From 8d5547ccbdfbb016bf9ace104549344eaec7ffac Mon Sep 17 00:00:00 2001
From: Nithy1anand
Date: Sat, 14 Oct 2023 17:39:53 +0530
Subject: [PATCH 01/14] Improved the configuration flow
---
amd/build/contacts.min.js.map | 2 +-
amd/build/datepicker.min.js.map | 2 +-
amd/build/group-user-selector.min.js.map | 2 +-
amd/build/groups.min.js.map | 2 +-
amd/build/preferences_modal.min.js.map | 2 +-
amd/build/select2.min.js.map | 2 +-
block_dash.php | 42 ++++++++++
.../data_custom/abstract_custom_type.php | 65 ++++++++++++++
classes/local/data_custom/custom_layout.php | 78 +++++++++++++++++
.../local/data_grid/data/data_collection.php | 8 +-
.../local/data_source/data_source_factory.php | 17 ++++
classes/local/widget/abstract_layout.php | 5 +-
classes/output/mustache_custom_loader.php | 3 +
db/access.php | 22 +++++
edit_form.php | 84 +++++++++++++------
lang/en/block_dash.php | 23 ++++-
styles.css | 33 ++++++--
templates/block.mustache | 5 +-
version.php | 4 +-
19 files changed, 348 insertions(+), 53 deletions(-)
create mode 100644 classes/local/data_custom/abstract_custom_type.php
create mode 100644 classes/local/data_custom/custom_layout.php
diff --git a/amd/build/contacts.min.js.map b/amd/build/contacts.min.js.map
index a792a94..fbb12f8 100644
--- a/amd/build/contacts.min.js.map
+++ b/amd/build/contacts.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"contacts.min.js","sources":["../src/contacts.js"],"sourcesContent":["define(['core/str', 'core/modal_factory', 'core/modal_events',\n'core/fragment', 'core/templates', 'core/notification', 'core_message/toggle_contact_button'],\n function(Str, Modal, ModalEvents, Fragment, Templates, Notification, Contact) {\n\n return {\n init: function(contextID) {\n var groupModal = document.getElementsByClassName('contact-widget-viewgroup');\n var contactUser;\n Array.from(groupModal).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n var target = e.target.closest('a');\n contactUser = target.getAttribute('data-userid');\n Modal.create({\n title: Str.get_string('groups', 'core')\n }).then(function(modal) {\n modal.show();\n\n var args = JSON.stringify({contactuser: contactUser});\n var params = {widget: 'contacts', method: 'load_groups', args: args};\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\n modal.setBody(html);\n Templates.runTemplateJS(js);\n return html;\n }).catch(Notification.exception);\n\n modal.getRoot().on(ModalEvents.hidden, function() {\n modal.destroy();\n });\n return modal;\n }).catch(Notification.exception);\n });\n });\n\n var contactModal = document.getElementsByClassName('toggle-contact-button');\n Array.from(contactModal).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n if (e.target.dataset.userid != undefined) {\n Contact.enhance(e.target);\n }\n });\n });\n }\n };\n});\n"],"names":["define","Str","Modal","ModalEvents","Fragment","Templates","Notification","Contact","init","contextID","contactUser","groupModal","document","getElementsByClassName","Array","from","forEach","element","addEventListener","e","preventDefault","target","closest","getAttribute","create","title","get_string","then","modal","show","params","widget","method","args","JSON","stringify","contactuser","loadFragment","html","js","setBody","runTemplateJS","catch","exception","getRoot","on","hidden","destroy","contactModal","undefined","dataset","userid","enhance"],"mappings":"AAAAA,6BAAO,CAAC,WAAY,qBAAsB,oBAC1C,gBAAiB,iBAAkB,oBAAqB,uCACpD,SAASC,IAAKC,MAAOC,YAAaC,SAAUC,UAAWC,aAAcC,eAE9D,CACHC,KAAM,SAASC,eAEPC,YADAC,WAAaC,SAASC,uBAAuB,4BAEjDC,MAAMC,KAAKJ,YAAYK,SAAQ,SAASC,SACpCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,qBACEC,OAASF,EAAEE,OAAOC,QAAQ,KAC9BZ,YAAcW,OAAOE,aAAa,eAClCrB,MAAMsB,OAAO,CACTC,MAAOxB,IAAIyB,WAAW,SAAU,UACjCC,MAAK,SAASC,OACbA,MAAMC,WAGFC,OAAS,CAACC,OAAQ,WAAYC,OAAQ,cAAeC,KAD9CC,KAAKC,UAAU,CAACC,YAAa1B,sBAExCN,SAASiC,aAAa,aAAc,aAAc5B,UAAWqB,QAAQH,MAAK,CAACW,KAAMC,MAC7EX,MAAMY,QAAQF,MACdjC,UAAUoC,cAAcF,IACjBD,QACRI,MAAMpC,aAAaqC,WAEtBf,MAAMgB,UAAUC,GAAG1C,YAAY2C,QAAQ,WACnClB,MAAMmB,aAEHnB,SACRc,MAAMpC,aAAaqC,qBAI1BK,aAAepC,SAASC,uBAAuB,yBACnDC,MAAMC,KAAKiC,cAAchC,SAAQ,SAASC,SACtCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,iBAC6B6B,MAA3B9B,EAAEE,OAAO6B,QAAQC,QACjB5C,QAAQ6C,QAAQjC,EAAEE"}
\ No newline at end of file
+{"version":3,"file":"contacts.min.js","sources":["../src/contacts.js"],"sourcesContent":["define(['core/str', 'core/modal_factory', 'core/modal_events',\r\n'core/fragment', 'core/templates', 'core/notification', 'core_message/toggle_contact_button'],\r\n function(Str, Modal, ModalEvents, Fragment, Templates, Notification, Contact) {\r\n\r\n return {\r\n init: function(contextID) {\r\n var groupModal = document.getElementsByClassName('contact-widget-viewgroup');\r\n var contactUser;\r\n Array.from(groupModal).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n var target = e.target.closest('a');\r\n contactUser = target.getAttribute('data-userid');\r\n Modal.create({\r\n title: Str.get_string('groups', 'core')\r\n }).then(function(modal) {\r\n modal.show();\r\n\r\n var args = JSON.stringify({contactuser: contactUser});\r\n var params = {widget: 'contacts', method: 'load_groups', args: args};\r\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\r\n modal.setBody(html);\r\n Templates.runTemplateJS(js);\r\n return html;\r\n }).catch(Notification.exception);\r\n\r\n modal.getRoot().on(ModalEvents.hidden, function() {\r\n modal.destroy();\r\n });\r\n return modal;\r\n }).catch(Notification.exception);\r\n });\r\n });\r\n\r\n var contactModal = document.getElementsByClassName('toggle-contact-button');\r\n Array.from(contactModal).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n if (e.target.dataset.userid != undefined) {\r\n Contact.enhance(e.target);\r\n }\r\n });\r\n });\r\n }\r\n };\r\n});\r\n"],"names":["define","Str","Modal","ModalEvents","Fragment","Templates","Notification","Contact","init","contextID","contactUser","groupModal","document","getElementsByClassName","Array","from","forEach","element","addEventListener","e","preventDefault","target","closest","getAttribute","create","title","get_string","then","modal","show","params","widget","method","args","JSON","stringify","contactuser","loadFragment","html","js","setBody","runTemplateJS","catch","exception","getRoot","on","hidden","destroy","contactModal","undefined","dataset","userid","enhance"],"mappings":"AAAAA,6BAAO,CAAC,WAAY,qBAAsB,oBAC1C,gBAAiB,iBAAkB,oBAAqB,uCACpD,SAASC,IAAKC,MAAOC,YAAaC,SAAUC,UAAWC,aAAcC,eAE9D,CACHC,KAAM,SAASC,eAEPC,YADAC,WAAaC,SAASC,uBAAuB,4BAEjDC,MAAMC,KAAKJ,YAAYK,SAAQ,SAASC,SACpCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,qBACEC,OAASF,EAAEE,OAAOC,QAAQ,KAC9BZ,YAAcW,OAAOE,aAAa,eAClCrB,MAAMsB,OAAO,CACTC,MAAOxB,IAAIyB,WAAW,SAAU,UACjCC,MAAK,SAASC,OACbA,MAAMC,WAGFC,OAAS,CAACC,OAAQ,WAAYC,OAAQ,cAAeC,KAD9CC,KAAKC,UAAU,CAACC,YAAa1B,sBAExCN,SAASiC,aAAa,aAAc,aAAc5B,UAAWqB,QAAQH,MAAK,CAACW,KAAMC,MAC7EX,MAAMY,QAAQF,MACdjC,UAAUoC,cAAcF,IACjBD,QACRI,MAAMpC,aAAaqC,WAEtBf,MAAMgB,UAAUC,GAAG1C,YAAY2C,QAAQ,WACnClB,MAAMmB,aAEHnB,SACRc,MAAMpC,aAAaqC,qBAI1BK,aAAepC,SAASC,uBAAuB,yBACnDC,MAAMC,KAAKiC,cAAchC,SAAQ,SAASC,SACtCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,iBAC6B6B,MAA3B9B,EAAEE,OAAO6B,QAAQC,QACjB5C,QAAQ6C,QAAQjC,EAAEE"}
\ No newline at end of file
diff --git a/amd/build/datepicker.min.js.map b/amd/build/datepicker.min.js.map
index 0434eba..a8f533a 100644
--- a/amd/build/datepicker.min.js.map
+++ b/amd/build/datepicker.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"datepicker.min.js","sources":["../src/datepicker.js"],"sourcesContent":["/*!\n * Datepicker2 for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker2)\n *\n * Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)\n */\n\n(function(factory){\n if (typeof define === 'function' && define.amd) {\n define(['jquery'], factory);\n } else if (typeof exports === 'object') {\n factory(require('jquery'));\n } else {\n factory(jQuery);\n }\n}(function($, undefined){\n function UTCDate(){\n return new Date(Date.UTC.apply(Date, arguments));\n }\n function UTCToday(){\n var today = new Date();\n return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());\n }\n function isUTCEquals(date1, date2) {\n return (\n date1.getUTCFullYear() === date2.getUTCFullYear() &&\n date1.getUTCMonth() === date2.getUTCMonth() &&\n date1.getUTCDate() === date2.getUTCDate()\n );\n }\n function alias(method, deprecationMsg){\n return function(){\n if (deprecationMsg !== undefined) {\n $.fn.datepicker2.deprecated(deprecationMsg);\n }\n\n return this[method].apply(this, arguments);\n };\n }\n function isValidDate(d) {\n return d && !isNaN(d.getTime());\n }\n\n var DateArray = (function(){\n var extras = {\n get: function(i){\n return this.slice(i)[0];\n },\n contains: function(d){\n // Array.indexOf is not cross-browser;\n // $.inArray doesn't work with Dates\n var val = d && d.valueOf();\n for (var i=0, l=this.length; i < l; i++)\n // Use date arithmetic to allow dates with different times to match\n if (0 <= this[i].valueOf() - val && this[i].valueOf() - val < 1000*60*60*24)\n return i;\n return -1;\n },\n remove: function(i){\n this.splice(i,1);\n },\n replace: function(new_array){\n if (!new_array)\n return;\n if (!$.isArray(new_array))\n new_array = [new_array];\n this.clear();\n this.push.apply(this, new_array);\n },\n clear: function(){\n this.length = 0;\n },\n copy: function(){\n var a = new DateArray();\n a.replace(this);\n return a;\n }\n };\n\n return function(){\n var a = [];\n a.push.apply(a, arguments);\n $.extend(a, extras);\n return a;\n };\n })();\n\n\n // Picker object\n\n var Datepicker2 = function(element, options){\n $.data(element, 'datepicker2', this);\n\n this._events = [];\n this._secondaryEvents = [];\n\n this._process_options(options);\n\n this.dates = new DateArray();\n this.viewDate = this.o.defaultViewDate;\n this.focusDate = null;\n\n this.element = $(element);\n this.isInput = this.element.is('input');\n this.inputField = this.isInput ? this.element : this.element.find('input');\n this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .input-group-append, .input-group-prepend, .btn') : false;\n if (this.component && this.component.length === 0)\n this.component = false;\n this.isInline = !this.component && this.element.is('div');\n\n this.picker = $(DPGlobal.template);\n\n // Checking templates and inserting\n if (this._check_template(this.o.templates.leftArrow)) {\n this.picker.find('.prev').html(this.o.templates.leftArrow);\n }\n\n if (this._check_template(this.o.templates.rightArrow)) {\n this.picker.find('.next').html(this.o.templates.rightArrow);\n }\n\n this._buildEvents();\n this._attachEvents();\n\n if (this.isInline){\n this.picker.addClass('datepicker2-inline').appendTo(this.element);\n }\n else {\n this.picker.addClass('datepicker2-dropdown dropdown-menu');\n }\n\n if (this.o.rtl){\n this.picker.addClass('datepicker2-rtl');\n }\n\n if (this.o.calendarWeeks) {\n this.picker.find('.datepicker2-days .datepicker2-switch, thead .datepicker2-title, tfoot .today, tfoot .clear')\n .attr('colspan', function(i, val){\n return Number(val) + 1;\n });\n }\n\n this._process_options({\n startDate: this._o.startDate,\n endDate: this._o.endDate,\n daysOfWeekDisabled: this.o.daysOfWeekDisabled,\n daysOfWeekHighlighted: this.o.daysOfWeekHighlighted,\n datesDisabled: this.o.datesDisabled\n });\n\n this._allow_update = false;\n this.setViewMode(this.o.startView);\n this._allow_update = true;\n\n this.fillDow();\n this.fillMonths();\n\n this.update();\n\n if (this.isInline){\n this.show();\n }\n };\n\n Datepicker2.prototype = {\n constructor: Datepicker2,\n\n _resolveViewName: function(view){\n $.each(DPGlobal.viewModes, function(i, viewMode){\n if (view === i || $.inArray(view, viewMode.names) !== -1){\n view = i;\n return false;\n }\n });\n\n return view;\n },\n\n _resolveDaysOfWeek: function(daysOfWeek){\n if (!$.isArray(daysOfWeek))\n daysOfWeek = daysOfWeek.split(/[,\\s]*/);\n return $.map(daysOfWeek, Number);\n },\n\n _check_template: function(tmp){\n try {\n // If empty\n if (tmp === undefined || tmp === \"\") {\n return false;\n }\n // If no html, everything ok\n if ((tmp.match(/[<>]/g) || []).length <= 0) {\n return true;\n }\n // Checking if html is fine\n var jDom = $(tmp);\n return jDom.length > 0;\n }\n catch (ex) {\n return false;\n }\n },\n\n _process_options: function(opts){\n // Store raw options for reference\n this._o = $.extend({}, this._o, opts);\n // Processed options\n var o = this.o = $.extend({}, this._o);\n\n // Check if \"de-DE\" style date is available, if not language should\n // fallback to 2 letter code eg \"de\"\n var lang = o.language;\n if (!dates[lang]){\n lang = lang.split('-')[0];\n if (!dates[lang])\n lang = defaults.language;\n }\n o.language = lang;\n\n // Retrieve view index from any aliases\n o.startView = this._resolveViewName(o.startView);\n o.minViewMode = this._resolveViewName(o.minViewMode);\n o.maxViewMode = this._resolveViewName(o.maxViewMode);\n\n // Check view is between min and max\n o.startView = Math.max(this.o.minViewMode, Math.min(this.o.maxViewMode, o.startView));\n\n // true, false, or Number > 0\n if (o.multidate !== true){\n o.multidate = Number(o.multidate) || false;\n if (o.multidate !== false)\n o.multidate = Math.max(0, o.multidate);\n }\n o.multidateSeparator = String(o.multidateSeparator);\n\n o.weekStart %= 7;\n o.weekEnd = (o.weekStart + 6) % 7;\n\n var format = DPGlobal.parseFormat(o.format);\n if (o.startDate !== -Infinity){\n if (!!o.startDate){\n if (o.startDate instanceof Date)\n o.startDate = this._local_to_utc(this._zero_time(o.startDate));\n else\n o.startDate = DPGlobal.parseDate(o.startDate, format, o.language, o.assumeNearbyYear);\n }\n else {\n o.startDate = -Infinity;\n }\n }\n if (o.endDate !== Infinity){\n if (!!o.endDate){\n if (o.endDate instanceof Date)\n o.endDate = this._local_to_utc(this._zero_time(o.endDate));\n else\n o.endDate = DPGlobal.parseDate(o.endDate, format, o.language, o.assumeNearbyYear);\n }\n else {\n o.endDate = Infinity;\n }\n }\n\n o.daysOfWeekDisabled = this._resolveDaysOfWeek(o.daysOfWeekDisabled||[]);\n o.daysOfWeekHighlighted = this._resolveDaysOfWeek(o.daysOfWeekHighlighted||[]);\n\n o.datesDisabled = o.datesDisabled||[];\n if (!$.isArray(o.datesDisabled)) {\n o.datesDisabled = o.datesDisabled.split(',');\n }\n o.datesDisabled = $.map(o.datesDisabled, function(d){\n return DPGlobal.parseDate(d, format, o.language, o.assumeNearbyYear);\n });\n\n var plc = String(o.orientation).toLowerCase().split(/\\s+/g),\n _plc = o.orientation.toLowerCase();\n plc = $.grep(plc, function(word){\n return /^auto|left|right|top|bottom$/.test(word);\n });\n o.orientation = {x: 'auto', y: 'auto'};\n if (!_plc || _plc === 'auto')\n ; // no action\n else if (plc.length === 1){\n switch (plc[0]){\n case 'top':\n case 'bottom':\n o.orientation.y = plc[0];\n break;\n case 'left':\n case 'right':\n o.orientation.x = plc[0];\n break;\n }\n }\n else {\n _plc = $.grep(plc, function(word){\n return /^left|right$/.test(word);\n });\n o.orientation.x = _plc[0] || 'auto';\n\n _plc = $.grep(plc, function(word){\n return /^top|bottom$/.test(word);\n });\n o.orientation.y = _plc[0] || 'auto';\n }\n if (o.defaultViewDate instanceof Date || typeof o.defaultViewDate === 'string') {\n o.defaultViewDate = DPGlobal.parseDate(o.defaultViewDate, format, o.language, o.assumeNearbyYear);\n } else if (o.defaultViewDate) {\n var year = o.defaultViewDate.year || new Date().getFullYear();\n var month = o.defaultViewDate.month || 0;\n var day = o.defaultViewDate.day || 1;\n o.defaultViewDate = UTCDate(year, month, day);\n } else {\n o.defaultViewDate = UTCToday();\n }\n },\n _applyEvents: function(evs){\n for (var i=0, el, ch, ev; i < evs.length; i++){\n el = evs[i][0];\n if (evs[i].length === 2){\n ch = undefined;\n ev = evs[i][1];\n } else if (evs[i].length === 3){\n ch = evs[i][1];\n ev = evs[i][2];\n }\n el.on(ev, ch);\n }\n },\n _unapplyEvents: function(evs){\n for (var i=0, el, ev, ch; i < evs.length; i++){\n el = evs[i][0];\n if (evs[i].length === 2){\n ch = undefined;\n ev = evs[i][1];\n } else if (evs[i].length === 3){\n ch = evs[i][1];\n ev = evs[i][2];\n }\n el.off(ev, ch);\n }\n },\n _buildEvents: function(){\n var events = {\n keyup: $.proxy(function(e){\n if ($.inArray(e.keyCode, [27, 37, 39, 38, 40, 32, 13, 9]) === -1)\n this.update();\n }, this),\n keydown: $.proxy(this.keydown, this),\n paste: $.proxy(this.paste, this)\n };\n\n if (this.o.showOnFocus === true) {\n events.focus = $.proxy(this.show, this);\n }\n\n if (this.isInput) { // single input\n this._events = [\n [this.element, events]\n ];\n }\n // component: input + button\n else if (this.component && this.inputField.length) {\n this._events = [\n // For components that are not readonly, allow keyboard nav\n [this.inputField, events],\n [this.component, {\n click: $.proxy(this.show, this)\n }]\n ];\n }\n else {\n this._events = [\n [this.element, {\n click: $.proxy(this.show, this),\n keydown: $.proxy(this.keydown, this)\n }]\n ];\n }\n this._events.push(\n // Component: listen for blur on element descendants\n [this.element, '*', {\n blur: $.proxy(function(e){\n this._focused_from = e.target;\n }, this)\n }],\n // Input: listen for blur on element\n [this.element, {\n blur: $.proxy(function(e){\n this._focused_from = e.target;\n }, this)\n }]\n );\n\n if (this.o.immediateUpdates) {\n // Trigger input updates immediately on changed year/month\n this._events.push([this.element, {\n 'changeYear changeMonth': $.proxy(function(e){\n this.update(e.date);\n }, this)\n }]);\n }\n\n this._secondaryEvents = [\n [this.picker, {\n click: $.proxy(this.click, this)\n }],\n [this.picker, '.prev, .next', {\n click: $.proxy(this.navArrowsClick, this)\n }],\n [this.picker, '.day:not(.disabled)', {\n click: $.proxy(this.dayCellClick, this)\n }],\n [$(window), {\n resize: $.proxy(this.place, this)\n }],\n [$(document), {\n 'mousedown touchstart': $.proxy(function(e){\n // Clicked outside the datepicker2, hide it\n if (!(\n this.element.is(e.target) ||\n this.element.find(e.target).length ||\n this.picker.is(e.target) ||\n this.picker.find(e.target).length ||\n this.isInline\n )){\n this.hide();\n }\n }, this)\n }]\n ];\n },\n _attachEvents: function(){\n this._detachEvents();\n this._applyEvents(this._events);\n },\n _detachEvents: function(){\n this._unapplyEvents(this._events);\n },\n _attachSecondaryEvents: function(){\n this._detachSecondaryEvents();\n this._applyEvents(this._secondaryEvents);\n },\n _detachSecondaryEvents: function(){\n this._unapplyEvents(this._secondaryEvents);\n },\n _trigger: function(event, altdate){\n var date = altdate || this.dates.get(-1),\n local_date = this._utc_to_local(date);\n\n this.element.trigger({\n type: event,\n date: local_date,\n viewMode: this.viewMode,\n dates: $.map(this.dates, this._utc_to_local),\n format: $.proxy(function(ix, format){\n if (arguments.length === 0){\n ix = this.dates.length - 1;\n format = this.o.format;\n } else if (typeof ix === 'string'){\n format = ix;\n ix = this.dates.length - 1;\n }\n format = format || this.o.format;\n var date = this.dates.get(ix);\n return DPGlobal.formatDate(date, format, this.o.language);\n }, this)\n });\n },\n\n show: function(){\n if (this.inputField.is(':disabled') || (this.inputField.prop('readonly') && this.o.enableOnReadonly === false))\n return;\n if (!this.isInline)\n this.picker.appendTo(this.o.container);\n this.place();\n this.picker.show();\n this._attachSecondaryEvents();\n this._trigger('show');\n if ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && this.o.disableTouchKeyboard) {\n $(this.element).blur();\n }\n return this;\n },\n\n hide: function(){\n if (this.isInline || !this.picker.is(':visible'))\n return this;\n this.focusDate = null;\n this.picker.hide().detach();\n this._detachSecondaryEvents();\n this.setViewMode(this.o.startView);\n\n if (this.o.forceParse && this.inputField.val())\n this.setValue();\n this._trigger('hide');\n return this;\n },\n\n destroy: function(){\n this.hide();\n this._detachEvents();\n this._detachSecondaryEvents();\n this.picker.remove();\n delete this.element.data().datepicker2;\n if (!this.isInput){\n delete this.element.data().date;\n }\n return this;\n },\n\n paste: function(e){\n var dateString;\n if (e.originalEvent.clipboardData && e.originalEvent.clipboardData.types\n && $.inArray('text/plain', e.originalEvent.clipboardData.types) !== -1) {\n dateString = e.originalEvent.clipboardData.getData('text/plain');\n } else if (window.clipboardData) {\n dateString = window.clipboardData.getData('Text');\n } else {\n return;\n }\n this.setDate(dateString);\n this.update();\n e.preventDefault();\n },\n\n _utc_to_local: function(utc){\n if (!utc) {\n return utc;\n }\n\n var local = new Date(utc.getTime() + (utc.getTimezoneOffset() * 60000));\n\n if (local.getTimezoneOffset() !== utc.getTimezoneOffset()) {\n local = new Date(utc.getTime() + (local.getTimezoneOffset() * 60000));\n }\n\n return local;\n },\n _local_to_utc: function(local){\n return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));\n },\n _zero_time: function(local){\n return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());\n },\n _zero_utc_time: function(utc){\n return utc && UTCDate(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate());\n },\n\n getDates: function(){\n return $.map(this.dates, this._utc_to_local);\n },\n\n getUTCDates: function(){\n return $.map(this.dates, function(d){\n return new Date(d);\n });\n },\n\n getDate: function(){\n return this._utc_to_local(this.getUTCDate());\n },\n\n getUTCDate: function(){\n var selected_date = this.dates.get(-1);\n if (selected_date !== undefined) {\n return new Date(selected_date);\n } else {\n return null;\n }\n },\n\n clearDates: function(){\n this.inputField.val('');\n this.update();\n this._trigger('changeDate');\n\n if (this.o.autoclose) {\n this.hide();\n }\n },\n\n setDates: function(){\n var args = $.isArray(arguments[0]) ? arguments[0] : arguments;\n this.update.apply(this, args);\n this._trigger('changeDate');\n this.setValue();\n return this;\n },\n\n setUTCDates: function(){\n var args = $.isArray(arguments[0]) ? arguments[0] : arguments;\n this.setDates.apply(this, $.map(args, this._utc_to_local));\n return this;\n },\n\n setDate: alias('setDates'),\n setUTCDate: alias('setUTCDates'),\n remove: alias('destroy', 'Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead'),\n\n setValue: function(){\n var formatted = this.getFormattedDate();\n this.inputField.val(formatted);\n return this;\n },\n\n getFormattedDate: function(format){\n if (format === undefined)\n format = this.o.format;\n\n var lang = this.o.language;\n return $.map(this.dates, function(d){\n return DPGlobal.formatDate(d, format, lang);\n }).join(this.o.multidateSeparator);\n },\n\n getStartDate: function(){\n return this.o.startDate;\n },\n\n setStartDate: function(startDate){\n this._process_options({startDate: startDate});\n this.update();\n this.updateNavArrows();\n return this;\n },\n\n getEndDate: function(){\n return this.o.endDate;\n },\n\n setEndDate: function(endDate){\n this._process_options({endDate: endDate});\n this.update();\n this.updateNavArrows();\n return this;\n },\n\n setDaysOfWeekDisabled: function(daysOfWeekDisabled){\n this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});\n this.update();\n return this;\n },\n\n setDaysOfWeekHighlighted: function(daysOfWeekHighlighted){\n this._process_options({daysOfWeekHighlighted: daysOfWeekHighlighted});\n this.update();\n return this;\n },\n\n setDatesDisabled: function(datesDisabled){\n this._process_options({datesDisabled: datesDisabled});\n this.update();\n return this;\n },\n\n place: function(){\n if (this.isInline)\n return this;\n var calendarWidth = this.picker.outerWidth(),\n calendarHeight = this.picker.outerHeight(),\n visualPadding = 10,\n container = $(this.o.container),\n windowWidth = container.width(),\n scrollTop = this.o.container === 'body' ? $(document).scrollTop() : container.scrollTop(),\n appendOffset = container.offset();\n\n var parentsZindex = [0];\n this.element.parents().each(function(){\n var itemZIndex = $(this).css('z-index');\n if (itemZIndex !== 'auto' && Number(itemZIndex) !== 0) parentsZindex.push(Number(itemZIndex));\n });\n var zIndex = Math.max.apply(Math, parentsZindex) + this.o.zIndexOffset;\n var offset = this.component ? this.component.parent().offset() : this.element.offset();\n var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);\n var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);\n var left = offset.left - appendOffset.left;\n var top = offset.top - appendOffset.top;\n\n if (this.o.container !== 'body') {\n top += scrollTop;\n }\n\n this.picker.removeClass(\n 'datepicker2-orient-top datepicker2-orient-bottom '+\n 'datepicker2-orient-right datepicker2-orient-left'\n );\n\n if (this.o.orientation.x !== 'auto'){\n this.picker.addClass('datepicker2-orient-' + this.o.orientation.x);\n if (this.o.orientation.x === 'right')\n left -= calendarWidth - width;\n }\n // auto x orientation is best-placement: if it crosses a window\n // edge, fudge it sideways\n else {\n if (offset.left < 0) {\n // component is outside the window on the left side. Move it into visible range\n this.picker.addClass('datepicker2-orient-left');\n left -= offset.left - visualPadding;\n } else if (left + calendarWidth > windowWidth) {\n // the calendar passes the widow right edge. Align it to component right side\n this.picker.addClass('datepicker2-orient-right');\n left += width - calendarWidth;\n } else {\n if (this.o.rtl) {\n // Default to right\n this.picker.addClass('datepicker2-orient-right');\n } else {\n // Default to left\n this.picker.addClass('datepicker2-orient-left');\n }\n }\n }\n\n // auto y orientation is best-situation: top or bottom, no fudging,\n // decision based on which shows more of the calendar\n var yorient = this.o.orientation.y,\n top_overflow;\n if (yorient === 'auto'){\n top_overflow = -scrollTop + top - calendarHeight;\n yorient = top_overflow < 0 ? 'bottom' : 'top';\n }\n\n this.picker.addClass('datepicker2-orient-' + yorient);\n if (yorient === 'top')\n top -= calendarHeight + parseInt(this.picker.css('padding-top'));\n else\n top += height;\n\n if (this.o.rtl) {\n var right = windowWidth - (left + width);\n this.picker.css({\n top: top,\n right: right,\n zIndex: zIndex\n });\n } else {\n this.picker.css({\n top: top,\n left: left,\n zIndex: zIndex\n });\n }\n return this;\n },\n\n _allow_update: true,\n update: function(){\n if (!this._allow_update)\n return this;\n\n var oldDates = this.dates.copy(),\n dates = [],\n fromArgs = false;\n if (arguments.length){\n $.each(arguments, $.proxy(function(i, date){\n if (date instanceof Date)\n date = this._local_to_utc(date);\n dates.push(date);\n }, this));\n fromArgs = true;\n } else {\n dates = this.isInput\n ? this.element.val()\n : this.element.data('date') || this.inputField.val();\n if (dates && this.o.multidate)\n dates = dates.split(this.o.multidateSeparator);\n else\n dates = [dates];\n delete this.element.data().date;\n }\n\n dates = $.map(dates, $.proxy(function(date){\n return DPGlobal.parseDate(date, this.o.format, this.o.language, this.o.assumeNearbyYear);\n }, this));\n dates = $.grep(dates, $.proxy(function(date){\n return (\n !this.dateWithinRange(date) ||\n !date\n );\n }, this), true);\n this.dates.replace(dates);\n\n if (this.o.updateViewDate) {\n if (this.dates.length)\n this.viewDate = new Date(this.dates.get(-1));\n else if (this.viewDate < this.o.startDate)\n this.viewDate = new Date(this.o.startDate);\n else if (this.viewDate > this.o.endDate)\n this.viewDate = new Date(this.o.endDate);\n else\n this.viewDate = this.o.defaultViewDate;\n }\n\n if (fromArgs){\n // setting date by clicking\n this.setValue();\n this.element.change();\n }\n else if (this.dates.length){\n // setting date by typing\n if (String(oldDates) !== String(this.dates) && fromArgs) {\n this._trigger('changeDate');\n this.element.change();\n }\n }\n if (!this.dates.length && oldDates.length) {\n this._trigger('clearDate');\n this.element.change();\n }\n\n this.fill();\n return this;\n },\n\n fillDow: function(){\n if (this.o.showWeekDays) {\n var dowCnt = this.o.weekStart,\n html = '
';\n if (this.o.calendarWeeks){\n html += '
';\n }\n while (dowCnt < this.o.weekStart + 7){\n html += '
'+dates[this.o.language].daysMin[(dowCnt++)%7]+'
';\n }\n html += '
';\n this.picker.find('.datepicker2-days thead').append(html);\n }\n },\n\n fillMonths: function(){\n var localDate = this._utc_to_local(this.viewDate);\n var html = '';\n var focused;\n for (var i = 0; i < 12; i++){\n focused = localDate && localDate.getMonth() === i ? ' focused' : '';\n html += '' + dates[this.o.language].monthsShort[i] + '';\n }\n this.picker.find('.datepicker2-months td').html(html);\n },\n\n setRange: function(range){\n if (!range || !range.length)\n delete this.range;\n else\n this.range = $.map(range, function(d){\n return d.valueOf();\n });\n this.fill();\n },\n\n getClassNames: function(date){\n var cls = [],\n year = this.viewDate.getUTCFullYear(),\n month = this.viewDate.getUTCMonth(),\n today = UTCToday();\n if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){\n cls.push('old');\n } else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){\n cls.push('new');\n }\n if (this.focusDate && date.valueOf() === this.focusDate.valueOf())\n cls.push('focused');\n // Compare internal UTC date with UTC today, not local today\n if (this.o.todayHighlight && isUTCEquals(date, today)) {\n cls.push('today');\n }\n if (this.dates.contains(date) !== -1)\n cls.push('active');\n if (!this.dateWithinRange(date)){\n cls.push('disabled');\n }\n if (this.dateIsDisabled(date)){\n cls.push('disabled', 'disabled-date');\n }\n if ($.inArray(date.getUTCDay(), this.o.daysOfWeekHighlighted) !== -1){\n cls.push('highlighted');\n }\n\n if (this.range){\n if (date > this.range[0] && date < this.range[this.range.length-1]){\n cls.push('range');\n }\n if ($.inArray(date.valueOf(), this.range) !== -1){\n cls.push('selected');\n }\n if (date.valueOf() === this.range[0]){\n cls.push('range-start');\n }\n if (date.valueOf() === this.range[this.range.length-1]){\n cls.push('range-end');\n }\n }\n return cls;\n },\n\n _fill_yearsView: function(selector, cssClass, factor, year, startYear, endYear, beforeFn){\n var html = '';\n var step = factor / 10;\n var view = this.picker.find(selector);\n var startVal = Math.floor(year / factor) * factor;\n var endVal = startVal + step * 9;\n var focusedVal = Math.floor(this.viewDate.getFullYear() / step) * step;\n var selected = $.map(this.dates, function(d){\n return Math.floor(d.getUTCFullYear() / step) * step;\n });\n\n var classes, tooltip, before;\n for (var currVal = startVal - step; currVal <= endVal + step; currVal += step) {\n classes = [cssClass];\n tooltip = null;\n\n if (currVal === startVal - step) {\n classes.push('old');\n } else if (currVal === endVal + step) {\n classes.push('new');\n }\n if ($.inArray(currVal, selected) !== -1) {\n classes.push('active');\n }\n if (currVal < startYear || currVal > endYear) {\n classes.push('disabled');\n }\n if (currVal === focusedVal) {\n classes.push('focused');\n }\n\n if (beforeFn !== $.noop) {\n before = beforeFn(new Date(currVal, 0, 1));\n if (before === undefined) {\n before = {};\n } else if (typeof before === 'boolean') {\n before = {enabled: before};\n } else if (typeof before === 'string') {\n before = {classes: before};\n }\n if (before.enabled === false) {\n classes.push('disabled');\n }\n if (before.classes) {\n classes = classes.concat(before.classes.split(/\\s+/));\n }\n if (before.tooltip) {\n tooltip = before.tooltip;\n }\n }\n\n html += '' + currVal + '';\n }\n\n view.find('.datepicker2-switch').text(startVal + '-' + endVal);\n view.find('td').html(html);\n },\n\n fill: function(){\n var d = new Date(this.viewDate),\n year = d.getUTCFullYear(),\n month = d.getUTCMonth(),\n startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,\n startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,\n endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,\n endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,\n todaytxt = dates[this.o.language].today || dates['en'].today || '',\n cleartxt = dates[this.o.language].clear || dates['en'].clear || '',\n titleFormat = dates[this.o.language].titleFormat || dates['en'].titleFormat,\n todayDate = UTCToday(),\n titleBtnVisible = (this.o.todayBtn === true || this.o.todayBtn === 'linked') && todayDate >= this.o.startDate && todayDate <= this.o.endDate && !this.weekOfDateIsDisabled(todayDate),\n tooltip,\n before;\n if (isNaN(year) || isNaN(month))\n return;\n this.picker.find('.datepicker2-days .datepicker2-switch')\n .text(DPGlobal.formatDate(d, titleFormat, this.o.language));\n this.picker.find('tfoot .today')\n .text(todaytxt)\n .css('display', titleBtnVisible ? 'table-cell' : 'none');\n this.picker.find('tfoot .clear')\n .text(cleartxt)\n .css('display', this.o.clearBtn === true ? 'table-cell' : 'none');\n this.picker.find('thead .datepicker2-title')\n .text(this.o.title)\n .css('display', typeof this.o.title === 'string' && this.o.title !== '' ? 'table-cell' : 'none');\n this.updateNavArrows();\n this.fillMonths();\n var prevMonth = UTCDate(year, month, 0),\n day = prevMonth.getUTCDate();\n prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);\n var nextMonth = new Date(prevMonth);\n if (prevMonth.getUTCFullYear() < 100){\n nextMonth.setUTCFullYear(prevMonth.getUTCFullYear());\n }\n nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);\n nextMonth = nextMonth.valueOf();\n var html = [];\n var weekDay, clsName;\n while (prevMonth.valueOf() < nextMonth){\n weekDay = prevMonth.getUTCDay();\n if (weekDay === this.o.weekStart){\n html.push('
');\n if (this.o.calendarWeeks){\n // ISO 8601: First week contains first thursday.\n // ISO also states week starts on Monday, but we can be more abstract here.\n var\n // Start of current week: based on weekstart/current date\n ws = new Date(+prevMonth + (this.o.weekStart - weekDay - 7) % 7 * 864e5),\n // Thursday of this week\n th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),\n // First Thursday of year, year from thursday\n yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay()) % 7 * 864e5),\n // Calendar week: ms between thursdays, div ms per day, div 7 days\n calWeek = (th - yth) / 864e5 / 7 + 1;\n html.push('
'+ calWeek +'
');\n }\n }\n clsName = this.getClassNames(prevMonth);\n clsName.push('day');\n\n var content = prevMonth.getUTCDate();\n\n if (this.o.beforeShowDay !== $.noop){\n before = this.o.beforeShowDay(this._utc_to_local(prevMonth));\n if (before === undefined)\n before = {};\n else if (typeof before === 'boolean')\n before = {enabled: before};\n else if (typeof before === 'string')\n before = {classes: before};\n if (before.enabled === false)\n clsName.push('disabled');\n if (before.classes)\n clsName = clsName.concat(before.classes.split(/\\s+/));\n if (before.tooltip)\n tooltip = before.tooltip;\n if (before.content)\n content = before.content;\n }\n\n //Check if uniqueSort exists (supported by jquery >=1.12 and >=2.2)\n //Fallback to unique function for older jquery versions\n if ($.isFunction($.uniqueSort)) {\n clsName = $.uniqueSort(clsName);\n } else {\n clsName = $.unique(clsName);\n }\n\n html.push('
' + content + '
');\n tooltip = null;\n if (weekDay === this.o.weekEnd){\n html.push('
');\n }\n prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);\n }\n this.picker.find('.datepicker2-days tbody').html(html.join(''));\n\n var monthsTitle = dates[this.o.language].monthsTitle || dates['en'].monthsTitle || 'Months';\n var months = this.picker.find('.datepicker2-months')\n .find('.datepicker2-switch')\n .text(this.o.maxViewMode < 2 ? monthsTitle : year)\n .end()\n .find('tbody span').removeClass('active');\n\n $.each(this.dates, function(i, d){\n if (d.getUTCFullYear() === year)\n months.eq(d.getUTCMonth()).addClass('active');\n });\n\n if (year < startYear || year > endYear){\n months.addClass('disabled');\n }\n if (year === startYear){\n months.slice(0, startMonth).addClass('disabled');\n }\n if (year === endYear){\n months.slice(endMonth+1).addClass('disabled');\n }\n\n if (this.o.beforeShowMonth !== $.noop){\n var that = this;\n $.each(months, function(i, month){\n var moDate = new Date(year, i, 1);\n var before = that.o.beforeShowMonth(moDate);\n if (before === undefined)\n before = {};\n else if (typeof before === 'boolean')\n before = {enabled: before};\n else if (typeof before === 'string')\n before = {classes: before};\n if (before.enabled === false && !$(month).hasClass('disabled'))\n $(month).addClass('disabled');\n if (before.classes)\n $(month).addClass(before.classes);\n if (before.tooltip)\n $(month).prop('title', before.tooltip);\n });\n }\n\n // Generating decade/years picker\n this._fill_yearsView(\n '.datepicker2-years',\n 'year',\n 10,\n year,\n startYear,\n endYear,\n this.o.beforeShowYear\n );\n\n // Generating century/decades picker\n this._fill_yearsView(\n '.datepicker2-decades',\n 'decade',\n 100,\n year,\n startYear,\n endYear,\n this.o.beforeShowDecade\n );\n\n // Generating millennium/centuries picker\n this._fill_yearsView(\n '.datepicker2-centuries',\n 'century',\n 1000,\n year,\n startYear,\n endYear,\n this.o.beforeShowCentury\n );\n },\n\n updateNavArrows: function(){\n if (!this._allow_update)\n return;\n\n var d = new Date(this.viewDate),\n year = d.getUTCFullYear(),\n month = d.getUTCMonth(),\n startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,\n startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,\n endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,\n endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,\n prevIsDisabled,\n nextIsDisabled,\n factor = 1;\n switch (this.viewMode){\n case 4:\n factor *= 10;\n /* falls through */\n case 3:\n factor *= 10;\n /* falls through */\n case 2:\n factor *= 10;\n /* falls through */\n case 1:\n prevIsDisabled = Math.floor(year / factor) * factor <= startYear;\n nextIsDisabled = Math.floor(year / factor) * factor + factor > endYear;\n break;\n case 0:\n prevIsDisabled = year <= startYear && month <= startMonth;\n nextIsDisabled = year >= endYear && month >= endMonth;\n break;\n }\n\n this.picker.find('.prev').toggleClass('disabled', prevIsDisabled);\n this.picker.find('.next').toggleClass('disabled', nextIsDisabled);\n },\n\n click: function(e){\n e.preventDefault();\n e.stopPropagation();\n\n var target, dir, day, year, month;\n target = $(e.target);\n\n // Clicked on the switch\n if (target.hasClass('datepicker2-switch') && this.viewMode !== this.o.maxViewMode){\n this.setViewMode(this.viewMode + 1);\n }\n\n // Clicked on today button\n if (target.hasClass('today') && !target.hasClass('day')){\n this.setViewMode(0);\n this._setDate(UTCToday(), this.o.todayBtn === 'linked' ? null : 'view');\n }\n\n // Clicked on clear button\n if (target.hasClass('clear')){\n this.clearDates();\n }\n\n if (!target.hasClass('disabled')){\n // Clicked on a month, year, decade, century\n if (target.hasClass('month')\n || target.hasClass('year')\n || target.hasClass('decade')\n || target.hasClass('century')) {\n this.viewDate.setUTCDate(1);\n\n day = 1;\n if (this.viewMode === 1){\n month = target.parent().find('span').index(target);\n year = this.viewDate.getUTCFullYear();\n this.viewDate.setUTCMonth(month);\n } else {\n month = 0;\n year = Number(target.text());\n this.viewDate.setUTCFullYear(year);\n }\n\n this._trigger(DPGlobal.viewModes[this.viewMode - 1].e, this.viewDate);\n\n if (this.viewMode === this.o.minViewMode){\n this._setDate(UTCDate(year, month, day));\n } else {\n this.setViewMode(this.viewMode - 1);\n this.fill();\n }\n }\n }\n\n if (this.picker.is(':visible') && this._focused_from){\n this._focused_from.focus();\n }\n delete this._focused_from;\n },\n\n dayCellClick: function(e){\n var $target = $(e.currentTarget);\n var timestamp = $target.data('date');\n var date = new Date(timestamp);\n\n if (this.o.updateViewDate) {\n if (date.getUTCFullYear() !== this.viewDate.getUTCFullYear()) {\n this._trigger('changeYear', this.viewDate);\n }\n\n if (date.getUTCMonth() !== this.viewDate.getUTCMonth()) {\n this._trigger('changeMonth', this.viewDate);\n }\n }\n this._setDate(date);\n },\n\n // Clicked on prev or next\n navArrowsClick: function(e){\n var $target = $(e.currentTarget);\n var dir = $target.hasClass('prev') ? -1 : 1;\n if (this.viewMode !== 0){\n dir *= DPGlobal.viewModes[this.viewMode].navStep * 12;\n }\n this.viewDate = this.moveMonth(this.viewDate, dir);\n this._trigger(DPGlobal.viewModes[this.viewMode].e, this.viewDate);\n this.fill();\n },\n\n _toggle_multidate: function(date){\n var ix = this.dates.contains(date);\n if (!date){\n this.dates.clear();\n }\n\n if (ix !== -1){\n if (this.o.multidate === true || this.o.multidate > 1 || this.o.toggleActive){\n this.dates.remove(ix);\n }\n } else if (this.o.multidate === false) {\n this.dates.clear();\n this.dates.push(date);\n }\n else {\n this.dates.push(date);\n }\n\n if (typeof this.o.multidate === 'number')\n while (this.dates.length > this.o.multidate)\n this.dates.remove(0);\n },\n\n _setDate: function(date, which){\n if (!which || which === 'date')\n this._toggle_multidate(date && new Date(date));\n if ((!which && this.o.updateViewDate) || which === 'view')\n this.viewDate = date && new Date(date);\n\n this.fill();\n this.setValue();\n if (!which || which !== 'view') {\n this._trigger('changeDate');\n }\n this.inputField.trigger('change');\n if (this.o.autoclose && (!which || which === 'date')){\n this.hide();\n }\n },\n\n moveDay: function(date, dir){\n var newDate = new Date(date);\n newDate.setUTCDate(date.getUTCDate() + dir);\n\n return newDate;\n },\n\n moveWeek: function(date, dir){\n return this.moveDay(date, dir * 7);\n },\n\n moveMonth: function(date, dir){\n if (!isValidDate(date))\n return this.o.defaultViewDate;\n if (!dir)\n return date;\n var new_date = new Date(date.valueOf()),\n day = new_date.getUTCDate(),\n month = new_date.getUTCMonth(),\n mag = Math.abs(dir),\n new_month, test;\n dir = dir > 0 ? 1 : -1;\n if (mag === 1){\n test = dir === -1\n // If going back one month, make sure month is not current month\n // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)\n ? function(){\n return new_date.getUTCMonth() === month;\n }\n // If going forward one month, make sure month is as expected\n // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)\n : function(){\n return new_date.getUTCMonth() !== new_month;\n };\n new_month = month + dir;\n new_date.setUTCMonth(new_month);\n // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11\n new_month = (new_month + 12) % 12;\n }\n else {\n // For magnitudes >1, move one month at a time...\n for (var i=0; i < mag; i++)\n // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...\n new_date = this.moveMonth(new_date, dir);\n // ...then reset the day, keeping it in the new month\n new_month = new_date.getUTCMonth();\n new_date.setUTCDate(day);\n test = function(){\n return new_month !== new_date.getUTCMonth();\n };\n }\n // Common date-resetting loop -- if date is beyond end of month, make it\n // end of month\n while (test()){\n new_date.setUTCDate(--day);\n new_date.setUTCMonth(new_month);\n }\n return new_date;\n },\n\n moveYear: function(date, dir){\n return this.moveMonth(date, dir*12);\n },\n\n moveAvailableDate: function(date, dir, fn){\n do {\n date = this[fn](date, dir);\n\n if (!this.dateWithinRange(date))\n return false;\n\n fn = 'moveDay';\n }\n while (this.dateIsDisabled(date));\n\n return date;\n },\n\n weekOfDateIsDisabled: function(date){\n return $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1;\n },\n\n dateIsDisabled: function(date){\n return (\n this.weekOfDateIsDisabled(date) ||\n $.grep(this.o.datesDisabled, function(d){\n return isUTCEquals(date, d);\n }).length > 0\n );\n },\n\n dateWithinRange: function(date){\n return date >= this.o.startDate && date <= this.o.endDate;\n },\n\n keydown: function(e){\n if (!this.picker.is(':visible')){\n if (e.keyCode === 40 || e.keyCode === 27) { // allow down to re-show picker\n this.show();\n e.stopPropagation();\n }\n return;\n }\n var dateChanged = false,\n dir, newViewDate,\n focusDate = this.focusDate || this.viewDate;\n switch (e.keyCode){\n case 27: // escape\n if (this.focusDate){\n this.focusDate = null;\n this.viewDate = this.dates.get(-1) || this.viewDate;\n this.fill();\n }\n else\n this.hide();\n e.preventDefault();\n e.stopPropagation();\n break;\n case 37: // left\n case 38: // up\n case 39: // right\n case 40: // down\n if (!this.o.keyboardNavigation || this.o.daysOfWeekDisabled.length === 7)\n break;\n dir = e.keyCode === 37 || e.keyCode === 38 ? -1 : 1;\n if (this.viewMode === 0) {\n if (e.ctrlKey){\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear');\n\n if (newViewDate)\n this._trigger('changeYear', this.viewDate);\n } else if (e.shiftKey){\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth');\n\n if (newViewDate)\n this._trigger('changeMonth', this.viewDate);\n } else if (e.keyCode === 37 || e.keyCode === 39){\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveDay');\n } else if (!this.weekOfDateIsDisabled(focusDate)){\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveWeek');\n }\n } else if (this.viewMode === 1) {\n if (e.keyCode === 38 || e.keyCode === 40) {\n dir = dir * 4;\n }\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth');\n } else if (this.viewMode === 2) {\n if (e.keyCode === 38 || e.keyCode === 40) {\n dir = dir * 4;\n }\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear');\n }\n if (newViewDate){\n this.focusDate = this.viewDate = newViewDate;\n this.setValue();\n this.fill();\n e.preventDefault();\n }\n break;\n case 13: // enter\n if (!this.o.forceParse)\n break;\n focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;\n if (this.o.keyboardNavigation) {\n this._toggle_multidate(focusDate);\n dateChanged = true;\n }\n this.focusDate = null;\n this.viewDate = this.dates.get(-1) || this.viewDate;\n this.setValue();\n this.fill();\n if (this.picker.is(':visible')){\n e.preventDefault();\n e.stopPropagation();\n if (this.o.autoclose)\n this.hide();\n }\n break;\n case 9: // tab\n this.focusDate = null;\n this.viewDate = this.dates.get(-1) || this.viewDate;\n this.fill();\n this.hide();\n break;\n }\n if (dateChanged){\n if (this.dates.length)\n this._trigger('changeDate');\n else\n this._trigger('clearDate');\n this.inputField.trigger('change');\n }\n },\n\n setViewMode: function(viewMode){\n this.viewMode = viewMode;\n this.picker\n .children('div')\n .hide()\n .filter('.datepicker2-' + DPGlobal.viewModes[this.viewMode].clsName)\n .show();\n this.updateNavArrows();\n this._trigger('changeViewMode', new Date(this.viewDate));\n }\n };\n\n var DateRangePicker = function(element, options){\n $.data(element, 'datepicker2', this);\n this.element = $(element);\n this.inputs = $.map(options.inputs, function(i){\n return i.jquery ? i[0] : i;\n });\n delete options.inputs;\n\n this.keepEmptyValues = options.keepEmptyValues;\n delete options.keepEmptyValues;\n\n datepicker2Plugin.call($(this.inputs), options)\n .on('changeDate', $.proxy(this.dateUpdated, this));\n\n this.pickers = $.map(this.inputs, function(i){\n return $.data(i, 'datepicker2');\n });\n this.updateDates();\n };\n DateRangePicker.prototype = {\n updateDates: function(){\n this.dates = $.map(this.pickers, function(i){\n return i.getUTCDate();\n });\n this.updateRanges();\n },\n updateRanges: function(){\n var range = $.map(this.dates, function(d){\n return d.valueOf();\n });\n $.each(this.pickers, function(i, p){\n p.setRange(range);\n });\n },\n clearDates: function(){\n $.each(this.pickers, function(i, p){\n p.clearDates();\n });\n },\n dateUpdated: function(e){\n // `this.updating` is a workaround for preventing infinite recursion\n // between `changeDate` triggering and `setUTCDate` calling. Until\n // there is a better mechanism.\n if (this.updating)\n return;\n this.updating = true;\n\n var dp = $.data(e.target, 'datepicker2');\n\n if (dp === undefined) {\n return;\n }\n\n var new_date = dp.getUTCDate(),\n keep_empty_values = this.keepEmptyValues,\n i = $.inArray(e.target, this.inputs),\n j = i - 1,\n k = i + 1,\n l = this.inputs.length;\n if (i === -1)\n return;\n\n $.each(this.pickers, function(i, p){\n if (!p.getUTCDate() && (p === dp || !keep_empty_values))\n p.setUTCDate(new_date);\n });\n\n if (new_date < this.dates[j]){\n // Date being moved earlier/left\n while (j >= 0 && new_date < this.dates[j]){\n this.pickers[j--].setUTCDate(new_date);\n }\n } else if (new_date > this.dates[k]){\n // Date being moved later/right\n while (k < l && new_date > this.dates[k]){\n this.pickers[k++].setUTCDate(new_date);\n }\n }\n this.updateDates();\n\n delete this.updating;\n },\n destroy: function(){\n $.map(this.pickers, function(p){ p.destroy(); });\n $(this.inputs).off('changeDate', this.dateUpdated);\n delete this.element.data().datepicker2;\n },\n remove: alias('destroy', 'Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead')\n };\n\n function opts_from_el(el, prefix){\n // Derive options from element data-attrs\n var data = $(el).data(),\n out = {}, inkey,\n replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');\n prefix = new RegExp('^' + prefix.toLowerCase());\n function re_lower(_,a){\n return a.toLowerCase();\n }\n for (var key in data)\n if (prefix.test(key)){\n inkey = key.replace(replace, re_lower);\n out[inkey] = data[key];\n }\n return out;\n }\n\n function opts_from_locale(lang){\n // Derive options from locale plugins\n var out = {};\n // Check if \"de-DE\" style date is available, if not language should\n // fallback to 2 letter code eg \"de\"\n if (!dates[lang]){\n lang = lang.split('-')[0];\n if (!dates[lang])\n return;\n }\n var d = dates[lang];\n $.each(locale_opts, function(i,k){\n if (k in d)\n out[k] = d[k];\n });\n return out;\n }\n\n var old = $.fn.datepicker2;\n var datepicker2Plugin = function(option){\n var args = Array.apply(null, arguments);\n args.shift();\n var internal_return;\n this.each(function(){\n var $this = $(this),\n data = $this.data('datepicker2'),\n options = typeof option === 'object' && option;\n if (!data){\n var elopts = opts_from_el(this, 'date'),\n // Preliminary otions\n xopts = $.extend({}, defaults, elopts, options),\n locopts = opts_from_locale(xopts.language),\n // Options priority: js args, data-attrs, locales, defaults\n opts = $.extend({}, defaults, locopts, elopts, options);\n if ($this.hasClass('input-daterange') || opts.inputs){\n $.extend(opts, {\n inputs: opts.inputs || $this.find('input').toArray()\n });\n data = new DateRangePicker(this, opts);\n }\n else {\n data = new Datepicker2(this, opts);\n }\n $this.data('datepicker2', data);\n }\n if (typeof option === 'string' && typeof data[option] === 'function'){\n internal_return = data[option].apply(data, args);\n }\n });\n\n if (\n internal_return === undefined ||\n internal_return instanceof Datepicker2 ||\n internal_return instanceof DateRangePicker\n )\n return this;\n\n if (this.length > 1)\n throw new Error('Using only allowed for the collection of a single element (' + option + ' function)');\n else\n return internal_return;\n };\n $.fn.datepicker2 = datepicker2Plugin;\n\n var defaults = $.fn.datepicker2.defaults = {\n assumeNearbyYear: false,\n autoclose: false,\n beforeShowDay: $.noop,\n beforeShowMonth: $.noop,\n beforeShowYear: $.noop,\n beforeShowDecade: $.noop,\n beforeShowCentury: $.noop,\n calendarWeeks: false,\n clearBtn: false,\n toggleActive: false,\n daysOfWeekDisabled: [],\n daysOfWeekHighlighted: [],\n datesDisabled: [],\n endDate: Infinity,\n forceParse: true,\n format: 'mm/dd/yyyy',\n keepEmptyValues: false,\n keyboardNavigation: true,\n language: 'en',\n minViewMode: 0,\n maxViewMode: 4,\n multidate: false,\n multidateSeparator: ',',\n orientation: \"auto\",\n rtl: false,\n startDate: -Infinity,\n startView: 0,\n todayBtn: false,\n todayHighlight: false,\n updateViewDate: true,\n weekStart: 0,\n disableTouchKeyboard: false,\n enableOnReadonly: true,\n showOnFocus: true,\n zIndexOffset: 10,\n container: 'body',\n immediateUpdates: false,\n title: '',\n templates: {\n leftArrow: '«',\n rightArrow: '»'\n },\n showWeekDays: true\n };\n var locale_opts = $.fn.datepicker2.locale_opts = [\n 'format',\n 'rtl',\n 'weekStart'\n ];\n $.fn.datepicker2.Constructor = Datepicker2;\n var dates = $.fn.datepicker2.dates = {\n en: {\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n daysShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n daysMin: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n monthsShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n today: \"Today\",\n clear: \"Clear\",\n titleFormat: \"MM yyyy\"\n }\n };\n\n var DPGlobal = {\n viewModes: [\n {\n names: ['days', 'month'],\n clsName: 'days',\n e: 'changeMonth'\n },\n {\n names: ['months', 'year'],\n clsName: 'months',\n e: 'changeYear',\n navStep: 1\n },\n {\n names: ['years', 'decade'],\n clsName: 'years',\n e: 'changeDecade',\n navStep: 10\n },\n {\n names: ['decades', 'century'],\n clsName: 'decades',\n e: 'changeCentury',\n navStep: 100\n },\n {\n names: ['centuries', 'millennium'],\n clsName: 'centuries',\n e: 'changeMillennium',\n navStep: 1000\n }\n ],\n validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,\n nonpunctuation: /[^ -\\/:-@\\u5e74\\u6708\\u65e5\\[-`{-~\\t\\n\\r]+/g,\n parseFormat: function(format){\n if (typeof format.toValue === 'function' && typeof format.toDisplay === 'function')\n return format;\n // IE treats \\0 as a string end in inputs (truncating the value),\n // so it's a bad format delimiter, anyway\n var separators = format.replace(this.validParts, '\\0').split('\\0'),\n parts = format.match(this.validParts);\n if (!separators || !separators.length || !parts || parts.length === 0){\n throw new Error(\"Invalid date format.\");\n }\n return {separators: separators, parts: parts};\n },\n parseDate: function(date, format, language, assumeNearby){\n if (!date)\n return undefined;\n if (date instanceof Date)\n return date;\n if (typeof format === 'string')\n format = DPGlobal.parseFormat(format);\n if (format.toValue)\n return format.toValue(date, format, language);\n var fn_map = {\n d: 'moveDay',\n m: 'moveMonth',\n w: 'moveWeek',\n y: 'moveYear'\n },\n dateAliases = {\n yesterday: '-1d',\n today: '+0d',\n tomorrow: '+1d'\n },\n parts, part, dir, i, fn;\n if (date in dateAliases){\n date = dateAliases[date];\n }\n if (/^[\\-+]\\d+[dmwy]([\\s,]+[\\-+]\\d+[dmwy])*$/i.test(date)){\n parts = date.match(/([\\-+]\\d+)([dmwy])/gi);\n date = new Date();\n for (i=0; i < parts.length; i++){\n part = parts[i].match(/([\\-+]\\d+)([dmwy])/i);\n dir = Number(part[1]);\n fn = fn_map[part[2].toLowerCase()];\n date = Datepicker2.prototype[fn](date, dir);\n }\n return Datepicker2.prototype._zero_utc_time(date);\n }\n\n parts = date && date.match(this.nonpunctuation) || [];\n\n function applyNearbyYear(year, threshold){\n if (threshold === true)\n threshold = 10;\n\n // if year is 2 digits or less, than the user most likely is trying to get a recent century\n if (year < 100){\n year += 2000;\n // if the new year is more than threshold years in advance, use last century\n if (year > ((new Date()).getFullYear()+threshold)){\n year -= 100;\n }\n }\n\n return year;\n }\n\n var parsed = {},\n setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],\n setters_map = {\n yyyy: function(d,v){\n return d.setUTCFullYear(assumeNearby ? applyNearbyYear(v, assumeNearby) : v);\n },\n m: function(d,v){\n if (isNaN(d))\n return d;\n v -= 1;\n while (v < 0) v += 12;\n v %= 12;\n d.setUTCMonth(v);\n while (d.getUTCMonth() !== v)\n d.setUTCDate(d.getUTCDate()-1);\n return d;\n },\n d: function(d,v){\n return d.setUTCDate(v);\n }\n },\n val, filtered;\n setters_map['yy'] = setters_map['yyyy'];\n setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];\n setters_map['dd'] = setters_map['d'];\n date = UTCToday();\n var fparts = format.parts.slice();\n // Remove noop parts\n if (parts.length !== fparts.length){\n fparts = $(fparts).filter(function(i,p){\n return $.inArray(p, setters_order) !== -1;\n }).toArray();\n }\n // Process remainder\n function match_part(){\n var m = this.slice(0, parts[i].length),\n p = parts[i].slice(0, m.length);\n return m.toLowerCase() === p.toLowerCase();\n }\n if (parts.length === fparts.length){\n var cnt;\n for (i=0, cnt = fparts.length; i < cnt; i++){\n val = parseInt(parts[i], 10);\n part = fparts[i];\n if (isNaN(val)){\n switch (part){\n case 'MM':\n filtered = $(dates[language].months).filter(match_part);\n val = $.inArray(filtered[0], dates[language].months) + 1;\n break;\n case 'M':\n filtered = $(dates[language].monthsShort).filter(match_part);\n val = $.inArray(filtered[0], dates[language].monthsShort) + 1;\n break;\n }\n }\n parsed[part] = val;\n }\n var _date, s;\n for (i=0; i < setters_order.length; i++){\n s = setters_order[i];\n if (s in parsed && !isNaN(parsed[s])){\n _date = new Date(date);\n setters_map[s](_date, parsed[s]);\n if (!isNaN(_date))\n date = _date;\n }\n }\n }\n return date;\n },\n formatDate: function(date, format, language){\n if (!date)\n return '';\n if (typeof format === 'string')\n format = DPGlobal.parseFormat(format);\n if (format.toDisplay)\n return format.toDisplay(date, format, language);\n var val = {\n d: date.getUTCDate(),\n D: dates[language].daysShort[date.getUTCDay()],\n DD: dates[language].days[date.getUTCDay()],\n m: date.getUTCMonth() + 1,\n M: dates[language].monthsShort[date.getUTCMonth()],\n MM: dates[language].months[date.getUTCMonth()],\n yy: date.getUTCFullYear().toString().substring(2),\n yyyy: date.getUTCFullYear()\n };\n val.dd = (val.d < 10 ? '0' : '') + val.d;\n val.mm = (val.m < 10 ? '0' : '') + val.m;\n date = [];\n var seps = $.extend([], format.separators);\n for (var i=0, cnt = format.parts.length; i <= cnt; i++){\n if (seps.length)\n date.push(seps.shift());\n date.push(val[format.parts[i]]);\n }\n return date.join('');\n },\n headTemplate: ''+\n '
';\n\n $.fn.datepicker2.DPGlobal = DPGlobal;\n\n\n /* DATEPICKER NO CONFLICT\n * =================== */\n\n $.fn.datepicker2.noConflict = function(){\n $.fn.datepicker2 = old;\n return this;\n };\n\n /* DATEPICKER VERSION\n * =================== */\n $.fn.datepicker2.version = '1.9.0';\n\n $.fn.datepicker2.deprecated = function(msg){\n var console = window.console;\n if (console && console.warn) {\n console.warn('DEPRECATED: ' + msg);\n }\n };\n\n\n /* DATEPICKER DATA-API\n * ================== */\n\n $(document).on(\n 'focus.datepicker2.data-api click.datepicker2.data-api',\n '[data-provide=\"datepicker2\"]',\n function(e){\n var $this = $(this);\n if ($this.data('datepicker2'))\n return;\n e.preventDefault();\n // component click requires us to explicitly show it\n datepicker2Plugin.call($this, 'show');\n }\n );\n $(function(){\n datepicker2Plugin.call($('[data-provide=\"datepicker2-inline\"]'));\n });\n\n}));\n"],"names":["factory","$","undefined","UTCDate","Date","UTC","apply","arguments","UTCToday","today","getFullYear","getMonth","getDate","isUTCEquals","date1","date2","getUTCFullYear","getUTCMonth","getUTCDate","alias","method","deprecationMsg","fn","datepicker2","deprecated","this","extras","DateArray","get","i","slice","contains","d","val","valueOf","l","length","remove","splice","replace","new_array","isArray","clear","push","copy","a","extend","Datepicker2","element","options","data","_events","_secondaryEvents","_process_options","dates","viewDate","o","defaultViewDate","focusDate","isInput","is","inputField","find","component","hasClass","isInline","picker","DPGlobal","template","_check_template","templates","leftArrow","html","rightArrow","_buildEvents","_attachEvents","addClass","appendTo","rtl","calendarWeeks","attr","Number","startDate","_o","endDate","daysOfWeekDisabled","daysOfWeekHighlighted","datesDisabled","_allow_update","setViewMode","startView","fillDow","fillMonths","update","show","prototype","constructor","_resolveViewName","view","each","viewModes","viewMode","inArray","names","_resolveDaysOfWeek","daysOfWeek","split","map","tmp","match","ex","opts","lang","language","defaults","minViewMode","maxViewMode","Math","max","min","multidate","multidateSeparator","String","weekStart","weekEnd","format","parseFormat","_local_to_utc","_zero_time","parseDate","assumeNearbyYear","Infinity","plc","orientation","toLowerCase","_plc","grep","word","test","x","y","year","month","day","_applyEvents","evs","el","ch","ev","on","_unapplyEvents","off","events","keyup","proxy","e","keyCode","keydown","paste","showOnFocus","focus","click","blur","_focused_from","target","immediateUpdates","date","navArrowsClick","dayCellClick","window","resize","place","document","hide","_detachEvents","_attachSecondaryEvents","_detachSecondaryEvents","_trigger","event","altdate","local_date","_utc_to_local","trigger","type","ix","formatDate","prop","enableOnReadonly","container","navigator","msMaxTouchPoints","disableTouchKeyboard","detach","forceParse","setValue","destroy","dateString","originalEvent","clipboardData","types","getData","setDate","preventDefault","utc","local","getTime","getTimezoneOffset","_zero_utc_time","getDates","getUTCDates","selected_date","clearDates","autoclose","setDates","args","setUTCDates","setUTCDate","formatted","getFormattedDate","join","getStartDate","setStartDate","updateNavArrows","getEndDate","setEndDate","setDaysOfWeekDisabled","setDaysOfWeekHighlighted","setDatesDisabled","calendarWidth","outerWidth","calendarHeight","outerHeight","windowWidth","width","scrollTop","appendOffset","offset","parentsZindex","parents","itemZIndex","css","zIndex","zIndexOffset","parent","height","left","top","removeClass","yorient","parseInt","right","oldDates","fromArgs","dateWithinRange","updateViewDate","change","fill","showWeekDays","dowCnt","daysMin","append","localDate","monthsShort","setRange","range","getClassNames","cls","todayHighlight","dateIsDisabled","getUTCDay","_fill_yearsView","selector","cssClass","factor","startYear","endYear","beforeFn","classes","tooltip","before","step","startVal","floor","endVal","focusedVal","selected","currVal","noop","enabled","concat","text","startMonth","endMonth","todaytxt","cleartxt","titleFormat","todayDate","titleBtnVisible","todayBtn","weekOfDateIsDisabled","isNaN","clearBtn","title","prevMonth","nextMonth","setUTCFullYear","weekDay","clsName","ws","th","yth","calWeek","content","beforeShowDay","isFunction","uniqueSort","unique","toString","monthsTitle","months","end","eq","beforeShowMonth","that","moDate","beforeShowYear","beforeShowDecade","beforeShowCentury","prevIsDisabled","nextIsDisabled","toggleClass","stopPropagation","_setDate","index","setUTCMonth","timestamp","currentTarget","dir","navStep","moveMonth","_toggle_multidate","toggleActive","which","moveDay","newDate","moveWeek","new_month","new_date","mag","abs","moveYear","moveAvailableDate","newViewDate","dateChanged","keyboardNavigation","ctrlKey","shiftKey","children","filter","DateRangePicker","inputs","jquery","keepEmptyValues","datepicker2Plugin","call","dateUpdated","pickers","updateDates","opts_from_el","prefix","out","RegExp","re_lower","_","key","opts_from_locale","locale_opts","k","updateRanges","p","updating","dp","keep_empty_values","j","old","option","internal_return","Array","shift","$this","elopts","locopts","toArray","Error","Constructor","en","days","daysShort","validParts","nonpunctuation","toValue","toDisplay","separators","parts","assumeNearby","part","fn_map","m","w","dateAliases","yesterday","tomorrow","filtered","parsed","setters_order","setters_map","yyyy","v","threshold","fparts","match_part","cnt","_date","s","D","DD","M","MM","yy","substring","dd","mm","seps","headTemplate","contTemplate","footTemplate","noConflict","version","msg","console","warn","define","amd","exports","require","jQuery"],"mappings":"AAMC,IAASA,QAAAA,QAQR,SAASC,EAAGC,sBACDC,iBACE,IAAIC,KAAKA,KAAKC,IAAIC,MAAMF,KAAMG,qBAEhCC,eACDC,MAAQ,IAAIL,YACTD,QAAQM,MAAMC,cAAeD,MAAME,WAAYF,MAAMG,oBAEvDC,YAAYC,MAAOC,cAEpBD,MAAME,mBAAqBD,MAAMC,kBACjCF,MAAMG,gBAAkBF,MAAME,eAC9BH,MAAMI,eAAiBH,MAAMG,sBAG5BC,MAAMC,OAAQC,uBACZ,kBACCA,iBAAmBnB,aACnBD,EAAEqB,GAAGC,YAAYC,WAAWH,gBAGzBI,KAAKL,QAAQd,MAAMmB,KAAMlB,gBAQhCmB,OADJC,WACID,OAAS,CACTE,IAAK,SAASC,UACHJ,KAAKK,MAAMD,GAAG,IAEzBE,SAAU,SAASC,WAGXC,IAAMD,GAAKA,EAAEE,UACRL,EAAE,EAAGM,EAAEV,KAAKW,OAAQP,EAAIM,EAAGN,IAEhC,GAAI,GAAKJ,KAAKI,GAAGK,UAAYD,KAAOR,KAAKI,GAAGK,UAAYD,IAAM,MAC1D,OAAOJ,SACP,GAEZQ,OAAQ,SAASR,QACRS,OAAOT,EAAE,IAElBU,QAAS,SAASC,WACTA,YAEAvC,EAAEwC,QAAQD,aACXA,UAAY,CAACA,iBACZE,aACAC,KAAKrC,MAAMmB,KAAMe,aAE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AKU/T,SAAS5C,UAAUC,UAL7B,yEAOU2C,SAAS5C,UAAUG,WAP7B,qBAUdyW,aAAc,gDACdC,aAAc,2GASlBhX,SAASC,SAAW,yFAGhBD,SAAS8W,aACT,kBACA9W,SAASgX,aALO,gFAUhBhX,SAAS8W,aACT9W,SAAS+W,aACT/W,SAASgX,aAZO,+EAiBhBhX,SAAS8W,aACT9W,SAAS+W,aACT/W,SAASgX,aAnBO,iFAwBhBhX,SAAS8W,aACT9W,SAAS+W,aACT/W,SAASgX,aA1BO,mFA+BhBhX,SAAS8W,aACT9W,SAAS+W,aACT/W,SAASgX,aAjCO,uBAsCpBlb,EAAEqB,GAAGC,YAAY4C,SAAWA,SAM5BlE,EAAEqB,GAAGC,YAAY6Z,WAAa,kBAC1Bnb,EAAEqB,GAAGC,YAAcyW,IACZvW,MAKXxB,EAAEqB,GAAGC,YAAY8Z,QAAU,QAE3Bpb,EAAEqB,GAAGC,YAAYC,WAAa,SAAS8Z,SAC/BC,QAAU9Q,OAAO8Q,QACjBA,SAAWA,QAAQC,MACnBD,QAAQC,KAAK,eAAiBF,MAQtCrb,EAAE2K,UAAUvB,GACR,wDACA,gCACA,SAASM,OACD0O,MAAQpY,EAAEwB,MACV4W,MAAMnV,KAAK,iBAEfyG,EAAE+C,iBAEFiK,kBAAkBC,KAAKyB,MAAO,YAGtCpY,GAAE,WACE0W,kBAAkBC,KAAK3W,EAAE,4CA5+DP,mBAAXwb,QAAyBA,OAAOC,IACvCD,+BAAO,CAAC,UAAWzb,SACO,iBAAZ2b,QACd3b,QAAQ4b,QAAQ,WAEhB5b,QAAQ6b"}
\ No newline at end of file
+{"version":3,"file":"datepicker.min.js","sources":["../src/datepicker.js"],"sourcesContent":["/*!\r\n * Datepicker2 for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker2)\r\n *\r\n * Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)\r\n */\r\n\r\n(function(factory){\r\n if (typeof define === 'function' && define.amd) {\r\n define(['jquery'], factory);\r\n } else if (typeof exports === 'object') {\r\n factory(require('jquery'));\r\n } else {\r\n factory(jQuery);\r\n }\r\n}(function($, undefined){\r\n function UTCDate(){\r\n return new Date(Date.UTC.apply(Date, arguments));\r\n }\r\n function UTCToday(){\r\n var today = new Date();\r\n return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());\r\n }\r\n function isUTCEquals(date1, date2) {\r\n return (\r\n date1.getUTCFullYear() === date2.getUTCFullYear() &&\r\n date1.getUTCMonth() === date2.getUTCMonth() &&\r\n date1.getUTCDate() === date2.getUTCDate()\r\n );\r\n }\r\n function alias(method, deprecationMsg){\r\n return function(){\r\n if (deprecationMsg !== undefined) {\r\n $.fn.datepicker2.deprecated(deprecationMsg);\r\n }\r\n\r\n return this[method].apply(this, arguments);\r\n };\r\n }\r\n function isValidDate(d) {\r\n return d && !isNaN(d.getTime());\r\n }\r\n\r\n var DateArray = (function(){\r\n var extras = {\r\n get: function(i){\r\n return this.slice(i)[0];\r\n },\r\n contains: function(d){\r\n // Array.indexOf is not cross-browser;\r\n // $.inArray doesn't work with Dates\r\n var val = d && d.valueOf();\r\n for (var i=0, l=this.length; i < l; i++)\r\n // Use date arithmetic to allow dates with different times to match\r\n if (0 <= this[i].valueOf() - val && this[i].valueOf() - val < 1000*60*60*24)\r\n return i;\r\n return -1;\r\n },\r\n remove: function(i){\r\n this.splice(i,1);\r\n },\r\n replace: function(new_array){\r\n if (!new_array)\r\n return;\r\n if (!$.isArray(new_array))\r\n new_array = [new_array];\r\n this.clear();\r\n this.push.apply(this, new_array);\r\n },\r\n clear: function(){\r\n this.length = 0;\r\n },\r\n copy: function(){\r\n var a = new DateArray();\r\n a.replace(this);\r\n return a;\r\n }\r\n };\r\n\r\n return function(){\r\n var a = [];\r\n a.push.apply(a, arguments);\r\n $.extend(a, extras);\r\n return a;\r\n };\r\n })();\r\n\r\n\r\n // Picker object\r\n\r\n var Datepicker2 = function(element, options){\r\n $.data(element, 'datepicker2', this);\r\n\r\n this._events = [];\r\n this._secondaryEvents = [];\r\n\r\n this._process_options(options);\r\n\r\n this.dates = new DateArray();\r\n this.viewDate = this.o.defaultViewDate;\r\n this.focusDate = null;\r\n\r\n this.element = $(element);\r\n this.isInput = this.element.is('input');\r\n this.inputField = this.isInput ? this.element : this.element.find('input');\r\n this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .input-group-append, .input-group-prepend, .btn') : false;\r\n if (this.component && this.component.length === 0)\r\n this.component = false;\r\n this.isInline = !this.component && this.element.is('div');\r\n\r\n this.picker = $(DPGlobal.template);\r\n\r\n // Checking templates and inserting\r\n if (this._check_template(this.o.templates.leftArrow)) {\r\n this.picker.find('.prev').html(this.o.templates.leftArrow);\r\n }\r\n\r\n if (this._check_template(this.o.templates.rightArrow)) {\r\n this.picker.find('.next').html(this.o.templates.rightArrow);\r\n }\r\n\r\n this._buildEvents();\r\n this._attachEvents();\r\n\r\n if (this.isInline){\r\n this.picker.addClass('datepicker2-inline').appendTo(this.element);\r\n }\r\n else {\r\n this.picker.addClass('datepicker2-dropdown dropdown-menu');\r\n }\r\n\r\n if (this.o.rtl){\r\n this.picker.addClass('datepicker2-rtl');\r\n }\r\n\r\n if (this.o.calendarWeeks) {\r\n this.picker.find('.datepicker2-days .datepicker2-switch, thead .datepicker2-title, tfoot .today, tfoot .clear')\r\n .attr('colspan', function(i, val){\r\n return Number(val) + 1;\r\n });\r\n }\r\n\r\n this._process_options({\r\n startDate: this._o.startDate,\r\n endDate: this._o.endDate,\r\n daysOfWeekDisabled: this.o.daysOfWeekDisabled,\r\n daysOfWeekHighlighted: this.o.daysOfWeekHighlighted,\r\n datesDisabled: this.o.datesDisabled\r\n });\r\n\r\n this._allow_update = false;\r\n this.setViewMode(this.o.startView);\r\n this._allow_update = true;\r\n\r\n this.fillDow();\r\n this.fillMonths();\r\n\r\n this.update();\r\n\r\n if (this.isInline){\r\n this.show();\r\n }\r\n };\r\n\r\n Datepicker2.prototype = {\r\n constructor: Datepicker2,\r\n\r\n _resolveViewName: function(view){\r\n $.each(DPGlobal.viewModes, function(i, viewMode){\r\n if (view === i || $.inArray(view, viewMode.names) !== -1){\r\n view = i;\r\n return false;\r\n }\r\n });\r\n\r\n return view;\r\n },\r\n\r\n _resolveDaysOfWeek: function(daysOfWeek){\r\n if (!$.isArray(daysOfWeek))\r\n daysOfWeek = daysOfWeek.split(/[,\\s]*/);\r\n return $.map(daysOfWeek, Number);\r\n },\r\n\r\n _check_template: function(tmp){\r\n try {\r\n // If empty\r\n if (tmp === undefined || tmp === \"\") {\r\n return false;\r\n }\r\n // If no html, everything ok\r\n if ((tmp.match(/[<>]/g) || []).length <= 0) {\r\n return true;\r\n }\r\n // Checking if html is fine\r\n var jDom = $(tmp);\r\n return jDom.length > 0;\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n },\r\n\r\n _process_options: function(opts){\r\n // Store raw options for reference\r\n this._o = $.extend({}, this._o, opts);\r\n // Processed options\r\n var o = this.o = $.extend({}, this._o);\r\n\r\n // Check if \"de-DE\" style date is available, if not language should\r\n // fallback to 2 letter code eg \"de\"\r\n var lang = o.language;\r\n if (!dates[lang]){\r\n lang = lang.split('-')[0];\r\n if (!dates[lang])\r\n lang = defaults.language;\r\n }\r\n o.language = lang;\r\n\r\n // Retrieve view index from any aliases\r\n o.startView = this._resolveViewName(o.startView);\r\n o.minViewMode = this._resolveViewName(o.minViewMode);\r\n o.maxViewMode = this._resolveViewName(o.maxViewMode);\r\n\r\n // Check view is between min and max\r\n o.startView = Math.max(this.o.minViewMode, Math.min(this.o.maxViewMode, o.startView));\r\n\r\n // true, false, or Number > 0\r\n if (o.multidate !== true){\r\n o.multidate = Number(o.multidate) || false;\r\n if (o.multidate !== false)\r\n o.multidate = Math.max(0, o.multidate);\r\n }\r\n o.multidateSeparator = String(o.multidateSeparator);\r\n\r\n o.weekStart %= 7;\r\n o.weekEnd = (o.weekStart + 6) % 7;\r\n\r\n var format = DPGlobal.parseFormat(o.format);\r\n if (o.startDate !== -Infinity){\r\n if (!!o.startDate){\r\n if (o.startDate instanceof Date)\r\n o.startDate = this._local_to_utc(this._zero_time(o.startDate));\r\n else\r\n o.startDate = DPGlobal.parseDate(o.startDate, format, o.language, o.assumeNearbyYear);\r\n }\r\n else {\r\n o.startDate = -Infinity;\r\n }\r\n }\r\n if (o.endDate !== Infinity){\r\n if (!!o.endDate){\r\n if (o.endDate instanceof Date)\r\n o.endDate = this._local_to_utc(this._zero_time(o.endDate));\r\n else\r\n o.endDate = DPGlobal.parseDate(o.endDate, format, o.language, o.assumeNearbyYear);\r\n }\r\n else {\r\n o.endDate = Infinity;\r\n }\r\n }\r\n\r\n o.daysOfWeekDisabled = this._resolveDaysOfWeek(o.daysOfWeekDisabled||[]);\r\n o.daysOfWeekHighlighted = this._resolveDaysOfWeek(o.daysOfWeekHighlighted||[]);\r\n\r\n o.datesDisabled = o.datesDisabled||[];\r\n if (!$.isArray(o.datesDisabled)) {\r\n o.datesDisabled = o.datesDisabled.split(',');\r\n }\r\n o.datesDisabled = $.map(o.datesDisabled, function(d){\r\n return DPGlobal.parseDate(d, format, o.language, o.assumeNearbyYear);\r\n });\r\n\r\n var plc = String(o.orientation).toLowerCase().split(/\\s+/g),\r\n _plc = o.orientation.toLowerCase();\r\n plc = $.grep(plc, function(word){\r\n return /^auto|left|right|top|bottom$/.test(word);\r\n });\r\n o.orientation = {x: 'auto', y: 'auto'};\r\n if (!_plc || _plc === 'auto')\r\n ; // no action\r\n else if (plc.length === 1){\r\n switch (plc[0]){\r\n case 'top':\r\n case 'bottom':\r\n o.orientation.y = plc[0];\r\n break;\r\n case 'left':\r\n case 'right':\r\n o.orientation.x = plc[0];\r\n break;\r\n }\r\n }\r\n else {\r\n _plc = $.grep(plc, function(word){\r\n return /^left|right$/.test(word);\r\n });\r\n o.orientation.x = _plc[0] || 'auto';\r\n\r\n _plc = $.grep(plc, function(word){\r\n return /^top|bottom$/.test(word);\r\n });\r\n o.orientation.y = _plc[0] || 'auto';\r\n }\r\n if (o.defaultViewDate instanceof Date || typeof o.defaultViewDate === 'string') {\r\n o.defaultViewDate = DPGlobal.parseDate(o.defaultViewDate, format, o.language, o.assumeNearbyYear);\r\n } else if (o.defaultViewDate) {\r\n var year = o.defaultViewDate.year || new Date().getFullYear();\r\n var month = o.defaultViewDate.month || 0;\r\n var day = o.defaultViewDate.day || 1;\r\n o.defaultViewDate = UTCDate(year, month, day);\r\n } else {\r\n o.defaultViewDate = UTCToday();\r\n }\r\n },\r\n _applyEvents: function(evs){\r\n for (var i=0, el, ch, ev; i < evs.length; i++){\r\n el = evs[i][0];\r\n if (evs[i].length === 2){\r\n ch = undefined;\r\n ev = evs[i][1];\r\n } else if (evs[i].length === 3){\r\n ch = evs[i][1];\r\n ev = evs[i][2];\r\n }\r\n el.on(ev, ch);\r\n }\r\n },\r\n _unapplyEvents: function(evs){\r\n for (var i=0, el, ev, ch; i < evs.length; i++){\r\n el = evs[i][0];\r\n if (evs[i].length === 2){\r\n ch = undefined;\r\n ev = evs[i][1];\r\n } else if (evs[i].length === 3){\r\n ch = evs[i][1];\r\n ev = evs[i][2];\r\n }\r\n el.off(ev, ch);\r\n }\r\n },\r\n _buildEvents: function(){\r\n var events = {\r\n keyup: $.proxy(function(e){\r\n if ($.inArray(e.keyCode, [27, 37, 39, 38, 40, 32, 13, 9]) === -1)\r\n this.update();\r\n }, this),\r\n keydown: $.proxy(this.keydown, this),\r\n paste: $.proxy(this.paste, this)\r\n };\r\n\r\n if (this.o.showOnFocus === true) {\r\n events.focus = $.proxy(this.show, this);\r\n }\r\n\r\n if (this.isInput) { // single input\r\n this._events = [\r\n [this.element, events]\r\n ];\r\n }\r\n // component: input + button\r\n else if (this.component && this.inputField.length) {\r\n this._events = [\r\n // For components that are not readonly, allow keyboard nav\r\n [this.inputField, events],\r\n [this.component, {\r\n click: $.proxy(this.show, this)\r\n }]\r\n ];\r\n }\r\n else {\r\n this._events = [\r\n [this.element, {\r\n click: $.proxy(this.show, this),\r\n keydown: $.proxy(this.keydown, this)\r\n }]\r\n ];\r\n }\r\n this._events.push(\r\n // Component: listen for blur on element descendants\r\n [this.element, '*', {\r\n blur: $.proxy(function(e){\r\n this._focused_from = e.target;\r\n }, this)\r\n }],\r\n // Input: listen for blur on element\r\n [this.element, {\r\n blur: $.proxy(function(e){\r\n this._focused_from = e.target;\r\n }, this)\r\n }]\r\n );\r\n\r\n if (this.o.immediateUpdates) {\r\n // Trigger input updates immediately on changed year/month\r\n this._events.push([this.element, {\r\n 'changeYear changeMonth': $.proxy(function(e){\r\n this.update(e.date);\r\n }, this)\r\n }]);\r\n }\r\n\r\n this._secondaryEvents = [\r\n [this.picker, {\r\n click: $.proxy(this.click, this)\r\n }],\r\n [this.picker, '.prev, .next', {\r\n click: $.proxy(this.navArrowsClick, this)\r\n }],\r\n [this.picker, '.day:not(.disabled)', {\r\n click: $.proxy(this.dayCellClick, this)\r\n }],\r\n [$(window), {\r\n resize: $.proxy(this.place, this)\r\n }],\r\n [$(document), {\r\n 'mousedown touchstart': $.proxy(function(e){\r\n // Clicked outside the datepicker2, hide it\r\n if (!(\r\n this.element.is(e.target) ||\r\n this.element.find(e.target).length ||\r\n this.picker.is(e.target) ||\r\n this.picker.find(e.target).length ||\r\n this.isInline\r\n )){\r\n this.hide();\r\n }\r\n }, this)\r\n }]\r\n ];\r\n },\r\n _attachEvents: function(){\r\n this._detachEvents();\r\n this._applyEvents(this._events);\r\n },\r\n _detachEvents: function(){\r\n this._unapplyEvents(this._events);\r\n },\r\n _attachSecondaryEvents: function(){\r\n this._detachSecondaryEvents();\r\n this._applyEvents(this._secondaryEvents);\r\n },\r\n _detachSecondaryEvents: function(){\r\n this._unapplyEvents(this._secondaryEvents);\r\n },\r\n _trigger: function(event, altdate){\r\n var date = altdate || this.dates.get(-1),\r\n local_date = this._utc_to_local(date);\r\n\r\n this.element.trigger({\r\n type: event,\r\n date: local_date,\r\n viewMode: this.viewMode,\r\n dates: $.map(this.dates, this._utc_to_local),\r\n format: $.proxy(function(ix, format){\r\n if (arguments.length === 0){\r\n ix = this.dates.length - 1;\r\n format = this.o.format;\r\n } else if (typeof ix === 'string'){\r\n format = ix;\r\n ix = this.dates.length - 1;\r\n }\r\n format = format || this.o.format;\r\n var date = this.dates.get(ix);\r\n return DPGlobal.formatDate(date, format, this.o.language);\r\n }, this)\r\n });\r\n },\r\n\r\n show: function(){\r\n if (this.inputField.is(':disabled') || (this.inputField.prop('readonly') && this.o.enableOnReadonly === false))\r\n return;\r\n if (!this.isInline)\r\n this.picker.appendTo(this.o.container);\r\n this.place();\r\n this.picker.show();\r\n this._attachSecondaryEvents();\r\n this._trigger('show');\r\n if ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && this.o.disableTouchKeyboard) {\r\n $(this.element).blur();\r\n }\r\n return this;\r\n },\r\n\r\n hide: function(){\r\n if (this.isInline || !this.picker.is(':visible'))\r\n return this;\r\n this.focusDate = null;\r\n this.picker.hide().detach();\r\n this._detachSecondaryEvents();\r\n this.setViewMode(this.o.startView);\r\n\r\n if (this.o.forceParse && this.inputField.val())\r\n this.setValue();\r\n this._trigger('hide');\r\n return this;\r\n },\r\n\r\n destroy: function(){\r\n this.hide();\r\n this._detachEvents();\r\n this._detachSecondaryEvents();\r\n this.picker.remove();\r\n delete this.element.data().datepicker2;\r\n if (!this.isInput){\r\n delete this.element.data().date;\r\n }\r\n return this;\r\n },\r\n\r\n paste: function(e){\r\n var dateString;\r\n if (e.originalEvent.clipboardData && e.originalEvent.clipboardData.types\r\n && $.inArray('text/plain', e.originalEvent.clipboardData.types) !== -1) {\r\n dateString = e.originalEvent.clipboardData.getData('text/plain');\r\n } else if (window.clipboardData) {\r\n dateString = window.clipboardData.getData('Text');\r\n } else {\r\n return;\r\n }\r\n this.setDate(dateString);\r\n this.update();\r\n e.preventDefault();\r\n },\r\n\r\n _utc_to_local: function(utc){\r\n if (!utc) {\r\n return utc;\r\n }\r\n\r\n var local = new Date(utc.getTime() + (utc.getTimezoneOffset() * 60000));\r\n\r\n if (local.getTimezoneOffset() !== utc.getTimezoneOffset()) {\r\n local = new Date(utc.getTime() + (local.getTimezoneOffset() * 60000));\r\n }\r\n\r\n return local;\r\n },\r\n _local_to_utc: function(local){\r\n return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));\r\n },\r\n _zero_time: function(local){\r\n return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());\r\n },\r\n _zero_utc_time: function(utc){\r\n return utc && UTCDate(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate());\r\n },\r\n\r\n getDates: function(){\r\n return $.map(this.dates, this._utc_to_local);\r\n },\r\n\r\n getUTCDates: function(){\r\n return $.map(this.dates, function(d){\r\n return new Date(d);\r\n });\r\n },\r\n\r\n getDate: function(){\r\n return this._utc_to_local(this.getUTCDate());\r\n },\r\n\r\n getUTCDate: function(){\r\n var selected_date = this.dates.get(-1);\r\n if (selected_date !== undefined) {\r\n return new Date(selected_date);\r\n } else {\r\n return null;\r\n }\r\n },\r\n\r\n clearDates: function(){\r\n this.inputField.val('');\r\n this.update();\r\n this._trigger('changeDate');\r\n\r\n if (this.o.autoclose) {\r\n this.hide();\r\n }\r\n },\r\n\r\n setDates: function(){\r\n var args = $.isArray(arguments[0]) ? arguments[0] : arguments;\r\n this.update.apply(this, args);\r\n this._trigger('changeDate');\r\n this.setValue();\r\n return this;\r\n },\r\n\r\n setUTCDates: function(){\r\n var args = $.isArray(arguments[0]) ? arguments[0] : arguments;\r\n this.setDates.apply(this, $.map(args, this._utc_to_local));\r\n return this;\r\n },\r\n\r\n setDate: alias('setDates'),\r\n setUTCDate: alias('setUTCDates'),\r\n remove: alias('destroy', 'Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead'),\r\n\r\n setValue: function(){\r\n var formatted = this.getFormattedDate();\r\n this.inputField.val(formatted);\r\n return this;\r\n },\r\n\r\n getFormattedDate: function(format){\r\n if (format === undefined)\r\n format = this.o.format;\r\n\r\n var lang = this.o.language;\r\n return $.map(this.dates, function(d){\r\n return DPGlobal.formatDate(d, format, lang);\r\n }).join(this.o.multidateSeparator);\r\n },\r\n\r\n getStartDate: function(){\r\n return this.o.startDate;\r\n },\r\n\r\n setStartDate: function(startDate){\r\n this._process_options({startDate: startDate});\r\n this.update();\r\n this.updateNavArrows();\r\n return this;\r\n },\r\n\r\n getEndDate: function(){\r\n return this.o.endDate;\r\n },\r\n\r\n setEndDate: function(endDate){\r\n this._process_options({endDate: endDate});\r\n this.update();\r\n this.updateNavArrows();\r\n return this;\r\n },\r\n\r\n setDaysOfWeekDisabled: function(daysOfWeekDisabled){\r\n this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});\r\n this.update();\r\n return this;\r\n },\r\n\r\n setDaysOfWeekHighlighted: function(daysOfWeekHighlighted){\r\n this._process_options({daysOfWeekHighlighted: daysOfWeekHighlighted});\r\n this.update();\r\n return this;\r\n },\r\n\r\n setDatesDisabled: function(datesDisabled){\r\n this._process_options({datesDisabled: datesDisabled});\r\n this.update();\r\n return this;\r\n },\r\n\r\n place: function(){\r\n if (this.isInline)\r\n return this;\r\n var calendarWidth = this.picker.outerWidth(),\r\n calendarHeight = this.picker.outerHeight(),\r\n visualPadding = 10,\r\n container = $(this.o.container),\r\n windowWidth = container.width(),\r\n scrollTop = this.o.container === 'body' ? $(document).scrollTop() : container.scrollTop(),\r\n appendOffset = container.offset();\r\n\r\n var parentsZindex = [0];\r\n this.element.parents().each(function(){\r\n var itemZIndex = $(this).css('z-index');\r\n if (itemZIndex !== 'auto' && Number(itemZIndex) !== 0) parentsZindex.push(Number(itemZIndex));\r\n });\r\n var zIndex = Math.max.apply(Math, parentsZindex) + this.o.zIndexOffset;\r\n var offset = this.component ? this.component.parent().offset() : this.element.offset();\r\n var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);\r\n var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);\r\n var left = offset.left - appendOffset.left;\r\n var top = offset.top - appendOffset.top;\r\n\r\n if (this.o.container !== 'body') {\r\n top += scrollTop;\r\n }\r\n\r\n this.picker.removeClass(\r\n 'datepicker2-orient-top datepicker2-orient-bottom '+\r\n 'datepicker2-orient-right datepicker2-orient-left'\r\n );\r\n\r\n if (this.o.orientation.x !== 'auto'){\r\n this.picker.addClass('datepicker2-orient-' + this.o.orientation.x);\r\n if (this.o.orientation.x === 'right')\r\n left -= calendarWidth - width;\r\n }\r\n // auto x orientation is best-placement: if it crosses a window\r\n // edge, fudge it sideways\r\n else {\r\n if (offset.left < 0) {\r\n // component is outside the window on the left side. Move it into visible range\r\n this.picker.addClass('datepicker2-orient-left');\r\n left -= offset.left - visualPadding;\r\n } else if (left + calendarWidth > windowWidth) {\r\n // the calendar passes the widow right edge. Align it to component right side\r\n this.picker.addClass('datepicker2-orient-right');\r\n left += width - calendarWidth;\r\n } else {\r\n if (this.o.rtl) {\r\n // Default to right\r\n this.picker.addClass('datepicker2-orient-right');\r\n } else {\r\n // Default to left\r\n this.picker.addClass('datepicker2-orient-left');\r\n }\r\n }\r\n }\r\n\r\n // auto y orientation is best-situation: top or bottom, no fudging,\r\n // decision based on which shows more of the calendar\r\n var yorient = this.o.orientation.y,\r\n top_overflow;\r\n if (yorient === 'auto'){\r\n top_overflow = -scrollTop + top - calendarHeight;\r\n yorient = top_overflow < 0 ? 'bottom' : 'top';\r\n }\r\n\r\n this.picker.addClass('datepicker2-orient-' + yorient);\r\n if (yorient === 'top')\r\n top -= calendarHeight + parseInt(this.picker.css('padding-top'));\r\n else\r\n top += height;\r\n\r\n if (this.o.rtl) {\r\n var right = windowWidth - (left + width);\r\n this.picker.css({\r\n top: top,\r\n right: right,\r\n zIndex: zIndex\r\n });\r\n } else {\r\n this.picker.css({\r\n top: top,\r\n left: left,\r\n zIndex: zIndex\r\n });\r\n }\r\n return this;\r\n },\r\n\r\n _allow_update: true,\r\n update: function(){\r\n if (!this._allow_update)\r\n return this;\r\n\r\n var oldDates = this.dates.copy(),\r\n dates = [],\r\n fromArgs = false;\r\n if (arguments.length){\r\n $.each(arguments, $.proxy(function(i, date){\r\n if (date instanceof Date)\r\n date = this._local_to_utc(date);\r\n dates.push(date);\r\n }, this));\r\n fromArgs = true;\r\n } else {\r\n dates = this.isInput\r\n ? this.element.val()\r\n : this.element.data('date') || this.inputField.val();\r\n if (dates && this.o.multidate)\r\n dates = dates.split(this.o.multidateSeparator);\r\n else\r\n dates = [dates];\r\n delete this.element.data().date;\r\n }\r\n\r\n dates = $.map(dates, $.proxy(function(date){\r\n return DPGlobal.parseDate(date, this.o.format, this.o.language, this.o.assumeNearbyYear);\r\n }, this));\r\n dates = $.grep(dates, $.proxy(function(date){\r\n return (\r\n !this.dateWithinRange(date) ||\r\n !date\r\n );\r\n }, this), true);\r\n this.dates.replace(dates);\r\n\r\n if (this.o.updateViewDate) {\r\n if (this.dates.length)\r\n this.viewDate = new Date(this.dates.get(-1));\r\n else if (this.viewDate < this.o.startDate)\r\n this.viewDate = new Date(this.o.startDate);\r\n else if (this.viewDate > this.o.endDate)\r\n this.viewDate = new Date(this.o.endDate);\r\n else\r\n this.viewDate = this.o.defaultViewDate;\r\n }\r\n\r\n if (fromArgs){\r\n // setting date by clicking\r\n this.setValue();\r\n this.element.change();\r\n }\r\n else if (this.dates.length){\r\n // setting date by typing\r\n if (String(oldDates) !== String(this.dates) && fromArgs) {\r\n this._trigger('changeDate');\r\n this.element.change();\r\n }\r\n }\r\n if (!this.dates.length && oldDates.length) {\r\n this._trigger('clearDate');\r\n this.element.change();\r\n }\r\n\r\n this.fill();\r\n return this;\r\n },\r\n\r\n fillDow: function(){\r\n if (this.o.showWeekDays) {\r\n var dowCnt = this.o.weekStart,\r\n html = '
';\r\n if (this.o.calendarWeeks){\r\n html += '
';\r\n }\r\n while (dowCnt < this.o.weekStart + 7){\r\n html += '
'+dates[this.o.language].daysMin[(dowCnt++)%7]+'
';\r\n }\r\n html += '
';\r\n this.picker.find('.datepicker2-days thead').append(html);\r\n }\r\n },\r\n\r\n fillMonths: function(){\r\n var localDate = this._utc_to_local(this.viewDate);\r\n var html = '';\r\n var focused;\r\n for (var i = 0; i < 12; i++){\r\n focused = localDate && localDate.getMonth() === i ? ' focused' : '';\r\n html += '' + dates[this.o.language].monthsShort[i] + '';\r\n }\r\n this.picker.find('.datepicker2-months td').html(html);\r\n },\r\n\r\n setRange: function(range){\r\n if (!range || !range.length)\r\n delete this.range;\r\n else\r\n this.range = $.map(range, function(d){\r\n return d.valueOf();\r\n });\r\n this.fill();\r\n },\r\n\r\n getClassNames: function(date){\r\n var cls = [],\r\n year = this.viewDate.getUTCFullYear(),\r\n month = this.viewDate.getUTCMonth(),\r\n today = UTCToday();\r\n if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){\r\n cls.push('old');\r\n } else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){\r\n cls.push('new');\r\n }\r\n if (this.focusDate && date.valueOf() === this.focusDate.valueOf())\r\n cls.push('focused');\r\n // Compare internal UTC date with UTC today, not local today\r\n if (this.o.todayHighlight && isUTCEquals(date, today)) {\r\n cls.push('today');\r\n }\r\n if (this.dates.contains(date) !== -1)\r\n cls.push('active');\r\n if (!this.dateWithinRange(date)){\r\n cls.push('disabled');\r\n }\r\n if (this.dateIsDisabled(date)){\r\n cls.push('disabled', 'disabled-date');\r\n }\r\n if ($.inArray(date.getUTCDay(), this.o.daysOfWeekHighlighted) !== -1){\r\n cls.push('highlighted');\r\n }\r\n\r\n if (this.range){\r\n if (date > this.range[0] && date < this.range[this.range.length-1]){\r\n cls.push('range');\r\n }\r\n if ($.inArray(date.valueOf(), this.range) !== -1){\r\n cls.push('selected');\r\n }\r\n if (date.valueOf() === this.range[0]){\r\n cls.push('range-start');\r\n }\r\n if (date.valueOf() === this.range[this.range.length-1]){\r\n cls.push('range-end');\r\n }\r\n }\r\n return cls;\r\n },\r\n\r\n _fill_yearsView: function(selector, cssClass, factor, year, startYear, endYear, beforeFn){\r\n var html = '';\r\n var step = factor / 10;\r\n var view = this.picker.find(selector);\r\n var startVal = Math.floor(year / factor) * factor;\r\n var endVal = startVal + step * 9;\r\n var focusedVal = Math.floor(this.viewDate.getFullYear() / step) * step;\r\n var selected = $.map(this.dates, function(d){\r\n return Math.floor(d.getUTCFullYear() / step) * step;\r\n });\r\n\r\n var classes, tooltip, before;\r\n for (var currVal = startVal - step; currVal <= endVal + step; currVal += step) {\r\n classes = [cssClass];\r\n tooltip = null;\r\n\r\n if (currVal === startVal - step) {\r\n classes.push('old');\r\n } else if (currVal === endVal + step) {\r\n classes.push('new');\r\n }\r\n if ($.inArray(currVal, selected) !== -1) {\r\n classes.push('active');\r\n }\r\n if (currVal < startYear || currVal > endYear) {\r\n classes.push('disabled');\r\n }\r\n if (currVal === focusedVal) {\r\n classes.push('focused');\r\n }\r\n\r\n if (beforeFn !== $.noop) {\r\n before = beforeFn(new Date(currVal, 0, 1));\r\n if (before === undefined) {\r\n before = {};\r\n } else if (typeof before === 'boolean') {\r\n before = {enabled: before};\r\n } else if (typeof before === 'string') {\r\n before = {classes: before};\r\n }\r\n if (before.enabled === false) {\r\n classes.push('disabled');\r\n }\r\n if (before.classes) {\r\n classes = classes.concat(before.classes.split(/\\s+/));\r\n }\r\n if (before.tooltip) {\r\n tooltip = before.tooltip;\r\n }\r\n }\r\n\r\n html += '' + currVal + '';\r\n }\r\n\r\n view.find('.datepicker2-switch').text(startVal + '-' + endVal);\r\n view.find('td').html(html);\r\n },\r\n\r\n fill: function(){\r\n var d = new Date(this.viewDate),\r\n year = d.getUTCFullYear(),\r\n month = d.getUTCMonth(),\r\n startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,\r\n startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,\r\n endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,\r\n endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,\r\n todaytxt = dates[this.o.language].today || dates['en'].today || '',\r\n cleartxt = dates[this.o.language].clear || dates['en'].clear || '',\r\n titleFormat = dates[this.o.language].titleFormat || dates['en'].titleFormat,\r\n todayDate = UTCToday(),\r\n titleBtnVisible = (this.o.todayBtn === true || this.o.todayBtn === 'linked') && todayDate >= this.o.startDate && todayDate <= this.o.endDate && !this.weekOfDateIsDisabled(todayDate),\r\n tooltip,\r\n before;\r\n if (isNaN(year) || isNaN(month))\r\n return;\r\n this.picker.find('.datepicker2-days .datepicker2-switch')\r\n .text(DPGlobal.formatDate(d, titleFormat, this.o.language));\r\n this.picker.find('tfoot .today')\r\n .text(todaytxt)\r\n .css('display', titleBtnVisible ? 'table-cell' : 'none');\r\n this.picker.find('tfoot .clear')\r\n .text(cleartxt)\r\n .css('display', this.o.clearBtn === true ? 'table-cell' : 'none');\r\n this.picker.find('thead .datepicker2-title')\r\n .text(this.o.title)\r\n .css('display', typeof this.o.title === 'string' && this.o.title !== '' ? 'table-cell' : 'none');\r\n this.updateNavArrows();\r\n this.fillMonths();\r\n var prevMonth = UTCDate(year, month, 0),\r\n day = prevMonth.getUTCDate();\r\n prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);\r\n var nextMonth = new Date(prevMonth);\r\n if (prevMonth.getUTCFullYear() < 100){\r\n nextMonth.setUTCFullYear(prevMonth.getUTCFullYear());\r\n }\r\n nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);\r\n nextMonth = nextMonth.valueOf();\r\n var html = [];\r\n var weekDay, clsName;\r\n while (prevMonth.valueOf() < nextMonth){\r\n weekDay = prevMonth.getUTCDay();\r\n if (weekDay === this.o.weekStart){\r\n html.push('
');\r\n if (this.o.calendarWeeks){\r\n // ISO 8601: First week contains first thursday.\r\n // ISO also states week starts on Monday, but we can be more abstract here.\r\n var\r\n // Start of current week: based on weekstart/current date\r\n ws = new Date(+prevMonth + (this.o.weekStart - weekDay - 7) % 7 * 864e5),\r\n // Thursday of this week\r\n th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),\r\n // First Thursday of year, year from thursday\r\n yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay()) % 7 * 864e5),\r\n // Calendar week: ms between thursdays, div ms per day, div 7 days\r\n calWeek = (th - yth) / 864e5 / 7 + 1;\r\n html.push('
'+ calWeek +'
');\r\n }\r\n }\r\n clsName = this.getClassNames(prevMonth);\r\n clsName.push('day');\r\n\r\n var content = prevMonth.getUTCDate();\r\n\r\n if (this.o.beforeShowDay !== $.noop){\r\n before = this.o.beforeShowDay(this._utc_to_local(prevMonth));\r\n if (before === undefined)\r\n before = {};\r\n else if (typeof before === 'boolean')\r\n before = {enabled: before};\r\n else if (typeof before === 'string')\r\n before = {classes: before};\r\n if (before.enabled === false)\r\n clsName.push('disabled');\r\n if (before.classes)\r\n clsName = clsName.concat(before.classes.split(/\\s+/));\r\n if (before.tooltip)\r\n tooltip = before.tooltip;\r\n if (before.content)\r\n content = before.content;\r\n }\r\n\r\n //Check if uniqueSort exists (supported by jquery >=1.12 and >=2.2)\r\n //Fallback to unique function for older jquery versions\r\n if ($.isFunction($.uniqueSort)) {\r\n clsName = $.uniqueSort(clsName);\r\n } else {\r\n clsName = $.unique(clsName);\r\n }\r\n\r\n html.push('
' + content + '
');\r\n tooltip = null;\r\n if (weekDay === this.o.weekEnd){\r\n html.push('
');\r\n }\r\n prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);\r\n }\r\n this.picker.find('.datepicker2-days tbody').html(html.join(''));\r\n\r\n var monthsTitle = dates[this.o.language].monthsTitle || dates['en'].monthsTitle || 'Months';\r\n var months = this.picker.find('.datepicker2-months')\r\n .find('.datepicker2-switch')\r\n .text(this.o.maxViewMode < 2 ? monthsTitle : year)\r\n .end()\r\n .find('tbody span').removeClass('active');\r\n\r\n $.each(this.dates, function(i, d){\r\n if (d.getUTCFullYear() === year)\r\n months.eq(d.getUTCMonth()).addClass('active');\r\n });\r\n\r\n if (year < startYear || year > endYear){\r\n months.addClass('disabled');\r\n }\r\n if (year === startYear){\r\n months.slice(0, startMonth).addClass('disabled');\r\n }\r\n if (year === endYear){\r\n months.slice(endMonth+1).addClass('disabled');\r\n }\r\n\r\n if (this.o.beforeShowMonth !== $.noop){\r\n var that = this;\r\n $.each(months, function(i, month){\r\n var moDate = new Date(year, i, 1);\r\n var before = that.o.beforeShowMonth(moDate);\r\n if (before === undefined)\r\n before = {};\r\n else if (typeof before === 'boolean')\r\n before = {enabled: before};\r\n else if (typeof before === 'string')\r\n before = {classes: before};\r\n if (before.enabled === false && !$(month).hasClass('disabled'))\r\n $(month).addClass('disabled');\r\n if (before.classes)\r\n $(month).addClass(before.classes);\r\n if (before.tooltip)\r\n $(month).prop('title', before.tooltip);\r\n });\r\n }\r\n\r\n // Generating decade/years picker\r\n this._fill_yearsView(\r\n '.datepicker2-years',\r\n 'year',\r\n 10,\r\n year,\r\n startYear,\r\n endYear,\r\n this.o.beforeShowYear\r\n );\r\n\r\n // Generating century/decades picker\r\n this._fill_yearsView(\r\n '.datepicker2-decades',\r\n 'decade',\r\n 100,\r\n year,\r\n startYear,\r\n endYear,\r\n this.o.beforeShowDecade\r\n );\r\n\r\n // Generating millennium/centuries picker\r\n this._fill_yearsView(\r\n '.datepicker2-centuries',\r\n 'century',\r\n 1000,\r\n year,\r\n startYear,\r\n endYear,\r\n this.o.beforeShowCentury\r\n );\r\n },\r\n\r\n updateNavArrows: function(){\r\n if (!this._allow_update)\r\n return;\r\n\r\n var d = new Date(this.viewDate),\r\n year = d.getUTCFullYear(),\r\n month = d.getUTCMonth(),\r\n startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,\r\n startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,\r\n endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,\r\n endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,\r\n prevIsDisabled,\r\n nextIsDisabled,\r\n factor = 1;\r\n switch (this.viewMode){\r\n case 4:\r\n factor *= 10;\r\n /* falls through */\r\n case 3:\r\n factor *= 10;\r\n /* falls through */\r\n case 2:\r\n factor *= 10;\r\n /* falls through */\r\n case 1:\r\n prevIsDisabled = Math.floor(year / factor) * factor <= startYear;\r\n nextIsDisabled = Math.floor(year / factor) * factor + factor > endYear;\r\n break;\r\n case 0:\r\n prevIsDisabled = year <= startYear && month <= startMonth;\r\n nextIsDisabled = year >= endYear && month >= endMonth;\r\n break;\r\n }\r\n\r\n this.picker.find('.prev').toggleClass('disabled', prevIsDisabled);\r\n this.picker.find('.next').toggleClass('disabled', nextIsDisabled);\r\n },\r\n\r\n click: function(e){\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n var target, dir, day, year, month;\r\n target = $(e.target);\r\n\r\n // Clicked on the switch\r\n if (target.hasClass('datepicker2-switch') && this.viewMode !== this.o.maxViewMode){\r\n this.setViewMode(this.viewMode + 1);\r\n }\r\n\r\n // Clicked on today button\r\n if (target.hasClass('today') && !target.hasClass('day')){\r\n this.setViewMode(0);\r\n this._setDate(UTCToday(), this.o.todayBtn === 'linked' ? null : 'view');\r\n }\r\n\r\n // Clicked on clear button\r\n if (target.hasClass('clear')){\r\n this.clearDates();\r\n }\r\n\r\n if (!target.hasClass('disabled')){\r\n // Clicked on a month, year, decade, century\r\n if (target.hasClass('month')\r\n || target.hasClass('year')\r\n || target.hasClass('decade')\r\n || target.hasClass('century')) {\r\n this.viewDate.setUTCDate(1);\r\n\r\n day = 1;\r\n if (this.viewMode === 1){\r\n month = target.parent().find('span').index(target);\r\n year = this.viewDate.getUTCFullYear();\r\n this.viewDate.setUTCMonth(month);\r\n } else {\r\n month = 0;\r\n year = Number(target.text());\r\n this.viewDate.setUTCFullYear(year);\r\n }\r\n\r\n this._trigger(DPGlobal.viewModes[this.viewMode - 1].e, this.viewDate);\r\n\r\n if (this.viewMode === this.o.minViewMode){\r\n this._setDate(UTCDate(year, month, day));\r\n } else {\r\n this.setViewMode(this.viewMode - 1);\r\n this.fill();\r\n }\r\n }\r\n }\r\n\r\n if (this.picker.is(':visible') && this._focused_from){\r\n this._focused_from.focus();\r\n }\r\n delete this._focused_from;\r\n },\r\n\r\n dayCellClick: function(e){\r\n var $target = $(e.currentTarget);\r\n var timestamp = $target.data('date');\r\n var date = new Date(timestamp);\r\n\r\n if (this.o.updateViewDate) {\r\n if (date.getUTCFullYear() !== this.viewDate.getUTCFullYear()) {\r\n this._trigger('changeYear', this.viewDate);\r\n }\r\n\r\n if (date.getUTCMonth() !== this.viewDate.getUTCMonth()) {\r\n this._trigger('changeMonth', this.viewDate);\r\n }\r\n }\r\n this._setDate(date);\r\n },\r\n\r\n // Clicked on prev or next\r\n navArrowsClick: function(e){\r\n var $target = $(e.currentTarget);\r\n var dir = $target.hasClass('prev') ? -1 : 1;\r\n if (this.viewMode !== 0){\r\n dir *= DPGlobal.viewModes[this.viewMode].navStep * 12;\r\n }\r\n this.viewDate = this.moveMonth(this.viewDate, dir);\r\n this._trigger(DPGlobal.viewModes[this.viewMode].e, this.viewDate);\r\n this.fill();\r\n },\r\n\r\n _toggle_multidate: function(date){\r\n var ix = this.dates.contains(date);\r\n if (!date){\r\n this.dates.clear();\r\n }\r\n\r\n if (ix !== -1){\r\n if (this.o.multidate === true || this.o.multidate > 1 || this.o.toggleActive){\r\n this.dates.remove(ix);\r\n }\r\n } else if (this.o.multidate === false) {\r\n this.dates.clear();\r\n this.dates.push(date);\r\n }\r\n else {\r\n this.dates.push(date);\r\n }\r\n\r\n if (typeof this.o.multidate === 'number')\r\n while (this.dates.length > this.o.multidate)\r\n this.dates.remove(0);\r\n },\r\n\r\n _setDate: function(date, which){\r\n if (!which || which === 'date')\r\n this._toggle_multidate(date && new Date(date));\r\n if ((!which && this.o.updateViewDate) || which === 'view')\r\n this.viewDate = date && new Date(date);\r\n\r\n this.fill();\r\n this.setValue();\r\n if (!which || which !== 'view') {\r\n this._trigger('changeDate');\r\n }\r\n this.inputField.trigger('change');\r\n if (this.o.autoclose && (!which || which === 'date')){\r\n this.hide();\r\n }\r\n },\r\n\r\n moveDay: function(date, dir){\r\n var newDate = new Date(date);\r\n newDate.setUTCDate(date.getUTCDate() + dir);\r\n\r\n return newDate;\r\n },\r\n\r\n moveWeek: function(date, dir){\r\n return this.moveDay(date, dir * 7);\r\n },\r\n\r\n moveMonth: function(date, dir){\r\n if (!isValidDate(date))\r\n return this.o.defaultViewDate;\r\n if (!dir)\r\n return date;\r\n var new_date = new Date(date.valueOf()),\r\n day = new_date.getUTCDate(),\r\n month = new_date.getUTCMonth(),\r\n mag = Math.abs(dir),\r\n new_month, test;\r\n dir = dir > 0 ? 1 : -1;\r\n if (mag === 1){\r\n test = dir === -1\r\n // If going back one month, make sure month is not current month\r\n // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)\r\n ? function(){\r\n return new_date.getUTCMonth() === month;\r\n }\r\n // If going forward one month, make sure month is as expected\r\n // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)\r\n : function(){\r\n return new_date.getUTCMonth() !== new_month;\r\n };\r\n new_month = month + dir;\r\n new_date.setUTCMonth(new_month);\r\n // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11\r\n new_month = (new_month + 12) % 12;\r\n }\r\n else {\r\n // For magnitudes >1, move one month at a time...\r\n for (var i=0; i < mag; i++)\r\n // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...\r\n new_date = this.moveMonth(new_date, dir);\r\n // ...then reset the day, keeping it in the new month\r\n new_month = new_date.getUTCMonth();\r\n new_date.setUTCDate(day);\r\n test = function(){\r\n return new_month !== new_date.getUTCMonth();\r\n };\r\n }\r\n // Common date-resetting loop -- if date is beyond end of month, make it\r\n // end of month\r\n while (test()){\r\n new_date.setUTCDate(--day);\r\n new_date.setUTCMonth(new_month);\r\n }\r\n return new_date;\r\n },\r\n\r\n moveYear: function(date, dir){\r\n return this.moveMonth(date, dir*12);\r\n },\r\n\r\n moveAvailableDate: function(date, dir, fn){\r\n do {\r\n date = this[fn](date, dir);\r\n\r\n if (!this.dateWithinRange(date))\r\n return false;\r\n\r\n fn = 'moveDay';\r\n }\r\n while (this.dateIsDisabled(date));\r\n\r\n return date;\r\n },\r\n\r\n weekOfDateIsDisabled: function(date){\r\n return $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1;\r\n },\r\n\r\n dateIsDisabled: function(date){\r\n return (\r\n this.weekOfDateIsDisabled(date) ||\r\n $.grep(this.o.datesDisabled, function(d){\r\n return isUTCEquals(date, d);\r\n }).length > 0\r\n );\r\n },\r\n\r\n dateWithinRange: function(date){\r\n return date >= this.o.startDate && date <= this.o.endDate;\r\n },\r\n\r\n keydown: function(e){\r\n if (!this.picker.is(':visible')){\r\n if (e.keyCode === 40 || e.keyCode === 27) { // allow down to re-show picker\r\n this.show();\r\n e.stopPropagation();\r\n }\r\n return;\r\n }\r\n var dateChanged = false,\r\n dir, newViewDate,\r\n focusDate = this.focusDate || this.viewDate;\r\n switch (e.keyCode){\r\n case 27: // escape\r\n if (this.focusDate){\r\n this.focusDate = null;\r\n this.viewDate = this.dates.get(-1) || this.viewDate;\r\n this.fill();\r\n }\r\n else\r\n this.hide();\r\n e.preventDefault();\r\n e.stopPropagation();\r\n break;\r\n case 37: // left\r\n case 38: // up\r\n case 39: // right\r\n case 40: // down\r\n if (!this.o.keyboardNavigation || this.o.daysOfWeekDisabled.length === 7)\r\n break;\r\n dir = e.keyCode === 37 || e.keyCode === 38 ? -1 : 1;\r\n if (this.viewMode === 0) {\r\n if (e.ctrlKey){\r\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear');\r\n\r\n if (newViewDate)\r\n this._trigger('changeYear', this.viewDate);\r\n } else if (e.shiftKey){\r\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth');\r\n\r\n if (newViewDate)\r\n this._trigger('changeMonth', this.viewDate);\r\n } else if (e.keyCode === 37 || e.keyCode === 39){\r\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveDay');\r\n } else if (!this.weekOfDateIsDisabled(focusDate)){\r\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveWeek');\r\n }\r\n } else if (this.viewMode === 1) {\r\n if (e.keyCode === 38 || e.keyCode === 40) {\r\n dir = dir * 4;\r\n }\r\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth');\r\n } else if (this.viewMode === 2) {\r\n if (e.keyCode === 38 || e.keyCode === 40) {\r\n dir = dir * 4;\r\n }\r\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear');\r\n }\r\n if (newViewDate){\r\n this.focusDate = this.viewDate = newViewDate;\r\n this.setValue();\r\n this.fill();\r\n e.preventDefault();\r\n }\r\n break;\r\n case 13: // enter\r\n if (!this.o.forceParse)\r\n break;\r\n focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;\r\n if (this.o.keyboardNavigation) {\r\n this._toggle_multidate(focusDate);\r\n dateChanged = true;\r\n }\r\n this.focusDate = null;\r\n this.viewDate = this.dates.get(-1) || this.viewDate;\r\n this.setValue();\r\n this.fill();\r\n if (this.picker.is(':visible')){\r\n e.preventDefault();\r\n e.stopPropagation();\r\n if (this.o.autoclose)\r\n this.hide();\r\n }\r\n break;\r\n case 9: // tab\r\n this.focusDate = null;\r\n this.viewDate = this.dates.get(-1) || this.viewDate;\r\n this.fill();\r\n this.hide();\r\n break;\r\n }\r\n if (dateChanged){\r\n if (this.dates.length)\r\n this._trigger('changeDate');\r\n else\r\n this._trigger('clearDate');\r\n this.inputField.trigger('change');\r\n }\r\n },\r\n\r\n setViewMode: function(viewMode){\r\n this.viewMode = viewMode;\r\n this.picker\r\n .children('div')\r\n .hide()\r\n .filter('.datepicker2-' + DPGlobal.viewModes[this.viewMode].clsName)\r\n .show();\r\n this.updateNavArrows();\r\n this._trigger('changeViewMode', new Date(this.viewDate));\r\n }\r\n };\r\n\r\n var DateRangePicker = function(element, options){\r\n $.data(element, 'datepicker2', this);\r\n this.element = $(element);\r\n this.inputs = $.map(options.inputs, function(i){\r\n return i.jquery ? i[0] : i;\r\n });\r\n delete options.inputs;\r\n\r\n this.keepEmptyValues = options.keepEmptyValues;\r\n delete options.keepEmptyValues;\r\n\r\n datepicker2Plugin.call($(this.inputs), options)\r\n .on('changeDate', $.proxy(this.dateUpdated, this));\r\n\r\n this.pickers = $.map(this.inputs, function(i){\r\n return $.data(i, 'datepicker2');\r\n });\r\n this.updateDates();\r\n };\r\n DateRangePicker.prototype = {\r\n updateDates: function(){\r\n this.dates = $.map(this.pickers, function(i){\r\n return i.getUTCDate();\r\n });\r\n this.updateRanges();\r\n },\r\n updateRanges: function(){\r\n var range = $.map(this.dates, function(d){\r\n return d.valueOf();\r\n });\r\n $.each(this.pickers, function(i, p){\r\n p.setRange(range);\r\n });\r\n },\r\n clearDates: function(){\r\n $.each(this.pickers, function(i, p){\r\n p.clearDates();\r\n });\r\n },\r\n dateUpdated: function(e){\r\n // `this.updating` is a workaround for preventing infinite recursion\r\n // between `changeDate` triggering and `setUTCDate` calling. Until\r\n // there is a better mechanism.\r\n if (this.updating)\r\n return;\r\n this.updating = true;\r\n\r\n var dp = $.data(e.target, 'datepicker2');\r\n\r\n if (dp === undefined) {\r\n return;\r\n }\r\n\r\n var new_date = dp.getUTCDate(),\r\n keep_empty_values = this.keepEmptyValues,\r\n i = $.inArray(e.target, this.inputs),\r\n j = i - 1,\r\n k = i + 1,\r\n l = this.inputs.length;\r\n if (i === -1)\r\n return;\r\n\r\n $.each(this.pickers, function(i, p){\r\n if (!p.getUTCDate() && (p === dp || !keep_empty_values))\r\n p.setUTCDate(new_date);\r\n });\r\n\r\n if (new_date < this.dates[j]){\r\n // Date being moved earlier/left\r\n while (j >= 0 && new_date < this.dates[j]){\r\n this.pickers[j--].setUTCDate(new_date);\r\n }\r\n } else if (new_date > this.dates[k]){\r\n // Date being moved later/right\r\n while (k < l && new_date > this.dates[k]){\r\n this.pickers[k++].setUTCDate(new_date);\r\n }\r\n }\r\n this.updateDates();\r\n\r\n delete this.updating;\r\n },\r\n destroy: function(){\r\n $.map(this.pickers, function(p){ p.destroy(); });\r\n $(this.inputs).off('changeDate', this.dateUpdated);\r\n delete this.element.data().datepicker2;\r\n },\r\n remove: alias('destroy', 'Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead')\r\n };\r\n\r\n function opts_from_el(el, prefix){\r\n // Derive options from element data-attrs\r\n var data = $(el).data(),\r\n out = {}, inkey,\r\n replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');\r\n prefix = new RegExp('^' + prefix.toLowerCase());\r\n function re_lower(_,a){\r\n return a.toLowerCase();\r\n }\r\n for (var key in data)\r\n if (prefix.test(key)){\r\n inkey = key.replace(replace, re_lower);\r\n out[inkey] = data[key];\r\n }\r\n return out;\r\n }\r\n\r\n function opts_from_locale(lang){\r\n // Derive options from locale plugins\r\n var out = {};\r\n // Check if \"de-DE\" style date is available, if not language should\r\n // fallback to 2 letter code eg \"de\"\r\n if (!dates[lang]){\r\n lang = lang.split('-')[0];\r\n if (!dates[lang])\r\n return;\r\n }\r\n var d = dates[lang];\r\n $.each(locale_opts, function(i,k){\r\n if (k in d)\r\n out[k] = d[k];\r\n });\r\n return out;\r\n }\r\n\r\n var old = $.fn.datepicker2;\r\n var datepicker2Plugin = function(option){\r\n var args = Array.apply(null, arguments);\r\n args.shift();\r\n var internal_return;\r\n this.each(function(){\r\n var $this = $(this),\r\n data = $this.data('datepicker2'),\r\n options = typeof option === 'object' && option;\r\n if (!data){\r\n var elopts = opts_from_el(this, 'date'),\r\n // Preliminary otions\r\n xopts = $.extend({}, defaults, elopts, options),\r\n locopts = opts_from_locale(xopts.language),\r\n // Options priority: js args, data-attrs, locales, defaults\r\n opts = $.extend({}, defaults, locopts, elopts, options);\r\n if ($this.hasClass('input-daterange') || opts.inputs){\r\n $.extend(opts, {\r\n inputs: opts.inputs || $this.find('input').toArray()\r\n });\r\n data = new DateRangePicker(this, opts);\r\n }\r\n else {\r\n data = new Datepicker2(this, opts);\r\n }\r\n $this.data('datepicker2', data);\r\n }\r\n if (typeof option === 'string' && typeof data[option] === 'function'){\r\n internal_return = data[option].apply(data, args);\r\n }\r\n });\r\n\r\n if (\r\n internal_return === undefined ||\r\n internal_return instanceof Datepicker2 ||\r\n internal_return instanceof DateRangePicker\r\n )\r\n return this;\r\n\r\n if (this.length > 1)\r\n throw new Error('Using only allowed for the collection of a single element (' + option + ' function)');\r\n else\r\n return internal_return;\r\n };\r\n $.fn.datepicker2 = datepicker2Plugin;\r\n\r\n var defaults = $.fn.datepicker2.defaults = {\r\n assumeNearbyYear: false,\r\n autoclose: false,\r\n beforeShowDay: $.noop,\r\n beforeShowMonth: $.noop,\r\n beforeShowYear: $.noop,\r\n beforeShowDecade: $.noop,\r\n beforeShowCentury: $.noop,\r\n calendarWeeks: false,\r\n clearBtn: false,\r\n toggleActive: false,\r\n daysOfWeekDisabled: [],\r\n daysOfWeekHighlighted: [],\r\n datesDisabled: [],\r\n endDate: Infinity,\r\n forceParse: true,\r\n format: 'mm/dd/yyyy',\r\n keepEmptyValues: false,\r\n keyboardNavigation: true,\r\n language: 'en',\r\n minViewMode: 0,\r\n maxViewMode: 4,\r\n multidate: false,\r\n multidateSeparator: ',',\r\n orientation: \"auto\",\r\n rtl: false,\r\n startDate: -Infinity,\r\n startView: 0,\r\n todayBtn: false,\r\n todayHighlight: false,\r\n updateViewDate: true,\r\n weekStart: 0,\r\n disableTouchKeyboard: false,\r\n enableOnReadonly: true,\r\n showOnFocus: true,\r\n zIndexOffset: 10,\r\n container: 'body',\r\n immediateUpdates: false,\r\n title: '',\r\n templates: {\r\n leftArrow: '«',\r\n rightArrow: '»'\r\n },\r\n showWeekDays: true\r\n };\r\n var locale_opts = $.fn.datepicker2.locale_opts = [\r\n 'format',\r\n 'rtl',\r\n 'weekStart'\r\n ];\r\n $.fn.datepicker2.Constructor = Datepicker2;\r\n var dates = $.fn.datepicker2.dates = {\r\n en: {\r\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\r\n daysShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\r\n daysMin: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\r\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\r\n monthsShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\r\n today: \"Today\",\r\n clear: \"Clear\",\r\n titleFormat: \"MM yyyy\"\r\n }\r\n };\r\n\r\n var DPGlobal = {\r\n viewModes: [\r\n {\r\n names: ['days', 'month'],\r\n clsName: 'days',\r\n e: 'changeMonth'\r\n },\r\n {\r\n names: ['months', 'year'],\r\n clsName: 'months',\r\n e: 'changeYear',\r\n navStep: 1\r\n },\r\n {\r\n names: ['years', 'decade'],\r\n clsName: 'years',\r\n e: 'changeDecade',\r\n navStep: 10\r\n },\r\n {\r\n names: ['decades', 'century'],\r\n clsName: 'decades',\r\n e: 'changeCentury',\r\n navStep: 100\r\n },\r\n {\r\n names: ['centuries', 'millennium'],\r\n clsName: 'centuries',\r\n e: 'changeMillennium',\r\n navStep: 1000\r\n }\r\n ],\r\n validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,\r\n nonpunctuation: /[^ -\\/:-@\\u5e74\\u6708\\u65e5\\[-`{-~\\t\\n\\r]+/g,\r\n parseFormat: function(format){\r\n if (typeof format.toValue === 'function' && typeof format.toDisplay === 'function')\r\n return format;\r\n // IE treats \\0 as a string end in inputs (truncating the value),\r\n // so it's a bad format delimiter, anyway\r\n var separators = format.replace(this.validParts, '\\0').split('\\0'),\r\n parts = format.match(this.validParts);\r\n if (!separators || !separators.length || !parts || parts.length === 0){\r\n throw new Error(\"Invalid date format.\");\r\n }\r\n return {separators: separators, parts: parts};\r\n },\r\n parseDate: function(date, format, language, assumeNearby){\r\n if (!date)\r\n return undefined;\r\n if (date instanceof Date)\r\n return date;\r\n if (typeof format === 'string')\r\n format = DPGlobal.parseFormat(format);\r\n if (format.toValue)\r\n return format.toValue(date, format, language);\r\n var fn_map = {\r\n d: 'moveDay',\r\n m: 'moveMonth',\r\n w: 'moveWeek',\r\n y: 'moveYear'\r\n },\r\n dateAliases = {\r\n yesterday: '-1d',\r\n today: '+0d',\r\n tomorrow: '+1d'\r\n },\r\n parts, part, dir, i, fn;\r\n if (date in dateAliases){\r\n date = dateAliases[date];\r\n }\r\n if (/^[\\-+]\\d+[dmwy]([\\s,]+[\\-+]\\d+[dmwy])*$/i.test(date)){\r\n parts = date.match(/([\\-+]\\d+)([dmwy])/gi);\r\n date = new Date();\r\n for (i=0; i < parts.length; i++){\r\n part = parts[i].match(/([\\-+]\\d+)([dmwy])/i);\r\n dir = Number(part[1]);\r\n fn = fn_map[part[2].toLowerCase()];\r\n date = Datepicker2.prototype[fn](date, dir);\r\n }\r\n return Datepicker2.prototype._zero_utc_time(date);\r\n }\r\n\r\n parts = date && date.match(this.nonpunctuation) || [];\r\n\r\n function applyNearbyYear(year, threshold){\r\n if (threshold === true)\r\n threshold = 10;\r\n\r\n // if year is 2 digits or less, than the user most likely is trying to get a recent century\r\n if (year < 100){\r\n year += 2000;\r\n // if the new year is more than threshold years in advance, use last century\r\n if (year > ((new Date()).getFullYear()+threshold)){\r\n year -= 100;\r\n }\r\n }\r\n\r\n return year;\r\n }\r\n\r\n var parsed = {},\r\n setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],\r\n setters_map = {\r\n yyyy: function(d,v){\r\n return d.setUTCFullYear(assumeNearby ? applyNearbyYear(v, assumeNearby) : v);\r\n },\r\n m: function(d,v){\r\n if (isNaN(d))\r\n return d;\r\n v -= 1;\r\n while (v < 0) v += 12;\r\n v %= 12;\r\n d.setUTCMonth(v);\r\n while (d.getUTCMonth() !== v)\r\n d.setUTCDate(d.getUTCDate()-1);\r\n return d;\r\n },\r\n d: function(d,v){\r\n return d.setUTCDate(v);\r\n }\r\n },\r\n val, filtered;\r\n setters_map['yy'] = setters_map['yyyy'];\r\n setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];\r\n setters_map['dd'] = setters_map['d'];\r\n date = UTCToday();\r\n var fparts = format.parts.slice();\r\n // Remove noop parts\r\n if (parts.length !== fparts.length){\r\n fparts = $(fparts).filter(function(i,p){\r\n return $.inArray(p, setters_order) !== -1;\r\n }).toArray();\r\n }\r\n // Process remainder\r\n function match_part(){\r\n var m = this.slice(0, parts[i].length),\r\n p = parts[i].slice(0, m.length);\r\n return m.toLowerCase() === p.toLowerCase();\r\n }\r\n if (parts.length === fparts.length){\r\n var cnt;\r\n for (i=0, cnt = fparts.length; i < cnt; i++){\r\n val = parseInt(parts[i], 10);\r\n part = fparts[i];\r\n if (isNaN(val)){\r\n switch (part){\r\n case 'MM':\r\n filtered = $(dates[language].months).filter(match_part);\r\n val = $.inArray(filtered[0], dates[language].months) + 1;\r\n break;\r\n case 'M':\r\n filtered = $(dates[language].monthsShort).filter(match_part);\r\n val = $.inArray(filtered[0], dates[language].monthsShort) + 1;\r\n break;\r\n }\r\n }\r\n parsed[part] = val;\r\n }\r\n var _date, s;\r\n for (i=0; i < setters_order.length; i++){\r\n s = setters_order[i];\r\n if (s in parsed && !isNaN(parsed[s])){\r\n _date = new Date(date);\r\n setters_map[s](_date, parsed[s]);\r\n if (!isNaN(_date))\r\n date = _date;\r\n }\r\n }\r\n }\r\n return date;\r\n },\r\n formatDate: function(date, format, language){\r\n if (!date)\r\n return '';\r\n if (typeof format === 'string')\r\n format = DPGlobal.parseFormat(format);\r\n if (format.toDisplay)\r\n return format.toDisplay(date, format, language);\r\n var val = {\r\n d: date.getUTCDate(),\r\n D: dates[language].daysShort[date.getUTCDay()],\r\n DD: dates[language].days[date.getUTCDay()],\r\n m: date.getUTCMonth() + 1,\r\n M: dates[language].monthsShort[date.getUTCMonth()],\r\n MM: dates[language].months[date.getUTCMonth()],\r\n yy: date.getUTCFullYear().toString().substring(2),\r\n yyyy: date.getUTCFullYear()\r\n };\r\n val.dd = (val.d < 10 ? '0' : '') + val.d;\r\n val.mm = (val.m < 10 ? '0' : '') + val.m;\r\n date = [];\r\n var seps = $.extend([], format.separators);\r\n for (var i=0, cnt = format.parts.length; i <= cnt; i++){\r\n if (seps.length)\r\n date.push(seps.shift());\r\n date.push(val[format.parts[i]]);\r\n }\r\n return date.join('');\r\n },\r\n headTemplate: ''+\r\n '
';\r\n\r\n $.fn.datepicker2.DPGlobal = DPGlobal;\r\n\r\n\r\n /* DATEPICKER NO CONFLICT\r\n * =================== */\r\n\r\n $.fn.datepicker2.noConflict = function(){\r\n $.fn.datepicker2 = old;\r\n return this;\r\n };\r\n\r\n /* DATEPICKER VERSION\r\n * =================== */\r\n $.fn.datepicker2.version = '1.9.0';\r\n\r\n $.fn.datepicker2.deprecated = function(msg){\r\n var console = window.console;\r\n if (console && console.warn) {\r\n console.warn('DEPRECATED: ' + msg);\r\n }\r\n };\r\n\r\n\r\n /* DATEPICKER DATA-API\r\n * ================== */\r\n\r\n $(document).on(\r\n 'focus.datepicker2.data-api click.datepicker2.data-api',\r\n '[data-provide=\"datepicker2\"]',\r\n function(e){\r\n var $this = $(this);\r\n if ($this.data('datepicker2'))\r\n return;\r\n e.preventDefault();\r\n // component click requires us to explicitly show it\r\n datepicker2Plugin.call($this, 'show');\r\n }\r\n );\r\n $(function(){\r\n datepicker2Plugin.call($('[data-provide=\"datepicker2-inline\"]'));\r\n });\r\n\r\n}));\r\n"],"names":["factory","$","undefined","UTCDate","Date","UTC","apply","arguments","UTCToday","today","getFullYear","getMonth","getDate","isUTCEquals","date1","date2","getUTCFullYear","getUTCMonth","getUTCDate","alias","method","deprecationMsg","fn","datepicker2","deprecated","this","extras","DateArray","get","i","slice","contains","d","val","valueOf","l","length","remove","splice","replace","new_array","isArray","clear","push","copy","a","extend","Datepicker2","element","options","data","_events","_secondaryEvents","_process_options","dates","viewDate","o","defaultViewDate","focusDate","isInput","is","inputField","find","component","hasClass","isInline","picker","DPGlobal","template","_check_template","templates","leftArrow","html","rightArrow","_buildEvents","_attachEvents","addClass","appendTo","rtl","calendarWeeks","attr","Number","startDate","_o","endDate","daysOfWeekDisabled","daysOfWeekHighlighted","datesDisabled","_allow_update","setViewMode","startView","fillDow","fillMonths","update","show","prototype","constructor","_resolveViewName","view","each","viewModes","viewMode","inArray","names","_resolveDaysOfWeek","daysOfWeek","split","map","tmp","match","ex","opts","lang","language","defaults","minViewMode","maxViewMode","Math","max","min","multidate","multidateSeparator","String","weekStart","weekEnd","format","parseFormat","_local_to_utc","_zero_time","parseDate","assumeNearbyYear","Infinity","plc","orientation","toLowerCase","_plc","grep","word","test","x","y","year","month","day","_applyEvents","evs","el","ch","ev","on","_unapplyEvents","off","events","keyup","proxy","e","keyCode","keydown","paste","showOnFocus","focus","click","blur","_focused_from","target","immediateUpdates","date","navArrowsClick","dayCellClick","window","resize","place","document","hide","_detachEvents","_attachSecondaryEvents","_detachSecondaryEvents","_trigger","event","altdate","local_date","_utc_to_local","trigger","type","ix","formatDate","prop","enableOnReadonly","container","navigator","msMaxTouchPoints","disableTouchKeyboard","detach","forceParse","setValue","destroy","dateString","originalEvent","clipboardData","types","getData","setDate","preventDefault","utc","local","getTime","getTimezoneOffset","_zero_utc_time","getDates","getUTCDates","selected_date","clearDates","autoclose","setDates","args","setUTCDates","setUTCDate","formatted","getFormattedDate","join","getStartDate","setStartDate","updateNavArrows","getEndDate","setEndDate","setDaysOfWeekDisabled","setDaysOfWeekHighlighted","setDatesDisabled","calendarWidth","outerWidth","calendarHeight","outerHeight","windowWidth","width","scrollTop","appendOffset","offset","parentsZindex","parents","itemZIndex","css","zIndex","zIndexOffset","parent","height","left","top","removeClass","yorient","parseInt","right","oldDates","fromArgs","dateWithinRange","updateViewDate","change","fill","showWeekDays","dowCnt","daysMin","append","localDate","monthsShort","setRange","range","getClassNames","cls","todayHighlight","dateIsDisabled","getUTCDay","_fill_yearsView","selector","cssClass","factor","startYear","endYear","beforeFn","classes","tooltip","before","step","startVal","floor","endVal","focusedVal","selected","currVal","noop","enabled","concat","text","startMonth","endMonth","todaytxt","cleartxt","titleFormat","todayDate","titleBtnVisible","todayBtn","weekOfDateIsDisabled","isNaN","clearBtn","title","prevMonth","nextMonth","setUTCFullYear","weekDay","clsName","ws","th","yth","calWeek","content","beforeShowDay","isFunction","uniqueSort","unique","toString","monthsTitle","months","end","eq","beforeShowMonth","that","moDate","beforeShowYear","beforeShowDecade","beforeShowCentury","prevIsDisabled","nextIsDisabled","toggleClass","stopPropagation","_setDate","index","setUTCMonth","timestamp","currentTarget","dir","navStep","moveMonth","_toggle_multidate","toggleActive","which","moveDay","newDate","moveWeek","new_month","new_date","mag","abs","moveYear","moveAvailableDate","newViewDate","dateChanged","keyboardNavigation","ctrlKey","shiftKey","children","filter","DateRangePicker","inputs","jquery","keepEmptyValues","datepicker2Plugin","call","dateUpdated","pickers","updateDates","opts_from_el","prefix","out","RegExp","re_lower","_","key","opts_from_locale","locale_opts","k","updateRanges","p","updating","dp","keep_empty_values","j","old","option","internal_return","Array","shift","$this","elopts","locopts","toArray","Error","Constructor","en","days","daysShort","validParts","nonpunctuation","toValue","toDisplay","separators","parts","assumeNearby","part","fn_map","m","w","dateAliases","yesterday","tomorrow","filtered","parsed","setters_order","setters_map","yyyy","v","threshold","fparts","match_part","cnt","_date","s","D","DD","M","MM","yy","substring","dd","mm","seps","headTemplate","contTemplate","footTemplate","noConflict","version","msg","console","warn","define","amd","exports","require","jQuery"],"mappings":"AAMC,IAASA,QAAAA,QAQR,SAASC,EAAGC,sBACDC,iBACE,IAAIC,KAAKA,KAAKC,IAAIC,MAAMF,KAAMG,qBAEhCC,eACDC,MAAQ,IAAIL,YACTD,QAAQM,MAAMC,cAAeD,MAAME,WAAYF,MAAMG,oBAEvDC,YAA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AGC,YAAYC,WAAa,SAAS8Z,SAC/BC,QAAU9Q,OAAO8Q,QACjBA,SAAWA,QAAQC,MACnBD,QAAQC,KAAK,eAAiBF,MAQtCrb,EAAE2K,UAAUvB,GACR,wDACA,gCACA,SAASM,OACD0O,MAAQpY,EAAEwB,MACV4W,MAAMnV,KAAK,iBAEfyG,EAAE+C,iBAEFiK,kBAAkBC,KAAKyB,MAAO,YAGtCpY,GAAE,WACE0W,kBAAkBC,KAAK3W,EAAE,4CA5+DP,mBAAXwb,QAAyBA,OAAOC,IACvCD,+BAAO,CAAC,UAAWzb,SACO,iBAAZ2b,QACd3b,QAAQ4b,QAAQ,WAEhB5b,QAAQ6b"}
\ No newline at end of file
diff --git a/amd/build/group-user-selector.min.js.map b/amd/build/group-user-selector.min.js.map
index 4d56844..643c3b2 100644
--- a/amd/build/group-user-selector.min.js.map
+++ b/amd/build/group-user-selector.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"group-user-selector.min.js","sources":["../src/group-user-selector.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Search user selector module.\n *\n * @module block_dash/group-user-selector\n * @copyright 2017 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax', 'core/templates'], function($, Ajax, Templates) {\n\n return /** @alias module:block_dash/group-user-selector */ {\n\n processResults: function(selector, results) {\n var users = [];\n $.each(results, function(index, user) {\n users.push({\n value: user.id,\n label: user._label\n });\n });\n return users;\n },\n\n transport: function(selector, query, success, failure) {\n var promise;\n\n // Search within specific course if known and if the 'search within' dropdown is set\n // to search within course or activity.\n var args = {query: query};\n\n var groupid = $(selector).data('groupid');\n if (typeof groupid !== \"undefined\" && $('#id_searchwithin').val() !== '') {\n args.groupid = groupid;\n } else {\n args.groupid = 0;\n }\n\n // Call AJAX request.\n promise = Ajax.call([{methodname: 'block_dash_groups_get_non_members', args: args}]);\n\n // When AJAX request returns, handle the results.\n promise[0].then(function(results) {\n var promises = [];\n\n // Render label with user name and picture.\n $.each(results, function(index, user) {\n promises.push(Templates.render('mod_assign/list_participant_user_summary', user));\n });\n\n // Apply the label to the results.\n return $.when.apply($.when, promises).then(function() {\n var args = arguments;\n var i = 0;\n $.each(results, function(index, user) {\n user._label = args[i++];\n });\n success(results);\n return;\n });\n\n }).fail(failure);\n }\n\n };\n\n});\n"],"names":["define","$","Ajax","Templates","processResults","selector","results","users","each","index","user","push","value","id","label","_label","transport","query","success","failure","args","groupid","data","val","call","methodname","then","promises","render","when","apply","arguments","i","fail"],"mappings":";;;;;;;AAuBAA,wCAAO,CAAC,SAAU,YAAa,mBAAmB,SAASC,EAAGC,KAAMC,iBAEL,CAEvDC,eAAgB,SAASC,SAAUC,aAC3BC,MAAQ,UACZN,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BH,MAAMI,KAAK,CACPC,MAAOF,KAAKG,GACZC,MAAOJ,KAAKK,YAGbR,OAGXS,UAAW,SAASX,SAAUY,MAAOC,QAASC,aAKtCC,KAAO,CAACH,MAAOA,OAEfI,QAAUpB,EAAEI,UAAUiB,KAAK,gBACR,IAAZD,SAA2D,KAAhCpB,EAAE,oBAAoBsB,MACxDH,KAAKC,QAAUA,QAEfD,KAAKC,QAAU,EAITnB,KAAKsB,KAAK,CAAC,CAACC,WAAY,oCAAqCL,KAAMA,QAGrE,GAAGM,MAAK,SAASpB,aACjBqB,SAAW,UAGf1B,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BiB,SAAShB,KAAKR,UAAUyB,OAAO,2CAA4ClB,UAIxET,EAAE4B,KAAKC,MAAM7B,EAAE4B,KAAMF,UAAUD,MAAK,eACnCN,KAAOW,UACPC,EAAI,EACR/B,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BA,KAAKK,OAASK,KAAKY,QAEvBd,QAAQZ,eAIb2B,KAAKd"}
\ No newline at end of file
+{"version":3,"file":"group-user-selector.min.js","sources":["../src/group-user-selector.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\r\n//\r\n// Moodle is free software: you can redistribute it and/or modify\r\n// it under the terms of the GNU General Public License as published by\r\n// the Free Software Foundation, either version 3 of the License, or\r\n// (at your option) any later version.\r\n//\r\n// Moodle is distributed in the hope that it will be useful,\r\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\n// GNU General Public License for more details.\r\n//\r\n// You should have received a copy of the GNU General Public License\r\n// along with Moodle. If not, see .\r\n\r\n/**\r\n * Search user selector module.\r\n *\r\n * @module block_dash/group-user-selector\r\n * @copyright 2017 The Open University\r\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\r\n */\r\n\r\ndefine(['jquery', 'core/ajax', 'core/templates'], function($, Ajax, Templates) {\r\n\r\n return /** @alias module:block_dash/group-user-selector */ {\r\n\r\n processResults: function(selector, results) {\r\n var users = [];\r\n $.each(results, function(index, user) {\r\n users.push({\r\n value: user.id,\r\n label: user._label\r\n });\r\n });\r\n return users;\r\n },\r\n\r\n transport: function(selector, query, success, failure) {\r\n var promise;\r\n\r\n // Search within specific course if known and if the 'search within' dropdown is set\r\n // to search within course or activity.\r\n var args = {query: query};\r\n\r\n var groupid = $(selector).data('groupid');\r\n if (typeof groupid !== \"undefined\" && $('#id_searchwithin').val() !== '') {\r\n args.groupid = groupid;\r\n } else {\r\n args.groupid = 0;\r\n }\r\n\r\n // Call AJAX request.\r\n promise = Ajax.call([{methodname: 'block_dash_groups_get_non_members', args: args}]);\r\n\r\n // When AJAX request returns, handle the results.\r\n promise[0].then(function(results) {\r\n var promises = [];\r\n\r\n // Render label with user name and picture.\r\n $.each(results, function(index, user) {\r\n promises.push(Templates.render('mod_assign/list_participant_user_summary', user));\r\n });\r\n\r\n // Apply the label to the results.\r\n return $.when.apply($.when, promises).then(function() {\r\n var args = arguments;\r\n var i = 0;\r\n $.each(results, function(index, user) {\r\n user._label = args[i++];\r\n });\r\n success(results);\r\n return;\r\n });\r\n\r\n }).fail(failure);\r\n }\r\n\r\n };\r\n\r\n});\r\n"],"names":["define","$","Ajax","Templates","processResults","selector","results","users","each","index","user","push","value","id","label","_label","transport","query","success","failure","args","groupid","data","val","call","methodname","then","promises","render","when","apply","arguments","i","fail"],"mappings":";;;;;;;AAuBAA,wCAAO,CAAC,SAAU,YAAa,mBAAmB,SAASC,EAAGC,KAAMC,iBAEL,CAEvDC,eAAgB,SAASC,SAAUC,aAC3BC,MAAQ,UACZN,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BH,MAAMI,KAAK,CACPC,MAAOF,KAAKG,GACZC,MAAOJ,KAAKK,YAGbR,OAGXS,UAAW,SAASX,SAAUY,MAAOC,QAASC,aAKtCC,KAAO,CAACH,MAAOA,OAEfI,QAAUpB,EAAEI,UAAUiB,KAAK,gBACR,IAAZD,SAA2D,KAAhCpB,EAAE,oBAAoBsB,MACxDH,KAAKC,QAAUA,QAEfD,KAAKC,QAAU,EAITnB,KAAKsB,KAAK,CAAC,CAACC,WAAY,oCAAqCL,KAAMA,QAGrE,GAAGM,MAAK,SAASpB,aACjBqB,SAAW,UAGf1B,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BiB,SAAShB,KAAKR,UAAUyB,OAAO,2CAA4ClB,UAIxET,EAAE4B,KAAKC,MAAM7B,EAAE4B,KAAMF,UAAUD,MAAK,eACnCN,KAAOW,UACPC,EAAI,EACR/B,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BA,KAAKK,OAASK,KAAKY,QAEvBd,QAAQZ,eAIb2B,KAAKd"}
\ No newline at end of file
diff --git a/amd/build/groups.min.js.map b/amd/build/groups.min.js.map
index deacbf6..ac53394 100644
--- a/amd/build/groups.min.js.map
+++ b/amd/build/groups.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"groups.min.js","sources":["../src/groups.js"],"sourcesContent":["\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events',\n 'core/fragment', 'core/templates', 'core/ajax', 'core/notification'],\nfunction($, Str, Modal, ModalEvents, Fragment, Templates, AJAX, Notification) {\n\n return {\n init: function(contextID) {\n\n var groupModal = document.getElementsByClassName('group-widget-viewmembers');\n Array.from(groupModal).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n var target = e.target;\n var group = target.getAttribute('data-group');\n Modal.create({\n title: Str.get_string('groups', 'core')\n }).then(function(modal) {\n modal.show();\n var args = JSON.stringify({group: group});\n var params = {widget: 'groups', method: 'viewmembers', args: args};\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\n modal.setBody(html);\n Templates.runTemplateJS(js);\n return html;\n }).catch(Notification.exception);\n modal.getRoot().on(ModalEvents.hidden, function() {\n modal.destroy();\n });\n return modal;\n }).catch(Notification.exception);\n });\n });\n\n var groupUsers = document.getElementsByClassName('add-group-users');\n Array.from(groupUsers).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n addGroupUsers(e);\n });\n });\n\n /**\n * Modal create for add member to groups menu.\n * @param {Event} e\n */\n function addGroupUsers(e) {\n var target = e.target;\n var group = target.getAttribute('data-group');\n Modal.create({\n type: Modal.types.SAVE_CANCEL,\n title: Str.get_string('widget:groups:adduser', 'block_dash'),\n }).then(function(modal) {\n modal.setLarge(true);\n modal.show();\n\n var args = JSON.stringify({group: group});\n var params = {widget: 'groups', method: 'addmembers', args: args};\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\n modal.setBody(html);\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\n groupAddEventListeners(form);\n });\n\n Templates.runTemplateJS(js);\n return html;\n }).catch(Notification.exception);\n\n modal.getRoot().on(ModalEvents.hidden, function() {\n modal.destroy();\n });\n\n // Apply and save method.\n modal.getRoot().on(ModalEvents.save, (e) => {\n e.preventDefault();\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\n form.querySelector('#id_submitbutton').click();\n });\n });\n return modal;\n }).catch(Notification.exception);\n }\n\n /**\n * Event listener for add memebers to groups form submit.\n * @param {Array} form\n */\n function groupAddEventListeners(form) {\n form.addEventListener('submit', function(e) {\n e.preventDefault();\n var formdata = new FormData(e.target);\n if (e.target.querySelector('[name=\"users[]\"]').value == '') {\n return false;\n }\n var formdatastr = new URLSearchParams(formdata).toString();\n var promises = AJAX.call([{\n methodname: 'block_dash_groups_add_members',\n args: {formdata: formdatastr}\n }]);\n\n promises[0].done((response) => {\n if (response == true) {\n window.location.reload();\n } else {\n // TODO: Error Notification.\n }\n });\n return true;\n });\n }\n\n // Leave group.\n var leaveGroupModal = document.getElementsByClassName('group-widget-leavegroup');\n Array.from(leaveGroupModal).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n leaveGroup(e);\n });\n });\n\n /**\n * Event observer for leave group menu clicked to trigger the confirmation modal.\n * @param {event} e\n */\n function leaveGroup(e) {\n var target = e.target;\n var group = target.getAttribute('data-group');\n var groupname = target.getAttribute('data-groupname');\n\n Modal.create({\n type: Modal.types.SAVE_CANCEL,\n title: Str.get_string('groups', 'core'),\n }).then(function(modal) {\n Str.get_string('confirm', 'core').then((html) => {\n modal.setSaveButtonText(html);\n return html;\n }).catch(Notification.exception);\n modal.show();\n\n Str.get_string('confirmleavegroup', 'block_dash', groupname).then((html) => {\n modal.setBody(html);\n return html;\n }).catch(Notification.exception);\n\n modal.getRoot().on(ModalEvents.save, (e) => {\n e.preventDefault();\n var promises = AJAX.call([{\n methodname: 'block_dash_groups_leave_group',\n args: {groupid: group}\n }]);\n\n promises[0].done((response) => {\n if (response == true) {\n window.location.reload();\n } else {\n // TODO: Error Notification.\n }\n });\n });\n\n modal.getRoot().on(ModalEvents.hidden, function() {\n modal.destroy();\n });\n\n modal.getRoot().on(ModalEvents.destroyed, function() {\n modal.remove();\n modal.attachmentPoint.remove();\n });\n return modal;\n }).catch(Notification.exception);\n }\n\n // Create group.\n var createGroupModal = document.getElementsByClassName('create-group');\n Array.from(createGroupModal).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n createGroup();\n });\n });\n\n /**\n * Event listner for create group modal trigger.\n */\n function createGroup() {\n\n Modal.create({\n type: Modal.types.SAVE_CANCEL,\n title: Str.get_string('groups', 'core'),\n }).then(function(modal) {\n modal.show();\n\n var args = \"\";\n var params = {widget: 'groups', method: 'creategroup', args: args};\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\n modal.setBody(html);\n Templates.runTemplateJS(js);\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\n createGroupEvent(form);\n });\n return html;\n }).catch(Notification.exception);\n\n // Apply and save method.\n modal.getRoot().on(ModalEvents.save, (e) => {\n e.preventDefault();\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\n form.querySelector('#id_submitbutton').click();\n });\n });\n\n modal.getRoot().on(ModalEvents.hidden, function() {\n modal.destroy();\n });\n return modal;\n }).catch(Notification.exception);\n\n\n }\n /**\n * Event listner for create group forms in modal to init the group creation.\n * @param {Array} form\n */\n function createGroupEvent(form) {\n form.addEventListener('submit', function(e) {\n e.preventDefault();\n var formdata = new FormData(e.target);\n if (e.target.querySelector('[name=\"name\"]').value == \"\"\n || e.target.querySelector('[name=\"courseid\"]').value == '') {\n return false;\n }\n var formdatastr = new URLSearchParams(formdata).toString();\n var promises = AJAX.call([{\n methodname: 'block_dash_groups_create_group',\n args: {formdata: formdatastr}\n }]);\n\n promises[0].done((response) => {\n return (response == true) ? window.location.reload() : '';\n });\n return true;\n });\n }\n }\n };\n});\n"],"names":["define","$","Str","Modal","ModalEvents","Fragment","Templates","AJAX","Notification","init","contextID","groupModal","document","getElementsByClassName","Array","from","forEach","element","addEventListener","e","preventDefault","group","target","getAttribute","create","title","get_string","then","modal","show","params","widget","method","args","JSON","stringify","loadFragment","html","js","setBody","runTemplateJS","catch","exception","getRoot","on","hidden","destroy","groupUsers","type","types","SAVE_CANCEL","setLarge","get","querySelectorAll","form","formdata","FormData","querySelector","value","formdatastr","URLSearchParams","toString","call","methodname","done","response","window","location","reload","groupAddEventListeners","save","click","addGroupUsers","leaveGroupModal","groupname","setSaveButtonText","groupid","destroyed","remove","attachmentPoint","leaveGroup","createGroupModal","createGroupEvent"],"mappings":"AACAA,2BAAO,CAAC,SAAU,WAAY,qBAAsB,oBAChD,gBAAiB,iBAAkB,YAAa,sBACpD,SAASC,EAAGC,IAAKC,MAAOC,YAAaC,SAAUC,UAAWC,KAAMC,oBAErD,CACHC,KAAM,SAASC,eAEPC,WAAaC,SAASC,uBAAuB,4BACjDC,MAAMC,KAAKJ,YAAYK,SAAQ,SAASC,SACpCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,qBAEEC,MADSF,EAAEG,OACIC,aAAa,cAChCpB,MAAMqB,OAAO,CACTC,MAAOvB,IAAIwB,WAAW,SAAU,UACjCC,MAAK,SAASC,OACbA,MAAMC,WAEFC,OAAS,CAACC,OAAQ,SAAUC,OAAQ,cAAeC,KAD5CC,KAAKC,UAAU,CAACd,MAAOA,gBAElChB,SAAS+B,aAAa,aAAc,aAAc1B,UAAWoB,QAAQH,MAAK,CAACU,KAAMC,MAC7EV,MAAMW,QAAQF,MACd/B,UAAUkC,cAAcF,IACjBD,QACRI,MAAMjC,aAAakC,WACtBd,MAAMe,UAAUC,GAAGxC,YAAYyC,QAAQ,WACnCjB,MAAMkB,aAEHlB,SACRa,MAAMjC,aAAakC,qBAI1BK,WAAanC,SAASC,uBAAuB,mBACjDC,MAAMC,KAAKgC,YAAY/B,SAAQ,SAASC,SACpCA,QAAQ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QAAQF,MACd/B,UAAUkC,cAAcF,IACxBV,MAAMe,UAAUS,IAAI,GAAGC,iBAAiB,QAAQrC,SAAQsC,iBA0B1CA,MACtBA,KAAKpC,iBAAiB,UAAU,SAASC,GACrCA,EAAEC,qBACEmC,SAAW,IAAIC,SAASrC,EAAEG,WACuB,IAAjDH,EAAEG,OAAOmC,cAAc,iBAAiBC,OACgB,IAArDvC,EAAEG,OAAOmC,cAAc,qBAAqBC,aACxC,MAEPC,YAAc,IAAIC,gBAAgBL,UAAUM,kBACjCtD,KAAKuD,KAAK,CAAC,CACtBC,WAAY,iCACZ9B,KAAM,CAACsB,SAAUI,gBAGZ,GAAGK,MAAMC,UACM,GAAZA,SAAoBC,OAAOC,SAASC,SAAW,MAEpD,KA1CCc,CAAiB5B,SAEdjB,QACRI,MAAMjC,aAAakC,WAGtBd,MAAMe,UAAUC,GAAGxC,YAAYkE,MAAOnD,IAClCA,EAAEC,iBACFQ,MAAMe,UAAUS,IAAI,GAAGC,iBAAiB,QAAQrC,SAAQsC,OACpDA,KAAKG,cAAc,oBAAoBc,cAI/C3C,MAAMe,UAAUC,GAAGxC,YAAYyC,QAAQ,WACnCjB,MAAMkB,aAEHlB,SACRa,MAAMjC,aAAakC"}
\ No newline at end of file
+{"version":3,"file":"groups.min.js","sources":["../src/groups.js"],"sourcesContent":["\r\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events',\r\n 'core/fragment', 'core/templates', 'core/ajax', 'core/notification'],\r\nfunction($, Str, Modal, ModalEvents, Fragment, Templates, AJAX, Notification) {\r\n\r\n return {\r\n init: function(contextID) {\r\n\r\n var groupModal = document.getElementsByClassName('group-widget-viewmembers');\r\n Array.from(groupModal).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n var target = e.target;\r\n var group = target.getAttribute('data-group');\r\n Modal.create({\r\n title: Str.get_string('groups', 'core')\r\n }).then(function(modal) {\r\n modal.show();\r\n var args = JSON.stringify({group: group});\r\n var params = {widget: 'groups', method: 'viewmembers', args: args};\r\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\r\n modal.setBody(html);\r\n Templates.runTemplateJS(js);\r\n return html;\r\n }).catch(Notification.exception);\r\n modal.getRoot().on(ModalEvents.hidden, function() {\r\n modal.destroy();\r\n });\r\n return modal;\r\n }).catch(Notification.exception);\r\n });\r\n });\r\n\r\n var groupUsers = document.getElementsByClassName('add-group-users');\r\n Array.from(groupUsers).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n addGroupUsers(e);\r\n });\r\n });\r\n\r\n /**\r\n * Modal create for add member to groups menu.\r\n * @param {Event} e\r\n */\r\n function addGroupUsers(e) {\r\n var target = e.target;\r\n var group = target.getAttribute('data-group');\r\n Modal.create({\r\n type: Modal.types.SAVE_CANCEL,\r\n title: Str.get_string('widget:groups:adduser', 'block_dash'),\r\n }).then(function(modal) {\r\n modal.setLarge(true);\r\n modal.show();\r\n\r\n var args = JSON.stringify({group: group});\r\n var params = {widget: 'groups', method: 'addmembers', args: args};\r\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\r\n modal.setBody(html);\r\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\r\n groupAddEventListeners(form);\r\n });\r\n\r\n Templates.runTemplateJS(js);\r\n return html;\r\n }).catch(Notification.exception);\r\n\r\n modal.getRoot().on(ModalEvents.hidden, function() {\r\n modal.destroy();\r\n });\r\n\r\n // Apply and save method.\r\n modal.getRoot().on(ModalEvents.save, (e) => {\r\n e.preventDefault();\r\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\r\n form.querySelector('#id_submitbutton').click();\r\n });\r\n });\r\n return modal;\r\n }).catch(Notification.exception);\r\n }\r\n\r\n /**\r\n * Event listener for add memebers to groups form submit.\r\n * @param {Array} form\r\n */\r\n function groupAddEventListeners(form) {\r\n form.addEventListener('submit', function(e) {\r\n e.preventDefault();\r\n var formdata = new FormData(e.target);\r\n if (e.target.querySelector('[name=\"users[]\"]').value == '') {\r\n return false;\r\n }\r\n var formdatastr = new URLSearchParams(formdata).toString();\r\n var promises = AJAX.call([{\r\n methodname: 'block_dash_groups_add_members',\r\n args: {formdata: formdatastr}\r\n }]);\r\n\r\n promises[0].done((response) => {\r\n if (response == true) {\r\n window.location.reload();\r\n } else {\r\n // TODO: Error Notification.\r\n }\r\n });\r\n return true;\r\n });\r\n }\r\n\r\n // Leave group.\r\n var leaveGroupModal = document.getElementsByClassName('group-widget-leavegroup');\r\n Array.from(leaveGroupModal).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n leaveGroup(e);\r\n });\r\n });\r\n\r\n /**\r\n * Event observer for leave group menu clicked to trigger the confirmation modal.\r\n * @param {event} e\r\n */\r\n function leaveGroup(e) {\r\n var target = e.target;\r\n var group = target.getAttribute('data-group');\r\n var groupname = target.getAttribute('data-groupname');\r\n\r\n Modal.create({\r\n type: Modal.types.SAVE_CANCEL,\r\n title: Str.get_string('groups', 'core'),\r\n }).then(function(modal) {\r\n Str.get_string('confirm', 'core').then((html) => {\r\n modal.setSaveButtonText(html);\r\n return html;\r\n }).catch(Notification.exception);\r\n modal.show();\r\n\r\n Str.get_string('confirmleavegroup', 'block_dash', groupname).then((html) => {\r\n modal.setBody(html);\r\n return html;\r\n }).catch(Notification.exception);\r\n\r\n modal.getRoot().on(ModalEvents.save, (e) => {\r\n e.preventDefault();\r\n var promises = AJAX.call([{\r\n methodname: 'block_dash_groups_leave_group',\r\n args: {groupid: group}\r\n }]);\r\n\r\n promises[0].done((response) => {\r\n if (response == true) {\r\n window.location.reload();\r\n } else {\r\n // TODO: Error Notification.\r\n }\r\n });\r\n });\r\n\r\n modal.getRoot().on(ModalEvents.hidden, function() {\r\n modal.destroy();\r\n });\r\n\r\n modal.getRoot().on(ModalEvents.destroyed, function() {\r\n modal.remove();\r\n modal.attachmentPoint.remove();\r\n });\r\n return modal;\r\n }).catch(Notification.exception);\r\n }\r\n\r\n // Create group.\r\n var createGroupModal = document.getElementsByClassName('create-group');\r\n Array.from(createGroupModal).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n createGroup();\r\n });\r\n });\r\n\r\n /**\r\n * Event listner for create group modal trigger.\r\n */\r\n function createGroup() {\r\n\r\n Modal.create({\r\n type: Modal.types.SAVE_CANCEL,\r\n title: Str.get_string('groups', 'core'),\r\n }).then(function(modal) {\r\n modal.show();\r\n\r\n var args = \"\";\r\n var params = {widget: 'groups', method: 'creategroup', args: args};\r\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\r\n modal.setBody(html);\r\n Templates.runTemplateJS(js);\r\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\r\n createGroupEvent(form);\r\n });\r\n return html;\r\n }).catch(Notification.exception);\r\n\r\n // Apply and save method.\r\n modal.getRoot().on(ModalEvents.save, (e) => {\r\n e.preventDefault();\r\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\r\n form.querySelector('#id_submitbutton').click();\r\n });\r\n });\r\n\r\n modal.getRoot().on(ModalEvents.hidden, function() {\r\n modal.destroy();\r\n });\r\n return modal;\r\n }).catch(Notification.exception);\r\n\r\n\r\n }\r\n /**\r\n * Event listner for create group forms in modal to init the group creation.\r\n * @param {Array} form\r\n */\r\n function createGroupEvent(form) {\r\n form.addEventListener('submit', function(e) {\r\n e.preventDefault();\r\n var formdata = new FormData(e.target);\r\n if (e.target.querySelector('[name=\"name\"]').value == \"\"\r\n || e.target.querySelector('[name=\"courseid\"]').value == '') {\r\n return false;\r\n }\r\n var formdatastr = new URLSearchParams(formdata).toString();\r\n var promises = AJAX.call([{\r\n methodname: 'block_dash_groups_create_group',\r\n args: {formdata: formdatastr}\r\n }]);\r\n\r\n promises[0].done((response) => {\r\n return (response == true) ? window.location.reload() : '';\r\n });\r\n return true;\r\n });\r\n }\r\n }\r\n };\r\n});\r\n"],"names":["define","$","Str","Modal","ModalEvents","Fragment","Templates","AJAX","Notification","init","contextID","groupModal","document","getElementsByClassName","Array","from","forEach","element","addEventListener","e","preventDefault","group","target","getAttribute","create","title","get_string","then","modal","show","params","widget","method","args","JSON","stringify","loadFragment","html","js","setBody","runTemplateJS","catch","exception","getRoot","on","hidden","destroy","groupUsers","type","types","SAVE_CANCEL","setLarge","get","querySelectorAll","form","formdata","FormData","querySelector","value","formdatastr","URLSearchParams","toString","call","methodname","done","response","window","location","reload","groupAddEventListeners","save","click","addGroupUsers","leaveGroupModal","groupname","setSaveButtonText","groupid","destroyed","remove","attachmentPoint","leaveGroup","createGroupModal","createGroupEvent"],"mappings":"AACAA,2BAAO,CAAC,SAAU,WAAY,qBAAsB,oBAChD,gBAAiB,iBAAkB,YAAa,sBACpD,SAASC,EAAGC,IAAKC,MAAOC,YAAaC,SAAUC,UAAWC,KAAMC,oBAErD,CACHC,KAAM,SAASC,eAEPC,WAAaC,SAASC,uBAAuB,4BACjDC,MAAMC,KAAKJ,YAAYK,SAAQ,SAASC,SACpCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,qBAEEC,MADSF,EAAEG,OACIC,aAAa,cAChCpB,MAAMqB,OAAO,CACTC,MAAOvB,IAAIwB,WAAW,SAAU,UACjCC,MAAK,SAASC,OACbA,MAAMC,WAEFC,OAAS,CAACC,OAAQ,SAAUC,OAAQ,cAAeC,KAD5CC,KAAKC,UAAU,CAACd,MAAOA,gBAElChB,SAAS+B,aAAa,aAAc,aAAc1B,UAAWoB,QAAQH,MAAK,CAACU,KAAMC,MAC7EV,MAAMW,QAAQF,MACd/B,UAAUkC,cAAcF,IACjBD,QACRI,MAAMjC,aAAakC,WACtBd,MAAMe,UAAUC,GAAGxC,YAAYyC,QAAQ,WACnCjB,MAAMkB,aAEHlB,SACRa,MAAMjC,aAAakC,qBAI1BK,WAAanC,SAASC,uBAAuB,mBACjDC,MAAMC,KAAKgC,YAAY/B,SAAQ,SAASC,SACpCA,QAAQC,iBAAiB,SAAS,SAASC,GACv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cF,IACxBV,MAAMe,UAAUS,IAAI,GAAGC,iBAAiB,QAAQrC,SAAQsC,iBA0B1CA,MACtBA,KAAKpC,iBAAiB,UAAU,SAASC,GACrCA,EAAEC,qBACEmC,SAAW,IAAIC,SAASrC,EAAEG,WACuB,IAAjDH,EAAEG,OAAOmC,cAAc,iBAAiBC,OACgB,IAArDvC,EAAEG,OAAOmC,cAAc,qBAAqBC,aACxC,MAEPC,YAAc,IAAIC,gBAAgBL,UAAUM,kBACjCtD,KAAKuD,KAAK,CAAC,CACtBC,WAAY,iCACZ9B,KAAM,CAACsB,SAAUI,gBAGZ,GAAGK,MAAMC,UACM,GAAZA,SAAoBC,OAAOC,SAASC,SAAW,MAEpD,KA1CCc,CAAiB5B,SAEdjB,QACRI,MAAMjC,aAAakC,WAGtBd,MAAMe,UAAUC,GAAGxC,YAAYkE,MAAOnD,IAClCA,EAAEC,iBACFQ,MAAMe,UAAUS,IAAI,GAAGC,iBAAiB,QAAQrC,SAAQsC,OACpDA,KAAKG,cAAc,oBAAoBc,cAI/C3C,MAAMe,UAAUC,GAAGxC,YAAYyC,QAAQ,WACnCjB,MAAMkB,aAEHlB,SACRa,MAAMjC,aAAakC"}
\ No newline at end of file
diff --git a/amd/build/preferences_modal.min.js.map b/amd/build/preferences_modal.min.js.map
index 9edc5f0..f679307 100644
--- a/amd/build/preferences_modal.min.js.map
+++ b/amd/build/preferences_modal.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"preferences_modal.min.js","sources":["../src/preferences_modal.js"],"sourcesContent":["/**\n * Add a create new group modal to the page.\n *\n * @module core_group/newgroup\n * @class PreferencesModal\n * @copyright 2017 Damyon Wiese \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events',\n 'core/fragment', 'core/ajax', 'block_dash/select2', 'core/notification'],\n function($, Str, ModalFactory, ModalEvents, Fragment, Ajax, Select2, Notification) {\n\n /**\n * Constructor\n *\n * @param {String} selector used to find triggers for the new group modal.\n * @param {int} contextid\n * @param {Function} onCloseCallback\n *\n * Each call to init gets it's own instance of this class.\n */\n var PreferencesModal = function(selector, contextid, onCloseCallback) {\n this.contextid = contextid;\n this.onCloseCallback = onCloseCallback;\n this.tab = \"\";\n this.init(selector);\n };\n\n /**\n * @var {Modal} modal\n * @private\n */\n PreferencesModal.prototype.modal = null;\n\n /**\n * @var {int} contextid\n * @private\n */\n PreferencesModal.prototype.contextid = -1;\n\n /**\n * Initialise the class.\n *\n * @param {String} selector used to find triggers for the new group modal.\n * @private\n * @return {Promise}\n */\n PreferencesModal.prototype.init = function(selector) {\n var triggers = $(selector);\n // Fetch the title string.\n return Str.get_string('editpreferences', 'block_dash').then(function(title) {\n // Create the modal.\n return ModalFactory.create({\n type: ModalFactory.types.DEFAULT,\n title: title,\n body: this.getBody()\n }, triggers);\n }.bind(this)).then(function(modal) {\n // Keep a reference to the modal.\n this.modal = modal;\n\n // Forms are big, we want a big modal.\n this.modal.setLarge();\n\n // We want to reset the form every time it is opened.\n this.modal.getRoot().on(ModalEvents.shown, function() {\n this.modal.setBody(this.getBody());\n }.bind(this));\n\n this.modal.getRoot().on('change', '#id_config_preferences_layout', this.submitFormAjax.bind(this, false));\n\n this.modal.getRoot().on('click', '[data-action=cancel]', () => {\n this.modal.hide();\n });\n\n // We catch the modal save event, and use it to submit the form inside the modal.\n // Triggering a form submission will give JS validation scripts a chance to check for errors.\n this.modal.getRoot().on(ModalEvents.save, this.submitForm.bind(this));\n // We also catch the form submit event and use it to submit the form with ajax.\n this.modal.getRoot().on('submit', 'form', this.submitFormAjax.bind(this, true));\n\n this.modal.getRoot().on(ModalEvents.bodyRendered, function() {\n $(\"#fgroup_id_available_fields .form-inline > fieldset > div\").sortable({\n items: \".form-check-inline.fitem\",\n handle: \".drag-handle\",\n axis: \"y\"\n });\n\n this.initSelect2();\n }.bind(this));\n\n this.modal.getRoot().on(ModalEvents.hidden, function(e) {\n // Prevent \"changes may be lost\" popup.\n window.onbeforeunload = null;\n if (this.onCloseCallback) {\n this.onCloseCallback(e);\n }\n }.bind(this));\n\n this.modal.getRoot().on('click', '[data-action=change-tab]', (e) => {\n this.changeTab($(e.target).data('tab'));\n });\n\n return this.modal;\n }.bind(this));\n };\n\n PreferencesModal.prototype.changeTab = function(tab) {\n this.tab = tab;\n this.submitFormAjax(false);\n };\n\n /**\n * Get modal body content.\n * @method getBody\n * @param {Object} formdata\n * @private\n * @return {Promise}\n */\n PreferencesModal.prototype.getBody = function(formdata) {\n if (typeof formdata === \"undefined\") {\n formdata = {};\n }\n\n // Get the content of the modal.\n var params = {\n jsonformdata: JSON.stringify(formdata),\n tab: this.tab\n };\n return Fragment.loadFragment('block_dash', 'block_preferences_form', this.contextid, params);\n };\n\n /**\n * Form submission handler.\n * @method handleFormSubmissionResponse\n * @param {Object} formData\n * @param {Boolean} closeWhenDone\n * @param {Object} response\n * @private\n */\n PreferencesModal.prototype.handleFormSubmissionResponse = function(formData, closeWhenDone, response) {\n if (response.validationerrors || !closeWhenDone) {\n this.modal.setBody(this.getBody(formData));\n } else if (closeWhenDone) {\n this.modal.hide();\n }\n };\n\n /**\n * @method handleFormSubmissionFailure\n * @param {Object} data\n * @private\n */\n PreferencesModal.prototype.handleFormSubmissionFailure = function(data) {\n // Oh noes! Epic fail :(\n // Ah wait - this is normal. We need to re-display the form with errors!\n this.modal.setBody(this.getBody(data));\n };\n\n /**\n * Private method\n *\n * @method submitFormAjax\n * @private\n * @param {boolean} closeWhenDone If true modal will close after successful submission.\n * @param {Event} e Form submission event.\n */\n PreferencesModal.prototype.submitFormAjax = function(closeWhenDone, e) {\n // We don't want to do a real form submission.\n if (e) {\n e.preventDefault();\n }\n\n // Now the change events have run, see if there are any \"invalid\" form fields.\n var invalid = $.merge(\n this.modal.getRoot().find('[aria-invalid=\"true\"]'),\n this.modal.getRoot().find('.error')\n );\n\n // If we found invalid fields, focus on the first one and do not submit via ajax.\n if (invalid.length) {\n invalid.first().focus();\n return;\n }\n\n // Convert all the form elements values to a serialised string.\n var formData = this.modal.getRoot().find('form').serialize();\n\n // Now we can continue...\n Ajax.call([{\n methodname: 'block_dash_submit_preferences_form',\n args: {\n contextid: this.contextid,\n jsonformdata: JSON.stringify(formData)\n },\n done: this.handleFormSubmissionResponse.bind(this, formData, closeWhenDone),\n fail: this.handleFormSubmissionFailure.bind(this, formData)\n }])[0].fail(Notification.exception);\n };\n\n PreferencesModal.prototype.getModal = function() {\n return this.modal;\n };\n\n /**\n * This triggers a form submission, so that any mform elements can do final tricks before the form submission is processed.\n *\n * @method submitForm\n * @param {Event} e Form submission event.\n * @private\n */\n PreferencesModal.prototype.submitForm = function(e) {\n e.preventDefault();\n this.modal.getRoot().find('form').submit();\n };\n\n PreferencesModal.prototype.initSelect2 = function() {\n this.modal.getRoot().find('.select2-form select').each(function(index, element) {\n let placeholder = null;\n if ($(element).find(\"option[value='-1']\")) {\n placeholder = {\n id: '-1', // The value of the option\n text: $(element).find(\"option[value='-1']\").text()\n };\n }\n $(element).select2({\n dropdownParent: $(this).parent(),\n allowClear: true,\n theme: 'bootstrap4',\n placeholder: placeholder\n }).on('select2:unselecting', function() {\n $(this).data('unselecting', true);\n }).on('select2:opening', function(e) {\n if ($(this).data('unselecting')) {\n $(this).removeData('unselecting');\n e.preventDefault();\n }\n });\n });\n };\n\n return PreferencesModal;\n});\n"],"names":["define","$","Str","ModalFactory","ModalEvents","Fragment","Ajax","Select2","Notification","PreferencesModal","selector","contextid","onCloseCallback","tab","init","prototype","modal","triggers","get_string","then","title","create","type","types","DEFAULT","body","this","getBody","bind","setLarge","getRoot","on","shown","setBody","submitFormAjax","hide","save","submitForm","bodyRendered","sortable","items","handle","axis","initSelect2","hidden","e","window","onbeforeunload","changeTab","target","data","formdata","params","jsonformdata","JSON","stringify","loadFragment","handleFormSubmissionResponse","formData","closeWhenDone","response","validationerrors","handleFormSubmissionFailure","preventDefault","invalid","merge","find","length","first","focus","serialize","call","methodname","args","done","fail","exception","getModal","submit","each","index","element","placeholder","id","text","select2","dropdownParent","parent","allowClear","theme","removeData"],"mappings":";;;;;;;;AAQAA,sCAAO,CAAC,SAAU,WAAY,qBAAsB,oBAC5C,gBAAiB,YAAa,qBAAsB,sBACxD,SAASC,EAAGC,IAAKC,aAAcC,YAAaC,SAAUC,KAAMC,QAASC,kBAWjEC,iBAAmB,SAASC,SAAUC,UAAWC,sBAC5CD,UAAYA,eACZC,gBAAkBA,qBAClBC,IAAM,QACNC,KAAKJ,kBAOdD,iBAAiBM,UAAUC,MAAQ,KAMnCP,iBAAiBM,UAAUJ,WAAa,EASxCF,iBAAiBM,UAAUD,KAAO,SAASJ,cACnCO,SAAWhB,EAAES,iBAEVR,IAAIgB,WAAW,kBAAmB,cAAcC,KAAK,SAASC,cAE1DjB,aAAakB,OAAO,CACvBC,KAAMnB,aAAaoB,MAAMC,QACzBJ,MAAOA,MACPK,KAAMC,KAAKC,WACZV,WACLW,KAAKF,OAAOP,KAAK,SAASH,mBAEnBA,MAAQA,WAGRA,MAAMa,gBAGNb,MAAMc,UAAUC,GAAG3B,YAAY4B,MAAO,gBAClChB,MAAMiB,QAAQP,KAAKC,YAC1BC,KAAKF,YAEFV,MAAMc,UAAUC,GAAG,SAAU,gCAAiCL,KAAKQ,eAAeN,KAAKF,MAAM,SAE7FV,MAAMc,UAAUC,GAAG,QAAS,wBAAwB,UAChDf,MAAMmB,eAKVnB,MAAMc,UAAUC,GAAG3B,YAAYgC,KAAMV,KAAKW,WAAWT,KAAKF,YAE1DV,MAAMc,UAAUC,GAAG,SAAU,OAAQL,KAAKQ,eAAeN,KAAKF,MAAM,SAEpEV,MAAMc,UAAUC,GAAG3B,YAAYkC,aAAc,WAC9CrC,EAAE,6DAA6DsC,SAAS,CACpEC,MAAO,2BACPC,OAAQ,eACRC,KAAM,WAGLC,eACPf,KAAKF,YAEFV,MAAMc,UAAUC,GAAG3B,YAAYwC,OAAQ,SAASC,GAEjDC,OAAOC,eAAiB,KACpBrB,KAAKd,sBACAA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,GAC7CA,EAAEkB,sBACG/C,MAAMc,UAAUoC,KAAK,QAAQY,UAGtCrE,iBAAiBM,UAAU4B,YAAc,gBAChC3B,MAAMc,UAAUoC,KAAK,wBAAwBa,MAAK,SAASC,MAAOC,aAC/DC,YAAc,KACdjF,EAAEgF,SAASf,KAAK,wBAChBgB,YAAc,CACVC,GAAI,KACJC,KAAMnF,EAAEgF,SAASf,KAAK,sBAAsBkB,SAGpDnF,EAAEgF,SAASI,QAAQ,CACfC,eAAgBrF,EAAEyB,MAAM6D,SACxBC,YAAY,EACZC,MAAO,aACPP,YAAaA,cACdnD,GAAG,uBAAuB,WACzB9B,EAAEyB,MAAMwB,KAAK,eAAe,MAC7BnB,GAAG,mBAAmB,SAASc,GAC1B5C,EAAEyB,MAAMwB,KAAK,iBACbjD,EAAEyB,MAAMgE,WAAW,eACnB7C,EAAEkB,yBAMXtD"}
\ No newline at end of file
+{"version":3,"file":"preferences_modal.min.js","sources":["../src/preferences_modal.js"],"sourcesContent":["/**\r\n * Add a create new group modal to the page.\r\n *\r\n * @module core_group/newgroup\r\n * @class PreferencesModal\r\n * @copyright 2017 Damyon Wiese \r\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\r\n */\r\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events',\r\n 'core/fragment', 'core/ajax', 'block_dash/select2', 'core/notification'],\r\n function($, Str, ModalFactory, ModalEvents, Fragment, Ajax, Select2, Notification) {\r\n\r\n /**\r\n * Constructor\r\n *\r\n * @param {String} selector used to find triggers for the new group modal.\r\n * @param {int} contextid\r\n * @param {Function} onCloseCallback\r\n *\r\n * Each call to init gets it's own instance of this class.\r\n */\r\n var PreferencesModal = function(selector, contextid, onCloseCallback) {\r\n this.contextid = contextid;\r\n this.onCloseCallback = onCloseCallback;\r\n this.tab = \"\";\r\n this.init(selector);\r\n };\r\n\r\n /**\r\n * @var {Modal} modal\r\n * @private\r\n */\r\n PreferencesModal.prototype.modal = null;\r\n\r\n /**\r\n * @var {int} contextid\r\n * @private\r\n */\r\n PreferencesModal.prototype.contextid = -1;\r\n\r\n /**\r\n * Initialise the class.\r\n *\r\n * @param {String} selector used to find triggers for the new group modal.\r\n * @private\r\n * @return {Promise}\r\n */\r\n PreferencesModal.prototype.init = function(selector) {\r\n var triggers = $(selector);\r\n // Fetch the title string.\r\n return Str.get_string('editpreferences', 'block_dash').then(function(title) {\r\n // Create the modal.\r\n return ModalFactory.create({\r\n type: ModalFactory.types.DEFAULT,\r\n title: title,\r\n body: this.getBody()\r\n }, triggers);\r\n }.bind(this)).then(function(modal) {\r\n // Keep a reference to the modal.\r\n this.modal = modal;\r\n\r\n // Forms are big, we want a big modal.\r\n this.modal.setLarge();\r\n\r\n // We want to reset the form every time it is opened.\r\n this.modal.getRoot().on(ModalEvents.shown, function() {\r\n this.modal.setBody(this.getBody());\r\n }.bind(this));\r\n\r\n this.modal.getRoot().on('change', '#id_config_preferences_layout', this.submitFormAjax.bind(this, false));\r\n\r\n this.modal.getRoot().on('click', '[data-action=cancel]', () => {\r\n this.modal.hide();\r\n });\r\n\r\n // We catch the modal save event, and use it to submit the form inside the modal.\r\n // Triggering a form submission will give JS validation scripts a chance to check for errors.\r\n this.modal.getRoot().on(ModalEvents.save, this.submitForm.bind(this));\r\n // We also catch the form submit event and use it to submit the form with ajax.\r\n this.modal.getRoot().on('submit', 'form', this.submitFormAjax.bind(this, true));\r\n\r\n this.modal.getRoot().on(ModalEvents.bodyRendered, function() {\r\n $(\"#fgroup_id_available_fields .form-inline > fieldset > div\").sortable({\r\n items: \".form-check-inline.fitem\",\r\n handle: \".drag-handle\",\r\n axis: \"y\"\r\n });\r\n\r\n this.initSelect2();\r\n }.bind(this));\r\n\r\n this.modal.getRoot().on(ModalEvents.hidden, function(e) {\r\n // Prevent \"changes may be lost\" popup.\r\n window.onbeforeunload = null;\r\n if (this.onCloseCallback) {\r\n this.onCloseCallback(e);\r\n }\r\n }.bind(this));\r\n\r\n this.modal.getRoot().on('click', '[data-action=change-tab]', (e) => {\r\n this.changeTab($(e.target).data('tab'));\r\n });\r\n\r\n return this.modal;\r\n }.bind(this));\r\n };\r\n\r\n PreferencesModal.prototype.changeTab = function(tab) {\r\n this.tab = tab;\r\n this.submitFormAjax(false);\r\n };\r\n\r\n /**\r\n * Get modal body content.\r\n * @method getBody\r\n * @param {Object} formdata\r\n * @private\r\n * @return {Promise}\r\n */\r\n PreferencesModal.prototype.getBody = function(formdata) {\r\n if (typeof formdata === \"undefined\") {\r\n formdata = {};\r\n }\r\n\r\n // Get the content of the modal.\r\n var params = {\r\n jsonformdata: JSON.stringify(formdata),\r\n tab: this.tab\r\n };\r\n return Fragment.loadFragment('block_dash', 'block_preferences_form', this.contextid, params);\r\n };\r\n\r\n /**\r\n * Form submission handler.\r\n * @method handleFormSubmissionResponse\r\n * @param {Object} formData\r\n * @param {Boolean} closeWhenDone\r\n * @param {Object} response\r\n * @private\r\n */\r\n PreferencesModal.prototype.handleFormSubmissionResponse = function(formData, closeWhenDone, response) {\r\n if (response.validationerrors || !closeWhenDone) {\r\n this.modal.setBody(this.getBody(formData));\r\n } else if (closeWhenDone) {\r\n this.modal.hide();\r\n }\r\n };\r\n\r\n /**\r\n * @method handleFormSubmissionFailure\r\n * @param {Object} data\r\n * @private\r\n */\r\n PreferencesModal.prototype.handleFormSubmissionFailure = function(data) {\r\n // Oh noes! Epic fail :(\r\n // Ah wait - this is normal. We need to re-display the form with errors!\r\n this.modal.setBody(this.getBody(data));\r\n };\r\n\r\n /**\r\n * Private method\r\n *\r\n * @method submitFormAjax\r\n * @private\r\n * @param {boolean} closeWhenDone If true modal will close after successful submission.\r\n * @param {Event} e Form submission event.\r\n */\r\n PreferencesModal.prototype.submitFormAjax = function(closeWhenDone, e) {\r\n // We don't want to do a real form submission.\r\n if (e) {\r\n e.preventDefault();\r\n }\r\n\r\n // Now the change events have run, see if there are any \"invalid\" form fields.\r\n var invalid = $.merge(\r\n this.modal.getRoot().find('[aria-invalid=\"true\"]'),\r\n this.modal.getRoot().find('.error')\r\n );\r\n\r\n // If we found invalid fields, focus on the first one and do not submit via ajax.\r\n if (invalid.length) {\r\n invalid.first().focus();\r\n return;\r\n }\r\n\r\n // Convert all the form elements values to a serialised string.\r\n var formData = this.modal.getRoot().find('form').serialize();\r\n\r\n // Now we can continue...\r\n Ajax.call([{\r\n methodname: 'block_dash_submit_preferences_form',\r\n args: {\r\n contextid: this.contextid,\r\n jsonformdata: JSON.stringify(formData)\r\n },\r\n done: this.handleFormSubmissionResponse.bind(this, formData, closeWhenDone),\r\n fail: this.handleFormSubmissionFailure.bind(this, formData)\r\n }])[0].fail(Notification.exception);\r\n };\r\n\r\n PreferencesModal.prototype.getModal = function() {\r\n return this.modal;\r\n };\r\n\r\n /**\r\n * This triggers a form submission, so that any mform elements can do final tricks before the form submission is processed.\r\n *\r\n * @method submitForm\r\n * @param {Event} e Form submission event.\r\n * @private\r\n */\r\n PreferencesModal.prototype.submitForm = function(e) {\r\n e.preventDefault();\r\n this.modal.getRoot().find('form').submit();\r\n };\r\n\r\n PreferencesModal.prototype.initSelect2 = function() {\r\n this.modal.getRoot().find('.select2-form select').each(function(index, element) {\r\n let placeholder = null;\r\n if ($(element).find(\"option[value='-1']\")) {\r\n placeholder = {\r\n id: '-1', // The value of the option\r\n text: $(element).find(\"option[value='-1']\").text()\r\n };\r\n }\r\n $(element).select2({\r\n dropdownParent: $(this).parent(),\r\n allowClear: true,\r\n theme: 'bootstrap4',\r\n placeholder: placeholder\r\n }).on('select2:unselecting', function() {\r\n $(this).data('unselecting', true);\r\n }).on('select2:opening', function(e) {\r\n if ($(this).data('unselecting')) {\r\n $(this).removeData('unselecting');\r\n e.preventDefault();\r\n }\r\n });\r\n });\r\n };\r\n\r\n return PreferencesModal;\r\n});\r\n"],"names":["define","$","Str","ModalFactory","ModalEvents","Fragment","Ajax","Select2","Notification","PreferencesModal","selector","contextid","onCloseCallback","tab","init","prototype","modal","triggers","get_string","then","title","create","type","types","DEFAULT","body","this","getBody","bind","setLarge","getRoot","on","shown","setBody","submitFormAjax","hide","save","submitForm","bodyRendered","sortable","items","handle","axis","initSelect2","hidden","e","window","onbeforeunload","changeTab","target","data","formdata","params","jsonformdata","JSON","stringify","loadFragment","handleFormSubmissionResponse","formData","closeWhenDone","response","validationerrors","handleFormSubmissionFailure","preventDefault","invalid","merge","find","length","first","focus","serialize","call","methodname","args","done","fail","exception","getModal","submit","each","index","element","placeholder","id","text","select2","dropdownParent","parent","allowClear","theme","removeData"],"mappings":";;;;;;;;AAQAA,sCAAO,CAAC,SAAU,WAAY,qBAAsB,oBAC5C,gBAAiB,YAAa,qBAAsB,sBACxD,SAASC,EAAGC,IAAKC,aAAcC,YAAaC,SAAUC,KAAMC,QAASC,kBAWjEC,iBAAmB,SAASC,SAAUC,UAAWC,sBAC5CD,UAAYA,eACZC,gBAAkBA,qBAClBC,IAAM,QACNC,KAAKJ,kBAOdD,iBAAiBM,UAAUC,MAAQ,KAMnCP,iBAAiBM,UAAUJ,WAAa,EASxCF,iBAAiBM,UAAUD,KAAO,SAASJ,cACnCO,SAAWhB,EAAES,iBAEVR,IAAIgB,WAAW,kBAAmB,cAAcC,KAAK,SAASC,cAE1DjB,aAAakB,OAAO,CACvBC,KAAMnB,aAAaoB,MAAMC,QACzBJ,MAAOA,MACPK,KAAMC,KAAKC,WACZV,WACLW,KAAKF,OAAOP,KAAK,SAASH,mBAEnBA,MAAQA,WAGRA,MAAMa,gBAGNb,MAAMc,UAAUC,GAAG3B,YAAY4B,MAAO,gBAClChB,MAAMiB,QAAQP,KAAKC,YAC1BC,KAAKF,YAEFV,MAAMc,UAAUC,GAAG,SAAU,gCAAiCL,KAAKQ,eAAeN,KAAKF,MAAM,SAE7FV,MAAMc,UAAUC,GAAG,QAAS,wBAAwB,UAChDf,MAAMmB,eAKVnB,MAAMc,UAAUC,GAAG3B,YAAYgC,KAAMV,KAAKW,WAAWT,KAAKF,YAE1DV,MAAMc,UAAUC,GAAG,SAAU,OAAQL,KAAKQ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,aAAcC,KAAKC,UAAUG,WAEjCgB,KAAMhD,KAAK+B,6BAA6B7B,KAAKF,KAAMgC,SAAUC,eAC7DgB,KAAMjD,KAAKoC,4BAA4BlC,KAAKF,KAAMgC,aAClD,GAAGiB,KAAKnE,aAAaoE,aAG7BnE,iBAAiBM,UAAU8D,SAAW,kBAC3BnD,KAAKV,OAUhBP,iBAAiBM,UAAUsB,WAAa,SAASQ,GAC7CA,EAAEkB,sBACG/C,MAAMc,UAAUoC,KAAK,QAAQY,UAGtCrE,iBAAiBM,UAAU4B,YAAc,gBAChC3B,MAAMc,UAAUoC,KAAK,wBAAwBa,MAAK,SAASC,MAAOC,aAC/DC,YAAc,KACdjF,EAAEgF,SAASf,KAAK,wBAChBgB,YAAc,CACVC,GAAI,KACJC,KAAMnF,EAAEgF,SAASf,KAAK,sBAAsBkB,SAGpDnF,EAAEgF,SAASI,QAAQ,CACfC,eAAgBrF,EAAEyB,MAAM6D,SACxBC,YAAY,EACZC,MAAO,aACPP,YAAaA,cACdnD,GAAG,uBAAuB,WACzB9B,EAAEyB,MAAMwB,KAAK,eAAe,MAC7BnB,GAAG,mBAAmB,SAASc,GAC1B5C,EAAEyB,MAAMwB,KAAK,iBACbjD,EAAEyB,MAAMgE,WAAW,eACnB7C,EAAEkB,yBAMXtD"}
\ No newline at end of file
diff --git a/amd/build/select2.min.js.map b/amd/build/select2.min.js.map
index 69b0af9..8933430 100644
--- a/amd/build/select2.min.js.map
+++ b/amd/build/select2.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"select2.min.js","sources":["../src/select2.js"],"sourcesContent":["/*!\n * Select2 4.0.13\n * https://select2.github.io\n *\n * Released under the MIT license\n * https://github.com/select2/select2/blob/master/LICENSE.md\n */\n;(function (factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(['jquery'], factory);\n } else if (typeof module === 'object' && module.exports) {\n // Node/CommonJS\n module.exports = function (root, jQuery) {\n if (jQuery === undefined) {\n // require('jQuery') returns a factory that requires window to\n // build a jQuery instance, we normalize how we use modules\n // that require this pattern but the window provided is a noop\n // if it's defined (how jquery works)\n if (typeof window !== 'undefined') {\n jQuery = require('jquery');\n }\n else {\n jQuery = require('jquery')(root);\n }\n }\n factory(jQuery);\n return jQuery;\n };\n } else {\n // Browser globals\n factory(jQuery);\n }\n} (function (jQuery) {\n // This is needed so we can catch the AMD loader configuration and use it\n // The inner file should be wrapped (by `banner.start.js`) in a function that\n // returns the AMD loader references.\n var S2 =(function () {\n // Restore the Select2 AMD loader so it can be used\n // Needed mostly in the language files, where the loader is not inserted\n if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {\n var S2 = jQuery.fn.select2.amd;\n }\n var S2;(function () { if (!S2 || !S2.requirejs) {\n if (!S2) { S2 = {}; } else { require = S2; }\n /**\n * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.\n * Released under MIT license, http://github.com/requirejs/almond/LICENSE\n */\n//Going sloppy to avoid 'use strict' string cost, but strict practices should\n//be followed.\n /*global setTimeout: false */\n\n var requirejs, require, define;\n (function (undef) {\n var main, req, makeMap, handlers,\n defined = {},\n waiting = {},\n config = {},\n defining = {},\n hasOwn = Object.prototype.hasOwnProperty,\n aps = [].slice,\n jsSuffixRegExp = /\\.js$/;\n\n function hasProp(obj, prop) {\n return hasOwn.call(obj, prop);\n }\n\n /**\n * Given a relative module name, like ./something, normalize it to\n * a real name that can be mapped to a path.\n * @param {String} name the relative name\n * @param {String} baseName a real name that the name arg is relative\n * to.\n * @returns {String} normalized name\n */\n function normalize(name, baseName) {\n var nameParts, nameSegment, mapValue, foundMap, lastIndex,\n foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,\n baseParts = baseName && baseName.split(\"/\"),\n map = config.map,\n starMap = (map && map['*']) || {};\n\n //Adjust any relative paths.\n if (name) {\n name = name.split('/');\n lastIndex = name.length - 1;\n\n // If wanting node ID compatibility, strip .js from end\n // of IDs. Have to do this here, and not in nameToUrl\n // because node allows either .js or non .js to map\n // to same file.\n if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {\n name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');\n }\n\n // Starts with a '.' so need the baseName\n if (name[0].charAt(0) === '.' && baseParts) {\n //Convert baseName to array, and lop off the last part,\n //so that . matches that 'directory' and not name of the baseName's\n //module. For instance, baseName of 'one/two/three', maps to\n //'one/two/three.js', but we want the directory, 'one/two' for\n //this normalization.\n normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);\n name = normalizedBaseParts.concat(name);\n }\n\n //start trimDots\n for (i = 0; i < name.length; i++) {\n part = name[i];\n if (part === '.') {\n name.splice(i, 1);\n i -= 1;\n } else if (part === '..') {\n // If at the start, or previous value is still ..,\n // keep them so that when converted to a path it may\n // still work when converted to a path, even though\n // as an ID it is less than ideal. In larger point\n // releases, may be better to just kick out an error.\n if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {\n continue;\n } else if (i > 0) {\n name.splice(i - 1, 2);\n i -= 2;\n }\n }\n }\n //end trimDots\n\n name = name.join('/');\n }\n\n //Apply map config if available.\n if ((baseParts || starMap) && map) {\n nameParts = name.split('/');\n\n for (i = nameParts.length; i > 0; i -= 1) {\n nameSegment = nameParts.slice(0, i).join(\"/\");\n\n if (baseParts) {\n //Find the longest baseName segment match in the config.\n //So, do joins on the biggest to smallest lengths of baseParts.\n for (j = baseParts.length; j > 0; j -= 1) {\n mapValue = map[baseParts.slice(0, j).join('/')];\n\n //baseName segment has config, find if it has one for\n //this name.\n if (mapValue) {\n mapValue = mapValue[nameSegment];\n if (mapValue) {\n //Match, update name to the new value.\n foundMap = mapValue;\n foundI = i;\n break;\n }\n }\n }\n }\n\n if (foundMap) {\n break;\n }\n\n //Check for a star map match, but just hold on to it,\n //if there is a shorter segment match later in a matching\n //config, then favor over this star map.\n if (!foundStarMap && starMap && starMap[nameSegment]) {\n foundStarMap = starMap[nameSegment];\n starI = i;\n }\n }\n\n if (!foundMap && foundStarMap) {\n foundMap = foundStarMap;\n foundI = starI;\n }\n\n if (foundMap) {\n nameParts.splice(0, foundI, foundMap);\n name = nameParts.join('/');\n }\n }\n\n return name;\n }\n\n function makeRequire(relName, forceSync) {\n return function () {\n //A version of a require function that passes a moduleName\n //value for items that may need to\n //look up paths relative to the moduleName\n var args = aps.call(arguments, 0);\n\n //If first arg is not require('string'), and there is only\n //one arg, it is the array form without a callback. Insert\n //a null so that the following concat is correct.\n if (typeof args[0] !== 'string' && args.length === 1) {\n args.push(null);\n }\n return req.apply(undef, args.concat([relName, forceSync]));\n };\n }\n\n function makeNormalize(relName) {\n return function (name) {\n return normalize(name, relName);\n };\n }\n\n function makeLoad(depName) {\n return function (value) {\n defined[depName] = value;\n };\n }\n\n function callDep(name) {\n if (hasProp(waiting, name)) {\n var args = waiting[name];\n delete waiting[name];\n defining[name] = true;\n main.apply(undef, args);\n }\n\n if (!hasProp(defined, name) && !hasProp(defining, name)) {\n throw new Error('No ' + name);\n }\n return defined[name];\n }\n\n //Turns a plugin!resource to [plugin, resource]\n //with the plugin being undefined if the name\n //did not have a plugin prefix.\n function splitPrefix(name) {\n var prefix,\n index = name ? name.indexOf('!') : -1;\n if (index > -1) {\n prefix = name.substring(0, index);\n name = name.substring(index + 1, name.length);\n }\n return [prefix, name];\n }\n\n //Creates a parts array for a relName where first part is plugin ID,\n //second part is resource ID. Assumes relName has already been normalized.\n function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }\n\n /**\n * Makes a name map, normalizing the name, and using a plugin\n * for normalization if necessary. Grabs a ref to plugin\n * too, as an optimization.\n */\n makeMap = function (name, relParts) {\n var plugin,\n parts = splitPrefix(name),\n prefix = parts[0],\n relResourceName = relParts[1];\n\n name = parts[1];\n\n if (prefix) {\n prefix = normalize(prefix, relResourceName);\n plugin = callDep(prefix);\n }\n\n //Normalize according\n if (prefix) {\n if (plugin && plugin.normalize) {\n name = plugin.normalize(name, makeNormalize(relResourceName));\n } else {\n name = normalize(name, relResourceName);\n }\n } else {\n name = normalize(name, relResourceName);\n parts = splitPrefix(name);\n prefix = parts[0];\n name = parts[1];\n if (prefix) {\n plugin = callDep(prefix);\n }\n }\n\n //Using ridiculous property names for space reasons\n return {\n f: prefix ? prefix + '!' + name : name, //fullName\n n: name,\n pr: prefix,\n p: plugin\n };\n };\n\n function makeConfig(name) {\n return function () {\n return (config && config.config && config.config[name]) || {};\n };\n }\n\n handlers = {\n require: function (name) {\n return makeRequire(name);\n },\n exports: function (name) {\n var e = defined[name];\n if (typeof e !== 'undefined') {\n return e;\n } else {\n return (defined[name] = {});\n }\n },\n module: function (name) {\n return {\n id: name,\n uri: '',\n exports: defined[name],\n config: makeConfig(name)\n };\n }\n };\n\n main = function (name, deps, callback, relName) {\n var cjsModule, depName, ret, map, i, relParts,\n args = [],\n callbackType = typeof callback,\n usingExports;\n\n //Use name if no relName\n relName = relName || name;\n relParts = makeRelParts(relName);\n\n //Call the callback to define the module, if necessary.\n if (callbackType === 'undefined' || callbackType === 'function') {\n //Pull out the defined dependencies and pass the ordered\n //values to the callback.\n //Default to [require, exports, module] if no deps\n deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;\n for (i = 0; i < deps.length; i += 1) {\n map = makeMap(deps[i], relParts);\n depName = map.f;\n\n //Fast path CommonJS standard dependencies.\n if (depName === \"require\") {\n args[i] = handlers.require(name);\n } else if (depName === \"exports\") {\n //CommonJS module spec 1.1\n args[i] = handlers.exports(name);\n usingExports = true;\n } else if (depName === \"module\") {\n //CommonJS module spec 1.1\n cjsModule = args[i] = handlers.module(name);\n } else if (hasProp(defined, depName) ||\n hasProp(waiting, depName) ||\n hasProp(defining, depName)) {\n args[i] = callDep(depName);\n } else if (map.p) {\n map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});\n args[i] = defined[depName];\n } else {\n throw new Error(name + ' missing ' + depName);\n }\n }\n\n ret = callback ? callback.apply(defined[name], args) : undefined;\n\n if (name) {\n //If setting exports via \"module\" is in play,\n //favor that over return value and exports. After that,\n //favor a non-undefined return value over exports use.\n if (cjsModule && cjsModule.exports !== undef &&\n cjsModule.exports !== defined[name]) {\n defined[name] = cjsModule.exports;\n } else if (ret !== undef || !usingExports) {\n //Use the return value from the function.\n defined[name] = ret;\n }\n }\n } else if (name) {\n //May just be an object definition for the module. Only\n //worry about defining if have a module name.\n defined[name] = callback;\n }\n };\n\n requirejs = require = req = function (deps, callback, relName, forceSync, alt) {\n if (typeof deps === \"string\") {\n if (handlers[deps]) {\n //callback in this case is really relName\n return handlers[deps](callback);\n }\n //Just return the module wanted. In this scenario, the\n //deps arg is the module name, and second arg (if passed)\n //is just the relName.\n //Normalize module name, if it contains . or ..\n return callDep(makeMap(deps, makeRelParts(callback)).f);\n } else if (!deps.splice) {\n //deps is a config object, not an array.\n config = deps;\n if (config.deps) {\n req(config.deps, config.callback);\n }\n if (!callback) {\n return;\n }\n\n if (callback.splice) {\n //callback is an array, which means it is a dependency list.\n //Adjust args if there are dependencies\n deps = callback;\n callback = relName;\n relName = null;\n } else {\n deps = undef;\n }\n }\n\n //Support require(['a'])\n callback = callback || function () {};\n\n //If relName is a function, it is an errback handler,\n //so remove it.\n if (typeof relName === 'function') {\n relName = forceSync;\n forceSync = alt;\n }\n\n //Simulate async callback;\n if (forceSync) {\n main(undef, deps, callback, relName);\n } else {\n //Using a non-zero value because of concern for what old browsers\n //do, and latest browsers \"upgrade\" to 4 if lower value is used:\n //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:\n //If want a value immediately, use require('id') instead -- something\n //that works in almond on the global level, but not guaranteed and\n //unlikely to work in other AMD implementations.\n setTimeout(function () {\n main(undef, deps, callback, relName);\n }, 4);\n }\n\n return req;\n };\n\n /**\n * Just drops the config on the floor, but returns req in case\n * the config return value is used.\n */\n req.config = function (cfg) {\n return req(cfg);\n };\n\n /**\n * Expose module registry for debugging and tooling\n */\n requirejs._defined = defined;\n\n define = function (name, deps, callback) {\n if (typeof name !== 'string') {\n throw new Error('See almond README: incorrect module build, no module name');\n }\n\n //This module may not have dependencies\n if (!deps.splice) {\n //deps is not an array, so probably means\n //an object literal or factory function for\n //the value. Adjust args.\n callback = deps;\n deps = [];\n }\n\n if (!hasProp(defined, name) && !hasProp(waiting, name)) {\n waiting[name] = [name, deps, callback];\n }\n };\n\n define.amd = {\n jQuery: true\n };\n }());\n\n S2.requirejs = requirejs;S2.require = require;S2.define = define;\n }\n }());\n S2.define(\"almond\", function(){});\n\n /* global jQuery:false, $:false */\n S2.define('jquery',[],function () {\n var _$ = jQuery || $;\n\n if (_$ == null && console && console.error) {\n console.error(\n 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +\n 'found. Make sure that you are including jQuery before Select2 on your ' +\n 'web page.'\n );\n }\n\n return _$;\n });\n\n S2.define('select2/utils',[\n 'jquery'\n ], function ($) {\n var Utils = {};\n\n Utils.Extend = function (ChildClass, SuperClass) {\n var __hasProp = {}.hasOwnProperty;\n\n function BaseConstructor () {\n this.constructor = ChildClass;\n }\n\n for (var key in SuperClass) {\n if (__hasProp.call(SuperClass, key)) {\n ChildClass[key] = SuperClass[key];\n }\n }\n\n BaseConstructor.prototype = SuperClass.prototype;\n ChildClass.prototype = new BaseConstructor();\n ChildClass.__super__ = SuperClass.prototype;\n\n return ChildClass;\n };\n\n function getMethods (theClass) {\n var proto = theClass.prototype;\n\n var methods = [];\n\n for (var methodName in proto) {\n var m = proto[methodName];\n\n if (typeof m !== 'function') {\n continue;\n }\n\n if (methodName === 'constructor') {\n continue;\n }\n\n methods.push(methodName);\n }\n\n return methods;\n }\n\n Utils.Decorate = function (SuperClass, DecoratorClass) {\n var decoratedMethods = getMethods(DecoratorClass);\n var superMethods = getMethods(SuperClass);\n\n function DecoratedClass () {\n var unshift = Array.prototype.unshift;\n\n var argCount = DecoratorClass.prototype.constructor.length;\n\n var calledConstructor = SuperClass.prototype.constructor;\n\n if (argCount > 0) {\n unshift.call(arguments, SuperClass.prototype.constructor);\n\n calledConstructor = DecoratorClass.prototype.constructor;\n }\n\n calledConstructor.apply(this, arguments);\n }\n\n DecoratorClass.displayName = SuperClass.displayName;\n\n function ctr () {\n this.constructor = DecoratedClass;\n }\n\n DecoratedClass.prototype = new ctr();\n\n for (var m = 0; m < superMethods.length; m++) {\n var superMethod = superMethods[m];\n\n DecoratedClass.prototype[superMethod] =\n SuperClass.prototype[superMethod];\n }\n\n var calledMethod = function (methodName) {\n // Stub out the original method if it's not decorating an actual method\n var originalMethod = function () {};\n\n if (methodName in DecoratedClass.prototype) {\n originalMethod = DecoratedClass.prototype[methodName];\n }\n\n var decoratedMethod = DecoratorClass.prototype[methodName];\n\n return function () {\n var unshift = Array.prototype.unshift;\n\n unshift.call(arguments, originalMethod);\n\n return decoratedMethod.apply(this, arguments);\n };\n };\n\n for (var d = 0; d < decoratedMethods.length; d++) {\n var decoratedMethod = decoratedMethods[d];\n\n DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);\n }\n\n return DecoratedClass;\n };\n\n var Observable = function () {\n this.listeners = {};\n };\n\n Observable.prototype.on = function (event, callback) {\n this.listeners = this.listeners || {};\n\n if (event in this.listeners) {\n this.listeners[event].push(callback);\n } else {\n this.listeners[event] = [callback];\n }\n };\n\n Observable.prototype.trigger = function (event) {\n var slice = Array.prototype.slice;\n var params = slice.call(arguments, 1);\n\n this.listeners = this.listeners || {};\n\n // Params should always come in as an array\n if (params == null) {\n params = [];\n }\n\n // If there are no arguments to the event, use a temporary object\n if (params.length === 0) {\n params.push({});\n }\n\n // Set the `_type` of the first object to the event\n params[0]._type = event;\n\n if (event in this.listeners) {\n this.invoke(this.listeners[event], slice.call(arguments, 1));\n }\n\n if ('*' in this.listeners) {\n this.invoke(this.listeners['*'], arguments);\n }\n };\n\n Observable.prototype.invoke = function (listeners, params) {\n for (var i = 0, len = listeners.length; i < len; i++) {\n listeners[i].apply(this, params);\n }\n };\n\n Utils.Observable = Observable;\n\n Utils.generateChars = function (length) {\n var chars = '';\n\n for (var i = 0; i < length; i++) {\n var randomChar = Math.floor(Math.random() * 36);\n chars += randomChar.toString(36);\n }\n\n return chars;\n };\n\n Utils.bind = function (func, context) {\n return function () {\n func.apply(context, arguments);\n };\n };\n\n Utils._convertData = function (data) {\n for (var originalKey in data) {\n var keys = originalKey.split('-');\n\n var dataLevel = data;\n\n if (keys.length === 1) {\n continue;\n }\n\n for (var k = 0; k < keys.length; k++) {\n var key = keys[k];\n\n // Lowercase the first letter\n // By default, dash-separated becomes camelCase\n key = key.substring(0, 1).toLowerCase() + key.substring(1);\n\n if (!(key in dataLevel)) {\n dataLevel[key] = {};\n }\n\n if (k == keys.length - 1) {\n dataLevel[key] = data[originalKey];\n }\n\n dataLevel = dataLevel[key];\n }\n\n delete data[originalKey];\n }\n\n return data;\n };\n\n Utils.hasScroll = function (index, el) {\n // Adapted from the function created by @ShadowScripter\n // and adapted by @BillBarry on the Stack Exchange Code Review website.\n // The original code can be found at\n // http://codereview.stackexchange.com/q/13338\n // and was designed to be used with the Sizzle selector engine.\n\n var $el = $(el);\n var overflowX = el.style.overflowX;\n var overflowY = el.style.overflowY;\n\n //Check both x and y declarations\n if (overflowX === overflowY &&\n (overflowY === 'hidden' || overflowY === 'visible')) {\n return false;\n }\n\n if (overflowX === 'scroll' || overflowY === 'scroll') {\n return true;\n }\n\n return ($el.innerHeight() < el.scrollHeight ||\n $el.innerWidth() < el.scrollWidth);\n };\n\n Utils.escapeMarkup = function (markup) {\n var replaceMap = {\n '\\\\': '\',\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n '\\'': ''',\n '/': '/'\n };\n\n // Do not try to escape the markup if it's not a string\n if (typeof markup !== 'string') {\n return markup;\n }\n\n return String(markup).replace(/[&<>\"'\\/\\\\]/g, function (match) {\n return replaceMap[match];\n });\n };\n\n // Append an array of jQuery nodes to a given element.\n Utils.appendMany = function ($element, $nodes) {\n // jQuery 1.7.x does not support $.fn.append() with an array\n // Fall back to a jQuery object collection using $.fn.add()\n if ($.fn.jquery.substr(0, 3) === '1.7') {\n var $jqNodes = $();\n\n $.map($nodes, function (node) {\n $jqNodes = $jqNodes.add(node);\n });\n\n $nodes = $jqNodes;\n }\n\n $element.append($nodes);\n };\n\n // Cache objects in Utils.__cache instead of $.data (see #4346)\n Utils.__cache = {};\n\n var id = 0;\n Utils.GetUniqueElementId = function (element) {\n // Get a unique element Id. If element has no id,\n // creates a new unique number, stores it in the id\n // attribute and returns the new id.\n // If an id already exists, it simply returns it.\n\n var select2Id = element.getAttribute('data-select2-id');\n if (select2Id == null) {\n // If element has id, use it.\n if (element.id) {\n select2Id = element.id;\n element.setAttribute('data-select2-id', select2Id);\n } else {\n element.setAttribute('data-select2-id', ++id);\n select2Id = id.toString();\n }\n }\n return select2Id;\n };\n\n Utils.StoreData = function (element, name, value) {\n // Stores an item in the cache for a specified element.\n // name is the cache key.\n var id = Utils.GetUniqueElementId(element);\n if (!Utils.__cache[id]) {\n Utils.__cache[id] = {};\n }\n\n Utils.__cache[id][name] = value;\n };\n\n Utils.GetData = function (element, name) {\n // Retrieves a value from the cache by its key (name)\n // name is optional. If no name specified, return\n // all cache items for the specified element.\n // and for a specified element.\n var id = Utils.GetUniqueElementId(element);\n if (name) {\n if (Utils.__cache[id]) {\n if (Utils.__cache[id][name] != null) {\n return Utils.__cache[id][name];\n }\n return $(element).data(name); // Fallback to HTML5 data attribs.\n }\n return $(element).data(name); // Fallback to HTML5 data attribs.\n } else {\n return Utils.__cache[id];\n }\n };\n\n Utils.RemoveData = function (element) {\n // Removes all cached items for a specified element.\n var id = Utils.GetUniqueElementId(element);\n if (Utils.__cache[id] != null) {\n delete Utils.__cache[id];\n }\n\n element.removeAttribute('data-select2-id');\n };\n\n return Utils;\n });\n\n S2.define('select2/results',[\n 'jquery',\n './utils'\n ], function ($, Utils) {\n function Results ($element, options, dataAdapter) {\n this.$element = $element;\n this.data = dataAdapter;\n this.options = options;\n\n Results.__super__.constructor.call(this);\n }\n\n Utils.Extend(Results, Utils.Observable);\n\n Results.prototype.render = function () {\n var $results = $(\n '
'\n );\n\n if (this.options.get('multiple')) {\n $results.attr('aria-multiselectable', 'true');\n }\n\n this.$results = $results;\n\n return $results;\n };\n\n Results.prototype.clear = function () {\n this.$results.empty();\n };\n\n Results.prototype.displayMessage = function (params) {\n var escapeMarkup = this.options.get('escapeMarkup');\n\n this.clear();\n this.hideLoading();\n\n var $message = $(\n ''\n );\n\n var message = this.options.get('translations').get(params.message);\n\n $message.append(\n escapeMarkup(\n message(params.args)\n )\n );\n\n $message[0].className += ' select2-results__message';\n\n this.$results.append($message);\n };\n\n Results.prototype.hideMessages = function () {\n this.$results.find('.select2-results__message').remove();\n };\n\n Results.prototype.append = function (data) {\n this.hideLoading();\n\n var $options = [];\n\n if (data.results == null || data.results.length === 0) {\n if (this.$results.children().length === 0) {\n this.trigger('results:message', {\n message: 'noResults'\n });\n }\n\n return;\n }\n\n data.results = this.sort(data.results);\n\n for (var d = 0; d < data.results.length; d++) {\n var item = data.results[d];\n\n var $option = this.option(item);\n\n $options.push($option);\n }\n\n this.$results.append($options);\n };\n\n Results.prototype.position = function ($results, $dropdown) {\n var $resultsContainer = $dropdown.find('.select2-results');\n $resultsContainer.append($results);\n };\n\n Results.prototype.sort = function (data) {\n var sorter = this.options.get('sorter');\n\n return sorter(data);\n };\n\n Results.prototype.highlightFirstItem = function () {\n var $options = this.$results\n .find('.select2-results__option[aria-selected]');\n\n var $selected = $options.filter('[aria-selected=true]');\n\n // Check if there are any selected options\n if ($selected.length > 0) {\n // If there are selected options, highlight the first\n $selected.first().trigger('mouseenter');\n } else {\n // If there are no selected options, highlight the first option\n // in the dropdown\n $options.first().trigger('mouseenter');\n }\n\n this.ensureHighlightVisible();\n };\n\n Results.prototype.setClasses = function () {\n var self = this;\n\n this.data.current(function (selected) {\n var selectedIds = $.map(selected, function (s) {\n return s.id.toString();\n });\n\n var $options = self.$results\n .find('.select2-results__option[aria-selected]');\n\n $options.each(function () {\n var $option = $(this);\n\n var item = Utils.GetData(this, 'data');\n\n // id needs to be converted to a string when comparing\n var id = '' + item.id;\n\n if ((item.element != null && item.element.selected) ||\n (item.element == null && $.inArray(id, selectedIds) > -1)) {\n $option.attr('aria-selected', 'true');\n } else {\n $option.attr('aria-selected', 'false');\n }\n });\n\n });\n };\n\n Results.prototype.showLoading = function (params) {\n this.hideLoading();\n\n var loadingMore = this.options.get('translations').get('searching');\n\n var loading = {\n disabled: true,\n loading: true,\n text: loadingMore(params)\n };\n var $loading = this.option(loading);\n $loading.className += ' loading-results';\n\n this.$results.prepend($loading);\n };\n\n Results.prototype.hideLoading = function () {\n this.$results.find('.loading-results').remove();\n };\n\n Results.prototype.option = function (data) {\n var option = document.createElement('li');\n option.className = 'select2-results__option';\n\n var attrs = {\n 'role': 'option',\n 'aria-selected': 'false'\n };\n\n var matches = window.Element.prototype.matches ||\n window.Element.prototype.msMatchesSelector ||\n window.Element.prototype.webkitMatchesSelector;\n\n if ((data.element != null && matches.call(data.element, ':disabled')) ||\n (data.element == null && data.disabled)) {\n delete attrs['aria-selected'];\n attrs['aria-disabled'] = 'true';\n }\n\n if (data.id == null) {\n delete attrs['aria-selected'];\n }\n\n if (data._resultId != null) {\n option.id = data._resultId;\n }\n\n if (data.title) {\n option.title = data.title;\n }\n\n if (data.children) {\n attrs.role = 'group';\n attrs['aria-label'] = data.text;\n delete attrs['aria-selected'];\n }\n\n for (var attr in attrs) {\n var val = attrs[attr];\n\n option.setAttribute(attr, val);\n }\n\n if (data.children) {\n var $option = $(option);\n\n var label = document.createElement('strong');\n label.className = 'select2-results__group';\n\n var $label = $(label);\n this.template(data, label);\n\n var $children = [];\n\n for (var c = 0; c < data.children.length; c++) {\n var child = data.children[c];\n\n var $child = this.option(child);\n\n $children.push($child);\n }\n\n var $childrenContainer = $('
', {\n 'class': 'select2-results__options select2-results__options--nested'\n });\n\n $childrenContainer.append($children);\n\n $option.append(label);\n $option.append($childrenContainer);\n } else {\n this.template(data, option);\n }\n\n Utils.StoreData(option, 'data', data);\n\n return option;\n };\n\n Results.prototype.bind = function (container, $container) {\n var self = this;\n\n var id = container.id + '-results';\n\n this.$results.attr('id', id);\n\n container.on('results:all', function (params) {\n self.clear();\n self.append(params.data);\n\n if (container.isOpen()) {\n self.setClasses();\n self.highlightFirstItem();\n }\n });\n\n container.on('results:append', function (params) {\n self.append(params.data);\n\n if (container.isOpen()) {\n self.setClasses();\n }\n });\n\n container.on('query', function (params) {\n self.hideMessages();\n self.showLoading(params);\n });\n\n container.on('select', function () {\n if (!container.isOpen()) {\n return;\n }\n\n self.setClasses();\n\n if (self.options.get('scrollAfterSelect')) {\n self.highlightFirstItem();\n }\n });\n\n container.on('unselect', function () {\n if (!container.isOpen()) {\n return;\n }\n\n self.setClasses();\n\n if (self.options.get('scrollAfterSelect')) {\n self.highlightFirstItem();\n }\n });\n\n container.on('open', function () {\n // When the dropdown is open, aria-expended=\"true\"\n self.$results.attr('aria-expanded', 'true');\n self.$results.attr('aria-hidden', 'false');\n\n self.setClasses();\n self.ensureHighlightVisible();\n });\n\n container.on('close', function () {\n // When the dropdown is closed, aria-expended=\"false\"\n self.$results.attr('aria-expanded', 'false');\n self.$results.attr('aria-hidden', 'true');\n self.$results.removeAttr('aria-activedescendant');\n });\n\n container.on('results:toggle', function () {\n var $highlighted = self.getHighlightedResults();\n\n if ($highlighted.length === 0) {\n return;\n }\n\n $highlighted.trigger('mouseup');\n });\n\n container.on('results:select', function () {\n var $highlighted = self.getHighlightedResults();\n\n if ($highlighted.length === 0) {\n return;\n }\n\n var data = Utils.GetData($highlighted[0], 'data');\n\n if ($highlighted.attr('aria-selected') == 'true') {\n self.trigger('close', {});\n } else {\n self.trigger('select', {\n data: data\n });\n }\n });\n\n container.on('results:previous', function () {\n var $highlighted = self.getHighlightedResults();\n\n var $options = self.$results.find('[aria-selected]');\n\n var currentIndex = $options.index($highlighted);\n\n // If we are already at the top, don't move further\n // If no options, currentIndex will be -1\n if (currentIndex <= 0) {\n return;\n }\n\n var nextIndex = currentIndex - 1;\n\n // If none are highlighted, highlight the first\n if ($highlighted.length === 0) {\n nextIndex = 0;\n }\n\n var $next = $options.eq(nextIndex);\n\n $next.trigger('mouseenter');\n\n var currentOffset = self.$results.offset().top;\n var nextTop = $next.offset().top;\n var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);\n\n if (nextIndex === 0) {\n self.$results.scrollTop(0);\n } else if (nextTop - currentOffset < 0) {\n self.$results.scrollTop(nextOffset);\n }\n });\n\n container.on('results:next', function () {\n var $highlighted = self.getHighlightedResults();\n\n var $options = self.$results.find('[aria-selected]');\n\n var currentIndex = $options.index($highlighted);\n\n var nextIndex = currentIndex + 1;\n\n // If we are at the last option, stay there\n if (nextIndex >= $options.length) {\n return;\n }\n\n var $next = $options.eq(nextIndex);\n\n $next.trigger('mouseenter');\n\n var currentOffset = self.$results.offset().top +\n self.$results.outerHeight(false);\n var nextBottom = $next.offset().top + $next.outerHeight(false);\n var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;\n\n if (nextIndex === 0) {\n self.$results.scrollTop(0);\n } else if (nextBottom > currentOffset) {\n self.$results.scrollTop(nextOffset);\n }\n });\n\n container.on('results:focus', function (params) {\n params.element.addClass('select2-results__option--highlighted');\n });\n\n container.on('results:message', function (params) {\n self.displayMessage(params);\n });\n\n if ($.fn.mousewheel) {\n this.$results.on('mousewheel', function (e) {\n var top = self.$results.scrollTop();\n\n var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;\n\n var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;\n var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();\n\n if (isAtTop) {\n self.$results.scrollTop(0);\n\n e.preventDefault();\n e.stopPropagation();\n } else if (isAtBottom) {\n self.$results.scrollTop(\n self.$results.get(0).scrollHeight - self.$results.height()\n );\n\n e.preventDefault();\n e.stopPropagation();\n }\n });\n }\n\n this.$results.on('mouseup', '.select2-results__option[aria-selected]',\n function (evt) {\n var $this = $(this);\n\n var data = Utils.GetData(this, 'data');\n\n if ($this.attr('aria-selected') === 'true') {\n if (self.options.get('multiple')) {\n self.trigger('unselect', {\n originalEvent: evt,\n data: data\n });\n } else {\n self.trigger('close', {});\n }\n\n return;\n }\n\n self.trigger('select', {\n originalEvent: evt,\n data: data\n });\n });\n\n this.$results.on('mouseenter', '.select2-results__option[aria-selected]',\n function (evt) {\n var data = Utils.GetData(this, 'data');\n\n self.getHighlightedResults()\n .removeClass('select2-results__option--highlighted');\n\n self.trigger('results:focus', {\n data: data,\n element: $(this)\n });\n });\n };\n\n Results.prototype.getHighlightedResults = function () {\n var $highlighted = this.$results\n .find('.select2-results__option--highlighted');\n\n return $highlighted;\n };\n\n Results.prototype.destroy = function () {\n this.$results.remove();\n };\n\n Results.prototype.ensureHighlightVisible = function () {\n var $highlighted = this.getHighlightedResults();\n\n if ($highlighted.length === 0) {\n return;\n }\n\n var $options = this.$results.find('[aria-selected]');\n\n var currentIndex = $options.index($highlighted);\n\n var currentOffset = this.$results.offset().top;\n var nextTop = $highlighted.offset().top;\n var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);\n\n var offsetDelta = nextTop - currentOffset;\n nextOffset -= $highlighted.outerHeight(false) * 2;\n\n if (currentIndex <= 2) {\n this.$results.scrollTop(0);\n } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {\n this.$results.scrollTop(nextOffset);\n }\n };\n\n Results.prototype.template = function (result, container) {\n var template = this.options.get('templateResult');\n var escapeMarkup = this.options.get('escapeMarkup');\n\n var content = template(result, container);\n\n if (content == null) {\n container.style.display = 'none';\n } else if (typeof content === 'string') {\n container.innerHTML = escapeMarkup(content);\n } else {\n $(container).append(content);\n }\n };\n\n return Results;\n });\n\n S2.define('select2/keys',[\n\n ], function () {\n var KEYS = {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n PAGE_UP: 33,\n PAGE_DOWN: 34,\n END: 35,\n HOME: 36,\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n DOWN: 40,\n DELETE: 46\n };\n\n return KEYS;\n });\n\n S2.define('select2/selection/base',[\n 'jquery',\n '../utils',\n '../keys'\n ], function ($, Utils, KEYS) {\n function BaseSelection ($element, options) {\n this.$element = $element;\n this.options = options;\n\n BaseSelection.__super__.constructor.call(this);\n }\n\n Utils.Extend(BaseSelection, Utils.Observable);\n\n BaseSelection.prototype.render = function () {\n var $selection = $(\n '' +\n ''\n );\n\n this._tabindex = 0;\n\n if (Utils.GetData(this.$element[0], 'old-tabindex') != null) {\n this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex');\n } else if (this.$element.attr('tabindex') != null) {\n this._tabindex = this.$element.attr('tabindex');\n }\n\n $selection.attr('title', this.$element.attr('title'));\n $selection.attr('tabindex', this._tabindex);\n $selection.attr('aria-disabled', 'false');\n\n this.$selection = $selection;\n\n return $selection;\n };\n\n BaseSelection.prototype.bind = function (container, $container) {\n var self = this;\n\n var resultsId = container.id + '-results';\n\n this.container = container;\n\n this.$selection.on('focus', function (evt) {\n self.trigger('focus', evt);\n });\n\n this.$selection.on('blur', function (evt) {\n self._handleBlur(evt);\n });\n\n this.$selection.on('keydown', function (evt) {\n self.trigger('keypress', evt);\n\n if (evt.which === KEYS.SPACE) {\n evt.preventDefault();\n }\n });\n\n container.on('results:focus', function (params) {\n self.$selection.attr('aria-activedescendant', params.data._resultId);\n });\n\n container.on('selection:update', function (params) {\n self.update(params.data);\n });\n\n container.on('open', function () {\n // When the dropdown is open, aria-expanded=\"true\"\n self.$selection.attr('aria-expanded', 'true');\n self.$selection.attr('aria-owns', resultsId);\n\n self._attachCloseHandler(container);\n });\n\n container.on('close', function () {\n // When the dropdown is closed, aria-expanded=\"false\"\n self.$selection.attr('aria-expanded', 'false');\n self.$selection.removeAttr('aria-activedescendant');\n self.$selection.removeAttr('aria-owns');\n\n self.$selection.trigger('focus');\n\n self._detachCloseHandler(container);\n });\n\n container.on('enable', function () {\n self.$selection.attr('tabindex', self._tabindex);\n self.$selection.attr('aria-disabled', 'false');\n });\n\n container.on('disable', function () {\n self.$selection.attr('tabindex', '-1');\n self.$selection.attr('aria-disabled', 'true');\n });\n };\n\n BaseSelection.prototype._handleBlur = function (evt) {\n var self = this;\n\n // This needs to be delayed as the active element is the body when the tab\n // key is pressed, possibly along with others.\n window.setTimeout(function () {\n // Don't trigger `blur` if the focus is still in the selection\n if (\n (document.activeElement == self.$selection[0]) ||\n ($.contains(self.$selection[0], document.activeElement))\n ) {\n return;\n }\n\n self.trigger('blur', evt);\n }, 1);\n };\n\n BaseSelection.prototype._attachCloseHandler = function (container) {\n\n $(document.body).on('mousedown.select2.' + container.id, function (e) {\n var $target = $(e.target);\n\n var $select = $target.closest('.select2');\n\n var $all = $('.select2.select2-container--open');\n\n $all.each(function () {\n if (this == $select[0]) {\n return;\n }\n\n var $element = Utils.GetData(this, 'element');\n\n $element.select2('close');\n });\n });\n };\n\n BaseSelection.prototype._detachCloseHandler = function (container) {\n $(document.body).off('mousedown.select2.' + container.id);\n };\n\n BaseSelection.prototype.position = function ($selection, $container) {\n var $selectionContainer = $container.find('.selection');\n $selectionContainer.append($selection);\n };\n\n BaseSelection.prototype.destroy = function () {\n this._detachCloseHandler(this.container);\n };\n\n BaseSelection.prototype.update = function (data) {\n throw new Error('The `update` method must be defined in child classes.');\n };\n\n /**\n * Helper method to abstract the \"enabled\" (not \"disabled\") state of this\n * object.\n *\n * @return {true} if the instance is not disabled.\n * @return {false} if the instance is disabled.\n */\n BaseSelection.prototype.isEnabled = function () {\n return !this.isDisabled();\n };\n\n /**\n * Helper method to abstract the \"disabled\" state of this object.\n *\n * @return {true} if the disabled option is true.\n * @return {false} if the disabled option is false.\n */\n BaseSelection.prototype.isDisabled = function () {\n return this.options.get('disabled');\n };\n\n return BaseSelection;\n });\n\n S2.define('select2/selection/single',[\n 'jquery',\n './base',\n '../utils',\n '../keys'\n ], function ($, BaseSelection, Utils, KEYS) {\n function SingleSelection () {\n SingleSelection.__super__.constructor.apply(this, arguments);\n }\n\n Utils.Extend(SingleSelection, BaseSelection);\n\n SingleSelection.prototype.render = function () {\n var $selection = SingleSelection.__super__.render.call(this);\n\n $selection.addClass('select2-selection--single');\n\n $selection.html(\n '' +\n '' +\n '' +\n ''\n );\n\n return $selection;\n };\n\n SingleSelection.prototype.bind = function (container, $container) {\n var self = this;\n\n SingleSelection.__super__.bind.apply(this, arguments);\n\n var id = container.id + '-container';\n\n this.$selection.find('.select2-selection__rendered')\n .attr('id', id)\n .attr('role', 'textbox')\n .attr('aria-readonly', 'true');\n this.$selection.attr('aria-labelledby', id);\n\n this.$selection.on('mousedown', function (evt) {\n // Only respond to left clicks\n if (evt.which !== 1) {\n return;\n }\n\n self.trigger('toggle', {\n originalEvent: evt\n });\n });\n\n this.$selection.on('focus', function (evt) {\n // User focuses on the container\n });\n\n this.$selection.on('blur', function (evt) {\n // User exits the container\n });\n\n container.on('focus', function (evt) {\n if (!container.isOpen()) {\n self.$selection.trigger('focus');\n }\n });\n };\n\n SingleSelection.prototype.clear = function () {\n var $rendered = this.$selection.find('.select2-selection__rendered');\n $rendered.empty();\n $rendered.removeAttr('title'); // clear tooltip on empty\n };\n\n SingleSelection.prototype.display = function (data, container) {\n var template = this.options.get('templateSelection');\n var escapeMarkup = this.options.get('escapeMarkup');\n\n return escapeMarkup(template(data, container));\n };\n\n SingleSelection.prototype.selectionContainer = function () {\n return $('');\n };\n\n SingleSelection.prototype.update = function (data) {\n if (data.length === 0) {\n this.clear();\n return;\n }\n\n var selection = data[0];\n\n var $rendered = this.$selection.find('.select2-selection__rendered');\n var formatted = this.display(selection, $rendered);\n\n $rendered.empty().append(formatted);\n\n var title = selection.title || selection.text;\n\n if (title) {\n $rendered.attr('title', title);\n } else {\n $rendered.removeAttr('title');\n }\n };\n\n return SingleSelection;\n });\n\n S2.define('select2/selection/multiple',[\n 'jquery',\n './base',\n '../utils'\n ], function ($, BaseSelection, Utils) {\n function MultipleSelection ($element, options) {\n MultipleSelection.__super__.constructor.apply(this, arguments);\n }\n\n Utils.Extend(MultipleSelection, BaseSelection);\n\n MultipleSelection.prototype.render = function () {\n var $selection = MultipleSelection.__super__.render.call(this);\n\n $selection.addClass('select2-selection--multiple');\n\n $selection.html(\n '
'\n );\n\n return $selection;\n };\n\n MultipleSelection.prototype.bind = function (container, $container) {\n var self = this;\n\n MultipleSelection.__super__.bind.apply(this, arguments);\n\n this.$selection.on('click', function (evt) {\n self.trigger('toggle', {\n originalEvent: evt\n });\n });\n\n this.$selection.on(\n 'click',\n '.select2-selection__choice__remove',\n function (evt) {\n // Ignore the event if it is disabled\n if (self.isDisabled()) {\n return;\n }\n\n var $remove = $(this);\n var $selection = $remove.parent();\n\n var data = Utils.GetData($selection[0], 'data');\n\n self.trigger('unselect', {\n originalEvent: evt,\n data: data\n });\n }\n );\n };\n\n MultipleSelection.prototype.clear = function () {\n var $rendered = this.$selection.find('.select2-selection__rendered');\n $rendered.empty();\n $rendered.removeAttr('title');\n };\n\n MultipleSelection.prototype.display = function (data, container) {\n var template = this.options.get('templateSelection');\n var escapeMarkup = this.options.get('escapeMarkup');\n\n return escapeMarkup(template(data, container));\n };\n\n MultipleSelection.prototype.selectionContainer = function () {\n var $container = $(\n '
' +\n '' +\n '×' +\n '' +\n '
'\n );\n\n return $container;\n };\n\n MultipleSelection.prototype.update = function (data) {\n this.clear();\n\n if (data.length === 0) {\n return;\n }\n\n var $selections = [];\n\n for (var d = 0; d < data.length; d++) {\n var selection = data[d];\n\n var $selection = this.selectionContainer();\n var formatted = this.display(selection, $selection);\n\n $selection.append(formatted);\n\n var title = selection.title || selection.text;\n\n if (title) {\n $selection.attr('title', title);\n }\n\n Utils.StoreData($selection[0], 'data', selection);\n\n $selections.push($selection);\n }\n\n var $rendered = this.$selection.find('.select2-selection__rendered');\n\n Utils.appendMany($rendered, $selections);\n };\n\n return MultipleSelection;\n });\n\n S2.define('select2/selection/placeholder',[\n '../utils'\n ], function (Utils) {\n function Placeholder (decorated, $element, options) {\n this.placeholder = this.normalizePlaceholder(options.get('placeholder'));\n\n decorated.call(this, $element, options);\n }\n\n Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {\n if (typeof placeholder === 'string') {\n placeholder = {\n id: '',\n text: placeholder\n };\n }\n\n return placeholder;\n };\n\n Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {\n var $placeholder = this.selectionContainer();\n\n $placeholder.html(this.display(placeholder));\n $placeholder.addClass('select2-selection__placeholder')\n .removeClass('select2-selection__choice');\n\n return $placeholder;\n };\n\n Placeholder.prototype.update = function (decorated, data) {\n var singlePlaceholder = (\n data.length == 1 && data[0].id != this.placeholder.id\n );\n var multipleSelections = data.length > 1;\n\n if (multipleSelections || singlePlaceholder) {\n return decorated.call(this, data);\n }\n\n this.clear();\n\n var $placeholder = this.createPlaceholder(this.placeholder);\n\n this.$selection.find('.select2-selection__rendered').append($placeholder);\n };\n\n return Placeholder;\n });\n\n S2.define('select2/selection/allowClear',[\n 'jquery',\n '../keys',\n '../utils'\n ], function ($, KEYS, Utils) {\n function AllowClear () { }\n\n AllowClear.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n decorated.call(this, container, $container);\n\n if (this.placeholder == null) {\n if (this.options.get('debug') && window.console && console.error) {\n console.error(\n 'Select2: The `allowClear` option should be used in combination ' +\n 'with the `placeholder` option.'\n );\n }\n }\n\n this.$selection.on('mousedown', '.select2-selection__clear',\n function (evt) {\n self._handleClear(evt);\n });\n\n container.on('keypress', function (evt) {\n self._handleKeyboardClear(evt, container);\n });\n };\n\n AllowClear.prototype._handleClear = function (_, evt) {\n // Ignore the event if it is disabled\n if (this.isDisabled()) {\n return;\n }\n\n var $clear = this.$selection.find('.select2-selection__clear');\n\n // Ignore the event if nothing has been selected\n if ($clear.length === 0) {\n return;\n }\n\n evt.stopPropagation();\n\n var data = Utils.GetData($clear[0], 'data');\n\n var previousVal = this.$element.val();\n this.$element.val(this.placeholder.id);\n\n var unselectData = {\n data: data\n };\n this.trigger('clear', unselectData);\n if (unselectData.prevented) {\n this.$element.val(previousVal);\n return;\n }\n\n for (var d = 0; d < data.length; d++) {\n unselectData = {\n data: data[d]\n };\n\n // Trigger the `unselect` event, so people can prevent it from being\n // cleared.\n this.trigger('unselect', unselectData);\n\n // If the event was prevented, don't clear it out.\n if (unselectData.prevented) {\n this.$element.val(previousVal);\n return;\n }\n }\n\n this.$element.trigger('input').trigger('change');\n\n this.trigger('toggle', {});\n };\n\n AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {\n if (container.isOpen()) {\n return;\n }\n\n if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {\n this._handleClear(evt);\n }\n };\n\n AllowClear.prototype.update = function (decorated, data) {\n decorated.call(this, data);\n\n if (this.$selection.find('.select2-selection__placeholder').length > 0 ||\n data.length === 0) {\n return;\n }\n\n var removeAll = this.options.get('translations').get('removeAllItems');\n\n var $remove = $(\n '' +\n '×' +\n ''\n );\n Utils.StoreData($remove[0], 'data', data);\n\n this.$selection.find('.select2-selection__rendered').prepend($remove);\n };\n\n return AllowClear;\n });\n\n S2.define('select2/selection/search',[\n 'jquery',\n '../utils',\n '../keys'\n ], function ($, Utils, KEYS) {\n function Search (decorated, $element, options) {\n decorated.call(this, $element, options);\n }\n\n Search.prototype.render = function (decorated) {\n var $search = $(\n '
' +\n '' +\n '
'\n );\n\n this.$searchContainer = $search;\n this.$search = $search.find('input');\n\n var $rendered = decorated.call(this);\n\n this._transferTabIndex();\n\n return $rendered;\n };\n\n Search.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n var resultsId = container.id + '-results';\n\n decorated.call(this, container, $container);\n\n container.on('open', function () {\n self.$search.attr('aria-controls', resultsId);\n self.$search.trigger('focus');\n });\n\n container.on('close', function () {\n self.$search.val('');\n self.$search.removeAttr('aria-controls');\n self.$search.removeAttr('aria-activedescendant');\n self.$search.trigger('focus');\n });\n\n container.on('enable', function () {\n self.$search.prop('disabled', false);\n\n self._transferTabIndex();\n });\n\n container.on('disable', function () {\n self.$search.prop('disabled', true);\n });\n\n container.on('focus', function (evt) {\n self.$search.trigger('focus');\n });\n\n container.on('results:focus', function (params) {\n if (params.data._resultId) {\n self.$search.attr('aria-activedescendant', params.data._resultId);\n } else {\n self.$search.removeAttr('aria-activedescendant');\n }\n });\n\n this.$selection.on('focusin', '.select2-search--inline', function (evt) {\n self.trigger('focus', evt);\n });\n\n this.$selection.on('focusout', '.select2-search--inline', function (evt) {\n self._handleBlur(evt);\n });\n\n this.$selection.on('keydown', '.select2-search--inline', function (evt) {\n evt.stopPropagation();\n\n self.trigger('keypress', evt);\n\n self._keyUpPrevented = evt.isDefaultPrevented();\n\n var key = evt.which;\n\n if (key === KEYS.BACKSPACE && self.$search.val() === '') {\n var $previousChoice = self.$searchContainer\n .prev('.select2-selection__choice');\n\n if ($previousChoice.length > 0) {\n var item = Utils.GetData($previousChoice[0], 'data');\n\n self.searchRemoveChoice(item);\n\n evt.preventDefault();\n }\n }\n });\n\n this.$selection.on('click', '.select2-search--inline', function (evt) {\n if (self.$search.val()) {\n evt.stopPropagation();\n }\n });\n\n // Try to detect the IE version should the `documentMode` property that\n // is stored on the document. This is only implemented in IE and is\n // slightly cleaner than doing a user agent check.\n // This property is not available in Edge, but Edge also doesn't have\n // this bug.\n var msie = document.documentMode;\n var disableInputEvents = msie && msie <= 11;\n\n // Workaround for browsers which do not support the `input` event\n // This will prevent double-triggering of events for browsers which support\n // both the `keyup` and `input` events.\n this.$selection.on(\n 'input.searchcheck',\n '.select2-search--inline',\n function (evt) {\n // IE will trigger the `input` event when a placeholder is used on a\n // search box. To get around this issue, we are forced to ignore all\n // `input` events in IE and keep using `keyup`.\n if (disableInputEvents) {\n self.$selection.off('input.search input.searchcheck');\n return;\n }\n\n // Unbind the duplicated `keyup` event\n self.$selection.off('keyup.search');\n }\n );\n\n this.$selection.on(\n 'keyup.search input.search',\n '.select2-search--inline',\n function (evt) {\n // IE will trigger the `input` event when a placeholder is used on a\n // search box. To get around this issue, we are forced to ignore all\n // `input` events in IE and keep using `keyup`.\n if (disableInputEvents && evt.type === 'input') {\n self.$selection.off('input.search input.searchcheck');\n return;\n }\n\n var key = evt.which;\n\n // We can freely ignore events from modifier keys\n if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {\n return;\n }\n\n // Tabbing will be handled during the `keydown` phase\n if (key == KEYS.TAB) {\n return;\n }\n\n self.handleSearch(evt);\n }\n );\n };\n\n /**\n * This method will transfer the tabindex attribute from the rendered\n * selection to the search box. This allows for the search box to be used as\n * the primary focus instead of the selection container.\n *\n * @private\n */\n Search.prototype._transferTabIndex = function (decorated) {\n this.$search.attr('tabindex', this.$selection.attr('tabindex'));\n this.$selection.attr('tabindex', '-1');\n };\n\n Search.prototype.createPlaceholder = function (decorated, placeholder) {\n this.$search.attr('placeholder', placeholder.text);\n };\n\n Search.prototype.update = function (decorated, data) {\n var searchHadFocus = this.$search[0] == document.activeElement;\n\n this.$search.attr('placeholder', '');\n\n decorated.call(this, data);\n\n this.$selection.find('.select2-selection__rendered')\n .append(this.$searchContainer);\n\n this.resizeSearch();\n if (searchHadFocus) {\n this.$search.trigger('focus');\n }\n };\n\n Search.prototype.handleSearch = function () {\n this.resizeSearch();\n\n if (!this._keyUpPrevented) {\n var input = this.$search.val();\n\n this.trigger('query', {\n term: input\n });\n }\n\n this._keyUpPrevented = false;\n };\n\n Search.prototype.searchRemoveChoice = function (decorated, item) {\n this.trigger('unselect', {\n data: item\n });\n\n this.$search.val(item.text);\n this.handleSearch();\n };\n\n Search.prototype.resizeSearch = function () {\n this.$search.css('width', '25px');\n\n var width = '';\n\n if (this.$search.attr('placeholder') !== '') {\n width = this.$selection.find('.select2-selection__rendered').width();\n } else {\n var minimumWidth = this.$search.val().length + 1;\n\n width = (minimumWidth * 0.75) + 'em';\n }\n\n this.$search.css('width', width);\n };\n\n return Search;\n });\n\n S2.define('select2/selection/eventRelay',[\n 'jquery'\n ], function ($) {\n function EventRelay () { }\n\n EventRelay.prototype.bind = function (decorated, container, $container) {\n var self = this;\n var relayEvents = [\n 'open', 'opening',\n 'close', 'closing',\n 'select', 'selecting',\n 'unselect', 'unselecting',\n 'clear', 'clearing'\n ];\n\n var preventableEvents = [\n 'opening', 'closing', 'selecting', 'unselecting', 'clearing'\n ];\n\n decorated.call(this, container, $container);\n\n container.on('*', function (name, params) {\n // Ignore events that should not be relayed\n if ($.inArray(name, relayEvents) === -1) {\n return;\n }\n\n // The parameters should always be an object\n params = params || {};\n\n // Generate the jQuery event for the Select2 event\n var evt = $.Event('select2:' + name, {\n params: params\n });\n\n self.$element.trigger(evt);\n\n // Only handle preventable events if it was one\n if ($.inArray(name, preventableEvents) === -1) {\n return;\n }\n\n params.prevented = evt.isDefaultPrevented();\n });\n };\n\n return EventRelay;\n });\n\n S2.define('select2/translation',[\n 'jquery',\n 'require'\n ], function ($, require) {\n function Translation (dict) {\n this.dict = dict || {};\n }\n\n Translation.prototype.all = function () {\n return this.dict;\n };\n\n Translation.prototype.get = function (key) {\n return this.dict[key];\n };\n\n Translation.prototype.extend = function (translation) {\n this.dict = $.extend({}, translation.all(), this.dict);\n };\n\n // Static functions\n\n Translation._cache = {};\n\n Translation.loadPath = function (path) {\n if (!(path in Translation._cache)) {\n var translations = require(path);\n\n Translation._cache[path] = translations;\n }\n\n return new Translation(Translation._cache[path]);\n };\n\n return Translation;\n });\n\n S2.define('select2/diacritics',[\n\n ], function () {\n var diacritics = {\n '\\u24B6': 'A',\n '\\uFF21': 'A',\n '\\u00C0': 'A',\n '\\u00C1': 'A',\n '\\u00C2': 'A',\n '\\u1EA6': 'A',\n '\\u1EA4': 'A',\n '\\u1EAA': 'A',\n '\\u1EA8': 'A',\n '\\u00C3': 'A',\n '\\u0100': 'A',\n '\\u0102': 'A',\n '\\u1EB0': 'A',\n '\\u1EAE': 'A',\n '\\u1EB4': 'A',\n '\\u1EB2': 'A',\n '\\u0226': 'A',\n '\\u01E0': 'A',\n '\\u00C4': 'A',\n '\\u01DE': 'A',\n '\\u1EA2': 'A',\n '\\u00C5': 'A',\n '\\u01FA': 'A',\n '\\u01CD': 'A',\n '\\u0200': 'A',\n '\\u0202': 'A',\n '\\u1EA0': 'A',\n '\\u1EAC': 'A',\n '\\u1EB6': 'A',\n '\\u1E00': 'A',\n '\\u0104': 'A',\n '\\u023A': 'A',\n '\\u2C6F': 'A',\n '\\uA732': 'AA',\n '\\u00C6': 'AE',\n '\\u01FC': 'AE',\n '\\u01E2': 'AE',\n '\\uA734': 'AO',\n '\\uA736': 'AU',\n '\\uA738': 'AV',\n '\\uA73A': 'AV',\n '\\uA73C': 'AY',\n '\\u24B7': 'B',\n '\\uFF22': 'B',\n '\\u1E02': 'B',\n '\\u1E04': 'B',\n '\\u1E06': 'B',\n '\\u0243': 'B',\n '\\u0182': 'B',\n '\\u0181': 'B',\n '\\u24B8': 'C',\n '\\uFF23': 'C',\n '\\u0106': 'C',\n '\\u0108': 'C',\n '\\u010A': 'C',\n '\\u010C': 'C',\n '\\u00C7': 'C',\n '\\u1E08': 'C',\n '\\u0187': 'C',\n '\\u023B': 'C',\n '\\uA73E': 'C',\n '\\u24B9': 'D',\n '\\uFF24': 'D',\n '\\u1E0A': 'D',\n '\\u010E': 'D',\n '\\u1E0C': 'D',\n '\\u1E10': 'D',\n '\\u1E12': 'D',\n '\\u1E0E': 'D',\n '\\u0110': 'D',\n '\\u018B': 'D',\n '\\u018A': 'D',\n '\\u0189': 'D',\n '\\uA779': 'D',\n '\\u01F1': 'DZ',\n '\\u01C4': 'DZ',\n '\\u01F2': 'Dz',\n '\\u01C5': 'Dz',\n '\\u24BA': 'E',\n '\\uFF25': 'E',\n '\\u00C8': 'E',\n '\\u00C9': 'E',\n '\\u00CA': 'E',\n '\\u1EC0': 'E',\n '\\u1EBE': 'E',\n '\\u1EC4': 'E',\n '\\u1EC2': 'E',\n '\\u1EBC': 'E',\n '\\u0112': 'E',\n '\\u1E14': 'E',\n '\\u1E16': 'E',\n '\\u0114': 'E',\n '\\u0116': 'E',\n '\\u00CB': 'E',\n '\\u1EBA': 'E',\n '\\u011A': 'E',\n '\\u0204': 'E',\n '\\u0206': 'E',\n '\\u1EB8': 'E',\n '\\u1EC6': 'E',\n '\\u0228': 'E',\n '\\u1E1C': 'E',\n '\\u0118': 'E',\n '\\u1E18': 'E',\n '\\u1E1A': 'E',\n '\\u0190': 'E',\n '\\u018E': 'E',\n '\\u24BB': 'F',\n '\\uFF26': 'F',\n '\\u1E1E': 'F',\n '\\u0191': 'F',\n '\\uA77B': 'F',\n '\\u24BC': 'G',\n '\\uFF27': 'G',\n '\\u01F4': 'G',\n '\\u011C': 'G',\n '\\u1E20': 'G',\n '\\u011E': 'G',\n '\\u0120': 'G',\n '\\u01E6': 'G',\n '\\u0122': 'G',\n '\\u01E4': 'G',\n '\\u0193': 'G',\n '\\uA7A0': 'G',\n '\\uA77D': 'G',\n '\\uA77E': 'G',\n '\\u24BD': 'H',\n '\\uFF28': 'H',\n '\\u0124': 'H',\n '\\u1E22': 'H',\n '\\u1E26': 'H',\n '\\u021E': 'H',\n '\\u1E24': 'H',\n '\\u1E28': 'H',\n '\\u1E2A': 'H',\n '\\u0126': 'H',\n '\\u2C67': 'H',\n '\\u2C75': 'H',\n '\\uA78D': 'H',\n '\\u24BE': 'I',\n '\\uFF29': 'I',\n '\\u00CC': 'I',\n '\\u00CD': 'I',\n '\\u00CE': 'I',\n '\\u0128': 'I',\n '\\u012A': 'I',\n '\\u012C': 'I',\n '\\u0130': 'I',\n '\\u00CF': 'I',\n '\\u1E2E': 'I',\n '\\u1EC8': 'I',\n '\\u01CF': 'I',\n '\\u0208': 'I',\n '\\u020A': 'I',\n '\\u1ECA': 'I',\n '\\u012E': 'I',\n '\\u1E2C': 'I',\n '\\u0197': 'I',\n '\\u24BF': 'J',\n '\\uFF2A': 'J',\n '\\u0134': 'J',\n '\\u0248': 'J',\n '\\u24C0': 'K',\n '\\uFF2B': 'K',\n '\\u1E30': 'K',\n '\\u01E8': 'K',\n '\\u1E32': 'K',\n '\\u0136': 'K',\n '\\u1E34': 'K',\n '\\u0198': 'K',\n '\\u2C69': 'K',\n '\\uA740': 'K',\n '\\uA742': 'K',\n '\\uA744': 'K',\n '\\uA7A2': 'K',\n '\\u24C1': 'L',\n '\\uFF2C': 'L',\n '\\u013F': 'L',\n '\\u0139': 'L',\n '\\u013D': 'L',\n '\\u1E36': 'L',\n '\\u1E38': 'L',\n '\\u013B': 'L',\n '\\u1E3C': 'L',\n '\\u1E3A': 'L',\n '\\u0141': 'L',\n '\\u023D': 'L',\n '\\u2C62': 'L',\n '\\u2C60': 'L',\n '\\uA748': 'L',\n '\\uA746': 'L',\n '\\uA780': 'L',\n '\\u01C7': 'LJ',\n '\\u01C8': 'Lj',\n '\\u24C2': 'M',\n '\\uFF2D': 'M',\n '\\u1E3E': 'M',\n '\\u1E40': 'M',\n '\\u1E42': 'M',\n '\\u2C6E': 'M',\n '\\u019C': 'M',\n '\\u24C3': 'N',\n '\\uFF2E': 'N',\n '\\u01F8': 'N',\n '\\u0143': 'N',\n '\\u00D1': 'N',\n '\\u1E44': 'N',\n '\\u0147': 'N',\n '\\u1E46': 'N',\n '\\u0145': 'N',\n '\\u1E4A': 'N',\n '\\u1E48': 'N',\n '\\u0220': 'N',\n '\\u019D': 'N',\n '\\uA790': 'N',\n '\\uA7A4': 'N',\n '\\u01CA': 'NJ',\n '\\u01CB': 'Nj',\n '\\u24C4': 'O',\n '\\uFF2F': 'O',\n '\\u00D2': 'O',\n '\\u00D3': 'O',\n '\\u00D4': 'O',\n '\\u1ED2': 'O',\n '\\u1ED0': 'O',\n '\\u1ED6': 'O',\n '\\u1ED4': 'O',\n '\\u00D5': 'O',\n '\\u1E4C': 'O',\n '\\u022C': 'O',\n '\\u1E4E': 'O',\n '\\u014C': 'O',\n '\\u1E50': 'O',\n '\\u1E52': 'O',\n '\\u014E': 'O',\n '\\u022E': 'O',\n '\\u0230': 'O',\n '\\u00D6': 'O',\n '\\u022A': 'O',\n '\\u1ECE': 'O',\n '\\u0150': 'O',\n '\\u01D1': 'O',\n '\\u020C': 'O',\n '\\u020E': 'O',\n '\\u01A0': 'O',\n '\\u1EDC': 'O',\n '\\u1EDA': 'O',\n '\\u1EE0': 'O',\n '\\u1EDE': 'O',\n '\\u1EE2': 'O',\n '\\u1ECC': 'O',\n '\\u1ED8': 'O',\n '\\u01EA': 'O',\n '\\u01EC': 'O',\n '\\u00D8': 'O',\n '\\u01FE': 'O',\n '\\u0186': 'O',\n '\\u019F': 'O',\n '\\uA74A': 'O',\n '\\uA74C': 'O',\n '\\u0152': 'OE',\n '\\u01A2': 'OI',\n '\\uA74E': 'OO',\n '\\u0222': 'OU',\n '\\u24C5': 'P',\n '\\uFF30': 'P',\n '\\u1E54': 'P',\n '\\u1E56': 'P',\n '\\u01A4': 'P',\n '\\u2C63': 'P',\n '\\uA750': 'P',\n '\\uA752': 'P',\n '\\uA754': 'P',\n '\\u24C6': 'Q',\n '\\uFF31': 'Q',\n '\\uA756': 'Q',\n '\\uA758': 'Q',\n '\\u024A': 'Q',\n '\\u24C7': 'R',\n '\\uFF32': 'R',\n '\\u0154': 'R',\n '\\u1E58': 'R',\n '\\u0158': 'R',\n '\\u0210': 'R',\n '\\u0212': 'R',\n '\\u1E5A': 'R',\n '\\u1E5C': 'R',\n '\\u0156': 'R',\n '\\u1E5E': 'R',\n '\\u024C': 'R',\n '\\u2C64': 'R',\n '\\uA75A': 'R',\n '\\uA7A6': 'R',\n '\\uA782': 'R',\n '\\u24C8': 'S',\n '\\uFF33': 'S',\n '\\u1E9E': 'S',\n '\\u015A': 'S',\n '\\u1E64': 'S',\n '\\u015C': 'S',\n '\\u1E60': 'S',\n '\\u0160': 'S',\n '\\u1E66': 'S',\n '\\u1E62': 'S',\n '\\u1E68': 'S',\n '\\u0218': 'S',\n '\\u015E': 'S',\n '\\u2C7E': 'S',\n '\\uA7A8': 'S',\n '\\uA784': 'S',\n '\\u24C9': 'T',\n '\\uFF34': 'T',\n '\\u1E6A': 'T',\n '\\u0164': 'T',\n '\\u1E6C': 'T',\n '\\u021A': 'T',\n '\\u0162': 'T',\n '\\u1E70': 'T',\n '\\u1E6E': 'T',\n '\\u0166': 'T',\n '\\u01AC': 'T',\n '\\u01AE': 'T',\n '\\u023E': 'T',\n '\\uA786': 'T',\n '\\uA728': 'TZ',\n '\\u24CA': 'U',\n '\\uFF35': 'U',\n '\\u00D9': 'U',\n '\\u00DA': 'U',\n '\\u00DB': 'U',\n '\\u0168': 'U',\n '\\u1E78': 'U',\n '\\u016A': 'U',\n '\\u1E7A': 'U',\n '\\u016C': 'U',\n '\\u00DC': 'U',\n '\\u01DB': 'U',\n '\\u01D7': 'U',\n '\\u01D5': 'U',\n '\\u01D9': 'U',\n '\\u1EE6': 'U',\n '\\u016E': 'U',\n '\\u0170': 'U',\n '\\u01D3': 'U',\n '\\u0214': 'U',\n '\\u0216': 'U',\n '\\u01AF': 'U',\n '\\u1EEA': 'U',\n '\\u1EE8': 'U',\n '\\u1EEE': 'U',\n '\\u1EEC': 'U',\n '\\u1EF0': 'U',\n '\\u1EE4': 'U',\n '\\u1E72': 'U',\n '\\u0172': 'U',\n '\\u1E76': 'U',\n '\\u1E74': 'U',\n '\\u0244': 'U',\n '\\u24CB': 'V',\n '\\uFF36': 'V',\n '\\u1E7C': 'V',\n '\\u1E7E': 'V',\n '\\u01B2': 'V',\n '\\uA75E': 'V',\n '\\u0245': 'V',\n '\\uA760': 'VY',\n '\\u24CC': 'W',\n '\\uFF37': 'W',\n '\\u1E80': 'W',\n '\\u1E82': 'W',\n '\\u0174': 'W',\n '\\u1E86': 'W',\n '\\u1E84': 'W',\n '\\u1E88': 'W',\n '\\u2C72': 'W',\n '\\u24CD': 'X',\n '\\uFF38': 'X',\n '\\u1E8A': 'X',\n '\\u1E8C': 'X',\n '\\u24CE': 'Y',\n '\\uFF39': 'Y',\n '\\u1EF2': 'Y',\n '\\u00DD': 'Y',\n '\\u0176': 'Y',\n '\\u1EF8': 'Y',\n '\\u0232': 'Y',\n '\\u1E8E': 'Y',\n '\\u0178': 'Y',\n '\\u1EF6': 'Y',\n '\\u1EF4': 'Y',\n '\\u01B3': 'Y',\n '\\u024E': 'Y',\n '\\u1EFE': 'Y',\n '\\u24CF': 'Z',\n '\\uFF3A': 'Z',\n '\\u0179': 'Z',\n '\\u1E90': 'Z',\n '\\u017B': 'Z',\n '\\u017D': 'Z',\n '\\u1E92': 'Z',\n '\\u1E94': 'Z',\n '\\u01B5': 'Z',\n '\\u0224': 'Z',\n '\\u2C7F': 'Z',\n '\\u2C6B': 'Z',\n '\\uA762': 'Z',\n '\\u24D0': 'a',\n '\\uFF41': 'a',\n '\\u1E9A': 'a',\n '\\u00E0': 'a',\n '\\u00E1': 'a',\n '\\u00E2': 'a',\n '\\u1EA7': 'a',\n '\\u1EA5': 'a',\n '\\u1EAB': 'a',\n '\\u1EA9': 'a',\n '\\u00E3': 'a',\n '\\u0101': 'a',\n '\\u0103': 'a',\n '\\u1EB1': 'a',\n '\\u1EAF': 'a',\n '\\u1EB5': 'a',\n '\\u1EB3': 'a',\n '\\u0227': 'a',\n '\\u01E1': 'a',\n '\\u00E4': 'a',\n '\\u01DF': 'a',\n '\\u1EA3': 'a',\n '\\u00E5': 'a',\n '\\u01FB': 'a',\n '\\u01CE': 'a',\n '\\u0201': 'a',\n '\\u0203': 'a',\n '\\u1EA1': 'a',\n '\\u1EAD': 'a',\n '\\u1EB7': 'a',\n '\\u1E01': 'a',\n '\\u0105': 'a',\n '\\u2C65': 'a',\n '\\u0250': 'a',\n '\\uA733': 'aa',\n '\\u00E6': 'ae',\n '\\u01FD': 'ae',\n '\\u01E3': 'ae',\n '\\uA735': 'ao',\n '\\uA737': 'au',\n '\\uA739': 'av',\n '\\uA73B': 'av',\n '\\uA73D': 'ay',\n '\\u24D1': 'b',\n '\\uFF42': 'b',\n '\\u1E03': 'b',\n '\\u1E05': 'b',\n '\\u1E07': 'b',\n '\\u0180': 'b',\n '\\u0183': 'b',\n '\\u0253': 'b',\n '\\u24D2': 'c',\n '\\uFF43': 'c',\n '\\u0107': 'c',\n '\\u0109': 'c',\n '\\u010B': 'c',\n '\\u010D': 'c',\n '\\u00E7': 'c',\n '\\u1E09': 'c',\n '\\u0188': 'c',\n '\\u023C': 'c',\n '\\uA73F': 'c',\n '\\u2184': 'c',\n '\\u24D3': 'd',\n '\\uFF44': 'd',\n '\\u1E0B': 'd',\n '\\u010F': 'd',\n '\\u1E0D': 'd',\n '\\u1E11': 'd',\n '\\u1E13': 'd',\n '\\u1E0F': 'd',\n '\\u0111': 'd',\n '\\u018C': 'd',\n '\\u0256': 'd',\n '\\u0257': 'd',\n '\\uA77A': 'd',\n '\\u01F3': 'dz',\n '\\u01C6': 'dz',\n '\\u24D4': 'e',\n '\\uFF45': 'e',\n '\\u00E8': 'e',\n '\\u00E9': 'e',\n '\\u00EA': 'e',\n '\\u1EC1': 'e',\n '\\u1EBF': 'e',\n '\\u1EC5': 'e',\n '\\u1EC3': 'e',\n '\\u1EBD': 'e',\n '\\u0113': 'e',\n '\\u1E15': 'e',\n '\\u1E17': 'e',\n '\\u0115': 'e',\n '\\u0117': 'e',\n '\\u00EB': 'e',\n '\\u1EBB': 'e',\n '\\u011B': 'e',\n '\\u0205': 'e',\n '\\u0207': 'e',\n '\\u1EB9': 'e',\n '\\u1EC7': 'e',\n '\\u0229': 'e',\n '\\u1E1D': 'e',\n '\\u0119': 'e',\n '\\u1E19': 'e',\n '\\u1E1B': 'e',\n '\\u0247': 'e',\n '\\u025B': 'e',\n '\\u01DD': 'e',\n '\\u24D5': 'f',\n '\\uFF46': 'f',\n '\\u1E1F': 'f',\n '\\u0192': 'f',\n '\\uA77C': 'f',\n '\\u24D6': 'g',\n '\\uFF47': 'g',\n '\\u01F5': 'g',\n '\\u011D': 'g',\n '\\u1E21': 'g',\n '\\u011F': 'g',\n '\\u0121': 'g',\n '\\u01E7': 'g',\n '\\u0123': 'g',\n '\\u01E5': 'g',\n '\\u0260': 'g',\n '\\uA7A1': 'g',\n '\\u1D79': 'g',\n '\\uA77F': 'g',\n '\\u24D7': 'h',\n '\\uFF48': 'h',\n '\\u0125': 'h',\n '\\u1E23': 'h',\n '\\u1E27': 'h',\n '\\u021F': 'h',\n '\\u1E25': 'h',\n '\\u1E29': 'h',\n '\\u1E2B': 'h',\n '\\u1E96': 'h',\n '\\u0127': 'h',\n '\\u2C68': 'h',\n '\\u2C76': 'h',\n '\\u0265': 'h',\n '\\u0195': 'hv',\n '\\u24D8': 'i',\n '\\uFF49': 'i',\n '\\u00EC': 'i',\n '\\u00ED': 'i',\n '\\u00EE': 'i',\n '\\u0129': 'i',\n '\\u012B': 'i',\n '\\u012D': 'i',\n '\\u00EF': 'i',\n '\\u1E2F': 'i',\n '\\u1EC9': 'i',\n '\\u01D0': 'i',\n '\\u0209': 'i',\n '\\u020B': 'i',\n '\\u1ECB': 'i',\n '\\u012F': 'i',\n '\\u1E2D': 'i',\n '\\u0268': 'i',\n '\\u0131': 'i',\n '\\u24D9': 'j',\n '\\uFF4A': 'j',\n '\\u0135': 'j',\n '\\u01F0': 'j',\n '\\u0249': 'j',\n '\\u24DA': 'k',\n '\\uFF4B': 'k',\n '\\u1E31': 'k',\n '\\u01E9': 'k',\n '\\u1E33': 'k',\n '\\u0137': 'k',\n '\\u1E35': 'k',\n '\\u0199': 'k',\n '\\u2C6A': 'k',\n '\\uA741': 'k',\n '\\uA743': 'k',\n '\\uA745': 'k',\n '\\uA7A3': 'k',\n '\\u24DB': 'l',\n '\\uFF4C': 'l',\n '\\u0140': 'l',\n '\\u013A': 'l',\n '\\u013E': 'l',\n '\\u1E37': 'l',\n '\\u1E39': 'l',\n '\\u013C': 'l',\n '\\u1E3D': 'l',\n '\\u1E3B': 'l',\n '\\u017F': 'l',\n '\\u0142': 'l',\n '\\u019A': 'l',\n '\\u026B': 'l',\n '\\u2C61': 'l',\n '\\uA749': 'l',\n '\\uA781': 'l',\n '\\uA747': 'l',\n '\\u01C9': 'lj',\n '\\u24DC': 'm',\n '\\uFF4D': 'm',\n '\\u1E3F': 'm',\n '\\u1E41': 'm',\n '\\u1E43': 'm',\n '\\u0271': 'm',\n '\\u026F': 'm',\n '\\u24DD': 'n',\n '\\uFF4E': 'n',\n '\\u01F9': 'n',\n '\\u0144': 'n',\n '\\u00F1': 'n',\n '\\u1E45': 'n',\n '\\u0148': 'n',\n '\\u1E47': 'n',\n '\\u0146': 'n',\n '\\u1E4B': 'n',\n '\\u1E49': 'n',\n '\\u019E': 'n',\n '\\u0272': 'n',\n '\\u0149': 'n',\n '\\uA791': 'n',\n '\\uA7A5': 'n',\n '\\u01CC': 'nj',\n '\\u24DE': 'o',\n '\\uFF4F': 'o',\n '\\u00F2': 'o',\n '\\u00F3': 'o',\n '\\u00F4': 'o',\n '\\u1ED3': 'o',\n '\\u1ED1': 'o',\n '\\u1ED7': 'o',\n '\\u1ED5': 'o',\n '\\u00F5': 'o',\n '\\u1E4D': 'o',\n '\\u022D': 'o',\n '\\u1E4F': 'o',\n '\\u014D': 'o',\n '\\u1E51': 'o',\n '\\u1E53': 'o',\n '\\u014F': 'o',\n '\\u022F': 'o',\n '\\u0231': 'o',\n '\\u00F6': 'o',\n '\\u022B': 'o',\n '\\u1ECF': 'o',\n '\\u0151': 'o',\n '\\u01D2': 'o',\n '\\u020D': 'o',\n '\\u020F': 'o',\n '\\u01A1': 'o',\n '\\u1EDD': 'o',\n '\\u1EDB': 'o',\n '\\u1EE1': 'o',\n '\\u1EDF': 'o',\n '\\u1EE3': 'o',\n '\\u1ECD': 'o',\n '\\u1ED9': 'o',\n '\\u01EB': 'o',\n '\\u01ED': 'o',\n '\\u00F8': 'o',\n '\\u01FF': 'o',\n '\\u0254': 'o',\n '\\uA74B': 'o',\n '\\uA74D': 'o',\n '\\u0275': 'o',\n '\\u0153': 'oe',\n '\\u01A3': 'oi',\n '\\u0223': 'ou',\n '\\uA74F': 'oo',\n '\\u24DF': 'p',\n '\\uFF50': 'p',\n '\\u1E55': 'p',\n '\\u1E57': 'p',\n '\\u01A5': 'p',\n '\\u1D7D': 'p',\n '\\uA751': 'p',\n '\\uA753': 'p',\n '\\uA755': 'p',\n '\\u24E0': 'q',\n '\\uFF51': 'q',\n '\\u024B': 'q',\n '\\uA757': 'q',\n '\\uA759': 'q',\n '\\u24E1': 'r',\n '\\uFF52': 'r',\n '\\u0155': 'r',\n '\\u1E59': 'r',\n '\\u0159': 'r',\n '\\u0211': 'r',\n '\\u0213': 'r',\n '\\u1E5B': 'r',\n '\\u1E5D': 'r',\n '\\u0157': 'r',\n '\\u1E5F': 'r',\n '\\u024D': 'r',\n '\\u027D': 'r',\n '\\uA75B': 'r',\n '\\uA7A7': 'r',\n '\\uA783': 'r',\n '\\u24E2': 's',\n '\\uFF53': 's',\n '\\u00DF': 's',\n '\\u015B': 's',\n '\\u1E65': 's',\n '\\u015D': 's',\n '\\u1E61': 's',\n '\\u0161': 's',\n '\\u1E67': 's',\n '\\u1E63': 's',\n '\\u1E69': 's',\n '\\u0219': 's',\n '\\u015F': 's',\n '\\u023F': 's',\n '\\uA7A9': 's',\n '\\uA785': 's',\n '\\u1E9B': 's',\n '\\u24E3': 't',\n '\\uFF54': 't',\n '\\u1E6B': 't',\n '\\u1E97': 't',\n '\\u0165': 't',\n '\\u1E6D': 't',\n '\\u021B': 't',\n '\\u0163': 't',\n '\\u1E71': 't',\n '\\u1E6F': 't',\n '\\u0167': 't',\n '\\u01AD': 't',\n '\\u0288': 't',\n '\\u2C66': 't',\n '\\uA787': 't',\n '\\uA729': 'tz',\n '\\u24E4': 'u',\n '\\uFF55': 'u',\n '\\u00F9': 'u',\n '\\u00FA': 'u',\n '\\u00FB': 'u',\n '\\u0169': 'u',\n '\\u1E79': 'u',\n '\\u016B': 'u',\n '\\u1E7B': 'u',\n '\\u016D': 'u',\n '\\u00FC': 'u',\n '\\u01DC': 'u',\n '\\u01D8': 'u',\n '\\u01D6': 'u',\n '\\u01DA': 'u',\n '\\u1EE7': 'u',\n '\\u016F': 'u',\n '\\u0171': 'u',\n '\\u01D4': 'u',\n '\\u0215': 'u',\n '\\u0217': 'u',\n '\\u01B0': 'u',\n '\\u1EEB': 'u',\n '\\u1EE9': 'u',\n '\\u1EEF': 'u',\n '\\u1EED': 'u',\n '\\u1EF1': 'u',\n '\\u1EE5': 'u',\n '\\u1E73': 'u',\n '\\u0173': 'u',\n '\\u1E77': 'u',\n '\\u1E75': 'u',\n '\\u0289': 'u',\n '\\u24E5': 'v',\n '\\uFF56': 'v',\n '\\u1E7D': 'v',\n '\\u1E7F': 'v',\n '\\u028B': 'v',\n '\\uA75F': 'v',\n '\\u028C': 'v',\n '\\uA761': 'vy',\n '\\u24E6': 'w',\n '\\uFF57': 'w',\n '\\u1E81': 'w',\n '\\u1E83': 'w',\n '\\u0175': 'w',\n '\\u1E87': 'w',\n '\\u1E85': 'w',\n '\\u1E98': 'w',\n '\\u1E89': 'w',\n '\\u2C73': 'w',\n '\\u24E7': 'x',\n '\\uFF58': 'x',\n '\\u1E8B': 'x',\n '\\u1E8D': 'x',\n '\\u24E8': 'y',\n '\\uFF59': 'y',\n '\\u1EF3': 'y',\n '\\u00FD': 'y',\n '\\u0177': 'y',\n '\\u1EF9': 'y',\n '\\u0233': 'y',\n '\\u1E8F': 'y',\n '\\u00FF': 'y',\n '\\u1EF7': 'y',\n '\\u1E99': 'y',\n '\\u1EF5': 'y',\n '\\u01B4': 'y',\n '\\u024F': 'y',\n '\\u1EFF': 'y',\n '\\u24E9': 'z',\n '\\uFF5A': 'z',\n '\\u017A': 'z',\n '\\u1E91': 'z',\n '\\u017C': 'z',\n '\\u017E': 'z',\n '\\u1E93': 'z',\n '\\u1E95': 'z',\n '\\u01B6': 'z',\n '\\u0225': 'z',\n '\\u0240': 'z',\n '\\u2C6C': 'z',\n '\\uA763': 'z',\n '\\u0386': '\\u0391',\n '\\u0388': '\\u0395',\n '\\u0389': '\\u0397',\n '\\u038A': '\\u0399',\n '\\u03AA': '\\u0399',\n '\\u038C': '\\u039F',\n '\\u038E': '\\u03A5',\n '\\u03AB': '\\u03A5',\n '\\u038F': '\\u03A9',\n '\\u03AC': '\\u03B1',\n '\\u03AD': '\\u03B5',\n '\\u03AE': '\\u03B7',\n '\\u03AF': '\\u03B9',\n '\\u03CA': '\\u03B9',\n '\\u0390': '\\u03B9',\n '\\u03CC': '\\u03BF',\n '\\u03CD': '\\u03C5',\n '\\u03CB': '\\u03C5',\n '\\u03B0': '\\u03C5',\n '\\u03CE': '\\u03C9',\n '\\u03C2': '\\u03C3',\n '\\u2019': '\\''\n };\n\n return diacritics;\n });\n\n S2.define('select2/data/base',[\n '../utils'\n ], function (Utils) {\n function BaseAdapter ($element, options) {\n BaseAdapter.__super__.constructor.call(this);\n }\n\n Utils.Extend(BaseAdapter, Utils.Observable);\n\n BaseAdapter.prototype.current = function (callback) {\n throw new Error('The `current` method must be defined in child classes.');\n };\n\n BaseAdapter.prototype.query = function (params, callback) {\n throw new Error('The `query` method must be defined in child classes.');\n };\n\n BaseAdapter.prototype.bind = function (container, $container) {\n // Can be implemented in subclasses\n };\n\n BaseAdapter.prototype.destroy = function () {\n // Can be implemented in subclasses\n };\n\n BaseAdapter.prototype.generateResultId = function (container, data) {\n var id = container.id + '-result-';\n\n id += Utils.generateChars(4);\n\n if (data.id != null) {\n id += '-' + data.id.toString();\n } else {\n id += '-' + Utils.generateChars(4);\n }\n return id;\n };\n\n return BaseAdapter;\n });\n\n S2.define('select2/data/select',[\n './base',\n '../utils',\n 'jquery'\n ], function (BaseAdapter, Utils, $) {\n function SelectAdapter ($element, options) {\n this.$element = $element;\n this.options = options;\n\n SelectAdapter.__super__.constructor.call(this);\n }\n\n Utils.Extend(SelectAdapter, BaseAdapter);\n\n SelectAdapter.prototype.current = function (callback) {\n var data = [];\n var self = this;\n\n this.$element.find(':selected').each(function () {\n var $option = $(this);\n\n var option = self.item($option);\n\n data.push(option);\n });\n\n callback(data);\n };\n\n SelectAdapter.prototype.select = function (data) {\n var self = this;\n\n data.selected = true;\n\n // If data.element is a DOM node, use it instead\n if ($(data.element).is('option')) {\n data.element.selected = true;\n\n this.$element.trigger('input').trigger('change');\n\n return;\n }\n\n if (this.$element.prop('multiple')) {\n this.current(function (currentData) {\n var val = [];\n\n data = [data];\n data.push.apply(data, currentData);\n\n for (var d = 0; d < data.length; d++) {\n var id = data[d].id;\n\n if ($.inArray(id, val) === -1) {\n val.push(id);\n }\n }\n\n self.$element.val(val);\n self.$element.trigger('input').trigger('change');\n });\n } else {\n var val = data.id;\n\n this.$element.val(val);\n this.$element.trigger('input').trigger('change');\n }\n };\n\n SelectAdapter.prototype.unselect = function (data) {\n var self = this;\n\n if (!this.$element.prop('multiple')) {\n return;\n }\n\n data.selected = false;\n\n if ($(data.element).is('option')) {\n data.element.selected = false;\n\n this.$element.trigger('input').trigger('change');\n\n return;\n }\n\n this.current(function (currentData) {\n var val = [];\n\n for (var d = 0; d < currentData.length; d++) {\n var id = currentData[d].id;\n\n if (id !== data.id && $.inArray(id, val) === -1) {\n val.push(id);\n }\n }\n\n self.$element.val(val);\n\n self.$element.trigger('input').trigger('change');\n });\n };\n\n SelectAdapter.prototype.bind = function (container, $container) {\n var self = this;\n\n this.container = container;\n\n container.on('select', function (params) {\n self.select(params.data);\n });\n\n container.on('unselect', function (params) {\n self.unselect(params.data);\n });\n };\n\n SelectAdapter.prototype.destroy = function () {\n // Remove anything added to child elements\n this.$element.find('*').each(function () {\n // Remove any custom data set by Select2\n Utils.RemoveData(this);\n });\n };\n\n SelectAdapter.prototype.query = function (params, callback) {\n var data = [];\n var self = this;\n\n var $options = this.$element.children();\n\n $options.each(function () {\n var $option = $(this);\n\n if (!$option.is('option') && !$option.is('optgroup')) {\n return;\n }\n\n var option = self.item($option);\n\n var matches = self.matches(params, option);\n\n if (matches !== null) {\n data.push(matches);\n }\n });\n\n callback({\n results: data\n });\n };\n\n SelectAdapter.prototype.addOptions = function ($options) {\n Utils.appendMany(this.$element, $options);\n };\n\n SelectAdapter.prototype.option = function (data) {\n var option;\n\n if (data.children) {\n option = document.createElement('optgroup');\n option.label = data.text;\n } else {\n option = document.createElement('option');\n\n if (option.textContent !== undefined) {\n option.textContent = data.text;\n } else {\n option.innerText = data.text;\n }\n }\n\n if (data.id !== undefined) {\n option.value = data.id;\n }\n\n if (data.disabled) {\n option.disabled = true;\n }\n\n if (data.selected) {\n option.selected = true;\n }\n\n if (data.title) {\n option.title = data.title;\n }\n\n var $option = $(option);\n\n var normalizedData = this._normalizeItem(data);\n normalizedData.element = option;\n\n // Override the option's data with the combined data\n Utils.StoreData(option, 'data', normalizedData);\n\n return $option;\n };\n\n SelectAdapter.prototype.item = function ($option) {\n var data = {};\n\n data = Utils.GetData($option[0], 'data');\n\n if (data != null) {\n return data;\n }\n\n if ($option.is('option')) {\n data = {\n id: $option.val(),\n text: $option.text(),\n disabled: $option.prop('disabled'),\n selected: $option.prop('selected'),\n title: $option.prop('title')\n };\n } else if ($option.is('optgroup')) {\n data = {\n text: $option.prop('label'),\n children: [],\n title: $option.prop('title')\n };\n\n var $children = $option.children('option');\n var children = [];\n\n for (var c = 0; c < $children.length; c++) {\n var $child = $($children[c]);\n\n var child = this.item($child);\n\n children.push(child);\n }\n\n data.children = children;\n }\n\n data = this._normalizeItem(data);\n data.element = $option[0];\n\n Utils.StoreData($option[0], 'data', data);\n\n return data;\n };\n\n SelectAdapter.prototype._normalizeItem = function (item) {\n if (item !== Object(item)) {\n item = {\n id: item,\n text: item\n };\n }\n\n item = $.extend({}, {\n text: ''\n }, item);\n\n var defaults = {\n selected: false,\n disabled: false\n };\n\n if (item.id != null) {\n item.id = item.id.toString();\n }\n\n if (item.text != null) {\n item.text = item.text.toString();\n }\n\n if (item._resultId == null && item.id && this.container != null) {\n item._resultId = this.generateResultId(this.container, item);\n }\n\n return $.extend({}, defaults, item);\n };\n\n SelectAdapter.prototype.matches = function (params, data) {\n var matcher = this.options.get('matcher');\n\n return matcher(params, data);\n };\n\n return SelectAdapter;\n });\n\n S2.define('select2/data/array',[\n './select',\n '../utils',\n 'jquery'\n ], function (SelectAdapter, Utils, $) {\n function ArrayAdapter ($element, options) {\n this._dataToConvert = options.get('data') || [];\n\n ArrayAdapter.__super__.constructor.call(this, $element, options);\n }\n\n Utils.Extend(ArrayAdapter, SelectAdapter);\n\n ArrayAdapter.prototype.bind = function (container, $container) {\n ArrayAdapter.__super__.bind.call(this, container, $container);\n\n this.addOptions(this.convertToOptions(this._dataToConvert));\n };\n\n ArrayAdapter.prototype.select = function (data) {\n var $option = this.$element.find('option').filter(function (i, elm) {\n return elm.value == data.id.toString();\n });\n\n if ($option.length === 0) {\n $option = this.option(data);\n\n this.addOptions($option);\n }\n\n ArrayAdapter.__super__.select.call(this, data);\n };\n\n ArrayAdapter.prototype.convertToOptions = function (data) {\n var self = this;\n\n var $existing = this.$element.find('option');\n var existingIds = $existing.map(function () {\n return self.item($(this)).id;\n }).get();\n\n var $options = [];\n\n // Filter out all items except for the one passed in the argument\n function onlyItem (item) {\n return function () {\n return $(this).val() == item.id;\n };\n }\n\n for (var d = 0; d < data.length; d++) {\n var item = this._normalizeItem(data[d]);\n\n // Skip items which were pre-loaded, only merge the data\n if ($.inArray(item.id, existingIds) >= 0) {\n var $existingOption = $existing.filter(onlyItem(item));\n\n var existingData = this.item($existingOption);\n var newData = $.extend(true, {}, item, existingData);\n\n var $newOption = this.option(newData);\n\n $existingOption.replaceWith($newOption);\n\n continue;\n }\n\n var $option = this.option(item);\n\n if (item.children) {\n var $children = this.convertToOptions(item.children);\n\n Utils.appendMany($option, $children);\n }\n\n $options.push($option);\n }\n\n return $options;\n };\n\n return ArrayAdapter;\n });\n\n S2.define('select2/data/ajax',[\n './array',\n '../utils',\n 'jquery'\n ], function (ArrayAdapter, Utils, $) {\n function AjaxAdapter ($element, options) {\n this.ajaxOptions = this._applyDefaults(options.get('ajax'));\n\n if (this.ajaxOptions.processResults != null) {\n this.processResults = this.ajaxOptions.processResults;\n }\n\n AjaxAdapter.__super__.constructor.call(this, $element, options);\n }\n\n Utils.Extend(AjaxAdapter, ArrayAdapter);\n\n AjaxAdapter.prototype._applyDefaults = function (options) {\n var defaults = {\n data: function (params) {\n return $.extend({}, params, {\n q: params.term\n });\n },\n transport: function (params, success, failure) {\n var $request = $.ajax(params);\n\n $request.then(success);\n $request.fail(failure);\n\n return $request;\n }\n };\n\n return $.extend({}, defaults, options, true);\n };\n\n AjaxAdapter.prototype.processResults = function (results) {\n return results;\n };\n\n AjaxAdapter.prototype.query = function (params, callback) {\n var matches = [];\n var self = this;\n\n if (this._request != null) {\n // JSONP requests cannot always be aborted\n if ($.isFunction(this._request.abort)) {\n this._request.abort();\n }\n\n this._request = null;\n }\n\n var options = $.extend({\n type: 'GET'\n }, this.ajaxOptions);\n\n if (typeof options.url === 'function') {\n options.url = options.url.call(this.$element, params);\n }\n\n if (typeof options.data === 'function') {\n options.data = options.data.call(this.$element, params);\n }\n\n function request () {\n var $request = options.transport(options, function (data) {\n var results = self.processResults(data, params);\n\n if (self.options.get('debug') && window.console && console.error) {\n // Check to make sure that the response included a `results` key.\n if (!results || !results.results || !$.isArray(results.results)) {\n console.error(\n 'Select2: The AJAX results did not return an array in the ' +\n '`results` key of the response.'\n );\n }\n }\n\n callback(results);\n }, function () {\n // Attempt to detect if a request was aborted\n // Only works if the transport exposes a status property\n if ('status' in $request &&\n ($request.status === 0 || $request.status === '0')) {\n return;\n }\n\n self.trigger('results:message', {\n message: 'errorLoading'\n });\n });\n\n self._request = $request;\n }\n\n if (this.ajaxOptions.delay && params.term != null) {\n if (this._queryTimeout) {\n window.clearTimeout(this._queryTimeout);\n }\n\n this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);\n } else {\n request();\n }\n };\n\n return AjaxAdapter;\n });\n\n S2.define('select2/data/tags',[\n 'jquery'\n ], function ($) {\n function Tags (decorated, $element, options) {\n var tags = options.get('tags');\n\n var createTag = options.get('createTag');\n\n if (createTag !== undefined) {\n this.createTag = createTag;\n }\n\n var insertTag = options.get('insertTag');\n\n if (insertTag !== undefined) {\n this.insertTag = insertTag;\n }\n\n decorated.call(this, $element, options);\n\n if ($.isArray(tags)) {\n for (var t = 0; t < tags.length; t++) {\n var tag = tags[t];\n var item = this._normalizeItem(tag);\n\n var $option = this.option(item);\n\n this.$element.append($option);\n }\n }\n }\n\n Tags.prototype.query = function (decorated, params, callback) {\n var self = this;\n\n this._removeOldTags();\n\n if (params.term == null || params.page != null) {\n decorated.call(this, params, callback);\n return;\n }\n\n function wrapper (obj, child) {\n var data = obj.results;\n\n for (var i = 0; i < data.length; i++) {\n var option = data[i];\n\n var checkChildren = (\n option.children != null &&\n !wrapper({\n results: option.children\n }, true)\n );\n\n var optionText = (option.text || '').toUpperCase();\n var paramsTerm = (params.term || '').toUpperCase();\n\n var checkText = optionText === paramsTerm;\n\n if (checkText || checkChildren) {\n if (child) {\n return false;\n }\n\n obj.data = data;\n callback(obj);\n\n return;\n }\n }\n\n if (child) {\n return true;\n }\n\n var tag = self.createTag(params);\n\n if (tag != null) {\n var $option = self.option(tag);\n $option.attr('data-select2-tag', true);\n\n self.addOptions([$option]);\n\n self.insertTag(data, tag);\n }\n\n obj.results = data;\n\n callback(obj);\n }\n\n decorated.call(this, params, wrapper);\n };\n\n Tags.prototype.createTag = function (decorated, params) {\n var term = $.trim(params.term);\n\n if (term === '') {\n return null;\n }\n\n return {\n id: term,\n text: term\n };\n };\n\n Tags.prototype.insertTag = function (_, data, tag) {\n data.unshift(tag);\n };\n\n Tags.prototype._removeOldTags = function (_) {\n var $options = this.$element.find('option[data-select2-tag]');\n\n $options.each(function () {\n if (this.selected) {\n return;\n }\n\n $(this).remove();\n });\n };\n\n return Tags;\n });\n\n S2.define('select2/data/tokenizer',[\n 'jquery'\n ], function ($) {\n function Tokenizer (decorated, $element, options) {\n var tokenizer = options.get('tokenizer');\n\n if (tokenizer !== undefined) {\n this.tokenizer = tokenizer;\n }\n\n decorated.call(this, $element, options);\n }\n\n Tokenizer.prototype.bind = function (decorated, container, $container) {\n decorated.call(this, container, $container);\n\n this.$search = container.dropdown.$search || container.selection.$search ||\n $container.find('.select2-search__field');\n };\n\n Tokenizer.prototype.query = function (decorated, params, callback) {\n var self = this;\n\n function createAndSelect (data) {\n // Normalize the data object so we can use it for checks\n var item = self._normalizeItem(data);\n\n // Check if the data object already exists as a tag\n // Select it if it doesn't\n var $existingOptions = self.$element.find('option').filter(function () {\n return $(this).val() === item.id;\n });\n\n // If an existing option wasn't found for it, create the option\n if (!$existingOptions.length) {\n var $option = self.option(item);\n $option.attr('data-select2-tag', true);\n\n self._removeOldTags();\n self.addOptions([$option]);\n }\n\n // Select the item, now that we know there is an option for it\n select(item);\n }\n\n function select (data) {\n self.trigger('select', {\n data: data\n });\n }\n\n params.term = params.term || '';\n\n var tokenData = this.tokenizer(params, this.options, createAndSelect);\n\n if (tokenData.term !== params.term) {\n // Replace the search term if we have the search box\n if (this.$search.length) {\n this.$search.val(tokenData.term);\n this.$search.trigger('focus');\n }\n\n params.term = tokenData.term;\n }\n\n decorated.call(this, params, callback);\n };\n\n Tokenizer.prototype.tokenizer = function (_, params, options, callback) {\n var separators = options.get('tokenSeparators') || [];\n var term = params.term;\n var i = 0;\n\n var createTag = this.createTag || function (params) {\n return {\n id: params.term,\n text: params.term\n };\n };\n\n while (i < term.length) {\n var termChar = term[i];\n\n if ($.inArray(termChar, separators) === -1) {\n i++;\n\n continue;\n }\n\n var part = term.substr(0, i);\n var partParams = $.extend({}, params, {\n term: part\n });\n\n var data = createTag(partParams);\n\n if (data == null) {\n i++;\n continue;\n }\n\n callback(data);\n\n // Reset the term to not include the tokenized portion\n term = term.substr(i + 1) || '';\n i = 0;\n }\n\n return {\n term: term\n };\n };\n\n return Tokenizer;\n });\n\n S2.define('select2/data/minimumInputLength',[\n\n ], function () {\n function MinimumInputLength (decorated, $e, options) {\n this.minimumInputLength = options.get('minimumInputLength');\n\n decorated.call(this, $e, options);\n }\n\n MinimumInputLength.prototype.query = function (decorated, params, callback) {\n params.term = params.term || '';\n\n if (params.term.length < this.minimumInputLength) {\n this.trigger('results:message', {\n message: 'inputTooShort',\n args: {\n minimum: this.minimumInputLength,\n input: params.term,\n params: params\n }\n });\n\n return;\n }\n\n decorated.call(this, params, callback);\n };\n\n return MinimumInputLength;\n });\n\n S2.define('select2/data/maximumInputLength',[\n\n ], function () {\n function MaximumInputLength (decorated, $e, options) {\n this.maximumInputLength = options.get('maximumInputLength');\n\n decorated.call(this, $e, options);\n }\n\n MaximumInputLength.prototype.query = function (decorated, params, callback) {\n params.term = params.term || '';\n\n if (this.maximumInputLength > 0 &&\n params.term.length > this.maximumInputLength) {\n this.trigger('results:message', {\n message: 'inputTooLong',\n args: {\n maximum: this.maximumInputLength,\n input: params.term,\n params: params\n }\n });\n\n return;\n }\n\n decorated.call(this, params, callback);\n };\n\n return MaximumInputLength;\n });\n\n S2.define('select2/data/maximumSelectionLength',[\n\n ], function (){\n function MaximumSelectionLength (decorated, $e, options) {\n this.maximumSelectionLength = options.get('maximumSelectionLength');\n\n decorated.call(this, $e, options);\n }\n\n MaximumSelectionLength.prototype.bind =\n function (decorated, container, $container) {\n var self = this;\n\n decorated.call(this, container, $container);\n\n container.on('select', function () {\n self._checkIfMaximumSelected();\n });\n };\n\n MaximumSelectionLength.prototype.query =\n function (decorated, params, callback) {\n var self = this;\n\n this._checkIfMaximumSelected(function () {\n decorated.call(self, params, callback);\n });\n };\n\n MaximumSelectionLength.prototype._checkIfMaximumSelected =\n function (_, successCallback) {\n var self = this;\n\n this.current(function (currentData) {\n var count = currentData != null ? currentData.length : 0;\n if (self.maximumSelectionLength > 0 &&\n count >= self.maximumSelectionLength) {\n self.trigger('results:message', {\n message: 'maximumSelected',\n args: {\n maximum: self.maximumSelectionLength\n }\n });\n return;\n }\n\n if (successCallback) {\n successCallback();\n }\n });\n };\n\n return MaximumSelectionLength;\n });\n\n S2.define('select2/dropdown',[\n 'jquery',\n './utils'\n ], function ($, Utils) {\n function Dropdown ($element, options) {\n this.$element = $element;\n this.options = options;\n\n Dropdown.__super__.constructor.call(this);\n }\n\n Utils.Extend(Dropdown, Utils.Observable);\n\n Dropdown.prototype.render = function () {\n var $dropdown = $(\n '' +\n '' +\n ''\n );\n\n $dropdown.attr('dir', this.options.get('dir'));\n\n this.$dropdown = $dropdown;\n\n return $dropdown;\n };\n\n Dropdown.prototype.bind = function () {\n // Should be implemented in subclasses\n };\n\n Dropdown.prototype.position = function ($dropdown, $container) {\n // Should be implemented in subclasses\n };\n\n Dropdown.prototype.destroy = function () {\n // Remove the dropdown from the DOM\n this.$dropdown.remove();\n };\n\n return Dropdown;\n });\n\n S2.define('select2/dropdown/search',[\n 'jquery',\n '../utils'\n ], function ($, Utils) {\n function Search () { }\n\n Search.prototype.render = function (decorated) {\n var $rendered = decorated.call(this);\n\n var $search = $(\n '' +\n '' +\n ''\n );\n\n this.$searchContainer = $search;\n this.$search = $search.find('input');\n\n $rendered.prepend($search);\n\n return $rendered;\n };\n\n Search.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n var resultsId = container.id + '-results';\n\n decorated.call(this, container, $container);\n\n this.$search.on('keydown', function (evt) {\n self.trigger('keypress', evt);\n\n self._keyUpPrevented = evt.isDefaultPrevented();\n });\n\n // Workaround for browsers which do not support the `input` event\n // This will prevent double-triggering of events for browsers which support\n // both the `keyup` and `input` events.\n this.$search.on('input', function (evt) {\n // Unbind the duplicated `keyup` event\n $(this).off('keyup');\n });\n\n this.$search.on('keyup input', function (evt) {\n self.handleSearch(evt);\n });\n\n container.on('open', function () {\n self.$search.attr('tabindex', 0);\n self.$search.attr('aria-controls', resultsId);\n\n self.$search.trigger('focus');\n\n window.setTimeout(function () {\n self.$search.trigger('focus');\n }, 0);\n });\n\n container.on('close', function () {\n self.$search.attr('tabindex', -1);\n self.$search.removeAttr('aria-controls');\n self.$search.removeAttr('aria-activedescendant');\n\n self.$search.val('');\n self.$search.trigger('blur');\n });\n\n container.on('focus', function () {\n if (!container.isOpen()) {\n self.$search.trigger('focus');\n }\n });\n\n container.on('results:all', function (params) {\n if (params.query.term == null || params.query.term === '') {\n var showSearch = self.showSearch(params);\n\n if (showSearch) {\n self.$searchContainer.removeClass('select2-search--hide');\n } else {\n self.$searchContainer.addClass('select2-search--hide');\n }\n }\n });\n\n container.on('results:focus', function (params) {\n if (params.data._resultId) {\n self.$search.attr('aria-activedescendant', params.data._resultId);\n } else {\n self.$search.removeAttr('aria-activedescendant');\n }\n });\n };\n\n Search.prototype.handleSearch = function (evt) {\n if (!this._keyUpPrevented) {\n var input = this.$search.val();\n\n this.trigger('query', {\n term: input\n });\n }\n\n this._keyUpPrevented = false;\n };\n\n Search.prototype.showSearch = function (_, params) {\n return true;\n };\n\n return Search;\n });\n\n S2.define('select2/dropdown/hidePlaceholder',[\n\n ], function () {\n function HidePlaceholder (decorated, $element, options, dataAdapter) {\n this.placeholder = this.normalizePlaceholder(options.get('placeholder'));\n\n decorated.call(this, $element, options, dataAdapter);\n }\n\n HidePlaceholder.prototype.append = function (decorated, data) {\n data.results = this.removePlaceholder(data.results);\n\n decorated.call(this, data);\n };\n\n HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {\n if (typeof placeholder === 'string') {\n placeholder = {\n id: '',\n text: placeholder\n };\n }\n\n return placeholder;\n };\n\n HidePlaceholder.prototype.removePlaceholder = function (_, data) {\n var modifiedData = data.slice(0);\n\n for (var d = data.length - 1; d >= 0; d--) {\n var item = data[d];\n\n if (this.placeholder.id === item.id) {\n modifiedData.splice(d, 1);\n }\n }\n\n return modifiedData;\n };\n\n return HidePlaceholder;\n });\n\n S2.define('select2/dropdown/infiniteScroll',[\n 'jquery'\n ], function ($) {\n function InfiniteScroll (decorated, $element, options, dataAdapter) {\n this.lastParams = {};\n\n decorated.call(this, $element, options, dataAdapter);\n\n this.$loadingMore = this.createLoadingMore();\n this.loading = false;\n }\n\n InfiniteScroll.prototype.append = function (decorated, data) {\n this.$loadingMore.remove();\n this.loading = false;\n\n decorated.call(this, data);\n\n if (this.showLoadingMore(data)) {\n this.$results.append(this.$loadingMore);\n this.loadMoreIfNeeded();\n }\n };\n\n InfiniteScroll.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n decorated.call(this, container, $container);\n\n container.on('query', function (params) {\n self.lastParams = params;\n self.loading = true;\n });\n\n container.on('query:append', function (params) {\n self.lastParams = params;\n self.loading = true;\n });\n\n this.$results.on('scroll', this.loadMoreIfNeeded.bind(this));\n };\n\n InfiniteScroll.prototype.loadMoreIfNeeded = function () {\n var isLoadMoreVisible = $.contains(\n document.documentElement,\n this.$loadingMore[0]\n );\n\n if (this.loading || !isLoadMoreVisible) {\n return;\n }\n\n var currentOffset = this.$results.offset().top +\n this.$results.outerHeight(false);\n var loadingMoreOffset = this.$loadingMore.offset().top +\n this.$loadingMore.outerHeight(false);\n\n if (currentOffset + 50 >= loadingMoreOffset) {\n this.loadMore();\n }\n };\n\n InfiniteScroll.prototype.loadMore = function () {\n this.loading = true;\n\n var params = $.extend({}, {page: 1}, this.lastParams);\n\n params.page++;\n\n this.trigger('query:append', params);\n };\n\n InfiniteScroll.prototype.showLoadingMore = function (_, data) {\n return data.pagination && data.pagination.more;\n };\n\n InfiniteScroll.prototype.createLoadingMore = function () {\n var $option = $(\n ''\n );\n\n var message = this.options.get('translations').get('loadingMore');\n\n $option.html(message(this.lastParams));\n\n return $option;\n };\n\n return InfiniteScroll;\n });\n\n S2.define('select2/dropdown/attachBody',[\n 'jquery',\n '../utils'\n ], function ($, Utils) {\n function AttachBody (decorated, $element, options) {\n this.$dropdownParent = $(options.get('dropdownParent') || document.body);\n\n decorated.call(this, $element, options);\n }\n\n AttachBody.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n decorated.call(this, container, $container);\n\n container.on('open', function () {\n self._showDropdown();\n self._attachPositioningHandler(container);\n\n // Must bind after the results handlers to ensure correct sizing\n self._bindContainerResultHandlers(container);\n });\n\n container.on('close', function () {\n self._hideDropdown();\n self._detachPositioningHandler(container);\n });\n\n this.$dropdownContainer.on('mousedown', function (evt) {\n evt.stopPropagation();\n });\n };\n\n AttachBody.prototype.destroy = function (decorated) {\n decorated.call(this);\n\n this.$dropdownContainer.remove();\n };\n\n AttachBody.prototype.position = function (decorated, $dropdown, $container) {\n // Clone all of the container classes\n $dropdown.attr('class', $container.attr('class'));\n\n $dropdown.removeClass('select2');\n $dropdown.addClass('select2-container--open');\n\n $dropdown.css({\n position: 'absolute',\n top: -999999\n });\n\n this.$container = $container;\n };\n\n AttachBody.prototype.render = function (decorated) {\n var $container = $('');\n\n var $dropdown = decorated.call(this);\n $container.append($dropdown);\n\n this.$dropdownContainer = $container;\n\n return $container;\n };\n\n AttachBody.prototype._hideDropdown = function (decorated) {\n this.$dropdownContainer.detach();\n };\n\n AttachBody.prototype._bindContainerResultHandlers =\n function (decorated, container) {\n\n // These should only be bound once\n if (this._containerResultsHandlersBound) {\n return;\n }\n\n var self = this;\n\n container.on('results:all', function () {\n self._positionDropdown();\n self._resizeDropdown();\n });\n\n container.on('results:append', function () {\n self._positionDropdown();\n self._resizeDropdown();\n });\n\n container.on('results:message', function () {\n self._positionDropdown();\n self._resizeDropdown();\n });\n\n container.on('select', function () {\n self._positionDropdown();\n self._resizeDropdown();\n });\n\n container.on('unselect', function () {\n self._positionDropdown();\n self._resizeDropdown();\n });\n\n this._containerResultsHandlersBound = true;\n };\n\n AttachBody.prototype._attachPositioningHandler =\n function (decorated, container) {\n var self = this;\n\n var scrollEvent = 'scroll.select2.' + container.id;\n var resizeEvent = 'resize.select2.' + container.id;\n var orientationEvent = 'orientationchange.select2.' + container.id;\n\n var $watchers = this.$container.parents().filter(Utils.hasScroll);\n $watchers.each(function () {\n Utils.StoreData(this, 'select2-scroll-position', {\n x: $(this).scrollLeft(),\n y: $(this).scrollTop()\n });\n });\n\n $watchers.on(scrollEvent, function (ev) {\n var position = Utils.GetData(this, 'select2-scroll-position');\n $(this).scrollTop(position.y);\n });\n\n $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,\n function (e) {\n self._positionDropdown();\n self._resizeDropdown();\n });\n };\n\n AttachBody.prototype._detachPositioningHandler =\n function (decorated, container) {\n var scrollEvent = 'scroll.select2.' + container.id;\n var resizeEvent = 'resize.select2.' + container.id;\n var orientationEvent = 'orientationchange.select2.' + container.id;\n\n var $watchers = this.$container.parents().filter(Utils.hasScroll);\n $watchers.off(scrollEvent);\n\n $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);\n };\n\n AttachBody.prototype._positionDropdown = function () {\n var $window = $(window);\n\n var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');\n var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');\n\n var newDirection = null;\n\n var offset = this.$container.offset();\n\n offset.bottom = offset.top + this.$container.outerHeight(false);\n\n var container = {\n height: this.$container.outerHeight(false)\n };\n\n container.top = offset.top;\n container.bottom = offset.top + container.height;\n\n var dropdown = {\n height: this.$dropdown.outerHeight(false)\n };\n\n var viewport = {\n top: $window.scrollTop(),\n bottom: $window.scrollTop() + $window.height()\n };\n\n var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);\n var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);\n\n var css = {\n left: offset.left,\n top: container.bottom\n };\n\n // Determine what the parent element is to use for calculating the offset\n var $offsetParent = this.$dropdownParent;\n\n // For statically positioned elements, we need to get the element\n // that is determining the offset\n if ($offsetParent.css('position') === 'static') {\n $offsetParent = $offsetParent.offsetParent();\n }\n\n var parentOffset = {\n top: 0,\n left: 0\n };\n\n if (\n $.contains(document.body, $offsetParent[0]) ||\n $offsetParent[0].isConnected\n ) {\n parentOffset = $offsetParent.offset();\n }\n\n css.top -= parentOffset.top;\n css.left -= parentOffset.left;\n\n if (!isCurrentlyAbove && !isCurrentlyBelow) {\n newDirection = 'below';\n }\n\n if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {\n newDirection = 'above';\n } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {\n newDirection = 'below';\n }\n\n if (newDirection == 'above' ||\n (isCurrentlyAbove && newDirection !== 'below')) {\n css.top = container.top - parentOffset.top - dropdown.height;\n }\n\n if (newDirection != null) {\n this.$dropdown\n .removeClass('select2-dropdown--below select2-dropdown--above')\n .addClass('select2-dropdown--' + newDirection);\n this.$container\n .removeClass('select2-container--below select2-container--above')\n .addClass('select2-container--' + newDirection);\n }\n\n this.$dropdownContainer.css(css);\n };\n\n AttachBody.prototype._resizeDropdown = function () {\n var css = {\n width: this.$container.outerWidth(false) + 'px'\n };\n\n if (this.options.get('dropdownAutoWidth')) {\n css.minWidth = css.width;\n css.position = 'relative';\n css.width = 'auto';\n }\n\n this.$dropdown.css(css);\n };\n\n AttachBody.prototype._showDropdown = function (decorated) {\n this.$dropdownContainer.appendTo(this.$dropdownParent);\n\n this._positionDropdown();\n this._resizeDropdown();\n };\n\n return AttachBody;\n });\n\n S2.define('select2/dropdown/minimumResultsForSearch',[\n\n ], function () {\n function countResults (data) {\n var count = 0;\n\n for (var d = 0; d < data.length; d++) {\n var item = data[d];\n\n if (item.children) {\n count += countResults(item.children);\n } else {\n count++;\n }\n }\n\n return count;\n }\n\n function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {\n this.minimumResultsForSearch = options.get('minimumResultsForSearch');\n\n if (this.minimumResultsForSearch < 0) {\n this.minimumResultsForSearch = Infinity;\n }\n\n decorated.call(this, $element, options, dataAdapter);\n }\n\n MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {\n if (countResults(params.data.results) < this.minimumResultsForSearch) {\n return false;\n }\n\n return decorated.call(this, params);\n };\n\n return MinimumResultsForSearch;\n });\n\n S2.define('select2/dropdown/selectOnClose',[\n '../utils'\n ], function (Utils) {\n function SelectOnClose () { }\n\n SelectOnClose.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n decorated.call(this, container, $container);\n\n container.on('close', function (params) {\n self._handleSelectOnClose(params);\n });\n };\n\n SelectOnClose.prototype._handleSelectOnClose = function (_, params) {\n if (params && params.originalSelect2Event != null) {\n var event = params.originalSelect2Event;\n\n // Don't select an item if the close event was triggered from a select or\n // unselect event\n if (event._type === 'select' || event._type === 'unselect') {\n return;\n }\n }\n\n var $highlightedResults = this.getHighlightedResults();\n\n // Only select highlighted results\n if ($highlightedResults.length < 1) {\n return;\n }\n\n var data = Utils.GetData($highlightedResults[0], 'data');\n\n // Don't re-select already selected resulte\n if (\n (data.element != null && data.element.selected) ||\n (data.element == null && data.selected)\n ) {\n return;\n }\n\n this.trigger('select', {\n data: data\n });\n };\n\n return SelectOnClose;\n });\n\n S2.define('select2/dropdown/closeOnSelect',[\n\n ], function () {\n function CloseOnSelect () { }\n\n CloseOnSelect.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n decorated.call(this, container, $container);\n\n container.on('select', function (evt) {\n self._selectTriggered(evt);\n });\n\n container.on('unselect', function (evt) {\n self._selectTriggered(evt);\n });\n };\n\n CloseOnSelect.prototype._selectTriggered = function (_, evt) {\n var originalEvent = evt.originalEvent;\n\n // Don't close if the control key is being held\n if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) {\n return;\n }\n\n this.trigger('close', {\n originalEvent: originalEvent,\n originalSelect2Event: evt\n });\n };\n\n return CloseOnSelect;\n });\n\n S2.define('select2/i18n/en',[],function () {\n // English\n return {\n errorLoading: function () {\n return 'The results could not be loaded.';\n },\n inputTooLong: function (args) {\n var overChars = args.input.length - args.maximum;\n\n var message = 'Please delete ' + overChars + ' character';\n\n if (overChars != 1) {\n message += 's';\n }\n\n return message;\n },\n inputTooShort: function (args) {\n var remainingChars = args.minimum - args.input.length;\n\n var message = 'Please enter ' + remainingChars + ' or more characters';\n\n return message;\n },\n loadingMore: function () {\n return 'Loading more results…';\n },\n maximumSelected: function (args) {\n var message = 'You can only select ' + args.maximum + ' item';\n\n if (args.maximum != 1) {\n message += 's';\n }\n\n return message;\n },\n noResults: function () {\n return 'No results found';\n },\n searching: function () {\n return 'Searching…';\n },\n removeAllItems: function () {\n return 'Remove all items';\n }\n };\n });\n\n S2.define('select2/defaults',[\n 'jquery',\n 'require',\n\n './results',\n\n './selection/single',\n './selection/multiple',\n './selection/placeholder',\n './selection/allowClear',\n './selection/search',\n './selection/eventRelay',\n\n './utils',\n './translation',\n './diacritics',\n\n './data/select',\n './data/array',\n './data/ajax',\n './data/tags',\n './data/tokenizer',\n './data/minimumInputLength',\n './data/maximumInputLength',\n './data/maximumSelectionLength',\n\n './dropdown',\n './dropdown/search',\n './dropdown/hidePlaceholder',\n './dropdown/infiniteScroll',\n './dropdown/attachBody',\n './dropdown/minimumResultsForSearch',\n './dropdown/selectOnClose',\n './dropdown/closeOnSelect',\n\n './i18n/en'\n ], function ($, require,\n\n ResultsList,\n\n SingleSelection, MultipleSelection, Placeholder, AllowClear,\n SelectionSearch, EventRelay,\n\n Utils, Translation, DIACRITICS,\n\n SelectData, ArrayData, AjaxData, Tags, Tokenizer,\n MinimumInputLength, MaximumInputLength, MaximumSelectionLength,\n\n Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,\n AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,\n\n EnglishTranslation) {\n function Defaults () {\n this.reset();\n }\n\n Defaults.prototype.apply = function (options) {\n options = $.extend(true, {}, this.defaults, options);\n\n if (options.dataAdapter == null) {\n if (options.ajax != null) {\n options.dataAdapter = AjaxData;\n } else if (options.data != null) {\n options.dataAdapter = ArrayData;\n } else {\n options.dataAdapter = SelectData;\n }\n\n if (options.minimumInputLength > 0) {\n options.dataAdapter = Utils.Decorate(\n options.dataAdapter,\n MinimumInputLength\n );\n }\n\n if (options.maximumInputLength > 0) {\n options.dataAdapter = Utils.Decorate(\n options.dataAdapter,\n MaximumInputLength\n );\n }\n\n if (options.maximumSelectionLength > 0) {\n options.dataAdapter = Utils.Decorate(\n options.dataAdapter,\n MaximumSelectionLength\n );\n }\n\n if (options.tags) {\n options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);\n }\n\n if (options.tokenSeparators != null || options.tokenizer != null) {\n options.dataAdapter = Utils.Decorate(\n options.dataAdapter,\n Tokenizer\n );\n }\n\n if (options.query != null) {\n var Query = require(options.amdBase + 'compat/query');\n\n options.dataAdapter = Utils.Decorate(\n options.dataAdapter,\n Query\n );\n }\n\n if (options.initSelection != null) {\n var InitSelection = require(options.amdBase + 'compat/initSelection');\n\n options.dataAdapter = Utils.Decorate(\n options.dataAdapter,\n InitSelection\n );\n }\n }\n\n if (options.resultsAdapter == null) {\n options.resultsAdapter = ResultsList;\n\n if (options.ajax != null) {\n options.resultsAdapter = Utils.Decorate(\n options.resultsAdapter,\n InfiniteScroll\n );\n }\n\n if (options.placeholder != null) {\n options.resultsAdapter = Utils.Decorate(\n options.resultsAdapter,\n HidePlaceholder\n );\n }\n\n if (options.selectOnClose) {\n options.resultsAdapter = Utils.Decorate(\n options.resultsAdapter,\n SelectOnClose\n );\n }\n }\n\n if (options.dropdownAdapter == null) {\n if (options.multiple) {\n options.dropdownAdapter = Dropdown;\n } else {\n var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);\n\n options.dropdownAdapter = SearchableDropdown;\n }\n\n if (options.minimumResultsForSearch !== 0) {\n options.dropdownAdapter = Utils.Decorate(\n options.dropdownAdapter,\n MinimumResultsForSearch\n );\n }\n\n if (options.closeOnSelect) {\n options.dropdownAdapter = Utils.Decorate(\n options.dropdownAdapter,\n CloseOnSelect\n );\n }\n\n if (\n options.dropdownCssClass != null ||\n options.dropdownCss != null ||\n options.adaptDropdownCssClass != null\n ) {\n var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');\n\n options.dropdownAdapter = Utils.Decorate(\n options.dropdownAdapter,\n DropdownCSS\n );\n }\n\n options.dropdownAdapter = Utils.Decorate(\n options.dropdownAdapter,\n AttachBody\n );\n }\n\n if (options.selectionAdapter == null) {\n if (options.multiple) {\n options.selectionAdapter = MultipleSelection;\n } else {\n options.selectionAdapter = SingleSelection;\n }\n\n // Add the placeholder mixin if a placeholder was specified\n if (options.placeholder != null) {\n options.selectionAdapter = Utils.Decorate(\n options.selectionAdapter,\n Placeholder\n );\n }\n\n if (options.allowClear) {\n options.selectionAdapter = Utils.Decorate(\n options.selectionAdapter,\n AllowClear\n );\n }\n\n if (options.multiple) {\n options.selectionAdapter = Utils.Decorate(\n options.selectionAdapter,\n SelectionSearch\n );\n }\n\n if (\n options.containerCssClass != null ||\n options.containerCss != null ||\n options.adaptContainerCssClass != null\n ) {\n var ContainerCSS = require(options.amdBase + 'compat/containerCss');\n\n options.selectionAdapter = Utils.Decorate(\n options.selectionAdapter,\n ContainerCSS\n );\n }\n\n options.selectionAdapter = Utils.Decorate(\n options.selectionAdapter,\n EventRelay\n );\n }\n\n // If the defaults were not previously applied from an element, it is\n // possible for the language option to have not been resolved\n options.language = this._resolveLanguage(options.language);\n\n // Always fall back to English since it will always be complete\n options.language.push('en');\n\n var uniqueLanguages = [];\n\n for (var l = 0; l < options.language.length; l++) {\n var language = options.language[l];\n\n if (uniqueLanguages.indexOf(language) === -1) {\n uniqueLanguages.push(language);\n }\n }\n\n options.language = uniqueLanguages;\n\n options.translations = this._processTranslations(\n options.language,\n options.debug\n );\n\n return options;\n };\n\n Defaults.prototype.reset = function () {\n function stripDiacritics (text) {\n // Used 'uni range + named function' from http://jsperf.com/diacritics/18\n function match(a) {\n return DIACRITICS[a] || a;\n }\n\n return text.replace(/[^\\u0000-\\u007E]/g, match);\n }\n\n function matcher (params, data) {\n // Always return the object if there is nothing to compare\n if ($.trim(params.term) === '') {\n return data;\n }\n\n // Do a recursive check for options with children\n if (data.children && data.children.length > 0) {\n // Clone the data object if there are children\n // This is required as we modify the object to remove any non-matches\n var match = $.extend(true, {}, data);\n\n // Check each child of the option\n for (var c = data.children.length - 1; c >= 0; c--) {\n var child = data.children[c];\n\n var matches = matcher(params, child);\n\n // If there wasn't a match, remove the object in the array\n if (matches == null) {\n match.children.splice(c, 1);\n }\n }\n\n // If any children matched, return the new object\n if (match.children.length > 0) {\n return match;\n }\n\n // If there were no matching children, check just the plain object\n return matcher(params, match);\n }\n\n var original = stripDiacritics(data.text).toUpperCase();\n var term = stripDiacritics(params.term).toUpperCase();\n\n // Check if the text contains the term\n if (original.indexOf(term) > -1) {\n return data;\n }\n\n // If it doesn't contain the term, don't return anything\n return null;\n }\n\n this.defaults = {\n amdBase: './',\n amdLanguageBase: './i18n/',\n closeOnSelect: true,\n debug: false,\n dropdownAutoWidth: false,\n escapeMarkup: Utils.escapeMarkup,\n language: {},\n matcher: matcher,\n minimumInputLength: 0,\n maximumInputLength: 0,\n maximumSelectionLength: 0,\n minimumResultsForSearch: 0,\n selectOnClose: false,\n scrollAfterSelect: false,\n sorter: function (data) {\n return data;\n },\n templateResult: function (result) {\n return result.text;\n },\n templateSelection: function (selection) {\n return selection.text;\n },\n theme: 'default',\n width: 'resolve'\n };\n };\n\n Defaults.prototype.applyFromElement = function (options, $element) {\n var optionLanguage = options.language;\n var defaultLanguage = this.defaults.language;\n var elementLanguage = $element.prop('lang');\n var parentLanguage = $element.closest('[lang]').prop('lang');\n\n var languages = Array.prototype.concat.call(\n this._resolveLanguage(elementLanguage),\n this._resolveLanguage(optionLanguage),\n this._resolveLanguage(defaultLanguage),\n this._resolveLanguage(parentLanguage)\n );\n\n options.language = languages;\n\n return options;\n };\n\n Defaults.prototype._resolveLanguage = function (language) {\n if (!language) {\n return [];\n }\n\n if ($.isEmptyObject(language)) {\n return [];\n }\n\n if ($.isPlainObject(language)) {\n return [language];\n }\n\n var languages;\n\n if (!$.isArray(language)) {\n languages = [language];\n } else {\n languages = language;\n }\n\n var resolvedLanguages = [];\n\n for (var l = 0; l < languages.length; l++) {\n resolvedLanguages.push(languages[l]);\n\n if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) {\n // Extract the region information if it is included\n var languageParts = languages[l].split('-');\n var baseLanguage = languageParts[0];\n\n resolvedLanguages.push(baseLanguage);\n }\n }\n\n return resolvedLanguages;\n };\n\n Defaults.prototype._processTranslations = function (languages, debug) {\n var translations = new Translation();\n\n for (var l = 0; l < languages.length; l++) {\n var languageData = new Translation();\n\n var language = languages[l];\n\n if (typeof language === 'string') {\n try {\n // Try to load it with the original name\n languageData = Translation.loadPath(language);\n } catch (e) {\n try {\n // If we couldn't load it, check if it wasn't the full path\n language = this.defaults.amdLanguageBase + language;\n languageData = Translation.loadPath(language);\n } catch (ex) {\n // The translation could not be loaded at all. Sometimes this is\n // because of a configuration problem, other times this can be\n // because of how Select2 helps load all possible translation files\n if (debug && window.console && console.warn) {\n console.warn(\n 'Select2: The language file for \"' + language + '\" could ' +\n 'not be automatically loaded. A fallback will be used instead.'\n );\n }\n }\n }\n } else if ($.isPlainObject(language)) {\n languageData = new Translation(language);\n } else {\n languageData = language;\n }\n\n translations.extend(languageData);\n }\n\n return translations;\n };\n\n Defaults.prototype.set = function (key, value) {\n var camelKey = $.camelCase(key);\n\n var data = {};\n data[camelKey] = value;\n\n var convertedData = Utils._convertData(data);\n\n $.extend(true, this.defaults, convertedData);\n };\n\n var defaults = new Defaults();\n\n return defaults;\n });\n\n S2.define('select2/options',[\n 'require',\n 'jquery',\n './defaults',\n './utils'\n ], function (require, $, Defaults, Utils) {\n function Options (options, $element) {\n this.options = options;\n\n if ($element != null) {\n this.fromElement($element);\n }\n\n if ($element != null) {\n this.options = Defaults.applyFromElement(this.options, $element);\n }\n\n this.options = Defaults.apply(this.options);\n\n if ($element && $element.is('input')) {\n var InputCompat = require(this.get('amdBase') + 'compat/inputData');\n\n this.options.dataAdapter = Utils.Decorate(\n this.options.dataAdapter,\n InputCompat\n );\n }\n }\n\n Options.prototype.fromElement = function ($e) {\n var excludedData = ['select2'];\n\n if (this.options.multiple == null) {\n this.options.multiple = $e.prop('multiple');\n }\n\n if (this.options.disabled == null) {\n this.options.disabled = $e.prop('disabled');\n }\n\n if (this.options.dir == null) {\n if ($e.prop('dir')) {\n this.options.dir = $e.prop('dir');\n } else if ($e.closest('[dir]').prop('dir')) {\n this.options.dir = $e.closest('[dir]').prop('dir');\n } else {\n this.options.dir = 'ltr';\n }\n }\n\n $e.prop('disabled', this.options.disabled);\n $e.prop('multiple', this.options.multiple);\n\n if (Utils.GetData($e[0], 'select2Tags')) {\n if (this.options.debug && window.console && console.warn) {\n console.warn(\n 'Select2: The `data-select2-tags` attribute has been changed to ' +\n 'use the `data-data` and `data-tags=\"true\"` attributes and will be ' +\n 'removed in future versions of Select2.'\n );\n }\n\n Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags'));\n Utils.StoreData($e[0], 'tags', true);\n }\n\n if (Utils.GetData($e[0], 'ajaxUrl')) {\n if (this.options.debug && window.console && console.warn) {\n console.warn(\n 'Select2: The `data-ajax-url` attribute has been changed to ' +\n '`data-ajax--url` and support for the old attribute will be removed' +\n ' in future versions of Select2.'\n );\n }\n\n $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl'));\n Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl'));\n }\n\n var dataset = {};\n\n function upperCaseLetter(_, letter) {\n return letter.toUpperCase();\n }\n\n // Pre-load all of the attributes which are prefixed with `data-`\n for (var attr = 0; attr < $e[0].attributes.length; attr++) {\n var attributeName = $e[0].attributes[attr].name;\n var prefix = 'data-';\n\n if (attributeName.substr(0, prefix.length) == prefix) {\n // Get the contents of the attribute after `data-`\n var dataName = attributeName.substring(prefix.length);\n\n // Get the data contents from the consistent source\n // This is more than likely the jQuery data helper\n var dataValue = Utils.GetData($e[0], dataName);\n\n // camelCase the attribute name to match the spec\n var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter);\n\n // Store the data attribute contents into the dataset since\n dataset[camelDataName] = dataValue;\n }\n }\n\n // Prefer the element's `dataset` attribute if it exists\n // jQuery 1.x does not correctly handle data attributes with multiple dashes\n if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {\n dataset = $.extend(true, {}, $e[0].dataset, dataset);\n }\n\n // Prefer our internal data cache if it exists\n var data = $.extend(true, {}, Utils.GetData($e[0]), dataset);\n\n data = Utils._convertData(data);\n\n for (var key in data) {\n if ($.inArray(key, excludedData) > -1) {\n continue;\n }\n\n if ($.isPlainObject(this.options[key])) {\n $.extend(this.options[key], data[key]);\n } else {\n this.options[key] = data[key];\n }\n }\n\n return this;\n };\n\n Options.prototype.get = function (key) {\n return this.options[key];\n };\n\n Options.prototype.set = function (key, val) {\n this.options[key] = val;\n };\n\n return Options;\n });\n\n S2.define('select2/core',[\n 'jquery',\n './options',\n './utils',\n './keys'\n ], function ($, Options, Utils, KEYS) {\n var Select2 = function ($element, options) {\n if (Utils.GetData($element[0], 'select2') != null) {\n Utils.GetData($element[0], 'select2').destroy();\n }\n\n this.$element = $element;\n\n this.id = this._generateId($element);\n\n options = options || {};\n\n this.options = new Options(options, $element);\n\n Select2.__super__.constructor.call(this);\n\n // Set up the tabindex\n\n var tabindex = $element.attr('tabindex') || 0;\n Utils.StoreData($element[0], 'old-tabindex', tabindex);\n $element.attr('tabindex', '-1');\n\n // Set up containers and adapters\n\n var DataAdapter = this.options.get('dataAdapter');\n this.dataAdapter = new DataAdapter($element, this.options);\n\n var $container = this.render();\n\n this._placeContainer($container);\n\n var SelectionAdapter = this.options.get('selectionAdapter');\n this.selection = new SelectionAdapter($element, this.options);\n this.$selection = this.selection.render();\n\n this.selection.position(this.$selection, $container);\n\n var DropdownAdapter = this.options.get('dropdownAdapter');\n this.dropdown = new DropdownAdapter($element, this.options);\n this.$dropdown = this.dropdown.render();\n\n this.dropdown.position(this.$dropdown, $container);\n\n var ResultsAdapter = this.options.get('resultsAdapter');\n this.results = new ResultsAdapter($element, this.options, this.dataAdapter);\n this.$results = this.results.render();\n\n this.results.position(this.$results, this.$dropdown);\n\n // Bind events\n\n var self = this;\n\n // Bind the container to all of the adapters\n this._bindAdapters();\n\n // Register any DOM event handlers\n this._registerDomEvents();\n\n // Register any internal event handlers\n this._registerDataEvents();\n this._registerSelectionEvents();\n this._registerDropdownEvents();\n this._registerResultsEvents();\n this._registerEvents();\n\n // Set the initial state\n this.dataAdapter.current(function (initialData) {\n self.trigger('selection:update', {\n data: initialData\n });\n });\n\n // Hide the original select\n $element.addClass('select2-hidden-accessible');\n $element.attr('aria-hidden', 'true');\n\n // Synchronize any monitored attributes\n this._syncAttributes();\n\n Utils.StoreData($element[0], 'select2', this);\n\n // Ensure backwards compatibility with $element.data('select2').\n $element.data('select2', this);\n };\n\n Utils.Extend(Select2, Utils.Observable);\n\n Select2.prototype._generateId = function ($element) {\n var id = '';\n\n if ($element.attr('id') != null) {\n id = $element.attr('id');\n } else if ($element.attr('name') != null) {\n id = $element.attr('name') + '-' + Utils.generateChars(2);\n } else {\n id = Utils.generateChars(4);\n }\n\n id = id.replace(/(:|\\.|\\[|\\]|,)/g, '');\n id = 'select2-' + id;\n\n return id;\n };\n\n Select2.prototype._placeContainer = function ($container) {\n $container.insertAfter(this.$element);\n\n var width = this._resolveWidth(this.$element, this.options.get('width'));\n\n if (width != null) {\n $container.css('width', width);\n }\n };\n\n Select2.prototype._resolveWidth = function ($element, method) {\n var WIDTH = /^width:(([-+]?([0-9]*\\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;\n\n if (method == 'resolve') {\n var styleWidth = this._resolveWidth($element, 'style');\n\n if (styleWidth != null) {\n return styleWidth;\n }\n\n return this._resolveWidth($element, 'element');\n }\n\n if (method == 'element') {\n var elementWidth = $element.outerWidth(false);\n\n if (elementWidth <= 0) {\n return 'auto';\n }\n\n return elementWidth + 'px';\n }\n\n if (method == 'style') {\n var style = $element.attr('style');\n\n if (typeof(style) !== 'string') {\n return null;\n }\n\n var attrs = style.split(';');\n\n for (var i = 0, l = attrs.length; i < l; i = i + 1) {\n var attr = attrs[i].replace(/\\s/g, '');\n var matches = attr.match(WIDTH);\n\n if (matches !== null && matches.length >= 1) {\n return matches[1];\n }\n }\n\n return null;\n }\n\n if (method == 'computedstyle') {\n var computedStyle = window.getComputedStyle($element[0]);\n\n return computedStyle.width;\n }\n\n return method;\n };\n\n Select2.prototype._bindAdapters = function () {\n this.dataAdapter.bind(this, this.$container);\n this.selection.bind(this, this.$container);\n\n this.dropdown.bind(this, this.$container);\n this.results.bind(this, this.$container);\n };\n\n Select2.prototype._registerDomEvents = function () {\n var self = this;\n\n this.$element.on('change.select2', function () {\n self.dataAdapter.current(function (data) {\n self.trigger('selection:update', {\n data: data\n });\n });\n });\n\n this.$element.on('focus.select2', function (evt) {\n self.trigger('focus', evt);\n });\n\n this._syncA = Utils.bind(this._syncAttributes, this);\n this._syncS = Utils.bind(this._syncSubtree, this);\n\n if (this.$element[0].attachEvent) {\n this.$element[0].attachEvent('onpropertychange', this._syncA);\n }\n\n var observer = window.MutationObserver ||\n window.WebKitMutationObserver ||\n window.MozMutationObserver\n ;\n\n if (observer != null) {\n this._observer = new observer(function (mutations) {\n self._syncA();\n self._syncS(null, mutations);\n });\n this._observer.observe(this.$element[0], {\n attributes: true,\n childList: true,\n subtree: false\n });\n } else if (this.$element[0].addEventListener) {\n this.$element[0].addEventListener(\n 'DOMAttrModified',\n self._syncA,\n false\n );\n this.$element[0].addEventListener(\n 'DOMNodeInserted',\n self._syncS,\n false\n );\n this.$element[0].addEventListener(\n 'DOMNodeRemoved',\n self._syncS,\n false\n );\n }\n };\n\n Select2.prototype._registerDataEvents = function () {\n var self = this;\n\n this.dataAdapter.on('*', function (name, params) {\n self.trigger(name, params);\n });\n };\n\n Select2.prototype._registerSelectionEvents = function () {\n var self = this;\n var nonRelayEvents = ['toggle', 'focus'];\n\n this.selection.on('toggle', function () {\n self.toggleDropdown();\n });\n\n this.selection.on('focus', function (params) {\n self.focus(params);\n });\n\n this.selection.on('*', function (name, params) {\n if ($.inArray(name, nonRelayEvents) !== -1) {\n return;\n }\n\n self.trigger(name, params);\n });\n };\n\n Select2.prototype._registerDropdownEvents = function () {\n var self = this;\n\n this.dropdown.on('*', function (name, params) {\n self.trigger(name, params);\n });\n };\n\n Select2.prototype._registerResultsEvents = function () {\n var self = this;\n\n this.results.on('*', function (name, params) {\n self.trigger(name, params);\n });\n };\n\n Select2.prototype._registerEvents = function () {\n var self = this;\n\n this.on('open', function () {\n self.$container.addClass('select2-container--open');\n });\n\n this.on('close', function () {\n self.$container.removeClass('select2-container--open');\n });\n\n this.on('enable', function () {\n self.$container.removeClass('select2-container--disabled');\n });\n\n this.on('disable', function () {\n self.$container.addClass('select2-container--disabled');\n });\n\n this.on('blur', function () {\n self.$container.removeClass('select2-container--focus');\n });\n\n this.on('query', function (params) {\n if (!self.isOpen()) {\n self.trigger('open', {});\n }\n\n this.dataAdapter.query(params, function (data) {\n self.trigger('results:all', {\n data: data,\n query: params\n });\n });\n });\n\n this.on('query:append', function (params) {\n this.dataAdapter.query(params, function (data) {\n self.trigger('results:append', {\n data: data,\n query: params\n });\n });\n });\n\n this.on('keypress', function (evt) {\n var key = evt.which;\n\n if (self.isOpen()) {\n if (key === KEYS.ESC || key === KEYS.TAB ||\n (key === KEYS.UP && evt.altKey)) {\n self.close(evt);\n\n evt.preventDefault();\n } else if (key === KEYS.ENTER) {\n self.trigger('results:select', {});\n\n evt.preventDefault();\n } else if ((key === KEYS.SPACE && evt.ctrlKey)) {\n self.trigger('results:toggle', {});\n\n evt.preventDefault();\n } else if (key === KEYS.UP) {\n self.trigger('results:previous', {});\n\n evt.preventDefault();\n } else if (key === KEYS.DOWN) {\n self.trigger('results:next', {});\n\n evt.preventDefault();\n }\n } else {\n if (key === KEYS.ENTER || key === KEYS.SPACE ||\n (key === KEYS.DOWN && evt.altKey)) {\n self.open();\n\n evt.preventDefault();\n }\n }\n });\n };\n\n Select2.prototype._syncAttributes = function () {\n this.options.set('disabled', this.$element.prop('disabled'));\n\n if (this.isDisabled()) {\n if (this.isOpen()) {\n this.close();\n }\n\n this.trigger('disable', {});\n } else {\n this.trigger('enable', {});\n }\n };\n\n Select2.prototype._isChangeMutation = function (evt, mutations) {\n var changed = false;\n var self = this;\n\n // Ignore any mutation events raised for elements that aren't options or\n // optgroups. This handles the case when the select element is destroyed\n if (\n evt && evt.target && (\n evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'\n )\n ) {\n return;\n }\n\n if (!mutations) {\n // If mutation events aren't supported, then we can only assume that the\n // change affected the selections\n changed = true;\n } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {\n for (var n = 0; n < mutations.addedNodes.length; n++) {\n var node = mutations.addedNodes[n];\n\n if (node.selected) {\n changed = true;\n }\n }\n } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {\n changed = true;\n } else if ($.isArray(mutations)) {\n $.each(mutations, function(evt, mutation) {\n if (self._isChangeMutation(evt, mutation)) {\n // We've found a change mutation.\n // Let's escape from the loop and continue\n changed = true;\n return false;\n }\n });\n }\n return changed;\n };\n\n Select2.prototype._syncSubtree = function (evt, mutations) {\n var changed = this._isChangeMutation(evt, mutations);\n var self = this;\n\n // Only re-pull the data if we think there is a change\n if (changed) {\n this.dataAdapter.current(function (currentData) {\n self.trigger('selection:update', {\n data: currentData\n });\n });\n }\n };\n\n /**\n * Override the trigger method to automatically trigger pre-events when\n * there are events that can be prevented.\n */\n Select2.prototype.trigger = function (name, args) {\n var actualTrigger = Select2.__super__.trigger;\n var preTriggerMap = {\n 'open': 'opening',\n 'close': 'closing',\n 'select': 'selecting',\n 'unselect': 'unselecting',\n 'clear': 'clearing'\n };\n\n if (args === undefined) {\n args = {};\n }\n\n if (name in preTriggerMap) {\n var preTriggerName = preTriggerMap[name];\n var preTriggerArgs = {\n prevented: false,\n name: name,\n args: args\n };\n\n actualTrigger.call(this, preTriggerName, preTriggerArgs);\n\n if (preTriggerArgs.prevented) {\n args.prevented = true;\n\n return;\n }\n }\n\n actualTrigger.call(this, name, args);\n };\n\n Select2.prototype.toggleDropdown = function () {\n if (this.isDisabled()) {\n return;\n }\n\n if (this.isOpen()) {\n this.close();\n } else {\n this.open();\n }\n };\n\n Select2.prototype.open = function () {\n if (this.isOpen()) {\n return;\n }\n\n if (this.isDisabled()) {\n return;\n }\n\n this.trigger('query', {});\n };\n\n Select2.prototype.close = function (evt) {\n if (!this.isOpen()) {\n return;\n }\n\n this.trigger('close', { originalEvent : evt });\n };\n\n /**\n * Helper method to abstract the \"enabled\" (not \"disabled\") state of this\n * object.\n *\n * @return {true} if the instance is not disabled.\n * @return {false} if the instance is disabled.\n */\n Select2.prototype.isEnabled = function () {\n return !this.isDisabled();\n };\n\n /**\n * Helper method to abstract the \"disabled\" state of this object.\n *\n * @return {true} if the disabled option is true.\n * @return {false} if the disabled option is false.\n */\n Select2.prototype.isDisabled = function () {\n return this.options.get('disabled');\n };\n\n Select2.prototype.isOpen = function () {\n return this.$container.hasClass('select2-container--open');\n };\n\n Select2.prototype.hasFocus = function () {\n return this.$container.hasClass('select2-container--focus');\n };\n\n Select2.prototype.focus = function (data) {\n // No need to re-trigger focus events if we are already focused\n if (this.hasFocus()) {\n return;\n }\n\n this.$container.addClass('select2-container--focus');\n this.trigger('focus', {});\n };\n\n Select2.prototype.enable = function (args) {\n if (this.options.get('debug') && window.console && console.warn) {\n console.warn(\n 'Select2: The `select2(\"enable\")` method has been deprecated and will' +\n ' be removed in later Select2 versions. Use $element.prop(\"disabled\")' +\n ' instead.'\n );\n }\n\n if (args == null || args.length === 0) {\n args = [true];\n }\n\n var disabled = !args[0];\n\n this.$element.prop('disabled', disabled);\n };\n\n Select2.prototype.data = function () {\n if (this.options.get('debug') &&\n arguments.length > 0 && window.console && console.warn) {\n console.warn(\n 'Select2: Data can no longer be set using `select2(\"data\")`. You ' +\n 'should consider setting the value instead using `$element.val()`.'\n );\n }\n\n var data = [];\n\n this.dataAdapter.current(function (currentData) {\n data = currentData;\n });\n\n return data;\n };\n\n Select2.prototype.val = function (args) {\n if (this.options.get('debug') && window.console && console.warn) {\n console.warn(\n 'Select2: The `select2(\"val\")` method has been deprecated and will be' +\n ' removed in later Select2 versions. Use $element.val() instead.'\n );\n }\n\n if (args == null || args.length === 0) {\n return this.$element.val();\n }\n\n var newVal = args[0];\n\n if ($.isArray(newVal)) {\n newVal = $.map(newVal, function (obj) {\n return obj.toString();\n });\n }\n\n this.$element.val(newVal).trigger('input').trigger('change');\n };\n\n Select2.prototype.destroy = function () {\n this.$container.remove();\n\n if (this.$element[0].detachEvent) {\n this.$element[0].detachEvent('onpropertychange', this._syncA);\n }\n\n if (this._observer != null) {\n this._observer.disconnect();\n this._observer = null;\n } else if (this.$element[0].removeEventListener) {\n this.$element[0]\n .removeEventListener('DOMAttrModified', this._syncA, false);\n this.$element[0]\n .removeEventListener('DOMNodeInserted', this._syncS, false);\n this.$element[0]\n .removeEventListener('DOMNodeRemoved', this._syncS, false);\n }\n\n this._syncA = null;\n this._syncS = null;\n\n this.$element.off('.select2');\n this.$element.attr('tabindex',\n Utils.GetData(this.$element[0], 'old-tabindex'));\n\n this.$element.removeClass('select2-hidden-accessible');\n this.$element.attr('aria-hidden', 'false');\n Utils.RemoveData(this.$element[0]);\n this.$element.removeData('select2');\n\n this.dataAdapter.destroy();\n this.selection.destroy();\n this.dropdown.destroy();\n this.results.destroy();\n\n this.dataAdapter = null;\n this.selection = null;\n this.dropdown = null;\n this.results = null;\n };\n\n Select2.prototype.render = function () {\n var $container = $(\n '' +\n '' +\n '' +\n ''\n );\n\n $container.attr('dir', this.options.get('dir'));\n\n this.$container = $container;\n\n this.$container.addClass('select2-container--' + this.options.get('theme'));\n\n Utils.StoreData($container[0], 'element', this.$element);\n\n return $container;\n };\n\n return Select2;\n });\n\n S2.define('select2/compat/utils',[\n 'jquery'\n ], function ($) {\n function syncCssClasses ($dest, $src, adapter) {\n var classes, replacements = [], adapted;\n\n classes = $.trim($dest.attr('class'));\n\n if (classes) {\n classes = '' + classes; // for IE which returns object\n\n $(classes.split(/\\s+/)).each(function () {\n // Save all Select2 classes\n if (this.indexOf('select2-') === 0) {\n replacements.push(this);\n }\n });\n }\n\n classes = $.trim($src.attr('class'));\n\n if (classes) {\n classes = '' + classes; // for IE which returns object\n\n $(classes.split(/\\s+/)).each(function () {\n // Only adapt non-Select2 classes\n if (this.indexOf('select2-') !== 0) {\n adapted = adapter(this);\n\n if (adapted != null) {\n replacements.push(adapted);\n }\n }\n });\n }\n\n $dest.attr('class', replacements.join(' '));\n }\n\n return {\n syncCssClasses: syncCssClasses\n };\n });\n\n S2.define('select2/compat/containerCss',[\n 'jquery',\n './utils'\n ], function ($, CompatUtils) {\n // No-op CSS adapter that discards all classes by default\n function _containerAdapter (clazz) {\n return null;\n }\n\n function ContainerCSS () { }\n\n ContainerCSS.prototype.render = function (decorated) {\n var $container = decorated.call(this);\n\n var containerCssClass = this.options.get('containerCssClass') || '';\n\n if ($.isFunction(containerCssClass)) {\n containerCssClass = containerCssClass(this.$element);\n }\n\n var containerCssAdapter = this.options.get('adaptContainerCssClass');\n containerCssAdapter = containerCssAdapter || _containerAdapter;\n\n if (containerCssClass.indexOf(':all:') !== -1) {\n containerCssClass = containerCssClass.replace(':all:', '');\n\n var _cssAdapter = containerCssAdapter;\n\n containerCssAdapter = function (clazz) {\n var adapted = _cssAdapter(clazz);\n\n if (adapted != null) {\n // Append the old one along with the adapted one\n return adapted + ' ' + clazz;\n }\n\n return clazz;\n };\n }\n\n var containerCss = this.options.get('containerCss') || {};\n\n if ($.isFunction(containerCss)) {\n containerCss = containerCss(this.$element);\n }\n\n CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter);\n\n $container.css(containerCss);\n $container.addClass(containerCssClass);\n\n return $container;\n };\n\n return ContainerCSS;\n });\n\n S2.define('select2/compat/dropdownCss',[\n 'jquery',\n './utils'\n ], function ($, CompatUtils) {\n // No-op CSS adapter that discards all classes by default\n function _dropdownAdapter (clazz) {\n return null;\n }\n\n function DropdownCSS () { }\n\n DropdownCSS.prototype.render = function (decorated) {\n var $dropdown = decorated.call(this);\n\n var dropdownCssClass = this.options.get('dropdownCssClass') || '';\n\n if ($.isFunction(dropdownCssClass)) {\n dropdownCssClass = dropdownCssClass(this.$element);\n }\n\n var dropdownCssAdapter = this.options.get('adaptDropdownCssClass');\n dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter;\n\n if (dropdownCssClass.indexOf(':all:') !== -1) {\n dropdownCssClass = dropdownCssClass.replace(':all:', '');\n\n var _cssAdapter = dropdownCssAdapter;\n\n dropdownCssAdapter = function (clazz) {\n var adapted = _cssAdapter(clazz);\n\n if (adapted != null) {\n // Append the old one along with the adapted one\n return adapted + ' ' + clazz;\n }\n\n return clazz;\n };\n }\n\n var dropdownCss = this.options.get('dropdownCss') || {};\n\n if ($.isFunction(dropdownCss)) {\n dropdownCss = dropdownCss(this.$element);\n }\n\n CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter);\n\n $dropdown.css(dropdownCss);\n $dropdown.addClass(dropdownCssClass);\n\n return $dropdown;\n };\n\n return DropdownCSS;\n });\n\n S2.define('select2/compat/initSelection',[\n 'jquery'\n ], function ($) {\n function InitSelection (decorated, $element, options) {\n if (options.get('debug') && window.console && console.warn) {\n console.warn(\n 'Select2: The `initSelection` option has been deprecated in favor' +\n ' of a custom data adapter that overrides the `current` method. ' +\n 'This method is now called multiple times instead of a single ' +\n 'time when the instance is initialized. Support will be removed ' +\n 'for the `initSelection` option in future versions of Select2'\n );\n }\n\n this.initSelection = options.get('initSelection');\n this._isInitialized = false;\n\n decorated.call(this, $element, options);\n }\n\n InitSelection.prototype.current = function (decorated, callback) {\n var self = this;\n\n if (this._isInitialized) {\n decorated.call(this, callback);\n\n return;\n }\n\n this.initSelection.call(null, this.$element, function (data) {\n self._isInitialized = true;\n\n if (!$.isArray(data)) {\n data = [data];\n }\n\n callback(data);\n });\n };\n\n return InitSelection;\n });\n\n S2.define('select2/compat/inputData',[\n 'jquery',\n '../utils'\n ], function ($, Utils) {\n function InputData (decorated, $element, options) {\n this._currentData = [];\n this._valueSeparator = options.get('valueSeparator') || ',';\n\n if ($element.prop('type') === 'hidden') {\n if (options.get('debug') && console && console.warn) {\n console.warn(\n 'Select2: Using a hidden input with Select2 is no longer ' +\n 'supported and may stop working in the future. It is recommended ' +\n 'to use a `
+ *
+ * The return value will be casted to boolean if non-boolean was returned.
+ * @since 5.0.0
+ */
+ public function offsetExists($offset) : bool {
+ if ($offset == 'data') {
+ return true;
+ }
+ return isset($this->data[$offset]) || isset($this->children[$offset]);
+ }
+
+ /**
+ * Offset to retrieve
+ * @link https://php.net/manual/en/arrayaccess.offsetget.php
+ * @param mixed $offset
+ * The offset to retrieve.
+ *
+ * @return mixed Can return all value types.
+ * @since 5.0.0
+ */
+ public function offsetGet(mixed $offset): mixed {
+ if ($offset == 'data') {
+ return $this->get_data();
+ }
+
+ if (isset($this->data[$offset])) {
+ return $this->data[$offset]->get_value();
+ } else {
+ return $this->children[$offset];
+ }
+ }
+
+ /**
+ * Offset to set
+ * @link https://php.net/manual/en/arrayaccess.offsetset.php
+ * @param mixed $offset
+ * The offset to assign the value to.
+ *
+ * @param mixed $value
+ * The value to set.
+ *
+ * @return void
+ * @since 5.0.0
+ */
+ public function offsetSet(mixed $offset, mixed $value): void {
+ throw new \coding_exception('Setting data not supported with array access.');
+ }
+
+ /**
+ * Offset to unset
+ * @link https://php.net/manual/en/arrayaccess.offsetunset.php
+ * @param mixed $offset
+ * The offset to unset.
+ *
+ * @return void
+ * @since 5.0.0
+ */
+ public function offsetUnset(mixed $offset): void {
+ throw new \coding_exception('Unsetting data not supported with array access.');
+ }
+}
diff --git a/classes/local/data_grid/data/field.php b/classes/local/data_grid/data/field.php
index 370ba51..b6dd3fe 100644
--- a/classes/local/data_grid/data/field.php
+++ b/classes/local/data_grid/data/field.php
@@ -80,7 +80,7 @@ public function get_name() {
* @return mixed|string
*/
public function get_value() {
- if (!filter_var($this->value, FILTER_VALIDATE_URL)) {
+ if (!filter_var($this->value, FILTER_VALIDATE_URL)) {
return format_text($this->value, FORMAT_HTML, ['noclean' => true]);
}
return $this->value;
diff --git a/classes/local/data_grid/data/strategy/grouped_strategy.php b/classes/local/data_grid/data/strategy/grouped_strategy.php
index d5313f0..7d5e512 100644
--- a/classes/local/data_grid/data/strategy/grouped_strategy.php
+++ b/classes/local/data_grid/data/strategy/grouped_strategy.php
@@ -65,13 +65,13 @@ public function __construct(field_interface $groupbyfielddefinition,
* @return data_collection_interface
*/
public function convert_records_to_data_collection($records, array $fielddefinitions) {
- $griddata = new data_collection();
+ $griddata = block_dash_get_data_collection();
$sections = [];
foreach ($records as $fullrecord) {
$record = clone $fullrecord;
- $row = new data_collection();
+ $row = block_dash_get_data_collection();
$label = $record->{$this->grouplabelfielddefinition->get_alias()};
if (!$groupby = $record->{$this->groupbyfielddefinition->get_alias()}) {
@@ -90,7 +90,7 @@ public function convert_records_to_data_collection($records, array $fielddefinit
}
if (!isset($sections[$groupby])) {
- $sections[$groupby] = new data_collection();
+ $sections[$groupby] = block_dash_get_data_collection();
$sections[$groupby]->add_data(new field('groupby', $groupby, $fielddefinition->get_visibility()));
$sections[$groupby]->add_data(new field('label', $label, $fielddefinition->get_visibility()));
}
diff --git a/classes/local/data_grid/data/strategy/standard_strategy.php b/classes/local/data_grid/data/strategy/standard_strategy.php
index d24aeab..6c1bdd1 100644
--- a/classes/local/data_grid/data/strategy/standard_strategy.php
+++ b/classes/local/data_grid/data/strategy/standard_strategy.php
@@ -44,14 +44,14 @@ class standard_strategy implements data_strategy_interface {
* @return data_collection_interface
*/
public function convert_records_to_data_collection($records, array $fielddefinitions) {
- $griddata = new data_collection();
+ $griddata = block_dash_get_data_collection();
foreach ($records as $fullrecord) {
$record = clone $fullrecord;
if (isset($record->unique_id)) {
unset($record->unique_id);
}
- $row = new data_collection();
+ $row = block_dash_get_data_collection();
foreach ($fielddefinitions as $fielddefinition) {
$name = $fielddefinition->get_alias();
diff --git a/classes/local/data_grid/field/attribute/time_attribute.php b/classes/local/data_grid/field/attribute/time_attribute.php
index 0474366..c0349d4 100644
--- a/classes/local/data_grid/field/attribute/time_attribute.php
+++ b/classes/local/data_grid/field/attribute/time_attribute.php
@@ -43,8 +43,8 @@ public function transform_data($data, \stdClass $record) {
if (is_numeric($data) && $data > 0) {
$t = $data;
$hours = floor($t / 3600);
- $minutes = floor(($t % 3600) / 60);
- $seconds = $t % 60;
+ $minutes = floor((intval($t) % 3600) / 60);
+ $seconds = intval($t) % 60;
return sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds);
}
diff --git a/classes/local/data_grid/filter/select_filter.php b/classes/local/data_grid/filter/select_filter.php
index d5313db..d272425 100644
--- a/classes/local/data_grid/filter/select_filter.php
+++ b/classes/local/data_grid/filter/select_filter.php
@@ -40,7 +40,7 @@ abstract class select_filter extends filter {
*
* @var array
*/
- private $options = [];
+ protected $options = [];
/**
* Initialize the filter. It must be initialized before values are extracted or SQL generated.
diff --git a/classes/local/data_source/abstract_data_source.php b/classes/local/data_source/abstract_data_source.php
index 831cf8b..9b7ab29 100644
--- a/classes/local/data_source/abstract_data_source.php
+++ b/classes/local/data_source/abstract_data_source.php
@@ -93,7 +93,7 @@ abstract class abstract_data_source implements data_source_interface, \templatab
/**
* @var paginator
*/
- private $paginator;
+ protected $paginator;
/**
* @var table[]
@@ -348,7 +348,7 @@ final public function get_data() {
if (is_null($this->data)) {
// If the block has no preferences do not query any data.
if (empty($this->get_all_preferences())) {
- return new data_collection();
+ return block_dash_get_data_collection();
}
$this->before_data();
diff --git a/classes/local/layout/abstract_layout.php b/classes/local/layout/abstract_layout.php
index 2badf15..18008db 100644
--- a/classes/local/layout/abstract_layout.php
+++ b/classes/local/layout/abstract_layout.php
@@ -279,14 +279,13 @@ public function export_for_template(\renderer_base $output) {
$downloadlist = '';
$options['sesskey'] = sesskey();
$options["download"] = "csv";
- $button = $OUTPUT->single_button(new moodle_url($PAGE->url, $options), get_string("downloadcsv", 'block_dash'), 'get');
+ $button = $OUTPUT->single_button(new moodle_url($PAGE->url, $options), get_string("downloadcsv", 'block_dash'), 'get');
$downloadoptions[] = html_writer::tag('li', $button, array('class' => 'reportoption list-inline-item'));
$options["download"] = "xls";
$button = $OUTPUT->single_button(new moodle_url($PAGE->url, $options), get_string("downloadexcel"), 'get');
$downloadoptions[] = html_writer::tag('li', $button, array('class' => 'reportoption list-inline-item'));
-
$downloadlist .= html_writer::tag('ul', implode('', $downloadoptions), array('class' => 'list-inline inline'));
$downloadlist .= html_writer::tag('div', '', array('class' => 'clearfloat'));
$downloadcontent .= html_writer::tag('div', $downloadlist, array('class' => 'downloadreport mt-1'));
diff --git a/classes/local/widget/abstract_widget.php b/classes/local/widget/abstract_widget.php
index 711be42..2211b1d 100644
--- a/classes/local/widget/abstract_widget.php
+++ b/classes/local/widget/abstract_widget.php
@@ -52,6 +52,8 @@ abstract class abstract_widget extends abstract_data_source implements data_sour
*/
public $iswidget = true;
+
+
/**
* Constructor.
*
diff --git a/classes/local/widget/contacts/contacts_widget.php b/classes/local/widget/contacts/contacts_widget.php
index 1f5e80a..8a76622 100644
--- a/classes/local/widget/contacts/contacts_widget.php
+++ b/classes/local/widget/contacts/contacts_widget.php
@@ -245,7 +245,7 @@ public function include_suggest_contacts() {
}
// Groups suggestion.
- $sql = 'SELECT * FROM {groups_members} gm
+ $sql = 'SELECT *, gm.id FROM {groups_members} gm
JOIN {groups} g ON g.id = gm.groupid
JOIN {user} u ON u.id = gm.userid
WHERE gm.userid != :userid AND g.id IN (
diff --git a/classes/local/widget/groups/external.php b/classes/local/widget/groups/external.php
index 3f990c1..a7dfaf9 100644
--- a/classes/local/widget/groups/external.php
+++ b/classes/local/widget/groups/external.php
@@ -24,10 +24,11 @@
namespace block_dash\local\widget\groups;
-use external_api;
-
defined('MOODLE_INTERNAL') || die('No direct access');
+require_once($CFG->libdir . '/externallib.php');
+use external_api;
+
require_once($CFG->dirroot . '/user/selector/lib.php');
require_once($CFG->dirroot . '/group/lib.php');
diff --git a/classes/local/widget/mylearning/mylearning_widget.php b/classes/local/widget/mylearning/mylearning_widget.php
index 4a3e9b4..6e62feb 100644
--- a/classes/local/widget/mylearning/mylearning_widget.php
+++ b/classes/local/widget/mylearning/mylearning_widget.php
@@ -331,8 +331,10 @@ protected function activity_progress($course, $userid) {
*/
public static function get_course_contents($courseid) {
global $CFG, $DB, $USER, $PAGE;
+ // Include library files.
require_once($CFG->dirroot . "/course/lib.php");
require_once($CFG->libdir . '/completionlib.php');
+ require_once($CFG->libdir . '/externallib.php');
$filters = array();
// Retrieve the course.
diff --git a/classes/output/mustache_custom_loader.php b/classes/output/mustache_custom_loader.php
index ba651f9..8b98fe5 100644
--- a/classes/output/mustache_custom_loader.php
+++ b/classes/output/mustache_custom_loader.php
@@ -38,10 +38,11 @@ class mustache_custom_loader extends \Mustache_Loader_FilesystemLoader {
public function __construct() {
global $CFG;
- $baseDir = '';
- parent::__construct($baseDir, []);
+ $basedir = '';
+ parent::__construct($basedir, []);
}
+ // @codingStandardsIgnoreStart
/**
* Helper function for getting a Mustache template file name.
* Uses the leading component to restrict us specific directories.
@@ -51,7 +52,7 @@ public function __construct() {
*/
protected function getFileName($name) {
global $CFG;
-
+ // @codingStandardsIgnoreEnd
if (strpos($name, '_custom') === 0) {
return "$CFG->localcachedir/block_dash/templates/" . str_replace('_custom/', '', $name);
}
diff --git a/classes/output/renderer.php b/classes/output/renderer.php
index 7bc057b..03d2dda 100644
--- a/classes/output/renderer.php
+++ b/classes/output/renderer.php
@@ -134,9 +134,6 @@ public function render_from_template($templatestring, $context) {
* @throws \coding_exception
*/
public function render_data_source(abstract_data_source $datasource) {
- /* $data = $datasource->export_for_template($this);
- unset($data['datasource']);
- print_object($data); */
return $this->render_from_template($datasource->get_layout()->get_mustache_template_name(),
$datasource->export_for_template($this));
}
diff --git a/download.php b/download.php
index fa45b59..a75420f 100644
--- a/download.php
+++ b/download.php
@@ -22,18 +22,19 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+require(__DIR__.'/../../config.php');
if (!defined('AJAX_SCRIPT')) {
define('AJAX_SCRIPT', true);
}
-require(__DIR__.'/../../config.php');
+require_login();
use block_dash\local\block_builder;
$download = optional_param('download', 'csv', PARAM_TEXT);
$instanceid = required_param('block_instance_id', PARAM_INT);
-$filterform_data = optional_param('filter_form_data', '', PARAM_TEXT);
+$filterformdata = optional_param('filter_form_data', '', PARAM_TEXT);
$currentpage = optional_param('page', 0, PARAM_INT);
$sortfield = optional_param('sort_field', '', PARAM_TEXT);
$sortdir = optional_param('sort_direction', '', PARAM_TEXT);
@@ -50,7 +51,7 @@
if (!$bbdownload->get_configuration()->get_data_source()->get_preferences('exportdata') ) {
return false;
}
-foreach (json_decode($filterform_data, true) as $filter) {
+foreach (json_decode($filterformdata, true) as $filter) {
$bbdownload->get_configuration()
->get_data_source()
->get_filter_collection()
@@ -59,18 +60,18 @@
$bbdownload->get_configuration()->get_data_source()->get_paginator()->set_current_page($currentpage);
$bbdownloadsource = $bbdownload->get_configuration()->get_data_source();
$file = $bbdownload->get_configuration()->get_data_source()->get_name();
-$filename = $file . "_" . get_string('strdatasource', 'block_dash');
+$filename = $file . "_" . get_string('strdatasource', 'block_dash');
if ($download == "xls") {
require_once("$CFG->libdir/excellib.class.php");
- /// Calculate file name
- /// Creating a workbook
+ // Calculate file name.
+ // Creating a workbook.
$workbook = new \MoodleExcelWorkbook("-");
- /// Send HTTP headers
+ // Send HTTP headers.
$filename .= "_" . time();
$workbook->send($filename);
- /// Creating the first worksheet
+ // Creating the first worksheet.
$myxls = $workbook->add_worksheet('dash');
- /// Print names of all the fields
+ // Print names of all the fields.
$i = 0;
foreach ($bbdownloadsource->export_for_template($renderer)['data']->first_child()['data'] as $col) {
if ($col->is_visible()) {
@@ -92,7 +93,7 @@
$j++;
}
}
- /// Close the workbook
+ // Close the workbook.
$workbook->close();
} else if ($download == 'csv') {
require_once("$CFG->libdir/csvlib.class.php");
diff --git a/edit_form.php b/edit_form.php
index cedc067..79b8146 100644
--- a/edit_form.php
+++ b/edit_form.php
@@ -22,6 +22,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
use block_dash\local\data_source\data_source_factory;
/**
@@ -127,7 +129,7 @@ public function add_datasource_group(&$mform, $config) {
if (!isset($config->data_source_idnumber)) {
- self::dash_features_list($mform, $this->block->context);
+ self::dash_features_list($mform, $this->block->context, $this->page);
} else {
if ($ds = data_source_factory::build_data_source($config->data_source_idnumber,
@@ -143,8 +145,8 @@ public function add_datasource_group(&$mform, $config) {
}
}
- public static function dash_features_list(&$mform, $context) {
- global $OUTPUT, $PAGE;
+ public static function dash_features_list(&$mform, $context, $page) {
+ global $OUTPUT;
// Group of datasources.
if (has_capability('block/dash:managedatasource', $context)) {
$datasources = data_source_factory::get_data_source_form_options();
@@ -193,7 +195,6 @@ public static function dash_features_list(&$mform, $context) {
// Content layout.
$customfeatures = data_source_factory::get_data_source_form_options('custom');
if ($customfeatures) {
- // $customoptions[] = $mform->createElement('html', html_writer::start_div('custom-addon'));
foreach ($customfeatures as $id => $source) {
if ($id::has_capbility($context)) {
$id::get_features_config($mform, $source);
@@ -202,7 +203,7 @@ public static function dash_features_list(&$mform, $context) {
}
if (isset($showcustom)) {
- $PAGE->requires->js_amd_inline('require(["jquery"], function($) {
+ $page->requires->js_amd_inline('require(["jquery"], function($) {
$("body").on("change", "[data-target=\"subsource-config\"] [type=radio]", function(e) {
var subConfig;
if (subConfig = e.target.closest("[data-target=\"subsource-config\"]")) {
@@ -228,15 +229,31 @@ public static function display_form_when_adding(): bool {
}
}
+/**
+ * Dash features form to configure the data source or widget.
+ */
class block_dash_featuresform extends \moodleform {
+ /**
+ * Defined the form fields for the datasource selector list.
+ *
+ * @return void
+ */
public function definition() {
+ // @codingStandardsIgnoreStart
+ global $PAGE;
+ // Ignore the phplint due to block class not allowed to include the PAGE global variable.
+ // @codingStandardsIgnoreEnd
+
$mform = $this->_form;
$mform->updateAttributes(['class' => 'form-inline']);
$mform->updateAttributes(['id' => 'dash-configuration']);
$block = $this->_customdata['block'] ?? '';
- block_dash_edit_form::dash_features_list($mform, $block);
+ // @codingStandardsIgnoreStart
+ // Ignore the phplint due to block class not allowed to include the PAGE global variable.
+ block_dash_edit_form::dash_features_list($mform, $block, $PAGE);
+ // @codingStandardsIgnoreEnd
}
}
diff --git a/lib.php b/lib.php
index 7afc60d..0dd375e 100644
--- a/lib.php
+++ b/lib.php
@@ -325,3 +325,8 @@ function block_dash_get_suggest_users() {
}
return isset($list) ? $list : [];
}
+
+function block_dash_get_data_collection() {
+ return version_compare(phpversion(), '8.1', '<')
+ ? new block_dash\local\data_grid\data\data_collection() : new \block_dash\local\data_grid\data\data_collection_new();
+}
diff --git a/styles.css b/styles.css
index c72326a..de87aa8 100644
--- a/styles.css
+++ b/styles.css
@@ -568,7 +568,8 @@ body .select2-container {
.block_dash-info-element .course-info-block .right-block .info-block .accordion-block .card-header
h5 button:before {
content: '\f107';
- font-family: fontawesome;
+ font-family: var(--fa-style-family, "Font Awesome 6 Free", fontawesome);
+ font-weight: var(--fa-style, 900);
font-size: 20px;
margin-right: 10px;
}
@@ -680,7 +681,8 @@ h5 .completion-card.completed p i {
.block_dash-info-element .course-info-block .right-block .info-block .accordion-block .card-body
.section-block.inprogress .section-action a:after {
content: '\f178';
- font-family: 'fontawesome';
+ font-family: var(--fa-style-family, "Font Awesome 6 Free", fontawesome);
+ font-weight: var(--fa-style, 900);
margin-left: 10px;
}
.block_dash-info-element .course-info-block .right-block .info-block .accordion-block .card-body .section-block.restricted h5,
@@ -696,7 +698,7 @@ h5:before,
@media (min-width: 1400px) {
.block_dash-info-element .course-info-block .left-block .img-block {
- max-width: 400px;
+ max-width: 300px;
width: 100%;
height: 400px;
}
diff --git a/styles/slick.css b/styles/slick.css
index 437651b..888dc3d 100644
--- a/styles/slick.css
+++ b/styles/slick.css
@@ -96,4 +96,4 @@
height: auto;
border: 1px solid transparent;
-}
\ No newline at end of file
+}
diff --git a/tests/behat/mycontacts.feature b/tests/behat/mycontacts.feature
index f7a0493..ecf1d29 100644
--- a/tests/behat/mycontacts.feature
+++ b/tests/behat/mycontacts.feature
@@ -67,10 +67,10 @@ Feature: Add user contacts widget in dash block
And I navigate to "Appearance > Default Dashboard page" in site administration
And I turn block editing mode on
And I add the "Dash" block
- And I configure the "New Dash" block
+ # And I configure the "New Dash" block
And I click on "#id_config_data_source_idnumber_block_dashlocalwidgetcontactscontacts_widget" "css_element"
And I set the following fields to these values:
- | Region | content |
+ | Default region | content |
And I press "Save changes"
And I click on "Reset Dashboard for all users" "button"
And I log out
From 7f81ff43b7f247694df69f70a190fdc0ba28c386 Mon Sep 17 00:00:00 2001
From: Prasanna LMSACE
Date: Wed, 29 Nov 2023 19:26:14 +0530
Subject: [PATCH 11/14] Version upgraded
---
version.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/version.php b/version.php
index 6925a2e..d04abad 100644
--- a/version.php
+++ b/version.php
@@ -24,9 +24,9 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2023101706; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->version = 2023101707; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2021051700; // Requires this Moodle version.
$plugin->component = 'block_dash'; // Full name of the plugin (used for diagnostics).
$plugin->maturity = MATURITY_RC;
$plugin->release = '1.8 RC';
-$plugin->supported = [311, 401];
+$plugin->supported = [311, 403];
From e4359c2e98c1cdd12c364db43c0a27aa465b1592 Mon Sep 17 00:00:00 2001
From: Prasanna LMSACE
Date: Thu, 7 Dec 2023 20:55:48 +0530
Subject: [PATCH 12/14] Support included for dash developer addon.
---
amd/build/contacts.min.js | 2 +-
amd/build/contacts.min.js.map | 2 +-
amd/build/dash_instance.min.js | 2 +-
amd/build/dash_instance.min.js.map | 2 +-
amd/build/datepicker.min.js | 2 +-
amd/build/datepicker.min.js.map | 2 +-
amd/build/group-user-selector.min.js | 2 +-
amd/build/group-user-selector.min.js.map | 2 +-
amd/build/groups.min.js | 2 +-
amd/build/groups.min.js.map | 2 +-
amd/build/preferences_modal.min.js | 2 +-
amd/build/preferences_modal.min.js.map | 2 +-
amd/build/select2.min.js | 2 +-
amd/build/select2.min.js.map | 2 +-
.../dash_framework/query_builder/builder.php | 15 +++-
.../dash_framework/query_builder/join.php | 5 +-
.../dash_framework/query_builder/where.php | 90 ++++++++++++++++++-
.../attribute/abstract_field_attribute.php | 55 ++++++++++++
.../field/attribute/button_attribute.php | 31 +++++++
.../field/attribute/image_attribute.php | 23 +++++
.../field/attribute/link_attribute.php | 34 +++++++
.../field/attribute/linked_icon_attribute.php | 21 +++++
.../field/attribute/moodle_url_attribute.php | 24 +++++
.../field/attribute/percent_attribute.php | 26 ++++++
.../data_source/abstract_data_source.php | 4 +
lang/en/block_dash.php | 72 +++++++++++++++
version.php | 2 +-
27 files changed, 409 insertions(+), 21 deletions(-)
diff --git a/amd/build/contacts.min.js b/amd/build/contacts.min.js
index f69c171..4ca564b 100644
--- a/amd/build/contacts.min.js
+++ b/amd/build/contacts.min.js
@@ -1,3 +1,3 @@
define("block_dash/contacts",["core/str","core/modal_factory","core/modal_events","core/fragment","core/templates","core/notification","core_message/toggle_contact_button"],(function(Str,Modal,ModalEvents,Fragment,Templates,Notification,Contact){return{init:function(contextID){var contactUser,groupModal=document.getElementsByClassName("contact-widget-viewgroup");Array.from(groupModal).forEach((function(element){element.addEventListener("click",(function(e){e.preventDefault();var target=e.target.closest("a");contactUser=target.getAttribute("data-userid"),Modal.create({title:Str.get_string("groups","core")}).then((function(modal){modal.show();var params={widget:"contacts",method:"load_groups",args:JSON.stringify({contactuser:contactUser})};return Fragment.loadFragment("block_dash","loadwidget",contextID,params).then(((html,js)=>(modal.setBody(html),Templates.runTemplateJS(js),html))).catch(Notification.exception),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()})),modal})).catch(Notification.exception)}))}));var contactModal=document.getElementsByClassName("toggle-contact-button");Array.from(contactModal).forEach((function(element){element.addEventListener("click",(function(e){e.preventDefault(),null!=e.target.dataset.userid&&Contact.enhance(e.target)}))}))}}}));
-//# sourceMappingURL=contacts.min.js.map
+//# sourceMappingURL=contacts.min.js.map
\ No newline at end of file
diff --git a/amd/build/contacts.min.js.map b/amd/build/contacts.min.js.map
index fbb12f8..a792a94 100644
--- a/amd/build/contacts.min.js.map
+++ b/amd/build/contacts.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"contacts.min.js","sources":["../src/contacts.js"],"sourcesContent":["define(['core/str', 'core/modal_factory', 'core/modal_events',\r\n'core/fragment', 'core/templates', 'core/notification', 'core_message/toggle_contact_button'],\r\n function(Str, Modal, ModalEvents, Fragment, Templates, Notification, Contact) {\r\n\r\n return {\r\n init: function(contextID) {\r\n var groupModal = document.getElementsByClassName('contact-widget-viewgroup');\r\n var contactUser;\r\n Array.from(groupModal).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n var target = e.target.closest('a');\r\n contactUser = target.getAttribute('data-userid');\r\n Modal.create({\r\n title: Str.get_string('groups', 'core')\r\n }).then(function(modal) {\r\n modal.show();\r\n\r\n var args = JSON.stringify({contactuser: contactUser});\r\n var params = {widget: 'contacts', method: 'load_groups', args: args};\r\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\r\n modal.setBody(html);\r\n Templates.runTemplateJS(js);\r\n return html;\r\n }).catch(Notification.exception);\r\n\r\n modal.getRoot().on(ModalEvents.hidden, function() {\r\n modal.destroy();\r\n });\r\n return modal;\r\n }).catch(Notification.exception);\r\n });\r\n });\r\n\r\n var contactModal = document.getElementsByClassName('toggle-contact-button');\r\n Array.from(contactModal).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n if (e.target.dataset.userid != undefined) {\r\n Contact.enhance(e.target);\r\n }\r\n });\r\n });\r\n }\r\n };\r\n});\r\n"],"names":["define","Str","Modal","ModalEvents","Fragment","Templates","Notification","Contact","init","contextID","contactUser","groupModal","document","getElementsByClassName","Array","from","forEach","element","addEventListener","e","preventDefault","target","closest","getAttribute","create","title","get_string","then","modal","show","params","widget","method","args","JSON","stringify","contactuser","loadFragment","html","js","setBody","runTemplateJS","catch","exception","getRoot","on","hidden","destroy","contactModal","undefined","dataset","userid","enhance"],"mappings":"AAAAA,6BAAO,CAAC,WAAY,qBAAsB,oBAC1C,gBAAiB,iBAAkB,oBAAqB,uCACpD,SAASC,IAAKC,MAAOC,YAAaC,SAAUC,UAAWC,aAAcC,eAE9D,CACHC,KAAM,SAASC,eAEPC,YADAC,WAAaC,SAASC,uBAAuB,4BAEjDC,MAAMC,KAAKJ,YAAYK,SAAQ,SAASC,SACpCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,qBACEC,OAASF,EAAEE,OAAOC,QAAQ,KAC9BZ,YAAcW,OAAOE,aAAa,eAClCrB,MAAMsB,OAAO,CACTC,MAAOxB,IAAIyB,WAAW,SAAU,UACjCC,MAAK,SAASC,OACbA,MAAMC,WAGFC,OAAS,CAACC,OAAQ,WAAYC,OAAQ,cAAeC,KAD9CC,KAAKC,UAAU,CAACC,YAAa1B,sBAExCN,SAASiC,aAAa,aAAc,aAAc5B,UAAWqB,QAAQH,MAAK,CAACW,KAAMC,MAC7EX,MAAMY,QAAQF,MACdjC,UAAUoC,cAAcF,IACjBD,QACRI,MAAMpC,aAAaqC,WAEtBf,MAAMgB,UAAUC,GAAG1C,YAAY2C,QAAQ,WACnClB,MAAMmB,aAEHnB,SACRc,MAAMpC,aAAaqC,qBAI1BK,aAAepC,SAASC,uBAAuB,yBACnDC,MAAMC,KAAKiC,cAAchC,SAAQ,SAASC,SACtCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,iBAC6B6B,MAA3B9B,EAAEE,OAAO6B,QAAQC,QACjB5C,QAAQ6C,QAAQjC,EAAEE"}
\ No newline at end of file
+{"version":3,"file":"contacts.min.js","sources":["../src/contacts.js"],"sourcesContent":["define(['core/str', 'core/modal_factory', 'core/modal_events',\n'core/fragment', 'core/templates', 'core/notification', 'core_message/toggle_contact_button'],\n function(Str, Modal, ModalEvents, Fragment, Templates, Notification, Contact) {\n\n return {\n init: function(contextID) {\n var groupModal = document.getElementsByClassName('contact-widget-viewgroup');\n var contactUser;\n Array.from(groupModal).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n var target = e.target.closest('a');\n contactUser = target.getAttribute('data-userid');\n Modal.create({\n title: Str.get_string('groups', 'core')\n }).then(function(modal) {\n modal.show();\n\n var args = JSON.stringify({contactuser: contactUser});\n var params = {widget: 'contacts', method: 'load_groups', args: args};\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\n modal.setBody(html);\n Templates.runTemplateJS(js);\n return html;\n }).catch(Notification.exception);\n\n modal.getRoot().on(ModalEvents.hidden, function() {\n modal.destroy();\n });\n return modal;\n }).catch(Notification.exception);\n });\n });\n\n var contactModal = document.getElementsByClassName('toggle-contact-button');\n Array.from(contactModal).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n if (e.target.dataset.userid != undefined) {\n Contact.enhance(e.target);\n }\n });\n });\n }\n };\n});\n"],"names":["define","Str","Modal","ModalEvents","Fragment","Templates","Notification","Contact","init","contextID","contactUser","groupModal","document","getElementsByClassName","Array","from","forEach","element","addEventListener","e","preventDefault","target","closest","getAttribute","create","title","get_string","then","modal","show","params","widget","method","args","JSON","stringify","contactuser","loadFragment","html","js","setBody","runTemplateJS","catch","exception","getRoot","on","hidden","destroy","contactModal","undefined","dataset","userid","enhance"],"mappings":"AAAAA,6BAAO,CAAC,WAAY,qBAAsB,oBAC1C,gBAAiB,iBAAkB,oBAAqB,uCACpD,SAASC,IAAKC,MAAOC,YAAaC,SAAUC,UAAWC,aAAcC,eAE9D,CACHC,KAAM,SAASC,eAEPC,YADAC,WAAaC,SAASC,uBAAuB,4BAEjDC,MAAMC,KAAKJ,YAAYK,SAAQ,SAASC,SACpCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,qBACEC,OAASF,EAAEE,OAAOC,QAAQ,KAC9BZ,YAAcW,OAAOE,aAAa,eAClCrB,MAAMsB,OAAO,CACTC,MAAOxB,IAAIyB,WAAW,SAAU,UACjCC,MAAK,SAASC,OACbA,MAAMC,WAGFC,OAAS,CAACC,OAAQ,WAAYC,OAAQ,cAAeC,KAD9CC,KAAKC,UAAU,CAACC,YAAa1B,sBAExCN,SAASiC,aAAa,aAAc,aAAc5B,UAAWqB,QAAQH,MAAK,CAACW,KAAMC,MAC7EX,MAAMY,QAAQF,MACdjC,UAAUoC,cAAcF,IACjBD,QACRI,MAAMpC,aAAaqC,WAEtBf,MAAMgB,UAAUC,GAAG1C,YAAY2C,QAAQ,WACnClB,MAAMmB,aAEHnB,SACRc,MAAMpC,aAAaqC,qBAI1BK,aAAepC,SAASC,uBAAuB,yBACnDC,MAAMC,KAAKiC,cAAchC,SAAQ,SAASC,SACtCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,iBAC6B6B,MAA3B9B,EAAEE,OAAO6B,QAAQC,QACjB5C,QAAQ6C,QAAQjC,EAAEE"}
\ No newline at end of file
diff --git a/amd/build/dash_instance.min.js b/amd/build/dash_instance.min.js
index 3ef281d..06e793e 100644
--- a/amd/build/dash_instance.min.js
+++ b/amd/build/dash_instance.min.js
@@ -1,3 +1,3 @@
define("block_dash/dash_instance",["jquery","jqueryui","core/log","core/ajax","core/notification","core/modal_events","block_dash/preferences_modal","block_dash/datepicker","block_dash/select2","core/fragment","core/templates"],(function($,UI,Log,Ajax,Notification,ModalEvents,PreferencesModal,DatePicker,Select2,Fragment,Templates){var DashInstance=function(root,blockInstanceId,blockContextid,editing,istotara,pagelayout){this.root=$(root),this.blockInstanceId=blockInstanceId,this.blockContextid=blockContextid,this.currentPage=0,this.blockPreferencesModal=null,this.editing=editing,this.sortField=null,this.sortDirections={},this.isTotara=istotara,this.pageLayout=pagelayout,this.init()};return DashInstance.prototype.BLOCK_CONTENT_SELECTOR=".dash-block-content",DashInstance.prototype.FILTER_FORM_SELECTOR=".filter-form",DashInstance.prototype.init=function(){Log.debug("Initializing dash instance",this),this.getRoot().find(".dash-configuration-form").length>0&&(this.getRoot().find(".dash-configuration-form").removeClass("hide"),this.getRoot().find('[data-target="subsource-config"] [type=radio], [name="config_data_source_idnumber"]').addClass("norefresh"),this.getRoot().find(".dash-edit-preferences").hide(),this.getRoot().on("change",'[data-target="subsource-config"] [type=radio]',function(e){var subConfig;(subConfig=e.target.closest('[data-target="subsource-config"]'))&&(null!==subConfig.parentNode&&subConfig.parentNode.querySelector('[name="config_data_source_idnumber"]').click())}.bind(this)),this.getRoot().find('.dash-configuration-form [name="config_data_source_idnumber"]').on("change",function(e){console.log(e),console.log("TEST");var dataSource=this.getRoot().find(".dash-configuration-form"),formData=$(dataSource).find("form").serialize();Ajax.call([{methodname:"block_dash_submit_preferences_form",args:{contextid:this.blockContextid,jsonformdata:JSON.stringify(formData)},done:function(){this.getRoot().find(".dash-edit-preferences").show(),this.refresh()}.bind(this)}])[0].fail(Notification.exception)}.bind(this))),this.initDatePickers(),this.initSelect2(),this.editing&&(this.blockPreferencesModal=new PreferencesModal(this.getRoot().find(".dash-edit-preferences"),this.blockContextid,function(){this.currentPage=0,this.refresh()}.bind(this))),this.getRoot().on("change","select:not(.norefresh), input:not(.select2-search__field, .norefresh)",function(e){e.preventDefault(),Log.debug("Submitting filter form"),Log.debug(e),Log.debug($(e.target).serializeArray()),this.currentPage=0,this.refresh()}.bind(this)),this.getRoot().on("submit",".downloadreport .reportoption form",function(e){e.preventDefault();let params=new URLSearchParams($(e.target).serialize()),sortDirection=null;this.sortField&&this.sortDirections.hasOwnProperty(this.sortField)&&(sortDirection=this.sortDirections[this.sortField]);var args={download:params.get("download"),block_instance_id:this.blockInstanceId,filter_form_data:JSON.stringify(this.getFilterForm().serializeArray()),page:this.currentPage,sort_field:this.sortField,sort_direction:sortDirection};let url=M.cfg.wwwroot+"/blocks/dash/download.php";const form=$("
",{method:"post",action:url,target:"_self"});form.append($("",{type:"hidden",name:"download",value:args.download})),form.append($("",{type:"hidden",name:"block_instance_id",value:args.block_instance_id})),form.append($("",{type:"hidden",name:"filter_form_data",value:args.filter_form_data})),form.append($("",{type:"hidden",name:"page",value:args.page})),form.append($("",{type:"hidden",name:"sort_field",value:args.sort_field})),form.append($("",{type:"hidden",name:"sort_direction",value:args.sort_direction})),form.appendTo("body").submit()}.bind(this)),this.getRoot().on("click","button.tab-filter",function(e){e.preventDefault();var elem=$(e.currentTarget),value=$(e.currentTarget).attr("data-value"),select=$(e.currentTarget).parents(".sort-group").find("select"),prevVal=select.val();if(elem.hasClass("is-checked")){if(elem.removeClass("is-checked"),elem.removeClass("btn-primary"),select.prop("multiple")){var index=prevVal.indexOf(value.toString());index>-1&&(prevVal.splice(index,1),value=prevVal)}}else elem.addClass("is-checked"),elem.addClass("btn-primary"),select.prop("multiple")&&(prevVal.push(value),value=prevVal);select.val(value),this.currentPage=0,this.refresh()}.bind(this)),this.getBlockContentArea().on("click",".page-link",function(e){e.preventDefault(),this.currentPage=$(e.target).data("page"),this.refresh()}.bind(this)),this.getBlockContentArea().on("click",".dash-sort",function(e){const $target=$(e.target);this.sortField=$target.data("sort"),this.sortDirections.hasOwnProperty(this.sortField)?this.sortDirections[this.sortField]="asc"===this.sortDirections[this.sortField]?"desc":"asc":this.sortDirections[this.sortField]="asc",this.refresh()}.bind(this)),this.isTotara&&this.setDynamicTable()},DashInstance.prototype.getRoot=function(){return this.root},DashInstance.prototype.getBlockContentArea=function(){return this.getRoot().find(this.BLOCK_CONTENT_SELECTOR)},DashInstance.prototype.getFilterForm=function(){return this.getRoot().find(this.FILTER_FORM_SELECTOR)},DashInstance.prototype.getBlockContent=function(){let sortDirection=null;this.sortField&&this.sortDirections.hasOwnProperty(this.sortField)&&(sortDirection=this.sortDirections[this.sortField]);var request={methodname:"block_dash_get_block_content",args:{block_instance_id:this.blockInstanceId,filter_form_data:JSON.stringify(this.getFilterForm().serializeArray()),page:this.currentPage,sort_field:this.sortField,sort_direction:sortDirection,pagelayout:this.pageLayout}};return Ajax.call([request])[0]},DashInstance.prototype.refresh=function(){this.getBlockContentArea().css("opacity",.5),this.getBlockContent().then(function(response){this.getBlockContentArea().html(response.html),this.getBlockContentArea().css("opacity",1),this.initDatePickers(),this.initSelect2(),response.scripts&&Templates.runTemplateJS($(response.scripts).html()||response.scripts)}.bind(this)).catch(Notification.exception)},DashInstance.prototype.initDatePickers=function(){this.getRoot().find(".datepicker").datepicker2({autoclose:!0,format:"dd/mm/yyyy"})},DashInstance.prototype.initSelect2=function(){this.getRoot().find(".select2").each(function(index,element){let placeholder=null;$(element).find("option[value='-1']")&&(placeholder={id:"-1",text:$(element).find("option[value='-1']").text()}),$(element).select2({dropdownParent:this.getRoot(),allowClear:!0,theme:"bootstrap4",placeholder:placeholder}).on("select2:unselecting",(function(){$(this).data("unselecting",!0)})).on("select2:opening",(function(e){$(this).data("unselecting")&&($(this).removeData("unselecting"),e.preventDefault())}))}.bind(this))},DashInstance.prototype.setDynamicTable=function(){$("body").delegate('[data-table-dynamic="true"] thead th a',"click",(function(e){e.preventDefault(),updateTable($(this))})),$("body").delegate(".modal-body .paging a","click",(function(e){e.preventDefault(),updateTable($(this))}));var updateTable=function(element){var table=element.parents(".modal-body").find("table"),href=element.attr("href"),params=new URL(href).searchParams,page=params.get("page"),sortfield=params.get("tsort");""==sortfield&&(sortfield=table.data("table-sort"));var tablehandler=table.data("table-handler"),filter=table.data("table-filter"),uniqueid=table.data("table-uniqueid"),context=table.data("table-context"),data={handler:tablehandler,filter:filter,uniqueid:uniqueid,sort:sortfield,page:page};Fragment.loadFragment("block_dash","loadtable",context,data).then(((html,js)=>($(".modal-body").html(html),Templates.runTemplateJS(js),html))).catch(Notification.exception)}},DashInstance}));
-//# sourceMappingURL=dash_instance.min.js.map
+//# sourceMappingURL=dash_instance.min.js.map
\ No newline at end of file
diff --git a/amd/build/dash_instance.min.js.map b/amd/build/dash_instance.min.js.map
index 5828498..9a075ba 100644
--- a/amd/build/dash_instance.min.js.map
+++ b/amd/build/dash_instance.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"dash_instance.min.js","sources":["../src/dash_instance.js"],"sourcesContent":["define(['jquery', 'jqueryui', 'core/log', 'core/ajax', 'core/notification', 'core/modal_events',\r\n 'block_dash/preferences_modal', 'block_dash/datepicker', 'block_dash/select2', 'core/fragment', 'core/templates'],\r\n function($, UI, Log, Ajax, Notification, ModalEvents, PreferencesModal, DatePicker, Select2, Fragment, Templates) {\r\n\r\n var DashInstance = function(root, blockInstanceId, blockContextid, editing, istotara, pagelayout) {\r\n this.root = $(root);\r\n this.blockInstanceId = blockInstanceId;\r\n this.blockContextid = blockContextid;\r\n this.currentPage = 0;\r\n this.blockPreferencesModal = null;\r\n this.editing = editing;\r\n this.sortField = null;\r\n this.sortDirections = {};\r\n this.isTotara = istotara;\r\n this.pageLayout = pagelayout;\r\n this.init();\r\n };\r\n\r\n DashInstance.prototype.BLOCK_CONTENT_SELECTOR = '.dash-block-content';\r\n DashInstance.prototype.FILTER_FORM_SELECTOR = '.filter-form';\r\n\r\n DashInstance.prototype.init = function() {\r\n\r\n Log.debug('Initializing dash instance', this);\r\n\r\n // Select datasource for configuration.\r\n if (this.getRoot().find('.dash-configuration-form').length > 0) {\r\n\r\n this.getRoot().find('.dash-configuration-form').removeClass('hide');\r\n this.getRoot()\r\n .find('[data-target=\"subsource-config\"] [type=radio], [name=\"config_data_source_idnumber\"]')\r\n .addClass('norefresh');\r\n\r\n // Hide the preference link for others.\r\n this.getRoot().find('.dash-edit-preferences').hide();\r\n\r\n // Select the parent datasource for the sub config.\r\n this.getRoot().on('change', '[data-target=\"subsource-config\"] [type=radio]', function(e) {\r\n var subConfig;\r\n if (subConfig = e.target.closest('[data-target=\"subsource-config\"]')) {\r\n if (subConfig.parentNode !== null) {\r\n var dataSource = subConfig.parentNode.querySelector('[name=\"config_data_source_idnumber\"]');\r\n dataSource.click(); // = true;\r\n }\r\n }\r\n }.bind(this));\r\n\r\n this.getRoot().find('.dash-configuration-form [name=\"config_data_source_idnumber\"]').on('change', function(e) {\r\n console.log(e);\r\n console.log(\"TEST\");\r\n var dataSource = this.getRoot().find('.dash-configuration-form');\r\n var formData = $(dataSource).find('form').serialize();\r\n\r\n // Now we can continue...\r\n Ajax.call([{\r\n methodname: 'block_dash_submit_preferences_form',\r\n args: {\r\n contextid: this.blockContextid,\r\n jsonformdata: JSON.stringify(formData)\r\n },\r\n done: function() {\r\n // Hide the preference link for others.\r\n this.getRoot().find('.dash-edit-preferences').show();\r\n this.refresh();\r\n }.bind(this),\r\n }])[0].fail(Notification.exception);\r\n }.bind(this));\r\n\r\n }\r\n\r\n this.initDatePickers();\r\n this.initSelect2();\r\n\r\n if (this.editing) {\r\n this.blockPreferencesModal = new PreferencesModal(this.getRoot().find('.dash-edit-preferences'),\r\n this.blockContextid, function() {\r\n // Preferences changed, go back to first page.\r\n this.currentPage = 0;\r\n this.refresh();\r\n }.bind(this));\r\n }\r\n this.getRoot().on('change', 'select:not(.norefresh), input:not(.select2-search__field, .norefresh)',\r\n function(e) {\r\n e.preventDefault();\r\n\r\n Log.debug('Submitting filter form');\r\n Log.debug(e);\r\n Log.debug($(e.target).serializeArray());\r\n\r\n // Filter results, go back to first page.\r\n this.currentPage = 0;\r\n this.refresh();\r\n }.bind(this));\r\n\r\n this.getRoot().on('submit', '.downloadreport .reportoption form', function(e) {\r\n e.preventDefault();\r\n let params = new URLSearchParams($(e.target).serialize());\r\n let sortDirection = null;\r\n if (this.sortField && this.sortDirections.hasOwnProperty(this.sortField)) {\r\n sortDirection = this.sortDirections[this.sortField];\r\n }\r\n var args = {\r\n 'download' : params.get('download'),\r\n \"block_instance_id\": this.blockInstanceId,\r\n \"filter_form_data\": JSON.stringify(this.getFilterForm().serializeArray()),\r\n \"page\": this.currentPage,\r\n \"sort_field\": this.sortField,\r\n \"sort_direction\": sortDirection,\r\n };\r\n let url = M.cfg.wwwroot + '/blocks/dash/download.php';\r\n // Create a new form element.\r\n const form = $('
', {\r\n method: 'post',\r\n action: url,\r\n target: '_self',\r\n });\r\n\r\n // Add input fields with your data\r\n form.append($('', { type: 'hidden', name: 'download', value: args.download }));\r\n form.append($('', { type: 'hidden', name: 'block_instance_id', value: args.block_instance_id }));\r\n form.append($('', { type: 'hidden', name: 'filter_form_data', value: args.filter_form_data }));\r\n form.append($('', { type: 'hidden', name: 'page', value: args.page }));\r\n form.append($('', { type: 'hidden', name: 'sort_field', value: args.sort_field }));\r\n form.append($('', { type: 'hidden', name: 'sort_direction', value: args.sort_direction }));\r\n\r\n // Append the form to the body and submit it\r\n form.appendTo('body').submit();\r\n\r\n }.bind(this));\r\n\r\n // Adding support for tab filters.\r\n this.getRoot().on('click', 'button.tab-filter', function(e) {\r\n e.preventDefault();\r\n var elem = $(e.currentTarget);\r\n\r\n var value = $(e.currentTarget).attr('data-value');\r\n var select = $(e.currentTarget).parents('.sort-group').find('select');\r\n var prevVal = select.val();\r\n // Remove checked is already checked.\r\n if (elem.hasClass('is-checked')) {\r\n elem.removeClass('is-checked');\r\n elem.removeClass('btn-primary');\r\n if (select.prop('multiple')) {\r\n var index = prevVal.indexOf(value.toString());\r\n if (index > -1) {\r\n prevVal.splice(index, 1);\r\n value = prevVal;\r\n }\r\n }\r\n } else {\r\n elem.addClass('is-checked');\r\n elem.addClass('btn-primary');\r\n if (select.prop('multiple')) {\r\n prevVal.push(value);\r\n value = prevVal;\r\n }\r\n }\r\n // Set value for select.\r\n select.val(value);\r\n // Filter results, go back to first page.\r\n this.currentPage = 0;\r\n this.refresh();\r\n }.bind(this));\r\n\r\n this.getBlockContentArea().on('click', '.page-link', function(e) {\r\n e.preventDefault();\r\n\t\t\t\tthis.currentPage = $(e.target).data('page');\r\n this.refresh();\r\n }.bind(this));\r\n\r\n this.getBlockContentArea().on('click', '.dash-sort', function(e) {\r\n const $target = $(e.target);\r\n this.sortField = $target.data('sort');\r\n\r\n // Set sorting to asc by default.\r\n if (!this.sortDirections.hasOwnProperty(this.sortField)) {\r\n this.sortDirections[this.sortField] = 'asc';\r\n } else {\r\n // Toggle sort direction on field.\r\n this.sortDirections[this.sortField] = this.sortDirections[this.sortField] === 'asc' ? 'desc' : 'asc';\r\n }\r\n this.refresh();\r\n }.bind(this));\r\n\r\n if (this.isTotara) {\r\n this.setDynamicTable();\r\n }\r\n };\r\n\r\n /**\r\n * Get the root element of this dash instance.\r\n *\r\n * @method getRoot\r\n * @return {object} jQuery object\r\n */\r\n DashInstance.prototype.getRoot = function() {\r\n return this.root;\r\n };\r\n\r\n /**\r\n * Get the content element of this dash instance.\r\n *\r\n * @method getRoot\r\n * @return {object} jQuery object\r\n */\r\n DashInstance.prototype.getBlockContentArea = function() {\r\n return this.getRoot().find(this.BLOCK_CONTENT_SELECTOR);\r\n };\r\n\r\n /**\r\n * Get filter form element.\r\n *\r\n * @returns {object} jQuery object\r\n */\r\n DashInstance.prototype.getFilterForm = function() {\r\n return this.getRoot().find(this.FILTER_FORM_SELECTOR);\r\n };\r\n\r\n DashInstance.prototype.getBlockContent = function() {\r\n let sortDirection = null;\r\n if (this.sortField && this.sortDirections.hasOwnProperty(this.sortField)) {\r\n sortDirection = this.sortDirections[this.sortField];\r\n }\r\n\r\n var request = {\r\n methodname: 'block_dash_get_block_content',\r\n args: {\r\n \"block_instance_id\": this.blockInstanceId,\r\n \"filter_form_data\": JSON.stringify(this.getFilterForm().serializeArray()),\r\n \"page\": this.currentPage,\r\n \"sort_field\": this.sortField,\r\n \"sort_direction\": sortDirection,\r\n \"pagelayout\" : this.pageLayout,\r\n }\r\n };\r\n return Ajax.call([request])[0];\r\n };\r\n\r\n DashInstance.prototype.refresh = function() {\r\n this.getBlockContentArea().css('opacity', 0.5);\r\n this.getBlockContent()\r\n .then(function(response) {\r\n this.getBlockContentArea().html(response.html);\r\n this.getBlockContentArea().css('opacity', 1);\r\n this.initDatePickers();\r\n this.initSelect2();\r\n if (response.scripts) {\r\n Templates.runTemplateJS($(response.scripts).html() || response.scripts);\r\n }\r\n }.bind(this))\r\n .catch(Notification.exception);\r\n };\r\n\r\n DashInstance.prototype.initDatePickers = function() {\r\n this.getRoot().find('.datepicker').datepicker2({\r\n autoclose: true,\r\n format: \"dd/mm/yyyy\"\r\n });\r\n };\r\n\r\n DashInstance.prototype.initSelect2 = function() {\r\n this.getRoot().find('.select2').each(function(index, element) {\r\n let placeholder = null;\r\n if ($(element).find(\"option[value='-1']\")) {\r\n placeholder = {\r\n id: '-1', // The value of the option.\r\n text: $(element).find(\"option[value='-1']\").text()\r\n };\r\n }\r\n $(element).select2({\r\n dropdownParent: this.getRoot(),\r\n allowClear: true,\r\n theme: 'bootstrap4',\r\n placeholder: placeholder\r\n }).on('select2:unselecting', function() {\r\n $(this).data('unselecting', true);\r\n }).on('select2:opening', function(e) {\r\n if ($(this).data('unselecting')) {\r\n $(this).removeData('unselecting');\r\n e.preventDefault();\r\n }\r\n });\r\n }.bind(this));\r\n };\r\n\r\n DashInstance.prototype.setDynamicTable = function() {\r\n\r\n $('body').delegate('[data-table-dynamic=\"true\"] thead th a', 'click', function(e) {\r\n e.preventDefault();\r\n updateTable($(this));\r\n });\r\n\r\n $('body').delegate('.modal-body .paging a', 'click', function(e) {\r\n e.preventDefault();\r\n updateTable($(this));\r\n });\r\n\r\n var updateTable = function(element) {\r\n var table = element.parents('.modal-body').find('table');\r\n\r\n var href = element.attr('href');\r\n var params = new URL(href).searchParams;\r\n var page = params.get('page');\r\n var sortfield = params.get('tsort');\r\n if (sortfield == '') {\r\n sortfield = table.data('table-sort');\r\n }\r\n\r\n var tablehandler = table.data('table-handler');\r\n var filter = table.data('table-filter');\r\n var uniqueid = table.data('table-uniqueid');\r\n var context = table.data('table-context');\r\n\r\n var data = {\r\n handler: tablehandler,\r\n filter: filter,\r\n uniqueid: uniqueid,\r\n sort: sortfield,\r\n page: page\r\n };\r\n\r\n Fragment.loadFragment('block_dash', 'loadtable', context, data).then((html, js) => {\r\n $('.modal-body').html(html);\r\n Templates.runTemplateJS(js);\r\n return html;\r\n }).catch(Notification.exception);\r\n };\r\n };\r\n\r\n return DashInstance;\r\n });\r\n"],"names":["define","$","UI","Log","Ajax","Notification","ModalEvents","PreferencesModal","DatePicker","Select2","Fragment","Templates","DashInstance","root","blockInstanceId","blockContextid","editing","istotara","pagelayout","currentPage","blockPreferencesModal","sortField","sortDirections","isTotara","pageLayout","init","prototype","BLOCK_CONTENT_SELECTOR","FILTER_FORM_SELECTOR","debug","this","getRoot","find","length","removeClass","addClass","hide","on","e","subConfig","target","closest","parentNode","querySelector","click","bind","console","log","dataSource","formData","serialize","call","methodname","args","contextid","jsonformdata","JSON","stringify","done","show","refresh","fail","exception","initDatePickers","initSelect2","preventDefault","serializeArray","params","URLSearchParams","sortDirection","hasOwnProperty","get","getFilterForm","url","M","cfg","wwwroot","form","method","action","append","type","name","value","download","block_instance_id","filter_form_data","page","sort_field","sort_direction","appendTo","submit","elem","currentTarget","attr","select","parents","prevVal","val","hasClass","prop","index","indexOf","toString","splice","push","getBlockContentArea","data","$target","setDynamicTable","getBlockContent","request","css","then","response","html","scripts","runTemplateJS","catch","datepicker2","autoclose","format","each","element","placeholder","id","text","select2","dropdownParent","allowClear","theme","removeData","delegate","updateTable","table","href","URL","searchParams","sortfield","tablehandler","filter","uniqueid","context","handler","sort","loadFragment","js"],"mappings":"AAAAA,kCAAO,CAAC,SAAU,WAAY,WAAY,YAAa,oBAAqB,oBACxE,+BAAgC,wBAAyB,qBAAsB,gBAAiB,mBAChG,SAASC,EAAGC,GAAIC,IAAKC,KAAMC,aAAcC,YAAaC,iBAAkBC,WAAYC,QAASC,SAAUC,eAE/FC,aAAe,SAASC,KAAMC,gBAAiBC,eAAgBC,QAASC,SAAUC,iBAC7EL,KAAOZ,EAAEY,WACTC,gBAAkBA,qBAClBC,eAAiBA,oBACjBI,YAAc,OACdC,sBAAwB,UACxBJ,QAAUA,aACVK,UAAY,UACZC,eAAiB,QACjBC,SAAWN,cACXO,WAAaN,gBACbO,eAGTb,aAAac,UAAUC,uBAAyB,sBAChDf,aAAac,UAAUE,qBAAuB,eAE9ChB,aAAac,UAAUD,KAAO,WAE1BtB,IAAI0B,MAAM,6BAA8BC,MAGpCA,KAAKC,UAAUC,KAAK,4BAA4BC,OAAS,SAEpDF,UAAUC,KAAK,4BAA4BE,YAAY,aACvDH,UACAC,KAAK,uFACLG,SAAS,kBAGTJ,UAAUC,KAAK,0BAA0BI,YAGzCL,UAAUM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,UACNnD,KAAMA,MAGV7E,SAASuI,aAAa,aAAc,YAAaH,QAASnC,MAAMM,MAAK,CAACE,KAAM+B,MACxEjJ,EAAE,eAAekH,KAAKA,MACtBxG,UAAU0G,cAAc6B,IACjB/B,QACRG,MAAMjH,aAAayD,aAIvBlD"}
\ No newline at end of file
+{"version":3,"file":"dash_instance.min.js","sources":["../src/dash_instance.js"],"sourcesContent":["define(['jquery', 'jqueryui', 'core/log', 'core/ajax', 'core/notification', 'core/modal_events',\n 'block_dash/preferences_modal', 'block_dash/datepicker', 'block_dash/select2', 'core/fragment', 'core/templates'],\n function($, UI, Log, Ajax, Notification, ModalEvents, PreferencesModal, DatePicker, Select2, Fragment, Templates) {\n\n var DashInstance = function(root, blockInstanceId, blockContextid, editing, istotara, pagelayout) {\n this.root = $(root);\n this.blockInstanceId = blockInstanceId;\n this.blockContextid = blockContextid;\n this.currentPage = 0;\n this.blockPreferencesModal = null;\n this.editing = editing;\n this.sortField = null;\n this.sortDirections = {};\n this.isTotara = istotara;\n this.pageLayout = pagelayout;\n this.init();\n };\n\n DashInstance.prototype.BLOCK_CONTENT_SELECTOR = '.dash-block-content';\n DashInstance.prototype.FILTER_FORM_SELECTOR = '.filter-form';\n\n DashInstance.prototype.init = function() {\n\n Log.debug('Initializing dash instance', this);\n\n // Select datasource for configuration.\n if (this.getRoot().find('.dash-configuration-form').length > 0) {\n\n this.getRoot().find('.dash-configuration-form').removeClass('hide');\n this.getRoot()\n .find('[data-target=\"subsource-config\"] [type=radio], [name=\"config_data_source_idnumber\"]')\n .addClass('norefresh');\n\n // Hide the preference link for others.\n this.getRoot().find('.dash-edit-preferences').hide();\n\n // Select the parent datasource for the sub config.\n this.getRoot().on('change', '[data-target=\"subsource-config\"] [type=radio]', function(e) {\n var subConfig;\n if (subConfig = e.target.closest('[data-target=\"subsource-config\"]')) {\n if (subConfig.parentNode !== null) {\n var dataSource = subConfig.parentNode.querySelector('[name=\"config_data_source_idnumber\"]');\n dataSource.click(); // = true;\n }\n }\n }.bind(this));\n\n this.getRoot().find('.dash-configuration-form [name=\"config_data_source_idnumber\"]').on('change', function(e) {\n console.log(e);\n console.log(\"TEST\");\n var dataSource = this.getRoot().find('.dash-configuration-form');\n var formData = $(dataSource).find('form').serialize();\n\n // Now we can continue...\n Ajax.call([{\n methodname: 'block_dash_submit_preferences_form',\n args: {\n contextid: this.blockContextid,\n jsonformdata: JSON.stringify(formData)\n },\n done: function() {\n // Hide the preference link for others.\n this.getRoot().find('.dash-edit-preferences').show();\n this.refresh();\n }.bind(this),\n }])[0].fail(Notification.exception);\n }.bind(this));\n\n }\n\n this.initDatePickers();\n this.initSelect2();\n\n if (this.editing) {\n this.blockPreferencesModal = new PreferencesModal(this.getRoot().find('.dash-edit-preferences'),\n this.blockContextid, function() {\n // Preferences changed, go back to first page.\n this.currentPage = 0;\n this.refresh();\n }.bind(this));\n }\n this.getRoot().on('change', 'select:not(.norefresh), input:not(.select2-search__field, .norefresh)',\n function(e) {\n e.preventDefault();\n\n Log.debug('Submitting filter form');\n Log.debug(e);\n Log.debug($(e.target).serializeArray());\n\n // Filter results, go back to first page.\n this.currentPage = 0;\n this.refresh();\n }.bind(this));\n\n this.getRoot().on('submit', '.downloadreport .reportoption form', function(e) {\n e.preventDefault();\n let params = new URLSearchParams($(e.target).serialize());\n let sortDirection = null;\n if (this.sortField && this.sortDirections.hasOwnProperty(this.sortField)) {\n sortDirection = this.sortDirections[this.sortField];\n }\n var args = {\n 'download' : params.get('download'),\n \"block_instance_id\": this.blockInstanceId,\n \"filter_form_data\": JSON.stringify(this.getFilterForm().serializeArray()),\n \"page\": this.currentPage,\n \"sort_field\": this.sortField,\n \"sort_direction\": sortDirection,\n };\n let url = M.cfg.wwwroot + '/blocks/dash/download.php';\n // Create a new form element.\n const form = $('
', {\n method: 'post',\n action: url,\n target: '_self',\n });\n\n // Add input fields with your data\n form.append($('', { type: 'hidden', name: 'download', value: args.download }));\n form.append($('', { type: 'hidden', name: 'block_instance_id', value: args.block_instance_id }));\n form.append($('', { type: 'hidden', name: 'filter_form_data', value: args.filter_form_data }));\n form.append($('', { type: 'hidden', name: 'page', value: args.page }));\n form.append($('', { type: 'hidden', name: 'sort_field', value: args.sort_field }));\n form.append($('', { type: 'hidden', name: 'sort_direction', value: args.sort_direction }));\n\n // Append the form to the body and submit it\n form.appendTo('body').submit();\n\n }.bind(this));\n\n // Adding support for tab filters.\n this.getRoot().on('click', 'button.tab-filter', function(e) {\n e.preventDefault();\n var elem = $(e.currentTarget);\n\n var value = $(e.currentTarget).attr('data-value');\n var select = $(e.currentTarget).parents('.sort-group').find('select');\n var prevVal = select.val();\n // Remove checked is already checked.\n if (elem.hasClass('is-checked')) {\n elem.removeClass('is-checked');\n elem.removeClass('btn-primary');\n if (select.prop('multiple')) {\n var index = prevVal.indexOf(value.toString());\n if (index > -1) {\n prevVal.splice(index, 1);\n value = prevVal;\n }\n }\n } else {\n elem.addClass('is-checked');\n elem.addClass('btn-primary');\n if (select.prop('multiple')) {\n prevVal.push(value);\n value = prevVal;\n }\n }\n // Set value for select.\n select.val(value);\n // Filter results, go back to first page.\n this.currentPage = 0;\n this.refresh();\n }.bind(this));\n\n this.getBlockContentArea().on('click', '.page-link', function(e) {\n e.preventDefault();\n\t\t\t\tthis.currentPage = $(e.target).data('page');\n this.refresh();\n }.bind(this));\n\n this.getBlockContentArea().on('click', '.dash-sort', function(e) {\n const $target = $(e.target);\n this.sortField = $target.data('sort');\n\n // Set sorting to asc by default.\n if (!this.sortDirections.hasOwnProperty(this.sortField)) {\n this.sortDirections[this.sortField] = 'asc';\n } else {\n // Toggle sort direction on field.\n this.sortDirections[this.sortField] = this.sortDirections[this.sortField] === 'asc' ? 'desc' : 'asc';\n }\n this.refresh();\n }.bind(this));\n\n if (this.isTotara) {\n this.setDynamicTable();\n }\n };\n\n /**\n * Get the root element of this dash instance.\n *\n * @method getRoot\n * @return {object} jQuery object\n */\n DashInstance.prototype.getRoot = function() {\n return this.root;\n };\n\n /**\n * Get the content element of this dash instance.\n *\n * @method getRoot\n * @return {object} jQuery object\n */\n DashInstance.prototype.getBlockContentArea = function() {\n return this.getRoot().find(this.BLOCK_CONTENT_SELECTOR);\n };\n\n /**\n * Get filter form element.\n *\n * @returns {object} jQuery object\n */\n DashInstance.prototype.getFilterForm = function() {\n return this.getRoot().find(this.FILTER_FORM_SELECTOR);\n };\n\n DashInstance.prototype.getBlockContent = function() {\n let sortDirection = null;\n if (this.sortField && this.sortDirections.hasOwnProperty(this.sortField)) {\n sortDirection = this.sortDirections[this.sortField];\n }\n\n var request = {\n methodname: 'block_dash_get_block_content',\n args: {\n \"block_instance_id\": this.blockInstanceId,\n \"filter_form_data\": JSON.stringify(this.getFilterForm().serializeArray()),\n \"page\": this.currentPage,\n \"sort_field\": this.sortField,\n \"sort_direction\": sortDirection,\n \"pagelayout\" : this.pageLayout,\n }\n };\n return Ajax.call([request])[0];\n };\n\n DashInstance.prototype.refresh = function() {\n this.getBlockContentArea().css('opacity', 0.5);\n this.getBlockContent()\n .then(function(response) {\n this.getBlockContentArea().html(response.html);\n this.getBlockContentArea().css('opacity', 1);\n this.initDatePickers();\n this.initSelect2();\n if (response.scripts) {\n Templates.runTemplateJS($(response.scripts).html() || response.scripts);\n }\n }.bind(this))\n .catch(Notification.exception);\n };\n\n DashInstance.prototype.initDatePickers = function() {\n this.getRoot().find('.datepicker').datepicker2({\n autoclose: true,\n format: \"dd/mm/yyyy\"\n });\n };\n\n DashInstance.prototype.initSelect2 = function() {\n this.getRoot().find('.select2').each(function(index, element) {\n let placeholder = null;\n if ($(element).find(\"option[value='-1']\")) {\n placeholder = {\n id: '-1', // The value of the option.\n text: $(element).find(\"option[value='-1']\").text()\n };\n }\n $(element).select2({\n dropdownParent: this.getRoot(),\n allowClear: true,\n theme: 'bootstrap4',\n placeholder: placeholder\n }).on('select2:unselecting', function() {\n $(this).data('unselecting', true);\n }).on('select2:opening', function(e) {\n if ($(this).data('unselecting')) {\n $(this).removeData('unselecting');\n e.preventDefault();\n }\n });\n }.bind(this));\n };\n\n DashInstance.prototype.setDynamicTable = function() {\n\n $('body').delegate('[data-table-dynamic=\"true\"] thead th a', 'click', function(e) {\n e.preventDefault();\n updateTable($(this));\n });\n\n $('body').delegate('.modal-body .paging a', 'click', function(e) {\n e.preventDefault();\n updateTable($(this));\n });\n\n var updateTable = function(element) {\n var table = element.parents('.modal-body').find('table');\n\n var href = element.attr('href');\n var params = new URL(href).searchParams;\n var page = params.get('page');\n var sortfield = params.get('tsort');\n if (sortfield == '') {\n sortfield = table.data('table-sort');\n }\n\n var tablehandler = table.data('table-handler');\n var filter = table.data('table-filter');\n var uniqueid = table.data('table-uniqueid');\n var context = table.data('table-context');\n\n var data = {\n handler: tablehandler,\n filter: filter,\n uniqueid: uniqueid,\n sort: sortfield,\n page: page\n };\n\n Fragment.loadFragment('block_dash', 'loadtable', context, data).then((html, js) => {\n $('.modal-body').html(html);\n Templates.runTemplateJS(js);\n return html;\n }).catch(Notification.exception);\n };\n };\n\n return DashInstance;\n });\n"],"names":["define","$","UI","Log","Ajax","Notification","ModalEvents","PreferencesModal","DatePicker","Select2","Fragment","Templates","DashInstance","root","blockInstanceId","blockContextid","editing","istotara","pagelayout","currentPage","blockPreferencesModal","sortField","sortDirections","isTotara","pageLayout","init","prototype","BLOCK_CONTENT_SELECTOR","FILTER_FORM_SELECTOR","debug","this","getRoot","find","length","removeClass","addClass","hide","on","e","subConfig","target","closest","parentNode","querySelector","click","bind","console","log","dataSource","formData","serialize","call","methodname","args","contextid","jsonformdata","JSON","stringify","done","show","refresh","fail","exception","initDatePickers","initSelect2","preventDefault","serializeArray","params","URLSearchParams","sortDirection","hasOwnProperty","get","getFilterForm","url","M","cfg","wwwroot","form","method","action","append","type","name","value","download","block_instance_id","filter_form_data","page","sort_field","sort_direction","appendTo","submit","elem","currentTarget","attr","select","parents","prevVal","val","hasClass","prop","index","indexOf","toString","splice","push","getBlockContentArea","data","$target","setDynamicTable","getBlockContent","request","css","then","response","html","scripts","runTemplateJS","catch","datepicker2","autoclose","format","each","element","placeholder","id","text","select2","dropdownParent","allowClear","theme","removeData","delegate","updateTable","table","href","URL","searchParams","sortfield","tablehandler","filter","uniqueid","context","handler","sort","loadFragment","js"],"mappings":"AAAAA,kCAAO,CAAC,SAAU,WAAY,WAAY,YAAa,oBAAqB,oBACxE,+BAAgC,wBAAyB,qBAAsB,gBAAiB,mBAChG,SAASC,EAAGC,GAAIC,IAAKC,KAAMC,aAAcC,YAAaC,iBAAkBC,WAAYC,QAASC,SAAUC,eAE/FC,aAAe,SAASC,KAAMC,gBAAiBC,eAAgBC,QAASC,SAAUC,iBAC7EL,KAAOZ,EAAEY,WACTC,gBAAkBA,qBAClBC,eAAiBA,oBACjBI,YAAc,OACdC,sBAAwB,UACxBJ,QAAUA,aACVK,UAAY,UACZC,eAAiB,QACjBC,SAAWN,cACXO,WAAaN,gBACbO,eAGTb,aAAac,UAAUC,uBAAyB,sBAChDf,aAAac,UAAUE,qBAAuB,eAE9ChB,aAAac,UAAUD,KAAO,WAE1BtB,IAAI0B,MAAM,6BAA8BC,MAGpCA,KAAKC,UAAUC,KAAK,4BAA4BC,OAAS,SAEpDF,UAAUC,KAAK,4BAA4BE,YAAY,aACvDH,UACAC,KAAK,uFACLG,SAAS,kBAGTJ,UAAUC,KAAK,0BAA0BI,YAGzCL,UAAUM,GAAG,SAAU,gDAAiD,SAASC,OAC9EC,WACAA,UAAYD,EAAEE,OAAOC,QAAQ,uCACA,OAAzBF,UAAUG,YACOH,UAAUG,WAAWC,cAAc,wCACzCC,UAGrBC,KAAKf,YAEFC,UAAUC,KAAK,iEAAiEK,GAAG,SAAU,SAASC,GACvGQ,QAAQC,IAAIT,GACZQ,QAAQC,IAAI,YACRC,WAAalB,KAAKC,UAAUC,KAAK,4BACjCiB,SAAWhD,EAAE+C,YAAYhB,KAAK,QAAQkB,YAG1C9C,KAAK+C,KAAK,CAAC,CACPC,WAAY,qCACZC,KAAM,CACFC,UAAWxB,KAAKf,eAChBwC,aAA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AG,uBAAuB,WACzBpC,EAAE6B,MAAM6E,KAAK,eAAe,MAC7BtE,GAAG,mBAAmB,SAASC,GAC1BrC,EAAE6B,MAAM6E,KAAK,iBACb1G,EAAE6B,MAAMqG,WAAW,eACnB7F,EAAE2B,sBAGZpB,KAAKf,QAGXlB,aAAac,UAAUmF,gBAAkB,WAErC5G,EAAE,QAAQmI,SAAS,yCAA0C,SAAS,SAAS9F,GAC3EA,EAAE2B,iBACFoE,YAAYpI,EAAE6B,UAGlB7B,EAAE,QAAQmI,SAAS,wBAAyB,SAAS,SAAS9F,GAC1DA,EAAE2B,iBACFoE,YAAYpI,EAAE6B,cAGduG,YAAc,SAASV,aACnBW,MAAQX,QAAQ3B,QAAQ,eAAehE,KAAK,SAE5CuG,KAAOZ,QAAQ7B,KAAK,QACpB3B,OAAS,IAAIqE,IAAID,MAAME,aACvBlD,KAAOpB,OAAOI,IAAI,QAClBmE,UAAYvE,OAAOI,IAAI,SACV,IAAbmE,YACAA,UAAYJ,MAAM3B,KAAK,mBAGvBgC,aAAeL,MAAM3B,KAAK,iBAC1BiC,OAASN,MAAM3B,KAAK,gBACpBkC,SAAWP,MAAM3B,KAAK,kBACtBmC,QAAUR,MAAM3B,KAAK,iBAErBA,KAAO,CACPoC,QAASJ,aACTC,OAAQA,OACRC,SAAUA,SACVG,KAAMN,UACNnD,KAAMA,MAGV7E,SAASuI,aAAa,aAAc,YAAaH,QAASnC,MAAMM,MAAK,CAACE,KAAM+B,MACxEjJ,EAAE,eAAekH,KAAKA,MACtBxG,UAAU0G,cAAc6B,IACjB/B,QACRG,MAAMjH,aAAayD,aAIvBlD"}
\ No newline at end of file
diff --git a/amd/build/datepicker.min.js b/amd/build/datepicker.min.js
index 82811c6..3d48a02 100644
--- a/amd/build/datepicker.min.js
+++ b/amd/build/datepicker.min.js
@@ -1,3 +1,3 @@
var factory;factory=function($,undefined$1){function UTCDate(){return new Date(Date.UTC.apply(Date,arguments))}function UTCToday(){var today=new Date;return UTCDate(today.getFullYear(),today.getMonth(),today.getDate())}function isUTCEquals(date1,date2){return date1.getUTCFullYear()===date2.getUTCFullYear()&&date1.getUTCMonth()===date2.getUTCMonth()&&date1.getUTCDate()===date2.getUTCDate()}function alias(method,deprecationMsg){return function(){return deprecationMsg!==undefined$1&&$.fn.datepicker2.deprecated(deprecationMsg),this[method].apply(this,arguments)}}var extras,DateArray=(extras={get:function(i){return this.slice(i)[0]},contains:function(d){for(var val=d&&d.valueOf(),i=0,l=this.length;i]/g)||[]).length<=0||$(tmp).length>0)}catch(ex){return!1}},_process_options:function(opts){this._o=$.extend({},this._o,opts);var o=this.o=$.extend({},this._o),lang=o.language;dates[lang]||(lang=lang.split("-")[0],dates[lang]||(lang=defaults.language)),o.language=lang,o.startView=this._resolveViewName(o.startView),o.minViewMode=this._resolveViewName(o.minViewMode),o.maxViewMode=this._resolveViewName(o.maxViewMode),o.startView=Math.max(this.o.minViewMode,Math.min(this.o.maxViewMode,o.startView)),!0!==o.multidate&&(o.multidate=Number(o.multidate)||!1,!1!==o.multidate&&(o.multidate=Math.max(0,o.multidate))),o.multidateSeparator=String(o.multidateSeparator),o.weekStart%=7,o.weekEnd=(o.weekStart+6)%7;var format=DPGlobal.parseFormat(o.format);o.startDate!==-1/0&&(o.startDate?o.startDate instanceof Date?o.startDate=this._local_to_utc(this._zero_time(o.startDate)):o.startDate=DPGlobal.parseDate(o.startDate,format,o.language,o.assumeNearbyYear):o.startDate=-1/0),o.endDate!==1/0&&(o.endDate?o.endDate instanceof Date?o.endDate=this._local_to_utc(this._zero_time(o.endDate)):o.endDate=DPGlobal.parseDate(o.endDate,format,o.language,o.assumeNearbyYear):o.endDate=1/0),o.daysOfWeekDisabled=this._resolveDaysOfWeek(o.daysOfWeekDisabled||[]),o.daysOfWeekHighlighted=this._resolveDaysOfWeek(o.daysOfWeekHighlighted||[]),o.datesDisabled=o.datesDisabled||[],$.isArray(o.datesDisabled)||(o.datesDisabled=o.datesDisabled.split(",")),o.datesDisabled=$.map(o.datesDisabled,(function(d){return DPGlobal.parseDate(d,format,o.language,o.assumeNearbyYear)}));var plc=String(o.orientation).toLowerCase().split(/\s+/g),_plc=o.orientation.toLowerCase();if(plc=$.grep(plc,(function(word){return/^auto|left|right|top|bottom$/.test(word)})),o.orientation={x:"auto",y:"auto"},_plc&&"auto"!==_plc)if(1===plc.length)switch(plc[0]){case"top":case"bottom":o.orientation.y=plc[0];break;case"left":case"right":o.orientation.x=plc[0]}else _plc=$.grep(plc,(function(word){return/^left|right$/.test(word)})),o.orientation.x=_plc[0]||"auto",_plc=$.grep(plc,(function(word){return/^top|bottom$/.test(word)})),o.orientation.y=_plc[0]||"auto";if(o.defaultViewDate instanceof Date||"string"==typeof o.defaultViewDate)o.defaultViewDate=DPGlobal.parseDate(o.defaultViewDate,format,o.language,o.assumeNearbyYear);else if(o.defaultViewDate){var year=o.defaultViewDate.year||(new Date).getFullYear(),month=o.defaultViewDate.month||0,day=o.defaultViewDate.day||1;o.defaultViewDate=UTCDate(year,month,day)}else o.defaultViewDate=UTCToday()},_applyEvents:function(evs){for(var el,ch,ev,i=0;iwindowWidth?(this.picker.addClass("datepicker2-orient-right"),left+=width-calendarWidth):this.o.rtl?this.picker.addClass("datepicker2-orient-right"):this.picker.addClass("datepicker2-orient-left");var yorient=this.o.orientation.y;if("auto"===yorient&&(yorient=-scrollTop+top-calendarHeight<0?"bottom":"top"),this.picker.addClass("datepicker2-orient-"+yorient),"top"===yorient?top-=calendarHeight+parseInt(this.picker.css("padding-top")):top+=height,this.o.rtl){var right=windowWidth-(left+width);this.picker.css({top:top,right:right,zIndex:zIndex})}else this.picker.css({top:top,left:left,zIndex:zIndex});return this},_allow_update:!0,update:function(){if(!this._allow_update)return this;var oldDates=this.dates.copy(),dates=[],fromArgs=!1;return arguments.length?($.each(arguments,$.proxy((function(i,date){date instanceof Date&&(date=this._local_to_utc(date)),dates.push(date)}),this)),fromArgs=!0):(dates=(dates=this.isInput?this.element.val():this.element.data("date")||this.inputField.val())&&this.o.multidate?dates.split(this.o.multidateSeparator):[dates],delete this.element.data().date),dates=$.map(dates,$.proxy((function(date){return DPGlobal.parseDate(date,this.o.format,this.o.language,this.o.assumeNearbyYear)}),this)),dates=$.grep(dates,$.proxy((function(date){return!this.dateWithinRange(date)||!date}),this),!0),this.dates.replace(dates),this.o.updateViewDate&&(this.dates.length?this.viewDate=new Date(this.dates.get(-1)):this.viewDatethis.o.endDate?this.viewDate=new Date(this.o.endDate):this.viewDate=this.o.defaultViewDate),fromArgs?(this.setValue(),this.element.change()):this.dates.length&&String(oldDates)!==String(this.dates)&&fromArgs&&(this._trigger("changeDate"),this.element.change()),!this.dates.length&&oldDates.length&&(this._trigger("clearDate"),this.element.change()),this.fill(),this},fillDow:function(){if(this.o.showWeekDays){var dowCnt=this.o.weekStart,html="
",$.fn.datepicker2.DPGlobal=DPGlobal,$.fn.datepicker2.noConflict=function(){return $.fn.datepicker2=old,this},$.fn.datepicker2.version="1.9.0",$.fn.datepicker2.deprecated=function(msg){var console=window.console;console&&console.warn&&console.warn("DEPRECATED: "+msg)},$(document).on("focus.datepicker2.data-api click.datepicker2.data-api",'[data-provide="datepicker2"]',(function(e){var $this=$(this);$this.data("datepicker2")||(e.preventDefault(),datepicker2Plugin.call($this,"show"))})),$((function(){datepicker2Plugin.call($('[data-provide="datepicker2-inline"]'))}))},"function"==typeof define&&define.amd?define("block_dash/datepicker",["jquery"],factory):"object"==typeof exports?factory(require("jquery")):factory(jQuery);
-//# sourceMappingURL=datepicker.min.js.map
+//# sourceMappingURL=datepicker.min.js.map
\ No newline at end of file
diff --git a/amd/build/datepicker.min.js.map b/amd/build/datepicker.min.js.map
index a8f533a..0434eba 100644
--- a/amd/build/datepicker.min.js.map
+++ b/amd/build/datepicker.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"datepicker.min.js","sources":["../src/datepicker.js"],"sourcesContent":["/*!\r\n * Datepicker2 for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker2)\r\n *\r\n * Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)\r\n */\r\n\r\n(function(factory){\r\n if (typeof define === 'function' && define.amd) {\r\n define(['jquery'], factory);\r\n } else if (typeof exports === 'object') {\r\n factory(require('jquery'));\r\n } else {\r\n factory(jQuery);\r\n }\r\n}(function($, undefined){\r\n function UTCDate(){\r\n return new Date(Date.UTC.apply(Date, arguments));\r\n }\r\n function UTCToday(){\r\n var today = new Date();\r\n return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());\r\n }\r\n function isUTCEquals(date1, date2) {\r\n return (\r\n date1.getUTCFullYear() === date2.getUTCFullYear() &&\r\n date1.getUTCMonth() === date2.getUTCMonth() &&\r\n date1.getUTCDate() === date2.getUTCDate()\r\n );\r\n }\r\n function alias(method, deprecationMsg){\r\n return function(){\r\n if (deprecationMsg !== undefined) {\r\n $.fn.datepicker2.deprecated(deprecationMsg);\r\n }\r\n\r\n return this[method].apply(this, arguments);\r\n };\r\n }\r\n function isValidDate(d) {\r\n return d && !isNaN(d.getTime());\r\n }\r\n\r\n var DateArray = (function(){\r\n var extras = {\r\n get: function(i){\r\n return this.slice(i)[0];\r\n },\r\n contains: function(d){\r\n // Array.indexOf is not cross-browser;\r\n // $.inArray doesn't work with Dates\r\n var val = d && d.valueOf();\r\n for (var i=0, l=this.length; i < l; i++)\r\n // Use date arithmetic to allow dates with different times to match\r\n if (0 <= this[i].valueOf() - val && this[i].valueOf() - val < 1000*60*60*24)\r\n return i;\r\n return -1;\r\n },\r\n remove: function(i){\r\n this.splice(i,1);\r\n },\r\n replace: function(new_array){\r\n if (!new_array)\r\n return;\r\n if (!$.isArray(new_array))\r\n new_array = [new_array];\r\n this.clear();\r\n this.push.apply(this, new_array);\r\n },\r\n clear: function(){\r\n this.length = 0;\r\n },\r\n copy: function(){\r\n var a = new DateArray();\r\n a.replace(this);\r\n return a;\r\n }\r\n };\r\n\r\n return function(){\r\n var a = [];\r\n a.push.apply(a, arguments);\r\n $.extend(a, extras);\r\n return a;\r\n };\r\n })();\r\n\r\n\r\n // Picker object\r\n\r\n var Datepicker2 = function(element, options){\r\n $.data(element, 'datepicker2', this);\r\n\r\n this._events = [];\r\n this._secondaryEvents = [];\r\n\r\n this._process_options(options);\r\n\r\n this.dates = new DateArray();\r\n this.viewDate = this.o.defaultViewDate;\r\n this.focusDate = null;\r\n\r\n this.element = $(element);\r\n this.isInput = this.element.is('input');\r\n this.inputField = this.isInput ? this.element : this.element.find('input');\r\n this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .input-group-append, .input-group-prepend, .btn') : false;\r\n if (this.component && this.component.length === 0)\r\n this.component = false;\r\n this.isInline = !this.component && this.element.is('div');\r\n\r\n this.picker = $(DPGlobal.template);\r\n\r\n // Checking templates and inserting\r\n if (this._check_template(this.o.templates.leftArrow)) {\r\n this.picker.find('.prev').html(this.o.templates.leftArrow);\r\n }\r\n\r\n if (this._check_template(this.o.templates.rightArrow)) {\r\n this.picker.find('.next').html(this.o.templates.rightArrow);\r\n }\r\n\r\n this._buildEvents();\r\n this._attachEvents();\r\n\r\n if (this.isInline){\r\n this.picker.addClass('datepicker2-inline').appendTo(this.element);\r\n }\r\n else {\r\n this.picker.addClass('datepicker2-dropdown dropdown-menu');\r\n }\r\n\r\n if (this.o.rtl){\r\n this.picker.addClass('datepicker2-rtl');\r\n }\r\n\r\n if (this.o.calendarWeeks) {\r\n this.picker.find('.datepicker2-days .datepicker2-switch, thead .datepicker2-title, tfoot .today, tfoot .clear')\r\n .attr('colspan', function(i, val){\r\n return Number(val) + 1;\r\n });\r\n }\r\n\r\n this._process_options({\r\n startDate: this._o.startDate,\r\n endDate: this._o.endDate,\r\n daysOfWeekDisabled: this.o.daysOfWeekDisabled,\r\n daysOfWeekHighlighted: this.o.daysOfWeekHighlighted,\r\n datesDisabled: this.o.datesDisabled\r\n });\r\n\r\n this._allow_update = false;\r\n this.setViewMode(this.o.startView);\r\n this._allow_update = true;\r\n\r\n this.fillDow();\r\n this.fillMonths();\r\n\r\n this.update();\r\n\r\n if (this.isInline){\r\n this.show();\r\n }\r\n };\r\n\r\n Datepicker2.prototype = {\r\n constructor: Datepicker2,\r\n\r\n _resolveViewName: function(view){\r\n $.each(DPGlobal.viewModes, function(i, viewMode){\r\n if (view === i || $.inArray(view, viewMode.names) !== -1){\r\n view = i;\r\n return false;\r\n }\r\n });\r\n\r\n return view;\r\n },\r\n\r\n _resolveDaysOfWeek: function(daysOfWeek){\r\n if (!$.isArray(daysOfWeek))\r\n daysOfWeek = daysOfWeek.split(/[,\\s]*/);\r\n return $.map(daysOfWeek, Number);\r\n },\r\n\r\n _check_template: function(tmp){\r\n try {\r\n // If empty\r\n if (tmp === undefined || tmp === \"\") {\r\n return false;\r\n }\r\n // If no html, everything ok\r\n if ((tmp.match(/[<>]/g) || []).length <= 0) {\r\n return true;\r\n }\r\n // Checking if html is fine\r\n var jDom = $(tmp);\r\n return jDom.length > 0;\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n },\r\n\r\n _process_options: function(opts){\r\n // Store raw options for reference\r\n this._o = $.extend({}, this._o, opts);\r\n // Processed options\r\n var o = this.o = $.extend({}, this._o);\r\n\r\n // Check if \"de-DE\" style date is available, if not language should\r\n // fallback to 2 letter code eg \"de\"\r\n var lang = o.language;\r\n if (!dates[lang]){\r\n lang = lang.split('-')[0];\r\n if (!dates[lang])\r\n lang = defaults.language;\r\n }\r\n o.language = lang;\r\n\r\n // Retrieve view index from any aliases\r\n o.startView = this._resolveViewName(o.startView);\r\n o.minViewMode = this._resolveViewName(o.minViewMode);\r\n o.maxViewMode = this._resolveViewName(o.maxViewMode);\r\n\r\n // Check view is between min and max\r\n o.startView = Math.max(this.o.minViewMode, Math.min(this.o.maxViewMode, o.startView));\r\n\r\n // true, false, or Number > 0\r\n if (o.multidate !== true){\r\n o.multidate = Number(o.multidate) || false;\r\n if (o.multidate !== false)\r\n o.multidate = Math.max(0, o.multidate);\r\n }\r\n o.multidateSeparator = String(o.multidateSeparator);\r\n\r\n o.weekStart %= 7;\r\n o.weekEnd = (o.weekStart + 6) % 7;\r\n\r\n var format = DPGlobal.parseFormat(o.format);\r\n if (o.startDate !== -Infinity){\r\n if (!!o.startDate){\r\n if (o.startDate instanceof Date)\r\n o.startDate = this._local_to_utc(this._zero_time(o.startDate));\r\n else\r\n o.startDate = DPGlobal.parseDate(o.startDate, format, o.language, o.assumeNearbyYear);\r\n }\r\n else {\r\n o.startDate = -Infinity;\r\n }\r\n }\r\n if (o.endDate !== Infinity){\r\n if (!!o.endDate){\r\n if (o.endDate instanceof Date)\r\n o.endDate = this._local_to_utc(this._zero_time(o.endDate));\r\n else\r\n o.endDate = DPGlobal.parseDate(o.endDate, format, o.language, o.assumeNearbyYear);\r\n }\r\n else {\r\n o.endDate = Infinity;\r\n }\r\n }\r\n\r\n o.daysOfWeekDisabled = this._resolveDaysOfWeek(o.daysOfWeekDisabled||[]);\r\n o.daysOfWeekHighlighted = this._resolveDaysOfWeek(o.daysOfWeekHighlighted||[]);\r\n\r\n o.datesDisabled = o.datesDisabled||[];\r\n if (!$.isArray(o.datesDisabled)) {\r\n o.datesDisabled = o.datesDisabled.split(',');\r\n }\r\n o.datesDisabled = $.map(o.datesDisabled, function(d){\r\n return DPGlobal.parseDate(d, format, o.language, o.assumeNearbyYear);\r\n });\r\n\r\n var plc = String(o.orientation).toLowerCase().split(/\\s+/g),\r\n _plc = o.orientation.toLowerCase();\r\n plc = $.grep(plc, function(word){\r\n return /^auto|left|right|top|bottom$/.test(word);\r\n });\r\n o.orientation = {x: 'auto', y: 'auto'};\r\n if (!_plc || _plc === 'auto')\r\n ; // no action\r\n else if (plc.length === 1){\r\n switch (plc[0]){\r\n case 'top':\r\n case 'bottom':\r\n o.orientation.y = plc[0];\r\n break;\r\n case 'left':\r\n case 'right':\r\n o.orientation.x = plc[0];\r\n break;\r\n }\r\n }\r\n else {\r\n _plc = $.grep(plc, function(word){\r\n return /^left|right$/.test(word);\r\n });\r\n o.orientation.x = _plc[0] || 'auto';\r\n\r\n _plc = $.grep(plc, function(word){\r\n return /^top|bottom$/.test(word);\r\n });\r\n o.orientation.y = _plc[0] || 'auto';\r\n }\r\n if (o.defaultViewDate instanceof Date || typeof o.defaultViewDate === 'string') {\r\n o.defaultViewDate = DPGlobal.parseDate(o.defaultViewDate, format, o.language, o.assumeNearbyYear);\r\n } else if (o.defaultViewDate) {\r\n var year = o.defaultViewDate.year || new Date().getFullYear();\r\n var month = o.defaultViewDate.month || 0;\r\n var day = o.defaultViewDate.day || 1;\r\n o.defaultViewDate = UTCDate(year, month, day);\r\n } else {\r\n o.defaultViewDate = UTCToday();\r\n }\r\n },\r\n _applyEvents: function(evs){\r\n for (var i=0, el, ch, ev; i < evs.length; i++){\r\n el = evs[i][0];\r\n if (evs[i].length === 2){\r\n ch = undefined;\r\n ev = evs[i][1];\r\n } else if (evs[i].length === 3){\r\n ch = evs[i][1];\r\n ev = evs[i][2];\r\n }\r\n el.on(ev, ch);\r\n }\r\n },\r\n _unapplyEvents: function(evs){\r\n for (var i=0, el, ev, ch; i < evs.length; i++){\r\n el = evs[i][0];\r\n if (evs[i].length === 2){\r\n ch = undefined;\r\n ev = evs[i][1];\r\n } else if (evs[i].length === 3){\r\n ch = evs[i][1];\r\n ev = evs[i][2];\r\n }\r\n el.off(ev, ch);\r\n }\r\n },\r\n _buildEvents: function(){\r\n var events = {\r\n keyup: $.proxy(function(e){\r\n if ($.inArray(e.keyCode, [27, 37, 39, 38, 40, 32, 13, 9]) === -1)\r\n this.update();\r\n }, this),\r\n keydown: $.proxy(this.keydown, this),\r\n paste: $.proxy(this.paste, this)\r\n };\r\n\r\n if (this.o.showOnFocus === true) {\r\n events.focus = $.proxy(this.show, this);\r\n }\r\n\r\n if (this.isInput) { // single input\r\n this._events = [\r\n [this.element, events]\r\n ];\r\n }\r\n // component: input + button\r\n else if (this.component && this.inputField.length) {\r\n this._events = [\r\n // For components that are not readonly, allow keyboard nav\r\n [this.inputField, events],\r\n [this.component, {\r\n click: $.proxy(this.show, this)\r\n }]\r\n ];\r\n }\r\n else {\r\n this._events = [\r\n [this.element, {\r\n click: $.proxy(this.show, this),\r\n keydown: $.proxy(this.keydown, this)\r\n }]\r\n ];\r\n }\r\n this._events.push(\r\n // Component: listen for blur on element descendants\r\n [this.element, '*', {\r\n blur: $.proxy(function(e){\r\n this._focused_from = e.target;\r\n }, this)\r\n }],\r\n // Input: listen for blur on element\r\n [this.element, {\r\n blur: $.proxy(function(e){\r\n this._focused_from = e.target;\r\n }, this)\r\n }]\r\n );\r\n\r\n if (this.o.immediateUpdates) {\r\n // Trigger input updates immediately on changed year/month\r\n this._events.push([this.element, {\r\n 'changeYear changeMonth': $.proxy(function(e){\r\n this.update(e.date);\r\n }, this)\r\n }]);\r\n }\r\n\r\n this._secondaryEvents = [\r\n [this.picker, {\r\n click: $.proxy(this.click, this)\r\n }],\r\n [this.picker, '.prev, .next', {\r\n click: $.proxy(this.navArrowsClick, this)\r\n }],\r\n [this.picker, '.day:not(.disabled)', {\r\n click: $.proxy(this.dayCellClick, this)\r\n }],\r\n [$(window), {\r\n resize: $.proxy(this.place, this)\r\n }],\r\n [$(document), {\r\n 'mousedown touchstart': $.proxy(function(e){\r\n // Clicked outside the datepicker2, hide it\r\n if (!(\r\n this.element.is(e.target) ||\r\n this.element.find(e.target).length ||\r\n this.picker.is(e.target) ||\r\n this.picker.find(e.target).length ||\r\n this.isInline\r\n )){\r\n this.hide();\r\n }\r\n }, this)\r\n }]\r\n ];\r\n },\r\n _attachEvents: function(){\r\n this._detachEvents();\r\n this._applyEvents(this._events);\r\n },\r\n _detachEvents: function(){\r\n this._unapplyEvents(this._events);\r\n },\r\n _attachSecondaryEvents: function(){\r\n this._detachSecondaryEvents();\r\n this._applyEvents(this._secondaryEvents);\r\n },\r\n _detachSecondaryEvents: function(){\r\n this._unapplyEvents(this._secondaryEvents);\r\n },\r\n _trigger: function(event, altdate){\r\n var date = altdate || this.dates.get(-1),\r\n local_date = this._utc_to_local(date);\r\n\r\n this.element.trigger({\r\n type: event,\r\n date: local_date,\r\n viewMode: this.viewMode,\r\n dates: $.map(this.dates, this._utc_to_local),\r\n format: $.proxy(function(ix, format){\r\n if (arguments.length === 0){\r\n ix = this.dates.length - 1;\r\n format = this.o.format;\r\n } else if (typeof ix === 'string'){\r\n format = ix;\r\n ix = this.dates.length - 1;\r\n }\r\n format = format || this.o.format;\r\n var date = this.dates.get(ix);\r\n return DPGlobal.formatDate(date, format, this.o.language);\r\n }, this)\r\n });\r\n },\r\n\r\n show: function(){\r\n if (this.inputField.is(':disabled') || (this.inputField.prop('readonly') && this.o.enableOnReadonly === false))\r\n return;\r\n if (!this.isInline)\r\n this.picker.appendTo(this.o.container);\r\n this.place();\r\n this.picker.show();\r\n this._attachSecondaryEvents();\r\n this._trigger('show');\r\n if ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && this.o.disableTouchKeyboard) {\r\n $(this.element).blur();\r\n }\r\n return this;\r\n },\r\n\r\n hide: function(){\r\n if (this.isInline || !this.picker.is(':visible'))\r\n return this;\r\n this.focusDate = null;\r\n this.picker.hide().detach();\r\n this._detachSecondaryEvents();\r\n this.setViewMode(this.o.startView);\r\n\r\n if (this.o.forceParse && this.inputField.val())\r\n this.setValue();\r\n this._trigger('hide');\r\n return this;\r\n },\r\n\r\n destroy: function(){\r\n this.hide();\r\n this._detachEvents();\r\n this._detachSecondaryEvents();\r\n this.picker.remove();\r\n delete this.element.data().datepicker2;\r\n if (!this.isInput){\r\n delete this.element.data().date;\r\n }\r\n return this;\r\n },\r\n\r\n paste: function(e){\r\n var dateString;\r\n if (e.originalEvent.clipboardData && e.originalEvent.clipboardData.types\r\n && $.inArray('text/plain', e.originalEvent.clipboardData.types) !== -1) {\r\n dateString = e.originalEvent.clipboardData.getData('text/plain');\r\n } else if (window.clipboardData) {\r\n dateString = window.clipboardData.getData('Text');\r\n } else {\r\n return;\r\n }\r\n this.setDate(dateString);\r\n this.update();\r\n e.preventDefault();\r\n },\r\n\r\n _utc_to_local: function(utc){\r\n if (!utc) {\r\n return utc;\r\n }\r\n\r\n var local = new Date(utc.getTime() + (utc.getTimezoneOffset() * 60000));\r\n\r\n if (local.getTimezoneOffset() !== utc.getTimezoneOffset()) {\r\n local = new Date(utc.getTime() + (local.getTimezoneOffset() * 60000));\r\n }\r\n\r\n return local;\r\n },\r\n _local_to_utc: function(local){\r\n return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));\r\n },\r\n _zero_time: function(local){\r\n return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());\r\n },\r\n _zero_utc_time: function(utc){\r\n return utc && UTCDate(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate());\r\n },\r\n\r\n getDates: function(){\r\n return $.map(this.dates, this._utc_to_local);\r\n },\r\n\r\n getUTCDates: function(){\r\n return $.map(this.dates, function(d){\r\n return new Date(d);\r\n });\r\n },\r\n\r\n getDate: function(){\r\n return this._utc_to_local(this.getUTCDate());\r\n },\r\n\r\n getUTCDate: function(){\r\n var selected_date = this.dates.get(-1);\r\n if (selected_date !== undefined) {\r\n return new Date(selected_date);\r\n } else {\r\n return null;\r\n }\r\n },\r\n\r\n clearDates: function(){\r\n this.inputField.val('');\r\n this.update();\r\n this._trigger('changeDate');\r\n\r\n if (this.o.autoclose) {\r\n this.hide();\r\n }\r\n },\r\n\r\n setDates: function(){\r\n var args = $.isArray(arguments[0]) ? arguments[0] : arguments;\r\n this.update.apply(this, args);\r\n this._trigger('changeDate');\r\n this.setValue();\r\n return this;\r\n },\r\n\r\n setUTCDates: function(){\r\n var args = $.isArray(arguments[0]) ? arguments[0] : arguments;\r\n this.setDates.apply(this, $.map(args, this._utc_to_local));\r\n return this;\r\n },\r\n\r\n setDate: alias('setDates'),\r\n setUTCDate: alias('setUTCDates'),\r\n remove: alias('destroy', 'Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead'),\r\n\r\n setValue: function(){\r\n var formatted = this.getFormattedDate();\r\n this.inputField.val(formatted);\r\n return this;\r\n },\r\n\r\n getFormattedDate: function(format){\r\n if (format === undefined)\r\n format = this.o.format;\r\n\r\n var lang = this.o.language;\r\n return $.map(this.dates, function(d){\r\n return DPGlobal.formatDate(d, format, lang);\r\n }).join(this.o.multidateSeparator);\r\n },\r\n\r\n getStartDate: function(){\r\n return this.o.startDate;\r\n },\r\n\r\n setStartDate: function(startDate){\r\n this._process_options({startDate: startDate});\r\n this.update();\r\n this.updateNavArrows();\r\n return this;\r\n },\r\n\r\n getEndDate: function(){\r\n return this.o.endDate;\r\n },\r\n\r\n setEndDate: function(endDate){\r\n this._process_options({endDate: endDate});\r\n this.update();\r\n this.updateNavArrows();\r\n return this;\r\n },\r\n\r\n setDaysOfWeekDisabled: function(daysOfWeekDisabled){\r\n this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});\r\n this.update();\r\n return this;\r\n },\r\n\r\n setDaysOfWeekHighlighted: function(daysOfWeekHighlighted){\r\n this._process_options({daysOfWeekHighlighted: daysOfWeekHighlighted});\r\n this.update();\r\n return this;\r\n },\r\n\r\n setDatesDisabled: function(datesDisabled){\r\n this._process_options({datesDisabled: datesDisabled});\r\n this.update();\r\n return this;\r\n },\r\n\r\n place: function(){\r\n if (this.isInline)\r\n return this;\r\n var calendarWidth = this.picker.outerWidth(),\r\n calendarHeight = this.picker.outerHeight(),\r\n visualPadding = 10,\r\n container = $(this.o.container),\r\n windowWidth = container.width(),\r\n scrollTop = this.o.container === 'body' ? $(document).scrollTop() : container.scrollTop(),\r\n appendOffset = container.offset();\r\n\r\n var parentsZindex = [0];\r\n this.element.parents().each(function(){\r\n var itemZIndex = $(this).css('z-index');\r\n if (itemZIndex !== 'auto' && Number(itemZIndex) !== 0) parentsZindex.push(Number(itemZIndex));\r\n });\r\n var zIndex = Math.max.apply(Math, parentsZindex) + this.o.zIndexOffset;\r\n var offset = this.component ? this.component.parent().offset() : this.element.offset();\r\n var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);\r\n var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);\r\n var left = offset.left - appendOffset.left;\r\n var top = offset.top - appendOffset.top;\r\n\r\n if (this.o.container !== 'body') {\r\n top += scrollTop;\r\n }\r\n\r\n this.picker.removeClass(\r\n 'datepicker2-orient-top datepicker2-orient-bottom '+\r\n 'datepicker2-orient-right datepicker2-orient-left'\r\n );\r\n\r\n if (this.o.orientation.x !== 'auto'){\r\n this.picker.addClass('datepicker2-orient-' + this.o.orientation.x);\r\n if (this.o.orientation.x === 'right')\r\n left -= calendarWidth - width;\r\n }\r\n // auto x orientation is best-placement: if it crosses a window\r\n // edge, fudge it sideways\r\n else {\r\n if (offset.left < 0) {\r\n // component is outside the window on the left side. Move it into visible range\r\n this.picker.addClass('datepicker2-orient-left');\r\n left -= offset.left - visualPadding;\r\n } else if (left + calendarWidth > windowWidth) {\r\n // the calendar passes the widow right edge. Align it to component right side\r\n this.picker.addClass('datepicker2-orient-right');\r\n left += width - calendarWidth;\r\n } else {\r\n if (this.o.rtl) {\r\n // Default to right\r\n this.picker.addClass('datepicker2-orient-right');\r\n } else {\r\n // Default to left\r\n this.picker.addClass('datepicker2-orient-left');\r\n }\r\n }\r\n }\r\n\r\n // auto y orientation is best-situation: top or bottom, no fudging,\r\n // decision based on which shows more of the calendar\r\n var yorient = this.o.orientation.y,\r\n top_overflow;\r\n if (yorient === 'auto'){\r\n top_overflow = -scrollTop + top - calendarHeight;\r\n yorient = top_overflow < 0 ? 'bottom' : 'top';\r\n }\r\n\r\n this.picker.addClass('datepicker2-orient-' + yorient);\r\n if (yorient === 'top')\r\n top -= calendarHeight + parseInt(this.picker.css('padding-top'));\r\n else\r\n top += height;\r\n\r\n if (this.o.rtl) {\r\n var right = windowWidth - (left + width);\r\n this.picker.css({\r\n top: top,\r\n right: right,\r\n zIndex: zIndex\r\n });\r\n } else {\r\n this.picker.css({\r\n top: top,\r\n left: left,\r\n zIndex: zIndex\r\n });\r\n }\r\n return this;\r\n },\r\n\r\n _allow_update: true,\r\n update: function(){\r\n if (!this._allow_update)\r\n return this;\r\n\r\n var oldDates = this.dates.copy(),\r\n dates = [],\r\n fromArgs = false;\r\n if (arguments.length){\r\n $.each(arguments, $.proxy(function(i, date){\r\n if (date instanceof Date)\r\n date = this._local_to_utc(date);\r\n dates.push(date);\r\n }, this));\r\n fromArgs = true;\r\n } else {\r\n dates = this.isInput\r\n ? this.element.val()\r\n : this.element.data('date') || this.inputField.val();\r\n if (dates && this.o.multidate)\r\n dates = dates.split(this.o.multidateSeparator);\r\n else\r\n dates = [dates];\r\n delete this.element.data().date;\r\n }\r\n\r\n dates = $.map(dates, $.proxy(function(date){\r\n return DPGlobal.parseDate(date, this.o.format, this.o.language, this.o.assumeNearbyYear);\r\n }, this));\r\n dates = $.grep(dates, $.proxy(function(date){\r\n return (\r\n !this.dateWithinRange(date) ||\r\n !date\r\n );\r\n }, this), true);\r\n this.dates.replace(dates);\r\n\r\n if (this.o.updateViewDate) {\r\n if (this.dates.length)\r\n this.viewDate = new Date(this.dates.get(-1));\r\n else if (this.viewDate < this.o.startDate)\r\n this.viewDate = new Date(this.o.startDate);\r\n else if (this.viewDate > this.o.endDate)\r\n this.viewDate = new Date(this.o.endDate);\r\n else\r\n this.viewDate = this.o.defaultViewDate;\r\n }\r\n\r\n if (fromArgs){\r\n // setting date by clicking\r\n this.setValue();\r\n this.element.change();\r\n }\r\n else if (this.dates.length){\r\n // setting date by typing\r\n if (String(oldDates) !== String(this.dates) && fromArgs) {\r\n this._trigger('changeDate');\r\n this.element.change();\r\n }\r\n }\r\n if (!this.dates.length && oldDates.length) {\r\n this._trigger('clearDate');\r\n this.element.change();\r\n }\r\n\r\n this.fill();\r\n return this;\r\n },\r\n\r\n fillDow: function(){\r\n if (this.o.showWeekDays) {\r\n var dowCnt = this.o.weekStart,\r\n html = '
';\r\n if (this.o.calendarWeeks){\r\n html += '
';\r\n }\r\n while (dowCnt < this.o.weekStart + 7){\r\n html += '
'+dates[this.o.language].daysMin[(dowCnt++)%7]+'
';\r\n }\r\n html += '
';\r\n this.picker.find('.datepicker2-days thead').append(html);\r\n }\r\n },\r\n\r\n fillMonths: function(){\r\n var localDate = this._utc_to_local(this.viewDate);\r\n var html = '';\r\n var focused;\r\n for (var i = 0; i < 12; i++){\r\n focused = localDate && localDate.getMonth() === i ? ' focused' : '';\r\n html += '' + dates[this.o.language].monthsShort[i] + '';\r\n }\r\n this.picker.find('.datepicker2-months td').html(html);\r\n },\r\n\r\n setRange: function(range){\r\n if (!range || !range.length)\r\n delete this.range;\r\n else\r\n this.range = $.map(range, function(d){\r\n return d.valueOf();\r\n });\r\n this.fill();\r\n },\r\n\r\n getClassNames: function(date){\r\n var cls = [],\r\n year = this.viewDate.getUTCFullYear(),\r\n month = this.viewDate.getUTCMonth(),\r\n today = UTCToday();\r\n if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){\r\n cls.push('old');\r\n } else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){\r\n cls.push('new');\r\n }\r\n if (this.focusDate && date.valueOf() === this.focusDate.valueOf())\r\n cls.push('focused');\r\n // Compare internal UTC date with UTC today, not local today\r\n if (this.o.todayHighlight && isUTCEquals(date, today)) {\r\n cls.push('today');\r\n }\r\n if (this.dates.contains(date) !== -1)\r\n cls.push('active');\r\n if (!this.dateWithinRange(date)){\r\n cls.push('disabled');\r\n }\r\n if (this.dateIsDisabled(date)){\r\n cls.push('disabled', 'disabled-date');\r\n }\r\n if ($.inArray(date.getUTCDay(), this.o.daysOfWeekHighlighted) !== -1){\r\n cls.push('highlighted');\r\n }\r\n\r\n if (this.range){\r\n if (date > this.range[0] && date < this.range[this.range.length-1]){\r\n cls.push('range');\r\n }\r\n if ($.inArray(date.valueOf(), this.range) !== -1){\r\n cls.push('selected');\r\n }\r\n if (date.valueOf() === this.range[0]){\r\n cls.push('range-start');\r\n }\r\n if (date.valueOf() === this.range[this.range.length-1]){\r\n cls.push('range-end');\r\n }\r\n }\r\n return cls;\r\n },\r\n\r\n _fill_yearsView: function(selector, cssClass, factor, year, startYear, endYear, beforeFn){\r\n var html = '';\r\n var step = factor / 10;\r\n var view = this.picker.find(selector);\r\n var startVal = Math.floor(year / factor) * factor;\r\n var endVal = startVal + step * 9;\r\n var focusedVal = Math.floor(this.viewDate.getFullYear() / step) * step;\r\n var selected = $.map(this.dates, function(d){\r\n return Math.floor(d.getUTCFullYear() / step) * step;\r\n });\r\n\r\n var classes, tooltip, before;\r\n for (var currVal = startVal - step; currVal <= endVal + step; currVal += step) {\r\n classes = [cssClass];\r\n tooltip = null;\r\n\r\n if (currVal === startVal - step) {\r\n classes.push('old');\r\n } else if (currVal === endVal + step) {\r\n classes.push('new');\r\n }\r\n if ($.inArray(currVal, selected) !== -1) {\r\n classes.push('active');\r\n }\r\n if (currVal < startYear || currVal > endYear) {\r\n classes.push('disabled');\r\n }\r\n if (currVal === focusedVal) {\r\n classes.push('focused');\r\n }\r\n\r\n if (beforeFn !== $.noop) {\r\n before = beforeFn(new Date(currVal, 0, 1));\r\n if (before === undefined) {\r\n before = {};\r\n } else if (typeof before === 'boolean') {\r\n before = {enabled: before};\r\n } else if (typeof before === 'string') {\r\n before = {classes: before};\r\n }\r\n if (before.enabled === false) {\r\n classes.push('disabled');\r\n }\r\n if (before.classes) {\r\n classes = classes.concat(before.classes.split(/\\s+/));\r\n }\r\n if (before.tooltip) {\r\n tooltip = before.tooltip;\r\n }\r\n }\r\n\r\n html += '' + currVal + '';\r\n }\r\n\r\n view.find('.datepicker2-switch').text(startVal + '-' + endVal);\r\n view.find('td').html(html);\r\n },\r\n\r\n fill: function(){\r\n var d = new Date(this.viewDate),\r\n year = d.getUTCFullYear(),\r\n month = d.getUTCMonth(),\r\n startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,\r\n startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,\r\n endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,\r\n endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,\r\n todaytxt = dates[this.o.language].today || dates['en'].today || '',\r\n cleartxt = dates[this.o.language].clear || dates['en'].clear || '',\r\n titleFormat = dates[this.o.language].titleFormat || dates['en'].titleFormat,\r\n todayDate = UTCToday(),\r\n titleBtnVisible = (this.o.todayBtn === true || this.o.todayBtn === 'linked') && todayDate >= this.o.startDate && todayDate <= this.o.endDate && !this.weekOfDateIsDisabled(todayDate),\r\n tooltip,\r\n before;\r\n if (isNaN(year) || isNaN(month))\r\n return;\r\n this.picker.find('.datepicker2-days .datepicker2-switch')\r\n .text(DPGlobal.formatDate(d, titleFormat, this.o.language));\r\n this.picker.find('tfoot .today')\r\n .text(todaytxt)\r\n .css('display', titleBtnVisible ? 'table-cell' : 'none');\r\n this.picker.find('tfoot .clear')\r\n .text(cleartxt)\r\n .css('display', this.o.clearBtn === true ? 'table-cell' : 'none');\r\n this.picker.find('thead .datepicker2-title')\r\n .text(this.o.title)\r\n .css('display', typeof this.o.title === 'string' && this.o.title !== '' ? 'table-cell' : 'none');\r\n this.updateNavArrows();\r\n this.fillMonths();\r\n var prevMonth = UTCDate(year, month, 0),\r\n day = prevMonth.getUTCDate();\r\n prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);\r\n var nextMonth = new Date(prevMonth);\r\n if (prevMonth.getUTCFullYear() < 100){\r\n nextMonth.setUTCFullYear(prevMonth.getUTCFullYear());\r\n }\r\n nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);\r\n nextMonth = nextMonth.valueOf();\r\n var html = [];\r\n var weekDay, clsName;\r\n while (prevMonth.valueOf() < nextMonth){\r\n weekDay = prevMonth.getUTCDay();\r\n if (weekDay === this.o.weekStart){\r\n html.push('
');\r\n if (this.o.calendarWeeks){\r\n // ISO 8601: First week contains first thursday.\r\n // ISO also states week starts on Monday, but we can be more abstract here.\r\n var\r\n // Start of current week: based on weekstart/current date\r\n ws = new Date(+prevMonth + (this.o.weekStart - weekDay - 7) % 7 * 864e5),\r\n // Thursday of this week\r\n th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),\r\n // First Thursday of year, year from thursday\r\n yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay()) % 7 * 864e5),\r\n // Calendar week: ms between thursdays, div ms per day, div 7 days\r\n calWeek = (th - yth) / 864e5 / 7 + 1;\r\n html.push('
'+ calWeek +'
');\r\n }\r\n }\r\n clsName = this.getClassNames(prevMonth);\r\n clsName.push('day');\r\n\r\n var content = prevMonth.getUTCDate();\r\n\r\n if (this.o.beforeShowDay !== $.noop){\r\n before = this.o.beforeShowDay(this._utc_to_local(prevMonth));\r\n if (before === undefined)\r\n before = {};\r\n else if (typeof before === 'boolean')\r\n before = {enabled: before};\r\n else if (typeof before === 'string')\r\n before = {classes: before};\r\n if (before.enabled === false)\r\n clsName.push('disabled');\r\n if (before.classes)\r\n clsName = clsName.concat(before.classes.split(/\\s+/));\r\n if (before.tooltip)\r\n tooltip = before.tooltip;\r\n if (before.content)\r\n content = before.content;\r\n }\r\n\r\n //Check if uniqueSort exists (supported by jquery >=1.12 and >=2.2)\r\n //Fallback to unique function for older jquery versions\r\n if ($.isFunction($.uniqueSort)) {\r\n clsName = $.uniqueSort(clsName);\r\n } else {\r\n clsName = $.unique(clsName);\r\n }\r\n\r\n html.push('
' + content + '
');\r\n tooltip = null;\r\n if (weekDay === this.o.weekEnd){\r\n html.push('
');\r\n }\r\n prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);\r\n }\r\n this.picker.find('.datepicker2-days tbody').html(html.join(''));\r\n\r\n var monthsTitle = dates[this.o.language].monthsTitle || dates['en'].monthsTitle || 'Months';\r\n var months = this.picker.find('.datepicker2-months')\r\n .find('.datepicker2-switch')\r\n .text(this.o.maxViewMode < 2 ? monthsTitle : year)\r\n .end()\r\n .find('tbody span').removeClass('active');\r\n\r\n $.each(this.dates, function(i, d){\r\n if (d.getUTCFullYear() === year)\r\n months.eq(d.getUTCMonth()).addClass('active');\r\n });\r\n\r\n if (year < startYear || year > endYear){\r\n months.addClass('disabled');\r\n }\r\n if (year === startYear){\r\n months.slice(0, startMonth).addClass('disabled');\r\n }\r\n if (year === endYear){\r\n months.slice(endMonth+1).addClass('disabled');\r\n }\r\n\r\n if (this.o.beforeShowMonth !== $.noop){\r\n var that = this;\r\n $.each(months, function(i, month){\r\n var moDate = new Date(year, i, 1);\r\n var before = that.o.beforeShowMonth(moDate);\r\n if (before === undefined)\r\n before = {};\r\n else if (typeof before === 'boolean')\r\n before = {enabled: before};\r\n else if (typeof before === 'string')\r\n before = {classes: before};\r\n if (before.enabled === false && !$(month).hasClass('disabled'))\r\n $(month).addClass('disabled');\r\n if (before.classes)\r\n $(month).addClass(before.classes);\r\n if (before.tooltip)\r\n $(month).prop('title', before.tooltip);\r\n });\r\n }\r\n\r\n // Generating decade/years picker\r\n this._fill_yearsView(\r\n '.datepicker2-years',\r\n 'year',\r\n 10,\r\n year,\r\n startYear,\r\n endYear,\r\n this.o.beforeShowYear\r\n );\r\n\r\n // Generating century/decades picker\r\n this._fill_yearsView(\r\n '.datepicker2-decades',\r\n 'decade',\r\n 100,\r\n year,\r\n startYear,\r\n endYear,\r\n this.o.beforeShowDecade\r\n );\r\n\r\n // Generating millennium/centuries picker\r\n this._fill_yearsView(\r\n '.datepicker2-centuries',\r\n 'century',\r\n 1000,\r\n year,\r\n startYear,\r\n endYear,\r\n this.o.beforeShowCentury\r\n );\r\n },\r\n\r\n updateNavArrows: function(){\r\n if (!this._allow_update)\r\n return;\r\n\r\n var d = new Date(this.viewDate),\r\n year = d.getUTCFullYear(),\r\n month = d.getUTCMonth(),\r\n startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,\r\n startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,\r\n endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,\r\n endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,\r\n prevIsDisabled,\r\n nextIsDisabled,\r\n factor = 1;\r\n switch (this.viewMode){\r\n case 4:\r\n factor *= 10;\r\n /* falls through */\r\n case 3:\r\n factor *= 10;\r\n /* falls through */\r\n case 2:\r\n factor *= 10;\r\n /* falls through */\r\n case 1:\r\n prevIsDisabled = Math.floor(year / factor) * factor <= startYear;\r\n nextIsDisabled = Math.floor(year / factor) * factor + factor > endYear;\r\n break;\r\n case 0:\r\n prevIsDisabled = year <= startYear && month <= startMonth;\r\n nextIsDisabled = year >= endYear && month >= endMonth;\r\n break;\r\n }\r\n\r\n this.picker.find('.prev').toggleClass('disabled', prevIsDisabled);\r\n this.picker.find('.next').toggleClass('disabled', nextIsDisabled);\r\n },\r\n\r\n click: function(e){\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n var target, dir, day, year, month;\r\n target = $(e.target);\r\n\r\n // Clicked on the switch\r\n if (target.hasClass('datepicker2-switch') && this.viewMode !== this.o.maxViewMode){\r\n this.setViewMode(this.viewMode + 1);\r\n }\r\n\r\n // Clicked on today button\r\n if (target.hasClass('today') && !target.hasClass('day')){\r\n this.setViewMode(0);\r\n this._setDate(UTCToday(), this.o.todayBtn === 'linked' ? null : 'view');\r\n }\r\n\r\n // Clicked on clear button\r\n if (target.hasClass('clear')){\r\n this.clearDates();\r\n }\r\n\r\n if (!target.hasClass('disabled')){\r\n // Clicked on a month, year, decade, century\r\n if (target.hasClass('month')\r\n || target.hasClass('year')\r\n || target.hasClass('decade')\r\n || target.hasClass('century')) {\r\n this.viewDate.setUTCDate(1);\r\n\r\n day = 1;\r\n if (this.viewMode === 1){\r\n month = target.parent().find('span').index(target);\r\n year = this.viewDate.getUTCFullYear();\r\n this.viewDate.setUTCMonth(month);\r\n } else {\r\n month = 0;\r\n year = Number(target.text());\r\n this.viewDate.setUTCFullYear(year);\r\n }\r\n\r\n this._trigger(DPGlobal.viewModes[this.viewMode - 1].e, this.viewDate);\r\n\r\n if (this.viewMode === this.o.minViewMode){\r\n this._setDate(UTCDate(year, month, day));\r\n } else {\r\n this.setViewMode(this.viewMode - 1);\r\n this.fill();\r\n }\r\n }\r\n }\r\n\r\n if (this.picker.is(':visible') && this._focused_from){\r\n this._focused_from.focus();\r\n }\r\n delete this._focused_from;\r\n },\r\n\r\n dayCellClick: function(e){\r\n var $target = $(e.currentTarget);\r\n var timestamp = $target.data('date');\r\n var date = new Date(timestamp);\r\n\r\n if (this.o.updateViewDate) {\r\n if (date.getUTCFullYear() !== this.viewDate.getUTCFullYear()) {\r\n this._trigger('changeYear', this.viewDate);\r\n }\r\n\r\n if (date.getUTCMonth() !== this.viewDate.getUTCMonth()) {\r\n this._trigger('changeMonth', this.viewDate);\r\n }\r\n }\r\n this._setDate(date);\r\n },\r\n\r\n // Clicked on prev or next\r\n navArrowsClick: function(e){\r\n var $target = $(e.currentTarget);\r\n var dir = $target.hasClass('prev') ? -1 : 1;\r\n if (this.viewMode !== 0){\r\n dir *= DPGlobal.viewModes[this.viewMode].navStep * 12;\r\n }\r\n this.viewDate = this.moveMonth(this.viewDate, dir);\r\n this._trigger(DPGlobal.viewModes[this.viewMode].e, this.viewDate);\r\n this.fill();\r\n },\r\n\r\n _toggle_multidate: function(date){\r\n var ix = this.dates.contains(date);\r\n if (!date){\r\n this.dates.clear();\r\n }\r\n\r\n if (ix !== -1){\r\n if (this.o.multidate === true || this.o.multidate > 1 || this.o.toggleActive){\r\n this.dates.remove(ix);\r\n }\r\n } else if (this.o.multidate === false) {\r\n this.dates.clear();\r\n this.dates.push(date);\r\n }\r\n else {\r\n this.dates.push(date);\r\n }\r\n\r\n if (typeof this.o.multidate === 'number')\r\n while (this.dates.length > this.o.multidate)\r\n this.dates.remove(0);\r\n },\r\n\r\n _setDate: function(date, which){\r\n if (!which || which === 'date')\r\n this._toggle_multidate(date && new Date(date));\r\n if ((!which && this.o.updateViewDate) || which === 'view')\r\n this.viewDate = date && new Date(date);\r\n\r\n this.fill();\r\n this.setValue();\r\n if (!which || which !== 'view') {\r\n this._trigger('changeDate');\r\n }\r\n this.inputField.trigger('change');\r\n if (this.o.autoclose && (!which || which === 'date')){\r\n this.hide();\r\n }\r\n },\r\n\r\n moveDay: function(date, dir){\r\n var newDate = new Date(date);\r\n newDate.setUTCDate(date.getUTCDate() + dir);\r\n\r\n return newDate;\r\n },\r\n\r\n moveWeek: function(date, dir){\r\n return this.moveDay(date, dir * 7);\r\n },\r\n\r\n moveMonth: function(date, dir){\r\n if (!isValidDate(date))\r\n return this.o.defaultViewDate;\r\n if (!dir)\r\n return date;\r\n var new_date = new Date(date.valueOf()),\r\n day = new_date.getUTCDate(),\r\n month = new_date.getUTCMonth(),\r\n mag = Math.abs(dir),\r\n new_month, test;\r\n dir = dir > 0 ? 1 : -1;\r\n if (mag === 1){\r\n test = dir === -1\r\n // If going back one month, make sure month is not current month\r\n // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)\r\n ? function(){\r\n return new_date.getUTCMonth() === month;\r\n }\r\n // If going forward one month, make sure month is as expected\r\n // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)\r\n : function(){\r\n return new_date.getUTCMonth() !== new_month;\r\n };\r\n new_month = month + dir;\r\n new_date.setUTCMonth(new_month);\r\n // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11\r\n new_month = (new_month + 12) % 12;\r\n }\r\n else {\r\n // For magnitudes >1, move one month at a time...\r\n for (var i=0; i < mag; i++)\r\n // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...\r\n new_date = this.moveMonth(new_date, dir);\r\n // ...then reset the day, keeping it in the new month\r\n new_month = new_date.getUTCMonth();\r\n new_date.setUTCDate(day);\r\n test = function(){\r\n return new_month !== new_date.getUTCMonth();\r\n };\r\n }\r\n // Common date-resetting loop -- if date is beyond end of month, make it\r\n // end of month\r\n while (test()){\r\n new_date.setUTCDate(--day);\r\n new_date.setUTCMonth(new_month);\r\n }\r\n return new_date;\r\n },\r\n\r\n moveYear: function(date, dir){\r\n return this.moveMonth(date, dir*12);\r\n },\r\n\r\n moveAvailableDate: function(date, dir, fn){\r\n do {\r\n date = this[fn](date, dir);\r\n\r\n if (!this.dateWithinRange(date))\r\n return false;\r\n\r\n fn = 'moveDay';\r\n }\r\n while (this.dateIsDisabled(date));\r\n\r\n return date;\r\n },\r\n\r\n weekOfDateIsDisabled: function(date){\r\n return $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1;\r\n },\r\n\r\n dateIsDisabled: function(date){\r\n return (\r\n this.weekOfDateIsDisabled(date) ||\r\n $.grep(this.o.datesDisabled, function(d){\r\n return isUTCEquals(date, d);\r\n }).length > 0\r\n );\r\n },\r\n\r\n dateWithinRange: function(date){\r\n return date >= this.o.startDate && date <= this.o.endDate;\r\n },\r\n\r\n keydown: function(e){\r\n if (!this.picker.is(':visible')){\r\n if (e.keyCode === 40 || e.keyCode === 27) { // allow down to re-show picker\r\n this.show();\r\n e.stopPropagation();\r\n }\r\n return;\r\n }\r\n var dateChanged = false,\r\n dir, newViewDate,\r\n focusDate = this.focusDate || this.viewDate;\r\n switch (e.keyCode){\r\n case 27: // escape\r\n if (this.focusDate){\r\n this.focusDate = null;\r\n this.viewDate = this.dates.get(-1) || this.viewDate;\r\n this.fill();\r\n }\r\n else\r\n this.hide();\r\n e.preventDefault();\r\n e.stopPropagation();\r\n break;\r\n case 37: // left\r\n case 38: // up\r\n case 39: // right\r\n case 40: // down\r\n if (!this.o.keyboardNavigation || this.o.daysOfWeekDisabled.length === 7)\r\n break;\r\n dir = e.keyCode === 37 || e.keyCode === 38 ? -1 : 1;\r\n if (this.viewMode === 0) {\r\n if (e.ctrlKey){\r\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear');\r\n\r\n if (newViewDate)\r\n this._trigger('changeYear', this.viewDate);\r\n } else if (e.shiftKey){\r\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth');\r\n\r\n if (newViewDate)\r\n this._trigger('changeMonth', this.viewDate);\r\n } else if (e.keyCode === 37 || e.keyCode === 39){\r\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveDay');\r\n } else if (!this.weekOfDateIsDisabled(focusDate)){\r\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveWeek');\r\n }\r\n } else if (this.viewMode === 1) {\r\n if (e.keyCode === 38 || e.keyCode === 40) {\r\n dir = dir * 4;\r\n }\r\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth');\r\n } else if (this.viewMode === 2) {\r\n if (e.keyCode === 38 || e.keyCode === 40) {\r\n dir = dir * 4;\r\n }\r\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear');\r\n }\r\n if (newViewDate){\r\n this.focusDate = this.viewDate = newViewDate;\r\n this.setValue();\r\n this.fill();\r\n e.preventDefault();\r\n }\r\n break;\r\n case 13: // enter\r\n if (!this.o.forceParse)\r\n break;\r\n focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;\r\n if (this.o.keyboardNavigation) {\r\n this._toggle_multidate(focusDate);\r\n dateChanged = true;\r\n }\r\n this.focusDate = null;\r\n this.viewDate = this.dates.get(-1) || this.viewDate;\r\n this.setValue();\r\n this.fill();\r\n if (this.picker.is(':visible')){\r\n e.preventDefault();\r\n e.stopPropagation();\r\n if (this.o.autoclose)\r\n this.hide();\r\n }\r\n break;\r\n case 9: // tab\r\n this.focusDate = null;\r\n this.viewDate = this.dates.get(-1) || this.viewDate;\r\n this.fill();\r\n this.hide();\r\n break;\r\n }\r\n if (dateChanged){\r\n if (this.dates.length)\r\n this._trigger('changeDate');\r\n else\r\n this._trigger('clearDate');\r\n this.inputField.trigger('change');\r\n }\r\n },\r\n\r\n setViewMode: function(viewMode){\r\n this.viewMode = viewMode;\r\n this.picker\r\n .children('div')\r\n .hide()\r\n .filter('.datepicker2-' + DPGlobal.viewModes[this.viewMode].clsName)\r\n .show();\r\n this.updateNavArrows();\r\n this._trigger('changeViewMode', new Date(this.viewDate));\r\n }\r\n };\r\n\r\n var DateRangePicker = function(element, options){\r\n $.data(element, 'datepicker2', this);\r\n this.element = $(element);\r\n this.inputs = $.map(options.inputs, function(i){\r\n return i.jquery ? i[0] : i;\r\n });\r\n delete options.inputs;\r\n\r\n this.keepEmptyValues = options.keepEmptyValues;\r\n delete options.keepEmptyValues;\r\n\r\n datepicker2Plugin.call($(this.inputs), options)\r\n .on('changeDate', $.proxy(this.dateUpdated, this));\r\n\r\n this.pickers = $.map(this.inputs, function(i){\r\n return $.data(i, 'datepicker2');\r\n });\r\n this.updateDates();\r\n };\r\n DateRangePicker.prototype = {\r\n updateDates: function(){\r\n this.dates = $.map(this.pickers, function(i){\r\n return i.getUTCDate();\r\n });\r\n this.updateRanges();\r\n },\r\n updateRanges: function(){\r\n var range = $.map(this.dates, function(d){\r\n return d.valueOf();\r\n });\r\n $.each(this.pickers, function(i, p){\r\n p.setRange(range);\r\n });\r\n },\r\n clearDates: function(){\r\n $.each(this.pickers, function(i, p){\r\n p.clearDates();\r\n });\r\n },\r\n dateUpdated: function(e){\r\n // `this.updating` is a workaround for preventing infinite recursion\r\n // between `changeDate` triggering and `setUTCDate` calling. Until\r\n // there is a better mechanism.\r\n if (this.updating)\r\n return;\r\n this.updating = true;\r\n\r\n var dp = $.data(e.target, 'datepicker2');\r\n\r\n if (dp === undefined) {\r\n return;\r\n }\r\n\r\n var new_date = dp.getUTCDate(),\r\n keep_empty_values = this.keepEmptyValues,\r\n i = $.inArray(e.target, this.inputs),\r\n j = i - 1,\r\n k = i + 1,\r\n l = this.inputs.length;\r\n if (i === -1)\r\n return;\r\n\r\n $.each(this.pickers, function(i, p){\r\n if (!p.getUTCDate() && (p === dp || !keep_empty_values))\r\n p.setUTCDate(new_date);\r\n });\r\n\r\n if (new_date < this.dates[j]){\r\n // Date being moved earlier/left\r\n while (j >= 0 && new_date < this.dates[j]){\r\n this.pickers[j--].setUTCDate(new_date);\r\n }\r\n } else if (new_date > this.dates[k]){\r\n // Date being moved later/right\r\n while (k < l && new_date > this.dates[k]){\r\n this.pickers[k++].setUTCDate(new_date);\r\n }\r\n }\r\n this.updateDates();\r\n\r\n delete this.updating;\r\n },\r\n destroy: function(){\r\n $.map(this.pickers, function(p){ p.destroy(); });\r\n $(this.inputs).off('changeDate', this.dateUpdated);\r\n delete this.element.data().datepicker2;\r\n },\r\n remove: alias('destroy', 'Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead')\r\n };\r\n\r\n function opts_from_el(el, prefix){\r\n // Derive options from element data-attrs\r\n var data = $(el).data(),\r\n out = {}, inkey,\r\n replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');\r\n prefix = new RegExp('^' + prefix.toLowerCase());\r\n function re_lower(_,a){\r\n return a.toLowerCase();\r\n }\r\n for (var key in data)\r\n if (prefix.test(key)){\r\n inkey = key.replace(replace, re_lower);\r\n out[inkey] = data[key];\r\n }\r\n return out;\r\n }\r\n\r\n function opts_from_locale(lang){\r\n // Derive options from locale plugins\r\n var out = {};\r\n // Check if \"de-DE\" style date is available, if not language should\r\n // fallback to 2 letter code eg \"de\"\r\n if (!dates[lang]){\r\n lang = lang.split('-')[0];\r\n if (!dates[lang])\r\n return;\r\n }\r\n var d = dates[lang];\r\n $.each(locale_opts, function(i,k){\r\n if (k in d)\r\n out[k] = d[k];\r\n });\r\n return out;\r\n }\r\n\r\n var old = $.fn.datepicker2;\r\n var datepicker2Plugin = function(option){\r\n var args = Array.apply(null, arguments);\r\n args.shift();\r\n var internal_return;\r\n this.each(function(){\r\n var $this = $(this),\r\n data = $this.data('datepicker2'),\r\n options = typeof option === 'object' && option;\r\n if (!data){\r\n var elopts = opts_from_el(this, 'date'),\r\n // Preliminary otions\r\n xopts = $.extend({}, defaults, elopts, options),\r\n locopts = opts_from_locale(xopts.language),\r\n // Options priority: js args, data-attrs, locales, defaults\r\n opts = $.extend({}, defaults, locopts, elopts, options);\r\n if ($this.hasClass('input-daterange') || opts.inputs){\r\n $.extend(opts, {\r\n inputs: opts.inputs || $this.find('input').toArray()\r\n });\r\n data = new DateRangePicker(this, opts);\r\n }\r\n else {\r\n data = new Datepicker2(this, opts);\r\n }\r\n $this.data('datepicker2', data);\r\n }\r\n if (typeof option === 'string' && typeof data[option] === 'function'){\r\n internal_return = data[option].apply(data, args);\r\n }\r\n });\r\n\r\n if (\r\n internal_return === undefined ||\r\n internal_return instanceof Datepicker2 ||\r\n internal_return instanceof DateRangePicker\r\n )\r\n return this;\r\n\r\n if (this.length > 1)\r\n throw new Error('Using only allowed for the collection of a single element (' + option + ' function)');\r\n else\r\n return internal_return;\r\n };\r\n $.fn.datepicker2 = datepicker2Plugin;\r\n\r\n var defaults = $.fn.datepicker2.defaults = {\r\n assumeNearbyYear: false,\r\n autoclose: false,\r\n beforeShowDay: $.noop,\r\n beforeShowMonth: $.noop,\r\n beforeShowYear: $.noop,\r\n beforeShowDecade: $.noop,\r\n beforeShowCentury: $.noop,\r\n calendarWeeks: false,\r\n clearBtn: false,\r\n toggleActive: false,\r\n daysOfWeekDisabled: [],\r\n daysOfWeekHighlighted: [],\r\n datesDisabled: [],\r\n endDate: Infinity,\r\n forceParse: true,\r\n format: 'mm/dd/yyyy',\r\n keepEmptyValues: false,\r\n keyboardNavigation: true,\r\n language: 'en',\r\n minViewMode: 0,\r\n maxViewMode: 4,\r\n multidate: false,\r\n multidateSeparator: ',',\r\n orientation: \"auto\",\r\n rtl: false,\r\n startDate: -Infinity,\r\n startView: 0,\r\n todayBtn: false,\r\n todayHighlight: false,\r\n updateViewDate: true,\r\n weekStart: 0,\r\n disableTouchKeyboard: false,\r\n enableOnReadonly: true,\r\n showOnFocus: true,\r\n zIndexOffset: 10,\r\n container: 'body',\r\n immediateUpdates: false,\r\n title: '',\r\n templates: {\r\n leftArrow: '«',\r\n rightArrow: '»'\r\n },\r\n showWeekDays: true\r\n };\r\n var locale_opts = $.fn.datepicker2.locale_opts = [\r\n 'format',\r\n 'rtl',\r\n 'weekStart'\r\n ];\r\n $.fn.datepicker2.Constructor = Datepicker2;\r\n var dates = $.fn.datepicker2.dates = {\r\n en: {\r\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\r\n daysShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\r\n daysMin: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\r\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\r\n monthsShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\r\n today: \"Today\",\r\n clear: \"Clear\",\r\n titleFormat: \"MM yyyy\"\r\n }\r\n };\r\n\r\n var DPGlobal = {\r\n viewModes: [\r\n {\r\n names: ['days', 'month'],\r\n clsName: 'days',\r\n e: 'changeMonth'\r\n },\r\n {\r\n names: ['months', 'year'],\r\n clsName: 'months',\r\n e: 'changeYear',\r\n navStep: 1\r\n },\r\n {\r\n names: ['years', 'decade'],\r\n clsName: 'years',\r\n e: 'changeDecade',\r\n navStep: 10\r\n },\r\n {\r\n names: ['decades', 'century'],\r\n clsName: 'decades',\r\n e: 'changeCentury',\r\n navStep: 100\r\n },\r\n {\r\n names: ['centuries', 'millennium'],\r\n clsName: 'centuries',\r\n e: 'changeMillennium',\r\n navStep: 1000\r\n }\r\n ],\r\n validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,\r\n nonpunctuation: /[^ -\\/:-@\\u5e74\\u6708\\u65e5\\[-`{-~\\t\\n\\r]+/g,\r\n parseFormat: function(format){\r\n if (typeof format.toValue === 'function' && typeof format.toDisplay === 'function')\r\n return format;\r\n // IE treats \\0 as a string end in inputs (truncating the value),\r\n // so it's a bad format delimiter, anyway\r\n var separators = format.replace(this.validParts, '\\0').split('\\0'),\r\n parts = format.match(this.validParts);\r\n if (!separators || !separators.length || !parts || parts.length === 0){\r\n throw new Error(\"Invalid date format.\");\r\n }\r\n return {separators: separators, parts: parts};\r\n },\r\n parseDate: function(date, format, language, assumeNearby){\r\n if (!date)\r\n return undefined;\r\n if (date instanceof Date)\r\n return date;\r\n if (typeof format === 'string')\r\n format = DPGlobal.parseFormat(format);\r\n if (format.toValue)\r\n return format.toValue(date, format, language);\r\n var fn_map = {\r\n d: 'moveDay',\r\n m: 'moveMonth',\r\n w: 'moveWeek',\r\n y: 'moveYear'\r\n },\r\n dateAliases = {\r\n yesterday: '-1d',\r\n today: '+0d',\r\n tomorrow: '+1d'\r\n },\r\n parts, part, dir, i, fn;\r\n if (date in dateAliases){\r\n date = dateAliases[date];\r\n }\r\n if (/^[\\-+]\\d+[dmwy]([\\s,]+[\\-+]\\d+[dmwy])*$/i.test(date)){\r\n parts = date.match(/([\\-+]\\d+)([dmwy])/gi);\r\n date = new Date();\r\n for (i=0; i < parts.length; i++){\r\n part = parts[i].match(/([\\-+]\\d+)([dmwy])/i);\r\n dir = Number(part[1]);\r\n fn = fn_map[part[2].toLowerCase()];\r\n date = Datepicker2.prototype[fn](date, dir);\r\n }\r\n return Datepicker2.prototype._zero_utc_time(date);\r\n }\r\n\r\n parts = date && date.match(this.nonpunctuation) || [];\r\n\r\n function applyNearbyYear(year, threshold){\r\n if (threshold === true)\r\n threshold = 10;\r\n\r\n // if year is 2 digits or less, than the user most likely is trying to get a recent century\r\n if (year < 100){\r\n year += 2000;\r\n // if the new year is more than threshold years in advance, use last century\r\n if (year > ((new Date()).getFullYear()+threshold)){\r\n year -= 100;\r\n }\r\n }\r\n\r\n return year;\r\n }\r\n\r\n var parsed = {},\r\n setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],\r\n setters_map = {\r\n yyyy: function(d,v){\r\n return d.setUTCFullYear(assumeNearby ? applyNearbyYear(v, assumeNearby) : v);\r\n },\r\n m: function(d,v){\r\n if (isNaN(d))\r\n return d;\r\n v -= 1;\r\n while (v < 0) v += 12;\r\n v %= 12;\r\n d.setUTCMonth(v);\r\n while (d.getUTCMonth() !== v)\r\n d.setUTCDate(d.getUTCDate()-1);\r\n return d;\r\n },\r\n d: function(d,v){\r\n return d.setUTCDate(v);\r\n }\r\n },\r\n val, filtered;\r\n setters_map['yy'] = setters_map['yyyy'];\r\n setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];\r\n setters_map['dd'] = setters_map['d'];\r\n date = UTCToday();\r\n var fparts = format.parts.slice();\r\n // Remove noop parts\r\n if (parts.length !== fparts.length){\r\n fparts = $(fparts).filter(function(i,p){\r\n return $.inArray(p, setters_order) !== -1;\r\n }).toArray();\r\n }\r\n // Process remainder\r\n function match_part(){\r\n var m = this.slice(0, parts[i].length),\r\n p = parts[i].slice(0, m.length);\r\n return m.toLowerCase() === p.toLowerCase();\r\n }\r\n if (parts.length === fparts.length){\r\n var cnt;\r\n for (i=0, cnt = fparts.length; i < cnt; i++){\r\n val = parseInt(parts[i], 10);\r\n part = fparts[i];\r\n if (isNaN(val)){\r\n switch (part){\r\n case 'MM':\r\n filtered = $(dates[language].months).filter(match_part);\r\n val = $.inArray(filtered[0], dates[language].months) + 1;\r\n break;\r\n case 'M':\r\n filtered = $(dates[language].monthsShort).filter(match_part);\r\n val = $.inArray(filtered[0], dates[language].monthsShort) + 1;\r\n break;\r\n }\r\n }\r\n parsed[part] = val;\r\n }\r\n var _date, s;\r\n for (i=0; i < setters_order.length; i++){\r\n s = setters_order[i];\r\n if (s in parsed && !isNaN(parsed[s])){\r\n _date = new Date(date);\r\n setters_map[s](_date, parsed[s]);\r\n if (!isNaN(_date))\r\n date = _date;\r\n }\r\n }\r\n }\r\n return date;\r\n },\r\n formatDate: function(date, format, language){\r\n if (!date)\r\n return '';\r\n if (typeof format === 'string')\r\n format = DPGlobal.parseFormat(format);\r\n if (format.toDisplay)\r\n return format.toDisplay(date, format, language);\r\n var val = {\r\n d: date.getUTCDate(),\r\n D: dates[language].daysShort[date.getUTCDay()],\r\n DD: dates[language].days[date.getUTCDay()],\r\n m: date.getUTCMonth() + 1,\r\n M: dates[language].monthsShort[date.getUTCMonth()],\r\n MM: dates[language].months[date.getUTCMonth()],\r\n yy: date.getUTCFullYear().toString().substring(2),\r\n yyyy: date.getUTCFullYear()\r\n };\r\n val.dd = (val.d < 10 ? '0' : '') + val.d;\r\n val.mm = (val.m < 10 ? '0' : '') + val.m;\r\n date = [];\r\n var seps = $.extend([], format.separators);\r\n for (var i=0, cnt = format.parts.length; i <= cnt; i++){\r\n if (seps.length)\r\n date.push(seps.shift());\r\n date.push(val[format.parts[i]]);\r\n }\r\n return date.join('');\r\n },\r\n headTemplate: ''+\r\n '
';\r\n\r\n $.fn.datepicker2.DPGlobal = DPGlobal;\r\n\r\n\r\n /* DATEPICKER NO CONFLICT\r\n * =================== */\r\n\r\n $.fn.datepicker2.noConflict = function(){\r\n $.fn.datepicker2 = old;\r\n return this;\r\n };\r\n\r\n /* DATEPICKER VERSION\r\n * =================== */\r\n $.fn.datepicker2.version = '1.9.0';\r\n\r\n $.fn.datepicker2.deprecated = function(msg){\r\n var console = window.console;\r\n if (console && console.warn) {\r\n console.warn('DEPRECATED: ' + msg);\r\n }\r\n };\r\n\r\n\r\n /* DATEPICKER DATA-API\r\n * ================== */\r\n\r\n $(document).on(\r\n 'focus.datepicker2.data-api click.datepicker2.data-api',\r\n '[data-provide=\"datepicker2\"]',\r\n function(e){\r\n var $this = $(this);\r\n if ($this.data('datepicker2'))\r\n return;\r\n e.preventDefault();\r\n // component click requires us to explicitly show it\r\n datepicker2Plugin.call($this, 'show');\r\n }\r\n );\r\n $(function(){\r\n datepicker2Plugin.call($('[data-provide=\"datepicker2-inline\"]'));\r\n });\r\n\r\n}));\r\n"],"names":["factory","$","undefined","UTCDate","Date","UTC","apply","arguments","UTCToday","today","getFullYear","getMonth","getDate","isUTCEquals","date1","date2","getUTCFullYear","getUTCMonth","getUTCDate","alias","method","deprecationMsg","fn","datepicker2","deprecated","this","extras","DateArray","get","i","slice","contains","d","val","valueOf","l","length","remove","splice","replace","new_array","isArray","clear","push","copy","a","extend","Datepicker2","element","options","data","_events","_secondaryEvents","_process_options","dates","viewDate","o","defaultViewDate","focusDate","isInput","is","inputField","find","component","hasClass","isInline","picker","DPGlobal","template","_check_template","templates","leftArrow","html","rightArrow","_buildEvents","_attachEvents","addClass","appendTo","rtl","calendarWeeks","attr","Number","startDate","_o","endDate","daysOfWeekDisabled","daysOfWeekHighlighted","datesDisabled","_allow_update","setViewMode","startView","fillDow","fillMonths","update","show","prototype","constructor","_resolveViewName","view","each","viewModes","viewMode","inArray","names","_resolveDaysOfWeek","daysOfWeek","split","map","tmp","match","ex","opts","lang","language","defaults","minViewMode","maxViewMode","Math","max","min","multidate","multidateSeparator","String","weekStart","weekEnd","format","parseFormat","_local_to_utc","_zero_time","parseDate","assumeNearbyYear","Infinity","plc","orientation","toLowerCase","_plc","grep","word","test","x","y","year","month","day","_applyEvents","evs","el","ch","ev","on","_unapplyEvents","off","events","keyup","proxy","e","keyCode","keydown","paste","showOnFocus","focus","click","blur","_focused_from","target","immediateUpdates","date","navArrowsClick","dayCellClick","window","resize","place","document","hide","_detachEvents","_attachSecondaryEvents","_detachSecondaryEvents","_trigger","event","altdate","local_date","_utc_to_local","trigger","type","ix","formatDate","prop","enableOnReadonly","container","navigator","msMaxTouchPoints","disableTouchKeyboard","detach","forceParse","setValue","destroy","dateString","originalEvent","clipboardData","types","getData","setDate","preventDefault","utc","local","getTime","getTimezoneOffset","_zero_utc_time","getDates","getUTCDates","selected_date","clearDates","autoclose","setDates","args","setUTCDates","setUTCDate","formatted","getFormattedDate","join","getStartDate","setStartDate","updateNavArrows","getEndDate","setEndDate","setDaysOfWeekDisabled","setDaysOfWeekHighlighted","setDatesDisabled","calendarWidth","outerWidth","calendarHeight","outerHeight","windowWidth","width","scrollTop","appendOffset","offset","parentsZindex","parents","itemZIndex","css","zIndex","zIndexOffset","parent","height","left","top","removeClass","yorient","parseInt","right","oldDates","fromArgs","dateWithinRange","updateViewDate","change","fill","showWeekDays","dowCnt","daysMin","append","localDate","monthsShort","setRange","range","getClassNames","cls","todayHighlight","dateIsDisabled","getUTCDay","_fill_yearsView","selector","cssClass","factor","startYear","endYear","beforeFn","classes","tooltip","before","step","startVal","floor","endVal","focusedVal","selected","currVal","noop","enabled","concat","text","startMonth","endMonth","todaytxt","cleartxt","titleFormat","todayDate","titleBtnVisible","todayBtn","weekOfDateIsDisabled","isNaN","clearBtn","title","prevMonth","nextMonth","setUTCFullYear","weekDay","clsName","ws","th","yth","calWeek","content","beforeShowDay","isFunction","uniqueSort","unique","toString","monthsTitle","months","end","eq","beforeShowMonth","that","moDate","beforeShowYear","beforeShowDecade","beforeShowCentury","prevIsDisabled","nextIsDisabled","toggleClass","stopPropagation","_setDate","index","setUTCMonth","timestamp","currentTarget","dir","navStep","moveMonth","_toggle_multidate","toggleActive","which","moveDay","newDate","moveWeek","new_month","new_date","mag","abs","moveYear","moveAvailableDate","newViewDate","dateChanged","keyboardNavigation","ctrlKey","shiftKey","children","filter","DateRangePicker","inputs","jquery","keepEmptyValues","datepicker2Plugin","call","dateUpdated","pickers","updateDates","opts_from_el","prefix","out","RegExp","re_lower","_","key","opts_from_locale","locale_opts","k","updateRanges","p","updating","dp","keep_empty_values","j","old","option","internal_return","Array","shift","$this","elopts","locopts","toArray","Error","Constructor","en","days","daysShort","validParts","nonpunctuation","toValue","toDisplay","separators","parts","assumeNearby","part","fn_map","m","w","dateAliases","yesterday","tomorrow","filtered","parsed","setters_order","setters_map","yyyy","v","threshold","fparts","match_part","cnt","_date","s","D","DD","M","MM","yy","substring","dd","mm","seps","headTemplate","contTemplate","footTemplate","noConflict","version","msg","console","warn","define","amd","exports","require","jQuery"],"mappings":"AAMC,IAASA,QAAAA,QAQR,SAASC,EAAGC,sBACDC,iBACE,IAAIC,KAAKA,KAAKC,IAAIC,MAAMF,KAAMG,q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AEqB,GAAGC,YAAcyW,IACZvW,MAKXxB,EAAEqB,GAAGC,YAAY8Z,QAAU,QAE3Bpb,EAAEqB,GAAGC,YAAYC,WAAa,SAAS8Z,SAC/BC,QAAU9Q,OAAO8Q,QACjBA,SAAWA,QAAQC,MACnBD,QAAQC,KAAK,eAAiBF,MAQtCrb,EAAE2K,UAAUvB,GACR,wDACA,gCACA,SAASM,OACD0O,MAAQpY,EAAEwB,MACV4W,MAAMnV,KAAK,iBAEfyG,EAAE+C,iBAEFiK,kBAAkBC,KAAKyB,MAAO,YAGtCpY,GAAE,WACE0W,kBAAkBC,KAAK3W,EAAE,4CA5+DP,mBAAXwb,QAAyBA,OAAOC,IACvCD,+BAAO,CAAC,UAAWzb,SACO,iBAAZ2b,QACd3b,QAAQ4b,QAAQ,WAEhB5b,QAAQ6b"}
\ No newline at end of file
+{"version":3,"file":"datepicker.min.js","sources":["../src/datepicker.js"],"sourcesContent":["/*!\n * Datepicker2 for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker2)\n *\n * Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)\n */\n\n(function(factory){\n if (typeof define === 'function' && define.amd) {\n define(['jquery'], factory);\n } else if (typeof exports === 'object') {\n factory(require('jquery'));\n } else {\n factory(jQuery);\n }\n}(function($, undefined){\n function UTCDate(){\n return new Date(Date.UTC.apply(Date, arguments));\n }\n function UTCToday(){\n var today = new Date();\n return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());\n }\n function isUTCEquals(date1, date2) {\n return (\n date1.getUTCFullYear() === date2.getUTCFullYear() &&\n date1.getUTCMonth() === date2.getUTCMonth() &&\n date1.getUTCDate() === date2.getUTCDate()\n );\n }\n function alias(method, deprecationMsg){\n return function(){\n if (deprecationMsg !== undefined) {\n $.fn.datepicker2.deprecated(deprecationMsg);\n }\n\n return this[method].apply(this, arguments);\n };\n }\n function isValidDate(d) {\n return d && !isNaN(d.getTime());\n }\n\n var DateArray = (function(){\n var extras = {\n get: function(i){\n return this.slice(i)[0];\n },\n contains: function(d){\n // Array.indexOf is not cross-browser;\n // $.inArray doesn't work with Dates\n var val = d && d.valueOf();\n for (var i=0, l=this.length; i < l; i++)\n // Use date arithmetic to allow dates with different times to match\n if (0 <= this[i].valueOf() - val && this[i].valueOf() - val < 1000*60*60*24)\n return i;\n return -1;\n },\n remove: function(i){\n this.splice(i,1);\n },\n replace: function(new_array){\n if (!new_array)\n return;\n if (!$.isArray(new_array))\n new_array = [new_array];\n this.clear();\n this.push.apply(this, new_array);\n },\n clear: function(){\n this.length = 0;\n },\n copy: function(){\n var a = new DateArray();\n a.replace(this);\n return a;\n }\n };\n\n return function(){\n var a = [];\n a.push.apply(a, arguments);\n $.extend(a, extras);\n return a;\n };\n })();\n\n\n // Picker object\n\n var Datepicker2 = function(element, options){\n $.data(element, 'datepicker2', this);\n\n this._events = [];\n this._secondaryEvents = [];\n\n this._process_options(options);\n\n this.dates = new DateArray();\n this.viewDate = this.o.defaultViewDate;\n this.focusDate = null;\n\n this.element = $(element);\n this.isInput = this.element.is('input');\n this.inputField = this.isInput ? this.element : this.element.find('input');\n this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .input-group-append, .input-group-prepend, .btn') : false;\n if (this.component && this.component.length === 0)\n this.component = false;\n this.isInline = !this.component && this.element.is('div');\n\n this.picker = $(DPGlobal.template);\n\n // Checking templates and inserting\n if (this._check_template(this.o.templates.leftArrow)) {\n this.picker.find('.prev').html(this.o.templates.leftArrow);\n }\n\n if (this._check_template(this.o.templates.rightArrow)) {\n this.picker.find('.next').html(this.o.templates.rightArrow);\n }\n\n this._buildEvents();\n this._attachEvents();\n\n if (this.isInline){\n this.picker.addClass('datepicker2-inline').appendTo(this.element);\n }\n else {\n this.picker.addClass('datepicker2-dropdown dropdown-menu');\n }\n\n if (this.o.rtl){\n this.picker.addClass('datepicker2-rtl');\n }\n\n if (this.o.calendarWeeks) {\n this.picker.find('.datepicker2-days .datepicker2-switch, thead .datepicker2-title, tfoot .today, tfoot .clear')\n .attr('colspan', function(i, val){\n return Number(val) + 1;\n });\n }\n\n this._process_options({\n startDate: this._o.startDate,\n endDate: this._o.endDate,\n daysOfWeekDisabled: this.o.daysOfWeekDisabled,\n daysOfWeekHighlighted: this.o.daysOfWeekHighlighted,\n datesDisabled: this.o.datesDisabled\n });\n\n this._allow_update = false;\n this.setViewMode(this.o.startView);\n this._allow_update = true;\n\n this.fillDow();\n this.fillMonths();\n\n this.update();\n\n if (this.isInline){\n this.show();\n }\n };\n\n Datepicker2.prototype = {\n constructor: Datepicker2,\n\n _resolveViewName: function(view){\n $.each(DPGlobal.viewModes, function(i, viewMode){\n if (view === i || $.inArray(view, viewMode.names) !== -1){\n view = i;\n return false;\n }\n });\n\n return view;\n },\n\n _resolveDaysOfWeek: function(daysOfWeek){\n if (!$.isArray(daysOfWeek))\n daysOfWeek = daysOfWeek.split(/[,\\s]*/);\n return $.map(daysOfWeek, Number);\n },\n\n _check_template: function(tmp){\n try {\n // If empty\n if (tmp === undefined || tmp === \"\") {\n return false;\n }\n // If no html, everything ok\n if ((tmp.match(/[<>]/g) || []).length <= 0) {\n return true;\n }\n // Checking if html is fine\n var jDom = $(tmp);\n return jDom.length > 0;\n }\n catch (ex) {\n return false;\n }\n },\n\n _process_options: function(opts){\n // Store raw options for reference\n this._o = $.extend({}, this._o, opts);\n // Processed options\n var o = this.o = $.extend({}, this._o);\n\n // Check if \"de-DE\" style date is available, if not language should\n // fallback to 2 letter code eg \"de\"\n var lang = o.language;\n if (!dates[lang]){\n lang = lang.split('-')[0];\n if (!dates[lang])\n lang = defaults.language;\n }\n o.language = lang;\n\n // Retrieve view index from any aliases\n o.startView = this._resolveViewName(o.startView);\n o.minViewMode = this._resolveViewName(o.minViewMode);\n o.maxViewMode = this._resolveViewName(o.maxViewMode);\n\n // Check view is between min and max\n o.startView = Math.max(this.o.minViewMode, Math.min(this.o.maxViewMode, o.startView));\n\n // true, false, or Number > 0\n if (o.multidate !== true){\n o.multidate = Number(o.multidate) || false;\n if (o.multidate !== false)\n o.multidate = Math.max(0, o.multidate);\n }\n o.multidateSeparator = String(o.multidateSeparator);\n\n o.weekStart %= 7;\n o.weekEnd = (o.weekStart + 6) % 7;\n\n var format = DPGlobal.parseFormat(o.format);\n if (o.startDate !== -Infinity){\n if (!!o.startDate){\n if (o.startDate instanceof Date)\n o.startDate = this._local_to_utc(this._zero_time(o.startDate));\n else\n o.startDate = DPGlobal.parseDate(o.startDate, format, o.language, o.assumeNearbyYear);\n }\n else {\n o.startDate = -Infinity;\n }\n }\n if (o.endDate !== Infinity){\n if (!!o.endDate){\n if (o.endDate instanceof Date)\n o.endDate = this._local_to_utc(this._zero_time(o.endDate));\n else\n o.endDate = DPGlobal.parseDate(o.endDate, format, o.language, o.assumeNearbyYear);\n }\n else {\n o.endDate = Infinity;\n }\n }\n\n o.daysOfWeekDisabled = this._resolveDaysOfWeek(o.daysOfWeekDisabled||[]);\n o.daysOfWeekHighlighted = this._resolveDaysOfWeek(o.daysOfWeekHighlighted||[]);\n\n o.datesDisabled = o.datesDisabled||[];\n if (!$.isArray(o.datesDisabled)) {\n o.datesDisabled = o.datesDisabled.split(',');\n }\n o.datesDisabled = $.map(o.datesDisabled, function(d){\n return DPGlobal.parseDate(d, format, o.language, o.assumeNearbyYear);\n });\n\n var plc = String(o.orientation).toLowerCase().split(/\\s+/g),\n _plc = o.orientation.toLowerCase();\n plc = $.grep(plc, function(word){\n return /^auto|left|right|top|bottom$/.test(word);\n });\n o.orientation = {x: 'auto', y: 'auto'};\n if (!_plc || _plc === 'auto')\n ; // no action\n else if (plc.length === 1){\n switch (plc[0]){\n case 'top':\n case 'bottom':\n o.orientation.y = plc[0];\n break;\n case 'left':\n case 'right':\n o.orientation.x = plc[0];\n break;\n }\n }\n else {\n _plc = $.grep(plc, function(word){\n return /^left|right$/.test(word);\n });\n o.orientation.x = _plc[0] || 'auto';\n\n _plc = $.grep(plc, function(word){\n return /^top|bottom$/.test(word);\n });\n o.orientation.y = _plc[0] || 'auto';\n }\n if (o.defaultViewDate instanceof Date || typeof o.defaultViewDate === 'string') {\n o.defaultViewDate = DPGlobal.parseDate(o.defaultViewDate, format, o.language, o.assumeNearbyYear);\n } else if (o.defaultViewDate) {\n var year = o.defaultViewDate.year || new Date().getFullYear();\n var month = o.defaultViewDate.month || 0;\n var day = o.defaultViewDate.day || 1;\n o.defaultViewDate = UTCDate(year, month, day);\n } else {\n o.defaultViewDate = UTCToday();\n }\n },\n _applyEvents: function(evs){\n for (var i=0, el, ch, ev; i < evs.length; i++){\n el = evs[i][0];\n if (evs[i].length === 2){\n ch = undefined;\n ev = evs[i][1];\n } else if (evs[i].length === 3){\n ch = evs[i][1];\n ev = evs[i][2];\n }\n el.on(ev, ch);\n }\n },\n _unapplyEvents: function(evs){\n for (var i=0, el, ev, ch; i < evs.length; i++){\n el = evs[i][0];\n if (evs[i].length === 2){\n ch = undefined;\n ev = evs[i][1];\n } else if (evs[i].length === 3){\n ch = evs[i][1];\n ev = evs[i][2];\n }\n el.off(ev, ch);\n }\n },\n _buildEvents: function(){\n var events = {\n keyup: $.proxy(function(e){\n if ($.inArray(e.keyCode, [27, 37, 39, 38, 40, 32, 13, 9]) === -1)\n this.update();\n }, this),\n keydown: $.proxy(this.keydown, this),\n paste: $.proxy(this.paste, this)\n };\n\n if (this.o.showOnFocus === true) {\n events.focus = $.proxy(this.show, this);\n }\n\n if (this.isInput) { // single input\n this._events = [\n [this.element, events]\n ];\n }\n // component: input + button\n else if (this.component && this.inputField.length) {\n this._events = [\n // For components that are not readonly, allow keyboard nav\n [this.inputField, events],\n [this.component, {\n click: $.proxy(this.show, this)\n }]\n ];\n }\n else {\n this._events = [\n [this.element, {\n click: $.proxy(this.show, this),\n keydown: $.proxy(this.keydown, this)\n }]\n ];\n }\n this._events.push(\n // Component: listen for blur on element descendants\n [this.element, '*', {\n blur: $.proxy(function(e){\n this._focused_from = e.target;\n }, this)\n }],\n // Input: listen for blur on element\n [this.element, {\n blur: $.proxy(function(e){\n this._focused_from = e.target;\n }, this)\n }]\n );\n\n if (this.o.immediateUpdates) {\n // Trigger input updates immediately on changed year/month\n this._events.push([this.element, {\n 'changeYear changeMonth': $.proxy(function(e){\n this.update(e.date);\n }, this)\n }]);\n }\n\n this._secondaryEvents = [\n [this.picker, {\n click: $.proxy(this.click, this)\n }],\n [this.picker, '.prev, .next', {\n click: $.proxy(this.navArrowsClick, this)\n }],\n [this.picker, '.day:not(.disabled)', {\n click: $.proxy(this.dayCellClick, this)\n }],\n [$(window), {\n resize: $.proxy(this.place, this)\n }],\n [$(document), {\n 'mousedown touchstart': $.proxy(function(e){\n // Clicked outside the datepicker2, hide it\n if (!(\n this.element.is(e.target) ||\n this.element.find(e.target).length ||\n this.picker.is(e.target) ||\n this.picker.find(e.target).length ||\n this.isInline\n )){\n this.hide();\n }\n }, this)\n }]\n ];\n },\n _attachEvents: function(){\n this._detachEvents();\n this._applyEvents(this._events);\n },\n _detachEvents: function(){\n this._unapplyEvents(this._events);\n },\n _attachSecondaryEvents: function(){\n this._detachSecondaryEvents();\n this._applyEvents(this._secondaryEvents);\n },\n _detachSecondaryEvents: function(){\n this._unapplyEvents(this._secondaryEvents);\n },\n _trigger: function(event, altdate){\n var date = altdate || this.dates.get(-1),\n local_date = this._utc_to_local(date);\n\n this.element.trigger({\n type: event,\n date: local_date,\n viewMode: this.viewMode,\n dates: $.map(this.dates, this._utc_to_local),\n format: $.proxy(function(ix, format){\n if (arguments.length === 0){\n ix = this.dates.length - 1;\n format = this.o.format;\n } else if (typeof ix === 'string'){\n format = ix;\n ix = this.dates.length - 1;\n }\n format = format || this.o.format;\n var date = this.dates.get(ix);\n return DPGlobal.formatDate(date, format, this.o.language);\n }, this)\n });\n },\n\n show: function(){\n if (this.inputField.is(':disabled') || (this.inputField.prop('readonly') && this.o.enableOnReadonly === false))\n return;\n if (!this.isInline)\n this.picker.appendTo(this.o.container);\n this.place();\n this.picker.show();\n this._attachSecondaryEvents();\n this._trigger('show');\n if ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && this.o.disableTouchKeyboard) {\n $(this.element).blur();\n }\n return this;\n },\n\n hide: function(){\n if (this.isInline || !this.picker.is(':visible'))\n return this;\n this.focusDate = null;\n this.picker.hide().detach();\n this._detachSecondaryEvents();\n this.setViewMode(this.o.startView);\n\n if (this.o.forceParse && this.inputField.val())\n this.setValue();\n this._trigger('hide');\n return this;\n },\n\n destroy: function(){\n this.hide();\n this._detachEvents();\n this._detachSecondaryEvents();\n this.picker.remove();\n delete this.element.data().datepicker2;\n if (!this.isInput){\n delete this.element.data().date;\n }\n return this;\n },\n\n paste: function(e){\n var dateString;\n if (e.originalEvent.clipboardData && e.originalEvent.clipboardData.types\n && $.inArray('text/plain', e.originalEvent.clipboardData.types) !== -1) {\n dateString = e.originalEvent.clipboardData.getData('text/plain');\n } else if (window.clipboardData) {\n dateString = window.clipboardData.getData('Text');\n } else {\n return;\n }\n this.setDate(dateString);\n this.update();\n e.preventDefault();\n },\n\n _utc_to_local: function(utc){\n if (!utc) {\n return utc;\n }\n\n var local = new Date(utc.getTime() + (utc.getTimezoneOffset() * 60000));\n\n if (local.getTimezoneOffset() !== utc.getTimezoneOffset()) {\n local = new Date(utc.getTime() + (local.getTimezoneOffset() * 60000));\n }\n\n return local;\n },\n _local_to_utc: function(local){\n return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));\n },\n _zero_time: function(local){\n return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());\n },\n _zero_utc_time: function(utc){\n return utc && UTCDate(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate());\n },\n\n getDates: function(){\n return $.map(this.dates, this._utc_to_local);\n },\n\n getUTCDates: function(){\n return $.map(this.dates, function(d){\n return new Date(d);\n });\n },\n\n getDate: function(){\n return this._utc_to_local(this.getUTCDate());\n },\n\n getUTCDate: function(){\n var selected_date = this.dates.get(-1);\n if (selected_date !== undefined) {\n return new Date(selected_date);\n } else {\n return null;\n }\n },\n\n clearDates: function(){\n this.inputField.val('');\n this.update();\n this._trigger('changeDate');\n\n if (this.o.autoclose) {\n this.hide();\n }\n },\n\n setDates: function(){\n var args = $.isArray(arguments[0]) ? arguments[0] : arguments;\n this.update.apply(this, args);\n this._trigger('changeDate');\n this.setValue();\n return this;\n },\n\n setUTCDates: function(){\n var args = $.isArray(arguments[0]) ? arguments[0] : arguments;\n this.setDates.apply(this, $.map(args, this._utc_to_local));\n return this;\n },\n\n setDate: alias('setDates'),\n setUTCDate: alias('setUTCDates'),\n remove: alias('destroy', 'Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead'),\n\n setValue: function(){\n var formatted = this.getFormattedDate();\n this.inputField.val(formatted);\n return this;\n },\n\n getFormattedDate: function(format){\n if (format === undefined)\n format = this.o.format;\n\n var lang = this.o.language;\n return $.map(this.dates, function(d){\n return DPGlobal.formatDate(d, format, lang);\n }).join(this.o.multidateSeparator);\n },\n\n getStartDate: function(){\n return this.o.startDate;\n },\n\n setStartDate: function(startDate){\n this._process_options({startDate: startDate});\n this.update();\n this.updateNavArrows();\n return this;\n },\n\n getEndDate: function(){\n return this.o.endDate;\n },\n\n setEndDate: function(endDate){\n this._process_options({endDate: endDate});\n this.update();\n this.updateNavArrows();\n return this;\n },\n\n setDaysOfWeekDisabled: function(daysOfWeekDisabled){\n this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});\n this.update();\n return this;\n },\n\n setDaysOfWeekHighlighted: function(daysOfWeekHighlighted){\n this._process_options({daysOfWeekHighlighted: daysOfWeekHighlighted});\n this.update();\n return this;\n },\n\n setDatesDisabled: function(datesDisabled){\n this._process_options({datesDisabled: datesDisabled});\n this.update();\n return this;\n },\n\n place: function(){\n if (this.isInline)\n return this;\n var calendarWidth = this.picker.outerWidth(),\n calendarHeight = this.picker.outerHeight(),\n visualPadding = 10,\n container = $(this.o.container),\n windowWidth = container.width(),\n scrollTop = this.o.container === 'body' ? $(document).scrollTop() : container.scrollTop(),\n appendOffset = container.offset();\n\n var parentsZindex = [0];\n this.element.parents().each(function(){\n var itemZIndex = $(this).css('z-index');\n if (itemZIndex !== 'auto' && Number(itemZIndex) !== 0) parentsZindex.push(Number(itemZIndex));\n });\n var zIndex = Math.max.apply(Math, parentsZindex) + this.o.zIndexOffset;\n var offset = this.component ? this.component.parent().offset() : this.element.offset();\n var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);\n var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);\n var left = offset.left - appendOffset.left;\n var top = offset.top - appendOffset.top;\n\n if (this.o.container !== 'body') {\n top += scrollTop;\n }\n\n this.picker.removeClass(\n 'datepicker2-orient-top datepicker2-orient-bottom '+\n 'datepicker2-orient-right datepicker2-orient-left'\n );\n\n if (this.o.orientation.x !== 'auto'){\n this.picker.addClass('datepicker2-orient-' + this.o.orientation.x);\n if (this.o.orientation.x === 'right')\n left -= calendarWidth - width;\n }\n // auto x orientation is best-placement: if it crosses a window\n // edge, fudge it sideways\n else {\n if (offset.left < 0) {\n // component is outside the window on the left side. Move it into visible range\n this.picker.addClass('datepicker2-orient-left');\n left -= offset.left - visualPadding;\n } else if (left + calendarWidth > windowWidth) {\n // the calendar passes the widow right edge. Align it to component right side\n this.picker.addClass('datepicker2-orient-right');\n left += width - calendarWidth;\n } else {\n if (this.o.rtl) {\n // Default to right\n this.picker.addClass('datepicker2-orient-right');\n } else {\n // Default to left\n this.picker.addClass('datepicker2-orient-left');\n }\n }\n }\n\n // auto y orientation is best-situation: top or bottom, no fudging,\n // decision based on which shows more of the calendar\n var yorient = this.o.orientation.y,\n top_overflow;\n if (yorient === 'auto'){\n top_overflow = -scrollTop + top - calendarHeight;\n yorient = top_overflow < 0 ? 'bottom' : 'top';\n }\n\n this.picker.addClass('datepicker2-orient-' + yorient);\n if (yorient === 'top')\n top -= calendarHeight + parseInt(this.picker.css('padding-top'));\n else\n top += height;\n\n if (this.o.rtl) {\n var right = windowWidth - (left + width);\n this.picker.css({\n top: top,\n right: right,\n zIndex: zIndex\n });\n } else {\n this.picker.css({\n top: top,\n left: left,\n zIndex: zIndex\n });\n }\n return this;\n },\n\n _allow_update: true,\n update: function(){\n if (!this._allow_update)\n return this;\n\n var oldDates = this.dates.copy(),\n dates = [],\n fromArgs = false;\n if (arguments.length){\n $.each(arguments, $.proxy(function(i, date){\n if (date instanceof Date)\n date = this._local_to_utc(date);\n dates.push(date);\n }, this));\n fromArgs = true;\n } else {\n dates = this.isInput\n ? this.element.val()\n : this.element.data('date') || this.inputField.val();\n if (dates && this.o.multidate)\n dates = dates.split(this.o.multidateSeparator);\n else\n dates = [dates];\n delete this.element.data().date;\n }\n\n dates = $.map(dates, $.proxy(function(date){\n return DPGlobal.parseDate(date, this.o.format, this.o.language, this.o.assumeNearbyYear);\n }, this));\n dates = $.grep(dates, $.proxy(function(date){\n return (\n !this.dateWithinRange(date) ||\n !date\n );\n }, this), true);\n this.dates.replace(dates);\n\n if (this.o.updateViewDate) {\n if (this.dates.length)\n this.viewDate = new Date(this.dates.get(-1));\n else if (this.viewDate < this.o.startDate)\n this.viewDate = new Date(this.o.startDate);\n else if (this.viewDate > this.o.endDate)\n this.viewDate = new Date(this.o.endDate);\n else\n this.viewDate = this.o.defaultViewDate;\n }\n\n if (fromArgs){\n // setting date by clicking\n this.setValue();\n this.element.change();\n }\n else if (this.dates.length){\n // setting date by typing\n if (String(oldDates) !== String(this.dates) && fromArgs) {\n this._trigger('changeDate');\n this.element.change();\n }\n }\n if (!this.dates.length && oldDates.length) {\n this._trigger('clearDate');\n this.element.change();\n }\n\n this.fill();\n return this;\n },\n\n fillDow: function(){\n if (this.o.showWeekDays) {\n var dowCnt = this.o.weekStart,\n html = '
';\n if (this.o.calendarWeeks){\n html += '
';\n }\n while (dowCnt < this.o.weekStart + 7){\n html += '
'+dates[this.o.language].daysMin[(dowCnt++)%7]+'
';\n }\n html += '
';\n this.picker.find('.datepicker2-days thead').append(html);\n }\n },\n\n fillMonths: function(){\n var localDate = this._utc_to_local(this.viewDate);\n var html = '';\n var focused;\n for (var i = 0; i < 12; i++){\n focused = localDate && localDate.getMonth() === i ? ' focused' : '';\n html += '' + dates[this.o.language].monthsShort[i] + '';\n }\n this.picker.find('.datepicker2-months td').html(html);\n },\n\n setRange: function(range){\n if (!range || !range.length)\n delete this.range;\n else\n this.range = $.map(range, function(d){\n return d.valueOf();\n });\n this.fill();\n },\n\n getClassNames: function(date){\n var cls = [],\n year = this.viewDate.getUTCFullYear(),\n month = this.viewDate.getUTCMonth(),\n today = UTCToday();\n if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){\n cls.push('old');\n } else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){\n cls.push('new');\n }\n if (this.focusDate && date.valueOf() === this.focusDate.valueOf())\n cls.push('focused');\n // Compare internal UTC date with UTC today, not local today\n if (this.o.todayHighlight && isUTCEquals(date, today)) {\n cls.push('today');\n }\n if (this.dates.contains(date) !== -1)\n cls.push('active');\n if (!this.dateWithinRange(date)){\n cls.push('disabled');\n }\n if (this.dateIsDisabled(date)){\n cls.push('disabled', 'disabled-date');\n }\n if ($.inArray(date.getUTCDay(), this.o.daysOfWeekHighlighted) !== -1){\n cls.push('highlighted');\n }\n\n if (this.range){\n if (date > this.range[0] && date < this.range[this.range.length-1]){\n cls.push('range');\n }\n if ($.inArray(date.valueOf(), this.range) !== -1){\n cls.push('selected');\n }\n if (date.valueOf() === this.range[0]){\n cls.push('range-start');\n }\n if (date.valueOf() === this.range[this.range.length-1]){\n cls.push('range-end');\n }\n }\n return cls;\n },\n\n _fill_yearsView: function(selector, cssClass, factor, year, startYear, endYear, beforeFn){\n var html = '';\n var step = factor / 10;\n var view = this.picker.find(selector);\n var startVal = Math.floor(year / factor) * factor;\n var endVal = startVal + step * 9;\n var focusedVal = Math.floor(this.viewDate.getFullYear() / step) * step;\n var selected = $.map(this.dates, function(d){\n return Math.floor(d.getUTCFullYear() / step) * step;\n });\n\n var classes, tooltip, before;\n for (var currVal = startVal - step; currVal <= endVal + step; currVal += step) {\n classes = [cssClass];\n tooltip = null;\n\n if (currVal === startVal - step) {\n classes.push('old');\n } else if (currVal === endVal + step) {\n classes.push('new');\n }\n if ($.inArray(currVal, selected) !== -1) {\n classes.push('active');\n }\n if (currVal < startYear || currVal > endYear) {\n classes.push('disabled');\n }\n if (currVal === focusedVal) {\n classes.push('focused');\n }\n\n if (beforeFn !== $.noop) {\n before = beforeFn(new Date(currVal, 0, 1));\n if (before === undefined) {\n before = {};\n } else if (typeof before === 'boolean') {\n before = {enabled: before};\n } else if (typeof before === 'string') {\n before = {classes: before};\n }\n if (before.enabled === false) {\n classes.push('disabled');\n }\n if (before.classes) {\n classes = classes.concat(before.classes.split(/\\s+/));\n }\n if (before.tooltip) {\n tooltip = before.tooltip;\n }\n }\n\n html += '' + currVal + '';\n }\n\n view.find('.datepicker2-switch').text(startVal + '-' + endVal);\n view.find('td').html(html);\n },\n\n fill: function(){\n var d = new Date(this.viewDate),\n year = d.getUTCFullYear(),\n month = d.getUTCMonth(),\n startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,\n startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,\n endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,\n endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,\n todaytxt = dates[this.o.language].today || dates['en'].today || '',\n cleartxt = dates[this.o.language].clear || dates['en'].clear || '',\n titleFormat = dates[this.o.language].titleFormat || dates['en'].titleFormat,\n todayDate = UTCToday(),\n titleBtnVisible = (this.o.todayBtn === true || this.o.todayBtn === 'linked') && todayDate >= this.o.startDate && todayDate <= this.o.endDate && !this.weekOfDateIsDisabled(todayDate),\n tooltip,\n before;\n if (isNaN(year) || isNaN(month))\n return;\n this.picker.find('.datepicker2-days .datepicker2-switch')\n .text(DPGlobal.formatDate(d, titleFormat, this.o.language));\n this.picker.find('tfoot .today')\n .text(todaytxt)\n .css('display', titleBtnVisible ? 'table-cell' : 'none');\n this.picker.find('tfoot .clear')\n .text(cleartxt)\n .css('display', this.o.clearBtn === true ? 'table-cell' : 'none');\n this.picker.find('thead .datepicker2-title')\n .text(this.o.title)\n .css('display', typeof this.o.title === 'string' && this.o.title !== '' ? 'table-cell' : 'none');\n this.updateNavArrows();\n this.fillMonths();\n var prevMonth = UTCDate(year, month, 0),\n day = prevMonth.getUTCDate();\n prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);\n var nextMonth = new Date(prevMonth);\n if (prevMonth.getUTCFullYear() < 100){\n nextMonth.setUTCFullYear(prevMonth.getUTCFullYear());\n }\n nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);\n nextMonth = nextMonth.valueOf();\n var html = [];\n var weekDay, clsName;\n while (prevMonth.valueOf() < nextMonth){\n weekDay = prevMonth.getUTCDay();\n if (weekDay === this.o.weekStart){\n html.push('
');\n if (this.o.calendarWeeks){\n // ISO 8601: First week contains first thursday.\n // ISO also states week starts on Monday, but we can be more abstract here.\n var\n // Start of current week: based on weekstart/current date\n ws = new Date(+prevMonth + (this.o.weekStart - weekDay - 7) % 7 * 864e5),\n // Thursday of this week\n th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),\n // First Thursday of year, year from thursday\n yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay()) % 7 * 864e5),\n // Calendar week: ms between thursdays, div ms per day, div 7 days\n calWeek = (th - yth) / 864e5 / 7 + 1;\n html.push('
'+ calWeek +'
');\n }\n }\n clsName = this.getClassNames(prevMonth);\n clsName.push('day');\n\n var content = prevMonth.getUTCDate();\n\n if (this.o.beforeShowDay !== $.noop){\n before = this.o.beforeShowDay(this._utc_to_local(prevMonth));\n if (before === undefined)\n before = {};\n else if (typeof before === 'boolean')\n before = {enabled: before};\n else if (typeof before === 'string')\n before = {classes: before};\n if (before.enabled === false)\n clsName.push('disabled');\n if (before.classes)\n clsName = clsName.concat(before.classes.split(/\\s+/));\n if (before.tooltip)\n tooltip = before.tooltip;\n if (before.content)\n content = before.content;\n }\n\n //Check if uniqueSort exists (supported by jquery >=1.12 and >=2.2)\n //Fallback to unique function for older jquery versions\n if ($.isFunction($.uniqueSort)) {\n clsName = $.uniqueSort(clsName);\n } else {\n clsName = $.unique(clsName);\n }\n\n html.push('
' + content + '
');\n tooltip = null;\n if (weekDay === this.o.weekEnd){\n html.push('
');\n }\n prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);\n }\n this.picker.find('.datepicker2-days tbody').html(html.join(''));\n\n var monthsTitle = dates[this.o.language].monthsTitle || dates['en'].monthsTitle || 'Months';\n var months = this.picker.find('.datepicker2-months')\n .find('.datepicker2-switch')\n .text(this.o.maxViewMode < 2 ? monthsTitle : year)\n .end()\n .find('tbody span').removeClass('active');\n\n $.each(this.dates, function(i, d){\n if (d.getUTCFullYear() === year)\n months.eq(d.getUTCMonth()).addClass('active');\n });\n\n if (year < startYear || year > endYear){\n months.addClass('disabled');\n }\n if (year === startYear){\n months.slice(0, startMonth).addClass('disabled');\n }\n if (year === endYear){\n months.slice(endMonth+1).addClass('disabled');\n }\n\n if (this.o.beforeShowMonth !== $.noop){\n var that = this;\n $.each(months, function(i, month){\n var moDate = new Date(year, i, 1);\n var before = that.o.beforeShowMonth(moDate);\n if (before === undefined)\n before = {};\n else if (typeof before === 'boolean')\n before = {enabled: before};\n else if (typeof before === 'string')\n before = {classes: before};\n if (before.enabled === false && !$(month).hasClass('disabled'))\n $(month).addClass('disabled');\n if (before.classes)\n $(month).addClass(before.classes);\n if (before.tooltip)\n $(month).prop('title', before.tooltip);\n });\n }\n\n // Generating decade/years picker\n this._fill_yearsView(\n '.datepicker2-years',\n 'year',\n 10,\n year,\n startYear,\n endYear,\n this.o.beforeShowYear\n );\n\n // Generating century/decades picker\n this._fill_yearsView(\n '.datepicker2-decades',\n 'decade',\n 100,\n year,\n startYear,\n endYear,\n this.o.beforeShowDecade\n );\n\n // Generating millennium/centuries picker\n this._fill_yearsView(\n '.datepicker2-centuries',\n 'century',\n 1000,\n year,\n startYear,\n endYear,\n this.o.beforeShowCentury\n );\n },\n\n updateNavArrows: function(){\n if (!this._allow_update)\n return;\n\n var d = new Date(this.viewDate),\n year = d.getUTCFullYear(),\n month = d.getUTCMonth(),\n startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,\n startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,\n endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,\n endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,\n prevIsDisabled,\n nextIsDisabled,\n factor = 1;\n switch (this.viewMode){\n case 4:\n factor *= 10;\n /* falls through */\n case 3:\n factor *= 10;\n /* falls through */\n case 2:\n factor *= 10;\n /* falls through */\n case 1:\n prevIsDisabled = Math.floor(year / factor) * factor <= startYear;\n nextIsDisabled = Math.floor(year / factor) * factor + factor > endYear;\n break;\n case 0:\n prevIsDisabled = year <= startYear && month <= startMonth;\n nextIsDisabled = year >= endYear && month >= endMonth;\n break;\n }\n\n this.picker.find('.prev').toggleClass('disabled', prevIsDisabled);\n this.picker.find('.next').toggleClass('disabled', nextIsDisabled);\n },\n\n click: function(e){\n e.preventDefault();\n e.stopPropagation();\n\n var target, dir, day, year, month;\n target = $(e.target);\n\n // Clicked on the switch\n if (target.hasClass('datepicker2-switch') && this.viewMode !== this.o.maxViewMode){\n this.setViewMode(this.viewMode + 1);\n }\n\n // Clicked on today button\n if (target.hasClass('today') && !target.hasClass('day')){\n this.setViewMode(0);\n this._setDate(UTCToday(), this.o.todayBtn === 'linked' ? null : 'view');\n }\n\n // Clicked on clear button\n if (target.hasClass('clear')){\n this.clearDates();\n }\n\n if (!target.hasClass('disabled')){\n // Clicked on a month, year, decade, century\n if (target.hasClass('month')\n || target.hasClass('year')\n || target.hasClass('decade')\n || target.hasClass('century')) {\n this.viewDate.setUTCDate(1);\n\n day = 1;\n if (this.viewMode === 1){\n month = target.parent().find('span').index(target);\n year = this.viewDate.getUTCFullYear();\n this.viewDate.setUTCMonth(month);\n } else {\n month = 0;\n year = Number(target.text());\n this.viewDate.setUTCFullYear(year);\n }\n\n this._trigger(DPGlobal.viewModes[this.viewMode - 1].e, this.viewDate);\n\n if (this.viewMode === this.o.minViewMode){\n this._setDate(UTCDate(year, month, day));\n } else {\n this.setViewMode(this.viewMode - 1);\n this.fill();\n }\n }\n }\n\n if (this.picker.is(':visible') && this._focused_from){\n this._focused_from.focus();\n }\n delete this._focused_from;\n },\n\n dayCellClick: function(e){\n var $target = $(e.currentTarget);\n var timestamp = $target.data('date');\n var date = new Date(timestamp);\n\n if (this.o.updateViewDate) {\n if (date.getUTCFullYear() !== this.viewDate.getUTCFullYear()) {\n this._trigger('changeYear', this.viewDate);\n }\n\n if (date.getUTCMonth() !== this.viewDate.getUTCMonth()) {\n this._trigger('changeMonth', this.viewDate);\n }\n }\n this._setDate(date);\n },\n\n // Clicked on prev or next\n navArrowsClick: function(e){\n var $target = $(e.currentTarget);\n var dir = $target.hasClass('prev') ? -1 : 1;\n if (this.viewMode !== 0){\n dir *= DPGlobal.viewModes[this.viewMode].navStep * 12;\n }\n this.viewDate = this.moveMonth(this.viewDate, dir);\n this._trigger(DPGlobal.viewModes[this.viewMode].e, this.viewDate);\n this.fill();\n },\n\n _toggle_multidate: function(date){\n var ix = this.dates.contains(date);\n if (!date){\n this.dates.clear();\n }\n\n if (ix !== -1){\n if (this.o.multidate === true || this.o.multidate > 1 || this.o.toggleActive){\n this.dates.remove(ix);\n }\n } else if (this.o.multidate === false) {\n this.dates.clear();\n this.dates.push(date);\n }\n else {\n this.dates.push(date);\n }\n\n if (typeof this.o.multidate === 'number')\n while (this.dates.length > this.o.multidate)\n this.dates.remove(0);\n },\n\n _setDate: function(date, which){\n if (!which || which === 'date')\n this._toggle_multidate(date && new Date(date));\n if ((!which && this.o.updateViewDate) || which === 'view')\n this.viewDate = date && new Date(date);\n\n this.fill();\n this.setValue();\n if (!which || which !== 'view') {\n this._trigger('changeDate');\n }\n this.inputField.trigger('change');\n if (this.o.autoclose && (!which || which === 'date')){\n this.hide();\n }\n },\n\n moveDay: function(date, dir){\n var newDate = new Date(date);\n newDate.setUTCDate(date.getUTCDate() + dir);\n\n return newDate;\n },\n\n moveWeek: function(date, dir){\n return this.moveDay(date, dir * 7);\n },\n\n moveMonth: function(date, dir){\n if (!isValidDate(date))\n return this.o.defaultViewDate;\n if (!dir)\n return date;\n var new_date = new Date(date.valueOf()),\n day = new_date.getUTCDate(),\n month = new_date.getUTCMonth(),\n mag = Math.abs(dir),\n new_month, test;\n dir = dir > 0 ? 1 : -1;\n if (mag === 1){\n test = dir === -1\n // If going back one month, make sure month is not current month\n // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)\n ? function(){\n return new_date.getUTCMonth() === month;\n }\n // If going forward one month, make sure month is as expected\n // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)\n : function(){\n return new_date.getUTCMonth() !== new_month;\n };\n new_month = month + dir;\n new_date.setUTCMonth(new_month);\n // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11\n new_month = (new_month + 12) % 12;\n }\n else {\n // For magnitudes >1, move one month at a time...\n for (var i=0; i < mag; i++)\n // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...\n new_date = this.moveMonth(new_date, dir);\n // ...then reset the day, keeping it in the new month\n new_month = new_date.getUTCMonth();\n new_date.setUTCDate(day);\n test = function(){\n return new_month !== new_date.getUTCMonth();\n };\n }\n // Common date-resetting loop -- if date is beyond end of month, make it\n // end of month\n while (test()){\n new_date.setUTCDate(--day);\n new_date.setUTCMonth(new_month);\n }\n return new_date;\n },\n\n moveYear: function(date, dir){\n return this.moveMonth(date, dir*12);\n },\n\n moveAvailableDate: function(date, dir, fn){\n do {\n date = this[fn](date, dir);\n\n if (!this.dateWithinRange(date))\n return false;\n\n fn = 'moveDay';\n }\n while (this.dateIsDisabled(date));\n\n return date;\n },\n\n weekOfDateIsDisabled: function(date){\n return $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1;\n },\n\n dateIsDisabled: function(date){\n return (\n this.weekOfDateIsDisabled(date) ||\n $.grep(this.o.datesDisabled, function(d){\n return isUTCEquals(date, d);\n }).length > 0\n );\n },\n\n dateWithinRange: function(date){\n return date >= this.o.startDate && date <= this.o.endDate;\n },\n\n keydown: function(e){\n if (!this.picker.is(':visible')){\n if (e.keyCode === 40 || e.keyCode === 27) { // allow down to re-show picker\n this.show();\n e.stopPropagation();\n }\n return;\n }\n var dateChanged = false,\n dir, newViewDate,\n focusDate = this.focusDate || this.viewDate;\n switch (e.keyCode){\n case 27: // escape\n if (this.focusDate){\n this.focusDate = null;\n this.viewDate = this.dates.get(-1) || this.viewDate;\n this.fill();\n }\n else\n this.hide();\n e.preventDefault();\n e.stopPropagation();\n break;\n case 37: // left\n case 38: // up\n case 39: // right\n case 40: // down\n if (!this.o.keyboardNavigation || this.o.daysOfWeekDisabled.length === 7)\n break;\n dir = e.keyCode === 37 || e.keyCode === 38 ? -1 : 1;\n if (this.viewMode === 0) {\n if (e.ctrlKey){\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear');\n\n if (newViewDate)\n this._trigger('changeYear', this.viewDate);\n } else if (e.shiftKey){\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth');\n\n if (newViewDate)\n this._trigger('changeMonth', this.viewDate);\n } else if (e.keyCode === 37 || e.keyCode === 39){\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveDay');\n } else if (!this.weekOfDateIsDisabled(focusDate)){\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveWeek');\n }\n } else if (this.viewMode === 1) {\n if (e.keyCode === 38 || e.keyCode === 40) {\n dir = dir * 4;\n }\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth');\n } else if (this.viewMode === 2) {\n if (e.keyCode === 38 || e.keyCode === 40) {\n dir = dir * 4;\n }\n newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear');\n }\n if (newViewDate){\n this.focusDate = this.viewDate = newViewDate;\n this.setValue();\n this.fill();\n e.preventDefault();\n }\n break;\n case 13: // enter\n if (!this.o.forceParse)\n break;\n focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;\n if (this.o.keyboardNavigation) {\n this._toggle_multidate(focusDate);\n dateChanged = true;\n }\n this.focusDate = null;\n this.viewDate = this.dates.get(-1) || this.viewDate;\n this.setValue();\n this.fill();\n if (this.picker.is(':visible')){\n e.preventDefault();\n e.stopPropagation();\n if (this.o.autoclose)\n this.hide();\n }\n break;\n case 9: // tab\n this.focusDate = null;\n this.viewDate = this.dates.get(-1) || this.viewDate;\n this.fill();\n this.hide();\n break;\n }\n if (dateChanged){\n if (this.dates.length)\n this._trigger('changeDate');\n else\n this._trigger('clearDate');\n this.inputField.trigger('change');\n }\n },\n\n setViewMode: function(viewMode){\n this.viewMode = viewMode;\n this.picker\n .children('div')\n .hide()\n .filter('.datepicker2-' + DPGlobal.viewModes[this.viewMode].clsName)\n .show();\n this.updateNavArrows();\n this._trigger('changeViewMode', new Date(this.viewDate));\n }\n };\n\n var DateRangePicker = function(element, options){\n $.data(element, 'datepicker2', this);\n this.element = $(element);\n this.inputs = $.map(options.inputs, function(i){\n return i.jquery ? i[0] : i;\n });\n delete options.inputs;\n\n this.keepEmptyValues = options.keepEmptyValues;\n delete options.keepEmptyValues;\n\n datepicker2Plugin.call($(this.inputs), options)\n .on('changeDate', $.proxy(this.dateUpdated, this));\n\n this.pickers = $.map(this.inputs, function(i){\n return $.data(i, 'datepicker2');\n });\n this.updateDates();\n };\n DateRangePicker.prototype = {\n updateDates: function(){\n this.dates = $.map(this.pickers, function(i){\n return i.getUTCDate();\n });\n this.updateRanges();\n },\n updateRanges: function(){\n var range = $.map(this.dates, function(d){\n return d.valueOf();\n });\n $.each(this.pickers, function(i, p){\n p.setRange(range);\n });\n },\n clearDates: function(){\n $.each(this.pickers, function(i, p){\n p.clearDates();\n });\n },\n dateUpdated: function(e){\n // `this.updating` is a workaround for preventing infinite recursion\n // between `changeDate` triggering and `setUTCDate` calling. Until\n // there is a better mechanism.\n if (this.updating)\n return;\n this.updating = true;\n\n var dp = $.data(e.target, 'datepicker2');\n\n if (dp === undefined) {\n return;\n }\n\n var new_date = dp.getUTCDate(),\n keep_empty_values = this.keepEmptyValues,\n i = $.inArray(e.target, this.inputs),\n j = i - 1,\n k = i + 1,\n l = this.inputs.length;\n if (i === -1)\n return;\n\n $.each(this.pickers, function(i, p){\n if (!p.getUTCDate() && (p === dp || !keep_empty_values))\n p.setUTCDate(new_date);\n });\n\n if (new_date < this.dates[j]){\n // Date being moved earlier/left\n while (j >= 0 && new_date < this.dates[j]){\n this.pickers[j--].setUTCDate(new_date);\n }\n } else if (new_date > this.dates[k]){\n // Date being moved later/right\n while (k < l && new_date > this.dates[k]){\n this.pickers[k++].setUTCDate(new_date);\n }\n }\n this.updateDates();\n\n delete this.updating;\n },\n destroy: function(){\n $.map(this.pickers, function(p){ p.destroy(); });\n $(this.inputs).off('changeDate', this.dateUpdated);\n delete this.element.data().datepicker2;\n },\n remove: alias('destroy', 'Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead')\n };\n\n function opts_from_el(el, prefix){\n // Derive options from element data-attrs\n var data = $(el).data(),\n out = {}, inkey,\n replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');\n prefix = new RegExp('^' + prefix.toLowerCase());\n function re_lower(_,a){\n return a.toLowerCase();\n }\n for (var key in data)\n if (prefix.test(key)){\n inkey = key.replace(replace, re_lower);\n out[inkey] = data[key];\n }\n return out;\n }\n\n function opts_from_locale(lang){\n // Derive options from locale plugins\n var out = {};\n // Check if \"de-DE\" style date is available, if not language should\n // fallback to 2 letter code eg \"de\"\n if (!dates[lang]){\n lang = lang.split('-')[0];\n if (!dates[lang])\n return;\n }\n var d = dates[lang];\n $.each(locale_opts, function(i,k){\n if (k in d)\n out[k] = d[k];\n });\n return out;\n }\n\n var old = $.fn.datepicker2;\n var datepicker2Plugin = function(option){\n var args = Array.apply(null, arguments);\n args.shift();\n var internal_return;\n this.each(function(){\n var $this = $(this),\n data = $this.data('datepicker2'),\n options = typeof option === 'object' && option;\n if (!data){\n var elopts = opts_from_el(this, 'date'),\n // Preliminary otions\n xopts = $.extend({}, defaults, elopts, options),\n locopts = opts_from_locale(xopts.language),\n // Options priority: js args, data-attrs, locales, defaults\n opts = $.extend({}, defaults, locopts, elopts, options);\n if ($this.hasClass('input-daterange') || opts.inputs){\n $.extend(opts, {\n inputs: opts.inputs || $this.find('input').toArray()\n });\n data = new DateRangePicker(this, opts);\n }\n else {\n data = new Datepicker2(this, opts);\n }\n $this.data('datepicker2', data);\n }\n if (typeof option === 'string' && typeof data[option] === 'function'){\n internal_return = data[option].apply(data, args);\n }\n });\n\n if (\n internal_return === undefined ||\n internal_return instanceof Datepicker2 ||\n internal_return instanceof DateRangePicker\n )\n return this;\n\n if (this.length > 1)\n throw new Error('Using only allowed for the collection of a single element (' + option + ' function)');\n else\n return internal_return;\n };\n $.fn.datepicker2 = datepicker2Plugin;\n\n var defaults = $.fn.datepicker2.defaults = {\n assumeNearbyYear: false,\n autoclose: false,\n beforeShowDay: $.noop,\n beforeShowMonth: $.noop,\n beforeShowYear: $.noop,\n beforeShowDecade: $.noop,\n beforeShowCentury: $.noop,\n calendarWeeks: false,\n clearBtn: false,\n toggleActive: false,\n daysOfWeekDisabled: [],\n daysOfWeekHighlighted: [],\n datesDisabled: [],\n endDate: Infinity,\n forceParse: true,\n format: 'mm/dd/yyyy',\n keepEmptyValues: false,\n keyboardNavigation: true,\n language: 'en',\n minViewMode: 0,\n maxViewMode: 4,\n multidate: false,\n multidateSeparator: ',',\n orientation: \"auto\",\n rtl: false,\n startDate: -Infinity,\n startView: 0,\n todayBtn: false,\n todayHighlight: false,\n updateViewDate: true,\n weekStart: 0,\n disableTouchKeyboard: false,\n enableOnReadonly: true,\n showOnFocus: true,\n zIndexOffset: 10,\n container: 'body',\n immediateUpdates: false,\n title: '',\n templates: {\n leftArrow: '«',\n rightArrow: '»'\n },\n showWeekDays: true\n };\n var locale_opts = $.fn.datepicker2.locale_opts = [\n 'format',\n 'rtl',\n 'weekStart'\n ];\n $.fn.datepicker2.Constructor = Datepicker2;\n var dates = $.fn.datepicker2.dates = {\n en: {\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n daysShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n daysMin: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n monthsShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n today: \"Today\",\n clear: \"Clear\",\n titleFormat: \"MM yyyy\"\n }\n };\n\n var DPGlobal = {\n viewModes: [\n {\n names: ['days', 'month'],\n clsName: 'days',\n e: 'changeMonth'\n },\n {\n names: ['months', 'year'],\n clsName: 'months',\n e: 'changeYear',\n navStep: 1\n },\n {\n names: ['years', 'decade'],\n clsName: 'years',\n e: 'changeDecade',\n navStep: 10\n },\n {\n names: ['decades', 'century'],\n clsName: 'decades',\n e: 'changeCentury',\n navStep: 100\n },\n {\n names: ['centuries', 'millennium'],\n clsName: 'centuries',\n e: 'changeMillennium',\n navStep: 1000\n }\n ],\n validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,\n nonpunctuation: /[^ -\\/:-@\\u5e74\\u6708\\u65e5\\[-`{-~\\t\\n\\r]+/g,\n parseFormat: function(format){\n if (typeof format.toValue === 'function' && typeof format.toDisplay === 'function')\n return format;\n // IE treats \\0 as a string end in inputs (truncating the value),\n // so it's a bad format delimiter, anyway\n var separators = format.replace(this.validParts, '\\0').split('\\0'),\n parts = format.match(this.validParts);\n if (!separators || !separators.length || !parts || parts.length === 0){\n throw new Error(\"Invalid date format.\");\n }\n return {separators: separators, parts: parts};\n },\n parseDate: function(date, format, language, assumeNearby){\n if (!date)\n return undefined;\n if (date instanceof Date)\n return date;\n if (typeof format === 'string')\n format = DPGlobal.parseFormat(format);\n if (format.toValue)\n return format.toValue(date, format, language);\n var fn_map = {\n d: 'moveDay',\n m: 'moveMonth',\n w: 'moveWeek',\n y: 'moveYear'\n },\n dateAliases = {\n yesterday: '-1d',\n today: '+0d',\n tomorrow: '+1d'\n },\n parts, part, dir, i, fn;\n if (date in dateAliases){\n date = dateAliases[date];\n }\n if (/^[\\-+]\\d+[dmwy]([\\s,]+[\\-+]\\d+[dmwy])*$/i.test(date)){\n parts = date.match(/([\\-+]\\d+)([dmwy])/gi);\n date = new Date();\n for (i=0; i < parts.length; i++){\n part = parts[i].match(/([\\-+]\\d+)([dmwy])/i);\n dir = Number(part[1]);\n fn = fn_map[part[2].toLowerCase()];\n date = Datepicker2.prototype[fn](date, dir);\n }\n return Datepicker2.prototype._zero_utc_time(date);\n }\n\n parts = date && date.match(this.nonpunctuation) || [];\n\n function applyNearbyYear(year, threshold){\n if (threshold === true)\n threshold = 10;\n\n // if year is 2 digits or less, than the user most likely is trying to get a recent century\n if (year < 100){\n year += 2000;\n // if the new year is more than threshold years in advance, use last century\n if (year > ((new Date()).getFullYear()+threshold)){\n year -= 100;\n }\n }\n\n return year;\n }\n\n var parsed = {},\n setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],\n setters_map = {\n yyyy: function(d,v){\n return d.setUTCFullYear(assumeNearby ? applyNearbyYear(v, assumeNearby) : v);\n },\n m: function(d,v){\n if (isNaN(d))\n return d;\n v -= 1;\n while (v < 0) v += 12;\n v %= 12;\n d.setUTCMonth(v);\n while (d.getUTCMonth() !== v)\n d.setUTCDate(d.getUTCDate()-1);\n return d;\n },\n d: function(d,v){\n return d.setUTCDate(v);\n }\n },\n val, filtered;\n setters_map['yy'] = setters_map['yyyy'];\n setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];\n setters_map['dd'] = setters_map['d'];\n date = UTCToday();\n var fparts = format.parts.slice();\n // Remove noop parts\n if (parts.length !== fparts.length){\n fparts = $(fparts).filter(function(i,p){\n return $.inArray(p, setters_order) !== -1;\n }).toArray();\n }\n // Process remainder\n function match_part(){\n var m = this.slice(0, parts[i].length),\n p = parts[i].slice(0, m.length);\n return m.toLowerCase() === p.toLowerCase();\n }\n if (parts.length === fparts.length){\n var cnt;\n for (i=0, cnt = fparts.length; i < cnt; i++){\n val = parseInt(parts[i], 10);\n part = fparts[i];\n if (isNaN(val)){\n switch (part){\n case 'MM':\n filtered = $(dates[language].months).filter(match_part);\n val = $.inArray(filtered[0], dates[language].months) + 1;\n break;\n case 'M':\n filtered = $(dates[language].monthsShort).filter(match_part);\n val = $.inArray(filtered[0], dates[language].monthsShort) + 1;\n break;\n }\n }\n parsed[part] = val;\n }\n var _date, s;\n for (i=0; i < setters_order.length; i++){\n s = setters_order[i];\n if (s in parsed && !isNaN(parsed[s])){\n _date = new Date(date);\n setters_map[s](_date, parsed[s]);\n if (!isNaN(_date))\n date = _date;\n }\n }\n }\n return date;\n },\n formatDate: function(date, format, language){\n if (!date)\n return '';\n if (typeof format === 'string')\n format = DPGlobal.parseFormat(format);\n if (format.toDisplay)\n return format.toDisplay(date, format, language);\n var val = {\n d: date.getUTCDate(),\n D: dates[language].daysShort[date.getUTCDay()],\n DD: dates[language].days[date.getUTCDay()],\n m: date.getUTCMonth() + 1,\n M: dates[language].monthsShort[date.getUTCMonth()],\n MM: dates[language].months[date.getUTCMonth()],\n yy: date.getUTCFullYear().toString().substring(2),\n yyyy: date.getUTCFullYear()\n };\n val.dd = (val.d < 10 ? '0' : '') + val.d;\n val.mm = (val.m < 10 ? '0' : '') + val.m;\n date = [];\n var seps = $.extend([], format.separators);\n for (var i=0, cnt = format.parts.length; i <= cnt; i++){\n if (seps.length)\n date.push(seps.shift());\n date.push(val[format.parts[i]]);\n }\n return date.join('');\n },\n headTemplate: ''+\n '
';\n\n $.fn.datepicker2.DPGlobal = DPGlobal;\n\n\n /* DATEPICKER NO CONFLICT\n * =================== */\n\n $.fn.datepicker2.noConflict = function(){\n $.fn.datepicker2 = old;\n return this;\n };\n\n /* DATEPICKER VERSION\n * =================== */\n $.fn.datepicker2.version = '1.9.0';\n\n $.fn.datepicker2.deprecated = function(msg){\n var console = window.console;\n if (console && console.warn) {\n console.warn('DEPRECATED: ' + msg);\n }\n };\n\n\n /* DATEPICKER DATA-API\n * ================== */\n\n $(document).on(\n 'focus.datepicker2.data-api click.datepicker2.data-api',\n '[data-provide=\"datepicker2\"]',\n function(e){\n var $this = $(this);\n if ($this.data('datepicker2'))\n return;\n e.preventDefault();\n // component click requires us to explicitly show it\n datepicker2Plugin.call($this, 'show');\n }\n );\n $(function(){\n datepicker2Plugin.call($('[data-provide=\"datepicker2-inline\"]'));\n });\n\n}));\n"],"names":["factory","$","undefined","UTCDate","Date","UTC","apply","arguments","UTCToday","today","getFullYear","getMonth","getDate","isUTCEquals","date1","date2","getUTCFullYear","getUTCMonth","getUTCDate","alias","method","deprecationMsg","fn","datepicker2","deprecated","this","extras","DateArray","get","i","slice","contains","d","val","valueOf","l","length","remove","splice","replace","new_array","isArray","clear","push","copy","a","extend","Datepicker2","element","options","data","_events","_secondaryEvents","_process_options","dates","viewDate","o","defaultViewDate","focusDate","isInput","is","inputField","find","component","hasClass","isInline","picker","DPGlobal","template","_check_template","templates","leftArrow","html","rightArrow","_buildEvents","_attachEvents","addClass","appendTo","rtl","calendarWeeks","attr","Number","startDate","_o","endDate","daysOfWeekDisabled","daysOfWeekHighlighted","datesDisabled","_allow_update","setViewMode","startView","fillDow","fillMonths","update","show","prototype","constructor","_resolveViewName","view","each","viewModes","viewMode","inArray","names","_resolveDaysOfWeek","daysOfWeek","split","map","tmp","match","ex","opts","lang","language","defaults","minViewMode","maxViewMode","Math","max","min","multidate","multidateSeparator","String","weekStart","weekEnd","format","parseFormat","_local_to_utc","_zero_time","parseDate","assumeNearbyYear","Infinity","plc","orientation","toLowerCase","_plc","grep","word","test","x","y","year","month","day","_applyEvents","evs","el","ch","ev","on","_unapplyEvents","off","events","keyup","proxy","e","keyCode","keydown","paste","showOnFocus","focus","click","blur","_focused_from","target","immediateUpdates","date","navArrowsClick","dayCellClick","window","resize","place","document","hide","_detachEvents","_attachSecondaryEvents","_detachSecondaryEvents","_trigger","event","altdate","local_date","_utc_to_local","trigger","type","ix","formatDate","prop","enableOnReadonly","container","navigator","msMaxTouchPoints","disableTouchKeyboard","detach","forceParse","setValue","destroy","dateString","originalEvent","clipboardData","types","getData","setDate","preventDefault","utc","local","getTime","getTimezoneOffset","_zero_utc_time","getDates","getUTCDates","selected_date","clearDates","autoclose","setDates","args","setUTCDates","setUTCDate","formatted","getFormattedDate","join","getStartDate","setStartDate","updateNavArrows","getEndDate","setEndDate","setDaysOfWeekDisabled","setDaysOfWeekHighlighted","setDatesDisabled","calendarWidth","outerWidth","calendarHeight","outerHeight","windowWidth","width","scrollTop","appendOffset","offset","parentsZindex","parents","itemZIndex","css","zIndex","zIndexOffset","parent","height","left","top","removeClass","yorient","parseInt","right","oldDates","fromArgs","dateWithinRange","updateViewDate","change","fill","showWeekDays","dowCnt","daysMin","append","localDate","monthsShort","setRange","range","getClassNames","cls","todayHighlight","dateIsDisabled","getUTCDay","_fill_yearsView","selector","cssClass","factor","startYear","endYear","beforeFn","classes","tooltip","before","step","startVal","floor","endVal","focusedVal","selected","currVal","noop","enabled","concat","text","startMonth","endMonth","todaytxt","cleartxt","titleFormat","todayDate","titleBtnVisible","todayBtn","weekOfDateIsDisabled","isNaN","clearBtn","title","prevMonth","nextMonth","setUTCFullYear","weekDay","clsName","ws","th","yth","calWeek","content","beforeShowDay","isFunction","uniqueSort","unique","toString","monthsTitle","months","end","eq","beforeShowMonth","that","moDate","beforeShowYear","beforeShowDecade","beforeShowCentury","prevIsDisabled","nextIsDisabled","toggleClass","stopPropagation","_setDate","index","setUTCMonth","timestamp","currentTarget","dir","navStep","moveMonth","_toggle_multidate","toggleActive","which","moveDay","newDate","moveWeek","new_month","new_date","mag","abs","moveYear","moveAvailableDate","newViewDate","dateChanged","keyboardNavigation","ctrlKey","shiftKey","children","filter","DateRangePicker","inputs","jquery","keepEmptyValues","datepicker2Plugin","call","dateUpdated","pickers","updateDates","opts_from_el","prefix","out","RegExp","re_lower","_","key","opts_from_locale","locale_opts","k","updateRanges","p","updating","dp","keep_empty_values","j","old","option","internal_return","Array","shift","$this","elopts","locopts","toArray","Error","Constructor","en","days","daysShort","validParts","nonpunctuation","toValue","toDisplay","separators","parts","assumeNearby","part","fn_map","m","w","dateAliases","yesterday","tomorrow","filtered","parsed","setters_order","setters_map","yyyy","v","threshold","fparts","match_part","cnt","_date","s","D","DD","M","MM","yy","substring","dd","mm","seps","headTemplate","contTemplate","footTemplate","noConflict","version","msg","console","warn","define","amd","exports","require","jQuery"],"mappings":"AAMC,IAASA,QAAAA,QAQR,SAASC,EAAGC,sBACDC,iBACE,IAAIC,KAAKA,KAAKC,IAAIC,MAAMF,KAAMG,qBAEhCC,eACDC,MAAQ,IAAIL,YACTD,QAAQM,MAAMC,cAAeD,MAAME,WAAYF,MAAMG,oBAEvDC,YAAYC,MAAOC,cAEpBD,MAAME,mBAAqBD,MAAMC,kBACjCF,MAAMG,gBAAkBF,MAAME,eAC9BH,MAAMI,eAAiBH,MAAMG,sBAG5BC,MAAMC,OAAQC,uBACZ,kBACCA,iBAAmBnB,aACnBD,EAAEqB,GAAGC,YAAYC,WAAWH,gBAGzBI,KAAKL,QAAQd,MAAMmB,KAAMlB,gBAQhCmB,OADJC,WACID,OAAS,CACTE,IAAK,SAASC,UACHJ,KAAKK,MAAMD,GAAG,IAEzBE,SAAU,SA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yBA,OAAOC,IACvCD,+BAAO,CAAC,UAAWzb,SACO,iBAAZ2b,QACd3b,QAAQ4b,QAAQ,WAEhB5b,QAAQ6b"}
\ No newline at end of file
diff --git a/amd/build/group-user-selector.min.js b/amd/build/group-user-selector.min.js
index 9d99ac9..f1a31b9 100644
--- a/amd/build/group-user-selector.min.js
+++ b/amd/build/group-user-selector.min.js
@@ -7,4 +7,4 @@
*/
define("block_dash/group-user-selector",["jquery","core/ajax","core/templates"],(function($,Ajax,Templates){return{processResults:function(selector,results){var users=[];return $.each(results,(function(index,user){users.push({value:user.id,label:user._label})})),users},transport:function(selector,query,success,failure){var args={query:query},groupid=$(selector).data("groupid");void 0!==groupid&&""!==$("#id_searchwithin").val()?args.groupid=groupid:args.groupid=0,Ajax.call([{methodname:"block_dash_groups_get_non_members",args:args}])[0].then((function(results){var promises=[];return $.each(results,(function(index,user){promises.push(Templates.render("mod_assign/list_participant_user_summary",user))})),$.when.apply($.when,promises).then((function(){var args=arguments,i=0;$.each(results,(function(index,user){user._label=args[i++]})),success(results)}))})).fail(failure)}}}));
-//# sourceMappingURL=group-user-selector.min.js.map
+//# sourceMappingURL=group-user-selector.min.js.map
\ No newline at end of file
diff --git a/amd/build/group-user-selector.min.js.map b/amd/build/group-user-selector.min.js.map
index 643c3b2..4d56844 100644
--- a/amd/build/group-user-selector.min.js.map
+++ b/amd/build/group-user-selector.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"group-user-selector.min.js","sources":["../src/group-user-selector.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\r\n//\r\n// Moodle is free software: you can redistribute it and/or modify\r\n// it under the terms of the GNU General Public License as published by\r\n// the Free Software Foundation, either version 3 of the License, or\r\n// (at your option) any later version.\r\n//\r\n// Moodle is distributed in the hope that it will be useful,\r\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\n// GNU General Public License for more details.\r\n//\r\n// You should have received a copy of the GNU General Public License\r\n// along with Moodle. If not, see .\r\n\r\n/**\r\n * Search user selector module.\r\n *\r\n * @module block_dash/group-user-selector\r\n * @copyright 2017 The Open University\r\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\r\n */\r\n\r\ndefine(['jquery', 'core/ajax', 'core/templates'], function($, Ajax, Templates) {\r\n\r\n return /** @alias module:block_dash/group-user-selector */ {\r\n\r\n processResults: function(selector, results) {\r\n var users = [];\r\n $.each(results, function(index, user) {\r\n users.push({\r\n value: user.id,\r\n label: user._label\r\n });\r\n });\r\n return users;\r\n },\r\n\r\n transport: function(selector, query, success, failure) {\r\n var promise;\r\n\r\n // Search within specific course if known and if the 'search within' dropdown is set\r\n // to search within course or activity.\r\n var args = {query: query};\r\n\r\n var groupid = $(selector).data('groupid');\r\n if (typeof groupid !== \"undefined\" && $('#id_searchwithin').val() !== '') {\r\n args.groupid = groupid;\r\n } else {\r\n args.groupid = 0;\r\n }\r\n\r\n // Call AJAX request.\r\n promise = Ajax.call([{methodname: 'block_dash_groups_get_non_members', args: args}]);\r\n\r\n // When AJAX request returns, handle the results.\r\n promise[0].then(function(results) {\r\n var promises = [];\r\n\r\n // Render label with user name and picture.\r\n $.each(results, function(index, user) {\r\n promises.push(Templates.render('mod_assign/list_participant_user_summary', user));\r\n });\r\n\r\n // Apply the label to the results.\r\n return $.when.apply($.when, promises).then(function() {\r\n var args = arguments;\r\n var i = 0;\r\n $.each(results, function(index, user) {\r\n user._label = args[i++];\r\n });\r\n success(results);\r\n return;\r\n });\r\n\r\n }).fail(failure);\r\n }\r\n\r\n };\r\n\r\n});\r\n"],"names":["define","$","Ajax","Templates","processResults","selector","results","users","each","index","user","push","value","id","label","_label","transport","query","success","failure","args","groupid","data","val","call","methodname","then","promises","render","when","apply","arguments","i","fail"],"mappings":";;;;;;;AAuBAA,wCAAO,CAAC,SAAU,YAAa,mBAAmB,SAASC,EAAGC,KAAMC,iBAEL,CAEvDC,eAAgB,SAASC,SAAUC,aAC3BC,MAAQ,UACZN,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BH,MAAMI,KAAK,CACPC,MAAOF,KAAKG,GACZC,MAAOJ,KAAKK,YAGbR,OAGXS,UAAW,SAASX,SAAUY,MAAOC,QAASC,aAKtCC,KAAO,CAACH,MAAOA,OAEfI,QAAUpB,EAAEI,UAAUiB,KAAK,gBACR,IAAZD,SAA2D,KAAhCpB,EAAE,oBAAoBsB,MACxDH,KAAKC,QAAUA,QAEfD,KAAKC,QAAU,EAITnB,KAAKsB,KAAK,CAAC,CAACC,WAAY,oCAAqCL,KAAMA,QAGrE,GAAGM,MAAK,SAASpB,aACjBqB,SAAW,UAGf1B,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BiB,SAAShB,KAAKR,UAAUyB,OAAO,2CAA4ClB,UAIxET,EAAE4B,KAAKC,MAAM7B,EAAE4B,KAAMF,UAAUD,MAAK,eACnCN,KAAOW,UACPC,EAAI,EACR/B,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BA,KAAKK,OAASK,KAAKY,QAEvBd,QAAQZ,eAIb2B,KAAKd"}
\ No newline at end of file
+{"version":3,"file":"group-user-selector.min.js","sources":["../src/group-user-selector.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Search user selector module.\n *\n * @module block_dash/group-user-selector\n * @copyright 2017 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax', 'core/templates'], function($, Ajax, Templates) {\n\n return /** @alias module:block_dash/group-user-selector */ {\n\n processResults: function(selector, results) {\n var users = [];\n $.each(results, function(index, user) {\n users.push({\n value: user.id,\n label: user._label\n });\n });\n return users;\n },\n\n transport: function(selector, query, success, failure) {\n var promise;\n\n // Search within specific course if known and if the 'search within' dropdown is set\n // to search within course or activity.\n var args = {query: query};\n\n var groupid = $(selector).data('groupid');\n if (typeof groupid !== \"undefined\" && $('#id_searchwithin').val() !== '') {\n args.groupid = groupid;\n } else {\n args.groupid = 0;\n }\n\n // Call AJAX request.\n promise = Ajax.call([{methodname: 'block_dash_groups_get_non_members', args: args}]);\n\n // When AJAX request returns, handle the results.\n promise[0].then(function(results) {\n var promises = [];\n\n // Render label with user name and picture.\n $.each(results, function(index, user) {\n promises.push(Templates.render('mod_assign/list_participant_user_summary', user));\n });\n\n // Apply the label to the results.\n return $.when.apply($.when, promises).then(function() {\n var args = arguments;\n var i = 0;\n $.each(results, function(index, user) {\n user._label = args[i++];\n });\n success(results);\n return;\n });\n\n }).fail(failure);\n }\n\n };\n\n});\n"],"names":["define","$","Ajax","Templates","processResults","selector","results","users","each","index","user","push","value","id","label","_label","transport","query","success","failure","args","groupid","data","val","call","methodname","then","promises","render","when","apply","arguments","i","fail"],"mappings":";;;;;;;AAuBAA,wCAAO,CAAC,SAAU,YAAa,mBAAmB,SAASC,EAAGC,KAAMC,iBAEL,CAEvDC,eAAgB,SAASC,SAAUC,aAC3BC,MAAQ,UACZN,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BH,MAAMI,KAAK,CACPC,MAAOF,KAAKG,GACZC,MAAOJ,KAAKK,YAGbR,OAGXS,UAAW,SAASX,SAAUY,MAAOC,QAASC,aAKtCC,KAAO,CAACH,MAAOA,OAEfI,QAAUpB,EAAEI,UAAUiB,KAAK,gBACR,IAAZD,SAA2D,KAAhCpB,EAAE,oBAAoBsB,MACxDH,KAAKC,QAAUA,QAEfD,KAAKC,QAAU,EAITnB,KAAKsB,KAAK,CAAC,CAACC,WAAY,oCAAqCL,KAAMA,QAGrE,GAAGM,MAAK,SAASpB,aACjBqB,SAAW,UAGf1B,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BiB,SAAShB,KAAKR,UAAUyB,OAAO,2CAA4ClB,UAIxET,EAAE4B,KAAKC,MAAM7B,EAAE4B,KAAMF,UAAUD,MAAK,eACnCN,KAAOW,UACPC,EAAI,EACR/B,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BA,KAAKK,OAASK,KAAKY,QAEvBd,QAAQZ,eAIb2B,KAAKd"}
\ No newline at end of file
diff --git a/amd/build/groups.min.js b/amd/build/groups.min.js
index 13b53e3..bd8f2d5 100644
--- a/amd/build/groups.min.js
+++ b/amd/build/groups.min.js
@@ -1,3 +1,3 @@
define("block_dash/groups",["jquery","core/str","core/modal_factory","core/modal_events","core/fragment","core/templates","core/ajax","core/notification"],(function($,Str,Modal,ModalEvents,Fragment,Templates,AJAX,Notification){return{init:function(contextID){var groupModal=document.getElementsByClassName("group-widget-viewmembers");Array.from(groupModal).forEach((function(element){element.addEventListener("click",(function(e){e.preventDefault();var group=e.target.getAttribute("data-group");Modal.create({title:Str.get_string("groups","core")}).then((function(modal){modal.show();var params={widget:"groups",method:"viewmembers",args:JSON.stringify({group:group})};return Fragment.loadFragment("block_dash","loadwidget",contextID,params).then(((html,js)=>(modal.setBody(html),Templates.runTemplateJS(js),html))).catch(Notification.exception),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()})),modal})).catch(Notification.exception)}))}));var groupUsers=document.getElementsByClassName("add-group-users");Array.from(groupUsers).forEach((function(element){element.addEventListener("click",(function(e){e.preventDefault(),function(e){var group=e.target.getAttribute("data-group");Modal.create({type:Modal.types.SAVE_CANCEL,title:Str.get_string("widget:groups:adduser","block_dash")}).then((function(modal){modal.setLarge(!0),modal.show();var params={widget:"groups",method:"addmembers",args:JSON.stringify({group:group})};return Fragment.loadFragment("block_dash","loadwidget",contextID,params).then(((html,js)=>(modal.setBody(html),modal.getRoot().get(0).querySelectorAll("form").forEach((form=>{!function(form){form.addEventListener("submit",(function(e){e.preventDefault();var formdata=new FormData(e.target);if(""==e.target.querySelector('[name="users[]"]').value)return!1;var formdatastr=new URLSearchParams(formdata).toString();return AJAX.call([{methodname:"block_dash_groups_add_members",args:{formdata:formdatastr}}])[0].done((response=>{1==response&&window.location.reload()})),!0}))}(form)})),Templates.runTemplateJS(js),html))).catch(Notification.exception),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()})),modal.getRoot().on(ModalEvents.save,(e=>{e.preventDefault(),modal.getRoot().get(0).querySelectorAll("form").forEach((form=>{form.querySelector("#id_submitbutton").click()}))})),modal})).catch(Notification.exception)}(e)}))}));var leaveGroupModal=document.getElementsByClassName("group-widget-leavegroup");Array.from(leaveGroupModal).forEach((function(element){element.addEventListener("click",(function(e){e.preventDefault(),function(e){var target=e.target,group=target.getAttribute("data-group"),groupname=target.getAttribute("data-groupname");Modal.create({type:Modal.types.SAVE_CANCEL,title:Str.get_string("groups","core")}).then((function(modal){return Str.get_string("confirm","core").then((html=>(modal.setSaveButtonText(html),html))).catch(Notification.exception),modal.show(),Str.get_string("confirmleavegroup","block_dash",groupname).then((html=>(modal.setBody(html),html))).catch(Notification.exception),modal.getRoot().on(ModalEvents.save,(e=>{e.preventDefault(),AJAX.call([{methodname:"block_dash_groups_leave_group",args:{groupid:group}}])[0].done((response=>{1==response&&window.location.reload()}))})),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()})),modal.getRoot().on(ModalEvents.destroyed,(function(){modal.remove(),modal.attachmentPoint.remove()})),modal})).catch(Notification.exception)}(e)}))}));var createGroupModal=document.getElementsByClassName("create-group");Array.from(createGroupModal).forEach((function(element){element.addEventListener("click",(function(e){e.preventDefault(),Modal.create({type:Modal.types.SAVE_CANCEL,title:Str.get_string("groups","core")}).then((function(modal){modal.show();var params={widget:"groups",method:"creategroup",args:""};return Fragment.loadFragment("block_dash","loadwidget",contextID,params).then(((html,js)=>(modal.setBody(html),Templates.runTemplateJS(js),modal.getRoot().get(0).querySelectorAll("form").forEach((form=>{!function(form){form.addEventListener("submit",(function(e){e.preventDefault();var formdata=new FormData(e.target);if(""==e.target.querySelector('[name="name"]').value||""==e.target.querySelector('[name="courseid"]').value)return!1;var formdatastr=new URLSearchParams(formdata).toString();return AJAX.call([{methodname:"block_dash_groups_create_group",args:{formdata:formdatastr}}])[0].done((response=>1==response?window.location.reload():"")),!0}))}(form)})),html))).catch(Notification.exception),modal.getRoot().on(ModalEvents.save,(e=>{e.preventDefault(),modal.getRoot().get(0).querySelectorAll("form").forEach((form=>{form.querySelector("#id_submitbutton").click()}))})),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()})),modal})).catch(Notification.exception)}))}))}}}));
-//# sourceMappingURL=groups.min.js.map
+//# sourceMappingURL=groups.min.js.map
\ No newline at end of file
diff --git a/amd/build/groups.min.js.map b/amd/build/groups.min.js.map
index ac53394..deacbf6 100644
--- a/amd/build/groups.min.js.map
+++ b/amd/build/groups.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"groups.min.js","sources":["../src/groups.js"],"sourcesContent":["\r\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events',\r\n 'core/fragment', 'core/templates', 'core/ajax', 'core/notification'],\r\nfunction($, Str, Modal, ModalEvents, Fragment, Templates, AJAX, Notification) {\r\n\r\n return {\r\n init: function(contextID) {\r\n\r\n var groupModal = document.getElementsByClassName('group-widget-viewmembers');\r\n Array.from(groupModal).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n var target = e.target;\r\n var group = target.getAttribute('data-group');\r\n Modal.create({\r\n title: Str.get_string('groups', 'core')\r\n }).then(function(modal) {\r\n modal.show();\r\n var args = JSON.stringify({group: group});\r\n var params = {widget: 'groups', method: 'viewmembers', args: args};\r\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\r\n modal.setBody(html);\r\n Templates.runTemplateJS(js);\r\n return html;\r\n }).catch(Notification.exception);\r\n modal.getRoot().on(ModalEvents.hidden, function() {\r\n modal.destroy();\r\n });\r\n return modal;\r\n }).catch(Notification.exception);\r\n });\r\n });\r\n\r\n var groupUsers = document.getElementsByClassName('add-group-users');\r\n Array.from(groupUsers).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n addGroupUsers(e);\r\n });\r\n });\r\n\r\n /**\r\n * Modal create for add member to groups menu.\r\n * @param {Event} e\r\n */\r\n function addGroupUsers(e) {\r\n var target = e.target;\r\n var group = target.getAttribute('data-group');\r\n Modal.create({\r\n type: Modal.types.SAVE_CANCEL,\r\n title: Str.get_string('widget:groups:adduser', 'block_dash'),\r\n }).then(function(modal) {\r\n modal.setLarge(true);\r\n modal.show();\r\n\r\n var args = JSON.stringify({group: group});\r\n var params = {widget: 'groups', method: 'addmembers', args: args};\r\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\r\n modal.setBody(html);\r\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\r\n groupAddEventListeners(form);\r\n });\r\n\r\n Templates.runTemplateJS(js);\r\n return html;\r\n }).catch(Notification.exception);\r\n\r\n modal.getRoot().on(ModalEvents.hidden, function() {\r\n modal.destroy();\r\n });\r\n\r\n // Apply and save method.\r\n modal.getRoot().on(ModalEvents.save, (e) => {\r\n e.preventDefault();\r\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\r\n form.querySelector('#id_submitbutton').click();\r\n });\r\n });\r\n return modal;\r\n }).catch(Notification.exception);\r\n }\r\n\r\n /**\r\n * Event listener for add memebers to groups form submit.\r\n * @param {Array} form\r\n */\r\n function groupAddEventListeners(form) {\r\n form.addEventListener('submit', function(e) {\r\n e.preventDefault();\r\n var formdata = new FormData(e.target);\r\n if (e.target.querySelector('[name=\"users[]\"]').value == '') {\r\n return false;\r\n }\r\n var formdatastr = new URLSearchParams(formdata).toString();\r\n var promises = AJAX.call([{\r\n methodname: 'block_dash_groups_add_members',\r\n args: {formdata: formdatastr}\r\n }]);\r\n\r\n promises[0].done((response) => {\r\n if (response == true) {\r\n window.location.reload();\r\n } else {\r\n // TODO: Error Notification.\r\n }\r\n });\r\n return true;\r\n });\r\n }\r\n\r\n // Leave group.\r\n var leaveGroupModal = document.getElementsByClassName('group-widget-leavegroup');\r\n Array.from(leaveGroupModal).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n leaveGroup(e);\r\n });\r\n });\r\n\r\n /**\r\n * Event observer for leave group menu clicked to trigger the confirmation modal.\r\n * @param {event} e\r\n */\r\n function leaveGroup(e) {\r\n var target = e.target;\r\n var group = target.getAttribute('data-group');\r\n var groupname = target.getAttribute('data-groupname');\r\n\r\n Modal.create({\r\n type: Modal.types.SAVE_CANCEL,\r\n title: Str.get_string('groups', 'core'),\r\n }).then(function(modal) {\r\n Str.get_string('confirm', 'core').then((html) => {\r\n modal.setSaveButtonText(html);\r\n return html;\r\n }).catch(Notification.exception);\r\n modal.show();\r\n\r\n Str.get_string('confirmleavegroup', 'block_dash', groupname).then((html) => {\r\n modal.setBody(html);\r\n return html;\r\n }).catch(Notification.exception);\r\n\r\n modal.getRoot().on(ModalEvents.save, (e) => {\r\n e.preventDefault();\r\n var promises = AJAX.call([{\r\n methodname: 'block_dash_groups_leave_group',\r\n args: {groupid: group}\r\n }]);\r\n\r\n promises[0].done((response) => {\r\n if (response == true) {\r\n window.location.reload();\r\n } else {\r\n // TODO: Error Notification.\r\n }\r\n });\r\n });\r\n\r\n modal.getRoot().on(ModalEvents.hidden, function() {\r\n modal.destroy();\r\n });\r\n\r\n modal.getRoot().on(ModalEvents.destroyed, function() {\r\n modal.remove();\r\n modal.attachmentPoint.remove();\r\n });\r\n return modal;\r\n }).catch(Notification.exception);\r\n }\r\n\r\n // Create group.\r\n var createGroupModal = document.getElementsByClassName('create-group');\r\n Array.from(createGroupModal).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n createGroup();\r\n });\r\n });\r\n\r\n /**\r\n * Event listner for create group modal trigger.\r\n */\r\n function createGroup() {\r\n\r\n Modal.create({\r\n type: Modal.types.SAVE_CANCEL,\r\n title: Str.get_string('groups', 'core'),\r\n }).then(function(modal) {\r\n modal.show();\r\n\r\n var args = \"\";\r\n var params = {widget: 'groups', method: 'creategroup', args: args};\r\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\r\n modal.setBody(html);\r\n Templates.runTemplateJS(js);\r\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\r\n createGroupEvent(form);\r\n });\r\n return html;\r\n }).catch(Notification.exception);\r\n\r\n // Apply and save method.\r\n modal.getRoot().on(ModalEvents.save, (e) => {\r\n e.preventDefault();\r\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\r\n form.querySelector('#id_submitbutton').click();\r\n });\r\n });\r\n\r\n modal.getRoot().on(ModalEvents.hidden, function() {\r\n modal.destroy();\r\n });\r\n return modal;\r\n }).catch(Notification.exception);\r\n\r\n\r\n }\r\n /**\r\n * Event listner for create group forms in modal to init the group creation.\r\n * @param {Array} form\r\n */\r\n function createGroupEvent(form) {\r\n form.addEventListener('submit', function(e) {\r\n e.preventDefault();\r\n var formdata = new FormData(e.target);\r\n if (e.target.querySelector('[name=\"name\"]').value == \"\"\r\n || e.target.querySelector('[name=\"courseid\"]').value == '') {\r\n return false;\r\n }\r\n var formdatastr = new URLSearchParams(formdata).toString();\r\n var promises = AJAX.call([{\r\n methodname: 'block_dash_groups_create_group',\r\n args: {formdata: formdatastr}\r\n }]);\r\n\r\n promises[0].done((response) => {\r\n return (response == true) ? window.location.reload() : '';\r\n });\r\n return true;\r\n });\r\n }\r\n }\r\n };\r\n});\r\n"],"names":["define","$","Str","Modal","ModalEvents","Fragment","Templates","AJAX","Notification","init","contextID","groupModal","document","getElementsByClassName","Array","from","forEach","element","addEventListener","e","preventDefault","group","target","getAttribute","create","title","get_string","then","modal","show","params","widget","method","args","JSON","stringify","loadFragment","html","js","setBody","runTemplateJS","catch","exception","getRoot","on","hidden","destroy","groupUsers","type","types","SAVE_CANCEL","setLarge","get","querySelectorAll","form","formdata","FormData","querySelector","value","formdatastr","URLSearchParams","toString","call","methodname","done","response","window","location","reload","groupAddEventListeners","save","click","addGroupUsers","leaveGroupModal","groupname","setSaveButtonText","groupid","destroyed","remove","attachmentPoint","leaveGroup","createGroupModal","createGroupEvent"],"mappings":"AACAA,2BAAO,CAAC,SAAU,WAAY,qBAAsB,oBAChD,gBAAiB,iBAAkB,YAAa,sBACpD,SAASC,EAAGC,IAAKC,MAAOC,YAAaC,SAAUC,UAAWC,KAAMC,oBAErD,CACHC,KAAM,SAASC,eAEPC,WAAaC,SAASC,uBAAuB,4BACjDC,MAAMC,KAAKJ,YAAYK,SAAQ,SAASC,SACpCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,qBAEEC,MADSF,EAAEG,OACIC,aAAa,cAChCpB,MAAMqB,OAAO,CACTC,MAAOvB,IAAIwB,WAAW,SAAU,UACjCC,MAAK,SAASC,OACbA,MAAMC,WAEFC,OAAS,CAACC,OAAQ,SAAUC,OAAQ,cAAeC,KAD5CC,KAAKC,UAAU,CAACd,MAAOA,gBAElChB,SAAS+B,aAAa,aAAc,aAAc1B,UAAWoB,QAAQH,MAAK,CAACU,KAAMC,MAC7EV,MAAMW,QAAQF,MACd/B,UAAUkC,cAAcF,IACjBD,QACRI,MAAMjC,aAAakC,WACtBd,MAAMe,UAAUC,GAAGxC,YAAYyC,QAAQ,WACnCjB,MAAMkB,aAEHlB,SACRa,MAAMjC,aAAakC,qBAI1BK,WAAanC,SAASC,uBAAuB,mBACjDC,MAAMC,KAAKgC,YAAY/B,SAAQ,SAASC,SACpCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,0BASaD,OAEfE,MADSF,EAAEG,OACIC,aAAa,cAChCpB,MAAMqB,OAAO,CACTwB,KAAM7C,MAAM8C,MAAMC,YAClBzB,MAAOvB,IAAIwB,WAAW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AAW,IAAIC,SAASrC,EAAEG,WACuB,IAAjDH,EAAEG,OAAOmC,cAAc,iBAAiBC,OACgB,IAArDvC,EAAEG,OAAOmC,cAAc,qBAAqBC,aACxC,MAEPC,YAAc,IAAIC,gBAAgBL,UAAUM,kBACjCtD,KAAKuD,KAAK,CAAC,CACtBC,WAAY,iCACZ9B,KAAM,CAACsB,SAAUI,gBAGZ,GAAGK,MAAMC,UACM,GAAZA,SAAoBC,OAAOC,SAASC,SAAW,MAEpD,KA1CCc,CAAiB5B,SAEdjB,QACRI,MAAMjC,aAAakC,WAGtBd,MAAMe,UAAUC,GAAGxC,YAAYkE,MAAOnD,IAClCA,EAAEC,iBACFQ,MAAMe,UAAUS,IAAI,GAAGC,iBAAiB,QAAQrC,SAAQsC,OACpDA,KAAKG,cAAc,oBAAoBc,cAI/C3C,MAAMe,UAAUC,GAAGxC,YAAYyC,QAAQ,WACnCjB,MAAMkB,aAEHlB,SACRa,MAAMjC,aAAakC"}
\ No newline at end of file
+{"version":3,"file":"groups.min.js","sources":["../src/groups.js"],"sourcesContent":["\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events',\n 'core/fragment', 'core/templates', 'core/ajax', 'core/notification'],\nfunction($, Str, Modal, ModalEvents, Fragment, Templates, AJAX, Notification) {\n\n return {\n init: function(contextID) {\n\n var groupModal = document.getElementsByClassName('group-widget-viewmembers');\n Array.from(groupModal).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n var target = e.target;\n var group = target.getAttribute('data-group');\n Modal.create({\n title: Str.get_string('groups', 'core')\n }).then(function(modal) {\n modal.show();\n var args = JSON.stringify({group: group});\n var params = {widget: 'groups', method: 'viewmembers', args: args};\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\n modal.setBody(html);\n Templates.runTemplateJS(js);\n return html;\n }).catch(Notification.exception);\n modal.getRoot().on(ModalEvents.hidden, function() {\n modal.destroy();\n });\n return modal;\n }).catch(Notification.exception);\n });\n });\n\n var groupUsers = document.getElementsByClassName('add-group-users');\n Array.from(groupUsers).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n addGroupUsers(e);\n });\n });\n\n /**\n * Modal create for add member to groups menu.\n * @param {Event} e\n */\n function addGroupUsers(e) {\n var target = e.target;\n var group = target.getAttribute('data-group');\n Modal.create({\n type: Modal.types.SAVE_CANCEL,\n title: Str.get_string('widget:groups:adduser', 'block_dash'),\n }).then(function(modal) {\n modal.setLarge(true);\n modal.show();\n\n var args = JSON.stringify({group: group});\n var params = {widget: 'groups', method: 'addmembers', args: args};\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\n modal.setBody(html);\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\n groupAddEventListeners(form);\n });\n\n Templates.runTemplateJS(js);\n return html;\n }).catch(Notification.exception);\n\n modal.getRoot().on(ModalEvents.hidden, function() {\n modal.destroy();\n });\n\n // Apply and save method.\n modal.getRoot().on(ModalEvents.save, (e) => {\n e.preventDefault();\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\n form.querySelector('#id_submitbutton').click();\n });\n });\n return modal;\n }).catch(Notification.exception);\n }\n\n /**\n * Event listener for add memebers to groups form submit.\n * @param {Array} form\n */\n function groupAddEventListeners(form) {\n form.addEventListener('submit', function(e) {\n e.preventDefault();\n var formdata = new FormData(e.target);\n if (e.target.querySelector('[name=\"users[]\"]').value == '') {\n return false;\n }\n var formdatastr = new URLSearchParams(formdata).toString();\n var promises = AJAX.call([{\n methodname: 'block_dash_groups_add_members',\n args: {formdata: formdatastr}\n }]);\n\n promises[0].done((response) => {\n if (response == true) {\n window.location.reload();\n } else {\n // TODO: Error Notification.\n }\n });\n return true;\n });\n }\n\n // Leave group.\n var leaveGroupModal = document.getElementsByClassName('group-widget-leavegroup');\n Array.from(leaveGroupModal).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n leaveGroup(e);\n });\n });\n\n /**\n * Event observer for leave group menu clicked to trigger the confirmation modal.\n * @param {event} e\n */\n function leaveGroup(e) {\n var target = e.target;\n var group = target.getAttribute('data-group');\n var groupname = target.getAttribute('data-groupname');\n\n Modal.create({\n type: Modal.types.SAVE_CANCEL,\n title: Str.get_string('groups', 'core'),\n }).then(function(modal) {\n Str.get_string('confirm', 'core').then((html) => {\n modal.setSaveButtonText(html);\n return html;\n }).catch(Notification.exception);\n modal.show();\n\n Str.get_string('confirmleavegroup', 'block_dash', groupname).then((html) => {\n modal.setBody(html);\n return html;\n }).catch(Notification.exception);\n\n modal.getRoot().on(ModalEvents.save, (e) => {\n e.preventDefault();\n var promises = AJAX.call([{\n methodname: 'block_dash_groups_leave_group',\n args: {groupid: group}\n }]);\n\n promises[0].done((response) => {\n if (response == true) {\n window.location.reload();\n } else {\n // TODO: Error Notification.\n }\n });\n });\n\n modal.getRoot().on(ModalEvents.hidden, function() {\n modal.destroy();\n });\n\n modal.getRoot().on(ModalEvents.destroyed, function() {\n modal.remove();\n modal.attachmentPoint.remove();\n });\n return modal;\n }).catch(Notification.exception);\n }\n\n // Create group.\n var createGroupModal = document.getElementsByClassName('create-group');\n Array.from(createGroupModal).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n createGroup();\n });\n });\n\n /**\n * Event listner for create group modal trigger.\n */\n function createGroup() {\n\n Modal.create({\n type: Modal.types.SAVE_CANCEL,\n title: Str.get_string('groups', 'core'),\n }).then(function(modal) {\n modal.show();\n\n var args = \"\";\n var params = {widget: 'groups', method: 'creategroup', args: args};\n Fragment.loadFragment('block_dash', 'loadwidget', contextID, params).then((html, js) => {\n modal.setBody(html);\n Templates.runTemplateJS(js);\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\n createGroupEvent(form);\n });\n return html;\n }).catch(Notification.exception);\n\n // Apply and save method.\n modal.getRoot().on(ModalEvents.save, (e) => {\n e.preventDefault();\n modal.getRoot().get(0).querySelectorAll('form').forEach(form => {\n form.querySelector('#id_submitbutton').click();\n });\n });\n\n modal.getRoot().on(ModalEvents.hidden, function() {\n modal.destroy();\n });\n return modal;\n }).catch(Notification.exception);\n\n\n }\n /**\n * Event listner for create group forms in modal to init the group creation.\n * @param {Array} form\n */\n function createGroupEvent(form) {\n form.addEventListener('submit', function(e) {\n e.preventDefault();\n var formdata = new FormData(e.target);\n if (e.target.querySelector('[name=\"name\"]').value == \"\"\n || e.target.querySelector('[name=\"courseid\"]').value == '') {\n return false;\n }\n var formdatastr = new URLSearchParams(formdata).toString();\n var promises = AJAX.call([{\n methodname: 'block_dash_groups_create_group',\n args: {formdata: formdatastr}\n }]);\n\n promises[0].done((response) => {\n return (response == true) ? window.location.reload() : '';\n });\n return true;\n });\n }\n }\n };\n});\n"],"names":["define","$","Str","Modal","ModalEvents","Fragment","Templates","AJAX","Notification","init","contextID","groupModal","document","getElementsByClassName","Array","from","forEach","element","addEventListener","e","preventDefault","group","target","getAttribute","create","title","get_string","then","modal","show","params","widget","method","args","JSON","stringify","loadFragment","html","js","setBody","runTemplateJS","catch","exception","getRoot","on","hidden","destroy","groupUsers","type","types","SAVE_CANCEL","setLarge","get","querySelectorAll","form","formdata","FormData","querySelector","value","formdatastr","URLSearchParams","toString","call","methodname","done","response","window","location","reload","groupAddEventListeners","save","click","addGroupUsers","leaveGroupModal","groupname","setSaveButtonText","groupid","destroyed","remove","attachmentPoint","leaveGroup","createGroupModal","createGroupEvent"],"mappings":"AACAA,2BAAO,CAAC,SAAU,WAAY,qBAAsB,oBAChD,gBAAiB,iBAAkB,YAAa,sBACpD,SAASC,EAAGC,IAAKC,MAAOC,YAAaC,SAAUC,UAAWC,KAAMC,oBAErD,CACHC,KAAM,SAASC,eAEPC,WAAaC,SAASC,uBAAuB,4BACjDC,MAAMC,KAAKJ,YAAYK,SAAQ,SAASC,SACpCA,QAAQC,iBAAiB,SAAS,SAASC,GACvCA,EAAEC,qBAEEC,MADSF,EAAEG,OACIC,aAAa,cAChCpB,MAAMqB,OAAO,CACTC,MAAOvB,IAAIwB,W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diff --git a/amd/build/preferences_modal.min.js b/amd/build/preferences_modal.min.js
index 5e03fa8..4cd7429 100644
--- a/amd/build/preferences_modal.min.js
+++ b/amd/build/preferences_modal.min.js
@@ -8,4 +8,4 @@
*/
define("block_dash/preferences_modal",["jquery","core/str","core/modal_factory","core/modal_events","core/fragment","core/ajax","block_dash/select2","core/notification"],(function($,Str,ModalFactory,ModalEvents,Fragment,Ajax,Select2,Notification){var PreferencesModal=function(selector,contextid,onCloseCallback){this.contextid=contextid,this.onCloseCallback=onCloseCallback,this.tab="",this.init(selector)};return PreferencesModal.prototype.modal=null,PreferencesModal.prototype.contextid=-1,PreferencesModal.prototype.init=function(selector){var triggers=$(selector);return Str.get_string("editpreferences","block_dash").then(function(title){return ModalFactory.create({type:ModalFactory.types.DEFAULT,title:title,body:this.getBody()},triggers)}.bind(this)).then(function(modal){return this.modal=modal,this.modal.setLarge(),this.modal.getRoot().on(ModalEvents.shown,function(){this.modal.setBody(this.getBody())}.bind(this)),this.modal.getRoot().on("change","#id_config_preferences_layout",this.submitFormAjax.bind(this,!1)),this.modal.getRoot().on("click","[data-action=cancel]",(()=>{this.modal.hide()})),this.modal.getRoot().on(ModalEvents.save,this.submitForm.bind(this)),this.modal.getRoot().on("submit","form",this.submitFormAjax.bind(this,!0)),this.modal.getRoot().on(ModalEvents.bodyRendered,function(){$("#fgroup_id_available_fields .form-inline > fieldset > div").sortable({items:".form-check-inline.fitem",handle:".drag-handle",axis:"y"}),this.initSelect2()}.bind(this)),this.modal.getRoot().on(ModalEvents.hidden,function(e){window.onbeforeunload=null,this.onCloseCallback&&this.onCloseCallback(e)}.bind(this)),this.modal.getRoot().on("click","[data-action=change-tab]",(e=>{this.changeTab($(e.target).data("tab"))})),this.modal}.bind(this))},PreferencesModal.prototype.changeTab=function(tab){this.tab=tab,this.submitFormAjax(!1)},PreferencesModal.prototype.getBody=function(formdata){void 0===formdata&&(formdata={});var params={jsonformdata:JSON.stringify(formdata),tab:this.tab};return Fragment.loadFragment("block_dash","block_preferences_form",this.contextid,params)},PreferencesModal.prototype.handleFormSubmissionResponse=function(formData,closeWhenDone,response){response.validationerrors||!closeWhenDone?this.modal.setBody(this.getBody(formData)):closeWhenDone&&this.modal.hide()},PreferencesModal.prototype.handleFormSubmissionFailure=function(data){this.modal.setBody(this.getBody(data))},PreferencesModal.prototype.submitFormAjax=function(closeWhenDone,e){e&&e.preventDefault();var invalid=$.merge(this.modal.getRoot().find('[aria-invalid="true"]'),this.modal.getRoot().find(".error"));if(invalid.length)invalid.first().focus();else{var formData=this.modal.getRoot().find("form").serialize();Ajax.call([{methodname:"block_dash_submit_preferences_form",args:{contextid:this.contextid,jsonformdata:JSON.stringify(formData)},done:this.handleFormSubmissionResponse.bind(this,formData,closeWhenDone),fail:this.handleFormSubmissionFailure.bind(this,formData)}])[0].fail(Notification.exception)}},PreferencesModal.prototype.getModal=function(){return this.modal},PreferencesModal.prototype.submitForm=function(e){e.preventDefault(),this.modal.getRoot().find("form").submit()},PreferencesModal.prototype.initSelect2=function(){this.modal.getRoot().find(".select2-form select").each((function(index,element){let placeholder=null;$(element).find("option[value='-1']")&&(placeholder={id:"-1",text:$(element).find("option[value='-1']").text()}),$(element).select2({dropdownParent:$(this).parent(),allowClear:!0,theme:"bootstrap4",placeholder:placeholder}).on("select2:unselecting",(function(){$(this).data("unselecting",!0)})).on("select2:opening",(function(e){$(this).data("unselecting")&&($(this).removeData("unselecting"),e.preventDefault())}))}))},PreferencesModal}));
-//# sourceMappingURL=preferences_modal.min.js.map
+//# sourceMappingURL=preferences_modal.min.js.map
\ No newline at end of file
diff --git a/amd/build/preferences_modal.min.js.map b/amd/build/preferences_modal.min.js.map
index f679307..9edc5f0 100644
--- a/amd/build/preferences_modal.min.js.map
+++ b/amd/build/preferences_modal.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"preferences_modal.min.js","sources":["../src/preferences_modal.js"],"sourcesContent":["/**\r\n * Add a create new group modal to the page.\r\n *\r\n * @module core_group/newgroup\r\n * @class PreferencesModal\r\n * @copyright 2017 Damyon Wiese \r\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\r\n */\r\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events',\r\n 'core/fragment', 'core/ajax', 'block_dash/select2', 'core/notification'],\r\n function($, Str, ModalFactory, ModalEvents, Fragment, Ajax, Select2, Notification) {\r\n\r\n /**\r\n * Constructor\r\n *\r\n * @param {String} selector used to find triggers for the new group modal.\r\n * @param {int} contextid\r\n * @param {Function} onCloseCallback\r\n *\r\n * Each call to init gets it's own instance of this class.\r\n */\r\n var PreferencesModal = function(selector, contextid, onCloseCallback) {\r\n this.contextid = contextid;\r\n this.onCloseCallback = onCloseCallback;\r\n this.tab = \"\";\r\n this.init(selector);\r\n };\r\n\r\n /**\r\n * @var {Modal} modal\r\n * @private\r\n */\r\n PreferencesModal.prototype.modal = null;\r\n\r\n /**\r\n * @var {int} contextid\r\n * @private\r\n */\r\n PreferencesModal.prototype.contextid = -1;\r\n\r\n /**\r\n * Initialise the class.\r\n *\r\n * @param {String} selector used to find triggers for the new group modal.\r\n * @private\r\n * @return {Promise}\r\n */\r\n PreferencesModal.prototype.init = function(selector) {\r\n var triggers = $(selector);\r\n // Fetch the title string.\r\n return Str.get_string('editpreferences', 'block_dash').then(function(title) {\r\n // Create the modal.\r\n return ModalFactory.create({\r\n type: ModalFactory.types.DEFAULT,\r\n title: title,\r\n body: this.getBody()\r\n }, triggers);\r\n }.bind(this)).then(function(modal) {\r\n // Keep a reference to the modal.\r\n this.modal = modal;\r\n\r\n // Forms are big, we want a big modal.\r\n this.modal.setLarge();\r\n\r\n // We want to reset the form every time it is opened.\r\n this.modal.getRoot().on(ModalEvents.shown, function() {\r\n this.modal.setBody(this.getBody());\r\n }.bind(this));\r\n\r\n this.modal.getRoot().on('change', '#id_config_preferences_layout', this.submitFormAjax.bind(this, false));\r\n\r\n this.modal.getRoot().on('click', '[data-action=cancel]', () => {\r\n this.modal.hide();\r\n });\r\n\r\n // We catch the modal save event, and use it to submit the form inside the modal.\r\n // Triggering a form submission will give JS validation scripts a chance to check for errors.\r\n this.modal.getRoot().on(ModalEvents.save, this.submitForm.bind(this));\r\n // We also catch the form submit event and use it to submit the form with ajax.\r\n this.modal.getRoot().on('submit', 'form', this.submitFormAjax.bind(this, true));\r\n\r\n this.modal.getRoot().on(ModalEvents.bodyRendered, function() {\r\n $(\"#fgroup_id_available_fields .form-inline > fieldset > div\").sortable({\r\n items: \".form-check-inline.fitem\",\r\n handle: \".drag-handle\",\r\n axis: \"y\"\r\n });\r\n\r\n this.initSelect2();\r\n }.bind(this));\r\n\r\n this.modal.getRoot().on(ModalEvents.hidden, function(e) {\r\n // Prevent \"changes may be lost\" popup.\r\n window.onbeforeunload = null;\r\n if (this.onCloseCallback) {\r\n this.onCloseCallback(e);\r\n }\r\n }.bind(this));\r\n\r\n this.modal.getRoot().on('click', '[data-action=change-tab]', (e) => {\r\n this.changeTab($(e.target).data('tab'));\r\n });\r\n\r\n return this.modal;\r\n }.bind(this));\r\n };\r\n\r\n PreferencesModal.prototype.changeTab = function(tab) {\r\n this.tab = tab;\r\n this.submitFormAjax(false);\r\n };\r\n\r\n /**\r\n * Get modal body content.\r\n * @method getBody\r\n * @param {Object} formdata\r\n * @private\r\n * @return {Promise}\r\n */\r\n PreferencesModal.prototype.getBody = function(formdata) {\r\n if (typeof formdata === \"undefined\") {\r\n formdata = {};\r\n }\r\n\r\n // Get the content of the modal.\r\n var params = {\r\n jsonformdata: JSON.stringify(formdata),\r\n tab: this.tab\r\n };\r\n return Fragment.loadFragment('block_dash', 'block_preferences_form', this.contextid, params);\r\n };\r\n\r\n /**\r\n * Form submission handler.\r\n * @method handleFormSubmissionResponse\r\n * @param {Object} formData\r\n * @param {Boolean} closeWhenDone\r\n * @param {Object} response\r\n * @private\r\n */\r\n PreferencesModal.prototype.handleFormSubmissionResponse = function(formData, closeWhenDone, response) {\r\n if (response.validationerrors || !closeWhenDone) {\r\n this.modal.setBody(this.getBody(formData));\r\n } else if (closeWhenDone) {\r\n this.modal.hide();\r\n }\r\n };\r\n\r\n /**\r\n * @method handleFormSubmissionFailure\r\n * @param {Object} data\r\n * @private\r\n */\r\n PreferencesModal.prototype.handleFormSubmissionFailure = function(data) {\r\n // Oh noes! Epic fail :(\r\n // Ah wait - this is normal. We need to re-display the form with errors!\r\n this.modal.setBody(this.getBody(data));\r\n };\r\n\r\n /**\r\n * Private method\r\n *\r\n * @method submitFormAjax\r\n * @private\r\n * @param {boolean} closeWhenDone If true modal will close after successful submission.\r\n * @param {Event} e Form submission event.\r\n */\r\n PreferencesModal.prototype.submitFormAjax = function(closeWhenDone, e) {\r\n // We don't want to do a real form submission.\r\n if (e) {\r\n e.preventDefault();\r\n }\r\n\r\n // Now the change events have run, see if there are any \"invalid\" form fields.\r\n var invalid = $.merge(\r\n this.modal.getRoot().find('[aria-invalid=\"true\"]'),\r\n this.modal.getRoot().find('.error')\r\n );\r\n\r\n // If we found invalid fields, focus on the first one and do not submit via ajax.\r\n if (invalid.length) {\r\n invalid.first().focus();\r\n return;\r\n }\r\n\r\n // Convert all the form elements values to a serialised string.\r\n var formData = this.modal.getRoot().find('form').serialize();\r\n\r\n // Now we can continue...\r\n Ajax.call([{\r\n methodname: 'block_dash_submit_preferences_form',\r\n args: {\r\n contextid: this.contextid,\r\n jsonformdata: JSON.stringify(formData)\r\n },\r\n done: this.handleFormSubmissionResponse.bind(this, formData, closeWhenDone),\r\n fail: this.handleFormSubmissionFailure.bind(this, formData)\r\n }])[0].fail(Notification.exception);\r\n };\r\n\r\n PreferencesModal.prototype.getModal = function() {\r\n return this.modal;\r\n };\r\n\r\n /**\r\n * This triggers a form submission, so that any mform elements can do final tricks before the form submission is processed.\r\n *\r\n * @method submitForm\r\n * @param {Event} e Form submission event.\r\n * @private\r\n */\r\n PreferencesModal.prototype.submitForm = function(e) {\r\n e.preventDefault();\r\n this.modal.getRoot().find('form').submit();\r\n };\r\n\r\n PreferencesModal.prototype.initSelect2 = function() {\r\n this.modal.getRoot().find('.select2-form select').each(function(index, element) {\r\n let placeholder = null;\r\n if ($(element).find(\"option[value='-1']\")) {\r\n placeholder = {\r\n id: '-1', // The value of the option\r\n text: $(element).find(\"option[value='-1']\").text()\r\n };\r\n }\r\n $(element).select2({\r\n dropdownParent: $(this).parent(),\r\n allowClear: true,\r\n theme: 'bootstrap4',\r\n placeholder: placeholder\r\n }).on('select2:unselecting', function() {\r\n $(this).data('unselecting', true);\r\n }).on('select2:opening', function(e) {\r\n if ($(this).data('unselecting')) {\r\n $(this).removeData('unselecting');\r\n e.preventDefault();\r\n }\r\n });\r\n });\r\n };\r\n\r\n return PreferencesModal;\r\n});\r\n"],"names":["define","$","Str","ModalFactory","ModalEvents","Fragment","Ajax","Select2","Notification","PreferencesModal","selector","contextid","onCloseCallback","tab","init","prototype","modal","triggers","get_string","then","title","create","type","types","DEFAULT","body","this","getBody","bind","setLarge","getRoot","on","shown","setBody","submitFormAjax","hide","save","submitForm","bodyRendered","sortable","items","handle","axis","initSelect2","hidden","e","window","onbeforeunload","changeTab","target","data","formdata","params","jsonformdata","JSON","stringify","loadFragment","handleFormSubmissionResponse","formData","closeWhenDone","response","validationerrors","handleFormSubmissionFailure","preventDefault","invalid","merge","find","length","first","focus","serialize","call","methodname","args","done","fail","exception","getModal","submit","each","index","element","placeholder","id","text","select2","dropdownParent","parent","allowClear","theme","removeData"],"mappings":";;;;;;;;AAQAA,sCAAO,CAAC,SAAU,WAAY,qBAAsB,oBAC5C,gBAAiB,YAAa,qBAAsB,sBACxD,SAASC,EAAGC,IAAKC,aAAcC,YAAaC,SAAUC,KAAMC,QAASC,kBAWjEC,iBAAmB,SAASC,SAAUC,UAAWC,sBAC5CD,UAAYA,eACZC,gBAAkBA,qBAClBC,IAAM,QACNC,KAAKJ,kBAOdD,iBAAiBM,UAAUC,MAAQ,KAMnCP,iBAAiBM,UAAUJ,WAAa,EASxCF,iBAAiBM,UAAUD,KAAO,SAASJ,cACnCO,SAAWhB,E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K,eAAe,MAC7BnB,GAAG,mBAAmB,SAASc,GAC1B5C,EAAEyB,MAAMwB,KAAK,iBACbjD,EAAEyB,MAAMgE,WAAW,eACnB7C,EAAEkB,yBAMXtD"}
\ No newline at end of file
+{"version":3,"file":"preferences_modal.min.js","sources":["../src/preferences_modal.js"],"sourcesContent":["/**\n * Add a create new group modal to the page.\n *\n * @module core_group/newgroup\n * @class PreferencesModal\n * @copyright 2017 Damyon Wiese \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events',\n 'core/fragment', 'core/ajax', 'block_dash/select2', 'core/notification'],\n function($, Str, ModalFactory, ModalEvents, Fragment, Ajax, Select2, Notification) {\n\n /**\n * Constructor\n *\n * @param {String} selector used to find triggers for the new group modal.\n * @param {int} contextid\n * @param {Function} onCloseCallback\n *\n * Each call to init gets it's own instance of this class.\n */\n var PreferencesModal = function(selector, contextid, onCloseCallback) {\n this.contextid = contextid;\n this.onCloseCallback = onCloseCallback;\n this.tab = \"\";\n this.init(selector);\n };\n\n /**\n * @var {Modal} modal\n * @private\n */\n PreferencesModal.prototype.modal = null;\n\n /**\n * @var {int} contextid\n * @private\n */\n PreferencesModal.prototype.contextid = -1;\n\n /**\n * Initialise the class.\n *\n * @param {String} selector used to find triggers for the new group modal.\n * @private\n * @return {Promise}\n */\n PreferencesModal.prototype.init = function(selector) {\n var triggers = $(selector);\n // Fetch the title string.\n return Str.get_string('editpreferences', 'block_dash').then(function(title) {\n // Create the modal.\n return ModalFactory.create({\n type: ModalFactory.types.DEFAULT,\n title: title,\n body: this.getBody()\n }, triggers);\n }.bind(this)).then(function(modal) {\n // Keep a reference to the modal.\n this.modal = modal;\n\n // Forms are big, we want a big modal.\n this.modal.setLarge();\n\n // We want to reset the form every time it is opened.\n this.modal.getRoot().on(ModalEvents.shown, function() {\n this.modal.setBody(this.getBody());\n }.bind(this));\n\n this.modal.getRoot().on('change', '#id_config_preferences_layout', this.submitFormAjax.bind(this, false));\n\n this.modal.getRoot().on('click', '[data-action=cancel]', () => {\n this.modal.hide();\n });\n\n // We catch the modal save event, and use it to submit the form inside the modal.\n // Triggering a form submission will give JS validation scripts a chance to check for errors.\n this.modal.getRoot().on(ModalEvents.save, this.submitForm.bind(this));\n // We also catch the form submit event and use it to submit the form with ajax.\n this.modal.getRoot().on('submit', 'form', this.submitFormAjax.bind(this, true));\n\n this.modal.getRoot().on(ModalEvents.bodyRendered, function() {\n $(\"#fgroup_id_available_fields .form-inline > fieldset > div\").sortable({\n items: \".form-check-inline.fitem\",\n handle: \".drag-handle\",\n axis: \"y\"\n });\n\n this.initSelect2();\n }.bind(this));\n\n this.modal.getRoot().on(ModalEvents.hidden, function(e) {\n // Prevent \"changes may be lost\" popup.\n window.onbeforeunload = null;\n if (this.onCloseCallback) {\n this.onCloseCallback(e);\n }\n }.bind(this));\n\n this.modal.getRoot().on('click', '[data-action=change-tab]', (e) => {\n this.changeTab($(e.target).data('tab'));\n });\n\n return this.modal;\n }.bind(this));\n };\n\n PreferencesModal.prototype.changeTab = function(tab) {\n this.tab = tab;\n this.submitFormAjax(false);\n };\n\n /**\n * Get modal body content.\n * @method getBody\n * @param {Object} formdata\n * @private\n * @return {Promise}\n */\n PreferencesModal.prototype.getBody = function(formdata) {\n if (typeof formdata === \"undefined\") {\n formdata = {};\n }\n\n // Get the content of the modal.\n var params = {\n jsonformdata: JSON.stringify(formdata),\n tab: this.tab\n };\n return Fragment.loadFragment('block_dash', 'block_preferences_form', this.contextid, params);\n };\n\n /**\n * Form submission handler.\n * @method handleFormSubmissionResponse\n * @param {Object} formData\n * @param {Boolean} closeWhenDone\n * @param {Object} response\n * @private\n */\n PreferencesModal.prototype.handleFormSubmissionResponse = function(formData, closeWhenDone, response) {\n if (response.validationerrors || !closeWhenDone) {\n this.modal.setBody(this.getBody(formData));\n } else if (closeWhenDone) {\n this.modal.hide();\n }\n };\n\n /**\n * @method handleFormSubmissionFailure\n * @param {Object} data\n * @private\n */\n PreferencesModal.prototype.handleFormSubmissionFailure = function(data) {\n // Oh noes! Epic fail :(\n // Ah wait - this is normal. We need to re-display the form with errors!\n this.modal.setBody(this.getBody(data));\n };\n\n /**\n * Private method\n *\n * @method submitFormAjax\n * @private\n * @param {boolean} closeWhenDone If true modal will close after successful submission.\n * @param {Event} e Form submission event.\n */\n PreferencesModal.prototype.submitFormAjax = function(closeWhenDone, e) {\n // We don't want to do a real form submission.\n if (e) {\n e.preventDefault();\n }\n\n // Now the change events have run, see if there are any \"invalid\" form fields.\n var invalid = $.merge(\n this.modal.getRoot().find('[aria-invalid=\"true\"]'),\n this.modal.getRoot().find('.error')\n );\n\n // If we found invalid fields, focus on the first one and do not submit via ajax.\n if (invalid.length) {\n invalid.first().focus();\n return;\n }\n\n // Convert all the form elements values to a serialised string.\n var formData = this.modal.getRoot().find('form').serialize();\n\n // Now we can continue...\n Ajax.call([{\n methodname: 'block_dash_submit_preferences_form',\n args: {\n contextid: this.contextid,\n jsonformdata: JSON.stringify(formData)\n },\n done: this.handleFormSubmissionResponse.bind(this, formData, closeWhenDone),\n fail: this.handleFormSubmissionFailure.bind(this, formData)\n }])[0].fail(Notification.exception);\n };\n\n PreferencesModal.prototype.getModal = function() {\n return this.modal;\n };\n\n /**\n * This triggers a form submission, so that any mform elements can do final tricks before the form submission is processed.\n *\n * @method submitForm\n * @param {Event} e Form submission event.\n * @private\n */\n PreferencesModal.prototype.submitForm = function(e) {\n e.preventDefault();\n this.modal.getRoot().find('form').submit();\n };\n\n PreferencesModal.prototype.initSelect2 = function() {\n this.modal.getRoot().find('.select2-form select').each(function(index, element) {\n let placeholder = null;\n if ($(element).find(\"option[value='-1']\")) {\n placeholder = {\n id: '-1', // The value of the option\n text: $(element).find(\"option[value='-1']\").text()\n };\n }\n $(element).select2({\n dropdownParent: $(this).parent(),\n allowClear: true,\n theme: 'bootstrap4',\n placeholder: placeholder\n }).on('select2:unselecting', function() {\n $(this).data('unselecting', true);\n }).on('select2:opening', function(e) {\n if ($(this).data('unselecting')) {\n $(this).removeData('unselecting');\n e.preventDefault();\n }\n });\n });\n };\n\n return PreferencesModal;\n});\n"],"names":["define","$","Str","ModalFactory","ModalEvents","Fragment","Ajax","Select2","Notification","PreferencesModal","selector","contextid","onCloseCallback","tab","init","prototype","modal","triggers","get_string","then","title","create","type","types","DEFAULT","body","this","getBody","bind","setLarge","getRoot","on","shown","setBody","submitFormAjax","hide","save","submitForm","bodyRendered","sortable","items","handle","axis","initSelect2","hidden","e","window","onbeforeunload","changeTab","target","data","formdata","params","jsonformdata","JSON","stringify","loadFragment","handleFormSubmissionResponse","formData","closeWhenDone","response","validationerrors","handleFormSubmissionFailure","preventDefault","invalid","merge","find","length","first","focus","serialize","call","methodname","args","done","fail","exception","getModal","submit","each","index","element","placeholder","id","text","select2","dropdownParent","parent","allowClear","theme","removeData"],"mappings":";;;;;;;;AAQAA,sCAAO,CAAC,SAAU,WAAY,qBAAsB,oBAC5C,gBAAiB,YAAa,qBAAsB,sBACxD,SAASC,EAAGC,IAAKC,aAAcC,YAAaC,SAAUC,KAAMC,QAASC,kBAWjEC,iBAAmB,SAASC,SAAUC,UAAWC,sBAC5CD,UAAYA,eACZC,gBAAkBA,qBAClBC,IAAM,QACNC,KAAKJ,kBAOdD,iBAAiBM,UAAUC,MAAQ,KAMnCP,iBAAiBM,UAAUJ,WAAa,EASxCF,iBAAiBM,UAAUD,KAAO,SAASJ,cACnCO,SAAWhB,EAAES,iBAEVR,IAAIgB,WAAW,kBAAmB,cAAcC,KAAK,SAASC,cAE1DjB,aAAakB,OAAO,CACvBC,KAAMnB,aAAaoB,MAAMC,QACzBJ,MAAOA,MACPK,KAAMC,KAAKC,WACZV,WACLW,KAAKF,OAAOP,KAAK,SAASH,mBAEnBA,MAAQA,WAGRA,MAAMa,gBAGNb,MAAMc,UAAUC,GAAG3B,YAAY4B,MAAO,gBAClChB,MAAMiB,QAAQP,KAAKC,YAC1BC,KAAKF,YAEFV,MAAMc,UAAUC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UAAUoC,KAAK,yBAC1BxC,KAAKV,MAAMc,UAAUoC,KAAK,cAI1BF,QAAQG,OACRH,QAAQI,QAAQC,iBAKhBX,SAAWhC,KAAKV,MAAMc,UAAUoC,KAAK,QAAQI,YAGjDhE,KAAKiE,KAAK,CAAC,CACPC,WAAY,qCACZC,KAAM,CACF9D,UAAWe,KAAKf,UAChB0C,aAAcC,KAAKC,UAAUG,WAEjCgB,KAAMhD,KAAK+B,6BAA6B7B,KAAKF,KAAMgC,SAAUC,eAC7DgB,KAAMjD,KAAKoC,4BAA4BlC,KAAKF,KAAMgC,aAClD,GAAGiB,KAAKnE,aAAaoE,aAG7BnE,iBAAiBM,UAAU8D,SAAW,kBAC3BnD,KAAKV,OAUhBP,iBAAiBM,UAAUsB,WAAa,SAASQ,GAC7CA,EAAEkB,sBACG/C,MAAMc,UAAUoC,KAAK,QAAQY,UAGtCrE,iBAAiBM,UAAU4B,YAAc,gBAChC3B,MAAMc,UAAUoC,KAAK,wBAAwBa,MAAK,SAASC,MAAOC,aAC/DC,YAAc,KACdjF,EAAEgF,SAASf,KAAK,wBAChBgB,YAAc,CACVC,GAAI,KACJC,KAAMnF,EAAEgF,SAASf,KAAK,sBAAsBkB,SAGpDnF,EAAEgF,SAASI,QAAQ,CACfC,eAAgBrF,EAAEyB,MAAM6D,SACxBC,YAAY,EACZC,MAAO,aACPP,YAAaA,cACdnD,GAAG,uBAAuB,WACzB9B,EAAEyB,MAAMwB,KAAK,eAAe,MAC7BnB,GAAG,mBAAmB,SAASc,GAC1B5C,EAAEyB,MAAMwB,KAAK,iBACbjD,EAAEyB,MAAMgE,WAAW,eACnB7C,EAAEkB,yBAMXtD"}
\ No newline at end of file
diff --git a/amd/build/select2.min.js b/amd/build/select2.min.js
index 28fc86b..91579ff 100644
--- a/amd/build/select2.min.js
+++ b/amd/build/select2.min.js
@@ -5,4 +5,4 @@ var factory;factory=function(jQuery){var S2=function(){if(jQuery&&jQuery.fn&&jQu
*/
var requirejs,require,define;S2&&S2.requirejs||(S2?require=S2:S2={},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)}function normalize(name,baseName){var nameParts,nameSegment,mapValue,foundMap,lastIndex,foundI,foundStarMap,starI,i,j,part,baseParts=baseName&&baseName.split("/"),map=config.map,starMap=map&&map["*"]||{};if(name){for(lastIndex=(name=name.split("/")).length-1,config.nodeIdCompat&&jsSuffixRegExp.test(name[lastIndex])&&(name[lastIndex]=name[lastIndex].replace(jsSuffixRegExp,"")),"."===name[0].charAt(0)&&baseParts&&(name=baseParts.slice(0,baseParts.length-1).concat(name)),i=0;i0&&(name.splice(i-1,2),i-=2)}name=name.join("/")}if((baseParts||starMap)&&map){for(i=(nameParts=name.split("/")).length;i>0;i-=1){if(nameSegment=nameParts.slice(0,i).join("/"),baseParts)for(j=baseParts.length;j>0;j-=1)if((mapValue=map[baseParts.slice(0,j).join("/")])&&(mapValue=mapValue[nameSegment])){foundMap=mapValue,foundI=i;break}if(foundMap)break;!foundStarMap&&starMap&&starMap[nameSegment]&&(foundStarMap=starMap[nameSegment],starI=i)}!foundMap&&foundStarMap&&(foundMap=foundStarMap,foundI=starI),foundMap&&(nameParts.splice(0,foundI,foundMap),name=nameParts.join("/"))}return name}function makeRequire(relName,forceSync){return function(){var args=aps.call(arguments,0);return"string"!=typeof args[0]&&1===args.length&&args.push(null),req.apply(void 0,args.concat([relName,forceSync]))}}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]=!0,main.apply(void 0,args)}if(!hasProp(defined,name)&&!hasProp(defining,name))throw new Error("No "+name);return defined[name]}function splitPrefix(name){var prefix,index=name?name.indexOf("!"):-1;return index>-1&&(prefix=name.substring(0,index),name=name.substring(index+1,name.length)),[prefix,name]}function makeRelParts(relName){return relName?splitPrefix(relName):[]}function makeConfig(name){return function(){return config&&config.config&&config.config[name]||{}}}makeMap=function(name,relParts){var plugin,relName,parts=splitPrefix(name),prefix=parts[0],relResourceName=relParts[1];return name=parts[1],prefix&&(plugin=callDep(prefix=normalize(prefix,relResourceName))),prefix?name=plugin&&plugin.normalize?plugin.normalize(name,(relName=relResourceName,function(name){return normalize(name,relName)})):normalize(name,relResourceName):(prefix=(parts=splitPrefix(name=normalize(name,relResourceName)))[0],name=parts[1],prefix&&(plugin=callDep(prefix))),{f:prefix?prefix+"!"+name:name,n:name,pr:prefix,p:plugin}},handlers={require:function(name){return makeRequire(name)},exports:function(name){var e=defined[name];return void 0!==e?e: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,usingExports,args=[],callbackType=typeof callback;if(relParts=makeRelParts(relName=relName||name),"undefined"===callbackType||"function"===callbackType){for(deps=!deps.length&&callback.length?["require","exports","module"]:deps,i=0;i0&&(unshift.call(arguments,SuperClass.prototype.constructor),calledConstructor=DecoratorClass.prototype.constructor),calledConstructor.apply(this,arguments)}DecoratorClass.displayName=SuperClass.displayName,DecoratedClass.prototype=new function(){this.constructor=DecoratedClass};for(var m=0;m":">",'"':""","'":"'","/":"/"};return"string"!=typeof markup?markup:String(markup).replace(/[&<>"'\/\\]/g,(function(match){return replaceMap[match]}))},Utils.appendMany=function($element,$nodes){if("1.7"===$.fn.jquery.substr(0,3)){var $jqNodes=$();$.map($nodes,(function(node){$jqNodes=$jqNodes.add(node)})),$nodes=$jqNodes}$element.append($nodes)},Utils.__cache={};var id=0;return Utils.GetUniqueElementId=function(element){var select2Id=element.getAttribute("data-select2-id");return null==select2Id&&(element.id?(select2Id=element.id,element.setAttribute("data-select2-id",select2Id)):(element.setAttribute("data-select2-id",++id),select2Id=id.toString())),select2Id},Utils.StoreData=function(element,name,value){var id=Utils.GetUniqueElementId(element);Utils.__cache[id]||(Utils.__cache[id]={}),Utils.__cache[id][name]=value},Utils.GetData=function(element,name){var id=Utils.GetUniqueElementId(element);return name?Utils.__cache[id]&&null!=Utils.__cache[id][name]?Utils.__cache[id][name]:$(element).data(name):Utils.__cache[id]},Utils.RemoveData=function(element){var id=Utils.GetUniqueElementId(element);null!=Utils.__cache[id]&&delete Utils.__cache[id],element.removeAttribute("data-select2-id")},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)}return Utils.Extend(Results,Utils.Observable),Results.prototype.render=function(){var $results=$('
')},MultipleSelection.prototype.update=function(data){if(this.clear(),0!==data.length){for(var $selections=[],d=0;d1||singlePlaceholder)return decorated.call(this,data);this.clear();var $placeholder=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append($placeholder)},Placeholder})),S2.define("select2/selection/allowClear",["jquery","../keys","../utils"],(function($,KEYS,Utils){function AllowClear(){}return AllowClear.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container),null==this.placeholder&&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){if(!this.isDisabled()){var $clear=this.$selection.find(".select2-selection__clear");if(0!==$clear.length){evt.stopPropagation();var data=Utils.GetData($clear[0],"data"),previousVal=this.$element.val();this.$element.val(this.placeholder.id);var unselectData={data:data};if(this.trigger("clear",unselectData),unselectData.prevented)this.$element.val(previousVal);else{for(var d=0;d0||0===data.length)){var removeAll=this.options.get("translations").get("removeAllItems"),$remove=$('×');Utils.StoreData($remove[0],"data",data),this.$selection.find(".select2-selection__rendered").prepend($remove)}},AllowClear})),S2.define("select2/selection/search",["jquery","../utils","../keys"],(function($,Utils,KEYS){function Search(decorated,$element,options){decorated.call(this,$element,options)}return Search.prototype.render=function(decorated){var $search=$('');this.$searchContainer=$search,this.$search=$search.find("input");var $rendered=decorated.call(this);return this._transferTabIndex(),$rendered},Search.prototype.bind=function(decorated,container,$container){var self=this,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",!1),self._transferTabIndex()})),container.on("disable",(function(){self.$search.prop("disabled",!0)})),container.on("focus",(function(evt){self.$search.trigger("focus")})),container.on("results:focus",(function(params){params.data._resultId?self.$search.attr("aria-activedescendant",params.data._resultId):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){if(evt.stopPropagation(),self.trigger("keypress",evt),self._keyUpPrevented=evt.isDefaultPrevented(),evt.which===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){self.$search.val()&&evt.stopPropagation()}));var msie=document.documentMode,disableInputEvents=msie&&msie<=11;this.$selection.on("input.searchcheck",".select2-search--inline",(function(evt){disableInputEvents?self.$selection.off("input.search input.searchcheck"):self.$selection.off("keyup.search")})),this.$selection.on("keyup.search input.search",".select2-search--inline",(function(evt){if(disableInputEvents&&"input"===evt.type)self.$selection.off("input.search input.searchcheck");else{var key=evt.which;key!=KEYS.SHIFT&&key!=KEYS.CTRL&&key!=KEYS.ALT&&key!=KEYS.TAB&&self.handleSearch(evt)}}))},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(),searchHadFocus&&this.$search.trigger("focus")},Search.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var input=this.$search.val();this.trigger("query",{term:input})}this._keyUpPrevented=!1},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="";width=""!==this.$search.attr("placeholder")?this.$selection.find(".select2-selection__rendered").width():.75*(this.$search.val().length+1)+"em",this.$search.css("width",width)},Search})),S2.define("select2/selection/eventRelay",["jquery"],(function($){function EventRelay(){}return EventRelay.prototype.bind=function(decorated,container,$container){var self=this,relayEvents=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],preventableEvents=["opening","closing","selecting","unselecting","clearing"];decorated.call(this,container,$container),container.on("*",(function(name,params){if(-1!==$.inArray(name,relayEvents)){params=params||{};var evt=$.Event("select2:"+name,{params:params});self.$element.trigger(evt),-1!==$.inArray(name,preventableEvents)&&(params.prevented=evt.isDefaultPrevented())}}))},EventRelay})),S2.define("select2/translation",["jquery","require"],(function($,require){function Translation(dict){this.dict=dict||{}}return 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)},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])},Translation})),S2.define("select2/diacritics",[],(function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"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ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","œ":"oe","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"}})),S2.define("select2/data/base",["../utils"],(function(Utils){function BaseAdapter($element,options){BaseAdapter.__super__.constructor.call(this)}return 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){},BaseAdapter.prototype.destroy=function(){},BaseAdapter.prototype.generateResultId=function(container,data){var id=container.id+"-result-";return id+=Utils.generateChars(4),null!=data.id?id+="-"+data.id.toString():id+="-"+Utils.generateChars(4),id},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)}return Utils.Extend(SelectAdapter,BaseAdapter),SelectAdapter.prototype.current=function(callback){var data=[],self=this;this.$element.find(":selected").each((function(){var $option=$(this),option=self.item($option);data.push(option)})),callback(data)},SelectAdapter.prototype.select=function(data){var self=this;if(data.selected=!0,$(data.element).is("option"))return data.element.selected=!0,void this.$element.trigger("input").trigger("change");if(this.$element.prop("multiple"))this.current((function(currentData){var val=[];(data=[data]).push.apply(data,currentData);for(var d=0;d=0){var $existingOption=$existing.filter(onlyItem(item)),existingData=this.item($existingOption),newData=$.extend(!0,{},item,existingData),$newOption=this.option(newData);$existingOption.replaceWith($newOption)}else{var $option=this.option(item);if(item.children){var $children=this.convertToOptions(item.children);Utils.appendMany($option,$children)}$options.push($option)}}return $options},ArrayAdapter})),S2.define("select2/data/ajax",["./array","../utils","jquery"],(function(ArrayAdapter,Utils,$){function AjaxAdapter($element,options){this.ajaxOptions=this._applyDefaults(options.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),AjaxAdapter.__super__.constructor.call(this,$element,options)}return 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);return $request.then(success),$request.fail(failure),$request}};return $.extend({},defaults,options,!0)},AjaxAdapter.prototype.processResults=function(results){return results},AjaxAdapter.prototype.query=function(params,callback){var self=this;null!=this._request&&($.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var options=$.extend({type:"GET"},this.ajaxOptions);function request(){var $request=options.transport(options,(function(data){var results=self.processResults(data,params);self.options.get("debug")&&window.console&&console.error&&(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(){(!("status"in $request)||0!==$request.status&&"0"!==$request.status)&&self.trigger("results:message",{message:"errorLoading"})}));self._request=$request}"function"==typeof options.url&&(options.url=options.url.call(this.$element,params)),"function"==typeof options.data&&(options.data=options.data.call(this.$element,params)),this.ajaxOptions.delay&&null!=params.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(request,this.ajaxOptions.delay)):request()},AjaxAdapter})),S2.define("select2/data/tags",["jquery"],(function($){function Tags(decorated,$element,options){var tags=options.get("tags"),createTag=options.get("createTag");void 0!==createTag&&(this.createTag=createTag);var insertTag=options.get("insertTag");if(void 0!==insertTag&&(this.insertTag=insertTag),decorated.call(this,$element,options),$.isArray(tags))for(var t=0;t0&¶ms.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:params.term,params:params}}):decorated.call(this,params,callback)},MaximumInputLength})),S2.define("select2/data/maximumSelectionLength",[],(function(){function MaximumSelectionLength(decorated,$e,options){this.maximumSelectionLength=options.get("maximumSelectionLength"),decorated.call(this,$e,options)}return 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=null!=currentData?currentData.length:0;self.maximumSelectionLength>0&&count>=self.maximumSelectionLength?self.trigger("results:message",{message:"maximumSelected",args:{maximum:self.maximumSelectionLength}}):successCallback&&successCallback()}))},MaximumSelectionLength})),S2.define("select2/dropdown",["jquery","./utils"],(function($,Utils){function Dropdown($element,options){this.$element=$element,this.options=options,Dropdown.__super__.constructor.call(this)}return Utils.Extend(Dropdown,Utils.Observable),Dropdown.prototype.render=function(){var $dropdown=$('');return $dropdown.attr("dir",this.options.get("dir")),this.$dropdown=$dropdown,$dropdown},Dropdown.prototype.bind=function(){},Dropdown.prototype.position=function($dropdown,$container){},Dropdown.prototype.destroy=function(){this.$dropdown.remove()},Dropdown})),S2.define("select2/dropdown/search",["jquery","../utils"],(function($,Utils){function Search(){}return Search.prototype.render=function(decorated){var $rendered=decorated.call(this),$search=$('');return this.$searchContainer=$search,this.$search=$search.find("input"),$rendered.prepend($search),$rendered},Search.prototype.bind=function(decorated,container,$container){var self=this,resultsId=container.id+"-results";decorated.call(this,container,$container),this.$search.on("keydown",(function(evt){self.trigger("keypress",evt),self._keyUpPrevented=evt.isDefaultPrevented()})),this.$search.on("input",(function(evt){$(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(){container.isOpen()||self.$search.trigger("focus")})),container.on("results:all",(function(params){null!=params.query.term&&""!==params.query.term||(self.showSearch(params)?self.$searchContainer.removeClass("select2-search--hide"):self.$searchContainer.addClass("select2-search--hide"))})),container.on("results:focus",(function(params){params.data._resultId?self.$search.attr("aria-activedescendant",params.data._resultId):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=!1},Search.prototype.showSearch=function(_,params){return!0},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)}return HidePlaceholder.prototype.append=function(decorated,data){data.results=this.removePlaceholder(data.results),decorated.call(this,data)},HidePlaceholder.prototype.normalizePlaceholder=function(_,placeholder){return"string"==typeof placeholder&&(placeholder={id:"",text:placeholder}),placeholder},HidePlaceholder.prototype.removePlaceholder=function(_,data){for(var modifiedData=data.slice(0),d=data.length-1;d>=0;d--){var item=data[d];this.placeholder.id===item.id&&modifiedData.splice(d,1)}return modifiedData},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=!1}return InfiniteScroll.prototype.append=function(decorated,data){this.$loadingMore.remove(),this.loading=!1,decorated.call(this,data),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=!0})),container.on("query:append",(function(params){self.lastParams=params,self.loading=!0})),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},InfiniteScroll.prototype.loadMoreIfNeeded=function(){var isLoadMoreVisible=$.contains(document.documentElement,this.$loadingMore[0]);!this.loading&&isLoadMoreVisible&&this.$results.offset().top+this.$results.outerHeight(!1)+50>=this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)&&this.loadMore()},InfiniteScroll.prototype.loadMore=function(){this.loading=!0;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=$(''),message=this.options.get("translations").get("loadingMore");return $option.html(message(this.lastParams)),$option},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)}return AttachBody.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container),container.on("open",(function(){self._showDropdown(),self._attachPositioningHandler(container),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){$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=$(""),$dropdown=decorated.call(this);return $container.append($dropdown),this.$dropdownContainer=$container,$container},AttachBody.prototype._hideDropdown=function(decorated){this.$dropdownContainer.detach()},AttachBody.prototype._bindContainerResultHandlers=function(decorated,container){if(!this._containerResultsHandlersBound){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=!0}},AttachBody.prototype._attachPositioningHandler=function(decorated,container){var self=this,scrollEvent="scroll.select2."+container.id,resizeEvent="resize.select2."+container.id,orientationEvent="orientationchange.select2."+container.id,$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,resizeEvent="resize.select2."+container.id,orientationEvent="orientationchange.select2."+container.id;this.$container.parents().filter(Utils.hasScroll).off(scrollEvent),$(window).off(scrollEvent+" "+resizeEvent+" "+orientationEvent)},AttachBody.prototype._positionDropdown=function(){var $window=$(window),isCurrentlyAbove=this.$dropdown.hasClass("select2-dropdown--above"),isCurrentlyBelow=this.$dropdown.hasClass("select2-dropdown--below"),newDirection=null,offset=this.$container.offset();offset.bottom=offset.top+this.$container.outerHeight(!1);var container={height:this.$container.outerHeight(!1)};container.top=offset.top,container.bottom=offset.top+container.height;var dropdown_height=this.$dropdown.outerHeight(!1),viewport_top=$window.scrollTop(),viewport_bottom=$window.scrollTop()+$window.height(),enoughRoomAbove=viewport_topoffset.bottom+dropdown_height,css={left:offset.left,top:container.bottom},$offsetParent=this.$dropdownParent;"static"===$offsetParent.css("position")&&($offsetParent=$offsetParent.offsetParent());var parentOffset={top:0,left:0};($.contains(document.body,$offsetParent[0])||$offsetParent[0].isConnected)&&(parentOffset=$offsetParent.offset()),css.top-=parentOffset.top,css.left-=parentOffset.left,isCurrentlyAbove||isCurrentlyBelow||(newDirection="below"),enoughRoomBelow||!enoughRoomAbove||isCurrentlyAbove?!enoughRoomAbove&&enoughRoomBelow&&isCurrentlyAbove&&(newDirection="below"):newDirection="above",("above"==newDirection||isCurrentlyAbove&&"below"!==newDirection)&&(css.top=container.top-parentOffset.top-dropdown_height),null!=newDirection&&(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(!1)+"px"};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()},AttachBody})),S2.define("select2/dropdown/minimumResultsForSearch",[],(function(){function countResults(data){for(var count=0,d=0;d0&&(options.dataAdapter=Utils.Decorate(options.dataAdapter,MinimumInputLength)),options.maximumInputLength>0&&(options.dataAdapter=Utils.Decorate(options.dataAdapter,MaximumInputLength)),options.maximumSelectionLength>0&&(options.dataAdapter=Utils.Decorate(options.dataAdapter,MaximumSelectionLength)),options.tags&&(options.dataAdapter=Utils.Decorate(options.dataAdapter,Tags)),null==options.tokenSeparators&&null==options.tokenizer||(options.dataAdapter=Utils.Decorate(options.dataAdapter,Tokenizer)),null!=options.query){var Query=require(options.amdBase+"compat/query");options.dataAdapter=Utils.Decorate(options.dataAdapter,Query)}if(null!=options.initSelection){var InitSelection=require(options.amdBase+"compat/initSelection");options.dataAdapter=Utils.Decorate(options.dataAdapter,InitSelection)}}if(null==options.resultsAdapter&&(options.resultsAdapter=ResultsList,null!=options.ajax&&(options.resultsAdapter=Utils.Decorate(options.resultsAdapter,InfiniteScroll)),null!=options.placeholder&&(options.resultsAdapter=Utils.Decorate(options.resultsAdapter,HidePlaceholder)),options.selectOnClose&&(options.resultsAdapter=Utils.Decorate(options.resultsAdapter,SelectOnClose))),null==options.dropdownAdapter){if(options.multiple)options.dropdownAdapter=Dropdown;else{var SearchableDropdown=Utils.Decorate(Dropdown,DropdownSearch);options.dropdownAdapter=SearchableDropdown}if(0!==options.minimumResultsForSearch&&(options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,MinimumResultsForSearch)),options.closeOnSelect&&(options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,CloseOnSelect)),null!=options.dropdownCssClass||null!=options.dropdownCss||null!=options.adaptDropdownCssClass){var DropdownCSS=require(options.amdBase+"compat/dropdownCss");options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,DropdownCSS)}options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,AttachBody)}if(null==options.selectionAdapter){if(options.multiple?options.selectionAdapter=MultipleSelection:options.selectionAdapter=SingleSelection,null!=options.placeholder&&(options.selectionAdapter=Utils.Decorate(options.selectionAdapter,Placeholder)),options.allowClear&&(options.selectionAdapter=Utils.Decorate(options.selectionAdapter,AllowClear)),options.multiple&&(options.selectionAdapter=Utils.Decorate(options.selectionAdapter,SelectionSearch)),null!=options.containerCssClass||null!=options.containerCss||null!=options.adaptContainerCssClass){var ContainerCSS=require(options.amdBase+"compat/containerCss");options.selectionAdapter=Utils.Decorate(options.selectionAdapter,ContainerCSS)}options.selectionAdapter=Utils.Decorate(options.selectionAdapter,EventRelay)}options.language=this._resolveLanguage(options.language),options.language.push("en");for(var uniqueLanguages=[],l=0;l0){for(var match=$.extend(!0,{},data),c=data.children.length-1;c>=0;c--)null==matcher(params,data.children[c])&&match.children.splice(c,1);return match.children.length>0?match:matcher(params,match)}var original=stripDiacritics(data.text).toUpperCase(),term=stripDiacritics(params.term).toUpperCase();return original.indexOf(term)>-1?data:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,scrollAfterSelect:!1,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,defaultLanguage=this.defaults.language,elementLanguage=$element.prop("lang"),parentLanguage=$element.closest("[lang]").prop("lang"),languages=Array.prototype.concat.call(this._resolveLanguage(elementLanguage),this._resolveLanguage(optionLanguage),this._resolveLanguage(defaultLanguage),this._resolveLanguage(parentLanguage));return options.language=languages,options},Defaults.prototype._resolveLanguage=function(language){if(!language)return[];if($.isEmptyObject(language))return[];if($.isPlainObject(language))return[language];var languages;languages=$.isArray(language)?language:[language];for(var resolvedLanguages=[],l=0;l0){var baseLanguage=languages[l].split("-")[0];resolvedLanguages.push(baseLanguage)}return resolvedLanguages},Defaults.prototype._processTranslations=function(languages,debug){for(var translations=new Translation,l=0;l-1||($.isPlainObject(this.options[key])?$.extend(this.options[key],data[key]):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},Options})),S2.define("select2/core",["jquery","./options","./utils","./keys"],(function($,Options,Utils,KEYS){var Select2=function($element,options){null!=Utils.GetData($element[0],"select2")&&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);var tabindex=$element.attr("tabindex")||0;Utils.StoreData($element[0],"old-tabindex",tabindex),$element.attr("tabindex","-1");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);var self=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current((function(initialData){self.trigger("selection:update",{data:initialData})})),$element.addClass("select2-hidden-accessible"),$element.attr("aria-hidden","true"),this._syncAttributes(),Utils.StoreData($element[0],"select2",this),$element.data("select2",this)};return Utils.Extend(Select2,Utils.Observable),Select2.prototype._generateId=function($element){return"select2-"+(null!=$element.attr("id")?$element.attr("id"):null!=$element.attr("name")?$element.attr("name")+"-"+Utils.generateChars(2):Utils.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},Select2.prototype._placeContainer=function($container){$container.insertAfter(this.$element);var width=this._resolveWidth(this.$element,this.options.get("width"));null!=width&&$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("resolve"==method){var styleWidth=this._resolveWidth($element,"style");return null!=styleWidth?styleWidth:this._resolveWidth($element,"element")}if("element"==method){var elementWidth=$element.outerWidth(!1);return elementWidth<=0?"auto":elementWidth+"px"}if("style"==method){var style=$element.attr("style");if("string"!=typeof style)return null;for(var attrs=style.split(";"),i=0,l=attrs.length;i=1)return matches[1]}return null}return"computedstyle"==method?window.getComputedStyle($element[0]).width: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),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var observer=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=observer?(this._observer=new observer((function(mutations){self._syncA(),self._syncS(null,mutations)})),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",self._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",self._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",self._syncS,!1))},Select2.prototype._registerDataEvents=function(){var self=this;this.dataAdapter.on("*",(function(name,params){self.trigger(name,params)}))},Select2.prototype._registerSelectionEvents=function(){var self=this,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){-1===$.inArray(name,nonRelayEvents)&&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){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;self.isOpen()?key===KEYS.ESC||key===KEYS.TAB||key===KEYS.UP&&evt.altKey?(self.close(evt),evt.preventDefault()):key===KEYS.ENTER?(self.trigger("results:select",{}),evt.preventDefault()):key===KEYS.SPACE&&evt.ctrlKey?(self.trigger("results:toggle",{}),evt.preventDefault()):key===KEYS.UP?(self.trigger("results:previous",{}),evt.preventDefault()):key===KEYS.DOWN&&(self.trigger("results:next",{}),evt.preventDefault()):(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")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},Select2.prototype._isChangeMutation=function(evt,mutations){var changed=!1,self=this;if(!evt||!evt.target||"OPTION"===evt.target.nodeName||"OPTGROUP"===evt.target.nodeName){if(mutations)if(mutations.addedNodes&&mutations.addedNodes.length>0)for(var n=0;n0?changed=!0:$.isArray(mutations)&&$.each(mutations,(function(evt,mutation){if(self._isChangeMutation(evt,mutation))return changed=!0,!1}));else changed=!0;return changed}},Select2.prototype._syncSubtree=function(evt,mutations){var changed=this._isChangeMutation(evt,mutations),self=this;changed&&this.dataAdapter.current((function(currentData){self.trigger("selection:update",{data:currentData})}))},Select2.prototype.trigger=function(name,args){var actualTrigger=Select2.__super__.trigger,preTriggerMap={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===args&&(args={}),name in preTriggerMap){var preTriggerName=preTriggerMap[name],preTriggerArgs={prevented:!1,name:name,args:args};if(actualTrigger.call(this,preTriggerName,preTriggerArgs),preTriggerArgs.prevented)return void(args.prevented=!0)}actualTrigger.call(this,name,args)},Select2.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},Select2.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},Select2.prototype.close=function(evt){this.isOpen()&&this.trigger("close",{originalEvent:evt})},Select2.prototype.isEnabled=function(){return!this.isDisabled()},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){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},Select2.prototype.enable=function(args){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.'),null!=args&&0!==args.length||(args=[!0]);var disabled=!args[0];this.$element.prop("disabled",disabled)},Select2.prototype.data=function(){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=[];return this.dataAdapter.current((function(currentData){data=currentData})),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.'),null==args||0===args.length)return this.$element.val();var newVal=args[0];$.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(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),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=$('');return $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),$container},Select2})),S2.define("select2/compat/utils",["jquery"],(function($){return{syncCssClasses:function($dest,$src,adapter){var classes,adapted,replacements=[];(classes=$.trim($dest.attr("class")))&&$((classes=""+classes).split(/\s+/)).each((function(){0===this.indexOf("select2-")&&replacements.push(this)})),(classes=$.trim($src.attr("class")))&&$((classes=""+classes).split(/\s+/)).each((function(){0!==this.indexOf("select2-")&&null!=(adapted=adapter(this))&&replacements.push(adapted)})),$dest.attr("class",replacements.join(" "))}}})),S2.define("select2/compat/containerCss",["jquery","./utils"],(function($,CompatUtils){function _containerAdapter(clazz){return null}function ContainerCSS(){}return ContainerCSS.prototype.render=function(decorated){var $container=decorated.call(this),containerCssClass=this.options.get("containerCssClass")||"";$.isFunction(containerCssClass)&&(containerCssClass=containerCssClass(this.$element));var containerCssAdapter=this.options.get("adaptContainerCssClass");if(containerCssAdapter=containerCssAdapter||_containerAdapter,-1!==containerCssClass.indexOf(":all:")){containerCssClass=containerCssClass.replace(":all:","");var _cssAdapter=containerCssAdapter;containerCssAdapter=function(clazz){var adapted=_cssAdapter(clazz);return null!=adapted?adapted+" "+clazz:clazz}}var containerCss=this.options.get("containerCss")||{};return $.isFunction(containerCss)&&(containerCss=containerCss(this.$element)),CompatUtils.syncCssClasses($container,this.$element,containerCssAdapter),$container.css(containerCss),$container.addClass(containerCssClass),$container},ContainerCSS})),S2.define("select2/compat/dropdownCss",["jquery","./utils"],(function($,CompatUtils){function _dropdownAdapter(clazz){return null}function DropdownCSS(){}return DropdownCSS.prototype.render=function(decorated){var $dropdown=decorated.call(this),dropdownCssClass=this.options.get("dropdownCssClass")||"";$.isFunction(dropdownCssClass)&&(dropdownCssClass=dropdownCssClass(this.$element));var dropdownCssAdapter=this.options.get("adaptDropdownCssClass");if(dropdownCssAdapter=dropdownCssAdapter||_dropdownAdapter,-1!==dropdownCssClass.indexOf(":all:")){dropdownCssClass=dropdownCssClass.replace(":all:","");var _cssAdapter=dropdownCssAdapter;dropdownCssAdapter=function(clazz){var adapted=_cssAdapter(clazz);return null!=adapted?adapted+" "+clazz:clazz}}var dropdownCss=this.options.get("dropdownCss")||{};return $.isFunction(dropdownCss)&&(dropdownCss=dropdownCss(this.$element)),CompatUtils.syncCssClasses($dropdown,this.$element,dropdownCssAdapter),$dropdown.css(dropdownCss),$dropdown.addClass(dropdownCssClass),$dropdown},DropdownCSS})),S2.define("select2/compat/initSelection",["jquery"],(function($){function InitSelection(decorated,$element,options){options.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=options.get("initSelection"),this._isInitialized=!1,decorated.call(this,$element,options)}return InitSelection.prototype.current=function(decorated,callback){var self=this;this._isInitialized?decorated.call(this,callback):this.initSelection.call(null,this.$element,(function(data){self._isInitialized=!0,$.isArray(data)||(data=[data]),callback(data)}))},InitSelection})),S2.define("select2/compat/inputData",["jquery","../utils"],(function($,Utils){function InputData(decorated,$element,options){this._currentData=[],this._valueSeparator=options.get("valueSeparator")||",","hidden"===$element.prop("type")&&options.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `` element instead."),decorated.call(this,$element,options)}return InputData.prototype.current=function(_,callback){function getSelected(data,selectedIds){var selected=[];return data.selected||-1!==$.inArray(data.id,selectedIds)?(data.selected=!0,selected.push(data)):data.selected=!1,data.children&&selected.push.apply(selected,getSelected(data.children,selectedIds)),selected}for(var selected=[],d=0;d=0;c--){var child=data.children[c];matcher(params.term,child.text,child)||match.children.splice(c,1)}if(match.children.length>0)return match}return matcher(params.term,data.text,data)?match:null}}})),S2.define("select2/compat/query",[],(function(){function Query(decorated,$element,options){options.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `query` option has been deprecated in favor of a custom data adapter that overrides the `query` method. Support will be removed for the `query` option in future versions of Select2."),decorated.call(this,$element,options)}return Query.prototype.query=function(_,params,callback){params.callback=callback,this.options.get("query").call(null,params)},Query})),S2.define("select2/dropdown/attachContainer",[],(function(){function AttachContainer(decorated,$element,options){decorated.call(this,$element,options)}return AttachContainer.prototype.position=function(decorated,$dropdown,$container){$container.find(".dropdown-wrapper").append($dropdown),$dropdown.addClass("select2-dropdown--below"),$container.addClass("select2-container--below")},AttachContainer})),S2.define("select2/dropdown/stopPropagation",[],(function(){function StopPropagation(){}return StopPropagation.prototype.bind=function(decorated,container,$container){decorated.call(this,container,$container),this.$dropdown.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),(function(evt){evt.stopPropagation()}))},StopPropagation})),S2.define("select2/selection/stopPropagation",[],(function(){function StopPropagation(){}return StopPropagation.prototype.bind=function(decorated,container,$container){decorated.call(this,container,$container),this.$selection.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),(function(evt){evt.stopPropagation()}))},StopPropagation})),factory=function($){var nullLowestDeltaTimeout,lowestDelta,toFix=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],toBind="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],slice=Array.prototype.slice;if($.event.fixHooks)for(var i=toFix.length;i;)$.event.fixHooks[toFix[--i]]=$.event.mouseHooks;var special=$.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var i=toBind.length;i;)this.addEventListener(toBind[--i],handler,!1);else this.onmousewheel=handler;$.data(this,"mousewheel-line-height",special.getLineHeight(this)),$.data(this,"mousewheel-page-height",special.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var i=toBind.length;i;)this.removeEventListener(toBind[--i],handler,!1);else this.onmousewheel=null;$.removeData(this,"mousewheel-line-height"),$.removeData(this,"mousewheel-page-height")},getLineHeight:function(elem){var $elem=$(elem),$parent=$elem["offsetParent"in $.fn?"offsetParent":"parent"]();return $parent.length||($parent=$("body")),parseInt($parent.css("fontSize"),10)||parseInt($elem.css("fontSize"),10)||16},getPageHeight:function(elem){return $(elem).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function handler(event){var orgEvent=event||window.event,args=slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,offsetX=0,offsetY=0;if((event=$.event.fix(orgEvent)).type="mousewheel","detail"in orgEvent&&(deltaY=-1*orgEvent.detail),"wheelDelta"in orgEvent&&(deltaY=orgEvent.wheelDelta),"wheelDeltaY"in orgEvent&&(deltaY=orgEvent.wheelDeltaY),"wheelDeltaX"in orgEvent&&(deltaX=-1*orgEvent.wheelDeltaX),"axis"in orgEvent&&orgEvent.axis===orgEvent.HORIZONTAL_AXIS&&(deltaX=-1*deltaY,deltaY=0),delta=0===deltaY?deltaX:deltaY,"deltaY"in orgEvent&&(delta=deltaY=-1*orgEvent.deltaY),"deltaX"in orgEvent&&(deltaX=orgEvent.deltaX,0===deltaY&&(delta=-1*deltaX)),0!==deltaY||0!==deltaX){if(1===orgEvent.deltaMode){var lineHeight=$.data(this,"mousewheel-line-height");delta*=lineHeight,deltaY*=lineHeight,deltaX*=lineHeight}else if(2===orgEvent.deltaMode){var pageHeight=$.data(this,"mousewheel-page-height");delta*=pageHeight,deltaY*=pageHeight,deltaX*=pageHeight}if(absDelta=Math.max(Math.abs(deltaY),Math.abs(deltaX)),(!lowestDelta||absDelta=1?"floor":"ceil"](delta/lowestDelta),deltaX=Math[deltaX>=1?"floor":"ceil"](deltaX/lowestDelta),deltaY=Math[deltaY>=1?"floor":"ceil"](deltaY/lowestDelta),special.settings.normalizeOffset&&this.getBoundingClientRect){var boundingRect=this.getBoundingClientRect();offsetX=event.clientX-boundingRect.left,offsetY=event.clientY-boundingRect.top}return event.deltaX=deltaX,event.deltaY=deltaY,event.deltaFactor=lowestDelta,event.offsetX=offsetX,event.offsetY=offsetY,event.deltaMode=0,args.unshift(event,delta,deltaX,deltaY),nullLowestDeltaTimeout&&clearTimeout(nullLowestDeltaTimeout),nullLowestDeltaTimeout=setTimeout(nullLowestDelta,200),($.event.dispatch||$.event.handle).apply(this,args)}}function nullLowestDelta(){lowestDelta=null}function shouldAdjustOldDeltas(orgEvent,absDelta){return special.settings.adjustOldDeltas&&"mousewheel"===orgEvent.type&&absDelta%120==0}$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn){return this.unbind("mousewheel",fn)}})},"function"==typeof S2.define&&S2.define.amd?S2.define("jquery-mousewheel",["jquery"],factory):"object"==typeof exports?module.exports=factory:factory(jQuery),S2.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],(function($,_,Select2,Defaults,Utils){if(null==$.fn.select2){var thisMethods=["open","close","destroy"];$.fn.select2=function(options){if("object"==typeof(options=options||{}))return this.each((function(){var instanceOptions=$.extend(!0,{},options);new Select2($(this),instanceOptions)})),this;if("string"==typeof options){var ret,args=Array.prototype.slice.call(arguments,1);return this.each((function(){var instance=Utils.GetData(this,"select2");null==instance&&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)})),$.inArray(options,thisMethods)>-1?this:ret}throw new Error("Invalid arguments for Select2: "+options)}}return null==$.fn.select2.defaults&&($.fn.select2.defaults=Defaults),Select2})),{define:S2.define,require:S2.require}}(),select2=S2.require("jquery.select2");return jQuery.fn.select2.amd=S2,select2},"function"==typeof define&&define.amd?define("block_dash/select2",["jquery"],factory):"object"==typeof module&&module.exports?module.exports=function(root,jQuery){return void 0===jQuery&&(jQuery="undefined"!=typeof window?require("jquery"):require("jquery")(root)),factory(jQuery),jQuery}:factory(jQuery);
-//# sourceMappingURL=select2.min.js.map
+//# sourceMappingURL=select2.min.js.map
\ No newline at end of file
diff --git a/amd/build/select2.min.js.map b/amd/build/select2.min.js.map
index 8933430..69b0af9 100644
--- a/amd/build/select2.min.js.map
+++ b/amd/build/select2.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"select2.min.js","sources":["../src/select2.js"],"sourcesContent":["/*!\r\n * Select2 4.0.13\r\n * https://select2.github.io\r\n *\r\n * Released under the MIT license\r\n * https://github.com/select2/select2/blob/master/LICENSE.md\r\n */\r\n;(function (factory) {\r\n if (typeof define === 'function' && define.amd) {\r\n // AMD. Register as an anonymous module.\r\n define(['jquery'], factory);\r\n } else if (typeof module === 'object' && module.exports) {\r\n // Node/CommonJS\r\n module.exports = function (root, jQuery) {\r\n if (jQuery === undefined) {\r\n // require('jQuery') returns a factory that requires window to\r\n // build a jQuery instance, we normalize how we use modules\r\n // that require this pattern but the window provided is a noop\r\n // if it's defined (how jquery works)\r\n if (typeof window !== 'undefined') {\r\n jQuery = require('jquery');\r\n }\r\n else {\r\n jQuery = require('jquery')(root);\r\n }\r\n }\r\n factory(jQuery);\r\n return jQuery;\r\n };\r\n } else {\r\n // Browser globals\r\n factory(jQuery);\r\n }\r\n} (function (jQuery) {\r\n // This is needed so we can catch the AMD loader configuration and use it\r\n // The inner file should be wrapped (by `banner.start.js`) in a function that\r\n // returns the AMD loader references.\r\n var S2 =(function () {\r\n // Restore the Select2 AMD loader so it can be used\r\n // Needed mostly in the language files, where the loader is not inserted\r\n if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {\r\n var S2 = jQuery.fn.select2.amd;\r\n }\r\n var S2;(function () { if (!S2 || !S2.requirejs) {\r\n if (!S2) { S2 = {}; } else { require = S2; }\r\n /**\r\n * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.\r\n * Released under MIT license, http://github.com/requirejs/almond/LICENSE\r\n */\r\n//Going sloppy to avoid 'use strict' string cost, but strict practices should\r\n//be followed.\r\n /*global setTimeout: false */\r\n\r\n var requirejs, require, define;\r\n (function (undef) {\r\n var main, req, makeMap, handlers,\r\n defined = {},\r\n waiting = {},\r\n config = {},\r\n defining = {},\r\n hasOwn = Object.prototype.hasOwnProperty,\r\n aps = [].slice,\r\n jsSuffixRegExp = /\\.js$/;\r\n\r\n function hasProp(obj, prop) {\r\n return hasOwn.call(obj, prop);\r\n }\r\n\r\n /**\r\n * Given a relative module name, like ./something, normalize it to\r\n * a real name that can be mapped to a path.\r\n * @param {String} name the relative name\r\n * @param {String} baseName a real name that the name arg is relative\r\n * to.\r\n * @returns {String} normalized name\r\n */\r\n function normalize(name, baseName) {\r\n var nameParts, nameSegment, mapValue, foundMap, lastIndex,\r\n foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,\r\n baseParts = baseName && baseName.split(\"/\"),\r\n map = config.map,\r\n starMap = (map && map['*']) || {};\r\n\r\n //Adjust any relative paths.\r\n if (name) {\r\n name = name.split('/');\r\n lastIndex = name.length - 1;\r\n\r\n // If wanting node ID compatibility, strip .js from end\r\n // of IDs. Have to do this here, and not in nameToUrl\r\n // because node allows either .js or non .js to map\r\n // to same file.\r\n if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {\r\n name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');\r\n }\r\n\r\n // Starts with a '.' so need the baseName\r\n if (name[0].charAt(0) === '.' && baseParts) {\r\n //Convert baseName to array, and lop off the last part,\r\n //so that . matches that 'directory' and not name of the baseName's\r\n //module. For instance, baseName of 'one/two/three', maps to\r\n //'one/two/three.js', but we want the directory, 'one/two' for\r\n //this normalization.\r\n normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);\r\n name = normalizedBaseParts.concat(name);\r\n }\r\n\r\n //start trimDots\r\n for (i = 0; i < name.length; i++) {\r\n part = name[i];\r\n if (part === '.') {\r\n name.splice(i, 1);\r\n i -= 1;\r\n } else if (part === '..') {\r\n // If at the start, or previous value is still ..,\r\n // keep them so that when converted to a path it may\r\n // still work when converted to a path, even though\r\n // as an ID it is less than ideal. In larger point\r\n // releases, may be better to just kick out an error.\r\n if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {\r\n continue;\r\n } else if (i > 0) {\r\n name.splice(i - 1, 2);\r\n i -= 2;\r\n }\r\n }\r\n }\r\n //end trimDots\r\n\r\n name = name.join('/');\r\n }\r\n\r\n //Apply map config if available.\r\n if ((baseParts || starMap) && map) {\r\n nameParts = name.split('/');\r\n\r\n for (i = nameParts.length; i > 0; i -= 1) {\r\n nameSegment = nameParts.slice(0, i).join(\"/\");\r\n\r\n if (baseParts) {\r\n //Find the longest baseName segment match in the config.\r\n //So, do joins on the biggest to smallest lengths of baseParts.\r\n for (j = baseParts.length; j > 0; j -= 1) {\r\n mapValue = map[baseParts.slice(0, j).join('/')];\r\n\r\n //baseName segment has config, find if it has one for\r\n //this name.\r\n if (mapValue) {\r\n mapValue = mapValue[nameSegment];\r\n if (mapValue) {\r\n //Match, update name to the new value.\r\n foundMap = mapValue;\r\n foundI = i;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (foundMap) {\r\n break;\r\n }\r\n\r\n //Check for a star map match, but just hold on to it,\r\n //if there is a shorter segment match later in a matching\r\n //config, then favor over this star map.\r\n if (!foundStarMap && starMap && starMap[nameSegment]) {\r\n foundStarMap = starMap[nameSegment];\r\n starI = i;\r\n }\r\n }\r\n\r\n if (!foundMap && foundStarMap) {\r\n foundMap = foundStarMap;\r\n foundI = starI;\r\n }\r\n\r\n if (foundMap) {\r\n nameParts.splice(0, foundI, foundMap);\r\n name = nameParts.join('/');\r\n }\r\n }\r\n\r\n return name;\r\n }\r\n\r\n function makeRequire(relName, forceSync) {\r\n return function () {\r\n //A version of a require function that passes a moduleName\r\n //value for items that may need to\r\n //look up paths relative to the moduleName\r\n var args = aps.call(arguments, 0);\r\n\r\n //If first arg is not require('string'), and there is only\r\n //one arg, it is the array form without a callback. Insert\r\n //a null so that the following concat is correct.\r\n if (typeof args[0] !== 'string' && args.length === 1) {\r\n args.push(null);\r\n }\r\n return req.apply(undef, args.concat([relName, forceSync]));\r\n };\r\n }\r\n\r\n function makeNormalize(relName) {\r\n return function (name) {\r\n return normalize(name, relName);\r\n };\r\n }\r\n\r\n function makeLoad(depName) {\r\n return function (value) {\r\n defined[depName] = value;\r\n };\r\n }\r\n\r\n function callDep(name) {\r\n if (hasProp(waiting, name)) {\r\n var args = waiting[name];\r\n delete waiting[name];\r\n defining[name] = true;\r\n main.apply(undef, args);\r\n }\r\n\r\n if (!hasProp(defined, name) && !hasProp(defining, name)) {\r\n throw new Error('No ' + name);\r\n }\r\n return defined[name];\r\n }\r\n\r\n //Turns a plugin!resource to [plugin, resource]\r\n //with the plugin being undefined if the name\r\n //did not have a plugin prefix.\r\n function splitPrefix(name) {\r\n var prefix,\r\n index = name ? name.indexOf('!') : -1;\r\n if (index > -1) {\r\n prefix = name.substring(0, index);\r\n name = name.substring(index + 1, name.length);\r\n }\r\n return [prefix, name];\r\n }\r\n\r\n //Creates a parts array for a relName where first part is plugin ID,\r\n //second part is resource ID. Assumes relName has already been normalized.\r\n function makeRelParts(relName) {\r\n return relName ? splitPrefix(relName) : [];\r\n }\r\n\r\n /**\r\n * Makes a name map, normalizing the name, and using a plugin\r\n * for normalization if necessary. Grabs a ref to plugin\r\n * too, as an optimization.\r\n */\r\n makeMap = function (name, relParts) {\r\n var plugin,\r\n parts = splitPrefix(name),\r\n prefix = parts[0],\r\n relResourceName = relParts[1];\r\n\r\n name = parts[1];\r\n\r\n if (prefix) {\r\n prefix = normalize(prefix, relResourceName);\r\n plugin = callDep(prefix);\r\n }\r\n\r\n //Normalize according\r\n if (prefix) {\r\n if (plugin && plugin.normalize) {\r\n name = plugin.normalize(name, makeNormalize(relResourceName));\r\n } else {\r\n name = normalize(name, relResourceName);\r\n }\r\n } else {\r\n name = normalize(name, relResourceName);\r\n parts = splitPrefix(name);\r\n prefix = parts[0];\r\n name = parts[1];\r\n if (prefix) {\r\n plugin = callDep(prefix);\r\n }\r\n }\r\n\r\n //Using ridiculous property names for space reasons\r\n return {\r\n f: prefix ? prefix + '!' + name : name, //fullName\r\n n: name,\r\n pr: prefix,\r\n p: plugin\r\n };\r\n };\r\n\r\n function makeConfig(name) {\r\n return function () {\r\n return (config && config.config && config.config[name]) || {};\r\n };\r\n }\r\n\r\n handlers = {\r\n require: function (name) {\r\n return makeRequire(name);\r\n },\r\n exports: function (name) {\r\n var e = defined[name];\r\n if (typeof e !== 'undefined') {\r\n return e;\r\n } else {\r\n return (defined[name] = {});\r\n }\r\n },\r\n module: function (name) {\r\n return {\r\n id: name,\r\n uri: '',\r\n exports: defined[name],\r\n config: makeConfig(name)\r\n };\r\n }\r\n };\r\n\r\n main = function (name, deps, callback, relName) {\r\n var cjsModule, depName, ret, map, i, relParts,\r\n args = [],\r\n callbackType = typeof callback,\r\n usingExports;\r\n\r\n //Use name if no relName\r\n relName = relName || name;\r\n relParts = makeRelParts(relName);\r\n\r\n //Call the callback to define the module, if necessary.\r\n if (callbackType === 'undefined' || callbackType === 'function') {\r\n //Pull out the defined dependencies and pass the ordered\r\n //values to the callback.\r\n //Default to [require, exports, module] if no deps\r\n deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;\r\n for (i = 0; i < deps.length; i += 1) {\r\n map = makeMap(deps[i], relParts);\r\n depName = map.f;\r\n\r\n //Fast path CommonJS standard dependencies.\r\n if (depName === \"require\") {\r\n args[i] = handlers.require(name);\r\n } else if (depName === \"exports\") {\r\n //CommonJS module spec 1.1\r\n args[i] = handlers.exports(name);\r\n usingExports = true;\r\n } else if (depName === \"module\") {\r\n //CommonJS module spec 1.1\r\n cjsModule = args[i] = handlers.module(name);\r\n } else if (hasProp(defined, depName) ||\r\n hasProp(waiting, depName) ||\r\n hasProp(defining, depName)) {\r\n args[i] = callDep(depName);\r\n } else if (map.p) {\r\n map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});\r\n args[i] = defined[depName];\r\n } else {\r\n throw new Error(name + ' missing ' + depName);\r\n }\r\n }\r\n\r\n ret = callback ? callback.apply(defined[name], args) : undefined;\r\n\r\n if (name) {\r\n //If setting exports via \"module\" is in play,\r\n //favor that over return value and exports. After that,\r\n //favor a non-undefined return value over exports use.\r\n if (cjsModule && cjsModule.exports !== undef &&\r\n cjsModule.exports !== defined[name]) {\r\n defined[name] = cjsModule.exports;\r\n } else if (ret !== undef || !usingExports) {\r\n //Use the return value from the function.\r\n defined[name] = ret;\r\n }\r\n }\r\n } else if (name) {\r\n //May just be an object definition for the module. Only\r\n //worry about defining if have a module name.\r\n defined[name] = callback;\r\n }\r\n };\r\n\r\n requirejs = require = req = function (deps, callback, relName, forceSync, alt) {\r\n if (typeof deps === \"string\") {\r\n if (handlers[deps]) {\r\n //callback in this case is really relName\r\n return handlers[deps](callback);\r\n }\r\n //Just return the module wanted. In this scenario, the\r\n //deps arg is the module name, and second arg (if passed)\r\n //is just the relName.\r\n //Normalize module name, if it contains . or ..\r\n return callDep(makeMap(deps, makeRelParts(callback)).f);\r\n } else if (!deps.splice) {\r\n //deps is a config object, not an array.\r\n config = deps;\r\n if (config.deps) {\r\n req(config.deps, config.callback);\r\n }\r\n if (!callback) {\r\n return;\r\n }\r\n\r\n if (callback.splice) {\r\n //callback is an array, which means it is a dependency list.\r\n //Adjust args if there are dependencies\r\n deps = callback;\r\n callback = relName;\r\n relName = null;\r\n } else {\r\n deps = undef;\r\n }\r\n }\r\n\r\n //Support require(['a'])\r\n callback = callback || function () {};\r\n\r\n //If relName is a function, it is an errback handler,\r\n //so remove it.\r\n if (typeof relName === 'function') {\r\n relName = forceSync;\r\n forceSync = alt;\r\n }\r\n\r\n //Simulate async callback;\r\n if (forceSync) {\r\n main(undef, deps, callback, relName);\r\n } else {\r\n //Using a non-zero value because of concern for what old browsers\r\n //do, and latest browsers \"upgrade\" to 4 if lower value is used:\r\n //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:\r\n //If want a value immediately, use require('id') instead -- something\r\n //that works in almond on the global level, but not guaranteed and\r\n //unlikely to work in other AMD implementations.\r\n setTimeout(function () {\r\n main(undef, deps, callback, relName);\r\n }, 4);\r\n }\r\n\r\n return req;\r\n };\r\n\r\n /**\r\n * Just drops the config on the floor, but returns req in case\r\n * the config return value is used.\r\n */\r\n req.config = function (cfg) {\r\n return req(cfg);\r\n };\r\n\r\n /**\r\n * Expose module registry for debugging and tooling\r\n */\r\n requirejs._defined = defined;\r\n\r\n define = function (name, deps, callback) {\r\n if (typeof name !== 'string') {\r\n throw new Error('See almond README: incorrect module build, no module name');\r\n }\r\n\r\n //This module may not have dependencies\r\n if (!deps.splice) {\r\n //deps is not an array, so probably means\r\n //an object literal or factory function for\r\n //the value. Adjust args.\r\n callback = deps;\r\n deps = [];\r\n }\r\n\r\n if (!hasProp(defined, name) && !hasProp(waiting, name)) {\r\n waiting[name] = [name, deps, callback];\r\n }\r\n };\r\n\r\n define.amd = {\r\n jQuery: true\r\n };\r\n }());\r\n\r\n S2.requirejs = requirejs;S2.require = require;S2.define = define;\r\n }\r\n }());\r\n S2.define(\"almond\", function(){});\r\n\r\n /* global jQuery:false, $:false */\r\n S2.define('jquery',[],function () {\r\n var _$ = jQuery || $;\r\n\r\n if (_$ == null && console && console.error) {\r\n console.error(\r\n 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +\r\n 'found. Make sure that you are including jQuery before Select2 on your ' +\r\n 'web page.'\r\n );\r\n }\r\n\r\n return _$;\r\n });\r\n\r\n S2.define('select2/utils',[\r\n 'jquery'\r\n ], function ($) {\r\n var Utils = {};\r\n\r\n Utils.Extend = function (ChildClass, SuperClass) {\r\n var __hasProp = {}.hasOwnProperty;\r\n\r\n function BaseConstructor () {\r\n this.constructor = ChildClass;\r\n }\r\n\r\n for (var key in SuperClass) {\r\n if (__hasProp.call(SuperClass, key)) {\r\n ChildClass[key] = SuperClass[key];\r\n }\r\n }\r\n\r\n BaseConstructor.prototype = SuperClass.prototype;\r\n ChildClass.prototype = new BaseConstructor();\r\n ChildClass.__super__ = SuperClass.prototype;\r\n\r\n return ChildClass;\r\n };\r\n\r\n function getMethods (theClass) {\r\n var proto = theClass.prototype;\r\n\r\n var methods = [];\r\n\r\n for (var methodName in proto) {\r\n var m = proto[methodName];\r\n\r\n if (typeof m !== 'function') {\r\n continue;\r\n }\r\n\r\n if (methodName === 'constructor') {\r\n continue;\r\n }\r\n\r\n methods.push(methodName);\r\n }\r\n\r\n return methods;\r\n }\r\n\r\n Utils.Decorate = function (SuperClass, DecoratorClass) {\r\n var decoratedMethods = getMethods(DecoratorClass);\r\n var superMethods = getMethods(SuperClass);\r\n\r\n function DecoratedClass () {\r\n var unshift = Array.prototype.unshift;\r\n\r\n var argCount = DecoratorClass.prototype.constructor.length;\r\n\r\n var calledConstructor = SuperClass.prototype.constructor;\r\n\r\n if (argCount > 0) {\r\n unshift.call(arguments, SuperClass.prototype.constructor);\r\n\r\n calledConstructor = DecoratorClass.prototype.constructor;\r\n }\r\n\r\n calledConstructor.apply(this, arguments);\r\n }\r\n\r\n DecoratorClass.displayName = SuperClass.displayName;\r\n\r\n function ctr () {\r\n this.constructor = DecoratedClass;\r\n }\r\n\r\n DecoratedClass.prototype = new ctr();\r\n\r\n for (var m = 0; m < superMethods.length; m++) {\r\n var superMethod = superMethods[m];\r\n\r\n DecoratedClass.prototype[superMethod] =\r\n SuperClass.prototype[superMethod];\r\n }\r\n\r\n var calledMethod = function (methodName) {\r\n // Stub out the original method if it's not decorating an actual method\r\n var originalMethod = function () {};\r\n\r\n if (methodName in DecoratedClass.prototype) {\r\n originalMethod = DecoratedClass.prototype[methodName];\r\n }\r\n\r\n var decoratedMethod = DecoratorClass.prototype[methodName];\r\n\r\n return function () {\r\n var unshift = Array.prototype.unshift;\r\n\r\n unshift.call(arguments, originalMethod);\r\n\r\n return decoratedMethod.apply(this, arguments);\r\n };\r\n };\r\n\r\n for (var d = 0; d < decoratedMethods.length; d++) {\r\n var decoratedMethod = decoratedMethods[d];\r\n\r\n DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);\r\n }\r\n\r\n return DecoratedClass;\r\n };\r\n\r\n var Observable = function () {\r\n this.listeners = {};\r\n };\r\n\r\n Observable.prototype.on = function (event, callback) {\r\n this.listeners = this.listeners || {};\r\n\r\n if (event in this.listeners) {\r\n this.listeners[event].push(callback);\r\n } else {\r\n this.listeners[event] = [callback];\r\n }\r\n };\r\n\r\n Observable.prototype.trigger = function (event) {\r\n var slice = Array.prototype.slice;\r\n var params = slice.call(arguments, 1);\r\n\r\n this.listeners = this.listeners || {};\r\n\r\n // Params should always come in as an array\r\n if (params == null) {\r\n params = [];\r\n }\r\n\r\n // If there are no arguments to the event, use a temporary object\r\n if (params.length === 0) {\r\n params.push({});\r\n }\r\n\r\n // Set the `_type` of the first object to the event\r\n params[0]._type = event;\r\n\r\n if (event in this.listeners) {\r\n this.invoke(this.listeners[event], slice.call(arguments, 1));\r\n }\r\n\r\n if ('*' in this.listeners) {\r\n this.invoke(this.listeners['*'], arguments);\r\n }\r\n };\r\n\r\n Observable.prototype.invoke = function (listeners, params) {\r\n for (var i = 0, len = listeners.length; i < len; i++) {\r\n listeners[i].apply(this, params);\r\n }\r\n };\r\n\r\n Utils.Observable = Observable;\r\n\r\n Utils.generateChars = function (length) {\r\n var chars = '';\r\n\r\n for (var i = 0; i < length; i++) {\r\n var randomChar = Math.floor(Math.random() * 36);\r\n chars += randomChar.toString(36);\r\n }\r\n\r\n return chars;\r\n };\r\n\r\n Utils.bind = function (func, context) {\r\n return function () {\r\n func.apply(context, arguments);\r\n };\r\n };\r\n\r\n Utils._convertData = function (data) {\r\n for (var originalKey in data) {\r\n var keys = originalKey.split('-');\r\n\r\n var dataLevel = data;\r\n\r\n if (keys.length === 1) {\r\n continue;\r\n }\r\n\r\n for (var k = 0; k < keys.length; k++) {\r\n var key = keys[k];\r\n\r\n // Lowercase the first letter\r\n // By default, dash-separated becomes camelCase\r\n key = key.substring(0, 1).toLowerCase() + key.substring(1);\r\n\r\n if (!(key in dataLevel)) {\r\n dataLevel[key] = {};\r\n }\r\n\r\n if (k == keys.length - 1) {\r\n dataLevel[key] = data[originalKey];\r\n }\r\n\r\n dataLevel = dataLevel[key];\r\n }\r\n\r\n delete data[originalKey];\r\n }\r\n\r\n return data;\r\n };\r\n\r\n Utils.hasScroll = function (index, el) {\r\n // Adapted from the function created by @ShadowScripter\r\n // and adapted by @BillBarry on the Stack Exchange Code Review website.\r\n // The original code can be found at\r\n // http://codereview.stackexchange.com/q/13338\r\n // and was designed to be used with the Sizzle selector engine.\r\n\r\n var $el = $(el);\r\n var overflowX = el.style.overflowX;\r\n var overflowY = el.style.overflowY;\r\n\r\n //Check both x and y declarations\r\n if (overflowX === overflowY &&\r\n (overflowY === 'hidden' || overflowY === 'visible')) {\r\n return false;\r\n }\r\n\r\n if (overflowX === 'scroll' || overflowY === 'scroll') {\r\n return true;\r\n }\r\n\r\n return ($el.innerHeight() < el.scrollHeight ||\r\n $el.innerWidth() < el.scrollWidth);\r\n };\r\n\r\n Utils.escapeMarkup = function (markup) {\r\n var replaceMap = {\r\n '\\\\': '\',\r\n '&': '&',\r\n '<': '<',\r\n '>': '>',\r\n '\"': '"',\r\n '\\'': ''',\r\n '/': '/'\r\n };\r\n\r\n // Do not try to escape the markup if it's not a string\r\n if (typeof markup !== 'string') {\r\n return markup;\r\n }\r\n\r\n return String(markup).replace(/[&<>\"'\\/\\\\]/g, function (match) {\r\n return replaceMap[match];\r\n });\r\n };\r\n\r\n // Append an array of jQuery nodes to a given element.\r\n Utils.appendMany = function ($element, $nodes) {\r\n // jQuery 1.7.x does not support $.fn.append() with an array\r\n // Fall back to a jQuery object collection using $.fn.add()\r\n if ($.fn.jquery.substr(0, 3) === '1.7') {\r\n var $jqNodes = $();\r\n\r\n $.map($nodes, function (node) {\r\n $jqNodes = $jqNodes.add(node);\r\n });\r\n\r\n $nodes = $jqNodes;\r\n }\r\n\r\n $element.append($nodes);\r\n };\r\n\r\n // Cache objects in Utils.__cache instead of $.data (see #4346)\r\n Utils.__cache = {};\r\n\r\n var id = 0;\r\n Utils.GetUniqueElementId = function (element) {\r\n // Get a unique element Id. If element has no id,\r\n // creates a new unique number, stores it in the id\r\n // attribute and returns the new id.\r\n // If an id already exists, it simply returns it.\r\n\r\n var select2Id = element.getAttribute('data-select2-id');\r\n if (select2Id == null) {\r\n // If element has id, use it.\r\n if (element.id) {\r\n select2Id = element.id;\r\n element.setAttribute('data-select2-id', select2Id);\r\n } else {\r\n element.setAttribute('data-select2-id', ++id);\r\n select2Id = id.toString();\r\n }\r\n }\r\n return select2Id;\r\n };\r\n\r\n Utils.StoreData = function (element, name, value) {\r\n // Stores an item in the cache for a specified element.\r\n // name is the cache key.\r\n var id = Utils.GetUniqueElementId(element);\r\n if (!Utils.__cache[id]) {\r\n Utils.__cache[id] = {};\r\n }\r\n\r\n Utils.__cache[id][name] = value;\r\n };\r\n\r\n Utils.GetData = function (element, name) {\r\n // Retrieves a value from the cache by its key (name)\r\n // name is optional. If no name specified, return\r\n // all cache items for the specified element.\r\n // and for a specified element.\r\n var id = Utils.GetUniqueElementId(element);\r\n if (name) {\r\n if (Utils.__cache[id]) {\r\n if (Utils.__cache[id][name] != null) {\r\n return Utils.__cache[id][name];\r\n }\r\n return $(element).data(name); // Fallback to HTML5 data attribs.\r\n }\r\n return $(element).data(name); // Fallback to HTML5 data attribs.\r\n } else {\r\n return Utils.__cache[id];\r\n }\r\n };\r\n\r\n Utils.RemoveData = function (element) {\r\n // Removes all cached items for a specified element.\r\n var id = Utils.GetUniqueElementId(element);\r\n if (Utils.__cache[id] != null) {\r\n delete Utils.__cache[id];\r\n }\r\n\r\n element.removeAttribute('data-select2-id');\r\n };\r\n\r\n return Utils;\r\n });\r\n\r\n S2.define('select2/results',[\r\n 'jquery',\r\n './utils'\r\n ], function ($, Utils) {\r\n function Results ($element, options, dataAdapter) {\r\n this.$element = $element;\r\n this.data = dataAdapter;\r\n this.options = options;\r\n\r\n Results.__super__.constructor.call(this);\r\n }\r\n\r\n Utils.Extend(Results, Utils.Observable);\r\n\r\n Results.prototype.render = function () {\r\n var $results = $(\r\n '