';
- html += '';
- html += '';
-
- //adjust maxDate to reflect the maxSpan setting in order to
- //grey out end dates beyond the maxSpan
- if (this.endDate == null && this.maxSpan) {
- var maxLimit = this.startDate.clone().add(this.maxSpan).endOf('day');
- if (!maxDate || maxLimit.isBefore(maxDate)) {
- maxDate = maxLimit;
- }
- }
-
- for (var row = 0; row < 6; row++) {
- html += '
';
-
- // add week number
- if (this.showWeekNumbers)
- html += '
' + calendar[row][0].week() + '
';
- else if (this.showISOWeekNumbers)
- html += '
' + calendar[row][0].isoWeek() + '
';
-
- for (var col = 0; col < 7; col++) {
-
- var classes = [];
-
- //highlight today's date
- if (calendar[row][col].isSame(new Date(), "day"))
- classes.push('today');
-
- //highlight weekends
- if (calendar[row][col].isoWeekday() > 5)
- classes.push('weekend');
-
- //grey out the dates in other months displayed at beginning and end of this calendar
- if (calendar[row][col].month() != calendar[1][1].month())
- classes.push('off', 'ends');
-
- //don't allow selection of dates before the minimum date
- if (this.minDate && calendar[row][col].isBefore(this.minDate, 'day'))
- classes.push('off', 'disabled');
-
- //don't allow selection of dates after the maximum date
- if (maxDate && calendar[row][col].isAfter(maxDate, 'day'))
- classes.push('off', 'disabled');
-
- //don't allow selection of date if a custom function decides it's invalid
- if (this.isInvalidDate(calendar[row][col]))
- classes.push('off', 'disabled');
-
- //highlight the currently selected start date
- if (calendar[row][col].format('YYYY-MM-DD') == this.startDate.format('YYYY-MM-DD'))
- classes.push('active', 'start-date');
-
- //highlight the currently selected end date
- if (this.endDate != null && calendar[row][col].format('YYYY-MM-DD') == this.endDate.format('YYYY-MM-DD'))
- classes.push('active', 'end-date');
-
- //highlight dates in-between the selected dates
- if (this.endDate != null && calendar[row][col] > this.startDate && calendar[row][col] < this.endDate)
- classes.push('in-range');
-
- //apply custom classes for this date
- var isCustom = this.isCustomDate(calendar[row][col]);
- if (isCustom !== false) {
- if (typeof isCustom === 'string')
- classes.push(isCustom);
- else
- Array.prototype.push.apply(classes, isCustom);
- }
-
- var cname = '', disabled = false;
- for (var i = 0; i < classes.length; i++) {
- cname += classes[i] + ' ';
- if (classes[i] == 'disabled')
- disabled = true;
- }
- if (!disabled)
- cname += 'available';
-
- html += '
' + calendar[row][col].date() + '
';
-
- }
- html += '
';
- }
-
- html += '';
- html += '
';
-
- this.container.find('.drp-calendar.' + side + ' .calendar-table').html(html);
-
- },
-
- renderTimePicker: function(side) {
-
- // Don't bother updating the time picker if it's currently disabled
- // because an end date hasn't been clicked yet
- if (side == 'right' && !this.endDate) return;
-
- var html, selected, minDate, maxDate = this.maxDate;
-
- if (this.maxSpan && (!this.maxDate || this.startDate.clone().add(this.maxSpan).isBefore(this.maxDate)))
- maxDate = this.startDate.clone().add(this.maxSpan);
-
- if (side == 'left') {
- selected = this.startDate.clone();
- minDate = this.minDate;
- } else if (side == 'right') {
- selected = this.endDate.clone();
- minDate = this.startDate;
-
- //Preserve the time already selected
- var timeSelector = this.container.find('.drp-calendar.right .calendar-time');
- if (timeSelector.html() != '') {
-
- selected.hour(!isNaN(selected.hour()) ? selected.hour() : timeSelector.find('.hourselect option:selected').val());
- selected.minute(!isNaN(selected.minute()) ? selected.minute() : timeSelector.find('.minuteselect option:selected').val());
- selected.second(!isNaN(selected.second()) ? selected.second() : timeSelector.find('.secondselect option:selected').val());
-
- if (!this.timePicker24Hour) {
- var ampm = timeSelector.find('.ampmselect option:selected').val();
- if (ampm === 'PM' && selected.hour() < 12)
- selected.hour(selected.hour() + 12);
- if (ampm === 'AM' && selected.hour() === 12)
- selected.hour(0);
- }
-
- }
-
- if (selected.isBefore(this.startDate))
- selected = this.startDate.clone();
-
- if (maxDate && selected.isAfter(maxDate))
- selected = maxDate.clone();
-
- }
-
- //
- // hours
- //
-
- html = ' ';
-
- //
- // minutes
- //
-
- html += ': ';
-
- //
- // seconds
- //
-
- if (this.timePickerSeconds) {
- html += ': ';
- }
-
- //
- // AM/PM
- //
-
- if (!this.timePicker24Hour) {
- html += '';
- }
-
- this.container.find('.drp-calendar.' + side + ' .calendar-time').html(html);
-
- },
-
- updateFormInputs: function() {
-
- if (this.singleDatePicker || (this.endDate && (this.startDate.isBefore(this.endDate) || this.startDate.isSame(this.endDate)))) {
- this.container.find('button.applyBtn').prop('disabled', false);
- } else {
- this.container.find('button.applyBtn').prop('disabled', true);
- }
-
- },
-
- move: function() {
- var parentOffset = { top: 0, left: 0 },
- containerTop,
- drops = this.drops;
-
- var parentRightEdge = $(window).width();
- if (!this.parentEl.is('body')) {
- parentOffset = {
- top: this.parentEl.offset().top - this.parentEl.scrollTop(),
- left: this.parentEl.offset().left - this.parentEl.scrollLeft()
- };
- parentRightEdge = this.parentEl[0].clientWidth + this.parentEl.offset().left;
- }
-
- switch (drops) {
- case 'auto':
- containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
- if (containerTop + this.container.outerHeight() >= this.parentEl[0].scrollHeight) {
- containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
- drops = 'up';
- }
- break;
- case 'up':
- containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
- break;
- default:
- containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
- break;
- }
-
- // Force the container to it's actual width
- this.container.css({
- top: 0,
- left: 0,
- right: 'auto'
- });
- var containerWidth = this.container.outerWidth();
-
- this.container.toggleClass('drop-up', drops == 'up');
-
- if (this.opens == 'left') {
- var containerRight = parentRightEdge - this.element.offset().left - this.element.outerWidth();
- if (containerWidth + containerRight > $(window).width()) {
- this.container.css({
- top: containerTop,
- right: 'auto',
- left: 9
- });
- } else {
- this.container.css({
- top: containerTop,
- right: containerRight,
- left: 'auto'
- });
- }
- } else if (this.opens == 'center') {
- var containerLeft = this.element.offset().left - parentOffset.left + this.element.outerWidth() / 2
- - containerWidth / 2;
- if (containerLeft < 0) {
- this.container.css({
- top: containerTop,
- right: 'auto',
- left: 9
- });
- } else if (containerLeft + containerWidth > $(window).width()) {
- this.container.css({
- top: containerTop,
- left: 'auto',
- right: 0
- });
- } else {
- this.container.css({
- top: containerTop,
- left: containerLeft,
- right: 'auto'
- });
- }
- } else {
- var containerLeft = this.element.offset().left - parentOffset.left;
- if (containerLeft + containerWidth > $(window).width()) {
- this.container.css({
- top: containerTop,
- left: 'auto',
- right: 0
- });
- } else {
- this.container.css({
- top: containerTop,
- left: containerLeft,
- right: 'auto'
- });
- }
- }
- },
-
- show: function(e) {
- if (this.isShowing) return;
-
- // Create a click proxy that is private to this instance of datepicker, for unbinding
- this._outsideClickProxy = $.proxy(function(e) { this.outsideClick(e); }, this);
-
- // Bind global datepicker mousedown for hiding and
- $(document)
- .on('mousedown.daterangepicker', this._outsideClickProxy)
- // also support mobile devices
- .on('touchend.daterangepicker', this._outsideClickProxy)
- // also explicitly play nice with Bootstrap dropdowns, which stopPropagation when clicking them
- .on('click.daterangepicker', '[data-toggle=dropdown]', this._outsideClickProxy)
- // and also close when focus changes to outside the picker (eg. tabbing between controls)
- .on('focusin.daterangepicker', this._outsideClickProxy);
-
- // Reposition the picker if the window is resized while it's open
- $(window).on('resize.daterangepicker', $.proxy(function(e) { this.move(e); }, this));
-
- this.oldStartDate = this.startDate.clone();
- this.oldEndDate = this.endDate.clone();
- this.previousRightTime = this.endDate.clone();
-
- this.updateView();
- this.container.show();
- this.move();
- this.element.trigger('show.daterangepicker', this);
- this.isShowing = true;
- },
-
- hide: function(e) {
- if (!this.isShowing) return;
-
- //incomplete date selection, revert to last values
- if (!this.endDate) {
- this.startDate = this.oldStartDate.clone();
- this.endDate = this.oldEndDate.clone();
- }
-
- //if a new date range was selected, invoke the user callback function
- if (!this.startDate.isSame(this.oldStartDate) || !this.endDate.isSame(this.oldEndDate))
- this.callback(this.startDate.clone(), this.endDate.clone(), this.chosenLabel);
-
- //if picker is attached to a text input, update it
- this.updateElement();
-
- $(document).off('.daterangepicker');
- $(window).off('.daterangepicker');
- this.container.hide();
- this.element.trigger('hide.daterangepicker', this);
- this.isShowing = false;
- },
-
- toggle: function(e) {
- if (this.isShowing) {
- this.hide();
- } else {
- this.show();
- }
- },
-
- outsideClick: function(e) {
- var target = $(e.target);
- // if the page is clicked anywhere except within the daterangerpicker/button
- // itself then call this.hide()
- if (
- // ie modal dialog fix
- e.type == "focusin" ||
- target.closest(this.element).length ||
- target.closest(this.container).length ||
- target.closest('.calendar-table').length
- ) return;
- this.hide();
- this.element.trigger('outsideClick.daterangepicker', this);
- },
-
- showCalendars: function() {
- this.container.addClass('show-calendar');
- this.move();
- this.element.trigger('showCalendar.daterangepicker', this);
- },
-
- hideCalendars: function() {
- this.container.removeClass('show-calendar');
- this.element.trigger('hideCalendar.daterangepicker', this);
- },
-
- clickRange: function(e) {
- var label = e.target.getAttribute('data-range-key');
- this.chosenLabel = label;
- if (label == this.locale.customRangeLabel) {
- this.showCalendars();
- } else {
- var dates = this.ranges[label];
- this.startDate = dates[0];
- this.endDate = dates[1];
-
- if (!this.timePicker) {
- this.startDate.startOf('day');
- this.endDate.endOf('day');
- }
-
- if (!this.alwaysShowCalendars)
- this.hideCalendars();
- this.clickApply();
- }
- },
-
- clickPrev: function(e) {
- var cal = $(e.target).parents('.drp-calendar');
- if (cal.hasClass('left')) {
- this.leftCalendar.month.subtract(1, 'month');
- if (this.linkedCalendars)
- this.rightCalendar.month.subtract(1, 'month');
- } else {
- this.rightCalendar.month.subtract(1, 'month');
- }
- this.updateCalendars();
- },
-
- clickNext: function(e) {
- var cal = $(e.target).parents('.drp-calendar');
- if (cal.hasClass('left')) {
- this.leftCalendar.month.add(1, 'month');
- } else {
- this.rightCalendar.month.add(1, 'month');
- if (this.linkedCalendars)
- this.leftCalendar.month.add(1, 'month');
- }
- this.updateCalendars();
- },
-
- hoverDate: function(e) {
-
- //ignore dates that can't be selected
- if (!$(e.target).hasClass('available')) return;
-
- var title = $(e.target).attr('data-title');
- var row = title.substr(1, 1);
- var col = title.substr(3, 1);
- var cal = $(e.target).parents('.drp-calendar');
- var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
-
- //highlight the dates between the start date and the date being hovered as a potential end date
- var leftCalendar = this.leftCalendar;
- var rightCalendar = this.rightCalendar;
- var startDate = this.startDate;
- if (!this.endDate) {
- this.container.find('.drp-calendar tbody td').each(function(index, el) {
-
- //skip week numbers, only look at dates
- if ($(el).hasClass('week')) return;
-
- var title = $(el).attr('data-title');
- var row = title.substr(1, 1);
- var col = title.substr(3, 1);
- var cal = $(el).parents('.drp-calendar');
- var dt = cal.hasClass('left') ? leftCalendar.calendar[row][col] : rightCalendar.calendar[row][col];
-
- if ((dt.isAfter(startDate) && dt.isBefore(date)) || dt.isSame(date, 'day')) {
- $(el).addClass('in-range');
- } else {
- $(el).removeClass('in-range');
- }
-
- });
- }
-
- },
-
- clickDate: function(e) {
-
- if (!$(e.target).hasClass('available')) return;
-
- var title = $(e.target).attr('data-title');
- var row = title.substr(1, 1);
- var col = title.substr(3, 1);
- var cal = $(e.target).parents('.drp-calendar');
- var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
-
- //
- // this function needs to do a few things:
- // * alternate between selecting a start and end date for the range,
- // * if the time picker is enabled, apply the hour/minute/second from the select boxes to the clicked date
- // * if autoapply is enabled, and an end date was chosen, apply the selection
- // * if single date picker mode, and time picker isn't enabled, apply the selection immediately
- // * if one of the inputs above the calendars was focused, cancel that manual input
- //
-
- if (this.endDate || date.isBefore(this.startDate, 'day')) { //picking start
- if (this.timePicker) {
- var hour = parseInt(this.container.find('.left .hourselect').val(), 10);
- if (!this.timePicker24Hour) {
- var ampm = this.container.find('.left .ampmselect').val();
- if (ampm === 'PM' && hour < 12)
- hour += 12;
- if (ampm === 'AM' && hour === 12)
- hour = 0;
- }
- var minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
- if (isNaN(minute)) {
- minute = parseInt(this.container.find('.left .minuteselect option:last').val(), 10);
- }
- var second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
- date = date.clone().hour(hour).minute(minute).second(second);
- }
- this.endDate = null;
- this.setStartDate(date.clone());
- } else if (!this.endDate && date.isBefore(this.startDate)) {
- //special case: clicking the same date for start/end,
- //but the time of the end date is before the start date
- this.setEndDate(this.startDate.clone());
- } else { // picking end
- if (this.timePicker) {
- var hour = parseInt(this.container.find('.right .hourselect').val(), 10);
- if (!this.timePicker24Hour) {
- var ampm = this.container.find('.right .ampmselect').val();
- if (ampm === 'PM' && hour < 12)
- hour += 12;
- if (ampm === 'AM' && hour === 12)
- hour = 0;
- }
- var minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
- if (isNaN(minute)) {
- minute = parseInt(this.container.find('.right .minuteselect option:last').val(), 10);
- }
- var second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
- date = date.clone().hour(hour).minute(minute).second(second);
- }
- this.setEndDate(date.clone());
- if (this.autoApply) {
- this.calculateChosenLabel();
- this.clickApply();
- }
- }
-
- if (this.singleDatePicker) {
- this.setEndDate(this.startDate);
- if (!this.timePicker && this.autoApply)
- this.clickApply();
- }
-
- this.updateView();
-
- //This is to cancel the blur event handler if the mouse was in one of the inputs
- e.stopPropagation();
-
- },
-
- calculateChosenLabel: function () {
- var customRange = true;
- var i = 0;
- for (var range in this.ranges) {
- if (this.timePicker) {
- var format = this.timePickerSeconds ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD HH:mm";
- //ignore times when comparing dates if time picker seconds is not enabled
- if (this.startDate.format(format) == this.ranges[range][0].format(format) && this.endDate.format(format) == this.ranges[range][1].format(format)) {
- customRange = false;
- this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').attr('data-range-key');
- break;
- }
- } else {
- //ignore times when comparing dates if time picker is not enabled
- if (this.startDate.format('YYYY-MM-DD') == this.ranges[range][0].format('YYYY-MM-DD') && this.endDate.format('YYYY-MM-DD') == this.ranges[range][1].format('YYYY-MM-DD')) {
- customRange = false;
- this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').attr('data-range-key');
- break;
- }
- }
- i++;
- }
- if (customRange) {
- if (this.showCustomRangeLabel) {
- this.chosenLabel = this.container.find('.ranges li:last').addClass('active').attr('data-range-key');
- } else {
- this.chosenLabel = null;
- }
- this.showCalendars();
- }
- },
-
- clickApply: function(e) {
- this.hide();
- this.element.trigger('apply.daterangepicker', this);
- },
-
- clickCancel: function(e) {
- this.startDate = this.oldStartDate;
- this.endDate = this.oldEndDate;
- this.hide();
- this.element.trigger('cancel.daterangepicker', this);
- },
-
- monthOrYearChanged: function(e) {
- var isLeft = $(e.target).closest('.drp-calendar').hasClass('left'),
- leftOrRight = isLeft ? 'left' : 'right',
- cal = this.container.find('.drp-calendar.'+leftOrRight);
-
- // Month must be Number for new moment versions
- var month = parseInt(cal.find('.monthselect').val(), 10);
- var year = cal.find('.yearselect').val();
-
- if (!isLeft) {
- if (year < this.startDate.year() || (year == this.startDate.year() && month < this.startDate.month())) {
- month = this.startDate.month();
- year = this.startDate.year();
- }
- }
-
- if (this.minDate) {
- if (year < this.minDate.year() || (year == this.minDate.year() && month < this.minDate.month())) {
- month = this.minDate.month();
- year = this.minDate.year();
- }
- }
-
- if (this.maxDate) {
- if (year > this.maxDate.year() || (year == this.maxDate.year() && month > this.maxDate.month())) {
- month = this.maxDate.month();
- year = this.maxDate.year();
- }
- }
-
- if (isLeft) {
- this.leftCalendar.month.month(month).year(year);
- if (this.linkedCalendars)
- this.rightCalendar.month = this.leftCalendar.month.clone().add(1, 'month');
- } else {
- this.rightCalendar.month.month(month).year(year);
- if (this.linkedCalendars)
- this.leftCalendar.month = this.rightCalendar.month.clone().subtract(1, 'month');
- }
- this.updateCalendars();
- },
-
- timeChanged: function(e) {
-
- var cal = $(e.target).closest('.drp-calendar'),
- isLeft = cal.hasClass('left');
-
- var hour = parseInt(cal.find('.hourselect').val(), 10);
- var minute = parseInt(cal.find('.minuteselect').val(), 10);
- if (isNaN(minute)) {
- minute = parseInt(cal.find('.minuteselect option:last').val(), 10);
- }
- var second = this.timePickerSeconds ? parseInt(cal.find('.secondselect').val(), 10) : 0;
-
- if (!this.timePicker24Hour) {
- var ampm = cal.find('.ampmselect').val();
- if (ampm === 'PM' && hour < 12)
- hour += 12;
- if (ampm === 'AM' && hour === 12)
- hour = 0;
- }
-
- if (isLeft) {
- var start = this.startDate.clone();
- start.hour(hour);
- start.minute(minute);
- start.second(second);
- this.setStartDate(start);
- if (this.singleDatePicker) {
- this.endDate = this.startDate.clone();
- } else if (this.endDate && this.endDate.format('YYYY-MM-DD') == start.format('YYYY-MM-DD') && this.endDate.isBefore(start)) {
- this.setEndDate(start.clone());
- }
- } else if (this.endDate) {
- var end = this.endDate.clone();
- end.hour(hour);
- end.minute(minute);
- end.second(second);
- this.setEndDate(end);
- }
-
- //update the calendars so all clickable dates reflect the new time component
- this.updateCalendars();
-
- //update the form inputs above the calendars with the new time
- this.updateFormInputs();
-
- //re-render the time pickers because changing one selection can affect what's enabled in another
- this.renderTimePicker('left');
- this.renderTimePicker('right');
-
- },
-
- elementChanged: function() {
- if (!this.element.is('input')) return;
- if (!this.element.val().length) return;
-
- var dateString = this.element.val().split(this.locale.separator),
- start = null,
- end = null;
-
- if (dateString.length === 2) {
- start = moment(dateString[0], this.locale.format);
- end = moment(dateString[1], this.locale.format);
- }
-
- if (this.singleDatePicker || start === null || end === null) {
- start = moment(this.element.val(), this.locale.format);
- end = start;
- }
-
- if (!start.isValid() || !end.isValid()) return;
-
- this.setStartDate(start);
- this.setEndDate(end);
- this.updateView();
- },
-
- keydown: function(e) {
- //hide on tab or enter
- if ((e.keyCode === 9) || (e.keyCode === 13)) {
- this.hide();
- }
-
- //hide on esc and prevent propagation
- if (e.keyCode === 27) {
- e.preventDefault();
- e.stopPropagation();
-
- this.hide();
- }
- },
-
- updateElement: function() {
- if (this.element.is('input') && this.autoUpdateInput) {
- var newValue = this.startDate.format(this.locale.format);
- if (!this.singleDatePicker) {
- newValue += this.locale.separator + this.endDate.format(this.locale.format);
- }
- if (newValue !== this.element.val()) {
- this.element.val(newValue).trigger('change');
- }
- }
- },
-
- remove: function() {
- this.container.remove();
- this.element.off('.daterangepicker');
- this.element.removeData();
- }
-
- };
-
- $.fn.daterangepicker = function(options, callback) {
- var implementOptions = $.extend(true, {}, $.fn.daterangepicker.defaultOptions, options);
- this.each(function() {
- var el = $(this);
- if (el.data('daterangepicker'))
- el.data('daterangepicker').remove();
- el.data('daterangepicker', new DateRangePicker(el, implementOptions, callback));
- });
- return this;
- };
-
- return DateRangePicker;
-
-}));
+/**
+* @version: 3.1
+* @author: Dan Grossman http://www.dangrossman.info/
+* @copyright: Copyright (c) 2012-2019 Dan Grossman. All rights reserved.
+* @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php
+* @website: http://www.daterangepicker.com/
+*/
+// Following the UMD template https://github.com/umdjs/umd/blob/master/templates/returnExportsGlobal.js
+(function (root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Make globaly available as well
+ define(['moment', 'jquery'], function (moment, jquery) {
+ if (!jquery.fn) jquery.fn = {}; // webpack server rendering
+ if (typeof moment !== 'function' && moment.hasOwnProperty('default')) moment = moment['default']
+ return factory(moment, jquery);
+ });
+ } else if (typeof module === 'object' && module.exports) {
+ // Node / Browserify
+ //isomorphic issue
+ var jQuery = (typeof window != 'undefined') ? window.jQuery : undefined;
+ if (!jQuery) {
+ jQuery = require('jquery');
+ if (!jQuery.fn) jQuery.fn = {};
+ }
+ var moment = (typeof window != 'undefined' && typeof window.moment != 'undefined') ? window.moment : require('moment');
+ module.exports = factory(moment, jQuery);
+ } else {
+ // Browser globals
+ root.daterangepicker = factory(root.moment, root.jQuery);
+ }
+}(this, function(moment, $) {
+ var DateRangePicker = function(element, options, cb) {
+
+ //default settings for options
+ this.parentEl = 'body';
+ this.element = $(element);
+ this.startDate = moment().startOf('day');
+ this.endDate = moment().endOf('day');
+ this.minDate = false;
+ this.maxDate = false;
+ this.maxSpan = false;
+ this.autoApply = false;
+ this.singleDatePicker = false;
+ this.showDropdowns = false;
+ this.minYear = moment().subtract(100, 'year').format('YYYY');
+ this.maxYear = moment().add(100, 'year').format('YYYY');
+ this.showWeekNumbers = false;
+ this.showISOWeekNumbers = false;
+ this.showCustomRangeLabel = true;
+ this.timePicker = false;
+ this.timePicker24Hour = false;
+ this.timePickerIncrement = 1;
+ this.timePickerSeconds = false;
+ this.linkedCalendars = true;
+ this.autoUpdateInput = true;
+ this.alwaysShowCalendars = false;
+ this.ranges = {};
+
+ this.opens = 'right';
+ if (this.element.hasClass('pull-right'))
+ this.opens = 'left';
+
+ this.drops = 'down';
+ if (this.element.hasClass('dropup'))
+ this.drops = 'up';
+
+ this.buttonClasses = 'btn btn-sm';
+ this.applyButtonClasses = 'btn-primary';
+ this.cancelButtonClasses = 'btn-default';
+
+ this.locale = {
+ direction: 'ltr',
+ format: moment.localeData().longDateFormat('L'),
+ separator: ' - ',
+ applyLabel: 'Apply',
+ cancelLabel: 'Cancel',
+ weekLabel: 'W',
+ customRangeLabel: 'Custom Range',
+ daysOfWeek: moment.weekdaysMin(),
+ monthNames: moment.monthsShort(),
+ firstDay: moment.localeData().firstDayOfWeek()
+ };
+
+ this.callback = function() { };
+
+ //some state information
+ this.isShowing = false;
+ this.leftCalendar = {};
+ this.rightCalendar = {};
+
+ //custom options from user
+ if (typeof options !== 'object' || options === null)
+ options = {};
+
+ //allow setting options with data attributes
+ //data-api options will be overwritten with custom javascript options
+ options = $.extend(this.element.data(), options);
+
+ //html template for the picker UI
+ if (typeof options.template !== 'string' && !(options.template instanceof $))
+ options.template =
+ '
' +
+ '' +
+ '
' +
+ '' +
+ '' +
+ '
' +
+ '
' +
+ '' +
+ '' +
+ '
' +
+ '
' +
+ '' +
+ '' +
+ ' ' +
+ '
' +
+ '
';
+
+ this.parentEl = (options.parentEl && $(options.parentEl).length) ? $(options.parentEl) : $(this.parentEl);
+ this.container = $(options.template).appendTo(this.parentEl);
+
+ //
+ // handle all the possible options overriding defaults
+ //
+
+ if (typeof options.locale === 'object') {
+
+ if (typeof options.locale.direction === 'string')
+ this.locale.direction = options.locale.direction;
+
+ if (typeof options.locale.format === 'string')
+ this.locale.format = options.locale.format;
+
+ if (typeof options.locale.separator === 'string')
+ this.locale.separator = options.locale.separator;
+
+ if (typeof options.locale.daysOfWeek === 'object')
+ this.locale.daysOfWeek = options.locale.daysOfWeek.slice();
+
+ if (typeof options.locale.monthNames === 'object')
+ this.locale.monthNames = options.locale.monthNames.slice();
+
+ if (typeof options.locale.firstDay === 'number')
+ this.locale.firstDay = options.locale.firstDay;
+
+ if (typeof options.locale.applyLabel === 'string')
+ this.locale.applyLabel = options.locale.applyLabel;
+
+ if (typeof options.locale.cancelLabel === 'string')
+ this.locale.cancelLabel = options.locale.cancelLabel;
+
+ if (typeof options.locale.weekLabel === 'string')
+ this.locale.weekLabel = options.locale.weekLabel;
+
+ if (typeof options.locale.customRangeLabel === 'string'){
+ //Support unicode chars in the custom range name.
+ var elem = document.createElement('textarea');
+ elem.innerHTML = options.locale.customRangeLabel;
+ var rangeHtml = elem.value;
+ this.locale.customRangeLabel = rangeHtml;
+ }
+ }
+ this.container.addClass(this.locale.direction);
+
+ if (typeof options.startDate === 'string')
+ this.startDate = moment(options.startDate, this.locale.format);
+
+ if (typeof options.endDate === 'string')
+ this.endDate = moment(options.endDate, this.locale.format);
+
+ if (typeof options.minDate === 'string')
+ this.minDate = moment(options.minDate, this.locale.format);
+
+ if (typeof options.maxDate === 'string')
+ this.maxDate = moment(options.maxDate, this.locale.format);
+
+ if (typeof options.startDate === 'object')
+ this.startDate = moment(options.startDate);
+
+ if (typeof options.endDate === 'object')
+ this.endDate = moment(options.endDate);
+
+ if (typeof options.minDate === 'object')
+ this.minDate = moment(options.minDate);
+
+ if (typeof options.maxDate === 'object')
+ this.maxDate = moment(options.maxDate);
+
+ // sanity check for bad options
+ if (this.minDate && this.startDate.isBefore(this.minDate))
+ this.startDate = this.minDate.clone();
+
+ // sanity check for bad options
+ if (this.maxDate && this.endDate.isAfter(this.maxDate))
+ this.endDate = this.maxDate.clone();
+
+ if (typeof options.applyButtonClasses === 'string')
+ this.applyButtonClasses = options.applyButtonClasses;
+
+ if (typeof options.applyClass === 'string') //backwards compat
+ this.applyButtonClasses = options.applyClass;
+
+ if (typeof options.cancelButtonClasses === 'string')
+ this.cancelButtonClasses = options.cancelButtonClasses;
+
+ if (typeof options.cancelClass === 'string') //backwards compat
+ this.cancelButtonClasses = options.cancelClass;
+
+ if (typeof options.maxSpan === 'object')
+ this.maxSpan = options.maxSpan;
+
+ if (typeof options.dateLimit === 'object') //backwards compat
+ this.maxSpan = options.dateLimit;
+
+ if (typeof options.opens === 'string')
+ this.opens = options.opens;
+
+ if (typeof options.drops === 'string')
+ this.drops = options.drops;
+
+ if (typeof options.showWeekNumbers === 'boolean')
+ this.showWeekNumbers = options.showWeekNumbers;
+
+ if (typeof options.showISOWeekNumbers === 'boolean')
+ this.showISOWeekNumbers = options.showISOWeekNumbers;
+
+ if (typeof options.buttonClasses === 'string')
+ this.buttonClasses = options.buttonClasses;
+
+ if (typeof options.buttonClasses === 'object')
+ this.buttonClasses = options.buttonClasses.join(' ');
+
+ if (typeof options.showDropdowns === 'boolean')
+ this.showDropdowns = options.showDropdowns;
+
+ if (typeof options.minYear === 'number')
+ this.minYear = options.minYear;
+
+ if (typeof options.maxYear === 'number')
+ this.maxYear = options.maxYear;
+
+ if (typeof options.showCustomRangeLabel === 'boolean')
+ this.showCustomRangeLabel = options.showCustomRangeLabel;
+
+ if (typeof options.singleDatePicker === 'boolean') {
+ this.singleDatePicker = options.singleDatePicker;
+ if (this.singleDatePicker)
+ this.endDate = this.startDate.clone();
+ }
+
+ if (typeof options.timePicker === 'boolean')
+ this.timePicker = options.timePicker;
+
+ if (typeof options.timePickerSeconds === 'boolean')
+ this.timePickerSeconds = options.timePickerSeconds;
+
+ if (typeof options.timePickerIncrement === 'number')
+ this.timePickerIncrement = options.timePickerIncrement;
+
+ if (typeof options.timePicker24Hour === 'boolean')
+ this.timePicker24Hour = options.timePicker24Hour;
+
+ if (typeof options.autoApply === 'boolean')
+ this.autoApply = options.autoApply;
+
+ if (typeof options.autoUpdateInput === 'boolean')
+ this.autoUpdateInput = options.autoUpdateInput;
+
+ if (typeof options.linkedCalendars === 'boolean')
+ this.linkedCalendars = options.linkedCalendars;
+
+ if (typeof options.isInvalidDate === 'function')
+ this.isInvalidDate = options.isInvalidDate;
+
+ if (typeof options.isCustomDate === 'function')
+ this.isCustomDate = options.isCustomDate;
+
+ if (typeof options.alwaysShowCalendars === 'boolean')
+ this.alwaysShowCalendars = options.alwaysShowCalendars;
+
+ // update day names order to firstDay
+ if (this.locale.firstDay != 0) {
+ var iterator = this.locale.firstDay;
+ while (iterator > 0) {
+ this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift());
+ iterator--;
+ }
+ }
+
+ var start, end, range;
+
+ //if no start/end dates set, check if an input element contains initial values
+ if (typeof options.startDate === 'undefined' && typeof options.endDate === 'undefined') {
+ if ($(this.element).is(':text')) {
+ var val = $(this.element).val(),
+ split = val.split(this.locale.separator);
+
+ start = end = null;
+
+ if (split.length == 2) {
+ start = moment(split[0], this.locale.format);
+ end = moment(split[1], this.locale.format);
+ } else if (this.singleDatePicker && val !== "") {
+ start = moment(val, this.locale.format);
+ end = moment(val, this.locale.format);
+ }
+ if (start !== null && end !== null) {
+ this.setStartDate(start);
+ this.setEndDate(end);
+ }
+ }
+ }
+
+ if (typeof options.ranges === 'object') {
+ for (range in options.ranges) {
+
+ if (typeof options.ranges[range][0] === 'string')
+ start = moment(options.ranges[range][0], this.locale.format);
+ else
+ start = moment(options.ranges[range][0]);
+
+ if (typeof options.ranges[range][1] === 'string')
+ end = moment(options.ranges[range][1], this.locale.format);
+ else
+ end = moment(options.ranges[range][1]);
+
+ // If the start or end date exceed those allowed by the minDate or maxSpan
+ // options, shorten the range to the allowable period.
+ if (this.minDate && start.isBefore(this.minDate))
+ start = this.minDate.clone();
+
+ var maxDate = this.maxDate;
+ if (this.maxSpan && maxDate && start.clone().add(this.maxSpan).isAfter(maxDate))
+ maxDate = start.clone().add(this.maxSpan);
+ if (maxDate && end.isAfter(maxDate))
+ end = maxDate.clone();
+
+ // If the end of the range is before the minimum or the start of the range is
+ // after the maximum, don't display this range option at all.
+ if ((this.minDate && end.isBefore(this.minDate, this.timepicker ? 'minute' : 'day'))
+ || (maxDate && start.isAfter(maxDate, this.timepicker ? 'minute' : 'day')))
+ continue;
+
+ //Support unicode chars in the range names.
+ var elem = document.createElement('textarea');
+ elem.innerHTML = range;
+ var rangeHtml = elem.value;
+
+ this.ranges[rangeHtml] = [start, end];
+ }
+
+ var list = '
';
+ for (range in this.ranges) {
+ list += '
' + range + '
';
+ }
+ if (this.showCustomRangeLabel) {
+ list += '
' + this.locale.customRangeLabel + '
';
+ }
+ list += '
';
+ this.container.find('.ranges').prepend(list);
+ }
+
+ if (typeof cb === 'function') {
+ this.callback = cb;
+ }
+
+ if (!this.timePicker) {
+ this.startDate = this.startDate.startOf('day');
+ this.endDate = this.endDate.endOf('day');
+ this.container.find('.calendar-time').hide();
+ }
+
+ //can't be used together for now
+ if (this.timePicker && this.autoApply)
+ this.autoApply = false;
+
+ if (this.autoApply) {
+ this.container.addClass('auto-apply');
+ }
+
+ if (typeof options.ranges === 'object')
+ this.container.addClass('show-ranges');
+
+ if (this.singleDatePicker) {
+ this.container.addClass('single');
+ this.container.find('.drp-calendar.left').addClass('single');
+ this.container.find('.drp-calendar.left').show();
+ this.container.find('.drp-calendar.right').hide();
+ if (!this.timePicker && this.autoApply) {
+ this.container.addClass('auto-apply');
+ }
+ }
+
+ if ((typeof options.ranges === 'undefined' && !this.singleDatePicker) || this.alwaysShowCalendars) {
+ this.container.addClass('show-calendar');
+ }
+
+ this.container.addClass('opens' + this.opens);
+
+ //apply CSS classes and labels to buttons
+ this.container.find('.applyBtn, .cancelBtn').addClass(this.buttonClasses);
+ if (this.applyButtonClasses.length)
+ this.container.find('.applyBtn').addClass(this.applyButtonClasses);
+ if (this.cancelButtonClasses.length)
+ this.container.find('.cancelBtn').addClass(this.cancelButtonClasses);
+ this.container.find('.applyBtn').html(this.locale.applyLabel);
+ this.container.find('.cancelBtn').html(this.locale.cancelLabel);
+
+ //
+ // event listeners
+ //
+
+ this.container.find('.drp-calendar')
+ .on('click.daterangepicker', '.prev', $.proxy(this.clickPrev, this))
+ .on('click.daterangepicker', '.next', $.proxy(this.clickNext, this))
+ .on('mousedown.daterangepicker', 'td.available', $.proxy(this.clickDate, this))
+ .on('mouseenter.daterangepicker', 'td.available', $.proxy(this.hoverDate, this))
+ .on('change.daterangepicker', 'select.yearselect', $.proxy(this.monthOrYearChanged, this))
+ .on('change.daterangepicker', 'select.monthselect', $.proxy(this.monthOrYearChanged, this))
+ .on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect', $.proxy(this.timeChanged, this));
+
+ this.container.find('.ranges')
+ .on('click.daterangepicker', 'li', $.proxy(this.clickRange, this));
+
+ this.container.find('.drp-buttons')
+ .on('click.daterangepicker', 'button.applyBtn', $.proxy(this.clickApply, this))
+ .on('click.daterangepicker', 'button.cancelBtn', $.proxy(this.clickCancel, this));
+
+ if (this.element.is('input') || this.element.is('button')) {
+ this.element.on({
+ 'click.daterangepicker': $.proxy(this.show, this),
+ 'focus.daterangepicker': $.proxy(this.show, this),
+ 'keyup.daterangepicker': $.proxy(this.elementChanged, this),
+ 'keydown.daterangepicker': $.proxy(this.keydown, this) //IE 11 compatibility
+ });
+ } else {
+ this.element.on('click.daterangepicker', $.proxy(this.toggle, this));
+ this.element.on('keydown.daterangepicker', $.proxy(this.toggle, this));
+ }
+
+ //
+ // if attached to a text input, set the initial value
+ //
+
+ this.updateElement();
+
+ };
+
+ DateRangePicker.prototype = {
+
+ constructor: DateRangePicker,
+
+ setStartDate: function(startDate) {
+ if (typeof startDate === 'string')
+ this.startDate = moment(startDate, this.locale.format);
+
+ if (typeof startDate === 'object')
+ this.startDate = moment(startDate);
+
+ if (!this.timePicker)
+ this.startDate = this.startDate.startOf('day');
+
+ if (this.timePicker && this.timePickerIncrement)
+ this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
+
+ if (this.minDate && this.startDate.isBefore(this.minDate)) {
+ this.startDate = this.minDate.clone();
+ if (this.timePicker && this.timePickerIncrement)
+ this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
+ }
+
+ if (this.maxDate && this.startDate.isAfter(this.maxDate)) {
+ this.startDate = this.maxDate.clone();
+ if (this.timePicker && this.timePickerIncrement)
+ this.startDate.minute(Math.floor(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
+ }
+
+ if (!this.isShowing)
+ this.updateElement();
+
+ this.updateMonthsInView();
+ },
+
+ setEndDate: function(endDate) {
+ if (typeof endDate === 'string')
+ this.endDate = moment(endDate, this.locale.format);
+
+ if (typeof endDate === 'object')
+ this.endDate = moment(endDate);
+
+ if (!this.timePicker)
+ this.endDate = this.endDate.endOf('day');
+
+ if (this.timePicker && this.timePickerIncrement)
+ this.endDate.minute(Math.round(this.endDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
+
+ if (this.endDate.isBefore(this.startDate))
+ this.endDate = this.startDate.clone();
+
+ if (this.maxDate && this.endDate.isAfter(this.maxDate))
+ this.endDate = this.maxDate.clone();
+
+ if (this.maxSpan && this.startDate.clone().add(this.maxSpan).isBefore(this.endDate))
+ this.endDate = this.startDate.clone().add(this.maxSpan);
+
+ this.previousRightTime = this.endDate.clone();
+
+ this.container.find('.drp-selected').html(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
+
+ if (!this.isShowing)
+ this.updateElement();
+
+ this.updateMonthsInView();
+ },
+
+ isInvalidDate: function() {
+ return false;
+ },
+
+ isCustomDate: function() {
+ return false;
+ },
+
+ updateView: function() {
+ if (this.timePicker) {
+ this.renderTimePicker('left');
+ this.renderTimePicker('right');
+ if (!this.endDate) {
+ this.container.find('.right .calendar-time select').prop('disabled', true).addClass('disabled');
+ } else {
+ this.container.find('.right .calendar-time select').prop('disabled', false).removeClass('disabled');
+ }
+ }
+ if (this.endDate)
+ this.container.find('.drp-selected').html(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
+ this.updateMonthsInView();
+ this.updateCalendars();
+ this.updateFormInputs();
+ },
+
+ updateMonthsInView: function() {
+ if (this.endDate) {
+
+ //if both dates are visible already, do nothing
+ if (!this.singleDatePicker && this.leftCalendar.month && this.rightCalendar.month &&
+ (this.startDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.startDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM'))
+ &&
+ (this.endDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.endDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM'))
+ ) {
+ return;
+ }
+
+ this.leftCalendar.month = this.startDate.clone().date(2);
+ if (!this.linkedCalendars && (this.endDate.month() != this.startDate.month() || this.endDate.year() != this.startDate.year())) {
+ this.rightCalendar.month = this.endDate.clone().date(2);
+ } else {
+ this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month');
+ }
+
+ } else {
+ if (this.leftCalendar.month.format('YYYY-MM') != this.startDate.format('YYYY-MM') && this.rightCalendar.month.format('YYYY-MM') != this.startDate.format('YYYY-MM')) {
+ this.leftCalendar.month = this.startDate.clone().date(2);
+ this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month');
+ }
+ }
+ if (this.maxDate && this.linkedCalendars && !this.singleDatePicker && this.rightCalendar.month > this.maxDate) {
+ this.rightCalendar.month = this.maxDate.clone().date(2);
+ this.leftCalendar.month = this.maxDate.clone().date(2).subtract(1, 'month');
+ }
+ },
+
+ updateCalendars: function() {
+
+ if (this.timePicker) {
+ var hour, minute, second;
+ if (this.endDate) {
+ hour = parseInt(this.container.find('.left .hourselect').val(), 10);
+ minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
+ if (isNaN(minute)) {
+ minute = parseInt(this.container.find('.left .minuteselect option:last').val(), 10);
+ }
+ second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
+ if (!this.timePicker24Hour) {
+ var ampm = this.container.find('.left .ampmselect').val();
+ if (ampm === 'PM' && hour < 12)
+ hour += 12;
+ if (ampm === 'AM' && hour === 12)
+ hour = 0;
+ }
+ } else {
+ hour = parseInt(this.container.find('.right .hourselect').val(), 10);
+ minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
+ if (isNaN(minute)) {
+ minute = parseInt(this.container.find('.right .minuteselect option:last').val(), 10);
+ }
+ second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
+ if (!this.timePicker24Hour) {
+ var ampm = this.container.find('.right .ampmselect').val();
+ if (ampm === 'PM' && hour < 12)
+ hour += 12;
+ if (ampm === 'AM' && hour === 12)
+ hour = 0;
+ }
+ }
+ this.leftCalendar.month.hour(hour).minute(minute).second(second);
+ this.rightCalendar.month.hour(hour).minute(minute).second(second);
+ }
+
+ this.renderCalendar('left');
+ this.renderCalendar('right');
+
+ //highlight any predefined range matching the current start and end dates
+ this.container.find('.ranges li').removeClass('active');
+ if (this.endDate == null) return;
+
+ this.calculateChosenLabel();
+ },
+
+ renderCalendar: function(side) {
+
+ //
+ // Build the matrix of dates that will populate the calendar
+ //
+
+ var calendar = side == 'left' ? this.leftCalendar : this.rightCalendar;
+ var month = calendar.month.month();
+ var year = calendar.month.year();
+ var hour = calendar.month.hour();
+ var minute = calendar.month.minute();
+ var second = calendar.month.second();
+ var daysInMonth = moment([year, month]).daysInMonth();
+ var firstDay = moment([year, month, 1]);
+ var lastDay = moment([year, month, daysInMonth]);
+ var lastMonth = moment(firstDay).subtract(1, 'month').month();
+ var lastYear = moment(firstDay).subtract(1, 'month').year();
+ var daysInLastMonth = moment([lastYear, lastMonth]).daysInMonth();
+ var dayOfWeek = firstDay.day();
+
+ //initialize a 6 rows x 7 columns array for the calendar
+ var calendar = [];
+ calendar.firstDay = firstDay;
+ calendar.lastDay = lastDay;
+
+ for (var i = 0; i < 6; i++) {
+ calendar[i] = [];
+ }
+
+ //populate the calendar with date objects
+ var startDay = daysInLastMonth - dayOfWeek + this.locale.firstDay + 1;
+ if (startDay > daysInLastMonth)
+ startDay -= 7;
+
+ if (dayOfWeek == this.locale.firstDay)
+ startDay = daysInLastMonth - 6;
+
+ var curDate = moment([lastYear, lastMonth, startDay, 12, minute, second]);
+
+ var col, row;
+ for (var i = 0, col = 0, row = 0; i < 42; i++, col++, curDate = moment(curDate).add(24, 'hour')) {
+ if (i > 0 && col % 7 === 0) {
+ col = 0;
+ row++;
+ }
+ calendar[row][col] = curDate.clone().hour(hour).minute(minute).second(second);
+ curDate.hour(12);
+
+ if (this.minDate && calendar[row][col].format('YYYY-MM-DD') == this.minDate.format('YYYY-MM-DD') && calendar[row][col].isBefore(this.minDate) && side == 'left') {
+ calendar[row][col] = this.minDate.clone();
+ }
+
+ if (this.maxDate && calendar[row][col].format('YYYY-MM-DD') == this.maxDate.format('YYYY-MM-DD') && calendar[row][col].isAfter(this.maxDate) && side == 'right') {
+ calendar[row][col] = this.maxDate.clone();
+ }
+
+ }
+
+ //make the calendar object available to hoverDate/clickDate
+ if (side == 'left') {
+ this.leftCalendar.calendar = calendar;
+ } else {
+ this.rightCalendar.calendar = calendar;
+ }
+
+ //
+ // Display the calendar
+ //
+
+ var minDate = side == 'left' ? this.minDate : this.startDate;
+ var maxDate = this.maxDate;
+ var selected = side == 'left' ? this.startDate : this.endDate;
+ var arrow = this.locale.direction == 'ltr' ? {left: 'chevron-left', right: 'chevron-right'} : {left: 'chevron-right', right: 'chevron-left'};
+
+ var html = '
';
+ html += '';
+ html += '
';
+
+ // add empty cell for week number
+ if (this.showWeekNumbers || this.showISOWeekNumbers)
+ html += '
';
+
+ if ((!minDate || minDate.isBefore(calendar.firstDay)) && (!this.linkedCalendars || side == 'left')) {
+ html += '
';
+ } else {
+ html += '
';
+ }
+
+ var dateHtml = this.locale.monthNames[calendar[1][1].month()] + calendar[1][1].format(" YYYY");
+
+ if (this.showDropdowns) {
+ var currentMonth = calendar[1][1].month();
+ var currentYear = calendar[1][1].year();
+ var maxYear = (maxDate && maxDate.year()) || (this.maxYear);
+ var minYear = (minDate && minDate.year()) || (this.minYear);
+ var inMinYear = currentYear == minYear;
+ var inMaxYear = currentYear == maxYear;
+
+ var monthHtml = '";
+
+ var yearHtml = '';
+
+ dateHtml = monthHtml + yearHtml;
+ }
+
+ html += '
' + dateHtml + '
';
+ if ((!maxDate || maxDate.isAfter(calendar.lastDay)) && (!this.linkedCalendars || side == 'right' || this.singleDatePicker)) {
+ html += '
';
+ } else {
+ html += '
';
+ }
+
+ html += '
';
+ html += '
';
+
+ // add week number label
+ if (this.showWeekNumbers || this.showISOWeekNumbers)
+ html += '
';
+ html += '';
+ html += '';
+
+ //adjust maxDate to reflect the maxSpan setting in order to
+ //grey out end dates beyond the maxSpan
+ if (this.endDate == null && this.maxSpan) {
+ var maxLimit = this.startDate.clone().add(this.maxSpan).endOf('day');
+ if (!maxDate || maxLimit.isBefore(maxDate)) {
+ maxDate = maxLimit;
+ }
+ }
+
+ for (var row = 0; row < 6; row++) {
+ html += '
';
+
+ // add week number
+ if (this.showWeekNumbers)
+ html += '
' + calendar[row][0].week() + '
';
+ else if (this.showISOWeekNumbers)
+ html += '
' + calendar[row][0].isoWeek() + '
';
+
+ for (var col = 0; col < 7; col++) {
+
+ var classes = [];
+
+ //highlight today's date
+ if (calendar[row][col].isSame(new Date(), "day"))
+ classes.push('today');
+
+ //highlight weekends
+ if (calendar[row][col].isoWeekday() > 5)
+ classes.push('weekend');
+
+ //grey out the dates in other months displayed at beginning and end of this calendar
+ if (calendar[row][col].month() != calendar[1][1].month())
+ classes.push('off', 'ends');
+
+ //don't allow selection of dates before the minimum date
+ if (this.minDate && calendar[row][col].isBefore(this.minDate, 'day'))
+ classes.push('off', 'disabled');
+
+ //don't allow selection of dates after the maximum date
+ if (maxDate && calendar[row][col].isAfter(maxDate, 'day'))
+ classes.push('off', 'disabled');
+
+ //don't allow selection of date if a custom function decides it's invalid
+ if (this.isInvalidDate(calendar[row][col]))
+ classes.push('off', 'disabled');
+
+ //highlight the currently selected start date
+ if (calendar[row][col].format('YYYY-MM-DD') == this.startDate.format('YYYY-MM-DD'))
+ classes.push('active', 'start-date');
+
+ //highlight the currently selected end date
+ if (this.endDate != null && calendar[row][col].format('YYYY-MM-DD') == this.endDate.format('YYYY-MM-DD'))
+ classes.push('active', 'end-date');
+
+ //highlight dates in-between the selected dates
+ if (this.endDate != null && calendar[row][col] > this.startDate && calendar[row][col] < this.endDate)
+ classes.push('in-range');
+
+ //apply custom classes for this date
+ var isCustom = this.isCustomDate(calendar[row][col]);
+ if (isCustom !== false) {
+ if (typeof isCustom === 'string')
+ classes.push(isCustom);
+ else
+ Array.prototype.push.apply(classes, isCustom);
+ }
+
+ var cname = '', disabled = false;
+ for (var i = 0; i < classes.length; i++) {
+ cname += classes[i] + ' ';
+ if (classes[i] == 'disabled')
+ disabled = true;
+ }
+ if (!disabled)
+ cname += 'available';
+
+ html += '
' + calendar[row][col].date() + '
';
+
+ }
+ html += '
';
+ }
+
+ html += '';
+ html += '
';
+
+ this.container.find('.drp-calendar.' + side + ' .calendar-table').html(html);
+
+ },
+
+ renderTimePicker: function(side) {
+
+ // Don't bother updating the time picker if it's currently disabled
+ // because an end date hasn't been clicked yet
+ if (side == 'right' && !this.endDate) return;
+
+ var html, selected, minDate, maxDate = this.maxDate;
+
+ if (this.maxSpan && (!this.maxDate || this.startDate.clone().add(this.maxSpan).isBefore(this.maxDate)))
+ maxDate = this.startDate.clone().add(this.maxSpan);
+
+ if (side == 'left') {
+ selected = this.startDate.clone();
+ minDate = this.minDate;
+ } else if (side == 'right') {
+ selected = this.endDate.clone();
+ minDate = this.startDate;
+
+ //Preserve the time already selected
+ var timeSelector = this.container.find('.drp-calendar.right .calendar-time');
+ if (timeSelector.html() != '') {
+
+ selected.hour(!isNaN(selected.hour()) ? selected.hour() : timeSelector.find('.hourselect option:selected').val());
+ selected.minute(!isNaN(selected.minute()) ? selected.minute() : timeSelector.find('.minuteselect option:selected').val());
+ selected.second(!isNaN(selected.second()) ? selected.second() : timeSelector.find('.secondselect option:selected').val());
+
+ if (!this.timePicker24Hour) {
+ var ampm = timeSelector.find('.ampmselect option:selected').val();
+ if (ampm === 'PM' && selected.hour() < 12)
+ selected.hour(selected.hour() + 12);
+ if (ampm === 'AM' && selected.hour() === 12)
+ selected.hour(0);
+ }
+
+ }
+
+ if (selected.isBefore(this.startDate))
+ selected = this.startDate.clone();
+
+ if (maxDate && selected.isAfter(maxDate))
+ selected = maxDate.clone();
+
+ }
+
+ //
+ // hours
+ //
+
+ html = ' ';
+
+ //
+ // minutes
+ //
+
+ html += ': ';
+
+ //
+ // seconds
+ //
+
+ if (this.timePickerSeconds) {
+ html += ': ';
+ }
+
+ //
+ // AM/PM
+ //
+
+ if (!this.timePicker24Hour) {
+ html += '';
+ }
+
+ this.container.find('.drp-calendar.' + side + ' .calendar-time').html(html);
+
+ },
+
+ updateFormInputs: function() {
+
+ if (this.singleDatePicker || (this.endDate && (this.startDate.isBefore(this.endDate) || this.startDate.isSame(this.endDate)))) {
+ this.container.find('button.applyBtn').prop('disabled', false);
+ } else {
+ this.container.find('button.applyBtn').prop('disabled', true);
+ }
+
+ },
+
+ move: function() {
+ var parentOffset = { top: 0, left: 0 },
+ containerTop,
+ drops = this.drops;
+
+ var parentRightEdge = $(window).width();
+ if (!this.parentEl.is('body')) {
+ parentOffset = {
+ top: this.parentEl.offset().top - this.parentEl.scrollTop(),
+ left: this.parentEl.offset().left - this.parentEl.scrollLeft()
+ };
+ parentRightEdge = this.parentEl[0].clientWidth + this.parentEl.offset().left;
+ }
+
+ switch (drops) {
+ case 'auto':
+ containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
+ if (containerTop + this.container.outerHeight() >= this.parentEl[0].scrollHeight) {
+ containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
+ drops = 'up';
+ }
+ break;
+ case 'up':
+ containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
+ break;
+ default:
+ containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
+ break;
+ }
+
+ // Force the container to it's actual width
+ this.container.css({
+ top: 0,
+ left: 0,
+ right: 'auto'
+ });
+ var containerWidth = this.container.outerWidth();
+
+ this.container.toggleClass('drop-up', drops == 'up');
+
+ if (this.opens == 'left') {
+ var containerRight = parentRightEdge - this.element.offset().left - this.element.outerWidth();
+ if (containerWidth + containerRight > $(window).width()) {
+ this.container.css({
+ top: containerTop,
+ right: 'auto',
+ left: 9
+ });
+ } else {
+ this.container.css({
+ top: containerTop,
+ right: containerRight,
+ left: 'auto'
+ });
+ }
+ } else if (this.opens == 'center') {
+ var containerLeft = this.element.offset().left - parentOffset.left + this.element.outerWidth() / 2
+ - containerWidth / 2;
+ if (containerLeft < 0) {
+ this.container.css({
+ top: containerTop,
+ right: 'auto',
+ left: 9
+ });
+ } else if (containerLeft + containerWidth > $(window).width()) {
+ this.container.css({
+ top: containerTop,
+ left: 'auto',
+ right: 0
+ });
+ } else {
+ this.container.css({
+ top: containerTop,
+ left: containerLeft,
+ right: 'auto'
+ });
+ }
+ } else {
+ var containerLeft = this.element.offset().left - parentOffset.left;
+ if (containerLeft + containerWidth > $(window).width()) {
+ this.container.css({
+ top: containerTop,
+ left: 'auto',
+ right: 0
+ });
+ } else {
+ this.container.css({
+ top: containerTop,
+ left: containerLeft,
+ right: 'auto'
+ });
+ }
+ }
+ },
+
+ show: function(e) {
+ if (this.isShowing) return;
+
+ // Create a click proxy that is private to this instance of datepicker, for unbinding
+ this._outsideClickProxy = $.proxy(function(e) { this.outsideClick(e); }, this);
+
+ // Bind global datepicker mousedown for hiding and
+ $(document)
+ .on('mousedown.daterangepicker', this._outsideClickProxy)
+ // also support mobile devices
+ .on('touchend.daterangepicker', this._outsideClickProxy)
+ // also explicitly play nice with Bootstrap dropdowns, which stopPropagation when clicking them
+ .on('click.daterangepicker', '[data-toggle=dropdown]', this._outsideClickProxy)
+ // and also close when focus changes to outside the picker (eg. tabbing between controls)
+ .on('focusin.daterangepicker', this._outsideClickProxy);
+
+ // Reposition the picker if the window is resized while it's open
+ $(window).on('resize.daterangepicker', $.proxy(function(e) { this.move(e); }, this));
+
+ this.oldStartDate = this.startDate.clone();
+ this.oldEndDate = this.endDate.clone();
+ this.previousRightTime = this.endDate.clone();
+
+ this.updateView();
+ this.container.show();
+ this.move();
+ this.element.trigger('show.daterangepicker', this);
+ this.isShowing = true;
+ },
+
+ hide: function(e) {
+ if (!this.isShowing) return;
+
+ //incomplete date selection, revert to last values
+ if (!this.endDate) {
+ this.startDate = this.oldStartDate.clone();
+ this.endDate = this.oldEndDate.clone();
+ }
+
+ //if a new date range was selected, invoke the user callback function
+ if (!this.startDate.isSame(this.oldStartDate) || !this.endDate.isSame(this.oldEndDate))
+ this.callback(this.startDate.clone(), this.endDate.clone(), this.chosenLabel);
+
+ //if picker is attached to a text input, update it
+ this.updateElement();
+
+ $(document).off('.daterangepicker');
+ $(window).off('.daterangepicker');
+ this.container.hide();
+ this.element.trigger('hide.daterangepicker', this);
+ this.isShowing = false;
+ },
+
+ toggle: function(e) {
+ if (this.isShowing) {
+ this.hide();
+ } else {
+ this.show();
+ }
+ },
+
+ outsideClick: function(e) {
+ var target = $(e.target);
+ // if the page is clicked anywhere except within the daterangerpicker/button
+ // itself then call this.hide()
+ if (
+ // ie modal dialog fix
+ e.type == "focusin" ||
+ target.closest(this.element).length ||
+ target.closest(this.container).length ||
+ target.closest('.calendar-table').length
+ ) return;
+ this.hide();
+ this.element.trigger('outsideClick.daterangepicker', this);
+ },
+
+ showCalendars: function() {
+ this.container.addClass('show-calendar');
+ this.move();
+ this.element.trigger('showCalendar.daterangepicker', this);
+ },
+
+ hideCalendars: function() {
+ this.container.removeClass('show-calendar');
+ this.element.trigger('hideCalendar.daterangepicker', this);
+ },
+
+ clickRange: function(e) {
+ var label = e.target.getAttribute('data-range-key');
+ this.chosenLabel = label;
+ if (label == this.locale.customRangeLabel) {
+ this.showCalendars();
+ } else {
+ var dates = this.ranges[label];
+ this.startDate = dates[0];
+ this.endDate = dates[1];
+
+ if (!this.timePicker) {
+ this.startDate.startOf('day');
+ this.endDate.endOf('day');
+ }
+
+ if (!this.alwaysShowCalendars)
+ this.hideCalendars();
+ this.clickApply();
+ }
+ },
+
+ clickPrev: function(e) {
+ var cal = $(e.target).parents('.drp-calendar');
+ if (cal.hasClass('left')) {
+ this.leftCalendar.month.subtract(1, 'month');
+ if (this.linkedCalendars)
+ this.rightCalendar.month.subtract(1, 'month');
+ } else {
+ this.rightCalendar.month.subtract(1, 'month');
+ }
+ this.updateCalendars();
+ },
+
+ clickNext: function(e) {
+ var cal = $(e.target).parents('.drp-calendar');
+ if (cal.hasClass('left')) {
+ this.leftCalendar.month.add(1, 'month');
+ } else {
+ this.rightCalendar.month.add(1, 'month');
+ if (this.linkedCalendars)
+ this.leftCalendar.month.add(1, 'month');
+ }
+ this.updateCalendars();
+ },
+
+ hoverDate: function(e) {
+
+ //ignore dates that can't be selected
+ if (!$(e.target).hasClass('available')) return;
+
+ var title = $(e.target).attr('data-title');
+ var row = title.substr(1, 1);
+ var col = title.substr(3, 1);
+ var cal = $(e.target).parents('.drp-calendar');
+ var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
+
+ //highlight the dates between the start date and the date being hovered as a potential end date
+ var leftCalendar = this.leftCalendar;
+ var rightCalendar = this.rightCalendar;
+ var startDate = this.startDate;
+ if (!this.endDate) {
+ this.container.find('.drp-calendar tbody td').each(function(index, el) {
+
+ //skip week numbers, only look at dates
+ if ($(el).hasClass('week')) return;
+
+ var title = $(el).attr('data-title');
+ var row = title.substr(1, 1);
+ var col = title.substr(3, 1);
+ var cal = $(el).parents('.drp-calendar');
+ var dt = cal.hasClass('left') ? leftCalendar.calendar[row][col] : rightCalendar.calendar[row][col];
+
+ if ((dt.isAfter(startDate) && dt.isBefore(date)) || dt.isSame(date, 'day')) {
+ $(el).addClass('in-range');
+ } else {
+ $(el).removeClass('in-range');
+ }
+
+ });
+ }
+
+ },
+
+ clickDate: function(e) {
+
+ if (!$(e.target).hasClass('available')) return;
+
+ var title = $(e.target).attr('data-title');
+ var row = title.substr(1, 1);
+ var col = title.substr(3, 1);
+ var cal = $(e.target).parents('.drp-calendar');
+ var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
+
+ //
+ // this function needs to do a few things:
+ // * alternate between selecting a start and end date for the range,
+ // * if the time picker is enabled, apply the hour/minute/second from the select boxes to the clicked date
+ // * if autoapply is enabled, and an end date was chosen, apply the selection
+ // * if single date picker mode, and time picker isn't enabled, apply the selection immediately
+ // * if one of the inputs above the calendars was focused, cancel that manual input
+ //
+
+ if (this.endDate || date.isBefore(this.startDate, 'day')) { //picking start
+ if (this.timePicker) {
+ var hour = parseInt(this.container.find('.left .hourselect').val(), 10);
+ if (!this.timePicker24Hour) {
+ var ampm = this.container.find('.left .ampmselect').val();
+ if (ampm === 'PM' && hour < 12)
+ hour += 12;
+ if (ampm === 'AM' && hour === 12)
+ hour = 0;
+ }
+ var minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
+ if (isNaN(minute)) {
+ minute = parseInt(this.container.find('.left .minuteselect option:last').val(), 10);
+ }
+ var second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
+ date = date.clone().hour(hour).minute(minute).second(second);
+ }
+ this.endDate = null;
+ this.setStartDate(date.clone());
+ } else if (!this.endDate && date.isBefore(this.startDate)) {
+ //special case: clicking the same date for start/end,
+ //but the time of the end date is before the start date
+ this.setEndDate(this.startDate.clone());
+ } else { // picking end
+ if (this.timePicker) {
+ var hour = parseInt(this.container.find('.right .hourselect').val(), 10);
+ if (!this.timePicker24Hour) {
+ var ampm = this.container.find('.right .ampmselect').val();
+ if (ampm === 'PM' && hour < 12)
+ hour += 12;
+ if (ampm === 'AM' && hour === 12)
+ hour = 0;
+ }
+ var minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
+ if (isNaN(minute)) {
+ minute = parseInt(this.container.find('.right .minuteselect option:last').val(), 10);
+ }
+ var second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
+ date = date.clone().hour(hour).minute(minute).second(second);
+ }
+ this.setEndDate(date.clone());
+ if (this.autoApply) {
+ this.calculateChosenLabel();
+ this.clickApply();
+ }
+ }
+
+ if (this.singleDatePicker) {
+ this.setEndDate(this.startDate);
+ if (!this.timePicker && this.autoApply)
+ this.clickApply();
+ }
+
+ this.updateView();
+
+ //This is to cancel the blur event handler if the mouse was in one of the inputs
+ e.stopPropagation();
+
+ },
+
+ calculateChosenLabel: function () {
+ var customRange = true;
+ var i = 0;
+ for (var range in this.ranges) {
+ if (this.timePicker) {
+ var format = this.timePickerSeconds ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD HH:mm";
+ //ignore times when comparing dates if time picker seconds is not enabled
+ if (this.startDate.format(format) == this.ranges[range][0].format(format) && this.endDate.format(format) == this.ranges[range][1].format(format)) {
+ customRange = false;
+ this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').attr('data-range-key');
+ break;
+ }
+ } else {
+ //ignore times when comparing dates if time picker is not enabled
+ if (this.startDate.format('YYYY-MM-DD') == this.ranges[range][0].format('YYYY-MM-DD') && this.endDate.format('YYYY-MM-DD') == this.ranges[range][1].format('YYYY-MM-DD')) {
+ customRange = false;
+ this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').attr('data-range-key');
+ break;
+ }
+ }
+ i++;
+ }
+ if (customRange) {
+ if (this.showCustomRangeLabel) {
+ this.chosenLabel = this.container.find('.ranges li:last').addClass('active').attr('data-range-key');
+ } else {
+ this.chosenLabel = null;
+ }
+ this.showCalendars();
+ }
+ },
+
+ clickApply: function(e) {
+ this.hide();
+ this.element.trigger('apply.daterangepicker', this);
+ },
+
+ clickCancel: function(e) {
+ this.startDate = this.oldStartDate;
+ this.endDate = this.oldEndDate;
+ this.hide();
+ this.element.trigger('cancel.daterangepicker', this);
+ },
+
+ monthOrYearChanged: function(e) {
+ var isLeft = $(e.target).closest('.drp-calendar').hasClass('left'),
+ leftOrRight = isLeft ? 'left' : 'right',
+ cal = this.container.find('.drp-calendar.'+leftOrRight);
+
+ // Month must be Number for new moment versions
+ var month = parseInt(cal.find('.monthselect').val(), 10);
+ var year = cal.find('.yearselect').val();
+
+ if (!isLeft) {
+ if (year < this.startDate.year() || (year == this.startDate.year() && month < this.startDate.month())) {
+ month = this.startDate.month();
+ year = this.startDate.year();
+ }
+ }
+
+ if (this.minDate) {
+ if (year < this.minDate.year() || (year == this.minDate.year() && month < this.minDate.month())) {
+ month = this.minDate.month();
+ year = this.minDate.year();
+ }
+ }
+
+ if (this.maxDate) {
+ if (year > this.maxDate.year() || (year == this.maxDate.year() && month > this.maxDate.month())) {
+ month = this.maxDate.month();
+ year = this.maxDate.year();
+ }
+ }
+
+ if (isLeft) {
+ this.leftCalendar.month.month(month).year(year);
+ if (this.linkedCalendars)
+ this.rightCalendar.month = this.leftCalendar.month.clone().add(1, 'month');
+ } else {
+ this.rightCalendar.month.month(month).year(year);
+ if (this.linkedCalendars)
+ this.leftCalendar.month = this.rightCalendar.month.clone().subtract(1, 'month');
+ }
+ this.updateCalendars();
+ },
+
+ timeChanged: function(e) {
+
+ var cal = $(e.target).closest('.drp-calendar'),
+ isLeft = cal.hasClass('left');
+
+ var hour = parseInt(cal.find('.hourselect').val(), 10);
+ var minute = parseInt(cal.find('.minuteselect').val(), 10);
+ if (isNaN(minute)) {
+ minute = parseInt(cal.find('.minuteselect option:last').val(), 10);
+ }
+ var second = this.timePickerSeconds ? parseInt(cal.find('.secondselect').val(), 10) : 0;
+
+ if (!this.timePicker24Hour) {
+ var ampm = cal.find('.ampmselect').val();
+ if (ampm === 'PM' && hour < 12)
+ hour += 12;
+ if (ampm === 'AM' && hour === 12)
+ hour = 0;
+ }
+
+ if (isLeft) {
+ var start = this.startDate.clone();
+ start.hour(hour);
+ start.minute(minute);
+ start.second(second);
+ this.setStartDate(start);
+ if (this.singleDatePicker) {
+ this.endDate = this.startDate.clone();
+ } else if (this.endDate && this.endDate.format('YYYY-MM-DD') == start.format('YYYY-MM-DD') && this.endDate.isBefore(start)) {
+ this.setEndDate(start.clone());
+ }
+ } else if (this.endDate) {
+ var end = this.endDate.clone();
+ end.hour(hour);
+ end.minute(minute);
+ end.second(second);
+ this.setEndDate(end);
+ }
+
+ //update the calendars so all clickable dates reflect the new time component
+ this.updateCalendars();
+
+ //update the form inputs above the calendars with the new time
+ this.updateFormInputs();
+
+ //re-render the time pickers because changing one selection can affect what's enabled in another
+ this.renderTimePicker('left');
+ this.renderTimePicker('right');
+
+ },
+
+ elementChanged: function() {
+ if (!this.element.is('input')) return;
+ if (!this.element.val().length) return;
+
+ var dateString = this.element.val().split(this.locale.separator),
+ start = null,
+ end = null;
+
+ if (dateString.length === 2) {
+ start = moment(dateString[0], this.locale.format);
+ end = moment(dateString[1], this.locale.format);
+ }
+
+ if (this.singleDatePicker || start === null || end === null) {
+ start = moment(this.element.val(), this.locale.format);
+ end = start;
+ }
+
+ if (!start.isValid() || !end.isValid()) return;
+
+ this.setStartDate(start);
+ this.setEndDate(end);
+ this.updateView();
+ },
+
+ keydown: function(e) {
+ //hide on tab or enter
+ if ((e.keyCode === 9) || (e.keyCode === 13)) {
+ this.hide();
+ }
+
+ //hide on esc and prevent propagation
+ if (e.keyCode === 27) {
+ e.preventDefault();
+ e.stopPropagation();
+
+ this.hide();
+ }
+ },
+
+ updateElement: function() {
+ if (this.element.is('input') && this.autoUpdateInput) {
+ var newValue = this.startDate.format(this.locale.format);
+ if (!this.singleDatePicker) {
+ newValue += this.locale.separator + this.endDate.format(this.locale.format);
+ }
+ if (newValue !== this.element.val()) {
+ this.element.val(newValue).trigger('change');
+ }
+ }
+ },
+
+ remove: function() {
+ this.container.remove();
+ this.element.off('.daterangepicker');
+ this.element.removeData();
+ }
+
+ };
+
+ $.fn.daterangepicker = function(options, callback) {
+ var implementOptions = $.extend(true, {}, $.fn.daterangepicker.defaultOptions, options);
+ this.each(function() {
+ var el = $(this);
+ if (el.data('daterangepicker'))
+ el.data('daterangepicker').remove();
+ el.data('daterangepicker', new DateRangePicker(el, implementOptions, callback));
+ });
+ return this;
+ };
+
+ return DateRangePicker;
+
+}));
diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/bootstrap/js/bootstrap.enable.popovers.everywhere.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/bootstrap/js/bootstrap.enable.popovers.everywhere.js
index a02a2a7a5e..39ca36d655 100644
--- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/bootstrap/js/bootstrap.enable.popovers.everywhere.js
+++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/bootstrap/js/bootstrap.enable.popovers.everywhere.js
@@ -1,5 +1,5 @@
-(function () {
- [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]')).map(function (popoverTriggerEl) {
- return new bootstrap.Popover(popoverTriggerEl)
- })
-})();
+(function () {
+ [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]')).map(function (popoverTriggerEl) {
+ return new bootstrap.Popover(popoverTriggerEl)
+ })
+})();
diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/bootstrap/js/bootstrap.enable.tooltips.everywhere.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/bootstrap/js/bootstrap.enable.tooltips.everywhere.js
index 5a2b42a1d1..bc8f4b5d51 100644
--- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/bootstrap/js/bootstrap.enable.tooltips.everywhere.js
+++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/bootstrap/js/bootstrap.enable.tooltips.everywhere.js
@@ -1,5 +1,5 @@
-(function () {
- [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map(function (tooltipTriggerEl) {
- return new bootstrap.Tooltip(tooltipTriggerEl)
- });
-})();
+(function () {
+ [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map(function (tooltipTriggerEl) {
+ return new bootstrap.Tooltip(tooltipTriggerEl)
+ });
+})();
diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/codemirror/mode/sas/sas.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/codemirror/mode/sas/sas.js
old mode 100644
new mode 100755
diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/jquery-form/jquery.form.min.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/jquery-form/jquery.form.min.js
index c794a23e13..36fa19def7 100644
--- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/jquery-form/jquery.form.min.js
+++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/jquery-form/jquery.form.min.js
@@ -1,22 +1,22 @@
-/*!
- * jQuery Form Plugin
- * version: 4.3.0
- * Requires jQuery v1.7.2 or later
- * Project repository: https://github.com/jquery-form/form
-
- * Copyright 2017 Kevin Morris
- * Copyright 2006 M. Alsup
-
- * Dual licensed under the LGPL-2.1+ or MIT licenses
- * https://github.com/jquery-form/form#license
-
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- */
+/*!
+ * jQuery Form Plugin
+ * version: 4.3.0
+ * Requires jQuery v1.7.2 or later
+ * Project repository: https://github.com/jquery-form/form
+
+ * Copyright 2017 Kevin Morris
+ * Copyright 2006 M. Alsup
+
+ * Dual licensed under the LGPL-2.1+ or MIT licenses
+ * https://github.com/jquery-form/form#license
+
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ */
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,r){return void 0===r&&(r="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(r),r}:e(jQuery)}(function(e){"use strict";var t=/\r?\n/g,r={};r.fileapi=void 0!==e('').get(0).files,r.formdata=void 0!==window.FormData;var a=!!e.fn.prop;function n(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).closest("form").ajaxSubmit(r))}function i(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var i=r.form;if(i.clk=r,"image"===r.type)if(void 0!==t.offsetX)i.clk_x=t.offsetX,i.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();i.clk_x=t.pageX-o.left,i.clk_y=t.pageY-o.top}else i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop;setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function o(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}e.fn.attr2=function(){if(!a)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,n,i,s){if(!this.length)return o("ajaxSubmit: skipping submit process - no element selected"),this;var u,c,l,f,d=this;"function"==typeof t?t={success:t}:"string"==typeof t||!1===t&&arguments.length>0?(t={url:t,data:n,dataType:i},"function"==typeof s&&(t.success=s)):void 0===t&&(t={}),u=t.method||t.type||this.attr2("method"),(l=(l="string"==typeof(c=t.url||this.attr2("action"))?e.trim(c):"")||window.location.href||"")&&(l=(l.match(/^([^#]+)/)||[])[1]),f=/(MSIE|Trident)/.test(navigator.userAgent||"")&&/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",t=e.extend(!0,{url:l,success:e.ajaxSettings.success,type:u||e.ajaxSettings.type,iframeSrc:f},t);var m={};if(this.trigger("form-pre-serialize",[this,t,m]),m.veto)return o("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&!1===t.beforeSerialize(this,t))return o("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var p=t.traditional;void 0===p&&(p=e.ajaxSettings.traditional);var h,v=[],g=this.formToArray(t.semantic,v,t.filtering);if(t.data){var x=e.isFunction(t.data)?t.data(g):t.data;t.extraData=x,h=e.param(x,p)}if(t.beforeSubmit&&!1===t.beforeSubmit(g,this,t))return o("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[g,this,t,m]),m.veto)return o("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var y=e.param(g,p);h&&(y=y?y+"&"+h:h),"GET"===t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+y,t.data=null):t.data=y;var b=[];if(t.resetForm&&b.push(function(){d.resetForm()}),t.clearForm&&b.push(function(){d.clearForm(t.includeHidden)}),!t.dataType&&t.target){var T=t.success||function(){};b.push(function(r,a,n){var i=arguments,o=t.replaceTarget?"replaceWith":"html";"html"==o&&(r=e.parseHTML(e("
").text(r).html())),e(t.target)[o](r).each(function(){T.apply(this,i)})})}else t.success&&(e.isArray(t.success)?e.merge(b,t.success):b.push(t.success));if(t.success=function(e,r,a){for(var n=t.context||this,i=0,o=b.length;i0,k="multipart/form-data",D=d.attr("enctype")===k||d.attr("encoding")===k,A=r.fileapi&&r.formdata;o("fileAPI :"+A);var F,L=(S||D)&&!A;!1!==t.iframe&&(t.iframe||L)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){F=M(g)}):F=M(g):F=(S||D)&&A?function(r){for(var a=new FormData,n=0;n',j)).css({position:"absolute",top:"-1000px",left:"-1000px"}),m=f[0],p={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";o("aborting upload... "+r),this.aborted=1;try{m.contentWindow.document.execCommand&&m.contentWindow.document.execCommand("Stop")}catch(e){}f.attr("src",s.iframeSrc),p.error=r,s.error&&s.error.call(s.context,p,r,t),c&&e.event.trigger("ajaxError",[p,s,r]),s.complete&&s.complete.call(s.context,p,r)}},(c=s.global)&&0==e.active++&&e.event.trigger("ajaxStart"),c&&e.event.trigger("ajaxSend",[p,s]),s.beforeSend&&!1===s.beforeSend.call(s.context,p,s))return s.global&&e.active--,T.reject(),T;if(p.aborted)return T.reject(),T;(h=b.clk)&&(g=h.name)&&!h.disabled&&(s.extraData=s.extraData||{},s.extraData[g]=h.value,"image"===h.type&&(s.extraData[g+".x"]=b.clk_x,s.extraData[g+".y"]=b.clk_y));var S=1,k=2;function D(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(e){o("cannot get iframe.contentWindow document: "+e)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){o("cannot get iframe.contentDocument: "+r),t=e.document}return t}var A=e("meta[name=csrf-token]").attr("content"),F=e("meta[name=csrf-param]").attr("content");function L(){var t=d.attr2("target"),r=d.attr2("action"),a=d.attr("enctype")||d.attr("encoding")||"multipart/form-data";b.setAttribute("target",l),u&&!/post/i.test(u)||b.setAttribute("method","POST"),r!==s.url&&b.setAttribute("action",s.url),s.skipEncodingOverride||u&&!/post/i.test(u)||d.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),s.timeout&&(y=setTimeout(function(){x=!0,C(S)},s.timeout));var n=[];try{if(s.extraData)for(var i in s.extraData)s.extraData.hasOwnProperty(i)&&(e.isPlainObject(s.extraData[i])&&s.extraData[i].hasOwnProperty("name")&&s.extraData[i].hasOwnProperty("value")?n.push(e('',j).val(s.extraData[i].value).appendTo(b)[0]):n.push(e('',j).val(s.extraData[i]).appendTo(b)[0]));s.iframeTarget||f.appendTo(w),m.attachEvent?m.attachEvent("onload",C):m.addEventListener("load",C,!1),setTimeout(function e(){try{var t=D(m).readyState;o("state = "+t),t&&"uninitialized"===t.toLowerCase()&&setTimeout(e,50)}catch(e){o("Server abort: ",e," (",e.name,")"),C(k),y&&clearTimeout(y),y=void 0}},15);try{b.submit()}catch(e){document.createElement("form").submit.apply(b)}}finally{b.setAttribute("action",r),b.setAttribute("enctype",a),t?b.setAttribute("target",t):d.removeAttr("target"),e(n).remove()}}F&&A&&(s.extraData=s.extraData||{},s.extraData[F]=A),s.forceSync?L():setTimeout(L,10);var E,M,O,X=50;function C(t){if(!p.aborted&&!O){if((M=D(m))||(o("cannot access response document"),t=k),t===S&&p)return p.abort("timeout"),void T.reject(p,"timeout");if(t===k&&p)return p.abort("server abort"),void T.reject(p,"error","server abort");if(M&&M.location.href!==s.iframeSrc||x){m.detachEvent?m.detachEvent("onload",C):m.removeEventListener("load",C,!1);var r,a="success";try{if(x)throw"timeout";var n="xml"===s.dataType||M.XMLDocument||e.isXMLDoc(M);if(o("isXml="+n),!n&&window.opera&&(null===M.body||!M.body.innerHTML)&&--X)return o("requeing onLoad callback, DOM not available"),void setTimeout(C,250);var i=M.body?M.body:M.documentElement;p.responseText=i?i.innerHTML:null,p.responseXML=M.XMLDocument?M.XMLDocument:M,n&&(s.dataType="xml"),p.getResponseHeader=function(e){return{"content-type":s.dataType}[e.toLowerCase()]},i&&(p.status=Number(i.getAttribute("status"))||p.status,p.statusText=i.getAttribute("statusText")||p.statusText);var u=(s.dataType||"").toLowerCase(),l=/(json|script|text)/.test(u);if(l||s.textarea){var d=M.getElementsByTagName("textarea")[0];if(d)p.responseText=d.value,p.status=Number(d.getAttribute("status"))||p.status,p.statusText=d.getAttribute("statusText")||p.statusText;else if(l){var h=M.getElementsByTagName("pre")[0],v=M.getElementsByTagName("body")[0];h?p.responseText=h.textContent?h.textContent:h.innerText:v&&(p.responseText=v.textContent?v.textContent:v.innerText)}}else"xml"===u&&!p.responseXML&&p.responseText&&(p.responseXML=q(p.responseText));try{E=_(p,u,s)}catch(e){a="parsererror",p.error=r=e||a}}catch(e){o("error caught: ",e),a="error",p.error=r=e||a}p.aborted&&(o("upload aborted"),a=null),p.status&&(a=p.status>=200&&p.status<300||304===p.status?"success":"error"),"success"===a?(s.success&&s.success.call(s.context,E,"success",p),T.resolve(p.responseText,"success",p),c&&e.event.trigger("ajaxSuccess",[p,s])):a&&(void 0===r&&(r=p.statusText),s.error&&s.error.call(s.context,p,a,r),T.reject(p,"error",r),c&&e.event.trigger("ajaxError",[p,s,r])),c&&e.event.trigger("ajaxComplete",[p,s]),c&&!--e.active&&e.event.trigger("ajaxStop"),s.complete&&s.complete.call(s.context,p,a),O=!0,s.timeout&&clearTimeout(y),setTimeout(function(){s.iframeTarget?f.attr("src",s.iframeSrc):f.remove(),p.responseXML=null},100)}}}var q=e.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!==t.documentElement.nodeName?t:null},N=e.parseJSON||function(e){return window.console.error("jquery.parseJSON is undefined"),null},_=function(t,r,a){var n=t.getResponseHeader("content-type")||"",i=("xml"===r||!r)&&n.indexOf("xml")>=0,o=i?t.responseXML:t.responseText;return i&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(o=a.dataFilter(o,r)),"string"==typeof o&&(("json"===r||!r)&&n.indexOf("json")>=0?o=N(o):("script"===r||!r)&&n.indexOf("javascript")>=0&&e.globalEval(o)),o};return T}},e.fn.ajaxForm=function(t,r,a,s){if(("string"==typeof t||!1===t&&arguments.length>0)&&(t={url:t,data:r,dataType:a},"function"==typeof s&&(t.success=s)),(t=t||{}).delegation=t.delegation&&e.isFunction(e.fn.on),!t.delegation&&0===this.length){var u={s:this.selector,c:this.context};return!e.isReady&&u.s?(o("DOM not ready, queuing ajaxForm"),e(function(){e(u.s,u.c).ajaxForm(t)}),this):(o("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return t.delegation?(e(document).off("submit.form-plugin",this.selector,n).off("click.form-plugin",this.selector,i).on("submit.form-plugin",this.selector,t,n).on("click.form-plugin",this.selector,t,i),this):(t.beforeFormUnbind&&t.beforeFormUnbind(this,t),this.ajaxFormUnbind().on("submit.form-plugin",t,n).on("click.form-plugin",t,i))},e.fn.ajaxFormUnbind=function(){return this.off("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,a,n){var i=[];if(0===this.length)return i;var o,s,u,c,l,f,d,m,p=this[0],h=this.attr("id"),v=t||void 0===p.elements?p.getElementsByTagName("*"):p.elements;if(v&&(v=e.makeArray(v)),h&&(t||/(Edge|Trident)\//.test(navigator.userAgent))&&(o=e(':input[form="'+h+'"]').get()).length&&(v=(v||[]).concat(o)),!v||!v.length)return i;for(e.isFunction(n)&&(v=e.map(v,n)),s=0,d=v.length;s?@\[\\\]^`{|}~])/g, "\\$1");
- }
-
- function getModelPrefix(fieldName) {
- return fieldName.substr(0, fieldName.lastIndexOf(".") + 1);
- }
-
- function appendModelPrefix(value, prefix) {
- if (value.indexOf("*.") === 0) {
- value = value.replace("*.", prefix);
- }
- return value;
- }
-
- function onError(error, inputElement) { // 'this' is the form element
- var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
- replaceAttrValue = container.attr("data-valmsg-replace"),
- replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
-
- container.removeClass("field-validation-valid").addClass("field-validation-error");
- error.data("unobtrusiveContainer", container);
-
- if (replace) {
- container.empty();
- error.removeClass("input-validation-error").appendTo(container);
- }
- else {
- error.hide();
- }
- }
-
- function onErrors(event, validator) { // 'this' is the form element
- var container = $(this).find("[data-valmsg-summary=true]"),
- list = container.find("ul");
-
- if (list && list.length && validator.errorList.length) {
- list.empty();
- container.addClass("validation-summary-errors").removeClass("validation-summary-valid");
-
- $.each(validator.errorList, function () {
- $("").html(this.message).appendTo(list);
- });
- }
- }
-
- function onSuccess(error) { // 'this' is the form element
- var container = error.data("unobtrusiveContainer");
-
- if (container) {
- var replaceAttrValue = container.attr("data-valmsg-replace"),
- replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
-
- container.addClass("field-validation-valid").removeClass("field-validation-error");
- error.removeData("unobtrusiveContainer");
-
- if (replace) {
- container.empty();
- }
- }
- }
-
- function onReset(event) { // 'this' is the form element
- var $form = $(this),
- key = '__jquery_unobtrusive_validation_form_reset';
- if ($form.data(key)) {
- return;
- }
- // Set a flag that indicates we're currently resetting the form.
- $form.data(key, true);
- try {
- $form.data("validator").resetForm();
- } finally {
- $form.removeData(key);
- }
-
- $form.find(".validation-summary-errors")
- .addClass("validation-summary-valid")
- .removeClass("validation-summary-errors");
- $form.find(".field-validation-error")
- .addClass("field-validation-valid")
- .removeClass("field-validation-error")
- .removeData("unobtrusiveContainer")
- .find(">*") // If we were using valmsg-replace, get the underlying error
- .removeData("unobtrusiveContainer");
- }
-
- function validationInfo(form) {
- var $form = $(form),
- result = $form.data(data_validation),
- onResetProxy = $.proxy(onReset, form),
- defaultOptions = $jQval.unobtrusive.options || {},
- execInContext = function (name, args) {
- var func = defaultOptions[name];
- func && $.isFunction(func) && func.apply(form, args);
- };
-
- if (!result) {
- result = {
- options: { // options structure passed to jQuery Validate's validate() method
- errorClass: defaultOptions.errorClass || "input-validation-error",
- errorElement: defaultOptions.errorElement || "span",
- errorPlacement: function () {
- onError.apply(form, arguments);
- execInContext("errorPlacement", arguments);
- },
- invalidHandler: function () {
- onErrors.apply(form, arguments);
- execInContext("invalidHandler", arguments);
- },
- messages: {},
- rules: {},
- success: function () {
- onSuccess.apply(form, arguments);
- execInContext("success", arguments);
- }
- },
- attachValidation: function () {
- $form
- .off("reset." + data_validation, onResetProxy)
- .on("reset." + data_validation, onResetProxy)
- .validate(this.options);
- },
- validate: function () { // a validation function that is called by unobtrusive Ajax
- $form.validate();
- return $form.valid();
- }
- };
- $form.data(data_validation, result);
- }
-
- return result;
- }
-
- $jQval.unobtrusive = {
- adapters: [],
-
- parseElement: function (element, skipAttach) {
- ///
- /// Parses a single HTML element for unobtrusive validation attributes.
- ///
- /// The HTML element to be parsed.
- /// [Optional] true to skip attaching the
- /// validation to the form. If parsing just this single element, you should specify true.
- /// If parsing several elements, you should specify false, and manually attach the validation
- /// to the form when you are finished. The default is false.
- var $element = $(element),
- form = $element.parents("form")[0],
- valInfo, rules, messages;
-
- if (!form) { // Cannot do client-side validation without a form
- return;
- }
-
- valInfo = validationInfo(form);
- valInfo.options.rules[element.name] = rules = {};
- valInfo.options.messages[element.name] = messages = {};
-
- $.each(this.adapters, function () {
- var prefix = "data-val-" + this.name,
- message = $element.attr(prefix),
- paramValues = {};
-
- if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy)
- prefix += "-";
-
- $.each(this.params, function () {
- paramValues[this] = $element.attr(prefix + this);
- });
-
- this.adapt({
- element: element,
- form: form,
- message: message,
- params: paramValues,
- rules: rules,
- messages: messages
- });
- }
- });
-
- $.extend(rules, { "__dummy__": true });
-
- if (!skipAttach) {
- valInfo.attachValidation();
- }
- },
-
- parse: function (selector) {
- ///
- /// Parses all the HTML elements in the specified selector. It looks for input elements decorated
- /// with the [data-val=true] attribute value and enables validation according to the data-val-*
- /// attribute values.
- ///
- /// Any valid jQuery selector.
-
- // $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one
- // element with data-val=true
- var $selector = $(selector),
- $forms = $selector.parents()
- .addBack()
- .filter("form")
- .add($selector.find("form"))
- .has("[data-val=true]");
-
- $selector.find("[data-val=true]").each(function () {
- $jQval.unobtrusive.parseElement(this, true);
- });
-
- $forms.each(function () {
- var info = validationInfo(this);
- if (info) {
- info.attachValidation();
- }
- });
- }
- };
-
- adapters = $jQval.unobtrusive.adapters;
-
- adapters.add = function (adapterName, params, fn) {
- /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.
- /// The name of the adapter to be added. This matches the name used
- /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).
- /// [Optional] An array of parameter names (strings) that will
- /// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and
- /// mmmm is the parameter name).
- /// The function to call, which adapts the values from the HTML
- /// attributes into jQuery Validate rules and/or messages.
- ///
- if (!fn) { // Called with no params, just a function
- fn = params;
- params = [];
- }
- this.push({ name: adapterName, params: params, adapt: fn });
- return this;
- };
-
- adapters.addBool = function (adapterName, ruleName) {
- /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
- /// the jQuery Validate validation rule has no parameter values.
- /// The name of the adapter to be added. This matches the name used
- /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).
- /// [Optional] The name of the jQuery Validate rule. If not provided, the value
- /// of adapterName will be used instead.
- ///
- return this.add(adapterName, function (options) {
- setValidationValues(options, ruleName || adapterName, true);
- });
- };
-
- adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) {
- /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
- /// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and
- /// one for min-and-max). The HTML parameters are expected to be named -min and -max.
- /// The name of the adapter to be added. This matches the name used
- /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).
- /// The name of the jQuery Validate rule to be used when you only
- /// have a minimum value.
- /// The name of the jQuery Validate rule to be used when you only
- /// have a maximum value.
- /// The name of the jQuery Validate rule to be used when you
- /// have both a minimum and maximum value.
- /// [Optional] The name of the HTML attribute that
- /// contains the minimum value. The default is "min".
- /// [Optional] The name of the HTML attribute that
- /// contains the maximum value. The default is "max".
- ///
- return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) {
- var min = options.params.min,
- max = options.params.max;
-
- if (min && max) {
- setValidationValues(options, minMaxRuleName, [min, max]);
- }
- else if (min) {
- setValidationValues(options, minRuleName, min);
- }
- else if (max) {
- setValidationValues(options, maxRuleName, max);
- }
- });
- };
-
- adapters.addSingleVal = function (adapterName, attribute, ruleName) {
- /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
- /// the jQuery Validate validation rule has a single value.
- /// The name of the adapter to be added. This matches the name used
- /// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).
- /// [Optional] The name of the HTML attribute that contains the value.
- /// The default is "val".
- /// [Optional] The name of the jQuery Validate rule. If not provided, the value
- /// of adapterName will be used instead.
- ///
- return this.add(adapterName, [attribute || "val"], function (options) {
- setValidationValues(options, ruleName || adapterName, options.params[attribute]);
- });
- };
-
- $jQval.addMethod("__dummy__", function (value, element, params) {
- return true;
- });
-
- $jQval.addMethod("regex", function (value, element, params) {
- var match;
- if (this.optional(element)) {
- return true;
- }
-
- match = new RegExp(params).exec(value);
- return (match && (match.index === 0) && (match[0].length === value.length));
- });
-
- $jQval.addMethod("nonalphamin", function (value, element, nonalphamin) {
- var match;
- if (nonalphamin) {
- match = value.match(/\W/g);
- match = match && match.length >= nonalphamin;
- }
- return match;
- });
-
- if ($jQval.methods.extension) {
- adapters.addSingleVal("accept", "mimtype");
- adapters.addSingleVal("extension", "extension");
- } else {
- // for backward compatibility, when the 'extension' validation method does not exist, such as with versions
- // of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for
- // validating the extension, and ignore mime-type validations as they are not supported.
- adapters.addSingleVal("extension", "extension", "accept");
- }
-
- adapters.addSingleVal("regex", "pattern");
- adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");
- adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range");
- adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength");
- adapters.add("equalto", ["other"], function (options) {
- var prefix = getModelPrefix(options.element.name),
- other = options.params.other,
- fullOtherName = appendModelPrefix(other, prefix),
- element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
-
- setValidationValues(options, "equalTo", element);
- });
- adapters.add("required", function (options) {
- // jQuery Validate equates "required" with "mandatory" for checkbox elements
- if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") {
- setValidationValues(options, "required", true);
- }
- });
- adapters.add("remote", ["url", "type", "additionalfields"], function (options) {
- var value = {
- url: options.params.url,
- type: options.params.type || "GET",
- data: {}
- },
- prefix = getModelPrefix(options.element.name);
-
- $.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
- var paramName = appendModelPrefix(fieldName, prefix);
- value.data[paramName] = function () {
- var field = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']");
- // For checkboxes and radio buttons, only pick up values from checked fields.
- if (field.is(":checkbox")) {
- return field.filter(":checked").val() || field.filter(":hidden").val() || '';
- }
- else if (field.is(":radio")) {
- return field.filter(":checked").val() || '';
- }
- return field.val();
- };
- });
-
- setValidationValues(options, "remote", value);
- });
- adapters.add("password", ["min", "nonalphamin", "regex"], function (options) {
- if (options.params.min) {
- setValidationValues(options, "minlength", options.params.min);
- }
- if (options.params.nonalphamin) {
- setValidationValues(options, "nonalphamin", options.params.nonalphamin);
- }
- if (options.params.regex) {
- setValidationValues(options, "regex", options.params.regex);
- }
- });
- adapters.add("fileextensions", ["extensions"], function (options) {
- setValidationValues(options, "extension", options.params.extensions);
- });
-
- $(function () {
- $jQval.unobtrusive.parse(document);
- });
-
- return $jQval.unobtrusive;
-}));
+// Unobtrusive validation support library for jQuery and jQuery Validate
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+// @version v3.2.12
+
+/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
+/*global document: false, jQuery: false */
+
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define("jquery.validate.unobtrusive", ['jquery-validation'], factory);
+ } else if (typeof module === 'object' && module.exports) {
+ // CommonJS-like environments that support module.exports
+ module.exports = factory(require('jquery-validation'));
+ } else {
+ // Browser global
+ jQuery.validator.unobtrusive = factory(jQuery);
+ }
+}(function ($) {
+ var $jQval = $.validator,
+ adapters,
+ data_validation = "unobtrusiveValidation";
+
+ function setValidationValues(options, ruleName, value) {
+ options.rules[ruleName] = value;
+ if (options.message) {
+ options.messages[ruleName] = options.message;
+ }
+ }
+
+ function splitAndTrim(value) {
+ return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g);
+ }
+
+ function escapeAttributeValue(value) {
+ // As mentioned on http://api.jquery.com/category/selectors/
+ return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1");
+ }
+
+ function getModelPrefix(fieldName) {
+ return fieldName.substr(0, fieldName.lastIndexOf(".") + 1);
+ }
+
+ function appendModelPrefix(value, prefix) {
+ if (value.indexOf("*.") === 0) {
+ value = value.replace("*.", prefix);
+ }
+ return value;
+ }
+
+ function onError(error, inputElement) { // 'this' is the form element
+ var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
+ replaceAttrValue = container.attr("data-valmsg-replace"),
+ replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
+
+ container.removeClass("field-validation-valid").addClass("field-validation-error");
+ error.data("unobtrusiveContainer", container);
+
+ if (replace) {
+ container.empty();
+ error.removeClass("input-validation-error").appendTo(container);
+ }
+ else {
+ error.hide();
+ }
+ }
+
+ function onErrors(event, validator) { // 'this' is the form element
+ var container = $(this).find("[data-valmsg-summary=true]"),
+ list = container.find("ul");
+
+ if (list && list.length && validator.errorList.length) {
+ list.empty();
+ container.addClass("validation-summary-errors").removeClass("validation-summary-valid");
+
+ $.each(validator.errorList, function () {
+ $("").html(this.message).appendTo(list);
+ });
+ }
+ }
+
+ function onSuccess(error) { // 'this' is the form element
+ var container = error.data("unobtrusiveContainer");
+
+ if (container) {
+ var replaceAttrValue = container.attr("data-valmsg-replace"),
+ replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
+
+ container.addClass("field-validation-valid").removeClass("field-validation-error");
+ error.removeData("unobtrusiveContainer");
+
+ if (replace) {
+ container.empty();
+ }
+ }
+ }
+
+ function onReset(event) { // 'this' is the form element
+ var $form = $(this),
+ key = '__jquery_unobtrusive_validation_form_reset';
+ if ($form.data(key)) {
+ return;
+ }
+ // Set a flag that indicates we're currently resetting the form.
+ $form.data(key, true);
+ try {
+ $form.data("validator").resetForm();
+ } finally {
+ $form.removeData(key);
+ }
+
+ $form.find(".validation-summary-errors")
+ .addClass("validation-summary-valid")
+ .removeClass("validation-summary-errors");
+ $form.find(".field-validation-error")
+ .addClass("field-validation-valid")
+ .removeClass("field-validation-error")
+ .removeData("unobtrusiveContainer")
+ .find(">*") // If we were using valmsg-replace, get the underlying error
+ .removeData("unobtrusiveContainer");
+ }
+
+ function validationInfo(form) {
+ var $form = $(form),
+ result = $form.data(data_validation),
+ onResetProxy = $.proxy(onReset, form),
+ defaultOptions = $jQval.unobtrusive.options || {},
+ execInContext = function (name, args) {
+ var func = defaultOptions[name];
+ func && $.isFunction(func) && func.apply(form, args);
+ };
+
+ if (!result) {
+ result = {
+ options: { // options structure passed to jQuery Validate's validate() method
+ errorClass: defaultOptions.errorClass || "input-validation-error",
+ errorElement: defaultOptions.errorElement || "span",
+ errorPlacement: function () {
+ onError.apply(form, arguments);
+ execInContext("errorPlacement", arguments);
+ },
+ invalidHandler: function () {
+ onErrors.apply(form, arguments);
+ execInContext("invalidHandler", arguments);
+ },
+ messages: {},
+ rules: {},
+ success: function () {
+ onSuccess.apply(form, arguments);
+ execInContext("success", arguments);
+ }
+ },
+ attachValidation: function () {
+ $form
+ .off("reset." + data_validation, onResetProxy)
+ .on("reset." + data_validation, onResetProxy)
+ .validate(this.options);
+ },
+ validate: function () { // a validation function that is called by unobtrusive Ajax
+ $form.validate();
+ return $form.valid();
+ }
+ };
+ $form.data(data_validation, result);
+ }
+
+ return result;
+ }
+
+ $jQval.unobtrusive = {
+ adapters: [],
+
+ parseElement: function (element, skipAttach) {
+ ///
+ /// Parses a single HTML element for unobtrusive validation attributes.
+ ///
+ /// The HTML element to be parsed.
+ /// [Optional] true to skip attaching the
+ /// validation to the form. If parsing just this single element, you should specify true.
+ /// If parsing several elements, you should specify false, and manually attach the validation
+ /// to the form when you are finished. The default is false.
+ var $element = $(element),
+ form = $element.parents("form")[0],
+ valInfo, rules, messages;
+
+ if (!form) { // Cannot do client-side validation without a form
+ return;
+ }
+
+ valInfo = validationInfo(form);
+ valInfo.options.rules[element.name] = rules = {};
+ valInfo.options.messages[element.name] = messages = {};
+
+ $.each(this.adapters, function () {
+ var prefix = "data-val-" + this.name,
+ message = $element.attr(prefix),
+ paramValues = {};
+
+ if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy)
+ prefix += "-";
+
+ $.each(this.params, function () {
+ paramValues[this] = $element.attr(prefix + this);
+ });
+
+ this.adapt({
+ element: element,
+ form: form,
+ message: message,
+ params: paramValues,
+ rules: rules,
+ messages: messages
+ });
+ }
+ });
+
+ $.extend(rules, { "__dummy__": true });
+
+ if (!skipAttach) {
+ valInfo.attachValidation();
+ }
+ },
+
+ parse: function (selector) {
+ ///
+ /// Parses all the HTML elements in the specified selector. It looks for input elements decorated
+ /// with the [data-val=true] attribute value and enables validation according to the data-val-*
+ /// attribute values.
+ ///
+ /// Any valid jQuery selector.
+
+ // $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one
+ // element with data-val=true
+ var $selector = $(selector),
+ $forms = $selector.parents()
+ .addBack()
+ .filter("form")
+ .add($selector.find("form"))
+ .has("[data-val=true]");
+
+ $selector.find("[data-val=true]").each(function () {
+ $jQval.unobtrusive.parseElement(this, true);
+ });
+
+ $forms.each(function () {
+ var info = validationInfo(this);
+ if (info) {
+ info.attachValidation();
+ }
+ });
+ }
+ };
+
+ adapters = $jQval.unobtrusive.adapters;
+
+ adapters.add = function (adapterName, params, fn) {
+ /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.
+ /// The name of the adapter to be added. This matches the name used
+ /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).
+ /// [Optional] An array of parameter names (strings) that will
+ /// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and
+ /// mmmm is the parameter name).
+ /// The function to call, which adapts the values from the HTML
+ /// attributes into jQuery Validate rules and/or messages.
+ ///
+ if (!fn) { // Called with no params, just a function
+ fn = params;
+ params = [];
+ }
+ this.push({ name: adapterName, params: params, adapt: fn });
+ return this;
+ };
+
+ adapters.addBool = function (adapterName, ruleName) {
+ /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
+ /// the jQuery Validate validation rule has no parameter values.
+ /// The name of the adapter to be added. This matches the name used
+ /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).
+ /// [Optional] The name of the jQuery Validate rule. If not provided, the value
+ /// of adapterName will be used instead.
+ ///
+ return this.add(adapterName, function (options) {
+ setValidationValues(options, ruleName || adapterName, true);
+ });
+ };
+
+ adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) {
+ /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
+ /// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and
+ /// one for min-and-max). The HTML parameters are expected to be named -min and -max.
+ /// The name of the adapter to be added. This matches the name used
+ /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).
+ /// The name of the jQuery Validate rule to be used when you only
+ /// have a minimum value.
+ /// The name of the jQuery Validate rule to be used when you only
+ /// have a maximum value.
+ /// The name of the jQuery Validate rule to be used when you
+ /// have both a minimum and maximum value.
+ /// [Optional] The name of the HTML attribute that
+ /// contains the minimum value. The default is "min".
+ /// [Optional] The name of the HTML attribute that
+ /// contains the maximum value. The default is "max".
+ ///
+ return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) {
+ var min = options.params.min,
+ max = options.params.max;
+
+ if (min && max) {
+ setValidationValues(options, minMaxRuleName, [min, max]);
+ }
+ else if (min) {
+ setValidationValues(options, minRuleName, min);
+ }
+ else if (max) {
+ setValidationValues(options, maxRuleName, max);
+ }
+ });
+ };
+
+ adapters.addSingleVal = function (adapterName, attribute, ruleName) {
+ /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
+ /// the jQuery Validate validation rule has a single value.
+ /// The name of the adapter to be added. This matches the name used
+ /// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).
+ /// [Optional] The name of the HTML attribute that contains the value.
+ /// The default is "val".
+ /// [Optional] The name of the jQuery Validate rule. If not provided, the value
+ /// of adapterName will be used instead.
+ ///
+ return this.add(adapterName, [attribute || "val"], function (options) {
+ setValidationValues(options, ruleName || adapterName, options.params[attribute]);
+ });
+ };
+
+ $jQval.addMethod("__dummy__", function (value, element, params) {
+ return true;
+ });
+
+ $jQval.addMethod("regex", function (value, element, params) {
+ var match;
+ if (this.optional(element)) {
+ return true;
+ }
+
+ match = new RegExp(params).exec(value);
+ return (match && (match.index === 0) && (match[0].length === value.length));
+ });
+
+ $jQval.addMethod("nonalphamin", function (value, element, nonalphamin) {
+ var match;
+ if (nonalphamin) {
+ match = value.match(/\W/g);
+ match = match && match.length >= nonalphamin;
+ }
+ return match;
+ });
+
+ if ($jQval.methods.extension) {
+ adapters.addSingleVal("accept", "mimtype");
+ adapters.addSingleVal("extension", "extension");
+ } else {
+ // for backward compatibility, when the 'extension' validation method does not exist, such as with versions
+ // of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for
+ // validating the extension, and ignore mime-type validations as they are not supported.
+ adapters.addSingleVal("extension", "extension", "accept");
+ }
+
+ adapters.addSingleVal("regex", "pattern");
+ adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");
+ adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range");
+ adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength");
+ adapters.add("equalto", ["other"], function (options) {
+ var prefix = getModelPrefix(options.element.name),
+ other = options.params.other,
+ fullOtherName = appendModelPrefix(other, prefix),
+ element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
+
+ setValidationValues(options, "equalTo", element);
+ });
+ adapters.add("required", function (options) {
+ // jQuery Validate equates "required" with "mandatory" for checkbox elements
+ if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") {
+ setValidationValues(options, "required", true);
+ }
+ });
+ adapters.add("remote", ["url", "type", "additionalfields"], function (options) {
+ var value = {
+ url: options.params.url,
+ type: options.params.type || "GET",
+ data: {}
+ },
+ prefix = getModelPrefix(options.element.name);
+
+ $.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
+ var paramName = appendModelPrefix(fieldName, prefix);
+ value.data[paramName] = function () {
+ var field = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']");
+ // For checkboxes and radio buttons, only pick up values from checked fields.
+ if (field.is(":checkbox")) {
+ return field.filter(":checked").val() || field.filter(":hidden").val() || '';
+ }
+ else if (field.is(":radio")) {
+ return field.filter(":checked").val() || '';
+ }
+ return field.val();
+ };
+ });
+
+ setValidationValues(options, "remote", value);
+ });
+ adapters.add("password", ["min", "nonalphamin", "regex"], function (options) {
+ if (options.params.min) {
+ setValidationValues(options, "minlength", options.params.min);
+ }
+ if (options.params.nonalphamin) {
+ setValidationValues(options, "nonalphamin", options.params.nonalphamin);
+ }
+ if (options.params.regex) {
+ setValidationValues(options, "regex", options.params.regex);
+ }
+ });
+ adapters.add("fileextensions", ["extensions"], function (options) {
+ setValidationValues(options, "extension", options.params.extensions);
+ });
+
+ $(function () {
+ $jQval.unobtrusive.parse(document);
+ });
+
+ return $jQval.unobtrusive;
+}));
diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/toastui-editor-all.min.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/toastui-editor-all.min.js
index 9803b8d7a0..19621a6860 100644
--- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/toastui-editor-all.min.js
+++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/toastui-editor-all.min.js
@@ -1,24 +1,24 @@
-/*!
- * @toast-ui/editor
- * @version 3.1.2 | Mon Dec 27 2021
- * @author NHN FE Development Lab
- * @license MIT
- */
-!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.toastui=e():(t.toastui=t.toastui||{},t.toastui.Editor=e())}(self,(function(){return function(){var t={368:function(t){
-/*! @license DOMPurify 2.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.3/LICENSE */
-t.exports=function(){"use strict";function t(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e1?n-1:0),o=1;o/gm),j=a(/^data-[\-\w.\u00B7-\uFFFF]/),_=a(/^aria-[\-\w]+$/),q=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),V=a(/^(?:\w+script|data):/i),$=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function W(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:J(),e=function(t){return K(t)};if(e.version="2.3.3",e.removed=[],!t||!t.document||9!==t.document.nodeType)return e.isSupported=!1,e;var n=t.document,r=t.document,o=t.DocumentFragment,i=t.HTMLTemplateElement,a=t.Node,c=t.Element,l=t.NodeFilter,u=t.NamedNodeMap,p=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,x=t.Text,C=t.Comment,Z=t.DOMParser,X=t.trustedTypes,Q=c.prototype,Y=S(Q,"cloneNode"),tt=S(Q,"nextSibling"),et=S(Q,"childNodes"),nt=S(Q,"parentNode");if("function"==typeof i){var rt=r.createElement("template");rt.content&&rt.content.ownerDocument&&(r=rt.content.ownerDocument)}var ot=G(X,n),it=ot&&Ft?ot.createHTML(""):"",st=r,at=st.implementation,ct=st.createNodeIterator,lt=st.createDocumentFragment,ut=st.getElementsByTagName,pt=n.importNode,dt={};try{dt=M(r).documentMode?r.documentMode:{}}catch(t){}var ft={};e.isSupported="function"==typeof nt&&at&&void 0!==at.createHTMLDocument&&9!==dt;var ht=H,mt=z,vt=j,gt=_,yt=V,bt=$,wt=q,kt=null,xt=T({},[].concat(W(E),W(N),W(O),W(A),W(I))),Ct=null,Tt=T({},[].concat(W(R),W(P),W(B),W(F))),Mt=null,St=null,Et=!0,Nt=!0,Ot=!1,Dt=!1,At=!1,Lt=!1,It=!1,Rt=!1,Pt=!1,Bt=!0,Ft=!1,Ht=!0,zt=!0,jt=!1,_t={},qt=null,Vt=T({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),$t=null,Ut=T({},["audio","video","img","source","image","track"]),Wt=null,Jt=T({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Gt="http://www.w3.org/1998/Math/MathML",Kt="http://www.w3.org/2000/svg",Zt="http://www.w3.org/1999/xhtml",Xt=Zt,Qt=!1,Yt=void 0,te=["application/xhtml+xml","text/html"],ee="text/html",ne=void 0,re=null,oe=r.createElement("form"),ie=function(t){re&&re===t||(t&&"object"===(void 0===t?"undefined":U(t))||(t={}),t=M(t),kt="ALLOWED_TAGS"in t?T({},t.ALLOWED_TAGS):xt,Ct="ALLOWED_ATTR"in t?T({},t.ALLOWED_ATTR):Tt,Wt="ADD_URI_SAFE_ATTR"in t?T(M(Jt),t.ADD_URI_SAFE_ATTR):Jt,$t="ADD_DATA_URI_TAGS"in t?T(M(Ut),t.ADD_DATA_URI_TAGS):Ut,qt="FORBID_CONTENTS"in t?T({},t.FORBID_CONTENTS):Vt,Mt="FORBID_TAGS"in t?T({},t.FORBID_TAGS):{},St="FORBID_ATTR"in t?T({},t.FORBID_ATTR):{},_t="USE_PROFILES"in t&&t.USE_PROFILES,Et=!1!==t.ALLOW_ARIA_ATTR,Nt=!1!==t.ALLOW_DATA_ATTR,Ot=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Dt=t.SAFE_FOR_TEMPLATES||!1,At=t.WHOLE_DOCUMENT||!1,Rt=t.RETURN_DOM||!1,Pt=t.RETURN_DOM_FRAGMENT||!1,Bt=!1!==t.RETURN_DOM_IMPORT,Ft=t.RETURN_TRUSTED_TYPE||!1,It=t.FORCE_BODY||!1,Ht=!1!==t.SANITIZE_DOM,zt=!1!==t.KEEP_CONTENT,jt=t.IN_PLACE||!1,wt=t.ALLOWED_URI_REGEXP||wt,Xt=t.NAMESPACE||Zt,Yt=Yt=-1===te.indexOf(t.PARSER_MEDIA_TYPE)?ee:t.PARSER_MEDIA_TYPE,ne="application/xhtml+xml"===Yt?function(t){return t}:m,Dt&&(Nt=!1),Pt&&(Rt=!0),_t&&(kt=T({},[].concat(W(I))),Ct=[],!0===_t.html&&(T(kt,E),T(Ct,R)),!0===_t.svg&&(T(kt,N),T(Ct,P),T(Ct,F)),!0===_t.svgFilters&&(T(kt,O),T(Ct,P),T(Ct,F)),!0===_t.mathMl&&(T(kt,A),T(Ct,B),T(Ct,F))),t.ADD_TAGS&&(kt===xt&&(kt=M(kt)),T(kt,t.ADD_TAGS)),t.ADD_ATTR&&(Ct===Tt&&(Ct=M(Ct)),T(Ct,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&T(Wt,t.ADD_URI_SAFE_ATTR),t.FORBID_CONTENTS&&(qt===Vt&&(qt=M(qt)),T(qt,t.FORBID_CONTENTS)),zt&&(kt["#text"]=!0),At&&T(kt,["html","head","body"]),kt.table&&(T(kt,["tbody"]),delete Mt.tbody),s&&s(t),re=t)},se=T({},["mi","mo","mn","ms","mtext"]),ae=T({},["foreignobject","desc","title","annotation-xml"]),ce=T({},N);T(ce,O),T(ce,D);var le=T({},A);T(le,L);var ue=function(t){var e=nt(t);e&&e.tagName||(e={namespaceURI:Zt,tagName:"template"});var n=m(t.tagName),r=m(e.tagName);if(t.namespaceURI===Kt)return e.namespaceURI===Zt?"svg"===n:e.namespaceURI===Gt?"svg"===n&&("annotation-xml"===r||se[r]):Boolean(ce[n]);if(t.namespaceURI===Gt)return e.namespaceURI===Zt?"math"===n:e.namespaceURI===Kt?"math"===n&&ae[r]:Boolean(le[n]);if(t.namespaceURI===Zt){if(e.namespaceURI===Kt&&!ae[r])return!1;if(e.namespaceURI===Gt&&!se[r])return!1;var o=T({},["title","style","font","a","script"]);return!le[n]&&(o[n]||!ce[n])}return!1},pe=function(t){h(e.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=it}catch(e){t.remove()}}},de=function(t,n){try{h(e.removed,{attribute:n.getAttributeNode(t),from:n})}catch(t){h(e.removed,{attribute:null,from:n})}if(n.removeAttribute(t),"is"===t&&!Ct[t])if(Rt||Pt)try{pe(n)}catch(t){}else try{n.setAttribute(t,"")}catch(t){}},fe=function(t){var e=void 0,n=void 0;if(It)t=""+t;else{var o=v(t,/^[\r\n\t ]+/);n=o&&o[0]}"application/xhtml+xml"===Yt&&(t=''+t+"");var i=ot?ot.createHTML(t):t;if(Xt===Zt)try{e=(new Z).parseFromString(i,Yt)}catch(t){}if(!e||!e.documentElement){e=at.createDocument(Xt,"template",null);try{e.documentElement.innerHTML=Qt?"":i}catch(t){}}var s=e.body||e.documentElement;return t&&n&&s.insertBefore(r.createTextNode(n),s.childNodes[0]||null),Xt===Zt?ut.call(e,At?"html":"body")[0]:At?e.documentElement:s},he=function(t){return ct.call(t.ownerDocument||t,t,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT,null,!1)},me=function(t){return!(t instanceof x||t instanceof C||"string"==typeof t.nodeName&&"string"==typeof t.textContent&&"function"==typeof t.removeChild&&t.attributes instanceof p&&"function"==typeof t.removeAttribute&&"function"==typeof t.setAttribute&&"string"==typeof t.namespaceURI&&"function"==typeof t.insertBefore)},ve=function(t){return"object"===(void 0===a?"undefined":U(a))?t instanceof a:t&&"object"===(void 0===t?"undefined":U(t))&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},ge=function(t,n,r){ft[t]&&d(ft[t],(function(t){t.call(e,n,r,re)}))},ye=function(t){var n=void 0;if(ge("beforeSanitizeElements",t,null),me(t))return pe(t),!0;if(v(t.nodeName,/[\u0080-\uFFFF]/))return pe(t),!0;var r=ne(t.nodeName);if(ge("uponSanitizeElement",t,{tagName:r,allowedTags:kt}),!ve(t.firstElementChild)&&(!ve(t.content)||!ve(t.content.firstElementChild))&&w(/<[/\w]/g,t.innerHTML)&&w(/<[/\w]/g,t.textContent))return pe(t),!0;if("select"===r&&w(/=0;--s)o.insertBefore(Y(i[s],!0),tt(t))}return pe(t),!0}return t instanceof c&&!ue(t)?(pe(t),!0):"noscript"!==r&&"noembed"!==r||!w(/<\/no(script|embed)/i,t.innerHTML)?(Dt&&3===t.nodeType&&(n=t.textContent,n=g(n,ht," "),n=g(n,mt," "),t.textContent!==n&&(h(e.removed,{element:t.cloneNode()}),t.textContent=n)),ge("afterSanitizeElements",t,null),!1):(pe(t),!0)},be=function(t,e,n){if(Ht&&("id"===e||"name"===e)&&(n in r||n in oe))return!1;if(Nt&&!St[e]&&w(vt,e));else if(Et&&w(gt,e));else{if(!Ct[e]||St[e])return!1;if(Wt[e]);else if(w(wt,g(n,bt,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==y(n,"data:")||!$t[t])if(Ot&&!w(yt,g(n,bt,"")));else if(n)return!1}return!0},we=function(t){var n=void 0,r=void 0,o=void 0,i=void 0;ge("beforeSanitizeAttributes",t,null);var s=t.attributes;if(s){var a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ct};for(i=s.length;i--;){var c=n=s[i],l=c.name,u=c.namespaceURI;if(r=b(n.value),o=ne(l),a.attrName=o,a.attrValue=r,a.keepAttr=!0,a.forceKeepAttr=void 0,ge("uponSanitizeAttribute",t,a),r=a.attrValue,!a.forceKeepAttr&&(de(l,t),a.keepAttr))if(w(/\/>/i,r))de(l,t);else{Dt&&(r=g(r,ht," "),r=g(r,mt," "));var p=ne(t.nodeName);if(be(p,o,r))try{u?t.setAttributeNS(u,l,r):t.setAttribute(l,r),f(e.removed)}catch(t){}}}ge("afterSanitizeAttributes",t,null)}},ke=function t(e){var n=void 0,r=he(e);for(ge("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)ge("uponSanitizeShadowNode",n,null),ye(n)||(n.content instanceof o&&t(n.content),we(n));ge("afterSanitizeShadowDOM",e,null)};return e.sanitize=function(r,i){var s=void 0,c=void 0,l=void 0,u=void 0,p=void 0;if((Qt=!r)&&(r="\x3c!--\x3e"),"string"!=typeof r&&!ve(r)){if("function"!=typeof r.toString)throw k("toString is not a function");if("string"!=typeof(r=r.toString()))throw k("dirty is not a string, aborting")}if(!e.isSupported){if("object"===U(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof r)return t.toStaticHTML(r);if(ve(r))return t.toStaticHTML(r.outerHTML)}return r}if(Lt||ie(i),e.removed=[],"string"==typeof r&&(jt=!1),jt);else if(r instanceof a)1===(c=(s=fe("\x3c!----\x3e")).ownerDocument.importNode(r,!0)).nodeType&&"BODY"===c.nodeName||"HTML"===c.nodeName?s=c:s.appendChild(c);else{if(!Rt&&!Dt&&!At&&-1===r.indexOf("<"))return ot&&Ft?ot.createHTML(r):r;if(!(s=fe(r)))return Rt?null:it}s&&It&&pe(s.firstChild);for(var d=he(jt?r:s);l=d.nextNode();)3===l.nodeType&&l===u||ye(l)||(l.content instanceof o&&ke(l.content),we(l),u=l);if(u=null,jt)return r;if(Rt){if(Pt)for(p=lt.call(s.ownerDocument);s.firstChild;)p.appendChild(s.firstChild);else p=s;return Bt&&(p=pt.call(n,p,!0)),p}var f=At?s.outerHTML:s.innerHTML;return Dt&&(f=g(f,ht," "),f=g(f,mt," ")),ot&&Ft?ot.createHTML(f):f},e.setConfig=function(t){ie(t),Lt=!0},e.clearConfig=function(){re=null,Lt=!1},e.isValidAttribute=function(t,e,n){re||ie({});var r=ne(t),o=ne(e);return be(r,o,n)},e.addHook=function(t,e){"function"==typeof e&&(ft[t]=ft[t]||[],h(ft[t],e))},e.removeHook=function(t){ft[t]&&f(ft[t])},e.removeHooks=function(t){ft[t]&&(ft[t]=[])},e.removeAllHooks=function(){ft={}},e}return K()}()},928:function(t,e,n){"use strict";var r=n(322);t.exports=function(t,e,n){var o,i;if(n=n||0,!r(e))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(e,t,n);for(i=e.length,o=n;n>=0&&o-1)}},471:function(t,e,n){"use strict";var r=n(928),o=n(990),i=Element.prototype,s=i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(t){var e=this.document||this.ownerDocument;return r(this,o(e.querySelectorAll(t)))>-1};t.exports=function(t,e){return s.call(t,e)}},462:function(t,e,n){"use strict";var r=n(893),o=n(928),i=n(902),s=n(24);t.exports=function(t){var e,n,a=Array.prototype.slice.call(arguments,1),c=t.classList;c?r(a,(function(t){c.remove(t)})):(e=i(t).split(/\s+/),n=[],r(e,(function(t){o(t,a)<0&&n.push(t)})),s(t,n))}},969:function(t){"use strict";t.exports=function(t,e){var n,r,o,i,s=Object.prototype.hasOwnProperty;for(o=1,i=arguments.length;o6048e5}(s)||(window.localStorage.setItem(i,(new Date).getTime()),setTimeout((function(){"interactive"!==document.readyState&&"complete"!==document.readyState||o("https://www.google-analytics.com/collect",{v:1,t:"event",tid:e,cid:n,dp:n,dh:t,el:t,ec:"use"})}),1e3)))}},516:function(t){"use strict";t.exports=function(t,e){var n,r;return e=e||0,function(){r=Array.prototype.slice.call(arguments),window.clearTimeout(n),n=window.setTimeout((function(){t.apply(null,r)}),e)}}},423:function(t,e,n){"use strict";var r=n(516);t.exports=function(t,e){var n,o,i,s,a=!0,c=function(e){t.apply(null,e),n=null};function l(){if(s=Array.prototype.slice.call(arguments),a)return c(s),void(a=!1);i=Number(new Date),n=n||i,o(s),i-n>=e&&c(s)}return o=r(c,e=e||0),l.reset=function(){a=!0,n=null},l}},322:function(t){"use strict";t.exports=function(t){return t instanceof Array}},326:function(t){"use strict";t.exports=function(t){return"boolean"==typeof t||t instanceof Boolean}},65:function(t,e,n){"use strict";var r=n(929),o=n(934);t.exports=function(t){return!r(t)&&!o(t)}},404:function(t,e,n){"use strict";var r=n(790);t.exports=function(t){return!r(t)}},294:function(t){"use strict";t.exports=function(t){return t instanceof Function}},934:function(t){"use strict";t.exports=function(t){return null===t}},321:function(t){"use strict";t.exports=function(t){return"number"==typeof t||t instanceof Number}},73:function(t){"use strict";t.exports=function(t){return t===Object(t)}},758:function(t){"use strict";t.exports=function(t){return"string"==typeof t||t instanceof String}},790:function(t,e,n){"use strict";var r=n(65);t.exports=function(t){return r(t)&&!1!==t}},929:function(t){"use strict";t.exports=function(t){return void 0===t}}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var r={};return function(){"use strict";n.d(r,{default:function(){return Lg}});
-/*! *****************************************************************************
-Copyright (c) Microsoft Corporation.
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-***************************************************************************** */
+/*!
+ * @toast-ui/editor
+ * @version 3.1.2 | Mon Dec 27 2021
+ * @author NHN FE Development Lab
+ * @license MIT
+ */
+!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.toastui=e():(t.toastui=t.toastui||{},t.toastui.Editor=e())}(self,(function(){return function(){var t={368:function(t){
+/*! @license DOMPurify 2.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.3/LICENSE */
+t.exports=function(){"use strict";function t(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e1?n-1:0),o=1;o/gm),j=a(/^data-[\-\w.\u00B7-\uFFFF]/),_=a(/^aria-[\-\w]+$/),q=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),V=a(/^(?:\w+script|data):/i),$=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function W(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:J(),e=function(t){return K(t)};if(e.version="2.3.3",e.removed=[],!t||!t.document||9!==t.document.nodeType)return e.isSupported=!1,e;var n=t.document,r=t.document,o=t.DocumentFragment,i=t.HTMLTemplateElement,a=t.Node,c=t.Element,l=t.NodeFilter,u=t.NamedNodeMap,p=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,x=t.Text,C=t.Comment,Z=t.DOMParser,X=t.trustedTypes,Q=c.prototype,Y=S(Q,"cloneNode"),tt=S(Q,"nextSibling"),et=S(Q,"childNodes"),nt=S(Q,"parentNode");if("function"==typeof i){var rt=r.createElement("template");rt.content&&rt.content.ownerDocument&&(r=rt.content.ownerDocument)}var ot=G(X,n),it=ot&&Ft?ot.createHTML(""):"",st=r,at=st.implementation,ct=st.createNodeIterator,lt=st.createDocumentFragment,ut=st.getElementsByTagName,pt=n.importNode,dt={};try{dt=M(r).documentMode?r.documentMode:{}}catch(t){}var ft={};e.isSupported="function"==typeof nt&&at&&void 0!==at.createHTMLDocument&&9!==dt;var ht=H,mt=z,vt=j,gt=_,yt=V,bt=$,wt=q,kt=null,xt=T({},[].concat(W(E),W(N),W(O),W(A),W(I))),Ct=null,Tt=T({},[].concat(W(R),W(P),W(B),W(F))),Mt=null,St=null,Et=!0,Nt=!0,Ot=!1,Dt=!1,At=!1,Lt=!1,It=!1,Rt=!1,Pt=!1,Bt=!0,Ft=!1,Ht=!0,zt=!0,jt=!1,_t={},qt=null,Vt=T({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),$t=null,Ut=T({},["audio","video","img","source","image","track"]),Wt=null,Jt=T({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Gt="http://www.w3.org/1998/Math/MathML",Kt="http://www.w3.org/2000/svg",Zt="http://www.w3.org/1999/xhtml",Xt=Zt,Qt=!1,Yt=void 0,te=["application/xhtml+xml","text/html"],ee="text/html",ne=void 0,re=null,oe=r.createElement("form"),ie=function(t){re&&re===t||(t&&"object"===(void 0===t?"undefined":U(t))||(t={}),t=M(t),kt="ALLOWED_TAGS"in t?T({},t.ALLOWED_TAGS):xt,Ct="ALLOWED_ATTR"in t?T({},t.ALLOWED_ATTR):Tt,Wt="ADD_URI_SAFE_ATTR"in t?T(M(Jt),t.ADD_URI_SAFE_ATTR):Jt,$t="ADD_DATA_URI_TAGS"in t?T(M(Ut),t.ADD_DATA_URI_TAGS):Ut,qt="FORBID_CONTENTS"in t?T({},t.FORBID_CONTENTS):Vt,Mt="FORBID_TAGS"in t?T({},t.FORBID_TAGS):{},St="FORBID_ATTR"in t?T({},t.FORBID_ATTR):{},_t="USE_PROFILES"in t&&t.USE_PROFILES,Et=!1!==t.ALLOW_ARIA_ATTR,Nt=!1!==t.ALLOW_DATA_ATTR,Ot=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Dt=t.SAFE_FOR_TEMPLATES||!1,At=t.WHOLE_DOCUMENT||!1,Rt=t.RETURN_DOM||!1,Pt=t.RETURN_DOM_FRAGMENT||!1,Bt=!1!==t.RETURN_DOM_IMPORT,Ft=t.RETURN_TRUSTED_TYPE||!1,It=t.FORCE_BODY||!1,Ht=!1!==t.SANITIZE_DOM,zt=!1!==t.KEEP_CONTENT,jt=t.IN_PLACE||!1,wt=t.ALLOWED_URI_REGEXP||wt,Xt=t.NAMESPACE||Zt,Yt=Yt=-1===te.indexOf(t.PARSER_MEDIA_TYPE)?ee:t.PARSER_MEDIA_TYPE,ne="application/xhtml+xml"===Yt?function(t){return t}:m,Dt&&(Nt=!1),Pt&&(Rt=!0),_t&&(kt=T({},[].concat(W(I))),Ct=[],!0===_t.html&&(T(kt,E),T(Ct,R)),!0===_t.svg&&(T(kt,N),T(Ct,P),T(Ct,F)),!0===_t.svgFilters&&(T(kt,O),T(Ct,P),T(Ct,F)),!0===_t.mathMl&&(T(kt,A),T(Ct,B),T(Ct,F))),t.ADD_TAGS&&(kt===xt&&(kt=M(kt)),T(kt,t.ADD_TAGS)),t.ADD_ATTR&&(Ct===Tt&&(Ct=M(Ct)),T(Ct,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&T(Wt,t.ADD_URI_SAFE_ATTR),t.FORBID_CONTENTS&&(qt===Vt&&(qt=M(qt)),T(qt,t.FORBID_CONTENTS)),zt&&(kt["#text"]=!0),At&&T(kt,["html","head","body"]),kt.table&&(T(kt,["tbody"]),delete Mt.tbody),s&&s(t),re=t)},se=T({},["mi","mo","mn","ms","mtext"]),ae=T({},["foreignobject","desc","title","annotation-xml"]),ce=T({},N);T(ce,O),T(ce,D);var le=T({},A);T(le,L);var ue=function(t){var e=nt(t);e&&e.tagName||(e={namespaceURI:Zt,tagName:"template"});var n=m(t.tagName),r=m(e.tagName);if(t.namespaceURI===Kt)return e.namespaceURI===Zt?"svg"===n:e.namespaceURI===Gt?"svg"===n&&("annotation-xml"===r||se[r]):Boolean(ce[n]);if(t.namespaceURI===Gt)return e.namespaceURI===Zt?"math"===n:e.namespaceURI===Kt?"math"===n&&ae[r]:Boolean(le[n]);if(t.namespaceURI===Zt){if(e.namespaceURI===Kt&&!ae[r])return!1;if(e.namespaceURI===Gt&&!se[r])return!1;var o=T({},["title","style","font","a","script"]);return!le[n]&&(o[n]||!ce[n])}return!1},pe=function(t){h(e.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=it}catch(e){t.remove()}}},de=function(t,n){try{h(e.removed,{attribute:n.getAttributeNode(t),from:n})}catch(t){h(e.removed,{attribute:null,from:n})}if(n.removeAttribute(t),"is"===t&&!Ct[t])if(Rt||Pt)try{pe(n)}catch(t){}else try{n.setAttribute(t,"")}catch(t){}},fe=function(t){var e=void 0,n=void 0;if(It)t=""+t;else{var o=v(t,/^[\r\n\t ]+/);n=o&&o[0]}"application/xhtml+xml"===Yt&&(t=''+t+"");var i=ot?ot.createHTML(t):t;if(Xt===Zt)try{e=(new Z).parseFromString(i,Yt)}catch(t){}if(!e||!e.documentElement){e=at.createDocument(Xt,"template",null);try{e.documentElement.innerHTML=Qt?"":i}catch(t){}}var s=e.body||e.documentElement;return t&&n&&s.insertBefore(r.createTextNode(n),s.childNodes[0]||null),Xt===Zt?ut.call(e,At?"html":"body")[0]:At?e.documentElement:s},he=function(t){return ct.call(t.ownerDocument||t,t,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT,null,!1)},me=function(t){return!(t instanceof x||t instanceof C||"string"==typeof t.nodeName&&"string"==typeof t.textContent&&"function"==typeof t.removeChild&&t.attributes instanceof p&&"function"==typeof t.removeAttribute&&"function"==typeof t.setAttribute&&"string"==typeof t.namespaceURI&&"function"==typeof t.insertBefore)},ve=function(t){return"object"===(void 0===a?"undefined":U(a))?t instanceof a:t&&"object"===(void 0===t?"undefined":U(t))&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},ge=function(t,n,r){ft[t]&&d(ft[t],(function(t){t.call(e,n,r,re)}))},ye=function(t){var n=void 0;if(ge("beforeSanitizeElements",t,null),me(t))return pe(t),!0;if(v(t.nodeName,/[\u0080-\uFFFF]/))return pe(t),!0;var r=ne(t.nodeName);if(ge("uponSanitizeElement",t,{tagName:r,allowedTags:kt}),!ve(t.firstElementChild)&&(!ve(t.content)||!ve(t.content.firstElementChild))&&w(/<[/\w]/g,t.innerHTML)&&w(/<[/\w]/g,t.textContent))return pe(t),!0;if("select"===r&&w(/=0;--s)o.insertBefore(Y(i[s],!0),tt(t))}return pe(t),!0}return t instanceof c&&!ue(t)?(pe(t),!0):"noscript"!==r&&"noembed"!==r||!w(/<\/no(script|embed)/i,t.innerHTML)?(Dt&&3===t.nodeType&&(n=t.textContent,n=g(n,ht," "),n=g(n,mt," "),t.textContent!==n&&(h(e.removed,{element:t.cloneNode()}),t.textContent=n)),ge("afterSanitizeElements",t,null),!1):(pe(t),!0)},be=function(t,e,n){if(Ht&&("id"===e||"name"===e)&&(n in r||n in oe))return!1;if(Nt&&!St[e]&&w(vt,e));else if(Et&&w(gt,e));else{if(!Ct[e]||St[e])return!1;if(Wt[e]);else if(w(wt,g(n,bt,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==y(n,"data:")||!$t[t])if(Ot&&!w(yt,g(n,bt,"")));else if(n)return!1}return!0},we=function(t){var n=void 0,r=void 0,o=void 0,i=void 0;ge("beforeSanitizeAttributes",t,null);var s=t.attributes;if(s){var a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ct};for(i=s.length;i--;){var c=n=s[i],l=c.name,u=c.namespaceURI;if(r=b(n.value),o=ne(l),a.attrName=o,a.attrValue=r,a.keepAttr=!0,a.forceKeepAttr=void 0,ge("uponSanitizeAttribute",t,a),r=a.attrValue,!a.forceKeepAttr&&(de(l,t),a.keepAttr))if(w(/\/>/i,r))de(l,t);else{Dt&&(r=g(r,ht," "),r=g(r,mt," "));var p=ne(t.nodeName);if(be(p,o,r))try{u?t.setAttributeNS(u,l,r):t.setAttribute(l,r),f(e.removed)}catch(t){}}}ge("afterSanitizeAttributes",t,null)}},ke=function t(e){var n=void 0,r=he(e);for(ge("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)ge("uponSanitizeShadowNode",n,null),ye(n)||(n.content instanceof o&&t(n.content),we(n));ge("afterSanitizeShadowDOM",e,null)};return e.sanitize=function(r,i){var s=void 0,c=void 0,l=void 0,u=void 0,p=void 0;if((Qt=!r)&&(r="\x3c!--\x3e"),"string"!=typeof r&&!ve(r)){if("function"!=typeof r.toString)throw k("toString is not a function");if("string"!=typeof(r=r.toString()))throw k("dirty is not a string, aborting")}if(!e.isSupported){if("object"===U(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof r)return t.toStaticHTML(r);if(ve(r))return t.toStaticHTML(r.outerHTML)}return r}if(Lt||ie(i),e.removed=[],"string"==typeof r&&(jt=!1),jt);else if(r instanceof a)1===(c=(s=fe("\x3c!----\x3e")).ownerDocument.importNode(r,!0)).nodeType&&"BODY"===c.nodeName||"HTML"===c.nodeName?s=c:s.appendChild(c);else{if(!Rt&&!Dt&&!At&&-1===r.indexOf("<"))return ot&&Ft?ot.createHTML(r):r;if(!(s=fe(r)))return Rt?null:it}s&&It&&pe(s.firstChild);for(var d=he(jt?r:s);l=d.nextNode();)3===l.nodeType&&l===u||ye(l)||(l.content instanceof o&&ke(l.content),we(l),u=l);if(u=null,jt)return r;if(Rt){if(Pt)for(p=lt.call(s.ownerDocument);s.firstChild;)p.appendChild(s.firstChild);else p=s;return Bt&&(p=pt.call(n,p,!0)),p}var f=At?s.outerHTML:s.innerHTML;return Dt&&(f=g(f,ht," "),f=g(f,mt," ")),ot&&Ft?ot.createHTML(f):f},e.setConfig=function(t){ie(t),Lt=!0},e.clearConfig=function(){re=null,Lt=!1},e.isValidAttribute=function(t,e,n){re||ie({});var r=ne(t),o=ne(e);return be(r,o,n)},e.addHook=function(t,e){"function"==typeof e&&(ft[t]=ft[t]||[],h(ft[t],e))},e.removeHook=function(t){ft[t]&&f(ft[t])},e.removeHooks=function(t){ft[t]&&(ft[t]=[])},e.removeAllHooks=function(){ft={}},e}return K()}()},928:function(t,e,n){"use strict";var r=n(322);t.exports=function(t,e,n){var o,i;if(n=n||0,!r(e))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(e,t,n);for(i=e.length,o=n;n>=0&&o-1)}},471:function(t,e,n){"use strict";var r=n(928),o=n(990),i=Element.prototype,s=i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(t){var e=this.document||this.ownerDocument;return r(this,o(e.querySelectorAll(t)))>-1};t.exports=function(t,e){return s.call(t,e)}},462:function(t,e,n){"use strict";var r=n(893),o=n(928),i=n(902),s=n(24);t.exports=function(t){var e,n,a=Array.prototype.slice.call(arguments,1),c=t.classList;c?r(a,(function(t){c.remove(t)})):(e=i(t).split(/\s+/),n=[],r(e,(function(t){o(t,a)<0&&n.push(t)})),s(t,n))}},969:function(t){"use strict";t.exports=function(t,e){var n,r,o,i,s=Object.prototype.hasOwnProperty;for(o=1,i=arguments.length;o6048e5}(s)||(window.localStorage.setItem(i,(new Date).getTime()),setTimeout((function(){"interactive"!==document.readyState&&"complete"!==document.readyState||o("https://www.google-analytics.com/collect",{v:1,t:"event",tid:e,cid:n,dp:n,dh:t,el:t,ec:"use"})}),1e3)))}},516:function(t){"use strict";t.exports=function(t,e){var n,r;return e=e||0,function(){r=Array.prototype.slice.call(arguments),window.clearTimeout(n),n=window.setTimeout((function(){t.apply(null,r)}),e)}}},423:function(t,e,n){"use strict";var r=n(516);t.exports=function(t,e){var n,o,i,s,a=!0,c=function(e){t.apply(null,e),n=null};function l(){if(s=Array.prototype.slice.call(arguments),a)return c(s),void(a=!1);i=Number(new Date),n=n||i,o(s),i-n>=e&&c(s)}return o=r(c,e=e||0),l.reset=function(){a=!0,n=null},l}},322:function(t){"use strict";t.exports=function(t){return t instanceof Array}},326:function(t){"use strict";t.exports=function(t){return"boolean"==typeof t||t instanceof Boolean}},65:function(t,e,n){"use strict";var r=n(929),o=n(934);t.exports=function(t){return!r(t)&&!o(t)}},404:function(t,e,n){"use strict";var r=n(790);t.exports=function(t){return!r(t)}},294:function(t){"use strict";t.exports=function(t){return t instanceof Function}},934:function(t){"use strict";t.exports=function(t){return null===t}},321:function(t){"use strict";t.exports=function(t){return"number"==typeof t||t instanceof Number}},73:function(t){"use strict";t.exports=function(t){return t===Object(t)}},758:function(t){"use strict";t.exports=function(t){return"string"==typeof t||t instanceof String}},790:function(t,e,n){"use strict";var r=n(65);t.exports=function(t){return r(t)&&!1!==t}},929:function(t){"use strict";t.exports=function(t){return void 0===t}}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var r={};return function(){"use strict";n.d(r,{default:function(){return Lg}});
+/*! *****************************************************************************
+Copyright (c) Microsoft Corporation.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+***************************************************************************** */
var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var o=function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n>1}},a.from=function(t){if(t instanceof a)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new a(e)};var c=a;function l(t,e,n){for(var r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;var o=t.child(r),i=e.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(var s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){var a=l(o.content,i.content,n+1);if(null!=a)return a}n+=o.nodeSize}else n+=o.nodeSize}}function u(t,e,n,r){for(var o=t.childCount,i=e.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};var s=t.child(--o),a=e.child(--i),c=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){for(var l=0,p=Math.min(s.text.length,a.text.length);l
t&&!1!==n(a,r+s,o,i)&&a.content.size){var l=s+1;a.nodesBetween(Math.max(0,t-l),Math.min(a.content.size,e-l),n,r+l)}s=c}},p.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},p.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+=r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},p.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);ot)for(var o=0,i=0;it&&((ie)&&(s=s.isText?s.cut(Math.max(0,t-i),Math.min(s.text.length,e-i)):s.cut(Math.max(0,t-i-1),Math.min(s.content.size,e-i-1))),n.push(s),r+=s.nodeSize),i=a}return new p(n,r)},p.prototype.cutByIndex=function(t,e){return t==e?p.empty:0==t&&e==this.content.length?this:new p(this.content.slice(t,e))},p.prototype.replaceChild=function(t,e){var n=this.content[t];if(n==e)return this;var r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new p(r,o)},p.prototype.addToStart=function(t){return new p([t].concat(this.content),this.size+t.nodeSize)},p.prototype.addToEnd=function(t){return new p(this.content.concat(t),this.size+t.nodeSize)},p.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;ethis.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=t)return o==t||e>0?h(n+1,o):h(n,r);r=o}},p.prototype.toString=function(){return"<"+this.toStringInner()+">"},p.prototype.toStringInner=function(){return this.content.join(", ")},p.prototype.toJSON=function(){return this.content.length?this.content.map((function(t){return t.toJSON()})):null},p.fromJSON=function(t,e){if(!e)return p.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new p(e.map(t.nodeFromJSON))},p.fromArray=function(t){if(!t.length)return p.empty;for(var e,n=0,r=0;rthis.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e},v.prototype.removeFromSet=function(t){for(var e=0;et.depth)throw new g("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new g("Inconsistent open depths");return C(t,e,n,0)}function C(t,e,n,r){var o=t.index(r),i=t.node(r);if(o==e.index(r)&&r=0;o--)r=e.node(o).copy(p.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return N(i,O(t,a.start,a.end,e,r))}var c=t.parent,l=c.content;return N(c,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}return N(i,D(t,e,r))}function T(t,e){if(!e.type.compatibleContent(t.type))throw new g("Cannot join "+e.type.name+" onto "+t.type.name)}function M(t,e,n){var r=t.node(n);return T(r,e.node(n)),r}function S(t,e){var n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function E(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(S(t.nodeAfter,r),i++));for(var a=i;ao&&M(t,e,o+1),s=r.depth>o&&M(n,r,o+1),a=[];return E(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(T(i,s),S(N(i,O(t,e,n,r,o+1)),a)):(i&&S(N(i,D(t,e,o+1)),a),E(e,n,o,a),s&&S(N(s,D(n,r,o+1)),a)),E(r,null,o,a),new p(a)}function D(t,e,n){var r=[];(E(null,t,n,r),t.depth>n)&&S(N(M(t,e,n+1),D(t,e,n+1)),r);return E(e,null,n,r),new p(r)}b.size.get=function(){return this.content.size-this.openStart-this.openEnd},y.prototype.insertAt=function(t,e){var n=k(this.content,t+this.openStart,e,null);return n&&new y(n,this.openStart,this.openEnd)},y.prototype.removeBetween=function(t,e){return new y(w(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},y.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},y.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},y.prototype.toJSON=function(){if(!this.content.size)return null;var t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},y.fromJSON=function(t,e){if(!e)return y.empty;var n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new y(p.fromJSON(t,e.content),n,r)},y.maxOpen=function(t,e){void 0===e&&(e=!0);for(var n=0,r=0,o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(var i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)r++;return new y(t,n,r)},Object.defineProperties(y.prototype,b),y.empty=new y(p.empty,0,0);var A=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},L={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};A.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},L.parent.get=function(){return this.node(this.depth)},L.doc.get=function(){return this.node(0)},A.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},A.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},A.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},A.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},A.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},A.prototype.before=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]},A.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},L.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},L.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r},L.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},A.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1,o=0;o0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},A.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new B(this,t,n)},A.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},A.prototype.max=function(t){return t.pos>this.pos?t:this},A.prototype.min=function(t){return t.pos=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,l=o-c;if(n.push(i,a,r+c),!l)break;if((i=i.child(a)).isText)break;o=l-1,r+=c+1}return new A(e,n,o)},A.resolveCached=function(t,e){for(var n=0;nt&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},j.isBlock.get=function(){return this.type.isBlock},j.isTextblock.get=function(){return this.type.isTextblock},j.inlineContent.get=function(){return this.type.inlineContent},j.isInline.get=function(){return this.type.isInline},j.isText.get=function(){return this.type.isText},j.isLeaf.get=function(){return this.type.isLeaf},j.isAtom.get=function(){return this.type.isAtom},z.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),q(this.marks,t)},z.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},z.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=p.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var i=this.contentMatchAt(t).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(var a=r;a=0;n--)e=t[n].type.name+"("+e+")";return e}var V=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},$={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};V.parse=function(t,e){var n=new U(t,e);if(null==n.next)return V.empty;var r=J(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=Object.create(null);return n(Y(t,0));function n(r){var o=[];r.forEach((function(e){t[e].forEach((function(e){var n=e.term,r=e.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];Y(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new V(r.indexOf(t.length-1)>-1),s=0;s>1},V.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},V.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(V.prototype,$),V.empty=new V(!0);var U=function(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},W={next:{configurable:!0}};function J(t){var e=[];do{e.push(G(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function G(t){var e=[];do{e.push(K(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function K(t){for(var e=function(t){if(t.eat("(")){var e=J(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=X(t,e)}return e}function Z(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function X(t,e){var n=Z(t),r=n;return t.eat(",")&&(r="}"!=t.next?Z(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Q(t,e){return e-t}function Y(t,e){var n=[];return function e(r){var o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(var i=0;i-1},rt.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e-1};var ct=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=c.from(t.nodes),this.spec.marks=c.from(t.marks),this.nodes=rt.compile(this.spec.nodes,this),this.marks=at.compile(this.spec.marks,this);var n=Object.create(null);for(var r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");var o=this.nodes[r],i=o.spec.content||"",s=o.spec.marks;o.contentMatch=n[i]||(n[i]=V.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet="_"==s?null:s?lt(this,s.split(" ")):""!=s&&o.inlineContent?null:[]}for(var a in this.marks){var l=this.marks[a],u=l.spec.excludes;l.excluded=null==u?[l]:""==u?[]:lt(this,u.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};function lt(t,e){for(var n=[],r=0;r-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}ct.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof rt))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)},ct.prototype.text=function(t,e){var n=this.nodes.text;return new _(n,n.defaultAttrs,t,v.setFrom(e))},ct.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},ct.prototype.nodeFromJSON=function(t){return z.fromJSON(this,t)},ct.prototype.markFromJSON=function(t){return v.fromJSON(this,t)},ct.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var ut=function(t,e){var n=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((function(t){t.tag?n.tags.push(t):t.style&&n.styles.push(t)})),this.normalizeLists=!this.tags.some((function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)}))};ut.prototype.parse=function(t,e){void 0===e&&(e={});var n=new vt(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},ut.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new vt(this,e,!0);return n.addAll(t,null,e.from,e.to),y.maxOpen(n.finish())},ut.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;rt.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var s=i.getAttrs(e);if(!1===s)continue;i.attrs=s}return i}}},ut.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},mt.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;sthis.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},vt.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},vt.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},gt.currentPos.get=function(){this.closeExtra();for(var t=0,e=this.open;e>=0;e--){for(var n=this.nodes[e].content,r=n.length-1;r>=0;r--)t+=n[r].nodeSize;e&&t++}return t},vt.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=function(t,a){for(;t>=0;t--){var c=n[t];if(""==c){if(t==n.length-1||0==t)continue;for(;a>=i;a--)if(s(t-1,a))return!0;return!1}var l=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!l||l.name!=c&&-1==l.groups.indexOf(c))return!1;a--}return!0};return s(n.length-1,this.open)},vt.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}},vt.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;n=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1)r.pendingMarks=t.removeFromSet(r.pendingMarks);else{r.activeMarks=t.removeFromSet(r.activeMarks);var o=r.popFromStashMark(t);o&&r.type&&r.type.allowsMarkType(o.type)&&(r.activeMarks=o.addToSet(r.activeMarks))}if(r==e)break}},Object.defineProperties(vt.prototype,gt);var kt=function(t,e){this.nodes=t||{},this.marks=e||{}};function xt(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ct(t){return t.document||window.document}kt.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=Ct(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},kt.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&kt.renderSpec(Ct(n),r(t,e))},kt.renderSpec=function(t,e,n){if(void 0===n&&(n=null),"string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var i=null,s=n?t.createElementNS(n,r):t.createElement(r),a=e[1],c=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a))for(var l in c=2,a)if(null!=a[l]){var u=l.indexOf(" ");u>0?s.setAttributeNS(l.slice(0,u),l.slice(u+1),a[l]):s.setAttribute(l,a[l])}for(var p=c;pc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var f=kt.renderSpec(t,d,n),h=f.dom,m=f.contentDOM;if(s.appendChild(h),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:s,contentDOM:i}},kt.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new kt(this.nodesFromSchema(t),this.marksFromSchema(t)))},kt.nodesFromSchema=function(t){var e=xt(t.nodes);return e.text||(e.text=function(t){return t.text}),e},kt.marksFromSchema=function(t){return xt(t.marks)};var Tt=n(956),Mt=n.n(Tt),St=n(969),Et=n.n(St),Nt=n(522),Ot=n.n(Nt),Dt=n(204),At=n.n(Dt),Lt=n(462),It=n.n(Lt),Rt=n(758),Pt=n.n(Rt),Bt=n(321),Ft=n.n(Bt),Ht=n(929),zt=n.n(Ht),jt=n(934),_t=n.n(jt),qt=n(391),Vt=n.n(qt),$t=(/Mac/.test(navigator.platform),/[\u0020]+/g),Ut=/[>(){}[\]+-.!#|]/g,Wt=/<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\/>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>||<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g,Jt=/\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g,Gt=/[*_~`]/g,Kt=new RegExp('[&<>"]',"g");function Zt(t){switch(t){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return t}}function Xt(t){return Kt.test(t)?t.replace(Kt,Zt):t}function Qt(t,e){return-1!==t.indexOf(e)}var Yt=["rel","target","hreflang","type"],te={codeblock:/(^ {4}[^\n]+\n*)+/,thematicBreak:/^ *((\* *){3,}|(- *){3,} *|(_ *){3,}) */,atxHeading:/^(#{1,6}) +[\s\S]+/,seTextheading:/^([^\n]+)\n *(=|-){2,} */,blockquote:/^( *>[^\n]+.*)+/,list:/^ *(\*+|-+|\d+\.) [\s\S]+/,def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +["(]([^\n]+)[")])? */,link:/!?\[.*\]\(.*\)/,reflink:/!?\[.*\]\s*\[([^\]]*)\]/,verticalBar:/\u007C/,fencedCodeblock:/^((`|~){3,})/};function ee(t){if(!t)return null;var e={};return Yt.forEach((function(n){zt()(t[n])||(e[n]=t[n])})),e}function ne(t,e){for(var n="",r=0;re?[e,t]:[t,e]}var fe=Math.pow(2,16);function he(t,e){return t+e*fe}function me(t){return 65535&t}var ve=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},ge=function(t,e){void 0===e&&(e=!1),this.ranges=t,this.inverted=e};ge.prototype.recover=function(t){var e=0,n=me(t);if(!this.inverted)for(var r=0;rt)break;var c=this.ranges[s+o],l=this.ranges[s+i],u=a+c;if(t<=u){var p=a+r+((c?t==a?-1:t==u?1:e:e)<0?0:l);if(n)return p;var d=t==(e<0?a:u)?null:he(s/3,t-a);return new ve(p,e<0?t!=a:t!=u,d)}r+=l-c}return n?t+r:new ve(t+r)},ge.prototype.touches=function(t,e){for(var n=0,r=me(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;st)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},ge.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},ye.prototype.invert=function(){var t=new ye;return t.appendMappingInverted(this),t},ye.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;no&&s0},we.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(we.prototype,ke);var Ce=Object.create(null),Te=function(){};Te.prototype.apply=function(t){return xe()},Te.prototype.getMap=function(){return ge.empty},Te.prototype.invert=function(t){return xe()},Te.prototype.map=function(t){return xe()},Te.prototype.merge=function(t){return null},Te.prototype.toJSON=function(){return xe()},Te.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=Ce[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},Te.jsonID=function(t,e){if(t in Ce)throw new RangeError("Duplicate use of step JSON ID "+t);return Ce[t]=e,e.prototype.jsonID=t,e};var Me=function(t,e){this.doc=t,this.failed=e};Me.ok=function(t){return new Me(t,null)},Me.fail=function(t){return new Me(null,t)},Me.fromReplace=function(t,e,n,r){try{return Me.ok(t.replace(e,n,r))}catch(t){if(t instanceof g)return Me.fail(t.message);throw t}};var Se=function(t){function e(e,n,r,o){t.call(this),this.from=e,this.to=n,this.slice=r,this.structure=!!o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){return this.structure&&Ne(t,this.from,this.to)?Me.fail("Structure replace would overwrite content"):Me.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new ge([this.from,this.to-this.from,this.slice.size])},e.prototype.invert=function(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)},e.prototype.merge=function(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;var n=this.slice.size+t.slice.size==0?y.empty:new y(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}var r=this.slice.size+t.slice.size==0?y.empty:new y(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),r,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,y.fromJSON(t,n.slice),!!n.structure)},e}(Te);Te.jsonID("replace",Se);var Ee=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Ne(t,this.from,this.gapFrom)||Ne(t,this.gapTo,this.to)))return Me.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Me.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?Me.fromReplace(t,this.from,this.to,n):Me.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new ge([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},e.prototype.invert=function(t){var n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return n.deleted&&r.deleted||or.pos?null:new e(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(n.from,n.to,n.gapFrom,n.gapTo,y.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(Te);function Ne(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Oe(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function De(t){for(var e=t.parent.content.cutByIndex(t.startIndex,t.endIndex),n=t.depth;;--n){var r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(ni;a--,c--){var l=o.node(a),u=o.index(a);if(l.type.spec.isolating)return!1;var p=l.content.cutByIndex(u,l.childCount),d=r&&r[c]||l;if(d!=l&&(p=p.replaceChild(0,d.type.create(d.attrs))),!l.canReplace(u+1,l.childCount)||!d.type.validContent(p))return!1}var f=o.indexAfter(i),h=r&&r[0];return o.node(i).canReplaceWith(f,f,h?h.type:o.node(i+1).type)}function Ie(t,e){var n=t.resolve(e),r=n.index();return Re(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Re(t,e){return t&&e&&!t.isLeaf&&t.canAppend(e)}function Pe(t,e,n){for(var r=[],o=0;oe;d--)f||n.index(d)>0?(f=!0,l=p.from(n.node(d).copy(l)),u++):a--;for(var h=p.empty,m=0,v=o,g=!1;v>e;v--)g||r.after(v+1)=0;r--)n=p.from(e[r].type.create(e[r].attrs,n));var o=t.start,i=t.end;return this.step(new Ee(o,i,o,i,new y(n,0,0),e.length,!0))},we.prototype.setBlockType=function(t,e,n,r){var o=this;if(void 0===e&&(e=t),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(t,e,(function(t,e){if(t.isTextblock&&!t.hasMarkup(n,r)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(o.doc,o.mapping.slice(i).map(e),n)){o.clearIncompatible(o.mapping.slice(i).map(e,1),n);var s=o.mapping.slice(i),a=s.map(e,1),c=s.map(e+t.nodeSize,1);return o.step(new Ee(a,c,a+1,c-1,new y(p.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},we.prototype.setNodeMarkup=function(t,e,n,r){var o=this.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");e||(e=o.type);var i=e.create(n,null,r||o.marks);if(o.isLeaf)return this.replaceWith(t,t+o.nodeSize,i);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Ee(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new y(p.from(i),0,0),1,!0))},we.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=p.empty,i=p.empty,s=r.depth,a=r.depth-e,c=e-1;s>a;s--,c--){o=p.from(r.node(s).copy(o));var l=n&&n[c];i=p.from(l?l.type.create(l.attrs,i):r.node(s).copy(i))}return this.step(new Se(t,t,new y(o.append(i),e,e),!0))},we.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Se(t-e,t+e,y.empty,!0);return this.step(n)};var Be=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new y(Pe(n.content,(function(t,n){return t.isAtom&&n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t}),o),n.openStart,n.openEnd);return Me.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Fe(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(Te);Te.jsonID("addMark",Be);var Fe=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=new y(Pe(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return Me.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new Be(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(Te);function He(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}Te.jsonID("removeMark",Fe),we.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,l){if(r.isInline){var u=r.marks;if(!n.isInSet(u)&&l.type.allowsMarkType(n.type)){for(var p=Math.max(c,t),d=Math.min(c+r.nodeSize,e),f=n.addToSet(u),h=0;h=0;f--)this.step(o[f]);return this},we.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=y.empty);var r=function(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=y.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);return He(o,i,r)?new Se(e,n,r):new ze(o,i,r).fit()}(this.doc,t,e,n);return r&&this.step(r),this},we.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new y(p.from(n),0,0))},we.prototype.delete=function(t,e){return this.replace(t,e,y.empty)},we.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var ze=function(t,e,n){this.$to=e,this.$from=t,this.unplaced=n,this.frontier=[];for(var r=0;r<=t.depth;r++){var o=t.node(r);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(r))})}this.placed=p.empty;for(var i=t.depth;i>0;i--)this.placed=p.from(t.node(i).copy(this.placed))},je={depth:{configurable:!0}};function _e(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(_e(t.firstChild.content,e-1,n)))}function qe(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(qe(t.lastChild.content,e-1,n)))}function Ve(t,e){for(var n=0;n1&&(r=r.replaceChild(0,$e(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(p.empty,!0)))),t.copy(r)}function Ue(t,e,n,r,o){var i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(var r=n;rr){var s=o.contentMatchAt(0),a=s.fillBefore(t).append(t);t=a.append(s.matchFragment(a).fillBefore(p.empty,!0))}return t}function Je(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(oe.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;o==e.start(r)&&n.push(r)}return n}je.depth.get=function(){return this.frontier.length-1},ze.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;for(var i=this.placed,s=r.depth,a=o.depth;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;var c=new y(i,s,a);return e>-1?new Ee(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Se(r.pos,o.pos,c):void 0},ze.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--)for(var n=void 0,r=(e?(n=Ve(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,o=this.depth;o>=0;o--){var i=this.frontier[o],s=i.type,a=i.match,c=void 0,l=void 0;if(1==t&&(r?a.matchType(r.type)||(l=a.fillBefore(p.from(r),!1)):s.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:o,parent:n,inject:l};if(2==t&&r&&(c=a.findWrapping(r.type)))return{sliceDepth:e,frontierDepth:o,parent:n,wrap:c};if(n&&a.matchType(n.type))break}},ze.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Ve(e,n);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new y(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)},ze.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Ve(e,n);if(o.childCount<=1&&n>0){var i=e.size-n<=n+o.size;this.unplaced=new y(_e(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new y(_e(e,n,1),n,r)},ze.prototype.placeNodes=function(t){for(var e=t.sliceDepth,n=t.frontierDepth,r=t.parent,o=t.inject,i=t.wrap;this.depth>n;)this.closeFrontierNode();if(i)for(var s=0;s1||0==l||b.content.size)&&(h=w,d.push($e(b.mark(m.allowedMarks(b.marks)),1==u?l:0,u==c.childCount?g:-1)))}var k=u==c.childCount;k||(g=-1),this.placed=qe(this.placed,n,p.from(d)),this.frontier[n].match=h,k&&g<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var x=0,C=c;x1&&r==this.$to.end(--n);)++r;return r},ze.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var n=this.frontier[e],r=n.match,o=n.type,i=e=0;a--){var c=this.frontier[a],l=c.match,u=Ue(t,a,c.type,l,!0);if(!u||u.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}},ze.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=qe(this.placed,e.depth,e.fit)),t=e.move;for(var n=e.depth+1;n<=t.depth;n++){var r=t.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,t.index(n));this.openFrontierNode(r.type,r.attrs,o)}return t},ze.prototype.openFrontierNode=function(t,e,n){var r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=qe(this.placed,this.depth,p.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},ze.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(p.empty,!0);t.childCount&&(this.placed=qe(this.placed,this.frontier.length,t))},Object.defineProperties(ze.prototype,je),we.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var r=this.doc.resolve(t),o=this.doc.resolve(e);if(He(r,o,n))return this.step(new Se(t,e,n));var i=Je(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var l=r.node(a).type.spec;if(l.defining||l.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var u=i.indexOf(s),p=[],d=n.openStart,f=n.content,h=0;;h++){var m=f.firstChild;if(p.push(m),h==n.openStart)break;f=m.content}d>0&&p[d-1].type.spec.defining&&r.node(u).type!=p[d-1].type?d-=1:d>=2&&p[d-1].isTextblock&&p[d-2].type.spec.defining&&r.node(u).type!=p[d-2].type&&(d-=2);for(var v=n.openStart;v>=0;v--){var g=(v+d+1)%(n.openStart+1),b=p[g];if(b)for(var w=0;w=0&&(this.replace(t,e,n),!(this.steps.length>M));S--){var E=i[S];S<0||(t=r.before(E),e=o.after(E))}return this},we.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=function(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Ge=Object.create(null),Ke=function(t,e,n){this.ranges=n||[new Xe(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Ze={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Ze.anchor.get=function(){return this.$anchor.pos},Ze.head.get=function(){return this.$head.pos},Ze.from.get=function(){return this.$from.pos},Ze.to.get=function(){return this.$to.pos},Ze.$from.get=function(){return this.ranges[0].$from},Ze.$to.get=function(){return this.ranges[0].$to},Ze.empty.get=function(){for(var t=this.ranges,e=0;e=0;o--){var i=e<0?on(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):on(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},Ke.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new nn(t.node(0))},Ke.atStart=function(t){return on(t,t,0,0,1)||new nn(t)},Ke.atEnd=function(t){return on(t,t,t.content.size,t.childCount,-1)||new nn(t)},Ke.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Ge[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},Ke.jsonID=function(t,e){if(t in Ge)throw new RangeError("Duplicate use of selection JSON ID "+t);return Ge[t]=e,e.prototype.jsonID=t,e},Ke.prototype.getBookmark=function(){return Qe.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(Ke.prototype,Ze),Ke.prototype.visible=!0;var Xe=function(t,e){this.$from=t,this.$to=e},Qe=function(t){function e(e,n){void 0===n&&(n=e),t.call(this,e,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));if(!o.parent.inlineContent)return t.near(o);var i=n.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:o,o)},e.prototype.replace=function(e,n){if(void 0===n&&(n=y.empty),t.prototype.replace.call(this,e,n),n==y.empty){var r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head},e.prototype.getBookmark=function(){return new Ye(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos0?0:1);o>0?s=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&tn.isSelectable(a))return tn.create(t,n-(o<0?a.nodeSize:0))}else{var c=on(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function sn(t,e,n){var r=t.steps.length-1;if(!(r0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return v.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this},e.prototype.addStoredMark=function(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))},e.prototype.removeStoredMark=function(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},e.prototype.addStep=function(e,n){t.prototype.addStep.call(this,e,n),this.updated=-3&this.updated,this.storedMarks=null},e.prototype.setTime=function(t){return this.time=t,this},e.prototype.replaceSelection=function(t){return this.selection.replace(this,t),this},e.prototype.replaceSelectionWith=function(t,e){var n=this.selection;return!1!==e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||v.none))),n.replaceWith(this,t),this},e.prototype.deleteSelection=function(){return this.selection.replace(this),this},e.prototype.insertText=function(t,e,n){void 0===n&&(n=e);var r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();if(!t)return this.deleteRange(e,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(e);o=n==e?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.setSelection(Ke.near(this.selection.$to)),this},e.prototype.setMeta=function(t,e){return this.meta["string"==typeof t?t:t.key]=e,this},e.prototype.getMeta=function(t){return this.meta["string"==typeof t?t:t.key]},n.isGeneric.get=function(){for(var t in this.meta)return!1;return!0},e.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(e.prototype,n),e}(we);function cn(t,e){return e&&t?t.bind(e):t}var ln=function(t,e,n){this.name=t,this.init=cn(e.init,n),this.apply=cn(e.apply,n)},un=[new ln("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new ln("selection",{init:function(t,e){return t.selection||Ke.atStart(e.doc)},apply:function(t){return t.selection}}),new ln("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ln("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],pn=function(t,e){var n=this;this.schema=t,this.fields=un.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new ln(t.key,t.spec.state,t))}))},dn=function(t){this.config=t},fn={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};fn.schema.get=function(){return this.config.schema},fn.plugins.get=function(){return this.config.plugins},dn.prototype.apply=function(t){return this.applyTransaction(t).state},dn.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n-1&&hn.splice(e,1)},Object.defineProperties(dn.prototype,fn);var hn=[];function mn(t,e,n){for(var r in t){var o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=mn(o,e,{})),n[r]=o}return n}var vn=function(t){this.props={},t.props&&mn(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:yn("plugin")};vn.prototype.getState=function(t){return t[this.key]};var gn=Object.create(null);function yn(t){return t in gn?t+"$"+ ++gn[t]:(gn[t]=0,t+"$")}var bn=function(t){void 0===t&&(t="key"),this.key=yn(t)};bn.prototype.get=function(t){return t.config.pluginsByKey[this.key]},bn.prototype.getState=function(t){return t[this.key]};var wn={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var kn=/Edge\/(\d+)/.exec(navigator.userAgent),xn=/MSIE \d/.test(navigator.userAgent),Cn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);wn.mac=/Mac/.test(navigator.platform);var Tn=wn.ie=!!(xn||Cn||kn);wn.ie_version=xn?document.documentMode||6:Cn?+Cn[1]:kn?+kn[1]:null,wn.gecko=!Tn&&/gecko\/(\d+)/i.test(navigator.userAgent),wn.gecko_version=wn.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var Mn=!Tn&&/Chrome\/(\d+)/.exec(navigator.userAgent);wn.chrome=!!Mn,wn.chrome_version=Mn&&+Mn[1],wn.safari=!Tn&&/Apple Computer/.test(navigator.vendor),wn.ios=wn.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),wn.android=/Android \d/.test(navigator.userAgent),wn.webkit="webkitFontSmoothing"in document.documentElement.style,wn.webkit_version=wn.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Sn=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},En=function(t){var e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e},Nn=null,On=function(t,e,n){var r=Nn||(Nn=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},Dn=function(t,e,n,r){return n&&(Ln(t,e,n,r,-1)||Ln(t,e,n,r,1))},An=/^(img|br|input|textarea|hr)$/i;function Ln(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:In(t))){var i=t.parentNode;if(1!=i.nodeType||Rn(t)||An.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Sn(t)+(o<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(o<0?-1:0)]).contentEditable)return!1;e=o<0?In(t):0}}}function In(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Rn(t){for(var e,n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var Pn=function(t){var e=t.isCollapsed;return e&&wn.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function Bn(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Fn(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Hn(t,e){return"number"==typeof t?t:t[e]}function zn(t){var e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function jn(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,s=n||t.dom;s;s=En(s))if(1==s.nodeType){var a=s==i.body||1!=s.nodeType,c=a?Fn(i):zn(s),l=0,u=0;if(e.topc.bottom-Hn(r,"bottom")&&(u=e.bottom-c.bottom+Hn(o,"bottom")),e.leftc.right-Hn(r,"right")&&(l=e.right-c.right+Hn(o,"right")),l||u)if(a)i.defaultView.scrollBy(l,u);else{var p=s.scrollLeft,d=s.scrollTop;u&&(s.scrollTop+=u),l&&(s.scrollLeft+=l);var f=s.scrollLeft-p,h=s.scrollTop-d;e={left:e.left-f,top:e.top-h,right:e.right-f,bottom:e.bottom-h}}if(a)break}}function _n(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=En(t));return e}function qn(t,e){for(var n=0;n=a){s=Math.max(d.bottom,s),a=Math.min(d.top,a);var f=d.left>e.left?d.left-e.left:d.right=(d.left+d.right)/2?1:0));continue}}!n&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(i=l+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,r=document.createRange(),o=0;o=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:$n(n,r)}function Un(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Wn(t,e,n){var r=t.childNodes.length;if(r&&n.tope.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(l=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var s=t.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==l&&(l=function(t,e,n){var r=$n(e,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}(t,u,e));var m=t.docView.nearestDesc(u,!0);return{pos:l,inside:m?m.posAtStart-m.border:-1}}function Gn(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}var Kn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Zn(t,e,n){var r=t.docView.domFromPos(e,n<0?-1:1),o=r.node,i=r.offset,s=wn.webkit||wn.gecko;if(3==o.nodeType){if(!s||!Kn.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var a=i,c=i,l=n<0?1:-1;return n<0&&!i?(c++,l=-1):n>=0&&i==o.nodeValue.length?(a--,l=1):n<0?a--:c++,Xn(Gn(On(o,a,c),l),l<0)}var u=Gn(On(o,i,i),n);if(wn.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i=0)}if(i&&(n<0||i==In(o))){var m=o.childNodes[i-1],v=3==m.nodeType?On(m,In(m)-(s?0:1)):1!=m.nodeType||"BR"==m.nodeName&&m.nextSibling?null:m;if(v)return Xn(Gn(v,1),!1)}if(i=0)}function Xn(t,e){if(0==t.width)return t;var n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Qn(t,e){if(0==t.height)return t;var n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Yn(t,e,n){var r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}var tr=/[\u0590-\u08ac]/;var er=null,nr=null,rr=!1;function or(t,e,n){return er==e&&nr==n?rr:(er=e,nr=n,rr="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$from:r.$to;return Yn(t,e,(function(){for(var e=t.docView.domFromPos(o.pos,"up"==n?-1:1).node;;){var r=t.docView.nearestDesc(e,!0);if(!r)break;if(r.node.isBlock){e=r.dom;break}e=r.dom.parentNode}for(var i=Zn(t,o.pos,1),s=e.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=On(s,0,s.nodeValue.length).getClientRects()}for(var c=0;cl.top&&("up"==n?l.bottomi.bottom-1))return!1}}return!0}))}(t,e,n):function(t,e,n){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=getSelection();return tr.test(r.parent.textContent)&&a.modify?Yn(t,e,(function(){var e=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var c=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(e),null!=s&&(a.caretBidiLevel=s),c})):"left"==n||"backward"==n?i:s}(t,e,n))}var ir=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},sr={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};ir.prototype.matchesWidget=function(){return!1},ir.prototype.matchesMark=function(){return!1},ir.prototype.matchesNode=function(){return!1},ir.prototype.matchesHack=function(){return!1},sr.beforePosition.get=function(){return!1},ir.prototype.parseRule=function(){return null},ir.prototype.stopEvent=function(){return!1},sr.size.get=function(){for(var t=0,e=0;eSn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var c=t;;c=c.parentNode){if(c==this.dom){a=!1;break}if(c.parentNode.firstChild!=c)break}if(null==a&&e==t.childNodes.length)for(var l=t;;l=l.parentNode){if(l==this.dom){a=!0;break}if(l.parentNode.lastChild!=l)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},ir.prototype.nearestDesc=function(t,e){for(var n=!0,r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o&&(!e||o.node)){if(!n||!o.nodeDOM||(1==o.nodeDOM.nodeType?o.nodeDOM.contains(1==t.nodeType?t:t.parentNode):o.nodeDOM==t))return o;n=!1}}},ir.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},ir.prototype.posFromDOM=function(t,e,n){for(var r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}return-1},ir.prototype.descAt=function(t){for(var e=0,n=0;e=t:s>t)&&(s>t||r+1>=this.children.length||!this.children[r+1].beforePosition))return i.domFromPos(t-n-i.border,e);n=s}},ir.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],c=i+a.size;if(-1==r&&t<=c){var l=i+a.border;if(t>=l&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,l);t=i;for(var u=s;u>0;u--){var p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Sn(p.dom)+1;break}t-=p.size}-1==r&&(r=0)}if(r>-1&&(c>e||s==this.children.length-1)){e=c;for(var d=s+1;da&&ie){var b=u;u=p,p=b}var w=document.createRange();w.setEnd(p.node,p.offset),w.setStart(u.node,u.offset),d.removeAllRanges(),d.addRange(w)}}},ir.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},sr.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},ir.prototype.markDirty=function(t,e){for(var n=0,r=0;r=n:tn){var s=n+o.border,a=i-o.border;if(t>=s&&e<=a)return this.dirty=t==n||e==i?2:1,void(t!=s||e!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-s,e-s):o.dirty=3);o.dirty=3}n=i}this.dirty=2},ir.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var n=1==t?2:1;e.dirty0&&(i=Er(i,0,t,r));for(var a=0;ai;)l.push(o[c++]);var y=i+m.nodeSize;if(m.isText){var b=y;c=0&&!a&&s.syncToMarks(i==n.node.childCount?v.none:n.node.child(i).marks,r,t),s.placeWidget(e,t,o)}),(function(e,n,i,a){s.syncToMarks(e.marks,r,t),s.findNodeMatch(e,n,i,a)||s.updateNextNode(e,n,i,t,a)||s.addNode(e,n,i,t,o),o+=e.nodeSize})),s.syncToMarks(ar,r,t),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(i&&this.protectLocalComposition(t,i),vr(this.contentDOM,this.children,t),wn.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))},e.prototype.localCompositionNode=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof Qe)||re+this.node.content.size)){var i=t.root.getSelection(),s=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];e=In(t=t.childNodes[e-1])}else{if(!(1==t.nodeType&&e=n){var u=c.lastIndexOf(e,r-a);if(u>=0&&u+e.length+a>=n)return a+u}}}return-1}(this.node.content,a,r-e,o-e);return c<0?null:{node:s,pos:c,text:a}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,r=e.pos,o=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new lr(this,i,n,o);t.compositionNodes.push(s),this.children=Er(this.children,r,r+o.length,t,s)}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)},e.prototype.updateInner=function(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!Cr(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=wr(this.dom,this.nodeDOM,br(this.outerDeco,this.node,e),br(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=t}},e.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},e.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(e.prototype,n),e}(ir);function dr(t,e,n,r,o){return xr(r,e,t),new pr(null,t,e,n,r,r,r,o,0)}var fr=function(t){function e(e,n,r,o,i,s,a){t.call(this,e,n,r,o,i,null,s,a)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){for(var t=this.nodeDOM.parentNode;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=0,!0)},e.prototype.inParent=function(){for(var t=this.parent.contentDOM,e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1},e.prototype.domFromPos=function(t){return{node:this.nodeDOM,offset:t}},e.prototype.localPosFromDOM=function(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):t.prototype.localPosFromDOM.call(this,e,n,r)},e.prototype.ignoreMutation=function(t){return"characterData"!=t.type&&"selection"!=t.type},e.prototype.slice=function(t,n,r){var o=this.node.cut(t,n),i=document.createTextNode(o.text);return new e(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)},n.domAtom.get=function(){return!1},Object.defineProperties(e.prototype,n),e}(pr),hr=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(){return 0==this.dirty},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(ir),mr=function(t){function e(e,n,r,o,i,s,a,c,l,u){t.call(this,e,n,r,o,i,s,a,l,u),this.spec=c}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&t.prototype.update.call(this,e,n,r,o)},e.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():t.prototype.selectNode.call(this)},e.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():t.prototype.deselectNode.call(this)},e.prototype.setSelection=function(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):t.prototype.setSelection.call(this,e,n,r,o)},e.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),t.prototype.destroy.call(this)},e.prototype.stopEvent=function(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)},e.prototype.ignoreMutation=function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):t.prototype.ignoreMutation.call(this,e)},e}(pr);function vr(t,e,n){for(var r=t.firstChild,o=!1,i=0;i0&&r>0;r--){var i=e[r-1],s=i.node;if(s){if(s!=t.child(n-1))break;--n,o.set(i,n)}}return{index:n,matched:o}}(t.node.content,t.children)};function Sr(t,e){return t.type.side-e.type.side}function Er(t,e,n,r,o){for(var i=[],s=0,a=0;s=n||u<=e?i.push(c):(ln&&i.push(c.slice(n-l,c.size,r)))}return i}function Nr(t,e){var n=t.root.getSelection(),r=t.state.doc;if(!n.focusNode)return null;var o=t.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=t.docView.posFromDOM(n.focusNode,n.focusOffset);if(s<0)return null;var a,c,l=r.resolve(s);if(Pn(n)){for(a=l;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&tn.isSelectable(o.node)&&o.parent&&(!o.node.isInline||!function(t,e,n){for(var r=0==e,o=e==In(t);r||o;){if(t==n)return!0;var i=Sn(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==In(t)}}(n.focusNode,n.focusOffset,o.dom))){var u=o.posBefore;c=new tn(s==u?l:r.resolve(u))}}else{var p=t.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(p<0)return null;a=r.resolve(p)}c||(c=Fr(t,a,l,"pointer"==e||t.state.selection.head>1,i=Math.min(o,t.length);r-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=ur.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}},Mr.prototype.findNodeMatch=function(t,e,n,r){var o=this.top.children,i=-1;if(r>=this.preMatch.index){for(var s=this.index;s0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ke.findFrom(s,e)}function jr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function _r(t,e,n){var r=t.state.selection;if(!(r instanceof Qe)){if(r instanceof tn&&r.node.isInline)return jr(t,new Qe(e>0?r.$to:r.$from));var o=zr(t.state,e);return!!o&&jr(t,o)}if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var i=zr(t.state,e);return!!(i&&i instanceof tn)&&jr(t,i)}if(!(wn.mac&&n.indexOf("m")>-1)){var s,a=r.$head,c=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!c||c.isText)return!1;var l=e<0?a.pos-c.nodeSize:a.pos;return!!(c.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM)&&(tn.isSelectable(c)?jr(t,new tn(e<0?t.state.doc.resolve(a.pos-c.nodeSize):a)):!!wn.webkit&&jr(t,new Qe(t.state.doc.resolve(e<0?l:l+c.nodeSize))))}}function qr(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Vr(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function $r(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,s=!1;for(wn.gecko&&1==n.nodeType&&r0){if(1!=n.nodeType)break;var a=n.childNodes[r-1];if(Vr(a))o=n,i=--r;else{if(3!=a.nodeType)break;r=(n=a).nodeValue.length}}else{if(Wr(n))break;for(var c=n.previousSibling;c&&Vr(c);)o=n.parentNode,i=Sn(c),c=c.previousSibling;if(c)r=qr(n=c);else{if((n=n.parentNode)==t.dom)break;r=0}}s?Jr(t,e,n,r):o&&Jr(t,e,o,i)}}function Ur(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,s=qr(n);;)if(r-1)return!1;if(wn.mac&&n.indexOf("m")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var s=zr(t.state,e);if(s&&s instanceof tn)return jr(t,s)}if(!o.parent.inlineContent){var a=e<0?o:i,c=r instanceof nn?Ke.near(a,e):Ke.findFrom(a,e);return!!c&&jr(t,c)}return!1}function Kr(t,e){if(!(t.state.selection instanceof Qe))return!0;var n=t.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var s=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=t.state.tr;return e<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),t.dispatch(a),!0}return!1}function Zr(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Xr(t,e){var n=e.keyCode,r=function(t){var e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||wn.mac&&72==n&&"c"==r?Kr(t,-1)||$r(t):46==n||wn.mac&&68==n&&"c"==r?Kr(t,1)||Ur(t):13==n||27==n||(37==n?_r(t,-1,r)||$r(t):39==n?_r(t,1,r)||Ur(t):38==n?Gr(t,-1,r)||$r(t):40==n?function(t){if(wn.safari&&!(t.state.selection.$head.parentOffset>0)){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;Zr(t,o,!0),setTimeout((function(){return Zr(t,o,!1)}),20)}}}(t)||Gr(t,1,r)||Ur(t):r==(wn.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Qr(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(wn.safari&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(t.parentNode.lastChild==t||wn.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function Yr(t,e,n,r,o){if(e<0){var i=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,s=Nr(t,i);if(s&&!t.state.selection.eq(s)){var a=t.state.tr.setSelection(s);"pointer"==i?a.setMeta("pointer",!0):"key"==i&&a.scrollIntoView(),t.dispatch(a)}}else{var c=t.state.doc.resolve(e),l=c.sharedDepth(n);e=c.before(l+1),n=t.state.doc.resolve(n).after(l+1);var u=t.state.selection,d=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,c=r.to,l=t.root.getSelection(),u=null,p=l.anchorNode;if(p&&t.dom.contains(1==p.nodeType?p:p.parentNode)&&(u=[{node:p,offset:l.anchorOffset}],Pn(l)||u.push({node:l.focusNode,offset:l.focusOffset})),wn.chrome&&8===t.lastKeyCode)for(var d=s;d>i;d--){var f=o.childNodes[d-1],h=f.pmViewDesc;if("BR"==f.nodeName&&!h){s=d;break}if(!h||h.size)break}var m=t.state.doc,v=t.someProp("domParser")||ut.fromSchema(t.state.schema),g=m.resolve(a),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:!g.parent.type.spec.code||"full",editableContent:!0,findPositions:u,ruleFromNode:Qr,context:g});if(u&&null!=u[0].pos){var w=u[0].pos,k=u[1]&&u[1].pos;null==k&&(k=w),y={anchor:w+a,head:k+a}}return{doc:b,sel:y,from:a,to:c}}(t,e,n);if(wn.chrome&&t.cursorWrapper&&d.sel&&d.sel.anchor==t.cursorWrapper.deco.from){var f=t.cursorWrapper.deco.type.toDOM.nextSibling,h=f&&f.nodeValue?f.nodeValue.length:1;d.sel={anchor:d.sel.anchor+h,head:d.sel.anchor+h}}var m,v,g=t.state.doc,y=g.slice(d.from,d.to);8===t.lastKeyCode&&Date.now()-100=a?i-r:0)+(c-a),a=i}else if(c=c?i-r:0)+(a-c),c=i}return{start:i,endA:a,endB:c}}(y.content,d.doc.content,d.from,m,v);if(!b){if(!(r&&u instanceof Qe&&!u.empty&&u.$head.sameParent(u.$anchor))||t.composing||d.sel&&d.sel.anchor!=d.sel.head){if((wn.ios&&t.lastIOSEnter>Date.now()-225||wn.android)&&o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName}))&&t.someProp("handleKeyDown",(function(e){return e(t,Bn(13,"Enter"))})))return void(t.lastIOSEnter=0);if(d.sel){var w=to(t,t.state.doc,d.sel);w&&!w.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(w))}return}b={start:u.from,endA:u.to,endB:u.to}}t.domChangeCount++,t.state.selection.fromt.state.selection.from&&b.start<=t.state.selection.from+2?b.start=t.state.selection.from:b.endA=t.state.selection.to-2&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),wn.ie&&wn.ie_version<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>d.from&&" "==d.doc.textBetween(b.start-d.from-1,b.start-d.from+1)&&(b.start--,b.endA--,b.endB--);var k,x=d.doc.resolveNoCache(b.start-d.from),C=d.doc.resolveNoCache(b.endB-d.from),T=x.sameParent(C)&&x.parent.inlineContent;if((wn.ios&&t.lastIOSEnter>Date.now()-225&&(!T||o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName})))||!T&&x.posb.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||eo(r,!0,!1)n||eo(s,!0,!1)e.content.size?null:Fr(t,e.resolve(n.anchor),e.resolve(n.head))}function eo(t,e,n){for(var r=t.depth,o=e?t.end():t.pos;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n)for(var i=t.node(r).maybeChild(t.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function no(t,e){for(var n=[],r=e.content,o=e.openStart,i=e.openEnd;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;var s=r.firstChild;n.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),r=s.content}var a=t.someProp("clipboardSerializer")||kt.fromSchema(t.state.schema),c=uo(),l=c.createElement("div");l.appendChild(a.serializeFragment(r,{document:c}));for(var u,p=l.firstChild;p&&1==p.nodeType&&(u=co[p.nodeName.toLowerCase()]);){for(var d=u.length-1;d>=0;d--){for(var f=c.createElement(u[d]);l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f)}p=l.firstChild}return p&&1==p.nodeType&&p.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:l,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function ro(t,e,n,r,o){var i,s,a=o.parent.type.spec.code;if(!n&&!e)return null;var c=e&&(r||a||!n);if(c){if(t.someProp("transformPastedText",(function(t){e=t(e,a||r)})),a)return new y(p.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0);var l=t.someProp("clipboardTextParser",(function(t){return t(e,o,r)}));l?s=l:(i=document.createElement("div"),e.trim().split(/(?:\r\n?|\n)+/).forEach((function(t){i.appendChild(document.createElement("p")).textContent=t})))}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),i=function(t){var e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,r=uo().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);(n=o&&co[o[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return""+t+">"})).reverse().join(""));if(r.innerHTML=t,n)for(var i=0;i=0;a-=2){var c=r.nodes[n[a]];if(!c||c.hasRequiredAttrs())break;o=p.from(c.create(n[a+1],o)),i++,s++}return new y(o,i,s)}(function(t,e,n){e=0;r--){var o=n(r);if(o)return o.v}return t}(s.content,o),!1),t.someProp("transformPasted",(function(t){s=t(s)})),s}function oo(t,e,n){void 0===n&&(n=0);for(var r=e.length-1;r>=n;r--)t=e[r].create(null,p.from(t));return t}function io(t,e,n,r,o){if(o=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,t.childCount>1||i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(p.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}var co={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},lo=null;function uo(){return lo||(lo=document.implementation.createHTMLDocument("title"))}var po={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},fo=wn.ie&&wn.ie_version<=11,ho=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};ho.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},ho.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var mo=function(t,e){var n=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(t){for(var e=0;et.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new ho,fo&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};mo.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){t.flushingSoon=-1,t.flush()}),20))},mo.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},mo.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,po),fo&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},mo.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n-1)){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Hr(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,s=[];if(this.view.editable)for(var a=0;a1){var l=s.filter((function(t){return"BR"==t.nodeName}));if(2==l.length){var u=l[0],p=l[1];u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(t){if(vo)return;vo=!0,"normal"==getComputedStyle(t.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,o,i,s),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||Dr(this.view),this.currentSelection.set(e))}},mo.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(var r=0;ri.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function To(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function Mo(t,e,n,r,o){return Co(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(function(n){return n(t,e,r)}))||(o?function(t,e){if(-1==e)return!1;var n,r,o=t.state.selection;o instanceof tn&&(n=o.node);for(var i=t.state.doc.resolve(e),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(tn.isSelectable(a)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(To(t,tn.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&tn.isSelectable(r))&&(To(t,new tn(n),"pointer"),!0)}(t,n))}function So(t,e,n,r){return Co(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(function(n){return n(t,e,r)}))}function Eo(t,e,n,r){return Co(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(function(n){return n(t,e,r)}))||function(t,e){var n=t.state.doc;if(-1==e)return!!n.inlineContent&&(To(t,Qe.create(n,0,n.content.size),"pointer"),!0);for(var r=n.resolve(e),o=r.depth+1;o>0;o--){var i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)To(t,Qe.create(n,s+1,s+1+i.content.size),"pointer");else{if(!tn.isSelectable(i))continue;To(t,tn.create(n,s),"pointer")}return!0}}(t,n)}function No(t){return Po(t)}yo.keydown=function(t,e){if(t.shiftKey=16==e.keyCode||e.shiftKey,!Ao(t,e))if(t.domObserver.forceFlush(),t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!wn.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey)t.someProp("handleKeyDown",(function(n){return n(t,e)}))||Xr(t,e)?e.preventDefault():bo(t,"key");else{var n=Date.now();t.lastIOSEnter=n,t.lastIOSEnterFallbackTimeout=setTimeout((function(){t.lastIOSEnter==n&&(t.someProp("handleKeyDown",(function(e){return e(t,Bn(13,"Enter"))})),t.lastIOSEnter=0)}),200)}},yo.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},yo.keypress=function(t,e){if(!(Ao(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||wn.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof Qe&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(e.charCode);t.someProp("handleTextInput",(function(e){return e(t,n.$from.pos,n.$to.pos,r)}))||t.dispatch(t.state.tr.insertText(r).scrollIntoView()),e.preventDefault()}}};var Oo=wn.mac?"metaKey":"ctrlKey";go.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=No(t),r=Date.now(),o="singleClick";r-t.lastClick.time<500&&function(t,e){var n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(e,t.lastClick)&&!e[Oo]&&("singleClick"==t.lastClick.type?o="doubleClick":"doubleClick"==t.lastClick.type&&(o="tripleClick")),t.lastClick={time:r,x:e.clientX,y:e.clientY,type:o};var i=t.posAtCoords(xo(e));i&&("singleClick"==o?(t.mouseDown&&t.mouseDown.done(),t.mouseDown=new Do(t,i,e,n)):("doubleClick"==o?So:Eo)(t,i.pos,i.inside,e)?e.preventDefault():bo(t,"pointer"))};var Do=function(t,e,n,r){var o,i,s=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[Oo],this.allowDefault=n.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var a=t.state.doc.resolve(e.pos);o=a.parent,i=a.depth?a.before():0}this.mightDrag=null;var c=r?null:n.target,l=c?t.docView.nearestDesc(c,!0):null;this.target=l?l.dom:null;var u=t.state.selection;(o.type.spec.draggable&&!1!==o.type.spec.selectable||u instanceof tn&&u.from<=i&&u.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&wn.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){s.view.mouseDown==s&&s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),bo(t,"pointer")};function Ao(t,e){return!!t.composing||!!(wn.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}Do.prototype.done=function(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.view.mouseDown=null},Do.prototype.up=function(t){if(this.done(),this.view.dom.contains(3==t.target.nodeType?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(xo(t))),this.allowDefault||!e?bo(this.view,"pointer"):Mo(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():this.flushed||wn.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||wn.chrome&&!(this.view.state.selection instanceof Qe)&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2?(To(this.view,Ke.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):bo(this.view,"pointer")}},Do.prototype.move=function(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0),bo(this.view,"pointer"),0==t.buttons&&this.done()},go.touchdown=function(t){No(t),bo(t,"pointer")},go.contextmenu=function(t){return No(t)};var Lo=wn.android?5e3:-1;function Io(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return Po(t)}),e))}function Ro(t){for(t.composing=!1;t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty()}function Po(t,e){if(t.domObserver.forceFlush(),Ro(t),e||t.docView.dirty){var n=Nr(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}yo.compositionstart=yo.compositionupdate=function(t){if(!t.composing){t.domObserver.flush();var e=t.state,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(t){return!1===t.type.spec.inclusive}))))t.markCursor=t.state.storedMarks||n.marks(),Po(t,!0),t.markCursor=null;else if(Po(t),wn.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=t.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(3==s.nodeType){r.collapse(s,s.nodeValue.length);break}o=s,i=-1}t.composing=!0}Io(t,Lo)},yo.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,Io(t,20))};var Bo=wn.ie&&wn.ie_version<15||wn.ios&&wn.webkit_version<604;function Fo(t,e,n,r){var o=ro(t,e,n,t.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",(function(e){return e(t,r,o||y.empty)})))return!0;if(!o)return!1;var i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),s=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);return t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}go.copy=yo.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=Bo?null:e.clipboardData,i=no(t,n.content()),s=i.dom,a=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(t,e){if(t.dom.parentNode){var n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}}(t,s),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},yo.paste=function(t,e){var n=Bo?null:e.clipboardData;n&&Fo(t,n.getData("text/plain"),n.getData("text/html"),e)?e.preventDefault():function(t,e){if(t.dom.parentNode){var n=t.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Fo(t,r.value,null,e):Fo(t,r.textContent,r.innerHTML,e)}),50)}}(t,e)};var Ho=function(t,e){this.slice=t,this.move=e},zo=wn.mac?"altKey":"ctrlKey";for(var jo in go.dragstart=function(t,e){var n=t.mouseDown;if(n&&n.done(),e.dataTransfer){var r=t.state.selection,o=r.empty?null:t.posAtCoords(xo(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof tn?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(tn.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);if(!i||!i.node.type.spec.draggable||i==t.docView)return;t.dispatch(t.state.tr.setSelection(tn.create(t.state.doc,i.posBefore)))}var s=t.state.selection.content(),a=no(t,s),c=a.dom,l=a.text;e.dataTransfer.clearData(),e.dataTransfer.setData(Bo?"Text":"text/html",c.innerHTML),e.dataTransfer.effectAllowed="copyMove",Bo||e.dataTransfer.setData("text/plain",l),t.dragging=new Ho(s,!e[zo])}},go.dragend=function(t){var e=t.dragging;window.setTimeout((function(){t.dragging==e&&(t.dragging=null)}),50)},yo.dragover=yo.dragenter=function(t,e){return e.preventDefault()},yo.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(xo(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice;i?t.someProp("transformPasted",(function(t){i=t(i)})):i=ro(t,e.dataTransfer.getData(Bo?"Text":"text/plain"),Bo?null:e.dataTransfer.getData("text/html"),!1,o);var s=n&&!e[zo];if(t.someProp("handleDrop",(function(n){return n(t,e,i||y.empty,s)})))e.preventDefault();else if(i){e.preventDefault();var a=i?function(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i=0;a--){var c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,l=r.index(a)+(c>0?1:0);if(1==s?r.node(a).canReplace(l,l,o):r.node(a).contentMatchAt(l).findWrapping(o.firstChild.type))return 0==c?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}(t.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);var c=t.state.tr;s&&c.deleteSelection();var l=c.mapping.map(a),u=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,p=c.doc;if(u?c.replaceRangeWith(l,l,i.content.firstChild):c.replaceRange(l,l,i),!c.doc.eq(p)){var d=c.doc.resolve(l);if(u&&tn.isSelectable(i.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new tn(d));else{var f=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((function(t,e,n,r){return f=r})),c.setSelection(Fr(t,d,c.doc.resolve(f)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}}}}}},go.focus=function(t){t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((function(){t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.root.getSelection())&&Dr(t)}),20))},go.blur=function(t){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),t.domObserver.currentSelection.set({}),t.focused=!1)},go.beforeinput=function(t,e){if(wn.chrome&&wn.android&&"deleteContentBackward"==e.inputType){var n=t.domChangeCount;setTimeout((function(){if(t.domChangeCount==n&&(t.dom.blur(),t.focus(),!t.someProp("handleKeyDown",(function(e){return e(t,Bn(8,"Backspace"))})))){var e=t.state.selection.$cursor;e&&e.pos>0&&t.dispatch(t.state.tr.delete(e.pos-1,e.pos).scrollIntoView())}}),50)}},yo)go[jo]=yo[jo];function _o(t,e){if(t==e)return!0;for(var n in t)if(t[n]!==e[n])return!1;for(var r in e)if(!(r in t))return!1;return!0}var qo=function(t,e){this.spec=e||Go,this.side=this.spec.side||0,this.toDOM=t};qo.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new Uo(i-n,i-n,this)},qo.prototype.valid=function(){return!0},qo.prototype.eq=function(t){return this==t||t instanceof qo&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&_o(this.spec,t.spec))};var Vo=function(t,e){this.spec=e||Go,this.attrs=t};Vo.prototype.map=function(t,e,n,r){var o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Uo(o,i,this)},Vo.prototype.valid=function(t,e){return e.from=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;at){var c=this.children[a]+1;this.children[a+2].findInner(t-c,e-c,n,r+c,o)}},Ko.prototype.map=function(t,e,n){return this==Zo||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Go)},Ko.prototype.mapInner=function(t,e,n,r,o){for(var i,s=0;sc+i||(e>=a[s]+i?a[s+1]=-1:n>=o&&(l=r-n-(e-t))&&(a[s]+=l,a[s+1]+=l))}},l=0;l=r.content.size){u=!0;continue}var h=n.map(t[p+1]+i,-1)-o,m=r.content.findIndex(f),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==f&&g+y.nodeSize==h){var b=a[p+2].mapInner(n,y,d+1,t[p]+i+1,s);b!=Zo?(a[p]=f,a[p+1]=h,a[p+2]=b):(a[p+1]=-2,u=!0)}else u=!0}if(u){var w=ei(function(t,e,n,r,o,i,s){function a(t,e){for(var i=0;is&&l.to=t){this.children[o]==t&&(n=this.children[o+2]);break}for(var i=t+1,s=i+e.content.size,a=0;ai&&c.type instanceof Vo){var l=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;ln&&s.to0;)e++;t.splice(e,0,n)}function ii(t){var e=[];return t.someProp("decorations",(function(n){var r=n(t.state);r&&r!=Zo&&e.push(r)})),t.cursorWrapper&&e.push(Ko.create(t.state.doc,[t.cursorWrapper.deco])),Xo.from(e)}Xo.prototype.forChild=function(t,e){if(e.isLeaf)return Ko.empty;for(var n=[],r=0;rr.scrollToSelection?"to selection":"preserve",u=o||!this.docView.matchesNode(t.doc,c,a);!u&&t.selection.eq(r.selection)||(i=!0);var p,d,f,h,m,v,g,y,b,w,k,x="preserve"==l&&i&&null==this.dom.style.overflowAnchor&&function(t){for(var e,n,r=t.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s=o-20){e=a,n=c.top;break}}}return{refDOM:e,refTop:n,stack:_n(t.dom)}}(this);if(i){this.domObserver.stop();var C=u&&(wn.ie||wn.chrome)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&(h=r.selection,m=t.selection,v=Math.min(h.$anchor.sharedDepth(h.head),m.$anchor.sharedDepth(m.head)),h.$anchor.start(v)!=m.$anchor.start(v));if(u){var T=wn.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!o&&this.docView.update(t.doc,c,a,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=dr(t.doc,c,a,this.dom,this)),T&&!this.trackWrites&&(C=!0)}C||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(p=this,d=p.docView.domFromPos(p.state.selection.anchor,0),f=p.root.getSelection(),Dn(d.node,d.offset,f.anchorNode,f.anchorOffset)))?Dr(this,C):(Pr(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==l)this.dom.scrollTop=0;else if("to selection"==l){var M=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof tn?jn(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),M):jn(this,this.coordsAtPos(t.selection.head,1),M))}else x&&(y=(g=x).refDOM,b=g.refTop,w=g.stack,k=y?y.getBoundingClientRect().top:0,qn(w,0==k?0:k-b))},si.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},si.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins)for(var e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},hi="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),mi="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),vi="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),gi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),yi="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),bi=hi&&(gi||+hi[1]<57)||vi&&gi,wi=0;wi<10;wi++)di[48+wi]=di[96+wi]=String(wi);for(wi=1;wi<=24;wi++)di[wi+111]="F"+wi;for(wi=65;wi<=90;wi++)di[wi]=String.fromCharCode(wi+32),fi[wi]=String.fromCharCode(wi);for(var ki in di)fi.hasOwnProperty(ki)||(fi[ki]=di[ki]);var xi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);function Ci(t){var e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a127)&&(r=di[n.keyCode])&&r!=o){var a=e[Ti(r,n,!0)];if(a&&a(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var c=e[Ti(o,n,!0)];if(c&&c(t.state,t.dispatch,t))return!0}return!1}}function Ei(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function Ni(t,e){for(;t;t="start"==e?t.firstChild:t.lastChild)if(t.isTextblock)return!0;return!1}function Oi(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Di(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){var n=t.node(e);if(t.index(e)+1=0;u--)l=p.from(r[u].create(null,l));l=p.from(i.copy(l));var d=t.tr.step(new Ee(e.pos-1,c,e.pos,c,new y(l,1,0),r.length,!0)),f=c+2*r.length;Ie(d.doc,f)&&d.join(f),n(d.scrollIntoView())}return!0}var h=Ke.findFrom(e,1),m=h&&h.$from.blockRange(h.$to),v=m&&De(m);if(null!=v&&v>=e.depth)return n&&n(t.tr.lift(m,v).scrollIntoView()),!0;if(a&&s.isTextblock&&Ni(i,"end")){for(var g=i,b=[];b.push(g),!g.isTextblock;)g=g.lastChild;if(g.canReplace(g.childCount,g.childCount,s.content)){if(n){for(var w=p.empty,k=b.length-1;k>=0;k--)w=p.from(b[k].copy(w));n(t.tr.step(new Ee(e.pos-b.length,e.pos+s.nodeSize,e.pos+1,e.pos+s.nodeSize-1,new y(w,b.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Hi(t,e){return function(n,r){var o=n.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&function(t,e,n,r){void 0===r&&(r=t);var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;var s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=(s.length?s[s.length-1]:e).contentMatch,c=r;a&&c0))return!1;var o=Oi(r);if(!o){var i=r.blockRange(),s=i&&De(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}var a=o.nodeBefore;if(!a.type.spec.isolating&&Fi(t,o,e))return!0;if(0==r.parent.content.size&&(Ni(a,"end")||tn.isSelectable(a))){if(e){var c=t.tr.deleteRange(r.before(),r.after());c.setSelection(Ni(a,"end")?Ke.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):tn.create(c.doc,o.pos-a.nodeSize)),e(c.scrollIntoView())}return!0}return!(!a.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos-a.nodeSize,o.pos).scrollIntoView()),!0)}),(function(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=Oi(o)}var s=i&&i.nodeBefore;return!(!s||!tn.isSelectable(s))&&(e&&e(t.tr.setSelection(tn.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)})),Vi=_i(Ei,Di,(function(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset1&&n.after()!=n.end(-1)){var r=n.before();if(Le(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&De(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)}),Pi),"Mod-Enter":Ri,Backspace:qi,"Mod-Backspace":qi,Delete:Vi,"Mod-Delete":Vi,"Mod-a":Bi},Ui={"Ctrl-h":$i.Backspace,"Alt-Backspace":$i["Mod-Backspace"],"Ctrl-d":$i.Delete,"Ctrl-Alt-Backspace":$i["Mod-Delete"],"Alt-Delete":$i["Mod-Delete"],"Alt-d":$i["Mod-Delete"]};for(var Wi in $i)Ui[Wi]=$i[Wi];var Ji=("undefined"!=typeof navigator?/Mac/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?Ui:$i,Gi=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,r,o){var i=n;if(e[1]){var s=e[0].lastIndexOf(e[1]);i+=e[0].slice(s+e[1].length);var a=(r+=s)-o;a>0&&(i=e[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function Ki(t,e,n,r,o,i){if(t.composing)return!1;var s=t.state,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,l=0;l=e?Xi.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Xi.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Xi.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Xi.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Xi.from=function(t){return t instanceof Xi?t:t&&t.length?new Qi(t):Xi.empty};var Qi=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=Zi)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=Zi)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Xi);Xi.empty=new Qi([]);var Yi=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return to&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Xi),ts=Xi,es=function(t,e){this.items=t,this.eventCount=e};es.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,c=t.tr,l=[],u=[];return this.items.forEach((function(t,e){if(!t.step)return r||(r=n.remapping(i,e+1),o=r.maps.length),o--,void u.push(t);if(r){u.push(new ns(t.map));var p,d=t.step.map(r.slice(o));d&&c.maybeStep(d).doc&&(p=c.mapping.maps[c.mapping.maps.length-1],l.push(new ns(p,null,null,l.length+u.length))),o--,p&&r.appendMap(p,o)}else c.maybeStep(t.step);return t.selection?(s=r?t.selection.map(r.slice(o)):t.selection,a=new es(n.items.slice(0,i).append(u.reverse().concat(l)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:c,selection:s}},es.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,c=0;cis&&(f=m,(d=s).forEach((function(t,e){if(t.selection&&0==f--)return h=e,!1})),s=d.slice(h),i-=m),new es(s.append(o),i)},es.prototype.remapping=function(t,e){var n=new ye;return this.items.forEach((function(e,r){var o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:null;n.appendMap(e.map,o)}),t,e),n},es.prototype.addMaps=function(t){return 0==this.eventCount?this:new es(this.items.append(t.map((function(t){return new ns(t)}))),this.eventCount)},es.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((function(t){t.selection&&s--}),r);var a=e;this.items.forEach((function(e){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var c=o.maps[r];if(e.step){var l=t.steps[r].invert(t.docs[r]),u=e.selection&&e.selection.map(o.slice(a+1,r));u&&s++,n.push(new ns(c,l,u))}else n.push(new ns(c))}}),r);for(var c=[],l=e;l500&&(p=p.compress(this.items.length-n.length)),p},es.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},es.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=t)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(e.slice(n)),c=a&&a.getMap();if(n--,c&&e.appendMap(c,n),a){var l=i.selection&&i.selection.map(e.slice(n));l&&o++;var u,p=new ns(c.invert(),a,l),d=r.length-1;(u=r.length&&r[d].merge(p))?r[d]=u:r.push(p)}}else i.map&&n--}),this.items.length,0),new es(ts.from(r.reverse()),o)},es.empty=new es(ts.empty,0);var ns=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};ns.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new ns(e.getMap().invert(),e,this.selection)}};var rs=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},is=20;function ss(t){var e=[];return t.forEach((function(t,n,r,o){return e.push(r,o)})),e}function as(t,e){if(!t)return null;for(var n=[],r=0;r=e[o]&&(n=!0)})),n}(n,t.prevRanges)),c=s?as(t.prevRanges,n.mapping):ss(n.mapping.maps[n.steps.length-1]);return new rs(t.done.addTransform(n,a?e.selection.getBookmark():null,r,ps(e)),es.empty,c,n.time)}(n,r,e,t)}},config:t})}function ms(t,e){var n=ds.getState(t);return!(!n||0==n.done.eventCount)&&(e&&cs(n,t,e,!1),!0)}function vs(t,e){var n=ds.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&cs(n,t,e,!0),!0)}function gs(t,e){var n=t.nodes.paragraph;return e?n.create(null,Pt()(e)?t.text(e):e):n.createAndFill()}function ys(t,e,n){return t.text(e,n)}function bs(t,e,n){void 0===n&&(n=e);var r=t.doc.content.size,o=r>0?r-1:1;return Qe.create(t.doc,Math.min(e,o),Math.min(n,o))}function ws(t,e,n){var r=e.pos;return t.replaceWith(r,r,gs(n)),t.setSelection(bs(t,r+1))}function ks(t){for(var e=t.state,n=t.from,r=t.startIndex,o=t.endIndex,i=t.createText,s=e.tr,a=e.doc,c=e.schema,l=r;l<=o;l+=1){var u=a.child(l),d=u.nodeSize,f=u.textContent,h=u.content,m=i(f),v=m?ys(c,m):p.empty,g=s.mapping.map(n),y=g+h.size;s.replaceWith(g,y,v),n+=d}return s}function xs(t,e,n,r){var o=n.length;t.split(e).delete(e-o,e).insert(t.mapping.map(e),r).setSelection(bs(t,t.mapping.map(e)-o))}function Cs(t){return t.sourcepos[0][0]}function Ts(t){return t.sourcepos[1][0]}function Ms(t){return t.sourcepos[0][1]}function Ss(t){return t.sourcepos[1][1]}function Es(t){var e=t.type;return"strike"===e||"strong"===e||"emph"===e||"code"===e||"link"===e||"image"===e}function Ns(t){return t&&("item"===t.type||"list"===t.type)}function Os(t){return Ns(t)&&"ordered"===t.listData.type}function Ds(t){return Ns(t)&&"ordered"!==t.listData.type}function As(t){return t&&("tableCell"===t.type||"tableDelimCell"===t.type)}function Ls(t,e,n){for(void 0===n&&(n=!0),t=n?t:t.parent;t&&"document"!==t.type;){if(e(t))return t;t=t.parent}return null}function Is(t,e){return[t[0],t[1]+e]}function Rs(t,e){return[t[0],e]}function Ps(t){var e=t.firstChild.literal;switch(t.type){case"emph":return"*"+e+"*";case"strong":return"**"+e+"**";case"strike":return"~~"+e+"~~";case"code":return"`"+e+"`";case"link":case"image":var n=t,r=n.destination,o=n.title;return("link"===t.type?"":"!")+"["+e+"]("+r+(o?' "'+o+'"':"")+")";default:return null}}function Bs(t){switch(t.type){case"document":case"blockQuote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"strike":case"link":case"image":case"table":case"tableHead":case"tableBody":case"tableRow":case"tableCell":case"tableDelimRow":case"customInline":return!0;default:return!1}}function Fs(t){for(var e=[],n=t.walker(),r=null;r=n.next();){var o=r.node;"text"===o.type&&e.push(o.literal)}return e.join("")}var Hs=[],zs={},js=/\$\$widget\d+\s/;function _s(t){var e=t.search(js);if(-1!==e){var n=t.substring(e).replace(js,"").replace("$$","");t=t.substring(0,e),t+=_s(n)}return t}function qs(t,e){return"$$"+t+" "+e+"$$"}function Vs(t,e){var n=zs[t],r=n.rule;return(0,n.toDOM)(e=_s(e).match(r)[0])}function $s(){return Hs}function Us(t){(Hs=t).forEach((function(t,e){zs["widget"+e]=t}))}function Ws(t,e,n,r){return t.concat(Js(e,n,r))}function Js(t,e,n){void 0===n&&(n=0);var r=[],o=(Hs[n]||{}).rule,i=n+1;if(t=_s(t),o&&o.test(t)){for(var s=void 0;-1!==(s=t.search(o));){var a=t.substring(0,s);a&&(r=Ws(r,a,e,i));var c=(t=t.substring(s)).match(o)[0],l="widget"+n;r.push(e.nodes.widget.create({info:l},e.text(qs(l,c)))),t=t.substring(c.length)}t&&(r=Ws(r,t,e,i))}else t&&(r=np){var d=se(c),f=Js(d,i);return s.replaceWith(o-d.length+1,o,f)}return null}))}));return t.length?function(t){var e=t.rules,n=new vn({state:{init:function(){return null},apply:function(t,e){return t.getMeta(this)||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,r,o,i){return Ki(t,r,o,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var r=t.state.selection.$cursor;r&&Ki(t,r.pos,r.pos,"",e,n)}))}}},isInputRules:!0});return n}({rules:t}):null},t.prototype.createSchema=function(){return new ct({nodes:this.specs.nodes,marks:this.specs.marks})},t.prototype.createKeymaps=function(t){return t?this.specs.keymaps():[]},t.prototype.createCommands=function(){return this.specs.commands(this.view)},t.prototype.createPluginProps=function(){var t=this;return this.extraPlugins.map((function(e){return e(t.eventEmitter)}))},t.prototype.focus=function(){var t=this;setTimeout((function(){t.view.focus(),t.view.dispatch(t.view.state.tr.scrollIntoView())}))},t.prototype.blur=function(){this.view.dom.blur()},t.prototype.destroy=function(){var t=this;this.view.destroy(),Object.keys(this).forEach((function(e){delete t[e]}))},t.prototype.moveCursorToStart=function(t){var e=this.view.state.tr;this.view.dispatch(e.setSelection(bs(e,1)).scrollIntoView()),t&&this.focus()},t.prototype.moveCursorToEnd=function(t){var e=this.view.state.tr;this.view.dispatch(e.setSelection(bs(e,e.doc.content.size-1)).scrollIntoView()),t&&this.focus()},t.prototype.setScrollTop=function(t){this.view.dom.scrollTop=t},t.prototype.getScrollTop=function(){return this.view.dom.scrollTop},t.prototype.setPlaceholder=function(t){this.placeholder.text=t,this.view.dispatch(this.view.state.tr.scrollIntoView())},t.prototype.setHeight=function(t){Ot()(this.el,{height:t+"px"})},t.prototype.setMinHeight=function(t){Ot()(this.el,{minHeight:t+"px"})},t.prototype.getElement=function(){return this.el},t}(),pa=n(294),da=n.n(pa);function fa(t,e,n){return t.focus(),e(n)(t.state,t.dispatch,t)}var ha=function(){function t(t){this.specs=t}return Object.defineProperty(t.prototype,"nodes",{get:function(){return this.specs.filter((function(t){return"node"===t.type})).reduce((function(t,e){var n,r=e.name,i=e.schema;return o(o({},t),((n={})[r]=i,n))}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"marks",{get:function(){return this.specs.filter((function(t){return"mark"===t.type})).reduce((function(t,e){var n,r=e.name,i=e.schema;return o(o({},t),((n={})[r]=i,n))}),{})},enumerable:!1,configurable:!0}),t.prototype.commands=function(t,e){var n=this.specs.filter((function(t){return t.commands})).reduce((function(e,n){var r={},i=n.commands();return da()(i)?r[n.name]=function(e){return fa(t,i,e)}:Object.keys(i).forEach((function(e){r[e]=function(n){return fa(t,i[e],n)}})),o(o({},e),r)}),{}),r=Ks();return Object.keys(r).forEach((function(e){n[e]=function(n){return fa(t,r[e],n)}})),e&&Object.keys(e).forEach((function(r){n[r]=function(n){return fa(t,e[r],n)}})),n},t.prototype.keymaps=function(){return this.specs.filter((function(t){return t.keymaps})).map((function(t){return t.keymaps()})).map((function(t){return Mi(t)}))},t.prototype.setContext=function(t){this.specs.forEach((function(e){e.setContext(t)}))},t}(),ma=n(322),va=n.n(ma),ga=n(714),ya=n.n(ga),ba=n(471),wa=n.n(ba),ka="[A-Za-z][A-Za-z0-9-]*",xa="(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)",Ca="<("+ka+")("+xa+")*\\s*/?>",Ta="(?:"+Ca+"|([A-Za-z][A-Za-z0-9-]*)\\s*[>])",Ma=new RegExp("^"+Ta,"i"),Sa=/ /i,Ea="
0},t}(),Av="undefined"!=typeof WeakMap?new WeakMap:new dv,Lv=function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=yv.getInstance(),r=new Dv(e,n,this);Av.set(this,r)};["observe","unobserve","disconnect"].forEach((function(t){Lv.prototype[t]=function(){var e;return(e=Av.get(this))[t].apply(e,arguments)}}));var Iv,Rv,Pv,Bv,Fv,Hv,zv,jv,_v,qv,Vv,$v,Uv,Wv,Jv,Gv,Kv=void 0!==hv.ResizeObserver?hv.ResizeObserver:Lv,Zv=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.execCommand=function(t){var e=Fa(t.target,"li");this.props.execCommand("heading",{level:Number(e.getAttribute("data-level"))})},n.prototype.render=function(){var t=this;return Wm(Rv||(Rv=s(["\n