← Back
Editing: plugin-vendor.js
/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 9003 /*!**************************************!*\ !*** ./assets/js/dupli-namespace.js ***! \**************************************/ () { /** * Global Namespace Definitions * * This file defines the global JavaScript namespaces for the Duplicator plugin. * Core-level namespaces only. Addon namespaces are declared by each addon. */ // Main namespace window.DupliJs = window.DupliJs || {}; // Package operations DupliJs.Pack = DupliJs.Pack || {}; // Settings operations DupliJs.Settings = DupliJs.Settings || {}; // Storage operations DupliJs.Storage = DupliJs.Storage || {}; DupliJs.Storage.Local = DupliJs.Storage.Local || {}; // Support operations DupliJs.Support = DupliJs.Support || {}; // Tools operations DupliJs.Tools = DupliJs.Tools || {}; // UI utilities DupliJs.UI = DupliJs.UI || {}; // Utility functions DupliJs.Util = DupliJs.Util || {}; // Debug utilities DupliJs.Debug = DupliJs.Debug || {}; // Help system DupliJs.Help = DupliJs.Help || {}; // Third-party libraries namespace DupliJs.Libs = DupliJs.Libs || {}; /***/ }, /***/ 5174 /*!*****************************************!*\ !*** ./assets/js/duplicator-tooltip.js ***! \*****************************************/ () { /*! dup tooltip */ (function ($) { /** * Safe wrapper for tippy operations - checks if instance exists and is not destroyed */ function safeCall(element, method, ...args) { var instance = element._tippy; if (instance && instance.state && !instance.state.isDestroyed) { return instance[method](...args); } return null; } DuplicatorTooltip = { initialized: false, messages: Object.assign( {}, { 'copy': 'Copy to Clipboard', 'copied': 'Copied to Clipboard', 'copyUnable': 'Unable to Copy' }, (typeof l10nDupTooltip === 'object' ? l10nDupTooltip : {}) ), load: function () { if (this.initialized) { return; } this.loadSelector('.duplicator-page .wrap [title], [data-tooltip]'); this.loadCopySelector('[data-dup-copy-value]'); this.initialized = true; }, loadSelector: function (selector) { $(selector).each(function () { if (this._tippy) { // already init return; } if (typeof $(this).data('tooltip') === 'undefined') { if (typeof $(this).attr('title') !== 'undefined' && $(this).attr('title') !== '') { $(this).attr('data-tooltip', $(this).attr('title') ); $(this).removeAttr('title'); } else { return; } } if (typeof $(this).data('tooltip-width') !== 'undefined') { $maxWdith = $(this).data('tooltip-width'); } else { $maxWdith = 350; } DupliJs.Libs.tippy(this, { content: function (ref) { var header = ref.dataset.tooltipTitle; var body = ref.dataset.tooltip; var res = header !== undefined ? '<h3>' + header + '</h3>' : ''; res += '<div class="dup-tippy-content">' + body + '</div>'; return res; }, allowHTML: true, interactive: true, placement: this.dataset.tooltipPlacement ? this.dataset.tooltipPlacement : 'bottom-start', theme: 'duplicator', zIndex: 900000, appendTo: document.body, maxWidth: $maxWdith, delay: 0, onCreate(instance) { instance.popper.childNodes.forEach((element) => { element.classList.add('dup-styles'); }); }, }); $(this).data('dup-tooltip-loaded', true); }); }, loadCopySelector: function (selector) { $(selector).each(function () { if (this._tippy) { // already init return; } var element = $(this); if (element.hasClass('disabled')) { return; } var tippyElement = DupliJs.Libs.tippy(this, { allowHTML: true, placement: this.dataset.tooltipPlacement ? this.dataset.tooltipPlacement : 'bottom-start', theme: 'duplicator', zIndex: 900000, hideOnClick: false, trigger: 'manual', delay: 0, onCreate(instance) { instance.popper.childNodes.forEach((element) => { element.classList.add('dup-styles'); }); }, }); var copyTitle = element.is('[data-dup-copy-title]') ? element.data('dup-copy-title') : DuplicatorTooltip.messages.copy; tippyElement.setContent('<div class="dup-tippy-content">' + copyTitle + '</div>'); //Have to set manually otherwise might hide on click. element.on('mouseenter.dupTooltip', function () { safeCall(this, 'show'); }).on('mouseleave.dupTooltip', function () { safeCall(this, 'hide'); }); element.on('click.dupTooltip', function () { var el = this; var valueToCopy = element.data('dup-copy-value'); var copiedTitle = element.is('[data-dup-copied-title]') ? element.data('dup-copied-title') : valueToCopy + ' ' + DuplicatorTooltip.messages.copied; var message = DuplicatorTooltip.messages.copyUnable; var tmpArea = jQuery("<textarea></textarea>").css({ position: 'absolute', top: '-10000px' }).text(valueToCopy).appendTo("body"); tmpArea.select(); try { message = document.execCommand('copy') ? copiedTitle : DuplicatorTooltip.messages.copyUnable; } catch (err) { console.log(err); } safeCall(el, 'setContent', '<div class="dup-tippy-content">' + message + '</div>'); safeCall(el, 'setProps', { theme: 'duplicator-filled' }); setTimeout(function () { safeCall(el, 'setContent', '<div class="dup-tippy-content">' + copyTitle + '</div>'); safeCall(el, 'setProps', { theme: 'duplicator' }); }, 2000); }); }); }, updateElementContent: function (selector, content) { if ($(selector).get(0)) { $(selector).get(0)._tippy.setContent('<div class="dup-tippy-content">' + content + '</div>'); } }, unload: function () { var tooltips = document.querySelectorAll('[data-tooltip], [data-dup-copy-value]'); tooltips.forEach(function (element) { // Remove event handlers to prevent memory leaks $(element).off('.dupTooltip'); if (element._tippy) { element._tippy.destroy(); element._tippy = null; } }); this.initialized = false; }, reload: function () { this.unload(); this.load(); } } })(jQuery); /***/ }, /***/ 5104 /*!***********************************!*\ !*** ./assets/js/dynamic-help.js ***! \***********************************/ () { jQuery(document).ready(function ($) { DupliJs.Help.Data = null; DupliJs.Help.isDataLoaded = function () { return DupliJs.Help.Data !== null; }; DupliJs.Help.ToggleCategory = function (categoryHeader) { $(categoryHeader).find(".fa-angle-right").toggleClass("fa-rotate-90"); $(categoryHeader).siblings(".dupli-help-article-list").slideToggle(); $(categoryHeader).siblings(".dupli-help-category-list").slideToggle(); }; DupliJs.Help.Search = function (search) { let results = $("#dupli-help-search-results"); let noResults = $("#dupli-help-search-results-empty"); let context = $("#dupli-context-articles"); let articles = $(".dupli-help-article"); let regex = DupliJs.Help.GetRegex(search); if (search.length === 0 && regex === null) { context.show(); results.hide(); noResults.hide(); return; } let found = false; let foundIds = []; context.hide(); results.empty(); articles.each(function () { let article = $(this); let id = article.data("id"); let title = article.find("a").text().toLowerCase(); if (title.search(regex) !== -1 && foundIds.indexOf(id) === -1) { found = true; results.append(article.clone()); foundIds.push(id); } }); if (found) { results.show(); noResults.hide(); } else { results.hide(); noResults.show(); } }; DupliJs.Help.Load = function (url) { if (DupliJs.Help.isDataLoaded()) { return; } $.ajax({ type: 'GET', url: url, beforeSend: function (xhr) { DupliJs.Util.ajaxProgressShow(); }, success: function (result) { DupliJs.Help.Data = result; //because ajax is async we need to open the modal here for first time DupliJs.Help.Display(); }, error: function (result) { DupliJs.addAdminMessage(l10nDupDynamicHelp.failedLoad, 'error'); }, complete: function () { DupliJs.Util.ajaxProgressHide(); }, }); }; DupliJs.Help.Display = function () { if (!DupliJs.Help.isDataLoaded()) { throw 'DupliJs.Help.Data is null'; } let box = new DuplicatorModalBox({ htmlContent: DupliJs.Help.Data, closeColor: '#000', fullscreen: true, }); box.open(); }; DupliJs.Help.GetRegex = function (search = '') { let regexStr = ''; let regex = null; if (search.length < 1) { return null; } $.each(search.split(' '), function (key, value) { //escape regex value = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); if (value.length > 1) { regexStr += '(?=.*' + value + ')'; } }); regex = new RegExp(regexStr, 'i'); return regex; }; $("body").on("click", ".dupli-help-category header", function () { DupliJs.Help.ToggleCategory(this); }); $("body").on("keyup", "#dupli-help-search input", function () { DupliJs.Help.Search($(this).val().toLowerCase()); }); }); /***/ }, /***/ 5446 /*!***************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/contains.js ***! \***************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ contains) /* harmony export */ }); function contains(parent, child) { // $FlowFixMe: hasOwnProperty doesn't seem to work in tests var isShadow = Boolean(child.getRootNode && child.getRootNode().host); // First, attempt with faster native method if (parent.contains(child)) { return true; } // then fallback to custom implementation with Shadow DOM support else if (isShadow) { var next = child; do { if (next && parent.isSameNode(next)) { return true; } // $FlowFixMe: need a better way to handle this... next = next.parentNode || next.host; } while (next); } // Give up, the result is false return false; } /***/ }, /***/ 6354 /*!****************************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js ***! \****************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getBoundingClientRect) /* harmony export */ }); function getBoundingClientRect(element) { var rect = element.getBoundingClientRect(); return { width: rect.width, height: rect.height, top: rect.top, right: rect.right, bottom: rect.bottom, left: rect.left, x: rect.left, y: rect.top }; } /***/ }, /***/ 2883 /*!**********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js ***! \**********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getClippingRect) /* harmony export */ }); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums.js */ 4278); /* harmony import */ var _getViewportRect_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getViewportRect.js */ 5487); /* harmony import */ var _getDocumentRect_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getDocumentRect.js */ 8848); /* harmony import */ var _listScrollParents_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./listScrollParents.js */ 3341); /* harmony import */ var _getOffsetParent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./getOffsetParent.js */ 5128); /* harmony import */ var _getDocumentElement_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./getDocumentElement.js */ 9760); /* harmony import */ var _getComputedStyle_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./getComputedStyle.js */ 271); /* harmony import */ var _instanceOf_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./instanceOf.js */ 5581); /* harmony import */ var _getBoundingClientRect_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./getBoundingClientRect.js */ 6354); /* harmony import */ var _getParentNode_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./getParentNode.js */ 2083); /* harmony import */ var _contains_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./contains.js */ 5446); /* harmony import */ var _getNodeName_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./getNodeName.js */ 7604); /* harmony import */ var _utils_rectToClientRect_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../utils/rectToClientRect.js */ 4426); function getInnerBoundingClientRect(element) { var rect = (0,_getBoundingClientRect_js__WEBPACK_IMPORTED_MODULE_8__["default"])(element); rect.top = rect.top + element.clientTop; rect.left = rect.left + element.clientLeft; rect.bottom = rect.top + element.clientHeight; rect.right = rect.left + element.clientWidth; rect.width = element.clientWidth; rect.height = element.clientHeight; rect.x = rect.left; rect.y = rect.top; return rect; } function getClientRectFromMixedType(element, clippingParent) { return clippingParent === _enums_js__WEBPACK_IMPORTED_MODULE_0__.viewport ? (0,_utils_rectToClientRect_js__WEBPACK_IMPORTED_MODULE_12__["default"])((0,_getViewportRect_js__WEBPACK_IMPORTED_MODULE_1__["default"])(element)) : (0,_instanceOf_js__WEBPACK_IMPORTED_MODULE_7__.isHTMLElement)(clippingParent) ? getInnerBoundingClientRect(clippingParent) : (0,_utils_rectToClientRect_js__WEBPACK_IMPORTED_MODULE_12__["default"])((0,_getDocumentRect_js__WEBPACK_IMPORTED_MODULE_2__["default"])((0,_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_5__["default"])(element))); } // A "clipping parent" is an overflowable container with the characteristic of // clipping (or hiding) overflowing elements with a position different from // `initial` function getClippingParents(element) { var clippingParents = (0,_listScrollParents_js__WEBPACK_IMPORTED_MODULE_3__["default"])((0,_getParentNode_js__WEBPACK_IMPORTED_MODULE_9__["default"])(element)); var canEscapeClipping = ['absolute', 'fixed'].indexOf((0,_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_6__["default"])(element).position) >= 0; var clipperElement = canEscapeClipping && (0,_instanceOf_js__WEBPACK_IMPORTED_MODULE_7__.isHTMLElement)(element) ? (0,_getOffsetParent_js__WEBPACK_IMPORTED_MODULE_4__["default"])(element) : element; if (!(0,_instanceOf_js__WEBPACK_IMPORTED_MODULE_7__.isElement)(clipperElement)) { return []; } // $FlowFixMe: https://github.com/facebook/flow/issues/1414 return clippingParents.filter(function (clippingParent) { return (0,_instanceOf_js__WEBPACK_IMPORTED_MODULE_7__.isElement)(clippingParent) && (0,_contains_js__WEBPACK_IMPORTED_MODULE_10__["default"])(clippingParent, clipperElement) && (0,_getNodeName_js__WEBPACK_IMPORTED_MODULE_11__["default"])(clippingParent) !== 'body'; }); } // Gets the maximum area that the element is visible in due to any number of // clipping parents function getClippingRect(element, boundary, rootBoundary) { var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary); var clippingParents = [].concat(mainClippingParents, [rootBoundary]); var firstClippingParent = clippingParents[0]; var clippingRect = clippingParents.reduce(function (accRect, clippingParent) { var rect = getClientRectFromMixedType(element, clippingParent); accRect.top = Math.max(rect.top, accRect.top); accRect.right = Math.min(rect.right, accRect.right); accRect.bottom = Math.min(rect.bottom, accRect.bottom); accRect.left = Math.max(rect.left, accRect.left); return accRect; }, getClientRectFromMixedType(element, firstClippingParent)); clippingRect.width = clippingRect.right - clippingRect.left; clippingRect.height = clippingRect.bottom - clippingRect.top; clippingRect.x = clippingRect.left; clippingRect.y = clippingRect.top; return clippingRect; } /***/ }, /***/ 7310 /*!***********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js ***! \***********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getCompositeRect) /* harmony export */ }); /* harmony import */ var _getBoundingClientRect_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getBoundingClientRect.js */ 6354); /* harmony import */ var _getNodeScroll_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getNodeScroll.js */ 3318); /* harmony import */ var _getNodeName_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getNodeName.js */ 7604); /* harmony import */ var _instanceOf_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./instanceOf.js */ 5581); /* harmony import */ var _getWindowScrollBarX_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./getWindowScrollBarX.js */ 793); /* harmony import */ var _getDocumentElement_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./getDocumentElement.js */ 9760); /* harmony import */ var _isScrollParent_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isScrollParent.js */ 134); // Returns the composite rect of an element relative to its offsetParent. // Composite means it takes into account transforms as well as layout. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) { if (isFixed === void 0) { isFixed = false; } var documentElement = (0,_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_5__["default"])(offsetParent); var rect = (0,_getBoundingClientRect_js__WEBPACK_IMPORTED_MODULE_0__["default"])(elementOrVirtualElement); var isOffsetParentAnElement = (0,_instanceOf_js__WEBPACK_IMPORTED_MODULE_3__.isHTMLElement)(offsetParent); var scroll = { scrollLeft: 0, scrollTop: 0 }; var offsets = { x: 0, y: 0 }; if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { if ((0,_getNodeName_js__WEBPACK_IMPORTED_MODULE_2__["default"])(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078 (0,_isScrollParent_js__WEBPACK_IMPORTED_MODULE_6__["default"])(documentElement)) { scroll = (0,_getNodeScroll_js__WEBPACK_IMPORTED_MODULE_1__["default"])(offsetParent); } if ((0,_instanceOf_js__WEBPACK_IMPORTED_MODULE_3__.isHTMLElement)(offsetParent)) { offsets = (0,_getBoundingClientRect_js__WEBPACK_IMPORTED_MODULE_0__["default"])(offsetParent); offsets.x += offsetParent.clientLeft; offsets.y += offsetParent.clientTop; } else if (documentElement) { offsets.x = (0,_getWindowScrollBarX_js__WEBPACK_IMPORTED_MODULE_4__["default"])(documentElement); } } return { x: rect.left + scroll.scrollLeft - offsets.x, y: rect.top + scroll.scrollTop - offsets.y, width: rect.width, height: rect.height }; } /***/ }, /***/ 271 /*!***********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js ***! \***********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getComputedStyle) /* harmony export */ }); /* harmony import */ var _getWindow_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getWindow.js */ 8979); function getComputedStyle(element) { return (0,_getWindow_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element).getComputedStyle(element); } /***/ }, /***/ 9760 /*!*************************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js ***! \*************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getDocumentElement) /* harmony export */ }); /* harmony import */ var _instanceOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./instanceOf.js */ 5581); function getDocumentElement(element) { // $FlowFixMe: assume body is always available return ((0,_instanceOf_js__WEBPACK_IMPORTED_MODULE_0__.isElement)(element) ? element.ownerDocument : element.document).documentElement; } /***/ }, /***/ 8848 /*!**********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js ***! \**********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getDocumentRect) /* harmony export */ }); /* harmony import */ var _getDocumentElement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getDocumentElement.js */ 9760); /* harmony import */ var _getComputedStyle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getComputedStyle.js */ 271); /* harmony import */ var _getWindowScrollBarX_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getWindowScrollBarX.js */ 793); /* harmony import */ var _getWindowScroll_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./getWindowScroll.js */ 222); // Gets the entire size of the scrollable document area, even extending outside // of the `<html>` and `<body>` rect bounds if horizontally scrollable function getDocumentRect(element) { var html = (0,_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element); var winScroll = (0,_getWindowScroll_js__WEBPACK_IMPORTED_MODULE_3__["default"])(element); var body = element.ownerDocument.body; var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); var x = -winScroll.scrollLeft + (0,_getWindowScrollBarX_js__WEBPACK_IMPORTED_MODULE_2__["default"])(element); var y = -winScroll.scrollTop; if ((0,_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_1__["default"])(body || html).direction === 'rtl') { x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width; } return { width: width, height: height, x: x, y: y }; } /***/ }, /***/ 6233 /*!***************************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js ***! \***************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getHTMLElementScroll) /* harmony export */ }); function getHTMLElementScroll(element) { return { scrollLeft: element.scrollLeft, scrollTop: element.scrollTop }; } /***/ }, /***/ 6979 /*!********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js ***! \********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getLayoutRect) /* harmony export */ }); // Returns the layout rect of an element relative to its offsetParent. Layout // means it doesn't take into account transforms. function getLayoutRect(element) { return { x: element.offsetLeft, y: element.offsetTop, width: element.offsetWidth, height: element.offsetHeight }; } /***/ }, /***/ 7604 /*!******************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getNodeName.js ***! \******************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getNodeName) /* harmony export */ }); function getNodeName(element) { return element ? (element.nodeName || '').toLowerCase() : null; } /***/ }, /***/ 3318 /*!********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js ***! \********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getNodeScroll) /* harmony export */ }); /* harmony import */ var _getWindowScroll_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getWindowScroll.js */ 222); /* harmony import */ var _getWindow_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getWindow.js */ 8979); /* harmony import */ var _instanceOf_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./instanceOf.js */ 5581); /* harmony import */ var _getHTMLElementScroll_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./getHTMLElementScroll.js */ 6233); function getNodeScroll(node) { if (node === (0,_getWindow_js__WEBPACK_IMPORTED_MODULE_1__["default"])(node) || !(0,_instanceOf_js__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(node)) { return (0,_getWindowScroll_js__WEBPACK_IMPORTED_MODULE_0__["default"])(node); } else { return (0,_getHTMLElementScroll_js__WEBPACK_IMPORTED_MODULE_3__["default"])(node); } } /***/ }, /***/ 5128 /*!**********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js ***! \**********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getOffsetParent) /* harmony export */ }); /* harmony import */ var _getWindow_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getWindow.js */ 8979); /* harmony import */ var _getNodeName_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getNodeName.js */ 7604); /* harmony import */ var _getComputedStyle_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getComputedStyle.js */ 271); /* harmony import */ var _instanceOf_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./instanceOf.js */ 5581); /* harmony import */ var _isTableElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./isTableElement.js */ 2063); /* harmony import */ var _getParentNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./getParentNode.js */ 2083); /* harmony import */ var _getDocumentElement_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./getDocumentElement.js */ 9760); function getTrueOffsetParent(element) { if (!(0,_instanceOf_js__WEBPACK_IMPORTED_MODULE_3__.isHTMLElement)(element) || // https://github.com/popperjs/popper-core/issues/837 (0,_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_2__["default"])(element).position === 'fixed') { return null; } var offsetParent = element.offsetParent; if (offsetParent) { var html = (0,_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_6__["default"])(offsetParent); if ((0,_getNodeName_js__WEBPACK_IMPORTED_MODULE_1__["default"])(offsetParent) === 'body' && (0,_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_2__["default"])(offsetParent).position === 'static' && (0,_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_2__["default"])(html).position !== 'static') { return html; } } return offsetParent; } // `.offsetParent` reports `null` for fixed elements, while absolute elements // return the containing block function getContainingBlock(element) { var currentNode = (0,_getParentNode_js__WEBPACK_IMPORTED_MODULE_5__["default"])(element); while ((0,_instanceOf_js__WEBPACK_IMPORTED_MODULE_3__.isHTMLElement)(currentNode) && ['html', 'body'].indexOf((0,_getNodeName_js__WEBPACK_IMPORTED_MODULE_1__["default"])(currentNode)) < 0) { var css = (0,_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_2__["default"])(currentNode); // This is non-exhaustive but covers the most common CSS properties that // create a containing block. if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') { return currentNode; } else { currentNode = currentNode.parentNode; } } return null; } // Gets the closest ancestor positioned element. Handles some edge cases, // such as table ancestors and cross browser bugs. function getOffsetParent(element) { var window = (0,_getWindow_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element); var offsetParent = getTrueOffsetParent(element); while (offsetParent && (0,_isTableElement_js__WEBPACK_IMPORTED_MODULE_4__["default"])(offsetParent) && (0,_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_2__["default"])(offsetParent).position === 'static') { offsetParent = getTrueOffsetParent(offsetParent); } if (offsetParent && (0,_getNodeName_js__WEBPACK_IMPORTED_MODULE_1__["default"])(offsetParent) === 'body' && (0,_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_2__["default"])(offsetParent).position === 'static') { return window; } return offsetParent || getContainingBlock(element) || window; } /***/ }, /***/ 2083 /*!********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getParentNode.js ***! \********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getParentNode) /* harmony export */ }); /* harmony import */ var _getNodeName_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getNodeName.js */ 7604); /* harmony import */ var _getDocumentElement_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getDocumentElement.js */ 9760); function getParentNode(element) { if ((0,_getNodeName_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element) === 'html') { return element; } return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle element.assignedSlot || // step into the shadow DOM of the parent of a slotted node element.parentNode || // DOM Element detected // $FlowFixMe: need a better way to handle this... element.host || // ShadowRoot detected // $FlowFixMe: HTMLElement is a Node (0,_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_1__["default"])(element) // fallback ); } /***/ }, /***/ 9970 /*!**********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js ***! \**********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getScrollParent) /* harmony export */ }); /* harmony import */ var _getParentNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getParentNode.js */ 2083); /* harmony import */ var _isScrollParent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isScrollParent.js */ 134); /* harmony import */ var _getNodeName_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getNodeName.js */ 7604); /* harmony import */ var _instanceOf_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./instanceOf.js */ 5581); function getScrollParent(node) { if (['html', 'body', '#document'].indexOf((0,_getNodeName_js__WEBPACK_IMPORTED_MODULE_2__["default"])(node)) >= 0) { // $FlowFixMe: assume body is always available return node.ownerDocument.body; } if ((0,_instanceOf_js__WEBPACK_IMPORTED_MODULE_3__.isHTMLElement)(node) && (0,_isScrollParent_js__WEBPACK_IMPORTED_MODULE_1__["default"])(node)) { return node; } return getScrollParent((0,_getParentNode_js__WEBPACK_IMPORTED_MODULE_0__["default"])(node)); } /***/ }, /***/ 5487 /*!**********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js ***! \**********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getViewportRect) /* harmony export */ }); /* harmony import */ var _getWindow_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getWindow.js */ 8979); /* harmony import */ var _getDocumentElement_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getDocumentElement.js */ 9760); /* harmony import */ var _getWindowScrollBarX_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getWindowScrollBarX.js */ 793); function getViewportRect(element) { var win = (0,_getWindow_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element); var html = (0,_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_1__["default"])(element); var visualViewport = win.visualViewport; var width = html.clientWidth; var height = html.clientHeight; var x = 0; var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper // can be obscured underneath it. // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even // if it isn't open, so if this isn't available, the popper will be detected // to overflow the bottom of the screen too early. if (visualViewport) { width = visualViewport.width; height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently) // In Chrome, it returns a value very close to 0 (+/-) but contains rounding // errors due to floating point numbers, so we need to check precision. // Safari returns a number <= 0, usually < -1 when pinch-zoomed // Feature detection fails in mobile emulation mode in Chrome. // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) < // 0.001 // Fallback here: "Not Safari" userAgent if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) { x = visualViewport.offsetLeft; y = visualViewport.offsetTop; } } return { width: width, height: height, x: x + (0,_getWindowScrollBarX_js__WEBPACK_IMPORTED_MODULE_2__["default"])(element), y: y }; } /***/ }, /***/ 8979 /*!****************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getWindow.js ***! \****************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getWindow) /* harmony export */ }); /*:: import type { Window } from '../types'; */ /*:: declare function getWindow(node: Node | Window): Window; */ function getWindow(node) { if (node.toString() !== '[object Window]') { var ownerDocument = node.ownerDocument; return ownerDocument ? ownerDocument.defaultView : window; } return node; } /***/ }, /***/ 222 /*!**********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js ***! \**********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getWindowScroll) /* harmony export */ }); /* harmony import */ var _getWindow_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getWindow.js */ 8979); function getWindowScroll(node) { var win = (0,_getWindow_js__WEBPACK_IMPORTED_MODULE_0__["default"])(node); var scrollLeft = win.pageXOffset; var scrollTop = win.pageYOffset; return { scrollLeft: scrollLeft, scrollTop: scrollTop }; } /***/ }, /***/ 793 /*!**************************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js ***! \**************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getWindowScrollBarX) /* harmony export */ }); /* harmony import */ var _getBoundingClientRect_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getBoundingClientRect.js */ 6354); /* harmony import */ var _getDocumentElement_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getDocumentElement.js */ 9760); /* harmony import */ var _getWindowScroll_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getWindowScroll.js */ 222); function getWindowScrollBarX(element) { // If <html> has a CSS width greater than the viewport, then this will be // incorrect for RTL. // Popper 1 is broken in this case and never had a bug report so let's assume // it's not an issue. I don't think anyone ever specifies width on <html> // anyway. // Browsers where the left scrollbar doesn't cause an issue report `0` for // this (e.g. Edge 2019, IE11, Safari) return (0,_getBoundingClientRect_js__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_1__["default"])(element)).left + (0,_getWindowScroll_js__WEBPACK_IMPORTED_MODULE_2__["default"])(element).scrollLeft; } /***/ }, /***/ 5581 /*!*****************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/instanceOf.js ***! \*****************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ isElement: () => (/* binding */ isElement), /* harmony export */ isHTMLElement: () => (/* binding */ isHTMLElement) /* harmony export */ }); /* harmony import */ var _getWindow_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getWindow.js */ 8979); /*:: declare function isElement(node: mixed): boolean %checks(node instanceof Element); */ function isElement(node) { var OwnElement = (0,_getWindow_js__WEBPACK_IMPORTED_MODULE_0__["default"])(node).Element; return node instanceof OwnElement || node instanceof Element; } /*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof HTMLElement); */ function isHTMLElement(node) { var OwnElement = (0,_getWindow_js__WEBPACK_IMPORTED_MODULE_0__["default"])(node).HTMLElement; return node instanceof OwnElement || node instanceof HTMLElement; } /***/ }, /***/ 134 /*!*********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js ***! \*********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ isScrollParent) /* harmony export */ }); /* harmony import */ var _getComputedStyle_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getComputedStyle.js */ 271); function isScrollParent(element) { // Firefox wants us to check `-x` and `-y` variations as well var _getComputedStyle = (0,_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY; return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX); } /***/ }, /***/ 2063 /*!*********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/isTableElement.js ***! \*********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ isTableElement) /* harmony export */ }); /* harmony import */ var _getNodeName_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getNodeName.js */ 7604); function isTableElement(element) { return ['table', 'td', 'th'].indexOf((0,_getNodeName_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element)) >= 0; } /***/ }, /***/ 3341 /*!************************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js ***! \************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ listScrollParents) /* harmony export */ }); /* harmony import */ var _getScrollParent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getScrollParent.js */ 9970); /* harmony import */ var _getParentNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getParentNode.js */ 2083); /* harmony import */ var _getNodeName_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getNodeName.js */ 7604); /* harmony import */ var _getWindow_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./getWindow.js */ 8979); /* harmony import */ var _isScrollParent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./isScrollParent.js */ 134); /* given a DOM element, return the list of all scroll parents, up the list of ancesors until we get to the top window object. This list is what we attach scroll listeners to, because if any of these parent elements scroll, we'll need to re-calculate the reference element's position. */ function listScrollParents(element, list) { if (list === void 0) { list = []; } var scrollParent = (0,_getScrollParent_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element); var isBody = (0,_getNodeName_js__WEBPACK_IMPORTED_MODULE_2__["default"])(scrollParent) === 'body'; var win = (0,_getWindow_js__WEBPACK_IMPORTED_MODULE_3__["default"])(scrollParent); var target = isBody ? [win].concat(win.visualViewport || [], (0,_isScrollParent_js__WEBPACK_IMPORTED_MODULE_4__["default"])(scrollParent) ? scrollParent : []) : scrollParent; var updatedList = list.concat(target); return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here updatedList.concat(listScrollParents((0,_getParentNode_js__WEBPACK_IMPORTED_MODULE_1__["default"])(target))); } /***/ }, /***/ 4278 /*!**************************************************!*\ !*** ./node_modules/@popperjs/core/lib/enums.js ***! \**************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ afterMain: () => (/* binding */ afterMain), /* harmony export */ afterRead: () => (/* binding */ afterRead), /* harmony export */ afterWrite: () => (/* binding */ afterWrite), /* harmony export */ auto: () => (/* binding */ auto), /* harmony export */ basePlacements: () => (/* binding */ basePlacements), /* harmony export */ beforeMain: () => (/* binding */ beforeMain), /* harmony export */ beforeRead: () => (/* binding */ beforeRead), /* harmony export */ beforeWrite: () => (/* binding */ beforeWrite), /* harmony export */ bottom: () => (/* binding */ bottom), /* harmony export */ clippingParents: () => (/* binding */ clippingParents), /* harmony export */ end: () => (/* binding */ end), /* harmony export */ left: () => (/* binding */ left), /* harmony export */ main: () => (/* binding */ main), /* harmony export */ modifierPhases: () => (/* binding */ modifierPhases), /* harmony export */ placements: () => (/* binding */ placements), /* harmony export */ popper: () => (/* binding */ popper), /* harmony export */ read: () => (/* binding */ read), /* harmony export */ reference: () => (/* binding */ reference), /* harmony export */ right: () => (/* binding */ right), /* harmony export */ start: () => (/* binding */ start), /* harmony export */ top: () => (/* binding */ top), /* harmony export */ variationPlacements: () => (/* binding */ variationPlacements), /* harmony export */ viewport: () => (/* binding */ viewport), /* harmony export */ write: () => (/* binding */ write) /* harmony export */ }); var top = 'top'; var bottom = 'bottom'; var right = 'right'; var left = 'left'; var auto = 'auto'; var basePlacements = [top, bottom, right, left]; var start = 'start'; var end = 'end'; var clippingParents = 'clippingParents'; var viewport = 'viewport'; var popper = 'popper'; var reference = 'reference'; var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) { return acc.concat([placement + "-" + start, placement + "-" + end]); }, []); var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) { return acc.concat([placement, placement + "-" + start, placement + "-" + end]); }, []); // modifiers that need to read the DOM var beforeRead = 'beforeRead'; var read = 'read'; var afterRead = 'afterRead'; // pure-logic modifiers var beforeMain = 'beforeMain'; var main = 'main'; var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state) var beforeWrite = 'beforeWrite'; var write = 'write'; var afterWrite = 'afterWrite'; var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite]; /***/ }, /***/ 4036 /*!**************************************************!*\ !*** ./node_modules/@popperjs/core/lib/index.js ***! \**************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ afterMain: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.afterMain), /* harmony export */ afterRead: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.afterRead), /* harmony export */ afterWrite: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.afterWrite), /* harmony export */ auto: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.auto), /* harmony export */ basePlacements: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.basePlacements), /* harmony export */ beforeMain: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.beforeMain), /* harmony export */ beforeRead: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.beforeRead), /* harmony export */ beforeWrite: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.beforeWrite), /* harmony export */ bottom: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.bottom), /* harmony export */ clippingParents: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.clippingParents), /* harmony export */ createPopper: () => (/* binding */ createPopper), /* harmony export */ detectOverflow: () => (/* reexport safe */ _utils_detectOverflow_js__WEBPACK_IMPORTED_MODULE_11__["default"]), /* harmony export */ end: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.end), /* harmony export */ left: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.left), /* harmony export */ main: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.main), /* harmony export */ modifierPhases: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.modifierPhases), /* harmony export */ placements: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.placements), /* harmony export */ popper: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.popper), /* harmony export */ popperGenerator: () => (/* binding */ popperGenerator), /* harmony export */ read: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.read), /* harmony export */ reference: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.reference), /* harmony export */ right: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.right), /* harmony export */ start: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.start), /* harmony export */ top: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.top), /* harmony export */ variationPlacements: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.variationPlacements), /* harmony export */ viewport: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.viewport), /* harmony export */ write: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_13__.write) /* harmony export */ }); /* harmony import */ var _dom_utils_getCompositeRect_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dom-utils/getCompositeRect.js */ 7310); /* harmony import */ var _dom_utils_getLayoutRect_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dom-utils/getLayoutRect.js */ 6979); /* harmony import */ var _dom_utils_listScrollParents_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dom-utils/listScrollParents.js */ 3341); /* harmony import */ var _dom_utils_getOffsetParent_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./dom-utils/getOffsetParent.js */ 5128); /* harmony import */ var _dom_utils_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./dom-utils/getComputedStyle.js */ 271); /* harmony import */ var _utils_orderModifiers_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/orderModifiers.js */ 1206); /* harmony import */ var _utils_debounce_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/debounce.js */ 571); /* harmony import */ var _utils_validateModifiers_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/validateModifiers.js */ 5246); /* harmony import */ var _utils_uniqueBy_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/uniqueBy.js */ 962); /* harmony import */ var _utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/getBasePlacement.js */ 2632); /* harmony import */ var _utils_mergeByName_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/mergeByName.js */ 844); /* harmony import */ var _utils_detectOverflow_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/detectOverflow.js */ 9913); /* harmony import */ var _dom_utils_instanceOf_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./dom-utils/instanceOf.js */ 5581); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./enums.js */ 4278); var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.'; var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.'; var DEFAULT_OPTIONS = { placement: 'bottom', modifiers: [], strategy: 'absolute' }; function areValidElements() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return !args.some(function (element) { return !(element && typeof element.getBoundingClientRect === 'function'); }); } function popperGenerator(generatorOptions) { if (generatorOptions === void 0) { generatorOptions = {}; } var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2; return function createPopper(reference, popper, options) { if (options === void 0) { options = defaultOptions; } var state = { placement: 'bottom', orderedModifiers: [], options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions), modifiersData: {}, elements: { reference: reference, popper: popper }, attributes: {}, styles: {} }; var effectCleanupFns = []; var isDestroyed = false; var instance = { state: state, setOptions: function setOptions(options) { cleanupModifierEffects(); state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options); state.scrollParents = { reference: (0,_dom_utils_instanceOf_js__WEBPACK_IMPORTED_MODULE_12__.isElement)(reference) ? (0,_dom_utils_listScrollParents_js__WEBPACK_IMPORTED_MODULE_2__["default"])(reference) : reference.contextElement ? (0,_dom_utils_listScrollParents_js__WEBPACK_IMPORTED_MODULE_2__["default"])(reference.contextElement) : [], popper: (0,_dom_utils_listScrollParents_js__WEBPACK_IMPORTED_MODULE_2__["default"])(popper) }; // Orders the modifiers based on their dependencies and `phase` // properties var orderedModifiers = (0,_utils_orderModifiers_js__WEBPACK_IMPORTED_MODULE_5__["default"])((0,_utils_mergeByName_js__WEBPACK_IMPORTED_MODULE_10__["default"])([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers state.orderedModifiers = orderedModifiers.filter(function (m) { return m.enabled; }); // Validate the provided modifiers so that the consumer will get warned // if one of the modifiers is invalid for any reason if (true) { var modifiers = (0,_utils_uniqueBy_js__WEBPACK_IMPORTED_MODULE_8__["default"])([].concat(orderedModifiers, state.options.modifiers), function (_ref) { var name = _ref.name; return name; }); (0,_utils_validateModifiers_js__WEBPACK_IMPORTED_MODULE_7__["default"])(modifiers); if ((0,_utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_9__["default"])(state.options.placement) === _enums_js__WEBPACK_IMPORTED_MODULE_13__.auto) { var flipModifier = state.orderedModifiers.find(function (_ref2) { var name = _ref2.name; return name === 'flip'; }); if (!flipModifier) { console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' ')); } } var _getComputedStyle = (0,_dom_utils_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_4__["default"])(popper), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can // cause bugs with positioning, so we'll warn the consumer if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) { return parseFloat(margin); })) { console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' ')); } } runModifierEffects(); return instance.update(); }, // Sync update – it will always be executed, even if not necessary. This // is useful for low frequency updates where sync behavior simplifies the // logic. // For high frequency updates (e.g. `resize` and `scroll` events), always // prefer the async Popper#update method forceUpdate: function forceUpdate() { if (isDestroyed) { return; } var _state$elements = state.elements, reference = _state$elements.reference, popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements // anymore if (!areValidElements(reference, popper)) { if (true) { console.error(INVALID_ELEMENT_ERROR); } return; } // Store the reference and popper rects to be read by modifiers state.rects = { reference: (0,_dom_utils_getCompositeRect_js__WEBPACK_IMPORTED_MODULE_0__["default"])(reference, (0,_dom_utils_getOffsetParent_js__WEBPACK_IMPORTED_MODULE_3__["default"])(popper), state.options.strategy === 'fixed'), popper: (0,_dom_utils_getLayoutRect_js__WEBPACK_IMPORTED_MODULE_1__["default"])(popper) }; // Modifiers have the ability to reset the current update cycle. The // most common use case for this is the `flip` modifier changing the // placement, which then needs to re-run all the modifiers, because the // logic was previously ran for the previous placement and is therefore // stale/incorrect state.reset = false; state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier // is filled with the initial data specified by the modifier. This means // it doesn't persist and is fresh on each update. // To ensure persistent data, use `${name}#persistent` state.orderedModifiers.forEach(function (modifier) { return state.modifiersData[modifier.name] = Object.assign({}, modifier.data); }); var __debug_loops__ = 0; for (var index = 0; index < state.orderedModifiers.length; index++) { if (true) { __debug_loops__ += 1; if (__debug_loops__ > 100) { console.error(INFINITE_LOOP_ERROR); break; } } if (state.reset === true) { state.reset = false; index = -1; continue; } var _state$orderedModifie = state.orderedModifiers[index], fn = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name; if (typeof fn === 'function') { state = fn({ state: state, options: _options, name: name, instance: instance }) || state; } } }, // Async and optimistically optimized update – it will not be executed if // not necessary (debounced to run at most once-per-tick) update: (0,_utils_debounce_js__WEBPACK_IMPORTED_MODULE_6__["default"])(function () { return new Promise(function (resolve) { instance.forceUpdate(); resolve(state); }); }), destroy: function destroy() { cleanupModifierEffects(); isDestroyed = true; } }; if (!areValidElements(reference, popper)) { if (true) { console.error(INVALID_ELEMENT_ERROR); } return instance; } instance.setOptions(options).then(function (state) { if (!isDestroyed && options.onFirstUpdate) { options.onFirstUpdate(state); } }); // Modifiers have the ability to execute arbitrary code before the first // update cycle runs. They will be executed in the same order as the update // cycle. This is useful when a modifier adds some persistent data that // other modifiers need to use, but the modifier is run after the dependent // one. function runModifierEffects() { state.orderedModifiers.forEach(function (_ref3) { var name = _ref3.name, _ref3$options = _ref3.options, options = _ref3$options === void 0 ? {} : _ref3$options, effect = _ref3.effect; if (typeof effect === 'function') { var cleanupFn = effect({ state: state, name: name, instance: instance, options: options }); var noopFn = function noopFn() {}; effectCleanupFns.push(cleanupFn || noopFn); } }); } function cleanupModifierEffects() { effectCleanupFns.forEach(function (fn) { return fn(); }); effectCleanupFns = []; } return instance; }; } var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules /***/ }, /***/ 6607 /*!******************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/modifiers/applyStyles.js ***! \******************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _dom_utils_getNodeName_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../dom-utils/getNodeName.js */ 7604); /* harmony import */ var _dom_utils_instanceOf_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dom-utils/instanceOf.js */ 5581); // This modifier takes the styles prepared by the `computeStyles` modifier // and applies them to the HTMLElements such as popper and arrow function applyStyles(_ref) { var state = _ref.state; Object.keys(state.elements).forEach(function (name) { var style = state.styles[name] || {}; var attributes = state.attributes[name] || {}; var element = state.elements[name]; // arrow is optional + virtual elements if (!(0,_dom_utils_instanceOf_js__WEBPACK_IMPORTED_MODULE_1__.isHTMLElement)(element) || !(0,_dom_utils_getNodeName_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element)) { return; } // Flow doesn't support to extend this property, but it's the most // effective way to apply styles to an HTMLElement // $FlowFixMe Object.assign(element.style, style); Object.keys(attributes).forEach(function (name) { var value = attributes[name]; if (value === false) { element.removeAttribute(name); } else { element.setAttribute(name, value === true ? '' : value); } }); }); } function effect(_ref2) { var state = _ref2.state; var initialStyles = { popper: { position: state.options.strategy, left: '0', top: '0', margin: '0' }, arrow: { position: 'absolute' }, reference: {} }; Object.assign(state.elements.popper.style, initialStyles.popper); if (state.elements.arrow) { Object.assign(state.elements.arrow.style, initialStyles.arrow); } return function () { Object.keys(state.elements).forEach(function (name) { var element = state.elements[name]; var attributes = state.attributes[name] || {}; var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them var style = styleProperties.reduce(function (style, property) { style[property] = ''; return style; }, {}); // arrow is optional + virtual elements if (!(0,_dom_utils_instanceOf_js__WEBPACK_IMPORTED_MODULE_1__.isHTMLElement)(element) || !(0,_dom_utils_getNodeName_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element)) { return; } // Flow doesn't support to extend this property, but it's the most // effective way to apply styles to an HTMLElement // $FlowFixMe Object.assign(element.style, style); Object.keys(attributes).forEach(function (attribute) { element.removeAttribute(attribute); }); }); }; } // eslint-disable-next-line import/no-unused-modules /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ name: 'applyStyles', enabled: true, phase: 'write', fn: applyStyles, effect: effect, requires: ['computeStyles'] }); /***/ }, /***/ 8256 /*!************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/modifiers/arrow.js ***! \************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/getBasePlacement.js */ 2632); /* harmony import */ var _dom_utils_getLayoutRect_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dom-utils/getLayoutRect.js */ 6979); /* harmony import */ var _dom_utils_contains_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dom-utils/contains.js */ 5446); /* harmony import */ var _dom_utils_getOffsetParent_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../dom-utils/getOffsetParent.js */ 5128); /* harmony import */ var _utils_getMainAxisFromPlacement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/getMainAxisFromPlacement.js */ 9703); /* harmony import */ var _utils_within_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/within.js */ 6523); /* harmony import */ var _utils_mergePaddingObject_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/mergePaddingObject.js */ 4318); /* harmony import */ var _utils_expandToHashMap_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/expandToHashMap.js */ 1007); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../enums.js */ 4278); /* harmony import */ var _dom_utils_instanceOf_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../dom-utils/instanceOf.js */ 5581); // eslint-disable-next-line import/no-unused-modules function arrow(_ref) { var _state$modifiersData$; var state = _ref.state, name = _ref.name; var arrowElement = state.elements.arrow; var popperOffsets = state.modifiersData.popperOffsets; var basePlacement = (0,_utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_0__["default"])(state.placement); var axis = (0,_utils_getMainAxisFromPlacement_js__WEBPACK_IMPORTED_MODULE_4__["default"])(basePlacement); var isVertical = [_enums_js__WEBPACK_IMPORTED_MODULE_8__.left, _enums_js__WEBPACK_IMPORTED_MODULE_8__.right].indexOf(basePlacement) >= 0; var len = isVertical ? 'height' : 'width'; if (!arrowElement || !popperOffsets) { return; } var paddingObject = state.modifiersData[name + "#persistent"].padding; var arrowRect = (0,_dom_utils_getLayoutRect_js__WEBPACK_IMPORTED_MODULE_1__["default"])(arrowElement); var minProp = axis === 'y' ? _enums_js__WEBPACK_IMPORTED_MODULE_8__.top : _enums_js__WEBPACK_IMPORTED_MODULE_8__.left; var maxProp = axis === 'y' ? _enums_js__WEBPACK_IMPORTED_MODULE_8__.bottom : _enums_js__WEBPACK_IMPORTED_MODULE_8__.right; var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len]; var startDiff = popperOffsets[axis] - state.rects.reference[axis]; var arrowOffsetParent = (0,_dom_utils_getOffsetParent_js__WEBPACK_IMPORTED_MODULE_3__["default"])(arrowElement); var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0; var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is // outside of the popper bounds var min = paddingObject[minProp]; var max = clientSize - arrowRect[len] - paddingObject[maxProp]; var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference; var offset = (0,_utils_within_js__WEBPACK_IMPORTED_MODULE_5__["default"])(min, center, max); // Prevents breaking syntax highlighting... var axisProp = axis; state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$); } function effect(_ref2) { var state = _ref2.state, options = _ref2.options, name = _ref2.name; var _options$element = options.element, arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element, _options$padding = options.padding, padding = _options$padding === void 0 ? 0 : _options$padding; if (arrowElement == null) { return; } // CSS selector if (typeof arrowElement === 'string') { arrowElement = state.elements.popper.querySelector(arrowElement); if (!arrowElement) { return; } } if (true) { if (!(0,_dom_utils_instanceOf_js__WEBPACK_IMPORTED_MODULE_9__.isHTMLElement)(arrowElement)) { console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' ')); } } if (!(0,_dom_utils_contains_js__WEBPACK_IMPORTED_MODULE_2__["default"])(state.elements.popper, arrowElement)) { if (true) { console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' ')); } return; } state.elements.arrow = arrowElement; state.modifiersData[name + "#persistent"] = { padding: (0,_utils_mergePaddingObject_js__WEBPACK_IMPORTED_MODULE_6__["default"])(typeof padding !== 'number' ? padding : (0,_utils_expandToHashMap_js__WEBPACK_IMPORTED_MODULE_7__["default"])(padding, _enums_js__WEBPACK_IMPORTED_MODULE_8__.basePlacements)) }; } // eslint-disable-next-line import/no-unused-modules /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ name: 'arrow', enabled: true, phase: 'main', fn: arrow, effect: effect, requires: ['popperOffsets'], requiresIfExists: ['preventOverflow'] }); /***/ }, /***/ 1262 /*!********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/modifiers/computeStyles.js ***! \********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ mapToStyles: () => (/* binding */ mapToStyles) /* harmony export */ }); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums.js */ 4278); /* harmony import */ var _dom_utils_getOffsetParent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dom-utils/getOffsetParent.js */ 5128); /* harmony import */ var _dom_utils_getWindow_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dom-utils/getWindow.js */ 8979); /* harmony import */ var _dom_utils_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../dom-utils/getDocumentElement.js */ 9760); /* harmony import */ var _dom_utils_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../dom-utils/getComputedStyle.js */ 271); /* harmony import */ var _utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/getBasePlacement.js */ 2632); // eslint-disable-next-line import/no-unused-modules var unsetSides = { top: 'auto', right: 'auto', bottom: 'auto', left: 'auto' }; // Round the offsets to the nearest suitable subpixel based on the DPR. // Zooming can change the DPR, but it seems to report a value that will // cleanly divide the values into the appropriate subpixels. function roundOffsets(_ref) { var x = _ref.x, y = _ref.y; var win = window; var dpr = win.devicePixelRatio || 1; return { x: Math.round(x * dpr) / dpr || 0, y: Math.round(y * dpr) / dpr || 0 }; } function mapToStyles(_ref2) { var _Object$assign2; var popper = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive; var _roundOffsets = roundOffsets(offsets), x = _roundOffsets.x, y = _roundOffsets.y; var hasX = offsets.hasOwnProperty('x'); var hasY = offsets.hasOwnProperty('y'); var sideX = _enums_js__WEBPACK_IMPORTED_MODULE_0__.left; var sideY = _enums_js__WEBPACK_IMPORTED_MODULE_0__.top; var win = window; if (adaptive) { var offsetParent = (0,_dom_utils_getOffsetParent_js__WEBPACK_IMPORTED_MODULE_1__["default"])(popper); if (offsetParent === (0,_dom_utils_getWindow_js__WEBPACK_IMPORTED_MODULE_2__["default"])(popper)) { offsetParent = (0,_dom_utils_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_3__["default"])(popper); } // $FlowFixMe: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it /*:: offsetParent = (offsetParent: Element); */ if (placement === _enums_js__WEBPACK_IMPORTED_MODULE_0__.top) { sideY = _enums_js__WEBPACK_IMPORTED_MODULE_0__.bottom; y -= offsetParent.clientHeight - popperRect.height; y *= gpuAcceleration ? 1 : -1; } if (placement === _enums_js__WEBPACK_IMPORTED_MODULE_0__.left) { sideX = _enums_js__WEBPACK_IMPORTED_MODULE_0__.right; x -= offsetParent.clientWidth - popperRect.width; x *= gpuAcceleration ? 1 : -1; } } var commonStyles = Object.assign({ position: position }, adaptive && unsetSides); if (gpuAcceleration) { var _Object$assign; return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign)); } return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2)); } function computeStyles(_ref3) { var state = _ref3.state, options = _ref3.options; var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive; if (true) { var transitionProperty = (0,_dom_utils_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_4__["default"])(state.elements.popper).transitionProperty || ''; if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) { return transitionProperty.indexOf(property) >= 0; })) { console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' ')); } } var commonStyles = { placement: (0,_utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_5__["default"])(state.placement), popper: state.elements.popper, popperRect: state.rects.popper, gpuAcceleration: gpuAcceleration }; if (state.modifiersData.popperOffsets != null) { state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, { offsets: state.modifiersData.popperOffsets, position: state.options.strategy, adaptive: adaptive }))); } if (state.modifiersData.arrow != null) { state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, { offsets: state.modifiersData.arrow, position: 'absolute', adaptive: false }))); } state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, { 'data-popper-placement': state.placement }); } // eslint-disable-next-line import/no-unused-modules /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ name: 'computeStyles', enabled: true, phase: 'beforeWrite', fn: computeStyles, data: {} }); /***/ }, /***/ 9068 /*!*********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/modifiers/eventListeners.js ***! \*********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _dom_utils_getWindow_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../dom-utils/getWindow.js */ 8979); // eslint-disable-next-line import/no-unused-modules var passive = { passive: true }; function effect(_ref) { var state = _ref.state, instance = _ref.instance, options = _ref.options; var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize; var window = (0,_dom_utils_getWindow_js__WEBPACK_IMPORTED_MODULE_0__["default"])(state.elements.popper); var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper); if (scroll) { scrollParents.forEach(function (scrollParent) { scrollParent.addEventListener('scroll', instance.update, passive); }); } if (resize) { window.addEventListener('resize', instance.update, passive); } return function () { if (scroll) { scrollParents.forEach(function (scrollParent) { scrollParent.removeEventListener('scroll', instance.update, passive); }); } if (resize) { window.removeEventListener('resize', instance.update, passive); } }; } // eslint-disable-next-line import/no-unused-modules /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ name: 'eventListeners', enabled: true, phase: 'write', fn: function fn() {}, effect: effect, data: {} }); /***/ }, /***/ 958 /*!***********************************************************!*\ !*** ./node_modules/@popperjs/core/lib/modifiers/flip.js ***! \***********************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _utils_getOppositePlacement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/getOppositePlacement.js */ 1688); /* harmony import */ var _utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/getBasePlacement.js */ 2632); /* harmony import */ var _utils_getOppositeVariationPlacement_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/getOppositeVariationPlacement.js */ 6771); /* harmony import */ var _utils_detectOverflow_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/detectOverflow.js */ 9913); /* harmony import */ var _utils_computeAutoPlacement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/computeAutoPlacement.js */ 6281); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../enums.js */ 4278); /* harmony import */ var _utils_getVariation_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/getVariation.js */ 8101); // eslint-disable-next-line import/no-unused-modules function getExpandedFallbackPlacements(placement) { if ((0,_utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_1__["default"])(placement) === _enums_js__WEBPACK_IMPORTED_MODULE_5__.auto) { return []; } var oppositePlacement = (0,_utils_getOppositePlacement_js__WEBPACK_IMPORTED_MODULE_0__["default"])(placement); return [(0,_utils_getOppositeVariationPlacement_js__WEBPACK_IMPORTED_MODULE_2__["default"])(placement), oppositePlacement, (0,_utils_getOppositeVariationPlacement_js__WEBPACK_IMPORTED_MODULE_2__["default"])(oppositePlacement)]; } function flip(_ref) { var state = _ref.state, options = _ref.options, name = _ref.name; if (state.modifiersData[name]._skip) { return; } var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements; var preferredPlacement = state.options.placement; var basePlacement = (0,_utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_1__["default"])(preferredPlacement); var isBasePlacement = basePlacement === preferredPlacement; var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [(0,_utils_getOppositePlacement_js__WEBPACK_IMPORTED_MODULE_0__["default"])(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement)); var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) { return acc.concat((0,_utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_1__["default"])(placement) === _enums_js__WEBPACK_IMPORTED_MODULE_5__.auto ? (0,_utils_computeAutoPlacement_js__WEBPACK_IMPORTED_MODULE_4__["default"])(state, { placement: placement, boundary: boundary, rootBoundary: rootBoundary, padding: padding, flipVariations: flipVariations, allowedAutoPlacements: allowedAutoPlacements }) : placement); }, []); var referenceRect = state.rects.reference; var popperRect = state.rects.popper; var checksMap = new Map(); var makeFallbackChecks = true; var firstFittingPlacement = placements[0]; for (var i = 0; i < placements.length; i++) { var placement = placements[i]; var _basePlacement = (0,_utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_1__["default"])(placement); var isStartVariation = (0,_utils_getVariation_js__WEBPACK_IMPORTED_MODULE_6__["default"])(placement) === _enums_js__WEBPACK_IMPORTED_MODULE_5__.start; var isVertical = [_enums_js__WEBPACK_IMPORTED_MODULE_5__.top, _enums_js__WEBPACK_IMPORTED_MODULE_5__.bottom].indexOf(_basePlacement) >= 0; var len = isVertical ? 'width' : 'height'; var overflow = (0,_utils_detectOverflow_js__WEBPACK_IMPORTED_MODULE_3__["default"])(state, { placement: placement, boundary: boundary, rootBoundary: rootBoundary, altBoundary: altBoundary, padding: padding }); var mainVariationSide = isVertical ? isStartVariation ? _enums_js__WEBPACK_IMPORTED_MODULE_5__.right : _enums_js__WEBPACK_IMPORTED_MODULE_5__.left : isStartVariation ? _enums_js__WEBPACK_IMPORTED_MODULE_5__.bottom : _enums_js__WEBPACK_IMPORTED_MODULE_5__.top; if (referenceRect[len] > popperRect[len]) { mainVariationSide = (0,_utils_getOppositePlacement_js__WEBPACK_IMPORTED_MODULE_0__["default"])(mainVariationSide); } var altVariationSide = (0,_utils_getOppositePlacement_js__WEBPACK_IMPORTED_MODULE_0__["default"])(mainVariationSide); var checks = []; if (checkMainAxis) { checks.push(overflow[_basePlacement] <= 0); } if (checkAltAxis) { checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0); } if (checks.every(function (check) { return check; })) { firstFittingPlacement = placement; makeFallbackChecks = false; break; } checksMap.set(placement, checks); } if (makeFallbackChecks) { // `2` may be desired in some cases – research later var numberOfChecks = flipVariations ? 3 : 1; var _loop = function _loop(_i) { var fittingPlacement = placements.find(function (placement) { var checks = checksMap.get(placement); if (checks) { return checks.slice(0, _i).every(function (check) { return check; }); } }); if (fittingPlacement) { firstFittingPlacement = fittingPlacement; return "break"; } }; for (var _i = numberOfChecks; _i > 0; _i--) { var _ret = _loop(_i); if (_ret === "break") break; } } if (state.placement !== firstFittingPlacement) { state.modifiersData[name]._skip = true; state.placement = firstFittingPlacement; state.reset = true; } } // eslint-disable-next-line import/no-unused-modules /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ name: 'flip', enabled: true, phase: 'main', fn: flip, requiresIfExists: ['offset'], data: { _skip: false } }); /***/ }, /***/ 9081 /*!***********************************************************!*\ !*** ./node_modules/@popperjs/core/lib/modifiers/hide.js ***! \***********************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums.js */ 4278); /* harmony import */ var _utils_detectOverflow_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/detectOverflow.js */ 9913); function getSideOffsets(overflow, rect, preventedOffsets) { if (preventedOffsets === void 0) { preventedOffsets = { x: 0, y: 0 }; } return { top: overflow.top - rect.height - preventedOffsets.y, right: overflow.right - rect.width + preventedOffsets.x, bottom: overflow.bottom - rect.height + preventedOffsets.y, left: overflow.left - rect.width - preventedOffsets.x }; } function isAnySideFullyClipped(overflow) { return [_enums_js__WEBPACK_IMPORTED_MODULE_0__.top, _enums_js__WEBPACK_IMPORTED_MODULE_0__.right, _enums_js__WEBPACK_IMPORTED_MODULE_0__.bottom, _enums_js__WEBPACK_IMPORTED_MODULE_0__.left].some(function (side) { return overflow[side] >= 0; }); } function hide(_ref) { var state = _ref.state, name = _ref.name; var referenceRect = state.rects.reference; var popperRect = state.rects.popper; var preventedOffsets = state.modifiersData.preventOverflow; var referenceOverflow = (0,_utils_detectOverflow_js__WEBPACK_IMPORTED_MODULE_1__["default"])(state, { elementContext: 'reference' }); var popperAltOverflow = (0,_utils_detectOverflow_js__WEBPACK_IMPORTED_MODULE_1__["default"])(state, { altBoundary: true }); var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect); var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets); var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets); var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets); state.modifiersData[name] = { referenceClippingOffsets: referenceClippingOffsets, popperEscapeOffsets: popperEscapeOffsets, isReferenceHidden: isReferenceHidden, hasPopperEscaped: hasPopperEscaped }; state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, { 'data-popper-reference-hidden': isReferenceHidden, 'data-popper-escaped': hasPopperEscaped }); } // eslint-disable-next-line import/no-unused-modules /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ name: 'hide', enabled: true, phase: 'main', requiresIfExists: ['preventOverflow'], fn: hide }); /***/ }, /***/ 8490 /*!*************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/modifiers/offset.js ***! \*************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ distanceAndSkiddingToXY: () => (/* binding */ distanceAndSkiddingToXY) /* harmony export */ }); /* harmony import */ var _utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/getBasePlacement.js */ 2632); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../enums.js */ 4278); function distanceAndSkiddingToXY(placement, rects, offset) { var basePlacement = (0,_utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_0__["default"])(placement); var invertDistance = [_enums_js__WEBPACK_IMPORTED_MODULE_1__.left, _enums_js__WEBPACK_IMPORTED_MODULE_1__.top].indexOf(basePlacement) >= 0 ? -1 : 1; var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, { placement: placement })) : offset, skidding = _ref[0], distance = _ref[1]; skidding = skidding || 0; distance = (distance || 0) * invertDistance; return [_enums_js__WEBPACK_IMPORTED_MODULE_1__.left, _enums_js__WEBPACK_IMPORTED_MODULE_1__.right].indexOf(basePlacement) >= 0 ? { x: distance, y: skidding } : { x: skidding, y: distance }; } function offset(_ref2) { var state = _ref2.state, options = _ref2.options, name = _ref2.name; var _options$offset = options.offset, offset = _options$offset === void 0 ? [0, 0] : _options$offset; var data = _enums_js__WEBPACK_IMPORTED_MODULE_1__.placements.reduce(function (acc, placement) { acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset); return acc; }, {}); var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y; if (state.modifiersData.popperOffsets != null) { state.modifiersData.popperOffsets.x += x; state.modifiersData.popperOffsets.y += y; } state.modifiersData[name] = data; } // eslint-disable-next-line import/no-unused-modules /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ name: 'offset', enabled: true, phase: 'main', requires: ['popperOffsets'], fn: offset }); /***/ }, /***/ 5059 /*!********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/modifiers/popperOffsets.js ***! \********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _utils_computeOffsets_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/computeOffsets.js */ 1815); function popperOffsets(_ref) { var state = _ref.state, name = _ref.name; // Offsets are the actual position the popper needs to have to be // properly positioned near its reference element // This is the most basic placement, and will be adjusted by // the modifiers in the next step state.modifiersData[name] = (0,_utils_computeOffsets_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ reference: state.rects.reference, element: state.rects.popper, strategy: 'absolute', placement: state.placement }); } // eslint-disable-next-line import/no-unused-modules /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ name: 'popperOffsets', enabled: true, phase: 'read', fn: popperOffsets, data: {} }); /***/ }, /***/ 2089 /*!**********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/modifiers/preventOverflow.js ***! \**********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums.js */ 4278); /* harmony import */ var _utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/getBasePlacement.js */ 2632); /* harmony import */ var _utils_getMainAxisFromPlacement_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/getMainAxisFromPlacement.js */ 9703); /* harmony import */ var _utils_getAltAxis_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/getAltAxis.js */ 6442); /* harmony import */ var _utils_within_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/within.js */ 6523); /* harmony import */ var _dom_utils_getLayoutRect_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../dom-utils/getLayoutRect.js */ 6979); /* harmony import */ var _dom_utils_getOffsetParent_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../dom-utils/getOffsetParent.js */ 5128); /* harmony import */ var _utils_detectOverflow_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/detectOverflow.js */ 9913); /* harmony import */ var _utils_getVariation_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/getVariation.js */ 8101); /* harmony import */ var _utils_getFreshSideObject_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/getFreshSideObject.js */ 7364); function preventOverflow(_ref) { var state = _ref.state, options = _ref.options, name = _ref.name; var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset; var overflow = (0,_utils_detectOverflow_js__WEBPACK_IMPORTED_MODULE_7__["default"])(state, { boundary: boundary, rootBoundary: rootBoundary, padding: padding, altBoundary: altBoundary }); var basePlacement = (0,_utils_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_1__["default"])(state.placement); var variation = (0,_utils_getVariation_js__WEBPACK_IMPORTED_MODULE_8__["default"])(state.placement); var isBasePlacement = !variation; var mainAxis = (0,_utils_getMainAxisFromPlacement_js__WEBPACK_IMPORTED_MODULE_2__["default"])(basePlacement); var altAxis = (0,_utils_getAltAxis_js__WEBPACK_IMPORTED_MODULE_3__["default"])(mainAxis); var popperOffsets = state.modifiersData.popperOffsets; var referenceRect = state.rects.reference; var popperRect = state.rects.popper; var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, { placement: state.placement })) : tetherOffset; var data = { x: 0, y: 0 }; if (!popperOffsets) { return; } if (checkMainAxis) { var mainSide = mainAxis === 'y' ? _enums_js__WEBPACK_IMPORTED_MODULE_0__.top : _enums_js__WEBPACK_IMPORTED_MODULE_0__.left; var altSide = mainAxis === 'y' ? _enums_js__WEBPACK_IMPORTED_MODULE_0__.bottom : _enums_js__WEBPACK_IMPORTED_MODULE_0__.right; var len = mainAxis === 'y' ? 'height' : 'width'; var offset = popperOffsets[mainAxis]; var min = popperOffsets[mainAxis] + overflow[mainSide]; var max = popperOffsets[mainAxis] - overflow[altSide]; var additive = tether ? -popperRect[len] / 2 : 0; var minLen = variation === _enums_js__WEBPACK_IMPORTED_MODULE_0__.start ? referenceRect[len] : popperRect[len]; var maxLen = variation === _enums_js__WEBPACK_IMPORTED_MODULE_0__.start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go // outside the reference bounds var arrowElement = state.elements.arrow; var arrowRect = tether && arrowElement ? (0,_dom_utils_getLayoutRect_js__WEBPACK_IMPORTED_MODULE_5__["default"])(arrowElement) : { width: 0, height: 0 }; var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : (0,_utils_getFreshSideObject_js__WEBPACK_IMPORTED_MODULE_9__["default"])(); var arrowPaddingMin = arrowPaddingObject[mainSide]; var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want // to include its full size in the calculation. If the reference is small // and near the edge of a boundary, the popper can overflow even if the // reference is not overflowing as well (e.g. virtual elements with no // width or height) var arrowLen = (0,_utils_within_js__WEBPACK_IMPORTED_MODULE_4__["default"])(0, referenceRect[len], arrowRect[len]); var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue; var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue; var arrowOffsetParent = state.elements.arrow && (0,_dom_utils_getOffsetParent_js__WEBPACK_IMPORTED_MODULE_6__["default"])(state.elements.arrow); var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0; var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset; var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue; var preventedOffset = (0,_utils_within_js__WEBPACK_IMPORTED_MODULE_4__["default"])(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max); popperOffsets[mainAxis] = preventedOffset; data[mainAxis] = preventedOffset - offset; } if (checkAltAxis) { var _mainSide = mainAxis === 'x' ? _enums_js__WEBPACK_IMPORTED_MODULE_0__.top : _enums_js__WEBPACK_IMPORTED_MODULE_0__.left; var _altSide = mainAxis === 'x' ? _enums_js__WEBPACK_IMPORTED_MODULE_0__.bottom : _enums_js__WEBPACK_IMPORTED_MODULE_0__.right; var _offset = popperOffsets[altAxis]; var _min = _offset + overflow[_mainSide]; var _max = _offset - overflow[_altSide]; var _preventedOffset = (0,_utils_within_js__WEBPACK_IMPORTED_MODULE_4__["default"])(_min, _offset, _max); popperOffsets[altAxis] = _preventedOffset; data[altAxis] = _preventedOffset - _offset; } state.modifiersData[name] = data; } // eslint-disable-next-line import/no-unused-modules /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ name: 'preventOverflow', enabled: true, phase: 'main', fn: preventOverflow, requiresIfExists: ['offset'] }); /***/ }, /***/ 1576 /*!***************************************************!*\ !*** ./node_modules/@popperjs/core/lib/popper.js ***! \***************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ createPopper: () => (/* binding */ createPopper), /* harmony export */ defaultModifiers: () => (/* binding */ defaultModifiers), /* harmony export */ detectOverflow: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_0__.detectOverflow), /* harmony export */ popperGenerator: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_0__.popperGenerator) /* harmony export */ }); /* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ 4036); /* harmony import */ var _modifiers_eventListeners_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modifiers/eventListeners.js */ 9068); /* harmony import */ var _modifiers_popperOffsets_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modifiers/popperOffsets.js */ 5059); /* harmony import */ var _modifiers_computeStyles_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modifiers/computeStyles.js */ 1262); /* harmony import */ var _modifiers_applyStyles_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modifiers/applyStyles.js */ 6607); /* harmony import */ var _modifiers_offset_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modifiers/offset.js */ 8490); /* harmony import */ var _modifiers_flip_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modifiers/flip.js */ 958); /* harmony import */ var _modifiers_preventOverflow_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./modifiers/preventOverflow.js */ 2089); /* harmony import */ var _modifiers_arrow_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./modifiers/arrow.js */ 8256); /* harmony import */ var _modifiers_hide_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./modifiers/hide.js */ 9081); var defaultModifiers = [_modifiers_eventListeners_js__WEBPACK_IMPORTED_MODULE_1__["default"], _modifiers_popperOffsets_js__WEBPACK_IMPORTED_MODULE_2__["default"], _modifiers_computeStyles_js__WEBPACK_IMPORTED_MODULE_3__["default"], _modifiers_applyStyles_js__WEBPACK_IMPORTED_MODULE_4__["default"], _modifiers_offset_js__WEBPACK_IMPORTED_MODULE_5__["default"], _modifiers_flip_js__WEBPACK_IMPORTED_MODULE_6__["default"], _modifiers_preventOverflow_js__WEBPACK_IMPORTED_MODULE_7__["default"], _modifiers_arrow_js__WEBPACK_IMPORTED_MODULE_8__["default"], _modifiers_hide_js__WEBPACK_IMPORTED_MODULE_9__["default"]]; var createPopper = /*#__PURE__*/(0,_index_js__WEBPACK_IMPORTED_MODULE_0__.popperGenerator)({ defaultModifiers: defaultModifiers }); // eslint-disable-next-line import/no-unused-modules /***/ }, /***/ 6281 /*!***********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js ***! \***********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ computeAutoPlacement) /* harmony export */ }); /* harmony import */ var _getVariation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getVariation.js */ 8101); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../enums.js */ 4278); /* harmony import */ var _detectOverflow_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./detectOverflow.js */ 9913); /* harmony import */ var _getBasePlacement_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./getBasePlacement.js */ 2632); /*:: type OverflowsMap = { [ComputedPlacement]: number }; */ /*;; type OverflowsMap = { [key in ComputedPlacement]: number }; */ function computeAutoPlacement(state, options) { if (options === void 0) { options = {}; } var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? _enums_js__WEBPACK_IMPORTED_MODULE_1__.placements : _options$allowedAutoP; var variation = (0,_getVariation_js__WEBPACK_IMPORTED_MODULE_0__["default"])(placement); var placements = variation ? flipVariations ? _enums_js__WEBPACK_IMPORTED_MODULE_1__.variationPlacements : _enums_js__WEBPACK_IMPORTED_MODULE_1__.variationPlacements.filter(function (placement) { return (0,_getVariation_js__WEBPACK_IMPORTED_MODULE_0__["default"])(placement) === variation; }) : _enums_js__WEBPACK_IMPORTED_MODULE_1__.basePlacements; // $FlowFixMe var allowedPlacements = placements.filter(function (placement) { return allowedAutoPlacements.indexOf(placement) >= 0; }); if (allowedPlacements.length === 0) { allowedPlacements = placements; if (true) { console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' ')); } } // $FlowFixMe: Flow seems to have problems with two array unions... var overflows = allowedPlacements.reduce(function (acc, placement) { acc[placement] = (0,_detectOverflow_js__WEBPACK_IMPORTED_MODULE_2__["default"])(state, { placement: placement, boundary: boundary, rootBoundary: rootBoundary, padding: padding })[(0,_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_3__["default"])(placement)]; return acc; }, {}); return Object.keys(overflows).sort(function (a, b) { return overflows[a] - overflows[b]; }); } /***/ }, /***/ 1815 /*!*****************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/computeOffsets.js ***! \*****************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ computeOffsets) /* harmony export */ }); /* harmony import */ var _getBasePlacement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getBasePlacement.js */ 2632); /* harmony import */ var _getVariation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getVariation.js */ 8101); /* harmony import */ var _getMainAxisFromPlacement_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getMainAxisFromPlacement.js */ 9703); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../enums.js */ 4278); function computeOffsets(_ref) { var reference = _ref.reference, element = _ref.element, placement = _ref.placement; var basePlacement = placement ? (0,_getBasePlacement_js__WEBPACK_IMPORTED_MODULE_0__["default"])(placement) : null; var variation = placement ? (0,_getVariation_js__WEBPACK_IMPORTED_MODULE_1__["default"])(placement) : null; var commonX = reference.x + reference.width / 2 - element.width / 2; var commonY = reference.y + reference.height / 2 - element.height / 2; var offsets; switch (basePlacement) { case _enums_js__WEBPACK_IMPORTED_MODULE_3__.top: offsets = { x: commonX, y: reference.y - element.height }; break; case _enums_js__WEBPACK_IMPORTED_MODULE_3__.bottom: offsets = { x: commonX, y: reference.y + reference.height }; break; case _enums_js__WEBPACK_IMPORTED_MODULE_3__.right: offsets = { x: reference.x + reference.width, y: commonY }; break; case _enums_js__WEBPACK_IMPORTED_MODULE_3__.left: offsets = { x: reference.x - element.width, y: commonY }; break; default: offsets = { x: reference.x, y: reference.y }; } var mainAxis = basePlacement ? (0,_getMainAxisFromPlacement_js__WEBPACK_IMPORTED_MODULE_2__["default"])(basePlacement) : null; if (mainAxis != null) { var len = mainAxis === 'y' ? 'height' : 'width'; switch (variation) { case _enums_js__WEBPACK_IMPORTED_MODULE_3__.start: offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2); break; case _enums_js__WEBPACK_IMPORTED_MODULE_3__.end: offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2); break; default: } } return offsets; } /***/ }, /***/ 571 /*!***********************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/debounce.js ***! \***********************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ debounce) /* harmony export */ }); function debounce(fn) { var pending; return function () { if (!pending) { pending = new Promise(function (resolve) { Promise.resolve().then(function () { pending = undefined; resolve(fn()); }); }); } return pending; }; } /***/ }, /***/ 9913 /*!*****************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/detectOverflow.js ***! \*****************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ detectOverflow) /* harmony export */ }); /* harmony import */ var _dom_utils_getBoundingClientRect_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../dom-utils/getBoundingClientRect.js */ 6354); /* harmony import */ var _dom_utils_getClippingRect_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dom-utils/getClippingRect.js */ 2883); /* harmony import */ var _dom_utils_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dom-utils/getDocumentElement.js */ 9760); /* harmony import */ var _computeOffsets_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./computeOffsets.js */ 1815); /* harmony import */ var _rectToClientRect_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./rectToClientRect.js */ 4426); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../enums.js */ 4278); /* harmony import */ var _dom_utils_instanceOf_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../dom-utils/instanceOf.js */ 5581); /* harmony import */ var _mergePaddingObject_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./mergePaddingObject.js */ 4318); /* harmony import */ var _expandToHashMap_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./expandToHashMap.js */ 1007); // eslint-disable-next-line import/no-unused-modules function detectOverflow(state, options) { if (options === void 0) { options = {}; } var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? _enums_js__WEBPACK_IMPORTED_MODULE_5__.clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? _enums_js__WEBPACK_IMPORTED_MODULE_5__.viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? _enums_js__WEBPACK_IMPORTED_MODULE_5__.popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding; var paddingObject = (0,_mergePaddingObject_js__WEBPACK_IMPORTED_MODULE_7__["default"])(typeof padding !== 'number' ? padding : (0,_expandToHashMap_js__WEBPACK_IMPORTED_MODULE_8__["default"])(padding, _enums_js__WEBPACK_IMPORTED_MODULE_5__.basePlacements)); var altContext = elementContext === _enums_js__WEBPACK_IMPORTED_MODULE_5__.popper ? _enums_js__WEBPACK_IMPORTED_MODULE_5__.reference : _enums_js__WEBPACK_IMPORTED_MODULE_5__.popper; var referenceElement = state.elements.reference; var popperRect = state.rects.popper; var element = state.elements[altBoundary ? altContext : elementContext]; var clippingClientRect = (0,_dom_utils_getClippingRect_js__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_dom_utils_instanceOf_js__WEBPACK_IMPORTED_MODULE_6__.isElement)(element) ? element : element.contextElement || (0,_dom_utils_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_2__["default"])(state.elements.popper), boundary, rootBoundary); var referenceClientRect = (0,_dom_utils_getBoundingClientRect_js__WEBPACK_IMPORTED_MODULE_0__["default"])(referenceElement); var popperOffsets = (0,_computeOffsets_js__WEBPACK_IMPORTED_MODULE_3__["default"])({ reference: referenceClientRect, element: popperRect, strategy: 'absolute', placement: placement }); var popperClientRect = (0,_rectToClientRect_js__WEBPACK_IMPORTED_MODULE_4__["default"])(Object.assign(Object.assign({}, popperRect), popperOffsets)); var elementClientRect = elementContext === _enums_js__WEBPACK_IMPORTED_MODULE_5__.popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect // 0 or negative = within the clipping rect var overflowOffsets = { top: clippingClientRect.top - elementClientRect.top + paddingObject.top, bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom, left: clippingClientRect.left - elementClientRect.left + paddingObject.left, right: elementClientRect.right - clippingClientRect.right + paddingObject.right }; var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element if (elementContext === _enums_js__WEBPACK_IMPORTED_MODULE_5__.popper && offsetData) { var offset = offsetData[placement]; Object.keys(overflowOffsets).forEach(function (key) { var multiply = [_enums_js__WEBPACK_IMPORTED_MODULE_5__.right, _enums_js__WEBPACK_IMPORTED_MODULE_5__.bottom].indexOf(key) >= 0 ? 1 : -1; var axis = [_enums_js__WEBPACK_IMPORTED_MODULE_5__.top, _enums_js__WEBPACK_IMPORTED_MODULE_5__.bottom].indexOf(key) >= 0 ? 'y' : 'x'; overflowOffsets[key] += offset[axis] * multiply; }); } return overflowOffsets; } /***/ }, /***/ 1007 /*!******************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/expandToHashMap.js ***! \******************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ expandToHashMap) /* harmony export */ }); function expandToHashMap(value, keys) { return keys.reduce(function (hashMap, key) { hashMap[key] = value; return hashMap; }, {}); } /***/ }, /***/ 6439 /*!*********************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/format.js ***! \*********************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ format) /* harmony export */ }); function format(str) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return [].concat(args).reduce(function (p, c) { return p.replace(/%s/, c); }, str); } /***/ }, /***/ 6442 /*!*************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/getAltAxis.js ***! \*************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getAltAxis) /* harmony export */ }); function getAltAxis(axis) { return axis === 'x' ? 'y' : 'x'; } /***/ }, /***/ 2632 /*!*******************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/getBasePlacement.js ***! \*******************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getBasePlacement) /* harmony export */ }); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums.js */ 4278); function getBasePlacement(placement) { return placement.split('-')[0]; } /***/ }, /***/ 7364 /*!*********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/getFreshSideObject.js ***! \*********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getFreshSideObject) /* harmony export */ }); function getFreshSideObject() { return { top: 0, right: 0, bottom: 0, left: 0 }; } /***/ }, /***/ 9703 /*!***************************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js ***! \***************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getMainAxisFromPlacement) /* harmony export */ }); function getMainAxisFromPlacement(placement) { return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y'; } /***/ }, /***/ 1688 /*!***********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/getOppositePlacement.js ***! \***********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getOppositePlacement) /* harmony export */ }); var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; function getOppositePlacement(placement) { return placement.replace(/left|right|bottom|top/g, function (matched) { return hash[matched]; }); } /***/ }, /***/ 6771 /*!********************************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js ***! \********************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getOppositeVariationPlacement) /* harmony export */ }); var hash = { start: 'end', end: 'start' }; function getOppositeVariationPlacement(placement) { return placement.replace(/start|end/g, function (matched) { return hash[matched]; }); } /***/ }, /***/ 8101 /*!***************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/getVariation.js ***! \***************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getVariation) /* harmony export */ }); function getVariation(placement) { return placement.split('-')[1]; } /***/ }, /***/ 844 /*!**************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/mergeByName.js ***! \**************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ mergeByName) /* harmony export */ }); function mergeByName(modifiers) { var merged = modifiers.reduce(function (merged, current) { var existing = merged[current.name]; merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, { options: Object.assign(Object.assign({}, existing.options), current.options), data: Object.assign(Object.assign({}, existing.data), current.data) }) : current; return merged; }, {}); // IE11 does not support Object.values return Object.keys(merged).map(function (key) { return merged[key]; }); } /***/ }, /***/ 4318 /*!*********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/mergePaddingObject.js ***! \*********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ mergePaddingObject) /* harmony export */ }); /* harmony import */ var _getFreshSideObject_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getFreshSideObject.js */ 7364); function mergePaddingObject(paddingObject) { return Object.assign(Object.assign({}, (0,_getFreshSideObject_js__WEBPACK_IMPORTED_MODULE_0__["default"])()), paddingObject); } /***/ }, /***/ 1206 /*!*****************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/orderModifiers.js ***! \*****************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ orderModifiers) /* harmony export */ }); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../enums.js */ 4278); // source: https://stackoverflow.com/questions/49875255 function order(modifiers) { var map = new Map(); var visited = new Set(); var result = []; modifiers.forEach(function (modifier) { map.set(modifier.name, modifier); }); // On visiting object, check for its dependencies and visit them recursively function sort(modifier) { visited.add(modifier.name); var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []); requires.forEach(function (dep) { if (!visited.has(dep)) { var depModifier = map.get(dep); if (depModifier) { sort(depModifier); } } }); result.push(modifier); } modifiers.forEach(function (modifier) { if (!visited.has(modifier.name)) { // check for visited object sort(modifier); } }); return result; } function orderModifiers(modifiers) { // order based on dependencies var orderedModifiers = order(modifiers); // order based on phase return _enums_js__WEBPACK_IMPORTED_MODULE_0__.modifierPhases.reduce(function (acc, phase) { return acc.concat(orderedModifiers.filter(function (modifier) { return modifier.phase === phase; })); }, []); } /***/ }, /***/ 4426 /*!*******************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/rectToClientRect.js ***! \*******************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ rectToClientRect) /* harmony export */ }); function rectToClientRect(rect) { return Object.assign(Object.assign({}, rect), {}, { left: rect.x, top: rect.y, right: rect.x + rect.width, bottom: rect.y + rect.height }); } /***/ }, /***/ 962 /*!***********************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/uniqueBy.js ***! \***********************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ uniqueBy) /* harmony export */ }); function uniqueBy(arr, fn) { var identifiers = new Set(); return arr.filter(function (item) { var identifier = fn(item); if (!identifiers.has(identifier)) { identifiers.add(identifier); return true; } }); } /***/ }, /***/ 5246 /*!********************************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/validateModifiers.js ***! \********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ validateModifiers) /* harmony export */ }); /* harmony import */ var _format_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./format.js */ 6439); /* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../enums.js */ 4278); var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s'; var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available'; var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options']; function validateModifiers(modifiers) { modifiers.forEach(function (modifier) { Object.keys(modifier).forEach(function (key) { switch (key) { case 'name': if (typeof modifier.name !== 'string') { console.error((0,_format_js__WEBPACK_IMPORTED_MODULE_0__["default"])(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\"")); } break; case 'enabled': if (typeof modifier.enabled !== 'boolean') { console.error((0,_format_js__WEBPACK_IMPORTED_MODULE_0__["default"])(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\"")); } case 'phase': if (_enums_js__WEBPACK_IMPORTED_MODULE_1__.modifierPhases.indexOf(modifier.phase) < 0) { console.error((0,_format_js__WEBPACK_IMPORTED_MODULE_0__["default"])(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + _enums_js__WEBPACK_IMPORTED_MODULE_1__.modifierPhases.join(', '), "\"" + String(modifier.phase) + "\"")); } break; case 'fn': if (typeof modifier.fn !== 'function') { console.error((0,_format_js__WEBPACK_IMPORTED_MODULE_0__["default"])(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\"")); } break; case 'effect': if (typeof modifier.effect !== 'function') { console.error((0,_format_js__WEBPACK_IMPORTED_MODULE_0__["default"])(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\"")); } break; case 'requires': if (!Array.isArray(modifier.requires)) { console.error((0,_format_js__WEBPACK_IMPORTED_MODULE_0__["default"])(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\"")); } break; case 'requiresIfExists': if (!Array.isArray(modifier.requiresIfExists)) { console.error((0,_format_js__WEBPACK_IMPORTED_MODULE_0__["default"])(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\"")); } break; case 'options': case 'data': break; default: console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) { return "\"" + s + "\""; }).join(', ') + "; but \"" + key + "\" was provided."); } modifier.requires && modifier.requires.forEach(function (requirement) { if (modifiers.find(function (mod) { return mod.name === requirement; }) == null) { console.error((0,_format_js__WEBPACK_IMPORTED_MODULE_0__["default"])(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement)); } }); }); }); } /***/ }, /***/ 6523 /*!*********************************************************!*\ !*** ./node_modules/@popperjs/core/lib/utils/within.js ***! \*********************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ within) /* harmony export */ }); function within(min, value, max) { return Math.max(min, Math.min(value, max)); } /***/ }, /***/ 5010 /*!************************************************!*\ !*** ./node_modules/formstone/dist/js/core.js ***! \************************************************/ (module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! formstone v1.4.17 [core.js] 2020-10-06 | GPL-3.0 License | formstone.it */ !function(e){ true?!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ 428)], __WEBPACK_AMD_DEFINE_FACTORY__ = (e), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):0}(function(w){"use strict";function e(){this.Version="1.4.17",this.Plugins={},this.DontConflict=!1,this.Conflicts={fn:{}},this.ResizeHandlers=[],this.RAFHandlers=[],this.window=i,this.$window=w(i),this.document=r,this.$document=w(r),this.$body=null,this.windowWidth=0,this.windowHeight=0,this.fallbackWidth=1024,this.fallbackHeight=768,this.userAgent=window.navigator.userAgent||window.navigator.vendor||window.opera,this.isFirefox=/Firefox/i.test(this.userAgent),this.isChrome=/Chrome/i.test(this.userAgent),this.isSafari=/Safari/i.test(this.userAgent)&&!this.isChrome,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(this.userAgent),this.isIEMobile=/IEMobile/i.test(this.userAgent),this.isFirefoxMobile=this.isFirefox&&this.isMobile,this.transform=null,this.transition=null,this.support={file:!!(window.File&&window.FileList&&window.FileReader),history:!!(window.history&&window.history.pushState&&window.history.replaceState),matchMedia:!(!window.matchMedia&&!window.msMatchMedia),pointer:!!window.PointerEvent,raf:!(!window.requestAnimationFrame||!window.cancelAnimationFrame),touch:!!("ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),transition:!1,transform:!1}}var t,n,s,i="undefined"!=typeof window?window:this,r=i.document,o={killEvent:function(e,t){try{e.preventDefault(),e.stopPropagation(),t&&e.stopImmediatePropagation()}catch(e){}},killGesture:function(e){try{e.preventDefault()}catch(e){}},lockViewport:function(e){p[e]=!0,w.isEmptyObject(p)||h||(t.length?t.attr("content",s):t=w("head").append('<meta name="viewport" content="'+s+'">'),c.$body.on(u.gestureChange,o.killGesture).on(u.gestureStart,o.killGesture).on(u.gestureEnd,o.killGesture),h=!0)},unlockViewport:function(e){"undefined"!==w.type(p[e])&&delete p[e],w.isEmptyObject(p)&&h&&(t.length&&(n?t.attr("content",n):t.remove()),c.$body.off(u.gestureChange).off(u.gestureStart).off(u.gestureEnd),h=!1)},startTimer:function(e,t,n,s){return o.clearTimer(e),s?setInterval(n,t):setTimeout(n,t)},clearTimer:function(e,t){e&&(t?clearInterval(e):clearTimeout(e),e=null)},sortAsc:function(e,t){return parseInt(e,10)-parseInt(t,10)},sortDesc:function(e,t){return parseInt(t,10)-parseInt(e,10)},decodeEntities:function(e){var t=c.document.createElement("textarea");return t.innerHTML=e,t.value},parseQueryString:function(e){for(var t={},n=e.slice(e.indexOf("?")+1).split("&"),s=0;s<n.length;s++){var i=n[s].split("=");t[i[0]]=i[1]}return t}},c=new e,a=w.Deferred(),l={base:"{ns}",element:"{ns}-element"},u={namespace:".{ns}",beforeUnload:"beforeunload.{ns}",blur:"blur.{ns}",change:"change.{ns}",click:"click.{ns}",dblClick:"dblclick.{ns}",drag:"drag.{ns}",dragEnd:"dragend.{ns}",dragEnter:"dragenter.{ns}",dragLeave:"dragleave.{ns}",dragOver:"dragover.{ns}",dragStart:"dragstart.{ns}",drop:"drop.{ns}",error:"error.{ns}",focus:"focus.{ns}",focusIn:"focusin.{ns}",focusOut:"focusout.{ns}",gestureChange:"gesturechange.{ns}",gestureStart:"gesturestart.{ns}",gestureEnd:"gestureend.{ns}",input:"input.{ns}",keyDown:"keydown.{ns}",keyPress:"keypress.{ns}",keyUp:"keyup.{ns}",load:"load.{ns}",mouseDown:"mousedown.{ns}",mouseEnter:"mouseenter.{ns}",mouseLeave:"mouseleave.{ns}",mouseMove:"mousemove.{ns}",mouseOut:"mouseout.{ns}",mouseOver:"mouseover.{ns}",mouseUp:"mouseup.{ns}",panStart:"panstart.{ns}",pan:"pan.{ns}",panEnd:"panend.{ns}",resize:"resize.{ns}",scaleStart:"scalestart.{ns}",scaleEnd:"scaleend.{ns}",scale:"scale.{ns}",scroll:"scroll.{ns}",select:"select.{ns}",swipe:"swipe.{ns}",touchCancel:"touchcancel.{ns}",touchEnd:"touchend.{ns}",touchLeave:"touchleave.{ns}",touchMove:"touchmove.{ns}",touchStart:"touchstart.{ns}"},d=null,f=20,p=[],h=!1;function m(e,t,n,s){var i,r={raw:{}};for(i in s=s||{})s.hasOwnProperty(i)&&("classes"===e?(r.raw[s[i]]=t+"-"+s[i],r[s[i]]="."+t+"-"+s[i]):(r.raw[i]=s[i],r[i]=s[i]+"."+t));for(i in n)n.hasOwnProperty(i)&&("classes"===e?(r.raw[i]=n[i].replace(/{ns}/g,t),r[i]=n[i].replace(/{ns}/g,"."+t)):(r.raw[i]=n[i].replace(/.{ns}/g,""),r[i]=n[i].replace(/{ns}/g,t)));return r}function g(){c.windowWidth=c.$window.width(),c.windowHeight=c.$window.height(),d=o.startTimer(d,f,y)}function y(){for(var e in c.ResizeHandlers)c.ResizeHandlers.hasOwnProperty(e)&&c.ResizeHandlers[e].callback.call(window,c.windowWidth,c.windowHeight)}function v(e,t){return parseInt(e.priority)-parseInt(t.priority)}return e.prototype.NoConflict=function(){for(var e in c.DontConflict=!0,c.Plugins)c.Plugins.hasOwnProperty(e)&&(w[e]=c.Conflicts[e],w.fn[e]=c.Conflicts.fn[e])},e.prototype.Ready=function(e){"complete"===c.document.readyState||"loading"!==c.document.readyState&&!c.document.documentElement.doScroll?e():c.document.addEventListener("DOMContentLoaded",e)},e.prototype.Plugin=function(e,t){function d(e){return e.data(h)}var f,p,n,h;return c.Plugins[e]=(p=t,n="fs-"+(f=e),h="fs"+f.replace(/(^|\s)([a-z])/g,function(e,t,n){return t+n.toUpperCase()}),p.initialized=!1,p.priority=p.priority||10,p.classes=m("classes",n,l,p.classes),p.events=m("events",f,u,p.events),p.functions=w.extend({getData:d,iterate:function(e){for(var t=Array.prototype.slice.call(arguments,1),n=0,s=this.length;n<s;n++){var i=this.eq(n),r=d(i)||{};"undefined"!==w.type(r.$el)&&e.apply(i,[r].concat(t))}return this}},o,p.functions),p.methods=w.extend(!0,{_construct:w.noop,_postConstruct:w.noop,_destruct:w.noop,_resize:!1,destroy:function(e){p.functions.iterate.apply(this,[p.methods._destruct].concat(Array.prototype.slice.call(arguments,1))),this.removeClass(p.classes.raw.element).removeData(h)}},p.methods),p.utilities=w.extend(!0,{_initialize:!1,_delegate:!1,defaults:function(e){p.defaults=w.extend(!0,p.defaults,e||{})}},p.utilities),p.widget&&(c.Conflicts.fn[f]=w.fn[f],w.fn[h]=function(e){if(this instanceof w){var t=p.methods[e];if("object"===w.type(e)||!e)return function(e){var t,n,s,i="object"===w.type(e),r=Array.prototype.slice.call(arguments,i?1:0),o=w();for(e=w.extend(!0,{},p.defaults||{},i?e:{}),n=0,s=this.length;n<s;n++)if(!d(t=this.eq(n))){p.guid++;var a="__"+p.guid,c=p.classes.raw.base+a,l=t.data(f+"-options"),u=w.extend(!0,{$el:t,guid:a,numGuid:p.guid,rawGuid:c,dotGuid:"."+c},e,"object"===w.type(l)?l:{});t.addClass(p.classes.raw.element).data(h,u),p.methods._construct.apply(t,[u].concat(r)),o=o.add(t)}for(n=0,s=o.length;n<s;n++)t=o.eq(n),p.methods._postConstruct.apply(t,[d(t)]);return this}.apply(this,arguments);if(t&&0!==e.indexOf("_")){var n=[t].concat(Array.prototype.slice.call(arguments,1));return p.functions.iterate.apply(this,n)}return this}},c.DontConflict||(w.fn[f]=w.fn[h])),c.Conflicts[f]=w[f],w[h]=p.utilities._delegate||function(e){var t=p.utilities[e]||p.utilities._initialize||!1;if(t){var n=Array.prototype.slice.call(arguments,"object"===w.type(e)?0:1);return t.apply(window,n)}},c.DontConflict||(w[f]=w[h]),p.namespace=f,p.namespaceClean=h,p.guid=0,p.methods._resize&&(c.ResizeHandlers.push({namespace:f,priority:p.priority,callback:p.methods._resize}),c.ResizeHandlers.sort(v)),p.methods._raf&&(c.RAFHandlers.push({namespace:f,priority:p.priority,callback:p.methods._raf}),c.RAFHandlers.sort(v)),p),c.Plugins[e]},c.$window.on("resize.fs",g),g(),function e(){if(c.support.raf)for(var t in c.window.requestAnimationFrame(e),c.RAFHandlers)c.RAFHandlers.hasOwnProperty(t)&&c.RAFHandlers[t].callback.call(window)}(),c.Ready(function(){c.$body=w("body"),w("html").addClass(c.support.touch?"touchevents":"no-touchevents"),t=w('meta[name="viewport"]'),n=!!t.length&&t.attr("content"),s="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0",a.resolve()}),u.clickTouchStart=u.click+" "+u.touchStart,function(){var e,t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"},n=["transition","-webkit-transition"],s={transform:"transform",MozTransform:"-moz-transform",OTransform:"-o-transform",msTransform:"-ms-transform",webkitTransform:"-webkit-transform"},i="transitionend",r="",o="",a=document.createElement("div");for(e in t)if(t.hasOwnProperty(e)&&e in a.style){i=t[e],c.support.transition=!0;break}for(e in u.transitionEnd=i+".{ns}",n)if(n.hasOwnProperty(e)&&n[e]in a.style){r=n[e];break}for(e in c.transition=r,s)if(s.hasOwnProperty(e)&&s[e]in a.style){c.support.transform=!0,o=s[e];break}c.transform=o}(),window.Formstone=c}); /***/ }, /***/ 5232 /*!**************************************************!*\ !*** ./node_modules/formstone/dist/js/upload.js ***! \**************************************************/ (module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! formstone v1.4.17 [upload.js] 2020-10-06 | GPL-3.0 License | formstone.it */ !function(e){ true?!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ 428),__webpack_require__(/*! ./core */ 5010)], __WEBPACK_AMD_DEFINE_FACTORY__ = (e), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):0}(function(u,r){"use strict";function s(e,t,a){t.error=!0,e.$el.trigger($.fileError,[t,a]),e.aborting||v(e)}function a(e){e.disabled&&(this.removeClass(C.disabled),e.$input.prop("disabled",!1),e.disabled=!1)}function n(e){y.killEvent(e);var t=e.data;t.disabled||t.$input.trigger($.click)}function i(e){e.data.$el.addClass(C.focus)}function l(e){e.data.$el.removeClass(C.focus)}function o(e){y.killEvent(e);var t=e.data,a=t.$input[0].files;!t.disabled&&a.length&&g(t,a)}function c(e){y.killEvent(e),e.data.$el.addClass(C.dropping).trigger($.fileDragEnter)}function d(e){y.killEvent(e),e.data.$el.addClass(C.dropping).trigger($.fileDragOver)}function f(e){y.killEvent(e),e.data.$el.removeClass(C.dropping).trigger($.fileDragLeave)}function p(e){y.killEvent(e);var t=e.data,a=e.originalEvent.dataTransfer.files;t.$el.removeClass(C.dropping),t.disabled||g(t,a)}function g(e,t){var a=[],r=t.length;if(e.maxFiles){var n=e.maxFiles-e.uploaded;0<=n&&t.length>n&&(r=n)}if(0<r){for(var i=0;i<r;i++){var l={index:e.total++,file:t[i],name:t[i].name,size:t[i].size,started:!1,complete:!1,error:!1,transfer:null};a.push(l),e.queue.push(l)}e.$el.trigger($.queued,[a]),e.autoUpload&&h(e)}e.$input.val("")}function h(e){e.uploading||(S.on($.beforeUnload,function(){return e.leave}),e.uploading=!0,e.$el.trigger($.start,[e.queue])),v(e)}function v(e){var t=0,a=[];if(e.uploading){for(var r in e.queue)!e.queue.hasOwnProperty(r)||e.queue[r].complete||e.queue[r].error||a.push(e.queue[r]);for(var n in e.queue=a,e.queue)if(e.queue.hasOwnProperty(n)){if(e.queue[n].started||m(e,e.queue[n]),++t>=e.maxConcurrent)return;r++}0===t&&(S.off($.beforeUnload),e.uploading=!1,e.$el.trigger($.complete))}}function m(n,i){if(i.size>=n.maxSize||!0===i.error)s(n,i,"size");else if(n.chunked)i.started=!0,i.chunkSize=1024*n.chunkSize,i.totalChunks=Math.ceil(i.size/i.chunkSize),i.currentChunk=0,n.$el.trigger($.fileStart,[i]),function n(l,o){var e=o.chunkSize*o.currentChunk,t=e+o.chunkSize;t>o.size&&(t=o.size);var a=o.file[q](e,t),r=new FormData;r.append(l.postKey,a,o.file.name);r.append("chunks",o.totalChunks);r.append("chunk",o.currentChunk);r=k(l,r,o);!1===r?s(l,o,"abort"):o.chunkTransfer=u.ajax({url:l.action,data:r,dataType:l.dataType,headers:l.headers,type:"POST",contentType:!1,processData:!1,cache:!1,beforeSend:function(e,t){l.$el.trigger($.chunkStart,[o,t,e])},success:function(e,t,a){o.currentChunk++,l.$el.trigger($.chunkComplete,[o]);var r=Math.ceil(o.currentChunk/o.totalChunks*100);l.$el.trigger($.fileProgress,[o,r,t,a]),o.currentChunk<o.totalChunks?n(l,o):(o.complete=!0,l.$el.trigger($.fileComplete,[o,e,t,a]),v(l))},error:function(e,t,a){var r,n,i;n=o,i=a,(r=l).$el.trigger($.chunkError,[n,i]),s(r,n,i)}})}(n,i);else{var e=new FormData;e.append(n.postKey,i.file),!1===(e=k(n,e,i))?s(n,i,"abort"):(i.started=!0,i.transfer=u.ajax({url:n.action,data:e,dataType:n.dataType,headers:n.headers,type:"POST",contentType:!1,processData:!1,cache:!1,xhr:function(){var e=u.ajaxSettings.xhr();return e.upload&&e.upload.addEventListener("progress",function(e){var t=0,a=e.loaded||e.position,r=e.total;e.lengthComputable&&(t=Math.ceil(a/r*100)),n.$el.trigger($.fileProgress,[i,t,e])},!1),e},beforeSend:function(e,t){n.$el.trigger($.fileStart,[i,t,e])},success:function(e,t,a){i.complete=!0,n.uploaded++,n.$el.trigger($.fileComplete,[i,e,t,a]),v(n)},error:function(e,t,a){s(n,i,a)}}))}}function k(e,t,a){for(var r in e.postData)e.postData.hasOwnProperty(r)&&t.append(r,e.postData[r]);return t=e.beforeSend.call(e.$el,t,a)}var e=r.Plugin("upload",{widget:!0,defaults:{accept:!1,action:"",autoUpload:!0,beforeSend:function(e){return e},chunked:!1,chunkSize:100,customClass:"",dataType:"html",headers:{},label:"Drag and drop files or click to select",leave:"You have uploads pending, are you sure you want to leave this page?",maxConcurrent:2,maxFiles:!1,maxSize:5242880,multiple:!0,postData:{},postKey:"file",theme:"fs-light"},classes:["input","target","multiple","dropping","disabled","focus"],methods:{_construct:function(e){if(r.support.file){var t="";q||(e.chunked=!1),e.maxQueue&&(e.maxConcurrent=e.maxQueue),!1!==e.label&&(t+='<div class="'+C.target+'">',t+=e.label,t+="</div>"),t+='<input class="'+C.input+'" type="file"',e.multiple&&(t+=" multiple"),e.accept&&(t+=' accept="'+e.accept+'"'),t+=">",e.baseClasses=[C.base,e.theme,e.customClass].join(" "),this.addClass(e.baseClasses).append(t),e.$input=this.find(b.input),e.queue=[],e.total=0,e.uploaded=0,e.uploading=!1,e.disabled=!0,e.aborting=!1,this.on($.click,b.target,e,n).on($.dragEnter,e,c).on($.dragOver,e,d).on($.dragLeave,e,f).on($.drop,e,p),e.$input.on($.focus,e,i).on($.blur,e,l).on($.change,e,o),a.call(this,e)}},_destruct:function(e){r.support.file&&(e.$input.off($.namespace),this.off($.namespace).removeClass(e.baseClasses).html(""))},disable:function(e){e.disabled||(this.addClass(C.disabled),e.$input.prop("disabled",!0),e.disabled=!0)},enable:a,abort:function(e,t){var a;for(var r in e.aborting=!0,e.queue)e.queue.hasOwnProperty(r)&&(a=e.queue[r],("undefined"===u.type(t)||0<=t&&a.index===t)&&(a.started&&!a.complete?e.chunked?a.chunkTransfer.abort():a.transfer.abort():s(e,a,"abort")));e.aborting=!1,v(e)},start:h}}),b=e.classes,C=b.raw,$=e.events,y=e.functions,S=(r.window,r.$window),q=!1;r.Ready(function(){var e=["mozSlice","webkitSlice","slice"];if(r.support.file){var t=!1;try{t=new File([""],"f")}catch(e){}if(!t)try{t=new Blob([""],{})}catch(e){}if(t)for(var a in e)if(e.hasOwnProperty(a)&&e[a]in t){q=e[a];break}}}),$.chunkComplete="chunkcomplete",$.chunkError="chunkerror",$.chunkStart="chunkstart",$.complete="complete",$.fileComplete="filecomplete",$.fileDragEnter="filedragenter",$.fileDragLeave="filedragleave",$.fileDragOver="filedragover",$.fileError="fileerror",$.fileProgress="fileprogress",$.fileStart="filestart",$.start="start",$.queued="queued"}); /***/ }, /***/ 7596 /*!****************************************************!*\ !*** ./node_modules/handlebars/dist/handlebars.js ***! \****************************************************/ (module) { /**! @license handlebars v4.7.9 Copyright (C) 2011-2019 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ (function webpackUniversalModuleDefinition(root, factory) { if(true) module.exports = factory(); else // removed by dead control flow {} })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __nested_webpack_require_1638__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_1638__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __nested_webpack_require_1638__.m = modules; /******/ // expose the module cache /******/ __nested_webpack_require_1638__.c = installedModules; /******/ // __webpack_public_path__ /******/ __nested_webpack_require_1638__.p = ""; /******/ // Load entry module and return exports /******/ return __nested_webpack_require_1638__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __nested_webpack_require_2839__) { 'use strict'; var _interopRequireDefault = __nested_webpack_require_2839__(1)['default']; exports.__esModule = true; var _handlebarsRuntime = __nested_webpack_require_2839__(2); var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime); // Compiler imports var _handlebarsCompilerAst = __nested_webpack_require_2839__(83); var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); var _handlebarsCompilerBase = __nested_webpack_require_2839__(84); var _handlebarsCompilerCompiler = __nested_webpack_require_2839__(89); var _handlebarsCompilerJavascriptCompiler = __nested_webpack_require_2839__(90); var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); var _handlebarsCompilerVisitor = __nested_webpack_require_2839__(87); var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); var _handlebarsNoConflict = __nested_webpack_require_2839__(82); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); var _create = _handlebarsRuntime2['default'].create; function create() { var hb = _create(); hb.compile = function (input, options) { return _handlebarsCompilerCompiler.compile(input, options, hb); }; hb.precompile = function (input, options) { return _handlebarsCompilerCompiler.precompile(input, options, hb); }; hb.AST = _handlebarsCompilerAst2['default']; hb.Compiler = _handlebarsCompilerCompiler.Compiler; hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; hb.Parser = _handlebarsCompilerBase.parser; hb.parse = _handlebarsCompilerBase.parse; hb.parseWithoutProcessing = _handlebarsCompilerBase.parseWithoutProcessing; return hb; } var inst = create(); inst.create = create; _handlebarsNoConflict2['default'](inst); inst.Visitor = _handlebarsCompilerVisitor2['default']; inst['default'] = inst; exports['default'] = inst; module.exports = exports['default']; /***/ }), /* 1 */ /***/ (function(module, exports) { "use strict"; exports["default"] = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; }; exports.__esModule = true; /***/ }), /* 2 */ /***/ (function(module, exports, __nested_webpack_require_5051__) { 'use strict'; var _interopRequireWildcard = __nested_webpack_require_5051__(3)['default']; var _interopRequireDefault = __nested_webpack_require_5051__(1)['default']; exports.__esModule = true; var _handlebarsBase = __nested_webpack_require_5051__(4); var base = _interopRequireWildcard(_handlebarsBase); // Each of these augment the Handlebars object. No need to setup here. // (This is done to easily share code between commonjs and browse envs) var _handlebarsSafeString = __nested_webpack_require_5051__(76); var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); var _handlebarsException = __nested_webpack_require_5051__(6); var _handlebarsException2 = _interopRequireDefault(_handlebarsException); var _handlebarsUtils = __nested_webpack_require_5051__(5); var Utils = _interopRequireWildcard(_handlebarsUtils); var _handlebarsRuntime = __nested_webpack_require_5051__(77); var runtime = _interopRequireWildcard(_handlebarsRuntime); var _handlebarsNoConflict = __nested_webpack_require_5051__(82); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); // For compatibility and usage outside of module systems, make the Handlebars object a namespace function create() { var hb = new base.HandlebarsEnvironment(); Utils.extend(hb, base); hb.SafeString = _handlebarsSafeString2['default']; hb.Exception = _handlebarsException2['default']; hb.Utils = Utils; hb.escapeExpression = Utils.escapeExpression; hb.VM = runtime; hb.template = function (spec) { return runtime.template(spec, hb); }; return hb; } var inst = create(); inst.create = create; _handlebarsNoConflict2['default'](inst); inst['default'] = inst; exports['default'] = inst; module.exports = exports['default']; /***/ }), /* 3 */ /***/ (function(module, exports) { "use strict"; exports["default"] = function (obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }; exports.__esModule = true; /***/ }), /* 4 */ /***/ (function(module, exports, __nested_webpack_require_7277__) { 'use strict'; var _interopRequireDefault = __nested_webpack_require_7277__(1)['default']; exports.__esModule = true; exports.HandlebarsEnvironment = HandlebarsEnvironment; var _utils = __nested_webpack_require_7277__(5); var _exception = __nested_webpack_require_7277__(6); var _exception2 = _interopRequireDefault(_exception); var _helpers = __nested_webpack_require_7277__(10); var _decorators = __nested_webpack_require_7277__(70); var _logger = __nested_webpack_require_7277__(72); var _logger2 = _interopRequireDefault(_logger); var _internalProtoAccess = __nested_webpack_require_7277__(73); var VERSION = '4.7.9'; exports.VERSION = VERSION; var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; var LAST_COMPATIBLE_COMPILER_REVISION = 7; exports.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; var REVISION_CHANGES = { 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 2: '== 1.0.0-rc.3', 3: '== 1.0.0-rc.4', 4: '== 1.x.x', 5: '== 2.0.0-alpha.x', 6: '>= 2.0.0-beta.1', 7: '>= 4.0.0 <4.3.0', 8: '>= 4.3.0' }; exports.REVISION_CHANGES = REVISION_CHANGES; var objectType = '[object Object]'; function HandlebarsEnvironment(helpers, partials, decorators) { this.helpers = helpers || {}; this.partials = partials || {}; this.decorators = decorators || {}; _helpers.registerDefaultHelpers(this); _decorators.registerDefaultDecorators(this); } HandlebarsEnvironment.prototype = { constructor: HandlebarsEnvironment, logger: _logger2['default'], log: _logger2['default'].log, registerHelper: function registerHelper(name, fn) { if (_utils.toString.call(name) === objectType) { if (fn) { throw new _exception2['default']('Arg not supported with multiple helpers'); } _utils.extend(this.helpers, name); } else { this.helpers[name] = fn; } }, unregisterHelper: function unregisterHelper(name) { delete this.helpers[name]; }, registerPartial: function registerPartial(name, partial) { if (_utils.toString.call(name) === objectType) { _utils.extend(this.partials, name); } else { if (typeof partial === 'undefined') { throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); } this.partials[name] = partial; } }, unregisterPartial: function unregisterPartial(name) { delete this.partials[name]; }, registerDecorator: function registerDecorator(name, fn) { if (_utils.toString.call(name) === objectType) { if (fn) { throw new _exception2['default']('Arg not supported with multiple decorators'); } _utils.extend(this.decorators, name); } else { this.decorators[name] = fn; } }, unregisterDecorator: function unregisterDecorator(name) { delete this.decorators[name]; }, /** * Reset the memory of illegal property accesses that have already been logged. * @deprecated should only be used in handlebars test-cases */ resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { _internalProtoAccess.resetLoggedProperties(); } }; var log = _logger2['default'].log; exports.log = log; exports.createFrame = _utils.createFrame; exports.logger = _logger2['default']; /***/ }), /* 5 */ /***/ (function(module, exports) { 'use strict'; exports.__esModule = true; exports.extend = extend; exports.indexOf = indexOf; exports.escapeExpression = escapeExpression; exports.isEmpty = isEmpty; exports.createFrame = createFrame; exports.blockParams = blockParams; exports.appendContextPath = appendContextPath; var escape = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '`': '`', '=': '=' }; var badChars = /[&<>"'`=]/g, possible = /[&<>"'`=]/; function escapeChar(chr) { return escape[chr]; } function extend(obj /* , ...source */) { for (var i = 1; i < arguments.length; i++) { for (var key in arguments[i]) { if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { obj[key] = arguments[i][key]; } } } return obj; } var toString = Object.prototype.toString; exports.toString = toString; // Sourced from lodash // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt /* eslint-disable func-style */ var isFunction = function isFunction(value) { return typeof value === 'function'; }; // fallback for older versions of Chrome and Safari /* istanbul ignore next */ if (isFunction(/x/)) { exports.isFunction = isFunction = function (value) { return typeof value === 'function' && toString.call(value) === '[object Function]'; }; } exports.isFunction = isFunction; /* eslint-enable func-style */ /* istanbul ignore next */ var isArray = Array.isArray || function (value) { return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; }; exports.isArray = isArray; // Older IE versions do not directly support indexOf so we must implement our own, sadly. function indexOf(array, value) { for (var i = 0, len = array.length; i < len; i++) { if (array[i] === value) { return i; } } return -1; } function escapeExpression(string) { if (typeof string !== 'string') { // don't escape SafeStrings, since they're already safe if (string && string.toHTML) { return string.toHTML(); } else if (string == null) { return ''; } else if (!string) { return string + ''; } // Force a string conversion as this will be done by the append regardless and // the regex test will do this transparently behind the scenes, causing issues if // an object's to string has escaped characters in it. string = '' + string; } if (!possible.test(string)) { return string; } return string.replace(badChars, escapeChar); } function isEmpty(value) { if (!value && value !== 0) { return true; } else if (isArray(value) && value.length === 0) { return true; } else { return false; } } function createFrame(object) { var frame = extend({}, object); frame._parent = object; return frame; } function blockParams(params, ids) { params.path = ids; return params; } function appendContextPath(contextPath, id) { return (contextPath ? contextPath + '.' : '') + id; } /***/ }), /* 6 */ /***/ (function(module, exports, __nested_webpack_require_13814__) { 'use strict'; var _Object$defineProperty = __nested_webpack_require_13814__(7)['default']; exports.__esModule = true; var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; function Exception(message, node) { var loc = node && node.loc, line = undefined, endLineNumber = undefined, column = undefined, endColumn = undefined; if (loc) { line = loc.start.line; endLineNumber = loc.end.line; column = loc.start.column; endColumn = loc.end.column; message += ' - ' + line + ':' + column; } var tmp = Error.prototype.constructor.call(this, message); // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. for (var idx = 0; idx < errorProps.length; idx++) { this[errorProps[idx]] = tmp[errorProps[idx]]; } /* istanbul ignore else */ if (Error.captureStackTrace) { Error.captureStackTrace(this, Exception); } try { if (loc) { this.lineNumber = line; this.endLineNumber = endLineNumber; // Work around issue under safari where we can't directly set the column value /* istanbul ignore next */ if (_Object$defineProperty) { Object.defineProperty(this, 'column', { value: column, enumerable: true }); Object.defineProperty(this, 'endColumn', { value: endColumn, enumerable: true }); } else { this.column = column; this.endColumn = endColumn; } } } catch (nop) { /* Ignore if the browser is very particular */ } } Exception.prototype = new Error(); exports['default'] = Exception; module.exports = exports['default']; /***/ }), /* 7 */ /***/ (function(module, exports, __nested_webpack_require_15674__) { module.exports = { "default": __nested_webpack_require_15674__(8), __esModule: true }; /***/ }), /* 8 */ /***/ (function(module, exports, __nested_webpack_require_15825__) { var $ = __nested_webpack_require_15825__(9); module.exports = function defineProperty(it, key, desc){ return $.setDesc(it, key, desc); }; /***/ }), /* 9 */ /***/ (function(module, exports) { var $Object = Object; module.exports = { create: $Object.create, getProto: $Object.getPrototypeOf, isEnum: {}.propertyIsEnumerable, getDesc: $Object.getOwnPropertyDescriptor, setDesc: $Object.defineProperty, setDescs: $Object.defineProperties, getKeys: $Object.keys, getNames: $Object.getOwnPropertyNames, getSymbols: $Object.getOwnPropertySymbols, each: [].forEach }; /***/ }), /* 10 */ /***/ (function(module, exports, __nested_webpack_require_16519__) { 'use strict'; var _interopRequireDefault = __nested_webpack_require_16519__(1)['default']; exports.__esModule = true; exports.registerDefaultHelpers = registerDefaultHelpers; exports.moveHelperToHooks = moveHelperToHooks; var _helpersBlockHelperMissing = __nested_webpack_require_16519__(11); var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); var _helpersEach = __nested_webpack_require_16519__(12); var _helpersEach2 = _interopRequireDefault(_helpersEach); var _helpersHelperMissing = __nested_webpack_require_16519__(65); var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); var _helpersIf = __nested_webpack_require_16519__(66); var _helpersIf2 = _interopRequireDefault(_helpersIf); var _helpersLog = __nested_webpack_require_16519__(67); var _helpersLog2 = _interopRequireDefault(_helpersLog); var _helpersLookup = __nested_webpack_require_16519__(68); var _helpersLookup2 = _interopRequireDefault(_helpersLookup); var _helpersWith = __nested_webpack_require_16519__(69); var _helpersWith2 = _interopRequireDefault(_helpersWith); function registerDefaultHelpers(instance) { _helpersBlockHelperMissing2['default'](instance); _helpersEach2['default'](instance); _helpersHelperMissing2['default'](instance); _helpersIf2['default'](instance); _helpersLog2['default'](instance); _helpersLookup2['default'](instance); _helpersWith2['default'](instance); } function moveHelperToHooks(instance, helperName, keepHelper) { if (instance.helpers[helperName]) { instance.hooks[helperName] = instance.helpers[helperName]; if (!keepHelper) { // Using delete is slow instance.helpers[helperName] = undefined; } } } /***/ }), /* 11 */ /***/ (function(module, exports, __nested_webpack_require_18251__) { 'use strict'; exports.__esModule = true; var _utils = __nested_webpack_require_18251__(5); exports['default'] = function (instance) { instance.registerHelper('blockHelperMissing', function (context, options) { var inverse = options.inverse, fn = options.fn; if (context === true) { return fn(this); } else if (context === false || context == null) { return inverse(this); } else if (_utils.isArray(context)) { if (context.length > 0) { if (options.ids) { options.ids = [options.name]; } return instance.helpers.each(context, options); } else { return inverse(this); } } else { if (options.data && options.ids) { var data = _utils.createFrame(options.data); data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); options = { data: data }; } return fn(context, options); } }); }; module.exports = exports['default']; /***/ }), /* 12 */ /***/ (function(module, exports, __nested_webpack_require_19348__) { 'use strict'; var _Symbol = __nested_webpack_require_19348__(13)['default']; var _Symbol$iterator = __nested_webpack_require_19348__(43)['default']; var _getIterator = __nested_webpack_require_19348__(55)['default']; var _Object$keys = __nested_webpack_require_19348__(60)['default']; var _interopRequireDefault = __nested_webpack_require_19348__(1)['default']; exports.__esModule = true; var _utils = __nested_webpack_require_19348__(5); var _exception = __nested_webpack_require_19348__(6); var _exception2 = _interopRequireDefault(_exception); exports['default'] = function (instance) { instance.registerHelper('each', function (context, options) { if (!options) { throw new _exception2['default']('Must pass iterator to #each'); } var fn = options.fn, inverse = options.inverse, i = 0, ret = '', data = undefined, contextPath = undefined; if (options.data && options.ids) { contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; } if (_utils.isFunction(context)) { context = context.call(this); } if (options.data) { data = _utils.createFrame(options.data); } function execIteration(field, index, last) { if (data) { data.key = field; data.index = index; data.first = index === 0; data.last = !!last; if (contextPath) { data.contextPath = contextPath + field; } } ret = ret + fn(context[field], { data: data, blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) }); } if (context && typeof context === 'object') { if (_utils.isArray(context)) { for (var j = context.length; i < j; i++) { if (i in context) { execIteration(i, i, i === context.length - 1); } } } else if (typeof _Symbol === 'function' && context[_Symbol$iterator]) { var newContext = []; var iterator = _getIterator(context); for (var it = iterator.next(); !it.done; it = iterator.next()) { newContext.push(it.value); } context = newContext; for (var j = context.length; i < j; i++) { execIteration(i, i, i === context.length - 1); } } else { (function () { var priorKey = undefined; _Object$keys(context).forEach(function (key) { // We're running the iterations one step out of sync so we can detect // the last iteration without have to scan the object twice and create // an itermediate keys array. if (priorKey !== undefined) { execIteration(priorKey, i - 1); } priorKey = key; i++; }); if (priorKey !== undefined) { execIteration(priorKey, i - 1, true); } })(); } } if (i === 0) { ret = inverse(this); } return ret; }); }; module.exports = exports['default']; /***/ }), /* 13 */ /***/ (function(module, exports, __nested_webpack_require_22504__) { module.exports = { "default": __nested_webpack_require_22504__(14), __esModule: true }; /***/ }), /* 14 */ /***/ (function(module, exports, __nested_webpack_require_22657__) { __nested_webpack_require_22657__(15); __nested_webpack_require_22657__(42); module.exports = __nested_webpack_require_22657__(21).Symbol; /***/ }), /* 15 */ /***/ (function(module, exports, __nested_webpack_require_22836__) { 'use strict'; // ECMAScript 6 symbols shim var $ = __nested_webpack_require_22836__(9) , global = __nested_webpack_require_22836__(16) , has = __nested_webpack_require_22836__(17) , DESCRIPTORS = __nested_webpack_require_22836__(18) , $export = __nested_webpack_require_22836__(20) , redefine = __nested_webpack_require_22836__(24) , $fails = __nested_webpack_require_22836__(19) , shared = __nested_webpack_require_22836__(27) , setToStringTag = __nested_webpack_require_22836__(28) , uid = __nested_webpack_require_22836__(30) , wks = __nested_webpack_require_22836__(29) , keyOf = __nested_webpack_require_22836__(31) , $names = __nested_webpack_require_22836__(36) , enumKeys = __nested_webpack_require_22836__(37) , isArray = __nested_webpack_require_22836__(38) , anObject = __nested_webpack_require_22836__(39) , toIObject = __nested_webpack_require_22836__(32) , createDesc = __nested_webpack_require_22836__(26) , getDesc = $.getDesc , setDesc = $.setDesc , _create = $.create , getNames = $names.get , $Symbol = global.Symbol , $JSON = global.JSON , _stringify = $JSON && $JSON.stringify , setter = false , HIDDEN = wks('_hidden') , isEnum = $.isEnum , SymbolRegistry = shared('symbol-registry') , AllSymbols = shared('symbols') , useNative = typeof $Symbol == 'function' , ObjectProto = Object.prototype; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 var setSymbolDesc = DESCRIPTORS && $fails(function(){ return _create(setDesc({}, 'a', { get: function(){ return setDesc(this, 'a', {value: 7}).a; } })).a != 7; }) ? function(it, key, D){ var protoDesc = getDesc(ObjectProto, key); if(protoDesc)delete ObjectProto[key]; setDesc(it, key, D); if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc); } : setDesc; var wrap = function(tag){ var sym = AllSymbols[tag] = _create($Symbol.prototype); sym._k = tag; DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, { configurable: true, set: function(value){ if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; setSymbolDesc(this, tag, createDesc(1, value)); } }); return sym; }; var isSymbol = function(it){ return typeof it == 'symbol'; }; var $defineProperty = function defineProperty(it, key, D){ if(D && has(AllSymbols, key)){ if(!D.enumerable){ if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {})); it[HIDDEN][key] = true; } else { if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; D = _create(D, {enumerable: createDesc(0, false)}); } return setSymbolDesc(it, key, D); } return setDesc(it, key, D); }; var $defineProperties = function defineProperties(it, P){ anObject(it); var keys = enumKeys(P = toIObject(P)) , i = 0 , l = keys.length , key; while(l > i)$defineProperty(it, key = keys[i++], P[key]); return it; }; var $create = function create(it, P){ return P === undefined ? _create(it) : $defineProperties(_create(it), P); }; var $propertyIsEnumerable = function propertyIsEnumerable(key){ var E = isEnum.call(this, key); return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ var D = getDesc(it = toIObject(it), key); if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; return D; }; var $getOwnPropertyNames = function getOwnPropertyNames(it){ var names = getNames(toIObject(it)) , result = [] , i = 0 , key; while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key); return result; }; var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ var names = getNames(toIObject(it)) , result = [] , i = 0 , key; while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]); return result; }; var $stringify = function stringify(it){ if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined var args = [it] , i = 1 , $$ = arguments , replacer, $replacer; while($$.length > i)args.push($$[i++]); replacer = args[1]; if(typeof replacer == 'function')$replacer = replacer; if($replacer || !isArray(replacer))replacer = function(key, value){ if($replacer)value = $replacer.call(this, key, value); if(!isSymbol(value))return value; }; args[1] = replacer; return _stringify.apply($JSON, args); }; var buggyJSON = $fails(function(){ var S = $Symbol(); // MS Edge converts symbol values to JSON as {} // WebKit converts symbol values to JSON as null // V8 throws on boxed symbols return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; }); // 19.4.1.1 Symbol([description]) if(!useNative){ $Symbol = function Symbol(){ if(isSymbol(this))throw TypeError('Symbol is not a constructor'); return wrap(uid(arguments.length > 0 ? arguments[0] : undefined)); }; redefine($Symbol.prototype, 'toString', function toString(){ return this._k; }); isSymbol = function(it){ return it instanceof $Symbol; }; $.create = $create; $.isEnum = $propertyIsEnumerable; $.getDesc = $getOwnPropertyDescriptor; $.setDesc = $defineProperty; $.setDescs = $defineProperties; $.getNames = $names.get = $getOwnPropertyNames; $.getSymbols = $getOwnPropertySymbols; if(DESCRIPTORS && !__nested_webpack_require_22836__(41)){ redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); } } var symbolStatics = { // 19.4.2.1 Symbol.for(key) 'for': function(key){ return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key); }, // 19.4.2.5 Symbol.keyFor(sym) keyFor: function keyFor(key){ return keyOf(SymbolRegistry, key); }, useSetter: function(){ setter = true; }, useSimple: function(){ setter = false; } }; // 19.4.2.2 Symbol.hasInstance // 19.4.2.3 Symbol.isConcatSpreadable // 19.4.2.4 Symbol.iterator // 19.4.2.6 Symbol.match // 19.4.2.8 Symbol.replace // 19.4.2.9 Symbol.search // 19.4.2.10 Symbol.species // 19.4.2.11 Symbol.split // 19.4.2.12 Symbol.toPrimitive // 19.4.2.13 Symbol.toStringTag // 19.4.2.14 Symbol.unscopables $.each.call(( 'hasInstance,isConcatSpreadable,iterator,match,replace,search,' + 'species,split,toPrimitive,toStringTag,unscopables' ).split(','), function(it){ var sym = wks(it); symbolStatics[it] = useNative ? sym : wrap(sym); }); setter = true; $export($export.G + $export.W, {Symbol: $Symbol}); $export($export.S, 'Symbol', symbolStatics); $export($export.S + $export.F * !useNative, 'Object', { // 19.1.2.2 Object.create(O [, Properties]) create: $create, // 19.1.2.4 Object.defineProperty(O, P, Attributes) defineProperty: $defineProperty, // 19.1.2.3 Object.defineProperties(O, Properties) defineProperties: $defineProperties, // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) getOwnPropertyDescriptor: $getOwnPropertyDescriptor, // 19.1.2.7 Object.getOwnPropertyNames(O) getOwnPropertyNames: $getOwnPropertyNames, // 19.1.2.8 Object.getOwnPropertySymbols(O) getOwnPropertySymbols: $getOwnPropertySymbols }); // 24.3.2 JSON.stringify(value [, replacer [, space]]) $JSON && $export($export.S + $export.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify}); // 19.4.3.5 Symbol.prototype[@@toStringTag] setToStringTag($Symbol, 'Symbol'); // 20.2.1.9 Math[@@toStringTag] setToStringTag(Math, 'Math', true); // 24.3.3 JSON[@@toStringTag] setToStringTag(global.JSON, 'JSON', true); /***/ }), /* 16 */ /***/ (function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef /***/ }), /* 17 */ /***/ (function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; module.exports = function(it, key){ return hasOwnProperty.call(it, key); }; /***/ }), /* 18 */ /***/ (function(module, exports, __nested_webpack_require_31403__) { // Thank's IE8 for his funny defineProperty module.exports = !__nested_webpack_require_31403__(19)(function(){ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }), /* 19 */ /***/ (function(module, exports) { module.exports = function(exec){ try { return !!exec(); } catch(e){ return true; } }; /***/ }), /* 20 */ /***/ (function(module, exports, __nested_webpack_require_31829__) { var global = __nested_webpack_require_31829__(16) , core = __nested_webpack_require_31829__(21) , ctx = __nested_webpack_require_31829__(22) , PROTOTYPE = 'prototype'; var $export = function(type, name, source){ var IS_FORCED = type & $export.F , IS_GLOBAL = type & $export.G , IS_STATIC = type & $export.S , IS_PROTO = type & $export.P , IS_BIND = type & $export.B , IS_WRAP = type & $export.W , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] , key, own, out; if(IS_GLOBAL)source = name; for(key in source){ // contains in native own = !IS_FORCED && target && key in target; if(own && key in exports)continue; // export native or passed out = own ? target[key] : source[key]; // prevent global pollution for namespaces exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] // bind timers to global for call from export context : IS_BIND && own ? ctx(out, global) // wrap global constructors for prevent change them in library : IS_WRAP && target[key] == out ? (function(C){ var F = function(param){ return this instanceof C ? new C(param) : C(param); }; F[PROTOTYPE] = C[PROTOTYPE]; return F; // make static versions for prototype methods })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; } }; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap module.exports = $export; /***/ }), /* 21 */ /***/ (function(module, exports) { var core = module.exports = {version: '1.2.6'}; if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef /***/ }), /* 22 */ /***/ (function(module, exports, __nested_webpack_require_33864__) { // optional / simple context binding var aFunction = __nested_webpack_require_33864__(23); module.exports = function(fn, that, length){ aFunction(fn); if(that === undefined)return fn; switch(length){ case 1: return function(a){ return fn.call(that, a); }; case 2: return function(a, b){ return fn.call(that, a, b); }; case 3: return function(a, b, c){ return fn.call(that, a, b, c); }; } return function(/* ...args */){ return fn.apply(that, arguments); }; }; /***/ }), /* 23 */ /***/ (function(module, exports) { module.exports = function(it){ if(typeof it != 'function')throw TypeError(it + ' is not a function!'); return it; }; /***/ }), /* 24 */ /***/ (function(module, exports, __nested_webpack_require_34647__) { module.exports = __nested_webpack_require_34647__(25); /***/ }), /* 25 */ /***/ (function(module, exports, __nested_webpack_require_34767__) { var $ = __nested_webpack_require_34767__(9) , createDesc = __nested_webpack_require_34767__(26); module.exports = __nested_webpack_require_34767__(18) ? function(object, key, value){ return $.setDesc(object, key, createDesc(1, value)); } : function(object, key, value){ object[key] = value; return object; }; /***/ }), /* 26 */ /***/ (function(module, exports) { module.exports = function(bitmap, value){ return { enumerable : !(bitmap & 1), configurable: !(bitmap & 2), writable : !(bitmap & 4), value : value }; }; /***/ }), /* 27 */ /***/ (function(module, exports, __nested_webpack_require_35387__) { var global = __nested_webpack_require_35387__(16) , SHARED = '__core-js_shared__' , store = global[SHARED] || (global[SHARED] = {}); module.exports = function(key){ return store[key] || (store[key] = {}); }; /***/ }), /* 28 */ /***/ (function(module, exports, __nested_webpack_require_35672__) { var def = __nested_webpack_require_35672__(9).setDesc , has = __nested_webpack_require_35672__(17) , TAG = __nested_webpack_require_35672__(29)('toStringTag'); module.exports = function(it, tag, stat){ if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); }; /***/ }), /* 29 */ /***/ (function(module, exports, __nested_webpack_require_36026__) { var store = __nested_webpack_require_36026__(27)('wks') , uid = __nested_webpack_require_36026__(30) , Symbol = __nested_webpack_require_36026__(16).Symbol; module.exports = function(name){ return store[name] || (store[name] = Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name)); }; /***/ }), /* 30 */ /***/ (function(module, exports) { var id = 0 , px = Math.random(); module.exports = function(key){ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; /***/ }), /* 31 */ /***/ (function(module, exports, __nested_webpack_require_36597__) { var $ = __nested_webpack_require_36597__(9) , toIObject = __nested_webpack_require_36597__(32); module.exports = function(object, el){ var O = toIObject(object) , keys = $.getKeys(O) , length = keys.length , index = 0 , key; while(length > index)if(O[key = keys[index++]] === el)return key; }; /***/ }), /* 32 */ /***/ (function(module, exports, __nested_webpack_require_36990__) { // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject = __nested_webpack_require_36990__(33) , defined = __nested_webpack_require_36990__(35); module.exports = function(it){ return IObject(defined(it)); }; /***/ }), /* 33 */ /***/ (function(module, exports, __nested_webpack_require_37291__) { // fallback for non-array-like ES3 and non-enumerable old V8 strings var cof = __nested_webpack_require_37291__(34); module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ return cof(it) == 'String' ? it.split('') : Object(it); }; /***/ }), /* 34 */ /***/ (function(module, exports) { var toString = {}.toString; module.exports = function(it){ return toString.call(it).slice(8, -1); }; /***/ }), /* 35 */ /***/ (function(module, exports) { // 7.2.1 RequireObjectCoercible(argument) module.exports = function(it){ if(it == undefined)throw TypeError("Can't call method on " + it); return it; }; /***/ }), /* 36 */ /***/ (function(module, exports, __nested_webpack_require_37999__) { // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window var toIObject = __nested_webpack_require_37999__(32) , getNames = __nested_webpack_require_37999__(9).getNames , toString = {}.toString; var windowNames = typeof window == 'object' && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function(it){ try { return getNames(it); } catch(e){ return windowNames.slice(); } }; module.exports.get = function getOwnPropertyNames(it){ if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it); return getNames(toIObject(it)); }; /***/ }), /* 37 */ /***/ (function(module, exports, __nested_webpack_require_38708__) { // all enumerable object keys, includes symbols var $ = __nested_webpack_require_38708__(9); module.exports = function(it){ var keys = $.getKeys(it) , getSymbols = $.getSymbols; if(getSymbols){ var symbols = getSymbols(it) , isEnum = $.isEnum , i = 0 , key; while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key); } return keys; }; /***/ }), /* 38 */ /***/ (function(module, exports, __nested_webpack_require_39193__) { // 7.2.2 IsArray(argument) var cof = __nested_webpack_require_39193__(34); module.exports = Array.isArray || function(arg){ return cof(arg) == 'Array'; }; /***/ }), /* 39 */ /***/ (function(module, exports, __nested_webpack_require_39419__) { var isObject = __nested_webpack_require_39419__(40); module.exports = function(it){ if(!isObject(it))throw TypeError(it + ' is not an object!'); return it; }; /***/ }), /* 40 */ /***/ (function(module, exports) { module.exports = function(it){ return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }), /* 41 */ /***/ (function(module, exports) { module.exports = true; /***/ }), /* 42 */ /***/ (function(module, exports) { /***/ }), /* 43 */ /***/ (function(module, exports, __nested_webpack_require_39956__) { module.exports = { "default": __nested_webpack_require_39956__(44), __esModule: true }; /***/ }), /* 44 */ /***/ (function(module, exports, __nested_webpack_require_40109__) { __nested_webpack_require_40109__(45); __nested_webpack_require_40109__(51); module.exports = __nested_webpack_require_40109__(29)('iterator'); /***/ }), /* 45 */ /***/ (function(module, exports, __nested_webpack_require_40293__) { 'use strict'; var $at = __nested_webpack_require_40293__(46)(true); // 21.1.3.27 String.prototype[@@iterator]() __nested_webpack_require_40293__(48)(String, 'String', function(iterated){ this._t = String(iterated); // target this._i = 0; // next index // 21.1.5.2.1 %StringIteratorPrototype%.next() }, function(){ var O = this._t , index = this._i , point; if(index >= O.length)return {value: undefined, done: true}; point = $at(O, index); this._i += point.length; return {value: point, done: false}; }); /***/ }), /* 46 */ /***/ (function(module, exports, __nested_webpack_require_40908__) { var toInteger = __nested_webpack_require_40908__(47) , defined = __nested_webpack_require_40908__(35); // true -> String#at // false -> String#codePointAt module.exports = function(TO_STRING){ return function(that, pos){ var s = String(defined(that)) , i = toInteger(pos) , l = s.length , a, b; if(i < 0 || i >= l)return TO_STRING ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; /***/ }), /* 47 */ /***/ (function(module, exports) { // 7.1.4 ToInteger var ceil = Math.ceil , floor = Math.floor; module.exports = function(it){ return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; /***/ }), /* 48 */ /***/ (function(module, exports, __nested_webpack_require_41836__) { 'use strict'; var LIBRARY = __nested_webpack_require_41836__(41) , $export = __nested_webpack_require_41836__(20) , redefine = __nested_webpack_require_41836__(24) , hide = __nested_webpack_require_41836__(25) , has = __nested_webpack_require_41836__(17) , Iterators = __nested_webpack_require_41836__(49) , $iterCreate = __nested_webpack_require_41836__(50) , setToStringTag = __nested_webpack_require_41836__(28) , getProto = __nested_webpack_require_41836__(9).getProto , ITERATOR = __nested_webpack_require_41836__(29)('iterator') , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` , FF_ITERATOR = '@@iterator' , KEYS = 'keys' , VALUES = 'values'; var returnThis = function(){ return this; }; module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ $iterCreate(Constructor, NAME, next); var getMethod = function(kind){ if(!BUGGY && kind in proto)return proto[kind]; switch(kind){ case KEYS: return function keys(){ return new Constructor(this, kind); }; case VALUES: return function values(){ return new Constructor(this, kind); }; } return function entries(){ return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator' , DEF_VALUES = DEFAULT == VALUES , VALUES_BUG = false , proto = Base.prototype , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] , $default = $native || getMethod(DEFAULT) , methods, key; // Fix native if($native){ var IteratorPrototype = getProto($default.call(new Base)); // Set @@toStringTag to native iterators setToStringTag(IteratorPrototype, TAG, true); // FF fix if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); // fix Array#{values, @@iterator}.name in V8 / FF if(DEF_VALUES && $native.name !== VALUES){ VALUES_BUG = true; $default = function values(){ return $native.call(this); }; } } // Define iterator if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ hide(proto, ITERATOR, $default); } // Plug for library Iterators[NAME] = $default; Iterators[TAG] = returnThis; if(DEFAULT){ methods = { values: DEF_VALUES ? $default : getMethod(VALUES), keys: IS_SET ? $default : getMethod(KEYS), entries: !DEF_VALUES ? $default : getMethod('entries') }; if(FORCED)for(key in methods){ if(!(key in proto))redefine(proto, key, methods[key]); } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; /***/ }), /* 49 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), /* 50 */ /***/ (function(module, exports, __nested_webpack_require_44663__) { 'use strict'; var $ = __nested_webpack_require_44663__(9) , descriptor = __nested_webpack_require_44663__(26) , setToStringTag = __nested_webpack_require_44663__(28) , IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() __nested_webpack_require_44663__(25)(IteratorPrototype, __nested_webpack_require_44663__(29)('iterator'), function(){ return this; }); module.exports = function(Constructor, NAME, next){ Constructor.prototype = $.create(IteratorPrototype, {next: descriptor(1, next)}); setToStringTag(Constructor, NAME + ' Iterator'); }; /***/ }), /* 51 */ /***/ (function(module, exports, __nested_webpack_require_45276__) { __nested_webpack_require_45276__(52); var Iterators = __nested_webpack_require_45276__(49); Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array; /***/ }), /* 52 */ /***/ (function(module, exports, __nested_webpack_require_45487__) { 'use strict'; var addToUnscopables = __nested_webpack_require_45487__(53) , step = __nested_webpack_require_45487__(54) , Iterators = __nested_webpack_require_45487__(49) , toIObject = __nested_webpack_require_45487__(32); // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() module.exports = __nested_webpack_require_45487__(48)(Array, 'Array', function(iterated, kind){ this._t = toIObject(iterated); // target this._i = 0; // next index this._k = kind; // kind // 22.1.5.2.1 %ArrayIteratorPrototype%.next() }, function(){ var O = this._t , kind = this._k , index = this._i++; if(!O || index >= O.length){ this._t = undefined; return step(1); } if(kind == 'keys' )return step(0, index); if(kind == 'values')return step(0, O[index]); return step(0, [index, O[index]]); }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) Iterators.Arguments = Iterators.Array; addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); /***/ }), /* 53 */ /***/ (function(module, exports) { module.exports = function(){ /* empty */ }; /***/ }), /* 54 */ /***/ (function(module, exports) { module.exports = function(done, value){ return {value: value, done: !!done}; }; /***/ }), /* 55 */ /***/ (function(module, exports, __nested_webpack_require_46959__) { module.exports = { "default": __nested_webpack_require_46959__(56), __esModule: true }; /***/ }), /* 56 */ /***/ (function(module, exports, __nested_webpack_require_47112__) { __nested_webpack_require_47112__(51); __nested_webpack_require_47112__(45); module.exports = __nested_webpack_require_47112__(57); /***/ }), /* 57 */ /***/ (function(module, exports, __nested_webpack_require_47284__) { var anObject = __nested_webpack_require_47284__(39) , get = __nested_webpack_require_47284__(58); module.exports = __nested_webpack_require_47284__(21).getIterator = function(it){ var iterFn = get(it); if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!'); return anObject(iterFn.call(it)); }; /***/ }), /* 58 */ /***/ (function(module, exports, __nested_webpack_require_47655__) { var classof = __nested_webpack_require_47655__(59) , ITERATOR = __nested_webpack_require_47655__(29)('iterator') , Iterators = __nested_webpack_require_47655__(49); module.exports = __nested_webpack_require_47655__(21).getIteratorMethod = function(it){ if(it != undefined)return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; /***/ }), /* 59 */ /***/ (function(module, exports, __nested_webpack_require_48047__) { // getting tag from 19.1.3.6 Object.prototype.toString() var cof = __nested_webpack_require_48047__(34) , TAG = __nested_webpack_require_48047__(29)('toStringTag') // ES3 wrong here , ARG = cof(function(){ return arguments; }()) == 'Arguments'; module.exports = function(it){ var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (T = (O = Object(it))[TAG]) == 'string' ? T // builtinTag case : ARG ? cof(O) // ES3 arguments fallback : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; /***/ }), /* 60 */ /***/ (function(module, exports, __nested_webpack_require_48715__) { module.exports = { "default": __nested_webpack_require_48715__(61), __esModule: true }; /***/ }), /* 61 */ /***/ (function(module, exports, __nested_webpack_require_48868__) { __nested_webpack_require_48868__(62); module.exports = __nested_webpack_require_48868__(21).Object.keys; /***/ }), /* 62 */ /***/ (function(module, exports, __nested_webpack_require_49026__) { // 19.1.2.14 Object.keys(O) var toObject = __nested_webpack_require_49026__(63); __nested_webpack_require_49026__(64)('keys', function($keys){ return function keys(it){ return $keys(toObject(it)); }; }); /***/ }), /* 63 */ /***/ (function(module, exports, __nested_webpack_require_49297__) { // 7.1.13 ToObject(argument) var defined = __nested_webpack_require_49297__(35); module.exports = function(it){ return Object(defined(it)); }; /***/ }), /* 64 */ /***/ (function(module, exports, __nested_webpack_require_49511__) { // most Object methods by ES6 should accept primitives var $export = __nested_webpack_require_49511__(20) , core = __nested_webpack_require_49511__(21) , fails = __nested_webpack_require_49511__(19); module.exports = function(KEY, exec){ var fn = (core.Object || {})[KEY] || Object[KEY] , exp = {}; exp[KEY] = exec(fn); $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); }; /***/ }), /* 65 */ /***/ (function(module, exports, __nested_webpack_require_49979__) { 'use strict'; var _interopRequireDefault = __nested_webpack_require_49979__(1)['default']; exports.__esModule = true; var _exception = __nested_webpack_require_49979__(6); var _exception2 = _interopRequireDefault(_exception); exports['default'] = function (instance) { instance.registerHelper('helperMissing', function () /* [args, ]options */{ if (arguments.length === 1) { // A missing field in a {{foo}} construct. return undefined; } else { // Someone is actually trying to call something, blow up. throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); } }); }; module.exports = exports['default']; /***/ }), /* 66 */ /***/ (function(module, exports, __nested_webpack_require_50742__) { 'use strict'; var _interopRequireDefault = __nested_webpack_require_50742__(1)['default']; exports.__esModule = true; var _utils = __nested_webpack_require_50742__(5); var _exception = __nested_webpack_require_50742__(6); var _exception2 = _interopRequireDefault(_exception); exports['default'] = function (instance) { instance.registerHelper('if', function (conditional, options) { if (arguments.length != 2) { throw new _exception2['default']('#if requires exactly one argument'); } if (_utils.isFunction(conditional)) { conditional = conditional.call(this); } // Default behavior is to render the positive path if the value is truthy and not empty. // The `includeZero` option may be set to treat the condtional as purely not empty based on the // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { return options.inverse(this); } else { return options.fn(this); } }); instance.registerHelper('unless', function (conditional, options) { if (arguments.length != 2) { throw new _exception2['default']('#unless requires exactly one argument'); } return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); }); }; module.exports = exports['default']; /***/ }), /* 67 */ /***/ (function(module, exports) { 'use strict'; exports.__esModule = true; exports['default'] = function (instance) { instance.registerHelper('log', function () /* message, options */{ var args = [undefined], options = arguments[arguments.length - 1]; for (var i = 0; i < arguments.length - 1; i++) { args.push(arguments[i]); } var level = 1; if (options.hash.level != null) { level = options.hash.level; } else if (options.data && options.data.level != null) { level = options.data.level; } args[0] = level; instance.log.apply(instance, args); }); }; module.exports = exports['default']; /***/ }), /* 68 */ /***/ (function(module, exports) { 'use strict'; exports.__esModule = true; exports['default'] = function (instance) { instance.registerHelper('lookup', function (obj, field, options) { if (!obj) { // Note for 5.0: Change to "obj == null" in 5.0 return obj; } return options.lookupProperty(obj, field); }); }; module.exports = exports['default']; /***/ }), /* 69 */ /***/ (function(module, exports, __nested_webpack_require_53388__) { 'use strict'; var _interopRequireDefault = __nested_webpack_require_53388__(1)['default']; exports.__esModule = true; var _utils = __nested_webpack_require_53388__(5); var _exception = __nested_webpack_require_53388__(6); var _exception2 = _interopRequireDefault(_exception); exports['default'] = function (instance) { instance.registerHelper('with', function (context, options) { if (arguments.length != 2) { throw new _exception2['default']('#with requires exactly one argument'); } if (_utils.isFunction(context)) { context = context.call(this); } var fn = options.fn; if (!_utils.isEmpty(context)) { var data = options.data; if (options.data && options.ids) { data = _utils.createFrame(options.data); data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); } return fn(context, { data: data, blockParams: _utils.blockParams([context], [data && data.contextPath]) }); } else { return options.inverse(this); } }); }; module.exports = exports['default']; /***/ }), /* 70 */ /***/ (function(module, exports, __nested_webpack_require_54570__) { 'use strict'; var _interopRequireDefault = __nested_webpack_require_54570__(1)['default']; exports.__esModule = true; exports.registerDefaultDecorators = registerDefaultDecorators; var _decoratorsInline = __nested_webpack_require_54570__(71); var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); function registerDefaultDecorators(instance) { _decoratorsInline2['default'](instance); } /***/ }), /* 71 */ /***/ (function(module, exports, __nested_webpack_require_55038__) { 'use strict'; exports.__esModule = true; var _utils = __nested_webpack_require_55038__(5); exports['default'] = function (instance) { instance.registerDecorator('inline', function (fn, props, container, options) { var ret = fn; if (!props.partials) { props.partials = {}; ret = function (context, options) { // Create a new partials stack frame prior to exec. var original = container.partials; container.partials = _utils.extend({}, original, props.partials); var ret = fn(context, options); container.partials = original; return ret; }; } props.partials[options.args[0]] = options.fn; return ret; }); }; module.exports = exports['default']; /***/ }), /* 72 */ /***/ (function(module, exports, __nested_webpack_require_55863__) { 'use strict'; exports.__esModule = true; var _utils = __nested_webpack_require_55863__(5); var logger = { methodMap: ['debug', 'info', 'warn', 'error'], level: 'info', // Maps a given level value to the `methodMap` indexes above. lookupLevel: function lookupLevel(level) { if (typeof level === 'string') { var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); if (levelMap >= 0) { level = levelMap; } else { level = parseInt(level, 10); } } return level; }, // Can be overridden in the host environment log: function log(level) { level = logger.lookupLevel(level); if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { var method = logger.methodMap[level]; // eslint-disable-next-line no-console if (!console[method]) { method = 'log'; } for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { message[_key - 1] = arguments[_key]; } console[method].apply(console, message); // eslint-disable-line no-console } } }; exports['default'] = logger; module.exports = exports['default']; /***/ }), /* 73 */ /***/ (function(module, exports, __nested_webpack_require_57190__) { 'use strict'; var _Object$create = __nested_webpack_require_57190__(74)['default']; var _Object$keys = __nested_webpack_require_57190__(60)['default']; var _interopRequireDefault = __nested_webpack_require_57190__(1)['default']; exports.__esModule = true; exports.createProtoAccessControl = createProtoAccessControl; exports.resultIsAllowed = resultIsAllowed; exports.resetLoggedProperties = resetLoggedProperties; var _utils = __nested_webpack_require_57190__(5); var _logger = __nested_webpack_require_57190__(72); var _logger2 = _interopRequireDefault(_logger); var loggedProperties = _Object$create(null); function createProtoAccessControl(runtimeOptions) { // Create an object with "null"-prototype to avoid truthy results on // prototype properties. var propertyWhiteList = _Object$create(null); // eslint-disable-next-line no-proto propertyWhiteList['__proto__'] = false; _utils.extend(propertyWhiteList, runtimeOptions.allowedProtoProperties); var methodWhiteList = _Object$create(null); methodWhiteList['constructor'] = false; methodWhiteList['__defineGetter__'] = false; methodWhiteList['__defineSetter__'] = false; methodWhiteList['__lookupGetter__'] = false; methodWhiteList['__lookupSetter__'] = false; _utils.extend(methodWhiteList, runtimeOptions.allowedProtoMethods); return { properties: { whitelist: propertyWhiteList, defaultValue: runtimeOptions.allowProtoPropertiesByDefault }, methods: { whitelist: methodWhiteList, defaultValue: runtimeOptions.allowProtoMethodsByDefault } }; } function resultIsAllowed(result, protoAccessControl, propertyName) { if (typeof result === 'function') { return checkWhiteList(protoAccessControl.methods, propertyName); } else { return checkWhiteList(protoAccessControl.properties, propertyName); } } function checkWhiteList(protoAccessControlForType, propertyName) { if (protoAccessControlForType.whitelist[propertyName] !== undefined) { return protoAccessControlForType.whitelist[propertyName] === true; } if (protoAccessControlForType.defaultValue !== undefined) { return protoAccessControlForType.defaultValue; } logUnexpecedPropertyAccessOnce(propertyName); return false; } function logUnexpecedPropertyAccessOnce(propertyName) { if (loggedProperties[propertyName] !== true) { loggedProperties[propertyName] = true; _logger2['default'].log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'); } } function resetLoggedProperties() { _Object$keys(loggedProperties).forEach(function (propertyName) { delete loggedProperties[propertyName]; }); } /***/ }), /* 74 */ /***/ (function(module, exports, __nested_webpack_require_60188__) { module.exports = { "default": __nested_webpack_require_60188__(75), __esModule: true }; /***/ }), /* 75 */ /***/ (function(module, exports, __nested_webpack_require_60341__) { var $ = __nested_webpack_require_60341__(9); module.exports = function create(P, D){ return $.create(P, D); }; /***/ }), /* 76 */ /***/ (function(module, exports) { // Build out our basic SafeString type 'use strict'; exports.__esModule = true; function SafeString(string) { this.string = string; } SafeString.prototype.toString = SafeString.prototype.toHTML = function () { return '' + this.string; }; exports['default'] = SafeString; module.exports = exports['default']; /***/ }), /* 77 */ /***/ (function(module, exports, __nested_webpack_require_60904__) { 'use strict'; var _Object$seal = __nested_webpack_require_60904__(78)['default']; var _Object$keys = __nested_webpack_require_60904__(60)['default']; var _interopRequireWildcard = __nested_webpack_require_60904__(3)['default']; var _interopRequireDefault = __nested_webpack_require_60904__(1)['default']; exports.__esModule = true; exports.checkRevision = checkRevision; exports.template = template; exports.wrapProgram = wrapProgram; exports.resolvePartial = resolvePartial; exports.invokePartial = invokePartial; exports.noop = noop; var _utils = __nested_webpack_require_60904__(5); var Utils = _interopRequireWildcard(_utils); var _exception = __nested_webpack_require_60904__(6); var _exception2 = _interopRequireDefault(_exception); var _base = __nested_webpack_require_60904__(4); var _helpers = __nested_webpack_require_60904__(10); var _internalWrapHelper = __nested_webpack_require_60904__(81); var _internalProtoAccess = __nested_webpack_require_60904__(73); function checkRevision(compilerInfo) { var compilerRevision = compilerInfo && compilerInfo[0] || 1, currentRevision = _base.COMPILER_REVISION; if (compilerRevision >= _base.LAST_COMPATIBLE_COMPILER_REVISION && compilerRevision <= _base.COMPILER_REVISION) { return; } if (compilerRevision < _base.LAST_COMPATIBLE_COMPILER_REVISION) { var runtimeVersions = _base.REVISION_CHANGES[currentRevision], compilerVersions = _base.REVISION_CHANGES[compilerRevision]; throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); } else { // Use the embedded version info since the runtime doesn't know about this revision yet throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); } } function template(templateSpec, env) { /* istanbul ignore next */ if (!env) { throw new _exception2['default']('No environment passed to template'); } if (!templateSpec || !templateSpec.main) { throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); } templateSpec.main.decorator = templateSpec.main_d; // Note: Using env.VM references rather than local var references throughout this section to allow // for external users to override these as pseudo-supported APIs. env.VM.checkRevision(templateSpec.compiler); // backwards compatibility for precompiled templates with compiler-version 7 (<4.3.0) var templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7; function invokePartialWrapper(partial, context, options) { if (options.hash) { context = Utils.extend({}, context, options.hash); if (options.ids) { options.ids[0] = true; } } partial = env.VM.resolvePartial.call(this, partial, context, options); options.hooks = this.hooks; options.protoAccessControl = this.protoAccessControl; var result = env.VM.invokePartial.call(this, partial, context, options); if (result == null && env.compile) { options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); result = options.partials[options.name](context, options); } if (result != null) { if (options.indent) { var lines = result.split('\n'); for (var i = 0, l = lines.length; i < l; i++) { if (!lines[i] && i + 1 === l) { break; } lines[i] = options.indent + lines[i]; } result = lines.join('\n'); } return result; } else { throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); } } // Just add water var container = { strict: function strict(obj, name, loc) { if (!obj || !(name in obj)) { throw new _exception2['default']('"' + name + '" not defined in ' + obj, { loc: loc }); } return container.lookupProperty(obj, name); }, lookupProperty: function lookupProperty(parent, propertyName) { var result = parent[propertyName]; if (result == null) { return result; } if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return result; } if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) { return result; } return undefined; }, lookup: function lookup(depths, name) { var len = depths.length; for (var i = 0; i < len; i++) { var result = depths[i] && container.lookupProperty(depths[i], name); if (result != null) { return result; } } }, lambda: function lambda(current, context) { return typeof current === 'function' ? current.call(context) : current; }, escapeExpression: Utils.escapeExpression, invokePartial: invokePartialWrapper, fn: function fn(i) { var ret = templateSpec[i]; ret.decorator = templateSpec[i + '_d']; return ret; }, programs: [], program: function program(i, data, declaredBlockParams, blockParams, depths) { var programWrapper = this.programs[i], fn = this.fn(i); if (data || depths || blockParams || declaredBlockParams) { programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); } else if (!programWrapper) { programWrapper = this.programs[i] = wrapProgram(this, i, fn); } return programWrapper; }, data: function data(value, depth) { while (value && depth--) { value = value._parent; } return value; }, mergeIfNeeded: function mergeIfNeeded(param, common) { var obj = param || common; if (param && common && param !== common) { obj = Utils.extend({}, common, param); } return obj; }, // An empty object to use as replacement for null-contexts nullContext: _Object$seal({}), noop: env.VM.noop, compilerInfo: templateSpec.compiler }; function ret(context) { var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; var data = options.data; ret._setup(options); if (!options.partial && templateSpec.useData) { data = initData(context, data); } var depths = undefined, blockParams = templateSpec.useBlockParams ? [] : undefined; if (templateSpec.useDepths) { if (options.depths) { depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; } else { depths = [context]; } } function main(context /*, options*/) { return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); } main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); return main(context, options); } ret.isTop = true; ret._setup = function (options) { if (!options.partial) { var mergedHelpers = {}; addHelpers(mergedHelpers, env.helpers, container); addHelpers(mergedHelpers, options.helpers, container); container.helpers = mergedHelpers; if (templateSpec.usePartial) { // Use mergeIfNeeded here to prevent compiling global partials multiple times container.partials = container.mergeIfNeeded(options.partials, env.partials); } if (templateSpec.usePartial || templateSpec.useDecorators) { container.decorators = Utils.extend({}, env.decorators, options.decorators); } container.hooks = {}; container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options); var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); } else { container.protoAccessControl = options.protoAccessControl; // internal option container.helpers = options.helpers; container.partials = options.partials; container.decorators = options.decorators; container.hooks = options.hooks; } }; ret._child = function (i, data, blockParams, depths) { if (templateSpec.useBlockParams && !blockParams) { throw new _exception2['default']('must pass block params'); } if (templateSpec.useDepths && !depths) { throw new _exception2['default']('must pass parent depths'); } return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); }; return ret; } function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { function prog(context) { var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; var currentDepths = depths; if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { currentDepths = [context].concat(depths); } return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); } prog = executeDecorators(fn, prog, container, depths, data, blockParams); prog.program = i; prog.depth = depths ? depths.length : 0; prog.blockParams = declaredBlockParams || 0; return prog; } /** * This is currently part of the official API, therefore implementation details should not be changed. */ function resolvePartial(partial, context, options) { if (!partial) { if (options.name === '@partial-block') { partial = lookupOwnProperty(options.data, 'partial-block'); } else { partial = lookupOwnProperty(options.partials, options.name); } } else if (!partial.call && !options.name) { // This is a dynamic partial that returned a string options.name = partial; partial = lookupOwnProperty(options.partials, partial); } return partial; } function invokePartial(partial, context, options) { // Use the current closure context to save the partial-block if this partial var currentPartialBlock = lookupOwnProperty(options.data, 'partial-block'); options.partial = true; if (options.ids) { options.data.contextPath = options.ids[0] || options.data.contextPath; } var partialBlock = undefined; if (options.fn && options.fn !== noop) { (function () { options.data = _base.createFrame(options.data); // Wrapper function to get access to currentPartialBlock from the closure var fn = options.fn; partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) { var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; // Restore the partial-block from the closure for the execution of the block // i.e. the part inside the block of the partial call. options.data = _base.createFrame(options.data); options.data['partial-block'] = currentPartialBlock; return fn(context, options); }; if (fn.partials) { options.partials = Utils.extend({}, options.partials, fn.partials); } })(); } if (partial === undefined && partialBlock) { partial = partialBlock; } if (partial === undefined) { throw new _exception2['default']('The partial ' + options.name + ' could not be found'); } else if (partial instanceof Function) { return partial(context, options); } } function noop() { return ''; } function lookupOwnProperty(obj, name) { if (obj && Object.prototype.hasOwnProperty.call(obj, name)) { return obj[name]; } } function initData(context, data) { if (!data || !('root' in data)) { data = data ? _base.createFrame(data) : {}; data.root = context; } return data; } function executeDecorators(fn, prog, container, depths, data, blockParams) { if (fn.decorator) { var props = {}; prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); Utils.extend(prog, props); } return prog; } function addHelpers(mergedHelpers, helpers, container) { if (!helpers) return; _Object$keys(helpers).forEach(function (helperName) { var helper = helpers[helperName]; mergedHelpers[helperName] = passLookupPropertyOption(helper, container); }); } function passLookupPropertyOption(helper, container) { var lookupProperty = container.lookupProperty; return _internalWrapHelper.wrapHelper(helper, function (options) { options.lookupProperty = lookupProperty; return options; }); } /***/ }), /* 78 */ /***/ (function(module, exports, __nested_webpack_require_74187__) { module.exports = { "default": __nested_webpack_require_74187__(79), __esModule: true }; /***/ }), /* 79 */ /***/ (function(module, exports, __nested_webpack_require_74340__) { __nested_webpack_require_74340__(80); module.exports = __nested_webpack_require_74340__(21).Object.seal; /***/ }), /* 80 */ /***/ (function(module, exports, __nested_webpack_require_74498__) { // 19.1.2.17 Object.seal(O) var isObject = __nested_webpack_require_74498__(40); __nested_webpack_require_74498__(64)('seal', function($seal){ return function seal(it){ return $seal && isObject(it) ? $seal(it) : it; }; }); /***/ }), /* 81 */ /***/ (function(module, exports) { 'use strict'; exports.__esModule = true; exports.wrapHelper = wrapHelper; function wrapHelper(helper, transformOptionsFn) { if (typeof helper !== 'function') { // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. return helper; } var wrapper = function wrapper() /* dynamic arguments */{ var options = arguments[arguments.length - 1]; arguments[arguments.length - 1] = transformOptionsFn(options); return helper.apply(this, arguments); }; return wrapper; } /***/ }), /* 82 */ /***/ (function(module, exports) { /* global globalThis */ 'use strict'; exports.__esModule = true; exports['default'] = function (Handlebars) { /* istanbul ignore next */ // https://mathiasbynens.be/notes/globalthis (function () { if (typeof globalThis === 'object') return; Object.prototype.__defineGetter__('__magic__', function () { return this; }); __magic__.globalThis = __magic__; // eslint-disable-line no-undef delete Object.prototype.__magic__; })(); var $Handlebars = globalThis.Handlebars; /* istanbul ignore next */ Handlebars.noConflict = function () { if (globalThis.Handlebars === Handlebars) { globalThis.Handlebars = $Handlebars; } return Handlebars; }; }; module.exports = exports['default']; /***/ }), /* 83 */ /***/ (function(module, exports) { 'use strict'; exports.__esModule = true; var AST = { // Public API used to evaluate derived attributes regarding AST nodes helpers: { // a mustache is definitely a helper if: // * it is an eligible helper, and // * it has at least one parameter or hash segment helperExpression: function helperExpression(node) { return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash); }, scopedId: function scopedId(path) { return (/^\.|this\b/.test(path.original) ); }, // an ID is simple if it only has one part, and that part is not // `..` or `this`. simpleId: function simpleId(path) { return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; } } }; // Must be exported as an object rather than the root of the module as the jison lexer // must modify the object to operate properly. exports['default'] = AST; module.exports = exports['default']; /***/ }), /* 84 */ /***/ (function(module, exports, __nested_webpack_require_77451__) { 'use strict'; var _Object$keys = __nested_webpack_require_77451__(60)['default']; var _interopRequireDefault = __nested_webpack_require_77451__(1)['default']; var _interopRequireWildcard = __nested_webpack_require_77451__(3)['default']; exports.__esModule = true; exports.parseWithoutProcessing = parseWithoutProcessing; exports.parse = parse; var _parser = __nested_webpack_require_77451__(85); var _parser2 = _interopRequireDefault(_parser); var _whitespaceControl = __nested_webpack_require_77451__(86); var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); var _helpers = __nested_webpack_require_77451__(88); var Helpers = _interopRequireWildcard(_helpers); var _exception = __nested_webpack_require_77451__(6); var _exception2 = _interopRequireDefault(_exception); var _utils = __nested_webpack_require_77451__(5); exports.parser = _parser2['default']; var yy = {}; _utils.extend(yy, Helpers); function parseWithoutProcessing(input, options) { // Just return if an already-compiled AST was passed in. if (input.type === 'Program') { // When a pre-parsed AST is passed in, validate all node values to prevent // code injection via type-confused literals. validateInputAst(input); return input; } _parser2['default'].yy = yy; // Altering the shared object here, but this is ok as parser is a sync operation yy.locInfo = function (locInfo) { return new yy.SourceLocation(options && options.srcName, locInfo); }; var ast = _parser2['default'].parse(input); return ast; } function parse(input, options) { var ast = parseWithoutProcessing(input, options); var strip = new _whitespaceControl2['default'](options); return strip.accept(ast); } function validateInputAst(ast) { validateAstNode(ast); } function validateAstNode(node) { if (node == null) { return; } if (Array.isArray(node)) { node.forEach(validateAstNode); return; } if (typeof node !== 'object') { return; } if (node.type === 'PathExpression') { if (!isValidDepth(node.depth)) { throw new _exception2['default']('Invalid AST: PathExpression.depth must be an integer'); } if (!Array.isArray(node.parts)) { throw new _exception2['default']('Invalid AST: PathExpression.parts must be an array'); } for (var i = 0; i < node.parts.length; i++) { if (typeof node.parts[i] !== 'string') { throw new _exception2['default']('Invalid AST: PathExpression.parts must only contain strings'); } } } else if (node.type === 'NumberLiteral') { if (typeof node.value !== 'number' || !isFinite(node.value)) { throw new _exception2['default']('Invalid AST: NumberLiteral.value must be a number'); } } else if (node.type === 'BooleanLiteral') { if (typeof node.value !== 'boolean') { throw new _exception2['default']('Invalid AST: BooleanLiteral.value must be a boolean'); } } _Object$keys(node).forEach(function (propertyName) { if (propertyName === 'loc') { return; } validateAstNode(node[propertyName]); }); } function isValidDepth(depth) { return typeof depth === 'number' && isFinite(depth) && Math.floor(depth) === depth && depth >= 0; } /***/ }), /* 85 */ /***/ (function(module, exports) { // File ignored in coverage tests via setting in .istanbul.yml /* Jison generated parser */ "use strict"; exports.__esModule = true; var handlebars = (function () { var parser = { trace: function trace() {}, yy: {}, symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 0], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { var $0 = $$.length - 1; switch (yystate) { case 1: return $$[$0 - 1]; // removed by dead control flow case 2: this.$ = yy.prepareProgram($$[$0]); break; case 3: this.$ = $$[$0]; break; case 4: this.$ = $$[$0]; break; case 5: this.$ = $$[$0]; break; case 6: this.$ = $$[$0]; break; case 7: this.$ = $$[$0]; break; case 8: this.$ = $$[$0]; break; case 9: this.$ = { type: 'CommentStatement', value: yy.stripComment($$[$0]), strip: yy.stripFlags($$[$0], $$[$0]), loc: yy.locInfo(this._$) }; break; case 10: this.$ = { type: 'ContentStatement', original: $$[$0], value: $$[$0], loc: yy.locInfo(this._$) }; break; case 11: this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); break; case 12: this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; break; case 13: this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); break; case 14: this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); break; case 15: this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; break; case 16: this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; break; case 17: this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; break; case 18: this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; break; case 19: var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), program = yy.prepareProgram([inverse], $$[$0 - 1].loc); program.chained = true; this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; break; case 20: this.$ = $$[$0]; break; case 21: this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; break; case 22: this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); break; case 23: this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); break; case 24: this.$ = { type: 'PartialStatement', name: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], indent: '', strip: yy.stripFlags($$[$0 - 4], $$[$0]), loc: yy.locInfo(this._$) }; break; case 25: this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); break; case 26: this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) }; break; case 27: this.$ = $$[$0]; break; case 28: this.$ = $$[$0]; break; case 29: this.$ = { type: 'SubExpression', path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], loc: yy.locInfo(this._$) }; break; case 30: this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) }; break; case 31: this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) }; break; case 32: this.$ = yy.id($$[$0 - 1]); break; case 33: this.$ = $$[$0]; break; case 34: this.$ = $$[$0]; break; case 35: this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) }; break; case 36: this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) }; break; case 37: this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) }; break; case 38: this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) }; break; case 39: this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) }; break; case 40: this.$ = $$[$0]; break; case 41: this.$ = $$[$0]; break; case 42: this.$ = yy.preparePath(true, $$[$0], this._$); break; case 43: this.$ = yy.preparePath(false, $$[$0], this._$); break; case 44: $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2]; break; case 45: this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; break; case 46: this.$ = []; break; case 47: $$[$0 - 1].push($$[$0]); break; case 48: this.$ = []; break; case 49: $$[$0 - 1].push($$[$0]); break; case 50: this.$ = []; break; case 51: $$[$0 - 1].push($$[$0]); break; case 58: this.$ = []; break; case 59: $$[$0 - 1].push($$[$0]); break; case 64: this.$ = []; break; case 65: $$[$0 - 1].push($$[$0]); break; case 70: this.$ = []; break; case 71: $$[$0 - 1].push($$[$0]); break; case 78: this.$ = []; break; case 79: $$[$0 - 1].push($$[$0]); break; case 82: this.$ = []; break; case 83: $$[$0 - 1].push($$[$0]); break; case 86: this.$ = []; break; case 87: $$[$0 - 1].push($$[$0]); break; case 90: this.$ = []; break; case 91: $$[$0 - 1].push($$[$0]); break; case 94: this.$ = []; break; case 95: $$[$0 - 1].push($$[$0]); break; case 98: this.$ = [$$[$0]]; break; case 99: $$[$0 - 1].push($$[$0]); break; case 100: this.$ = [$$[$0]]; break; case 101: $$[$0 - 1].push($$[$0]); break; } }, table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 15: [2, 48], 17: 39, 18: [2, 48] }, { 20: 41, 56: 40, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 44, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 45, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 41, 56: 48, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 49, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 50] }, { 72: [1, 35], 86: 51 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 52, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 53, 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 54, 47: [2, 54] }, { 28: 59, 43: 60, 44: [1, 58], 47: [2, 56] }, { 13: 62, 15: [1, 20], 18: [1, 61] }, { 33: [2, 86], 57: 63, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 64, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 65, 47: [1, 66] }, { 30: 67, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 68, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 69, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 70, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 74, 33: [2, 80], 50: 71, 63: 72, 64: 75, 65: [1, 43], 69: 73, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 79] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 50] }, { 20: 74, 53: 80, 54: [2, 84], 63: 81, 64: 75, 65: [1, 43], 69: 82, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 83, 47: [1, 66] }, { 47: [2, 55] }, { 4: 84, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 85, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 86, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 87, 47: [1, 66] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 74, 33: [2, 88], 58: 88, 63: 89, 64: 75, 65: [1, 43], 69: 90, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 91, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 92, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 31: 93, 33: [2, 60], 63: 94, 64: 75, 65: [1, 43], 69: 95, 70: 76, 71: 77, 72: [1, 78], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 66], 36: 96, 63: 97, 64: 75, 65: [1, 43], 69: 98, 70: 76, 71: 77, 72: [1, 78], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 22: 99, 23: [2, 52], 63: 100, 64: 75, 65: [1, 43], 69: 101, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 92], 62: 102, 63: 103, 64: 75, 65: [1, 43], 69: 104, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 105] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 106, 72: [1, 107], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 108], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 109] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 111, 46: 110, 47: [2, 76] }, { 33: [2, 70], 40: 112, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 113] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 74, 63: 115, 64: 75, 65: [1, 43], 67: 114, 68: [2, 96], 69: 116, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 117] }, { 32: 118, 33: [2, 62], 74: 119, 75: [1, 120] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 121, 74: 122, 75: [1, 120] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 123] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 124] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 108] }, { 20: 74, 63: 125, 64: 75, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 74, 33: [2, 72], 41: 126, 63: 127, 64: 75, 65: [1, 43], 69: 128, 70: 76, 71: 77, 72: [1, 78], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 129] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 130] }, { 33: [2, 63] }, { 72: [1, 132], 76: 131 }, { 33: [1, 133] }, { 33: [2, 69] }, { 15: [2, 12], 18: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 134, 74: 135, 75: [1, 120] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 137], 77: [1, 136] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 138] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }], defaultActions: { 4: [2, 1], 54: [2, 55], 56: [2, 20], 60: [2, 57], 73: [2, 81], 82: [2, 85], 86: [2, 18], 90: [2, 89], 101: [2, 53], 104: [2, 93], 110: [2, 19], 111: [2, 77], 116: [2, 97], 119: [2, 63], 122: [2, 69], 135: [2, 75], 136: [2, 32] }, parseError: function parseError(str, hash) { throw new Error(str); }, parse: function parse(input) { var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; this.lexer.setInput(input); this.lexer.yy = this.yy; this.yy.lexer = this.lexer; this.yy.parser = this; if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; var yyloc = this.lexer.yylloc; lstack.push(yyloc); var ranges = this.lexer.options && this.lexer.options.ranges; if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = self.lexer.lex() || 1; if (typeof token !== "number") { token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == "undefined") { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === "undefined" || !action.length || !action[0]) { var errStr = ""; if (!recovering) { expected = []; for (p in table[state]) if (this.terminals_[p] && p > 2) { expected.push("'" + this.terminals_[p] + "'"); } if (this.lexer.showPosition) { errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; } else { errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); } this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); } } if (action[0] instanceof Array && action.length > 1) { throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(this.lexer.yytext); lstack.push(this.lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = this.lexer.yyleng; yytext = this.lexer.yytext; yylineno = this.lexer.yylineno; yyloc = this.lexer.yylloc; if (recovering > 0) recovering--; } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; } r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); if (typeof r !== "undefined") { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; } }; /* Jison generated lexer */ var lexer = (function () { var lexer = { EOF: 1, parseError: function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, setInput: function setInput(input) { this._input = input; this._more = this._less = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) this.yylloc.range = [0, 0]; this.offset = 0; return this; }, input: function input() { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) this.yylloc.range[1]++; this._input = this._input.slice(1); return ch; }, unput: function unput(ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) this.yylineno -= lines.length - 1; var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } return this; }, more: function more() { this._more = true; return this; }, less: function less(n) { this.unput(this.match.slice(n)); }, pastInput: function pastInput() { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); }, upcomingInput: function upcomingInput() { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20 - next.length); } return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, showPosition: function showPosition() { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, next: function next() { if (this.done) { return this.EOF; } if (!this._input) this.done = true; var token, match, tempMatch, index, col, lines; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (!this.options.flex) break; } } if (match) { lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) this.yylineno += lines.length; this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) this.done = false; if (token) return token;else return; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, lex: function lex() { var r = this.next(); if (typeof r !== 'undefined') { return r; } else { return this.lex(); } }, begin: function begin(condition) { this.conditionStack.push(condition); }, popState: function popState() { return this.conditionStack.pop(); }, _currentRules: function _currentRules() { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; }, topState: function topState() { return this.conditionStack[this.conditionStack.length - 2]; }, pushState: function begin(condition) { this.begin(condition); } }; lexer.options = {}; lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { function strip(start, end) { return yy_.yytext = yy_.yytext.substring(start, yy_.yyleng - end + start); } var YYSTATE = YY_START; switch ($avoiding_name_collisions) { case 0: if (yy_.yytext.slice(-2) === "\\\\") { strip(0, 1); this.begin("mu"); } else if (yy_.yytext.slice(-1) === "\\") { strip(0, 1); this.begin("emu"); } else { this.begin("mu"); } if (yy_.yytext) return 15; break; case 1: return 15; // removed by dead control flow case 2: this.popState(); return 15; // removed by dead control flow case 3: this.begin('raw');return 15; // removed by dead control flow case 4: this.popState(); // Should be using `this.topState()` below, but it currently // returns the second top instead of the first top. Opened an // issue about it at https://github.com/zaach/jison/issues/291 if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { return 15; } else { strip(5, 9); return 'END_RAW_BLOCK'; } // removed by dead control flow case 5: return 15; // removed by dead control flow case 6: this.popState(); return 14; // removed by dead control flow case 7: return 65; // removed by dead control flow case 8: return 68; // removed by dead control flow case 9: return 19; // removed by dead control flow case 10: this.popState(); this.begin('raw'); return 23; // removed by dead control flow case 11: return 55; // removed by dead control flow case 12: return 60; // removed by dead control flow case 13: return 29; // removed by dead control flow case 14: return 47; // removed by dead control flow case 15: this.popState();return 44; // removed by dead control flow case 16: this.popState();return 44; // removed by dead control flow case 17: return 34; // removed by dead control flow case 18: return 39; // removed by dead control flow case 19: return 51; // removed by dead control flow case 20: return 48; // removed by dead control flow case 21: this.unput(yy_.yytext); this.popState(); this.begin('com'); break; case 22: this.popState(); return 14; // removed by dead control flow case 23: return 48; // removed by dead control flow case 24: return 73; // removed by dead control flow case 25: return 72; // removed by dead control flow case 26: return 72; // removed by dead control flow case 27: return 87; // removed by dead control flow case 28: // ignore whitespace break; case 29: this.popState();return 54; // removed by dead control flow case 30: this.popState();return 33; // removed by dead control flow case 31: yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80; // removed by dead control flow case 32: yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80; // removed by dead control flow case 33: return 85; // removed by dead control flow case 34: return 82; // removed by dead control flow case 35: return 82; // removed by dead control flow case 36: return 83; // removed by dead control flow case 37: return 84; // removed by dead control flow case 38: return 81; // removed by dead control flow case 39: return 75; // removed by dead control flow case 40: return 77; // removed by dead control flow case 41: return 72; // removed by dead control flow case 42: yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72; // removed by dead control flow case 43: return 'INVALID'; // removed by dead control flow case 44: return 5; // removed by dead control flow } }; lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]+?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } }; return lexer; })(); parser.lexer = lexer; function Parser() { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; return new Parser(); })();exports["default"] = handlebars; module.exports = exports["default"]; /***/ }), /* 86 */ /***/ (function(module, exports, __nested_webpack_require_130256__) { 'use strict'; var _interopRequireDefault = __nested_webpack_require_130256__(1)['default']; exports.__esModule = true; var _visitor = __nested_webpack_require_130256__(87); var _visitor2 = _interopRequireDefault(_visitor); function WhitespaceControl() { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; this.options = options; } WhitespaceControl.prototype = new _visitor2['default'](); WhitespaceControl.prototype.Program = function (program) { var doStandalone = !this.options.ignoreStandalone; var isRoot = !this.isRootSeen; this.isRootSeen = true; var body = program.body; for (var i = 0, l = body.length; i < l; i++) { var current = body[i], strip = this.accept(current); if (!strip) { continue; } var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), _isNextWhitespace = isNextWhitespace(body, i, isRoot), openStandalone = strip.openStandalone && _isPrevWhitespace, closeStandalone = strip.closeStandalone && _isNextWhitespace, inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; if (strip.close) { omitRight(body, i, true); } if (strip.open) { omitLeft(body, i, true); } if (doStandalone && inlineStandalone) { omitRight(body, i); if (omitLeft(body, i)) { // If we are on a standalone node, save the indent info for partials if (current.type === 'PartialStatement') { // Pull out the whitespace from the final line current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; } } } if (doStandalone && openStandalone) { omitRight((current.program || current.inverse).body); // Strip out the previous content node if it's whitespace only omitLeft(body, i); } if (doStandalone && closeStandalone) { // Always strip the next node omitRight(body, i); omitLeft((current.inverse || current.program).body); } } return program; }; WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) { this.accept(block.program); this.accept(block.inverse); // Find the inverse program that is involed with whitespace stripping. var program = block.program || block.inverse, inverse = block.program && block.inverse, firstInverse = inverse, lastInverse = inverse; if (inverse && inverse.chained) { firstInverse = inverse.body[0].program; // Walk the inverse chain to find the last inverse that is actually in the chain. while (lastInverse.chained) { lastInverse = lastInverse.body[lastInverse.body.length - 1].program; } } var strip = { open: block.openStrip.open, close: block.closeStrip.close, // Determine the standalone candiacy. Basically flag our content as being possibly standalone // so our parent can determine if we actually are standalone openStandalone: isNextWhitespace(program.body), closeStandalone: isPrevWhitespace((firstInverse || program).body) }; if (block.openStrip.close) { omitRight(program.body, null, true); } if (inverse) { var inverseStrip = block.inverseStrip; if (inverseStrip.open) { omitLeft(program.body, null, true); } if (inverseStrip.close) { omitRight(firstInverse.body, null, true); } if (block.closeStrip.open) { omitLeft(lastInverse.body, null, true); } // Find standalone else statments if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { omitLeft(program.body); omitRight(firstInverse.body); } } else if (block.closeStrip.open) { omitLeft(program.body, null, true); } return strip; }; WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) { return mustache.strip; }; WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { /* istanbul ignore next */ var strip = node.strip || {}; return { inlineStandalone: true, open: strip.open, close: strip.close }; }; function isPrevWhitespace(body, i, isRoot) { if (i === undefined) { i = body.length; } // Nodes that end with newlines are considered whitespace (but are special // cased for strip operations) var prev = body[i - 1], sibling = body[i - 2]; if (!prev) { return isRoot; } if (prev.type === 'ContentStatement') { return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); } } function isNextWhitespace(body, i, isRoot) { if (i === undefined) { i = -1; } var next = body[i + 1], sibling = body[i + 2]; if (!next) { return isRoot; } if (next.type === 'ContentStatement') { return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); } } // Marks the node to the right of the position as omitted. // I.e. {{foo}}' ' will mark the ' ' node as omitted. // // If i is undefined, then the first child will be marked as such. // // If mulitple is truthy then all whitespace will be stripped out until non-whitespace // content is met. function omitRight(body, i, multiple) { var current = body[i == null ? 0 : i + 1]; if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { return; } var original = current.value; current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); current.rightStripped = current.value !== original; } // Marks the node to the left of the position as omitted. // I.e. ' '{{foo}} will mark the ' ' node as omitted. // // If i is undefined then the last child will be marked as such. // // If mulitple is truthy then all whitespace will be stripped out until non-whitespace // content is met. function omitLeft(body, i, multiple) { var current = body[i == null ? body.length - 1 : i - 1]; if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { return; } // We omit the last node if it's whitespace only and not preceded by a non-content node. var original = current.value; current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); current.leftStripped = current.value !== original; return current.leftStripped; } exports['default'] = WhitespaceControl; module.exports = exports['default']; /***/ }), /* 87 */ /***/ (function(module, exports, __nested_webpack_require_137041__) { 'use strict'; var _interopRequireDefault = __nested_webpack_require_137041__(1)['default']; exports.__esModule = true; var _exception = __nested_webpack_require_137041__(6); var _exception2 = _interopRequireDefault(_exception); function Visitor() { this.parents = []; } Visitor.prototype = { constructor: Visitor, mutating: false, // Visits a given value. If mutating, will replace the value if necessary. acceptKey: function acceptKey(node, name) { var value = this.accept(node[name]); if (this.mutating) { // Hacky sanity check: This may have a few false positives for type for the helper // methods but will generally do the right thing without a lot of overhead. if (value && !Visitor.prototype[value.type]) { throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); } node[name] = value; } }, // Performs an accept operation with added sanity check to ensure // required keys are not removed. acceptRequired: function acceptRequired(node, name) { this.acceptKey(node, name); if (!node[name]) { throw new _exception2['default'](node.type + ' requires ' + name); } }, // Traverses a given array. If mutating, empty respnses will be removed // for child elements. acceptArray: function acceptArray(array) { for (var i = 0, l = array.length; i < l; i++) { this.acceptKey(array, i); if (!array[i]) { array.splice(i, 1); i--; l--; } } }, accept: function accept(object) { if (!object) { return; } /* istanbul ignore next: Sanity code */ if (!this[object.type]) { throw new _exception2['default']('Unknown type: ' + object.type, object); } if (this.current) { this.parents.unshift(this.current); } this.current = object; var ret = this[object.type](object); this.current = this.parents.shift(); if (!this.mutating || ret) { return ret; } else if (ret !== false) { return object; } }, Program: function Program(program) { this.acceptArray(program.body); }, MustacheStatement: visitSubExpression, Decorator: visitSubExpression, BlockStatement: visitBlock, DecoratorBlock: visitBlock, PartialStatement: visitPartial, PartialBlockStatement: function PartialBlockStatement(partial) { visitPartial.call(this, partial); this.acceptKey(partial, 'program'); }, ContentStatement: function ContentStatement() /* content */{}, CommentStatement: function CommentStatement() /* comment */{}, SubExpression: visitSubExpression, PathExpression: function PathExpression() /* path */{}, StringLiteral: function StringLiteral() /* string */{}, NumberLiteral: function NumberLiteral() /* number */{}, BooleanLiteral: function BooleanLiteral() /* bool */{}, UndefinedLiteral: function UndefinedLiteral() /* literal */{}, NullLiteral: function NullLiteral() /* literal */{}, Hash: function Hash(hash) { this.acceptArray(hash.pairs); }, HashPair: function HashPair(pair) { this.acceptRequired(pair, 'value'); } }; function visitSubExpression(mustache) { this.acceptRequired(mustache, 'path'); this.acceptArray(mustache.params); this.acceptKey(mustache, 'hash'); } function visitBlock(block) { visitSubExpression.call(this, block); this.acceptKey(block, 'program'); this.acceptKey(block, 'inverse'); } function visitPartial(partial) { this.acceptRequired(partial, 'name'); this.acceptArray(partial.params); this.acceptKey(partial, 'hash'); } exports['default'] = Visitor; module.exports = exports['default']; /***/ }), /* 88 */ /***/ (function(module, exports, __nested_webpack_require_140897__) { 'use strict'; var _interopRequireDefault = __nested_webpack_require_140897__(1)['default']; exports.__esModule = true; exports.SourceLocation = SourceLocation; exports.id = id; exports.stripFlags = stripFlags; exports.stripComment = stripComment; exports.preparePath = preparePath; exports.prepareMustache = prepareMustache; exports.prepareRawBlock = prepareRawBlock; exports.prepareBlock = prepareBlock; exports.prepareProgram = prepareProgram; exports.preparePartialBlock = preparePartialBlock; var _exception = __nested_webpack_require_140897__(6); var _exception2 = _interopRequireDefault(_exception); function validateClose(open, close) { close = close.path ? close.path.original : close; if (open.path.original !== close) { var errorNode = { loc: open.path.loc }; throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode); } } function SourceLocation(source, locInfo) { this.source = source; this.start = { line: locInfo.first_line, column: locInfo.first_column }; this.end = { line: locInfo.last_line, column: locInfo.last_column }; } function id(token) { if (/^\[.*\]$/.test(token)) { return token.substring(1, token.length - 1); } else { return token; } } function stripFlags(open, close) { return { open: open.charAt(2) === '~', close: close.charAt(close.length - 3) === '~' }; } function stripComment(comment) { return comment.replace(/^\{\{~?!-?-?/, '').replace(/-?-?~?\}\}$/, ''); } function preparePath(data, parts, loc) { loc = this.locInfo(loc); var original = data ? '@' : '', dig = [], depth = 0; for (var i = 0, l = parts.length; i < l; i++) { var part = parts[i].part, // If we have [] syntax then we do not treat path references as operators, // i.e. foo.[this] resolves to approximately context.foo['this'] isLiteral = parts[i].original !== part; original += (parts[i].separator || '') + part; if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { if (dig.length > 0) { throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); } else if (part === '..') { depth++; } } else { dig.push(part); } } return { type: 'PathExpression', data: data, depth: depth, parts: dig, original: original, loc: loc }; } function prepareMustache(path, params, hash, open, strip, locInfo) { // Must use charAt to support IE pre-10 var escapeFlag = open.charAt(3) || open.charAt(2), escaped = escapeFlag !== '{' && escapeFlag !== '&'; var decorator = /\*/.test(open); return { type: decorator ? 'Decorator' : 'MustacheStatement', path: path, params: params, hash: hash, escaped: escaped, strip: strip, loc: this.locInfo(locInfo) }; } function prepareRawBlock(openRawBlock, contents, close, locInfo) { validateClose(openRawBlock, close); locInfo = this.locInfo(locInfo); var program = { type: 'Program', body: contents, strip: {}, loc: locInfo }; return { type: 'BlockStatement', path: openRawBlock.path, params: openRawBlock.params, hash: openRawBlock.hash, program: program, openStrip: {}, inverseStrip: {}, closeStrip: {}, loc: locInfo }; } function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { if (close && close.path) { validateClose(openBlock, close); } var decorator = /\*/.test(openBlock.open); program.blockParams = openBlock.blockParams; var inverse = undefined, inverseStrip = undefined; if (inverseAndProgram) { if (decorator) { throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram); } if (inverseAndProgram.chain) { inverseAndProgram.program.body[0].closeStrip = close.strip; } inverseStrip = inverseAndProgram.strip; inverse = inverseAndProgram.program; } if (inverted) { inverted = inverse; inverse = program; program = inverted; } return { type: decorator ? 'DecoratorBlock' : 'BlockStatement', path: openBlock.path, params: openBlock.params, hash: openBlock.hash, program: program, inverse: inverse, openStrip: openBlock.strip, inverseStrip: inverseStrip, closeStrip: close && close.strip, loc: this.locInfo(locInfo) }; } function prepareProgram(statements, loc) { if (!loc && statements.length) { var firstLoc = statements[0].loc, lastLoc = statements[statements.length - 1].loc; /* istanbul ignore else */ if (firstLoc && lastLoc) { loc = { source: firstLoc.source, start: { line: firstLoc.start.line, column: firstLoc.start.column }, end: { line: lastLoc.end.line, column: lastLoc.end.column } }; } } return { type: 'Program', body: statements, strip: {}, loc: loc }; } function preparePartialBlock(open, program, close, locInfo) { validateClose(open, close); return { type: 'PartialBlockStatement', name: open.path, params: open.params, hash: open.hash, program: program, openStrip: open.strip, closeStrip: close && close.strip, loc: this.locInfo(locInfo) }; } /***/ }), /* 89 */ /***/ (function(module, exports, __nested_webpack_require_146492__) { /* eslint-disable new-cap */ 'use strict'; var _Object$create = __nested_webpack_require_146492__(74)['default']; var _interopRequireDefault = __nested_webpack_require_146492__(1)['default']; exports.__esModule = true; exports.Compiler = Compiler; exports.precompile = precompile; exports.compile = compile; var _exception = __nested_webpack_require_146492__(6); var _exception2 = _interopRequireDefault(_exception); var _utils = __nested_webpack_require_146492__(5); var _ast = __nested_webpack_require_146492__(83); var _ast2 = _interopRequireDefault(_ast); var slice = [].slice; function Compiler() {} // the foundHelper register will disambiguate helper lookup from finding a // function in a context. This is necessary for mustache compatibility, which // requires that context functions in blocks are evaluated by blockHelperMissing, // and then proceed as if the resulting value was provided to blockHelperMissing. Compiler.prototype = { compiler: Compiler, equals: function equals(other) { var len = this.opcodes.length; if (other.opcodes.length !== len) { return false; } for (var i = 0; i < len; i++) { var opcode = this.opcodes[i], otherOpcode = other.opcodes[i]; if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { return false; } } // We know that length is the same between the two arrays because they are directly tied // to the opcode behavior above. len = this.children.length; for (var i = 0; i < len; i++) { if (!this.children[i].equals(other.children[i])) { return false; } } return true; }, guid: 0, compile: function compile(program, options) { this.sourceNode = []; this.opcodes = []; this.children = []; this.options = options; this.stringParams = options.stringParams; this.trackIds = options.trackIds; options.blockParams = options.blockParams || []; options.knownHelpers = _utils.extend(_Object$create(null), { helperMissing: true, blockHelperMissing: true, each: true, 'if': true, unless: true, 'with': true, log: true, lookup: true }, options.knownHelpers); return this.accept(program); }, compileProgram: function compileProgram(program) { var childCompiler = new this.compiler(), // eslint-disable-line new-cap result = childCompiler.compile(program, this.options), guid = this.guid++; this.usePartial = this.usePartial || result.usePartial; this.children[guid] = result; this.useDepths = this.useDepths || result.useDepths; return guid; }, accept: function accept(node) { /* istanbul ignore next: Sanity code */ if (!this[node.type]) { throw new _exception2['default']('Unknown type: ' + node.type, node); } this.sourceNode.unshift(node); var ret = this[node.type](node); this.sourceNode.shift(); return ret; }, Program: function Program(program) { this.options.blockParams.unshift(program.blockParams); var body = program.body, bodyLength = body.length; for (var i = 0; i < bodyLength; i++) { this.accept(body[i]); } this.options.blockParams.shift(); this.isSimple = bodyLength === 1; this.blockParams = program.blockParams ? program.blockParams.length : 0; return this; }, BlockStatement: function BlockStatement(block) { transformLiteralToPath(block); var program = block.program, inverse = block.inverse; program = program && this.compileProgram(program); inverse = inverse && this.compileProgram(inverse); var type = this.classifySexpr(block); if (type === 'helper') { this.helperSexpr(block, program, inverse); } else if (type === 'simple') { this.simpleSexpr(block); // now that the simple mustache is resolved, we need to // evaluate it by executing `blockHelperMissing` this.opcode('pushProgram', program); this.opcode('pushProgram', inverse); this.opcode('emptyHash'); this.opcode('blockValue', block.path.original); } else { this.ambiguousSexpr(block, program, inverse); // now that the simple mustache is resolved, we need to // evaluate it by executing `blockHelperMissing` this.opcode('pushProgram', program); this.opcode('pushProgram', inverse); this.opcode('emptyHash'); this.opcode('ambiguousBlockValue'); } this.opcode('append'); }, DecoratorBlock: function DecoratorBlock(decorator) { var program = decorator.program && this.compileProgram(decorator.program); var params = this.setupFullMustacheParams(decorator, program, undefined), path = decorator.path; this.useDecorators = true; this.opcode('registerDecorator', params.length, path.original); }, PartialStatement: function PartialStatement(partial) { this.usePartial = true; var program = partial.program; if (program) { program = this.compileProgram(partial.program); } var params = partial.params; if (params.length > 1) { throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); } else if (!params.length) { if (this.options.explicitPartialContext) { this.opcode('pushLiteral', 'undefined'); } else { params.push({ type: 'PathExpression', parts: [], depth: 0 }); } } var partialName = partial.name.original, isDynamic = partial.name.type === 'SubExpression'; if (isDynamic) { this.accept(partial.name); } this.setupFullMustacheParams(partial, program, undefined, true); var indent = partial.indent || ''; if (this.options.preventIndent && indent) { this.opcode('appendContent', indent); indent = ''; } this.opcode('invokePartial', isDynamic, partialName, indent); this.opcode('append'); }, PartialBlockStatement: function PartialBlockStatement(partialBlock) { this.PartialStatement(partialBlock); }, MustacheStatement: function MustacheStatement(mustache) { this.SubExpression(mustache); if (mustache.escaped && !this.options.noEscape) { this.opcode('appendEscaped'); } else { this.opcode('append'); } }, Decorator: function Decorator(decorator) { this.DecoratorBlock(decorator); }, ContentStatement: function ContentStatement(content) { if (content.value) { this.opcode('appendContent', content.value); } }, CommentStatement: function CommentStatement() {}, SubExpression: function SubExpression(sexpr) { transformLiteralToPath(sexpr); var type = this.classifySexpr(sexpr); if (type === 'simple') { this.simpleSexpr(sexpr); } else if (type === 'helper') { this.helperSexpr(sexpr); } else { this.ambiguousSexpr(sexpr); } }, ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { var path = sexpr.path, name = path.parts[0], isBlock = program != null || inverse != null; this.opcode('getContext', path.depth); this.opcode('pushProgram', program); this.opcode('pushProgram', inverse); path.strict = true; this.accept(path); this.opcode('invokeAmbiguous', name, isBlock); }, simpleSexpr: function simpleSexpr(sexpr) { var path = sexpr.path; path.strict = true; this.accept(path); this.opcode('resolvePossibleLambda'); }, helperSexpr: function helperSexpr(sexpr, program, inverse) { var params = this.setupFullMustacheParams(sexpr, program, inverse), path = sexpr.path, name = path.parts[0]; if (this.options.knownHelpers[name]) { this.opcode('invokeKnownHelper', params.length, name); } else if (this.options.knownHelpersOnly) { throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); } else { path.strict = true; path.falsy = true; this.accept(path); this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path)); } }, PathExpression: function PathExpression(path) { this.addDepth(path.depth); this.opcode('getContext', path.depth); var name = path.parts[0], scoped = _ast2['default'].helpers.scopedId(path), blockParamId = !path.depth && !scoped && this.blockParamIndex(name); if (blockParamId) { this.opcode('lookupBlockParam', blockParamId, path.parts); } else if (!name) { // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` this.opcode('pushContext'); } else if (path.data) { this.options.data = true; this.opcode('lookupData', path.depth, path.parts, path.strict); } else { this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped); } }, StringLiteral: function StringLiteral(string) { this.opcode('pushString', string.value); }, NumberLiteral: function NumberLiteral(number) { this.opcode('pushLiteral', number.value); }, BooleanLiteral: function BooleanLiteral(bool) { this.opcode('pushLiteral', bool.value); }, UndefinedLiteral: function UndefinedLiteral() { this.opcode('pushLiteral', 'undefined'); }, NullLiteral: function NullLiteral() { this.opcode('pushLiteral', 'null'); }, Hash: function Hash(hash) { var pairs = hash.pairs, i = 0, l = pairs.length; this.opcode('pushHash'); for (; i < l; i++) { this.pushParam(pairs[i].value); } while (i--) { this.opcode('assignToHash', pairs[i].key); } this.opcode('popHash'); }, // HELPERS opcode: function opcode(name) { this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc }); }, addDepth: function addDepth(depth) { if (!depth) { return; } this.useDepths = true; }, classifySexpr: function classifySexpr(sexpr) { var isSimple = _ast2['default'].helpers.simpleId(sexpr.path); var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); // a mustache is an eligible helper if: // * its id is simple (a single part, not `this` or `..`) var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr); // if a mustache is an eligible helper but not a definite // helper, it is ambiguous, and will be resolved in a later // pass or at runtime. var isEligible = !isBlockParam && (isHelper || isSimple); // if ambiguous, we can possibly resolve the ambiguity now // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. if (isEligible && !isHelper) { var _name = sexpr.path.parts[0], options = this.options; if (options.knownHelpers[_name]) { isHelper = true; } else if (options.knownHelpersOnly) { isEligible = false; } } if (isHelper) { return 'helper'; } else if (isEligible) { return 'ambiguous'; } else { return 'simple'; } }, pushParams: function pushParams(params) { for (var i = 0, l = params.length; i < l; i++) { this.pushParam(params[i]); } }, pushParam: function pushParam(val) { var value = val.value != null ? val.value : val.original || ''; if (this.stringParams) { if (value.replace) { value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); } if (val.depth) { this.addDepth(val.depth); } this.opcode('getContext', val.depth || 0); this.opcode('pushStringParam', value, val.type); if (val.type === 'SubExpression') { // SubExpressions get evaluated and passed in // in string params mode. this.accept(val); } } else { if (this.trackIds) { var blockParamIndex = undefined; if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) { blockParamIndex = this.blockParamIndex(val.parts[0]); } if (blockParamIndex) { var blockParamChild = val.parts.slice(1).join('.'); this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); } else { value = val.original || value; if (value.replace) { value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, ''); } this.opcode('pushId', val.type, value); } } this.accept(val); } }, setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { var params = sexpr.params; this.pushParams(params); this.opcode('pushProgram', program); this.opcode('pushProgram', inverse); if (sexpr.hash) { this.accept(sexpr.hash); } else { this.opcode('emptyHash', omitEmpty); } return params; }, blockParamIndex: function blockParamIndex(name) { for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { var blockParams = this.options.blockParams[depth], param = blockParams && _utils.indexOf(blockParams, name); if (blockParams && param >= 0) { return [depth, param]; } } } }; function precompile(input, options, env) { if (input == null || typeof input !== 'string' && input.type !== 'Program') { throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); } options = options || {}; if (!('data' in options)) { options.data = true; } if (options.compat) { options.useDepths = true; } var ast = env.parse(input, options), environment = new env.Compiler().compile(ast, options); return new env.JavaScriptCompiler().compile(environment, options); } function compile(input, options, env) { if (options === undefined) options = {}; if (input == null || typeof input !== 'string' && input.type !== 'Program') { throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); } options = _utils.extend({}, options); if (!('data' in options)) { options.data = true; } if (options.compat) { options.useDepths = true; } var compiled = undefined; function compileInput() { var ast = env.parse(input, options), environment = new env.Compiler().compile(ast, options), templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); return env.template(templateSpec); } // Template is only compiled on first use and cached after that point. function ret(context, execOptions) { if (!compiled) { compiled = compileInput(); } return compiled.call(this, context, execOptions); } ret._setup = function (setupOptions) { if (!compiled) { compiled = compileInput(); } return compiled._setup(setupOptions); }; ret._child = function (i, data, blockParams, depths) { if (!compiled) { compiled = compileInput(); } return compiled._child(i, data, blockParams, depths); }; return ret; } function argEquals(a, b) { if (a === b) { return true; } if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) { for (var i = 0; i < a.length; i++) { if (!argEquals(a[i], b[i])) { return false; } } return true; } } function transformLiteralToPath(sexpr) { if (!sexpr.path.parts) { var literal = sexpr.path; // Casting to string here to make false and 0 literal values play nicely with the rest // of the system. sexpr.path = { type: 'PathExpression', data: false, depth: 0, parts: [literal.original + ''], original: literal.original + '', loc: literal.loc }; } } /***/ }), /* 90 */ /***/ (function(module, exports, __nested_webpack_require_162909__) { 'use strict'; var _Object$keys = __nested_webpack_require_162909__(60)['default']; var _interopRequireDefault = __nested_webpack_require_162909__(1)['default']; exports.__esModule = true; var _base = __nested_webpack_require_162909__(4); var _exception = __nested_webpack_require_162909__(6); var _exception2 = _interopRequireDefault(_exception); var _utils = __nested_webpack_require_162909__(5); var _codeGen = __nested_webpack_require_162909__(91); var _codeGen2 = _interopRequireDefault(_codeGen); function Literal(value) { this.value = value; } function JavaScriptCompiler() {} JavaScriptCompiler.prototype = { // PUBLIC API: You can override these methods in a subclass to provide // alternative compiled forms for name lookup and buffering semantics nameLookup: function nameLookup(parent, name /*, type */) { return this.internalNameLookup(parent, name); }, depthedLookup: function depthedLookup(name) { return [this.aliasable('container.lookup'), '(depths, ', JSON.stringify(name), ')']; }, compilerInfo: function compilerInfo() { var revision = _base.COMPILER_REVISION, versions = _base.REVISION_CHANGES[revision]; return [revision, versions]; }, appendToBuffer: function appendToBuffer(source, location, explicit) { // Force a source as this simplifies the merge logic. if (!_utils.isArray(source)) { source = [source]; } source = this.source.wrap(source, location); if (this.environment.isSimple) { return ['return ', source, ';']; } else if (explicit) { // This is a case where the buffer operation occurs as a child of another // construct, generally braces. We have to explicitly output these buffer // operations to ensure that the emitted code goes in the correct location. return ['buffer += ', source, ';']; } else { source.appendToBuffer = true; return source; } }, initializeBuffer: function initializeBuffer() { return this.quotedString(''); }, // END PUBLIC API internalNameLookup: function internalNameLookup(parent, name) { this.lookupPropertyFunctionIsUsed = true; return ['lookupProperty(', parent, ',', JSON.stringify(name), ')']; }, lookupPropertyFunctionIsUsed: false, compile: function compile(environment, options, context, asObject) { this.environment = environment; this.options = options; this.stringParams = this.options.stringParams; this.trackIds = this.options.trackIds; this.precompile = !asObject; this.name = this.environment.name; this.isChild = !!context; this.context = context || { decorators: [], programs: [], environments: [] }; this.preamble(); this.stackSlot = 0; this.stackVars = []; this.aliases = {}; this.registers = { list: [] }; this.hashes = []; this.compileStack = []; this.inlineStack = []; this.blockParams = []; this.compileChildren(environment, options); this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat; this.useBlockParams = this.useBlockParams || environment.useBlockParams; var opcodes = environment.opcodes, opcode = undefined, firstLoc = undefined, i = undefined, l = undefined; for (i = 0, l = opcodes.length; i < l; i++) { opcode = opcodes[i]; this.source.currentLocation = opcode.loc; firstLoc = firstLoc || opcode.loc; this[opcode.opcode].apply(this, opcode.args); } // Flush any trailing content that might be pending. this.source.currentLocation = firstLoc; this.pushSource(''); /* istanbul ignore next */ if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { throw new _exception2['default']('Compile completed with content left on stack'); } if (!this.decorators.isEmpty()) { this.useDecorators = true; this.decorators.prepend(['var decorators = container.decorators, ', this.lookupPropertyFunctionVarDeclaration(), ';\n']); this.decorators.push('return fn;'); if (asObject) { this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]); } else { this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n'); this.decorators.push('}\n'); this.decorators = this.decorators.merge(); } } else { this.decorators = undefined; } var fn = this.createFunctionContext(asObject); if (!this.isChild) { var ret = { compiler: this.compilerInfo(), main: fn }; if (this.decorators) { ret.main_d = this.decorators; // eslint-disable-line camelcase ret.useDecorators = true; } var _context = this.context; var programs = _context.programs; var decorators = _context.decorators; for (i = 0, l = programs.length; i < l; i++) { ret[i] = programs[i]; if (decorators[i]) { ret[i + '_d'] = decorators[i]; ret.useDecorators = true; } } if (this.environment.usePartial) { ret.usePartial = true; } if (this.options.data) { ret.useData = true; } if (this.useDepths) { ret.useDepths = true; } if (this.useBlockParams) { ret.useBlockParams = true; } if (this.options.compat) { ret.compat = true; } if (!asObject) { ret.compiler = JSON.stringify(ret.compiler); this.source.currentLocation = { start: { line: 1, column: 0 } }; ret = this.objectLiteral(ret); if (options.srcName) { ret = ret.toStringWithSourceMap({ file: options.destName }); ret.map = ret.map && ret.map.toString(); } else { ret = ret.toString(); } } else { ret.compilerOptions = this.options; } return ret; } else { return fn; } }, preamble: function preamble() { // track the last context pushed into place to allow skipping the // getContext opcode when it would be a noop this.lastContext = 0; this.source = new _codeGen2['default'](this.options.srcName); this.decorators = new _codeGen2['default'](this.options.srcName); }, createFunctionContext: function createFunctionContext(asObject) { // istanbul ignore next var _this = this; var varDeclarations = ''; var locals = this.stackVars.concat(this.registers.list); if (locals.length > 0) { varDeclarations += ', ' + locals.join(', '); } // Generate minimizer alias mappings // // When using true SourceNodes, this will update all references to the given alias // as the source nodes are reused in situ. For the non-source node compilation mode, // aliases will not be used, but this case is already being run on the client and // we aren't concern about minimizing the template size. var aliasCount = 0; _Object$keys(this.aliases).forEach(function (alias) { var node = _this.aliases[alias]; if (node.children && node.referenceCount > 1) { varDeclarations += ', alias' + ++aliasCount + '=' + alias; node.children[0] = 'alias' + aliasCount; } }); if (this.lookupPropertyFunctionIsUsed) { varDeclarations += ', ' + this.lookupPropertyFunctionVarDeclaration(); } var params = ['container', 'depth0', 'helpers', 'partials', 'data']; if (this.useBlockParams || this.useDepths) { params.push('blockParams'); } if (this.useDepths) { params.push('depths'); } // Perform a second pass over the output to merge content when possible var source = this.mergeSource(varDeclarations); if (asObject) { params.push(source); return Function.apply(this, params); } else { return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); } }, mergeSource: function mergeSource(varDeclarations) { var isSimple = this.environment.isSimple, appendOnly = !this.forceBuffer, appendFirst = undefined, sourceSeen = undefined, bufferStart = undefined, bufferEnd = undefined; this.source.each(function (line) { if (line.appendToBuffer) { if (bufferStart) { line.prepend(' + '); } else { bufferStart = line; } bufferEnd = line; } else { if (bufferStart) { if (!sourceSeen) { appendFirst = true; } else { bufferStart.prepend('buffer += '); } bufferEnd.add(';'); bufferStart = bufferEnd = undefined; } sourceSeen = true; if (!isSimple) { appendOnly = false; } } }); if (appendOnly) { if (bufferStart) { bufferStart.prepend('return '); bufferEnd.add(';'); } else if (!sourceSeen) { this.source.push('return "";'); } } else { varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); if (bufferStart) { bufferStart.prepend('return buffer + '); bufferEnd.add(';'); } else { this.source.push('return buffer;'); } } if (varDeclarations) { this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); } return this.source.merge(); }, lookupPropertyFunctionVarDeclaration: function lookupPropertyFunctionVarDeclaration() { return '\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n '.trim(); }, // [blockValue] // // On stack, before: hash, inverse, program, value // On stack, after: return value of blockHelperMissing // // The purpose of this opcode is to take a block of the form // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and // replace it on the stack with the result of properly // invoking blockHelperMissing. blockValue: function blockValue(name) { var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), params = [this.contextName(0)]; this.setupHelperArgs(name, 0, params); var blockName = this.popStack(); params.splice(1, 0, blockName); this.push(this.source.functionCall(blockHelperMissing, 'call', params)); }, // [ambiguousBlockValue] // // On stack, before: hash, inverse, program, value // Compiler value, before: lastHelper=value of last found helper, if any // On stack, after, if no lastHelper: same as [blockValue] // On stack, after, if lastHelper: value ambiguousBlockValue: function ambiguousBlockValue() { // We're being a bit cheeky and reusing the options value from the prior exec var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), params = [this.contextName(0)]; this.setupHelperArgs('', 0, params, true); this.flushInline(); var current = this.topStack(); params.splice(1, 0, current); this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); }, // [appendContent] // // On stack, before: ... // On stack, after: ... // // Appends the string value of `content` to the current buffer appendContent: function appendContent(content) { if (this.pendingContent) { content = this.pendingContent + content; } else { this.pendingLocation = this.source.currentLocation; } this.pendingContent = content; }, // [append] // // On stack, before: value, ... // On stack, after: ... // // Coerces `value` to a String and appends it to the current buffer. // // If `value` is truthy, or 0, it is coerced into a string and appended // Otherwise, the empty string is appended append: function append() { if (this.isInline()) { this.replaceStack(function (current) { return [' != null ? ', current, ' : ""']; }); this.pushSource(this.appendToBuffer(this.popStack())); } else { var local = this.popStack(); this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); if (this.environment.isSimple) { this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); } } }, // [appendEscaped] // // On stack, before: value, ... // On stack, after: ... // // Escape `value` and append it to the buffer appendEscaped: function appendEscaped() { this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')'])); }, // [getContext] // // On stack, before: ... // On stack, after: ... // Compiler value, after: lastContext=depth // // Set the value of the `lastContext` compiler value to the depth getContext: function getContext(depth) { this.lastContext = depth; }, // [pushContext] // // On stack, before: ... // On stack, after: currentContext, ... // // Pushes the value of the current context onto the stack. pushContext: function pushContext() { this.pushStackLiteral(this.contextName(this.lastContext)); }, // [lookupOnContext] // // On stack, before: ... // On stack, after: currentContext[name], ... // // Looks up the value of `name` on the current context and pushes // it onto the stack. lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) { var i = 0; if (!scoped && this.options.compat && !this.lastContext) { // The depthed query is expected to handle the undefined logic for the root level that // is implemented below, so we evaluate that directly in compat mode this.push(this.depthedLookup(parts[i++])); } else { this.pushContext(); } this.resolvePath('context', parts, i, falsy, strict); }, // [lookupBlockParam] // // On stack, before: ... // On stack, after: blockParam[name], ... // // Looks up the value of `parts` on the given block param and pushes // it onto the stack. lookupBlockParam: function lookupBlockParam(blockParamId, parts) { this.useBlockParams = true; this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); this.resolvePath('context', parts, 1); }, // [lookupData] // // On stack, before: ... // On stack, after: data, ... // // Push the data lookup operator lookupData: function lookupData(depth, parts, strict) { if (!depth) { this.pushStackLiteral('data'); } else { this.pushStackLiteral('container.data(data, ' + depth + ')'); } this.resolvePath('data', parts, 0, true, strict); }, resolvePath: function resolvePath(type, parts, startPartIndex, falsy, strict) { // istanbul ignore next var _this2 = this; if (this.options.strict || this.options.assumeObjects) { this.push(strictLookup(this.options.strict && strict, this, parts, startPartIndex, type)); return; } var len = parts.length; var _loop = function (i) { /* eslint-disable no-loop-func */ _this2.replaceStack(function (current) { var lookup = _this2.nameLookup(current, parts[i], type); // We want to ensure that zero and false are handled properly if the context (falsy flag) // needs to have the special handling for these values. if (!falsy) { return [' != null ? ', lookup, ' : ', current]; } else { // Otherwise we can use generic falsy handling return [' && ', lookup]; } }); /* eslint-enable no-loop-func */ }; for (var i = startPartIndex; i < len; i++) { _loop(i); } }, // [resolvePossibleLambda] // // On stack, before: value, ... // On stack, after: resolved value, ... // // If the `value` is a lambda, replace it on the stack by // the return value of the lambda resolvePossibleLambda: function resolvePossibleLambda() { this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); }, // [pushStringParam] // // On stack, before: ... // On stack, after: string, currentContext, ... // // This opcode is designed for use in string mode, which // provides the string value of a parameter along with its // depth rather than resolving it immediately. pushStringParam: function pushStringParam(string, type) { this.pushContext(); this.pushString(type); // If it's a subexpression, the string result // will be pushed after this opcode. if (type !== 'SubExpression') { if (typeof string === 'string') { this.pushString(string); } else { this.pushStackLiteral(string); } } }, emptyHash: function emptyHash(omitEmpty) { if (this.trackIds) { this.push('{}'); // hashIds } if (this.stringParams) { this.push('{}'); // hashContexts this.push('{}'); // hashTypes } this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); }, pushHash: function pushHash() { if (this.hash) { this.hashes.push(this.hash); } this.hash = { values: {}, types: [], contexts: [], ids: [] }; }, popHash: function popHash() { var hash = this.hash; this.hash = this.hashes.pop(); if (this.trackIds) { this.push(this.objectLiteral(hash.ids)); } if (this.stringParams) { this.push(this.objectLiteral(hash.contexts)); this.push(this.objectLiteral(hash.types)); } this.push(this.objectLiteral(hash.values)); }, // [pushString] // // On stack, before: ... // On stack, after: quotedString(string), ... // // Push a quoted version of `string` onto the stack pushString: function pushString(string) { this.pushStackLiteral(this.quotedString(string)); }, // [pushLiteral] // // On stack, before: ... // On stack, after: value, ... // // Pushes a value onto the stack. This operation prevents // the compiler from creating a temporary variable to hold // it. pushLiteral: function pushLiteral(value) { this.pushStackLiteral(value); }, // [pushProgram] // // On stack, before: ... // On stack, after: program(guid), ... // // Push a program expression onto the stack. This takes // a compile-time guid and converts it into a runtime-accessible // expression. pushProgram: function pushProgram(guid) { if (guid != null) { this.pushStackLiteral(this.programExpression(guid)); } else { this.pushStackLiteral(null); } }, // [registerDecorator] // // On stack, before: hash, program, params..., ... // On stack, after: ... // // Pops off the decorator's parameters, invokes the decorator, // and inserts the decorator into the decorators list. registerDecorator: function registerDecorator(paramSize, name) { var foundDecorator = this.nameLookup('decorators', name, 'decorator'), options = this.setupHelperArgs(name, paramSize); // Store the resolved decorator in a variable and verify it is a function before // calling it. Without this, unregistered decorators can cause an unhandled TypeError // (calling undefined), which crashes the process — enabling Denial of Service. this.decorators.push(['var decorator = ', foundDecorator, ';']); this.decorators.push(['if (typeof decorator !== "function") { throw new Error(', this.quotedString('Missing decorator: "' + name + '"'), '); }']); this.decorators.push(['fn = ', this.decorators.functionCall('decorator', '', ['fn', 'props', 'container', options]), ' || fn;']); }, // [invokeHelper] // // On stack, before: hash, inverse, program, params..., ... // On stack, after: result of helper invocation // // Pops off the helper's parameters, invokes the helper, // and pushes the helper's return value onto the stack. // // If the helper is not found, `helperMissing` is called. invokeHelper: function invokeHelper(paramSize, name, isSimple) { var nonHelper = this.popStack(), helper = this.setupHelper(paramSize, name); var possibleFunctionCalls = []; if (isSimple) { // direct call to helper possibleFunctionCalls.push(helper.name); } // call a function from the input object possibleFunctionCalls.push(nonHelper); if (!this.options.strict) { possibleFunctionCalls.push(this.aliasable('container.hooks.helperMissing')); } var functionLookupCode = ['(', this.itemsSeparatedBy(possibleFunctionCalls, '||'), ')']; var functionCall = this.source.functionCall(functionLookupCode, 'call', helper.callParams); this.push(functionCall); }, itemsSeparatedBy: function itemsSeparatedBy(items, separator) { var result = []; result.push(items[0]); for (var i = 1; i < items.length; i++) { result.push(separator, items[i]); } return result; }, // [invokeKnownHelper] // // On stack, before: hash, inverse, program, params..., ... // On stack, after: result of helper invocation // // This operation is used when the helper is known to exist, // so a `helperMissing` fallback is not required. invokeKnownHelper: function invokeKnownHelper(paramSize, name) { var helper = this.setupHelper(paramSize, name); this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); }, // [invokeAmbiguous] // // On stack, before: hash, inverse, program, params..., ... // On stack, after: result of disambiguation // // This operation is used when an expression like `{{foo}}` // is provided, but we don't know at compile-time whether it // is a helper or a path. // // This operation emits more code than the other options, // and can be avoided by passing the `knownHelpers` and // `knownHelpersOnly` flags at compile-time. invokeAmbiguous: function invokeAmbiguous(name, helperCall) { this.useRegister('helper'); var nonHelper = this.popStack(); this.emptyHash(); var helper = this.setupHelper(0, name, helperCall); var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; if (!this.options.strict) { lookup[0] = '(helper = '; lookup.push(' != null ? helper : ', this.aliasable('container.hooks.helperMissing')); } this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); }, // [invokePartial] // // On stack, before: context, ... // On stack after: result of partial invocation // // This operation pops off a context, invokes a partial with that context, // and pushes the result of the invocation back. invokePartial: function invokePartial(isDynamic, name, indent) { var params = [], options = this.setupParams(name, 1, params); if (isDynamic) { name = this.popStack(); delete options.name; } if (indent) { options.indent = JSON.stringify(indent); } options.helpers = 'helpers'; options.partials = 'partials'; options.decorators = 'container.decorators'; if (!isDynamic) { params.unshift(this.nameLookup('partials', name, 'partial')); } else { params.unshift(name); } if (this.options.compat) { options.depths = 'depths'; } options = this.objectLiteral(options); params.push(options); this.push(this.source.functionCall('container.invokePartial', '', params)); }, // [assignToHash] // // On stack, before: value, ..., hash, ... // On stack, after: ..., hash, ... // // Pops a value off the stack and assigns it to the current hash assignToHash: function assignToHash(key) { var value = this.popStack(), context = undefined, type = undefined, id = undefined; if (this.trackIds) { id = this.popStack(); } if (this.stringParams) { type = this.popStack(); context = this.popStack(); } var hash = this.hash; if (context) { hash.contexts[key] = context; } if (type) { hash.types[key] = type; } if (id) { hash.ids[key] = id; } hash.values[key] = value; }, pushId: function pushId(type, name, child) { if (type === 'BlockParam') { this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); } else if (type === 'PathExpression') { this.pushString(name); } else if (type === 'SubExpression') { this.pushStackLiteral('true'); } else { this.pushStackLiteral('null'); } }, // HELPERS compiler: JavaScriptCompiler, compileChildren: function compileChildren(environment, options) { var children = environment.children, child = undefined, compiler = undefined; for (var i = 0, l = children.length; i < l; i++) { child = children[i]; compiler = new this.compiler(); // eslint-disable-line new-cap var existing = this.matchExistingProgram(child); if (existing == null) { // Placeholder to prevent name conflicts for nested children var index = this.context.programs.push('') - 1; child.index = index; child.name = 'program' + index; this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); this.context.decorators[index] = compiler.decorators; this.context.environments[index] = child; this.useDepths = this.useDepths || compiler.useDepths; this.useBlockParams = this.useBlockParams || compiler.useBlockParams; child.useDepths = this.useDepths; child.useBlockParams = this.useBlockParams; } else { child.index = existing.index; child.name = 'program' + existing.index; this.useDepths = this.useDepths || existing.useDepths; this.useBlockParams = this.useBlockParams || existing.useBlockParams; } } }, matchExistingProgram: function matchExistingProgram(child) { for (var i = 0, len = this.context.environments.length; i < len; i++) { var environment = this.context.environments[i]; if (environment && environment.equals(child)) { return environment; } } }, programExpression: function programExpression(guid) { var child = this.environment.children[guid], programParams = [child.index, 'data', child.blockParams]; if (this.useBlockParams || this.useDepths) { programParams.push('blockParams'); } if (this.useDepths) { programParams.push('depths'); } return 'container.program(' + programParams.join(', ') + ')'; }, useRegister: function useRegister(name) { if (!this.registers[name]) { this.registers[name] = true; this.registers.list.push(name); } }, push: function push(expr) { if (!(expr instanceof Literal)) { expr = this.source.wrap(expr); } this.inlineStack.push(expr); return expr; }, pushStackLiteral: function pushStackLiteral(item) { this.push(new Literal(item)); }, pushSource: function pushSource(source) { if (this.pendingContent) { this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); this.pendingContent = undefined; } if (source) { this.source.push(source); } }, replaceStack: function replaceStack(callback) { var prefix = ['('], stack = undefined, createdStack = undefined, usedLiteral = undefined; /* istanbul ignore next */ if (!this.isInline()) { throw new _exception2['default']('replaceStack on non-inline'); } // We want to merge the inline statement into the replacement statement via ',' var top = this.popStack(true); if (top instanceof Literal) { // Literals do not need to be inlined stack = [top.value]; prefix = ['(', stack]; usedLiteral = true; } else { // Get or create the current stack name for use by the inline createdStack = true; var _name = this.incrStack(); prefix = ['((', this.push(_name), ' = ', top, ')']; stack = this.topStack(); } var item = callback.call(this, stack); if (!usedLiteral) { this.popStack(); } if (createdStack) { this.stackSlot--; } this.push(prefix.concat(item, ')')); }, incrStack: function incrStack() { this.stackSlot++; if (this.stackSlot > this.stackVars.length) { this.stackVars.push('stack' + this.stackSlot); } return this.topStackName(); }, topStackName: function topStackName() { return 'stack' + this.stackSlot; }, flushInline: function flushInline() { var inlineStack = this.inlineStack; this.inlineStack = []; for (var i = 0, len = inlineStack.length; i < len; i++) { var entry = inlineStack[i]; /* istanbul ignore if */ if (entry instanceof Literal) { this.compileStack.push(entry); } else { var stack = this.incrStack(); this.pushSource([stack, ' = ', entry, ';']); this.compileStack.push(stack); } } }, isInline: function isInline() { return this.inlineStack.length; }, popStack: function popStack(wrapped) { var inline = this.isInline(), item = (inline ? this.inlineStack : this.compileStack).pop(); if (!wrapped && item instanceof Literal) { return item.value; } else { if (!inline) { /* istanbul ignore next */ if (!this.stackSlot) { throw new _exception2['default']('Invalid stack pop'); } this.stackSlot--; } return item; } }, topStack: function topStack() { var stack = this.isInline() ? this.inlineStack : this.compileStack, item = stack[stack.length - 1]; /* istanbul ignore if */ if (item instanceof Literal) { return item.value; } else { return item; } }, contextName: function contextName(context) { if (this.useDepths && context) { return 'depths[' + context + ']'; } else { return 'depth' + context; } }, quotedString: function quotedString(str) { return this.source.quotedString(str); }, objectLiteral: function objectLiteral(obj) { return this.source.objectLiteral(obj); }, aliasable: function aliasable(name) { var ret = this.aliases[name]; if (ret) { ret.referenceCount++; return ret; } ret = this.aliases[name] = this.source.wrap(name); ret.aliasable = true; ret.referenceCount = 1; return ret; }, setupHelper: function setupHelper(paramSize, name, blockHelper) { var params = [], paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); var foundHelper = this.nameLookup('helpers', name, 'helper'), callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : (container.nullContext || {})'); return { params: params, paramsInit: paramsInit, name: foundHelper, callParams: [callContext].concat(params) }; }, setupParams: function setupParams(helper, paramSize, params) { var options = {}, contexts = [], types = [], ids = [], objectArgs = !params, param = undefined; if (objectArgs) { params = []; } options.name = this.quotedString(helper); options.hash = this.popStack(); if (this.trackIds) { options.hashIds = this.popStack(); } if (this.stringParams) { options.hashTypes = this.popStack(); options.hashContexts = this.popStack(); } var inverse = this.popStack(), program = this.popStack(); // Avoid setting fn and inverse if neither are set. This allows // helpers to do a check for `if (options.fn)` if (program || inverse) { options.fn = program || 'container.noop'; options.inverse = inverse || 'container.noop'; } // The parameters go on to the stack in order (making sure that they are evaluated in order) // so we need to pop them off the stack in reverse order var i = paramSize; while (i--) { param = this.popStack(); params[i] = param; if (this.trackIds) { ids[i] = this.popStack(); } if (this.stringParams) { types[i] = this.popStack(); contexts[i] = this.popStack(); } } if (objectArgs) { options.args = this.source.generateArray(params); } if (this.trackIds) { options.ids = this.source.generateArray(ids); } if (this.stringParams) { options.types = this.source.generateArray(types); options.contexts = this.source.generateArray(contexts); } if (this.options.data) { options.data = 'data'; } if (this.useBlockParams) { options.blockParams = 'blockParams'; } return options; }, setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { var options = this.setupParams(helper, paramSize, params); options.loc = JSON.stringify(this.source.currentLocation); options = this.objectLiteral(options); if (useRegister) { this.useRegister('options'); params.push('options'); return ['options=', options]; } else if (params) { params.push(options); return ''; } else { return options; } } }; (function () { var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' '); var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; for (var i = 0, l = reservedWords.length; i < l; i++) { compilerWords[reservedWords[i]] = true; } })(); /** * @deprecated May be removed in the next major version */ JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); }; function strictLookup(requireTerminal, compiler, parts, startPartIndex, type) { var stack = compiler.popStack(), len = parts.length; if (requireTerminal) { len--; } for (var i = startPartIndex; i < len; i++) { stack = compiler.nameLookup(stack, parts[i], type); } if (requireTerminal) { return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[len]), ', ', JSON.stringify(compiler.source.currentLocation), ' )']; } else { return stack; } } exports['default'] = JavaScriptCompiler; module.exports = exports['default']; /***/ }), /* 91 */ /***/ (function(module, exports, __nested_webpack_require_199397__) { /* global define, require */ 'use strict'; var _Object$keys = __nested_webpack_require_199397__(60)['default']; exports.__esModule = true; var _utils = __nested_webpack_require_199397__(5); var SourceNode = undefined; try { /* istanbul ignore next */ if (false) // removed by dead control flow { var SourceMap; } } catch (err) {} /* NOP */ /* istanbul ignore if: tested but not covered in istanbul due to dist build */ if (!SourceNode) { SourceNode = function (line, column, srcFile, chunks) { this.src = ''; if (chunks) { this.add(chunks); } }; /* istanbul ignore next */ SourceNode.prototype = { add: function add(chunks) { if (_utils.isArray(chunks)) { chunks = chunks.join(''); } this.src += chunks; }, prepend: function prepend(chunks) { if (_utils.isArray(chunks)) { chunks = chunks.join(''); } this.src = chunks + this.src; }, toStringWithSourceMap: function toStringWithSourceMap() { return { code: this.toString() }; }, toString: function toString() { return this.src; } }; } function castChunk(chunk, codeGen, loc) { if (_utils.isArray(chunk)) { var ret = []; for (var i = 0, len = chunk.length; i < len; i++) { ret.push(codeGen.wrap(chunk[i], loc)); } return ret; } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { // Handle primitives that the SourceNode will throw up on return chunk + ''; } return chunk; } function CodeGen(srcFile) { this.srcFile = srcFile; this.source = []; } CodeGen.prototype = { isEmpty: function isEmpty() { return !this.source.length; }, prepend: function prepend(source, loc) { this.source.unshift(this.wrap(source, loc)); }, push: function push(source, loc) { this.source.push(this.wrap(source, loc)); }, merge: function merge() { var source = this.empty(); this.each(function (line) { source.add([' ', line, '\n']); }); return source; }, each: function each(iter) { for (var i = 0, len = this.source.length; i < len; i++) { iter(this.source[i]); } }, empty: function empty() { var loc = this.currentLocation || { start: {} }; return new SourceNode(loc.start.line, loc.start.column, this.srcFile); }, wrap: function wrap(chunk) { var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; if (chunk instanceof SourceNode) { return chunk; } chunk = castChunk(chunk, this, loc); return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); }, functionCall: function functionCall(fn, type, params) { params = this.generateList(params); return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); }, quotedString: function quotedString(str) { return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 .replace(/\u2029/g, '\\u2029') + '"'; }, objectLiteral: function objectLiteral(obj) { // istanbul ignore next var _this = this; var pairs = []; _Object$keys(obj).forEach(function (key) { var value = castChunk(obj[key], _this); if (value !== 'undefined') { pairs.push([_this.quotedString(key), ':', value]); } }); var ret = this.generateList(pairs); ret.prepend('{'); ret.add('}'); return ret; }, generateList: function generateList(entries) { var ret = this.empty(); for (var i = 0, len = entries.length; i < len; i++) { if (i) { ret.add(','); } ret.add(castChunk(entries[i], this)); } return ret; }, generateArray: function generateArray(entries) { var ret = this.generateList(entries); ret.prepend('['); ret.add(']'); return ret; } }; exports['default'] = CodeGen; module.exports = exports['default']; /***/ }) /******/ ]) }); ; /***/ }, /***/ 1460 /*!********************************************!*\ !*** ./node_modules/jstree/dist/jstree.js ***! \********************************************/ (module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*globals jQuery, define, module, exports, require, window, document, postMessage */ (function (factory) { "use strict"; if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ 428)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else // removed by dead control flow {} }(function ($, undefined) { "use strict"; /*! * jsTree 3.3.7 * http://jstree.com/ * * Copyright (c) 2014 Ivan Bozhanov (http://vakata.com) * * Licensed same as jquery - under the terms of the MIT License * http://www.opensource.org/licenses/mit-license.php */ /*! * if using jslint please allow for the jQuery global and use following options: * jslint: loopfunc: true, browser: true, ass: true, bitwise: true, continue: true, nomen: true, plusplus: true, regexp: true, unparam: true, todo: true, white: true */ /*jshint -W083 */ // prevent another load? maybe there is a better way? if($.jstree) { return; } /** * ### jsTree core functionality */ // internal variables var instance_counter = 0, ccp_node = false, ccp_mode = false, ccp_inst = false, themes_loaded = [], src = $('script:last').attr('src'), document = window.document; // local variable is always faster to access then a global /** * holds all jstree related functions and variables, including the actual class and methods to create, access and manipulate instances. * @name $.jstree */ $.jstree = { /** * specifies the jstree version in use * @name $.jstree.version */ version : '3.3.7', /** * holds all the default options used when creating new instances * @name $.jstree.defaults */ defaults : { /** * configure which plugins will be active on an instance. Should be an array of strings, where each element is a plugin name. The default is `[]` * @name $.jstree.defaults.plugins */ plugins : [] }, /** * stores all loaded jstree plugins (used internally) * @name $.jstree.plugins */ plugins : {}, path : src && src.indexOf('/') !== -1 ? src.replace(/\/[^\/]+$/,'') : '', idregex : /[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g, root : '#' }; /** * creates a jstree instance * @name $.jstree.create(el [, options]) * @param {DOMElement|jQuery|String} el the element to create the instance on, can be jQuery extended or a selector * @param {Object} options options for this instance (extends `$.jstree.defaults`) * @return {jsTree} the new instance */ $.jstree.create = function (el, options) { var tmp = new $.jstree.core(++instance_counter), opt = options; options = $.extend(true, {}, $.jstree.defaults, options); if(opt && opt.plugins) { options.plugins = opt.plugins; } $.each(options.plugins, function (i, k) { if(i !== 'core') { tmp = tmp.plugin(k, options[k]); } }); $(el).data('jstree', tmp); tmp.init(el, options); return tmp; }; /** * remove all traces of jstree from the DOM and destroy all instances * @name $.jstree.destroy() */ $.jstree.destroy = function () { $('.jstree:jstree').jstree('destroy'); $(document).off('.jstree'); }; /** * the jstree class constructor, used only internally * @private * @name $.jstree.core(id) * @param {Number} id this instance's index */ $.jstree.core = function (id) { this._id = id; this._cnt = 0; this._wrk = null; this._data = { core : { themes : { name : false, dots : false, icons : false, ellipsis : false }, selected : [], last_error : {}, working : false, worker_queue : [], focused : null } }; }; /** * get a reference to an existing instance * * __Examples__ * * // provided a container with an ID of "tree", and a nested node with an ID of "branch" * // all of there will return the same instance * $.jstree.reference('tree'); * $.jstree.reference('#tree'); * $.jstree.reference($('#tree')); * $.jstree.reference(document.getElementByID('tree')); * $.jstree.reference('branch'); * $.jstree.reference('#branch'); * $.jstree.reference($('#branch')); * $.jstree.reference(document.getElementByID('branch')); * * @name $.jstree.reference(needle) * @param {DOMElement|jQuery|String} needle * @return {jsTree|null} the instance or `null` if not found */ $.jstree.reference = function (needle) { var tmp = null, obj = null; if(needle && needle.id && (!needle.tagName || !needle.nodeType)) { needle = needle.id; } if(!obj || !obj.length) { try { obj = $(needle); } catch (ignore) { } } if(!obj || !obj.length) { try { obj = $('#' + needle.replace($.jstree.idregex,'\\$&')); } catch (ignore) { } } if(obj && obj.length && (obj = obj.closest('.jstree')).length && (obj = obj.data('jstree'))) { tmp = obj; } else { $('.jstree').each(function () { var inst = $(this).data('jstree'); if(inst && inst._model.data[needle]) { tmp = inst; return false; } }); } return tmp; }; /** * Create an instance, get an instance or invoke a command on a instance. * * If there is no instance associated with the current node a new one is created and `arg` is used to extend `$.jstree.defaults` for this new instance. There would be no return value (chaining is not broken). * * If there is an existing instance and `arg` is a string the command specified by `arg` is executed on the instance, with any additional arguments passed to the function. If the function returns a value it will be returned (chaining could break depending on function). * * If there is an existing instance and `arg` is not a string the instance itself is returned (similar to `$.jstree.reference`). * * In any other case - nothing is returned and chaining is not broken. * * __Examples__ * * $('#tree1').jstree(); // creates an instance * $('#tree2').jstree({ plugins : [] }); // create an instance with some options * $('#tree1').jstree('open_node', '#branch_1'); // call a method on an existing instance, passing additional arguments * $('#tree2').jstree(); // get an existing instance (or create an instance) * $('#tree2').jstree(true); // get an existing instance (will not create new instance) * $('#branch_1').jstree().select_node('#branch_1'); // get an instance (using a nested element and call a method) * * @name $().jstree([arg]) * @param {String|Object} arg * @return {Mixed} */ $.fn.jstree = function (arg) { // check for string argument var is_method = (typeof arg === 'string'), args = Array.prototype.slice.call(arguments, 1), result = null; if(arg === true && !this.length) { return false; } this.each(function () { // get the instance (if there is one) and method (if it exists) var instance = $.jstree.reference(this), method = is_method && instance ? instance[arg] : null; // if calling a method, and method is available - execute on the instance result = is_method && method ? method.apply(instance, args) : null; // if there is no instance and no method is being called - create one if(!instance && !is_method && (arg === undefined || $.isPlainObject(arg))) { $.jstree.create(this, arg); } // if there is an instance and no method is called - return the instance if( (instance && !is_method) || arg === true ) { result = instance || false; } // if there was a method call which returned a result - break and return the value if(result !== null && result !== undefined) { return false; } }); // if there was a method call with a valid return value - return that, otherwise continue the chain return result !== null && result !== undefined ? result : this; }; /** * used to find elements containing an instance * * __Examples__ * * $('div:jstree').each(function () { * $(this).jstree('destroy'); * }); * * @name $(':jstree') * @return {jQuery} */ $.expr.pseudos.jstree = $.expr.createPseudo(function(search) { return function(a) { return $(a).hasClass('jstree') && $(a).data('jstree') !== undefined; }; }); /** * stores all defaults for the core * @name $.jstree.defaults.core */ $.jstree.defaults.core = { /** * data configuration * * If left as `false` the HTML inside the jstree container element is used to populate the tree (that should be an unordered list with list items). * * You can also pass in a HTML string or a JSON array here. * * It is possible to pass in a standard jQuery-like AJAX config and jstree will automatically determine if the response is JSON or HTML and use that to populate the tree. * In addition to the standard jQuery ajax options here you can suppy functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used. * * The last option is to specify a function, that function will receive the node being loaded as argument and a second param which is a function which should be called with the result. * * __Examples__ * * // AJAX * $('#tree').jstree({ * 'core' : { * 'data' : { * 'url' : '/get/children/', * 'data' : function (node) { * return { 'id' : node.id }; * } * } * }); * * // direct data * $('#tree').jstree({ * 'core' : { * 'data' : [ * 'Simple root node', * { * 'id' : 'node_2', * 'text' : 'Root node with options', * 'state' : { 'opened' : true, 'selected' : true }, * 'children' : [ { 'text' : 'Child 1' }, 'Child 2'] * } * ] * } * }); * * // function * $('#tree').jstree({ * 'core' : { * 'data' : function (obj, callback) { * callback.call(this, ['Root 1', 'Root 2']); * } * }); * * @name $.jstree.defaults.core.data */ data : false, /** * configure the various strings used throughout the tree * * You can use an object where the key is the string you need to replace and the value is your replacement. * Another option is to specify a function which will be called with an argument of the needed string and should return the replacement. * If left as `false` no replacement is made. * * __Examples__ * * $('#tree').jstree({ * 'core' : { * 'strings' : { * 'Loading ...' : 'Please wait ...' * } * } * }); * * @name $.jstree.defaults.core.strings */ strings : false, /** * determines what happens when a user tries to modify the structure of the tree * If left as `false` all operations like create, rename, delete, move or copy are prevented. * You can set this to `true` to allow all interactions or use a function to have better control. * * __Examples__ * * $('#tree').jstree({ * 'core' : { * 'check_callback' : function (operation, node, node_parent, node_position, more) { * // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node', 'copy_node' or 'edit' * // in case of 'rename_node' node_position is filled with the new node name * return operation === 'rename_node' ? true : false; * } * } * }); * * @name $.jstree.defaults.core.check_callback */ check_callback : false, /** * a callback called with a single object parameter in the instance's scope when something goes wrong (operation prevented, ajax failed, etc) * @name $.jstree.defaults.core.error */ error : $.noop, /** * the open / close animation duration in milliseconds - set this to `false` to disable the animation (default is `200`) * @name $.jstree.defaults.core.animation */ animation : 200, /** * a boolean indicating if multiple nodes can be selected * @name $.jstree.defaults.core.multiple */ multiple : true, /** * theme configuration object * @name $.jstree.defaults.core.themes */ themes : { /** * the name of the theme to use (if left as `false` the default theme is used) * @name $.jstree.defaults.core.themes.name */ name : false, /** * the URL of the theme's CSS file, leave this as `false` if you have manually included the theme CSS (recommended). You can set this to `true` too which will try to autoload the theme. * @name $.jstree.defaults.core.themes.url */ url : false, /** * the location of all jstree themes - only used if `url` is set to `true` * @name $.jstree.defaults.core.themes.dir */ dir : false, /** * a boolean indicating if connecting dots are shown * @name $.jstree.defaults.core.themes.dots */ dots : true, /** * a boolean indicating if node icons are shown * @name $.jstree.defaults.core.themes.icons */ icons : true, /** * a boolean indicating if node ellipsis should be shown - this only works with a fixed with on the container * @name $.jstree.defaults.core.themes.ellipsis */ ellipsis : false, /** * a boolean indicating if the tree background is striped * @name $.jstree.defaults.core.themes.stripes */ stripes : false, /** * a string (or boolean `false`) specifying the theme variant to use (if the theme supports variants) * @name $.jstree.defaults.core.themes.variant */ variant : false, /** * a boolean specifying if a reponsive version of the theme should kick in on smaller screens (if the theme supports it). Defaults to `false`. * @name $.jstree.defaults.core.themes.responsive */ responsive : false }, /** * if left as `true` all parents of all selected nodes will be opened once the tree loads (so that all selected nodes are visible to the user) * @name $.jstree.defaults.core.expand_selected_onload */ expand_selected_onload : true, /** * if left as `true` web workers will be used to parse incoming JSON data where possible, so that the UI will not be blocked by large requests. Workers are however about 30% slower. Defaults to `true` * @name $.jstree.defaults.core.worker */ worker : true, /** * Force node text to plain text (and escape HTML). Defaults to `false` * @name $.jstree.defaults.core.force_text */ force_text : false, /** * Should the node be toggled if the text is double clicked. Defaults to `true` * @name $.jstree.defaults.core.dblclick_toggle */ dblclick_toggle : true, /** * Should the loaded nodes be part of the state. Defaults to `false` * @name $.jstree.defaults.core.loaded_state */ loaded_state : false, /** * Should the last active node be focused when the tree container is blurred and the focused again. This helps working with screen readers. Defaults to `true` * @name $.jstree.defaults.core.restore_focus */ restore_focus : true, /** * Default keyboard shortcuts (an object where each key is the button name or combo - like 'enter', 'ctrl-space', 'p', etc and the value is the function to execute in the instance's scope) * @name $.jstree.defaults.core.keyboard */ keyboard : { 'ctrl-space': function (e) { // aria defines space only with Ctrl e.type = "click"; $(e.currentTarget).trigger(e); }, 'enter': function (e) { // enter e.type = "click"; $(e.currentTarget).trigger(e); }, 'left': function (e) { // left e.preventDefault(); if(this.is_open(e.currentTarget)) { this.close_node(e.currentTarget); } else { var o = this.get_parent(e.currentTarget); if(o && o.id !== $.jstree.root) { this.get_node(o, true).children('.jstree-anchor').focus(); } } }, 'up': function (e) { // up e.preventDefault(); var o = this.get_prev_dom(e.currentTarget); if(o && o.length) { o.children('.jstree-anchor').focus(); } }, 'right': function (e) { // right e.preventDefault(); if(this.is_closed(e.currentTarget)) { this.open_node(e.currentTarget, function (o) { this.get_node(o, true).children('.jstree-anchor').focus(); }); } else if (this.is_open(e.currentTarget)) { var o = this.get_node(e.currentTarget, true).children('.jstree-children')[0]; if(o) { $(this._firstChild(o)).children('.jstree-anchor').focus(); } } }, 'down': function (e) { // down e.preventDefault(); var o = this.get_next_dom(e.currentTarget); if(o && o.length) { o.children('.jstree-anchor').focus(); } }, '*': function (e) { // aria defines * on numpad as open_all - not very common this.open_all(); }, 'home': function (e) { // home e.preventDefault(); var o = this._firstChild(this.get_container_ul()[0]); if(o) { $(o).children('.jstree-anchor').filter(':visible').focus(); } }, 'end': function (e) { // end e.preventDefault(); this.element.find('.jstree-anchor').filter(':visible').last().focus(); }, 'f2': function (e) { // f2 - safe to include - if check_callback is false it will fail e.preventDefault(); this.edit(e.currentTarget); } } }; $.jstree.core.prototype = { /** * used to decorate an instance with a plugin. Used internally. * @private * @name plugin(deco [, opts]) * @param {String} deco the plugin to decorate with * @param {Object} opts options for the plugin * @return {jsTree} */ plugin : function (deco, opts) { var Child = $.jstree.plugins[deco]; if(Child) { this._data[deco] = {}; Child.prototype = this; return new Child(opts, this); } return this; }, /** * initialize the instance. Used internally. * @private * @name init(el, optons) * @param {DOMElement|jQuery|String} el the element we are transforming * @param {Object} options options for this instance * @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree */ init : function (el, options) { this._model = { data : {}, changed : [], force_full_redraw : false, redraw_timeout : false, default_state : { loaded : true, opened : false, selected : false, disabled : false } }; this._model.data[$.jstree.root] = { id : $.jstree.root, parent : null, parents : [], children : [], children_d : [], state : { loaded : false } }; this.element = $(el).addClass('jstree jstree-' + this._id); this.settings = options; this._data.core.ready = false; this._data.core.loaded = false; this._data.core.rtl = (this.element.css("direction") === "rtl"); this.element[this._data.core.rtl ? 'addClass' : 'removeClass']("jstree-rtl"); this.element.attr('role','tree'); if(this.settings.core.multiple) { this.element.attr('aria-multiselectable', true); } if(!this.element.attr('tabindex')) { this.element.attr('tabindex','0'); } this.bind(); /** * triggered after all events are bound * @event * @name init.jstree */ this.trigger("init"); this._data.core.original_container_html = this.element.find(" > ul > li").clone(true); this._data.core.original_container_html .find("li").addBack() .contents().filter(function() { return this.nodeType === 3 && (!this.nodeValue || /^\s+$/.test(this.nodeValue)); }) .remove(); this.element.html("<"+"ul class='jstree-container-ul jstree-children' role='group'><"+"li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><i class='jstree-icon jstree-ocl'></i><"+"a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>" + this.get_string("Loading ...") + "</a></li></ul>"); this.element.attr('aria-activedescendant','j' + this._id + '_loading'); this._data.core.li_height = this.get_container_ul().children("li").first().outerHeight() || 24; this._data.core.node = this._create_prototype_node(); /** * triggered after the loading text is shown and before loading starts * @event * @name loading.jstree */ this.trigger("loading"); this.load_node($.jstree.root); }, /** * destroy an instance * @name destroy() * @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact */ destroy : function (keep_html) { /** * triggered before the tree is destroyed * @event * @name destroy.jstree */ this.trigger("destroy"); if(this._wrk) { try { window.URL.revokeObjectURL(this._wrk); this._wrk = null; } catch (ignore) { } } if(!keep_html) { this.element.empty(); } this.teardown(); }, /** * Create a prototype node * @name _create_prototype_node() * @return {DOMElement} */ _create_prototype_node : function () { var _node = document.createElement('LI'), _temp1, _temp2; _node.setAttribute('role', 'treeitem'); _temp1 = document.createElement('I'); _temp1.className = 'jstree-icon jstree-ocl'; _temp1.setAttribute('role', 'presentation'); _node.appendChild(_temp1); _temp1 = document.createElement('A'); _temp1.className = 'jstree-anchor'; _temp1.setAttribute('href','#'); _temp1.setAttribute('tabindex','-1'); _temp2 = document.createElement('I'); _temp2.className = 'jstree-icon jstree-themeicon'; _temp2.setAttribute('role', 'presentation'); _temp1.appendChild(_temp2); _node.appendChild(_temp1); _temp1 = _temp2 = null; return _node; }, _kbevent_to_func : function (e) { var keys = { 8: "Backspace", 9: "Tab", 13: "Return", 19: "Pause", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "Print", 45: "Insert", 46: "Delete", 96: "Numpad0", 97: "Numpad1", 98: "Numpad2", 99 : "Numpad3", 100: "Numpad4", 101: "Numpad5", 102: "Numpad6", 103: "Numpad7", 104: "Numpad8", 105: "Numpad9", '-13': "NumpadEnter", 112: "F1", 113: "F2", 114: "F3", 115: "F4", 116: "F5", 117: "F6", 118: "F7", 119: "F8", 120: "F9", 121: "F10", 122: "F11", 123: "F12", 144: "Numlock", 145: "Scrolllock", 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a', 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h', 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o', 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v', 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.', 186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\',221: ']', 222: "'", 111: '/', 106: '*', 173: '-' }; var parts = []; if (e.ctrlKey) { parts.push('ctrl'); } if (e.altKey) { parts.push('alt'); } if (e.shiftKey) { parts.push('shift'); } parts.push(keys[e.which] || e.which); parts = parts.sort().join('-').toLowerCase(); var kb = this.settings.core.keyboard, i, tmp; for (i in kb) { if (kb.hasOwnProperty(i)) { tmp = i; if (tmp !== '-' && tmp !== '+') { tmp = tmp.replace('--', '-MINUS').replace('+-', '-MINUS').replace('++', '-PLUS').replace('-+', '-PLUS'); tmp = tmp.split(/-|\+/).sort().join('-').replace('MINUS', '-').replace('PLUS', '+').toLowerCase(); } if (tmp === parts) { return kb[i]; } } } return null; }, /** * part of the destroying of an instance. Used internally. * @private * @name teardown() */ teardown : function () { this.unbind(); this.element .removeClass('jstree') .removeData('jstree') .find("[class^='jstree']") .addBack() .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); }); this.element = null; }, /** * bind all events. Used internally. * @private * @name bind() */ bind : function () { var word = '', tout = null, was_click = 0; this.element .on("dblclick.jstree", function (e) { if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } if(document.selection && document.selection.empty) { document.selection.empty(); } else { if(window.getSelection) { var sel = window.getSelection(); try { sel.removeAllRanges(); sel.collapse(); } catch (ignore) { } } } }) .on("mousedown.jstree", $.proxy(function (e) { if(e.target === this.element[0]) { e.preventDefault(); // prevent losing focus when clicking scroll arrows (FF, Chrome) was_click = +(new Date()); // ie does not allow to prevent losing focus } }, this)) .on("mousedown.jstree", ".jstree-ocl", function (e) { e.preventDefault(); // prevent any node inside from losing focus when clicking the open/close icon }) .on("click.jstree", ".jstree-ocl", $.proxy(function (e) { this.toggle_node(e.target); }, this)) .on("dblclick.jstree", ".jstree-anchor", $.proxy(function (e) { if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } if(this.settings.core.dblclick_toggle) { this.toggle_node(e.target); } }, this)) .on("click.jstree", ".jstree-anchor", $.proxy(function (e) { e.preventDefault(); if(e.currentTarget !== document.activeElement) { $(e.currentTarget).focus(); } this.activate_node(e.currentTarget, e); }, this)) .on('keydown.jstree', '.jstree-anchor', $.proxy(function (e) { if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } if(this._data.core.rtl) { if(e.which === 37) { e.which = 39; } else if(e.which === 39) { e.which = 37; } } var f = this._kbevent_to_func(e); if (f) { var r = f.call(this, e); if (r === false || r === true) { return r; } } }, this)) .on("load_node.jstree", $.proxy(function (e, data) { if(data.status) { if(data.node.id === $.jstree.root && !this._data.core.loaded) { this._data.core.loaded = true; if(this._firstChild(this.get_container_ul()[0])) { this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id); } /** * triggered after the root node is loaded for the first time * @event * @name loaded.jstree */ this.trigger("loaded"); } if(!this._data.core.ready) { setTimeout($.proxy(function() { if(this.element && !this.get_container_ul().find('.jstree-loading').length) { this._data.core.ready = true; if(this._data.core.selected.length) { if(this.settings.core.expand_selected_onload) { var tmp = [], i, j; for(i = 0, j = this._data.core.selected.length; i < j; i++) { tmp = tmp.concat(this._model.data[this._data.core.selected[i]].parents); } tmp = $.vakata.array_unique(tmp); for(i = 0, j = tmp.length; i < j; i++) { this.open_node(tmp[i], false, 0); } } this.trigger('changed', { 'action' : 'ready', 'selected' : this._data.core.selected }); } /** * triggered after all nodes are finished loading * @event * @name ready.jstree */ this.trigger("ready"); } }, this), 0); } } }, this)) // quick searching when the tree is focused .on('keypress.jstree', $.proxy(function (e) { if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } if(tout) { clearTimeout(tout); } tout = setTimeout(function () { word = ''; }, 500); var chr = String.fromCharCode(e.which).toLowerCase(), col = this.element.find('.jstree-anchor').filter(':visible'), ind = col.index(document.activeElement) || 0, end = false; word += chr; // match for whole word from current node down (including the current node) if(word.length > 1) { col.slice(ind).each($.proxy(function (i, v) { if($(v).text().toLowerCase().indexOf(word) === 0) { $(v).focus(); end = true; return false; } }, this)); if(end) { return; } // match for whole word from the beginning of the tree col.slice(0, ind).each($.proxy(function (i, v) { if($(v).text().toLowerCase().indexOf(word) === 0) { $(v).focus(); end = true; return false; } }, this)); if(end) { return; } } // list nodes that start with that letter (only if word consists of a single char) if(new RegExp('^' + chr.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '+$').test(word)) { // search for the next node starting with that letter col.slice(ind + 1).each($.proxy(function (i, v) { if($(v).text().toLowerCase().charAt(0) === chr) { $(v).focus(); end = true; return false; } }, this)); if(end) { return; } // search from the beginning col.slice(0, ind + 1).each($.proxy(function (i, v) { if($(v).text().toLowerCase().charAt(0) === chr) { $(v).focus(); end = true; return false; } }, this)); if(end) { return; } } }, this)) // THEME RELATED .on("init.jstree", $.proxy(function () { var s = this.settings.core.themes; this._data.core.themes.dots = s.dots; this._data.core.themes.stripes = s.stripes; this._data.core.themes.icons = s.icons; this._data.core.themes.ellipsis = s.ellipsis; this.set_theme(s.name || "default", s.url); this.set_theme_variant(s.variant); }, this)) .on("loading.jstree", $.proxy(function () { this[ this._data.core.themes.dots ? "show_dots" : "hide_dots" ](); this[ this._data.core.themes.icons ? "show_icons" : "hide_icons" ](); this[ this._data.core.themes.stripes ? "show_stripes" : "hide_stripes" ](); this[ this._data.core.themes.ellipsis ? "show_ellipsis" : "hide_ellipsis" ](); }, this)) .on('blur.jstree', '.jstree-anchor', $.proxy(function (e) { this._data.core.focused = null; $(e.currentTarget).filter('.jstree-hovered').mouseleave(); this.element.attr('tabindex', '0'); }, this)) .on('focus.jstree', '.jstree-anchor', $.proxy(function (e) { var tmp = this.get_node(e.currentTarget); if(tmp && tmp.id) { this._data.core.focused = tmp.id; } this.element.find('.jstree-hovered').not(e.currentTarget).mouseleave(); $(e.currentTarget).mouseenter(); this.element.attr('tabindex', '-1'); }, this)) .on('focus.jstree', $.proxy(function () { if(+(new Date()) - was_click > 500 && !this._data.core.focused && this.settings.core.restore_focus) { was_click = 0; var act = this.get_node(this.element.attr('aria-activedescendant'), true); if(act) { act.find('> .jstree-anchor').focus(); } } }, this)) .on('mouseenter.jstree', '.jstree-anchor', $.proxy(function (e) { this.hover_node(e.currentTarget); }, this)) .on('mouseleave.jstree', '.jstree-anchor', $.proxy(function (e) { this.dehover_node(e.currentTarget); }, this)); }, /** * part of the destroying of an instance. Used internally. * @private * @name unbind() */ unbind : function () { this.element.off('.jstree'); $(document).off('.jstree-' + this._id); }, /** * trigger an event. Used internally. * @private * @name trigger(ev [, data]) * @param {String} ev the name of the event to trigger * @param {Object} data additional data to pass with the event */ trigger : function (ev, data) { if(!data) { data = {}; } data.instance = this; this.element.triggerHandler(ev.replace('.jstree','') + '.jstree', data); }, /** * returns the jQuery extended instance container * @name get_container() * @return {jQuery} */ get_container : function () { return this.element; }, /** * returns the jQuery extended main UL node inside the instance container. Used internally. * @private * @name get_container_ul() * @return {jQuery} */ get_container_ul : function () { return this.element.children(".jstree-children").first(); }, /** * gets string replacements (localization). Used internally. * @private * @name get_string(key) * @param {String} key * @return {String} */ get_string : function (key) { var a = this.settings.core.strings; if($.isFunction(a)) { return a.call(this, key); } if(a && a[key]) { return a[key]; } return key; }, /** * gets the first child of a DOM node. Used internally. * @private * @name _firstChild(dom) * @param {DOMElement} dom * @return {DOMElement} */ _firstChild : function (dom) { dom = dom ? dom.firstChild : null; while(dom !== null && dom.nodeType !== 1) { dom = dom.nextSibling; } return dom; }, /** * gets the next sibling of a DOM node. Used internally. * @private * @name _nextSibling(dom) * @param {DOMElement} dom * @return {DOMElement} */ _nextSibling : function (dom) { dom = dom ? dom.nextSibling : null; while(dom !== null && dom.nodeType !== 1) { dom = dom.nextSibling; } return dom; }, /** * gets the previous sibling of a DOM node. Used internally. * @private * @name _previousSibling(dom) * @param {DOMElement} dom * @return {DOMElement} */ _previousSibling : function (dom) { dom = dom ? dom.previousSibling : null; while(dom !== null && dom.nodeType !== 1) { dom = dom.previousSibling; } return dom; }, /** * get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc) * @name get_node(obj [, as_dom]) * @param {mixed} obj * @param {Boolean} as_dom * @return {Object|jQuery} */ get_node : function (obj, as_dom) { if(obj && obj.id) { obj = obj.id; } if (obj instanceof jQuery && obj.length && obj[0].id) { obj = obj[0].id; } var dom; try { if(this._model.data[obj]) { obj = this._model.data[obj]; } else if(typeof obj === "string" && this._model.data[obj.replace(/^#/, '')]) { obj = this._model.data[obj.replace(/^#/, '')]; } else if(typeof obj === "string" && (dom = $('#' + obj.replace($.jstree.idregex,'\\$&'), this.element)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) { obj = this._model.data[dom.closest('.jstree-node').attr('id')]; } else if((dom = this.element.find(obj)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) { obj = this._model.data[dom.closest('.jstree-node').attr('id')]; } else if((dom = this.element.find(obj)).length && dom.hasClass('jstree')) { obj = this._model.data[$.jstree.root]; } else { return false; } if(as_dom) { obj = obj.id === $.jstree.root ? this.element : $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element); } return obj; } catch (ex) { return false; } }, /** * get the path to a node, either consisting of node texts, or of node IDs, optionally glued together (otherwise an array) * @name get_path(obj [, glue, ids]) * @param {mixed} obj the node * @param {String} glue if you want the path as a string - pass the glue here (for example '/'), if a falsy value is supplied here, an array is returned * @param {Boolean} ids if set to true build the path using ID, otherwise node text is used * @return {mixed} */ get_path : function (obj, glue, ids) { obj = obj.parents ? obj : this.get_node(obj); if(!obj || obj.id === $.jstree.root || !obj.parents) { return false; } var i, j, p = []; p.push(ids ? obj.id : obj.text); for(i = 0, j = obj.parents.length; i < j; i++) { p.push(ids ? obj.parents[i] : this.get_text(obj.parents[i])); } p = p.reverse().slice(1); return glue ? p.join(glue) : p; }, /** * get the next visible node that is below the `obj` node. If `strict` is set to `true` only sibling nodes are returned. * @name get_next_dom(obj [, strict]) * @param {mixed} obj * @param {Boolean} strict * @return {jQuery} */ get_next_dom : function (obj, strict) { var tmp; obj = this.get_node(obj, true); if(obj[0] === this.element[0]) { tmp = this._firstChild(this.get_container_ul()[0]); while (tmp && tmp.offsetHeight === 0) { tmp = this._nextSibling(tmp); } return tmp ? $(tmp) : false; } if(!obj || !obj.length) { return false; } if(strict) { tmp = obj[0]; do { tmp = this._nextSibling(tmp); } while (tmp && tmp.offsetHeight === 0); return tmp ? $(tmp) : false; } if(obj.hasClass("jstree-open")) { tmp = this._firstChild(obj.children('.jstree-children')[0]); while (tmp && tmp.offsetHeight === 0) { tmp = this._nextSibling(tmp); } if(tmp !== null) { return $(tmp); } } tmp = obj[0]; do { tmp = this._nextSibling(tmp); } while (tmp && tmp.offsetHeight === 0); if(tmp !== null) { return $(tmp); } return obj.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first(); }, /** * get the previous visible node that is above the `obj` node. If `strict` is set to `true` only sibling nodes are returned. * @name get_prev_dom(obj [, strict]) * @param {mixed} obj * @param {Boolean} strict * @return {jQuery} */ get_prev_dom : function (obj, strict) { var tmp; obj = this.get_node(obj, true); if(obj[0] === this.element[0]) { tmp = this.get_container_ul()[0].lastChild; while (tmp && tmp.offsetHeight === 0) { tmp = this._previousSibling(tmp); } return tmp ? $(tmp) : false; } if(!obj || !obj.length) { return false; } if(strict) { tmp = obj[0]; do { tmp = this._previousSibling(tmp); } while (tmp && tmp.offsetHeight === 0); return tmp ? $(tmp) : false; } tmp = obj[0]; do { tmp = this._previousSibling(tmp); } while (tmp && tmp.offsetHeight === 0); if(tmp !== null) { obj = $(tmp); while(obj.hasClass("jstree-open")) { obj = obj.children(".jstree-children").first().children(".jstree-node:visible:last"); } return obj; } tmp = obj[0].parentNode.parentNode; return tmp && tmp.className && tmp.className.indexOf('jstree-node') !== -1 ? $(tmp) : false; }, /** * get the parent ID of a node * @name get_parent(obj) * @param {mixed} obj * @return {String} */ get_parent : function (obj) { obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } return obj.parent; }, /** * get a jQuery collection of all the children of a node (node must be rendered), returns false on error * @name get_children_dom(obj) * @param {mixed} obj * @return {jQuery} */ get_children_dom : function (obj) { obj = this.get_node(obj, true); if(obj[0] === this.element[0]) { return this.get_container_ul().children(".jstree-node"); } if(!obj || !obj.length) { return false; } return obj.children(".jstree-children").children(".jstree-node"); }, /** * checks if a node has children * @name is_parent(obj) * @param {mixed} obj * @return {Boolean} */ is_parent : function (obj) { obj = this.get_node(obj); return obj && (obj.state.loaded === false || obj.children.length > 0); }, /** * checks if a node is loaded (its children are available) * @name is_loaded(obj) * @param {mixed} obj * @return {Boolean} */ is_loaded : function (obj) { obj = this.get_node(obj); return obj && obj.state.loaded; }, /** * check if a node is currently loading (fetching children) * @name is_loading(obj) * @param {mixed} obj * @return {Boolean} */ is_loading : function (obj) { obj = this.get_node(obj); return obj && obj.state && obj.state.loading; }, /** * check if a node is opened * @name is_open(obj) * @param {mixed} obj * @return {Boolean} */ is_open : function (obj) { obj = this.get_node(obj); return obj && obj.state.opened; }, /** * check if a node is in a closed state * @name is_closed(obj) * @param {mixed} obj * @return {Boolean} */ is_closed : function (obj) { obj = this.get_node(obj); return obj && this.is_parent(obj) && !obj.state.opened; }, /** * check if a node has no children * @name is_leaf(obj) * @param {mixed} obj * @return {Boolean} */ is_leaf : function (obj) { return !this.is_parent(obj); }, /** * loads a node (fetches its children using the `core.data` setting). Multiple nodes can be passed to by using an array. * @name load_node(obj [, callback]) * @param {mixed} obj * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives two arguments - the node and a boolean status * @return {Boolean} * @trigger load_node.jstree */ load_node : function (obj, callback) { var k, l, i, j, c; if($.isArray(obj)) { this._load_nodes(obj.slice(), callback); return true; } obj = this.get_node(obj); if(!obj) { if(callback) { callback.call(this, obj, false); } return false; } // if(obj.state.loading) { } // the node is already loading - just wait for it to load and invoke callback? but if called implicitly it should be loaded again? if(obj.state.loaded) { obj.state.loaded = false; for(i = 0, j = obj.parents.length; i < j; i++) { this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) { return $.inArray(v, obj.children_d) === -1; }); } for(k = 0, l = obj.children_d.length; k < l; k++) { if(this._model.data[obj.children_d[k]].state.selected) { c = true; } delete this._model.data[obj.children_d[k]]; } if (c) { this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) { return $.inArray(v, obj.children_d) === -1; }); } obj.children = []; obj.children_d = []; if(c) { this.trigger('changed', { 'action' : 'load_node', 'node' : obj, 'selected' : this._data.core.selected }); } } obj.state.failed = false; obj.state.loading = true; this.get_node(obj, true).addClass("jstree-loading").attr('aria-busy',true); this._load_node(obj, $.proxy(function (status) { obj = this._model.data[obj.id]; obj.state.loading = false; obj.state.loaded = status; obj.state.failed = !obj.state.loaded; var dom = this.get_node(obj, true), i = 0, j = 0, m = this._model.data, has_children = false; for(i = 0, j = obj.children.length; i < j; i++) { if(m[obj.children[i]] && !m[obj.children[i]].state.hidden) { has_children = true; break; } } if(obj.state.loaded && dom && dom.length) { dom.removeClass('jstree-closed jstree-open jstree-leaf'); if (!has_children) { dom.addClass('jstree-leaf'); } else { if (obj.id !== '#') { dom.addClass(obj.state.opened ? 'jstree-open' : 'jstree-closed'); } } } dom.removeClass("jstree-loading").attr('aria-busy',false); /** * triggered after a node is loaded * @event * @name load_node.jstree * @param {Object} node the node that was loading * @param {Boolean} status was the node loaded successfully */ this.trigger('load_node', { "node" : obj, "status" : status }); if(callback) { callback.call(this, obj, status); } }, this)); return true; }, /** * load an array of nodes (will also load unavailable nodes as soon as they appear in the structure). Used internally. * @private * @name _load_nodes(nodes [, callback]) * @param {array} nodes * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes */ _load_nodes : function (nodes, callback, is_callback, force_reload) { var r = true, c = function () { this._load_nodes(nodes, callback, true); }, m = this._model.data, i, j, tmp = []; for(i = 0, j = nodes.length; i < j; i++) { if(m[nodes[i]] && ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || (!is_callback && force_reload) )) { if(!this.is_loading(nodes[i])) { this.load_node(nodes[i], c); } r = false; } } if(r) { for(i = 0, j = nodes.length; i < j; i++) { if(m[nodes[i]] && m[nodes[i]].state.loaded) { tmp.push(nodes[i]); } } if(callback && !callback.done) { callback.call(this, tmp); callback.done = true; } } }, /** * loads all unloaded nodes * @name load_all([obj, callback]) * @param {mixed} obj the node to load recursively, omit to load all nodes in the tree * @param {function} callback a function to be executed once loading all the nodes is complete, * @trigger load_all.jstree */ load_all : function (obj, callback) { if(!obj) { obj = $.jstree.root; } obj = this.get_node(obj); if(!obj) { return false; } var to_load = [], m = this._model.data, c = m[obj.id].children_d, i, j; if(obj.state && !obj.state.loaded) { to_load.push(obj.id); } for(i = 0, j = c.length; i < j; i++) { if(m[c[i]] && m[c[i]].state && !m[c[i]].state.loaded) { to_load.push(c[i]); } } if(to_load.length) { this._load_nodes(to_load, function () { this.load_all(obj, callback); }); } else { /** * triggered after a load_all call completes * @event * @name load_all.jstree * @param {Object} node the recursively loaded node */ if(callback) { callback.call(this, obj); } this.trigger('load_all', { "node" : obj }); } }, /** * handles the actual loading of a node. Used only internally. * @private * @name _load_node(obj [, callback]) * @param {mixed} obj * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status * @return {Boolean} */ _load_node : function (obj, callback) { var s = this.settings.core.data, t; var notTextOrCommentNode = function notTextOrCommentNode () { return this.nodeType !== 3 && this.nodeType !== 8; }; // use original HTML if(!s) { if(obj.id === $.jstree.root) { return this._append_html_data(obj, this._data.core.original_container_html.clone(true), function (status) { callback.call(this, status); }); } else { return callback.call(this, false); } // return callback.call(this, obj.id === $.jstree.root ? this._append_html_data(obj, this._data.core.original_container_html.clone(true)) : false); } if($.isFunction(s)) { return s.call(this, obj, $.proxy(function (d) { if(d === false) { callback.call(this, false); } else { this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $($.parseHTML(d)).filter(notTextOrCommentNode) : d, function (status) { callback.call(this, status); }); } // return d === false ? callback.call(this, false) : callback.call(this, this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $(d) : d)); }, this)); } if(typeof s === 'object') { if(s.url) { s = $.extend(true, {}, s); if($.isFunction(s.url)) { s.url = s.url.call(this, obj); } if($.isFunction(s.data)) { s.data = s.data.call(this, obj); } return $.ajax(s) .done($.proxy(function (d,t,x) { var type = x.getResponseHeader('Content-Type'); if((type && type.indexOf('json') !== -1) || typeof d === "object") { return this._append_json_data(obj, d, function (status) { callback.call(this, status); }); //return callback.call(this, this._append_json_data(obj, d)); } if((type && type.indexOf('html') !== -1) || typeof d === "string") { return this._append_html_data(obj, $($.parseHTML(d)).filter(notTextOrCommentNode), function (status) { callback.call(this, status); }); // return callback.call(this, this._append_html_data(obj, $(d))); } this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : x }) }; this.settings.core.error.call(this, this._data.core.last_error); return callback.call(this, false); }, this)) .fail($.proxy(function (f) { this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : f }) }; callback.call(this, false); this.settings.core.error.call(this, this._data.core.last_error); }, this)); } if ($.isArray(s)) { t = $.extend(true, [], s); } else if ($.isPlainObject(s)) { t = $.extend(true, {}, s); } else { t = s; } if(obj.id === $.jstree.root) { return this._append_json_data(obj, t, function (status) { callback.call(this, status); }); } else { this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_05', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) }; this.settings.core.error.call(this, this._data.core.last_error); return callback.call(this, false); } //return callback.call(this, (obj.id === $.jstree.root ? this._append_json_data(obj, t) : false) ); } if(typeof s === 'string') { if(obj.id === $.jstree.root) { return this._append_html_data(obj, $($.parseHTML(s)).filter(notTextOrCommentNode), function (status) { callback.call(this, status); }); } else { this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_06', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) }; this.settings.core.error.call(this, this._data.core.last_error); return callback.call(this, false); } //return callback.call(this, (obj.id === $.jstree.root ? this._append_html_data(obj, $(s)) : false) ); } return callback.call(this, false); }, /** * adds a node to the list of nodes to redraw. Used only internally. * @private * @name _node_changed(obj [, callback]) * @param {mixed} obj */ _node_changed : function (obj) { obj = this.get_node(obj); if (obj && $.inArray(obj.id, this._model.changed) === -1) { this._model.changed.push(obj.id); } }, /** * appends HTML content to the tree. Used internally. * @private * @name _append_html_data(obj, data) * @param {mixed} obj the node to append to * @param {String} data the HTML string to parse and append * @trigger model.jstree, changed.jstree */ _append_html_data : function (dom, data, cb) { dom = this.get_node(dom); dom.children = []; dom.children_d = []; var dat = data.is('ul') ? data.children() : data, par = dom.id, chd = [], dpc = [], m = this._model.data, p = m[par], s = this._data.core.selected.length, tmp, i, j; dat.each($.proxy(function (i, v) { tmp = this._parse_model_from_html($(v), par, p.parents.concat()); if(tmp) { chd.push(tmp); dpc.push(tmp); if(m[tmp].children_d.length) { dpc = dpc.concat(m[tmp].children_d); } } }, this)); p.children = chd; p.children_d = dpc; for(i = 0, j = p.parents.length; i < j; i++) { m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); } /** * triggered when new data is inserted to the tree model * @event * @name model.jstree * @param {Array} nodes an array of node IDs * @param {String} parent the parent ID of the nodes */ this.trigger('model', { "nodes" : dpc, 'parent' : par }); if(par !== $.jstree.root) { this._node_changed(par); this.redraw(); } else { this.get_container_ul().children('.jstree-initial-node').remove(); this.redraw(true); } if(this._data.core.selected.length !== s) { this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected }); } cb.call(this, true); }, /** * appends JSON content to the tree. Used internally. * @private * @name _append_json_data(obj, data) * @param {mixed} obj the node to append to * @param {String} data the JSON object to parse and append * @param {Boolean} force_processing internal param - do not set * @trigger model.jstree, changed.jstree */ _append_json_data : function (dom, data, cb, force_processing) { if(this.element === null) { return; } dom = this.get_node(dom); dom.children = []; dom.children_d = []; // *%$@!!! if(data.d) { data = data.d; if(typeof data === "string") { data = JSON.parse(data); } } if(!$.isArray(data)) { data = [data]; } var w = null, args = { 'df' : this._model.default_state, 'dat' : data, 'par' : dom.id, 'm' : this._model.data, 't_id' : this._id, 't_cnt' : this._cnt, 'sel' : this._data.core.selected }, func = function (data, undefined) { if(data.data) { data = data.data; } var dat = data.dat, par = data.par, chd = [], dpc = [], add = [], df = data.df, t_id = data.t_id, t_cnt = data.t_cnt, m = data.m, p = m[par], sel = data.sel, tmp, i, j, rslt, parse_flat = function (d, p, ps) { if(!ps) { ps = []; } else { ps = ps.concat(); } if(p) { ps.unshift(p); } var tid = d.id.toString(), i, j, c, e, tmp = { id : tid, text : d.text || '', icon : d.icon !== undefined ? d.icon : true, parent : p, parents : ps, children : d.children || [], children_d : d.children_d || [], data : d.data, state : { }, li_attr : { id : false }, a_attr : { href : '#' }, original : false }; for(i in df) { if(df.hasOwnProperty(i)) { tmp.state[i] = df[i]; } } if(d && d.data && d.data.jstree && d.data.jstree.icon) { tmp.icon = d.data.jstree.icon; } if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { tmp.icon = true; } if(d && d.data) { tmp.data = d.data; if(d.data.jstree) { for(i in d.data.jstree) { if(d.data.jstree.hasOwnProperty(i)) { tmp.state[i] = d.data.jstree[i]; } } } } if(d && typeof d.state === 'object') { for (i in d.state) { if(d.state.hasOwnProperty(i)) { tmp.state[i] = d.state[i]; } } } if(d && typeof d.li_attr === 'object') { for (i in d.li_attr) { if(d.li_attr.hasOwnProperty(i)) { tmp.li_attr[i] = d.li_attr[i]; } } } if(!tmp.li_attr.id) { tmp.li_attr.id = tid; } if(d && typeof d.a_attr === 'object') { for (i in d.a_attr) { if(d.a_attr.hasOwnProperty(i)) { tmp.a_attr[i] = d.a_attr[i]; } } } if(d && d.children && d.children === true) { tmp.state.loaded = false; tmp.children = []; tmp.children_d = []; } m[tmp.id] = tmp; for(i = 0, j = tmp.children.length; i < j; i++) { c = parse_flat(m[tmp.children[i]], tmp.id, ps); e = m[c]; tmp.children_d.push(c); if(e.children_d.length) { tmp.children_d = tmp.children_d.concat(e.children_d); } } delete d.data; delete d.children; m[tmp.id].original = d; if(tmp.state.selected) { add.push(tmp.id); } return tmp.id; }, parse_nest = function (d, p, ps) { if(!ps) { ps = []; } else { ps = ps.concat(); } if(p) { ps.unshift(p); } var tid = false, i, j, c, e, tmp; do { tid = 'j' + t_id + '_' + (++t_cnt); } while(m[tid]); tmp = { id : false, text : typeof d === 'string' ? d : '', icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true, parent : p, parents : ps, children : [], children_d : [], data : null, state : { }, li_attr : { id : false }, a_attr : { href : '#' }, original : false }; for(i in df) { if(df.hasOwnProperty(i)) { tmp.state[i] = df[i]; } } if(d && d.id) { tmp.id = d.id.toString(); } if(d && d.text) { tmp.text = d.text; } if(d && d.data && d.data.jstree && d.data.jstree.icon) { tmp.icon = d.data.jstree.icon; } if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { tmp.icon = true; } if(d && d.data) { tmp.data = d.data; if(d.data.jstree) { for(i in d.data.jstree) { if(d.data.jstree.hasOwnProperty(i)) { tmp.state[i] = d.data.jstree[i]; } } } } if(d && typeof d.state === 'object') { for (i in d.state) { if(d.state.hasOwnProperty(i)) { tmp.state[i] = d.state[i]; } } } if(d && typeof d.li_attr === 'object') { for (i in d.li_attr) { if(d.li_attr.hasOwnProperty(i)) { tmp.li_attr[i] = d.li_attr[i]; } } } if(tmp.li_attr.id && !tmp.id) { tmp.id = tmp.li_attr.id.toString(); } if(!tmp.id) { tmp.id = tid; } if(!tmp.li_attr.id) { tmp.li_attr.id = tmp.id; } if(d && typeof d.a_attr === 'object') { for (i in d.a_attr) { if(d.a_attr.hasOwnProperty(i)) { tmp.a_attr[i] = d.a_attr[i]; } } } if(d && d.children && d.children.length) { for(i = 0, j = d.children.length; i < j; i++) { c = parse_nest(d.children[i], tmp.id, ps); e = m[c]; tmp.children.push(c); if(e.children_d.length) { tmp.children_d = tmp.children_d.concat(e.children_d); } } tmp.children_d = tmp.children_d.concat(tmp.children); } if(d && d.children && d.children === true) { tmp.state.loaded = false; tmp.children = []; tmp.children_d = []; } delete d.data; delete d.children; tmp.original = d; m[tmp.id] = tmp; if(tmp.state.selected) { add.push(tmp.id); } return tmp.id; }; if(dat.length && dat[0].id !== undefined && dat[0].parent !== undefined) { // Flat JSON support (for easy import from DB): // 1) convert to object (foreach) for(i = 0, j = dat.length; i < j; i++) { if(!dat[i].children) { dat[i].children = []; } if(!dat[i].state) { dat[i].state = {}; } m[dat[i].id.toString()] = dat[i]; } // 2) populate children (foreach) for(i = 0, j = dat.length; i < j; i++) { if (!m[dat[i].parent.toString()]) { this._data.core.last_error = { 'error' : 'parse', 'plugin' : 'core', 'id' : 'core_07', 'reason' : 'Node with invalid parent', 'data' : JSON.stringify({ 'id' : dat[i].id.toString(), 'parent' : dat[i].parent.toString() }) }; this.settings.core.error.call(this, this._data.core.last_error); continue; } m[dat[i].parent.toString()].children.push(dat[i].id.toString()); // populate parent.children_d p.children_d.push(dat[i].id.toString()); } // 3) normalize && populate parents and children_d with recursion for(i = 0, j = p.children.length; i < j; i++) { tmp = parse_flat(m[p.children[i]], par, p.parents.concat()); dpc.push(tmp); if(m[tmp].children_d.length) { dpc = dpc.concat(m[tmp].children_d); } } for(i = 0, j = p.parents.length; i < j; i++) { m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); } // ?) three_state selection - p.state.selected && t - (if three_state foreach(dat => ch) -> foreach(parents) if(parent.selected) child.selected = true; rslt = { 'cnt' : t_cnt, 'mod' : m, 'sel' : sel, 'par' : par, 'dpc' : dpc, 'add' : add }; } else { for(i = 0, j = dat.length; i < j; i++) { tmp = parse_nest(dat[i], par, p.parents.concat()); if(tmp) { chd.push(tmp); dpc.push(tmp); if(m[tmp].children_d.length) { dpc = dpc.concat(m[tmp].children_d); } } } p.children = chd; p.children_d = dpc; for(i = 0, j = p.parents.length; i < j; i++) { m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); } rslt = { 'cnt' : t_cnt, 'mod' : m, 'sel' : sel, 'par' : par, 'dpc' : dpc, 'add' : add }; } if(typeof window === 'undefined' || typeof window.document === 'undefined') { postMessage(rslt); } else { return rslt; } }, rslt = function (rslt, worker) { if(this.element === null) { return; } this._cnt = rslt.cnt; var i, m = this._model.data; for (i in m) { if (m.hasOwnProperty(i) && m[i].state && m[i].state.loading && rslt.mod[i]) { rslt.mod[i].state.loading = true; } } this._model.data = rslt.mod; // breaks the reference in load_node - careful if(worker) { var j, a = rslt.add, r = rslt.sel, s = this._data.core.selected.slice(); m = this._model.data; // if selection was changed while calculating in worker if(r.length !== s.length || $.vakata.array_unique(r.concat(s)).length !== r.length) { // deselect nodes that are no longer selected for(i = 0, j = r.length; i < j; i++) { if($.inArray(r[i], a) === -1 && $.inArray(r[i], s) === -1) { m[r[i]].state.selected = false; } } // select nodes that were selected in the mean time for(i = 0, j = s.length; i < j; i++) { if($.inArray(s[i], r) === -1) { m[s[i]].state.selected = true; } } } } if(rslt.add.length) { this._data.core.selected = this._data.core.selected.concat(rslt.add); } this.trigger('model', { "nodes" : rslt.dpc, 'parent' : rslt.par }); if(rslt.par !== $.jstree.root) { this._node_changed(rslt.par); this.redraw(); } else { // this.get_container_ul().children('.jstree-initial-node').remove(); this.redraw(true); } if(rslt.add.length) { this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected }); } cb.call(this, true); }; if(this.settings.core.worker && window.Blob && window.URL && window.Worker) { try { if(this._wrk === null) { this._wrk = window.URL.createObjectURL( new window.Blob( ['self.onmessage = ' + func.toString()], {type:"text/javascript"} ) ); } if(!this._data.core.working || force_processing) { this._data.core.working = true; w = new window.Worker(this._wrk); w.onmessage = $.proxy(function (e) { rslt.call(this, e.data, true); try { w.terminate(); w = null; } catch(ignore) { } if(this._data.core.worker_queue.length) { this._append_json_data.apply(this, this._data.core.worker_queue.shift()); } else { this._data.core.working = false; } }, this); if(!args.par) { if(this._data.core.worker_queue.length) { this._append_json_data.apply(this, this._data.core.worker_queue.shift()); } else { this._data.core.working = false; } } else { w.postMessage(args); } } else { this._data.core.worker_queue.push([dom, data, cb, true]); } } catch(e) { rslt.call(this, func(args), false); if(this._data.core.worker_queue.length) { this._append_json_data.apply(this, this._data.core.worker_queue.shift()); } else { this._data.core.working = false; } } } else { rslt.call(this, func(args), false); } }, /** * parses a node from a jQuery object and appends them to the in memory tree model. Used internally. * @private * @name _parse_model_from_html(d [, p, ps]) * @param {jQuery} d the jQuery object to parse * @param {String} p the parent ID * @param {Array} ps list of all parents * @return {String} the ID of the object added to the model */ _parse_model_from_html : function (d, p, ps) { if(!ps) { ps = []; } else { ps = [].concat(ps); } if(p) { ps.unshift(p); } var c, e, m = this._model.data, data = { id : false, text : false, icon : true, parent : p, parents : ps, children : [], children_d : [], data : null, state : { }, li_attr : { id : false }, a_attr : { href : '#' }, original : false }, i, tmp, tid; for(i in this._model.default_state) { if(this._model.default_state.hasOwnProperty(i)) { data.state[i] = this._model.default_state[i]; } } tmp = $.vakata.attributes(d, true); $.each(tmp, function (i, v) { v = $.trim(v); if(!v.length) { return true; } data.li_attr[i] = v; if(i === 'id') { data.id = v.toString(); } }); tmp = d.children('a').first(); if(tmp.length) { tmp = $.vakata.attributes(tmp, true); $.each(tmp, function (i, v) { v = $.trim(v); if(v.length) { data.a_attr[i] = v; } }); } tmp = d.children("a").first().length ? d.children("a").first().clone() : d.clone(); tmp.children("ins, i, ul").remove(); tmp = tmp.html(); tmp = $('<div />').html(tmp); data.text = this.settings.core.force_text ? tmp.text() : tmp.html(); tmp = d.data(); data.data = tmp ? $.extend(true, {}, tmp) : null; data.state.opened = d.hasClass('jstree-open'); data.state.selected = d.children('a').hasClass('jstree-clicked'); data.state.disabled = d.children('a').hasClass('jstree-disabled'); if(data.data && data.data.jstree) { for(i in data.data.jstree) { if(data.data.jstree.hasOwnProperty(i)) { data.state[i] = data.data.jstree[i]; } } } tmp = d.children("a").children(".jstree-themeicon"); if(tmp.length) { data.icon = tmp.hasClass('jstree-themeicon-hidden') ? false : tmp.attr('rel'); } if(data.state.icon !== undefined) { data.icon = data.state.icon; } if(data.icon === undefined || data.icon === null || data.icon === "") { data.icon = true; } tmp = d.children("ul").children("li"); do { tid = 'j' + this._id + '_' + (++this._cnt); } while(m[tid]); data.id = data.li_attr.id ? data.li_attr.id.toString() : tid; if(tmp.length) { tmp.each($.proxy(function (i, v) { c = this._parse_model_from_html($(v), data.id, ps); e = this._model.data[c]; data.children.push(c); if(e.children_d.length) { data.children_d = data.children_d.concat(e.children_d); } }, this)); data.children_d = data.children_d.concat(data.children); } else { if(d.hasClass('jstree-closed')) { data.state.loaded = false; } } if(data.li_attr['class']) { data.li_attr['class'] = data.li_attr['class'].replace('jstree-closed','').replace('jstree-open',''); } if(data.a_attr['class']) { data.a_attr['class'] = data.a_attr['class'].replace('jstree-clicked','').replace('jstree-disabled',''); } m[data.id] = data; if(data.state.selected) { this._data.core.selected.push(data.id); } return data.id; }, /** * parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally. * @private * @name _parse_model_from_flat_json(d [, p, ps]) * @param {Object} d the JSON object to parse * @param {String} p the parent ID * @param {Array} ps list of all parents * @return {String} the ID of the object added to the model */ _parse_model_from_flat_json : function (d, p, ps) { if(!ps) { ps = []; } else { ps = ps.concat(); } if(p) { ps.unshift(p); } var tid = d.id.toString(), m = this._model.data, df = this._model.default_state, i, j, c, e, tmp = { id : tid, text : d.text || '', icon : d.icon !== undefined ? d.icon : true, parent : p, parents : ps, children : d.children || [], children_d : d.children_d || [], data : d.data, state : { }, li_attr : { id : false }, a_attr : { href : '#' }, original : false }; for(i in df) { if(df.hasOwnProperty(i)) { tmp.state[i] = df[i]; } } if(d && d.data && d.data.jstree && d.data.jstree.icon) { tmp.icon = d.data.jstree.icon; } if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { tmp.icon = true; } if(d && d.data) { tmp.data = d.data; if(d.data.jstree) { for(i in d.data.jstree) { if(d.data.jstree.hasOwnProperty(i)) { tmp.state[i] = d.data.jstree[i]; } } } } if(d && typeof d.state === 'object') { for (i in d.state) { if(d.state.hasOwnProperty(i)) { tmp.state[i] = d.state[i]; } } } if(d && typeof d.li_attr === 'object') { for (i in d.li_attr) { if(d.li_attr.hasOwnProperty(i)) { tmp.li_attr[i] = d.li_attr[i]; } } } if(!tmp.li_attr.id) { tmp.li_attr.id = tid; } if(d && typeof d.a_attr === 'object') { for (i in d.a_attr) { if(d.a_attr.hasOwnProperty(i)) { tmp.a_attr[i] = d.a_attr[i]; } } } if(d && d.children && d.children === true) { tmp.state.loaded = false; tmp.children = []; tmp.children_d = []; } m[tmp.id] = tmp; for(i = 0, j = tmp.children.length; i < j; i++) { c = this._parse_model_from_flat_json(m[tmp.children[i]], tmp.id, ps); e = m[c]; tmp.children_d.push(c); if(e.children_d.length) { tmp.children_d = tmp.children_d.concat(e.children_d); } } delete d.data; delete d.children; m[tmp.id].original = d; if(tmp.state.selected) { this._data.core.selected.push(tmp.id); } return tmp.id; }, /** * parses a node from a JSON object and appends it to the in memory tree model. Used internally. * @private * @name _parse_model_from_json(d [, p, ps]) * @param {Object} d the JSON object to parse * @param {String} p the parent ID * @param {Array} ps list of all parents * @return {String} the ID of the object added to the model */ _parse_model_from_json : function (d, p, ps) { if(!ps) { ps = []; } else { ps = ps.concat(); } if(p) { ps.unshift(p); } var tid = false, i, j, c, e, m = this._model.data, df = this._model.default_state, tmp; do { tid = 'j' + this._id + '_' + (++this._cnt); } while(m[tid]); tmp = { id : false, text : typeof d === 'string' ? d : '', icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true, parent : p, parents : ps, children : [], children_d : [], data : null, state : { }, li_attr : { id : false }, a_attr : { href : '#' }, original : false }; for(i in df) { if(df.hasOwnProperty(i)) { tmp.state[i] = df[i]; } } if(d && d.id) { tmp.id = d.id.toString(); } if(d && d.text) { tmp.text = d.text; } if(d && d.data && d.data.jstree && d.data.jstree.icon) { tmp.icon = d.data.jstree.icon; } if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { tmp.icon = true; } if(d && d.data) { tmp.data = d.data; if(d.data.jstree) { for(i in d.data.jstree) { if(d.data.jstree.hasOwnProperty(i)) { tmp.state[i] = d.data.jstree[i]; } } } } if(d && typeof d.state === 'object') { for (i in d.state) { if(d.state.hasOwnProperty(i)) { tmp.state[i] = d.state[i]; } } } if(d && typeof d.li_attr === 'object') { for (i in d.li_attr) { if(d.li_attr.hasOwnProperty(i)) { tmp.li_attr[i] = d.li_attr[i]; } } } if(tmp.li_attr.id && !tmp.id) { tmp.id = tmp.li_attr.id.toString(); } if(!tmp.id) { tmp.id = tid; } if(!tmp.li_attr.id) { tmp.li_attr.id = tmp.id; } if(d && typeof d.a_attr === 'object') { for (i in d.a_attr) { if(d.a_attr.hasOwnProperty(i)) { tmp.a_attr[i] = d.a_attr[i]; } } } if(d && d.children && d.children.length) { for(i = 0, j = d.children.length; i < j; i++) { c = this._parse_model_from_json(d.children[i], tmp.id, ps); e = m[c]; tmp.children.push(c); if(e.children_d.length) { tmp.children_d = tmp.children_d.concat(e.children_d); } } tmp.children_d = tmp.children_d.concat(tmp.children); } if(d && d.children && d.children === true) { tmp.state.loaded = false; tmp.children = []; tmp.children_d = []; } delete d.data; delete d.children; tmp.original = d; m[tmp.id] = tmp; if(tmp.state.selected) { this._data.core.selected.push(tmp.id); } return tmp.id; }, /** * redraws all nodes that need to be redrawn. Used internally. * @private * @name _redraw() * @trigger redraw.jstree */ _redraw : function () { var nodes = this._model.force_full_redraw ? this._model.data[$.jstree.root].children.concat([]) : this._model.changed.concat([]), f = document.createElement('UL'), tmp, i, j, fe = this._data.core.focused; for(i = 0, j = nodes.length; i < j; i++) { tmp = this.redraw_node(nodes[i], true, this._model.force_full_redraw); if(tmp && this._model.force_full_redraw) { f.appendChild(tmp); } } if(this._model.force_full_redraw) { f.className = this.get_container_ul()[0].className; f.setAttribute('role','group'); this.element.empty().append(f); //this.get_container_ul()[0].appendChild(f); } if(fe !== null && this.settings.core.restore_focus) { tmp = this.get_node(fe, true); if(tmp && tmp.length && tmp.children('.jstree-anchor')[0] !== document.activeElement) { tmp.children('.jstree-anchor').focus(); } else { this._data.core.focused = null; } } this._model.force_full_redraw = false; this._model.changed = []; /** * triggered after nodes are redrawn * @event * @name redraw.jstree * @param {array} nodes the redrawn nodes */ this.trigger('redraw', { "nodes" : nodes }); }, /** * redraws all nodes that need to be redrawn or optionally - the whole tree * @name redraw([full]) * @param {Boolean} full if set to `true` all nodes are redrawn. */ redraw : function (full) { if(full) { this._model.force_full_redraw = true; } //if(this._model.redraw_timeout) { // clearTimeout(this._model.redraw_timeout); //} //this._model.redraw_timeout = setTimeout($.proxy(this._redraw, this),0); this._redraw(); }, /** * redraws a single node's children. Used internally. * @private * @name draw_children(node) * @param {mixed} node the node whose children will be redrawn */ draw_children : function (node) { var obj = this.get_node(node), i = false, j = false, k = false, d = document; if(!obj) { return false; } if(obj.id === $.jstree.root) { return this.redraw(true); } node = this.get_node(node, true); if(!node || !node.length) { return false; } // TODO: quick toggle node.children('.jstree-children').remove(); node = node[0]; if(obj.children.length && obj.state.loaded) { k = d.createElement('UL'); k.setAttribute('role', 'group'); k.className = 'jstree-children'; for(i = 0, j = obj.children.length; i < j; i++) { k.appendChild(this.redraw_node(obj.children[i], true, true)); } node.appendChild(k); } }, /** * redraws a single node. Used internally. * @private * @name redraw_node(node, deep, is_callback, force_render) * @param {mixed} node the node to redraw * @param {Boolean} deep should child nodes be redrawn too * @param {Boolean} is_callback is this a recursion call * @param {Boolean} force_render should children of closed parents be drawn anyway */ redraw_node : function (node, deep, is_callback, force_render) { var obj = this.get_node(node), par = false, ind = false, old = false, i = false, j = false, k = false, c = '', d = document, m = this._model.data, f = false, s = false, tmp = null, t = 0, l = 0, has_children = false, last_sibling = false; if(!obj) { return false; } if(obj.id === $.jstree.root) { return this.redraw(true); } deep = deep || obj.children.length === 0; node = !document.querySelector ? document.getElementById(obj.id) : this.element[0].querySelector('#' + ("0123456789".indexOf(obj.id[0]) !== -1 ? '\\3' + obj.id[0] + ' ' + obj.id.substr(1).replace($.jstree.idregex,'\\$&') : obj.id.replace($.jstree.idregex,'\\$&')) ); //, this.element); if(!node) { deep = true; //node = d.createElement('LI'); if(!is_callback) { par = obj.parent !== $.jstree.root ? $('#' + obj.parent.replace($.jstree.idregex,'\\$&'), this.element)[0] : null; if(par !== null && (!par || !m[obj.parent].state.opened)) { return false; } ind = $.inArray(obj.id, par === null ? m[$.jstree.root].children : m[obj.parent].children); } } else { node = $(node); if(!is_callback) { par = node.parent().parent()[0]; if(par === this.element[0]) { par = null; } ind = node.index(); } // m[obj.id].data = node.data(); // use only node's data, no need to touch jquery storage if(!deep && obj.children.length && !node.children('.jstree-children').length) { deep = true; } if(!deep) { old = node.children('.jstree-children')[0]; } f = node.children('.jstree-anchor')[0] === document.activeElement; node.remove(); //node = d.createElement('LI'); //node = node[0]; } node = this._data.core.node.cloneNode(true); // node is DOM, deep is boolean c = 'jstree-node '; for(i in obj.li_attr) { if(obj.li_attr.hasOwnProperty(i)) { if(i === 'id') { continue; } if(i !== 'class') { node.setAttribute(i, obj.li_attr[i]); } else { c += obj.li_attr[i]; } } } if(!obj.a_attr.id) { obj.a_attr.id = obj.id + '_anchor'; } node.setAttribute('aria-selected', !!obj.state.selected); node.setAttribute('aria-level', obj.parents.length); node.setAttribute('aria-labelledby', obj.a_attr.id); if(obj.state.disabled) { node.setAttribute('aria-disabled', true); } for(i = 0, j = obj.children.length; i < j; i++) { if(!m[obj.children[i]].state.hidden) { has_children = true; break; } } if(obj.parent !== null && m[obj.parent] && !obj.state.hidden) { i = $.inArray(obj.id, m[obj.parent].children); last_sibling = obj.id; if(i !== -1) { i++; for(j = m[obj.parent].children.length; i < j; i++) { if(!m[m[obj.parent].children[i]].state.hidden) { last_sibling = m[obj.parent].children[i]; } if(last_sibling !== obj.id) { break; } } } } if(obj.state.hidden) { c += ' jstree-hidden'; } if (obj.state.loading) { c += ' jstree-loading'; } if(obj.state.loaded && !has_children) { c += ' jstree-leaf'; } else { c += obj.state.opened && obj.state.loaded ? ' jstree-open' : ' jstree-closed'; node.setAttribute('aria-expanded', (obj.state.opened && obj.state.loaded) ); } if(last_sibling === obj.id) { c += ' jstree-last'; } node.id = obj.id; node.className = c; c = ( obj.state.selected ? ' jstree-clicked' : '') + ( obj.state.disabled ? ' jstree-disabled' : ''); for(j in obj.a_attr) { if(obj.a_attr.hasOwnProperty(j)) { if(j === 'href' && obj.a_attr[j] === '#') { continue; } if(j !== 'class') { node.childNodes[1].setAttribute(j, obj.a_attr[j]); } else { c += ' ' + obj.a_attr[j]; } } } if(c.length) { node.childNodes[1].className = 'jstree-anchor ' + c; } if((obj.icon && obj.icon !== true) || obj.icon === false) { if(obj.icon === false) { node.childNodes[1].childNodes[0].className += ' jstree-themeicon-hidden'; } else if(obj.icon.indexOf('/') === -1 && obj.icon.indexOf('.') === -1) { node.childNodes[1].childNodes[0].className += ' ' + obj.icon + ' jstree-themeicon-custom'; } else { node.childNodes[1].childNodes[0].style.backgroundImage = 'url("'+obj.icon+'")'; node.childNodes[1].childNodes[0].style.backgroundPosition = 'center center'; node.childNodes[1].childNodes[0].style.backgroundSize = 'auto'; node.childNodes[1].childNodes[0].className += ' jstree-themeicon-custom'; } } if(this.settings.core.force_text) { node.childNodes[1].appendChild(d.createTextNode(obj.text)); } else { node.childNodes[1].innerHTML += obj.text; } if(deep && obj.children.length && (obj.state.opened || force_render) && obj.state.loaded) { k = d.createElement('UL'); k.setAttribute('role', 'group'); k.className = 'jstree-children'; for(i = 0, j = obj.children.length; i < j; i++) { k.appendChild(this.redraw_node(obj.children[i], deep, true)); } node.appendChild(k); } if(old) { node.appendChild(old); } if(!is_callback) { // append back using par / ind if(!par) { par = this.element[0]; } for(i = 0, j = par.childNodes.length; i < j; i++) { if(par.childNodes[i] && par.childNodes[i].className && par.childNodes[i].className.indexOf('jstree-children') !== -1) { tmp = par.childNodes[i]; break; } } if(!tmp) { tmp = d.createElement('UL'); tmp.setAttribute('role', 'group'); tmp.className = 'jstree-children'; par.appendChild(tmp); } par = tmp; if(ind < par.childNodes.length) { par.insertBefore(node, par.childNodes[ind]); } else { par.appendChild(node); } if(f) { t = this.element[0].scrollTop; l = this.element[0].scrollLeft; node.childNodes[1].focus(); this.element[0].scrollTop = t; this.element[0].scrollLeft = l; } } if(obj.state.opened && !obj.state.loaded) { obj.state.opened = false; setTimeout($.proxy(function () { this.open_node(obj.id, false, 0); }, this), 0); } return node; }, /** * opens a node, revealing its children. If the node is not loaded it will be loaded and opened once ready. * @name open_node(obj [, callback, animation]) * @param {mixed} obj the node to open * @param {Function} callback a function to execute once the node is opened * @param {Number} animation the animation duration in milliseconds when opening the node (overrides the `core.animation` setting). Use `false` for no animation. * @trigger open_node.jstree, after_open.jstree, before_open.jstree */ open_node : function (obj, callback, animation) { var t1, t2, d, t; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.open_node(obj[t1], callback, animation); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } animation = animation === undefined ? this.settings.core.animation : animation; if(!this.is_closed(obj)) { if(callback) { callback.call(this, obj, false); } return false; } if(!this.is_loaded(obj)) { if(this.is_loading(obj)) { return setTimeout($.proxy(function () { this.open_node(obj, callback, animation); }, this), 500); } this.load_node(obj, function (o, ok) { return ok ? this.open_node(o, callback, animation) : (callback ? callback.call(this, o, false) : false); }); } else { d = this.get_node(obj, true); t = this; if(d.length) { if(animation && d.children(".jstree-children").length) { d.children(".jstree-children").stop(true, true); } if(obj.children.length && !this._firstChild(d.children('.jstree-children')[0])) { this.draw_children(obj); //d = this.get_node(obj, true); } if(!animation) { this.trigger('before_open', { "node" : obj }); d[0].className = d[0].className.replace('jstree-closed', 'jstree-open'); d[0].setAttribute("aria-expanded", true); } else { this.trigger('before_open', { "node" : obj }); d .children(".jstree-children").css("display","none").end() .removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded", true) .children(".jstree-children").stop(true, true) .slideDown(animation, function () { this.style.display = ""; if (t.element) { t.trigger("after_open", { "node" : obj }); } }); } } obj.state.opened = true; if(callback) { callback.call(this, obj, true); } if(!d.length) { /** * triggered when a node is about to be opened (if the node is supposed to be in the DOM, it will be, but it won't be visible yet) * @event * @name before_open.jstree * @param {Object} node the opened node */ this.trigger('before_open', { "node" : obj }); } /** * triggered when a node is opened (if there is an animation it will not be completed yet) * @event * @name open_node.jstree * @param {Object} node the opened node */ this.trigger('open_node', { "node" : obj }); if(!animation || !d.length) { /** * triggered when a node is opened and the animation is complete * @event * @name after_open.jstree * @param {Object} node the opened node */ this.trigger("after_open", { "node" : obj }); } return true; } }, /** * opens every parent of a node (node should be loaded) * @name _open_to(obj) * @param {mixed} obj the node to reveal * @private */ _open_to : function (obj) { obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } var i, j, p = obj.parents; for(i = 0, j = p.length; i < j; i+=1) { if(i !== $.jstree.root) { this.open_node(p[i], false, 0); } } return $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element); }, /** * closes a node, hiding its children * @name close_node(obj [, animation]) * @param {mixed} obj the node to close * @param {Number} animation the animation duration in milliseconds when closing the node (overrides the `core.animation` setting). Use `false` for no animation. * @trigger close_node.jstree, after_close.jstree */ close_node : function (obj, animation) { var t1, t2, t, d; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.close_node(obj[t1], animation); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } if(this.is_closed(obj)) { return false; } animation = animation === undefined ? this.settings.core.animation : animation; t = this; d = this.get_node(obj, true); obj.state.opened = false; /** * triggered when a node is closed (if there is an animation it will not be complete yet) * @event * @name close_node.jstree * @param {Object} node the closed node */ this.trigger('close_node',{ "node" : obj }); if(!d.length) { /** * triggered when a node is closed and the animation is complete * @event * @name after_close.jstree * @param {Object} node the closed node */ this.trigger("after_close", { "node" : obj }); } else { if(!animation) { d[0].className = d[0].className.replace('jstree-open', 'jstree-closed'); d.attr("aria-expanded", false).children('.jstree-children').remove(); this.trigger("after_close", { "node" : obj }); } else { d .children(".jstree-children").attr("style","display:block !important").end() .removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded", false) .children(".jstree-children").stop(true, true).slideUp(animation, function () { this.style.display = ""; d.children('.jstree-children').remove(); if (t.element) { t.trigger("after_close", { "node" : obj }); } }); } } }, /** * toggles a node - closing it if it is open, opening it if it is closed * @name toggle_node(obj) * @param {mixed} obj the node to toggle */ toggle_node : function (obj) { var t1, t2; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.toggle_node(obj[t1]); } return true; } if(this.is_closed(obj)) { return this.open_node(obj); } if(this.is_open(obj)) { return this.close_node(obj); } }, /** * opens all nodes within a node (or the tree), revealing their children. If the node is not loaded it will be loaded and opened once ready. * @name open_all([obj, animation, original_obj]) * @param {mixed} obj the node to open recursively, omit to open all nodes in the tree * @param {Number} animation the animation duration in milliseconds when opening the nodes, the default is no animation * @param {jQuery} reference to the node that started the process (internal use) * @trigger open_all.jstree */ open_all : function (obj, animation, original_obj) { if(!obj) { obj = $.jstree.root; } obj = this.get_node(obj); if(!obj) { return false; } var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), i, j, _this; if(!dom.length) { for(i = 0, j = obj.children_d.length; i < j; i++) { if(this.is_closed(this._model.data[obj.children_d[i]])) { this._model.data[obj.children_d[i]].state.opened = true; } } return this.trigger('open_all', { "node" : obj }); } original_obj = original_obj || dom; _this = this; dom = this.is_closed(obj) ? dom.find('.jstree-closed').addBack() : dom.find('.jstree-closed'); dom.each(function () { _this.open_node( this, function(node, status) { if(status && this.is_parent(node)) { this.open_all(node, animation, original_obj); } }, animation || 0 ); }); if(original_obj.find('.jstree-closed').length === 0) { /** * triggered when an `open_all` call completes * @event * @name open_all.jstree * @param {Object} node the opened node */ this.trigger('open_all', { "node" : this.get_node(original_obj) }); } }, /** * closes all nodes within a node (or the tree), revealing their children * @name close_all([obj, animation]) * @param {mixed} obj the node to close recursively, omit to close all nodes in the tree * @param {Number} animation the animation duration in milliseconds when closing the nodes, the default is no animation * @trigger close_all.jstree */ close_all : function (obj, animation) { if(!obj) { obj = $.jstree.root; } obj = this.get_node(obj); if(!obj) { return false; } var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), _this = this, i, j; if(dom.length) { dom = this.is_open(obj) ? dom.find('.jstree-open').addBack() : dom.find('.jstree-open'); $(dom.get().reverse()).each(function () { _this.close_node(this, animation || 0); }); } for(i = 0, j = obj.children_d.length; i < j; i++) { this._model.data[obj.children_d[i]].state.opened = false; } /** * triggered when an `close_all` call completes * @event * @name close_all.jstree * @param {Object} node the closed node */ this.trigger('close_all', { "node" : obj }); }, /** * checks if a node is disabled (not selectable) * @name is_disabled(obj) * @param {mixed} obj * @return {Boolean} */ is_disabled : function (obj) { obj = this.get_node(obj); return obj && obj.state && obj.state.disabled; }, /** * enables a node - so that it can be selected * @name enable_node(obj) * @param {mixed} obj the node to enable * @trigger enable_node.jstree */ enable_node : function (obj) { var t1, t2; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.enable_node(obj[t1]); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } obj.state.disabled = false; this.get_node(obj,true).children('.jstree-anchor').removeClass('jstree-disabled').attr('aria-disabled', false); /** * triggered when an node is enabled * @event * @name enable_node.jstree * @param {Object} node the enabled node */ this.trigger('enable_node', { 'node' : obj }); }, /** * disables a node - so that it can not be selected * @name disable_node(obj) * @param {mixed} obj the node to disable * @trigger disable_node.jstree */ disable_node : function (obj) { var t1, t2; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.disable_node(obj[t1]); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } obj.state.disabled = true; this.get_node(obj,true).children('.jstree-anchor').addClass('jstree-disabled').attr('aria-disabled', true); /** * triggered when an node is disabled * @event * @name disable_node.jstree * @param {Object} node the disabled node */ this.trigger('disable_node', { 'node' : obj }); }, /** * determines if a node is hidden * @name is_hidden(obj) * @param {mixed} obj the node */ is_hidden : function (obj) { obj = this.get_node(obj); return obj.state.hidden === true; }, /** * hides a node - it is still in the structure but will not be visible * @name hide_node(obj) * @param {mixed} obj the node to hide * @param {Boolean} skip_redraw internal parameter controlling if redraw is called * @trigger hide_node.jstree */ hide_node : function (obj, skip_redraw) { var t1, t2; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.hide_node(obj[t1], true); } if (!skip_redraw) { this.redraw(); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } if(!obj.state.hidden) { obj.state.hidden = true; this._node_changed(obj.parent); if(!skip_redraw) { this.redraw(); } /** * triggered when an node is hidden * @event * @name hide_node.jstree * @param {Object} node the hidden node */ this.trigger('hide_node', { 'node' : obj }); } }, /** * shows a node * @name show_node(obj) * @param {mixed} obj the node to show * @param {Boolean} skip_redraw internal parameter controlling if redraw is called * @trigger show_node.jstree */ show_node : function (obj, skip_redraw) { var t1, t2; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.show_node(obj[t1], true); } if (!skip_redraw) { this.redraw(); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } if(obj.state.hidden) { obj.state.hidden = false; this._node_changed(obj.parent); if(!skip_redraw) { this.redraw(); } /** * triggered when an node is shown * @event * @name show_node.jstree * @param {Object} node the shown node */ this.trigger('show_node', { 'node' : obj }); } }, /** * hides all nodes * @name hide_all() * @trigger hide_all.jstree */ hide_all : function (skip_redraw) { var i, m = this._model.data, ids = []; for(i in m) { if(m.hasOwnProperty(i) && i !== $.jstree.root && !m[i].state.hidden) { m[i].state.hidden = true; ids.push(i); } } this._model.force_full_redraw = true; if(!skip_redraw) { this.redraw(); } /** * triggered when all nodes are hidden * @event * @name hide_all.jstree * @param {Array} nodes the IDs of all hidden nodes */ this.trigger('hide_all', { 'nodes' : ids }); return ids; }, /** * shows all nodes * @name show_all() * @trigger show_all.jstree */ show_all : function (skip_redraw) { var i, m = this._model.data, ids = []; for(i in m) { if(m.hasOwnProperty(i) && i !== $.jstree.root && m[i].state.hidden) { m[i].state.hidden = false; ids.push(i); } } this._model.force_full_redraw = true; if(!skip_redraw) { this.redraw(); } /** * triggered when all nodes are shown * @event * @name show_all.jstree * @param {Array} nodes the IDs of all shown nodes */ this.trigger('show_all', { 'nodes' : ids }); return ids; }, /** * called when a node is selected by the user. Used internally. * @private * @name activate_node(obj, e) * @param {mixed} obj the node * @param {Object} e the related event * @trigger activate_node.jstree, changed.jstree */ activate_node : function (obj, e) { if(this.is_disabled(obj)) { return false; } if(!e || typeof e !== 'object') { e = {}; } // ensure last_clicked is still in the DOM, make it fresh (maybe it was moved?) and make sure it is still selected, if not - make last_clicked the last selected node this._data.core.last_clicked = this._data.core.last_clicked && this._data.core.last_clicked.id !== undefined ? this.get_node(this._data.core.last_clicked.id) : null; if(this._data.core.last_clicked && !this._data.core.last_clicked.state.selected) { this._data.core.last_clicked = null; } if(!this._data.core.last_clicked && this._data.core.selected.length) { this._data.core.last_clicked = this.get_node(this._data.core.selected[this._data.core.selected.length - 1]); } if(!this.settings.core.multiple || (!e.metaKey && !e.ctrlKey && !e.shiftKey) || (e.shiftKey && (!this._data.core.last_clicked || !this.get_parent(obj) || this.get_parent(obj) !== this._data.core.last_clicked.parent ) )) { if(!this.settings.core.multiple && (e.metaKey || e.ctrlKey || e.shiftKey) && this.is_selected(obj)) { this.deselect_node(obj, false, e); } else { this.deselect_all(true); this.select_node(obj, false, false, e); this._data.core.last_clicked = this.get_node(obj); } } else { if(e.shiftKey) { var o = this.get_node(obj).id, l = this._data.core.last_clicked.id, p = this.get_node(this._data.core.last_clicked.parent).children, c = false, i, j; for(i = 0, j = p.length; i < j; i += 1) { // separate IFs work whem o and l are the same if(p[i] === o) { c = !c; } if(p[i] === l) { c = !c; } if(!this.is_disabled(p[i]) && (c || p[i] === o || p[i] === l)) { if (!this.is_hidden(p[i])) { this.select_node(p[i], true, false, e); } } else { this.deselect_node(p[i], true, e); } } this.trigger('changed', { 'action' : 'select_node', 'node' : this.get_node(obj), 'selected' : this._data.core.selected, 'event' : e }); } else { if(!this.is_selected(obj)) { this.select_node(obj, false, false, e); } else { this.deselect_node(obj, false, e); } } } /** * triggered when an node is clicked or intercated with by the user * @event * @name activate_node.jstree * @param {Object} node * @param {Object} event the ooriginal event (if any) which triggered the call (may be an empty object) */ this.trigger('activate_node', { 'node' : this.get_node(obj), 'event' : e }); }, /** * applies the hover state on a node, called when a node is hovered by the user. Used internally. * @private * @name hover_node(obj) * @param {mixed} obj * @trigger hover_node.jstree */ hover_node : function (obj) { obj = this.get_node(obj, true); if(!obj || !obj.length || obj.children('.jstree-hovered').length) { return false; } var o = this.element.find('.jstree-hovered'), t = this.element; if(o && o.length) { this.dehover_node(o); } obj.children('.jstree-anchor').addClass('jstree-hovered'); /** * triggered when an node is hovered * @event * @name hover_node.jstree * @param {Object} node */ this.trigger('hover_node', { 'node' : this.get_node(obj) }); setTimeout(function () { t.attr('aria-activedescendant', obj[0].id); }, 0); }, /** * removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally. * @private * @name dehover_node(obj) * @param {mixed} obj * @trigger dehover_node.jstree */ dehover_node : function (obj) { obj = this.get_node(obj, true); if(!obj || !obj.length || !obj.children('.jstree-hovered').length) { return false; } obj.children('.jstree-anchor').removeClass('jstree-hovered'); /** * triggered when an node is no longer hovered * @event * @name dehover_node.jstree * @param {Object} node */ this.trigger('dehover_node', { 'node' : this.get_node(obj) }); }, /** * select a node * @name select_node(obj [, supress_event, prevent_open]) * @param {mixed} obj an array can be used to select multiple nodes * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered * @param {Boolean} prevent_open if set to `true` parents of the selected node won't be opened * @trigger select_node.jstree, changed.jstree */ select_node : function (obj, supress_event, prevent_open, e) { var dom, t1, t2, th; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.select_node(obj[t1], supress_event, prevent_open, e); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } dom = this.get_node(obj, true); if(!obj.state.selected) { obj.state.selected = true; this._data.core.selected.push(obj.id); if(!prevent_open) { dom = this._open_to(obj); } if(dom && dom.length) { dom.attr('aria-selected', true).children('.jstree-anchor').addClass('jstree-clicked'); } /** * triggered when an node is selected * @event * @name select_node.jstree * @param {Object} node * @param {Array} selected the current selection * @param {Object} event the event (if any) that triggered this select_node */ this.trigger('select_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); if(!supress_event) { /** * triggered when selection changes * @event * @name changed.jstree * @param {Object} node * @param {Object} action the action that caused the selection to change * @param {Array} selected the current selection * @param {Object} event the event (if any) that triggered this changed event */ this.trigger('changed', { 'action' : 'select_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); } } }, /** * deselect a node * @name deselect_node(obj [, supress_event]) * @param {mixed} obj an array can be used to deselect multiple nodes * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered * @trigger deselect_node.jstree, changed.jstree */ deselect_node : function (obj, supress_event, e) { var t1, t2, dom; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.deselect_node(obj[t1], supress_event, e); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } dom = this.get_node(obj, true); if(obj.state.selected) { obj.state.selected = false; this._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, obj.id); if(dom.length) { dom.attr('aria-selected', false).children('.jstree-anchor').removeClass('jstree-clicked'); } /** * triggered when an node is deselected * @event * @name deselect_node.jstree * @param {Object} node * @param {Array} selected the current selection * @param {Object} event the event (if any) that triggered this deselect_node */ this.trigger('deselect_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); if(!supress_event) { this.trigger('changed', { 'action' : 'deselect_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); } } }, /** * select all nodes in the tree * @name select_all([supress_event]) * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered * @trigger select_all.jstree, changed.jstree */ select_all : function (supress_event) { var tmp = this._data.core.selected.concat([]), i, j; this._data.core.selected = this._model.data[$.jstree.root].children_d.concat(); for(i = 0, j = this._data.core.selected.length; i < j; i++) { if(this._model.data[this._data.core.selected[i]]) { this._model.data[this._data.core.selected[i]].state.selected = true; } } this.redraw(true); /** * triggered when all nodes are selected * @event * @name select_all.jstree * @param {Array} selected the current selection */ this.trigger('select_all', { 'selected' : this._data.core.selected }); if(!supress_event) { this.trigger('changed', { 'action' : 'select_all', 'selected' : this._data.core.selected, 'old_selection' : tmp }); } }, /** * deselect all selected nodes * @name deselect_all([supress_event]) * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered * @trigger deselect_all.jstree, changed.jstree */ deselect_all : function (supress_event) { var tmp = this._data.core.selected.concat([]), i, j; for(i = 0, j = this._data.core.selected.length; i < j; i++) { if(this._model.data[this._data.core.selected[i]]) { this._model.data[this._data.core.selected[i]].state.selected = false; } } this._data.core.selected = []; this.element.find('.jstree-clicked').removeClass('jstree-clicked').parent().attr('aria-selected', false); /** * triggered when all nodes are deselected * @event * @name deselect_all.jstree * @param {Object} node the previous selection * @param {Array} selected the current selection */ this.trigger('deselect_all', { 'selected' : this._data.core.selected, 'node' : tmp }); if(!supress_event) { this.trigger('changed', { 'action' : 'deselect_all', 'selected' : this._data.core.selected, 'old_selection' : tmp }); } }, /** * checks if a node is selected * @name is_selected(obj) * @param {mixed} obj * @return {Boolean} */ is_selected : function (obj) { obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } return obj.state.selected; }, /** * get an array of all selected nodes * @name get_selected([full]) * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned * @return {Array} */ get_selected : function (full) { return full ? $.map(this._data.core.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.core.selected.slice(); }, /** * get an array of all top level selected nodes (ignoring children of selected nodes) * @name get_top_selected([full]) * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned * @return {Array} */ get_top_selected : function (full) { var tmp = this.get_selected(true), obj = {}, i, j, k, l; for(i = 0, j = tmp.length; i < j; i++) { obj[tmp[i].id] = tmp[i]; } for(i = 0, j = tmp.length; i < j; i++) { for(k = 0, l = tmp[i].children_d.length; k < l; k++) { if(obj[tmp[i].children_d[k]]) { delete obj[tmp[i].children_d[k]]; } } } tmp = []; for(i in obj) { if(obj.hasOwnProperty(i)) { tmp.push(i); } } return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp; }, /** * get an array of all bottom level selected nodes (ignoring selected parents) * @name get_bottom_selected([full]) * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned * @return {Array} */ get_bottom_selected : function (full) { var tmp = this.get_selected(true), obj = [], i, j; for(i = 0, j = tmp.length; i < j; i++) { if(!tmp[i].children.length) { obj.push(tmp[i].id); } } return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj; }, /** * gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally. * @name get_state() * @private * @return {Object} */ get_state : function () { var state = { 'core' : { 'open' : [], 'loaded' : [], 'scroll' : { 'left' : this.element.scrollLeft(), 'top' : this.element.scrollTop() }, /*! 'themes' : { 'name' : this.get_theme(), 'icons' : this._data.core.themes.icons, 'dots' : this._data.core.themes.dots }, */ 'selected' : [] } }, i; for(i in this._model.data) { if(this._model.data.hasOwnProperty(i)) { if(i !== $.jstree.root) { if(this._model.data[i].state.loaded && this.settings.core.loaded_state) { state.core.loaded.push(i); } if(this._model.data[i].state.opened) { state.core.open.push(i); } if(this._model.data[i].state.selected) { state.core.selected.push(i); } } } } return state; }, /** * sets the state of the tree. Used internally. * @name set_state(state [, callback]) * @private * @param {Object} state the state to restore. Keep in mind this object is passed by reference and jstree will modify it. * @param {Function} callback an optional function to execute once the state is restored. * @trigger set_state.jstree */ set_state : function (state, callback) { if(state) { if(state.core && state.core.selected && state.core.initial_selection === undefined) { state.core.initial_selection = this._data.core.selected.concat([]).sort().join(','); } if(state.core) { var res, n, t, _this, i; if(state.core.loaded) { if(!this.settings.core.loaded_state || !$.isArray(state.core.loaded) || !state.core.loaded.length) { delete state.core.loaded; this.set_state(state, callback); } else { this._load_nodes(state.core.loaded, function (nodes) { delete state.core.loaded; this.set_state(state, callback); }); } return false; } if(state.core.open) { if(!$.isArray(state.core.open) || !state.core.open.length) { delete state.core.open; this.set_state(state, callback); } else { this._load_nodes(state.core.open, function (nodes) { this.open_node(nodes, false, 0); delete state.core.open; this.set_state(state, callback); }); } return false; } if(state.core.scroll) { if(state.core.scroll && state.core.scroll.left !== undefined) { this.element.scrollLeft(state.core.scroll.left); } if(state.core.scroll && state.core.scroll.top !== undefined) { this.element.scrollTop(state.core.scroll.top); } delete state.core.scroll; this.set_state(state, callback); return false; } if(state.core.selected) { _this = this; if (state.core.initial_selection === undefined || state.core.initial_selection === this._data.core.selected.concat([]).sort().join(',') ) { this.deselect_all(); $.each(state.core.selected, function (i, v) { _this.select_node(v, false, true); }); } delete state.core.initial_selection; delete state.core.selected; this.set_state(state, callback); return false; } for(i in state) { if(state.hasOwnProperty(i) && i !== "core" && $.inArray(i, this.settings.plugins) === -1) { delete state[i]; } } if($.isEmptyObject(state.core)) { delete state.core; this.set_state(state, callback); return false; } } if($.isEmptyObject(state)) { state = null; if(callback) { callback.call(this); } /** * triggered when a `set_state` call completes * @event * @name set_state.jstree */ this.trigger('set_state'); return false; } return true; } return false; }, /** * refreshes the tree - all nodes are reloaded with calls to `load_node`. * @name refresh() * @param {Boolean} skip_loading an option to skip showing the loading indicator * @param {Mixed} forget_state if set to `true` state will not be reapplied, if set to a function (receiving the current state as argument) the result of that function will be used as state * @trigger refresh.jstree */ refresh : function (skip_loading, forget_state) { this._data.core.state = forget_state === true ? {} : this.get_state(); if(forget_state && $.isFunction(forget_state)) { this._data.core.state = forget_state.call(this, this._data.core.state); } this._cnt = 0; this._model.data = {}; this._model.data[$.jstree.root] = { id : $.jstree.root, parent : null, parents : [], children : [], children_d : [], state : { loaded : false } }; this._data.core.selected = []; this._data.core.last_clicked = null; this._data.core.focused = null; var c = this.get_container_ul()[0].className; if(!skip_loading) { this.element.html("<"+"ul class='"+c+"' role='group'><"+"li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'></i><"+"a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>" + this.get_string("Loading ...") + "</a></li></ul>"); this.element.attr('aria-activedescendant','j'+this._id+'_loading'); } this.load_node($.jstree.root, function (o, s) { if(s) { this.get_container_ul()[0].className = c; if(this._firstChild(this.get_container_ul()[0])) { this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id); } this.set_state($.extend(true, {}, this._data.core.state), function () { /** * triggered when a `refresh` call completes * @event * @name refresh.jstree */ this.trigger('refresh'); }); } this._data.core.state = null; }); }, /** * refreshes a node in the tree (reload its children) all opened nodes inside that node are reloaded with calls to `load_node`. * @name refresh_node(obj) * @param {mixed} obj the node * @trigger refresh_node.jstree */ refresh_node : function (obj) { obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } var opened = [], to_load = [], s = this._data.core.selected.concat([]); to_load.push(obj.id); if(obj.state.opened === true) { opened.push(obj.id); } this.get_node(obj, true).find('.jstree-open').each(function() { to_load.push(this.id); opened.push(this.id); }); this._load_nodes(to_load, $.proxy(function (nodes) { this.open_node(opened, false, 0); this.select_node(s); /** * triggered when a node is refreshed * @event * @name refresh_node.jstree * @param {Object} node - the refreshed node * @param {Array} nodes - an array of the IDs of the nodes that were reloaded */ this.trigger('refresh_node', { 'node' : obj, 'nodes' : nodes }); }, this), false, true); }, /** * set (change) the ID of a node * @name set_id(obj, id) * @param {mixed} obj the node * @param {String} id the new ID * @return {Boolean} * @trigger set_id.jstree */ set_id : function (obj, id) { obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } var i, j, m = this._model.data, old = obj.id; id = id.toString(); // update parents (replace current ID with new one in children and children_d) m[obj.parent].children[$.inArray(obj.id, m[obj.parent].children)] = id; for(i = 0, j = obj.parents.length; i < j; i++) { m[obj.parents[i]].children_d[$.inArray(obj.id, m[obj.parents[i]].children_d)] = id; } // update children (replace current ID with new one in parent and parents) for(i = 0, j = obj.children.length; i < j; i++) { m[obj.children[i]].parent = id; } for(i = 0, j = obj.children_d.length; i < j; i++) { m[obj.children_d[i]].parents[$.inArray(obj.id, m[obj.children_d[i]].parents)] = id; } i = $.inArray(obj.id, this._data.core.selected); if(i !== -1) { this._data.core.selected[i] = id; } // update model and obj itself (obj.id, this._model.data[KEY]) i = this.get_node(obj.id, true); if(i) { i.attr('id', id); //.children('.jstree-anchor').attr('id', id + '_anchor').end().attr('aria-labelledby', id + '_anchor'); if(this.element.attr('aria-activedescendant') === obj.id) { this.element.attr('aria-activedescendant', id); } } delete m[obj.id]; obj.id = id; obj.li_attr.id = id; m[id] = obj; /** * triggered when a node id value is changed * @event * @name set_id.jstree * @param {Object} node * @param {String} old the old id */ this.trigger('set_id',{ "node" : obj, "new" : obj.id, "old" : old }); return true; }, /** * get the text value of a node * @name get_text(obj) * @param {mixed} obj the node * @return {String} */ get_text : function (obj) { obj = this.get_node(obj); return (!obj || obj.id === $.jstree.root) ? false : obj.text; }, /** * set the text value of a node. Used internally, please use `rename_node(obj, val)`. * @private * @name set_text(obj, val) * @param {mixed} obj the node, you can pass an array to set the text on multiple nodes * @param {String} val the new text value * @return {Boolean} * @trigger set_text.jstree */ set_text : function (obj, val) { var t1, t2; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.set_text(obj[t1], val); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } obj.text = val; if(this.get_node(obj, true).length) { this.redraw_node(obj.id); } /** * triggered when a node text value is changed * @event * @name set_text.jstree * @param {Object} obj * @param {String} text the new value */ this.trigger('set_text',{ "obj" : obj, "text" : val }); return true; }, /** * gets a JSON representation of a node (or the whole tree) * @name get_json([obj, options]) * @param {mixed} obj * @param {Object} options * @param {Boolean} options.no_state do not return state information * @param {Boolean} options.no_id do not return ID * @param {Boolean} options.no_children do not include children * @param {Boolean} options.no_data do not include node data * @param {Boolean} options.no_li_attr do not include LI attributes * @param {Boolean} options.no_a_attr do not include A attributes * @param {Boolean} options.flat return flat JSON instead of nested * @return {Object} */ get_json : function (obj, options, flat) { obj = this.get_node(obj || $.jstree.root); if(!obj) { return false; } if(options && options.flat && !flat) { flat = []; } var tmp = { 'id' : obj.id, 'text' : obj.text, 'icon' : this.get_icon(obj), 'li_attr' : $.extend(true, {}, obj.li_attr), 'a_attr' : $.extend(true, {}, obj.a_attr), 'state' : {}, 'data' : options && options.no_data ? false : $.extend(true, $.isArray(obj.data)?[]:{}, obj.data) //( this.get_node(obj, true).length ? this.get_node(obj, true).data() : obj.data ), }, i, j; if(options && options.flat) { tmp.parent = obj.parent; } else { tmp.children = []; } if(!options || !options.no_state) { for(i in obj.state) { if(obj.state.hasOwnProperty(i)) { tmp.state[i] = obj.state[i]; } } } else { delete tmp.state; } if(options && options.no_li_attr) { delete tmp.li_attr; } if(options && options.no_a_attr) { delete tmp.a_attr; } if(options && options.no_id) { delete tmp.id; if(tmp.li_attr && tmp.li_attr.id) { delete tmp.li_attr.id; } if(tmp.a_attr && tmp.a_attr.id) { delete tmp.a_attr.id; } } if(options && options.flat && obj.id !== $.jstree.root) { flat.push(tmp); } if(!options || !options.no_children) { for(i = 0, j = obj.children.length; i < j; i++) { if(options && options.flat) { this.get_json(obj.children[i], options, flat); } else { tmp.children.push(this.get_json(obj.children[i], options)); } } } return options && options.flat ? flat : (obj.id === $.jstree.root ? tmp.children : tmp); }, /** * create a new node (do not confuse with load_node) * @name create_node([par, node, pos, callback, is_loaded]) * @param {mixed} par the parent node (to create a root node use either "#" (string) or `null`) * @param {mixed} node the data for the new node (a valid JSON object, or a simple string with the name) * @param {mixed} pos the index at which to insert the node, "first" and "last" are also supported, default is "last" * @param {Function} callback a function to be called once the node is created * @param {Boolean} is_loaded internal argument indicating if the parent node was succesfully loaded * @return {String} the ID of the newly create node * @trigger model.jstree, create_node.jstree */ create_node : function (par, node, pos, callback, is_loaded) { if(par === null) { par = $.jstree.root; } par = this.get_node(par); if(!par) { return false; } pos = pos === undefined ? "last" : pos; if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { return this.load_node(par, function () { this.create_node(par, node, pos, callback, true); }); } if(!node) { node = { "text" : this.get_string('New node') }; } if(typeof node === "string") { node = { "text" : node }; } else { node = $.extend(true, {}, node); } if(node.text === undefined) { node.text = this.get_string('New node'); } var tmp, dpc, i, j; if(par.id === $.jstree.root) { if(pos === "before") { pos = "first"; } if(pos === "after") { pos = "last"; } } switch(pos) { case "before": tmp = this.get_node(par.parent); pos = $.inArray(par.id, tmp.children); par = tmp; break; case "after" : tmp = this.get_node(par.parent); pos = $.inArray(par.id, tmp.children) + 1; par = tmp; break; case "inside": case "first": pos = 0; break; case "last": pos = par.children.length; break; default: if(!pos) { pos = 0; } break; } if(pos > par.children.length) { pos = par.children.length; } if(!node.id) { node.id = true; } if(!this.check("create_node", node, par, pos)) { this.settings.core.error.call(this, this._data.core.last_error); return false; } if(node.id === true) { delete node.id; } node = this._parse_model_from_json(node, par.id, par.parents.concat()); if(!node) { return false; } tmp = this.get_node(node); dpc = []; dpc.push(node); dpc = dpc.concat(tmp.children_d); this.trigger('model', { "nodes" : dpc, "parent" : par.id }); par.children_d = par.children_d.concat(dpc); for(i = 0, j = par.parents.length; i < j; i++) { this._model.data[par.parents[i]].children_d = this._model.data[par.parents[i]].children_d.concat(dpc); } node = tmp; tmp = []; for(i = 0, j = par.children.length; i < j; i++) { tmp[i >= pos ? i+1 : i] = par.children[i]; } tmp[pos] = node.id; par.children = tmp; this.redraw_node(par, true); /** * triggered when a node is created * @event * @name create_node.jstree * @param {Object} node * @param {String} parent the parent's ID * @param {Number} position the position of the new node among the parent's children */ this.trigger('create_node', { "node" : this.get_node(node), "parent" : par.id, "position" : pos }); if(callback) { callback.call(this, this.get_node(node)); } return node.id; }, /** * set the text value of a node * @name rename_node(obj, val) * @param {mixed} obj the node, you can pass an array to rename multiple nodes to the same name * @param {String} val the new text value * @return {Boolean} * @trigger rename_node.jstree */ rename_node : function (obj, val) { var t1, t2, old; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.rename_node(obj[t1], val); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } old = obj.text; if(!this.check("rename_node", obj, this.get_parent(obj), val)) { this.settings.core.error.call(this, this._data.core.last_error); return false; } this.set_text(obj, val); // .apply(this, Array.prototype.slice.call(arguments)) /** * triggered when a node is renamed * @event * @name rename_node.jstree * @param {Object} node * @param {String} text the new value * @param {String} old the old value */ this.trigger('rename_node', { "node" : obj, "text" : val, "old" : old }); return true; }, /** * remove a node * @name delete_node(obj) * @param {mixed} obj the node, you can pass an array to delete multiple nodes * @return {Boolean} * @trigger delete_node.jstree, changed.jstree */ delete_node : function (obj) { var t1, t2, par, pos, tmp, i, j, k, l, c, top, lft; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.delete_node(obj[t1]); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } par = this.get_node(obj.parent); pos = $.inArray(obj.id, par.children); c = false; if(!this.check("delete_node", obj, par, pos)) { this.settings.core.error.call(this, this._data.core.last_error); return false; } if(pos !== -1) { par.children = $.vakata.array_remove(par.children, pos); } tmp = obj.children_d.concat([]); tmp.push(obj.id); for(i = 0, j = obj.parents.length; i < j; i++) { this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) { return $.inArray(v, tmp) === -1; }); } for(k = 0, l = tmp.length; k < l; k++) { if(this._model.data[tmp[k]].state.selected) { c = true; break; } } if (c) { this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) { return $.inArray(v, tmp) === -1; }); } /** * triggered when a node is deleted * @event * @name delete_node.jstree * @param {Object} node * @param {String} parent the parent's ID */ this.trigger('delete_node', { "node" : obj, "parent" : par.id }); if(c) { this.trigger('changed', { 'action' : 'delete_node', 'node' : obj, 'selected' : this._data.core.selected, 'parent' : par.id }); } for(k = 0, l = tmp.length; k < l; k++) { delete this._model.data[tmp[k]]; } if($.inArray(this._data.core.focused, tmp) !== -1) { this._data.core.focused = null; top = this.element[0].scrollTop; lft = this.element[0].scrollLeft; if(par.id === $.jstree.root) { if (this._model.data[$.jstree.root].children[0]) { this.get_node(this._model.data[$.jstree.root].children[0], true).children('.jstree-anchor').focus(); } } else { this.get_node(par, true).children('.jstree-anchor').focus(); } this.element[0].scrollTop = top; this.element[0].scrollLeft = lft; } this.redraw_node(par, true); return true; }, /** * check if an operation is premitted on the tree. Used internally. * @private * @name check(chk, obj, par, pos) * @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node" * @param {mixed} obj the node * @param {mixed} par the parent * @param {mixed} pos the position to insert at, or if "rename_node" - the new name * @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node * @return {Boolean} */ check : function (chk, obj, par, pos, more) { obj = obj && obj.id ? obj : this.get_node(obj); par = par && par.id ? par : this.get_node(par); var tmp = chk.match(/^move_node|copy_node|create_node$/i) ? par : obj, chc = this.settings.core.check_callback; if(chk === "move_node" || chk === "copy_node") { if((!more || !more.is_multi) && (obj.id === par.id || (chk === "move_node" && $.inArray(obj.id, par.children) === pos) || $.inArray(par.id, obj.children_d) !== -1)) { this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_01', 'reason' : 'Moving parent inside child', 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; return false; } } if(tmp && tmp.data) { tmp = tmp.data; } if(tmp && tmp.functions && (tmp.functions[chk] === false || tmp.functions[chk] === true)) { if(tmp.functions[chk] === false) { this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_02', 'reason' : 'Node data prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; } return tmp.functions[chk]; } if(chc === false || ($.isFunction(chc) && chc.call(this, chk, obj, par, pos, more) === false) || (chc && chc[chk] === false)) { this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_03', 'reason' : 'User config for core.check_callback prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; return false; } return true; }, /** * get the last error * @name last_error() * @return {Object} */ last_error : function () { return this._data.core.last_error; }, /** * move a node to a new parent * @name move_node(obj, par [, pos, callback, is_loaded]) * @param {mixed} obj the node to move, pass an array to move multiple nodes * @param {mixed} par the new parent * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn * @param {Boolean} instance internal parameter indicating if the node comes from another instance * @trigger move_node.jstree */ move_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { var t1, t2, old_par, old_pos, new_par, old_ins, is_multi, dpc, tmp, i, j, k, l, p; par = this.get_node(par); pos = pos === undefined ? 0 : pos; if(!par) { return false; } if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { return this.load_node(par, function () { this.move_node(obj, par, pos, callback, true, false, origin); }); } if($.isArray(obj)) { if(obj.length === 1) { obj = obj[0]; } else { //obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { if((tmp = this.move_node(obj[t1], par, pos, callback, is_loaded, false, origin))) { par = tmp; pos = "after"; } } this.redraw(); return true; } } obj = obj && obj.id ? obj : this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } old_par = (obj.parent || $.jstree.root).toString(); new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent); old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id)); is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id); old_pos = old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1; if(old_ins && old_ins._id) { obj = old_ins._model.data[obj.id]; } if(is_multi) { if((tmp = this.copy_node(obj, par, pos, callback, is_loaded, false, origin))) { if(old_ins) { old_ins.delete_node(obj); } return tmp; } return false; } //var m = this._model.data; if(par.id === $.jstree.root) { if(pos === "before") { pos = "first"; } if(pos === "after") { pos = "last"; } } switch(pos) { case "before": pos = $.inArray(par.id, new_par.children); break; case "after" : pos = $.inArray(par.id, new_par.children) + 1; break; case "inside": case "first": pos = 0; break; case "last": pos = new_par.children.length; break; default: if(!pos) { pos = 0; } break; } if(pos > new_par.children.length) { pos = new_par.children.length; } if(!this.check("move_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) { this.settings.core.error.call(this, this._data.core.last_error); return false; } if(obj.parent === new_par.id) { dpc = new_par.children.concat(); tmp = $.inArray(obj.id, dpc); if(tmp !== -1) { dpc = $.vakata.array_remove(dpc, tmp); if(pos > tmp) { pos--; } } tmp = []; for(i = 0, j = dpc.length; i < j; i++) { tmp[i >= pos ? i+1 : i] = dpc[i]; } tmp[pos] = obj.id; new_par.children = tmp; this._node_changed(new_par.id); this.redraw(new_par.id === $.jstree.root); } else { // clean old parent and up tmp = obj.children_d.concat(); tmp.push(obj.id); for(i = 0, j = obj.parents.length; i < j; i++) { dpc = []; p = old_ins._model.data[obj.parents[i]].children_d; for(k = 0, l = p.length; k < l; k++) { if($.inArray(p[k], tmp) === -1) { dpc.push(p[k]); } } old_ins._model.data[obj.parents[i]].children_d = dpc; } old_ins._model.data[old_par].children = $.vakata.array_remove_item(old_ins._model.data[old_par].children, obj.id); // insert into new parent and up for(i = 0, j = new_par.parents.length; i < j; i++) { this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(tmp); } dpc = []; for(i = 0, j = new_par.children.length; i < j; i++) { dpc[i >= pos ? i+1 : i] = new_par.children[i]; } dpc[pos] = obj.id; new_par.children = dpc; new_par.children_d.push(obj.id); new_par.children_d = new_par.children_d.concat(obj.children_d); // update object obj.parent = new_par.id; tmp = new_par.parents.concat(); tmp.unshift(new_par.id); p = obj.parents.length; obj.parents = tmp; // update object children tmp = tmp.concat(); for(i = 0, j = obj.children_d.length; i < j; i++) { this._model.data[obj.children_d[i]].parents = this._model.data[obj.children_d[i]].parents.slice(0,p*-1); Array.prototype.push.apply(this._model.data[obj.children_d[i]].parents, tmp); } if(old_par === $.jstree.root || new_par.id === $.jstree.root) { this._model.force_full_redraw = true; } if(!this._model.force_full_redraw) { this._node_changed(old_par); this._node_changed(new_par.id); } if(!skip_redraw) { this.redraw(); } } if(callback) { callback.call(this, obj, new_par, pos); } /** * triggered when a node is moved * @event * @name move_node.jstree * @param {Object} node * @param {String} parent the parent's ID * @param {Number} position the position of the node among the parent's children * @param {String} old_parent the old parent of the node * @param {Number} old_position the old position of the node * @param {Boolean} is_multi do the node and new parent belong to different instances * @param {jsTree} old_instance the instance the node came from * @param {jsTree} new_instance the instance of the new parent */ this.trigger('move_node', { "node" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_pos, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this }); return obj.id; }, /** * copy a node to a new parent * @name copy_node(obj, par [, pos, callback, is_loaded]) * @param {mixed} obj the node to copy, pass an array to copy multiple nodes * @param {mixed} par the new parent * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn * @param {Boolean} instance internal parameter indicating if the node comes from another instance * @trigger model.jstree copy_node.jstree */ copy_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { var t1, t2, dpc, tmp, i, j, node, old_par, new_par, old_ins, is_multi; par = this.get_node(par); pos = pos === undefined ? 0 : pos; if(!par) { return false; } if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { return this.load_node(par, function () { this.copy_node(obj, par, pos, callback, true, false, origin); }); } if($.isArray(obj)) { if(obj.length === 1) { obj = obj[0]; } else { //obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { if((tmp = this.copy_node(obj[t1], par, pos, callback, is_loaded, true, origin))) { par = tmp; pos = "after"; } } this.redraw(); return true; } } obj = obj && obj.id ? obj : this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } old_par = (obj.parent || $.jstree.root).toString(); new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent); old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id)); is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id); if(old_ins && old_ins._id) { obj = old_ins._model.data[obj.id]; } if(par.id === $.jstree.root) { if(pos === "before") { pos = "first"; } if(pos === "after") { pos = "last"; } } switch(pos) { case "before": pos = $.inArray(par.id, new_par.children); break; case "after" : pos = $.inArray(par.id, new_par.children) + 1; break; case "inside": case "first": pos = 0; break; case "last": pos = new_par.children.length; break; default: if(!pos) { pos = 0; } break; } if(pos > new_par.children.length) { pos = new_par.children.length; } if(!this.check("copy_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) { this.settings.core.error.call(this, this._data.core.last_error); return false; } node = old_ins ? old_ins.get_json(obj, { no_id : true, no_data : true, no_state : true }) : obj; if(!node) { return false; } if(node.id === true) { delete node.id; } node = this._parse_model_from_json(node, new_par.id, new_par.parents.concat()); if(!node) { return false; } tmp = this.get_node(node); if(obj && obj.state && obj.state.loaded === false) { tmp.state.loaded = false; } dpc = []; dpc.push(node); dpc = dpc.concat(tmp.children_d); this.trigger('model', { "nodes" : dpc, "parent" : new_par.id }); // insert into new parent and up for(i = 0, j = new_par.parents.length; i < j; i++) { this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(dpc); } dpc = []; for(i = 0, j = new_par.children.length; i < j; i++) { dpc[i >= pos ? i+1 : i] = new_par.children[i]; } dpc[pos] = tmp.id; new_par.children = dpc; new_par.children_d.push(tmp.id); new_par.children_d = new_par.children_d.concat(tmp.children_d); if(new_par.id === $.jstree.root) { this._model.force_full_redraw = true; } if(!this._model.force_full_redraw) { this._node_changed(new_par.id); } if(!skip_redraw) { this.redraw(new_par.id === $.jstree.root); } if(callback) { callback.call(this, tmp, new_par, pos); } /** * triggered when a node is copied * @event * @name copy_node.jstree * @param {Object} node the copied node * @param {Object} original the original node * @param {String} parent the parent's ID * @param {Number} position the position of the node among the parent's children * @param {String} old_parent the old parent of the node * @param {Number} old_position the position of the original node * @param {Boolean} is_multi do the node and new parent belong to different instances * @param {jsTree} old_instance the instance the node came from * @param {jsTree} new_instance the instance of the new parent */ this.trigger('copy_node', { "node" : tmp, "original" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1,'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this }); return tmp.id; }, /** * cut a node (a later call to `paste(obj)` would move the node) * @name cut(obj) * @param {mixed} obj multiple objects can be passed using an array * @trigger cut.jstree */ cut : function (obj) { if(!obj) { obj = this._data.core.selected.concat(); } if(!$.isArray(obj)) { obj = [obj]; } if(!obj.length) { return false; } var tmp = [], o, t1, t2; for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { o = this.get_node(obj[t1]); if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); } } if(!tmp.length) { return false; } ccp_node = tmp; ccp_inst = this; ccp_mode = 'move_node'; /** * triggered when nodes are added to the buffer for moving * @event * @name cut.jstree * @param {Array} node */ this.trigger('cut', { "node" : obj }); }, /** * copy a node (a later call to `paste(obj)` would copy the node) * @name copy(obj) * @param {mixed} obj multiple objects can be passed using an array * @trigger copy.jstree */ copy : function (obj) { if(!obj) { obj = this._data.core.selected.concat(); } if(!$.isArray(obj)) { obj = [obj]; } if(!obj.length) { return false; } var tmp = [], o, t1, t2; for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { o = this.get_node(obj[t1]); if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); } } if(!tmp.length) { return false; } ccp_node = tmp; ccp_inst = this; ccp_mode = 'copy_node'; /** * triggered when nodes are added to the buffer for copying * @event * @name copy.jstree * @param {Array} node */ this.trigger('copy', { "node" : obj }); }, /** * get the current buffer (any nodes that are waiting for a paste operation) * @name get_buffer() * @return {Object} an object consisting of `mode` ("copy_node" or "move_node"), `node` (an array of objects) and `inst` (the instance) */ get_buffer : function () { return { 'mode' : ccp_mode, 'node' : ccp_node, 'inst' : ccp_inst }; }, /** * check if there is something in the buffer to paste * @name can_paste() * @return {Boolean} */ can_paste : function () { return ccp_mode !== false && ccp_node !== false; // && ccp_inst._model.data[ccp_node]; }, /** * copy or move the previously cut or copied nodes to a new parent * @name paste(obj [, pos]) * @param {mixed} obj the new parent * @param {mixed} pos the position to insert at (besides integer, "first" and "last" are supported), defaults to integer `0` * @trigger paste.jstree */ paste : function (obj, pos) { obj = this.get_node(obj); if(!obj || !ccp_mode || !ccp_mode.match(/^(copy_node|move_node)$/) || !ccp_node) { return false; } if(this[ccp_mode](ccp_node, obj, pos, false, false, false, ccp_inst)) { /** * triggered when paste is invoked * @event * @name paste.jstree * @param {String} parent the ID of the receiving node * @param {Array} node the nodes in the buffer * @param {String} mode the performed operation - "copy_node" or "move_node" */ this.trigger('paste', { "parent" : obj.id, "node" : ccp_node, "mode" : ccp_mode }); } ccp_node = false; ccp_mode = false; ccp_inst = false; }, /** * clear the buffer of previously copied or cut nodes * @name clear_buffer() * @trigger clear_buffer.jstree */ clear_buffer : function () { ccp_node = false; ccp_mode = false; ccp_inst = false; /** * triggered when the copy / cut buffer is cleared * @event * @name clear_buffer.jstree */ this.trigger('clear_buffer'); }, /** * put a node in edit mode (input field to rename the node) * @name edit(obj [, default_text, callback]) * @param {mixed} obj * @param {String} default_text the text to populate the input with (if omitted or set to a non-string value the node's text value is used) * @param {Function} callback a function to be called once the text box is blurred, it is called in the instance's scope and receives the node, a status parameter (true if the rename is successful, false otherwise) and a boolean indicating if the user cancelled the edit. You can access the node's title using .text */ edit : function (obj, default_text, callback) { var rtl, w, a, s, t, h1, h2, fn, tmp, cancel = false; obj = this.get_node(obj); if(!obj) { return false; } if(!this.check("edit", obj, this.get_parent(obj))) { this.settings.core.error.call(this, this._data.core.last_error); return false; } tmp = obj; default_text = typeof default_text === 'string' ? default_text : obj.text; this.set_text(obj, ""); obj = this._open_to(obj); tmp.text = default_text; rtl = this._data.core.rtl; w = this.element.width(); this._data.core.focused = tmp.id; a = obj.children('.jstree-anchor').focus(); s = $('<span>'); /*! oi = obj.children("i:visible"), ai = a.children("i:visible"), w1 = oi.width() * oi.length, w2 = ai.width() * ai.length, */ t = default_text; h1 = $("<"+"div />", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo(document.body); h2 = $("<"+"input />", { "value" : t, "class" : "jstree-rename-input", // "size" : t.length, "css" : { "padding" : "0", "border" : "1px solid silver", "box-sizing" : "border-box", "display" : "inline-block", "height" : (this._data.core.li_height) + "px", "lineHeight" : (this._data.core.li_height) + "px", "width" : "150px" // will be set a bit further down }, "blur" : $.proxy(function (e) { e.stopImmediatePropagation(); e.preventDefault(); var i = s.children(".jstree-rename-input"), v = i.val(), f = this.settings.core.force_text, nv; if(v === "") { v = t; } h1.remove(); s.replaceWith(a); s.remove(); t = f ? t : $('<div></div>').append($.parseHTML(t)).html(); obj = this.get_node(obj); this.set_text(obj, t); nv = !!this.rename_node(obj, f ? $('<div></div>').text(v).text() : $('<div></div>').append($.parseHTML(v)).html()); if(!nv) { this.set_text(obj, t); // move this up? and fix #483 } this._data.core.focused = tmp.id; setTimeout($.proxy(function () { var node = this.get_node(tmp.id, true); if(node.length) { this._data.core.focused = tmp.id; node.children('.jstree-anchor').focus(); } }, this), 0); if(callback) { callback.call(this, tmp, nv, cancel); } h2 = null; }, this), "keydown" : function (e) { var key = e.which; if(key === 27) { cancel = true; this.value = t; } if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) { e.stopImmediatePropagation(); } if(key === 27 || key === 13) { e.preventDefault(); this.blur(); } }, "click" : function (e) { e.stopImmediatePropagation(); }, "mousedown" : function (e) { e.stopImmediatePropagation(); }, "keyup" : function (e) { h2.width(Math.min(h1.text("pW" + this.value).width(),w)); }, "keypress" : function(e) { if(e.which === 13) { return false; } } }); fn = { fontFamily : a.css('fontFamily') || '', fontSize : a.css('fontSize') || '', fontWeight : a.css('fontWeight') || '', fontStyle : a.css('fontStyle') || '', fontStretch : a.css('fontStretch') || '', fontVariant : a.css('fontVariant') || '', letterSpacing : a.css('letterSpacing') || '', wordSpacing : a.css('wordSpacing') || '' }; s.attr('class', a.attr('class')).append(a.contents().clone()).append(h2); a.replaceWith(s); h1.css(fn); h2.css(fn).width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select(); $(document).one('mousedown.jstree touchstart.jstree dnd_start.vakata', function (e) { if (h2 && e.target !== h2) { $(h2).blur(); } }); }, /** * changes the theme * @name set_theme(theme_name [, theme_url]) * @param {String} theme_name the name of the new theme to apply * @param {mixed} theme_url the location of the CSS file for this theme. Omit or set to `false` if you manually included the file. Set to `true` to autoload from the `core.themes.dir` directory. * @trigger set_theme.jstree */ set_theme : function (theme_name, theme_url) { if(!theme_name) { return false; } if(theme_url === true) { var dir = this.settings.core.themes.dir; if(!dir) { dir = $.jstree.path + '/themes'; } theme_url = dir + '/' + theme_name + '/style.css'; } if(theme_url && $.inArray(theme_url, themes_loaded) === -1) { $('head').append('<'+'link rel="stylesheet" href="' + theme_url + '" type="text/css" />'); themes_loaded.push(theme_url); } if(this._data.core.themes.name) { this.element.removeClass('jstree-' + this._data.core.themes.name); } this._data.core.themes.name = theme_name; this.element.addClass('jstree-' + theme_name); this.element[this.settings.core.themes.responsive ? 'addClass' : 'removeClass' ]('jstree-' + theme_name + '-responsive'); /** * triggered when a theme is set * @event * @name set_theme.jstree * @param {String} theme the new theme */ this.trigger('set_theme', { 'theme' : theme_name }); }, /** * gets the name of the currently applied theme name * @name get_theme() * @return {String} */ get_theme : function () { return this._data.core.themes.name; }, /** * changes the theme variant (if the theme has variants) * @name set_theme_variant(variant_name) * @param {String|Boolean} variant_name the variant to apply (if `false` is used the current variant is removed) */ set_theme_variant : function (variant_name) { if(this._data.core.themes.variant) { this.element.removeClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant); } this._data.core.themes.variant = variant_name; if(variant_name) { this.element.addClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant); } }, /** * gets the name of the currently applied theme variant * @name get_theme() * @return {String} */ get_theme_variant : function () { return this._data.core.themes.variant; }, /** * shows a striped background on the container (if the theme supports it) * @name show_stripes() */ show_stripes : function () { this._data.core.themes.stripes = true; this.get_container_ul().addClass("jstree-striped"); /** * triggered when stripes are shown * @event * @name show_stripes.jstree */ this.trigger('show_stripes'); }, /** * hides the striped background on the container * @name hide_stripes() */ hide_stripes : function () { this._data.core.themes.stripes = false; this.get_container_ul().removeClass("jstree-striped"); /** * triggered when stripes are hidden * @event * @name hide_stripes.jstree */ this.trigger('hide_stripes'); }, /** * toggles the striped background on the container * @name toggle_stripes() */ toggle_stripes : function () { if(this._data.core.themes.stripes) { this.hide_stripes(); } else { this.show_stripes(); } }, /** * shows the connecting dots (if the theme supports it) * @name show_dots() */ show_dots : function () { this._data.core.themes.dots = true; this.get_container_ul().removeClass("jstree-no-dots"); /** * triggered when dots are shown * @event * @name show_dots.jstree */ this.trigger('show_dots'); }, /** * hides the connecting dots * @name hide_dots() */ hide_dots : function () { this._data.core.themes.dots = false; this.get_container_ul().addClass("jstree-no-dots"); /** * triggered when dots are hidden * @event * @name hide_dots.jstree */ this.trigger('hide_dots'); }, /** * toggles the connecting dots * @name toggle_dots() */ toggle_dots : function () { if(this._data.core.themes.dots) { this.hide_dots(); } else { this.show_dots(); } }, /** * show the node icons * @name show_icons() */ show_icons : function () { this._data.core.themes.icons = true; this.get_container_ul().removeClass("jstree-no-icons"); /** * triggered when icons are shown * @event * @name show_icons.jstree */ this.trigger('show_icons'); }, /** * hide the node icons * @name hide_icons() */ hide_icons : function () { this._data.core.themes.icons = false; this.get_container_ul().addClass("jstree-no-icons"); /** * triggered when icons are hidden * @event * @name hide_icons.jstree */ this.trigger('hide_icons'); }, /** * toggle the node icons * @name toggle_icons() */ toggle_icons : function () { if(this._data.core.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }, /** * show the node ellipsis * @name show_icons() */ show_ellipsis : function () { this._data.core.themes.ellipsis = true; this.get_container_ul().addClass("jstree-ellipsis"); /** * triggered when ellisis is shown * @event * @name show_ellipsis.jstree */ this.trigger('show_ellipsis'); }, /** * hide the node ellipsis * @name hide_ellipsis() */ hide_ellipsis : function () { this._data.core.themes.ellipsis = false; this.get_container_ul().removeClass("jstree-ellipsis"); /** * triggered when ellisis is hidden * @event * @name hide_ellipsis.jstree */ this.trigger('hide_ellipsis'); }, /** * toggle the node ellipsis * @name toggle_icons() */ toggle_ellipsis : function () { if(this._data.core.themes.ellipsis) { this.hide_ellipsis(); } else { this.show_ellipsis(); } }, /** * set the node icon for a node * @name set_icon(obj, icon) * @param {mixed} obj * @param {String} icon the new icon - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class */ set_icon : function (obj, icon) { var t1, t2, dom, old; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.set_icon(obj[t1], icon); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } old = obj.icon; obj.icon = icon === true || icon === null || icon === undefined || icon === '' ? true : icon; dom = this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon"); if(icon === false) { dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel"); this.hide_icon(obj); } else if(icon === true || icon === null || icon === undefined || icon === '') { dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel"); if(old === false) { this.show_icon(obj); } } else if(icon.indexOf("/") === -1 && icon.indexOf(".") === -1) { dom.removeClass(old).css("background",""); dom.addClass(icon + ' jstree-themeicon-custom').attr("rel",icon); if(old === false) { this.show_icon(obj); } } else { dom.removeClass(old).css("background",""); dom.addClass('jstree-themeicon-custom').css("background", "url('" + icon + "') center center no-repeat").attr("rel",icon); if(old === false) { this.show_icon(obj); } } return true; }, /** * get the node icon for a node * @name get_icon(obj) * @param {mixed} obj * @return {String} */ get_icon : function (obj) { obj = this.get_node(obj); return (!obj || obj.id === $.jstree.root) ? false : obj.icon; }, /** * hide the icon on an individual node * @name hide_icon(obj) * @param {mixed} obj */ hide_icon : function (obj) { var t1, t2; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.hide_icon(obj[t1]); } return true; } obj = this.get_node(obj); if(!obj || obj === $.jstree.root) { return false; } obj.icon = false; this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon").addClass('jstree-themeicon-hidden'); return true; }, /** * show the icon on an individual node * @name show_icon(obj) * @param {mixed} obj */ show_icon : function (obj) { var t1, t2, dom; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.show_icon(obj[t1]); } return true; } obj = this.get_node(obj); if(!obj || obj === $.jstree.root) { return false; } dom = this.get_node(obj, true); obj.icon = dom.length ? dom.children(".jstree-anchor").children(".jstree-themeicon").attr('rel') : true; if(!obj.icon) { obj.icon = true; } dom.children(".jstree-anchor").children(".jstree-themeicon").removeClass('jstree-themeicon-hidden'); return true; } }; // helpers $.vakata = {}; // collect attributes $.vakata.attributes = function(node, with_values) { node = $(node)[0]; var attr = with_values ? {} : []; if(node && node.attributes) { $.each(node.attributes, function (i, v) { if($.inArray(v.name.toLowerCase(),['style','contenteditable','hasfocus','tabindex']) !== -1) { return; } if(v.value !== null && $.trim(v.value) !== '') { if(with_values) { attr[v.name] = v.value; } else { attr.push(v.name); } } }); } return attr; }; $.vakata.array_unique = function(array) { var a = [], i, j, l, o = {}; for(i = 0, l = array.length; i < l; i++) { if(o[array[i]] === undefined) { a.push(array[i]); o[array[i]] = true; } } return a; }; // remove item from array $.vakata.array_remove = function(array, from) { array.splice(from, 1); return array; //var rest = array.slice((to || from) + 1 || array.length); //array.length = from < 0 ? array.length + from : from; //array.push.apply(array, rest); //return array; }; // remove item from array $.vakata.array_remove_item = function(array, item) { var tmp = $.inArray(item, array); return tmp !== -1 ? $.vakata.array_remove(array, tmp) : array; }; $.vakata.array_filter = function(c,a,b,d,e) { if (c.filter) { return c.filter(a, b); } d=[]; for (e in c) { if (~~e+''===e+'' && e>=0 && a.call(b,c[e],+e,c)) { d.push(c[e]); } } return d; }; /** * ### Changed plugin * * This plugin adds more information to the `changed.jstree` event. The new data is contained in the `changed` event data property, and contains a lists of `selected` and `deselected` nodes. */ $.jstree.plugins.changed = function (options, parent) { var last = []; this.trigger = function (ev, data) { var i, j; if(!data) { data = {}; } if(ev.replace('.jstree','') === 'changed') { data.changed = { selected : [], deselected : [] }; var tmp = {}; for(i = 0, j = last.length; i < j; i++) { tmp[last[i]] = 1; } for(i = 0, j = data.selected.length; i < j; i++) { if(!tmp[data.selected[i]]) { data.changed.selected.push(data.selected[i]); } else { tmp[data.selected[i]] = 2; } } for(i = 0, j = last.length; i < j; i++) { if(tmp[last[i]] === 1) { data.changed.deselected.push(last[i]); } } last = data.selected.slice(); } /** * triggered when selection changes (the "changed" plugin enhances the original event with more data) * @event * @name changed.jstree * @param {Object} node * @param {Object} action the action that caused the selection to change * @param {Array} selected the current selection * @param {Object} changed an object containing two properties `selected` and `deselected` - both arrays of node IDs, which were selected or deselected since the last changed event * @param {Object} event the event (if any) that triggered this changed event * @plugin changed */ parent.trigger.call(this, ev, data); }; this.refresh = function (skip_loading, forget_state) { last = []; return parent.refresh.apply(this, arguments); }; }; /** * ### Checkbox plugin * * This plugin renders checkbox icons in front of each node, making multiple selection much easier. * It also supports tri-state behavior, meaning that if a node has a few of its children checked it will be rendered as undetermined, and state will be propagated up. */ var _i = document.createElement('I'); _i.className = 'jstree-icon jstree-checkbox'; _i.setAttribute('role', 'presentation'); /** * stores all defaults for the checkbox plugin * @name $.jstree.defaults.checkbox * @plugin checkbox */ $.jstree.defaults.checkbox = { /** * a boolean indicating if checkboxes should be visible (can be changed at a later time using `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`. * @name $.jstree.defaults.checkbox.visible * @plugin checkbox */ visible : true, /** * a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`. * @name $.jstree.defaults.checkbox.three_state * @plugin checkbox */ three_state : true, /** * a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`. * @name $.jstree.defaults.checkbox.whole_node * @plugin checkbox */ whole_node : true, /** * a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`. * @name $.jstree.defaults.checkbox.keep_selected_style * @plugin checkbox */ keep_selected_style : true, /** * This setting controls how cascading and undetermined nodes are applied. * If 'up' is in the string - cascading up is enabled, if 'down' is in the string - cascading down is enabled, if 'undetermined' is in the string - undetermined nodes will be used. * If `three_state` is set to `true` this setting is automatically set to 'up+down+undetermined'. Defaults to ''. * @name $.jstree.defaults.checkbox.cascade * @plugin checkbox */ cascade : '', /** * This setting controls if checkbox are bound to the general tree selection or to an internal array maintained by the checkbox plugin. Defaults to `true`, only set to `false` if you know exactly what you are doing. * @name $.jstree.defaults.checkbox.tie_selection * @plugin checkbox */ tie_selection : true, /** * This setting controls if cascading down affects disabled checkboxes * @name $.jstree.defaults.checkbox.cascade_to_disabled * @plugin checkbox */ cascade_to_disabled : true, /** * This setting controls if cascading down affects hidden checkboxes * @name $.jstree.defaults.checkbox.cascade_to_hidden * @plugin checkbox */ cascade_to_hidden : true }; $.jstree.plugins.checkbox = function (options, parent) { this.bind = function () { parent.bind.call(this); this._data.checkbox.uto = false; this._data.checkbox.selected = []; if(this.settings.checkbox.three_state) { this.settings.checkbox.cascade = 'up+down+undetermined'; } this.element .on("init.jstree", $.proxy(function () { this._data.checkbox.visible = this.settings.checkbox.visible; if(!this.settings.checkbox.keep_selected_style) { this.element.addClass('jstree-checkbox-no-clicked'); } if(this.settings.checkbox.tie_selection) { this.element.addClass('jstree-checkbox-selection'); } }, this)) .on("loading.jstree", $.proxy(function () { this[ this._data.checkbox.visible ? 'show_checkboxes' : 'hide_checkboxes' ](); }, this)); if(this.settings.checkbox.cascade.indexOf('undetermined') !== -1) { this.element .on('changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree', $.proxy(function () { // only if undetermined is in setting if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); } this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50); }, this)); } if(!this.settings.checkbox.tie_selection) { this.element .on('model.jstree', $.proxy(function (e, data) { var m = this._model.data, p = m[data.parent], dpc = data.nodes, i, j; for(i = 0, j = dpc.length; i < j; i++) { m[dpc[i]].state.checked = m[dpc[i]].state.checked || (m[dpc[i]].original && m[dpc[i]].original.state && m[dpc[i]].original.state.checked); if(m[dpc[i]].state.checked) { this._data.checkbox.selected.push(dpc[i]); } } }, this)); } if(this.settings.checkbox.cascade.indexOf('up') !== -1 || this.settings.checkbox.cascade.indexOf('down') !== -1) { this.element .on('model.jstree', $.proxy(function (e, data) { var m = this._model.data, p = m[data.parent], dpc = data.nodes, chd = [], c, i, j, k, l, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection; if(s.indexOf('down') !== -1) { // apply down if(p.state[ t ? 'selected' : 'checked' ]) { for(i = 0, j = dpc.length; i < j; i++) { m[dpc[i]].state[ t ? 'selected' : 'checked' ] = true; } this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(dpc); } else { for(i = 0, j = dpc.length; i < j; i++) { if(m[dpc[i]].state[ t ? 'selected' : 'checked' ]) { for(k = 0, l = m[dpc[i]].children_d.length; k < l; k++) { m[m[dpc[i]].children_d[k]].state[ t ? 'selected' : 'checked' ] = true; } this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(m[dpc[i]].children_d); } } } } if(s.indexOf('up') !== -1) { // apply up for(i = 0, j = p.children_d.length; i < j; i++) { if(!m[p.children_d[i]].children.length) { chd.push(m[p.children_d[i]].parent); } } chd = $.vakata.array_unique(chd); for(k = 0, l = chd.length; k < l; k++) { p = m[chd[k]]; while(p && p.id !== $.jstree.root) { c = 0; for(i = 0, j = p.children.length; i < j; i++) { c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; } if(c === j) { p.state[ t ? 'selected' : 'checked' ] = true; this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); tmp = this.get_node(p, true); if(tmp && tmp.length) { tmp.attr('aria-selected', true).children('.jstree-anchor').addClass( t ? 'jstree-clicked' : 'jstree-checked'); } } else { break; } p = this.get_node(p.parent); } } } this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected); }, this)) .on(this.settings.checkbox.tie_selection ? 'select_node.jstree' : 'check_node.jstree', $.proxy(function (e, data) { var self = this, obj = data.node, m = this._model.data, par = this.get_node(obj.parent), i, j, c, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection, sel = {}, cur = this._data[ t ? 'core' : 'checkbox' ].selected; for (i = 0, j = cur.length; i < j; i++) { sel[cur[i]] = true; } // apply down if(s.indexOf('down') !== -1) { //this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected.concat(obj.children_d)); var selectedIds = this._cascade_new_checked_state(obj.id, true); var temp = obj.children_d.concat(obj.id); for (i = 0, j = temp.length; i < j; i++) { if (selectedIds.indexOf(temp[i]) > -1) { sel[temp[i]] = true; } else { delete sel[temp[i]]; } } } // apply up if(s.indexOf('up') !== -1) { while(par && par.id !== $.jstree.root) { c = 0; for(i = 0, j = par.children.length; i < j; i++) { c += m[par.children[i]].state[ t ? 'selected' : 'checked' ]; } if(c === j) { par.state[ t ? 'selected' : 'checked' ] = true; sel[par.id] = true; //this._data[ t ? 'core' : 'checkbox' ].selected.push(par.id); tmp = this.get_node(par, true); if(tmp && tmp.length) { tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); } } else { break; } par = this.get_node(par.parent); } } cur = []; for (i in sel) { if (sel.hasOwnProperty(i)) { cur.push(i); } } this._data[ t ? 'core' : 'checkbox' ].selected = cur; }, this)) .on(this.settings.checkbox.tie_selection ? 'deselect_all.jstree' : 'uncheck_all.jstree', $.proxy(function (e, data) { var obj = this.get_node($.jstree.root), m = this._model.data, i, j, tmp; for(i = 0, j = obj.children_d.length; i < j; i++) { tmp = m[obj.children_d[i]]; if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { tmp.original.state.undetermined = false; } } }, this)) .on(this.settings.checkbox.tie_selection ? 'deselect_node.jstree' : 'uncheck_node.jstree', $.proxy(function (e, data) { var self = this, obj = data.node, dom = this.get_node(obj, true), i, j, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection, cur = this._data[ t ? 'core' : 'checkbox' ].selected, sel = {}, stillSelectedIds = [], allIds = obj.children_d.concat(obj.id); // apply down if(s.indexOf('down') !== -1) { var selectedIds = this._cascade_new_checked_state(obj.id, false); cur = cur.filter(function(id) { return allIds.indexOf(id) === -1 || selectedIds.indexOf(id) > -1; }); } // only apply up if cascade up is enabled and if this node is not selected // (if all child nodes are disabled and cascade_to_disabled === false then this node will till be selected). if(s.indexOf('up') !== -1 && cur.indexOf(obj.id) === -1) { for(i = 0, j = obj.parents.length; i < j; i++) { tmp = this._model.data[obj.parents[i]]; tmp.state[ t ? 'selected' : 'checked' ] = false; if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { tmp.original.state.undetermined = false; } tmp = this.get_node(obj.parents[i], true); if(tmp && tmp.length) { tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); } } cur = cur.filter(function(id) { return obj.parents.indexOf(id) === -1; }); } this._data[ t ? 'core' : 'checkbox' ].selected = cur; }, this)); } if(this.settings.checkbox.cascade.indexOf('up') !== -1) { this.element .on('delete_node.jstree', $.proxy(function (e, data) { // apply up (whole handler) var p = this.get_node(data.parent), m = this._model.data, i, j, c, tmp, t = this.settings.checkbox.tie_selection; while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) { c = 0; for(i = 0, j = p.children.length; i < j; i++) { c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; } if(j > 0 && c === j) { p.state[ t ? 'selected' : 'checked' ] = true; this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); tmp = this.get_node(p, true); if(tmp && tmp.length) { tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); } } else { break; } p = this.get_node(p.parent); } }, this)) .on('move_node.jstree', $.proxy(function (e, data) { // apply up (whole handler) var is_multi = data.is_multi, old_par = data.old_parent, new_par = this.get_node(data.parent), m = this._model.data, p, c, i, j, tmp, t = this.settings.checkbox.tie_selection; if(!is_multi) { p = this.get_node(old_par); while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) { c = 0; for(i = 0, j = p.children.length; i < j; i++) { c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; } if(j > 0 && c === j) { p.state[ t ? 'selected' : 'checked' ] = true; this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); tmp = this.get_node(p, true); if(tmp && tmp.length) { tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); } } else { break; } p = this.get_node(p.parent); } } p = new_par; while(p && p.id !== $.jstree.root) { c = 0; for(i = 0, j = p.children.length; i < j; i++) { c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; } if(c === j) { if(!p.state[ t ? 'selected' : 'checked' ]) { p.state[ t ? 'selected' : 'checked' ] = true; this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); tmp = this.get_node(p, true); if(tmp && tmp.length) { tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); } } } else { if(p.state[ t ? 'selected' : 'checked' ]) { p.state[ t ? 'selected' : 'checked' ] = false; this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_remove_item(this._data[ t ? 'core' : 'checkbox' ].selected, p.id); tmp = this.get_node(p, true); if(tmp && tmp.length) { tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); } } else { break; } } p = this.get_node(p.parent); } }, this)); } }; /** * get an array of all nodes whose state is "undetermined" * @name get_undetermined([full]) * @param {boolean} full: if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned * @return {Array} * @plugin checkbox */ this.get_undetermined = function (full) { if (this.settings.checkbox.cascade.indexOf('undetermined') === -1) { return []; } var i, j, k, l, o = {}, m = this._model.data, t = this.settings.checkbox.tie_selection, s = this._data[ t ? 'core' : 'checkbox' ].selected, p = [], tt = this, r = []; for(i = 0, j = s.length; i < j; i++) { if(m[s[i]] && m[s[i]].parents) { for(k = 0, l = m[s[i]].parents.length; k < l; k++) { if(o[m[s[i]].parents[k]] !== undefined) { break; } if(m[s[i]].parents[k] !== $.jstree.root) { o[m[s[i]].parents[k]] = true; p.push(m[s[i]].parents[k]); } } } } // attempt for server side undetermined state this.element.find('.jstree-closed').not(':has(.jstree-children)') .each(function () { var tmp = tt.get_node(this), tmp2; if(!tmp) { return; } if(!tmp.state.loaded) { if(tmp.original && tmp.original.state && tmp.original.state.undetermined && tmp.original.state.undetermined === true) { if(o[tmp.id] === undefined && tmp.id !== $.jstree.root) { o[tmp.id] = true; p.push(tmp.id); } for(k = 0, l = tmp.parents.length; k < l; k++) { if(o[tmp.parents[k]] === undefined && tmp.parents[k] !== $.jstree.root) { o[tmp.parents[k]] = true; p.push(tmp.parents[k]); } } } } else { for(i = 0, j = tmp.children_d.length; i < j; i++) { tmp2 = m[tmp.children_d[i]]; if(!tmp2.state.loaded && tmp2.original && tmp2.original.state && tmp2.original.state.undetermined && tmp2.original.state.undetermined === true) { if(o[tmp2.id] === undefined && tmp2.id !== $.jstree.root) { o[tmp2.id] = true; p.push(tmp2.id); } for(k = 0, l = tmp2.parents.length; k < l; k++) { if(o[tmp2.parents[k]] === undefined && tmp2.parents[k] !== $.jstree.root) { o[tmp2.parents[k]] = true; p.push(tmp2.parents[k]); } } } } } }); for (i = 0, j = p.length; i < j; i++) { if(!m[p[i]].state[ t ? 'selected' : 'checked' ]) { r.push(full ? m[p[i]] : p[i]); } } return r; }; /** * set the undetermined state where and if necessary. Used internally. * @private * @name _undetermined() * @plugin checkbox */ this._undetermined = function () { if(this.element === null) { return; } var p = this.get_undetermined(false), i, j, s; this.element.find('.jstree-undetermined').removeClass('jstree-undetermined'); for (i = 0, j = p.length; i < j; i++) { s = this.get_node(p[i], true); if(s && s.length) { s.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-undetermined'); } } }; this.redraw_node = function(obj, deep, is_callback, force_render) { obj = parent.redraw_node.apply(this, arguments); if(obj) { var i, j, tmp = null, icon = null; for(i = 0, j = obj.childNodes.length; i < j; i++) { if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { tmp = obj.childNodes[i]; break; } } if(tmp) { if(!this.settings.checkbox.tie_selection && this._model.data[obj.id].state.checked) { tmp.className += ' jstree-checked'; } icon = _i.cloneNode(false); if(this._model.data[obj.id].state.checkbox_disabled) { icon.className += ' jstree-checkbox-disabled'; } tmp.insertBefore(icon, tmp.childNodes[0]); } } if(!is_callback && this.settings.checkbox.cascade.indexOf('undetermined') !== -1) { if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); } this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50); } return obj; }; /** * show the node checkbox icons * @name show_checkboxes() * @plugin checkbox */ this.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.get_container_ul().removeClass("jstree-no-checkboxes"); }; /** * hide the node checkbox icons * @name hide_checkboxes() * @plugin checkbox */ this.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.get_container_ul().addClass("jstree-no-checkboxes"); }; /** * toggle the node icons * @name toggle_checkboxes() * @plugin checkbox */ this.toggle_checkboxes = function () { if(this._data.core.themes.checkboxes) { this.hide_checkboxes(); } else { this.show_checkboxes(); } }; /** * checks if a node is in an undetermined state * @name is_undetermined(obj) * @param {mixed} obj * @return {Boolean} */ this.is_undetermined = function (obj) { obj = this.get_node(obj); var s = this.settings.checkbox.cascade, i, j, t = this.settings.checkbox.tie_selection, d = this._data[ t ? 'core' : 'checkbox' ].selected, m = this._model.data; if(!obj || obj.state[ t ? 'selected' : 'checked' ] === true || s.indexOf('undetermined') === -1 || (s.indexOf('down') === -1 && s.indexOf('up') === -1)) { return false; } if(!obj.state.loaded && obj.original.state.undetermined === true) { return true; } for(i = 0, j = obj.children_d.length; i < j; i++) { if($.inArray(obj.children_d[i], d) !== -1 || (!m[obj.children_d[i]].state.loaded && m[obj.children_d[i]].original.state.undetermined)) { return true; } } return false; }; /** * disable a node's checkbox * @name disable_checkbox(obj) * @param {mixed} obj an array can be used too * @trigger disable_checkbox.jstree * @plugin checkbox */ this.disable_checkbox = function (obj) { var t1, t2, dom; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.disable_checkbox(obj[t1]); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } dom = this.get_node(obj, true); if(!obj.state.checkbox_disabled) { obj.state.checkbox_disabled = true; if(dom && dom.length) { dom.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-checkbox-disabled'); } /** * triggered when an node's checkbox is disabled * @event * @name disable_checkbox.jstree * @param {Object} node * @plugin checkbox */ this.trigger('disable_checkbox', { 'node' : obj }); } }; /** * enable a node's checkbox * @name disable_checkbox(obj) * @param {mixed} obj an array can be used too * @trigger enable_checkbox.jstree * @plugin checkbox */ this.enable_checkbox = function (obj) { var t1, t2, dom; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.enable_checkbox(obj[t1]); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } dom = this.get_node(obj, true); if(obj.state.checkbox_disabled) { obj.state.checkbox_disabled = false; if(dom && dom.length) { dom.children('.jstree-anchor').children('.jstree-checkbox').removeClass('jstree-checkbox-disabled'); } /** * triggered when an node's checkbox is enabled * @event * @name enable_checkbox.jstree * @param {Object} node * @plugin checkbox */ this.trigger('enable_checkbox', { 'node' : obj }); } }; this.activate_node = function (obj, e) { if($(e.target).hasClass('jstree-checkbox-disabled')) { return false; } if(this.settings.checkbox.tie_selection && (this.settings.checkbox.whole_node || $(e.target).hasClass('jstree-checkbox'))) { e.ctrlKey = true; } if(this.settings.checkbox.tie_selection || (!this.settings.checkbox.whole_node && !$(e.target).hasClass('jstree-checkbox'))) { return parent.activate_node.call(this, obj, e); } if(this.is_disabled(obj)) { return false; } if(this.is_checked(obj)) { this.uncheck_node(obj, e); } else { this.check_node(obj, e); } this.trigger('activate_node', { 'node' : this.get_node(obj) }); }; /** * Cascades checked state to a node and all its descendants. This function does NOT affect hidden and disabled nodes (or their descendants). * However if these unaffected nodes are already selected their ids will be included in the returned array. * @private * @param {string} id the node ID * @param {bool} checkedState should the nodes be checked or not * @returns {Array} Array of all node id's (in this tree branch) that are checked. */ this._cascade_new_checked_state = function (id, checkedState) { var self = this; var t = this.settings.checkbox.tie_selection; var node = this._model.data[id]; var selectedNodeIds = []; var selectedChildrenIds = [], i, j, selectedChildIds; if ( (this.settings.checkbox.cascade_to_disabled || !node.state.disabled) && (this.settings.checkbox.cascade_to_hidden || !node.state.hidden) ) { //First try and check/uncheck the children if (node.children) { for (i = 0, j = node.children.length; i < j; i++) { var childId = node.children[i]; selectedChildIds = self._cascade_new_checked_state(childId, checkedState); selectedNodeIds = selectedNodeIds.concat(selectedChildIds); if (selectedChildIds.indexOf(childId) > -1) { selectedChildrenIds.push(childId); } } } var dom = self.get_node(node, true); //A node's state is undetermined if some but not all of it's children are checked/selected . var undetermined = selectedChildrenIds.length > 0 && selectedChildrenIds.length < node.children.length; if(node.original && node.original.state && node.original.state.undetermined) { node.original.state.undetermined = undetermined; } //If a node is undetermined then remove selected class if (undetermined) { node.state[ t ? 'selected' : 'checked' ] = false; dom.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); } //Otherwise, if the checkedState === true (i.e. the node is being checked now) and all of the node's children are checked (if it has any children), //check the node and style it correctly. else if (checkedState && selectedChildrenIds.length === node.children.length) { node.state[ t ? 'selected' : 'checked' ] = checkedState; selectedNodeIds.push(node.id); dom.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); } else { node.state[ t ? 'selected' : 'checked' ] = false; dom.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); } } else { selectedChildIds = this.get_checked_descendants(id); if (node.state[ t ? 'selected' : 'checked' ]) { selectedChildIds.push(node.id); } selectedNodeIds = selectedNodeIds.concat(selectedChildIds); } return selectedNodeIds; }; /** * Gets ids of nodes selected in branch (of tree) specified by id (does not include the node specified by id) * @name get_checked_descendants(obj) * @param {string} id the node ID * @return {Array} array of IDs * @plugin checkbox */ this.get_checked_descendants = function (id) { var self = this; var t = self.settings.checkbox.tie_selection; var node = self._model.data[id]; return node.children_d.filter(function(_id) { return self._model.data[_id].state[ t ? 'selected' : 'checked' ]; }); }; /** * check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally) * @name check_node(obj) * @param {mixed} obj an array can be used to check multiple nodes * @trigger check_node.jstree * @plugin checkbox */ this.check_node = function (obj, e) { if(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); } var dom, t1, t2, th; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.check_node(obj[t1], e); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } dom = this.get_node(obj, true); if(!obj.state.checked) { obj.state.checked = true; this._data.checkbox.selected.push(obj.id); if(dom && dom.length) { dom.children('.jstree-anchor').addClass('jstree-checked'); } /** * triggered when an node is checked (only if tie_selection in checkbox settings is false) * @event * @name check_node.jstree * @param {Object} node * @param {Array} selected the current selection * @param {Object} event the event (if any) that triggered this check_node * @plugin checkbox */ this.trigger('check_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e }); } }; /** * uncheck a node (only if tie_selection in checkbox settings is false, otherwise deselect_node will be called internally) * @name uncheck_node(obj) * @param {mixed} obj an array can be used to uncheck multiple nodes * @trigger uncheck_node.jstree * @plugin checkbox */ this.uncheck_node = function (obj, e) { if(this.settings.checkbox.tie_selection) { return this.deselect_node(obj, false, e); } var t1, t2, dom; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.uncheck_node(obj[t1], e); } return true; } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } dom = this.get_node(obj, true); if(obj.state.checked) { obj.state.checked = false; this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, obj.id); if(dom.length) { dom.children('.jstree-anchor').removeClass('jstree-checked'); } /** * triggered when an node is unchecked (only if tie_selection in checkbox settings is false) * @event * @name uncheck_node.jstree * @param {Object} node * @param {Array} selected the current selection * @param {Object} event the event (if any) that triggered this uncheck_node * @plugin checkbox */ this.trigger('uncheck_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e }); } }; /** * checks all nodes in the tree (only if tie_selection in checkbox settings is false, otherwise select_all will be called internally) * @name check_all() * @trigger check_all.jstree, changed.jstree * @plugin checkbox */ this.check_all = function () { if(this.settings.checkbox.tie_selection) { return this.select_all(); } var tmp = this._data.checkbox.selected.concat([]), i, j; this._data.checkbox.selected = this._model.data[$.jstree.root].children_d.concat(); for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) { if(this._model.data[this._data.checkbox.selected[i]]) { this._model.data[this._data.checkbox.selected[i]].state.checked = true; } } this.redraw(true); /** * triggered when all nodes are checked (only if tie_selection in checkbox settings is false) * @event * @name check_all.jstree * @param {Array} selected the current selection * @plugin checkbox */ this.trigger('check_all', { 'selected' : this._data.checkbox.selected }); }; /** * uncheck all checked nodes (only if tie_selection in checkbox settings is false, otherwise deselect_all will be called internally) * @name uncheck_all() * @trigger uncheck_all.jstree * @plugin checkbox */ this.uncheck_all = function () { if(this.settings.checkbox.tie_selection) { return this.deselect_all(); } var tmp = this._data.checkbox.selected.concat([]), i, j; for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) { if(this._model.data[this._data.checkbox.selected[i]]) { this._model.data[this._data.checkbox.selected[i]].state.checked = false; } } this._data.checkbox.selected = []; this.element.find('.jstree-checked').removeClass('jstree-checked'); /** * triggered when all nodes are unchecked (only if tie_selection in checkbox settings is false) * @event * @name uncheck_all.jstree * @param {Object} node the previous selection * @param {Array} selected the current selection * @plugin checkbox */ this.trigger('uncheck_all', { 'selected' : this._data.checkbox.selected, 'node' : tmp }); }; /** * checks if a node is checked (if tie_selection is on in the settings this function will return the same as is_selected) * @name is_checked(obj) * @param {mixed} obj * @return {Boolean} * @plugin checkbox */ this.is_checked = function (obj) { if(this.settings.checkbox.tie_selection) { return this.is_selected(obj); } obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } return obj.state.checked; }; /** * get an array of all checked nodes (if tie_selection is on in the settings this function will return the same as get_selected) * @name get_checked([full]) * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned * @return {Array} * @plugin checkbox */ this.get_checked = function (full) { if(this.settings.checkbox.tie_selection) { return this.get_selected(full); } return full ? $.map(this._data.checkbox.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.checkbox.selected; }; /** * get an array of all top level checked nodes (ignoring children of checked nodes) (if tie_selection is on in the settings this function will return the same as get_top_selected) * @name get_top_checked([full]) * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned * @return {Array} * @plugin checkbox */ this.get_top_checked = function (full) { if(this.settings.checkbox.tie_selection) { return this.get_top_selected(full); } var tmp = this.get_checked(true), obj = {}, i, j, k, l; for(i = 0, j = tmp.length; i < j; i++) { obj[tmp[i].id] = tmp[i]; } for(i = 0, j = tmp.length; i < j; i++) { for(k = 0, l = tmp[i].children_d.length; k < l; k++) { if(obj[tmp[i].children_d[k]]) { delete obj[tmp[i].children_d[k]]; } } } tmp = []; for(i in obj) { if(obj.hasOwnProperty(i)) { tmp.push(i); } } return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp; }; /** * get an array of all bottom level checked nodes (ignoring selected parents) (if tie_selection is on in the settings this function will return the same as get_bottom_selected) * @name get_bottom_checked([full]) * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned * @return {Array} * @plugin checkbox */ this.get_bottom_checked = function (full) { if(this.settings.checkbox.tie_selection) { return this.get_bottom_selected(full); } var tmp = this.get_checked(true), obj = [], i, j; for(i = 0, j = tmp.length; i < j; i++) { if(!tmp[i].children.length) { obj.push(tmp[i].id); } } return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj; }; this.load_node = function (obj, callback) { var k, l, i, j, c, tmp; if(!$.isArray(obj) && !this.settings.checkbox.tie_selection) { tmp = this.get_node(obj); if(tmp && tmp.state.loaded) { for(k = 0, l = tmp.children_d.length; k < l; k++) { if(this._model.data[tmp.children_d[k]].state.checked) { c = true; this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, tmp.children_d[k]); } } } } return parent.load_node.apply(this, arguments); }; this.get_state = function () { var state = parent.get_state.apply(this, arguments); if(this.settings.checkbox.tie_selection) { return state; } state.checkbox = this._data.checkbox.selected.slice(); return state; }; this.set_state = function (state, callback) { var res = parent.set_state.apply(this, arguments); if(res && state.checkbox) { if(!this.settings.checkbox.tie_selection) { this.uncheck_all(); var _this = this; $.each(state.checkbox, function (i, v) { _this.check_node(v); }); } delete state.checkbox; this.set_state(state, callback); return false; } return res; }; this.refresh = function (skip_loading, forget_state) { if(this.settings.checkbox.tie_selection) { this._data.checkbox.selected = []; } return parent.refresh.apply(this, arguments); }; }; // include the checkbox plugin by default // $.jstree.defaults.plugins.push("checkbox"); /** * ### Conditionalselect plugin * * This plugin allows defining a callback to allow or deny node selection by user input (activate node method). */ /** * a callback (function) which is invoked in the instance's scope and receives two arguments - the node and the event that triggered the `activate_node` call. Returning false prevents working with the node, returning true allows invoking activate_node. Defaults to returning `true`. * @name $.jstree.defaults.checkbox.visible * @plugin checkbox */ $.jstree.defaults.conditionalselect = function () { return true; }; $.jstree.plugins.conditionalselect = function (options, parent) { // own function this.activate_node = function (obj, e) { if(this.settings.conditionalselect.call(this, this.get_node(obj), e)) { return parent.activate_node.call(this, obj, e); } }; }; /** * ### Contextmenu plugin * * Shows a context menu when a node is right-clicked. */ /** * stores all defaults for the contextmenu plugin * @name $.jstree.defaults.contextmenu * @plugin contextmenu */ $.jstree.defaults.contextmenu = { /** * a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`. * @name $.jstree.defaults.contextmenu.select_node * @plugin contextmenu */ select_node : true, /** * a boolean indicating if the menu should be shown aligned with the node. Defaults to `true`, otherwise the mouse coordinates are used. * @name $.jstree.defaults.contextmenu.show_at_node * @plugin contextmenu */ show_at_node : true, /** * an object of actions, or a function that accepts a node and a callback function and calls the callback function with an object of actions available for that node (you can also return the items too). * * Each action consists of a key (a unique name) and a value which is an object with the following properties (only label and action are required). Once a menu item is activated the `action` function will be invoked with an object containing the following keys: item - the contextmenu item definition as seen below, reference - the DOM node that was used (the tree node), element - the contextmenu DOM element, position - an object with x/y properties indicating the position of the menu. * * * `separator_before` - a boolean indicating if there should be a separator before this item * * `separator_after` - a boolean indicating if there should be a separator after this item * * `_disabled` - a boolean indicating if this action should be disabled * * `label` - a string - the name of the action (could be a function returning a string) * * `title` - a string - an optional tooltip for the item * * `action` - a function to be executed if this item is chosen, the function will receive * * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class * * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2) * * `shortcut_label` - shortcut label (like for example `F2` for rename) * * `submenu` - an object with the same structure as $.jstree.defaults.contextmenu.items which can be used to create a submenu - each key will be rendered as a separate option in a submenu that will appear once the current item is hovered * * @name $.jstree.defaults.contextmenu.items * @plugin contextmenu */ items : function (o, cb) { // Could be an object directly return { "create" : { "separator_before" : false, "separator_after" : true, "_disabled" : false, //(this.check("create_node", data.reference, {}, "last")), "label" : "Create", "action" : function (data) { var inst = $.jstree.reference(data.reference), obj = inst.get_node(data.reference); inst.create_node(obj, {}, "last", function (new_node) { try { inst.edit(new_node); } catch (ex) { setTimeout(function () { inst.edit(new_node); },0); } }); } }, "rename" : { "separator_before" : false, "separator_after" : false, "_disabled" : false, //(this.check("rename_node", data.reference, this.get_parent(data.reference), "")), "label" : "Rename", /*! "shortcut" : 113, "shortcut_label" : 'F2', "icon" : "glyphicon glyphicon-leaf", */ "action" : function (data) { var inst = $.jstree.reference(data.reference), obj = inst.get_node(data.reference); inst.edit(obj); } }, "remove" : { "separator_before" : false, "icon" : false, "separator_after" : false, "_disabled" : false, //(this.check("delete_node", data.reference, this.get_parent(data.reference), "")), "label" : "Delete", "action" : function (data) { var inst = $.jstree.reference(data.reference), obj = inst.get_node(data.reference); if(inst.is_selected(obj)) { inst.delete_node(inst.get_selected()); } else { inst.delete_node(obj); } } }, "ccp" : { "separator_before" : true, "icon" : false, "separator_after" : false, "label" : "Edit", "action" : false, "submenu" : { "cut" : { "separator_before" : false, "separator_after" : false, "label" : "Cut", "action" : function (data) { var inst = $.jstree.reference(data.reference), obj = inst.get_node(data.reference); if(inst.is_selected(obj)) { inst.cut(inst.get_top_selected()); } else { inst.cut(obj); } } }, "copy" : { "separator_before" : false, "icon" : false, "separator_after" : false, "label" : "Copy", "action" : function (data) { var inst = $.jstree.reference(data.reference), obj = inst.get_node(data.reference); if(inst.is_selected(obj)) { inst.copy(inst.get_top_selected()); } else { inst.copy(obj); } } }, "paste" : { "separator_before" : false, "icon" : false, "_disabled" : function (data) { return !$.jstree.reference(data.reference).can_paste(); }, "separator_after" : false, "label" : "Paste", "action" : function (data) { var inst = $.jstree.reference(data.reference), obj = inst.get_node(data.reference); inst.paste(obj); } } } } }; } }; $.jstree.plugins.contextmenu = function (options, parent) { this.bind = function () { parent.bind.call(this); var last_ts = 0, cto = null, ex, ey; this.element .on("init.jstree loading.jstree ready.jstree", $.proxy(function () { this.get_container_ul().addClass('jstree-contextmenu'); }, this)) .on("contextmenu.jstree", ".jstree-anchor", $.proxy(function (e, data) { if (e.target.tagName.toLowerCase() === 'input') { return; } e.preventDefault(); last_ts = e.ctrlKey ? +new Date() : 0; if(data || cto) { last_ts = (+new Date()) + 10000; } if(cto) { clearTimeout(cto); } if(!this.is_loading(e.currentTarget)) { this.show_contextmenu(e.currentTarget, e.pageX, e.pageY, e); } }, this)) .on("click.jstree", ".jstree-anchor", $.proxy(function (e) { if(this._data.contextmenu.visible && (!last_ts || (+new Date()) - last_ts > 250)) { // work around safari & macOS ctrl+click $.vakata.context.hide(); } last_ts = 0; }, this)) .on("touchstart.jstree", ".jstree-anchor", function (e) { if(!e.originalEvent || !e.originalEvent.changedTouches || !e.originalEvent.changedTouches[0]) { return; } ex = e.originalEvent.changedTouches[0].clientX; ey = e.originalEvent.changedTouches[0].clientY; cto = setTimeout(function () { $(e.currentTarget).trigger('contextmenu', true); }, 750); }) .on('touchmove.vakata.jstree', function (e) { if(cto && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0] && (Math.abs(ex - e.originalEvent.changedTouches[0].clientX) > 10 || Math.abs(ey - e.originalEvent.changedTouches[0].clientY) > 10)) { clearTimeout(cto); $.vakata.context.hide(); } }) .on('touchend.vakata.jstree', function (e) { if(cto) { clearTimeout(cto); } }); /*! if(!('oncontextmenu' in document.body) && ('ontouchstart' in document.body)) { var el = null, tm = null; this.element .on("touchstart", ".jstree-anchor", function (e) { el = e.currentTarget; tm = +new Date(); $(document).one("touchend", function (e) { e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset); e.currentTarget = e.target; tm = ((+(new Date())) - tm); if(e.target === el && tm > 600 && tm < 1000) { e.preventDefault(); $(el).trigger('contextmenu', e); } el = null; tm = null; }); }); } */ $(document).on("context_hide.vakata.jstree", $.proxy(function (e, data) { this._data.contextmenu.visible = false; $(data.reference).removeClass('jstree-context'); }, this)); }; this.teardown = function () { if(this._data.contextmenu.visible) { $.vakata.context.hide(); } parent.teardown.call(this); }; /** * prepare and show the context menu for a node * @name show_contextmenu(obj [, x, y]) * @param {mixed} obj the node * @param {Number} x the x-coordinate relative to the document to show the menu at * @param {Number} y the y-coordinate relative to the document to show the menu at * @param {Object} e the event if available that triggered the contextmenu * @plugin contextmenu * @trigger show_contextmenu.jstree */ this.show_contextmenu = function (obj, x, y, e) { obj = this.get_node(obj); if(!obj || obj.id === $.jstree.root) { return false; } var s = this.settings.contextmenu, d = this.get_node(obj, true), a = d.children(".jstree-anchor"), o = false, i = false; if(s.show_at_node || x === undefined || y === undefined) { o = a.offset(); x = o.left; y = o.top + this._data.core.li_height; } if(this.settings.contextmenu.select_node && !this.is_selected(obj)) { this.activate_node(obj, e); } i = s.items; if($.isFunction(i)) { i = i.call(this, obj, $.proxy(function (i) { this._show_contextmenu(obj, x, y, i); }, this)); } if($.isPlainObject(i)) { this._show_contextmenu(obj, x, y, i); } }; /** * show the prepared context menu for a node * @name _show_contextmenu(obj, x, y, i) * @param {mixed} obj the node * @param {Number} x the x-coordinate relative to the document to show the menu at * @param {Number} y the y-coordinate relative to the document to show the menu at * @param {Number} i the object of items to show * @plugin contextmenu * @trigger show_contextmenu.jstree * @private */ this._show_contextmenu = function (obj, x, y, i) { var d = this.get_node(obj, true), a = d.children(".jstree-anchor"); $(document).one("context_show.vakata.jstree", $.proxy(function (e, data) { var cls = 'jstree-contextmenu jstree-' + this.get_theme() + '-contextmenu'; $(data.element).addClass(cls); a.addClass('jstree-context'); }, this)); this._data.contextmenu.visible = true; $.vakata.context.show(a, { 'x' : x, 'y' : y }, i); /** * triggered when the contextmenu is shown for a node * @event * @name show_contextmenu.jstree * @param {Object} node the node * @param {Number} x the x-coordinate of the menu relative to the document * @param {Number} y the y-coordinate of the menu relative to the document * @plugin contextmenu */ this.trigger('show_contextmenu', { "node" : obj, "x" : x, "y" : y }); }; }; // contextmenu helper (function ($) { var right_to_left = false, vakata_context = { element : false, reference : false, position_x : 0, position_y : 0, items : [], html : "", is_visible : false }; $.vakata.context = { settings : { hide_onmouseleave : 0, icons : true }, _trigger : function (event_name) { $(document).triggerHandler("context_" + event_name + ".vakata", { "reference" : vakata_context.reference, "element" : vakata_context.element, "position" : { "x" : vakata_context.position_x, "y" : vakata_context.position_y } }); }, _execute : function (i) { i = vakata_context.items[i]; return i && (!i._disabled || ($.isFunction(i._disabled) && !i._disabled({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }))) && i.action ? i.action.call(null, { "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element, "position" : { "x" : vakata_context.position_x, "y" : vakata_context.position_y } }) : false; }, _parse : function (o, is_callback) { if(!o) { return false; } if(!is_callback) { vakata_context.html = ""; vakata_context.items = []; } var str = "", sep = false, tmp; if(is_callback) { str += "<"+"ul>"; } $.each(o, function (i, val) { if(!val) { return true; } vakata_context.items.push(val); if(!sep && val.separator_before) { str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>"; } sep = false; str += "<"+"li class='" + (val._class || "") + (val._disabled === true || ($.isFunction(val._disabled) && val._disabled({ "item" : val, "reference" : vakata_context.reference, "element" : vakata_context.element })) ? " vakata-contextmenu-disabled " : "") + "' "+(val.shortcut?" data-shortcut='"+val.shortcut+"' ":'')+">"; str += "<"+"a href='#' rel='" + (vakata_context.items.length - 1) + "' " + (val.title ? "title='" + val.title + "'" : "") + ">"; if($.vakata.context.settings.icons) { str += "<"+"i "; if(val.icon) { if(val.icon.indexOf("/") !== -1 || val.icon.indexOf(".") !== -1) { str += " style='background:url(\"" + val.icon + "\") center center no-repeat' "; } else { str += " class='" + val.icon + "' "; } } str += "><"+"/i><"+"span class='vakata-contextmenu-sep'> <"+"/span>"; } str += ($.isFunction(val.label) ? val.label({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }) : val.label) + (val.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+val.shortcut+'">'+ (val.shortcut_label || '') +'</span>':'') + "<"+"/a>"; if(val.submenu) { tmp = $.vakata.context._parse(val.submenu, true); if(tmp) { str += tmp; } } str += "<"+"/li>"; if(val.separator_after) { str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>"; sep = true; } }); str = str.replace(/<li class\='vakata-context-separator'\><\/li\>$/,""); if(is_callback) { str += "</ul>"; } /** * triggered on the document when the contextmenu is parsed (HTML is built) * @event * @plugin contextmenu * @name context_parse.vakata * @param {jQuery} reference the element that was right clicked * @param {jQuery} element the DOM element of the menu itself * @param {Object} position the x & y coordinates of the menu */ if(!is_callback) { vakata_context.html = str; $.vakata.context._trigger("parse"); } return str.length > 10 ? str : false; }, _show_submenu : function (o) { o = $(o); if(!o.length || !o.children("ul").length) { return; } var e = o.children("ul"), xl = o.offset().left, x = xl + o.outerWidth(), y = o.offset().top, w = e.width(), h = e.height(), dw = $(window).width() + $(window).scrollLeft(), dh = $(window).height() + $(window).scrollTop(); // може да се спести е една проверка - дали няма някой от класовете вече нагоре if(right_to_left) { o[x - (w + 10 + o.outerWidth()) < 0 ? "addClass" : "removeClass"]("vakata-context-left"); } else { o[x + w > dw && xl > dw - x ? "addClass" : "removeClass"]("vakata-context-right"); } if(y + h + 10 > dh) { e.css("bottom","-1px"); } //if does not fit - stick it to the side if (o.hasClass('vakata-context-right')) { if (xl < w) { e.css("margin-right", xl - w); } } else { if (dw - x < w) { e.css("margin-left", dw - x - w); } } e.show(); }, show : function (reference, position, data) { var o, e, x, y, w, h, dw, dh, cond = true; if(vakata_context.element && vakata_context.element.length) { vakata_context.element.width(''); } switch(cond) { case (!position && !reference): return false; case (!!position && !!reference): vakata_context.reference = reference; vakata_context.position_x = position.x; vakata_context.position_y = position.y; break; case (!position && !!reference): vakata_context.reference = reference; o = reference.offset(); vakata_context.position_x = o.left + reference.outerHeight(); vakata_context.position_y = o.top; break; case (!!position && !reference): vakata_context.position_x = position.x; vakata_context.position_y = position.y; break; } if(!!reference && !data && $(reference).data('vakata_contextmenu')) { data = $(reference).data('vakata_contextmenu'); } if($.vakata.context._parse(data)) { vakata_context.element.html(vakata_context.html); } if(vakata_context.items.length) { vakata_context.element.appendTo(document.body); e = vakata_context.element; x = vakata_context.position_x; y = vakata_context.position_y; w = e.width(); h = e.height(); dw = $(window).width() + $(window).scrollLeft(); dh = $(window).height() + $(window).scrollTop(); if(right_to_left) { x -= (e.outerWidth() - $(reference).outerWidth()); if(x < $(window).scrollLeft() + 20) { x = $(window).scrollLeft() + 20; } } if(x + w + 20 > dw) { x = dw - (w + 20); } if(y + h + 20 > dh) { y = dh - (h + 20); } vakata_context.element .css({ "left" : x, "top" : y }) .show() .find('a').first().focus().parent().addClass("vakata-context-hover"); vakata_context.is_visible = true; /** * triggered on the document when the contextmenu is shown * @event * @plugin contextmenu * @name context_show.vakata * @param {jQuery} reference the element that was right clicked * @param {jQuery} element the DOM element of the menu itself * @param {Object} position the x & y coordinates of the menu */ $.vakata.context._trigger("show"); } }, hide : function () { if(vakata_context.is_visible) { vakata_context.element.hide().find("ul").hide().end().find(':focus').blur().end().detach(); vakata_context.is_visible = false; /** * triggered on the document when the contextmenu is hidden * @event * @plugin contextmenu * @name context_hide.vakata * @param {jQuery} reference the element that was right clicked * @param {jQuery} element the DOM element of the menu itself * @param {Object} position the x & y coordinates of the menu */ $.vakata.context._trigger("hide"); } } }; $(function () { right_to_left = $(document.body).css("direction") === "rtl"; var to = false; vakata_context.element = $("<ul class='vakata-context'></ul>"); vakata_context.element .on("mouseenter", "li", function (e) { e.stopImmediatePropagation(); if($.contains(this, e.relatedTarget)) { // премахнато заради delegate mouseleave по-долу // $(this).find(".vakata-context-hover").removeClass("vakata-context-hover"); return; } if(to) { clearTimeout(to); } vakata_context.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(); $(this) .siblings().find("ul").hide().end().end() .parentsUntil(".vakata-context", "li").addBack().addClass("vakata-context-hover"); $.vakata.context._show_submenu(this); }) // тестово - дали не натоварва? .on("mouseleave", "li", function (e) { if($.contains(this, e.relatedTarget)) { return; } $(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover"); }) .on("mouseleave", function (e) { $(this).find(".vakata-context-hover").removeClass("vakata-context-hover"); if($.vakata.context.settings.hide_onmouseleave) { to = setTimeout( (function (t) { return function () { $.vakata.context.hide(); }; }(this)), $.vakata.context.settings.hide_onmouseleave); } }) .on("click", "a", function (e) { e.preventDefault(); //}) //.on("mouseup", "a", function (e) { if(!$(this).blur().parent().hasClass("vakata-context-disabled") && $.vakata.context._execute($(this).attr("rel")) !== false) { $.vakata.context.hide(); } }) .on('keydown', 'a', function (e) { var o = null; switch(e.which) { case 13: case 32: e.type = "click"; e.preventDefault(); $(e.currentTarget).trigger(e); break; case 37: if(vakata_context.is_visible) { vakata_context.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children('a').focus(); e.stopImmediatePropagation(); e.preventDefault(); } break; case 38: if(vakata_context.is_visible) { o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(); if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last(); } o.addClass("vakata-context-hover").children('a').focus(); e.stopImmediatePropagation(); e.preventDefault(); } break; case 39: if(vakata_context.is_visible) { vakata_context.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children('a').focus(); e.stopImmediatePropagation(); e.preventDefault(); } break; case 40: if(vakata_context.is_visible) { o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(); if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first(); } o.addClass("vakata-context-hover").children('a').focus(); e.stopImmediatePropagation(); e.preventDefault(); } break; case 27: $.vakata.context.hide(); e.preventDefault(); break; default: //console.log(e.which); break; } }) .on('keydown', function (e) { e.preventDefault(); var a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent(); if(a.parent().not('.vakata-context-disabled')) { a.click(); } }); $(document) .on("mousedown.vakata.jstree", function (e) { if(vakata_context.is_visible && vakata_context.element[0] !== e.target && !$.contains(vakata_context.element[0], e.target)) { $.vakata.context.hide(); } }) .on("context_show.vakata.jstree", function (e, data) { vakata_context.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"); if(right_to_left) { vakata_context.element.addClass("vakata-context-rtl").css("direction", "rtl"); } // also apply a RTL class? vakata_context.element.find("ul").hide().end(); }); }); }($)); // $.jstree.defaults.plugins.push("contextmenu"); /** * ### Drag'n'drop plugin * * Enables dragging and dropping of nodes in the tree, resulting in a move or copy operations. */ /** * stores all defaults for the drag'n'drop plugin * @name $.jstree.defaults.dnd * @plugin dnd */ $.jstree.defaults.dnd = { /** * a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`. * @name $.jstree.defaults.dnd.copy * @plugin dnd */ copy : true, /** * a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`. * @name $.jstree.defaults.dnd.open_timeout * @plugin dnd */ open_timeout : 500, /** * a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to be dragged as an argument (array) and the event that started the drag - return `false` to prevent dragging * @name $.jstree.defaults.dnd.is_draggable * @plugin dnd */ is_draggable : true, /** * a boolean indicating if checks should constantly be made while the user is dragging the node (as opposed to checking only on drop), default is `true` * @name $.jstree.defaults.dnd.check_while_dragging * @plugin dnd */ check_while_dragging : true, /** * a boolean indicating if nodes from this tree should only be copied with dnd (as opposed to moved), default is `false` * @name $.jstree.defaults.dnd.always_copy * @plugin dnd */ always_copy : false, /** * when dropping a node "inside", this setting indicates the position the node should go to - it can be an integer or a string: "first" (same as 0) or "last", default is `0` * @name $.jstree.defaults.dnd.inside_pos * @plugin dnd */ inside_pos : 0, /** * when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node * @name $.jstree.defaults.dnd.drag_selection * @plugin dnd */ drag_selection : true, /** * controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices. * @name $.jstree.defaults.dnd.touch * @plugin dnd */ touch : true, /** * controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target. * @name $.jstree.defaults.dnd.large_drop_target * @plugin dnd */ large_drop_target : false, /** * controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected". * @name $.jstree.defaults.dnd.large_drag_target * @plugin dnd */ large_drag_target : false, /** * controls whether use HTML5 dnd api instead of classical. That will allow better integration of dnd events with other HTML5 controls. * @reference http://caniuse.com/#feat=dragndrop * @name $.jstree.defaults.dnd.use_html5 * @plugin dnd */ use_html5: false }; var drg, elm; // TODO: now check works by checking for each node individually, how about max_children, unique, etc? $.jstree.plugins.dnd = function (options, parent) { this.init = function (el, options) { parent.init.call(this, el, options); this.settings.dnd.use_html5 = this.settings.dnd.use_html5 && ('draggable' in document.createElement('span')); }; this.bind = function () { parent.bind.call(this); this.element .on(this.settings.dnd.use_html5 ? 'dragstart.jstree' : 'mousedown.jstree touchstart.jstree', this.settings.dnd.large_drag_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) { if(this.settings.dnd.large_drag_target && $(e.target).closest('.jstree-node')[0] !== e.currentTarget) { return true; } if(e.type === "touchstart" && (!this.settings.dnd.touch || (this.settings.dnd.touch === 'selected' && !$(e.currentTarget).closest('.jstree-node').children('.jstree-anchor').hasClass('jstree-clicked')))) { return true; } var obj = this.get_node(e.target), mlt = this.is_selected(obj) && this.settings.dnd.drag_selection ? this.get_top_selected().length : 1, txt = (mlt > 1 ? mlt + ' ' + this.get_string('nodes') : this.get_text(e.currentTarget)); if(this.settings.core.force_text) { txt = $.vakata.html.escape(txt); } if(obj && obj.id && obj.id !== $.jstree.root && (e.which === 1 || e.type === "touchstart" || e.type === "dragstart") && (this.settings.dnd.is_draggable === true || ($.isFunction(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]), e))) ) { drg = { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected() : [obj.id] }; elm = e.currentTarget; if (this.settings.dnd.use_html5) { $.vakata.dnd._trigger('start', e, { 'helper': $(), 'element': elm, 'data': drg }); } else { this.element.trigger('mousedown.jstree'); return $.vakata.dnd.start(e, drg, '<div id="jstree-dnd" class="jstree-' + this.get_theme() + ' jstree-' + this.get_theme() + '-' + this.get_theme_variant() + ' ' + ( this.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' ) + '"><i class="jstree-icon jstree-er"></i>' + txt + '<ins class="jstree-copy" style="display:none;">+</ins></div>'); } } }, this)); if (this.settings.dnd.use_html5) { this.element .on('dragover.jstree', function (e) { e.preventDefault(); $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); return false; }) //.on('dragenter.jstree', this.settings.dnd.large_drop_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) { // e.preventDefault(); // $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); // return false; // }, this)) .on('drop.jstree', $.proxy(function (e) { e.preventDefault(); $.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg }); return false; }, this)); } }; this.redraw_node = function(obj, deep, callback, force_render) { obj = parent.redraw_node.apply(this, arguments); if (obj && this.settings.dnd.use_html5) { if (this.settings.dnd.large_drag_target) { obj.setAttribute('draggable', true); } else { var i, j, tmp = null; for(i = 0, j = obj.childNodes.length; i < j; i++) { if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { tmp = obj.childNodes[i]; break; } } if(tmp) { tmp.setAttribute('draggable', true); } } } return obj; }; }; $(function() { // bind only once for all instances var lastmv = false, laster = false, lastev = false, opento = false, marker = $('<div id="jstree-marker"> </div>').hide(); //.appendTo('body'); $(document) .on('dragover.vakata.jstree', function (e) { if (elm) { $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); } }) .on('drop.vakata.jstree', function (e) { if (elm) { $.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg }); elm = null; drg = null; } }) .on('dnd_start.vakata.jstree', function (e, data) { lastmv = false; lastev = false; if(!data || !data.data || !data.data.jstree) { return; } marker.appendTo(document.body); //.show(); }) .on('dnd_move.vakata.jstree', function (e, data) { var isDifferentNode = data.event.target !== lastev.target; if(opento) { if (!data.event || data.event.type !== 'dragover' || isDifferentNode) { clearTimeout(opento); } } if(!data || !data.data || !data.data.jstree) { return; } // if we are hovering the marker image do nothing (can happen on "inside" drags) if(data.event.target.id && data.event.target.id === 'jstree-marker') { return; } lastev = data.event; var ins = $.jstree.reference(data.event.target), ref = false, off = false, rel = false, tmp, l, t, h, p, i, o, ok, t1, t2, op, ps, pr, ip, tm, is_copy, pn; // if we are over an instance if(ins && ins._data && ins._data.dnd) { marker.attr('class', 'jstree-' + ins.get_theme() + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' )); is_copy = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))); data.helper .children().attr('class', 'jstree-' + ins.get_theme() + ' jstree-' + ins.get_theme() + '-' + ins.get_theme_variant() + ' ' + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' )) .find('.jstree-copy').first()[ is_copy ? 'show' : 'hide' ](); // if are hovering the container itself add a new root node //console.log(data.event); if( (data.event.target === ins.element[0] || data.event.target === ins.get_container_ul()[0]) && ins.get_container_ul().children().length === 0) { ok = true; for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) { ok = ok && ins.check( (data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey)) ) ? "copy_node" : "move_node"), (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), $.jstree.root, 'last', { 'dnd' : true, 'ref' : ins.get_node($.jstree.root), 'pos' : 'i', 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }); if(!ok) { break; } } if(ok) { lastmv = { 'ins' : ins, 'par' : $.jstree.root, 'pos' : 'last' }; marker.hide(); data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok'); if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move'; } return; } } else { // if we are hovering a tree node ref = ins.settings.dnd.large_drop_target ? $(data.event.target).closest('.jstree-node').children('.jstree-anchor') : $(data.event.target).closest('.jstree-anchor'); if(ref && ref.length && ref.parent().is('.jstree-closed, .jstree-open, .jstree-leaf')) { off = ref.offset(); rel = (data.event.pageY !== undefined ? data.event.pageY : data.event.originalEvent.pageY) - off.top; h = ref.outerHeight(); if(rel < h / 3) { o = ['b', 'i', 'a']; } else if(rel > h - h / 3) { o = ['a', 'i', 'b']; } else { o = rel > h / 2 ? ['i', 'a', 'b'] : ['i', 'b', 'a']; } $.each(o, function (j, v) { switch(v) { case 'b': l = off.left - 6; t = off.top; p = ins.get_parent(ref); i = ref.parent().index(); break; case 'i': ip = ins.settings.dnd.inside_pos; tm = ins.get_node(ref.parent()); l = off.left - 2; t = off.top + h / 2 + 1; p = tm.id; i = ip === 'first' ? 0 : (ip === 'last' ? tm.children.length : Math.min(ip, tm.children.length)); break; case 'a': l = off.left - 6; t = off.top + h; p = ins.get_parent(ref); i = ref.parent().index() + 1; break; } ok = true; for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) { op = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? "copy_node" : "move_node"; ps = i; if(op === "move_node" && v === 'a' && (data.data.origin && data.data.origin === ins) && p === ins.get_parent(data.data.nodes[t1])) { pr = ins.get_node(p); if(ps > $.inArray(data.data.nodes[t1], pr.children)) { ps -= 1; } } ok = ok && ( (ins && ins.settings && ins.settings.dnd && ins.settings.dnd.check_while_dragging === false) || ins.check(op, (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), p, ps, { 'dnd' : true, 'ref' : ins.get_node(ref.parent()), 'pos' : v, 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }) ); if(!ok) { if(ins && ins.last_error) { laster = ins.last_error(); } break; } } if(v === 'i' && ref.parent().is('.jstree-closed') && ins.settings.dnd.open_timeout) { if (!data.event || data.event.type !== 'dragover' || isDifferentNode) { if (opento) { clearTimeout(opento); } opento = setTimeout((function (x, z) { return function () { x.open_node(z); }; }(ins, ref)), ins.settings.dnd.open_timeout); } } if(ok) { pn = ins.get_node(p, true); if (!pn.hasClass('.jstree-dnd-parent')) { $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); pn.addClass('jstree-dnd-parent'); } lastmv = { 'ins' : ins, 'par' : p, 'pos' : v === 'i' && ip === 'last' && i === 0 && !ins.is_loaded(tm) ? 'last' : i }; marker.css({ 'left' : l + 'px', 'top' : t + 'px' }).show(); data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok'); if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move'; } laster = {}; o = true; return false; } }); if(o === true) { return; } } } } $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); lastmv = false; data.helper.find('.jstree-icon').removeClass('jstree-ok').addClass('jstree-er'); if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { //data.event.originalEvent.dataTransfer.dropEffect = 'none'; } marker.hide(); }) .on('dnd_scroll.vakata.jstree', function (e, data) { if(!data || !data.data || !data.data.jstree) { return; } marker.hide(); lastmv = false; lastev = false; data.helper.find('.jstree-icon').first().removeClass('jstree-ok').addClass('jstree-er'); }) .on('dnd_stop.vakata.jstree', function (e, data) { $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); if(opento) { clearTimeout(opento); } if(!data || !data.data || !data.data.jstree) { return; } marker.hide().detach(); var i, j, nodes = []; if(lastmv) { for(i = 0, j = data.data.nodes.length; i < j; i++) { nodes[i] = data.data.origin ? data.data.origin.get_node(data.data.nodes[i]) : data.data.nodes[i]; } lastmv.ins[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos, false, false, false, data.data.origin); } else { i = $(data.event.target).closest('.jstree'); if(i.length && laster && laster.error && laster.error === 'check') { i = i.jstree(true); if(i) { i.settings.core.error.call(this, laster); } } } lastev = false; lastmv = false; }) .on('keyup.jstree keydown.jstree', function (e, data) { data = $.vakata.dnd._get(); if(data && data.data && data.data.jstree) { if (e.type === "keyup" && e.which === 27) { if (opento) { clearTimeout(opento); } lastmv = false; laster = false; lastev = false; opento = false; marker.hide().detach(); $.vakata.dnd._clean(); } else { data.helper.find('.jstree-copy').first()[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (e.metaKey || e.ctrlKey))) ? 'show' : 'hide' ](); if(lastev) { lastev.metaKey = e.metaKey; lastev.ctrlKey = e.ctrlKey; $.vakata.dnd._trigger('move', lastev); } } } }); }); // helpers (function ($) { $.vakata.html = { div : $('<div />'), escape : function (str) { return $.vakata.html.div.text(str).html(); }, strip : function (str) { return $.vakata.html.div.empty().append($.parseHTML(str)).text(); } }; // private variable var vakata_dnd = { element : false, target : false, is_down : false, is_drag : false, helper : false, helper_w: 0, data : false, init_x : 0, init_y : 0, scroll_l: 0, scroll_t: 0, scroll_e: false, scroll_i: false, is_touch: false }; $.vakata.dnd = { settings : { scroll_speed : 10, scroll_proximity : 20, helper_left : 5, helper_top : 10, threshold : 5, threshold_touch : 10 }, _trigger : function (event_name, e, data) { if (data === undefined) { data = $.vakata.dnd._get(); } data.event = e; $(document).triggerHandler("dnd_" + event_name + ".vakata", data); }, _get : function () { return { "data" : vakata_dnd.data, "element" : vakata_dnd.element, "helper" : vakata_dnd.helper }; }, _clean : function () { if(vakata_dnd.helper) { vakata_dnd.helper.remove(); } if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; } vakata_dnd = { element : false, target : false, is_down : false, is_drag : false, helper : false, helper_w: 0, data : false, init_x : 0, init_y : 0, scroll_l: 0, scroll_t: 0, scroll_e: false, scroll_i: false, is_touch: false }; $(document).off("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag); $(document).off("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop); }, _scroll : function (init_only) { if(!vakata_dnd.scroll_e || (!vakata_dnd.scroll_l && !vakata_dnd.scroll_t)) { if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; } return false; } if(!vakata_dnd.scroll_i) { vakata_dnd.scroll_i = setInterval($.vakata.dnd._scroll, 100); return false; } if(init_only === true) { return false; } var i = vakata_dnd.scroll_e.scrollTop(), j = vakata_dnd.scroll_e.scrollLeft(); vakata_dnd.scroll_e.scrollTop(i + vakata_dnd.scroll_t * $.vakata.dnd.settings.scroll_speed); vakata_dnd.scroll_e.scrollLeft(j + vakata_dnd.scroll_l * $.vakata.dnd.settings.scroll_speed); if(i !== vakata_dnd.scroll_e.scrollTop() || j !== vakata_dnd.scroll_e.scrollLeft()) { /** * triggered on the document when a drag causes an element to scroll * @event * @plugin dnd * @name dnd_scroll.vakata * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start * @param {DOM} element the DOM element being dragged * @param {jQuery} helper the helper shown next to the mouse * @param {jQuery} event the element that is scrolling */ $.vakata.dnd._trigger("scroll", vakata_dnd.scroll_e); } }, start : function (e, data, html) { if(e.type === "touchstart" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { e.pageX = e.originalEvent.changedTouches[0].pageX; e.pageY = e.originalEvent.changedTouches[0].pageY; e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); } if(vakata_dnd.is_drag) { $.vakata.dnd.stop({}); } try { e.currentTarget.unselectable = "on"; e.currentTarget.onselectstart = function() { return false; }; if(e.currentTarget.style) { e.currentTarget.style.touchAction = "none"; e.currentTarget.style.msTouchAction = "none"; e.currentTarget.style.MozUserSelect = "none"; } } catch(ignore) { } vakata_dnd.init_x = e.pageX; vakata_dnd.init_y = e.pageY; vakata_dnd.data = data; vakata_dnd.is_down = true; vakata_dnd.element = e.currentTarget; vakata_dnd.target = e.target; vakata_dnd.is_touch = e.type === "touchstart"; if(html !== false) { vakata_dnd.helper = $("<div id='vakata-dnd'></div>").html(html).css({ "display" : "block", "margin" : "0", "padding" : "0", "position" : "absolute", "top" : "-2000px", "lineHeight" : "16px", "zIndex" : "10000" }); } $(document).on("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag); $(document).on("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop); return false; }, drag : function (e) { if(e.type === "touchmove" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { e.pageX = e.originalEvent.changedTouches[0].pageX; e.pageY = e.originalEvent.changedTouches[0].pageY; e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); } if(!vakata_dnd.is_down) { return; } if(!vakata_dnd.is_drag) { if( Math.abs(e.pageX - vakata_dnd.init_x) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) || Math.abs(e.pageY - vakata_dnd.init_y) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) ) { if(vakata_dnd.helper) { vakata_dnd.helper.appendTo(document.body); vakata_dnd.helper_w = vakata_dnd.helper.outerWidth(); } vakata_dnd.is_drag = true; $(vakata_dnd.target).one('click.vakata', false); /** * triggered on the document when a drag starts * @event * @plugin dnd * @name dnd_start.vakata * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start * @param {DOM} element the DOM element being dragged * @param {jQuery} helper the helper shown next to the mouse * @param {Object} event the event that caused the start (probably mousemove) */ $.vakata.dnd._trigger("start", e); } else { return; } } var d = false, w = false, dh = false, wh = false, dw = false, ww = false, dt = false, dl = false, ht = false, hl = false; vakata_dnd.scroll_t = 0; vakata_dnd.scroll_l = 0; vakata_dnd.scroll_e = false; $($(e.target).parentsUntil("body").addBack().get().reverse()) .filter(function () { return (/^auto|scroll$/).test($(this).css("overflow")) && (this.scrollHeight > this.offsetHeight || this.scrollWidth > this.offsetWidth); }) .each(function () { var t = $(this), o = t.offset(); if(this.scrollHeight > this.offsetHeight) { if(o.top + t.height() - e.pageY < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; } if(e.pageY - o.top < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; } } if(this.scrollWidth > this.offsetWidth) { if(o.left + t.width() - e.pageX < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; } if(e.pageX - o.left < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; } } if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) { vakata_dnd.scroll_e = $(this); return false; } }); if(!vakata_dnd.scroll_e) { d = $(document); w = $(window); dh = d.height(); wh = w.height(); dw = d.width(); ww = w.width(); dt = d.scrollTop(); dl = d.scrollLeft(); if(dh > wh && e.pageY - dt < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; } if(dh > wh && wh - (e.pageY - dt) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; } if(dw > ww && e.pageX - dl < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; } if(dw > ww && ww - (e.pageX - dl) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; } if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) { vakata_dnd.scroll_e = d; } } if(vakata_dnd.scroll_e) { $.vakata.dnd._scroll(true); } if(vakata_dnd.helper) { ht = parseInt(e.pageY + $.vakata.dnd.settings.helper_top, 10); hl = parseInt(e.pageX + $.vakata.dnd.settings.helper_left, 10); if(dh && ht + 25 > dh) { ht = dh - 50; } if(dw && hl + vakata_dnd.helper_w > dw) { hl = dw - (vakata_dnd.helper_w + 2); } vakata_dnd.helper.css({ left : hl + "px", top : ht + "px" }); } /** * triggered on the document when a drag is in progress * @event * @plugin dnd * @name dnd_move.vakata * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start * @param {DOM} element the DOM element being dragged * @param {jQuery} helper the helper shown next to the mouse * @param {Object} event the event that caused this to trigger (most likely mousemove) */ $.vakata.dnd._trigger("move", e); return false; }, stop : function (e) { if(e.type === "touchend" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { e.pageX = e.originalEvent.changedTouches[0].pageX; e.pageY = e.originalEvent.changedTouches[0].pageY; e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); } if(vakata_dnd.is_drag) { /** * triggered on the document when a drag stops (the dragged element is dropped) * @event * @plugin dnd * @name dnd_stop.vakata * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start * @param {DOM} element the DOM element being dragged * @param {jQuery} helper the helper shown next to the mouse * @param {Object} event the event that caused the stop */ if (e.target !== vakata_dnd.target) { $(vakata_dnd.target).off('click.vakata'); } $.vakata.dnd._trigger("stop", e); } else { if(e.type === "touchend" && e.target === vakata_dnd.target) { var to = setTimeout(function () { $(e.target).click(); }, 100); $(e.target).one('click', function() { if(to) { clearTimeout(to); } }); } } $.vakata.dnd._clean(); return false; } }; }($)); // include the dnd plugin by default // $.jstree.defaults.plugins.push("dnd"); /** * ### Massload plugin * * Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading). */ /** * massload configuration * * It is possible to set this to a standard jQuery-like AJAX config. * In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used. * * You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result. * * Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array. * * { * "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }], * "id2" : [{ "text" : "Child of ID2", "id" : "c3" }] * } * * @name $.jstree.defaults.massload * @plugin massload */ $.jstree.defaults.massload = null; $.jstree.plugins.massload = function (options, parent) { this.init = function (el, options) { this._data.massload = {}; parent.init.call(this, el, options); }; this._load_nodes = function (nodes, callback, is_callback, force_reload) { var s = this.settings.massload, nodesString = JSON.stringify(nodes), toLoad = [], m = this._model.data, i, j, dom; if (!is_callback) { for(i = 0, j = nodes.length; i < j; i++) { if(!m[nodes[i]] || ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || force_reload) ) { toLoad.push(nodes[i]); dom = this.get_node(nodes[i], true); if (dom && dom.length) { dom.addClass("jstree-loading").attr('aria-busy',true); } } } this._data.massload = {}; if (toLoad.length) { if($.isFunction(s)) { return s.call(this, toLoad, $.proxy(function (data) { var i, j; if(data) { for(i in data) { if(data.hasOwnProperty(i)) { this._data.massload[i] = data[i]; } } } for(i = 0, j = nodes.length; i < j; i++) { dom = this.get_node(nodes[i], true); if (dom && dom.length) { dom.removeClass("jstree-loading").attr('aria-busy',false); } } parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); }, this)); } if(typeof s === 'object' && s && s.url) { s = $.extend(true, {}, s); if($.isFunction(s.url)) { s.url = s.url.call(this, toLoad); } if($.isFunction(s.data)) { s.data = s.data.call(this, toLoad); } return $.ajax(s) .done($.proxy(function (data,t,x) { var i, j; if(data) { for(i in data) { if(data.hasOwnProperty(i)) { this._data.massload[i] = data[i]; } } } for(i = 0, j = nodes.length; i < j; i++) { dom = this.get_node(nodes[i], true); if (dom && dom.length) { dom.removeClass("jstree-loading").attr('aria-busy',false); } } parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); }, this)) .fail($.proxy(function (f) { parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); }, this)); } } } return parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); }; this._load_node = function (obj, callback) { var data = this._data.massload[obj.id], rslt = null, dom; if(data) { rslt = this[typeof data === 'string' ? '_append_html_data' : '_append_json_data']( obj, typeof data === 'string' ? $($.parseHTML(data)).filter(function () { return this.nodeType !== 3; }) : data, function (status) { callback.call(this, status); } ); dom = this.get_node(obj.id, true); if (dom && dom.length) { dom.removeClass("jstree-loading").attr('aria-busy',false); } delete this._data.massload[obj.id]; return rslt; } return parent._load_node.call(this, obj, callback); }; }; /** * ### Search plugin * * Adds search functionality to jsTree. */ /** * stores all defaults for the search plugin * @name $.jstree.defaults.search * @plugin search */ $.jstree.defaults.search = { /** * a jQuery-like AJAX config, which jstree uses if a server should be queried for results. * * A `str` (which is the search string) parameter will be added with the request, an optional `inside` parameter will be added if the search is limited to a node id. The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed. * Leave this setting as `false` to not query the server. You can also set this to a function, which will be invoked in the instance's scope and receive 3 parameters - the search string, the callback to call with the array of nodes to load, and the optional node ID to limit the search to * @name $.jstree.defaults.search.ajax * @plugin search */ ajax : false, /** * Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `false`. * @name $.jstree.defaults.search.fuzzy * @plugin search */ fuzzy : false, /** * Indicates if the search should be case sensitive. Default is `false`. * @name $.jstree.defaults.search.case_sensitive * @plugin search */ case_sensitive : false, /** * Indicates if the tree should be filtered (by default) to show only matching nodes (keep in mind this can be a heavy on large trees in old browsers). * This setting can be changed at runtime when calling the search method. Default is `false`. * @name $.jstree.defaults.search.show_only_matches * @plugin search */ show_only_matches : false, /** * Indicates if the children of matched element are shown (when show_only_matches is true) * This setting can be changed at runtime when calling the search method. Default is `false`. * @name $.jstree.defaults.search.show_only_matches_children * @plugin search */ show_only_matches_children : false, /** * Indicates if all nodes opened to reveal the search result, should be closed when the search is cleared or a new search is performed. Default is `true`. * @name $.jstree.defaults.search.close_opened_onclear * @plugin search */ close_opened_onclear : true, /** * Indicates if only leaf nodes should be included in search results. Default is `false`. * @name $.jstree.defaults.search.search_leaves_only * @plugin search */ search_leaves_only : false, /** * If set to a function it wil be called in the instance's scope with two arguments - search string and node (where node will be every node in the structure, so use with caution). * If the function returns a truthy value the node will be considered a match (it might not be displayed if search_only_leaves is set to true and the node is not a leaf). Default is `false`. * @name $.jstree.defaults.search.search_callback * @plugin search */ search_callback : false }; $.jstree.plugins.search = function (options, parent) { this.bind = function () { parent.bind.call(this); this._data.search.str = ""; this._data.search.dom = $(); this._data.search.res = []; this._data.search.opn = []; this._data.search.som = false; this._data.search.smc = false; this._data.search.hdn = []; this.element .on("search.jstree", $.proxy(function (e, data) { if(this._data.search.som && data.res.length) { var m = this._model.data, i, j, p = [], k, l; for(i = 0, j = data.res.length; i < j; i++) { if(m[data.res[i]] && !m[data.res[i]].state.hidden) { p.push(data.res[i]); p = p.concat(m[data.res[i]].parents); if(this._data.search.smc) { for (k = 0, l = m[data.res[i]].children_d.length; k < l; k++) { if (m[m[data.res[i]].children_d[k]] && !m[m[data.res[i]].children_d[k]].state.hidden) { p.push(m[data.res[i]].children_d[k]); } } } } } p = $.vakata.array_remove_item($.vakata.array_unique(p), $.jstree.root); this._data.search.hdn = this.hide_all(true); this.show_node(p, true); this.redraw(true); } }, this)) .on("clear_search.jstree", $.proxy(function (e, data) { if(this._data.search.som && data.res.length) { this.show_node(this._data.search.hdn, true); this.redraw(true); } }, this)); }; /** * used to search the tree nodes for a given string * @name search(str [, skip_async]) * @param {String} str the search string * @param {Boolean} skip_async if set to true server will not be queried even if configured * @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers) * @param {mixed} inside an optional node to whose children to limit the search * @param {Boolean} append if set to true the results of this search are appended to the previous search * @plugin search * @trigger search.jstree */ this.search = function (str, skip_async, show_only_matches, inside, append, show_only_matches_children) { if(str === false || $.trim(str.toString()) === "") { return this.clear_search(); } inside = this.get_node(inside); inside = inside && inside.id ? inside.id : null; str = str.toString(); var s = this.settings.search, a = s.ajax ? s.ajax : false, m = this._model.data, f = null, r = [], p = [], i, j; if(this._data.search.res.length && !append) { this.clear_search(); } if(show_only_matches === undefined) { show_only_matches = s.show_only_matches; } if(show_only_matches_children === undefined) { show_only_matches_children = s.show_only_matches_children; } if(!skip_async && a !== false) { if($.isFunction(a)) { return a.call(this, str, $.proxy(function (d) { if(d && d.d) { d = d.d; } this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () { this.search(str, true, show_only_matches, inside, append, show_only_matches_children); }); }, this), inside); } else { a = $.extend({}, a); if(!a.data) { a.data = {}; } a.data.str = str; if(inside) { a.data.inside = inside; } if (this._data.search.lastRequest) { this._data.search.lastRequest.abort(); } this._data.search.lastRequest = $.ajax(a) .fail($.proxy(function () { this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'search', 'id' : 'search_01', 'reason' : 'Could not load search parents', 'data' : JSON.stringify(a) }; this.settings.core.error.call(this, this._data.core.last_error); }, this)) .done($.proxy(function (d) { if(d && d.d) { d = d.d; } this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () { this.search(str, true, show_only_matches, inside, append, show_only_matches_children); }); }, this)); return this._data.search.lastRequest; } } if(!append) { this._data.search.str = str; this._data.search.dom = $(); this._data.search.res = []; this._data.search.opn = []; this._data.search.som = show_only_matches; this._data.search.smc = show_only_matches_children; } f = new $.vakata.search(str, true, { caseSensitive : s.case_sensitive, fuzzy : s.fuzzy }); $.each(m[inside ? inside : $.jstree.root].children_d, function (ii, i) { var v = m[i]; if(v.text && !v.state.hidden && (!s.search_leaves_only || (v.state.loaded && v.children.length === 0)) && ( (s.search_callback && s.search_callback.call(this, str, v)) || (!s.search_callback && f.search(v.text).isMatch) ) ) { r.push(i); p = p.concat(v.parents); } }); if(r.length) { p = $.vakata.array_unique(p); for(i = 0, j = p.length; i < j; i++) { if(p[i] !== $.jstree.root && m[p[i]] && this.open_node(p[i], null, 0) === true) { this._data.search.opn.push(p[i]); } } if(!append) { this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #'))); this._data.search.res = r; } else { this._data.search.dom = this._data.search.dom.add($(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #')))); this._data.search.res = $.vakata.array_unique(this._data.search.res.concat(r)); } this._data.search.dom.children(".jstree-anchor").addClass('jstree-search'); } /** * triggered after search is complete * @event * @name search.jstree * @param {jQuery} nodes a jQuery collection of matching nodes * @param {String} str the search string * @param {Array} res a collection of objects represeing the matching nodes * @plugin search */ this.trigger('search', { nodes : this._data.search.dom, str : str, res : this._data.search.res, show_only_matches : show_only_matches }); }; /** * used to clear the last search (removes classes and shows all nodes if filtering is on) * @name clear_search() * @plugin search * @trigger clear_search.jstree */ this.clear_search = function () { if(this.settings.search.close_opened_onclear) { this.close_node(this._data.search.opn, 0); } /** * triggered after search is complete * @event * @name clear_search.jstree * @param {jQuery} nodes a jQuery collection of matching nodes (the result from the last search) * @param {String} str the search string (the last search string) * @param {Array} res a collection of objects represeing the matching nodes (the result from the last search) * @plugin search */ this.trigger('clear_search', { 'nodes' : this._data.search.dom, str : this._data.search.str, res : this._data.search.res }); if(this._data.search.res.length) { this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(this._data.search.res, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #'))); this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search"); } this._data.search.str = ""; this._data.search.res = []; this._data.search.opn = []; this._data.search.dom = $(); }; this.redraw_node = function(obj, deep, callback, force_render) { obj = parent.redraw_node.apply(this, arguments); if(obj) { if($.inArray(obj.id, this._data.search.res) !== -1) { var i, j, tmp = null; for(i = 0, j = obj.childNodes.length; i < j; i++) { if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { tmp = obj.childNodes[i]; break; } } if(tmp) { tmp.className += ' jstree-search'; } } } return obj; }; }; // helpers (function ($) { // from http://kiro.me/projects/fuse.html $.vakata.search = function(pattern, txt, options) { options = options || {}; options = $.extend({}, $.vakata.search.defaults, options); if(options.fuzzy !== false) { options.fuzzy = true; } pattern = options.caseSensitive ? pattern : pattern.toLowerCase(); var MATCH_LOCATION = options.location, MATCH_DISTANCE = options.distance, MATCH_THRESHOLD = options.threshold, patternLen = pattern.length, matchmask, pattern_alphabet, match_bitapScore, search; if(patternLen > 32) { options.fuzzy = false; } if(options.fuzzy) { matchmask = 1 << (patternLen - 1); pattern_alphabet = (function () { var mask = {}, i = 0; for (i = 0; i < patternLen; i++) { mask[pattern.charAt(i)] = 0; } for (i = 0; i < patternLen; i++) { mask[pattern.charAt(i)] |= 1 << (patternLen - i - 1); } return mask; }()); match_bitapScore = function (e, x) { var accuracy = e / patternLen, proximity = Math.abs(MATCH_LOCATION - x); if(!MATCH_DISTANCE) { return proximity ? 1.0 : accuracy; } return accuracy + (proximity / MATCH_DISTANCE); }; } search = function (text) { text = options.caseSensitive ? text : text.toLowerCase(); if(pattern === text || text.indexOf(pattern) !== -1) { return { isMatch: true, score: 0 }; } if(!options.fuzzy) { return { isMatch: false, score: 1 }; } var i, j, textLen = text.length, scoreThreshold = MATCH_THRESHOLD, bestLoc = text.indexOf(pattern, MATCH_LOCATION), binMin, binMid, binMax = patternLen + textLen, lastRd, start, finish, rd, charMatch, score = 1, locations = []; if (bestLoc !== -1) { scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold); bestLoc = text.lastIndexOf(pattern, MATCH_LOCATION + patternLen); if (bestLoc !== -1) { scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold); } } bestLoc = -1; for (i = 0; i < patternLen; i++) { binMin = 0; binMid = binMax; while (binMin < binMid) { if (match_bitapScore(i, MATCH_LOCATION + binMid) <= scoreThreshold) { binMin = binMid; } else { binMax = binMid; } binMid = Math.floor((binMax - binMin) / 2 + binMin); } binMax = binMid; start = Math.max(1, MATCH_LOCATION - binMid + 1); finish = Math.min(MATCH_LOCATION + binMid, textLen) + patternLen; rd = new Array(finish + 2); rd[finish + 1] = (1 << i) - 1; for (j = finish; j >= start; j--) { charMatch = pattern_alphabet[text.charAt(j - 1)]; if (i === 0) { rd[j] = ((rd[j + 1] << 1) | 1) & charMatch; } else { rd[j] = ((rd[j + 1] << 1) | 1) & charMatch | (((lastRd[j + 1] | lastRd[j]) << 1) | 1) | lastRd[j + 1]; } if (rd[j] & matchmask) { score = match_bitapScore(i, j - 1); if (score <= scoreThreshold) { scoreThreshold = score; bestLoc = j - 1; locations.push(bestLoc); if (bestLoc > MATCH_LOCATION) { start = Math.max(1, 2 * MATCH_LOCATION - bestLoc); } else { break; } } } } if (match_bitapScore(i + 1, MATCH_LOCATION) > scoreThreshold) { break; } lastRd = rd; } return { isMatch: bestLoc >= 0, score: score }; }; return txt === true ? { 'search' : search } : search(txt); }; $.vakata.search.defaults = { location : 0, distance : 100, threshold : 0.6, fuzzy : false, caseSensitive : false }; }($)); // include the search plugin by default // $.jstree.defaults.plugins.push("search"); /** * ### Sort plugin * * Automatically sorts all siblings in the tree according to a sorting function. */ /** * the settings function used to sort the nodes. * It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`. * @name $.jstree.defaults.sort * @plugin sort */ $.jstree.defaults.sort = function (a, b) { //return this.get_type(a) === this.get_type(b) ? (this.get_text(a) > this.get_text(b) ? 1 : -1) : this.get_type(a) >= this.get_type(b); return this.get_text(a) > this.get_text(b) ? 1 : -1; }; $.jstree.plugins.sort = function (options, parent) { this.bind = function () { parent.bind.call(this); this.element .on("model.jstree", $.proxy(function (e, data) { this.sort(data.parent, true); }, this)) .on("rename_node.jstree create_node.jstree", $.proxy(function (e, data) { this.sort(data.parent || data.node.parent, false); this.redraw_node(data.parent || data.node.parent, true); }, this)) .on("move_node.jstree copy_node.jstree", $.proxy(function (e, data) { this.sort(data.parent, false); this.redraw_node(data.parent, true); }, this)); }; /** * used to sort a node's children * @private * @name sort(obj [, deep]) * @param {mixed} obj the node * @param {Boolean} deep if set to `true` nodes are sorted recursively. * @plugin sort * @trigger search.jstree */ this.sort = function (obj, deep) { var i, j; obj = this.get_node(obj); if(obj && obj.children && obj.children.length) { obj.children.sort($.proxy(this.settings.sort, this)); if(deep) { for(i = 0, j = obj.children_d.length; i < j; i++) { this.sort(obj.children_d[i], false); } } } }; }; // include the sort plugin by default // $.jstree.defaults.plugins.push("sort"); /** * ### State plugin * * Saves the state of the tree (selected nodes, opened nodes) on the user's computer using available options (localStorage, cookies, etc) */ var to = false; /** * stores all defaults for the state plugin * @name $.jstree.defaults.state * @plugin state */ $.jstree.defaults.state = { /** * A string for the key to use when saving the current tree (change if using multiple trees in your project). Defaults to `jstree`. * @name $.jstree.defaults.state.key * @plugin state */ key : 'jstree', /** * A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`. * @name $.jstree.defaults.state.events * @plugin state */ events : 'changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree', /** * Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire. * @name $.jstree.defaults.state.ttl * @plugin state */ ttl : false, /** * A function that will be executed prior to restoring state with one argument - the state object. Can be used to clear unwanted parts of the state. * @name $.jstree.defaults.state.filter * @plugin state */ filter : false, /** * Should loaded nodes be restored (setting this to true means that it is possible that the whole tree will be loaded for some users - use with caution). Defaults to `false` * @name $.jstree.defaults.state.preserve_loaded * @plugin state */ preserve_loaded : false }; $.jstree.plugins.state = function (options, parent) { this.bind = function () { parent.bind.call(this); var bind = $.proxy(function () { this.element.on(this.settings.state.events, $.proxy(function () { if(to) { clearTimeout(to); } to = setTimeout($.proxy(function () { this.save_state(); }, this), 100); }, this)); /** * triggered when the state plugin is finished restoring the state (and immediately after ready if there is no state to restore). * @event * @name state_ready.jstree * @plugin state */ this.trigger('state_ready'); }, this); this.element .on("ready.jstree", $.proxy(function (e, data) { this.element.one("restore_state.jstree", bind); if(!this.restore_state()) { bind(); } }, this)); }; /** * save the state * @name save_state() * @plugin state */ this.save_state = function () { var tm = this.get_state(); if (!this.settings.state.preserve_loaded) { delete tm.core.loaded; } var st = { 'state' : tm, 'ttl' : this.settings.state.ttl, 'sec' : +(new Date()) }; $.vakata.storage.set(this.settings.state.key, JSON.stringify(st)); }; /** * restore the state from the user's computer * @name restore_state() * @plugin state */ this.restore_state = function () { var k = $.vakata.storage.get(this.settings.state.key); if(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } } if(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; } if(!!k && k.state) { k = k.state; } if(!!k && $.isFunction(this.settings.state.filter)) { k = this.settings.state.filter.call(this, k); } if(!!k) { if (!this.settings.state.preserve_loaded) { delete k.core.loaded; } this.element.one("set_state.jstree", function (e, data) { data.instance.trigger('restore_state', { 'state' : $.extend(true, {}, k) }); }); this.set_state(k); return true; } return false; }; /** * clear the state on the user's computer * @name clear_state() * @plugin state */ this.clear_state = function () { return $.vakata.storage.del(this.settings.state.key); }; }; (function ($, undefined) { $.vakata.storage = { // simply specifying the functions in FF throws an error set : function (key, val) { return window.localStorage.setItem(key, val); }, get : function (key) { return window.localStorage.getItem(key); }, del : function (key) { return window.localStorage.removeItem(key); } }; }($)); // include the state plugin by default // $.jstree.defaults.plugins.push("state"); /** * ### Types plugin * * Makes it possible to add predefined types for groups of nodes, which make it possible to easily control nesting rules and icon for each group. */ /** * An object storing all types as key value pairs, where the key is the type name and the value is an object that could contain following keys (all optional). * * * `max_children` the maximum number of immediate children this node type can have. Do not specify or set to `-1` for unlimited. * * `max_depth` the maximum number of nesting this node type can have. A value of `1` would mean that the node can have children, but no grandchildren. Do not specify or set to `-1` for unlimited. * * `valid_children` an array of node type strings, that nodes of this type can have as children. Do not specify or set to `-1` for no limits. * * `icon` a string - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class. Omit to use the default icon from your theme. * * `li_attr` an object of values which will be used to add HTML attributes on the resulting LI DOM node (merged with the node's own data) * * `a_attr` an object of values which will be used to add HTML attributes on the resulting A DOM node (merged with the node's own data) * * There are two predefined types: * * * `#` represents the root of the tree, for example `max_children` would control the maximum number of root nodes. * * `default` represents the default node - any settings here will be applied to all nodes that do not have a type specified. * * @name $.jstree.defaults.types * @plugin types */ $.jstree.defaults.types = { 'default' : {} }; $.jstree.defaults.types[$.jstree.root] = {}; $.jstree.plugins.types = function (options, parent) { this.init = function (el, options) { var i, j; if(options && options.types && options.types['default']) { for(i in options.types) { if(i !== "default" && i !== $.jstree.root && options.types.hasOwnProperty(i)) { for(j in options.types['default']) { if(options.types['default'].hasOwnProperty(j) && options.types[i][j] === undefined) { options.types[i][j] = options.types['default'][j]; } } } } } parent.init.call(this, el, options); this._model.data[$.jstree.root].type = $.jstree.root; }; this.refresh = function (skip_loading, forget_state) { parent.refresh.call(this, skip_loading, forget_state); this._model.data[$.jstree.root].type = $.jstree.root; }; this.bind = function () { this.element .on('model.jstree', $.proxy(function (e, data) { var m = this._model.data, dpc = data.nodes, t = this.settings.types, i, j, c = 'default', k; for(i = 0, j = dpc.length; i < j; i++) { c = 'default'; if(m[dpc[i]].original && m[dpc[i]].original.type && t[m[dpc[i]].original.type]) { c = m[dpc[i]].original.type; } if(m[dpc[i]].data && m[dpc[i]].data.jstree && m[dpc[i]].data.jstree.type && t[m[dpc[i]].data.jstree.type]) { c = m[dpc[i]].data.jstree.type; } m[dpc[i]].type = c; if(m[dpc[i]].icon === true && t[c].icon !== undefined) { m[dpc[i]].icon = t[c].icon; } if(t[c].li_attr !== undefined && typeof t[c].li_attr === 'object') { for (k in t[c].li_attr) { if (t[c].li_attr.hasOwnProperty(k)) { if (k === 'id') { continue; } else if (m[dpc[i]].li_attr[k] === undefined) { m[dpc[i]].li_attr[k] = t[c].li_attr[k]; } else if (k === 'class') { m[dpc[i]].li_attr['class'] = t[c].li_attr['class'] + ' ' + m[dpc[i]].li_attr['class']; } } } } if(t[c].a_attr !== undefined && typeof t[c].a_attr === 'object') { for (k in t[c].a_attr) { if (t[c].a_attr.hasOwnProperty(k)) { if (k === 'id') { continue; } else if (m[dpc[i]].a_attr[k] === undefined) { m[dpc[i]].a_attr[k] = t[c].a_attr[k]; } else if (k === 'href' && m[dpc[i]].a_attr[k] === '#') { m[dpc[i]].a_attr['href'] = t[c].a_attr['href']; } else if (k === 'class') { m[dpc[i]].a_attr['class'] = t[c].a_attr['class'] + ' ' + m[dpc[i]].a_attr['class']; } } } } } m[$.jstree.root].type = $.jstree.root; }, this)); parent.bind.call(this); }; this.get_json = function (obj, options, flat) { var i, j, m = this._model.data, opt = options ? $.extend(true, {}, options, {no_id:false}) : {}, tmp = parent.get_json.call(this, obj, opt, flat); if(tmp === false) { return false; } if($.isArray(tmp)) { for(i = 0, j = tmp.length; i < j; i++) { tmp[i].type = tmp[i].id && m[tmp[i].id] && m[tmp[i].id].type ? m[tmp[i].id].type : "default"; if(options && options.no_id) { delete tmp[i].id; if(tmp[i].li_attr && tmp[i].li_attr.id) { delete tmp[i].li_attr.id; } if(tmp[i].a_attr && tmp[i].a_attr.id) { delete tmp[i].a_attr.id; } } } } else { tmp.type = tmp.id && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : "default"; if(options && options.no_id) { tmp = this._delete_ids(tmp); } } return tmp; }; this._delete_ids = function (tmp) { if($.isArray(tmp)) { for(var i = 0, j = tmp.length; i < j; i++) { tmp[i] = this._delete_ids(tmp[i]); } return tmp; } delete tmp.id; if(tmp.li_attr && tmp.li_attr.id) { delete tmp.li_attr.id; } if(tmp.a_attr && tmp.a_attr.id) { delete tmp.a_attr.id; } if(tmp.children && $.isArray(tmp.children)) { tmp.children = this._delete_ids(tmp.children); } return tmp; }; this.check = function (chk, obj, par, pos, more) { if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; } obj = obj && obj.id ? obj : this.get_node(obj); par = par && par.id ? par : this.get_node(par); var m = obj && obj.id ? (more && more.origin ? more.origin : $.jstree.reference(obj.id)) : null, tmp, d, i, j; m = m && m._model && m._model.data ? m._model.data : null; switch(chk) { case "create_node": case "move_node": case "copy_node": if(chk !== 'move_node' || $.inArray(obj.id, par.children) === -1) { tmp = this.get_rules(par); if(tmp.max_children !== undefined && tmp.max_children !== -1 && tmp.max_children === par.children.length) { this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_01', 'reason' : 'max_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; return false; } if(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray((obj.type || 'default'), tmp.valid_children) === -1) { this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_02', 'reason' : 'valid_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; return false; } if(m && obj.children_d && obj.parents) { d = 0; for(i = 0, j = obj.children_d.length; i < j; i++) { d = Math.max(d, m[obj.children_d[i]].parents.length); } d = d - obj.parents.length + 1; } if(d <= 0 || d === undefined) { d = 1; } do { if(tmp.max_depth !== undefined && tmp.max_depth !== -1 && tmp.max_depth < d) { this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_03', 'reason' : 'max_depth prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; return false; } par = this.get_node(par.parent); tmp = this.get_rules(par); d++; } while(par); } break; } return true; }; /** * used to retrieve the type settings object for a node * @name get_rules(obj) * @param {mixed} obj the node to find the rules for * @return {Object} * @plugin types */ this.get_rules = function (obj) { obj = this.get_node(obj); if(!obj) { return false; } var tmp = this.get_type(obj, true); if(tmp.max_depth === undefined) { tmp.max_depth = -1; } if(tmp.max_children === undefined) { tmp.max_children = -1; } if(tmp.valid_children === undefined) { tmp.valid_children = -1; } return tmp; }; /** * used to retrieve the type string or settings object for a node * @name get_type(obj [, rules]) * @param {mixed} obj the node to find the rules for * @param {Boolean} rules if set to `true` instead of a string the settings object will be returned * @return {String|Object} * @plugin types */ this.get_type = function (obj, rules) { obj = this.get_node(obj); return (!obj) ? false : ( rules ? $.extend({ 'type' : obj.type }, this.settings.types[obj.type]) : obj.type); }; /** * used to change a node's type * @name set_type(obj, type) * @param {mixed} obj the node to change * @param {String} type the new type * @plugin types */ this.set_type = function (obj, type) { var m = this._model.data, t, t1, t2, old_type, old_icon, k, d, a; if($.isArray(obj)) { obj = obj.slice(); for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { this.set_type(obj[t1], type); } return true; } t = this.settings.types; obj = this.get_node(obj); if(!t[type] || !obj) { return false; } d = this.get_node(obj, true); if (d && d.length) { a = d.children('.jstree-anchor'); } old_type = obj.type; old_icon = this.get_icon(obj); obj.type = type; if(old_icon === true || !t[old_type] || (t[old_type].icon !== undefined && old_icon === t[old_type].icon)) { this.set_icon(obj, t[type].icon !== undefined ? t[type].icon : true); } // remove old type props if(t[old_type] && t[old_type].li_attr !== undefined && typeof t[old_type].li_attr === 'object') { for (k in t[old_type].li_attr) { if (t[old_type].li_attr.hasOwnProperty(k)) { if (k === 'id') { continue; } else if (k === 'class') { m[obj.id].li_attr['class'] = (m[obj.id].li_attr['class'] || '').replace(t[old_type].li_attr[k], ''); if (d) { d.removeClass(t[old_type].li_attr[k]); } } else if (m[obj.id].li_attr[k] === t[old_type].li_attr[k]) { m[obj.id].li_attr[k] = null; if (d) { d.removeAttr(k); } } } } } if(t[old_type] && t[old_type].a_attr !== undefined && typeof t[old_type].a_attr === 'object') { for (k in t[old_type].a_attr) { if (t[old_type].a_attr.hasOwnProperty(k)) { if (k === 'id') { continue; } else if (k === 'class') { m[obj.id].a_attr['class'] = (m[obj.id].a_attr['class'] || '').replace(t[old_type].a_attr[k], ''); if (a) { a.removeClass(t[old_type].a_attr[k]); } } else if (m[obj.id].a_attr[k] === t[old_type].a_attr[k]) { if (k === 'href') { m[obj.id].a_attr[k] = '#'; if (a) { a.attr('href', '#'); } } else { delete m[obj.id].a_attr[k]; if (a) { a.removeAttr(k); } } } } } } // add new props if(t[type].li_attr !== undefined && typeof t[type].li_attr === 'object') { for (k in t[type].li_attr) { if (t[type].li_attr.hasOwnProperty(k)) { if (k === 'id') { continue; } else if (m[obj.id].li_attr[k] === undefined) { m[obj.id].li_attr[k] = t[type].li_attr[k]; if (d) { if (k === 'class') { d.addClass(t[type].li_attr[k]); } else { d.attr(k, t[type].li_attr[k]); } } } else if (k === 'class') { m[obj.id].li_attr['class'] = t[type].li_attr[k] + ' ' + m[obj.id].li_attr['class']; if (d) { d.addClass(t[type].li_attr[k]); } } } } } if(t[type].a_attr !== undefined && typeof t[type].a_attr === 'object') { for (k in t[type].a_attr) { if (t[type].a_attr.hasOwnProperty(k)) { if (k === 'id') { continue; } else if (m[obj.id].a_attr[k] === undefined) { m[obj.id].a_attr[k] = t[type].a_attr[k]; if (a) { if (k === 'class') { a.addClass(t[type].a_attr[k]); } else { a.attr(k, t[type].a_attr[k]); } } } else if (k === 'href' && m[obj.id].a_attr[k] === '#') { m[obj.id].a_attr['href'] = t[type].a_attr['href']; if (a) { a.attr('href', t[type].a_attr['href']); } } else if (k === 'class') { m[obj.id].a_attr['class'] = t[type].a_attr['class'] + ' ' + m[obj.id].a_attr['class']; if (a) { a.addClass(t[type].a_attr[k]); } } } } } return true; }; }; // include the types plugin by default // $.jstree.defaults.plugins.push("types"); /** * ### Unique plugin * * Enforces that no nodes with the same name can coexist as siblings. */ /** * stores all defaults for the unique plugin * @name $.jstree.defaults.unique * @plugin unique */ $.jstree.defaults.unique = { /** * Indicates if the comparison should be case sensitive. Default is `false`. * @name $.jstree.defaults.unique.case_sensitive * @plugin unique */ case_sensitive : false, /** * Indicates if white space should be trimmed before the comparison. Default is `false`. * @name $.jstree.defaults.unique.trim_whitespace * @plugin unique */ trim_whitespace : false, /** * A callback executed in the instance's scope when a new node is created and the name is already taken, the two arguments are the conflicting name and the counter. The default will produce results like `New node (2)`. * @name $.jstree.defaults.unique.duplicate * @plugin unique */ duplicate : function (name, counter) { return name + ' (' + counter + ')'; } }; $.jstree.plugins.unique = function (options, parent) { this.check = function (chk, obj, par, pos, more) { if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; } obj = obj && obj.id ? obj : this.get_node(obj); par = par && par.id ? par : this.get_node(par); if(!par || !par.children) { return true; } var n = chk === "rename_node" ? pos : obj.text, c = [], s = this.settings.unique.case_sensitive, w = this.settings.unique.trim_whitespace, m = this._model.data, i, j, t; for(i = 0, j = par.children.length; i < j; i++) { t = m[par.children[i]].text; if (!s) { t = t.toLowerCase(); } if (w) { t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } c.push(t); } if(!s) { n = n.toLowerCase(); } if (w) { n = n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } switch(chk) { case "delete_node": return true; case "rename_node": t = obj.text || ''; if (!s) { t = t.toLowerCase(); } if (w) { t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } i = ($.inArray(n, c) === -1 || (obj.text && t === n)); if(!i) { this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_01', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; } return i; case "create_node": i = ($.inArray(n, c) === -1); if(!i) { this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_04', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; } return i; case "copy_node": i = ($.inArray(n, c) === -1); if(!i) { this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_02', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; } return i; case "move_node": i = ( (obj.parent === par.id && (!more || !more.is_multi)) || $.inArray(n, c) === -1); if(!i) { this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_03', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; } return i; } return true; }; this.create_node = function (par, node, pos, callback, is_loaded) { if(!node || node.text === undefined) { if(par === null) { par = $.jstree.root; } par = this.get_node(par); if(!par) { return parent.create_node.call(this, par, node, pos, callback, is_loaded); } pos = pos === undefined ? "last" : pos; if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { return parent.create_node.call(this, par, node, pos, callback, is_loaded); } if(!node) { node = {}; } var tmp, n, dpc, i, j, m = this._model.data, s = this.settings.unique.case_sensitive, w = this.settings.unique.trim_whitespace, cb = this.settings.unique.duplicate, t; n = tmp = this.get_string('New node'); dpc = []; for(i = 0, j = par.children.length; i < j; i++) { t = m[par.children[i]].text; if (!s) { t = t.toLowerCase(); } if (w) { t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } dpc.push(t); } i = 1; t = n; if (!s) { t = t.toLowerCase(); } if (w) { t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } while($.inArray(t, dpc) !== -1) { n = cb.call(this, tmp, (++i)).toString(); t = n; if (!s) { t = t.toLowerCase(); } if (w) { t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } } node.text = n; } return parent.create_node.call(this, par, node, pos, callback, is_loaded); }; }; // include the unique plugin by default // $.jstree.defaults.plugins.push("unique"); /** * ### Wholerow plugin * * Makes each node appear block level. Making selection easier. May cause slow down for large trees in old browsers. */ var div = document.createElement('DIV'); div.setAttribute('unselectable','on'); div.setAttribute('role','presentation'); div.className = 'jstree-wholerow'; div.innerHTML = ' '; $.jstree.plugins.wholerow = function (options, parent) { this.bind = function () { parent.bind.call(this); this.element .on('ready.jstree set_state.jstree', $.proxy(function () { this.hide_dots(); }, this)) .on("init.jstree loading.jstree ready.jstree", $.proxy(function () { //div.style.height = this._data.core.li_height + 'px'; this.get_container_ul().addClass('jstree-wholerow-ul'); }, this)) .on("deselect_all.jstree", $.proxy(function (e, data) { this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked'); }, this)) .on("changed.jstree", $.proxy(function (e, data) { this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked'); var tmp = false, i, j; for(i = 0, j = data.selected.length; i < j; i++) { tmp = this.get_node(data.selected[i], true); if(tmp && tmp.length) { tmp.children('.jstree-wholerow').addClass('jstree-wholerow-clicked'); } } }, this)) .on("open_node.jstree", $.proxy(function (e, data) { this.get_node(data.node, true).find('.jstree-clicked').parent().children('.jstree-wholerow').addClass('jstree-wholerow-clicked'); }, this)) .on("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) { if(e.type === "hover_node" && this.is_disabled(data.node)) { return; } this.get_node(data.node, true).children('.jstree-wholerow')[e.type === "hover_node"?"addClass":"removeClass"]('jstree-wholerow-hovered'); }, this)) .on("contextmenu.jstree", ".jstree-wholerow", $.proxy(function (e) { if (this._data.contextmenu) { e.preventDefault(); var tmp = $.Event('contextmenu', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey, pageX : e.pageX, pageY : e.pageY }); $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp); } }, this)) /*! .on("mousedown.jstree touchstart.jstree", ".jstree-wholerow", function (e) { if(e.target === e.currentTarget) { var a = $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor"); e.target = a[0]; a.trigger(e); } }) */ .on("click.jstree", ".jstree-wholerow", function (e) { e.stopImmediatePropagation(); var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); }) .on("dblclick.jstree", ".jstree-wholerow", function (e) { e.stopImmediatePropagation(); var tmp = $.Event('dblclick', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); }) .on("click.jstree", ".jstree-leaf > .jstree-ocl", $.proxy(function (e) { e.stopImmediatePropagation(); var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); }, this)) .on("mouseover.jstree", ".jstree-wholerow, .jstree-icon", $.proxy(function (e) { e.stopImmediatePropagation(); if(!this.is_disabled(e.currentTarget)) { this.hover_node(e.currentTarget); } return false; }, this)) .on("mouseleave.jstree", ".jstree-node", $.proxy(function (e) { this.dehover_node(e.currentTarget); }, this)); }; this.teardown = function () { if(this.settings.wholerow) { this.element.find(".jstree-wholerow").remove(); } parent.teardown.call(this); }; this.redraw_node = function(obj, deep, callback, force_render) { obj = parent.redraw_node.apply(this, arguments); if(obj) { var tmp = div.cloneNode(true); //tmp.style.height = this._data.core.li_height + 'px'; if($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicked'; } if(this._data.core.focused && this._data.core.focused === obj.id) { tmp.className += ' jstree-wholerow-hovered'; } obj.insertBefore(tmp, obj.childNodes[0]); } return obj; }; }; // include the wholerow plugin by default // $.jstree.defaults.plugins.push("wholerow"); if(window.customElements && Object && Object.create) { var proto = Object.create(HTMLElement.prototype); proto.createdCallback = function () { var c = { core : {}, plugins : [] }, i; for(i in $.jstree.plugins) { if($.jstree.plugins.hasOwnProperty(i) && this.attributes[i]) { c.plugins.push(i); if(this.getAttribute(i) && JSON.parse(this.getAttribute(i))) { c[i] = JSON.parse(this.getAttribute(i)); } } } for(i in $.jstree.defaults.core) { if($.jstree.defaults.core.hasOwnProperty(i) && this.attributes[i]) { c.core[i] = JSON.parse(this.getAttribute(i)) || this.getAttribute(i); } } $(this).jstree(c); }; // proto.attributeChangedCallback = function (name, previous, value) { }; try { window.customElements.define("vakata-jstree", function() {}, { prototype: proto }); } catch (ignore) { } } })); /***/ }, /***/ 8336 /*!***********************************************************!*\ !*** ./node_modules/jstree/dist/themes/default/style.css ***! \***********************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); // extracted by mini-css-extract-plugin /***/ }, /***/ 2395 /*!***************************************************!*\ !*** ./node_modules/select2/dist/css/select2.css ***! \***************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); // extracted by mini-css-extract-plugin /***/ }, /***/ 6409 /*!************************************************!*\ !*** ./node_modules/parsleyjs/dist/parsley.js ***! \************************************************/ (module, __unused_webpack_exports, __webpack_require__) { /*! * Parsley.js * Version 2.9.2 - built Tue, Dec 10th 2019, 6:18 pm * http://parsleyjs.org * Guillaume Potier - <guillaume@wisembly.com> * Marc-Andre Lafortune - <petroselinum@marc-andre.ca> * MIT Licensed */ // The source code below is generated by babel as // Parsley is written in ECMAScript 6 // (function (global, factory) { true ? module.exports = factory(__webpack_require__(/*! jquery */ 428)) : 0; }(this, (function ($) { 'use strict'; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } var globalID = 1; var pastWarnings = {}; var Utils = { // Parsley DOM-API // returns object from dom attributes and values attr: function attr(element, namespace, obj) { var i; var attribute; var attributes; var regex = new RegExp('^' + namespace, 'i'); if ('undefined' === typeof obj) obj = {};else { // Clear all own properties. This won't affect prototype's values for (i in obj) { if (obj.hasOwnProperty(i)) delete obj[i]; } } if (!element) return obj; attributes = element.attributes; for (i = attributes.length; i--;) { attribute = attributes[i]; if (attribute && attribute.specified && regex.test(attribute.name)) { obj[this.camelize(attribute.name.slice(namespace.length))] = this.deserializeValue(attribute.value); } } return obj; }, checkAttr: function checkAttr(element, namespace, _checkAttr) { return element.hasAttribute(namespace + _checkAttr); }, setAttr: function setAttr(element, namespace, attr, value) { element.setAttribute(this.dasherize(namespace + attr), String(value)); }, getType: function getType(element) { return element.getAttribute('type') || 'text'; }, generateID: function generateID() { return '' + globalID++; }, /** Third party functions **/ deserializeValue: function deserializeValue(value) { var num; try { return value ? value == "true" || (value == "false" ? false : value == "null" ? null : !isNaN(num = Number(value)) ? num : /^[\[\{]/.test(value) ? JSON.parse(value) : value) : value; } catch (e) { return value; } }, // Zepto camelize function camelize: function camelize(str) { return str.replace(/-+(.)?/g, function (match, chr) { return chr ? chr.toUpperCase() : ''; }); }, // Zepto dasherize function dasherize: function dasherize(str) { return str.replace(/::/g, '/').replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2').replace(/([a-z\d])([A-Z])/g, '$1_$2').replace(/_/g, '-').toLowerCase(); }, warn: function warn() { var _window$console; if (window.console && 'function' === typeof window.console.warn) (_window$console = window.console).warn.apply(_window$console, arguments); }, warnOnce: function warnOnce(msg) { if (!pastWarnings[msg]) { pastWarnings[msg] = true; this.warn.apply(this, arguments); } }, _resetWarnings: function _resetWarnings() { pastWarnings = {}; }, trimString: function trimString(string) { return string.replace(/^\s+|\s+$/g, ''); }, parse: { date: function date(string) { var parsed = string.match(/^(\d{4,})-(\d\d)-(\d\d)$/); if (!parsed) return null; var _parsed$map = parsed.map(function (x) { return parseInt(x, 10); }), _parsed$map2 = _slicedToArray(_parsed$map, 4), _ = _parsed$map2[0], year = _parsed$map2[1], month = _parsed$map2[2], day = _parsed$map2[3]; var date = new Date(year, month - 1, day); if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) return null; return date; }, string: function string(_string) { return _string; }, integer: function integer(string) { if (isNaN(string)) return null; return parseInt(string, 10); }, number: function number(string) { if (isNaN(string)) throw null; return parseFloat(string); }, 'boolean': function _boolean(string) { return !/^\s*false\s*$/i.test(string); }, object: function object(string) { return Utils.deserializeValue(string); }, regexp: function regexp(_regexp) { var flags = ''; // Test if RegExp is literal, if not, nothing to be done, otherwise, we need to isolate flags and pattern if (/^\/.*\/(?:[gimy]*)$/.test(_regexp)) { // Replace the regexp literal string with the first match group: ([gimy]*) // If no flag is present, this will be a blank string flags = _regexp.replace(/.*\/([gimy]*)$/, '$1'); // Again, replace the regexp literal string with the first match group: // everything excluding the opening and closing slashes and the flags _regexp = _regexp.replace(new RegExp('^/(.*?)/' + flags + '$'), '$1'); } else { // Anchor regexp: _regexp = '^' + _regexp + '$'; } return new RegExp(_regexp, flags); } }, parseRequirement: function parseRequirement(requirementType, string) { var converter = this.parse[requirementType || 'string']; if (!converter) throw 'Unknown requirement specification: "' + requirementType + '"'; var converted = converter(string); if (converted === null) throw "Requirement is not a ".concat(requirementType, ": \"").concat(string, "\""); return converted; }, namespaceEvents: function namespaceEvents(events, namespace) { events = this.trimString(events || '').split(/\s+/); if (!events[0]) return ''; return $.map(events, function (evt) { return "".concat(evt, ".").concat(namespace); }).join(' '); }, difference: function difference(array, remove) { // This is O(N^2), should be optimized var result = []; $.each(array, function (_, elem) { if (remove.indexOf(elem) == -1) result.push(elem); }); return result; }, // Alter-ego to native Promise.all, but for jQuery all: function all(promises) { // jQuery treats $.when() and $.when(singlePromise) differently; let's avoid that and add spurious elements return $.when.apply($, _toConsumableArray(promises).concat([42, 42])); }, // Object.create polyfill, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill objectCreate: Object.create || function () { var Object = function Object() {}; return function (prototype) { if (arguments.length > 1) { throw Error('Second argument not supported'); } if (_typeof(prototype) != 'object') { throw TypeError('Argument must be an object'); } Object.prototype = prototype; var result = new Object(); Object.prototype = null; return result; }; }(), _SubmitSelector: 'input[type="submit"], button:submit' }; // All these options could be overriden and specified directly in DOM using // `data-parsley-` default DOM-API // eg: `inputs` can be set in DOM using `data-parsley-inputs="input, textarea"` // eg: `data-parsley-stop-on-first-failing-constraint="false"` var Defaults = { // ### General // Default data-namespace for DOM API namespace: 'data-parsley-', // Supported inputs by default inputs: 'input, textarea, select', // Excluded inputs by default excluded: 'input[type=button], input[type=submit], input[type=reset], input[type=hidden]', // Stop validating field on highest priority failing constraint priorityEnabled: true, // ### Field only // identifier used to group together inputs (e.g. radio buttons...) multiple: null, // identifier (or array of identifiers) used to validate only a select group of inputs group: null, // ### UI // Enable\Disable error messages uiEnabled: true, // Key events threshold before validation validationThreshold: 3, // Focused field on form validation error. 'first'|'last'|'none' focus: 'first', // event(s) that will trigger validation before first failure. eg: `input`... trigger: false, // event(s) that will trigger validation after first failure. triggerAfterFailure: 'input', // Class that would be added on every failing validation Parsley field errorClass: 'parsley-error', // Same for success validation successClass: 'parsley-success', // Return the `$element` that will receive these above success or error classes // Could also be (and given directly from DOM) a valid selector like `'#div'` classHandler: function classHandler(Field) {}, // Return the `$element` where errors will be appended // Could also be (and given directly from DOM) a valid selector like `'#div'` errorsContainer: function errorsContainer(Field) {}, // ul elem that would receive errors' list errorsWrapper: '<ul class="parsley-errors-list"></ul>', // li elem that would receive error message errorTemplate: '<li></li>' }; var Base = function Base() { this.__id__ = Utils.generateID(); }; Base.prototype = { asyncSupport: true, // Deprecated _pipeAccordingToValidationResult: function _pipeAccordingToValidationResult() { var _this = this; var pipe = function pipe() { var r = $.Deferred(); if (true !== _this.validationResult) r.reject(); return r.resolve().promise(); }; return [pipe, pipe]; }, actualizeOptions: function actualizeOptions() { Utils.attr(this.element, this.options.namespace, this.domOptions); if (this.parent && this.parent.actualizeOptions) this.parent.actualizeOptions(); return this; }, _resetOptions: function _resetOptions(initOptions) { this.domOptions = Utils.objectCreate(this.parent.options); this.options = Utils.objectCreate(this.domOptions); // Shallow copy of ownProperties of initOptions: for (var i in initOptions) { if (initOptions.hasOwnProperty(i)) this.options[i] = initOptions[i]; } this.actualizeOptions(); }, _listeners: null, // Register a callback for the given event name // Callback is called with context as the first argument and the `this` // The context is the current parsley instance, or window.Parsley if global // A return value of `false` will interrupt the calls on: function on(name, fn) { this._listeners = this._listeners || {}; var queue = this._listeners[name] = this._listeners[name] || []; queue.push(fn); return this; }, // Deprecated. Use `on` instead subscribe: function subscribe(name, fn) { $.listenTo(this, name.toLowerCase(), fn); }, // Unregister a callback (or all if none is given) for the given event name off: function off(name, fn) { var queue = this._listeners && this._listeners[name]; if (queue) { if (!fn) { delete this._listeners[name]; } else { for (var i = queue.length; i--;) { if (queue[i] === fn) queue.splice(i, 1); } } } return this; }, // Deprecated. Use `off` unsubscribe: function unsubscribe(name, fn) { $.unsubscribeTo(this, name.toLowerCase()); }, // Trigger an event of the given name // A return value of `false` interrupts the callback chain // Returns false if execution was interrupted trigger: function trigger(name, target, extraArg) { target = target || this; var queue = this._listeners && this._listeners[name]; var result; if (queue) { for (var i = queue.length; i--;) { result = queue[i].call(target, target, extraArg); if (result === false) return result; } } if (this.parent) { return this.parent.trigger(name, target, extraArg); } return true; }, asyncIsValid: function asyncIsValid(group, force) { Utils.warnOnce("asyncIsValid is deprecated; please use whenValid instead"); return this.whenValid({ group: group, force: force }); }, _findRelated: function _findRelated() { return this.options.multiple ? $(this.parent.element.querySelectorAll("[".concat(this.options.namespace, "multiple=\"").concat(this.options.multiple, "\"]"))) : this.$element; } }; var convertArrayRequirement = function convertArrayRequirement(string, length) { var m = string.match(/^\s*\[(.*)\]\s*$/); if (!m) throw 'Requirement is not an array: "' + string + '"'; var values = m[1].split(',').map(Utils.trimString); if (values.length !== length) throw 'Requirement has ' + values.length + ' values when ' + length + ' are needed'; return values; }; var convertExtraOptionRequirement = function convertExtraOptionRequirement(requirementSpec, string, extraOptionReader) { var main = null; var extra = {}; for (var key in requirementSpec) { if (key) { var value = extraOptionReader(key); if ('string' === typeof value) value = Utils.parseRequirement(requirementSpec[key], value); extra[key] = value; } else { main = Utils.parseRequirement(requirementSpec[key], string); } } return [main, extra]; }; // A Validator needs to implement the methods `validate` and `parseRequirements` var Validator = function Validator(spec) { $.extend(true, this, spec); }; Validator.prototype = { // Returns `true` iff the given `value` is valid according the given requirements. validate: function validate(value, requirementFirstArg) { if (this.fn) { // Legacy style validator if (arguments.length > 3) // If more args then value, requirement, instance... requirementFirstArg = [].slice.call(arguments, 1, -1); // Skip first arg (value) and last (instance), combining the rest return this.fn(value, requirementFirstArg); } if (Array.isArray(value)) { if (!this.validateMultiple) throw 'Validator `' + this.name + '` does not handle multiple values'; return this.validateMultiple.apply(this, arguments); } else { var instance = arguments[arguments.length - 1]; if (this.validateDate && instance._isDateInput()) { arguments[0] = Utils.parse.date(arguments[0]); if (arguments[0] === null) return false; return this.validateDate.apply(this, arguments); } if (this.validateNumber) { if (!value) // Builtin validators all accept empty strings, except `required` of course return true; if (isNaN(value)) return false; arguments[0] = parseFloat(arguments[0]); return this.validateNumber.apply(this, arguments); } if (this.validateString) { return this.validateString.apply(this, arguments); } throw 'Validator `' + this.name + '` only handles multiple values'; } }, // Parses `requirements` into an array of arguments, // according to `this.requirementType` parseRequirements: function parseRequirements(requirements, extraOptionReader) { if ('string' !== typeof requirements) { // Assume requirement already parsed // but make sure we return an array return Array.isArray(requirements) ? requirements : [requirements]; } var type = this.requirementType; if (Array.isArray(type)) { var values = convertArrayRequirement(requirements, type.length); for (var i = 0; i < values.length; i++) { values[i] = Utils.parseRequirement(type[i], values[i]); } return values; } else if ($.isPlainObject(type)) { return convertExtraOptionRequirement(type, requirements, extraOptionReader); } else { return [Utils.parseRequirement(type, requirements)]; } }, // Defaults: requirementType: 'string', priority: 2 }; var ValidatorRegistry = function ValidatorRegistry(validators, catalog) { this.__class__ = 'ValidatorRegistry'; // Default Parsley locale is en this.locale = 'en'; this.init(validators || {}, catalog || {}); }; var typeTesters = { email: /^((([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))$/, // Follow https://www.w3.org/TR/html5/infrastructure.html#floating-point-numbers number: /^-?(\d*\.)?\d+(e[-+]?\d+)?$/i, integer: /^-?\d+$/, digits: /^\d+$/, alphanum: /^\w+$/i, date: { test: function test(value) { return Utils.parse.date(value) !== null; } }, url: new RegExp("^" + // protocol identifier "(?:(?:https?|ftp)://)?" + // ** mod: make scheme optional // user:pass authentication "(?:\\S+(?::\\S*)?@)?" + "(?:" + // IP address exclusion // private & local networks // "(?!(?:10|127)(?:\\.\\d{1,3}){3})" + // ** mod: allow local networks // "(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})" + // ** mod: allow local networks // "(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})" + // ** mod: allow local networks // IP address dotted notation octets // excludes loopback network 0.0.0.0 // excludes reserved space >= 224.0.0.0 // excludes network & broacast addresses // (first & last IP address of each class) "(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" + "(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" + "(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" + "|" + // host name "(?:(?:[a-zA-Z\\u00a1-\\uffff0-9]-*)*[a-zA-Z\\u00a1-\\uffff0-9]+)" + // domain name "(?:\\.(?:[a-zA-Z\\u00a1-\\uffff0-9]-*)*[a-zA-Z\\u00a1-\\uffff0-9]+)*" + // TLD identifier "(?:\\.(?:[a-zA-Z\\u00a1-\\uffff]{2,}))" + ")" + // port number "(?::\\d{2,5})?" + // resource path "(?:/\\S*)?" + "$") }; typeTesters.range = typeTesters.number; // See http://stackoverflow.com/a/10454560/8279 var decimalPlaces = function decimalPlaces(num) { var match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); if (!match) { return 0; } return Math.max(0, // Number of digits right of decimal point. (match[1] ? match[1].length : 0) - ( // Adjust for scientific notation. match[2] ? +match[2] : 0)); }; // parseArguments('number', ['1', '2']) => [1, 2] var parseArguments = function parseArguments(type, args) { return args.map(Utils.parse[type]); }; // operatorToValidator returns a validating function for an operator function, applied to the given type var operatorToValidator = function operatorToValidator(type, operator) { return function (value) { for (var _len = arguments.length, requirementsAndInput = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { requirementsAndInput[_key - 1] = arguments[_key]; } requirementsAndInput.pop(); // Get rid of `input` argument return operator.apply(void 0, [value].concat(_toConsumableArray(parseArguments(type, requirementsAndInput)))); }; }; var comparisonOperator = function comparisonOperator(operator) { return { validateDate: operatorToValidator('date', operator), validateNumber: operatorToValidator('number', operator), requirementType: operator.length <= 2 ? 'string' : ['string', 'string'], // Support operators with a 1 or 2 requirement(s) priority: 30 }; }; ValidatorRegistry.prototype = { init: function init(validators, catalog) { this.catalog = catalog; // Copy prototype's validators: this.validators = _extends({}, this.validators); for (var name in validators) { this.addValidator(name, validators[name].fn, validators[name].priority); } window.Parsley.trigger('parsley:validator:init'); }, // Set new messages locale if we have dictionary loaded in ParsleyConfig.i18n setLocale: function setLocale(locale) { if ('undefined' === typeof this.catalog[locale]) throw new Error(locale + ' is not available in the catalog'); this.locale = locale; return this; }, // Add a new messages catalog for a given locale. Set locale for this catalog if set === `true` addCatalog: function addCatalog(locale, messages, set) { if ('object' === _typeof(messages)) this.catalog[locale] = messages; if (true === set) return this.setLocale(locale); return this; }, // Add a specific message for a given constraint in a given locale addMessage: function addMessage(locale, name, message) { if ('undefined' === typeof this.catalog[locale]) this.catalog[locale] = {}; this.catalog[locale][name] = message; return this; }, // Add messages for a given locale addMessages: function addMessages(locale, nameMessageObject) { for (var name in nameMessageObject) { this.addMessage(locale, name, nameMessageObject[name]); } return this; }, // Add a new validator // // addValidator('custom', { // requirementType: ['integer', 'integer'], // validateString: function(value, from, to) {}, // priority: 22, // messages: { // en: "Hey, that's no good", // fr: "Aye aye, pas bon du tout", // } // }) // // Old API was addValidator(name, function, priority) // addValidator: function addValidator(name, arg1, arg2) { if (this.validators[name]) Utils.warn('Validator "' + name + '" is already defined.');else if (Defaults.hasOwnProperty(name)) { Utils.warn('"' + name + '" is a restricted keyword and is not a valid validator name.'); return; } return this._setValidator.apply(this, arguments); }, hasValidator: function hasValidator(name) { return !!this.validators[name]; }, updateValidator: function updateValidator(name, arg1, arg2) { if (!this.validators[name]) { Utils.warn('Validator "' + name + '" is not already defined.'); return this.addValidator.apply(this, arguments); } return this._setValidator.apply(this, arguments); }, removeValidator: function removeValidator(name) { if (!this.validators[name]) Utils.warn('Validator "' + name + '" is not defined.'); delete this.validators[name]; return this; }, _setValidator: function _setValidator(name, validator, priority) { if ('object' !== _typeof(validator)) { // Old style validator, with `fn` and `priority` validator = { fn: validator, priority: priority }; } if (!validator.validate) { validator = new Validator(validator); } this.validators[name] = validator; for (var locale in validator.messages || {}) { this.addMessage(locale, name, validator.messages[locale]); } return this; }, getErrorMessage: function getErrorMessage(constraint) { var message; // Type constraints are a bit different, we have to match their requirements too to find right error message if ('type' === constraint.name) { var typeMessages = this.catalog[this.locale][constraint.name] || {}; message = typeMessages[constraint.requirements]; } else message = this.formatMessage(this.catalog[this.locale][constraint.name], constraint.requirements); return message || this.catalog[this.locale].defaultMessage || this.catalog.en.defaultMessage; }, // Kind of light `sprintf()` implementation formatMessage: function formatMessage(string, parameters) { if ('object' === _typeof(parameters)) { for (var i in parameters) { string = this.formatMessage(string, parameters[i]); } return string; } return 'string' === typeof string ? string.replace(/%s/i, parameters) : ''; }, // Here is the Parsley default validators list. // A validator is an object with the following key values: // - priority: an integer // - requirement: 'string' (default), 'integer', 'number', 'regexp' or an Array of these // - validateString, validateMultiple, validateNumber: functions returning `true`, `false` or a promise // Alternatively, a validator can be a function that returns such an object // validators: { notblank: { validateString: function validateString(value) { return /\S/.test(value); }, priority: 2 }, required: { validateMultiple: function validateMultiple(values) { return values.length > 0; }, validateString: function validateString(value) { return /\S/.test(value); }, priority: 512 }, type: { validateString: function validateString(value, type) { var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, _ref$step = _ref.step, step = _ref$step === void 0 ? 'any' : _ref$step, _ref$base = _ref.base, base = _ref$base === void 0 ? 0 : _ref$base; var tester = typeTesters[type]; if (!tester) { throw new Error('validator type `' + type + '` is not supported'); } if (!value) return true; // Builtin validators all accept empty strings, except `required` of course if (!tester.test(value)) return false; if ('number' === type) { if (!/^any$/i.test(step || '')) { var nb = Number(value); var decimals = Math.max(decimalPlaces(step), decimalPlaces(base)); if (decimalPlaces(nb) > decimals) // Value can't have too many decimals return false; // Be careful of rounding errors by using integers. var toInt = function toInt(f) { return Math.round(f * Math.pow(10, decimals)); }; if ((toInt(nb) - toInt(base)) % toInt(step) != 0) return false; } } return true; }, requirementType: { '': 'string', step: 'string', base: 'number' }, priority: 256 }, pattern: { validateString: function validateString(value, regexp) { if (!value) return true; // Builtin validators all accept empty strings, except `required` of course return regexp.test(value); }, requirementType: 'regexp', priority: 64 }, minlength: { validateString: function validateString(value, requirement) { if (!value) return true; // Builtin validators all accept empty strings, except `required` of course return value.length >= requirement; }, requirementType: 'integer', priority: 30 }, maxlength: { validateString: function validateString(value, requirement) { return value.length <= requirement; }, requirementType: 'integer', priority: 30 }, length: { validateString: function validateString(value, min, max) { if (!value) return true; // Builtin validators all accept empty strings, except `required` of course return value.length >= min && value.length <= max; }, requirementType: ['integer', 'integer'], priority: 30 }, mincheck: { validateMultiple: function validateMultiple(values, requirement) { return values.length >= requirement; }, requirementType: 'integer', priority: 30 }, maxcheck: { validateMultiple: function validateMultiple(values, requirement) { return values.length <= requirement; }, requirementType: 'integer', priority: 30 }, check: { validateMultiple: function validateMultiple(values, min, max) { return values.length >= min && values.length <= max; }, requirementType: ['integer', 'integer'], priority: 30 }, min: comparisonOperator(function (value, requirement) { return value >= requirement; }), max: comparisonOperator(function (value, requirement) { return value <= requirement; }), range: comparisonOperator(function (value, min, max) { return value >= min && value <= max; }), equalto: { validateString: function validateString(value, refOrValue) { if (!value) return true; // Builtin validators all accept empty strings, except `required` of course var $reference = $(refOrValue); if ($reference.length) return value === $reference.val();else return value === refOrValue; }, priority: 256 }, euvatin: { validateString: function validateString(value, refOrValue) { if (!value) { return true; // Builtin validators all accept empty strings, except `required` of course } var re = /^[A-Z][A-Z][A-Za-z0-9 -]{2,}$/; return re.test(value); }, priority: 30 } } }; var UI = {}; var diffResults = function diffResults(newResult, oldResult, deep) { var added = []; var kept = []; for (var i = 0; i < newResult.length; i++) { var found = false; for (var j = 0; j < oldResult.length; j++) { if (newResult[i].assert.name === oldResult[j].assert.name) { found = true; break; } } if (found) kept.push(newResult[i]);else added.push(newResult[i]); } return { kept: kept, added: added, removed: !deep ? diffResults(oldResult, newResult, true).added : [] }; }; UI.Form = { _actualizeTriggers: function _actualizeTriggers() { var _this = this; this.$element.on('submit.Parsley', function (evt) { _this.onSubmitValidate(evt); }); this.$element.on('click.Parsley', Utils._SubmitSelector, function (evt) { _this.onSubmitButton(evt); }); // UI could be disabled if (false === this.options.uiEnabled) return; this.element.setAttribute('novalidate', ''); }, focus: function focus() { this._focusedField = null; if (true === this.validationResult || 'none' === this.options.focus) return null; for (var i = 0; i < this.fields.length; i++) { var field = this.fields[i]; if (true !== field.validationResult && field.validationResult.length > 0 && 'undefined' === typeof field.options.noFocus) { this._focusedField = field.$element; if ('first' === this.options.focus) break; } } if (null === this._focusedField) return null; return this._focusedField.focus(); }, _destroyUI: function _destroyUI() { // Reset all event listeners this.$element.off('.Parsley'); } }; UI.Field = { _reflowUI: function _reflowUI() { this._buildUI(); // If this field doesn't have an active UI don't bother doing something if (!this._ui) return; // Diff between two validation results var diff = diffResults(this.validationResult, this._ui.lastValidationResult); // Then store current validation result for next reflow this._ui.lastValidationResult = this.validationResult; // Handle valid / invalid / none field class this._manageStatusClass(); // Add, remove, updated errors messages this._manageErrorsMessages(diff); // Triggers impl this._actualizeTriggers(); // If field is not valid for the first time, bind keyup trigger to ease UX and quickly inform user if ((diff.kept.length || diff.added.length) && !this._failedOnce) { this._failedOnce = true; this._actualizeTriggers(); } }, // Returns an array of field's error message(s) getErrorsMessages: function getErrorsMessages() { // No error message, field is valid if (true === this.validationResult) return []; var messages = []; for (var i = 0; i < this.validationResult.length; i++) { messages.push(this.validationResult[i].errorMessage || this._getErrorMessage(this.validationResult[i].assert)); } return messages; }, // It's a goal of Parsley that this method is no longer required [#1073] addError: function addError(name) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, message = _ref.message, assert = _ref.assert, _ref$updateClass = _ref.updateClass, updateClass = _ref$updateClass === void 0 ? true : _ref$updateClass; this._buildUI(); this._addError(name, { message: message, assert: assert }); if (updateClass) this._errorClass(); }, // It's a goal of Parsley that this method is no longer required [#1073] updateError: function updateError(name) { var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, message = _ref2.message, assert = _ref2.assert, _ref2$updateClass = _ref2.updateClass, updateClass = _ref2$updateClass === void 0 ? true : _ref2$updateClass; this._buildUI(); this._updateError(name, { message: message, assert: assert }); if (updateClass) this._errorClass(); }, // It's a goal of Parsley that this method is no longer required [#1073] removeError: function removeError(name) { var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref3$updateClass = _ref3.updateClass, updateClass = _ref3$updateClass === void 0 ? true : _ref3$updateClass; this._buildUI(); this._removeError(name); // edge case possible here: remove a standard Parsley error that is still failing in this.validationResult // but highly improbable cuz' manually removing a well Parsley handled error makes no sense. if (updateClass) this._manageStatusClass(); }, _manageStatusClass: function _manageStatusClass() { if (this.hasConstraints() && this.needsValidation() && true === this.validationResult) this._successClass();else if (this.validationResult.length > 0) this._errorClass();else this._resetClass(); }, _manageErrorsMessages: function _manageErrorsMessages(diff) { if ('undefined' !== typeof this.options.errorsMessagesDisabled) return; // Case where we have errorMessage option that configure an unique field error message, regardless failing validators if ('undefined' !== typeof this.options.errorMessage) { if (diff.added.length || diff.kept.length) { this._insertErrorWrapper(); if (0 === this._ui.$errorsWrapper.find('.parsley-custom-error-message').length) this._ui.$errorsWrapper.append($(this.options.errorTemplate).addClass('parsley-custom-error-message')); this._ui.$errorClassHandler.attr('aria-describedby', this._ui.errorsWrapperId); return this._ui.$errorsWrapper.addClass('filled').attr('aria-hidden', 'false').find('.parsley-custom-error-message').html(this.options.errorMessage); } this._ui.$errorClassHandler.removeAttr('aria-describedby'); return this._ui.$errorsWrapper.removeClass('filled').attr('aria-hidden', 'true').find('.parsley-custom-error-message').remove(); } // Show, hide, update failing constraints messages for (var i = 0; i < diff.removed.length; i++) { this._removeError(diff.removed[i].assert.name); } for (i = 0; i < diff.added.length; i++) { this._addError(diff.added[i].assert.name, { message: diff.added[i].errorMessage, assert: diff.added[i].assert }); } for (i = 0; i < diff.kept.length; i++) { this._updateError(diff.kept[i].assert.name, { message: diff.kept[i].errorMessage, assert: diff.kept[i].assert }); } }, _addError: function _addError(name, _ref4) { var message = _ref4.message, assert = _ref4.assert; this._insertErrorWrapper(); this._ui.$errorClassHandler.attr('aria-describedby', this._ui.errorsWrapperId); this._ui.$errorsWrapper.addClass('filled').attr('aria-hidden', 'false').append($(this.options.errorTemplate).addClass('parsley-' + name).html(message || this._getErrorMessage(assert))); }, _updateError: function _updateError(name, _ref5) { var message = _ref5.message, assert = _ref5.assert; this._ui.$errorsWrapper.addClass('filled').find('.parsley-' + name).html(message || this._getErrorMessage(assert)); }, _removeError: function _removeError(name) { this._ui.$errorClassHandler.removeAttr('aria-describedby'); this._ui.$errorsWrapper.removeClass('filled').attr('aria-hidden', 'true').find('.parsley-' + name).remove(); }, _getErrorMessage: function _getErrorMessage(constraint) { var customConstraintErrorMessage = constraint.name + 'Message'; if ('undefined' !== typeof this.options[customConstraintErrorMessage]) return window.Parsley.formatMessage(this.options[customConstraintErrorMessage], constraint.requirements); return window.Parsley.getErrorMessage(constraint); }, _buildUI: function _buildUI() { // UI could be already built or disabled if (this._ui || false === this.options.uiEnabled) return; var _ui = {}; // Give field its Parsley id in DOM this.element.setAttribute(this.options.namespace + 'id', this.__id__); /** Generate important UI elements and store them in this **/ // $errorClassHandler is the $element that woul have parsley-error and parsley-success classes _ui.$errorClassHandler = this._manageClassHandler(); // $errorsWrapper is a div that would contain the various field errors, it will be appended into $errorsContainer _ui.errorsWrapperId = 'parsley-id-' + (this.options.multiple ? 'multiple-' + this.options.multiple : this.__id__); _ui.$errorsWrapper = $(this.options.errorsWrapper).attr('id', _ui.errorsWrapperId); // ValidationResult UI storage to detect what have changed bwt two validations, and update DOM accordingly _ui.lastValidationResult = []; _ui.validationInformationVisible = false; // Store it in this for later this._ui = _ui; }, // Determine which element will have `parsley-error` and `parsley-success` classes _manageClassHandler: function _manageClassHandler() { // Class handled could also be determined by function given in Parsley options if ('string' === typeof this.options.classHandler && $(this.options.classHandler).length) return $(this.options.classHandler); // Class handled could also be determined by function given in Parsley options var $handlerFunction = this.options.classHandler; // It might also be the function name of a global function if ('string' === typeof this.options.classHandler && 'function' === typeof window[this.options.classHandler]) $handlerFunction = window[this.options.classHandler]; if ('function' === typeof $handlerFunction) { var $handler = $handlerFunction.call(this, this); // If this function returned a valid existing DOM element, go for it if ('undefined' !== typeof $handler && $handler.length) return $handler; } else if ('object' === _typeof($handlerFunction) && $handlerFunction instanceof jQuery && $handlerFunction.length) { return $handlerFunction; } else if ($handlerFunction) { Utils.warn('The class handler `' + $handlerFunction + '` does not exist in DOM nor as a global JS function'); } return this._inputHolder(); }, _inputHolder: function _inputHolder() { // if simple element (input, texatrea, select...) it will perfectly host the classes and precede the error container if (!this.options.multiple || this.element.nodeName === 'SELECT') return this.$element; // But if multiple element (radio, checkbox), that would be their parent return this.$element.parent(); }, _insertErrorWrapper: function _insertErrorWrapper() { var $errorsContainer = this.options.errorsContainer; // Nothing to do if already inserted if (0 !== this._ui.$errorsWrapper.parent().length) return this._ui.$errorsWrapper.parent(); if ('string' === typeof $errorsContainer) { if ($($errorsContainer).length) return $($errorsContainer).append(this._ui.$errorsWrapper);else if ('function' === typeof window[$errorsContainer]) $errorsContainer = window[$errorsContainer];else Utils.warn('The errors container `' + $errorsContainer + '` does not exist in DOM nor as a global JS function'); } if ('function' === typeof $errorsContainer) $errorsContainer = $errorsContainer.call(this, this); if ('object' === _typeof($errorsContainer) && $errorsContainer.length) return $errorsContainer.append(this._ui.$errorsWrapper); return this._inputHolder().after(this._ui.$errorsWrapper); }, _actualizeTriggers: function _actualizeTriggers() { var _this2 = this; var $toBind = this._findRelated(); var trigger; // Remove Parsley events already bound on this field $toBind.off('.Parsley'); if (this._failedOnce) $toBind.on(Utils.namespaceEvents(this.options.triggerAfterFailure, 'Parsley'), function () { _this2._validateIfNeeded(); });else if (trigger = Utils.namespaceEvents(this.options.trigger, 'Parsley')) { $toBind.on(trigger, function (event) { _this2._validateIfNeeded(event); }); } }, _validateIfNeeded: function _validateIfNeeded(event) { var _this3 = this; // For keyup, keypress, keydown, input... events that could be a little bit obstrusive // do not validate if val length < min threshold on first validation. Once field have been validated once and info // about success or failure have been displayed, always validate with this trigger to reflect every yalidation change. if (event && /key|input/.test(event.type)) if (!(this._ui && this._ui.validationInformationVisible) && this.getValue().length <= this.options.validationThreshold) return; if (this.options.debounce) { window.clearTimeout(this._debounced); this._debounced = window.setTimeout(function () { return _this3.validate(); }, this.options.debounce); } else this.validate(); }, _resetUI: function _resetUI() { // Reset all event listeners this._failedOnce = false; this._actualizeTriggers(); // Nothing to do if UI never initialized for this field if ('undefined' === typeof this._ui) return; // Reset all errors' li this._ui.$errorsWrapper.removeClass('filled').children().remove(); // Reset validation class this._resetClass(); // Reset validation flags and last validation result this._ui.lastValidationResult = []; this._ui.validationInformationVisible = false; }, _destroyUI: function _destroyUI() { this._resetUI(); if ('undefined' !== typeof this._ui) this._ui.$errorsWrapper.remove(); delete this._ui; }, _successClass: function _successClass() { this._ui.validationInformationVisible = true; this._ui.$errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass); }, _errorClass: function _errorClass() { this._ui.validationInformationVisible = true; this._ui.$errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass); }, _resetClass: function _resetClass() { this._ui.$errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass); } }; var Form = function Form(element, domOptions, options) { this.__class__ = 'Form'; this.element = element; this.$element = $(element); this.domOptions = domOptions; this.options = options; this.parent = window.Parsley; this.fields = []; this.validationResult = null; }; var statusMapping = { pending: null, resolved: true, rejected: false }; Form.prototype = { onSubmitValidate: function onSubmitValidate(event) { var _this = this; // This is a Parsley generated submit event, do not validate, do not prevent, simply exit and keep normal behavior if (true === event.parsley) return; // If we didn't come here through a submit button, use the first one in the form var submitSource = this._submitSource || this.$element.find(Utils._SubmitSelector)[0]; this._submitSource = null; this.$element.find('.parsley-synthetic-submit-button').prop('disabled', true); if (submitSource && null !== submitSource.getAttribute('formnovalidate')) return; window.Parsley._remoteCache = {}; var promise = this.whenValidate({ event: event }); if ('resolved' === promise.state() && false !== this._trigger('submit')) ; else { // Rejected or pending: cancel this submit event.stopImmediatePropagation(); event.preventDefault(); if ('pending' === promise.state()) promise.done(function () { _this._submit(submitSource); }); } }, onSubmitButton: function onSubmitButton(event) { this._submitSource = event.currentTarget; }, // internal // _submit submits the form, this time without going through the validations. // Care must be taken to "fake" the actual submit button being clicked. _submit: function _submit(submitSource) { if (false === this._trigger('submit')) return; // Add submit button's data if (submitSource) { var $synthetic = this.$element.find('.parsley-synthetic-submit-button').prop('disabled', false); if (0 === $synthetic.length) $synthetic = $('<input class="parsley-synthetic-submit-button" type="hidden">').appendTo(this.$element); $synthetic.attr({ name: submitSource.getAttribute('name'), value: submitSource.getAttribute('value') }); } this.$element.trigger(_extends($.Event('submit'), { parsley: true })); }, // Performs validation on fields while triggering events. // @returns `true` if all validations succeeds, `false` // if a failure is immediately detected, or `null` // if dependant on a promise. // Consider using `whenValidate` instead. validate: function validate(options) { if (arguments.length >= 1 && !$.isPlainObject(options)) { Utils.warnOnce('Calling validate on a parsley form without passing arguments as an object is deprecated.'); var _arguments = Array.prototype.slice.call(arguments), group = _arguments[0], force = _arguments[1], event = _arguments[2]; options = { group: group, force: force, event: event }; } return statusMapping[this.whenValidate(options).state()]; }, whenValidate: function whenValidate() { var _this2 = this, _Utils$all$done$fail$; var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, group = _ref.group, force = _ref.force, event = _ref.event; this.submitEvent = event; if (event) { this.submitEvent = _extends({}, event, { preventDefault: function preventDefault() { Utils.warnOnce("Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`"); _this2.validationResult = false; } }); } this.validationResult = true; // fire validate event to eventually modify things before every validation this._trigger('validate'); // Refresh form DOM options and form's fields that could have changed this._refreshFields(); var promises = this._withoutReactualizingFormOptions(function () { return $.map(_this2.fields, function (field) { return field.whenValidate({ force: force, group: group }); }); }); return (_Utils$all$done$fail$ = Utils.all(promises).done(function () { _this2._trigger('success'); }).fail(function () { _this2.validationResult = false; _this2.focus(); _this2._trigger('error'); }).always(function () { _this2._trigger('validated'); })).pipe.apply(_Utils$all$done$fail$, _toConsumableArray(this._pipeAccordingToValidationResult())); }, // Iterate over refreshed fields, and stop on first failure. // Returns `true` if all fields are valid, `false` if a failure is detected // or `null` if the result depends on an unresolved promise. // Prefer using `whenValid` instead. isValid: function isValid(options) { if (arguments.length >= 1 && !$.isPlainObject(options)) { Utils.warnOnce('Calling isValid on a parsley form without passing arguments as an object is deprecated.'); var _arguments2 = Array.prototype.slice.call(arguments), group = _arguments2[0], force = _arguments2[1]; options = { group: group, force: force }; } return statusMapping[this.whenValid(options).state()]; }, // Iterate over refreshed fields and validate them. // Returns a promise. // A validation that immediately fails will interrupt the validations. whenValid: function whenValid() { var _this3 = this; var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, group = _ref2.group, force = _ref2.force; this._refreshFields(); var promises = this._withoutReactualizingFormOptions(function () { return $.map(_this3.fields, function (field) { return field.whenValid({ group: group, force: force }); }); }); return Utils.all(promises); }, refresh: function refresh() { this._refreshFields(); return this; }, // Reset UI reset: function reset() { // Form case: emit a reset event for each field for (var i = 0; i < this.fields.length; i++) { this.fields[i].reset(); } this._trigger('reset'); }, // Destroy Parsley instance (+ UI) destroy: function destroy() { // Field case: emit destroy event to clean UI and then destroy stored instance this._destroyUI(); // Form case: destroy all its fields and then destroy stored instance for (var i = 0; i < this.fields.length; i++) { this.fields[i].destroy(); } this.$element.removeData('Parsley'); this._trigger('destroy'); }, _refreshFields: function _refreshFields() { return this.actualizeOptions()._bindFields(); }, _bindFields: function _bindFields() { var _this4 = this; var oldFields = this.fields; this.fields = []; this.fieldsMappedById = {}; this._withoutReactualizingFormOptions(function () { _this4.$element.find(_this4.options.inputs).not(_this4.options.excluded).not("[".concat(_this4.options.namespace, "excluded=true]")).each(function (_, element) { var fieldInstance = new window.Parsley.Factory(element, {}, _this4); // Only add valid and not excluded `Field` and `FieldMultiple` children if ('Field' === fieldInstance.__class__ || 'FieldMultiple' === fieldInstance.__class__) { var uniqueId = fieldInstance.__class__ + '-' + fieldInstance.__id__; if ('undefined' === typeof _this4.fieldsMappedById[uniqueId]) { _this4.fieldsMappedById[uniqueId] = fieldInstance; _this4.fields.push(fieldInstance); } } }); $.each(Utils.difference(oldFields, _this4.fields), function (_, field) { field.reset(); }); }); return this; }, // Internal only. // Looping on a form's fields to do validation or similar // will trigger reactualizing options on all of them, which // in turn will reactualize the form's options. // To avoid calling actualizeOptions so many times on the form // for nothing, _withoutReactualizingFormOptions temporarily disables // the method actualizeOptions on this form while `fn` is called. _withoutReactualizingFormOptions: function _withoutReactualizingFormOptions(fn) { var oldActualizeOptions = this.actualizeOptions; this.actualizeOptions = function () { return this; }; var result = fn(); this.actualizeOptions = oldActualizeOptions; return result; }, // Internal only. // Shortcut to trigger an event // Returns true iff event is not interrupted and default not prevented. _trigger: function _trigger(eventName) { return this.trigger('form:' + eventName); } }; var Constraint = function Constraint(parsleyField, name, requirements, priority, isDomConstraint) { var validatorSpec = window.Parsley._validatorRegistry.validators[name]; var validator = new Validator(validatorSpec); priority = priority || parsleyField.options[name + 'Priority'] || validator.priority; isDomConstraint = true === isDomConstraint; _extends(this, { validator: validator, name: name, requirements: requirements, priority: priority, isDomConstraint: isDomConstraint }); this._parseRequirements(parsleyField.options); }; var capitalize = function capitalize(str) { var cap = str[0].toUpperCase(); return cap + str.slice(1); }; Constraint.prototype = { validate: function validate(value, instance) { var _this$validator; return (_this$validator = this.validator).validate.apply(_this$validator, [value].concat(_toConsumableArray(this.requirementList), [instance])); }, _parseRequirements: function _parseRequirements(options) { var _this = this; this.requirementList = this.validator.parseRequirements(this.requirements, function (key) { return options[_this.name + capitalize(key)]; }); } }; var Field = function Field(field, domOptions, options, parsleyFormInstance) { this.__class__ = 'Field'; this.element = field; this.$element = $(field); // Set parent if we have one if ('undefined' !== typeof parsleyFormInstance) { this.parent = parsleyFormInstance; } this.options = options; this.domOptions = domOptions; // Initialize some properties this.constraints = []; this.constraintsByName = {}; this.validationResult = true; // Bind constraints this._bindConstraints(); }; var statusMapping$1 = { pending: null, resolved: true, rejected: false }; Field.prototype = { // # Public API // Validate field and trigger some events for mainly `UI` // @returns `true`, an array of the validators that failed, or // `null` if validation is not finished. Prefer using whenValidate validate: function validate(options) { if (arguments.length >= 1 && !$.isPlainObject(options)) { Utils.warnOnce('Calling validate on a parsley field without passing arguments as an object is deprecated.'); options = { options: options }; } var promise = this.whenValidate(options); if (!promise) // If excluded with `group` option return true; switch (promise.state()) { case 'pending': return null; case 'resolved': return true; case 'rejected': return this.validationResult; } }, // Validate field and trigger some events for mainly `UI` // @returns a promise that succeeds only when all validations do // or `undefined` if field is not in the given `group`. whenValidate: function whenValidate() { var _this$whenValid$alway, _this = this; var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, force = _ref.force, group = _ref.group; // do not validate a field if not the same as given validation group this.refresh(); if (group && !this._isInGroup(group)) return; this.value = this.getValue(); // Field Validate event. `this.value` could be altered for custom needs this._trigger('validate'); return (_this$whenValid$alway = this.whenValid({ force: force, value: this.value, _refreshed: true }).always(function () { _this._reflowUI(); }).done(function () { _this._trigger('success'); }).fail(function () { _this._trigger('error'); }).always(function () { _this._trigger('validated'); })).pipe.apply(_this$whenValid$alway, _toConsumableArray(this._pipeAccordingToValidationResult())); }, hasConstraints: function hasConstraints() { return 0 !== this.constraints.length; }, // An empty optional field does not need validation needsValidation: function needsValidation(value) { if ('undefined' === typeof value) value = this.getValue(); // If a field is empty and not required, it is valid // Except if `data-parsley-validate-if-empty` explicitely added, useful for some custom validators if (!value.length && !this._isRequired() && 'undefined' === typeof this.options.validateIfEmpty) return false; return true; }, _isInGroup: function _isInGroup(group) { if (Array.isArray(this.options.group)) return -1 !== $.inArray(group, this.options.group); return this.options.group === group; }, // Just validate field. Do not trigger any event. // Returns `true` iff all constraints pass, `false` if there are failures, // or `null` if the result can not be determined yet (depends on a promise) // See also `whenValid`. isValid: function isValid(options) { if (arguments.length >= 1 && !$.isPlainObject(options)) { Utils.warnOnce('Calling isValid on a parsley field without passing arguments as an object is deprecated.'); var _arguments = Array.prototype.slice.call(arguments), force = _arguments[0], value = _arguments[1]; options = { force: force, value: value }; } var promise = this.whenValid(options); if (!promise) // Excluded via `group` return true; return statusMapping$1[promise.state()]; }, // Just validate field. Do not trigger any event. // @returns a promise that succeeds only when all validations do // or `undefined` if the field is not in the given `group`. // The argument `force` will force validation of empty fields. // If a `value` is given, it will be validated instead of the value of the input. whenValid: function whenValid() { var _this2 = this; var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref2$force = _ref2.force, force = _ref2$force === void 0 ? false : _ref2$force, value = _ref2.value, group = _ref2.group, _refreshed = _ref2._refreshed; // Recompute options and rebind constraints to have latest changes if (!_refreshed) this.refresh(); // do not validate a field if not the same as given validation group if (group && !this._isInGroup(group)) return; this.validationResult = true; // A field without constraint is valid if (!this.hasConstraints()) return $.when(); // Value could be passed as argument, needed to add more power to 'field:validate' if ('undefined' === typeof value || null === value) value = this.getValue(); if (!this.needsValidation(value) && true !== force) return $.when(); var groupedConstraints = this._getGroupedConstraints(); var promises = []; $.each(groupedConstraints, function (_, constraints) { // Process one group of constraints at a time, we validate the constraints // and combine the promises together. var promise = Utils.all($.map(constraints, function (constraint) { return _this2._validateConstraint(value, constraint); })); promises.push(promise); if (promise.state() === 'rejected') return false; // Interrupt processing if a group has already failed }); return Utils.all(promises); }, // @returns a promise _validateConstraint: function _validateConstraint(value, constraint) { var _this3 = this; var result = constraint.validate(value, this); // Map false to a failed promise if (false === result) result = $.Deferred().reject(); // Make sure we return a promise and that we record failures return Utils.all([result]).fail(function (errorMessage) { if (!(_this3.validationResult instanceof Array)) _this3.validationResult = []; _this3.validationResult.push({ assert: constraint, errorMessage: 'string' === typeof errorMessage && errorMessage }); }); }, // @returns Parsley field computed value that could be overrided or configured in DOM getValue: function getValue() { var value; // Value could be overriden in DOM or with explicit options if ('function' === typeof this.options.value) value = this.options.value(this);else if ('undefined' !== typeof this.options.value) value = this.options.value;else value = this.$element.val(); // Handle wrong DOM or configurations if ('undefined' === typeof value || null === value) return ''; return this._handleWhitespace(value); }, // Reset UI reset: function reset() { this._resetUI(); return this._trigger('reset'); }, // Destroy Parsley instance (+ UI) destroy: function destroy() { // Field case: emit destroy event to clean UI and then destroy stored instance this._destroyUI(); this.$element.removeData('Parsley'); this.$element.removeData('FieldMultiple'); this._trigger('destroy'); }, // Actualize options and rebind constraints refresh: function refresh() { this._refreshConstraints(); return this; }, _refreshConstraints: function _refreshConstraints() { return this.actualizeOptions()._bindConstraints(); }, refreshConstraints: function refreshConstraints() { Utils.warnOnce("Parsley's refreshConstraints is deprecated. Please use refresh"); return this.refresh(); }, /** * Add a new constraint to a field * * @param {String} name * @param {Mixed} requirements optional * @param {Number} priority optional * @param {Boolean} isDomConstraint optional */ addConstraint: function addConstraint(name, requirements, priority, isDomConstraint) { if (window.Parsley._validatorRegistry.validators[name]) { var constraint = new Constraint(this, name, requirements, priority, isDomConstraint); // if constraint already exist, delete it and push new version if ('undefined' !== this.constraintsByName[constraint.name]) this.removeConstraint(constraint.name); this.constraints.push(constraint); this.constraintsByName[constraint.name] = constraint; } return this; }, // Remove a constraint removeConstraint: function removeConstraint(name) { for (var i = 0; i < this.constraints.length; i++) { if (name === this.constraints[i].name) { this.constraints.splice(i, 1); break; } } delete this.constraintsByName[name]; return this; }, // Update a constraint (Remove + re-add) updateConstraint: function updateConstraint(name, parameters, priority) { return this.removeConstraint(name).addConstraint(name, parameters, priority); }, // # Internals // Internal only. // Bind constraints from config + options + DOM _bindConstraints: function _bindConstraints() { var constraints = []; var constraintsByName = {}; // clean all existing DOM constraints to only keep javascript user constraints for (var i = 0; i < this.constraints.length; i++) { if (false === this.constraints[i].isDomConstraint) { constraints.push(this.constraints[i]); constraintsByName[this.constraints[i].name] = this.constraints[i]; } } this.constraints = constraints; this.constraintsByName = constraintsByName; // then re-add Parsley DOM-API constraints for (var name in this.options) { this.addConstraint(name, this.options[name], undefined, true); } // finally, bind special HTML5 constraints return this._bindHtml5Constraints(); }, // Internal only. // Bind specific HTML5 constraints to be HTML5 compliant _bindHtml5Constraints: function _bindHtml5Constraints() { // html5 required if (null !== this.element.getAttribute('required')) this.addConstraint('required', true, undefined, true); // html5 pattern if (null !== this.element.getAttribute('pattern')) this.addConstraint('pattern', this.element.getAttribute('pattern'), undefined, true); // range var min = this.element.getAttribute('min'); var max = this.element.getAttribute('max'); if (null !== min && null !== max) this.addConstraint('range', [min, max], undefined, true); // HTML5 min else if (null !== min) this.addConstraint('min', min, undefined, true); // HTML5 max else if (null !== max) this.addConstraint('max', max, undefined, true); // length if (null !== this.element.getAttribute('minlength') && null !== this.element.getAttribute('maxlength')) this.addConstraint('length', [this.element.getAttribute('minlength'), this.element.getAttribute('maxlength')], undefined, true); // HTML5 minlength else if (null !== this.element.getAttribute('minlength')) this.addConstraint('minlength', this.element.getAttribute('minlength'), undefined, true); // HTML5 maxlength else if (null !== this.element.getAttribute('maxlength')) this.addConstraint('maxlength', this.element.getAttribute('maxlength'), undefined, true); // html5 types var type = Utils.getType(this.element); // Small special case here for HTML5 number: integer validator if step attribute is undefined or an integer value, number otherwise if ('number' === type) { return this.addConstraint('type', ['number', { step: this.element.getAttribute('step') || '1', base: min || this.element.getAttribute('value') }], undefined, true); // Regular other HTML5 supported types } else if (/^(email|url|range|date)$/i.test(type)) { return this.addConstraint('type', type, undefined, true); } return this; }, // Internal only. // Field is required if have required constraint without `false` value _isRequired: function _isRequired() { if ('undefined' === typeof this.constraintsByName.required) return false; return false !== this.constraintsByName.required.requirements; }, // Internal only. // Shortcut to trigger an event _trigger: function _trigger(eventName) { return this.trigger('field:' + eventName); }, // Internal only // Handles whitespace in a value // Use `data-parsley-whitespace="squish"` to auto squish input value // Use `data-parsley-whitespace="trim"` to auto trim input value _handleWhitespace: function _handleWhitespace(value) { if (true === this.options.trimValue) Utils.warnOnce('data-parsley-trim-value="true" is deprecated, please use data-parsley-whitespace="trim"'); if ('squish' === this.options.whitespace) value = value.replace(/\s{2,}/g, ' '); if ('trim' === this.options.whitespace || 'squish' === this.options.whitespace || true === this.options.trimValue) value = Utils.trimString(value); return value; }, _isDateInput: function _isDateInput() { var c = this.constraintsByName.type; return c && c.requirements === 'date'; }, // Internal only. // Returns the constraints, grouped by descending priority. // The result is thus an array of arrays of constraints. _getGroupedConstraints: function _getGroupedConstraints() { if (false === this.options.priorityEnabled) return [this.constraints]; var groupedConstraints = []; var index = {}; // Create array unique of priorities for (var i = 0; i < this.constraints.length; i++) { var p = this.constraints[i].priority; if (!index[p]) groupedConstraints.push(index[p] = []); index[p].push(this.constraints[i]); } // Sort them by priority DESC groupedConstraints.sort(function (a, b) { return b[0].priority - a[0].priority; }); return groupedConstraints; } }; var Multiple = function Multiple() { this.__class__ = 'FieldMultiple'; }; Multiple.prototype = { // Add new `$element` sibling for multiple field addElement: function addElement($element) { this.$elements.push($element); return this; }, // See `Field._refreshConstraints()` _refreshConstraints: function _refreshConstraints() { var fieldConstraints; this.constraints = []; // Select multiple special treatment if (this.element.nodeName === 'SELECT') { this.actualizeOptions()._bindConstraints(); return this; } // Gather all constraints for each input in the multiple group for (var i = 0; i < this.$elements.length; i++) { // Check if element have not been dynamically removed since last binding if (!$('html').has(this.$elements[i]).length) { this.$elements.splice(i, 1); continue; } fieldConstraints = this.$elements[i].data('FieldMultiple')._refreshConstraints().constraints; for (var j = 0; j < fieldConstraints.length; j++) { this.addConstraint(fieldConstraints[j].name, fieldConstraints[j].requirements, fieldConstraints[j].priority, fieldConstraints[j].isDomConstraint); } } return this; }, // See `Field.getValue()` getValue: function getValue() { // Value could be overriden in DOM if ('function' === typeof this.options.value) return this.options.value(this);else if ('undefined' !== typeof this.options.value) return this.options.value; // Radio input case if (this.element.nodeName === 'INPUT') { var type = Utils.getType(this.element); if (type === 'radio') return this._findRelated().filter(':checked').val() || ''; // checkbox input case if (type === 'checkbox') { var values = []; this._findRelated().filter(':checked').each(function () { values.push($(this).val()); }); return values; } } // Select multiple case if (this.element.nodeName === 'SELECT' && null === this.$element.val()) return []; // Default case that should never happen return this.$element.val(); }, _init: function _init() { this.$elements = [this.$element]; return this; } }; var Factory = function Factory(element, options, parsleyFormInstance) { this.element = element; this.$element = $(element); // If the element has already been bound, returns its saved Parsley instance var savedparsleyFormInstance = this.$element.data('Parsley'); if (savedparsleyFormInstance) { // If the saved instance has been bound without a Form parent and there is one given in this call, add it if ('undefined' !== typeof parsleyFormInstance && savedparsleyFormInstance.parent === window.Parsley) { savedparsleyFormInstance.parent = parsleyFormInstance; savedparsleyFormInstance._resetOptions(savedparsleyFormInstance.options); } if ('object' === _typeof(options)) { _extends(savedparsleyFormInstance.options, options); } return savedparsleyFormInstance; } // Parsley must be instantiated with a DOM element or jQuery $element if (!this.$element.length) throw new Error('You must bind Parsley on an existing element.'); if ('undefined' !== typeof parsleyFormInstance && 'Form' !== parsleyFormInstance.__class__) throw new Error('Parent instance must be a Form instance'); this.parent = parsleyFormInstance || window.Parsley; return this.init(options); }; Factory.prototype = { init: function init(options) { this.__class__ = 'Parsley'; this.__version__ = '2.9.2'; this.__id__ = Utils.generateID(); // Pre-compute options this._resetOptions(options); // A Form instance is obviously a `<form>` element but also every node that is not an input and has the `data-parsley-validate` attribute if (this.element.nodeName === 'FORM' || Utils.checkAttr(this.element, this.options.namespace, 'validate') && !this.$element.is(this.options.inputs)) return this.bind('parsleyForm'); // Every other element is bound as a `Field` or `FieldMultiple` return this.isMultiple() ? this.handleMultiple() : this.bind('parsleyField'); }, isMultiple: function isMultiple() { var type = Utils.getType(this.element); return type === 'radio' || type === 'checkbox' || this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple'); }, // Multiples fields are a real nightmare :( // Maybe some refactoring would be appreciated here... handleMultiple: function handleMultiple() { var _this = this; var name; var parsleyMultipleInstance; // Handle multiple name this.options.multiple = this.options.multiple || (name = this.element.getAttribute('name')) || this.element.getAttribute('id'); // Special select multiple input if (this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple')) { this.options.multiple = this.options.multiple || this.__id__; return this.bind('parsleyFieldMultiple'); // Else for radio / checkboxes, we need a `name` or `data-parsley-multiple` to properly bind it } else if (!this.options.multiple) { Utils.warn('To be bound by Parsley, a radio, a checkbox and a multiple select input must have either a name or a multiple option.', this.$element); return this; } // Remove special chars this.options.multiple = this.options.multiple.replace(/(:|\.|\[|\]|\{|\}|\$)/g, ''); // Add proper `data-parsley-multiple` to siblings if we have a valid multiple name if (name) { $('input[name="' + name + '"]').each(function (i, input) { var type = Utils.getType(input); if (type === 'radio' || type === 'checkbox') input.setAttribute(_this.options.namespace + 'multiple', _this.options.multiple); }); } // Check here if we don't already have a related multiple instance saved var $previouslyRelated = this._findRelated(); for (var i = 0; i < $previouslyRelated.length; i++) { parsleyMultipleInstance = $($previouslyRelated.get(i)).data('Parsley'); if ('undefined' !== typeof parsleyMultipleInstance) { if (!this.$element.data('FieldMultiple')) { parsleyMultipleInstance.addElement(this.$element); } break; } } // Create a secret Field instance for every multiple field. It will be stored in `data('FieldMultiple')` // And will be useful later to access classic `Field` stuff while being in a `FieldMultiple` instance this.bind('parsleyField', true); return parsleyMultipleInstance || this.bind('parsleyFieldMultiple'); }, // Return proper `Form`, `Field` or `FieldMultiple` bind: function bind(type, doNotStore) { var parsleyInstance; switch (type) { case 'parsleyForm': parsleyInstance = $.extend(new Form(this.element, this.domOptions, this.options), new Base(), window.ParsleyExtend)._bindFields(); break; case 'parsleyField': parsleyInstance = $.extend(new Field(this.element, this.domOptions, this.options, this.parent), new Base(), window.ParsleyExtend); break; case 'parsleyFieldMultiple': parsleyInstance = $.extend(new Field(this.element, this.domOptions, this.options, this.parent), new Multiple(), new Base(), window.ParsleyExtend)._init(); break; default: throw new Error(type + 'is not a supported Parsley type'); } if (this.options.multiple) Utils.setAttr(this.element, this.options.namespace, 'multiple', this.options.multiple); if ('undefined' !== typeof doNotStore) { this.$element.data('FieldMultiple', parsleyInstance); return parsleyInstance; } // Store the freshly bound instance in a DOM element for later access using jQuery `data()` this.$element.data('Parsley', parsleyInstance); // Tell the world we have a new Form or Field instance! parsleyInstance._actualizeTriggers(); parsleyInstance._trigger('init'); return parsleyInstance; } }; var vernums = $.fn.jquery.split('.'); if (parseInt(vernums[0]) <= 1 && parseInt(vernums[1]) < 8) { throw "The loaded version of jQuery is too old. Please upgrade to 1.8.x or better."; } if (!vernums.forEach) { Utils.warn('Parsley requires ES5 to run properly. Please include https://github.com/es-shims/es5-shim'); } // Inherit `on`, `off` & `trigger` to Parsley: var Parsley = _extends(new Base(), { element: document, $element: $(document), actualizeOptions: null, _resetOptions: null, Factory: Factory, version: '2.9.2' }); // Supplement Field and Form with Base // This way, the constructors will have access to those methods _extends(Field.prototype, UI.Field, Base.prototype); _extends(Form.prototype, UI.Form, Base.prototype); // Inherit actualizeOptions and _resetOptions: _extends(Factory.prototype, Base.prototype); // ### jQuery API // `$('.elem').parsley(options)` or `$('.elem').psly(options)` $.fn.parsley = $.fn.psly = function (options) { if (this.length > 1) { var instances = []; this.each(function () { instances.push($(this).parsley(options)); }); return instances; } // Return undefined if applied to non existing DOM element if (this.length == 0) { return; } return new Factory(this[0], options); }; // ### Field and Form extension // Ensure the extension is now defined if it wasn't previously if ('undefined' === typeof window.ParsleyExtend) window.ParsleyExtend = {}; // ### Parsley config // Inherit from ParsleyDefault, and copy over any existing values Parsley.options = _extends(Utils.objectCreate(Defaults), window.ParsleyConfig); window.ParsleyConfig = Parsley.options; // Old way of accessing global options // ### Globals window.Parsley = window.psly = Parsley; Parsley.Utils = Utils; window.ParsleyUtils = {}; $.each(Utils, function (key, value) { if ('function' === typeof value) { window.ParsleyUtils[key] = function () { Utils.warnOnce('Accessing `window.ParsleyUtils` is deprecated. Use `window.Parsley.Utils` instead.'); return Utils[key].apply(Utils, arguments); }; } }); // ### Define methods that forward to the registry, and deprecate all access except through window.Parsley var registry = window.Parsley._validatorRegistry = new ValidatorRegistry(window.ParsleyConfig.validators, window.ParsleyConfig.i18n); window.ParsleyValidator = {}; $.each('setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator hasValidator'.split(' '), function (i, method) { window.Parsley[method] = function () { return registry[method].apply(registry, arguments); }; window.ParsleyValidator[method] = function () { var _window$Parsley; Utils.warnOnce("Accessing the method '".concat(method, "' through Validator is deprecated. Simply call 'window.Parsley.").concat(method, "(...)'")); return (_window$Parsley = window.Parsley)[method].apply(_window$Parsley, arguments); }; }); // ### UI // Deprecated global object window.Parsley.UI = UI; window.ParsleyUI = { removeError: function removeError(instance, name, doNotUpdateClass) { var updateClass = true !== doNotUpdateClass; Utils.warnOnce("Accessing UI is deprecated. Call 'removeError' on the instance directly. Please comment in issue 1073 as to your need to call this method."); return instance.removeError(name, { updateClass: updateClass }); }, getErrorsMessages: function getErrorsMessages(instance) { Utils.warnOnce("Accessing UI is deprecated. Call 'getErrorsMessages' on the instance directly."); return instance.getErrorsMessages(); } }; $.each('addError updateError'.split(' '), function (i, method) { window.ParsleyUI[method] = function (instance, name, message, assert, doNotUpdateClass) { var updateClass = true !== doNotUpdateClass; Utils.warnOnce("Accessing UI is deprecated. Call '".concat(method, "' on the instance directly. Please comment in issue 1073 as to your need to call this method.")); return instance[method](name, { message: message, assert: assert, updateClass: updateClass }); }; }); // ### PARSLEY auto-binding // Prevent it by setting `ParsleyConfig.autoBind` to `false` if (false !== window.ParsleyConfig.autoBind) { $(function () { // Works only on `data-parsley-validate`. if ($('[data-parsley-validate]').length) $('[data-parsley-validate]').parsley(); }); } var o = $({}); var deprecated = function deprecated() { Utils.warnOnce("Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley"); }; // Returns an event handler that calls `fn` with the arguments it expects function adapt(fn, context) { // Store to allow unbinding if (!fn.parsleyAdaptedCallback) { fn.parsleyAdaptedCallback = function () { var args = Array.prototype.slice.call(arguments, 0); args.unshift(this); fn.apply(context || o, args); }; } return fn.parsleyAdaptedCallback; } var eventPrefix = 'parsley:'; // Converts 'parsley:form:validate' into 'form:validate' function eventName(name) { if (name.lastIndexOf(eventPrefix, 0) === 0) return name.substr(eventPrefix.length); return name; } // $.listen is deprecated. Use Parsley.on instead. $.listen = function (name, callback) { var context; deprecated(); if ('object' === _typeof(arguments[1]) && 'function' === typeof arguments[2]) { context = arguments[1]; callback = arguments[2]; } if ('function' !== typeof callback) throw new Error('Wrong parameters'); window.Parsley.on(eventName(name), adapt(callback, context)); }; $.listenTo = function (instance, name, fn) { deprecated(); if (!(instance instanceof Field) && !(instance instanceof Form)) throw new Error('Must give Parsley instance'); if ('string' !== typeof name || 'function' !== typeof fn) throw new Error('Wrong parameters'); instance.on(eventName(name), adapt(fn)); }; $.unsubscribe = function (name, fn) { deprecated(); if ('string' !== typeof name || 'function' !== typeof fn) throw new Error('Wrong arguments'); window.Parsley.off(eventName(name), fn.parsleyAdaptedCallback); }; $.unsubscribeTo = function (instance, name) { deprecated(); if (!(instance instanceof Field) && !(instance instanceof Form)) throw new Error('Must give Parsley instance'); instance.off(eventName(name)); }; $.unsubscribeAll = function (name) { deprecated(); window.Parsley.off(eventName(name)); $('form,input,textarea,select').each(function () { var instance = $(this).data('Parsley'); if (instance) { instance.off(eventName(name)); } }); }; // $.emit is deprecated. Use jQuery events instead. $.emit = function (name, instance) { var _instance; deprecated(); var instanceGiven = instance instanceof Field || instance instanceof Form; var args = Array.prototype.slice.call(arguments, instanceGiven ? 2 : 1); args.unshift(eventName(name)); if (!instanceGiven) { instance = window.Parsley; } (_instance = instance).trigger.apply(_instance, _toConsumableArray(args)); }; $.extend(true, Parsley, { asyncValidators: { 'default': { fn: function fn(xhr) { // By default, only status 2xx are deemed successful. // Note: we use status instead of state() because responses with status 200 // but invalid messages (e.g. an empty body for content type set to JSON) will // result in state() === 'rejected'. return xhr.status >= 200 && xhr.status < 300; }, url: false }, reverse: { fn: function fn(xhr) { // If reverse option is set, a failing ajax request is considered successful return xhr.status < 200 || xhr.status >= 300; }, url: false } }, addAsyncValidator: function addAsyncValidator(name, fn, url, options) { Parsley.asyncValidators[name] = { fn: fn, url: url || false, options: options || {} }; return this; } }); Parsley.addValidator('remote', { requirementType: { '': 'string', 'validator': 'string', 'reverse': 'boolean', 'options': 'object' }, validateString: function validateString(value, url, options, instance) { var data = {}; var ajaxOptions; var csr; var validator = options.validator || (true === options.reverse ? 'reverse' : 'default'); if ('undefined' === typeof Parsley.asyncValidators[validator]) throw new Error('Calling an undefined async validator: `' + validator + '`'); url = Parsley.asyncValidators[validator].url || url; // Fill current value if (url.indexOf('{value}') > -1) { url = url.replace('{value}', encodeURIComponent(value)); } else { data[instance.element.getAttribute('name') || instance.element.getAttribute('id')] = value; } // Merge options passed in from the function with the ones in the attribute var remoteOptions = $.extend(true, options.options || {}, Parsley.asyncValidators[validator].options); // All `$.ajax(options)` could be overridden or extended directly from DOM in `data-parsley-remote-options` ajaxOptions = $.extend(true, {}, { url: url, data: data, type: 'GET' }, remoteOptions); // Generate store key based on ajax options instance.trigger('field:ajaxoptions', instance, ajaxOptions); csr = $.param(ajaxOptions); // Initialise querry cache if ('undefined' === typeof Parsley._remoteCache) Parsley._remoteCache = {}; // Try to retrieve stored xhr var xhr = Parsley._remoteCache[csr] = Parsley._remoteCache[csr] || $.ajax(ajaxOptions); var handleXhr = function handleXhr() { var result = Parsley.asyncValidators[validator].fn.call(instance, xhr, url, options); if (!result) // Map falsy results to rejected promise result = $.Deferred().reject(); return $.when(result); }; return xhr.then(handleXhr, handleXhr); }, priority: -1 }); Parsley.on('form:submit', function () { Parsley._remoteCache = {}; }); Base.prototype.addAsyncValidator = function () { Utils.warnOnce('Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(...)`'); return Parsley.addAsyncValidator.apply(Parsley, arguments); }; // This is included with the Parsley library itself, Parsley.addMessages('en', { defaultMessage: "This value seems to be invalid.", type: { email: "This value should be a valid email.", url: "This value should be a valid url.", number: "This value should be a valid number.", integer: "This value should be a valid integer.", digits: "This value should be digits.", alphanum: "This value should be alphanumeric." }, notblank: "This value should not be blank.", required: "This value is required.", pattern: "This value seems to be invalid.", min: "This value should be greater than or equal to %s.", max: "This value should be lower than or equal to %s.", range: "This value should be between %s and %s.", minlength: "This value is too short. It should have %s characters or more.", maxlength: "This value is too long. It should have %s characters or fewer.", length: "This value length is invalid. It should be between %s and %s characters long.", mincheck: "You must select at least %s choices.", maxcheck: "You must select %s choices or fewer.", check: "You must select between %s and %s choices.", equalto: "This value should be the same.", euvatin: "It's not a valid VAT Identification Number." }); Parsley.setLocale('en'); function InputEvent() { var _this = this; var globals = window || __webpack_require__.g; // Slightly odd way construct our object. This way methods are force bound. // Used to test for duplicate library. _extends(this, { // For browsers that do not support isTrusted, assumes event is native. isNativeEvent: function isNativeEvent(evt) { return evt.originalEvent && evt.originalEvent.isTrusted !== false; }, fakeInputEvent: function fakeInputEvent(evt) { if (_this.isNativeEvent(evt)) { $(evt.target).trigger('input'); } }, misbehaves: function misbehaves(evt) { if (_this.isNativeEvent(evt)) { _this.behavesOk(evt); $(document).on('change.inputevent', evt.data.selector, _this.fakeInputEvent); _this.fakeInputEvent(evt); } }, behavesOk: function behavesOk(evt) { if (_this.isNativeEvent(evt)) { $(document) // Simply unbinds the testing handler .off('input.inputevent', evt.data.selector, _this.behavesOk).off('change.inputevent', evt.data.selector, _this.misbehaves); } }, // Bind the testing handlers install: function install() { if (globals.inputEventPatched) { return; } globals.inputEventPatched = '0.0.3'; for (var _i = 0, _arr = ['select', 'input[type="checkbox"]', 'input[type="radio"]', 'input[type="file"]']; _i < _arr.length; _i++) { var selector = _arr[_i]; $(document).on('input.inputevent', selector, { selector: selector }, _this.behavesOk).on('change.inputevent', selector, { selector: selector }, _this.misbehaves); } }, uninstall: function uninstall() { delete globals.inputEventPatched; $(document).off('.inputevent'); } }); } var inputevent = new InputEvent(); inputevent.install(); return Parsley; }))); //# sourceMappingURL=parsley.js.map /***/ }, /***/ 5458 /*!*************************************************!*\ !*** ./node_modules/select2/dist/js/select2.js ***! \*************************************************/ (module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! * Select2 4.0.13 * https://select2.github.io * * Released under the MIT license * https://github.com/select2/select2/blob/master/LICENSE.md */ ;(function (factory) { if (true) { // AMD. Register as an anonymous module. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ 428)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else // removed by dead control flow {} } (function (jQuery) { // This is needed so we can catch the AMD loader configuration and use it // The inner file should be wrapped (by `banner.start.js`) in a function that // returns the AMD loader references. var S2 =(function () { // Restore the Select2 AMD loader so it can be used // Needed mostly in the language files, where the loader is not inserted if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { var S2 = jQuery.fn.select2.amd; } var S2;(function () { if (!S2 || !S2.requirejs) { if (!S2) { S2 = {}; } else { require = S2; } /** * @license almond 0.3.3 Copyright jQuery Foundation and other contributors. * Released under MIT license, http://github.com/requirejs/almond/LICENSE */ //Going sloppy to avoid 'use strict' string cost, but strict practices should //be followed. /*global setTimeout: false */ var requirejs, require, define; (function (undef) { var main, req, makeMap, handlers, defined = {}, waiting = {}, config = {}, defining = {}, hasOwn = Object.prototype.hasOwnProperty, aps = [].slice, jsSuffixRegExp = /\.js$/; function hasProp(obj, prop) { return hasOwn.call(obj, prop); } /** * Given a relative module name, like ./something, normalize it to * a real name that can be mapped to a path. * @param {String} name the relative name * @param {String} baseName a real name that the name arg is relative * to. * @returns {String} normalized name */ function normalize(name, baseName) { var nameParts, nameSegment, mapValue, foundMap, lastIndex, foundI, foundStarMap, starI, i, j, part, normalizedBaseParts, baseParts = baseName && baseName.split("/"), map = config.map, starMap = (map && map['*']) || {}; //Adjust any relative paths. if (name) { name = name.split('/'); lastIndex = name.length - 1; // If wanting node ID compatibility, strip .js from end // of IDs. Have to do this here, and not in nameToUrl // because node allows either .js or non .js to map // to same file. if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); } // Starts with a '.' so need the baseName if (name[0].charAt(0) === '.' && baseParts) { //Convert baseName to array, and lop off the last part, //so that . matches that 'directory' and not name of the baseName's //module. For instance, baseName of 'one/two/three', maps to //'one/two/three.js', but we want the directory, 'one/two' for //this normalization. normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); name = normalizedBaseParts.concat(name); } //start trimDots for (i = 0; i < name.length; i++) { part = name[i]; if (part === '.') { name.splice(i, 1); i -= 1; } else if (part === '..') { // If at the start, or previous value is still .., // keep them so that when converted to a path it may // still work when converted to a path, even though // as an ID it is less than ideal. In larger point // releases, may be better to just kick out an error. if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') { continue; } else if (i > 0) { name.splice(i - 1, 2); i -= 2; } } } //end trimDots name = name.join('/'); } //Apply map config if available. if ((baseParts || starMap) && map) { nameParts = name.split('/'); for (i = nameParts.length; i > 0; i -= 1) { nameSegment = nameParts.slice(0, i).join("/"); if (baseParts) { //Find the longest baseName segment match in the config. //So, do joins on the biggest to smallest lengths of baseParts. for (j = baseParts.length; j > 0; j -= 1) { mapValue = map[baseParts.slice(0, j).join('/')]; //baseName segment has config, find if it has one for //this name. if (mapValue) { mapValue = mapValue[nameSegment]; if (mapValue) { //Match, update name to the new value. foundMap = mapValue; foundI = i; break; } } } } if (foundMap) { break; } //Check for a star map match, but just hold on to it, //if there is a shorter segment match later in a matching //config, then favor over this star map. if (!foundStarMap && starMap && starMap[nameSegment]) { foundStarMap = starMap[nameSegment]; starI = i; } } if (!foundMap && foundStarMap) { foundMap = foundStarMap; foundI = starI; } if (foundMap) { nameParts.splice(0, foundI, foundMap); name = nameParts.join('/'); } } return name; } function makeRequire(relName, forceSync) { return function () { //A version of a require function that passes a moduleName //value for items that may need to //look up paths relative to the moduleName var args = aps.call(arguments, 0); //If first arg is not require('string'), and there is only //one arg, it is the array form without a callback. Insert //a null so that the following concat is correct. if (typeof args[0] !== 'string' && args.length === 1) { args.push(null); } return req.apply(undef, args.concat([relName, forceSync])); }; } function makeNormalize(relName) { return function (name) { return normalize(name, relName); }; } function makeLoad(depName) { return function (value) { defined[depName] = value; }; } function callDep(name) { if (hasProp(waiting, name)) { var args = waiting[name]; delete waiting[name]; defining[name] = true; main.apply(undef, args); } if (!hasProp(defined, name) && !hasProp(defining, name)) { throw new Error('No ' + name); } return defined[name]; } //Turns a plugin!resource to [plugin, resource] //with the plugin being undefined if the name //did not have a plugin prefix. function splitPrefix(name) { var prefix, index = name ? name.indexOf('!') : -1; if (index > -1) { prefix = name.substring(0, index); name = name.substring(index + 1, name.length); } return [prefix, name]; } //Creates a parts array for a relName where first part is plugin ID, //second part is resource ID. Assumes relName has already been normalized. function makeRelParts(relName) { return relName ? splitPrefix(relName) : []; } /** * Makes a name map, normalizing the name, and using a plugin * for normalization if necessary. Grabs a ref to plugin * too, as an optimization. */ makeMap = function (name, relParts) { var plugin, parts = splitPrefix(name), prefix = parts[0], relResourceName = relParts[1]; name = parts[1]; if (prefix) { prefix = normalize(prefix, relResourceName); plugin = callDep(prefix); } //Normalize according if (prefix) { if (plugin && plugin.normalize) { name = plugin.normalize(name, makeNormalize(relResourceName)); } else { name = normalize(name, relResourceName); } } else { name = normalize(name, relResourceName); parts = splitPrefix(name); prefix = parts[0]; name = parts[1]; if (prefix) { plugin = callDep(prefix); } } //Using ridiculous property names for space reasons return { f: prefix ? prefix + '!' + name : name, //fullName n: name, pr: prefix, p: plugin }; }; function makeConfig(name) { return function () { return (config && config.config && config.config[name]) || {}; }; } handlers = { require: function (name) { return makeRequire(name); }, exports: function (name) { var e = defined[name]; if (typeof e !== 'undefined') { return e; } else { return (defined[name] = {}); } }, module: function (name) { return { id: name, uri: '', exports: defined[name], config: makeConfig(name) }; } }; main = function (name, deps, callback, relName) { var cjsModule, depName, ret, map, i, relParts, args = [], callbackType = typeof callback, usingExports; //Use name if no relName relName = relName || name; relParts = makeRelParts(relName); //Call the callback to define the module, if necessary. if (callbackType === 'undefined' || callbackType === 'function') { //Pull out the defined dependencies and pass the ordered //values to the callback. //Default to [require, exports, module] if no deps deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; for (i = 0; i < deps.length; i += 1) { map = makeMap(deps[i], relParts); depName = map.f; //Fast path CommonJS standard dependencies. if (depName === "require") { args[i] = handlers.require(name); } else if (depName === "exports") { //CommonJS module spec 1.1 args[i] = handlers.exports(name); usingExports = true; } else if (depName === "module") { //CommonJS module spec 1.1 cjsModule = args[i] = handlers.module(name); } else if (hasProp(defined, depName) || hasProp(waiting, depName) || hasProp(defining, depName)) { args[i] = callDep(depName); } else if (map.p) { map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); args[i] = defined[depName]; } else { throw new Error(name + ' missing ' + depName); } } ret = callback ? callback.apply(defined[name], args) : undefined; if (name) { //If setting exports via "module" is in play, //favor that over return value and exports. After that, //favor a non-undefined return value over exports use. if (cjsModule && cjsModule.exports !== undef && cjsModule.exports !== defined[name]) { defined[name] = cjsModule.exports; } else if (ret !== undef || !usingExports) { //Use the return value from the function. defined[name] = ret; } } } else if (name) { //May just be an object definition for the module. Only //worry about defining if have a module name. defined[name] = callback; } }; requirejs = require = req = function (deps, callback, relName, forceSync, alt) { if (typeof deps === "string") { if (handlers[deps]) { //callback in this case is really relName return handlers[deps](callback); } //Just return the module wanted. In this scenario, the //deps arg is the module name, and second arg (if passed) //is just the relName. //Normalize module name, if it contains . or .. return callDep(makeMap(deps, makeRelParts(callback)).f); } else if (!deps.splice) { //deps is a config object, not an array. config = deps; if (config.deps) { req(config.deps, config.callback); } if (!callback) { return; } if (callback.splice) { //callback is an array, which means it is a dependency list. //Adjust args if there are dependencies deps = callback; callback = relName; relName = null; } else { deps = undef; } } //Support require(['a']) callback = callback || function () {}; //If relName is a function, it is an errback handler, //so remove it. if (typeof relName === 'function') { relName = forceSync; forceSync = alt; } //Simulate async callback; if (forceSync) { main(undef, deps, callback, relName); } else { //Using a non-zero value because of concern for what old browsers //do, and latest browsers "upgrade" to 4 if lower value is used: //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: //If want a value immediately, use require('id') instead -- something //that works in almond on the global level, but not guaranteed and //unlikely to work in other AMD implementations. setTimeout(function () { main(undef, deps, callback, relName); }, 4); } return req; }; /** * Just drops the config on the floor, but returns req in case * the config return value is used. */ req.config = function (cfg) { return req(cfg); }; /** * Expose module registry for debugging and tooling */ requirejs._defined = defined; define = function (name, deps, callback) { if (typeof name !== 'string') { throw new Error('See almond README: incorrect module build, no module name'); } //This module may not have dependencies if (!deps.splice) { //deps is not an array, so probably means //an object literal or factory function for //the value. Adjust args. callback = deps; deps = []; } if (!hasProp(defined, name) && !hasProp(waiting, name)) { waiting[name] = [name, deps, callback]; } }; define.amd = { jQuery: true }; }()); S2.requirejs = requirejs;S2.require = require;S2.define = define; } }()); S2.define("almond", function(){}); /* global jQuery:false, $:false */ S2.define('jquery',[],function () { var _$ = jQuery || $; if (_$ == null && console && console.error) { console.error( 'Select2: An instance of jQuery or a jQuery-compatible library was not ' + 'found. Make sure that you are including jQuery before Select2 on your ' + 'web page.' ); } return _$; }); S2.define('select2/utils',[ 'jquery' ], function ($) { var Utils = {}; Utils.Extend = function (ChildClass, SuperClass) { var __hasProp = {}.hasOwnProperty; function BaseConstructor () { this.constructor = ChildClass; } for (var key in SuperClass) { if (__hasProp.call(SuperClass, key)) { ChildClass[key] = SuperClass[key]; } } BaseConstructor.prototype = SuperClass.prototype; ChildClass.prototype = new BaseConstructor(); ChildClass.__super__ = SuperClass.prototype; return ChildClass; }; function getMethods (theClass) { var proto = theClass.prototype; var methods = []; for (var methodName in proto) { var m = proto[methodName]; if (typeof m !== 'function') { continue; } if (methodName === 'constructor') { continue; } methods.push(methodName); } return methods; } Utils.Decorate = function (SuperClass, DecoratorClass) { var decoratedMethods = getMethods(DecoratorClass); var superMethods = getMethods(SuperClass); function DecoratedClass () { var unshift = Array.prototype.unshift; var argCount = DecoratorClass.prototype.constructor.length; var calledConstructor = SuperClass.prototype.constructor; if (argCount > 0) { unshift.call(arguments, SuperClass.prototype.constructor); calledConstructor = DecoratorClass.prototype.constructor; } calledConstructor.apply(this, arguments); } DecoratorClass.displayName = SuperClass.displayName; function ctr () { this.constructor = DecoratedClass; } DecoratedClass.prototype = new ctr(); for (var m = 0; m < superMethods.length; m++) { var superMethod = superMethods[m]; DecoratedClass.prototype[superMethod] = SuperClass.prototype[superMethod]; } var calledMethod = function (methodName) { // Stub out the original method if it's not decorating an actual method var originalMethod = function () {}; if (methodName in DecoratedClass.prototype) { originalMethod = DecoratedClass.prototype[methodName]; } var decoratedMethod = DecoratorClass.prototype[methodName]; return function () { var unshift = Array.prototype.unshift; unshift.call(arguments, originalMethod); return decoratedMethod.apply(this, arguments); }; }; for (var d = 0; d < decoratedMethods.length; d++) { var decoratedMethod = decoratedMethods[d]; DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); } return DecoratedClass; }; var Observable = function () { this.listeners = {}; }; Observable.prototype.on = function (event, callback) { this.listeners = this.listeners || {}; if (event in this.listeners) { this.listeners[event].push(callback); } else { this.listeners[event] = [callback]; } }; Observable.prototype.trigger = function (event) { var slice = Array.prototype.slice; var params = slice.call(arguments, 1); this.listeners = this.listeners || {}; // Params should always come in as an array if (params == null) { params = []; } // If there are no arguments to the event, use a temporary object if (params.length === 0) { params.push({}); } // Set the `_type` of the first object to the event params[0]._type = event; if (event in this.listeners) { this.invoke(this.listeners[event], slice.call(arguments, 1)); } if ('*' in this.listeners) { this.invoke(this.listeners['*'], arguments); } }; Observable.prototype.invoke = function (listeners, params) { for (var i = 0, len = listeners.length; i < len; i++) { listeners[i].apply(this, params); } }; Utils.Observable = Observable; Utils.generateChars = function (length) { var chars = ''; for (var i = 0; i < length; i++) { var randomChar = Math.floor(Math.random() * 36); chars += randomChar.toString(36); } return chars; }; Utils.bind = function (func, context) { return function () { func.apply(context, arguments); }; }; Utils._convertData = function (data) { for (var originalKey in data) { var keys = originalKey.split('-'); var dataLevel = data; if (keys.length === 1) { continue; } for (var k = 0; k < keys.length; k++) { var key = keys[k]; // Lowercase the first letter // By default, dash-separated becomes camelCase key = key.substring(0, 1).toLowerCase() + key.substring(1); if (!(key in dataLevel)) { dataLevel[key] = {}; } if (k == keys.length - 1) { dataLevel[key] = data[originalKey]; } dataLevel = dataLevel[key]; } delete data[originalKey]; } return data; }; Utils.hasScroll = function (index, el) { // Adapted from the function created by @ShadowScripter // and adapted by @BillBarry on the Stack Exchange Code Review website. // The original code can be found at // http://codereview.stackexchange.com/q/13338 // and was designed to be used with the Sizzle selector engine. var $el = $(el); var overflowX = el.style.overflowX; var overflowY = el.style.overflowY; //Check both x and y declarations if (overflowX === overflowY && (overflowY === 'hidden' || overflowY === 'visible')) { return false; } if (overflowX === 'scroll' || overflowY === 'scroll') { return true; } return ($el.innerHeight() < el.scrollHeight || $el.innerWidth() < el.scrollWidth); }; Utils.escapeMarkup = function (markup) { var replaceMap = { '\\': '\', '&': '&', '<': '<', '>': '>', '"': '"', '\'': ''', '/': '/' }; // Do not try to escape the markup if it's not a string if (typeof markup !== 'string') { return markup; } return String(markup).replace(/[&<>"'\/\\]/g, function (match) { return replaceMap[match]; }); }; // Append an array of jQuery nodes to a given element. Utils.appendMany = function ($element, $nodes) { // jQuery 1.7.x does not support $.fn.append() with an array // Fall back to a jQuery object collection using $.fn.add() if ($.fn.jquery.substr(0, 3) === '1.7') { var $jqNodes = $(); $.map($nodes, function (node) { $jqNodes = $jqNodes.add(node); }); $nodes = $jqNodes; } $element.append($nodes); }; // Cache objects in Utils.__cache instead of $.data (see #4346) Utils.__cache = {}; var id = 0; Utils.GetUniqueElementId = function (element) { // Get a unique element Id. If element has no id, // creates a new unique number, stores it in the id // attribute and returns the new id. // If an id already exists, it simply returns it. var select2Id = element.getAttribute('data-select2-id'); if (select2Id == null) { // If element has id, use it. if (element.id) { select2Id = element.id; element.setAttribute('data-select2-id', select2Id); } else { element.setAttribute('data-select2-id', ++id); select2Id = id.toString(); } } return select2Id; }; Utils.StoreData = function (element, name, value) { // Stores an item in the cache for a specified element. // name is the cache key. var id = Utils.GetUniqueElementId(element); if (!Utils.__cache[id]) { Utils.__cache[id] = {}; } Utils.__cache[id][name] = value; }; Utils.GetData = function (element, name) { // Retrieves a value from the cache by its key (name) // name is optional. If no name specified, return // all cache items for the specified element. // and for a specified element. var id = Utils.GetUniqueElementId(element); if (name) { if (Utils.__cache[id]) { if (Utils.__cache[id][name] != null) { return Utils.__cache[id][name]; } return $(element).data(name); // Fallback to HTML5 data attribs. } return $(element).data(name); // Fallback to HTML5 data attribs. } else { return Utils.__cache[id]; } }; Utils.RemoveData = function (element) { // Removes all cached items for a specified element. var id = Utils.GetUniqueElementId(element); if (Utils.__cache[id] != null) { delete Utils.__cache[id]; } element.removeAttribute('data-select2-id'); }; return Utils; }); S2.define('select2/results',[ 'jquery', './utils' ], function ($, Utils) { function Results ($element, options, dataAdapter) { this.$element = $element; this.data = dataAdapter; this.options = options; Results.__super__.constructor.call(this); } Utils.Extend(Results, Utils.Observable); Results.prototype.render = function () { var $results = $( '<ul class="select2-results__options" role="listbox"></ul>' ); if (this.options.get('multiple')) { $results.attr('aria-multiselectable', 'true'); } this.$results = $results; return $results; }; Results.prototype.clear = function () { this.$results.empty(); }; Results.prototype.displayMessage = function (params) { var escapeMarkup = this.options.get('escapeMarkup'); this.clear(); this.hideLoading(); var $message = $( '<li role="alert" aria-live="assertive"' + ' class="select2-results__option"></li>' ); var message = this.options.get('translations').get(params.message); $message.append( escapeMarkup( message(params.args) ) ); $message[0].className += ' select2-results__message'; this.$results.append($message); }; Results.prototype.hideMessages = function () { this.$results.find('.select2-results__message').remove(); }; Results.prototype.append = function (data) { this.hideLoading(); var $options = []; if (data.results == null || data.results.length === 0) { if (this.$results.children().length === 0) { this.trigger('results:message', { message: 'noResults' }); } return; } data.results = this.sort(data.results); for (var d = 0; d < data.results.length; d++) { var item = data.results[d]; var $option = this.option(item); $options.push($option); } this.$results.append($options); }; Results.prototype.position = function ($results, $dropdown) { var $resultsContainer = $dropdown.find('.select2-results'); $resultsContainer.append($results); }; Results.prototype.sort = function (data) { var sorter = this.options.get('sorter'); return sorter(data); }; Results.prototype.highlightFirstItem = function () { var $options = this.$results .find('.select2-results__option[aria-selected]'); var $selected = $options.filter('[aria-selected=true]'); // Check if there are any selected options if ($selected.length > 0) { // If there are selected options, highlight the first $selected.first().trigger('mouseenter'); } else { // If there are no selected options, highlight the first option // in the dropdown $options.first().trigger('mouseenter'); } this.ensureHighlightVisible(); }; Results.prototype.setClasses = function () { var self = this; this.data.current(function (selected) { var selectedIds = $.map(selected, function (s) { return s.id.toString(); }); var $options = self.$results .find('.select2-results__option[aria-selected]'); $options.each(function () { var $option = $(this); var item = Utils.GetData(this, 'data'); // id needs to be converted to a string when comparing var id = '' + item.id; if ((item.element != null && item.element.selected) || (item.element == null && $.inArray(id, selectedIds) > -1)) { $option.attr('aria-selected', 'true'); } else { $option.attr('aria-selected', 'false'); } }); }); }; Results.prototype.showLoading = function (params) { this.hideLoading(); var loadingMore = this.options.get('translations').get('searching'); var loading = { disabled: true, loading: true, text: loadingMore(params) }; var $loading = this.option(loading); $loading.className += ' loading-results'; this.$results.prepend($loading); }; Results.prototype.hideLoading = function () { this.$results.find('.loading-results').remove(); }; Results.prototype.option = function (data) { var option = document.createElement('li'); option.className = 'select2-results__option'; var attrs = { 'role': 'option', 'aria-selected': 'false' }; var matches = window.Element.prototype.matches || window.Element.prototype.msMatchesSelector || window.Element.prototype.webkitMatchesSelector; if ((data.element != null && matches.call(data.element, ':disabled')) || (data.element == null && data.disabled)) { delete attrs['aria-selected']; attrs['aria-disabled'] = 'true'; } if (data.id == null) { delete attrs['aria-selected']; } if (data._resultId != null) { option.id = data._resultId; } if (data.title) { option.title = data.title; } if (data.children) { attrs.role = 'group'; attrs['aria-label'] = data.text; delete attrs['aria-selected']; } for (var attr in attrs) { var val = attrs[attr]; option.setAttribute(attr, val); } if (data.children) { var $option = $(option); var label = document.createElement('strong'); label.className = 'select2-results__group'; var $label = $(label); this.template(data, label); var $children = []; for (var c = 0; c < data.children.length; c++) { var child = data.children[c]; var $child = this.option(child); $children.push($child); } var $childrenContainer = $('<ul></ul>', { 'class': 'select2-results__options select2-results__options--nested' }); $childrenContainer.append($children); $option.append(label); $option.append($childrenContainer); } else { this.template(data, option); } Utils.StoreData(option, 'data', data); return option; }; Results.prototype.bind = function (container, $container) { var self = this; var id = container.id + '-results'; this.$results.attr('id', id); container.on('results:all', function (params) { self.clear(); self.append(params.data); if (container.isOpen()) { self.setClasses(); self.highlightFirstItem(); } }); container.on('results:append', function (params) { self.append(params.data); if (container.isOpen()) { self.setClasses(); } }); container.on('query', function (params) { self.hideMessages(); self.showLoading(params); }); container.on('select', function () { if (!container.isOpen()) { return; } self.setClasses(); if (self.options.get('scrollAfterSelect')) { self.highlightFirstItem(); } }); container.on('unselect', function () { if (!container.isOpen()) { return; } self.setClasses(); if (self.options.get('scrollAfterSelect')) { self.highlightFirstItem(); } }); container.on('open', function () { // When the dropdown is open, aria-expended="true" self.$results.attr('aria-expanded', 'true'); self.$results.attr('aria-hidden', 'false'); self.setClasses(); self.ensureHighlightVisible(); }); container.on('close', function () { // When the dropdown is closed, aria-expended="false" self.$results.attr('aria-expanded', 'false'); self.$results.attr('aria-hidden', 'true'); self.$results.removeAttr('aria-activedescendant'); }); container.on('results:toggle', function () { var $highlighted = self.getHighlightedResults(); if ($highlighted.length === 0) { return; } $highlighted.trigger('mouseup'); }); container.on('results:select', function () { var $highlighted = self.getHighlightedResults(); if ($highlighted.length === 0) { return; } var data = Utils.GetData($highlighted[0], 'data'); if ($highlighted.attr('aria-selected') == 'true') { self.trigger('close', {}); } else { self.trigger('select', { data: data }); } }); container.on('results:previous', function () { var $highlighted = self.getHighlightedResults(); var $options = self.$results.find('[aria-selected]'); var currentIndex = $options.index($highlighted); // If we are already at the top, don't move further // If no options, currentIndex will be -1 if (currentIndex <= 0) { return; } var nextIndex = currentIndex - 1; // If none are highlighted, highlight the first if ($highlighted.length === 0) { nextIndex = 0; } var $next = $options.eq(nextIndex); $next.trigger('mouseenter'); var currentOffset = self.$results.offset().top; var nextTop = $next.offset().top; var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); if (nextIndex === 0) { self.$results.scrollTop(0); } else if (nextTop - currentOffset < 0) { self.$results.scrollTop(nextOffset); } }); container.on('results:next', function () { var $highlighted = self.getHighlightedResults(); var $options = self.$results.find('[aria-selected]'); var currentIndex = $options.index($highlighted); var nextIndex = currentIndex + 1; // If we are at the last option, stay there if (nextIndex >= $options.length) { return; } var $next = $options.eq(nextIndex); $next.trigger('mouseenter'); var currentOffset = self.$results.offset().top + self.$results.outerHeight(false); var nextBottom = $next.offset().top + $next.outerHeight(false); var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; if (nextIndex === 0) { self.$results.scrollTop(0); } else if (nextBottom > currentOffset) { self.$results.scrollTop(nextOffset); } }); container.on('results:focus', function (params) { params.element.addClass('select2-results__option--highlighted'); }); container.on('results:message', function (params) { self.displayMessage(params); }); if ($.fn.mousewheel) { this.$results.on('mousewheel', function (e) { var top = self.$results.scrollTop(); var bottom = self.$results.get(0).scrollHeight - top + e.deltaY; var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); if (isAtTop) { self.$results.scrollTop(0); e.preventDefault(); e.stopPropagation(); } else if (isAtBottom) { self.$results.scrollTop( self.$results.get(0).scrollHeight - self.$results.height() ); e.preventDefault(); e.stopPropagation(); } }); } this.$results.on('mouseup', '.select2-results__option[aria-selected]', function (evt) { var $this = $(this); var data = Utils.GetData(this, 'data'); if ($this.attr('aria-selected') === 'true') { if (self.options.get('multiple')) { self.trigger('unselect', { originalEvent: evt, data: data }); } else { self.trigger('close', {}); } return; } self.trigger('select', { originalEvent: evt, data: data }); }); this.$results.on('mouseenter', '.select2-results__option[aria-selected]', function (evt) { var data = Utils.GetData(this, 'data'); self.getHighlightedResults() .removeClass('select2-results__option--highlighted'); self.trigger('results:focus', { data: data, element: $(this) }); }); }; Results.prototype.getHighlightedResults = function () { var $highlighted = this.$results .find('.select2-results__option--highlighted'); return $highlighted; }; Results.prototype.destroy = function () { this.$results.remove(); }; Results.prototype.ensureHighlightVisible = function () { var $highlighted = this.getHighlightedResults(); if ($highlighted.length === 0) { return; } var $options = this.$results.find('[aria-selected]'); var currentIndex = $options.index($highlighted); var currentOffset = this.$results.offset().top; var nextTop = $highlighted.offset().top; var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); var offsetDelta = nextTop - currentOffset; nextOffset -= $highlighted.outerHeight(false) * 2; if (currentIndex <= 2) { this.$results.scrollTop(0); } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { this.$results.scrollTop(nextOffset); } }; Results.prototype.template = function (result, container) { var template = this.options.get('templateResult'); var escapeMarkup = this.options.get('escapeMarkup'); var content = template(result, container); if (content == null) { container.style.display = 'none'; } else if (typeof content === 'string') { container.innerHTML = escapeMarkup(content); } else { $(container).append(content); } }; return Results; }); S2.define('select2/keys',[ ], function () { var KEYS = { BACKSPACE: 8, TAB: 9, ENTER: 13, SHIFT: 16, CTRL: 17, ALT: 18, ESC: 27, SPACE: 32, PAGE_UP: 33, PAGE_DOWN: 34, END: 35, HOME: 36, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, DELETE: 46 }; return KEYS; }); S2.define('select2/selection/base',[ 'jquery', '../utils', '../keys' ], function ($, Utils, KEYS) { function BaseSelection ($element, options) { this.$element = $element; this.options = options; BaseSelection.__super__.constructor.call(this); } Utils.Extend(BaseSelection, Utils.Observable); BaseSelection.prototype.render = function () { var $selection = $( '<span class="select2-selection" role="combobox" ' + ' aria-haspopup="true" aria-expanded="false">' + '</span>' ); this._tabindex = 0; if (Utils.GetData(this.$element[0], 'old-tabindex') != null) { this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex'); } else if (this.$element.attr('tabindex') != null) { this._tabindex = this.$element.attr('tabindex'); } $selection.attr('title', this.$element.attr('title')); $selection.attr('tabindex', this._tabindex); $selection.attr('aria-disabled', 'false'); this.$selection = $selection; return $selection; }; BaseSelection.prototype.bind = function (container, $container) { var self = this; var resultsId = container.id + '-results'; this.container = container; this.$selection.on('focus', function (evt) { self.trigger('focus', evt); }); this.$selection.on('blur', function (evt) { self._handleBlur(evt); }); this.$selection.on('keydown', function (evt) { self.trigger('keypress', evt); if (evt.which === KEYS.SPACE) { evt.preventDefault(); } }); container.on('results:focus', function (params) { self.$selection.attr('aria-activedescendant', params.data._resultId); }); container.on('selection:update', function (params) { self.update(params.data); }); container.on('open', function () { // When the dropdown is open, aria-expanded="true" self.$selection.attr('aria-expanded', 'true'); self.$selection.attr('aria-owns', resultsId); self._attachCloseHandler(container); }); container.on('close', function () { // When the dropdown is closed, aria-expanded="false" self.$selection.attr('aria-expanded', 'false'); self.$selection.removeAttr('aria-activedescendant'); self.$selection.removeAttr('aria-owns'); self.$selection.trigger('focus'); self._detachCloseHandler(container); }); container.on('enable', function () { self.$selection.attr('tabindex', self._tabindex); self.$selection.attr('aria-disabled', 'false'); }); container.on('disable', function () { self.$selection.attr('tabindex', '-1'); self.$selection.attr('aria-disabled', 'true'); }); }; BaseSelection.prototype._handleBlur = function (evt) { var self = this; // This needs to be delayed as the active element is the body when the tab // key is pressed, possibly along with others. window.setTimeout(function () { // Don't trigger `blur` if the focus is still in the selection if ( (document.activeElement == self.$selection[0]) || ($.contains(self.$selection[0], document.activeElement)) ) { return; } self.trigger('blur', evt); }, 1); }; BaseSelection.prototype._attachCloseHandler = function (container) { $(document.body).on('mousedown.select2.' + container.id, function (e) { var $target = $(e.target); var $select = $target.closest('.select2'); var $all = $('.select2.select2-container--open'); $all.each(function () { if (this == $select[0]) { return; } var $element = Utils.GetData(this, 'element'); $element.select2('close'); }); }); }; BaseSelection.prototype._detachCloseHandler = function (container) { $(document.body).off('mousedown.select2.' + container.id); }; BaseSelection.prototype.position = function ($selection, $container) { var $selectionContainer = $container.find('.selection'); $selectionContainer.append($selection); }; BaseSelection.prototype.destroy = function () { this._detachCloseHandler(this.container); }; BaseSelection.prototype.update = function (data) { throw new Error('The `update` method must be defined in child classes.'); }; /** * Helper method to abstract the "enabled" (not "disabled") state of this * object. * * @return {true} if the instance is not disabled. * @return {false} if the instance is disabled. */ BaseSelection.prototype.isEnabled = function () { return !this.isDisabled(); }; /** * Helper method to abstract the "disabled" state of this object. * * @return {true} if the disabled option is true. * @return {false} if the disabled option is false. */ BaseSelection.prototype.isDisabled = function () { return this.options.get('disabled'); }; return BaseSelection; }); S2.define('select2/selection/single',[ 'jquery', './base', '../utils', '../keys' ], function ($, BaseSelection, Utils, KEYS) { function SingleSelection () { SingleSelection.__super__.constructor.apply(this, arguments); } Utils.Extend(SingleSelection, BaseSelection); SingleSelection.prototype.render = function () { var $selection = SingleSelection.__super__.render.call(this); $selection.addClass('select2-selection--single'); $selection.html( '<span class="select2-selection__rendered"></span>' + '<span class="select2-selection__arrow" role="presentation">' + '<b role="presentation"></b>' + '</span>' ); return $selection; }; SingleSelection.prototype.bind = function (container, $container) { var self = this; SingleSelection.__super__.bind.apply(this, arguments); var id = container.id + '-container'; this.$selection.find('.select2-selection__rendered') .attr('id', id) .attr('role', 'textbox') .attr('aria-readonly', 'true'); this.$selection.attr('aria-labelledby', id); this.$selection.on('mousedown', function (evt) { // Only respond to left clicks if (evt.which !== 1) { return; } self.trigger('toggle', { originalEvent: evt }); }); this.$selection.on('focus', function (evt) { // User focuses on the container }); this.$selection.on('blur', function (evt) { // User exits the container }); container.on('focus', function (evt) { if (!container.isOpen()) { self.$selection.trigger('focus'); } }); }; SingleSelection.prototype.clear = function () { var $rendered = this.$selection.find('.select2-selection__rendered'); $rendered.empty(); $rendered.removeAttr('title'); // clear tooltip on empty }; SingleSelection.prototype.display = function (data, container) { var template = this.options.get('templateSelection'); var escapeMarkup = this.options.get('escapeMarkup'); return escapeMarkup(template(data, container)); }; SingleSelection.prototype.selectionContainer = function () { return $('<span></span>'); }; SingleSelection.prototype.update = function (data) { if (data.length === 0) { this.clear(); return; } var selection = data[0]; var $rendered = this.$selection.find('.select2-selection__rendered'); var formatted = this.display(selection, $rendered); $rendered.empty().append(formatted); var title = selection.title || selection.text; if (title) { $rendered.attr('title', title); } else { $rendered.removeAttr('title'); } }; return SingleSelection; }); S2.define('select2/selection/multiple',[ 'jquery', './base', '../utils' ], function ($, BaseSelection, Utils) { function MultipleSelection ($element, options) { MultipleSelection.__super__.constructor.apply(this, arguments); } Utils.Extend(MultipleSelection, BaseSelection); MultipleSelection.prototype.render = function () { var $selection = MultipleSelection.__super__.render.call(this); $selection.addClass('select2-selection--multiple'); $selection.html( '<ul class="select2-selection__rendered"></ul>' ); return $selection; }; MultipleSelection.prototype.bind = function (container, $container) { var self = this; MultipleSelection.__super__.bind.apply(this, arguments); this.$selection.on('click', function (evt) { self.trigger('toggle', { originalEvent: evt }); }); this.$selection.on( 'click', '.select2-selection__choice__remove', function (evt) { // Ignore the event if it is disabled if (self.isDisabled()) { return; } var $remove = $(this); var $selection = $remove.parent(); var data = Utils.GetData($selection[0], 'data'); self.trigger('unselect', { originalEvent: evt, data: data }); } ); }; MultipleSelection.prototype.clear = function () { var $rendered = this.$selection.find('.select2-selection__rendered'); $rendered.empty(); $rendered.removeAttr('title'); }; MultipleSelection.prototype.display = function (data, container) { var template = this.options.get('templateSelection'); var escapeMarkup = this.options.get('escapeMarkup'); return escapeMarkup(template(data, container)); }; MultipleSelection.prototype.selectionContainer = function () { var $container = $( '<li class="select2-selection__choice">' + '<span class="select2-selection__choice__remove" role="presentation">' + '×' + '</span>' + '</li>' ); return $container; }; MultipleSelection.prototype.update = function (data) { this.clear(); if (data.length === 0) { return; } var $selections = []; for (var d = 0; d < data.length; d++) { var selection = data[d]; var $selection = this.selectionContainer(); var formatted = this.display(selection, $selection); $selection.append(formatted); var title = selection.title || selection.text; if (title) { $selection.attr('title', title); } Utils.StoreData($selection[0], 'data', selection); $selections.push($selection); } var $rendered = this.$selection.find('.select2-selection__rendered'); Utils.appendMany($rendered, $selections); }; return MultipleSelection; }); S2.define('select2/selection/placeholder',[ '../utils' ], function (Utils) { function Placeholder (decorated, $element, options) { this.placeholder = this.normalizePlaceholder(options.get('placeholder')); decorated.call(this, $element, options); } Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { if (typeof placeholder === 'string') { placeholder = { id: '', text: placeholder }; } return placeholder; }; Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { var $placeholder = this.selectionContainer(); $placeholder.html(this.display(placeholder)); $placeholder.addClass('select2-selection__placeholder') .removeClass('select2-selection__choice'); return $placeholder; }; Placeholder.prototype.update = function (decorated, data) { var singlePlaceholder = ( data.length == 1 && data[0].id != this.placeholder.id ); var multipleSelections = data.length > 1; if (multipleSelections || singlePlaceholder) { return decorated.call(this, data); } this.clear(); var $placeholder = this.createPlaceholder(this.placeholder); this.$selection.find('.select2-selection__rendered').append($placeholder); }; return Placeholder; }); S2.define('select2/selection/allowClear',[ 'jquery', '../keys', '../utils' ], function ($, KEYS, Utils) { function AllowClear () { } AllowClear.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); if (this.placeholder == null) { if (this.options.get('debug') && window.console && console.error) { console.error( 'Select2: The `allowClear` option should be used in combination ' + 'with the `placeholder` option.' ); } } this.$selection.on('mousedown', '.select2-selection__clear', function (evt) { self._handleClear(evt); }); container.on('keypress', function (evt) { self._handleKeyboardClear(evt, container); }); }; AllowClear.prototype._handleClear = function (_, evt) { // Ignore the event if it is disabled if (this.isDisabled()) { return; } var $clear = this.$selection.find('.select2-selection__clear'); // Ignore the event if nothing has been selected if ($clear.length === 0) { return; } evt.stopPropagation(); var data = Utils.GetData($clear[0], 'data'); var previousVal = this.$element.val(); this.$element.val(this.placeholder.id); var unselectData = { data: data }; this.trigger('clear', unselectData); if (unselectData.prevented) { this.$element.val(previousVal); return; } for (var d = 0; d < data.length; d++) { unselectData = { data: data[d] }; // Trigger the `unselect` event, so people can prevent it from being // cleared. this.trigger('unselect', unselectData); // If the event was prevented, don't clear it out. if (unselectData.prevented) { this.$element.val(previousVal); return; } } this.$element.trigger('input').trigger('change'); this.trigger('toggle', {}); }; AllowClear.prototype._handleKeyboardClear = function (_, evt, container) { if (container.isOpen()) { return; } if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) { this._handleClear(evt); } }; AllowClear.prototype.update = function (decorated, data) { decorated.call(this, data); if (this.$selection.find('.select2-selection__placeholder').length > 0 || data.length === 0) { return; } var removeAll = this.options.get('translations').get('removeAllItems'); var $remove = $( '<span class="select2-selection__clear" title="' + removeAll() +'">' + '×' + '</span>' ); Utils.StoreData($remove[0], 'data', data); this.$selection.find('.select2-selection__rendered').prepend($remove); }; return AllowClear; }); S2.define('select2/selection/search',[ 'jquery', '../utils', '../keys' ], function ($, Utils, KEYS) { function Search (decorated, $element, options) { decorated.call(this, $element, options); } Search.prototype.render = function (decorated) { var $search = $( '<li class="select2-search select2-search--inline">' + '<input class="select2-search__field" type="search" tabindex="-1"' + ' autocomplete="off" autocorrect="off" autocapitalize="none"' + ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + '</li>' ); this.$searchContainer = $search; this.$search = $search.find('input'); var $rendered = decorated.call(this); this._transferTabIndex(); return $rendered; }; Search.prototype.bind = function (decorated, container, $container) { var self = this; var resultsId = container.id + '-results'; decorated.call(this, container, $container); container.on('open', function () { self.$search.attr('aria-controls', resultsId); self.$search.trigger('focus'); }); container.on('close', function () { self.$search.val(''); self.$search.removeAttr('aria-controls'); self.$search.removeAttr('aria-activedescendant'); self.$search.trigger('focus'); }); container.on('enable', function () { self.$search.prop('disabled', false); self._transferTabIndex(); }); container.on('disable', function () { self.$search.prop('disabled', true); }); container.on('focus', function (evt) { self.$search.trigger('focus'); }); container.on('results:focus', function (params) { if (params.data._resultId) { self.$search.attr('aria-activedescendant', params.data._resultId); } else { self.$search.removeAttr('aria-activedescendant'); } }); this.$selection.on('focusin', '.select2-search--inline', function (evt) { self.trigger('focus', evt); }); this.$selection.on('focusout', '.select2-search--inline', function (evt) { self._handleBlur(evt); }); this.$selection.on('keydown', '.select2-search--inline', function (evt) { evt.stopPropagation(); self.trigger('keypress', evt); self._keyUpPrevented = evt.isDefaultPrevented(); var key = evt.which; if (key === KEYS.BACKSPACE && self.$search.val() === '') { var $previousChoice = self.$searchContainer .prev('.select2-selection__choice'); if ($previousChoice.length > 0) { var item = Utils.GetData($previousChoice[0], 'data'); self.searchRemoveChoice(item); evt.preventDefault(); } } }); this.$selection.on('click', '.select2-search--inline', function (evt) { if (self.$search.val()) { evt.stopPropagation(); } }); // Try to detect the IE version should the `documentMode` property that // is stored on the document. This is only implemented in IE and is // slightly cleaner than doing a user agent check. // This property is not available in Edge, but Edge also doesn't have // this bug. var msie = document.documentMode; var disableInputEvents = msie && msie <= 11; // Workaround for browsers which do not support the `input` event // This will prevent double-triggering of events for browsers which support // both the `keyup` and `input` events. this.$selection.on( 'input.searchcheck', '.select2-search--inline', function (evt) { // IE will trigger the `input` event when a placeholder is used on a // search box. To get around this issue, we are forced to ignore all // `input` events in IE and keep using `keyup`. if (disableInputEvents) { self.$selection.off('input.search input.searchcheck'); return; } // Unbind the duplicated `keyup` event self.$selection.off('keyup.search'); } ); this.$selection.on( 'keyup.search input.search', '.select2-search--inline', function (evt) { // IE will trigger the `input` event when a placeholder is used on a // search box. To get around this issue, we are forced to ignore all // `input` events in IE and keep using `keyup`. if (disableInputEvents && evt.type === 'input') { self.$selection.off('input.search input.searchcheck'); return; } var key = evt.which; // We can freely ignore events from modifier keys if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) { return; } // Tabbing will be handled during the `keydown` phase if (key == KEYS.TAB) { return; } self.handleSearch(evt); } ); }; /** * This method will transfer the tabindex attribute from the rendered * selection to the search box. This allows for the search box to be used as * the primary focus instead of the selection container. * * @private */ Search.prototype._transferTabIndex = function (decorated) { this.$search.attr('tabindex', this.$selection.attr('tabindex')); this.$selection.attr('tabindex', '-1'); }; Search.prototype.createPlaceholder = function (decorated, placeholder) { this.$search.attr('placeholder', placeholder.text); }; Search.prototype.update = function (decorated, data) { var searchHadFocus = this.$search[0] == document.activeElement; this.$search.attr('placeholder', ''); decorated.call(this, data); this.$selection.find('.select2-selection__rendered') .append(this.$searchContainer); this.resizeSearch(); if (searchHadFocus) { this.$search.trigger('focus'); } }; Search.prototype.handleSearch = function () { this.resizeSearch(); if (!this._keyUpPrevented) { var input = this.$search.val(); this.trigger('query', { term: input }); } this._keyUpPrevented = false; }; Search.prototype.searchRemoveChoice = function (decorated, item) { this.trigger('unselect', { data: item }); this.$search.val(item.text); this.handleSearch(); }; Search.prototype.resizeSearch = function () { this.$search.css('width', '25px'); var width = ''; if (this.$search.attr('placeholder') !== '') { width = this.$selection.find('.select2-selection__rendered').width(); } else { var minimumWidth = this.$search.val().length + 1; width = (minimumWidth * 0.75) + 'em'; } this.$search.css('width', width); }; return Search; }); S2.define('select2/selection/eventRelay',[ 'jquery' ], function ($) { function EventRelay () { } EventRelay.prototype.bind = function (decorated, container, $container) { var self = this; var relayEvents = [ 'open', 'opening', 'close', 'closing', 'select', 'selecting', 'unselect', 'unselecting', 'clear', 'clearing' ]; var preventableEvents = [ 'opening', 'closing', 'selecting', 'unselecting', 'clearing' ]; decorated.call(this, container, $container); container.on('*', function (name, params) { // Ignore events that should not be relayed if ($.inArray(name, relayEvents) === -1) { return; } // The parameters should always be an object params = params || {}; // Generate the jQuery event for the Select2 event var evt = $.Event('select2:' + name, { params: params }); self.$element.trigger(evt); // Only handle preventable events if it was one if ($.inArray(name, preventableEvents) === -1) { return; } params.prevented = evt.isDefaultPrevented(); }); }; return EventRelay; }); S2.define('select2/translation',[ 'jquery', 'require' ], function ($, require) { function Translation (dict) { this.dict = dict || {}; } Translation.prototype.all = function () { return this.dict; }; Translation.prototype.get = function (key) { return this.dict[key]; }; Translation.prototype.extend = function (translation) { this.dict = $.extend({}, translation.all(), this.dict); }; // Static functions Translation._cache = {}; Translation.loadPath = function (path) { if (!(path in Translation._cache)) { var translations = require(path); Translation._cache[path] = translations; } return new Translation(Translation._cache[path]); }; return Translation; }); S2.define('select2/diacritics',[ ], function () { var diacritics = { '\u24B6': 'A', '\uFF21': 'A', '\u00C0': 'A', '\u00C1': 'A', '\u00C2': 'A', '\u1EA6': 'A', '\u1EA4': 'A', '\u1EAA': 'A', '\u1EA8': 'A', '\u00C3': 'A', '\u0100': 'A', '\u0102': 'A', '\u1EB0': 'A', '\u1EAE': 'A', '\u1EB4': 'A', '\u1EB2': 'A', '\u0226': 'A', '\u01E0': 'A', '\u00C4': 'A', '\u01DE': 'A', '\u1EA2': 'A', '\u00C5': 'A', '\u01FA': 'A', '\u01CD': 'A', '\u0200': 'A', '\u0202': 'A', '\u1EA0': 'A', '\u1EAC': 'A', '\u1EB6': 'A', '\u1E00': 'A', '\u0104': 'A', '\u023A': 'A', '\u2C6F': 'A', '\uA732': 'AA', '\u00C6': 'AE', '\u01FC': 'AE', '\u01E2': 'AE', '\uA734': 'AO', '\uA736': 'AU', '\uA738': 'AV', '\uA73A': 'AV', '\uA73C': 'AY', '\u24B7': 'B', '\uFF22': 'B', '\u1E02': 'B', '\u1E04': 'B', '\u1E06': 'B', '\u0243': 'B', '\u0182': 'B', '\u0181': 'B', '\u24B8': 'C', '\uFF23': 'C', '\u0106': 'C', '\u0108': 'C', '\u010A': 'C', '\u010C': 'C', '\u00C7': 'C', '\u1E08': 'C', '\u0187': 'C', '\u023B': 'C', '\uA73E': 'C', '\u24B9': 'D', '\uFF24': 'D', '\u1E0A': 'D', '\u010E': 'D', '\u1E0C': 'D', '\u1E10': 'D', '\u1E12': 'D', '\u1E0E': 'D', '\u0110': 'D', '\u018B': 'D', '\u018A': 'D', '\u0189': 'D', '\uA779': 'D', '\u01F1': 'DZ', '\u01C4': 'DZ', '\u01F2': 'Dz', '\u01C5': 'Dz', '\u24BA': 'E', '\uFF25': 'E', '\u00C8': 'E', '\u00C9': 'E', '\u00CA': 'E', '\u1EC0': 'E', '\u1EBE': 'E', '\u1EC4': 'E', '\u1EC2': 'E', '\u1EBC': 'E', '\u0112': 'E', '\u1E14': 'E', '\u1E16': 'E', '\u0114': 'E', '\u0116': 'E', '\u00CB': 'E', '\u1EBA': 'E', '\u011A': 'E', '\u0204': 'E', '\u0206': 'E', '\u1EB8': 'E', '\u1EC6': 'E', '\u0228': 'E', '\u1E1C': 'E', '\u0118': 'E', '\u1E18': 'E', '\u1E1A': 'E', '\u0190': 'E', '\u018E': 'E', '\u24BB': 'F', '\uFF26': 'F', '\u1E1E': 'F', '\u0191': 'F', '\uA77B': 'F', '\u24BC': 'G', '\uFF27': 'G', '\u01F4': 'G', '\u011C': 'G', '\u1E20': 'G', '\u011E': 'G', '\u0120': 'G', '\u01E6': 'G', '\u0122': 'G', '\u01E4': 'G', '\u0193': 'G', '\uA7A0': 'G', '\uA77D': 'G', '\uA77E': 'G', '\u24BD': 'H', '\uFF28': 'H', '\u0124': 'H', '\u1E22': 'H', '\u1E26': 'H', '\u021E': 'H', '\u1E24': 'H', '\u1E28': 'H', '\u1E2A': 'H', '\u0126': 'H', '\u2C67': 'H', '\u2C75': 'H', '\uA78D': 'H', '\u24BE': 'I', '\uFF29': 'I', '\u00CC': 'I', '\u00CD': 'I', '\u00CE': 'I', '\u0128': 'I', '\u012A': 'I', '\u012C': 'I', '\u0130': 'I', '\u00CF': 'I', '\u1E2E': 'I', '\u1EC8': 'I', '\u01CF': 'I', '\u0208': 'I', '\u020A': 'I', '\u1ECA': 'I', '\u012E': 'I', '\u1E2C': 'I', '\u0197': 'I', '\u24BF': 'J', '\uFF2A': 'J', '\u0134': 'J', '\u0248': 'J', '\u24C0': 'K', '\uFF2B': 'K', '\u1E30': 'K', '\u01E8': 'K', '\u1E32': 'K', '\u0136': 'K', '\u1E34': 'K', '\u0198': 'K', '\u2C69': 'K', '\uA740': 'K', '\uA742': 'K', '\uA744': 'K', '\uA7A2': 'K', '\u24C1': 'L', '\uFF2C': 'L', '\u013F': 'L', '\u0139': 'L', '\u013D': 'L', '\u1E36': 'L', '\u1E38': 'L', '\u013B': 'L', '\u1E3C': 'L', '\u1E3A': 'L', '\u0141': 'L', '\u023D': 'L', '\u2C62': 'L', '\u2C60': 'L', '\uA748': 'L', '\uA746': 'L', '\uA780': 'L', '\u01C7': 'LJ', '\u01C8': 'Lj', '\u24C2': 'M', '\uFF2D': 'M', '\u1E3E': 'M', '\u1E40': 'M', '\u1E42': 'M', '\u2C6E': 'M', '\u019C': 'M', '\u24C3': 'N', '\uFF2E': 'N', '\u01F8': 'N', '\u0143': 'N', '\u00D1': 'N', '\u1E44': 'N', '\u0147': 'N', '\u1E46': 'N', '\u0145': 'N', '\u1E4A': 'N', '\u1E48': 'N', '\u0220': 'N', '\u019D': 'N', '\uA790': 'N', '\uA7A4': 'N', '\u01CA': 'NJ', '\u01CB': 'Nj', '\u24C4': 'O', '\uFF2F': 'O', '\u00D2': 'O', '\u00D3': 'O', '\u00D4': 'O', '\u1ED2': 'O', '\u1ED0': 'O', '\u1ED6': 'O', '\u1ED4': 'O', '\u00D5': 'O', '\u1E4C': 'O', '\u022C': 'O', '\u1E4E': 'O', '\u014C': 'O', '\u1E50': 'O', '\u1E52': 'O', '\u014E': 'O', '\u022E': 'O', '\u0230': 'O', '\u00D6': 'O', '\u022A': 'O', '\u1ECE': 'O', '\u0150': 'O', '\u01D1': 'O', '\u020C': 'O', '\u020E': 'O', '\u01A0': 'O', '\u1EDC': 'O', '\u1EDA': 'O', '\u1EE0': 'O', '\u1EDE': 'O', '\u1EE2': 'O', '\u1ECC': 'O', '\u1ED8': 'O', '\u01EA': 'O', '\u01EC': 'O', '\u00D8': 'O', '\u01FE': 'O', '\u0186': 'O', '\u019F': 'O', '\uA74A': 'O', '\uA74C': 'O', '\u0152': 'OE', '\u01A2': 'OI', '\uA74E': 'OO', '\u0222': 'OU', '\u24C5': 'P', '\uFF30': 'P', '\u1E54': 'P', '\u1E56': 'P', '\u01A4': 'P', '\u2C63': 'P', '\uA750': 'P', '\uA752': 'P', '\uA754': 'P', '\u24C6': 'Q', '\uFF31': 'Q', '\uA756': 'Q', '\uA758': 'Q', '\u024A': 'Q', '\u24C7': 'R', '\uFF32': 'R', '\u0154': 'R', '\u1E58': 'R', '\u0158': 'R', '\u0210': 'R', '\u0212': 'R', '\u1E5A': 'R', '\u1E5C': 'R', '\u0156': 'R', '\u1E5E': 'R', '\u024C': 'R', '\u2C64': 'R', '\uA75A': 'R', '\uA7A6': 'R', '\uA782': 'R', '\u24C8': 'S', '\uFF33': 'S', '\u1E9E': 'S', '\u015A': 'S', '\u1E64': 'S', '\u015C': 'S', '\u1E60': 'S', '\u0160': 'S', '\u1E66': 'S', '\u1E62': 'S', '\u1E68': 'S', '\u0218': 'S', '\u015E': 'S', '\u2C7E': 'S', '\uA7A8': 'S', '\uA784': 'S', '\u24C9': 'T', '\uFF34': 'T', '\u1E6A': 'T', '\u0164': 'T', '\u1E6C': 'T', '\u021A': 'T', '\u0162': 'T', '\u1E70': 'T', '\u1E6E': 'T', '\u0166': 'T', '\u01AC': 'T', '\u01AE': 'T', '\u023E': 'T', '\uA786': 'T', '\uA728': 'TZ', '\u24CA': 'U', '\uFF35': 'U', '\u00D9': 'U', '\u00DA': 'U', '\u00DB': 'U', '\u0168': 'U', '\u1E78': 'U', '\u016A': 'U', '\u1E7A': 'U', '\u016C': 'U', '\u00DC': 'U', '\u01DB': 'U', '\u01D7': 'U', '\u01D5': 'U', '\u01D9': 'U', '\u1EE6': 'U', '\u016E': 'U', '\u0170': 'U', '\u01D3': 'U', '\u0214': 'U', '\u0216': 'U', '\u01AF': 'U', '\u1EEA': 'U', '\u1EE8': 'U', '\u1EEE': 'U', '\u1EEC': 'U', '\u1EF0': 'U', '\u1EE4': 'U', '\u1E72': 'U', '\u0172': 'U', '\u1E76': 'U', '\u1E74': 'U', '\u0244': 'U', '\u24CB': 'V', '\uFF36': 'V', '\u1E7C': 'V', '\u1E7E': 'V', '\u01B2': 'V', '\uA75E': 'V', '\u0245': 'V', '\uA760': 'VY', '\u24CC': 'W', '\uFF37': 'W', '\u1E80': 'W', '\u1E82': 'W', '\u0174': 'W', '\u1E86': 'W', '\u1E84': 'W', '\u1E88': 'W', '\u2C72': 'W', '\u24CD': 'X', '\uFF38': 'X', '\u1E8A': 'X', '\u1E8C': 'X', '\u24CE': 'Y', '\uFF39': 'Y', '\u1EF2': 'Y', '\u00DD': 'Y', '\u0176': 'Y', '\u1EF8': 'Y', '\u0232': 'Y', '\u1E8E': 'Y', '\u0178': 'Y', '\u1EF6': 'Y', '\u1EF4': 'Y', '\u01B3': 'Y', '\u024E': 'Y', '\u1EFE': 'Y', '\u24CF': 'Z', '\uFF3A': 'Z', '\u0179': 'Z', '\u1E90': 'Z', '\u017B': 'Z', '\u017D': 'Z', '\u1E92': 'Z', '\u1E94': 'Z', '\u01B5': 'Z', '\u0224': 'Z', '\u2C7F': 'Z', '\u2C6B': 'Z', '\uA762': 'Z', '\u24D0': 'a', '\uFF41': 'a', '\u1E9A': 'a', '\u00E0': 'a', '\u00E1': 'a', '\u00E2': 'a', '\u1EA7': 'a', '\u1EA5': 'a', '\u1EAB': 'a', '\u1EA9': 'a', '\u00E3': 'a', '\u0101': 'a', '\u0103': 'a', '\u1EB1': 'a', '\u1EAF': 'a', '\u1EB5': 'a', '\u1EB3': 'a', '\u0227': 'a', '\u01E1': 'a', '\u00E4': 'a', '\u01DF': 'a', '\u1EA3': 'a', '\u00E5': 'a', '\u01FB': 'a', '\u01CE': 'a', '\u0201': 'a', '\u0203': 'a', '\u1EA1': 'a', '\u1EAD': 'a', '\u1EB7': 'a', '\u1E01': 'a', '\u0105': 'a', '\u2C65': 'a', '\u0250': 'a', '\uA733': 'aa', '\u00E6': 'ae', '\u01FD': 'ae', '\u01E3': 'ae', '\uA735': 'ao', '\uA737': 'au', '\uA739': 'av', '\uA73B': 'av', '\uA73D': 'ay', '\u24D1': 'b', '\uFF42': 'b', '\u1E03': 'b', '\u1E05': 'b', '\u1E07': 'b', '\u0180': 'b', '\u0183': 'b', '\u0253': 'b', '\u24D2': 'c', '\uFF43': 'c', '\u0107': 'c', '\u0109': 'c', '\u010B': 'c', '\u010D': 'c', '\u00E7': 'c', '\u1E09': 'c', '\u0188': 'c', '\u023C': 'c', '\uA73F': 'c', '\u2184': 'c', '\u24D3': 'd', '\uFF44': 'd', '\u1E0B': 'd', '\u010F': 'd', '\u1E0D': 'd', '\u1E11': 'd', '\u1E13': 'd', '\u1E0F': 'd', '\u0111': 'd', '\u018C': 'd', '\u0256': 'd', '\u0257': 'd', '\uA77A': 'd', '\u01F3': 'dz', '\u01C6': 'dz', '\u24D4': 'e', '\uFF45': 'e', '\u00E8': 'e', '\u00E9': 'e', '\u00EA': 'e', '\u1EC1': 'e', '\u1EBF': 'e', '\u1EC5': 'e', '\u1EC3': 'e', '\u1EBD': 'e', '\u0113': 'e', '\u1E15': 'e', '\u1E17': 'e', '\u0115': 'e', '\u0117': 'e', '\u00EB': 'e', '\u1EBB': 'e', '\u011B': 'e', '\u0205': 'e', '\u0207': 'e', '\u1EB9': 'e', '\u1EC7': 'e', '\u0229': 'e', '\u1E1D': 'e', '\u0119': 'e', '\u1E19': 'e', '\u1E1B': 'e', '\u0247': 'e', '\u025B': 'e', '\u01DD': 'e', '\u24D5': 'f', '\uFF46': 'f', '\u1E1F': 'f', '\u0192': 'f', '\uA77C': 'f', '\u24D6': 'g', '\uFF47': 'g', '\u01F5': 'g', '\u011D': 'g', '\u1E21': 'g', '\u011F': 'g', '\u0121': 'g', '\u01E7': 'g', '\u0123': 'g', '\u01E5': 'g', '\u0260': 'g', '\uA7A1': 'g', '\u1D79': 'g', '\uA77F': 'g', '\u24D7': 'h', '\uFF48': 'h', '\u0125': 'h', '\u1E23': 'h', '\u1E27': 'h', '\u021F': 'h', '\u1E25': 'h', '\u1E29': 'h', '\u1E2B': 'h', '\u1E96': 'h', '\u0127': 'h', '\u2C68': 'h', '\u2C76': 'h', '\u0265': 'h', '\u0195': 'hv', '\u24D8': 'i', '\uFF49': 'i', '\u00EC': 'i', '\u00ED': 'i', '\u00EE': 'i', '\u0129': 'i', '\u012B': 'i', '\u012D': 'i', '\u00EF': 'i', '\u1E2F': 'i', '\u1EC9': 'i', '\u01D0': 'i', '\u0209': 'i', '\u020B': 'i', '\u1ECB': 'i', '\u012F': 'i', '\u1E2D': 'i', '\u0268': 'i', '\u0131': 'i', '\u24D9': 'j', '\uFF4A': 'j', '\u0135': 'j', '\u01F0': 'j', '\u0249': 'j', '\u24DA': 'k', '\uFF4B': 'k', '\u1E31': 'k', '\u01E9': 'k', '\u1E33': 'k', '\u0137': 'k', '\u1E35': 'k', '\u0199': 'k', '\u2C6A': 'k', '\uA741': 'k', '\uA743': 'k', '\uA745': 'k', '\uA7A3': 'k', '\u24DB': 'l', '\uFF4C': 'l', '\u0140': 'l', '\u013A': 'l', '\u013E': 'l', '\u1E37': 'l', '\u1E39': 'l', '\u013C': 'l', '\u1E3D': 'l', '\u1E3B': 'l', '\u017F': 'l', '\u0142': 'l', '\u019A': 'l', '\u026B': 'l', '\u2C61': 'l', '\uA749': 'l', '\uA781': 'l', '\uA747': 'l', '\u01C9': 'lj', '\u24DC': 'm', '\uFF4D': 'm', '\u1E3F': 'm', '\u1E41': 'm', '\u1E43': 'm', '\u0271': 'm', '\u026F': 'm', '\u24DD': 'n', '\uFF4E': 'n', '\u01F9': 'n', '\u0144': 'n', '\u00F1': 'n', '\u1E45': 'n', '\u0148': 'n', '\u1E47': 'n', '\u0146': 'n', '\u1E4B': 'n', '\u1E49': 'n', '\u019E': 'n', '\u0272': 'n', '\u0149': 'n', '\uA791': 'n', '\uA7A5': 'n', '\u01CC': 'nj', '\u24DE': 'o', '\uFF4F': 'o', '\u00F2': 'o', '\u00F3': 'o', '\u00F4': 'o', '\u1ED3': 'o', '\u1ED1': 'o', '\u1ED7': 'o', '\u1ED5': 'o', '\u00F5': 'o', '\u1E4D': 'o', '\u022D': 'o', '\u1E4F': 'o', '\u014D': 'o', '\u1E51': 'o', '\u1E53': 'o', '\u014F': 'o', '\u022F': 'o', '\u0231': 'o', '\u00F6': 'o', '\u022B': 'o', '\u1ECF': 'o', '\u0151': 'o', '\u01D2': 'o', '\u020D': 'o', '\u020F': 'o', '\u01A1': 'o', '\u1EDD': 'o', '\u1EDB': 'o', '\u1EE1': 'o', '\u1EDF': 'o', '\u1EE3': 'o', '\u1ECD': 'o', '\u1ED9': 'o', '\u01EB': 'o', '\u01ED': 'o', '\u00F8': 'o', '\u01FF': 'o', '\u0254': 'o', '\uA74B': 'o', '\uA74D': 'o', '\u0275': 'o', '\u0153': 'oe', '\u01A3': 'oi', '\u0223': 'ou', '\uA74F': 'oo', '\u24DF': 'p', '\uFF50': 'p', '\u1E55': 'p', '\u1E57': 'p', '\u01A5': 'p', '\u1D7D': 'p', '\uA751': 'p', '\uA753': 'p', '\uA755': 'p', '\u24E0': 'q', '\uFF51': 'q', '\u024B': 'q', '\uA757': 'q', '\uA759': 'q', '\u24E1': 'r', '\uFF52': 'r', '\u0155': 'r', '\u1E59': 'r', '\u0159': 'r', '\u0211': 'r', '\u0213': 'r', '\u1E5B': 'r', '\u1E5D': 'r', '\u0157': 'r', '\u1E5F': 'r', '\u024D': 'r', '\u027D': 'r', '\uA75B': 'r', '\uA7A7': 'r', '\uA783': 'r', '\u24E2': 's', '\uFF53': 's', '\u00DF': 's', '\u015B': 's', '\u1E65': 's', '\u015D': 's', '\u1E61': 's', '\u0161': 's', '\u1E67': 's', '\u1E63': 's', '\u1E69': 's', '\u0219': 's', '\u015F': 's', '\u023F': 's', '\uA7A9': 's', '\uA785': 's', '\u1E9B': 's', '\u24E3': 't', '\uFF54': 't', '\u1E6B': 't', '\u1E97': 't', '\u0165': 't', '\u1E6D': 't', '\u021B': 't', '\u0163': 't', '\u1E71': 't', '\u1E6F': 't', '\u0167': 't', '\u01AD': 't', '\u0288': 't', '\u2C66': 't', '\uA787': 't', '\uA729': 'tz', '\u24E4': 'u', '\uFF55': 'u', '\u00F9': 'u', '\u00FA': 'u', '\u00FB': 'u', '\u0169': 'u', '\u1E79': 'u', '\u016B': 'u', '\u1E7B': 'u', '\u016D': 'u', '\u00FC': 'u', '\u01DC': 'u', '\u01D8': 'u', '\u01D6': 'u', '\u01DA': 'u', '\u1EE7': 'u', '\u016F': 'u', '\u0171': 'u', '\u01D4': 'u', '\u0215': 'u', '\u0217': 'u', '\u01B0': 'u', '\u1EEB': 'u', '\u1EE9': 'u', '\u1EEF': 'u', '\u1EED': 'u', '\u1EF1': 'u', '\u1EE5': 'u', '\u1E73': 'u', '\u0173': 'u', '\u1E77': 'u', '\u1E75': 'u', '\u0289': 'u', '\u24E5': 'v', '\uFF56': 'v', '\u1E7D': 'v', '\u1E7F': 'v', '\u028B': 'v', '\uA75F': 'v', '\u028C': 'v', '\uA761': 'vy', '\u24E6': 'w', '\uFF57': 'w', '\u1E81': 'w', '\u1E83': 'w', '\u0175': 'w', '\u1E87': 'w', '\u1E85': 'w', '\u1E98': 'w', '\u1E89': 'w', '\u2C73': 'w', '\u24E7': 'x', '\uFF58': 'x', '\u1E8B': 'x', '\u1E8D': 'x', '\u24E8': 'y', '\uFF59': 'y', '\u1EF3': 'y', '\u00FD': 'y', '\u0177': 'y', '\u1EF9': 'y', '\u0233': 'y', '\u1E8F': 'y', '\u00FF': 'y', '\u1EF7': 'y', '\u1E99': 'y', '\u1EF5': 'y', '\u01B4': 'y', '\u024F': 'y', '\u1EFF': 'y', '\u24E9': 'z', '\uFF5A': 'z', '\u017A': 'z', '\u1E91': 'z', '\u017C': 'z', '\u017E': 'z', '\u1E93': 'z', '\u1E95': 'z', '\u01B6': 'z', '\u0225': 'z', '\u0240': 'z', '\u2C6C': 'z', '\uA763': 'z', '\u0386': '\u0391', '\u0388': '\u0395', '\u0389': '\u0397', '\u038A': '\u0399', '\u03AA': '\u0399', '\u038C': '\u039F', '\u038E': '\u03A5', '\u03AB': '\u03A5', '\u038F': '\u03A9', '\u03AC': '\u03B1', '\u03AD': '\u03B5', '\u03AE': '\u03B7', '\u03AF': '\u03B9', '\u03CA': '\u03B9', '\u0390': '\u03B9', '\u03CC': '\u03BF', '\u03CD': '\u03C5', '\u03CB': '\u03C5', '\u03B0': '\u03C5', '\u03CE': '\u03C9', '\u03C2': '\u03C3', '\u2019': '\'' }; return diacritics; }); S2.define('select2/data/base',[ '../utils' ], function (Utils) { function BaseAdapter ($element, options) { BaseAdapter.__super__.constructor.call(this); } Utils.Extend(BaseAdapter, Utils.Observable); BaseAdapter.prototype.current = function (callback) { throw new Error('The `current` method must be defined in child classes.'); }; BaseAdapter.prototype.query = function (params, callback) { throw new Error('The `query` method must be defined in child classes.'); }; BaseAdapter.prototype.bind = function (container, $container) { // Can be implemented in subclasses }; BaseAdapter.prototype.destroy = function () { // Can be implemented in subclasses }; BaseAdapter.prototype.generateResultId = function (container, data) { var id = container.id + '-result-'; id += Utils.generateChars(4); if (data.id != null) { id += '-' + data.id.toString(); } else { id += '-' + Utils.generateChars(4); } return id; }; return BaseAdapter; }); S2.define('select2/data/select',[ './base', '../utils', 'jquery' ], function (BaseAdapter, Utils, $) { function SelectAdapter ($element, options) { this.$element = $element; this.options = options; SelectAdapter.__super__.constructor.call(this); } Utils.Extend(SelectAdapter, BaseAdapter); SelectAdapter.prototype.current = function (callback) { var data = []; var self = this; this.$element.find(':selected').each(function () { var $option = $(this); var option = self.item($option); data.push(option); }); callback(data); }; SelectAdapter.prototype.select = function (data) { var self = this; data.selected = true; // If data.element is a DOM node, use it instead if ($(data.element).is('option')) { data.element.selected = true; this.$element.trigger('input').trigger('change'); return; } if (this.$element.prop('multiple')) { this.current(function (currentData) { var val = []; data = [data]; data.push.apply(data, currentData); for (var d = 0; d < data.length; d++) { var id = data[d].id; if ($.inArray(id, val) === -1) { val.push(id); } } self.$element.val(val); self.$element.trigger('input').trigger('change'); }); } else { var val = data.id; this.$element.val(val); this.$element.trigger('input').trigger('change'); } }; SelectAdapter.prototype.unselect = function (data) { var self = this; if (!this.$element.prop('multiple')) { return; } data.selected = false; if ($(data.element).is('option')) { data.element.selected = false; this.$element.trigger('input').trigger('change'); return; } this.current(function (currentData) { var val = []; for (var d = 0; d < currentData.length; d++) { var id = currentData[d].id; if (id !== data.id && $.inArray(id, val) === -1) { val.push(id); } } self.$element.val(val); self.$element.trigger('input').trigger('change'); }); }; SelectAdapter.prototype.bind = function (container, $container) { var self = this; this.container = container; container.on('select', function (params) { self.select(params.data); }); container.on('unselect', function (params) { self.unselect(params.data); }); }; SelectAdapter.prototype.destroy = function () { // Remove anything added to child elements this.$element.find('*').each(function () { // Remove any custom data set by Select2 Utils.RemoveData(this); }); }; SelectAdapter.prototype.query = function (params, callback) { var data = []; var self = this; var $options = this.$element.children(); $options.each(function () { var $option = $(this); if (!$option.is('option') && !$option.is('optgroup')) { return; } var option = self.item($option); var matches = self.matches(params, option); if (matches !== null) { data.push(matches); } }); callback({ results: data }); }; SelectAdapter.prototype.addOptions = function ($options) { Utils.appendMany(this.$element, $options); }; SelectAdapter.prototype.option = function (data) { var option; if (data.children) { option = document.createElement('optgroup'); option.label = data.text; } else { option = document.createElement('option'); if (option.textContent !== undefined) { option.textContent = data.text; } else { option.innerText = data.text; } } if (data.id !== undefined) { option.value = data.id; } if (data.disabled) { option.disabled = true; } if (data.selected) { option.selected = true; } if (data.title) { option.title = data.title; } var $option = $(option); var normalizedData = this._normalizeItem(data); normalizedData.element = option; // Override the option's data with the combined data Utils.StoreData(option, 'data', normalizedData); return $option; }; SelectAdapter.prototype.item = function ($option) { var data = {}; data = Utils.GetData($option[0], 'data'); if (data != null) { return data; } if ($option.is('option')) { data = { id: $option.val(), text: $option.text(), disabled: $option.prop('disabled'), selected: $option.prop('selected'), title: $option.prop('title') }; } else if ($option.is('optgroup')) { data = { text: $option.prop('label'), children: [], title: $option.prop('title') }; var $children = $option.children('option'); var children = []; for (var c = 0; c < $children.length; c++) { var $child = $($children[c]); var child = this.item($child); children.push(child); } data.children = children; } data = this._normalizeItem(data); data.element = $option[0]; Utils.StoreData($option[0], 'data', data); return data; }; SelectAdapter.prototype._normalizeItem = function (item) { if (item !== Object(item)) { item = { id: item, text: item }; } item = $.extend({}, { text: '' }, item); var defaults = { selected: false, disabled: false }; if (item.id != null) { item.id = item.id.toString(); } if (item.text != null) { item.text = item.text.toString(); } if (item._resultId == null && item.id && this.container != null) { item._resultId = this.generateResultId(this.container, item); } return $.extend({}, defaults, item); }; SelectAdapter.prototype.matches = function (params, data) { var matcher = this.options.get('matcher'); return matcher(params, data); }; return SelectAdapter; }); S2.define('select2/data/array',[ './select', '../utils', 'jquery' ], function (SelectAdapter, Utils, $) { function ArrayAdapter ($element, options) { this._dataToConvert = options.get('data') || []; ArrayAdapter.__super__.constructor.call(this, $element, options); } Utils.Extend(ArrayAdapter, SelectAdapter); ArrayAdapter.prototype.bind = function (container, $container) { ArrayAdapter.__super__.bind.call(this, container, $container); this.addOptions(this.convertToOptions(this._dataToConvert)); }; ArrayAdapter.prototype.select = function (data) { var $option = this.$element.find('option').filter(function (i, elm) { return elm.value == data.id.toString(); }); if ($option.length === 0) { $option = this.option(data); this.addOptions($option); } ArrayAdapter.__super__.select.call(this, data); }; ArrayAdapter.prototype.convertToOptions = function (data) { var self = this; var $existing = this.$element.find('option'); var existingIds = $existing.map(function () { return self.item($(this)).id; }).get(); var $options = []; // Filter out all items except for the one passed in the argument function onlyItem (item) { return function () { return $(this).val() == item.id; }; } for (var d = 0; d < data.length; d++) { var item = this._normalizeItem(data[d]); // Skip items which were pre-loaded, only merge the data if ($.inArray(item.id, existingIds) >= 0) { var $existingOption = $existing.filter(onlyItem(item)); var existingData = this.item($existingOption); var newData = $.extend(true, {}, item, existingData); var $newOption = this.option(newData); $existingOption.replaceWith($newOption); continue; } var $option = this.option(item); if (item.children) { var $children = this.convertToOptions(item.children); Utils.appendMany($option, $children); } $options.push($option); } return $options; }; return ArrayAdapter; }); S2.define('select2/data/ajax',[ './array', '../utils', 'jquery' ], function (ArrayAdapter, Utils, $) { function AjaxAdapter ($element, options) { this.ajaxOptions = this._applyDefaults(options.get('ajax')); if (this.ajaxOptions.processResults != null) { this.processResults = this.ajaxOptions.processResults; } AjaxAdapter.__super__.constructor.call(this, $element, options); } Utils.Extend(AjaxAdapter, ArrayAdapter); AjaxAdapter.prototype._applyDefaults = function (options) { var defaults = { data: function (params) { return $.extend({}, params, { q: params.term }); }, transport: function (params, success, failure) { var $request = $.ajax(params); $request.then(success); $request.fail(failure); return $request; } }; return $.extend({}, defaults, options, true); }; AjaxAdapter.prototype.processResults = function (results) { return results; }; AjaxAdapter.prototype.query = function (params, callback) { var matches = []; var self = this; if (this._request != null) { // JSONP requests cannot always be aborted if ($.isFunction(this._request.abort)) { this._request.abort(); } this._request = null; } var options = $.extend({ type: 'GET' }, this.ajaxOptions); if (typeof options.url === 'function') { options.url = options.url.call(this.$element, params); } if (typeof options.data === 'function') { options.data = options.data.call(this.$element, params); } function request () { var $request = options.transport(options, function (data) { var results = self.processResults(data, params); if (self.options.get('debug') && window.console && console.error) { // Check to make sure that the response included a `results` key. if (!results || !results.results || !$.isArray(results.results)) { console.error( 'Select2: The AJAX results did not return an array in the ' + '`results` key of the response.' ); } } callback(results); }, function () { // Attempt to detect if a request was aborted // Only works if the transport exposes a status property if ('status' in $request && ($request.status === 0 || $request.status === '0')) { return; } self.trigger('results:message', { message: 'errorLoading' }); }); self._request = $request; } if (this.ajaxOptions.delay && params.term != null) { if (this._queryTimeout) { window.clearTimeout(this._queryTimeout); } this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); } else { request(); } }; return AjaxAdapter; }); S2.define('select2/data/tags',[ 'jquery' ], function ($) { function Tags (decorated, $element, options) { var tags = options.get('tags'); var createTag = options.get('createTag'); if (createTag !== undefined) { this.createTag = createTag; } var insertTag = options.get('insertTag'); if (insertTag !== undefined) { this.insertTag = insertTag; } decorated.call(this, $element, options); if ($.isArray(tags)) { for (var t = 0; t < tags.length; t++) { var tag = tags[t]; var item = this._normalizeItem(tag); var $option = this.option(item); this.$element.append($option); } } } Tags.prototype.query = function (decorated, params, callback) { var self = this; this._removeOldTags(); if (params.term == null || params.page != null) { decorated.call(this, params, callback); return; } function wrapper (obj, child) { var data = obj.results; for (var i = 0; i < data.length; i++) { var option = data[i]; var checkChildren = ( option.children != null && !wrapper({ results: option.children }, true) ); var optionText = (option.text || '').toUpperCase(); var paramsTerm = (params.term || '').toUpperCase(); var checkText = optionText === paramsTerm; if (checkText || checkChildren) { if (child) { return false; } obj.data = data; callback(obj); return; } } if (child) { return true; } var tag = self.createTag(params); if (tag != null) { var $option = self.option(tag); $option.attr('data-select2-tag', true); self.addOptions([$option]); self.insertTag(data, tag); } obj.results = data; callback(obj); } decorated.call(this, params, wrapper); }; Tags.prototype.createTag = function (decorated, params) { var term = $.trim(params.term); if (term === '') { return null; } return { id: term, text: term }; }; Tags.prototype.insertTag = function (_, data, tag) { data.unshift(tag); }; Tags.prototype._removeOldTags = function (_) { var $options = this.$element.find('option[data-select2-tag]'); $options.each(function () { if (this.selected) { return; } $(this).remove(); }); }; return Tags; }); S2.define('select2/data/tokenizer',[ 'jquery' ], function ($) { function Tokenizer (decorated, $element, options) { var tokenizer = options.get('tokenizer'); if (tokenizer !== undefined) { this.tokenizer = tokenizer; } decorated.call(this, $element, options); } Tokenizer.prototype.bind = function (decorated, container, $container) { decorated.call(this, container, $container); this.$search = container.dropdown.$search || container.selection.$search || $container.find('.select2-search__field'); }; Tokenizer.prototype.query = function (decorated, params, callback) { var self = this; function createAndSelect (data) { // Normalize the data object so we can use it for checks var item = self._normalizeItem(data); // Check if the data object already exists as a tag // Select it if it doesn't var $existingOptions = self.$element.find('option').filter(function () { return $(this).val() === item.id; }); // If an existing option wasn't found for it, create the option if (!$existingOptions.length) { var $option = self.option(item); $option.attr('data-select2-tag', true); self._removeOldTags(); self.addOptions([$option]); } // Select the item, now that we know there is an option for it select(item); } function select (data) { self.trigger('select', { data: data }); } params.term = params.term || ''; var tokenData = this.tokenizer(params, this.options, createAndSelect); if (tokenData.term !== params.term) { // Replace the search term if we have the search box if (this.$search.length) { this.$search.val(tokenData.term); this.$search.trigger('focus'); } params.term = tokenData.term; } decorated.call(this, params, callback); }; Tokenizer.prototype.tokenizer = function (_, params, options, callback) { var separators = options.get('tokenSeparators') || []; var term = params.term; var i = 0; var createTag = this.createTag || function (params) { return { id: params.term, text: params.term }; }; while (i < term.length) { var termChar = term[i]; if ($.inArray(termChar, separators) === -1) { i++; continue; } var part = term.substr(0, i); var partParams = $.extend({}, params, { term: part }); var data = createTag(partParams); if (data == null) { i++; continue; } callback(data); // Reset the term to not include the tokenized portion term = term.substr(i + 1) || ''; i = 0; } return { term: term }; }; return Tokenizer; }); S2.define('select2/data/minimumInputLength',[ ], function () { function MinimumInputLength (decorated, $e, options) { this.minimumInputLength = options.get('minimumInputLength'); decorated.call(this, $e, options); } MinimumInputLength.prototype.query = function (decorated, params, callback) { params.term = params.term || ''; if (params.term.length < this.minimumInputLength) { this.trigger('results:message', { message: 'inputTooShort', args: { minimum: this.minimumInputLength, input: params.term, params: params } }); return; } decorated.call(this, params, callback); }; return MinimumInputLength; }); S2.define('select2/data/maximumInputLength',[ ], function () { function MaximumInputLength (decorated, $e, options) { this.maximumInputLength = options.get('maximumInputLength'); decorated.call(this, $e, options); } MaximumInputLength.prototype.query = function (decorated, params, callback) { params.term = params.term || ''; if (this.maximumInputLength > 0 && params.term.length > this.maximumInputLength) { this.trigger('results:message', { message: 'inputTooLong', args: { maximum: this.maximumInputLength, input: params.term, params: params } }); return; } decorated.call(this, params, callback); }; return MaximumInputLength; }); S2.define('select2/data/maximumSelectionLength',[ ], function (){ function MaximumSelectionLength (decorated, $e, options) { this.maximumSelectionLength = options.get('maximumSelectionLength'); decorated.call(this, $e, options); } MaximumSelectionLength.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('select', function () { self._checkIfMaximumSelected(); }); }; MaximumSelectionLength.prototype.query = function (decorated, params, callback) { var self = this; this._checkIfMaximumSelected(function () { decorated.call(self, params, callback); }); }; MaximumSelectionLength.prototype._checkIfMaximumSelected = function (_, successCallback) { var self = this; this.current(function (currentData) { var count = currentData != null ? currentData.length : 0; if (self.maximumSelectionLength > 0 && count >= self.maximumSelectionLength) { self.trigger('results:message', { message: 'maximumSelected', args: { maximum: self.maximumSelectionLength } }); return; } if (successCallback) { successCallback(); } }); }; return MaximumSelectionLength; }); S2.define('select2/dropdown',[ 'jquery', './utils' ], function ($, Utils) { function Dropdown ($element, options) { this.$element = $element; this.options = options; Dropdown.__super__.constructor.call(this); } Utils.Extend(Dropdown, Utils.Observable); Dropdown.prototype.render = function () { var $dropdown = $( '<span class="select2-dropdown">' + '<span class="select2-results"></span>' + '</span>' ); $dropdown.attr('dir', this.options.get('dir')); this.$dropdown = $dropdown; return $dropdown; }; Dropdown.prototype.bind = function () { // Should be implemented in subclasses }; Dropdown.prototype.position = function ($dropdown, $container) { // Should be implemented in subclasses }; Dropdown.prototype.destroy = function () { // Remove the dropdown from the DOM this.$dropdown.remove(); }; return Dropdown; }); S2.define('select2/dropdown/search',[ 'jquery', '../utils' ], function ($, Utils) { function Search () { } Search.prototype.render = function (decorated) { var $rendered = decorated.call(this); var $search = $( '<span class="select2-search select2-search--dropdown">' + '<input class="select2-search__field" type="search" tabindex="-1"' + ' autocomplete="off" autocorrect="off" autocapitalize="none"' + ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + '</span>' ); this.$searchContainer = $search; this.$search = $search.find('input'); $rendered.prepend($search); return $rendered; }; Search.prototype.bind = function (decorated, container, $container) { var self = this; var resultsId = container.id + '-results'; decorated.call(this, container, $container); this.$search.on('keydown', function (evt) { self.trigger('keypress', evt); self._keyUpPrevented = evt.isDefaultPrevented(); }); // Workaround for browsers which do not support the `input` event // This will prevent double-triggering of events for browsers which support // both the `keyup` and `input` events. this.$search.on('input', function (evt) { // Unbind the duplicated `keyup` event $(this).off('keyup'); }); this.$search.on('keyup input', function (evt) { self.handleSearch(evt); }); container.on('open', function () { self.$search.attr('tabindex', 0); self.$search.attr('aria-controls', resultsId); self.$search.trigger('focus'); window.setTimeout(function () { self.$search.trigger('focus'); }, 0); }); container.on('close', function () { self.$search.attr('tabindex', -1); self.$search.removeAttr('aria-controls'); self.$search.removeAttr('aria-activedescendant'); self.$search.val(''); self.$search.trigger('blur'); }); container.on('focus', function () { if (!container.isOpen()) { self.$search.trigger('focus'); } }); container.on('results:all', function (params) { if (params.query.term == null || params.query.term === '') { var showSearch = self.showSearch(params); if (showSearch) { self.$searchContainer.removeClass('select2-search--hide'); } else { self.$searchContainer.addClass('select2-search--hide'); } } }); container.on('results:focus', function (params) { if (params.data._resultId) { self.$search.attr('aria-activedescendant', params.data._resultId); } else { self.$search.removeAttr('aria-activedescendant'); } }); }; Search.prototype.handleSearch = function (evt) { if (!this._keyUpPrevented) { var input = this.$search.val(); this.trigger('query', { term: input }); } this._keyUpPrevented = false; }; Search.prototype.showSearch = function (_, params) { return true; }; return Search; }); S2.define('select2/dropdown/hidePlaceholder',[ ], function () { function HidePlaceholder (decorated, $element, options, dataAdapter) { this.placeholder = this.normalizePlaceholder(options.get('placeholder')); decorated.call(this, $element, options, dataAdapter); } HidePlaceholder.prototype.append = function (decorated, data) { data.results = this.removePlaceholder(data.results); decorated.call(this, data); }; HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { if (typeof placeholder === 'string') { placeholder = { id: '', text: placeholder }; } return placeholder; }; HidePlaceholder.prototype.removePlaceholder = function (_, data) { var modifiedData = data.slice(0); for (var d = data.length - 1; d >= 0; d--) { var item = data[d]; if (this.placeholder.id === item.id) { modifiedData.splice(d, 1); } } return modifiedData; }; return HidePlaceholder; }); S2.define('select2/dropdown/infiniteScroll',[ 'jquery' ], function ($) { function InfiniteScroll (decorated, $element, options, dataAdapter) { this.lastParams = {}; decorated.call(this, $element, options, dataAdapter); this.$loadingMore = this.createLoadingMore(); this.loading = false; } InfiniteScroll.prototype.append = function (decorated, data) { this.$loadingMore.remove(); this.loading = false; decorated.call(this, data); if (this.showLoadingMore(data)) { this.$results.append(this.$loadingMore); this.loadMoreIfNeeded(); } }; InfiniteScroll.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('query', function (params) { self.lastParams = params; self.loading = true; }); container.on('query:append', function (params) { self.lastParams = params; self.loading = true; }); this.$results.on('scroll', this.loadMoreIfNeeded.bind(this)); }; InfiniteScroll.prototype.loadMoreIfNeeded = function () { var isLoadMoreVisible = $.contains( document.documentElement, this.$loadingMore[0] ); if (this.loading || !isLoadMoreVisible) { return; } var currentOffset = this.$results.offset().top + this.$results.outerHeight(false); var loadingMoreOffset = this.$loadingMore.offset().top + this.$loadingMore.outerHeight(false); if (currentOffset + 50 >= loadingMoreOffset) { this.loadMore(); } }; InfiniteScroll.prototype.loadMore = function () { this.loading = true; var params = $.extend({}, {page: 1}, this.lastParams); params.page++; this.trigger('query:append', params); }; InfiniteScroll.prototype.showLoadingMore = function (_, data) { return data.pagination && data.pagination.more; }; InfiniteScroll.prototype.createLoadingMore = function () { var $option = $( '<li ' + 'class="select2-results__option select2-results__option--load-more"' + 'role="option" aria-disabled="true"></li>' ); var message = this.options.get('translations').get('loadingMore'); $option.html(message(this.lastParams)); return $option; }; return InfiniteScroll; }); S2.define('select2/dropdown/attachBody',[ 'jquery', '../utils' ], function ($, Utils) { function AttachBody (decorated, $element, options) { this.$dropdownParent = $(options.get('dropdownParent') || document.body); decorated.call(this, $element, options); } AttachBody.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('open', function () { self._showDropdown(); self._attachPositioningHandler(container); // Must bind after the results handlers to ensure correct sizing self._bindContainerResultHandlers(container); }); container.on('close', function () { self._hideDropdown(); self._detachPositioningHandler(container); }); this.$dropdownContainer.on('mousedown', function (evt) { evt.stopPropagation(); }); }; AttachBody.prototype.destroy = function (decorated) { decorated.call(this); this.$dropdownContainer.remove(); }; AttachBody.prototype.position = function (decorated, $dropdown, $container) { // Clone all of the container classes $dropdown.attr('class', $container.attr('class')); $dropdown.removeClass('select2'); $dropdown.addClass('select2-container--open'); $dropdown.css({ position: 'absolute', top: -999999 }); this.$container = $container; }; AttachBody.prototype.render = function (decorated) { var $container = $('<span></span>'); var $dropdown = decorated.call(this); $container.append($dropdown); this.$dropdownContainer = $container; return $container; }; AttachBody.prototype._hideDropdown = function (decorated) { this.$dropdownContainer.detach(); }; AttachBody.prototype._bindContainerResultHandlers = function (decorated, container) { // These should only be bound once if (this._containerResultsHandlersBound) { return; } var self = this; container.on('results:all', function () { self._positionDropdown(); self._resizeDropdown(); }); container.on('results:append', function () { self._positionDropdown(); self._resizeDropdown(); }); container.on('results:message', function () { self._positionDropdown(); self._resizeDropdown(); }); container.on('select', function () { self._positionDropdown(); self._resizeDropdown(); }); container.on('unselect', function () { self._positionDropdown(); self._resizeDropdown(); }); this._containerResultsHandlersBound = true; }; AttachBody.prototype._attachPositioningHandler = function (decorated, container) { var self = this; var scrollEvent = 'scroll.select2.' + container.id; var resizeEvent = 'resize.select2.' + container.id; var orientationEvent = 'orientationchange.select2.' + container.id; var $watchers = this.$container.parents().filter(Utils.hasScroll); $watchers.each(function () { Utils.StoreData(this, 'select2-scroll-position', { x: $(this).scrollLeft(), y: $(this).scrollTop() }); }); $watchers.on(scrollEvent, function (ev) { var position = Utils.GetData(this, 'select2-scroll-position'); $(this).scrollTop(position.y); }); $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, function (e) { self._positionDropdown(); self._resizeDropdown(); }); }; AttachBody.prototype._detachPositioningHandler = function (decorated, container) { var scrollEvent = 'scroll.select2.' + container.id; var resizeEvent = 'resize.select2.' + container.id; var orientationEvent = 'orientationchange.select2.' + container.id; var $watchers = this.$container.parents().filter(Utils.hasScroll); $watchers.off(scrollEvent); $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); }; AttachBody.prototype._positionDropdown = function () { var $window = $(window); var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); var newDirection = null; var offset = this.$container.offset(); offset.bottom = offset.top + this.$container.outerHeight(false); var container = { height: this.$container.outerHeight(false) }; container.top = offset.top; container.bottom = offset.top + container.height; var dropdown = { height: this.$dropdown.outerHeight(false) }; var viewport = { top: $window.scrollTop(), bottom: $window.scrollTop() + $window.height() }; var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); var css = { left: offset.left, top: container.bottom }; // Determine what the parent element is to use for calculating the offset var $offsetParent = this.$dropdownParent; // For statically positioned elements, we need to get the element // that is determining the offset if ($offsetParent.css('position') === 'static') { $offsetParent = $offsetParent.offsetParent(); } var parentOffset = { top: 0, left: 0 }; if ( $.contains(document.body, $offsetParent[0]) || $offsetParent[0].isConnected ) { parentOffset = $offsetParent.offset(); } css.top -= parentOffset.top; css.left -= parentOffset.left; if (!isCurrentlyAbove && !isCurrentlyBelow) { newDirection = 'below'; } if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { newDirection = 'above'; } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { newDirection = 'below'; } if (newDirection == 'above' || (isCurrentlyAbove && newDirection !== 'below')) { css.top = container.top - parentOffset.top - dropdown.height; } if (newDirection != null) { this.$dropdown .removeClass('select2-dropdown--below select2-dropdown--above') .addClass('select2-dropdown--' + newDirection); this.$container .removeClass('select2-container--below select2-container--above') .addClass('select2-container--' + newDirection); } this.$dropdownContainer.css(css); }; AttachBody.prototype._resizeDropdown = function () { var css = { width: this.$container.outerWidth(false) + 'px' }; if (this.options.get('dropdownAutoWidth')) { css.minWidth = css.width; css.position = 'relative'; css.width = 'auto'; } this.$dropdown.css(css); }; AttachBody.prototype._showDropdown = function (decorated) { this.$dropdownContainer.appendTo(this.$dropdownParent); this._positionDropdown(); this._resizeDropdown(); }; return AttachBody; }); S2.define('select2/dropdown/minimumResultsForSearch',[ ], function () { function countResults (data) { var count = 0; for (var d = 0; d < data.length; d++) { var item = data[d]; if (item.children) { count += countResults(item.children); } else { count++; } } return count; } function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { this.minimumResultsForSearch = options.get('minimumResultsForSearch'); if (this.minimumResultsForSearch < 0) { this.minimumResultsForSearch = Infinity; } decorated.call(this, $element, options, dataAdapter); } MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { if (countResults(params.data.results) < this.minimumResultsForSearch) { return false; } return decorated.call(this, params); }; return MinimumResultsForSearch; }); S2.define('select2/dropdown/selectOnClose',[ '../utils' ], function (Utils) { function SelectOnClose () { } SelectOnClose.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('close', function (params) { self._handleSelectOnClose(params); }); }; SelectOnClose.prototype._handleSelectOnClose = function (_, params) { if (params && params.originalSelect2Event != null) { var event = params.originalSelect2Event; // Don't select an item if the close event was triggered from a select or // unselect event if (event._type === 'select' || event._type === 'unselect') { return; } } var $highlightedResults = this.getHighlightedResults(); // Only select highlighted results if ($highlightedResults.length < 1) { return; } var data = Utils.GetData($highlightedResults[0], 'data'); // Don't re-select already selected resulte if ( (data.element != null && data.element.selected) || (data.element == null && data.selected) ) { return; } this.trigger('select', { data: data }); }; return SelectOnClose; }); S2.define('select2/dropdown/closeOnSelect',[ ], function () { function CloseOnSelect () { } CloseOnSelect.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('select', function (evt) { self._selectTriggered(evt); }); container.on('unselect', function (evt) { self._selectTriggered(evt); }); }; CloseOnSelect.prototype._selectTriggered = function (_, evt) { var originalEvent = evt.originalEvent; // Don't close if the control key is being held if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) { return; } this.trigger('close', { originalEvent: originalEvent, originalSelect2Event: evt }); }; return CloseOnSelect; }); S2.define('select2/i18n/en',[],function () { // English return { errorLoading: function () { return 'The results could not be loaded.'; }, inputTooLong: function (args) { var overChars = args.input.length - args.maximum; var message = 'Please delete ' + overChars + ' character'; if (overChars != 1) { message += 's'; } return message; }, inputTooShort: function (args) { var remainingChars = args.minimum - args.input.length; var message = 'Please enter ' + remainingChars + ' or more characters'; return message; }, loadingMore: function () { return 'Loading more results…'; }, maximumSelected: function (args) { var message = 'You can only select ' + args.maximum + ' item'; if (args.maximum != 1) { message += 's'; } return message; }, noResults: function () { return 'No results found'; }, searching: function () { return 'Searching…'; }, removeAllItems: function () { return 'Remove all items'; } }; }); S2.define('select2/defaults',[ 'jquery', 'require', './results', './selection/single', './selection/multiple', './selection/placeholder', './selection/allowClear', './selection/search', './selection/eventRelay', './utils', './translation', './diacritics', './data/select', './data/array', './data/ajax', './data/tags', './data/tokenizer', './data/minimumInputLength', './data/maximumInputLength', './data/maximumSelectionLength', './dropdown', './dropdown/search', './dropdown/hidePlaceholder', './dropdown/infiniteScroll', './dropdown/attachBody', './dropdown/minimumResultsForSearch', './dropdown/selectOnClose', './dropdown/closeOnSelect', './i18n/en' ], function ($, require, ResultsList, SingleSelection, MultipleSelection, Placeholder, AllowClear, SelectionSearch, EventRelay, Utils, Translation, DIACRITICS, SelectData, ArrayData, AjaxData, Tags, Tokenizer, MinimumInputLength, MaximumInputLength, MaximumSelectionLength, Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, EnglishTranslation) { function Defaults () { this.reset(); } Defaults.prototype.apply = function (options) { options = $.extend(true, {}, this.defaults, options); if (options.dataAdapter == null) { if (options.ajax != null) { options.dataAdapter = AjaxData; } else if (options.data != null) { options.dataAdapter = ArrayData; } else { options.dataAdapter = SelectData; } if (options.minimumInputLength > 0) { options.dataAdapter = Utils.Decorate( options.dataAdapter, MinimumInputLength ); } if (options.maximumInputLength > 0) { options.dataAdapter = Utils.Decorate( options.dataAdapter, MaximumInputLength ); } if (options.maximumSelectionLength > 0) { options.dataAdapter = Utils.Decorate( options.dataAdapter, MaximumSelectionLength ); } if (options.tags) { options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); } if (options.tokenSeparators != null || options.tokenizer != null) { options.dataAdapter = Utils.Decorate( options.dataAdapter, Tokenizer ); } if (options.query != null) { var Query = require(options.amdBase + 'compat/query'); options.dataAdapter = Utils.Decorate( options.dataAdapter, Query ); } if (options.initSelection != null) { var InitSelection = require(options.amdBase + 'compat/initSelection'); options.dataAdapter = Utils.Decorate( options.dataAdapter, InitSelection ); } } if (options.resultsAdapter == null) { options.resultsAdapter = ResultsList; if (options.ajax != null) { options.resultsAdapter = Utils.Decorate( options.resultsAdapter, InfiniteScroll ); } if (options.placeholder != null) { options.resultsAdapter = Utils.Decorate( options.resultsAdapter, HidePlaceholder ); } if (options.selectOnClose) { options.resultsAdapter = Utils.Decorate( options.resultsAdapter, SelectOnClose ); } } if (options.dropdownAdapter == null) { if (options.multiple) { options.dropdownAdapter = Dropdown; } else { var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); options.dropdownAdapter = SearchableDropdown; } if (options.minimumResultsForSearch !== 0) { options.dropdownAdapter = Utils.Decorate( options.dropdownAdapter, MinimumResultsForSearch ); } if (options.closeOnSelect) { options.dropdownAdapter = Utils.Decorate( options.dropdownAdapter, CloseOnSelect ); } if ( options.dropdownCssClass != null || options.dropdownCss != null || options.adaptDropdownCssClass != null ) { var DropdownCSS = require(options.amdBase + 'compat/dropdownCss'); options.dropdownAdapter = Utils.Decorate( options.dropdownAdapter, DropdownCSS ); } options.dropdownAdapter = Utils.Decorate( options.dropdownAdapter, AttachBody ); } if (options.selectionAdapter == null) { if (options.multiple) { options.selectionAdapter = MultipleSelection; } else { options.selectionAdapter = SingleSelection; } // Add the placeholder mixin if a placeholder was specified if (options.placeholder != null) { options.selectionAdapter = Utils.Decorate( options.selectionAdapter, Placeholder ); } if (options.allowClear) { options.selectionAdapter = Utils.Decorate( options.selectionAdapter, AllowClear ); } if (options.multiple) { options.selectionAdapter = Utils.Decorate( options.selectionAdapter, SelectionSearch ); } if ( options.containerCssClass != null || options.containerCss != null || options.adaptContainerCssClass != null ) { var ContainerCSS = require(options.amdBase + 'compat/containerCss'); options.selectionAdapter = Utils.Decorate( options.selectionAdapter, ContainerCSS ); } options.selectionAdapter = Utils.Decorate( options.selectionAdapter, EventRelay ); } // If the defaults were not previously applied from an element, it is // possible for the language option to have not been resolved options.language = this._resolveLanguage(options.language); // Always fall back to English since it will always be complete options.language.push('en'); var uniqueLanguages = []; for (var l = 0; l < options.language.length; l++) { var language = options.language[l]; if (uniqueLanguages.indexOf(language) === -1) { uniqueLanguages.push(language); } } options.language = uniqueLanguages; options.translations = this._processTranslations( options.language, options.debug ); return options; }; Defaults.prototype.reset = function () { function stripDiacritics (text) { // Used 'uni range + named function' from http://jsperf.com/diacritics/18 function match(a) { return DIACRITICS[a] || a; } return text.replace(/[^\u0000-\u007E]/g, match); } function matcher (params, data) { // Always return the object if there is nothing to compare if ($.trim(params.term) === '') { return data; } // Do a recursive check for options with children if (data.children && data.children.length > 0) { // Clone the data object if there are children // This is required as we modify the object to remove any non-matches var match = $.extend(true, {}, data); // Check each child of the option for (var c = data.children.length - 1; c >= 0; c--) { var child = data.children[c]; var matches = matcher(params, child); // If there wasn't a match, remove the object in the array if (matches == null) { match.children.splice(c, 1); } } // If any children matched, return the new object if (match.children.length > 0) { return match; } // If there were no matching children, check just the plain object return matcher(params, match); } var original = stripDiacritics(data.text).toUpperCase(); var term = stripDiacritics(params.term).toUpperCase(); // Check if the text contains the term if (original.indexOf(term) > -1) { return data; } // If it doesn't contain the term, don't return anything return null; } this.defaults = { amdBase: './', amdLanguageBase: './i18n/', closeOnSelect: true, debug: false, dropdownAutoWidth: false, escapeMarkup: Utils.escapeMarkup, language: {}, matcher: matcher, minimumInputLength: 0, maximumInputLength: 0, maximumSelectionLength: 0, minimumResultsForSearch: 0, selectOnClose: false, scrollAfterSelect: false, sorter: function (data) { return data; }, templateResult: function (result) { return result.text; }, templateSelection: function (selection) { return selection.text; }, theme: 'default', width: 'resolve' }; }; Defaults.prototype.applyFromElement = function (options, $element) { var optionLanguage = options.language; var defaultLanguage = this.defaults.language; var elementLanguage = $element.prop('lang'); var parentLanguage = $element.closest('[lang]').prop('lang'); var languages = Array.prototype.concat.call( this._resolveLanguage(elementLanguage), this._resolveLanguage(optionLanguage), this._resolveLanguage(defaultLanguage), this._resolveLanguage(parentLanguage) ); options.language = languages; return options; }; Defaults.prototype._resolveLanguage = function (language) { if (!language) { return []; } if ($.isEmptyObject(language)) { return []; } if ($.isPlainObject(language)) { return [language]; } var languages; if (!$.isArray(language)) { languages = [language]; } else { languages = language; } var resolvedLanguages = []; for (var l = 0; l < languages.length; l++) { resolvedLanguages.push(languages[l]); if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) { // Extract the region information if it is included var languageParts = languages[l].split('-'); var baseLanguage = languageParts[0]; resolvedLanguages.push(baseLanguage); } } return resolvedLanguages; }; Defaults.prototype._processTranslations = function (languages, debug) { var translations = new Translation(); for (var l = 0; l < languages.length; l++) { var languageData = new Translation(); var language = languages[l]; if (typeof language === 'string') { try { // Try to load it with the original name languageData = Translation.loadPath(language); } catch (e) { try { // If we couldn't load it, check if it wasn't the full path language = this.defaults.amdLanguageBase + language; languageData = Translation.loadPath(language); } catch (ex) { // The translation could not be loaded at all. Sometimes this is // because of a configuration problem, other times this can be // because of how Select2 helps load all possible translation files if (debug && window.console && console.warn) { console.warn( 'Select2: The language file for "' + language + '" could ' + 'not be automatically loaded. A fallback will be used instead.' ); } } } } else if ($.isPlainObject(language)) { languageData = new Translation(language); } else { languageData = language; } translations.extend(languageData); } return translations; }; Defaults.prototype.set = function (key, value) { var camelKey = $.camelCase(key); var data = {}; data[camelKey] = value; var convertedData = Utils._convertData(data); $.extend(true, this.defaults, convertedData); }; var defaults = new Defaults(); return defaults; }); S2.define('select2/options',[ 'require', 'jquery', './defaults', './utils' ], function (require, $, Defaults, Utils) { function Options (options, $element) { this.options = options; if ($element != null) { this.fromElement($element); } if ($element != null) { this.options = Defaults.applyFromElement(this.options, $element); } this.options = Defaults.apply(this.options); if ($element && $element.is('input')) { var InputCompat = require(this.get('amdBase') + 'compat/inputData'); this.options.dataAdapter = Utils.Decorate( this.options.dataAdapter, InputCompat ); } } Options.prototype.fromElement = function ($e) { var excludedData = ['select2']; if (this.options.multiple == null) { this.options.multiple = $e.prop('multiple'); } if (this.options.disabled == null) { this.options.disabled = $e.prop('disabled'); } if (this.options.dir == null) { if ($e.prop('dir')) { this.options.dir = $e.prop('dir'); } else if ($e.closest('[dir]').prop('dir')) { this.options.dir = $e.closest('[dir]').prop('dir'); } else { this.options.dir = 'ltr'; } } $e.prop('disabled', this.options.disabled); $e.prop('multiple', this.options.multiple); if (Utils.GetData($e[0], 'select2Tags')) { if (this.options.debug && window.console && console.warn) { console.warn( 'Select2: The `data-select2-tags` attribute has been changed to ' + 'use the `data-data` and `data-tags="true"` attributes and will be ' + 'removed in future versions of Select2.' ); } Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags')); Utils.StoreData($e[0], 'tags', true); } if (Utils.GetData($e[0], 'ajaxUrl')) { if (this.options.debug && window.console && console.warn) { console.warn( 'Select2: The `data-ajax-url` attribute has been changed to ' + '`data-ajax--url` and support for the old attribute will be removed' + ' in future versions of Select2.' ); } $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl')); } var dataset = {}; function upperCaseLetter(_, letter) { return letter.toUpperCase(); } // Pre-load all of the attributes which are prefixed with `data-` for (var attr = 0; attr < $e[0].attributes.length; attr++) { var attributeName = $e[0].attributes[attr].name; var prefix = 'data-'; if (attributeName.substr(0, prefix.length) == prefix) { // Get the contents of the attribute after `data-` var dataName = attributeName.substring(prefix.length); // Get the data contents from the consistent source // This is more than likely the jQuery data helper var dataValue = Utils.GetData($e[0], dataName); // camelCase the attribute name to match the spec var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter); // Store the data attribute contents into the dataset since dataset[camelDataName] = dataValue; } } // Prefer the element's `dataset` attribute if it exists // jQuery 1.x does not correctly handle data attributes with multiple dashes if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { dataset = $.extend(true, {}, $e[0].dataset, dataset); } // Prefer our internal data cache if it exists var data = $.extend(true, {}, Utils.GetData($e[0]), dataset); data = Utils._convertData(data); for (var key in data) { if ($.inArray(key, excludedData) > -1) { continue; } if ($.isPlainObject(this.options[key])) { $.extend(this.options[key], data[key]); } else { this.options[key] = data[key]; } } return this; }; Options.prototype.get = function (key) { return this.options[key]; }; Options.prototype.set = function (key, val) { this.options[key] = val; }; return Options; }); S2.define('select2/core',[ 'jquery', './options', './utils', './keys' ], function ($, Options, Utils, KEYS) { var Select2 = function ($element, options) { if (Utils.GetData($element[0], 'select2') != null) { Utils.GetData($element[0], 'select2').destroy(); } this.$element = $element; this.id = this._generateId($element); options = options || {}; this.options = new Options(options, $element); Select2.__super__.constructor.call(this); // Set up the tabindex var tabindex = $element.attr('tabindex') || 0; Utils.StoreData($element[0], 'old-tabindex', tabindex); $element.attr('tabindex', '-1'); // Set up containers and adapters var DataAdapter = this.options.get('dataAdapter'); this.dataAdapter = new DataAdapter($element, this.options); var $container = this.render(); this._placeContainer($container); var SelectionAdapter = this.options.get('selectionAdapter'); this.selection = new SelectionAdapter($element, this.options); this.$selection = this.selection.render(); this.selection.position(this.$selection, $container); var DropdownAdapter = this.options.get('dropdownAdapter'); this.dropdown = new DropdownAdapter($element, this.options); this.$dropdown = this.dropdown.render(); this.dropdown.position(this.$dropdown, $container); var ResultsAdapter = this.options.get('resultsAdapter'); this.results = new ResultsAdapter($element, this.options, this.dataAdapter); this.$results = this.results.render(); this.results.position(this.$results, this.$dropdown); // Bind events var self = this; // Bind the container to all of the adapters this._bindAdapters(); // Register any DOM event handlers this._registerDomEvents(); // Register any internal event handlers this._registerDataEvents(); this._registerSelectionEvents(); this._registerDropdownEvents(); this._registerResultsEvents(); this._registerEvents(); // Set the initial state this.dataAdapter.current(function (initialData) { self.trigger('selection:update', { data: initialData }); }); // Hide the original select $element.addClass('select2-hidden-accessible'); $element.attr('aria-hidden', 'true'); // Synchronize any monitored attributes this._syncAttributes(); Utils.StoreData($element[0], 'select2', this); // Ensure backwards compatibility with $element.data('select2'). $element.data('select2', this); }; Utils.Extend(Select2, Utils.Observable); Select2.prototype._generateId = function ($element) { var id = ''; if ($element.attr('id') != null) { id = $element.attr('id'); } else if ($element.attr('name') != null) { id = $element.attr('name') + '-' + Utils.generateChars(2); } else { id = Utils.generateChars(4); } id = id.replace(/(:|\.|\[|\]|,)/g, ''); id = 'select2-' + id; return id; }; Select2.prototype._placeContainer = function ($container) { $container.insertAfter(this.$element); var width = this._resolveWidth(this.$element, this.options.get('width')); if (width != null) { $container.css('width', width); } }; Select2.prototype._resolveWidth = function ($element, method) { var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; if (method == 'resolve') { var styleWidth = this._resolveWidth($element, 'style'); if (styleWidth != null) { return styleWidth; } return this._resolveWidth($element, 'element'); } if (method == 'element') { var elementWidth = $element.outerWidth(false); if (elementWidth <= 0) { return 'auto'; } return elementWidth + 'px'; } if (method == 'style') { var style = $element.attr('style'); if (typeof(style) !== 'string') { return null; } var attrs = style.split(';'); for (var i = 0, l = attrs.length; i < l; i = i + 1) { var attr = attrs[i].replace(/\s/g, ''); var matches = attr.match(WIDTH); if (matches !== null && matches.length >= 1) { return matches[1]; } } return null; } if (method == 'computedstyle') { var computedStyle = window.getComputedStyle($element[0]); return computedStyle.width; } return method; }; Select2.prototype._bindAdapters = function () { this.dataAdapter.bind(this, this.$container); this.selection.bind(this, this.$container); this.dropdown.bind(this, this.$container); this.results.bind(this, this.$container); }; Select2.prototype._registerDomEvents = function () { var self = this; this.$element.on('change.select2', function () { self.dataAdapter.current(function (data) { self.trigger('selection:update', { data: data }); }); }); this.$element.on('focus.select2', function (evt) { self.trigger('focus', evt); }); this._syncA = Utils.bind(this._syncAttributes, this); this._syncS = Utils.bind(this._syncSubtree, this); if (this.$element[0].attachEvent) { this.$element[0].attachEvent('onpropertychange', this._syncA); } var observer = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver ; if (observer != null) { this._observer = new observer(function (mutations) { self._syncA(); self._syncS(null, mutations); }); this._observer.observe(this.$element[0], { attributes: true, childList: true, subtree: false }); } else if (this.$element[0].addEventListener) { this.$element[0].addEventListener( 'DOMAttrModified', self._syncA, false ); this.$element[0].addEventListener( 'DOMNodeInserted', self._syncS, false ); this.$element[0].addEventListener( 'DOMNodeRemoved', self._syncS, false ); } }; Select2.prototype._registerDataEvents = function () { var self = this; this.dataAdapter.on('*', function (name, params) { self.trigger(name, params); }); }; Select2.prototype._registerSelectionEvents = function () { var self = this; var nonRelayEvents = ['toggle', 'focus']; this.selection.on('toggle', function () { self.toggleDropdown(); }); this.selection.on('focus', function (params) { self.focus(params); }); this.selection.on('*', function (name, params) { if ($.inArray(name, nonRelayEvents) !== -1) { return; } self.trigger(name, params); }); }; Select2.prototype._registerDropdownEvents = function () { var self = this; this.dropdown.on('*', function (name, params) { self.trigger(name, params); }); }; Select2.prototype._registerResultsEvents = function () { var self = this; this.results.on('*', function (name, params) { self.trigger(name, params); }); }; Select2.prototype._registerEvents = function () { var self = this; this.on('open', function () { self.$container.addClass('select2-container--open'); }); this.on('close', function () { self.$container.removeClass('select2-container--open'); }); this.on('enable', function () { self.$container.removeClass('select2-container--disabled'); }); this.on('disable', function () { self.$container.addClass('select2-container--disabled'); }); this.on('blur', function () { self.$container.removeClass('select2-container--focus'); }); this.on('query', function (params) { if (!self.isOpen()) { self.trigger('open', {}); } this.dataAdapter.query(params, function (data) { self.trigger('results:all', { data: data, query: params }); }); }); this.on('query:append', function (params) { this.dataAdapter.query(params, function (data) { self.trigger('results:append', { data: data, query: params }); }); }); this.on('keypress', function (evt) { var key = evt.which; if (self.isOpen()) { if (key === KEYS.ESC || key === KEYS.TAB || (key === KEYS.UP && evt.altKey)) { self.close(evt); evt.preventDefault(); } else if (key === KEYS.ENTER) { self.trigger('results:select', {}); evt.preventDefault(); } else if ((key === KEYS.SPACE && evt.ctrlKey)) { self.trigger('results:toggle', {}); evt.preventDefault(); } else if (key === KEYS.UP) { self.trigger('results:previous', {}); evt.preventDefault(); } else if (key === KEYS.DOWN) { self.trigger('results:next', {}); evt.preventDefault(); } } else { if (key === KEYS.ENTER || key === KEYS.SPACE || (key === KEYS.DOWN && evt.altKey)) { self.open(); evt.preventDefault(); } } }); }; Select2.prototype._syncAttributes = function () { this.options.set('disabled', this.$element.prop('disabled')); if (this.isDisabled()) { if (this.isOpen()) { this.close(); } this.trigger('disable', {}); } else { this.trigger('enable', {}); } }; Select2.prototype._isChangeMutation = function (evt, mutations) { var changed = false; var self = this; // Ignore any mutation events raised for elements that aren't options or // optgroups. This handles the case when the select element is destroyed if ( evt && evt.target && ( evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP' ) ) { return; } if (!mutations) { // If mutation events aren't supported, then we can only assume that the // change affected the selections changed = true; } else if (mutations.addedNodes && mutations.addedNodes.length > 0) { for (var n = 0; n < mutations.addedNodes.length; n++) { var node = mutations.addedNodes[n]; if (node.selected) { changed = true; } } } else if (mutations.removedNodes && mutations.removedNodes.length > 0) { changed = true; } else if ($.isArray(mutations)) { $.each(mutations, function(evt, mutation) { if (self._isChangeMutation(evt, mutation)) { // We've found a change mutation. // Let's escape from the loop and continue changed = true; return false; } }); } return changed; }; Select2.prototype._syncSubtree = function (evt, mutations) { var changed = this._isChangeMutation(evt, mutations); var self = this; // Only re-pull the data if we think there is a change if (changed) { this.dataAdapter.current(function (currentData) { self.trigger('selection:update', { data: currentData }); }); } }; /** * Override the trigger method to automatically trigger pre-events when * there are events that can be prevented. */ Select2.prototype.trigger = function (name, args) { var actualTrigger = Select2.__super__.trigger; var preTriggerMap = { 'open': 'opening', 'close': 'closing', 'select': 'selecting', 'unselect': 'unselecting', 'clear': 'clearing' }; if (args === undefined) { args = {}; } if (name in preTriggerMap) { var preTriggerName = preTriggerMap[name]; var preTriggerArgs = { prevented: false, name: name, args: args }; actualTrigger.call(this, preTriggerName, preTriggerArgs); if (preTriggerArgs.prevented) { args.prevented = true; return; } } actualTrigger.call(this, name, args); }; Select2.prototype.toggleDropdown = function () { if (this.isDisabled()) { return; } if (this.isOpen()) { this.close(); } else { this.open(); } }; Select2.prototype.open = function () { if (this.isOpen()) { return; } if (this.isDisabled()) { return; } this.trigger('query', {}); }; Select2.prototype.close = function (evt) { if (!this.isOpen()) { return; } this.trigger('close', { originalEvent : evt }); }; /** * Helper method to abstract the "enabled" (not "disabled") state of this * object. * * @return {true} if the instance is not disabled. * @return {false} if the instance is disabled. */ Select2.prototype.isEnabled = function () { return !this.isDisabled(); }; /** * Helper method to abstract the "disabled" state of this object. * * @return {true} if the disabled option is true. * @return {false} if the disabled option is false. */ Select2.prototype.isDisabled = function () { return this.options.get('disabled'); }; Select2.prototype.isOpen = function () { return this.$container.hasClass('select2-container--open'); }; Select2.prototype.hasFocus = function () { return this.$container.hasClass('select2-container--focus'); }; Select2.prototype.focus = function (data) { // No need to re-trigger focus events if we are already focused if (this.hasFocus()) { return; } this.$container.addClass('select2-container--focus'); this.trigger('focus', {}); }; Select2.prototype.enable = function (args) { if (this.options.get('debug') && window.console && console.warn) { console.warn( 'Select2: The `select2("enable")` method has been deprecated and will' + ' be removed in later Select2 versions. Use $element.prop("disabled")' + ' instead.' ); } if (args == null || args.length === 0) { args = [true]; } var disabled = !args[0]; this.$element.prop('disabled', disabled); }; Select2.prototype.data = function () { if (this.options.get('debug') && arguments.length > 0 && window.console && console.warn) { console.warn( 'Select2: Data can no longer be set using `select2("data")`. You ' + 'should consider setting the value instead using `$element.val()`.' ); } var data = []; this.dataAdapter.current(function (currentData) { data = currentData; }); return data; }; Select2.prototype.val = function (args) { if (this.options.get('debug') && window.console && console.warn) { console.warn( 'Select2: The `select2("val")` method has been deprecated and will be' + ' removed in later Select2 versions. Use $element.val() instead.' ); } if (args == null || args.length === 0) { return this.$element.val(); } var newVal = args[0]; if ($.isArray(newVal)) { newVal = $.map(newVal, function (obj) { return obj.toString(); }); } this.$element.val(newVal).trigger('input').trigger('change'); }; Select2.prototype.destroy = function () { this.$container.remove(); if (this.$element[0].detachEvent) { this.$element[0].detachEvent('onpropertychange', this._syncA); } if (this._observer != null) { this._observer.disconnect(); this._observer = null; } else if (this.$element[0].removeEventListener) { this.$element[0] .removeEventListener('DOMAttrModified', this._syncA, false); this.$element[0] .removeEventListener('DOMNodeInserted', this._syncS, false); this.$element[0] .removeEventListener('DOMNodeRemoved', this._syncS, false); } this._syncA = null; this._syncS = null; this.$element.off('.select2'); this.$element.attr('tabindex', Utils.GetData(this.$element[0], 'old-tabindex')); this.$element.removeClass('select2-hidden-accessible'); this.$element.attr('aria-hidden', 'false'); Utils.RemoveData(this.$element[0]); this.$element.removeData('select2'); this.dataAdapter.destroy(); this.selection.destroy(); this.dropdown.destroy(); this.results.destroy(); this.dataAdapter = null; this.selection = null; this.dropdown = null; this.results = null; }; Select2.prototype.render = function () { var $container = $( '<span class="select2 select2-container">' + '<span class="selection"></span>' + '<span class="dropdown-wrapper" aria-hidden="true"></span>' + '</span>' ); $container.attr('dir', this.options.get('dir')); this.$container = $container; this.$container.addClass('select2-container--' + this.options.get('theme')); Utils.StoreData($container[0], 'element', this.$element); return $container; }; return Select2; }); S2.define('jquery-mousewheel',[ 'jquery' ], function ($) { // Used to shim jQuery.mousewheel for non-full builds. return $; }); S2.define('jquery.select2',[ 'jquery', 'jquery-mousewheel', './select2/core', './select2/defaults', './select2/utils' ], function ($, _, Select2, Defaults, Utils) { if ($.fn.select2 == null) { // All methods that should return the element var thisMethods = ['open', 'close', 'destroy']; $.fn.select2 = function (options) { options = options || {}; if (typeof options === 'object') { this.each(function () { var instanceOptions = $.extend(true, {}, options); var instance = new Select2($(this), instanceOptions); }); return this; } else if (typeof options === 'string') { var ret; var args = Array.prototype.slice.call(arguments, 1); this.each(function () { var instance = Utils.GetData(this, 'select2'); if (instance == null && window.console && console.error) { console.error( 'The select2(\'' + options + '\') method was called on an ' + 'element that is not using Select2.' ); } ret = instance[options].apply(instance, args); }); // Check if we should be returning `this` if ($.inArray(options, thisMethods) > -1) { return this; } return ret; } else { throw new Error('Invalid arguments for Select2: ' + options); } }; } if ($.fn.select2.defaults == null) { $.fn.select2.defaults = Defaults; } return Select2; }); // Return the AMD loader configuration so it can be used outside of this file return { define: S2.define, require: S2.require }; }()); // Autoload the jQuery bindings // We know that all of the modules exist above this, so we're safe var select2 = S2.require('jquery.select2'); // Hold the AMD module references on the jQuery function that was just loaded // This allows Select2 to use the internal loader outside of this file, such // as in the language files. jQuery.fn.select2.amd = S2; // Return the Select2 instance for anyone who is importing it. return select2; })); /***/ }, /***/ 4504 /*!*************************************************!*\ !*** ./node_modules/tippy.js/dist/tippy.esm.js ***! \*************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ animateFill: () => (/* binding */ animateFill), /* harmony export */ createSingleton: () => (/* binding */ createSingleton), /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), /* harmony export */ delegate: () => (/* binding */ delegate), /* harmony export */ followCursor: () => (/* binding */ followCursor), /* harmony export */ hideAll: () => (/* binding */ hideAll), /* harmony export */ inlinePositioning: () => (/* binding */ inlinePositioning), /* harmony export */ roundArrow: () => (/* binding */ ROUND_ARROW), /* harmony export */ sticky: () => (/* binding */ sticky) /* harmony export */ }); /* harmony import */ var _popperjs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @popperjs/core */ 1576); /**! * tippy.js v6.2.6 * (c) 2017-2020 atomiks * MIT License */ var ROUND_ARROW = '<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>'; var BOX_CLASS = "tippy-box"; var CONTENT_CLASS = "tippy-content"; var BACKDROP_CLASS = "tippy-backdrop"; var ARROW_CLASS = "tippy-arrow"; var SVG_ARROW_CLASS = "tippy-svg-arrow"; var TOUCH_OPTIONS = { passive: true, capture: true }; function hasOwnProperty(obj, key) { return {}.hasOwnProperty.call(obj, key); } function getValueAtIndexOrReturn(value, index, defaultValue) { if (Array.isArray(value)) { var v = value[index]; return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v; } return value; } function isType(value, type) { var str = {}.toString.call(value); return str.indexOf('[object') === 0 && str.indexOf(type + "]") > -1; } function invokeWithArgsOrReturn(value, args) { return typeof value === 'function' ? value.apply(void 0, args) : value; } function debounce(fn, ms) { // Avoid wrapping in `setTimeout` if ms is 0 anyway if (ms === 0) { return fn; } var timeout; return function (arg) { clearTimeout(timeout); timeout = setTimeout(function () { fn(arg); }, ms); }; } function removeProperties(obj, keys) { var clone = Object.assign({}, obj); keys.forEach(function (key) { delete clone[key]; }); return clone; } function splitBySpaces(value) { return value.split(/\s+/).filter(Boolean); } function normalizeToArray(value) { return [].concat(value); } function pushIfUnique(arr, value) { if (arr.indexOf(value) === -1) { arr.push(value); } } function unique(arr) { return arr.filter(function (item, index) { return arr.indexOf(item) === index; }); } function getBasePlacement(placement) { return placement.split('-')[0]; } function arrayFrom(value) { return [].slice.call(value); } function removeUndefinedProps(obj) { return Object.keys(obj).reduce(function (acc, key) { if (obj[key] !== undefined) { acc[key] = obj[key]; } return acc; }, {}); } function div() { return document.createElement('div'); } function isElement(value) { return ['Element', 'Fragment'].some(function (type) { return isType(value, type); }); } function isNodeList(value) { return isType(value, 'NodeList'); } function isMouseEvent(value) { return isType(value, 'MouseEvent'); } function isReferenceElement(value) { return !!(value && value._tippy && value._tippy.reference === value); } function getArrayOfElements(value) { if (isElement(value)) { return [value]; } if (isNodeList(value)) { return arrayFrom(value); } if (Array.isArray(value)) { return value; } return arrayFrom(document.querySelectorAll(value)); } function setTransitionDuration(els, value) { els.forEach(function (el) { if (el) { el.style.transitionDuration = value + "ms"; } }); } function setVisibilityState(els, state) { els.forEach(function (el) { if (el) { el.setAttribute('data-state', state); } }); } function getOwnerDocument(elementOrElements) { var _normalizeToArray = normalizeToArray(elementOrElements), element = _normalizeToArray[0]; return element ? element.ownerDocument || document : document; } function isCursorOutsideInteractiveBorder(popperTreeData, event) { var clientX = event.clientX, clientY = event.clientY; return popperTreeData.every(function (_ref) { var popperRect = _ref.popperRect, popperState = _ref.popperState, props = _ref.props; var interactiveBorder = props.interactiveBorder; var basePlacement = getBasePlacement(popperState.placement); var offsetData = popperState.modifiersData.offset; if (!offsetData) { return true; } var topDistance = basePlacement === 'bottom' ? offsetData.top.y : 0; var bottomDistance = basePlacement === 'top' ? offsetData.bottom.y : 0; var leftDistance = basePlacement === 'right' ? offsetData.left.x : 0; var rightDistance = basePlacement === 'left' ? offsetData.right.x : 0; var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder; var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder; var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder; var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder; return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight; }); } function updateTransitionEndListener(box, action, listener) { var method = action + "EventListener"; // some browsers apparently support `transition` (unprefixed) but only fire // `webkitTransitionEnd`... ['transitionend', 'webkitTransitionEnd'].forEach(function (event) { box[method](event, listener); }); } var currentInput = { isTouch: false }; var lastMouseMoveTime = 0; /** * When a `touchstart` event is fired, it's assumed the user is using touch * input. We'll bind a `mousemove` event listener to listen for mouse input in * the future. This way, the `isTouch` property is fully dynamic and will handle * hybrid devices that use a mix of touch + mouse input. */ function onDocumentTouchStart() { if (currentInput.isTouch) { return; } currentInput.isTouch = true; if (window.performance) { document.addEventListener('mousemove', onDocumentMouseMove); } } /** * When two `mousemove` event are fired consecutively within 20ms, it's assumed * the user is using mouse input again. `mousemove` can fire on touch devices as * well, but very rarely that quickly. */ function onDocumentMouseMove() { var now = performance.now(); if (now - lastMouseMoveTime < 20) { currentInput.isTouch = false; document.removeEventListener('mousemove', onDocumentMouseMove); } lastMouseMoveTime = now; } /** * When an element is in focus and has a tippy, leaving the tab/window and * returning causes it to show again. For mouse users this is unexpected, but * for keyboard use it makes sense. * TODO: find a better technique to solve this problem */ function onWindowBlur() { var activeElement = document.activeElement; if (isReferenceElement(activeElement)) { var instance = activeElement._tippy; if (activeElement.blur && !instance.state.isVisible) { activeElement.blur(); } } } function bindGlobalEventListeners() { document.addEventListener('touchstart', onDocumentTouchStart, TOUCH_OPTIONS); window.addEventListener('blur', onWindowBlur); } var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'; var ua = isBrowser ? navigator.userAgent : ''; var isIE = /MSIE |Trident\//.test(ua); function createMemoryLeakWarning(method) { var txt = method === 'destroy' ? 'n already-' : ' '; return [method + "() was called on a" + txt + "destroyed instance. This is a no-op but", 'indicates a potential memory leak.'].join(' '); } function clean(value) { var spacesAndTabs = /[ \t]{2,}/g; var lineStartWithSpaces = /^[ \t]*/gm; return value.replace(spacesAndTabs, ' ').replace(lineStartWithSpaces, '').trim(); } function getDevMessage(message) { return clean("\n %ctippy.js\n\n %c" + clean(message) + "\n\n %c\uD83D\uDC77\u200D This is a development-only message. It will be removed in production.\n "); } function getFormattedMessage(message) { return [getDevMessage(message), // title 'color: #00C584; font-size: 1.3em; font-weight: bold;', // message 'line-height: 1.5', // footer 'color: #a6a095;']; } // Assume warnings and errors never have the same message var visitedMessages; if (true) { resetVisitedMessages(); } function resetVisitedMessages() { visitedMessages = new Set(); } function warnWhen(condition, message) { if (condition && !visitedMessages.has(message)) { var _console; visitedMessages.add(message); (_console = console).warn.apply(_console, getFormattedMessage(message)); } } function errorWhen(condition, message) { if (condition && !visitedMessages.has(message)) { var _console2; visitedMessages.add(message); (_console2 = console).error.apply(_console2, getFormattedMessage(message)); } } function validateTargets(targets) { var didPassFalsyValue = !targets; var didPassPlainObject = Object.prototype.toString.call(targets) === '[object Object]' && !targets.addEventListener; errorWhen(didPassFalsyValue, ['tippy() was passed', '`' + String(targets) + '`', 'as its targets (first) argument. Valid types are: String, Element,', 'Element[], or NodeList.'].join(' ')); errorWhen(didPassPlainObject, ['tippy() was passed a plain object which is not supported as an argument', 'for virtual positioning. Use props.getReferenceClientRect instead.'].join(' ')); } var pluginProps = { animateFill: false, followCursor: false, inlinePositioning: false, sticky: false }; var renderProps = { allowHTML: false, animation: 'fade', arrow: true, content: '', inertia: false, maxWidth: 350, role: 'tooltip', theme: '', zIndex: 9999 }; var defaultProps = Object.assign({ appendTo: function appendTo() { return document.body; }, aria: { content: 'auto', expanded: 'auto' }, delay: 0, duration: [300, 250], getReferenceClientRect: null, hideOnClick: true, ignoreAttributes: false, interactive: false, interactiveBorder: 2, interactiveDebounce: 0, moveTransition: '', offset: [0, 10], onAfterUpdate: function onAfterUpdate() {}, onBeforeUpdate: function onBeforeUpdate() {}, onCreate: function onCreate() {}, onDestroy: function onDestroy() {}, onHidden: function onHidden() {}, onHide: function onHide() {}, onMount: function onMount() {}, onShow: function onShow() {}, onShown: function onShown() {}, onTrigger: function onTrigger() {}, onUntrigger: function onUntrigger() {}, onClickOutside: function onClickOutside() {}, placement: 'top', plugins: [], popperOptions: {}, render: null, showOnCreate: false, touch: true, trigger: 'mouseenter focus', triggerTarget: null }, pluginProps, {}, renderProps); var defaultKeys = Object.keys(defaultProps); var setDefaultProps = function setDefaultProps(partialProps) { /* istanbul ignore else */ if (true) { validateProps(partialProps, []); } var keys = Object.keys(partialProps); keys.forEach(function (key) { defaultProps[key] = partialProps[key]; }); }; function getExtendedPassedProps(passedProps) { var plugins = passedProps.plugins || []; var pluginProps = plugins.reduce(function (acc, plugin) { var name = plugin.name, defaultValue = plugin.defaultValue; if (name) { acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue; } return acc; }, {}); return Object.assign({}, passedProps, {}, pluginProps); } function getDataAttributeProps(reference, plugins) { var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, { plugins: plugins }))) : defaultKeys; var props = propKeys.reduce(function (acc, key) { var valueAsString = (reference.getAttribute("data-tippy-" + key) || '').trim(); if (!valueAsString) { return acc; } if (key === 'content') { acc[key] = valueAsString; } else { try { acc[key] = JSON.parse(valueAsString); } catch (e) { acc[key] = valueAsString; } } return acc; }, {}); return props; } function evaluateProps(reference, props) { var out = Object.assign({}, props, { content: invokeWithArgsOrReturn(props.content, [reference]) }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins)); out.aria = Object.assign({}, defaultProps.aria, {}, out.aria); out.aria = { expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded, content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content }; return out; } function validateProps(partialProps, plugins) { if (partialProps === void 0) { partialProps = {}; } if (plugins === void 0) { plugins = []; } var keys = Object.keys(partialProps); keys.forEach(function (prop) { var nonPluginProps = removeProperties(defaultProps, Object.keys(pluginProps)); var didPassUnknownProp = !hasOwnProperty(nonPluginProps, prop); // Check if the prop exists in `plugins` if (didPassUnknownProp) { didPassUnknownProp = plugins.filter(function (plugin) { return plugin.name === prop; }).length === 0; } warnWhen(didPassUnknownProp, ["`" + prop + "`", "is not a valid prop. You may have spelled it incorrectly, or if it's", 'a plugin, forgot to pass it in an array as props.plugins.', '\n\n', 'All props: https://atomiks.github.io/tippyjs/v6/all-props/\n', 'Plugins: https://atomiks.github.io/tippyjs/v6/plugins/'].join(' ')); }); } var innerHTML = function innerHTML() { return 'innerHTML'; }; function dangerouslySetInnerHTML(element, html) { element[innerHTML()] = html; } function createArrowElement(value) { var arrow = div(); if (value === true) { arrow.className = ARROW_CLASS; } else { arrow.className = SVG_ARROW_CLASS; if (isElement(value)) { arrow.appendChild(value); } else { dangerouslySetInnerHTML(arrow, value); } } return arrow; } function setContent(content, props) { if (isElement(props.content)) { dangerouslySetInnerHTML(content, ''); content.appendChild(props.content); } else if (typeof props.content !== 'function') { if (props.allowHTML) { dangerouslySetInnerHTML(content, props.content); } else { content.textContent = props.content; } } } function getChildren(popper) { var box = popper.firstElementChild; var boxChildren = arrayFrom(box.children); return { box: box, content: boxChildren.find(function (node) { return node.classList.contains(CONTENT_CLASS); }), arrow: boxChildren.find(function (node) { return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS); }), backdrop: boxChildren.find(function (node) { return node.classList.contains(BACKDROP_CLASS); }) }; } function render(instance) { var popper = div(); var box = div(); box.className = BOX_CLASS; box.setAttribute('data-state', 'hidden'); box.setAttribute('tabindex', '-1'); var content = div(); content.className = CONTENT_CLASS; content.setAttribute('data-state', 'hidden'); setContent(content, instance.props); popper.appendChild(box); box.appendChild(content); onUpdate(instance.props, instance.props); function onUpdate(prevProps, nextProps) { var _getChildren = getChildren(popper), box = _getChildren.box, content = _getChildren.content, arrow = _getChildren.arrow; if (nextProps.theme) { box.setAttribute('data-theme', nextProps.theme); } else { box.removeAttribute('data-theme'); } if (typeof nextProps.animation === 'string') { box.setAttribute('data-animation', nextProps.animation); } else { box.removeAttribute('data-animation'); } if (nextProps.inertia) { box.setAttribute('data-inertia', ''); } else { box.removeAttribute('data-inertia'); } box.style.maxWidth = typeof nextProps.maxWidth === 'number' ? nextProps.maxWidth + "px" : nextProps.maxWidth; if (nextProps.role) { box.setAttribute('role', nextProps.role); } else { box.removeAttribute('role'); } if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) { setContent(content, instance.props); } if (nextProps.arrow) { if (!arrow) { box.appendChild(createArrowElement(nextProps.arrow)); } else if (prevProps.arrow !== nextProps.arrow) { box.removeChild(arrow); box.appendChild(createArrowElement(nextProps.arrow)); } } else if (arrow) { box.removeChild(arrow); } } return { popper: popper, onUpdate: onUpdate }; } // Runtime check to identify if the render function is the default one; this // way we can apply default CSS transitions logic and it can be tree-shaken away render.$$tippy = true; var idCounter = 1; var mouseMoveListeners = []; // Used by `hideAll()` var mountedInstances = []; function createTippy(reference, passedProps) { var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // =========================================================================== // 🔒 Private members // =========================================================================== var showTimeout; var hideTimeout; var scheduleHideAnimationFrame; var isVisibleFromClick = false; var didHideDueToDocumentMouseDown = false; var didTouchMove = false; var ignoreOnFirstUpdate = false; var lastTriggerEvent; var currentTransitionEndListener; var onFirstUpdate; var listeners = []; var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce); var currentTarget; var doc = getOwnerDocument(props.triggerTarget || reference); // =========================================================================== // 🔑 Public members // =========================================================================== var id = idCounter++; var popperInstance = null; var plugins = unique(props.plugins); var state = { // Is the instance currently enabled? isEnabled: true, // Is the tippy currently showing and not transitioning out? isVisible: false, // Has the instance been destroyed? isDestroyed: false, // Is the tippy currently mounted to the DOM? isMounted: false, // Has the tippy finished transitioning in? isShown: false }; var instance = { // properties id: id, reference: reference, popper: div(), popperInstance: popperInstance, props: props, state: state, plugins: plugins, // methods clearDelayTimeouts: clearDelayTimeouts, setProps: setProps, setContent: setContent, show: show, hide: hide, hideWithInteractivity: hideWithInteractivity, enable: enable, disable: disable, unmount: unmount, destroy: destroy }; // TODO: Investigate why this early return causes a TDZ error in the tests — // it doesn't seem to happen in the browser /* istanbul ignore if */ if (!props.render) { if (true) { errorWhen(true, 'render() function has not been supplied.'); } return instance; } // =========================================================================== // Initial mutations // =========================================================================== var _props$render = props.render(instance), popper = _props$render.popper, onUpdate = _props$render.onUpdate; popper.setAttribute('data-tippy-root', ''); popper.id = "tippy-" + instance.id; instance.popper = popper; reference._tippy = instance; popper._tippy = instance; var pluginsHooks = plugins.map(function (plugin) { return plugin.fn(instance); }); var hasAriaExpanded = reference.hasAttribute('aria-expanded'); addListeners(); handleAriaExpandedAttribute(); handleStyles(); invokeHook('onCreate', [instance]); if (props.showOnCreate) { scheduleShow(); } // Prevent a tippy with a delay from hiding if the cursor left then returned // before it started hiding popper.addEventListener('mouseenter', function () { if (instance.props.interactive && instance.state.isVisible) { instance.clearDelayTimeouts(); } }); popper.addEventListener('mouseleave', function (event) { if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) { doc.addEventListener('mousemove', debouncedOnMouseMove); debouncedOnMouseMove(event); } }); return instance; // =========================================================================== // 🔒 Private methods // =========================================================================== function getNormalizedTouchSettings() { var touch = instance.props.touch; return Array.isArray(touch) ? touch : [touch, 0]; } function getIsCustomTouchBehavior() { return getNormalizedTouchSettings()[0] === 'hold'; } function getIsDefaultRenderFn() { var _instance$props$rende; // @ts-ignore return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy); } function getCurrentTarget() { return currentTarget || reference; } function getDefaultTemplateChildren() { return getChildren(popper); } function getDelay(isShow) { // For touch or keyboard input, force `0` delay for UX reasons // Also if the instance is mounted but not visible (transitioning out), // ignore delay if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === 'focus') { return 0; } return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay); } function handleStyles() { popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none'; popper.style.zIndex = "" + instance.props.zIndex; } function invokeHook(hook, args, shouldInvokePropsHook) { if (shouldInvokePropsHook === void 0) { shouldInvokePropsHook = true; } pluginsHooks.forEach(function (pluginHooks) { if (pluginHooks[hook]) { pluginHooks[hook].apply(void 0, args); } }); if (shouldInvokePropsHook) { var _instance$props; (_instance$props = instance.props)[hook].apply(_instance$props, args); } } function handleAriaContentAttribute() { var aria = instance.props.aria; if (!aria.content) { return; } var attr = "aria-" + aria.content; var id = popper.id; var nodes = normalizeToArray(instance.props.triggerTarget || reference); nodes.forEach(function (node) { var currentValue = node.getAttribute(attr); if (instance.state.isVisible) { node.setAttribute(attr, currentValue ? currentValue + " " + id : id); } else { var nextValue = currentValue && currentValue.replace(id, '').trim(); if (nextValue) { node.setAttribute(attr, nextValue); } else { node.removeAttribute(attr); } } }); } function handleAriaExpandedAttribute() { if (hasAriaExpanded || !instance.props.aria.expanded) { return; } var nodes = normalizeToArray(instance.props.triggerTarget || reference); nodes.forEach(function (node) { if (instance.props.interactive) { node.setAttribute('aria-expanded', instance.state.isVisible && node === getCurrentTarget() ? 'true' : 'false'); } else { node.removeAttribute('aria-expanded'); } }); } function cleanupInteractiveMouseListeners() { doc.removeEventListener('mousemove', debouncedOnMouseMove); mouseMoveListeners = mouseMoveListeners.filter(function (listener) { return listener !== debouncedOnMouseMove; }); } function onDocumentPress(event) { // Moved finger to scroll instead of an intentional tap outside if (currentInput.isTouch) { if (didTouchMove || event.type === 'mousedown') { return; } } // Clicked on interactive popper if (instance.props.interactive && popper.contains(event.target)) { return; } // Clicked on the event listeners target if (getCurrentTarget().contains(event.target)) { if (currentInput.isTouch) { return; } if (instance.state.isVisible && instance.props.trigger.indexOf('click') >= 0) { return; } } else { invokeHook('onClickOutside', [instance, event]); } if (instance.props.hideOnClick === true) { instance.clearDelayTimeouts(); instance.hide(); // `mousedown` event is fired right before `focus` if pressing the // currentTarget. This lets a tippy with `focus` trigger know that it // should not show didHideDueToDocumentMouseDown = true; setTimeout(function () { didHideDueToDocumentMouseDown = false; }); // The listener gets added in `scheduleShow()`, but this may be hiding it // before it shows, and hide()'s early bail-out behavior can prevent it // from being cleaned up if (!instance.state.isMounted) { removeDocumentPress(); } } } function onTouchMove() { didTouchMove = true; } function onTouchStart() { didTouchMove = false; } function addDocumentPress() { doc.addEventListener('mousedown', onDocumentPress, true); doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS); doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS); doc.addEventListener('touchmove', onTouchMove, TOUCH_OPTIONS); } function removeDocumentPress() { doc.removeEventListener('mousedown', onDocumentPress, true); doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS); doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS); doc.removeEventListener('touchmove', onTouchMove, TOUCH_OPTIONS); } function onTransitionedOut(duration, callback) { onTransitionEnd(duration, function () { if (!instance.state.isVisible && popper.parentNode && popper.parentNode.contains(popper)) { callback(); } }); } function onTransitionedIn(duration, callback) { onTransitionEnd(duration, callback); } function onTransitionEnd(duration, callback) { var box = getDefaultTemplateChildren().box; function listener(event) { if (event.target === box) { updateTransitionEndListener(box, 'remove', listener); callback(); } } // Make callback synchronous if duration is 0 // `transitionend` won't fire otherwise if (duration === 0) { return callback(); } updateTransitionEndListener(box, 'remove', currentTransitionEndListener); updateTransitionEndListener(box, 'add', listener); currentTransitionEndListener = listener; } function on(eventType, handler, options) { if (options === void 0) { options = false; } var nodes = normalizeToArray(instance.props.triggerTarget || reference); nodes.forEach(function (node) { node.addEventListener(eventType, handler, options); listeners.push({ node: node, eventType: eventType, handler: handler, options: options }); }); } function addListeners() { if (getIsCustomTouchBehavior()) { on('touchstart', onTrigger, { passive: true }); on('touchend', onMouseLeave, { passive: true }); } splitBySpaces(instance.props.trigger).forEach(function (eventType) { if (eventType === 'manual') { return; } on(eventType, onTrigger); switch (eventType) { case 'mouseenter': on('mouseleave', onMouseLeave); break; case 'focus': on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut); break; case 'focusin': on('focusout', onBlurOrFocusOut); break; } }); } function removeListeners() { listeners.forEach(function (_ref) { var node = _ref.node, eventType = _ref.eventType, handler = _ref.handler, options = _ref.options; node.removeEventListener(eventType, handler, options); }); listeners = []; } function onTrigger(event) { var _lastTriggerEvent; var shouldScheduleClickHide = false; if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) { return; } var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === 'focus'; lastTriggerEvent = event; currentTarget = event.currentTarget; handleAriaExpandedAttribute(); if (!instance.state.isVisible && isMouseEvent(event)) { // If scrolling, `mouseenter` events can be fired if the cursor lands // over a new target, but `mousemove` events don't get fired. This // causes interactive tooltips to get stuck open until the cursor is // moved mouseMoveListeners.forEach(function (listener) { return listener(event); }); } // Toggle show/hide when clicking click-triggered tooltips if (event.type === 'click' && (instance.props.trigger.indexOf('mouseenter') < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) { shouldScheduleClickHide = true; } else { scheduleShow(event); } if (event.type === 'click') { isVisibleFromClick = !shouldScheduleClickHide; } if (shouldScheduleClickHide && !wasFocused) { scheduleHide(event); } } function onMouseMove(event) { var target = event.target; var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target); if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) { return; } var popperTreeData = getNestedPopperTree().concat(popper).map(function (popper) { var _instance$popperInsta; var instance = popper._tippy; var state = (_instance$popperInsta = instance.popperInstance) == null ? void 0 : _instance$popperInsta.state; if (state) { return { popperRect: popper.getBoundingClientRect(), popperState: state, props: props }; } return null; }).filter(Boolean); if (isCursorOutsideInteractiveBorder(popperTreeData, event)) { cleanupInteractiveMouseListeners(); scheduleHide(event); } } function onMouseLeave(event) { var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf('click') >= 0 && isVisibleFromClick; if (shouldBail) { return; } if (instance.props.interactive) { instance.hideWithInteractivity(event); return; } scheduleHide(event); } function onBlurOrFocusOut(event) { if (instance.props.trigger.indexOf('focusin') < 0 && event.target !== getCurrentTarget()) { return; } // If focus was moved to within the popper if (instance.props.interactive && event.relatedTarget && popper.contains(event.relatedTarget)) { return; } scheduleHide(event); } function isEventListenerStopped(event) { return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf('touch') >= 0 : false; } function createPopperInstance() { destroyPopperInstance(); var _instance$props2 = instance.props, popperOptions = _instance$props2.popperOptions, placement = _instance$props2.placement, offset = _instance$props2.offset, getReferenceClientRect = _instance$props2.getReferenceClientRect, moveTransition = _instance$props2.moveTransition; var arrow = getIsDefaultRenderFn() ? getChildren(popper).arrow : null; var computedReference = getReferenceClientRect ? { getBoundingClientRect: getReferenceClientRect, contextElement: getReferenceClientRect.contextElement || getCurrentTarget() } : reference; var tippyModifier = { name: '$$tippy', enabled: true, phase: 'beforeWrite', requires: ['computeStyles'], fn: function fn(_ref2) { var state = _ref2.state; if (getIsDefaultRenderFn()) { var _getDefaultTemplateCh = getDefaultTemplateChildren(), box = _getDefaultTemplateCh.box; ['placement', 'reference-hidden', 'escaped'].forEach(function (attr) { if (attr === 'placement') { box.setAttribute('data-placement', state.placement); } else { if (state.attributes.popper["data-popper-" + attr]) { box.setAttribute("data-" + attr, ''); } else { box.removeAttribute("data-" + attr); } } }); state.attributes.popper = {}; } } }; var modifiers = [{ name: 'offset', options: { offset: offset } }, { name: 'preventOverflow', options: { padding: { top: 2, bottom: 2, left: 5, right: 5 } } }, { name: 'flip', options: { padding: 5 } }, { name: 'computeStyles', options: { adaptive: !moveTransition } }, tippyModifier]; if (getIsDefaultRenderFn() && arrow) { modifiers.push({ name: 'arrow', options: { element: arrow, padding: 3 } }); } modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []); instance.popperInstance = (0,_popperjs_core__WEBPACK_IMPORTED_MODULE_0__.createPopper)(computedReference, popper, Object.assign({}, popperOptions, { placement: placement, onFirstUpdate: onFirstUpdate, modifiers: modifiers })); } function destroyPopperInstance() { if (instance.popperInstance) { instance.popperInstance.destroy(); instance.popperInstance = null; } } function mount() { var appendTo = instance.props.appendTo; var parentNode; // By default, we'll append the popper to the triggerTargets's parentNode so // it's directly after the reference element so the elements inside the // tippy can be tabbed to // If there are clipping issues, the user can specify a different appendTo // and ensure focus management is handled correctly manually var node = getCurrentTarget(); if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') { parentNode = node.parentNode; } else { parentNode = invokeWithArgsOrReturn(appendTo, [node]); } // The popper element needs to exist on the DOM before its position can be // updated as Popper needs to read its dimensions if (!parentNode.contains(popper)) { parentNode.appendChild(popper); } createPopperInstance(); /* istanbul ignore else */ if (true) { // Accessibility check warnWhen(instance.props.interactive && appendTo === defaultProps.appendTo && node.nextElementSibling !== popper, ['Interactive tippy element may not be accessible via keyboard', 'navigation because it is not directly after the reference element', 'in the DOM source order.', '\n\n', 'Using a wrapper <div> or <span> tag around the reference element', 'solves this by creating a new parentNode context.', '\n\n', 'Specifying `appendTo: document.body` silences this warning, but it', 'assumes you are using a focus management solution to handle', 'keyboard navigation.', '\n\n', 'See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity'].join(' ')); } } function getNestedPopperTree() { return arrayFrom(popper.querySelectorAll('[data-tippy-root]')); } function scheduleShow(event) { instance.clearDelayTimeouts(); if (event) { invokeHook('onTrigger', [instance, event]); } addDocumentPress(); var delay = getDelay(true); var _getNormalizedTouchSe = getNormalizedTouchSettings(), touchValue = _getNormalizedTouchSe[0], touchDelay = _getNormalizedTouchSe[1]; if (currentInput.isTouch && touchValue === 'hold' && touchDelay) { delay = touchDelay; } if (delay) { showTimeout = setTimeout(function () { instance.show(); }, delay); } else { instance.show(); } } function scheduleHide(event) { instance.clearDelayTimeouts(); invokeHook('onUntrigger', [instance, event]); if (!instance.state.isVisible) { removeDocumentPress(); return; } // For interactive tippies, scheduleHide is added to a document.body handler // from onMouseLeave so must intercept scheduled hides from mousemove/leave // events when trigger contains mouseenter and click, and the tip is // currently shown as a result of a click. if (instance.props.trigger.indexOf('mouseenter') >= 0 && instance.props.trigger.indexOf('click') >= 0 && ['mouseleave', 'mousemove'].indexOf(event.type) >= 0 && isVisibleFromClick) { return; } var delay = getDelay(false); if (delay) { hideTimeout = setTimeout(function () { if (instance.state.isVisible) { instance.hide(); } }, delay); } else { // Fixes a `transitionend` problem when it fires 1 frame too // late sometimes, we don't want hide() to be called. scheduleHideAnimationFrame = requestAnimationFrame(function () { instance.hide(); }); } } // =========================================================================== // 🔑 Public methods // =========================================================================== function enable() { instance.state.isEnabled = true; } function disable() { // Disabling the instance should also hide it // https://github.com/atomiks/tippy.js-react/issues/106 instance.hide(); instance.state.isEnabled = false; } function clearDelayTimeouts() { clearTimeout(showTimeout); clearTimeout(hideTimeout); cancelAnimationFrame(scheduleHideAnimationFrame); } function setProps(partialProps) { /* istanbul ignore else */ if (true) { warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('setProps')); } if (instance.state.isDestroyed) { return; } invokeHook('onBeforeUpdate', [instance, partialProps]); removeListeners(); var prevProps = instance.props; var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, { ignoreAttributes: true })); instance.props = nextProps; addListeners(); if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) { cleanupInteractiveMouseListeners(); debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce); } // Ensure stale aria-expanded attributes are removed if (prevProps.triggerTarget && !nextProps.triggerTarget) { normalizeToArray(prevProps.triggerTarget).forEach(function (node) { node.removeAttribute('aria-expanded'); }); } else if (nextProps.triggerTarget) { reference.removeAttribute('aria-expanded'); } handleAriaExpandedAttribute(); handleStyles(); if (onUpdate) { onUpdate(prevProps, nextProps); } if (instance.popperInstance) { createPopperInstance(); // Fixes an issue with nested tippies if they are all getting re-rendered, // and the nested ones get re-rendered first. // https://github.com/atomiks/tippyjs-react/issues/177 // TODO: find a cleaner / more efficient solution(!) getNestedPopperTree().forEach(function (nestedPopper) { // React (and other UI libs likely) requires a rAF wrapper as it flushes // its work in one requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate); }); } invokeHook('onAfterUpdate', [instance, partialProps]); } function setContent(content) { instance.setProps({ content: content }); } function show() { /* istanbul ignore else */ if (true) { warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('show')); } // Early bail-out var isAlreadyVisible = instance.state.isVisible; var isDestroyed = instance.state.isDestroyed; var isDisabled = !instance.state.isEnabled; var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch; var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration); if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) { return; } // Normalize `disabled` behavior across browsers. // Firefox allows events on disabled elements, but Chrome doesn't. // Using a wrapper element (i.e. <span>) is recommended. if (getCurrentTarget().hasAttribute('disabled')) { return; } invokeHook('onShow', [instance], false); if (instance.props.onShow(instance) === false) { return; } instance.state.isVisible = true; if (getIsDefaultRenderFn()) { popper.style.visibility = 'visible'; } handleStyles(); addDocumentPress(); if (!instance.state.isMounted) { popper.style.transition = 'none'; } // If flipping to the opposite side after hiding at least once, the // animation will use the wrong placement without resetting the duration if (getIsDefaultRenderFn()) { var _getDefaultTemplateCh2 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh2.box, content = _getDefaultTemplateCh2.content; setTransitionDuration([box, content], 0); } onFirstUpdate = function onFirstUpdate() { if (!instance.state.isVisible || ignoreOnFirstUpdate) { return; } ignoreOnFirstUpdate = true; // reflow void popper.offsetHeight; popper.style.transition = instance.props.moveTransition; if (getIsDefaultRenderFn() && instance.props.animation) { var _getDefaultTemplateCh3 = getDefaultTemplateChildren(), _box = _getDefaultTemplateCh3.box, _content = _getDefaultTemplateCh3.content; setTransitionDuration([_box, _content], duration); setVisibilityState([_box, _content], 'visible'); } handleAriaContentAttribute(); handleAriaExpandedAttribute(); pushIfUnique(mountedInstances, instance); instance.state.isMounted = true; invokeHook('onMount', [instance]); if (instance.props.animation && getIsDefaultRenderFn()) { onTransitionedIn(duration, function () { instance.state.isShown = true; invokeHook('onShown', [instance]); }); } }; mount(); } function hide() { /* istanbul ignore else */ if (true) { warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hide')); } // Early bail-out var isAlreadyHidden = !instance.state.isVisible; var isDestroyed = instance.state.isDestroyed; var isDisabled = !instance.state.isEnabled; var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration); if (isAlreadyHidden || isDestroyed || isDisabled) { return; } invokeHook('onHide', [instance], false); if (instance.props.onHide(instance) === false) { return; } instance.state.isVisible = false; instance.state.isShown = false; ignoreOnFirstUpdate = false; isVisibleFromClick = false; if (getIsDefaultRenderFn()) { popper.style.visibility = 'hidden'; } cleanupInteractiveMouseListeners(); removeDocumentPress(); handleStyles(); if (getIsDefaultRenderFn()) { var _getDefaultTemplateCh4 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh4.box, content = _getDefaultTemplateCh4.content; if (instance.props.animation) { setTransitionDuration([box, content], duration); setVisibilityState([box, content], 'hidden'); } } handleAriaContentAttribute(); handleAriaExpandedAttribute(); if (instance.props.animation) { if (getIsDefaultRenderFn()) { onTransitionedOut(duration, instance.unmount); } } else { instance.unmount(); } } function hideWithInteractivity(event) { /* istanbul ignore else */ if (true) { warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity')); } doc.addEventListener('mousemove', debouncedOnMouseMove); pushIfUnique(mouseMoveListeners, debouncedOnMouseMove); debouncedOnMouseMove(event); } function unmount() { /* istanbul ignore else */ if (true) { warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('unmount')); } if (instance.state.isVisible) { instance.hide(); } if (!instance.state.isMounted) { return; } destroyPopperInstance(); // If a popper is not interactive, it will be appended outside the popper // tree by default. This seems mainly for interactive tippies, but we should // find a workaround if possible getNestedPopperTree().forEach(function (nestedPopper) { nestedPopper._tippy.unmount(); }); if (popper.parentNode) { popper.parentNode.removeChild(popper); } mountedInstances = mountedInstances.filter(function (i) { return i !== instance; }); instance.state.isMounted = false; invokeHook('onHidden', [instance]); } function destroy() { /* istanbul ignore else */ if (true) { warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('destroy')); } if (instance.state.isDestroyed) { return; } instance.clearDelayTimeouts(); instance.unmount(); removeListeners(); delete reference._tippy; instance.state.isDestroyed = true; invokeHook('onDestroy', [instance]); } } function tippy(targets, optionalProps) { if (optionalProps === void 0) { optionalProps = {}; } var plugins = defaultProps.plugins.concat(optionalProps.plugins || []); /* istanbul ignore else */ if (true) { validateTargets(targets); validateProps(optionalProps, plugins); } bindGlobalEventListeners(); var passedProps = Object.assign({}, optionalProps, { plugins: plugins }); var elements = getArrayOfElements(targets); /* istanbul ignore else */ if (true) { var isSingleContentElement = isElement(passedProps.content); var isMoreThanOneReferenceElement = elements.length > 1; warnWhen(isSingleContentElement && isMoreThanOneReferenceElement, ['tippy() was passed an Element as the `content` prop, but more than', 'one tippy instance was created by this invocation. This means the', 'content element will only be appended to the last tippy instance.', '\n\n', 'Instead, pass the .innerHTML of the element, or use a function that', 'returns a cloned version of the element instead.', '\n\n', '1) content: element.innerHTML\n', '2) content: () => element.cloneNode(true)'].join(' ')); } var instances = elements.reduce(function (acc, reference) { var instance = reference && createTippy(reference, passedProps); if (instance) { acc.push(instance); } return acc; }, []); return isElement(targets) ? instances[0] : instances; } tippy.defaultProps = defaultProps; tippy.setDefaultProps = setDefaultProps; tippy.currentInput = currentInput; var hideAll = function hideAll(_temp) { var _ref = _temp === void 0 ? {} : _temp, excludedReferenceOrInstance = _ref.exclude, duration = _ref.duration; mountedInstances.forEach(function (instance) { var isExcluded = false; if (excludedReferenceOrInstance) { isExcluded = isReferenceElement(excludedReferenceOrInstance) ? instance.reference === excludedReferenceOrInstance : instance.popper === excludedReferenceOrInstance.popper; } if (!isExcluded) { var originalDuration = instance.props.duration; instance.setProps({ duration: duration }); instance.hide(); if (!instance.state.isDestroyed) { instance.setProps({ duration: originalDuration }); } } }); }; var createSingleton = function createSingleton(tippyInstances, optionalProps) { if (optionalProps === void 0) { optionalProps = {}; } /* istanbul ignore else */ if (true) { errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' ')); } var mutTippyInstances = tippyInstances; var references = []; var currentTarget; var overrides = optionalProps.overrides; function setReferences() { references = mutTippyInstances.map(function (instance) { return instance.reference; }); } function enableInstances(isEnabled) { mutTippyInstances.forEach(function (instance) { if (isEnabled) { instance.enable(); } else { instance.disable(); } }); } enableInstances(false); setReferences(); var singleton = { fn: function fn() { return { onDestroy: function onDestroy() { enableInstances(true); }, onTrigger: function onTrigger(instance, event) { var target = event.currentTarget; var index = references.indexOf(target); // bail-out if (target === currentTarget) { return; } currentTarget = target; var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) { acc[prop] = mutTippyInstances[index].props[prop]; return acc; }, {}); instance.setProps(Object.assign({}, overrideProps, { getReferenceClientRect: function getReferenceClientRect() { return target.getBoundingClientRect(); } })); } }; } }; var instance = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), { plugins: [singleton].concat(optionalProps.plugins || []), triggerTarget: references })); var originalSetProps = instance.setProps; instance.setProps = function (props) { overrides = props.overrides || overrides; originalSetProps(props); }; instance.setInstances = function (nextInstances) { enableInstances(true); mutTippyInstances = nextInstances; enableInstances(false); setReferences(); instance.setProps({ triggerTarget: references }); }; return instance; }; var BUBBLING_EVENTS_MAP = { mouseover: 'mouseenter', focusin: 'focus', click: 'click' }; /** * Creates a delegate instance that controls the creation of tippy instances * for child elements (`target` CSS selector). */ function delegate(targets, props) { /* istanbul ignore else */ if (true) { errorWhen(!(props && props.target), ['You must specity a `target` prop indicating a CSS selector string matching', 'the target elements that should receive a tippy.'].join(' ')); } var listeners = []; var childTippyInstances = []; var target = props.target; var nativeProps = removeProperties(props, ['target']); var parentProps = Object.assign({}, nativeProps, { trigger: 'manual', touch: false }); var childProps = Object.assign({}, nativeProps, { showOnCreate: true }); var returnValue = tippy(targets, parentProps); var normalizedReturnValue = normalizeToArray(returnValue); function onTrigger(event) { if (!event.target) { return; } var targetNode = event.target.closest(target); if (!targetNode) { return; } // Get relevant trigger with fallbacks: // 1. Check `data-tippy-trigger` attribute on target node // 2. Fallback to `trigger` passed to `delegate()` // 3. Fallback to `defaultProps.trigger` var trigger = targetNode.getAttribute('data-tippy-trigger') || props.trigger || defaultProps.trigger; // @ts-ignore if (targetNode._tippy) { return; } if (event.type === 'touchstart' && typeof childProps.touch === 'boolean') { return; } if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type]) < 0) { return; } var instance = tippy(targetNode, childProps); if (instance) { childTippyInstances = childTippyInstances.concat(instance); } } function on(node, eventType, handler, options) { if (options === void 0) { options = false; } node.addEventListener(eventType, handler, options); listeners.push({ node: node, eventType: eventType, handler: handler, options: options }); } function addEventListeners(instance) { var reference = instance.reference; on(reference, 'touchstart', onTrigger); on(reference, 'mouseover', onTrigger); on(reference, 'focusin', onTrigger); on(reference, 'click', onTrigger); } function removeEventListeners() { listeners.forEach(function (_ref) { var node = _ref.node, eventType = _ref.eventType, handler = _ref.handler, options = _ref.options; node.removeEventListener(eventType, handler, options); }); listeners = []; } function applyMutations(instance) { var originalDestroy = instance.destroy; instance.destroy = function (shouldDestroyChildInstances) { if (shouldDestroyChildInstances === void 0) { shouldDestroyChildInstances = true; } if (shouldDestroyChildInstances) { childTippyInstances.forEach(function (instance) { instance.destroy(); }); } childTippyInstances = []; removeEventListeners(); originalDestroy(); }; addEventListeners(instance); } normalizedReturnValue.forEach(applyMutations); return returnValue; } var animateFill = { name: 'animateFill', defaultValue: false, fn: function fn(instance) { var _instance$props$rende; // @ts-ignore if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) { if (true) { errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.'); } return {}; } var _getChildren = getChildren(instance.popper), box = _getChildren.box, content = _getChildren.content; var backdrop = instance.props.animateFill ? createBackdropElement() : null; return { onCreate: function onCreate() { if (backdrop) { box.insertBefore(backdrop, box.firstElementChild); box.setAttribute('data-animatefill', ''); box.style.overflow = 'hidden'; instance.setProps({ arrow: false, animation: 'shift-away' }); } }, onMount: function onMount() { if (backdrop) { var transitionDuration = box.style.transitionDuration; var duration = Number(transitionDuration.replace('ms', '')); // The content should fade in after the backdrop has mostly filled the // tooltip element. `clip-path` is the other alternative but is not // well-supported and is buggy on some devices. content.style.transitionDelay = Math.round(duration / 10) + "ms"; backdrop.style.transitionDuration = transitionDuration; setVisibilityState([backdrop], 'visible'); } }, onShow: function onShow() { if (backdrop) { backdrop.style.transitionDuration = '0ms'; } }, onHide: function onHide() { if (backdrop) { setVisibilityState([backdrop], 'hidden'); } } }; } }; function createBackdropElement() { var backdrop = div(); backdrop.className = BACKDROP_CLASS; setVisibilityState([backdrop], 'hidden'); return backdrop; } var mouseCoords = { clientX: 0, clientY: 0 }; var activeInstances = []; function storeMouseCoords(_ref) { var clientX = _ref.clientX, clientY = _ref.clientY; mouseCoords = { clientX: clientX, clientY: clientY }; } function addMouseCoordsListener(doc) { doc.addEventListener('mousemove', storeMouseCoords); } function removeMouseCoordsListener(doc) { doc.removeEventListener('mousemove', storeMouseCoords); } var followCursor = { name: 'followCursor', defaultValue: false, fn: function fn(instance) { var reference = instance.reference; var doc = getOwnerDocument(instance.props.triggerTarget || reference); var isInternalUpdate = false; var wasFocusEvent = false; var isUnmounted = true; var prevProps = instance.props; function getIsInitialBehavior() { return instance.props.followCursor === 'initial' && instance.state.isVisible; } function addListener() { doc.addEventListener('mousemove', onMouseMove); } function removeListener() { doc.removeEventListener('mousemove', onMouseMove); } function unsetGetReferenceClientRect() { isInternalUpdate = true; instance.setProps({ getReferenceClientRect: null }); isInternalUpdate = false; } function onMouseMove(event) { // If the instance is interactive, avoid updating the position unless it's // over the reference element var isCursorOverReference = event.target ? reference.contains(event.target) : true; var followCursor = instance.props.followCursor; var clientX = event.clientX, clientY = event.clientY; var rect = reference.getBoundingClientRect(); var relativeX = clientX - rect.left; var relativeY = clientY - rect.top; if (isCursorOverReference || !instance.props.interactive) { instance.setProps({ getReferenceClientRect: function getReferenceClientRect() { var rect = reference.getBoundingClientRect(); var x = clientX; var y = clientY; if (followCursor === 'initial') { x = rect.left + relativeX; y = rect.top + relativeY; } var top = followCursor === 'horizontal' ? rect.top : y; var right = followCursor === 'vertical' ? rect.right : x; var bottom = followCursor === 'horizontal' ? rect.bottom : y; var left = followCursor === 'vertical' ? rect.left : x; return { width: right - left, height: bottom - top, top: top, right: right, bottom: bottom, left: left }; } }); } } function create() { if (instance.props.followCursor) { activeInstances.push({ instance: instance, doc: doc }); addMouseCoordsListener(doc); } } function destroy() { activeInstances = activeInstances.filter(function (data) { return data.instance !== instance; }); if (activeInstances.filter(function (data) { return data.doc === doc; }).length === 0) { removeMouseCoordsListener(doc); } } return { onCreate: create, onDestroy: destroy, onBeforeUpdate: function onBeforeUpdate() { prevProps = instance.props; }, onAfterUpdate: function onAfterUpdate(_, _ref2) { var followCursor = _ref2.followCursor; if (isInternalUpdate) { return; } if (followCursor !== undefined && prevProps.followCursor !== followCursor) { destroy(); if (followCursor) { create(); if (instance.state.isMounted && !wasFocusEvent && !getIsInitialBehavior()) { addListener(); } } else { removeListener(); unsetGetReferenceClientRect(); } } }, onMount: function onMount() { if (instance.props.followCursor && !wasFocusEvent) { if (isUnmounted) { onMouseMove(mouseCoords); isUnmounted = false; } if (!getIsInitialBehavior()) { addListener(); } } }, onTrigger: function onTrigger(_, event) { if (isMouseEvent(event)) { mouseCoords = { clientX: event.clientX, clientY: event.clientY }; } wasFocusEvent = event.type === 'focus'; }, onHidden: function onHidden() { if (instance.props.followCursor) { unsetGetReferenceClientRect(); removeListener(); isUnmounted = true; } } }; } }; function getProps(props, modifier) { var _props$popperOptions; return { popperOptions: Object.assign({}, props.popperOptions, { modifiers: [].concat((((_props$popperOptions = props.popperOptions) == null ? void 0 : _props$popperOptions.modifiers) || []).filter(function (_ref) { var name = _ref.name; return name !== modifier.name; }), [modifier]) }) }; } var inlinePositioning = { name: 'inlinePositioning', defaultValue: false, fn: function fn(instance) { var reference = instance.reference; function isEnabled() { return !!instance.props.inlinePositioning; } var placement; var cursorRectIndex = -1; var isInternalUpdate = false; var modifier = { name: 'tippyInlinePositioning', enabled: true, phase: 'afterWrite', fn: function fn(_ref2) { var state = _ref2.state; if (isEnabled()) { if (placement !== state.placement) { instance.setProps({ getReferenceClientRect: function getReferenceClientRect() { return _getReferenceClientRect(state.placement); } }); } placement = state.placement; } } }; function _getReferenceClientRect(placement) { return getInlineBoundingClientRect(getBasePlacement(placement), reference.getBoundingClientRect(), arrayFrom(reference.getClientRects()), cursorRectIndex); } function setInternalProps(partialProps) { isInternalUpdate = true; instance.setProps(partialProps); isInternalUpdate = false; } function addModifier() { if (!isInternalUpdate) { setInternalProps(getProps(instance.props, modifier)); } } return { onCreate: addModifier, onAfterUpdate: addModifier, onTrigger: function onTrigger(_, event) { if (isMouseEvent(event)) { var rects = arrayFrom(instance.reference.getClientRects()); var cursorRect = rects.find(function (rect) { return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY; }); cursorRectIndex = rects.indexOf(cursorRect); } }, onUntrigger: function onUntrigger() { cursorRectIndex = -1; } }; } }; function getInlineBoundingClientRect(currentBasePlacement, boundingRect, clientRects, cursorRectIndex) { // Not an inline element, or placement is not yet known if (clientRects.length < 2 || currentBasePlacement === null) { return boundingRect; } // There are two rects and they are disjoined if (clientRects.length === 2 && cursorRectIndex >= 0 && clientRects[0].left > clientRects[1].right) { return clientRects[cursorRectIndex] || boundingRect; } switch (currentBasePlacement) { case 'top': case 'bottom': { var firstRect = clientRects[0]; var lastRect = clientRects[clientRects.length - 1]; var isTop = currentBasePlacement === 'top'; var top = firstRect.top; var bottom = lastRect.bottom; var left = isTop ? firstRect.left : lastRect.left; var right = isTop ? firstRect.right : lastRect.right; var width = right - left; var height = bottom - top; return { top: top, bottom: bottom, left: left, right: right, width: width, height: height }; } case 'left': case 'right': { var minLeft = Math.min.apply(Math, clientRects.map(function (rects) { return rects.left; })); var maxRight = Math.max.apply(Math, clientRects.map(function (rects) { return rects.right; })); var measureRects = clientRects.filter(function (rect) { return currentBasePlacement === 'left' ? rect.left === minLeft : rect.right === maxRight; }); var _top = measureRects[0].top; var _bottom = measureRects[measureRects.length - 1].bottom; var _left = minLeft; var _right = maxRight; var _width = _right - _left; var _height = _bottom - _top; return { top: _top, bottom: _bottom, left: _left, right: _right, width: _width, height: _height }; } default: { return boundingRect; } } } var sticky = { name: 'sticky', defaultValue: false, fn: function fn(instance) { var reference = instance.reference, popper = instance.popper; function getReference() { return instance.popperInstance ? instance.popperInstance.state.elements.reference : reference; } function shouldCheck(value) { return instance.props.sticky === true || instance.props.sticky === value; } var prevRefRect = null; var prevPopRect = null; function updatePosition() { var currentRefRect = shouldCheck('reference') ? getReference().getBoundingClientRect() : null; var currentPopRect = shouldCheck('popper') ? popper.getBoundingClientRect() : null; if (currentRefRect && areRectsDifferent(prevRefRect, currentRefRect) || currentPopRect && areRectsDifferent(prevPopRect, currentPopRect)) { if (instance.popperInstance) { instance.popperInstance.update(); } } prevRefRect = currentRefRect; prevPopRect = currentPopRect; if (instance.state.isMounted) { requestAnimationFrame(updatePosition); } } return { onMount: function onMount() { if (instance.props.sticky) { updatePosition(); } } }; } }; function areRectsDifferent(rectA, rectB) { if (rectA && rectB) { return rectA.top !== rectB.top || rectA.right !== rectB.right || rectA.bottom !== rectB.bottom || rectA.left !== rectB.left; } return true; } tippy.setDefaultProps({ render: render }); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (tippy); //# sourceMappingURL=tippy.esm.js.map /***/ }, /***/ 428 /*!*************************!*\ !*** external "jQuery" ***! \*************************/ (module) { "use strict"; module.exports = window["jQuery"]; /***/ }, /***/ 8987 /*!***************************************************!*\ !*** ./node_modules/js-cookie/dist/js.cookie.mjs ***! \***************************************************/ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ api) /* harmony export */ }); /*! js-cookie v3.0.7 | MIT */ function assign (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (key === '__proto__') continue target[key] = source[key]; } } return target } var defaultConverter = { read: function (value) { if (value[0] === '"') { value = value.slice(1, -1); } return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent) }, write: function (value) { return encodeURIComponent(value).replace( /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent ) } }; function init(converter, defaultAttributes) { function set(name, value, attributes) { if (typeof document === 'undefined') { return } attributes = assign({}, defaultAttributes, attributes); if (typeof attributes.expires === 'number') { attributes.expires = new Date(Date.now() + attributes.expires * 864e5); } if (attributes.expires) { attributes.expires = attributes.expires.toUTCString(); } name = encodeURIComponent(name) .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent) .replace(/[()]/g, escape); var stringifiedAttributes = ''; for (var attributeName in attributes) { if (!attributes[attributeName]) { continue } stringifiedAttributes += '; ' + attributeName; if (attributes[attributeName] === true) { continue } // Considers RFC 6265 section 5.2: // ... // 3. If the remaining unparsed-attributes contains a %x3B (";") // character: // Consume the characters of the unparsed-attributes up to, // not including, the first %x3B (";") character. // ... stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; } return (document.cookie = name + '=' + converter.write(value, name) + stringifiedAttributes) } function get(name) { if (typeof document === 'undefined' || (arguments.length && !name)) { return } // To prevent the for loop in the first place assign an empty array // in case there are no cookies at all. var cookies = document.cookie ? document.cookie.split('; ') : []; var jar = {}; for (var i = 0; i < cookies.length; i++) { var parts = cookies[i].split('='); var value = parts.slice(1).join('='); try { var found = decodeURIComponent(parts[0]); if (!(found in jar)) jar[found] = converter.read(value, found); if (name === found) { break } } catch { // Do nothing... } } return name ? jar[name] : jar } return Object.create( { set, get, remove: function (name, attributes) { set( name, '', assign({}, attributes, { expires: -1 }) ); }, withAttributes: function (attributes) { return init(this.converter, assign({}, this.attributes, attributes)) }, withConverter: function (converter) { return init(assign({}, this.converter, converter), this.attributes) } }, { attributes: { value: Object.freeze(defaultAttributes) }, converter: { value: Object.freeze(converter) } } ) } var api = init(defaultConverter, { path: '/' }); /***/ } /******/ }); /************************************************************************/ /******/ // The module cache /******/ const __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ const cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ const module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ if (!(moduleId in __webpack_modules__)) { /******/ delete __webpack_module_cache__[moduleId]; /******/ const e = new Error("Cannot find module '" + moduleId + "'"); /******/ e.code = 'MODULE_NOT_FOUND'; /******/ throw e; /******/ } /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ const getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter/value functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ if(Array.isArray(definition)) { /******/ var i = 0; /******/ while(i < definition.length) { /******/ var key = definition[i++]; /******/ var binding = definition[i++]; /******/ if(!__webpack_require__.o(exports, key)) { /******/ if(binding === 0) { /******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] }); /******/ } else { /******/ Object.defineProperty(exports, key, { enumerable: true, get: binding }); /******/ } /******/ } else if(binding === 0) { i++; } /******/ } /******/ } else { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/global */ /******/ (() => { /******/ __webpack_require__.g = (function() { /******/ if (typeof globalThis === 'object') return globalThis; /******/ try { /******/ return this || new Function('return this')(); /******/ } catch (e) { /******/ if (typeof window === 'object') return window; /******/ } /******/ })(); /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ let __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; /*!***************************!*\ !*** ./assets/js/main.js ***! \***************************/ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _dupli_namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dupli-namespace.js */ 9003); /* harmony import */ var _dupli_namespace_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_dupli_namespace_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ 428); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var tippy_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tippy.js */ 4504); /* harmony import */ var handlebars_dist_handlebars__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! handlebars/dist/handlebars */ 7596); /* harmony import */ var handlebars_dist_handlebars__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(handlebars_dist_handlebars__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var parsleyjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! parsleyjs */ 6409); /* harmony import */ var parsleyjs__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(parsleyjs__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _popperjs_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @popperjs/core */ 1576); /* harmony import */ var select2__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! select2 */ 5458); /* harmony import */ var select2__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(select2__WEBPACK_IMPORTED_MODULE_6__); /* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! js-cookie */ 8987); /* harmony import */ var jstree__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! jstree */ 1460); /* harmony import */ var jstree__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(jstree__WEBPACK_IMPORTED_MODULE_8__); /* harmony import */ var formstone__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! formstone */ 5010); /* harmony import */ var formstone__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(formstone__WEBPACK_IMPORTED_MODULE_9__); /* harmony import */ var formstone_dist_js_upload_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! formstone/dist/js/upload.js */ 5232); /* harmony import */ var formstone_dist_js_upload_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(formstone_dist_js_upload_js__WEBPACK_IMPORTED_MODULE_10__); /* harmony import */ var _duplicator_tooltip_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./duplicator-tooltip.js */ 5174); /* harmony import */ var _duplicator_tooltip_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_duplicator_tooltip_js__WEBPACK_IMPORTED_MODULE_11__); /* harmony import */ var _dynamic_help_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./dynamic-help.js */ 5104); /* harmony import */ var _dynamic_help_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_dynamic_help_js__WEBPACK_IMPORTED_MODULE_12__); /* harmony import */ var select2_dist_css_select2_css__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! select2/dist/css/select2.css */ 2395); /* harmony import */ var jstree_dist_themes_default_style_css__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! jstree/dist/themes/default/style.css */ 8336); /** * Main script for Duplicator Plugin */ // Import and initialize global namespace (must be first) // jQuery resolves to the WordPress-provided instance (webpack external); // expose the `$` alias that inline template scripts rely on window.$ = window.jQuery = (jquery__WEBPACK_IMPORTED_MODULE_1___default()); // Import Tippy and make it available under DupliJs.Libs DupliJs.Libs.tippy = tippy_js__WEBPACK_IMPORTED_MODULE_2__["default"]; // Import Handlebars dist (browser-compatible) and make it available under DupliJs.Libs DupliJs.Libs.Handlebars = (handlebars_dist_handlebars__WEBPACK_IMPORTED_MODULE_3___default()); /** * Scripts */ /** * Styles */ })(); self["DuplicatorPlugin-vendor"] = __webpack_exports__; /******/ })() ;
Save File
Cancel