var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key2, value24) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value: value24 }) : obj[key2] = value24; var __spreadValues = (a2, b2) => { for (var prop in b2 || (b2 = {})) if (__hasOwnProp.call(b2, prop)) __defNormalProp(a2, prop, b2[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b2)) { if (__propIsEnum.call(b2, prop)) __defNormalProp(a2, prop, b2[prop]); } return a2; }; var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2)); var __publicField = (obj, key2, value24) => { __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value24); return value24; }; var _a2; import * as _vue from "vue"; import { unref, inject, reactive, readonly, provide, getCurrentScope, onScopeDispose, getCurrentInstance, onMounted, nextTick, onUnmounted, watch, ref, computed, defineComponent, toRefs, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, resolveComponent, createBlock, createVNode, withCtx, Fragment, createTextVNode, toDisplayString, renderSlot, createCommentVNode, Comment, Text, isVNode, onUpdated, cloneVNode, watchEffect, onBeforeUnmount, withDirectives, onBeforeUpdate, Transition as Transition$2, TransitionGroup as TransitionGroup$1, vShow, Teleport, h as h$2, toRaw, toRef, createApp, render, onBeforeMount, markRaw, mergeProps as mergeProps$1, toHandlers, resolveDynamicComponent, renderList, useSlots, shallowRef, normalizeProps, guardReactiveProps, onActivated, isRef, createSlots, resolveDirective, onDeactivated, withKeys } from "vue"; var index$H = ""; if (typeof window !== "undefined") { let loadSvg = function() { var body = document.body; var svgDom = document.getElementById("__svg__icons__dom__"); if (!svgDom) { svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg"); svgDom.style.position = "absolute"; svgDom.style.width = "0"; svgDom.style.height = "0"; svgDom.id = "__svg__icons__dom__"; svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink"); } svgDom.innerHTML = '%'; body.insertBefore(svgDom, body.lastChild); }; if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", loadSvg); } else { loadSvg(); } } //! moment.js //! version : 2.29.3 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com var hookCallback; function hooks() { return hookCallback.apply(null, arguments); } function setHookCallback(callback2) { hookCallback = callback2; } function isArray$9(input) { return input instanceof Array || Object.prototype.toString.call(input) === "[object Array]"; } function isObject$5(input) { return input != null && Object.prototype.toString.call(input) === "[object Object]"; } function hasOwnProp(a2, b2) { return Object.prototype.hasOwnProperty.call(a2, b2); } function isObjectEmpty(obj) { if (Object.getOwnPropertyNames) { return Object.getOwnPropertyNames(obj).length === 0; } else { var k2; for (k2 in obj) { if (hasOwnProp(obj, k2)) { return false; } } return true; } } function isUndefined$1(input) { return input === void 0; } function isNumber$4(input) { return typeof input === "number" || Object.prototype.toString.call(input) === "[object Number]"; } function isDate$2(input) { return input instanceof Date || Object.prototype.toString.call(input) === "[object Date]"; } function map(arr, fn) { var res = [], i2, arrLen = arr.length; for (i2 = 0; i2 < arrLen; ++i2) { res.push(fn(arr[i2], i2)); } return res; } function extend$2(a2, b2) { for (var i2 in b2) { if (hasOwnProp(b2, i2)) { a2[i2] = b2[i2]; } } if (hasOwnProp(b2, "toString")) { a2.toString = b2.toString; } if (hasOwnProp(b2, "valueOf")) { a2.valueOf = b2.valueOf; } return a2; } function createUTC(input, format3, locale2, strict) { return createLocalOrUTC(input, format3, locale2, strict, true).utc(); } function defaultParsingFlags() { return { empty: false, unusedTokens: [], unusedInput: [], overflow: -2, charsLeftOver: 0, nullInput: false, invalidEra: null, invalidMonth: null, invalidFormat: false, userInvalidated: false, iso: false, parsedDateParts: [], era: null, meridiem: null, rfc2822: false, weekdayMismatch: false }; } function getParsingFlags(m2) { if (m2._pf == null) { m2._pf = defaultParsingFlags(); } return m2._pf; } var some; if (Array.prototype.some) { some = Array.prototype.some; } else { some = function(fun) { var t2 = Object(this), len = t2.length >>> 0, i2; for (i2 = 0; i2 < len; i2++) { if (i2 in t2 && fun.call(this, t2[i2], i2, t2)) { return true; } } return false; }; } function isValid$2(m2) { if (m2._isValid == null) { var flags = getParsingFlags(m2), parsedParts = some.call(flags.parsedDateParts, function(i2) { return i2 != null; }), isNowValid = !isNaN(m2._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts); if (m2._strict) { isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === void 0; } if (Object.isFrozen == null || !Object.isFrozen(m2)) { m2._isValid = isNowValid; } else { return isNowValid; } } return m2._isValid; } function createInvalid(flags) { var m2 = createUTC(NaN); if (flags != null) { extend$2(getParsingFlags(m2), flags); } else { getParsingFlags(m2).userInvalidated = true; } return m2; } var momentProperties = hooks.momentProperties = [], updateInProgress = false; function copyConfig(to2, from2) { var i2, prop, val, momentPropertiesLen = momentProperties.length; if (!isUndefined$1(from2._isAMomentObject)) { to2._isAMomentObject = from2._isAMomentObject; } if (!isUndefined$1(from2._i)) { to2._i = from2._i; } if (!isUndefined$1(from2._f)) { to2._f = from2._f; } if (!isUndefined$1(from2._l)) { to2._l = from2._l; } if (!isUndefined$1(from2._strict)) { to2._strict = from2._strict; } if (!isUndefined$1(from2._tzm)) { to2._tzm = from2._tzm; } if (!isUndefined$1(from2._isUTC)) { to2._isUTC = from2._isUTC; } if (!isUndefined$1(from2._offset)) { to2._offset = from2._offset; } if (!isUndefined$1(from2._pf)) { to2._pf = getParsingFlags(from2); } if (!isUndefined$1(from2._locale)) { to2._locale = from2._locale; } if (momentPropertiesLen > 0) { for (i2 = 0; i2 < momentPropertiesLen; i2++) { prop = momentProperties[i2]; val = from2[prop]; if (!isUndefined$1(val)) { to2[prop] = val; } } } return to2; } function Moment(config3) { copyConfig(this, config3); this._d = new Date(config3._d != null ? config3._d.getTime() : NaN); if (!this.isValid()) { this._d = new Date(NaN); } if (updateInProgress === false) { updateInProgress = true; hooks.updateOffset(this); updateInProgress = false; } } function isMoment$1(obj) { return obj instanceof Moment || obj != null && obj._isAMomentObject != null; } function warn$2(msg) { if (hooks.suppressDeprecationWarnings === false && typeof console !== "undefined" && console.warn) { console.warn("Deprecation warning: " + msg); } } function deprecate(msg, fn) { var firstTime = true; return extend$2(function() { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = [], arg, i2, key2, argLen = arguments.length; for (i2 = 0; i2 < argLen; i2++) { arg = ""; if (typeof arguments[i2] === "object") { arg += "\n[" + i2 + "] "; for (key2 in arguments[0]) { if (hasOwnProp(arguments[0], key2)) { arg += key2 + ": " + arguments[0][key2] + ", "; } } arg = arg.slice(0, -2); } else { arg = arguments[i2]; } args.push(arg); } warn$2(msg + "\nArguments: " + Array.prototype.slice.call(args).join("") + "\n" + new Error().stack); firstTime = false; } return fn.apply(this, arguments); }, fn); } var deprecations = {}; function deprecateSimple(name, msg) { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(name, msg); } if (!deprecations[name]) { warn$2(msg); deprecations[name] = true; } } hooks.suppressDeprecationWarnings = false; hooks.deprecationHandler = null; function isFunction$4(input) { return typeof Function !== "undefined" && input instanceof Function || Object.prototype.toString.call(input) === "[object Function]"; } function set$1(config3) { var prop, i2; for (i2 in config3) { if (hasOwnProp(config3, i2)) { prop = config3[i2]; if (isFunction$4(prop)) { this[i2] = prop; } else { this["_" + i2] = prop; } } } this._config = config3; this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source); } function mergeConfigs(parentConfig, childConfig) { var res = extend$2({}, parentConfig), prop; for (prop in childConfig) { if (hasOwnProp(childConfig, prop)) { if (isObject$5(parentConfig[prop]) && isObject$5(childConfig[prop])) { res[prop] = {}; extend$2(res[prop], parentConfig[prop]); extend$2(res[prop], childConfig[prop]); } else if (childConfig[prop] != null) { res[prop] = childConfig[prop]; } else { delete res[prop]; } } } for (prop in parentConfig) { if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject$5(parentConfig[prop])) { res[prop] = extend$2({}, res[prop]); } } return res; } function Locale(config3) { if (config3 != null) { this.set(config3); } } var keys$1; if (Object.keys) { keys$1 = Object.keys; } else { keys$1 = function(obj) { var i2, res = []; for (i2 in obj) { if (hasOwnProp(obj, i2)) { res.push(i2); } } return res; }; } var defaultCalendar = { sameDay: "[Today at] LT", nextDay: "[Tomorrow at] LT", nextWeek: "dddd [at] LT", lastDay: "[Yesterday at] LT", lastWeek: "[Last] dddd [at] LT", sameElse: "L" }; function calendar(key2, mom, now2) { var output = this._calendar[key2] || this._calendar["sameElse"]; return isFunction$4(output) ? output.call(mom, now2) : output; } function zeroFill(number3, targetLength, forceSign) { var absNumber = "" + Math.abs(number3), zerosToFill = targetLength - absNumber.length, sign2 = number3 >= 0; return (sign2 ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; } var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {}; function addFormatToken(token2, padded, ordinal2, callback2) { var func = callback2; if (typeof callback2 === "string") { func = function() { return this[callback2](); }; } if (token2) { formatTokenFunctions[token2] = func; } if (padded) { formatTokenFunctions[padded[0]] = function() { return zeroFill(func.apply(this, arguments), padded[1], padded[2]); }; } if (ordinal2) { formatTokenFunctions[ordinal2] = function() { return this.localeData().ordinal(func.apply(this, arguments), token2); }; } } function removeFormattingTokens(input) { if (input.match(/\[[\s\S]/)) { return input.replace(/^\[|\]$/g, ""); } return input.replace(/\\/g, ""); } function makeFormatFunction(format3) { var array3 = format3.match(formattingTokens), i2, length; for (i2 = 0, length = array3.length; i2 < length; i2++) { if (formatTokenFunctions[array3[i2]]) { array3[i2] = formatTokenFunctions[array3[i2]]; } else { array3[i2] = removeFormattingTokens(array3[i2]); } } return function(mom) { var output = "", i3; for (i3 = 0; i3 < length; i3++) { output += isFunction$4(array3[i3]) ? array3[i3].call(mom, format3) : array3[i3]; } return output; }; } function formatMoment(m2, format3) { if (!m2.isValid()) { return m2.localeData().invalidDate(); } format3 = expandFormat(format3, m2.localeData()); formatFunctions[format3] = formatFunctions[format3] || makeFormatFunction(format3); return formatFunctions[format3](m2); } function expandFormat(format3, locale2) { var i2 = 5; function replaceLongDateFormatTokens(input) { return locale2.longDateFormat(input) || input; } localFormattingTokens.lastIndex = 0; while (i2 >= 0 && localFormattingTokens.test(format3)) { format3 = format3.replace(localFormattingTokens, replaceLongDateFormatTokens); localFormattingTokens.lastIndex = 0; i2 -= 1; } return format3; } var defaultLongDateFormat = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }; function longDateFormat(key2) { var format3 = this._longDateFormat[key2], formatUpper = this._longDateFormat[key2.toUpperCase()]; if (format3 || !formatUpper) { return format3; } this._longDateFormat[key2] = formatUpper.match(formattingTokens).map(function(tok) { if (tok === "MMMM" || tok === "MM" || tok === "DD" || tok === "dddd") { return tok.slice(1); } return tok; }).join(""); return this._longDateFormat[key2]; } var defaultInvalidDate = "Invalid date"; function invalidDate() { return this._invalidDate; } var defaultOrdinal = "%d", defaultDayOfMonthOrdinalParse = /\d{1,2}/; function ordinal(number3) { return this._ordinal.replace("%d", number3); } var defaultRelativeTime = { future: "in %s", past: "%s ago", s: "a few seconds", ss: "%d seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", w: "a week", ww: "%d weeks", M: "a month", MM: "%d months", y: "a year", yy: "%d years" }; function relativeTime(number3, withoutSuffix, string2, isFuture) { var output = this._relativeTime[string2]; return isFunction$4(output) ? output(number3, withoutSuffix, string2, isFuture) : output.replace(/%d/i, number3); } function pastFuture(diff2, output) { var format3 = this._relativeTime[diff2 > 0 ? "future" : "past"]; return isFunction$4(format3) ? format3(output) : format3.replace(/%s/i, output); } var aliases = {}; function addUnitAlias(unit, shorthand) { var lowerCase = unit.toLowerCase(); aliases[lowerCase] = aliases[lowerCase + "s"] = aliases[shorthand] = unit; } function normalizeUnits(units) { return typeof units === "string" ? aliases[units] || aliases[units.toLowerCase()] : void 0; } function normalizeObjectUnits(inputObject) { var normalizedInput = {}, normalizedProp, prop; for (prop in inputObject) { if (hasOwnProp(inputObject, prop)) { normalizedProp = normalizeUnits(prop); if (normalizedProp) { normalizedInput[normalizedProp] = inputObject[prop]; } } } return normalizedInput; } var priorities = {}; function addUnitPriority(unit, priority) { priorities[unit] = priority; } function getPrioritizedUnits(unitsObj) { var units = [], u2; for (u2 in unitsObj) { if (hasOwnProp(unitsObj, u2)) { units.push({ unit: u2, priority: priorities[u2] }); } } units.sort(function(a2, b2) { return a2.priority - b2.priority; }); return units; } function isLeapYear(year) { return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; } function absFloor(number3) { if (number3 < 0) { return Math.ceil(number3) || 0; } else { return Math.floor(number3); } } function toInt(argumentForCoercion) { var coercedNumber = +argumentForCoercion, value24 = 0; if (coercedNumber !== 0 && isFinite(coercedNumber)) { value24 = absFloor(coercedNumber); } return value24; } function makeGetSet(unit, keepTime) { return function(value24) { if (value24 != null) { set$1$1(this, unit, value24); hooks.updateOffset(this, keepTime); return this; } else { return get$1(this, unit); } }; } function get$1(mom, unit) { return mom.isValid() ? mom._d["get" + (mom._isUTC ? "UTC" : "") + unit]() : NaN; } function set$1$1(mom, unit, value24) { if (mom.isValid() && !isNaN(value24)) { if (unit === "FullYear" && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) { value24 = toInt(value24); mom._d["set" + (mom._isUTC ? "UTC" : "") + unit](value24, mom.month(), daysInMonth(value24, mom.month())); } else { mom._d["set" + (mom._isUTC ? "UTC" : "") + unit](value24); } } } function stringGet(units) { units = normalizeUnits(units); if (isFunction$4(this[units])) { return this[units](); } return this; } function stringSet(units, value24) { if (typeof units === "object") { units = normalizeObjectUnits(units); var prioritized = getPrioritizedUnits(units), i2, prioritizedLen = prioritized.length; for (i2 = 0; i2 < prioritizedLen; i2++) { this[prioritized[i2].unit](units[prioritized[i2].unit]); } } else { units = normalizeUnits(units); if (isFunction$4(this[units])) { return this[units](value24); } } return this; } var match1 = /\d/, match2 = /\d\d/, match3 = /\d{3}/, match4 = /\d{4}/, match6 = /[+-]?\d{6}/, match1to2 = /\d\d?/, match3to4 = /\d\d\d\d?/, match5to6 = /\d\d\d\d\d\d?/, match1to3 = /\d{1,3}/, match1to4 = /\d{1,4}/, match1to6 = /[+-]?\d{1,6}/, matchUnsigned = /\d+/, matchSigned = /[+-]?\d+/, matchOffset = /Z|[+-]\d\d:?\d\d/gi, matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, regexes; regexes = {}; function addRegexToken(token2, regex2, strictRegex) { regexes[token2] = isFunction$4(regex2) ? regex2 : function(isStrict, localeData2) { return isStrict && strictRegex ? strictRegex : regex2; }; } function getParseRegexForToken(token2, config3) { if (!hasOwnProp(regexes, token2)) { return new RegExp(unescapeFormat(token2)); } return regexes[token2](config3._strict, config3._locale); } function unescapeFormat(s2) { return regexEscape(s2.replace("\\", "").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function(matched, p1, p2, p3, p4) { return p1 || p2 || p3 || p4; })); } function regexEscape(s2) { return s2.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); } var tokens = {}; function addParseToken(token2, callback2) { var i2, func = callback2, tokenLen; if (typeof token2 === "string") { token2 = [token2]; } if (isNumber$4(callback2)) { func = function(input, array3) { array3[callback2] = toInt(input); }; } tokenLen = token2.length; for (i2 = 0; i2 < tokenLen; i2++) { tokens[token2[i2]] = func; } } function addWeekParseToken(token2, callback2) { addParseToken(token2, function(input, array3, config3, token3) { config3._w = config3._w || {}; callback2(input, config3._w, config3, token3); }); } function addTimeToArrayFromToken(token2, input, config3) { if (input != null && hasOwnProp(tokens, token2)) { tokens[token2](input, config3._a, config3, token2); } } var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8; function mod(n2, x2) { return (n2 % x2 + x2) % x2; } var indexOf$2; if (Array.prototype.indexOf) { indexOf$2 = Array.prototype.indexOf; } else { indexOf$2 = function(o2) { var i2; for (i2 = 0; i2 < this.length; ++i2) { if (this[i2] === o2) { return i2; } } return -1; }; } function daysInMonth(year, month) { if (isNaN(year) || isNaN(month)) { return NaN; } var modMonth = mod(month, 12); year += (month - modMonth) / 12; return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2; } addFormatToken("M", ["MM", 2], "Mo", function() { return this.month() + 1; }); addFormatToken("MMM", 0, 0, function(format3) { return this.localeData().monthsShort(this, format3); }); addFormatToken("MMMM", 0, 0, function(format3) { return this.localeData().months(this, format3); }); addUnitAlias("month", "M"); addUnitPriority("month", 8); addRegexToken("M", match1to2); addRegexToken("MM", match1to2, match2); addRegexToken("MMM", function(isStrict, locale2) { return locale2.monthsShortRegex(isStrict); }); addRegexToken("MMMM", function(isStrict, locale2) { return locale2.monthsRegex(isStrict); }); addParseToken(["M", "MM"], function(input, array3) { array3[MONTH] = toInt(input) - 1; }); addParseToken(["MMM", "MMMM"], function(input, array3, config3, token2) { var month = config3._locale.monthsParse(input, token2, config3._strict); if (month != null) { array3[MONTH] = month; } else { getParsingFlags(config3).invalidMonth = input; } }); var defaultLocaleMonths = "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), defaultLocaleMonthsShort = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultMonthsShortRegex = matchWord, defaultMonthsRegex = matchWord; function localeMonths(m2, format3) { if (!m2) { return isArray$9(this._months) ? this._months : this._months["standalone"]; } return isArray$9(this._months) ? this._months[m2.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format3) ? "format" : "standalone"][m2.month()]; } function localeMonthsShort(m2, format3) { if (!m2) { return isArray$9(this._monthsShort) ? this._monthsShort : this._monthsShort["standalone"]; } return isArray$9(this._monthsShort) ? this._monthsShort[m2.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format3) ? "format" : "standalone"][m2.month()]; } function handleStrictParse(monthName, format3, strict) { var i2, ii, mom, llc = monthName.toLocaleLowerCase(); if (!this._monthsParse) { this._monthsParse = []; this._longMonthsParse = []; this._shortMonthsParse = []; for (i2 = 0; i2 < 12; ++i2) { mom = createUTC([2e3, i2]); this._shortMonthsParse[i2] = this.monthsShort(mom, "").toLocaleLowerCase(); this._longMonthsParse[i2] = this.months(mom, "").toLocaleLowerCase(); } } if (strict) { if (format3 === "MMM") { ii = indexOf$2.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf$2.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } } else { if (format3 === "MMM") { ii = indexOf$2.call(this._shortMonthsParse, llc); if (ii !== -1) { return ii; } ii = indexOf$2.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf$2.call(this._longMonthsParse, llc); if (ii !== -1) { return ii; } ii = indexOf$2.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } } } function localeMonthsParse(monthName, format3, strict) { var i2, mom, regex2; if (this._monthsParseExact) { return handleStrictParse.call(this, monthName, format3, strict); } if (!this._monthsParse) { this._monthsParse = []; this._longMonthsParse = []; this._shortMonthsParse = []; } for (i2 = 0; i2 < 12; i2++) { mom = createUTC([2e3, i2]); if (strict && !this._longMonthsParse[i2]) { this._longMonthsParse[i2] = new RegExp("^" + this.months(mom, "").replace(".", "") + "$", "i"); this._shortMonthsParse[i2] = new RegExp("^" + this.monthsShort(mom, "").replace(".", "") + "$", "i"); } if (!strict && !this._monthsParse[i2]) { regex2 = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, ""); this._monthsParse[i2] = new RegExp(regex2.replace(".", ""), "i"); } if (strict && format3 === "MMMM" && this._longMonthsParse[i2].test(monthName)) { return i2; } else if (strict && format3 === "MMM" && this._shortMonthsParse[i2].test(monthName)) { return i2; } else if (!strict && this._monthsParse[i2].test(monthName)) { return i2; } } } function setMonth(mom, value24) { var dayOfMonth; if (!mom.isValid()) { return mom; } if (typeof value24 === "string") { if (/^\d+$/.test(value24)) { value24 = toInt(value24); } else { value24 = mom.localeData().monthsParse(value24); if (!isNumber$4(value24)) { return mom; } } } dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value24)); mom._d["set" + (mom._isUTC ? "UTC" : "") + "Month"](value24, dayOfMonth); return mom; } function getSetMonth(value24) { if (value24 != null) { setMonth(this, value24); hooks.updateOffset(this, true); return this; } else { return get$1(this, "Month"); } } function getDaysInMonth() { return daysInMonth(this.year(), this.month()); } function monthsShortRegex(isStrict) { if (this._monthsParseExact) { if (!hasOwnProp(this, "_monthsRegex")) { computeMonthsParse.call(this); } if (isStrict) { return this._monthsShortStrictRegex; } else { return this._monthsShortRegex; } } else { if (!hasOwnProp(this, "_monthsShortRegex")) { this._monthsShortRegex = defaultMonthsShortRegex; } return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex; } } function monthsRegex(isStrict) { if (this._monthsParseExact) { if (!hasOwnProp(this, "_monthsRegex")) { computeMonthsParse.call(this); } if (isStrict) { return this._monthsStrictRegex; } else { return this._monthsRegex; } } else { if (!hasOwnProp(this, "_monthsRegex")) { this._monthsRegex = defaultMonthsRegex; } return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex; } } function computeMonthsParse() { function cmpLenRev(a2, b2) { return b2.length - a2.length; } var shortPieces = [], longPieces = [], mixedPieces = [], i2, mom; for (i2 = 0; i2 < 12; i2++) { mom = createUTC([2e3, i2]); shortPieces.push(this.monthsShort(mom, "")); longPieces.push(this.months(mom, "")); mixedPieces.push(this.months(mom, "")); mixedPieces.push(this.monthsShort(mom, "")); } shortPieces.sort(cmpLenRev); longPieces.sort(cmpLenRev); mixedPieces.sort(cmpLenRev); for (i2 = 0; i2 < 12; i2++) { shortPieces[i2] = regexEscape(shortPieces[i2]); longPieces[i2] = regexEscape(longPieces[i2]); } for (i2 = 0; i2 < 24; i2++) { mixedPieces[i2] = regexEscape(mixedPieces[i2]); } this._monthsRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i"); this._monthsShortRegex = this._monthsRegex; this._monthsStrictRegex = new RegExp("^(" + longPieces.join("|") + ")", "i"); this._monthsShortStrictRegex = new RegExp("^(" + shortPieces.join("|") + ")", "i"); } addFormatToken("Y", 0, 0, function() { var y2 = this.year(); return y2 <= 9999 ? zeroFill(y2, 4) : "+" + y2; }); addFormatToken(0, ["YY", 2], 0, function() { return this.year() % 100; }); addFormatToken(0, ["YYYY", 4], 0, "year"); addFormatToken(0, ["YYYYY", 5], 0, "year"); addFormatToken(0, ["YYYYYY", 6, true], 0, "year"); addUnitAlias("year", "y"); addUnitPriority("year", 1); addRegexToken("Y", matchSigned); addRegexToken("YY", match1to2, match2); addRegexToken("YYYY", match1to4, match4); addRegexToken("YYYYY", match1to6, match6); addRegexToken("YYYYYY", match1to6, match6); addParseToken(["YYYYY", "YYYYYY"], YEAR); addParseToken("YYYY", function(input, array3) { array3[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); }); addParseToken("YY", function(input, array3) { array3[YEAR] = hooks.parseTwoDigitYear(input); }); addParseToken("Y", function(input, array3) { array3[YEAR] = parseInt(input, 10); }); function daysInYear(year) { return isLeapYear(year) ? 366 : 365; } hooks.parseTwoDigitYear = function(input) { return toInt(input) + (toInt(input) > 68 ? 1900 : 2e3); }; var getSetYear = makeGetSet("FullYear", true); function getIsLeapYear() { return isLeapYear(this.year()); } function createDate(y2, m2, d2, h2, M2, s2, ms) { var date3; if (y2 < 100 && y2 >= 0) { date3 = new Date(y2 + 400, m2, d2, h2, M2, s2, ms); if (isFinite(date3.getFullYear())) { date3.setFullYear(y2); } } else { date3 = new Date(y2, m2, d2, h2, M2, s2, ms); } return date3; } function createUTCDate(y2) { var date3, args; if (y2 < 100 && y2 >= 0) { args = Array.prototype.slice.call(arguments); args[0] = y2 + 400; date3 = new Date(Date.UTC.apply(null, args)); if (isFinite(date3.getUTCFullYear())) { date3.setUTCFullYear(y2); } } else { date3 = new Date(Date.UTC.apply(null, arguments)); } return date3; } function firstWeekOffset(year, dow, doy) { var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; return -fwdlw + fwd - 1; } function dayOfYearFromWeeks(year, week, weekday, dow, doy) { var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear; if (dayOfYear <= 0) { resYear = year - 1; resDayOfYear = daysInYear(resYear) + dayOfYear; } else if (dayOfYear > daysInYear(year)) { resYear = year + 1; resDayOfYear = dayOfYear - daysInYear(year); } else { resYear = year; resDayOfYear = dayOfYear; } return { year: resYear, dayOfYear: resDayOfYear }; } function weekOfYear(mom, dow, doy) { var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear; if (week < 1) { resYear = mom.year() - 1; resWeek = week + weeksInYear(resYear, dow, doy); } else if (week > weeksInYear(mom.year(), dow, doy)) { resWeek = week - weeksInYear(mom.year(), dow, doy); resYear = mom.year() + 1; } else { resYear = mom.year(); resWeek = week; } return { week: resWeek, year: resYear }; } function weeksInYear(year, dow, doy) { var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy); return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; } addFormatToken("w", ["ww", 2], "wo", "week"); addFormatToken("W", ["WW", 2], "Wo", "isoWeek"); addUnitAlias("week", "w"); addUnitAlias("isoWeek", "W"); addUnitPriority("week", 5); addUnitPriority("isoWeek", 5); addRegexToken("w", match1to2); addRegexToken("ww", match1to2, match2); addRegexToken("W", match1to2); addRegexToken("WW", match1to2, match2); addWeekParseToken(["w", "ww", "W", "WW"], function(input, week, config3, token2) { week[token2.substr(0, 1)] = toInt(input); }); function localeWeek(mom) { return weekOfYear(mom, this._week.dow, this._week.doy).week; } var defaultLocaleWeek = { dow: 0, doy: 6 }; function localeFirstDayOfWeek() { return this._week.dow; } function localeFirstDayOfYear() { return this._week.doy; } function getSetWeek(input) { var week = this.localeData().week(this); return input == null ? week : this.add((input - week) * 7, "d"); } function getSetISOWeek(input) { var week = weekOfYear(this, 1, 4).week; return input == null ? week : this.add((input - week) * 7, "d"); } addFormatToken("d", 0, "do", "day"); addFormatToken("dd", 0, 0, function(format3) { return this.localeData().weekdaysMin(this, format3); }); addFormatToken("ddd", 0, 0, function(format3) { return this.localeData().weekdaysShort(this, format3); }); addFormatToken("dddd", 0, 0, function(format3) { return this.localeData().weekdays(this, format3); }); addFormatToken("e", 0, 0, "weekday"); addFormatToken("E", 0, 0, "isoWeekday"); addUnitAlias("day", "d"); addUnitAlias("weekday", "e"); addUnitAlias("isoWeekday", "E"); addUnitPriority("day", 11); addUnitPriority("weekday", 11); addUnitPriority("isoWeekday", 11); addRegexToken("d", match1to2); addRegexToken("e", match1to2); addRegexToken("E", match1to2); addRegexToken("dd", function(isStrict, locale2) { return locale2.weekdaysMinRegex(isStrict); }); addRegexToken("ddd", function(isStrict, locale2) { return locale2.weekdaysShortRegex(isStrict); }); addRegexToken("dddd", function(isStrict, locale2) { return locale2.weekdaysRegex(isStrict); }); addWeekParseToken(["dd", "ddd", "dddd"], function(input, week, config3, token2) { var weekday = config3._locale.weekdaysParse(input, token2, config3._strict); if (weekday != null) { week.d = weekday; } else { getParsingFlags(config3).invalidWeekday = input; } }); addWeekParseToken(["d", "e", "E"], function(input, week, config3, token2) { week[token2] = toInt(input); }); function parseWeekday(input, locale2) { if (typeof input !== "string") { return input; } if (!isNaN(input)) { return parseInt(input, 10); } input = locale2.weekdaysParse(input); if (typeof input === "number") { return input; } return null; } function parseIsoWeekday(input, locale2) { if (typeof input === "string") { return locale2.weekdaysParse(input) % 7 || 7; } return isNaN(input) ? null : input; } function shiftWeekdays(ws, n2) { return ws.slice(n2, 7).concat(ws.slice(0, n2)); } var defaultLocaleWeekdays = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), defaultWeekdaysRegex = matchWord, defaultWeekdaysShortRegex = matchWord, defaultWeekdaysMinRegex = matchWord; function localeWeekdays(m2, format3) { var weekdays = isArray$9(this._weekdays) ? this._weekdays : this._weekdays[m2 && m2 !== true && this._weekdays.isFormat.test(format3) ? "format" : "standalone"]; return m2 === true ? shiftWeekdays(weekdays, this._week.dow) : m2 ? weekdays[m2.day()] : weekdays; } function localeWeekdaysShort(m2) { return m2 === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m2 ? this._weekdaysShort[m2.day()] : this._weekdaysShort; } function localeWeekdaysMin(m2) { return m2 === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m2 ? this._weekdaysMin[m2.day()] : this._weekdaysMin; } function handleStrictParse$1(weekdayName, format3, strict) { var i2, ii, mom, llc = weekdayName.toLocaleLowerCase(); if (!this._weekdaysParse) { this._weekdaysParse = []; this._shortWeekdaysParse = []; this._minWeekdaysParse = []; for (i2 = 0; i2 < 7; ++i2) { mom = createUTC([2e3, 1]).day(i2); this._minWeekdaysParse[i2] = this.weekdaysMin(mom, "").toLocaleLowerCase(); this._shortWeekdaysParse[i2] = this.weekdaysShort(mom, "").toLocaleLowerCase(); this._weekdaysParse[i2] = this.weekdays(mom, "").toLocaleLowerCase(); } } if (strict) { if (format3 === "dddd") { ii = indexOf$2.call(this._weekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format3 === "ddd") { ii = indexOf$2.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf$2.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } } else { if (format3 === "dddd") { ii = indexOf$2.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf$2.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf$2.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format3 === "ddd") { ii = indexOf$2.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf$2.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf$2.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf$2.call(this._minWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf$2.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf$2.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } } } function localeWeekdaysParse(weekdayName, format3, strict) { var i2, mom, regex2; if (this._weekdaysParseExact) { return handleStrictParse$1.call(this, weekdayName, format3, strict); } if (!this._weekdaysParse) { this._weekdaysParse = []; this._minWeekdaysParse = []; this._shortWeekdaysParse = []; this._fullWeekdaysParse = []; } for (i2 = 0; i2 < 7; i2++) { mom = createUTC([2e3, 1]).day(i2); if (strict && !this._fullWeekdaysParse[i2]) { this._fullWeekdaysParse[i2] = new RegExp("^" + this.weekdays(mom, "").replace(".", "\\.?") + "$", "i"); this._shortWeekdaysParse[i2] = new RegExp("^" + this.weekdaysShort(mom, "").replace(".", "\\.?") + "$", "i"); this._minWeekdaysParse[i2] = new RegExp("^" + this.weekdaysMin(mom, "").replace(".", "\\.?") + "$", "i"); } if (!this._weekdaysParse[i2]) { regex2 = "^" + this.weekdays(mom, "") + "|^" + this.weekdaysShort(mom, "") + "|^" + this.weekdaysMin(mom, ""); this._weekdaysParse[i2] = new RegExp(regex2.replace(".", ""), "i"); } if (strict && format3 === "dddd" && this._fullWeekdaysParse[i2].test(weekdayName)) { return i2; } else if (strict && format3 === "ddd" && this._shortWeekdaysParse[i2].test(weekdayName)) { return i2; } else if (strict && format3 === "dd" && this._minWeekdaysParse[i2].test(weekdayName)) { return i2; } else if (!strict && this._weekdaysParse[i2].test(weekdayName)) { return i2; } } } function getSetDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); if (input != null) { input = parseWeekday(input, this.localeData()); return this.add(input - day, "d"); } else { return day; } } function getSetLocaleDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; return input == null ? weekday : this.add(input - weekday, "d"); } function getSetISODayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { var weekday = parseIsoWeekday(input, this.localeData()); return this.day(this.day() % 7 ? weekday : weekday - 7); } else { return this.day() || 7; } } function weekdaysRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, "_weekdaysRegex")) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysStrictRegex; } else { return this._weekdaysRegex; } } else { if (!hasOwnProp(this, "_weekdaysRegex")) { this._weekdaysRegex = defaultWeekdaysRegex; } return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex; } } function weekdaysShortRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, "_weekdaysRegex")) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysShortStrictRegex; } else { return this._weekdaysShortRegex; } } else { if (!hasOwnProp(this, "_weekdaysShortRegex")) { this._weekdaysShortRegex = defaultWeekdaysShortRegex; } return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex; } } function weekdaysMinRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, "_weekdaysRegex")) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysMinStrictRegex; } else { return this._weekdaysMinRegex; } } else { if (!hasOwnProp(this, "_weekdaysMinRegex")) { this._weekdaysMinRegex = defaultWeekdaysMinRegex; } return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex; } } function computeWeekdaysParse() { function cmpLenRev(a2, b2) { return b2.length - a2.length; } var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i2, mom, minp, shortp, longp; for (i2 = 0; i2 < 7; i2++) { mom = createUTC([2e3, 1]).day(i2); minp = regexEscape(this.weekdaysMin(mom, "")); shortp = regexEscape(this.weekdaysShort(mom, "")); longp = regexEscape(this.weekdays(mom, "")); minPieces.push(minp); shortPieces.push(shortp); longPieces.push(longp); mixedPieces.push(minp); mixedPieces.push(shortp); mixedPieces.push(longp); } minPieces.sort(cmpLenRev); shortPieces.sort(cmpLenRev); longPieces.sort(cmpLenRev); mixedPieces.sort(cmpLenRev); this._weekdaysRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i"); this._weekdaysShortRegex = this._weekdaysRegex; this._weekdaysMinRegex = this._weekdaysRegex; this._weekdaysStrictRegex = new RegExp("^(" + longPieces.join("|") + ")", "i"); this._weekdaysShortStrictRegex = new RegExp("^(" + shortPieces.join("|") + ")", "i"); this._weekdaysMinStrictRegex = new RegExp("^(" + minPieces.join("|") + ")", "i"); } function hFormat() { return this.hours() % 12 || 12; } function kFormat() { return this.hours() || 24; } addFormatToken("H", ["HH", 2], 0, "hour"); addFormatToken("h", ["hh", 2], 0, hFormat); addFormatToken("k", ["kk", 2], 0, kFormat); addFormatToken("hmm", 0, 0, function() { return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2); }); addFormatToken("hmmss", 0, 0, function() { return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); }); addFormatToken("Hmm", 0, 0, function() { return "" + this.hours() + zeroFill(this.minutes(), 2); }); addFormatToken("Hmmss", 0, 0, function() { return "" + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); }); function meridiem(token2, lowercase) { addFormatToken(token2, 0, 0, function() { return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); }); } meridiem("a", true); meridiem("A", false); addUnitAlias("hour", "h"); addUnitPriority("hour", 13); function matchMeridiem(isStrict, locale2) { return locale2._meridiemParse; } addRegexToken("a", matchMeridiem); addRegexToken("A", matchMeridiem); addRegexToken("H", match1to2); addRegexToken("h", match1to2); addRegexToken("k", match1to2); addRegexToken("HH", match1to2, match2); addRegexToken("hh", match1to2, match2); addRegexToken("kk", match1to2, match2); addRegexToken("hmm", match3to4); addRegexToken("hmmss", match5to6); addRegexToken("Hmm", match3to4); addRegexToken("Hmmss", match5to6); addParseToken(["H", "HH"], HOUR); addParseToken(["k", "kk"], function(input, array3, config3) { var kInput = toInt(input); array3[HOUR] = kInput === 24 ? 0 : kInput; }); addParseToken(["a", "A"], function(input, array3, config3) { config3._isPm = config3._locale.isPM(input); config3._meridiem = input; }); addParseToken(["h", "hh"], function(input, array3, config3) { array3[HOUR] = toInt(input); getParsingFlags(config3).bigHour = true; }); addParseToken("hmm", function(input, array3, config3) { var pos = input.length - 2; array3[HOUR] = toInt(input.substr(0, pos)); array3[MINUTE] = toInt(input.substr(pos)); getParsingFlags(config3).bigHour = true; }); addParseToken("hmmss", function(input, array3, config3) { var pos1 = input.length - 4, pos2 = input.length - 2; array3[HOUR] = toInt(input.substr(0, pos1)); array3[MINUTE] = toInt(input.substr(pos1, 2)); array3[SECOND] = toInt(input.substr(pos2)); getParsingFlags(config3).bigHour = true; }); addParseToken("Hmm", function(input, array3, config3) { var pos = input.length - 2; array3[HOUR] = toInt(input.substr(0, pos)); array3[MINUTE] = toInt(input.substr(pos)); }); addParseToken("Hmmss", function(input, array3, config3) { var pos1 = input.length - 4, pos2 = input.length - 2; array3[HOUR] = toInt(input.substr(0, pos1)); array3[MINUTE] = toInt(input.substr(pos1, 2)); array3[SECOND] = toInt(input.substr(pos2)); }); function localeIsPM(input) { return (input + "").toLowerCase().charAt(0) === "p"; } var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, getSetHour = makeGetSet("Hours", true); function localeMeridiem(hours2, minutes2, isLower) { if (hours2 > 11) { return isLower ? "pm" : "PM"; } else { return isLower ? "am" : "AM"; } } var baseConfig = { calendar: defaultCalendar, longDateFormat: defaultLongDateFormat, invalidDate: defaultInvalidDate, ordinal: defaultOrdinal, dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, relativeTime: defaultRelativeTime, months: defaultLocaleMonths, monthsShort: defaultLocaleMonthsShort, week: defaultLocaleWeek, weekdays: defaultLocaleWeekdays, weekdaysMin: defaultLocaleWeekdaysMin, weekdaysShort: defaultLocaleWeekdaysShort, meridiemParse: defaultLocaleMeridiemParse }; var locales = {}, localeFamilies = {}, globalLocale; function commonPrefix(arr1, arr2) { var i2, minl = Math.min(arr1.length, arr2.length); for (i2 = 0; i2 < minl; i2 += 1) { if (arr1[i2] !== arr2[i2]) { return i2; } } return minl; } function normalizeLocale(key2) { return key2 ? key2.toLowerCase().replace("_", "-") : key2; } function chooseLocale(names2) { var i2 = 0, j2, next2, locale2, split2; while (i2 < names2.length) { split2 = normalizeLocale(names2[i2]).split("-"); j2 = split2.length; next2 = normalizeLocale(names2[i2 + 1]); next2 = next2 ? next2.split("-") : null; while (j2 > 0) { locale2 = loadLocale(split2.slice(0, j2).join("-")); if (locale2) { return locale2; } if (next2 && next2.length >= j2 && commonPrefix(split2, next2) >= j2 - 1) { break; } j2--; } i2++; } return globalLocale; } function isLocaleNameSane(name) { return name.match("^[^/\\\\]*$") != null; } function loadLocale(name) { var oldLocale = null, aliasedRequire; if (locales[name] === void 0 && typeof module !== "undefined" && module && module.exports && isLocaleNameSane(name)) { try { oldLocale = globalLocale._abbr; aliasedRequire = require; aliasedRequire("./locale/" + name); getSetGlobalLocale(oldLocale); } catch (e2) { locales[name] = null; } } return locales[name]; } function getSetGlobalLocale(key2, values2) { var data65; if (key2) { if (isUndefined$1(values2)) { data65 = getLocale(key2); } else { data65 = defineLocale(key2, values2); } if (data65) { globalLocale = data65; } else { if (typeof console !== "undefined" && console.warn) { console.warn("Locale " + key2 + " not found. Did you forget to load it?"); } } } return globalLocale._abbr; } function defineLocale(name, config3) { if (config3 !== null) { var locale2, parentConfig = baseConfig; config3.abbr = name; if (locales[name] != null) { deprecateSimple("defineLocaleOverride", "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."); parentConfig = locales[name]._config; } else if (config3.parentLocale != null) { if (locales[config3.parentLocale] != null) { parentConfig = locales[config3.parentLocale]._config; } else { locale2 = loadLocale(config3.parentLocale); if (locale2 != null) { parentConfig = locale2._config; } else { if (!localeFamilies[config3.parentLocale]) { localeFamilies[config3.parentLocale] = []; } localeFamilies[config3.parentLocale].push({ name, config: config3 }); return null; } } } locales[name] = new Locale(mergeConfigs(parentConfig, config3)); if (localeFamilies[name]) { localeFamilies[name].forEach(function(x2) { defineLocale(x2.name, x2.config); }); } getSetGlobalLocale(name); return locales[name]; } else { delete locales[name]; return null; } } function updateLocale(name, config3) { if (config3 != null) { var locale2, tmpLocale, parentConfig = baseConfig; if (locales[name] != null && locales[name].parentLocale != null) { locales[name].set(mergeConfigs(locales[name]._config, config3)); } else { tmpLocale = loadLocale(name); if (tmpLocale != null) { parentConfig = tmpLocale._config; } config3 = mergeConfigs(parentConfig, config3); if (tmpLocale == null) { config3.abbr = name; } locale2 = new Locale(config3); locale2.parentLocale = locales[name]; locales[name] = locale2; } getSetGlobalLocale(name); } else { if (locales[name] != null) { if (locales[name].parentLocale != null) { locales[name] = locales[name].parentLocale; if (name === getSetGlobalLocale()) { getSetGlobalLocale(name); } } else if (locales[name] != null) { delete locales[name]; } } } return locales[name]; } function getLocale(key2) { var locale2; if (key2 && key2._locale && key2._locale._abbr) { key2 = key2._locale._abbr; } if (!key2) { return globalLocale; } if (!isArray$9(key2)) { locale2 = loadLocale(key2); if (locale2) { return locale2; } key2 = [key2]; } return chooseLocale(key2); } function listLocales() { return keys$1(locales); } function checkOverflow(m2) { var overflow, a2 = m2._a; if (a2 && getParsingFlags(m2).overflow === -2) { overflow = a2[MONTH] < 0 || a2[MONTH] > 11 ? MONTH : a2[DATE] < 1 || a2[DATE] > daysInMonth(a2[YEAR], a2[MONTH]) ? DATE : a2[HOUR] < 0 || a2[HOUR] > 24 || a2[HOUR] === 24 && (a2[MINUTE] !== 0 || a2[SECOND] !== 0 || a2[MILLISECOND] !== 0) ? HOUR : a2[MINUTE] < 0 || a2[MINUTE] > 59 ? MINUTE : a2[SECOND] < 0 || a2[SECOND] > 59 ? SECOND : a2[MILLISECOND] < 0 || a2[MILLISECOND] > 999 ? MILLISECOND : -1; if (getParsingFlags(m2)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { overflow = DATE; } if (getParsingFlags(m2)._overflowWeeks && overflow === -1) { overflow = WEEK; } if (getParsingFlags(m2)._overflowWeekday && overflow === -1) { overflow = WEEKDAY; } getParsingFlags(m2).overflow = overflow; } return m2; } var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, isoDates = [ ["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/], ["YYYY-MM-DD", /\d{4}-\d\d-\d\d/], ["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/], ["GGGG-[W]WW", /\d{4}-W\d\d/, false], ["YYYY-DDD", /\d{4}-\d{3}/], ["YYYY-MM", /\d{4}-\d\d/, false], ["YYYYYYMMDD", /[+-]\d{10}/], ["YYYYMMDD", /\d{8}/], ["GGGG[W]WWE", /\d{4}W\d{3}/], ["GGGG[W]WW", /\d{4}W\d{2}/, false], ["YYYYDDD", /\d{7}/], ["YYYYMM", /\d{6}/, false], ["YYYY", /\d{4}/, false] ], isoTimes = [ ["HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/], ["HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/], ["HH:mm:ss", /\d\d:\d\d:\d\d/], ["HH:mm", /\d\d:\d\d/], ["HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/], ["HHmmss,SSSS", /\d\d\d\d\d\d,\d+/], ["HHmmss", /\d\d\d\d\d\d/], ["HHmm", /\d\d\d\d/], ["HH", /\d\d/] ], aspNetJsonRegex = /^\/?Date\((-?\d+)/i, rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, obsOffsets = { UT: 0, GMT: 0, EDT: -4 * 60, EST: -5 * 60, CDT: -5 * 60, CST: -6 * 60, MDT: -6 * 60, MST: -7 * 60, PDT: -7 * 60, PST: -8 * 60 }; function configFromISO(config3) { var i2, l2, string2 = config3._i, match5 = extendedIsoRegex.exec(string2) || basicIsoRegex.exec(string2), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length; if (match5) { getParsingFlags(config3).iso = true; for (i2 = 0, l2 = isoDatesLen; i2 < l2; i2++) { if (isoDates[i2][1].exec(match5[1])) { dateFormat = isoDates[i2][0]; allowTime = isoDates[i2][2] !== false; break; } } if (dateFormat == null) { config3._isValid = false; return; } if (match5[3]) { for (i2 = 0, l2 = isoTimesLen; i2 < l2; i2++) { if (isoTimes[i2][1].exec(match5[3])) { timeFormat = (match5[2] || " ") + isoTimes[i2][0]; break; } } if (timeFormat == null) { config3._isValid = false; return; } } if (!allowTime && timeFormat != null) { config3._isValid = false; return; } if (match5[4]) { if (tzRegex.exec(match5[4])) { tzFormat = "Z"; } else { config3._isValid = false; return; } } config3._f = dateFormat + (timeFormat || "") + (tzFormat || ""); configFromStringAndFormat(config3); } else { config3._isValid = false; } } function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { var result = [ untruncateYear(yearStr), defaultLocaleMonthsShort.indexOf(monthStr), parseInt(dayStr, 10), parseInt(hourStr, 10), parseInt(minuteStr, 10) ]; if (secondStr) { result.push(parseInt(secondStr, 10)); } return result; } function untruncateYear(yearStr) { var year = parseInt(yearStr, 10); if (year <= 49) { return 2e3 + year; } else if (year <= 999) { return 1900 + year; } return year; } function preprocessRFC2822(s2) { return s2.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, ""); } function checkWeekday(weekdayStr, parsedInput, config3) { if (weekdayStr) { var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay(); if (weekdayProvided !== weekdayActual) { getParsingFlags(config3).weekdayMismatch = true; config3._isValid = false; return false; } } return true; } function calculateOffset(obsOffset, militaryOffset, numOffset) { if (obsOffset) { return obsOffsets[obsOffset]; } else if (militaryOffset) { return 0; } else { var hm = parseInt(numOffset, 10), m2 = hm % 100, h2 = (hm - m2) / 100; return h2 * 60 + m2; } } function configFromRFC2822(config3) { var match5 = rfc2822.exec(preprocessRFC2822(config3._i)), parsedArray; if (match5) { parsedArray = extractFromRFC2822Strings(match5[4], match5[3], match5[2], match5[5], match5[6], match5[7]); if (!checkWeekday(match5[1], parsedArray, config3)) { return; } config3._a = parsedArray; config3._tzm = calculateOffset(match5[8], match5[9], match5[10]); config3._d = createUTCDate.apply(null, config3._a); config3._d.setUTCMinutes(config3._d.getUTCMinutes() - config3._tzm); getParsingFlags(config3).rfc2822 = true; } else { config3._isValid = false; } } function configFromString(config3) { var matched = aspNetJsonRegex.exec(config3._i); if (matched !== null) { config3._d = new Date(+matched[1]); return; } configFromISO(config3); if (config3._isValid === false) { delete config3._isValid; } else { return; } configFromRFC2822(config3); if (config3._isValid === false) { delete config3._isValid; } else { return; } if (config3._strict) { config3._isValid = false; } else { hooks.createFromInputFallback(config3); } } hooks.createFromInputFallback = deprecate("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.", function(config3) { config3._d = new Date(config3._i + (config3._useUTC ? " UTC" : "")); }); function defaults$8(a2, b2, c2) { if (a2 != null) { return a2; } if (b2 != null) { return b2; } return c2; } function currentDateArray(config3) { var nowValue = new Date(hooks.now()); if (config3._useUTC) { return [ nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate() ]; } return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; } function configFromArray(config3) { var i2, date3, input = [], currentDate, expectedWeekday, yearToUse; if (config3._d) { return; } currentDate = currentDateArray(config3); if (config3._w && config3._a[DATE] == null && config3._a[MONTH] == null) { dayOfYearFromWeekInfo(config3); } if (config3._dayOfYear != null) { yearToUse = defaults$8(config3._a[YEAR], currentDate[YEAR]); if (config3._dayOfYear > daysInYear(yearToUse) || config3._dayOfYear === 0) { getParsingFlags(config3)._overflowDayOfYear = true; } date3 = createUTCDate(yearToUse, 0, config3._dayOfYear); config3._a[MONTH] = date3.getUTCMonth(); config3._a[DATE] = date3.getUTCDate(); } for (i2 = 0; i2 < 3 && config3._a[i2] == null; ++i2) { config3._a[i2] = input[i2] = currentDate[i2]; } for (; i2 < 7; i2++) { config3._a[i2] = input[i2] = config3._a[i2] == null ? i2 === 2 ? 1 : 0 : config3._a[i2]; } if (config3._a[HOUR] === 24 && config3._a[MINUTE] === 0 && config3._a[SECOND] === 0 && config3._a[MILLISECOND] === 0) { config3._nextDay = true; config3._a[HOUR] = 0; } config3._d = (config3._useUTC ? createUTCDate : createDate).apply(null, input); expectedWeekday = config3._useUTC ? config3._d.getUTCDay() : config3._d.getDay(); if (config3._tzm != null) { config3._d.setUTCMinutes(config3._d.getUTCMinutes() - config3._tzm); } if (config3._nextDay) { config3._a[HOUR] = 24; } if (config3._w && typeof config3._w.d !== "undefined" && config3._w.d !== expectedWeekday) { getParsingFlags(config3).weekdayMismatch = true; } } function dayOfYearFromWeekInfo(config3) { var w2, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek; w2 = config3._w; if (w2.GG != null || w2.W != null || w2.E != null) { dow = 1; doy = 4; weekYear = defaults$8(w2.GG, config3._a[YEAR], weekOfYear(createLocal(), 1, 4).year); week = defaults$8(w2.W, 1); weekday = defaults$8(w2.E, 1); if (weekday < 1 || weekday > 7) { weekdayOverflow = true; } } else { dow = config3._locale._week.dow; doy = config3._locale._week.doy; curWeek = weekOfYear(createLocal(), dow, doy); weekYear = defaults$8(w2.gg, config3._a[YEAR], curWeek.year); week = defaults$8(w2.w, curWeek.week); if (w2.d != null) { weekday = w2.d; if (weekday < 0 || weekday > 6) { weekdayOverflow = true; } } else if (w2.e != null) { weekday = w2.e + dow; if (w2.e < 0 || w2.e > 6) { weekdayOverflow = true; } } else { weekday = dow; } } if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { getParsingFlags(config3)._overflowWeeks = true; } else if (weekdayOverflow != null) { getParsingFlags(config3)._overflowWeekday = true; } else { temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); config3._a[YEAR] = temp.year; config3._dayOfYear = temp.dayOfYear; } } hooks.ISO_8601 = function() { }; hooks.RFC_2822 = function() { }; function configFromStringAndFormat(config3) { if (config3._f === hooks.ISO_8601) { configFromISO(config3); return; } if (config3._f === hooks.RFC_2822) { configFromRFC2822(config3); return; } config3._a = []; getParsingFlags(config3).empty = true; var string2 = "" + config3._i, i2, parsedInput, tokens2, token2, skipped, stringLength = string2.length, totalParsedInputLength = 0, era, tokenLen; tokens2 = expandFormat(config3._f, config3._locale).match(formattingTokens) || []; tokenLen = tokens2.length; for (i2 = 0; i2 < tokenLen; i2++) { token2 = tokens2[i2]; parsedInput = (string2.match(getParseRegexForToken(token2, config3)) || [])[0]; if (parsedInput) { skipped = string2.substr(0, string2.indexOf(parsedInput)); if (skipped.length > 0) { getParsingFlags(config3).unusedInput.push(skipped); } string2 = string2.slice(string2.indexOf(parsedInput) + parsedInput.length); totalParsedInputLength += parsedInput.length; } if (formatTokenFunctions[token2]) { if (parsedInput) { getParsingFlags(config3).empty = false; } else { getParsingFlags(config3).unusedTokens.push(token2); } addTimeToArrayFromToken(token2, parsedInput, config3); } else if (config3._strict && !parsedInput) { getParsingFlags(config3).unusedTokens.push(token2); } } getParsingFlags(config3).charsLeftOver = stringLength - totalParsedInputLength; if (string2.length > 0) { getParsingFlags(config3).unusedInput.push(string2); } if (config3._a[HOUR] <= 12 && getParsingFlags(config3).bigHour === true && config3._a[HOUR] > 0) { getParsingFlags(config3).bigHour = void 0; } getParsingFlags(config3).parsedDateParts = config3._a.slice(0); getParsingFlags(config3).meridiem = config3._meridiem; config3._a[HOUR] = meridiemFixWrap(config3._locale, config3._a[HOUR], config3._meridiem); era = getParsingFlags(config3).era; if (era !== null) { config3._a[YEAR] = config3._locale.erasConvertYear(era, config3._a[YEAR]); } configFromArray(config3); checkOverflow(config3); } function meridiemFixWrap(locale2, hour2, meridiem2) { var isPm; if (meridiem2 == null) { return hour2; } if (locale2.meridiemHour != null) { return locale2.meridiemHour(hour2, meridiem2); } else if (locale2.isPM != null) { isPm = locale2.isPM(meridiem2); if (isPm && hour2 < 12) { hour2 += 12; } if (!isPm && hour2 === 12) { hour2 = 0; } return hour2; } else { return hour2; } } function configFromStringAndArray(config3) { var tempConfig, bestMoment, scoreToBeat, i2, currentScore, validFormatFound, bestFormatIsValid = false, configfLen = config3._f.length; if (configfLen === 0) { getParsingFlags(config3).invalidFormat = true; config3._d = new Date(NaN); return; } for (i2 = 0; i2 < configfLen; i2++) { currentScore = 0; validFormatFound = false; tempConfig = copyConfig({}, config3); if (config3._useUTC != null) { tempConfig._useUTC = config3._useUTC; } tempConfig._f = config3._f[i2]; configFromStringAndFormat(tempConfig); if (isValid$2(tempConfig)) { validFormatFound = true; } currentScore += getParsingFlags(tempConfig).charsLeftOver; currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; getParsingFlags(tempConfig).score = currentScore; if (!bestFormatIsValid) { if (scoreToBeat == null || currentScore < scoreToBeat || validFormatFound) { scoreToBeat = currentScore; bestMoment = tempConfig; if (validFormatFound) { bestFormatIsValid = true; } } } else { if (currentScore < scoreToBeat) { scoreToBeat = currentScore; bestMoment = tempConfig; } } } extend$2(config3, bestMoment || tempConfig); } function configFromObject(config3) { if (config3._d) { return; } var i2 = normalizeObjectUnits(config3._i), dayOrDate = i2.day === void 0 ? i2.date : i2.day; config3._a = map([i2.year, i2.month, dayOrDate, i2.hour, i2.minute, i2.second, i2.millisecond], function(obj) { return obj && parseInt(obj, 10); }); configFromArray(config3); } function createFromConfig(config3) { var res = new Moment(checkOverflow(prepareConfig(config3))); if (res._nextDay) { res.add(1, "d"); res._nextDay = void 0; } return res; } function prepareConfig(config3) { var input = config3._i, format3 = config3._f; config3._locale = config3._locale || getLocale(config3._l); if (input === null || format3 === void 0 && input === "") { return createInvalid({ nullInput: true }); } if (typeof input === "string") { config3._i = input = config3._locale.preparse(input); } if (isMoment$1(input)) { return new Moment(checkOverflow(input)); } else if (isDate$2(input)) { config3._d = input; } else if (isArray$9(format3)) { configFromStringAndArray(config3); } else if (format3) { configFromStringAndFormat(config3); } else { configFromInput(config3); } if (!isValid$2(config3)) { config3._d = null; } return config3; } function configFromInput(config3) { var input = config3._i; if (isUndefined$1(input)) { config3._d = new Date(hooks.now()); } else if (isDate$2(input)) { config3._d = new Date(input.valueOf()); } else if (typeof input === "string") { configFromString(config3); } else if (isArray$9(input)) { config3._a = map(input.slice(0), function(obj) { return parseInt(obj, 10); }); configFromArray(config3); } else if (isObject$5(input)) { configFromObject(config3); } else if (isNumber$4(input)) { config3._d = new Date(input); } else { hooks.createFromInputFallback(config3); } } function createLocalOrUTC(input, format3, locale2, strict, isUTC) { var c2 = {}; if (format3 === true || format3 === false) { strict = format3; format3 = void 0; } if (locale2 === true || locale2 === false) { strict = locale2; locale2 = void 0; } if (isObject$5(input) && isObjectEmpty(input) || isArray$9(input) && input.length === 0) { input = void 0; } c2._isAMomentObject = true; c2._useUTC = c2._isUTC = isUTC; c2._l = locale2; c2._i = input; c2._f = format3; c2._strict = strict; return createFromConfig(c2); } function createLocal(input, format3, locale2, strict) { return createLocalOrUTC(input, format3, locale2, strict, false); } var prototypeMin = deprecate("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/", function() { var other = createLocal.apply(null, arguments); if (this.isValid() && other.isValid()) { return other < this ? this : other; } else { return createInvalid(); } }), prototypeMax = deprecate("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/", function() { var other = createLocal.apply(null, arguments); if (this.isValid() && other.isValid()) { return other > this ? this : other; } else { return createInvalid(); } }); function pickBy(fn, moments) { var res, i2; if (moments.length === 1 && isArray$9(moments[0])) { moments = moments[0]; } if (!moments.length) { return createLocal(); } res = moments[0]; for (i2 = 1; i2 < moments.length; ++i2) { if (!moments[i2].isValid() || moments[i2][fn](res)) { res = moments[i2]; } } return res; } function min() { var args = [].slice.call(arguments, 0); return pickBy("isBefore", args); } function max() { var args = [].slice.call(arguments, 0); return pickBy("isAfter", args); } var now$4 = function() { return Date.now ? Date.now() : +new Date(); }; var ordering = [ "year", "quarter", "month", "week", "day", "hour", "minute", "second", "millisecond" ]; function isDurationValid(m2) { var key2, unitHasDecimal = false, i2, orderLen = ordering.length; for (key2 in m2) { if (hasOwnProp(m2, key2) && !(indexOf$2.call(ordering, key2) !== -1 && (m2[key2] == null || !isNaN(m2[key2])))) { return false; } } for (i2 = 0; i2 < orderLen; ++i2) { if (m2[ordering[i2]]) { if (unitHasDecimal) { return false; } if (parseFloat(m2[ordering[i2]]) !== toInt(m2[ordering[i2]])) { unitHasDecimal = true; } } } return true; } function isValid$1$1() { return this._isValid; } function createInvalid$1() { return createDuration(NaN); } function Duration(duration2) { var normalizedInput = normalizeObjectUnits(duration2), years3 = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months3 = normalizedInput.month || 0, weeks2 = normalizedInput.week || normalizedInput.isoWeek || 0, days2 = normalizedInput.day || 0, hours2 = normalizedInput.hour || 0, minutes2 = normalizedInput.minute || 0, seconds2 = normalizedInput.second || 0, milliseconds2 = normalizedInput.millisecond || 0; this._isValid = isDurationValid(normalizedInput); this._milliseconds = +milliseconds2 + seconds2 * 1e3 + minutes2 * 6e4 + hours2 * 1e3 * 60 * 60; this._days = +days2 + weeks2 * 7; this._months = +months3 + quarters * 3 + years3 * 12; this._data = {}; this._locale = getLocale(); this._bubble(); } function isDuration(obj) { return obj instanceof Duration; } function absRound(number3) { if (number3 < 0) { return Math.round(-1 * number3) * -1; } else { return Math.round(number3); } } function compareArrays(array1, array22, dontConvert) { var len = Math.min(array1.length, array22.length), lengthDiff = Math.abs(array1.length - array22.length), diffs = 0, i2; for (i2 = 0; i2 < len; i2++) { if (dontConvert && array1[i2] !== array22[i2] || !dontConvert && toInt(array1[i2]) !== toInt(array22[i2])) { diffs++; } } return diffs + lengthDiff; } function offset$1(token2, separator2) { addFormatToken(token2, 0, 0, function() { var offset4 = this.utcOffset(), sign2 = "+"; if (offset4 < 0) { offset4 = -offset4; sign2 = "-"; } return sign2 + zeroFill(~~(offset4 / 60), 2) + separator2 + zeroFill(~~offset4 % 60, 2); }); } offset$1("Z", ":"); offset$1("ZZ", ""); addRegexToken("Z", matchShortOffset); addRegexToken("ZZ", matchShortOffset); addParseToken(["Z", "ZZ"], function(input, array3, config3) { config3._useUTC = true; config3._tzm = offsetFromString(matchShortOffset, input); }); var chunkOffset = /([\+\-]|\d\d)/gi; function offsetFromString(matcher, string2) { var matches = (string2 || "").match(matcher), chunk, parts, minutes2; if (matches === null) { return null; } chunk = matches[matches.length - 1] || []; parts = (chunk + "").match(chunkOffset) || ["-", 0, 0]; minutes2 = +(parts[1] * 60) + toInt(parts[2]); return minutes2 === 0 ? 0 : parts[0] === "+" ? minutes2 : -minutes2; } function cloneWithOffset(input, model) { var res, diff2; if (model._isUTC) { res = model.clone(); diff2 = (isMoment$1(input) || isDate$2(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); res._d.setTime(res._d.valueOf() + diff2); hooks.updateOffset(res, false); return res; } else { return createLocal(input).local(); } } function getDateOffset(m2) { return -Math.round(m2._d.getTimezoneOffset()); } hooks.updateOffset = function() { }; function getSetOffset(input, keepLocalTime, keepMinutes) { var offset4 = this._offset || 0, localAdjust; if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { if (typeof input === "string") { input = offsetFromString(matchShortOffset, input); if (input === null) { return this; } } else if (Math.abs(input) < 16 && !keepMinutes) { input = input * 60; } if (!this._isUTC && keepLocalTime) { localAdjust = getDateOffset(this); } this._offset = input; this._isUTC = true; if (localAdjust != null) { this.add(localAdjust, "m"); } if (offset4 !== input) { if (!keepLocalTime || this._changeInProgress) { addSubtract(this, createDuration(input - offset4, "m"), 1, false); } else if (!this._changeInProgress) { this._changeInProgress = true; hooks.updateOffset(this, true); this._changeInProgress = null; } } return this; } else { return this._isUTC ? offset4 : getDateOffset(this); } } function getSetZone(input, keepLocalTime) { if (input != null) { if (typeof input !== "string") { input = -input; } this.utcOffset(input, keepLocalTime); return this; } else { return -this.utcOffset(); } } function setOffsetToUTC(keepLocalTime) { return this.utcOffset(0, keepLocalTime); } function setOffsetToLocal(keepLocalTime) { if (this._isUTC) { this.utcOffset(0, keepLocalTime); this._isUTC = false; if (keepLocalTime) { this.subtract(getDateOffset(this), "m"); } } return this; } function setOffsetToParsedOffset() { if (this._tzm != null) { this.utcOffset(this._tzm, false, true); } else if (typeof this._i === "string") { var tZone = offsetFromString(matchOffset, this._i); if (tZone != null) { this.utcOffset(tZone); } else { this.utcOffset(0, true); } } return this; } function hasAlignedHourOffset(input) { if (!this.isValid()) { return false; } input = input ? createLocal(input).utcOffset() : 0; return (this.utcOffset() - input) % 60 === 0; } function isDaylightSavingTime() { return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset(); } function isDaylightSavingTimeShifted() { if (!isUndefined$1(this._isDSTShifted)) { return this._isDSTShifted; } var c2 = {}, other; copyConfig(c2, this); c2 = prepareConfig(c2); if (c2._a) { other = c2._isUTC ? createUTC(c2._a) : createLocal(c2._a); this._isDSTShifted = this.isValid() && compareArrays(c2._a, other.toArray()) > 0; } else { this._isDSTShifted = false; } return this._isDSTShifted; } function isLocal() { return this.isValid() ? !this._isUTC : false; } function isUtcOffset() { return this.isValid() ? this._isUTC : false; } function isUtc() { return this.isValid() ? this._isUTC && this._offset === 0 : false; } var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; function createDuration(input, key2) { var duration2 = input, match5 = null, sign2, ret, diffRes; if (isDuration(input)) { duration2 = { ms: input._milliseconds, d: input._days, M: input._months }; } else if (isNumber$4(input) || !isNaN(+input)) { duration2 = {}; if (key2) { duration2[key2] = +input; } else { duration2.milliseconds = +input; } } else if (match5 = aspNetRegex.exec(input)) { sign2 = match5[1] === "-" ? -1 : 1; duration2 = { y: 0, d: toInt(match5[DATE]) * sign2, h: toInt(match5[HOUR]) * sign2, m: toInt(match5[MINUTE]) * sign2, s: toInt(match5[SECOND]) * sign2, ms: toInt(absRound(match5[MILLISECOND] * 1e3)) * sign2 }; } else if (match5 = isoRegex.exec(input)) { sign2 = match5[1] === "-" ? -1 : 1; duration2 = { y: parseIso(match5[2], sign2), M: parseIso(match5[3], sign2), w: parseIso(match5[4], sign2), d: parseIso(match5[5], sign2), h: parseIso(match5[6], sign2), m: parseIso(match5[7], sign2), s: parseIso(match5[8], sign2) }; } else if (duration2 == null) { duration2 = {}; } else if (typeof duration2 === "object" && ("from" in duration2 || "to" in duration2)) { diffRes = momentsDifference(createLocal(duration2.from), createLocal(duration2.to)); duration2 = {}; duration2.ms = diffRes.milliseconds; duration2.M = diffRes.months; } ret = new Duration(duration2); if (isDuration(input) && hasOwnProp(input, "_locale")) { ret._locale = input._locale; } if (isDuration(input) && hasOwnProp(input, "_isValid")) { ret._isValid = input._isValid; } return ret; } createDuration.fn = Duration.prototype; createDuration.invalid = createInvalid$1; function parseIso(inp, sign2) { var res = inp && parseFloat(inp.replace(",", ".")); return (isNaN(res) ? 0 : res) * sign2; } function positiveMomentsDifference(base, other) { var res = {}; res.months = other.month() - base.month() + (other.year() - base.year()) * 12; if (base.clone().add(res.months, "M").isAfter(other)) { --res.months; } res.milliseconds = +other - +base.clone().add(res.months, "M"); return res; } function momentsDifference(base, other) { var res; if (!(base.isValid() && other.isValid())) { return { milliseconds: 0, months: 0 }; } other = cloneWithOffset(other, base); if (base.isBefore(other)) { res = positiveMomentsDifference(base, other); } else { res = positiveMomentsDifference(other, base); res.milliseconds = -res.milliseconds; res.months = -res.months; } return res; } function createAdder(direction, name) { return function(val, period) { var dur, tmp; if (period !== null && !isNaN(+period)) { deprecateSimple(name, "moment()." + name + "(period, number) is deprecated. Please use moment()." + name + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."); tmp = val; val = period; period = tmp; } dur = createDuration(val, period); addSubtract(this, dur, direction); return this; }; } function addSubtract(mom, duration2, isAdding, updateOffset) { var milliseconds2 = duration2._milliseconds, days2 = absRound(duration2._days), months3 = absRound(duration2._months); if (!mom.isValid()) { return; } updateOffset = updateOffset == null ? true : updateOffset; if (months3) { setMonth(mom, get$1(mom, "Month") + months3 * isAdding); } if (days2) { set$1$1(mom, "Date", get$1(mom, "Date") + days2 * isAdding); } if (milliseconds2) { mom._d.setTime(mom._d.valueOf() + milliseconds2 * isAdding); } if (updateOffset) { hooks.updateOffset(mom, days2 || months3); } } var add$1 = createAdder(1, "add"), subtract = createAdder(-1, "subtract"); function isString$4(input) { return typeof input === "string" || input instanceof String; } function isMomentInput(input) { return isMoment$1(input) || isDate$2(input) || isString$4(input) || isNumber$4(input) || isNumberOrStringArray(input) || isMomentInputObject(input) || input === null || input === void 0; } function isMomentInputObject(input) { var objectTest = isObject$5(input) && !isObjectEmpty(input), propertyTest = false, properties = [ "years", "year", "y", "months", "month", "M", "days", "day", "d", "dates", "date", "D", "hours", "hour", "h", "minutes", "minute", "m", "seconds", "second", "s", "milliseconds", "millisecond", "ms" ], i2, property2, propertyLen = properties.length; for (i2 = 0; i2 < propertyLen; i2 += 1) { property2 = properties[i2]; propertyTest = propertyTest || hasOwnProp(input, property2); } return objectTest && propertyTest; } function isNumberOrStringArray(input) { var arrayTest = isArray$9(input), dataTypeTest = false; if (arrayTest) { dataTypeTest = input.filter(function(item) { return !isNumber$4(item) && isString$4(input); }).length === 0; } return arrayTest && dataTypeTest; } function isCalendarSpec(input) { var objectTest = isObject$5(input) && !isObjectEmpty(input), propertyTest = false, properties = [ "sameDay", "nextDay", "lastDay", "nextWeek", "lastWeek", "sameElse" ], i2, property2; for (i2 = 0; i2 < properties.length; i2 += 1) { property2 = properties[i2]; propertyTest = propertyTest || hasOwnProp(input, property2); } return objectTest && propertyTest; } function getCalendarFormat(myMoment, now2) { var diff2 = myMoment.diff(now2, "days", true); return diff2 < -6 ? "sameElse" : diff2 < -1 ? "lastWeek" : diff2 < 0 ? "lastDay" : diff2 < 1 ? "sameDay" : diff2 < 2 ? "nextDay" : diff2 < 7 ? "nextWeek" : "sameElse"; } function calendar$1(time, formats2) { if (arguments.length === 1) { if (!arguments[0]) { time = void 0; formats2 = void 0; } else if (isMomentInput(arguments[0])) { time = arguments[0]; formats2 = void 0; } else if (isCalendarSpec(arguments[0])) { formats2 = arguments[0]; time = void 0; } } var now2 = time || createLocal(), sod = cloneWithOffset(now2, this).startOf("day"), format3 = hooks.calendarFormat(this, sod) || "sameElse", output = formats2 && (isFunction$4(formats2[format3]) ? formats2[format3].call(this, now2) : formats2[format3]); return this.format(output || this.localeData().calendar(format3, this, createLocal(now2))); } function clone$1() { return new Moment(this); } function isAfter(input, units) { var localInput = isMoment$1(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || "millisecond"; if (units === "millisecond") { return this.valueOf() > localInput.valueOf(); } else { return localInput.valueOf() < this.clone().startOf(units).valueOf(); } } function isBefore(input, units) { var localInput = isMoment$1(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || "millisecond"; if (units === "millisecond") { return this.valueOf() < localInput.valueOf(); } else { return this.clone().endOf(units).valueOf() < localInput.valueOf(); } } function isBetween(from2, to2, units, inclusivity) { var localFrom = isMoment$1(from2) ? from2 : createLocal(from2), localTo = isMoment$1(to2) ? to2 : createLocal(to2); if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { return false; } inclusivity = inclusivity || "()"; return (inclusivity[0] === "(" ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ")" ? this.isBefore(localTo, units) : !this.isAfter(localTo, units)); } function isSame(input, units) { var localInput = isMoment$1(input) ? input : createLocal(input), inputMs; if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || "millisecond"; if (units === "millisecond") { return this.valueOf() === localInput.valueOf(); } else { inputMs = localInput.valueOf(); return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); } } function isSameOrAfter(input, units) { return this.isSame(input, units) || this.isAfter(input, units); } function isSameOrBefore(input, units) { return this.isSame(input, units) || this.isBefore(input, units); } function diff(input, units, asFloat) { var that, zoneDelta, output; if (!this.isValid()) { return NaN; } that = cloneWithOffset(input, this); if (!that.isValid()) { return NaN; } zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; units = normalizeUnits(units); switch (units) { case "year": output = monthDiff(this, that) / 12; break; case "month": output = monthDiff(this, that); break; case "quarter": output = monthDiff(this, that) / 3; break; case "second": output = (this - that) / 1e3; break; case "minute": output = (this - that) / 6e4; break; case "hour": output = (this - that) / 36e5; break; case "day": output = (this - that - zoneDelta) / 864e5; break; case "week": output = (this - that - zoneDelta) / 6048e5; break; default: output = this - that; } return asFloat ? output : absFloor(output); } function monthDiff(a2, b2) { if (a2.date() < b2.date()) { return -monthDiff(b2, a2); } var wholeMonthDiff = (b2.year() - a2.year()) * 12 + (b2.month() - a2.month()), anchor = a2.clone().add(wholeMonthDiff, "months"), anchor2, adjust; if (b2 - anchor < 0) { anchor2 = a2.clone().add(wholeMonthDiff - 1, "months"); adjust = (b2 - anchor) / (anchor - anchor2); } else { anchor2 = a2.clone().add(wholeMonthDiff + 1, "months"); adjust = (b2 - anchor) / (anchor2 - anchor); } return -(wholeMonthDiff + adjust) || 0; } hooks.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ"; hooks.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]"; function toString$4() { return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ"); } function toISOString(keepOffset) { if (!this.isValid()) { return null; } var utc = keepOffset !== true, m2 = utc ? this.clone().utc() : this; if (m2.year() < 0 || m2.year() > 9999) { return formatMoment(m2, utc ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"); } if (isFunction$4(Date.prototype.toISOString)) { if (utc) { return this.toDate().toISOString(); } else { return new Date(this.valueOf() + this.utcOffset() * 60 * 1e3).toISOString().replace("Z", formatMoment(m2, "Z")); } } return formatMoment(m2, utc ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ"); } function inspect$1() { if (!this.isValid()) { return "moment.invalid(/* " + this._i + " */)"; } var func = "moment", zone = "", prefix, year, datetime, suffix; if (!this.isLocal()) { func = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone"; zone = "Z"; } prefix = "[" + func + '("]'; year = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY"; datetime = "-MM-DD[T]HH:mm:ss.SSS"; suffix = zone + '[")]'; return this.format(prefix + year + datetime + suffix); } function format$1(inputString) { if (!inputString) { inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; } var output = formatMoment(this, inputString); return this.localeData().postformat(output); } function from(time, withoutSuffix) { if (this.isValid() && (isMoment$1(time) && time.isValid() || createLocal(time).isValid())) { return createDuration({ to: this, from: time }).locale(this.locale()).humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } } function fromNow(withoutSuffix) { return this.from(createLocal(), withoutSuffix); } function to(time, withoutSuffix) { if (this.isValid() && (isMoment$1(time) && time.isValid() || createLocal(time).isValid())) { return createDuration({ from: this, to: time }).locale(this.locale()).humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } } function toNow(withoutSuffix) { return this.to(createLocal(), withoutSuffix); } function locale$2(key2) { var newLocaleData; if (key2 === void 0) { return this._locale._abbr; } else { newLocaleData = getLocale(key2); if (newLocaleData != null) { this._locale = newLocaleData; } return this; } } var lang = deprecate("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", function(key2) { if (key2 === void 0) { return this.localeData(); } else { return this.locale(key2); } }); function localeData() { return this._locale; } var MS_PER_SECOND = 1e3, MS_PER_MINUTE = 60 * MS_PER_SECOND, MS_PER_HOUR = 60 * MS_PER_MINUTE, MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; function mod$1(dividend, divisor) { return (dividend % divisor + divisor) % divisor; } function localStartOfDate(y2, m2, d2) { if (y2 < 100 && y2 >= 0) { return new Date(y2 + 400, m2, d2) - MS_PER_400_YEARS; } else { return new Date(y2, m2, d2).valueOf(); } } function utcStartOfDate(y2, m2, d2) { if (y2 < 100 && y2 >= 0) { return Date.UTC(y2 + 400, m2, d2) - MS_PER_400_YEARS; } else { return Date.UTC(y2, m2, d2); } } function startOf(units) { var time, startOfDate; units = normalizeUnits(units); if (units === void 0 || units === "millisecond" || !this.isValid()) { return this; } startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; switch (units) { case "year": time = startOfDate(this.year(), 0, 1); break; case "quarter": time = startOfDate(this.year(), this.month() - this.month() % 3, 1); break; case "month": time = startOfDate(this.year(), this.month(), 1); break; case "week": time = startOfDate(this.year(), this.month(), this.date() - this.weekday()); break; case "isoWeek": time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1)); break; case "day": case "date": time = startOfDate(this.year(), this.month(), this.date()); break; case "hour": time = this._d.valueOf(); time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR); break; case "minute": time = this._d.valueOf(); time -= mod$1(time, MS_PER_MINUTE); break; case "second": time = this._d.valueOf(); time -= mod$1(time, MS_PER_SECOND); break; } this._d.setTime(time); hooks.updateOffset(this, true); return this; } function endOf(units) { var time, startOfDate; units = normalizeUnits(units); if (units === void 0 || units === "millisecond" || !this.isValid()) { return this; } startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; switch (units) { case "year": time = startOfDate(this.year() + 1, 0, 1) - 1; break; case "quarter": time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1; break; case "month": time = startOfDate(this.year(), this.month() + 1, 1) - 1; break; case "week": time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1; break; case "isoWeek": time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1; break; case "day": case "date": time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; break; case "hour": time = this._d.valueOf(); time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1; break; case "minute": time = this._d.valueOf(); time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; break; case "second": time = this._d.valueOf(); time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; break; } this._d.setTime(time); hooks.updateOffset(this, true); return this; } function valueOf() { return this._d.valueOf() - (this._offset || 0) * 6e4; } function unix() { return Math.floor(this.valueOf() / 1e3); } function toDate() { return new Date(this.valueOf()); } function toArray$5() { var m2 = this; return [ m2.year(), m2.month(), m2.date(), m2.hour(), m2.minute(), m2.second(), m2.millisecond() ]; } function toObject$1() { var m2 = this; return { years: m2.year(), months: m2.month(), date: m2.date(), hours: m2.hours(), minutes: m2.minutes(), seconds: m2.seconds(), milliseconds: m2.milliseconds() }; } function toJSON() { return this.isValid() ? this.toISOString() : null; } function isValid$2$1() { return isValid$2(this); } function parsingFlags() { return extend$2({}, getParsingFlags(this)); } function invalidAt() { return getParsingFlags(this).overflow; } function creationData() { return { input: this._i, format: this._f, locale: this._locale, isUTC: this._isUTC, strict: this._strict }; } addFormatToken("N", 0, 0, "eraAbbr"); addFormatToken("NN", 0, 0, "eraAbbr"); addFormatToken("NNN", 0, 0, "eraAbbr"); addFormatToken("NNNN", 0, 0, "eraName"); addFormatToken("NNNNN", 0, 0, "eraNarrow"); addFormatToken("y", ["y", 1], "yo", "eraYear"); addFormatToken("y", ["yy", 2], 0, "eraYear"); addFormatToken("y", ["yyy", 3], 0, "eraYear"); addFormatToken("y", ["yyyy", 4], 0, "eraYear"); addRegexToken("N", matchEraAbbr); addRegexToken("NN", matchEraAbbr); addRegexToken("NNN", matchEraAbbr); addRegexToken("NNNN", matchEraName); addRegexToken("NNNNN", matchEraNarrow); addParseToken(["N", "NN", "NNN", "NNNN", "NNNNN"], function(input, array3, config3, token2) { var era = config3._locale.erasParse(input, token2, config3._strict); if (era) { getParsingFlags(config3).era = era; } else { getParsingFlags(config3).invalidEra = input; } }); addRegexToken("y", matchUnsigned); addRegexToken("yy", matchUnsigned); addRegexToken("yyy", matchUnsigned); addRegexToken("yyyy", matchUnsigned); addRegexToken("yo", matchEraYearOrdinal); addParseToken(["y", "yy", "yyy", "yyyy"], YEAR); addParseToken(["yo"], function(input, array3, config3, token2) { var match5; if (config3._locale._eraYearOrdinalRegex) { match5 = input.match(config3._locale._eraYearOrdinalRegex); } if (config3._locale.eraYearOrdinalParse) { array3[YEAR] = config3._locale.eraYearOrdinalParse(input, match5); } else { array3[YEAR] = parseInt(input, 10); } }); function localeEras(m2, format3) { var i2, l2, date3, eras = this._eras || getLocale("en")._eras; for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) { switch (typeof eras[i2].since) { case "string": date3 = hooks(eras[i2].since).startOf("day"); eras[i2].since = date3.valueOf(); break; } switch (typeof eras[i2].until) { case "undefined": eras[i2].until = Infinity; break; case "string": date3 = hooks(eras[i2].until).startOf("day").valueOf(); eras[i2].until = date3.valueOf(); break; } } return eras; } function localeErasParse(eraName, format3, strict) { var i2, l2, eras = this.eras(), name, abbr, narrow; eraName = eraName.toUpperCase(); for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) { name = eras[i2].name.toUpperCase(); abbr = eras[i2].abbr.toUpperCase(); narrow = eras[i2].narrow.toUpperCase(); if (strict) { switch (format3) { case "N": case "NN": case "NNN": if (abbr === eraName) { return eras[i2]; } break; case "NNNN": if (name === eraName) { return eras[i2]; } break; case "NNNNN": if (narrow === eraName) { return eras[i2]; } break; } } else if ([name, abbr, narrow].indexOf(eraName) >= 0) { return eras[i2]; } } } function localeErasConvertYear(era, year) { var dir = era.since <= era.until ? 1 : -1; if (year === void 0) { return hooks(era.since).year(); } else { return hooks(era.since).year() + (year - era.offset) * dir; } } function getEraName() { var i2, l2, val, eras = this.localeData().eras(); for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) { val = this.clone().startOf("day").valueOf(); if (eras[i2].since <= val && val <= eras[i2].until) { return eras[i2].name; } if (eras[i2].until <= val && val <= eras[i2].since) { return eras[i2].name; } } return ""; } function getEraNarrow() { var i2, l2, val, eras = this.localeData().eras(); for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) { val = this.clone().startOf("day").valueOf(); if (eras[i2].since <= val && val <= eras[i2].until) { return eras[i2].narrow; } if (eras[i2].until <= val && val <= eras[i2].since) { return eras[i2].narrow; } } return ""; } function getEraAbbr() { var i2, l2, val, eras = this.localeData().eras(); for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) { val = this.clone().startOf("day").valueOf(); if (eras[i2].since <= val && val <= eras[i2].until) { return eras[i2].abbr; } if (eras[i2].until <= val && val <= eras[i2].since) { return eras[i2].abbr; } } return ""; } function getEraYear() { var i2, l2, dir, val, eras = this.localeData().eras(); for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) { dir = eras[i2].since <= eras[i2].until ? 1 : -1; val = this.clone().startOf("day").valueOf(); if (eras[i2].since <= val && val <= eras[i2].until || eras[i2].until <= val && val <= eras[i2].since) { return (this.year() - hooks(eras[i2].since).year()) * dir + eras[i2].offset; } } return this.year(); } function erasNameRegex(isStrict) { if (!hasOwnProp(this, "_erasNameRegex")) { computeErasParse.call(this); } return isStrict ? this._erasNameRegex : this._erasRegex; } function erasAbbrRegex(isStrict) { if (!hasOwnProp(this, "_erasAbbrRegex")) { computeErasParse.call(this); } return isStrict ? this._erasAbbrRegex : this._erasRegex; } function erasNarrowRegex(isStrict) { if (!hasOwnProp(this, "_erasNarrowRegex")) { computeErasParse.call(this); } return isStrict ? this._erasNarrowRegex : this._erasRegex; } function matchEraAbbr(isStrict, locale2) { return locale2.erasAbbrRegex(isStrict); } function matchEraName(isStrict, locale2) { return locale2.erasNameRegex(isStrict); } function matchEraNarrow(isStrict, locale2) { return locale2.erasNarrowRegex(isStrict); } function matchEraYearOrdinal(isStrict, locale2) { return locale2._eraYearOrdinalRegex || matchUnsigned; } function computeErasParse() { var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i2, l2, eras = this.eras(); for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) { namePieces.push(regexEscape(eras[i2].name)); abbrPieces.push(regexEscape(eras[i2].abbr)); narrowPieces.push(regexEscape(eras[i2].narrow)); mixedPieces.push(regexEscape(eras[i2].name)); mixedPieces.push(regexEscape(eras[i2].abbr)); mixedPieces.push(regexEscape(eras[i2].narrow)); } this._erasRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i"); this._erasNameRegex = new RegExp("^(" + namePieces.join("|") + ")", "i"); this._erasAbbrRegex = new RegExp("^(" + abbrPieces.join("|") + ")", "i"); this._erasNarrowRegex = new RegExp("^(" + narrowPieces.join("|") + ")", "i"); } addFormatToken(0, ["gg", 2], 0, function() { return this.weekYear() % 100; }); addFormatToken(0, ["GG", 2], 0, function() { return this.isoWeekYear() % 100; }); function addWeekYearFormatToken(token2, getter) { addFormatToken(0, [token2, token2.length], 0, getter); } addWeekYearFormatToken("gggg", "weekYear"); addWeekYearFormatToken("ggggg", "weekYear"); addWeekYearFormatToken("GGGG", "isoWeekYear"); addWeekYearFormatToken("GGGGG", "isoWeekYear"); addUnitAlias("weekYear", "gg"); addUnitAlias("isoWeekYear", "GG"); addUnitPriority("weekYear", 1); addUnitPriority("isoWeekYear", 1); addRegexToken("G", matchSigned); addRegexToken("g", matchSigned); addRegexToken("GG", match1to2, match2); addRegexToken("gg", match1to2, match2); addRegexToken("GGGG", match1to4, match4); addRegexToken("gggg", match1to4, match4); addRegexToken("GGGGG", match1to6, match6); addRegexToken("ggggg", match1to6, match6); addWeekParseToken(["gggg", "ggggg", "GGGG", "GGGGG"], function(input, week, config3, token2) { week[token2.substr(0, 2)] = toInt(input); }); addWeekParseToken(["gg", "GG"], function(input, week, config3, token2) { week[token2] = hooks.parseTwoDigitYear(input); }); function getSetWeekYear(input) { return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy); } function getSetISOWeekYear(input) { return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4); } function getISOWeeksInYear() { return weeksInYear(this.year(), 1, 4); } function getISOWeeksInISOWeekYear() { return weeksInYear(this.isoWeekYear(), 1, 4); } function getWeeksInYear() { var weekInfo = this.localeData()._week; return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); } function getWeeksInWeekYear() { var weekInfo = this.localeData()._week; return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy); } function getSetWeekYearHelper(input, week, weekday, dow, doy) { var weeksTarget; if (input == null) { return weekOfYear(this, dow, doy).year; } else { weeksTarget = weeksInYear(input, dow, doy); if (week > weeksTarget) { week = weeksTarget; } return setWeekAll.call(this, input, week, weekday, dow, doy); } } function setWeekAll(weekYear, week, weekday, dow, doy) { var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date3 = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); this.year(date3.getUTCFullYear()); this.month(date3.getUTCMonth()); this.date(date3.getUTCDate()); return this; } addFormatToken("Q", 0, "Qo", "quarter"); addUnitAlias("quarter", "Q"); addUnitPriority("quarter", 7); addRegexToken("Q", match1); addParseToken("Q", function(input, array3) { array3[MONTH] = (toInt(input) - 1) * 3; }); function getSetQuarter(input) { return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); } addFormatToken("D", ["DD", 2], "Do", "date"); addUnitAlias("date", "D"); addUnitPriority("date", 9); addRegexToken("D", match1to2); addRegexToken("DD", match1to2, match2); addRegexToken("Do", function(isStrict, locale2) { return isStrict ? locale2._dayOfMonthOrdinalParse || locale2._ordinalParse : locale2._dayOfMonthOrdinalParseLenient; }); addParseToken(["D", "DD"], DATE); addParseToken("Do", function(input, array3) { array3[DATE] = toInt(input.match(match1to2)[0]); }); var getSetDayOfMonth = makeGetSet("Date", true); addFormatToken("DDD", ["DDDD", 3], "DDDo", "dayOfYear"); addUnitAlias("dayOfYear", "DDD"); addUnitPriority("dayOfYear", 4); addRegexToken("DDD", match1to3); addRegexToken("DDDD", match3); addParseToken(["DDD", "DDDD"], function(input, array3, config3) { config3._dayOfYear = toInt(input); }); function getSetDayOfYear(input) { var dayOfYear = Math.round((this.clone().startOf("day") - this.clone().startOf("year")) / 864e5) + 1; return input == null ? dayOfYear : this.add(input - dayOfYear, "d"); } addFormatToken("m", ["mm", 2], 0, "minute"); addUnitAlias("minute", "m"); addUnitPriority("minute", 14); addRegexToken("m", match1to2); addRegexToken("mm", match1to2, match2); addParseToken(["m", "mm"], MINUTE); var getSetMinute = makeGetSet("Minutes", false); addFormatToken("s", ["ss", 2], 0, "second"); addUnitAlias("second", "s"); addUnitPriority("second", 15); addRegexToken("s", match1to2); addRegexToken("ss", match1to2, match2); addParseToken(["s", "ss"], SECOND); var getSetSecond = makeGetSet("Seconds", false); addFormatToken("S", 0, 0, function() { return ~~(this.millisecond() / 100); }); addFormatToken(0, ["SS", 2], 0, function() { return ~~(this.millisecond() / 10); }); addFormatToken(0, ["SSS", 3], 0, "millisecond"); addFormatToken(0, ["SSSS", 4], 0, function() { return this.millisecond() * 10; }); addFormatToken(0, ["SSSSS", 5], 0, function() { return this.millisecond() * 100; }); addFormatToken(0, ["SSSSSS", 6], 0, function() { return this.millisecond() * 1e3; }); addFormatToken(0, ["SSSSSSS", 7], 0, function() { return this.millisecond() * 1e4; }); addFormatToken(0, ["SSSSSSSS", 8], 0, function() { return this.millisecond() * 1e5; }); addFormatToken(0, ["SSSSSSSSS", 9], 0, function() { return this.millisecond() * 1e6; }); addUnitAlias("millisecond", "ms"); addUnitPriority("millisecond", 16); addRegexToken("S", match1to3, match1); addRegexToken("SS", match1to3, match2); addRegexToken("SSS", match1to3, match3); var token, getSetMillisecond; for (token = "SSSS"; token.length <= 9; token += "S") { addRegexToken(token, matchUnsigned); } function parseMs(input, array3) { array3[MILLISECOND] = toInt(("0." + input) * 1e3); } for (token = "S"; token.length <= 9; token += "S") { addParseToken(token, parseMs); } getSetMillisecond = makeGetSet("Milliseconds", false); addFormatToken("z", 0, 0, "zoneAbbr"); addFormatToken("zz", 0, 0, "zoneName"); function getZoneAbbr() { return this._isUTC ? "UTC" : ""; } function getZoneName() { return this._isUTC ? "Coordinated Universal Time" : ""; } var proto = Moment.prototype; proto.add = add$1; proto.calendar = calendar$1; proto.clone = clone$1; proto.diff = diff; proto.endOf = endOf; proto.format = format$1; proto.from = from; proto.fromNow = fromNow; proto.to = to; proto.toNow = toNow; proto.get = stringGet; proto.invalidAt = invalidAt; proto.isAfter = isAfter; proto.isBefore = isBefore; proto.isBetween = isBetween; proto.isSame = isSame; proto.isSameOrAfter = isSameOrAfter; proto.isSameOrBefore = isSameOrBefore; proto.isValid = isValid$2$1; proto.lang = lang; proto.locale = locale$2; proto.localeData = localeData; proto.max = prototypeMax; proto.min = prototypeMin; proto.parsingFlags = parsingFlags; proto.set = stringSet; proto.startOf = startOf; proto.subtract = subtract; proto.toArray = toArray$5; proto.toObject = toObject$1; proto.toDate = toDate; proto.toISOString = toISOString; proto.inspect = inspect$1; if (typeof Symbol !== "undefined" && Symbol.for != null) { proto[Symbol.for("nodejs.util.inspect.custom")] = function() { return "Moment<" + this.format() + ">"; }; } proto.toJSON = toJSON; proto.toString = toString$4; proto.unix = unix; proto.valueOf = valueOf; proto.creationData = creationData; proto.eraName = getEraName; proto.eraNarrow = getEraNarrow; proto.eraAbbr = getEraAbbr; proto.eraYear = getEraYear; proto.year = getSetYear; proto.isLeapYear = getIsLeapYear; proto.weekYear = getSetWeekYear; proto.isoWeekYear = getSetISOWeekYear; proto.quarter = proto.quarters = getSetQuarter; proto.month = getSetMonth; proto.daysInMonth = getDaysInMonth; proto.week = proto.weeks = getSetWeek; proto.isoWeek = proto.isoWeeks = getSetISOWeek; proto.weeksInYear = getWeeksInYear; proto.weeksInWeekYear = getWeeksInWeekYear; proto.isoWeeksInYear = getISOWeeksInYear; proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear; proto.date = getSetDayOfMonth; proto.day = proto.days = getSetDayOfWeek; proto.weekday = getSetLocaleDayOfWeek; proto.isoWeekday = getSetISODayOfWeek; proto.dayOfYear = getSetDayOfYear; proto.hour = proto.hours = getSetHour; proto.minute = proto.minutes = getSetMinute; proto.second = proto.seconds = getSetSecond; proto.millisecond = proto.milliseconds = getSetMillisecond; proto.utcOffset = getSetOffset; proto.utc = setOffsetToUTC; proto.local = setOffsetToLocal; proto.parseZone = setOffsetToParsedOffset; proto.hasAlignedHourOffset = hasAlignedHourOffset; proto.isDST = isDaylightSavingTime; proto.isLocal = isLocal; proto.isUtcOffset = isUtcOffset; proto.isUtc = isUtc; proto.isUTC = isUtc; proto.zoneAbbr = getZoneAbbr; proto.zoneName = getZoneName; proto.dates = deprecate("dates accessor is deprecated. Use date instead.", getSetDayOfMonth); proto.months = deprecate("months accessor is deprecated. Use month instead", getSetMonth); proto.years = deprecate("years accessor is deprecated. Use year instead", getSetYear); proto.zone = deprecate("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/", getSetZone); proto.isDSTShifted = deprecate("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information", isDaylightSavingTimeShifted); function createUnix(input) { return createLocal(input * 1e3); } function createInZone() { return createLocal.apply(null, arguments).parseZone(); } function preParsePostFormat(string2) { return string2; } var proto$1 = Locale.prototype; proto$1.calendar = calendar; proto$1.longDateFormat = longDateFormat; proto$1.invalidDate = invalidDate; proto$1.ordinal = ordinal; proto$1.preparse = preParsePostFormat; proto$1.postformat = preParsePostFormat; proto$1.relativeTime = relativeTime; proto$1.pastFuture = pastFuture; proto$1.set = set$1; proto$1.eras = localeEras; proto$1.erasParse = localeErasParse; proto$1.erasConvertYear = localeErasConvertYear; proto$1.erasAbbrRegex = erasAbbrRegex; proto$1.erasNameRegex = erasNameRegex; proto$1.erasNarrowRegex = erasNarrowRegex; proto$1.months = localeMonths; proto$1.monthsShort = localeMonthsShort; proto$1.monthsParse = localeMonthsParse; proto$1.monthsRegex = monthsRegex; proto$1.monthsShortRegex = monthsShortRegex; proto$1.week = localeWeek; proto$1.firstDayOfYear = localeFirstDayOfYear; proto$1.firstDayOfWeek = localeFirstDayOfWeek; proto$1.weekdays = localeWeekdays; proto$1.weekdaysMin = localeWeekdaysMin; proto$1.weekdaysShort = localeWeekdaysShort; proto$1.weekdaysParse = localeWeekdaysParse; proto$1.weekdaysRegex = weekdaysRegex; proto$1.weekdaysShortRegex = weekdaysShortRegex; proto$1.weekdaysMinRegex = weekdaysMinRegex; proto$1.isPM = localeIsPM; proto$1.meridiem = localeMeridiem; function get$1$1(format3, index2, field, setter) { var locale2 = getLocale(), utc = createUTC().set(setter, index2); return locale2[field](utc, format3); } function listMonthsImpl(format3, index2, field) { if (isNumber$4(format3)) { index2 = format3; format3 = void 0; } format3 = format3 || ""; if (index2 != null) { return get$1$1(format3, index2, field, "month"); } var i2, out = []; for (i2 = 0; i2 < 12; i2++) { out[i2] = get$1$1(format3, i2, field, "month"); } return out; } function listWeekdaysImpl(localeSorted, format3, index2, field) { if (typeof localeSorted === "boolean") { if (isNumber$4(format3)) { index2 = format3; format3 = void 0; } format3 = format3 || ""; } else { format3 = localeSorted; index2 = format3; localeSorted = false; if (isNumber$4(format3)) { index2 = format3; format3 = void 0; } format3 = format3 || ""; } var locale2 = getLocale(), shift = localeSorted ? locale2._week.dow : 0, i2, out = []; if (index2 != null) { return get$1$1(format3, (index2 + shift) % 7, field, "day"); } for (i2 = 0; i2 < 7; i2++) { out[i2] = get$1$1(format3, (i2 + shift) % 7, field, "day"); } return out; } function listMonths(format3, index2) { return listMonthsImpl(format3, index2, "months"); } function listMonthsShort(format3, index2) { return listMonthsImpl(format3, index2, "monthsShort"); } function listWeekdays(localeSorted, format3, index2) { return listWeekdaysImpl(localeSorted, format3, index2, "weekdays"); } function listWeekdaysShort(localeSorted, format3, index2) { return listWeekdaysImpl(localeSorted, format3, index2, "weekdaysShort"); } function listWeekdaysMin(localeSorted, format3, index2) { return listWeekdaysImpl(localeSorted, format3, index2, "weekdaysMin"); } getSetGlobalLocale("en", { eras: [ { since: "0001-01-01", until: Infinity, offset: 1, name: "Anno Domini", narrow: "AD", abbr: "AD" }, { since: "0000-12-31", until: -Infinity, offset: 1, name: "Before Christ", narrow: "BC", abbr: "BC" } ], dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, ordinal: function(number3) { var b2 = number3 % 10, output = toInt(number3 % 100 / 10) === 1 ? "th" : b2 === 1 ? "st" : b2 === 2 ? "nd" : b2 === 3 ? "rd" : "th"; return number3 + output; } }); hooks.lang = deprecate("moment.lang is deprecated. Use moment.locale instead.", getSetGlobalLocale); hooks.langData = deprecate("moment.langData is deprecated. Use moment.localeData instead.", getLocale); var mathAbs = Math.abs; function abs() { var data65 = this._data; this._milliseconds = mathAbs(this._milliseconds); this._days = mathAbs(this._days); this._months = mathAbs(this._months); data65.milliseconds = mathAbs(data65.milliseconds); data65.seconds = mathAbs(data65.seconds); data65.minutes = mathAbs(data65.minutes); data65.hours = mathAbs(data65.hours); data65.months = mathAbs(data65.months); data65.years = mathAbs(data65.years); return this; } function addSubtract$1(duration2, input, value24, direction) { var other = createDuration(input, value24); duration2._milliseconds += direction * other._milliseconds; duration2._days += direction * other._days; duration2._months += direction * other._months; return duration2._bubble(); } function add$1$1(input, value24) { return addSubtract$1(this, input, value24, 1); } function subtract$1(input, value24) { return addSubtract$1(this, input, value24, -1); } function absCeil(number3) { if (number3 < 0) { return Math.floor(number3); } else { return Math.ceil(number3); } } function bubble() { var milliseconds2 = this._milliseconds, days2 = this._days, months3 = this._months, data65 = this._data, seconds2, minutes2, hours2, years3, monthsFromDays; if (!(milliseconds2 >= 0 && days2 >= 0 && months3 >= 0 || milliseconds2 <= 0 && days2 <= 0 && months3 <= 0)) { milliseconds2 += absCeil(monthsToDays(months3) + days2) * 864e5; days2 = 0; months3 = 0; } data65.milliseconds = milliseconds2 % 1e3; seconds2 = absFloor(milliseconds2 / 1e3); data65.seconds = seconds2 % 60; minutes2 = absFloor(seconds2 / 60); data65.minutes = minutes2 % 60; hours2 = absFloor(minutes2 / 60); data65.hours = hours2 % 24; days2 += absFloor(hours2 / 24); monthsFromDays = absFloor(daysToMonths(days2)); months3 += monthsFromDays; days2 -= absCeil(monthsToDays(monthsFromDays)); years3 = absFloor(months3 / 12); months3 %= 12; data65.days = days2; data65.months = months3; data65.years = years3; return this; } function daysToMonths(days2) { return days2 * 4800 / 146097; } function monthsToDays(months3) { return months3 * 146097 / 4800; } function as(units) { if (!this.isValid()) { return NaN; } var days2, months3, milliseconds2 = this._milliseconds; units = normalizeUnits(units); if (units === "month" || units === "quarter" || units === "year") { days2 = this._days + milliseconds2 / 864e5; months3 = this._months + daysToMonths(days2); switch (units) { case "month": return months3; case "quarter": return months3 / 3; case "year": return months3 / 12; } } else { days2 = this._days + Math.round(monthsToDays(this._months)); switch (units) { case "week": return days2 / 7 + milliseconds2 / 6048e5; case "day": return days2 + milliseconds2 / 864e5; case "hour": return days2 * 24 + milliseconds2 / 36e5; case "minute": return days2 * 1440 + milliseconds2 / 6e4; case "second": return days2 * 86400 + milliseconds2 / 1e3; case "millisecond": return Math.floor(days2 * 864e5) + milliseconds2; default: throw new Error("Unknown unit " + units); } } } function valueOf$1() { if (!this.isValid()) { return NaN; } return this._milliseconds + this._days * 864e5 + this._months % 12 * 2592e6 + toInt(this._months / 12) * 31536e6; } function makeAs(alias) { return function() { return this.as(alias); }; } var asMilliseconds = makeAs("ms"), asSeconds = makeAs("s"), asMinutes = makeAs("m"), asHours = makeAs("h"), asDays = makeAs("d"), asWeeks = makeAs("w"), asMonths = makeAs("M"), asQuarters = makeAs("Q"), asYears = makeAs("y"); function clone$1$1() { return createDuration(this); } function get$2(units) { units = normalizeUnits(units); return this.isValid() ? this[units + "s"]() : NaN; } function makeGetter(name) { return function() { return this.isValid() ? this._data[name] : NaN; }; } var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years"); function weeks() { return absFloor(this.days() / 7); } var round = Math.round, thresholds = { ss: 44, s: 45, m: 45, h: 22, d: 26, w: null, M: 11 }; function substituteTimeAgo(string2, number3, withoutSuffix, isFuture, locale2) { return locale2.relativeTime(number3 || 1, !!withoutSuffix, string2, isFuture); } function relativeTime$1(posNegDuration, withoutSuffix, thresholds2, locale2) { var duration2 = createDuration(posNegDuration).abs(), seconds2 = round(duration2.as("s")), minutes2 = round(duration2.as("m")), hours2 = round(duration2.as("h")), days2 = round(duration2.as("d")), months3 = round(duration2.as("M")), weeks2 = round(duration2.as("w")), years3 = round(duration2.as("y")), a2 = seconds2 <= thresholds2.ss && ["s", seconds2] || seconds2 < thresholds2.s && ["ss", seconds2] || minutes2 <= 1 && ["m"] || minutes2 < thresholds2.m && ["mm", minutes2] || hours2 <= 1 && ["h"] || hours2 < thresholds2.h && ["hh", hours2] || days2 <= 1 && ["d"] || days2 < thresholds2.d && ["dd", days2]; if (thresholds2.w != null) { a2 = a2 || weeks2 <= 1 && ["w"] || weeks2 < thresholds2.w && ["ww", weeks2]; } a2 = a2 || months3 <= 1 && ["M"] || months3 < thresholds2.M && ["MM", months3] || years3 <= 1 && ["y"] || ["yy", years3]; a2[2] = withoutSuffix; a2[3] = +posNegDuration > 0; a2[4] = locale2; return substituteTimeAgo.apply(null, a2); } function getSetRelativeTimeRounding(roundingFunction) { if (roundingFunction === void 0) { return round; } if (typeof roundingFunction === "function") { round = roundingFunction; return true; } return false; } function getSetRelativeTimeThreshold(threshold, limit) { if (thresholds[threshold] === void 0) { return false; } if (limit === void 0) { return thresholds[threshold]; } thresholds[threshold] = limit; if (threshold === "s") { thresholds.ss = limit - 1; } return true; } function humanize(argWithSuffix, argThresholds) { if (!this.isValid()) { return this.localeData().invalidDate(); } var withSuffix = false, th = thresholds, locale2, output; if (typeof argWithSuffix === "object") { argThresholds = argWithSuffix; argWithSuffix = false; } if (typeof argWithSuffix === "boolean") { withSuffix = argWithSuffix; } if (typeof argThresholds === "object") { th = Object.assign({}, thresholds, argThresholds); if (argThresholds.s != null && argThresholds.ss == null) { th.ss = argThresholds.s - 1; } } locale2 = this.localeData(); output = relativeTime$1(this, !withSuffix, th, locale2); if (withSuffix) { output = locale2.pastFuture(+this, output); } return locale2.postformat(output); } var abs$1 = Math.abs; function sign(x2) { return (x2 > 0) - (x2 < 0) || +x2; } function toISOString$1() { if (!this.isValid()) { return this.localeData().invalidDate(); } var seconds2 = abs$1(this._milliseconds) / 1e3, days2 = abs$1(this._days), months3 = abs$1(this._months), minutes2, hours2, years3, s2, total2 = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign; if (!total2) { return "P0D"; } minutes2 = absFloor(seconds2 / 60); hours2 = absFloor(minutes2 / 60); seconds2 %= 60; minutes2 %= 60; years3 = absFloor(months3 / 12); months3 %= 12; s2 = seconds2 ? seconds2.toFixed(3).replace(/\.?0+$/, "") : ""; totalSign = total2 < 0 ? "-" : ""; ymSign = sign(this._months) !== sign(total2) ? "-" : ""; daysSign = sign(this._days) !== sign(total2) ? "-" : ""; hmsSign = sign(this._milliseconds) !== sign(total2) ? "-" : ""; return totalSign + "P" + (years3 ? ymSign + years3 + "Y" : "") + (months3 ? ymSign + months3 + "M" : "") + (days2 ? daysSign + days2 + "D" : "") + (hours2 || minutes2 || seconds2 ? "T" : "") + (hours2 ? hmsSign + hours2 + "H" : "") + (minutes2 ? hmsSign + minutes2 + "M" : "") + (seconds2 ? hmsSign + s2 + "S" : ""); } var proto$2 = Duration.prototype; proto$2.isValid = isValid$1$1; proto$2.abs = abs; proto$2.add = add$1$1; proto$2.subtract = subtract$1; proto$2.as = as; proto$2.asMilliseconds = asMilliseconds; proto$2.asSeconds = asSeconds; proto$2.asMinutes = asMinutes; proto$2.asHours = asHours; proto$2.asDays = asDays; proto$2.asWeeks = asWeeks; proto$2.asMonths = asMonths; proto$2.asQuarters = asQuarters; proto$2.asYears = asYears; proto$2.valueOf = valueOf$1; proto$2._bubble = bubble; proto$2.clone = clone$1$1; proto$2.get = get$2; proto$2.milliseconds = milliseconds; proto$2.seconds = seconds; proto$2.minutes = minutes; proto$2.hours = hours; proto$2.days = days; proto$2.weeks = weeks; proto$2.months = months; proto$2.years = years; proto$2.humanize = humanize; proto$2.toISOString = toISOString$1; proto$2.toString = toISOString$1; proto$2.toJSON = toISOString$1; proto$2.locale = locale$2; proto$2.localeData = localeData; proto$2.toIsoString = deprecate("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)", toISOString$1); proto$2.lang = lang; addFormatToken("X", 0, 0, "unix"); addFormatToken("x", 0, 0, "valueOf"); addRegexToken("x", matchSigned); addRegexToken("X", matchTimestamp); addParseToken("X", function(input, array3, config3) { config3._d = new Date(parseFloat(input) * 1e3); }); addParseToken("x", function(input, array3, config3) { config3._d = new Date(toInt(input)); }); //! moment.js hooks.version = "2.29.3"; setHookCallback(createLocal); hooks.fn = proto; hooks.min = min; hooks.max = max; hooks.now = now$4; hooks.utc = createUTC; hooks.unix = createUnix; hooks.months = listMonths; hooks.isDate = isDate$2; hooks.locale = getSetGlobalLocale; hooks.invalid = createInvalid; hooks.duration = createDuration; hooks.isMoment = isMoment$1; hooks.weekdays = listWeekdays; hooks.parseZone = createInZone; hooks.localeData = getLocale; hooks.isDuration = isDuration; hooks.monthsShort = listMonthsShort; hooks.weekdaysMin = listWeekdaysMin; hooks.defineLocale = defineLocale; hooks.updateLocale = updateLocale; hooks.locales = listLocales; hooks.weekdaysShort = listWeekdaysShort; hooks.normalizeUnits = normalizeUnits; hooks.relativeTimeRounding = getSetRelativeTimeRounding; hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; hooks.calendarFormat = getCalendarFormat; hooks.prototype = proto; hooks.HTML5_FMT = { DATETIME_LOCAL: "YYYY-MM-DDTHH:mm", DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss", DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS", DATE: "YYYY-MM-DD", TIME: "HH:mm", TIME_SECONDS: "HH:mm:ss", TIME_MS: "HH:mm:ss.SSS", WEEK: "GGGG-[W]WW", MONTH: "YYYY-MM" }; //! moment.js locale configuration hooks.defineLocale("zh-cn", { months: "\u4E00\u6708_\u4E8C\u6708_\u4E09\u6708_\u56DB\u6708_\u4E94\u6708_\u516D\u6708_\u4E03\u6708_\u516B\u6708_\u4E5D\u6708_\u5341\u6708_\u5341\u4E00\u6708_\u5341\u4E8C\u6708".split("_"), monthsShort: "1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"), weekdays: "\u661F\u671F\u65E5_\u661F\u671F\u4E00_\u661F\u671F\u4E8C_\u661F\u671F\u4E09_\u661F\u671F\u56DB_\u661F\u671F\u4E94_\u661F\u671F\u516D".split("_"), weekdaysShort: "\u5468\u65E5_\u5468\u4E00_\u5468\u4E8C_\u5468\u4E09_\u5468\u56DB_\u5468\u4E94_\u5468\u516D".split("_"), weekdaysMin: "\u65E5_\u4E00_\u4E8C_\u4E09_\u56DB_\u4E94_\u516D".split("_"), longDateFormat: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY\u5E74M\u6708D\u65E5", LLL: "YYYY\u5E74M\u6708D\u65E5Ah\u70B9mm\u5206", LLLL: "YYYY\u5E74M\u6708D\u65E5ddddAh\u70B9mm\u5206", l: "YYYY/M/D", ll: "YYYY\u5E74M\u6708D\u65E5", lll: "YYYY\u5E74M\u6708D\u65E5 HH:mm", llll: "YYYY\u5E74M\u6708D\u65E5dddd HH:mm" }, meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, meridiemHour: function(hour2, meridiem2) { if (hour2 === 12) { hour2 = 0; } if (meridiem2 === "\u51CC\u6668" || meridiem2 === "\u65E9\u4E0A" || meridiem2 === "\u4E0A\u5348") { return hour2; } else if (meridiem2 === "\u4E0B\u5348" || meridiem2 === "\u665A\u4E0A") { return hour2 + 12; } else { return hour2 >= 11 ? hour2 : hour2 + 12; } }, meridiem: function(hour2, minute, isLower) { var hm = hour2 * 100 + minute; if (hm < 600) { return "\u51CC\u6668"; } else if (hm < 900) { return "\u65E9\u4E0A"; } else if (hm < 1130) { return "\u4E0A\u5348"; } else if (hm < 1230) { return "\u4E2D\u5348"; } else if (hm < 1800) { return "\u4E0B\u5348"; } else { return "\u665A\u4E0A"; } }, calendar: { sameDay: "[\u4ECA\u5929]LT", nextDay: "[\u660E\u5929]LT", nextWeek: function(now2) { if (now2.week() !== this.week()) { return "[\u4E0B]dddLT"; } else { return "[\u672C]dddLT"; } }, lastDay: "[\u6628\u5929]LT", lastWeek: function(now2) { if (this.week() !== now2.week()) { return "[\u4E0A]dddLT"; } else { return "[\u672C]dddLT"; } }, sameElse: "L" }, dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/, ordinal: function(number3, period) { switch (period) { case "d": case "D": case "DDD": return number3 + "\u65E5"; case "M": return number3 + "\u6708"; case "w": case "W": return number3 + "\u5468"; default: return number3; } }, relativeTime: { future: "%s\u540E", past: "%s\u524D", s: "\u51E0\u79D2", ss: "%d \u79D2", m: "1 \u5206\u949F", mm: "%d \u5206\u949F", h: "1 \u5C0F\u65F6", hh: "%d \u5C0F\u65F6", d: "1 \u5929", dd: "%d \u5929", w: "1 \u5468", ww: "%d \u5468", M: "1 \u4E2A\u6708", MM: "%d \u4E2A\u6708", y: "1 \u5E74", yy: "%d \u5E74" }, week: { dow: 1, doy: 4 } }); const toString$3 = Object.prototype.toString; function is(val, type2) { return toString$3.call(val) === `[object ${type2}]`; } function isDef(val) { return typeof val !== "undefined"; } function isUnDef(val) { return !isDef(val); } function isObject$4(val) { return val !== null && is(val, "Object"); } function isNull(val) { return val === null; } function isNullOrUnDef(val) { return isUnDef(val) || isNull(val); } function isNumber$3(val) { return is(val, "Number"); } function isString$3(val) { return is(val, "String"); } function isFunction$3(val) { return typeof val === "function"; } function isBoolean$1(val) { return is(val, "Boolean"); } function isArray$8(val) { return val && Array.isArray(val); } function isMap$3(val) { return is(val, "Map"); } const isServer$1 = typeof window === "undefined"; const isClient$2 = !isServer$1; var freeGlobal = typeof global == "object" && global && global.Object === Object && global; var freeGlobal$1 = freeGlobal; var freeSelf = typeof self == "object" && self && self.Object === Object && self; var root = freeGlobal$1 || freeSelf || Function("return this")(); var root$1 = root; var Symbol$1 = root$1.Symbol; var Symbol$2 = Symbol$1; var objectProto$f = Object.prototype; var hasOwnProperty$d = objectProto$f.hasOwnProperty; var nativeObjectToString$1 = objectProto$f.toString; var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0; function getRawTag(value24) { var isOwn = hasOwnProperty$d.call(value24, symToStringTag$1), tag = value24[symToStringTag$1]; try { value24[symToStringTag$1] = void 0; var unmasked = true; } catch (e2) { } var result = nativeObjectToString$1.call(value24); if (unmasked) { if (isOwn) { value24[symToStringTag$1] = tag; } else { delete value24[symToStringTag$1]; } } return result; } var objectProto$e = Object.prototype; var nativeObjectToString = objectProto$e.toString; function objectToString$1(value24) { return nativeObjectToString.call(value24); } var nullTag = "[object Null]", undefinedTag = "[object Undefined]"; var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0; function baseGetTag(value24) { if (value24 == null) { return value24 === void 0 ? undefinedTag : nullTag; } return symToStringTag && symToStringTag in Object(value24) ? getRawTag(value24) : objectToString$1(value24); } function isObjectLike(value24) { return value24 != null && typeof value24 == "object"; } var symbolTag$3 = "[object Symbol]"; function isSymbol$1(value24) { return typeof value24 == "symbol" || isObjectLike(value24) && baseGetTag(value24) == symbolTag$3; } function arrayMap(array3, iteratee) { var index2 = -1, length = array3 == null ? 0 : array3.length, result = Array(length); while (++index2 < length) { result[index2] = iteratee(array3[index2], index2, array3); } return result; } var isArray$6 = Array.isArray; var isArray$7 = isArray$6; var INFINITY$3 = 1 / 0; var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0; function baseToString(value24) { if (typeof value24 == "string") { return value24; } if (isArray$7(value24)) { return arrayMap(value24, baseToString) + ""; } if (isSymbol$1(value24)) { return symbolToString ? symbolToString.call(value24) : ""; } var result = value24 + ""; return result == "0" && 1 / value24 == -INFINITY$3 ? "-0" : result; } var reWhitespace = /\s/; function trimmedEndIndex(string2) { var index2 = string2.length; while (index2-- && reWhitespace.test(string2.charAt(index2))) { } return index2; } var reTrimStart = /^\s+/; function baseTrim(string2) { return string2 ? string2.slice(0, trimmedEndIndex(string2) + 1).replace(reTrimStart, "") : string2; } function isObject$3(value24) { var type2 = typeof value24; return value24 != null && (type2 == "object" || type2 == "function"); } var NAN = 0 / 0; var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; var reIsBinary = /^0b[01]+$/i; var reIsOctal = /^0o[0-7]+$/i; var freeParseInt = parseInt; function toNumber(value24) { if (typeof value24 == "number") { return value24; } if (isSymbol$1(value24)) { return NAN; } if (isObject$3(value24)) { var other = typeof value24.valueOf == "function" ? value24.valueOf() : value24; value24 = isObject$3(other) ? other + "" : other; } if (typeof value24 != "string") { return value24 === 0 ? value24 : +value24; } value24 = baseTrim(value24); var isBinary = reIsBinary.test(value24); return isBinary || reIsOctal.test(value24) ? freeParseInt(value24.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value24) ? NAN : +value24; } var INFINITY$2 = 1 / 0, MAX_INTEGER = 17976931348623157e292; function toFinite(value24) { if (!value24) { return value24 === 0 ? value24 : 0; } value24 = toNumber(value24); if (value24 === INFINITY$2 || value24 === -INFINITY$2) { var sign2 = value24 < 0 ? -1 : 1; return sign2 * MAX_INTEGER; } return value24 === value24 ? value24 : 0; } function toInteger(value24) { var result = toFinite(value24), remainder = result % 1; return result === result ? remainder ? result - remainder : result : 0; } function identity(value24) { return value24; } var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]"; function isFunction$2(value24) { if (!isObject$3(value24)) { return false; } var tag = baseGetTag(value24); return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag; } var coreJsData = root$1["__core-js_shared__"]; var coreJsData$1 = coreJsData; var maskSrcKey = function() { var uid2 = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || ""); return uid2 ? "Symbol(src)_1." + uid2 : ""; }(); function isMasked(func) { return !!maskSrcKey && maskSrcKey in func; } var funcProto$2 = Function.prototype; var funcToString$2 = funcProto$2.toString; function toSource(func) { if (func != null) { try { return funcToString$2.call(func); } catch (e2) { } try { return func + ""; } catch (e2) { } } return ""; } var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; var reIsHostCtor = /^\[object .+?Constructor\]$/; var funcProto$1 = Function.prototype, objectProto$d = Object.prototype; var funcToString$1 = funcProto$1.toString; var hasOwnProperty$c = objectProto$d.hasOwnProperty; var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$c).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); function baseIsNative(value24) { if (!isObject$3(value24) || isMasked(value24)) { return false; } var pattern2 = isFunction$2(value24) ? reIsNative : reIsHostCtor; return pattern2.test(toSource(value24)); } function getValue$2(object3, key2) { return object3 == null ? void 0 : object3[key2]; } function getNative(object3, key2) { var value24 = getValue$2(object3, key2); return baseIsNative(value24) ? value24 : void 0; } var WeakMap$1 = getNative(root$1, "WeakMap"); var WeakMap$2 = WeakMap$1; var objectCreate = Object.create; var baseCreate = function() { function object3() { } return function(proto2) { if (!isObject$3(proto2)) { return {}; } if (objectCreate) { return objectCreate(proto2); } object3.prototype = proto2; var result = new object3(); object3.prototype = void 0; return result; }; }(); var baseCreate$1 = baseCreate; function apply(func, thisArg, args) { switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } function noop$w() { } function copyArray(source2, array3) { var index2 = -1, length = source2.length; array3 || (array3 = Array(length)); while (++index2 < length) { array3[index2] = source2[index2]; } return array3; } var HOT_COUNT = 800, HOT_SPAN = 16; var nativeNow = Date.now; function shortOut(func) { var count2 = 0, lastCalled = 0; return function() { var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count2 >= HOT_COUNT) { return arguments[0]; } } else { count2 = 0; } return func.apply(void 0, arguments); }; } function constant(value24) { return function() { return value24; }; } var defineProperty = function() { try { var func = getNative(Object, "defineProperty"); func({}, "", {}); return func; } catch (e2) { } }(); var defineProperty$1 = defineProperty; var baseSetToString = !defineProperty$1 ? identity : function(func, string2) { return defineProperty$1(func, "toString", { "configurable": true, "enumerable": false, "value": constant(string2), "writable": true }); }; var baseSetToString$1 = baseSetToString; var setToString = shortOut(baseSetToString$1); var setToString$1 = setToString; function arrayEach(array3, iteratee) { var index2 = -1, length = array3 == null ? 0 : array3.length; while (++index2 < length) { if (iteratee(array3[index2], index2, array3) === false) { break; } } return array3; } function baseFindIndex(array3, predicate, fromIndex, fromRight) { var length = array3.length, index2 = fromIndex + (fromRight ? 1 : -1); while (fromRight ? index2-- : ++index2 < length) { if (predicate(array3[index2], index2, array3)) { return index2; } } return -1; } function baseIsNaN(value24) { return value24 !== value24; } function strictIndexOf(array3, value24, fromIndex) { var index2 = fromIndex - 1, length = array3.length; while (++index2 < length) { if (array3[index2] === value24) { return index2; } } return -1; } function baseIndexOf(array3, value24, fromIndex) { return value24 === value24 ? strictIndexOf(array3, value24, fromIndex) : baseFindIndex(array3, baseIsNaN, fromIndex); } function arrayIncludes(array3, value24) { var length = array3 == null ? 0 : array3.length; return !!length && baseIndexOf(array3, value24, 0) > -1; } var MAX_SAFE_INTEGER$2 = 9007199254740991; var reIsUint = /^(?:0|[1-9]\d*)$/; function isIndex(value24, length) { var type2 = typeof value24; length = length == null ? MAX_SAFE_INTEGER$2 : length; return !!length && (type2 == "number" || type2 != "symbol" && reIsUint.test(value24)) && (value24 > -1 && value24 % 1 == 0 && value24 < length); } function baseAssignValue(object3, key2, value24) { if (key2 == "__proto__" && defineProperty$1) { defineProperty$1(object3, key2, { "configurable": true, "enumerable": true, "value": value24, "writable": true }); } else { object3[key2] = value24; } } function eq(value24, other) { return value24 === other || value24 !== value24 && other !== other; } var objectProto$c = Object.prototype; var hasOwnProperty$b = objectProto$c.hasOwnProperty; function assignValue(object3, key2, value24) { var objValue = object3[key2]; if (!(hasOwnProperty$b.call(object3, key2) && eq(objValue, value24)) || value24 === void 0 && !(key2 in object3)) { baseAssignValue(object3, key2, value24); } } function copyObject(source2, props2, object3, customizer) { var isNew = !object3; object3 || (object3 = {}); var index2 = -1, length = props2.length; while (++index2 < length) { var key2 = props2[index2]; var newValue = customizer ? customizer(object3[key2], source2[key2], key2, object3, source2) : void 0; if (newValue === void 0) { newValue = source2[key2]; } if (isNew) { baseAssignValue(object3, key2, newValue); } else { assignValue(object3, key2, newValue); } } return object3; } var nativeMax$3 = Math.max; function overRest(func, start, transform2) { start = nativeMax$3(start === void 0 ? func.length - 1 : start, 0); return function() { var args = arguments, index2 = -1, length = nativeMax$3(args.length - start, 0), array3 = Array(length); while (++index2 < length) { array3[index2] = args[start + index2]; } index2 = -1; var otherArgs = Array(start + 1); while (++index2 < start) { otherArgs[index2] = args[index2]; } otherArgs[start] = transform2(array3); return apply(func, this, otherArgs); }; } function baseRest(func, start) { return setToString$1(overRest(func, start, identity), func + ""); } var MAX_SAFE_INTEGER$1 = 9007199254740991; function isLength(value24) { return typeof value24 == "number" && value24 > -1 && value24 % 1 == 0 && value24 <= MAX_SAFE_INTEGER$1; } function isArrayLike(value24) { return value24 != null && isLength(value24.length) && !isFunction$2(value24); } function isIterateeCall(value24, index2, object3) { if (!isObject$3(object3)) { return false; } var type2 = typeof index2; if (type2 == "number" ? isArrayLike(object3) && isIndex(index2, object3.length) : type2 == "string" && index2 in object3) { return eq(object3[index2], value24); } return false; } function createAssigner(assigner) { return baseRest(function(object3, sources) { var index2 = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0; customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? void 0 : customizer; length = 1; } object3 = Object(object3); while (++index2 < length) { var source2 = sources[index2]; if (source2) { assigner(object3, source2, index2, customizer); } } return object3; }); } var objectProto$b = Object.prototype; function isPrototype(value24) { var Ctor = value24 && value24.constructor, proto2 = typeof Ctor == "function" && Ctor.prototype || objectProto$b; return value24 === proto2; } function baseTimes(n2, iteratee) { var index2 = -1, result = Array(n2); while (++index2 < n2) { result[index2] = iteratee(index2); } return result; } var argsTag$3 = "[object Arguments]"; function baseIsArguments(value24) { return isObjectLike(value24) && baseGetTag(value24) == argsTag$3; } var objectProto$a = Object.prototype; var hasOwnProperty$a = objectProto$a.hasOwnProperty; var propertyIsEnumerable$1 = objectProto$a.propertyIsEnumerable; var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value24) { return isObjectLike(value24) && hasOwnProperty$a.call(value24, "callee") && !propertyIsEnumerable$1.call(value24, "callee"); }; var isArguments$1 = isArguments; function stubFalse() { return false; } var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports; var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module; var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2; var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0; var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0; var isBuffer$2 = nativeIsBuffer || stubFalse; var isBuffer$3 = isBuffer$2; var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$4 = "[object Number]", objectTag$4 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]"; var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]"; var typedArrayTags = {}; typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true; typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$5] = typedArrayTags[numberTag$4] = typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false; function baseIsTypedArray(value24) { return isObjectLike(value24) && isLength(value24.length) && !!typedArrayTags[baseGetTag(value24)]; } function baseUnary(func) { return function(value24) { return func(value24); }; } var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports; var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module; var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1; var freeProcess = moduleExports$1 && freeGlobal$1.process; var nodeUtil = function() { try { var types2 = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types; if (types2) { return types2; } return freeProcess && freeProcess.binding && freeProcess.binding("util"); } catch (e2) { } }(); var nodeUtil$1 = nodeUtil; var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray; var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; var isTypedArray$1 = isTypedArray; var objectProto$9 = Object.prototype; var hasOwnProperty$9 = objectProto$9.hasOwnProperty; function arrayLikeKeys(value24, inherited) { var isArr = isArray$7(value24), isArg = !isArr && isArguments$1(value24), isBuff = !isArr && !isArg && isBuffer$3(value24), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value24), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value24.length, String) : [], length = result.length; for (var key2 in value24) { if ((inherited || hasOwnProperty$9.call(value24, key2)) && !(skipIndexes && (key2 == "length" || isBuff && (key2 == "offset" || key2 == "parent") || isType && (key2 == "buffer" || key2 == "byteLength" || key2 == "byteOffset") || isIndex(key2, length)))) { result.push(key2); } } return result; } function overArg(func, transform2) { return function(arg) { return func(transform2(arg)); }; } var nativeKeys = overArg(Object.keys, Object); var nativeKeys$1 = nativeKeys; var objectProto$8 = Object.prototype; var hasOwnProperty$8 = objectProto$8.hasOwnProperty; function baseKeys(object3) { if (!isPrototype(object3)) { return nativeKeys$1(object3); } var result = []; for (var key2 in Object(object3)) { if (hasOwnProperty$8.call(object3, key2) && key2 != "constructor") { result.push(key2); } } return result; } function keys(object3) { return isArrayLike(object3) ? arrayLikeKeys(object3) : baseKeys(object3); } function nativeKeysIn(object3) { var result = []; if (object3 != null) { for (var key2 in Object(object3)) { result.push(key2); } } return result; } var objectProto$7 = Object.prototype; var hasOwnProperty$7 = objectProto$7.hasOwnProperty; function baseKeysIn(object3) { if (!isObject$3(object3)) { return nativeKeysIn(object3); } var isProto = isPrototype(object3), result = []; for (var key2 in object3) { if (!(key2 == "constructor" && (isProto || !hasOwnProperty$7.call(object3, key2)))) { result.push(key2); } } return result; } function keysIn(object3) { return isArrayLike(object3) ? arrayLikeKeys(object3, true) : baseKeysIn(object3); } var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/; function isKey(value24, object3) { if (isArray$7(value24)) { return false; } var type2 = typeof value24; if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value24 == null || isSymbol$1(value24)) { return true; } return reIsPlainProp.test(value24) || !reIsDeepProp.test(value24) || object3 != null && value24 in Object(object3); } var nativeCreate = getNative(Object, "create"); var nativeCreate$1 = nativeCreate; function hashClear() { this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {}; this.size = 0; } function hashDelete(key2) { var result = this.has(key2) && delete this.__data__[key2]; this.size -= result ? 1 : 0; return result; } var HASH_UNDEFINED$2 = "__lodash_hash_undefined__"; var objectProto$6 = Object.prototype; var hasOwnProperty$6 = objectProto$6.hasOwnProperty; function hashGet(key2) { var data65 = this.__data__; if (nativeCreate$1) { var result = data65[key2]; return result === HASH_UNDEFINED$2 ? void 0 : result; } return hasOwnProperty$6.call(data65, key2) ? data65[key2] : void 0; } var objectProto$5 = Object.prototype; var hasOwnProperty$5 = objectProto$5.hasOwnProperty; function hashHas(key2) { var data65 = this.__data__; return nativeCreate$1 ? data65[key2] !== void 0 : hasOwnProperty$5.call(data65, key2); } var HASH_UNDEFINED$1 = "__lodash_hash_undefined__"; function hashSet(key2, value24) { var data65 = this.__data__; this.size += this.has(key2) ? 0 : 1; data65[key2] = nativeCreate$1 && value24 === void 0 ? HASH_UNDEFINED$1 : value24; return this; } function Hash(entries2) { var index2 = -1, length = entries2 == null ? 0 : entries2.length; this.clear(); while (++index2 < length) { var entry = entries2[index2]; this.set(entry[0], entry[1]); } } Hash.prototype.clear = hashClear; Hash.prototype["delete"] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; function listCacheClear() { this.__data__ = []; this.size = 0; } function assocIndexOf(array3, key2) { var length = array3.length; while (length--) { if (eq(array3[length][0], key2)) { return length; } } return -1; } var arrayProto = Array.prototype; var splice = arrayProto.splice; function listCacheDelete(key2) { var data65 = this.__data__, index2 = assocIndexOf(data65, key2); if (index2 < 0) { return false; } var lastIndex = data65.length - 1; if (index2 == lastIndex) { data65.pop(); } else { splice.call(data65, index2, 1); } --this.size; return true; } function listCacheGet(key2) { var data65 = this.__data__, index2 = assocIndexOf(data65, key2); return index2 < 0 ? void 0 : data65[index2][1]; } function listCacheHas(key2) { return assocIndexOf(this.__data__, key2) > -1; } function listCacheSet(key2, value24) { var data65 = this.__data__, index2 = assocIndexOf(data65, key2); if (index2 < 0) { ++this.size; data65.push([key2, value24]); } else { data65[index2][1] = value24; } return this; } function ListCache(entries2) { var index2 = -1, length = entries2 == null ? 0 : entries2.length; this.clear(); while (++index2 < length) { var entry = entries2[index2]; this.set(entry[0], entry[1]); } } ListCache.prototype.clear = listCacheClear; ListCache.prototype["delete"] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; var Map$1 = getNative(root$1, "Map"); var Map$2 = Map$1; function mapCacheClear() { this.size = 0; this.__data__ = { "hash": new Hash(), "map": new (Map$2 || ListCache)(), "string": new Hash() }; } function isKeyable(value24) { var type2 = typeof value24; return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value24 !== "__proto__" : value24 === null; } function getMapData(map2, key2) { var data65 = map2.__data__; return isKeyable(key2) ? data65[typeof key2 == "string" ? "string" : "hash"] : data65.map; } function mapCacheDelete(key2) { var result = getMapData(this, key2)["delete"](key2); this.size -= result ? 1 : 0; return result; } function mapCacheGet(key2) { return getMapData(this, key2).get(key2); } function mapCacheHas(key2) { return getMapData(this, key2).has(key2); } function mapCacheSet(key2, value24) { var data65 = getMapData(this, key2), size = data65.size; data65.set(key2, value24); this.size += data65.size == size ? 0 : 1; return this; } function MapCache(entries2) { var index2 = -1, length = entries2 == null ? 0 : entries2.length; this.clear(); while (++index2 < length) { var entry = entries2[index2]; this.set(entry[0], entry[1]); } } MapCache.prototype.clear = mapCacheClear; MapCache.prototype["delete"] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; var FUNC_ERROR_TEXT$1 = "Expected a function"; function memoize(func, resolver) { if (typeof func != "function" || resolver != null && typeof resolver != "function") { throw new TypeError(FUNC_ERROR_TEXT$1); } var memoized = function() { var args = arguments, key2 = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache; if (cache2.has(key2)) { return cache2.get(key2); } var result = func.apply(this, args); memoized.cache = cache2.set(key2, result) || cache2; return result; }; memoized.cache = new (memoize.Cache || MapCache)(); return memoized; } memoize.Cache = MapCache; var MAX_MEMOIZE_SIZE = 500; function memoizeCapped(func) { var result = memoize(func, function(key2) { if (cache2.size === MAX_MEMOIZE_SIZE) { cache2.clear(); } return key2; }); var cache2 = result.cache; return result; } var rePropName$1 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; var reEscapeChar$1 = /\\(\\)?/g; var stringToPath$1 = memoizeCapped(function(string2) { var result = []; if (string2.charCodeAt(0) === 46) { result.push(""); } string2.replace(rePropName$1, function(match5, number3, quote2, subString) { result.push(quote2 ? subString.replace(reEscapeChar$1, "$1") : number3 || match5); }); return result; }); var stringToPath$2 = stringToPath$1; function toString$2(value24) { return value24 == null ? "" : baseToString(value24); } function castPath(value24, object3) { if (isArray$7(value24)) { return value24; } return isKey(value24, object3) ? [value24] : stringToPath$2(toString$2(value24)); } var INFINITY$1 = 1 / 0; function toKey(value24) { if (typeof value24 == "string" || isSymbol$1(value24)) { return value24; } var result = value24 + ""; return result == "0" && 1 / value24 == -INFINITY$1 ? "-0" : result; } function baseGet(object3, path2) { path2 = castPath(path2, object3); var index2 = 0, length = path2.length; while (object3 != null && index2 < length) { object3 = object3[toKey(path2[index2++])]; } return index2 && index2 == length ? object3 : void 0; } function get(object3, path2, defaultValue) { var result = object3 == null ? void 0 : baseGet(object3, path2); return result === void 0 ? defaultValue : result; } function arrayPush(array3, values2) { var index2 = -1, length = values2.length, offset4 = array3.length; while (++index2 < length) { array3[offset4 + index2] = values2[index2]; } return array3; } var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : void 0; function isFlattenable(value24) { return isArray$7(value24) || isArguments$1(value24) || !!(spreadableSymbol && value24 && value24[spreadableSymbol]); } function baseFlatten(array3, depth, predicate, isStrict, result) { var index2 = -1, length = array3.length; predicate || (predicate = isFlattenable); result || (result = []); while (++index2 < length) { var value24 = array3[index2]; if (depth > 0 && predicate(value24)) { if (depth > 1) { baseFlatten(value24, depth - 1, predicate, isStrict, result); } else { arrayPush(result, value24); } } else if (!isStrict) { result[result.length] = value24; } } return result; } function flatten(array3) { var length = array3 == null ? 0 : array3.length; return length ? baseFlatten(array3, 1) : []; } function flatRest(func) { return setToString$1(overRest(func, void 0, flatten), func + ""); } var getPrototype = overArg(Object.getPrototypeOf, Object); var getPrototype$1 = getPrototype; var objectTag$3 = "[object Object]"; var funcProto = Function.prototype, objectProto$4 = Object.prototype; var funcToString = funcProto.toString; var hasOwnProperty$4 = objectProto$4.hasOwnProperty; var objectCtorString = funcToString.call(Object); function isPlainObject$1(value24) { if (!isObjectLike(value24) || baseGetTag(value24) != objectTag$3) { return false; } var proto2 = getPrototype$1(value24); if (proto2 === null) { return true; } var Ctor = hasOwnProperty$4.call(proto2, "constructor") && proto2.constructor; return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; } function baseSlice(array3, start, end) { var index2 = -1, length = array3.length; if (start < 0) { start = -start > length ? 0 : length + start; } end = end > length ? length : end; if (end < 0) { end += length; } length = start > end ? 0 : end - start >>> 0; start >>>= 0; var result = Array(length); while (++index2 < length) { result[index2] = array3[index2 + start]; } return result; } function castSlice(array3, start, end) { var length = array3.length; end = end === void 0 ? length : end; return !start && end >= length ? array3 : baseSlice(array3, start, end); } var rsAstralRange$1 = "\\ud800-\\udfff", rsComboMarksRange$1 = "\\u0300-\\u036f", reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f", rsComboSymbolsRange$1 = "\\u20d0-\\u20ff", rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1, rsVarRange$1 = "\\ufe0e\\ufe0f"; var rsZWJ$1 = "\\u200d"; var reHasUnicode = RegExp("[" + rsZWJ$1 + rsAstralRange$1 + rsComboRange$1 + rsVarRange$1 + "]"); function hasUnicode(string2) { return reHasUnicode.test(string2); } function asciiToArray(string2) { return string2.split(""); } var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsVarRange = "\\ufe0e\\ufe0f"; var rsAstral = "[" + rsAstralRange + "]", rsCombo = "[" + rsComboRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsZWJ = "\\u200d"; var reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")"; var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); function unicodeToArray(string2) { return string2.match(reUnicode) || []; } function stringToArray(string2) { return hasUnicode(string2) ? unicodeToArray(string2) : asciiToArray(string2); } function createCaseFirst(methodName) { return function(string2) { string2 = toString$2(string2); var strSymbols = hasUnicode(string2) ? stringToArray(string2) : void 0; var chr = strSymbols ? strSymbols[0] : string2.charAt(0); var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string2.slice(1); return chr[methodName]() + trailing; }; } var upperFirst$1 = createCaseFirst("toUpperCase"); var upperFirst$2 = upperFirst$1; function stackClear() { this.__data__ = new ListCache(); this.size = 0; } function stackDelete(key2) { var data65 = this.__data__, result = data65["delete"](key2); this.size = data65.size; return result; } function stackGet(key2) { return this.__data__.get(key2); } function stackHas(key2) { return this.__data__.has(key2); } var LARGE_ARRAY_SIZE$1 = 200; function stackSet(key2, value24) { var data65 = this.__data__; if (data65 instanceof ListCache) { var pairs = data65.__data__; if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) { pairs.push([key2, value24]); this.size = ++data65.size; return this; } data65 = this.__data__ = new MapCache(pairs); } data65.set(key2, value24); this.size = data65.size; return this; } function Stack(entries2) { var data65 = this.__data__ = new ListCache(entries2); this.size = data65.size; } Stack.prototype.clear = stackClear; Stack.prototype["delete"] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; function baseAssign(object3, source2) { return object3 && copyObject(source2, keys(source2), object3); } function baseAssignIn(object3, source2) { return object3 && copyObject(source2, keysIn(source2), object3); } var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module; var moduleExports = freeModule && freeModule.exports === freeExports; var Buffer = moduleExports ? root$1.Buffer : void 0, allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0; function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); buffer.copy(result); return result; } function arrayFilter(array3, predicate) { var index2 = -1, length = array3 == null ? 0 : array3.length, resIndex = 0, result = []; while (++index2 < length) { var value24 = array3[index2]; if (predicate(value24, index2, array3)) { result[resIndex++] = value24; } } return result; } function stubArray() { return []; } var objectProto$3 = Object.prototype; var propertyIsEnumerable = objectProto$3.propertyIsEnumerable; var nativeGetSymbols$1 = Object.getOwnPropertySymbols; var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object3) { if (object3 == null) { return []; } object3 = Object(object3); return arrayFilter(nativeGetSymbols$1(object3), function(symbol) { return propertyIsEnumerable.call(object3, symbol); }); }; var getSymbols$1 = getSymbols; function copySymbols(source2, object3) { return copyObject(source2, getSymbols$1(source2), object3); } var nativeGetSymbols = Object.getOwnPropertySymbols; var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object3) { var result = []; while (object3) { arrayPush(result, getSymbols$1(object3)); object3 = getPrototype$1(object3); } return result; }; var getSymbolsIn$1 = getSymbolsIn; function copySymbolsIn(source2, object3) { return copyObject(source2, getSymbolsIn$1(source2), object3); } function baseGetAllKeys(object3, keysFunc, symbolsFunc) { var result = keysFunc(object3); return isArray$7(object3) ? result : arrayPush(result, symbolsFunc(object3)); } function getAllKeys(object3) { return baseGetAllKeys(object3, keys, getSymbols$1); } function getAllKeysIn(object3) { return baseGetAllKeys(object3, keysIn, getSymbolsIn$1); } var DataView$1 = getNative(root$1, "DataView"); var DataView$2 = DataView$1; var Promise$1 = getNative(root$1, "Promise"); var Promise$2 = Promise$1; var Set$1 = getNative(root$1, "Set"); var Set$2 = Set$1; var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]"; var dataViewTag$3 = "[object DataView]"; var dataViewCtorString = toSource(DataView$2), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$2); var getTag = baseGetTag; if (DataView$2 && getTag(new DataView$2(new ArrayBuffer(1))) != dataViewTag$3 || Map$2 && getTag(new Map$2()) != mapTag$4 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag$4 || WeakMap$2 && getTag(new WeakMap$2()) != weakMapTag$1) { getTag = function(value24) { var result = baseGetTag(value24), Ctor = result == objectTag$2 ? value24.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : ""; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag$3; case mapCtorString: return mapTag$4; case promiseCtorString: return promiseTag; case setCtorString: return setTag$4; case weakMapCtorString: return weakMapTag$1; } } return result; }; } var getTag$1 = getTag; var objectProto$2 = Object.prototype; var hasOwnProperty$3 = objectProto$2.hasOwnProperty; function initCloneArray(array3) { var length = array3.length, result = new array3.constructor(length); if (length && typeof array3[0] == "string" && hasOwnProperty$3.call(array3, "index")) { result.index = array3.index; result.input = array3.input; } return result; } var Uint8Array$1 = root$1.Uint8Array; var Uint8Array$2 = Uint8Array$1; function cloneArrayBuffer(arrayBuffer) { var result = new arrayBuffer.constructor(arrayBuffer.byteLength); new Uint8Array$2(result).set(new Uint8Array$2(arrayBuffer)); return result; } function cloneDataView(dataView, isDeep) { var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); } var reFlags = /\w*$/; function cloneRegExp(regexp3) { var result = new regexp3.constructor(regexp3.source, reFlags.exec(regexp3)); result.lastIndex = regexp3.lastIndex; return result; } var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0; function cloneSymbol(symbol) { return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {}; } function cloneTypedArray(typedArray, isDeep) { var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$3 = "[object Map]", numberTag$3 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]"; var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]"; function initCloneByTag(object3, tag, isDeep) { var Ctor = object3.constructor; switch (tag) { case arrayBufferTag$2: return cloneArrayBuffer(object3); case boolTag$2: case dateTag$2: return new Ctor(+object3); case dataViewTag$2: return cloneDataView(object3, isDeep); case float32Tag$1: case float64Tag$1: case int8Tag$1: case int16Tag$1: case int32Tag$1: case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1: return cloneTypedArray(object3, isDeep); case mapTag$3: return new Ctor(); case numberTag$3: case stringTag$2: return new Ctor(object3); case regexpTag$2: return cloneRegExp(object3); case setTag$3: return new Ctor(); case symbolTag$2: return cloneSymbol(object3); } } function initCloneObject(object3) { return typeof object3.constructor == "function" && !isPrototype(object3) ? baseCreate$1(getPrototype$1(object3)) : {}; } var mapTag$2 = "[object Map]"; function baseIsMap(value24) { return isObjectLike(value24) && getTag$1(value24) == mapTag$2; } var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap; var isMap$1 = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; var isMap$2 = isMap$1; var setTag$2 = "[object Set]"; function baseIsSet(value24) { return isObjectLike(value24) && getTag$1(value24) == setTag$2; } var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet; var isSet$1 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; var isSet$2 = isSet$1; var CLONE_DEEP_FLAG$2 = 1, CLONE_FLAT_FLAG$1 = 2, CLONE_SYMBOLS_FLAG$3 = 4; var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$2 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]"; var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; var cloneableTags = {}; cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$2] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; function baseClone(value24, bitmask, customizer, key2, object3, stack) { var result, isDeep = bitmask & CLONE_DEEP_FLAG$2, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$3; if (customizer) { result = object3 ? customizer(value24, key2, object3, stack) : customizer(value24); } if (result !== void 0) { return result; } if (!isObject$3(value24)) { return value24; } var isArr = isArray$7(value24); if (isArr) { result = initCloneArray(value24); if (!isDeep) { return copyArray(value24, result); } } else { var tag = getTag$1(value24), isFunc = tag == funcTag || tag == genTag; if (isBuffer$3(value24)) { return cloneBuffer(value24, isDeep); } if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object3) { result = isFlat || isFunc ? {} : initCloneObject(value24); if (!isDeep) { return isFlat ? copySymbolsIn(value24, baseAssignIn(result, value24)) : copySymbols(value24, baseAssign(result, value24)); } } else { if (!cloneableTags[tag]) { return object3 ? value24 : {}; } result = initCloneByTag(value24, tag, isDeep); } } stack || (stack = new Stack()); var stacked = stack.get(value24); if (stacked) { return stacked; } stack.set(value24, result); if (isSet$2(value24)) { value24.forEach(function(subValue) { result.add(baseClone(subValue, bitmask, customizer, subValue, value24, stack)); }); } else if (isMap$2(value24)) { value24.forEach(function(subValue, key3) { result.set(key3, baseClone(subValue, bitmask, customizer, key3, value24, stack)); }); } var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys; var props2 = isArr ? void 0 : keysFunc(value24); arrayEach(props2 || value24, function(subValue, key3) { if (props2) { key3 = subValue; subValue = value24[key3]; } assignValue(result, key3, baseClone(subValue, bitmask, customizer, key3, value24, stack)); }); return result; } var CLONE_SYMBOLS_FLAG$2 = 4; function clone(value24) { return baseClone(value24, CLONE_SYMBOLS_FLAG$2); } var CLONE_DEEP_FLAG$1 = 1, CLONE_SYMBOLS_FLAG$1 = 4; function cloneDeep(value24) { return baseClone(value24, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1); } var HASH_UNDEFINED = "__lodash_hash_undefined__"; function setCacheAdd(value24) { this.__data__.set(value24, HASH_UNDEFINED); return this; } function setCacheHas(value24) { return this.__data__.has(value24); } function SetCache(values2) { var index2 = -1, length = values2 == null ? 0 : values2.length; this.__data__ = new MapCache(); while (++index2 < length) { this.add(values2[index2]); } } SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; function arraySome(array3, predicate) { var index2 = -1, length = array3 == null ? 0 : array3.length; while (++index2 < length) { if (predicate(array3[index2], index2, array3)) { return true; } } return false; } function cacheHas(cache2, key2) { return cache2.has(key2); } var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2; function equalArrays(array3, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array3.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } var arrStacked = stack.get(array3); var othStacked = stack.get(other); if (arrStacked && othStacked) { return arrStacked == other && othStacked == array3; } var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0; stack.set(array3, other); stack.set(other, array3); while (++index2 < arrLength) { var arrValue = array3[index2], othValue = other[index2]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index2, other, array3, stack) : customizer(arrValue, othValue, index2, array3, other, stack); } if (compared !== void 0) { if (compared) { continue; } result = false; break; } if (seen) { if (!arraySome(other, function(othValue2, othIndex) { if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { result = false; break; } } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { result = false; break; } } stack["delete"](array3); stack["delete"](other); return result; } function mapToArray(map2) { var index2 = -1, result = Array(map2.size); map2.forEach(function(value24, key2) { result[++index2] = [key2, value24]; }); return result; } function setToArray(set2) { var index2 = -1, result = Array(set2.size); set2.forEach(function(value24) { result[++index2] = value24; }); return result; } var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2; var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag$1 = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]"; var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]"; var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0; function equalByTag(object3, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: if (object3.byteLength != other.byteLength || object3.byteOffset != other.byteOffset) { return false; } object3 = object3.buffer; other = other.buffer; case arrayBufferTag: if (object3.byteLength != other.byteLength || !equalFunc(new Uint8Array$2(object3), new Uint8Array$2(other))) { return false; } return true; case boolTag: case dateTag: case numberTag$1: return eq(+object3, +other); case errorTag: return object3.name == other.name && object3.message == other.message; case regexpTag: case stringTag: return object3 == other + ""; case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4; convert || (convert = setToArray); if (object3.size != other.size && !isPartial) { return false; } var stacked = stack.get(object3); if (stacked) { return stacked == other; } bitmask |= COMPARE_UNORDERED_FLAG$2; stack.set(object3, other); var result = equalArrays(convert(object3), convert(other), bitmask, customizer, equalFunc, stack); stack["delete"](object3); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object3) == symbolValueOf.call(other); } } return false; } var COMPARE_PARTIAL_FLAG$3 = 1; var objectProto$1 = Object.prototype; var hasOwnProperty$2 = objectProto$1.hasOwnProperty; function equalObjects(object3, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object3), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index2 = objLength; while (index2--) { var key2 = objProps[index2]; if (!(isPartial ? key2 in other : hasOwnProperty$2.call(other, key2))) { return false; } } var objStacked = stack.get(object3); var othStacked = stack.get(other); if (objStacked && othStacked) { return objStacked == other && othStacked == object3; } var result = true; stack.set(object3, other); stack.set(other, object3); var skipCtor = isPartial; while (++index2 < objLength) { key2 = objProps[index2]; var objValue = object3[key2], othValue = other[key2]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key2, other, object3, stack) : customizer(objValue, othValue, key2, object3, other, stack); } if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { result = false; break; } skipCtor || (skipCtor = key2 == "constructor"); } if (result && !skipCtor) { var objCtor = object3.constructor, othCtor = other.constructor; if (objCtor != othCtor && ("constructor" in object3 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { result = false; } } stack["delete"](object3); stack["delete"](other); return result; } var COMPARE_PARTIAL_FLAG$2 = 1; var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]"; var objectProto = Object.prototype; var hasOwnProperty$1 = objectProto.hasOwnProperty; function baseIsEqualDeep(object3, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray$7(object3), othIsArr = isArray$7(other), objTag = objIsArr ? arrayTag : getTag$1(object3), othTag = othIsArr ? arrayTag : getTag$1(other); objTag = objTag == argsTag ? objectTag : objTag; othTag = othTag == argsTag ? objectTag : othTag; var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && isBuffer$3(object3)) { if (!isBuffer$3(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { stack || (stack = new Stack()); return objIsArr || isTypedArray$1(object3) ? equalArrays(object3, other, bitmask, customizer, equalFunc, stack) : equalByTag(object3, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) { var objIsWrapped = objIsObj && hasOwnProperty$1.call(object3, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__"); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object3.value() : object3, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack()); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack()); return equalObjects(object3, other, bitmask, customizer, equalFunc, stack); } function baseIsEqual(value24, other, bitmask, customizer, stack) { if (value24 === other) { return true; } if (value24 == null || other == null || !isObjectLike(value24) && !isObjectLike(other)) { return value24 !== value24 && other !== other; } return baseIsEqualDeep(value24, other, bitmask, customizer, baseIsEqual, stack); } var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2; function baseIsMatch(object3, source2, matchData, customizer) { var index2 = matchData.length, length = index2, noCustomizer = !customizer; if (object3 == null) { return !length; } object3 = Object(object3); while (index2--) { var data65 = matchData[index2]; if (noCustomizer && data65[2] ? data65[1] !== object3[data65[0]] : !(data65[0] in object3)) { return false; } } while (++index2 < length) { data65 = matchData[index2]; var key2 = data65[0], objValue = object3[key2], srcValue = data65[1]; if (noCustomizer && data65[2]) { if (objValue === void 0 && !(key2 in object3)) { return false; } } else { var stack = new Stack(); if (customizer) { var result = customizer(objValue, srcValue, key2, object3, source2, stack); } if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) { return false; } } } return true; } function isStrictComparable(value24) { return value24 === value24 && !isObject$3(value24); } function getMatchData(object3) { var result = keys(object3), length = result.length; while (length--) { var key2 = result[length], value24 = object3[key2]; result[length] = [key2, value24, isStrictComparable(value24)]; } return result; } function matchesStrictComparable(key2, srcValue) { return function(object3) { if (object3 == null) { return false; } return object3[key2] === srcValue && (srcValue !== void 0 || key2 in Object(object3)); }; } function baseMatches(source2) { var matchData = getMatchData(source2); if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object3) { return object3 === source2 || baseIsMatch(object3, source2, matchData); }; } function baseHasIn(object3, key2) { return object3 != null && key2 in Object(object3); } function hasPath(object3, path2, hasFunc) { path2 = castPath(path2, object3); var index2 = -1, length = path2.length, result = false; while (++index2 < length) { var key2 = toKey(path2[index2]); if (!(result = object3 != null && hasFunc(object3, key2))) { break; } object3 = object3[key2]; } if (result || ++index2 != length) { return result; } length = object3 == null ? 0 : object3.length; return !!length && isLength(length) && isIndex(key2, length) && (isArray$7(object3) || isArguments$1(object3)); } function hasIn(object3, path2) { return object3 != null && hasPath(object3, path2, baseHasIn); } var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; function baseMatchesProperty(path2, srcValue) { if (isKey(path2) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path2), srcValue); } return function(object3) { var objValue = get(object3, path2); return objValue === void 0 && objValue === srcValue ? hasIn(object3, path2) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } function baseProperty(key2) { return function(object3) { return object3 == null ? void 0 : object3[key2]; }; } function basePropertyDeep(path2) { return function(object3) { return baseGet(object3, path2); }; } function property(path2) { return isKey(path2) ? baseProperty(toKey(path2)) : basePropertyDeep(path2); } function baseIteratee(value24) { if (typeof value24 == "function") { return value24; } if (value24 == null) { return identity; } if (typeof value24 == "object") { return isArray$7(value24) ? baseMatchesProperty(value24[0], value24[1]) : baseMatches(value24); } return property(value24); } function arrayAggregator(array3, setter, iteratee, accumulator) { var index2 = -1, length = array3 == null ? 0 : array3.length; while (++index2 < length) { var value24 = array3[index2]; setter(accumulator, value24, iteratee(value24), array3); } return accumulator; } function createBaseFor(fromRight) { return function(object3, iteratee, keysFunc) { var index2 = -1, iterable = Object(object3), props2 = keysFunc(object3), length = props2.length; while (length--) { var key2 = props2[fromRight ? length : ++index2]; if (iteratee(iterable[key2], key2, iterable) === false) { break; } } return object3; }; } var baseFor = createBaseFor(); var baseFor$1 = baseFor; function baseForOwn(object3, iteratee) { return object3 && baseFor$1(object3, iteratee, keys); } function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { if (collection == null) { return collection; } if (!isArrayLike(collection)) { return eachFunc(collection, iteratee); } var length = collection.length, index2 = fromRight ? length : -1, iterable = Object(collection); while (fromRight ? index2-- : ++index2 < length) { if (iteratee(iterable[index2], index2, iterable) === false) { break; } } return collection; }; } var baseEach = createBaseEach(baseForOwn); var baseEach$1 = baseEach; function baseAggregator(collection, setter, iteratee, accumulator) { baseEach$1(collection, function(value24, key2, collection2) { setter(accumulator, value24, iteratee(value24), collection2); }); return accumulator; } function createAggregator(setter, initializer) { return function(collection, iteratee) { var func = isArray$7(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; return func(collection, setter, baseIteratee(iteratee), accumulator); }; } var now$2 = function() { return root$1.Date.now(); }; var now$3 = now$2; var FUNC_ERROR_TEXT = "Expected a function"; var nativeMax$2 = Math.max, nativeMin$1 = Math.min; function debounce$1(func, wait, options2) { var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; if (typeof func != "function") { throw new TypeError(FUNC_ERROR_TEXT); } wait = toNumber(wait) || 0; if (isObject$3(options2)) { leading = !!options2.leading; maxing = "maxWait" in options2; maxWait = maxing ? nativeMax$2(toNumber(options2.maxWait) || 0, wait) : maxWait; trailing = "trailing" in options2 ? !!options2.trailing : trailing; } function invokeFunc(time) { var args = lastArgs, thisArg = lastThis; lastArgs = lastThis = void 0; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function leadingEdge(time) { lastInvokeTime = time; timerId = setTimeout(timerExpired, wait); return leading ? invokeFunc(time) : result; } function remainingWait(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; return maxing ? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; } function timerExpired() { var time = now$3(); if (shouldInvoke(time)) { return trailingEdge(time); } timerId = setTimeout(timerExpired, remainingWait(time)); } function trailingEdge(time) { timerId = void 0; if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = void 0; return result; } function cancel2() { if (timerId !== void 0) { clearTimeout(timerId); } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = void 0; } function flush() { return timerId === void 0 ? result : trailingEdge(now$3()); } function debounced() { var time = now$3(), isInvoking = shouldInvoke(time); lastArgs = arguments; lastThis = this; lastCallTime = time; if (isInvoking) { if (timerId === void 0) { return leadingEdge(lastCallTime); } if (maxing) { clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } } if (timerId === void 0) { timerId = setTimeout(timerExpired, wait); } return result; } debounced.cancel = cancel2; debounced.flush = flush; return debounced; } function assignMergeValue(object3, key2, value24) { if (value24 !== void 0 && !eq(object3[key2], value24) || value24 === void 0 && !(key2 in object3)) { baseAssignValue(object3, key2, value24); } } function isArrayLikeObject(value24) { return isObjectLike(value24) && isArrayLike(value24); } function safeGet(object3, key2) { if (key2 === "constructor" && typeof object3[key2] === "function") { return; } if (key2 == "__proto__") { return; } return object3[key2]; } function toPlainObject(value24) { return copyObject(value24, keysIn(value24)); } function baseMergeDeep(object3, source2, key2, srcIndex, mergeFunc, customizer, stack) { var objValue = safeGet(object3, key2), srcValue = safeGet(source2, key2), stacked = stack.get(srcValue); if (stacked) { assignMergeValue(object3, key2, stacked); return; } var newValue = customizer ? customizer(objValue, srcValue, key2 + "", object3, source2, stack) : void 0; var isCommon = newValue === void 0; if (isCommon) { var isArr = isArray$7(srcValue), isBuff = !isArr && isBuffer$3(srcValue), isTyped = !isArr && !isBuff && isTypedArray$1(srcValue); newValue = srcValue; if (isArr || isBuff || isTyped) { if (isArray$7(objValue)) { newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else if (isBuff) { isCommon = false; newValue = cloneBuffer(srcValue, true); } else if (isTyped) { isCommon = false; newValue = cloneTypedArray(srcValue, true); } else { newValue = []; } } else if (isPlainObject$1(srcValue) || isArguments$1(srcValue)) { newValue = objValue; if (isArguments$1(objValue)) { newValue = toPlainObject(objValue); } else if (!isObject$3(objValue) || isFunction$2(objValue)) { newValue = initCloneObject(srcValue); } } else { isCommon = false; } } if (isCommon) { stack.set(srcValue, newValue); mergeFunc(newValue, srcValue, srcIndex, customizer, stack); stack["delete"](srcValue); } assignMergeValue(object3, key2, newValue); } function baseMerge(object3, source2, srcIndex, customizer, stack) { if (object3 === source2) { return; } baseFor$1(source2, function(srcValue, key2) { stack || (stack = new Stack()); if (isObject$3(srcValue)) { baseMergeDeep(object3, source2, key2, srcIndex, baseMerge, customizer, stack); } else { var newValue = customizer ? customizer(safeGet(object3, key2), srcValue, key2 + "", object3, source2, stack) : void 0; if (newValue === void 0) { newValue = srcValue; } assignMergeValue(object3, key2, newValue); } }, keysIn); } function arrayIncludesWith(array3, value24, comparator) { var index2 = -1, length = array3 == null ? 0 : array3.length; while (++index2 < length) { if (comparator(value24, array3[index2])) { return true; } } return false; } function last(array3) { var length = array3 == null ? 0 : array3.length; return length ? array3[length - 1] : void 0; } function createFind(findIndexFunc) { return function(collection, predicate, fromIndex) { var iterable = Object(collection); if (!isArrayLike(collection)) { var iteratee = baseIteratee(predicate); collection = keys(collection); predicate = function(key2) { return iteratee(iterable[key2], key2, iterable); }; } var index2 = findIndexFunc(collection, predicate, fromIndex); return index2 > -1 ? iterable[iteratee ? collection[index2] : index2] : void 0; }; } var nativeMax$1 = Math.max; function findIndex(array3, predicate, fromIndex) { var length = array3 == null ? 0 : array3.length; if (!length) { return -1; } var index2 = fromIndex == null ? 0 : toInteger(fromIndex); if (index2 < 0) { index2 = nativeMax$1(length + index2, 0); } return baseFindIndex(array3, baseIteratee(predicate), index2); } var find = createFind(findIndex); var find$1 = find; var nativeMax = Math.max; function indexOf$1(array3, value24, fromIndex) { var length = array3 == null ? 0 : array3.length; if (!length) { return -1; } var index2 = fromIndex == null ? 0 : toInteger(fromIndex); if (index2 < 0) { index2 = nativeMax(length + index2, 0); } return baseIndexOf(array3, value24, index2); } var nativeMin = Math.min; function baseIntersection(arrays2, iteratee, comparator) { var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays2[0].length, othLength = arrays2.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = []; while (othIndex--) { var array3 = arrays2[othIndex]; if (othIndex && iteratee) { array3 = arrayMap(array3, baseUnary(iteratee)); } maxLength = nativeMin(array3.length, maxLength); caches[othIndex] = !comparator && (iteratee || length >= 120 && array3.length >= 120) ? new SetCache(othIndex && array3) : void 0; } array3 = arrays2[0]; var index2 = -1, seen = caches[0]; outer: while (++index2 < length && result.length < maxLength) { var value24 = array3[index2], computed2 = iteratee ? iteratee(value24) : value24; value24 = comparator || value24 !== 0 ? value24 : 0; if (!(seen ? cacheHas(seen, computed2) : includes(result, computed2, comparator))) { othIndex = othLength; while (--othIndex) { var cache2 = caches[othIndex]; if (!(cache2 ? cacheHas(cache2, computed2) : includes(arrays2[othIndex], computed2, comparator))) { continue outer; } } if (seen) { seen.push(computed2); } result.push(value24); } } return result; } function castArrayLikeObject(value24) { return isArrayLikeObject(value24) ? value24 : []; } var intersection = baseRest(function(arrays2) { var mapped = arrayMap(arrays2, castArrayLikeObject); return mapped.length && mapped[0] === arrays2[0] ? baseIntersection(mapped) : []; }); var intersection$1 = intersection; function parent(object3, path2) { return path2.length < 2 ? object3 : baseGet(object3, baseSlice(path2, 0, -1)); } function isEqual$1(value24, other) { return baseIsEqual(value24, other); } var numberTag = "[object Number]"; function isNumber$2(value24) { return typeof value24 == "number" || isObjectLike(value24) && baseGetTag(value24) == numberTag; } function isNil(value24) { return value24 == null; } var merge$2 = createAssigner(function(object3, source2, srcIndex) { baseMerge(object3, source2, srcIndex); }); var merge$3 = merge$2; function baseUnset(object3, path2) { path2 = castPath(path2, object3); object3 = parent(object3, path2); return object3 == null || delete object3[toKey(last(path2))]; } function customOmitClone(value24) { return isPlainObject$1(value24) ? void 0 : value24; } var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; var omit$1 = flatRest(function(object3, paths) { var result = {}; if (object3 == null) { return result; } var isDeep = false; paths = arrayMap(paths, function(path2) { path2 = castPath(path2, object3); isDeep || (isDeep = path2.length > 1); return path2; }); copyObject(object3, getAllKeysIn(object3), result); if (isDeep) { result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); } var length = paths.length; while (length--) { baseUnset(result, paths[length]); } return result; }); var omit$2 = omit$1; function baseSet(object3, path2, value24, customizer) { if (!isObject$3(object3)) { return object3; } path2 = castPath(path2, object3); var index2 = -1, length = path2.length, lastIndex = length - 1, nested = object3; while (nested != null && ++index2 < length) { var key2 = toKey(path2[index2]), newValue = value24; if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") { return object3; } if (index2 != lastIndex) { var objValue = nested[key2]; newValue = customizer ? customizer(objValue, key2, nested) : void 0; if (newValue === void 0) { newValue = isObject$3(objValue) ? objValue : isIndex(path2[index2 + 1]) ? [] : {}; } } assignValue(nested, key2, newValue); nested = nested[key2]; } return object3; } function basePickBy(object3, paths, predicate) { var index2 = -1, length = paths.length, result = {}; while (++index2 < length) { var path2 = paths[index2], value24 = baseGet(object3, path2); if (predicate(value24, path2)) { baseSet(result, castPath(path2, object3), value24); } } return result; } var partition = createAggregator(function(result, value24, key2) { result[key2 ? 0 : 1].push(value24); }, function() { return [[], []]; }); var partition$1 = partition; function basePick(object3, paths) { return basePickBy(object3, paths, function(value24, path2) { return hasIn(object3, path2); }); } var pick = flatRest(function(object3, paths) { return object3 == null ? {} : basePick(object3, paths); }); var pick$1 = pick; function set(object3, path2, value24) { return object3 == null ? object3 : baseSet(object3, path2, value24); } var INFINITY = 1 / 0; var createSet = !(Set$2 && 1 / setToArray(new Set$2([, -0]))[1] == INFINITY) ? noop$w : function(values2) { return new Set$2(values2); }; var createSet$1 = createSet; var LARGE_ARRAY_SIZE = 200; function baseUniq(array3, iteratee, comparator) { var index2 = -1, includes = arrayIncludes, length = array3.length, isCommon = true, result = [], seen = result; if (comparator) { isCommon = false; includes = arrayIncludesWith; } else if (length >= LARGE_ARRAY_SIZE) { var set2 = iteratee ? null : createSet$1(array3); if (set2) { return setToArray(set2); } isCommon = false; includes = cacheHas; seen = new SetCache(); } else { seen = iteratee ? [] : result; } outer: while (++index2 < length) { var value24 = array3[index2], computed2 = iteratee ? iteratee(value24) : value24; value24 = comparator || value24 !== 0 ? value24 : 0; if (isCommon && computed2 === computed2) { var seenIndex = seen.length; while (seenIndex--) { if (seen[seenIndex] === computed2) { continue outer; } } if (iteratee) { seen.push(computed2); } result.push(value24); } else if (!includes(seen, computed2, comparator)) { if (seen !== result) { seen.push(computed2); } result.push(value24); } } return result; } function uniq(array3) { return array3 && array3.length ? baseUniq(array3) : []; } function uniqBy(array3, iteratee) { return array3 && array3.length ? baseUniq(array3, baseIteratee(iteratee)) : []; } function getPopupContainer(node) { var _a3; return (_a3 = node == null ? void 0 : node.parentNode) != null ? _a3 : document.body; } const withInstall$1 = (component, alias) => { component.install = (app) => { const compName = component.name || component.displayName; if (!compName) return; app.component(compName, component); if (alias) { app.config.globalProperties[alias] = component; } }; return component; }; function setObjToUrlParams(baseUrl, obj) { let parameters = ""; for (const key2 in obj) { parameters += key2 + "=" + encodeURIComponent(obj[key2]) + "&"; } parameters = parameters.replace(/&$/, ""); return /\?$/.test(baseUrl) ? baseUrl + parameters : baseUrl.replace(/\/?$/, "?") + parameters; } function deepMerge$1(src2 = {}, target = {}) { let key2; const res = cloneDeep(src2); for (key2 in target) { res[key2] = isObject$4(res[key2]) ? deepMerge$1(res[key2], target[key2]) : res[key2] = target[key2]; } return res; } function getDynamicProps(props2) { const ret = {}; Object.keys(props2).map((key2) => { ret[key2] = unref(props2[key2]); }); return ret; } function createContext(context2, key2 = Symbol(), options2 = {}) { const { readonly: readonly$1 = true, createProvider = false, native = false } = options2; const state = reactive(context2); const provideData = readonly$1 ? readonly(state) : state; !createProvider && provide(key2, native ? context2 : provideData); return { state }; } function useContext(key2 = Symbol(), defaultValue) { return inject(key2, defaultValue || {}); } const key$4 = Symbol(); function createAppProviderContext(context2) { return createContext(context2, key$4); } function useAppProviderContext() { return useContext(key$4); } function tryOnScopeDispose(fn) { if (getCurrentScope()) { onScopeDispose(fn); return true; } return false; } const isClient$1 = typeof window !== "undefined"; function createFilterWrapper(filter, fn) { function wrapper(...args) { filter(() => fn.apply(this, args), { fn, thisArg: this, args }); } return wrapper; } function debounceFilter(ms, options2 = {}) { let timer; let maxTimer; const filter = (invoke) => { const duration2 = unref(ms); const maxDuration = unref(options2.maxWait); if (timer) clearTimeout(timer); if (duration2 <= 0 || maxDuration !== void 0 && maxDuration <= 0) { if (maxTimer) { clearTimeout(maxTimer); maxTimer = null; } return invoke(); } if (maxDuration && !maxTimer) { maxTimer = setTimeout(() => { if (timer) clearTimeout(timer); maxTimer = null; invoke(); }, maxDuration); } timer = setTimeout(() => { if (maxTimer) clearTimeout(maxTimer); maxTimer = null; invoke(); }, duration2); }; return filter; } function throttleFilter(ms, trailing = true, leading = true) { let lastExec = 0; let timer; let preventLeading = !leading; const clear2 = () => { if (timer) { clearTimeout(timer); timer = void 0; } }; const filter = (invoke) => { const duration2 = unref(ms); const elapsed = Date.now() - lastExec; clear2(); if (duration2 <= 0) { lastExec = Date.now(); return invoke(); } if (elapsed > duration2) { lastExec = Date.now(); if (preventLeading) preventLeading = false; else invoke(); } if (trailing) { timer = setTimeout(() => { lastExec = Date.now(); if (!leading) preventLeading = true; clear2(); invoke(); }, duration2); } if (!leading && !timer) timer = setTimeout(() => preventLeading = true, duration2); }; return filter; } function useDebounceFn(fn, ms = 200, options2 = {}) { return createFilterWrapper(debounceFilter(ms, options2), fn); } function useThrottleFn(fn, ms = 200, trailing = true, leading = true) { return createFilterWrapper(throttleFilter(ms, trailing, leading), fn); } function tryOnMounted(fn, sync = true) { if (getCurrentInstance()) onMounted(fn); else if (sync) fn(); else nextTick(fn); } function tryOnUnmounted(fn) { if (getCurrentInstance()) onUnmounted(fn); } function unrefElement(elRef) { var _a3; const plain = unref(elRef); return (_a3 = plain == null ? void 0 : plain.$el) != null ? _a3 : plain; } const defaultWindow = isClient$1 ? window : void 0; const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; const globalKey = "__vueuse_ssr_handlers__"; _global[globalKey] = _global[globalKey] || {}; _global[globalKey]; var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols; var __hasOwnProp$7 = Object.prototype.hasOwnProperty; var __propIsEnum$7 = Object.prototype.propertyIsEnumerable; var __objRest$1 = (source2, exclude) => { var target = {}; for (var prop in source2) if (__hasOwnProp$7.call(source2, prop) && exclude.indexOf(prop) < 0) target[prop] = source2[prop]; if (source2 != null && __getOwnPropSymbols$7) for (var prop of __getOwnPropSymbols$7(source2)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source2, prop)) target[prop] = source2[prop]; } return target; }; function useMutationObserver(target, callback2, options2 = {}) { const _a3 = options2, { window: window2 = defaultWindow } = _a3, mutationOptions = __objRest$1(_a3, ["window"]); let observer; const isSupported = window2 && "IntersectionObserver" in window2; const cleanup = () => { if (observer) { observer.disconnect(); observer = void 0; } }; const stopWatch = watch(() => unrefElement(target), (el) => { cleanup(); if (isSupported && window2 && el) { observer = new window2.MutationObserver(callback2); observer.observe(el, mutationOptions); } }, { immediate: true }); const stop2 = () => { cleanup(); stopWatch(); }; tryOnScopeDispose(stop2); return { isSupported, stop: stop2 }; } var _a, _b; isClient$1 && (window == null ? void 0 : window.navigator) && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.platform) && /iP(ad|hone|od)/.test((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.platform); var __defProp$3 = Object.defineProperty; var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols; var __hasOwnProp$3 = Object.prototype.hasOwnProperty; var __propIsEnum$3 = Object.prototype.propertyIsEnumerable; var __defNormalProp$3 = (obj, key2, value24) => key2 in obj ? __defProp$3(obj, key2, { enumerable: true, configurable: true, writable: true, value: value24 }) : obj[key2] = value24; var __spreadValues$3 = (a2, b2) => { for (var prop in b2 || (b2 = {})) if (__hasOwnProp$3.call(b2, prop)) __defNormalProp$3(a2, prop, b2[prop]); if (__getOwnPropSymbols$3) for (var prop of __getOwnPropSymbols$3(b2)) { if (__propIsEnum$3.call(b2, prop)) __defNormalProp$3(a2, prop, b2[prop]); } return a2; }; const initialRect = { top: 0, left: 0, bottom: 0, right: 0, height: 0, width: 0 }; __spreadValues$3({ text: "" }, initialRect); function useEventListener({ el = window, name, listener, options: options2, autoRemove = true, isDebounce = true, wait = 80 }) { let remove3 = () => { }; const isAddRef = ref(false); if (el) { const element = ref(el); const handler7 = isDebounce ? useDebounceFn(listener, wait) : useThrottleFn(listener, wait); const realHandler = wait ? handler7 : listener; const removeEventListener2 = (e2) => { isAddRef.value = true; e2.removeEventListener(name, realHandler, options2); }; const addEventListener2 = (e2) => e2.addEventListener(name, realHandler, options2); const removeWatch = watch(element, (v2, _ov, cleanUp) => { if (v2) { !unref(isAddRef) && addEventListener2(v2); cleanUp(() => { autoRemove && removeEventListener2(v2); }); } }, { immediate: true }); remove3 = () => { removeEventListener2(element.value); removeWatch(); }; } return { removeEvent: remove3 }; } var sizeEnum = /* @__PURE__ */ ((sizeEnum2) => { sizeEnum2["XS"] = "XS"; sizeEnum2["SM"] = "SM"; sizeEnum2["MD"] = "MD"; sizeEnum2["LG"] = "LG"; sizeEnum2["XL"] = "XL"; sizeEnum2["XXL"] = "XXL"; return sizeEnum2; })(sizeEnum || {}); var screenEnum = /* @__PURE__ */ ((screenEnum2) => { screenEnum2[screenEnum2["XS"] = 480] = "XS"; screenEnum2[screenEnum2["SM"] = 576] = "SM"; screenEnum2[screenEnum2["MD"] = 768] = "MD"; screenEnum2[screenEnum2["LG"] = 992] = "LG"; screenEnum2[screenEnum2["XL"] = 1200] = "XL"; screenEnum2[screenEnum2["XXL"] = 1600] = "XXL"; return screenEnum2; })(screenEnum || {}); const screenMap = /* @__PURE__ */ new Map(); screenMap.set("XS", 480); screenMap.set("SM", 576); screenMap.set("MD", 768); screenMap.set("LG", 992); screenMap.set("XL", 1200); screenMap.set("XXL", 1600); let globalScreenRef; let globalWidthRef; let globalRealWidthRef; function useBreakpoint$1() { return { screenRef: computed(() => unref(globalScreenRef)), widthRef: globalWidthRef, screenEnum, realWidthRef: globalRealWidthRef }; } function createBreakpointListen(fn) { const screenRef = ref(sizeEnum.XL); const realWidthRef = ref(window.innerWidth); function getWindowWidth() { const width = document.body.clientWidth; const xs = screenMap.get(sizeEnum.XS); const sm = screenMap.get(sizeEnum.SM); const md = screenMap.get(sizeEnum.MD); const lg = screenMap.get(sizeEnum.LG); const xl = screenMap.get(sizeEnum.XL); if (width < xs) { screenRef.value = sizeEnum.XS; } else if (width < sm) { screenRef.value = sizeEnum.SM; } else if (width < md) { screenRef.value = sizeEnum.MD; } else if (width < lg) { screenRef.value = sizeEnum.LG; } else if (width < xl) { screenRef.value = sizeEnum.XL; } else { screenRef.value = sizeEnum.XXL; } realWidthRef.value = width; } useEventListener({ el: window, name: "resize", listener: () => { getWindowWidth(); resizeFn(); } }); getWindowWidth(); globalScreenRef = computed(() => unref(screenRef)); globalWidthRef = computed(() => screenMap.get(unref(screenRef))); globalRealWidthRef = computed(() => unref(realWidthRef)); function resizeFn() { fn == null ? void 0 : fn({ screen: globalScreenRef, width: globalWidthRef, realWidth: globalRealWidthRef, screenEnum, screenMap, sizeEnum }); } resizeFn(); return { screenRef: globalScreenRef, screenEnum, widthRef: globalWidthRef, realWidthRef: globalRealWidthRef }; } var ThemeEnum = /* @__PURE__ */ ((ThemeEnum2) => { ThemeEnum2["DARK"] = "dark"; ThemeEnum2["LIGHT"] = "light"; return ThemeEnum2; })(ThemeEnum || {}); const prefixCls$2 = "bz"; ThemeEnum.LIGHT; const props$a = { prefixCls: { type: String, default: prefixCls$2 } }; const _sfc_main$L = defineComponent({ name: "AppProvider", inheritAttrs: false, props: props$a, setup(props2, { slots }) { const isMobile2 = ref(false); const isSetState = ref(false); createBreakpointListen(({ screenMap: screenMap2, sizeEnum: sizeEnum2, width }) => { const lgWidth = screenMap2.get(sizeEnum2.LG); if (lgWidth) { isMobile2.value = width.value - 1 < lgWidth; } handleRestoreState(); }); const { prefixCls: prefixCls2 } = toRefs(props2); createAppProviderContext({ prefixCls: prefixCls2, isMobile: isMobile2 }); function handleRestoreState() { if (unref(isMobile2)) { if (!unref(isSetState)) { isSetState.value = true; } } else { if (unref(isSetState)) { isSetState.value = false; } } } return () => { var _a3; return (_a3 = slots.default) == null ? void 0 : _a3.call(slots); }; } }); const AppProvider = withInstall$1(_sfc_main$L); function useDesign(scope) { const values2 = useAppProviderContext(); return { prefixCls: `${values2.prefixCls || "bz"}-${scope}`, prefixVar: values2.prefixCls || "bz" }; } var _export_sfc = (sfc, props2) => { const target = sfc.__vccOpts || sfc; for (const [key2, val] of props2) { target[key2] = val; } return target; }; const _sfc_main$K = defineComponent({ name: "BzSvgIcon", props: { prefix: { type: String, default: "icon" }, name: { type: String, required: true }, size: { type: [Number, String], default: 16 }, spin: { type: Boolean, default: false } }, setup(props2) { const { prefixCls: prefixCls2 } = useDesign("svg-icon"); const symbolId = computed(() => `#${props2.prefix}-${props2.name}`); const getStyle3 = computed(() => { const { size } = props2; let s2 = `${size}`; s2 = `${s2.replace("px", "")}px`; return { width: s2, height: s2 }; }); return { symbolId, prefixCls: prefixCls2, getStyle: getStyle3 }; } }); const _hoisted_1$f = ["xlink:href"]; function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", { class: normalizeClass([_ctx.prefixCls, _ctx.$attrs.class, _ctx.spin && "svg-icon-spin"]), style: normalizeStyle(_ctx.getStyle), "aria-hidden": "true" }, [ createElementVNode("use", { "xlink:href": _ctx.symbolId }, null, 8, _hoisted_1$f) ], 6); } var bzSvgIcon = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["render", _sfc_render$y]]); /** * (c) Iconify * * For the full copyright and license information, please view the license.txt or license.gpl.txt * files at https://github.com/iconify/iconify * * Licensed under Apache 2.0 or GPL 2.0 at your option. * If derivative product is not compatible with one of licenses, you can pick one of licenses. * * @license Apache 2.0 * @license GPL 2.0 * @version 2.1.2 */ var matchName = /^[a-z0-9]+(-[a-z0-9]+)*$/; var iconDefaults = Object.freeze({ left: 0, top: 0, width: 16, height: 16, rotate: 0, vFlip: false, hFlip: false }); function fullIcon(data65) { return __spreadValues(__spreadValues({}, iconDefaults), data65); } function mergeIconData(icon, alias) { const result = __spreadValues({}, icon); for (const key2 in iconDefaults) { const prop = key2; if (alias[prop] !== void 0) { const value24 = alias[prop]; if (result[prop] === void 0) { result[prop] = value24; continue; } switch (prop) { case "rotate": result[prop] = (result[prop] + value24) % 4; break; case "hFlip": case "vFlip": result[prop] = value24 !== result[prop]; break; default: result[prop] = value24; } } } return result; } function getIconData$1(data65, name, full = false) { function getIcon3(name2, iteration) { var _a3, _b2, _c, _d; if (data65.icons[name2] !== void 0) { return Object.assign({}, data65.icons[name2]); } if (iteration > 5) { return null; } if (((_a3 = data65.aliases) == null ? void 0 : _a3[name2]) !== void 0) { const item = (_b2 = data65.aliases) == null ? void 0 : _b2[name2]; const result2 = getIcon3(item.parent, iteration + 1); if (result2) { return mergeIconData(result2, item); } return result2; } if (iteration === 0 && ((_c = data65.chars) == null ? void 0 : _c[name2]) !== void 0) { return getIcon3((_d = data65.chars) == null ? void 0 : _d[name2], iteration + 1); } return null; } const result = getIcon3(name, 0); if (result) { for (const key2 in iconDefaults) { if (result[key2] === void 0 && data65[key2] !== void 0) { result[key2] = data65[key2]; } } } return result && full ? fullIcon(result) : result; } var matchChar = /^[a-f0-9]+(-[a-f0-9]+)*$/; function validateIconProps(item, fix) { for (const key2 in item) { const attr = key2; const value24 = item[attr]; const type2 = typeof value24; if (type2 === "undefined") { delete item[attr]; continue; } switch (key2) { case "body": case "parent": if (type2 !== "string") { return key2; } break; case "hFlip": case "vFlip": case "hidden": if (type2 !== "boolean") { if (fix) { delete item[attr]; } else { return key2; } } break; case "width": case "height": case "left": case "top": case "rotate": case "inlineHeight": case "inlineTop": case "verticalAlign": if (type2 !== "number") { if (fix) { delete item[attr]; } else { return key2; } } break; default: if (type2 === "object") { if (fix) { delete item[attr]; } else { return key2; } } } } return null; } function validateIconSet(obj, options2) { const fix = !!(options2 == null ? void 0 : options2.fix); if (typeof obj !== "object" || obj === null || typeof obj.icons !== "object" || !obj.icons) { throw new Error("Bad icon set"); } const data65 = obj; if (typeof (options2 == null ? void 0 : options2.prefix) === "string") { data65.prefix = options2.prefix; } else if (typeof data65.prefix !== "string" || !data65.prefix.match(matchName)) { throw new Error("Invalid prefix"); } if (typeof (options2 == null ? void 0 : options2.provider) === "string") { data65.provider = options2.provider; } else if (data65.provider !== void 0) { const value24 = data65.provider; if (typeof value24 !== "string" || value24 !== "" && !value24.match(matchName)) { if (fix) { delete data65.provider; } else { throw new Error("Invalid provider"); } } } const icons = data65.icons; Object.keys(icons).forEach((name) => { if (!name.match(matchName)) { if (fix) { delete icons[name]; return; } throw new Error(`Invalid icon name: "${name}"`); } const item = icons[name]; if (typeof item !== "object" || item === null || typeof item.body !== "string") { if (fix) { delete icons[name]; return; } throw new Error(`Invalid icon: "${name}"`); } const key2 = typeof item.parent === "string" ? "parent" : validateIconProps(item, fix); if (key2 !== null) { if (fix) { delete icons[name]; return; } throw new Error(`Invalid property "${key2}" in icon "${name}"`); } }); if (!Object.keys(data65.icons).length) { throw new Error("Icon set is empty"); } if (data65.aliases !== void 0) { if (typeof data65.aliases !== "object" || data65.aliases === null) { if (fix) { delete data65.aliases; } else { throw new Error("Invalid aliases list"); } } } if (typeof data65.aliases === "object") { let validateAlias = function(name, iteration) { if (validatedAliases.has(name)) { return !failedAliases.has(name); } const item = aliases2[name]; if (iteration > 5 || typeof item !== "object" || item === null || typeof item.parent !== "string" || !name.match(matchName)) { if (fix) { delete aliases2[name]; failedAliases.add(name); return false; } throw new Error(`Invalid icon alias: "${name}"`); } const parent2 = item.parent; if (data65.icons[parent2] === void 0) { if (aliases2[parent2] === void 0 || !validateAlias(parent2, iteration + 1)) { if (fix) { delete aliases2[name]; failedAliases.add(name); return false; } throw new Error(`Missing parent icon for alias "${name}`); } } if (fix && item.body !== void 0) { delete item.body; } const key2 = item.body !== void 0 ? "body" : validateIconProps(item, fix); if (key2 !== null) { if (fix) { delete aliases2[name]; failedAliases.add(name); return false; } throw new Error(`Invalid property "${key2}" in alias "${name}"`); } validatedAliases.add(name); return true; }; const aliases2 = data65.aliases; const validatedAliases = /* @__PURE__ */ new Set(); const failedAliases = /* @__PURE__ */ new Set(); Object.keys(aliases2).forEach((name) => { validateAlias(name, 0); }); if (fix && !Object.keys(data65.aliases).length) { delete data65.aliases; } } Object.keys(iconDefaults).forEach((prop) => { const expectedType = typeof iconDefaults[prop]; const actualType = typeof data65[prop]; if (actualType !== "undefined" && actualType !== expectedType) { throw new Error(`Invalid value type for "${prop}"`); } }); if (data65.chars !== void 0) { if (typeof data65.chars !== "object" || data65.chars === null) { if (fix) { delete data65.chars; } else { throw new Error("Invalid characters map"); } } } if (typeof data65.chars === "object") { const chars = data65.chars; Object.keys(chars).forEach((char) => { var _a3; if (!char.match(matchChar) || typeof chars[char] !== "string") { if (fix) { delete chars[char]; return; } throw new Error(`Invalid character "${char}"`); } const target = chars[char]; if (data65.icons[target] === void 0 && ((_a3 = data65.aliases) == null ? void 0 : _a3[target]) === void 0) { if (fix) { delete chars[char]; return; } throw new Error(`Character "${char}" points to missing icon "${target}"`); } }); if (fix && !Object.keys(data65.chars).length) { delete data65.chars; } } return data65; } function isVariation(item) { for (const key2 in iconDefaults) { if (item[key2] !== void 0) { return true; } } return false; } function parseIconSet(data65, callback2, options2) { options2 = options2 || {}; const names2 = []; if (typeof data65 !== "object" || typeof data65.icons !== "object") { return names2; } const validate3 = options2.validate; if (validate3 !== false) { try { validateIconSet(data65, typeof validate3 === "object" ? validate3 : { fix: true }); } catch (err) { return names2; } } if (data65.not_found instanceof Array) { data65.not_found.forEach((name) => { callback2(name, null); names2.push(name); }); } const icons = data65.icons; Object.keys(icons).forEach((name) => { const iconData = getIconData$1(data65, name, true); if (iconData) { callback2(name, iconData); names2.push(name); } }); const parseAliases = options2.aliases || "all"; if (parseAliases !== "none" && typeof data65.aliases === "object") { const aliases2 = data65.aliases; Object.keys(aliases2).forEach((name) => { if (parseAliases === "variations" && isVariation(aliases2[name])) { return; } const iconData = getIconData$1(data65, name, true); if (iconData) { callback2(name, iconData); names2.push(name); } }); } return names2; } var stringToIcon = (value24, validate3, allowSimpleName, provider = "") => { const colonSeparated = value24.split(":"); if (value24.slice(0, 1) === "@") { if (colonSeparated.length < 2 || colonSeparated.length > 3) { return null; } provider = colonSeparated.shift().slice(1); } if (colonSeparated.length > 3 || !colonSeparated.length) { return null; } if (colonSeparated.length > 1) { const name2 = colonSeparated.pop(); const prefix = colonSeparated.pop(); const result = { provider: colonSeparated.length > 0 ? colonSeparated[0] : provider, prefix, name: name2 }; return validate3 && !validateIcon(result) ? null : result; } const name = colonSeparated[0]; const dashSeparated = name.split("-"); if (dashSeparated.length > 1) { const result = { provider, prefix: dashSeparated.shift(), name: dashSeparated.join("-") }; return validate3 && !validateIcon(result) ? null : result; } if (allowSimpleName && provider === "") { const result = { provider, prefix: "", name }; return validate3 && !validateIcon(result, allowSimpleName) ? null : result; } return null; }; var validateIcon = (icon, allowSimpleName) => { if (!icon) { return false; } return !!((icon.provider === "" || icon.provider.match(matchName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchName)) && icon.name.match(matchName)); }; var storageVersion = 1; var storage$1 = /* @__PURE__ */ Object.create(null); try { const w2 = window || self; if ((w2 == null ? void 0 : w2._iconifyStorage.version) === storageVersion) { storage$1 = w2._iconifyStorage.storage; } } catch (err) { } function shareStorage() { try { const w2 = window || self; if (w2 && !w2._iconifyStorage) { w2._iconifyStorage = { version: storageVersion, storage: storage$1 }; } } catch (err) { } } function newStorage(provider, prefix) { return { provider, prefix, icons: /* @__PURE__ */ Object.create(null), missing: /* @__PURE__ */ Object.create(null) }; } function getStorage(provider, prefix) { if (storage$1[provider] === void 0) { storage$1[provider] = /* @__PURE__ */ Object.create(null); } const providerStorage = storage$1[provider]; if (providerStorage[prefix] === void 0) { providerStorage[prefix] = newStorage(provider, prefix); } return providerStorage[prefix]; } function addIconSet(storage2, data65) { const t2 = Date.now(); return parseIconSet(data65, (name, icon) => { if (icon) { storage2.icons[name] = icon; } else { storage2.missing[name] = t2; } }); } function addIconToStorage(storage2, name, icon) { try { if (typeof icon.body === "string") { storage2.icons[name] = Object.freeze(fullIcon(icon)); return true; } } catch (err) { } return false; } function getIconFromStorage(storage2, name) { const value24 = storage2.icons[name]; return value24 === void 0 ? null : value24; } function listIcons(provider, prefix) { let allIcons = []; let providers; if (typeof provider === "string") { providers = [provider]; } else { providers = Object.keys(storage$1); } providers.forEach((provider2) => { let prefixes2; if (typeof provider2 === "string" && typeof prefix === "string") { prefixes2 = [prefix]; } else { prefixes2 = storage$1[provider2] === void 0 ? [] : Object.keys(storage$1[provider2]); } prefixes2.forEach((prefix2) => { const storage2 = getStorage(provider2, prefix2); const icons = Object.keys(storage2.icons).map((name) => (provider2 !== "" ? "@" + provider2 + ":" : "") + prefix2 + ":" + name); allIcons = allIcons.concat(icons); }); }); return allIcons; } var simpleNames = false; function allowSimpleNames(allow) { if (typeof allow === "boolean") { simpleNames = allow; } return simpleNames; } function getIconData(name) { const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name; return icon ? getIconFromStorage(getStorage(icon.provider, icon.prefix), icon.name) : null; } function addIcon(name, data65) { const icon = stringToIcon(name, true, simpleNames); if (!icon) { return false; } const storage2 = getStorage(icon.provider, icon.prefix); return addIconToStorage(storage2, icon.name, data65); } function addCollection(data65, provider) { if (typeof data65 !== "object") { return false; } if (typeof provider !== "string") { provider = typeof data65.provider === "string" ? data65.provider : ""; } if (simpleNames && provider === "" && (typeof data65.prefix !== "string" || data65.prefix === "")) { let added = false; parseIconSet(data65, (name, icon) => { if (icon && addIcon(name, icon)) { added = true; } }, { validate: { fix: true, prefix: "" } }); return added; } if (typeof data65.prefix !== "string" || !validateIcon({ provider, prefix: data65.prefix, name: "a" })) { return false; } const storage2 = getStorage(provider, data65.prefix); return !!addIconSet(storage2, data65); } function iconExists(name) { return getIconData(name) !== null; } function getIcon$2(name) { const result = getIconData(name); return result ? __spreadValues({}, result) : null; } var defaults$7 = Object.freeze({ inline: false, width: null, height: null, hAlign: "center", vAlign: "middle", slice: false, hFlip: false, vFlip: false, rotate: 0 }); function mergeCustomisations(defaults2, item) { const result = {}; for (const key2 in defaults2) { const attr = key2; result[attr] = defaults2[attr]; if (item[attr] === void 0) { continue; } const value24 = item[attr]; switch (attr) { case "inline": case "slice": if (typeof value24 === "boolean") { result[attr] = value24; } break; case "hFlip": case "vFlip": if (value24 === true) { result[attr] = !result[attr]; } break; case "hAlign": case "vAlign": if (typeof value24 === "string" && value24 !== "") { result[attr] = value24; } break; case "width": case "height": if (typeof value24 === "string" && value24 !== "" || typeof value24 === "number" && value24 || value24 === null) { result[attr] = value24; } break; case "rotate": if (typeof value24 === "number") { result[attr] += value24; } break; } } return result; } var unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g; var unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g; function calculateSize(size, ratio, precision) { if (ratio === 1) { return size; } precision = precision === void 0 ? 100 : precision; if (typeof size === "number") { return Math.ceil(size * ratio * precision) / precision; } if (typeof size !== "string") { return size; } const oldParts = size.split(unitsSplit); if (oldParts === null || !oldParts.length) { return size; } const newParts = []; let code = oldParts.shift(); let isNumber2 = unitsTest.test(code); while (true) { if (isNumber2) { const num = parseFloat(code); if (isNaN(num)) { newParts.push(code); } else { newParts.push(Math.ceil(num * ratio * precision) / precision); } } else { newParts.push(code); } code = oldParts.shift(); if (code === void 0) { return newParts.join(""); } isNumber2 = !isNumber2; } } function preserveAspectRatio(props2) { let result = ""; switch (props2.hAlign) { case "left": result += "xMin"; break; case "right": result += "xMax"; break; default: result += "xMid"; } switch (props2.vAlign) { case "top": result += "YMin"; break; case "bottom": result += "YMax"; break; default: result += "YMid"; } result += props2.slice ? " slice" : " meet"; return result; } function iconToSVG(icon, customisations) { const box = { left: icon.left, top: icon.top, width: icon.width, height: icon.height }; let body = icon.body; [icon, customisations].forEach((props2) => { const transformations = []; const hFlip = props2.hFlip; const vFlip = props2.vFlip; let rotation = props2.rotate; if (hFlip) { if (vFlip) { rotation += 2; } else { transformations.push("translate(" + (box.width + box.left) + " " + (0 - box.top) + ")"); transformations.push("scale(-1 1)"); box.top = box.left = 0; } } else if (vFlip) { transformations.push("translate(" + (0 - box.left) + " " + (box.height + box.top) + ")"); transformations.push("scale(1 -1)"); box.top = box.left = 0; } let tempValue; if (rotation < 0) { rotation -= Math.floor(rotation / 4) * 4; } rotation = rotation % 4; switch (rotation) { case 1: tempValue = box.height / 2 + box.top; transformations.unshift("rotate(90 " + tempValue + " " + tempValue + ")"); break; case 2: transformations.unshift("rotate(180 " + (box.width / 2 + box.left) + " " + (box.height / 2 + box.top) + ")"); break; case 3: tempValue = box.width / 2 + box.left; transformations.unshift("rotate(-90 " + tempValue + " " + tempValue + ")"); break; } if (rotation % 2 === 1) { if (box.left !== 0 || box.top !== 0) { tempValue = box.left; box.left = box.top; box.top = tempValue; } if (box.width !== box.height) { tempValue = box.width; box.width = box.height; box.height = tempValue; } } if (transformations.length) { body = '' + body + ""; } }); let width, height; if (customisations.width === null && customisations.height === null) { height = "1em"; width = calculateSize(height, box.width / box.height); } else if (customisations.width !== null && customisations.height !== null) { width = customisations.width; height = customisations.height; } else if (customisations.height !== null) { height = customisations.height; width = calculateSize(height, box.width / box.height); } else { width = customisations.width; height = calculateSize(width, box.height / box.width); } if (width === "auto") { width = box.width; } if (height === "auto") { height = box.height; } width = typeof width === "string" ? width : width + ""; height = typeof height === "string" ? height : height + ""; const result = { attributes: { width, height, preserveAspectRatio: preserveAspectRatio(customisations), viewBox: box.left + " " + box.top + " " + box.width + " " + box.height }, body }; if (customisations.inline) { result.inline = true; } return result; } function buildIcon(icon, customisations) { return iconToSVG(fullIcon(icon), customisations ? mergeCustomisations(defaults$7, customisations) : defaults$7); } var regex = /\sid="(\S+)"/g; var randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16); var counter = 0; function replaceIDs(body, prefix = randomPrefix) { const ids2 = []; let match5; while (match5 = regex.exec(body)) { ids2.push(match5[1]); } if (!ids2.length) { return body; } ids2.forEach((id2) => { const newID = typeof prefix === "function" ? prefix(id2) : prefix + counter++; const escapedID = id2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); body = body.replace(new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"), "$1" + newID + "$3"); }); return body; } var cacheVersion = "iconify2"; var cachePrefix = "iconify"; var countKey = cachePrefix + "-count"; var versionKey = cachePrefix + "-version"; var hour = 36e5; var cacheExpiration = 168; var config = { local: true, session: true }; var loaded = false; var count = { local: 0, session: 0 }; var emptyList = { local: [], session: [] }; var _window = typeof window === "undefined" ? {} : window; function getGlobal$1(key2) { const attr = key2 + "Storage"; try { if (_window && _window[attr] && typeof _window[attr].length === "number") { return _window[attr]; } } catch (err) { } config[key2] = false; return null; } function setCount(storage2, key2, value24) { try { storage2.setItem(countKey, value24 + ""); count[key2] = value24; return true; } catch (err) { return false; } } function getCount(storage2) { const count2 = storage2.getItem(countKey); if (count2) { const total2 = parseInt(count2); return total2 ? total2 : 0; } return 0; } function initCache(storage2, key2) { try { storage2.setItem(versionKey, cacheVersion); } catch (err) { } setCount(storage2, key2, 0); } function destroyCache(storage2) { try { const total2 = getCount(storage2); for (let i2 = 0; i2 < total2; i2++) { storage2.removeItem(cachePrefix + i2); } } catch (err) { } } var loadCache = () => { if (loaded) { return; } loaded = true; const minTime = Math.floor(Date.now() / hour) - cacheExpiration; function load(key2) { const func = getGlobal$1(key2); if (!func) { return; } const getItem = (index2) => { const name = cachePrefix + index2; const item = func.getItem(name); if (typeof item !== "string") { return false; } let valid = true; try { const data65 = JSON.parse(item); if (typeof data65 !== "object" || typeof data65.cached !== "number" || data65.cached < minTime || typeof data65.provider !== "string" || typeof data65.data !== "object" || typeof data65.data.prefix !== "string") { valid = false; } else { const provider = data65.provider; const prefix = data65.data.prefix; const storage2 = getStorage(provider, prefix); valid = addIconSet(storage2, data65.data).length > 0; } } catch (err) { valid = false; } if (!valid) { func.removeItem(name); } return valid; }; try { const version = func.getItem(versionKey); if (version !== cacheVersion) { if (version) { destroyCache(func); } initCache(func, key2); return; } let total2 = getCount(func); for (let i2 = total2 - 1; i2 >= 0; i2--) { if (!getItem(i2)) { if (i2 === total2 - 1) { total2--; } else { emptyList[key2].push(i2); } } } setCount(func, key2, total2); } catch (err) { } } for (const key2 in config) { load(key2); } }; var storeCache = (provider, data65) => { if (!loaded) { loadCache(); } function store(key2) { if (!config[key2]) { return false; } const func = getGlobal$1(key2); if (!func) { return false; } let index2 = emptyList[key2].shift(); if (index2 === void 0) { index2 = count[key2]; if (!setCount(func, key2, index2 + 1)) { return false; } } try { const item = { cached: Math.floor(Date.now() / hour), provider, data: data65 }; func.setItem(cachePrefix + index2, JSON.stringify(item)); } catch (err) { return false; } return true; } if (!store("local")) { store("session"); } }; var cache = {}; function toggleBrowserCache(storage2, value24) { switch (storage2) { case "local": case "session": config[storage2] = value24; break; case "all": for (const key2 in config) { config[key2] = value24; } break; } } var storage = /* @__PURE__ */ Object.create(null); function setAPIModule(provider, item) { storage[provider] = item; } function getAPIModule(provider) { return storage[provider] || storage[""]; } function createAPIConfig(source2) { let resources; if (typeof source2.resources === "string") { resources = [source2.resources]; } else { resources = source2.resources; if (!(resources instanceof Array) || !resources.length) { return null; } } const result = { resources, path: source2.path === void 0 ? "/" : source2.path, maxURL: source2.maxURL ? source2.maxURL : 500, rotate: source2.rotate ? source2.rotate : 750, timeout: source2.timeout ? source2.timeout : 5e3, random: source2.random === true, index: source2.index ? source2.index : 0, dataAfterTimeout: source2.dataAfterTimeout !== false }; return result; } var configStorage = /* @__PURE__ */ Object.create(null); var fallBackAPISources = [ "https://api.simplesvg.com", "https://api.unisvg.com" ]; var fallBackAPI = []; while (fallBackAPISources.length > 0) { if (fallBackAPISources.length === 1) { fallBackAPI.push(fallBackAPISources.shift()); } else { if (Math.random() > 0.5) { fallBackAPI.push(fallBackAPISources.shift()); } else { fallBackAPI.push(fallBackAPISources.pop()); } } } configStorage[""] = createAPIConfig({ resources: ["https://api.iconify.design"].concat(fallBackAPI) }); function addAPIProvider(provider, customConfig) { const config3 = createAPIConfig(customConfig); if (config3 === null) { return false; } configStorage[provider] = config3; return true; } function getAPIConfig(provider) { return configStorage[provider]; } function listAPIProviders() { return Object.keys(configStorage); } var mergeParams = (base, params) => { let result = base, hasParams = result.indexOf("?") !== -1; function paramToString(value24) { switch (typeof value24) { case "boolean": return value24 ? "true" : "false"; case "number": return encodeURIComponent(value24); case "string": return encodeURIComponent(value24); default: throw new Error("Invalid parameter"); } } Object.keys(params).forEach((key2) => { let value24; try { value24 = paramToString(params[key2]); } catch (err) { return; } result += (hasParams ? "&" : "?") + encodeURIComponent(key2) + "=" + value24; hasParams = true; }); return result; }; var rootVar = null; var rootVarName = null; var maxLengthCache$1 = /* @__PURE__ */ Object.create(null); var pathCache$1 = /* @__PURE__ */ Object.create(null); function hash(str) { let total2 = 0, i2; for (i2 = str.length - 1; i2 >= 0; i2--) { total2 += str.charCodeAt(i2); } return total2 % 999; } function getGlobal() { if (rootVar === null) { const globalRoot = self; let prefix = "Iconify"; let extraPrefix = ".cb"; if (globalRoot[prefix] === void 0) { prefix = "IconifyJSONP"; extraPrefix = ""; if (globalRoot[prefix] === void 0) { globalRoot[prefix] = /* @__PURE__ */ Object.create(null); } rootVar = globalRoot[prefix]; } else { const iconifyRoot = globalRoot[prefix]; if (iconifyRoot.cb === void 0) { iconifyRoot.cb = /* @__PURE__ */ Object.create(null); } rootVar = iconifyRoot.cb; } rootVarName = prefix + extraPrefix + ".{cb}"; } return rootVar; } function calculateMaxLength$1(provider, prefix) { const config3 = getAPIConfig(provider); if (!config3) { return 0; } let result; if (!config3.maxURL) { result = 0; } else { let maxHostLength = 0; config3.resources.forEach((item) => { const host = item; maxHostLength = Math.max(maxHostLength, host.length); }); getGlobal(); const url2 = mergeParams(prefix + ".js", { icons: "", callback: rootVarName }); result = config3.maxURL - maxHostLength - config3.path.length - url2.length; } const cacheKey = provider + ":" + prefix; pathCache$1[cacheKey] = config3.path; maxLengthCache$1[cacheKey] = result; return result; } var prepare$1 = (provider, prefix, icons) => { const results = []; const cacheKey = provider + ":" + prefix; let maxLength = maxLengthCache$1[cacheKey]; if (maxLength === void 0) { maxLength = calculateMaxLength$1(provider, prefix); } const type2 = "icons"; let item = { type: type2, provider, prefix, icons: [] }; let length = 0; icons.forEach((name, index2) => { length += name.length + 1; if (length >= maxLength && index2 > 0) { results.push(item); item = { type: type2, provider, prefix, icons: [] }; length = name.length; } item.icons.push(name); }); results.push(item); return results; }; var send$1 = (host, params, status) => { if (params.type !== "icons") { status.done(void 0, 400); return; } const provider = params.provider; const prefix = params.prefix; const icons = params.icons; const iconsList = icons.join(","); const cacheKey = provider + ":" + prefix; const cbPrefix = prefix.split("-").shift().slice(0, 3); const global2 = getGlobal(); let cbCounter = hash(provider + ":" + host + ":" + prefix + ":" + iconsList); while (global2[cbPrefix + cbCounter] !== void 0) { cbCounter++; } const callbackName = cbPrefix + cbCounter; const url2 = mergeParams(prefix + ".js", { icons: iconsList, callback: rootVarName.replace("{cb}", callbackName) }); const path2 = pathCache$1[cacheKey] + url2; global2[callbackName] = (data65) => { delete global2[callbackName]; status.done(data65); }; const uri = host + path2; const script = document.createElement("script"); script.type = "text/javascript"; script.async = true; script.src = uri; document.head.appendChild(script); }; var jsonpAPIModule = { prepare: prepare$1, send: send$1 }; var maxLengthCache = /* @__PURE__ */ Object.create(null); var pathCache = /* @__PURE__ */ Object.create(null); var detectFetch = () => { let callback2; try { callback2 = fetch; if (typeof callback2 === "function") { return callback2; } } catch (err) { } try { const chunk = String.fromCharCode(114) + String.fromCharCode(101); const req = global[chunk + "qui" + chunk]; callback2 = req("cross-fetch"); if (typeof callback2 === "function") { return callback2; } } catch (err) { } return null; }; var fetchModule = detectFetch(); function setFetch$1(fetch2) { fetchModule = fetch2; } function getFetch() { return fetchModule; } function calculateMaxLength(provider, prefix) { const config3 = getAPIConfig(provider); if (!config3) { return 0; } let result; if (!config3.maxURL) { result = 0; } else { let maxHostLength = 0; config3.resources.forEach((item) => { const host = item; maxHostLength = Math.max(maxHostLength, host.length); }); const url2 = mergeParams(prefix + ".json", { icons: "" }); result = config3.maxURL - maxHostLength - config3.path.length - url2.length; } const cacheKey = provider + ":" + prefix; pathCache[provider] = config3.path; maxLengthCache[cacheKey] = result; return result; } var prepare = (provider, prefix, icons) => { const results = []; let maxLength = maxLengthCache[prefix]; if (maxLength === void 0) { maxLength = calculateMaxLength(provider, prefix); } const type2 = "icons"; let item = { type: type2, provider, prefix, icons: [] }; let length = 0; icons.forEach((name, index2) => { length += name.length + 1; if (length >= maxLength && index2 > 0) { results.push(item); item = { type: type2, provider, prefix, icons: [] }; length = name.length; } item.icons.push(name); }); results.push(item); return results; }; function getPath(provider) { if (typeof provider === "string") { if (pathCache[provider] === void 0) { const config3 = getAPIConfig(provider); if (!config3) { return "/"; } pathCache[provider] = config3.path; } return pathCache[provider]; } return "/"; } var send = (host, params, status) => { if (!fetchModule) { status.done(void 0, 424); return; } let path2 = getPath(params.provider); switch (params.type) { case "icons": { const prefix = params.prefix; const icons = params.icons; const iconsList = icons.join(","); path2 += mergeParams(prefix + ".json", { icons: iconsList }); break; } case "custom": { const uri = params.uri; path2 += uri.slice(0, 1) === "/" ? uri.slice(1) : uri; break; } default: status.done(void 0, 400); return; } let defaultError = 503; fetchModule(host + path2).then((response) => { if (response.status !== 200) { setTimeout(() => { status.done(void 0, response.status); }); return; } defaultError = 501; return response.json(); }).then((data65) => { if (typeof data65 !== "object" || data65 === null) { setTimeout(() => { status.done(void 0, defaultError); }); return; } setTimeout(() => { status.done(data65); }); }).catch(() => { status.done(void 0, defaultError); }); }; var fetchAPIModule = { prepare, send }; function sortIcons(icons) { const result = { loaded: [], missing: [], pending: [] }; const storage2 = /* @__PURE__ */ Object.create(null); icons.sort((a2, b2) => { if (a2.provider !== b2.provider) { return a2.provider.localeCompare(b2.provider); } if (a2.prefix !== b2.prefix) { return a2.prefix.localeCompare(b2.prefix); } return a2.name.localeCompare(b2.name); }); let lastIcon = { provider: "", prefix: "", name: "" }; icons.forEach((icon) => { if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) { return; } lastIcon = icon; const provider = icon.provider; const prefix = icon.prefix; const name = icon.name; if (storage2[provider] === void 0) { storage2[provider] = /* @__PURE__ */ Object.create(null); } const providerStorage = storage2[provider]; if (providerStorage[prefix] === void 0) { providerStorage[prefix] = getStorage(provider, prefix); } const localStorage = providerStorage[prefix]; let list; if (localStorage.icons[name] !== void 0) { list = result.loaded; } else if (prefix === "" || localStorage.missing[name] !== void 0) { list = result.missing; } else { list = result.pending; } const item = { provider, prefix, name }; list.push(item); }); return result; } var callbacks = /* @__PURE__ */ Object.create(null); var pendingUpdates = /* @__PURE__ */ Object.create(null); function removeCallback(sources, id2) { sources.forEach((source2) => { const provider = source2.provider; if (callbacks[provider] === void 0) { return; } const providerCallbacks = callbacks[provider]; const prefix = source2.prefix; const items = providerCallbacks[prefix]; if (items) { providerCallbacks[prefix] = items.filter((row) => row.id !== id2); } }); } function updateCallbacks(provider, prefix) { if (pendingUpdates[provider] === void 0) { pendingUpdates[provider] = /* @__PURE__ */ Object.create(null); } const providerPendingUpdates = pendingUpdates[provider]; if (!providerPendingUpdates[prefix]) { providerPendingUpdates[prefix] = true; setTimeout(() => { providerPendingUpdates[prefix] = false; if (callbacks[provider] === void 0 || callbacks[provider][prefix] === void 0) { return; } const items = callbacks[provider][prefix].slice(0); if (!items.length) { return; } const storage2 = getStorage(provider, prefix); let hasPending = false; items.forEach((item) => { const icons = item.icons; const oldLength = icons.pending.length; icons.pending = icons.pending.filter((icon) => { if (icon.prefix !== prefix) { return true; } const name = icon.name; if (storage2.icons[name] !== void 0) { icons.loaded.push({ provider, prefix, name }); } else if (storage2.missing[name] !== void 0) { icons.missing.push({ provider, prefix, name }); } else { hasPending = true; return true; } return false; }); if (icons.pending.length !== oldLength) { if (!hasPending) { removeCallback([ { provider, prefix } ], item.id); } item.callback(icons.loaded.slice(0), icons.missing.slice(0), icons.pending.slice(0), item.abort); } }); }); } } var idCounter = 0; function storeCallback(callback2, icons, pendingSources) { const id2 = idCounter++; const abort4 = removeCallback.bind(null, pendingSources, id2); if (!icons.pending.length) { return abort4; } const item = { id: id2, icons, callback: callback2, abort: abort4 }; pendingSources.forEach((source2) => { const provider = source2.provider; const prefix = source2.prefix; if (callbacks[provider] === void 0) { callbacks[provider] = /* @__PURE__ */ Object.create(null); } const providerCallbacks = callbacks[provider]; if (providerCallbacks[prefix] === void 0) { providerCallbacks[prefix] = []; } providerCallbacks[prefix].push(item); }); return abort4; } function listToIcons(list, validate3 = true, simpleNames2 = false) { const result = []; list.forEach((item) => { const icon = typeof item === "string" ? stringToIcon(item, false, simpleNames2) : item; if (!validate3 || validateIcon(icon, simpleNames2)) { result.push({ provider: icon.provider, prefix: icon.prefix, name: icon.name }); } }); return result; } var defaultConfig = { resources: [], index: 0, timeout: 2e3, rotate: 750, random: false, dataAfterTimeout: false }; function sendQuery(config3, payload, query, done, success3) { const resourcesCount = config3.resources.length; const startIndex = config3.random ? Math.floor(Math.random() * resourcesCount) : config3.index; let resources; if (config3.random) { let list = config3.resources.slice(0); resources = []; while (list.length > 1) { const nextIndex = Math.floor(Math.random() * list.length); resources.push(list[nextIndex]); list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1)); } resources = resources.concat(list); } else { resources = config3.resources.slice(startIndex).concat(config3.resources.slice(0, startIndex)); } const startTime = Date.now(); let status = "pending"; let queriesSent = 0; let lastError = void 0; let timer = null; let queue = []; let doneCallbacks = []; if (typeof done === "function") { doneCallbacks.push(done); } function resetTimer() { if (timer) { clearTimeout(timer); timer = null; } } function abort4() { if (status === "pending") { status = "aborted"; } resetTimer(); queue.forEach((item) => { if (item.abort) { item.abort(); } if (item.status === "pending") { item.status = "aborted"; } }); queue = []; } function subscribe3(callback2, overwrite) { if (overwrite) { doneCallbacks = []; } if (typeof callback2 === "function") { doneCallbacks.push(callback2); } } function getQueryStatus() { return { startTime, payload, status, queriesSent, queriesPending: queue.length, subscribe: subscribe3, abort: abort4 }; } function failQuery() { status = "failed"; doneCallbacks.forEach((callback2) => { callback2(void 0, lastError); }); } function clearQueue() { queue = queue.filter((item) => { if (item.status === "pending") { item.status = "aborted"; } if (item.abort) { item.abort(); } return false; }); } function moduleResponse(item, data65, error3) { const isError2 = data65 === void 0; queue = queue.filter((queued) => queued !== item); switch (status) { case "pending": break; case "failed": if (isError2 || !config3.dataAfterTimeout) { return; } break; default: return; } if (isError2) { if (error3 !== void 0) { lastError = error3; } if (!queue.length) { if (!resources.length) { failQuery(); } else { execNext(); } } return; } resetTimer(); clearQueue(); if (success3 && !config3.random) { const index2 = config3.resources.indexOf(item.resource); if (index2 !== -1 && index2 !== config3.index) { success3(index2); } } status = "completed"; doneCallbacks.forEach((callback2) => { callback2(data65); }); } function execNext() { if (status !== "pending") { return; } resetTimer(); const resource = resources.shift(); if (resource === void 0) { if (queue.length) { const timeout2 = typeof config3.timeout === "function" ? config3.timeout(startTime) : config3.timeout; if (timeout2) { timer = setTimeout(() => { resetTimer(); if (status === "pending") { clearQueue(); failQuery(); } }, timeout2); return; } } failQuery(); return; } const item = { getQueryStatus, status: "pending", resource, done: (data65, error3) => { moduleResponse(item, data65, error3); } }; queue.push(item); queriesSent++; const timeout = typeof config3.rotate === "function" ? config3.rotate(queriesSent, startTime) : config3.rotate; timer = setTimeout(execNext, timeout); query(resource, payload, item); } setTimeout(execNext); return getQueryStatus; } function setConfig(config3) { if (typeof config3 !== "object" || typeof config3.resources !== "object" || !(config3.resources instanceof Array) || !config3.resources.length) { throw new Error("Invalid Reduncancy configuration"); } const newConfig = /* @__PURE__ */ Object.create(null); let key2; for (key2 in defaultConfig) { if (config3[key2] !== void 0) { newConfig[key2] = config3[key2]; } else { newConfig[key2] = defaultConfig[key2]; } } return newConfig; } function initRedundancy(cfg) { const config3 = setConfig(cfg); let queries = []; function cleanup() { queries = queries.filter((item) => item().status === "pending"); } function query(payload, queryCallback, doneCallback) { const query2 = sendQuery(config3, payload, queryCallback, (data65, error3) => { cleanup(); if (doneCallback) { doneCallback(data65, error3); } }, (newIndex) => { config3.index = newIndex; }); queries.push(query2); return query2; } function find2(callback2) { const result = queries.find((value24) => { return callback2(value24); }); return result !== void 0 ? result : null; } const instance = { query, find: find2, setIndex: (index2) => { config3.index = index2; }, getIndex: () => config3.index, cleanup }; return instance; } function emptyCallback$1() { } var redundancyCache = /* @__PURE__ */ Object.create(null); function getRedundancyCache(provider) { if (redundancyCache[provider] === void 0) { const config3 = getAPIConfig(provider); if (!config3) { return; } const redundancy = initRedundancy(config3); const cachedReundancy = { config: config3, redundancy }; redundancyCache[provider] = cachedReundancy; } return redundancyCache[provider]; } function sendAPIQuery(target, query, callback2) { let redundancy; let send2; if (typeof target === "string") { const api2 = getAPIModule(target); if (!api2) { callback2(void 0, 424); return emptyCallback$1; } send2 = api2.send; const cached2 = getRedundancyCache(target); if (cached2) { redundancy = cached2.redundancy; } } else { const config3 = createAPIConfig(target); if (config3) { redundancy = initRedundancy(config3); const moduleKey = target.resources ? target.resources[0] : ""; const api2 = getAPIModule(moduleKey); if (api2) { send2 = api2.send; } } } if (!redundancy || !send2) { callback2(void 0, 424); return emptyCallback$1; } return redundancy.query(query, send2, callback2)().abort; } function emptyCallback() { } var pendingIcons = /* @__PURE__ */ Object.create(null); var iconsToLoad = /* @__PURE__ */ Object.create(null); var loaderFlags = /* @__PURE__ */ Object.create(null); var queueFlags = /* @__PURE__ */ Object.create(null); function loadedNewIcons(provider, prefix) { if (loaderFlags[provider] === void 0) { loaderFlags[provider] = /* @__PURE__ */ Object.create(null); } const providerLoaderFlags = loaderFlags[provider]; if (!providerLoaderFlags[prefix]) { providerLoaderFlags[prefix] = true; setTimeout(() => { providerLoaderFlags[prefix] = false; updateCallbacks(provider, prefix); }); } } var errorsCache = /* @__PURE__ */ Object.create(null); function loadNewIcons(provider, prefix, icons) { function err() { const key2 = (provider === "" ? "" : "@" + provider + ":") + prefix; const time = Math.floor(Date.now() / 6e4); if (errorsCache[key2] < time) { errorsCache[key2] = time; console.error('Unable to retrieve icons for "' + key2 + '" because API is not configured properly.'); } } if (iconsToLoad[provider] === void 0) { iconsToLoad[provider] = /* @__PURE__ */ Object.create(null); } const providerIconsToLoad = iconsToLoad[provider]; if (queueFlags[provider] === void 0) { queueFlags[provider] = /* @__PURE__ */ Object.create(null); } const providerQueueFlags = queueFlags[provider]; if (pendingIcons[provider] === void 0) { pendingIcons[provider] = /* @__PURE__ */ Object.create(null); } const providerPendingIcons = pendingIcons[provider]; if (providerIconsToLoad[prefix] === void 0) { providerIconsToLoad[prefix] = icons; } else { providerIconsToLoad[prefix] = providerIconsToLoad[prefix].concat(icons).sort(); } if (!providerQueueFlags[prefix]) { providerQueueFlags[prefix] = true; setTimeout(() => { providerQueueFlags[prefix] = false; const icons2 = providerIconsToLoad[prefix]; delete providerIconsToLoad[prefix]; const api2 = getAPIModule(provider); if (!api2) { err(); return; } const params = api2.prepare(provider, prefix, icons2); params.forEach((item) => { sendAPIQuery(provider, item, (data65, error3) => { const storage2 = getStorage(provider, prefix); if (typeof data65 !== "object") { if (error3 !== 404) { return; } const t2 = Date.now(); item.icons.forEach((name) => { storage2.missing[name] = t2; }); } else { try { const parsed = addIconSet(storage2, data65); if (!parsed.length) { return; } const pending = providerPendingIcons[prefix]; parsed.forEach((name) => { delete pending[name]; }); if (cache.store) { cache.store(provider, data65); } } catch (err2) { console.error(err2); } } loadedNewIcons(provider, prefix); }); }); }); } } var isPending = (icon) => { const provider = icon.provider; const prefix = icon.prefix; return pendingIcons[provider] && pendingIcons[provider][prefix] && pendingIcons[provider][prefix][icon.name] !== void 0; }; var loadIcons = (icons, callback2) => { const cleanedIcons = listToIcons(icons, true, allowSimpleNames()); const sortedIcons = sortIcons(cleanedIcons); if (!sortedIcons.pending.length) { let callCallback = true; if (callback2) { setTimeout(() => { if (callCallback) { callback2(sortedIcons.loaded, sortedIcons.missing, sortedIcons.pending, emptyCallback); } }); } return () => { callCallback = false; }; } const newIcons = /* @__PURE__ */ Object.create(null); const sources = []; let lastProvider, lastPrefix; sortedIcons.pending.forEach((icon) => { const provider = icon.provider; const prefix = icon.prefix; if (prefix === lastPrefix && provider === lastProvider) { return; } lastProvider = provider; lastPrefix = prefix; sources.push({ provider, prefix }); if (pendingIcons[provider] === void 0) { pendingIcons[provider] = /* @__PURE__ */ Object.create(null); } const providerPendingIcons = pendingIcons[provider]; if (providerPendingIcons[prefix] === void 0) { providerPendingIcons[prefix] = /* @__PURE__ */ Object.create(null); } if (newIcons[provider] === void 0) { newIcons[provider] = /* @__PURE__ */ Object.create(null); } const providerNewIcons = newIcons[provider]; if (providerNewIcons[prefix] === void 0) { providerNewIcons[prefix] = []; } }); const time = Date.now(); sortedIcons.pending.forEach((icon) => { const provider = icon.provider; const prefix = icon.prefix; const name = icon.name; const pendingQueue = pendingIcons[provider][prefix]; if (pendingQueue[name] === void 0) { pendingQueue[name] = time; newIcons[provider][prefix].push(name); } }); sources.forEach((source2) => { const provider = source2.provider; const prefix = source2.prefix; if (newIcons[provider][prefix].length) { loadNewIcons(provider, prefix, newIcons[provider][prefix]); } }); return callback2 ? storeCallback(callback2, sortedIcons, sources) : emptyCallback; }; var iconsQueue = /* @__PURE__ */ Object.create(null); var loadIcon = (icon) => { if (typeof icon === "string" && iconsQueue[icon]) { return iconsQueue[icon]; } const result = new Promise((fulfill, reject) => { const iconObj = typeof icon === "string" ? stringToIcon(icon) : icon; loadIcons([iconObj || icon], (loaded2) => { if (loaded2.length && iconObj) { const storage2 = getStorage(iconObj.provider, iconObj.prefix); const data65 = getIconFromStorage(storage2, iconObj.name); if (data65) { fulfill(data65); return; } } reject(icon); }); }); if (typeof icon === "string") { iconsQueue[icon] = result; } return result; }; const elementFinderProperty = "iconifyFinder" + Date.now(); const elementDataProperty = "iconifyData" + Date.now(); function renderIconInPlaceholder(placeholder, customisations, iconData, returnString) { let span; try { span = document.createElement("span"); } catch (err) { return returnString ? "" : null; } const data65 = iconToSVG(iconData, mergeCustomisations(defaults$7, customisations)); const placeholderElement = placeholder.element; const finder2 = placeholder.finder; const name = placeholder.name; const placeholderClassName = placeholderElement ? placeholderElement.getAttribute("class") : ""; const filteredClassList = finder2 ? finder2.classFilter(placeholderClassName ? placeholderClassName.split(/\s+/) : []) : []; const className = "iconify iconify--" + name.prefix + (name.provider === "" ? "" : " iconify--" + name.provider) + (filteredClassList.length ? " " + filteredClassList.join(" ") : ""); const html = '"; span.innerHTML = html; const svg = span.childNodes[0]; const svgStyle = svg.style; const svgAttributes = data65.attributes; Object.keys(svgAttributes).forEach((attr) => { svg.setAttribute(attr, svgAttributes[attr]); }); if (data65.inline) { svgStyle.verticalAlign = "-0.125em"; } if (placeholderElement) { const placeholderAttributes = placeholderElement.attributes; for (let i2 = 0; i2 < placeholderAttributes.length; i2++) { const item = placeholderAttributes.item(i2); if (item) { const name2 = item.name; if (name2 !== "class" && name2 !== "style" && svgAttributes[name2] === void 0) { try { svg.setAttribute(name2, item.value); } catch (err) { } } } } const placeholderStyle = placeholderElement.style; for (let i2 = 0; i2 < placeholderStyle.length; i2++) { const attr = placeholderStyle[i2]; svgStyle[attr] = placeholderStyle[attr]; } } if (finder2) { const elementData = { name, status: "loaded", customisations }; svg[elementDataProperty] = elementData; svg[elementFinderProperty] = finder2; } const result = returnString ? span.innerHTML : svg; if (placeholderElement && placeholderElement.parentNode) { placeholderElement.parentNode.replaceChild(svg, placeholderElement); } else { span.removeChild(svg); } return result; } let nodes = []; function findRootNode(node) { for (let i2 = 0; i2 < nodes.length; i2++) { const item = nodes[i2]; const root2 = typeof item.node === "function" ? item.node() : item.node; if (root2 === node) { return item; } } } function addRootNode(root2, autoRemove = false) { let node = findRootNode(root2); if (node) { if (node.temporary) { node.temporary = autoRemove; } return node; } node = { node: root2, temporary: autoRemove }; nodes.push(node); return node; } function addBodyNode() { if (document.documentElement) { return addRootNode(document.documentElement); } nodes.push({ node: () => { return document.documentElement; } }); } function removeRootNode(root2) { nodes = nodes.filter((node) => { const element = typeof node.node === "function" ? node.node() : node.node; return root2 !== element; }); } function listRootNodes() { return nodes; } function onReady(callback2) { const doc = document; if (doc.readyState === "complete" || doc.readyState !== "loading" && !doc.documentElement.doScroll) { callback2(); } else { doc.addEventListener("DOMContentLoaded", callback2); window.addEventListener("load", callback2); } } let callback = null; const observerParams = { childList: true, subtree: true, attributes: true }; function queueScan(node) { if (!node.observer) { return; } const observer = node.observer; if (!observer.pendingScan) { observer.pendingScan = setTimeout(() => { delete observer.pendingScan; if (callback) { callback(node); } }); } } function checkMutations(node, mutations) { if (!node.observer) { return; } const observer = node.observer; if (!observer.pendingScan) { for (let i2 = 0; i2 < mutations.length; i2++) { const item = mutations[i2]; if (item.addedNodes && item.addedNodes.length > 0 || item.type === "attributes" && item.target[elementFinderProperty] !== void 0) { if (!observer.paused) { queueScan(node); } return; } } } } function continueObserving(node, root2) { node.observer.instance.observe(root2, observerParams); } function startObserver(node) { let observer = node.observer; if (observer && observer.instance) { return; } const root2 = typeof node.node === "function" ? node.node() : node.node; if (!root2) { return; } if (!observer) { observer = { paused: 0 }; node.observer = observer; } observer.instance = new MutationObserver(checkMutations.bind(null, node)); continueObserving(node, root2); if (!observer.paused) { queueScan(node); } } function startObservers() { listRootNodes().forEach(startObserver); } function stopObserver(node) { if (!node.observer) { return; } const observer = node.observer; if (observer.pendingScan) { clearTimeout(observer.pendingScan); delete observer.pendingScan; } if (observer.instance) { observer.instance.disconnect(); delete observer.instance; } } function initObserver(cb) { const isRestart = callback !== null; if (callback !== cb) { callback = cb; if (isRestart) { listRootNodes().forEach(stopObserver); } } if (isRestart) { startObservers(); return; } onReady(startObservers); } function pauseObservingNode(node) { (node ? [node] : listRootNodes()).forEach((node2) => { if (!node2.observer) { node2.observer = { paused: 1 }; return; } const observer = node2.observer; observer.paused++; if (observer.paused > 1 || !observer.instance) { return; } const instance = observer.instance; instance.disconnect(); }); } function pauseObserver(root2) { if (root2) { const node = findRootNode(root2); if (node) { pauseObservingNode(node); } } else { pauseObservingNode(); } } function resumeObservingNode(observer) { (observer ? [observer] : listRootNodes()).forEach((node) => { if (!node.observer) { startObserver(node); return; } const observer2 = node.observer; if (observer2.paused) { observer2.paused--; if (!observer2.paused) { const root2 = typeof node.node === "function" ? node.node() : node.node; if (!root2) { return; } else if (observer2.instance) { continueObserving(node, root2); } else { startObserver(node); } } } }); } function resumeObserver(root2) { if (root2) { const node = findRootNode(root2); if (node) { resumeObservingNode(node); } } else { resumeObservingNode(); } } function observe(root2, autoRemove = false) { const node = addRootNode(root2, autoRemove); startObserver(node); return node; } function stopObserving(root2) { const node = findRootNode(root2); if (node) { stopObserver(node); removeRootNode(root2); } } const finders = []; function addFinder(finder2) { if (finders.indexOf(finder2) === -1) { finders.push(finder2); } } function cleanIconName(name) { if (typeof name === "string") { name = stringToIcon(name); } return name === null || !validateIcon(name) ? null : name; } function compareCustomisations(list1, list2) { const keys1 = Object.keys(list1); const keys2 = Object.keys(list2); if (keys1.length !== keys2.length) { return false; } for (let i2 = 0; i2 < keys1.length; i2++) { const key2 = keys1[i2]; if (list2[key2] !== list1[key2]) { return false; } } return true; } function findPlaceholders(root2) { const results = []; finders.forEach((finder2) => { const elements2 = finder2.find(root2); Array.prototype.forEach.call(elements2, (item) => { const element = item; if (element[elementFinderProperty] !== void 0 && element[elementFinderProperty] !== finder2) { return; } const name = cleanIconName(finder2.name(element)); if (name === null) { return; } element[elementFinderProperty] = finder2; const placeholder = { element, finder: finder2, name }; results.push(placeholder); }); }); const elements = root2.querySelectorAll("svg.iconify"); Array.prototype.forEach.call(elements, (item) => { const element = item; const finder2 = element[elementFinderProperty]; const data65 = element[elementDataProperty]; if (!finder2 || !data65) { return; } const name = cleanIconName(finder2.name(element)); if (name === null) { return; } let updated22 = false; let customisations; if (name.prefix !== data65.name.prefix || name.name !== data65.name.name) { updated22 = true; } else { customisations = finder2.customisations(element); if (!compareCustomisations(data65.customisations, customisations)) { updated22 = true; } } if (updated22) { const placeholder = { element, finder: finder2, name, customisations }; results.push(placeholder); } }); return results; } let scanQueued = false; function checkPendingIcons() { if (!scanQueued) { scanQueued = true; setTimeout(() => { if (scanQueued) { scanQueued = false; scanDOM(); } }); } } const compareIcons = (icon1, icon2) => { return icon1 !== null && icon2 !== null && icon1.name === icon2.name && icon1.prefix === icon2.prefix; }; function scanElement(root2) { const node = findRootNode(root2); if (!node) { scanDOM({ node: root2, temporary: true }, true); } else { scanDOM(node); } } function scanDOM(node, addTempNode = false) { scanQueued = false; const iconsToLoad2 = /* @__PURE__ */ Object.create(null); (node ? [node] : listRootNodes()).forEach((node2) => { const root2 = typeof node2.node === "function" ? node2.node() : node2.node; if (!root2 || !root2.querySelectorAll) { return; } let hasPlaceholders = false; let paused = false; findPlaceholders(root2).forEach((item) => { const element = item.element; const iconName = item.name; const provider = iconName.provider; const prefix = iconName.prefix; const name = iconName.name; let data65 = element[elementDataProperty]; if (data65 !== void 0 && compareIcons(data65.name, iconName)) { switch (data65.status) { case "missing": return; case "loading": if (isPending({ provider, prefix, name })) { hasPlaceholders = true; return; } } } const storage2 = getStorage(provider, prefix); if (storage2.icons[name] !== void 0) { if (!paused && node2.observer) { pauseObservingNode(node2); paused = true; } const customisations = item.customisations !== void 0 ? item.customisations : item.finder.customisations(element); renderIconInPlaceholder(item, customisations, getIconFromStorage(storage2, name)); return; } if (storage2.missing[name]) { data65 = { name: iconName, status: "missing", customisations: {} }; element[elementDataProperty] = data65; return; } if (!isPending({ provider, prefix, name })) { if (iconsToLoad2[provider] === void 0) { iconsToLoad2[provider] = /* @__PURE__ */ Object.create(null); } const providerIconsToLoad = iconsToLoad2[provider]; if (providerIconsToLoad[prefix] === void 0) { providerIconsToLoad[prefix] = /* @__PURE__ */ Object.create(null); } providerIconsToLoad[prefix][name] = true; } data65 = { name: iconName, status: "loading", customisations: {} }; element[elementDataProperty] = data65; hasPlaceholders = true; }); if (node2.temporary && !hasPlaceholders) { stopObserving(root2); } else if (addTempNode && hasPlaceholders) { observe(root2, true); } else if (paused && node2.observer) { resumeObservingNode(node2); } }); Object.keys(iconsToLoad2).forEach((provider) => { const providerIconsToLoad = iconsToLoad2[provider]; Object.keys(providerIconsToLoad).forEach((prefix) => { loadIcons(Object.keys(providerIconsToLoad[prefix]).map((name) => { const icon = { provider, prefix, name }; return icon; }), checkPendingIcons); }); }); } function rotateFromString(value24, defaultValue = 0) { const units = value24.replace(/^-?[0-9.]*/, ""); function cleanup(value25) { while (value25 < 0) { value25 += 4; } return value25 % 4; } if (units === "") { const num = parseInt(value24); return isNaN(num) ? 0 : cleanup(num); } else if (units !== value24) { let split2 = 0; switch (units) { case "%": split2 = 25; break; case "deg": split2 = 90; } if (split2) { let num = parseFloat(value24.slice(0, value24.length - units.length)); if (isNaN(num)) { return 0; } num = num / split2; return num % 1 === 0 ? cleanup(num) : 0; } } return defaultValue; } var separator = /[\s,]+/; function flipFromString(custom, flip2) { flip2.split(separator).forEach((str) => { const value24 = str.trim(); switch (value24) { case "horizontal": custom.hFlip = true; break; case "vertical": custom.vFlip = true; break; } }); } function alignmentFromString(custom, align) { align.split(separator).forEach((str) => { const value24 = str.trim(); switch (value24) { case "left": case "center": case "right": custom.hAlign = value24; break; case "top": case "middle": case "bottom": custom.vAlign = value24; break; case "slice": case "crop": custom.slice = true; break; case "meet": custom.slice = false; } }); } function hasAttribute(element, key2) { return element.hasAttribute(key2); } function getAttribute(element, key2) { return element.getAttribute(key2); } function getBooleanAttribute(element, key2) { const value24 = element.getAttribute(key2); if (value24 === key2 || value24 === "true") { return true; } if (value24 === "" || value24 === "false") { return false; } return null; } const booleanAttributes = [ "inline", "hFlip", "vFlip" ]; const stringAttributes = [ "width", "height" ]; const mainClass = "iconify"; const inlineClass = "iconify-inline"; const selector = "i." + mainClass + ", span." + mainClass + ", i." + inlineClass + ", span." + inlineClass; const finder = { find: (root2) => root2.querySelectorAll(selector), name: (element) => { if (hasAttribute(element, "data-icon")) { return getAttribute(element, "data-icon"); } return null; }, customisations: (element, defaultValues = { inline: false }) => { const result = defaultValues; const className = element.getAttribute("class"); const classList = className ? className.split(/\s+/) : []; if (classList.indexOf(inlineClass) !== -1) { result.inline = true; } if (hasAttribute(element, "data-rotate")) { const value24 = rotateFromString(getAttribute(element, "data-rotate")); if (value24) { result.rotate = value24; } } if (hasAttribute(element, "data-flip")) { flipFromString(result, getAttribute(element, "data-flip")); } if (hasAttribute(element, "data-align")) { alignmentFromString(result, getAttribute(element, "data-align")); } booleanAttributes.forEach((attr) => { if (hasAttribute(element, "data-" + attr)) { const value24 = getBooleanAttribute(element, "data-" + attr); if (typeof value24 === "boolean") { result[attr] = value24; } } }); stringAttributes.forEach((attr) => { if (hasAttribute(element, "data-" + attr)) { const value24 = getAttribute(element, "data-" + attr); if (value24 !== "") { result[attr] = value24; } } }); return result; }, classFilter: (classList) => { const result = []; classList.forEach((className) => { if (className !== "iconify" && className !== "" && className.slice(0, 9) !== "iconify--") { result.push(className); } }); return result; } }; function generateIcon(name, customisations, returnString) { const iconData = getIconData(name); if (!iconData) { return null; } const iconName = stringToIcon(name); const changes = mergeCustomisations(defaults$7, typeof customisations === "object" ? customisations : {}); return renderIconInPlaceholder({ name: iconName }, changes, iconData, returnString); } function getVersion() { return "2.1.2"; } function renderSVG(name, customisations) { return generateIcon(name, customisations, false); } function renderHTML(name, customisations) { return generateIcon(name, customisations, true); } function renderIcon(name, customisations) { const iconData = getIconData(name); if (!iconData) { return null; } const changes = mergeCustomisations(defaults$7, typeof customisations === "object" ? customisations : {}); return iconToSVG(iconData, changes); } function scan(root2) { if (root2) { scanElement(root2); } else { scanDOM(); } } if (typeof document !== "undefined" && typeof window !== "undefined") { addBodyNode(); addFinder(finder); const _window2 = window; if (_window2.IconifyPreload !== void 0) { const preload = _window2.IconifyPreload; const err = "Invalid IconifyPreload syntax."; if (typeof preload === "object" && preload !== null) { (preload instanceof Array ? preload : [preload]).forEach((item) => { try { if (typeof item !== "object" || item === null || item instanceof Array || typeof item.icons !== "object" || typeof item.prefix !== "string" || !addCollection(item)) { console.error(err); } } catch (e2) { console.error(err); } }); } } setTimeout(() => { initObserver(scanDOM); scanDOM(); }); } function enableCache(storage2, enable) { toggleBrowserCache(storage2, enable !== false); } function disableCache(storage2) { toggleBrowserCache(storage2, true); } setAPIModule("", getFetch() ? fetchAPIModule : jsonpAPIModule); function setFetch(nodeFetch) { setFetch$1(nodeFetch); setAPIModule("", fetchAPIModule); } if (typeof document !== "undefined" && typeof window !== "undefined") { cache.store = storeCache; loadCache(); const _window2 = window; if (_window2.IconifyProviders !== void 0) { const providers = _window2.IconifyProviders; if (typeof providers === "object" && providers !== null) { for (const key2 in providers) { const err = "IconifyProviders[" + key2 + "] is invalid."; try { const value24 = providers[key2]; if (typeof value24 !== "object" || !value24 || value24.resources === void 0) { continue; } if (!addAPIProvider(key2, value24)) { console.error(err); } } catch (e2) { console.error(err); } } } } } const _api = { getAPIConfig, setAPIModule, sendAPIQuery, setFetch, listAPIProviders, mergeParams }; const Iconify$1 = { _api, addAPIProvider, loadIcons, loadIcon, iconExists, getIcon: getIcon$2, listIcons, addIcon, addCollection, shareStorage, replaceIDs, calculateSize, buildIcon, getVersion, renderSVG, renderHTML, renderIcon, scan, observe, stopObserving, pauseObserver, resumeObserver, enableCache, disableCache }; try { if (self.Iconify === void 0) { self.Iconify = Iconify$1; } } catch (err) { } const Iconify = Iconify$1.default || Iconify$1; const collections = JSON.parse('[{"prefix":"ion","width":512,"height":512,"icons":{"apps-outline":{"body":""},"bar-chart-outline":{"body":""},"chevron-forward":{"body":""},"grid-outline":{"body":""},"layers-outline":{"body":""},"settings-outline":{"body":""},"tv-outline":{"body":""}}},{"prefix":"el","width":1200,"height":1200,"icons":{}},{"prefix":"et","width":32,"height":32,"icons":{}},{"prefix":"il","width":750,"height":850,"icons":{}},{"prefix":"map","width":50,"height":50,"icons":{}},{"prefix":"fe","width":24,"height":24,"icons":{}},{"prefix":"ps","width":512,"height":512,"icons":{}},{"prefix":"ls","width":717,"height":717,"icons":{"p":{"body":"","width":563,"height":867}}},{"prefix":"la","width":32,"height":32,"icons":{}},{"prefix":"ep","width":1024,"height":1024,"icons":{}},{"prefix":"ph","width":256,"height":256,"icons":{}},{"prefix":"ri","width":24,"height":24,"icons":{}},{"prefix":"ic","width":24,"height":24,"icons":{"outline-delete-outline":{"body":""}}},{"prefix":"fa","width":1536,"height":1536,"icons":{}},{"prefix":"wi","width":30,"height":30,"icons":{}},{"prefix":"flag","width":512,"height":512,"icons":{}},{"prefix":"mdi","width":24,"height":24,"icons":{"page-next-outline":{"body":""}}},{"prefix":"bi","icons":{"plus":{"body":""}}},{"prefix":"bx","width":24,"height":24,"icons":{"bxs-folder-open":{"body":"","hidden":true}}}]'); collections.forEach((c2) => Iconify.addCollection(c2)); function e$1(e2, t2) { for (var n2 = 0; n2 < t2.length; n2++) { var r2 = t2[n2]; r2.enumerable = r2.enumerable || false, r2.configurable = true, "value" in r2 && (r2.writable = true), Object.defineProperty(e2, r2.key, r2); } } function t$1(t2, n2, r2) { return n2 && e$1(t2.prototype, n2), r2 && e$1(t2, r2), t2; } function n$1() { return (n$1 = Object.assign || function(e2) { for (var t2 = 1; t2 < arguments.length; t2++) { var n2 = arguments[t2]; for (var r2 in n2) Object.prototype.hasOwnProperty.call(n2, r2) && (e2[r2] = n2[r2]); } return e2; }).apply(this, arguments); } function r$1(e2, t2) { e2.prototype = Object.create(t2.prototype), e2.prototype.constructor = e2, e2.__proto__ = t2; } function i(e2, t2) { if (e2 == null) return {}; var n2, r2, i2 = {}, o2 = Object.keys(e2); for (r2 = 0; r2 < o2.length; r2++) t2.indexOf(n2 = o2[r2]) >= 0 || (i2[n2] = e2[n2]); return i2; } function o(e2) { return ((t2 = e2) != null && typeof t2 == "object" && Array.isArray(t2) === false) == 1 && Object.prototype.toString.call(e2) === "[object Object]"; var t2; } var u = Object.prototype, a = u.toString, f = u.hasOwnProperty, c = /^\s*function (\w+)/; function l(e2) { var t2, n2 = (t2 = e2 == null ? void 0 : e2.type) !== null && t2 !== void 0 ? t2 : e2; if (n2) { var r2 = n2.toString().match(c); return r2 ? r2[1] : ""; } return ""; } var s = function(e2) { var t2, n2; return o(e2) !== false && typeof (t2 = e2.constructor) == "function" && o(n2 = t2.prototype) !== false && n2.hasOwnProperty("isPrototypeOf") !== false; }, v = function(e2) { return e2; }, y = v; var d = function(e2, t2) { return f.call(e2, t2); }, h$1 = Number.isInteger || function(e2) { return typeof e2 == "number" && isFinite(e2) && Math.floor(e2) === e2; }, b = Array.isArray || function(e2) { return a.call(e2) === "[object Array]"; }, O = function(e2) { return a.call(e2) === "[object Function]"; }, g = function(e2) { return s(e2) && d(e2, "_vueTypes_name"); }, m = function(e2) { return s(e2) && (d(e2, "type") || ["_vueTypes_name", "validator", "default", "required"].some(function(t2) { return d(e2, t2); })); }; function j(e2, t2) { return Object.defineProperty(e2.bind(t2), "__original", { value: e2 }); } function _(e2, t2, n2) { var r2; n2 === void 0 && (n2 = false); var i2 = true, o2 = ""; r2 = s(e2) ? e2 : { type: e2 }; var u2 = g(r2) ? r2._vueTypes_name + " - " : ""; if (m(r2) && r2.type !== null) { if (r2.type === void 0 || r2.type === true) return i2; if (!r2.required && t2 === void 0) return i2; b(r2.type) ? (i2 = r2.type.some(function(e3) { return _(e3, t2, true) === true; }), o2 = r2.type.map(function(e3) { return l(e3); }).join(" or ")) : i2 = (o2 = l(r2)) === "Array" ? b(t2) : o2 === "Object" ? s(t2) : o2 === "String" || o2 === "Number" || o2 === "Boolean" || o2 === "Function" ? function(e3) { if (e3 == null) return ""; var t3 = e3.constructor.toString().match(c); return t3 ? t3[1] : ""; }(t2) === o2 : t2 instanceof r2.type; } if (!i2) { var a2 = u2 + 'value "' + t2 + '" should be of type "' + o2 + '"'; return n2 === false ? (y(a2), false) : a2; } if (d(r2, "validator") && O(r2.validator)) { var f2 = y, v2 = []; if (y = function(e3) { v2.push(e3); }, i2 = r2.validator(t2), y = f2, !i2) { var p = (v2.length > 1 ? "* " : "") + v2.join("\n* "); return v2.length = 0, n2 === false ? (y(p), i2) : p; } } return i2; } function T$2(e2, t2) { var n2 = Object.defineProperties(t2, { _vueTypes_name: { value: e2, writable: true }, isRequired: { get: function() { return this.required = true, this; } }, def: { value: function(e3) { return e3 !== void 0 || this.default ? O(e3) || _(this, e3, true) === true ? (this.default = b(e3) ? function() { return [].concat(e3); } : s(e3) ? function() { return Object.assign({}, e3); } : e3, this) : (y(this._vueTypes_name + ' - invalid default value: "' + e3 + '"'), this) : this; } } }), r2 = n2.validator; return O(r2) && (n2.validator = j(r2, n2)), n2; } function w(e2, t2) { var n2 = T$2(e2, t2); return Object.defineProperty(n2, "validate", { value: function(e3) { return O(this.validator) && y(this._vueTypes_name + " - calling .validate() will overwrite the current custom validator function. Validator info:\n" + JSON.stringify(this)), this.validator = j(e3, this), this; } }); } function k(e2, t2, n2) { var r2, o2, u2 = (r2 = t2, o2 = {}, Object.getOwnPropertyNames(r2).forEach(function(e3) { o2[e3] = Object.getOwnPropertyDescriptor(r2, e3); }), Object.defineProperties({}, o2)); if (u2._vueTypes_name = e2, !s(n2)) return u2; var a2, f2, c2 = n2.validator, l2 = i(n2, ["validator"]); if (O(c2)) { var v2 = u2.validator; v2 && (v2 = (f2 = (a2 = v2).__original) !== null && f2 !== void 0 ? f2 : a2), u2.validator = j(v2 ? function(e3) { return v2.call(this, e3) && c2.call(this, e3); } : c2, u2); } return Object.assign(u2, l2); } function P(e2) { return e2.replace(/^(?!\s*$)/gm, " "); } var x = function() { return w("any", {}); }, A = function() { return w("function", { type: Function }); }, E = function() { return w("boolean", { type: Boolean }); }, N = function() { return w("string", { type: String }); }, q = function() { return w("number", { type: Number }); }, S = function() { return w("array", { type: Array }); }, V = function() { return w("object", { type: Object }); }, F = function() { return T$2("integer", { type: Number, validator: function(e2) { return h$1(e2); } }); }, D = function() { return T$2("symbol", { validator: function(e2) { return typeof e2 == "symbol"; } }); }; function L(e2, t2) { if (t2 === void 0 && (t2 = "custom validation failed"), typeof e2 != "function") throw new TypeError("[VueTypes error]: You must provide a function as argument"); return T$2(e2.name || "<>", { validator: function(n2) { var r2 = e2(n2); return r2 || y(this._vueTypes_name + " - " + t2), r2; } }); } function Y(e2) { if (!b(e2)) throw new TypeError("[VueTypes error]: You must provide an array as argument."); var t2 = 'oneOf - value should be one of "' + e2.join('", "') + '".', n2 = e2.reduce(function(e3, t3) { if (t3 != null) { var n3 = t3.constructor; e3.indexOf(n3) === -1 && e3.push(n3); } return e3; }, []); return T$2("oneOf", { type: n2.length > 0 ? n2 : void 0, validator: function(n3) { var r2 = e2.indexOf(n3) !== -1; return r2 || y(t2), r2; } }); } function B(e2) { if (!b(e2)) throw new TypeError("[VueTypes error]: You must provide an array as argument"); for (var t2 = false, n2 = [], r2 = 0; r2 < e2.length; r2 += 1) { var i2 = e2[r2]; if (m(i2)) { if (g(i2) && i2._vueTypes_name === "oneOf") { n2 = n2.concat(i2.type); continue; } if (O(i2.validator) && (t2 = true), i2.type !== true && i2.type) { n2 = n2.concat(i2.type); continue; } } n2.push(i2); } return n2 = n2.filter(function(e3, t3) { return n2.indexOf(e3) === t3; }), T$2("oneOfType", t2 ? { type: n2, validator: function(t3) { var n3 = [], r3 = e2.some(function(e3) { var r4 = _(g(e3) && e3._vueTypes_name === "oneOf" ? e3.type || null : e3, t3, true); return typeof r4 == "string" && n3.push(r4), r4 === true; }); return r3 || y("oneOfType - provided value does not match any of the " + n3.length + " passed-in validators:\n" + P(n3.join("\n"))), r3; } } : { type: n2 }); } function I(e2) { return T$2("arrayOf", { type: Array, validator: function(t2) { var n2, r2 = t2.every(function(t3) { return (n2 = _(e2, t3, true)) === true; }); return r2 || y("arrayOf - value validation error:\n" + P(n2)), r2; } }); } function J(e2) { return T$2("instanceOf", { type: e2 }); } function M(e2) { return T$2("objectOf", { type: Object, validator: function(t2) { var n2, r2 = Object.keys(t2).every(function(r3) { return (n2 = _(e2, t2[r3], true)) === true; }); return r2 || y("objectOf - value validation error:\n" + P(n2)), r2; } }); } function R(e2) { var t2 = Object.keys(e2), n2 = t2.filter(function(t3) { var n3; return !!((n3 = e2[t3]) === null || n3 === void 0 ? void 0 : n3.required); }), r2 = T$2("shape", { type: Object, validator: function(r3) { var i2 = this; if (!s(r3)) return false; var o2 = Object.keys(r3); if (n2.length > 0 && n2.some(function(e3) { return o2.indexOf(e3) === -1; })) { var u2 = n2.filter(function(e3) { return o2.indexOf(e3) === -1; }); return y(u2.length === 1 ? 'shape - required property "' + u2[0] + '" is not defined.' : 'shape - required properties "' + u2.join('", "') + '" are not defined.'), false; } return o2.every(function(n3) { if (t2.indexOf(n3) === -1) return i2._vueTypes_isLoose === true || (y('shape - shape definition does not include a "' + n3 + '" property. Allowed keys: "' + t2.join('", "') + '".'), false); var o3 = _(e2[n3], r3[n3], true); return typeof o3 == "string" && y('shape - "' + n3 + '" property validation error:\n ' + P(o3)), o3 === true; }); } }); return Object.defineProperty(r2, "_vueTypes_isLoose", { writable: true, value: false }), Object.defineProperty(r2, "loose", { get: function() { return this._vueTypes_isLoose = true, this; } }), r2; } var $ = function() { function e2() { } return e2.extend = function(e3) { var t2 = this; if (b(e3)) return e3.forEach(function(e4) { return t2.extend(e4); }), this; var n2 = e3.name, r2 = e3.validate, o2 = r2 !== void 0 && r2, u2 = e3.getter, a2 = u2 !== void 0 && u2, f2 = i(e3, ["name", "validate", "getter"]); if (d(this, n2)) throw new TypeError('[VueTypes error]: Type "' + n2 + '" already defined'); var c2, l2 = f2.type; return g(l2) ? (delete f2.type, Object.defineProperty(this, n2, a2 ? { get: function() { return k(n2, l2, f2); } } : { value: function() { var e4, t3 = k(n2, l2, f2); return t3.validator && (t3.validator = (e4 = t3.validator).bind.apply(e4, [t3].concat([].slice.call(arguments)))), t3; } })) : (c2 = a2 ? { get: function() { var e4 = Object.assign({}, f2); return o2 ? w(n2, e4) : T$2(n2, e4); }, enumerable: true } : { value: function() { var e4, t3, r3 = Object.assign({}, f2); return e4 = o2 ? w(n2, r3) : T$2(n2, r3), r3.validator && (e4.validator = (t3 = r3.validator).bind.apply(t3, [e4].concat([].slice.call(arguments)))), e4; }, enumerable: true }, Object.defineProperty(this, n2, c2)); }, t$1(e2, null, [{ key: "any", get: function() { return x(); } }, { key: "func", get: function() { return A().def(this.defaults.func); } }, { key: "bool", get: function() { return E().def(this.defaults.bool); } }, { key: "string", get: function() { return N().def(this.defaults.string); } }, { key: "number", get: function() { return q().def(this.defaults.number); } }, { key: "array", get: function() { return S().def(this.defaults.array); } }, { key: "object", get: function() { return V().def(this.defaults.object); } }, { key: "integer", get: function() { return F().def(this.defaults.integer); } }, { key: "symbol", get: function() { return D(); } }]), e2; }(); function z(e2) { var i2; return e2 === void 0 && (e2 = { func: function() { }, bool: true, string: "", number: 0, array: function() { return []; }, object: function() { return {}; }, integer: 0 }), (i2 = function(i3) { function o2() { return i3.apply(this, arguments) || this; } return r$1(o2, i3), t$1(o2, null, [{ key: "sensibleDefaults", get: function() { return n$1({}, this.defaults); }, set: function(t2) { this.defaults = t2 !== false ? n$1({}, t2 !== true ? t2 : e2) : {}; } }]), o2; }($)).defaults = n$1({}, e2), i2; } $.defaults = {}, $.custom = L, $.oneOf = Y, $.instanceOf = J, $.oneOfType = B, $.arrayOf = I, $.objectOf = M, $.shape = R, $.utils = { validate: function(e2, t2) { return _(t2, e2, true) === true; }, toType: function(e2, t2, n2) { return n2 === void 0 && (n2 = false), n2 ? w(e2, t2) : T$2(e2, t2); } }; (function(e2) { function t2() { return e2.apply(this, arguments) || this; } return r$1(t2, e2), t2; })(z()); const propTypes$1 = z({ func: void 0, bool: void 0, string: void 0, number: void 0, object: void 0, integer: void 0 }); propTypes$1.extend([ { name: "style", getter: true, type: [String, Object], default: void 0 }, { name: "VNodeChild", getter: true, type: void 0 } ]); const SVG_END_WITH_FLAG = "|svg"; const ICON_FONT_END_WITH_FLAG = "|font"; const _sfc_main$J = defineComponent({ name: "BzIcon", components: { SvgIcon: bzSvgIcon }, props: { icon: propTypes$1.string, color: propTypes$1.string, size: { type: [String, Number], default: 16 }, spin: propTypes$1.bool.def(false), prefix: propTypes$1.string.def("") }, setup(props2) { const elRef = ref(null); const isSvgIcon = computed(() => { var _a3; return (_a3 = props2.icon) == null ? void 0 : _a3.endsWith(SVG_END_WITH_FLAG); }); const getSvgIcon = computed(() => props2.icon.replace(SVG_END_WITH_FLAG, "")); const getIconRef = computed(() => `${props2.prefix ? props2.prefix + ":" : ""}${props2.icon}`); const isIconFont = computed(() => { var _a3; return (_a3 = props2.icon) == null ? void 0 : _a3.endsWith(ICON_FONT_END_WITH_FLAG); }); const getIconFontIcon = computed(() => props2.icon.replace(ICON_FONT_END_WITH_FLAG, "")); const update = async () => { if (unref(isSvgIcon)) return; const el = unref(elRef); if (!el) return; await nextTick(); const icon = unref(getIconRef); if (!icon) return; const svg = Iconify.renderSVG(icon, {}); if (svg) { el.textContent = ""; el.appendChild(svg); } else { const span = document.createElement("span"); span.className = "iconify"; span.dataset.icon = icon; el.textContent = ""; el.appendChild(span); } }; const getWrapStyle2 = computed(() => { const { size, color } = props2; let fs = size; if (isString$3(size)) { fs = parseInt(size, 10); } return { fontSize: `${fs}px`, color, display: "inline-flex" }; }); watch(() => props2.icon, update, { flush: "post" }); onMounted(update); return { elRef, getWrapStyle: getWrapStyle2, isSvgIcon, getSvgIcon, isIconFont, getIconFontIcon }; } }); const _hoisted_1$e = ["xlink:href"]; function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) { const _component_SvgIcon = resolveComponent("SvgIcon"); return _ctx.isSvgIcon ? (openBlock(), createBlock(_component_SvgIcon, { key: 0, size: _ctx.size, name: _ctx.getSvgIcon, class: normalizeClass([_ctx.$attrs.class, "anticon"]), spin: _ctx.spin }, null, 8, ["size", "name", "class", "spin"])) : _ctx.isIconFont ? (openBlock(), createElementBlock("svg", { key: 1, class: normalizeClass([_ctx.$attrs.class, "icon"]), "aria-hidden": "true", style: normalizeStyle(_ctx.getWrapStyle) }, [ createElementVNode("use", { "xlink:href": `#${_ctx.getIconFontIcon}` }, null, 8, _hoisted_1$e) ], 6)) : (openBlock(), createElementBlock("span", { key: 2, ref: "elRef", class: normalizeClass([_ctx.$attrs.class, "bz-app-iconify anticon", _ctx.spin && "app-iconify-spin"]), style: normalizeStyle(_ctx.getWrapStyle) }, null, 6)); } var Icon$2 = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["render", _sfc_render$x]]); const __default__$5 = { name: "CollapseContainer", inheritAttrs: false }; const _sfc_main$I = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$5), { props: { prefixCls: { type: String }, helpMessage: { type: [Array, String], default: "" }, title: { type: String }, show: { type: Boolean }, canExpan: { type: Boolean } }, emits: ["expand"], setup(__props) { return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass([`${__props.prefixCls}__header px-2 py-5`, _ctx.$attrs.class]) }, [ createVNode(unref(BzTitle), { helpMessage: __props.helpMessage, normal: "" }, { default: withCtx(() => [ __props.title ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ createTextVNode(toDisplayString(__props.title), 1) ], 64)) : renderSlot(_ctx.$slots, "title", { key: 1 }) ]), _: 3 }, 8, ["helpMessage"]), createElementVNode("div", { class: normalizeClass(`${__props.prefixCls}__action`) }, [ renderSlot(_ctx.$slots, "action"), __props.canExpan ? (openBlock(), createBlock(unref(BzArrow), { key: 0, up: "", expand: __props.show, onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("expand")) }, null, 8, ["expand"])) : createCommentVNode("", true) ], 2) ], 2); }; } })); function _defineProperty$12(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } function ownKeys$2(object3, enumerableOnly) { var keys2 = Object.keys(object3); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object3); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object3, sym).enumerable; })), keys2.push.apply(keys2, symbols); } return keys2; } function _objectSpread2$2(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? arguments[i2] : {}; i2 % 2 ? ownKeys$2(Object(source2), true).forEach(function(key2) { _defineProperty$12(target, key2, source2[key2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2)) : ownKeys$2(Object(source2)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source2, key2)); }); } return target; } function _extends$1() { _extends$1 = Object.assign || function(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2]; for (var key2 in source2) { if (Object.prototype.hasOwnProperty.call(source2, key2)) { target[key2] = source2[key2]; } } } return target; }; return _extends$1.apply(this, arguments); } var PropTypes = z({ func: void 0, bool: void 0, string: void 0, number: void 0, array: void 0, object: void 0, integer: void 0 }); PropTypes.extend([{ name: "looseBool", getter: true, type: Boolean, default: void 0 }, { name: "style", getter: true, type: [String, Object], default: void 0 }, { name: "VNodeChild", getter: true, type: null }]); function withUndefined(type2) { type2.default = void 0; return type2; } var PropsTypes = PropTypes; function _typeof$2(obj) { "@babel/helpers - typeof"; return _typeof$2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { return typeof obj2; } : function(obj2) { return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }, _typeof$2(obj); } var isFunction$1 = function isFunction2(val) { return typeof val === "function"; }; var isArray$5 = Array.isArray; var isString$2 = function isString2(val) { return typeof val === "string"; }; var isObject$2 = function isObject2(val) { return val !== null && _typeof$2(val) === "object"; }; var onRE = /^on[^a-z]/; var isOn = function isOn2(key2) { return onRE.test(key2); }; var cacheStringFunction = function cacheStringFunction2(fn) { var cache2 = /* @__PURE__ */ Object.create(null); return function(str) { var hit = cache2[str]; return hit || (cache2[str] = fn(str)); }; }; var camelizeRE = /-(\w)/g; var camelize = cacheStringFunction(function(str) { return str.replace(camelizeRE, function(_2, c2) { return c2 ? c2.toUpperCase() : ""; }); }); var hyphenateRE = /\B([A-Z])/g; var hyphenate = cacheStringFunction(function(str) { return str.replace(hyphenateRE, "-$1").toLowerCase(); }); var hasOwnProperty = Object.prototype.hasOwnProperty; var hasOwn$2 = function hasOwn2(val, key2) { return hasOwnProperty.call(val, key2); }; function resolvePropValue(options2, props2, key2, value24) { var opt = options2[key2]; if (opt != null) { var hasDefault = hasOwn$2(opt, "default"); if (hasDefault && value24 === void 0) { var defaultValue = opt.default; value24 = opt.type !== Function && isFunction$1(defaultValue) ? defaultValue() : defaultValue; } if (opt.type === Boolean) { if (!hasOwn$2(props2, key2) && !hasDefault) { value24 = false; } else if (value24 === "") { value24 = true; } } } return value24; } function getDataAndAriaProps$1(props2) { return Object.keys(props2).reduce(function(memo, key2) { if (key2.substr(0, 5) === "data-" || key2.substr(0, 5) === "aria-") { memo[key2] = props2[key2]; } return memo; }, {}); } function classNames() { var classes3 = []; for (var i2 = 0; i2 < arguments.length; i2++) { var value24 = i2 < 0 || arguments.length <= i2 ? void 0 : arguments[i2]; if (!value24) continue; if (isString$2(value24)) { classes3.push(value24); } else if (isArray$5(value24)) { for (var _i = 0; _i < value24.length; _i++) { var inner = classNames(value24[_i]); if (inner) { classes3.push(inner); } } } else if (isObject$2(value24)) { for (var name in value24) { if (value24[name]) { classes3.push(name); } } } } return classes3.join(" "); } function omit(obj, fields2) { var shallowCopy = Object.assign({}, obj); for (var i2 = 0; i2 < fields2.length; i2 += 1) { var key2 = fields2[i2]; delete shallowCopy[key2]; } return shallowCopy; } var MapShim = function() { if (typeof Map !== "undefined") { return Map; } function getIndex(arr, key2) { var result = -1; arr.some(function(entry, index2) { if (entry[0] === key2) { result = index2; return true; } return false; }); return result; } return function() { function class_1() { this.__entries__ = []; } Object.defineProperty(class_1.prototype, "size", { get: function() { return this.__entries__.length; }, enumerable: true, configurable: true }); class_1.prototype.get = function(key2) { var index2 = getIndex(this.__entries__, key2); var entry = this.__entries__[index2]; return entry && entry[1]; }; class_1.prototype.set = function(key2, value24) { var index2 = getIndex(this.__entries__, key2); if (~index2) { this.__entries__[index2][1] = value24; } else { this.__entries__.push([key2, value24]); } }; class_1.prototype.delete = function(key2) { var entries2 = this.__entries__; var index2 = getIndex(entries2, key2); if (~index2) { entries2.splice(index2, 1); } }; class_1.prototype.has = function(key2) { return !!~getIndex(this.__entries__, key2); }; class_1.prototype.clear = function() { this.__entries__.splice(0); }; class_1.prototype.forEach = function(callback2, ctx) { if (ctx === void 0) { ctx = null; } for (var _i = 0, _a3 = this.__entries__; _i < _a3.length; _i++) { var entry = _a3[_i]; callback2.call(ctx, entry[1], entry[0]); } }; return class_1; }(); }(); var isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && window.document === document; var global$1 = function() { if (typeof global !== "undefined" && global.Math === Math) { return global; } if (typeof self !== "undefined" && self.Math === Math) { return self; } if (typeof window !== "undefined" && window.Math === Math) { return window; } return Function("return this")(); }(); var requestAnimationFrame$1 = function() { if (typeof requestAnimationFrame === "function") { return requestAnimationFrame.bind(global$1); } return function(callback2) { return setTimeout(function() { return callback2(Date.now()); }, 1e3 / 60); }; }(); var trailingTimeout = 2; function throttle(callback2, delay) { var leadingCall = false, trailingCall = false, lastCallTime = 0; function resolvePending() { if (leadingCall) { leadingCall = false; callback2(); } if (trailingCall) { proxy(); } } function timeoutCallback() { requestAnimationFrame$1(resolvePending); } function proxy() { var timeStamp = Date.now(); if (leadingCall) { if (timeStamp - lastCallTime < trailingTimeout) { return; } trailingCall = true; } else { leadingCall = true; trailingCall = false; setTimeout(timeoutCallback, delay); } lastCallTime = timeStamp; } return proxy; } var REFRESH_DELAY = 20; var transitionKeys = ["top", "right", "bottom", "left", "width", "height", "size", "weight"]; var mutationObserverSupported = typeof MutationObserver !== "undefined"; var ResizeObserverController = function() { function ResizeObserverController2() { this.connected_ = false; this.mutationEventsAdded_ = false; this.mutationsObserver_ = null; this.observers_ = []; this.onTransitionEnd_ = this.onTransitionEnd_.bind(this); this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY); } ResizeObserverController2.prototype.addObserver = function(observer) { if (!~this.observers_.indexOf(observer)) { this.observers_.push(observer); } if (!this.connected_) { this.connect_(); } }; ResizeObserverController2.prototype.removeObserver = function(observer) { var observers2 = this.observers_; var index2 = observers2.indexOf(observer); if (~index2) { observers2.splice(index2, 1); } if (!observers2.length && this.connected_) { this.disconnect_(); } }; ResizeObserverController2.prototype.refresh = function() { var changesDetected = this.updateObservers_(); if (changesDetected) { this.refresh(); } }; ResizeObserverController2.prototype.updateObservers_ = function() { var activeObservers = this.observers_.filter(function(observer) { return observer.gatherActive(), observer.hasActive(); }); activeObservers.forEach(function(observer) { return observer.broadcastActive(); }); return activeObservers.length > 0; }; ResizeObserverController2.prototype.connect_ = function() { if (!isBrowser || this.connected_) { return; } document.addEventListener("transitionend", this.onTransitionEnd_); window.addEventListener("resize", this.refresh); if (mutationObserverSupported) { this.mutationsObserver_ = new MutationObserver(this.refresh); this.mutationsObserver_.observe(document, { attributes: true, childList: true, characterData: true, subtree: true }); } else { document.addEventListener("DOMSubtreeModified", this.refresh); this.mutationEventsAdded_ = true; } this.connected_ = true; }; ResizeObserverController2.prototype.disconnect_ = function() { if (!isBrowser || !this.connected_) { return; } document.removeEventListener("transitionend", this.onTransitionEnd_); window.removeEventListener("resize", this.refresh); if (this.mutationsObserver_) { this.mutationsObserver_.disconnect(); } if (this.mutationEventsAdded_) { document.removeEventListener("DOMSubtreeModified", this.refresh); } this.mutationsObserver_ = null; this.mutationEventsAdded_ = false; this.connected_ = false; }; ResizeObserverController2.prototype.onTransitionEnd_ = function(_a3) { var _b2 = _a3.propertyName, propertyName = _b2 === void 0 ? "" : _b2; var isReflowProperty = transitionKeys.some(function(key2) { return !!~propertyName.indexOf(key2); }); if (isReflowProperty) { this.refresh(); } }; ResizeObserverController2.getInstance = function() { if (!this.instance_) { this.instance_ = new ResizeObserverController2(); } return this.instance_; }; ResizeObserverController2.instance_ = null; return ResizeObserverController2; }(); var defineConfigurable = function(target, props2) { for (var _i = 0, _a3 = Object.keys(props2); _i < _a3.length; _i++) { var key2 = _a3[_i]; Object.defineProperty(target, key2, { value: props2[key2], enumerable: false, writable: false, configurable: true }); } return target; }; var getWindowOf = function(target) { var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView; return ownerGlobal || global$1; }; var emptyRect = createRectInit(0, 0, 0, 0); function toFloat(value24) { return parseFloat(value24) || 0; } function getBordersSize(styles) { var positions = []; for (var _i = 1; _i < arguments.length; _i++) { positions[_i - 1] = arguments[_i]; } return positions.reduce(function(size, position2) { var value24 = styles["border-" + position2 + "-width"]; return size + toFloat(value24); }, 0); } function getPaddings(styles) { var positions = ["top", "right", "bottom", "left"]; var paddings = {}; for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) { var position2 = positions_1[_i]; var value24 = styles["padding-" + position2]; paddings[position2] = toFloat(value24); } return paddings; } function getSVGContentRect(target) { var bbox = target.getBBox(); return createRectInit(0, 0, bbox.width, bbox.height); } function getHTMLElementContentRect(target) { var clientWidth = target.clientWidth, clientHeight = target.clientHeight; if (!clientWidth && !clientHeight) { return emptyRect; } var styles = getWindowOf(target).getComputedStyle(target); var paddings = getPaddings(styles); var horizPad = paddings.left + paddings.right; var vertPad = paddings.top + paddings.bottom; var width = toFloat(styles.width), height = toFloat(styles.height); if (styles.boxSizing === "border-box") { if (Math.round(width + horizPad) !== clientWidth) { width -= getBordersSize(styles, "left", "right") + horizPad; } if (Math.round(height + vertPad) !== clientHeight) { height -= getBordersSize(styles, "top", "bottom") + vertPad; } } if (!isDocumentElement(target)) { var vertScrollbar = Math.round(width + horizPad) - clientWidth; var horizScrollbar = Math.round(height + vertPad) - clientHeight; if (Math.abs(vertScrollbar) !== 1) { width -= vertScrollbar; } if (Math.abs(horizScrollbar) !== 1) { height -= horizScrollbar; } } return createRectInit(paddings.left, paddings.top, width, height); } var isSVGGraphicsElement = function() { if (typeof SVGGraphicsElement !== "undefined") { return function(target) { return target instanceof getWindowOf(target).SVGGraphicsElement; }; } return function(target) { return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === "function"; }; }(); function isDocumentElement(target) { return target === getWindowOf(target).document.documentElement; } function getContentRect(target) { if (!isBrowser) { return emptyRect; } if (isSVGGraphicsElement(target)) { return getSVGContentRect(target); } return getHTMLElementContentRect(target); } function createReadOnlyRect(_a3) { var x2 = _a3.x, y2 = _a3.y, width = _a3.width, height = _a3.height; var Constr = typeof DOMRectReadOnly !== "undefined" ? DOMRectReadOnly : Object; var rect = Object.create(Constr.prototype); defineConfigurable(rect, { x: x2, y: y2, width, height, top: y2, right: x2 + width, bottom: height + y2, left: x2 }); return rect; } function createRectInit(x2, y2, width, height) { return { x: x2, y: y2, width, height }; } var ResizeObservation = function() { function ResizeObservation2(target) { this.broadcastWidth = 0; this.broadcastHeight = 0; this.contentRect_ = createRectInit(0, 0, 0, 0); this.target = target; } ResizeObservation2.prototype.isActive = function() { var rect = getContentRect(this.target); this.contentRect_ = rect; return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight; }; ResizeObservation2.prototype.broadcastRect = function() { var rect = this.contentRect_; this.broadcastWidth = rect.width; this.broadcastHeight = rect.height; return rect; }; return ResizeObservation2; }(); var ResizeObserverEntry = function() { function ResizeObserverEntry2(target, rectInit) { var contentRect = createReadOnlyRect(rectInit); defineConfigurable(this, { target, contentRect }); } return ResizeObserverEntry2; }(); var ResizeObserverSPI = function() { function ResizeObserverSPI2(callback2, controller, callbackCtx) { this.activeObservations_ = []; this.observations_ = new MapShim(); if (typeof callback2 !== "function") { throw new TypeError("The callback provided as parameter 1 is not a function."); } this.callback_ = callback2; this.controller_ = controller; this.callbackCtx_ = callbackCtx; } ResizeObserverSPI2.prototype.observe = function(target) { if (!arguments.length) { throw new TypeError("1 argument required, but only 0 present."); } if (typeof Element === "undefined" || !(Element instanceof Object)) { return; } if (!(target instanceof getWindowOf(target).Element)) { throw new TypeError('parameter 1 is not of type "Element".'); } var observations = this.observations_; if (observations.has(target)) { return; } observations.set(target, new ResizeObservation(target)); this.controller_.addObserver(this); this.controller_.refresh(); }; ResizeObserverSPI2.prototype.unobserve = function(target) { if (!arguments.length) { throw new TypeError("1 argument required, but only 0 present."); } if (typeof Element === "undefined" || !(Element instanceof Object)) { return; } if (!(target instanceof getWindowOf(target).Element)) { throw new TypeError('parameter 1 is not of type "Element".'); } var observations = this.observations_; if (!observations.has(target)) { return; } observations.delete(target); if (!observations.size) { this.controller_.removeObserver(this); } }; ResizeObserverSPI2.prototype.disconnect = function() { this.clearActive(); this.observations_.clear(); this.controller_.removeObserver(this); }; ResizeObserverSPI2.prototype.gatherActive = function() { var _this = this; this.clearActive(); this.observations_.forEach(function(observation) { if (observation.isActive()) { _this.activeObservations_.push(observation); } }); }; ResizeObserverSPI2.prototype.broadcastActive = function() { if (!this.hasActive()) { return; } var ctx = this.callbackCtx_; var entries2 = this.activeObservations_.map(function(observation) { return new ResizeObserverEntry(observation.target, observation.broadcastRect()); }); this.callback_.call(ctx, entries2, ctx); this.clearActive(); }; ResizeObserverSPI2.prototype.clearActive = function() { this.activeObservations_.splice(0); }; ResizeObserverSPI2.prototype.hasActive = function() { return this.activeObservations_.length > 0; }; return ResizeObserverSPI2; }(); var observers = typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : new MapShim(); var ResizeObserver$1 = function() { function ResizeObserver2(callback2) { if (!(this instanceof ResizeObserver2)) { throw new TypeError("Cannot call a class as a function."); } if (!arguments.length) { throw new TypeError("1 argument required, but only 0 present."); } var controller = ResizeObserverController.getInstance(); var observer = new ResizeObserverSPI(callback2, controller, this); observers.set(this, observer); } return ResizeObserver2; }(); [ "observe", "unobserve", "disconnect" ].forEach(function(method3) { ResizeObserver$1.prototype[method3] = function() { var _a3; return (_a3 = observers.get(this))[method3].apply(_a3, arguments); }; }); var index$G = function() { if (typeof global$1.ResizeObserver !== "undefined") { return global$1.ResizeObserver; } return ResizeObserver$1; }(); function _arrayWithHoles$4(arr) { if (Array.isArray(arr)) return arr; } function _iterableToArrayLimit$4(arr, i2) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i2 && _arr.length === i2) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) { arr2[i2] = arr[i2]; } return arr2; } function _unsupportedIterableToArray$4(o2, minLen) { if (!o2) return; if (typeof o2 === "string") return _arrayLikeToArray$4(o2, minLen); var n2 = Object.prototype.toString.call(o2).slice(8, -1); if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; if (n2 === "Map" || n2 === "Set") return Array.from(o2); if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$4(o2, minLen); } function _nonIterableRest$4() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _slicedToArray$4(arr, i2) { return _arrayWithHoles$4(arr) || _iterableToArrayLimit$4(arr, i2) || _unsupportedIterableToArray$4(arr, i2) || _nonIterableRest$4(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$4(arr); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$4(arr) || _nonIterableSpread(); } var isValid = function isValid2(value24) { return value24 !== void 0 && value24 !== null && value24 !== ""; }; var isValid$1 = isValid; var splitAttrs = function splitAttrs2(attrs) { var allAttrs = Object.keys(attrs); var eventAttrs = {}; var onEvents = {}; var extraAttrs = {}; for (var i2 = 0, l2 = allAttrs.length; i2 < l2; i2++) { var key2 = allAttrs[i2]; if (isOn(key2)) { eventAttrs[key2[2].toLowerCase() + key2.slice(3)] = attrs[key2]; onEvents[key2] = attrs[key2]; } else { extraAttrs[key2] = attrs[key2]; } } return { onEvents, events: eventAttrs, extraAttrs }; }; var parseStyleText = function parseStyleText2() { var cssText = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; var camel = arguments.length > 1 ? arguments[1] : void 0; var res = {}; var listDelimiter = /;(?![^(]*\))/g; var propertyDelimiter = /:(.+)/; cssText.split(listDelimiter).forEach(function(item) { if (item) { var tmp = item.split(propertyDelimiter); if (tmp.length > 1) { var k2 = camel ? camelize(tmp[0].trim()) : tmp[0].trim(); res[k2] = tmp[1].trim(); } } }); return res; }; var hasProp = function hasProp2(instance, prop) { return prop in getOptionProps(instance); }; var flattenChildren = function flattenChildren2() { var children = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var filterEmpty2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; var temp = Array.isArray(children) ? children : [children]; var res = []; temp.forEach(function(child) { if (Array.isArray(child)) { res.push.apply(res, _toConsumableArray(flattenChildren2(child, filterEmpty2))); } else if (child && child.type === Fragment) { res.push.apply(res, _toConsumableArray(flattenChildren2(child.children, filterEmpty2))); } else if (child && isVNode(child)) { if (filterEmpty2 && !isEmptyElement(child)) { res.push(child); } else if (!filterEmpty2) { res.push(child); } } else if (isValid$1(child)) { res.push(child); } }); return res; }; var getSlot$1 = function getSlot2(self2) { var name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "default"; var options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; if (isVNode(self2)) { if (self2.type === Fragment) { return name === "default" ? flattenChildren(self2.children) : []; } else if (self2.children && self2.children[name]) { return flattenChildren(self2.children[name](options2)); } else { return []; } } else { var res = self2.$slots[name] && self2.$slots[name](options2); return flattenChildren(res); } }; var findDOMNode = function findDOMNode2(instance) { var _a3; var node = ((_a3 = instance === null || instance === void 0 ? void 0 : instance.vnode) === null || _a3 === void 0 ? void 0 : _a3.el) || instance && (instance.$el || instance); while (node && !node.tagName) { node = node.nextSibling; } return node; }; var getOptionProps = function getOptionProps2(instance) { var res = {}; if (instance.$ && instance.$.vnode) { var props2 = instance.$.vnode.props || {}; Object.keys(instance.$props).forEach(function(k2) { var v2 = instance.$props[k2]; var hyphenateKey = hyphenate(k2); if (v2 !== void 0 || hyphenateKey in props2) { res[k2] = v2; } }); } else if (isVNode(instance) && _typeof$2(instance.type) === "object") { var originProps = instance.props || {}; var _props2 = {}; Object.keys(originProps).forEach(function(key2) { _props2[camelize(key2)] = originProps[key2]; }); var options2 = instance.type.props || {}; Object.keys(options2).forEach(function(k2) { var v2 = resolvePropValue(options2, _props2, k2, _props2[k2]); if (v2 !== void 0 || k2 in _props2) { res[k2] = v2; } }); } return res; }; var getComponent = function getComponent2(instance) { var prop = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "default"; var options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : instance; var execute = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true; var com = void 0; if (instance.$) { var temp = instance[prop]; if (temp !== void 0) { return typeof temp === "function" && execute ? temp(options2) : temp; } else { com = instance.$slots[prop]; com = execute && com ? com(options2) : com; } } else if (isVNode(instance)) { var _temp = instance.props && instance.props[prop]; if (_temp !== void 0 && instance.props !== null) { return typeof _temp === "function" && execute ? _temp(options2) : _temp; } else if (instance.type === Fragment) { com = instance.children; } else if (instance.children && instance.children[prop]) { com = instance.children[prop]; com = execute && com ? com(options2) : com; } } if (Array.isArray(com)) { com = flattenChildren(com); com = com.length === 1 ? com[0] : com; com = com.length === 0 ? void 0 : com; } return com; }; var getPropsData = function getPropsData2(ins) { var vnode = ins.$ ? ins.$ : ins; var res = {}; var originProps = vnode.props || {}; var props2 = {}; Object.keys(originProps).forEach(function(key2) { props2[camelize(key2)] = originProps[key2]; }); var options2 = isPlainObject$1(vnode.type) ? vnode.type.props : {}; options2 && Object.keys(options2).forEach(function(k2) { var v2 = resolvePropValue(options2, props2, k2, props2[k2]); if (k2 in props2) { res[k2] = v2; } }); return _extends$1(_extends$1({}, props2), res); }; var getKey$2 = function getKey2(ele) { var key2 = ele.key; return key2; }; function getEvents() { var ele = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var on2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; var props2 = {}; if (ele.$) { props2 = _extends$1(_extends$1({}, props2), ele.$attrs); } else { props2 = _extends$1(_extends$1({}, props2), ele.props); } return splitAttrs(props2)[on2 ? "onEvents" : "events"]; } function getClass(ele) { var props2 = (isVNode(ele) ? ele.props : ele.$attrs) || {}; var tempCls = props2.class || {}; var cls = {}; if (typeof tempCls === "string") { tempCls.split(" ").forEach(function(c2) { cls[c2.trim()] = true; }); } else if (Array.isArray(tempCls)) { classNames(tempCls).split(" ").forEach(function(c2) { cls[c2.trim()] = true; }); } else { cls = _extends$1(_extends$1({}, cls), tempCls); } return cls; } function getStyle(ele, camel) { var props2 = (isVNode(ele) ? ele.props : ele.$attrs) || {}; var style = props2.style || {}; if (typeof style === "string") { style = parseStyleText(style, camel); } else if (camel && style) { var res = {}; Object.keys(style).forEach(function(k2) { return res[camelize(k2)] = style[k2]; }); return res; } return style; } function isEmptyContent(c2) { return c2 === void 0 || c2 === null || c2 === "" || Array.isArray(c2) && c2.length === 0; } function isEmptyElement(c2) { return c2 && (c2.type === Comment || c2.type === Fragment && c2.children.length === 0 || c2.type === Text && c2.children.trim() === ""); } function isEmptySlot(c2) { return !c2 || c2().every(isEmptyElement); } function filterEmpty() { var children = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var res = []; children.forEach(function(child) { if (Array.isArray(child)) { res.push.apply(res, _toConsumableArray(child)); } else if (child.type === Fragment) { res.push.apply(res, _toConsumableArray(child.children)); } else { res.push(child); } }); return res.filter(function(c2) { return !isEmptyElement(c2); }); } var initDefaultProps$2 = function initDefaultProps2(propTypes2, defaultProps2) { Object.keys(defaultProps2).forEach(function(k2) { if (propTypes2[k2]) { propTypes2[k2].def && (propTypes2[k2] = propTypes2[k2].def(defaultProps2[k2])); } else { throw new Error("not have ".concat(k2, " prop")); } }); return propTypes2; }; function mergeProps() { var args = [].slice.call(arguments, 0); var props2 = {}; args.forEach(function() { var p = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; for (var _i = 0, _Object$entries = Object.entries(p); _i < _Object$entries.length; _i++) { var _Object$entries$_i = _slicedToArray$4(_Object$entries[_i], 2), k2 = _Object$entries$_i[0], v2 = _Object$entries$_i[1]; props2[k2] = props2[k2] || {}; if (isPlainObject$1(v2)) { _extends$1(props2[k2], v2); } else { props2[k2] = v2; } } }); return props2; } function isValidElement(element) { return element && element.__v_isVNode && _typeof$2(element.type) !== "symbol"; } function getPropsSlot(slots, props2) { var prop = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "default"; var _a3, _b2; return (_a3 = props2[prop]) !== null && _a3 !== void 0 ? _a3 : (_b2 = slots[prop]) === null || _b2 === void 0 ? void 0 : _b2.call(slots); } var hasProp$1 = hasProp; var ResizeObserver = defineComponent({ name: "ResizeObserver", props: { disabled: Boolean, onResize: Function }, emits: ["resize"], setup: function setup(props2, _ref) { var slots = _ref.slots; var state = reactive({ width: 0, height: 0, offsetHeight: 0, offsetWidth: 0 }); var currentElement = null; var resizeObserver = null; var destroyObserver = function destroyObserver2() { if (resizeObserver) { resizeObserver.disconnect(); resizeObserver = null; } }; var onResize = function onResize2(entries2) { var onResize3 = props2.onResize; var target = entries2[0].target; var _target$getBoundingCl = target.getBoundingClientRect(), width = _target$getBoundingCl.width, height = _target$getBoundingCl.height; var offsetWidth = target.offsetWidth, offsetHeight = target.offsetHeight; var fixedWidth = Math.floor(width); var fixedHeight = Math.floor(height); if (state.width !== fixedWidth || state.height !== fixedHeight || state.offsetWidth !== offsetWidth || state.offsetHeight !== offsetHeight) { var size = { width: fixedWidth, height: fixedHeight, offsetWidth, offsetHeight }; _extends$1(state, size); if (onResize3) { Promise.resolve().then(function() { onResize3(_extends$1(_extends$1({}, size), { offsetWidth, offsetHeight }), target); }); } } }; var instance = getCurrentInstance(); var registerObserver = function registerObserver2() { var disabled = props2.disabled; if (disabled) { destroyObserver(); return; } var element = findDOMNode(instance); var elementChanged = element !== currentElement; if (elementChanged) { destroyObserver(); currentElement = element; } if (!resizeObserver && element) { resizeObserver = new index$G(onResize); resizeObserver.observe(element); } }; onMounted(function() { registerObserver(); }); onUpdated(function() { registerObserver(); }); onUnmounted(function() { destroyObserver(); }); watch(function() { return props2.disabled; }, function() { registerObserver(); }, { flush: "post" }); return function() { var _a3; return (_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)[0]; }; } }); var tuple = function tuple2() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return args; }; var withInstall = function withInstall2(comp) { var c2 = comp; c2.install = function(app) { app.component(c2.displayName || c2.name, comp); }; return comp; }; var supportsPassive = false; try { var opts = Object.defineProperty({}, "passive", { get: function get2() { supportsPassive = true; } }); window.addEventListener("testPassive", null, opts); window.removeEventListener("testPassive", null, opts); } catch (e2) { } var supportsPassive$1 = supportsPassive; function addEventListenerWrap(target, eventType, cb, option) { if (target.addEventListener) { var opt = option; if (opt === void 0 && supportsPassive$1 && (eventType === "touchstart" || eventType === "touchmove" || eventType === "wheel")) { opt = { passive: false }; } target.addEventListener(eventType, cb, opt); } return { remove: function remove3() { if (target.removeEventListener) { target.removeEventListener(eventType, cb); } } }; } var enUS$2 = { items_per_page: "/ page", jump_to: "Go to", jump_to_confirm: "confirm", page: "", prev_page: "Previous Page", next_page: "Next Page", prev_5: "Previous 5 Pages", next_5: "Next 5 Pages", prev_3: "Previous 3 Pages", next_3: "Next 3 Pages" }; var enUs = { today: "Today", now: "Now", backToToday: "Back to today", ok: "Ok", clear: "Clear", month: "Month", year: "Year", timeSelect: "select time", dateSelect: "select date", weekSelect: "Choose a week", monthSelect: "Choose a month", yearSelect: "Choose a year", decadeSelect: "Choose a decade", yearFormat: "YYYY", dateFormat: "M/D/YYYY", dayFormat: "D", dateTimeFormat: "M/D/YYYY HH:mm:ss", monthBeforeYear: true, previousMonth: "Previous month (PageUp)", nextMonth: "Next month (PageDown)", previousYear: "Last year (Control + left)", nextYear: "Next year (Control + right)", previousDecade: "Last decade", nextDecade: "Next decade", previousCentury: "Last century", nextCentury: "Next century" }; var locale$1 = { placeholder: "Select time" }; var enUS$1 = locale$1; var locale = { lang: _extends$1({ placeholder: "Select date", rangePlaceholder: ["Start date", "End date"] }, enUs), timePickerLocale: _extends$1({}, enUS$1) }; var enUS = locale; var typeTemplate$1 = "${label} is not a valid ${type}"; var defaultLocale = { locale: "en", Pagination: enUS$2, DatePicker: enUS, TimePicker: enUS$1, Calendar: enUS, global: { placeholder: "Please select" }, Table: { filterTitle: "Filter menu", filterConfirm: "OK", filterReset: "Reset", filterEmptyText: "No filters", emptyText: "No data", selectAll: "Select current page", selectInvert: "Invert current page", selectNone: "Clear all data", selectionAll: "Select all data", sortTitle: "Sort", expand: "Expand row", collapse: "Collapse row", triggerDesc: "Click to sort descending", triggerAsc: "Click to sort ascending", cancelSort: "Click to cancel sorting" }, Modal: { okText: "OK", cancelText: "Cancel", justOkText: "OK" }, Popconfirm: { okText: "OK", cancelText: "Cancel" }, Transfer: { titles: ["", ""], searchPlaceholder: "Search here", itemUnit: "item", itemsUnit: "items", remove: "Remove", selectCurrent: "Select current page", removeCurrent: "Remove current page", selectAll: "Select all data", removeAll: "Remove all data", selectInvert: "Invert current page" }, Upload: { uploading: "Uploading...", removeFile: "Remove file", uploadError: "Upload error", previewFile: "Preview file", downloadFile: "Download file" }, Empty: { description: "No Data" }, Icon: { icon: "icon" }, Text: { edit: "Edit", copy: "Copy", copied: "Copied", expand: "Expand" }, PageHeader: { back: "Back" }, Form: { optional: "(optional)", defaultValidateMessages: { default: "Field validation error for ${label}", required: "Please enter ${label}", enum: "${label} must be one of [${enum}]", whitespace: "${label} cannot be a blank character", date: { format: "${label} date format is invalid", parse: "${label} cannot be converted to a date", invalid: "${label} is an invalid date" }, types: { string: typeTemplate$1, method: typeTemplate$1, array: typeTemplate$1, object: typeTemplate$1, number: typeTemplate$1, date: typeTemplate$1, boolean: typeTemplate$1, integer: typeTemplate$1, float: typeTemplate$1, regexp: typeTemplate$1, email: typeTemplate$1, url: typeTemplate$1, hex: typeTemplate$1 }, string: { len: "${label} must be ${len} characters", min: "${label} must be at least ${min} characters", max: "${label} must be up to ${max} characters", range: "${label} must be between ${min}-${max} characters" }, number: { len: "${label} must be equal to ${len}", min: "${label} must be minimum ${min}", max: "${label} must be maximum ${max}", range: "${label} must be between ${min}-${max}" }, array: { len: "Must be ${len} ${label}", min: "At least ${min} ${label}", max: "At most ${max} ${label}", range: "The amount of ${label} must be between ${min}-${max}" }, pattern: { mismatch: "${label} does not match the pattern ${pattern}" } } }, Image: { preview: "Preview" } }; var LocaleReceiver = defineComponent({ name: "LocaleReceiver", props: { componentName: PropsTypes.string, defaultLocale: { type: [Object, Function] }, children: { type: Function } }, setup: function setup2(props2, _ref) { var slots = _ref.slots; var localeData2 = inject("localeData", {}); var locale2 = computed(function() { var _props$componentName = props2.componentName, componentName = _props$componentName === void 0 ? "global" : _props$componentName, defaultLocale$1 = props2.defaultLocale; var locale3 = defaultLocale$1 || defaultLocale[componentName || "global"]; var antLocale = localeData2.antLocale; var localeFromContext = componentName && antLocale ? antLocale[componentName] : {}; return _extends$1(_extends$1({}, typeof locale3 === "function" ? locale3() : locale3), localeFromContext || {}); }); var localeCode = computed(function() { var antLocale = localeData2.antLocale; var localeCode2 = antLocale && antLocale.locale; if (antLocale && antLocale.exist && !localeCode2) { return defaultLocale.locale; } return localeCode2; }); return function() { var children = props2.children || slots.default; var antLocale = localeData2.antLocale; return children === null || children === void 0 ? void 0 : children(locale2.value, localeCode.value, antLocale); }; } }); function useLocaleReceiver(componentName, defaultLocale$1) { var localeData2 = inject("localeData", {}); var componentLocale = computed(function() { var antLocale = localeData2.antLocale; var locale2 = defaultLocale$1 || defaultLocale[componentName || "global"]; var localeFromContext = componentName && antLocale ? antLocale[componentName] : {}; return _extends$1(_extends$1({}, typeof locale2 === "function" ? locale2() : locale2), localeFromContext || {}); }); return [componentLocale]; } var Empty$1 = function Empty2() { var _inject = inject("configProvider", defaultConfigProvider), getPrefixCls2 = _inject.getPrefixCls; var prefixCls2 = getPrefixCls2("empty-img-default"); return createVNode("svg", { "class": prefixCls2, "width": "184", "height": "152", "viewBox": "0 0 184 152" }, [createVNode("g", { "fill": "none", "fill-rule": "evenodd" }, [createVNode("g", { "transform": "translate(24 31.67)" }, [createVNode("ellipse", { "class": "".concat(prefixCls2, "-ellipse"), "cx": "67.797", "cy": "106.89", "rx": "67.797", "ry": "12.668" }, null), createVNode("path", { "class": "".concat(prefixCls2, "-path-1"), "d": "M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z" }, null), createVNode("path", { "class": "".concat(prefixCls2, "-path-2"), "d": "M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z", "transform": "translate(13.56)" }, null), createVNode("path", { "class": "".concat(prefixCls2, "-path-3"), "d": "M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z" }, null), createVNode("path", { "class": "".concat(prefixCls2, "-path-4"), "d": "M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z" }, null)]), createVNode("path", { "class": "".concat(prefixCls2, "-path-5"), "d": "M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z" }, null), createVNode("g", { "class": "".concat(prefixCls2, "-g"), "transform": "translate(149.65 15.383)" }, [createVNode("ellipse", { "cx": "20.654", "cy": "3.167", "rx": "2.849", "ry": "2.815" }, null), createVNode("path", { "d": "M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z" }, null)])])]); }; Empty$1.PRESENTED_IMAGE_DEFAULT = true; var DefaultEmptyImg = Empty$1; var Simple = function Simple2() { var _inject = inject("configProvider", defaultConfigProvider), getPrefixCls2 = _inject.getPrefixCls; var prefixCls2 = getPrefixCls2("empty-img-simple"); return createVNode("svg", { "class": prefixCls2, "width": "64", "height": "41", "viewBox": "0 0 64 41" }, [createVNode("g", { "transform": "translate(0 1)", "fill": "none", "fill-rule": "evenodd" }, [createVNode("ellipse", { "class": "".concat(prefixCls2, "-ellipse"), "fill": "#F5F5F5", "cx": "32", "cy": "33", "rx": "32", "ry": "7" }, null), createVNode("g", { "class": "".concat(prefixCls2, "-g"), "fill-rule": "nonzero", "stroke": "#D9D9D9" }, [createVNode("path", { "d": "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }, null), createVNode("path", { "d": "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", "fill": "#FAFAFA", "class": "".concat(prefixCls2, "-path") }, null)])])]); }; Simple.PRESENTED_IMAGE_SIMPLE = true; var SimpleEmptyImg = Simple; var __rest$J = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var defaultEmptyImg = createVNode(DefaultEmptyImg, null, null); var simpleEmptyImg = createVNode(SimpleEmptyImg, null, null); var Empty = function Empty3(props2, _ref) { var _ref$slots = _ref.slots, slots = _ref$slots === void 0 ? {} : _ref$slots, attrs = _ref.attrs; var _a3; var configProvider = inject("configProvider", defaultConfigProvider); var getPrefixCls2 = configProvider.getPrefixCls, direction = configProvider.direction; var _b2 = _extends$1(_extends$1({}, props2), attrs), customizePrefixCls = _b2.prefixCls, _b$image = _b2.image, image = _b$image === void 0 ? defaultEmptyImg : _b$image, _b$description = _b2.description, description = _b$description === void 0 ? ((_a3 = slots.description) === null || _a3 === void 0 ? void 0 : _a3.call(slots)) || void 0 : _b$description, imageStyle = _b2.imageStyle, _b$class = _b2.class, className = _b$class === void 0 ? "" : _b$class, restProps = __rest$J(_b2, ["prefixCls", "image", "description", "imageStyle", "class"]); return createVNode(LocaleReceiver, { "componentName": "Empty", "children": function children(locale2) { var _classNames; var prefixCls2 = getPrefixCls2("empty", customizePrefixCls); var des = typeof description !== "undefined" ? description : locale2.description; var alt = typeof des === "string" ? des : "empty"; var imageNode = null; if (typeof image === "string") { imageNode = createVNode("img", { "alt": alt, "src": image }, null); } else { imageNode = image; } return createVNode("div", _objectSpread2$2({ "class": classNames(prefixCls2, className, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-normal"), image === simpleEmptyImg), _defineProperty$12(_classNames, "".concat(prefixCls2, "-rtl"), direction === "rtl"), _classNames)) }, restProps), [createVNode("div", { "class": "".concat(prefixCls2, "-image"), "style": imageStyle }, [imageNode]), des && createVNode("p", { "class": "".concat(prefixCls2, "-description") }, [des]), slots.default && createVNode("div", { "class": "".concat(prefixCls2, "-footer") }, [filterEmpty(slots.default())])]); } }, null); }; Empty.displayName = "AEmpty"; Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg; Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg; Empty.inheritAttrs = false; Empty.props = { prefixCls: PropsTypes.string, image: PropsTypes.any, description: PropsTypes.any, imageStyle: PropsTypes.object }; var AEmpty = withInstall(Empty); var RenderEmpty = function RenderEmpty2(props2) { var configProvider = inject("configProvider", defaultConfigProvider); var renderHtml = function renderHtml2(componentName) { var getPrefixCls2 = configProvider.getPrefixCls; var prefix = getPrefixCls2("empty"); switch (componentName) { case "Table": case "List": return createVNode(AEmpty, { "image": AEmpty.PRESENTED_IMAGE_SIMPLE }, null); case "Select": case "TreeSelect": case "Cascader": case "Transfer": case "Mentions": return createVNode(AEmpty, { "image": AEmpty.PRESENTED_IMAGE_SIMPLE, "class": "".concat(prefix, "-small") }, null); default: return createVNode(AEmpty, null, null); } }; return renderHtml(props2.componentName); }; function renderEmpty(componentName) { return createVNode(RenderEmpty, { "componentName": componentName }, null); } function interopDefault(m2) { return m2.default || m2; } var runtimeLocale = _extends$1({}, defaultLocale.Modal); function changeConfirmLocale(newLocale) { if (newLocale) { runtimeLocale = _extends$1(_extends$1({}, runtimeLocale), newLocale); } else { runtimeLocale = _extends$1({}, defaultLocale.Modal); } } function getConfirmLocale() { return runtimeLocale; } var warned = {}; function warning$6(valid, message2) { } function note(valid, message2) { } function call(method3, valid, message2) { if (!valid && !warned[message2]) { method3(false, message2); warned[message2] = true; } } function warningOnce(valid, message2) { call(warning$6, valid, message2); } function noteOnce(valid, message2) { call(note, valid, message2); } var warning$5 = function(valid, component) { var message2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ""; warningOnce(valid, "[antdv: ".concat(component, "] ").concat(message2)); }; var ANT_MARK = "internalMark"; function setMomentLocale(locale2) { if (locale2 && locale2.locale) { interopDefault(hooks).locale(locale2.locale); } else { interopDefault(hooks).locale("en"); } } var LocaleProvider = defineComponent({ name: "ALocaleProvider", props: { locale: { type: Object }, ANT_MARK__: PropsTypes.string }, setup: function setup3(props2, _ref) { var slots = _ref.slots; warning$5(props2.ANT_MARK__ === ANT_MARK, "LocaleProvider", "`LocaleProvider` is deprecated. Please use `locale` with `ConfigProvider` instead"); var state = reactive({ antLocale: _extends$1(_extends$1({}, props2.locale), { exist: true }), ANT_MARK__: ANT_MARK }); provide("localeData", state); watch(function() { return props2.locale; }, function(val) { state.antLocale = _extends$1(_extends$1({}, val), { exist: true }); setMomentLocale(val); changeConfirmLocale(val && val.Modal); }, { immediate: true }); onUnmounted(function() { changeConfirmLocale(); }); return function() { var _a3; return (_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots); }; } }); LocaleProvider.install = function(app) { app.component(LocaleProvider.name, LocaleProvider); return app; }; var LocaleProvider$1 = withInstall(LocaleProvider); var configProviderProps = { getTargetContainer: { type: Function }, getPopupContainer: { type: Function }, prefixCls: String, getPrefixCls: { type: Function }, renderEmpty: { type: Function }, transformCellText: { type: Function }, csp: { type: Object }, autoInsertSpaceInButton: PropsTypes.looseBool, locale: { type: Object }, pageHeader: { type: Object }, componentSize: { type: String }, direction: { type: String }, space: { type: Object }, virtual: PropsTypes.looseBool, dropdownMatchSelectWidth: PropsTypes.looseBool, form: { type: Object } }; var ConfigProvider = defineComponent({ name: "AConfigProvider", props: configProviderProps, setup: function setup4(props2, _ref) { var slots = _ref.slots; var getPrefixCls2 = function getPrefixCls3(suffixCls, customizePrefixCls) { var _props$prefixCls = props2.prefixCls, prefixCls2 = _props$prefixCls === void 0 ? "ant" : _props$prefixCls; if (customizePrefixCls) return customizePrefixCls; return suffixCls ? "".concat(prefixCls2, "-").concat(suffixCls) : prefixCls2; }; var renderEmptyComponent = function renderEmptyComponent2(name) { var renderEmpty$1 = props2.renderEmpty || slots.renderEmpty || renderEmpty; return renderEmpty$1(name); }; var getPrefixClsWrapper = function getPrefixClsWrapper2(suffixCls, customizePrefixCls) { var prefixCls2 = props2.prefixCls; if (customizePrefixCls) return customizePrefixCls; var mergedPrefixCls = prefixCls2 || getPrefixCls2(""); return suffixCls ? "".concat(mergedPrefixCls, "-").concat(suffixCls) : mergedPrefixCls; }; var configProvider = reactive(_extends$1(_extends$1({}, props2), { getPrefixCls: getPrefixClsWrapper, renderEmpty: renderEmptyComponent })); Object.keys(props2).forEach(function(key2) { watch(function() { return props2[key2]; }, function() { configProvider[key2] = props2[key2]; }); }); provide("configProvider", configProvider); var renderProvider = function renderProvider2(legacyLocale) { var _a3; return createVNode(LocaleProvider$1, { "locale": props2.locale || legacyLocale, "ANT_MARK__": ANT_MARK }, { default: function _default8() { return [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)]; } }); }; return function() { return createVNode(LocaleReceiver, { "children": function children(_2, __, legacyLocale) { return renderProvider(legacyLocale); } }, null); }; } }); var defaultConfigProvider = reactive({ getPrefixCls: function getPrefixCls(suffixCls, customizePrefixCls) { if (customizePrefixCls) return customizePrefixCls; return suffixCls ? "ant-".concat(suffixCls) : "ant"; }, renderEmpty, direction: "ltr" }); withInstall(ConfigProvider); var useConfigInject = function(name, props2) { var configProvider = inject("configProvider", defaultConfigProvider); var prefixCls2 = computed(function() { return configProvider.getPrefixCls(name, props2.prefixCls); }); var direction = computed(function() { return configProvider.direction; }); var autoInsertSpaceInButton = computed(function() { return configProvider.autoInsertSpaceInButton; }); var renderEmpty2 = computed(function() { return configProvider.renderEmpty; }); var space = computed(function() { return configProvider.space; }); var pageHeader = computed(function() { return configProvider.pageHeader; }); var form = computed(function() { return configProvider.form; }); var size = computed(function() { return props2.size || configProvider.componentSize; }); var getTargetContainer = computed(function() { return props2.getTargetContainer; }); return { configProvider, prefixCls: prefixCls2, direction, size, getTargetContainer, space, pageHeader, form, autoInsertSpaceInButton, renderEmpty: renderEmpty2 }; }; var id = 0; var ids = {}; function wrapperRaf(callback2) { var delayFrames = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1; var myId = id++; var restFrames = delayFrames; function internalCallback() { restFrames -= 1; if (restFrames <= 0) { callback2(); delete ids[myId]; } else { ids[myId] = requestAnimationFrame(internalCallback); } } ids[myId] = requestAnimationFrame(internalCallback); return myId; } wrapperRaf.cancel = function cancel(pid) { if (pid === void 0) return; cancelAnimationFrame(ids[pid]); delete ids[pid]; }; wrapperRaf.ids = ids; function isWindow$2(obj) { return obj !== null && obj !== void 0 && obj === obj.window; } function getScroll$4(target, top) { var _a3; if (typeof window === "undefined") { return 0; } var method3 = top ? "scrollTop" : "scrollLeft"; var result = 0; if (isWindow$2(target)) { result = target[top ? "pageYOffset" : "pageXOffset"]; } else if (target instanceof Document) { result = target.documentElement[method3]; } else if (target) { result = target[method3]; } if (target && !isWindow$2(target) && typeof result !== "number") { result = (_a3 = (target.ownerDocument || target).documentElement) === null || _a3 === void 0 ? void 0 : _a3[method3]; } return result; } function easeInOutCubic(t2, b2, c2, d2) { var cc = c2 - b2; t2 /= d2 / 2; if (t2 < 1) { return cc / 2 * t2 * t2 * t2 + b2; } return cc / 2 * ((t2 -= 2) * t2 * t2 + 2) + b2; } function scrollTo$1(y2) { var options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var _options$getContainer = options2.getContainer, getContainer5 = _options$getContainer === void 0 ? function() { return window; } : _options$getContainer, callback2 = options2.callback, _options$duration = options2.duration, duration2 = _options$duration === void 0 ? 450 : _options$duration; var container = getContainer5(); var scrollTop2 = getScroll$4(container, true); var startTime = Date.now(); var frameFunc = function frameFunc2() { var timestamp = Date.now(); var time = timestamp - startTime; var nextScrollTop = easeInOutCubic(time > duration2 ? duration2 : time, scrollTop2, y2, duration2); if (isWindow$2(container)) { container.scrollTo(window.pageXOffset, nextScrollTop); } else if (container instanceof HTMLDocument || container.constructor.name === "HTMLDocument") { container.documentElement.scrollTop = nextScrollTop; } else { container.scrollTop = nextScrollTop; } if (time < duration2) { wrapperRaf(frameFunc2); } else if (typeof callback2 === "function") { callback2(); } }; wrapperRaf(frameFunc); } var TransBtn = function TransBtn2(props2, _ref) { var slots = _ref.slots; var _a3; var className = props2.class, customizeIcon = props2.customizeIcon, customizeIconProps = props2.customizeIconProps, _onMousedown = props2.onMousedown, onClick7 = props2.onClick; var icon; if (typeof customizeIcon === "function") { icon = customizeIcon(customizeIconProps); } else { icon = customizeIcon; } return createVNode("span", { "class": className, "onMousedown": function onMousedown2(event) { event.preventDefault(); if (_onMousedown) { _onMousedown(event); } }, "style": { userSelect: "none", WebkitUserSelect: "none" }, "unselectable": "on", "onClick": onClick7, "aria-hidden": true }, [icon !== void 0 ? icon : createVNode("span", { "class": className.split(/\s+/).map(function(cls) { return "".concat(cls, "-icon"); }) }, [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)])]); }; TransBtn.inheritAttrs = false; TransBtn.displayName = "TransBtn"; TransBtn.props = { class: PropsTypes.string, customizeIcon: PropsTypes.any, customizeIconProps: PropsTypes.any, onMousedown: PropsTypes.func, onClick: PropsTypes.func }; var TransBtn$1 = TransBtn; var KeyCode = { MAC_ENTER: 3, BACKSPACE: 8, TAB: 9, NUM_CENTER: 12, ENTER: 13, SHIFT: 16, CTRL: 17, ALT: 18, PAUSE: 19, CAPS_LOCK: 20, ESC: 27, SPACE: 32, PAGE_UP: 33, PAGE_DOWN: 34, END: 35, HOME: 36, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, PRINT_SCREEN: 44, INSERT: 45, DELETE: 46, ZERO: 48, ONE: 49, TWO: 50, THREE: 51, FOUR: 52, FIVE: 53, SIX: 54, SEVEN: 55, EIGHT: 56, NINE: 57, QUESTION_MARK: 63, A: 65, B: 66, C: 67, D: 68, E: 69, F: 70, G: 71, H: 72, I: 73, J: 74, K: 75, L: 76, M: 77, N: 78, O: 79, P: 80, Q: 81, R: 82, S: 83, T: 84, U: 85, V: 86, W: 87, X: 88, Y: 89, Z: 90, META: 91, WIN_KEY_RIGHT: 92, CONTEXT_MENU: 93, NUM_ZERO: 96, NUM_ONE: 97, NUM_TWO: 98, NUM_THREE: 99, NUM_FOUR: 100, NUM_FIVE: 101, NUM_SIX: 102, NUM_SEVEN: 103, NUM_EIGHT: 104, NUM_NINE: 105, NUM_MULTIPLY: 106, NUM_PLUS: 107, NUM_MINUS: 109, NUM_PERIOD: 110, NUM_DIVISION: 111, F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123, NUMLOCK: 144, SEMICOLON: 186, DASH: 189, EQUALS: 187, COMMA: 188, PERIOD: 190, SLASH: 191, APOSTROPHE: 192, SINGLE_QUOTE: 222, OPEN_SQUARE_BRACKET: 219, BACKSLASH: 220, CLOSE_SQUARE_BRACKET: 221, WIN_KEY: 224, MAC_FF_META: 224, WIN_IME: 229, isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e2) { var keyCode = e2.keyCode; if (e2.altKey && !e2.ctrlKey || e2.metaKey || keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) { return false; } switch (keyCode) { case KeyCode.ALT: case KeyCode.CAPS_LOCK: case KeyCode.CONTEXT_MENU: case KeyCode.CTRL: case KeyCode.DOWN: case KeyCode.END: case KeyCode.ESC: case KeyCode.HOME: case KeyCode.INSERT: case KeyCode.LEFT: case KeyCode.MAC_FF_META: case KeyCode.META: case KeyCode.NUMLOCK: case KeyCode.NUM_CENTER: case KeyCode.PAGE_DOWN: case KeyCode.PAGE_UP: case KeyCode.PAUSE: case KeyCode.PRINT_SCREEN: case KeyCode.RIGHT: case KeyCode.SHIFT: case KeyCode.UP: case KeyCode.WIN_KEY: case KeyCode.WIN_KEY_RIGHT: return false; default: return true; } }, isCharacterKey: function isCharacterKey(keyCode) { if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) { return true; } if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) { return true; } if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) { return true; } if (window.navigator.userAgent.indexOf("WebKit") !== -1 && keyCode === 0) { return true; } switch (keyCode) { case KeyCode.SPACE: case KeyCode.QUESTION_MARK: case KeyCode.NUM_PLUS: case KeyCode.NUM_MINUS: case KeyCode.NUM_PERIOD: case KeyCode.NUM_DIVISION: case KeyCode.SEMICOLON: case KeyCode.DASH: case KeyCode.EQUALS: case KeyCode.COMMA: case KeyCode.PERIOD: case KeyCode.SLASH: case KeyCode.APOSTROPHE: case KeyCode.SINGLE_QUOTE: case KeyCode.OPEN_SQUARE_BRACKET: case KeyCode.BACKSLASH: case KeyCode.CLOSE_SQUARE_BRACKET: return true; default: return false; } } }; var KeyCode$1 = KeyCode; var attributes = "accept acceptcharset accesskey action allowfullscreen allowtransparency\nalt async autocomplete autofocus autoplay capture cellpadding cellspacing challenge\ncharset checked classid classname colspan cols content contenteditable contextmenu\ncontrols coords crossorigin data datetime default defer dir disabled download draggable\nenctype form formaction formenctype formmethod formnovalidate formtarget frameborder\nheaders height hidden high href hreflang htmlfor httpequiv icon id inputmode integrity\nis keyparams keytype kind label lang list loop low manifest marginheight marginwidth max maxlength media\nmediagroup method min minlength multiple muted name novalidate nonce open\noptimum pattern placeholder poster preload radiogroup readonly rel required\nreversed role rowspan rows sandbox scope scoped scrolling seamless selected\nshape size sizes span spellcheck src srcdoc srclang srcset start step style\nsummary tabindex target title type usemap value width wmode wrap"; var eventsName = "onCopy onCut onPaste onCompositionend onCompositionstart onCompositionupdate onKeydown\n onKeypress onKeyup onFocus onBlur onChange onInput onSubmit onClick onContextmenu onDoubleclick onDblclick\n onDrag onDragend onDragenter onDragexit onDragleave onDragover onDragstart onDrop onMousedown\n onMouseenter onMouseleave onMousemove onMouseout onMouseover onMouseup onSelect onTouchcancel\n onTouchend onTouchmove onTouchstart onTouchstartPassive onTouchmovePassive onScroll onWheel onAbort onCanplay onCanplaythrough\n onDurationchange onEmptied onEncrypted onEnded onError onLoadeddata onLoadedmetadata\n onLoadstart onPause onPlay onPlaying onProgress onRatechange onSeeked onSeeking onStalled onSuspend onTimeupdate onVolumechange onWaiting onLoad onError"; var propList = "".concat(attributes, " ").concat(eventsName).split(/[\s\n]+/); var ariaPrefix = "aria-"; var dataPrefix = "data-"; function match$1(key2, prefix) { return key2.indexOf(prefix) === 0; } function pickAttrs(props2) { var ariaOnly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; var mergedConfig; if (ariaOnly === false) { mergedConfig = { aria: true, data: true, attr: true }; } else if (ariaOnly === true) { mergedConfig = { aria: true }; } else { mergedConfig = _extends$1({}, ariaOnly); } var attrs = {}; Object.keys(props2).forEach(function(key2) { if (mergedConfig.aria && (key2 === "role" || match$1(key2, ariaPrefix)) || mergedConfig.data && match$1(key2, dataPrefix) || mergedConfig.attr && (propList.includes(key2) || propList.includes(key2.toLowerCase()))) { attrs[key2] = props2[key2]; } }); return attrs; } function createRef$1() { var func = function func2(node) { func2.current = node; }; return func; } var Filter = function Filter2(_ref, _ref2) { var height = _ref.height, offset4 = _ref.offset, prefixCls2 = _ref.prefixCls, onInnerResize = _ref.onInnerResize; var slots = _ref2.slots; var _a3; var outerStyle = {}; var innerStyle = { display: "flex", flexDirection: "column" }; if (offset4 !== void 0) { outerStyle = { height: "".concat(height, "px"), position: "relative", overflow: "hidden" }; innerStyle = _extends$1(_extends$1({}, innerStyle), { transform: "translateY(".concat(offset4, "px)"), position: "absolute", left: 0, right: 0, top: 0 }); } return createVNode("div", { "style": outerStyle }, [createVNode(ResizeObserver, { "onResize": function onResize(_ref3) { var offsetHeight = _ref3.offsetHeight; if (offsetHeight && onInnerResize) { onInnerResize(); } } }, { default: function _default8() { return [createVNode("div", { "style": innerStyle, "class": classNames(_defineProperty$12({}, "".concat(prefixCls2, "-holder-inner"), prefixCls2)) }, [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)])]; } })]); }; Filter.displayName = "Filter"; Filter.inheritAttrs = false; Filter.props = { prefixCls: String, height: Number, offset: Number, onInnerResize: Function }; var Filler = Filter; var Item$1 = function Item2(_ref, _ref2) { var setRef = _ref.setRef; var slots = _ref2.slots; var _a3; var children = (_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots); return children && children.length ? cloneVNode(children[0], { ref: setRef }) : children; }; Item$1.props = { setRef: { type: Function, default: function _default() { } } }; var Item$2 = Item$1; var MIN_SIZE = 20; function getPageY(e2) { return "touches" in e2 ? e2.touches[0].pageY : e2.pageY; } var ScrollBar = defineComponent({ name: "ScrollBar", inheritAttrs: false, props: { prefixCls: PropsTypes.string, scrollTop: PropsTypes.number, scrollHeight: PropsTypes.number, height: PropsTypes.number, count: PropsTypes.number, onScroll: { type: Function }, onStartMove: { type: Function }, onStopMove: { type: Function } }, setup: function setup5() { return { moveRaf: null, scrollbarRef: createRef$1(), thumbRef: createRef$1(), visibleTimeout: null, state: reactive({ dragging: false, pageY: null, startTop: null, visible: false }) }; }, watch: { scrollTop: { handler: function handler() { this.delayHidden(); }, flush: "post" } }, mounted: function mounted() { this.scrollbarRef.current.addEventListener("touchstart", this.onScrollbarTouchStart, supportsPassive$1 ? { passive: false } : false); this.thumbRef.current.addEventListener("touchstart", this.onMouseDown, supportsPassive$1 ? { passive: false } : false); }, beforeUnmount: function beforeUnmount() { this.removeEvents(); clearTimeout(this.visibleTimeout); }, methods: { delayHidden: function delayHidden() { var _this = this; clearTimeout(this.visibleTimeout); this.state.visible = true; this.visibleTimeout = setTimeout(function() { _this.state.visible = false; }, 2e3); }, onScrollbarTouchStart: function onScrollbarTouchStart(e2) { e2.preventDefault(); }, onContainerMouseDown: function onContainerMouseDown(e2) { e2.stopPropagation(); e2.preventDefault(); }, patchEvents: function patchEvents() { window.addEventListener("mousemove", this.onMouseMove); window.addEventListener("mouseup", this.onMouseUp); this.thumbRef.current.addEventListener("touchmove", this.onMouseMove, supportsPassive$1 ? { passive: false } : false); this.thumbRef.current.addEventListener("touchend", this.onMouseUp); }, removeEvents: function removeEvents() { window.removeEventListener("mousemove", this.onMouseMove); window.removeEventListener("mouseup", this.onMouseUp); this.scrollbarRef.current.removeEventListener("touchstart", this.onScrollbarTouchStart, supportsPassive$1 ? { passive: false } : false); this.thumbRef.current.removeEventListener("touchstart", this.onMouseDown, supportsPassive$1 ? { passive: false } : false); this.thumbRef.current.removeEventListener("touchmove", this.onMouseMove, supportsPassive$1 ? { passive: false } : false); this.thumbRef.current.removeEventListener("touchend", this.onMouseUp); wrapperRaf.cancel(this.moveRaf); }, onMouseDown: function onMouseDown(e2) { var onStartMove = this.$props.onStartMove; _extends$1(this.state, { dragging: true, pageY: getPageY(e2), startTop: this.getTop() }); onStartMove(); this.patchEvents(); e2.stopPropagation(); e2.preventDefault(); }, onMouseMove: function onMouseMove(e2) { var _this$state = this.state, dragging = _this$state.dragging, pageY = _this$state.pageY, startTop = _this$state.startTop; var onScroll = this.$props.onScroll; wrapperRaf.cancel(this.moveRaf); if (dragging) { var offsetY = getPageY(e2) - pageY; var newTop = startTop + offsetY; var enableScrollRange = this.getEnableScrollRange(); var enableHeightRange = this.getEnableHeightRange(); var ptg = enableHeightRange ? newTop / enableHeightRange : 0; var newScrollTop = Math.ceil(ptg * enableScrollRange); this.moveRaf = wrapperRaf(function() { onScroll(newScrollTop); }); } }, onMouseUp: function onMouseUp() { var onStopMove = this.$props.onStopMove; this.state.dragging = false; onStopMove(); this.removeEvents(); }, getSpinHeight: function getSpinHeight() { var _this$$props = this.$props, height = _this$$props.height, count2 = _this$$props.count; var baseHeight = height / count2 * 10; baseHeight = Math.max(baseHeight, MIN_SIZE); baseHeight = Math.min(baseHeight, height / 2); return Math.floor(baseHeight); }, getEnableScrollRange: function getEnableScrollRange() { var _this$$props2 = this.$props, scrollHeight = _this$$props2.scrollHeight, height = _this$$props2.height; return scrollHeight - height || 0; }, getEnableHeightRange: function getEnableHeightRange() { var height = this.$props.height; var spinHeight = this.getSpinHeight(); return height - spinHeight || 0; }, getTop: function getTop() { var scrollTop2 = this.$props.scrollTop; var enableScrollRange = this.getEnableScrollRange(); var enableHeightRange = this.getEnableHeightRange(); if (scrollTop2 === 0 || enableScrollRange === 0) { return 0; } var ptg = scrollTop2 / enableScrollRange; return ptg * enableHeightRange; }, showScroll: function showScroll() { var _this$$props3 = this.$props, height = _this$$props3.height, scrollHeight = _this$$props3.scrollHeight; return scrollHeight > height; } }, render: function render2() { var _this$state2 = this.state, dragging = _this$state2.dragging, visible9 = _this$state2.visible; var prefixCls2 = this.$props.prefixCls; var spinHeight = this.getSpinHeight() + "px"; var top = this.getTop() + "px"; var canScroll = this.showScroll(); var mergedVisible = canScroll && visible9; return createVNode("div", { "ref": this.scrollbarRef, "class": classNames("".concat(prefixCls2, "-scrollbar"), _defineProperty$12({}, "".concat(prefixCls2, "-scrollbar-show"), canScroll)), "style": { width: "8px", top: 0, bottom: 0, right: 0, position: "absolute", display: mergedVisible ? void 0 : "none" }, "onMousedown": this.onContainerMouseDown, "onMousemove": this.delayHidden }, [createVNode("div", { "ref": this.thumbRef, "class": classNames("".concat(prefixCls2, "-scrollbar-thumb"), _defineProperty$12({}, "".concat(prefixCls2, "-scrollbar-thumb-moving"), dragging)), "style": { width: "100%", height: spinHeight, top, left: 0, position: "absolute", background: "rgba(0, 0, 0, 0.5)", borderRadius: "99px", cursor: "pointer", userSelect: "none" }, "onMousedown": this.onMouseDown }, null)]); } }); function useHeights(getKey3, onItemAdd, onItemRemove) { var instance = /* @__PURE__ */ new Map(); var heights = reactive({}); var heightUpdateId = 0; function collectHeight() { heightUpdateId += 1; var currentId = heightUpdateId; Promise.resolve().then(function() { if (currentId !== heightUpdateId) return; instance.forEach(function(element, key2) { if (element && element.offsetParent) { var offsetHeight = element.offsetHeight; if (heights[key2] !== offsetHeight) { heights[key2] = element.offsetHeight; } } }); }); } function setInstance(item, ins) { var key2 = getKey3(item); var origin = instance.get(key2); if (ins) { instance.set(key2, ins); collectHeight(); } else { instance.delete(key2); } if (!origin !== !ins) { if (ins) { onItemAdd === null || onItemAdd === void 0 ? void 0 : onItemAdd(item); } else { onItemRemove === null || onItemRemove === void 0 ? void 0 : onItemRemove(item); } } } return [setInstance, collectHeight, heights]; } function useScrollTo$1(containerRef, mergedData, heights, props2, getKey3, collectHeight, syncScrollTop, triggerFlash) { var scroll = null; return function(arg) { if (arg === null || arg === void 0) { triggerFlash(); return; } wrapperRaf.cancel(scroll); var data65 = mergedData.value; var itemHeight = props2.itemHeight; if (typeof arg === "number") { syncScrollTop(arg); } else if (arg && _typeof$2(arg) === "object") { var index2; var align = arg.align; if ("index" in arg) { index2 = arg.index; } else { index2 = data65.findIndex(function(item) { return getKey3(item) === arg.key; }); } var _arg$offset = arg.offset, offset4 = _arg$offset === void 0 ? 0 : _arg$offset; var syncScroll = function syncScroll2(times, targetAlign) { if (times < 0 || !containerRef.value) return; var height = containerRef.value.clientHeight; var needCollectHeight = false; var newTargetAlign = targetAlign; if (height) { var mergedAlign = targetAlign || align; var stackTop = 0; var itemTop = 0; var itemBottom = 0; var maxLen = Math.min(data65.length, index2); for (var i2 = 0; i2 <= maxLen; i2 += 1) { var key2 = getKey3(data65[i2]); itemTop = stackTop; var cacheHeight = heights[key2]; itemBottom = itemTop + (cacheHeight === void 0 ? itemHeight : cacheHeight); stackTop = itemBottom; if (i2 === index2 && cacheHeight === void 0) { needCollectHeight = true; } } var targetTop = null; switch (mergedAlign) { case "top": targetTop = itemTop - offset4; break; case "bottom": targetTop = itemBottom - height + offset4; break; default: { var scrollTop2 = containerRef.value.scrollTop; var scrollBottom = scrollTop2 + height; if (itemTop < scrollTop2) { newTargetAlign = "top"; } else if (itemBottom > scrollBottom) { newTargetAlign = "bottom"; } } } if (targetTop !== null && targetTop !== containerRef.value.scrollTop) { syncScrollTop(targetTop); } } scroll = wrapperRaf(function() { if (needCollectHeight) { collectHeight(); } syncScroll2(times - 1, newTargetAlign); }); }; syncScroll(3); } }; } var isFF = (typeof navigator === "undefined" ? "undefined" : _typeof$2(navigator)) === "object" && /Firefox/i.test(navigator.userAgent); var isFF$1 = isFF; var useOriginScroll = function(isScrollAtTop, isScrollAtBottom) { var lock = false; var lockTimeout = null; function lockScroll() { clearTimeout(lockTimeout); lock = true; lockTimeout = setTimeout(function() { lock = false; }, 50); } return function(deltaY) { var smoothOffset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; var originScroll = deltaY < 0 && isScrollAtTop.value || deltaY > 0 && isScrollAtBottom.value; if (smoothOffset && originScroll) { clearTimeout(lockTimeout); lock = false; } else if (!originScroll || lock) { lockScroll(); } return !lock && originScroll; }; }; function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, onWheelDelta) { var offsetRef = 0; var nextFrame = null; var wheelValue = null; var isMouseScroll = false; var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom); function onWheel(event) { if (!inVirtual.value) return; wrapperRaf.cancel(nextFrame); var deltaY = event.deltaY; offsetRef += deltaY; wheelValue = deltaY; if (originScroll(deltaY)) return; if (!isFF$1) { event.preventDefault(); } nextFrame = wrapperRaf(function() { var patchMultiple = isMouseScroll ? 10 : 1; onWheelDelta(offsetRef * patchMultiple); offsetRef = 0; }); } function onFireFoxScroll(event) { if (!inVirtual.value) return; isMouseScroll = event.detail === wheelValue; } return [onWheel, onFireFoxScroll]; } var SMOOTH_PTG = 14 / 15; function useMobileTouchMove(inVirtual, listRef, callback2) { var touched = false; var touchY = 0; var element = null; var interval = null; var cleanUpEvents = function cleanUpEvents2() { if (element) { element.removeEventListener("touchmove", onTouchMove2, supportsPassive$1 ? { passive: false } : false); element.removeEventListener("touchend", onTouchEnd3); } }; var onTouchMove2 = function onTouchMove3(e2) { if (touched) { var currentY = Math.ceil(e2.touches[0].pageY); var offsetY = touchY - currentY; touchY = currentY; if (callback2(offsetY)) { e2.preventDefault(); } clearInterval(interval); interval = setInterval(function() { offsetY *= SMOOTH_PTG; if (!callback2(offsetY, true) || Math.abs(offsetY) <= 0.1) { clearInterval(interval); } }, 16); } }; var onTouchEnd3 = function onTouchEnd4() { touched = false; cleanUpEvents(); }; var onTouchStart2 = function onTouchStart3(e2) { cleanUpEvents(); if (e2.touches.length === 1 && !touched) { touched = true; touchY = Math.ceil(e2.touches[0].pageY); element = e2.target; element.addEventListener("touchmove", onTouchMove2, supportsPassive$1 ? { passive: false } : false); element.addEventListener("touchend", onTouchEnd3); } }; onMounted(function() { watch(inVirtual, function(val) { listRef.value.removeEventListener("touchstart", onTouchStart2, supportsPassive$1 ? { passive: false } : false); cleanUpEvents(); clearInterval(interval); if (val) { listRef.value.addEventListener("touchstart", onTouchStart2, supportsPassive$1 ? { passive: false } : false); } }, { immediate: true }); }); } var __rest$I = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var EMPTY_DATA = []; var ScrollStyle = { overflowY: "auto", overflowAnchor: "none" }; function renderChildren(list, startIndex, endIndex, setNodeRef, renderFunc, _ref) { var getKey3 = _ref.getKey; return list.slice(startIndex, endIndex + 1).map(function(item, index2) { var eleIndex = startIndex + index2; var node = renderFunc(item, eleIndex, {}); var key2 = getKey3(item); return createVNode(Item$2, { "key": key2, "setRef": function setRef(ele) { return setNodeRef(item, ele); } }, { default: function _default8() { return [node]; } }); }); } var List = defineComponent({ name: "List", inheritAttrs: false, props: { prefixCls: PropsTypes.string, data: PropsTypes.array, height: PropsTypes.number, itemHeight: PropsTypes.number, fullHeight: PropsTypes.looseBool, itemKey: { type: [String, Number, Function], required: true }, component: { type: [String, Object] }, virtual: PropsTypes.looseBool, children: PropsTypes.func, onScroll: PropsTypes.func, onMousedown: PropsTypes.func, onMouseenter: PropsTypes.func }, setup: function setup6(props2) { var useVirtual = computed(function() { var height = props2.height, itemHeight = props2.itemHeight, virtual = props2.virtual; return !!(virtual !== false && height && itemHeight); }); var inVirtual = computed(function() { var height = props2.height, itemHeight = props2.itemHeight, data65 = props2.data; return useVirtual.value && data65 && itemHeight * data65.length > height; }); var state = reactive({ scrollTop: 0, scrollMoving: false }); var mergedData = computed(function() { return props2.data || EMPTY_DATA; }); var componentRef = ref(); var fillerInnerRef = ref(); var scrollBarRef = ref(); var getKey3 = function getKey4(item) { if (typeof props2.itemKey === "function") { return props2.itemKey(item); } return item === null || item === void 0 ? void 0 : item[props2.itemKey]; }; var sharedConfig = { getKey: getKey3 }; function syncScrollTop(newTop) { var value24; if (typeof newTop === "function") { value24 = newTop(state.scrollTop); } else { value24 = newTop; } var alignedTop = keepInRange(value24); if (componentRef.value) { componentRef.value.scrollTop = alignedTop; } state.scrollTop = alignedTop; } var _useHeights = useHeights(getKey3, null, null), _useHeights2 = _slicedToArray$4(_useHeights, 3), setInstance = _useHeights2[0], collectHeight = _useHeights2[1], heights = _useHeights2[2]; var calRes = ref({}); watch([inVirtual, useVirtual, function() { return state.scrollTop; }, mergedData, heights, function() { return props2.height; }], function() { nextTick(function() { var _a3; if (!useVirtual.value) { calRes.value = { scrollHeight: void 0, start: 0, end: mergedData.value.length - 1, offset: void 0 }; return; } if (!inVirtual.value) { calRes.value = { scrollHeight: ((_a3 = fillerInnerRef.value) === null || _a3 === void 0 ? void 0 : _a3.offsetHeight) || 0, start: 0, end: mergedData.value.length - 1, offset: void 0 }; return; } var itemTop = 0; var startIndex; var startOffset; var endIndex; var dataLen3 = mergedData.value.length; var data65 = mergedData.value; for (var i2 = 0; i2 < dataLen3; i2 += 1) { var item = data65[i2]; var key2 = getKey3(item); var cacheHeight = heights[key2]; var currentItemBottom = itemTop + (cacheHeight === void 0 ? props2.itemHeight : cacheHeight); if (currentItemBottom >= state.scrollTop && startIndex === void 0) { startIndex = i2; startOffset = itemTop; } if (currentItemBottom > state.scrollTop + props2.height && endIndex === void 0) { endIndex = i2; } itemTop = currentItemBottom; } if (startIndex === void 0) { startIndex = 0; startOffset = 0; } if (endIndex === void 0) { endIndex = dataLen3 - 1; } endIndex = Math.min(endIndex + 1, dataLen3); calRes.value = { scrollHeight: itemTop, start: startIndex, end: endIndex, offset: startOffset }; }); }, { immediate: true, flush: "post" }); var maxScrollHeight = computed(function() { return calRes.value.scrollHeight - props2.height; }); function keepInRange(newScrollTop) { var newTop = newScrollTop; if (!Number.isNaN(maxScrollHeight.value)) { newTop = Math.min(newTop, maxScrollHeight.value); } newTop = Math.max(newTop, 0); return newTop; } var isScrollAtTop = computed(function() { return state.scrollTop <= 0; }); var isScrollAtBottom = computed(function() { return state.scrollTop >= maxScrollHeight.value; }); var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom); function onScrollBar(newScrollTop) { var newTop = newScrollTop; syncScrollTop(newTop); } function onFallbackScroll(e2) { var _a3; var newScrollTop = e2.currentTarget.scrollTop; if (Math.abs(newScrollTop - state.scrollTop) >= 1) { syncScrollTop(newScrollTop); } (_a3 = props2.onScroll) === null || _a3 === void 0 ? void 0 : _a3.call(props2, e2); } var _useFrameWheel = useFrameWheel(useVirtual, isScrollAtTop, isScrollAtBottom, function(offsetY) { syncScrollTop(function(top) { var newTop = top + offsetY; return newTop; }); }), _useFrameWheel2 = _slicedToArray$4(_useFrameWheel, 2), onRawWheel = _useFrameWheel2[0], onFireFoxScroll = _useFrameWheel2[1]; useMobileTouchMove(useVirtual, componentRef, function(deltaY, smoothOffset) { if (originScroll(deltaY, smoothOffset)) { return false; } onRawWheel({ preventDefault: function preventDefault2() { }, deltaY }); return true; }); function onMozMousePixelScroll(e2) { if (useVirtual.value) { e2.preventDefault(); } } var removeEventListener2 = function removeEventListener3() { if (componentRef.value) { componentRef.value.removeEventListener("wheel", onRawWheel, supportsPassive$1 ? { passive: false } : false); componentRef.value.removeEventListener("DOMMouseScroll", onFireFoxScroll); componentRef.value.removeEventListener("MozMousePixelScroll", onMozMousePixelScroll); } }; watchEffect(function() { nextTick(function() { if (componentRef.value) { removeEventListener2(); componentRef.value.addEventListener("wheel", onRawWheel, supportsPassive$1 ? { passive: false } : false); componentRef.value.addEventListener("DOMMouseScroll", onFireFoxScroll); componentRef.value.addEventListener("MozMousePixelScroll", onMozMousePixelScroll); } }); }); onBeforeUnmount(function() { removeEventListener2(); }); var scrollTo3 = useScrollTo$1(componentRef, mergedData, heights, props2, getKey3, collectHeight, syncScrollTop, function() { var _a3; (_a3 = scrollBarRef.value) === null || _a3 === void 0 ? void 0 : _a3.delayHidden(); }); var componentStyle = computed(function() { var cs = null; if (props2.height) { cs = _extends$1(_defineProperty$12({}, props2.fullHeight ? "height" : "maxHeight", props2.height + "px"), ScrollStyle); if (useVirtual.value) { cs.overflowY = "hidden"; if (state.scrollMoving) { cs.pointerEvents = "none"; } } } return cs; }); return { state, mergedData, componentStyle, scrollTo: scrollTo3, onFallbackScroll, onScrollBar, componentRef, useVirtual, calRes, collectHeight, setInstance, sharedConfig, scrollBarRef, fillerInnerRef }; }, render: function render3() { var _this = this; var _a3 = _extends$1(_extends$1({}, this.$props), this.$attrs), _a$prefixCls = _a3.prefixCls, prefixCls2 = _a$prefixCls === void 0 ? "rc-virtual-list" : _a$prefixCls, height = _a3.height; _a3.itemHeight; _a3.fullHeight; _a3.data; _a3.itemKey; _a3.virtual; var _a$component = _a3.component, Component = _a$component === void 0 ? "div" : _a$component; _a3.onScroll; var children = _a3.children, style = _a3.style, className = _a3.class, restProps = __rest$I(_a3, ["prefixCls", "height", "itemHeight", "fullHeight", "data", "itemKey", "virtual", "component", "onScroll", "children", "style", "class"]); var mergedClassName = classNames(prefixCls2, className); var scrollTop2 = this.state.scrollTop; var _this$calRes = this.calRes, scrollHeight = _this$calRes.scrollHeight, offset4 = _this$calRes.offset, start = _this$calRes.start, end = _this$calRes.end; var componentStyle = this.componentStyle, onFallbackScroll = this.onFallbackScroll, onScrollBar = this.onScrollBar, useVirtual = this.useVirtual, collectHeight = this.collectHeight, sharedConfig = this.sharedConfig, setInstance = this.setInstance, mergedData = this.mergedData; var listChildren = renderChildren(mergedData, start, end, setInstance, children, sharedConfig); return createVNode("div", _objectSpread2$2({ "style": _extends$1(_extends$1({}, style), { position: "relative" }), "class": mergedClassName }, restProps), [createVNode(Component, { "class": "".concat(prefixCls2, "-holder"), "style": componentStyle, "ref": "componentRef", "onScroll": onFallbackScroll }, { default: function _default8() { return [createVNode(Filler, { "prefixCls": prefixCls2, "height": scrollHeight, "offset": offset4, "onInnerResize": collectHeight, "ref": "fillerInnerRef" }, { default: function _default9() { return [listChildren]; } })]; } }), useVirtual && createVNode(ScrollBar, { "ref": "scrollBarRef", "prefixCls": prefixCls2, "scrollTop": scrollTop2, "height": height, "scrollHeight": scrollHeight, "count": mergedData.length, "onScroll": onScrollBar, "onStartMove": function onStartMove() { _this.state.scrollMoving = true; }, "onStopMove": function onStopMove() { _this.state.scrollMoving = false; } }, null)]); } }); var List$1 = List; function useMemo(getValue2, condition, shouldUpdate) { var cacheRef = ref(getValue2()); watch(condition, function(next2, pre) { if (shouldUpdate) { if (shouldUpdate(next2, pre)) { cacheRef.value = getValue2(); } } else { cacheRef.value = getValue2(); } }); return cacheRef; } var __rest$H = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var OptionListProps = { prefixCls: PropsTypes.string, id: PropsTypes.string, options: PropsTypes.array, flattenOptions: PropsTypes.array, height: PropsTypes.number, itemHeight: PropsTypes.number, values: PropsTypes.any, multiple: PropsTypes.looseBool, open: PropsTypes.looseBool, defaultActiveFirstOption: PropsTypes.looseBool, notFoundContent: PropsTypes.any, menuItemSelectedIcon: PropsTypes.any, childrenAsData: PropsTypes.looseBool, searchValue: PropsTypes.string, virtual: PropsTypes.looseBool, onSelect: PropsTypes.func, onToggleOpen: { type: Function }, onActiveValue: PropsTypes.func, onScroll: PropsTypes.func, onMouseenter: PropsTypes.func }; var OptionList = defineComponent({ name: "OptionList", inheritAttrs: false, slots: ["option"], setup: function setup7(props2) { var itemPrefixCls = computed(function() { return "".concat(props2.prefixCls, "-item"); }); var memoFlattenOptions = useMemo(function() { return props2.flattenOptions; }, [function() { return props2.open; }, function() { return props2.flattenOptions; }], function(next2) { return next2[0]; }); var listRef = createRef$1(); var onListMouseDown = function onListMouseDown2(event) { event.preventDefault(); }; var scrollIntoView2 = function scrollIntoView3(index2) { if (listRef.current) { listRef.current.scrollTo({ index: index2 }); } }; var getEnabledActiveIndex = function getEnabledActiveIndex2(index2) { var offset4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1; var len = memoFlattenOptions.value.length; for (var i2 = 0; i2 < len; i2 += 1) { var current2 = (index2 + i2 * offset4 + len) % len; var _memoFlattenOptions$v = memoFlattenOptions.value[current2], group = _memoFlattenOptions$v.group, data65 = _memoFlattenOptions$v.data; if (!group && !data65.disabled) { return current2; } } return -1; }; var state = reactive({ activeIndex: getEnabledActiveIndex(0) }); var setActive = function setActive2(index2) { var fromKeyboard = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; state.activeIndex = index2; var info3 = { source: fromKeyboard ? "keyboard" : "mouse" }; var flattenItem = memoFlattenOptions.value[index2]; if (!flattenItem) { props2.onActiveValue(null, -1, info3); return; } props2.onActiveValue(flattenItem.data.value, index2, info3); }; watch([function() { return memoFlattenOptions.value.length; }, function() { return props2.searchValue; }], function() { setActive(props2.defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1); }, { immediate: true }); watch(function() { return props2.open; }, function() { if (!props2.multiple && props2.open && props2.values.size === 1) { var value24 = Array.from(props2.values)[0]; var index2 = memoFlattenOptions.value.findIndex(function(_ref) { var data65 = _ref.data; return data65.value === value24; }); setActive(index2); nextTick(function() { scrollIntoView2(index2); }); } if (props2.open) { nextTick(function() { var _a3; (_a3 = listRef.current) === null || _a3 === void 0 ? void 0 : _a3.scrollTo(void 0); }); } }, { immediate: true, flush: "post" }); var onSelectValue = function onSelectValue2(value24) { if (value24 !== void 0) { props2.onSelect(value24, { selected: !props2.values.has(value24) }); } if (!props2.multiple) { props2.onToggleOpen(false); } }; function renderItem(index2) { var item = memoFlattenOptions.value[index2]; if (!item) return null; var itemData = item.data || {}; var value24 = itemData.value, label = itemData.label, children = itemData.children; var attrs = pickAttrs(itemData, true); var mergedLabel = props2.childrenAsData ? children : label; return item ? createVNode("div", _objectSpread2$2(_objectSpread2$2({ "aria-label": typeof mergedLabel === "string" ? mergedLabel : void 0 }, attrs), {}, { "key": index2, "role": "option", "id": "".concat(props2.id, "_list_").concat(index2), "aria-selected": props2.values.has(value24) }), [value24]) : null; } return { memoFlattenOptions, renderItem, listRef, state, onListMouseDown, itemPrefixCls, setActive, onSelectValue, onKeydown: function onKeydown2(event) { var which = event.which; switch (which) { case KeyCode$1.UP: case KeyCode$1.DOWN: { var offset4 = 0; if (which === KeyCode$1.UP) { offset4 = -1; } else if (which === KeyCode$1.DOWN) { offset4 = 1; } if (offset4 !== 0) { var nextActiveIndex = getEnabledActiveIndex(state.activeIndex + offset4, offset4); scrollIntoView2(nextActiveIndex); setActive(nextActiveIndex, true); } break; } case KeyCode$1.ENTER: { var item = memoFlattenOptions.value[state.activeIndex]; if (item && !item.data.disabled) { onSelectValue(item.data.value); } else { onSelectValue(void 0); } if (props2.open) { event.preventDefault(); } break; } case KeyCode$1.ESC: { props2.onToggleOpen(false); if (props2.open) { event.stopPropagation(); } } } }, onKeyup: function onKeyup() { }, scrollTo: function scrollTo3(index2) { scrollIntoView2(index2); } }; }, render: function render4() { var renderItem = this.renderItem, listRef = this.listRef, onListMouseDown = this.onListMouseDown, itemPrefixCls = this.itemPrefixCls, setActive = this.setActive, onSelectValue = this.onSelectValue, memoFlattenOptions = this.memoFlattenOptions, $slots = this.$slots; var _this$$props = this.$props, id2 = _this$$props.id, childrenAsData = _this$$props.childrenAsData, values2 = _this$$props.values, height = _this$$props.height, itemHeight = _this$$props.itemHeight, menuItemSelectedIcon = _this$$props.menuItemSelectedIcon, notFoundContent = _this$$props.notFoundContent, virtual = _this$$props.virtual, onScroll = _this$$props.onScroll, onMouseenter2 = _this$$props.onMouseenter; var renderOption = $slots.option; var activeIndex = this.state.activeIndex; if (memoFlattenOptions.length === 0) { return createVNode("div", { "role": "listbox", "id": "".concat(id2, "_list"), "class": "".concat(itemPrefixCls, "-empty"), "onMousedown": onListMouseDown }, [notFoundContent]); } return createVNode(Fragment, null, [createVNode("div", { "role": "listbox", "id": "".concat(id2, "_list"), "style": { height: 0, width: 0, overflow: "hidden" } }, [renderItem(activeIndex - 1), renderItem(activeIndex), renderItem(activeIndex + 1)]), createVNode(List$1, { "itemKey": "key", "ref": listRef, "data": memoFlattenOptions, "height": height, "itemHeight": itemHeight, "fullHeight": false, "onMousedown": onListMouseDown, "onScroll": onScroll, "virtual": virtual, "onMouseenter": onMouseenter2, "children": function children(_ref2, itemIndex) { var _classNames; var group = _ref2.group, groupOption = _ref2.groupOption, data65 = _ref2.data; var label = data65.label, key2 = data65.key; if (group) { return createVNode("div", { "class": classNames(itemPrefixCls, "".concat(itemPrefixCls, "-group")) }, [renderOption ? renderOption(data65) : label !== void 0 ? label : key2]); } var disabled = data65.disabled, value24 = data65.value, title = data65.title, children2 = data65.children, style = data65.style, cls = data65.class, className = data65.className, otherProps = __rest$H(data65, ["disabled", "value", "title", "children", "style", "class", "className"]); var selected = values2.has(value24); var optionPrefixCls = "".concat(itemPrefixCls, "-option"); var optionClassName = classNames(itemPrefixCls, optionPrefixCls, cls, className, (_classNames = {}, _defineProperty$12(_classNames, "".concat(optionPrefixCls, "-grouped"), groupOption), _defineProperty$12(_classNames, "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !disabled), _defineProperty$12(_classNames, "".concat(optionPrefixCls, "-disabled"), disabled), _defineProperty$12(_classNames, "".concat(optionPrefixCls, "-selected"), selected), _classNames)); var mergedLabel = childrenAsData ? children2 : label; var iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === "function" || selected; var content = mergedLabel || value24; var optionTitle = typeof content === "string" || typeof content === "number" ? content.toString() : void 0; if (title !== void 0) { optionTitle = title; } return createVNode("div", _objectSpread2$2(_objectSpread2$2({}, otherProps), {}, { "aria-selected": selected, "class": optionClassName, "title": optionTitle, "onMousemove": function onMousemove(e2) { if (otherProps.onMousemove) { otherProps.onMousemove(e2); } if (activeIndex === itemIndex || disabled) { return; } setActive(itemIndex); }, "onClick": function onClick7(e2) { if (!disabled) { onSelectValue(value24); } if (otherProps.onClick) { otherProps.onClick(e2); } }, "style": style }), [createVNode("div", { "class": "".concat(optionPrefixCls, "-content") }, [renderOption ? renderOption(data65) : content]), isValidElement(menuItemSelectedIcon) || selected, iconVisible && createVNode(TransBtn$1, { "class": "".concat(itemPrefixCls, "-option-state"), "customizeIcon": menuItemSelectedIcon, "customizeIconProps": { isSelected: selected } }, { default: function _default8() { return [selected ? "\u2713" : null]; } })]); } }, null)]); } }); OptionList.props = OptionListProps; var SelectOptionList = OptionList; var Option$2 = function Option2() { return null; }; Option$2.isSelectOption = true; Option$2.displayName = "ASelectOption"; var Option$3 = Option$2; var OptGroup$2 = function OptGroup2() { return null; }; OptGroup$2.isSelectOptGroup = true; OptGroup$2.displayName = "ASelectOptGroup"; var OptGroup$3 = OptGroup$2; var __rest$G = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; function convertNodeToOption(node) { var _a3 = node, key2 = _a3.key, children = _a3.children, _b2 = _a3.props, value24 = _b2.value, disabled = _b2.disabled, restProps = __rest$G(_b2, ["value", "disabled"]); var child = children && children.default ? children.default() : void 0; return _extends$1({ key: key2, value: value24 !== void 0 ? value24 : key2, children: child, disabled: disabled || disabled === "" }, restProps); } function convertChildrenToData$1(nodes2) { var optionOnly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; var dd = flattenChildren(nodes2).map(function(node, index2) { var _a3; if (!isValidElement(node) || !node.type) { return null; } var isSelectOptGroup = node.type.isSelectOptGroup, key2 = node.key, children = node.children, props2 = node.props; if (optionOnly || !isSelectOptGroup) { return convertNodeToOption(node); } var child = children && children.default ? children.default() : void 0; var label = (props2 === null || props2 === void 0 ? void 0 : props2.label) || ((_a3 = children.label) === null || _a3 === void 0 ? void 0 : _a3.call(children)) || key2; return _extends$1(_extends$1({ key: "__RC_SELECT_GRP__".concat(key2 === null ? index2 : String(key2), "__") }, props2), { label, options: convertChildrenToData$1(child || []) }); }).filter(function(data65) { return data65; }); return dd; } function _toArray(arr) { return _arrayWithHoles$4(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$4(arr) || _nonIterableRest$4(); } function toArray$4(value24) { if (Array.isArray(value24)) { return value24; } return value24 !== void 0 ? [value24] : []; } function toInnerValue(value24, _ref) { var labelInValue = _ref.labelInValue, combobox = _ref.combobox; var valueMap = /* @__PURE__ */ new Map(); if (value24 === void 0 || value24 === "" && combobox) { return [[], valueMap]; } var values2 = Array.isArray(value24) ? value24 : [value24]; var rawValues = values2; if (labelInValue) { rawValues = values2.filter(function(item) { return item !== null; }).map(function(itemValue) { var key2 = itemValue.key, val = itemValue.value; var finalVal = val !== void 0 ? val : key2; valueMap.set(finalVal, itemValue); return finalVal; }); } return [rawValues, valueMap]; } function toOuterValues(valueList, _ref2) { var optionLabelProp = _ref2.optionLabelProp, labelInValue = _ref2.labelInValue, prevValueMap = _ref2.prevValueMap, options2 = _ref2.options, getLabeledValue3 = _ref2.getLabeledValue; var values2 = valueList; if (labelInValue) { values2 = values2.map(function(val) { return getLabeledValue3(val, { options: options2, prevValueMap, labelInValue, optionLabelProp }); }); } return values2; } function removeLastEnabledValue(measureValues, values2) { var newValues = _toConsumableArray(values2); var removeIndex; for (removeIndex = measureValues.length - 1; removeIndex >= 0; removeIndex -= 1) { if (!measureValues[removeIndex].disabled) { break; } } var removedValue = null; if (removeIndex !== -1) { removedValue = newValues[removeIndex]; newValues.splice(removeIndex, 1); } return { values: newValues, removedValue }; } var isClient = typeof window !== "undefined" && window.document && window.document.documentElement; var isBrowserClient = isClient; var uuid$2 = 0; function getUUID() { var retId; if (isBrowserClient) { retId = uuid$2; uuid$2 += 1; } else { retId = "TEST_OR_SSR"; } return retId; } function getKey$1(data65, index2) { var key2 = data65.key; var value24; if ("value" in data65) { value24 = data65.value; } if (key2 !== null && key2 !== void 0) { return key2; } if (value24 !== void 0) { return value24; } return "rc-index-key-".concat(index2); } function flattenOptions(options2) { var flattenList = []; function dig(list, isGroupOption) { list.forEach(function(data65) { if (isGroupOption || !("options" in data65)) { flattenList.push({ key: getKey$1(data65, flattenList.length), groupOption: isGroupOption, data: data65 }); } else { flattenList.push({ key: getKey$1(data65, flattenList.length), group: true, data: data65 }); dig(data65.options, true); } }); } dig(options2, false); return flattenList; } function injectPropsWithOption(option) { var newOption = _extends$1({}, option); if (!("props" in newOption)) { Object.defineProperty(newOption, "props", { get: function get2() { return newOption; } }); } return newOption; } function findValueOption(values2, options2) { var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, _ref$prevValueOptions = _ref.prevValueOptions, prevValueOptions = _ref$prevValueOptions === void 0 ? [] : _ref$prevValueOptions; var optionMap = /* @__PURE__ */ new Map(); options2.forEach(function(flattenItem) { if (!flattenItem.group) { var data65 = flattenItem.data; optionMap.set(data65.value, data65); } }); return values2.map(function(val) { var option = optionMap.get(val); if (!option) { option = _extends$1({}, prevValueOptions.find(function(opt) { return opt._INTERNAL_OPTION_VALUE_ === val; })); } return injectPropsWithOption(option); }); } var getLabeledValue = function getLabeledValue2(value24, _ref2) { var options2 = _ref2.options, prevValueMap = _ref2.prevValueMap, labelInValue = _ref2.labelInValue, optionLabelProp = _ref2.optionLabelProp; var item = findValueOption([value24], options2)[0]; var result = { value: value24 }; var prevValItem = labelInValue ? prevValueMap.get(value24) : void 0; if (prevValItem && _typeof$2(prevValItem) === "object" && "label" in prevValItem) { result.label = prevValItem.label; if (item && typeof prevValItem.label === "string" && typeof item[optionLabelProp] === "string" && prevValItem.label.trim() !== item[optionLabelProp].trim()) ; } else if (item && optionLabelProp in item) { if (Array.isArray(item[optionLabelProp])) { result.label = isVNode(item[optionLabelProp][0]) ? cloneVNode(item[optionLabelProp][0]) : item[optionLabelProp]; } else { result.label = item[optionLabelProp]; } } else { result.label = value24; result.isCacheable = true; } result.key = result.value; return result; }; function toRawString(content) { return toArray$4(content).map(function(item) { var _a3, _b2; if (isVNode(item)) { return ((_a3 = item === null || item === void 0 ? void 0 : item.el) === null || _a3 === void 0 ? void 0 : _a3.innerText) || ((_b2 = item === null || item === void 0 ? void 0 : item.el) === null || _b2 === void 0 ? void 0 : _b2.wholeText); } else { return item; } }).join(""); } function getFilterFunction(optionFilterProp) { return function(searchValue2, option) { var lowerSearchText = searchValue2.toLowerCase(); if ("options" in option) { return toRawString(option.label).toLowerCase().includes(lowerSearchText); } var rawValue = option[optionFilterProp]; var value24 = toRawString(rawValue).toLowerCase(); return value24.includes(lowerSearchText); }; } function filterOptions(searchValue2, options2, _ref3) { var optionFilterProp = _ref3.optionFilterProp, filterOption = _ref3.filterOption; var filteredOptions = []; var filterFunc; if (filterOption === false) { return _toConsumableArray(options2); } if (typeof filterOption === "function") { filterFunc = filterOption; } else { filterFunc = getFilterFunction(optionFilterProp); } options2.forEach(function(item) { if ("options" in item) { var matchGroup = filterFunc(searchValue2, item); if (matchGroup) { filteredOptions.push(item); } else { var subOptions = item.options.filter(function(subItem) { return filterFunc(searchValue2, subItem); }); if (subOptions.length) { filteredOptions.push(_extends$1(_extends$1({}, item), { options: subOptions })); } } return; } if (filterFunc(searchValue2, injectPropsWithOption(item))) { filteredOptions.push(item); } }); return filteredOptions; } function getSeparatedContent(text, tokens2) { if (!tokens2 || !tokens2.length) { return null; } var match5 = false; function separate(str, _ref4) { var _ref5 = _toArray(_ref4), token2 = _ref5[0], restTokens = _ref5.slice(1); if (!token2) { return [str]; } var list2 = str.split(token2); match5 = match5 || list2.length > 1; return list2.reduce(function(prevList, unitStr) { return [].concat(_toConsumableArray(prevList), _toConsumableArray(separate(unitStr, restTokens))); }, []).filter(function(unit) { return unit; }); } var list = separate(text, tokens2); return match5 ? list : null; } function isValueDisabled(value24, options2) { var option = findValueOption([value24], options2)[0]; return option.disabled; } function fillOptionsWithMissingValue(options2, value24, optionLabelProp, labelInValue) { var values2 = toArray$4(value24).slice().sort(); var cloneOptions = _toConsumableArray(options2); var optionValues = /* @__PURE__ */ new Set(); options2.forEach(function(opt) { if (opt.options) { opt.options.forEach(function(subOpt) { optionValues.add(subOpt.value); }); } else { optionValues.add(opt.value); } }); values2.forEach(function(item) { var val = labelInValue ? item.value : item; if (!optionValues.has(val)) { var _ref6; cloneOptions.push(labelInValue ? (_ref6 = {}, _defineProperty$12(_ref6, optionLabelProp, item.label), _defineProperty$12(_ref6, "value", val), _ref6) : { value: val }); } }); return cloneOptions; } function cloneElement(vnode) { var nodeProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var override = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true; var mergeRef = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false; var ele = vnode; if (Array.isArray(vnode)) { ele = filterEmpty(vnode)[0]; } if (!ele) { return null; } var node = cloneVNode(ele, nodeProps, mergeRef); node.props = override ? _extends$1(_extends$1({}, node.props), nodeProps) : node.props; warning$5(_typeof$2(node.props.class) !== "object", "class must be string"); return node; } function onCompositionStart(e2) { e2.target.composing = true; } function onCompositionEnd(e2) { if (!e2.target.composing) return; e2.target.composing = false; trigger(e2.target, "input"); } function trigger(el, type2) { var e2 = document.createEvent("HTMLEvents"); e2.initEvent(type2, true, true); el.dispatchEvent(e2); } function addEventListener$3(el, event, handler7, options2) { el.addEventListener(event, handler7, options2); } var antInput = { created: function created(el, binding) { if (!binding.modifiers || !binding.modifiers.lazy) { addEventListener$3(el, "compositionstart", onCompositionStart); addEventListener$3(el, "compositionend", onCompositionEnd); addEventListener$3(el, "change", onCompositionEnd); } } }; var antInput$1 = antInput; var Input$1 = defineComponent({ name: "Input", inheritAttrs: false, props: { inputRef: PropsTypes.any, prefixCls: PropsTypes.string, id: PropsTypes.string, inputElement: PropsTypes.any, disabled: PropsTypes.looseBool, autofocus: PropsTypes.looseBool, autocomplete: PropsTypes.string, editable: PropsTypes.looseBool, accessibilityIndex: PropsTypes.number, value: PropsTypes.string, open: PropsTypes.looseBool, tabindex: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), attrs: PropsTypes.object, onKeydown: PropsTypes.func, onMousedown: PropsTypes.func, onChange: PropsTypes.func, onPaste: PropsTypes.func, onCompositionstart: PropsTypes.func, onCompositionend: PropsTypes.func, onFocus: PropsTypes.func, onBlur: PropsTypes.func }, setup: function setup8(props2) { return { blurTimeout: null, VCSelectContainerEvent: inject("VCSelectContainerEvent") }; }, render: function render5() { var _this = this; var _a3; var _this$$props = this.$props, prefixCls2 = _this$$props.prefixCls, id2 = _this$$props.id, inputElement = _this$$props.inputElement, disabled = _this$$props.disabled, tabindex = _this$$props.tabindex, autofocus = _this$$props.autofocus, autocomplete = _this$$props.autocomplete, editable = _this$$props.editable, accessibilityIndex = _this$$props.accessibilityIndex, value24 = _this$$props.value, _onKeydown = _this$$props.onKeydown, _onMousedown = _this$$props.onMousedown, onChange8 = _this$$props.onChange, onPaste = _this$$props.onPaste, _onCompositionstart = _this$$props.onCompositionstart, _onCompositionend = _this$$props.onCompositionend, _onFocus = _this$$props.onFocus, _onBlur = _this$$props.onBlur, open6 = _this$$props.open, inputRef = _this$$props.inputRef, attrs = _this$$props.attrs; var inputNode = inputElement || withDirectives(createVNode("input", null, null), [[antInput$1]]); var inputProps2 = inputNode.props || {}; var onOriginKeyDown = inputProps2.onKeydown, onOriginInput = inputProps2.onInput, onOriginFocus = inputProps2.onFocus, onOriginBlur = inputProps2.onBlur, onOriginMouseDown = inputProps2.onMousedown, onOriginCompositionStart = inputProps2.onCompositionstart, onOriginCompositionEnd = inputProps2.onCompositionend, style = inputProps2.style; inputNode = cloneElement(inputNode, _extends$1(_extends$1(_extends$1({ id: id2, ref: inputRef, disabled, tabindex, autocomplete: autocomplete || "off", autofocus, class: classNames("".concat(prefixCls2, "-selection-search-input"), (_a3 = inputNode === null || inputNode === void 0 ? void 0 : inputNode.props) === null || _a3 === void 0 ? void 0 : _a3.className), style: _extends$1(_extends$1({}, style), { opacity: editable ? null : 0 }), role: "combobox", "aria-expanded": open6, "aria-haspopup": "listbox", "aria-owns": "".concat(id2, "_list"), "aria-autocomplete": "list", "aria-controls": "".concat(id2, "_list"), "aria-activedescendant": "".concat(id2, "_list_").concat(accessibilityIndex) }, attrs), { value: editable ? value24 : "", readonly: !editable, unselectable: !editable ? "on" : null, onKeydown: function onKeydown2(event) { _onKeydown(event); if (onOriginKeyDown) { onOriginKeyDown(event); } }, onMousedown: function onMousedown2(event) { _onMousedown(event); if (onOriginMouseDown) { onOriginMouseDown(event); } }, onInput: function onInput(event) { onChange8(event); if (onOriginInput) { onOriginInput(event); } }, onCompositionstart: function onCompositionstart2(event) { _onCompositionstart(event); if (onOriginCompositionStart) { onOriginCompositionStart(event); } }, onCompositionend: function onCompositionend2(event) { _onCompositionend(event); if (onOriginCompositionEnd) { onOriginCompositionEnd(event); } }, onPaste, onFocus: function onFocus5() { var _a4; clearTimeout(_this.blurTimeout); onOriginFocus && onOriginFocus(arguments.length <= 0 ? void 0 : arguments[0]); _onFocus && _onFocus(arguments.length <= 0 ? void 0 : arguments[0]); (_a4 = _this.VCSelectContainerEvent) === null || _a4 === void 0 ? void 0 : _a4.focus(arguments.length <= 0 ? void 0 : arguments[0]); }, onBlur: function onBlur6() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this.blurTimeout = setTimeout(function() { var _a4; onOriginBlur && onOriginBlur(args[0]); _onBlur && _onBlur(args[0]); (_a4 = _this.VCSelectContainerEvent) === null || _a4 === void 0 ? void 0 : _a4.blur(args[0]); }, 200); } }), inputNode.type === "textarea" ? {} : { type: "search" }), true, true); return inputNode; } }); var Input$2 = Input$1; var OverflowContextProviderKey = Symbol("OverflowContextProviderKey"); var OverflowContextProvider = defineComponent({ name: "OverflowContextProvider", inheritAttrs: false, props: { value: { type: Object } }, setup: function setup9(props2, _ref) { var slots = _ref.slots; provide(OverflowContextProviderKey, computed(function() { return props2.value; })); return function() { var _a3; return (_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots); }; } }); var useInjectOverflowContext = function useInjectOverflowContext2() { return inject(OverflowContextProviderKey, computed(function() { return null; })); }; var __rest$F = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var UNDEFINED = void 0; var Item = defineComponent({ name: "Item", props: { prefixCls: String, item: PropsTypes.any, renderItem: Function, responsive: Boolean, itemKey: { type: [String, Number] }, registerSize: Function, display: Boolean, order: Number, component: PropsTypes.any, invalidate: Boolean }, setup: function setup10(props2, _ref) { var slots = _ref.slots, expose = _ref.expose; var mergedHidden = computed(function() { return props2.responsive && !props2.display; }); var itemNodeRef = ref(); expose({ itemNodeRef }); function internalRegisterSize(width) { props2.registerSize(props2.itemKey, width); } onUnmounted(function() { internalRegisterSize(null); }); return function() { var _a3; var prefixCls2 = props2.prefixCls, invalidate = props2.invalidate, item = props2.item, renderItem = props2.renderItem, responsive = props2.responsive; props2.registerSize; props2.itemKey; props2.display; var order = props2.order, _props$component = props2.component, Component = _props$component === void 0 ? "div" : _props$component, restProps = __rest$F(props2, ["prefixCls", "invalidate", "item", "renderItem", "responsive", "registerSize", "itemKey", "display", "order", "component"]); var children = (_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots); var childNode = renderItem && item !== UNDEFINED ? renderItem(item) : children; var overflowStyle; if (!invalidate) { overflowStyle = { opacity: mergedHidden.value ? 0 : 1, height: mergedHidden.value ? 0 : UNDEFINED, overflowY: mergedHidden.value ? "hidden" : UNDEFINED, order: responsive ? order : UNDEFINED, pointerEvents: mergedHidden.value ? "none" : UNDEFINED, position: mergedHidden.value ? "absolute" : UNDEFINED }; } var overflowProps = {}; if (mergedHidden.value) { overflowProps["aria-hidden"] = true; } var itemNode = createVNode(Component, _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({ "class": classNames(!invalidate && prefixCls2), "style": overflowStyle }, overflowProps), restProps), {}, { "ref": itemNodeRef }), { default: function _default8() { return [childNode]; } }); return createVNode(ResizeObserver, { "disabled": !responsive, "onResize": function onResize(_ref2) { var offsetWidth = _ref2.offsetWidth; internalRegisterSize(offsetWidth); } }, { default: function _default8() { return [itemNode]; } }); }; } }); var __rest$E = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var RawItem = defineComponent({ name: "RawItem", inheritAttrs: false, props: { component: PropsTypes.any, title: PropsTypes.any }, setup: function setup11(props2, _ref) { var slots = _ref.slots, attrs = _ref.attrs; var context2 = useInjectOverflowContext(); return function() { var _a3, _b2; if (!context2.value) { var _props$component = props2.component, Component = _props$component === void 0 ? "div" : _props$component, _restProps = __rest$E(props2, ["component"]); return createVNode(Component, _objectSpread2$2(_objectSpread2$2({}, _restProps), attrs), { default: function _default8() { return [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)]; } }); } var _c = context2.value, contextClassName = _c.className, restContext = __rest$E(_c, ["className"]); var className = attrs.class, restProps = __rest$E(attrs, ["class"]); return createVNode(OverflowContextProvider, { "value": null }, { default: function _default8() { return [createVNode(Item, _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({ "class": classNames(contextClassName, className) }, restContext), restProps), props2), { default: function _default9() { return [(_b2 = slots.default) === null || _b2 === void 0 ? void 0 : _b2.call(slots)]; } })]; } }); }; } }); var __rest$D = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var RESPONSIVE = "responsive"; var INVALIDATE = "invalidate"; function defaultRenderRest(omittedItems) { return "+ ".concat(omittedItems.length, " ..."); } var Overflow = defineComponent({ name: "Overflow", inheritAttrs: false, props: { prefixCls: String, data: Array, itemKey: [String, Number, Function], itemWidth: { type: Number, default: 10 }, renderItem: Function, renderRawItem: Function, maxCount: [Number, String], renderRest: Function, renderRawRest: Function, suffix: PropsTypes.any, component: String, itemComponent: PropsTypes.any, onVisibleChange: Function, ssr: String }, emits: ["visibleChange"], setup: function setup12(props2, _ref) { var attrs = _ref.attrs, emit2 = _ref.emit; var fullySSR = computed(function() { return props2.ssr === "full"; }); var containerWidth = ref(null); var mergedContainerWidth = computed(function() { return containerWidth.value || 0; }); var itemWidths = ref(/* @__PURE__ */ new Map()); var prevRestWidth = ref(0); var restWidth = ref(0); var suffixWidth = ref(0); var suffixFixedStart = ref(null); var displayCount = ref(null); var mergedDisplayCount = computed(function() { if (displayCount.value === null && fullySSR.value) { return Number.MAX_SAFE_INTEGER; } return displayCount.value || 0; }); var restReady = ref(false); var itemPrefixCls = computed(function() { return "".concat(props2.prefixCls, "-item"); }); var mergedRestWidth = computed(function() { return Math.max(prevRestWidth.value, restWidth.value); }); var isResponsive = computed(function() { return !!(props2.data.length && props2.maxCount === RESPONSIVE); }); var invalidate = computed(function() { return props2.maxCount === INVALIDATE; }); var showRest = computed(function() { return isResponsive.value || typeof props2.maxCount === "number" && props2.data.length > props2.maxCount; }); var mergedData = computed(function() { var items = props2.data; if (isResponsive.value) { if (containerWidth.value === null && fullySSR.value) { items = props2.data; } else { items = props2.data.slice(0, Math.min(props2.data.length, mergedContainerWidth.value / props2.itemWidth)); } } else if (typeof props2.maxCount === "number") { items = props2.data.slice(0, props2.maxCount); } return items; }); var omittedItems = computed(function() { if (isResponsive.value) { return props2.data.slice(mergedDisplayCount.value + 1); } return props2.data.slice(mergedData.value.length); }); var getKey3 = function getKey4(item, index2) { var _a3, _b2; if (typeof props2.itemKey === "function") { return props2.itemKey(item); } return (_b2 = props2.itemKey && ((_a3 = item) === null || _a3 === void 0 ? void 0 : _a3[props2.itemKey])) !== null && _b2 !== void 0 ? _b2 : index2; }; var mergedRenderItem = computed(function() { return props2.renderItem || function(item) { return item; }; }); var updateDisplayCount = function updateDisplayCount2(count2, notReady) { displayCount.value = count2; if (!notReady) { restReady.value = count2 < props2.data.length - 1; emit2("visibleChange", count2); } }; var onOverflowResize = function onOverflowResize2(_2, element) { containerWidth.value = element.clientWidth; }; var registerSize = function registerSize2(key2, width) { var clone4 = new Map(itemWidths.value); if (width === null) { clone4.delete(key2); } else { clone4.set(key2, width); } itemWidths.value = clone4; }; var registerOverflowSize = function registerOverflowSize2(_2, width) { prevRestWidth.value = restWidth.value; restWidth.value = width; }; var registerSuffixSize = function registerSuffixSize2(_2, width) { suffixWidth.value = width; }; var getItemWidth = function getItemWidth2(index2) { return itemWidths.value.get(getKey3(mergedData.value[index2], index2)); }; watch([mergedContainerWidth, itemWidths, restWidth, suffixWidth, function() { return props2.itemKey; }, mergedData], function() { if (mergedContainerWidth.value && mergedRestWidth.value && mergedData.value) { var totalWidth = suffixWidth.value; var len = mergedData.value.length; var lastIndex = len - 1; if (!len) { updateDisplayCount(0); suffixFixedStart.value = null; return; } for (var i2 = 0; i2 < len; i2 += 1) { var currentItemWidth = getItemWidth(i2); if (currentItemWidth === void 0) { updateDisplayCount(i2 - 1, true); break; } totalWidth += currentItemWidth; if (lastIndex === 0 && totalWidth <= mergedContainerWidth.value || i2 === lastIndex - 1 && totalWidth + getItemWidth(lastIndex) <= mergedContainerWidth.value) { updateDisplayCount(lastIndex); suffixFixedStart.value = null; break; } else if (totalWidth + mergedRestWidth.value > mergedContainerWidth.value) { updateDisplayCount(i2 - 1); suffixFixedStart.value = totalWidth - currentItemWidth - suffixWidth.value + restWidth.value; break; } } if (props2.suffix && getItemWidth(0) + suffixWidth.value > mergedContainerWidth.value) { suffixFixedStart.value = null; } } }); return function() { var displayRest = restReady.value && !!omittedItems.value.length; var itemComponent = props2.itemComponent, renderRawItem = props2.renderRawItem, renderRawRest = props2.renderRawRest, renderRest = props2.renderRest, _props$prefixCls = props2.prefixCls, prefixCls2 = _props$prefixCls === void 0 ? "rc-overflow" : _props$prefixCls, suffix = props2.suffix, _props$component = props2.component, Component = _props$component === void 0 ? "div" : _props$component; var className = attrs.class, style = attrs.style, restAttrs = __rest$D(attrs, ["class", "style"]); var suffixStyle = {}; if (suffixFixedStart.value !== null && isResponsive.value) { suffixStyle = { position: "absolute", left: "".concat(suffixFixedStart.value, "px"), top: 0 }; } var itemSharedProps = { prefixCls: itemPrefixCls.value, responsive: isResponsive.value, component: itemComponent, invalidate: invalidate.value }; var internalRenderItemNode = renderRawItem ? function(item, index2) { var key2 = getKey3(item, index2); return createVNode(OverflowContextProvider, { "key": key2, "value": _extends$1(_extends$1({}, itemSharedProps), { order: index2, item, itemKey: key2, registerSize, display: index2 <= mergedDisplayCount.value }) }, { default: function _default8() { return [renderRawItem(item, index2)]; } }); } : function(item, index2) { var key2 = getKey3(item, index2); return createVNode(Item, _objectSpread2$2(_objectSpread2$2({}, itemSharedProps), {}, { "order": index2, "key": key2, "item": item, "renderItem": mergedRenderItem.value, "itemKey": key2, "registerSize": registerSize, "display": index2 <= mergedDisplayCount.value }), null); }; var restNode; var restContextProps = { order: displayRest ? mergedDisplayCount.value : Number.MAX_SAFE_INTEGER, className: "".concat(itemPrefixCls.value, "-rest"), registerSize: registerOverflowSize, display: displayRest }; if (!renderRawRest) { var mergedRenderRest = renderRest || defaultRenderRest; restNode = createVNode(Item, _objectSpread2$2(_objectSpread2$2({}, itemSharedProps), restContextProps), { default: function _default8() { return [typeof mergedRenderRest === "function" ? mergedRenderRest(omittedItems.value) : mergedRenderRest]; } }); } else if (renderRawRest) { restNode = createVNode(OverflowContextProvider, { "value": _extends$1(_extends$1({}, itemSharedProps), restContextProps) }, { default: function _default8() { return [renderRawRest(omittedItems.value)]; } }); } var overflowNode = createVNode(Component, _objectSpread2$2({ "class": classNames(!invalidate.value && prefixCls2, className), "style": style }, restAttrs), { default: function _default8() { return [mergedData.value.map(internalRenderItemNode), showRest.value ? restNode : null, suffix && createVNode(Item, _objectSpread2$2(_objectSpread2$2({}, itemSharedProps), {}, { "order": mergedDisplayCount.value, "class": "".concat(itemPrefixCls.value, "-suffix"), "registerSize": registerSuffixSize, "display": true, "style": suffixStyle }), { default: function _default9() { return [suffix]; } })]; } }); return createVNode(ResizeObserver, { "disabled": !isResponsive.value, "onResize": onOverflowResize }, { default: function _default8() { return [overflowNode]; } }); }; } }); Overflow.Item = RawItem; Overflow.RESPONSIVE = RESPONSIVE; Overflow.INVALIDATE = INVALIDATE; var Overflow$1 = Overflow; var props$9 = { id: PropsTypes.string, prefixCls: PropsTypes.string, values: PropsTypes.array, open: PropsTypes.looseBool, searchValue: PropsTypes.string, inputRef: PropsTypes.any, placeholder: PropsTypes.any, disabled: PropsTypes.looseBool, mode: PropsTypes.string, showSearch: PropsTypes.looseBool, autofocus: PropsTypes.looseBool, autocomplete: PropsTypes.string, accessibilityIndex: PropsTypes.number, tabindex: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), removeIcon: PropsTypes.VNodeChild, choiceTransitionName: PropsTypes.string, maxTagCount: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), maxTagTextLength: PropsTypes.number, maxTagPlaceholder: PropsTypes.any.def(function() { return function(omittedValues) { return "+ ".concat(omittedValues.length, " ..."); }; }), tagRender: PropsTypes.func, onToggleOpen: { type: Function }, onSelect: PropsTypes.func, onInputChange: PropsTypes.func, onInputPaste: PropsTypes.func, onInputKeyDown: PropsTypes.func, onInputMouseDown: PropsTypes.func, onInputCompositionStart: PropsTypes.func, onInputCompositionEnd: PropsTypes.func }; var onPreventMouseDown = function onPreventMouseDown2(event) { event.preventDefault(); event.stopPropagation(); }; var SelectSelector = defineComponent({ name: "MultipleSelectSelector", inheritAttrs: false, props: props$9, setup: function setup13(props2) { var measureRef = ref(); var inputWidth = ref(0); var focused = ref(false); var selectionPrefixCls = computed(function() { return "".concat(props2.prefixCls, "-selection"); }); var inputValue = computed(function() { return props2.open || props2.mode === "tags" ? props2.searchValue : ""; }); var inputEditable = computed(function() { return props2.mode === "tags" || props2.showSearch && (props2.open || focused.value); }); onMounted(function() { watch(inputValue, function() { inputWidth.value = measureRef.value.scrollWidth; }, { flush: "post", immediate: true }); }); function defaultRenderSelector(content, itemDisabled, closable, onClose) { return createVNode("span", { "class": classNames("".concat(selectionPrefixCls.value, "-item"), _defineProperty$12({}, "".concat(selectionPrefixCls.value, "-item-disabled"), itemDisabled)) }, [createVNode("span", { "class": "".concat(selectionPrefixCls.value, "-item-content") }, [content]), closable && createVNode(TransBtn$1, { "class": "".concat(selectionPrefixCls.value, "-item-remove"), "onMousedown": onPreventMouseDown, "onClick": onClose, "customizeIcon": props2.removeIcon }, { default: function _default8() { return [createTextVNode("\xD7")]; } })]); } function customizeRenderSelector(value24, content, itemDisabled, closable, onClose) { var onMouseDown3 = function onMouseDown4(e2) { onPreventMouseDown(e2); props2.onToggleOpen(!open); }; return createVNode("span", { "onMousedown": onMouseDown3 }, [props2.tagRender({ label: content, value: value24, disabled: itemDisabled, closable, onClose })]); } function renderItem(_ref) { var itemDisabled = _ref.disabled, label = _ref.label, value24 = _ref.value; var closable = !props2.disabled && !itemDisabled; var displayLabel = label; if (typeof props2.maxTagTextLength === "number") { if (typeof label === "string" || typeof label === "number") { var strLabel = String(displayLabel); if (strLabel.length > props2.maxTagTextLength) { displayLabel = "".concat(strLabel.slice(0, props2.maxTagTextLength), "..."); } } } var onClose = function onClose2(event) { if (event) event.stopPropagation(); props2.onSelect(value24, { selected: false }); }; return typeof props2.tagRender === "function" ? customizeRenderSelector(value24, displayLabel, itemDisabled, closable, onClose) : defaultRenderSelector(displayLabel, itemDisabled, closable, onClose); } function renderRest(omittedValues) { var _props$maxTagPlacehol = props2.maxTagPlaceholder, maxTagPlaceholder = _props$maxTagPlacehol === void 0 ? function(omittedValues2) { return "+ ".concat(omittedValues2.length, " ..."); } : _props$maxTagPlacehol; var content = typeof maxTagPlaceholder === "function" ? maxTagPlaceholder(omittedValues) : maxTagPlaceholder; return defaultRenderSelector(content, false); } return function() { var id2 = props2.id, prefixCls2 = props2.prefixCls, values2 = props2.values, open6 = props2.open, inputRef = props2.inputRef, placeholder = props2.placeholder, disabled = props2.disabled, autofocus = props2.autofocus, autocomplete = props2.autocomplete, accessibilityIndex = props2.accessibilityIndex, tabindex = props2.tabindex, onInputChange3 = props2.onInputChange, onInputPaste = props2.onInputPaste, onInputKeyDown = props2.onInputKeyDown, onInputMouseDown = props2.onInputMouseDown, onInputCompositionStart = props2.onInputCompositionStart, onInputCompositionEnd = props2.onInputCompositionEnd; var inputNode = createVNode("div", { "class": "".concat(selectionPrefixCls.value, "-search"), "style": { width: inputWidth.value + "px" }, "key": "input" }, [createVNode(Input$2, { "inputRef": inputRef, "open": open6, "prefixCls": prefixCls2, "id": id2, "inputElement": null, "disabled": disabled, "autofocus": autofocus, "autocomplete": autocomplete, "editable": inputEditable.value, "accessibilityIndex": accessibilityIndex, "value": inputValue.value, "onKeydown": onInputKeyDown, "onMousedown": onInputMouseDown, "onChange": onInputChange3, "onPaste": onInputPaste, "onCompositionstart": onInputCompositionStart, "onCompositionend": onInputCompositionEnd, "tabindex": tabindex, "attrs": pickAttrs(props2, true), "onFocus": function onFocus5() { return focused.value = true; }, "onBlur": function onBlur6() { return focused.value = false; } }, null), createVNode("span", { "ref": measureRef, "class": "".concat(selectionPrefixCls.value, "-search-mirror"), "aria-hidden": true }, [inputValue.value, createTextVNode("\xA0")])]); var selectionNode = createVNode(Overflow$1, { "prefixCls": "".concat(selectionPrefixCls.value, "-overflow"), "data": values2, "renderItem": renderItem, "renderRest": renderRest, "suffix": inputNode, "itemKey": "key", "maxCount": props2.maxTagCount, "key": "overflow" }, null); return createVNode(Fragment, null, [selectionNode, !values2.length && !inputValue.value && createVNode("span", { "class": "".concat(selectionPrefixCls.value, "-placeholder") }, [placeholder])]); }; } }); var MultipleSelector$2 = SelectSelector; var props$8 = { inputElement: PropsTypes.any, id: PropsTypes.string, prefixCls: PropsTypes.string, values: PropsTypes.array, open: PropsTypes.looseBool, searchValue: PropsTypes.string, inputRef: PropsTypes.any, placeholder: PropsTypes.any, disabled: PropsTypes.looseBool, mode: PropsTypes.string, showSearch: PropsTypes.looseBool, autofocus: PropsTypes.looseBool, autocomplete: PropsTypes.string, accessibilityIndex: PropsTypes.number, tabindex: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), activeValue: PropsTypes.string, backfill: PropsTypes.looseBool, onInputChange: PropsTypes.func, onInputPaste: PropsTypes.func, onInputKeyDown: PropsTypes.func, onInputMouseDown: PropsTypes.func, onInputCompositionStart: PropsTypes.func, onInputCompositionEnd: PropsTypes.func }; var SingleSelector$2 = defineComponent({ name: "SingleSelector", setup: function setup14(props2) { var inputChanged = ref(false); var combobox = computed(function() { return props2.mode === "combobox"; }); var inputEditable = computed(function() { return combobox.value || props2.showSearch; }); var inputValue = computed(function() { var inputValue2 = props2.searchValue || ""; if (combobox.value && props2.activeValue && !inputChanged.value) { inputValue2 = props2.activeValue; } return inputValue2; }); watch([combobox, function() { return props2.activeValue; }], function() { if (combobox.value) { inputChanged.value = false; } }, { immediate: true }); var hasTextInput = computed(function() { return props2.mode !== "combobox" && !props2.open ? false : !!inputValue.value; }); var title = computed(function() { var item = props2.values[0]; return item && (typeof item.label === "string" || typeof item.label === "number") ? item.label.toString() : void 0; }); return function() { var inputElement = props2.inputElement, prefixCls2 = props2.prefixCls, id2 = props2.id, values2 = props2.values, inputRef = props2.inputRef, disabled = props2.disabled, autofocus = props2.autofocus, autocomplete = props2.autocomplete, accessibilityIndex = props2.accessibilityIndex, open6 = props2.open, placeholder = props2.placeholder, tabindex = props2.tabindex, onInputKeyDown = props2.onInputKeyDown, onInputMouseDown = props2.onInputMouseDown, onInputChange3 = props2.onInputChange, onInputPaste = props2.onInputPaste, onInputCompositionStart = props2.onInputCompositionStart, onInputCompositionEnd = props2.onInputCompositionEnd; var item = values2[0]; return createVNode(Fragment, null, [createVNode("span", { "class": "".concat(prefixCls2, "-selection-search") }, [createVNode(Input$2, { "inputRef": inputRef, "prefixCls": prefixCls2, "id": id2, "open": open6, "inputElement": inputElement, "disabled": disabled, "autofocus": autofocus, "autocomplete": autocomplete, "editable": inputEditable.value, "accessibilityIndex": accessibilityIndex, "value": inputValue.value, "onKeydown": onInputKeyDown, "onMousedown": onInputMouseDown, "onChange": function onChange8(e2) { inputChanged.value = true; onInputChange3(e2); }, "onPaste": onInputPaste, "onCompositionstart": onInputCompositionStart, "onCompositionend": onInputCompositionEnd, "tabindex": tabindex, "attrs": pickAttrs(props2, true) }, null)]), !combobox.value && item && !hasTextInput.value && createVNode("span", { "class": "".concat(prefixCls2, "-selection-item"), "title": title.value }, [createVNode(Fragment, { "key": item.key || item.value }, [item.label])]), !item && !hasTextInput.value && createVNode("span", { "class": "".concat(prefixCls2, "-selection-placeholder") }, [placeholder])]); }; } }); SingleSelector$2.props = props$8; SingleSelector$2.inheritAttrs = false; var SingleSelector$3 = SingleSelector$2; function useLock() { var duration2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 250; var lock = null; var timeout; onBeforeUpdate(function() { window.clearTimeout(timeout); }); function doLock(locked) { if (locked || lock === null) { lock = locked; } window.clearTimeout(timeout); timeout = window.setTimeout(function() { lock = null; }, duration2); } return [function() { return lock; }, doLock]; } var Selector$2 = defineComponent({ name: "Selector", inheritAttrs: false, props: { id: PropsTypes.string, prefixCls: PropsTypes.string, showSearch: PropsTypes.looseBool, open: PropsTypes.looseBool, values: PropsTypes.array, multiple: PropsTypes.looseBool, mode: PropsTypes.string, searchValue: PropsTypes.string, activeValue: PropsTypes.string, inputElement: PropsTypes.any, autofocus: PropsTypes.looseBool, accessibilityIndex: PropsTypes.number, tabindex: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), disabled: PropsTypes.looseBool, placeholder: PropsTypes.any, removeIcon: PropsTypes.any, maxTagCount: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), maxTagTextLength: PropsTypes.number, maxTagPlaceholder: PropsTypes.any, tagRender: PropsTypes.func, tokenWithEnter: PropsTypes.looseBool, choiceTransitionName: PropsTypes.string, onToggleOpen: { type: Function }, onSearch: PropsTypes.func, onSearchSubmit: PropsTypes.func, onSelect: PropsTypes.func, onInputKeyDown: { type: Function }, domRef: PropsTypes.func }, setup: function setup15(props2) { var inputRef = createRef$1(); var compositionStatus = false; var _useLock = useLock(0), _useLock2 = _slicedToArray$4(_useLock, 2), getInputMouseDown = _useLock2[0], setInputMouseDown = _useLock2[1]; var onInternalInputKeyDown = function onInternalInputKeyDown2(event) { var which = event.which; if (which === KeyCode$1.UP || which === KeyCode$1.DOWN) { event.preventDefault(); } if (props2.onInputKeyDown) { props2.onInputKeyDown(event); } if (which === KeyCode$1.ENTER && props2.mode === "tags" && !compositionStatus && !props2.open) { props2.onSearchSubmit(event.target.value); } if (![KeyCode$1.SHIFT, KeyCode$1.TAB, KeyCode$1.BACKSPACE, KeyCode$1.ESC].includes(which)) { props2.onToggleOpen(true); } }; var onInternalInputMouseDown = function onInternalInputMouseDown2() { setInputMouseDown(true); }; var pastedText = null; var triggerOnSearch = function triggerOnSearch2(value24) { if (props2.onSearch(value24, true, compositionStatus) !== false) { props2.onToggleOpen(true); } }; var onInputCompositionStart = function onInputCompositionStart2() { compositionStatus = true; }; var onInputCompositionEnd = function onInputCompositionEnd2(e2) { compositionStatus = false; if (props2.mode !== "combobox") { triggerOnSearch(e2.target.value); } }; var onInputChange3 = function onInputChange4(event) { var value24 = event.target.value; if (props2.tokenWithEnter && pastedText && /[\r\n]/.test(pastedText)) { var replacedText = pastedText.replace(/[\r\n]+$/, "").replace(/\r\n/g, " ").replace(/[\r\n]/g, " "); value24 = value24.replace(replacedText, pastedText); } pastedText = null; triggerOnSearch(value24); }; var onInputPaste = function onInputPaste2(e2) { var clipboardData = e2.clipboardData; var value24 = clipboardData.getData("text"); pastedText = value24; }; var onClick7 = function onClick8(_ref) { var target = _ref.target; if (target !== inputRef.current) { var isIE = document.body.style.msTouchAction !== void 0; if (isIE) { setTimeout(function() { inputRef.current.focus(); }); } else { inputRef.current.focus(); } } }; var onMousedown2 = function onMousedown3(event) { var inputMouseDown = getInputMouseDown(); if (event.target !== inputRef.current && !inputMouseDown) { event.preventDefault(); } if (props2.mode !== "combobox" && (!props2.showSearch || !inputMouseDown) || !props2.open) { if (props2.open) { props2.onSearch("", true, false); } props2.onToggleOpen(); } }; return { focus: function focus25() { inputRef.current.focus(); }, blur: function blur22() { inputRef.current.blur(); }, onMousedown: onMousedown2, onClick: onClick7, onInputPaste, inputRef, onInternalInputKeyDown, onInternalInputMouseDown, onInputChange: onInputChange3, onInputCompositionEnd, onInputCompositionStart }; }, render: function render6() { var _this$$props = this.$props, prefixCls2 = _this$$props.prefixCls, domRef = _this$$props.domRef, multiple = _this$$props.multiple; var onMousedown2 = this.onMousedown, onClick7 = this.onClick, inputRef = this.inputRef, onInputPaste = this.onInputPaste, onInternalInputKeyDown = this.onInternalInputKeyDown, onInternalInputMouseDown = this.onInternalInputMouseDown, onInputChange3 = this.onInputChange, onInputCompositionStart = this.onInputCompositionStart, onInputCompositionEnd = this.onInputCompositionEnd; var sharedProps = { inputRef, onInputKeyDown: onInternalInputKeyDown, onInputMouseDown: onInternalInputMouseDown, onInputChange: onInputChange3, onInputPaste, onInputCompositionStart, onInputCompositionEnd }; var selectNode = multiple ? createVNode(MultipleSelector$2, _objectSpread2$2(_objectSpread2$2({}, this.$props), sharedProps), null) : createVNode(SingleSelector$3, _objectSpread2$2(_objectSpread2$2({}, this.$props), sharedProps), null); return createVNode("div", { "ref": domRef, "class": "".concat(prefixCls2, "-selector"), "onClick": onClick7, "onMousedown": onMousedown2 }, [selectNode]); } }); var Selector$3 = Selector$2; function contains(root2, n2) { if (!root2) { return false; } return root2.contains(n2); } var availablePrefixs = ["moz", "ms", "webkit"]; function requestAnimationFramePolyfill() { var lastTime = 0; return function(callback2) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id2 = window.setTimeout(function() { callback2(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id2; }; } function getRequestAnimationFrame() { if (typeof window === "undefined") { return function() { }; } if (window.requestAnimationFrame) { return window.requestAnimationFrame.bind(window); } var prefix = availablePrefixs.filter(function(key2) { return "".concat(key2, "RequestAnimationFrame") in window; })[0]; return prefix ? window["".concat(prefix, "RequestAnimationFrame")] : requestAnimationFramePolyfill(); } function cancelRequestAnimationFrame(id2) { if (typeof window === "undefined") { return null; } if (window.cancelAnimationFrame) { return window.cancelAnimationFrame(id2); } var prefix = availablePrefixs.filter(function(key2) { return "".concat(key2, "CancelAnimationFrame") in window || "".concat(key2, "CancelRequestAnimationFrame") in window; })[0]; return prefix ? (window["".concat(prefix, "CancelAnimationFrame")] || window["".concat(prefix, "CancelRequestAnimationFrame")]).call(this, id2) : clearTimeout(id2); } var raf = getRequestAnimationFrame(); var cancelAnimationTimeout = function cancelAnimationTimeout2(frame) { return cancelRequestAnimationFrame(frame.id); }; var requestAnimationTimeout = function requestAnimationTimeout2(callback2, delay) { var start = Date.now(); function timeout() { if (Date.now() - start >= delay) { callback2.call(); } else { frame.id = raf(timeout); } } var frame = { id: raf(timeout) }; return frame; }; function ownKeys$1(object3, enumerableOnly) { var keys2 = Object.keys(object3); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object3); if (enumerableOnly) { symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object3, sym).enumerable; }); } keys2.push.apply(keys2, symbols); } return keys2; } function _objectSpread2$1(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? arguments[i2] : {}; if (i2 % 2) { ownKeys$1(Object(source2), true).forEach(function(key2) { _defineProperty$11(target, key2, source2[key2]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2)); } else { ownKeys$1(Object(source2)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source2, key2)); }); } } return target; } function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function(obj2) { return typeof obj2; }; } else { _typeof$1 = function(obj2) { return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }; } return _typeof$1(obj); } function _defineProperty$11(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var vendorPrefix; var jsCssMap = { Webkit: "-webkit-", Moz: "-moz-", ms: "-ms-", O: "-o-" }; function getVendorPrefix() { if (vendorPrefix !== void 0) { return vendorPrefix; } vendorPrefix = ""; var style = document.createElement("p").style; var testProp = "Transform"; for (var key2 in jsCssMap) { if (key2 + testProp in style) { vendorPrefix = key2; } } return vendorPrefix; } function getTransitionName() { return getVendorPrefix() ? "".concat(getVendorPrefix(), "TransitionProperty") : "transitionProperty"; } function getTransformName() { return getVendorPrefix() ? "".concat(getVendorPrefix(), "Transform") : "transform"; } function setTransitionProperty(node, value24) { var name = getTransitionName(); if (name) { node.style[name] = value24; if (name !== "transitionProperty") { node.style.transitionProperty = value24; } } } function setTransform(node, value24) { var name = getTransformName(); if (name) { node.style[name] = value24; if (name !== "transform") { node.style.transform = value24; } } } function getTransitionProperty(node) { return node.style.transitionProperty || node.style[getTransitionName()]; } function getTransformXY(node) { var style = window.getComputedStyle(node, null); var transform2 = style.getPropertyValue("transform") || style.getPropertyValue(getTransformName()); if (transform2 && transform2 !== "none") { var matrix = transform2.replace(/[^0-9\-.,]/g, "").split(","); return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) }; } return { x: 0, y: 0 }; } var matrix2d = /matrix\((.*)\)/; var matrix3d = /matrix3d\((.*)\)/; function setTransformXY(node, xy) { var style = window.getComputedStyle(node, null); var transform2 = style.getPropertyValue("transform") || style.getPropertyValue(getTransformName()); if (transform2 && transform2 !== "none") { var arr; var match2d = transform2.match(matrix2d); if (match2d) { match2d = match2d[1]; arr = match2d.split(",").map(function(item) { return parseFloat(item, 10); }); arr[4] = xy.x; arr[5] = xy.y; setTransform(node, "matrix(".concat(arr.join(","), ")")); } else { var match3d = transform2.match(matrix3d)[1]; arr = match3d.split(",").map(function(item) { return parseFloat(item, 10); }); arr[12] = xy.x; arr[13] = xy.y; setTransform(node, "matrix3d(".concat(arr.join(","), ")")); } } else { setTransform(node, "translateX(".concat(xy.x, "px) translateY(").concat(xy.y, "px) translateZ(0)")); } } var RE_NUM$1 = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; var getComputedStyleX$1; function forceRelayout(elem) { var originalStyle = elem.style.display; elem.style.display = "none"; elem.offsetHeight; elem.style.display = originalStyle; } function css$1(el, name, v2) { var value24 = v2; if (_typeof$1(name) === "object") { for (var i2 in name) { if (name.hasOwnProperty(i2)) { css$1(el, i2, name[i2]); } } return void 0; } if (typeof value24 !== "undefined") { if (typeof value24 === "number") { value24 = "".concat(value24, "px"); } el.style[name] = value24; return void 0; } return getComputedStyleX$1(el, name); } function getClientPosition$2(elem) { var box; var x2; var y2; var doc = elem.ownerDocument; var body = doc.body; var docElem = doc && doc.documentElement; box = elem.getBoundingClientRect(); x2 = box.left; y2 = box.top; x2 -= docElem.clientLeft || body.clientLeft || 0; y2 -= docElem.clientTop || body.clientTop || 0; return { left: x2, top: y2 }; } function getScroll$3(w2, top) { var ret = w2["page".concat(top ? "Y" : "X", "Offset")]; var method3 = "scroll".concat(top ? "Top" : "Left"); if (typeof ret !== "number") { var d2 = w2.document; ret = d2.documentElement[method3]; if (typeof ret !== "number") { ret = d2.body[method3]; } } return ret; } function getScrollLeft$1(w2) { return getScroll$3(w2); } function getScrollTop$1(w2) { return getScroll$3(w2, true); } function getOffset$3(el) { var pos = getClientPosition$2(el); var doc = el.ownerDocument; var w2 = doc.defaultView || doc.parentWindow; pos.left += getScrollLeft$1(w2); pos.top += getScrollTop$1(w2); return pos; } function isWindow$1(obj) { return obj !== null && obj !== void 0 && obj == obj.window; } function getDocument(node) { if (isWindow$1(node)) { return node.document; } if (node.nodeType === 9) { return node; } return node.ownerDocument; } function _getComputedStyle$1(elem, name, cs) { var computedStyle = cs; var val = ""; var d2 = getDocument(elem); computedStyle = computedStyle || d2.defaultView.getComputedStyle(elem, null); if (computedStyle) { val = computedStyle.getPropertyValue(name) || computedStyle[name]; } return val; } var _RE_NUM_NO_PX$1 = new RegExp("^(".concat(RE_NUM$1, ")(?!px)[a-z%]+$"), "i"); var RE_POS$1 = /^(top|right|bottom|left)$/; var CURRENT_STYLE$1 = "currentStyle"; var RUNTIME_STYLE$1 = "runtimeStyle"; var LEFT$1 = "left"; var PX$1 = "px"; function _getComputedStyleIE$1(elem, name) { var ret = elem[CURRENT_STYLE$1] && elem[CURRENT_STYLE$1][name]; if (_RE_NUM_NO_PX$1.test(ret) && !RE_POS$1.test(name)) { var style = elem.style; var left = style[LEFT$1]; var rsLeft = elem[RUNTIME_STYLE$1][LEFT$1]; elem[RUNTIME_STYLE$1][LEFT$1] = elem[CURRENT_STYLE$1][LEFT$1]; style[LEFT$1] = name === "fontSize" ? "1em" : ret || 0; ret = style.pixelLeft + PX$1; style[LEFT$1] = left; elem[RUNTIME_STYLE$1][LEFT$1] = rsLeft; } return ret === "" ? "auto" : ret; } if (typeof window !== "undefined") { getComputedStyleX$1 = window.getComputedStyle ? _getComputedStyle$1 : _getComputedStyleIE$1; } function getOffsetDirection(dir, option) { if (dir === "left") { return option.useCssRight ? "right" : dir; } return option.useCssBottom ? "bottom" : dir; } function oppositeOffsetDirection(dir) { if (dir === "left") { return "right"; } else if (dir === "right") { return "left"; } else if (dir === "top") { return "bottom"; } else if (dir === "bottom") { return "top"; } } function setLeftTop(elem, offset4, option) { if (css$1(elem, "position") === "static") { elem.style.position = "relative"; } var presetH = -999; var presetV = -999; var horizontalProperty = getOffsetDirection("left", option); var verticalProperty = getOffsetDirection("top", option); var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty); var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty); if (horizontalProperty !== "left") { presetH = 999; } if (verticalProperty !== "top") { presetV = 999; } var originalTransition = ""; var originalOffset = getOffset$3(elem); if ("left" in offset4 || "top" in offset4) { originalTransition = getTransitionProperty(elem) || ""; setTransitionProperty(elem, "none"); } if ("left" in offset4) { elem.style[oppositeHorizontalProperty] = ""; elem.style[horizontalProperty] = "".concat(presetH, "px"); } if ("top" in offset4) { elem.style[oppositeVerticalProperty] = ""; elem.style[verticalProperty] = "".concat(presetV, "px"); } forceRelayout(elem); var old = getOffset$3(elem); var originalStyle = {}; for (var key2 in offset4) { if (offset4.hasOwnProperty(key2)) { var dir = getOffsetDirection(key2, option); var preset = key2 === "left" ? presetH : presetV; var off2 = originalOffset[key2] - old[key2]; if (dir === key2) { originalStyle[dir] = preset + off2; } else { originalStyle[dir] = preset - off2; } } } css$1(elem, originalStyle); forceRelayout(elem); if ("left" in offset4 || "top" in offset4) { setTransitionProperty(elem, originalTransition); } var ret = {}; for (var _key in offset4) { if (offset4.hasOwnProperty(_key)) { var _dir = getOffsetDirection(_key, option); var _off = offset4[_key] - originalOffset[_key]; if (_key === _dir) { ret[_dir] = originalStyle[_dir] + _off; } else { ret[_dir] = originalStyle[_dir] - _off; } } } css$1(elem, ret); } function setTransform$1(elem, offset4) { var originalOffset = getOffset$3(elem); var originalXY = getTransformXY(elem); var resultXY = { x: originalXY.x, y: originalXY.y }; if ("left" in offset4) { resultXY.x = originalXY.x + offset4.left - originalOffset.left; } if ("top" in offset4) { resultXY.y = originalXY.y + offset4.top - originalOffset.top; } setTransformXY(elem, resultXY); } function setOffset$1(elem, offset4, option) { if (option.ignoreShake) { var oriOffset = getOffset$3(elem); var oLeft = oriOffset.left.toFixed(0); var oTop = oriOffset.top.toFixed(0); var tLeft = offset4.left.toFixed(0); var tTop = offset4.top.toFixed(0); if (oLeft === tLeft && oTop === tTop) { return; } } if (option.useCssRight || option.useCssBottom) { setLeftTop(elem, offset4, option); } else if (option.useCssTransform && getTransformName() in document.body.style) { setTransform$1(elem, offset4); } else { setLeftTop(elem, offset4, option); } } function each$1(arr, fn) { for (var i2 = 0; i2 < arr.length; i2++) { fn(arr[i2]); } } function isBorderBoxFn$1(elem) { return getComputedStyleX$1(elem, "boxSizing") === "border-box"; } var BOX_MODELS$1 = ["margin", "border", "padding"]; var CONTENT_INDEX$1 = -1; var PADDING_INDEX$1 = 2; var BORDER_INDEX$1 = 1; var MARGIN_INDEX$1 = 0; function swap$1(elem, options2, callback2) { var old = {}; var style = elem.style; var name; for (name in options2) { if (options2.hasOwnProperty(name)) { old[name] = style[name]; style[name] = options2[name]; } } callback2.call(elem); for (name in options2) { if (options2.hasOwnProperty(name)) { style[name] = old[name]; } } } function getPBMWidth$1(elem, props2, which) { var value24 = 0; var prop; var j2; var i2; for (j2 = 0; j2 < props2.length; j2++) { prop = props2[j2]; if (prop) { for (i2 = 0; i2 < which.length; i2++) { var cssProp = void 0; if (prop === "border") { cssProp = "".concat(prop).concat(which[i2], "Width"); } else { cssProp = prop + which[i2]; } value24 += parseFloat(getComputedStyleX$1(elem, cssProp)) || 0; } } } return value24; } var domUtils$1 = { getParent: function getParent2(element) { var parent2 = element; do { if (parent2.nodeType === 11 && parent2.host) { parent2 = parent2.host; } else { parent2 = parent2.parentNode; } } while (parent2 && parent2.nodeType !== 1 && parent2.nodeType !== 9); return parent2; } }; each$1(["Width", "Height"], function(name) { domUtils$1["doc".concat(name)] = function(refWin) { var d2 = refWin.document; return Math.max(d2.documentElement["scroll".concat(name)], d2.body["scroll".concat(name)], domUtils$1["viewport".concat(name)](d2)); }; domUtils$1["viewport".concat(name)] = function(win) { var prop = "client".concat(name); var doc = win.document; var body = doc.body; var documentElement = doc.documentElement; var documentElementProp = documentElement[prop]; return doc.compatMode === "CSS1Compat" && documentElementProp || body && body[prop] || documentElementProp; }; }); function getWH$1(elem, name, ex) { var extra = ex; if (isWindow$1(elem)) { return name === "width" ? domUtils$1.viewportWidth(elem) : domUtils$1.viewportHeight(elem); } else if (elem.nodeType === 9) { return name === "width" ? domUtils$1.docWidth(elem) : domUtils$1.docHeight(elem); } var which = name === "width" ? ["Left", "Right"] : ["Top", "Bottom"]; var borderBoxValue = name === "width" ? elem.getBoundingClientRect().width : elem.getBoundingClientRect().height; var isBorderBox = isBorderBoxFn$1(elem); var cssBoxValue = 0; if (borderBoxValue === null || borderBoxValue === void 0 || borderBoxValue <= 0) { borderBoxValue = void 0; cssBoxValue = getComputedStyleX$1(elem, name); if (cssBoxValue === null || cssBoxValue === void 0 || Number(cssBoxValue) < 0) { cssBoxValue = elem.style[name] || 0; } cssBoxValue = parseFloat(cssBoxValue) || 0; } if (extra === void 0) { extra = isBorderBox ? BORDER_INDEX$1 : CONTENT_INDEX$1; } var borderBoxValueOrIsBorderBox = borderBoxValue !== void 0 || isBorderBox; var val = borderBoxValue || cssBoxValue; if (extra === CONTENT_INDEX$1) { if (borderBoxValueOrIsBorderBox) { return val - getPBMWidth$1(elem, ["border", "padding"], which); } return cssBoxValue; } else if (borderBoxValueOrIsBorderBox) { if (extra === BORDER_INDEX$1) { return val; } return val + (extra === PADDING_INDEX$1 ? -getPBMWidth$1(elem, ["border"], which) : getPBMWidth$1(elem, ["margin"], which)); } return cssBoxValue + getPBMWidth$1(elem, BOX_MODELS$1.slice(extra), which); } var cssShow$1 = { position: "absolute", visibility: "hidden", display: "block" }; function getWHIgnoreDisplay$1() { for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) { args[_key2] = arguments[_key2]; } var val; var elem = args[0]; if (elem.offsetWidth !== 0) { val = getWH$1.apply(void 0, args); } else { swap$1(elem, cssShow$1, function() { val = getWH$1.apply(void 0, args); }); } return val; } each$1(["width", "height"], function(name) { var first = name.charAt(0).toUpperCase() + name.slice(1); domUtils$1["outer".concat(first)] = function(el, includeMargin) { return el && getWHIgnoreDisplay$1(el, name, includeMargin ? MARGIN_INDEX$1 : BORDER_INDEX$1); }; var which = name === "width" ? ["Left", "Right"] : ["Top", "Bottom"]; domUtils$1[name] = function(elem, v2) { var val = v2; if (val !== void 0) { if (elem) { var isBorderBox = isBorderBoxFn$1(elem); if (isBorderBox) { val += getPBMWidth$1(elem, ["padding", "border"], which); } return css$1(elem, name, val); } return void 0; } return elem && getWHIgnoreDisplay$1(elem, name, CONTENT_INDEX$1); }; }); function mix$1(to2, from2) { for (var i2 in from2) { if (from2.hasOwnProperty(i2)) { to2[i2] = from2[i2]; } } return to2; } var utils$i = { getWindow: function getWindow(node) { if (node && node.document && node.setTimeout) { return node; } var doc = node.ownerDocument || node; return doc.defaultView || doc.parentWindow; }, getDocument, offset: function offset2(el, value24, option) { if (typeof value24 !== "undefined") { setOffset$1(el, value24, option || {}); } else { return getOffset$3(el); } }, isWindow: isWindow$1, each: each$1, css: css$1, clone: function clone2(obj) { var i2; var ret = {}; for (i2 in obj) { if (obj.hasOwnProperty(i2)) { ret[i2] = obj[i2]; } } var overflow = obj.overflow; if (overflow) { for (i2 in obj) { if (obj.hasOwnProperty(i2)) { ret.overflow[i2] = obj.overflow[i2]; } } } return ret; }, mix: mix$1, getWindowScrollLeft: function getWindowScrollLeft(w2) { return getScrollLeft$1(w2); }, getWindowScrollTop: function getWindowScrollTop(w2) { return getScrollTop$1(w2); }, merge: function merge2() { var ret = {}; for (var i2 = 0; i2 < arguments.length; i2++) { utils$i.mix(ret, i2 < 0 || arguments.length <= i2 ? void 0 : arguments[i2]); } return ret; }, viewportWidth: 0, viewportHeight: 0 }; mix$1(utils$i, domUtils$1); var getParent = utils$i.getParent; function getOffsetParent(element) { if (utils$i.isWindow(element) || element.nodeType === 9) { return null; } var doc = utils$i.getDocument(element); var body = doc.body; var parent2; var positionStyle = utils$i.css(element, "position"); var skipStatic = positionStyle === "fixed" || positionStyle === "absolute"; if (!skipStatic) { return element.nodeName.toLowerCase() === "html" ? null : getParent(element); } for (parent2 = getParent(element); parent2 && parent2 !== body && parent2.nodeType !== 9; parent2 = getParent(parent2)) { positionStyle = utils$i.css(parent2, "position"); if (positionStyle !== "static") { return parent2; } } return null; } var getParent$1 = utils$i.getParent; function isAncestorFixed(element) { if (utils$i.isWindow(element) || element.nodeType === 9) { return false; } var doc = utils$i.getDocument(element); var body = doc.body; var parent2 = null; for (parent2 = getParent$1(element); parent2 && parent2 !== body && parent2 !== doc; parent2 = getParent$1(parent2)) { var positionStyle = utils$i.css(parent2, "position"); if (positionStyle === "fixed") { return true; } } return false; } function getVisibleRectForElement(element, alwaysByViewport) { var visibleRect = { left: 0, right: Infinity, top: 0, bottom: Infinity }; var el = getOffsetParent(element); var doc = utils$i.getDocument(element); var win = doc.defaultView || doc.parentWindow; var body = doc.body; var documentElement = doc.documentElement; while (el) { if ((navigator.userAgent.indexOf("MSIE") === -1 || el.clientWidth !== 0) && el !== body && el !== documentElement && utils$i.css(el, "overflow") !== "visible") { var pos = utils$i.offset(el); pos.left += el.clientLeft; pos.top += el.clientTop; visibleRect.top = Math.max(visibleRect.top, pos.top); visibleRect.right = Math.min(visibleRect.right, pos.left + el.clientWidth); visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight); visibleRect.left = Math.max(visibleRect.left, pos.left); } else if (el === body || el === documentElement) { break; } el = getOffsetParent(el); } var originalPosition = null; if (!utils$i.isWindow(element) && element.nodeType !== 9) { originalPosition = element.style.position; var position2 = utils$i.css(element, "position"); if (position2 === "absolute") { element.style.position = "fixed"; } } var scrollX = utils$i.getWindowScrollLeft(win); var scrollY = utils$i.getWindowScrollTop(win); var viewportWidth = utils$i.viewportWidth(win); var viewportHeight = utils$i.viewportHeight(win); var documentWidth = documentElement.scrollWidth; var documentHeight = documentElement.scrollHeight; var bodyStyle = window.getComputedStyle(body); if (bodyStyle.overflowX === "hidden") { documentWidth = win.innerWidth; } if (bodyStyle.overflowY === "hidden") { documentHeight = win.innerHeight; } if (element.style) { element.style.position = originalPosition; } if (alwaysByViewport || isAncestorFixed(element)) { visibleRect.left = Math.max(visibleRect.left, scrollX); visibleRect.top = Math.max(visibleRect.top, scrollY); visibleRect.right = Math.min(visibleRect.right, scrollX + viewportWidth); visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + viewportHeight); } else { var maxVisibleWidth = Math.max(documentWidth, scrollX + viewportWidth); visibleRect.right = Math.min(visibleRect.right, maxVisibleWidth); var maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight); visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight); } return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null; } function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) { var pos = utils$i.clone(elFuturePos); var size = { width: elRegion.width, height: elRegion.height }; if (overflow.adjustX && pos.left < visibleRect.left) { pos.left = visibleRect.left; } if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) { size.width -= pos.left + size.width - visibleRect.right; } if (overflow.adjustX && pos.left + size.width > visibleRect.right) { pos.left = Math.max(visibleRect.right - size.width, visibleRect.left); } if (overflow.adjustY && pos.top < visibleRect.top) { pos.top = visibleRect.top; } if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) { size.height -= pos.top + size.height - visibleRect.bottom; } if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) { pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top); } return utils$i.mix(pos, size); } function getRegion(node) { var offset4; var w2; var h2; if (!utils$i.isWindow(node) && node.nodeType !== 9) { offset4 = utils$i.offset(node); w2 = utils$i.outerWidth(node); h2 = utils$i.outerHeight(node); } else { var win = utils$i.getWindow(node); offset4 = { left: utils$i.getWindowScrollLeft(win), top: utils$i.getWindowScrollTop(win) }; w2 = utils$i.viewportWidth(win); h2 = utils$i.viewportHeight(win); } offset4.width = w2; offset4.height = h2; return offset4; } function getAlignOffset(region, align) { var V2 = align.charAt(0); var H = align.charAt(1); var w2 = region.width; var h2 = region.height; var x2 = region.left; var y2 = region.top; if (V2 === "c") { y2 += h2 / 2; } else if (V2 === "b") { y2 += h2; } if (H === "c") { x2 += w2 / 2; } else if (H === "r") { x2 += w2; } return { left: x2, top: y2 }; } function getElFuturePos(elRegion, refNodeRegion, points, offset4, targetOffset2) { var p1 = getAlignOffset(refNodeRegion, points[1]); var p2 = getAlignOffset(elRegion, points[0]); var diff2 = [p2.left - p1.left, p2.top - p1.top]; return { left: Math.round(elRegion.left - diff2[0] + offset4[0] - targetOffset2[0]), top: Math.round(elRegion.top - diff2[1] + offset4[1] - targetOffset2[1]) }; } function isFailX(elFuturePos, elRegion, visibleRect) { return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right; } function isFailY(elFuturePos, elRegion, visibleRect) { return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom; } function isCompleteFailX(elFuturePos, elRegion, visibleRect) { return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left; } function isCompleteFailY(elFuturePos, elRegion, visibleRect) { return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top; } function flip(points, reg, map2) { var ret = []; utils$i.each(points, function(p) { ret.push(p.replace(reg, function(m2) { return map2[m2]; })); }); return ret; } function flipOffset(offset4, index2) { offset4[index2] = -offset4[index2]; return offset4; } function convertOffset(str, offsetLen) { var n2; if (/%$/.test(str)) { n2 = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen; } else { n2 = parseInt(str, 10); } return n2 || 0; } function normalizeOffset(offset4, el) { offset4[0] = convertOffset(offset4[0], el.width); offset4[1] = convertOffset(offset4[1], el.height); } function doAlign(el, tgtRegion, align, isTgtRegionVisible) { var points = align.points; var offset4 = align.offset || [0, 0]; var targetOffset2 = align.targetOffset || [0, 0]; var overflow = align.overflow; var source2 = align.source || el; offset4 = [].concat(offset4); targetOffset2 = [].concat(targetOffset2); overflow = overflow || {}; var newOverflowCfg = {}; var fail = 0; var alwaysByViewport = !!(overflow && overflow.alwaysByViewport); var visibleRect = getVisibleRectForElement(source2, alwaysByViewport); var elRegion = getRegion(source2); normalizeOffset(offset4, elRegion); normalizeOffset(targetOffset2, tgtRegion); var elFuturePos = getElFuturePos(elRegion, tgtRegion, points, offset4, targetOffset2); var newElRegion = utils$i.merge(elRegion, elFuturePos); if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTgtRegionVisible) { if (overflow.adjustX) { if (isFailX(elFuturePos, elRegion, visibleRect)) { var newPoints = flip(points, /[lr]/gi, { l: "r", r: "l" }); var newOffset = flipOffset(offset4, 0); var newTargetOffset = flipOffset(targetOffset2, 0); var newElFuturePos = getElFuturePos(elRegion, tgtRegion, newPoints, newOffset, newTargetOffset); if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) { fail = 1; points = newPoints; offset4 = newOffset; targetOffset2 = newTargetOffset; } } } if (overflow.adjustY) { if (isFailY(elFuturePos, elRegion, visibleRect)) { var _newPoints = flip(points, /[tb]/gi, { t: "b", b: "t" }); var _newOffset = flipOffset(offset4, 1); var _newTargetOffset = flipOffset(targetOffset2, 1); var _newElFuturePos = getElFuturePos(elRegion, tgtRegion, _newPoints, _newOffset, _newTargetOffset); if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) { fail = 1; points = _newPoints; offset4 = _newOffset; targetOffset2 = _newTargetOffset; } } } if (fail) { elFuturePos = getElFuturePos(elRegion, tgtRegion, points, offset4, targetOffset2); utils$i.mix(newElRegion, elFuturePos); } var isStillFailX = isFailX(elFuturePos, elRegion, visibleRect); var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect); if (isStillFailX || isStillFailY) { var _newPoints2 = points; if (isStillFailX) { _newPoints2 = flip(points, /[lr]/gi, { l: "r", r: "l" }); } if (isStillFailY) { _newPoints2 = flip(points, /[tb]/gi, { t: "b", b: "t" }); } points = _newPoints2; offset4 = align.offset || [0, 0]; targetOffset2 = align.targetOffset || [0, 0]; } newOverflowCfg.adjustX = overflow.adjustX && isStillFailX; newOverflowCfg.adjustY = overflow.adjustY && isStillFailY; if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) { newElRegion = adjustForViewport(elFuturePos, elRegion, visibleRect, newOverflowCfg); } } if (newElRegion.width !== elRegion.width) { utils$i.css(source2, "width", utils$i.width(source2) + newElRegion.width - elRegion.width); } if (newElRegion.height !== elRegion.height) { utils$i.css(source2, "height", utils$i.height(source2) + newElRegion.height - elRegion.height); } utils$i.offset(source2, { left: newElRegion.left, top: newElRegion.top }, { useCssRight: align.useCssRight, useCssBottom: align.useCssBottom, useCssTransform: align.useCssTransform, ignoreShake: align.ignoreShake }); return { points, offset: offset4, targetOffset: targetOffset2, overflow: newOverflowCfg }; } function isOutOfVisibleRect(target, alwaysByViewport) { var visibleRect = getVisibleRectForElement(target, alwaysByViewport); var targetRegion = getRegion(target); return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom; } function alignElement(el, refNode, align) { var target = align.target || refNode; var refNodeRegion = getRegion(target); var isTargetNotOutOfVisible = !isOutOfVisibleRect(target, align.overflow && align.overflow.alwaysByViewport); return doAlign(el, refNodeRegion, align, isTargetNotOutOfVisible); } alignElement.__getOffsetParent = getOffsetParent; alignElement.__getVisibleRectForElement = getVisibleRectForElement; function alignPoint(el, tgtPoint, align) { var pageX; var pageY; var doc = utils$i.getDocument(el); var win = doc.defaultView || doc.parentWindow; var scrollX = utils$i.getWindowScrollLeft(win); var scrollY = utils$i.getWindowScrollTop(win); var viewportWidth = utils$i.viewportWidth(win); var viewportHeight = utils$i.viewportHeight(win); if ("pageX" in tgtPoint) { pageX = tgtPoint.pageX; } else { pageX = scrollX + tgtPoint.clientX; } if ("pageY" in tgtPoint) { pageY = tgtPoint.pageY; } else { pageY = scrollY + tgtPoint.clientY; } var tgtRegion = { left: pageX, top: pageY, width: 0, height: 0 }; var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight; var points = [align.points[0], "cc"]; return doAlign(el, tgtRegion, _objectSpread2$1(_objectSpread2$1({}, align), {}, { points }), pointInView); } var isVisible = function(element) { if (!element) { return false; } if (element.offsetParent) { return true; } if (element.getBBox) { var box = element.getBBox(); if (box.width || box.height) { return true; } } if (element.getBoundingClientRect) { var _box = element.getBoundingClientRect(); if (_box.width || _box.height) { return true; } } return false; }; function isSamePoint(prev2, next2) { if (prev2 === next2) return true; if (!prev2 || !next2) return false; if ("pageX" in next2 && "pageY" in next2) { return prev2.pageX === next2.pageX && prev2.pageY === next2.pageY; } if ("clientX" in next2 && "clientY" in next2) { return prev2.clientX === next2.clientX && prev2.clientY === next2.clientY; } return false; } function restoreFocus(activeElement, container) { if (activeElement !== document.activeElement && contains(container, activeElement) && typeof activeElement.focus === "function") { activeElement.focus(); } } function monitorResize(element, callback2) { var prevWidth = null; var prevHeight = null; function onResize(_ref) { var _ref2 = _slicedToArray$4(_ref, 1), target = _ref2[0].target; if (!document.documentElement.contains(target)) return; var _target$getBoundingCl = target.getBoundingClientRect(), width = _target$getBoundingCl.width, height = _target$getBoundingCl.height; var fixedWidth = Math.floor(width); var fixedHeight = Math.floor(height); if (prevWidth !== fixedWidth || prevHeight !== fixedHeight) { Promise.resolve().then(function() { callback2({ width: fixedWidth, height: fixedHeight }); }); } prevWidth = fixedWidth; prevHeight = fixedHeight; } var resizeObserver = new index$G(onResize); if (element) { resizeObserver.observe(element); } return function() { resizeObserver.disconnect(); }; } var useBuffer = function(callback2, buffer) { var called = false; var timeout = null; function cancelTrigger() { window.clearTimeout(timeout); } function trigger2(force) { if (!called || force === true) { if (callback2() === false) { return; } called = true; cancelTrigger(); timeout = window.setTimeout(function() { called = false; }, buffer.value); } else { cancelTrigger(); timeout = window.setTimeout(function() { called = false; trigger2(); }, buffer.value); } } return [trigger2, function() { called = false; cancelTrigger(); }]; }; var alignProps = { align: Object, target: [Object, Function], onAlign: Function, monitorBufferTime: Number, monitorWindowResize: Boolean, disabled: Boolean }; function getElement(func) { if (typeof func !== "function") return null; return func(); } function getPoint(point) { if (_typeof$2(point) !== "object" || !point) return null; return point; } var Align = defineComponent({ name: "Align", props: alignProps, emits: ["align"], setup: function setup16(props2, _ref) { var expose = _ref.expose, slots = _ref.slots; var cacheRef = ref({}); var nodeRef = ref(); var forceAlignPropsRef = computed(function() { return { disabled: props2.disabled, target: props2.target, onAlign: props2.onAlign }; }); var _useBuffer = useBuffer(function() { var _forceAlignPropsRef$v = forceAlignPropsRef.value, latestDisabled = _forceAlignPropsRef$v.disabled, latestTarget = _forceAlignPropsRef$v.target, latestOnAlign = _forceAlignPropsRef$v.onAlign; if (!latestDisabled && latestTarget && nodeRef.value && nodeRef.value.$el) { var source2 = nodeRef.value.$el; var result; var element = getElement(latestTarget); var point = getPoint(latestTarget); cacheRef.value.element = element; cacheRef.value.point = point; var _document = document, activeElement = _document.activeElement; if (element && isVisible(element)) { result = alignElement(source2, element, props2.align); } else if (point) { result = alignPoint(source2, point, props2.align); } restoreFocus(activeElement, source2); if (latestOnAlign && result) { latestOnAlign(source2, result); } return true; } return false; }, computed(function() { return props2.monitorBufferTime; })), _useBuffer2 = _slicedToArray$4(_useBuffer, 2), _forceAlign = _useBuffer2[0], cancelForceAlign = _useBuffer2[1]; var resizeMonitor = ref({ cancel: function cancel2() { } }); var sourceResizeMonitor = ref({ cancel: function cancel2() { } }); var goAlign = function goAlign2() { var target = props2.target; var element = getElement(target); var point = getPoint(target); if (nodeRef.value && nodeRef.value.$el !== sourceResizeMonitor.value.element) { sourceResizeMonitor.value.cancel(); sourceResizeMonitor.value.element = nodeRef.value.$el; sourceResizeMonitor.value.cancel = monitorResize(nodeRef.value.$el, _forceAlign); } if (cacheRef.value.element !== element || !isSamePoint(cacheRef.value.point, point)) { _forceAlign(); if (resizeMonitor.value.element !== element) { resizeMonitor.value.cancel(); resizeMonitor.value.element = element; resizeMonitor.value.cancel = monitorResize(element, _forceAlign); } } }; onMounted(function() { goAlign(); }); onUpdated(function() { goAlign(); }); watch(function() { return props2.disabled; }, function(disabled) { if (!disabled) { _forceAlign(); } else { cancelForceAlign(); } }, { flush: "post" }); var winResizeRef = ref(null); watch(function() { return props2.monitorWindowResize; }, function(monitorWindowResize) { if (monitorWindowResize) { if (!winResizeRef.value) { winResizeRef.value = addEventListenerWrap(window, "resize", _forceAlign); } } else if (winResizeRef.value) { winResizeRef.value.remove(); winResizeRef.value = null; } }, { flush: "post" }); onUnmounted(function() { resizeMonitor.value.cancel(); sourceResizeMonitor.value.cancel(); if (winResizeRef.value) winResizeRef.value.remove(); cancelForceAlign(); }); expose({ forceAlign: function forceAlign() { return _forceAlign(true); } }); return function() { var child = slots === null || slots === void 0 ? void 0 : slots.default(); if (child) { return cloneElement(child[0], { ref: nodeRef }, true, true); } return child && child[0]; }; } }); var LazyRenderBox$1 = { name: "LazyRenderBox", props: { visible: PropsTypes.looseBool, hiddenClassName: PropsTypes.string }, render: function render7() { var hiddenClassName = this.$props.hiddenClassName; var child = getSlot$1(this); if (hiddenClassName || child && child.length > 1 || child && child[0] && child[0].type === Text) { return createVNode("div", null, [child]); } return child && child[0]; } }; var PopupInner = { props: { hiddenClassName: PropsTypes.string.def(""), prefixCls: PropsTypes.string, visible: PropsTypes.looseBool }, render: function render8() { var _this = this; var _a3, _b2; var _this$$props = this.$props, prefixCls2 = _this$$props.prefixCls, visible9 = _this$$props.visible, hiddenClassName = _this$$props.hiddenClassName; return createVNode("div", { "class": !visible9 ? hiddenClassName : "" }, [createVNode(LazyRenderBox$1, { "class": "".concat(prefixCls2, "-content"), "visible": visible9 }, { default: function _default8() { return [(_b2 = (_a3 = _this.$slots).default) === null || _b2 === void 0 ? void 0 : _b2.call(_a3)]; } })]); } }; var BaseMixin = { methods: { setState: function setState() { var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var callback2 = arguments.length > 1 ? arguments[1] : void 0; var newState = typeof state === "function" ? state(this.$data, this.$props) : state; if (this.getDerivedStateFromProps) { var s2 = this.getDerivedStateFromProps(getOptionProps(this), _extends$1(_extends$1({}, this.$data), newState)); if (s2 === null) { return; } else { newState = _extends$1(_extends$1({}, newState), s2 || {}); } } _extends$1(this.$data, newState); if (this._.isMounted) { this.$forceUpdate(); } nextTick(function() { callback2 && callback2(); }); }, __emit: function __emit() { var args = [].slice.call(arguments, 0); var eventName = args[0]; eventName = "on".concat(eventName[0].toUpperCase()).concat(eventName.substring(1)); var event = this.$props[eventName] || this.$attrs[eventName]; if (args.length && event) { if (Array.isArray(event)) { for (var i2 = 0, l2 = event.length; i2 < l2; i2++) { event[i2].apply(event, _toConsumableArray(args.slice(1))); } } else { event.apply(void 0, _toConsumableArray(args.slice(1))); } } } } }; function isPointsEq(a1, a2, isAlignPoint) { if (isAlignPoint) { return a1[0] === a2[0]; } return a1[0] === a2[0] && a1[1] === a2[1]; } function getAlignFromPlacement(builtinPlacements, placementStr, align) { var baseAlign = builtinPlacements[placementStr] || {}; return _extends$1(_extends$1({}, baseAlign), align); } function getAlignPopupClassName(builtinPlacements, prefixCls2, align, isAlignPoint) { var points = align.points; for (var placement2 in builtinPlacements) { if (builtinPlacements.hasOwnProperty(placement2)) { if (isPointsEq(builtinPlacements[placement2].points, points, isAlignPoint)) { return "".concat(prefixCls2, "-placement-").concat(placement2); } } } return ""; } function noop$v() { } function saveRef(name, component) { this[name] = component; } globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var getTransitionProps = function getTransitionProps2(transitionName2) { var opt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var transitionProps = transitionName2 ? _extends$1({ appear: true, appearToClass: "".concat(transitionName2, "-appear ").concat(transitionName2, "-appear-active"), enterFromClass: "".concat(transitionName2, "-enter ").concat(transitionName2, "-enter-prepare"), enterToClass: "".concat(transitionName2, "-enter ").concat(transitionName2, "-enter-active"), leaveFromClass: " ".concat(transitionName2, "-leave"), leaveActiveClass: "".concat(transitionName2, "-leave ").concat(transitionName2, "-leave-active"), leaveToClass: "".concat(transitionName2, "-leave ").concat(transitionName2, "-leave-active") }, opt) : _extends$1({ css: false }, opt); return transitionProps; }; var getTransitionGroupProps = function getTransitionGroupProps2(transitionName2) { var opt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var transitionProps = transitionName2 ? _extends$1({ appear: true, appearActiveClass: "".concat(transitionName2), appearToClass: "".concat(transitionName2, "-appear ").concat(transitionName2, "-appear-active"), enterFromClass: "".concat(transitionName2, "-appear ").concat(transitionName2, "-enter ").concat(transitionName2, "-appear-prepare ").concat(transitionName2, "-enter-prepare"), enterActiveClass: "".concat(transitionName2), enterToClass: "".concat(transitionName2, "-enter ").concat(transitionName2, "-appear ").concat(transitionName2, "-appear-active ").concat(transitionName2, "-enter-active"), leaveActiveClass: "".concat(transitionName2, " ").concat(transitionName2, "-leave"), leaveToClass: "".concat(transitionName2, "-leave-active") }, opt) : _extends$1({ css: false }, opt); return transitionProps; }; var Transition = Transition$2; var TransitionGroup = TransitionGroup$1; var getCollapsedHeight = function getCollapsedHeight2() { return { height: 0, opacity: 0 }; }; var getRealHeight = function getRealHeight2(node) { return { height: "".concat(node.scrollHeight, "px"), opacity: 1 }; }; var getCurrentHeight = function getCurrentHeight2(node) { return { height: "".concat(node.offsetHeight, "px") }; }; var collapseMotion = function collapseMotion2(style, className) { return { name: "ant-motion-collapse", appear: true, css: true, onBeforeEnter: function onBeforeEnter(node) { className.value = "ant-motion-collapse"; style.value = getCollapsedHeight(); }, onEnter: function onEnter2(node) { nextTick(function() { style.value = getRealHeight(node); }); }, onAfterEnter: function onAfterEnter() { className.value = ""; style.value = {}; }, onBeforeLeave: function onBeforeLeave(node) { className.value = "ant-motion-collapse"; style.value = getCurrentHeight(node); }, onLeave: function onLeave2(node) { window.setTimeout(function() { style.value = getCollapsedHeight(); }); }, onAfterLeave: function onAfterLeave() { className.value = ""; style.value = {}; } }; }; var Transition$1 = Transition; var Popup = { name: "VCTriggerPopup", mixins: [BaseMixin], inheritAttrs: false, props: { visible: PropsTypes.looseBool, getClassNameFromAlign: PropsTypes.func, getRootDomNode: PropsTypes.func, align: PropsTypes.any, destroyPopupOnHide: PropsTypes.looseBool, prefixCls: PropsTypes.string, getContainer: PropsTypes.func, transitionName: PropsTypes.string, animation: PropsTypes.any, maskAnimation: PropsTypes.string, maskTransitionName: PropsTypes.string, mask: PropsTypes.looseBool, zIndex: PropsTypes.number, popupClassName: PropsTypes.any, popupStyle: PropsTypes.object.def(function() { return {}; }), stretch: PropsTypes.string, point: PropsTypes.shape({ pageX: PropsTypes.number, pageY: PropsTypes.number }).loose }, data: function data2() { this.domEl = null; this.currentAlignClassName = void 0; this.transitionProps = {}; this.savePopupRef = saveRef.bind(this, "popupInstance"); this.saveAlignRef = saveRef.bind(this, "alignInstance"); return { stretchChecked: false, targetWidth: void 0, targetHeight: void 0 }; }, mounted: function mounted2() { var _this = this; this.$nextTick(function() { _this.rootNode = _this.getPopupDomNode(); _this.setStretchSize(); }); }, updated: function updated() { var _this2 = this; this.$nextTick(function() { _this2.setStretchSize(); }); }, methods: { onAlign: function onAlign(popupDomNode, align) { var props2 = this.$props; var currentAlignClassName = props2.getClassNameFromAlign(align); if (this.currentAlignClassName !== currentAlignClassName) { this.currentAlignClassName = currentAlignClassName; popupDomNode.className = this.getClassName(currentAlignClassName, popupDomNode.className); } var onaAlign = this.$attrs.onaAlign; onaAlign && onaAlign(popupDomNode, align); }, setStretchSize: function setStretchSize() { var _this$$props = this.$props, stretch = _this$$props.stretch, getRootDomNode2 = _this$$props.getRootDomNode, visible9 = _this$$props.visible; var _this$$data = this.$data, stretchChecked = _this$$data.stretchChecked, targetHeight = _this$$data.targetHeight, targetWidth = _this$$data.targetWidth; if (!stretch || !visible9) { if (stretchChecked) { this.setState({ stretchChecked: false }); } return; } var $ele = getRootDomNode2(); if (!$ele) return; var height = $ele.offsetHeight; var width = $ele.offsetWidth; if (targetHeight !== height || targetWidth !== width || !stretchChecked) { this.setState({ stretchChecked: true, targetHeight: height, targetWidth: width }); } }, getPopupDomNode: function getPopupDomNode() { return findDOMNode(this.popupInstance); }, getTargetElement: function getTargetElement() { return this.$props.getRootDomNode(); }, getAlignTarget: function getAlignTarget() { var point = this.$props.point; if (point) { return point; } return this.getTargetElement; }, getMaskTransitionName: function getMaskTransitionName() { var props2 = this.$props; var transitionName2 = props2.maskTransitionName; var animation2 = props2.maskAnimation; if (!transitionName2 && animation2) { transitionName2 = "".concat(props2.prefixCls, "-").concat(animation2); } return transitionName2; }, getTransitionName: function getTransitionName2() { var props2 = this.$props; var transitionName2 = props2.transitionName; var animation2 = props2.animation; if (!transitionName2) { if (typeof animation2 === "string") { transitionName2 = "".concat(animation2); } else if (animation2 && animation2.props && animation2.props.name) { transitionName2 = animation2.props.name; } } return transitionName2; }, getClassName: function getClassName(currentAlignClassName) { var _this3 = this; var originClassName = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; var enterActiveClass = []; if (this.transitionProps) { Object.keys(this.transitionProps).forEach(function(k2) { if (typeof _this3.transitionProps[k2] === "string") { enterActiveClass.push.apply(enterActiveClass, _toConsumableArray(_this3.transitionProps[k2].split(" "))); } }); } var classNames2 = originClassName.split(" ").filter(function(c2) { return enterActiveClass.indexOf(c2) !== -1; }).join(" "); return "".concat(this.$props.prefixCls, " ").concat(this.$attrs.class || "", " ").concat(this.$props.popupClassName, " ").concat(currentAlignClassName, " ").concat(classNames2); }, getPopupElement: function getPopupElement() { var _this4 = this; var _a3, _b2; var savePopupRef6 = this.savePopupRef; var props2 = this.$props, $attrs = this.$attrs, $slots = this.$slots, getTransitionName6 = this.getTransitionName; var _this$$data2 = this.$data, stretchChecked = _this$$data2.stretchChecked, targetHeight = _this$$data2.targetHeight, targetWidth = _this$$data2.targetWidth; var _$attrs$style = $attrs.style, style = _$attrs$style === void 0 ? {} : _$attrs$style; var onEvents = splitAttrs($attrs).onEvents; var align = props2.align, visible9 = props2.visible, prefixCls2 = props2.prefixCls, animation2 = props2.animation, popupStyle = props2.popupStyle, getClassNameFromAlign = props2.getClassNameFromAlign, destroyPopupOnHide = props2.destroyPopupOnHide, stretch = props2.stretch; var className = this.getClassName(this.currentAlignClassName || getClassNameFromAlign(align)); if (!visible9) { this.currentAlignClassName = null; } var sizeStyle = {}; if (stretch) { if (stretch.indexOf("height") !== -1) { sizeStyle.height = typeof targetHeight === "number" ? "".concat(targetHeight, "px") : targetHeight; } else if (stretch.indexOf("minHeight") !== -1) { sizeStyle.minHeight = typeof targetHeight === "number" ? "".concat(targetHeight, "px") : targetHeight; } if (stretch.indexOf("width") !== -1) { sizeStyle.width = typeof targetWidth === "number" ? "".concat(targetWidth, "px") : targetWidth; } else if (stretch.indexOf("minWidth") !== -1) { sizeStyle.minWidth = typeof targetWidth === "number" ? "".concat(targetWidth, "px") : targetWidth; } if (!stretchChecked) { setTimeout(function() { if (_this4.alignInstance) { _this4.alignInstance.forceAlign(); } }, 0); } } var popupInnerProps = _extends$1(_extends$1({ prefixCls: prefixCls2, visible: visible9, class: className }, onEvents), { ref: savePopupRef6, style: _extends$1(_extends$1(_extends$1(_extends$1({}, sizeStyle), popupStyle), style), this.getZIndexStyle()) }); var transitionName2 = getTransitionName6(); var useTransition = !!transitionName2; var transitionProps = getTransitionProps(transitionName2); if (_typeof$2(animation2) === "object") { useTransition = true; transitionProps = _extends$1(_extends$1({}, transitionProps), animation2); } if (!useTransition) { transitionProps = {}; } this.transitionProps = transitionProps; if (destroyPopupOnHide) { return createVNode(Transition, transitionProps, { default: function _default8() { return [visible9 ? createVNode(Align, { "target": _this4.getAlignTarget(), "key": "popup", "ref": _this4.saveAlignRef, "monitorWindowResize": true, "align": align, "onAlign": _this4.onAlign }, { default: function _default9() { return [createVNode(PopupInner, popupInnerProps, { default: function _default10() { return [(_a3 = $slots.default) === null || _a3 === void 0 ? void 0 : _a3.call($slots)]; } })]; } }) : null]; } }); } return createVNode(Transition, transitionProps, { default: function _default8() { return [withDirectives(createVNode(Align, { "target": _this4.getAlignTarget(), "key": "popup", "ref": _this4.saveAlignRef, "monitorWindowResize": true, "disabled": !visible9, "align": align, "onAlign": _this4.onAlign }, { default: function _default9() { return [createVNode(PopupInner, popupInnerProps, { default: function _default10() { return [(_b2 = $slots.default) === null || _b2 === void 0 ? void 0 : _b2.call($slots)]; } })]; } }), [[vShow, visible9]])]; } }); }, getZIndexStyle: function getZIndexStyle() { var style = {}; var props2 = this.$props; if (props2.zIndex !== void 0) { style.zIndex = props2.zIndex; } return style; }, getMaskElement: function getMaskElement() { var props2 = this.$props; var maskElement = null; if (props2.mask) { var maskTransition = this.getMaskTransitionName(); maskElement = withDirectives(createVNode(LazyRenderBox$1, { "style": this.getZIndexStyle(), "key": "mask", "class": "".concat(props2.prefixCls, "-mask"), "visible": props2.visible }, null), [[vShow, props2.visible]]); if (maskTransition) { var _maskElement = function() { return maskElement; }(); maskElement = createVNode(Transition, { "appear": true, "name": maskTransition }, { default: function _default8() { return [_maskElement]; } }); } } return maskElement; } }, render: function render9() { var getMaskElement3 = this.getMaskElement, getPopupElement4 = this.getPopupElement; return createVNode("div", null, [getMaskElement3(), getPopupElement4()]); } }; var Portal$1 = defineComponent({ name: "Portal", props: { getContainer: PropsTypes.func.isRequired, children: PropsTypes.any.isRequired, didUpdate: PropsTypes.func }, data: function data3() { this._container = null; return {}; }, mounted: function mounted3() { this.createContainer(); }, updated: function updated2() { var _this = this; var didUpdate = this.$props.didUpdate; if (didUpdate) { nextTick(function() { didUpdate(_this.$props); }); } }, beforeUnmount: function beforeUnmount2() { this.removeContainer(); }, methods: { createContainer: function createContainer() { this._container = this.$props.getContainer(); this.$forceUpdate(); }, removeContainer: function removeContainer() { if (this._container && this._container.parentNode) { this._container.parentNode.removeChild(this._container); } } }, render: function render10() { var _this2 = this; if (this._container) { return createVNode(Teleport, { "to": this._container }, { default: function _default8() { return [_this2.$props.children]; } }); } return null; } }); function returnEmptyString() { return ""; } function returnDocument() { return window.document; } var ALL_HANDLERS = ["onClick", "onMousedown", "onTouchstart", "onMouseenter", "onMouseleave", "onFocus", "onBlur", "onContextmenu"]; var Trigger = defineComponent({ name: "Trigger", mixins: [BaseMixin], inheritAttrs: false, props: { action: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.arrayOf(PropsTypes.string)]).def([]), showAction: PropsTypes.any.def([]), hideAction: PropsTypes.any.def([]), getPopupClassNameFromAlign: PropsTypes.any.def(returnEmptyString), onPopupVisibleChange: PropsTypes.func.def(noop$v), afterPopupVisibleChange: PropsTypes.func.def(noop$v), popup: PropsTypes.any, popupStyle: PropsTypes.object.def(function() { return {}; }), prefixCls: PropsTypes.string.def("rc-trigger-popup"), popupClassName: PropsTypes.string.def(""), popupPlacement: PropsTypes.string, builtinPlacements: PropsTypes.object, popupTransitionName: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.object]), popupAnimation: PropsTypes.any, mouseEnterDelay: PropsTypes.number.def(0), mouseLeaveDelay: PropsTypes.number.def(0.1), zIndex: PropsTypes.number, focusDelay: PropsTypes.number.def(0), blurDelay: PropsTypes.number.def(0.15), getPopupContainer: PropsTypes.func, getDocument: PropsTypes.func.def(returnDocument), forceRender: PropsTypes.looseBool, destroyPopupOnHide: PropsTypes.looseBool.def(false), mask: PropsTypes.looseBool.def(false), maskClosable: PropsTypes.looseBool.def(true), popupAlign: PropsTypes.object.def(function() { return {}; }), popupVisible: PropsTypes.looseBool, defaultPopupVisible: PropsTypes.looseBool.def(false), maskTransitionName: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.object]), maskAnimation: PropsTypes.string, stretch: PropsTypes.string, alignPoint: PropsTypes.looseBool }, setup: function setup17() { return { vcTriggerContext: inject("vcTriggerContext", {}), savePopupRef: inject("savePopupRef", noop$v), dialogContext: inject("dialogContext", null) }; }, data: function data4() { var _this = this; var props2 = this.$props; var popupVisible4; if (hasProp(this, "popupVisible")) { popupVisible4 = !!props2.popupVisible; } else { popupVisible4 = !!props2.defaultPopupVisible; } ALL_HANDLERS.forEach(function(h2) { _this["fire".concat(h2)] = function(e2) { _this.fireEvents(h2, e2); }; }); this._component = null; this.focusTime = null; this.clickOutsideHandler = null; this.contextmenuOutsideHandler1 = null; this.contextmenuOutsideHandler2 = null; this.touchOutsideHandler = null; return { prevPopupVisible: popupVisible4, sPopupVisible: popupVisible4, point: null }; }, watch: { popupVisible: function popupVisible(val) { if (val !== void 0) { this.prevPopupVisible = this.sPopupVisible; this.sPopupVisible = val; } } }, created: function created2() { provide("vcTriggerContext", this); }, deactivated: function deactivated() { this.setPopupVisible(false); }, mounted: function mounted4() { var _this2 = this; this.$nextTick(function() { _this2.updatedCal(); }); }, updated: function updated3() { var _this3 = this; this.$nextTick(function() { _this3.updatedCal(); }); }, beforeUnmount: function beforeUnmount3() { this.clearDelayTimer(); this.clearOutsideHandler(); clearTimeout(this.mouseDownTimeout); }, methods: { updatedCal: function updatedCal() { var props2 = this.$props; var state = this.$data; if (state.sPopupVisible) { var currentDocument; if (!this.clickOutsideHandler && (this.isClickToHide() || this.isContextmenuToShow())) { currentDocument = props2.getDocument(); this.clickOutsideHandler = addEventListenerWrap(currentDocument, "mousedown", this.onDocumentClick); } if (!this.touchOutsideHandler) { currentDocument = currentDocument || props2.getDocument(); this.touchOutsideHandler = addEventListenerWrap(currentDocument, "touchstart", this.onDocumentClick, supportsPassive$1 ? { passive: false } : false); } if (!this.contextmenuOutsideHandler1 && this.isContextmenuToShow()) { currentDocument = currentDocument || props2.getDocument(); this.contextmenuOutsideHandler1 = addEventListenerWrap(currentDocument, "scroll", this.onContextmenuClose); } if (!this.contextmenuOutsideHandler2 && this.isContextmenuToShow()) { this.contextmenuOutsideHandler2 = addEventListenerWrap(window, "blur", this.onContextmenuClose); } } else { this.clearOutsideHandler(); } }, onMouseenter: function onMouseenter(e2) { var mouseEnterDelay = this.$props.mouseEnterDelay; this.fireEvents("onMouseenter", e2); this.delaySetPopupVisible(true, mouseEnterDelay, mouseEnterDelay ? null : e2); }, onMouseMove: function onMouseMove2(e2) { this.fireEvents("onMousemove", e2); this.setPoint(e2); }, onMouseleave: function onMouseleave(e2) { this.fireEvents("onMouseleave", e2); this.delaySetPopupVisible(false, this.$props.mouseLeaveDelay); }, onPopupMouseenter: function onPopupMouseenter() { this.clearDelayTimer(); }, onPopupMouseleave: function onPopupMouseleave(e2) { if (e2 && e2.relatedTarget && !e2.relatedTarget.setTimeout && this._component && this._component.getPopupDomNode && contains(this._component.getPopupDomNode(), e2.relatedTarget)) { return; } this.delaySetPopupVisible(false, this.$props.mouseLeaveDelay); }, onFocus: function onFocus(e2) { this.fireEvents("onFocus", e2); this.clearDelayTimer(); if (this.isFocusToShow()) { this.focusTime = Date.now(); this.delaySetPopupVisible(true, this.$props.focusDelay); } }, onMousedown: function onMousedown(e2) { this.fireEvents("onMousedown", e2); this.preClickTime = Date.now(); }, onTouchstart: function onTouchstart(e2) { this.fireEvents("onTouchstart", e2); this.preTouchTime = Date.now(); }, onBlur: function onBlur(e2) { if (!contains(e2.target, e2.relatedTarget || document.activeElement)) { this.fireEvents("onBlur", e2); this.clearDelayTimer(); if (this.isBlurToHide()) { this.delaySetPopupVisible(false, this.$props.blurDelay); } } }, onContextmenu: function onContextmenu(e2) { e2.preventDefault(); this.fireEvents("onContextmenu", e2); this.setPopupVisible(true, e2); }, onContextmenuClose: function onContextmenuClose() { if (this.isContextmenuToShow()) { this.close(); } }, onClick: function onClick(event) { this.fireEvents("onClick", event); if (this.focusTime) { var preTime; if (this.preClickTime && this.preTouchTime) { preTime = Math.min(this.preClickTime, this.preTouchTime); } else if (this.preClickTime) { preTime = this.preClickTime; } else if (this.preTouchTime) { preTime = this.preTouchTime; } if (Math.abs(preTime - this.focusTime) < 20) { return; } this.focusTime = 0; } this.preClickTime = 0; this.preTouchTime = 0; if (this.isClickToShow() && (this.isClickToHide() || this.isBlurToHide()) && event && event.preventDefault) { event.preventDefault(); } if (event && event.domEvent) { event.domEvent.preventDefault(); } var nextVisible = !this.$data.sPopupVisible; if (this.isClickToHide() && !nextVisible || nextVisible && this.isClickToShow()) { this.setPopupVisible(!this.$data.sPopupVisible, event); } }, onPopupMouseDown: function onPopupMouseDown() { var _this4 = this; var _this$vcTriggerContex = this.vcTriggerContext, vcTriggerContext = _this$vcTriggerContex === void 0 ? {} : _this$vcTriggerContex; this.hasPopupMouseDown = true; clearTimeout(this.mouseDownTimeout); this.mouseDownTimeout = setTimeout(function() { _this4.hasPopupMouseDown = false; }, 0); if (vcTriggerContext.onPopupMouseDown) { vcTriggerContext.onPopupMouseDown.apply(vcTriggerContext, arguments); } }, onDocumentClick: function onDocumentClick(event) { if (this.$props.mask && !this.$props.maskClosable) { return; } var target = event.target; var root2 = findDOMNode(this); if (!contains(root2, target) && !this.hasPopupMouseDown) { this.close(); } }, getPopupDomNode: function getPopupDomNode2() { if (this._component && this._component.getPopupDomNode) { return this._component.getPopupDomNode(); } return null; }, getRootDomNode: function getRootDomNode() { return findDOMNode(this); }, handleGetPopupClassFromAlign: function handleGetPopupClassFromAlign(align) { var className = []; var props2 = this.$props; var popupPlacement = props2.popupPlacement, builtinPlacements = props2.builtinPlacements, prefixCls2 = props2.prefixCls, alignPoint2 = props2.alignPoint, getPopupClassNameFromAlign = props2.getPopupClassNameFromAlign; if (popupPlacement && builtinPlacements) { className.push(getAlignPopupClassName(builtinPlacements, prefixCls2, align, alignPoint2)); } if (getPopupClassNameFromAlign) { className.push(getPopupClassNameFromAlign(align)); } return className.join(" "); }, getPopupAlign: function getPopupAlign() { var props2 = this.$props; var popupPlacement = props2.popupPlacement, popupAlign = props2.popupAlign, builtinPlacements = props2.builtinPlacements; if (popupPlacement && builtinPlacements) { return getAlignFromPlacement(builtinPlacements, popupPlacement, popupAlign); } return popupAlign; }, savePopup: function savePopup(node) { this._component = node; this.savePopupRef(node); }, getComponent: function getComponent$1() { var self2 = this; var mouseProps = {}; if (this.isMouseEnterToShow()) { mouseProps.onMouseenter = self2.onPopupMouseenter; } if (this.isMouseLeaveToHide()) { mouseProps.onMouseleave = self2.onPopupMouseleave; } mouseProps.onMousedown = this.onPopupMouseDown; mouseProps[supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart"] = this.onPopupMouseDown; var handleGetPopupClassFromAlign2 = self2.handleGetPopupClassFromAlign, getRootDomNode2 = self2.getRootDomNode, getContainer5 = self2.getContainer, $attrs = self2.$attrs; var _self$$props = self2.$props, prefixCls2 = _self$$props.prefixCls, destroyPopupOnHide = _self$$props.destroyPopupOnHide, popupClassName = _self$$props.popupClassName, action = _self$$props.action, popupAnimation = _self$$props.popupAnimation, popupTransitionName = _self$$props.popupTransitionName, popupStyle = _self$$props.popupStyle, mask = _self$$props.mask, maskAnimation = _self$$props.maskAnimation, maskTransitionName = _self$$props.maskTransitionName, zIndex = _self$$props.zIndex, stretch = _self$$props.stretch, alignPoint2 = _self$$props.alignPoint; var _this$$data = this.$data, sPopupVisible = _this$$data.sPopupVisible, point = _this$$data.point; var align = this.getPopupAlign(); var popupProps = _extends$1(_extends$1({ prefixCls: prefixCls2, destroyPopupOnHide, visible: sPopupVisible, point: alignPoint2 ? point : null, action, align, animation: popupAnimation, getClassNameFromAlign: handleGetPopupClassFromAlign2, stretch, getRootDomNode: getRootDomNode2, mask, zIndex, transitionName: popupTransitionName, maskAnimation, maskTransitionName, getContainer: getContainer5, popupClassName, popupStyle, onAlign: $attrs.onPopupAlign || noop$v }, mouseProps), { ref: this.savePopup }); return createVNode(Popup, popupProps, { default: function _default8() { return [getComponent(self2, "popup")]; } }); }, getContainer: function getContainer2() { var props2 = this.$props, dialogContext = this.dialogContext; var popupContainer = document.createElement("div"); popupContainer.style.position = "absolute"; popupContainer.style.top = "0"; popupContainer.style.left = "0"; popupContainer.style.width = "100%"; var mountNode = props2.getPopupContainer ? props2.getPopupContainer(findDOMNode(this), dialogContext) : props2.getDocument().body; mountNode.appendChild(popupContainer); this.popupContainer = popupContainer; return popupContainer; }, setPopupVisible: function setPopupVisible(sPopupVisible, event) { var alignPoint2 = this.alignPoint, prevPopupVisible = this.sPopupVisible, onPopupVisibleChange = this.onPopupVisibleChange; this.clearDelayTimer(); if (prevPopupVisible !== sPopupVisible) { if (!hasProp(this, "popupVisible")) { this.setState({ sPopupVisible, prevPopupVisible }); } onPopupVisibleChange && onPopupVisibleChange(sPopupVisible); } if (alignPoint2 && event) { this.setPoint(event); } }, setPoint: function setPoint(point) { var alignPoint2 = this.$props.alignPoint; if (!alignPoint2 || !point) return; this.setState({ point: { pageX: point.pageX, pageY: point.pageY } }); }, handlePortalUpdate: function handlePortalUpdate() { if (this.prevPopupVisible !== this.sPopupVisible) { this.afterPopupVisibleChange(this.sPopupVisible); } }, delaySetPopupVisible: function delaySetPopupVisible(visible9, delayS, event) { var _this5 = this; var delay = delayS * 1e3; this.clearDelayTimer(); if (delay) { var point = event ? { pageX: event.pageX, pageY: event.pageY } : null; this.delayTimer = requestAnimationTimeout(function() { _this5.setPopupVisible(visible9, point); _this5.clearDelayTimer(); }, delay); } else { this.setPopupVisible(visible9, event); } }, clearDelayTimer: function clearDelayTimer() { if (this.delayTimer) { cancelAnimationTimeout(this.delayTimer); this.delayTimer = null; } }, clearOutsideHandler: function clearOutsideHandler() { if (this.clickOutsideHandler) { this.clickOutsideHandler.remove(); this.clickOutsideHandler = null; } if (this.contextmenuOutsideHandler1) { this.contextmenuOutsideHandler1.remove(); this.contextmenuOutsideHandler1 = null; } if (this.contextmenuOutsideHandler2) { this.contextmenuOutsideHandler2.remove(); this.contextmenuOutsideHandler2 = null; } if (this.touchOutsideHandler) { this.touchOutsideHandler.remove(); this.touchOutsideHandler = null; } }, createTwoChains: function createTwoChains(event) { var fn = function fn2() { }; var events = getEvents(this); if (this.childOriginEvents[event] && events[event]) { return this["fire".concat(event)]; } fn = this.childOriginEvents[event] || events[event] || fn; return fn; }, isClickToShow: function isClickToShow() { var _this$$props = this.$props, action = _this$$props.action, showAction = _this$$props.showAction; return action.indexOf("click") !== -1 || showAction.indexOf("click") !== -1; }, isContextmenuToShow: function isContextmenuToShow() { var _this$$props2 = this.$props, action = _this$$props2.action, showAction = _this$$props2.showAction; return action.indexOf("contextmenu") !== -1 || showAction.indexOf("contextmenu") !== -1; }, isClickToHide: function isClickToHide() { var _this$$props3 = this.$props, action = _this$$props3.action, hideAction = _this$$props3.hideAction; return action.indexOf("click") !== -1 || hideAction.indexOf("click") !== -1; }, isMouseEnterToShow: function isMouseEnterToShow() { var _this$$props4 = this.$props, action = _this$$props4.action, showAction = _this$$props4.showAction; return action.indexOf("hover") !== -1 || showAction.indexOf("mouseenter") !== -1; }, isMouseLeaveToHide: function isMouseLeaveToHide() { var _this$$props5 = this.$props, action = _this$$props5.action, hideAction = _this$$props5.hideAction; return action.indexOf("hover") !== -1 || hideAction.indexOf("mouseleave") !== -1; }, isFocusToShow: function isFocusToShow() { var _this$$props6 = this.$props, action = _this$$props6.action, showAction = _this$$props6.showAction; return action.indexOf("focus") !== -1 || showAction.indexOf("focus") !== -1; }, isBlurToHide: function isBlurToHide() { var _this$$props7 = this.$props, action = _this$$props7.action, hideAction = _this$$props7.hideAction; return action.indexOf("focus") !== -1 || hideAction.indexOf("blur") !== -1; }, forcePopupAlign: function forcePopupAlign() { if (this.$data.sPopupVisible && this._component && this._component.alignInstance) { this._component.alignInstance.forceAlign(); } }, fireEvents: function fireEvents(type2, e2) { if (this.childOriginEvents[type2]) { this.childOriginEvents[type2](e2); } var event = this.$props[type2] || this.$attrs[type2]; if (event) { event(e2); } }, close: function close() { this.setPopupVisible(false); } }, render: function render11() { var _this6 = this; var sPopupVisible = this.sPopupVisible, $attrs = this.$attrs; var children = filterEmpty(getSlot$1(this)); var _this$$props8 = this.$props, forceRender = _this$$props8.forceRender, alignPoint2 = _this$$props8.alignPoint; if (children.length > 1) { warning$5(false, "Trigger children just support only one default", true); } var child = children[0]; this.childOriginEvents = getEvents(child); var newChildProps = { key: "trigger" }; if (this.isContextmenuToShow()) { newChildProps.onContextmenu = this.onContextmenu; } else { newChildProps.onContextmenu = this.createTwoChains("onContextmenu"); } if (this.isClickToHide() || this.isClickToShow()) { newChildProps.onClick = this.onClick; newChildProps.onMousedown = this.onMousedown; newChildProps[supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart"] = this.onTouchstart; } else { newChildProps.onClick = this.createTwoChains("onClick"); newChildProps.onMousedown = this.createTwoChains("onMousedown"); newChildProps[supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart"] = this.createTwoChains("onTouchstart"); } if (this.isMouseEnterToShow()) { newChildProps.onMouseenter = this.onMouseenter; if (alignPoint2) { newChildProps.onMousemove = this.onMouseMove; } } else { newChildProps.onMouseenter = this.createTwoChains("onMouseenter"); } if (this.isMouseLeaveToHide()) { newChildProps.onMouseleave = this.onMouseleave; } else { newChildProps.onMouseleave = this.createTwoChains("onMouseleave"); } if (this.isFocusToShow() || this.isBlurToHide()) { newChildProps.onFocus = this.onFocus; newChildProps.onBlur = this.onBlur; } else { newChildProps.onFocus = this.createTwoChains("onFocus"); newChildProps.onBlur = function(e2) { if (e2 && (!e2.relatedTarget || !contains(e2.target, e2.relatedTarget))) { _this6.createTwoChains("onBlur")(e2); } }; } var childrenClassName = classNames(child && child.props && child.props.class, $attrs.class); if (childrenClassName) { newChildProps.class = childrenClassName; } var trigger2 = cloneElement(child, newChildProps); var portal; if (sPopupVisible || this._component || forceRender) { portal = createVNode(Portal$1, { "key": "portal", "children": this.getComponent(), "getContainer": this.getContainer, "didUpdate": this.handlePortalUpdate }, null); } return [portal, trigger2]; } }); var __rest$C = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var getBuiltInPlacements = function getBuiltInPlacements2(dropdownMatchSelectWidth) { var adjustX = typeof dropdownMatchSelectWidth !== "number" ? 0 : 1; return { bottomLeft: { points: ["tl", "bl"], offset: [0, 4], overflow: { adjustX, adjustY: 1 } }, bottomRight: { points: ["tr", "br"], offset: [0, 4], overflow: { adjustX, adjustY: 1 } }, topLeft: { points: ["bl", "tl"], offset: [0, -4], overflow: { adjustX, adjustY: 1 } }, topRight: { points: ["br", "tr"], offset: [0, -4], overflow: { adjustX, adjustY: 1 } } }; }; var SelectTrigger$2 = defineComponent({ name: "SelectTrigger", inheritAttrs: false, created: function created3() { this.popupRef = createRef$1(); }, methods: { getPopupElement: function getPopupElement2() { return this.popupRef.current; } }, render: function render12() { var _this = this; var _a3 = _extends$1(_extends$1({}, this.$props), this.$attrs), _a$empty = _a3.empty, empty2 = _a$empty === void 0 ? false : _a$empty, props2 = __rest$C(_a3, ["empty"]); var visible9 = props2.visible, dropdownAlign = props2.dropdownAlign, prefixCls2 = props2.prefixCls, popupElement = props2.popupElement, dropdownClassName = props2.dropdownClassName, dropdownStyle = props2.dropdownStyle, dropdownMatchSelectWidth = props2.dropdownMatchSelectWidth, containerWidth = props2.containerWidth, dropdownRender = props2.dropdownRender, animation2 = props2.animation, transitionName2 = props2.transitionName, direction = props2.direction, getPopupContainer2 = props2.getPopupContainer; var dropdownPrefixCls = "".concat(prefixCls2, "-dropdown"); var popupNode = popupElement; if (dropdownRender) { popupNode = dropdownRender({ menuNode: popupElement, props: props2 }); } var builtInPlacements = getBuiltInPlacements(dropdownMatchSelectWidth); var mergedTransitionName = animation2 ? "".concat(dropdownPrefixCls, "-").concat(animation2) : transitionName2; var popupStyle = _extends$1({ minWidth: "".concat(containerWidth, "px") }, dropdownStyle); if (typeof dropdownMatchSelectWidth === "number") { popupStyle.width = "".concat(dropdownMatchSelectWidth, "px"); } else if (dropdownMatchSelectWidth) { popupStyle.width = "".concat(containerWidth, "px"); } return createVNode(Trigger, _objectSpread2$2(_objectSpread2$2({}, props2), {}, { "showAction": [], "hideAction": [], "popupPlacement": direction === "rtl" ? "bottomRight" : "bottomLeft", "builtinPlacements": builtInPlacements, "prefixCls": dropdownPrefixCls, "popupTransitionName": mergedTransitionName, "popup": createVNode("div", { "ref": this.popupRef }, [popupNode]), "popupAlign": dropdownAlign, "popupVisible": visible9, "getPopupContainer": getPopupContainer2, "popupClassName": classNames(dropdownClassName, _defineProperty$12({}, "".concat(dropdownPrefixCls, "-empty"), empty2)), "popupStyle": popupStyle }), { default: function _default8() { return [getSlot$1(_this)[0]]; } }); } }); SelectTrigger$2.props = { dropdownAlign: PropsTypes.object, visible: PropsTypes.looseBool, disabled: PropsTypes.looseBool, dropdownClassName: PropsTypes.string, dropdownStyle: PropsTypes.object, empty: PropsTypes.looseBool, prefixCls: PropsTypes.string, popupClassName: PropsTypes.string, animation: PropsTypes.string, transitionName: PropsTypes.string, getPopupContainer: PropsTypes.func, dropdownRender: PropsTypes.func, containerWidth: PropsTypes.number, dropdownMatchSelectWidth: PropsTypes.oneOfType([Number, Boolean]).def(true), popupElement: PropsTypes.any, direction: PropsTypes.string, getTriggerDOMNode: PropsTypes.func }; var SelectTrigger$3 = SelectTrigger$2; var INTERNAL_PROPS_MARK = "RC_SELECT_INTERNAL_PROPS_MARK"; function useDelayReset() { var timeout = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 10; var bool = ref(false); var delay; var cancelLatest = function cancelLatest2() { window.clearTimeout(delay); }; onMounted(function() { cancelLatest(); }); var delaySetBool = function delaySetBool2(value24, callback2) { cancelLatest(); delay = window.setTimeout(function() { bool.value = value24; if (callback2) { callback2(); } }, timeout); }; return [bool, delaySetBool, cancelLatest]; } function useSelectTriggerControl(refs, open6, triggerOpen) { function onGlobalMouseDown(event) { var _a3, _b2, _c; var target = event.target; if (target.shadowRoot && event.composed) { target = event.composedPath()[0] || target; } var elements = [(_a3 = refs[0]) === null || _a3 === void 0 ? void 0 : _a3.value, (_c = (_b2 = refs[1]) === null || _b2 === void 0 ? void 0 : _b2.value) === null || _c === void 0 ? void 0 : _c.getPopupElement()]; if (open6.value && elements.every(function(element) { return element && !element.contains(target) && element !== target; })) { triggerOpen(false); } } onMounted(function() { window.addEventListener("mousedown", onGlobalMouseDown); }); onBeforeUnmount(function() { window.removeEventListener("mousedown", onGlobalMouseDown); }); } function useCacheDisplayValue(values2) { var prevValues = _toConsumableArray(values2.value); var mergedValues = computed(function() { var valueLabels = /* @__PURE__ */ new Map(); prevValues.forEach(function(_ref) { var value24 = _ref.value, label = _ref.label; if (value24 !== label) { valueLabels.set(value24, label); } }); var resultValues = values2.value.map(function(item) { var cacheLabel = valueLabels.get(item.value); if (item.isCacheable && cacheLabel) { return _extends$1(_extends$1({}, item), { label: cacheLabel }); } return item; }); prevValues = resultValues; return resultValues; }); return mergedValues; } function useCacheOptions(options2) { var optionMap = computed(function() { var map2 = /* @__PURE__ */ new Map(); options2.value.forEach(function(item) { var value24 = item.data.value; map2.set(value24, item); }); return map2; }); var getValueOption = function getValueOption2(vals) { return vals.map(function(value24) { return optionMap.value.get(value24); }).filter(Boolean); }; return getValueOption; } var initDefaultProps = function initDefaultProps3(types2, defaultProps2) { var propTypes2 = _extends$1({}, types2); Object.keys(defaultProps2).forEach(function(k2) { var prop = propTypes2[k2]; if (prop) { prop.default = defaultProps2[k2]; } else { throw new Error("not have ".concat(k2, " prop")); } }); return propTypes2; }; var initDefaultProps$1 = initDefaultProps; var isMobile$2 = function() { if (typeof navigator === "undefined" || typeof window === "undefined") { return false; } var agent = navigator.userAgent || navigator.vendor || window.opera; if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(agent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(agent === null || agent === void 0 ? void 0 : agent.substr(0, 4))) { return true; } return false; }; var __rest$B = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var DEFAULT_OMIT_PROPS = ["children", "removeIcon", "placeholder", "autofocus", "maxTagCount", "maxTagTextLength", "maxTagPlaceholder", "choiceTransitionName", "onInputKeyDown", "tabindex"]; var BaseProps = function BaseProps2() { return { prefixCls: PropsTypes.string, id: PropsTypes.string, class: PropsTypes.string, style: PropsTypes.any, options: PropsTypes.array, mode: PropsTypes.string, value: PropsTypes.any, defaultValue: PropsTypes.any, labelInValue: PropsTypes.looseBool, inputValue: PropsTypes.string, searchValue: PropsTypes.string, optionFilterProp: PropsTypes.string, filterOption: PropsTypes.any, filterSort: PropsTypes.func, showSearch: PropsTypes.looseBool, autoClearSearchValue: PropsTypes.looseBool, onSearch: PropsTypes.func, onClear: PropsTypes.func, allowClear: PropsTypes.looseBool, clearIcon: PropsTypes.VNodeChild, showArrow: PropsTypes.looseBool, inputIcon: PropsTypes.VNodeChild, removeIcon: PropsTypes.VNodeChild, menuItemSelectedIcon: PropsTypes.VNodeChild, open: PropsTypes.looseBool, defaultOpen: PropsTypes.looseBool, listHeight: PropsTypes.number, listItemHeight: PropsTypes.number, dropdownStyle: PropsTypes.object, dropdownClassName: PropsTypes.string, dropdownMatchSelectWidth: withUndefined(PropsTypes.oneOfType([Boolean, Number])), virtual: PropsTypes.looseBool, dropdownRender: PropsTypes.func, dropdownAlign: PropsTypes.any, animation: PropsTypes.string, transitionName: PropsTypes.string, getPopupContainer: PropsTypes.func, direction: PropsTypes.string, disabled: PropsTypes.looseBool, loading: PropsTypes.looseBool, autofocus: PropsTypes.looseBool, defaultActiveFirstOption: PropsTypes.looseBool, notFoundContent: PropsTypes.VNodeChild, placeholder: PropsTypes.VNodeChild, backfill: PropsTypes.looseBool, getInputElement: PropsTypes.func, optionLabelProp: PropsTypes.string, maxTagTextLength: PropsTypes.number, maxTagCount: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), maxTagPlaceholder: PropsTypes.any, tokenSeparators: PropsTypes.arrayOf(PropsTypes.string), tagRender: PropsTypes.func, showAction: PropsTypes.array, tabindex: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), onKeyup: PropsTypes.func, onKeydown: PropsTypes.func, onPopupScroll: PropsTypes.func, onDropdownVisibleChange: PropsTypes.func, onSelect: PropsTypes.func, onDeselect: PropsTypes.func, onInputKeyDown: { type: Function }, onClick: PropsTypes.func, onChange: PropsTypes.func, onBlur: PropsTypes.func, onFocus: PropsTypes.func, onMousedown: PropsTypes.func, onMouseenter: PropsTypes.func, onMouseleave: PropsTypes.func, choiceTransitionName: PropsTypes.string, internalProps: PropsTypes.object, children: PropsTypes.array }; }; function generateSelector$1(config3) { var defaultPrefixCls = config3.prefixCls, OptionList2 = config3.components.optionList, convertChildrenToData2 = config3.convertChildrenToData, flattenOptions2 = config3.flattenOptions, getLabeledValue3 = config3.getLabeledValue, filterOptions2 = config3.filterOptions, isValueDisabled2 = config3.isValueDisabled, findValueOption2 = config3.findValueOption; config3.warningProps; var fillOptionsWithMissingValue2 = config3.fillOptionsWithMissingValue, omitDOMProps = config3.omitDOMProps; var Select2 = defineComponent({ name: "Select", slots: ["option"], props: initDefaultProps$1(BaseProps(), {}), setup: function setup123(props2) { var _a3; var useInternalProps = computed(function() { return props2.internalProps && props2.internalProps.mark === INTERNAL_PROPS_MARK; }); warning$5(props2.optionFilterProp !== "children", "Select", "optionFilterProp not support children, please use label instead"); var containerRef = ref(null); var triggerRef = ref(null); var selectorRef = ref(null); var listRef = ref(null); var tokenWithEnter = computed(function() { return (props2.tokenSeparators || []).some(function(tokenSeparator) { return ["\n", "\r\n"].includes(tokenSeparator); }); }); var _useDelayReset = useDelayReset(), _useDelayReset2 = _slicedToArray$4(_useDelayReset, 3), mockFocused = _useDelayReset2[0], setMockFocused = _useDelayReset2[1], cancelSetMockFocused = _useDelayReset2[2]; var mergedId = computed(function() { return props2.id || "rc_select_".concat(getUUID()); }); var mergedOptionLabelProp = computed(function() { var mergedOptionLabelProp2 = props2.optionLabelProp; if (mergedOptionLabelProp2 === void 0) { mergedOptionLabelProp2 = props2.options ? "label" : "children"; } return mergedOptionLabelProp2; }); var mergedLabelInValue = computed(function() { return props2.mode === "combobox" ? false : props2.labelInValue; }); var isMultiple2 = computed(function() { return props2.mode === "tags" || props2.mode === "multiple"; }); var mergedShowSearch = computed(function() { return props2.showSearch !== void 0 ? props2.showSearch : isMultiple2.value || props2.mode === "combobox"; }); var mobile = ref(false); onMounted(function() { mobile.value = isMobile$2(); }); var selectorDomRef = createRef$1(); var innerSearchValue = ref(""); var setInnerSearchValue = function setInnerSearchValue2(val) { innerSearchValue.value = val; }; var mergedValue = ref(props2.value !== void 0 ? props2.value : props2.defaultValue); watch(function() { return props2.value; }, function() { mergedValue.value = props2.value; innerSearchValue.value = ""; }); var mergedRawValueArr = computed(function() { return toInnerValue(mergedValue.value, { labelInValue: mergedLabelInValue.value, combobox: props2.mode === "combobox" }); }); var mergedRawValue = computed(function() { return mergedRawValueArr.value[0]; }); var mergedValueMap = computed(function() { return mergedRawValueArr.value[1]; }); var rawValues = computed(function() { return new Set(mergedRawValue.value); }); var activeValue = ref(null); var setActiveValue = function setActiveValue2(val) { activeValue.value = val; }; var mergedSearchValue = computed(function() { var mergedSearchValue2 = innerSearchValue.value; if (props2.mode === "combobox" && mergedValue.value !== void 0) { mergedSearchValue2 = mergedValue.value; } else if (props2.searchValue !== void 0) { mergedSearchValue2 = props2.searchValue; } else if (props2.inputValue) { mergedSearchValue2 = props2.inputValue; } return mergedSearchValue2; }); var mergedOptions = computed(function() { var newOptions = props2.options; if (newOptions === void 0) { newOptions = convertChildrenToData2(props2.children); } if (props2.mode === "tags" && fillOptionsWithMissingValue2) { newOptions = fillOptionsWithMissingValue2(newOptions, mergedValue.value, mergedOptionLabelProp.value, props2.labelInValue); } return newOptions || []; }); var mergedFlattenOptions = computed(function() { return flattenOptions2(mergedOptions.value, props2); }); var getValueOption = useCacheOptions(mergedFlattenOptions); var displayOptions = computed(function() { if (!mergedSearchValue.value || !mergedShowSearch.value) { return _toConsumableArray(mergedOptions.value); } var _props$optionFilterPr = props2.optionFilterProp, optionFilterProp = _props$optionFilterPr === void 0 ? "value" : _props$optionFilterPr, mode3 = props2.mode, filterOption = props2.filterOption; var filteredOptions = filterOptions2(mergedSearchValue.value, mergedOptions.value, { optionFilterProp, filterOption: mode3 === "combobox" && filterOption === void 0 ? function() { return true; } : filterOption }); if (mode3 === "tags" && filteredOptions.every(function(opt) { return opt[optionFilterProp] !== mergedSearchValue.value; })) { filteredOptions.unshift({ value: mergedSearchValue.value, label: mergedSearchValue.value, key: "__RC_SELECT_TAG_PLACEHOLDER__" }); } if (props2.filterSort && Array.isArray(filteredOptions)) { return _toConsumableArray(filteredOptions).sort(props2.filterSort); } return filteredOptions; }); var displayFlattenOptions = computed(function() { return flattenOptions2(displayOptions.value, props2); }); onMounted(function() { watch(mergedSearchValue, function() { if (listRef.value && listRef.value.scrollTo) { listRef.value.scrollTo(0); } }, { flush: "post", immediate: true }); }); var displayValues = computed(function() { var tmpValues = mergedRawValue.value.map(function(val) { var valueOptions = getValueOption([val]); var displayValue = getLabeledValue3(val, { options: valueOptions, prevValueMap: mergedValueMap.value, labelInValue: mergedLabelInValue.value, optionLabelProp: mergedOptionLabelProp.value }); return _extends$1(_extends$1({}, displayValue), { disabled: isValueDisabled2(val, valueOptions) }); }); if (!props2.mode && tmpValues.length === 1 && tmpValues[0].value === null && tmpValues[0].label === null) { return []; } return tmpValues; }); displayValues = useCacheDisplayValue(displayValues); var triggerSelect = function triggerSelect2(newValue, isSelect, source2) { var newValueOption = getValueOption([newValue]); var outOption = findValueOption2([newValue], newValueOption)[0]; var _props$internalProps = props2.internalProps, internalProps = _props$internalProps === void 0 ? {} : _props$internalProps; if (!internalProps.skipTriggerSelect) { var selectValue = mergedLabelInValue.value ? getLabeledValue3(newValue, { options: newValueOption, prevValueMap: mergedValueMap.value, labelInValue: mergedLabelInValue.value, optionLabelProp: mergedOptionLabelProp.value }) : newValue; if (isSelect && props2.onSelect) { props2.onSelect(selectValue, outOption); } else if (!isSelect && props2.onDeselect) { props2.onDeselect(selectValue, outOption); } } if (useInternalProps.value) { if (isSelect && internalProps.onRawSelect) { internalProps.onRawSelect(newValue, outOption, source2); } else if (!isSelect && internalProps.onRawDeselect) { internalProps.onRawDeselect(newValue, outOption, source2); } } }; var prevValueOptions = ref([]); var setPrevValueOptions = function setPrevValueOptions2(val) { prevValueOptions.value = val; }; var triggerChange4 = function triggerChange5(newRawValues) { if (useInternalProps.value && props2.internalProps && props2.internalProps.skipTriggerChange) { return; } var newRawValuesOptions = getValueOption(newRawValues); var outValues = toOuterValues(Array.from(newRawValues), { labelInValue: mergedLabelInValue.value, options: newRawValuesOptions, getLabeledValue: getLabeledValue3, prevValueMap: mergedValueMap.value, optionLabelProp: mergedOptionLabelProp.value }); var outValue = isMultiple2.value ? outValues : outValues[0]; if (props2.onChange && (mergedRawValue.value.length !== 0 || outValues.length !== 0)) { var outOptions = findValueOption2(newRawValues, newRawValuesOptions, { prevValueOptions: prevValueOptions.value }); setPrevValueOptions(outOptions.map(function(option, index2) { var clone4 = _extends$1({}, option); Object.defineProperty(clone4, "_INTERNAL_OPTION_VALUE_", { get: function get2() { return newRawValues[index2]; } }); return clone4; })); props2.onChange(outValue, isMultiple2.value ? outOptions : outOptions[0]); } mergedValue.value = outValue; }; var onInternalSelect = function onInternalSelect2(newValue, _ref) { var selected = _ref.selected, source2 = _ref.source; var _props$autoClearSearc = props2.autoClearSearchValue, autoClearSearchValue = _props$autoClearSearc === void 0 ? true : _props$autoClearSearc; if (props2.disabled) { return; } var newRawValue; if (isMultiple2.value) { newRawValue = new Set(mergedRawValue.value); if (selected) { newRawValue.add(newValue); } else { newRawValue.delete(newValue); } } else { newRawValue = /* @__PURE__ */ new Set(); newRawValue.add(newValue); } if (isMultiple2.value || !isMultiple2.value && Array.from(mergedRawValue.value)[0] !== newValue) { triggerChange4(Array.from(newRawValue)); } triggerSelect(newValue, !isMultiple2.value || selected, source2); if (props2.mode === "combobox") { setInnerSearchValue(String(newValue)); setActiveValue(""); } else if (!isMultiple2.value || autoClearSearchValue) { setInnerSearchValue(""); setActiveValue(""); } }; var onInternalOptionSelect = function onInternalOptionSelect2(newValue, info3) { onInternalSelect(newValue, _extends$1(_extends$1({}, info3), { source: "option" })); }; var onInternalSelectionSelect = function onInternalSelectionSelect2(newValue, info3) { onInternalSelect(newValue, _extends$1(_extends$1({}, info3), { source: "selection" })); }; var initOpen = props2.open !== void 0 ? props2.open : props2.defaultOpen; var innerOpen = ref(initOpen); var mergedOpen = ref(initOpen); var setInnerOpen = function setInnerOpen2(val) { innerOpen.value = props2.open !== void 0 ? props2.open : val; mergedOpen.value = innerOpen.value; }; watch(function() { return props2.open; }, function() { setInnerOpen(props2.open); }); var emptyListContent = computed(function() { return !props2.notFoundContent && !displayOptions.value.length; }); watchEffect(function() { mergedOpen.value = innerOpen.value; if (props2.disabled || emptyListContent.value && mergedOpen.value && props2.mode === "combobox") { mergedOpen.value = false; } }); var triggerOpen = computed(function() { return emptyListContent.value ? false : mergedOpen.value; }); var onToggleOpen = function onToggleOpen2(newOpen) { var nextOpen = newOpen !== void 0 ? newOpen : !mergedOpen.value; if (innerOpen.value !== nextOpen && !props2.disabled) { setInnerOpen(nextOpen); if (props2.onDropdownVisibleChange) { props2.onDropdownVisibleChange(nextOpen); } } }; useSelectTriggerControl([containerRef, triggerRef], triggerOpen, onToggleOpen); var triggerSearch = function triggerSearch2(searchText, fromTyping, isCompositing) { var ret = true; var newSearchText = searchText; var preSearchValue = mergedSearchValue.value; setActiveValue(null); var patchLabels = isCompositing ? null : getSeparatedContent(searchText, props2.tokenSeparators); var patchRawValues = patchLabels; if (props2.mode === "combobox") { if (fromTyping) { triggerChange4([newSearchText]); } } else if (patchLabels) { newSearchText = ""; if (props2.mode !== "tags") { patchRawValues = patchLabels.map(function(label) { var item = mergedFlattenOptions.value.find(function(_ref2) { var data65 = _ref2.data; return data65[mergedOptionLabelProp.value] === label; }); return item ? item.data.value : null; }).filter(function(val) { return val !== null; }); } var newRawValues = Array.from(new Set([].concat(_toConsumableArray(mergedRawValue.value), _toConsumableArray(patchRawValues)))); triggerChange4(newRawValues); newRawValues.forEach(function(newRawValue) { triggerSelect(newRawValue, true, "input"); }); onToggleOpen(false); ret = false; } setInnerSearchValue(newSearchText); if (props2.onSearch && preSearchValue !== newSearchText) { props2.onSearch(newSearchText); } return ret; }; var onSearchSubmit = function onSearchSubmit2(searchText) { if (!searchText || !searchText.trim()) { return; } var newRawValues = Array.from(new Set([].concat(_toConsumableArray(mergedRawValue.value), [searchText]))); triggerChange4(newRawValues); newRawValues.forEach(function(newRawValue) { triggerSelect(newRawValue, true, "input"); }); setInnerSearchValue(""); }; watch(function() { return props2.disabled; }, function() { if (innerOpen.value && !!props2.disabled) { setInnerOpen(false); } }, { immediate: true }); watch(mergedOpen, function() { if (!mergedOpen.value && !isMultiple2.value && props2.mode !== "combobox") { triggerSearch("", false, false); } }, { immediate: true }); var _useLock = useLock(), _useLock2 = _slicedToArray$4(_useLock, 2), getClearLock = _useLock2[0], setClearLock = _useLock2[1]; var onInternalKeyDown = function onInternalKeyDown2(event) { var clearLock = getClearLock(); var which = event.which; if (which === KeyCode$1.ENTER) { if (props2.mode !== "combobox") { event.preventDefault(); } if (!mergedOpen.value) { onToggleOpen(true); } } setClearLock(!!mergedSearchValue.value); if (which === KeyCode$1.BACKSPACE && !clearLock && isMultiple2.value && !mergedSearchValue.value && mergedRawValue.value.length) { var removeInfo = removeLastEnabledValue(displayValues.value, mergedRawValue.value); if (removeInfo.removedValue !== null) { triggerChange4(removeInfo.values); triggerSelect(removeInfo.removedValue, false, "input"); } } if (mergedOpen.value && listRef.value) { listRef.value.onKeydown(event); } if (props2.onKeydown) { props2.onKeydown(event); } }; var onInternalKeyUp = function onInternalKeyUp2(event) { if (mergedOpen.value && listRef.value) { listRef.value.onKeyup(event); } if (props2.onKeyup) { props2.onKeyup(event); } }; var focusRef = ref(false); var onContainerFocus = function onContainerFocus2() { setMockFocused(true); if (!props2.disabled) { if (props2.onFocus && !focusRef.value) { props2.onFocus(arguments.length <= 0 ? void 0 : arguments[0]); } if (props2.showAction && props2.showAction.includes("focus")) { onToggleOpen(true); } } focusRef.value = true; }; var onContainerBlur = function onContainerBlur2() { setMockFocused(false, function() { focusRef.value = false; onToggleOpen(false); }); if (props2.disabled) { return; } var searchVal = mergedSearchValue.value; if (searchVal) { if (props2.mode === "tags") { triggerSearch("", false, false); triggerChange4(Array.from(new Set([].concat(_toConsumableArray(mergedRawValue.value), [searchVal])))); } else if (props2.mode === "multiple") { setInnerSearchValue(""); } } if (props2.onBlur) { props2.onBlur(arguments.length <= 0 ? void 0 : arguments[0]); } }; provide("VCSelectContainerEvent", { focus: onContainerFocus, blur: onContainerBlur }); var activeTimeoutIds = []; onMounted(function() { activeTimeoutIds.forEach(function(timeoutId) { return window.clearTimeout(timeoutId); }); activeTimeoutIds.splice(0, activeTimeoutIds.length); }); onBeforeUnmount(function() { activeTimeoutIds.forEach(function(timeoutId) { return window.clearTimeout(timeoutId); }); activeTimeoutIds.splice(0, activeTimeoutIds.length); }); var onInternalMouseDown = function onInternalMouseDown2(event) { var target = event.target; var popupElement = triggerRef.value && triggerRef.value.getPopupElement(); if (popupElement && popupElement.contains(target)) { var timeoutId = window.setTimeout(function() { var index2 = activeTimeoutIds.indexOf(timeoutId); if (index2 !== -1) { activeTimeoutIds.splice(index2, 1); } cancelSetMockFocused(); if (!mobile.value && !popupElement.contains(document.activeElement)) { selectorRef.value.focus(); } }); activeTimeoutIds.push(timeoutId); } if (props2.onMousedown) { props2.onMousedown(event); } }; var accessibilityIndex = ref(0); var mergedDefaultActiveFirstOption = computed(function() { return props2.defaultActiveFirstOption !== void 0 ? props2.defaultActiveFirstOption : props2.mode !== "combobox"; }); var onActiveValue = function onActiveValue2(active, index2) { var _ref3 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, _ref3$source = _ref3.source, source2 = _ref3$source === void 0 ? "keyboard" : _ref3$source; accessibilityIndex.value = index2; if (props2.backfill && props2.mode === "combobox" && active !== null && source2 === "keyboard") { setActiveValue(String(active)); } }; var containerWidth = ref(null); onMounted(function() { watch(triggerOpen, function() { if (triggerOpen.value) { var newWidth = Math.ceil(containerRef.value.offsetWidth); if (containerWidth.value !== newWidth) { containerWidth.value = newWidth; } } }, { immediate: true }); }); var focus25 = function focus26() { selectorRef.value.focus(); }; var blur22 = function blur23() { selectorRef.value.blur(); }; return { focus: focus25, blur: blur22, scrollTo: (_a3 = listRef.value) === null || _a3 === void 0 ? void 0 : _a3.scrollTo, tokenWithEnter, mockFocused, mergedId, containerWidth, onActiveValue, accessibilityIndex, mergedDefaultActiveFirstOption, onInternalMouseDown, onContainerFocus, onContainerBlur, onInternalKeyDown, isMultiple: isMultiple2, mergedOpen, displayOptions, displayFlattenOptions, rawValues, onInternalOptionSelect, onToggleOpen, mergedSearchValue, useInternalProps, triggerChange: triggerChange4, triggerSearch, mergedRawValue, mergedShowSearch, onInternalKeyUp, triggerOpen, mergedOptions, onInternalSelectionSelect, selectorDomRef, displayValues, activeValue, onSearchSubmit, containerRef, listRef, triggerRef, selectorRef }; }, methods: { onPopupMouseEnter: function onPopupMouseEnter() { this.$forceUpdate(); } }, render: function render123() { var _classNames2, _this = this; var tokenWithEnter = this.tokenWithEnter, mockFocused = this.mockFocused, mergedId = this.mergedId, containerWidth = this.containerWidth, onActiveValue = this.onActiveValue, accessibilityIndex = this.accessibilityIndex, mergedDefaultActiveFirstOption = this.mergedDefaultActiveFirstOption, onInternalMouseDown = this.onInternalMouseDown, onInternalKeyDown = this.onInternalKeyDown, isMultiple2 = this.isMultiple, mergedOpen = this.mergedOpen, displayOptions = this.displayOptions, displayFlattenOptions = this.displayFlattenOptions, rawValues = this.rawValues, onInternalOptionSelect = this.onInternalOptionSelect, onToggleOpen = this.onToggleOpen, mergedSearchValue = this.mergedSearchValue, onPopupMouseEnter = this.onPopupMouseEnter, useInternalProps = this.useInternalProps, triggerChange4 = this.triggerChange, triggerSearch = this.triggerSearch, mergedRawValue = this.mergedRawValue, mergedShowSearch = this.mergedShowSearch, onInternalKeyUp = this.onInternalKeyUp, triggerOpen = this.triggerOpen, mergedOptions = this.mergedOptions, onInternalSelectionSelect = this.onInternalSelectionSelect, selectorDomRef = this.selectorDomRef, displayValues = this.displayValues, activeValue = this.activeValue, onSearchSubmit = this.onSearchSubmit, slots = this.$slots; var _a3 = this.$props, _a$prefixCls = _a3.prefixCls, prefixCls2 = _a$prefixCls === void 0 ? defaultPrefixCls : _a$prefixCls, className = _a3.class; _a3.id; _a3.open; _a3.defaultOpen; var options2 = _a3.options; _a3.children; var mode3 = _a3.mode; _a3.value; _a3.defaultValue; _a3.labelInValue; _a3.showSearch; _a3.inputValue; _a3.searchValue; _a3.filterOption; _a3.optionFilterProp; _a3.autoClearSearchValue; _a3.onSearch; var allowClear = _a3.allowClear, clearIcon = _a3.clearIcon, showArrow = _a3.showArrow, inputIcon = _a3.inputIcon, menuItemSelectedIcon = _a3.menuItemSelectedIcon, disabled = _a3.disabled, loading = _a3.loading; _a3.defaultActiveFirstOption; var _a$notFoundContent = _a3.notFoundContent, notFoundContent = _a$notFoundContent === void 0 ? "Not Found" : _a$notFoundContent; _a3.optionLabelProp; _a3.backfill; var getInputElement2 = _a3.getInputElement, getPopupContainer2 = _a3.getPopupContainer, _a$listHeight = _a3.listHeight, listHeight = _a$listHeight === void 0 ? 200 : _a$listHeight, _a$listItemHeight = _a3.listItemHeight, listItemHeight = _a$listItemHeight === void 0 ? 20 : _a$listItemHeight, animation2 = _a3.animation, transitionName2 = _a3.transitionName, virtual = _a3.virtual, dropdownStyle = _a3.dropdownStyle, dropdownClassName = _a3.dropdownClassName, dropdownMatchSelectWidth = _a3.dropdownMatchSelectWidth, dropdownRender = _a3.dropdownRender, dropdownAlign = _a3.dropdownAlign; _a3.showAction; var direction = _a3.direction; _a3.tokenSeparators; var tagRender = _a3.tagRender, onPopupScroll = _a3.onPopupScroll; _a3.onDropdownVisibleChange; _a3.onFocus; _a3.onBlur; _a3.onKeyup; _a3.onKeydown; _a3.onMousedown; _a3.onChange; _a3.onSelect; _a3.onDeselect; var onClear4 = _a3.onClear, _a$internalProps = _a3.internalProps, internalProps = _a$internalProps === void 0 ? {} : _a$internalProps, restProps = __rest$B(_a3, ["prefixCls", "class", "id", "open", "defaultOpen", "options", "children", "mode", "value", "defaultValue", "labelInValue", "showSearch", "inputValue", "searchValue", "filterOption", "optionFilterProp", "autoClearSearchValue", "onSearch", "allowClear", "clearIcon", "showArrow", "inputIcon", "menuItemSelectedIcon", "disabled", "loading", "defaultActiveFirstOption", "notFoundContent", "optionLabelProp", "backfill", "getInputElement", "getPopupContainer", "listHeight", "listItemHeight", "animation", "transitionName", "virtual", "dropdownStyle", "dropdownClassName", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "showAction", "direction", "tokenSeparators", "tagRender", "onPopupScroll", "onDropdownVisibleChange", "onFocus", "onBlur", "onKeyup", "onKeydown", "onMousedown", "onChange", "onSelect", "onDeselect", "onClear", "internalProps"]); var customizeInputElement = mode3 === "combobox" && getInputElement2 && getInputElement2() || null; var domProps = omitDOMProps ? omitDOMProps(restProps) : restProps; DEFAULT_OMIT_PROPS.forEach(function(prop) { delete domProps[prop]; }); var popupNode = createVNode(OptionList2, { "ref": "listRef", "prefixCls": prefixCls2, "id": mergedId, "open": mergedOpen, "childrenAsData": !options2, "options": displayOptions, "flattenOptions": displayFlattenOptions, "multiple": isMultiple2, "values": rawValues, "height": listHeight, "itemHeight": listItemHeight, "onSelect": onInternalOptionSelect, "onToggleOpen": onToggleOpen, "onActiveValue": onActiveValue, "defaultActiveFirstOption": mergedDefaultActiveFirstOption, "notFoundContent": notFoundContent, "onScroll": onPopupScroll, "searchValue": mergedSearchValue, "menuItemSelectedIcon": menuItemSelectedIcon, "virtual": virtual !== false && dropdownMatchSelectWidth !== false, "onMouseenter": onPopupMouseEnter }, { option: slots.option }); var clearNode; var onClearMouseDown = function onClearMouseDown2() { if (useInternalProps && internalProps.onClear) { internalProps.onClear(); } if (onClear4) { onClear4(); } triggerChange4([]); triggerSearch("", false, false); }; if (!disabled && allowClear && (mergedRawValue.length || mergedSearchValue)) { clearNode = createVNode(TransBtn$1, { "class": "".concat(prefixCls2, "-clear"), "onMousedown": onClearMouseDown, "customizeIcon": clearIcon }, { default: function _default8() { return [createTextVNode("\xD7")]; } }); } var mergedShowArrow = showArrow !== void 0 ? showArrow : loading || !isMultiple2 && mode3 !== "combobox"; var arrowNode; if (mergedShowArrow) { arrowNode = createVNode(TransBtn$1, { "class": classNames("".concat(prefixCls2, "-arrow"), _defineProperty$12({}, "".concat(prefixCls2, "-arrow-loading"), loading)), "customizeIcon": inputIcon, "customizeIconProps": { loading, searchValue: mergedSearchValue, open: mergedOpen, focused: mockFocused, showSearch: mergedShowSearch } }, null); } var mergedClassName = classNames(prefixCls2, className, (_classNames2 = {}, _defineProperty$12(_classNames2, "".concat(prefixCls2, "-focused"), mockFocused), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-multiple"), isMultiple2), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-single"), !isMultiple2), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-allow-clear"), allowClear), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-show-arrow"), mergedShowArrow), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-disabled"), disabled), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-loading"), loading), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-open"), mergedOpen), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-customize-input"), customizeInputElement), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-show-search"), mergedShowSearch), _classNames2)); return createVNode("div", _objectSpread2$2(_objectSpread2$2({ "class": mergedClassName }, domProps), {}, { "ref": "containerRef", "onMousedown": onInternalMouseDown, "onKeydown": onInternalKeyDown, "onKeyup": onInternalKeyUp }), [mockFocused && !mergedOpen && createVNode("span", { "style": { width: 0, height: 0, display: "flex", overflow: "hidden", opacity: 0 }, "aria-live": "polite" }, ["".concat(mergedRawValue.join(", "))]), createVNode(SelectTrigger$3, { "ref": "triggerRef", "disabled": disabled, "prefixCls": prefixCls2, "visible": triggerOpen, "popupElement": popupNode, "containerWidth": containerWidth, "animation": animation2, "transitionName": transitionName2, "dropdownStyle": dropdownStyle, "dropdownClassName": dropdownClassName, "direction": direction, "dropdownMatchSelectWidth": dropdownMatchSelectWidth, "dropdownRender": dropdownRender, "dropdownAlign": dropdownAlign, "getPopupContainer": getPopupContainer2, "empty": !mergedOptions.length, "getTriggerDOMNode": function getTriggerDOMNode() { return selectorDomRef.current; } }, { default: function _default8() { return [createVNode(Selector$3, _objectSpread2$2(_objectSpread2$2({}, _this.$props), {}, { "domRef": selectorDomRef, "prefixCls": prefixCls2, "inputElement": customizeInputElement, "ref": "selectorRef", "id": mergedId, "showSearch": mergedShowSearch, "mode": mode3, "accessibilityIndex": accessibilityIndex, "multiple": isMultiple2, "tagRender": tagRender, "values": displayValues, "open": mergedOpen, "onToggleOpen": onToggleOpen, "searchValue": mergedSearchValue, "activeValue": activeValue, "onSearch": triggerSearch, "onSearchSubmit": onSearchSubmit, "onSelect": onInternalSelectionSelect, "tokenWithEnter": tokenWithEnter }), null)]; } }), arrowNode, clearNode]); } }); return Select2; } function warningProps(props2) { var mode3 = props2.mode, options2 = props2.options, children = props2.children, backfill = props2.backfill, allowClear = props2.allowClear, placeholder = props2.placeholder, getInputElement2 = props2.getInputElement, showSearch = props2.showSearch, onSearch = props2.onSearch, defaultOpen = props2.defaultOpen, autofocus = props2.autofocus, labelInValue = props2.labelInValue, value24 = props2.value, inputValue = props2.inputValue, optionLabelProp = props2.optionLabelProp; var multiple = mode3 === "multiple" || mode3 === "tags"; var mergedShowSearch = showSearch !== void 0 ? showSearch : multiple || mode3 === "combobox"; var mergedOptions = options2 || convertChildrenToData$1(children); warningOnce(mode3 !== "tags" || mergedOptions.every(function(opt) { return !opt.disabled; }), "Please avoid setting option to disabled in tags mode since user can always type text as tag."); warningOnce(mode3 !== "combobox" || !optionLabelProp, "`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."); warningOnce(mode3 === "combobox" || !backfill, "`backfill` only works with `combobox` mode."); warningOnce(mode3 === "combobox" || !getInputElement2, "`getInputElement` only work with `combobox` mode."); noteOnce(mode3 !== "combobox" || !getInputElement2 || !allowClear || !placeholder, "Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."); if (onSearch && !mergedShowSearch && mode3 !== "combobox" && mode3 !== "tags") { warningOnce(false, "`onSearch` should work with `showSearch` instead of use alone."); } noteOnce(!defaultOpen || autofocus, "`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autofocus` if needed."); if (value24 !== void 0 && value24 !== null) { var values2 = toArray$4(value24); warningOnce(!labelInValue || values2.every(function(val) { return _typeof$2(val) === "object" && ("key" in val || "value" in val); }), "`value` should in shape of `{ value: string | number, label?: any }` when you set `labelInValue` to `true`"); warningOnce(!multiple || Array.isArray(value24), "`value` should be array when `mode` is `multiple` or `tags`"); } if (children) { var invalidateChildType = null; children.some(function(node) { var _a3; if (!isValidElement(node) || !node.type) { return false; } var type2 = node.type; if (type2.isSelectOption) { return false; } if (type2.isSelectOptGroup) { var childs = ((_a3 = node.children) === null || _a3 === void 0 ? void 0 : _a3.default()) || []; var allChildrenValid = childs.every(function(subNode) { if (!isValidElement(subNode) || !node.type || subNode.type.isSelectOption) { return true; } invalidateChildType = subNode.type; return false; }); if (allChildrenValid) { return false; } return true; } invalidateChildType = type2; return true; }); if (invalidateChildType) { warningOnce(false, "`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(invalidateChildType.displayName || invalidateChildType.name || invalidateChildType, "`.")); } warningOnce(inputValue === void 0, "`inputValue` is deprecated, please use `searchValue` instead."); } } var RefSelect = generateSelector$1({ prefixCls: "rc-select", components: { optionList: SelectOptionList }, convertChildrenToData: convertChildrenToData$1, flattenOptions, getLabeledValue, filterOptions, isValueDisabled, findValueOption, warningProps, fillOptionsWithMissingValue }); var Select$6 = defineComponent({ setup: function setup18(props2, _ref) { var attrs = _ref.attrs, expose = _ref.expose, slots = _ref.slots; var selectRef = ref(null); expose({ focus: function focus25() { var _a3; (_a3 = selectRef.value) === null || _a3 === void 0 ? void 0 : _a3.focus(); }, blur: function blur22() { var _a3; (_a3 = selectRef.value) === null || _a3 === void 0 ? void 0 : _a3.blur(); } }); return function() { var _a3; return createVNode(RefSelect, _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({ "ref": selectRef }, props2), attrs), {}, { "children": ((_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)) || [] }), slots); }; } }); Select$6.inheritAttrs = false; Select$6.props = omit$2(RefSelect.props, ["children"]); Select$6.Option = Option$3; Select$6.OptGroup = OptGroup$3; var Select$7 = Select$6; var DownOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" } }] }, "name": "down", "theme": "outlined" }; var DownOutlinedSvg = DownOutlined$2; function bound01(n2, max4) { if (isOnePointZero(n2)) { n2 = "100%"; } var isPercent = isPercentage(n2); n2 = max4 === 360 ? n2 : Math.min(max4, Math.max(0, parseFloat(n2))); if (isPercent) { n2 = parseInt(String(n2 * max4), 10) / 100; } if (Math.abs(n2 - max4) < 1e-6) { return 1; } if (max4 === 360) { n2 = (n2 < 0 ? n2 % max4 + max4 : n2 % max4) / parseFloat(String(max4)); } else { n2 = n2 % max4 / parseFloat(String(max4)); } return n2; } function clamp01(val) { return Math.min(1, Math.max(0, val)); } function isOnePointZero(n2) { return typeof n2 === "string" && n2.indexOf(".") !== -1 && parseFloat(n2) === 1; } function isPercentage(n2) { return typeof n2 === "string" && n2.indexOf("%") !== -1; } function boundAlpha(a2) { a2 = parseFloat(a2); if (isNaN(a2) || a2 < 0 || a2 > 1) { a2 = 1; } return a2; } function convertToPercentage(n2) { if (n2 <= 1) { return Number(n2) * 100 + "%"; } return n2; } function pad2(c2) { return c2.length === 1 ? "0" + c2 : String(c2); } function rgbToRgb(r2, g2, b2) { return { r: bound01(r2, 255) * 255, g: bound01(g2, 255) * 255, b: bound01(b2, 255) * 255 }; } function rgbToHsl(r2, g2, b2) { r2 = bound01(r2, 255); g2 = bound01(g2, 255); b2 = bound01(b2, 255); var max4 = Math.max(r2, g2, b2); var min4 = Math.min(r2, g2, b2); var h2 = 0; var s2 = 0; var l2 = (max4 + min4) / 2; if (max4 === min4) { s2 = 0; h2 = 0; } else { var d2 = max4 - min4; s2 = l2 > 0.5 ? d2 / (2 - max4 - min4) : d2 / (max4 + min4); switch (max4) { case r2: h2 = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0); break; case g2: h2 = (b2 - r2) / d2 + 2; break; case b2: h2 = (r2 - g2) / d2 + 4; break; } h2 /= 6; } return { h: h2, s: s2, l: l2 }; } function hue2rgb(p, q2, t2) { if (t2 < 0) { t2 += 1; } if (t2 > 1) { t2 -= 1; } if (t2 < 1 / 6) { return p + (q2 - p) * (6 * t2); } if (t2 < 1 / 2) { return q2; } if (t2 < 2 / 3) { return p + (q2 - p) * (2 / 3 - t2) * 6; } return p; } function hslToRgb(h2, s2, l2) { var r2; var g2; var b2; h2 = bound01(h2, 360); s2 = bound01(s2, 100); l2 = bound01(l2, 100); if (s2 === 0) { g2 = l2; b2 = l2; r2 = l2; } else { var q2 = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2; var p = 2 * l2 - q2; r2 = hue2rgb(p, q2, h2 + 1 / 3); g2 = hue2rgb(p, q2, h2); b2 = hue2rgb(p, q2, h2 - 1 / 3); } return { r: r2 * 255, g: g2 * 255, b: b2 * 255 }; } function rgbToHsv(r2, g2, b2) { r2 = bound01(r2, 255); g2 = bound01(g2, 255); b2 = bound01(b2, 255); var max4 = Math.max(r2, g2, b2); var min4 = Math.min(r2, g2, b2); var h2 = 0; var v2 = max4; var d2 = max4 - min4; var s2 = max4 === 0 ? 0 : d2 / max4; if (max4 === min4) { h2 = 0; } else { switch (max4) { case r2: h2 = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0); break; case g2: h2 = (b2 - r2) / d2 + 2; break; case b2: h2 = (r2 - g2) / d2 + 4; break; } h2 /= 6; } return { h: h2, s: s2, v: v2 }; } function hsvToRgb(h2, s2, v2) { h2 = bound01(h2, 360) * 6; s2 = bound01(s2, 100); v2 = bound01(v2, 100); var i2 = Math.floor(h2); var f2 = h2 - i2; var p = v2 * (1 - s2); var q2 = v2 * (1 - f2 * s2); var t2 = v2 * (1 - (1 - f2) * s2); var mod2 = i2 % 6; var r2 = [v2, q2, p, p, t2, v2][mod2]; var g2 = [t2, v2, v2, q2, p, p][mod2]; var b2 = [p, p, t2, v2, v2, q2][mod2]; return { r: r2 * 255, g: g2 * 255, b: b2 * 255 }; } function rgbToHex(r2, g2, b2, allow3Char) { var hex2 = [ pad2(Math.round(r2).toString(16)), pad2(Math.round(g2).toString(16)), pad2(Math.round(b2).toString(16)) ]; if (allow3Char && hex2[0].startsWith(hex2[0].charAt(1)) && hex2[1].startsWith(hex2[1].charAt(1)) && hex2[2].startsWith(hex2[2].charAt(1))) { return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0); } return hex2.join(""); } function rgbaToHex(r2, g2, b2, a2, allow4Char) { var hex2 = [ pad2(Math.round(r2).toString(16)), pad2(Math.round(g2).toString(16)), pad2(Math.round(b2).toString(16)), pad2(convertDecimalToHex(a2)) ]; if (allow4Char && hex2[0].startsWith(hex2[0].charAt(1)) && hex2[1].startsWith(hex2[1].charAt(1)) && hex2[2].startsWith(hex2[2].charAt(1)) && hex2[3].startsWith(hex2[3].charAt(1))) { return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0) + hex2[3].charAt(0); } return hex2.join(""); } function convertDecimalToHex(d2) { return Math.round(parseFloat(d2) * 255).toString(16); } function convertHexToDecimal(h2) { return parseIntFromHex(h2) / 255; } function parseIntFromHex(val) { return parseInt(val, 16); } function numberInputToObject(color) { return { r: color >> 16, g: (color & 65280) >> 8, b: color & 255 }; } var names = { aliceblue: "#f0f8ff", antiquewhite: "#faebd7", aqua: "#00ffff", aquamarine: "#7fffd4", azure: "#f0ffff", beige: "#f5f5dc", bisque: "#ffe4c4", black: "#000000", blanchedalmond: "#ffebcd", blue: "#0000ff", blueviolet: "#8a2be2", brown: "#a52a2a", burlywood: "#deb887", cadetblue: "#5f9ea0", chartreuse: "#7fff00", chocolate: "#d2691e", coral: "#ff7f50", cornflowerblue: "#6495ed", cornsilk: "#fff8dc", crimson: "#dc143c", cyan: "#00ffff", darkblue: "#00008b", darkcyan: "#008b8b", darkgoldenrod: "#b8860b", darkgray: "#a9a9a9", darkgreen: "#006400", darkgrey: "#a9a9a9", darkkhaki: "#bdb76b", darkmagenta: "#8b008b", darkolivegreen: "#556b2f", darkorange: "#ff8c00", darkorchid: "#9932cc", darkred: "#8b0000", darksalmon: "#e9967a", darkseagreen: "#8fbc8f", darkslateblue: "#483d8b", darkslategray: "#2f4f4f", darkslategrey: "#2f4f4f", darkturquoise: "#00ced1", darkviolet: "#9400d3", deeppink: "#ff1493", deepskyblue: "#00bfff", dimgray: "#696969", dimgrey: "#696969", dodgerblue: "#1e90ff", firebrick: "#b22222", floralwhite: "#fffaf0", forestgreen: "#228b22", fuchsia: "#ff00ff", gainsboro: "#dcdcdc", ghostwhite: "#f8f8ff", goldenrod: "#daa520", gold: "#ffd700", gray: "#808080", green: "#008000", greenyellow: "#adff2f", grey: "#808080", honeydew: "#f0fff0", hotpink: "#ff69b4", indianred: "#cd5c5c", indigo: "#4b0082", ivory: "#fffff0", khaki: "#f0e68c", lavenderblush: "#fff0f5", lavender: "#e6e6fa", lawngreen: "#7cfc00", lemonchiffon: "#fffacd", lightblue: "#add8e6", lightcoral: "#f08080", lightcyan: "#e0ffff", lightgoldenrodyellow: "#fafad2", lightgray: "#d3d3d3", lightgreen: "#90ee90", lightgrey: "#d3d3d3", lightpink: "#ffb6c1", lightsalmon: "#ffa07a", lightseagreen: "#20b2aa", lightskyblue: "#87cefa", lightslategray: "#778899", lightslategrey: "#778899", lightsteelblue: "#b0c4de", lightyellow: "#ffffe0", lime: "#00ff00", limegreen: "#32cd32", linen: "#faf0e6", magenta: "#ff00ff", maroon: "#800000", mediumaquamarine: "#66cdaa", mediumblue: "#0000cd", mediumorchid: "#ba55d3", mediumpurple: "#9370db", mediumseagreen: "#3cb371", mediumslateblue: "#7b68ee", mediumspringgreen: "#00fa9a", mediumturquoise: "#48d1cc", mediumvioletred: "#c71585", midnightblue: "#191970", mintcream: "#f5fffa", mistyrose: "#ffe4e1", moccasin: "#ffe4b5", navajowhite: "#ffdead", navy: "#000080", oldlace: "#fdf5e6", olive: "#808000", olivedrab: "#6b8e23", orange: "#ffa500", orangered: "#ff4500", orchid: "#da70d6", palegoldenrod: "#eee8aa", palegreen: "#98fb98", paleturquoise: "#afeeee", palevioletred: "#db7093", papayawhip: "#ffefd5", peachpuff: "#ffdab9", peru: "#cd853f", pink: "#ffc0cb", plum: "#dda0dd", powderblue: "#b0e0e6", purple: "#800080", rebeccapurple: "#663399", red: "#ff0000", rosybrown: "#bc8f8f", royalblue: "#4169e1", saddlebrown: "#8b4513", salmon: "#fa8072", sandybrown: "#f4a460", seagreen: "#2e8b57", seashell: "#fff5ee", sienna: "#a0522d", silver: "#c0c0c0", skyblue: "#87ceeb", slateblue: "#6a5acd", slategray: "#708090", slategrey: "#708090", snow: "#fffafa", springgreen: "#00ff7f", steelblue: "#4682b4", tan: "#d2b48c", teal: "#008080", thistle: "#d8bfd8", tomato: "#ff6347", turquoise: "#40e0d0", violet: "#ee82ee", wheat: "#f5deb3", white: "#ffffff", whitesmoke: "#f5f5f5", yellow: "#ffff00", yellowgreen: "#9acd32" }; function inputToRGB(color) { var rgb = { r: 0, g: 0, b: 0 }; var a2 = 1; var s2 = null; var v2 = null; var l2 = null; var ok = false; var format3 = false; if (typeof color === "string") { color = stringInputToObject(color); } if (typeof color === "object") { if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { rgb = rgbToRgb(color.r, color.g, color.b); ok = true; format3 = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { s2 = convertToPercentage(color.s); v2 = convertToPercentage(color.v); rgb = hsvToRgb(color.h, s2, v2); ok = true; format3 = "hsv"; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { s2 = convertToPercentage(color.s); l2 = convertToPercentage(color.l); rgb = hslToRgb(color.h, s2, l2); ok = true; format3 = "hsl"; } if (Object.prototype.hasOwnProperty.call(color, "a")) { a2 = color.a; } } a2 = boundAlpha(a2); return { ok, format: color.format || format3, r: Math.min(255, Math.max(rgb.r, 0)), g: Math.min(255, Math.max(rgb.g, 0)), b: Math.min(255, Math.max(rgb.b, 0)), a: a2 }; } var CSS_INTEGER = "[-\\+]?\\d+%?"; var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; var matchers = { CSS_UNIT: new RegExp(CSS_UNIT), rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ }; function stringInputToObject(color) { color = color.trim().toLowerCase(); if (color.length === 0) { return false; } var named = false; if (names[color]) { color = names[color]; named = true; } else if (color === "transparent") { return { r: 0, g: 0, b: 0, a: 0, format: "name" }; } var match5 = matchers.rgb.exec(color); if (match5) { return { r: match5[1], g: match5[2], b: match5[3] }; } match5 = matchers.rgba.exec(color); if (match5) { return { r: match5[1], g: match5[2], b: match5[3], a: match5[4] }; } match5 = matchers.hsl.exec(color); if (match5) { return { h: match5[1], s: match5[2], l: match5[3] }; } match5 = matchers.hsla.exec(color); if (match5) { return { h: match5[1], s: match5[2], l: match5[3], a: match5[4] }; } match5 = matchers.hsv.exec(color); if (match5) { return { h: match5[1], s: match5[2], v: match5[3] }; } match5 = matchers.hsva.exec(color); if (match5) { return { h: match5[1], s: match5[2], v: match5[3], a: match5[4] }; } match5 = matchers.hex8.exec(color); if (match5) { return { r: parseIntFromHex(match5[1]), g: parseIntFromHex(match5[2]), b: parseIntFromHex(match5[3]), a: convertHexToDecimal(match5[4]), format: named ? "name" : "hex8" }; } match5 = matchers.hex6.exec(color); if (match5) { return { r: parseIntFromHex(match5[1]), g: parseIntFromHex(match5[2]), b: parseIntFromHex(match5[3]), format: named ? "name" : "hex" }; } match5 = matchers.hex4.exec(color); if (match5) { return { r: parseIntFromHex(match5[1] + match5[1]), g: parseIntFromHex(match5[2] + match5[2]), b: parseIntFromHex(match5[3] + match5[3]), a: convertHexToDecimal(match5[4] + match5[4]), format: named ? "name" : "hex8" }; } match5 = matchers.hex3.exec(color); if (match5) { return { r: parseIntFromHex(match5[1] + match5[1]), g: parseIntFromHex(match5[2] + match5[2]), b: parseIntFromHex(match5[3] + match5[3]), format: named ? "name" : "hex" }; } return false; } function isValidCSSUnit(color) { return Boolean(matchers.CSS_UNIT.exec(String(color))); } var TinyColor = function() { function TinyColor2(color, opts2) { if (color === void 0) { color = ""; } if (opts2 === void 0) { opts2 = {}; } var _a3; if (color instanceof TinyColor2) { return color; } if (typeof color === "number") { color = numberInputToObject(color); } this.originalInput = color; var rgb = inputToRGB(color); this.originalInput = color; this.r = rgb.r; this.g = rgb.g; this.b = rgb.b; this.a = rgb.a; this.roundA = Math.round(100 * this.a) / 100; this.format = (_a3 = opts2.format) !== null && _a3 !== void 0 ? _a3 : rgb.format; this.gradientType = opts2.gradientType; if (this.r < 1) { this.r = Math.round(this.r); } if (this.g < 1) { this.g = Math.round(this.g); } if (this.b < 1) { this.b = Math.round(this.b); } this.isValid = rgb.ok; } TinyColor2.prototype.isDark = function() { return this.getBrightness() < 128; }; TinyColor2.prototype.isLight = function() { return !this.isDark(); }; TinyColor2.prototype.getBrightness = function() { var rgb = this.toRgb(); return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3; }; TinyColor2.prototype.getLuminance = function() { var rgb = this.toRgb(); var R2; var G; var B2; var RsRGB = rgb.r / 255; var GsRGB = rgb.g / 255; var BsRGB = rgb.b / 255; if (RsRGB <= 0.03928) { R2 = RsRGB / 12.92; } else { R2 = Math.pow((RsRGB + 0.055) / 1.055, 2.4); } if (GsRGB <= 0.03928) { G = GsRGB / 12.92; } else { G = Math.pow((GsRGB + 0.055) / 1.055, 2.4); } if (BsRGB <= 0.03928) { B2 = BsRGB / 12.92; } else { B2 = Math.pow((BsRGB + 0.055) / 1.055, 2.4); } return 0.2126 * R2 + 0.7152 * G + 0.0722 * B2; }; TinyColor2.prototype.getAlpha = function() { return this.a; }; TinyColor2.prototype.setAlpha = function(alpha) { this.a = boundAlpha(alpha); this.roundA = Math.round(100 * this.a) / 100; return this; }; TinyColor2.prototype.toHsv = function() { var hsv = rgbToHsv(this.r, this.g, this.b); return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a }; }; TinyColor2.prototype.toHsvString = function() { var hsv = rgbToHsv(this.r, this.g, this.b); var h2 = Math.round(hsv.h * 360); var s2 = Math.round(hsv.s * 100); var v2 = Math.round(hsv.v * 100); return this.a === 1 ? "hsv(" + h2 + ", " + s2 + "%, " + v2 + "%)" : "hsva(" + h2 + ", " + s2 + "%, " + v2 + "%, " + this.roundA + ")"; }; TinyColor2.prototype.toHsl = function() { var hsl = rgbToHsl(this.r, this.g, this.b); return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a }; }; TinyColor2.prototype.toHslString = function() { var hsl = rgbToHsl(this.r, this.g, this.b); var h2 = Math.round(hsl.h * 360); var s2 = Math.round(hsl.s * 100); var l2 = Math.round(hsl.l * 100); return this.a === 1 ? "hsl(" + h2 + ", " + s2 + "%, " + l2 + "%)" : "hsla(" + h2 + ", " + s2 + "%, " + l2 + "%, " + this.roundA + ")"; }; TinyColor2.prototype.toHex = function(allow3Char) { if (allow3Char === void 0) { allow3Char = false; } return rgbToHex(this.r, this.g, this.b, allow3Char); }; TinyColor2.prototype.toHexString = function(allow3Char) { if (allow3Char === void 0) { allow3Char = false; } return "#" + this.toHex(allow3Char); }; TinyColor2.prototype.toHex8 = function(allow4Char) { if (allow4Char === void 0) { allow4Char = false; } return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char); }; TinyColor2.prototype.toHex8String = function(allow4Char) { if (allow4Char === void 0) { allow4Char = false; } return "#" + this.toHex8(allow4Char); }; TinyColor2.prototype.toRgb = function() { return { r: Math.round(this.r), g: Math.round(this.g), b: Math.round(this.b), a: this.a }; }; TinyColor2.prototype.toRgbString = function() { var r2 = Math.round(this.r); var g2 = Math.round(this.g); var b2 = Math.round(this.b); return this.a === 1 ? "rgb(" + r2 + ", " + g2 + ", " + b2 + ")" : "rgba(" + r2 + ", " + g2 + ", " + b2 + ", " + this.roundA + ")"; }; TinyColor2.prototype.toPercentageRgb = function() { var fmt = function(x2) { return Math.round(bound01(x2, 255) * 100) + "%"; }; return { r: fmt(this.r), g: fmt(this.g), b: fmt(this.b), a: this.a }; }; TinyColor2.prototype.toPercentageRgbString = function() { var rnd = function(x2) { return Math.round(bound01(x2, 255) * 100); }; return this.a === 1 ? "rgb(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%)" : "rgba(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%, " + this.roundA + ")"; }; TinyColor2.prototype.toName = function() { if (this.a === 0) { return "transparent"; } if (this.a < 1) { return false; } var hex2 = "#" + rgbToHex(this.r, this.g, this.b, false); for (var _i = 0, _a3 = Object.entries(names); _i < _a3.length; _i++) { var _b2 = _a3[_i], key2 = _b2[0], value24 = _b2[1]; if (hex2 === value24) { return key2; } } return false; }; TinyColor2.prototype.toString = function(format3) { var formatSet = Boolean(format3); format3 = format3 !== null && format3 !== void 0 ? format3 : this.format; var formattedString = false; var hasAlpha = this.a < 1 && this.a >= 0; var needsAlphaFormat = !formatSet && hasAlpha && (format3.startsWith("hex") || format3 === "name"); if (needsAlphaFormat) { if (format3 === "name" && this.a === 0) { return this.toName(); } return this.toRgbString(); } if (format3 === "rgb") { formattedString = this.toRgbString(); } if (format3 === "prgb") { formattedString = this.toPercentageRgbString(); } if (format3 === "hex" || format3 === "hex6") { formattedString = this.toHexString(); } if (format3 === "hex3") { formattedString = this.toHexString(true); } if (format3 === "hex4") { formattedString = this.toHex8String(true); } if (format3 === "hex8") { formattedString = this.toHex8String(); } if (format3 === "name") { formattedString = this.toName(); } if (format3 === "hsl") { formattedString = this.toHslString(); } if (format3 === "hsv") { formattedString = this.toHsvString(); } return formattedString || this.toHexString(); }; TinyColor2.prototype.toNumber = function() { return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b); }; TinyColor2.prototype.clone = function() { return new TinyColor2(this.toString()); }; TinyColor2.prototype.lighten = function(amount) { if (amount === void 0) { amount = 10; } var hsl = this.toHsl(); hsl.l += amount / 100; hsl.l = clamp01(hsl.l); return new TinyColor2(hsl); }; TinyColor2.prototype.brighten = function(amount) { if (amount === void 0) { amount = 10; } var rgb = this.toRgb(); rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100)))); rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100)))); rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100)))); return new TinyColor2(rgb); }; TinyColor2.prototype.darken = function(amount) { if (amount === void 0) { amount = 10; } var hsl = this.toHsl(); hsl.l -= amount / 100; hsl.l = clamp01(hsl.l); return new TinyColor2(hsl); }; TinyColor2.prototype.tint = function(amount) { if (amount === void 0) { amount = 10; } return this.mix("white", amount); }; TinyColor2.prototype.shade = function(amount) { if (amount === void 0) { amount = 10; } return this.mix("black", amount); }; TinyColor2.prototype.desaturate = function(amount) { if (amount === void 0) { amount = 10; } var hsl = this.toHsl(); hsl.s -= amount / 100; hsl.s = clamp01(hsl.s); return new TinyColor2(hsl); }; TinyColor2.prototype.saturate = function(amount) { if (amount === void 0) { amount = 10; } var hsl = this.toHsl(); hsl.s += amount / 100; hsl.s = clamp01(hsl.s); return new TinyColor2(hsl); }; TinyColor2.prototype.greyscale = function() { return this.desaturate(100); }; TinyColor2.prototype.spin = function(amount) { var hsl = this.toHsl(); var hue = (hsl.h + amount) % 360; hsl.h = hue < 0 ? 360 + hue : hue; return new TinyColor2(hsl); }; TinyColor2.prototype.mix = function(color, amount) { if (amount === void 0) { amount = 50; } var rgb1 = this.toRgb(); var rgb2 = new TinyColor2(color).toRgb(); var p = amount / 100; var rgba = { r: (rgb2.r - rgb1.r) * p + rgb1.r, g: (rgb2.g - rgb1.g) * p + rgb1.g, b: (rgb2.b - rgb1.b) * p + rgb1.b, a: (rgb2.a - rgb1.a) * p + rgb1.a }; return new TinyColor2(rgba); }; TinyColor2.prototype.analogous = function(results, slices) { if (results === void 0) { results = 6; } if (slices === void 0) { slices = 30; } var hsl = this.toHsl(); var part = 360 / slices; var ret = [this]; for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) { hsl.h = (hsl.h + part) % 360; ret.push(new TinyColor2(hsl)); } return ret; }; TinyColor2.prototype.complement = function() { var hsl = this.toHsl(); hsl.h = (hsl.h + 180) % 360; return new TinyColor2(hsl); }; TinyColor2.prototype.monochromatic = function(results) { if (results === void 0) { results = 6; } var hsv = this.toHsv(); var h2 = hsv.h; var s2 = hsv.s; var v2 = hsv.v; var res = []; var modification = 1 / results; while (results--) { res.push(new TinyColor2({ h: h2, s: s2, v: v2 })); v2 = (v2 + modification) % 1; } return res; }; TinyColor2.prototype.splitcomplement = function() { var hsl = this.toHsl(); var h2 = hsl.h; return [ this, new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }), new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l }) ]; }; TinyColor2.prototype.onBackground = function(background) { var fg = this.toRgb(); var bg = new TinyColor2(background).toRgb(); return new TinyColor2({ r: bg.r + (fg.r - bg.r) * fg.a, g: bg.g + (fg.g - bg.g) * fg.a, b: bg.b + (fg.b - bg.b) * fg.a }); }; TinyColor2.prototype.triad = function() { return this.polyad(3); }; TinyColor2.prototype.tetrad = function() { return this.polyad(4); }; TinyColor2.prototype.polyad = function(n2) { var hsl = this.toHsl(); var h2 = hsl.h; var result = [this]; var increment = 360 / n2; for (var i2 = 1; i2 < n2; i2++) { result.push(new TinyColor2({ h: (h2 + i2 * increment) % 360, s: hsl.s, l: hsl.l })); } return result; }; TinyColor2.prototype.equals = function(color) { return this.toRgbString() === new TinyColor2(color).toRgbString(); }; return TinyColor2; }(); var hueStep$1 = 2; var saturationStep$1 = 0.16; var saturationStep2$1 = 0.05; var brightnessStep1$1 = 0.05; var brightnessStep2$1 = 0.15; var lightColorCount$1 = 5; var darkColorCount$1 = 4; var darkColorMap$1 = [{ index: 7, opacity: 0.15 }, { index: 6, opacity: 0.25 }, { index: 5, opacity: 0.3 }, { index: 5, opacity: 0.45 }, { index: 5, opacity: 0.65 }, { index: 5, opacity: 0.85 }, { index: 4, opacity: 0.9 }, { index: 3, opacity: 0.95 }, { index: 2, opacity: 0.97 }, { index: 1, opacity: 0.98 }]; function toHsv(_ref) { var r2 = _ref.r, g2 = _ref.g, b2 = _ref.b; var hsv = rgbToHsv(r2, g2, b2); return { h: hsv.h * 360, s: hsv.s, v: hsv.v }; } function toHex(_ref2) { var r2 = _ref2.r, g2 = _ref2.g, b2 = _ref2.b; return "#".concat(rgbToHex(r2, g2, b2, false)); } function mix(rgb1, rgb2, amount) { var p = amount / 100; var rgb = { r: (rgb2.r - rgb1.r) * p + rgb1.r, g: (rgb2.g - rgb1.g) * p + rgb1.g, b: (rgb2.b - rgb1.b) * p + rgb1.b }; return rgb; } function getHue$1(hsv, i2, light) { var hue; if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) { hue = light ? Math.round(hsv.h) - hueStep$1 * i2 : Math.round(hsv.h) + hueStep$1 * i2; } else { hue = light ? Math.round(hsv.h) + hueStep$1 * i2 : Math.round(hsv.h) - hueStep$1 * i2; } if (hue < 0) { hue += 360; } else if (hue >= 360) { hue -= 360; } return hue; } function getSaturation$1(hsv, i2, light) { if (hsv.h === 0 && hsv.s === 0) { return hsv.s; } var saturation; if (light) { saturation = hsv.s - saturationStep$1 * i2; } else if (i2 === darkColorCount$1) { saturation = hsv.s + saturationStep$1; } else { saturation = hsv.s + saturationStep2$1 * i2; } if (saturation > 1) { saturation = 1; } if (light && i2 === lightColorCount$1 && saturation > 0.1) { saturation = 0.1; } if (saturation < 0.06) { saturation = 0.06; } return Number(saturation.toFixed(2)); } function getValue$1(hsv, i2, light) { var value24; if (light) { value24 = hsv.v + brightnessStep1$1 * i2; } else { value24 = hsv.v - brightnessStep2$1 * i2; } if (value24 > 1) { value24 = 1; } return Number(value24.toFixed(2)); } function generate$3(color) { var opts2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var patterns = []; var pColor = inputToRGB(color); for (var i2 = lightColorCount$1; i2 > 0; i2 -= 1) { var hsv = toHsv(pColor); var colorString = toHex(inputToRGB({ h: getHue$1(hsv, i2, true), s: getSaturation$1(hsv, i2, true), v: getValue$1(hsv, i2, true) })); patterns.push(colorString); } patterns.push(toHex(pColor)); for (var _i = 1; _i <= darkColorCount$1; _i += 1) { var _hsv = toHsv(pColor); var _colorString = toHex(inputToRGB({ h: getHue$1(_hsv, _i), s: getSaturation$1(_hsv, _i), v: getValue$1(_hsv, _i) })); patterns.push(_colorString); } if (opts2.theme === "dark") { return darkColorMap$1.map(function(_ref3) { var index2 = _ref3.index, opacity = _ref3.opacity; var darkColorString = toHex(mix(inputToRGB(opts2.backgroundColor || "#141414"), inputToRGB(patterns[index2]), opacity * 100)); return darkColorString; }); } return patterns; } var presetPrimaryColors$1 = { red: "#F5222D", volcano: "#FA541C", orange: "#FA8C16", gold: "#FAAD14", yellow: "#FADB14", lime: "#A0D911", green: "#52C41A", cyan: "#13C2C2", blue: "#1890FF", geekblue: "#2F54EB", purple: "#722ED1", magenta: "#EB2F96", grey: "#666666" }; var presetPalettes$1 = {}; var presetDarkPalettes$1 = {}; Object.keys(presetPrimaryColors$1).forEach(function(key2) { presetPalettes$1[key2] = generate$3(presetPrimaryColors$1[key2]); presetPalettes$1[key2].primary = presetPalettes$1[key2][5]; presetDarkPalettes$1[key2] = generate$3(presetPrimaryColors$1[key2], { theme: "dark", backgroundColor: "#141414" }); presetDarkPalettes$1[key2].primary = presetDarkPalettes$1[key2][5]; }); presetPalettes$1.red; presetPalettes$1.volcano; presetPalettes$1.gold; presetPalettes$1.orange; presetPalettes$1.yellow; presetPalettes$1.lime; presetPalettes$1.green; presetPalettes$1.cyan; presetPalettes$1.blue; presetPalettes$1.geekblue; presetPalettes$1.purple; presetPalettes$1.magenta; presetPalettes$1.grey; var containers$1 = []; var styleElements$1 = []; var usage$1 = "insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options])."; function createStyleElement$1() { var styleElement = document.createElement("style"); styleElement.setAttribute("type", "text/css"); return styleElement; } function insertCss$1(css2, options2) { options2 = options2 || {}; if (css2 === void 0) { throw new Error(usage$1); } var position2 = options2.prepend === true ? "prepend" : "append"; var container = options2.container !== void 0 ? options2.container : document.querySelector("head"); var containerId = containers$1.indexOf(container); if (containerId === -1) { containerId = containers$1.push(container) - 1; styleElements$1[containerId] = {}; } var styleElement; if (styleElements$1[containerId] !== void 0 && styleElements$1[containerId][position2] !== void 0) { styleElement = styleElements$1[containerId][position2]; } else { styleElement = styleElements$1[containerId][position2] = createStyleElement$1(); if (position2 === "prepend") { container.insertBefore(styleElement, container.childNodes[0]); } else { container.appendChild(styleElement); } } if (css2.charCodeAt(0) === 65279) { css2 = css2.substr(1, css2.length); } if (styleElement.styleSheet) { styleElement.styleSheet.cssText += css2; } else { styleElement.textContent += css2; } return styleElement; } function _objectSpread$$(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$10(target, key2, source2[key2]); }); } return target; } function _defineProperty$10(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } function warning$4(valid, message2) { } function isIconDefinition$1(target) { return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function"); } function generate$2(node, key2, rootProps) { if (!rootProps) { return h$2(node.tag, _objectSpread$$({ key: key2 }, node.attrs), (node.children || []).map(function(child, index2) { return generate$2(child, "".concat(key2, "-").concat(node.tag, "-").concat(index2)); })); } return h$2(node.tag, _objectSpread$$({ key: key2 }, rootProps, node.attrs), (node.children || []).map(function(child, index2) { return generate$2(child, "".concat(key2, "-").concat(node.tag, "-").concat(index2)); })); } function getSecondaryColor$1(primaryColor) { return generate$3(primaryColor)[0]; } function normalizeTwoToneColors$1(twoToneColor) { if (!twoToneColor) { return []; } return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor]; } var iconStyles$1 = "\n.anticon {\n display: inline-block;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n"; var cssInjectedFlag$1 = false; var useInsertStyles$1 = function useInsertStyles2() { var styleStr = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : iconStyles$1; nextTick(function() { if (!cssInjectedFlag$1) { if (typeof window !== "undefined" && window.document && window.document.documentElement) { insertCss$1(styleStr, { prepend: true }); } cssInjectedFlag$1 = true; } }); }; var _excluded$1 = ["icon", "primaryColor", "secondaryColor"]; function _objectWithoutProperties$3(source2, excluded) { if (source2 == null) return {}; var target = _objectWithoutPropertiesLoose$3(source2, excluded); var key2, i2; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source2); for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { key2 = sourceSymbolKeys[i2]; if (excluded.indexOf(key2) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source2, key2)) continue; target[key2] = source2[key2]; } } return target; } function _objectWithoutPropertiesLoose$3(source2, excluded) { if (source2 == null) return {}; var target = {}; var sourceKeys = Object.keys(source2); var key2, i2; for (i2 = 0; i2 < sourceKeys.length; i2++) { key2 = sourceKeys[i2]; if (excluded.indexOf(key2) >= 0) continue; target[key2] = source2[key2]; } return target; } function _objectSpread$_(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$$(target, key2, source2[key2]); }); } return target; } function _defineProperty$$(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var twoToneColorPalette$1 = { primaryColor: "#333", secondaryColor: "#E6E6E6", calculated: false }; function setTwoToneColors$1(_ref) { var primaryColor = _ref.primaryColor, secondaryColor = _ref.secondaryColor; twoToneColorPalette$1.primaryColor = primaryColor; twoToneColorPalette$1.secondaryColor = secondaryColor || getSecondaryColor$1(primaryColor); twoToneColorPalette$1.calculated = !!secondaryColor; } function getTwoToneColors$1() { return _objectSpread$_({}, twoToneColorPalette$1); } var IconBase$1 = function IconBase2(props2, context2) { var _props$context$attrs = _objectSpread$_({}, props2, context2.attrs), icon = _props$context$attrs.icon, primaryColor = _props$context$attrs.primaryColor, secondaryColor = _props$context$attrs.secondaryColor, restProps = _objectWithoutProperties$3(_props$context$attrs, _excluded$1); var colors = twoToneColorPalette$1; if (primaryColor) { colors = { primaryColor, secondaryColor: secondaryColor || getSecondaryColor$1(primaryColor) }; } useInsertStyles$1(); warning$4(isIconDefinition$1(icon)); if (!isIconDefinition$1(icon)) { return null; } var target = icon; if (target && typeof target.icon === "function") { target = _objectSpread$_({}, target, { icon: target.icon(colors.primaryColor, colors.secondaryColor) }); } return generate$2(target.icon, "svg-".concat(target.name), _objectSpread$_({}, restProps, { "data-icon": target.name, width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true" })); }; IconBase$1.props = { icon: Object, primaryColor: String, secondaryColor: String, focusable: String }; IconBase$1.inheritAttrs = false; IconBase$1.displayName = "IconBase"; IconBase$1.getTwoToneColors = getTwoToneColors$1; IconBase$1.setTwoToneColors = setTwoToneColors$1; var VueIcon$1 = IconBase$1; function _slicedToArray$3(arr, i2) { return _arrayWithHoles$3(arr) || _iterableToArrayLimit$3(arr, i2) || _unsupportedIterableToArray$3(arr, i2) || _nonIterableRest$3(); } function _nonIterableRest$3() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray$3(o2, minLen) { if (!o2) return; if (typeof o2 === "string") return _arrayLikeToArray$3(o2, minLen); var n2 = Object.prototype.toString.call(o2).slice(8, -1); if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; if (n2 === "Map" || n2 === "Set") return Array.from(o2); if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$3(o2, minLen); } function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) { arr2[i2] = arr[i2]; } return arr2; } function _iterableToArrayLimit$3(arr, i2) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i2 && _arr.length === i2) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles$3(arr) { if (Array.isArray(arr)) return arr; } function setTwoToneColor$1(twoToneColor) { var _normalizeTwoToneColo = normalizeTwoToneColors$1(twoToneColor), _normalizeTwoToneColo2 = _slicedToArray$3(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1]; return VueIcon$1.setTwoToneColors({ primaryColor, secondaryColor }); } function getTwoToneColor$1() { var colors = VueIcon$1.getTwoToneColors(); if (!colors.calculated) { return colors.primaryColor; } return [colors.primaryColor, colors.secondaryColor]; } var _excluded = ["class", "icon", "spin", "rotate", "tabindex", "twoToneColor", "onClick"]; function _slicedToArray$2(arr, i2) { return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i2) || _unsupportedIterableToArray$2(arr, i2) || _nonIterableRest$2(); } function _nonIterableRest$2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray$2(o2, minLen) { if (!o2) return; if (typeof o2 === "string") return _arrayLikeToArray$2(o2, minLen); var n2 = Object.prototype.toString.call(o2).slice(8, -1); if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; if (n2 === "Map" || n2 === "Set") return Array.from(o2); if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$2(o2, minLen); } function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) { arr2[i2] = arr[i2]; } return arr2; } function _iterableToArrayLimit$2(arr, i2) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i2 && _arr.length === i2) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles$2(arr) { if (Array.isArray(arr)) return arr; } function _objectSpread$Z(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$_(target, key2, source2[key2]); }); } return target; } function _defineProperty$_(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } function _objectWithoutProperties$2(source2, excluded) { if (source2 == null) return {}; var target = _objectWithoutPropertiesLoose$2(source2, excluded); var key2, i2; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source2); for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { key2 = sourceSymbolKeys[i2]; if (excluded.indexOf(key2) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source2, key2)) continue; target[key2] = source2[key2]; } } return target; } function _objectWithoutPropertiesLoose$2(source2, excluded) { if (source2 == null) return {}; var target = {}; var sourceKeys = Object.keys(source2); var key2, i2; for (i2 = 0; i2 < sourceKeys.length; i2++) { key2 = sourceKeys[i2]; if (excluded.indexOf(key2) >= 0) continue; target[key2] = source2[key2]; } return target; } setTwoToneColor$1("#1890ff"); var Icon$1 = function Icon2(props2, context2) { var _classObj; var _props$context$attrs = _objectSpread$Z({}, props2, context2.attrs), cls = _props$context$attrs["class"], icon = _props$context$attrs.icon, spin = _props$context$attrs.spin, rotate = _props$context$attrs.rotate, tabindex = _props$context$attrs.tabindex, twoToneColor = _props$context$attrs.twoToneColor, onClick7 = _props$context$attrs.onClick, restProps = _objectWithoutProperties$2(_props$context$attrs, _excluded); var classObj = (_classObj = { anticon: true }, _defineProperty$_(_classObj, "anticon-".concat(icon.name), Boolean(icon.name)), _defineProperty$_(_classObj, cls, cls), _classObj); var svgClassString = spin === "" || !!spin || icon.name === "loading" ? "anticon-spin" : ""; var iconTabIndex = tabindex; if (iconTabIndex === void 0 && onClick7) { iconTabIndex = -1; restProps.tabindex = iconTabIndex; } var svgStyle = rotate ? { msTransform: "rotate(".concat(rotate, "deg)"), transform: "rotate(".concat(rotate, "deg)") } : void 0; var _normalizeTwoToneColo = normalizeTwoToneColors$1(twoToneColor), _normalizeTwoToneColo2 = _slicedToArray$2(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1]; return createVNode("span", _objectSpread$Z({ "role": "img", "aria-label": icon.name }, restProps, { "onClick": onClick7, "class": classObj }), [createVNode(VueIcon$1, { "class": svgClassString, "icon": icon, "primaryColor": primaryColor, "secondaryColor": secondaryColor, "style": svgStyle }, null)]); }; Icon$1.props = { spin: Boolean, rotate: Number, icon: Object, twoToneColor: String }; Icon$1.displayName = "AntdIcon"; Icon$1.inheritAttrs = false; Icon$1.getTwoToneColor = getTwoToneColor$1; Icon$1.setTwoToneColor = setTwoToneColor$1; var AntdIcon$1 = Icon$1; function _objectSpread$Y(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$Z(target, key2, source2[key2]); }); } return target; } function _defineProperty$Z(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var DownOutlined = function DownOutlined2(props2, context2) { var p = _objectSpread$Y({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$Y({}, p, { "icon": DownOutlinedSvg }), null); }; DownOutlined.displayName = "DownOutlined"; DownOutlined.inheritAttrs = false; var DownOutlined$1 = DownOutlined; var LoadingOutlined$4 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" } }] }, "name": "loading", "theme": "outlined" }; var LoadingOutlinedSvg = LoadingOutlined$4; function _objectSpread$X(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$Y(target, key2, source2[key2]); }); } return target; } function _defineProperty$Y(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var LoadingOutlined$2 = function LoadingOutlined2(props2, context2) { var p = _objectSpread$X({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$X({}, p, { "icon": LoadingOutlinedSvg }), null); }; LoadingOutlined$2.displayName = "LoadingOutlined"; LoadingOutlined$2.inheritAttrs = false; var LoadingOutlined$3 = LoadingOutlined$2; var CheckOutlined$4 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" } }] }, "name": "check", "theme": "outlined" }; var CheckOutlinedSvg = CheckOutlined$4; function _objectSpread$W(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$X(target, key2, source2[key2]); }); } return target; } function _defineProperty$X(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CheckOutlined$2 = function CheckOutlined2(props2, context2) { var p = _objectSpread$W({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$W({}, p, { "icon": CheckOutlinedSvg }), null); }; CheckOutlined$2.displayName = "CheckOutlined"; CheckOutlined$2.inheritAttrs = false; var CheckOutlined$3 = CheckOutlined$2; var CloseOutlined$4 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 00203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z" } }] }, "name": "close", "theme": "outlined" }; var CloseOutlinedSvg = CloseOutlined$4; function _objectSpread$V(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$W(target, key2, source2[key2]); }); } return target; } function _defineProperty$W(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CloseOutlined$2 = function CloseOutlined2(props2, context2) { var p = _objectSpread$V({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$V({}, p, { "icon": CloseOutlinedSvg }), null); }; CloseOutlined$2.displayName = "CloseOutlined"; CloseOutlined$2.inheritAttrs = false; var CloseOutlined$3 = CloseOutlined$2; var CloseCircleFilled$4 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z" } }] }, "name": "close-circle", "theme": "filled" }; var CloseCircleFilledSvg = CloseCircleFilled$4; function _objectSpread$U(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$V(target, key2, source2[key2]); }); } return target; } function _defineProperty$V(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CloseCircleFilled$2 = function CloseCircleFilled2(props2, context2) { var p = _objectSpread$U({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$U({}, p, { "icon": CloseCircleFilledSvg }), null); }; CloseCircleFilled$2.displayName = "CloseCircleFilled"; CloseCircleFilled$2.inheritAttrs = false; var CloseCircleFilled$3 = CloseCircleFilled$2; var SearchOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" } }] }, "name": "search", "theme": "outlined" }; var SearchOutlinedSvg = SearchOutlined$2; function _objectSpread$T(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$U(target, key2, source2[key2]); }); } return target; } function _defineProperty$U(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var SearchOutlined = function SearchOutlined2(props2, context2) { var p = _objectSpread$T({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$T({}, p, { "icon": SearchOutlinedSvg }), null); }; SearchOutlined.displayName = "SearchOutlined"; SearchOutlined.inheritAttrs = false; var SearchOutlined$1 = SearchOutlined; function getIcons(props2) { var slots = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var loading = props2.loading, multiple = props2.multiple, prefixCls2 = props2.prefixCls; var suffixIcon = props2.suffixIcon || slots.suffixIcon && slots.suffixIcon(); var clearIcon = props2.clearIcon || slots.clearIcon && slots.clearIcon(); var menuItemSelectedIcon = props2.menuItemSelectedIcon || slots.menuItemSelectedIcon && slots.menuItemSelectedIcon(); var removeIcon = props2.removeIcon || slots.removeIcon && slots.removeIcon(); var mergedClearIcon = clearIcon; if (!clearIcon) { mergedClearIcon = createVNode(CloseCircleFilled$3, null, null); } var mergedSuffixIcon = null; if (suffixIcon !== void 0) { mergedSuffixIcon = suffixIcon; } else if (loading) { mergedSuffixIcon = createVNode(LoadingOutlined$3, { "spin": true }, null); } else { var iconCls = "".concat(prefixCls2, "-suffix"); mergedSuffixIcon = function mergedSuffixIcon2(_ref) { var open6 = _ref.open, showSearch = _ref.showSearch; if (open6 && showSearch) { return createVNode(SearchOutlined$1, { "class": iconCls }, null); } return createVNode(DownOutlined$1, { "class": iconCls }, null); }; } var mergedItemIcon = null; if (menuItemSelectedIcon !== void 0) { mergedItemIcon = menuItemSelectedIcon; } else if (multiple) { mergedItemIcon = createVNode(CheckOutlined$3, null, null); } else { mergedItemIcon = null; } var mergedRemoveIcon = null; if (removeIcon !== void 0) { mergedRemoveIcon = removeIcon; } else { mergedRemoveIcon = createVNode(CloseOutlined$3, null, null); } return { clearIcon: mergedClearIcon, suffixIcon: mergedSuffixIcon, itemIcon: mergedItemIcon, removeIcon: mergedRemoveIcon }; } var SelectProps = function SelectProps2() { return _extends$1(_extends$1({}, omit(BaseProps(), ["inputIcon", "mode", "getInputElement", "backfill", "class", "style"])), { value: { type: [Array, Object, String, Number] }, defaultValue: { type: [Array, Object, String, Number] }, notFoundContent: PropsTypes.VNodeChild, suffixIcon: PropsTypes.VNodeChild, itemIcon: PropsTypes.VNodeChild, size: PropsTypes.oneOf(tuple("small", "middle", "large", "default")), mode: PropsTypes.oneOf(tuple("multiple", "tags", "SECRET_COMBOBOX_MODE_DO_NOT_USE")), bordered: PropsTypes.looseBool.def(true), transitionName: PropsTypes.string.def("slide-up"), choiceTransitionName: PropsTypes.string.def("") }); }; var Select$4 = defineComponent({ name: "ASelect", Option: Option$3, OptGroup: OptGroup$3, inheritAttrs: false, props: SelectProps(), SECRET_COMBOBOX_MODE_DO_NOT_USE: "SECRET_COMBOBOX_MODE_DO_NOT_USE", emits: ["change", "update:value"], slots: ["notFoundContent", "suffixIcon", "itemIcon", "removeIcon", "clearIcon", "dropdownRender", "option"], setup: function setup19(props2, _ref) { var attrs = _ref.attrs, emit2 = _ref.emit, slots = _ref.slots, expose = _ref.expose; var selectRef = ref(null); var focus25 = function focus26() { if (selectRef.value) { selectRef.value.focus(); } }; var blur22 = function blur23() { if (selectRef.value) { selectRef.value.blur(); } }; var mode3 = computed(function() { var mode4 = props2.mode; if (mode4 === "combobox") { return void 0; } if (mode4 === Select$4.SECRET_COMBOBOX_MODE_DO_NOT_USE) { return "combobox"; } return mode4; }); var _useConfigInject = useConfigInject("select", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction, configProvider = _useConfigInject.configProvider; var mergedClassName = computed(function() { var _classNames; return classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-lg"), props2.size === "large"), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-sm"), props2.size === "small"), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-rtl"), direction.value === "rtl"), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-borderless"), !props2.bordered), _classNames)); }); var triggerChange4 = function triggerChange5() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } emit2("update:value", args[0]); emit2.apply(void 0, ["change"].concat(args)); }; expose({ blur: blur22, focus: focus25 }); return function() { var _a3; var notFoundContent = props2.notFoundContent, _props$listHeight = props2.listHeight, listHeight = _props$listHeight === void 0 ? 256 : _props$listHeight, _props$listItemHeight = props2.listItemHeight, listItemHeight = _props$listItemHeight === void 0 ? 24 : _props$listItemHeight, getPopupContainer2 = props2.getPopupContainer, dropdownClassName = props2.dropdownClassName, virtual = props2.virtual, dropdownMatchSelectWidth = props2.dropdownMatchSelectWidth; var renderEmpty2 = configProvider.renderEmpty, getContextPopupContainer = configProvider.getPopupContainer; var isMultiple2 = mode3.value === "multiple" || mode3.value === "tags"; var mergedNotFound; if (notFoundContent !== void 0) { mergedNotFound = notFoundContent; } else if (slots.notFoundContent) { mergedNotFound = slots.notFoundContent(); } else if (mode3.value === "combobox") { mergedNotFound = null; } else { mergedNotFound = renderEmpty2("Select"); } var _getIcons = getIcons(_extends$1(_extends$1({}, props2), { multiple: isMultiple2, prefixCls: prefixCls2.value }), slots), suffixIcon = _getIcons.suffixIcon, itemIcon = _getIcons.itemIcon, removeIcon = _getIcons.removeIcon, clearIcon = _getIcons.clearIcon; var selectProps = omit(props2, ["prefixCls", "suffixIcon", "itemIcon", "removeIcon", "clearIcon", "size", "bordered"]); var rcSelectRtlDropDownClassName = classNames(dropdownClassName, _defineProperty$12({}, "".concat(prefixCls2.value, "-dropdown-").concat(direction.value), direction.value === "rtl")); return createVNode(Select$7, _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({ "ref": selectRef, "virtual": virtual, "dropdownMatchSelectWidth": dropdownMatchSelectWidth }, selectProps), attrs), {}, { "listHeight": listHeight, "listItemHeight": listItemHeight, "mode": mode3.value, "prefixCls": prefixCls2.value, "direction": direction.value, "inputIcon": suffixIcon, "menuItemSelectedIcon": itemIcon, "removeIcon": removeIcon, "clearIcon": clearIcon, "notFoundContent": mergedNotFound, "class": [mergedClassName.value, attrs.class], "getPopupContainer": getPopupContainer2 || getContextPopupContainer, "dropdownClassName": rcSelectRtlDropDownClassName, "onChange": triggerChange4, "dropdownRender": selectProps.dropdownRender || slots.dropdownRender }), { default: function _default8() { return [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)]; }, option: slots.option }); }; } }); Select$4.install = function(app) { app.component(Select$4.name, Select$4); app.component(Select$4.Option.displayName, Select$4.Option); app.component(Select$4.OptGroup.displayName, Select$4.OptGroup); return app; }; Select$4.Option; Select$4.OptGroup; var Select$5 = Select$4; var inputProps = { prefixCls: PropsTypes.string, inputPrefixCls: PropsTypes.string, defaultValue: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), value: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), placeholder: { type: [String, Number] }, type: PropsTypes.string.def("text"), name: PropsTypes.string, size: { type: String }, disabled: PropsTypes.looseBool, readonly: PropsTypes.looseBool, addonBefore: PropsTypes.VNodeChild, addonAfter: PropsTypes.VNodeChild, prefix: PropsTypes.VNodeChild, suffix: PropsTypes.VNodeChild, autofocus: PropsTypes.looseBool, allowClear: PropsTypes.looseBool, lazy: PropsTypes.looseBool.def(true), maxlength: PropsTypes.number, loading: PropsTypes.looseBool, onPressEnter: PropsTypes.func, onKeydown: PropsTypes.func, onKeyup: PropsTypes.func, onFocus: PropsTypes.func, onBlur: PropsTypes.func, onChange: PropsTypes.func, onInput: PropsTypes.func, "onUpdate:value": PropsTypes.func }; function hasPrefixSuffix(instance) { return !!(getComponent(instance, "prefix") || getComponent(instance, "suffix") || instance.$props.allowClear); } var ClearableInputType = ["text", "input"]; var ClearableLabeledInput = defineComponent({ name: "ClearableLabeledInput", inheritAttrs: false, props: { prefixCls: PropsTypes.string, inputType: PropsTypes.oneOf(tuple("text", "input")), value: PropsTypes.any, defaultValue: PropsTypes.any, allowClear: PropsTypes.looseBool, element: PropsTypes.VNodeChild, handleReset: PropsTypes.func, disabled: PropsTypes.looseBool, size: PropsTypes.oneOf(tuple("small", "large", "default")), suffix: PropsTypes.VNodeChild, prefix: PropsTypes.VNodeChild, addonBefore: PropsTypes.VNodeChild, addonAfter: PropsTypes.VNodeChild, readonly: PropsTypes.looseBool, isFocused: PropsTypes.looseBool }, methods: { renderClearIcon: function renderClearIcon(prefixCls2) { var _this$$props = this.$props, allowClear = _this$$props.allowClear, value24 = _this$$props.value, disabled = _this$$props.disabled, readonly2 = _this$$props.readonly, inputType = _this$$props.inputType, handleReset3 = _this$$props.handleReset; if (!allowClear) { return null; } var showClearIcon = !disabled && !readonly2 && value24 !== void 0 && value24 !== null && value24 !== ""; var className = inputType === ClearableInputType[0] ? "".concat(prefixCls2, "-textarea-clear-icon") : "".concat(prefixCls2, "-clear-icon"); return createVNode(CloseCircleFilled$3, { "onClick": handleReset3, "class": classNames(className, _defineProperty$12({}, "".concat(className, "-hidden"), !showClearIcon)), "role": "button" }, null); }, renderSuffix: function renderSuffix(prefixCls2) { var _this$$props2 = this.$props, suffix = _this$$props2.suffix, allowClear = _this$$props2.allowClear; if (suffix || allowClear) { return createVNode("span", { "class": "".concat(prefixCls2, "-suffix") }, [this.renderClearIcon(prefixCls2), suffix]); } return null; }, renderLabeledIcon: function renderLabeledIcon(prefixCls2, element) { var _classNames2; var _a3; var props2 = this.$props; var style = this.$attrs.style; var suffix = this.renderSuffix(prefixCls2); if (!hasPrefixSuffix(this)) { return cloneElement(element, { value: props2.value }); } var prefix = props2.prefix ? createVNode("span", { "class": "".concat(prefixCls2, "-prefix") }, [props2.prefix]) : null; var affixWrapperCls = classNames((_a3 = this.$attrs) === null || _a3 === void 0 ? void 0 : _a3.class, "".concat(prefixCls2, "-affix-wrapper"), (_classNames2 = {}, _defineProperty$12(_classNames2, "".concat(prefixCls2, "-affix-wrapper-focused"), props2.isFocused), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-affix-wrapper-disabled"), props2.disabled), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-affix-wrapper-sm"), props2.size === "small"), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-affix-wrapper-lg"), props2.size === "large"), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-affix-wrapper-input-with-clear-btn"), props2.suffix && props2.allowClear && this.$props.value), _classNames2)); return createVNode("span", { "class": affixWrapperCls, "style": style }, [prefix, cloneElement(element, { style: null, value: props2.value, class: getInputClassName(prefixCls2, props2.size, props2.disabled) }), suffix]); }, renderInputWithLabel: function renderInputWithLabel(prefixCls2, labeledElement) { var _classNames4; var _this$$props3 = this.$props, addonBefore = _this$$props3.addonBefore, addonAfter = _this$$props3.addonAfter, size = _this$$props3.size; var _this$$attrs = this.$attrs, style = _this$$attrs.style, className = _this$$attrs.class; if (!addonBefore && !addonAfter) { return labeledElement; } var wrapperClassName = "".concat(prefixCls2, "-group"); var addonClassName = "".concat(wrapperClassName, "-addon"); var addonBeforeNode = addonBefore ? createVNode("span", { "class": addonClassName }, [addonBefore]) : null; var addonAfterNode = addonAfter ? createVNode("span", { "class": addonClassName }, [addonAfter]) : null; var mergedWrapperClassName = classNames("".concat(prefixCls2, "-wrapper"), _defineProperty$12({}, wrapperClassName, addonBefore || addonAfter)); var mergedGroupClassName = classNames(className, "".concat(prefixCls2, "-group-wrapper"), (_classNames4 = {}, _defineProperty$12(_classNames4, "".concat(prefixCls2, "-group-wrapper-sm"), size === "small"), _defineProperty$12(_classNames4, "".concat(prefixCls2, "-group-wrapper-lg"), size === "large"), _classNames4)); return createVNode("span", { "class": mergedGroupClassName, "style": style }, [createVNode("span", { "class": mergedWrapperClassName }, [addonBeforeNode, cloneElement(labeledElement, { style: null }), addonAfterNode])]); }, renderTextAreaWithClearIcon: function renderTextAreaWithClearIcon(prefixCls2, element) { var _this$$props4 = this.$props, value24 = _this$$props4.value, allowClear = _this$$props4.allowClear; var _this$$attrs2 = this.$attrs, style = _this$$attrs2.style, className = _this$$attrs2.class; if (!allowClear) { return cloneElement(element, { value: value24 }); } var affixWrapperCls = classNames(className, "".concat(prefixCls2, "-affix-wrapper"), "".concat(prefixCls2, "-affix-wrapper-textarea-with-clear-btn")); return createVNode("span", { "class": affixWrapperCls, "style": style }, [cloneElement(element, { style: null, value: value24 }), this.renderClearIcon(prefixCls2)]); }, renderClearableLabeledInput: function renderClearableLabeledInput() { var _this$$props5 = this.$props, prefixCls2 = _this$$props5.prefixCls, inputType = _this$$props5.inputType, element = _this$$props5.element; if (inputType === ClearableInputType[0]) { return this.renderTextAreaWithClearIcon(prefixCls2, element); } return this.renderInputWithLabel(prefixCls2, this.renderLabeledIcon(prefixCls2, element)); } }, render: function render13() { return this.renderClearableLabeledInput(); } }); var ClearableLabeledInput$1 = ClearableLabeledInput; function fixControlledValue(value24) { if (typeof value24 === "undefined" || value24 === null) { return ""; } return value24; } function resolveOnChange(target, e2, onChange8) { if (onChange8) { var event = e2; if (e2.type === "click") { Object.defineProperty(event, "target", { writable: true }); Object.defineProperty(event, "currentTarget", { writable: true }); event.target = target; event.currentTarget = target; var originalInputValue = target.value; target.value = ""; onChange8(event); target.value = originalInputValue; return; } onChange8(event); } } function getInputClassName(prefixCls2, size, disabled) { var _classNames; return classNames(prefixCls2, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-sm"), size === "small"), _defineProperty$12(_classNames, "".concat(prefixCls2, "-lg"), size === "large"), _defineProperty$12(_classNames, "".concat(prefixCls2, "-disabled"), disabled), _classNames)); } var Input = defineComponent({ name: "AInput", inheritAttrs: false, props: _extends$1({}, inputProps), setup: function setup20() { return { configProvider: inject("configProvider", defaultConfigProvider), removePasswordTimeout: void 0, input: null, clearableInput: null }; }, data: function data5() { var props2 = this.$props; var value24 = typeof props2.value === "undefined" ? props2.defaultValue : props2.value; return { stateValue: typeof value24 === "undefined" ? "" : value24, isFocused: false }; }, watch: { value: function value2(val) { this.stateValue = val; } }, mounted: function mounted5() { var _this = this; nextTick(function() { _this.clearPasswordValueAttribute(); }); }, beforeUnmount: function beforeUnmount4() { if (this.removePasswordTimeout) { clearTimeout(this.removePasswordTimeout); } }, methods: { handleInputFocus: function handleInputFocus(e2) { this.isFocused = true; this.onFocus && this.onFocus(e2); }, handleInputBlur: function handleInputBlur(e2) { this.isFocused = false; this.onBlur && this.onBlur(e2); }, focus: function focus() { this.input.focus(); }, blur: function blur() { this.input.blur(); }, select: function select() { this.input.select(); }, saveClearableInput: function saveClearableInput(input) { this.clearableInput = input; }, saveInput: function saveInput(input) { this.input = input; }, setValue: function setValue(value24, callback2) { if (this.stateValue === value24) { return; } if (!hasProp(this, "value")) { this.stateValue = value24; } else { this.$forceUpdate(); } nextTick(function() { callback2 && callback2(); }); }, triggerChange: function triggerChange(e2) { this.$emit("update:value", e2.target.value); this.$emit("change", e2); this.$emit("input", e2); }, handleReset: function handleReset(e2) { var _this2 = this; this.setValue("", function() { _this2.focus(); }); resolveOnChange(this.input, e2, this.triggerChange); }, renderInput: function renderInput(prefixCls2, _ref) { var addonBefore = _ref.addonBefore, addonAfter = _ref.addonAfter; var otherProps = omit(this.$props, ["prefixCls", "onPressEnter", "addonBefore", "addonAfter", "prefix", "suffix", "allowClear", "defaultValue", "lazy", "size", "inputPrefixCls", "loading"]); var handleKeyDown7 = this.handleKeyDown, handleChange17 = this.handleChange, handleInputFocus3 = this.handleInputFocus, handleInputBlur3 = this.handleInputBlur, size = this.size, disabled = this.disabled, $attrs = this.$attrs; var inputProps2 = _extends$1(_extends$1(_extends$1({}, otherProps), $attrs), { onKeydown: handleKeyDown7, class: classNames(getInputClassName(prefixCls2, size, disabled), _defineProperty$12({}, $attrs.class, $attrs.class && !addonBefore && !addonAfter)), ref: this.saveInput, key: "ant-input", onInput: handleChange17, onChange: handleChange17, onFocus: handleInputFocus3, onBlur: handleInputBlur3 }); if (!inputProps2.autofocus) { delete inputProps2.autofocus; } var inputNode = createVNode("input", inputProps2, null); return withDirectives(inputNode, [[antInput$1]]); }, clearPasswordValueAttribute: function clearPasswordValueAttribute() { var _this3 = this; this.removePasswordTimeout = setTimeout(function() { if (_this3.input && _this3.input.getAttribute && _this3.input.getAttribute("type") === "password" && _this3.input.hasAttribute("value")) { _this3.input.removeAttribute("value"); } }); }, handleChange: function handleChange(e2) { var _e$target = e2.target, value24 = _e$target.value, composing = _e$target.composing, isComposing = _e$target.isComposing; if ((isComposing || composing) && this.lazy || this.stateValue === value24) return; this.setValue(value24, this.clearPasswordValueAttribute); resolveOnChange(this.input, e2, this.triggerChange); }, handleKeyDown: function handleKeyDown(e2) { if (e2.keyCode === 13) { this.$emit("pressEnter", e2); } this.$emit("keydown", e2); } }, render: function render14() { var customizePrefixCls = this.$props.prefixCls; var _this$$data = this.$data, stateValue = _this$$data.stateValue, isFocused = _this$$data.isFocused; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("input", customizePrefixCls); var addonAfter = getComponent(this, "addonAfter"); var addonBefore = getComponent(this, "addonBefore"); var suffix = getComponent(this, "suffix"); var prefix = getComponent(this, "prefix"); var props2 = _extends$1(_extends$1(_extends$1({}, this.$attrs), getOptionProps(this)), { prefixCls: prefixCls2, inputType: "input", value: fixControlledValue(stateValue), element: this.renderInput(prefixCls2, { addonAfter, addonBefore }), handleReset: this.handleReset, addonAfter, addonBefore, suffix, prefix, isFocused }); return createVNode(ClearableLabeledInput$1, _objectSpread2$2(_objectSpread2$2({}, props2), {}, { "ref": this.saveClearableInput }), null); } }); var Group$4 = defineComponent({ name: "AInputGroup", props: { prefixCls: PropsTypes.string, size: PropsTypes.oneOf(tuple("small", "large", "default")), compact: PropsTypes.looseBool }, setup: function setup21() { return { configProvider: inject("configProvider", defaultConfigProvider) }; }, computed: { classes: function classes2() { var _ref; var customizePrefixCls = this.prefixCls, size = this.size, _this$compact = this.compact, compact3 = _this$compact === void 0 ? false : _this$compact, configProvider = this.configProvider; var getPrefixCls2 = configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("input-group", customizePrefixCls); return _ref = {}, _defineProperty$12(_ref, "".concat(prefixCls2), true), _defineProperty$12(_ref, "".concat(prefixCls2, "-lg"), size === "large"), _defineProperty$12(_ref, "".concat(prefixCls2, "-sm"), size === "small"), _defineProperty$12(_ref, "".concat(prefixCls2, "-compact"), compact3), _ref; } }, render: function render15() { return createVNode("span", { "class": this.classes }, [getSlot$1(this)]); } }); var applePhone = /iPhone/i; var appleIpod = /iPod/i; var appleTablet = /iPad/i; var androidPhone = /\bAndroid(?:.+)Mobile\b/i; var androidTablet = /Android/i; var amazonPhone = /\bAndroid(?:.+)SD4930UR\b/i; var amazonTablet = /\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i; var windowsPhone = /Windows Phone/i; var windowsTablet = /\bWindows(?:.+)ARM\b/i; var otherBlackberry = /BlackBerry/i; var otherBlackberry10 = /BB10/i; var otherOpera = /Opera Mini/i; var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i; var otherFirefox = /Mobile(?:.+)Firefox\b/i; function match(regex2, userAgent) { return regex2.test(userAgent); } function isMobile(userAgent) { var ua = userAgent || (typeof navigator !== "undefined" ? navigator.userAgent : ""); var tmp = ua.split("[FBAN"); if (typeof tmp[1] !== "undefined") { var _tmp = tmp; var _tmp2 = _slicedToArray$4(_tmp, 1); ua = _tmp2[0]; } tmp = ua.split("Twitter"); if (typeof tmp[1] !== "undefined") { var _tmp3 = tmp; var _tmp4 = _slicedToArray$4(_tmp3, 1); ua = _tmp4[0]; } var result = { apple: { phone: match(applePhone, ua) && !match(windowsPhone, ua), ipod: match(appleIpod, ua), tablet: !match(applePhone, ua) && match(appleTablet, ua) && !match(windowsPhone, ua), device: (match(applePhone, ua) || match(appleIpod, ua) || match(appleTablet, ua)) && !match(windowsPhone, ua) }, amazon: { phone: match(amazonPhone, ua), tablet: !match(amazonPhone, ua) && match(amazonTablet, ua), device: match(amazonPhone, ua) || match(amazonTablet, ua) }, android: { phone: !match(windowsPhone, ua) && match(amazonPhone, ua) || !match(windowsPhone, ua) && match(androidPhone, ua), tablet: !match(windowsPhone, ua) && !match(amazonPhone, ua) && !match(androidPhone, ua) && (match(amazonTablet, ua) || match(androidTablet, ua)), device: !match(windowsPhone, ua) && (match(amazonPhone, ua) || match(amazonTablet, ua) || match(androidPhone, ua) || match(androidTablet, ua)) || match(/\bokhttp\b/i, ua) }, windows: { phone: match(windowsPhone, ua), tablet: match(windowsTablet, ua), device: match(windowsPhone, ua) || match(windowsTablet, ua) }, other: { blackberry: match(otherBlackberry, ua), blackberry10: match(otherBlackberry10, ua), opera: match(otherOpera, ua), firefox: match(otherFirefox, ua), chrome: match(otherChrome, ua), device: match(otherBlackberry, ua) || match(otherBlackberry10, ua) || match(otherOpera, ua) || match(otherFirefox, ua) || match(otherChrome, ua) }, any: null, phone: null, tablet: null }; result.any = result.apple.device || result.android.device || result.windows.device || result.other.device; result.phone = result.apple.phone || result.android.phone || result.windows.phone; result.tablet = result.apple.tablet || result.android.tablet || result.windows.tablet; return result; } var defaultResult = _extends$1(_extends$1({}, isMobile()), { isMobile }); var isMobile$1 = defaultResult; var START_EVENT_NAME_MAP = { transitionstart: { transition: "transitionstart", WebkitTransition: "webkitTransitionStart", MozTransition: "mozTransitionStart", OTransition: "oTransitionStart", msTransition: "MSTransitionStart" }, animationstart: { animation: "animationstart", WebkitAnimation: "webkitAnimationStart", MozAnimation: "mozAnimationStart", OAnimation: "oAnimationStart", msAnimation: "MSAnimationStart" } }; var END_EVENT_NAME_MAP = { transitionend: { transition: "transitionend", WebkitTransition: "webkitTransitionEnd", MozTransition: "mozTransitionEnd", OTransition: "oTransitionEnd", msTransition: "MSTransitionEnd" }, animationend: { animation: "animationend", WebkitAnimation: "webkitAnimationEnd", MozAnimation: "mozAnimationEnd", OAnimation: "oAnimationEnd", msAnimation: "MSAnimationEnd" } }; var startEvents = []; var endEvents = []; function detectEvents() { var testEl = document.createElement("div"); var style = testEl.style; if (!("AnimationEvent" in window)) { delete START_EVENT_NAME_MAP.animationstart.animation; delete END_EVENT_NAME_MAP.animationend.animation; } if (!("TransitionEvent" in window)) { delete START_EVENT_NAME_MAP.transitionstart.transition; delete END_EVENT_NAME_MAP.transitionend.transition; } function process2(EVENT_NAME_MAP, events) { for (var baseEventName in EVENT_NAME_MAP) { if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) { var baseEvents = EVENT_NAME_MAP[baseEventName]; for (var styleName in baseEvents) { if (styleName in style) { events.push(baseEvents[styleName]); break; } } } } } process2(START_EVENT_NAME_MAP, startEvents); process2(END_EVENT_NAME_MAP, endEvents); } if (typeof window !== "undefined" && typeof document !== "undefined") { detectEvents(); } function addEventListener$2(node, eventName, eventListener) { node.addEventListener(eventName, eventListener, false); } function removeEventListener$2(node, eventName, eventListener) { node.removeEventListener(eventName, eventListener, false); } var TransitionEvents = { startEvents, addStartEventListener: function addStartEventListener(node, eventListener) { if (startEvents.length === 0) { window.setTimeout(eventListener, 0); return; } startEvents.forEach(function(startEvent) { addEventListener$2(node, startEvent, eventListener); }); }, removeStartEventListener: function removeStartEventListener(node, eventListener) { if (startEvents.length === 0) { return; } startEvents.forEach(function(startEvent) { removeEventListener$2(node, startEvent, eventListener); }); }, endEvents, addEndEventListener: function addEndEventListener(node, eventListener) { if (endEvents.length === 0) { window.setTimeout(eventListener, 0); return; } endEvents.forEach(function(endEvent) { addEventListener$2(node, endEvent, eventListener); }); }, removeEndEventListener: function removeEndEventListener(node, eventListener) { if (endEvents.length === 0) { return; } endEvents.forEach(function(endEvent) { removeEventListener$2(node, endEvent, eventListener); }); } }; var Event$1 = TransitionEvents; var styleForPesudo; function isHidden(element) { return !element || element.offsetParent === null; } function isNotGrey(color) { var match5 = (color || "").match(/rgba?\((\d*), (\d*), (\d*)(, [\.\d]*)?\)/); if (match5 && match5[1] && match5[2] && match5[3]) { return !(match5[1] === match5[2] && match5[2] === match5[3]); } return true; } var Wave = defineComponent({ name: "Wave", props: ["insertExtraNode"], setup: function setup22() { var configProvider = inject("configProvider", defaultConfigProvider); return { configProvider }; }, mounted: function mounted6() { var _this = this; nextTick(function() { var node = findDOMNode(_this); if (node.nodeType !== 1) { return; } _this.instance = _this.bindAnimationEvent(node); }); }, beforeUnmount: function beforeUnmount5() { if (this.instance) { this.instance.cancel(); } if (this.clickWaveTimeoutId) { clearTimeout(this.clickWaveTimeoutId); } }, methods: { onClick: function onClick2(node, waveColor) { if (!node || isHidden(node) || node.className.indexOf("-leave") >= 0) { return; } var insertExtraNode = this.$props.insertExtraNode; this.extraNode = document.createElement("div"); var extraNode = this.extraNode; extraNode.className = "ant-click-animating-node"; var attributeName = this.getAttributeName(); node.removeAttribute(attributeName); node.setAttribute(attributeName, "true"); styleForPesudo = styleForPesudo || document.createElement("style"); if (waveColor && waveColor !== "#ffffff" && waveColor !== "rgb(255, 255, 255)" && isNotGrey(waveColor) && !/rgba\(\d*, \d*, \d*, 0\)/.test(waveColor) && waveColor !== "transparent") { if (this.csp && this.csp.nonce) { styleForPesudo.nonce = this.csp.nonce; } extraNode.style.borderColor = waveColor; styleForPesudo.innerHTML = "\n [ant-click-animating-without-extra-node='true']::after, .ant-click-animating-node {\n --antd-wave-shadow-color: ".concat(waveColor, ";\n }"); if (!document.body.contains(styleForPesudo)) { document.body.appendChild(styleForPesudo); } } if (insertExtraNode) { node.appendChild(extraNode); } Event$1.addStartEventListener(node, this.onTransitionStart); Event$1.addEndEventListener(node, this.onTransitionEnd); }, onTransitionStart: function onTransitionStart(e2) { if (this._.isUnmounted) return; var node = findDOMNode(this); if (!e2 || e2.target !== node) { return; } if (!this.animationStart) { this.resetEffect(node); } }, onTransitionEnd: function onTransitionEnd(e2) { if (!e2 || e2.animationName !== "fadeEffect") { return; } this.resetEffect(e2.target); }, getAttributeName: function getAttributeName() { var insertExtraNode = this.$props.insertExtraNode; return insertExtraNode ? "ant-click-animating" : "ant-click-animating-without-extra-node"; }, bindAnimationEvent: function bindAnimationEvent(node) { var _this2 = this; if (!node || !node.getAttribute || node.getAttribute("disabled") || node.className.indexOf("disabled") >= 0) { return; } var onClick7 = function onClick8(e2) { if (e2.target.tagName === "INPUT" || isHidden(e2.target)) { return; } _this2.resetEffect(node); var waveColor = getComputedStyle(node).getPropertyValue("border-top-color") || getComputedStyle(node).getPropertyValue("border-color") || getComputedStyle(node).getPropertyValue("background-color"); _this2.clickWaveTimeoutId = window.setTimeout(function() { return _this2.onClick(node, waveColor); }, 0); wrapperRaf.cancel(_this2.animationStartId); _this2.animationStart = true; _this2.animationStartId = wrapperRaf(function() { _this2.animationStart = false; }, 10); }; node.addEventListener("click", onClick7, true); return { cancel: function cancel2() { node.removeEventListener("click", onClick7, true); } }; }, resetEffect: function resetEffect(node) { if (!node || node === this.extraNode || !(node instanceof Element)) { return; } var insertExtraNode = this.$props.insertExtraNode; var attributeName = this.getAttributeName(); node.setAttribute(attributeName, "false"); if (styleForPesudo) { styleForPesudo.innerHTML = ""; } if (insertExtraNode && this.extraNode && node.contains(this.extraNode)) { node.removeChild(this.extraNode); } Event$1.removeStartEventListener(node, this.onTransitionStart); Event$1.removeEndEventListener(node, this.onTransitionEnd); } }, render: function render16() { var _a3, _b2; var csp = this.configProvider.csp; if (csp) { this.csp = csp; } return (_b2 = (_a3 = this.$slots).default) === null || _b2 === void 0 ? void 0 : _b2.call(_a3)[0]; } }); var ButtonTypes = tuple("default", "primary", "ghost", "dashed", "link", "text"); var ButtonShapes = tuple("circle", "round"); var ButtonHTMLTypes = tuple("submit", "button", "reset"); function convertLegacyProps(type2) { if (type2 === "danger") { return { danger: true }; } return { type: type2 }; } var buttonProps$1 = function buttonProps2() { return { prefixCls: PropsTypes.string, type: PropsTypes.oneOf(ButtonTypes), htmlType: PropsTypes.oneOf(ButtonHTMLTypes).def("button"), shape: PropsTypes.oneOf(ButtonShapes), size: { type: String }, loading: { type: [Boolean, Object], default: function _default8() { return false; } }, disabled: PropsTypes.looseBool, ghost: PropsTypes.looseBool, block: PropsTypes.looseBool, danger: PropsTypes.looseBool, icon: PropsTypes.VNodeChild, href: PropsTypes.string, target: PropsTypes.string, title: PropsTypes.string, onClick: { type: Function } }; }; var buttonTypes = buttonProps$1; var devWarning = function(valid, component, message2) { warningOnce(valid, "[ant-design-vue: ".concat(component, "] ").concat(message2)); }; var rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/; var isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar); var props$7 = buttonTypes(); function isUnborderedButtonType(type2) { return type2 === "text" || type2 === "link"; } var Button$1 = defineComponent({ name: "AButton", inheritAttrs: false, __ANT_BUTTON: true, props: props$7, slots: ["icon"], emits: ["click"], setup: function setup23(props2, _ref) { var slots = _ref.slots, attrs = _ref.attrs, emit2 = _ref.emit; var _useConfigInject = useConfigInject("btn", props2), prefixCls2 = _useConfigInject.prefixCls, autoInsertSpaceInButton = _useConfigInject.autoInsertSpaceInButton, direction = _useConfigInject.direction; var buttonNodeRef = ref(null); var delayTimeoutRef = ref(void 0); var isNeedInserted = false; var innerLoading = ref(false); var hasTwoCNChar = ref(false); var autoInsertSpace = computed(function() { return autoInsertSpaceInButton.value !== false; }); var loadingOrDelay = computed(function() { return _typeof$2(props2.loading) === "object" && props2.loading.delay ? props2.loading.delay || true : !!props2.loading; }); watch(loadingOrDelay, function(val) { clearTimeout(delayTimeoutRef.value); if (typeof loadingOrDelay.value === "number") { delayTimeoutRef.value = window.setTimeout(function() { innerLoading.value = val; }, loadingOrDelay.value); } else { innerLoading.value = val; } }, { immediate: true }); var classes3 = computed(function() { var _ref2; var type2 = props2.type, shape = props2.shape, size = props2.size, ghost = props2.ghost, block = props2.block, danger = props2.danger; var pre = prefixCls2.value; var sizeCls = ""; switch (size) { case "large": sizeCls = "lg"; break; case "small": sizeCls = "sm"; break; } return _ref2 = {}, _defineProperty$12(_ref2, "".concat(pre), true), _defineProperty$12(_ref2, "".concat(pre, "-").concat(type2), type2), _defineProperty$12(_ref2, "".concat(pre, "-").concat(shape), shape), _defineProperty$12(_ref2, "".concat(pre, "-").concat(sizeCls), sizeCls), _defineProperty$12(_ref2, "".concat(pre, "-loading"), innerLoading.value), _defineProperty$12(_ref2, "".concat(pre, "-background-ghost"), ghost && !isUnborderedButtonType(type2)), _defineProperty$12(_ref2, "".concat(pre, "-two-chinese-chars"), hasTwoCNChar.value && autoInsertSpace.value), _defineProperty$12(_ref2, "".concat(pre, "-block"), block), _defineProperty$12(_ref2, "".concat(pre, "-dangerous"), !!danger), _defineProperty$12(_ref2, "".concat(pre, "-rtl"), direction.value === "rtl"), _ref2; }); var fixTwoCNChar = function fixTwoCNChar2() { var node = buttonNodeRef.value; if (!node || autoInsertSpaceInButton.value === false) { return; } var buttonText = node.textContent; if (isNeedInserted && isTwoCNChar(buttonText)) { if (!hasTwoCNChar.value) { hasTwoCNChar.value = true; } } else if (hasTwoCNChar.value) { hasTwoCNChar.value = false; } }; var handleClick5 = function handleClick6(event) { if (innerLoading.value || props2.disabled) { event.preventDefault(); return; } emit2("click", event); }; var insertSpace = function insertSpace2(child, needInserted) { var SPACE = needInserted ? " " : ""; if (child.type === Text) { var text = child.children.trim(); if (isTwoCNChar(text)) { text = text.split("").join(SPACE); } return createVNode("span", null, [text]); } return child; }; watchEffect(function() { devWarning(!(props2.ghost && isUnborderedButtonType(props2.type)), "Button", "`link` or `text` button can't be a `ghost` button."); }); onMounted(fixTwoCNChar); onUpdated(fixTwoCNChar); onBeforeUnmount(function() { delayTimeoutRef.value && clearTimeout(delayTimeoutRef.value); }); return function() { var children = flattenChildren(getPropsSlot(slots, props2)); var icon = getPropsSlot(slots, props2, "icon"); isNeedInserted = children.length === 1 && !icon && !isUnborderedButtonType(props2.type); var type2 = props2.type, htmlType = props2.htmlType, disabled = props2.disabled, href = props2.href, title = props2.title, target = props2.target; var iconType = innerLoading.value ? "loading" : icon; var buttonProps3 = _extends$1(_extends$1({}, attrs), { title, disabled, class: [classes3.value, attrs.class, _defineProperty$12({}, "".concat(prefixCls2.value, "-icon-only"), children.length === 0 && !!iconType)], onClick: handleClick5 }); var iconNode = innerLoading.value ? createVNode(LoadingOutlined$3, null, null) : icon; var kids = children.map(function(child) { return insertSpace(child, isNeedInserted && autoInsertSpace.value); }); if (href !== void 0) { return createVNode("a", _objectSpread2$2(_objectSpread2$2({}, buttonProps3), {}, { "href": href, "target": target, "ref": buttonNodeRef }), [iconNode, kids]); } var buttonNode = createVNode("button", _objectSpread2$2(_objectSpread2$2({}, buttonProps3), {}, { "ref": buttonNodeRef, "type": htmlType }), [iconNode, kids]); if (isUnborderedButtonType(type2)) { return buttonNode; } return createVNode(Wave, { "ref": "wave" }, { default: function _default8() { return [buttonNode]; } }); }; } }); var buttonGroupProps = { prefixCls: PropsTypes.string, size: { type: String } }; var ButtonGroup$1 = defineComponent({ name: "AButtonGroup", props: buttonGroupProps, setup: function setup24(props2, _ref) { var slots = _ref.slots; var _useConfigInject = useConfigInject("btn-group", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction; var classes3 = computed(function() { var _ref2; var size = props2.size; var sizeCls = ""; switch (size) { case "large": sizeCls = "lg"; break; case "small": sizeCls = "sm"; break; } return _ref2 = {}, _defineProperty$12(_ref2, "".concat(prefixCls2.value), true), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-").concat(sizeCls), sizeCls), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-rtl"), direction.value === "rtl"), _ref2; }); return function() { var _a3; return createVNode("div", { "class": classes3.value }, [flattenChildren((_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots))]); }; } }); Button$1.Group = ButtonGroup$1; Button$1.install = function(app) { app.component(Button$1.name, Button$1); app.component(ButtonGroup$1.name, ButtonGroup$1); return app; }; var __rest$A = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var Search = defineComponent({ name: "AInputSearch", inheritAttrs: false, props: _extends$1(_extends$1({}, inputProps), { enterButton: PropsTypes.VNodeChild, onSearch: PropsTypes.func }), setup: function setup25() { return { configProvider: inject("configProvider", defaultConfigProvider), input: null }; }, methods: { saveInput: function saveInput2(node) { this.input = node; }, handleChange: function handleChange2(e2) { this.$emit("update:value", e2.target.value); if (e2 && e2.target && e2.type === "click") { this.$emit("search", e2.target.value, e2); } this.$emit("change", e2); }, handleSearch: function handleSearch(e2) { if (this.loading || this.disabled) { return; } this.$emit("search", this.input.stateValue, e2); if (!isMobile$1.tablet) { this.input.focus(); } }, focus: function focus2() { this.input.focus(); }, blur: function blur2() { this.input.blur(); }, renderLoading: function renderLoading(prefixCls2) { var size = this.$props.size; var enterButton = getComponent(this, "enterButton"); enterButton = enterButton || enterButton === ""; if (enterButton) { return createVNode(Button$1, { "class": "".concat(prefixCls2, "-button"), "type": "primary", "size": size, "key": "enterButton" }, { default: function _default8() { return [createVNode(LoadingOutlined$3, null, null)]; } }); } return createVNode(LoadingOutlined$3, { "class": "".concat(prefixCls2, "-icon"), "key": "loadingIcon" }, null); }, renderSuffix: function renderSuffix2(prefixCls2) { var loading = this.loading; var suffix = getComponent(this, "suffix"); var enterButton = getComponent(this, "enterButton"); enterButton = enterButton || enterButton === ""; if (loading && !enterButton) { return [suffix, this.renderLoading(prefixCls2)]; } if (enterButton) return suffix; var icon = createVNode(SearchOutlined$1, { "class": "".concat(prefixCls2, "-icon"), "key": "searchIcon", "onClick": this.handleSearch }, null); if (suffix) { return [suffix, icon]; } return icon; }, renderAddonAfter: function renderAddonAfter(prefixCls2) { var size = this.size, disabled = this.disabled, loading = this.loading; var btnClassName = "".concat(prefixCls2, "-button"); var enterButton = getComponent(this, "enterButton"); enterButton = enterButton || enterButton === ""; var addonAfter = getComponent(this, "addonAfter"); if (loading && enterButton) { return [this.renderLoading(prefixCls2), addonAfter]; } if (!enterButton) return addonAfter; var enterButtonAsElement = Array.isArray(enterButton) ? enterButton[0] : enterButton; var button; var isAntdButton = enterButtonAsElement.type && isPlainObject$1(enterButtonAsElement.type) && enterButtonAsElement.type.__ANT_BUTTON; if (enterButtonAsElement.tagName === "button" || isAntdButton) { button = cloneElement(enterButtonAsElement, _extends$1(_extends$1({ key: "enterButton", class: isAntdButton ? btnClassName : "" }, isAntdButton ? { size } : {}), { onClick: this.handleSearch })); } else { button = createVNode(Button$1, { "class": btnClassName, "type": "primary", "size": size, "disabled": disabled, "key": "enterButton", "onClick": this.handleSearch }, { default: function _default8() { return [enterButton === true || enterButton === "" ? createVNode(SearchOutlined$1, null, null) : enterButton]; } }); } if (addonAfter) { return [button, addonAfter]; } return button; } }, render: function render17() { var _a3 = _extends$1(_extends$1({}, getOptionProps(this)), this.$attrs), customizePrefixCls = _a3.prefixCls, customizeInputPrefixCls = _a3.inputPrefixCls, size = _a3.size, className = _a3.class, restProps = __rest$A(_a3, ["prefixCls", "inputPrefixCls", "size", "class"]); delete restProps.onSearch; delete restProps.loading; delete restProps.enterButton; delete restProps.addonBefore; delete restProps["onUpdate:value"]; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("input-search", customizePrefixCls); var inputPrefixCls = getPrefixCls2("input", customizeInputPrefixCls); var enterButton = getComponent(this, "enterButton"); var addonBefore = getComponent(this, "addonBefore"); enterButton = enterButton || enterButton === ""; var inputClassName; if (enterButton) { var _classNames; inputClassName = classNames(prefixCls2, className, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-enter-button"), !!enterButton), _defineProperty$12(_classNames, "".concat(prefixCls2, "-").concat(size), !!size), _classNames)); } else { inputClassName = classNames(prefixCls2, className); } var inputProps2 = _extends$1(_extends$1({}, restProps), { prefixCls: inputPrefixCls, size, suffix: this.renderSuffix(prefixCls2), prefix: getComponent(this, "prefix"), addonAfter: this.renderAddonAfter(prefixCls2), addonBefore, class: inputClassName, onPressEnter: this.handleSearch, onChange: this.handleChange }); return createVNode(Input, _objectSpread2$2(_objectSpread2$2({}, inputProps2), {}, { "ref": this.saveInput }), null); } }); var HIDDEN_TEXTAREA_STYLE = "\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n"; var SIZING_STYLE = ["letter-spacing", "line-height", "padding-top", "padding-bottom", "font-family", "font-weight", "font-size", "font-variant", "text-rendering", "text-transform", "width", "text-indent", "padding-left", "padding-right", "border-width", "box-sizing"]; var computedStyleCache = {}; var hiddenTextarea; function calculateNodeStyling(node) { var useCache = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; var nodeRef = node.getAttribute("id") || node.getAttribute("data-reactid") || node.getAttribute("name"); if (useCache && computedStyleCache[nodeRef]) { return computedStyleCache[nodeRef]; } var style = window.getComputedStyle(node); var boxSizing = style.getPropertyValue("box-sizing") || style.getPropertyValue("-moz-box-sizing") || style.getPropertyValue("-webkit-box-sizing"); var paddingSize = parseFloat(style.getPropertyValue("padding-bottom")) + parseFloat(style.getPropertyValue("padding-top")); var borderSize = parseFloat(style.getPropertyValue("border-bottom-width")) + parseFloat(style.getPropertyValue("border-top-width")); var sizingStyle = SIZING_STYLE.map(function(name) { return "".concat(name, ":").concat(style.getPropertyValue(name)); }).join(";"); var nodeInfo = { sizingStyle, paddingSize, borderSize, boxSizing }; if (useCache && nodeRef) { computedStyleCache[nodeRef] = nodeInfo; } return nodeInfo; } function calculateNodeHeight(uiTextNode) { var useCache = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; var minRows = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null; var maxRows = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null; if (!hiddenTextarea) { hiddenTextarea = document.createElement("textarea"); document.body.appendChild(hiddenTextarea); } if (uiTextNode.getAttribute("wrap")) { hiddenTextarea.setAttribute("wrap", uiTextNode.getAttribute("wrap")); } else { hiddenTextarea.removeAttribute("wrap"); } var _calculateNodeStyling = calculateNodeStyling(uiTextNode, useCache), paddingSize = _calculateNodeStyling.paddingSize, borderSize = _calculateNodeStyling.borderSize, boxSizing = _calculateNodeStyling.boxSizing, sizingStyle = _calculateNodeStyling.sizingStyle; hiddenTextarea.setAttribute("style", "".concat(sizingStyle, ";").concat(HIDDEN_TEXTAREA_STYLE)); hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || ""; var minHeight = Number.MIN_SAFE_INTEGER; var maxHeight = Number.MAX_SAFE_INTEGER; var height = hiddenTextarea.scrollHeight; var overflowY; if (boxSizing === "border-box") { height += borderSize; } else if (boxSizing === "content-box") { height -= paddingSize; } if (minRows !== null || maxRows !== null) { hiddenTextarea.value = " "; var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize; if (minRows !== null) { minHeight = singleRowHeight * minRows; if (boxSizing === "border-box") { minHeight = minHeight + paddingSize + borderSize; } height = Math.max(minHeight, height); } if (maxRows !== null) { maxHeight = singleRowHeight * maxRows; if (boxSizing === "border-box") { maxHeight = maxHeight + paddingSize + borderSize; } overflowY = height > maxHeight ? "" : "hidden"; height = Math.min(maxHeight, height); } } return { height: "".concat(height, "px"), minHeight: "".concat(minHeight, "px"), maxHeight: "".concat(maxHeight, "px"), overflowY, resize: "none" }; } var RESIZE_STATUS_NONE = 0; var RESIZE_STATUS_RESIZING = 1; var RESIZE_STATUS_RESIZED = 2; var TextAreaProps$1 = _extends$1(_extends$1({}, inputProps), { autosize: { type: [Boolean, Object], default: void 0 }, autoSize: { type: [Boolean, Object], default: void 0 }, onResize: PropsTypes.func }); var ResizableTextArea = defineComponent({ name: "ResizableTextArea", mixins: [BaseMixin], inheritAttrs: false, props: TextAreaProps$1, setup: function setup26() { return { nextFrameActionId: void 0, textArea: null, resizeFrameId: void 0 }; }, data: function data6() { return { textareaStyles: {}, resizeStatus: RESIZE_STATUS_NONE }; }, watch: { value: function value3() { var _this = this; nextTick(function() { _this.resizeTextarea(); }); } }, mounted: function mounted7() { this.resizeTextarea(); }, beforeUnmount: function beforeUnmount6() { wrapperRaf.cancel(this.nextFrameActionId); wrapperRaf.cancel(this.resizeFrameId); }, methods: { saveTextArea: function saveTextArea(textArea) { this.textArea = textArea; }, handleResize: function handleResize(size) { var resizeStatus = this.$data.resizeStatus; if (resizeStatus !== RESIZE_STATUS_NONE) { return; } this.$emit("resize", size); }, resizeOnNextFrame: function resizeOnNextFrame() { wrapperRaf.cancel(this.nextFrameActionId); this.nextFrameActionId = wrapperRaf(this.resizeTextarea); }, resizeTextarea: function resizeTextarea() { var _this2 = this; var autoSize = this.$props.autoSize || this.$props.autosize; if (!autoSize || !this.textArea) { return; } var minRows = autoSize.minRows, maxRows = autoSize.maxRows; var textareaStyles = calculateNodeHeight(this.textArea, false, minRows, maxRows); this.setState({ textareaStyles, resizeStatus: RESIZE_STATUS_RESIZING }, function() { wrapperRaf.cancel(_this2.resizeFrameId); _this2.resizeFrameId = wrapperRaf(function() { _this2.setState({ resizeStatus: RESIZE_STATUS_RESIZED }, function() { _this2.resizeFrameId = wrapperRaf(function() { _this2.setState({ resizeStatus: RESIZE_STATUS_NONE }); _this2.fixFirefoxAutoScroll(); }); }); }); }); }, fixFirefoxAutoScroll: function fixFirefoxAutoScroll() { try { if (document.activeElement === this.textArea) { var currentStart = this.textArea.selectionStart; var currentEnd = this.textArea.selectionEnd; this.textArea.setSelectionRange(currentStart, currentEnd); } } catch (e2) { } }, renderTextArea: function renderTextArea() { var _this3 = this; var props2 = _extends$1(_extends$1({}, getOptionProps(this)), this.$attrs); var prefixCls2 = props2.prefixCls, autoSize = props2.autoSize, autosize = props2.autosize, disabled = props2.disabled, className = props2.class; var _this$$data = this.$data, textareaStyles = _this$$data.textareaStyles, resizeStatus = _this$$data.resizeStatus; warning$5(autosize === void 0, "Input.TextArea", "autosize is deprecated, please use autoSize instead."); var otherProps = omit(props2, ["prefixCls", "onPressEnter", "autoSize", "autosize", "defaultValue", "allowClear", "type", "lazy"]); var cls = classNames(prefixCls2, className, _defineProperty$12({}, "".concat(prefixCls2, "-disabled"), disabled)); if ("value" in otherProps) { otherProps.value = otherProps.value || ""; } var style = _extends$1(_extends$1(_extends$1({}, props2.style), textareaStyles), resizeStatus === RESIZE_STATUS_RESIZING ? { overflowX: "hidden", overflowY: "hidden" } : null); var textareaProps = _extends$1(_extends$1({}, otherProps), { style, class: cls }); if (!textareaProps.autofocus) { delete textareaProps.autofocus; } return createVNode(ResizeObserver, { "onResize": this.handleResize, "disabled": !(autoSize || autosize) }, { default: function _default8() { return [withDirectives(createVNode("textarea", _objectSpread2$2(_objectSpread2$2({}, textareaProps), {}, { "ref": _this3.saveTextArea }), null), [[antInput$1]])]; } }); } }, render: function render18() { return this.renderTextArea(); } }); var ResizableTextArea$1 = ResizableTextArea; var TextAreaProps = _extends$1(_extends$1({}, inputProps), { autosize: withUndefined(PropsTypes.oneOfType([Object, Boolean])), autoSize: withUndefined(PropsTypes.oneOfType([Object, Boolean])), showCount: PropsTypes.looseBool, onCompositionstart: PropsTypes.func, onCompositionend: PropsTypes.func }); var TextArea = defineComponent({ name: "ATextarea", inheritAttrs: false, props: _extends$1({}, TextAreaProps), setup: function setup27() { return { configProvider: inject("configProvider", defaultConfigProvider), resizableTextArea: null, clearableInput: null }; }, data: function data7() { var value24 = typeof this.value === "undefined" ? this.defaultValue : this.value; return { stateValue: typeof value24 === "undefined" ? "" : value24 }; }, watch: { value: function value4(val) { this.stateValue = val; } }, mounted: function mounted8() { nextTick(function() { }); }, methods: { setValue: function setValue2(value24, callback2) { if (!hasProp(this, "value")) { this.stateValue = value24; } else { this.$forceUpdate(); } nextTick(function() { callback2 && callback2(); }); }, handleKeyDown: function handleKeyDown2(e2) { if (e2.keyCode === 13) { this.$emit("pressEnter", e2); } this.$emit("keydown", e2); }, triggerChange: function triggerChange2(e2) { this.$emit("update:value", e2.target.value); this.$emit("change", e2); this.$emit("input", e2); }, handleChange: function handleChange3(e2) { var _this2 = this; var _e$target = e2.target, value24 = _e$target.value, composing = _e$target.composing, isComposing = _e$target.isComposing; if ((isComposing || composing) && this.lazy || this.stateValue === value24) return; this.setValue(e2.target.value, function() { var _a3; (_a3 = _this2.resizableTextArea) === null || _a3 === void 0 ? void 0 : _a3.resizeTextarea(); }); resolveOnChange(this.resizableTextArea.textArea, e2, this.triggerChange); }, focus: function focus3() { this.resizableTextArea.textArea.focus(); }, blur: function blur3() { this.resizableTextArea.textArea.blur(); }, saveTextArea: function saveTextArea2(resizableTextArea) { this.resizableTextArea = resizableTextArea; }, saveClearableInput: function saveClearableInput2(clearableInput) { this.clearableInput = clearableInput; }, handleReset: function handleReset2(e2) { var _this3 = this; this.setValue("", function() { _this3.resizableTextArea.renderTextArea(); _this3.focus(); }); resolveOnChange(this.resizableTextArea.textArea, e2, this.triggerChange); }, renderTextArea: function renderTextArea2(prefixCls2) { var props2 = getOptionProps(this); var _this$$attrs = this.$attrs, style = _this$$attrs.style, customClass = _this$$attrs.class; var resizeProps = _extends$1(_extends$1(_extends$1({}, props2), this.$attrs), { style: !props2.showCount && style, class: !props2.showCount && customClass, showCount: null, prefixCls: prefixCls2, onInput: this.handleChange, onChange: this.handleChange, onKeydown: this.handleKeyDown }); return createVNode(ResizableTextArea$1, _objectSpread2$2(_objectSpread2$2({}, resizeProps), {}, { "ref": this.saveTextArea }), null); } }, render: function render19() { var stateValue = this.stateValue, customizePrefixCls = this.prefixCls, maxlength = this.maxlength, showCount = this.showCount; var _this$$attrs2 = this.$attrs, style = _this$$attrs2.style, customClass = _this$$attrs2.class; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("input", customizePrefixCls); var value24 = fixControlledValue(stateValue); var hasMaxlength = Number(maxlength) > 0; value24 = hasMaxlength ? value24.slice(0, maxlength) : value24; var props2 = _extends$1(_extends$1(_extends$1({}, getOptionProps(this)), this.$attrs), { prefixCls: prefixCls2, inputType: "text", element: this.renderTextArea(prefixCls2), handleReset: this.handleReset }); var textareaNode = createVNode(ClearableLabeledInput$1, _objectSpread2$2(_objectSpread2$2({}, props2), {}, { "value": value24, "ref": this.saveClearableInput }), null); if (showCount) { var valueLength = _toConsumableArray(value24).length; var dataCount = "".concat(valueLength).concat(hasMaxlength ? " / ".concat(maxlength) : ""); textareaNode = createVNode("div", { "class": classNames("".concat(prefixCls2, "-textarea"), "".concat(prefixCls2, "-textarea-show-count"), customClass), "style": style, "data-count": dataCount }, [textareaNode]); } return textareaNode; } }); var EyeOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" } }] }, "name": "eye", "theme": "outlined" }; var EyeOutlinedSvg = EyeOutlined$2; function _objectSpread$S(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$T(target, key2, source2[key2]); }); } return target; } function _defineProperty$T(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var EyeOutlined = function EyeOutlined2(props2, context2) { var p = _objectSpread$S({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$S({}, p, { "icon": EyeOutlinedSvg }), null); }; EyeOutlined.displayName = "EyeOutlined"; EyeOutlined.inheritAttrs = false; var EyeOutlined$1 = EyeOutlined; var EyeInvisibleOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z" } }, { "tag": "path", "attrs": { "d": "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z" } }] }, "name": "eye-invisible", "theme": "outlined" }; var EyeInvisibleOutlinedSvg = EyeInvisibleOutlined$2; function _objectSpread$R(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$S(target, key2, source2[key2]); }); } return target; } function _defineProperty$S(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var EyeInvisibleOutlined = function EyeInvisibleOutlined2(props2, context2) { var p = _objectSpread$R({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$R({}, p, { "icon": EyeInvisibleOutlinedSvg }), null); }; EyeInvisibleOutlined.displayName = "EyeInvisibleOutlined"; EyeInvisibleOutlined.inheritAttrs = false; var EyeInvisibleOutlined$1 = EyeInvisibleOutlined; var __rest$z = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var ActionMap = { click: "onClick", hover: "onMouseover" }; var Password = defineComponent({ name: "AInputPassword", mixins: [BaseMixin], inheritAttrs: false, props: _extends$1(_extends$1({}, inputProps), { prefixCls: PropsTypes.string, inputPrefixCls: PropsTypes.string, action: PropsTypes.string.def("click"), visibilityToggle: PropsTypes.looseBool.def(true), iconRender: PropsTypes.func.def(function(visible9) { return visible9 ? createVNode(EyeOutlined$1, null, null) : createVNode(EyeInvisibleOutlined$1, null, null); }) }), setup: function setup28() { return { input: null, configProvider: inject("configProvider", defaultConfigProvider) }; }, data: function data8() { return { visible: false }; }, methods: { saveInput: function saveInput3(node) { this.input = node; }, focus: function focus4() { this.input.focus(); }, blur: function blur4() { this.input.blur(); }, onVisibleChange: function onVisibleChange() { if (this.disabled) { return; } this.setState({ visible: !this.visible }); }, getIcon: function getIcon2(prefixCls2) { var _iconProps; var action = this.$props.action; var iconTrigger = ActionMap[action] || ""; var iconRender = this.$slots.iconRender || this.$props.iconRender; var icon = iconRender(this.visible); var iconProps = (_iconProps = {}, _defineProperty$12(_iconProps, iconTrigger, this.onVisibleChange), _defineProperty$12(_iconProps, "onMousedown", function onMousedown2(e2) { e2.preventDefault(); }), _defineProperty$12(_iconProps, "onMouseup", function onMouseup(e2) { e2.preventDefault(); }), _defineProperty$12(_iconProps, "class", "".concat(prefixCls2, "-icon")), _defineProperty$12(_iconProps, "key", "passwordIcon"), _iconProps); return cloneElement(icon, iconProps); } }, render: function render20() { var _a3 = getOptionProps(this), customizePrefixCls = _a3.prefixCls, customizeInputPrefixCls = _a3.inputPrefixCls, size = _a3.size; _a3.suffix; _a3.action; var visibilityToggle = _a3.visibilityToggle; _a3.iconRender; var restProps = __rest$z(_a3, ["prefixCls", "inputPrefixCls", "size", "suffix", "action", "visibilityToggle", "iconRender"]); var className = this.$attrs.class; var getPrefixCls2 = this.configProvider.getPrefixCls; var inputPrefixCls = getPrefixCls2("input", customizeInputPrefixCls); var prefixCls2 = getPrefixCls2("input-password", customizePrefixCls); var suffixIcon = visibilityToggle && this.getIcon(prefixCls2); var inputClassName = classNames(prefixCls2, className, _defineProperty$12({}, "".concat(prefixCls2, "-").concat(size), !!size)); var inputProps2 = _extends$1(_extends$1(_extends$1(_extends$1({}, restProps), { prefixCls: inputPrefixCls, size, suffix: suffixIcon, prefix: getComponent(this, "prefix"), addonAfter: getComponent(this, "addonAfter"), addonBefore: getComponent(this, "addonBefore") }), this.$attrs), { type: this.visible ? "text" : "password", class: inputClassName, ref: "input" }); return createVNode(Input, _objectSpread2$2(_objectSpread2$2({}, inputProps2), {}, { "ref": this.saveInput }), null); } }); Input.Group = Group$4; Input.Search = Search; Input.TextArea = TextArea; Input.Password = Password; Input.install = function(app) { app.component(Input.name, Input); app.component(Input.Group.name, Input.Group); app.component(Input.Search.name, Input.Search); app.component(Input.TextArea.name, Input.TextArea); app.component(Input.Password.name, Input.Password); return app; }; var Option = function Option3() { return null; }; Option.isSelectOption = true; Option.displayName = "AAutoCompleteOption"; var Option$1 = Option; var OptGroup = function OptGroup3() { return null; }; OptGroup.isSelectOptGroup = true; OptGroup.displayName = "AAutoCompleteOptGroup"; var OptGroup$1 = OptGroup; function isSelectOptionOrSelectOptGroup(child) { var _a3, _b2; return ((_a3 = child === null || child === void 0 ? void 0 : child.type) === null || _a3 === void 0 ? void 0 : _a3.isSelectOption) || ((_b2 = child === null || child === void 0 ? void 0 : child.type) === null || _b2 === void 0 ? void 0 : _b2.isSelectOptGroup); } var autoCompleteProps = _extends$1(_extends$1({}, SelectProps()), { dataSource: PropsTypes.array, dropdownMenuStyle: PropsTypes.style, optionLabelProp: PropsTypes.string, dropdownMatchSelectWidth: PropsTypes.looseBool }); var AutoComplete = defineComponent({ name: "AAutoComplete", inheritAttrs: false, props: _extends$1(_extends$1({}, autoCompleteProps), { prefixCls: PropsTypes.string, showSearch: PropsTypes.looseBool, transitionName: PropsTypes.string.def("slide-up"), choiceTransitionName: PropsTypes.string.def("zoom"), autofocus: PropsTypes.looseBool, backfill: PropsTypes.looseBool, optionLabelProp: PropsTypes.string.def("children"), filterOption: PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.func]).def(false), defaultActiveFirstOption: PropsTypes.looseBool.def(true) }), emits: ["change", "select", "focus", "blur"], Option: Option$1, OptGroup: OptGroup$1, setup: function setup29(props2, _ref) { var slots = _ref.slots; warning$5(!(props2.dataSource !== void 0 || "dataSource" in slots), "AutoComplete", "`dataSource` is deprecated, please use `options` instead."); return { configProvider: inject("configProvider", defaultConfigProvider), popupRef: null, select: null }; }, created: function created4() { provide("savePopupRef", this.savePopupRef); }, methods: { savePopupRef: function savePopupRef(ref2) { this.popupRef = ref2; }, saveSelect: function saveSelect(node) { this.select = node; }, getInputElement: function getInputElement() { var children = getSlot$1(this); var element = children.length ? children[0] : createVNode(Input, { "lazy": false }, null); return element; }, focus: function focus5() { if (this.select) { this.select.focus(); } }, blur: function blur5() { if (this.select) { this.select.blur(); } } }, render: function render21() { var _cls; var size = this.size, customizePrefixCls = this.prefixCls, dataSource2 = this.dataSource; var optionChildren; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("select", customizePrefixCls); var className = this.$attrs.class; var cls = (_cls = {}, _defineProperty$12(_cls, className, !!className), _defineProperty$12(_cls, "".concat(prefixCls2, "-lg"), size === "large"), _defineProperty$12(_cls, "".concat(prefixCls2, "-sm"), size === "small"), _defineProperty$12(_cls, "".concat(prefixCls2, "-show-search"), true), _defineProperty$12(_cls, "".concat(prefixCls2, "-auto-complete"), true), _cls); var childArray = getSlot$1(this, "dataSource"); if ("options" in this.$slots) { childArray = getSlot$1(this, "options"); } if (childArray.length && isSelectOptionOrSelectOptGroup(childArray[0])) { optionChildren = childArray; } else { optionChildren = dataSource2 ? dataSource2.map(function(item) { if (isValidElement(item)) { return item; } switch (_typeof$2(item)) { case "string": return createVNode(Option$1, { "key": item, "value": item }, { default: function _default8() { return [item]; } }); case "object": return createVNode(Option$1, { "key": item.value, "value": item.value }, { default: function _default8() { return [item.text]; } }); default: throw new Error("AutoComplete[dataSource] only supports type `string[] | Object[]`."); } }) : []; } var selectProps = _extends$1(_extends$1(_extends$1({}, omit(getOptionProps(this), ["dataSource", "optionLabelProp"])), this.$attrs), { mode: Select$5.SECRET_COMBOBOX_MODE_DO_NOT_USE, getInputElement: this.getInputElement, notFoundContent: getComponent(this, "notFoundContent"), class: cls, ref: this.saveSelect }); return createVNode(Select$5, selectProps, { default: function _default8() { return [optionChildren]; } }); } }); AutoComplete.install = function(app) { app.component(AutoComplete.name, AutoComplete); app.component(AutoComplete.Option.displayName, AutoComplete.Option); app.component(AutoComplete.OptGroup.displayName, AutoComplete.OptGroup); return app; }; var AutoComplete$1 = AutoComplete; var CheckCircleOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z" } }, { "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "check-circle", "theme": "outlined" }; var CheckCircleOutlinedSvg = CheckCircleOutlined$2; function _objectSpread$Q(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$R(target, key2, source2[key2]); }); } return target; } function _defineProperty$R(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CheckCircleOutlined = function CheckCircleOutlined2(props2, context2) { var p = _objectSpread$Q({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$Q({}, p, { "icon": CheckCircleOutlinedSvg }), null); }; CheckCircleOutlined.displayName = "CheckCircleOutlined"; CheckCircleOutlined.inheritAttrs = false; var CheckCircleOutlined$1 = CheckCircleOutlined; var ExclamationCircleOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z" } }] }, "name": "exclamation-circle", "theme": "outlined" }; var ExclamationCircleOutlinedSvg = ExclamationCircleOutlined$2; function _objectSpread$P(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$Q(target, key2, source2[key2]); }); } return target; } function _defineProperty$Q(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var ExclamationCircleOutlined = function ExclamationCircleOutlined2(props2, context2) { var p = _objectSpread$P({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$P({}, p, { "icon": ExclamationCircleOutlinedSvg }), null); }; ExclamationCircleOutlined.displayName = "ExclamationCircleOutlined"; ExclamationCircleOutlined.inheritAttrs = false; var ExclamationCircleOutlined$1 = ExclamationCircleOutlined; var InfoCircleOutlined$4 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z" } }] }, "name": "info-circle", "theme": "outlined" }; var InfoCircleOutlinedSvg = InfoCircleOutlined$4; function _objectSpread$O(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$P(target, key2, source2[key2]); }); } return target; } function _defineProperty$P(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var InfoCircleOutlined$2 = function InfoCircleOutlined2(props2, context2) { var p = _objectSpread$O({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$O({}, p, { "icon": InfoCircleOutlinedSvg }), null); }; InfoCircleOutlined$2.displayName = "InfoCircleOutlined"; InfoCircleOutlined$2.inheritAttrs = false; var InfoCircleOutlined$3 = InfoCircleOutlined$2; var CloseCircleOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M685.4 354.8c0-4.4-3.6-8-8-8l-66 .3L512 465.6l-99.3-118.4-66.1-.3c-4.4 0-8 3.5-8 8 0 1.9.7 3.7 1.9 5.2l130.1 155L340.5 670a8.32 8.32 0 00-1.9 5.2c0 4.4 3.6 8 8 8l66.1-.3L512 564.4l99.3 118.4 66 .3c4.4 0 8-3.5 8-8 0-1.9-.7-3.7-1.9-5.2L553.5 515l130.1-155c1.2-1.4 1.8-3.3 1.8-5.2z" } }, { "tag": "path", "attrs": { "d": "M512 65C264.6 65 64 265.6 64 513s200.6 448 448 448 448-200.6 448-448S759.4 65 512 65zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "close-circle", "theme": "outlined" }; var CloseCircleOutlinedSvg = CloseCircleOutlined$2; function _objectSpread$N(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$O(target, key2, source2[key2]); }); } return target; } function _defineProperty$O(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CloseCircleOutlined = function CloseCircleOutlined2(props2, context2) { var p = _objectSpread$N({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$N({}, p, { "icon": CloseCircleOutlinedSvg }), null); }; CloseCircleOutlined.displayName = "CloseCircleOutlined"; CloseCircleOutlined.inheritAttrs = false; var CloseCircleOutlined$1 = CloseCircleOutlined; var CheckCircleFilled$4 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" } }] }, "name": "check-circle", "theme": "filled" }; var CheckCircleFilledSvg = CheckCircleFilled$4; function _objectSpread$M(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$N(target, key2, source2[key2]); }); } return target; } function _defineProperty$N(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CheckCircleFilled$2 = function CheckCircleFilled2(props2, context2) { var p = _objectSpread$M({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$M({}, p, { "icon": CheckCircleFilledSvg }), null); }; CheckCircleFilled$2.displayName = "CheckCircleFilled"; CheckCircleFilled$2.inheritAttrs = false; var CheckCircleFilled$3 = CheckCircleFilled$2; var ExclamationCircleFilled$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "exclamation-circle", "theme": "filled" }; var ExclamationCircleFilledSvg = ExclamationCircleFilled$2; function _objectSpread$L(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$M(target, key2, source2[key2]); }); } return target; } function _defineProperty$M(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var ExclamationCircleFilled = function ExclamationCircleFilled2(props2, context2) { var p = _objectSpread$L({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$L({}, p, { "icon": ExclamationCircleFilledSvg }), null); }; ExclamationCircleFilled.displayName = "ExclamationCircleFilled"; ExclamationCircleFilled.inheritAttrs = false; var ExclamationCircleFilled$1 = ExclamationCircleFilled; var InfoCircleFilled$4 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "info-circle", "theme": "filled" }; var InfoCircleFilledSvg = InfoCircleFilled$4; function _objectSpread$K(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$L(target, key2, source2[key2]); }); } return target; } function _defineProperty$L(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var InfoCircleFilled$2 = function InfoCircleFilled2(props2, context2) { var p = _objectSpread$K({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$K({}, p, { "icon": InfoCircleFilledSvg }), null); }; InfoCircleFilled$2.displayName = "InfoCircleFilled"; InfoCircleFilled$2.inheritAttrs = false; var InfoCircleFilled$3 = InfoCircleFilled$2; var responsiveArray = ["xxl", "xl", "lg", "md", "sm", "xs"]; var responsiveMap = { xs: "(max-width: 575px)", sm: "(min-width: 576px)", md: "(min-width: 768px)", lg: "(min-width: 992px)", xl: "(min-width: 1200px)", xxl: "(min-width: 1600px)" }; var subscribers = /* @__PURE__ */ new Map(); var subUid = -1; var screens = {}; var responsiveObserve = { matchHandlers: {}, dispatch: function dispatch(pointMap) { screens = pointMap; subscribers.forEach(function(func) { return func(screens); }); return subscribers.size >= 1; }, subscribe: function subscribe(func) { if (!subscribers.size) this.register(); subUid += 1; subscribers.set(subUid, func); func(screens); return subUid; }, unsubscribe: function unsubscribe(token2) { subscribers.delete(token2); if (!subscribers.size) this.unregister(); }, unregister: function unregister() { var _this = this; Object.keys(responsiveMap).forEach(function(screen) { var matchMediaQuery = responsiveMap[screen]; var handler7 = _this.matchHandlers[matchMediaQuery]; handler7 === null || handler7 === void 0 ? void 0 : handler7.mql.removeListener(handler7 === null || handler7 === void 0 ? void 0 : handler7.listener); }); subscribers.clear(); }, register: function register() { var _this2 = this; Object.keys(responsiveMap).forEach(function(screen) { var matchMediaQuery = responsiveMap[screen]; var listener = function listener2(_ref) { var matches = _ref.matches; _this2.dispatch(_extends$1(_extends$1({}, screens), _defineProperty$12({}, screen, matches))); }; var mql = window.matchMedia(matchMediaQuery); mql.addListener(listener); _this2.matchHandlers[matchMediaQuery] = { mql, listener }; listener(mql); }); } }; var ResponsiveObserve = responsiveObserve; function useBreakpoint() { var screens2 = ref({}); var token2 = null; onMounted(function() { token2 = ResponsiveObserve.subscribe(function(supportScreens) { screens2.value = supportScreens; }); }); onUnmounted(function() { ResponsiveObserve.unsubscribe(token2); }); return screens2; } var sizeProvider = Symbol("SizeProvider"); var useProvideSize = function useProvideSize2(props2) { var configProvider = inject("configProvider", defaultConfigProvider); var size = computed(function() { return props2.size || configProvider.componentSize; }); provide(sizeProvider, size); return size; }; var useInjectSize = function useInjectSize2(props2) { var size = props2 ? computed(function() { return props2.size; }) : inject(sizeProvider, computed(function() { return "default"; })); return size; }; var avatarProps$1 = { prefixCls: PropsTypes.string, shape: PropsTypes.oneOf(tuple("circle", "square")).def("circle"), size: { type: [Number, String, Object], default: function _default2() { return "default"; } }, src: PropsTypes.string, srcset: PropsTypes.string, icon: PropsTypes.VNodeChild, alt: PropsTypes.string, gap: PropsTypes.number, draggable: PropsTypes.bool, loadError: { type: Function } }; var Avatar = defineComponent({ name: "AAvatar", inheritAttrs: false, props: avatarProps$1, slots: ["icon"], setup: function setup30(props2, _ref) { var slots = _ref.slots, attrs = _ref.attrs; var isImgExist = ref(true); var isMounted = ref(false); var scale = ref(1); var avatarChildrenRef = ref(null); var avatarNodeRef = ref(null); var _useConfigInject = useConfigInject("avatar", props2), prefixCls2 = _useConfigInject.prefixCls; var groupSize = useInjectSize(); var screens2 = useBreakpoint(); var responsiveSize = computed(function() { if (_typeof$2(props2.size) !== "object") { return void 0; } var currentBreakpoint = responsiveArray.find(function(screen) { return screens2.value[screen]; }); var currentSize = props2.size[currentBreakpoint]; return currentSize; }); var responsiveSizeStyle = function responsiveSizeStyle2(hasIcon) { if (responsiveSize.value) { return { width: "".concat(responsiveSize.value, "px"), height: "".concat(responsiveSize.value, "px"), lineHeight: "".concat(responsiveSize.value, "px"), fontSize: "".concat(hasIcon ? responsiveSize.value / 2 : 18, "px") }; } return {}; }; var setScaleParam = function setScaleParam2() { if (!avatarChildrenRef.value || !avatarNodeRef.value) { return; } var childrenWidth = avatarChildrenRef.value.offsetWidth; var nodeWidth = avatarNodeRef.value.offsetWidth; if (childrenWidth !== 0 && nodeWidth !== 0) { var _props$gap = props2.gap, gap = _props$gap === void 0 ? 4 : _props$gap; if (gap * 2 < nodeWidth) { scale.value = nodeWidth - gap * 2 < childrenWidth ? (nodeWidth - gap * 2) / childrenWidth : 1; } } }; var handleImgLoadError = function handleImgLoadError2() { var loadError = props2.loadError; var errorFlag = loadError === null || loadError === void 0 ? void 0 : loadError(); if (errorFlag !== false) { isImgExist.value = false; } }; watch(function() { return props2.src; }, function() { nextTick(function() { isImgExist.value = true; scale.value = 1; }); }); watch(function() { return props2.gap; }, function() { nextTick(function() { setScaleParam(); }); }); onMounted(function() { nextTick(function() { setScaleParam(); isMounted.value = true; }); }); return function() { var _classString; var _a3; var shape = props2.shape, customSize = props2.size, src2 = props2.src, alt = props2.alt, srcset = props2.srcset, draggable = props2.draggable; var icon = getPropsSlot(slots, props2, "icon"); var pre = prefixCls2.value; var size = customSize === "default" ? groupSize.value : customSize; var classString = (_classString = {}, _defineProperty$12(_classString, "".concat(attrs.class), !!attrs.class), _defineProperty$12(_classString, pre, true), _defineProperty$12(_classString, "".concat(pre, "-lg"), size === "large"), _defineProperty$12(_classString, "".concat(pre, "-sm"), size === "small"), _defineProperty$12(_classString, "".concat(pre, "-").concat(shape), shape), _defineProperty$12(_classString, "".concat(pre, "-image"), src2 && isImgExist.value), _defineProperty$12(_classString, "".concat(pre, "-icon"), icon), _classString); var sizeStyle = typeof size === "number" ? { width: "".concat(size, "px"), height: "".concat(size, "px"), lineHeight: "".concat(size, "px"), fontSize: icon ? "".concat(size / 2, "px") : "18px" } : {}; var children = (_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots); var childrenToRender; if (src2 && isImgExist.value) { childrenToRender = createVNode("img", { "draggable": draggable, "src": src2, "srcset": srcset, "onError": handleImgLoadError, "alt": alt }, null); } else if (icon) { childrenToRender = icon; } else if (isMounted.value || scale.value !== 1) { var transformString = "scale(".concat(scale.value, ") translateX(-50%)"); var childrenStyle = { msTransform: transformString, WebkitTransform: transformString, transform: transformString }; var sizeChildrenStyle = typeof size === "number" ? { lineHeight: "".concat(size, "px") } : {}; childrenToRender = createVNode(ResizeObserver, { "onResize": setScaleParam }, { default: function _default8() { return [createVNode("span", { "class": "".concat(pre, "-string"), "ref": avatarChildrenRef, "style": _extends$1(_extends$1({}, sizeChildrenStyle), childrenStyle) }, [children])]; } }); } else { childrenToRender = createVNode("span", { "class": "".concat(pre, "-string"), "ref": avatarChildrenRef, "style": { opacity: 0 } }, [children]); } return createVNode("span", _objectSpread2$2(_objectSpread2$2({}, attrs), {}, { "ref": avatarNodeRef, "class": classString, "style": _extends$1(_extends$1(_extends$1({}, sizeStyle), responsiveSizeStyle(!!icon)), attrs.style) }), [childrenToRender]); }; } }); var Avatar$1 = Avatar; var autoAdjustOverflow$4 = { adjustX: 1, adjustY: 1 }; var targetOffset$4 = [0, 0]; var placements$7 = { left: { points: ["cr", "cl"], overflow: autoAdjustOverflow$4, offset: [-4, 0], targetOffset: targetOffset$4 }, right: { points: ["cl", "cr"], overflow: autoAdjustOverflow$4, offset: [4, 0], targetOffset: targetOffset$4 }, top: { points: ["bc", "tc"], overflow: autoAdjustOverflow$4, offset: [0, -4], targetOffset: targetOffset$4 }, bottom: { points: ["tc", "bc"], overflow: autoAdjustOverflow$4, offset: [0, 4], targetOffset: targetOffset$4 }, topLeft: { points: ["bl", "tl"], overflow: autoAdjustOverflow$4, offset: [0, -4], targetOffset: targetOffset$4 }, leftTop: { points: ["tr", "tl"], overflow: autoAdjustOverflow$4, offset: [-4, 0], targetOffset: targetOffset$4 }, topRight: { points: ["br", "tr"], overflow: autoAdjustOverflow$4, offset: [0, -4], targetOffset: targetOffset$4 }, rightTop: { points: ["tl", "tr"], overflow: autoAdjustOverflow$4, offset: [4, 0], targetOffset: targetOffset$4 }, bottomRight: { points: ["tr", "br"], overflow: autoAdjustOverflow$4, offset: [0, 4], targetOffset: targetOffset$4 }, rightBottom: { points: ["bl", "br"], overflow: autoAdjustOverflow$4, offset: [4, 0], targetOffset: targetOffset$4 }, bottomLeft: { points: ["tl", "bl"], overflow: autoAdjustOverflow$4, offset: [0, 4], targetOffset: targetOffset$4 }, leftBottom: { points: ["br", "bl"], overflow: autoAdjustOverflow$4, offset: [-4, 0], targetOffset: targetOffset$4 } }; var Content = { name: "Content", props: { prefixCls: PropsTypes.string, overlay: PropsTypes.any, trigger: PropsTypes.any, overlayInnerStyle: PropsTypes.any }, updated: function updated4() { var trigger2 = this.trigger; if (trigger2) { trigger2.forcePopupAlign(); } }, render: function render22() { var overlay = this.overlay, prefixCls2 = this.prefixCls, overlayInnerStyle = this.overlayInnerStyle; return createVNode("div", { "class": "".concat(prefixCls2, "-inner"), "role": "tooltip", "style": overlayInnerStyle }, [typeof overlay === "function" ? overlay() : overlay]); } }; var __rest$y = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; function noop$u() { } var Tooltip$1 = defineComponent({ name: "Tooltip", inheritAttrs: false, props: { trigger: PropsTypes.any.def(["hover"]), defaultVisible: PropsTypes.looseBool, visible: PropsTypes.looseBool, placement: PropsTypes.string.def("right"), transitionName: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.object]), animation: PropsTypes.any, afterVisibleChange: PropsTypes.func.def(function() { }), overlay: PropsTypes.any, overlayStyle: PropsTypes.object, overlayClassName: PropsTypes.string, prefixCls: PropsTypes.string.def("rc-tooltip"), mouseEnterDelay: PropsTypes.number.def(0), mouseLeaveDelay: PropsTypes.number.def(0.1), getTooltipContainer: PropsTypes.func, destroyTooltipOnHide: PropsTypes.looseBool.def(false), align: PropsTypes.object.def(function() { return {}; }), arrowContent: PropsTypes.any.def(null), tipId: PropsTypes.string, builtinPlacements: PropsTypes.object, overlayInnerStyle: PropsTypes.style }, methods: { getPopupElement: function getPopupElement3() { var _this$$props = this.$props, prefixCls2 = _this$$props.prefixCls, tipId = _this$$props.tipId, overlayInnerStyle = _this$$props.overlayInnerStyle; return [createVNode("div", { "class": "".concat(prefixCls2, "-arrow"), "key": "arrow" }, [getComponent(this, "arrowContent")]), createVNode(Content, { "key": "content", "trigger": this.$refs.trigger, "prefixCls": prefixCls2, "id": tipId, "overlay": getComponent(this, "overlay"), "overlayInnerStyle": overlayInnerStyle }, null)]; }, getPopupDomNode: function getPopupDomNode3() { return this.$refs.trigger.getPopupDomNode(); } }, render: function render23(h2) { var _this = this; var _a3 = getOptionProps(this), overlayClassName = _a3.overlayClassName, trigger2 = _a3.trigger, mouseEnterDelay = _a3.mouseEnterDelay, mouseLeaveDelay = _a3.mouseLeaveDelay, overlayStyle = _a3.overlayStyle, prefixCls2 = _a3.prefixCls, afterVisibleChange2 = _a3.afterVisibleChange, transitionName2 = _a3.transitionName, animation2 = _a3.animation, placement2 = _a3.placement, align = _a3.align, destroyTooltipOnHide = _a3.destroyTooltipOnHide, defaultVisible = _a3.defaultVisible, getTooltipContainer = _a3.getTooltipContainer, restProps = __rest$y(_a3, ["overlayClassName", "trigger", "mouseEnterDelay", "mouseLeaveDelay", "overlayStyle", "prefixCls", "afterVisibleChange", "transitionName", "animation", "placement", "align", "destroyTooltipOnHide", "defaultVisible", "getTooltipContainer"]); var extraProps = _extends$1({}, restProps); if (hasProp(this, "visible")) { extraProps.popupVisible = this.$props.visible; } var $attrs = this.$attrs; var triggerProps = _extends$1(_extends$1(_extends$1({ popupClassName: overlayClassName, prefixCls: prefixCls2, action: trigger2, builtinPlacements: placements$7, popupPlacement: placement2, popupAlign: align, getPopupContainer: getTooltipContainer, afterPopupVisibleChange: afterVisibleChange2, popupTransitionName: transitionName2, popupAnimation: animation2, defaultPopupVisible: defaultVisible, destroyPopupOnHide: destroyTooltipOnHide, mouseLeaveDelay, popupStyle: overlayStyle, mouseEnterDelay }, extraProps), $attrs), { onPopupVisibleChange: $attrs.onVisibleChange || noop$u, onPopupAlign: $attrs.onPopupAlign || noop$u, ref: "trigger", popup: this.getPopupElement() }); return createVNode(Trigger, triggerProps, { default: function _default8() { return [getSlot$1(_this)[0]]; } }); } }); var autoAdjustOverflowEnabled = { adjustX: 1, adjustY: 1 }; var autoAdjustOverflowDisabled = { adjustX: 0, adjustY: 0 }; var targetOffset$3 = [0, 0]; function getOverflowOptions(autoAdjustOverflow2) { if (typeof autoAdjustOverflow2 === "boolean") { return autoAdjustOverflow2 ? autoAdjustOverflowEnabled : autoAdjustOverflowDisabled; } return _extends$1(_extends$1({}, autoAdjustOverflowDisabled), autoAdjustOverflow2); } function getPlacements(config3) { var _config$arrowWidth = config3.arrowWidth, arrowWidth = _config$arrowWidth === void 0 ? 5 : _config$arrowWidth, _config$horizontalArr = config3.horizontalArrowShift, horizontalArrowShift = _config$horizontalArr === void 0 ? 16 : _config$horizontalArr, _config$verticalArrow = config3.verticalArrowShift, verticalArrowShift = _config$verticalArrow === void 0 ? 12 : _config$verticalArrow, _config$autoAdjustOve = config3.autoAdjustOverflow, autoAdjustOverflow2 = _config$autoAdjustOve === void 0 ? true : _config$autoAdjustOve; var placementMap = { left: { points: ["cr", "cl"], offset: [-4, 0] }, right: { points: ["cl", "cr"], offset: [4, 0] }, top: { points: ["bc", "tc"], offset: [0, -4] }, bottom: { points: ["tc", "bc"], offset: [0, 4] }, topLeft: { points: ["bl", "tc"], offset: [-(horizontalArrowShift + arrowWidth), -4] }, leftTop: { points: ["tr", "cl"], offset: [-4, -(verticalArrowShift + arrowWidth)] }, topRight: { points: ["br", "tc"], offset: [horizontalArrowShift + arrowWidth, -4] }, rightTop: { points: ["tl", "cr"], offset: [4, -(verticalArrowShift + arrowWidth)] }, bottomRight: { points: ["tr", "bc"], offset: [horizontalArrowShift + arrowWidth, 4] }, rightBottom: { points: ["bl", "cr"], offset: [4, verticalArrowShift + arrowWidth] }, bottomLeft: { points: ["tl", "bc"], offset: [-(horizontalArrowShift + arrowWidth), 4] }, leftBottom: { points: ["br", "cl"], offset: [-4, verticalArrowShift + arrowWidth] } }; Object.keys(placementMap).forEach(function(key2) { placementMap[key2] = config3.arrowPointAtCenter ? _extends$1(_extends$1({}, placementMap[key2]), { overflow: getOverflowOptions(autoAdjustOverflow2), targetOffset: targetOffset$3 }) : _extends$1(_extends$1({}, placements$7[key2]), { overflow: getOverflowOptions(autoAdjustOverflow2) }); placementMap[key2].ignoreShake = true; }); return placementMap; } var PresetStatusColorTypes = tuple("success", "processing", "error", "default", "warning"); var PresetColorTypes = tuple("pink", "red", "yellow", "orange", "cyan", "green", "blue", "purple", "geekblue", "magenta", "volcano", "gold", "lime"); var triggerType = PropsTypes.oneOf(tuple("hover", "focus", "click", "contextmenu")); var abstractTooltipProps = function() { return { trigger: PropsTypes.oneOfType([triggerType, PropsTypes.arrayOf(triggerType)]).def("hover"), visible: PropsTypes.looseBool, defaultVisible: PropsTypes.looseBool, placement: PropsTypes.oneOf(tuple("top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom")).def("top"), color: PropsTypes.string, transitionName: PropsTypes.string.def("zoom-big-fast"), overlayStyle: PropsTypes.object.def(function() { return {}; }), overlayClassName: PropsTypes.string, openClassName: PropsTypes.string, prefixCls: PropsTypes.string, mouseEnterDelay: PropsTypes.number.def(0.1), mouseLeaveDelay: PropsTypes.number.def(0.1), getPopupContainer: PropsTypes.func, arrowPointAtCenter: PropsTypes.looseBool.def(false), autoAdjustOverflow: PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.object]).def(true), destroyTooltipOnHide: PropsTypes.looseBool.def(false), align: PropsTypes.object.def(function() { return {}; }), builtinPlacements: PropsTypes.object, children: PropsTypes.array, onVisibleChange: PropsTypes.func, "onUpdate:visible": PropsTypes.func }; }; var splitObject = function splitObject2(obj, keys2) { var picked = {}; var omitted = _extends$1({}, obj); keys2.forEach(function(key2) { if (obj && key2 in obj) { picked[key2] = obj[key2]; delete omitted[key2]; } }); return { picked, omitted }; }; var props$6 = abstractTooltipProps(); var PresetColorRegex$1 = new RegExp("^(".concat(PresetColorTypes.join("|"), ")(-inverse)?$")); var tooltipProps$2 = _extends$1(_extends$1({}, props$6), { title: PropsTypes.VNodeChild }); var ToolTip = defineComponent({ name: "ATooltip", inheritAttrs: false, props: tooltipProps$2, emits: ["update:visible", "visibleChange"], setup: function setup31() { return { configProvider: inject("configProvider", defaultConfigProvider) }; }, data: function data9() { return { sVisible: !!this.$props.visible || !!this.$props.defaultVisible }; }, watch: { visible: function visible(val) { this.sVisible = val; } }, methods: { handleVisibleChange: function handleVisibleChange(visible9) { if (!hasProp(this, "visible")) { this.sVisible = this.isNoTitle() ? false : visible9; } if (!this.isNoTitle()) { this.$emit("update:visible", visible9); this.$emit("visibleChange", visible9); } }, getPopupDomNode: function getPopupDomNode4() { return this.$refs.tooltip.getPopupDomNode(); }, getPlacements: function getPlacements$1() { var _this$$props = this.$props, builtinPlacements = _this$$props.builtinPlacements, arrowPointAtCenter = _this$$props.arrowPointAtCenter, autoAdjustOverflow2 = _this$$props.autoAdjustOverflow; return builtinPlacements || getPlacements({ arrowPointAtCenter, verticalArrowShift: 8, autoAdjustOverflow: autoAdjustOverflow2 }); }, getDisabledCompatibleChildren: function getDisabledCompatibleChildren(ele) { if ((_typeof$2(ele.type) === "object" && (ele.type.__ANT_BUTTON === true || ele.type.__ANT_SWITCH === true || ele.type.__ANT_CHECKBOX === true) || ele.type === "button") && ele.props && (ele.props.disabled || ele.props.disabled === "")) { var _splitObject = splitObject(getStyle(ele), ["position", "left", "right", "top", "bottom", "float", "display", "zIndex"]), picked = _splitObject.picked, omitted = _splitObject.omitted; var spanStyle = _extends$1(_extends$1({ display: "inline-block" }, picked), { cursor: "not-allowed", width: ele.props && ele.props.block ? "100%" : null }); var buttonStyle = _extends$1(_extends$1({}, omitted), { pointerEvents: "none" }); var child = cloneElement(ele, { style: buttonStyle }, true); return createVNode("span", { "style": spanStyle }, [child]); } return ele; }, isNoTitle: function isNoTitle() { var title = getComponent(this, "title"); return !title && title !== 0; }, getOverlay: function getOverlay() { var title = getComponent(this, "title"); if (title === 0) { return title; } return title || ""; }, onPopupAlign: function onPopupAlign(domNode, align) { var placements2 = this.getPlacements(); var placement2 = Object.keys(placements2).filter(function(key2) { return placements2[key2].points[0] === align.points[0] && placements2[key2].points[1] === align.points[1]; })[0]; if (!placement2) { return; } var rect = domNode.getBoundingClientRect(); var transformOrigin = { top: "50%", left: "50%" }; if (placement2.indexOf("top") >= 0 || placement2.indexOf("Bottom") >= 0) { transformOrigin.top = "".concat(rect.height - align.offset[1], "px"); } else if (placement2.indexOf("Top") >= 0 || placement2.indexOf("bottom") >= 0) { transformOrigin.top = "".concat(-align.offset[1], "px"); } if (placement2.indexOf("left") >= 0 || placement2.indexOf("Right") >= 0) { transformOrigin.left = "".concat(rect.width - align.offset[0], "px"); } else if (placement2.indexOf("right") >= 0 || placement2.indexOf("Left") >= 0) { transformOrigin.left = "".concat(-align.offset[0], "px"); } domNode.style.transformOrigin = "".concat(transformOrigin.left, " ").concat(transformOrigin.top); } }, render: function render24() { var _classNames; var $props = this.$props, $data = this.$data, $attrs = this.$attrs; var customizePrefixCls = $props.prefixCls, openClassName = $props.openClassName, getPopupContainer2 = $props.getPopupContainer, color = $props.color, overlayClassName = $props.overlayClassName; var getContextPopupContainer = this.configProvider.getPopupContainer; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("tooltip", customizePrefixCls); var children = this.children || filterEmpty(getSlot$1(this)); children = children.length === 1 ? children[0] : children; var sVisible = $data.sVisible; if (!hasProp(this, "visible") && this.isNoTitle()) { sVisible = false; } if (!children) { return null; } var child = this.getDisabledCompatibleChildren(isValidElement(children) ? children : createVNode("span", null, [children])); var childCls = classNames((_classNames = {}, _defineProperty$12(_classNames, openClassName || "".concat(prefixCls2, "-open"), sVisible), _defineProperty$12(_classNames, child.props && child.props.class, child.props && child.props.class), _classNames)); var customOverlayClassName = classNames(overlayClassName, _defineProperty$12({}, "".concat(prefixCls2, "-").concat(color), color && PresetColorRegex$1.test(color))); var formattedOverlayInnerStyle; var arrowContentStyle; if (color && !PresetColorRegex$1.test(color)) { formattedOverlayInnerStyle = { backgroundColor: color }; arrowContentStyle = { backgroundColor: color }; } var vcTooltipProps = _extends$1(_extends$1(_extends$1({}, $attrs), $props), { prefixCls: prefixCls2, getTooltipContainer: getPopupContainer2 || getContextPopupContainer, builtinPlacements: this.getPlacements(), overlay: this.getOverlay(), visible: sVisible, ref: "tooltip", overlayClassName: customOverlayClassName, overlayInnerStyle: formattedOverlayInnerStyle, arrowContent: createVNode("span", { "class": "".concat(prefixCls2, "-arrow-content"), "style": arrowContentStyle }, null), onVisibleChange: this.handleVisibleChange, onPopupAlign: this.onPopupAlign }); return createVNode(Tooltip$1, vcTooltipProps, { default: function _default8() { return [sVisible ? cloneElement(child, { class: childCls }) : child]; } }); } }); var Tooltip = withInstall(ToolTip); var props$5 = abstractTooltipProps(); var Popover = defineComponent({ name: "APopover", props: _extends$1(_extends$1({}, props$5), { prefixCls: PropsTypes.string, transitionName: PropsTypes.string.def("zoom-big"), content: PropsTypes.any, title: PropsTypes.any }), setup: function setup32() { return { configProvider: inject("configProvider", defaultConfigProvider) }; }, methods: { getPopupDomNode: function getPopupDomNode5() { return this.$refs.tooltip.getPopupDomNode(); } }, render: function render25() { var _this = this; var title = this.title, customizePrefixCls = this.prefixCls, $slots = this.$slots; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("popover", customizePrefixCls); var props2 = getOptionProps(this); delete props2.title; delete props2.content; var tooltipProps2 = _extends$1(_extends$1({}, props2), { prefixCls: prefixCls2, ref: "tooltip", title: createVNode("div", null, [(title || $slots.title) && createVNode("div", { "class": "".concat(prefixCls2, "-title") }, [getComponent(this, "title")]), createVNode("div", { "class": "".concat(prefixCls2, "-inner-content") }, [getComponent(this, "content")])]) }); return createVNode(Tooltip, tooltipProps2, { default: function _default8() { return [getSlot$1(_this)]; } }); } }); var Popover$1 = withInstall(Popover); var groupProps = { prefixCls: PropsTypes.string, maxCount: PropsTypes.number, maxStyle: { type: Object, default: function _default3() { return {}; } }, maxPopoverPlacement: PropsTypes.oneOf(tuple("top", "bottom")).def("top"), size: avatarProps$1.size }; var Group$2 = defineComponent({ name: "AAvatarGroup", inheritAttrs: false, props: groupProps, setup: function setup33(props2, _ref) { var slots = _ref.slots, attrs = _ref.attrs; var _useConfigInject = useConfigInject("avatar-group", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction; useProvideSize(props2); return function() { var _cls; var _props$maxPopoverPlac = props2.maxPopoverPlacement, maxPopoverPlacement = _props$maxPopoverPlac === void 0 ? "top" : _props$maxPopoverPlac, maxCount2 = props2.maxCount, maxStyle = props2.maxStyle; var cls = (_cls = {}, _defineProperty$12(_cls, prefixCls2.value, true), _defineProperty$12(_cls, "".concat(prefixCls2.value, "-rtl"), direction.value === "rtl"), _defineProperty$12(_cls, "".concat(attrs.class), !!attrs.class), _cls); var children = getPropsSlot(slots, props2); var childrenWithProps = flattenChildren(children).map(function(child, index2) { return cloneElement(child, { key: "avatar-key-".concat(index2) }); }); var numOfChildren = childrenWithProps.length; if (maxCount2 && maxCount2 < numOfChildren) { var childrenShow = childrenWithProps.slice(0, maxCount2); var childrenHidden = childrenWithProps.slice(maxCount2, numOfChildren); childrenShow.push(createVNode(Popover$1, { "key": "avatar-popover-key", "content": childrenHidden, "trigger": "hover", "placement": maxPopoverPlacement, "overlayClassName": "".concat(prefixCls2.value, "-popover") }, { default: function _default8() { return [createVNode(Avatar$1, { "style": maxStyle }, { default: function _default9() { return ["+".concat(numOfChildren - maxCount2)]; } })]; } })); return createVNode("div", _objectSpread2$2(_objectSpread2$2({}, attrs), {}, { "class": cls, "style": attrs.style }), [childrenShow]); } return createVNode("div", _objectSpread2$2(_objectSpread2$2({}, attrs), {}, { "class": cls, "style": attrs.style }), [childrenWithProps]); }; } }); var Group$3 = Group$2; Avatar$1.Group = Group$3; Avatar$1.install = function(app) { app.component(Avatar$1.name, Avatar$1); app.component(Group$3.name, Group$3); return app; }; function UnitNumber(_ref) { var prefixCls2 = _ref.prefixCls, value24 = _ref.value, current2 = _ref.current, _ref$offset = _ref.offset, offset4 = _ref$offset === void 0 ? 0 : _ref$offset; var style; if (offset4) { style = { position: "absolute", top: "".concat(offset4, "00%"), left: 0 }; } return createVNode("p", { "style": style, "class": classNames("".concat(prefixCls2, "-only-unit"), { current: current2 }) }, [value24]); } function getOffset$2(start, end, unit) { var index2 = start; var offset4 = 0; while ((index2 + 10) % 10 !== end) { index2 += unit; offset4 += unit; } return offset4; } var SingleNumber = defineComponent({ name: "SingleNumber", props: { prefixCls: String, value: String, count: Number }, setup: function setup34(props2) { var originValue = computed(function() { return Number(props2.value); }); var originCount = computed(function() { return Math.abs(props2.count); }); var state = reactive({ prevValue: originValue.value, prevCount: originCount.value }); var onTransitionEnd2 = function onTransitionEnd3() { state.prevValue = originValue.value; state.prevCount = originCount.value; }; var timeout = ref(); watch(originValue, function() { clearTimeout(timeout.value); timeout.value = setTimeout(function() { onTransitionEnd2(); }, 1e3); }, { flush: "post" }); onUnmounted(function() { clearTimeout(timeout.value); }); return function() { var unitNodes; var offsetStyle = {}; var value24 = originValue.value; if (state.prevValue === value24 || Number.isNaN(value24) || Number.isNaN(state.prevValue)) { unitNodes = [UnitNumber(_extends$1(_extends$1({}, props2), { current: true }))]; offsetStyle = { transition: "none" }; } else { unitNodes = []; var end = value24 + 10; var unitNumberList = []; for (var index2 = value24; index2 <= end; index2 += 1) { unitNumberList.push(index2); } var prevIndex = unitNumberList.findIndex(function(n2) { return n2 % 10 === state.prevValue; }); unitNodes = unitNumberList.map(function(n2, index3) { var singleUnit = n2 % 10; return UnitNumber(_extends$1(_extends$1({}, props2), { value: singleUnit, offset: index3 - prevIndex, current: index3 === prevIndex })); }); var unit = state.prevCount < originCount.value ? 1 : -1; offsetStyle = { transform: "translateY(".concat(-getOffset$2(state.prevValue, value24, unit), "00%)") }; } return createVNode("span", { "class": "".concat(props2.prefixCls, "-only"), "style": offsetStyle, "onTransitionend": function onTransitionend() { return onTransitionEnd2(); } }, [unitNodes]); }; } }); var __rest$x = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var scrollNumberProps = { prefixCls: PropsTypes.string, count: PropsTypes.any, component: PropsTypes.string, title: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string, null]), show: Boolean }; var ScrollNumber = defineComponent({ name: "ScrollNumber", inheritAttrs: false, props: scrollNumberProps, setup: function setup35(props2, _ref) { var attrs = _ref.attrs, slots = _ref.slots; var _useConfigInject = useConfigInject("scroll-number", props2), prefixCls2 = _useConfigInject.prefixCls; return function() { var _a3; var _b2 = _extends$1(_extends$1({}, props2), attrs); _b2.prefixCls; var count2 = _b2.count, title = _b2.title; _b2.show; var _b$component = _b2.component, Tag2 = _b$component === void 0 ? "sup" : _b$component, className = _b2.class, style = _b2.style, restProps = __rest$x(_b2, ["prefixCls", "count", "title", "show", "component", "class", "style"]); var newProps = _extends$1(_extends$1({}, restProps), { style, "data-show": props2.show, class: classNames(prefixCls2.value, className), title }); var numberNodes = count2; if (count2 && Number(count2) % 1 === 0) { var numberList = String(count2).split(""); numberNodes = numberList.map(function(num, i2) { return createVNode(SingleNumber, { "prefixCls": prefixCls2.value, "count": Number(count2), "value": num, "key": numberList.length - i2 }, null); }); } if (style && style.borderColor) { newProps.style = _extends$1(_extends$1({}, style), { boxShadow: "0 0 0 1px ".concat(style.borderColor, " inset") }); } var children = filterEmpty((_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)); if (children && children.length) { return cloneElement(children, { class: classNames("".concat(prefixCls2.value, "-custom-component")) }, false); } return createVNode(Tag2, newProps, { default: function _default8() { return [numberNodes]; } }); }; } }); function isPresetColor(color) { return PresetColorTypes.indexOf(color) !== -1; } var __rest$w = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var ribbonProps = { prefix: PropsTypes.string, color: { type: String }, text: PropsTypes.any, placement: PropsTypes.oneOf(tuple("start", "end")).def("end") }; var Ribbon = defineComponent({ name: "ABadgeRibbon", inheritAttrs: false, props: ribbonProps, slots: ["text"], setup: function setup36(props2, _ref) { var attrs = _ref.attrs, slots = _ref.slots; var _useConfigInject = useConfigInject("ribbon", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction; var colorInPreset = computed(function() { return isPresetColor(props2.color); }); var ribbonCls = computed(function() { var _ref2; return [prefixCls2.value, "".concat(prefixCls2.value, "-placement-").concat(props2.placement), (_ref2 = {}, _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-rtl"), direction.value === "rtl"), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-color-").concat(props2.color), colorInPreset.value), _ref2)]; }); return function() { var _a3, _b2; var className = attrs.class, style = attrs.style, restAttrs = __rest$w(attrs, ["class", "style"]); var colorStyle = {}; var cornerColorStyle = {}; if (props2.color && !colorInPreset.value) { colorStyle.background = props2.color; cornerColorStyle.color = props2.color; } return createVNode("div", _objectSpread2$2({ "class": "".concat(prefixCls2.value, "-wrapper") }, restAttrs), [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots), createVNode("div", { "class": [ribbonCls.value, className], "style": _extends$1(_extends$1({}, colorStyle), style) }, [createVNode("span", { "class": "".concat(prefixCls2.value, "-text") }, [props2.text || ((_b2 = slots.text) === null || _b2 === void 0 ? void 0 : _b2.call(slots))]), createVNode("div", { "class": "".concat(prefixCls2.value, "-corner"), "style": cornerColorStyle }, null)])]); }; } }); var isNumeric$1 = function isNumeric2(value24) { return !isNaN(parseFloat(value24)) && isFinite(value24); }; var isNumeric$2 = isNumeric$1; var badgeProps = { count: PropsTypes.any, showZero: PropsTypes.looseBool, overflowCount: PropsTypes.number.def(99), dot: PropsTypes.looseBool, prefixCls: PropsTypes.string, scrollNumberPrefixCls: PropsTypes.string, status: PropsTypes.oneOf(tuple("success", "processing", "default", "error", "warning")), size: PropsTypes.oneOf(tuple("default", "small")).def("default"), color: PropsTypes.string, text: PropsTypes.VNodeChild, offset: PropsTypes.arrayOf(PropsTypes.oneOfType([String, Number])), numberStyle: PropsTypes.style, title: PropsTypes.string }; var Badge = defineComponent({ name: "ABadge", Ribbon, inheritAttrs: false, props: badgeProps, slots: ["text", "count"], setup: function setup37(props2, _ref) { var slots = _ref.slots, attrs = _ref.attrs; var _useConfigInject = useConfigInject("badge", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction; var numberedDisplayCount = computed(function() { return props2.count > props2.overflowCount ? "".concat(props2.overflowCount, "+") : props2.count; }); var hasStatus = computed(function() { return props2.status !== null && props2.status !== void 0 || props2.color !== null && props2.color !== void 0; }); var isZero = computed(function() { return numberedDisplayCount.value === "0" || numberedDisplayCount.value === 0; }); var showAsDot = computed(function() { return props2.dot && !isZero.value || hasStatus.value; }); var mergedCount = computed(function() { return showAsDot.value ? "" : numberedDisplayCount.value; }); var isHidden2 = computed(function() { var isEmpty = mergedCount.value === null || mergedCount.value === void 0 || mergedCount.value === ""; return (isEmpty || isZero.value && !props2.showZero) && !showAsDot.value; }); var livingCount = ref(props2.count); var displayCount = ref(mergedCount.value); var isDotRef = ref(showAsDot.value); watch([function() { return props2.count; }, mergedCount, showAsDot], function() { if (!isHidden2.value) { livingCount.value = props2.count; displayCount.value = mergedCount.value; isDotRef.value = showAsDot.value; } }, { immediate: true }); var statusCls = computed(function() { var _ref2; return _ref2 = {}, _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-status-dot"), hasStatus.value), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-status-").concat(props2.status), !!props2.status), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-status-").concat(props2.color), isPresetColor(props2.color)), _ref2; }); var statusStyle = computed(function() { if (props2.color && !isPresetColor(props2.color)) { return { background: props2.color }; } else { return {}; } }); var scrollNumberCls = computed(function() { var _ref3; return _ref3 = {}, _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-dot"), isDotRef.value), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-count"), !isDotRef.value), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-count-sm"), props2.size === "small"), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-multiple-words"), !isDotRef.value && displayCount.value && displayCount.value.toString().length > 1), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-status-").concat(props2.status), !!props2.status), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-status-").concat(props2.color), isPresetColor(props2.color)), _ref3; }); return function() { var _classNames; var _a3, _b2; var offset4 = props2.offset, title = props2.title, color = props2.color; var style = attrs.style; var text = getPropsSlot(slots, props2, "text"); var pre = prefixCls2.value; var count2 = livingCount.value; var children = flattenChildren((_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)); children = children.length ? children : null; var visible9 = !!(!isHidden2.value || slots.count); var mergedStyle = function() { if (!offset4) { return _extends$1({}, style); } var offsetStyle = { marginTop: isNumeric$2(offset4[1]) ? "".concat(offset4[1], "px") : offset4[1] }; if (direction.value === "rtl") { offsetStyle.left = "".concat(parseInt(offset4[0], 10), "px"); } else { offsetStyle.right = "".concat(-parseInt(offset4[0], 10), "px"); } return _extends$1(_extends$1({}, offsetStyle), style); }(); var titleNode = title !== null && title !== void 0 ? title : typeof count2 === "string" || typeof count2 === "number" ? count2 : void 0; var statusTextNode = visible9 || !text ? null : createVNode("span", { "class": "".concat(pre, "-status-text") }, [text]); var displayNode = _typeof$2(count2) === "object" || count2 === void 0 && slots.count ? cloneElement(count2 !== null && count2 !== void 0 ? count2 : (_b2 = slots.count) === null || _b2 === void 0 ? void 0 : _b2.call(slots), { style: mergedStyle }, false) : null; var badgeClassName = classNames(pre, (_classNames = {}, _defineProperty$12(_classNames, "".concat(pre, "-status"), hasStatus.value), _defineProperty$12(_classNames, "".concat(pre, "-not-a-wrapper"), !children), _defineProperty$12(_classNames, "".concat(pre, "-rtl"), direction.value === "rtl"), _classNames), attrs.class); if (!children && hasStatus.value) { var statusTextColor = mergedStyle.color; return createVNode("span", _objectSpread2$2(_objectSpread2$2({}, attrs), {}, { "class": badgeClassName, "style": mergedStyle }), [createVNode("span", { "class": statusCls.value, "style": statusStyle.value }, null), createVNode("span", { "style": { color: statusTextColor }, "class": "".concat(pre, "-status-text") }, [text])]); } var transitionProps = getTransitionProps(children ? "".concat(pre, "-zoom") : "", { appear: false }); var scrollNumberStyle = _extends$1(_extends$1({}, mergedStyle), props2.numberStyle); if (color && !isPresetColor(color)) { scrollNumberStyle = scrollNumberStyle || {}; scrollNumberStyle.background = color; } return createVNode("span", _objectSpread2$2(_objectSpread2$2({}, attrs), {}, { "class": badgeClassName }), [children, createVNode(Transition, transitionProps, { default: function _default8() { return [withDirectives(createVNode(ScrollNumber, { "prefixCls": props2.scrollNumberPrefixCls, "show": visible9, "class": scrollNumberCls.value, "count": displayCount.value, "title": titleNode, "style": scrollNumberStyle, "key": "scrollNumber" }, { default: function _default9() { return [displayNode]; } }), [[vShow, visible9]])]; } }), statusTextNode]); }; } }); Badge.install = function(app) { app.component(Badge.name, Badge); app.component(Ribbon.name, Ribbon); return app; }; var autoAdjustOverflow$3 = { adjustX: 1, adjustY: 1 }; var targetOffset$2 = [0, 0]; var placements$5 = { topLeft: { points: ["bl", "tl"], overflow: autoAdjustOverflow$3, offset: [0, -4], targetOffset: targetOffset$2 }, topCenter: { points: ["bc", "tc"], overflow: autoAdjustOverflow$3, offset: [0, -4], targetOffset: targetOffset$2 }, topRight: { points: ["br", "tr"], overflow: autoAdjustOverflow$3, offset: [0, -4], targetOffset: targetOffset$2 }, bottomLeft: { points: ["tl", "bl"], overflow: autoAdjustOverflow$3, offset: [0, 4], targetOffset: targetOffset$2 }, bottomCenter: { points: ["tc", "bc"], overflow: autoAdjustOverflow$3, offset: [0, 4], targetOffset: targetOffset$2 }, bottomRight: { points: ["tr", "br"], overflow: autoAdjustOverflow$3, offset: [0, 4], targetOffset: targetOffset$2 } }; var placements$6 = placements$5; var __rest$v = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var Dropdown$2 = defineComponent({ mixins: [BaseMixin], props: { minOverlayWidthMatchTrigger: PropsTypes.looseBool, prefixCls: PropsTypes.string.def("rc-dropdown"), transitionName: PropsTypes.string, overlayClassName: PropsTypes.string.def(""), openClassName: PropsTypes.string, animation: PropsTypes.any, align: PropsTypes.object, overlayStyle: PropsTypes.object.def(function() { return {}; }), placement: PropsTypes.string.def("bottomLeft"), overlay: PropsTypes.any, trigger: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.arrayOf(PropsTypes.string)]).def("hover"), alignPoint: PropsTypes.looseBool, showAction: PropsTypes.array, hideAction: PropsTypes.array, getPopupContainer: PropsTypes.func, visible: PropsTypes.looseBool, defaultVisible: PropsTypes.looseBool.def(false), mouseEnterDelay: PropsTypes.number.def(0.15), mouseLeaveDelay: PropsTypes.number.def(0.1) }, data: function data10() { var sVisible = this.defaultVisible; if (hasProp(this, "visible")) { sVisible = this.visible; } return { sVisible }; }, watch: { visible: function visible2(val) { if (val !== void 0) { this.setState({ sVisible: val }); } } }, methods: { onClick: function onClick3(e2) { var overlayProps = this.getOverlayElement().props; if (!hasProp(this, "visible")) { this.setState({ sVisible: false }); } this.__emit("overlayClick", e2); if (overlayProps.onClick) { overlayProps.onClick(e2); } }, onVisibleChange: function onVisibleChange2(visible9) { if (!hasProp(this, "visible")) { this.setState({ sVisible: visible9 }); } this.__emit("update:visible", visible9); this.__emit("visibleChange", visible9); }, getMinOverlayWidthMatchTrigger: function getMinOverlayWidthMatchTrigger() { var props2 = getOptionProps(this); var minOverlayWidthMatchTrigger = props2.minOverlayWidthMatchTrigger, alignPoint2 = props2.alignPoint; if ("minOverlayWidthMatchTrigger" in props2) { return minOverlayWidthMatchTrigger; } return !alignPoint2; }, getOverlayElement: function getOverlayElement() { var overlay = getComponent(this, "overlay"); return Array.isArray(overlay) ? overlay[0] : overlay; }, getMenuElement: function getMenuElement() { var _this = this; var onClick7 = this.onClick, prefixCls2 = this.prefixCls; var overlayElement = this.getOverlayElement(); var extraOverlayProps = { prefixCls: "".concat(prefixCls2, "-menu"), getPopupContainer: function getPopupContainer2() { return _this.getPopupDomNode(); }, onClick: onClick7 }; if (overlayElement && overlayElement.type === Text) { delete extraOverlayProps.prefixCls; } return cloneElement(overlayElement, extraOverlayProps); }, getMenuElementOrLambda: function getMenuElementOrLambda() { var overlay = this.overlay || this.$slots.overlay; if (typeof overlay === "function") { return this.getMenuElement; } return this.getMenuElement(); }, getPopupDomNode: function getPopupDomNode6() { return this.triggerRef.getPopupDomNode(); }, getOpenClassName: function getOpenClassName() { var _this$$props = this.$props, openClassName = _this$$props.openClassName, prefixCls2 = _this$$props.prefixCls; if (openClassName !== void 0) { return openClassName; } return "".concat(prefixCls2, "-open"); }, afterVisibleChange: function afterVisibleChange(visible9) { if (visible9 && this.getMinOverlayWidthMatchTrigger()) { var overlayNode = this.getPopupDomNode(); var rootNode = findDOMNode(this); if (rootNode && overlayNode && rootNode.offsetWidth > overlayNode.offsetWidth) { overlayNode.style.minWidth = "".concat(rootNode.offsetWidth, "px"); if (this.triggerRef && this.triggerRef._component && this.triggerRef._component.alignInstance) { this.triggerRef._component.alignInstance.forceAlign(); } } } }, renderChildren: function renderChildren2() { var children = getSlot$1(this); var sVisible = this.sVisible; return sVisible && children ? cloneElement(children[0], { class: this.getOpenClassName() }, false) : children; }, saveTrigger: function saveTrigger(node) { this.triggerRef = node; } }, render: function render26() { var _this2 = this; var _a3 = this.$props, prefixCls2 = _a3.prefixCls, transitionName2 = _a3.transitionName, animation2 = _a3.animation, align = _a3.align, placement2 = _a3.placement, getPopupContainer2 = _a3.getPopupContainer, showAction = _a3.showAction, hideAction = _a3.hideAction, overlayClassName = _a3.overlayClassName, overlayStyle = _a3.overlayStyle, trigger2 = _a3.trigger, otherProps = __rest$v(_a3, ["prefixCls", "transitionName", "animation", "align", "placement", "getPopupContainer", "showAction", "hideAction", "overlayClassName", "overlayStyle", "trigger"]); var triggerHideAction = hideAction; if (!triggerHideAction && trigger2.indexOf("contextmenu") !== -1) { triggerHideAction = ["click"]; } var triggerProps = _extends$1(_extends$1({}, otherProps), { prefixCls: prefixCls2, popupClassName: overlayClassName, popupStyle: overlayStyle, builtinPlacements: placements$6, action: trigger2, showAction, hideAction: triggerHideAction || [], popupPlacement: placement2, popupAlign: align, popupTransitionName: transitionName2, popupAnimation: animation2, popupVisible: this.sVisible, afterPopupVisibleChange: this.afterVisibleChange, getPopupContainer: getPopupContainer2, onPopupVisibleChange: this.onVisibleChange, popup: this.getMenuElementOrLambda(), ref: this.saveTrigger }); return createVNode(Trigger, triggerProps, { default: function _default8() { return [_this2.renderChildren()]; } }); } }); var getDropdownProps = function() { return { trigger: { type: [Array, String], default: "hover" }, overlay: PropsTypes.any, visible: PropsTypes.looseBool, disabled: PropsTypes.looseBool, align: PropsTypes.object, getPopupContainer: PropsTypes.func, prefixCls: PropsTypes.string, transitionName: PropsTypes.string, placement: PropsTypes.oneOf(tuple("topLeft", "topCenter", "topRight", "bottomLeft", "bottomCenter", "bottomRight")), overlayClassName: PropsTypes.string, overlayStyle: PropsTypes.style, forceRender: PropsTypes.looseBool, mouseEnterDelay: PropsTypes.number, mouseLeaveDelay: PropsTypes.number, openClassName: PropsTypes.string, minOverlayWidthMatchTrigger: PropsTypes.looseBool }; }; var EllipsisOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "ellipsis", "theme": "outlined" }; var EllipsisOutlinedSvg = EllipsisOutlined$2; function _objectSpread$J(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$K(target, key2, source2[key2]); }); } return target; } function _defineProperty$K(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var EllipsisOutlined = function EllipsisOutlined2(props2, context2) { var p = _objectSpread$J({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$J({}, p, { "icon": EllipsisOutlinedSvg }), null); }; EllipsisOutlined.displayName = "EllipsisOutlined"; EllipsisOutlined.inheritAttrs = false; var EllipsisOutlined$1 = EllipsisOutlined; var __rest$u = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var ButtonTypesProps = buttonTypes(); var DropdownProps = getDropdownProps(); var ButtonGroup = Button$1.Group; var dropdownButtonProps = _extends$1(_extends$1({}, DropdownProps), { type: PropsTypes.oneOf(tuple("primary", "ghost", "dashed", "danger", "default")).def("default"), size: PropsTypes.oneOf(tuple("small", "large", "default")).def("default"), htmlType: ButtonTypesProps.htmlType, href: PropsTypes.string, disabled: PropsTypes.looseBool, prefixCls: PropsTypes.string, placement: DropdownProps.placement.def("bottomRight"), icon: PropsTypes.any, title: PropsTypes.string, onClick: PropsTypes.func, onVisibleChange: PropsTypes.func, "onUpdate:visible": PropsTypes.func }); var DropdownButton = defineComponent({ name: "ADropdownButton", inheritAttrs: false, props: dropdownButtonProps, emits: ["click", "visibleChange", "update:visible"], setup: function setup38() { return { configProvider: inject("configProvider", defaultConfigProvider), popupRef: null }; }, created: function created5() { provide("savePopupRef", this.savePopupRef); }, methods: { savePopupRef: function savePopupRef2(ref2) { this.popupRef = ref2; }, handleClick: function handleClick(e2) { this.$emit("click", e2); }, handleVisibleChange: function handleVisibleChange2(val) { this.$emit("update:visible", val); this.$emit("visibleChange", val); } }, render: function render27() { var _this = this; var _a3 = _extends$1(_extends$1({}, this.$props), this.$attrs), type2 = _a3.type, disabled = _a3.disabled; _a3.onClick; var htmlType = _a3.htmlType, className = _a3.class, customizePrefixCls = _a3.prefixCls; _a3.overlay; var trigger2 = _a3.trigger, align = _a3.align, visible9 = _a3.visible; _a3.onVisibleChange; var placement2 = _a3.placement, getPopupContainer2 = _a3.getPopupContainer, href = _a3.href, title = _a3.title, restProps = __rest$u(_a3, ["type", "disabled", "onClick", "htmlType", "class", "prefixCls", "overlay", "trigger", "align", "visible", "onVisibleChange", "placement", "getPopupContainer", "href", "title"]); var icon = getComponent(this, "icon") || createVNode(EllipsisOutlined$1, null, null); var getContextPopupContainer = this.configProvider.getPopupContainer; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("dropdown-button", customizePrefixCls); var dropdownProps2 = { align, disabled, trigger: disabled ? [] : trigger2, placement: placement2, getPopupContainer: getPopupContainer2 || getContextPopupContainer, onVisibleChange: this.handleVisibleChange }; if (hasProp(this, "visible")) { dropdownProps2.visible = visible9; } var buttonGroupProps2 = _extends$1(_extends$1({}, restProps), { class: classNames(prefixCls2, className) }); return createVNode(ButtonGroup, buttonGroupProps2, { default: function _default8() { return [createVNode(Button$1, { "type": type2, "disabled": disabled, "onClick": _this.handleClick, "htmlType": htmlType, "href": href, "title": title }, { default: function _default9() { return [getSlot$1(_this)]; } }), createVNode(Dropdown$1, _objectSpread2$2(_objectSpread2$2({}, dropdownProps2), {}, { "overlay": getComponent(_this, "overlay") }), { default: function _default9() { return [createVNode(Button$1, { "type": type2 }, { default: function _default10() { return [icon]; } })]; } })]; } }); } }); var RightOutlined$4 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" } }] }, "name": "right", "theme": "outlined" }; var RightOutlinedSvg = RightOutlined$4; function _objectSpread$I(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$J(target, key2, source2[key2]); }); } return target; } function _defineProperty$J(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var RightOutlined$2 = function RightOutlined2(props2, context2) { var p = _objectSpread$I({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$I({}, p, { "icon": RightOutlinedSvg }), null); }; RightOutlined$2.displayName = "RightOutlined"; RightOutlined$2.inheritAttrs = false; var RightOutlined$3 = RightOutlined$2; var dropdownProps = getDropdownProps(); var Dropdown = defineComponent({ name: "ADropdown", inheritAttrs: false, props: _extends$1(_extends$1({}, dropdownProps), { prefixCls: PropsTypes.string, mouseEnterDelay: PropsTypes.number.def(0.15), mouseLeaveDelay: PropsTypes.number.def(0.1), placement: dropdownProps.placement.def("bottomLeft"), onVisibleChange: PropsTypes.func, "onUpdate:visible": PropsTypes.func }), emits: ["visibleChange", "update:visible"], setup: function setup39() { return { configProvider: inject("configProvider", defaultConfigProvider), popupRef: null }; }, created: function created6() { provide("savePopupRef", this.savePopupRef); }, methods: { savePopupRef: function savePopupRef3(ref2) { this.popupRef = ref2; }, getTransitionName: function getTransitionName3() { var _this$$props = this.$props, _this$$props$placemen = _this$$props.placement, placement2 = _this$$props$placemen === void 0 ? "" : _this$$props$placemen, transitionName2 = _this$$props.transitionName; if (transitionName2 !== void 0) { return transitionName2; } if (placement2.indexOf("top") >= 0) { return "slide-down"; } return "slide-up"; }, renderOverlay: function renderOverlay(prefixCls2) { var overlay = getComponent(this, "overlay"); var overlayNode = Array.isArray(overlay) ? overlay[0] : overlay; var overlayProps = overlayNode && getPropsData(overlayNode); var _ref = overlayProps || {}, _ref$selectable = _ref.selectable, selectable = _ref$selectable === void 0 ? false : _ref$selectable, _ref$focusable = _ref.focusable, focusable = _ref$focusable === void 0 ? true : _ref$focusable; var expandIcon = function expandIcon2() { return createVNode("span", { "class": "".concat(prefixCls2, "-menu-submenu-arrow") }, [createVNode(RightOutlined$3, { "class": "".concat(prefixCls2, "-menu-submenu-arrow-icon") }, null)]); }; var fixedModeOverlay = isValidElement(overlayNode) ? cloneVNode(overlayNode, { mode: "vertical", selectable, focusable, expandIcon }) : overlay; return fixedModeOverlay; }, handleVisibleChange: function handleVisibleChange3(val) { this.$emit("update:visible", val); this.$emit("visibleChange", val); } }, render: function render28() { var _a3; var props2 = getOptionProps(this); var customizePrefixCls = props2.prefixCls, trigger2 = props2.trigger, disabled = props2.disabled, getPopupContainer2 = props2.getPopupContainer; var getContextPopupContainer = this.configProvider.getPopupContainer; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("dropdown", customizePrefixCls); var child = getSlot$1(this)[0]; var dropdownTrigger = cloneElement(child, { class: classNames((_a3 = child === null || child === void 0 ? void 0 : child.props) === null || _a3 === void 0 ? void 0 : _a3.class, "".concat(prefixCls2, "-trigger")), disabled }); var triggerActions = disabled ? [] : typeof trigger2 === "string" ? [trigger2] : trigger2; var alignPoint2; if (triggerActions && triggerActions.indexOf("contextmenu") !== -1) { alignPoint2 = true; } var dropdownProps2 = _extends$1(_extends$1(_extends$1({ alignPoint: alignPoint2 }, props2), this.$attrs), { prefixCls: prefixCls2, getPopupContainer: getPopupContainer2 || getContextPopupContainer, transitionName: this.getTransitionName(), trigger: triggerActions, overlay: this.renderOverlay(prefixCls2), onVisibleChange: this.handleVisibleChange }); return createVNode(Dropdown$2, dropdownProps2, { default: function _default8() { return [dropdownTrigger]; } }); } }); Dropdown.Button = DropdownButton; var Dropdown$1 = Dropdown; var breadcrumbItemProps = { prefixCls: PropsTypes.string, href: PropsTypes.string, separator: PropsTypes.any, overlay: PropsTypes.any }; var BreadcrumbItem = defineComponent({ name: "ABreadcrumbItem", __ANT_BREADCRUMB_ITEM: true, props: breadcrumbItemProps, slots: ["separator", "overlay"], setup: function setup40(props2, _ref) { var slots = _ref.slots; var _useConfigInject = useConfigInject("breadcrumb", props2), prefixCls2 = _useConfigInject.prefixCls; var renderBreadcrumbNode = function renderBreadcrumbNode2(breadcrumbItem, prefixCls3) { var overlay = getPropsSlot(slots, props2, "overlay"); if (overlay) { return createVNode(Dropdown$1, { "overlay": overlay, "placement": "bottomCenter" }, { default: function _default8() { return [createVNode("span", { "class": "".concat(prefixCls3, "-overlay-link") }, [breadcrumbItem, createVNode(DownOutlined$1, null, null)])]; } }); } return breadcrumbItem; }; return function() { var _a3; var separator2 = (_a3 = getPropsSlot(slots, props2, "separator")) !== null && _a3 !== void 0 ? _a3 : "/"; var children = getPropsSlot(slots, props2); var link; if (props2.href !== void 0) { link = createVNode("a", { "class": "".concat(prefixCls2.value, "-link") }, [children]); } else { link = createVNode("span", { "class": "".concat(prefixCls2.value, "-link") }, [children]); } link = renderBreadcrumbNode(link, prefixCls2.value); if (children) { return createVNode("span", null, [link, separator2 && createVNode("span", { "class": "".concat(prefixCls2.value, "-separator") }, [separator2])]); } return null; }; } }); function shallowEqual(objA, objB, compare2, compareContext) { var ret = compare2 ? compare2.call(compareContext, objA, objB) : void 0; if (ret !== void 0) { return !!ret; } if (objA === objB) { return true; } if (_typeof$2(objA) !== "object" || !objA || _typeof$2(objB) !== "object" || !objB) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); for (var idx = 0; idx < keysA.length; idx++) { var key2 = keysA[idx]; if (!bHasOwnProperty(key2)) { return false; } var valueA = objA[key2]; var valueB = objB[key2]; ret = compare2 ? compare2.call(compareContext, valueA, valueB, key2) : void 0; if (ret === false || ret === void 0 && valueA !== valueB) { return false; } } return true; } function shallowEqual$1(value24, other, customizer, thisArg) { return shallowEqual(toRaw(value24), toRaw(other), customizer, thisArg); } var MenuContextKey = Symbol("menuContextKey"); var useProvideMenu = function useProvideMenu2(props2) { provide(MenuContextKey, props2); }; var useInjectMenu = function useInjectMenu2() { return inject(MenuContextKey); }; var MenuFirstLevelContextKey = Symbol("menuFirstLevelContextKey"); var useProvideFirstLevel = function useProvideFirstLevel2(firstLevel) { provide(MenuFirstLevelContextKey, firstLevel); }; var useInjectFirstLevel = function useInjectFirstLevel2() { return inject(MenuFirstLevelContextKey, true); }; var MenuContextProvider = defineComponent({ name: "MenuContextProvider", inheritAttrs: false, props: { mode: { type: String, default: void 0 }, overflowDisabled: { type: Boolean, default: void 0 }, isRootMenu: { type: Boolean, default: void 0 } }, setup: function setup41(props2, _ref) { var slots = _ref.slots; var menuContext = useInjectMenu(); var newContext = _extends$1({}, menuContext); if (props2.mode !== void 0) { newContext.mode = toRef(props2, "mode"); } if (props2.isRootMenu !== void 0) { newContext.isRootMenu = toRef(props2, "isRootMenu"); } if (props2.overflowDisabled !== void 0) { newContext.overflowDisabled = toRef(props2, "overflowDisabled"); } useProvideMenu(newContext); return function() { var _a3; return (_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots); }; } }); var useProvideMenu$1 = useProvideMenu; var SiderCollapsedKey = Symbol("siderCollapsed"); var KeyPathContext = Symbol("KeyPathContext"); var useInjectKeyPath = function useInjectKeyPath2() { return inject(KeyPathContext, { parentEventKeys: computed(function() { return []; }), parentKeys: computed(function() { return []; }), parentInfo: {} }); }; var useProvideKeyPath = function useProvideKeyPath2(eventKey, key2, menuInfo) { var _useInjectKeyPath = useInjectKeyPath(), parentEventKeys = _useInjectKeyPath.parentEventKeys, parentKeys = _useInjectKeyPath.parentKeys; var eventKeys = computed(function() { return [].concat(_toConsumableArray(parentEventKeys.value), [eventKey]); }); var keys2 = computed(function() { return [].concat(_toConsumableArray(parentKeys.value), [key2]); }); provide(KeyPathContext, { parentEventKeys: eventKeys, parentKeys: keys2, parentInfo: menuInfo }); return keys2; }; var useProvideKeyPath$1 = useProvideKeyPath; function useDirectionStyle(level2) { var _useInjectMenu = useInjectMenu(), mode3 = _useInjectMenu.mode, rtl = _useInjectMenu.rtl, inlineIndent = _useInjectMenu.inlineIndent; return computed(function() { return mode3.value !== "inline" ? null : rtl.value ? { paddingRight: "".concat(level2.value * inlineIndent.value, "px") } : { paddingLeft: "".concat(level2.value * inlineIndent.value, "px") }; }); } var indexGuid$2 = 0; var menuItemProps = { role: String, disabled: Boolean, danger: Boolean, title: { type: [String, Boolean], default: void 0 }, icon: PropsTypes.VNodeChild }; var MenuItem = defineComponent({ name: "AMenuItem", inheritAttrs: false, props: menuItemProps, emits: ["mouseenter", "mouseleave", "click", "keydown", "focus"], slots: ["icon", "title"], setup: function setup42(props2, _ref) { var slots = _ref.slots, emit2 = _ref.emit, attrs = _ref.attrs; var instance = getCurrentInstance(); var key2 = _typeof$2(instance.vnode.key) === "symbol" ? String(instance.vnode.key) : instance.vnode.key; devWarning(_typeof$2(instance.vnode.key) !== "symbol", "MenuItem", 'MenuItem `:key="'.concat(String(key2), '"` not support Symbol type')); var eventKey = "menu_item_".concat(++indexGuid$2, "_$$_").concat(key2); var _useInjectKeyPath = useInjectKeyPath(), parentEventKeys = _useInjectKeyPath.parentEventKeys, parentKeys = _useInjectKeyPath.parentKeys; var _useInjectMenu = useInjectMenu(), prefixCls2 = _useInjectMenu.prefixCls, activeKeys = _useInjectMenu.activeKeys, disabled = _useInjectMenu.disabled, changeActiveKeys = _useInjectMenu.changeActiveKeys, rtl = _useInjectMenu.rtl, inlineCollapsed = _useInjectMenu.inlineCollapsed, siderCollapsed = _useInjectMenu.siderCollapsed, onItemClick = _useInjectMenu.onItemClick, selectedKeys2 = _useInjectMenu.selectedKeys, registerMenuInfo = _useInjectMenu.registerMenuInfo, unRegisterMenuInfo = _useInjectMenu.unRegisterMenuInfo; var firstLevel = useInjectFirstLevel(); var isActive = ref(false); var keysPath = computed(function() { return [].concat(_toConsumableArray(parentKeys.value), [key2]); }); var menuInfo = { eventKey, key: key2, parentEventKeys, parentKeys, isLeaf: true }; registerMenuInfo(eventKey, menuInfo); onBeforeUnmount(function() { unRegisterMenuInfo(eventKey); }); watch(activeKeys, function() { isActive.value = !!activeKeys.value.find(function(val) { return val === key2; }); }, { immediate: true }); var mergedDisabled = computed(function() { return disabled.value || props2.disabled; }); var selected = computed(function() { return selectedKeys2.value.includes(key2); }); var classNames2 = computed(function() { var _ref2; var itemCls = "".concat(prefixCls2.value, "-item"); return _ref2 = {}, _defineProperty$12(_ref2, "".concat(itemCls), true), _defineProperty$12(_ref2, "".concat(itemCls, "-danger"), props2.danger), _defineProperty$12(_ref2, "".concat(itemCls, "-active"), isActive.value), _defineProperty$12(_ref2, "".concat(itemCls, "-selected"), selected.value), _defineProperty$12(_ref2, "".concat(itemCls, "-disabled"), mergedDisabled.value), _ref2; }); var getEventInfo = function getEventInfo2(e2) { return { key: key2, eventKey, keyPath: keysPath.value, eventKeyPath: [].concat(_toConsumableArray(parentEventKeys.value), [eventKey]), domEvent: e2, item: _extends$1(_extends$1({}, props2), attrs) }; }; var onInternalClick = function onInternalClick2(e2) { if (mergedDisabled.value) { return; } var info3 = getEventInfo(e2); emit2("click", e2); onItemClick(info3); }; var onMouseEnter4 = function onMouseEnter5(event) { if (!mergedDisabled.value) { changeActiveKeys(keysPath.value); emit2("mouseenter", event); } }; var onMouseLeave5 = function onMouseLeave6(event) { if (!mergedDisabled.value) { changeActiveKeys([]); emit2("mouseleave", event); } }; var onInternalKeyDown = function onInternalKeyDown2(e2) { emit2("keydown", e2); if (e2.which === KeyCode$1.ENTER) { var info3 = getEventInfo(e2); emit2("click", e2); onItemClick(info3); } }; var onInternalFocus = function onInternalFocus2(e2) { changeActiveKeys(keysPath.value); emit2("focus", e2); }; var renderItemChildren = function renderItemChildren2(icon, children) { var wrapNode = createVNode("span", { "class": "".concat(prefixCls2.value, "-title-content") }, [children]); if (!icon || isValidElement(children) && children.type === "span") { if (children && inlineCollapsed.value && firstLevel && typeof children === "string") { return createVNode("div", { "class": "".concat(prefixCls2.value, "-inline-collapsed-noicon") }, [children.charAt(0)]); } } return wrapNode; }; var directionStyle = useDirectionStyle(computed(function() { return keysPath.value.length; })); return function() { var _ref3; var _a3, _b2, _c; var title = (_a3 = props2.title) !== null && _a3 !== void 0 ? _a3 : (_b2 = slots.title) === null || _b2 === void 0 ? void 0 : _b2.call(slots); var children = flattenChildren((_c = slots.default) === null || _c === void 0 ? void 0 : _c.call(slots)); var childrenLength = children.length; var tooltipTitle = title; if (typeof title === "undefined") { tooltipTitle = firstLevel && childrenLength ? children : ""; } else if (title === false) { tooltipTitle = ""; } var tooltipProps2 = { title: tooltipTitle }; if (!siderCollapsed.value && !inlineCollapsed.value) { tooltipProps2.title = null; tooltipProps2.visible = false; } var optionRoleProps = {}; if (props2.role === "option") { optionRoleProps["aria-selected"] = selected.value; } var icon = getPropsSlot(slots, props2, "icon"); return createVNode(Tooltip, _objectSpread2$2(_objectSpread2$2({}, tooltipProps2), {}, { "placement": rtl.value ? "left" : "right", "overlayClassName": "".concat(prefixCls2.value, "-inline-collapsed-tooltip") }), { default: function _default8() { return [createVNode(Overflow$1.Item, _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({ "component": "li" }, attrs), {}, { "style": _extends$1(_extends$1({}, attrs.style || {}), directionStyle.value), "class": [classNames2.value, (_ref3 = {}, _defineProperty$12(_ref3, "".concat(attrs.class), !!attrs.class), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-item-only-child"), (icon ? childrenLength + 1 : childrenLength) === 1), _ref3)], "role": props2.role || "menuitem", "tabindex": props2.disabled ? null : -1, "data-menu-id": key2, "aria-disabled": props2.disabled }, optionRoleProps), {}, { "onMouseenter": onMouseEnter4, "onMouseleave": onMouseLeave5, "onClick": onInternalClick, "onKeydown": onInternalKeyDown, "onFocus": onInternalFocus, "title": typeof title === "string" ? title : void 0 }), { default: function _default9() { return [cloneElement(icon, { class: "".concat(prefixCls2.value, "-item-icon") }), renderItemChildren(icon, children)]; } })]; } }); }; } }); var autoAdjustOverflow$2 = { adjustX: 1, adjustY: 1 }; var placements$4 = { topLeft: { points: ["bl", "tl"], overflow: autoAdjustOverflow$2, offset: [0, -7] }, bottomLeft: { points: ["tl", "bl"], overflow: autoAdjustOverflow$2, offset: [0, 7] }, leftTop: { points: ["tr", "tl"], overflow: autoAdjustOverflow$2, offset: [-4, 0] }, rightTop: { points: ["tl", "tr"], overflow: autoAdjustOverflow$2, offset: [4, 0] } }; var placementsRtl = { topLeft: { points: ["bl", "tl"], overflow: autoAdjustOverflow$2, offset: [0, -7] }, bottomLeft: { points: ["tl", "bl"], overflow: autoAdjustOverflow$2, offset: [0, 7] }, rightTop: { points: ["tr", "tl"], overflow: autoAdjustOverflow$2, offset: [-4, 0] }, leftTop: { points: ["tl", "tr"], overflow: autoAdjustOverflow$2, offset: [4, 0] } }; var popupPlacementMap = { horizontal: "bottomLeft", vertical: "rightTop", "vertical-left": "rightTop", "vertical-right": "leftTop" }; var PopupTrigger = defineComponent({ name: "PopupTrigger", inheritAttrs: false, props: { prefixCls: String, mode: String, visible: Boolean, popupClassName: String, popupOffset: Array, disabled: Boolean, onVisibleChange: Function }, slots: ["popup"], emits: ["visibleChange"], setup: function setup43(props2, _ref) { var slots = _ref.slots, emit2 = _ref.emit; var innerVisible = ref(false); var _useInjectMenu = useInjectMenu(), getPopupContainer2 = _useInjectMenu.getPopupContainer, rtl = _useInjectMenu.rtl, subMenuOpenDelay = _useInjectMenu.subMenuOpenDelay, subMenuCloseDelay = _useInjectMenu.subMenuCloseDelay, builtinPlacements = _useInjectMenu.builtinPlacements, triggerSubMenuAction = _useInjectMenu.triggerSubMenuAction, isRootMenu = _useInjectMenu.isRootMenu; var placement2 = computed(function() { return rtl.value ? _extends$1(_extends$1({}, placementsRtl), builtinPlacements.value) : _extends$1(_extends$1({}, placements$4), builtinPlacements.value); }); var popupPlacement = computed(function() { return popupPlacementMap[props2.mode]; }); var visibleRef = ref(); watch(function() { return props2.visible; }, function(visible9) { wrapperRaf.cancel(visibleRef.value); visibleRef.value = wrapperRaf(function() { innerVisible.value = visible9; }); }, { immediate: true }); onBeforeUnmount(function() { wrapperRaf.cancel(visibleRef.value); }); var onVisibleChange6 = function onVisibleChange7(visible9) { emit2("visibleChange", visible9); }; return function() { var prefixCls2 = props2.prefixCls, popupClassName = props2.popupClassName, mode3 = props2.mode, popupOffset = props2.popupOffset, disabled = props2.disabled; return createVNode(Trigger, { "prefixCls": prefixCls2, "popupClassName": classNames("".concat(prefixCls2, "-popup"), _defineProperty$12({}, "".concat(prefixCls2, "-rtl"), rtl.value), popupClassName), "stretch": mode3 === "horizontal" ? "minWidth" : null, "getPopupContainer": isRootMenu.value ? getPopupContainer2.value : function(triggerNode) { return triggerNode.parentNode; }, "builtinPlacements": placement2.value, "popupPlacement": popupPlacement.value, "popupVisible": innerVisible.value, "popupAlign": popupOffset && { offset: popupOffset }, "action": disabled ? [] : [triggerSubMenuAction.value], "mouseEnterDelay": subMenuOpenDelay.value, "mouseLeaveDelay": subMenuCloseDelay.value, "onPopupVisibleChange": onVisibleChange6, "forceRender": true }, { popup: function popup() { var _a3; return (_a3 = slots.popup) === null || _a3 === void 0 ? void 0 : _a3.call(slots, { visible: innerVisible.value }); }, default: slots.default }); }; } }); var InternalSubMenuList = function InternalSubMenuList2(_props2, _ref) { var slots = _ref.slots, attrs = _ref.attrs; var _a3; var _useInjectMenu = useInjectMenu(), prefixCls2 = _useInjectMenu.prefixCls, mode3 = _useInjectMenu.mode; return createVNode("ul", _objectSpread2$2(_objectSpread2$2({}, attrs), {}, { "class": classNames(prefixCls2.value, "".concat(prefixCls2.value, "-sub"), "".concat(prefixCls2.value, "-").concat(mode3.value === "inline" ? "inline" : "vertical")), "data-menu-list": true }), [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)]); }; InternalSubMenuList.displayName = "SubMenuList"; var SubMenuList = InternalSubMenuList; var InlineSubMenuList = defineComponent({ name: "InlineSubMenuList", inheritAttrs: false, props: { id: String, open: Boolean, keyPath: Array }, setup: function setup44(props2, _ref) { var slots = _ref.slots; var fixedMode = computed(function() { return "inline"; }); var _useInjectMenu = useInjectMenu(), motion = _useInjectMenu.motion, mode3 = _useInjectMenu.mode, defaultMotions = _useInjectMenu.defaultMotions; var sameModeRef = computed(function() { return mode3.value === fixedMode.value; }); var destroy3 = ref(!sameModeRef.value); var mergedOpen = computed(function() { return sameModeRef.value ? props2.open : false; }); watch(mode3, function() { if (sameModeRef.value) { destroy3.value = false; } }, { flush: "post" }); var style = ref({}); var className = ref(""); var mergedMotion = computed(function() { var _a3, _b2; var m2 = motion.value || ((_a3 = defaultMotions.value) === null || _a3 === void 0 ? void 0 : _a3[fixedMode.value]) || ((_b2 = defaultMotions.value) === null || _b2 === void 0 ? void 0 : _b2.other); var res = typeof m2 === "function" ? m2(style, className) : m2; return _extends$1(_extends$1({}, res), { appear: props2.keyPath.length <= 1 }); }); return function() { var _a3; if (destroy3.value) { return null; } return createVNode(MenuContextProvider, { "mode": fixedMode.value }, { default: function _default8() { return [createVNode(Transition$1, mergedMotion.value, { default: function _default9() { return [withDirectives(createVNode(SubMenuList, { "id": props2.id, "style": style.value, "class": className.value }, { default: function _default10() { return [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)]; } }), [[vShow, mergedOpen.value]])]; } })]; } }); }; } }); var indexGuid$1 = 0; var subMenuProps = { icon: PropsTypes.VNodeChild, title: PropsTypes.VNodeChild, disabled: Boolean, level: Number, popupClassName: String, popupOffset: Array, internalPopupClose: Boolean, eventKey: String, expandIcon: Function }; var SubMenu = defineComponent({ name: "ASubMenu", inheritAttrs: false, props: subMenuProps, slots: ["icon", "title", "expandIcon"], emits: ["titleClick", "mouseenter", "mouseleave"], setup: function setup45(props2, _ref) { var slots = _ref.slots, attrs = _ref.attrs, emit2 = _ref.emit; var _a3, _b2; useProvideFirstLevel(false); var instance = getCurrentInstance(); var vnodeKey = _typeof$2(instance.vnode.key) === "symbol" ? String(instance.vnode.key) : instance.vnode.key; devWarning(_typeof$2(instance.vnode.key) !== "symbol", "SubMenu", 'SubMenu `:key="'.concat(String(vnodeKey), '"` not support Symbol type')); var key2 = isValid$1(vnodeKey) ? vnodeKey : "sub_menu_".concat(++indexGuid$1, "_$$_not_set_key"); var eventKey = (_a3 = props2.eventKey) !== null && _a3 !== void 0 ? _a3 : isValid$1(vnodeKey) ? "sub_menu_".concat(++indexGuid$1, "_$$_").concat(vnodeKey) : key2; var _useInjectKeyPath = useInjectKeyPath(), parentEventKeys = _useInjectKeyPath.parentEventKeys, parentInfo = _useInjectKeyPath.parentInfo, parentKeys = _useInjectKeyPath.parentKeys; var keysPath = computed(function() { return [].concat(_toConsumableArray(parentKeys.value), [key2]); }); var eventKeysPath = computed(function() { return [].concat(_toConsumableArray(parentEventKeys.value), [eventKey]); }); var childrenEventKeys = ref([]); var menuInfo = { eventKey, key: key2, parentEventKeys, childrenEventKeys, parentKeys }; (_b2 = parentInfo.childrenEventKeys) === null || _b2 === void 0 ? void 0 : _b2.value.push(eventKey); onBeforeUnmount(function() { var _a4; if (parentInfo.childrenEventKeys) { parentInfo.childrenEventKeys.value = (_a4 = parentInfo.childrenEventKeys) === null || _a4 === void 0 ? void 0 : _a4.value.filter(function(k2) { return k2 != eventKey; }); } }); useProvideKeyPath$1(eventKey, key2, menuInfo); var _useInjectMenu = useInjectMenu(), prefixCls2 = _useInjectMenu.prefixCls, activeKeys = _useInjectMenu.activeKeys, contextDisabled = _useInjectMenu.disabled, changeActiveKeys = _useInjectMenu.changeActiveKeys, mode3 = _useInjectMenu.mode, inlineCollapsed = _useInjectMenu.inlineCollapsed, antdMenuTheme = _useInjectMenu.antdMenuTheme, openKeys = _useInjectMenu.openKeys, overflowDisabled = _useInjectMenu.overflowDisabled, onOpenChange = _useInjectMenu.onOpenChange, registerMenuInfo = _useInjectMenu.registerMenuInfo, unRegisterMenuInfo = _useInjectMenu.unRegisterMenuInfo, selectedSubMenuEventKeys = _useInjectMenu.selectedSubMenuEventKeys, motion = _useInjectMenu.motion, defaultMotions = _useInjectMenu.defaultMotions, menuExpandIcon = _useInjectMenu.expandIcon; registerMenuInfo(eventKey, menuInfo); onBeforeUnmount(function() { unRegisterMenuInfo(eventKey); }); var subMenuPrefixCls = computed(function() { return "".concat(prefixCls2.value, "-submenu"); }); var mergedDisabled = computed(function() { return contextDisabled.value || props2.disabled; }); var elementRef = ref(); var popupRef = ref(); var originOpen = computed(function() { return openKeys.value.includes(key2); }); var open6 = computed(function() { return !overflowDisabled.value && originOpen.value; }); var childrenSelected = computed(function() { return selectedSubMenuEventKeys.value.includes(eventKey); }); var isActive = ref(false); watch(activeKeys, function() { isActive.value = !!activeKeys.value.find(function(val) { return val === key2; }); }, { immediate: true }); var onInternalTitleClick = function onInternalTitleClick2(e2) { if (mergedDisabled.value) { return; } emit2("titleClick", e2, key2); if (mode3.value === "inline") { onOpenChange(eventKey, !originOpen.value); } }; var onMouseEnter4 = function onMouseEnter5(event) { if (!mergedDisabled.value) { changeActiveKeys(keysPath.value); emit2("mouseenter", event); } }; var onMouseLeave5 = function onMouseLeave6(event) { if (!mergedDisabled.value) { changeActiveKeys([]); emit2("mouseleave", event); } }; var directionStyle = useDirectionStyle(computed(function() { return eventKeysPath.value.length; })); var onPopupVisibleChange = function onPopupVisibleChange2(newVisible) { if (mode3.value !== "inline") { onOpenChange(eventKey, newVisible); } }; var onInternalFocus = function onInternalFocus2() { changeActiveKeys(keysPath.value); }; var popupId = eventKey && "".concat(eventKey, "-popup"); var popupClassName = computed(function() { return classNames(prefixCls2.value, "".concat(prefixCls2.value, "-").concat(antdMenuTheme.value), props2.popupClassName); }); var renderTitle2 = function renderTitle3(title, icon) { if (!icon) { return inlineCollapsed.value && !parentEventKeys.value.length && title && typeof title === "string" ? createVNode("div", { "class": "".concat(prefixCls2.value, "-inline-collapsed-noicon") }, [title.charAt(0)]) : createVNode("span", { "class": "".concat(prefixCls2.value, "-title-content") }, [title]); } var titleIsSpan = isValidElement(title) && title.type === "span"; return createVNode(Fragment, null, [cloneElement(icon, { class: "".concat(prefixCls2.value, "-item-icon") }, false), titleIsSpan ? title : createVNode("span", { "class": "".concat(prefixCls2.value, "-title-content") }, [title])]); }; var triggerModeRef = computed(function() { return mode3.value !== "inline" && eventKeysPath.value.length > 1 ? "vertical" : mode3.value; }); var renderMode = computed(function() { return mode3.value === "horizontal" ? "vertical" : mode3.value; }); var style = ref({}); var className = ref(""); var mergedMotion = computed(function() { var _a4, _b3; var m2 = motion.value || ((_a4 = defaultMotions.value) === null || _a4 === void 0 ? void 0 : _a4[mode3.value]) || ((_b3 = defaultMotions.value) === null || _b3 === void 0 ? void 0 : _b3.other); var res = typeof m2 === "function" ? m2(style, className) : m2; return res ? getTransitionProps(res.name) : void 0; }); var subMenuTriggerModeRef = computed(function() { return triggerModeRef.value === "horizontal" ? "vertical" : triggerModeRef.value; }); return function() { var _classNames; var _a4; var icon = getPropsSlot(slots, props2, "icon"); var title = renderTitle2(getPropsSlot(slots, props2, "title"), icon); var subMenuPrefixClsValue = subMenuPrefixCls.value; var expandIcon = props2.expandIcon || slots.expandIcon || menuExpandIcon; var titleNode = createVNode("div", { "style": directionStyle.value, "class": "".concat(subMenuPrefixClsValue, "-title"), "tabindex": mergedDisabled.value ? null : -1, "ref": elementRef, "title": typeof title === "string" ? title : null, "data-menu-id": key2, "aria-expanded": open6.value, "aria-haspopup": true, "aria-controls": popupId, "aria-disabled": mergedDisabled.value, "onClick": onInternalTitleClick, "onFocus": onInternalFocus }, [title, mode3.value !== "horizontal" && expandIcon ? expandIcon(_extends$1(_extends$1({}, props2), { isOpen: open6.value })) : createVNode("i", { "class": "".concat(subMenuPrefixClsValue, "-arrow") }, null)]); if (!overflowDisabled.value && mode3.value !== "inline") { var triggerMode = triggerModeRef.value; var _titleNode = function() { return titleNode; }(); titleNode = createVNode(PopupTrigger, { "mode": triggerMode, "prefixCls": subMenuPrefixClsValue, "visible": !props2.internalPopupClose && open6.value, "popupClassName": popupClassName.value, "popupOffset": props2.popupOffset, "disabled": mergedDisabled.value, "onVisibleChange": onPopupVisibleChange }, { default: function _default8() { return [_titleNode]; }, popup: function popup(_ref2) { var visible9 = _ref2.visible; var _a5; return createVNode(MenuContextProvider, { "mode": subMenuTriggerModeRef.value, "isRootMenu": false }, { default: function _default8() { return [createVNode(Transition$1, mergedMotion.value, { default: function _default9() { return [withDirectives(createVNode(SubMenuList, { "id": popupId, "ref": popupRef }, { default: function _default10() { return [(_a5 = slots.default) === null || _a5 === void 0 ? void 0 : _a5.call(slots)]; } }), [[vShow, visible9]])]; } })]; } }); } }); } else { var _titleNode2 = function() { return titleNode; }(); titleNode = createVNode(PopupTrigger, null, { default: function _default8() { return [_titleNode2]; } }); } return createVNode(MenuContextProvider, { "mode": renderMode.value }, { default: function _default8() { return [createVNode(Overflow$1.Item, _objectSpread2$2(_objectSpread2$2({ "component": "li" }, attrs), {}, { "role": "none", "class": classNames(subMenuPrefixClsValue, "".concat(subMenuPrefixClsValue, "-").concat(mode3.value), attrs.class, (_classNames = {}, _defineProperty$12(_classNames, "".concat(subMenuPrefixClsValue, "-open"), open6.value), _defineProperty$12(_classNames, "".concat(subMenuPrefixClsValue, "-active"), isActive.value), _defineProperty$12(_classNames, "".concat(subMenuPrefixClsValue, "-selected"), childrenSelected.value), _defineProperty$12(_classNames, "".concat(subMenuPrefixClsValue, "-disabled"), mergedDisabled.value), _classNames)), "onMouseenter": onMouseEnter4, "onMouseleave": onMouseLeave5, "data-submenu-id": key2 }), { default: function _default9() { return [titleNode, !overflowDisabled.value && createVNode(InlineSubMenuList, { "id": popupId, "open": open6.value, "keyPath": keysPath.value }, { default: function _default10() { return [(_a4 = slots.default) === null || _a4 === void 0 ? void 0 : _a4.call(slots)]; } })]; } })]; } }); }; } }); var menuProps = { prefixCls: String, disabled: Boolean, inlineCollapsed: Boolean, disabledOverflow: Boolean, openKeys: Array, selectedKeys: Array, activeKey: String, selectable: { type: Boolean, default: true }, multiple: { type: Boolean, default: false }, motion: Object, theme: { type: String, default: "light" }, mode: { type: String, default: "vertical" }, inlineIndent: { type: Number, default: 24 }, subMenuOpenDelay: { type: Number, default: 0.1 }, subMenuCloseDelay: { type: Number, default: 0.1 }, builtinPlacements: { type: Object }, triggerSubMenuAction: { type: String, default: "hover" }, getPopupContainer: Function, expandIcon: Function }; var EMPTY_LIST = []; var Menu = defineComponent({ name: "AMenu", props: menuProps, emits: ["update:openKeys", "openChange", "select", "deselect", "update:selectedKeys", "click", "update:activeKey"], slots: ["expandIcon", "overflowedIndicator"], setup: function setup46(props2, _ref) { var slots = _ref.slots, emit2 = _ref.emit; var _useConfigInject = useConfigInject("menu", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction; var store = ref({}); var siderCollapsed = inject(SiderCollapsedKey, ref(void 0)); var inlineCollapsed = computed(function() { if (siderCollapsed.value !== void 0) { return siderCollapsed.value; } return props2.inlineCollapsed; }); var isMounted = ref(false); onMounted(function() { isMounted.value = true; }); watchEffect(function() { devWarning(!(props2.inlineCollapsed === true && props2.mode !== "inline"), "Menu", "`inlineCollapsed` should only be used when `mode` is inline."); devWarning(!(siderCollapsed.value !== void 0 && props2.inlineCollapsed === true), "Menu", "`inlineCollapsed` not control Menu under Sider. Should set `collapsed` on Sider instead."); }); var activeKeys = ref([]); var mergedSelectedKeys = ref([]); var keyMapStore = ref({}); watch(store, function() { var newKeyMapStore = {}; for (var _i = 0, _Object$values = Object.values(store.value); _i < _Object$values.length; _i++) { var menuInfo = _Object$values[_i]; newKeyMapStore[menuInfo.key] = menuInfo; } keyMapStore.value = newKeyMapStore; }, { flush: "post" }); watchEffect(function() { if (props2.activeKey !== void 0) { var keys2 = []; var menuInfo = props2.activeKey ? keyMapStore.value[props2.activeKey] : void 0; if (menuInfo && props2.activeKey !== void 0) { keys2 = [].concat(_toConsumableArray(menuInfo.parentKeys), [props2.activeKey]); } else { keys2 = []; } if (!shallowEqual$1(activeKeys.value, keys2)) { activeKeys.value = keys2; } } }); watch(function() { return props2.selectedKeys; }, function(selectedKeys2) { mergedSelectedKeys.value = selectedKeys2 || mergedSelectedKeys.value; }, { immediate: true }); var selectedSubMenuEventKeys = ref([]); watch([keyMapStore, mergedSelectedKeys], function() { var subMenuParentEventKeys = []; mergedSelectedKeys.value.forEach(function(key2) { var menuInfo = keyMapStore.value[key2]; if (menuInfo) { var _subMenuParentEventKe; (_subMenuParentEventKe = subMenuParentEventKeys).push.apply(_subMenuParentEventKe, _toConsumableArray(unref(menuInfo.parentEventKeys))); } }); subMenuParentEventKeys = uniq(subMenuParentEventKeys); if (!shallowEqual$1(selectedSubMenuEventKeys.value, subMenuParentEventKeys)) { selectedSubMenuEventKeys.value = subMenuParentEventKeys; } }, { immediate: true }); var triggerSelection = function triggerSelection2(info3) { if (!props2.selectable) { return; } var targetKey = info3.key; var exist = mergedSelectedKeys.value.includes(targetKey); var newSelectedKeys; if (props2.multiple) { if (exist) { newSelectedKeys = mergedSelectedKeys.value.filter(function(key2) { return key2 !== targetKey; }); } else { newSelectedKeys = [].concat(_toConsumableArray(mergedSelectedKeys.value), [targetKey]); } } else { newSelectedKeys = [targetKey]; } var selectInfo = _extends$1(_extends$1({}, info3), { selectedKeys: newSelectedKeys }); if (!shallowEqual$1(newSelectedKeys, mergedSelectedKeys.value)) { if (props2.selectedKeys === void 0) { mergedSelectedKeys.value = newSelectedKeys; } emit2("update:selectedKeys", newSelectedKeys); if (exist && props2.multiple) { emit2("deselect", selectInfo); } else { emit2("select", selectInfo); } } if (mergedMode.value !== "inline" && !props2.multiple && mergedOpenKeys.value.length) { triggerOpenKeys(EMPTY_LIST); } }; var mergedOpenKeys = ref([]); watch(function() { return props2.openKeys; }, function() { var openKeys = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : mergedOpenKeys.value; if (!shallowEqual$1(mergedOpenKeys.value, openKeys)) { mergedOpenKeys.value = openKeys; } }, { immediate: true }); var timeout; var changeActiveKeys = function changeActiveKeys2(keys2) { window.clearTimeout(timeout); timeout = window.setTimeout(function() { if (props2.activeKey === void 0) { activeKeys.value = keys2; } emit2("update:activeKey", keys2[keys2.length - 1]); }); }; var disabled = computed(function() { return !!props2.disabled; }); var isRtl = computed(function() { return direction.value === "rtl"; }); var mergedMode = ref("vertical"); var mergedInlineCollapsed = ref(false); watchEffect(function() { if ((props2.mode === "inline" || props2.mode === "vertical") && inlineCollapsed.value) { mergedMode.value = "vertical"; mergedInlineCollapsed.value = inlineCollapsed.value; } else { mergedMode.value = props2.mode; mergedInlineCollapsed.value = false; } }); var isInlineMode = computed(function() { return mergedMode.value === "inline"; }); var triggerOpenKeys = function triggerOpenKeys2(keys2) { mergedOpenKeys.value = keys2; emit2("update:openKeys", keys2); emit2("openChange", keys2); }; var inlineCacheOpenKeys = ref(mergedOpenKeys.value); var mountRef = ref(false); watch(mergedOpenKeys, function() { if (isInlineMode.value) { inlineCacheOpenKeys.value = mergedOpenKeys.value; } }, { immediate: true }); watch(isInlineMode, function() { if (!mountRef.value) { mountRef.value = true; return; } if (isInlineMode.value) { mergedOpenKeys.value = inlineCacheOpenKeys.value; } else { triggerOpenKeys(EMPTY_LIST); } }, { immediate: true }); var className = computed(function() { var _ref2; return _ref2 = {}, _defineProperty$12(_ref2, "".concat(prefixCls2.value), true), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-root"), true), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-").concat(mergedMode.value), true), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-inline-collapsed"), mergedInlineCollapsed.value), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-rtl"), isRtl.value), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-").concat(props2.theme), true), _ref2; }); var defaultMotions = { horizontal: { name: "ant-slide-up" }, inline: collapseMotion, other: { name: "ant-zoom-big" } }; useProvideFirstLevel(true); var getChildrenKeys = function getChildrenKeys2() { var eventKeys = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var keys2 = []; var storeValue = store.value; eventKeys.forEach(function(eventKey) { var _storeValue$eventKey = storeValue[eventKey], key2 = _storeValue$eventKey.key, childrenEventKeys = _storeValue$eventKey.childrenEventKeys; keys2.push.apply(keys2, [key2].concat(_toConsumableArray(getChildrenKeys2(childrenEventKeys)))); }); return keys2; }; var onInternalClick = function onInternalClick2(info3) { emit2("click", info3); triggerSelection(info3); }; var onInternalOpenChange = function onInternalOpenChange2(eventKey, open6) { var _store$value$eventKey = store.value[eventKey], key2 = _store$value$eventKey.key, childrenEventKeys = _store$value$eventKey.childrenEventKeys; var newOpenKeys = mergedOpenKeys.value.filter(function(k2) { return k2 !== key2; }); if (open6) { newOpenKeys.push(key2); } else if (mergedMode.value !== "inline") { var subPathKeys = getChildrenKeys(childrenEventKeys); newOpenKeys = newOpenKeys.filter(function(k2) { return !subPathKeys.includes(k2); }); } if (!shallowEqual$1(mergedOpenKeys, newOpenKeys)) { triggerOpenKeys(newOpenKeys); } }; var registerMenuInfo = function registerMenuInfo2(key2, info3) { store.value = _extends$1(_extends$1({}, store.value), _defineProperty$12({}, key2, info3)); }; var unRegisterMenuInfo = function unRegisterMenuInfo2(key2) { delete store.value[key2]; store.value = _extends$1({}, store.value); }; var lastVisibleIndex = ref(0); useProvideMenu$1({ store, prefixCls: prefixCls2, activeKeys, openKeys: mergedOpenKeys, selectedKeys: mergedSelectedKeys, changeActiveKeys, disabled, rtl: isRtl, mode: mergedMode, inlineIndent: computed(function() { return props2.inlineIndent; }), subMenuCloseDelay: computed(function() { return props2.subMenuCloseDelay; }), subMenuOpenDelay: computed(function() { return props2.subMenuOpenDelay; }), builtinPlacements: computed(function() { return props2.builtinPlacements; }), triggerSubMenuAction: computed(function() { return props2.triggerSubMenuAction; }), getPopupContainer: computed(function() { return props2.getPopupContainer; }), inlineCollapsed: mergedInlineCollapsed, antdMenuTheme: computed(function() { return props2.theme; }), siderCollapsed, defaultMotions: computed(function() { return isMounted.value ? defaultMotions : null; }), motion: computed(function() { return isMounted.value ? props2.motion : null; }), overflowDisabled: ref(void 0), onOpenChange: onInternalOpenChange, onItemClick: onInternalClick, registerMenuInfo, unRegisterMenuInfo, selectedSubMenuEventKeys, isRootMenu: ref(true), expandIcon: props2.expandIcon || slots.expandIcon }); return function() { var _a3, _b2; var childList = flattenChildren((_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)); var allVisible = lastVisibleIndex.value >= childList.length - 1 || mergedMode.value !== "horizontal" || props2.disabledOverflow; var wrappedChildList = mergedMode.value !== "horizontal" || props2.disabledOverflow ? childList : childList.map(function(child, index2) { return createVNode(MenuContextProvider, { "key": child.key, "overflowDisabled": index2 > lastVisibleIndex.value }, { default: function _default8() { return [child]; } }); }); var overflowedIndicator = ((_b2 = slots.overflowedIndicator) === null || _b2 === void 0 ? void 0 : _b2.call(slots)) || createVNode(EllipsisOutlined$1, null, null); return createVNode(Overflow$1, { "prefixCls": "".concat(prefixCls2.value, "-overflow"), "component": "ul", "itemComponent": MenuItem, "class": className.value, "role": "menu", "data": wrappedChildList, "renderRawItem": function renderRawItem(node) { return node; }, "renderRawRest": function renderRawRest(omitItems) { var len = omitItems.length; var originOmitItems = len ? childList.slice(-len) : null; return createVNode(SubMenu, { "eventKey": Overflow$1.OVERFLOW_KEY, "title": overflowedIndicator, "disabled": allVisible, "internalPopupClose": len === 0 }, { default: function _default8() { return [originOmitItems]; } }); }, "maxCount": mergedMode.value !== "horizontal" || props2.disabledOverflow ? Overflow$1.INVALIDATE : Overflow$1.RESPONSIVE, "ssr": "full", "data-menu-list": true, "onVisibleChange": function onVisibleChange6(newLastIndex) { lastVisibleIndex.value = newLastIndex; } }, null); }; } }); var menuItemGroupProps = { title: PropsTypes.VNodeChild }; var ItemGroup = defineComponent({ name: "AMenuItemGroup", inheritAttrs: false, props: menuItemGroupProps, slots: ["title"], setup: function setup47(props2, _ref) { var slots = _ref.slots, attrs = _ref.attrs; var _useInjectMenu = useInjectMenu(), prefixCls2 = _useInjectMenu.prefixCls; var groupPrefixCls = computed(function() { return "".concat(prefixCls2.value, "-item-group"); }); return function() { var _a3; return createVNode("li", _objectSpread2$2(_objectSpread2$2({}, attrs), {}, { "onClick": function onClick7(e2) { return e2.stopPropagation(); }, "class": groupPrefixCls.value }), [createVNode("div", { "title": typeof props2.title === "string" ? props2.title : void 0, "class": "".concat(groupPrefixCls.value, "-title") }, [getPropsSlot(slots, props2, "title")]), createVNode("ul", { "class": "".concat(groupPrefixCls.value, "-list") }, [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)])]); }; } }); var Divider$2 = defineComponent({ name: "AMenuDivider", setup: function setup48() { var _useInjectMenu = useInjectMenu(), prefixCls2 = _useInjectMenu.prefixCls; return function() { return createVNode("li", { "class": "".concat(prefixCls2.value, "-item-divider") }, null); }; } }); Menu.install = function(app) { app.component(Menu.name, Menu); app.component(MenuItem.name, MenuItem); app.component(SubMenu.name, SubMenu); app.component(Divider$2.name, Divider$2); app.component(ItemGroup.name, ItemGroup); return app; }; Menu.Item = MenuItem; Menu.Divider = Divider$2; Menu.SubMenu = SubMenu; Menu.ItemGroup = ItemGroup; var breadcrumbProps = { prefixCls: PropsTypes.string, routes: { type: Array }, params: PropsTypes.any, separator: PropsTypes.any, itemRender: { type: Function } }; function getBreadcrumbName(route, params) { if (!route.breadcrumbName) { return null; } var paramsKeys = Object.keys(params).join("|"); var name = route.breadcrumbName.replace(new RegExp(":(".concat(paramsKeys, ")"), "g"), function(replacement, key2) { return params[key2] || replacement; }); return name; } function defaultItemRender$1(opt) { var route = opt.route, params = opt.params, routes = opt.routes, paths = opt.paths; var isLastItem = routes.indexOf(route) === routes.length - 1; var name = getBreadcrumbName(route, params); return isLastItem ? createVNode("span", null, [name]) : createVNode("a", { "href": "#/".concat(paths.join("/")) }, [name]); } var Breadcrumb = defineComponent({ name: "ABreadcrumb", props: breadcrumbProps, slots: ["separator", "itemRender"], setup: function setup49(props2, _ref) { var slots = _ref.slots; var _useConfigInject = useConfigInject("breadcrumb", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction; var getPath2 = function getPath3(path2, params) { path2 = (path2 || "").replace(/^\//, ""); Object.keys(params).forEach(function(key2) { path2 = path2.replace(":".concat(key2), params[key2]); }); return path2; }; var addChildPath = function addChildPath2(paths) { var childPath = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; var params = arguments.length > 2 ? arguments[2] : void 0; var originalPaths = _toConsumableArray(paths); var path2 = getPath2(childPath, params); if (path2) { originalPaths.push(path2); } return originalPaths; }; var genForRoutes = function genForRoutes2(_ref2) { var _ref2$routes = _ref2.routes, routes = _ref2$routes === void 0 ? [] : _ref2$routes, _ref2$params = _ref2.params, params = _ref2$params === void 0 ? {} : _ref2$params, separator2 = _ref2.separator, _ref2$itemRender = _ref2.itemRender, itemRender2 = _ref2$itemRender === void 0 ? defaultItemRender$1 : _ref2$itemRender; var paths = []; return routes.map(function(route) { var path2 = getPath2(route.path, params); if (path2) { paths.push(path2); } var tempPaths = [].concat(paths); var overlay = null; if (route.children && route.children.length) { overlay = createVNode(Menu, null, { default: function _default8() { return [route.children.map(function(child) { return createVNode(Menu.Item, { "key": child.path || child.breadcrumbName }, { default: function _default9() { return [itemRender2({ route: child, params, routes, paths: addChildPath(tempPaths, child.path, params) })]; } }); })]; } }); } return createVNode(BreadcrumbItem, { "overlay": overlay, "separator": separator2, "key": path2 || route.breadcrumbName }, { default: function _default8() { return [itemRender2({ route, params, routes, paths: tempPaths })]; } }); }); }; return function() { var _breadcrumbClassName; var _a3; var crumbs; var routes = props2.routes, _props$params = props2.params, params = _props$params === void 0 ? {} : _props$params; var children = flattenChildren(getPropsSlot(slots, props2)); var separator2 = (_a3 = getPropsSlot(slots, props2, "separator")) !== null && _a3 !== void 0 ? _a3 : "/"; var itemRender2 = props2.itemRender || slots.itemRender || defaultItemRender$1; if (routes && routes.length > 0) { crumbs = genForRoutes({ routes, params, separator: separator2, itemRender: itemRender2 }); } else if (children.length) { crumbs = children.map(function(element, index2) { warning$5(_typeof$2(element.type) === "object" && (element.type.__ANT_BREADCRUMB_ITEM || element.type.__ANT_BREADCRUMB_SEPARATOR), "Breadcrumb", "Only accepts Breadcrumb.Item and Breadcrumb.Separator as it's children"); return cloneVNode(element, { separator: separator2, key: index2 }); }); } var breadcrumbClassName = (_breadcrumbClassName = {}, _defineProperty$12(_breadcrumbClassName, prefixCls2.value, true), _defineProperty$12(_breadcrumbClassName, "".concat(prefixCls2.value, "-rtl"), direction.value === "rtl"), _breadcrumbClassName); return createVNode("div", { "class": breadcrumbClassName }, [crumbs]); }; } }); var __rest$t = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var breadcrumbSeparatorProps = { prefixCls: PropsTypes.string }; var BreadcrumbSeparator = defineComponent({ name: "ABreadcrumbSeparator", __ANT_BREADCRUMB_SEPARATOR: true, inheritAttrs: false, props: breadcrumbSeparatorProps, setup: function setup50(props2, _ref) { var slots = _ref.slots, attrs = _ref.attrs; var _useConfigInject = useConfigInject("breadcrumb", props2), prefixCls2 = _useConfigInject.prefixCls; return function() { var _a3; attrs.separator; var className = attrs.class, restAttrs = __rest$t(attrs, ["separator", "class"]); var children = flattenChildren((_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)); return createVNode("span", _objectSpread2$2({ "class": ["".concat(prefixCls2.value, "-separator"), className] }, restAttrs), [children.length > 0 ? children : "/"]); }; } }); Breadcrumb.Item = BreadcrumbItem; Breadcrumb.Separator = BreadcrumbSeparator; Breadcrumb.install = function(app) { app.component(Breadcrumb.name, Breadcrumb); app.component(BreadcrumbItem.name, BreadcrumbItem); app.component(BreadcrumbSeparator.name, BreadcrumbSeparator); return app; }; var DateConstants = { DATE_ROW_COUNT: 6, DATE_COL_COUNT: 7 }; var DateTHead = function DateTHead2(_2, _ref) { var attrs = _ref.attrs; var value24 = attrs.value; var localeData2 = value24.localeData(); var prefixCls2 = attrs.prefixCls; var veryShortWeekdays = []; var weekDays = []; var firstDayOfWeek = localeData2.firstDayOfWeek(); var showWeekNumberEl; var now2 = hooks(); for (var dateColIndex = 0; dateColIndex < DateConstants.DATE_COL_COUNT; dateColIndex++) { var index2 = (firstDayOfWeek + dateColIndex) % DateConstants.DATE_COL_COUNT; now2.day(index2); veryShortWeekdays[dateColIndex] = localeData2.weekdaysMin(now2); weekDays[dateColIndex] = localeData2.weekdaysShort(now2); } if (attrs.showWeekNumber) { showWeekNumberEl = createVNode("th", { "role": "columnheader", "class": "".concat(prefixCls2, "-column-header ").concat(prefixCls2, "-week-number-header") }, [createVNode("span", { "class": "".concat(prefixCls2, "-column-header-inner") }, [createTextVNode("x")])]); } var weekDaysEls = weekDays.map(function(day, xindex) { return createVNode("th", { "key": xindex, "role": "columnheader", "title": day, "class": "".concat(prefixCls2, "-column-header") }, [createVNode("span", { "class": "".concat(prefixCls2, "-column-header-inner") }, [veryShortWeekdays[xindex]])]); }); return createVNode("thead", null, [createVNode("tr", { "role": "row" }, [showWeekNumberEl, weekDaysEls])]); }; DateTHead.inheritAttrs = false; var DateTHead$1 = DateTHead; var defaultDisabledTime = { disabledHours: function disabledHours() { return []; }, disabledMinutes: function disabledMinutes() { return []; }, disabledSeconds: function disabledSeconds() { return []; } }; function getTodayTime(value24) { var today = hooks(); today.locale(value24.locale()).utcOffset(value24.utcOffset()); return today; } function getTitleString(value24) { return value24.format("LL"); } function getTodayTimeStr(value24) { var today = getTodayTime(value24); return getTitleString(today); } function getMonthName(month) { var locale2 = month.locale(); var localeData2 = month.localeData(); return localeData2[locale2 === "zh-cn" ? "months" : "monthsShort"](month); } function syncTime(from2, to2) { if (!hooks.isMoment(from2) || !hooks.isMoment(to2)) return; to2.hour(from2.hour()); to2.minute(from2.minute()); to2.second(from2.second()); to2.millisecond(from2.millisecond()); } function getTimeConfig(value24, disabledTime) { var disabledTimeConfig = disabledTime ? disabledTime(value24) : {}; disabledTimeConfig = _extends$1(_extends$1({}, defaultDisabledTime), disabledTimeConfig); return disabledTimeConfig; } function isTimeValidByConfig(value24, disabledTimeConfig) { var invalidTime = false; if (value24) { var hour2 = value24.hour(); var minutes2 = value24.minute(); var seconds2 = value24.second(); var disabledHours3 = disabledTimeConfig.disabledHours(); if (disabledHours3.indexOf(hour2) === -1) { var disabledMinutes2 = disabledTimeConfig.disabledMinutes(hour2); if (disabledMinutes2.indexOf(minutes2) === -1) { var disabledSeconds2 = disabledTimeConfig.disabledSeconds(hour2, minutes2); invalidTime = disabledSeconds2.indexOf(seconds2) !== -1; } else { invalidTime = true; } } else { invalidTime = true; } } return !invalidTime; } function isTimeValid(value24, disabledTime) { var disabledTimeConfig = getTimeConfig(value24, disabledTime); return isTimeValidByConfig(value24, disabledTimeConfig); } function isAllowedDate(value24, disabledDate, disabledTime) { if (disabledDate) { if (disabledDate(value24)) { return false; } } if (disabledTime) { if (!isTimeValid(value24, disabledTime)) { return false; } } return true; } function formatDate$1(value24, format3) { if (!value24) { return ""; } if (Array.isArray(format3)) { format3 = format3[0]; } if (typeof format3 === "function") { var result = format3(value24); if (typeof result === "string") { return result; } else { throw new Error("The function of format does not return a string"); } } return value24.format(format3); } function noop$t() { } function isSameDay(one, two) { return one && two && one.isSame(two, "day"); } function beforeCurrentMonthYear(current2, today) { if (current2.year() < today.year()) { return 1; } return current2.year() === today.year() && current2.month() < today.month(); } function afterCurrentMonthYear(current2, today) { if (current2.year() > today.year()) { return 1; } return current2.year() === today.year() && current2.month() > today.month(); } function getIdFromDate(date3) { return "rc-calendar-".concat(date3.year(), "-").concat(date3.month(), "-").concat(date3.date()); } var DateTBody = { name: "DateTBody", inheritAttrs: false, props: { contentRender: PropsTypes.func, dateRender: PropsTypes.func, disabledDate: PropsTypes.func, prefixCls: PropsTypes.string, selectedValue: PropsTypes.any, value: PropsTypes.object, hoverValue: PropsTypes.any.def([]), showWeekNumber: PropsTypes.looseBool }, render: function render29() { var props2 = getOptionProps(this); var contentRender = props2.contentRender, prefixCls2 = props2.prefixCls, selectedValue5 = props2.selectedValue, value24 = props2.value, showWeekNumber = props2.showWeekNumber, dateRender = props2.dateRender, disabledDate = props2.disabledDate, hoverValue2 = props2.hoverValue; var _this$$attrs = this.$attrs, _this$$attrs$onSelect = _this$$attrs.onSelect, onSelect6 = _this$$attrs$onSelect === void 0 ? noop$t : _this$$attrs$onSelect, _this$$attrs$onDayHov = _this$$attrs.onDayHover, onDayHover2 = _this$$attrs$onDayHov === void 0 ? noop$t : _this$$attrs$onDayHov; var iIndex; var jIndex; var current2; var dateTable = []; var today = getTodayTime(value24); var cellClass = "".concat(prefixCls2, "-cell"); var weekNumberCellClass = "".concat(prefixCls2, "-week-number-cell"); var dateClass = "".concat(prefixCls2, "-date"); var todayClass = "".concat(prefixCls2, "-today"); var selectedClass = "".concat(prefixCls2, "-selected-day"); var selectedDateClass = "".concat(prefixCls2, "-selected-date"); var selectedStartDateClass = "".concat(prefixCls2, "-selected-start-date"); var selectedEndDateClass = "".concat(prefixCls2, "-selected-end-date"); var inRangeClass = "".concat(prefixCls2, "-in-range-cell"); var lastMonthDayClass = "".concat(prefixCls2, "-last-month-cell"); var nextMonthDayClass = "".concat(prefixCls2, "-next-month-btn-day"); var disabledClass = "".concat(prefixCls2, "-disabled-cell"); var firstDisableClass = "".concat(prefixCls2, "-disabled-cell-first-of-row"); var lastDisableClass = "".concat(prefixCls2, "-disabled-cell-last-of-row"); var lastDayOfMonthClass = "".concat(prefixCls2, "-last-day-of-month"); var month1 = value24.clone(); month1.date(1); var day = month1.day(); var lastMonthDiffDay = (day + 7 - value24.localeData().firstDayOfWeek()) % 7; var lastMonth1 = month1.clone(); lastMonth1.add(0 - lastMonthDiffDay, "days"); var passed = 0; for (iIndex = 0; iIndex < DateConstants.DATE_ROW_COUNT; iIndex++) { for (jIndex = 0; jIndex < DateConstants.DATE_COL_COUNT; jIndex++) { current2 = lastMonth1; if (passed) { current2 = current2.clone(); current2.add(passed, "days"); } dateTable.push(current2); passed++; } } var tableHtml = []; passed = 0; for (iIndex = 0; iIndex < DateConstants.DATE_ROW_COUNT; iIndex++) { var _cx; var isCurrentWeek = void 0; var weekNumberCell = void 0; var isActiveWeek = false; var dateCells = []; if (showWeekNumber) { weekNumberCell = createVNode("td", { "key": "week-".concat(dateTable[passed].week()), "role": "gridcell", "class": weekNumberCellClass }, [dateTable[passed].week()]); } for (jIndex = 0; jIndex < DateConstants.DATE_COL_COUNT; jIndex++) { var next2 = null; var last2 = null; current2 = dateTable[passed]; if (jIndex < DateConstants.DATE_COL_COUNT - 1) { next2 = dateTable[passed + 1]; } if (jIndex > 0) { last2 = dateTable[passed - 1]; } var cls = cellClass; var disabled = false; var selected = false; if (isSameDay(current2, today)) { cls += " ".concat(todayClass); isCurrentWeek = true; } var isBeforeCurrentMonthYear = beforeCurrentMonthYear(current2, value24); var isAfterCurrentMonthYear = afterCurrentMonthYear(current2, value24); if (selectedValue5 && Array.isArray(selectedValue5)) { var rangeValue = hoverValue2.length ? hoverValue2 : selectedValue5; if (!isBeforeCurrentMonthYear && !isAfterCurrentMonthYear) { var startValue = rangeValue[0]; var endValue = rangeValue[1]; if (startValue) { if (isSameDay(current2, startValue)) { selected = true; isActiveWeek = true; cls += " ".concat(selectedStartDateClass); } } if (startValue || endValue) { if (isSameDay(current2, endValue)) { selected = true; isActiveWeek = true; cls += " ".concat(selectedEndDateClass); } else if ((startValue === null || startValue === void 0) && current2.isBefore(endValue, "day")) { cls += " ".concat(inRangeClass); } else if ((endValue === null || endValue === void 0) && current2.isAfter(startValue, "day")) { cls += " ".concat(inRangeClass); } else if (current2.isAfter(startValue, "day") && current2.isBefore(endValue, "day")) { cls += " ".concat(inRangeClass); } } } } else if (isSameDay(current2, value24)) { selected = true; isActiveWeek = true; } if (isSameDay(current2, selectedValue5)) { cls += " ".concat(selectedDateClass); } if (isBeforeCurrentMonthYear) { cls += " ".concat(lastMonthDayClass); } if (isAfterCurrentMonthYear) { cls += " ".concat(nextMonthDayClass); } if (current2.clone().endOf("month").date() === current2.date()) { cls += " ".concat(lastDayOfMonthClass); } if (disabledDate) { if (disabledDate(current2, value24)) { disabled = true; if (!last2 || !disabledDate(last2, value24)) { cls += " ".concat(firstDisableClass); } if (!next2 || !disabledDate(next2, value24)) { cls += " ".concat(lastDisableClass); } } } if (selected) { cls += " ".concat(selectedClass); } if (disabled) { cls += " ".concat(disabledClass); } var dateHtml = void 0; if (dateRender) { dateHtml = dateRender({ current: current2, today: value24 }); } else { var content = contentRender ? contentRender({ current: current2, today: value24 }) : current2.date(); dateHtml = createVNode("div", { "key": getIdFromDate(current2), "class": dateClass, "aria-selected": selected, "aria-disabled": disabled }, [content]); } dateCells.push(createVNode("td", { "key": passed, "onClick": disabled ? noop$t : onSelect6.bind(null, current2), "onMouseenter": disabled ? noop$t : onDayHover2.bind(null, current2), "role": "gridcell", "title": getTitleString(current2), "class": cls }, [dateHtml])); passed++; } tableHtml.push(createVNode("tr", { "key": iIndex, "role": "row", "class": classNames((_cx = {}, _defineProperty$12(_cx, "".concat(prefixCls2, "-current-week"), isCurrentWeek), _defineProperty$12(_cx, "".concat(prefixCls2, "-active-week"), isActiveWeek), _cx)) }, [weekNumberCell, dateCells])); } return createVNode("tbody", { "class": "".concat(prefixCls2, "-tbody") }, [tableHtml]); } }; var DateTBody$1 = DateTBody; var DateTable = function DateTable2(_2, _ref) { var attrs = _ref.attrs; var prefixCls2 = attrs.prefixCls; return createVNode("table", { "class": "".concat(prefixCls2, "-table"), "cellspacing": "0", "role": "grid" }, [createVNode(DateTHead$1, attrs, null), createVNode(DateTBody$1, attrs, null)]); }; DateTable.inheritAttrs = false; var DateTable$1 = DateTable; var ROW$2 = 4; var COL$2 = 3; function noop$s() { } var MonthTable = { name: "MonthTable", inheritAttrs: false, mixins: [BaseMixin], props: { cellRender: PropsTypes.func, prefixCls: PropsTypes.string, value: PropsTypes.object, locale: PropsTypes.any, contentRender: PropsTypes.any, disabledDate: PropsTypes.func }, data: function data11() { return { sValue: this.value }; }, watch: { value: function value5(val) { this.setState({ sValue: val }); } }, methods: { setAndSelectValue: function setAndSelectValue(value24) { this.setState({ sValue: value24 }); this.__emit("select", value24); }, chooseMonth: function chooseMonth(month) { var next2 = this.sValue.clone(); next2.month(month); this.setAndSelectValue(next2); }, months: function months2() { var value24 = this.sValue; var current2 = value24.clone(); var months3 = []; var index2 = 0; for (var rowIndex = 0; rowIndex < ROW$2; rowIndex++) { months3[rowIndex] = []; for (var colIndex = 0; colIndex < COL$2; colIndex++) { current2.month(index2); var content = getMonthName(current2); months3[rowIndex][colIndex] = { value: index2, content, title: content }; index2++; } } return months3; } }, render: function render30() { var _this = this; var props2 = this.$props; var value24 = this.sValue; var today = getTodayTime(value24); var months3 = this.months(); var currentMonth = value24.month(); var prefixCls2 = props2.prefixCls, locale2 = props2.locale, contentRender = props2.contentRender, cellRender = props2.cellRender, disabledDate = props2.disabledDate; var monthsEls = months3.map(function(month, index2) { var tds = month.map(function(monthData) { var _classNameMap; var disabled = false; if (disabledDate) { var testValue = value24.clone(); testValue.month(monthData.value); disabled = disabledDate(testValue); } var classNameMap = (_classNameMap = {}, _defineProperty$12(_classNameMap, "".concat(prefixCls2, "-cell"), 1), _defineProperty$12(_classNameMap, "".concat(prefixCls2, "-cell-disabled"), disabled), _defineProperty$12(_classNameMap, "".concat(prefixCls2, "-selected-cell"), monthData.value === currentMonth), _defineProperty$12(_classNameMap, "".concat(prefixCls2, "-current-cell"), today.year() === value24.year() && monthData.value === today.month()), _classNameMap); var cellEl; if (cellRender) { var currentValue = value24.clone(); currentValue.month(monthData.value); cellEl = cellRender({ current: currentValue, locale: locale2 }); } else { var content; if (contentRender) { var _currentValue = value24.clone(); _currentValue.month(monthData.value); content = contentRender({ current: _currentValue, locale: locale2 }); } else { content = monthData.content; } cellEl = createVNode("a", { "class": "".concat(prefixCls2, "-month") }, [content]); } return createVNode("td", { "role": "gridcell", "key": monthData.value, "onClick": disabled ? noop$s : function() { return _this.chooseMonth(monthData.value); }, "title": monthData.title, "class": classNameMap }, [cellEl]); }); return createVNode("tr", { "key": index2, "role": "row" }, [tds]); }); return createVNode("table", { "class": "".concat(prefixCls2, "-table"), "cellspacing": "0", "role": "grid" }, [createVNode("tbody", { "class": "".concat(prefixCls2, "-tbody") }, [monthsEls])]); } }; var MonthTable$1 = MonthTable; function noop$r() { } function getNowByCurrentStateValue(value24) { var ret; if (value24) { ret = getTodayTime(value24); } else { ret = hooks(); } return ret; } function isMoment(value24) { if (Array.isArray(value24)) { return value24.length === 0 || value24.findIndex(function(val) { return val === void 0 || hooks.isMoment(val); }) !== -1; } else { return value24 === void 0 || hooks.isMoment(value24); } } var MomentType = PropsTypes.custom(isMoment); var CalendarMixin = { mixins: [BaseMixin], inheritAttrs: false, name: "CalendarMixinWrapper", props: { value: MomentType, defaultValue: MomentType }, data: function data12() { if (this.onKeyDown === void 0) { this.onKeyDown = noop$r; } if (this.onBlur === void 0) { this.onBlur = noop$r; } var props2 = this.$props; var sValue = props2.value || props2.defaultValue || getNowByCurrentStateValue(); return { sValue, sSelectedValue: props2.selectedValue || props2.defaultSelectedValue }; }, watch: { value: function value6(val) { var sValue = val || this.defaultValue || getNowByCurrentStateValue(this.sValue); this.setState({ sValue }); }, selectedValue: function selectedValue(val) { this.setState({ sSelectedValue: val }); } }, methods: { onSelect: function onSelect(value24, cause) { if (value24) { this.setValue(value24); } this.setSelectedValue(value24, cause); }, renderRoot: function renderRoot(newProps) { var _className; var props2 = _extends$1(_extends$1({}, this.$props), this.$attrs); var prefixCls2 = props2.prefixCls; var className = (_className = {}, _defineProperty$12(_className, prefixCls2, 1), _defineProperty$12(_className, "".concat(prefixCls2, "-hidden"), !props2.visible), _defineProperty$12(_className, props2.class, !!props2.class), _defineProperty$12(_className, newProps.class, !!newProps.class), _className); return createVNode("div", { "ref": this.saveRoot, "class": className, "tabindex": "0", "onKeydown": this.onKeyDown || noop$r, "onBlur": this.onBlur || noop$r }, [newProps.children]); }, setSelectedValue: function setSelectedValue(selectedValue5, cause) { if (!hasProp(this, "selectedValue")) { this.setState({ sSelectedValue: selectedValue5 }); } this.__emit("select", selectedValue5, cause); }, setValue: function setValue3(value24) { var originalValue = this.sValue; if (!hasProp(this, "value")) { this.setState({ sValue: value24 }); } if (originalValue && value24 && !originalValue.isSame(value24) || !originalValue && value24 || originalValue && !value24) { this.__emit("change", value24); } }, isAllowedDate: function isAllowedDate$1(value24) { var disabledDate = this.disabledDate; var disabledTime = this.disabledTime; return isAllowedDate(value24, disabledDate, disabledTime); } } }; var CalendarMixin$1 = CalendarMixin; var CommonMixin = { methods: { getFormat: function getFormat() { var format3 = this.format; var locale2 = this.locale, timePicker = this.timePicker; if (!format3) { if (timePicker) { format3 = locale2.dateTimeFormat; } else { format3 = locale2.dateFormat; } } return format3; }, focus: function focus6() { if (this.focusElement) { this.focusElement.focus(); } else if (this.rootInstance) { this.rootInstance.focus(); } }, saveFocusElement: function saveFocusElement(focusElement) { this.focusElement = focusElement; }, saveRoot: function saveRoot(root2) { this.rootInstance = root2; } } }; var __rest$s = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var Checkbox$1 = defineComponent({ name: "Checkbox", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$2({ prefixCls: PropsTypes.string, name: PropsTypes.string, id: PropsTypes.string, type: PropsTypes.string, defaultChecked: withUndefined(PropsTypes.oneOfType([PropsTypes.number, PropsTypes.looseBool])), checked: withUndefined(PropsTypes.oneOfType([PropsTypes.number, PropsTypes.looseBool])), disabled: PropsTypes.looseBool, tabindex: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), readonly: PropsTypes.looseBool, autofocus: PropsTypes.looseBool, value: PropsTypes.any }, { prefixCls: "rc-checkbox", type: "checkbox", defaultChecked: false }), data: function data13() { var checked2 = hasProp(this, "checked") ? this.checked : this.defaultChecked; return { sChecked: checked2 }; }, watch: { checked: function checked(val) { this.sChecked = val; } }, mounted: function mounted9() { nextTick(function() { }); }, methods: { focus: function focus7() { this.$refs.input.focus(); }, blur: function blur6() { this.$refs.input.blur(); }, handleChange: function handleChange4(e2) { var props2 = getOptionProps(this); if (props2.disabled) { return; } if (!("checked" in props2)) { this.sChecked = e2.target.checked; } e2.shiftKey = this.eventShiftKey; var eventObj = { target: _extends$1(_extends$1({}, props2), { checked: e2.target.checked }), stopPropagation: function stopPropagation2() { e2.stopPropagation(); }, preventDefault: function preventDefault2() { e2.preventDefault(); }, nativeEvent: e2 }; if ("checked" in props2) { this.$refs.input.checked = props2.checked; } this.__emit("change", eventObj); this.eventShiftKey = false; }, onClick: function onClick4(e2) { this.__emit("click", e2); this.eventShiftKey = e2.shiftKey; } }, render: function render31() { var _classNames; var _a3 = getOptionProps(this), prefixCls2 = _a3.prefixCls, name = _a3.name, id2 = _a3.id, type2 = _a3.type, disabled = _a3.disabled, readonly2 = _a3.readonly, tabindex = _a3.tabindex, autofocus = _a3.autofocus, value24 = _a3.value, others = __rest$s(_a3, ["prefixCls", "name", "id", "type", "disabled", "readonly", "tabindex", "autofocus", "value"]); var _this$$attrs = this.$attrs, className = _this$$attrs.class, onFocus5 = _this$$attrs.onFocus, onBlur6 = _this$$attrs.onBlur; var globalProps = Object.keys(_extends$1(_extends$1({}, others), this.$attrs)).reduce(function(prev2, key2) { if (key2.substr(0, 5) === "aria-" || key2.substr(0, 5) === "data-" || key2 === "role") { prev2[key2] = others[key2]; } return prev2; }, {}); var sChecked = this.sChecked; var classString = classNames(prefixCls2, className, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-checked"), sChecked), _defineProperty$12(_classNames, "".concat(prefixCls2, "-disabled"), disabled), _classNames)); var inputProps2 = _extends$1(_extends$1({ name, id: id2, type: type2, readonly: readonly2, disabled, tabindex, class: "".concat(prefixCls2, "-input"), checked: !!sChecked, autofocus, value: value24 }, globalProps), { onChange: this.handleChange, onClick: this.onClick, onFocus: onFocus5, onBlur: onBlur6 }); return createVNode("span", { "class": classString }, [createVNode("input", _objectSpread2$2({ "ref": "input" }, inputProps2), null), createVNode("span", { "class": "".concat(prefixCls2, "-inner") }, null)]); } }); var __rest$r = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var radioProps = { prefixCls: PropsTypes.string, defaultChecked: PropsTypes.looseBool, checked: PropsTypes.looseBool, disabled: PropsTypes.looseBool, isGroup: PropsTypes.looseBool, value: PropsTypes.any, name: PropsTypes.string, id: PropsTypes.string, autofocus: PropsTypes.looseBool, type: PropsTypes.string.def("radio"), onChange: PropsTypes.func, onFocus: PropsTypes.func, onBlur: PropsTypes.func }; var Radio = defineComponent({ name: "ARadio", props: radioProps, emits: ["update:checked", "update:value", "change", "blur", "focus"], setup: function setup51() { return { configProvider: inject("configProvider", defaultConfigProvider), radioGroupContext: inject("radioGroupContext", null) }; }, methods: { focus: function focus8() { this.$refs.vcCheckbox.focus(); }, blur: function blur7() { this.$refs.vcCheckbox.blur(); }, handleChange: function handleChange5(event) { var targetChecked = event.target.checked; this.$emit("update:checked", targetChecked); this.$emit("update:value", targetChecked); this.$emit("change", event); }, onChange2: function onChange2(e2) { this.$emit("change", e2); if (this.radioGroupContext && this.radioGroupContext.onRadioChange) { this.radioGroupContext.onRadioChange(e2); } } }, render: function render32() { var _classNames; var $slots = this.$slots, radioGroup = this.radioGroupContext; var props2 = getOptionProps(this); var customizePrefixCls = props2.prefixCls, restProps = __rest$r(props2, ["prefixCls"]); var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("radio", customizePrefixCls); var rProps = _extends$1({ prefixCls: prefixCls2 }, restProps); if (radioGroup) { rProps.name = radioGroup.name; rProps.onChange = this.onChange2; rProps.checked = props2.value === radioGroup.stateValue; rProps.disabled = props2.disabled || radioGroup.disabled; } else { rProps.onChange = this.handleChange; } var wrapperClassString = classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-wrapper"), true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-wrapper-checked"), rProps.checked), _defineProperty$12(_classNames, "".concat(prefixCls2, "-wrapper-disabled"), rProps.disabled), _classNames)); return createVNode("label", { "class": wrapperClassString }, [createVNode(Checkbox$1, _objectSpread2$2(_objectSpread2$2({}, rProps), {}, { "ref": "vcCheckbox" }), null), $slots.default && createVNode("span", null, [$slots.default()])]); } }); var Group$1 = defineComponent({ name: "ARadioGroup", props: { prefixCls: PropsTypes.string, defaultValue: PropsTypes.any, value: PropsTypes.any, size: PropsTypes.oneOf(tuple("large", "default", "small")).def("default"), options: PropsTypes.array, disabled: PropsTypes.looseBool, name: PropsTypes.string, buttonStyle: PropsTypes.string.def("outline"), onChange: PropsTypes.func }, emits: ["update:value", "change"], setup: function setup52() { return { updatingValue: false, configProvider: inject("configProvider", defaultConfigProvider), radioGroupContext: null }; }, data: function data14() { var value24 = this.value, defaultValue = this.defaultValue; return { stateValue: value24 === void 0 ? defaultValue : value24 }; }, watch: { value: function value7(val) { this.updatingValue = false; this.stateValue = val; } }, created: function created7() { this.radioGroupContext = provide("radioGroupContext", this); }, methods: { onRadioChange: function onRadioChange(ev) { var _this = this; var lastValue = this.stateValue; var value24 = ev.target.value; if (!hasProp(this, "value")) { this.stateValue = value24; } if (!this.updatingValue && value24 !== lastValue) { this.updatingValue = true; this.$emit("update:value", value24); this.$emit("change", ev); } nextTick(function() { _this.updatingValue = false; }); } }, render: function render33() { var _this2 = this; var props2 = getOptionProps(this); var customizePrefixCls = props2.prefixCls, options2 = props2.options, buttonStyle = props2.buttonStyle; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("radio", customizePrefixCls); var groupPrefixCls = "".concat(prefixCls2, "-group"); var classString = classNames(groupPrefixCls, "".concat(groupPrefixCls, "-").concat(buttonStyle), _defineProperty$12({}, "".concat(groupPrefixCls, "-").concat(props2.size), props2.size)); var children = filterEmpty(getSlot$1(this)); if (options2 && options2.length > 0) { children = options2.map(function(option) { if (typeof option === "string") { return createVNode(Radio, { "key": option, "prefixCls": prefixCls2, "disabled": props2.disabled, "value": option, "checked": _this2.stateValue === option }, { default: function _default8() { return [option]; } }); } return createVNode(Radio, { "key": "radio-group-value-options-".concat(option.value), "prefixCls": prefixCls2, "disabled": option.disabled || props2.disabled, "value": option.value, "checked": _this2.stateValue === option.value }, { default: function _default8() { return [option.label]; } }); }); } return createVNode("div", { "class": classString }, [children]); } }); var __rest$q = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var Button = defineComponent({ name: "ARadioButton", props: _extends$1({}, radioProps), setup: function setup53() { return { configProvider: inject("configProvider", defaultConfigProvider), radioGroupContext: inject("radioGroupContext", {}) }; }, render: function render34() { var _this = this; var props2 = getOptionProps(this); var customizePrefixCls = props2.prefixCls, otherProps = __rest$q(props2, ["prefixCls"]); var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("radio-button", customizePrefixCls); var rProps = _extends$1({ prefixCls: prefixCls2 }, otherProps); if (this.radioGroupContext) { rProps.onChange = this.radioGroupContext.onRadioChange; rProps.checked = props2.value === this.radioGroupContext.stateValue; rProps.disabled = props2.disabled || this.radioGroupContext.disabled; } return createVNode(Radio, rProps, { default: function _default8() { return [getSlot$1(_this)]; } }); } }); Radio.Group = Group$1; Radio.Button = Button; Radio.install = function(app) { app.component(Radio.name, Radio); app.component(Radio.Group.name, Radio.Group); app.component(Radio.Button.name, Radio.Button); return app; }; var TimeOrTimesType = { validator: function validator2(value24) { if (Array.isArray(value24)) { return value24.length === 0 || value24.findIndex(function(val) { return typeof val !== "string"; }) === -1 || value24.findIndex(function(val) { return !isNil(val) && !hooks.isMoment(val); }) === -1; } else { return typeof value24 === "string" || isNil(value24) || hooks.isMoment(value24); } } }; function checkValidate(componentName, value24, propName, valueFormat) { var values2 = Array.isArray(value24) ? value24 : [value24]; values2.forEach(function(val) { if (!val) return; valueFormat && warning$5(interopDefault(hooks)(val, valueFormat).isValid(), componentName, "When set `valueFormat`, `".concat(propName, "` should provides invalidate string time. ")); !valueFormat && warning$5(interopDefault(hooks).isMoment(val) && val.isValid(), componentName, "`".concat(propName, "` provides invalidate moment time. If you want to set empty value, use `null` instead.")); }); } var stringToMoment = function stringToMoment2(value24, valueFormat) { if (Array.isArray(value24)) { return value24.map(function(val) { return typeof val === "string" && val ? interopDefault(hooks)(val, valueFormat) : val || null; }); } else { return typeof value24 === "string" && value24 ? interopDefault(hooks)(value24, valueFormat) : value24 || null; } }; var momentToString = function momentToString2(value24, valueFormat) { if (Array.isArray(value24)) { return value24.map(function(val) { return interopDefault(hooks).isMoment(val) ? val.format(valueFormat) : val; }); } else { return interopDefault(hooks).isMoment(value24) ? value24.format(valueFormat) : value24; } }; var UpOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" } }] }, "name": "up", "theme": "outlined" }; var UpOutlinedSvg = UpOutlined$2; function _objectSpread$H(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$I(target, key2, source2[key2]); }); } return target; } function _defineProperty$I(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var UpOutlined = function UpOutlined2(props2, context2) { var p = _objectSpread$H({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$H({}, p, { "icon": UpOutlinedSvg }), null); }; UpOutlined.displayName = "UpOutlined"; UpOutlined.inheritAttrs = false; var UpOutlined$1 = UpOutlined; var LeftOutlined$4 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" } }] }, "name": "left", "theme": "outlined" }; var LeftOutlinedSvg = LeftOutlined$4; function _objectSpread$G(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$H(target, key2, source2[key2]); }); } return target; } function _defineProperty$H(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var LeftOutlined$2 = function LeftOutlined2(props2, context2) { var p = _objectSpread$G({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$G({}, p, { "icon": LeftOutlinedSvg }), null); }; LeftOutlined$2.displayName = "LeftOutlined"; LeftOutlined$2.inheritAttrs = false; var LeftOutlined$3 = LeftOutlined$2; var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; function getAugmentedNamespace(n2) { if (n2.__esModule) return n2; var a2 = Object.defineProperty({}, "__esModule", { value: true }); Object.keys(n2).forEach(function(k2) { var d2 = Object.getOwnPropertyDescriptor(n2, k2); Object.defineProperty(a2, k2, d2.get ? d2 : { enumerable: true, get: function() { return n2[k2]; } }); }); return a2; } var warning$3 = function() { }; var warning_1 = warning$3; function canUseDom() { return !!(typeof window !== "undefined" && window.document && window.document.createElement); } var canUseDocElement = function canUseDocElement2() { return canUseDom() && window.document.documentElement; }; var flexGapSupported; var detectFlexGapSupported = function detectFlexGapSupported2() { if (!canUseDocElement()) { return false; } if (flexGapSupported !== void 0) { return flexGapSupported; } var flex = document.createElement("div"); flex.style.display = "flex"; flex.style.flexDirection = "column"; flex.style.rowGap = "1px"; flex.appendChild(document.createElement("div")); flex.appendChild(document.createElement("div")); document.body.appendChild(flex); flexGapSupported = flex.scrollHeight === 1; document.body.removeChild(flex); return flexGapSupported; }; var useFlexGapSupport = function() { var flexible = ref(false); onMounted(function() { flexible.value = detectFlexGapSupported(); }); return flexible; }; var RowContextKey = Symbol("rowContextKey"); var useProvideRow = function useProvideRow2(state) { provide(RowContextKey, state); }; var useInjectRow = function useInjectRow2() { return inject(RowContextKey, { gutter: computed(function() { return void 0; }), wrap: computed(function() { return void 0; }), supportFlexGap: computed(function() { return void 0; }) }); }; var RowAligns = tuple("top", "middle", "bottom", "stretch"); var RowJustify = tuple("start", "end", "center", "space-around", "space-between"); var rowProps = { type: PropsTypes.oneOf(["flex"]), align: PropsTypes.oneOf(RowAligns), justify: PropsTypes.oneOf(RowJustify), prefixCls: PropsTypes.string, gutter: PropsTypes.oneOfType([PropsTypes.object, PropsTypes.number, PropsTypes.array]).def(0), wrap: PropsTypes.looseBool }; var ARow = defineComponent({ name: "ARow", props: rowProps, setup: function setup54(props2, _ref) { var slots = _ref.slots; var _useConfigInject = useConfigInject("row", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction; var token2; var screens2 = ref({ xs: true, sm: true, md: true, lg: true, xl: true, xxl: true }); var supportFlexGap = useFlexGapSupport(); onMounted(function() { token2 = ResponsiveObserve.subscribe(function(screen) { var currentGutter = props2.gutter || 0; if (!Array.isArray(currentGutter) && _typeof$2(currentGutter) === "object" || Array.isArray(currentGutter) && (_typeof$2(currentGutter[0]) === "object" || _typeof$2(currentGutter[1]) === "object")) { screens2.value = screen; } }); }); onBeforeUnmount(function() { ResponsiveObserve.unsubscribe(token2); }); var gutter = computed(function() { var results = [0, 0]; var _props$gutter = props2.gutter, gutter2 = _props$gutter === void 0 ? 0 : _props$gutter; var normalizedGutter = Array.isArray(gutter2) ? gutter2 : [gutter2, 0]; normalizedGutter.forEach(function(g2, index2) { if (_typeof$2(g2) === "object") { for (var i2 = 0; i2 < responsiveArray.length; i2++) { var breakpoint = responsiveArray[i2]; if (screens2.value[breakpoint] && g2[breakpoint] !== void 0) { results[index2] = g2[breakpoint]; break; } } } else { results[index2] = g2 || 0; } }); return results; }); useProvideRow({ gutter, supportFlexGap, wrap: computed(function() { return props2.wrap; }) }); var classes3 = computed(function() { var _classNames; return classNames(prefixCls2.value, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-no-wrap"), props2.wrap === false), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-").concat(props2.justify), props2.justify), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-").concat(props2.align), props2.align), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-rtl"), direction.value === "rtl"), _classNames)); }); var rowStyle = computed(function() { var gt = gutter.value; var style = {}; var horizontalGutter = gt[0] > 0 ? "".concat(gt[0] / -2, "px") : void 0; var verticalGutter = gt[1] > 0 ? "".concat(gt[1] / -2, "px") : void 0; if (horizontalGutter) { style.marginLeft = horizontalGutter; style.marginRight = horizontalGutter; } if (supportFlexGap.value) { style.rowGap = "".concat(gt[1], "px"); } else if (verticalGutter) { style.marginTop = verticalGutter; style.marginBottom = verticalGutter; } return style; }); return function() { var _a3; return createVNode("div", { "class": classes3.value, "style": rowStyle.value }, [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)]); }; } }); var Row$3 = ARow; function parseFlex(flex) { if (typeof flex === "number") { return "".concat(flex, " ").concat(flex, " auto"); } if (/^\d+(\.\d+)?(px|em|rem|%)$/.test(flex)) { return "0 0 ".concat(flex); } return flex; } var stringOrNumber = PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]); var colSize = PropsTypes.shape({ span: stringOrNumber, order: stringOrNumber, offset: stringOrNumber, push: stringOrNumber, pull: stringOrNumber }).loose; var objectOrNumber = PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number, colSize]); var colProps = { span: stringOrNumber, order: stringOrNumber, offset: stringOrNumber, push: stringOrNumber, pull: stringOrNumber, xs: objectOrNumber, sm: objectOrNumber, md: objectOrNumber, lg: objectOrNumber, xl: objectOrNumber, xxl: objectOrNumber, prefixCls: PropsTypes.string, flex: stringOrNumber }; var Col$1 = defineComponent({ name: "ACol", props: colProps, setup: function setup55(props2, _ref) { var slots = _ref.slots; var _useInjectRow = useInjectRow(), gutter = _useInjectRow.gutter, supportFlexGap = _useInjectRow.supportFlexGap, wrap = _useInjectRow.wrap; var _useConfigInject = useConfigInject("col", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction; var classes3 = computed(function() { var _classNames; var span = props2.span, order = props2.order, offset4 = props2.offset, push3 = props2.push, pull2 = props2.pull; var pre = prefixCls2.value; var sizeClassObj = {}; ["xs", "sm", "md", "lg", "xl", "xxl"].forEach(function(size) { var _extends2; var sizeProps = {}; var propSize = props2[size]; if (typeof propSize === "number") { sizeProps.span = propSize; } else if (_typeof$2(propSize) === "object") { sizeProps = propSize || {}; } sizeClassObj = _extends$1(_extends$1({}, sizeClassObj), (_extends2 = {}, _defineProperty$12(_extends2, "".concat(pre, "-").concat(size, "-").concat(sizeProps.span), sizeProps.span !== void 0), _defineProperty$12(_extends2, "".concat(pre, "-").concat(size, "-order-").concat(sizeProps.order), sizeProps.order || sizeProps.order === 0), _defineProperty$12(_extends2, "".concat(pre, "-").concat(size, "-offset-").concat(sizeProps.offset), sizeProps.offset || sizeProps.offset === 0), _defineProperty$12(_extends2, "".concat(pre, "-").concat(size, "-push-").concat(sizeProps.push), sizeProps.push || sizeProps.push === 0), _defineProperty$12(_extends2, "".concat(pre, "-").concat(size, "-pull-").concat(sizeProps.pull), sizeProps.pull || sizeProps.pull === 0), _defineProperty$12(_extends2, "".concat(pre, "-rtl"), direction.value === "rtl"), _extends2)); }); return classNames(pre, (_classNames = {}, _defineProperty$12(_classNames, "".concat(pre, "-").concat(span), span !== void 0), _defineProperty$12(_classNames, "".concat(pre, "-order-").concat(order), order), _defineProperty$12(_classNames, "".concat(pre, "-offset-").concat(offset4), offset4), _defineProperty$12(_classNames, "".concat(pre, "-push-").concat(push3), push3), _defineProperty$12(_classNames, "".concat(pre, "-pull-").concat(pull2), pull2), _classNames), sizeClassObj); }); var mergedStyle = computed(function() { var flex = props2.flex; var gutterVal = gutter.value; var style = {}; if (gutterVal && gutterVal[0] > 0) { var horizontalGutter = "".concat(gutterVal[0] / 2, "px"); style.paddingLeft = horizontalGutter; style.paddingRight = horizontalGutter; } if (gutterVal && gutterVal[1] > 0 && !supportFlexGap.value) { var verticalGutter = "".concat(gutterVal[1] / 2, "px"); style.paddingTop = verticalGutter; style.paddingBottom = verticalGutter; } if (flex) { style.flex = parseFlex(flex); if (flex === "auto" && wrap.value === false && !style.minWidth) { style.minWidth = 0; } } return style; }); return function() { var _a3; return createVNode("div", { "class": classes3.value, "style": mergedStyle.value }, [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)]); }; } }); var Row$2 = withInstall(Row$3); var Col = withInstall(Col$1); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props2) { for (var i2 = 0; i2 < props2.length; i2++) { var descriptor = props2[i2]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } var re = /\s+/; var ClassList = /* @__PURE__ */ function() { function ClassList2(el) { _classCallCheck(this, ClassList2); if (!el || !el.nodeType) { throw new Error("A DOM element reference is required"); } this.el = el; this.list = el.classList; } _createClass(ClassList2, [{ key: "array", value: function array3() { var className = this.el.getAttribute("class") || ""; var str = className.replace(/^\s+|\s+$/g, ""); var arr = str.split(re); if (arr[0] === "") arr.shift(); return arr; } }, { key: "add", value: function add3(name) { if (this.list) { this.list.add(name); return this; } var arr = this.array(); var i2 = indexOf$1(arr, name); if (!~i2) arr.push(name); this.el.className = arr.join(" "); return this; } }, { key: "remove", value: function remove3(name) { if (toString.call(name) === "[object RegExp]") { return this._removeMatching(name); } if (this.list) { this.list.remove(name); return this; } var arr = this.array(); var i2 = indexOf$1(arr, name); if (~i2) arr.splice(i2, 1); this.el.className = arr.join(" "); return this; } }, { key: "_removeMatching", value: function _removeMatching(re2) { var arr = this.array(); for (var i2 = 0; i2 < arr.length; i2++) { if (re2.test(arr[i2])) { this.remove(arr[i2]); } } return this; } }, { key: "toggle", value: function toggle(name, force) { if (this.list) { if (typeof force !== "undefined") { if (force !== this.list.toggle(name, force)) { this.list.toggle(name); } } else { this.list.toggle(name); } return this; } if (typeof force !== "undefined") { if (!force) { this.remove(name); } else { this.add(name); } } else { if (this.has(name)) { this.remove(name); } else { this.add(name); } } return this; } }, { key: "has", value: function has2(name) { return this.list ? this.list.contains(name) : !!~indexOf$1(this.array(), name); } }, { key: "contains", value: function contains2(name) { return this.has(name); } }]); return ClassList2; }(); function classes(el) { return new ClassList(el); } var isCssAnimationSupported = Event$1.endEvents.length !== 0; var capitalPrefixes = [ "Webkit", "Moz", "O", "ms" ]; var prefixes = ["-webkit-", "-moz-", "-o-", "ms-", ""]; function getStyleProperty(node, name) { var style = window.getComputedStyle(node, null); var ret = ""; for (var i2 = 0; i2 < prefixes.length; i2++) { ret = style.getPropertyValue(prefixes[i2] + name); if (ret) { break; } } return ret; } function fixBrowserByTimeout(node) { if (isCssAnimationSupported) { var transitionDelay = parseFloat(getStyleProperty(node, "transition-delay")) || 0; var transitionDuration = parseFloat(getStyleProperty(node, "transition-duration")) || 0; var animationDelay = parseFloat(getStyleProperty(node, "animation-delay")) || 0; var animationDuration = parseFloat(getStyleProperty(node, "animation-duration")) || 0; var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay); node.rcEndAnimTimeout = setTimeout(function() { node.rcEndAnimTimeout = null; if (node.rcEndListener) { node.rcEndListener(); } }, time * 1e3 + 200); } } function clearBrowserBugTimeout(node) { if (node.rcEndAnimTimeout) { clearTimeout(node.rcEndAnimTimeout); node.rcEndAnimTimeout = null; } } var cssAnimation = function cssAnimation2(node, transitionName2, endCallback) { var nameIsObj = _typeof$2(transitionName2) === "object"; var className = nameIsObj ? transitionName2.name : transitionName2; var activeClassName = nameIsObj ? transitionName2.active : "".concat(transitionName2, "-active"); var end = endCallback; var start; var active; var nodeClasses = classes(node); if (endCallback && Object.prototype.toString.call(endCallback) === "[object Object]") { end = endCallback.end; start = endCallback.start; active = endCallback.active; } if (node.rcEndListener) { node.rcEndListener(); } node.rcEndListener = function(e2) { if (e2 && e2.target !== node) { return; } if (node.rcAnimTimeout) { cancelAnimationTimeout(node.rcAnimTimeout); node.rcAnimTimeout = null; } clearBrowserBugTimeout(node); nodeClasses.remove(className); nodeClasses.remove(activeClassName); Event$1.removeEndEventListener(node, node.rcEndListener); node.rcEndListener = null; if (end) { end(); } }; Event$1.addEndEventListener(node, node.rcEndListener); if (start) { start(); } nodeClasses.add(className); node.rcAnimTimeout = requestAnimationTimeout(function() { node.rcAnimTimeout = null; nodeClasses.add(className); nodeClasses.add(activeClassName); if (active) { requestAnimationTimeout(active, 0); } fixBrowserByTimeout(node); }, 30); return { stop: function stop2() { if (node.rcEndListener) { node.rcEndListener(); } } }; }; cssAnimation.style = function(node, style, callback2) { if (node.rcEndListener) { node.rcEndListener(); } node.rcEndListener = function(e2) { if (e2 && e2.target !== node) { return; } if (node.rcAnimTimeout) { cancelAnimationTimeout(node.rcAnimTimeout); node.rcAnimTimeout = null; } clearBrowserBugTimeout(node); Event$1.removeEndEventListener(node, node.rcEndListener); node.rcEndListener = null; if (callback2) { callback2(); } }; Event$1.addEndEventListener(node, node.rcEndListener); node.rcAnimTimeout = requestAnimationTimeout(function() { for (var s2 in style) { if (style.hasOwnProperty(s2)) { node.style[s2] = style[s2]; } } node.rcAnimTimeout = null; fixBrowserByTimeout(node); }, 0); }; cssAnimation.setTransition = function(node, p, value24) { var property2 = p; var v2 = value24; if (value24 === void 0) { v2 = property2; property2 = ""; } property2 = property2 || ""; capitalPrefixes.forEach(function(prefix) { node.style["".concat(prefix, "Transition").concat(property2)] = v2; }); }; cssAnimation.isCssAnimationSupported = isCssAnimationSupported; var cssAnimation$1 = cssAnimation; function animate(node, show, done) { var height; var requestAnimationFrameId; var appearRequestAnimationFrameId; return cssAnimation$1(node, "ant-motion-collapse-legacy", { start: function start() { if (appearRequestAnimationFrameId) { cancelAnimationFrame(appearRequestAnimationFrameId); } if (!show) { node.style.height = "".concat(node.offsetHeight, "px"); node.style.opacity = "1"; } else { height = node.offsetHeight; if (height === 0) { appearRequestAnimationFrameId = requestAnimationFrame(function() { height = node.offsetHeight; node.style.height = "0px"; node.style.opacity = "0"; }); } else { node.style.height = "0px"; node.style.opacity = "0"; } } }, active: function active() { if (requestAnimationFrameId) { cancelAnimationFrame(requestAnimationFrameId); } requestAnimationFrameId = requestAnimationFrame(function() { node.style.height = "".concat(show ? height : 0, "px"); node.style.opacity = show ? "1" : "0"; }); }, end: function end() { if (appearRequestAnimationFrameId) { cancelAnimationFrame(appearRequestAnimationFrameId); } if (requestAnimationFrameId) { cancelAnimationFrame(requestAnimationFrameId); } node.style.height = ""; node.style.opacity = ""; done && done(); } }); } var animation = { onEnter: function onEnter(node, done) { nextTick(function() { animate(node, true, done); }); }, onLeave: function onLeave(node, done) { return animate(node, false, done); } }; var animation$1 = animation; var lib$1 = { exports: {} }; (function(module2, exports2) { (function(global2, factory) { module2.exports = factory(); })(commonjsGlobal, function() { function arrayTreeFilter2(data65, filterFn, options2) { options2 = options2 || {}; options2.childrenKeyName = options2.childrenKeyName || "children"; var children = data65 || []; var result = []; var level2 = 0; do { var foundItem = children.filter(function(item) { return filterFn(item, level2); })[0]; if (!foundItem) { break; } result.push(foundItem); children = foundItem[options2.childrenKeyName] || []; level2 += 1; } while (children.length > 0); return result; } return arrayTreeFilter2; }); })(lib$1); var arrayTreeFilter = lib$1.exports; var Menus = { name: "CascaderMenus", mixins: [BaseMixin], inheritAttrs: false, props: { value: PropsTypes.array.def([]), activeValue: PropsTypes.array.def([]), options: PropsTypes.array, prefixCls: PropsTypes.string.def("rc-cascader-menus"), expandTrigger: PropsTypes.string.def("click"), visible: PropsTypes.looseBool.def(false), dropdownMenuColumnStyle: PropsTypes.object, defaultFieldNames: PropsTypes.object, fieldNames: PropsTypes.object, expandIcon: PropsTypes.any, loadingIcon: PropsTypes.any }, data: function data15() { this.menuItems = {}; return {}; }, watch: { visible: function visible3(val) { var _this = this; if (val) { this.$nextTick(function() { _this.scrollActiveItemToView(); }); } } }, mounted: function mounted10() { var _this2 = this; this.$nextTick(function() { _this2.scrollActiveItemToView(); }); }, methods: { getFieldName: function getFieldName(name) { var _this$$props = this.$props, fieldNames = _this$$props.fieldNames, defaultFieldNames = _this$$props.defaultFieldNames; return fieldNames[name] || defaultFieldNames[name]; }, getOption: function getOption(option, menuIndex) { var _this3 = this; var prefixCls2 = this.prefixCls, expandTrigger = this.expandTrigger; var loadingIcon = getComponent(this, "loadingIcon"); var expandIcon = getComponent(this, "expandIcon"); var onSelect6 = function onSelect7(e2) { _this3.__emit("select", option, menuIndex, e2); }; var onItemDoubleClick = function onItemDoubleClick2(e2) { _this3.__emit("itemDoubleClick", option, menuIndex, e2); }; var key2 = option[this.getFieldName("value")]; var expandProps = { onClick: onSelect6, onDblclick: onItemDoubleClick }; var menuItemCls = "".concat(prefixCls2, "-menu-item"); var expandIconNode = null; var hasChildren = option[this.getFieldName("children")] && option[this.getFieldName("children")].length > 0; if (hasChildren || option.isLeaf === false) { menuItemCls += " ".concat(prefixCls2, "-menu-item-expand"); if (!option.loading) { expandIconNode = createVNode("span", { "class": "".concat(prefixCls2, "-menu-item-expand-icon") }, [expandIcon]); } } if (expandTrigger === "hover" && (hasChildren || option.isLeaf === false)) { expandProps = { onMouseenter: this.delayOnSelect.bind(this, onSelect6), onMouseleave: this.delayOnSelect.bind(this), onClick: onSelect6 }; } if (this.isActiveOption(option, menuIndex)) { menuItemCls += " ".concat(prefixCls2, "-menu-item-active"); expandProps.ref = this.saveMenuItem(menuIndex); } if (option.disabled) { menuItemCls += " ".concat(prefixCls2, "-menu-item-disabled"); } var loadingIconNode = null; if (option.loading) { menuItemCls += " ".concat(prefixCls2, "-menu-item-loading"); loadingIconNode = loadingIcon || null; } var title = ""; if (option.title) { title = option.title; } else if (typeof option[this.getFieldName("label")] === "string") { title = option[this.getFieldName("label")]; } return createVNode("li", _objectSpread2$2(_objectSpread2$2({ "key": Array.isArray(key2) ? key2.join("__ant__") : key2, "class": menuItemCls, "title": title }, expandProps), {}, { "role": "menuitem", "onMousedown": function onMousedown2(e2) { return e2.preventDefault(); } }), [option[this.getFieldName("label")], expandIconNode, loadingIconNode]); }, getActiveOptions: function getActiveOptions(values2) { var _this4 = this; var activeValue = values2 || this.activeValue; var options2 = this.options; return arrayTreeFilter(options2, function(o2, level2) { return isEqual$1(o2[_this4.getFieldName("value")], activeValue[level2]); }, { childrenKeyName: this.getFieldName("children") }); }, getShowOptions: function getShowOptions() { var _this5 = this; var options2 = this.options; var result = this.getActiveOptions().map(function(activeOption) { return activeOption[_this5.getFieldName("children")]; }).filter(function(activeOption) { return !!activeOption; }); result.unshift(options2); return result; }, delayOnSelect: function delayOnSelect(onSelect6) { var _this6 = this; for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } if (this.delayTimer) { clearTimeout(this.delayTimer); this.delayTimer = null; } if (typeof onSelect6 === "function") { this.delayTimer = setTimeout(function() { onSelect6(args); _this6.delayTimer = null; }, 150); } }, scrollActiveItemToView: function scrollActiveItemToView() { var optionsLength = this.getShowOptions().length; for (var i2 = 0; i2 < optionsLength; i2++) { var itemComponent = this.menuItems[i2]; if (itemComponent) { var target = findDOMNode(itemComponent); target.parentNode.scrollTop = target.offsetTop; } } }, isActiveOption: function isActiveOption(option, menuIndex) { var _this$activeValue = this.activeValue, activeValue = _this$activeValue === void 0 ? [] : _this$activeValue; return isEqual$1(activeValue[menuIndex], option[this.getFieldName("value")]); }, saveMenuItem: function saveMenuItem(index2) { var _this7 = this; return function(node) { _this7.menuItems[index2] = node; }; } }, render: function render35() { var _this8 = this; var prefixCls2 = this.prefixCls, dropdownMenuColumnStyle = this.dropdownMenuColumnStyle; return createVNode("div", null, [this.getShowOptions().map(function(options2, menuIndex) { return createVNode("ul", { "class": "".concat(prefixCls2, "-menu"), "key": menuIndex, "style": dropdownMenuColumnStyle }, [options2.map(function(option) { return _this8.getOption(option, menuIndex); })]); })]); } }; function shallowEqualArrays(arrA, arrB) { if (arrA === arrB) { return true; } if (!arrA || !arrB) { return false; } var len = arrA.length; if (arrB.length !== len) { return false; } for (var i2 = 0; i2 < len; i2++) { if (arrA[i2] !== arrB[i2]) { return false; } } return true; } var arrays = shallowEqualArrays; var shallowEqualArrays$1 = arrays; var __rest$p = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var BUILT_IN_PLACEMENTS$1 = { bottomLeft: { points: ["tl", "bl"], offset: [0, 4], overflow: { adjustX: 1, adjustY: 1 } }, topLeft: { points: ["bl", "tl"], offset: [0, -4], overflow: { adjustX: 1, adjustY: 1 } }, bottomRight: { points: ["tr", "br"], offset: [0, 4], overflow: { adjustX: 1, adjustY: 1 } }, topRight: { points: ["br", "tr"], offset: [0, -4], overflow: { adjustX: 1, adjustY: 1 } } }; var Cascader$2 = defineComponent({ name: "Cascader", mixins: [BaseMixin], inheritAttrs: false, props: { value: PropsTypes.array, defaultValue: PropsTypes.array, options: PropsTypes.array, popupVisible: PropsTypes.looseBool, disabled: PropsTypes.looseBool.def(false), transitionName: PropsTypes.string.def(""), popupClassName: PropsTypes.string.def(""), popupStyle: PropsTypes.object.def(function() { return {}; }), popupPlacement: PropsTypes.string.def("bottomLeft"), prefixCls: PropsTypes.string.def("rc-cascader"), dropdownMenuColumnStyle: PropsTypes.object, builtinPlacements: PropsTypes.object.def(BUILT_IN_PLACEMENTS$1), loadData: PropsTypes.func, changeOnSelect: PropsTypes.looseBool, expandTrigger: PropsTypes.string.def("click"), fieldNames: PropsTypes.object.def(function() { return { label: "label", value: "value", children: "children" }; }), expandIcon: PropsTypes.any, loadingIcon: PropsTypes.any, getPopupContainer: PropsTypes.func }, data: function data16() { var initialValue = []; var value24 = this.value, defaultValue = this.defaultValue, popupVisible4 = this.popupVisible; if (hasProp(this, "value")) { initialValue = value24 || []; } else if (hasProp(this, "defaultValue")) { initialValue = defaultValue || []; } this.children = void 0; this.defaultFieldNames = { label: "label", value: "value", children: "children" }; return { sPopupVisible: popupVisible4, sActiveValue: initialValue, sValue: initialValue }; }, watch: { value: function value8(val, oldValue) { if (!shallowEqualArrays$1(val, oldValue)) { var newValues = { sValue: val || [] }; if (!hasProp(this, "loadData")) { newValues.sActiveValue = val || []; } this.setState(newValues); } }, popupVisible: function popupVisible2(val) { this.setState({ sPopupVisible: val }); } }, methods: { getPopupDOMNode: function getPopupDOMNode() { return this.trigger.getPopupDomNode(); }, getFieldName: function getFieldName2(name) { var defaultFieldNames = this.defaultFieldNames, fieldNames = this.fieldNames; return fieldNames[name] || defaultFieldNames[name]; }, getFieldNames: function getFieldNames() { return this.fieldNames; }, getCurrentLevelOptions: function getCurrentLevelOptions() { var _this = this; var _this$options = this.options, options2 = _this$options === void 0 ? [] : _this$options, _this$sActiveValue = this.sActiveValue, sActiveValue = _this$sActiveValue === void 0 ? [] : _this$sActiveValue; var result = arrayTreeFilter(options2, function(o2, level2) { return isEqual$1(o2[_this.getFieldName("value")], sActiveValue[level2]); }, { childrenKeyName: this.getFieldName("children") }); if (result[result.length - 2]) { return result[result.length - 2][this.getFieldName("children")]; } return _toConsumableArray(options2).filter(function(o2) { return !o2.disabled; }); }, getActiveOptions: function getActiveOptions2(activeValue) { var _this2 = this; return arrayTreeFilter(this.options || [], function(o2, level2) { return isEqual$1(o2[_this2.getFieldName("value")], activeValue[level2]); }, { childrenKeyName: this.getFieldName("children") }); }, setPopupVisible: function setPopupVisible2(popupVisible4) { if (!hasProp(this, "popupVisible")) { this.setState({ sPopupVisible: popupVisible4 }); } if (popupVisible4 && !this.sPopupVisible) { this.setState({ sActiveValue: this.sValue }); } this.__emit("popupVisibleChange", popupVisible4); }, handleChange: function handleChange6(options2, setProps, e2) { var _this3 = this; if (e2.type !== "keydown" || e2.keyCode === KeyCode$1.ENTER) { var value24 = options2.map(function(o2) { return o2[_this3.getFieldName("value")]; }); this.__emit("change", value24, options2); this.setPopupVisible(setProps.visible); } }, handlePopupVisibleChange: function handlePopupVisibleChange(popupVisible4) { this.setPopupVisible(popupVisible4); }, handleMenuSelect: function handleMenuSelect(targetOption, menuIndex, e2) { var triggerNode = this.trigger.getRootDomNode(); if (triggerNode && triggerNode.focus) { triggerNode.focus(); } var changeOnSelect = this.changeOnSelect, loadData = this.loadData, expandTrigger = this.expandTrigger; if (!targetOption || targetOption.disabled) { return; } var sActiveValue = this.sActiveValue; sActiveValue = sActiveValue.slice(0, menuIndex + 1); sActiveValue[menuIndex] = targetOption[this.getFieldName("value")]; var activeOptions = this.getActiveOptions(sActiveValue); if (targetOption.isLeaf === false && !targetOption[this.getFieldName("children")] && loadData) { if (changeOnSelect) { this.handleChange(activeOptions, { visible: true }, e2); } this.setState({ sActiveValue }); loadData(activeOptions); return; } var newState = {}; if (!targetOption[this.getFieldName("children")] || !targetOption[this.getFieldName("children")].length) { this.handleChange(activeOptions, { visible: false }, e2); newState.sValue = sActiveValue; } else if (changeOnSelect && (e2.type === "click" || e2.type === "keydown")) { if (expandTrigger === "hover") { this.handleChange(activeOptions, { visible: false }, e2); } else { this.handleChange(activeOptions, { visible: true }, e2); } newState.sValue = sActiveValue; } newState.sActiveValue = sActiveValue; if (hasProp(this, "value") || e2.type === "keydown" && e2.keyCode !== KeyCode$1.ENTER) { delete newState.sValue; } this.setState(newState); }, handleItemDoubleClick: function handleItemDoubleClick() { var changeOnSelect = this.$props.changeOnSelect; if (changeOnSelect) { this.setPopupVisible(false); } }, handleKeyDown: function handleKeyDown3(e2) { var _this4 = this; var children = this.children; if (children) { var keydown = getEvents(children).onKeydown; if (keydown) { keydown(e2); return; } } var activeValue = _toConsumableArray(this.sActiveValue); var currentLevel = activeValue.length - 1 < 0 ? 0 : activeValue.length - 1; var currentOptions = this.getCurrentLevelOptions(); var currentIndex = currentOptions.map(function(o2) { return o2[_this4.getFieldName("value")]; }).findIndex(function(val) { return isEqual$1(activeValue[currentLevel], val); }); if (e2.keyCode !== KeyCode$1.DOWN && e2.keyCode !== KeyCode$1.UP && e2.keyCode !== KeyCode$1.LEFT && e2.keyCode !== KeyCode$1.RIGHT && e2.keyCode !== KeyCode$1.ENTER && e2.keyCode !== KeyCode$1.SPACE && e2.keyCode !== KeyCode$1.BACKSPACE && e2.keyCode !== KeyCode$1.ESC && e2.keyCode !== KeyCode$1.TAB) { return; } if (!this.sPopupVisible && e2.keyCode !== KeyCode$1.BACKSPACE && e2.keyCode !== KeyCode$1.LEFT && e2.keyCode !== KeyCode$1.RIGHT && e2.keyCode !== KeyCode$1.ESC && e2.keyCode !== KeyCode$1.TAB) { this.setPopupVisible(true); return; } if (e2.keyCode === KeyCode$1.DOWN || e2.keyCode === KeyCode$1.UP) { e2.preventDefault(); var nextIndex = currentIndex; if (nextIndex !== -1) { if (e2.keyCode === KeyCode$1.DOWN) { nextIndex += 1; nextIndex = nextIndex >= currentOptions.length ? 0 : nextIndex; } else { nextIndex -= 1; nextIndex = nextIndex < 0 ? currentOptions.length - 1 : nextIndex; } } else { nextIndex = 0; } activeValue[currentLevel] = currentOptions[nextIndex][this.getFieldName("value")]; } else if (e2.keyCode === KeyCode$1.LEFT || e2.keyCode === KeyCode$1.BACKSPACE) { e2.preventDefault(); activeValue.splice(activeValue.length - 1, 1); } else if (e2.keyCode === KeyCode$1.RIGHT) { e2.preventDefault(); if (currentOptions[currentIndex] && currentOptions[currentIndex][this.getFieldName("children")]) { activeValue.push(currentOptions[currentIndex][this.getFieldName("children")][0][this.getFieldName("value")]); } } else if (e2.keyCode === KeyCode$1.ESC || e2.keyCode === KeyCode$1.TAB) { this.setPopupVisible(false); return; } if (!activeValue || activeValue.length === 0) { this.setPopupVisible(false); } var activeOptions = this.getActiveOptions(activeValue); var targetOption = activeOptions[activeOptions.length - 1]; this.handleMenuSelect(targetOption, activeOptions.length - 1, e2); this.__emit("keydown", e2); }, saveTrigger: function saveTrigger2(node) { this.trigger = node; } }, render: function render36() { var $props = this.$props, sActiveValue = this.sActiveValue, handleMenuSelect2 = this.handleMenuSelect, sPopupVisible = this.sPopupVisible, handlePopupVisibleChange3 = this.handlePopupVisibleChange, handleKeyDown7 = this.handleKeyDown; var prefixCls2 = $props.prefixCls, transitionName2 = $props.transitionName, popupClassName = $props.popupClassName, _$props$options = $props.options, options2 = _$props$options === void 0 ? [] : _$props$options, disabled = $props.disabled, builtinPlacements = $props.builtinPlacements, popupPlacement = $props.popupPlacement, restProps = __rest$p($props, ["prefixCls", "transitionName", "popupClassName", "options", "disabled", "builtinPlacements", "popupPlacement"]); var menus = createVNode("div", null, null); var emptyMenuClassName = ""; if (options2 && options2.length > 0) { var loadingIcon = getComponent(this, "loadingIcon"); var expandIcon = getComponent(this, "expandIcon") || ">"; var menusProps = _extends$1(_extends$1(_extends$1({}, $props), this.$attrs), { fieldNames: this.getFieldNames(), defaultFieldNames: this.defaultFieldNames, activeValue: sActiveValue, visible: sPopupVisible, loadingIcon, expandIcon, onSelect: handleMenuSelect2, onItemDoubleClick: this.handleItemDoubleClick }); menus = createVNode(Menus, menusProps, null); } else { emptyMenuClassName = " ".concat(prefixCls2, "-menus-empty"); } var triggerProps = _extends$1(_extends$1(_extends$1({}, restProps), this.$attrs), { disabled, popupPlacement, builtinPlacements, popupTransitionName: transitionName2, action: disabled ? [] : ["click"], popupVisible: disabled ? false : sPopupVisible, prefixCls: "".concat(prefixCls2, "-menus"), popupClassName: popupClassName + emptyMenuClassName, popup: menus, onPopupVisibleChange: handlePopupVisibleChange3, ref: this.saveTrigger }); var children = getSlot$1(this); this.children = children; return createVNode(Trigger, triggerProps, { default: function _default8() { return [children && cloneElement(children[0], { onKeydown: handleKeyDown7, tabindex: disabled ? void 0 : 0 })]; } }); } }); var RedoOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z" } }] }, "name": "redo", "theme": "outlined" }; var RedoOutlinedSvg = RedoOutlined$2; function _objectSpread$F(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$G(target, key2, source2[key2]); }); } return target; } function _defineProperty$G(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var RedoOutlined = function RedoOutlined2(props2, context2) { var p = _objectSpread$F({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$F({}, p, { "icon": RedoOutlinedSvg }), null); }; RedoOutlined.displayName = "RedoOutlined"; RedoOutlined.inheritAttrs = false; var RedoOutlined$1 = RedoOutlined; var __rest$o = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; function noop$q() { } var cascaderProps = { options: { type: Array, default: [] }, defaultValue: PropsTypes.array, value: PropsTypes.array, displayRender: PropsTypes.func, transitionName: PropsTypes.string.def("slide-up"), popupStyle: PropsTypes.object.def(function() { return {}; }), popupClassName: PropsTypes.string, popupPlacement: PropsTypes.oneOf(tuple("bottomLeft", "bottomRight", "topLeft", "topRight")).def("bottomLeft"), placeholder: PropsTypes.string.def("Please select"), size: PropsTypes.oneOf(tuple("large", "default", "small")), disabled: PropsTypes.looseBool.def(false), allowClear: PropsTypes.looseBool.def(true), showSearch: { type: [Boolean, Object], default: void 0 }, notFoundContent: PropsTypes.VNodeChild, loadData: PropsTypes.func, expandTrigger: PropsTypes.oneOf(tuple("click", "hover")), changeOnSelect: PropsTypes.looseBool, prefixCls: PropsTypes.string, inputPrefixCls: PropsTypes.string, getPopupContainer: PropsTypes.func, popupVisible: PropsTypes.looseBool, fieldNames: { type: Object }, autofocus: PropsTypes.looseBool, suffixIcon: PropsTypes.VNodeChild, showSearchRender: PropsTypes.any, onChange: PropsTypes.func, onPopupVisibleChange: PropsTypes.func, onFocus: PropsTypes.func, onBlur: PropsTypes.func, onSearch: PropsTypes.func, "onUpdate:value": PropsTypes.func }; var defaultLimit = 50; function defaultFilterOption(inputValue, path2, names2) { return path2.some(function(option) { return option[names2.label].indexOf(inputValue) > -1; }); } function defaultSortFilteredOption(a2, b2, inputValue, names2) { function callback2(elem) { return elem[names2.label].indexOf(inputValue) > -1; } return a2.findIndex(callback2) - b2.findIndex(callback2); } function getFilledFieldNames(props2) { var fieldNames = props2.fieldNames || {}; var names2 = { children: fieldNames.children || "children", label: fieldNames.label || "label", value: fieldNames.value || "value" }; return names2; } function flattenTree(options2, props2) { var ancestor = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : []; var names2 = getFilledFieldNames(props2); var flattenOptions2 = []; var childrenName = names2.children; options2.forEach(function(option) { var path2 = ancestor.concat(option); if (props2.changeOnSelect || !option[childrenName] || !option[childrenName].length) { flattenOptions2.push(path2); } if (option[childrenName]) { flattenOptions2 = flattenOptions2.concat(flattenTree(option[childrenName], props2, path2)); } }); return flattenOptions2; } var defaultDisplayRender = function defaultDisplayRender2(_ref) { var labels = _ref.labels; return labels.join(" / "); }; var Cascader = defineComponent({ name: "ACascader", mixins: [BaseMixin], inheritAttrs: false, props: cascaderProps, setup: function setup56() { return { configProvider: inject("configProvider", defaultConfigProvider), localeData: inject("localeData", {}), cachedOptions: [], popupRef: void 0, input: void 0 }; }, data: function data17() { var _this$$props = this.$props, value24 = _this$$props.value, defaultValue = _this$$props.defaultValue, popupVisible4 = _this$$props.popupVisible, showSearch = _this$$props.showSearch, options2 = _this$$props.options; return { sValue: value24 || defaultValue || [], inputValue: "", inputFocused: false, sPopupVisible: popupVisible4, flattenOptions: showSearch ? flattenTree(options2, this.$props) : void 0 }; }, watch: { value: function value9(val) { this.setState({ sValue: val || [] }); }, popupVisible: function popupVisible3(val) { this.setState({ sPopupVisible: val }); }, options: function options(val) { if (this.showSearch) { this.setState({ flattenOptions: flattenTree(val, this.$props) }); } } }, created: function created8() { provide("savePopupRef", this.savePopupRef); }, methods: { savePopupRef: function savePopupRef4(ref2) { this.popupRef = ref2; }, highlightKeyword: function highlightKeyword(str, keyword, prefixCls2) { return str.split(keyword).map(function(node, index2) { return index2 === 0 ? node : [createVNode("span", { "class": "".concat(prefixCls2, "-menu-item-keyword") }, [keyword]), node]; }); }, defaultRenderFilteredOption: function defaultRenderFilteredOption(opt) { var _this = this; var inputValue = opt.inputValue, path2 = opt.path, prefixCls2 = opt.prefixCls, names2 = opt.names; return path2.map(function(option, index2) { var label = option[names2.label]; var node = label.indexOf(inputValue) > -1 ? _this.highlightKeyword(label, inputValue, prefixCls2) : label; return index2 === 0 ? node : [" / ", node]; }); }, saveInput: function saveInput4(node) { this.input = node; }, handleChange: function handleChange7(value24, selectedOptions) { this.setState({ inputValue: "" }); if (selectedOptions[0].__IS_FILTERED_OPTION) { var unwrappedValue = value24[0]; var unwrappedSelectedOptions = selectedOptions[0].path; this.setValue(unwrappedValue, unwrappedSelectedOptions); return; } this.setValue(value24, selectedOptions); }, handlePopupVisibleChange: function handlePopupVisibleChange2(popupVisible4) { if (!hasProp(this, "popupVisible")) { this.setState(function(state) { return { sPopupVisible: popupVisible4, inputFocused: popupVisible4, inputValue: popupVisible4 ? state.inputValue : "" }; }); } this.$emit("popupVisibleChange", popupVisible4); }, handleInputFocus: function handleInputFocus2(e2) { this.$emit("focus", e2); }, handleInputBlur: function handleInputBlur2(e2) { this.setState({ inputFocused: false }); this.$emit("blur", e2); }, handleInputClick: function handleInputClick(e2) { var inputFocused = this.inputFocused, sPopupVisible = this.sPopupVisible; if (inputFocused || sPopupVisible) { e2.stopPropagation(); if (e2.nativeEvent && e2.nativeEvent.stopImmediatePropagation) { e2.nativeEvent.stopImmediatePropagation(); } } }, handleKeyDown: function handleKeyDown4(e2) { if (e2.keyCode === KeyCode$1.BACKSPACE || e2.keyCode === KeyCode$1.SPACE) { e2.stopPropagation(); } }, handleInputChange: function handleInputChange(e2) { var inputValue = e2.target.value; this.setState({ inputValue }); this.$emit("search", inputValue); }, setValue: function setValue4(value24) { var selectedOptions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; if (!hasProp(this, "value")) { this.setState({ sValue: value24 }); } this.$emit("update:value", value24); this.$emit("change", value24, selectedOptions); }, getLabel: function getLabel2() { var options2 = this.options; var names2 = getFilledFieldNames(this.$props); var displayRender = getComponent(this, "displayRender", {}, false) || defaultDisplayRender; var value24 = this.sValue; var unwrappedValue = Array.isArray(value24[0]) ? value24[0] : value24; var selectedOptions = arrayTreeFilter(options2, function(o2, level2) { return o2[names2.value] === unwrappedValue[level2]; }, { childrenKeyName: names2.children }); var labels = selectedOptions.map(function(o2) { return o2[names2.label]; }); return displayRender({ labels, selectedOptions }); }, clearSelection: function clearSelection(e2) { e2.preventDefault(); e2.stopPropagation(); if (!this.inputValue) { this.setValue([]); this.handlePopupVisibleChange(false); } else { this.setState({ inputValue: "" }); } }, generateFilteredOptions: function generateFilteredOptions(prefixCls2, renderEmpty2) { var _ref3; var showSearch = this.showSearch, notFoundContent = this.notFoundContent; var names2 = getFilledFieldNames(this.$props); var _showSearch$filter = showSearch.filter, filter = _showSearch$filter === void 0 ? defaultFilterOption : _showSearch$filter, _showSearch$sort = showSearch.sort, sort = _showSearch$sort === void 0 ? defaultSortFilteredOption : _showSearch$sort, _showSearch$limit = showSearch.limit, limit = _showSearch$limit === void 0 ? defaultLimit : _showSearch$limit; var render123 = showSearch.render || getComponent(this, "showSearchRender") || this.defaultRenderFilteredOption; var _this$$data = this.$data, _this$$data$flattenOp = _this$$data.flattenOptions, flattenOptions2 = _this$$data$flattenOp === void 0 ? [] : _this$$data$flattenOp, inputValue = _this$$data.inputValue; var filtered; if (limit > 0) { filtered = []; var matchCount = 0; flattenOptions2.some(function(path2) { var match5 = filter(inputValue, path2, names2); if (match5) { filtered.push(path2); matchCount += 1; } return matchCount >= limit; }); } else { warning$5(typeof limit !== "number", "Cascader", "'limit' of showSearch in Cascader should be positive number or false."); filtered = flattenOptions2.filter(function(path2) { return filter(inputValue, path2, names2); }); } filtered.sort(function(a2, b2) { return sort(a2, b2, inputValue, names2); }); if (filtered.length > 0) { return filtered.map(function(path2) { var _ref2; return _ref2 = { __IS_FILTERED_OPTION: true, path: path2 }, _defineProperty$12(_ref2, names2.label, render123({ inputValue, path: path2, prefixCls: prefixCls2, names: names2 })), _defineProperty$12(_ref2, names2.value, path2.map(function(o2) { return o2[names2.value]; })), _defineProperty$12(_ref2, "disabled", path2.some(function(o2) { return !!o2.disabled; })), _ref2; }); } return [(_ref3 = {}, _defineProperty$12(_ref3, names2.label, notFoundContent || renderEmpty2("Cascader")), _defineProperty$12(_ref3, names2.value, "ANT_CASCADER_NOT_FOUND"), _defineProperty$12(_ref3, "disabled", true), _ref3)]; }, focus: function focus9() { this.input && this.input.focus(); }, blur: function blur8() { this.input && this.input.blur(); } }, render: function render37() { var _classNames, _classNames2, _classNames3; var sPopupVisible = this.sPopupVisible, inputValue = this.inputValue, configProvider = this.configProvider, localeData2 = this.localeData; var _this$$data2 = this.$data, value24 = _this$$data2.sValue, inputFocused = _this$$data2.inputFocused; var props2 = getOptionProps(this); var suffixIcon = getComponent(this, "suffixIcon"); suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon; var getContextPopupContainer = configProvider.getPopupContainer; var _a3 = props2, customizePrefixCls = _a3.prefixCls, customizeInputPrefixCls = _a3.inputPrefixCls, _a$placeholder = _a3.placeholder, placeholder = _a$placeholder === void 0 ? localeData2.placeholder : _a$placeholder, size = _a3.size, disabled = _a3.disabled, allowClear = _a3.allowClear, _a$showSearch = _a3.showSearch, showSearch = _a$showSearch === void 0 ? false : _a$showSearch, notFoundContent = _a3.notFoundContent, otherProps = __rest$o(_a3, ["prefixCls", "inputPrefixCls", "placeholder", "size", "disabled", "allowClear", "showSearch", "notFoundContent"]); var _splitAttrs = splitAttrs(this.$attrs), onEvents = _splitAttrs.onEvents, extraAttrs = _splitAttrs.extraAttrs; var className = extraAttrs.class, style = extraAttrs.style, restAttrs = __rest$o(extraAttrs, ["class", "style"]); var getPrefixCls2 = this.configProvider.getPrefixCls; var renderEmpty2 = this.configProvider.renderEmpty; var prefixCls2 = getPrefixCls2("cascader", customizePrefixCls); var inputPrefixCls = getPrefixCls2("input", customizeInputPrefixCls); var sizeCls = classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(inputPrefixCls, "-lg"), size === "large"), _defineProperty$12(_classNames, "".concat(inputPrefixCls, "-sm"), size === "small"), _classNames)); var clearIcon = allowClear && !disabled && value24.length > 0 || inputValue ? createVNode(CloseCircleFilled$3, { "class": "".concat(prefixCls2, "-picker-clear"), "onClick": this.clearSelection, "key": "clear-icon" }, null) : null; var arrowCls = classNames((_classNames2 = {}, _defineProperty$12(_classNames2, "".concat(prefixCls2, "-picker-arrow"), true), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-picker-arrow-expand"), sPopupVisible), _classNames2)); var pickerCls = classNames(className, "".concat(prefixCls2, "-picker"), (_classNames3 = {}, _defineProperty$12(_classNames3, "".concat(prefixCls2, "-picker-with-value"), inputValue), _defineProperty$12(_classNames3, "".concat(prefixCls2, "-picker-disabled"), disabled), _defineProperty$12(_classNames3, "".concat(prefixCls2, "-picker-").concat(size), !!size), _defineProperty$12(_classNames3, "".concat(prefixCls2, "-picker-show-search"), !!showSearch), _defineProperty$12(_classNames3, "".concat(prefixCls2, "-picker-focused"), inputFocused), _classNames3)); var tempInputProps = omit(otherProps, ["popupStyle", "options", "popupPlacement", "transitionName", "displayRender", "changeOnSelect", "expandTrigger", "popupVisible", "getPopupContainer", "loadData", "popupClassName", "filterOption", "renderFilteredOption", "sortFilteredOption", "notFoundContent", "defaultValue", "fieldNames", "onChange", "onPopupVisibleChange", "onFocus", "onBlur", "onSearch", "onUpdate:value"]); var options2 = props2.options; var names2 = getFilledFieldNames(this.$props); if (options2 && options2.length > 0) { if (inputValue) { options2 = this.generateFilteredOptions(prefixCls2, renderEmpty2); } } else { var _ref4; options2 = [(_ref4 = {}, _defineProperty$12(_ref4, names2.label, notFoundContent || renderEmpty2("Cascader")), _defineProperty$12(_ref4, names2.value, "ANT_CASCADER_NOT_FOUND"), _defineProperty$12(_ref4, "disabled", true), _ref4)]; } if (!sPopupVisible) { options2 = this.cachedOptions; } else { this.cachedOptions = options2; } var dropdownMenuColumnStyle = {}; var isNotFound = (options2 || []).length === 1 && options2[0].value === "ANT_CASCADER_NOT_FOUND"; if (isNotFound) { dropdownMenuColumnStyle.height = "auto"; } var resultListMatchInputWidth = showSearch.matchInputWidth !== false; if (resultListMatchInputWidth && (inputValue || isNotFound) && this.input) { dropdownMenuColumnStyle.width = findDOMNode(this.input.input).offsetWidth + "px"; } var inputProps2 = _extends$1(_extends$1(_extends$1({}, restAttrs), tempInputProps), { prefixCls: inputPrefixCls, placeholder: value24 && value24.length > 0 ? void 0 : placeholder, value: inputValue, disabled, readonly: !showSearch, autocomplete: "off", class: "".concat(prefixCls2, "-input ").concat(sizeCls), onFocus: this.handleInputFocus, onClick: showSearch ? this.handleInputClick : noop$q, onBlur: showSearch ? this.handleInputBlur : props2.onBlur, onKeydown: this.handleKeyDown, onChange: showSearch ? this.handleInputChange : noop$q }); var children = getSlot$1(this); var inputIcon = suffixIcon && (isValidElement(suffixIcon) ? cloneElement(suffixIcon, { class: "".concat(prefixCls2, "-picker-arrow") }) : createVNode("span", { "class": "".concat(prefixCls2, "-picker-arrow") }, [suffixIcon])) || createVNode(DownOutlined$1, { "class": arrowCls }, null); var input = children.length ? children : createVNode("span", { "class": pickerCls, "style": style }, [createVNode("span", { "class": "".concat(prefixCls2, "-picker-label") }, [this.getLabel()]), createVNode(Input, _objectSpread2$2(_objectSpread2$2({}, inputProps2), {}, { "ref": this.saveInput }), null), clearIcon, inputIcon]); var expandIcon = createVNode(RightOutlined$3, null, null); var loadingIcon = createVNode("span", { "class": "".concat(prefixCls2, "-menu-item-loading-icon") }, [createVNode(RedoOutlined$1, { "spin": true }, null)]); var getPopupContainer2 = props2.getPopupContainer || getContextPopupContainer; var cascaderProps2 = _extends$1(_extends$1(_extends$1(_extends$1({}, props2), { getPopupContainer: getPopupContainer2, options: options2, prefixCls: prefixCls2, value: value24, popupVisible: sPopupVisible, dropdownMenuColumnStyle, expandIcon, loadingIcon }), onEvents), { onPopupVisibleChange: this.handlePopupVisibleChange, onChange: this.handleChange }); return createVNode(Cascader$2, cascaderProps2, { default: function _default8() { return [input]; } }); } }); var Cascader$1 = withInstall(Cascader); var __rest$n = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; function noop$p() { } var Checkbox = defineComponent({ name: "ACheckbox", inheritAttrs: false, __ANT_CHECKBOX: true, props: { prefixCls: PropsTypes.string, defaultChecked: PropsTypes.looseBool, checked: PropsTypes.looseBool, disabled: PropsTypes.looseBool, isGroup: PropsTypes.looseBool, value: PropsTypes.any, name: PropsTypes.string, id: PropsTypes.string, indeterminate: PropsTypes.looseBool, type: PropsTypes.string.def("checkbox"), autofocus: PropsTypes.looseBool, onChange: PropsTypes.func, "onUpdate:checked": PropsTypes.func }, emits: ["change", "update:checked"], setup: function setup57() { return { configProvider: inject("configProvider", defaultConfigProvider), checkboxGroupContext: inject("checkboxGroupContext", void 0) }; }, watch: { value: function value10(_value, prevValue) { var _this = this; nextTick(function() { var _this$checkboxGroupCo = _this.checkboxGroupContext, checkboxGroup = _this$checkboxGroupCo === void 0 ? {} : _this$checkboxGroupCo; if (checkboxGroup.registerValue && checkboxGroup.cancelValue) { checkboxGroup.cancelValue(prevValue); checkboxGroup.registerValue(_value); } }); } }, mounted: function mounted11() { var value24 = this.value, _this$checkboxGroupCo2 = this.checkboxGroupContext, checkboxGroup = _this$checkboxGroupCo2 === void 0 ? {} : _this$checkboxGroupCo2; if (checkboxGroup.registerValue) { checkboxGroup.registerValue(value24); } warning$5(hasProp$1(this, "checked") || this.checkboxGroupContext || !hasProp$1(this, "value"), "Checkbox", "`value` is not validate prop, do you mean `checked`?"); }, beforeUnmount: function beforeUnmount7() { var value24 = this.value, _this$checkboxGroupCo3 = this.checkboxGroupContext, checkboxGroup = _this$checkboxGroupCo3 === void 0 ? {} : _this$checkboxGroupCo3; if (checkboxGroup.cancelValue) { checkboxGroup.cancelValue(value24); } }, methods: { handleChange: function handleChange8(event) { var targetChecked = event.target.checked; this.$emit("update:checked", targetChecked); this.$emit("change", event); }, focus: function focus10() { this.$refs.vcCheckbox.focus(); }, blur: function blur9() { this.$refs.vcCheckbox.blur(); } }, render: function render38() { var _this2 = this, _classNames; var props2 = getOptionProps(this); var checkboxGroup = this.checkboxGroupContext, $attrs = this.$attrs; var children = getSlot$1(this); var indeterminate = props2.indeterminate, customizePrefixCls = props2.prefixCls, restProps = __rest$n(props2, ["indeterminate", "prefixCls"]); var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("checkbox", customizePrefixCls); var _$attrs$onMouseenter = $attrs.onMouseenter, onMouseenter2 = _$attrs$onMouseenter === void 0 ? noop$p : _$attrs$onMouseenter, _$attrs$onMouseleave = $attrs.onMouseleave, onMouseleave2 = _$attrs$onMouseleave === void 0 ? noop$p : _$attrs$onMouseleave; $attrs.onInput; var className = $attrs.class, style = $attrs.style, restAttrs = __rest$n($attrs, ["onMouseenter", "onMouseleave", "onInput", "class", "style"]); var checkboxProps = _extends$1(_extends$1(_extends$1({}, restProps), { prefixCls: prefixCls2 }), restAttrs); if (checkboxGroup) { checkboxProps.onChange = function() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this2.$emit.apply(_this2, ["change"].concat(args)); checkboxGroup.toggleOption({ label: children, value: props2.value }); }; checkboxProps.name = checkboxGroup.name; checkboxProps.checked = checkboxGroup.sValue.indexOf(props2.value) !== -1; checkboxProps.disabled = props2.disabled || checkboxGroup.disabled; checkboxProps.indeterminate = indeterminate; } else { checkboxProps.onChange = this.handleChange; } var classString = classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-wrapper"), true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-wrapper-checked"), checkboxProps.checked), _defineProperty$12(_classNames, "".concat(prefixCls2, "-wrapper-disabled"), checkboxProps.disabled), _classNames), className); var checkboxClass = classNames(_defineProperty$12({}, "".concat(prefixCls2, "-indeterminate"), indeterminate)); return createVNode("label", { "class": classString, "style": style, "onMouseenter": onMouseenter2, "onMouseleave": onMouseleave2 }, [createVNode(Checkbox$1, _objectSpread2$2(_objectSpread2$2({}, checkboxProps), {}, { "class": checkboxClass, "ref": "vcCheckbox" }), null), children.length ? createVNode("span", null, [children]) : null]); } }); function noop$o() { } var CheckboxGroup = defineComponent({ name: "ACheckboxGroup", props: { name: PropsTypes.string, prefixCls: PropsTypes.string, defaultValue: { type: Array }, value: { type: Array }, options: { type: Array }, disabled: PropsTypes.looseBool, onChange: PropsTypes.func }, emits: ["change", "update:value"], setup: function setup58() { return { configProvider: inject("configProvider", defaultConfigProvider) }; }, data: function data18() { var value24 = this.value, defaultValue = this.defaultValue; return { sValue: value24 || defaultValue || [], registeredValues: [] }; }, watch: { value: function value11(val) { this.sValue = val || []; } }, created: function created9() { provide("checkboxGroupContext", this); }, methods: { getOptions: function getOptions2() { var _this$options = this.options, options2 = _this$options === void 0 ? [] : _this$options, $slots = this.$slots; return options2.map(function(option) { if (typeof option === "string") { return { label: option, value: option }; } var label = option.label; if (label === void 0 && $slots.label) { label = $slots.label(option); } return _extends$1(_extends$1({}, option), { label }); }); }, cancelValue: function cancelValue(value24) { this.registeredValues = this.registeredValues.filter(function(val) { return val !== value24; }); }, registerValue: function registerValue(value24) { this.registeredValues = [].concat(_toConsumableArray(this.registeredValues), [value24]); }, toggleOption: function toggleOption(option) { var registeredValues = this.registeredValues; var optionIndex = this.sValue.indexOf(option.value); var value24 = _toConsumableArray(this.sValue); if (optionIndex === -1) { value24.push(option.value); } else { value24.splice(optionIndex, 1); } if (!hasProp$1(this, "value")) { this.sValue = value24; } var options2 = this.getOptions(); var val = value24.filter(function(val2) { return registeredValues.indexOf(val2) !== -1; }).sort(function(a2, b2) { var indexA = options2.findIndex(function(opt) { return opt.value === a2; }); var indexB = options2.findIndex(function(opt) { return opt.value === b2; }); return indexA - indexB; }); this.$emit("update:value", val); this.$emit("change", val); } }, render: function render39() { var props2 = this.$props, state = this.$data; var customizePrefixCls = props2.prefixCls, options2 = props2.options; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("checkbox", customizePrefixCls); var children = getSlot$1(this); var groupPrefixCls = "".concat(prefixCls2, "-group"); if (options2 && options2.length > 0) { children = this.getOptions().map(function(option) { return createVNode(Checkbox, { "prefixCls": prefixCls2, "key": option.value.toString(), "disabled": "disabled" in option ? option.disabled : props2.disabled, "indeterminate": option.indeterminate, "value": option.value, "checked": state.sValue.indexOf(option.value) !== -1, "onChange": option.onChange || noop$o, "class": "".concat(groupPrefixCls, "-item") }, { default: function _default8() { return [option.label]; } }); }); } return createVNode("div", { "class": groupPrefixCls }, [children]); } }); Checkbox.Group = CheckboxGroup; Checkbox.install = function(app) { app.component(Checkbox.name, Checkbox); app.component(CheckboxGroup.name, CheckboxGroup); return app; }; function goYear$3(direction) { this.changeYear(direction); } function noop$n() { } var MonthPanel = { name: "MonthPanel", inheritAttrs: false, mixins: [BaseMixin], props: { value: PropsTypes.any, defaultValue: PropsTypes.any, cellRender: PropsTypes.any, contentRender: PropsTypes.any, locale: PropsTypes.any, rootPrefixCls: PropsTypes.string, disabledDate: PropsTypes.func, renderFooter: PropsTypes.func, changeYear: PropsTypes.func.def(noop$n) }, data: function data19() { var value24 = this.value, defaultValue = this.defaultValue; this.nextYear = goYear$3.bind(this, 1); this.previousYear = goYear$3.bind(this, -1); return { sValue: value24 || defaultValue }; }, watch: { value: function value12(val) { this.setState({ sValue: val }); } }, methods: { setAndSelectValue: function setAndSelectValue2(value24) { this.setValue(value24); this.__emit("select", value24); }, setValue: function setValue5(value24) { if (hasProp(this, "value")) { this.setState({ sValue: value24 }); } } }, render: function render40() { var sValue = this.sValue, cellRender = this.cellRender, contentRender = this.contentRender, locale2 = this.locale, rootPrefixCls = this.rootPrefixCls, disabledDate = this.disabledDate, renderFooter5 = this.renderFooter; var year = sValue.year(); var prefixCls2 = "".concat(rootPrefixCls, "-month-panel"); var footer = renderFooter5 && renderFooter5("month"); return createVNode("div", { "class": prefixCls2 }, [createVNode("div", null, [createVNode("div", { "class": "".concat(prefixCls2, "-header") }, [createVNode("a", { "class": "".concat(prefixCls2, "-prev-year-btn"), "role": "button", "onClick": this.previousYear, "title": locale2.previousYear }, null), createVNode("a", { "class": "".concat(prefixCls2, "-year-select"), "role": "button", "onClick": this.$attrs.onYearPanelShow || noop$n, "title": locale2.yearSelect }, [createVNode("span", { "class": "".concat(prefixCls2, "-year-select-content") }, [year]), createVNode("span", { "class": "".concat(prefixCls2, "-year-select-arrow") }, [createTextVNode("x")])]), createVNode("a", { "class": "".concat(prefixCls2, "-next-year-btn"), "role": "button", "onClick": this.nextYear, "title": locale2.nextYear }, null)]), createVNode("div", { "class": "".concat(prefixCls2, "-body") }, [createVNode(MonthTable$1, { "disabledDate": disabledDate, "onSelect": this.setAndSelectValue, "locale": locale2, "value": sValue, "cellRender": cellRender, "contentRender": contentRender, "prefixCls": prefixCls2 }, null)]), footer && createVNode("div", { "class": "".concat(prefixCls2, "-footer") }, [footer])])]); } }; var MonthPanel$1 = MonthPanel; var ROW$1 = 4; var COL$1 = 3; function noop$m() { } function goYear$2(direction) { var value24 = this.sValue.clone(); value24.add(direction, "year"); this.setState({ sValue: value24 }); } function chooseYear(year) { var value24 = this.sValue.clone(); value24.year(year); value24.month(this.sValue.month()); this.sValue = value24; this.__emit("select", value24); } var YearPanel = { name: "YearPanel", mixins: [BaseMixin], inheritAttrs: false, props: { rootPrefixCls: PropsTypes.string, value: PropsTypes.object, defaultValue: PropsTypes.object, locale: PropsTypes.object, renderFooter: PropsTypes.func }, data: function data20() { this.nextDecade = goYear$2.bind(this, 10); this.previousDecade = goYear$2.bind(this, -10); return { sValue: this.value || this.defaultValue }; }, watch: { value: function value13(val) { this.sValue = val; } }, methods: { years: function years2() { var value24 = this.sValue; var currentYear = value24.year(); var startYear = parseInt(currentYear / 10, 10) * 10; var previousYear = startYear - 1; var years3 = []; var index2 = 0; for (var rowIndex = 0; rowIndex < ROW$1; rowIndex++) { years3[rowIndex] = []; for (var colIndex = 0; colIndex < COL$1; colIndex++) { var year = previousYear + index2; var content = String(year); years3[rowIndex][colIndex] = { content, year, title: content }; index2++; } } return years3; } }, render: function render41() { var _this = this; var value24 = this.sValue, locale2 = this.locale, renderFooter5 = this.renderFooter; var onDecadePanelShow = this.$attrs.onDecadePanelShow || noop$m; var years3 = this.years(); var currentYear = value24.year(); var startYear = parseInt(currentYear / 10, 10) * 10; var endYear = startYear + 9; var prefixCls2 = "".concat(this.rootPrefixCls, "-year-panel"); var yeasEls = years3.map(function(row, index2) { var tds = row.map(function(yearData) { var _classNameMap; var classNameMap = (_classNameMap = {}, _defineProperty$12(_classNameMap, "".concat(prefixCls2, "-cell"), 1), _defineProperty$12(_classNameMap, "".concat(prefixCls2, "-selected-cell"), yearData.year === currentYear), _defineProperty$12(_classNameMap, "".concat(prefixCls2, "-last-decade-cell"), yearData.year < startYear), _defineProperty$12(_classNameMap, "".concat(prefixCls2, "-next-decade-cell"), yearData.year > endYear), _classNameMap); var clickHandler = noop$m; if (yearData.year < startYear) { clickHandler = _this.previousDecade; } else if (yearData.year > endYear) { clickHandler = _this.nextDecade; } else { clickHandler = chooseYear.bind(_this, yearData.year); } return createVNode("td", { "role": "gridcell", "title": yearData.title, "key": yearData.content, "onClick": clickHandler, "class": classNameMap }, [createVNode("a", { "class": "".concat(prefixCls2, "-year") }, [yearData.content])]); }); return createVNode("tr", { "key": index2, "role": "row" }, [tds]); }); var footer = renderFooter5 && renderFooter5("year"); return createVNode("div", { "class": prefixCls2 }, [createVNode("div", null, [createVNode("div", { "class": "".concat(prefixCls2, "-header") }, [createVNode("a", { "class": "".concat(prefixCls2, "-prev-decade-btn"), "role": "button", "onClick": this.previousDecade, "title": locale2.previousDecade }, null), createVNode("a", { "class": "".concat(prefixCls2, "-decade-select"), "role": "button", "onClick": onDecadePanelShow, "title": locale2.decadeSelect }, [createVNode("span", { "class": "".concat(prefixCls2, "-decade-select-content") }, [startYear, createTextVNode("-"), endYear]), createVNode("span", { "class": "".concat(prefixCls2, "-decade-select-arrow") }, [createTextVNode("x")])]), createVNode("a", { "class": "".concat(prefixCls2, "-next-decade-btn"), "role": "button", "onClick": this.nextDecade, "title": locale2.nextDecade }, null)]), createVNode("div", { "class": "".concat(prefixCls2, "-body") }, [createVNode("table", { "class": "".concat(prefixCls2, "-table"), "cellspacing": "0", "role": "grid" }, [createVNode("tbody", { "class": "".concat(prefixCls2, "-tbody") }, [yeasEls])])]), footer && createVNode("div", { "class": "".concat(prefixCls2, "-footer") }, [footer])])]); } }; var ROW = 4; var COL = 3; function noop$l() { } function goYear$1(direction) { var next2 = this.sValue.clone(); next2.add(direction, "years"); this.setState({ sValue: next2 }); } function chooseDecade(year, event) { var next2 = this.sValue.clone(); next2.year(year); next2.month(this.sValue.month()); this.__emit("select", next2); event.preventDefault(); } var DecadePanel = { name: "DecadePanel", mixins: [BaseMixin], inheritAttrs: false, props: { locale: PropsTypes.object, value: PropsTypes.object, defaultValue: PropsTypes.object, rootPrefixCls: PropsTypes.string, renderFooter: PropsTypes.func }, data: function data21() { this.nextCentury = goYear$1.bind(this, 100); this.previousCentury = goYear$1.bind(this, -100); return { sValue: this.value || this.defaultValue }; }, watch: { value: function value14(val) { this.sValue = val; } }, render: function render42() { var _this = this; var value24 = this.sValue; var _this$$props = this.$props, locale2 = _this$$props.locale, renderFooter5 = _this$$props.renderFooter; var currentYear = value24.year(); var startYear = parseInt(currentYear / 100, 10) * 100; var preYear = startYear - 10; var endYear = startYear + 99; var decades = []; var index2 = 0; var prefixCls2 = "".concat(this.rootPrefixCls, "-decade-panel"); for (var rowIndex = 0; rowIndex < ROW; rowIndex++) { decades[rowIndex] = []; for (var colIndex = 0; colIndex < COL; colIndex++) { var startDecade = preYear + index2 * 10; var endDecade = preYear + index2 * 10 + 9; decades[rowIndex][colIndex] = { startDecade, endDecade }; index2++; } } var footer = renderFooter5 && renderFooter5("decade"); var decadesEls = decades.map(function(row, decadeIndex) { var tds = row.map(function(decadeData) { var _classNameMap; var dStartDecade = decadeData.startDecade; var dEndDecade = decadeData.endDecade; var isLast = dStartDecade < startYear; var isNext = dEndDecade > endYear; var classNameMap = (_classNameMap = {}, _defineProperty$12(_classNameMap, "".concat(prefixCls2, "-cell"), 1), _defineProperty$12(_classNameMap, "".concat(prefixCls2, "-selected-cell"), dStartDecade <= currentYear && currentYear <= dEndDecade), _defineProperty$12(_classNameMap, "".concat(prefixCls2, "-last-century-cell"), isLast), _defineProperty$12(_classNameMap, "".concat(prefixCls2, "-next-century-cell"), isNext), _classNameMap); var content = "".concat(dStartDecade, "-").concat(dEndDecade); var clickHandler = noop$l; if (isLast) { clickHandler = _this.previousCentury; } else if (isNext) { clickHandler = _this.nextCentury; } else { clickHandler = chooseDecade.bind(_this, dStartDecade); } return createVNode("td", { "key": dStartDecade, "onClick": clickHandler, "role": "gridcell", "class": classNameMap }, [createVNode("a", { "class": "".concat(prefixCls2, "-decade") }, [content])]); }); return createVNode("tr", { "key": decadeIndex, "role": "row" }, [tds]); }); return createVNode("div", { "class": prefixCls2 }, [createVNode("div", { "class": "".concat(prefixCls2, "-header") }, [createVNode("a", { "class": "".concat(prefixCls2, "-prev-century-btn"), "role": "button", "onClick": this.previousCentury, "title": locale2.previousCentury }, null), createVNode("div", { "class": "".concat(prefixCls2, "-century") }, [startYear, createTextVNode("-"), endYear]), createVNode("a", { "class": "".concat(prefixCls2, "-next-century-btn"), "role": "button", "onClick": this.nextCentury, "title": locale2.nextCentury }, null)]), createVNode("div", { "class": "".concat(prefixCls2, "-body") }, [createVNode("table", { "class": "".concat(prefixCls2, "-table"), "cellspacing": "0", "role": "grid" }, [createVNode("tbody", { "class": "".concat(prefixCls2, "-tbody") }, [decadesEls])])]), footer && createVNode("div", { "class": "".concat(prefixCls2, "-footer") }, [footer])]); } }; function noop$k() { } function goMonth(direction) { var next2 = this.value.clone(); next2.add(direction, "months"); this.__emit("valueChange", next2); } function goYear(direction) { var next2 = this.value.clone(); next2.add(direction, "years"); this.__emit("valueChange", next2); } function showIf(condition, el) { return condition ? el : null; } var CalendarHeader = { name: "CalendarHeader", inheritAttrs: false, mixins: [BaseMixin], props: { prefixCls: PropsTypes.string, value: PropsTypes.object, showTimePicker: PropsTypes.looseBool, locale: PropsTypes.object, enablePrev: PropsTypes.any.def(1), enableNext: PropsTypes.any.def(1), disabledMonth: PropsTypes.func, mode: PropsTypes.any, monthCellRender: PropsTypes.func, monthCellContentRender: PropsTypes.func, renderFooter: PropsTypes.func }, data: function data22() { this.nextMonth = goMonth.bind(this, 1); this.previousMonth = goMonth.bind(this, -1); this.nextYear = goYear.bind(this, 1); this.previousYear = goYear.bind(this, -1); return { yearPanelReferer: null }; }, methods: { onMonthSelect: function onMonthSelect(value24) { this.__emit("panelChange", value24, "date"); if (this.$attrs.onMonthSelect) { this.__emit("monthSelect", value24); } else { this.__emit("valueChange", value24); } }, onYearSelect: function onYearSelect(value24) { var referer = this.yearPanelReferer; this.setState({ yearPanelReferer: null }); this.__emit("panelChange", value24, referer); this.__emit("valueChange", value24); }, onDecadeSelect: function onDecadeSelect(value24) { this.__emit("panelChange", value24, "year"); this.__emit("valueChange", value24); }, changeYear: function changeYear(direction) { if (direction > 0) { this.nextYear(); } else { this.previousYear(); } }, monthYearElement: function monthYearElement(showTimePicker) { var _this = this; var props2 = this.$props; var prefixCls2 = props2.prefixCls; var locale2 = props2.locale; var value24 = props2.value; var localeData2 = value24.localeData(); var monthBeforeYear = locale2.monthBeforeYear; var selectClassName = "".concat(prefixCls2, "-").concat(monthBeforeYear ? "my-select" : "ym-select"); var timeClassName = showTimePicker ? " ".concat(prefixCls2, "-time-status") : ""; var year = createVNode("a", { "class": "".concat(prefixCls2, "-year-select").concat(timeClassName), "role": "button", "onClick": showTimePicker ? noop$k : function() { return _this.showYearPanel("date"); }, "title": showTimePicker ? null : locale2.yearSelect }, [value24.format(locale2.yearFormat)]); var month = createVNode("a", { "class": "".concat(prefixCls2, "-month-select").concat(timeClassName), "role": "button", "onClick": showTimePicker ? noop$k : this.showMonthPanel, "title": showTimePicker ? null : locale2.monthSelect }, [locale2.monthFormat ? value24.format(locale2.monthFormat) : localeData2.monthsShort(value24)]); var day; if (showTimePicker) { day = createVNode("a", { "class": "".concat(prefixCls2, "-day-select").concat(timeClassName), "role": "button" }, [value24.format(locale2.dayFormat)]); } var my = []; if (monthBeforeYear) { my = [month, day, year]; } else { my = [year, month, day]; } return createVNode("span", { "class": selectClassName }, [my]); }, showMonthPanel: function showMonthPanel() { this.__emit("panelChange", null, "month"); }, showYearPanel: function showYearPanel(referer) { this.setState({ yearPanelReferer: referer }); this.__emit("panelChange", null, "year"); }, showDecadePanel: function showDecadePanel() { this.__emit("panelChange", null, "decade"); } }, render: function render43() { var _this2 = this; var props2 = getOptionProps(this); var prefixCls2 = props2.prefixCls, locale2 = props2.locale, mode3 = props2.mode, value24 = props2.value, showTimePicker = props2.showTimePicker, enableNext = props2.enableNext, enablePrev = props2.enablePrev, disabledMonth = props2.disabledMonth, renderFooter5 = props2.renderFooter; var panel = null; if (mode3 === "month") { panel = createVNode(MonthPanel$1, { "locale": locale2, "value": value24, "rootPrefixCls": prefixCls2, "onSelect": this.onMonthSelect, "onYearPanelShow": function onYearPanelShow() { return _this2.showYearPanel("month"); }, "disabledDate": disabledMonth, "cellRender": props2.monthCellRender, "contentRender": props2.monthCellContentRender, "renderFooter": renderFooter5, "changeYear": this.changeYear }, null); } if (mode3 === "year") { panel = createVNode(YearPanel, { "locale": locale2, "value": value24, "rootPrefixCls": prefixCls2, "onSelect": this.onYearSelect, "onDecadePanelShow": this.showDecadePanel, "renderFooter": renderFooter5 }, null); } if (mode3 === "decade") { panel = createVNode(DecadePanel, { "locale": locale2, "value": value24, "rootPrefixCls": prefixCls2, "onSelect": this.onDecadeSelect, "renderFooter": renderFooter5 }, null); } return createVNode("div", { "class": "".concat(prefixCls2, "-header") }, [createVNode("div", { "style": { position: "relative" } }, [showIf(enablePrev && !showTimePicker, createVNode("a", { "class": "".concat(prefixCls2, "-prev-year-btn"), "role": "button", "onClick": this.previousYear, "title": locale2.previousYear }, null)), showIf(enablePrev && !showTimePicker, createVNode("a", { "class": "".concat(prefixCls2, "-prev-month-btn"), "role": "button", "onClick": this.previousMonth, "title": locale2.previousMonth }, null)), this.monthYearElement(showTimePicker), showIf(enableNext && !showTimePicker, createVNode("a", { "class": "".concat(prefixCls2, "-next-month-btn"), "onClick": this.nextMonth, "title": locale2.nextMonth }, null)), showIf(enableNext && !showTimePicker, createVNode("a", { "class": "".concat(prefixCls2, "-next-year-btn"), "onClick": this.nextYear, "title": locale2.nextYear }, null))]), panel]); } }; var CalendarHeader$1 = CalendarHeader; function noop$j() { } var TodayButton = function TodayButton2(_2, _ref) { var attrs = _ref.attrs; var prefixCls2 = attrs.prefixCls, locale2 = attrs.locale, value24 = attrs.value, timePicker = attrs.timePicker, disabled = attrs.disabled, disabledDate = attrs.disabledDate, onToday3 = attrs.onToday, text = attrs.text; var localeNow = (!text && timePicker ? locale2.now : text) || locale2.today; var disabledToday = disabledDate && !isAllowedDate(getTodayTime(value24), disabledDate); var isDisabled2 = disabledToday || disabled; var disabledTodayClass = isDisabled2 ? "".concat(prefixCls2, "-today-btn-disabled") : ""; return createVNode("a", { "class": "".concat(prefixCls2, "-today-btn ").concat(disabledTodayClass), "role": "button", "onClick": isDisabled2 ? noop$j : onToday3, "title": getTodayTimeStr(value24) }, [localeNow]); }; TodayButton.inheritAttrs = false; var TodayButton$1 = TodayButton; function noop$i() { } var OkButton = function OkButton2(_2, _ref) { var attrs = _ref.attrs; var prefixCls2 = attrs.prefixCls, locale2 = attrs.locale, okDisabled = attrs.okDisabled, onOk3 = attrs.onOk; var className = "".concat(prefixCls2, "-ok-btn"); if (okDisabled) { className += " ".concat(prefixCls2, "-ok-btn-disabled"); } return createVNode("a", { "class": className, "role": "button", "onClick": okDisabled ? noop$i : onOk3 }, [locale2.ok]); }; OkButton.inheritAttrs = false; var OkButton$1 = OkButton; function noop$h() { } var TimePickerButton = function TimePickerButton2(_2, _ref) { var _className; var attrs = _ref.attrs; var prefixCls2 = attrs.prefixCls, locale2 = attrs.locale, showTimePicker = attrs.showTimePicker, timePickerDisabled = attrs.timePickerDisabled, _attrs$onCloseTimePic = attrs.onCloseTimePicker, onCloseTimePicker2 = _attrs$onCloseTimePic === void 0 ? noop$h : _attrs$onCloseTimePic, _attrs$onOpenTimePick = attrs.onOpenTimePicker, onOpenTimePicker2 = _attrs$onOpenTimePick === void 0 ? noop$h : _attrs$onOpenTimePick; var className = (_className = {}, _defineProperty$12(_className, "".concat(prefixCls2, "-time-picker-btn"), true), _defineProperty$12(_className, "".concat(prefixCls2, "-time-picker-btn-disabled"), timePickerDisabled), _className); var onClick7 = noop$h; if (!timePickerDisabled) { onClick7 = showTimePicker ? onCloseTimePicker2 : onOpenTimePicker2; } return createVNode("a", { "class": className, "role": "button", "onClick": onClick7 }, [showTimePicker ? locale2.dateSelect : locale2.timeSelect]); }; TimePickerButton.inheritAttrs = false; var TimePickerButton$1 = TimePickerButton; var CalendarFooter = { name: "CalendarFooter", inheritAttrs: false, mixins: [BaseMixin], props: { prefixCls: PropsTypes.string, showDateInput: PropsTypes.looseBool, disabledTime: PropsTypes.any, timePicker: PropsTypes.any, selectedValue: PropsTypes.any, showOk: PropsTypes.looseBool, value: PropsTypes.object, renderFooter: PropsTypes.func, defaultValue: PropsTypes.object, locale: PropsTypes.object, showToday: PropsTypes.looseBool, disabledDate: PropsTypes.func, showTimePicker: PropsTypes.looseBool, okDisabled: PropsTypes.looseBool, mode: PropsTypes.string }, methods: { onSelect: function onSelect2(value24) { this.__emit("select", value24); }, getRootDOMNode: function getRootDOMNode() { return findDOMNode(this); } }, render: function render44() { var props2 = getOptionProps(this); var value24 = props2.value, prefixCls2 = props2.prefixCls, showOk = props2.showOk, timePicker = props2.timePicker, renderFooter5 = props2.renderFooter, showToday = props2.showToday, mode3 = props2.mode; var footerEl = null; var extraFooter = renderFooter5 && renderFooter5(mode3); if (showToday || timePicker || extraFooter) { var _cls; var btnProps = _extends$1(_extends$1(_extends$1({}, props2), this.$attrs), { value: value24 }); var nowEl = null; if (showToday) { nowEl = createVNode(TodayButton$1, _objectSpread2$2({ "key": "todayButton" }, btnProps), null); } delete btnProps.value; var okBtn = null; if (showOk === true || showOk !== false && !!timePicker) { okBtn = createVNode(OkButton$1, _objectSpread2$2({ "key": "okButton" }, btnProps), null); } var timePickerBtn = null; if (timePicker) { timePickerBtn = createVNode(TimePickerButton$1, _objectSpread2$2({ "key": "timePickerButton" }, btnProps), null); } var footerBtn; if (nowEl || timePickerBtn || okBtn || extraFooter) { footerBtn = createVNode("span", { "class": "".concat(prefixCls2, "-footer-btn") }, [extraFooter, nowEl, timePickerBtn, okBtn]); } var cls = (_cls = {}, _defineProperty$12(_cls, "".concat(prefixCls2, "-footer"), true), _defineProperty$12(_cls, "".concat(prefixCls2, "-footer-show-ok"), !!okBtn), _cls); footerEl = createVNode("div", { "class": cls }, [footerBtn]); } return footerEl; } }; var CalendarFooter$1 = CalendarFooter; var cachedSelectionStart; var cachedSelectionEnd; var dateInputInstance; var DateInput = { name: "DateInput", inheritAttrs: false, mixins: [BaseMixin], props: { prefixCls: PropsTypes.string, timePicker: PropsTypes.object, value: PropsTypes.object, disabledTime: PropsTypes.any, format: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.arrayOf(PropsTypes.string), PropsTypes.func]), locale: PropsTypes.object, disabledDate: PropsTypes.func, placeholder: PropsTypes.string, selectedValue: PropsTypes.object, clearIcon: PropsTypes.any, inputMode: PropsTypes.string, inputReadOnly: PropsTypes.looseBool, disabled: PropsTypes.looseBool, showClear: PropsTypes.looseBool }, data: function data23() { var selectedValue5 = this.selectedValue; return { str: formatDate$1(selectedValue5, this.format), invalid: false, hasFocus: false }; }, watch: { selectedValue: function selectedValue2() { this.setState(); }, format: function format2() { this.setState(); } }, updated: function updated5() { var _this = this; this.$nextTick(function() { if (dateInputInstance && _this.$data.hasFocus && !_this.invalid && !(cachedSelectionStart === 0 && cachedSelectionEnd === 0)) { dateInputInstance.setSelectionRange(cachedSelectionStart, cachedSelectionEnd); } }); }, getInstance: function getInstance() { return dateInputInstance; }, methods: { getDerivedStateFromProps: function getDerivedStateFromProps(nextProps, state) { var newState = {}; if (dateInputInstance) { cachedSelectionStart = dateInputInstance.selectionStart; cachedSelectionEnd = dateInputInstance.selectionEnd; } var selectedValue5 = nextProps.selectedValue; if (!state.hasFocus) { newState = { str: formatDate$1(selectedValue5, this.format), invalid: false }; } return newState; }, onClear: function onClear() { this.setState({ str: "" }); this.__emit("clear", null); }, onInputChange: function onInputChange(e2) { var _e$target = e2.target, str = _e$target.value, composing = _e$target.composing; var _this$str = this.str, oldStr = _this$str === void 0 ? "" : _this$str; if (e2.isComposing || composing || oldStr === str) return; var _this$$props = this.$props, disabledDate = _this$$props.disabledDate, format3 = _this$$props.format, selectedValue5 = _this$$props.selectedValue; if (!str) { this.__emit("change", null); this.setState({ invalid: false, str }); return; } var parsed = hooks(str, format3, true); if (!parsed.isValid()) { this.setState({ invalid: true, str }); return; } var value24 = this.value.clone(); value24.year(parsed.year()).month(parsed.month()).date(parsed.date()).hour(parsed.hour()).minute(parsed.minute()).second(parsed.second()); if (!value24 || disabledDate && disabledDate(value24)) { this.setState({ invalid: true, str }); return; } if (selectedValue5 !== value24 || selectedValue5 && value24 && !selectedValue5.isSame(value24)) { this.setState({ invalid: false, str }); this.__emit("change", value24); } }, onFocus: function onFocus2() { this.setState({ hasFocus: true }); }, onBlur: function onBlur2() { this.setState(function(prevState, prevProps) { return { hasFocus: false, str: formatDate$1(prevProps.value, prevProps.format) }; }); }, onKeyDown: function onKeyDown(event) { var keyCode = event.keyCode; var _this$$props2 = this.$props, value24 = _this$$props2.value, disabledDate = _this$$props2.disabledDate; if (keyCode === KeyCode$1.ENTER) { var validateDate = !disabledDate || !disabledDate(value24); if (validateDate) { this.__emit("select", value24.clone()); } event.preventDefault(); } }, getRootDOMNode: function getRootDOMNode2() { return findDOMNode(this); }, focus: function focus11() { if (dateInputInstance) { dateInputInstance.focus(); } }, saveDateInput: function saveDateInput(dateInput) { dateInputInstance = dateInput; } }, render: function render45() { var invalid = this.invalid, str = this.str, locale2 = this.locale, prefixCls2 = this.prefixCls, placeholder = this.placeholder, disabled = this.disabled, showClear = this.showClear, inputMode = this.inputMode, inputReadOnly = this.inputReadOnly; var clearIcon = getComponent(this, "clearIcon"); var invalidClass = invalid ? "".concat(prefixCls2, "-input-invalid") : ""; return createVNode("div", { "class": "".concat(prefixCls2, "-input-wrap") }, [createVNode("div", { "class": "".concat(prefixCls2, "-date-input-wrap") }, [withDirectives(createVNode("input", { "ref": this.saveDateInput, "class": "".concat(prefixCls2, "-input ").concat(invalidClass), "value": str, "disabled": disabled, "placeholder": placeholder, "onInput": this.onInputChange, "onChange": this.onInputChange, "onKeydown": this.onKeyDown, "onFocus": this.onFocus, "onBlur": this.onBlur, "inputMode": inputMode, "readonly": inputReadOnly }, null), [[antInput$1]])]), showClear ? createVNode("a", { "role": "button", "title": locale2.clear, "onClick": this.onClear }, [clearIcon || createVNode("span", { "class": "".concat(prefixCls2, "-clear-btn") }, null)]) : null]); } }; var DateInput$1 = DateInput; function goStartMonth(time) { return time.clone().startOf("month"); } function goEndMonth(time) { return time.clone().endOf("month"); } function goTime(time, direction, unit) { return time.clone().add(direction, unit); } function includesTime() { var timeList = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var time = arguments.length > 1 ? arguments[1] : void 0; var unit = arguments.length > 2 ? arguments[2] : void 0; return timeList.some(function(t2) { return t2.isSame(time, unit); }); } var getMomentObjectIfValid = function getMomentObjectIfValid2(date3) { if (hooks.isMoment(date3) && date3.isValid()) { return date3; } return false; }; var Calendar = defineComponent({ name: "Calendar", mixins: [BaseMixin, CommonMixin, CalendarMixin$1], inheritAttrs: false, props: { locale: PropsTypes.object.def(enUs), format: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.arrayOf(PropsTypes.string), PropsTypes.func]), visible: PropsTypes.looseBool.def(true), prefixCls: PropsTypes.string.def("rc-calendar"), defaultValue: PropsTypes.object, value: PropsTypes.object, selectedValue: PropsTypes.object, defaultSelectedValue: PropsTypes.object, mode: PropsTypes.oneOf(["time", "date", "month", "year", "decade"]), showDateInput: PropsTypes.looseBool.def(true), showWeekNumber: PropsTypes.looseBool, showToday: PropsTypes.looseBool.def(true), showOk: PropsTypes.looseBool, timePicker: PropsTypes.any, dateInputPlaceholder: PropsTypes.any, disabledDate: PropsTypes.func, disabledTime: PropsTypes.any, dateRender: PropsTypes.func, renderFooter: PropsTypes.func.def(function() { return null; }), renderSidebar: PropsTypes.func.def(function() { return null; }), clearIcon: PropsTypes.any, focusablePanel: PropsTypes.looseBool.def(true), inputMode: PropsTypes.string, inputReadOnly: PropsTypes.looseBool, monthCellRender: PropsTypes.func, monthCellContentRender: PropsTypes.func }, data: function data24() { var props2 = this.$props; return { sMode: this.mode || "date", sValue: getMomentObjectIfValid(props2.value) || getMomentObjectIfValid(props2.defaultValue) || hooks(), sSelectedValue: props2.selectedValue || props2.defaultSelectedValue }; }, watch: { mode: function mode(val) { this.setState({ sMode: val }); }, value: function value15(val) { this.setState({ sValue: getMomentObjectIfValid(val) || getMomentObjectIfValid(this.defaultValue) || getNowByCurrentStateValue(this.sValue) }); }, selectedValue: function selectedValue3(val) { this.setState({ sSelectedValue: val }); } }, mounted: function mounted12() { var _this = this; this.$nextTick(function() { _this.saveFocusElement(DateInput$1.getInstance()); }); }, methods: { onPanelChange: function onPanelChange(value24, mode3) { var sValue = this.sValue; if (!hasProp(this, "mode")) { this.setState({ sMode: mode3 }); } this.__emit("panelChange", value24 || sValue, mode3); }, onKeyDown: function onKeyDown2(event) { if (event.target.nodeName.toLowerCase() === "input") { return void 0; } var keyCode = event.keyCode; var ctrlKey = event.ctrlKey || event.metaKey; var disabledDate = this.disabledDate, value24 = this.sValue; switch (keyCode) { case KeyCode$1.DOWN: this.goTime(1, "weeks"); event.preventDefault(); return 1; case KeyCode$1.UP: this.goTime(-1, "weeks"); event.preventDefault(); return 1; case KeyCode$1.LEFT: if (ctrlKey) { this.goTime(-1, "years"); } else { this.goTime(-1, "days"); } event.preventDefault(); return 1; case KeyCode$1.RIGHT: if (ctrlKey) { this.goTime(1, "years"); } else { this.goTime(1, "days"); } event.preventDefault(); return 1; case KeyCode$1.HOME: this.setValue(goStartMonth(value24)); event.preventDefault(); return 1; case KeyCode$1.END: this.setValue(goEndMonth(value24)); event.preventDefault(); return 1; case KeyCode$1.PAGE_DOWN: this.goTime(1, "month"); event.preventDefault(); return 1; case KeyCode$1.PAGE_UP: this.goTime(-1, "month"); event.preventDefault(); return 1; case KeyCode$1.ENTER: if (!disabledDate || !disabledDate(value24)) { this.onSelect(value24, { source: "keyboard" }); } event.preventDefault(); return 1; default: this.__emit("keydown", event); return 1; } }, onClear: function onClear2() { this.onSelect(null); this.__emit("clear"); }, onOk: function onOk() { var sSelectedValue = this.sSelectedValue; if (this.isAllowedDate(sSelectedValue)) { this.__emit("ok", sSelectedValue); } }, onDateInputChange: function onDateInputChange(value24) { this.onSelect(value24, { source: "dateInput" }); }, onDateInputSelect: function onDateInputSelect(value24) { this.onSelect(value24, { source: "dateInputSelect" }); }, onDateTableSelect: function onDateTableSelect(value24) { var timePicker = this.timePicker, sSelectedValue = this.sSelectedValue; if (!sSelectedValue && timePicker) { var timePickerProps3 = getOptionProps(timePicker); var timePickerDefaultValue = timePickerProps3.defaultValue; if (timePickerDefaultValue) { syncTime(timePickerDefaultValue, value24); } } this.onSelect(value24); }, onToday: function onToday() { var sValue = this.sValue; var now2 = getTodayTime(sValue); this.onSelect(now2, { source: "todayButton" }); }, onBlur: function onBlur3(event) { var _this2 = this; setTimeout(function() { var dateInput = DateInput$1.getInstance(); var rootInstance = _this2.rootInstance; if (!rootInstance || rootInstance.contains(document.activeElement) || dateInput && dateInput.contains(document.activeElement)) { return; } _this2.__emit("blur", event); }, 0); }, getRootDOMNode: function getRootDOMNode3() { return findDOMNode(this); }, openTimePicker: function openTimePicker() { this.onPanelChange(null, "time"); }, closeTimePicker: function closeTimePicker() { this.onPanelChange(null, "date"); }, goTime: function goTime$1(direction, unit) { this.setValue(goTime(this.sValue, direction, unit)); } }, render: function render46() { var locale2 = this.locale, prefixCls2 = this.prefixCls, disabledDate = this.disabledDate, dateInputPlaceholder = this.dateInputPlaceholder, timePicker = this.timePicker, disabledTime = this.disabledTime, showDateInput = this.showDateInput, sValue = this.sValue, sSelectedValue = this.sSelectedValue, sMode = this.sMode, renderFooter5 = this.renderFooter, inputMode = this.inputMode, inputReadOnly = this.inputReadOnly, monthCellRender = this.monthCellRender, monthCellContentRender = this.monthCellContentRender, props2 = this.$props; var clearIcon = getComponent(this, "clearIcon"); var showTimePicker = sMode === "time"; var disabledTimeConfig = showTimePicker && disabledTime && timePicker ? getTimeConfig(sSelectedValue, disabledTime) : null; var timePickerEle = null; if (timePicker && showTimePicker) { var timePickerOriginProps = getOptionProps(timePicker); var timePickerProps3 = _extends$1(_extends$1(_extends$1({ showHour: true, showSecond: true, showMinute: true }, timePickerOriginProps), disabledTimeConfig), { value: sSelectedValue, disabledTime, onChange: this.onDateInputChange }); if (timePickerOriginProps.defaultValue !== void 0) { timePickerProps3.defaultOpenValue = timePickerOriginProps.defaultValue; } timePickerEle = cloneElement(timePicker, timePickerProps3); } var dateInputElement = showDateInput ? createVNode(DateInput$1, { "format": this.getFormat(), "key": "date-input", "value": sValue, "locale": locale2, "placeholder": dateInputPlaceholder, "showClear": true, "disabledTime": disabledTime, "disabledDate": disabledDate, "onClear": this.onClear, "prefixCls": prefixCls2, "selectedValue": sSelectedValue, "onChange": this.onDateInputChange, "clearIcon": clearIcon, "onSelect": this.onDateInputSelect, "inputMode": inputMode, "inputReadOnly": inputReadOnly }, null) : null; var children = []; if (props2.renderSidebar) { children.push(props2.renderSidebar()); } children.push(createVNode("div", { "class": "".concat(prefixCls2, "-panel"), "key": "panel" }, [dateInputElement, createVNode("div", { "tabindex": props2.focusablePanel ? 0 : void 0, "class": "".concat(prefixCls2, "-date-panel") }, [createVNode(CalendarHeader$1, { "locale": locale2, "mode": sMode, "value": sValue, "onValueChange": this.setValue, "onPanelChange": this.onPanelChange, "renderFooter": renderFooter5, "showTimePicker": showTimePicker, "prefixCls": prefixCls2, "monthCellRender": monthCellRender, "monthCellContentRender": monthCellContentRender }, null), timePicker && showTimePicker ? createVNode("div", { "class": "".concat(prefixCls2, "-time-picker") }, [createVNode("div", { "class": "".concat(prefixCls2, "-time-picker-panel") }, [timePickerEle])]) : null, createVNode("div", { "class": "".concat(prefixCls2, "-body") }, [createVNode(DateTable$1, { "locale": locale2, "value": sValue, "selectedValue": sSelectedValue, "prefixCls": prefixCls2, "dateRender": props2.dateRender, "onSelect": this.onDateTableSelect, "disabledDate": disabledDate, "showWeekNumber": props2.showWeekNumber }, null)]), createVNode(CalendarFooter$1, { "showOk": props2.showOk, "mode": sMode, "renderFooter": props2.renderFooter, "locale": locale2, "prefixCls": prefixCls2, "showToday": props2.showToday, "disabledTime": disabledTime, "showTimePicker": showTimePicker, "showDateInput": props2.showDateInput, "timePicker": timePicker, "selectedValue": sSelectedValue, "timePickerDisabled": !sSelectedValue, "value": sValue, "disabledDate": disabledDate, "okDisabled": props2.showOk !== false && (!sSelectedValue || !this.isAllowedDate(sSelectedValue)), "onOk": this.onOk, "onSelect": this.onSelect, "onToday": this.onToday, "onOpenTimePicker": this.openTimePicker, "onCloseTimePicker": this.closeTimePicker }, null)])])); return this.renderRoot({ children, class: props2.showWeekNumber ? "".concat(prefixCls2, "-week-number") : "" }); } }); var Calendar$1 = Calendar; var MonthCalendar = defineComponent({ name: "MonthCalendar", mixins: [BaseMixin, CommonMixin, CalendarMixin$1], inheritAttrs: false, props: { locale: PropsTypes.object.def(enUs), format: PropsTypes.string, visible: PropsTypes.looseBool.def(true), prefixCls: PropsTypes.string.def("rc-calendar"), monthCellRender: PropsTypes.func, value: PropsTypes.object, defaultValue: PropsTypes.object, selectedValue: PropsTypes.object, defaultSelectedValue: PropsTypes.object, disabledDate: PropsTypes.func, monthCellContentRender: PropsTypes.func, renderFooter: PropsTypes.func.def(function() { return null; }), renderSidebar: PropsTypes.func.def(function() { return null; }) }, data: function data25() { var props2 = this.$props; return { mode: "month", sValue: props2.value || props2.defaultValue || hooks(), sSelectedValue: props2.selectedValue || props2.defaultSelectedValue }; }, methods: { onKeyDown: function onKeyDown3(event) { var keyCode = event.keyCode; var ctrlKey = event.ctrlKey || event.metaKey; var stateValue = this.sValue; var disabledDate = this.disabledDate; var value24 = stateValue; switch (keyCode) { case KeyCode$1.DOWN: value24 = stateValue.clone(); value24.add(3, "months"); break; case KeyCode$1.UP: value24 = stateValue.clone(); value24.add(-3, "months"); break; case KeyCode$1.LEFT: value24 = stateValue.clone(); if (ctrlKey) { value24.add(-1, "years"); } else { value24.add(-1, "months"); } break; case KeyCode$1.RIGHT: value24 = stateValue.clone(); if (ctrlKey) { value24.add(1, "years"); } else { value24.add(1, "months"); } break; case KeyCode$1.ENTER: if (!disabledDate || !disabledDate(stateValue)) { this.onSelect(stateValue); } event.preventDefault(); return 1; default: return void 0; } if (value24 !== stateValue) { this.setValue(value24); event.preventDefault(); return 1; } }, handlePanelChange: function handlePanelChange(_2, mode3) { if (mode3 !== "date") { this.setState({ mode: mode3 }); } } }, render: function render47() { var mode3 = this.mode, value24 = this.sValue, props2 = this.$props, $slots = this.$slots; var prefixCls2 = props2.prefixCls, locale2 = props2.locale, disabledDate = props2.disabledDate; var monthCellRender = this.monthCellRender || $slots.monthCellRender; var monthCellContentRender = this.monthCellContentRender || $slots.monthCellContentRender; var renderFooter5 = this.renderFooter || $slots.renderFooter; var children = createVNode("div", { "class": "".concat(prefixCls2, "-month-calendar-content") }, [createVNode("div", { "class": "".concat(prefixCls2, "-month-header-wrap") }, [createVNode(CalendarHeader$1, { "prefixCls": prefixCls2, "mode": mode3, "value": value24, "locale": locale2, "disabledMonth": disabledDate, "monthCellRender": monthCellRender, "monthCellContentRender": monthCellContentRender, "onMonthSelect": this.onSelect, "onValueChange": this.setValue, "onPanelChange": this.handlePanelChange }, null)]), createVNode(CalendarFooter$1, { "prefixCls": prefixCls2, "renderFooter": renderFooter5 }, null)]); return this.renderRoot({ class: "".concat(props2.prefixCls, "-month-calendar"), children }); } }); var MonthCalendar$1 = MonthCalendar; function createChainedFunction() { var args = [].slice.call(arguments, 0); if (args.length === 1) { return args[0]; } return function chainedFunction() { for (var i2 = 0; i2 < args.length; i2++) { if (args[i2] && args[i2].apply) { args[i2].apply(this, arguments); } } }; } var autoAdjustOverflow$1 = { adjustX: 1, adjustY: 1 }; var targetOffset$1 = [0, 0]; var placements$2 = { bottomLeft: { points: ["tl", "tl"], overflow: autoAdjustOverflow$1, offset: [0, -3], targetOffset: targetOffset$1 }, bottomRight: { points: ["tr", "tr"], overflow: autoAdjustOverflow$1, offset: [0, -3], targetOffset: targetOffset$1 }, topRight: { points: ["br", "br"], overflow: autoAdjustOverflow$1, offset: [0, 3], targetOffset: targetOffset$1 }, topLeft: { points: ["bl", "bl"], overflow: autoAdjustOverflow$1, offset: [0, 3], targetOffset: targetOffset$1 } }; var placements$3 = placements$2; var TimeType = { validator: function validator3(value24) { if (Array.isArray(value24)) { return value24.length === 0 || value24.findIndex(function(val) { return !isNil(val) && !hooks.isMoment(val); }) === -1; } else { return isNil(value24) || hooks.isMoment(value24); } } }; function refFn$1(field, component) { this[field] = component; } var Picker = defineComponent({ name: "Picker", mixins: [BaseMixin], inheritAttrs: false, props: { animation: PropsTypes.oneOfType([PropsTypes.func, PropsTypes.string]), disabled: PropsTypes.looseBool, transitionName: PropsTypes.string, format: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.array, PropsTypes.func]), getCalendarContainer: PropsTypes.func, calendar: PropsTypes.any, open: PropsTypes.looseBool, defaultOpen: PropsTypes.looseBool.def(false), prefixCls: PropsTypes.string.def("rc-calendar-picker"), placement: PropsTypes.any.def("bottomLeft"), value: TimeType, defaultValue: TimeType, align: PropsTypes.object.def(function() { return {}; }), dropdownClassName: PropsTypes.string, dateRender: PropsTypes.func, children: PropsTypes.func }, data: function data26() { var props2 = this.$props; this.calendarElement = null; this.saveCalendarRef = refFn$1.bind(this, "calendarInstance"); var open6; if (hasProp(this, "open")) { open6 = props2.open; } else { open6 = props2.defaultOpen; } var value24 = props2.value || props2.defaultValue; return { sOpen: open6, sValue: value24 }; }, watch: { value: function value16(val) { this.setState({ sValue: val }); }, open: function open2(val) { this.setState({ sOpen: val }); } }, mounted: function mounted13() { this.preSOpen = this.sOpen; }, updated: function updated6() { if (!this.preSOpen && this.sOpen) { this.focusTimeout = setTimeout(this.focusCalendar, 100); } this.preSOpen = this.sOpen; }, beforeUnmount: function beforeUnmount8() { clearTimeout(this.focusTimeout); }, methods: { onCalendarKeyDown: function onCalendarKeyDown(event) { if (event.keyCode === KeyCode$1.ESC) { event.stopPropagation(); this.closeCalendar(this.focus); } }, onCalendarSelect: function onCalendarSelect(value24) { var cause = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var props2 = this.$props; if (!hasProp(this, "value")) { this.setState({ sValue: value24 }); } var calendarProps = getOptionProps(props2.calendar); if (cause.source === "keyboard" || cause.source === "dateInputSelect" || !calendarProps.timePicker && cause.source !== "dateInput" || cause.source === "todayButton") { this.closeCalendar(this.focus); } this.__emit("change", value24); }, onKeyDown: function onKeyDown4(event) { if (!this.sOpen && (event.keyCode === KeyCode$1.DOWN || event.keyCode === KeyCode$1.ENTER)) { this.openCalendar(); event.preventDefault(); } }, onCalendarOk: function onCalendarOk() { this.closeCalendar(this.focus); }, onCalendarClear: function onCalendarClear() { this.closeCalendar(this.focus); }, onCalendarBlur: function onCalendarBlur() { this.setOpen(false); }, onVisibleChange: function onVisibleChange3(open6) { this.setOpen(open6); }, getCalendarElement: function getCalendarElement() { var props2 = this.$props; var calendarProps = getOptionProps(props2.calendar); var calendarEvents = getEvents(props2.calendar); var value24 = this.sValue; var defaultValue = value24; var extraProps = { ref: this.saveCalendarRef, defaultValue: defaultValue || calendarProps.defaultValue, selectedValue: value24, onKeydown: this.onCalendarKeyDown, onOk: createChainedFunction(calendarEvents.onOk, this.onCalendarOk), onSelect: createChainedFunction(calendarEvents.onSelect, this.onCalendarSelect), onClear: createChainedFunction(calendarEvents.onClear, this.onCalendarClear), onBlur: createChainedFunction(calendarEvents.onBlur, this.onCalendarBlur) }; return cloneElement(props2.calendar, extraProps); }, setOpen: function setOpen(open6, callback2) { if (this.sOpen !== open6) { if (!hasProp(this, "open")) { this.setState({ sOpen: open6 }, callback2); } this.__emit("openChange", open6); } }, openCalendar: function openCalendar(callback2) { this.setOpen(true, callback2); }, closeCalendar: function closeCalendar(callback2) { this.setOpen(false, callback2); }, focus: function focus12() { if (!this.sOpen) { findDOMNode(this).focus(); } }, focusCalendar: function focusCalendar() { if (this.sOpen && !!this.calendarInstance) { this.calendarInstance.focus(); } } }, render: function render48() { var _this = this; var props2 = getOptionProps(this); var prefixCls2 = props2.prefixCls, placement2 = props2.placement, getCalendarContainer = props2.getCalendarContainer, align = props2.align, animation2 = props2.animation, disabled = props2.disabled, dropdownClassName = props2.dropdownClassName, transitionName2 = props2.transitionName; var sValue = this.sValue, sOpen2 = this.sOpen; var childrenState = { value: sValue, open: sOpen2 }; var children = this.$slots.default(childrenState); if (this.sOpen || !this.calendarElement) { this.calendarElement = this.getCalendarElement(); } return createVNode(Trigger, { "popupAlign": align, "builtinPlacements": placements$3, "popupPlacement": placement2, "action": disabled && !sOpen2 ? [] : ["click"], "destroyPopupOnHide": true, "getPopupContainer": getCalendarContainer, "popupStyle": this.$attrs.style || {}, "popupAnimation": animation2, "popupTransitionName": transitionName2, "popupVisible": sOpen2, "onPopupVisibleChange": this.onVisibleChange, "prefixCls": prefixCls2, "popupClassName": dropdownClassName, "popup": this.calendarElement }, { default: function _default8() { return [cloneElement(children, { onKeydown: _this.onKeyDown })]; } }); } }); var VcDatePicker = Picker; var CalendarOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z" } }] }, "name": "calendar", "theme": "outlined" }; var CalendarOutlinedSvg = CalendarOutlined$2; function _objectSpread$E(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$F(target, key2, source2[key2]); }); } return target; } function _defineProperty$F(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CalendarOutlined = function CalendarOutlined2(props2, context2) { var p = _objectSpread$E({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$E({}, p, { "icon": CalendarOutlinedSvg }), null); }; CalendarOutlined.displayName = "CalendarOutlined"; CalendarOutlined.inheritAttrs = false; var CalendarOutlined$1 = CalendarOutlined; function formatDate(value24, format3) { if (!value24) { return ""; } if (Array.isArray(format3)) { format3 = format3[0]; } if (typeof format3 === "function") { return format3(value24); } return value24.format(format3); } function createPicker(TheCalendar, props2, name) { return defineComponent({ name, mixins: [BaseMixin], inheritAttrs: false, props: _extends$1(_extends$1({}, props2), { allowClear: PropsTypes.looseBool.def(true), showToday: PropsTypes.looseBool.def(true) }), setup: function setup123() { return { configProvider: inject("configProvider", defaultConfigProvider), input: void 0, sPrefixCls: void 0 }; }, data: function data65() { var value24 = this.value || this.defaultValue; return { sValue: value24, showDate: value24, sOpen: !!this.open }; }, watch: { open: function open6(val) { var props3 = getOptionProps(this); var state = {}; state.sOpen = val; if ("value" in props3 && !val && props3.value !== this.showDate) { state.showDate = props3.value; } this.setState(state); }, value: function value24(val) { var state = {}; state.sValue = val; if (val !== this.sValue) { state.showDate = val; } this.setState(state); }, sOpen: function sOpen2(val, oldVal) { var _this = this; nextTick(function() { if (!hasProp(_this, "open") && oldVal && !val) { _this.focus(); } }); } }, methods: { saveInput: function saveInput7(node) { this.input = node; }, clearSelection: function clearSelection4(e2) { e2.preventDefault(); e2.stopPropagation(); this.handleChange(null); }, handleChange: function handleChange17(value24) { if (!hasProp(this, "value")) { this.setState({ sValue: value24, showDate: value24 }); } this.$emit("change", value24, formatDate(value24, this.format)); }, handleCalendarChange: function handleCalendarChange(value24) { this.setState({ showDate: value24 }); }, handleOpenChange: function handleOpenChange3(open6) { var props3 = getOptionProps(this); if (!("open" in props3)) { this.setState({ sOpen: open6 }); } this.$emit("openChange", open6); }, focus: function focus25() { var _a3; (_a3 = this.input) === null || _a3 === void 0 ? void 0 : _a3.focus(); }, blur: function blur22() { var _a3; (_a3 = this.input) === null || _a3 === void 0 ? void 0 : _a3.blur(); }, renderFooter: function renderFooter5() { var $slots = this.$slots, prefixCls2 = this.sPrefixCls; var renderExtraFooter = this.renderExtraFooter || $slots.renderExtraFooter; return renderExtraFooter ? createVNode("div", { "class": "".concat(prefixCls2, "-footer-extra") }, [typeof renderExtraFooter === "function" ? renderExtraFooter.apply(void 0, arguments) : renderExtraFooter]) : null; }, onMouseEnter: function onMouseEnter4(e2) { this.$emit("mouseenter", e2); }, onMouseLeave: function onMouseLeave5(e2) { this.$emit("mouseleave", e2); } }, render: function render123() { var _classNames, _this2 = this; var $slots = this.$slots; var _this$$data = this.$data, value24 = _this$$data.sValue, showDate = _this$$data.showDate, open6 = _this$$data.sOpen; var suffixIcon = getComponent(this, "suffixIcon"); suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon; var props3 = omit$2(_extends$1(_extends$1({}, getOptionProps(this)), this.$attrs), ["onChange"]); var customizePrefixCls = props3.prefixCls, locale2 = props3.locale, localeCode = props3.localeCode, inputReadOnly = props3.inputReadOnly; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("calendar", customizePrefixCls); this.sPrefixCls = prefixCls2; var dateRender = props3.dateRender || $slots.dateRender; var monthCellContentRender = props3.monthCellContentRender || $slots.monthCellContentRender; var placeholder = "placeholder" in props3 ? props3.placeholder : locale2.lang.placeholder; var disabledTime = props3.showTime ? props3.disabledTime : null; var calendarClassName = classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-time"), props3.showTime), _defineProperty$12(_classNames, "".concat(prefixCls2, "-month"), MonthCalendar$1 === TheCalendar), _classNames)); if (value24 && localeCode) { value24.locale(localeCode); } var pickerProps2 = {}; var calendarProps = {}; var pickerStyle = {}; if (props3.showTime) { calendarProps.onSelect = this.handleChange; pickerStyle.minWidth = "195px"; } else { pickerProps2.onChange = this.handleChange; } if ("mode" in props3) { calendarProps.mode = props3.mode; } var theCalendarProps = _extends$1(_extends$1({}, calendarProps), { disabledDate: props3.disabledDate, disabledTime, locale: locale2.lang, timePicker: props3.timePicker, defaultValue: props3.defaultPickerValue || interopDefault(hooks)(), dateInputPlaceholder: placeholder, prefixCls: prefixCls2, dateRender, format: props3.format, showToday: props3.showToday, monthCellContentRender, renderFooter: this.renderFooter, value: showDate, inputReadOnly, onOk: props3.onOk, onPanelChange: props3.onPanelChange, onChange: this.handleCalendarChange, class: calendarClassName }); var calendar2 = createVNode(TheCalendar, theCalendarProps, $slots); var clearIcon = !props3.disabled && props3.allowClear && value24 ? createVNode(CloseCircleFilled$3, { "class": "".concat(prefixCls2, "-picker-clear"), "onClick": this.clearSelection }, null) : null; var inputIcon = suffixIcon && (isValidElement(suffixIcon) ? cloneElement(suffixIcon, { class: "".concat(prefixCls2, "-picker-icon") }) : createVNode("span", { "class": "".concat(prefixCls2, "-picker-icon") }, [suffixIcon])) || createVNode(CalendarOutlined$1, { "class": "".concat(prefixCls2, "-picker-icon") }, null); var input = function input2(_ref) { var inputValue = _ref.value; return createVNode("div", null, [createVNode("input", { "ref": _this2.saveInput, "disabled": props3.disabled, "onFocus": props3.onFocus, "onBlur": props3.onBlur, "readonly": true, "value": formatDate(inputValue, _this2.format), "placeholder": placeholder, "class": props3.pickerInputClass, "tabindex": props3.tabindex, "name": _this2.name }, null), clearIcon, inputIcon]); }; var vcDatePickerProps = _extends$1(_extends$1(_extends$1({}, props3), pickerProps2), { calendar: calendar2, value: value24, prefixCls: "".concat(prefixCls2, "-picker-container"), open: open6, onOpenChange: this.handleOpenChange, style: props3.popupStyle }); return createVNode("span", _objectSpread2$2(_objectSpread2$2({ "id": props3.id, "class": classNames(props3.class, props3.pickerClass), "style": _extends$1(_extends$1({}, pickerStyle), props3.style) }, getDataAndAriaProps$1(this.$attrs)), {}, { "onMouseenter": this.onMouseEnter, "onMouseleave": this.onMouseLeave }), [createVNode(VcDatePicker, vcDatePickerProps, _extends$1(_extends$1({}, $slots), { default: isEmptySlot($slots.default) ? input : $slots.default }))]); } }); } var Header = { inheritAttrs: false, name: "Header", mixins: [BaseMixin], props: { format: PropsTypes.string, prefixCls: PropsTypes.string, disabledDate: PropsTypes.func, placeholder: PropsTypes.string, clearText: PropsTypes.string, value: PropsTypes.object, inputReadOnly: PropsTypes.looseBool.def(false), hourOptions: PropsTypes.array, minuteOptions: PropsTypes.array, secondOptions: PropsTypes.array, disabledHours: PropsTypes.func, disabledMinutes: PropsTypes.func, disabledSeconds: PropsTypes.func, allowEmpty: PropsTypes.looseBool, defaultOpenValue: PropsTypes.object, currentSelectPanel: PropsTypes.string, focusOnOpen: PropsTypes.looseBool, clearIcon: PropsTypes.any }, data: function data27() { var value24 = this.value, format3 = this.format; return { str: value24 && value24.format(format3) || "", invalid: false }; }, mounted: function mounted14() { var _this = this; if (this.focusOnOpen) { var requestAnimationFrame2 = window.requestAnimationFrame || window.setTimeout; requestAnimationFrame2(function() { _this.refInput.focus(); _this.refInput.select(); }); } }, watch: { value: function value17(val) { var _this2 = this; this.$nextTick(function() { _this2.setState({ str: val && val.format(_this2.format) || "", invalid: false }); }); } }, methods: { onInputChange: function onInputChange2(e2) { var _e$target = e2.target, str = _e$target.value, composing = _e$target.composing; var _this$str = this.str, oldStr = _this$str === void 0 ? "" : _this$str; if (e2.isComposing || composing || oldStr === str) return; this.setState({ str }); var format3 = this.format, hourOptions = this.hourOptions, minuteOptions = this.minuteOptions, secondOptions = this.secondOptions, disabledHours3 = this.disabledHours, disabledMinutes2 = this.disabledMinutes, disabledSeconds2 = this.disabledSeconds, originalValue = this.value; if (str) { var value24 = this.getProtoValue().clone(); var parsed = hooks(str, format3, true); if (!parsed.isValid()) { this.setState({ invalid: true }); return; } value24.hour(parsed.hour()).minute(parsed.minute()).second(parsed.second()); if (hourOptions.indexOf(value24.hour()) < 0 || minuteOptions.indexOf(value24.minute()) < 0 || secondOptions.indexOf(value24.second()) < 0) { this.setState({ invalid: true }); return; } var disabledHourOptions = disabledHours3(); var disabledMinuteOptions = disabledMinutes2(value24.hour()); var disabledSecondOptions = disabledSeconds2(value24.hour(), value24.minute()); if (disabledHourOptions && disabledHourOptions.indexOf(value24.hour()) >= 0 || disabledMinuteOptions && disabledMinuteOptions.indexOf(value24.minute()) >= 0 || disabledSecondOptions && disabledSecondOptions.indexOf(value24.second()) >= 0) { this.setState({ invalid: true }); return; } if (originalValue) { if (originalValue.hour() !== value24.hour() || originalValue.minute() !== value24.minute() || originalValue.second() !== value24.second()) { var changedValue = originalValue.clone(); changedValue.hour(value24.hour()); changedValue.minute(value24.minute()); changedValue.second(value24.second()); this.__emit("change", changedValue); } } else if (originalValue !== value24) { this.__emit("change", value24); } } else { this.__emit("change", null); } this.setState({ invalid: false }); }, onKeyDown: function onKeyDown5(e2) { if (e2.keyCode === 27) { this.__emit("esc"); } this.__emit("keydown", e2); }, getProtoValue: function getProtoValue() { return this.value || this.defaultOpenValue; }, getInput: function getInput() { var _this3 = this; var prefixCls2 = this.prefixCls, placeholder = this.placeholder, inputReadOnly = this.inputReadOnly, invalid = this.invalid, str = this.str; var invalidClass = invalid ? "".concat(prefixCls2, "-input-invalid") : ""; return withDirectives(createVNode("input", { "class": "".concat(prefixCls2, "-input ").concat(invalidClass), "ref": function ref2(_ref) { _this3.refInput = _ref; }, "onKeydown": this.onKeyDown, "value": str, "placeholder": placeholder, "onInput": this.onInputChange, "onChange": this.onInputChange, "readonly": !!inputReadOnly }, null), [[antInput$1]]); } }, render: function render49() { var prefixCls2 = this.prefixCls; return createVNode("div", { "class": "".concat(prefixCls2, "-input-wrap") }, [this.getInput()]); } }; var Header$1 = Header; function noop$g() { } var scrollTo = function scrollTo2(element, to2, duration2) { if (duration2 <= 0) { requestAnimationFrame(function() { element.scrollTop = to2; }); return; } var difference = to2 - element.scrollTop; var perTick = difference / duration2 * 10; requestAnimationFrame(function() { element.scrollTop += perTick; if (element.scrollTop === to2) return; scrollTo2(element, to2, duration2 - 10); }); }; var Select$2 = { name: "Select", mixins: [BaseMixin], inheritAttrs: false, props: { prefixCls: PropsTypes.string, options: PropsTypes.array, selectedIndex: PropsTypes.number, type: PropsTypes.string }, data: function data28() { return { active: false }; }, mounted: function mounted15() { var _this = this; this.$nextTick(function() { _this.scrollToSelected(0); }); }, watch: { selectedIndex: function selectedIndex() { var _this2 = this; this.$nextTick(function() { _this2.scrollToSelected(120); }); } }, methods: { onSelect: function onSelect3(value24) { var type2 = this.type; this.__emit("select", type2, value24); }, onEsc: function onEsc(e2) { this.__emit("esc", e2); }, getOptions: function getOptions3() { var _this3 = this; var options2 = this.options, selectedIndex2 = this.selectedIndex, prefixCls2 = this.prefixCls; return options2.map(function(item, index2) { var _classnames; var cls = classNames((_classnames = {}, _defineProperty$12(_classnames, "".concat(prefixCls2, "-select-option-selected"), selectedIndex2 === index2), _defineProperty$12(_classnames, "".concat(prefixCls2, "-select-option-disabled"), item.disabled), _classnames)); var onClick7 = item.disabled ? noop$g : function() { _this3.onSelect(item.value); }; var onKeyDown11 = function onKeyDown12(e2) { if (e2.keyCode === 13) onClick7(); else if (e2.keyCode === 27) _this3.onEsc(); }; return createVNode("li", { "role": "button", "onClick": onClick7, "class": cls, "key": index2, "disabled": item.disabled, "tabindex": "0", "onKeydown": onKeyDown11 }, [item.value]); }); }, handleMouseEnter: function handleMouseEnter(e2) { this.setState({ active: true }); this.__emit("mouseenter", e2); }, handleMouseLeave: function handleMouseLeave() { this.setState({ active: false }); }, scrollToSelected: function scrollToSelected(duration2) { var select2 = findDOMNode(this); var list = this.$refs.list; if (!list) { return; } var index2 = this.selectedIndex; if (index2 < 0) { index2 = 0; } var topOption = list.children[index2]; var to2 = topOption.offsetTop; scrollTo(select2, to2, duration2); } }, render: function render50() { var _cls; var prefixCls2 = this.prefixCls, options2 = this.options, active = this.active; if (options2.length === 0) { return null; } var cls = (_cls = {}, _defineProperty$12(_cls, "".concat(prefixCls2, "-select"), 1), _defineProperty$12(_cls, "".concat(prefixCls2, "-select-active"), active), _cls); return createVNode("div", { "class": cls, "onMouseenter": this.handleMouseEnter, "onMouseleave": this.handleMouseLeave }, [createVNode("ul", { "ref": "list" }, [this.getOptions()])]); } }; var Select$3 = Select$2; var formatOption = function formatOption2(option, disabledOptions) { var value24 = "".concat(option); if (option < 10) { value24 = "0".concat(option); } var disabled = false; if (disabledOptions && disabledOptions.indexOf(option) >= 0) { disabled = true; } return { value: value24, disabled }; }; var Combobox = { inheritAttrs: false, mixins: [BaseMixin], name: "Combobox", props: { format: PropsTypes.string, defaultOpenValue: PropsTypes.object, prefixCls: PropsTypes.string, value: PropsTypes.object, showHour: PropsTypes.looseBool, showMinute: PropsTypes.looseBool, showSecond: PropsTypes.looseBool, hourOptions: PropsTypes.array, minuteOptions: PropsTypes.array, secondOptions: PropsTypes.array, disabledHours: PropsTypes.func, disabledMinutes: PropsTypes.func, disabledSeconds: PropsTypes.func, use12Hours: PropsTypes.looseBool, isAM: PropsTypes.looseBool }, methods: { onItemChange: function onItemChange(type2, itemValue) { var defaultOpenValue = this.defaultOpenValue, use12Hours = this.use12Hours, propValue = this.value, isAM2 = this.isAM; var value24 = (propValue || defaultOpenValue).clone(); if (type2 === "hour") { if (use12Hours) { if (isAM2) { value24.hour(+itemValue % 12); } else { value24.hour(+itemValue % 12 + 12); } } else { value24.hour(+itemValue); } } else if (type2 === "minute") { value24.minute(+itemValue); } else if (type2 === "ampm") { var ampm = itemValue.toUpperCase(); if (use12Hours) { if (ampm === "PM" && value24.hour() < 12) { value24.hour(value24.hour() % 12 + 12); } if (ampm === "AM") { if (value24.hour() >= 12) { value24.hour(value24.hour() - 12); } } } this.__emit("amPmChange", ampm); } else { value24.second(+itemValue); } this.__emit("change", value24); }, onEnterSelectPanel: function onEnterSelectPanel(range2) { this.__emit("currentSelectPanelChange", range2); }, onEsc: function onEsc2(e2) { this.__emit("esc", e2); }, getHourSelect: function getHourSelect(hour2) { var _this = this; var prefixCls2 = this.prefixCls, hourOptions = this.hourOptions, disabledHours3 = this.disabledHours, showHour = this.showHour, use12Hours = this.use12Hours; if (!showHour) { return null; } var disabledOptions = disabledHours3(); var hourOptionsAdj; var hourAdj; if (use12Hours) { hourOptionsAdj = [12].concat(hourOptions.filter(function(h2) { return h2 < 12 && h2 > 0; })); hourAdj = hour2 % 12 || 12; } else { hourOptionsAdj = hourOptions; hourAdj = hour2; } return createVNode(Select$3, { "prefixCls": prefixCls2, "options": hourOptionsAdj.map(function(option) { return formatOption(option, disabledOptions); }), "selectedIndex": hourOptionsAdj.indexOf(hourAdj), "type": "hour", "onSelect": this.onItemChange, "onMouseenter": function onMouseenter2() { return _this.onEnterSelectPanel("hour"); }, "onEsc": this.onEsc }, null); }, getMinuteSelect: function getMinuteSelect(minute) { var _this2 = this; var prefixCls2 = this.prefixCls, minuteOptions = this.minuteOptions, disabledMinutes2 = this.disabledMinutes, defaultOpenValue = this.defaultOpenValue, showMinute = this.showMinute, propValue = this.value; if (!showMinute) { return null; } var value24 = propValue || defaultOpenValue; var disabledOptions = disabledMinutes2(value24.hour()); return createVNode(Select$3, { "prefixCls": prefixCls2, "options": minuteOptions.map(function(option) { return formatOption(option, disabledOptions); }), "selectedIndex": minuteOptions.indexOf(minute), "type": "minute", "onSelect": this.onItemChange, "onMouseenter": function onMouseenter2() { return _this2.onEnterSelectPanel("minute"); }, "onEsc": this.onEsc }, null); }, getSecondSelect: function getSecondSelect(second) { var _this3 = this; var prefixCls2 = this.prefixCls, secondOptions = this.secondOptions, disabledSeconds2 = this.disabledSeconds, showSecond = this.showSecond, defaultOpenValue = this.defaultOpenValue, propValue = this.value; if (!showSecond) { return null; } var value24 = propValue || defaultOpenValue; var disabledOptions = disabledSeconds2(value24.hour(), value24.minute()); return createVNode(Select$3, { "prefixCls": prefixCls2, "options": secondOptions.map(function(option) { return formatOption(option, disabledOptions); }), "selectedIndex": secondOptions.indexOf(second), "type": "second", "onSelect": this.onItemChange, "onMouseenter": function onMouseenter2() { return _this3.onEnterSelectPanel("second"); }, "onEsc": this.onEsc }, null); }, getAMPMSelect: function getAMPMSelect() { var _this4 = this; var prefixCls2 = this.prefixCls, use12Hours = this.use12Hours, format3 = this.format, isAM2 = this.isAM; if (!use12Hours) { return null; } var AMPMOptions = ["am", "pm"].map(function(c2) { return format3.match(/\sA/) ? c2.toUpperCase() : c2; }).map(function(c2) { return { value: c2 }; }); var selected = isAM2 ? 0 : 1; return createVNode(Select$3, { "prefixCls": prefixCls2, "options": AMPMOptions, "selectedIndex": selected, "type": "ampm", "onSelect": this.onItemChange, "onMouseenter": function onMouseenter2() { return _this4.onEnterSelectPanel("ampm"); }, "onEsc": this.onEsc }, null); } }, render: function render51() { var prefixCls2 = this.prefixCls, defaultOpenValue = this.defaultOpenValue, propValue = this.value; var value24 = propValue || defaultOpenValue; return createVNode("div", { "class": "".concat(prefixCls2, "-combobox") }, [this.getHourSelect(value24.hour()), this.getMinuteSelect(value24.minute()), this.getSecondSelect(value24.second()), this.getAMPMSelect(value24.hour())]); } }; var Combobox$1 = Combobox; function noop$f() { } function generateOptions$1(length, disabledOptions, hideDisabledOptions) { var step = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1; var arr = []; for (var value24 = 0; value24 < length; value24 += step) { if (!disabledOptions || disabledOptions.indexOf(value24) < 0 || !hideDisabledOptions) { arr.push(value24); } } return arr; } function toNearestValidTime(time, hourOptions, minuteOptions, secondOptions) { var hour2 = hourOptions.slice().sort(function(a2, b2) { return Math.abs(time.hour() - a2) - Math.abs(time.hour() - b2); })[0]; var minute = minuteOptions.slice().sort(function(a2, b2) { return Math.abs(time.minute() - a2) - Math.abs(time.minute() - b2); })[0]; var second = secondOptions.slice().sort(function(a2, b2) { return Math.abs(time.second() - a2) - Math.abs(time.second() - b2); })[0]; return hooks("".concat(hour2, ":").concat(minute, ":").concat(second), "HH:mm:ss"); } var Panel = defineComponent({ name: "Panel", mixins: [BaseMixin], inheritAttrs: false, props: { clearText: PropsTypes.string, prefixCls: PropsTypes.string.def("rc-time-picker-panel"), defaultOpenValue: { type: Object, default: function _default4() { return hooks(); } }, value: PropsTypes.any, defaultValue: PropsTypes.any, placeholder: PropsTypes.string, format: PropsTypes.string, inputReadOnly: PropsTypes.looseBool.def(false), disabledHours: PropsTypes.func.def(noop$f), disabledMinutes: PropsTypes.func.def(noop$f), disabledSeconds: PropsTypes.func.def(noop$f), hideDisabledOptions: PropsTypes.looseBool, allowEmpty: PropsTypes.looseBool, showHour: PropsTypes.looseBool, showMinute: PropsTypes.looseBool, showSecond: PropsTypes.looseBool, use12Hours: PropsTypes.looseBool.def(false), hourStep: PropsTypes.number, minuteStep: PropsTypes.number, secondStep: PropsTypes.number, addon: PropsTypes.func.def(noop$f), focusOnOpen: PropsTypes.looseBool, clearIcon: PropsTypes.any }, data: function data29() { return { sValue: this.value, selectionRange: [], currentSelectPanel: "" }; }, watch: { value: function value18(val) { this.setState({ sValue: val }); } }, methods: { onChange: function onChange(newValue) { this.setState({ sValue: newValue }); this.__emit("change", newValue); }, onAmPmChange: function onAmPmChange(ampm) { this.__emit("amPmChange", ampm); }, onCurrentSelectPanelChange: function onCurrentSelectPanelChange(currentSelectPanel) { this.setState({ currentSelectPanel }); }, close: function close2() { this.__emit("esc"); }, onEsc: function onEsc3(e2) { this.__emit("esc", e2); }, disabledHours2: function disabledHours2() { var use12Hours = this.use12Hours, disabledHours3 = this.disabledHours; var disabledOptions = disabledHours3(); if (use12Hours && Array.isArray(disabledOptions)) { if (this.isAM()) { disabledOptions = disabledOptions.filter(function(h2) { return h2 < 12; }).map(function(h2) { return h2 === 0 ? 12 : h2; }); } else { disabledOptions = disabledOptions.map(function(h2) { return h2 === 12 ? 12 : h2 - 12; }); } } return disabledOptions; }, isAM: function isAM() { var value24 = this.sValue || this.defaultOpenValue; return value24.hour() >= 0 && value24.hour() < 12; } }, render: function render52() { var prefixCls2 = this.prefixCls, placeholder = this.placeholder, disabledMinutes2 = this.disabledMinutes, addon = this.addon, disabledSeconds2 = this.disabledSeconds, hideDisabledOptions = this.hideDisabledOptions, showHour = this.showHour, showMinute = this.showMinute, showSecond = this.showSecond, format3 = this.format, defaultOpenValue = this.defaultOpenValue, clearText = this.clearText, use12Hours = this.use12Hours, focusOnOpen = this.focusOnOpen, hourStep = this.hourStep, minuteStep = this.minuteStep, secondStep = this.secondStep, inputReadOnly = this.inputReadOnly, sValue = this.sValue, currentSelectPanel = this.currentSelectPanel; var _this$$attrs = this.$attrs, className = _this$$attrs.class, _this$$attrs$onEsc = _this$$attrs.onEsc, onEsc5 = _this$$attrs$onEsc === void 0 ? noop$f : _this$$attrs$onEsc, _this$$attrs$onKeydow = _this$$attrs.onKeydown, onKeydown2 = _this$$attrs$onKeydow === void 0 ? noop$f : _this$$attrs$onKeydow; var clearIcon = getComponent(this, "clearIcon"); var disabledHourOptions = this.disabledHours2(); var disabledMinuteOptions = disabledMinutes2(sValue ? sValue.hour() : null); var disabledSecondOptions = disabledSeconds2(sValue ? sValue.hour() : null, sValue ? sValue.minute() : null); var hourOptions = generateOptions$1(24, disabledHourOptions, hideDisabledOptions, hourStep); var minuteOptions = generateOptions$1(60, disabledMinuteOptions, hideDisabledOptions, minuteStep); var secondOptions = generateOptions$1(60, disabledSecondOptions, hideDisabledOptions, secondStep); var validDefaultOpenValue = toNearestValidTime(defaultOpenValue, hourOptions, minuteOptions, secondOptions); return createVNode("div", { "className": classNames(className, "".concat(prefixCls2, "-inner")) }, [createVNode(Header$1, { "clearText": clearText, "prefixCls": prefixCls2, "defaultOpenValue": validDefaultOpenValue, "value": sValue, "currentSelectPanel": currentSelectPanel, "onEsc": onEsc5, "format": format3, "placeholder": placeholder, "hourOptions": hourOptions, "minuteOptions": minuteOptions, "secondOptions": secondOptions, "disabledHours": this.disabledHours2, "disabledMinutes": disabledMinutes2, "disabledSeconds": disabledSeconds2, "onChange": this.onChange, "focusOnOpen": focusOnOpen, "onKeydown": onKeydown2, "inputReadOnly": inputReadOnly, "clearIcon": clearIcon }, null), createVNode(Combobox$1, { "prefixCls": prefixCls2, "value": sValue, "defaultOpenValue": validDefaultOpenValue, "format": format3, "onChange": this.onChange, "onAmPmChange": this.onAmPmChange, "showHour": showHour, "showMinute": showMinute, "showSecond": showSecond, "hourOptions": hourOptions, "minuteOptions": minuteOptions, "secondOptions": secondOptions, "disabledHours": this.disabledHours2, "disabledMinutes": disabledMinutes2, "disabledSeconds": disabledSeconds2, "onCurrentSelectPanelChange": this.onCurrentSelectPanelChange, "use12Hours": use12Hours, "onEsc": this.onEsc, "isAM": this.isAM() }, null), addon(this)]); } }); var TimePickerPanel = Panel; var autoAdjustOverflow = { adjustX: 1, adjustY: 1 }; var targetOffset = [0, 0]; var placements = { bottomLeft: { points: ["tl", "tl"], overflow: autoAdjustOverflow, offset: [0, -3], targetOffset }, bottomRight: { points: ["tr", "tr"], overflow: autoAdjustOverflow, offset: [0, -3], targetOffset }, topRight: { points: ["br", "br"], overflow: autoAdjustOverflow, offset: [0, 3], targetOffset }, topLeft: { points: ["bl", "bl"], overflow: autoAdjustOverflow, offset: [0, 3], targetOffset } }; var placements$1 = placements; function noop$e() { } function refFn(field, component) { this[field] = component; } var VcTimePicker = defineComponent({ name: "VcTimePicker", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$2({ prefixCls: PropsTypes.string, clearText: PropsTypes.string, value: PropsTypes.any, defaultOpenValue: { type: Object, default: function _default5() { return hooks(); } }, pickerInputClass: String, inputReadOnly: PropsTypes.looseBool, disabled: PropsTypes.looseBool, allowEmpty: PropsTypes.looseBool, defaultValue: PropsTypes.any, open: PropsTypes.looseBool, defaultOpen: PropsTypes.looseBool, align: PropsTypes.object, placement: PropsTypes.any, transitionName: PropsTypes.string, getPopupContainer: PropsTypes.func, placeholder: PropsTypes.string, format: PropsTypes.string, showHour: PropsTypes.looseBool, showMinute: PropsTypes.looseBool, showSecond: PropsTypes.looseBool, popupClassName: PropsTypes.string, popupStyle: PropsTypes.object, disabledHours: PropsTypes.func, disabledMinutes: PropsTypes.func, disabledSeconds: PropsTypes.func, hideDisabledOptions: PropsTypes.looseBool, name: PropsTypes.string, autocomplete: PropsTypes.string, use12Hours: PropsTypes.looseBool, hourStep: PropsTypes.number, minuteStep: PropsTypes.number, secondStep: PropsTypes.number, focusOnOpen: PropsTypes.looseBool, autofocus: PropsTypes.looseBool, id: PropsTypes.string, inputIcon: PropsTypes.any, clearIcon: PropsTypes.any, addon: PropsTypes.func }, { clearText: "clear", prefixCls: "rc-time-picker", defaultOpen: false, inputReadOnly: false, popupClassName: "", popupStyle: {}, align: {}, allowEmpty: true, showHour: true, showMinute: true, showSecond: true, disabledHours: noop$e, disabledMinutes: noop$e, disabledSeconds: noop$e, hideDisabledOptions: false, placement: "bottomLeft", use12Hours: false, focusOnOpen: false }), data: function data30() { this.saveInputRef = refFn.bind(this, "picker"); this.savePanelRef = refFn.bind(this, "panelInstance"); var defaultOpen = this.defaultOpen, defaultValue = this.defaultValue, _this$open = this.open, open6 = _this$open === void 0 ? defaultOpen : _this$open, _this$value = this.value, value24 = _this$value === void 0 ? defaultValue : _this$value; return { sOpen: open6, sValue: value24 }; }, watch: { value: function value19(val) { this.setState({ sValue: val }); }, open: function open3(val) { if (val !== void 0) { this.setState({ sOpen: val }); } } }, mounted: function mounted16() { var _this = this; this.$nextTick(function() { if (_this.autofocus) { _this.focus(); } }); }, methods: { onPanelChange: function onPanelChange2(value24) { this.setValue(value24); }, onAmPmChange: function onAmPmChange2(ampm) { this.__emit("amPmChange", ampm); }, onClear: function onClear3(event) { event.stopPropagation(); this.setValue(null); this.setOpen(false); }, onVisibleChange: function onVisibleChange4(open6) { this.setOpen(open6); }, onEsc: function onEsc4() { this.setOpen(false); this.focus(); }, onKeyDown: function onKeyDown6(e2) { if (e2.keyCode === 40) { this.setOpen(true); } }, onKeyDown2: function onKeyDown22(e2) { this.__emit("keydown", e2); }, setValue: function setValue6(value24) { if (!hasProp(this, "value")) { this.setState({ sValue: value24 }); } this.__emit("change", value24); }, getFormat: function getFormat2() { var format3 = this.format, showHour = this.showHour, showMinute = this.showMinute, showSecond = this.showSecond, use12Hours = this.use12Hours; if (format3) { return format3; } if (use12Hours) { var fmtString = [showHour ? "h" : "", showMinute ? "mm" : "", showSecond ? "ss" : ""].filter(function(item) { return !!item; }).join(":"); return fmtString.concat(" a"); } return [showHour ? "HH" : "", showMinute ? "mm" : "", showSecond ? "ss" : ""].filter(function(item) { return !!item; }).join(":"); }, getPanelElement: function getPanelElement() { var prefixCls2 = this.prefixCls, placeholder = this.placeholder, disabledHours3 = this.disabledHours, addon = this.addon, disabledMinutes2 = this.disabledMinutes, disabledSeconds2 = this.disabledSeconds, hideDisabledOptions = this.hideDisabledOptions, inputReadOnly = this.inputReadOnly, showHour = this.showHour, showMinute = this.showMinute, showSecond = this.showSecond, defaultOpenValue = this.defaultOpenValue, clearText = this.clearText, use12Hours = this.use12Hours, focusOnOpen = this.focusOnOpen, onKeyDown23 = this.onKeyDown2, hourStep = this.hourStep, minuteStep = this.minuteStep, secondStep = this.secondStep, sValue = this.sValue; var clearIcon = getComponent(this, "clearIcon"); return createVNode(TimePickerPanel, { "clearText": clearText, "prefixCls": "".concat(prefixCls2, "-panel"), "ref": this.savePanelRef, "value": sValue, "inputReadOnly": inputReadOnly, "onChange": this.onPanelChange, "onAmPmChange": this.onAmPmChange, "defaultOpenValue": defaultOpenValue, "showHour": showHour, "showMinute": showMinute, "showSecond": showSecond, "onEsc": this.onEsc, "format": this.getFormat(), "placeholder": placeholder, "disabledHours": disabledHours3, "disabledMinutes": disabledMinutes2, "disabledSeconds": disabledSeconds2, "hideDisabledOptions": hideDisabledOptions, "use12Hours": use12Hours, "hourStep": hourStep, "minuteStep": minuteStep, "secondStep": secondStep, "focusOnOpen": focusOnOpen, "onKeydown": onKeyDown23, "clearIcon": clearIcon, "addon": addon }, null); }, getPopupClassName: function getPopupClassName() { var showHour = this.showHour, showMinute = this.showMinute, showSecond = this.showSecond, use12Hours = this.use12Hours, prefixCls2 = this.prefixCls, popupClassName = this.popupClassName; var selectColumnCount = 0; if (showHour) { selectColumnCount += 1; } if (showMinute) { selectColumnCount += 1; } if (showSecond) { selectColumnCount += 1; } if (use12Hours) { selectColumnCount += 1; } return classNames(popupClassName, _defineProperty$12({}, "".concat(prefixCls2, "-panel-narrow"), (!showHour || !showMinute || !showSecond) && !use12Hours), "".concat(prefixCls2, "-panel-column-").concat(selectColumnCount)); }, setOpen: function setOpen2(open6) { if (this.sOpen !== open6) { if (!hasProp(this, "open")) { this.setState({ sOpen: open6 }); } if (open6) { this.__emit("open", { open: open6 }); } else { this.__emit("close", { open: open6 }); } } }, focus: function focus13() { this.picker.focus(); }, blur: function blur10() { this.picker.blur(); }, onFocus: function onFocus3(e2) { this.__emit("focus", e2); }, onBlur: function onBlur4(e2) { this.__emit("blur", e2); }, renderClearButton: function renderClearButton() { var _this2 = this; var sValue = this.sValue; var _this$$props = this.$props, prefixCls2 = _this$$props.prefixCls, allowEmpty = _this$$props.allowEmpty, clearText = _this$$props.clearText, disabled = _this$$props.disabled; if (!allowEmpty || !sValue || disabled) { return null; } var clearIcon = getComponent(this, "clearIcon"); if (isValidElement(clearIcon)) { var _ref = getEvents(clearIcon) || {}, _onClick = _ref.onClick; return cloneElement(clearIcon, { onClick: function onClick7() { if (_onClick) _onClick.apply(void 0, arguments); _this2.onClear.apply(_this2, arguments); } }); } return createVNode("a", { "role": "button", "class": "".concat(prefixCls2, "-clear"), "title": clearText, "onClick": this.onClear, "tabindex": 0 }, [clearIcon || createVNode("i", { "class": "".concat(prefixCls2, "-clear-icon") }, null)]); } }, render: function render53() { var _this3 = this; var prefixCls2 = this.prefixCls, placeholder = this.placeholder, placement2 = this.placement, align = this.align, id2 = this.id, disabled = this.disabled, transitionName2 = this.transitionName, getPopupContainer2 = this.getPopupContainer, name = this.name, autocomplete = this.autocomplete, autofocus = this.autofocus, sOpen2 = this.sOpen, sValue = this.sValue, onFocus5 = this.onFocus, onBlur6 = this.onBlur, popupStyle = this.popupStyle, pickerInputClass = this.pickerInputClass; var _this$$attrs = this.$attrs, className = _this$$attrs.class, style = _this$$attrs.style; var popupClassName = this.getPopupClassName(); var inputIcon = getComponent(this, "inputIcon"); return createVNode(Trigger, { "prefixCls": "".concat(prefixCls2, "-panel"), "popupClassName": popupClassName, "popupStyle": popupStyle, "popupAlign": align, "builtinPlacements": placements$1, "popupPlacement": placement2, "action": disabled ? [] : ["click"], "destroyPopupOnHide": true, "getPopupContainer": getPopupContainer2, "popupTransitionName": transitionName2, "popupVisible": sOpen2, "onPopupVisibleChange": this.onVisibleChange, "popup": this.getPanelElement() }, { default: function _default8() { return [createVNode("span", { "class": classNames(prefixCls2, className), "style": style }, [createVNode("input", { "class": pickerInputClass, "ref": _this3.saveInputRef, "type": "text", "placeholder": placeholder, "name": name, "onKeydown": _this3.onKeyDown, "disabled": disabled, "value": sValue && sValue.format(_this3.getFormat()) || "", "autocomplete": autocomplete, "onFocus": onFocus5, "onBlur": onBlur6, "autofocus": autofocus, "readonly": true, "id": id2 }, null), inputIcon || createVNode("span", { "class": "".concat(prefixCls2, "-icon") }, null), _this3.renderClearButton()])]; } }); } }); var ClockCircleOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z" } }] }, "name": "clock-circle", "theme": "outlined" }; var ClockCircleOutlinedSvg = ClockCircleOutlined$2; function _objectSpread$D(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$E(target, key2, source2[key2]); }); } return target; } function _defineProperty$E(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var ClockCircleOutlined = function ClockCircleOutlined2(props2, context2) { var p = _objectSpread$D({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$D({}, p, { "icon": ClockCircleOutlinedSvg }), null); }; ClockCircleOutlined.displayName = "ClockCircleOutlined"; ClockCircleOutlined.inheritAttrs = false; var ClockCircleOutlined$1 = ClockCircleOutlined; function generateShowHourMinuteSecond(format3) { return { showHour: format3.indexOf("H") > -1 || format3.indexOf("h") > -1 || format3.indexOf("k") > -1, showMinute: format3.indexOf("m") > -1, showSecond: format3.indexOf("s") > -1 }; } var timePickerProps = function timePickerProps2() { return { size: PropsTypes.oneOf(tuple("large", "default", "small")), value: TimeOrTimesType, defaultValue: TimeOrTimesType, open: PropsTypes.looseBool, format: PropsTypes.string, disabled: PropsTypes.looseBool, placeholder: PropsTypes.string, prefixCls: PropsTypes.string, hideDisabledOptions: PropsTypes.looseBool, disabledHours: PropsTypes.func, disabledMinutes: PropsTypes.func, disabledSeconds: PropsTypes.func, getPopupContainer: PropsTypes.func, use12Hours: PropsTypes.looseBool, focusOnOpen: PropsTypes.looseBool, hourStep: PropsTypes.number, minuteStep: PropsTypes.number, secondStep: PropsTypes.number, allowEmpty: PropsTypes.looseBool, allowClear: PropsTypes.looseBool, inputReadOnly: PropsTypes.looseBool, clearText: PropsTypes.string, defaultOpenValue: PropsTypes.object, popupClassName: PropsTypes.string, popupStyle: PropsTypes.style, suffixIcon: PropsTypes.any, align: PropsTypes.object, placement: PropsTypes.any, transitionName: PropsTypes.string, autofocus: PropsTypes.looseBool, addon: PropsTypes.any, clearIcon: PropsTypes.any, locale: PropsTypes.object, valueFormat: PropsTypes.string, onChange: PropsTypes.func, onAmPmChange: PropsTypes.func, onOpen: PropsTypes.func, onClose: PropsTypes.func, onFocus: PropsTypes.func, onBlur: PropsTypes.func, onKeydown: PropsTypes.func, onOpenChange: PropsTypes.func }; }; var TimePicker = defineComponent({ name: "ATimePicker", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$1(timePickerProps(), { align: { offset: [0, -2] }, disabled: false, disabledHours: void 0, disabledMinutes: void 0, disabledSeconds: void 0, hideDisabledOptions: false, placement: "bottomLeft", transitionName: "slide-up", focusOnOpen: true, allowClear: true }), emits: ["update:value", "update:open", "change", "openChange", "focus", "blur", "keydown"], setup: function setup59() { return { popupRef: null, timePickerRef: null, configProvider: inject("configProvider", defaultConfigProvider) }; }, data: function data31() { var value24 = this.value, defaultValue = this.defaultValue, valueFormat = this.valueFormat; checkValidate("TimePicker", defaultValue, "defaultValue", valueFormat); checkValidate("TimePicker", value24, "value", valueFormat); warning$5(!hasProp(this, "allowEmpty"), "TimePicker", "`allowEmpty` is deprecated. Please use `allowClear` instead."); return { sValue: stringToMoment(value24 || defaultValue, valueFormat) }; }, watch: { value: function value20(val) { checkValidate("TimePicker", val, "value", this.valueFormat); this.setState({ sValue: stringToMoment(val, this.valueFormat) }); } }, created: function created10() { provide("savePopupRef", this.savePopupRef); }, methods: { getDefaultFormat: function getDefaultFormat() { var format3 = this.format, use12Hours = this.use12Hours; if (format3) { return format3; } else if (use12Hours) { return "h:mm:ss a"; } return "HH:mm:ss"; }, getAllowClear: function getAllowClear() { var _this$$props = this.$props, allowClear = _this$$props.allowClear, allowEmpty = _this$$props.allowEmpty; if (hasProp(this, "allowClear")) { return allowClear; } return allowEmpty; }, getDefaultLocale: function getDefaultLocale() { var defaultLocale2 = _extends$1(_extends$1({}, enUS$1), this.$props.locale); return defaultLocale2; }, savePopupRef: function savePopupRef5(ref2) { this.popupRef = ref2; }, saveTimePicker: function saveTimePicker(timePickerRef) { this.timePickerRef = timePickerRef; }, handleChange: function handleChange9(value24) { if (!hasProp(this, "value")) { this.setState({ sValue: value24 }); } var _this$format = this.format, format3 = _this$format === void 0 ? "HH:mm:ss" : _this$format; var val = this.valueFormat ? momentToString(value24, this.valueFormat) : value24; this.$emit("update:value", val); this.$emit("change", val, value24 && value24.format(format3) || ""); }, handleOpenClose: function handleOpenClose(_ref) { var open6 = _ref.open; this.$emit("update:open", open6); this.$emit("openChange", open6); }, focus: function focus14() { this.timePickerRef.focus(); }, blur: function blur11() { this.timePickerRef.blur(); }, renderInputIcon: function renderInputIcon(prefixCls2) { var suffixIcon = getComponent(this, "suffixIcon"); suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon; var clockIcon = suffixIcon && isValidElement(suffixIcon) && cloneElement(suffixIcon, { class: "".concat(prefixCls2, "-clock-icon") }) || createVNode(ClockCircleOutlined$1, { "class": "".concat(prefixCls2, "-clock-icon") }, null); return createVNode("span", { "class": "".concat(prefixCls2, "-icon") }, [clockIcon]); }, renderClearIcon: function renderClearIcon2(prefixCls2) { var clearIcon = getComponent(this, "clearIcon"); var clearIconPrefixCls = "".concat(prefixCls2, "-clear"); if (clearIcon && isValidElement(clearIcon)) { return cloneElement(clearIcon, { class: clearIconPrefixCls }); } return createVNode(CloseCircleFilled$3, { "class": clearIconPrefixCls }, null); }, renderTimePicker: function renderTimePicker(locale2) { var _pickerClassName; var props2 = getOptionProps(this); props2 = omit(props2, ["defaultValue", "suffixIcon", "allowEmpty", "allowClear"]); var className = this.$attrs.class; var _props2 = props2, customizePrefixCls = _props2.prefixCls, getPopupContainer2 = _props2.getPopupContainer, placeholder = _props2.placeholder, size = _props2.size; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("time-picker", customizePrefixCls); var inputPrefixCls = getPrefixCls2("input"); var pickerInputClass = classNames("".concat(prefixCls2, "-input"), inputPrefixCls); var format3 = this.getDefaultFormat(); var pickerClassName = (_pickerClassName = {}, _defineProperty$12(_pickerClassName, className, className), _defineProperty$12(_pickerClassName, "".concat(prefixCls2, "-").concat(size), !!size), _pickerClassName); var tempAddon = getComponent(this, "addon", {}, false); var pickerAddon = function pickerAddon2(panel) { return tempAddon ? createVNode("div", { "class": "".concat(prefixCls2, "-panel-addon") }, [typeof tempAddon === "function" ? tempAddon(panel) : tempAddon]) : null; }; var inputIcon = this.renderInputIcon(prefixCls2); var clearIcon = this.renderClearIcon(prefixCls2); var getContextPopupContainer = this.configProvider.getPopupContainer; var timeProps = _extends$1(_extends$1(_extends$1(_extends$1({}, generateShowHourMinuteSecond(format3)), props2), this.$attrs), { allowEmpty: this.getAllowClear(), prefixCls: prefixCls2, pickerInputClass, getPopupContainer: getPopupContainer2 || getContextPopupContainer, format: format3, value: this.sValue, placeholder: placeholder === void 0 ? locale2.placeholder : placeholder, addon: pickerAddon, inputIcon, clearIcon, class: pickerClassName, ref: this.saveTimePicker, onChange: this.handleChange, onOpen: this.handleOpenClose, onClose: this.handleOpenClose }); return createVNode(VcTimePicker, timeProps, null); } }, render: function render54() { return createVNode(LocaleReceiver, { "componentName": "TimePicker", "defaultLocale": this.getDefaultLocale(), "children": this.renderTimePicker }, null); } }); var TimePicker$1 = withInstall(TimePicker); var DEFAULT_FORMAT = { date: "YYYY-MM-DD", dateTime: "YYYY-MM-DD HH:mm:ss", week: "gggg-wo", month: "YYYY-MM" }; var LOCALE_FORMAT_MAPPING = { date: "dateFormat", dateTime: "dateTimeFormat", week: "weekFormat", month: "monthFormat" }; function getColumns(_ref) { var showHour = _ref.showHour, showMinute = _ref.showMinute, showSecond = _ref.showSecond, use12Hours = _ref.use12Hours; var column = 0; if (showHour) { column += 1; } if (showMinute) { column += 1; } if (showSecond) { column += 1; } if (use12Hours) { column += 1; } return column; } function wrapPicker(Picker2, props2, pickerType) { return defineComponent({ name: Picker2.name, inheritAttrs: false, props: _extends$1(_extends$1({}, props2), { transitionName: PropsTypes.string.def("slide-up"), popupStyle: PropsTypes.style, locale: PropsTypes.any.def({}) }), emits: ["update:value", "openChange", "focus", "blur", "mouseenter", "mouseleave", "change", "ok", "calendarChange"], setup: function setup123() { return { configProvider: inject("configProvider", defaultConfigProvider), picker: void 0, popupRef: void 0 }; }, watch: { value: function value24(val) { checkValidate("DatePicker", val, "value", this.valueFormat); } }, created: function created24() { provide("savePopupRef", this.savePopupRef); }, mounted: function mounted36() { var _this = this; var _this$$props = this.$props, autofocus = _this$$props.autofocus, disabled = _this$$props.disabled, value24 = _this$$props.value, defaultValue = _this$$props.defaultValue, valueFormat = _this$$props.valueFormat; checkValidate("DatePicker", defaultValue, "defaultValue", valueFormat); checkValidate("DatePicker", value24, "value", valueFormat); if (autofocus && !disabled) { nextTick(function() { _this.focus(); }); } }, methods: { savePicker: function savePicker2(node) { this.picker = node; }, getDefaultLocale: function getDefaultLocale2() { var result = _extends$1(_extends$1({}, enUS), this.locale); result.lang = _extends$1(_extends$1({}, result.lang), (this.locale || {}).lang); return result; }, savePopupRef: function savePopupRef6(ref2) { this.popupRef = ref2; }, handleOpenChange: function handleOpenChange3(open6) { this.$emit("openChange", open6); }, handleFocus: function handleFocus(e2) { this.$emit("focus", e2); }, handleBlur: function handleBlur3(e2) { this.$emit("blur", e2); }, handleMouseEnter: function handleMouseEnter2(e2) { this.$emit("mouseenter", e2); }, handleMouseLeave: function handleMouseLeave2(e2) { this.$emit("mouseleave", e2); }, handleChange: function handleChange17(date3, dateString) { var value24 = this.valueFormat ? momentToString(date3, this.valueFormat) : date3; this.$emit("update:value", value24); this.$emit("change", value24, dateString); }, handleOk: function handleOk2(val) { this.$emit("ok", this.valueFormat ? momentToString(val, this.valueFormat) : val); }, handleCalendarChange: function handleCalendarChange(date3, dateString) { this.$emit("calendarChange", this.valueFormat ? momentToString(date3, this.valueFormat) : date3, dateString); }, focus: function focus25() { this.picker.focus(); }, blur: function blur22() { this.picker.blur(); }, transformValue: function transformValue(props3) { if ("value" in props3) { props3.value = stringToMoment(props3.value, this.valueFormat); } if ("defaultValue" in props3) { props3.defaultValue = stringToMoment(props3.defaultValue, this.valueFormat); } if ("defaultPickerValue" in props3) { props3.defaultPickerValue = stringToMoment(props3.defaultPickerValue, this.valueFormat); } }, renderPicker: function renderPicker(locale2, localeCode) { var _classNames2; var props3 = _extends$1(_extends$1({}, getOptionProps(this)), this.$attrs); this.transformValue(props3); var customizePrefixCls = props3.prefixCls, customizeInputPrefixCls = props3.inputPrefixCls, getCalendarContainer = props3.getCalendarContainer, size = props3.size, showTime = props3.showTime, disabled = props3.disabled, format3 = props3.format; var mergedPickerType = showTime ? "".concat(pickerType, "Time") : pickerType; var mergedFormat = format3 || locale2[LOCALE_FORMAT_MAPPING[mergedPickerType]] || DEFAULT_FORMAT[mergedPickerType]; var _this$configProvider = this.configProvider, getPrefixCls2 = _this$configProvider.getPrefixCls, getContextPopupContainer = _this$configProvider.getPopupContainer; var getPopupContainer2 = getCalendarContainer || getContextPopupContainer; var prefixCls2 = getPrefixCls2("calendar", customizePrefixCls); var inputPrefixCls = getPrefixCls2("input", customizeInputPrefixCls); var pickerClass = classNames("".concat(prefixCls2, "-picker"), _defineProperty$12({}, "".concat(prefixCls2, "-picker-").concat(size), !!size)); var pickerInputClass = classNames("".concat(prefixCls2, "-picker-input"), inputPrefixCls, (_classNames2 = {}, _defineProperty$12(_classNames2, "".concat(inputPrefixCls, "-lg"), size === "large"), _defineProperty$12(_classNames2, "".concat(inputPrefixCls, "-sm"), size === "small"), _defineProperty$12(_classNames2, "".concat(inputPrefixCls, "-disabled"), disabled), _classNames2)); var timeFormat = showTime && showTime.format || "HH:mm:ss"; var vcTimePickerProps = _extends$1(_extends$1({}, generateShowHourMinuteSecond(timeFormat)), { format: timeFormat, use12Hours: showTime && showTime.use12Hours }); var columns2 = getColumns(vcTimePickerProps); var timePickerCls = "".concat(prefixCls2, "-time-picker-column-").concat(columns2); var timePickerPanelProps = _extends$1(_extends$1(_extends$1({}, vcTimePickerProps), showTime), { prefixCls: "".concat(prefixCls2, "-time-picker"), placeholder: locale2.timePickerLocale.placeholder, transitionName: "slide-up", class: timePickerCls, onEsc: function onEsc5() { } }); var timePicker = showTime ? createVNode(TimePickerPanel, timePickerPanelProps, null) : null; var pickerProps2 = _extends$1(_extends$1({}, props3), { getCalendarContainer: getPopupContainer2, format: mergedFormat, pickerClass, pickerInputClass, locale: locale2, localeCode, timePicker, onOpenChange: this.handleOpenChange, onFocus: this.handleFocus, onBlur: this.handleBlur, onMouseenter: this.handleMouseEnter, onMouseleave: this.handleMouseLeave, onChange: this.handleChange, onOk: this.handleOk, onCalendarChange: this.handleCalendarChange, ref: this.savePicker }); return createVNode(Picker2, pickerProps2, this.$slots); } }, render: function render123() { return createVNode(LocaleReceiver, { "componentName": "DatePicker", "defaultLocale": this.getDefaultLocale, "children": this.renderPicker }, null); } }); } function noop$d() { } var CalendarPart = { name: "CalendarPart", inheritAttrs: false, mixins: [BaseMixin], props: { prefixCls: PropsTypes.string, value: PropsTypes.any, hoverValue: PropsTypes.any, selectedValue: PropsTypes.any, direction: PropsTypes.any, locale: PropsTypes.any, showDateInput: PropsTypes.looseBool, showTimePicker: PropsTypes.looseBool, showWeekNumber: PropsTypes.looseBool, format: PropsTypes.any, placeholder: PropsTypes.any, disabledDate: PropsTypes.any, timePicker: PropsTypes.any, disabledTime: PropsTypes.any, disabledMonth: PropsTypes.any, mode: PropsTypes.any, timePickerDisabledTime: PropsTypes.object, enableNext: PropsTypes.any, enablePrev: PropsTypes.any, clearIcon: PropsTypes.any, dateRender: PropsTypes.func, inputMode: PropsTypes.string, inputReadOnly: PropsTypes.looseBool }, render: function render55() { var props2 = this.$props; var prefixCls2 = props2.prefixCls, value24 = props2.value, hoverValue2 = props2.hoverValue, selectedValue5 = props2.selectedValue, mode3 = props2.mode, direction = props2.direction, locale2 = props2.locale, format3 = props2.format, placeholder = props2.placeholder, disabledDate = props2.disabledDate, timePicker = props2.timePicker, disabledTime = props2.disabledTime, timePickerDisabledTime = props2.timePickerDisabledTime, showTimePicker = props2.showTimePicker, enablePrev = props2.enablePrev, enableNext = props2.enableNext, disabledMonth = props2.disabledMonth, showDateInput = props2.showDateInput, dateRender = props2.dateRender, showWeekNumber = props2.showWeekNumber, showClear = props2.showClear, inputMode = props2.inputMode, inputReadOnly = props2.inputReadOnly; var clearIcon = getComponent(this, "clearIcon"); var _this$$attrs = this.$attrs, _this$$attrs$onInputC = _this$$attrs.onInputChange, onInputChange3 = _this$$attrs$onInputC === void 0 ? noop$d : _this$$attrs$onInputC, _this$$attrs$onInputS = _this$$attrs.onInputSelect, onInputSelect2 = _this$$attrs$onInputS === void 0 ? noop$d : _this$$attrs$onInputS, _this$$attrs$onValueC = _this$$attrs.onValueChange, onValueChange = _this$$attrs$onValueC === void 0 ? noop$d : _this$$attrs$onValueC, _this$$attrs$onPanelC = _this$$attrs.onPanelChange, onPanelChange3 = _this$$attrs$onPanelC === void 0 ? noop$d : _this$$attrs$onPanelC, _this$$attrs$onSelect = _this$$attrs.onSelect, onSelect6 = _this$$attrs$onSelect === void 0 ? noop$d : _this$$attrs$onSelect, _this$$attrs$onDayHov = _this$$attrs.onDayHover, onDayHover2 = _this$$attrs$onDayHov === void 0 ? noop$d : _this$$attrs$onDayHov; var shouldShowTimePicker = showTimePicker && timePicker; var disabledTimeConfig = shouldShowTimePicker && disabledTime ? getTimeConfig(selectedValue5, disabledTime) : null; var rangeClassName = "".concat(prefixCls2, "-range"); var newProps = { locale: locale2, value: value24, prefixCls: prefixCls2, showTimePicker }; var index2 = direction === "left" ? 0 : 1; var timePickerEle = null; if (shouldShowTimePicker) { var timePickerProps3 = getOptionProps(timePicker); timePickerEle = cloneElement(timePicker, _extends$1(_extends$1(_extends$1(_extends$1({ showHour: true, showMinute: true, showSecond: true }, timePickerProps3), disabledTimeConfig), timePickerDisabledTime), { defaultOpenValue: value24, value: selectedValue5[index2], onChange: onInputChange3 })); } var dateInputElement = showDateInput && createVNode(DateInput$1, { "format": format3, "locale": locale2, "prefixCls": prefixCls2, "timePicker": timePicker, "disabledDate": disabledDate, "placeholder": placeholder, "disabledTime": disabledTime, "value": value24, "showClear": showClear || false, "selectedValue": selectedValue5[index2], "onChange": onInputChange3, "onSelect": onInputSelect2, "clearIcon": clearIcon, "inputMode": inputMode, "inputReadOnly": inputReadOnly }, null); var headerProps = _extends$1(_extends$1({}, newProps), { mode: mode3, enableNext, enablePrev, disabledMonth, onValueChange, onPanelChange: onPanelChange3 }); var tableProps2 = _extends$1(_extends$1({}, newProps), { hoverValue: hoverValue2, selectedValue: selectedValue5, dateRender, disabledDate, showWeekNumber, onSelect: onSelect6, onDayHover: onDayHover2 }); return createVNode("div", { "class": "".concat(rangeClassName, "-part ").concat(rangeClassName, "-").concat(direction) }, [dateInputElement, createVNode("div", { "style": { outline: "none" } }, [createVNode(CalendarHeader$1, headerProps, null), showTimePicker ? createVNode("div", { "class": "".concat(prefixCls2, "-time-picker") }, [createVNode("div", { "class": "".concat(prefixCls2, "-time-picker-panel") }, [timePickerEle])]) : null, createVNode("div", { "class": "".concat(prefixCls2, "-body") }, [createVNode(DateTable$1, tableProps2, null)])])]); } }; var CalendarPart$1 = CalendarPart; function noop$c() { } function isEmptyArray$1(arr) { return Array.isArray(arr) && (arr.length === 0 || arr.every(function(i2) { return !i2; })); } function isArraysEqual(a2, b2) { if (a2 === b2) return true; if (a2 === null || typeof a2 === "undefined" || b2 === null || typeof b2 === "undefined") { return false; } if (a2.length !== b2.length) return false; for (var i2 = 0; i2 < a2.length; ++i2) { if (a2[i2] !== b2[i2]) return false; } return true; } function getValueFromSelectedValue(selectedValue5) { var _selectedValue = _slicedToArray$4(selectedValue5, 2), start = _selectedValue[0], end = _selectedValue[1]; if (end && (start === void 0 || start === null)) { start = end.clone().subtract(1, "month"); } if (start && (end === void 0 || end === null)) { end = start.clone().add(1, "month"); } return [start, end]; } function normalizeAnchor(props2, init) { var selectedValue5 = props2.selectedValue || init && props2.defaultSelectedValue; var value24 = props2.value || init && props2.defaultValue; var normalizedValue = value24 ? getValueFromSelectedValue(value24) : getValueFromSelectedValue(selectedValue5); return !isEmptyArray$1(normalizedValue) ? normalizedValue : init && [hooks(), hooks().add(1, "months")]; } function generateOptions(length, extraOptionGen) { var arr = extraOptionGen ? extraOptionGen().concat() : []; for (var value24 = 0; value24 < length; value24++) { if (arr.indexOf(value24) === -1) { arr.push(value24); } } return arr; } function onInputSelect(direction, value24, cause) { if (!value24) { return; } var originalValue = this.sSelectedValue; var selectedValue5 = originalValue.concat(); var index2 = direction === "left" ? 0 : 1; selectedValue5[index2] = value24; if (selectedValue5[0] && this.compare(selectedValue5[0], selectedValue5[1]) > 0) { selectedValue5[1 - index2] = this.sShowTimePicker ? selectedValue5[index2] : void 0; } this.__emit("inputSelect", selectedValue5); this.fireSelectValueChange(selectedValue5, null, cause || { source: "dateInput" }); } var RangeCalendar = defineComponent({ name: "RangeCalendar", mixins: [BaseMixin, CommonMixin], inheritAttrs: false, props: { locale: PropsTypes.object.def(enUs), visible: PropsTypes.looseBool.def(true), prefixCls: PropsTypes.string.def("rc-calendar"), dateInputPlaceholder: PropsTypes.any, seperator: PropsTypes.string.def("~"), defaultValue: PropsTypes.any, value: PropsTypes.any, hoverValue: PropsTypes.any, mode: PropsTypes.arrayOf(PropsTypes.oneOf(["time", "date", "month", "year", "decade"])), showDateInput: PropsTypes.looseBool.def(true), timePicker: PropsTypes.any, showOk: PropsTypes.looseBool, showToday: PropsTypes.looseBool.def(true), defaultSelectedValue: PropsTypes.array.def([]), selectedValue: PropsTypes.array, showClear: PropsTypes.looseBool, showWeekNumber: PropsTypes.looseBool, format: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.arrayOf(PropsTypes.string), PropsTypes.func]), type: PropsTypes.any.def("both"), disabledDate: PropsTypes.func, disabledTime: PropsTypes.func.def(noop$c), renderFooter: PropsTypes.func.def(function() { return null; }), renderSidebar: PropsTypes.func.def(function() { return null; }), dateRender: PropsTypes.func, clearIcon: PropsTypes.any, inputReadOnly: PropsTypes.looseBool }, data: function data32() { var props2 = this.$props; var selectedValue5 = props2.selectedValue || props2.defaultSelectedValue; var value24 = normalizeAnchor(props2, 1); return { sSelectedValue: selectedValue5, prevSelectedValue: selectedValue5, firstSelectedValue: null, sHoverValue: props2.hoverValue || [], sValue: value24, sShowTimePicker: false, sMode: props2.mode || ["date", "date"], sPanelTriggerSource: "" }; }, watch: { value: function value21() { var newState = {}; newState.sValue = normalizeAnchor(this.$props, 0); this.setState(newState); }, hoverValue: function hoverValue(val) { if (!isArraysEqual(this.sHoverValue, val)) { this.setState({ sHoverValue: val }); } }, selectedValue: function selectedValue4(val) { var newState = {}; newState.sSelectedValue = val; newState.prevSelectedValue = val; this.setState(newState); }, mode: function mode2(val) { if (!isArraysEqual(this.sMode, val)) { this.setState({ sMode: val }); } } }, methods: { onDatePanelEnter: function onDatePanelEnter() { if (this.hasSelectedValue()) { this.fireHoverValueChange(this.sSelectedValue.concat()); } }, onDatePanelLeave: function onDatePanelLeave() { if (this.hasSelectedValue()) { this.fireHoverValueChange([]); } }, onSelect: function onSelect4(value24) { var type2 = this.type, sSelectedValue = this.sSelectedValue, prevSelectedValue = this.prevSelectedValue, firstSelectedValue = this.firstSelectedValue; var nextSelectedValue; if (type2 === "both") { if (!firstSelectedValue) { syncTime(prevSelectedValue[0], value24); nextSelectedValue = [value24]; } else if (this.compare(firstSelectedValue, value24) < 0) { syncTime(prevSelectedValue[1], value24); nextSelectedValue = [firstSelectedValue, value24]; } else { syncTime(prevSelectedValue[0], value24); syncTime(prevSelectedValue[1], firstSelectedValue); nextSelectedValue = [value24, firstSelectedValue]; } } else if (type2 === "start") { syncTime(prevSelectedValue[0], value24); var endValue = sSelectedValue[1]; nextSelectedValue = endValue && this.compare(endValue, value24) > 0 ? [value24, endValue] : [value24]; } else { var startValue = sSelectedValue[0]; if (startValue && this.compare(startValue, value24) <= 0) { syncTime(prevSelectedValue[1], value24); nextSelectedValue = [startValue, value24]; } else { syncTime(prevSelectedValue[0], value24); nextSelectedValue = [value24]; } } this.fireSelectValueChange(nextSelectedValue); }, onKeyDown: function onKeyDown7(event) { var _this = this; if (event.target.nodeName.toLowerCase() === "input") { return; } var keyCode = event.keyCode; var ctrlKey = event.ctrlKey || event.metaKey; var _this$$data = this.$data, selectedValue5 = _this$$data.sSelectedValue, hoverValue2 = _this$$data.sHoverValue, firstSelectedValue = _this$$data.firstSelectedValue, value24 = _this$$data.sValue; var disabledDate = this.$props.disabledDate; var updateHoverPoint = function updateHoverPoint2(func) { var currentHoverTime; var nextHoverTime; var nextHoverValue; if (!firstSelectedValue) { currentHoverTime = hoverValue2[0] || selectedValue5[0] || value24[0] || hooks(); nextHoverTime = func(currentHoverTime); nextHoverValue = [nextHoverTime]; _this.fireHoverValueChange(nextHoverValue); } else { if (hoverValue2.length === 1) { currentHoverTime = hoverValue2[0].clone(); nextHoverTime = func(currentHoverTime); nextHoverValue = _this.onDayHover(nextHoverTime); } else { currentHoverTime = hoverValue2[0].isSame(firstSelectedValue, "day") ? hoverValue2[1] : hoverValue2[0]; nextHoverTime = func(currentHoverTime); nextHoverValue = _this.onDayHover(nextHoverTime); } } if (nextHoverValue.length >= 2) { var miss = nextHoverValue.some(function(ht) { return !includesTime(value24, ht, "month"); }); if (miss) { var newValue = nextHoverValue.slice().sort(function(t1, t2) { return t1.valueOf() - t2.valueOf(); }); if (newValue[0].isSame(newValue[1], "month")) { newValue[1] = newValue[0].clone().add(1, "month"); } _this.fireValueChange(newValue); } } else if (nextHoverValue.length === 1) { var oriValueIndex = value24.findIndex(function(time) { return time.isSame(currentHoverTime, "month"); }); if (oriValueIndex === -1) oriValueIndex = 0; if (value24.every(function(time) { return !time.isSame(nextHoverTime, "month"); })) { var _newValue = value24.slice(); _newValue[oriValueIndex] = nextHoverTime.clone(); _this.fireValueChange(_newValue); } } event.preventDefault(); return nextHoverTime; }; switch (keyCode) { case KeyCode$1.DOWN: updateHoverPoint(function(time) { return goTime(time, 1, "weeks"); }); return; case KeyCode$1.UP: updateHoverPoint(function(time) { return goTime(time, -1, "weeks"); }); return; case KeyCode$1.LEFT: if (ctrlKey) { updateHoverPoint(function(time) { return goTime(time, -1, "years"); }); } else { updateHoverPoint(function(time) { return goTime(time, -1, "days"); }); } return; case KeyCode$1.RIGHT: if (ctrlKey) { updateHoverPoint(function(time) { return goTime(time, 1, "years"); }); } else { updateHoverPoint(function(time) { return goTime(time, 1, "days"); }); } return; case KeyCode$1.HOME: updateHoverPoint(function(time) { return goStartMonth(time); }); return; case KeyCode$1.END: updateHoverPoint(function(time) { return goEndMonth(time); }); return; case KeyCode$1.PAGE_DOWN: updateHoverPoint(function(time) { return goTime(time, 1, "month"); }); return; case KeyCode$1.PAGE_UP: updateHoverPoint(function(time) { return goTime(time, -1, "month"); }); return; case KeyCode$1.ENTER: { var lastValue; if (hoverValue2.length === 0) { lastValue = updateHoverPoint(function(time) { return time; }); } else if (hoverValue2.length === 1) { lastValue = hoverValue2[0]; } else { lastValue = hoverValue2[0].isSame(firstSelectedValue, "day") ? hoverValue2[1] : hoverValue2[0]; } if (lastValue && (!disabledDate || !disabledDate(lastValue))) { this.onSelect(lastValue); } event.preventDefault(); return; } default: this.__emit("keydown", event); } }, onDayHover: function onDayHover(value24) { var hoverValue2 = []; var sSelectedValue = this.sSelectedValue, firstSelectedValue = this.firstSelectedValue, type2 = this.type; if (type2 === "start" && sSelectedValue[1]) { hoverValue2 = this.compare(value24, sSelectedValue[1]) < 0 ? [value24, sSelectedValue[1]] : [value24]; } else if (type2 === "end" && sSelectedValue[0]) { hoverValue2 = this.compare(value24, sSelectedValue[0]) > 0 ? [sSelectedValue[0], value24] : []; } else { if (!firstSelectedValue) { if (this.sHoverValue.length) { this.setState({ sHoverValue: [] }); } return hoverValue2; } hoverValue2 = this.compare(value24, firstSelectedValue) < 0 ? [value24, firstSelectedValue] : [firstSelectedValue, value24]; } this.fireHoverValueChange(hoverValue2); return hoverValue2; }, onToday: function onToday2() { var startValue = getTodayTime(this.sValue[0]); var endValue = startValue.clone().add(1, "months"); this.setState({ sValue: [startValue, endValue] }); }, onOpenTimePicker: function onOpenTimePicker() { this.setState({ sShowTimePicker: true }); }, onCloseTimePicker: function onCloseTimePicker() { this.setState({ sShowTimePicker: false }); }, onOk: function onOk2() { var sSelectedValue = this.sSelectedValue; if (this.isAllowedDateAndTime(sSelectedValue)) { this.__emit("ok", sSelectedValue); } }, onStartInputChange: function onStartInputChange() { for (var _len = arguments.length, oargs = new Array(_len), _key = 0; _key < _len; _key++) { oargs[_key] = arguments[_key]; } var args = ["left"].concat(oargs); return onInputSelect.apply(this, args); }, onEndInputChange: function onEndInputChange() { for (var _len2 = arguments.length, oargs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { oargs[_key2] = arguments[_key2]; } var args = ["right"].concat(oargs); return onInputSelect.apply(this, args); }, onStartInputSelect: function onStartInputSelect(value24) { var args = ["left", value24, { source: "dateInputSelect" }]; return onInputSelect.apply(this, args); }, onEndInputSelect: function onEndInputSelect(value24) { var args = ["right", value24, { source: "dateInputSelect" }]; return onInputSelect.apply(this, args); }, onStartValueChange: function onStartValueChange(leftValue) { var value24 = _toConsumableArray(this.sValue); value24[0] = leftValue; return this.fireValueChange(value24); }, onEndValueChange: function onEndValueChange(rightValue) { var value24 = _toConsumableArray(this.sValue); value24[1] = rightValue; return this.fireValueChange(value24); }, onStartPanelChange: function onStartPanelChange(value24, mode3) { var sMode = this.sMode, sValue = this.sValue; var newMode = [mode3, sMode[1]]; var newValue = [value24 || sValue[0], sValue[1]]; this.__emit("panelChange", newValue, newMode); var newState = { sPanelTriggerSource: "start" }; if (!hasProp(this, "mode")) { newState.sMode = newMode; } this.setState(newState); }, onEndPanelChange: function onEndPanelChange(value24, mode3) { var sMode = this.sMode, sValue = this.sValue; var newMode = [sMode[0], mode3]; var newValue = [sValue[0], value24 || sValue[1]]; this.__emit("panelChange", newValue, newMode); var newState = { sPanelTriggerSource: "end" }; if (!hasProp(this, "mode")) { newState.sMode = newMode; } this.setState(newState); }, getStartValue: function getStartValue() { var _this$$data2 = this.$data, selectedValue5 = _this$$data2.sSelectedValue, showTimePicker = _this$$data2.sShowTimePicker, value24 = _this$$data2.sValue, mode3 = _this$$data2.sMode, panelTriggerSource = _this$$data2.sPanelTriggerSource; var startValue = value24[0]; if (selectedValue5[0] && this.$props.timePicker) { startValue = startValue.clone(); syncTime(selectedValue5[0], startValue); } if (showTimePicker && selectedValue5[0]) { startValue = selectedValue5[0]; } if (panelTriggerSource === "end" && mode3[0] === "date" && mode3[1] === "date" && startValue.isSame(value24[1], "month")) { startValue = startValue.clone().subtract(1, "month"); } return startValue; }, getEndValue: function getEndValue() { var _this$$data3 = this.$data, selectedValue5 = _this$$data3.sSelectedValue, showTimePicker = _this$$data3.sShowTimePicker, value24 = _this$$data3.sValue, mode3 = _this$$data3.sMode, panelTriggerSource = _this$$data3.sPanelTriggerSource; var endValue = value24[1] ? value24[1].clone() : value24[0].clone().add(1, "month"); if (selectedValue5[1] && this.$props.timePicker) { syncTime(selectedValue5[1], endValue); } if (showTimePicker) { endValue = selectedValue5[1] ? selectedValue5[1] : this.getStartValue(); } if (!showTimePicker && panelTriggerSource !== "end" && mode3[0] === "date" && mode3[1] === "date" && endValue.isSame(value24[0], "month")) { endValue = endValue.clone().add(1, "month"); } return endValue; }, getEndDisableTime: function getEndDisableTime() { var sSelectedValue = this.sSelectedValue, sValue = this.sValue, disabledTime = this.disabledTime; var userSettingDisabledTime = disabledTime(sSelectedValue, "end") || {}; var startValue = sSelectedValue && sSelectedValue[0] || sValue[0].clone(); if (!sSelectedValue[1] || startValue.isSame(sSelectedValue[1], "day")) { var hours2 = startValue.hour(); var minutes2 = startValue.minute(); var second = startValue.second(); var _disabledHours = userSettingDisabledTime.disabledHours, _disabledMinutes = userSettingDisabledTime.disabledMinutes, _disabledSeconds = userSettingDisabledTime.disabledSeconds; var oldDisabledMinutes = _disabledMinutes ? _disabledMinutes() : []; var olddisabledSeconds = _disabledSeconds ? _disabledSeconds() : []; _disabledHours = generateOptions(hours2, _disabledHours); _disabledMinutes = generateOptions(minutes2, _disabledMinutes); _disabledSeconds = generateOptions(second, _disabledSeconds); return { disabledHours: function disabledHours3() { return _disabledHours; }, disabledMinutes: function disabledMinutes2(hour2) { if (hour2 === hours2) { return _disabledMinutes; } return oldDisabledMinutes; }, disabledSeconds: function disabledSeconds2(hour2, minute) { if (hour2 === hours2 && minute === minutes2) { return _disabledSeconds; } return olddisabledSeconds; } }; } return userSettingDisabledTime; }, isAllowedDateAndTime: function isAllowedDateAndTime(selectedValue5) { return isAllowedDate(selectedValue5[0], this.disabledDate, this.disabledStartTime) && isAllowedDate(selectedValue5[1], this.disabledDate, this.disabledEndTime); }, isMonthYearPanelShow: function isMonthYearPanelShow(mode3) { return ["month", "year", "decade"].indexOf(mode3) > -1; }, hasSelectedValue: function hasSelectedValue() { var sSelectedValue = this.sSelectedValue; return !!sSelectedValue[1] && !!sSelectedValue[0]; }, compare: function compare(v1, v2) { if (this.timePicker) { return v1.diff(v2); } return v1.diff(v2, "days"); }, fireSelectValueChange: function fireSelectValueChange(selectedValue5, direct, cause) { var timePicker = this.timePicker, prevSelectedValue = this.prevSelectedValue; if (timePicker) { var timePickerProps3 = getOptionProps(timePicker); if (timePickerProps3.defaultValue) { var timePickerDefaultValue = timePickerProps3.defaultValue; if (!prevSelectedValue[0] && selectedValue5[0]) { syncTime(timePickerDefaultValue[0], selectedValue5[0]); } if (!prevSelectedValue[1] && selectedValue5[1]) { syncTime(timePickerDefaultValue[1], selectedValue5[1]); } } } if (!this.sSelectedValue[0] || !this.sSelectedValue[1]) { var startValue = selectedValue5[0] || hooks(); var endValue = selectedValue5[1] || startValue.clone().add(1, "months"); this.setState({ sSelectedValue: selectedValue5, sValue: selectedValue5 && selectedValue5.length === 2 ? getValueFromSelectedValue([startValue, endValue]) : this.sValue }); } if (selectedValue5[0] && !selectedValue5[1]) { this.setState({ firstSelectedValue: selectedValue5[0] }); this.fireHoverValueChange(selectedValue5.concat()); } this.__emit("change", selectedValue5); if (direct || selectedValue5[0] && selectedValue5[1]) { this.setState({ prevSelectedValue: selectedValue5, firstSelectedValue: null }); this.fireHoverValueChange([]); this.__emit("select", selectedValue5, cause); } if (!hasProp(this, "selectedValue")) { this.setState({ sSelectedValue: selectedValue5 }); } }, fireValueChange: function fireValueChange(value24) { if (!hasProp(this, "value")) { this.setState({ sValue: value24 }); } this.__emit("valueChange", value24); }, fireHoverValueChange: function fireHoverValueChange(hoverValue2) { if (!hasProp(this, "hoverValue")) { this.setState({ sHoverValue: hoverValue2 }); } this.__emit("hoverChange", hoverValue2); }, clear: function clear() { this.fireSelectValueChange([], true); this.__emit("clear"); }, disabledStartTime: function disabledStartTime(time) { return this.disabledTime(time, "start"); }, disabledEndTime: function disabledEndTime(time) { return this.disabledTime(time, "end"); }, disabledStartMonth: function disabledStartMonth(month) { var sValue = this.sValue; return month.isAfter(sValue[1], "month"); }, disabledEndMonth: function disabledEndMonth(month) { var sValue = this.sValue; return month.isBefore(sValue[0], "month"); } }, render: function render56() { var _className, _cls; var props2 = getOptionProps(this); var prefixCls2 = props2.prefixCls, dateInputPlaceholder = props2.dateInputPlaceholder, timePicker = props2.timePicker, showOk = props2.showOk, locale2 = props2.locale, showClear = props2.showClear, showToday = props2.showToday, type2 = props2.type, seperator = props2.seperator; var clearIcon = getComponent(this, "clearIcon"); var sHoverValue = this.sHoverValue, sSelectedValue = this.sSelectedValue, mode3 = this.sMode, sShowTimePicker = this.sShowTimePicker, sValue = this.sValue; var className = (_className = {}, _defineProperty$12(_className, this.$attrs.class, !!this.$attrs.class), _defineProperty$12(_className, prefixCls2, 1), _defineProperty$12(_className, "".concat(prefixCls2, "-hidden"), !props2.visible), _defineProperty$12(_className, "".concat(prefixCls2, "-range"), 1), _defineProperty$12(_className, "".concat(prefixCls2, "-show-time-picker"), sShowTimePicker), _defineProperty$12(_className, "".concat(prefixCls2, "-week-number"), props2.showWeekNumber), _className); var baseProps = _extends$1(_extends$1({}, props2), this.$attrs); var newProps = { selectedValue: sSelectedValue, onSelect: this.onSelect, onDayHover: type2 === "start" && sSelectedValue[1] || type2 === "end" && sSelectedValue[0] || !!sHoverValue.length ? this.onDayHover : noop$c }; var placeholder1; var placeholder2; if (dateInputPlaceholder) { if (Array.isArray(dateInputPlaceholder)) { var _dateInputPlaceholder = _slicedToArray$4(dateInputPlaceholder, 2); placeholder1 = _dateInputPlaceholder[0]; placeholder2 = _dateInputPlaceholder[1]; } else { placeholder1 = placeholder2 = dateInputPlaceholder; } } var showOkButton = showOk === true || showOk !== false && !!timePicker; var cls = (_cls = {}, _defineProperty$12(_cls, "".concat(prefixCls2, "-footer"), true), _defineProperty$12(_cls, "".concat(prefixCls2, "-range-bottom"), true), _defineProperty$12(_cls, "".concat(prefixCls2, "-footer-show-ok"), showOkButton), _cls); var startValue = this.getStartValue(); var endValue = this.getEndValue(); var todayTime = getTodayTime(startValue); var thisMonth = todayTime.month(); var thisYear = todayTime.year(); var isTodayInView = startValue.year() === thisYear && startValue.month() === thisMonth || endValue.year() === thisYear && endValue.month() === thisMonth; var nextMonthOfStart = startValue.clone().add(1, "months"); var isClosestMonths = nextMonthOfStart.year() === endValue.year() && nextMonthOfStart.month() === endValue.month(); var leftPartProps = _extends$1(_extends$1(_extends$1({}, baseProps), newProps), { hoverValue: sHoverValue, direction: "left", disabledTime: this.disabledStartTime, disabledMonth: this.disabledStartMonth, format: this.getFormat(), value: startValue, mode: mode3[0], placeholder: placeholder1, showDateInput: this.showDateInput, timePicker, showTimePicker: sShowTimePicker || mode3[0] === "time", enablePrev: true, enableNext: !isClosestMonths || this.isMonthYearPanelShow(mode3[1]), clearIcon, onInputChange: this.onStartInputChange, onInputSelect: this.onStartInputSelect, onValueChange: this.onStartValueChange, onPanelChange: this.onStartPanelChange }); var rightPartProps = _extends$1(_extends$1(_extends$1({}, baseProps), newProps), { hoverValue: sHoverValue, direction: "right", format: this.getFormat(), timePickerDisabledTime: this.getEndDisableTime(), placeholder: placeholder2, value: endValue, mode: mode3[1], showDateInput: this.showDateInput, timePicker, showTimePicker: sShowTimePicker || mode3[1] === "time", disabledTime: this.disabledEndTime, disabledMonth: this.disabledEndMonth, enablePrev: !isClosestMonths || this.isMonthYearPanelShow(mode3[0]), enableNext: true, clearIcon, onInputChange: this.onEndInputChange, onInputSelect: this.onEndInputSelect, onValueChange: this.onEndValueChange, onPanelChange: this.onEndPanelChange }); var TodayButtonNode = null; if (showToday) { var todayButtonProps = _extends$1(_extends$1({}, baseProps), { disabled: isTodayInView, value: sValue[0], text: locale2.backToToday, onToday: this.onToday }); TodayButtonNode = createVNode(TodayButton$1, _objectSpread2$2({ "key": "todayButton" }, todayButtonProps), null); } var TimePickerButtonNode = null; if (props2.timePicker) { var timePickerButtonProps = _extends$1(_extends$1({}, baseProps), { showTimePicker: sShowTimePicker || mode3[0] === "time" && mode3[1] === "time", timePickerDisabled: !this.hasSelectedValue() || sHoverValue.length, onOpenTimePicker: this.onOpenTimePicker, onCloseTimePicker: this.onCloseTimePicker }); TimePickerButtonNode = createVNode(TimePickerButton$1, _objectSpread2$2({ "key": "timePickerButton" }, timePickerButtonProps), null); } var OkButtonNode = null; if (showOkButton) { var okButtonProps = _extends$1(_extends$1({}, baseProps), { okDisabled: !this.isAllowedDateAndTime(sSelectedValue) || !this.hasSelectedValue() || sHoverValue.length, onOk: this.onOk }); OkButtonNode = createVNode(OkButton$1, _objectSpread2$2({ "key": "okButtonNode" }, okButtonProps), null); } var extraFooter = this.renderFooter(mode3); return createVNode("div", { "ref": "rootInstance", "class": className, "tabindex": "0", "onKeydown": this.onKeyDown }, [props2.renderSidebar(), createVNode("div", { "class": "".concat(prefixCls2, "-panel") }, [showClear && sSelectedValue[0] && sSelectedValue[1] ? createVNode("a", { "role": "button", "title": locale2.clear, "onClick": this.clear }, [clearIcon || createVNode("span", { "class": "".concat(prefixCls2, "-clear-btn") }, null)]) : null, createVNode("div", { "class": "".concat(prefixCls2, "-date-panel"), "onMouseleave": type2 !== "both" ? this.onDatePanelLeave : noop$c, "onMouseenter": type2 !== "both" ? this.onDatePanelEnter : noop$c }, [createVNode(CalendarPart$1, leftPartProps, null), createVNode("span", { "class": "".concat(prefixCls2, "-range-middle") }, [seperator]), createVNode(CalendarPart$1, rightPartProps, null)]), createVNode("div", { "class": cls }, [showToday || props2.timePicker || showOkButton || extraFooter ? createVNode("div", { "class": "".concat(prefixCls2, "-footer-btn") }, [extraFooter, TodayButtonNode, TimePickerButtonNode, OkButtonNode]) : null])])]); } }); var RangeCalendar$1 = RangeCalendar; var CheckableTag = defineComponent({ name: "ACheckableTag", props: { prefixCls: PropsTypes.string, checked: PropsTypes.looseBool, onChange: { type: Function }, onClick: { type: Function } }, emits: ["update:checked", "change", "click"], setup: function setup60(props2, _ref) { var slots = _ref.slots, emit2 = _ref.emit; var _useConfigInject = useConfigInject("tag", props2), prefixCls2 = _useConfigInject.prefixCls; var handleClick5 = function handleClick6(e2) { var checked2 = props2.checked; emit2("update:checked", !checked2); emit2("change", !checked2); emit2("click", e2); }; var cls = computed(function() { var _classNames; return classNames(prefixCls2.value, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-checkable"), true), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-checkable-checked"), props2.checked), _classNames)); }); return function() { var _a3; return createVNode("span", { "class": cls.value, "onClick": handleClick5 }, [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)]); }; } }); var CheckableTag$1 = CheckableTag; var PresetColorRegex = new RegExp("^(".concat(PresetColorTypes.join("|"), ")(-inverse)?$")); var PresetStatusColorRegex = new RegExp("^(".concat(PresetStatusColorTypes.join("|"), ")$")); var tagProps = { prefixCls: PropsTypes.string, color: { type: String }, closable: PropsTypes.looseBool.def(false), closeIcon: PropsTypes.VNodeChild, visible: PropsTypes.looseBool, onClose: { type: Function }, icon: PropsTypes.VNodeChild }; var Tag = defineComponent({ name: "ATag", props: tagProps, emits: ["update:visible", "close"], slots: ["closeIcon", "icon"], setup: function setup61(props2, _ref) { var slots = _ref.slots, emit2 = _ref.emit, attrs = _ref.attrs; var _useConfigInject = useConfigInject("tag", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction; var visible9 = ref(true); watchEffect(function() { if (props2.visible !== void 0) { visible9.value = props2.visible; } }); var handleCloseClick = function handleCloseClick2(e2) { e2.stopPropagation(); emit2("update:visible", false); emit2("close", e2); if (e2.defaultPrevented) { return; } if (props2.visible === void 0) { visible9.value = false; } }; var isPresetColor2 = computed(function() { var color = props2.color; if (!color) { return false; } return PresetColorRegex.test(color) || PresetStatusColorRegex.test(color); }); var tagClassName = computed(function() { var _classNames; return classNames(prefixCls2.value, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-").concat(props2.color), isPresetColor2.value), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-has-color"), props2.color && !isPresetColor2.value), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-hidden"), !visible9.value), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-rtl"), direction.value === "rtl"), _classNames)); }); return function() { var _a3, _b2, _c; var _props$icon = props2.icon, icon = _props$icon === void 0 ? (_a3 = slots.icon) === null || _a3 === void 0 ? void 0 : _a3.call(slots) : _props$icon, color = props2.color, _props$closeIcon = props2.closeIcon, closeIcon = _props$closeIcon === void 0 ? (_b2 = slots.closeIcon) === null || _b2 === void 0 ? void 0 : _b2.call(slots) : _props$closeIcon, _props$closable = props2.closable, closable = _props$closable === void 0 ? false : _props$closable; var renderCloseIcon2 = function renderCloseIcon3() { if (closable) { return closeIcon ? createVNode("div", { "class": "".concat(prefixCls2.value, "-close-icon"), "onClick": handleCloseClick }, [closeIcon]) : createVNode(CloseOutlined$3, { "class": "".concat(prefixCls2.value, "-close-icon"), "onClick": handleCloseClick }, null); } return null; }; var tagStyle = { backgroundColor: color && !isPresetColor2.value ? color : void 0 }; var iconNode = icon || null; var children = (_c = slots.default) === null || _c === void 0 ? void 0 : _c.call(slots); var kids = iconNode ? createVNode(Fragment, null, [iconNode, createVNode("span", null, [children])]) : children; var isNeedWave = "onClick" in attrs; var tagNode = createVNode("span", { "class": tagClassName.value, "style": tagStyle }, [kids, renderCloseIcon2()]); return isNeedWave ? createVNode(Wave, null, { default: function _default8() { return [tagNode]; } }) : tagNode; }; } }); Tag.CheckableTag = CheckableTag$1; Tag.install = function(app) { app.component(Tag.name, Tag); app.component(CheckableTag$1.name, CheckableTag$1); return app; }; var Tag$1 = Tag; var PickerProps = { name: PropsTypes.string, transitionName: PropsTypes.string, prefixCls: PropsTypes.string, inputPrefixCls: PropsTypes.string, format: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.array, PropsTypes.func]), disabled: PropsTypes.looseBool, allowClear: PropsTypes.looseBool, suffixIcon: PropsTypes.any, popupStyle: PropsTypes.object, dropdownClassName: PropsTypes.string, locale: PropsTypes.any, localeCode: PropsTypes.string, size: PropsTypes.oneOf(tuple("large", "small", "default")), getCalendarContainer: PropsTypes.func, open: PropsTypes.looseBool, disabledDate: PropsTypes.func, showToday: PropsTypes.looseBool, dateRender: PropsTypes.any, pickerClass: PropsTypes.string, pickerInputClass: PropsTypes.string, timePicker: PropsTypes.any, autofocus: PropsTypes.looseBool, tagPrefixCls: PropsTypes.string, tabindex: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), align: PropsTypes.object.def(function() { return {}; }), inputReadOnly: PropsTypes.looseBool, valueFormat: PropsTypes.string, onOpenChange: PropsTypes.func, onFocus: PropsTypes.func, onBlur: PropsTypes.func, onMouseenter: PropsTypes.func, onMouseleave: PropsTypes.func }; var SinglePickerProps = { value: { type: [String, Object] }, defaultValue: { type: [String, Object] }, defaultPickerValue: { type: [String, Object] }, renderExtraFooter: PropsTypes.any, placeholder: PropsTypes.string, onChange: PropsTypes.func }; var DatePickerProps = _extends$1(_extends$1(_extends$1({}, PickerProps), SinglePickerProps), { showTime: withUndefined(PropsTypes.oneOfType([PropsTypes.object, PropsTypes.looseBool])), open: PropsTypes.looseBool, disabledTime: PropsTypes.func, mode: PropsTypes.oneOf(tuple("time", "date", "month", "year", "decade")), onOpenChange: PropsTypes.func, onPanelChange: PropsTypes.func, onOk: PropsTypes.func }); var MonthPickerProps = _extends$1(_extends$1(_extends$1({}, PickerProps), SinglePickerProps), { placeholder: PropsTypes.string, monthCellContentRender: PropsTypes.func }); var RangePickerProps = _extends$1(_extends$1({}, PickerProps), { tagPrefixCls: PropsTypes.string, value: { type: Array }, defaultValue: { type: Array }, defaultPickerValue: { type: Array }, timePicker: PropsTypes.any, showTime: withUndefined(PropsTypes.oneOfType([PropsTypes.object, PropsTypes.looseBool])), ranges: PropsTypes.object, placeholder: PropsTypes.arrayOf(String), mode: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.arrayOf(String)]), separator: PropsTypes.any, disabledTime: PropsTypes.func, showToday: PropsTypes.looseBool, renderExtraFooter: PropsTypes.any, onChange: PropsTypes.func, onCalendarChange: PropsTypes.func, onOk: PropsTypes.func, onPanelChange: PropsTypes.func, onMouseenter: PropsTypes.func, onMouseleave: PropsTypes.func }); var WeekPickerProps = _extends$1(_extends$1(_extends$1({}, PickerProps), SinglePickerProps), { placeholder: PropsTypes.string }); var InputIcon = function InputIcon2(_2, _ref) { var _classNames; var attrs = _ref.attrs; var _a3, _b2; var suffixIcon = attrs.suffixIcon, prefixCls2 = attrs.prefixCls; return (suffixIcon && isValidElement(suffixIcon) ? cloneElement(suffixIcon, { class: classNames((_classNames = {}, _defineProperty$12(_classNames, (_a3 = suffixIcon.props) === null || _a3 === void 0 ? void 0 : _a3.class, (_b2 = suffixIcon.props) === null || _b2 === void 0 ? void 0 : _b2.class), _defineProperty$12(_classNames, "".concat(prefixCls2, "-picker-icon"), true), _classNames)) }) : createVNode("span", { "class": "".concat(prefixCls2, "-picker-icon") }, [suffixIcon])) || createVNode(CalendarOutlined$1, { "class": "".concat(prefixCls2, "-picker-icon") }, null); }; InputIcon.inheritAttrs = false; var InputIcon$1 = InputIcon; function getShowDateFromValue(value24, mode3) { var _value = _slicedToArray$4(value24, 2), start = _value[0], end = _value[1]; if (!start && !end) { return; } if (mode3 && mode3[0] === "month") { return [start, end]; } var newEnd = end && end.isSame(start, "month") ? end.clone().add(1, "month") : end; return [start, newEnd]; } function pickerValueAdapter(value24) { if (!value24) { return; } if (Array.isArray(value24)) { return value24; } return [value24, value24.clone().add(1, "month")]; } function isEmptyArray(arr) { if (Array.isArray(arr)) { return arr.length === 0 || arr.every(function(i2) { return !i2; }); } return false; } function fixLocale(value24, localeCode) { if (!localeCode) { return; } if (!value24 || value24.length === 0) { return; } var _value2 = _slicedToArray$4(value24, 2), start = _value2[0], end = _value2[1]; if (start) { start.locale(localeCode); } if (end) { end.locale(localeCode); } } var RangePicker = defineComponent({ name: "ARangePicker", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$1(RangePickerProps, { allowClear: true, showToday: false, separator: "~" }), setup: function setup62() { return { configProvider: inject("configProvider", defaultConfigProvider), picker: null, sTagPrefixCls: void 0, sPrefixCls: "" }; }, data: function data33() { var value24 = this.value || this.defaultValue || []; var _value3 = _slicedToArray$4(value24, 2), start = _value3[0], end = _value3[1]; if (start && !interopDefault(hooks).isMoment(start) || end && !interopDefault(hooks).isMoment(end)) { throw new Error("The value/defaultValue of RangePicker must be a moment object array after `antd@2.0`, see: https://u.ant.design/date-picker-value"); } var pickerValue = !value24 || isEmptyArray(value24) ? this.defaultPickerValue : value24; return { sValue: value24, sShowDate: pickerValueAdapter(pickerValue || interopDefault(hooks)()), sOpen: this.open, sHoverValue: [] }; }, watch: { value: function value22(val) { var value24 = val || []; var state = { sValue: value24 }; if (!shallowEqual$1(val, this.sValue)) { state = _extends$1(_extends$1({}, state), { sShowDate: getShowDateFromValue(value24, this.mode) || this.sShowDate }); } this.setState(state); }, open: function open4(val) { var state = { sOpen: val }; this.setState(state); }, sOpen: function sOpen(val, oldVal) { var _this = this; nextTick(function() { if (!hasProp(_this, "open") && oldVal && !val) { _this.focus(); } }); } }, methods: { setValue: function setValue7(value24, hidePanel) { this.handleChange(value24); if ((hidePanel || !this.showTime) && !hasProp(this, "open")) { this.setState({ sOpen: false }); } }, savePicker: function savePicker(node) { this.picker = node; }, clearSelection: function clearSelection2(e2) { e2.preventDefault(); e2.stopPropagation(); this.setState({ sValue: [] }); this.handleChange([]); }, clearHoverValue: function clearHoverValue() { this.setState({ sHoverValue: [] }); }, handleChange: function handleChange10(value24) { if (!hasProp(this, "value")) { this.setState(function(_ref) { var sShowDate = _ref.sShowDate; return { sValue: value24, sShowDate: getShowDateFromValue(value24) || sShowDate }; }); } if (value24[0] && value24[1] && value24[0].diff(value24[1]) > 0) { value24[1] = void 0; } var _value4 = _slicedToArray$4(value24, 2), start = _value4[0], end = _value4[1]; this.$emit("change", value24, [formatDate(start, this.format), formatDate(end, this.format)]); }, handleOpenChange: function handleOpenChange(open6) { if (!hasProp(this, "open")) { this.setState({ sOpen: open6 }); } if (open6 === false) { this.clearHoverValue(); } this.$emit("openChange", open6); }, handleShowDateChange: function handleShowDateChange(showDate) { this.setState({ sShowDate: showDate }); }, handleHoverChange: function handleHoverChange(hoverValue2) { this.setState({ sHoverValue: hoverValue2 }); }, handleRangeMouseLeave: function handleRangeMouseLeave() { if (this.sOpen) { this.clearHoverValue(); } }, handleCalendarInputSelect: function handleCalendarInputSelect(value24) { var _value5 = _slicedToArray$4(value24, 1), start = _value5[0]; if (!start) { return; } this.setState(function(_ref2) { var sShowDate = _ref2.sShowDate; return { sValue: value24, sShowDate: getShowDateFromValue(value24) || sShowDate }; }); }, handleRangeClick: function handleRangeClick(value24) { if (typeof value24 === "function") { value24 = value24(); } this.setValue(value24, true); this.$emit("ok", value24); this.$emit("openChange", false); }, onMouseEnter: function onMouseEnter(e2) { this.$emit("mouseenter", e2); }, onMouseLeave: function onMouseLeave(e2) { this.$emit("mouseleave", e2); }, focus: function focus15() { this.picker.focus(); }, blur: function blur12() { this.picker.blur(); }, renderFooter: function renderFooter() { var _this2 = this; var ranges = this.ranges, $slots = this.$slots; var prefixCls2 = this.sPrefixCls, tagPrefixCls = this.sTagPrefixCls; var renderExtraFooter = this.renderExtraFooter || $slots.renderExtraFooter; if (!ranges && !renderExtraFooter) { return null; } var customFooter = renderExtraFooter ? createVNode("div", { "class": "".concat(prefixCls2, "-footer-extra"), "key": "extra" }, [typeof renderExtraFooter === "function" ? renderExtraFooter() : renderExtraFooter]) : null; var operations = ranges && Object.keys(ranges).map(function(range2) { var value24 = ranges[range2]; var hoverValue2 = typeof value24 === "function" ? value24.call(_this2) : value24; return createVNode(Tag$1, { "key": range2, "prefixCls": tagPrefixCls, "color": "blue", "onClick": function onClick7() { return _this2.handleRangeClick(value24); }, "onMouseenter": function onMouseenter2() { return _this2.setState({ sHoverValue: hoverValue2 }); }, "onMouseleave": _this2.handleRangeMouseLeave }, { default: function _default8() { return [range2]; } }); }); var rangeNode = operations && operations.length > 0 ? createVNode("div", { "class": "".concat(prefixCls2, "-footer-extra ").concat(prefixCls2, "-range-quick-selector"), "key": "range" }, [operations]) : null; return [rangeNode, customFooter]; } }, render: function render57() { var _classNames, _this3 = this; var props2 = _extends$1(_extends$1({}, getOptionProps(this)), this.$attrs); var suffixIcon = getComponent(this, "suffixIcon"); suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon; var value24 = this.sValue, showDate = this.sShowDate, hoverValue2 = this.sHoverValue, open6 = this.sOpen, $slots = this.$slots; var customizePrefixCls = props2.prefixCls, customizeTagPrefixCls = props2.tagPrefixCls, popupStyle = props2.popupStyle, disabledDate = props2.disabledDate, disabledTime = props2.disabledTime, showTime = props2.showTime, showToday = props2.showToday, ranges = props2.ranges, locale2 = props2.locale, localeCode = props2.localeCode, format3 = props2.format, separator2 = props2.separator, inputReadOnly = props2.inputReadOnly, style = props2.style, onCalendarChange = props2.onCalendarChange, onOk3 = props2.onOk, onBlur6 = props2.onBlur, onFocus5 = props2.onFocus, onPanelChange3 = props2.onPanelChange; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("calendar", customizePrefixCls); var tagPrefixCls = getPrefixCls2("tag", customizeTagPrefixCls); this.sPrefixCls = prefixCls2; this.sTagPrefixCls = tagPrefixCls; var dateRender = props2.dateRender || $slots.dateRender; fixLocale(value24, localeCode); fixLocale(showDate, localeCode); var calendarClassName = classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-time"), showTime), _defineProperty$12(_classNames, "".concat(prefixCls2, "-range-with-ranges"), ranges), _classNames)); var pickerChangeHandler = { onChange: this.handleChange }; var calendarProps = { onOk: this.handleChange }; if (props2.timePicker) { pickerChangeHandler.onChange = function(changedValue) { return _this3.handleChange(changedValue); }; } else { calendarProps = {}; } if ("mode" in props2) { calendarProps.mode = props2.mode; } var startPlaceholder = Array.isArray(props2.placeholder) ? props2.placeholder[0] : locale2.lang.rangePlaceholder[0]; var endPlaceholder = Array.isArray(props2.placeholder) ? props2.placeholder[1] : locale2.lang.rangePlaceholder[1]; var rangeCalendarProps = _extends$1(_extends$1({}, calendarProps), { separator: separator2, format: format3, prefixCls: prefixCls2, renderFooter: this.renderFooter, timePicker: props2.timePicker, disabledDate, disabledTime, dateInputPlaceholder: [startPlaceholder, endPlaceholder], locale: locale2.lang, dateRender, value: showDate, hoverValue: hoverValue2, showToday, inputReadOnly, onChange: onCalendarChange, onOk: onOk3, onValueChange: this.handleShowDateChange, onHoverChange: this.handleHoverChange, onPanelChange: onPanelChange3, onInputSelect: this.handleCalendarInputSelect, class: calendarClassName }); var calendar2 = createVNode(RangeCalendar$1, rangeCalendarProps, $slots); var pickerStyle = {}; if (props2.showTime) { pickerStyle.width = "350px"; } var _value6 = _slicedToArray$4(value24, 2), startValue = _value6[0], endValue = _value6[1]; var clearIcon = !props2.disabled && props2.allowClear && value24 && (startValue || endValue) ? createVNode(CloseCircleFilled$3, { "class": "".concat(prefixCls2, "-picker-clear"), "onClick": this.clearSelection }, null) : null; var inputIcon = createVNode(InputIcon$1, { "suffixIcon": suffixIcon, "prefixCls": prefixCls2 }, null); var input = function input2(_ref3) { var inputValue = _ref3.value; var _inputValue = _slicedToArray$4(inputValue, 2), start = _inputValue[0], end = _inputValue[1]; return createVNode("span", { "class": props2.pickerInputClass }, [createVNode("input", { "disabled": props2.disabled, "readonly": true, "value": formatDate(start, props2.format), "placeholder": startPlaceholder, "class": "".concat(prefixCls2, "-range-picker-input"), "tabindex": -1 }, null), createVNode("span", { "class": "".concat(prefixCls2, "-range-picker-separator") }, [createTextVNode(" "), separator2, createTextVNode(" ")]), createVNode("input", { "disabled": props2.disabled, "readonly": true, "value": formatDate(end, props2.format), "placeholder": endPlaceholder, "class": "".concat(prefixCls2, "-range-picker-input"), "tabindex": -1 }, null), clearIcon, inputIcon]); }; var vcDatePickerProps = _extends$1(_extends$1(_extends$1({}, props2), pickerChangeHandler), { calendar: calendar2, value: value24, open: open6, prefixCls: "".concat(prefixCls2, "-picker-container"), onOpenChange: this.handleOpenChange, style: popupStyle }); return createVNode("span", _objectSpread2$2({ "ref": this.savePicker, "id": props2.id, "class": classNames(props2.class, props2.pickerClass), "style": _extends$1(_extends$1({}, pickerStyle), style), "tabindex": props2.disabled ? -1 : 0, "onFocus": onFocus5, "onBlur": onBlur6, "onMouseenter": this.onMouseEnter, "onMouseleave": this.onMouseLeave }, getDataAndAriaProps$1(props2)), [createVNode(VcDatePicker, vcDatePickerProps, _extends$1({ default: input }, $slots))]); } }); function formatValue(value24, format3) { return value24 && value24.format(format3) || ""; } function noop$b() { } var WeekPicker = defineComponent({ name: "AWeekPicker", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$1(WeekPickerProps, { allowClear: true }), setup: function setup63() { return { configProvider: inject("configProvider", defaultConfigProvider), prevState: {}, input: void 0, sPrefixCls: void 0 }; }, data: function data34() { var value24 = this.value || this.defaultValue; if (value24 && !interopDefault(hooks).isMoment(value24)) { throw new Error("The value/defaultValue of WeekPicker or MonthPicker must be a moment object"); } return { _value: value24, _open: this.open }; }, watch: { value: function value23(val) { var state = { _value: val }; this.setState(state); this.prevState = _extends$1(_extends$1({}, this.$data), state); }, open: function open5(val) { var state = { _open: val }; this.setState(state); this.prevState = _extends$1(_extends$1({}, this.$data), state); }, _open: function _open(val, oldVal) { var _this = this; nextTick(function() { if (!hasProp(_this, "open") && oldVal && !val) { _this.focus(); } }); } }, mounted: function mounted17() { this.prevState = _extends$1({}, this.$data); }, updated: function updated7() { var _this2 = this; nextTick(function() { if (!hasProp(_this2, "open") && _this2.prevState._open && !_this2._open) { _this2.focus(); } }); }, methods: { saveInput: function saveInput5(node) { this.input = node; }, weekDateRender: function weekDateRender(_ref) { var current2 = _ref.current; var selectedValue5 = this.$data._value; var prefixCls2 = this.sPrefixCls, $slots = this.$slots; var dateRender = this.dateRender || $slots.dateRender; var dateNode = dateRender ? dateRender({ current: current2 }) : current2.date(); if (selectedValue5 && current2.year() === selectedValue5.year() && current2.week() === selectedValue5.week()) { return createVNode("div", { "class": "".concat(prefixCls2, "-selected-day") }, [createVNode("div", { "class": "".concat(prefixCls2, "-date") }, [dateNode])]); } return createVNode("div", { "class": "".concat(prefixCls2, "-date") }, [dateNode]); }, handleChange: function handleChange11(value24) { if (!hasProp(this, "value")) { this.setState({ _value: value24 }); } this.$emit("change", value24, formatValue(value24, this.format)); }, handleOpenChange: function handleOpenChange2(open6) { if (!hasProp(this, "open")) { this.setState({ _open: open6 }); } this.$emit("openChange", open6); }, clearSelection: function clearSelection3(e2) { e2.preventDefault(); e2.stopPropagation(); this.handleChange(null); }, focus: function focus16() { this.input.focus(); }, blur: function blur13() { this.input.blur(); }, renderFooter: function renderFooter2() { var prefixCls2 = this.sPrefixCls, $slots = this.$slots; var renderExtraFooter = this.renderExtraFooter || $slots.renderExtraFooter; return renderExtraFooter ? createVNode("div", { "class": "".concat(prefixCls2, "-footer-extra") }, [renderExtraFooter.apply(void 0, arguments)]) : null; } }, render: function render58() { var _this3 = this; var props2 = _extends$1(_extends$1({}, getOptionProps(this)), this.$attrs); var suffixIcon = getComponent(this, "suffixIcon"); suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon; var customizePrefixCls = this.prefixCls, disabled = this.disabled, pickerClass = this.pickerClass, popupStyle = this.popupStyle, pickerInputClass = this.pickerInputClass, format3 = this.format, allowClear = this.allowClear, locale2 = this.locale, localeCode = this.localeCode, disabledDate = this.disabledDate, defaultPickerValue = this.defaultPickerValue, $data = this.$data, $slots = this.$slots; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("calendar", customizePrefixCls); this.sPrefixCls = prefixCls2; var pickerValue = $data._value, open6 = $data._open; var className = props2.class, style = props2.style, id2 = props2.id, _props$onFocus = props2.onFocus, onFocus5 = _props$onFocus === void 0 ? noop$b : _props$onFocus, _props$onBlur = props2.onBlur, onBlur6 = _props$onBlur === void 0 ? noop$b : _props$onBlur; if (pickerValue && localeCode) { pickerValue.locale(localeCode); } var placeholder = hasProp(this, "placeholder") ? this.placeholder : locale2.lang.placeholder; var weekDateRender2 = this.dateRender || $slots.dateRender || this.weekDateRender; var calendar2 = createVNode(Calendar$1, { "showWeekNumber": true, "dateRender": weekDateRender2, "prefixCls": prefixCls2, "format": format3, "locale": locale2.lang, "showDateInput": false, "showToday": false, "disabledDate": disabledDate, "renderFooter": this.renderFooter, "defaultValue": defaultPickerValue }, null); var clearIcon = !disabled && allowClear && $data._value ? createVNode(CloseCircleFilled$3, { "class": "".concat(prefixCls2, "-picker-clear"), "onClick": this.clearSelection }, null) : null; var inputIcon = createVNode(InputIcon$1, { "suffixIcon": suffixIcon, "prefixCls": prefixCls2 }, null); var input = function input2(_ref2) { var value24 = _ref2.value; return createVNode("span", { "style": { display: "inline-block", width: "100%" } }, [createVNode("input", { "ref": _this3.saveInput, "disabled": disabled, "readonly": true, "value": value24 && value24.format(format3) || "", "placeholder": placeholder, "class": pickerInputClass, "onFocus": onFocus5, "onBlur": onBlur6 }, null), clearIcon, inputIcon]); }; var vcDatePickerProps = _extends$1(_extends$1({}, props2), { calendar: calendar2, prefixCls: "".concat(prefixCls2, "-picker-container"), value: pickerValue, open: open6, onChange: this.handleChange, onOpenChange: this.handleOpenChange, style: popupStyle }); return createVNode("span", _objectSpread2$2({ "class": classNames(className, pickerClass), "style": style, "id": id2 }, getDataAndAriaProps$1(props2)), [createVNode(VcDatePicker, vcDatePickerProps, _extends$1({ default: input }, $slots))]); } }); var WrappedRangePicker = wrapPicker(RangePicker, RangePickerProps, "date"); var WrappedWeekPicker = wrapPicker(WeekPicker, WeekPickerProps, "week"); var DatePicker = wrapPicker(createPicker(Calendar$1, DatePickerProps, "ADatePicker"), DatePickerProps, "date"); var MonthPicker = wrapPicker(createPicker(MonthCalendar$1, MonthPickerProps, "AMonthPicker"), MonthPickerProps, "month"); _extends$1(DatePicker, { RangePicker: WrappedRangePicker, MonthPicker, WeekPicker: WrappedWeekPicker }); DatePicker.install = function(app) { app.component(DatePicker.name, DatePicker); app.component(DatePicker.RangePicker.name, DatePicker.RangePicker); app.component(DatePicker.MonthPicker.name, DatePicker.MonthPicker); app.component(DatePicker.WeekPicker.name, DatePicker.WeekPicker); return app; }; var DatePicker$1 = DatePicker; function notEmpty(val) { return val !== void 0 && val !== null; } var Cell = function Cell2(props2) { var itemPrefixCls = props2.itemPrefixCls, component = props2.component, span = props2.span, labelStyle = props2.labelStyle, contentStyle = props2.contentStyle, bordered = props2.bordered, label = props2.label, content = props2.content, colon = props2.colon; var Component = component; if (bordered) { var _ref; return createVNode(Component, { "class": [(_ref = {}, _defineProperty$12(_ref, "".concat(itemPrefixCls, "-item-label"), notEmpty(label)), _defineProperty$12(_ref, "".concat(itemPrefixCls, "-item-content"), notEmpty(content)), _ref)], "colSpan": span }, { default: function _default8() { return [notEmpty(label) && createVNode("span", { "style": labelStyle }, [label]), notEmpty(content) && createVNode("span", { "style": contentStyle }, [content])]; } }); } return createVNode(Component, { "class": ["".concat(itemPrefixCls, "-item")], "colSpan": span }, { default: function _default8() { return [createVNode("div", { "class": "".concat(itemPrefixCls, "-item-container") }, [label && createVNode("span", { "class": ["".concat(itemPrefixCls, "-item-label"), _defineProperty$12({}, "".concat(itemPrefixCls, "-item-no-colon"), !colon)], "style": labelStyle }, [label]), content && createVNode("span", { "class": "".concat(itemPrefixCls, "-item-content"), "style": contentStyle }, [content])])]; } }); }; var Cell$1 = Cell; var Row = function Row2(props2) { var renderCells = function renderCells2(items, _ref, _ref2) { var colon = _ref.colon, prefixCls3 = _ref.prefixCls, bordered2 = _ref.bordered; var component = _ref2.component, type2 = _ref2.type, showLabel = _ref2.showLabel, showContent = _ref2.showContent, rootLabelStyle = _ref2.labelStyle, rootContentStyle = _ref2.contentStyle; return items.map(function(item, index3) { var _a3, _b2; var _ref3 = item.props || {}, _ref3$prefixCls = _ref3.prefixCls, itemPrefixCls = _ref3$prefixCls === void 0 ? prefixCls3 : _ref3$prefixCls, _ref3$span = _ref3.span, span = _ref3$span === void 0 ? 1 : _ref3$span, labelStyle2 = _ref3.labelStyle, contentStyle2 = _ref3.contentStyle, _ref3$label = _ref3.label, label = _ref3$label === void 0 ? (_b2 = (_a3 = item.children) === null || _a3 === void 0 ? void 0 : _a3.label) === null || _b2 === void 0 ? void 0 : _b2.call(_a3) : _ref3$label; var children = getSlot$1(item); var className = getClass(item); var style = getStyle(item); var key2 = item.key; if (typeof component === "string") { return createVNode(Cell$1, { "key": "".concat(type2, "-").concat(String(key2) || index3), "class": className, "style": style, "labelStyle": _extends$1(_extends$1({}, rootLabelStyle.value), labelStyle2), "contentStyle": _extends$1(_extends$1({}, rootContentStyle.value), contentStyle2), "span": span, "colon": colon, "component": component, "itemPrefixCls": itemPrefixCls, "bordered": bordered2, "label": showLabel ? label : null, "content": showContent ? children : null }, null); } return [createVNode(Cell$1, { "key": "label-".concat(String(key2) || index3), "class": className, "style": _extends$1(_extends$1(_extends$1({}, rootLabelStyle.value), style), labelStyle2), "span": 1, "colon": colon, "component": component[0], "itemPrefixCls": itemPrefixCls, "bordered": bordered2, "label": label }, null), createVNode(Cell$1, { "key": "content-".concat(String(key2) || index3), "class": className, "style": _extends$1(_extends$1(_extends$1({}, rootContentStyle.value), style), contentStyle2), "span": span * 2 - 1, "component": component[1], "itemPrefixCls": itemPrefixCls, "bordered": bordered2, "content": children }, null)]; }); }; var prefixCls2 = props2.prefixCls, vertical = props2.vertical, row = props2.row, index2 = props2.index, bordered = props2.bordered; var _inject = inject(descriptionsContext, { labelStyle: ref({}), contentStyle: ref({}) }), labelStyle = _inject.labelStyle, contentStyle = _inject.contentStyle; if (vertical) { return createVNode(Fragment, null, [createVNode("tr", { "key": "label-".concat(index2), "class": "".concat(prefixCls2, "-row") }, [renderCells(row, props2, { component: "th", type: "label", showLabel: true, labelStyle, contentStyle })]), createVNode("tr", { "key": "content-".concat(index2), "class": "".concat(prefixCls2, "-row") }, [renderCells(row, props2, { component: "td", type: "content", showContent: true, labelStyle, contentStyle })])]); } return createVNode("tr", { "key": index2, "class": "".concat(prefixCls2, "-row") }, [renderCells(row, props2, { component: bordered ? ["th", "td"] : "td", type: "item", showLabel: true, showContent: true, labelStyle, contentStyle })]); }; var Row$1 = Row; ({ prefixCls: PropsTypes.string, label: PropsTypes.any, span: PropsTypes.number }); var descriptionsItemProp = { prefixCls: PropsTypes.string, label: PropsTypes.VNodeChild, labelStyle: PropsTypes.style, contentStyle: PropsTypes.style, span: PropsTypes.number.def(1) }; var DescriptionsItem = defineComponent({ name: "ADescriptionsItem", props: descriptionsItemProp, slots: ["label"], setup: function setup64(_2, _ref) { var slots = _ref.slots; return function() { var _a3; return (_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots); }; } }); var DEFAULT_COLUMN_MAP = { xxl: 3, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }; function getColumn(column, screens2) { if (typeof column === "number") { return column; } if (_typeof$2(column) === "object") { for (var i2 = 0; i2 < responsiveArray.length; i2++) { var breakpoint = responsiveArray[i2]; if (screens2[breakpoint] && column[breakpoint] !== void 0) { return column[breakpoint] || DEFAULT_COLUMN_MAP[breakpoint]; } } } return 3; } function getFilledItem(node, span, rowRestCol) { var clone4 = node; if (span === void 0 || span > rowRestCol) { clone4 = cloneElement(node, { span: rowRestCol }); warning$5(span === void 0, "Descriptions", "Sum of column `span` in a line not match `column` of Descriptions."); } return clone4; } function getRows(children, column) { var childNodes = flattenChildren(children); var rows = []; var tmpRow = []; var rowRestCol = column; childNodes.forEach(function(node, index2) { var _a3; var span = (_a3 = node.props) === null || _a3 === void 0 ? void 0 : _a3.span; var mergedSpan = span || 1; if (index2 === childNodes.length - 1) { tmpRow.push(getFilledItem(node, span, rowRestCol)); rows.push(tmpRow); return; } if (mergedSpan < rowRestCol) { rowRestCol -= mergedSpan; tmpRow.push(node); } else { tmpRow.push(getFilledItem(node, mergedSpan, rowRestCol)); rows.push(tmpRow); rowRestCol = column; tmpRow = []; } }); return rows; } var descriptionsProps = { prefixCls: PropsTypes.string, bordered: PropsTypes.looseBool, size: PropsTypes.oneOf(tuple("default", "middle", "small")).def("default"), title: PropsTypes.VNodeChild, extra: PropsTypes.VNodeChild, column: { type: [Number, Object], default: function _default6() { return DEFAULT_COLUMN_MAP; } }, layout: PropsTypes.oneOf(tuple("horizontal", "vertical")), colon: PropsTypes.looseBool, labelStyle: PropsTypes.style, contentStyle: PropsTypes.style }; var descriptionsContext = Symbol("descriptionsContext"); var Descriptions = defineComponent({ name: "ADescriptions", props: descriptionsProps, slots: ["title", "extra"], Item: DescriptionsItem, setup: function setup65(props2, _ref2) { var slots = _ref2.slots; var _useConfigInject = useConfigInject("descriptions", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction; var token2; var screens2 = ref({}); onMounted(function() { token2 = ResponsiveObserve.subscribe(function(screen) { if (_typeof$2(props2.column) !== "object") { return; } screens2.value = screen; }); }); onBeforeUnmount(function() { ResponsiveObserve.unsubscribe(token2); }); provide(descriptionsContext, { labelStyle: toRef(props2, "labelStyle"), contentStyle: toRef(props2, "contentStyle") }); var mergeColumn = computed(function() { return getColumn(props2.column, screens2.value); }); return function() { var _ref3; var _a3, _b2, _c; var size = props2.size, _props$bordered = props2.bordered, bordered = _props$bordered === void 0 ? false : _props$bordered, _props$layout = props2.layout, layout = _props$layout === void 0 ? "horizontal" : _props$layout, _props$colon = props2.colon, colon = _props$colon === void 0 ? true : _props$colon, _props$title = props2.title, title = _props$title === void 0 ? (_a3 = slots.title) === null || _a3 === void 0 ? void 0 : _a3.call(slots) : _props$title, _props$extra = props2.extra, extra = _props$extra === void 0 ? (_b2 = slots.extra) === null || _b2 === void 0 ? void 0 : _b2.call(slots) : _props$extra; var children = (_c = slots.default) === null || _c === void 0 ? void 0 : _c.call(slots); var rows = getRows(children, mergeColumn.value); return createVNode("div", { "class": [prefixCls2.value, (_ref3 = {}, _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-").concat(size), size !== "default"), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-bordered"), !!bordered), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-rtl"), direction.value === "rtl"), _ref3)] }, [(title || extra) && createVNode("div", { "class": "".concat(prefixCls2.value, "-header") }, [title && createVNode("div", { "class": "".concat(prefixCls2.value, "-title") }, [title]), extra && createVNode("div", { "class": "".concat(prefixCls2.value, "-extra") }, [extra])]), createVNode("div", { "class": "".concat(prefixCls2.value, "-view") }, [createVNode("table", null, [createVNode("tbody", null, [rows.map(function(row, index2) { return createVNode(Row$1, { "key": index2, "index": index2, "colon": colon, "prefixCls": prefixCls2.value, "vertical": layout === "vertical", "bordered": bordered, "row": row }, null); })])])])]); }; } }); Descriptions.install = function(app) { app.component(Descriptions.name, Descriptions); app.component(Descriptions.Item.name, Descriptions.Item); return app; }; var Descriptions$1 = Descriptions; var dividerProps = { prefixCls: String, type: { type: String, default: "horizontal" }, dashed: { type: Boolean, default: false }, orientation: { type: String, default: "center" }, plain: { type: Boolean, default: false } }; var Divider = defineComponent({ name: "ADivider", props: dividerProps, setup: function setup66(props2, _ref) { var slots = _ref.slots; var configProvider = inject("configProvider", defaultConfigProvider); var prefixClsRef = computed(function() { return configProvider.getPrefixCls("divider", props2.prefixCls); }); var classString = computed(function() { var _ref2; var type2 = props2.type, dashed = props2.dashed, plain = props2.plain; var prefixCls2 = prefixClsRef.value; return _ref2 = {}, _defineProperty$12(_ref2, prefixCls2, true), _defineProperty$12(_ref2, "".concat(prefixCls2, "-").concat(type2), true), _defineProperty$12(_ref2, "".concat(prefixCls2, "-dashed"), !!dashed), _defineProperty$12(_ref2, "".concat(prefixCls2, "-plain"), !!plain), _defineProperty$12(_ref2, "".concat(prefixCls2, "-rtl"), configProvider.direction === "rtl"), _ref2; }); var orientationPrefix = computed(function() { return props2.orientation.length > 0 ? "-" + props2.orientation : props2.orientation; }); return function() { var _a3; var children = flattenChildren((_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)); return createVNode("div", { "class": [classString.value, children.length ? "".concat(prefixClsRef.value, "-with-text ").concat(prefixClsRef.value, "-with-text").concat(orientationPrefix.value) : ""], "role": "separator" }, [children.length ? createVNode("span", { "class": "".concat(prefixClsRef.value, "-inner-text") }, [children]) : null]); }; } }); var Divider$1 = withInstall(Divider); Dropdown$1.Button = DropdownButton; Dropdown$1.install = function(app) { app.component(Dropdown$1.name, Dropdown$1); app.component(DropdownButton.name, DropdownButton); return app; }; var cached; function getScrollBarSize(fresh) { if (fresh || cached === void 0) { var inner = document.createElement("div"); inner.style.width = "100%"; inner.style.height = "200px"; var outer = document.createElement("div"); var outerStyle = outer.style; outerStyle.position = "absolute"; outerStyle.top = 0; outerStyle.left = 0; outerStyle.pointerEvents = "none"; outerStyle.visibility = "hidden"; outerStyle.width = "200px"; outerStyle.height = "150px"; outerStyle.overflow = "hidden"; outer.appendChild(inner); document.body.appendChild(outer); var widthContained = inner.offsetWidth; outer.style.overflow = "scroll"; var widthScroll = inner.offsetWidth; if (widthContained === widthScroll) { widthScroll = outer.clientWidth; } document.body.removeChild(outer); cached = widthContained - widthScroll; } return cached; } var IProps = { width: PropsTypes.any, height: PropsTypes.any, defaultOpen: PropsTypes.looseBool, firstEnter: PropsTypes.looseBool, open: PropsTypes.looseBool, prefixCls: PropsTypes.string, placement: PropsTypes.string, level: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.array]), levelMove: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.func, PropsTypes.array]), ease: PropsTypes.string, duration: PropsTypes.string, handler: PropsTypes.any, showMask: PropsTypes.looseBool, maskStyle: PropsTypes.object, className: PropsTypes.string, wrapStyle: PropsTypes.object, maskClosable: PropsTypes.looseBool, afterVisibleChange: PropsTypes.func, keyboard: PropsTypes.looseBool }; var IDrawerProps = _extends$1(_extends$1({}, IProps), { wrapperClassName: PropsTypes.string, forceRender: PropsTypes.looseBool, getContainer: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.func, PropsTypes.object, PropsTypes.looseBool]) }); _extends$1(_extends$1({}, IProps), { getContainer: PropsTypes.func, getOpenCount: PropsTypes.func, switchScrollingEffect: PropsTypes.func }); function dataToArray(vars) { if (Array.isArray(vars)) { return vars; } return [vars]; } var transitionEndObject = { transition: "transitionend", WebkitTransition: "webkitTransitionEnd", MozTransition: "transitionend", OTransition: "oTransitionEnd otransitionend" }; var transitionStr = Object.keys(transitionEndObject).filter(function(key2) { if (typeof document === "undefined") { return false; } var html = document.getElementsByTagName("html")[0]; return key2 in (html ? html.style : {}); })[0]; var transitionEnd = transitionEndObject[transitionStr]; function addEventListener$1(target, eventType, callback2, options2) { if (target.addEventListener) { target.addEventListener(eventType, callback2, options2); } else if (target.attachEvent) { target.attachEvent("on".concat(eventType), callback2); } } function removeEventListener$1(target, eventType, callback2, options2) { if (target.removeEventListener) { target.removeEventListener(eventType, callback2, options2); } else if (target.attachEvent) { target.detachEvent("on".concat(eventType), callback2); } } function transformArguments(arg, cb) { var result; if (typeof arg === "function") { result = arg(cb); } else { result = arg; } if (Array.isArray(result)) { if (result.length === 2) { return result; } return [result[0], result[1]]; } return [result]; } var isNumeric = function isNumeric3(value24) { return !isNaN(parseFloat(value24)) && isFinite(value24); }; var __rest$m = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; function noop$a() { } var currentDrawer = {}; var windowIsUndefined$1 = !(typeof window !== "undefined" && window.document && window.document.createElement); var Drawer$2 = defineComponent({ name: "Drawer", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$2(IDrawerProps, { prefixCls: "drawer", placement: "left", getContainer: "body", level: "all", duration: ".3s", ease: "cubic-bezier(0.78, 0.14, 0.15, 0.86)", firstEnter: false, showMask: true, handler: true, maskStyle: {}, wrapperClassName: "" }), data: function data35() { this.levelDom = []; this.contentDom = null; this.maskDom = null; this.handlerdom = null; this.mousePos = null; this.sFirstEnter = this.firstEnter; this.timeout = null; this.children = null; this.dom = null; this.drawerId = Number((Date.now() + Math.random()).toString().replace(".", Math.round(Math.random() * 9))).toString(16); var open6 = this.open !== void 0 ? this.open : !!this.defaultOpen; currentDrawer[this.drawerId] = open6; this.orignalOpen = this.open; this.preProps = _extends$1({}, this.$props); return { sOpen: open6, isOpenChange: void 0, passive: void 0, container: void 0 }; }, watch: { open: function(_open3) { function open6(_x) { return _open3.apply(this, arguments); } open6.toString = function() { return _open3.toString(); }; return open6; }(function(val) { var _this = this; if (val !== void 0 && val !== this.preProps.open) { this.isOpenChange = true; if (!this.container) { this.getDefault(this.$props); } this.setState({ sOpen: open }); } this.preProps.open = val; if (val) { setTimeout(function() { _this.domFocus(); }); } }), placement: function placement(val) { if (val !== this.preProps.placement) { this.contentDom = null; } this.preProps.placement = val; }, level: function level(val) { if (this.preProps.level !== val) { this.getParentAndLevelDom(this.$props); } this.preProps.level = val; } }, mounted: function mounted18() { var _this2 = this; nextTick(function() { if (!windowIsUndefined$1) { _this2.passive = supportsPassive$1 ? { passive: false } : false; } var open6 = _this2.getOpen(); if (_this2.handler || open6 || _this2.sFirstEnter) { _this2.getDefault(_this2.$props); if (open6) { _this2.isOpenChange = true; nextTick(function() { _this2.domFocus(); }); } _this2.$forceUpdate(); } }); }, updated: function updated8() { var _this3 = this; nextTick(function() { if (!_this3.sFirstEnter && _this3.container) { _this3.$forceUpdate(); _this3.sFirstEnter = true; } }); }, beforeUnmount: function beforeUnmount9() { delete currentDrawer[this.drawerId]; delete this.isOpenChange; if (this.container) { if (this.sOpen) { this.setLevelDomTransform(false, true); } document.body.style.overflow = ""; } this.sFirstEnter = false; clearTimeout(this.timeout); }, methods: { domFocus: function domFocus() { if (this.dom) { this.dom.focus(); } }, onKeyDown: function onKeyDown8(e2) { if (e2.keyCode === KeyCode$1.ESC) { e2.stopPropagation(); this.__emit("close", e2); } }, onMaskTouchEnd: function onMaskTouchEnd(e2) { this.__emit("close", e2); this.onTouchEnd(e2, true); }, onIconTouchEnd: function onIconTouchEnd(e2) { this.__emit("handleClick", e2); this.onTouchEnd(e2); }, onTouchEnd: function onTouchEnd(e2, close7) { if (this.open !== void 0) { return; } var open6 = close7 || this.sOpen; this.isOpenChange = true; this.setState({ sOpen: !open6 }); }, onWrapperTransitionEnd: function onWrapperTransitionEnd(e2) { if (e2.target === this.contentWrapper && e2.propertyName.match(/transform$/)) { var _open22 = this.getOpen(); this.dom.style.transition = ""; if (!_open22 && this.getCurrentDrawerSome()) { document.body.style.overflowX = ""; if (this.maskDom) { this.maskDom.style.left = ""; this.maskDom.style.width = ""; } } if (this.afterVisibleChange) { this.afterVisibleChange(!!_open22); } } }, getDefault: function getDefault(props2) { this.getParentAndLevelDom(props2); if (props2.getContainer || props2.parent) { this.container = this.defaultGetContainer(); } }, getCurrentDrawerSome: function getCurrentDrawerSome() { return !Object.keys(currentDrawer).some(function(key2) { return currentDrawer[key2]; }); }, getSelfContainer: function getSelfContainer() { return this.container; }, getParentAndLevelDom: function getParentAndLevelDom(props2) { var _this4 = this; if (windowIsUndefined$1) { return; } var level2 = props2.level, getContainer5 = props2.getContainer; this.levelDom = []; if (getContainer5) { if (typeof getContainer5 === "string") { var dom = document.querySelectorAll(getContainer5)[0]; this.parent = dom; } if (typeof getContainer5 === "function") { this.parent = getContainer5(); } if (_typeof$2(getContainer5) === "object" && getContainer5 instanceof window.HTMLElement) { this.parent = getContainer5; } } if (!getContainer5 && this.container) { this.parent = this.container.parentNode; } if (level2 === "all") { var children = Array.prototype.slice.call(this.parent.children); children.forEach(function(child) { if (child.nodeName !== "SCRIPT" && child.nodeName !== "STYLE" && child.nodeName !== "LINK" && child !== _this4.container) { _this4.levelDom.push(child); } }); } else if (level2) { dataToArray(level2).forEach(function(key2) { document.querySelectorAll(key2).forEach(function(item) { _this4.levelDom.push(item); }); }); } }, setLevelDomTransform: function setLevelDomTransform(open6, openTransition, placementName, value24) { var _this5 = this; var _this$$props = this.$props, placement2 = _this$$props.placement, levelMove = _this$$props.levelMove, duration2 = _this$$props.duration, ease = _this$$props.ease, getContainer5 = _this$$props.getContainer; if (!windowIsUndefined$1) { this.levelDom.forEach(function(dom) { if (dom && (_this5.isOpenChange || openTransition)) { dom.style.transition = "transform ".concat(duration2, " ").concat(ease); addEventListener$1(dom, transitionEnd, _this5.trnasitionEnd); var levelValue = open6 ? value24 : 0; if (levelMove) { var $levelMove = transformArguments(levelMove, { target: dom, open: open6 }); levelValue = open6 ? $levelMove[0] : $levelMove[1] || 0; } var $value = typeof levelValue === "number" ? "".concat(levelValue, "px") : levelValue; var placementPos = placement2 === "left" || placement2 === "top" ? $value : "-".concat($value); dom.style.transform = levelValue ? "".concat(placementName, "(").concat(placementPos, ")") : ""; dom.style.msTransform = levelValue ? "".concat(placementName, "(").concat(placementPos, ")") : ""; } }); if (getContainer5 === "body") { var eventArray = ["touchstart"]; var domArray = [document.body, this.maskDom, this.handlerdom, this.contentDom]; var right = document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth ? getScrollBarSize(1) : 0; var widthTransition = "width ".concat(duration2, " ").concat(ease); var trannsformTransition = "transform ".concat(duration2, " ").concat(ease); if (open6 && document.body.style.overflow !== "hidden") { document.body.style.overflow = "hidden"; if (right) { document.body.style.position = "relative"; document.body.style.width = "calc(100% - ".concat(right, "px)"); clearTimeout(this.timeout); if (this.dom) { this.dom.style.transition = "none"; switch (placement2) { case "right": this.dom.style.transform = "translateX(-".concat(right, "px)"); this.dom.style.msTransform = "translateX(-".concat(right, "px)"); break; case "top": case "bottom": this.dom.style.width = "calc(100% - ".concat(right, "px)"); this.dom.style.transform = "translateZ(0)"; break; } this.timeout = setTimeout(function() { _this5.dom.style.transition = "".concat(trannsformTransition, ",").concat(widthTransition); _this5.dom.style.width = ""; _this5.dom.style.transform = ""; _this5.dom.style.msTransform = ""; }); } } domArray.forEach(function(item, i2) { if (!item) { return; } addEventListener$1(item, eventArray[i2] || "touchmove", i2 ? _this5.removeMoveHandler : _this5.removeStartHandler, _this5.passive); }); } else if (this.getCurrentDrawerSome()) { document.body.style.overflow = ""; if ((this.isOpenChange || openTransition) && right) { document.body.style.position = ""; document.body.style.width = ""; if (transitionStr) { document.body.style.overflowX = "hidden"; } if (placement2 === "right" && this.maskDom) { this.maskDom.style.left = "-".concat(right, "px"); this.maskDom.style.width = "calc(100% + ".concat(right, "px)"); } clearTimeout(this.timeout); if (this.dom) { this.dom.style.transition = "none"; var heightTransition; switch (placement2) { case "right": { this.dom.style.transform = "translateX(".concat(right, "px)"); this.dom.style.msTransform = "translateX(".concat(right, "px)"); this.dom.style.width = "100%"; widthTransition = "width 0s ".concat(ease, " ").concat(duration2); break; } case "top": case "bottom": { this.dom.style.width = "calc(100% + ".concat(right, "px)"); this.dom.style.height = "100%"; this.dom.style.transform = "translateZ(0)"; heightTransition = "height 0s ".concat(ease, " ").concat(duration2); break; } } this.timeout = setTimeout(function() { _this5.dom.style.transition = "".concat(trannsformTransition, ",").concat(heightTransition ? "".concat(heightTransition, ",") : "").concat(widthTransition); _this5.dom.style.transform = ""; _this5.dom.style.msTransform = ""; _this5.dom.style.width = ""; _this5.dom.style.height = ""; }); } } domArray.forEach(function(item, i2) { if (!item) { return; } removeEventListener$1(item, eventArray[i2] || "touchmove", i2 ? _this5.removeMoveHandler : _this5.removeStartHandler, _this5.passive); }); } } } var onChange8 = this.$attrs.onChange; if (onChange8 && this.isOpenChange && this.sFirstEnter) { onChange8(open6); this.isOpenChange = false; } }, getChildToRender: function getChildToRender(open6) { var _classnames, _this6 = this, _touchEvents; var _this$$props2 = this.$props, prefixCls2 = _this$$props2.prefixCls, placement2 = _this$$props2.placement, handler7 = _this$$props2.handler, showMask = _this$$props2.showMask, maskStyle = _this$$props2.maskStyle, width = _this$$props2.width, height = _this$$props2.height, wrapStyle = _this$$props2.wrapStyle, keyboard = _this$$props2.keyboard, maskClosable = _this$$props2.maskClosable; var _a3 = this.$attrs, cls = _a3.class, style = _a3.style, restAttrs = __rest$m(_a3, ["class", "style"]); var children = getSlot$1(this); var wrapperClassname = classNames(prefixCls2, (_classnames = {}, _defineProperty$12(_classnames, "".concat(prefixCls2, "-").concat(placement2), true), _defineProperty$12(_classnames, "".concat(prefixCls2, "-open"), open6), _defineProperty$12(_classnames, "no-mask", !showMask), _defineProperty$12(_classnames, cls, cls), _classnames)); var isOpenChange = this.isOpenChange; var isHorizontal = placement2 === "left" || placement2 === "right"; var placementName = "translate".concat(isHorizontal ? "X" : "Y"); var placementPos = placement2 === "left" || placement2 === "top" ? "-100%" : "100%"; var transform2 = open6 ? "" : "".concat(placementName, "(").concat(placementPos, ")"); if (isOpenChange === void 0 || isOpenChange) { var contentValue = this.contentDom ? this.contentDom.getBoundingClientRect()[isHorizontal ? "width" : "height"] : 0; var value24 = (isHorizontal ? width : height) || contentValue; this.setLevelDomTransform(open6, false, placementName, value24); } var handlerChildren; if (handler7 !== false) { var handlerDefalut = createVNode("div", { "class": "drawer-handle", "onClick": function onClick7() { } }, [createVNode("i", { "class": "drawer-handle-icon" }, null)]); var handlerSlot = this.handler; var handlerSlotVnode = handlerSlot || handlerDefalut; var handleIconClick = handlerSlotVnode.props && handlerSlotVnode.props.onClick; handlerChildren = cloneElement(handlerSlotVnode, { onClick: function onClick7(e2) { handleIconClick && handleIconClick(e2); _this6.onIconTouchEnd(e2); }, ref: function ref2(c2) { _this6.handlerdom = c2; } }); } var domContProps = _extends$1(_extends$1({}, restAttrs), { class: wrapperClassname, onTransitionend: this.onWrapperTransitionEnd, onKeydown: open6 && keyboard ? this.onKeyDown : noop$a, style: _extends$1(_extends$1({}, wrapStyle), style) }); var touchEvents = (_touchEvents = {}, _defineProperty$12(_touchEvents, supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart", open6 ? this.removeStartHandler : noop$a), _defineProperty$12(_touchEvents, supportsPassive$1 ? "onTouchmovePassive" : "onTouchmove", open6 ? this.removeMoveHandler : noop$a), _touchEvents); return createVNode("div", _objectSpread2$2(_objectSpread2$2({ "ref": function ref2(c2) { _this6.dom = c2; } }, domContProps), {}, { "tabindex": -1 }), [showMask && createVNode("div", { "key": open6, "class": "".concat(prefixCls2, "-mask"), "onClick": maskClosable ? this.onMaskTouchEnd : noop$a, "style": maskStyle, "ref": function ref2(c2) { _this6.maskDom = c2; } }, null), createVNode("div", { "class": "".concat(prefixCls2, "-content-wrapper"), "style": { transform: transform2, msTransform: transform2, width: isNumeric(width) ? "".concat(width, "px") : width, height: isNumeric(height) ? "".concat(height, "px") : height }, "ref": function ref2(c2) { _this6.contentWrapper = c2; } }, [createVNode("div", _objectSpread2$2({ "class": "".concat(prefixCls2, "-content"), "ref": function ref2(c2) { _this6.contentDom = c2; } }, touchEvents), [children]), handlerChildren])]); }, getOpen: function getOpen() { return this.open !== void 0 ? this.open : this.sOpen; }, getTouchParentScroll: function getTouchParentScroll(root2, currentTarget, differX, differY) { if (!currentTarget || currentTarget === document) { return false; } if (currentTarget === root2.parentNode) { return true; } var isY = Math.max(Math.abs(differX), Math.abs(differY)) === Math.abs(differY); var isX = Math.max(Math.abs(differX), Math.abs(differY)) === Math.abs(differX); var scrollY = currentTarget.scrollHeight - currentTarget.clientHeight; var scrollX = currentTarget.scrollWidth - currentTarget.clientWidth; var t2 = currentTarget.scrollTop; var l2 = currentTarget.scrollLeft; if (currentTarget.scrollTo) { currentTarget.scrollTo(currentTarget.scrollLeft + 1, currentTarget.scrollTop + 1); } var currentT = currentTarget.scrollTop; var currentL = currentTarget.scrollLeft; if (currentTarget.scrollTo) { currentTarget.scrollTo(currentTarget.scrollLeft - 1, currentTarget.scrollTop - 1); } if (isY && (!scrollY || !(currentT - t2) || scrollY && (currentTarget.scrollTop >= scrollY && differY < 0 || currentTarget.scrollTop <= 0 && differY > 0)) || isX && (!scrollX || !(currentL - l2) || scrollX && (currentTarget.scrollLeft >= scrollX && differX < 0 || currentTarget.scrollLeft <= 0 && differX > 0))) { return this.getTouchParentScroll(root2, currentTarget.parentNode, differX, differY); } return false; }, removeStartHandler: function removeStartHandler(e2) { if (e2.touches.length > 1) { return; } this.startPos = { x: e2.touches[0].clientX, y: e2.touches[0].clientY }; }, removeMoveHandler: function removeMoveHandler(e2) { if (e2.changedTouches.length > 1) { return; } var currentTarget = e2.currentTarget; var differX = e2.changedTouches[0].clientX - this.startPos.x; var differY = e2.changedTouches[0].clientY - this.startPos.y; if (currentTarget === this.maskDom || currentTarget === this.handlerdom || currentTarget === this.contentDom && this.getTouchParentScroll(currentTarget, e2.target, differX, differY)) { e2.preventDefault(); } }, trnasitionEnd: function trnasitionEnd(e2) { removeEventListener$1(e2.target, transitionEnd, this.trnasitionEnd); e2.target.style.transition = ""; }, defaultGetContainer: function defaultGetContainer2() { if (windowIsUndefined$1) { return null; } var container = document.createElement("div"); this.parent.appendChild(container); if (this.wrapperClassName) { container.className = this.wrapperClassName; } return container; } }, render: function render59() { var _this7 = this; var _this$$props3 = this.$props, getContainer5 = _this$$props3.getContainer, wrapperClassName = _this$$props3.wrapperClassName, handler7 = _this$$props3.handler, forceRender = _this$$props3.forceRender; var open6 = this.getOpen(); var portal = null; currentDrawer[this.drawerId] = open6 ? this.container : open6; var children = this.getChildToRender(this.sFirstEnter ? open6 : false); if (!getContainer5) { return createVNode("div", { "class": wrapperClassName, "ref": function ref2(c2) { _this7.container = c2; } }, [children]); } if (!this.container || !open6 && !this.sFirstEnter) { return null; } var $forceRender = !!handler7 || forceRender; if ($forceRender || open6 || this.dom) { portal = createVNode(Teleport, { "to": this.getSelfContainer() }, { default: function _default8() { return [children]; } }); } return portal; } }); var Drawer$3 = Drawer$2; var __rest$l = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var PlacementTypes = tuple("top", "right", "bottom", "left"); var Drawer = defineComponent({ name: "ADrawer", mixins: [BaseMixin], inheritAttrs: false, props: { closable: PropsTypes.looseBool.def(true), destroyOnClose: PropsTypes.looseBool, getContainer: PropsTypes.any, maskClosable: PropsTypes.looseBool.def(true), mask: PropsTypes.looseBool.def(true), maskStyle: PropsTypes.object, wrapStyle: PropsTypes.object, bodyStyle: PropsTypes.object, headerStyle: PropsTypes.object, drawerStyle: PropsTypes.object, title: PropsTypes.VNodeChild, visible: PropsTypes.looseBool, width: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]).def(256), height: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]).def(256), zIndex: PropsTypes.number, prefixCls: PropsTypes.string, placement: PropsTypes.oneOf(PlacementTypes).def("right"), level: PropsTypes.any.def(null), wrapClassName: PropsTypes.string, handle: PropsTypes.VNodeChild, afterVisibleChange: PropsTypes.func, keyboard: PropsTypes.looseBool.def(true), onClose: PropsTypes.func, "onUpdate:visible": PropsTypes.func }, setup: function setup67(props2) { var configProvider = inject("configProvider", defaultConfigProvider); return { configProvider, destroyClose: false, preVisible: props2.visible, parentDrawer: inject("parentDrawer", null) }; }, data: function data36() { return { sPush: false }; }, beforeCreate: function beforeCreate() { provide("parentDrawer", this); }, mounted: function mounted19() { var visible9 = this.visible; if (visible9 && this.parentDrawer) { this.parentDrawer.push(); } }, updated: function updated9() { var _this = this; nextTick(function() { if (_this.preVisible !== _this.visible && _this.parentDrawer) { if (_this.visible) { _this.parentDrawer.push(); } else { _this.parentDrawer.pull(); } } _this.preVisible = _this.visible; }); }, beforeUnmount: function beforeUnmount10() { if (this.parentDrawer) { this.parentDrawer.pull(); } }, methods: { domFocus: function domFocus2() { if (this.$refs.vcDrawer) { this.$refs.vcDrawer.domFocus(); } }, close: function close3(e2) { this.$emit("update:visible", false); this.$emit("close", e2); }, push: function push2() { this.setState({ sPush: true }); }, pull: function pull() { var _this2 = this; this.setState({ sPush: false }, function() { _this2.domFocus(); }); }, onDestroyTransitionEnd: function onDestroyTransitionEnd() { var isDestroyOnClose = this.getDestroyOnClose(); if (!isDestroyOnClose) { return; } if (!this.visible) { this.destroyClose = true; this.$forceUpdate(); } }, getDestroyOnClose: function getDestroyOnClose() { return this.destroyOnClose && !this.visible; }, getPushTransform: function getPushTransform(placement2) { if (placement2 === "left" || placement2 === "right") { return "translateX(".concat(placement2 === "left" ? 180 : -180, "px)"); } if (placement2 === "top" || placement2 === "bottom") { return "translateY(".concat(placement2 === "top" ? 180 : -180, "px)"); } }, getRcDrawerStyle: function getRcDrawerStyle() { var _this$$props = this.$props, zIndex = _this$$props.zIndex, placement2 = _this$$props.placement, wrapStyle = _this$$props.wrapStyle; var push3 = this.$data.sPush; return _extends$1({ zIndex, transform: push3 ? this.getPushTransform(placement2) : void 0 }, wrapStyle); }, renderHeader: function renderHeader(prefixCls2) { var _this$$props2 = this.$props, closable = _this$$props2.closable, headerStyle = _this$$props2.headerStyle; var title = getComponent(this, "title"); if (!title && !closable) { return null; } var headerClassName = title ? "".concat(prefixCls2, "-header") : "".concat(prefixCls2, "-header-no-title"); return createVNode("div", { "class": headerClassName, "style": headerStyle }, [title && createVNode("div", { "class": "".concat(prefixCls2, "-title") }, [title]), closable ? this.renderCloseIcon(prefixCls2) : null]); }, renderCloseIcon: function renderCloseIcon(prefixCls2) { var closable = this.closable; return closable && createVNode("button", { "key": "closer", "onClick": this.close, "aria-label": "Close", "class": "".concat(prefixCls2, "-close") }, [createVNode(CloseOutlined$3, null, null)]); }, renderBody: function renderBody(prefixCls2) { var _a3, _b2; if (this.destroyClose && !this.visible) { return null; } this.destroyClose = false; var _this$$props3 = this.$props, bodyStyle = _this$$props3.bodyStyle, drawerStyle = _this$$props3.drawerStyle; var containerStyle = {}; var isDestroyOnClose = this.getDestroyOnClose(); if (isDestroyOnClose) { containerStyle.opacity = 0; containerStyle.transition = "opacity .3s"; } return createVNode("div", { "class": "".concat(prefixCls2, "-wrapper-body"), "style": _extends$1(_extends$1({}, containerStyle), drawerStyle), "onTransitionend": this.onDestroyTransitionEnd }, [this.renderHeader(prefixCls2), createVNode("div", { "key": "body", "class": "".concat(prefixCls2, "-body"), "style": bodyStyle }, [(_b2 = (_a3 = this.$slots).default) === null || _b2 === void 0 ? void 0 : _b2.call(_a3)])]); } }, render: function render60() { var _classnames, _this3 = this; var props2 = getOptionProps(this); var customizePrefixCls = props2.prefixCls, width = props2.width, height = props2.height, visible9 = props2.visible, placement2 = props2.placement, wrapClassName = props2.wrapClassName, mask = props2.mask, rest = __rest$l(props2, ["prefixCls", "width", "height", "visible", "placement", "wrapClassName", "mask"]); var haveMask = mask ? "" : "no-mask"; var offsetStyle = {}; if (placement2 === "left" || placement2 === "right") { offsetStyle.width = typeof width === "number" ? "".concat(width, "px") : width; } else { offsetStyle.height = typeof height === "number" ? "".concat(height, "px") : height; } var handler7 = getComponent(this, "handle") || false; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("drawer", customizePrefixCls); var className = this.$attrs.class; var vcDrawerProps = _extends$1(_extends$1(_extends$1(_extends$1(_extends$1({}, this.$attrs), omit(rest, ["closable", "destroyOnClose", "drawerStyle", "headerStyle", "bodyStyle", "title", "push", "visible", "getPopupContainer", "rootPrefixCls", "getPrefixCls", "renderEmpty", "csp", "pageHeader", "autoInsertSpaceInButton"])), { onClose: this.close, handler: handler7 }), offsetStyle), { prefixCls: prefixCls2, open: visible9, showMask: mask, placement: placement2, class: classNames((_classnames = {}, _defineProperty$12(_classnames, className, !!className), _defineProperty$12(_classnames, wrapClassName, !!wrapClassName), _defineProperty$12(_classnames, haveMask, !!haveMask), _classnames)), wrapStyle: this.getRcDrawerStyle(), ref: "vcDrawer" }); return createVNode(Drawer$3, vcDrawerProps, { default: function _default8() { return [_this3.renderBody(prefixCls2)]; } }); } }); var Drawer$1 = withInstall(Drawer); var runtime = { exports: {} }; (function(module2) { var runtime2 = function(exports2) { var Op = Object.prototype; var hasOwn3 = Op.hasOwnProperty; var undefined$12; var $Symbol = typeof Symbol === "function" ? Symbol : {}; var iteratorSymbol = $Symbol.iterator || "@@iterator"; var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define2(obj, key2, value24) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); return obj[key2]; } try { define2({}, ""); } catch (err) { define2 = function(obj, key2, value24) { return obj[key2] = value24; }; } function wrap(innerFn, outerFn, self2, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; var generator = Object.create(protoGenerator.prototype); var context2 = new Context(tryLocsList || []); generator._invoke = makeInvokeMethod(innerFn, self2, context2); return generator; } exports2.wrap = wrap; function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } var GenStateSuspendedStart = "suspendedStart"; var GenStateSuspendedYield = "suspendedYield"; var GenStateExecuting = "executing"; var GenStateCompleted = "completed"; var ContinueSentinel = {}; function Generator() { } function GeneratorFunction() { } function GeneratorFunctionPrototype() { } var IteratorPrototype = {}; define2(IteratorPrototype, iteratorSymbol, function() { return this; }); var getProto2 = Object.getPrototypeOf; var NativeIteratorPrototype = getProto2 && getProto2(getProto2(values2([]))); if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn3.call(NativeIteratorPrototype, iteratorSymbol)) { IteratorPrototype = NativeIteratorPrototype; } var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); GeneratorFunction.prototype = GeneratorFunctionPrototype; define2(Gp, "constructor", GeneratorFunctionPrototype); define2(GeneratorFunctionPrototype, "constructor", GeneratorFunction); GeneratorFunction.displayName = define2(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function(method3) { define2(prototype, method3, function(arg) { return this._invoke(method3, arg); }); }); } exports2.isGeneratorFunction = function(genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; exports2.mark = function(genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { genFun.__proto__ = GeneratorFunctionPrototype; define2(genFun, toStringTagSymbol, "GeneratorFunction"); } genFun.prototype = Object.create(Gp); return genFun; }; exports2.awrap = function(arg) { return { __await: arg }; }; function AsyncIterator(generator, PromiseImpl) { function invoke(method3, arg, resolve, reject) { var record = tryCatch(generator[method3], generator, arg); if (record.type === "throw") { reject(record.arg); } else { var result = record.arg; var value24 = result.value; if (value24 && typeof value24 === "object" && hasOwn3.call(value24, "__await")) { return PromiseImpl.resolve(value24.__await).then(function(value25) { invoke("next", value25, resolve, reject); }, function(err) { invoke("throw", err, resolve, reject); }); } return PromiseImpl.resolve(value24).then(function(unwrapped) { result.value = unwrapped; resolve(result); }, function(error3) { return invoke("throw", error3, resolve, reject); }); } } var previousPromise; function enqueue(method3, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function(resolve, reject) { invoke(method3, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } this._invoke = enqueue; } defineIteratorMethods(AsyncIterator.prototype); define2(AsyncIterator.prototype, asyncIteratorSymbol, function() { return this; }); exports2.AsyncIterator = AsyncIterator; exports2.async = function(innerFn, outerFn, self2, tryLocsList, PromiseImpl) { if (PromiseImpl === void 0) PromiseImpl = Promise; var iter = new AsyncIterator(wrap(innerFn, outerFn, self2, tryLocsList), PromiseImpl); return exports2.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) { return result.done ? result.value : iter.next(); }); }; function makeInvokeMethod(innerFn, self2, context2) { var state = GenStateSuspendedStart; return function invoke(method3, arg) { if (state === GenStateExecuting) { throw new Error("Generator is already running"); } if (state === GenStateCompleted) { if (method3 === "throw") { throw arg; } return doneResult(); } context2.method = method3; context2.arg = arg; while (true) { var delegate = context2.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context2); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (context2.method === "next") { context2.sent = context2._sent = context2.arg; } else if (context2.method === "throw") { if (state === GenStateSuspendedStart) { state = GenStateCompleted; throw context2.arg; } context2.dispatchException(context2.arg); } else if (context2.method === "return") { context2.abrupt("return", context2.arg); } state = GenStateExecuting; var record = tryCatch(innerFn, self2, context2); if (record.type === "normal") { state = context2.done ? GenStateCompleted : GenStateSuspendedYield; if (record.arg === ContinueSentinel) { continue; } return { value: record.arg, done: context2.done }; } else if (record.type === "throw") { state = GenStateCompleted; context2.method = "throw"; context2.arg = record.arg; } } }; } function maybeInvokeDelegate(delegate, context2) { var method3 = delegate.iterator[context2.method]; if (method3 === undefined$12) { context2.delegate = null; if (context2.method === "throw") { if (delegate.iterator["return"]) { context2.method = "return"; context2.arg = undefined$12; maybeInvokeDelegate(delegate, context2); if (context2.method === "throw") { return ContinueSentinel; } } context2.method = "throw"; context2.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method3, delegate.iterator, context2.arg); if (record.type === "throw") { context2.method = "throw"; context2.arg = record.arg; context2.delegate = null; return ContinueSentinel; } var info3 = record.arg; if (!info3) { context2.method = "throw"; context2.arg = new TypeError("iterator result is not an object"); context2.delegate = null; return ContinueSentinel; } if (info3.done) { context2[delegate.resultName] = info3.value; context2.next = delegate.nextLoc; if (context2.method !== "return") { context2.method = "next"; context2.arg = undefined$12; } } else { return info3; } context2.delegate = null; return ContinueSentinel; } defineIteratorMethods(Gp); define2(Gp, toStringTagSymbol, "Generator"); define2(Gp, iteratorSymbol, function() { return this; }); define2(Gp, "toString", function() { return "[object Generator]"; }); function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; if (1 in locs) { entry.catchLoc = locs[1]; } if (2 in locs) { entry.finallyLoc = locs[2]; entry.afterLoc = locs[3]; } this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal"; delete record.arg; entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }]; tryLocsList.forEach(pushTryEntry, this); this.reset(true); } exports2.keys = function(object3) { var keys2 = []; for (var key2 in object3) { keys2.push(key2); } keys2.reverse(); return function next2() { while (keys2.length) { var key3 = keys2.pop(); if (key3 in object3) { next2.value = key3; next2.done = false; return next2; } } next2.done = true; return next2; }; }; function values2(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) { return iteratorMethod.call(iterable); } if (typeof iterable.next === "function") { return iterable; } if (!isNaN(iterable.length)) { var i2 = -1, next2 = function next3() { while (++i2 < iterable.length) { if (hasOwn3.call(iterable, i2)) { next3.value = iterable[i2]; next3.done = false; return next3; } } next3.value = undefined$12; next3.done = true; return next3; }; return next2.next = next2; } } return { next: doneResult }; } exports2.values = values2; function doneResult() { return { value: undefined$12, done: true }; } Context.prototype = { constructor: Context, reset: function(skipTempReset) { this.prev = 0; this.next = 0; this.sent = this._sent = undefined$12; this.done = false; this.delegate = null; this.method = "next"; this.arg = undefined$12; this.tryEntries.forEach(resetTryEntry); if (!skipTempReset) { for (var name in this) { if (name.charAt(0) === "t" && hasOwn3.call(this, name) && !isNaN(+name.slice(1))) { this[name] = undefined$12; } } } }, stop: function() { this.done = true; var rootEntry = this.tryEntries[0]; var rootRecord = rootEntry.completion; if (rootRecord.type === "throw") { throw rootRecord.arg; } return this.rval; }, dispatchException: function(exception) { if (this.done) { throw exception; } var context2 = this; function handle(loc, caught) { record.type = "throw"; record.arg = exception; context2.next = loc; if (caught) { context2.method = "next"; context2.arg = undefined$12; } return !!caught; } for (var i2 = this.tryEntries.length - 1; i2 >= 0; --i2) { var entry = this.tryEntries[i2]; var record = entry.completion; if (entry.tryLoc === "root") { return handle("end"); } if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn3.call(entry, "catchLoc"); var hasFinally = hasOwn3.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } else if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else if (hasCatch) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } } else if (hasFinally) { if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else { throw new Error("try statement without catch or finally"); } } } }, abrupt: function(type2, arg) { for (var i2 = this.tryEntries.length - 1; i2 >= 0; --i2) { var entry = this.tryEntries[i2]; if (entry.tryLoc <= this.prev && hasOwn3.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } if (finallyEntry && (type2 === "break" || type2 === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { finallyEntry = null; } var record = finallyEntry ? finallyEntry.completion : {}; record.type = type2; record.arg = arg; if (finallyEntry) { this.method = "next"; this.next = finallyEntry.finallyLoc; return ContinueSentinel; } return this.complete(record); }, complete: function(record, afterLoc) { if (record.type === "throw") { throw record.arg; } if (record.type === "break" || record.type === "continue") { this.next = record.arg; } else if (record.type === "return") { this.rval = this.arg = record.arg; this.method = "return"; this.next = "end"; } else if (record.type === "normal" && afterLoc) { this.next = afterLoc; } return ContinueSentinel; }, finish: function(finallyLoc) { for (var i2 = this.tryEntries.length - 1; i2 >= 0; --i2) { var entry = this.tryEntries[i2]; if (entry.finallyLoc === finallyLoc) { this.complete(entry.completion, entry.afterLoc); resetTryEntry(entry); return ContinueSentinel; } } }, "catch": function(tryLoc) { for (var i2 = this.tryEntries.length - 1; i2 >= 0; --i2) { var entry = this.tryEntries[i2]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (record.type === "throw") { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function(iterable, resultName, nextLoc) { this.delegate = { iterator: values2(iterable), resultName, nextLoc }; if (this.method === "next") { this.arg = undefined$12; } return ContinueSentinel; } }; return exports2; }(module2.exports); try { regeneratorRuntime = runtime2; } catch (accidentalStrictMode) { if (typeof globalThis === "object") { globalThis.regeneratorRuntime = runtime2; } else { Function("r", "regeneratorRuntime = r")(runtime2); } } })(runtime); var regenerator = runtime.exports; function _extends() { _extends = Object.assign || function(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2]; for (var key2 in source2) { if (Object.prototype.hasOwnProperty.call(source2, key2)) { target[key2] = source2[key2]; } } } return target; }; return _extends.apply(this, arguments); } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } function _getPrototypeOf(o2) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o3) { return o3.__proto__ || Object.getPrototypeOf(o3); }; return _getPrototypeOf(o2); } function _setPrototypeOf(o2, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o3, p2) { o3.__proto__ = p2; return o3; }; return _setPrototypeOf(o2, p); } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { })); return true; } catch (e2) { return false; } } function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct2(Parent2, args2, Class2) { var a2 = [null]; a2.push.apply(a2, args2); var Constructor = Function.bind.apply(Parent2, a2); var instance = new Constructor(); if (Class2) _setPrototypeOf(instance, Class2.prototype); return instance; }; } return _construct.apply(null, arguments); } function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0; _wrapNativeSuper = function _wrapNativeSuper2(Class2) { if (Class2 === null || !_isNativeFunction(Class2)) return Class2; if (typeof Class2 !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class2)) return _cache.get(Class2); _cache.set(Class2, Wrapper); } function Wrapper() { return _construct(Class2, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class2.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class2); }; return _wrapNativeSuper(Class); } var formatRegExp = /%[sdj%]/g; var warning$2 = function warning2() { }; if (typeof process !== "undefined" && process.env && false) { warning$2 = function warning4(type2, errors) { if (typeof console !== "undefined" && console.warn) { if (errors.every(function(e2) { return typeof e2 === "string"; })) { console.warn(type2, errors); } } }; } function convertFieldsError(errors) { if (!errors || !errors.length) return null; var fields2 = {}; errors.forEach(function(error3) { var field = error3.field; fields2[field] = fields2[field] || []; fields2[field].push(error3); }); return fields2; } function format() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var i2 = 1; var f2 = args[0]; var len = args.length; if (typeof f2 === "function") { return f2.apply(null, args.slice(1)); } if (typeof f2 === "string") { var str = String(f2).replace(formatRegExp, function(x2) { if (x2 === "%%") { return "%"; } if (i2 >= len) { return x2; } switch (x2) { case "%s": return String(args[i2++]); case "%d": return Number(args[i2++]); case "%j": try { return JSON.stringify(args[i2++]); } catch (_2) { return "[Circular]"; } break; default: return x2; } }); return str; } return f2; } function isNativeStringType(type2) { return type2 === "string" || type2 === "url" || type2 === "hex" || type2 === "email" || type2 === "date" || type2 === "pattern"; } function isEmptyValue(value24, type2) { if (value24 === void 0 || value24 === null) { return true; } if (type2 === "array" && Array.isArray(value24) && !value24.length) { return true; } if (isNativeStringType(type2) && typeof value24 === "string" && !value24) { return true; } return false; } function asyncParallelArray(arr, func, callback2) { var results = []; var total2 = 0; var arrLength = arr.length; function count2(errors) { results.push.apply(results, errors); total2++; if (total2 === arrLength) { callback2(results); } } arr.forEach(function(a2) { func(a2, count2); }); } function asyncSerialArray(arr, func, callback2) { var index2 = 0; var arrLength = arr.length; function next2(errors) { if (errors && errors.length) { callback2(errors); return; } var original = index2; index2 = index2 + 1; if (original < arrLength) { func(arr[original], next2); } else { callback2([]); } } next2([]); } function flattenObjArr(objArr) { var ret = []; Object.keys(objArr).forEach(function(k2) { ret.push.apply(ret, objArr[k2]); }); return ret; } var AsyncValidationError = /* @__PURE__ */ function(_Error) { _inheritsLoose(AsyncValidationError2, _Error); function AsyncValidationError2(errors, fields2) { var _this; _this = _Error.call(this, "Async Validation Error") || this; _this.errors = errors; _this.fields = fields2; return _this; } return AsyncValidationError2; }(/* @__PURE__ */ _wrapNativeSuper(Error)); function asyncMap(objArr, option, func, callback2) { if (option.first) { var _pending = new Promise(function(resolve, reject) { var next2 = function next3(errors) { callback2(errors); return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(); }; var flattenArr = flattenObjArr(objArr); asyncSerialArray(flattenArr, func, next2); }); _pending["catch"](function(e2) { return e2; }); return _pending; } var firstFields = option.firstFields || []; if (firstFields === true) { firstFields = Object.keys(objArr); } var objArrKeys = Object.keys(objArr); var objArrLength = objArrKeys.length; var total2 = 0; var results = []; var pending = new Promise(function(resolve, reject) { var next2 = function next3(errors) { results.push.apply(results, errors); total2++; if (total2 === objArrLength) { callback2(results); return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(); } }; if (!objArrKeys.length) { callback2(results); resolve(); } objArrKeys.forEach(function(key2) { var arr = objArr[key2]; if (firstFields.indexOf(key2) !== -1) { asyncSerialArray(arr, func, next2); } else { asyncParallelArray(arr, func, next2); } }); }); pending["catch"](function(e2) { return e2; }); return pending; } function complementError(rule) { return function(oe) { if (oe && oe.message) { oe.field = oe.field || rule.fullField; return oe; } return { message: typeof oe === "function" ? oe() : oe, field: oe.field || rule.fullField }; }; } function deepMerge(target, source2) { if (source2) { for (var s2 in source2) { if (source2.hasOwnProperty(s2)) { var value24 = source2[s2]; if (typeof value24 === "object" && typeof target[s2] === "object") { target[s2] = _extends({}, target[s2], value24); } else { target[s2] = value24; } } } } return target; } function required(rule, value24, source2, errors, options2, type2) { if (rule.required && (!source2.hasOwnProperty(rule.field) || isEmptyValue(value24, type2 || rule.type))) { errors.push(format(options2.messages.required, rule.fullField)); } } function whitespace(rule, value24, source2, errors, options2) { if (/^\s+$/.test(value24) || value24 === "") { errors.push(format(options2.messages.whitespace, rule.fullField)); } } var pattern = { email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, url: new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", "i"), hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i }; var types = { integer: function integer2(value24) { return types.number(value24) && parseInt(value24, 10) === value24; }, "float": function float(value24) { return types.number(value24) && !types.integer(value24); }, array: function array2(value24) { return Array.isArray(value24); }, regexp: function regexp2(value24) { if (value24 instanceof RegExp) { return true; } try { return !!new RegExp(value24); } catch (e2) { return false; } }, date: function date2(value24) { return typeof value24.getTime === "function" && typeof value24.getMonth === "function" && typeof value24.getYear === "function" && !isNaN(value24.getTime()); }, number: function number2(value24) { if (isNaN(value24)) { return false; } return typeof value24 === "number"; }, object: function object2(value24) { return typeof value24 === "object" && !types.array(value24); }, method: function method2(value24) { return typeof value24 === "function"; }, email: function email(value24) { return typeof value24 === "string" && !!value24.match(pattern.email) && value24.length < 255; }, url: function url(value24) { return typeof value24 === "string" && !!value24.match(pattern.url); }, hex: function hex(value24) { return typeof value24 === "string" && !!value24.match(pattern.hex); } }; function type(rule, value24, source2, errors, options2) { if (rule.required && value24 === void 0) { required(rule, value24, source2, errors, options2); return; } var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"]; var ruleType = rule.type; if (custom.indexOf(ruleType) > -1) { if (!types[ruleType](value24)) { errors.push(format(options2.messages.types[ruleType], rule.fullField, rule.type)); } } else if (ruleType && typeof value24 !== rule.type) { errors.push(format(options2.messages.types[ruleType], rule.fullField, rule.type)); } } function range(rule, value24, source2, errors, options2) { var len = typeof rule.len === "number"; var min4 = typeof rule.min === "number"; var max4 = typeof rule.max === "number"; var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; var val = value24; var key2 = null; var num = typeof value24 === "number"; var str = typeof value24 === "string"; var arr = Array.isArray(value24); if (num) { key2 = "number"; } else if (str) { key2 = "string"; } else if (arr) { key2 = "array"; } if (!key2) { return false; } if (arr) { val = value24.length; } if (str) { val = value24.replace(spRegexp, "_").length; } if (len) { if (val !== rule.len) { errors.push(format(options2.messages[key2].len, rule.fullField, rule.len)); } } else if (min4 && !max4 && val < rule.min) { errors.push(format(options2.messages[key2].min, rule.fullField, rule.min)); } else if (max4 && !min4 && val > rule.max) { errors.push(format(options2.messages[key2].max, rule.fullField, rule.max)); } else if (min4 && max4 && (val < rule.min || val > rule.max)) { errors.push(format(options2.messages[key2].range, rule.fullField, rule.min, rule.max)); } } var ENUM = "enum"; function enumerable(rule, value24, source2, errors, options2) { rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : []; if (rule[ENUM].indexOf(value24) === -1) { errors.push(format(options2.messages[ENUM], rule.fullField, rule[ENUM].join(", "))); } } function pattern$1(rule, value24, source2, errors, options2) { if (rule.pattern) { if (rule.pattern instanceof RegExp) { rule.pattern.lastIndex = 0; if (!rule.pattern.test(value24)) { errors.push(format(options2.messages.pattern.mismatch, rule.fullField, value24, rule.pattern)); } } else if (typeof rule.pattern === "string") { var _pattern = new RegExp(rule.pattern); if (!_pattern.test(value24)) { errors.push(format(options2.messages.pattern.mismatch, rule.fullField, value24, rule.pattern)); } } } } var rules = { required, whitespace, type, range, "enum": enumerable, pattern: pattern$1 }; function string(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (isEmptyValue(value24, "string") && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2, "string"); if (!isEmptyValue(value24, "string")) { rules.type(rule, value24, source2, errors, options2); rules.range(rule, value24, source2, errors, options2); rules.pattern(rule, value24, source2, errors, options2); if (rule.whitespace === true) { rules.whitespace(rule, value24, source2, errors, options2); } } } callback2(errors); } function method(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (isEmptyValue(value24) && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2); if (value24 !== void 0) { rules.type(rule, value24, source2, errors, options2); } } callback2(errors); } function number(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (value24 === "") { value24 = void 0; } if (isEmptyValue(value24) && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2); if (value24 !== void 0) { rules.type(rule, value24, source2, errors, options2); rules.range(rule, value24, source2, errors, options2); } } callback2(errors); } function _boolean(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (isEmptyValue(value24) && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2); if (value24 !== void 0) { rules.type(rule, value24, source2, errors, options2); } } callback2(errors); } function regexp(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (isEmptyValue(value24) && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2); if (!isEmptyValue(value24)) { rules.type(rule, value24, source2, errors, options2); } } callback2(errors); } function integer(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (isEmptyValue(value24) && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2); if (value24 !== void 0) { rules.type(rule, value24, source2, errors, options2); rules.range(rule, value24, source2, errors, options2); } } callback2(errors); } function floatFn(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (isEmptyValue(value24) && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2); if (value24 !== void 0) { rules.type(rule, value24, source2, errors, options2); rules.range(rule, value24, source2, errors, options2); } } callback2(errors); } function array(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if ((value24 === void 0 || value24 === null) && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2, "array"); if (value24 !== void 0 && value24 !== null) { rules.type(rule, value24, source2, errors, options2); rules.range(rule, value24, source2, errors, options2); } } callback2(errors); } function object(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (isEmptyValue(value24) && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2); if (value24 !== void 0) { rules.type(rule, value24, source2, errors, options2); } } callback2(errors); } var ENUM$1 = "enum"; function enumerable$1(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (isEmptyValue(value24) && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2); if (value24 !== void 0) { rules[ENUM$1](rule, value24, source2, errors, options2); } } callback2(errors); } function pattern$2(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (isEmptyValue(value24, "string") && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2); if (!isEmptyValue(value24, "string")) { rules.pattern(rule, value24, source2, errors, options2); } } callback2(errors); } function date(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (isEmptyValue(value24, "date") && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2); if (!isEmptyValue(value24, "date")) { var dateObject; if (value24 instanceof Date) { dateObject = value24; } else { dateObject = new Date(value24); } rules.type(rule, dateObject, source2, errors, options2); if (dateObject) { rules.range(rule, dateObject.getTime(), source2, errors, options2); } } } callback2(errors); } function required$1(rule, value24, callback2, source2, options2) { var errors = []; var type2 = Array.isArray(value24) ? "array" : typeof value24; rules.required(rule, value24, source2, errors, options2, type2); callback2(errors); } function type$1(rule, value24, callback2, source2, options2) { var ruleType = rule.type; var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (isEmptyValue(value24, ruleType) && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2, ruleType); if (!isEmptyValue(value24, ruleType)) { rules.type(rule, value24, source2, errors, options2); } } callback2(errors); } function any(rule, value24, callback2, source2, options2) { var errors = []; var validate3 = rule.required || !rule.required && source2.hasOwnProperty(rule.field); if (validate3) { if (isEmptyValue(value24) && !rule.required) { return callback2(); } rules.required(rule, value24, source2, errors, options2); } callback2(errors); } var validators$2 = { string, method, number, "boolean": _boolean, regexp, integer, "float": floatFn, array, object, "enum": enumerable$1, pattern: pattern$2, date, url: type$1, hex: type$1, email: type$1, required: required$1, any }; function newMessages() { return { "default": "Validation error on field %s", required: "%s is required", "enum": "%s must be one of %s", whitespace: "%s cannot be empty", date: { format: "%s date %s is invalid for format %s", parse: "%s date could not be parsed, %s is invalid ", invalid: "%s date %s is invalid" }, types: { string: "%s is not a %s", method: "%s is not a %s (function)", array: "%s is not an %s", object: "%s is not an %s", number: "%s is not a %s", date: "%s is not a %s", "boolean": "%s is not a %s", integer: "%s is not an %s", "float": "%s is not a %s", regexp: "%s is not a valid %s", email: "%s is not a valid %s", url: "%s is not a valid %s", hex: "%s is not a valid %s" }, string: { len: "%s must be exactly %s characters", min: "%s must be at least %s characters", max: "%s cannot be longer than %s characters", range: "%s must be between %s and %s characters" }, number: { len: "%s must equal %s", min: "%s cannot be less than %s", max: "%s cannot be greater than %s", range: "%s must be between %s and %s" }, array: { len: "%s must be exactly %s in length", min: "%s cannot be less than %s in length", max: "%s cannot be greater than %s in length", range: "%s must be between %s and %s in length" }, pattern: { mismatch: "%s value %s does not match pattern %s" }, clone: function clone4() { var cloned = JSON.parse(JSON.stringify(this)); cloned.clone = this.clone; return cloned; } }; } var messages = newMessages(); function Schema(descriptor) { this.rules = null; this._messages = messages; this.define(descriptor); } Schema.prototype = { messages: function messages2(_messages) { if (_messages) { this._messages = deepMerge(newMessages(), _messages); } return this._messages; }, define: function define(rules2) { if (!rules2) { throw new Error("Cannot configure a schema with no rules"); } if (typeof rules2 !== "object" || Array.isArray(rules2)) { throw new Error("Rules must be an object"); } this.rules = {}; var z2; var item; for (z2 in rules2) { if (rules2.hasOwnProperty(z2)) { item = rules2[z2]; this.rules[z2] = Array.isArray(item) ? item : [item]; } } }, validate: function validate2(source_, o2, oc) { var _this = this; if (o2 === void 0) { o2 = {}; } if (oc === void 0) { oc = function oc2() { }; } var source2 = source_; var options2 = o2; var callback2 = oc; if (typeof options2 === "function") { callback2 = options2; options2 = {}; } if (!this.rules || Object.keys(this.rules).length === 0) { if (callback2) { callback2(); } return Promise.resolve(); } function complete(results) { var i2; var errors = []; var fields2 = {}; function add3(e2) { if (Array.isArray(e2)) { var _errors; errors = (_errors = errors).concat.apply(_errors, e2); } else { errors.push(e2); } } for (i2 = 0; i2 < results.length; i2++) { add3(results[i2]); } if (!errors.length) { errors = null; fields2 = null; } else { fields2 = convertFieldsError(errors); } callback2(errors, fields2); } if (options2.messages) { var messages$1 = this.messages(); if (messages$1 === messages) { messages$1 = newMessages(); } deepMerge(messages$1, options2.messages); options2.messages = messages$1; } else { options2.messages = this.messages(); } var arr; var value24; var series = {}; var keys2 = options2.keys || Object.keys(this.rules); keys2.forEach(function(z2) { arr = _this.rules[z2]; value24 = source2[z2]; arr.forEach(function(r2) { var rule = r2; if (typeof rule.transform === "function") { if (source2 === source_) { source2 = _extends({}, source2); } value24 = source2[z2] = rule.transform(value24); } if (typeof rule === "function") { rule = { validator: rule }; } else { rule = _extends({}, rule); } rule.validator = _this.getValidationMethod(rule); rule.field = z2; rule.fullField = rule.fullField || z2; rule.type = _this.getType(rule); if (!rule.validator) { return; } series[z2] = series[z2] || []; series[z2].push({ rule, value: value24, source: source2, field: z2 }); }); }); var errorFields = {}; return asyncMap(series, options2, function(data65, doIt) { var rule = data65.rule; var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object"); deep = deep && (rule.required || !rule.required && data65.value); rule.field = data65.field; function addFullfield(key2, schema2) { return _extends({}, schema2, { fullField: rule.fullField + "." + key2 }); } function cb(e2) { if (e2 === void 0) { e2 = []; } var errors = e2; if (!Array.isArray(errors)) { errors = [errors]; } if (!options2.suppressWarning && errors.length) { Schema.warning("async-validator:", errors); } if (errors.length && rule.message !== void 0) { errors = [].concat(rule.message); } errors = errors.map(complementError(rule)); if (options2.first && errors.length) { errorFields[rule.field] = 1; return doIt(errors); } if (!deep) { doIt(errors); } else { if (rule.required && !data65.value) { if (rule.message !== void 0) { errors = [].concat(rule.message).map(complementError(rule)); } else if (options2.error) { errors = [options2.error(rule, format(options2.messages.required, rule.field))]; } return doIt(errors); } var fieldsSchema = {}; if (rule.defaultField) { for (var k2 in data65.value) { if (data65.value.hasOwnProperty(k2)) { fieldsSchema[k2] = rule.defaultField; } } } fieldsSchema = _extends({}, fieldsSchema, data65.rule.fields); for (var f2 in fieldsSchema) { if (fieldsSchema.hasOwnProperty(f2)) { var fieldSchema = Array.isArray(fieldsSchema[f2]) ? fieldsSchema[f2] : [fieldsSchema[f2]]; fieldsSchema[f2] = fieldSchema.map(addFullfield.bind(null, f2)); } } var schema2 = new Schema(fieldsSchema); schema2.messages(options2.messages); if (data65.rule.options) { data65.rule.options.messages = options2.messages; data65.rule.options.error = options2.error; } schema2.validate(data65.value, data65.rule.options || options2, function(errs) { var finalErrors = []; if (errors && errors.length) { finalErrors.push.apply(finalErrors, errors); } if (errs && errs.length) { finalErrors.push.apply(finalErrors, errs); } doIt(finalErrors.length ? finalErrors : null); }); } } var res; if (rule.asyncValidator) { res = rule.asyncValidator(rule, data65.value, cb, data65.source, options2); } else if (rule.validator) { res = rule.validator(rule, data65.value, cb, data65.source, options2); if (res === true) { cb(); } else if (res === false) { cb(rule.message || rule.field + " fails"); } else if (res instanceof Array) { cb(res); } else if (res instanceof Error) { cb(res.message); } } if (res && res.then) { res.then(function() { return cb(); }, function(e2) { return cb(e2); }); } }, function(results) { complete(results); }); }, getType: function getType(rule) { if (rule.type === void 0 && rule.pattern instanceof RegExp) { rule.type = "pattern"; } if (typeof rule.validator !== "function" && rule.type && !validators$2.hasOwnProperty(rule.type)) { throw new Error(format("Unknown rule type %s", rule.type)); } return rule.type || "string"; }, getValidationMethod: function getValidationMethod(rule) { if (typeof rule.validator === "function") { return rule.validator; } var keys2 = Object.keys(rule); var messageIndex = keys2.indexOf("message"); if (messageIndex !== -1) { keys2.splice(messageIndex, 1); } if (keys2.length === 1 && keys2[0] === "required") { return validators$2.required; } return validators$2[this.getType(rule)] || false; } }; Schema.register = function register2(type2, validator4) { if (typeof validator4 !== "function") { throw new Error("Cannot register a validator by type, validator is not a function"); } validators$2[type2] = validator4; }; Schema.warning = warning$2; Schema.messages = messages; Schema.validators = validators$2; function toArray$3(value24) { if (value24 === void 0 || value24 === null) { return []; } return Array.isArray(value24) ? value24 : [value24]; } function getNamePath(path2) { return toArray$3(path2); } function containsNamePath(namePathList, namePath) { return namePathList && namePathList.some(function(path2) { return matchNamePath(path2, namePath); }); } function isObject$1(obj) { return _typeof$2(obj) === "object" && obj !== null && Object.getPrototypeOf(obj) === Object.prototype; } function internalSetValues(store, values2) { var newStore = Array.isArray(store) ? _toConsumableArray(store) : _extends$1({}, store); if (!values2) { return newStore; } Object.keys(values2).forEach(function(key2) { var prevValue = newStore[key2]; var value24 = values2[key2]; var recursive = isObject$1(prevValue) && isObject$1(value24); newStore[key2] = recursive ? internalSetValues(prevValue, value24 || {}) : value24; }); return newStore; } function setValues(store) { for (var _len = arguments.length, restValues = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { restValues[_key - 1] = arguments[_key]; } return restValues.reduce(function(current2, newStore) { return internalSetValues(current2, newStore); }, store); } function matchNamePath(namePath, changedNamePath) { if (!namePath || !changedNamePath || namePath.length !== changedNamePath.length) { return false; } return namePath.every(function(nameUnit, i2) { return changedNamePath[i2] === nameUnit; }); } var typeTemplate = "'${name}' is not a valid ${type}"; var defaultValidateMessages = { default: "Validation error on field '${name}'", required: "'${name}' is required", enum: "'${name}' must be one of [${enum}]", whitespace: "'${name}' cannot be empty", date: { format: "'${name}' is invalid for format date", parse: "'${name}' could not be parsed as date", invalid: "'${name}' is invalid date" }, types: { string: typeTemplate, method: typeTemplate, array: typeTemplate, object: typeTemplate, number: typeTemplate, date: typeTemplate, boolean: typeTemplate, integer: typeTemplate, float: typeTemplate, regexp: typeTemplate, email: typeTemplate, url: typeTemplate, hex: typeTemplate }, string: { len: "'${name}' must be exactly ${len} characters", min: "'${name}' must be at least ${min} characters", max: "'${name}' cannot be longer than ${max} characters", range: "'${name}' must be between ${min} and ${max} characters" }, number: { len: "'${name}' must equal ${len}", min: "'${name}' cannot be less than ${min}", max: "'${name}' cannot be greater than ${max}", range: "'${name}' must be between ${min} and ${max}" }, array: { len: "'${name}' must be exactly ${len} in length", min: "'${name}' cannot be less than ${min} in length", max: "'${name}' cannot be greater than ${max} in length", range: "'${name}' must be between ${min} and ${max} in length" }, pattern: { mismatch: "'${name}' does not match pattern ${pattern}" } }; var __awaiter = globalThis && globalThis.__awaiter || function(thisArg, _arguments, P2, generator) { function adopt(value24) { return value24 instanceof P2 ? value24 : new P2(function(resolve) { resolve(value24); }); } return new (P2 || (P2 = Promise))(function(resolve, reject) { function fulfilled(value24) { try { step(generator.next(value24)); } catch (e2) { reject(e2); } } function rejected(value24) { try { step(generator["throw"](value24)); } catch (e2) { reject(e2); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var AsyncValidator = Schema; function replaceMessage(template, kv) { return template.replace(/\$\{\w+\}/g, function(str) { var key2 = str.slice(2, -1); return kv[key2]; }); } function validateRule(name, value24, rule, options2, messageVariables) { return __awaiter(this, void 0, void 0, /* @__PURE__ */ regenerator.mark(function _callee() { var cloneRule, subRuleField, validator4, messages3, result, subResults, kv, fillVariableResult; return regenerator.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: cloneRule = _extends$1({}, rule); delete cloneRule.ruleIndex; subRuleField = null; if (cloneRule && cloneRule.type === "array" && cloneRule.defaultField) { subRuleField = cloneRule.defaultField; delete cloneRule.defaultField; } validator4 = new AsyncValidator(_defineProperty$12({}, name, [cloneRule])); messages3 = setValues({}, defaultValidateMessages, options2.validateMessages); validator4.messages(messages3); result = []; _context.prev = 8; _context.next = 11; return Promise.resolve(validator4.validate(_defineProperty$12({}, name, value24), _extends$1({}, options2))); case 11: _context.next = 16; break; case 13: _context.prev = 13; _context.t0 = _context["catch"](8); if (_context.t0.errors) { result = _context.t0.errors.map(function(_ref, index2) { var message2 = _ref.message; return isValidElement(message2) ? cloneVNode(message2, { key: "error_".concat(index2) }) : message2; }); } else { console.error(_context.t0); result = [messages3.default()]; } case 16: if (!(!result.length && subRuleField)) { _context.next = 21; break; } _context.next = 19; return Promise.all(value24.map(function(subValue, i2) { return validateRule("".concat(name, ".").concat(i2), subValue, subRuleField, options2, messageVariables); })); case 19: subResults = _context.sent; return _context.abrupt("return", subResults.reduce(function(prev2, errors) { return [].concat(_toConsumableArray(prev2), _toConsumableArray(errors)); }, [])); case 21: kv = _extends$1(_extends$1(_extends$1({}, rule), { name, enum: (rule.enum || []).join(", ") }), messageVariables); fillVariableResult = result.map(function(error3) { if (typeof error3 === "string") { return replaceMessage(error3, kv); } return error3; }); return _context.abrupt("return", fillVariableResult); case 24: case "end": return _context.stop(); } } }, _callee, null, [[8, 13]]); })); } function validateRules(namePath, value24, rules2, options2, validateFirst, messageVariables) { var _this = this; var name = namePath.join("."); var filledRules = rules2.map(function(currentRule, ruleIndex) { var originValidatorFunc = currentRule.validator; var cloneRule = _extends$1(_extends$1({}, currentRule), { ruleIndex }); if (originValidatorFunc) { cloneRule.validator = function(rule, val, callback2) { var hasPromise = false; var wrappedCallback = function wrappedCallback2() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } Promise.resolve().then(function() { if (!hasPromise) { callback2.apply(void 0, args); } }); }; var promise = originValidatorFunc(rule, val, wrappedCallback); hasPromise = promise && typeof promise.then === "function" && typeof promise.catch === "function"; if (hasPromise) { promise.then(function() { callback2(); }).catch(function(err) { callback2(err || " "); }); } }; } return cloneRule; }).sort(function(_ref2, _ref3) { var w1 = _ref2.warningOnly, i1 = _ref2.ruleIndex; var w2 = _ref3.warningOnly, i2 = _ref3.ruleIndex; if (!!w1 === !!w2) { return i1 - i2; } if (w1) { return 1; } return -1; }); var summaryPromise; if (validateFirst === true) { summaryPromise = new Promise(function(resolve, reject) { return __awaiter(_this, void 0, void 0, /* @__PURE__ */ regenerator.mark(function _callee2() { var i2, rule, errors; return regenerator.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: i2 = 0; case 1: if (!(i2 < filledRules.length)) { _context2.next = 12; break; } rule = filledRules[i2]; _context2.next = 5; return validateRule(name, value24, rule, options2, messageVariables); case 5: errors = _context2.sent; if (!errors.length) { _context2.next = 9; break; } reject([{ errors, rule }]); return _context2.abrupt("return"); case 9: i2 += 1; _context2.next = 1; break; case 12: resolve([]); case 13: case "end": return _context2.stop(); } } }, _callee2); })); }); } else { var rulePromises = filledRules.map(function(rule) { return validateRule(name, value24, rule, options2, messageVariables).then(function(errors) { return { errors, rule }; }); }); summaryPromise = (validateFirst ? finishOnFirstFailed(rulePromises) : finishOnAllFailed(rulePromises)).then(function(errors) { return Promise.reject(errors); }); } summaryPromise.catch(function(e2) { return e2; }); return summaryPromise; } function finishOnAllFailed(rulePromises) { return __awaiter(this, void 0, void 0, /* @__PURE__ */ regenerator.mark(function _callee3() { return regenerator.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: return _context3.abrupt("return", Promise.all(rulePromises).then(function(errorsList) { var _ref4; var errors = (_ref4 = []).concat.apply(_ref4, _toConsumableArray(errorsList)); return errors; })); case 1: case "end": return _context3.stop(); } } }, _callee3); })); } function finishOnFirstFailed(rulePromises) { return __awaiter(this, void 0, void 0, /* @__PURE__ */ regenerator.mark(function _callee4() { var count2; return regenerator.wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: count2 = 0; return _context4.abrupt("return", new Promise(function(resolve) { rulePromises.forEach(function(promise) { promise.then(function(ruleError) { if (ruleError.errors.length) { resolve([ruleError]); } count2 += 1; if (count2 === rulePromises.length) { resolve([]); } }); }); })); case 2: case "end": return _context4.stop(); } } }, _callee4); })); } var FormContextKey = Symbol("formContextKey"); var useProvideForm = function useProvideForm2(state) { provide(FormContextKey, state); }; var useInjectForm = function useInjectForm2() { return inject(FormContextKey, { labelAlign: computed(function() { return "right"; }), vertical: computed(function() { return false; }), addField: function addField(_eventKey, _field) { }, removeField: function removeField(_eventKey) { }, model: computed(function() { return void 0; }), rules: computed(function() { return void 0; }), requiredMark: computed(function() { return false; }) }); }; var FormItemPrefixContextKey = Symbol("formItemPrefixContextKey"); var useProvideFormItemPrefix = function useProvideFormItemPrefix2(state) { provide(FormItemPrefixContextKey, state); }; var useInjectFormItemPrefix = function useInjectFormItemPrefix2() { return inject(FormItemPrefixContextKey, { prefixCls: computed(function() { return ""; }) }); }; var FormItemLabel = function FormItemLabel2(props2, _ref) { var _classNames; var slots = _ref.slots, emit2 = _ref.emit, attrs = _ref.attrs; var _a3, _b2, _c, _d, _e; var _Object$assign = _extends$1(_extends$1({}, props2), attrs), prefixCls2 = _Object$assign.prefixCls, htmlFor = _Object$assign.htmlFor, labelCol = _Object$assign.labelCol, labelAlign = _Object$assign.labelAlign, colon = _Object$assign.colon, required2 = _Object$assign.required, requiredMark = _Object$assign.requiredMark; var _useLocaleReceiver = useLocaleReceiver("Form"), _useLocaleReceiver2 = _slicedToArray$4(_useLocaleReceiver, 1), formLocale = _useLocaleReceiver2[0]; var label = (_a3 = props2.label) !== null && _a3 !== void 0 ? _a3 : (_b2 = slots.label) === null || _b2 === void 0 ? void 0 : _b2.call(slots); if (!label) return null; var _useInjectForm = useInjectForm(), vertical = _useInjectForm.vertical, contextLabelAlign = _useInjectForm.labelAlign, contextLabelCol = _useInjectForm.labelCol, contextColon = _useInjectForm.colon; var mergedLabelCol = labelCol || (contextLabelCol === null || contextLabelCol === void 0 ? void 0 : contextLabelCol.value) || {}; var mergedLabelAlign = labelAlign || (contextLabelAlign === null || contextLabelAlign === void 0 ? void 0 : contextLabelAlign.value); var labelClsBasic = "".concat(prefixCls2, "-item-label"); var labelColClassName = classNames(labelClsBasic, mergedLabelAlign === "left" && "".concat(labelClsBasic, "-left"), mergedLabelCol.class); var labelChildren = label; var computedColon = colon === true || (contextColon === null || contextColon === void 0 ? void 0 : contextColon.value) !== false && colon !== false; var haveColon = computedColon && !vertical.value; if (haveColon && typeof label === "string" && label.trim() !== "") { labelChildren = label.replace(/[:|:]\s*$/, ""); } labelChildren = createVNode(Fragment, null, [labelChildren, (_c = slots.tooltip) === null || _c === void 0 ? void 0 : _c.call(slots, { class: "".concat(prefixCls2, "-item-tooltip") })]); if (requiredMark === "optional" && !required2) { labelChildren = createVNode(Fragment, null, [labelChildren, createVNode("span", { "class": "".concat(prefixCls2, "-item-optional") }, [((_d = formLocale.value) === null || _d === void 0 ? void 0 : _d.optional) || ((_e = defaultLocale.Form) === null || _e === void 0 ? void 0 : _e.optional)])]); } var labelClassName = classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-item-required"), required2), _defineProperty$12(_classNames, "".concat(prefixCls2, "-item-required-mark-optional"), requiredMark === "optional"), _defineProperty$12(_classNames, "".concat(prefixCls2, "-item-no-colon"), !computedColon), _classNames)); return createVNode(Col$1, _objectSpread2$2(_objectSpread2$2({}, mergedLabelCol), {}, { "class": labelColClassName }), { default: function _default8() { return [createVNode("label", { "html-for": htmlFor, "class": labelClassName, "title": typeof label === "string" ? label : "", "onClick": function onClick7(e2) { return emit2("click", e2); } }, [labelChildren])]; } }); }; FormItemLabel.displayName = "FormItemLabel"; FormItemLabel.inheritAttrs = false; var FormItemLabel$1 = FormItemLabel; var ErrorList = defineComponent({ name: "ErrorList", props: ["errors", "help", "onDomErrorVisibleChange"], setup: function setup68(props2) { var _useConfigInject = useConfigInject("", props2), rootPrefixCls = _useConfigInject.prefixCls; var _useInjectFormItemPre = useInjectFormItemPrefix(), prefixCls2 = _useInjectFormItemPre.prefixCls, status = _useInjectFormItemPre.status; var visible9 = ref(!!(props2.errors && props2.errors.length)); var innerStatus = ref(status.value); var timeout = ref(); var cacheErrors = ref(_toConsumableArray(props2.errors)); watch([function() { return _toConsumableArray(props2.errors); }, function() { return props2.help; }], function(newValues) { window.clearTimeout(timeout.value); if (props2.help) { visible9.value = !!(props2.errors && props2.errors.length); if (visible9.value) { cacheErrors.value = newValues[0]; } } else { timeout.value = window.setTimeout(function() { visible9.value = !!(props2.errors && props2.errors.length); if (visible9.value) { cacheErrors.value = newValues[0]; } }); } }); onBeforeUnmount(function() { window.clearTimeout(timeout.value); }); watch([visible9, status], function() { if (visible9.value && status.value) { innerStatus.value = status.value; } }); watch(visible9, function() { var _a3; if (visible9.value) { (_a3 = props2.onDomErrorVisibleChange) === null || _a3 === void 0 ? void 0 : _a3.call(props2, true); } }, { immediate: true, flush: "post" }); return function() { var _a3; var baseClassName = "".concat(prefixCls2.value, "-item-explain"); var transitionProps = getTransitionProps("".concat(rootPrefixCls.value, "-show-help"), { onAfterLeave: function onAfterLeave() { var _a4; (_a4 = props2.onDomErrorVisibleChange) === null || _a4 === void 0 ? void 0 : _a4.call(props2, false); } }); return createVNode(Transition$1, transitionProps, { default: function _default8() { return [visible9.value ? createVNode("div", { "class": classNames(baseClassName, _defineProperty$12({}, "".concat(baseClassName, "-").concat(innerStatus.value), innerStatus.value)), "key": "help" }, [(_a3 = cacheErrors.value) === null || _a3 === void 0 ? void 0 : _a3.map(function(error3, index2) { return createVNode("div", { "key": index2, "role": "alert" }, [error3]); })]) : null]; } }); }; } }); var iconMap$1 = { success: CheckCircleFilled$3, warning: ExclamationCircleFilled$1, error: CloseCircleFilled$3, validating: LoadingOutlined$3 }; var FormItemInput = defineComponent({ slots: ["help", "extra", "errors"], inheritAttrs: false, props: ["prefixCls", "errors", "hasFeedback", "validateStatus", "onDomErrorVisibleChange", "wrapperCol", "help", "extra", "status"], setup: function setup69(props2, _ref) { var slots = _ref.slots; var formContext = useInjectForm(); var contextWrapperCol = formContext.wrapperCol; var subFormContext = _extends$1({}, formContext); delete subFormContext.labelCol; delete subFormContext.wrapperCol; useProvideForm(subFormContext); useProvideFormItemPrefix({ prefixCls: computed(function() { return props2.prefixCls; }), status: computed(function() { return props2.status; }) }); onUnmounted(function() { props2.onDomErrorVisibleChange(false); }); return function() { var _a3, _b2, _c, _d; var prefixCls2 = props2.prefixCls, wrapperCol = props2.wrapperCol, _props$help = props2.help, help = _props$help === void 0 ? (_a3 = slots.help) === null || _a3 === void 0 ? void 0 : _a3.call(slots) : _props$help, _props$errors = props2.errors, errors = _props$errors === void 0 ? (_b2 = slots.errors) === null || _b2 === void 0 ? void 0 : _b2.call(slots) : _props$errors, onDomErrorVisibleChange = props2.onDomErrorVisibleChange, hasFeedback = props2.hasFeedback, validateStatus2 = props2.validateStatus, _props$extra = props2.extra, extra = _props$extra === void 0 ? (_c = slots.extra) === null || _c === void 0 ? void 0 : _c.call(slots) : _props$extra; var baseClassName = "".concat(prefixCls2, "-item"); var mergedWrapperCol = wrapperCol || (contextWrapperCol === null || contextWrapperCol === void 0 ? void 0 : contextWrapperCol.value) || {}; var className = classNames("".concat(baseClassName, "-control"), mergedWrapperCol.class); var IconNode = validateStatus2 && iconMap$1[validateStatus2]; var icon = hasFeedback && IconNode ? createVNode("span", { "class": "".concat(baseClassName, "-children-icon") }, [createVNode(IconNode, null, null)]) : null; var inputDom = createVNode("div", { "class": "".concat(baseClassName, "-control-input") }, [createVNode("div", { "class": "".concat(baseClassName, "-control-input-content") }, [(_d = slots.default) === null || _d === void 0 ? void 0 : _d.call(slots)]), icon]); var errorListDom = createVNode(ErrorList, { "errors": errors, "help": help, "onDomErrorVisibleChange": onDomErrorVisibleChange }, null); var extraDom = extra ? createVNode("div", { "class": "".concat(baseClassName, "-extra") }, [extra]) : null; return createVNode(Col$1, _objectSpread2$2(_objectSpread2$2({}, mergedWrapperCol), {}, { "class": className }), { default: function _default8() { return [inputDom, errorListDom, extraDom]; } }); }; } }); var FormItemInput$1 = FormItemInput; tuple("success", "warning", "error", "validating", ""); function getPropByPath$1(obj, namePathList, strict) { var tempObj = obj; var keyArr = namePathList; var i2 = 0; try { for (var len = keyArr.length; i2 < len - 1; ++i2) { if (!tempObj && !strict) break; var key2 = keyArr[i2]; if (key2 in tempObj) { tempObj = tempObj[key2]; } else { if (strict) { throw Error("please transfer a valid name path to form item!"); } break; } } if (strict && !tempObj) { throw Error("please transfer a valid name path to form item!"); } } catch (error3) { console.error("please transfer a valid name path to form item!"); } return { o: tempObj, k: keyArr[i2], v: tempObj ? tempObj[keyArr[i2]] : void 0 }; } var formItemProps = { id: PropsTypes.string, htmlFor: PropsTypes.string, prefixCls: PropsTypes.string, label: PropsTypes.VNodeChild, help: PropsTypes.VNodeChild, extra: PropsTypes.VNodeChild, labelCol: { type: Object }, wrapperCol: { type: Object }, hasFeedback: PropsTypes.looseBool.def(false), colon: PropsTypes.looseBool, labelAlign: PropsTypes.oneOf(tuple("left", "right")), prop: { type: [String, Number, Array] }, name: { type: [String, Number, Array] }, rules: PropsTypes.oneOfType([Array, Object]), autoLink: PropsTypes.looseBool.def(true), required: PropsTypes.looseBool, validateFirst: PropsTypes.looseBool, validateStatus: PropsTypes.oneOf(tuple("", "success", "warning", "error", "validating")), validateTrigger: { type: [String, Array] }, messageVariables: { type: Object }, hidden: Boolean }; var indexGuid = 0; var FormItem = defineComponent({ name: "AFormItem", mixins: [BaseMixin], inheritAttrs: false, __ANT_NEW_FORM_ITEM: true, props: formItemProps, slots: ["help", "label", "extra"], setup: function setup70(props2, _ref) { var slots = _ref.slots, attrs = _ref.attrs, expose = _ref.expose; warning$6(props2.prop === void 0); var eventKey = "form-item-".concat(++indexGuid); var _useConfigInject = useConfigInject("form", props2), prefixCls2 = _useConfigInject.prefixCls; var formContext = useInjectForm(); var fieldName = computed(function() { return props2.name || props2.prop; }); var errors = ref([]); var validateDisabled = ref(false); var domErrorVisible = ref(false); var inputRef = ref(); var namePath = computed(function() { var val = fieldName.value; return getNamePath(val); }); var fieldId = computed(function() { var id2 = props2.id; if (id2) { return id2; } else if (!namePath.value.length) { return void 0; } else { var formName = formContext.name.value; var mergedId = namePath.value.join("_"); return formName ? "".concat(formName, "_").concat(mergedId) : mergedId; } }); var fieldValue = computed(function() { var model = formContext.model.value; if (!model || !fieldName.value) { return; } return getPropByPath$1(model, namePath.value, true).v; }); var initialValue = ref(cloneDeep(fieldValue.value)); var mergedValidateTrigger = computed(function() { var validateTrigger = props2.validateTrigger !== void 0 ? props2.validateTrigger : formContext.validateTrigger.value; validateTrigger = validateTrigger === void 0 ? "change" : validateTrigger; return toArray$3(validateTrigger); }); var rulesRef = computed(function() { var formRules = formContext.rules.value; var selfRules = props2.rules; var requiredRule = props2.required !== void 0 ? { required: !!props2.required, trigger: mergedValidateTrigger.value } : []; var prop = getPropByPath$1(formRules, namePath.value); formRules = formRules ? prop.o[prop.k] || prop.v : []; var rules2 = [].concat(selfRules || formRules || []); if (find$1(rules2, function(rule) { return rule.required; })) { return rules2; } else { return rules2.concat(requiredRule); } }); var isRequired2 = computed(function() { var rules2 = rulesRef.value; var isRequired3 = false; if (rules2 && rules2.length) { rules2.every(function(rule) { if (rule.required) { isRequired3 = true; return false; } return true; }); } return isRequired3 || props2.required; }); var validateState = ref(); watchEffect(function() { validateState.value = props2.validateStatus; }); var validateRules$1 = function validateRules$12(options2) { var _props$validateFirst = props2.validateFirst, validateFirst = _props$validateFirst === void 0 ? false : _props$validateFirst, messageVariables = props2.messageVariables; var _ref2 = options2 || {}, triggerName = _ref2.triggerName; var filteredRules = rulesRef.value; if (triggerName) { filteredRules = filteredRules.filter(function(rule) { var trigger2 = rule.trigger; if (!trigger2 && !mergedValidateTrigger.value.length) { return true; } var triggerList = toArray$3(trigger2 || mergedValidateTrigger.value); return triggerList.includes(triggerName); }); } if (!filteredRules.length) { return Promise.resolve(); } var promise = validateRules(namePath.value, fieldValue.value, filteredRules, options2, validateFirst, messageVariables); validateState.value = "validating"; errors.value = []; promise.catch(function(e2) { return e2; }).then(function() { var results = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; if (validateState.value === "validating") { var res = results.filter(function(result) { return result && result.errors.length; }); validateState.value = res.length ? "error" : "success"; errors.value = res.map(function(r2) { return r2.errors; }); } }); return promise; }; var onFieldBlur = function onFieldBlur2() { validateRules$1({ triggerName: "blur" }); }; var onFieldChange = function onFieldChange2() { if (validateDisabled.value) { validateDisabled.value = false; return; } validateRules$1({ triggerName: "change" }); }; var clearValidate2 = function clearValidate3() { validateState.value = ""; validateDisabled.value = false; errors.value = []; }; var resetField = function resetField2() { validateState.value = ""; validateDisabled.value = true; errors.value = []; var model = formContext.model.value || {}; var value24 = fieldValue.value; var prop = getPropByPath$1(model, namePath.value, true); if (Array.isArray(value24)) { prop.o[prop.k] = [].concat(initialValue.value); } else { prop.o[prop.k] = initialValue.value; } nextTick(function() { validateDisabled.value = false; }); }; var onLabelClick = function onLabelClick2() { var id2 = fieldId.value; if (!id2 || !inputRef.value) { return; } var control = inputRef.value.$el.querySelector('[id="'.concat(id2, '"]')); if (control && control.focus) { control.focus(); } }; expose({ onFieldBlur, onFieldChange, clearValidate: clearValidate2, resetField }); var registered = false; watch(fieldName, function(val) { if (val) { if (!registered) { registered = true; formContext.addField(eventKey, { fieldValue, fieldId, fieldName, resetField, clearValidate: clearValidate2, namePath, validateRules: validateRules$1, rules: rulesRef }); } } else { registered = false; formContext.removeField(eventKey); } }, { immediate: true }); onBeforeUnmount(function() { formContext.removeField(eventKey); }); var itemClassName = computed(function() { var _ref3; return _ref3 = {}, _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-item"), true), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-item-has-feedback"), validateState.value && props2.hasFeedback), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-item-has-success"), validateState.value === "success"), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-item-has-warning"), validateState.value === "warning"), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-item-has-error"), validateState.value === "error"), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-item-is-validating"), validateState.value === "validating"), _defineProperty$12(_ref3, "".concat(prefixCls2.value, "-item-hidden"), props2.hidden), _ref3; }); return function() { var _a3, _b2, _c, _d, _e, _f; var help = (_a3 = props2.help) !== null && _a3 !== void 0 ? _a3 : slots.help ? filterEmpty(slots.help()) : null; var children = flattenChildren((_b2 = slots.default) === null || _b2 === void 0 ? void 0 : _b2.call(slots)); var firstChildren = children[0]; if (fieldName.value && props2.autoLink && isValidElement(firstChildren)) { var originalEvents = firstChildren.props || {}; var originalBlur = originalEvents.onBlur; var originalChange = originalEvents.onChange; firstChildren = cloneElement(firstChildren, _extends$1(_extends$1({}, fieldId.value ? { id: fieldId.value } : void 0), { onBlur: function onBlur6() { if (Array.isArray(originalChange)) { for (var i2 = 0, l2 = originalChange.length; i2 < l2; i2++) { originalBlur[i2].apply(originalBlur, arguments); } } else if (originalBlur) { originalBlur.apply(void 0, arguments); } onFieldBlur(); }, onChange: function onChange8() { if (Array.isArray(originalChange)) { for (var i2 = 0, l2 = originalChange.length; i2 < l2; i2++) { originalChange[i2].apply(originalChange, arguments); } } else if (originalChange) { originalChange.apply(void 0, arguments); } onFieldChange(); } })); } return createVNode(Row$3, _objectSpread2$2(_objectSpread2$2({}, attrs), {}, { "class": [itemClassName.value, domErrorVisible.value || !!help ? "".concat(prefixCls2.value, "-item-with-help") : "", attrs.class], "key": "row" }), { default: function _default8() { return [createVNode(FormItemLabel$1, _objectSpread2$2(_objectSpread2$2({}, props2), {}, { "htmlFor": fieldId.value, "required": isRequired2.value, "requiredMark": formContext.requiredMark.value, "prefixCls": prefixCls2.value, "onClick": onLabelClick, "label": (_c = props2.label) !== null && _c !== void 0 ? _c : (_d = slots.label) === null || _d === void 0 ? void 0 : _d.call(slots) }), null), createVNode(FormItemInput$1, _objectSpread2$2(_objectSpread2$2({}, props2), {}, { "errors": help !== void 0 && help !== null ? toArray$3(help) : errors.value, "prefixCls": prefixCls2.value, "status": validateState.value, "onDomErrorVisibleChange": function onDomErrorVisibleChange(v2) { return domErrorVisible.value = v2; }, "validateStatus": validateState.value, "ref": inputRef, "help": help, "extra": (_e = props2.extra) !== null && _e !== void 0 ? _e : (_f = slots.extra) === null || _f === void 0 ? void 0 : _f.call(slots) }), { default: function _default9() { return [[firstChildren, children.slice(1)]]; } })]; } }); }; } }); function allPromiseFinish(promiseList) { var hasError = false; var count2 = promiseList.length; var results = []; if (!promiseList.length) { return Promise.resolve([]); } return new Promise(function(resolve, reject) { promiseList.forEach(function(promise, index2) { promise.catch(function(e2) { hasError = true; return e2; }).then(function(result) { count2 -= 1; results[index2] = result; if (count2 > 0) { return; } if (hasError) { reject(results); } resolve(results); }); }); }); } function t(t2) { return typeof t2 == "object" && t2 != null && t2.nodeType === 1; } function e(t2, e2) { return (!e2 || t2 !== "hidden") && t2 !== "visible" && t2 !== "clip"; } function n(t2, n2) { if (t2.clientHeight < t2.scrollHeight || t2.clientWidth < t2.scrollWidth) { var r2 = getComputedStyle(t2, null); return e(r2.overflowY, n2) || e(r2.overflowX, n2) || function(t3) { var e2 = function(t4) { if (!t4.ownerDocument || !t4.ownerDocument.defaultView) return null; try { return t4.ownerDocument.defaultView.frameElement; } catch (t5) { return null; } }(t3); return !!e2 && (e2.clientHeight < t3.scrollHeight || e2.clientWidth < t3.scrollWidth); }(t2); } return false; } function r(t2, e2, n2, r2, i2, o2, l2, d2) { return o2 < t2 && l2 > e2 || o2 > t2 && l2 < e2 ? 0 : o2 <= t2 && d2 <= n2 || l2 >= e2 && d2 >= n2 ? o2 - t2 - r2 : l2 > e2 && d2 < n2 || o2 < t2 && d2 > n2 ? l2 - e2 + i2 : 0; } function compute(e2, i2) { var o2 = window, l2 = i2.scrollMode, d2 = i2.block, u2 = i2.inline, h2 = i2.boundary, a2 = i2.skipOverflowHiddenElements, c2 = typeof h2 == "function" ? h2 : function(t2) { return t2 !== h2; }; if (!t(e2)) throw new TypeError("Invalid target"); for (var f2 = document.scrollingElement || document.documentElement, s2 = [], p = e2; t(p) && c2(p); ) { if ((p = p.parentElement) === f2) { s2.push(p); break; } p != null && p === document.body && n(p) && !n(document.documentElement) || p != null && n(p, a2) && s2.push(p); } for (var m2 = o2.visualViewport ? o2.visualViewport.width : innerWidth, g2 = o2.visualViewport ? o2.visualViewport.height : innerHeight, w2 = window.scrollX || pageXOffset, v2 = window.scrollY || pageYOffset, W = e2.getBoundingClientRect(), b2 = W.height, H = W.width, y2 = W.top, E2 = W.right, M2 = W.bottom, V2 = W.left, x2 = d2 === "start" || d2 === "nearest" ? y2 : d2 === "end" ? M2 : y2 + b2 / 2, I2 = u2 === "center" ? V2 + H / 2 : u2 === "end" ? E2 : V2, C = [], T2 = 0; T2 < s2.length; T2++) { var k2 = s2[T2], B2 = k2.getBoundingClientRect(), D2 = B2.height, O2 = B2.width, R2 = B2.top, X = B2.right, Y2 = B2.bottom, L2 = B2.left; if (l2 === "if-needed" && y2 >= 0 && V2 >= 0 && M2 <= g2 && E2 <= m2 && y2 >= R2 && M2 <= Y2 && V2 >= L2 && E2 <= X) return C; var S2 = getComputedStyle(k2), j2 = parseInt(S2.borderLeftWidth, 10), q2 = parseInt(S2.borderTopWidth, 10), z2 = parseInt(S2.borderRightWidth, 10), A2 = parseInt(S2.borderBottomWidth, 10), F2 = 0, G = 0, J2 = "offsetWidth" in k2 ? k2.offsetWidth - k2.clientWidth - j2 - z2 : 0, K = "offsetHeight" in k2 ? k2.offsetHeight - k2.clientHeight - q2 - A2 : 0; if (f2 === k2) F2 = d2 === "start" ? x2 : d2 === "end" ? x2 - g2 : d2 === "nearest" ? r(v2, v2 + g2, g2, q2, A2, v2 + x2, v2 + x2 + b2, b2) : x2 - g2 / 2, G = u2 === "start" ? I2 : u2 === "center" ? I2 - m2 / 2 : u2 === "end" ? I2 - m2 : r(w2, w2 + m2, m2, j2, z2, w2 + I2, w2 + I2 + H, H), F2 = Math.max(0, F2 + v2), G = Math.max(0, G + w2); else { F2 = d2 === "start" ? x2 - R2 - q2 : d2 === "end" ? x2 - Y2 + A2 + K : d2 === "nearest" ? r(R2, Y2, D2, q2, A2 + K, x2, x2 + b2, b2) : x2 - (R2 + D2 / 2) + K / 2, G = u2 === "start" ? I2 - L2 - j2 : u2 === "center" ? I2 - (L2 + O2 / 2) + J2 / 2 : u2 === "end" ? I2 - X + z2 + J2 : r(L2, X, O2, j2, z2 + J2, I2, I2 + H, H); var N2 = k2.scrollLeft, P2 = k2.scrollTop; x2 += P2 - (F2 = Math.max(0, Math.min(P2 + F2, k2.scrollHeight - D2 + K))), I2 += N2 - (G = Math.max(0, Math.min(N2 + G, k2.scrollWidth - O2 + J2))); } C.push({ el: k2, top: F2, left: G }); } return C; } function isOptionsObject(options2) { return options2 === Object(options2) && Object.keys(options2).length !== 0; } function defaultBehavior(actions, behavior) { if (behavior === void 0) { behavior = "auto"; } var canSmoothScroll = "scrollBehavior" in document.body.style; actions.forEach(function(_ref) { var el = _ref.el, top = _ref.top, left = _ref.left; if (el.scroll && canSmoothScroll) { el.scroll({ top, left, behavior }); } else { el.scrollTop = top; el.scrollLeft = left; } }); } function getOptions(options2) { if (options2 === false) { return { block: "end", inline: "nearest" }; } if (isOptionsObject(options2)) { return options2; } return { block: "start", inline: "nearest" }; } function scrollIntoView$1(target, options2) { var isTargetAttached = target.isConnected || target.ownerDocument.documentElement.contains(target); if (isOptionsObject(options2) && typeof options2.behavior === "function") { return options2.behavior(isTargetAttached ? compute(target, options2) : []); } if (!isTargetAttached) { return; } var computeOptions = getOptions(options2); return defaultBehavior(compute(target, computeOptions), computeOptions.behavior); } function isRequired(rules2) { var isRequired2 = false; if (rules2 && rules2.length) { rules2.every(function(rule) { if (rule.required) { isRequired2 = true; return false; } return true; }); } return isRequired2; } function toArray$2(value24) { if (value24 === void 0 || value24 === null) { return []; } return Array.isArray(value24) ? value24 : [value24]; } function getPropByPath(obj, path2, strict) { var tempObj = obj; path2 = path2.replace(/\[(\w+)\]/g, ".$1"); path2 = path2.replace(/^\./, ""); var keyArr = path2.split("."); var i2 = 0; for (var len = keyArr.length; i2 < len - 1; ++i2) { if (!tempObj && !strict) break; var key2 = keyArr[i2]; if (key2 in tempObj) { tempObj = tempObj[key2]; } else { if (strict) { throw new Error("please transfer a valid name path to validate!"); } break; } } return { o: tempObj, k: keyArr[i2], v: tempObj ? tempObj[keyArr[i2]] : null, isValid: tempObj && keyArr[i2] in tempObj }; } function useForm$1(modelRef, rulesRef, options2) { var initialModel = cloneDeep(unref(modelRef)); var validateInfos = reactive({}); var rulesKeys = computed(function() { return rulesRef ? Object.keys(unref(rulesRef)) : []; }); watch(rulesKeys, function() { var newValidateInfos = {}; rulesKeys.value.forEach(function(key3) { newValidateInfos[key3] = validateInfos[key3] || { autoLink: false, required: isRequired(unref(rulesRef)[key3]) }; delete validateInfos[key3]; }); for (var key2 in validateInfos) { if (Object.prototype.hasOwnProperty.call(validateInfos, key2)) { delete validateInfos[key2]; } } _extends$1(validateInfos, newValidateInfos); }, { immediate: true }); var resetFields2 = function resetFields3(newValues) { _extends$1(unref(modelRef), _extends$1(_extends$1({}, cloneDeep(initialModel)), newValues)); nextTick(function() { Object.keys(validateInfos).forEach(function(key2) { validateInfos[key2] = { autoLink: false, required: isRequired(unref(rulesRef)[key2]) }; }); }); }; var filterRules = function filterRules2() { var rules2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var trigger2 = arguments.length > 1 ? arguments[1] : void 0; if (!trigger2.length) { return rules2; } else { return rules2.filter(function(rule) { var triggerList = toArray$2(rule.trigger || "change"); return intersection$1(triggerList, trigger2).length; }); } }; var lastValidatePromise = null; var validateFields2 = function validateFields3(names2) { var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var strict = arguments.length > 2 ? arguments[2] : void 0; var promiseList = []; var values2 = {}; var _loop = function _loop2(i3) { var name = names2[i3]; var prop = getPropByPath(unref(modelRef), name, strict); if (!prop.isValid) return "continue"; values2[name] = prop.v; var rules2 = filterRules(unref(rulesRef)[name], toArray$2(option && option.trigger)); if (rules2.length) { promiseList.push(validateField(name, prop.v, rules2, option || {}).then(function() { return { name, errors: [], warnings: [] }; }).catch(function(ruleErrors) { var mergedErrors = []; var mergedWarnings = []; ruleErrors.forEach(function(_ref) { var warningOnly = _ref.rule.warningOnly, errors = _ref.errors; if (warningOnly) { mergedWarnings.push.apply(mergedWarnings, _toConsumableArray(errors)); } else { mergedErrors.push.apply(mergedErrors, _toConsumableArray(errors)); } }); if (mergedErrors.length) { return Promise.reject({ name, errors: mergedErrors, warnings: mergedWarnings }); } return { name, errors: mergedErrors, warnings: mergedWarnings }; })); } }; for (var i2 = 0; i2 < names2.length; i2++) { var _ret = _loop(i2); if (_ret === "continue") continue; } var summaryPromise = allPromiseFinish(promiseList); lastValidatePromise = summaryPromise; var returnPromise = summaryPromise.then(function() { if (lastValidatePromise === summaryPromise) { return Promise.resolve(values2); } return Promise.reject([]); }).catch(function(results) { var errorList = results.filter(function(result) { return result && result.errors.length; }); return Promise.reject({ values: values2, errorFields: errorList, outOfDate: lastValidatePromise !== summaryPromise }); }); returnPromise.catch(function(e2) { return e2; }); return returnPromise; }; var validateField = function validateField2(name, value24, rules2) { var option = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; var promise = validateRules([name], value24, rules2, _extends$1({ validateMessages: defaultValidateMessages }, option), !!option.validateFirst); if (!validateInfos[name]) { return promise.catch(function(e2) { return e2; }); } validateInfos[name].validateStatus = "validating"; promise.catch(function(e2) { return e2; }).then(function() { var results = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; if (validateInfos[name].validateStatus === "validating") { var res = results.filter(function(result) { return result && result.errors.length; }); validateInfos[name].validateStatus = res.length ? "error" : "success"; validateInfos[name].help = res.length ? res.map(function(r2) { return r2.errors; }) : ""; } }); return promise; }; var validate3 = function validate4(names2, option) { var keys2 = []; var strict = true; if (!names2) { strict = false; keys2 = rulesKeys.value; } else if (Array.isArray(names2)) { keys2 = names2; } else { keys2 = [names2]; } var promises = validateFields2(keys2, option || {}, strict); promises.catch(function(e2) { return e2; }); return promises; }; var clearValidate2 = function clearValidate3(names2) { var keys2 = []; if (!names2) { keys2 = rulesKeys.value; } else if (Array.isArray(names2)) { keys2 = names2; } else { keys2 = [names2]; } keys2.forEach(function(key2) { validateInfos[key2] && _extends$1(validateInfos[key2], { validateStatus: "", help: "" }); }); }; var mergeValidateInfo = function mergeValidateInfo2(items) { var info3 = { autoLink: false }; var help = []; var infos = Array.isArray(items) ? items : [items]; for (var i2 = 0; i2 < infos.length; i2++) { var arg = infos[i2]; if ((arg === null || arg === void 0 ? void 0 : arg.validateStatus) === "error") { info3.validateStatus = "error"; arg.help && help.push(arg.help); } info3.required = info3.required || (arg === null || arg === void 0 ? void 0 : arg.required); } info3.help = help; return info3; }; var oldModel = initialModel; var isFirstTime = true; var modelFn = function modelFn2(model) { var names2 = []; rulesKeys.value.forEach(function(key2) { var prop = getPropByPath(model, key2, false); var oldProp = getPropByPath(oldModel, key2, false); var isFirstValidation = isFirstTime && (options2 === null || options2 === void 0 ? void 0 : options2.immediate) && prop.isValid; if (isFirstValidation || !isEqual$1(prop.v, oldProp.v)) { names2.push(key2); } }); validate3(names2, { trigger: "change" }); isFirstTime = false; oldModel = cloneDeep(model); }; var debounceOptions = options2 === null || options2 === void 0 ? void 0 : options2.debounce; watch(modelRef, debounceOptions && debounceOptions.wait ? debounce$1(modelFn, debounceOptions.wait, omit$2(debounceOptions, ["wait"])) : modelFn, { immediate: options2 && !!options2.immediate, deep: true }); watch(rulesRef, function() { if (options2 && options2.validateOnRuleChange) { validate3(); } }, { deep: true }); return { modelRef, rulesRef, initialModel, validateInfos, resetFields: resetFields2, validate: validate3, validateField, mergeValidateInfo, clearValidate: clearValidate2 }; } var formProps = { layout: PropsTypes.oneOf(tuple("horizontal", "inline", "vertical")), labelCol: { type: Object }, wrapperCol: { type: Object }, colon: PropsTypes.looseBool, labelAlign: PropsTypes.oneOf(tuple("left", "right")), prefixCls: PropsTypes.string, requiredMark: { type: [String, Boolean], default: void 0 }, hideRequiredMark: PropsTypes.looseBool, model: PropsTypes.object, rules: { type: Object }, validateMessages: PropsTypes.object, validateOnRuleChange: PropsTypes.looseBool, scrollToFirstError: { type: [Boolean, Object] }, onSubmit: PropsTypes.func, onFinish: PropsTypes.func, onFinishFailed: PropsTypes.func, name: PropsTypes.string, validateTrigger: { type: [String, Array] }, size: { type: String } }; function isEqualName(name1, name2) { return isEqual$1(toArray$3(name1), toArray$3(name2)); } var Form = defineComponent({ name: "AForm", inheritAttrs: false, props: initDefaultProps$1(formProps, { layout: "horizontal", hideRequiredMark: false, colon: true }), Item: FormItem, useForm: useForm$1, emits: ["finishFailed", "submit", "finish"], setup: function setup71(props2, _ref) { var emit2 = _ref.emit, slots = _ref.slots, expose = _ref.expose, attrs = _ref.attrs; var size = useInjectSize(props2); var _useConfigInject = useConfigInject("form", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction, contextForm = _useConfigInject.form; var requiredMark = computed(function() { return props2.requiredMark === "" || props2.requiredMark; }); var mergedRequiredMark = computed(function() { var _a3; if (requiredMark.value !== void 0) { return requiredMark.value; } if (contextForm && ((_a3 = contextForm.value) === null || _a3 === void 0 ? void 0 : _a3.requiredMark) !== void 0) { return contextForm.value.requiredMark; } if (props2.hideRequiredMark) { return false; } return true; }); var formClassName = computed(function() { var _classNames; return classNames(prefixCls2.value, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-").concat(props2.layout), true), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-hide-required-mark"), mergedRequiredMark.value === false), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-rtl"), direction.value === "rtl"), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-").concat(size.value), size.value), _classNames)); }); var lastValidatePromise = ref(); var fields2 = {}; var addField = function addField2(eventKey, field) { fields2[eventKey] = field; }; var removeField = function removeField2(eventKey) { delete fields2[eventKey]; }; var getFieldsByNameList = function getFieldsByNameList2(nameList) { var provideNameList = !!nameList; var namePathList = provideNameList ? toArray$3(nameList).map(getNamePath) : []; if (!provideNameList) { return Object.values(fields2); } else { return Object.values(fields2).filter(function(field) { return namePathList.findIndex(function(namePath) { return isEqualName(namePath, field.fieldName.value); }) > -1; }); } }; var resetFields2 = function resetFields3(name) { if (!props2.model) { warning$5(false, "Form", "model is required for resetFields to work."); return; } getFieldsByNameList(name).forEach(function(field) { field.resetField(); }); }; var clearValidate2 = function clearValidate3(name) { getFieldsByNameList(name).forEach(function(field) { field.clearValidate(); }); }; var handleFinishFailed = function handleFinishFailed2(errorInfo) { var scrollToFirstError = props2.scrollToFirstError; emit2("finishFailed", errorInfo); if (scrollToFirstError && errorInfo.errorFields.length) { var scrollToFieldOptions = {}; if (_typeof$2(scrollToFirstError) === "object") { scrollToFieldOptions = scrollToFirstError; } scrollToField2(errorInfo.errorFields[0].name, scrollToFieldOptions); } }; var validate3 = function validate4() { return validateField.apply(void 0, arguments); }; var scrollToField2 = function scrollToField3(name) { var options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var fields3 = getFieldsByNameList(name); if (fields3.length) { var fieldId = fields3[0].fieldId.value; var node = fieldId ? document.getElementById(fieldId) : null; if (node) { scrollIntoView$1(node, _extends$1({ scrollMode: "if-needed", block: "nearest" }, options2)); } } }; var getFieldsValue2 = function getFieldsValue3() { var nameList = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; var values2 = {}; Object.values(fields2).forEach(function(_ref2) { var fieldName = _ref2.fieldName, fieldValue = _ref2.fieldValue; values2[fieldName.value] = fieldValue.value; }); if (nameList === true) { return values2; } else { var res = {}; toArray$3(nameList).forEach(function(namePath) { return res[namePath] = values2[namePath]; }); return res; } }; var validateFields2 = function validateFields3(nameList, options2) { warning$5(!(nameList instanceof Function), "Form", "validateFields/validateField/validate not support callback, please use promise instead"); if (!props2.model) { warning$5(false, "Form", "model is required for validateFields to work."); return Promise.reject("Form `model` is required for validateFields to work."); } var provideNameList = !!nameList; var namePathList = provideNameList ? toArray$3(nameList).map(getNamePath) : []; var promiseList = []; Object.values(fields2).forEach(function(field) { var _a3; if (!provideNameList) { namePathList.push(field.namePath.value); } if (!((_a3 = field.rules) === null || _a3 === void 0 ? void 0 : _a3.value.length)) { return; } var fieldNamePath = field.namePath.value; if (!provideNameList || containsNamePath(namePathList, fieldNamePath)) { var promise = field.validateRules(_extends$1({ validateMessages: _extends$1(_extends$1({}, defaultValidateMessages), props2.validateMessages) }, options2)); promiseList.push(promise.then(function() { return { name: fieldNamePath, errors: [], warnings: [] }; }).catch(function(ruleErrors) { var mergedErrors = []; var mergedWarnings = []; ruleErrors.forEach(function(_ref3) { var warningOnly = _ref3.rule.warningOnly, errors = _ref3.errors; if (warningOnly) { mergedWarnings.push.apply(mergedWarnings, _toConsumableArray(errors)); } else { mergedErrors.push.apply(mergedErrors, _toConsumableArray(errors)); } }); if (mergedErrors.length) { return Promise.reject({ name: fieldNamePath, errors: mergedErrors, warnings: mergedWarnings }); } return { name: fieldNamePath, errors: mergedErrors, warnings: mergedWarnings }; })); } }); var summaryPromise = allPromiseFinish(promiseList); lastValidatePromise.value = summaryPromise; var returnPromise = summaryPromise.then(function() { if (lastValidatePromise.value === summaryPromise) { return Promise.resolve(getFieldsValue2(namePathList)); } return Promise.reject([]); }).catch(function(results) { var errorList = results.filter(function(result) { return result && result.errors.length; }); return Promise.reject({ values: getFieldsValue2(namePathList), errorFields: errorList, outOfDate: lastValidatePromise.value !== summaryPromise }); }); returnPromise.catch(function(e2) { return e2; }); return returnPromise; }; var validateField = function validateField2() { return validateFields2.apply(void 0, arguments); }; var handleSubmit2 = function handleSubmit3(e2) { e2.preventDefault(); e2.stopPropagation(); emit2("submit", e2); if (props2.model) { var res = validateFields2(); res.then(function(values2) { emit2("finish", values2); }).catch(function(errors) { handleFinishFailed(errors); }); } }; expose({ resetFields: resetFields2, clearValidate: clearValidate2, validateFields: validateFields2, getFieldsValue: getFieldsValue2, validate: validate3, scrollToField: scrollToField2 }); useProvideForm({ model: computed(function() { return props2.model; }), name: computed(function() { return props2.name; }), labelAlign: computed(function() { return props2.labelAlign; }), labelCol: computed(function() { return props2.labelCol; }), wrapperCol: computed(function() { return props2.wrapperCol; }), vertical: computed(function() { return props2.layout === "vertical"; }), colon: computed(function() { return props2.colon; }), requiredMark: mergedRequiredMark, validateTrigger: computed(function() { return props2.validateTrigger; }), rules: computed(function() { return props2.rules; }), addField, removeField }); watch(function() { return props2.rules; }, function() { if (props2.validateOnRuleChange) { validateFields2(); } }); return function() { var _a3; return createVNode("form", _objectSpread2$2(_objectSpread2$2({}, attrs), {}, { "onSubmit": handleSubmit2, "class": [formClassName.value, attrs.class] }), [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)]); }; } }); var Form$1 = Form; Form$1.install = function(app) { app.component(Form$1.name, Form$1); app.component(Form$1.Item.name, Form$1.Item); return app; }; function getClientSize() { var width = document.documentElement.clientWidth; var height = window.innerHeight || document.documentElement.clientHeight; return { width, height }; } function getOffset$1(node) { var box = node.getBoundingClientRect(); var docElem = document.documentElement; return { left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0), top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0) }; } var RotateLeftOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M672 418H144c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H188V494h440v326z" } }, { "tag": "path", "attrs": { "d": "M819.3 328.5c-78.8-100.7-196-153.6-314.6-154.2l-.2-64c0-6.5-7.6-10.1-12.6-6.1l-128 101c-4 3.1-3.9 9.1 0 12.3L492 318.6c5.1 4 12.7.4 12.6-6.1v-63.9c12.9.1 25.9.9 38.8 2.5 42.1 5.2 82.1 18.2 119 38.7 38.1 21.2 71.2 49.7 98.4 84.3 27.1 34.7 46.7 73.7 58.1 115.8a325.95 325.95 0 016.5 140.9h74.9c14.8-103.6-11.3-213-81-302.3z" } }] }, "name": "rotate-left", "theme": "outlined" }; var RotateLeftOutlinedSvg = RotateLeftOutlined$2; function _objectSpread$C(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$D(target, key2, source2[key2]); }); } return target; } function _defineProperty$D(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var RotateLeftOutlined = function RotateLeftOutlined2(props2, context2) { var p = _objectSpread$C({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$C({}, p, { "icon": RotateLeftOutlinedSvg }), null); }; RotateLeftOutlined.displayName = "RotateLeftOutlined"; RotateLeftOutlined.inheritAttrs = false; var RotateLeftOutlined$1 = RotateLeftOutlined; var RotateRightOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M480.5 251.2c13-1.6 25.9-2.4 38.8-2.5v63.9c0 6.5 7.5 10.1 12.6 6.1L660 217.6c4-3.2 4-9.2 0-12.3l-128-101c-5.1-4-12.6-.4-12.6 6.1l-.2 64c-118.6.5-235.8 53.4-314.6 154.2A399.75 399.75 0 00123.5 631h74.9c-.9-5.3-1.7-10.7-2.4-16.1-5.1-42.1-2.1-84.1 8.9-124.8 11.4-42.2 31-81.1 58.1-115.8 27.2-34.7 60.3-63.2 98.4-84.3 37-20.6 76.9-33.6 119.1-38.8z" } }, { "tag": "path", "attrs": { "d": "M880 418H352c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H396V494h440v326z" } }] }, "name": "rotate-right", "theme": "outlined" }; var RotateRightOutlinedSvg = RotateRightOutlined$2; function _objectSpread$B(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$C(target, key2, source2[key2]); }); } return target; } function _defineProperty$C(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var RotateRightOutlined = function RotateRightOutlined2(props2, context2) { var p = _objectSpread$B({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$B({}, p, { "icon": RotateRightOutlinedSvg }), null); }; RotateRightOutlined.displayName = "RotateRightOutlined"; RotateRightOutlined.inheritAttrs = false; var RotateRightOutlined$1 = RotateRightOutlined; var ZoomInOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z" } }] }, "name": "zoom-in", "theme": "outlined" }; var ZoomInOutlinedSvg = ZoomInOutlined$2; function _objectSpread$A(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$B(target, key2, source2[key2]); }); } return target; } function _defineProperty$B(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var ZoomInOutlined = function ZoomInOutlined2(props2, context2) { var p = _objectSpread$A({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$A({}, p, { "icon": ZoomInOutlinedSvg }), null); }; ZoomInOutlined.displayName = "ZoomInOutlined"; ZoomInOutlined.inheritAttrs = false; var ZoomInOutlined$1 = ZoomInOutlined; var ZoomOutOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z" } }] }, "name": "zoom-out", "theme": "outlined" }; var ZoomOutOutlinedSvg = ZoomOutOutlined$2; function _objectSpread$z(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$A(target, key2, source2[key2]); }); } return target; } function _defineProperty$A(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var ZoomOutOutlined = function ZoomOutOutlined2(props2, context2) { var p = _objectSpread$z({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$z({}, p, { "icon": ZoomOutOutlinedSvg }), null); }; ZoomOutOutlined.displayName = "ZoomOutOutlined"; ZoomOutOutlined.inheritAttrs = false; var ZoomOutOutlined$1 = ZoomOutOutlined; var ILazyRenderBoxPropTypes = { visible: PropsTypes.looseBool, hiddenClassName: PropsTypes.string, forceRender: PropsTypes.looseBool }; var LazyRenderBox = { props: ILazyRenderBoxPropTypes, render: function render61() { return createVNode("div", null, [getSlot$1(this)]); } }; var _switchScrollingEffect = function(close7) { var bodyIsOverflowing = document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth; if (!bodyIsOverflowing) { return; } if (close7) { document.body.style.position = ""; document.body.style.width = ""; return; } var scrollBarSize = getScrollBarSize(); if (scrollBarSize) { document.body.style.position = "relative"; document.body.style.width = "calc(100% - ".concat(scrollBarSize, "px)"); } }; function IDialogPropTypes$3() { return { keyboard: PropsTypes.looseBool, mask: PropsTypes.looseBool, afterClose: PropsTypes.func, closable: PropsTypes.looseBool, maskClosable: PropsTypes.looseBool, visible: PropsTypes.looseBool, destroyOnClose: PropsTypes.looseBool, mousePosition: PropsTypes.shape({ x: PropsTypes.number, y: PropsTypes.number }).loose, title: PropsTypes.any, footer: PropsTypes.any, transitionName: PropsTypes.string, maskTransitionName: PropsTypes.string, animation: PropsTypes.any, maskAnimation: PropsTypes.any, wrapStyle: PropsTypes.object, bodyStyle: PropsTypes.object, maskStyle: PropsTypes.object, prefixCls: PropsTypes.string, wrapClassName: PropsTypes.string, width: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), height: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), zIndex: PropsTypes.number, bodyProps: PropsTypes.any, maskProps: PropsTypes.any, wrapProps: PropsTypes.any, getContainer: PropsTypes.any, dialogStyle: PropsTypes.object, dialogClass: PropsTypes.string, closeIcon: PropsTypes.any, forceRender: PropsTypes.looseBool, getOpenCount: PropsTypes.func, focusTriggerAfterClose: PropsTypes.looseBool, onClose: PropsTypes.func }; } var IDialogPropTypes$2 = IDialogPropTypes$3(); var uuid$1 = 0; function noop$9() { } function getScroll$2(w2, top) { var ret = w2["page".concat(top ? "Y" : "X", "Offset")]; var method3 = "scroll".concat(top ? "Top" : "Left"); if (typeof ret !== "number") { var d2 = w2.document; ret = d2.documentElement[method3]; if (typeof ret !== "number") { ret = d2.body[method3]; } } return ret; } function setTransformOrigin(node, value24) { var style = node.style; ["Webkit", "Moz", "Ms", "ms"].forEach(function(prefix) { style["".concat(prefix, "TransformOrigin")] = value24; }); style["transformOrigin"] = value24; } function offset(el) { var rect = el.getBoundingClientRect(); var pos = { left: rect.left, top: rect.top }; var doc = el.ownerDocument; var w2 = doc.defaultView || doc.parentWindow; pos.left += getScroll$2(w2); pos.top += getScroll$2(w2, true); return pos; } var cacheOverflow$1 = {}; var Dialog = defineComponent({ name: "VcDialog", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$2(IDialogPropTypes$2, { mask: true, visible: false, keyboard: true, closable: true, maskClosable: true, destroyOnClose: false, prefixCls: "rc-dialog", getOpenCount: function getOpenCount() { return null; }, focusTriggerAfterClose: true }), data: function data37() { warning$5(!this.dialogClass, "Modal", "dialogClass is deprecated, please use class instead."); warning$5(!this.dialogStyle, "Modal", "dialogStyle is deprecated, please use style instead."); return { inTransition: false, titleId: "rcDialogTitle".concat(uuid$1++), dialogMouseDown: void 0 }; }, watch: { visible: function visible4(val) { var _this = this; this.$nextTick(function() { _this.updatedCallback(!val); }); } }, created: function created11() { provide("dialogContext", this); }, mounted: function mounted20() { var _this2 = this; this.$nextTick(function() { _this2.updatedCallback(false); if ((_this2.forceRender || _this2.getContainer === false && !_this2.visible) && _this2.$refs.wrap) { _this2.$refs.wrap.style.display = "none"; } }); }, beforeUnmount: function beforeUnmount11() { var visible9 = this.visible, getOpenCount2 = this.getOpenCount; if ((visible9 || this.inTransition) && !getOpenCount2()) { this.switchScrollingEffect(); } clearTimeout(this.timeoutId); }, methods: { getDialogWrap: function getDialogWrap() { return this.$refs.wrap; }, updatedCallback: function updatedCallback(visible9) { var mousePosition2 = this.mousePosition; var mask = this.mask, focusTriggerAfterClose = this.focusTriggerAfterClose; if (this.visible) { if (!visible9) { this.openTime = Date.now(); this.switchScrollingEffect(); this.tryFocus(); var dialogNode = findDOMNode(this.$refs.dialog); if (mousePosition2) { var elOffset = offset(dialogNode); setTransformOrigin(dialogNode, "".concat(mousePosition2.x - elOffset.left, "px ").concat(mousePosition2.y - elOffset.top, "px")); } else { setTransformOrigin(dialogNode, ""); } } } else if (visible9) { this.inTransition = true; if (mask && this.lastOutSideFocusNode && focusTriggerAfterClose) { try { this.lastOutSideFocusNode.focus(); } catch (e2) { this.lastOutSideFocusNode = null; } this.lastOutSideFocusNode = null; } } }, tryFocus: function tryFocus() { if (!contains(this.$refs.wrap, document.activeElement)) { this.lastOutSideFocusNode = document.activeElement; this.$refs.sentinelStart.focus(); } }, onAnimateLeave: function onAnimateLeave() { var afterClose = this.afterClose; if (this.$refs.wrap) { this.$refs.wrap.style.display = "none"; } this.inTransition = false; this.switchScrollingEffect(); if (afterClose) { afterClose(); } }, onDialogMouseDown: function onDialogMouseDown() { this.dialogMouseDown = true; }, onMaskMouseUp: function onMaskMouseUp() { var _this3 = this; if (this.dialogMouseDown) { this.timeoutId = setTimeout(function() { _this3.dialogMouseDown = false; }, 0); } }, onMaskClick: function onMaskClick(e2) { if (Date.now() - this.openTime < 300) { return; } if (e2.target === e2.currentTarget && !this.dialogMouseDown) { this.close(e2); } }, onKeydown: function onKeydown(e2) { var props2 = this.$props; if (props2.keyboard && e2.keyCode === KeyCode$1.ESC) { e2.stopPropagation(); this.close(e2); return; } if (props2.visible) { if (e2.keyCode === KeyCode$1.TAB) { var activeElement = document.activeElement; var sentinelStart = this.$refs.sentinelStart; if (e2.shiftKey) { if (activeElement === sentinelStart) { this.$refs.sentinelEnd.focus(); } } else if (activeElement === this.$refs.sentinelEnd) { sentinelStart.focus(); } } } }, getDialogElement: function getDialogElement() { var _this4 = this; var closable = this.closable, prefixCls2 = this.prefixCls, width = this.width, height = this.height, title = this.title, tempFooter = this.footer, bodyStyle = this.bodyStyle, visible9 = this.visible, bodyProps = this.bodyProps, forceRender = this.forceRender, closeIcon = this.closeIcon, _this$dialogStyle = this.dialogStyle, dialogStyle = _this$dialogStyle === void 0 ? {} : _this$dialogStyle, _this$dialogClass = this.dialogClass, dialogClass = _this$dialogClass === void 0 ? "" : _this$dialogClass; var dest = _extends$1({}, dialogStyle); if (width !== void 0) { dest.width = typeof width === "number" ? "".concat(width, "px") : width; } if (height !== void 0) { dest.height = typeof height === "number" ? "".concat(height, "px") : height; } var footer; if (tempFooter) { footer = createVNode("div", { "key": "footer", "class": "".concat(prefixCls2, "-footer"), "ref": "footer" }, [tempFooter]); } var header; if (title) { header = createVNode("div", { "key": "header", "class": "".concat(prefixCls2, "-header"), "ref": "header" }, [createVNode("div", { "class": "".concat(prefixCls2, "-title"), "id": this.titleId }, [title])]); } var closer; if (closable) { closer = createVNode("button", { "type": "button", "key": "close", "onClick": this.close || noop$9, "aria-label": "Close", "class": "".concat(prefixCls2, "-close") }, [closeIcon || createVNode("span", { "class": "".concat(prefixCls2, "-close-x") }, null)]); } var _this$$attrs = this.$attrs, stl = _this$$attrs.style, className = _this$$attrs.class; var style = _extends$1(_extends$1({}, stl), dest); var sentinelStyle = { width: 0, height: 0, overflow: "hidden" }; var cls = [prefixCls2, className, dialogClass]; var transitionName2 = this.getTransitionName(); var dialogElement = withDirectives(createVNode(LazyRenderBox, { "key": "dialog-element", "role": "document", "ref": "dialog", "style": style, "class": cls, "forceRender": forceRender, "onMousedown": this.onDialogMouseDown }, { default: function _default8() { return [createVNode("div", { "tabindex": 0, "ref": "sentinelStart", "style": sentinelStyle, "aria-hidden": "true" }, null), createVNode("div", { "class": "".concat(prefixCls2, "-content") }, [closer, header, createVNode("div", _objectSpread2$2({ "key": "body", "class": "".concat(prefixCls2, "-body"), "style": bodyStyle, "ref": "body" }, bodyProps), [getSlot$1(_this4)]), footer]), createVNode("div", { "tabindex": 0, "ref": "sentinelEnd", "style": sentinelStyle, "aria-hidden": "true" }, null)]; } }), [[vShow, visible9]]); var dialogTransitionProps = getTransitionProps(transitionName2, { onAfterLeave: this.onAnimateLeave }); return createVNode(Transition, _objectSpread2$2({ "key": "dialog" }, dialogTransitionProps), { default: function _default8() { return [visible9 || !_this4.destroyOnClose ? dialogElement : null]; } }); }, getZIndexStyle: function getZIndexStyle2() { var style = {}; var props2 = this.$props; if (props2.zIndex !== void 0) { style.zIndex = props2.zIndex; } return style; }, getWrapStyle: function getWrapStyle() { return _extends$1(_extends$1({}, this.getZIndexStyle()), this.wrapStyle); }, getMaskStyle: function getMaskStyle() { return _extends$1(_extends$1({}, this.getZIndexStyle()), this.maskStyle); }, getMaskElement: function getMaskElement2() { var props2 = this.$props; var maskElement; if (props2.mask) { var maskTransition = this.getMaskTransitionName(); var tempMaskElement = withDirectives(createVNode(LazyRenderBox, _objectSpread2$2({ "style": this.getMaskStyle(), "key": "mask", "class": "".concat(props2.prefixCls, "-mask") }, props2.maskProps || {}), null), [[vShow, props2.visible]]); if (maskTransition) { var maskTransitionProps = getTransitionProps(maskTransition); maskElement = createVNode(Transition, _objectSpread2$2({ "key": "mask" }, maskTransitionProps), { default: function _default8() { return [tempMaskElement]; } }); } else { maskElement = tempMaskElement; } } return maskElement; }, getMaskTransitionName: function getMaskTransitionName2() { var props2 = this.$props; var transitionName2 = props2.maskTransitionName; var animation2 = props2.maskAnimation; if (!transitionName2 && animation2) { transitionName2 = "".concat(props2.prefixCls, "-").concat(animation2); } return transitionName2; }, getTransitionName: function getTransitionName4() { var props2 = this.$props; var transitionName2 = props2.transitionName; var animation2 = props2.animation; if (!transitionName2 && animation2) { transitionName2 = "".concat(props2.prefixCls, "-").concat(animation2); } return transitionName2; }, switchScrollingEffect: function switchScrollingEffect() { var getOpenCount2 = this.getOpenCount; var openCount2 = getOpenCount2(); if (openCount2 === 1) { if (cacheOverflow$1.hasOwnProperty("overflowX")) { return; } cacheOverflow$1 = { overflowX: document.body.style.overflowX, overflowY: document.body.style.overflowY, overflow: document.body.style.overflow }; _switchScrollingEffect(); document.body.style.overflow = "hidden"; } else if (!openCount2) { if (cacheOverflow$1.overflow !== void 0) { document.body.style.overflow = cacheOverflow$1.overflow; } if (cacheOverflow$1.overflowX !== void 0) { document.body.style.overflowX = cacheOverflow$1.overflowX; } if (cacheOverflow$1.overflowY !== void 0) { document.body.style.overflowY = cacheOverflow$1.overflowY; } cacheOverflow$1 = {}; _switchScrollingEffect(true); } }, close: function close4(e2) { this.__emit("close", e2); } }, render: function render62() { var prefixCls2 = this.prefixCls, maskClosable = this.maskClosable, visible9 = this.visible, wrapClassName = this.wrapClassName, title = this.title, wrapProps = this.wrapProps; var style = this.getWrapStyle(); if (visible9) { style.display = null; } return createVNode("div", { "class": "".concat(prefixCls2, "-root") }, [this.getMaskElement(), createVNode("div", _objectSpread2$2({ "tabindex": -1, "onKeydown": this.onKeydown, "class": "".concat(prefixCls2, "-wrap ").concat(wrapClassName || ""), "ref": "wrap", "onClick": maskClosable ? this.onMaskClick : noop$9, "onMouseup": maskClosable ? this.onMaskMouseUp : noop$9, "role": "dialog", "aria-labelledby": title ? this.titleId : null, "style": style }, wrapProps), [this.getDialogElement()])]); } }); function setStyle(style) { var options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var _options$element = options2.element, element = _options$element === void 0 ? document.body : _options$element; var oldStyle = {}; var styleKeys = Object.keys(style); styleKeys.forEach(function(key2) { oldStyle[key2] = element.style[key2]; }); styleKeys.forEach(function(key2) { element.style[key2] = style[key2]; }); return oldStyle; } var openCount = 0; var windowIsUndefined = !(typeof window !== "undefined" && window.document && window.document.createElement); var cacheOverflow = {}; var Portal = defineComponent({ name: "PortalWrapper", props: { wrapperClassName: PropsTypes.string, forceRender: PropsTypes.looseBool, getContainer: PropsTypes.any, children: PropsTypes.func, visible: PropsTypes.looseBool }, data: function data38() { this._component = null; var visible9 = this.$props.visible; openCount = visible9 ? openCount + 1 : openCount; return {}; }, watch: { visible: function visible5(val) { openCount = val ? openCount + 1 : openCount - 1; }, getContainer: function getContainer3(_getContainer, prevGetContainer) { var getContainerIsFunc = typeof _getContainer === "function" && typeof prevGetContainer === "function"; if (getContainerIsFunc ? _getContainer.toString() !== prevGetContainer.toString() : _getContainer !== prevGetContainer) { this.removeCurrentContainer(false); } } }, updated: function updated10() { this.setWrapperClassName(); }, beforeUnmount: function beforeUnmount12() { var visible9 = this.$props.visible; openCount = visible9 && openCount ? openCount - 1 : openCount; this.removeCurrentContainer(visible9); }, methods: { getParent: function getParent3() { var getContainer5 = this.$props.getContainer; if (getContainer5) { if (typeof getContainer5 === "string") { return document.querySelectorAll(getContainer5)[0]; } if (typeof getContainer5 === "function") { return getContainer5(); } if (_typeof$2(getContainer5) === "object" && getContainer5 instanceof window.HTMLElement) { return getContainer5; } } return document.body; }, getDomContainer: function getDomContainer() { if (windowIsUndefined) { return null; } if (!this.container) { this.container = document.createElement("div"); var parent2 = this.getParent(); if (parent2) { parent2.appendChild(this.container); } } this.setWrapperClassName(); return this.container; }, setWrapperClassName: function setWrapperClassName() { var wrapperClassName = this.$props.wrapperClassName; if (this.container && wrapperClassName && wrapperClassName !== this.container.className) { this.container.className = wrapperClassName; } }, savePortal: function savePortal(c2) { this._component = c2; }, removeCurrentContainer: function removeCurrentContainer() { this.container = null; this._component = null; }, switchScrollingEffect: function switchScrollingEffect2() { if (openCount === 1 && !Object.keys(cacheOverflow).length) { _switchScrollingEffect(); cacheOverflow = setStyle({ overflow: "hidden", overflowX: "hidden", overflowY: "hidden" }); } else if (!openCount) { setStyle(cacheOverflow); cacheOverflow = {}; _switchScrollingEffect(true); } } }, render: function render63() { var _this$$props = this.$props, children = _this$$props.children, forceRender = _this$$props.forceRender, visible9 = _this$$props.visible; var portal = null; var childProps = { getOpenCount: function getOpenCount2() { return openCount; }, getContainer: this.getDomContainer, switchScrollingEffect: this.switchScrollingEffect }; if (forceRender || visible9 || this._component) { portal = createVNode(Portal$1, { "getContainer": this.getDomContainer, "children": children(childProps), "ref": this.savePortal }, null); } return portal; } }); var IDialogPropTypes$1 = IDialogPropTypes$3(); var DialogWrap = defineComponent({ inheritAttrs: false, props: _extends$1(_extends$1({}, IDialogPropTypes$1), { visible: IDialogPropTypes$1.visible.def(false) }), render: function render64() { var _this = this; var _this$$props = this.$props, visible9 = _this$$props.visible, getContainer5 = _this$$props.getContainer, forceRender = _this$$props.forceRender; var dialogProps = _extends$1(_extends$1(_extends$1({}, this.$props), this.$attrs), { ref: "_component", key: "dialog" }); if (getContainer5 === false) { return createVNode(Dialog, _objectSpread2$2(_objectSpread2$2({}, dialogProps), {}, { "getOpenCount": function getOpenCount2() { return 2; } }), { default: function _default8() { return [getSlot$1(_this)]; } }); } return createVNode(Portal, { "visible": visible9, "forceRender": forceRender, "getContainer": getContainer5, "children": function children(childProps) { dialogProps = _extends$1(_extends$1({}, dialogProps), childProps); return createVNode(Dialog, dialogProps, { default: function _default8() { return [getSlot$1(_this)]; } }); } }, null); } }); var DialogWrap$1 = DialogWrap; function useFrameSetState(initial) { var frame = ref(null); var state = reactive(_extends$1({}, initial)); var queue = ref([]); var setFrameState = function setFrameState2(newState) { if (frame.value === null) { queue.value = []; frame.value = wrapperRaf(function() { var memoState; queue.value.forEach(function(queueState) { memoState = _extends$1(_extends$1({}, memoState), queueState); }); _extends$1(state, memoState); frame.value = null; }); } queue.value.push(newState); }; onMounted(function() { frame.value && wrapperRaf.cancel(frame.value); }); return [state, setFrameState]; } function fixPoint(key2, start, width, clientWidth) { var startAddWidth = start + width; var offsetStart = (width - clientWidth) / 2; if (width > clientWidth) { if (start > 0) { return _defineProperty$12({}, key2, offsetStart); } if (start < 0 && startAddWidth < clientWidth) { return _defineProperty$12({}, key2, -offsetStart); } } else if (start < 0 || startAddWidth > clientWidth) { return _defineProperty$12({}, key2, start < 0 ? offsetStart : -offsetStart); } return {}; } function getFixScaleEleTransPosition(width, height, left, top) { var _getClientSize = getClientSize(), clientWidth = _getClientSize.width, clientHeight = _getClientSize.height; var fixPos = null; if (width <= clientWidth && height <= clientHeight) { fixPos = { x: 0, y: 0 }; } else if (width > clientWidth || height > clientHeight) { fixPos = _extends$1(_extends$1({}, fixPoint("x", left, width, clientWidth)), fixPoint("y", top, height, clientHeight)); } return fixPos; } var previewGroupContext = Symbol("previewGroupContext"); var context = { provide: function provide$1(val) { provide(previewGroupContext, val); }, inject: function inject$1() { return inject(previewGroupContext, { isPreviewGroup: ref(false), previewUrls: reactive({}), setPreviewUrls: function setPreviewUrls() { }, current: ref(null), setCurrent: function setCurrent() { }, setShowPreview: function setShowPreview() { }, setMousePosition: function setMousePosition() { }, registerImage: null }); } }; var Group = defineComponent({ name: "PreviewGroup", inheritAttrs: false, props: { previewPrefixCls: String }, setup: function setup72(props2, _ref) { var slots = _ref.slots; var previewUrls = reactive({}); var current2 = ref(); var isShowPreview = ref(false); var mousePosition2 = ref(null); var setPreviewUrls = function setPreviewUrls2(val) { _extends$1(previewUrls, val); }; var setCurrent = function setCurrent2(val) { current2.value = val; }; var setMousePosition = function setMousePosition2(val) { mousePosition2.value = val; }; var setShowPreview = function setShowPreview2(val) { isShowPreview.value = val; }; var registerImage = function registerImage2(id2, url2) { previewUrls[id2] = url2; return function() { delete previewUrls[id2]; }; }; var onPreviewClose = function onPreviewClose2(e2) { e2 === null || e2 === void 0 ? void 0 : e2.stopPropagation(); isShowPreview.value = false; mousePosition2.value = null; }; context.provide({ isPreviewGroup: ref(true), previewUrls, setPreviewUrls, current: current2, setCurrent, setShowPreview, setMousePosition, registerImage }); return function() { return createVNode(Fragment, null, [slots.default && slots.default(), createVNode(Preview$1, { "ria-hidden": !isShowPreview.value, "visible": isShowPreview.value, "prefixCls": props2.previewPrefixCls, "onClose": onPreviewClose, "mousePosition": mousePosition2.value, "src": previewUrls[current2.value] }, null)]); }; } }); var PreviewGroup$1 = Group; var IDialogPropTypes = IDialogPropTypes$3(); var initialPosition = { x: 0, y: 0 }; var PreviewType = _extends$1({ src: PropsTypes.string, alt: PropsTypes.string }, IDialogPropTypes); var Preview = defineComponent({ name: "Preview", inheritAttrs: false, props: PreviewType, emits: ["close", "afterClose"], setup: function setup73(props2, _ref) { var emit2 = _ref.emit, attrs = _ref.attrs; var scale = ref(1); var rotate = ref(0); var _useFrameSetState = useFrameSetState(initialPosition), _useFrameSetState2 = _slicedToArray$4(_useFrameSetState, 2), position2 = _useFrameSetState2[0], setPosition = _useFrameSetState2[1]; var onClose = function onClose2() { return emit2("close"); }; var imgRef = ref(); var originPositionRef = reactive({ originX: 0, originY: 0, deltaX: 0, deltaY: 0 }); var isMoving = ref(false); var groupContext = context.inject(); var previewUrls = groupContext.previewUrls, current2 = groupContext.current, isPreviewGroup = groupContext.isPreviewGroup, setCurrent = groupContext.setCurrent; var previewGroupCount = computed(function() { return Object.keys(previewUrls).length; }); var previewUrlsKeys = computed(function() { return Object.keys(previewUrls); }); var currentPreviewIndex = computed(function() { return previewUrlsKeys.value.indexOf(String(current2.value)); }); var combinationSrc = computed(function() { return isPreviewGroup.value ? previewUrls[current2.value] : props2.src; }); var showLeftOrRightSwitches = computed(function() { return isPreviewGroup.value && previewGroupCount.value > 1; }); var onAfterClose = function onAfterClose2() { scale.value = 1; rotate.value = 0; setPosition(initialPosition); }; var onZoomIn = function onZoomIn2() { scale.value++; setPosition(initialPosition); }; var onZoomOut = function onZoomOut2() { if (scale.value > 1) { scale.value--; } setPosition(initialPosition); }; var onRotateRight = function onRotateRight2() { rotate.value += 90; }; var onRotateLeft = function onRotateLeft2() { rotate.value -= 90; }; var onSwitchLeft = function onSwitchLeft2(event) { event.preventDefault(); event.stopPropagation(); if (currentPreviewIndex.value > 0) { setCurrent(previewUrlsKeys.value[String(currentPreviewIndex.value - 1)]); } }; var onSwitchRight = function onSwitchRight2(event) { event.preventDefault(); event.stopPropagation(); if (currentPreviewIndex.value < previewGroupCount.value - 1) { setCurrent(previewUrlsKeys.value[String(currentPreviewIndex.value + 1)]); } }; var wrapClassName = classNames(_defineProperty$12({}, "".concat(props2.prefixCls, "-moving"), isMoving.value)); var toolClassName = "".concat(props2.prefixCls, "-operations-operation"); var iconClassName = "".concat(props2.prefixCls, "-operations-icon"); var tools = [{ icon: CloseOutlined$3, onClick: onClose, type: "close" }, { icon: ZoomInOutlined$1, onClick: onZoomIn, type: "zoomIn" }, { icon: ZoomOutOutlined$1, onClick: onZoomOut, type: "zoomOut", disabled: computed(function() { return scale.value === 1; }) }, { icon: RotateRightOutlined$1, onClick: onRotateRight, type: "rotateRight" }, { icon: RotateLeftOutlined$1, onClick: onRotateLeft, type: "rotateLeft" }]; var onMouseUp3 = function onMouseUp4() { if (props2.visible && isMoving.value) { var width = imgRef.value.offsetWidth * scale.value; var height = imgRef.value.offsetHeight * scale.value; var _getOffset = getOffset$1(imgRef.value), left = _getOffset.left, top = _getOffset.top; var isRotate = rotate.value % 180 !== 0; isMoving.value = false; var fixState = getFixScaleEleTransPosition(isRotate ? height : width, isRotate ? width : height, left, top); if (fixState) { setPosition(_extends$1({}, fixState)); } } }; var onMouseDown3 = function onMouseDown4(event) { event.preventDefault(); event.stopPropagation(); originPositionRef.deltaX = event.pageX - position2.x; originPositionRef.deltaY = event.pageY - position2.y; originPositionRef.originX = position2.x; originPositionRef.originY = position2.y; isMoving.value = true; }; var onMouseMove3 = function onMouseMove4(event) { if (props2.visible && isMoving.value) { setPosition({ x: event.pageX - originPositionRef.deltaX, y: event.pageY - originPositionRef.deltaY }); } }; var removeListeners = function removeListeners2() { }; onMounted(function() { watch([function() { return props2.visible; }, isMoving], function() { removeListeners(); var onTopMouseUpListener; var onTopMouseMoveListener; var onMouseUpListener = addEventListenerWrap(window, "mouseup", onMouseUp3, false); var onMouseMoveListener = addEventListenerWrap(window, "mousemove", onMouseMove3, false); try { if (window.top !== window.self) { onTopMouseUpListener = addEventListenerWrap(window.top, "mouseup", onMouseUp3, false); onTopMouseMoveListener = addEventListenerWrap(window.top, "mousemove", onMouseMove3, false); } } catch (error3) { } removeListeners = function removeListeners2() { onMouseUpListener.remove(); onMouseMoveListener.remove(); if (onTopMouseUpListener) onTopMouseUpListener.remove(); if (onTopMouseMoveListener) onTopMouseMoveListener.remove(); }; }, { flush: "post", immediate: true }); }); onUnmounted(function() { removeListeners(); }); return function() { return createVNode(DialogWrap$1, _objectSpread2$2(_objectSpread2$2({}, attrs), {}, { "transitionName": "zoom", "maskTransitionName": "fade", "closable": false, "keyboard": true, "prefixCls": props2.prefixCls, "onClose": onClose, "afterClose": onAfterClose, "visible": props2.visible, "wrapClassName": wrapClassName, "getContainer": props2.getContainer }), { default: function _default8() { return [createVNode("ul", { "class": "".concat(props2.prefixCls, "-operations") }, [tools.map(function(_ref2) { var IconType = _ref2.icon, onClick7 = _ref2.onClick, type2 = _ref2.type, disabled = _ref2.disabled; return createVNode("li", { "class": classNames(toolClassName, _defineProperty$12({}, "".concat(props2.prefixCls, "-operations-operation-disabled"), disabled && (disabled === null || disabled === void 0 ? void 0 : disabled.value))), "onClick": onClick7, "key": type2 }, [createVNode(IconType, { "class": iconClassName }, null)]); })]), createVNode("div", { "class": "".concat(props2.prefixCls, "-img-wrapper"), "style": { transform: "translate3d(".concat(position2.x, "px, ").concat(position2.y, "px, 0)") } }, [createVNode("img", { "onMousedown": onMouseDown3, "ref": imgRef, "class": "".concat(props2.prefixCls, "-img"), "src": combinationSrc.value, "alt": props2.alt, "style": { transform: "scale3d(".concat(scale.value, ", ").concat(scale.value, ", 1) rotate(").concat(rotate.value, "deg)") } }, null)]), showLeftOrRightSwitches.value && createVNode("div", { "class": classNames("".concat(props2.prefixCls, "-switch-left"), _defineProperty$12({}, "".concat(props2.prefixCls, "-switch-left-disabled"), currentPreviewIndex.value <= 0)), "onClick": onSwitchLeft }, [createVNode(LeftOutlined$3, null, null)]), showLeftOrRightSwitches.value && createVNode("div", { "class": classNames("".concat(props2.prefixCls, "-switch-right"), _defineProperty$12({}, "".concat(props2.prefixCls, "-switch-right-disabled"), currentPreviewIndex.value >= previewGroupCount.value - 1)), "onClick": onSwitchRight }, [createVNode(RightOutlined$3, null, null)])]; } }); }; } }); var Preview$1 = Preview; var imageProps = { src: PropsTypes.string, wrapperClassName: PropsTypes.string, wrapperStyle: PropsTypes.style, prefixCls: PropsTypes.string, previewPrefixCls: PropsTypes.string, placeholder: PropsTypes.VNodeChild, fallback: PropsTypes.string, preview: PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.shape({ visible: PropsTypes.bool, onVisibleChange: PropsTypes.func, getContainer: PropsTypes.oneOfType([PropsTypes.func, PropsTypes.looseBool, PropsTypes.string]) }).loose]).def(true) }; var mergeDefaultValue = function mergeDefaultValue2(obj, defaultValues) { var res = _extends$1({}, obj); Object.keys(defaultValues).forEach(function(key2) { if (obj[key2] === void 0) { res[key2] = defaultValues[key2]; } }); return res; }; var uuid = 0; var ImageInternal = defineComponent({ name: "Image", mixins: [BaseMixin], inheritAttrs: false, props: imageProps, emits: ["click"], setup: function setup74(props2, _ref) { var attrs = _ref.attrs, slots = _ref.slots, emit2 = _ref.emit; var prefixCls2 = computed(function() { return props2.prefixCls; }); var previewPrefixCls = computed(function() { return "".concat(prefixCls2.value, "-preview"); }); var preview = computed(function() { var defaultValues = { visible: void 0, onVisibleChange: function onVisibleChange6() { }, getContainer: void 0 }; return _typeof$2(props2.preview) === "object" ? mergeDefaultValue(props2.preview, defaultValues) : defaultValues; }); var isCustomPlaceholder = computed(function() { return props2.placeholder && props2.placeholder !== true || slots.placeholder; }); var previewVisible = computed(function() { return preview.value.visible; }); var onPreviewVisibleChange = computed(function() { return preview.value.onVisibleChange; }); var getPreviewContainer = computed(function() { return preview.value.getContainer; }); var isControlled = computed(function() { return previewVisible.value !== void 0; }); var isShowPreview = ref(!!previewVisible.value); watch(previewVisible, function() { isShowPreview.value = !!previewVisible.value; }); watch(isShowPreview, function(val, preVal) { onPreviewVisibleChange.value(val, preVal); }); var status = ref(isCustomPlaceholder.value ? "loading" : "normal"); watch(function() { return props2.src; }, function() { status.value = isCustomPlaceholder.value ? "loading" : "normal"; }); var mousePosition2 = ref(null); var isError2 = computed(function() { return status.value === "error"; }); var groupContext = context.inject(); var isPreviewGroup = groupContext.isPreviewGroup, setCurrent = groupContext.setCurrent, setGroupShowPreview = groupContext.setShowPreview, setGroupMousePosition = groupContext.setMousePosition, registerImage = groupContext.registerImage; var currentId = ref(uuid++); var canPreview = computed(function() { return props2.preview && !isError2.value; }); var onLoad3 = function onLoad4() { status.value = "normal"; }; var onError2 = function onError3() { status.value = "error"; }; var onPreview = function onPreview2(e2) { if (!isControlled.value) { var _getOffset = getOffset$1(e2.target), left = _getOffset.left, top = _getOffset.top; if (isPreviewGroup.value) { setCurrent(currentId.value); setGroupMousePosition({ x: left, y: top }); } else { mousePosition2.value = { x: left, y: top }; } } if (isPreviewGroup.value) { setGroupShowPreview(true); } else { isShowPreview.value = true; } emit2("click", e2); }; var onPreviewClose = function onPreviewClose2() { isShowPreview.value = false; if (!isControlled.value) { mousePosition2.value = null; } }; var img = ref(null); watch(function() { return img; }, function() { if (status.value !== "loading") return; if (img.value.complete && (img.value.naturalWidth || img.value.naturalHeight)) { onLoad3(); } }); var unRegister = function unRegister2() { }; onMounted(function() { watch([function() { return props2.src; }, canPreview], function() { unRegister(); if (!isPreviewGroup.value) { return function() { }; } unRegister = registerImage(currentId.value, props2.src); if (!canPreview.value) { unRegister(); } }, { flush: "post", immediate: true }); }); var toSizePx = function toSizePx2(l2) { if (isNumber$2(l2)) return l2 + "px"; return l2; }; return function() { var prefixCls3 = props2.prefixCls, wrapperClassName = props2.wrapperClassName, fallback = props2.fallback, src2 = props2.src, preview2 = props2.preview, placeholder = props2.placeholder, wrapperStyle = props2.wrapperStyle; var width = attrs.width, height = attrs.height, crossorigin = attrs.crossorigin, decoding = attrs.decoding, alt = attrs.alt, sizes = attrs.sizes, srcset = attrs.srcset, usemap = attrs.usemap, cls = attrs.class, style = attrs.style; var wrappperClass = classNames(prefixCls3, wrapperClassName, _defineProperty$12({}, "".concat(prefixCls3, "-error"), isError2.value)); var mergedSrc = isError2.value && fallback ? fallback : src2; var previewMask = slots.previewMask && slots.previewMask(); var imgCommonProps = { crossorigin, decoding, alt, sizes, srcset, usemap, class: classNames("".concat(prefixCls3, "-img"), _defineProperty$12({}, "".concat(prefixCls3, "-img-placeholder"), placeholder === true), cls), style: _extends$1({ height }, style) }; return createVNode(Fragment, null, [createVNode("div", { "class": wrappperClass, "onClick": preview2 && !isError2.value ? onPreview : function(e2) { emit2("click", e2); }, "style": _extends$1({ width: toSizePx(width), height: toSizePx(height) }, wrapperStyle) }, [createVNode("img", _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({}, imgCommonProps), isError2.value && fallback ? { src: fallback } : { onLoad: onLoad3, onError: onError2, src: src2 }), {}, { "ref": img }), null), status.value === "loading" && createVNode("div", { "aria-hidden": "true", "class": "".concat(prefixCls3, "-placeholder") }, [placeholder || slots.placeholder && slots.placeholder()]), previewMask && canPreview.value && createVNode("div", { "class": "".concat(prefixCls3, "-mask") }, [previewMask])]), !isPreviewGroup.value && canPreview.value && createVNode(Preview$1, { "aria-hidden": !isShowPreview.value, "visible": isShowPreview.value, "prefixCls": previewPrefixCls.value, "onClose": onPreviewClose, "mousePosition": mousePosition2.value, "src": mergedSrc, "alt": alt, "getContainer": getPreviewContainer.value }, null)]); }; } }); ImageInternal.PreviewGroup = PreviewGroup$1; var Image$3 = ImageInternal; var InternalPreviewGroup = defineComponent({ name: "AImagePreviewGroup", inheritAttrs: false, props: { previewPrefixCls: PropsTypes.string }, setup: function setup75(props2, _ref) { var attrs = _ref.attrs, slots = _ref.slots; var configProvider = inject("configProvider", defaultConfigProvider); var prefixCls2 = computed(function() { return configProvider.getPrefixCls("image-preview", props2.previewPrefixCls); }); return function() { return createVNode(PreviewGroup$1, _objectSpread2$2(_objectSpread2$2({}, _extends$1(_extends$1({}, attrs), props2)), {}, { "previewPrefixCls": prefixCls2.value }), slots); }; } }); var PreviewGroup = InternalPreviewGroup; var Image$1 = defineComponent({ name: "AImage", inheritAttrs: false, props: imageProps, setup: function setup76(props2, _ref) { var slots = _ref.slots, attrs = _ref.attrs; var _useConfigInject = useConfigInject("image", props2), prefixCls2 = _useConfigInject.prefixCls; return function() { return createVNode(Image$3, _extends$1(_extends$1(_extends$1({}, attrs), props2), { prefixCls: prefixCls2.value }), slots); }; } }); Image$1.PreviewGroup = PreviewGroup; Image$1.install = function(app) { app.component(Image$1.name, Image$1); app.component(Image$1.PreviewGroup.name, Image$1.PreviewGroup); return app; }; var Image$2 = Image$1; var ITouchProps = { disabled: PropsTypes.looseBool, activeClassName: PropsTypes.string, activeStyle: PropsTypes.any }; var TouchFeedback = defineComponent({ name: "TouchFeedback", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$2(ITouchProps, { disabled: false }), data: function data39() { this.child = null; return { active: false }; }, mounted: function mounted21() { var _this = this; this.$nextTick(function() { if (_this.disabled && _this.active) { _this.setState({ active: false }); } }); }, methods: { triggerEvent: function triggerEvent(type2, isActive, ev) { var eventType = "on".concat(type2); var child = this.child; if (child.props[eventType]) { child.props[eventType](ev); } if (isActive !== this.active) { this.setState({ active: isActive }); } }, onTouchStart: function onTouchStart(e2) { this.triggerEvent("Touchstart", true, e2); }, onTouchMove: function onTouchMove(e2) { this.triggerEvent("Touchmove", false, e2); }, onTouchEnd: function onTouchEnd2(e2) { this.triggerEvent("Touchend", false, e2); }, onTouchCancel: function onTouchCancel(e2) { this.triggerEvent("Touchcancel", false, e2); }, onMouseDown: function onMouseDown2(e2) { this.triggerEvent("Mousedown", true, e2); }, onMouseUp: function onMouseUp2(e2) { this.triggerEvent("Mouseup", false, e2); }, onMouseLeave: function onMouseLeave2(e2) { this.triggerEvent("Mouseleave", false, e2); } }, render: function render65() { var _ref; var _this$$props = this.$props, disabled = _this$$props.disabled, _this$$props$activeCl = _this$$props.activeClassName, activeClassName = _this$$props$activeCl === void 0 ? "" : _this$$props$activeCl, _this$$props$activeSt = _this$$props.activeStyle, activeStyle = _this$$props$activeSt === void 0 ? {} : _this$$props$activeSt; var child = getSlot$1(this); if (child.length !== 1) { warning$5(false, "m-feedback\u7EC4\u4EF6\u53EA\u80FD\u5305\u542B\u4E00\u4E2A\u5B50\u5143\u7D20"); return null; } var events = disabled ? void 0 : (_ref = {}, _defineProperty$12(_ref, supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart", this.onTouchStart), _defineProperty$12(_ref, supportsPassive$1 ? "onTouchmovePassive" : "onTouchmove", this.onTouchMove), _defineProperty$12(_ref, "onTouchend", this.onTouchEnd), _defineProperty$12(_ref, "onTouchcancel", this.onTouchCancel), _defineProperty$12(_ref, "onMousedown", this.onMouseDown), _defineProperty$12(_ref, "onMouseup", this.onMouseUp), _defineProperty$12(_ref, "onMouseleave", this.onMouseLeave), _ref); child = child[0]; this.child = child; if (!disabled && this.active) { var _child$props = child.props, style = _child$props.style, className = _child$props.class; if (activeStyle !== false) { if (activeStyle) { style = _extends$1(_extends$1({}, style), activeStyle); } className = classNames(className, activeClassName); } return cloneElement(child, _extends$1({ class: className, style }, events)); } return cloneElement(child, events); } }); var InputHandler = { name: "InputHandler", inheritAttrs: false, props: { prefixCls: PropsTypes.string, disabled: PropsTypes.looseBool }, render: function render66() { var _this = this; var _this$$props = this.$props, prefixCls2 = _this$$props.prefixCls, disabled = _this$$props.disabled; var touchableProps = { disabled, activeClassName: "".concat(prefixCls2, "-handler-active") }; return createVNode(TouchFeedback, touchableProps, { default: function _default8() { return [createVNode("span", _this.$attrs, [getSlot$1(_this)])]; } }); } }; var InputHandler$1 = InputHandler; function preventDefault(e2) { e2.preventDefault(); } function defaultParser(input) { return input.replace(/[^\w\.-]+/g, ""); } var SPEED = 200; var DELAY = 600; var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; var isValidProps = function isValidProps2(value24) { return value24 !== void 0 && value24 !== null; }; var isEqual = function isEqual2(oldValue, newValue) { return newValue === oldValue || typeof newValue === "number" && typeof oldValue === "number" && isNaN(newValue) && isNaN(oldValue); }; var inputNumberProps$1 = { value: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), defaultValue: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), focusOnUpDown: PropsTypes.looseBool, autofocus: PropsTypes.looseBool, prefixCls: PropsTypes.string, tabindex: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), placeholder: PropsTypes.string, disabled: PropsTypes.looseBool, readonly: PropsTypes.looseBool, max: PropsTypes.number, min: PropsTypes.number, step: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), upHandler: PropsTypes.any, downHandler: PropsTypes.any, useTouch: PropsTypes.looseBool, formatter: PropsTypes.func, parser: PropsTypes.func, precision: PropsTypes.number, required: PropsTypes.looseBool, pattern: PropsTypes.string, decimalSeparator: PropsTypes.string, autocomplete: PropsTypes.string, title: PropsTypes.string, name: PropsTypes.string, id: PropsTypes.string, type: PropsTypes.string, maxlength: PropsTypes.any }; var VcInputNumber = defineComponent({ name: "VCInputNumber", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$2(inputNumberProps$1, { focusOnUpDown: true, useTouch: false, prefixCls: "rc-input-number", min: -MAX_SAFE_INTEGER, step: 1, parser: defaultParser, required: false, autocomplete: "off" }), data: function data40() { var props2 = getOptionProps(this); this.prevProps = _extends$1({}, props2); var value24; if ("value" in props2) { value24 = this.value; } else { value24 = this.defaultValue; } var validValue = this.getValidValue(this.toNumber(value24)); return { inputValue: this.toPrecisionAsStep(validValue), sValue: validValue, focused: this.autofocus }; }, mounted: function mounted22() { var _this = this; this.$nextTick(function() { _this.updatedFunc(); }); }, updated: function updated11() { var _this2 = this; var _this$$props = this.$props, value24 = _this$$props.value, max4 = _this$$props.max, min4 = _this$$props.min; var focused = this.$data.focused; var prevProps = this.prevProps; var props2 = getOptionProps(this); if (prevProps) { if (!isEqual(prevProps.value, value24) || !isEqual(prevProps.max, max4) || !isEqual(prevProps.min, min4)) { var validValue = focused ? value24 : this.getValidValue(value24); var nextInputValue; if (this.pressingUpOrDown) { nextInputValue = validValue; } else if (this.inputting) { nextInputValue = this.rawInput; } else { nextInputValue = this.toPrecisionAsStep(validValue); } this.setState({ sValue: validValue, inputValue: nextInputValue }); } var nextValue = "value" in props2 ? value24 : this.$data.sValue; if ("max" in props2 && prevProps.max !== max4 && typeof nextValue === "number" && nextValue > max4) { this.__emit("update:value", max4); this.__emit("change", max4); } if ("min" in props2 && prevProps.min !== min4 && typeof nextValue === "number" && nextValue < min4) { this.__emit("update:value", min4); this.__emit("change", min4); } } this.prevProps = _extends$1({}, props2); this.$nextTick(function() { _this2.updatedFunc(); }); }, beforeUnmount: function beforeUnmount13() { this.stop(); }, methods: { updatedFunc: function updatedFunc() { var inputElem = this.inputRef; try { if (this.cursorStart !== void 0 && this.$data.focused) { if (!this.partRestoreByAfter(this.cursorAfter) && this.$data.sValue !== this.value) { var pos = this.cursorStart + 1; if (!this.cursorAfter) { pos = inputElem.value.length; } else if (this.lastKeyCode === KeyCode$1.BACKSPACE) { pos = this.cursorStart - 1; } else if (this.lastKeyCode === KeyCode$1.DELETE) { pos = this.cursorStart; } this.fixCaret(pos, pos); } else if (this.currentValue === inputElem.value) { switch (this.lastKeyCode) { case KeyCode$1.BACKSPACE: this.fixCaret(this.cursorStart - 1, this.cursorStart - 1); break; case KeyCode$1.DELETE: this.fixCaret(this.cursorStart + 1, this.cursorStart + 1); break; default: } } } } catch (e2) { } this.lastKeyCode = null; if (!this.pressingUpOrDown) { return; } if (this.focusOnUpDown && this.$data.focused) { if (document.activeElement !== inputElem) { this.focus(); } } this.pressingUpOrDown = false; }, onKeyDown: function onKeyDown9(e2) { if (e2.keyCode === KeyCode$1.UP) { var ratio = this.getRatio(e2); this.up(e2, ratio); this.stop(); } else if (e2.keyCode === KeyCode$1.DOWN) { var _ratio = this.getRatio(e2); this.down(e2, _ratio); this.stop(); } else if (e2.keyCode === KeyCode$1.ENTER) { this.__emit("pressEnter", e2); } this.recordCursorPosition(); this.lastKeyCode = e2.keyCode; for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } this.__emit.apply(this, ["keydown", e2].concat(args)); }, onKeyUp: function onKeyUp(e2) { this.stop(); this.recordCursorPosition(); for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } this.__emit.apply(this, ["keyup", e2].concat(args)); }, onTrigger: function onTrigger(e2) { if (e2.target.composing) return false; this.onChange(e2); }, onChange: function onChange3(e2) { if (this.$data.focused) { this.inputting = true; } this.rawInput = this.parser(this.getValueFromEvent(e2)); this.setState({ inputValue: this.rawInput }); var num = this.toNumber(this.rawInput); this.__emit("update:value", num); this.__emit("change", num); }, onFocus: function onFocus4() { this.setState({ focused: true }); for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } this.__emit.apply(this, ["focus"].concat(args)); }, onBlur: function onBlur5() { this.inputting = false; this.setState({ focused: false }); var value24 = this.getCurrentValidValue(this.$data.inputValue); var newValue = this.setValue(value24); if (this.$attrs.onBlur && this.inputRef) { var originValue = this.inputRef.value; var inputValue = this.getInputDisplayValue({ focused: false, sValue: newValue }); this.inputRef.value = inputValue; for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } this.__emit.apply(this, ["blur"].concat(args)); this.inputRef.value = originValue; } }, getCurrentValidValue: function getCurrentValidValue(value24) { var val = value24; if (val === "") { val = ""; } else if (!this.isNotCompleteNumber(parseFloat(val, 10))) { val = this.getValidValue(val); } else { val = this.$data.sValue; } return this.toNumber(val); }, getRatio: function getRatio(e2) { var ratio = 1; if (e2.metaKey || e2.ctrlKey) { ratio = 0.1; } else if (e2.shiftKey) { ratio = 10; } return ratio; }, getValueFromEvent: function getValueFromEvent(e2) { var value24 = e2.target.value.trim().replace(/。/g, "."); if (isValidProps(this.decimalSeparator)) { value24 = value24.replace(this.decimalSeparator, "."); } return value24; }, getValidValue: function getValidValue(value24) { var min4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.min; var max4 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.max; var val = parseFloat(value24, 10); if (isNaN(val)) { return value24; } if (val < min4) { val = min4; } if (val > max4) { val = max4; } return val; }, setValue: function setValue8(v2, callback2) { var precision = this.$props.precision; var newValue = this.isNotCompleteNumber(parseFloat(v2, 10)) ? null : parseFloat(v2, 10); var _this$$data = this.$data, _this$$data$sValue = _this$$data.sValue, value24 = _this$$data$sValue === void 0 ? null : _this$$data$sValue, _this$$data$inputValu = _this$$data.inputValue, inputValue = _this$$data$inputValu === void 0 ? null : _this$$data$inputValu; var newValueInString = typeof newValue === "number" ? newValue.toFixed(precision) : "".concat(newValue); var changed = newValue !== value24 || newValueInString !== "".concat(inputValue); if (!hasProp(this, "value")) { this.setState({ sValue: newValue, inputValue: this.toPrecisionAsStep(v2) }, callback2); } else { this.setState({ inputValue: this.toPrecisionAsStep(this.$data.sValue) }, callback2); } if (changed) { this.__emit("update:value", newValue); this.__emit("change", newValue); } return newValue; }, getPrecision: function getPrecision2(value24) { if (isValidProps(this.precision)) { return this.precision; } var valueString = value24.toString(); if (valueString.indexOf("e-") >= 0) { return parseInt(valueString.slice(valueString.indexOf("e-") + 2), 10); } var precision = 0; if (valueString.indexOf(".") >= 0) { precision = valueString.length - valueString.indexOf(".") - 1; } return precision; }, getMaxPrecision: function getMaxPrecision(currentValue) { var ratio = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1; if (isValidProps(this.precision)) { return this.precision; } var step = this.step; var ratioPrecision = this.getPrecision(ratio); var stepPrecision = this.getPrecision(step); var currentValuePrecision = this.getPrecision(currentValue); if (!currentValue) { return ratioPrecision + stepPrecision; } return Math.max(currentValuePrecision, ratioPrecision + stepPrecision); }, getPrecisionFactor: function getPrecisionFactor(currentValue) { var ratio = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1; var precision = this.getMaxPrecision(currentValue, ratio); return Math.pow(10, precision); }, getInputDisplayValue: function getInputDisplayValue(state) { var _ref = state || this.$data, focused = _ref.focused, inputValue = _ref.inputValue, sValue = _ref.sValue; var inputDisplayValue; if (focused) { inputDisplayValue = inputValue; } else { inputDisplayValue = this.toPrecisionAsStep(sValue); } if (inputDisplayValue === void 0 || inputDisplayValue === null) { inputDisplayValue = ""; } var inputDisplayValueFormat = this.formatWrapper(inputDisplayValue); if (isValidProps(this.$props.decimalSeparator)) { inputDisplayValueFormat = inputDisplayValueFormat.toString().replace(".", this.$props.decimalSeparator); } return inputDisplayValueFormat; }, recordCursorPosition: function recordCursorPosition() { try { var inputElem = this.inputRef; this.cursorStart = inputElem.selectionStart; this.cursorEnd = inputElem.selectionEnd; this.currentValue = inputElem.value; this.cursorBefore = inputElem.value.substring(0, this.cursorStart); this.cursorAfter = inputElem.value.substring(this.cursorEnd); } catch (e2) { } }, fixCaret: function fixCaret(start, end) { if (start === void 0 || end === void 0 || !this.inputRef || !this.inputRef.value) { return; } try { var inputElem = this.inputRef; var currentStart = inputElem.selectionStart; var currentEnd = inputElem.selectionEnd; if (start !== currentStart || end !== currentEnd) { inputElem.setSelectionRange(start, end); } } catch (e2) { } }, restoreByAfter: function restoreByAfter(str) { if (str === void 0) return false; var fullStr = this.inputRef.value; var index2 = fullStr.lastIndexOf(str); if (index2 === -1) return false; var prevCursorPos = this.cursorBefore.length; if (this.lastKeyCode === KeyCode$1.DELETE && this.cursorBefore.charAt(prevCursorPos - 1) === str[0]) { this.fixCaret(prevCursorPos, prevCursorPos); return true; } if (index2 + str.length === fullStr.length) { this.fixCaret(index2, index2); return true; } return false; }, partRestoreByAfter: function partRestoreByAfter(str) { var _this3 = this; if (str === void 0) return false; return Array.prototype.some.call(str, function(_2, start) { var partStr = str.substring(start); return _this3.restoreByAfter(partStr); }); }, focus: function focus17() { this.inputRef.focus(); this.recordCursorPosition(); }, blur: function blur14() { this.inputRef.blur(); }, formatWrapper: function formatWrapper(num) { if (this.formatter) { return this.formatter(num); } return num; }, toPrecisionAsStep: function toPrecisionAsStep(num) { if (this.isNotCompleteNumber(num) || num === "") { return num; } var precision = Math.abs(this.getMaxPrecision(num)); if (!isNaN(precision)) { return Number(num).toFixed(precision); } return num.toString(); }, isNotCompleteNumber: function isNotCompleteNumber(num) { return isNaN(num) || num === "" || num === null || num && num.toString().indexOf(".") === num.toString().length - 1; }, toNumber: function toNumber2(num) { var _this$$props2 = this.$props, precision = _this$$props2.precision, autofocus = _this$$props2.autofocus; var _this$$data$focused = this.$data.focused, focused = _this$$data$focused === void 0 ? autofocus : _this$$data$focused; var numberIsTooLarge = num && num.length > 16 && focused; if (this.isNotCompleteNumber(num) || numberIsTooLarge) { return num; } if (isValidProps(precision)) { return Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision); } return Number(num); }, upStep: function upStep(val, rat) { var step = this.step; var precisionFactor = this.getPrecisionFactor(val, rat); var precision = Math.abs(this.getMaxPrecision(val, rat)); var result = ((precisionFactor * val + precisionFactor * step * rat) / precisionFactor).toFixed(precision); return this.toNumber(result); }, downStep: function downStep(val, rat) { var step = this.step; var precisionFactor = this.getPrecisionFactor(val, rat); var precision = Math.abs(this.getMaxPrecision(val, rat)); var result = ((precisionFactor * val - precisionFactor * step * rat) / precisionFactor).toFixed(precision); return this.toNumber(result); }, stepFn: function stepFn(type2, e2) { var _this4 = this; var ratio = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1; var recursive = arguments.length > 3 ? arguments[3] : void 0; this.stop(); if (e2) { e2.preventDefault(); } if (this.disabled) { return; } var max4 = this.max, min4 = this.min; var value24 = this.getCurrentValidValue(this.$data.inputValue) || 0; if (this.isNotCompleteNumber(value24)) { return; } var val = this["".concat(type2, "Step")](value24, ratio); var outOfRange = val > max4 || val < min4; if (val > max4) { val = max4; } else if (val < min4) { val = min4; } this.setValue(val); this.setState({ focused: true }); if (outOfRange) { return; } this.autoStepTimer = setTimeout(function() { _this4[type2](e2, ratio, true); }, recursive ? SPEED : DELAY); }, stop: function stop() { if (this.autoStepTimer) { clearTimeout(this.autoStepTimer); } }, down: function down(e2, ratio, recursive) { this.pressingUpOrDown = true; this.stepFn("down", e2, ratio, recursive); }, up: function up(e2, ratio, recursive) { this.pressingUpOrDown = true; this.stepFn("up", e2, ratio, recursive); }, handleInputClick: function handleInputClick2() { this.__emit("click"); }, saveUp: function saveUp(node) { this.upHandlerRef = node; }, saveDown: function saveDown(node) { this.downHandlerRef = node; }, saveInput: function saveInput6(node) { this.inputRef = node; }, onCompositionstart: function onCompositionstart(e2) { e2.target.composing = true; }, onCompositionend: function onCompositionend(e2) { this.onChange(e2); e2.target.composing = false; } }, render: function render67() { var _classNames; var props2 = _extends$1(_extends$1({}, this.$props), this.$attrs); var prefixCls2 = props2.prefixCls, disabled = props2.disabled, readonly2 = props2.readonly, useTouch = props2.useTouch, autocomplete = props2.autocomplete, upHandler = props2.upHandler, downHandler = props2.downHandler, className = props2.class; var classes3 = classNames((_classNames = {}, _defineProperty$12(_classNames, className, className), _defineProperty$12(_classNames, prefixCls2, true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-disabled"), disabled), _defineProperty$12(_classNames, "".concat(prefixCls2, "-focused"), this.$data.focused), _classNames)); var upDisabledClass = ""; var downDisabledClass = ""; var sValue = this.$data.sValue; if (sValue || sValue === 0) { if (!isNaN(sValue)) { var val = Number(sValue); if (val >= this.max) { upDisabledClass = "".concat(prefixCls2, "-handler-up-disabled"); } if (val <= this.min) { downDisabledClass = "".concat(prefixCls2, "-handler-down-disabled"); } } else { upDisabledClass = "".concat(prefixCls2, "-handler-up-disabled"); downDisabledClass = "".concat(prefixCls2, "-handler-down-disabled"); } } var dataOrAriaAttributeProps = {}; for (var key2 in props2) { if (props2.hasOwnProperty(key2) && (key2.substr(0, 5) === "data-" || key2.substr(0, 5) === "aria-" || key2 === "role")) { dataOrAriaAttributeProps[key2] = props2[key2]; } } var editable = !this.readonly && !this.disabled; var inputDisplayValue = this.getInputDisplayValue(); var upEvents; var downEvents; if (useTouch) { var _upEvents, _downEvents; upEvents = (_upEvents = {}, _defineProperty$12(_upEvents, supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart", editable && !upDisabledClass && this.up), _defineProperty$12(_upEvents, "onTouchend", this.stop), _upEvents); downEvents = (_downEvents = {}, _defineProperty$12(_downEvents, supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart", editable && !downDisabledClass && this.down), _defineProperty$12(_downEvents, "onTouchend", this.stop), _downEvents); } else { upEvents = { onMousedown: editable && !upDisabledClass && this.up, onMouseup: this.stop, onMouseleave: this.stop }; downEvents = { onMousedown: editable && !downDisabledClass && this.down, onMouseup: this.stop, onMouseleave: this.stop }; } var isUpDisabled = !!upDisabledClass || disabled || readonly2; var isDownDisabled = !!downDisabledClass || disabled || readonly2; var upHandlerProps = _extends$1(_extends$1({ disabled: isUpDisabled, prefixCls: prefixCls2, unselectable: "unselectable", role: "button", "aria-label": "Increase Value", "aria-disabled": !!isUpDisabled, class: "".concat(prefixCls2, "-handler ").concat(prefixCls2, "-handler-up ").concat(upDisabledClass) }, upEvents), { ref: this.saveUp }); var downHandlerProps = _extends$1(_extends$1({ disabled: isDownDisabled, prefixCls: prefixCls2, unselectable: "unselectable", role: "button", "aria-label": "Decrease Value", "aria-disabled": !!isDownDisabled, class: "".concat(prefixCls2, "-handler ").concat(prefixCls2, "-handler-down ").concat(downDisabledClass) }, downEvents), { ref: this.saveDown }); return createVNode("div", { "class": classes3, "style": props2.style, "title": props2.title, "onMouseenter": props2.onMouseenter, "onMouseleave": props2.onMouseleave, "onMouseover": props2.onMouseover, "onMouseout": props2.onMouseout }, [createVNode("div", { "class": "".concat(prefixCls2, "-handler-wrap") }, [createVNode("span", null, [createVNode(InputHandler$1, _objectSpread2$2(_objectSpread2$2({}, upHandlerProps), {}, { "key": "upHandler" }), { default: function _default8() { return [upHandler || createVNode("span", { "unselectable": "unselectable", "class": "".concat(prefixCls2, "-handler-up-inner"), "onClick": preventDefault }, null)]; } })]), createVNode(InputHandler$1, _objectSpread2$2(_objectSpread2$2({}, downHandlerProps), {}, { "key": "downHandler" }), { default: function _default8() { return [downHandler || createVNode("span", { "unselectable": "unselectable", "class": "".concat(prefixCls2, "-handler-down-inner"), "onClick": preventDefault }, null)]; } })]), createVNode("div", { "class": "".concat(prefixCls2, "-input-wrap") }, [createVNode("input", _objectSpread2$2({ "role": "spinbutton", "aria-valuemin": this.min, "aria-valuemax": this.max, "aria-valuenow": sValue, "required": this.required, "type": props2.type, "placeholder": this.placeholder, "onClick": this.handleInputClick, "class": "".concat(prefixCls2, "-input"), "tabindex": this.tabindex, "autocomplete": autocomplete, "onFocus": this.onFocus, "onBlur": this.onBlur, "onKeydown": editable && this.onKeyDown, "onKeyup": editable && this.onKeyUp, "autofocus": this.autofocus, "maxlength": this.maxlength, "readonly": this.readonly, "disabled": this.disabled, "max": this.max, "min": this.min, "step": this.step, "name": this.name, "title": this.title, "id": this.id, "onInput": this.onTrigger, "onCompositionstart": this.onCompositionstart, "onCompositionend": this.onCompositionend, "ref": this.saveInput, "value": inputDisplayValue, "pattern": this.pattern }, dataOrAriaAttributeProps), null)])]); } }); var __rest$k = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var inputNumberProps = { prefixCls: PropsTypes.string, min: PropsTypes.number, max: PropsTypes.number, value: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), step: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]).def(1), defaultValue: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), tabindex: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), disabled: PropsTypes.looseBool, size: PropsTypes.oneOf(tuple("large", "small", "default")), formatter: PropsTypes.func, parser: PropsTypes.func, decimalSeparator: PropsTypes.string, placeholder: PropsTypes.string, name: PropsTypes.string, id: PropsTypes.string, precision: PropsTypes.number, autofocus: PropsTypes.looseBool, onPressEnter: { type: Function }, onChange: Function }; var InputNumber = defineComponent({ name: "AInputNumber", inheritAttrs: false, props: inputNumberProps, setup: function setup77(props2) { var inputNumberRef = ref(null); var focus25 = function focus26() { inputNumberRef.value.focus(); }; var blur22 = function blur23() { inputNumberRef.value.blur(); }; onMounted(function() { nextTick(function() { }); }); return { configProvider: inject("configProvider", defaultConfigProvider), inputNumberRef, focus: focus25, blur: blur22 }; }, render: function render68() { var _classNames; var _a3 = _extends$1(_extends$1({}, getOptionProps(this)), this.$attrs), customizePrefixCls = _a3.prefixCls, size = _a3.size, className = _a3.class, others = __rest$k(_a3, ["prefixCls", "size", "class"]); var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("input-number", customizePrefixCls); var inputNumberClass = classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-lg"), size === "large"), _defineProperty$12(_classNames, "".concat(prefixCls2, "-sm"), size === "small"), _classNames), className); var upIcon = createVNode(UpOutlined$1, { "class": "".concat(prefixCls2, "-handler-up-inner") }, null); var downIcon = createVNode(DownOutlined$1, { "class": "".concat(prefixCls2, "-handler-down-inner") }, null); var vcInputNumberProps = _extends$1(_extends$1({ prefixCls: prefixCls2, upHandler: upIcon, downHandler: downIcon }, others), { class: inputNumberClass }); return createVNode(VcInputNumber, _objectSpread2$2(_objectSpread2$2({}, vcInputNumberProps), {}, { "ref": "inputNumberRef" }), null); } }); var InputNumber$1 = withInstall(InputNumber); var __rest$j = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var SpinSize = PropsTypes.oneOf(tuple("small", "default", "large")); var getSpinProps = function getSpinProps2() { return { prefixCls: PropsTypes.string, spinning: PropsTypes.looseBool, size: SpinSize, wrapperClassName: PropsTypes.string, tip: PropsTypes.string, delay: PropsTypes.number, indicator: PropsTypes.any }; }; var defaultIndicator = null; function shouldDelay(spinning, delay) { return !!spinning && !!delay && !isNaN(Number(delay)); } function setDefaultIndicator(Content2) { var Indicator = Content2.indicator; defaultIndicator = typeof Indicator === "function" ? Indicator : function() { return createVNode(Indicator, null, null); }; } var Spin = defineComponent({ name: "ASpin", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$1(getSpinProps(), { size: "default", spinning: true, wrapperClassName: "" }), setup: function setup78() { return { originalUpdateSpinning: null, configProvider: inject("configProvider", defaultConfigProvider) }; }, data: function data41() { var spinning = this.spinning, delay = this.delay; var shouldBeDelayed = shouldDelay(spinning, delay); return { sSpinning: spinning && !shouldBeDelayed }; }, created: function created12() { this.originalUpdateSpinning = this.updateSpinning; this.debouncifyUpdateSpinning(this.$props); }, mounted: function mounted23() { this.updateSpinning(); }, updated: function updated12() { var _this = this; nextTick(function() { _this.debouncifyUpdateSpinning(); _this.updateSpinning(); }); }, beforeUnmount: function beforeUnmount14() { this.cancelExistingSpin(); }, methods: { debouncifyUpdateSpinning: function debouncifyUpdateSpinning(props2) { var _ref = props2 || this.$props, delay = _ref.delay; if (delay) { this.cancelExistingSpin(); this.updateSpinning = debounce$1(this.originalUpdateSpinning, delay); } }, updateSpinning: function updateSpinning() { var spinning = this.spinning, sSpinning = this.sSpinning; if (sSpinning !== spinning) { this.setState({ sSpinning: spinning }); } }, cancelExistingSpin: function cancelExistingSpin() { var updateSpinning2 = this.updateSpinning; if (updateSpinning2 && updateSpinning2.cancel) { updateSpinning2.cancel(); } }, renderIndicator: function renderIndicator(prefixCls2) { var dotClassName = "".concat(prefixCls2, "-dot"); var indicator = getComponent(this, "indicator"); if (indicator === null) { return null; } if (Array.isArray(indicator)) { indicator = indicator.length === 1 ? indicator[0] : indicator; } if (isVNode(indicator)) { return cloneVNode(indicator, { class: dotClassName }); } if (defaultIndicator && isVNode(defaultIndicator())) { return cloneVNode(defaultIndicator(), { class: dotClassName }); } return createVNode("span", { "class": "".concat(dotClassName, " ").concat(prefixCls2, "-dot-spin") }, [createVNode("i", { "class": "".concat(prefixCls2, "-dot-item") }, null), createVNode("i", { "class": "".concat(prefixCls2, "-dot-item") }, null), createVNode("i", { "class": "".concat(prefixCls2, "-dot-item") }, null), createVNode("i", { "class": "".concat(prefixCls2, "-dot-item") }, null)]); } }, render: function render69() { var _spinClassName; var _this$$props = this.$props, size = _this$$props.size, customizePrefixCls = _this$$props.prefixCls, tip = _this$$props.tip, wrapperClassName = _this$$props.wrapperClassName; var _a3 = this.$attrs, cls = _a3.class, style = _a3.style, divProps = __rest$j(_a3, ["class", "style"]); var _this$configProvider = this.configProvider, getPrefixCls2 = _this$configProvider.getPrefixCls, direction = _this$configProvider.direction; var prefixCls2 = getPrefixCls2("spin", customizePrefixCls); var sSpinning = this.sSpinning; var spinClassName = (_spinClassName = {}, _defineProperty$12(_spinClassName, prefixCls2, true), _defineProperty$12(_spinClassName, "".concat(prefixCls2, "-sm"), size === "small"), _defineProperty$12(_spinClassName, "".concat(prefixCls2, "-lg"), size === "large"), _defineProperty$12(_spinClassName, "".concat(prefixCls2, "-spinning"), sSpinning), _defineProperty$12(_spinClassName, "".concat(prefixCls2, "-show-text"), !!tip), _defineProperty$12(_spinClassName, "".concat(prefixCls2, "-rtl"), direction === "rtl"), _defineProperty$12(_spinClassName, cls, !!cls), _spinClassName); var spinElement = createVNode("div", _objectSpread2$2(_objectSpread2$2({}, divProps), {}, { "style": style, "class": spinClassName }), [this.renderIndicator(prefixCls2), tip ? createVNode("div", { "class": "".concat(prefixCls2, "-text") }, [tip]) : null]); var children = getSlot$1(this); if (children && children.length) { var _containerClassName; var containerClassName = (_containerClassName = {}, _defineProperty$12(_containerClassName, "".concat(prefixCls2, "-container"), true), _defineProperty$12(_containerClassName, "".concat(prefixCls2, "-blur"), sSpinning), _containerClassName); return createVNode("div", { "class": ["".concat(prefixCls2, "-nested-loading"), wrapperClassName] }, [sSpinning && createVNode("div", { "key": "loading" }, [spinElement]), createVNode("div", { "class": containerClassName, "key": "container" }, [children])]); } return spinElement; } }); Spin.setDefaultIndicator = setDefaultIndicator; Spin.install = function(app) { app.component(Spin.name, Spin); return app; }; var DoubleLeftOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z" } }] }, "name": "double-left", "theme": "outlined" }; var DoubleLeftOutlinedSvg = DoubleLeftOutlined$2; function _objectSpread$y(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$z(target, key2, source2[key2]); }); } return target; } function _defineProperty$z(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var DoubleLeftOutlined = function DoubleLeftOutlined2(props2, context2) { var p = _objectSpread$y({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$y({}, p, { "icon": DoubleLeftOutlinedSvg }), null); }; DoubleLeftOutlined.displayName = "DoubleLeftOutlined"; DoubleLeftOutlined.inheritAttrs = false; var DoubleLeftOutlined$1 = DoubleLeftOutlined; var DoubleRightOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 00188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 00492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z" } }] }, "name": "double-right", "theme": "outlined" }; var DoubleRightOutlinedSvg = DoubleRightOutlined$2; function _objectSpread$x(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$y(target, key2, source2[key2]); }); } return target; } function _defineProperty$y(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var DoubleRightOutlined = function DoubleRightOutlined2(props2, context2) { var p = _objectSpread$x({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$x({}, p, { "icon": DoubleRightOutlinedSvg }), null); }; DoubleRightOutlined.displayName = "DoubleRightOutlined"; DoubleRightOutlined.inheritAttrs = false; var DoubleRightOutlined$1 = DoubleRightOutlined; var MiniSelect = defineComponent({ inheritAttrs: false, props: SelectProps(), Option: Select$5.Option, render: function render70() { var _this = this; var selectOptionsProps = getOptionProps(this); var selelctProps = _extends$1(_extends$1(_extends$1({}, selectOptionsProps), { size: "small" }), this.$attrs); return createVNode(Select$5, selelctProps, { default: function _default8() { return [getSlot$1(_this)]; } }); } }); var Pager = { name: "Pager", mixins: [BaseMixin], inheritAttrs: false, props: { rootPrefixCls: PropsTypes.string, page: PropsTypes.number, active: PropsTypes.looseBool, last: PropsTypes.looseBool, locale: PropsTypes.object, showTitle: PropsTypes.looseBool, itemRender: { type: Function, default: function _default7() { } } }, methods: { handleClick: function handleClick2() { this.__emit("click", this.page); }, handleKeyPress: function handleKeyPress(event) { this.__emit("keypress", event, this.handleClick, this.page); } }, render: function render71() { var _classNames; var _this$$attrs = this.$attrs, _cls = _this$$attrs.class, style = _this$$attrs.style; var props2 = this.$props; var prefixCls2 = "".concat(props2.rootPrefixCls, "-item"); var cls = classNames(prefixCls2, "".concat(prefixCls2, "-").concat(props2.page), (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-active"), props2.active), _defineProperty$12(_classNames, "".concat(prefixCls2, "-disabled"), !props2.page), _classNames), _cls); return createVNode("li", { "onClick": this.handleClick, "onKeypress": this.handleKeyPress, "title": this.showTitle ? this.page : null, "tabindex": "0", "class": cls, "style": style }, [this.itemRender({ page: this.page, type: "page", originalElement: createVNode("a", null, [this.page]) })]); } }; var KEYCODE = { ZERO: 48, NINE: 57, NUMPAD_ZERO: 96, NUMPAD_NINE: 105, BACKSPACE: 8, DELETE: 46, ENTER: 13, ARROW_UP: 38, ARROW_DOWN: 40 }; var Options = { mixins: [BaseMixin], props: { disabled: PropsTypes.looseBool, changeSize: PropsTypes.func, quickGo: PropsTypes.func, selectComponentClass: PropsTypes.any, current: PropsTypes.number, pageSizeOptions: PropsTypes.array.def(["10", "20", "30", "40"]), pageSize: PropsTypes.number, buildOptionText: PropsTypes.func, locale: PropsTypes.object, rootPrefixCls: PropsTypes.string, selectPrefixCls: PropsTypes.string, goButton: PropsTypes.any }, data: function data42() { return { goInputText: "" }; }, methods: { getValidValue: function getValidValue2() { var goInputText = this.goInputText, current2 = this.current; return !goInputText || isNaN(goInputText) ? current2 : Number(goInputText); }, defaultBuildOptionText: function defaultBuildOptionText(opt) { return "".concat(opt.value, " ").concat(this.locale.items_per_page); }, handleChange: function handleChange12(e2) { var _e$target = e2.target, value24 = _e$target.value, composing = _e$target.composing; if (e2.isComposing || composing || this.goInputText === value24) return; this.setState({ goInputText: value24 }); }, handleBlur: function handleBlur(e2) { var _this$$props = this.$props, goButton = _this$$props.goButton, quickGo = _this$$props.quickGo, rootPrefixCls = _this$$props.rootPrefixCls; if (goButton) { return; } if (e2.relatedTarget && (e2.relatedTarget.className.indexOf("".concat(rootPrefixCls, "-prev")) >= 0 || e2.relatedTarget.className.indexOf("".concat(rootPrefixCls, "-next")) >= 0)) { return; } quickGo(this.getValidValue()); }, go: function go(e2) { var goInputText = this.goInputText; if (goInputText === "") { return; } if (e2.keyCode === KEYCODE.ENTER || e2.type === "click") { this.quickGo(this.getValidValue()); this.setState({ goInputText: "" }); } } }, render: function render72() { var _this = this; var rootPrefixCls = this.rootPrefixCls, locale2 = this.locale, changeSize = this.changeSize, quickGo = this.quickGo, goButton = this.goButton, Select2 = this.selectComponentClass, defaultBuildOptionText2 = this.defaultBuildOptionText, selectPrefixCls = this.selectPrefixCls, pageSize2 = this.pageSize, pageSizeOptions2 = this.pageSizeOptions, goInputText = this.goInputText, disabled = this.disabled; var prefixCls2 = "".concat(rootPrefixCls, "-options"); var changeSelect = null; var goInput = null; var gotoButton = null; if (!changeSize && !quickGo) { return null; } if (changeSize && Select2) { var buildOptionText = this.buildOptionText || defaultBuildOptionText2; var options2 = pageSizeOptions2.map(function(opt, i2) { return createVNode(Select2.Option, { "key": i2, "value": opt }, { default: function _default8() { return [buildOptionText({ value: opt })]; } }); }); changeSelect = createVNode(Select2, { "disabled": disabled, "prefixCls": selectPrefixCls, "showSearch": false, "class": "".concat(prefixCls2, "-size-changer"), "optionLabelProp": "children", "value": (pageSize2 || pageSizeOptions2[0]).toString(), "onChange": function onChange8(value24) { return _this.changeSize(Number(value24)); }, "getPopupContainer": function getPopupContainer2(triggerNode) { return triggerNode.parentNode; } }, { default: function _default8() { return [options2]; } }); } if (quickGo) { if (goButton) { gotoButton = typeof goButton === "boolean" ? createVNode("button", { "type": "button", "onClick": this.go, "onKeyup": this.go, "disabled": disabled }, [locale2.jump_to_confirm]) : createVNode("span", { "onClick": this.go, "onKeyup": this.go }, [goButton]); } goInput = createVNode("div", { "class": "".concat(prefixCls2, "-quick-jumper") }, [locale2.jump_to, withDirectives(createVNode("input", { "disabled": disabled, "type": "text", "value": goInputText, "onInput": this.handleChange, "onChange": this.handleChange, "onKeyup": this.go, "onBlur": this.handleBlur }, null), [[antInput$1]]), locale2.page, gotoButton]); } return createVNode("li", { "class": "".concat(prefixCls2) }, [changeSelect, goInput]); } }; var LOCALE = { items_per_page: "\u6761/\u9875", jump_to: "\u8DF3\u81F3", jump_to_confirm: "\u786E\u5B9A", page: "\u9875", prev_page: "\u4E0A\u4E00\u9875", next_page: "\u4E0B\u4E00\u9875", prev_5: "\u5411\u524D 5 \u9875", next_5: "\u5411\u540E 5 \u9875", prev_3: "\u5411\u524D 3 \u9875", next_3: "\u5411\u540E 3 \u9875" }; var __rest$i = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; function noop$8() { } function isInteger(value24) { return typeof value24 === "number" && isFinite(value24) && Math.floor(value24) === value24; } function defaultItemRender(_ref) { var originalElement = _ref.originalElement; return originalElement; } function calculatePage(p, state, props2) { var pageSize2 = p; if (typeof pageSize2 === "undefined") { pageSize2 = state.statePageSize; } return Math.floor((props2.total - 1) / pageSize2) + 1; } var VcPagination = defineComponent({ name: "Pagination", mixins: [BaseMixin], inheritAttrs: false, props: { disabled: PropsTypes.looseBool, prefixCls: PropsTypes.string.def("rc-pagination"), selectPrefixCls: PropsTypes.string.def("rc-select"), current: PropsTypes.number, defaultCurrent: PropsTypes.number.def(1), total: PropsTypes.number.def(0), pageSize: PropsTypes.number, defaultPageSize: PropsTypes.number.def(10), hideOnSinglePage: PropsTypes.looseBool.def(false), showSizeChanger: PropsTypes.looseBool.def(false), showLessItems: PropsTypes.looseBool.def(false), selectComponentClass: PropsTypes.any, showPrevNextJumpers: PropsTypes.looseBool.def(true), showQuickJumper: PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.object]).def(false), showTitle: PropsTypes.looseBool.def(true), pageSizeOptions: PropsTypes.arrayOf(PropsTypes.string), buildOptionText: PropsTypes.func, showTotal: PropsTypes.func, simple: PropsTypes.looseBool, locale: PropsTypes.object.def(LOCALE), itemRender: PropsTypes.func, prevIcon: PropsTypes.any, nextIcon: PropsTypes.any, jumpPrevIcon: PropsTypes.any, jumpNextIcon: PropsTypes.any }, data: function data43() { var props2 = getOptionProps(this); var hasOnChange = this.onChange !== noop$8; var hasCurrent = "current" in props2; if (hasCurrent && !hasOnChange) { console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component."); } var current2 = this.defaultCurrent; if ("current" in props2) { current2 = this.current; } var pageSize2 = this.defaultPageSize; if ("pageSize" in props2) { pageSize2 = this.pageSize; } current2 = Math.min(current2, calculatePage(pageSize2, void 0, props2)); return { stateCurrent: current2, stateCurrentInputValue: current2, statePageSize: pageSize2 }; }, watch: { current: function current(val) { this.setState({ stateCurrent: val, stateCurrentInputValue: val }); }, pageSize: function pageSize(val) { var newState = {}; var current2 = this.stateCurrent; var newCurrent = calculatePage(val, this.$data, this.$props); current2 = current2 > newCurrent ? newCurrent : current2; if (!hasProp(this, "current")) { newState.stateCurrent = current2; newState.stateCurrentInputValue = current2; } newState.statePageSize = val; this.setState(newState); }, stateCurrent: function stateCurrent(val, oldValue) { var _this = this; this.$nextTick(function() { if (_this.$refs.paginationNode) { var lastCurrentNode = _this.$refs.paginationNode.querySelector(".".concat(_this.prefixCls, "-item-").concat(oldValue)); if (lastCurrentNode && document.activeElement === lastCurrentNode) { lastCurrentNode.blur(); } } }); }, total: function total() { var newState = {}; var newCurrent = calculatePage(this.pageSize, this.$data, this.$props); if (hasProp(this, "current")) { var current2 = Math.min(this.current, newCurrent); newState.stateCurrent = current2; newState.stateCurrentInputValue = current2; } else { var _current = this.stateCurrent; if (_current === 0 && newCurrent > 0) { _current = 1; } else { _current = Math.min(this.stateCurrent, newCurrent); } newState.stateCurrent = _current; } this.setState(newState); } }, methods: { getJumpPrevPage: function getJumpPrevPage() { return Math.max(1, this.stateCurrent - (this.showLessItems ? 3 : 5)); }, getJumpNextPage: function getJumpNextPage() { return Math.min(calculatePage(void 0, this.$data, this.$props), this.stateCurrent + (this.showLessItems ? 3 : 5)); }, getItemIcon: function getItemIcon(icon) { var prefixCls2 = this.$props.prefixCls; var iconNode = getComponent(this, icon, this.$props) || createVNode("a", { "class": "".concat(prefixCls2, "-item-link") }, null); return iconNode; }, getValidValue: function getValidValue3(e2) { var inputValue = e2.target.value; var allPages = calculatePage(void 0, this.$data, this.$props); var stateCurrentInputValue = this.$data.stateCurrentInputValue; var value24; if (inputValue === "") { value24 = inputValue; } else if (isNaN(Number(inputValue))) { value24 = stateCurrentInputValue; } else if (inputValue >= allPages) { value24 = allPages; } else { value24 = Number(inputValue); } return value24; }, isValid: function isValid3(page) { return isInteger(page) && page !== this.stateCurrent; }, shouldDisplayQuickJumper: function shouldDisplayQuickJumper() { var _this$$props = this.$props, showQuickJumper = _this$$props.showQuickJumper, pageSize2 = _this$$props.pageSize, total2 = _this$$props.total; if (total2 <= pageSize2) { return false; } return showQuickJumper; }, handleKeyDown: function handleKeyDown5(event) { if (event.keyCode === KEYCODE.ARROW_UP || event.keyCode === KEYCODE.ARROW_DOWN) { event.preventDefault(); } }, handleKeyUp: function handleKeyUp(e2) { if (e2.isComposing || e2.target.composing) return; var value24 = this.getValidValue(e2); var stateCurrentInputValue = this.stateCurrentInputValue; if (value24 !== stateCurrentInputValue) { this.setState({ stateCurrentInputValue: value24 }); } if (e2.keyCode === KEYCODE.ENTER) { this.handleChange(value24); } else if (e2.keyCode === KEYCODE.ARROW_UP) { this.handleChange(value24 - 1); } else if (e2.keyCode === KEYCODE.ARROW_DOWN) { this.handleChange(value24 + 1); } }, changePageSize: function changePageSize(size) { var current2 = this.stateCurrent; var preCurrent = current2; var newCurrent = calculatePage(size, this.$data, this.$props); current2 = current2 > newCurrent ? newCurrent : current2; if (newCurrent === 0) { current2 = this.stateCurrent; } if (typeof size === "number") { if (!hasProp(this, "pageSize")) { this.setState({ statePageSize: size }); } if (!hasProp(this, "current")) { this.setState({ stateCurrent: current2, stateCurrentInputValue: current2 }); } } this.__emit("update:pageSize", size); if (current2 !== preCurrent) { this.__emit("update:current", current2); } this.__emit("showSizeChange", current2, size); }, handleChange: function handleChange13(p) { var disabled = this.$props.disabled; var page = p; if (this.isValid(page) && !disabled) { var currentPage = calculatePage(void 0, this.$data, this.$props); if (page > currentPage) { page = currentPage; } else if (page < 1) { page = 1; } if (!hasProp(this, "current")) { this.setState({ stateCurrent: page, stateCurrentInputValue: page }); } this.__emit("update:current", page); this.__emit("change", page, this.statePageSize); return page; } return this.stateCurrent; }, prev: function prev() { if (this.hasPrev()) { this.handleChange(this.stateCurrent - 1); } }, next: function next() { if (this.hasNext()) { this.handleChange(this.stateCurrent + 1); } }, jumpPrev: function jumpPrev() { this.handleChange(this.getJumpPrevPage()); }, jumpNext: function jumpNext() { this.handleChange(this.getJumpNextPage()); }, hasPrev: function hasPrev() { return this.stateCurrent > 1; }, hasNext: function hasNext() { return this.stateCurrent < calculatePage(void 0, this.$data, this.$props); }, runIfEnter: function runIfEnter(event, callback2) { if (event.key === "Enter" || event.charCode === 13) { for (var _len = arguments.length, restParams = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { restParams[_key - 2] = arguments[_key]; } callback2.apply(void 0, restParams); } }, runIfEnterPrev: function runIfEnterPrev(event) { this.runIfEnter(event, this.prev); }, runIfEnterNext: function runIfEnterNext(event) { this.runIfEnter(event, this.next); }, runIfEnterJumpPrev: function runIfEnterJumpPrev(event) { this.runIfEnter(event, this.jumpPrev); }, runIfEnterJumpNext: function runIfEnterJumpNext(event) { this.runIfEnter(event, this.jumpNext); }, handleGoTO: function handleGoTO(event) { if (event.keyCode === KEYCODE.ENTER || event.type === "click") { this.handleChange(this.stateCurrentInputValue); } } }, render: function render73() { var _classNames; var _this$$props2 = this.$props, prefixCls2 = _this$$props2.prefixCls, disabled = _this$$props2.disabled; var _a3 = splitAttrs(this.$attrs).extraAttrs, className = _a3.class, restAttrs = __rest$i(_a3, ["class"]); if (this.hideOnSinglePage === true && this.total <= this.statePageSize) { return null; } var itemRender2 = this.itemRender || defaultItemRender; var props2 = this.$props; var locale2 = this.locale; var allPages = calculatePage(void 0, this.$data, this.$props); var pagerList = []; var jumpPrev2 = null; var jumpNext2 = null; var firstPager = null; var lastPager = null; var gotoButton = null; var goButton = this.showQuickJumper && this.showQuickJumper.goButton; var pageBufferSize = this.showLessItems ? 1 : 2; var stateCurrent2 = this.stateCurrent, statePageSize = this.statePageSize; var prevPage = stateCurrent2 - 1 > 0 ? stateCurrent2 - 1 : 0; var nextPage = stateCurrent2 + 1 < allPages ? stateCurrent2 + 1 : allPages; if (this.simple) { if (goButton) { if (typeof goButton === "boolean") { gotoButton = createVNode("button", { "type": "button", "onClick": this.handleGoTO, "onKeyup": this.handleGoTO }, [locale2.jump_to_confirm]); } else { gotoButton = createVNode("span", { "onClick": this.handleGoTO, "onKeyup": this.handleGoTO }, [goButton]); } gotoButton = createVNode("li", { "title": this.showTitle ? "".concat(locale2.jump_to).concat(this.stateCurrent, "/").concat(allPages) : null, "class": "".concat(prefixCls2, "-simple-pager") }, [gotoButton]); } var hasPrev2 = this.hasPrev(); var hasNext2 = this.hasNext(); return createVNode("ul", _objectSpread2$2({ "class": classNames("".concat(prefixCls2, " ").concat(prefixCls2, "-simple"), className) }, restAttrs), [createVNode("li", { "title": this.showTitle ? locale2.prev_page : null, "onClick": this.prev, "tabindex": hasPrev2 ? 0 : null, "onKeypress": this.runIfEnterPrev, "class": "".concat(hasPrev2 ? "" : "".concat(prefixCls2, "-disabled"), " ").concat(prefixCls2, "-prev"), "aria-disabled": !this.hasPrev() }, [itemRender2({ page: prevPage, type: "prev", originalElement: this.getItemIcon("prevIcon") })]), createVNode("li", { "title": this.showTitle ? "".concat(stateCurrent2, "/").concat(allPages) : null, "class": "".concat(prefixCls2, "-simple-pager") }, [withDirectives(createVNode("input", { "type": "text", "value": this.stateCurrentInputValue, "onKeydown": this.handleKeyDown, "onKeyup": this.handleKeyUp, "onInput": this.handleKeyUp, "onChange": this.handleKeyUp, "size": "3" }, null), [[antInput$1]]), createVNode("span", { "class": "".concat(prefixCls2, "-slash") }, [createTextVNode("\uFF0F")]), allPages]), createVNode("li", { "title": this.showTitle ? locale2.next_page : null, "onClick": this.next, "tabindex": this.hasNext ? 0 : null, "onKeypress": this.runIfEnterNext, "class": "".concat(hasNext2 ? "" : "".concat(prefixCls2, "-disabled"), " ").concat(prefixCls2, "-next"), "aria-disabled": !this.hasNext() }, [itemRender2({ page: nextPage, type: "next", originalElement: this.getItemIcon("nextIcon") })]), gotoButton]); } if (allPages <= 5 + pageBufferSize * 2) { var pagerProps = { locale: locale2, rootPrefixCls: prefixCls2, showTitle: props2.showTitle, itemRender: itemRender2, onClick: this.handleChange, onKeypress: this.runIfEnter }; if (!allPages) { pagerList.push(createVNode(Pager, _objectSpread2$2(_objectSpread2$2({}, pagerProps), {}, { "key": "noPager", "page": allPages, "class": "".concat(prefixCls2, "-disabled") }), null)); } for (var i2 = 1; i2 <= allPages; i2++) { var active = stateCurrent2 === i2; pagerList.push(createVNode(Pager, _objectSpread2$2(_objectSpread2$2({}, pagerProps), {}, { "key": i2, "page": i2, "active": active }), null)); } } else { var prevItemTitle = this.showLessItems ? locale2.prev_3 : locale2.prev_5; var nextItemTitle = this.showLessItems ? locale2.next_3 : locale2.next_5; if (this.showPrevNextJumpers) { var jumpPrevClassString = "".concat(prefixCls2, "-jump-prev"); if (props2.jumpPrevIcon) { jumpPrevClassString += " ".concat(prefixCls2, "-jump-prev-custom-icon"); } jumpPrev2 = createVNode("li", { "title": this.showTitle ? prevItemTitle : null, "key": "prev", "onClick": this.jumpPrev, "tabindex": "0", "onKeypress": this.runIfEnterJumpPrev, "class": jumpPrevClassString }, [itemRender2({ page: this.getJumpPrevPage(), type: "jump-prev", originalElement: this.getItemIcon("jumpPrevIcon") })]); var jumpNextClassString = "".concat(prefixCls2, "-jump-next"); if (props2.jumpNextIcon) { jumpNextClassString += " ".concat(prefixCls2, "-jump-next-custom-icon"); } jumpNext2 = createVNode("li", { "title": this.showTitle ? nextItemTitle : null, "key": "next", "tabindex": "0", "onClick": this.jumpNext, "onKeypress": this.runIfEnterJumpNext, "class": jumpNextClassString }, [itemRender2({ page: this.getJumpNextPage(), type: "jump-next", originalElement: this.getItemIcon("jumpNextIcon") })]); } lastPager = createVNode(Pager, { "locale": locale2, "last": true, "rootPrefixCls": prefixCls2, "onClick": this.handleChange, "onKeypress": this.runIfEnter, "key": allPages, "page": allPages, "active": false, "showTitle": this.showTitle, "itemRender": itemRender2 }, null); firstPager = createVNode(Pager, { "locale": locale2, "rootPrefixCls": prefixCls2, "onClick": this.handleChange, "onKeypress": this.runIfEnter, "key": 1, "page": 1, "active": false, "showTitle": this.showTitle, "itemRender": itemRender2 }, null); var left = Math.max(1, stateCurrent2 - pageBufferSize); var right = Math.min(stateCurrent2 + pageBufferSize, allPages); if (stateCurrent2 - 1 <= pageBufferSize) { right = 1 + pageBufferSize * 2; } if (allPages - stateCurrent2 <= pageBufferSize) { left = allPages - pageBufferSize * 2; } for (var _i = left; _i <= right; _i++) { var _active = stateCurrent2 === _i; pagerList.push(createVNode(Pager, { "locale": locale2, "rootPrefixCls": prefixCls2, "onClick": this.handleChange, "onKeypress": this.runIfEnter, "key": _i, "page": _i, "active": _active, "showTitle": this.showTitle, "itemRender": itemRender2 }, null)); } if (stateCurrent2 - 1 >= pageBufferSize * 2 && stateCurrent2 !== 1 + 2) { pagerList[0] = createVNode(Pager, { "locale": locale2, "rootPrefixCls": prefixCls2, "onClick": this.handleChange, "onKeypress": this.runIfEnter, "key": left, "page": left, "class": "".concat(prefixCls2, "-item-after-jump-prev"), "active": false, "showTitle": this.showTitle, "itemRender": itemRender2 }, null); pagerList.unshift(jumpPrev2); } if (allPages - stateCurrent2 >= pageBufferSize * 2 && stateCurrent2 !== allPages - 2) { pagerList[pagerList.length - 1] = createVNode(Pager, { "locale": locale2, "rootPrefixCls": prefixCls2, "onClick": this.handleChange, "onKeypress": this.runIfEnter, "key": right, "page": right, "class": "".concat(prefixCls2, "-item-before-jump-next"), "active": false, "showTitle": this.showTitle, "itemRender": itemRender2 }, null); pagerList.push(jumpNext2); } if (left !== 1) { pagerList.unshift(firstPager); } if (right !== allPages) { pagerList.push(lastPager); } } var totalText = null; if (this.showTotal) { totalText = createVNode("li", { "class": "".concat(prefixCls2, "-total-text") }, [this.showTotal(this.total, [this.total === 0 ? 0 : (stateCurrent2 - 1) * statePageSize + 1, stateCurrent2 * statePageSize > this.total ? this.total : stateCurrent2 * statePageSize])]); } var prevDisabled = !this.hasPrev() || !allPages; var nextDisabled = !this.hasNext() || !allPages; var buildOptionText = this.buildOptionText || this.$slots.buildOptionText; return createVNode("ul", _objectSpread2$2(_objectSpread2$2({ "unselectable": "unselectable", "ref": "paginationNode" }, restAttrs), {}, { "class": classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2), true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-disabled"), disabled), _classNames), className) }), [totalText, createVNode("li", { "title": this.showTitle ? locale2.prev_page : null, "onClick": this.prev, "tabindex": prevDisabled ? null : 0, "onKeypress": this.runIfEnterPrev, "class": "".concat(!prevDisabled ? "" : "".concat(prefixCls2, "-disabled"), " ").concat(prefixCls2, "-prev"), "aria-disabled": prevDisabled }, [itemRender2({ page: prevPage, type: "prev", originalElement: this.getItemIcon("prevIcon") })]), pagerList, createVNode("li", { "title": this.showTitle ? locale2.next_page : null, "onClick": this.next, "tabindex": nextDisabled ? null : 0, "onKeypress": this.runIfEnterNext, "class": "".concat(!nextDisabled ? "" : "".concat(prefixCls2, "-disabled"), " ").concat(prefixCls2, "-next"), "aria-disabled": nextDisabled }, [itemRender2({ page: nextPage, type: "next", originalElement: this.getItemIcon("nextIcon") })]), createVNode(Options, { "disabled": disabled, "locale": locale2, "rootPrefixCls": prefixCls2, "selectComponentClass": this.selectComponentClass, "selectPrefixCls": this.selectPrefixCls, "changeSize": this.showSizeChanger ? this.changePageSize : null, "current": stateCurrent2, "pageSize": statePageSize, "pageSizeOptions": this.pageSizeOptions, "buildOptionText": buildOptionText || null, "quickGo": this.shouldDisplayQuickJumper() ? this.handleChange : null, "goButton": goButton }, null)]); } }); var __rest$h = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var paginationProps$1 = function paginationProps2() { return { total: PropsTypes.number, defaultCurrent: PropsTypes.number, disabled: PropsTypes.looseBool, current: PropsTypes.number, defaultPageSize: PropsTypes.number, pageSize: PropsTypes.number, hideOnSinglePage: PropsTypes.looseBool, showSizeChanger: PropsTypes.looseBool, pageSizeOptions: PropsTypes.arrayOf(PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string])), buildOptionText: PropsTypes.func, showSizeChange: PropsTypes.func, showQuickJumper: withUndefined(PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.object])), showTotal: PropsTypes.any, size: PropsTypes.string, simple: PropsTypes.looseBool, locale: PropsTypes.object, prefixCls: PropsTypes.string, selectPrefixCls: PropsTypes.string, itemRender: PropsTypes.func, role: PropsTypes.string, showLessItems: PropsTypes.looseBool, onChange: PropsTypes.func, onShowSizeChange: PropsTypes.func, "onUpdate:current": PropsTypes.func, "onUpdate:pageSize": PropsTypes.func }; }; var paginationConfig = function paginationConfig2() { return _extends$1(_extends$1({}, paginationProps$1()), { position: PropsTypes.oneOf(tuple("top", "bottom", "both")) }); }; var Pagination = defineComponent({ name: "APagination", inheritAttrs: false, props: _extends$1({}, paginationProps$1()), emits: ["change", "showSizeChange", "update:current", "update:pageSize"], setup: function setup79() { return { configProvider: inject("configProvider", defaultConfigProvider) }; }, methods: { getIconsProps: function getIconsProps(prefixCls2) { var prevIcon = createVNode("a", { "class": "".concat(prefixCls2, "-item-link") }, [createVNode(LeftOutlined$3, null, null)]); var nextIcon = createVNode("a", { "class": "".concat(prefixCls2, "-item-link") }, [createVNode(RightOutlined$3, null, null)]); var jumpPrevIcon = createVNode("a", { "class": "".concat(prefixCls2, "-item-link") }, [createVNode("div", { "class": "".concat(prefixCls2, "-item-container") }, [createVNode(DoubleLeftOutlined$1, { "class": "".concat(prefixCls2, "-item-link-icon") }, null), createVNode("span", { "class": "".concat(prefixCls2, "-item-ellipsis") }, [createTextVNode("\u2022\u2022\u2022")])])]); var jumpNextIcon = createVNode("a", { "class": "".concat(prefixCls2, "-item-link") }, [createVNode("div", { "class": "".concat(prefixCls2, "-item-container") }, [createVNode(DoubleRightOutlined$1, { "class": "".concat(prefixCls2, "-item-link-icon") }, null), createVNode("span", { "class": "".concat(prefixCls2, "-item-ellipsis") }, [createTextVNode("\u2022\u2022\u2022")])])]); return { prevIcon, nextIcon, jumpPrevIcon, jumpNextIcon }; }, renderPagination: function renderPagination(contextLocale) { var _a3 = getOptionProps(this), customizePrefixCls = _a3.prefixCls, customizeSelectPrefixCls = _a3.selectPrefixCls, buildOptionText = _a3.buildOptionText, size = _a3.size, customLocale = _a3.locale, restProps = __rest$h(_a3, ["prefixCls", "selectPrefixCls", "buildOptionText", "size", "locale"]); var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("pagination", customizePrefixCls); var selectPrefixCls = getPrefixCls2("select", customizeSelectPrefixCls); var isSmall = size === "small"; var paginationProps3 = _extends$1(_extends$1(_extends$1(_extends$1(_extends$1({ prefixCls: prefixCls2, selectPrefixCls }, restProps), this.getIconsProps(prefixCls2)), { selectComponentClass: isSmall ? MiniSelect : Select$5, locale: _extends$1(_extends$1({}, contextLocale), customLocale), buildOptionText: buildOptionText || this.$slots.buildOptionText }), this.$attrs), { class: classNames({ mini: isSmall }, this.$attrs.class), itemRender: this.itemRender || this.$slots.itemRender }); return createVNode(VcPagination, paginationProps3, null); } }, render: function render74() { return createVNode(LocaleReceiver, { "componentName": "Pagination", "defaultLocale": enUS$2, "children": this.renderPagination }, null); } }); var APagination = withInstall(Pagination); var Notice = { mixins: [BaseMixin], props: { duration: PropsTypes.number.def(1.5), closable: PropsTypes.looseBool, prefixCls: PropsTypes.string, update: PropsTypes.looseBool, closeIcon: PropsTypes.any, onClose: PropsTypes.func }, watch: { duration: function duration() { this.restartCloseTimer(); } }, mounted: function mounted24() { this.startCloseTimer(); }, updated: function updated13() { if (this.update) { this.restartCloseTimer(); } }, beforeUnmount: function beforeUnmount15() { this.clearCloseTimer(); this.willDestroy = true; }, methods: { close: function close5(e2) { if (e2) { e2.stopPropagation(); } this.clearCloseTimer(); this.__emit("close"); }, startCloseTimer: function startCloseTimer() { var _this = this; this.clearCloseTimer(); if (!this.willDestroy && this.duration) { this.closeTimer = setTimeout(function() { _this.close(); }, this.duration * 1e3); } }, clearCloseTimer: function clearCloseTimer() { if (this.closeTimer) { clearTimeout(this.closeTimer); this.closeTimer = null; } }, restartCloseTimer: function restartCloseTimer() { this.clearCloseTimer(); this.startCloseTimer(); } }, render: function render75() { var _className; var prefixCls2 = this.prefixCls, closable = this.closable, clearCloseTimer2 = this.clearCloseTimer, startCloseTimer2 = this.startCloseTimer, close7 = this.close, $attrs = this.$attrs; var componentClass = "".concat(prefixCls2, "-notice"); var className = (_className = {}, _defineProperty$12(_className, "".concat(componentClass), 1), _defineProperty$12(_className, "".concat(componentClass, "-closable"), closable), _className); var closeIcon = getComponent(this, "closeIcon"); return createVNode("div", { "class": className, "style": $attrs.style || { right: "50%" }, "onMouseenter": clearCloseTimer2, "onMouseleave": startCloseTimer2 }, [createVNode("div", { "class": "".concat(componentClass, "-content") }, [getSlot$1(this)]), closable ? createVNode("a", { "tabindex": "0", "onClick": close7, "class": "".concat(componentClass, "-close") }, [closeIcon || createVNode("span", { "class": "".concat(componentClass, "-close-x") }, null)]) : null]); } }; var __rest$g = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; function noop$7() { } var seed = 0; var now$1 = Date.now(); function getUuid() { return "rcNotification_".concat(now$1, "_").concat(seed++); } var Notification = defineComponent({ mixins: [BaseMixin], props: { prefixCls: PropsTypes.string.def("rc-notification"), transitionName: PropsTypes.string, animation: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.object]).def("fade"), maxCount: PropsTypes.number, closeIcon: PropsTypes.any }, data: function data44() { return { notices: [] }; }, methods: { getTransitionName: function getTransitionName5() { var props2 = this.$props; var transitionName2 = props2.transitionName; if (!transitionName2 && props2.animation) { transitionName2 = "".concat(props2.prefixCls, "-").concat(props2.animation); } return transitionName2; }, add: function add2(notice2) { var key2 = notice2.key = notice2.key || getUuid(); var maxCount2 = this.$props.maxCount; this.setState(function(previousState) { var notices = previousState.notices; var noticeIndex = notices.map(function(v2) { return v2.key; }).indexOf(key2); var updatedNotices = notices.concat(); if (noticeIndex !== -1) { updatedNotices.splice(noticeIndex, 1, notice2); } else { if (maxCount2 && notices.length >= maxCount2) { notice2.updateKey = updatedNotices[0].updateKey || updatedNotices[0].key; updatedNotices.shift(); } updatedNotices.push(notice2); } return { notices: updatedNotices }; }); }, remove: function remove2(key2) { this.setState(function(previousState) { return { notices: previousState.notices.filter(function(notice2) { return notice2.key !== key2; }) }; }); } }, render: function render76() { var _this = this; var prefixCls2 = this.prefixCls, notices = this.notices, remove3 = this.remove, getTransitionName6 = this.getTransitionName, $attrs = this.$attrs; var transitionProps = getTransitionGroupProps(getTransitionName6()); var noticeNodes = notices.map(function(notice2, index2) { var update = Boolean(index2 === notices.length - 1 && notice2.updateKey); var key2 = notice2.updateKey ? notice2.updateKey : notice2.key; var content = notice2.content, duration2 = notice2.duration, closable = notice2.closable, onClose = notice2.onClose, style = notice2.style, className2 = notice2.class; var close7 = createChainedFunction(remove3.bind(_this, notice2.key), onClose); var noticeProps = { prefixCls: prefixCls2, duration: duration2, closable, update, closeIcon: getComponent(_this, "closeIcon"), onClose: close7, onClick: notice2.onClick || noop$7, style, class: className2, key: key2 }; return createVNode(Notice, noticeProps, { default: function _default8() { return [typeof content === "function" ? content() : content]; } }); }); var className = _defineProperty$12({}, prefixCls2, 1); return createVNode("div", { "class": className, "style": $attrs.style || { top: "65px", left: "50%" } }, [createVNode(TransitionGroup, _objectSpread2$2({ "tag": "span" }, transitionProps), { default: function _default8() { return [noticeNodes]; } })]); } }); Notification.newInstance = function newNotificationInstance(properties, callback2) { var _a3 = properties || {}, getContainer5 = _a3.getContainer, style = _a3.style, className = _a3.class, props2 = __rest$g(_a3, ["getContainer", "style", "class"]); var div = document.createElement("div"); if (getContainer5) { var root2 = getContainer5(); root2.appendChild(div); } else { document.body.appendChild(div); } var app = createApp({ mounted: function mounted36() { var self2 = this; this.$nextTick(function() { callback2({ notice: function notice2(noticeProps) { self2.$refs.notification.add(noticeProps); }, removeNotice: function removeNotice(key2) { self2.$refs.notification.remove(key2); }, component: self2, destroy: function destroy3() { app.unmount(div); if (div.parentNode) { div.parentNode.removeChild(div); } } }); }); }, render: function render123() { var p = _extends$1(_extends$1({}, props2), { ref: "notification", style, class: className }); return createVNode(Notification, p, null); } }); app.mount(div); }; var Notification$1 = Notification; var defaultDuration$1 = 3; var defaultTop$1; var messageInstance; var key$3 = 1; var prefixCls$1 = "ant-message"; var transitionName = "move-up"; var getContainer = function getContainer4() { return document.body; }; var maxCount; function getMessageInstance(callback2) { if (messageInstance) { callback2(messageInstance); return; } Notification$1.newInstance({ prefixCls: prefixCls$1, transitionName, style: { top: defaultTop$1 }, getContainer, maxCount }, function(instance) { if (messageInstance) { callback2(messageInstance); return; } messageInstance = instance; callback2(instance); }); } var iconMap = { info: InfoCircleFilled$3, success: CheckCircleFilled$3, error: CloseCircleFilled$3, warning: ExclamationCircleFilled$1, loading: LoadingOutlined$3 }; function notice$1(args) { var duration2 = args.duration !== void 0 ? args.duration : defaultDuration$1; var Icon4 = iconMap[args.type]; var iconNode = Icon4 ? createVNode(Icon4, null, null) : ""; var target = args.key || key$3++; var closePromise = new Promise(function(resolve) { var callback2 = function callback3() { if (typeof args.onClose === "function") { args.onClose(); } return resolve(true); }; getMessageInstance(function(instance) { instance.notice({ key: target, duration: duration2, style: args.style || {}, class: args.class, content: function content() { return createVNode("div", { "class": "".concat(prefixCls$1, "-custom-content").concat(args.type ? " ".concat(prefixCls$1, "-").concat(args.type) : "") }, [args.icon || iconNode, createVNode("span", null, [args.content])]); }, onClose: callback2 }); }); }); var result = function result2() { if (messageInstance) { messageInstance.removeNotice(target); } }; result.then = function(filled, rejected) { return closePromise.then(filled, rejected); }; result.promise = closePromise; return result; } function isArgsProps(content) { return Object.prototype.toString.call(content) === "[object Object]" && !!content.content; } var api$1 = { open: notice$1, config: function config2(options2) { if (options2.top !== void 0) { defaultTop$1 = options2.top; messageInstance = null; } if (options2.duration !== void 0) { defaultDuration$1 = options2.duration; } if (options2.prefixCls !== void 0) { prefixCls$1 = options2.prefixCls; } if (options2.getContainer !== void 0) { getContainer = options2.getContainer; } if (options2.transitionName !== void 0) { transitionName = options2.transitionName; messageInstance = null; } if (options2.maxCount !== void 0) { maxCount = options2.maxCount; messageInstance = null; } }, destroy: function destroy() { if (messageInstance) { messageInstance.destroy(); messageInstance = null; } } }; ["success", "info", "warning", "error", "loading"].forEach(function(type2) { api$1[type2] = function(content, duration2, onClose) { if (isArgsProps(content)) { return api$1.open(_extends$1(_extends$1({}, content), { type: type2 })); } if (typeof duration2 === "function") { onClose = duration2; duration2 = void 0; } return api$1.open({ content, duration: duration2, type: type2, onClose }); }; }); api$1.warn = api$1.warning; var message = api$1; var mousePosition = null; var getClickPosition = function getClickPosition2(e2) { mousePosition = { x: e2.pageX, y: e2.pageY }; setTimeout(function() { return mousePosition = null; }, 100); }; if (typeof window !== "undefined" && window.document && window.document.documentElement) { addEventListenerWrap(document.documentElement, "click", getClickPosition, true); } function noop$6() { } var modalProps$1 = { prefixCls: PropsTypes.string, visible: PropsTypes.looseBool, confirmLoading: PropsTypes.looseBool, title: PropsTypes.any, closable: PropsTypes.looseBool, closeIcon: PropsTypes.any, onOk: { type: Function }, onCancel: { type: Function }, afterClose: PropsTypes.func.def(noop$6), centered: PropsTypes.looseBool, width: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), footer: PropsTypes.any, okText: PropsTypes.any, okType: { type: String }, cancelText: PropsTypes.any, icon: PropsTypes.any, maskClosable: PropsTypes.looseBool, forceRender: PropsTypes.looseBool, okButtonProps: PropsTypes.shape(buttonTypes).loose, cancelButtonProps: PropsTypes.shape(buttonTypes).loose, destroyOnClose: PropsTypes.looseBool, wrapClassName: PropsTypes.string, maskTransitionName: PropsTypes.string, transitionName: PropsTypes.string, getContainer: PropsTypes.any, zIndex: PropsTypes.number, bodyStyle: PropsTypes.style, maskStyle: PropsTypes.style, mask: PropsTypes.looseBool, keyboard: PropsTypes.looseBool, wrapProps: PropsTypes.object, focusTriggerAfterClose: PropsTypes.looseBool }; var destroyFns = []; var Modal$1 = defineComponent({ name: "AModal", inheritAttrs: false, props: initDefaultProps$1(modalProps$1, { width: 520, transitionName: "zoom", maskTransitionName: "fade", confirmLoading: false, visible: false, okType: "primary" }), emits: ["update:visible", "cancel", "change", "ok"], setup: function setup80() { return { configProvider: inject("configProvider", defaultConfigProvider) }; }, data: function data45() { return { sVisible: !!this.visible }; }, watch: { visible: function visible6(val) { this.sVisible = val; } }, methods: { handleCancel: function handleCancel(e2) { this.$emit("update:visible", false); this.$emit("cancel", e2); this.$emit("change", false); }, handleOk: function handleOk(e2) { this.$emit("ok", e2); }, renderFooter: function renderFooter3(locale2) { var _this = this; var okType = this.okType, confirmLoading = this.confirmLoading; var cancelBtnProps = _extends$1({ onClick: this.handleCancel }, this.cancelButtonProps || {}); var okBtnProps = _extends$1(_extends$1(_extends$1({ onClick: this.handleOk }, convertLegacyProps(okType)), { loading: confirmLoading }), this.okButtonProps || {}); return createVNode("div", null, [createVNode(Button$1, cancelBtnProps, { default: function _default8() { return [getComponent(_this, "cancelText") || locale2.cancelText]; } }), createVNode(Button$1, okBtnProps, { default: function _default8() { return [getComponent(_this, "okText") || locale2.okText]; } })]); } }, render: function render77() { var customizePrefixCls = this.prefixCls, visible9 = this.sVisible, wrapClassName = this.wrapClassName, centered = this.centered, getContainer5 = this.getContainer, $attrs = this.$attrs; var children = getSlot$1(this); var _this$configProvider = this.configProvider, getPrefixCls2 = _this$configProvider.getPrefixCls, getContextPopupContainer = _this$configProvider.getPopupContainer; var prefixCls2 = getPrefixCls2("modal", customizePrefixCls); var defaultFooter = createVNode(LocaleReceiver, { "componentName": "Modal", "defaultLocale": getConfirmLocale(), "children": this.renderFooter }, null); var closeIcon = getComponent(this, "closeIcon"); var closeIconToRender = createVNode("span", { "class": "".concat(prefixCls2, "-close-x") }, [closeIcon || createVNode(CloseOutlined$3, { "class": "".concat(prefixCls2, "-close-icon") }, null)]); var footer = getComponent(this, "footer"); var title = getComponent(this, "title"); var dialogProps = _extends$1(_extends$1(_extends$1({}, this.$props), $attrs), { getContainer: getContainer5 === void 0 ? getContextPopupContainer : getContainer5, prefixCls: prefixCls2, wrapClassName: classNames(_defineProperty$12({}, "".concat(prefixCls2, "-centered"), !!centered), wrapClassName), title, footer: footer === void 0 ? defaultFooter : footer, visible: visible9, mousePosition, closeIcon: closeIconToRender, onClose: this.handleCancel }); return createVNode(DialogWrap$1, dialogProps, { default: function _default8() { return [children]; } }); } }); var ActionButtonProps = { type: { type: String }, actionFn: PropsTypes.func, closeModal: PropsTypes.func, autofocus: PropsTypes.looseBool, buttonProps: PropsTypes.object }; var ActionButton = defineComponent({ mixins: [BaseMixin], props: ActionButtonProps, setup: function setup81() { return { timeoutId: void 0 }; }, data: function data46() { return { loading: false }; }, mounted: function mounted25() { var _this = this; if (this.autofocus) { this.timeoutId = setTimeout(function() { return findDOMNode(_this).focus(); }); } }, beforeUnmount: function beforeUnmount16() { clearTimeout(this.timeoutId); }, methods: { onClick: function onClick5() { var _this2 = this; var actionFn = this.actionFn, closeModal = this.closeModal; if (actionFn) { var ret; if (actionFn.length) { ret = actionFn(closeModal); } else { ret = actionFn(); if (!ret) { closeModal(); } } if (ret && ret.then) { this.setState({ loading: true }); ret.then(function() { closeModal.apply(void 0, arguments); }, function(e2) { console.error(e2); _this2.setState({ loading: false }); }); } } else { closeModal(); } } }, render: function render78() { var _this3 = this; var type2 = this.type, loading = this.loading, buttonProps3 = this.buttonProps; var props2 = _extends$1(_extends$1(_extends$1({}, convertLegacyProps(type2)), { onClick: this.onClick, loading }), buttonProps3); return createVNode(Button$1, props2, { default: function _default8() { return [getSlot$1(_this3)]; } }); } }); function renderSomeContent(_name, someContent) { if (typeof someContent === "function") { return someContent(); } return someContent; } var ConfirmDialog = function ConfirmDialog2(props2) { var icon = props2.icon, onCancel = props2.onCancel, onOk3 = props2.onOk, close7 = props2.close, _props$closable = props2.closable, closable = _props$closable === void 0 ? false : _props$closable, zIndex = props2.zIndex, afterClose = props2.afterClose, visible9 = props2.visible, keyboard = props2.keyboard, centered = props2.centered, getContainer5 = props2.getContainer, maskStyle = props2.maskStyle, okButtonProps = props2.okButtonProps, cancelButtonProps = props2.cancelButtonProps; var okType = props2.okType || "primary"; var prefixCls2 = props2.prefixCls || "ant-modal"; var contentPrefixCls = "".concat(prefixCls2, "-confirm"); var okCancel = "okCancel" in props2 ? props2.okCancel : true; var width = props2.width || 416; var style = props2.style || {}; var mask = props2.mask === void 0 ? true : props2.mask; var maskClosable = props2.maskClosable === void 0 ? false : props2.maskClosable; var runtimeLocale2 = getConfirmLocale(); var okText = renderSomeContent("okText", props2.okText) || (okCancel ? runtimeLocale2.okText : runtimeLocale2.justOkText); var cancelText = renderSomeContent("cancelText", props2.cancelText) || runtimeLocale2.cancelText; var autoFocusButton = props2.autoFocusButton === null ? false : props2.autoFocusButton || "ok"; var transitionName2 = props2.transitionName || "zoom"; var maskTransitionName = props2.maskTransitionName || "fade"; var classString = classNames(contentPrefixCls, "".concat(contentPrefixCls, "-").concat(props2.type), "".concat(prefixCls2, "-").concat(props2.type), props2.class); var cancelButton = okCancel && createVNode(ActionButton, { "actionFn": onCancel, "closeModal": close7, "autofocus": autoFocusButton === "cancel", "buttonProps": cancelButtonProps }, { default: function _default8() { return [cancelText]; } }); return createVNode(Modal$1, { "prefixCls": prefixCls2, "class": classString, "wrapClassName": classNames(_defineProperty$12({}, "".concat(contentPrefixCls, "-centered"), !!centered)), "onCancel": function onCancel2(e2) { return close7({ triggerCancel: true }, e2); }, "visible": visible9, "title": "", "transitionName": transitionName2, "footer": "", "maskTransitionName": maskTransitionName, "mask": mask, "maskClosable": maskClosable, "maskStyle": maskStyle, "style": style, "width": width, "zIndex": zIndex, "afterClose": afterClose, "keyboard": keyboard, "centered": centered, "getContainer": getContainer5, "closable": closable }, { default: function _default8() { return [createVNode("div", { "class": "".concat(contentPrefixCls, "-body-wrapper") }, [createVNode("div", { "class": "".concat(contentPrefixCls, "-body") }, [renderSomeContent("icon", icon), props2.title === void 0 ? null : createVNode("span", { "class": "".concat(contentPrefixCls, "-title") }, [renderSomeContent("title", props2.title)]), createVNode("div", { "class": "".concat(contentPrefixCls, "-content") }, [renderSomeContent("content", props2.content)])]), createVNode("div", { "class": "".concat(contentPrefixCls, "-btns") }, [cancelButton, createVNode(ActionButton, { "type": okType, "actionFn": onOk3, "closeModal": close7, "autofocus": autoFocusButton === "ok", "buttonProps": okButtonProps }, { default: function _default9() { return [okText]; } })])])]; } }); }; ConfirmDialog.inheritAttrs = false; var ConfirmDialog$1 = ConfirmDialog; var confirm$1 = function confirm2(config3) { var div = document.createElement("div"); document.body.appendChild(div); var currentConfig = _extends$1(_extends$1({}, omit(config3, ["parentContext", "appContext"])), { close: close7, visible: true }); var confirmDialogInstance = null; function close7() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } currentConfig = _extends$1(_extends$1({}, currentConfig), { visible: false, afterClose: destroy3.bind.apply(destroy3, [this].concat(args)) }); update(currentConfig); } function update(newConfig) { currentConfig = _extends$1(_extends$1({}, currentConfig), newConfig); if (confirmDialogInstance) { _extends$1(confirmDialogInstance.component.props, currentConfig); confirmDialogInstance.component.update(); } } function destroy3() { if (confirmDialogInstance && div.parentNode) { _extends$1(confirmDialogInstance.component.props, { vIf: false }); confirmDialogInstance.component.update(); confirmDialogInstance = null; div.parentNode.removeChild(div); } for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } var triggerCancel = args.some(function(param) { return param && param.triggerCancel; }); if (config3.onCancel && triggerCancel) { config3.onCancel.apply(config3, args); } for (var i2 = 0; i2 < destroyFns.length; i2++) { var fn = destroyFns[i2]; if (fn === close7) { destroyFns.splice(i2, 1); break; } } } var Wrapper = function Wrapper2(p) { return p.vIf ? createVNode(ConfirmDialog$1, p, null) : null; }; function render$1(props2) { var vm = createVNode(Wrapper, _extends$1(_extends$1({}, props2), { vIf: true })); vm.appContext = config3.parentContext || config3.appContext || vm.appContext; render(vm, div); return vm; } confirmDialogInstance = render$1(currentConfig); destroyFns.push(close7); return { destroy: close7, update }; }; var modalConfirm = confirm$1; var info = function info2(props2) { var config3 = _extends$1({ type: "info", icon: function icon() { return createVNode(InfoCircleOutlined$3, null, null); }, okCancel: false }, props2); return modalConfirm(config3); }; var success = function success2(props2) { var config3 = _extends$1({ type: "success", icon: function icon() { return createVNode(CheckCircleOutlined$1, null, null); }, okCancel: false }, props2); return modalConfirm(config3); }; var error$1 = function error2(props2) { var config3 = _extends$1({ type: "error", icon: function icon() { return createVNode(CloseCircleOutlined$1, null, null); }, okCancel: false }, props2); return modalConfirm(config3); }; var warning$1 = function warning3(props2) { var config3 = _extends$1({ type: "warning", icon: function icon() { return createVNode(ExclamationCircleOutlined$1, null, null); }, okCancel: false }, props2); return modalConfirm(config3); }; var warn$1 = warning$1; var confirm = function confirmFn(props2) { var config3 = _extends$1({ type: "confirm", okCancel: true }, props2); return modalConfirm(config3); }; Modal$1.info = info; Modal$1.success = success; Modal$1.error = error$1; Modal$1.warning = warning$1; Modal$1.warn = warn$1; Modal$1.confirm = confirm; Modal$1.destroyAll = function destroyAllFn() { while (destroyFns.length) { var close7 = destroyFns.pop(); if (close7) { close7(); } } }; Modal$1.install = function(app) { app.component(Modal$1.name, Modal$1); return app; }; var skeletonElementProps = function skeletonElementProps2() { return { prefixCls: PropsTypes.string, size: PropsTypes.oneOfType([PropsTypes.oneOf(tuple("large", "small", "default")), PropsTypes.number]), shape: PropsTypes.oneOf(tuple("circle", "square", "round")), active: PropsTypes.looseBool }; }; var Element$1 = function Element2(props2) { var _classNames, _classNames2; var prefixCls2 = props2.prefixCls, size = props2.size, shape = props2.shape; var sizeCls = classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-lg"), size === "large"), _defineProperty$12(_classNames, "".concat(prefixCls2, "-sm"), size === "small"), _classNames)); var shapeCls = classNames((_classNames2 = {}, _defineProperty$12(_classNames2, "".concat(prefixCls2, "-circle"), shape === "circle"), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-square"), shape === "square"), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-round"), shape === "round"), _classNames2)); var sizeStyle = typeof size === "number" ? { width: "".concat(size, "px"), height: "".concat(size, "px"), lineHeight: "".concat(size, "px") } : {}; return createVNode("span", { "class": classNames(prefixCls2, sizeCls, shapeCls), "style": sizeStyle }, null); }; Element$1.displayName = "SkeletonElement"; var Element$2 = Element$1; var avatarProps = initDefaultProps$1(_extends$1(_extends$1({}, skeletonElementProps()), { shape: PropsTypes.oneOf(tuple("circle", "square")) }), { size: "large" }); var SkeletonAvatar = defineComponent({ name: "ASkeletonAvatar", props: avatarProps, setup: function setup82(props2) { var _useConfigInject = useConfigInject("skeleton", props2), prefixCls2 = _useConfigInject.prefixCls; var cls = computed(function() { return classNames(prefixCls2.value, "".concat(prefixCls2.value, "-element"), _defineProperty$12({}, "".concat(prefixCls2.value, "-active"), props2.active)); }); return function() { return createVNode("div", { "class": cls.value }, [createVNode(Element$2, _objectSpread2$2(_objectSpread2$2({}, props2), {}, { "prefixCls": "".concat(prefixCls2.value, "-avatar") }), null)]); }; } }); var SkeletonAvatar$1 = SkeletonAvatar; var skeletonTitleProps = { prefixCls: PropsTypes.string, width: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]) }; var SkeletonTitle = defineComponent({ name: "SkeletonTitle", props: skeletonTitleProps, setup: function setup83(props2) { return function() { var prefixCls2 = props2.prefixCls, width = props2.width; var zWidth = typeof width === "number" ? "".concat(width, "px") : width; return createVNode("h3", { "class": prefixCls2, "style": { width: zWidth } }, null); }; } }); var Title = SkeletonTitle; var widthUnit = PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]); var skeletonParagraphProps = { prefixCls: PropsTypes.string, width: PropsTypes.oneOfType([widthUnit, PropsTypes.arrayOf(widthUnit)]), rows: PropsTypes.number }; var SkeletonParagraph = defineComponent({ name: "SkeletonParagraph", props: skeletonParagraphProps, setup: function setup84(props2) { var getWidth = function getWidth2(index2) { var width = props2.width, _props$rows = props2.rows, rows = _props$rows === void 0 ? 2 : _props$rows; if (Array.isArray(width)) { return width[index2]; } if (rows - 1 === index2) { return width; } return void 0; }; return function() { var prefixCls2 = props2.prefixCls, rows = props2.rows; var rowList = _toConsumableArray(Array(rows)).map(function(_2, index2) { var width = getWidth(index2); return createVNode("li", { "key": index2, "style": { width: typeof width === "number" ? "".concat(width, "px") : width } }, null); }); return createVNode("ul", { "class": prefixCls2 }, [rowList]); }; } }); var Paragraph = SkeletonParagraph; var skeletonProps = { active: PropsTypes.looseBool, loading: PropsTypes.looseBool, prefixCls: PropsTypes.string, avatar: withUndefined(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.shape(omit(avatarProps, ["active"])).loose, PropsTypes.looseBool])), title: withUndefined(PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.string, PropsTypes.shape(skeletonTitleProps).loose])), paragraph: withUndefined(PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.string, PropsTypes.shape(skeletonParagraphProps).loose])) }; function getComponentProps(prop) { if (prop && _typeof$2(prop) === "object") { return prop; } return {}; } function getAvatarBasicProps(hasTitle, hasParagraph) { if (hasTitle && !hasParagraph) { return { size: "large", shape: "square" }; } return { size: "large", shape: "circle" }; } function getTitleBasicProps(hasAvatar, hasParagraph) { if (!hasAvatar && hasParagraph) { return { width: "38%" }; } if (hasAvatar && hasParagraph) { return { width: "50%" }; } return {}; } function getParagraphBasicProps(hasAvatar, hasTitle) { var basicProps2 = {}; if (!hasAvatar || !hasTitle) { basicProps2.width = "61%"; } if (!hasAvatar && hasTitle) { basicProps2.rows = 3; } else { basicProps2.rows = 2; } return basicProps2; } var Skeleton = defineComponent({ name: "ASkeleton", props: initDefaultProps$2(skeletonProps, { avatar: false, title: true, paragraph: true }), setup: function setup85(props2, _ref) { var slots = _ref.slots; var _useConfigInject = useConfigInject("skeleton", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction; return function() { var _a3; var loading = props2.loading, avatar = props2.avatar, title = props2.title, paragraph = props2.paragraph, active = props2.active, round2 = props2.round; var pre = prefixCls2.value; if (loading || props2.loading === void 0) { var _classNames; var hasAvatar = !!avatar || avatar === ""; var hasTitle = !!title || title === ""; var hasParagraph = !!paragraph || paragraph === ""; var avatarNode; if (hasAvatar) { var _avatarProps = _extends$1(_extends$1({ prefixCls: "".concat(pre, "-avatar") }, getAvatarBasicProps(hasTitle, hasParagraph)), getComponentProps(avatar)); avatarNode = createVNode("div", { "class": "".concat(pre, "-header") }, [createVNode(Element$2, _avatarProps, null)]); } var contentNode; if (hasTitle || hasParagraph) { var $title; if (hasTitle) { var titleProps = _extends$1(_extends$1({ prefixCls: "".concat(pre, "-title") }, getTitleBasicProps(hasAvatar, hasParagraph)), getComponentProps(title)); $title = createVNode(Title, titleProps, null); } var paragraphNode; if (hasParagraph) { var paragraphProps = _extends$1(_extends$1({ prefixCls: "".concat(pre, "-paragraph") }, getParagraphBasicProps(hasAvatar, hasTitle)), getComponentProps(paragraph)); paragraphNode = createVNode(Paragraph, paragraphProps, null); } contentNode = createVNode("div", { "class": "".concat(pre, "-content") }, [$title, paragraphNode]); } var cls = classNames(pre, (_classNames = {}, _defineProperty$12(_classNames, "".concat(pre, "-with-avatar"), hasAvatar), _defineProperty$12(_classNames, "".concat(pre, "-active"), active), _defineProperty$12(_classNames, "".concat(pre, "-rtl"), direction.value === "rtl"), _defineProperty$12(_classNames, "".concat(pre, "-round"), round2), _classNames)); return createVNode("div", { "class": cls }, [avatarNode, contentNode]); } return (_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots); }; } }); var Skeleton$1 = Skeleton; var notificationInstance = {}; var defaultDuration = 4.5; var defaultTop = "24px"; var defaultBottom = "24px"; var defaultPlacement = "topRight"; var defaultGetContainer = function defaultGetContainer3() { return document.body; }; var defaultCloseIcon = null; function setNotificationConfig(options2) { var duration2 = options2.duration, placement2 = options2.placement, bottom = options2.bottom, top = options2.top, getContainer5 = options2.getContainer, closeIcon = options2.closeIcon; if (duration2 !== void 0) { defaultDuration = duration2; } if (placement2 !== void 0) { defaultPlacement = placement2; } if (bottom !== void 0) { defaultBottom = typeof bottom === "number" ? "".concat(bottom, "px") : bottom; } if (top !== void 0) { defaultTop = typeof top === "number" ? "".concat(top, "px") : top; } if (getContainer5 !== void 0) { defaultGetContainer = getContainer5; } if (closeIcon !== void 0) { defaultCloseIcon = closeIcon; } } function getPlacementStyle(placement2) { var top = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultTop; var bottom = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : defaultBottom; var style; switch (placement2) { case "topLeft": style = { left: "0px", top, bottom: "auto" }; break; case "topRight": style = { right: "0px", top, bottom: "auto" }; break; case "bottomLeft": style = { left: "0px", top: "auto", bottom }; break; default: style = { right: "0px", top: "auto", bottom }; break; } return style; } function getNotificationInstance(_ref, callback2) { var prefixCls2 = _ref.prefixCls, _ref$placement = _ref.placement, placement2 = _ref$placement === void 0 ? defaultPlacement : _ref$placement, _ref$getContainer = _ref.getContainer, getContainer5 = _ref$getContainer === void 0 ? defaultGetContainer : _ref$getContainer, top = _ref.top, bottom = _ref.bottom, _ref$closeIcon = _ref.closeIcon, _closeIcon = _ref$closeIcon === void 0 ? defaultCloseIcon : _ref$closeIcon; var cacheKey = "".concat(prefixCls2, "-").concat(placement2); if (notificationInstance[cacheKey]) { callback2(notificationInstance[cacheKey]); return; } Notification$1.newInstance({ prefixCls: prefixCls2, class: "".concat(prefixCls2, "-").concat(placement2), style: getPlacementStyle(placement2, top, bottom), getContainer: getContainer5, closeIcon: function closeIcon() { var closeIconToRender = createVNode("span", { "class": "".concat(prefixCls2, "-close-x") }, [_closeIcon || createVNode(CloseOutlined$3, { "class": "".concat(prefixCls2, "-close-icon") }, null)]); return closeIconToRender; } }, function(notification2) { notificationInstance[cacheKey] = notification2; callback2(notification2); }); } var typeToIcon = { success: CheckCircleOutlined$1, info: InfoCircleOutlined$3, error: CloseCircleOutlined$1, warning: ExclamationCircleOutlined$1 }; function notice(args) { var icon = args.icon, type2 = args.type, description = args.description, message2 = args.message, btn = args.btn; var outerPrefixCls = args.prefixCls || "ant-notification"; var prefixCls2 = "".concat(outerPrefixCls, "-notice"); var duration2 = args.duration === void 0 ? defaultDuration : args.duration; var iconNode = null; if (icon) { iconNode = function iconNode2() { return createVNode("span", { "class": "".concat(prefixCls2, "-icon") }, [icon]); }; } else if (type2) { var Icon4 = typeToIcon[type2]; iconNode = function iconNode2() { return createVNode(Icon4, { "class": "".concat(prefixCls2, "-icon ").concat(prefixCls2, "-icon-").concat(type2) }, null); }; } var placement2 = args.placement, top = args.top, bottom = args.bottom, getContainer5 = args.getContainer, closeIcon = args.closeIcon; getNotificationInstance({ prefixCls: outerPrefixCls, placement: placement2, top, bottom, getContainer: getContainer5, closeIcon }, function(notification2) { notification2.notice({ content: function content() { return createVNode("div", { "class": iconNode ? "".concat(prefixCls2, "-with-icon") : "" }, [iconNode && iconNode(), createVNode("div", { "class": "".concat(prefixCls2, "-message") }, [!description && iconNode ? createVNode("span", { "class": "".concat(prefixCls2, "-message-single-line-auto-margin") }, null) : null, message2]), createVNode("div", { "class": "".concat(prefixCls2, "-description") }, [description]), btn ? createVNode("span", { "class": "".concat(prefixCls2, "-btn") }, [btn]) : null]); }, duration: duration2, closable: true, onClose: args.onClose, onClick: args.onClick, key: args.key, style: args.style || {}, class: args.class }); }); } var apiBase = { open: notice, close: function close6(key2) { Object.keys(notificationInstance).forEach(function(cacheKey) { return notificationInstance[cacheKey].removeNotice(key2); }); }, config: setNotificationConfig, destroy: function destroy2() { Object.keys(notificationInstance).forEach(function(cacheKey) { notificationInstance[cacheKey].destroy(); delete notificationInstance[cacheKey]; }); } }; var api = apiBase; var iconTypes = ["success", "info", "warning", "error"]; iconTypes.forEach(function(type2) { api[type2] = function(args) { return api.open(_extends$1(_extends$1({}, args), { type: type2 })); }; }); api.warn = api.warning; var notification = api; var ArrowLeftOutlined$4 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" } }] }, "name": "arrow-left", "theme": "outlined" }; var ArrowLeftOutlinedSvg = ArrowLeftOutlined$4; function _objectSpread$w(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$x(target, key2, source2[key2]); }); } return target; } function _defineProperty$x(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var ArrowLeftOutlined$2 = function ArrowLeftOutlined2(props2, context2) { var p = _objectSpread$w({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$w({}, p, { "icon": ArrowLeftOutlinedSvg }), null); }; ArrowLeftOutlined$2.displayName = "ArrowLeftOutlined"; ArrowLeftOutlined$2.inheritAttrs = false; var ArrowLeftOutlined$3 = ArrowLeftOutlined$2; var ArrowRightOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z" } }] }, "name": "arrow-right", "theme": "outlined" }; var ArrowRightOutlinedSvg = ArrowRightOutlined$2; function _objectSpread$v(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$w(target, key2, source2[key2]); }); } return target; } function _defineProperty$w(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var ArrowRightOutlined = function ArrowRightOutlined2(props2, context2) { var p = _objectSpread$v({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$v({}, p, { "icon": ArrowRightOutlinedSvg }), null); }; ArrowRightOutlined.displayName = "ArrowRightOutlined"; ArrowRightOutlined.inheritAttrs = false; var ArrowRightOutlined$1 = ArrowRightOutlined; var __rest$f = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var inlineStyle = { border: 0, background: "transparent", padding: 0, lineHeight: "inherit", display: "inline-block" }; var TransButton = defineComponent({ name: "TransButton", inheritAttrs: false, props: { noStyle: PropsTypes.looseBool, onClick: PropsTypes.func, disabled: PropsTypes.looseBool, autofocus: PropsTypes.looseBool }, setup: function setup86(props2, _ref) { var slots = _ref.slots, emit2 = _ref.emit, attrs = _ref.attrs, expose = _ref.expose; var domRef = ref(); var onKeyDown11 = function onKeyDown12(event) { var keyCode = event.keyCode; if (keyCode === KeyCode$1.ENTER) { event.preventDefault(); } }; var onKeyUp2 = function onKeyUp3(event) { var keyCode = event.keyCode; if (keyCode === KeyCode$1.ENTER) { emit2("click", event); } }; var onClick7 = function onClick8(e2) { emit2("click", e2); }; var focus25 = function focus26() { if (domRef.value) { domRef.value.focus(); } }; var blur22 = function blur23() { if (domRef.value) { domRef.value.blur(); } }; onMounted(function() { if (props2.autofocus) { focus25(); } }); expose({ focus: focus25, blur: blur22 }); return function() { var _a3; var noStyle = props2.noStyle, disabled = props2.disabled, restProps = __rest$f(props2, ["noStyle", "disabled"]); var mergedStyle = {}; if (!noStyle) { mergedStyle = _extends$1({}, inlineStyle); } if (disabled) { mergedStyle.pointerEvents = "none"; } return createVNode("div", _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({ "role": "button", "tabindex": 0, "ref": domRef }, restProps), attrs), {}, { "onClick": onClick7, "onKeydown": onKeyDown11, "onKeyup": onKeyUp2, "style": _extends$1(_extends$1({}, mergedStyle), attrs.style || {}) }), [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)]); }; } }); var TransButton$1 = TransButton; var pageHeaderProps = { backIcon: PropsTypes.VNodeChild, prefixCls: PropsTypes.string, title: PropsTypes.VNodeChild, subTitle: PropsTypes.VNodeChild, breadcrumb: PropsTypes.object, tags: PropsTypes.any, footer: PropsTypes.VNodeChild, extra: PropsTypes.VNodeChild, avatar: PropsTypes.object, ghost: PropsTypes.looseBool, onBack: PropsTypes.func }; var PageHeader = defineComponent({ name: "APageHeader", props: pageHeaderProps, emits: ["back"], slots: ["backIcon", "avatar", "breadcrumb", "title", "subTitle", "tags", "extra", "footer"], setup: function setup87(props2, _ref) { var emit2 = _ref.emit, slots = _ref.slots; var _useConfigInject = useConfigInject("page-header", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction, pageHeader = _useConfigInject.pageHeader; var compact3 = ref(false); var onResize = function onResize2(_ref2) { var width = _ref2.width; compact3.value = width < 768; }; var ghost = computed(function() { var _a3, _b2, _c; return (_c = (_a3 = props2.ghost) !== null && _a3 !== void 0 ? _a3 : (_b2 = pageHeader.value) === null || _b2 === void 0 ? void 0 : _b2.ghost) !== null && _c !== void 0 ? _c : true; }); var getBackIcon = function getBackIcon2() { var _a3, _b2, _c; return (_c = (_a3 = props2.backIcon) !== null && _a3 !== void 0 ? _a3 : (_b2 = slots.backIcon) === null || _b2 === void 0 ? void 0 : _b2.call(slots)) !== null && _c !== void 0 ? _c : direction.value === "rtl" ? createVNode(ArrowRightOutlined$1, null, null) : createVNode(ArrowLeftOutlined$3, null, null); }; var renderBack = function renderBack2(backIcon) { if (!backIcon || !props2.onBack) { return null; } return createVNode(LocaleReceiver, { "componentName": "PageHeader", "children": function children(_ref3) { var back = _ref3.back; return createVNode("div", { "class": "".concat(prefixCls2.value, "-back") }, [createVNode(TransButton$1, { "onClick": function onClick7(e2) { emit2("back", e2); }, "class": "".concat(prefixCls2.value, "-back-button"), "aria-label": back }, { default: function _default8() { return [backIcon]; } })]); } }, null); }; var renderBreadcrumb = function renderBreadcrumb2() { var _a3; return props2.breadcrumb ? createVNode(Breadcrumb, props2.breadcrumb, null) : (_a3 = slots.breadcrumb) === null || _a3 === void 0 ? void 0 : _a3.call(slots); }; var renderTitle2 = function renderTitle3() { var _a3, _b2, _c, _d, _e, _f, _g, _h, _j; var avatar = props2.avatar; var title = (_a3 = props2.title) !== null && _a3 !== void 0 ? _a3 : (_b2 = slots.title) === null || _b2 === void 0 ? void 0 : _b2.call(slots); var subTitle = (_c = props2.subTitle) !== null && _c !== void 0 ? _c : (_d = slots.subTitle) === null || _d === void 0 ? void 0 : _d.call(slots); var tags = (_e = props2.tags) !== null && _e !== void 0 ? _e : (_f = slots.tags) === null || _f === void 0 ? void 0 : _f.call(slots); var extra = (_g = props2.extra) !== null && _g !== void 0 ? _g : (_h = slots.extra) === null || _h === void 0 ? void 0 : _h.call(slots); var headingPrefixCls = "".concat(prefixCls2.value, "-heading"); var hasHeading = title || subTitle || tags || extra; if (!hasHeading) { return null; } var backIcon = getBackIcon(); var backIconDom = renderBack(backIcon); var hasTitle = backIconDom || avatar || hasHeading; return createVNode("div", { "class": headingPrefixCls }, [hasTitle && createVNode("div", { "class": "".concat(headingPrefixCls, "-left") }, [backIconDom, avatar ? createVNode(Avatar$1, avatar, null) : (_j = slots.avatar) === null || _j === void 0 ? void 0 : _j.call(slots), title && createVNode("span", { "class": "".concat(headingPrefixCls, "-title"), "title": typeof title === "string" ? title : void 0 }, [title]), subTitle && createVNode("span", { "class": "".concat(headingPrefixCls, "-sub-title"), "title": typeof subTitle === "string" ? subTitle : void 0 }, [subTitle]), tags && createVNode("span", { "class": "".concat(headingPrefixCls, "-tags") }, [tags])]), extra && createVNode("span", { "class": "".concat(headingPrefixCls, "-extra") }, [extra])]); }; var renderFooter5 = function renderFooter6() { var _a3, _b2; var footer = (_a3 = props2.footer) !== null && _a3 !== void 0 ? _a3 : filterEmpty((_b2 = slots.footer) === null || _b2 === void 0 ? void 0 : _b2.call(slots)); return isEmptyContent(footer) ? null : createVNode("div", { "class": "".concat(prefixCls2.value, "-footer") }, [footer]); }; var renderChildren4 = function renderChildren5(children) { return createVNode("div", { "class": "".concat(prefixCls2.value, "-content") }, [children]); }; return function() { var _classNames; var _a3, _b2; var hasBreadcrumb = ((_a3 = props2.breadcrumb) === null || _a3 === void 0 ? void 0 : _a3.routes) || slots.breadcrumb; var hasFooter = props2.footer || slots.footer; var children = flattenChildren((_b2 = slots.default) === null || _b2 === void 0 ? void 0 : _b2.call(slots)); var className = classNames(prefixCls2.value, (_classNames = { "has-breadcrumb": hasBreadcrumb, "has-footer": hasFooter }, _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-ghost"), ghost.value), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-rtl"), direction.value === "rtl"), _defineProperty$12(_classNames, "".concat(prefixCls2.value, "-compact"), compact3.value), _classNames)); return createVNode(ResizeObserver, { "onResize": onResize }, { default: function _default8() { return [createVNode("div", { "class": className }, [renderBreadcrumb(), renderTitle2(), children.length ? renderChildren4(children) : null, renderFooter5()])]; } }); }; } }); var PageHeader$1 = withInstall(PageHeader); var tooltipProps$1 = abstractTooltipProps(); var Popconfirm = defineComponent({ name: "APopconfirm", mixins: [BaseMixin], props: _extends$1(_extends$1({}, tooltipProps$1), { prefixCls: PropsTypes.string, transitionName: PropsTypes.string.def("zoom-big"), content: PropsTypes.any, title: PropsTypes.any, trigger: tooltipProps$1.trigger.def("click"), okType: { type: String, default: "primary" }, disabled: PropsTypes.looseBool.def(false), okText: PropsTypes.any, cancelText: PropsTypes.any, icon: PropsTypes.any, okButtonProps: PropsTypes.object, cancelButtonProps: PropsTypes.object, onConfirm: PropsTypes.func, onCancel: PropsTypes.func, onVisibleChange: PropsTypes.func }), emits: ["update:visible", "confirm", "cancel", "visibleChange"], setup: function setup88() { return { configProvider: inject("configProvider", defaultConfigProvider) }; }, data: function data47() { var props2 = getOptionProps(this); var state = { sVisible: false }; if ("visible" in props2) { state.sVisible = props2.visible; } if ("defaultVisible" in props2) { state.sVisible = props2.defaultVisible; } return state; }, watch: { visible: function visible7(val) { this.sVisible = val; } }, methods: { onConfirmHandle: function onConfirmHandle(e2) { this.setVisible(false, e2); this.$emit("confirm", e2); }, onCancelHandle: function onCancelHandle(e2) { this.setVisible(false, e2); this.$emit("cancel", e2); }, onVisibleChangeHandle: function onVisibleChangeHandle(sVisible) { var disabled = this.$props.disabled; if (disabled) { return; } this.setVisible(sVisible); }, setVisible: function setVisible(sVisible, e2) { if (!hasProp(this, "visible")) { this.setState({ sVisible }); } this.$emit("update:visible", sVisible); this.$emit("visibleChange", sVisible, e2); }, getPopupDomNode: function getPopupDomNode7() { return this.$refs.tooltip.getPopupDomNode(); }, renderOverlay: function renderOverlay2(prefixCls2, popconfirmLocale) { var _this = this; var okType = this.okType, okButtonProps = this.okButtonProps, cancelButtonProps = this.cancelButtonProps; var icon = getComponent(this, "icon") || createVNode(ExclamationCircleFilled$1, null, null); var cancelBtnProps = mergeProps(_extends$1({ size: "small", onClick: this.onCancelHandle }, cancelButtonProps)); var okBtnProps = mergeProps(_extends$1(_extends$1(_extends$1({}, convertLegacyProps(okType)), { size: "small", onClick: this.onConfirmHandle }), okButtonProps)); return createVNode("div", { "class": "".concat(prefixCls2, "-inner-content") }, [createVNode("div", { "class": "".concat(prefixCls2, "-message") }, [icon, createVNode("div", { "class": "".concat(prefixCls2, "-message-title") }, [getComponent(this, "title")])]), createVNode("div", { "class": "".concat(prefixCls2, "-buttons") }, [createVNode(Button$1, cancelBtnProps, { default: function _default8() { return [getComponent(_this, "cancelText") || popconfirmLocale.cancelText]; } }), createVNode(Button$1, okBtnProps, { default: function _default8() { return [getComponent(_this, "okText") || popconfirmLocale.okText]; } })])]); } }, render: function render79() { var _this2 = this; var _a3; var props2 = getOptionProps(this); var customizePrefixCls = props2.prefixCls; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("popover", customizePrefixCls); var otherProps = omit(props2, ["title", "content", "cancelText", "okText", "onUpdate:visible"]); var overlay = createVNode(LocaleReceiver, { "componentName": "Popconfirm", "defaultLocale": defaultLocale.Popconfirm, "children": function children(popconfirmLocale) { return _this2.renderOverlay(prefixCls2, popconfirmLocale); } }, null); var tooltipProps2 = _extends$1(_extends$1({}, otherProps), { title: overlay, prefixCls: prefixCls2, visible: this.sVisible, ref: "tooltip", onVisibleChange: this.onVisibleChangeHandle }); return createVNode(Tooltip, tooltipProps2, { default: function _default8() { return [(_a3 = _this2.$slots) === null || _a3 === void 0 ? void 0 : _a3.default()]; } }); } }); var Popconfirm$1 = withInstall(Popconfirm); function validProgress(progress) { if (!progress || progress < 0) { return 0; } if (progress > 100) { return 100; } return progress; } var __rest$e = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var sortGradient = function sortGradient2(gradients) { var tempArr = []; for (var _i = 0, _Object$entries = Object.entries(gradients); _i < _Object$entries.length; _i++) { var _Object$entries$_i = _slicedToArray$4(_Object$entries[_i], 2), key2 = _Object$entries$_i[0], value24 = _Object$entries$_i[1]; var formatKey = parseFloat(key2.replace(/%/g, "")); if (isNaN(formatKey)) { return {}; } tempArr.push({ key: formatKey, value: value24 }); } tempArr = tempArr.sort(function(a2, b2) { return a2.key - b2.key; }); return tempArr.map(function(_ref) { var key3 = _ref.key, value25 = _ref.value; return "".concat(value25, " ").concat(key3, "%"); }).join(", "); }; var handleGradient = function handleGradient2(strokeColor) { var _strokeColor$from = strokeColor.from, from2 = _strokeColor$from === void 0 ? "#1890ff" : _strokeColor$from, _strokeColor$to = strokeColor.to, to2 = _strokeColor$to === void 0 ? "#1890ff" : _strokeColor$to, _strokeColor$directio = strokeColor.direction, direction = _strokeColor$directio === void 0 ? "to right" : _strokeColor$directio, rest = __rest$e(strokeColor, ["from", "to", "direction"]); if (Object.keys(rest).length !== 0) { var sortedGradients = sortGradient(rest); return { backgroundImage: "linear-gradient(".concat(direction, ", ").concat(sortedGradients, ")") }; } return { backgroundImage: "linear-gradient(".concat(direction, ", ").concat(from2, ", ").concat(to2, ")") }; }; var Line = function Line2(_2, _ref2) { var attrs = _ref2.attrs, slots = _ref2.slots; var prefixCls2 = attrs.prefixCls, percent = attrs.percent, successPercent = attrs.successPercent, strokeWidth = attrs.strokeWidth, size = attrs.size, strokeColor = attrs.strokeColor, strokeLinecap = attrs.strokeLinecap, trailColor = attrs.trailColor; var backgroundProps; if (strokeColor && typeof strokeColor !== "string") { backgroundProps = handleGradient(strokeColor); } else { backgroundProps = { background: strokeColor }; } var trailStyle = trailColor ? { style: { backgroundColor: trailColor } } : void 0; var percentStyle = _extends$1({ width: "".concat(validProgress(percent), "%"), height: "".concat(strokeWidth || (size === "small" ? 6 : 8), "px"), background: strokeColor, borderRadius: strokeLinecap === "square" ? 0 : "100px" }, backgroundProps); var successPercentStyle = { width: "".concat(validProgress(successPercent), "%"), height: "".concat(strokeWidth || (size === "small" ? 6 : 8), "px"), borderRadius: strokeLinecap === "square" ? 0 : "" }; var successSegment = successPercent !== void 0 ? createVNode("div", { "class": "".concat(prefixCls2, "-success-bg"), "style": successPercentStyle }, null) : null; return createVNode("div", null, [createVNode("div", { "class": "".concat(prefixCls2, "-outer") }, [createVNode("div", _objectSpread2$2({ "class": "".concat(prefixCls2, "-inner") }, trailStyle), [createVNode("div", { "class": "".concat(prefixCls2, "-bg"), "style": percentStyle }, null), successSegment])]), slots === null || slots === void 0 ? void 0 : slots.default()]); }; var Line$1 = Line; function enhancer(Component) { return _extends$1(_extends$1({}, Component), { updated: function updated22() { var _this = this; var now2 = Date.now(); var updated23 = false; Object.keys(this.paths).forEach(function(key2) { var path2 = _this.paths[key2]; if (!path2) { return; } updated23 = true; var pathStyle = path2.style; pathStyle.transitionDuration = ".3s, .3s, .3s, .06s"; if (_this.prevTimeStamp && now2 - _this.prevTimeStamp < 100) { pathStyle.transitionDuration = "0s, 0s"; } }); if (updated23) { this.prevTimeStamp = Date.now(); } } }); } var defaultProps = { percent: 0, prefixCls: "rc-progress", strokeColor: "#2db7f5", strokeLinecap: "round", strokeWidth: 1, trailColor: "#D9D9D9", trailWidth: 1 }; var mixedType = PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]); var propTypes = { percent: PropsTypes.oneOfType([mixedType, PropsTypes.arrayOf(mixedType)]), prefixCls: PropsTypes.string, strokeColor: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.arrayOf(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.object])), PropsTypes.object]), strokeLinecap: PropsTypes.oneOf(["butt", "round", "square"]), strokeWidth: mixedType, trailColor: PropsTypes.string, trailWidth: mixedType }; var __rest$d = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var circlePropTypes = _extends$1(_extends$1({}, propTypes), { gapPosition: PropsTypes.oneOf(["top", "bottom", "left", "right"]), gapDegree: withUndefined(PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string, PropsTypes.looseBool])) }); var circleDefaultProps = _extends$1(_extends$1({}, defaultProps), { gapPosition: "top" }); var gradientSeed = 0; function stripPercentToNumber(percent) { return +percent.replace("%", ""); } function toArray$1(symArray) { return Array.isArray(symArray) ? symArray : [symArray]; } function getPathStyles(offset4, percent, strokeColor, strokeWidth) { var gapDegree = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0; var gapPosition = arguments.length > 5 ? arguments[5] : void 0; var radius = 50 - strokeWidth / 2; var beginPositionX = 0; var beginPositionY = -radius; var endPositionX = 0; var endPositionY = -2 * radius; switch (gapPosition) { case "left": beginPositionX = -radius; beginPositionY = 0; endPositionX = 2 * radius; endPositionY = 0; break; case "right": beginPositionX = radius; beginPositionY = 0; endPositionX = -2 * radius; endPositionY = 0; break; case "bottom": beginPositionY = radius; endPositionY = 2 * radius; break; } var pathString = "M 50,50 m ".concat(beginPositionX, ",").concat(beginPositionY, "\n a ").concat(radius, ",").concat(radius, " 0 1 1 ").concat(endPositionX, ",").concat(-endPositionY, "\n a ").concat(radius, ",").concat(radius, " 0 1 1 ").concat(-endPositionX, ",").concat(endPositionY); var len = Math.PI * 2 * radius; var pathStyle = { stroke: strokeColor, strokeDasharray: "".concat(percent / 100 * (len - gapDegree), "px ").concat(len, "px"), strokeDashoffset: "-".concat(gapDegree / 2 + offset4 / 100 * (len - gapDegree), "px"), transition: "stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s" }; return { pathString, pathStyle }; } var Circle$2 = defineComponent({ name: "Circle", props: initDefaultProps$2(circlePropTypes, circleDefaultProps), created: function created13() { this.paths = {}; this.gradientId = gradientSeed; gradientSeed += 1; }, methods: { getStokeList: function getStokeList() { var _this = this; var _this$$props = this.$props, prefixCls2 = _this$$props.prefixCls, percent = _this$$props.percent, strokeColor = _this$$props.strokeColor, strokeWidth = _this$$props.strokeWidth, strokeLinecap = _this$$props.strokeLinecap, gapDegree = _this$$props.gapDegree, gapPosition = _this$$props.gapPosition; var percentList = toArray$1(percent); var strokeColorList = toArray$1(strokeColor); var stackPtg = 0; return percentList.map(function(ptg, index2) { var color = strokeColorList[index2] || strokeColorList[strokeColorList.length - 1]; var stroke = Object.prototype.toString.call(color) === "[object Object]" ? "url(#".concat(prefixCls2, "-gradient-").concat(_this.gradientId, ")") : ""; var _getPathStyles = getPathStyles(stackPtg, ptg, color, strokeWidth, gapDegree, gapPosition), pathString = _getPathStyles.pathString, pathStyle = _getPathStyles.pathStyle; stackPtg += ptg; var pathProps = { key: index2, d: pathString, stroke, "stroke-linecap": strokeLinecap, "stroke-width": strokeWidth, opacity: ptg === 0 ? 0 : 1, "fill-opacity": "0", class: "".concat(prefixCls2, "-circle-path"), style: pathStyle }; return createVNode("path", _objectSpread2$2({ "ref": function ref2(c2) { return _this.paths[index2] = c2; } }, pathProps), null); }); } }, render: function render80() { var _a3 = this.$props, prefixCls2 = _a3.prefixCls, strokeWidth = _a3.strokeWidth, trailWidth = _a3.trailWidth, gapDegree = _a3.gapDegree, gapPosition = _a3.gapPosition, trailColor = _a3.trailColor, strokeLinecap = _a3.strokeLinecap, strokeColor = _a3.strokeColor, restProps = __rest$d(_a3, ["prefixCls", "strokeWidth", "trailWidth", "gapDegree", "gapPosition", "trailColor", "strokeLinecap", "strokeColor"]); var _getPathStyles2 = getPathStyles(0, 100, trailColor, strokeWidth, gapDegree, gapPosition), pathString = _getPathStyles2.pathString, pathStyle = _getPathStyles2.pathStyle; delete restProps.percent; var strokeColorList = toArray$1(strokeColor); var gradient = strokeColorList.find(function(color) { return Object.prototype.toString.call(color) === "[object Object]"; }); var pathFirst = { d: pathString, stroke: trailColor, "stroke-linecap": strokeLinecap, "stroke-width": trailWidth || strokeWidth, "fill-opacity": "0", class: "".concat(prefixCls2, "-circle-trail"), style: pathStyle }; return createVNode("svg", _objectSpread2$2({ "class": "".concat(prefixCls2, "-circle"), "viewBox": "0 0 100 100" }, restProps), [gradient && createVNode("defs", null, [createVNode("linearGradient", { "id": "".concat(prefixCls2, "-gradient-").concat(this.gradientId), "x1": "100%", "y1": "0%", "x2": "0%", "y2": "0%" }, [Object.keys(gradient).sort(function(a2, b2) { return stripPercentToNumber(a2) - stripPercentToNumber(b2); }).map(function(key2, index2) { return createVNode("stop", { "key": index2, "offset": key2, "stop-color": gradient[key2] }, null); })])]), createVNode("path", pathFirst, null), this.getStokeList().reverse()]); } }); var VCCircle = enhancer(Circle$2); var ProgressStatuses = tuple("normal", "exception", "active", "success"); var ProgressType = PropsTypes.oneOf(tuple("line", "circle", "dashboard")); var ProgressSize = PropsTypes.oneOf(tuple("default", "small")); var ProgressProps = { prefixCls: PropsTypes.string, type: ProgressType, percent: PropsTypes.number, successPercent: PropsTypes.number, format: PropsTypes.func, status: PropsTypes.oneOf(ProgressStatuses), showInfo: PropsTypes.looseBool, strokeWidth: PropsTypes.number, strokeLinecap: PropsTypes.oneOf(["butt", "round", "square"]), strokeColor: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.object]), trailColor: PropsTypes.string, width: PropsTypes.number, gapDegree: PropsTypes.number, gapPosition: PropsTypes.oneOf(tuple("top", "bottom", "left", "right")), size: ProgressSize }; var CircleProps = _extends$1(_extends$1({}, ProgressProps), { progressStatus: PropsTypes.string }); var statusColorMap = { normal: "#108ee9", exception: "#ff5500", success: "#87d068" }; function getPercentage(_ref) { var percent = _ref.percent, successPercent = _ref.successPercent; var ptg = validProgress(percent); if (!successPercent) return ptg; var successPtg = validProgress(successPercent); return [successPercent, validProgress(ptg - successPtg)]; } function getStrokeColor(_ref2) { var progressStatus = _ref2.progressStatus, successPercent = _ref2.successPercent, strokeColor = _ref2.strokeColor; var color = strokeColor || statusColorMap[progressStatus]; if (!successPercent) return color; return [statusColorMap.success, color]; } var Circle = defineComponent({ props: CircleProps, setup: function setup89(props2, _ref3) { var slots = _ref3.slots; return function() { var _wrapperClassName; var prefixCls2 = props2.prefixCls, width = props2.width, strokeWidth = props2.strokeWidth, trailColor = props2.trailColor, strokeLinecap = props2.strokeLinecap, gapPosition = props2.gapPosition, gapDegree = props2.gapDegree, type2 = props2.type; var circleSize = width || 120; var circleStyle = { width: typeof circleSize === "number" ? "".concat(circleSize, "px") : circleSize, height: typeof circleSize === "number" ? "".concat(circleSize, "px") : circleSize, fontSize: "".concat(circleSize * 0.15 + 6, "px") }; var circleWidth = strokeWidth || 6; var gapPos = gapPosition || type2 === "dashboard" && "bottom" || "top"; var gapDeg = gapDegree || type2 === "dashboard" && 75; var strokeColor = getStrokeColor(props2); var isGradient = Object.prototype.toString.call(strokeColor) === "[object Object]"; var wrapperClassName = (_wrapperClassName = {}, _defineProperty$12(_wrapperClassName, "".concat(prefixCls2, "-inner"), true), _defineProperty$12(_wrapperClassName, "".concat(prefixCls2, "-circle-gradient"), isGradient), _wrapperClassName); return createVNode("div", { "class": wrapperClassName, "style": circleStyle }, [createVNode(VCCircle, { "percent": getPercentage(props2), "strokeWidth": circleWidth, "trailWidth": circleWidth, "strokeColor": strokeColor, "strokeLinecap": strokeLinecap, "trailColor": trailColor, "prefixCls": prefixCls2, "gapDegree": gapDeg, "gapPosition": gapPos }, null), slots === null || slots === void 0 ? void 0 : slots.default()]); }; } }); var Circle$1 = Circle; var Progress$1 = defineComponent({ name: "AProgress", props: initDefaultProps$1(ProgressProps, { type: "line", percent: 0, showInfo: true, trailColor: null, size: "default", gapDegree: 0, strokeLinecap: "round" }), setup: function setup90() { return { configProvider: inject("configProvider", defaultConfigProvider) }; }, methods: { getPercentNumber: function getPercentNumber() { var _this$$props = this.$props, successPercent = _this$$props.successPercent, _this$$props$percent = _this$$props.percent, percent = _this$$props$percent === void 0 ? 0 : _this$$props$percent; return parseInt(successPercent !== void 0 ? successPercent.toString() : percent.toString(), 10); }, getProgressStatus: function getProgressStatus() { var status = this.$props.status; if (ProgressStatuses.indexOf(status) < 0 && this.getPercentNumber() >= 100) { return "success"; } return status || "normal"; }, renderProcessInfo: function renderProcessInfo(prefixCls2, progressStatus) { var _this$$props2 = this.$props, showInfo = _this$$props2.showInfo, format3 = _this$$props2.format, type2 = _this$$props2.type, percent = _this$$props2.percent, successPercent = _this$$props2.successPercent; if (!showInfo) return null; var text; var textFormatter = format3 || this.$slots.format || function(percentNumber) { return "".concat(percentNumber, "%"); }; var isLineType = type2 === "line"; if (format3 || this.$slots.format || progressStatus !== "exception" && progressStatus !== "success") { text = textFormatter(validProgress(percent), validProgress(successPercent)); } else if (progressStatus === "exception") { text = isLineType ? createVNode(CloseCircleFilled$3, null, null) : createVNode(CloseOutlined$3, null, null); } else if (progressStatus === "success") { text = isLineType ? createVNode(CheckCircleFilled$3, null, null) : createVNode(CheckOutlined$3, null, null); } return createVNode("span", { "class": "".concat(prefixCls2, "-text"), "title": typeof text === "string" ? text : void 0 }, [text]); } }, render: function render81() { var _classNames; var props2 = getOptionProps(this); var customizePrefixCls = props2.prefixCls, size = props2.size, type2 = props2.type, showInfo = props2.showInfo; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("progress", customizePrefixCls); var progressStatus = this.getProgressStatus(); var progressInfo = this.renderProcessInfo(prefixCls2, progressStatus); var progress; if (type2 === "line") { var lineProps = _extends$1(_extends$1({}, props2), { prefixCls: prefixCls2 }); progress = createVNode(Line$1, lineProps, { default: function _default8() { return [progressInfo]; } }); } else if (type2 === "circle" || type2 === "dashboard") { var circleProps = _extends$1(_extends$1({}, props2), { prefixCls: prefixCls2, progressStatus }); progress = createVNode(Circle$1, circleProps, { default: function _default8() { return [progressInfo]; } }); } var classString = classNames(prefixCls2, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-").concat(type2 === "dashboard" && "circle" || type2), true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-status-").concat(progressStatus), true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-show-info"), showInfo), _defineProperty$12(_classNames, "".concat(prefixCls2, "-").concat(size), size), _classNames)); var progressProps = { class: classString }; return createVNode("div", progressProps, [progress]); } }); var Progress = withInstall(Progress$1); function getScroll$1(w2) { var ret = w2.pageXOffset; var method3 = "scrollLeft"; if (typeof ret !== "number") { var d2 = w2.document; ret = d2.documentElement[method3]; if (typeof ret !== "number") { ret = d2.body[method3]; } } return ret; } function getClientPosition$1(elem) { var x2; var y2; var doc = elem.ownerDocument; var body = doc.body; var docElem = doc && doc.documentElement; var box = elem.getBoundingClientRect(); x2 = box.left; y2 = box.top; x2 -= docElem.clientLeft || body.clientLeft || 0; y2 -= docElem.clientTop || body.clientTop || 0; return { left: x2, top: y2 }; } function getOffsetLeft(el) { var pos = getClientPosition$1(el); var doc = el.ownerDocument; var w2 = doc.defaultView || doc.parentWindow; pos.left += getScroll$1(w2); return pos.left; } var StarFilled$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z" } }] }, "name": "star", "theme": "filled" }; var StarFilledSvg = StarFilled$2; function _objectSpread$u(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$v(target, key2, source2[key2]); }); } return target; } function _defineProperty$v(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var StarFilled = function StarFilled2(props2, context2) { var p = _objectSpread$u({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$u({}, p, { "icon": StarFilledSvg }), null); }; StarFilled.displayName = "StarFilled"; StarFilled.inheritAttrs = false; var StarFilled$1 = StarFilled; var starProps = { value: PropsTypes.number, index: PropsTypes.number, prefixCls: PropsTypes.string, allowHalf: PropsTypes.looseBool, disabled: PropsTypes.looseBool, character: PropsTypes.any, characterRender: PropsTypes.func, focused: PropsTypes.looseBool, count: PropsTypes.number, onClick: PropsTypes.func, onHover: PropsTypes.func }; var Star = defineComponent({ name: "Star", inheritAttrs: false, props: starProps, emits: ["hover", "click"], setup: function setup91(props2, _ref) { var slots = _ref.slots, emit2 = _ref.emit; var onHover = function onHover2(e2) { var index2 = props2.index; emit2("hover", e2, index2); }; var onClick7 = function onClick8(e2) { var index2 = props2.index; emit2("click", e2, index2); }; var onKeyDown11 = function onKeyDown12(e2) { var index2 = props2.index; if (e2.keyCode === 13) { emit2("click", e2, index2); } }; var cls = computed(function() { var prefixCls2 = props2.prefixCls, index2 = props2.index, value24 = props2.value, allowHalf = props2.allowHalf, focused = props2.focused; var starValue = index2 + 1; var className = prefixCls2; if (value24 === 0 && index2 === 0 && focused) { className += " ".concat(prefixCls2, "-focused"); } else if (allowHalf && value24 + 0.5 >= starValue && value24 < starValue) { className += " ".concat(prefixCls2, "-half ").concat(prefixCls2, "-active"); if (focused) { className += " ".concat(prefixCls2, "-focused"); } } else { className += starValue <= value24 ? " ".concat(prefixCls2, "-full") : " ".concat(prefixCls2, "-zero"); if (starValue === value24 && focused) { className += " ".concat(prefixCls2, "-focused"); } } return className; }); return function() { var disabled = props2.disabled, prefixCls2 = props2.prefixCls, characterRender = props2.characterRender, index2 = props2.index, count2 = props2.count, value24 = props2.value; var character = getPropsSlot(slots, props2, "character"); var star = createVNode("li", { "class": cls.value }, [createVNode("div", { "onClick": disabled ? null : onClick7, "onKeydown": disabled ? null : onKeyDown11, "onMousemove": disabled ? null : onHover, "role": "radio", "aria-checked": value24 > index2 ? "true" : "false", "aria-posinset": index2 + 1, "aria-setsize": count2, "tabindex": disabled ? -1 : 0 }, [createVNode("div", { "class": "".concat(prefixCls2, "-first") }, [character]), createVNode("div", { "class": "".concat(prefixCls2, "-second") }, [character])])]); if (characterRender) { star = characterRender(star, props2); } return star; }; } }); var useRef = function useRef2() { var refs = ref({}); var setRef = function setRef2(el, key2) { refs.value[key2] = el; }; onBeforeUpdate(function() { refs.value = {}; }); return [setRef, refs]; }; var rateProps = { prefixCls: PropsTypes.string, count: PropsTypes.number, value: PropsTypes.number, allowHalf: PropsTypes.looseBool, allowClear: PropsTypes.looseBool, tooltips: PropsTypes.arrayOf(PropsTypes.string), disabled: PropsTypes.looseBool, character: PropsTypes.any, autofocus: PropsTypes.looseBool, tabindex: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), direction: PropsTypes.string }; var Rate = defineComponent({ name: "ARate", inheritAttrs: false, props: initDefaultProps$2(rateProps, { value: 0, count: 5, allowHalf: false, allowClear: true, prefixCls: "ant-rate", tabindex: 0, direction: "ltr" }), emits: ["hoverChange", "update:value", "change", "focus", "blur", "keydown"], setup: function setup92(props2, _ref) { var slots = _ref.slots, attrs = _ref.attrs, emit2 = _ref.emit, expose = _ref.expose; var _useConfigInject = useConfigInject("rate", props2), prefixCls2 = _useConfigInject.prefixCls, direction = _useConfigInject.direction; var rateRef = ref(); var _useRef = useRef(), _useRef2 = _slicedToArray$4(_useRef, 2), setRef = _useRef2[0], starRefs = _useRef2[1]; var state = reactive({ value: props2.value, focused: false, cleanedValue: null, hoverValue: void 0 }); watch(function() { return props2.value; }, function() { state.value = props2.value; }); var getStarDOM = function getStarDOM2(index2) { return findDOMNode(starRefs.value[index2]); }; var getStarValue = function getStarValue2(index2, x2) { var reverse = direction.value === "rtl"; var value24 = index2 + 1; if (props2.allowHalf) { var starEle = getStarDOM(index2); var leftDis = getOffsetLeft(starEle); var width = starEle.clientWidth; if (reverse && x2 - leftDis > width / 2) { value24 -= 0.5; } else if (!reverse && x2 - leftDis < width / 2) { value24 -= 0.5; } } return value24; }; var changeValue = function changeValue2(value24) { if (props2.value === void 0) { state.value = value24; } emit2("update:value", value24); emit2("change", value24); }; var onHover = function onHover2(e2, index2) { var hoverValue2 = getStarValue(index2, e2.pageX); if (hoverValue2 !== state.cleanedValue) { state.hoverValue = hoverValue2; state.cleanedValue = null; } emit2("hoverChange", hoverValue2); }; var onMouseLeave5 = function onMouseLeave6() { state.hoverValue = void 0; state.cleanedValue = null; emit2("hoverChange", void 0); }; var onClick7 = function onClick8(event, index2) { var allowClear = props2.allowClear; var newValue = getStarValue(index2, event.pageX); var isReset = false; if (allowClear) { isReset = newValue === state.value; } onMouseLeave5(); changeValue(isReset ? 0 : newValue); state.cleanedValue = isReset ? newValue : null; }; var onFocus5 = function onFocus6() { state.focused = true; emit2("focus"); }; var onBlur6 = function onBlur7() { state.focused = false; emit2("blur"); }; var onKeyDown11 = function onKeyDown12(event) { var keyCode = event.keyCode; var count2 = props2.count, allowHalf = props2.allowHalf; var reverse = direction.value === "rtl"; if (keyCode === KeyCode$1.RIGHT && state.value < count2 && !reverse) { if (allowHalf) { state.value += 0.5; } else { state.value += 1; } changeValue(state.value); event.preventDefault(); } else if (keyCode === KeyCode$1.LEFT && state.value > 0 && !reverse) { if (allowHalf) { state.value -= 0.5; } else { state.value -= 1; } changeValue(state.value); event.preventDefault(); } else if (keyCode === KeyCode$1.RIGHT && state.value > 0 && reverse) { if (allowHalf) { state.value -= 0.5; } else { state.value -= 1; } changeValue(state.value); event.preventDefault(); } else if (keyCode === KeyCode$1.LEFT && state.value < count2 && reverse) { if (allowHalf) { state.value += 0.5; } else { state.value += 1; } changeValue(state.value); event.preventDefault(); } emit2("keydown", event); }; var focus25 = function focus26() { if (!props2.disabled) { rateRef.value.focus(); } }; var blur22 = function blur23() { if (!props2.disabled) { rateRef.value.blur(); } }; expose({ focus: focus25, blur: blur22 }); onMounted(function() { var autofocus = props2.autofocus, disabled = props2.disabled; if (autofocus && !disabled) { focus25(); } }); var characterRender = function characterRender2(node, _ref2) { var index2 = _ref2.index; var tooltips = props2.tooltips; if (!tooltips) return node; return createVNode(Tooltip, { "title": tooltips[index2] }, { default: function _default8() { return [node]; } }); }; var character = getPropsSlot(slots, props2, "character") || createVNode(StarFilled$1, null, null); return function() { var count2 = props2.count, allowHalf = props2.allowHalf, disabled = props2.disabled, tabindex = props2.tabindex; var className = attrs.class, style = attrs.style; var stars = []; var disabledClass = disabled ? "".concat(prefixCls2.value, "-disabled") : ""; var _loop = function _loop2(index3) { stars.push(createVNode(Star, { "ref": function ref2(r2) { return setRef(r2, index3); }, "key": index3, "index": index3, "count": count2, "disabled": disabled, "prefixCls": "".concat(prefixCls2.value, "-star"), "allowHalf": allowHalf, "value": state.hoverValue === void 0 ? state.value : state.hoverValue, "onClick": onClick7, "onHover": onHover, "character": character, "characterRender": characterRender, "focused": state.focused }, null)); }; for (var index2 = 0; index2 < count2; index2++) { _loop(index2); } var rateClassName = classNames(prefixCls2.value, disabledClass, className, _defineProperty$12({}, "".concat(prefixCls2.value, "-rtl"), direction.value === "rtl")); return createVNode("ul", _objectSpread2$2(_objectSpread2$2({}, attrs), {}, { "class": rateClassName, "style": style, "onMouseleave": disabled ? null : onMouseLeave5, "tabindex": disabled ? -1 : tabindex, "onFocus": disabled ? null : onFocus5, "onBlur": disabled ? null : onBlur6, "onKeydown": disabled ? null : onKeyDown11, "ref": rateRef, "role": "radiogroup" }), [stars]); }; } }); var Rate$1 = withInstall(Rate); var SkeletonButton = defineComponent({ name: "ASkeletonButton", props: _extends$1(_extends$1({}, skeletonElementProps()), { size: PropsTypes.oneOf(tuple("large", "small", "default")) }), setup: function setup93(props2) { var _useConfigInject = useConfigInject("skeleton", props2), prefixCls2 = _useConfigInject.prefixCls; var cls = computed(function() { return classNames(prefixCls2.value, "".concat(prefixCls2.value, "-element"), _defineProperty$12({}, "".concat(prefixCls2.value, "-active"), props2.active)); }); return function() { return createVNode("div", { "class": cls.value }, [createVNode(Element$2, _objectSpread2$2(_objectSpread2$2({}, props2), {}, { "prefixCls": "".concat(prefixCls2.value, "-button") }), null)]); }; } }); var SkeletonButton$1 = SkeletonButton; var SkeletonInput = defineComponent({ name: "ASkeletonInput", props: _extends$1(_extends$1({}, omit(skeletonElementProps(), "shape")), { size: PropsTypes.oneOf(tuple("large", "small", "default")) }), setup: function setup94(props2) { var _useConfigInject = useConfigInject("skeleton", props2), prefixCls2 = _useConfigInject.prefixCls; var cls = computed(function() { return classNames(prefixCls2.value, "".concat(prefixCls2.value, "-element"), _defineProperty$12({}, "".concat(prefixCls2.value, "-active"), props2.active)); }); return function() { return createVNode("div", { "class": cls.value }, [createVNode(Element$2, _objectSpread2$2(_objectSpread2$2({}, props2), {}, { "prefixCls": "".concat(prefixCls2.value, "-input") }), null)]); }; } }); var SkeletonInput$1 = SkeletonInput; var path = "M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z"; var SkeletonImage = defineComponent({ name: "ASkeletonImage", props: skeletonElementProps(), setup: function setup95(props2) { var _useConfigInject = useConfigInject("skeleton", props2), prefixCls2 = _useConfigInject.prefixCls; var cls = computed(function() { return classNames(prefixCls2.value, "".concat(prefixCls2.value, "-element")); }); return function() { return createVNode("div", { "class": cls.value }, [createVNode("div", { "class": "".concat(prefixCls2.value, "-image") }, [createVNode("svg", { "viewBox": "0 0 1098 1024", "xmlns": "http://www.w3.org/2000/svg", "class": "".concat(prefixCls2.value, "-image-svg") }, [createVNode("path", { "d": path, "class": "".concat(prefixCls2.value, "-image-path") }, null)])])]); }; } }); var SkeletonImage$1 = SkeletonImage; Skeleton$1.Button = SkeletonButton$1; Skeleton$1.Avatar = SkeletonAvatar$1; Skeleton$1.Input = SkeletonInput$1; Skeleton$1.Image = SkeletonImage$1; Skeleton$1.install = function(app) { app.component(Skeleton$1.name, Skeleton$1); app.component(Skeleton$1.Button.name, SkeletonButton$1); app.component(Skeleton$1.Avatar.name, SkeletonAvatar$1); app.component(Skeleton$1.Input.name, SkeletonInput$1); app.component(Skeleton$1.Image.name, SkeletonImage$1); return app; }; var Track = function Track2(_2, _ref) { var _ref2, _ref3; var attrs = _ref.attrs; var included = attrs.included, vertical = attrs.vertical, offset4 = attrs.offset, length = attrs.length, reverse = attrs.reverse, style = attrs.style, className = attrs.class; var positonStyle = vertical ? (_ref2 = {}, _defineProperty$12(_ref2, reverse ? "top" : "bottom", "".concat(offset4, "%")), _defineProperty$12(_ref2, reverse ? "bottom" : "top", "auto"), _defineProperty$12(_ref2, "height", "".concat(length, "%")), _ref2) : (_ref3 = {}, _defineProperty$12(_ref3, reverse ? "right" : "left", "".concat(offset4, "%")), _defineProperty$12(_ref3, reverse ? "left" : "right", "auto"), _defineProperty$12(_ref3, "width", "".concat(length, "%")), _ref3); var elStyle = _extends$1(_extends$1({}, style), positonStyle); return included ? createVNode("div", { "class": className, "style": elStyle }, null) : null; }; Track.inheritAttrs = false; var Track$1 = Track; var calcPoints = function calcPoints2(vertical, marks, dots, step, min4, max4) { warning$5(dots ? step > 0 : true, "Slider", "`Slider[step]` should be a positive number in order to make Slider[dots] work."); var points = Object.keys(marks).map(parseFloat).sort(function(a2, b2) { return a2 - b2; }); if (dots && step) { for (var i2 = min4; i2 <= max4; i2 += step) { if (points.indexOf(i2) === -1) { points.push(i2); } } } return points; }; var Steps = function Steps2(_2, _ref) { var attrs = _ref.attrs; var prefixCls2 = attrs.prefixCls, vertical = attrs.vertical, reverse = attrs.reverse, marks = attrs.marks, dots = attrs.dots, step = attrs.step, included = attrs.included, lowerBound = attrs.lowerBound, upperBound = attrs.upperBound, max4 = attrs.max, min4 = attrs.min, dotStyle = attrs.dotStyle, activeDotStyle = attrs.activeDotStyle; var range2 = max4 - min4; var elements = calcPoints(vertical, marks, dots, step, min4, max4).map(function(point) { var _classNames; var offset4 = "".concat(Math.abs(point - min4) / range2 * 100, "%"); var isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound; var style = vertical ? _extends$1(_extends$1({}, dotStyle), _defineProperty$12({}, reverse ? "top" : "bottom", offset4)) : _extends$1(_extends$1({}, dotStyle), _defineProperty$12({}, reverse ? "right" : "left", offset4)); if (isActived) { style = _extends$1(_extends$1({}, style), activeDotStyle); } var pointClassName = classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-dot"), true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-dot-active"), isActived), _defineProperty$12(_classNames, "".concat(prefixCls2, "-dot-reverse"), reverse), _classNames)); return createVNode("span", { "class": pointClassName, "style": style, "key": point }, null); }); return createVNode("div", { "class": "".concat(prefixCls2, "-step") }, [elements]); }; Steps.inheritAttrs = false; var Steps$1 = Steps; var Marks = function Marks2(_2, _ref) { var attrs = _ref.attrs; var className = attrs.class, vertical = attrs.vertical, reverse = attrs.reverse, marks = attrs.marks, included = attrs.included, upperBound = attrs.upperBound, lowerBound = attrs.lowerBound, max4 = attrs.max, min4 = attrs.min, onClickLabel = attrs.onClickLabel; var marksKeys = Object.keys(marks); var range2 = max4 - min4; var elements = marksKeys.map(parseFloat).sort(function(a2, b2) { return a2 - b2; }).map(function(point) { var _classNames; var markPoint = typeof marks[point] === "function" ? marks[point](h) : marks[point]; var markPointIsObject = _typeof$2(markPoint) === "object" && !isValidElement(markPoint); var markLabel = markPointIsObject ? markPoint.label : markPoint; if (!markLabel && markLabel !== 0) { return null; } var isActive = !included && point === upperBound || included && point <= upperBound && point >= lowerBound; var markClassName = classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(className, "-text"), true), _defineProperty$12(_classNames, "".concat(className, "-text-active"), isActive), _classNames)); var bottomStyle = _defineProperty$12({ marginBottom: "-50%" }, reverse ? "top" : "bottom", "".concat((point - min4) / range2 * 100, "%")); var leftStyle = _defineProperty$12({ transform: "translateX(-50%)", msTransform: "translateX(-50%)" }, reverse ? "right" : "left", reverse ? "".concat((point - min4 / 4) / range2 * 100, "%") : "".concat((point - min4) / range2 * 100, "%")); var style = vertical ? bottomStyle : leftStyle; var markStyle = markPointIsObject ? _extends$1(_extends$1({}, style), markPoint.style) : style; var touchEvents = _defineProperty$12({}, supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart", function(e2) { return onClickLabel(e2, point); }); return createVNode("span", _objectSpread2$2({ "class": markClassName, "style": markStyle, "key": point, "onMousedown": function onMousedown2(e2) { return onClickLabel(e2, point); } }, touchEvents), [markLabel]); }); return createVNode("div", { "class": className }, [elements]); }; Marks.inheritAttrs = false; var Marks$1 = Marks; var VcHandle = defineComponent({ name: "Handle", mixins: [BaseMixin], inheritAttrs: false, props: { prefixCls: PropsTypes.string, vertical: PropsTypes.looseBool, offset: PropsTypes.number, disabled: PropsTypes.looseBool, min: PropsTypes.number, max: PropsTypes.number, value: PropsTypes.number, tabindex: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), reverse: PropsTypes.looseBool }, data: function data48() { return { clickFocused: false }; }, mounted: function mounted26() { this.onMouseUpListener = addEventListenerWrap(document, "mouseup", this.handleMouseUp); }, beforeUnmount: function beforeUnmount17() { if (this.onMouseUpListener) { this.onMouseUpListener.remove(); } }, methods: { setHandleRef: function setHandleRef(node) { this.handle = node; }, setClickFocus: function setClickFocus(focused) { this.setState({ clickFocused: focused }); }, handleMouseUp: function handleMouseUp() { if (document.activeElement === this.handle) { this.setClickFocus(true); } }, handleBlur: function handleBlur2(e2) { this.setClickFocus(false); this.__emit("blur", e2); }, handleKeyDown: function handleKeyDown6() { this.setClickFocus(false); }, clickFocus: function clickFocus() { this.setClickFocus(true); this.focus(); }, focus: function focus18() { this.handle.focus(); }, blur: function blur15() { this.handle.blur(); }, handleMousedown: function handleMousedown(e2) { this.focus(); this.__emit("mousedown", e2); } }, render: function render82() { var _ref, _ref2; var _getOptionProps = getOptionProps(this), prefixCls2 = _getOptionProps.prefixCls, vertical = _getOptionProps.vertical, reverse = _getOptionProps.reverse, offset4 = _getOptionProps.offset, disabled = _getOptionProps.disabled, min4 = _getOptionProps.min, max4 = _getOptionProps.max, value24 = _getOptionProps.value, tabindex = _getOptionProps.tabindex; var className = classNames(this.$attrs.class, _defineProperty$12({}, "".concat(prefixCls2, "-handle-click-focused"), this.clickFocused)); var positionStyle = vertical ? (_ref = {}, _defineProperty$12(_ref, reverse ? "top" : "bottom", "".concat(offset4, "%")), _defineProperty$12(_ref, reverse ? "bottom" : "top", "auto"), _defineProperty$12(_ref, "transform", "translateY(+50%)"), _ref) : (_ref2 = {}, _defineProperty$12(_ref2, reverse ? "right" : "left", "".concat(offset4, "%")), _defineProperty$12(_ref2, reverse ? "left" : "right", "auto"), _defineProperty$12(_ref2, "transform", "translateX(".concat(reverse ? "+" : "-", "50%)")), _ref2); var ariaProps = { "aria-valuemin": min4, "aria-valuemax": max4, "aria-valuenow": value24, "aria-disabled": !!disabled }; var elStyle = _extends$1(_extends$1({}, this.$attrs.style), positionStyle); var _tabIndex = tabindex || 0; if (disabled || tabindex === null) { _tabIndex = null; } var handleProps = _extends$1(_extends$1(_extends$1(_extends$1({}, this.$attrs), { role: "slider", tabindex: _tabIndex }), ariaProps), { class: className, onBlur: this.handleBlur, onKeydown: this.handleKeyDown, onMousedown: this.handleMousedown, ref: this.setHandleRef, style: elStyle }); return createVNode("div", handleProps, null); } }); function isEventFromHandle(e2, handles) { try { return Object.keys(handles).some(function(key2) { return e2.target === findDOMNode(handles[key2]) || e2.target === handles[key2]; }); } catch (error3) { return false; } } function isValueOutOfRange(value24, _ref) { var min4 = _ref.min, max4 = _ref.max; return value24 < min4 || value24 > max4; } function isNotTouchEvent(e2) { return e2.touches.length > 1 || e2.type.toLowerCase() === "touchend" && e2.touches.length > 0; } function getClosestPoint(val, _ref2) { var marks = _ref2.marks, step = _ref2.step, min4 = _ref2.min, max4 = _ref2.max; var points = Object.keys(marks).map(parseFloat); if (step !== null) { var base = Math.pow(10, getPrecision(step)); var maxSteps = Math.floor((max4 * base - min4 * base) / (step * base)); var steps = Math.min((val - min4) / step, maxSteps); var closestStep = Math.round(steps) * step + min4; points.push(closestStep); } var diffs = points.map(function(point) { return Math.abs(val - point); }); return points[diffs.indexOf(Math.min.apply(Math, _toConsumableArray(diffs)))]; } function getPrecision(step) { var stepString = step.toString(); var precision = 0; if (stepString.indexOf(".") >= 0) { precision = stepString.length - stepString.indexOf(".") - 1; } return precision; } function getMousePosition(vertical, e2) { var zoom = 1; if (window.visualViewport) { zoom = +(window.visualViewport.width / document.body.getBoundingClientRect().width).toFixed(2); } return (vertical ? e2.clientY : e2.pageX) / zoom; } function getTouchPosition(vertical, e2) { var zoom = 1; if (window.visualViewport) { zoom = +(window.visualViewport.width / document.body.getBoundingClientRect().width).toFixed(2); } return (vertical ? e2.touches[0].clientY : e2.touches[0].pageX) / zoom; } function getHandleCenterPosition(vertical, handle) { var coords = handle.getBoundingClientRect(); return vertical ? coords.top + coords.height * 0.5 : window.pageXOffset + coords.left + coords.width * 0.5; } function ensureValueInRange(val, _ref3) { var max4 = _ref3.max, min4 = _ref3.min; if (val <= min4) { return min4; } if (val >= max4) { return max4; } return val; } function ensureValuePrecision(val, props2) { var step = props2.step; var closestPoint = isFinite(getClosestPoint(val, props2)) ? getClosestPoint(val, props2) : 0; return step === null ? closestPoint : parseFloat(closestPoint.toFixed(getPrecision(step))); } function pauseEvent(e2) { e2.stopPropagation(); e2.preventDefault(); } function calculateNextValue(func, value24, props2) { var operations = { increase: function increase(a2, b2) { return a2 + b2; }, decrease: function decrease(a2, b2) { return a2 - b2; } }; var indexToGet = operations[func](Object.keys(props2.marks).indexOf(JSON.stringify(value24)), 1); var keyToGet = Object.keys(props2.marks)[indexToGet]; if (props2.step) { return operations[func](value24, props2.step); } else if (!!Object.keys(props2.marks).length && !!props2.marks[keyToGet]) { return props2.marks[keyToGet]; } return value24; } function getKeyboardValueMutator(e2, vertical, reverse) { var increase = "increase"; var decrease = "decrease"; var method3 = increase; switch (e2.keyCode) { case KeyCode$1.UP: method3 = vertical && reverse ? decrease : increase; break; case KeyCode$1.RIGHT: method3 = !vertical && reverse ? decrease : increase; break; case KeyCode$1.DOWN: method3 = vertical && reverse ? increase : decrease; break; case KeyCode$1.LEFT: method3 = !vertical && reverse ? increase : decrease; break; case KeyCode$1.END: return function(value24, props2) { return props2.max; }; case KeyCode$1.HOME: return function(value24, props2) { return props2.min; }; case KeyCode$1.PAGE_UP: return function(value24, props2) { return value24 + props2.step * 2; }; case KeyCode$1.PAGE_DOWN: return function(value24, props2) { return value24 - props2.step * 2; }; default: return void 0; } return function(value24, props2) { return calculateNextValue(method3, value24, props2); }; } var __rest$c = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; function noop$5() { } function createSlider(Component) { var propTypes2 = { min: PropsTypes.number, max: PropsTypes.number, step: PropsTypes.number, marks: PropsTypes.object, included: PropsTypes.looseBool, prefixCls: PropsTypes.string, disabled: PropsTypes.looseBool, handle: PropsTypes.func, dots: PropsTypes.looseBool, vertical: PropsTypes.looseBool, reverse: PropsTypes.looseBool, minimumTrackStyle: PropsTypes.object, maximumTrackStyle: PropsTypes.object, handleStyle: PropsTypes.oneOfType([PropsTypes.object, PropsTypes.arrayOf(PropsTypes.object)]), trackStyle: PropsTypes.oneOfType([PropsTypes.object, PropsTypes.arrayOf(PropsTypes.object)]), railStyle: PropsTypes.object, dotStyle: PropsTypes.object, activeDotStyle: PropsTypes.object, autofocus: PropsTypes.looseBool }; return defineComponent({ name: "CreateSlider", mixins: [BaseMixin, Component], inheritAttrs: false, props: initDefaultProps$2(propTypes2, { prefixCls: "rc-slider", min: 0, max: 100, step: 1, marks: {}, included: true, disabled: false, dots: false, vertical: false, reverse: false, trackStyle: [{}], handleStyle: [{}], railStyle: {}, dotStyle: {}, activeDotStyle: {} }), data: function data65() { var step = this.step, max4 = this.max, min4 = this.min; var isPointDiffEven = isFinite(max4 - min4) ? (max4 - min4) % step === 0 : true; warning$5(step && Math.floor(step) === step ? isPointDiffEven : true, "Slider", "Slider[max] - Slider[min] (%s) should be a multiple of Slider[step] (%s)", max4 - min4, step); this.handlesRefs = {}; return {}; }, mounted: function mounted36() { var _this = this; this.$nextTick(function() { _this.document = _this.sliderRef && _this.sliderRef.ownerDocument; var autofocus = _this.autofocus, disabled = _this.disabled; if (autofocus && !disabled) { _this.focus(); } }); }, beforeUnmount: function beforeUnmount23() { var _this2 = this; this.$nextTick(function() { _this2.removeDocumentEvents(); }); }, methods: { defaultHandle: function defaultHandle(_a3) { var index2 = _a3.index; _a3.directives; var className = _a3.className, style = _a3.style, restProps = __rest$c(_a3, ["index", "directives", "className", "style"]); delete restProps.dragging; if (restProps.value === null) { return null; } var handleProps = _extends$1(_extends$1({}, restProps), { class: className, style, key: index2 }); return createVNode(VcHandle, handleProps, null); }, onMouseDown: function onMouseDown3(e2) { if (e2.button !== 0) { return; } var isVertical = this.vertical; var position2 = getMousePosition(isVertical, e2); if (!isEventFromHandle(e2, this.handlesRefs)) { this.dragOffset = 0; } else { var handlePosition = getHandleCenterPosition(isVertical, e2.target); this.dragOffset = position2 - handlePosition; position2 = handlePosition; } this.removeDocumentEvents(); this.onStart(position2); this.addDocumentMouseEvents(); pauseEvent(e2); }, onTouchStart: function onTouchStart2(e2) { if (isNotTouchEvent(e2)) return; var isVertical = this.vertical; var position2 = getTouchPosition(isVertical, e2); if (!isEventFromHandle(e2, this.handlesRefs)) { this.dragOffset = 0; } else { var handlePosition = getHandleCenterPosition(isVertical, e2.target); this.dragOffset = position2 - handlePosition; position2 = handlePosition; } this.onStart(position2); this.addDocumentTouchEvents(); pauseEvent(e2); }, onFocus: function onFocus5(e2) { var vertical = this.vertical; if (isEventFromHandle(e2, this.handlesRefs)) { var handlePosition = getHandleCenterPosition(vertical, e2.target); this.dragOffset = 0; this.onStart(handlePosition); pauseEvent(e2); this.__emit("focus", e2); } }, onBlur: function onBlur6(e2) { this.onEnd(); this.__emit("blur", e2); }, onMouseUp: function onMouseUp3() { if (this.handlesRefs[this.prevMovedHandleIndex]) { this.handlesRefs[this.prevMovedHandleIndex].clickFocus(); } }, onMouseMove: function onMouseMove3(e2) { if (!this.sliderRef) { this.onEnd(); return; } var position2 = getMousePosition(this.vertical, e2); this.onMove(e2, position2 - this.dragOffset); }, onTouchMove: function onTouchMove2(e2) { if (isNotTouchEvent(e2) || !this.sliderRef) { this.onEnd(); return; } var position2 = getTouchPosition(this.vertical, e2); this.onMove(e2, position2 - this.dragOffset); }, onKeyDown: function onKeyDown11(e2) { if (this.sliderRef && isEventFromHandle(e2, this.handlesRefs)) { this.onKeyboard(e2); } }, onClickMarkLabel: function onClickMarkLabel(e2, value24) { var _this3 = this; e2.stopPropagation(); this.onChange({ sValue: value24 }); this.setState({ sValue: value24 }, function() { return _this3.onEnd(true); }); }, getSliderStart: function getSliderStart() { var slider = this.sliderRef; var vertical = this.vertical, reverse = this.reverse; var rect = slider.getBoundingClientRect(); if (vertical) { return reverse ? rect.bottom : rect.top; } return window.pageXOffset + (reverse ? rect.right : rect.left); }, getSliderLength: function getSliderLength() { var slider = this.sliderRef; if (!slider) { return 0; } var coords = slider.getBoundingClientRect(); return this.vertical ? coords.height : coords.width; }, addDocumentTouchEvents: function addDocumentTouchEvents() { this.onTouchMoveListener = addEventListenerWrap(this.document, "touchmove", this.onTouchMove); this.onTouchUpListener = addEventListenerWrap(this.document, "touchend", this.onEnd); }, addDocumentMouseEvents: function addDocumentMouseEvents() { this.onMouseMoveListener = addEventListenerWrap(this.document, "mousemove", this.onMouseMove); this.onMouseUpListener = addEventListenerWrap(this.document, "mouseup", this.onEnd); }, removeDocumentEvents: function removeDocumentEvents() { this.onTouchMoveListener && this.onTouchMoveListener.remove(); this.onTouchUpListener && this.onTouchUpListener.remove(); this.onMouseMoveListener && this.onMouseMoveListener.remove(); this.onMouseUpListener && this.onMouseUpListener.remove(); }, focus: function focus25() { if (!this.disabled) { this.handlesRefs[0].focus(); } }, blur: function blur22() { var _this4 = this; if (!this.disabled) { Object.keys(this.handlesRefs).forEach(function(key2) { if (_this4.handlesRefs[key2] && _this4.handlesRefs[key2].blur) { _this4.handlesRefs[key2].blur(); } }); } }, calcValue: function calcValue(offset4) { var vertical = this.vertical, min4 = this.min, max4 = this.max; var ratio = Math.abs(Math.max(offset4, 0) / this.getSliderLength()); var value24 = vertical ? (1 - ratio) * (max4 - min4) + min4 : ratio * (max4 - min4) + min4; return value24; }, calcValueByPos: function calcValueByPos(position2) { var sign2 = this.reverse ? -1 : 1; var pixelOffset = sign2 * (position2 - this.getSliderStart()); var nextValue = this.trimAlignValue(this.calcValue(pixelOffset)); return nextValue; }, calcOffset: function calcOffset(value24) { var min4 = this.min, max4 = this.max; var ratio = (value24 - min4) / (max4 - min4); return ratio * 100; }, saveSlider: function saveSlider2(slider) { this.sliderRef = slider; }, saveHandle: function saveHandle(index2, handle) { this.handlesRefs[index2] = handle; } }, render: function render123() { var _classNames; var prefixCls2 = this.prefixCls, marks = this.marks, dots = this.dots, step = this.step, included = this.included, disabled = this.disabled, vertical = this.vertical, reverse = this.reverse, min4 = this.min, max4 = this.max, maximumTrackStyle = this.maximumTrackStyle, railStyle = this.railStyle, dotStyle = this.dotStyle, activeDotStyle = this.activeDotStyle; var _this$$attrs = this.$attrs, className = _this$$attrs.class, style = _this$$attrs.style, id2 = _this$$attrs.id; var _this$renderSlider = this.renderSlider(), tracks = _this$renderSlider.tracks, handles = _this$renderSlider.handles; var sliderClassName = classNames(prefixCls2, className, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-with-marks"), Object.keys(marks).length), _defineProperty$12(_classNames, "".concat(prefixCls2, "-disabled"), disabled), _defineProperty$12(_classNames, "".concat(prefixCls2, "-vertical"), vertical), _classNames)); var markProps = { vertical, marks, included, lowerBound: this.getLowerBound(), upperBound: this.getUpperBound(), max: max4, min: min4, reverse, class: "".concat(prefixCls2, "-mark"), onClickLabel: disabled ? noop$5 : this.onClickMarkLabel }; var touchEvents = _defineProperty$12({}, supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart", disabled ? noop$5 : this.onTouchStart); return createVNode("div", _objectSpread2$2(_objectSpread2$2({ "id": id2, "ref": this.saveSlider, "tabindex": "-1", "class": sliderClassName }, touchEvents), {}, { "onMousedown": disabled ? noop$5 : this.onMouseDown, "onMouseup": disabled ? noop$5 : this.onMouseUp, "onKeydown": disabled ? noop$5 : this.onKeyDown, "onFocus": disabled ? noop$5 : this.onFocus, "onBlur": disabled ? noop$5 : this.onBlur, "style": style }), [createVNode("div", { "class": "".concat(prefixCls2, "-rail"), "style": _extends$1(_extends$1({}, maximumTrackStyle), railStyle) }, null), tracks, createVNode(Steps$1, { "prefixCls": prefixCls2, "vertical": vertical, "reverse": reverse, "marks": marks, "dots": dots, "step": step, "included": included, "lowerBound": this.getLowerBound(), "upperBound": this.getUpperBound(), "max": max4, "min": min4, "dotStyle": dotStyle, "activeDotStyle": activeDotStyle }, null), handles, createVNode(Marks$1, markProps, null), getSlot$1(this)]); } }); } var Slider$2 = defineComponent({ name: "Slider", mixins: [BaseMixin], inheritAttrs: false, props: { defaultValue: PropsTypes.number, value: PropsTypes.number, disabled: PropsTypes.looseBool, autofocus: PropsTypes.looseBool, tabindex: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]), reverse: PropsTypes.looseBool, min: PropsTypes.number, max: PropsTypes.number }, data: function data49() { var defaultValue = this.defaultValue !== void 0 ? this.defaultValue : this.min; var value24 = this.value !== void 0 ? this.value : defaultValue; return { sValue: this.trimAlignValue(value24), dragging: false }; }, watch: { value: { handler: function handler2(val) { this.setChangeValue(val); }, deep: true }, min: function min2() { var sValue = this.sValue; this.setChangeValue(sValue); }, max: function max2() { var sValue = this.sValue; this.setChangeValue(sValue); } }, methods: { setChangeValue: function setChangeValue(value24) { var newValue = value24 !== void 0 ? value24 : this.sValue; var nextValue = this.trimAlignValue(newValue, this.$props); if (nextValue === this.sValue) return; this.setState({ sValue: nextValue }); if (isValueOutOfRange(newValue, this.$props)) { this.__emit("change", nextValue); } }, onChange: function onChange4(state) { var isNotControlled = !hasProp(this, "value"); var nextState = state.sValue > this.max ? _extends$1(_extends$1({}, state), { sValue: this.max }) : state; if (isNotControlled) { this.setState(nextState); } var changedValue = nextState.sValue; this.__emit("change", changedValue); }, onStart: function onStart(position2) { this.setState({ dragging: true }); var sValue = this.sValue; this.__emit("beforeChange", sValue); var value24 = this.calcValueByPos(position2); this.startValue = value24; this.startPosition = position2; if (value24 === sValue) return; this.prevMovedHandleIndex = 0; this.onChange({ sValue: value24 }); }, onEnd: function onEnd(force) { var dragging = this.dragging; this.removeDocumentEvents(); if (dragging || force) { this.__emit("afterChange", this.sValue); } this.setState({ dragging: false }); }, onMove: function onMove(e2, position2) { pauseEvent(e2); var sValue = this.sValue; var value24 = this.calcValueByPos(position2); if (value24 === sValue) return; this.onChange({ sValue: value24 }); }, onKeyboard: function onKeyboard(e2) { var _this$$props = this.$props, reverse = _this$$props.reverse, vertical = _this$$props.vertical; var valueMutator = getKeyboardValueMutator(e2, vertical, reverse); if (valueMutator) { pauseEvent(e2); var sValue = this.sValue; var mutatedValue = valueMutator(sValue, this.$props); var value24 = this.trimAlignValue(mutatedValue); if (value24 === sValue) return; this.onChange({ sValue: value24 }); this.__emit("afterChange", value24); this.onEnd(); } }, getLowerBound: function getLowerBound() { return this.min; }, getUpperBound: function getUpperBound() { return this.sValue; }, trimAlignValue: function trimAlignValue(v2) { var nextProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (v2 === null) { return null; } var mergedProps = _extends$1(_extends$1({}, this.$props), nextProps); var val = ensureValueInRange(v2, mergedProps); return ensureValuePrecision(val, mergedProps); }, getTrack: function getTrack(_ref) { var prefixCls2 = _ref.prefixCls, reverse = _ref.reverse, vertical = _ref.vertical, included = _ref.included, offset4 = _ref.offset, minimumTrackStyle = _ref.minimumTrackStyle, _trackStyle = _ref._trackStyle; return createVNode(Track$1, { "class": "".concat(prefixCls2, "-track"), "vertical": vertical, "included": included, "offset": 0, "reverse": reverse, "length": offset4, "style": _extends$1(_extends$1({}, minimumTrackStyle), _trackStyle) }, null); }, renderSlider: function renderSlider() { var _this = this; var prefixCls2 = this.prefixCls, vertical = this.vertical, included = this.included, disabled = this.disabled, minimumTrackStyle = this.minimumTrackStyle, trackStyle = this.trackStyle, handleStyle = this.handleStyle, tabindex = this.tabindex, min4 = this.min, max4 = this.max, reverse = this.reverse, handle = this.handle, defaultHandle = this.defaultHandle; var handleGenerator = handle || defaultHandle; var sValue = this.sValue, dragging = this.dragging; var offset4 = this.calcOffset(sValue); var handles = handleGenerator({ class: "".concat(prefixCls2, "-handle"), prefixCls: prefixCls2, vertical, offset: offset4, value: sValue, dragging, disabled, min: min4, max: max4, reverse, index: 0, tabindex, style: handleStyle[0] || handleStyle, ref: function ref2(h2) { return _this.saveHandle(0, h2); }, onFocus: this.onFocus, onBlur: this.onBlur }); var _trackStyle = trackStyle[0] || trackStyle; return { tracks: this.getTrack({ prefixCls: prefixCls2, reverse, vertical, included, offset: offset4, minimumTrackStyle, _trackStyle }), handles }; } } }); var VcSlider = createSlider(Slider$2); var _trimAlignValue = function trimAlignValue2(_ref) { var value24 = _ref.value, handle = _ref.handle, bounds = _ref.bounds, props2 = _ref.props; var allowCross = props2.allowCross, pushable = props2.pushable; var thershold = Number(pushable); var valInRange = ensureValueInRange(value24, props2); var valNotConflict = valInRange; if (!allowCross && handle != null && bounds !== void 0) { if (handle > 0 && valInRange <= bounds[handle - 1] + thershold) { valNotConflict = bounds[handle - 1] + thershold; } if (handle < bounds.length - 1 && valInRange >= bounds[handle + 1] - thershold) { valNotConflict = bounds[handle + 1] - thershold; } } return ensureValuePrecision(valNotConflict, props2); }; var rangeProps = { defaultValue: PropsTypes.arrayOf(PropsTypes.number), value: PropsTypes.arrayOf(PropsTypes.number), count: PropsTypes.number, pushable: withUndefined(PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.number])), allowCross: PropsTypes.looseBool, disabled: PropsTypes.looseBool, reverse: PropsTypes.looseBool, tabindex: PropsTypes.arrayOf(PropsTypes.number), prefixCls: PropsTypes.string, min: PropsTypes.number, max: PropsTypes.number, autofocus: PropsTypes.looseBool }; var Range$1 = { name: "Range", inheritAttrs: false, displayName: "Range", mixins: [BaseMixin], props: initDefaultProps$2(rangeProps, { count: 1, allowCross: true, pushable: false, tabindex: [] }), data: function data50() { var _this = this; var count2 = this.count, min4 = this.min, max4 = this.max; var initialValue = Array.apply(void 0, _toConsumableArray(Array(count2 + 1))).map(function() { return min4; }); var defaultValue = hasProp(this, "defaultValue") ? this.defaultValue : initialValue; var value24 = this.value; if (value24 === void 0) { value24 = defaultValue; } var bounds = value24.map(function(v2, i2) { return _trimAlignValue({ value: v2, handle: i2, props: _this.$props }); }); var recent = bounds[0] === max4 ? 0 : bounds.length - 1; return { sHandle: null, recent, bounds }; }, watch: { value: { handler: function handler3(val) { var bounds = this.bounds; this.setChangeValue(val || bounds); }, deep: true }, min: function min3() { var value24 = this.value; this.setChangeValue(value24 || this.bounds); }, max: function max3() { var value24 = this.value; this.setChangeValue(value24 || this.bounds); } }, methods: { setChangeValue: function setChangeValue2(value24) { var _this2 = this; var bounds = this.bounds; var nextBounds = value24.map(function(v2, i2) { return _trimAlignValue({ value: v2, handle: i2, bounds, props: _this2.$props }); }); if (nextBounds.length === bounds.length && nextBounds.every(function(v2, i2) { return v2 === bounds[i2]; })) return; this.setState({ bounds: nextBounds }); if (value24.some(function(v2) { return isValueOutOfRange(v2, _this2.$props); })) { var newValues = value24.map(function(v2) { return ensureValueInRange(v2, _this2.$props); }); this.__emit("change", newValues); } }, onChange: function onChange5(state) { var isNotControlled = !hasProp(this, "value"); if (isNotControlled) { this.setState(state); } else { var controlledState = {}; ["sHandle", "recent"].forEach(function(item) { if (state[item] !== void 0) { controlledState[item] = state[item]; } }); if (Object.keys(controlledState).length) { this.setState(controlledState); } } var data65 = _extends$1(_extends$1({}, this.$data), state); var changedValue = data65.bounds; this.__emit("change", changedValue); }, onStart: function onStart2(position2) { var bounds = this.bounds; this.__emit("beforeChange", bounds); var value24 = this.calcValueByPos(position2); this.startValue = value24; this.startPosition = position2; var closestBound = this.getClosestBound(value24); this.prevMovedHandleIndex = this.getBoundNeedMoving(value24, closestBound); this.setState({ sHandle: this.prevMovedHandleIndex, recent: this.prevMovedHandleIndex }); var prevValue = bounds[this.prevMovedHandleIndex]; if (value24 === prevValue) return; var nextBounds = _toConsumableArray(bounds); nextBounds[this.prevMovedHandleIndex] = value24; this.onChange({ bounds: nextBounds }); }, onEnd: function onEnd2(force) { var sHandle = this.sHandle; this.removeDocumentEvents(); if (sHandle !== null || force) { this.__emit("afterChange", this.bounds); } this.setState({ sHandle: null }); }, onMove: function onMove2(e2, position2) { pauseEvent(e2); var bounds = this.bounds, sHandle = this.sHandle; var value24 = this.calcValueByPos(position2); var oldValue = bounds[sHandle]; if (value24 === oldValue) return; this.moveTo(value24); }, onKeyboard: function onKeyboard2(e2) { var _this$$props = this.$props, reverse = _this$$props.reverse, vertical = _this$$props.vertical; var valueMutator = getKeyboardValueMutator(e2, vertical, reverse); if (valueMutator) { pauseEvent(e2); var bounds = this.bounds, sHandle = this.sHandle; var oldValue = bounds[sHandle === null ? this.recent : sHandle]; var mutatedValue = valueMutator(oldValue, this.$props); var value24 = _trimAlignValue({ value: mutatedValue, handle: sHandle, bounds, props: this.$props }); if (value24 === oldValue) return; var isFromKeyboardEvent = true; this.moveTo(value24, isFromKeyboardEvent); } }, getClosestBound: function getClosestBound(value24) { var bounds = this.bounds; var closestBound = 0; for (var i2 = 1; i2 < bounds.length - 1; ++i2) { if (value24 > bounds[i2]) { closestBound = i2; } } if (Math.abs(bounds[closestBound + 1] - value24) < Math.abs(bounds[closestBound] - value24)) { closestBound += 1; } return closestBound; }, getBoundNeedMoving: function getBoundNeedMoving(value24, closestBound) { var bounds = this.bounds, recent = this.recent; var boundNeedMoving = closestBound; var isAtTheSamePoint = bounds[closestBound + 1] === bounds[closestBound]; if (isAtTheSamePoint && bounds[recent] === bounds[closestBound]) { boundNeedMoving = recent; } if (isAtTheSamePoint && value24 !== bounds[closestBound + 1]) { boundNeedMoving = value24 < bounds[closestBound + 1] ? closestBound : closestBound + 1; } return boundNeedMoving; }, getLowerBound: function getLowerBound2() { return this.bounds[0]; }, getUpperBound: function getUpperBound2() { var bounds = this.bounds; return bounds[bounds.length - 1]; }, getPoints: function getPoints() { var marks = this.marks, step = this.step, min4 = this.min, max4 = this.max; var cache2 = this._getPointsCache; if (!cache2 || cache2.marks !== marks || cache2.step !== step) { var pointsObject = _extends$1({}, marks); if (step !== null) { for (var point = min4; point <= max4; point += step) { pointsObject[point] = point; } } var points = Object.keys(pointsObject).map(parseFloat); points.sort(function(a2, b2) { return a2 - b2; }); this._getPointsCache = { marks, step, points }; } return this._getPointsCache.points; }, moveTo: function moveTo(value24, isFromKeyboardEvent) { var _this3 = this; var nextBounds = _toConsumableArray(this.bounds); var sHandle = this.sHandle, recent = this.recent; var handle = sHandle === null ? recent : sHandle; nextBounds[handle] = value24; var nextHandle = handle; if (this.$props.pushable !== false) { this.pushSurroundingHandles(nextBounds, nextHandle); } else if (this.$props.allowCross) { nextBounds.sort(function(a2, b2) { return a2 - b2; }); nextHandle = nextBounds.indexOf(value24); } this.onChange({ recent: nextHandle, sHandle: nextHandle, bounds: nextBounds }); if (isFromKeyboardEvent) { this.__emit("afterChange", nextBounds); this.setState({}, function() { _this3.handlesRefs[nextHandle].focus(); }); this.onEnd(); } }, pushSurroundingHandles: function pushSurroundingHandles(bounds, handle) { var value24 = bounds[handle]; var threshold = this.pushable; threshold = Number(threshold); var direction = 0; if (bounds[handle + 1] - value24 < threshold) { direction = 1; } if (value24 - bounds[handle - 1] < threshold) { direction = -1; } if (direction === 0) { return; } var nextHandle = handle + direction; var diffToNext = direction * (bounds[nextHandle] - value24); if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) { bounds[handle] = bounds[nextHandle] - direction * threshold; } }, pushHandle: function pushHandle(bounds, handle, direction, amount) { var originalValue = bounds[handle]; var currentValue = bounds[handle]; while (direction * (currentValue - originalValue) < amount) { if (!this.pushHandleOnePoint(bounds, handle, direction)) { bounds[handle] = originalValue; return false; } currentValue = bounds[handle]; } return true; }, pushHandleOnePoint: function pushHandleOnePoint(bounds, handle, direction) { var points = this.getPoints(); var pointIndex = points.indexOf(bounds[handle]); var nextPointIndex = pointIndex + direction; if (nextPointIndex >= points.length || nextPointIndex < 0) { return false; } var nextHandle = handle + direction; var nextValue = points[nextPointIndex]; var threshold = this.pushable; var diffToNext = direction * (bounds[nextHandle] - nextValue); if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) { return false; } bounds[handle] = nextValue; return true; }, trimAlignValue: function trimAlignValue3(value24) { var sHandle = this.sHandle, bounds = this.bounds; return _trimAlignValue({ value: value24, handle: sHandle, bounds, props: this.$props }); }, ensureValueNotConflict: function ensureValueNotConflict(handle, val, _ref2) { var allowCross = _ref2.allowCross, thershold = _ref2.pushable; var state = this.$data || {}; var bounds = state.bounds; handle = handle === void 0 ? state.sHandle : handle; thershold = Number(thershold); if (!allowCross && handle != null && bounds !== void 0) { if (handle > 0 && val <= bounds[handle - 1] + thershold) { return bounds[handle - 1] + thershold; } if (handle < bounds.length - 1 && val >= bounds[handle + 1] - thershold) { return bounds[handle + 1] - thershold; } } return val; }, getTrack: function getTrack2(_ref3) { var bounds = _ref3.bounds, prefixCls2 = _ref3.prefixCls, reverse = _ref3.reverse, vertical = _ref3.vertical, included = _ref3.included, offsets = _ref3.offsets, trackStyle = _ref3.trackStyle; return bounds.slice(0, -1).map(function(_2, index2) { var _classNames; var i2 = index2 + 1; var trackClassName = classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-track"), true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-track-").concat(i2), true), _classNames)); return createVNode(Track$1, { "class": trackClassName, "vertical": vertical, "reverse": reverse, "included": included, "offset": offsets[i2 - 1], "length": offsets[i2] - offsets[i2 - 1], "style": trackStyle[index2], "key": i2 }, null); }); }, renderSlider: function renderSlider2() { var _this4 = this; var sHandle = this.sHandle, bounds = this.bounds, prefixCls2 = this.prefixCls, vertical = this.vertical, included = this.included, disabled = this.disabled, min4 = this.min, max4 = this.max, reverse = this.reverse, handle = this.handle, defaultHandle = this.defaultHandle, trackStyle = this.trackStyle, handleStyle = this.handleStyle, tabindex = this.tabindex; var handleGenerator = handle || defaultHandle; var offsets = bounds.map(function(v2) { return _this4.calcOffset(v2); }); var handleClassName = "".concat(prefixCls2, "-handle"); var handles = bounds.map(function(v2, i2) { var _classNames2; var _tabIndex = tabindex[i2] || 0; if (disabled || tabindex[i2] === null) { _tabIndex = null; } return handleGenerator({ class: classNames((_classNames2 = {}, _defineProperty$12(_classNames2, handleClassName, true), _defineProperty$12(_classNames2, "".concat(handleClassName, "-").concat(i2 + 1), true), _classNames2)), prefixCls: prefixCls2, vertical, offset: offsets[i2], value: v2, dragging: sHandle === i2, index: i2, tabindex: _tabIndex, min: min4, max: max4, reverse, disabled, style: handleStyle[i2], ref: function ref2(h2) { return _this4.saveHandle(i2, h2); }, onFocus: _this4.onFocus, onBlur: _this4.onBlur }); }); return { tracks: this.getTrack({ bounds, prefixCls: prefixCls2, reverse, vertical, included, offsets, trackStyle }), handles }; } } }; var VcRange = createSlider(Range$1); var __rest$b = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var tooltipProps = abstractTooltipProps(); var SliderProps = function SliderProps2() { return { prefixCls: PropsTypes.string, tooltipPrefixCls: PropsTypes.string, range: PropsTypes.looseBool, reverse: PropsTypes.looseBool, min: PropsTypes.number, max: PropsTypes.number, step: PropsTypes.any, marks: PropsTypes.object, dots: PropsTypes.looseBool, value: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.arrayOf(PropsTypes.number)]), defaultValue: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.arrayOf(PropsTypes.number)]), included: PropsTypes.looseBool, disabled: PropsTypes.looseBool, vertical: PropsTypes.looseBool, tipFormatter: PropsTypes.oneOfType([PropsTypes.func, PropsTypes.object]), tooltipVisible: PropsTypes.looseBool, tooltipPlacement: tooltipProps.placement, getTooltipPopupContainer: PropsTypes.func, onChange: PropsTypes.func, onAfterChange: PropsTypes.func }; }; var defaultTipFormatter = function defaultTipFormatter2(value24) { return value24.toString(); }; var Slider = defineComponent({ name: "ASlider", mixins: [BaseMixin], inheritAttrs: false, props: _extends$1({}, SliderProps()), emits: ["update:value", "change"], setup: function setup96() { return { vcSlider: null, configProvider: inject("configProvider", defaultConfigProvider) }; }, data: function data51() { return { visibles: {} }; }, methods: { toggleTooltipVisible: function toggleTooltipVisible(index2, visible9) { this.setState(function(_ref) { var visibles = _ref.visibles; return { visibles: _extends$1(_extends$1({}, visibles), _defineProperty$12({}, index2, visible9)) }; }); }, handleWithTooltip: function handleWithTooltip(tooltipPrefixCls, prefixCls2, _a3) { var _this = this; var value24 = _a3.value, dragging = _a3.dragging, index2 = _a3.index, restProps = __rest$b(_a3, ["value", "dragging", "index"]); var _this$$props = this.$props, _this$$props$tipForma = _this$$props.tipFormatter, tipFormatter = _this$$props$tipForma === void 0 ? defaultTipFormatter : _this$$props$tipForma, tooltipVisible = _this$$props.tooltipVisible, tooltipPlacement = _this$$props.tooltipPlacement, getTooltipPopupContainer = _this$$props.getTooltipPopupContainer; var visibles = this.visibles; var isTipFormatter = tipFormatter ? visibles[index2] || dragging : false; var visible9 = tooltipVisible || tooltipVisible === void 0 && isTipFormatter; var tooltipProps2 = { prefixCls: tooltipPrefixCls, title: tipFormatter ? tipFormatter(value24) : "", visible: visible9, placement: tooltipPlacement || "top", transitionName: "zoom-down", overlayClassName: "".concat(prefixCls2, "-tooltip"), getPopupContainer: getTooltipPopupContainer || function() { return document.body; }, key: index2 }; var handleProps = _extends$1(_extends$1({ value: value24 }, restProps), { onMouseenter: function onMouseenter2() { return _this.toggleTooltipVisible(index2, true); }, onMouseleave: function onMouseleave2() { return _this.toggleTooltipVisible(index2, false); } }); return createVNode(Tooltip, tooltipProps2, { default: function _default8() { return [createVNode(VcHandle, handleProps, null)]; } }); }, saveSlider: function saveSlider(node) { this.vcSlider = node; }, focus: function focus19() { this.vcSlider.focus(); }, blur: function blur16() { this.vcSlider.blur(); }, handleChange: function handleChange14(val) { this.$emit("update:value", val); this.$emit("change", val); } }, render: function render83() { var _this2 = this; var _a3 = _extends$1(_extends$1({}, getOptionProps(this)), this.$attrs), range2 = _a3.range, customizePrefixCls = _a3.prefixCls, customizeTooltipPrefixCls = _a3.tooltipPrefixCls, restProps = __rest$b(_a3, ["range", "prefixCls", "tooltipPrefixCls"]); var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("slider", customizePrefixCls); var tooltipPrefixCls = getPrefixCls2("tooltip", customizeTooltipPrefixCls); if (range2) { var vcRangeProps = _extends$1(_extends$1({}, restProps), { prefixCls: prefixCls2, tooltipPrefixCls, handle: function handle(info3) { return _this2.handleWithTooltip(tooltipPrefixCls, prefixCls2, info3); }, ref: this.saveSlider, onChange: this.handleChange }); return createVNode(VcRange, vcRangeProps, null); } var vcSliderProps = _extends$1(_extends$1({}, restProps), { prefixCls: prefixCls2, tooltipPrefixCls, handle: function handle(info3) { return _this2.handleWithTooltip(tooltipPrefixCls, prefixCls2, info3); }, ref: this.saveSlider, onChange: this.handleChange }); return createVNode(VcSlider, vcSliderProps, null); } }); var Slider$1 = withInstall(Slider); var SwitchSizes = tuple("small", "default"); var switchProps = { prefixCls: PropsTypes.string, size: PropsTypes.oneOf(SwitchSizes), disabled: PropsTypes.looseBool, checkedChildren: PropsTypes.VNodeChild, unCheckedChildren: PropsTypes.VNodeChild, tabindex: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), autofocus: PropsTypes.looseBool, loading: PropsTypes.looseBool, checked: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number, PropsTypes.looseBool]), checkedValue: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number, PropsTypes.looseBool]).def(true), unCheckedValue: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number, PropsTypes.looseBool]).def(false), onChange: { type: Function }, onClick: { type: Function }, onKeydown: { type: Function }, onMouseup: { type: Function }, "onUpdate:checked": { type: Function } }; var Switch = defineComponent({ name: "ASwitch", __ANT_SWITCH: true, inheritAttrs: false, props: switchProps, slots: ["checkedChildren", "unCheckedChildren"], emits: ["update:checked", "mouseup", "change", "click", "keydown"], setup: function setup97(props2, _ref) { var attrs = _ref.attrs, slots = _ref.slots, expose = _ref.expose, emit2 = _ref.emit; onBeforeMount(function() { warning$5(!("defaultChecked" in attrs), "Switch", "'defaultChecked' is deprecated, please use 'v-model:checked'"); warning$5(!("value" in attrs), "Switch", "`value` is not validate prop, do you mean `checked`?"); }); var checked2 = ref(props2.checked !== void 0 ? props2.checked : attrs.defaultChecked); var checkedStatus = computed(function() { return checked2.value === props2.checkedValue; }); watch(function() { return props2.checked; }, function() { checked2.value = props2.checked; }); var _useConfigInject = useConfigInject("switch", props2), prefixCls2 = _useConfigInject.prefixCls; var refSwitchNode = ref(); var focus25 = function focus26() { var _a3; (_a3 = refSwitchNode.value) === null || _a3 === void 0 ? void 0 : _a3.focus(); }; var blur22 = function blur23() { var _a3; (_a3 = refSwitchNode.value) === null || _a3 === void 0 ? void 0 : _a3.blur(); }; expose({ focus: focus25, blur: blur22 }); onMounted(function() { nextTick(function() { if (props2.autofocus && !props2.disabled) { refSwitchNode.value.focus(); } }); }); var setChecked = function setChecked2(check, e2) { if (props2.disabled) { return; } emit2("update:checked", check); emit2("change", check, e2); }; var handleClick5 = function handleClick6(e2) { focus25(); var newChecked = checkedStatus.value ? props2.unCheckedValue : props2.checkedValue; setChecked(newChecked, e2); emit2("click", newChecked, e2); }; var handleKeyDown7 = function handleKeyDown8(e2) { if (e2.keyCode === KeyCode$1.LEFT) { setChecked(props2.unCheckedValue, e2); } else if (e2.keyCode === KeyCode$1.RIGHT) { setChecked(props2.checkedValue, e2); } emit2("keydown", e2); }; var handleMouseUp2 = function handleMouseUp3(e2) { var _a3; (_a3 = refSwitchNode.value) === null || _a3 === void 0 ? void 0 : _a3.blur(); emit2("mouseup", e2); }; var classNames2 = computed(function() { var _ref2; return _ref2 = {}, _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-small"), props2.size === "small"), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-loading"), props2.loading), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-checked"), checkedStatus.value), _defineProperty$12(_ref2, "".concat(prefixCls2.value, "-disabled"), props2.disabled), _defineProperty$12(_ref2, prefixCls2.value, true), _ref2; }); return function() { return createVNode(Wave, { "insertExtraNode": true }, { default: function _default8() { return [createVNode("button", _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({}, omit(props2, ["prefixCls", "checkedChildren", "unCheckedChildren", "checked", "autofocus", "defaultChecked", "checkedValue", "unCheckedValue"])), attrs), {}, { "onKeydown": handleKeyDown7, "onClick": handleClick5, "onMouseup": handleMouseUp2, "type": "button", "role": "switch", "aria-checked": checked2.value, "disabled": props2.disabled || props2.loading, "class": [attrs.class, classNames2.value], "ref": refSwitchNode }), [props2.loading ? createVNode(LoadingOutlined$3, { "class": "".concat(prefixCls2.value, "-loading-icon") }, null) : null, createVNode("span", { "class": "".concat(prefixCls2.value, "-inner") }, [checkedStatus.value ? getPropsSlot(slots, props2, "checkedChildren") : getPropsSlot(slots, props2, "unCheckedChildren")])])]; } }); }; } }); var Switch$1 = withInstall(Switch); var CaretUpFilled$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z" } }] }, "name": "caret-up", "theme": "filled" }; var CaretUpFilledSvg = CaretUpFilled$2; function _objectSpread$t(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$u(target, key2, source2[key2]); }); } return target; } function _defineProperty$u(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CaretUpFilled = function CaretUpFilled2(props2, context2) { var p = _objectSpread$t({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$t({}, p, { "icon": CaretUpFilledSvg }), null); }; CaretUpFilled.displayName = "CaretUpFilled"; CaretUpFilled.inheritAttrs = false; var CaretUpFilled$1 = CaretUpFilled; var CaretDownFilled$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" } }] }, "name": "caret-down", "theme": "filled" }; var CaretDownFilledSvg = CaretDownFilled$2; function _objectSpread$s(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$t(target, key2, source2[key2]); }); } return target; } function _defineProperty$t(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CaretDownFilled = function CaretDownFilled2(props2, context2) { var p = _objectSpread$s({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$s({}, p, { "icon": CaretDownFilledSvg }), null); }; CaretDownFilled.displayName = "CaretDownFilled"; CaretDownFilled.inheritAttrs = false; var CaretDownFilled$1 = CaretDownFilled; var scrollbarVerticalSize; var scrollbarHorizontalSize; var scrollbarMeasure = { position: "absolute", top: "-9999px", width: "50px", height: "50px" }; var INTERNAL_COL_DEFINE = "RC_TABLE_INTERNAL_COL_DEFINE"; function measureScrollbar(_ref) { var _ref$direction = _ref.direction, direction = _ref$direction === void 0 ? "vertical" : _ref$direction, prefixCls2 = _ref.prefixCls; if (typeof document === "undefined" || typeof window === "undefined") { return 0; } var isVertical = direction === "vertical"; if (isVertical && scrollbarVerticalSize) { return scrollbarVerticalSize; } if (!isVertical && scrollbarHorizontalSize) { return scrollbarHorizontalSize; } var scrollDiv = document.createElement("div"); Object.keys(scrollbarMeasure).forEach(function(scrollProp) { scrollDiv.style[scrollProp] = scrollbarMeasure[scrollProp]; }); scrollDiv.className = "".concat(prefixCls2, "-hide-scrollbar scroll-div-append-to-body"); if (isVertical) { scrollDiv.style.overflowY = "scroll"; } else { scrollDiv.style.overflowX = "scroll"; } document.body.appendChild(scrollDiv); var size = 0; if (isVertical) { size = scrollDiv.offsetWidth - scrollDiv.clientWidth; scrollbarVerticalSize = size; } else { size = scrollDiv.offsetHeight - scrollDiv.clientHeight; scrollbarHorizontalSize = size; } document.body.removeChild(scrollDiv); return size; } function debounce(func, wait, immediate) { var timeout; function debounceFunc() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var context2 = this; if (args[0] && args[0].persist) { args[0].persist(); } var later = function later2() { timeout = null; if (!immediate) { func.apply(context2, args); } }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) { func.apply(context2, args); } } debounceFunc.cancel = function cancel2() { if (timeout) { clearTimeout(timeout); timeout = null; } }; return debounceFunc; } function remove(array3, item) { var index2 = array3.indexOf(item); var front = array3.slice(0, index2); var last2 = array3.slice(index2 + 1, array3.length); return front.concat(last2); } function getDataAndAriaProps(props2) { return Object.keys(props2).reduce(function(memo, key2) { if (key2.substr(0, 5) === "data-" || key2.substr(0, 5) === "aria-") { memo[key2] = props2[key2]; } return memo; }, {}); } function getColumnsKey(columns2) { var columnKeys = []; columns2.forEach(function(column) { var _ref2 = column || {}, key2 = _ref2.key, dataIndex = _ref2.dataIndex; columnKeys.push(key2 !== void 0 ? key2 : dataIndex); }); return columnKeys; } function validateValue(val) { return val !== null && val !== void 0; } var ColGroup = { name: "ColGroup", inheritAttrs: false, props: { fixed: PropsTypes.string, columns: PropsTypes.array }, setup: function setup98() { return { table: inject("table", {}), store: inject("table-store", function() { return {}; }) }; }, render: function render84() { var fixed = this.fixed, table2 = this.table; var prefixCls2 = table2.prefixCls, expandIconAsCell = table2.expandIconAsCell, onColumnResize = table2.onColumnResize; var cols = []; if (expandIconAsCell && fixed !== "right") { cols.push(createVNode("col", { "class": "".concat(prefixCls2, "-expand-icon-col"), "key": "rc-table-expand-icon-col" }, null)); } var leafColumns; var columnManager = this.store.columnManager; if (fixed === "left") { leafColumns = columnManager.leftLeafColumns; } else if (fixed === "right") { leafColumns = columnManager.rightLeafColumns; } else { leafColumns = columnManager.leafColumns; } cols = cols.concat(leafColumns.map(function(_ref) { var key2 = _ref.key, dataIndex = _ref.dataIndex, width = _ref.width, additionalProps = _ref[INTERNAL_COL_DEFINE]; var mergedKey = key2 !== void 0 ? key2 : dataIndex; var w2 = typeof width === "number" ? "".concat(width, "px") : width; return createVNode(ResizeObserver, { "onResize": function onResize(_ref2) { var offsetWidth = _ref2.offsetWidth; onColumnResize(mergedKey, offsetWidth); } }, { default: function _default8() { return [createVNode("col", _objectSpread2$2({ "data-key": mergedKey, "key": mergedKey, "style": { width: w2, minWidth: w2 } }, additionalProps), null)]; } }); })); return createVNode("colgroup", null, [cols]); } }; function getCellFixedInfo(colStart, colEnd, columns2, stickyOffsets, direction) { var startColumn = columns2[colStart] || {}; var endColumn = columns2[colEnd] || {}; var fixLeft; var fixRight; if (startColumn.fixed === "left") { fixLeft = stickyOffsets.left[colStart]; } else if (endColumn.fixed === "right") { fixRight = stickyOffsets.right[colEnd]; } var lastFixLeft = false; var firstFixRight = false; var lastFixRight = false; var firstFixLeft = false; var nextColumn = columns2[colEnd + 1]; var prevColumn = columns2[colStart - 1]; if (direction === "rtl") { if (fixLeft !== void 0) { var prevFixLeft = prevColumn && prevColumn.fixed === "left"; firstFixLeft = !prevFixLeft; } else if (fixRight !== void 0) { var nextFixRight = nextColumn && nextColumn.fixed === "right"; lastFixRight = !nextFixRight; } } else if (fixLeft !== void 0) { var nextFixLeft = nextColumn && nextColumn.fixed === "left"; lastFixLeft = !nextFixLeft; } else if (fixRight !== void 0) { var prevFixRight = prevColumn && prevColumn.fixed === "right"; firstFixRight = !prevFixRight; } return { fixLeft, fixRight, lastFixLeft, firstFixRight, lastFixRight, firstFixLeft, isSticky: stickyOffsets.isSticky }; } var __rest$a = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var TableHeaderRow = { name: "TableHeaderRow", inheritAttrs: false, props: { index: PropsTypes.number, fixed: PropsTypes.string, columns: PropsTypes.array, rows: PropsTypes.array, row: PropsTypes.array, components: PropsTypes.object, customHeaderRow: PropsTypes.func, prefixCls: PropsTypes.prefixCls }, setup: function setup99(props2) { var store = inject("table-store", function() { return {}; }); return { height: computed(function() { var fixedColumnsHeadRowsHeight = store.fixedColumnsHeadRowsHeight; var columns2 = props2.columns, rows = props2.rows, fixed = props2.fixed; var headerHeight = fixedColumnsHeadRowsHeight[0]; if (!fixed) { return null; } if (headerHeight && columns2) { if (headerHeight === "auto") { return "auto"; } return "".concat(headerHeight / rows.length, "px"); } return null; }), store }; }, render: function render85() { var row = this.row, index2 = this.index, height = this.height, components3 = this.components, customHeaderRow2 = this.customHeaderRow, prefixCls2 = this.prefixCls; var HeaderRow = components3.header.row; var HeaderCell2 = components3.header.cell; var rowProps2 = customHeaderRow2(row.map(function(cell) { return cell.column; }), index2); var customStyle = rowProps2 ? rowProps2.style : {}; var style = _extends$1({ height }, customStyle); if (style.height === null) { delete style.height; } var _this$store = this.store, stickyOffsets = _this$store.stickyOffsets, columnManager = _this$store.columnManager; return createVNode(HeaderRow, _objectSpread2$2(_objectSpread2$2({}, rowProps2), {}, { "style": style }), { default: function _default8() { return [row.map(function(cell, i2) { var _classNames; var column = cell.column, isLast = cell.isLast, children = cell.children; cell.className; var cellProps = __rest$a(cell, ["column", "isLast", "children", "className"]); var fixedInfo = getCellFixedInfo(cell.colStart, cell.colEnd, columnManager.leafColumns, stickyOffsets); var customProps = column.customHeaderCell ? column.customHeaderCell(column) : {}; var headerCellProps = _extends$1(_extends$1(_extends$1({}, cellProps), customProps), { key: column.key || column.dataIndex || i2 }); if (headerCellProps.colSpan === 0) { return null; } if (column.align) { headerCellProps.style = _extends$1(_extends$1({}, customProps.style), { textAlign: column.align }); } var fixLeft = fixedInfo.fixLeft, fixRight = fixedInfo.fixRight, firstFixLeft = fixedInfo.firstFixLeft, lastFixLeft = fixedInfo.lastFixLeft, firstFixRight = fixedInfo.firstFixRight, lastFixRight = fixedInfo.lastFixRight; var fixedStyle = {}; var isFixLeft = typeof fixLeft === "number"; var isFixRight = typeof fixRight === "number"; if (isFixLeft) { fixedStyle.position = "sticky"; fixedStyle.left = "".concat(fixLeft, "px"); } if (isFixRight) { fixedStyle.position = "sticky"; fixedStyle.right = "".concat(fixRight, "px"); } headerCellProps.class = classNames(customProps.class, customProps.className, column.class, column.className, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-align-").concat(column.align), !!column.align), _defineProperty$12(_classNames, "".concat(prefixCls2, "-row-cell-ellipsis"), !!column.ellipsis), _defineProperty$12(_classNames, "".concat(prefixCls2, "-row-cell-break-word"), !!column.width), _defineProperty$12(_classNames, "".concat(prefixCls2, "-row-cell-last"), isLast), _defineProperty$12(_classNames, "".concat(prefixCls2, "-cell-fix-left"), isFixLeft), _defineProperty$12(_classNames, "".concat(prefixCls2, "-cell-fix-left-first"), firstFixLeft), _defineProperty$12(_classNames, "".concat(prefixCls2, "-cell-fix-left-last"), lastFixLeft), _defineProperty$12(_classNames, "".concat(prefixCls2, "-cell-fix-right"), isFixRight), _defineProperty$12(_classNames, "".concat(prefixCls2, "-cell-fix-right-first"), firstFixRight), _defineProperty$12(_classNames, "".concat(prefixCls2, "-cell-fix-right-last"), lastFixRight), _classNames)); headerCellProps.style = _extends$1(_extends$1({}, headerCellProps.style || {}), fixedStyle); if (typeof HeaderCell2 === "function") { return HeaderCell2(headerCellProps, children); } return createVNode(HeaderCell2, headerCellProps, { default: function _default9() { return [children]; } }); })]; } }); } }; var TableHeaderRow$1 = TableHeaderRow; function parseHeaderRows(rootColumns) { var rows = []; function fillRowCells(columns2, colIndex) { var rowIndex2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; rows[rowIndex2] = rows[rowIndex2] || []; var currentColIndex = colIndex; var colSpans = columns2.filter(Boolean).map(function(column) { var cell = { key: column.key, className: column.className || column.class || "", children: column.title, column, colStart: currentColIndex }; var colSpan = 1; var subColumns = column.children; if (subColumns && subColumns.length > 0) { colSpan = fillRowCells(subColumns, currentColIndex, rowIndex2 + 1).reduce(function(total2, count2) { return total2 + count2; }, 0); cell.hasSubColumns = true; } if ("colSpan" in column) { colSpan = column.colSpan; } if ("rowSpan" in column) { cell.rowSpan = column.rowSpan; } cell.colSpan = colSpan; cell.colEnd = cell.colStart + colSpan - 1; rows[rowIndex2].push(cell); currentColIndex += colSpan; return colSpan; }); return colSpans; } fillRowCells(rootColumns, 0); var rowCount = rows.length; var _loop = function _loop2(rowIndex2) { rows[rowIndex2].forEach(function(cell) { if (!("rowSpan" in cell) && !cell.hasSubColumns) { cell.rowSpan = rowCount - rowIndex2; } }); }; for (var rowIndex = 0; rowIndex < rowCount; rowIndex += 1) { _loop(rowIndex); } return rows; } var TableHeader$1 = { name: "TableHeader", inheritAttrs: false, props: { fixed: PropsTypes.string, columns: PropsTypes.array.isRequired, expander: PropsTypes.object.isRequired }, setup: function setup100() { return { table: inject("table", {}) }; }, render: function render86() { var _this$table = this.table, components3 = _this$table.sComponents, prefixCls2 = _this$table.prefixCls, showHeader = _this$table.showHeader, customHeaderRow2 = _this$table.customHeaderRow; var expander = this.expander, columns2 = this.columns, fixed = this.fixed; if (!showHeader) { return null; } var rows = parseHeaderRows(this.columns); expander.renderExpandIndentCell(rows, fixed); var HeaderWrapper = components3.header.wrapper; return createVNode(HeaderWrapper, { "class": "".concat(prefixCls2, "-thead") }, { default: function _default8() { return [rows.map(function(row, index2) { return createVNode(TableHeaderRow$1, { "prefixCls": prefixCls2, "key": index2, "index": index2, "fixed": fixed, "columns": columns2, "rows": rows, "row": row, "components": components3, "customHeaderRow": customHeaderRow2 }, null); })]; } }); } }; function isInvalidRenderCellText(text) { return text && !isValidElement(text) && Object.prototype.toString.call(text) === "[object Object]"; } var TableCell = { name: "TableCell", inheritAttrs: false, props: { record: PropsTypes.object, prefixCls: PropsTypes.string, index: PropsTypes.number, indent: PropsTypes.number, indentSize: PropsTypes.number, column: PropsTypes.object, expandIcon: PropsTypes.any, component: PropsTypes.any, colIndex: PropsTypes.number }, setup: function setup101() { return { table: inject("table", {}), store: inject("table-store", {}) }; }, methods: { handleClick: function handleClick3(e2) { var record = this.record, onCellClick = this.column.onCellClick; if (onCellClick) { onCellClick(record, e2); } } }, render: function render87() { var _classNames; var record = this.record, indentSize = this.indentSize, prefixCls2 = this.prefixCls, indent = this.indent, index2 = this.index, expandIcon = this.expandIcon, column = this.column, BodyCell = this.component; var fixedInfoList = this.store.fixedInfoList || []; var fixedInfo = fixedInfoList[this.colIndex] || {}; var fixLeft = fixedInfo.fixLeft, fixRight = fixedInfo.fixRight, firstFixLeft = fixedInfo.firstFixLeft, lastFixLeft = fixedInfo.lastFixLeft, firstFixRight = fixedInfo.firstFixRight, lastFixRight = fixedInfo.lastFixRight; var fixedStyle = {}; var isFixLeft = typeof fixLeft === "number"; var isFixRight = typeof fixRight === "number"; if (isFixLeft) { fixedStyle.position = "sticky"; fixedStyle.left = "".concat(fixLeft, "px"); } if (isFixRight) { fixedStyle.position = "sticky"; fixedStyle.right = "".concat(fixRight, "px"); } var dataIndex = column.dataIndex, customRender = column.customRender, _column$className = column.className, className = _column$className === void 0 ? "" : _column$className; var _this$table = this.table, transformCellText = _this$table.transformCellText, rootPrefixCls = _this$table.prefixCls; var text; if (typeof dataIndex === "number") { text = get(record, dataIndex); } else if (!dataIndex || dataIndex.length === 0) { text = record; } else { text = get(record, dataIndex); } var tdProps = { onClick: this.handleClick }; var colSpan; var rowSpan; if (customRender) { text = customRender({ text, record, index: index2, column }); if (isInvalidRenderCellText(text)) { tdProps = text.props || text.attrs || tdProps; var _tdProps = tdProps; colSpan = _tdProps.colSpan; rowSpan = _tdProps.rowSpan; text = text.children; } } if (column.customCell) { tdProps = _extends$1(_extends$1({}, tdProps), column.customCell(record, index2)); } if (isInvalidRenderCellText(text)) { text = null; } if (transformCellText) { text = transformCellText({ text, column, record, index: index2 }); } var indentText = expandIcon ? createVNode("span", { "style": { paddingLeft: "".concat(indentSize * indent, "px") }, "class": "".concat(prefixCls2, "-indent indent-level-").concat(indent) }, null) : null; if (rowSpan === 0 || colSpan === 0) { return null; } if (column.align) { tdProps.style = _extends$1({ textAlign: column.align }, tdProps.style); } var cellClassName = classNames(className, column.class, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-cell-ellipsis"), !!column.ellipsis), _defineProperty$12(_classNames, "".concat(prefixCls2, "-cell-break-word"), !!column.width), _defineProperty$12(_classNames, "".concat(rootPrefixCls, "-cell-fix-left"), isFixLeft), _defineProperty$12(_classNames, "".concat(rootPrefixCls, "-cell-fix-left-first"), firstFixLeft), _defineProperty$12(_classNames, "".concat(rootPrefixCls, "-cell-fix-left-last"), lastFixLeft), _defineProperty$12(_classNames, "".concat(rootPrefixCls, "-cell-fix-right"), isFixRight), _defineProperty$12(_classNames, "".concat(rootPrefixCls, "-cell-fix-right-first"), firstFixRight), _defineProperty$12(_classNames, "".concat(rootPrefixCls, "-cell-fix-right-last"), lastFixRight), _classNames)); if (column.ellipsis) { if (typeof text === "string") { tdProps.title = text; } } return createVNode(BodyCell, _objectSpread2$2(_objectSpread2$2({ "class": cellClassName }, tdProps), {}, { style: _extends$1(_extends$1({}, tdProps.style || {}), fixedStyle) }), { default: function _default8() { return [indentText, expandIcon, toRaw(text)]; } }); } }; var __rest$9 = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; function noop$4() { } var TableRow = { name: "TableRow", inheritAttrs: false, mixins: [BaseMixin], props: initDefaultProps$2({ customRow: PropsTypes.func, record: PropsTypes.object, prefixCls: PropsTypes.string, columns: PropsTypes.array, index: PropsTypes.number, rowKey: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]).isRequired, className: PropsTypes.string, indent: PropsTypes.number, indentSize: PropsTypes.number, hasExpandIcon: PropsTypes.func, fixed: withUndefined(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.looseBool])), renderExpandIcon: PropsTypes.func, renderExpandIconCell: PropsTypes.func, components: PropsTypes.any, expandedRow: PropsTypes.looseBool, isAnyColumnsFixed: PropsTypes.looseBool, ancestorKeys: PropsTypes.array.isRequired, expandIconColumnIndex: PropsTypes.number, expandRowByClick: PropsTypes.looseBool }, { hasExpandIcon: function hasExpandIcon() { }, renderExpandIcon: function renderExpandIcon() { }, renderExpandIconCell: function renderExpandIconCell() { } }), setup: function setup102(props2) { var store = inject("table-store", function() { return {}; }); var visible9 = computed(function() { var expandedRowKeys2 = store.expandedRowKeys; var ancestorKeys = props2.ancestorKeys; return !!(ancestorKeys.length === 0 || ancestorKeys.every(function(k2) { return expandedRowKeys2.includes(k2); })); }); var height = computed(function() { var expandedRowsHeight = store.expandedRowsHeight, fixedColumnsBodyRowsHeight = store.fixedColumnsBodyRowsHeight; var fixed = props2.fixed, rowKey = props2.rowKey; if (!fixed) { return null; } if (expandedRowsHeight[rowKey]) { return expandedRowsHeight[rowKey]; } if (fixedColumnsBodyRowsHeight[rowKey]) { return fixedColumnsBodyRowsHeight[rowKey]; } return null; }); var hovered = computed(function() { var currentHoverKey = store.currentHoverKey; var rowKey = props2.rowKey; return currentHoverKey === rowKey; }); return { store, visible: visible9, hovered, height }; }, data: function data52() { this.rowRef = null; return { shouldRender: this.visible }; }, mounted: function mounted27() { var _this = this; if (this.shouldRender) { this.$nextTick(function() { _this.saveRowRef(); }); } }, watch: { visible: function visible8(val) { if (val) { this.shouldRender = true; } } }, updated: function updated14() { var _this2 = this; if (this.shouldRender && !this.rowRef) { this.$nextTick(function() { _this2.saveRowRef(); }); } }, methods: { onRowClick: function onRowClick(event) { var rowPropFunc = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$4; var record = this.record, index2 = this.index; this.__emit("rowClick", record, index2, event); rowPropFunc(event); }, onRowDoubleClick: function onRowDoubleClick(event) { var rowPropFunc = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$4; var record = this.record, index2 = this.index; this.__emit("rowDoubleClick", record, index2, event); rowPropFunc(event); }, onContextMenu: function onContextMenu(event) { var rowPropFunc = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$4; var record = this.record, index2 = this.index; this.__emit("rowContextmenu", record, index2, event); rowPropFunc(event); }, onMouseEnter: function onMouseEnter2(event) { var rowPropFunc = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$4; var record = this.record, index2 = this.index, rowKey = this.rowKey; this.__emit("hover", true, rowKey); this.__emit("rowMouseenter", record, index2, event); rowPropFunc(event); }, onMouseLeave: function onMouseLeave3(event) { var rowPropFunc = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$4; var record = this.record, index2 = this.index, rowKey = this.rowKey; this.__emit("hover", false, rowKey); this.__emit("rowMouseleave", record, index2, event); rowPropFunc(event); }, setExpandedRowHeight: function setExpandedRowHeight() { var store = this.store, rowKey = this.rowKey; var expandedRowsHeight = store.expandedRowsHeight; var height = this.rowRef.getBoundingClientRect().height; expandedRowsHeight = _extends$1(_extends$1({}, expandedRowsHeight), _defineProperty$12({}, rowKey, height)); store.expandedRowsHeight = expandedRowsHeight; }, setRowHeight: function setRowHeight() { var store = this.store, rowKey = this.rowKey; var fixedColumnsBodyRowsHeight = store.fixedColumnsBodyRowsHeight; var height = this.rowRef.getBoundingClientRect().height; store.fixedColumnsBodyRowsHeight = _extends$1(_extends$1({}, fixedColumnsBodyRowsHeight), _defineProperty$12({}, rowKey, height)); }, getStyle: function getStyle2() { var height = this.height, visible9 = this.visible; var style = this.$attrs.style || {}; if (height) { style = _extends$1(_extends$1({}, style), { height }); } if (!visible9 && !style.display) { style = _extends$1(_extends$1({}, style), { display: "none" }); } return style; }, saveRowRef: function saveRowRef() { this.rowRef = findDOMNode(this); var isAnyColumnsFixed = this.isAnyColumnsFixed, fixed = this.fixed, expandedRow = this.expandedRow, ancestorKeys = this.ancestorKeys; if (!isAnyColumnsFixed) { return; } if (!fixed && expandedRow) { this.setExpandedRowHeight(); } if (!fixed && ancestorKeys.length >= 0) { this.setRowHeight(); } } }, render: function render88() { var _this3 = this; if (!this.shouldRender) { return null; } var prefixCls2 = this.prefixCls, columns2 = this.columns, record = this.record, rowKey = this.rowKey, index2 = this.index, _this$customRow = this.customRow, customRow = _this$customRow === void 0 ? noop$4 : _this$customRow, indent = this.indent, indentSize = this.indentSize, hovered = this.hovered, height = this.height, visible9 = this.visible, components3 = this.components, hasExpandIcon3 = this.hasExpandIcon, renderExpandIcon4 = this.renderExpandIcon, renderExpandIconCell3 = this.renderExpandIconCell; var BodyRow = components3.body.row; var BodyCell = components3.body.cell; var className = this.$attrs.class || ""; if (hovered) { className += " ".concat(prefixCls2, "-hover"); } var cells = []; renderExpandIconCell3(cells); for (var i2 = 0; i2 < columns2.length; i2 += 1) { var column = columns2[i2]; warning$5(column.onCellClick === void 0, "column[onCellClick] is deprecated, please use column[customCell] instead."); cells.push(createVNode(TableCell, { "prefixCls": prefixCls2, "record": record, "indentSize": indentSize, "indent": indent, "index": index2, "colIndex": i2, "column": column, "key": column.key || column.dataIndex, "expandIcon": hasExpandIcon3(i2) && renderExpandIcon4(), "component": BodyCell }, null)); } var _a3 = customRow(record, index2) || {}, customClass = _a3.class, customClassName = _a3.className, customStyle = _a3.style, rowProps2 = __rest$9(_a3, ["class", "className", "style"]); var style = { height: typeof height === "number" ? "".concat(height, "px") : height }; if (!visible9) { style.display = "none"; } style = _extends$1(_extends$1({}, style), customStyle); var rowClassName2 = classNames(prefixCls2, className, "".concat(prefixCls2, "-level-").concat(indent), customClassName, customClass); var bodyRowProps = _extends$1(_extends$1({}, rowProps2), { style, onClick: function onClick7(e2) { _this3.onRowClick(e2, rowProps2.onClick); }, onDblclick: function onDblclick(e2) { _this3.onRowDoubleClick(e2, rowProps2.onDblclick); }, onMouseenter: function onMouseenter2(e2) { _this3.onMouseEnter(e2, rowProps2.onMouseenter); }, onMouseleave: function onMouseleave2(e2) { _this3.onMouseLeave(e2, rowProps2.onMouseleave); }, onContextmenu: function onContextmenu2(e2) { _this3.onContextMenu(e2, rowProps2.onContextmenu); }, class: rowClassName2, "data-row-key": rowKey }); return createVNode(BodyRow, bodyRowProps, { default: function _default8() { return [cells]; } }); } }; var TableRow$1 = TableRow; var ExpandIcon = { name: "ExpandIcon", mixins: [BaseMixin], inheritAttrs: false, props: { record: PropsTypes.object, prefixCls: PropsTypes.string, expandable: PropsTypes.any, expanded: PropsTypes.looseBool, needIndentSpaced: PropsTypes.looseBool }, methods: { onExpand: function onExpand(e2) { this.__emit("expand", this.record, e2); } }, render: function render89() { var expandable = this.expandable, prefixCls2 = this.prefixCls, onExpand3 = this.onExpand, needIndentSpaced = this.needIndentSpaced, expanded = this.expanded; if (expandable) { var expandClassName = expanded ? "expanded" : "collapsed"; return createVNode("span", { "class": "".concat(prefixCls2, "-expand-icon ").concat(prefixCls2, "-").concat(expandClassName), "onClick": onExpand3 }, null); } if (needIndentSpaced) { return createVNode("span", { "class": "".concat(prefixCls2, "-expand-icon ").concat(prefixCls2, "-spaced") }, null); } return null; } }; var ExpandableRow = { mixins: [BaseMixin], name: "ExpandableRow", inheritAttrs: false, props: { prefixCls: PropsTypes.string.isRequired, rowKey: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]).isRequired, fixed: withUndefined(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.looseBool])), record: PropsTypes.oneOfType([PropsTypes.object, PropsTypes.array]).isRequired, indentSize: PropsTypes.number, needIndentSpaced: PropsTypes.looseBool.isRequired, expandRowByClick: PropsTypes.looseBool, expandIconAsCell: PropsTypes.looseBool, expandIconColumnIndex: PropsTypes.number, childrenColumnName: PropsTypes.string, expandedRowRender: PropsTypes.func, expandIcon: PropsTypes.func }, setup: function setup103(props2) { var store = inject("table-store", function() { return {}; }); return { expanded: computed(function() { return store.expandedRowKeys.includes(props2.rowKey); }) }; }, beforeUnmount: function beforeUnmount18() { this.handleDestroy(); }, methods: { hasExpandIcon: function hasExpandIcon2(columnIndex) { var _this$$props = this.$props, expandRowByClick = _this$$props.expandRowByClick, expandIcon = _this$$props.expandIcon; if (this.tempExpandIconAsCell || columnIndex !== this.tempExpandIconColumnIndex) { return false; } return !!expandIcon || !expandRowByClick; }, handleExpandChange: function handleExpandChange(record, event) { var expanded = this.expanded, rowKey = this.rowKey; this.__emit("expandedChange", !expanded, record, event, rowKey); }, handleDestroy: function handleDestroy() { var rowKey = this.rowKey, record = this.record; this.__emit("expandedChange", false, record, null, rowKey, true); }, handleRowClick: function handleRowClick(record, index2, event) { var expandRowByClick = this.expandRowByClick; if (expandRowByClick) { this.handleExpandChange(record, event); } this.__emit("rowClick", record, index2, event); }, renderExpandIcon: function renderExpandIcon2() { var prefixCls2 = this.prefixCls, expanded = this.expanded, record = this.record, needIndentSpaced = this.needIndentSpaced, expandIcon = this.expandIcon; if (expandIcon) { return expandIcon({ prefixCls: prefixCls2, expanded, record, needIndentSpaced, expandable: this.expandable, onExpand: this.handleExpandChange }); } return createVNode(ExpandIcon, { "expandable": this.expandable, "prefixCls": prefixCls2, "onExpand": this.handleExpandChange, "needIndentSpaced": needIndentSpaced, "expanded": expanded, "record": record }, null); }, renderExpandIconCell: function renderExpandIconCell2(cells) { if (!this.tempExpandIconAsCell) { return; } var prefixCls2 = this.prefixCls; cells.push(createVNode("td", { "class": "".concat(prefixCls2, "-expand-icon-cell"), "key": "rc-table-expand-icon-cell" }, [this.renderExpandIcon()])); } }, render: function render90() { var childrenColumnName = this.childrenColumnName, expandedRowRender = this.expandedRowRender, indentSize = this.indentSize, record = this.record, fixed = this.fixed, expanded = this.expanded; this.tempExpandIconAsCell = fixed !== "right" ? this.expandIconAsCell : false; this.tempExpandIconColumnIndex = fixed !== "right" ? this.expandIconColumnIndex : -1; var childrenData = record[childrenColumnName]; this.expandable = !!(childrenData || expandedRowRender); var expandableRowProps = { indentSize, expanded, hasExpandIcon: this.hasExpandIcon, renderExpandIcon: this.renderExpandIcon, renderExpandIconCell: this.renderExpandIconCell, onRowClick: this.handleRowClick }; return getSlot$1(this, "default", expandableRowProps); } }; var ExpandableRow$1 = ExpandableRow; function noop$3() { } var BaseTable = { name: "BaseTable", inheritAttrs: false, props: { fixed: withUndefined(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.looseBool])), columns: PropsTypes.array.isRequired, tableClassName: PropsTypes.string.isRequired, hasHead: PropsTypes.looseBool.isRequired, hasBody: PropsTypes.looseBool.isRequired, expander: PropsTypes.object.isRequired, getRowKey: PropsTypes.func, isAnyColumnsFixed: PropsTypes.looseBool }, setup: function setup104() { return { table: inject("table", function() { return {}; }), store: inject("table-store", function() { return {}; }) }; }, methods: { getColumns: function getColumns2(cols) { var _this$$props$columns = this.$props.columns, columns2 = _this$$props$columns === void 0 ? [] : _this$$props$columns; return (cols || columns2).map(function(column) { return _extends$1(_extends$1({}, column), { className: classNames(column.className, column.class) }); }); }, handleRowHover: function handleRowHover(isHover, key2) { this.store.currentHoverKey = isHover ? key2 : null; }, renderRows: function renderRows(renderData, indent) { var _this = this; var ancestorKeys = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : []; var _Object$assign = _extends$1(_extends$1(_extends$1({}, this.table.$attrs), this.table.$props), this.table.$data), components3 = _Object$assign.sComponents, prefixCls2 = _Object$assign.prefixCls, childrenColumnName = _Object$assign.childrenColumnName, rowClassName2 = _Object$assign.rowClassName, _Object$assign$custom = _Object$assign.customRow, customRow = _Object$assign$custom === void 0 ? noop$3 : _Object$assign$custom, _Object$assign$onRowC = _Object$assign.onRowClick, onRowClick2 = _Object$assign$onRowC === void 0 ? noop$3 : _Object$assign$onRowC, _Object$assign$onRowD = _Object$assign.onRowDoubleClick, onRowDoubleClick2 = _Object$assign$onRowD === void 0 ? noop$3 : _Object$assign$onRowD, _Object$assign$onRowC2 = _Object$assign.onRowContextMenu, onRowContextMenu = _Object$assign$onRowC2 === void 0 ? noop$3 : _Object$assign$onRowC2, _Object$assign$onRowM = _Object$assign.onRowMouseEnter, onRowMouseEnter = _Object$assign$onRowM === void 0 ? noop$3 : _Object$assign$onRowM, _Object$assign$onRowM2 = _Object$assign.onRowMouseLeave, onRowMouseLeave = _Object$assign$onRowM2 === void 0 ? noop$3 : _Object$assign$onRowM2, rowRef2 = _Object$assign.rowRef; var columnManager = this.store.columnManager; var getRowKey2 = this.getRowKey, fixed = this.fixed, expander = this.expander, isAnyColumnsFixed = this.isAnyColumnsFixed; var rows = []; var _loop = function _loop2(i3) { var record = renderData[i3]; var key2 = getRowKey2(record, i3); var className = typeof rowClassName2 === "string" ? rowClassName2 : rowClassName2(record, i3, indent); var onHoverProps = {}; if (columnManager.isAnyColumnsFixed) { onHoverProps.onHover = _this.handleRowHover; } var leafColumns = void 0; if (fixed === "left") { leafColumns = columnManager.leftLeafColumns; } else if (fixed === "right") { leafColumns = columnManager.rightLeafColumns; } else { leafColumns = _this.getColumns(columnManager.leafColumns); } var rowPrefixCls = "".concat(prefixCls2, "-row"); var expandableRowProps = _extends$1(_extends$1({}, expander.props), { fixed, index: i3, prefixCls: rowPrefixCls, record, rowKey: key2, needIndentSpaced: expander.needIndentSpaced, key: key2, onRowClick: onRowClick2, onExpandedChange: expander.handleExpandChange }); var row = createVNode(ExpandableRow$1, expandableRowProps, { default: function _default8(expandableRow) { var tableRowProps = _extends$1(_extends$1(_extends$1({ fixed, indent, record, index: i3, prefixCls: rowPrefixCls, childrenColumnName, columns: leafColumns, rowKey: key2, ancestorKeys, components: components3, isAnyColumnsFixed, customRow, onRowDoubleClick: onRowDoubleClick2, onRowContextMenu, onRowMouseEnter, onRowMouseLeave }, onHoverProps), { class: className, ref: rowRef2(record, i3, indent) }), expandableRow); return createVNode(TableRow$1, tableRowProps, null); } }); rows.push(row); expander.renderRows(_this.renderRows, rows, record, i3, indent, fixed, key2, ancestorKeys); }; for (var i2 = 0; i2 < renderData.length; i2 += 1) { _loop(i2); } return rows; } }, render: function render91() { var _this2 = this; var _this$table = this.table, components3 = _this$table.sComponents, prefixCls2 = _this$table.prefixCls, scroll = _this$table.scroll, data65 = _this$table.data; var _this$$props = this.$props, expander = _this$$props.expander, tableClassName = _this$$props.tableClassName, hasHead = _this$$props.hasHead, hasBody = _this$$props.hasBody, fixed = _this$$props.fixed; var columns2 = this.getColumns(); var tableStyle = {}; if (!fixed && scroll.x) { tableStyle.width = scroll.x === true ? "auto" : scroll.x; tableStyle.width = typeof tableStyle.width === "number" ? "".concat(tableStyle.width, "px") : tableStyle.width; } if (fixed) { var width = columns2.reduce(function(sum, _ref) { var w2 = _ref.width; return sum + parseFloat(w2, 10); }, 0); if (width > 0) { tableStyle.width = width + "px"; } } var Table2 = hasBody ? components3.table : "table"; var BodyWrapper = components3.body.wrapper; var body; if (hasBody) { body = createVNode(BodyWrapper, { "class": "".concat(prefixCls2, "-tbody") }, { default: function _default8() { return [_this2.renderRows(data65, 0)]; } }); } return createVNode(Table2, { "class": tableClassName, "style": tableStyle, "key": "table" }, { default: function _default8() { return [createVNode(ColGroup, { "columns": columns2, "fixed": fixed }, null), hasHead && createVNode(TableHeader$1, { "expander": expander, "columns": columns2, "fixed": fixed }, null), body]; } }); } }; var BaseTable$1 = BaseTable; var HeadTable = { name: "HeadTable", inheritAttrs: false, props: { fixed: withUndefined(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.looseBool])), columns: PropsTypes.array.isRequired, tableClassName: PropsTypes.string.isRequired, handleBodyScrollLeft: PropsTypes.func.isRequired, expander: PropsTypes.object.isRequired }, setup: function setup105() { return { table: inject("table", {}) }; }, render: function render92() { var columns2 = this.columns, fixed = this.fixed, tableClassName = this.tableClassName, handleBodyScrollLeft2 = this.handleBodyScrollLeft, expander = this.expander, table2 = this.table; var prefixCls2 = table2.prefixCls, scroll = table2.scroll, showHeader = table2.showHeader, saveRef3 = table2.saveRef; var useFixedHeader = table2.useFixedHeader; var headStyle = {}; var scrollbarWidth = measureScrollbar({ direction: "vertical" }); if (scroll.y) { useFixedHeader = true; var scrollbarWidthOfHeader = measureScrollbar({ direction: "horizontal", prefixCls: prefixCls2 }); if (scrollbarWidthOfHeader > 0 && !fixed) { headStyle.marginBottom = "-".concat(scrollbarWidthOfHeader, "px"); headStyle.paddingBottom = "0px"; headStyle.minWidth = "".concat(scrollbarWidth, "px"); headStyle.overflowX = "scroll"; headStyle.overflowY = scrollbarWidth === 0 ? "hidden" : "scroll"; } } if (!useFixedHeader || !showHeader) { return null; } return createVNode("div", { "key": "headTable", "ref": fixed ? function() { } : saveRef3("headTable"), "class": classNames("".concat(prefixCls2, "-header"), _defineProperty$12({}, "".concat(prefixCls2, "-hide-scrollbar"), scrollbarWidth > 0)), "style": headStyle, "onScroll": handleBodyScrollLeft2 }, [createVNode(BaseTable$1, { "tableClassName": tableClassName, "hasHead": true, "hasBody": false, "fixed": fixed, "columns": columns2, "expander": expander }, null)]); } }; var BodyTable = { name: "BodyTable", inheritAttrs: false, props: { columns: PropsTypes.array.isRequired, tableClassName: PropsTypes.string.isRequired, handleBodyScroll: PropsTypes.func.isRequired, handleWheel: PropsTypes.func.isRequired, getRowKey: PropsTypes.func.isRequired, expander: PropsTypes.object.isRequired, isAnyColumnsFixed: PropsTypes.looseBool }, setup: function setup106() { return { table: inject("table", {}) }; }, render: function render93() { var _this$table = this.table, prefixCls2 = _this$table.prefixCls, scroll = _this$table.scroll; var columns2 = this.columns, tableClassName = this.tableClassName, getRowKey2 = this.getRowKey, handleBodyScroll2 = this.handleBodyScroll, handleWheel2 = this.handleWheel, expander = this.expander, isAnyColumnsFixed = this.isAnyColumnsFixed; var _this$table2 = this.table, useFixedHeader = _this$table2.useFixedHeader, saveRef3 = _this$table2.saveRef; var bodyStyle = _extends$1({}, this.table.bodyStyle); if (scroll.y) { var maxHeight = bodyStyle.maxHeight || scroll.y; maxHeight = typeof maxHeight === "number" ? "".concat(maxHeight, "px") : maxHeight; bodyStyle.maxHeight = maxHeight; bodyStyle.overflowY = bodyStyle.overflowY || "scroll"; useFixedHeader = true; } if (scroll.x) { bodyStyle.overflowX = bodyStyle.overflowX || "auto"; bodyStyle.WebkitTransform = "translate3d (0, 0, 0)"; if (!scroll.y) { bodyStyle.overflowY = "hidden"; } } var baseTable = createVNode(BaseTable$1, { "tableClassName": tableClassName, "hasHead": !useFixedHeader, "hasBody": true, "columns": columns2, "expander": expander, "getRowKey": getRowKey2, "isAnyColumnsFixed": isAnyColumnsFixed }, null); var useTabIndex = scroll && (scroll.x || scroll.y); return createVNode("div", { "tabindex": useTabIndex ? -1 : void 0, "key": "bodyTable", "class": "".concat(prefixCls2, "-body"), "style": bodyStyle, "ref": saveRef3("bodyTable"), "onWheel": handleWheel2, "onScroll": handleBodyScroll2 }, [baseTable]); } }; var ExpandableTableProps = function ExpandableTableProps2() { return { expandIconAsCell: PropsTypes.looseBool, expandRowByClick: PropsTypes.looseBool, expandedRowKeys: PropsTypes.array, expandedRowClassName: PropsTypes.func, defaultExpandAllRows: PropsTypes.looseBool, defaultExpandedRowKeys: PropsTypes.array, expandIconColumnIndex: PropsTypes.number, expandedRowRender: PropsTypes.func, expandIcon: PropsTypes.func, childrenColumnName: PropsTypes.string, indentSize: PropsTypes.number, columnManager: PropsTypes.object.isRequired, prefixCls: PropsTypes.string.isRequired, data: PropsTypes.array, getRowKey: PropsTypes.func }; }; var ExpandableTable = { name: "ExpandableTable", inheritAttrs: false, mixins: [BaseMixin], props: initDefaultProps$2(ExpandableTableProps(), { expandIconAsCell: false, expandedRowClassName: function expandedRowClassName() { return ""; }, expandIconColumnIndex: 0, defaultExpandAllRows: false, defaultExpandedRowKeys: [], childrenColumnName: "children", indentSize: 15 }), setup: function setup107(props2) { var store = inject("table-store", function() { return {}; }); var data65 = props2.data, childrenColumnName = props2.childrenColumnName, defaultExpandAllRows = props2.defaultExpandAllRows, expandedRowKeys2 = props2.expandedRowKeys, defaultExpandedRowKeys = props2.defaultExpandedRowKeys, getRowKey2 = props2.getRowKey; var finalExpandedRowKeys = []; var rows = _toConsumableArray(data65); if (defaultExpandAllRows) { for (var i2 = 0; i2 < rows.length; i2 += 1) { var row = rows[i2]; finalExpandedRowKeys.push(getRowKey2(row, i2)); rows = rows.concat(row[childrenColumnName] || []); } } else { finalExpandedRowKeys = expandedRowKeys2 || defaultExpandedRowKeys; } _extends$1(store, { expandedRowsHeight: {}, expandedRowKeys: finalExpandedRowKeys }); return { store }; }, mounted: function mounted28() { this.handleUpdated(); }, updated: function updated15() { this.handleUpdated(); }, watch: { expandedRowKeys: function expandedRowKeys(val) { var _this = this; this.$nextTick(function() { _this.store.expandedRowKeys = val; }); } }, methods: { handleUpdated: function handleUpdated() { this.latestExpandedRows = null; }, handleExpandChange: function handleExpandChange2(expanded, record, event, rowKey) { var destroy3 = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false; if (event) { event.preventDefault(); event.stopPropagation(); } var expandedRowKeys2 = this.store.expandedRowKeys; if (expanded) { expandedRowKeys2 = [].concat(_toConsumableArray(expandedRowKeys2), [rowKey]); } else { var expandedRowIndex = expandedRowKeys2.indexOf(rowKey); if (expandedRowIndex !== -1) { expandedRowKeys2 = remove(expandedRowKeys2, rowKey); } } if (!this.expandedRowKeys) { this.store.expandedRowKeys = expandedRowKeys2; } if (!this.latestExpandedRows || !shallowEqual$1(this.latestExpandedRows, expandedRowKeys2)) { this.latestExpandedRows = expandedRowKeys2; this.__emit("expandedRowsChange", expandedRowKeys2); } if (!destroy3) { this.__emit("expand", expanded, record); } }, renderExpandIndentCell: function renderExpandIndentCell(rows, fixed) { var prefixCls2 = this.prefixCls, expandIconAsCell = this.expandIconAsCell; if (!expandIconAsCell || fixed === "right" || !rows.length) { return; } var iconColumn = { key: "rc-table-expand-icon-cell", className: "".concat(prefixCls2, "-expand-icon-th"), title: "", rowSpan: rows.length }; rows[0].unshift(_extends$1(_extends$1({}, iconColumn), { column: iconColumn })); }, renderExpandedRow: function renderExpandedRow(record, index2, expandedRowRender, className, ancestorKeys, indent, fixed) { var _this2 = this; var prefixCls2 = this.prefixCls, expandIconAsCell = this.expandIconAsCell, indentSize = this.indentSize; var parentKey = ancestorKeys[ancestorKeys.length - 1]; var rowKey = "".concat(parentKey, "-extra-row"); var components3 = { body: { row: "tr", cell: "td" } }; var colCount; if (fixed === "left") { colCount = this.columnManager.leftLeafColumns.value.length; } else if (fixed === "right") { colCount = this.columnManager.rightLeafColumns.value.length; } else { colCount = this.columnManager.leafColumns.value.length; } var columns2 = [{ key: "extra-row", customRender: function customRender() { var expandedRowKeys2 = _this2.store.expandedRowKeys; var expanded = expandedRowKeys2.includes(parentKey); return { props: { colSpan: colCount }, children: fixed !== "right" ? expandedRowRender({ record, index: index2, indent, expanded }) : " " }; } }]; if (expandIconAsCell && fixed !== "right") { columns2.unshift({ key: "expand-icon-placeholder", customRender: function customRender() { return null; } }); } return createVNode(TableRow$1, { "key": rowKey, "columns": columns2, "class": className, "rowKey": rowKey, "ancestorKeys": ancestorKeys, "prefixCls": "".concat(prefixCls2, "-expanded-row"), "indentSize": indentSize, "indent": indent, "fixed": fixed, "components": components3, "expandedRow": true, "hasExpandIcon": function hasExpandIcon3() { } }, null); }, renderRows: function renderRows2(_renderRows, rows, record, index2, indent, fixed, parentKey, ancestorKeys) { var expandedRowClassName2 = this.expandedRowClassName, expandedRowRender = this.expandedRowRender, childrenColumnName = this.childrenColumnName; var childrenData = record[childrenColumnName]; var nextAncestorKeys = [].concat(_toConsumableArray(ancestorKeys), [parentKey]); var nextIndent = indent + 1; if (expandedRowRender) { rows.push(this.renderExpandedRow(record, index2, expandedRowRender, expandedRowClassName2(record, index2, indent), nextAncestorKeys, nextIndent, fixed)); } if (childrenData) { rows.push.apply(rows, _toConsumableArray(_renderRows(childrenData, nextIndent, nextAncestorKeys))); } } }, render: function render94() { var data65 = this.data, childrenColumnName = this.childrenColumnName; var props2 = getOptionProps(this); var needIndentSpaced = data65.some(function(record) { return record[childrenColumnName]; }); return getSlot$1(this, "default", { props: _extends$1(_extends$1({}, props2), this.$attrs), needIndentSpaced, renderRows: this.renderRows, handleExpandChange: this.handleExpandChange, renderExpandIndentCell: this.renderExpandIndentCell }); } }; var ExpandableTable$1 = ExpandableTable; function useLayoutState(defaultState) { var stateRef = ref(defaultState); var tempState = stateRef.value; var updateBatchRef = []; var rafRef = ref(); function setFrameState(updater) { wrapperRaf.cancel(rafRef.value); updateBatchRef.push(updater); rafRef.value = wrapperRaf(function() { var prevBatch = updateBatchRef; updateBatchRef = []; prevBatch.forEach(function(batchUpdater) { tempState = batchUpdater(tempState); }); stateRef.value = tempState; }); } onBeforeUnmount(function() { wrapperRaf.cancel(rafRef.value); }); return [stateRef, setFrameState]; } function useColumnManager(columns2) { var _leafColumns = function _leafColumns2(cls) { var fixed = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; var leafColumns2 = []; cls.forEach(function(column) { column.fixed = fixed || column.fixed; if (!column.children) { leafColumns2.push(column); } else { leafColumns2.push.apply(leafColumns2, _toConsumableArray(_leafColumns2(column.children, column.fixed))); } }); return leafColumns2; }; var groupedColumns = computed(function() { var _groupColumns = function _groupColumns2(cls) { var currentRow = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; var parentColumn = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; var rows = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : []; var fixed = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false; rows[currentRow] = rows[currentRow] || []; var grouped = []; var setRowSpan = function setRowSpan2(column) { var rowSpan = rows.length - currentRow; if (column && !column.children && rowSpan > 1 && (!column.rowSpan || column.rowSpan < rowSpan)) { column.rowSpan = rowSpan; } }; cls.forEach(function(column, index2) { var newColumn = _extends$1({}, column); newColumn.fixed = fixed || column.fixed; rows[currentRow].push(newColumn); parentColumn.colSpan = parentColumn.colSpan || 0; if (newColumn.children && newColumn.children.length > 0) { newColumn.children = _groupColumns2(newColumn.children, currentRow + 1, newColumn, rows, newColumn.fixed); parentColumn.colSpan += newColumn.colSpan; } else { parentColumn.colSpan += 1; } for (var i2 = 0; i2 < rows[currentRow].length - 1; i2 += 1) { setRowSpan(rows[currentRow][i2]); } if (index2 + 1 === cls.length) { setRowSpan(newColumn); } grouped.push(newColumn); }); return grouped; }; return _groupColumns(columns2.value); }); var isAnyColumnsFixed = computed(function() { return columns2.value.some(function(column) { return !!column.fixed; }); }); var isAnyColumnsLeftFixed = computed(function() { return columns2.value.some(function(column) { return column.fixed === "left" || column.fixed === true; }); }); var isAnyColumnsRightFixed = computed(function() { return columns2.value.some(function(column) { return column.fixed === "right"; }); }); var leftColumns = computed(function() { return groupedColumns.value.filter(function(column) { return column.fixed === "left" || column.fixed === true; }); }); var rightColumns = computed(function() { return groupedColumns.value.filter(function(column) { return column.fixed === "right"; }); }); var leafColumns = computed(function() { return _leafColumns(columns2.value); }); var leftLeafColumns = computed(function() { return _leafColumns(leftColumns.value); }); var rightLeafColumns = computed(function() { return _leafColumns(rightColumns.value); }); return { groupedColumns, isAnyColumnsFixed, isAnyColumnsLeftFixed, isAnyColumnsRightFixed, leftColumns, rightColumns, leafColumns, leftLeafColumns, rightLeafColumns }; } function useStickyOffsets(colWidths, columns2) { var stickyOffsets = ref({ left: [], right: [] }); var columnCount = ref(); watch(columns2, function() { columnCount.value = columns2.value.length; }, { immediate: true }); watch([colWidths, columnCount], function() { var leftOffsets = []; var rightOffsets = []; var left = 0; var right = 0; for (var start = 0; start < columnCount.value; start += 1) { leftOffsets[start] = left; left += colWidths.value[start] || 0; var end = columnCount.value - start - 1; rightOffsets[end] = right; right += colWidths.value[end] || 0; } stickyOffsets.value = { left: leftOffsets, right: rightOffsets }; }); return stickyOffsets; } var Table$2 = defineComponent({ name: "Table", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$2({ data: PropsTypes.array, useFixedHeader: PropsTypes.looseBool, columns: PropsTypes.array, prefixCls: PropsTypes.string, bodyStyle: PropsTypes.object, rowKey: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.func]), rowClassName: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.func]), customRow: PropsTypes.func, customHeaderRow: PropsTypes.func, showHeader: PropsTypes.looseBool, title: PropsTypes.func, id: PropsTypes.string, footer: PropsTypes.func, emptyText: PropsTypes.any, scroll: PropsTypes.object, rowRef: PropsTypes.func, components: PropsTypes.shape({ table: PropsTypes.any, header: PropsTypes.shape({ wrapper: PropsTypes.any, row: PropsTypes.any, cell: PropsTypes.any }).loose, body: PropsTypes.shape({ wrapper: PropsTypes.any, row: PropsTypes.any, cell: PropsTypes.any }).loose }).loose, expandIconAsCell: PropsTypes.looseBool, expandedRowKeys: PropsTypes.array, expandedRowClassName: PropsTypes.func, defaultExpandAllRows: PropsTypes.looseBool, defaultExpandedRowKeys: PropsTypes.array, expandIconColumnIndex: PropsTypes.number, expandedRowRender: PropsTypes.func, childrenColumnName: PropsTypes.string, indentSize: PropsTypes.number, expandRowByClick: PropsTypes.looseBool, expandIcon: PropsTypes.func, tableLayout: PropsTypes.string, transformCellText: PropsTypes.func }, { data: [], useFixedHeader: false, rowKey: "key", rowClassName: function rowClassName() { return ""; }, prefixCls: "rc-table", bodyStyle: {}, showHeader: true, scroll: {}, rowRef: function rowRef() { return null; }, emptyText: function emptyText() { return "No Data"; }, customHeaderRow: function customHeaderRow() { } }), setup: function setup108(props2) { var columnManager = useColumnManager(toRef(props2, "columns")); var colsKeys = computed(function() { return getColumnsKey(columnManager.leafColumns.value); }); var _useLayoutState = useLayoutState(/* @__PURE__ */ new Map()), _useLayoutState2 = _slicedToArray$4(_useLayoutState, 2), colsWidths = _useLayoutState2[0], updateColsWidths = _useLayoutState2[1]; var pureColWidths = computed(function() { return colsKeys.value.map(function(columnKey) { return colsWidths.value.get(columnKey); }); }); var stickyOffsets = useStickyOffsets(pureColWidths, columnManager.leafColumns); var onColumnResize = function onColumnResize2(columnKey, width) { updateColsWidths(function(widths) { if (widths.get(columnKey) !== width) { var newWidths = new Map(widths); newWidths.set(columnKey, width); return newWidths; } return widths; }); }; var fixedInfoList = computed(function() { return columnManager.leafColumns.value.map(function(_2, colIndex) { return getCellFixedInfo(colIndex, colIndex, columnManager.leafColumns.value, stickyOffsets.value); }); }); var store = reactive({ currentHoverKey: null, fixedColumnsHeadRowsHeight: [], fixedColumnsBodyRowsHeight: {}, expandedRowsHeight: {}, expandedRowKeys: [], columnManager, fixedInfoList, stickyOffsets }); provide("table-store", store); var bodyRef = ref(); var pingedLeft = ref(false); var pingedRight = ref(false); var horizonScroll = computed(function() { return props2.scroll && validateValue(props2.scroll.x); }); var onScroll = function onScroll2(currentTarget) { var scrollWidth = currentTarget.scrollWidth, clientWidth = currentTarget.clientWidth, scrollLeft2 = currentTarget.scrollLeft; pingedLeft.value = scrollLeft2 > 0; pingedRight.value = scrollLeft2 < scrollWidth - clientWidth; }; onUpdated(function() { nextTick(function() { horizonScroll.value && onScroll(bodyRef.value.$el); }); }); onMounted(function() { nextTick(function() { horizonScroll.value && onScroll(bodyRef.value.$el); }); }); var onFullTableResize = function onFullTableResize2() { horizonScroll.value && onScroll(bodyRef.value.$el); }; return { bodyRef, store, onColumnResize, columnManager, onScroll, pingedLeft, pingedRight, onFullTableResize }; }, data: function data53() { this.preData = _toConsumableArray(this.data); return { sComponents: markRaw(merge$3({ table: "table", header: { wrapper: "thead", row: "tr", cell: "th" }, body: { wrapper: "tbody", row: "tr", cell: "td" } }, this.components)) }; }, computed: { dataLen: function dataLen() { return this.$props.data.length; } }, watch: { components: function components2() { this._components = merge$3({ table: "table", header: { wrapper: "thead", row: "tr", cell: "th" }, body: { wrapper: "tbody", row: "tr", cell: "td" } }, this.components); }, dataLen: function dataLen2(val, preVal) { var _this = this; if ((val === 0 || preVal === 0) && this.hasScrollX()) { nextTick(function() { _this.resetScrollX(); }); } } }, created: function created14() { provide("table", this); this.setScrollPosition("left"); this.debouncedWindowResize = debounce(this.handleWindowResize, 150); }, mounted: function mounted29() { var _this2 = this; this.$nextTick(function() { if (_this2.columnManager.isAnyColumnsFixed.value) { _this2.handleWindowResize(); _this2.resizeEvent = addEventListenerWrap(window, "resize", _this2.debouncedWindowResize); } if (_this2.ref_headTable) { _this2.ref_headTable.scrollLeft = 0; } if (_this2.ref_bodyTable) { _this2.ref_bodyTable.scrollLeft = 0; } }); }, updated: function updated16() { var _this3 = this; this.$nextTick(function() { if (_this3.columnManager.isAnyColumnsFixed.value) { _this3.handleWindowResize(); if (!_this3.resizeEvent) { _this3.resizeEvent = addEventListenerWrap(window, "resize", _this3.debouncedWindowResize); } } }); }, beforeUnmount: function beforeUnmount19() { if (this.resizeEvent) { this.resizeEvent.remove(); } if (this.debouncedWindowResize) { this.debouncedWindowResize.cancel(); } }, methods: { getRowKey: function getRowKey(record, index2) { var rowKey = this.rowKey; var key2 = typeof rowKey === "function" ? rowKey(record, index2) : record[rowKey]; warning$5(key2 !== void 0, "Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key."); return key2 === void 0 ? index2 : key2; }, setScrollPosition: function setScrollPosition(position2) { this.scrollPosition = position2; if (this.tableNode) { var prefixCls2 = this.prefixCls; if (position2 === "both") { classes(this.tableNode).remove(new RegExp("^".concat(prefixCls2, "-scroll-position-.+$"))).add("".concat(prefixCls2, "-scroll-position-left")).add("".concat(prefixCls2, "-scroll-position-right")); } else { classes(this.tableNode).remove(new RegExp("^".concat(prefixCls2, "-scroll-position-.+$"))).add("".concat(prefixCls2, "-scroll-position-").concat(position2)); } } }, setScrollPositionClassName: function setScrollPositionClassName() { var node = this.ref_bodyTable; var scrollToLeft = node.scrollLeft === 0; var scrollToRight = node.scrollLeft + 1 >= node.children[0].getBoundingClientRect().width - node.getBoundingClientRect().width; if (scrollToLeft && scrollToRight) { this.setScrollPosition("both"); } else if (scrollToLeft) { this.setScrollPosition("left"); } else if (scrollToRight) { this.setScrollPosition("right"); } else if (this.scrollPosition !== "middle") { this.setScrollPosition("middle"); } }, isTableLayoutFixed: function isTableLayoutFixed() { var _this$$props = this.$props, tableLayout = _this$$props.tableLayout, _this$$props$columns = _this$$props.columns, columns2 = _this$$props$columns === void 0 ? [] : _this$$props$columns, useFixedHeader = _this$$props.useFixedHeader, _this$$props$scroll = _this$$props.scroll, scroll = _this$$props$scroll === void 0 ? {} : _this$$props$scroll; if (typeof tableLayout !== "undefined") { return tableLayout === "fixed"; } if (columns2.some(function(_ref) { var ellipsis = _ref.ellipsis; return !!ellipsis; })) { return true; } if (useFixedHeader || scroll.y) { return true; } if (scroll.x && scroll.x !== true && scroll.x !== "max-content") { return true; } return false; }, handleWindowResize: function handleWindowResize() { this.syncFixedTableRowHeight(); this.setScrollPositionClassName(); }, syncFixedTableRowHeight: function syncFixedTableRowHeight() { var tableRect = this.tableNode.getBoundingClientRect(); if (tableRect.height !== void 0 && tableRect.height <= 0) { return; } var prefixCls2 = this.prefixCls; var headRows = this.ref_headTable ? this.ref_headTable.querySelectorAll("thead") : this.ref_bodyTable.querySelectorAll("thead"); var bodyRows = this.ref_bodyTable.querySelectorAll(".".concat(prefixCls2, "-row")) || []; var fixedColumnsHeadRowsHeight = [].map.call(headRows, function(row) { return row.getBoundingClientRect().height ? row.getBoundingClientRect().height - 0.5 : "auto"; }); var state = this.store; var fixedColumnsBodyRowsHeight = [].reduce.call(bodyRows, function(acc, row) { var rowKey = row.getAttribute("data-row-key"); var height = row.getBoundingClientRect().height || state.fixedColumnsBodyRowsHeight[rowKey] || "auto"; acc[rowKey] = height; return acc; }, {}); if (shallowEqual$1(state.fixedColumnsHeadRowsHeight, fixedColumnsHeadRowsHeight) && shallowEqual$1(state.fixedColumnsBodyRowsHeight, fixedColumnsBodyRowsHeight)) { return; } this.store.fixedColumnsHeadRowsHeight = fixedColumnsHeadRowsHeight; this.store.fixedColumnsBodyRowsHeight = fixedColumnsBodyRowsHeight; }, resetScrollX: function resetScrollX() { if (this.ref_headTable) { this.ref_headTable.scrollLeft = 0; } if (this.ref_bodyTable) { this.ref_bodyTable.scrollLeft = 0; } }, hasScrollX: function hasScrollX() { var _this$scroll = this.scroll, scroll = _this$scroll === void 0 ? {} : _this$scroll; return "x" in scroll; }, handleBodyScrollLeft: function handleBodyScrollLeft(e2) { var target = e2.target; var _this$scroll2 = this.scroll, scroll = _this$scroll2 === void 0 ? {} : _this$scroll2; var ref_headTable = this.ref_headTable, ref_bodyTable = this.ref_bodyTable; if (target.scrollLeft !== this.lastScrollLeft && scroll.x) { if (target === ref_bodyTable && ref_headTable) { ref_headTable.scrollLeft = target.scrollLeft; } else if (target === ref_headTable && ref_bodyTable) { ref_bodyTable.scrollLeft = target.scrollLeft; } this.setScrollPositionClassName(); } this.lastScrollLeft = target.scrollLeft; }, handleBodyScrollTop: function handleBodyScrollTop(e2) { var target = e2.target; if (e2.currentTarget !== target) { return; } var _this$scroll3 = this.scroll, scroll = _this$scroll3 === void 0 ? {} : _this$scroll3; var ref_headTable = this.ref_headTable, ref_bodyTable = this.ref_bodyTable, ref_fixedColumnsBodyLeft = this.ref_fixedColumnsBodyLeft, ref_fixedColumnsBodyRight = this.ref_fixedColumnsBodyRight; if (target.scrollTop !== this.lastScrollTop && scroll.y && target !== ref_headTable) { var scrollTop2 = target.scrollTop; if (ref_fixedColumnsBodyLeft && target !== ref_fixedColumnsBodyLeft) { ref_fixedColumnsBodyLeft.scrollTop = scrollTop2; } if (ref_fixedColumnsBodyRight && target !== ref_fixedColumnsBodyRight) { ref_fixedColumnsBodyRight.scrollTop = scrollTop2; } if (ref_bodyTable && target !== ref_bodyTable) { ref_bodyTable.scrollTop = scrollTop2; } } this.lastScrollTop = target.scrollTop; }, handleBodyScroll: function handleBodyScroll(e2) { this.onScroll(e2.target); this.handleBodyScrollLeft(e2); this.handleBodyScrollTop(e2); }, handleWheel: function handleWheel(event) { var _this$$props$scroll2 = this.$props.scroll, scroll = _this$$props$scroll2 === void 0 ? {} : _this$$props$scroll2; if (window.navigator.userAgent.match(/Trident\/7\./) && scroll.y) { event.preventDefault(); var wd = event.deltaY; var target = event.target; var bodyTable = this.ref_bodyTable, fixedColumnsBodyLeft = this.ref_fixedColumnsBodyLeft, fixedColumnsBodyRight = this.ref_fixedColumnsBodyRight; var scrollTop2 = 0; if (this.lastScrollTop) { scrollTop2 = this.lastScrollTop + wd; } else { scrollTop2 = wd; } if (fixedColumnsBodyLeft && target !== fixedColumnsBodyLeft) { fixedColumnsBodyLeft.scrollTop = scrollTop2; } if (fixedColumnsBodyRight && target !== fixedColumnsBodyRight) { fixedColumnsBodyRight.scrollTop = scrollTop2; } if (bodyTable && target !== bodyTable) { bodyTable.scrollTop = scrollTop2; } } }, saveRef: function saveRef2(name) { var _this4 = this; return function(node) { _this4["ref_".concat(name)] = node; }; }, saveTableNodeRef: function saveTableNodeRef(node) { this.tableNode = node; }, renderMainTable: function renderMainTable() { var scroll = this.scroll, prefixCls2 = this.prefixCls; var isAnyColumnsFixed = this.columnManager.isAnyColumnsFixed.value; var scrollable = isAnyColumnsFixed || scroll.x || scroll.y; var table2 = [this.renderTable({ columns: this.columnManager.groupedColumns.value, isAnyColumnsFixed }), this.renderEmptyText(), this.renderFooter()]; return scrollable ? createVNode(ResizeObserver, { "onResize": this.onFullTableResize }, { default: function _default8() { return [createVNode("div", { "class": "".concat(prefixCls2, "-scroll") }, [table2])]; } }) : table2; }, renderTable: function renderTable(options2) { var columns2 = options2.columns, isAnyColumnsFixed = options2.isAnyColumnsFixed; var prefixCls2 = this.prefixCls, _this$scroll4 = this.scroll, scroll = _this$scroll4 === void 0 ? {} : _this$scroll4; var tableClassName = scroll.x ? "".concat(prefixCls2, "-fixed") : ""; var headTable = createVNode(HeadTable, { "key": "head", "columns": columns2, "tableClassName": tableClassName, "handleBodyScrollLeft": this.handleBodyScrollLeft, "expander": this.expander }, null); var bodyTable = createVNode(BodyTable, { "key": "body", "columns": columns2, "tableClassName": tableClassName, "getRowKey": this.getRowKey, "handleWheel": this.handleWheel, "handleBodyScroll": this.handleBodyScroll, "expander": this.expander, "isAnyColumnsFixed": isAnyColumnsFixed, "ref": "bodyRef" }, null); return [headTable, bodyTable]; }, renderTitle: function renderTitle() { var title = this.title, prefixCls2 = this.prefixCls, data65 = this.data; return title ? createVNode("div", { "class": "".concat(prefixCls2, "-title"), "key": "title" }, [title(data65)]) : null; }, renderFooter: function renderFooter4() { var footer = this.footer, prefixCls2 = this.prefixCls, data65 = this.data; return footer ? createVNode("div", { "class": "".concat(prefixCls2, "-footer"), "key": "footer" }, [footer(data65)]) : null; }, renderEmptyText: function renderEmptyText() { var emptyText2 = this.emptyText, prefixCls2 = this.prefixCls, data65 = this.data; if (data65.length) { return null; } var emptyClassName = "".concat(prefixCls2, "-placeholder"); return createVNode("div", { "class": emptyClassName, "key": "emptyText" }, [typeof emptyText2 === "function" ? emptyText2() : emptyText2]); } }, render: function render95() { var _classNames, _this5 = this; var props2 = _extends$1(_extends$1({}, getOptionProps(this)), this.$attrs); var columnManager = this.columnManager, getRowKey2 = this.getRowKey; var prefixCls2 = props2.prefixCls; var tableClassName = classNames(props2.prefixCls, props2.class, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-fixed-header"), props2.useFixedHeader || props2.scroll && props2.scroll.y), _defineProperty$12(_classNames, "".concat(prefixCls2, "-scroll-position-left ").concat(prefixCls2, "-scroll-position-right"), this.scrollPosition === "both"), _defineProperty$12(_classNames, "".concat(prefixCls2, "-scroll-position-").concat(this.scrollPosition), this.scrollPosition !== "both"), _defineProperty$12(_classNames, "".concat(prefixCls2, "-layout-fixed"), this.isTableLayoutFixed()), _defineProperty$12(_classNames, "".concat(prefixCls2, "-ping-left"), this.pingedLeft), _defineProperty$12(_classNames, "".concat(prefixCls2, "-ping-right"), this.pingedRight), _classNames)); var dataAndAriaProps = getDataAndAriaProps(props2); var expandableTableProps = _extends$1(_extends$1({}, props2), { columnManager, getRowKey: getRowKey2 }); return createVNode(ExpandableTable$1, expandableTableProps, { default: function _default8(expander) { _this5.expander = expander; return createVNode("div", _objectSpread2$2({ "ref": _this5.saveTableNodeRef, "class": tableClassName, "style": props2.style, "id": props2.id }, dataAndAriaProps), [_this5.renderTitle(), createVNode("div", { "class": "".concat(prefixCls2, "-content") }, [_this5.renderMainTable()])]); } }); } }); var FilterFilled$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z" } }] }, "name": "filter", "theme": "filled" }; var FilterFilledSvg = FilterFilled$2; function _objectSpread$r(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$s(target, key2, source2[key2]); }); } return target; } function _defineProperty$s(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var FilterFilled = function FilterFilled2(props2, context2) { var p = _objectSpread$r({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$r({}, p, { "icon": FilterFilledSvg }), null); }; FilterFilled.displayName = "FilterFilled"; FilterFilled.inheritAttrs = false; var FilterFilled$1 = FilterFilled; var FilterDropdownMenuWrapper = function FilterDropdownMenuWrapper2(props2, _ref) { var slots = _ref.slots; var _a3; return createVNode("div", { "class": props2.class, "onClick": function onClick7(e2) { return e2.stopPropagation(); } }, [(_a3 = slots.default) === null || _a3 === void 0 ? void 0 : _a3.call(slots)]); }; FilterDropdownMenuWrapper.inheritAttrs = false; var FilterDropdownMenuWrapper$1 = FilterDropdownMenuWrapper; paginationProps$1(); var ColumnFilterItem = PropsTypes.shape({ text: PropsTypes.string, value: PropsTypes.string, children: PropsTypes.array }).loose; var columnProps = { title: PropsTypes.VNodeChild, key: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), dataIndex: PropsTypes.string, customRender: PropsTypes.func, customCell: PropsTypes.func, customHeaderCell: PropsTypes.func, align: PropsTypes.oneOf(tuple("left", "right", "center")), ellipsis: PropsTypes.looseBool, filters: PropsTypes.arrayOf(ColumnFilterItem), onFilter: { type: Function }, filterMultiple: PropsTypes.looseBool, filterDropdown: PropsTypes.any, filterDropdownVisible: PropsTypes.looseBool, onFilterDropdownVisibleChange: { type: Function }, sorter: PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.func]), defaultSortOrder: PropsTypes.oneOf(tuple("ascend", "descend")), colSpan: PropsTypes.number, width: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), className: PropsTypes.string, fixed: withUndefined(PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.oneOf(tuple("left", "right"))])), filterIcon: PropsTypes.any, filteredValue: PropsTypes.array, filtered: PropsTypes.looseBool, defaultFilteredValue: PropsTypes.array, sortOrder: withUndefined(PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.oneOf(tuple("ascend", "descend"))])), sortDirections: PropsTypes.array }; var TableLocale = PropsTypes.shape({ filterTitle: PropsTypes.string, filterConfirm: PropsTypes.any, filterReset: PropsTypes.any, emptyText: PropsTypes.any, selectAll: PropsTypes.any, selectInvert: PropsTypes.any, sortTitle: PropsTypes.string, expand: PropsTypes.string, collapse: PropsTypes.string }).loose; var RowSelectionType = PropsTypes.oneOf(tuple("checkbox", "radio")); var tableRowSelection = { type: RowSelectionType, selectedRowKeys: PropsTypes.array, getCheckboxProps: PropsTypes.func, selections: withUndefined(PropsTypes.oneOfType([PropsTypes.array, PropsTypes.looseBool])), hideDefaultSelections: PropsTypes.looseBool, fixed: PropsTypes.looseBool, columnWidth: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), selectWay: PropsTypes.oneOf(tuple("onSelect", "onSelectMultiple", "onSelectAll", "onSelectInvert")), columnTitle: PropsTypes.any }; var paginationProps = paginationConfig(); var tableProps = { prefixCls: PropsTypes.string, dropdownPrefixCls: PropsTypes.string, rowSelection: PropsTypes.oneOfType([PropsTypes.shape(tableRowSelection).loose, Object]), pagination: withUndefined(PropsTypes.oneOfType([PropsTypes.shape(paginationProps).loose, PropsTypes.looseBool])), size: PropsTypes.oneOf(tuple("default", "middle", "small", "large")), dataSource: PropsTypes.array, components: PropsTypes.object, columns: { type: Array }, rowKey: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.func]), rowClassName: PropsTypes.func, expandedRowRender: PropsTypes.any, defaultExpandAllRows: PropsTypes.looseBool, defaultExpandedRowKeys: PropsTypes.array, expandedRowKeys: PropsTypes.array, expandIconAsCell: PropsTypes.looseBool, expandIconColumnIndex: PropsTypes.number, expandRowByClick: PropsTypes.looseBool, loading: PropsTypes.oneOfType([PropsTypes.shape(getSpinProps()).loose, PropsTypes.looseBool]), locale: TableLocale, indentSize: PropsTypes.number, customRow: PropsTypes.func, customHeaderRow: PropsTypes.func, useFixedHeader: PropsTypes.looseBool, bordered: PropsTypes.looseBool, showHeader: PropsTypes.looseBool, footer: PropsTypes.func, title: PropsTypes.func, scroll: { type: Object }, childrenColumnName: PropsTypes.oneOfType([PropsTypes.array, PropsTypes.string]), bodyStyle: PropsTypes.style, sortDirections: { type: Array }, tableLayout: PropsTypes.string, getPopupContainer: PropsTypes.func, expandIcon: PropsTypes.func, transformCellText: PropsTypes.func, onExpandedRowsChange: PropsTypes.func, onExpand: PropsTypes.func, onChange: PropsTypes.func, onRowClick: PropsTypes.func }; var SelectionCheckboxAllProps = { propsSymbol: PropsTypes.any, store: PropsTypes.any, locale: PropsTypes.any, disabled: PropsTypes.looseBool, getCheckboxPropsByItem: PropsTypes.func, getRecordKey: PropsTypes.func, data: PropsTypes.array, prefixCls: PropsTypes.string, hideDefaultSelections: PropsTypes.looseBool, selections: PropsTypes.oneOfType([PropsTypes.array, PropsTypes.looseBool]), getPopupContainer: PropsTypes.func, onSelect: PropsTypes.func }; var SelectionBoxProps = { store: PropsTypes.any, type: RowSelectionType, defaultSelection: PropsTypes.array, rowIndex: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), name: PropsTypes.string, disabled: PropsTypes.looseBool, id: PropsTypes.string }; var FilterMenuProps = { locale: TableLocale, selectedKeys: PropsTypes.array, column: PropsTypes.object, confirmFilter: PropsTypes.func, prefixCls: PropsTypes.string, dropdownPrefixCls: PropsTypes.string, getPopupContainer: PropsTypes.func, handleFilter: PropsTypes.func }; var BaseMixin2 = { methods: { setState: function setState2() { var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var callback2 = arguments.length > 1 ? arguments[1] : void 0; var newState = typeof state === "function" ? state(this, this.$props) : state; if (this.getDerivedStateFromProps) { var s2 = this.getDerivedStateFromProps(getOptionProps(this), _extends$1(_extends$1({}, this), newState)); if (s2 === null) { return; } else { newState = _extends$1(_extends$1({}, newState), s2 || {}); } } _extends$1(this, newState); if (this._.isMounted) { this.$forceUpdate(); } nextTick(function() { callback2 && callback2(); }); }, __emit: function __emit2() { var args = [].slice.call(arguments, 0); var eventName = args[0]; eventName = "on".concat(eventName[0].toUpperCase()).concat(eventName.substring(1)); var event = this.$props[eventName] || this.$attrs[eventName]; if (args.length && event) { if (Array.isArray(event)) { for (var i2 = 0, l2 = event.length; i2 < l2; i2++) { event[i2].apply(event, _toConsumableArray(args.slice(1))); } } else { event.apply(void 0, _toConsumableArray(args.slice(1))); } } } } }; function flatArray() { var data65 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var childrenName = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "children"; var result = []; var loop = function loop2(array3) { array3.forEach(function(item) { if (item[childrenName]) { var newItem = _extends$1({}, item); delete newItem[childrenName]; result.push(newItem); if (item[childrenName].length > 0) { loop2(item[childrenName]); } } else { result.push(item); } }); }; loop(data65); return result; } function treeMap(tree, mapper) { var childrenName = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "children"; return tree.map(function(node, index2) { var extra = {}; if (node[childrenName]) { extra[childrenName] = treeMap(node[childrenName], mapper, childrenName); } return _extends$1(_extends$1({}, mapper(node, index2)), extra); }); } function flatFilter(tree, callback2) { return tree.reduce(function(acc, node) { if (callback2(node)) { acc.push(node); } if (node.children) { var children = flatFilter(node.children, callback2); acc.push.apply(acc, _toConsumableArray(children)); } return acc; }, []); } function generateValueMaps(items) { var maps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; (items || []).forEach(function(_ref) { var value24 = _ref.value, children = _ref.children; maps[value24.toString()] = value24; generateValueMaps(children, maps); }); return maps; } function stopPropagation$1(e2) { e2.stopPropagation(); } var FilterDropdown = defineComponent({ name: "FilterMenu", mixins: [BaseMixin2], inheritAttrs: false, props: initDefaultProps$1(FilterMenuProps, { column: {} }), setup: function setup109(props2) { var sSelectedKeys = computed(function() { return props2.selectedKeys; }); var sVisible = computed(function() { return "filterDropdownVisible" in props2.column ? props2.column.filterDropdownVisible : false; }); var sValueKeys = computed(function() { return generateValueMaps(props2.column.filters); }); var state = reactive({ neverShown: false, sSelectedKeys: sSelectedKeys.value, sKeyPathOfSelectedItem: {}, sVisible: sVisible.value, sValueKeys: sValueKeys.value }); watch(sSelectedKeys, function() { state.sSelectedKeys = sSelectedKeys.value; }); watch(sVisible, function() { state.sVisible = sVisible.value; }); watch(sValueKeys, function() { state.sValueKeys = sValueKeys.value; }); return state; }, methods: { getDropdownVisible: function getDropdownVisible() { return !!this.sVisible; }, setSelectedKeys: function setSelectedKeys(_ref) { var selectedKeys2 = _ref.selectedKeys; this.setState({ sSelectedKeys: selectedKeys2 }); }, setVisible: function setVisible2(visible9) { var column = this.column; if (!("filterDropdownVisible" in column)) { this.setState({ sVisible: visible9 }); } if (column.onFilterDropdownVisibleChange) { column.onFilterDropdownVisibleChange(visible9); } }, handleClearFilters: function handleClearFilters() { this.setState({ sSelectedKeys: [] }, this.handleConfirm); }, handleConfirm: function handleConfirm() { this.setVisible(false); this.$forceUpdate(); nextTick(this.confirmFilter2); }, onVisibleChange: function onVisibleChange5(visible9) { this.setVisible(visible9); var column = this.$props.column; if (!visible9 && !(column.filterDropdown instanceof Function)) { this.confirmFilter2(); } }, handleMenuItemClick: function handleMenuItemClick(info3) { var selectedKeys2 = this.sSelectedKeys; if (!info3.keyPath || info3.keyPath.length <= 1) { return; } var keyPathOfSelectedItem = this.sKeyPathOfSelectedItem; if (selectedKeys2 && selectedKeys2.indexOf(info3.key) >= 0) { delete keyPathOfSelectedItem[info3.key]; } else { keyPathOfSelectedItem[info3.key] = info3.keyPath; } this.setState({ sKeyPathOfSelectedItem: keyPathOfSelectedItem }); }, hasSubMenu: function hasSubMenu() { var _this$column$filters = this.column.filters, filters = _this$column$filters === void 0 ? [] : _this$column$filters; return filters.some(function(item) { return !!(item.children && item.children.length > 0); }); }, confirmFilter2: function confirmFilter2() { var _this$$props = this.$props, column = _this$$props.column, propSelectedKeys = _this$$props.selectedKeys, confirmFilter = _this$$props.confirmFilter; var selectedKeys2 = this.sSelectedKeys, valueKeys = this.sValueKeys; var filterDropdown = column.filterDropdown; if (!shallowEqual$1(selectedKeys2, propSelectedKeys)) { confirmFilter(column, filterDropdown ? selectedKeys2 : selectedKeys2.map(function(key2) { return valueKeys[key2]; }).filter(function(key2) { return key2 !== void 0; })); } }, renderMenus: function renderMenus(items) { var _this = this; var _this$$props2 = this.$props, dropdownPrefixCls = _this$$props2.dropdownPrefixCls, prefixCls2 = _this$$props2.prefixCls; return items.map(function(item) { if (item.children && item.children.length > 0) { var sKeyPathOfSelectedItem = _this.sKeyPathOfSelectedItem; var containSelected = Object.keys(sKeyPathOfSelectedItem).some(function(key2) { return sKeyPathOfSelectedItem[key2].indexOf(item.value) >= 0; }); var subMenuCls = classNames("".concat(prefixCls2, "-dropdown-submenu"), _defineProperty$12({}, "".concat(dropdownPrefixCls, "-submenu-contain-selected"), containSelected)); return createVNode(SubMenu, { "title": item.text, "popupClassName": subMenuCls, "key": item.value }, { default: function _default8() { return [_this.renderMenus(item.children)]; } }); } return _this.renderMenuItem(item); }); }, renderFilterIcon: function renderFilterIcon() { var _classNames2; var _a3, _b2; var column = this.column, locale2 = this.locale, prefixCls2 = this.prefixCls, selectedKeys2 = this.selectedKeys; var filtered = selectedKeys2 && selectedKeys2.length > 0; var filterIcon = column.filterIcon; if (typeof filterIcon === "function") { filterIcon = filterIcon({ filtered, column }); } var dropdownIconClass = classNames((_classNames2 = {}, _defineProperty$12(_classNames2, "".concat(prefixCls2, "-selected"), "filtered" in column ? column.filtered : filtered), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-open"), this.getDropdownVisible()), _classNames2)); if (!filterIcon) { return createVNode(FilterFilled$1, { "title": locale2.filterTitle, "class": dropdownIconClass, "onClick": stopPropagation$1 }, null); } if (filterIcon.length === 1 && isValidElement(filterIcon[0])) { return cloneElement(filterIcon[0], { title: ((_a3 = filterIcon.props) === null || _a3 === void 0 ? void 0 : _a3.title) || locale2.filterTitle, onClick: stopPropagation$1, class: classNames("".concat(prefixCls2, "-icon"), dropdownIconClass, (_b2 = filterIcon.props) === null || _b2 === void 0 ? void 0 : _b2.class) }); } return createVNode("span", { "class": classNames("".concat(prefixCls2, "-icon"), dropdownIconClass), "onClick": stopPropagation$1 }, [filterIcon]); }, renderMenuItem: function renderMenuItem(item) { var column = this.column; var selectedKeys2 = this.sSelectedKeys; var multiple = "filterMultiple" in column ? column.filterMultiple : true; var input = multiple ? createVNode(Checkbox, { "checked": selectedKeys2 && selectedKeys2.indexOf(item.value) >= 0 }, null) : createVNode(Radio, { "checked": selectedKeys2 && selectedKeys2.indexOf(item.value) >= 0 }, null); return createVNode(MenuItem, { "key": item.value }, { default: function _default8() { return [input, createVNode("span", null, [item.text])]; } }); } }, render: function render96() { var _this2 = this; var originSelectedKeys = this.sSelectedKeys; var column = this.column, locale2 = this.locale, prefixCls2 = this.prefixCls, dropdownPrefixCls = this.dropdownPrefixCls, getPopupContainer2 = this.getPopupContainer; var multiple = "filterMultiple" in column ? column.filterMultiple : true; var dropdownMenuClass = classNames(_defineProperty$12({}, "".concat(dropdownPrefixCls, "-menu-without-submenu"), !this.hasSubMenu())); var filterDropdown = column.filterDropdown; if (filterDropdown instanceof Function) { filterDropdown = filterDropdown({ prefixCls: "".concat(dropdownPrefixCls, "-custom"), setSelectedKeys: function setSelectedKeys2(selectedKeys2) { return _this2.setSelectedKeys({ selectedKeys: selectedKeys2 }); }, selectedKeys: originSelectedKeys, confirm: this.handleConfirm, clearFilters: this.handleClearFilters, filters: column.filters, visible: this.getDropdownVisible(), column }); } var menus = filterDropdown ? createVNode(FilterDropdownMenuWrapper$1, { "class": "".concat(prefixCls2, "-dropdown") }, { default: function _default8() { return [filterDropdown]; } }) : createVNode(FilterDropdownMenuWrapper$1, { "class": "".concat(prefixCls2, "-dropdown") }, { default: function _default8() { return [createVNode(Menu, { "multiple": multiple, "onClick": _this2.handleMenuItemClick, "prefixCls": "".concat(dropdownPrefixCls, "-menu"), "class": dropdownMenuClass, "onSelect": _this2.setSelectedKeys, "onDeselect": _this2.setSelectedKeys, "selectedKeys": originSelectedKeys, "getPopupContainer": getPopupContainer2 }, { default: function _default9() { return [_this2.renderMenus(column.filters)]; } }), createVNode("div", { "class": "".concat(prefixCls2, "-dropdown-btns") }, [createVNode("a", { "class": "".concat(prefixCls2, "-dropdown-link confirm"), "onClick": _this2.handleConfirm }, [locale2.filterConfirm]), createVNode("a", { "class": "".concat(prefixCls2, "-dropdown-link clear"), "onClick": _this2.handleClearFilters }, [locale2.filterReset])])]; } }); return createVNode(Dropdown$1, { "trigger": ["click"], "placement": "bottomRight", "visible": this.getDropdownVisible(), "onVisibleChange": this.onVisibleChange, "getPopupContainer": getPopupContainer2, "forceRender": true, "overlay": menus }, { default: function _default8() { return [_this2.renderFilterIcon()]; } }); } }); var __rest$8 = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var SelectionBox = defineComponent({ name: "SelectionBox", mixins: [BaseMixin], inheritAttrs: false, props: SelectionBoxProps, setup: function setup110(props2) { return { checked: computed(function() { var store = props2.store, defaultSelection = props2.defaultSelection, rowIndex = props2.rowIndex; var checked2 = false; if (store.selectionDirty) { checked2 = store.selectedRowKeys.indexOf(rowIndex) >= 0; } else { checked2 = store.selectedRowKeys.indexOf(rowIndex) >= 0 || defaultSelection.indexOf(rowIndex) >= 0; } return checked2; }) }; }, render: function render97() { var _a3 = _extends$1(_extends$1({}, getOptionProps(this)), this.$attrs), type2 = _a3.type, rowIndex = _a3.rowIndex, rest = __rest$8(_a3, ["type", "rowIndex"]); var checked2 = this.checked; var checkboxProps = _extends$1({ checked: checked2 }, rest); if (type2 === "radio") { checkboxProps.value = rowIndex; return createVNode(Radio, checkboxProps, null); } return createVNode(Checkbox, checkboxProps, null); } }); function checkSelection(_ref) { var store = _ref.store, getCheckboxPropsByItem2 = _ref.getCheckboxPropsByItem, getRecordKey2 = _ref.getRecordKey, data65 = _ref.data, type2 = _ref.type, byDefaultChecked = _ref.byDefaultChecked; return byDefaultChecked ? data65[type2](function(item, i2) { return getCheckboxPropsByItem2(item, i2).defaultChecked; }) : data65[type2](function(item, i2) { return store.selectedRowKeys.indexOf(getRecordKey2(item, i2)) >= 0; }); } function getIndeterminateState(props2) { var store = props2.store, data65 = props2.data; if (!data65.length) { return false; } var someCheckedNotByDefaultChecked = checkSelection(_extends$1(_extends$1({}, props2), { data: data65, type: "some", byDefaultChecked: false })) && !checkSelection(_extends$1(_extends$1({}, props2), { data: data65, type: "every", byDefaultChecked: false })); var someCheckedByDefaultChecked = checkSelection(_extends$1(_extends$1({}, props2), { data: data65, type: "some", byDefaultChecked: true })) && !checkSelection(_extends$1(_extends$1({}, props2), { data: data65, type: "every", byDefaultChecked: true })); if (store.selectionDirty) { return someCheckedNotByDefaultChecked; } return someCheckedNotByDefaultChecked || someCheckedByDefaultChecked; } function getCheckState(props2) { var store = props2.store, data65 = props2.data; if (!data65.length) { return false; } if (store.selectionDirty) { return checkSelection(_extends$1(_extends$1({}, props2), { data: data65, type: "every", byDefaultChecked: false })); } return checkSelection(_extends$1(_extends$1({}, props2), { data: data65, type: "every", byDefaultChecked: false })) || checkSelection(_extends$1(_extends$1({}, props2), { data: data65, type: "every", byDefaultChecked: true })); } var SelectionCheckboxAll = defineComponent({ name: "SelectionCheckboxAll", mixins: [BaseMixin], inheritAttrs: false, props: SelectionCheckboxAllProps, setup: function setup111(props2) { return { defaultSelections: [], checked: computed(function() { return getCheckState(props2); }), indeterminate: computed(function() { return getIndeterminateState(props2); }) }; }, created: function created15() { var props2 = this.$props; this.defaultSelections = props2.hideDefaultSelections ? [] : [{ key: "all", text: props2.locale.selectAll }, { key: "invert", text: props2.locale.selectInvert }]; }, methods: { handleSelectAllChange: function handleSelectAllChange(e2) { var checked2 = e2.target.checked; this.$emit("select", checked2 ? "all" : "removeAll", 0, null); }, renderMenus: function renderMenus2(selections) { var _this = this; return selections.map(function(selection, index2) { return createVNode(Menu.Item, { "key": selection.key || index2 }, { default: function _default8() { return [createVNode("div", { "onClick": function onClick7() { _this.$emit("select", selection.key, index2, selection.onSelect); } }, [selection.text])]; } }); }); } }, render: function render98() { var _this2 = this; var disabled = this.disabled, prefixCls2 = this.prefixCls, selections = this.selections, getPopupContainer2 = this.getPopupContainer, checked2 = this.checked, indeterminate = this.indeterminate; var selectionPrefixCls = "".concat(prefixCls2, "-selection"); var customSelections = null; if (selections) { var newSelections = Array.isArray(selections) ? this.defaultSelections.concat(selections) : this.defaultSelections; var menu = createVNode(Menu, { "class": "".concat(selectionPrefixCls, "-menu"), "selectedKeys": [] }, { default: function _default8() { return [_this2.renderMenus(newSelections)]; } }); customSelections = newSelections.length > 0 ? createVNode(Dropdown$1, { "getPopupContainer": getPopupContainer2, "overlay": menu }, { default: function _default8() { return [createVNode("div", { "class": "".concat(selectionPrefixCls, "-down") }, [createVNode(DownOutlined$1, null, null)])]; } }) : null; } return createVNode("div", { "class": selectionPrefixCls }, [createVNode(Checkbox, { "class": classNames(_defineProperty$12({}, "".concat(selectionPrefixCls, "-select-all-custom"), customSelections)), "checked": checked2, "indeterminate": indeterminate, "disabled": disabled, "onChange": this.handleSelectAllChange }, null), customSelections]); } }); var Column = defineComponent({ name: "ATableColumn", props: columnProps, render: function render99() { return null; } }); var ColumnGroup = defineComponent({ name: "ATableColumnGroup", props: { fixed: withUndefined(PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.oneOf(tuple("left", "right"))])), title: PropsTypes.any }, __ANT_TABLE_COLUMN_GROUP: true, render: function render100() { return null; } }); var BodyRowProps = { store: PropsTypes.object, rowKey: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), prefixCls: PropsTypes.string }; function createBodyRow() { var Component = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "tr"; var BodyRow = defineComponent({ name: "BodyRow", inheritAttrs: false, props: BodyRowProps, setup: function setup123(props2) { return { selected: computed(function() { var _a3; return ((_a3 = props2.store) === null || _a3 === void 0 ? void 0 : _a3.selectedRowKeys.indexOf(props2.rowKey)) >= 0; }) }; }, render: function render123() { var _className, _this = this; var rowProps2 = omit(_extends$1(_extends$1({}, this.$props), this.$attrs), ["prefixCls", "rowKey", "store", "class"]); var className = (_className = {}, _defineProperty$12(_className, "".concat(this.prefixCls, "-row-selected"), this.selected), _defineProperty$12(_className, this.$attrs.class, !!this.$attrs.class), _className); return createVNode(Component, _objectSpread2$2({ "class": className }, rowProps2), { default: function _default8() { return [getSlot$1(_this)]; } }); } }); return BodyRow; } var __rest$7 = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; function noop$2() { } function stopPropagation(e2) { e2.stopPropagation(); } function getRowSelection(props2) { return props2.rowSelection || {}; } function getColumnKey(column, index2) { return column.key || column.dataIndex || index2; } function isSameColumn(a2, b2) { if (a2 && b2 && a2.key && a2.key === b2.key) { return true; } return a2 === b2 || shallowEqual$1(a2, b2, function(value24, other) { if (typeof value24 === "function" && typeof other === "function") { return value24 === other || value24.toString() === other.toString(); } if (Array.isArray(value24) && Array.isArray(other)) { return value24 === other || shallowEqual$1(value24, other); } }); } var defaultPagination = { onChange: noop$2, onShowSizeChange: noop$2 }; var emptyObject = {}; var createComponents = function createComponents2() { var components3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var bodyRow = components3 && components3.body && components3.body.row; return _extends$1(_extends$1({}, components3), { body: _extends$1(_extends$1({}, components3.body), { row: createBodyRow(bodyRow) }) }); }; function isTheSameComponents() { var components1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var components22 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; return components1 === components22 || ["table", "header", "body"].every(function(key2) { return shallowEqual$1(components1[key2], components22[key2]); }); } function getFilteredValueColumns(state, columns2) { return flatFilter(columns2 || (state || {}).columns || [], function(column) { return typeof column.filteredValue !== "undefined"; }); } function getFiltersFromColumns(state, columns2) { var filters = {}; getFilteredValueColumns(state, columns2).forEach(function(col) { var colKey = getColumnKey(col); filters[colKey] = col.filteredValue; }); return filters; } function isFiltersChanged(state, filters) { if (Object.keys(filters).length !== Object.keys(state.filters).length) { return true; } return Object.keys(filters).some(function(columnKey) { return filters[columnKey] !== state.filters[columnKey]; }); } var defaultTableProps = initDefaultProps$1(tableProps, { dataSource: [], useFixedHeader: false, size: "default", loading: false, bordered: false, indentSize: 20, locale: {}, rowKey: "key", showHeader: true, sortDirections: ["ascend", "descend"], childrenColumnName: "children" }); var T$1 = defineComponent({ name: "Table", mixins: [BaseMixin], inheritAttrs: false, Column, ColumnGroup, props: defaultTableProps, setup: function setup112(props2) { var store = reactive({ selectedRowKeys: getRowSelection(props2).selectedRowKeys || [], selectionDirty: false }); return { vcTable: null, checkboxPropsCache: {}, store, configProvider: inject("configProvider", defaultConfigProvider) }; }, data: function data54() { var props2 = getOptionProps(this); warning$5(!props2.expandedRowRender || !("scroll" in props2), "`expandedRowRender` and `scroll` are not compatible. Please use one of them at one time."); var getDefaultSortOrder2 = this.getDefaultSortOrder, getDefaultFilters2 = this.getDefaultFilters, getDefaultPagination2 = this.getDefaultPagination; return _extends$1(_extends$1({}, getDefaultSortOrder2(props2.columns || [])), { sFilters: getDefaultFilters2(props2.columns), sPagination: getDefaultPagination2(this.$props), pivot: void 0, sComponents: markRaw(createComponents(this.components)), filterDataCnt: 0 }); }, watch: { pagination: { handler: function handler4(val) { this.setState(function(previousState) { var newPagination = _extends$1(_extends$1(_extends$1({}, defaultPagination), previousState.sPagination), val); newPagination.current = newPagination.current || 1; newPagination.pageSize = newPagination.pageSize || 10; return { sPagination: val !== false ? newPagination : emptyObject }; }); }, deep: true }, rowSelection: { handler: function handler5(val, oldVal) { if (val && "selectedRowKeys" in val) { this.store.selectedRowKeys = val.selectedRowKeys || []; var rowSelection = this.rowSelection; if (rowSelection && val.getCheckboxProps !== rowSelection.getCheckboxProps) { this.checkboxPropsCache = {}; } } else if (oldVal && !val) { this.store.selectedRowKeys = []; } }, deep: true }, dataSource: function dataSource() { this.store.selectionDirty = false; this.checkboxPropsCache = {}; }, columns: function columns(val) { var filteredValueColumns = getFilteredValueColumns({ columns: val }, val); if (filteredValueColumns.length > 0) { var filtersFromColumns = getFiltersFromColumns({ columns: val }, val); var newFilters = _extends$1({}, this.sFilters); Object.keys(filtersFromColumns).forEach(function(key2) { newFilters[key2] = filtersFromColumns[key2]; }); if (isFiltersChanged({ filters: this.sFilters }, newFilters)) { this.setState({ sFilters: newFilters }); } } }, components: { handler: function handler6(val, oldVal) { if (!isTheSameComponents(val, oldVal)) { var components3 = createComponents(val); this.setState({ sComponents: components3 }); } }, deep: true } }, updated: function updated17() { var columns2 = this.columns, sortColumn = this.sSortColumn, sortOrder = this.sSortOrder; if (this.getSortOrderColumns(columns2).length > 0) { var sortState = this.getSortStateFromColumns(columns2); if (!isSameColumn(sortState.sSortColumn, sortColumn) || sortState.sSortOrder !== sortOrder) { this.setState(sortState); } } }, methods: { setTableRef: function setTableRef(table2) { this.vcTable = table2; }, getCheckboxPropsByItem: function getCheckboxPropsByItem(item, index2) { var rowSelection = getRowSelection(this.$props); if (!rowSelection.getCheckboxProps) { return {}; } var key2 = this.getRecordKey(item, index2); if (!this.checkboxPropsCache[key2]) { this.checkboxPropsCache[key2] = rowSelection.getCheckboxProps(item) || {}; } return this.checkboxPropsCache[key2]; }, getDefaultSelection: function getDefaultSelection() { var _this = this; var rowSelection = getRowSelection(this.$props); if (!rowSelection.getCheckboxProps) { return []; } return this.getFlatData().filter(function(item, rowIndex) { return _this.getCheckboxPropsByItem(item, rowIndex).defaultChecked; }).map(function(record, rowIndex) { return _this.getRecordKey(record, rowIndex); }); }, getDefaultPagination: function getDefaultPagination(props2) { var pagination2 = _typeof$2(props2.pagination) === "object" ? props2.pagination : {}; var current2; if ("current" in pagination2) { current2 = pagination2.current; } else if ("defaultCurrent" in pagination2) { current2 = pagination2.defaultCurrent; } var pageSize2; if ("pageSize" in pagination2) { pageSize2 = pagination2.pageSize; } else if ("defaultPageSize" in pagination2) { pageSize2 = pagination2.defaultPageSize; } return this.hasPagination(props2) ? _extends$1(_extends$1(_extends$1({}, defaultPagination), pagination2), { current: current2 || 1, pageSize: pageSize2 || 10 }) : {}; }, getSortOrderColumns: function getSortOrderColumns(columns2) { return flatFilter(columns2 || this.columns || [], function(column) { return "sortOrder" in column; }); }, getDefaultFilters: function getDefaultFilters(columns2) { var definedFilters = getFiltersFromColumns({ columns: this.columns }, columns2); var defaultFilteredValueColumns = flatFilter(columns2 || [], function(column) { return typeof column.defaultFilteredValue !== "undefined"; }); var defaultFilters = defaultFilteredValueColumns.reduce(function(soFar, col) { var colKey = getColumnKey(col); soFar[colKey] = col.defaultFilteredValue; return soFar; }, {}); return _extends$1(_extends$1({}, defaultFilters), definedFilters); }, getDefaultSortOrder: function getDefaultSortOrder(columns2) { var definedSortState = this.getSortStateFromColumns(columns2); var defaultSortedColumn = flatFilter(columns2 || [], function(column) { return column.defaultSortOrder != null; })[0]; if (defaultSortedColumn && !definedSortState.sortColumn) { return { sSortColumn: defaultSortedColumn, sSortOrder: defaultSortedColumn.defaultSortOrder }; } return definedSortState; }, getSortStateFromColumns: function getSortStateFromColumns(columns2) { var sortedColumn = this.getSortOrderColumns(columns2).filter(function(col) { return col.sortOrder; })[0]; if (sortedColumn) { return { sSortColumn: sortedColumn, sSortOrder: sortedColumn.sortOrder }; } return { sSortColumn: null, sSortOrder: null }; }, getMaxCurrent: function getMaxCurrent(total2) { var _this$sPagination = this.sPagination, current2 = _this$sPagination.current, pageSize2 = _this$sPagination.pageSize; if ((current2 - 1) * pageSize2 >= total2) { return Math.floor((total2 - 1) / pageSize2) + 1; } return current2; }, getRecordKey: function getRecordKey(record, index2) { var rowKey = this.rowKey; var recordKey = typeof rowKey === "function" ? rowKey(record, index2) : record[rowKey]; warning$5(recordKey !== void 0, "Table", "Each record in dataSource of table should have a unique `key` prop, or set `rowKey` of Table to an unique primary key, "); return recordKey === void 0 ? index2 : recordKey; }, getSorterFn: function getSorterFn(state) { var _ref = state || this.$data, sortOrder = _ref.sSortOrder, sortColumn = _ref.sSortColumn; if (!sortOrder || !sortColumn || typeof sortColumn.sorter !== "function") { return; } return function(a2, b2) { var result = sortColumn.sorter(a2, b2, sortOrder); if (result !== 0) { return sortOrder === "descend" ? -result : result; } return 0; }; }, getCurrentPageData: function getCurrentPageData() { var data65 = this.getLocalData(); this.filterDataCnt = data65.length; var current2; var pageSize2; var sPagination = this.sPagination; if (!this.hasPagination()) { pageSize2 = Number.MAX_VALUE; current2 = 1; } else { pageSize2 = sPagination.pageSize; current2 = this.getMaxCurrent(sPagination.total || data65.length); } if (data65.length > pageSize2 || pageSize2 === Number.MAX_VALUE) { data65 = data65.slice((current2 - 1) * pageSize2, current2 * pageSize2); } return data65; }, getFlatData: function getFlatData() { var childrenColumnName = this.$props.childrenColumnName; return flatArray(this.getLocalData(null, false), childrenColumnName); }, getFlatCurrentPageData: function getFlatCurrentPageData() { var childrenColumnName = this.$props.childrenColumnName; return flatArray(this.getCurrentPageData(), childrenColumnName); }, getLocalData: function getLocalData(state) { var _this2 = this; var filter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; var currentState = state || this.$data; var filters = currentState.sFilters; var dataSource2 = this.$props.dataSource; var data65 = dataSource2 || []; data65 = data65.slice(0); var sorterFn = this.getSorterFn(currentState); if (sorterFn) { data65 = this.recursiveSort(_toConsumableArray(data65), sorterFn); } if (filter && filters) { Object.keys(filters).forEach(function(columnKey) { var col = _this2.findColumn(columnKey); if (!col) { return; } var values2 = filters[columnKey] || []; if (values2.length === 0) { return; } var onFilter = col.onFilter; data65 = onFilter ? data65.filter(function(record) { return values2.some(function(v2) { return onFilter(v2, record); }); }) : data65; }); } return data65; }, onRow: function onRow(prefixCls2, record, index2) { var customRow = this.customRow; var custom = customRow ? customRow(record, index2) : {}; return _extends$1(_extends$1({}, custom), { prefixCls: prefixCls2, store: this.store, rowKey: this.getRecordKey(record, index2) }); }, setSelectedRowKeys: function setSelectedRowKeys(selectedRowKeys, selectionInfo) { var _this3 = this; var selectWay = selectionInfo.selectWay, record = selectionInfo.record, checked2 = selectionInfo.checked, changeRowKeys = selectionInfo.changeRowKeys, nativeEvent = selectionInfo.nativeEvent; var rowSelection = getRowSelection(this.$props); if (rowSelection && !("selectedRowKeys" in rowSelection)) { this.store.selectedRowKeys = selectedRowKeys; } var data65 = this.getFlatData(); if (!rowSelection.onChange && !rowSelection[selectWay]) { return; } var selectedRows = data65.filter(function(row, i2) { return selectedRowKeys.indexOf(_this3.getRecordKey(row, i2)) >= 0; }); if (rowSelection.onChange) { rowSelection.onChange(selectedRowKeys, selectedRows); } if (selectWay === "onSelect" && rowSelection.onSelect) { rowSelection.onSelect(record, checked2, selectedRows, nativeEvent); } else if (selectWay === "onSelectMultiple" && rowSelection.onSelectMultiple) { var changeRows = data65.filter(function(row, i2) { return changeRowKeys.indexOf(_this3.getRecordKey(row, i2)) >= 0; }); rowSelection.onSelectMultiple(checked2, selectedRows, changeRows); } else if (selectWay === "onSelectAll" && rowSelection.onSelectAll) { var _changeRows = data65.filter(function(row, i2) { return changeRowKeys.indexOf(_this3.getRecordKey(row, i2)) >= 0; }); rowSelection.onSelectAll(checked2, selectedRows, _changeRows); } else if (selectWay === "onSelectInvert" && rowSelection.onSelectInvert) { rowSelection.onSelectInvert(selectedRowKeys); } }, generatePopupContainerFunc: function generatePopupContainerFunc(getPopupContainer2) { var scroll = this.$props.scroll; var table2 = this.vcTable; if (getPopupContainer2) { return getPopupContainer2; } return scroll && table2 ? function() { return table2.tableNode; } : void 0; }, scrollToFirstRow: function scrollToFirstRow() { var _this4 = this; var scroll = this.$props.scroll; if (scroll && scroll.scrollToFirstRowOnChange !== false) { scrollTo$1(0, { getContainer: function getContainer5() { return _this4.vcTable.ref_bodyTable; } }); } }, isSameColumn: function isSameColumn2(a2, b2) { if (a2 && b2 && a2.key && a2.key === b2.key) { return true; } return a2 === b2 || shallowEqual$1(a2, b2, function(value24, other) { if (typeof value24 === "function" && typeof other === "function") { return value24 === other || value24.toString() === other.toString(); } }); }, handleFilter: function handleFilter(column, nextFilters) { var _this5 = this; var props2 = this.$props; var pagination2 = _extends$1({}, this.sPagination); var filters = _extends$1(_extends$1({}, this.sFilters), _defineProperty$12({}, getColumnKey(column), nextFilters)); var currentColumnKeys = []; treeMap(this.columns, function(c2) { if (!c2.children) { currentColumnKeys.push(getColumnKey(c2)); } }); Object.keys(filters).forEach(function(columnKey) { if (currentColumnKeys.indexOf(columnKey) < 0) { delete filters[columnKey]; } }); if (props2.pagination) { pagination2.current = 1; pagination2.onChange(pagination2.current); } var newState = { sPagination: pagination2, sFilters: {} }; var filtersToSetState = _extends$1({}, filters); getFilteredValueColumns({ columns: props2.columns }).forEach(function(col) { var columnKey = getColumnKey(col); if (columnKey) { delete filtersToSetState[columnKey]; } }); if (Object.keys(filtersToSetState).length > 0) { newState.sFilters = filtersToSetState; } if (_typeof$2(props2.pagination) === "object" && "current" in props2.pagination) { newState.sPagination = _extends$1(_extends$1({}, pagination2), { current: this.sPagination.current }); } this.setState(newState, function() { _this5.scrollToFirstRow(); _this5.store.selectionDirty = false; _this5.$emit.apply(_this5, ["change"].concat(_toConsumableArray(_this5.prepareParamsArguments(_extends$1(_extends$1({}, _this5.$data), { sSelectionDirty: false, sFilters: filters, sPagination: pagination2 }))))); }); }, handleSelect: function handleSelect(record, rowIndex, e2) { var _this6 = this; var checked2 = e2.target.checked; var nativeEvent = e2.nativeEvent; var defaultSelection = this.store.selectionDirty ? [] : this.getDefaultSelection(); var selectedRowKeys = this.store.selectedRowKeys.concat(defaultSelection); var key2 = this.getRecordKey(record, rowIndex); var pivot = this.$data.pivot; var rows = this.getFlatCurrentPageData(); var realIndex = rowIndex; if (this.$props.expandedRowRender) { realIndex = rows.findIndex(function(row) { return _this6.getRecordKey(row, rowIndex) === key2; }); } if (nativeEvent.shiftKey && pivot !== void 0 && realIndex !== pivot) { var changeRowKeys = []; var direction = Math.sign(pivot - realIndex); var dist = Math.abs(pivot - realIndex); var step = 0; var _loop = function _loop2() { var i2 = realIndex + step * direction; step += 1; var row = rows[i2]; var rowKey = _this6.getRecordKey(row, i2); var checkboxProps = _this6.getCheckboxPropsByItem(row, i2); if (!checkboxProps.disabled) { if (selectedRowKeys.includes(rowKey)) { if (!checked2) { selectedRowKeys = selectedRowKeys.filter(function(j2) { return rowKey !== j2; }); changeRowKeys.push(rowKey); } } else if (checked2) { selectedRowKeys.push(rowKey); changeRowKeys.push(rowKey); } } }; while (step <= dist) { _loop(); } this.setState({ pivot: realIndex }); this.store.selectionDirty = true; this.setSelectedRowKeys(selectedRowKeys, { selectWay: "onSelectMultiple", record, checked: checked2, changeRowKeys, nativeEvent }); } else { if (checked2) { selectedRowKeys.push(this.getRecordKey(record, realIndex)); } else { selectedRowKeys = selectedRowKeys.filter(function(i2) { return key2 !== i2; }); } this.setState({ pivot: realIndex }); this.store.selectionDirty = true; this.setSelectedRowKeys(selectedRowKeys, { selectWay: "onSelect", record, checked: checked2, changeRowKeys: void 0, nativeEvent }); } }, handleRadioSelect: function handleRadioSelect(record, rowIndex, e2) { var checked2 = e2.target.checked; var nativeEvent = e2.nativeEvent; var key2 = this.getRecordKey(record, rowIndex); var selectedRowKeys = [key2]; this.store.selectionDirty = true; this.setSelectedRowKeys(selectedRowKeys, { selectWay: "onSelect", record, checked: checked2, changeRowKeys: void 0, nativeEvent }); }, handleSelectRow: function handleSelectRow(selectionKey, index2, onSelectFunc) { var _this7 = this; var data65 = this.getFlatCurrentPageData(); var defaultSelection = this.store.selectionDirty ? [] : this.getDefaultSelection(); var selectedRowKeys = this.store.selectedRowKeys.concat(defaultSelection); var changeableRowKeys = data65.filter(function(item, i2) { return !_this7.getCheckboxPropsByItem(item, i2).disabled; }).map(function(item, i2) { return _this7.getRecordKey(item, i2); }); var changeRowKeys = []; var selectWay = "onSelectAll"; var checked2; switch (selectionKey) { case "all": changeableRowKeys.forEach(function(key2) { if (selectedRowKeys.indexOf(key2) < 0) { selectedRowKeys.push(key2); changeRowKeys.push(key2); } }); selectWay = "onSelectAll"; checked2 = true; break; case "removeAll": changeableRowKeys.forEach(function(key2) { if (selectedRowKeys.indexOf(key2) >= 0) { selectedRowKeys.splice(selectedRowKeys.indexOf(key2), 1); changeRowKeys.push(key2); } }); selectWay = "onSelectAll"; checked2 = false; break; case "invert": changeableRowKeys.forEach(function(key2) { if (selectedRowKeys.indexOf(key2) < 0) { selectedRowKeys.push(key2); } else { selectedRowKeys.splice(selectedRowKeys.indexOf(key2), 1); } changeRowKeys.push(key2); selectWay = "onSelectInvert"; }); break; } this.store.selectionDirty = true; var rowSelection = this.rowSelection; var customSelectionStartIndex = 2; if (rowSelection && rowSelection.hideDefaultSelections) { customSelectionStartIndex = 0; } if (index2 >= customSelectionStartIndex && typeof onSelectFunc === "function") { return onSelectFunc(changeableRowKeys); } this.setSelectedRowKeys(selectedRowKeys, { selectWay, checked: checked2, changeRowKeys }); }, handlePageChange: function handlePageChange(current2) { var props2 = this.$props; var pagination2 = _extends$1({}, this.sPagination); if (current2) { pagination2.current = current2; } else { pagination2.current = pagination2.current || 1; } for (var _len = arguments.length, otherArguments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { otherArguments[_key - 1] = arguments[_key]; } pagination2.onChange.apply(pagination2, [pagination2.current].concat(otherArguments)); var newState = { sPagination: pagination2 }; if (props2.pagination && _typeof$2(props2.pagination) === "object" && "current" in props2.pagination) { newState.sPagination = _extends$1(_extends$1({}, pagination2), { current: this.sPagination.current }); } this.setState(newState, this.scrollToFirstRow); this.store.selectionDirty = false; this.$emit.apply(this, ["change"].concat(_toConsumableArray(this.prepareParamsArguments(_extends$1(_extends$1({}, this.$data), { sSelectionDirty: false, sPagination: pagination2 }))))); }, handleShowSizeChange: function handleShowSizeChange(current2, pageSize2) { var pagination2 = this.sPagination; pagination2.onShowSizeChange(current2, pageSize2); var nextPagination = _extends$1(_extends$1({}, pagination2), { pageSize: pageSize2, current: current2 }); this.setState({ sPagination: nextPagination }, this.scrollToFirstRow); this.$emit.apply(this, ["change"].concat(_toConsumableArray(this.prepareParamsArguments(_extends$1(_extends$1({}, this.$data), { sPagination: nextPagination }))))); }, toggleSortOrder: function toggleSortOrder(column) { var sortDirections = column.sortDirections || this.sortDirections; var sortOrder = this.sSortOrder, sortColumn = this.sSortColumn; var newSortOrder; if (isSameColumn(sortColumn, column) && sortOrder !== void 0) { var methodIndex = sortDirections.indexOf(sortOrder) + 1; newSortOrder = methodIndex === sortDirections.length ? void 0 : sortDirections[methodIndex]; } else { newSortOrder = sortDirections[0]; } var newState = { sSortOrder: newSortOrder, sSortColumn: newSortOrder ? column : null }; if (this.getSortOrderColumns().length === 0) { this.setState(newState, this.scrollToFirstRow); } this.$emit.apply(this, ["change"].concat(_toConsumableArray(this.prepareParamsArguments(_extends$1(_extends$1({}, this.$data), newState), column)))); }, hasPagination: function hasPagination(props2) { return (props2 || this.$props).pagination !== false; }, isSortColumn: function isSortColumn(column) { var sortColumn = this.sSortColumn; if (!column || !sortColumn) { return false; } return getColumnKey(sortColumn) === getColumnKey(column); }, prepareParamsArguments: function prepareParamsArguments(state, column) { var pagination2 = _extends$1({}, state.sPagination); delete pagination2.onChange; delete pagination2.onShowSizeChange; var filters = state.sFilters; var sorter = {}; var currentColumn = column; if (state.sSortColumn && state.sSortOrder) { currentColumn = state.sSortColumn; sorter.column = state.sSortColumn; sorter.order = state.sSortOrder; } if (currentColumn) { sorter.field = currentColumn.dataIndex; sorter.columnKey = getColumnKey(currentColumn); } var extra = { currentDataSource: this.getLocalData(state) }; return [pagination2, filters, sorter, extra]; }, findColumn: function findColumn(myKey) { var column; treeMap(this.columns, function(c2) { if (getColumnKey(c2) === myKey) { column = c2; } }); return column; }, recursiveSort: function recursiveSort(data65, sorterFn) { var _this8 = this; var _this$childrenColumnN = this.childrenColumnName, childrenColumnName = _this$childrenColumnN === void 0 ? "children" : _this$childrenColumnN; return data65.sort(sorterFn).map(function(item) { return item[childrenColumnName] ? _extends$1(_extends$1({}, item), _defineProperty$12({}, childrenColumnName, _this8.recursiveSort(_toConsumableArray(item[childrenColumnName]), sorterFn))) : item; }); }, renderExpandIcon: function renderExpandIcon3(prefixCls2) { if (this.expandIcon) { return this.expandIcon; } return function(_ref2) { var expandable = _ref2.expandable, expanded = _ref2.expanded, needIndentSpaced = _ref2.needIndentSpaced, record = _ref2.record, onExpand3 = _ref2.onExpand; if (expandable) { return createVNode(LocaleReceiver, { "componentName": "Table", "defaultLocale": defaultLocale.Table, "children": function children(locale2) { var _classNames; return createVNode(TransButton$1, { "class": classNames("".concat(prefixCls2, "-row-expand-icon"), (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-row-collapsed"), !expanded), _defineProperty$12(_classNames, "".concat(prefixCls2, "-row-expanded"), expanded), _classNames)), "onClick": function onClick7(event) { onExpand3(record, event); }, "aria-label": expanded ? locale2.collapse : locale2.expand, "noStyle": true }, null); } }, null); } if (needIndentSpaced) { return createVNode("span", { "class": "".concat(prefixCls2, "-row-expand-icon ").concat(prefixCls2, "-row-spaced") }, null); } return null; }; }, renderPagination: function renderPagination2(prefixCls2, paginationPosition) { if (!this.hasPagination()) { return null; } var size = "default"; var pagination2 = this.sPagination; if (pagination2.size) { size = pagination2.size; } else if (this.size === "middle" || this.size === "small") { size = "small"; } var position2 = pagination2.position || "bottom"; var total2 = pagination2.total || this.filterDataCnt; var cls = pagination2.class, style = pagination2.style; pagination2.onChange; pagination2.onShowSizeChange; var restProps = __rest$7(pagination2, ["class", "style", "onChange", "onShowSizeChange"]); var paginationProps3 = _extends$1(_extends$1({ key: "pagination-".concat(paginationPosition), class: classNames(cls, "".concat(prefixCls2, "-pagination")) }, restProps), { total: total2, size, current: this.getMaxCurrent(total2), style, onChange: this.handlePageChange, onShowSizeChange: this.handleShowSizeChange }); return total2 > 0 && (position2 === paginationPosition || position2 === "both") ? createVNode(APagination, paginationProps3, null) : null; }, renderSelectionBox: function renderSelectionBox(type2) { var _this9 = this; return function(_ref3) { var record = _ref3.record, index2 = _ref3.index; var rowKey = _this9.getRecordKey(record, index2); var props2 = _this9.getCheckboxPropsByItem(record, index2); var handleChange17 = function handleChange18(e2) { type2 === "radio" ? _this9.handleRadioSelect(record, index2, e2) : _this9.handleSelect(record, index2, e2); }; var selectionBoxProps = _extends$1({ type: type2, store: _this9.store, rowIndex: rowKey, defaultSelection: _this9.getDefaultSelection(), onChange: handleChange17 }, props2); return createVNode("span", { "onClick": stopPropagation }, [createVNode(SelectionBox, selectionBoxProps, null)]); }; }, renderRowSelection: function renderRowSelection(_ref4) { var _this10 = this; var prefixCls2 = _ref4.prefixCls, locale2 = _ref4.locale, getPopupContainer2 = _ref4.getPopupContainer; var rowSelection = this.rowSelection; var columns2 = this.columns.concat(); if (rowSelection) { var data65 = this.getFlatCurrentPageData().filter(function(item, index2) { if (rowSelection.getCheckboxProps) { return !_this10.getCheckboxPropsByItem(item, index2).disabled; } return true; }); var selectionColumnClass = classNames("".concat(prefixCls2, "-selection-column"), _defineProperty$12({}, "".concat(prefixCls2, "-selection-column-custom"), rowSelection.selections)); var selectionColumn = _defineProperty$12({ key: "selection-column", customRender: this.renderSelectionBox(rowSelection.type), className: selectionColumnClass, fixed: rowSelection.fixed, width: rowSelection.columnWidth, title: rowSelection.columnTitle }, INTERNAL_COL_DEFINE, { class: "".concat(prefixCls2, "-selection-col") }); if (rowSelection.type !== "radio") { var checkboxAllDisabled = data65.every(function(item, index2) { return _this10.getCheckboxPropsByItem(item, index2).disabled; }); selectionColumn.title = selectionColumn.title || createVNode(SelectionCheckboxAll, { "store": this.store, "locale": locale2, "data": data65, "getCheckboxPropsByItem": this.getCheckboxPropsByItem, "getRecordKey": this.getRecordKey, "disabled": checkboxAllDisabled, "prefixCls": prefixCls2, "onSelect": this.handleSelectRow, "selections": rowSelection.selections, "hideDefaultSelections": rowSelection.hideDefaultSelections, "getPopupContainer": this.generatePopupContainerFunc(getPopupContainer2), "propsSymbol": Symbol() }, null); } if ("fixed" in rowSelection) { selectionColumn.fixed = rowSelection.fixed; } else if (columns2.some(function(column) { return column.fixed === "left" || column.fixed === true; })) { selectionColumn.fixed = "left"; } if (columns2[0] && columns2[0].key === "selection-column") { columns2[0] = selectionColumn; } else { columns2.unshift(selectionColumn); } } return columns2; }, renderColumnsDropdown: function renderColumnsDropdown(_ref5) { var _this11 = this; var prefixCls2 = _ref5.prefixCls, dropdownPrefixCls = _ref5.dropdownPrefixCls, columns2 = _ref5.columns, locale2 = _ref5.locale, getPopupContainer2 = _ref5.getPopupContainer; var sortOrder = this.sSortOrder, filters = this.sFilters; return treeMap(columns2, function(column, i2) { var _classNames3; var key2 = getColumnKey(column, i2); var filterDropdown; var sortButton; var customHeaderCell = column.customHeaderCell; var isSortColumn2 = _this11.isSortColumn(column); if (column.filters && column.filters.length > 0 || column.filterDropdown) { var colFilters = key2 in filters ? filters[key2] : []; filterDropdown = createVNode(FilterDropdown, { "locale": locale2, "column": column, "selectedKeys": colFilters, "confirmFilter": _this11.handleFilter, "prefixCls": "".concat(prefixCls2, "-filter"), "dropdownPrefixCls": dropdownPrefixCls || "ant-dropdown", "getPopupContainer": _this11.generatePopupContainerFunc(getPopupContainer2), "key": "filter-dropdown" }, null); } if (column.sorter) { var sortDirections = column.sortDirections || _this11.sortDirections; var isAscend = isSortColumn2 && sortOrder === "ascend"; var isDescend = isSortColumn2 && sortOrder === "descend"; var ascend = sortDirections.indexOf("ascend") !== -1 && createVNode(CaretUpFilled$1, { "class": "".concat(prefixCls2, "-column-sorter-up ").concat(isAscend ? "on" : "off"), "key": "caret-up" }, null); var descend = sortDirections.indexOf("descend") !== -1 && createVNode(CaretDownFilled$1, { "class": "".concat(prefixCls2, "-column-sorter-down ").concat(isDescend ? "on" : "off"), "key": "caret-down" }, null); sortButton = createVNode("div", { "title": locale2.sortTitle, "class": classNames("".concat(prefixCls2, "-column-sorter-inner"), ascend && descend && "".concat(prefixCls2, "-column-sorter-inner-full")), "key": "sorter" }, [ascend, descend]); customHeaderCell = function customHeaderCell2(col) { var colProps2 = {}; if (column.customHeaderCell) { colProps2 = _extends$1({}, column.customHeaderCell(col)); } var onHeaderCellClick = colProps2.onClick; colProps2.onClick = function() { _this11.toggleSortOrder(column); if (onHeaderCellClick) { onHeaderCellClick.apply(void 0, arguments); } }; return colProps2; }; } return _extends$1(_extends$1({}, column), { className: classNames(column.className, (_classNames3 = {}, _defineProperty$12(_classNames3, "".concat(prefixCls2, "-column-has-actions"), sortButton || filterDropdown), _defineProperty$12(_classNames3, "".concat(prefixCls2, "-column-has-filters"), filterDropdown), _defineProperty$12(_classNames3, "".concat(prefixCls2, "-column-has-sorters"), sortButton), _defineProperty$12(_classNames3, "".concat(prefixCls2, "-column-sort"), isSortColumn2 && sortOrder), _classNames3)), title: [createVNode("span", { "key": "title", "class": "".concat(prefixCls2, "-header-column") }, [createVNode("div", { "class": sortButton ? "".concat(prefixCls2, "-column-sorters") : void 0 }, [createVNode("span", { "class": "".concat(prefixCls2, "-column-title") }, [_this11.renderColumnTitle(column.title)]), createVNode("span", { "class": "".concat(prefixCls2, "-column-sorter") }, [sortButton])])]), filterDropdown], customHeaderCell }); }); }, renderColumnTitle: function renderColumnTitle(title) { var _this$$data = this.$data, filters = _this$$data.sFilters, sortOrder = _this$$data.sSortOrder, sortColumn = _this$$data.sSortColumn; if (title instanceof Function) { return title({ filters, sortOrder, sortColumn }); } return title; }, renderTable: function renderTable2(_ref6) { var _classNames4, _this12 = this; var prefixCls2 = _ref6.prefixCls, renderEmpty2 = _ref6.renderEmpty, dropdownPrefixCls = _ref6.dropdownPrefixCls, contextLocale = _ref6.contextLocale, contextGetPopupContainer = _ref6.getPopupContainer, transformCellText = _ref6.transformCellText; var _a3 = _extends$1(_extends$1({}, getOptionProps(this)), this.$attrs), showHeader = _a3.showHeader, locale2 = _a3.locale, getPopupContainer2 = _a3.getPopupContainer; _a3.style; var restProps = __rest$7(_a3, ["showHeader", "locale", "getPopupContainer", "style"]); var data65 = this.getCurrentPageData(); var expandIconAsCell = this.expandedRowRender && this.expandIconAsCell !== false; var realGetPopupContainer = getPopupContainer2 || contextGetPopupContainer; var mergedLocale = _extends$1(_extends$1({}, contextLocale), locale2); if (!locale2 || !locale2.emptyText) { mergedLocale.emptyText = renderEmpty2("Table"); } var classString = classNames((_classNames4 = {}, _defineProperty$12(_classNames4, "".concat(prefixCls2, "-").concat(this.size), true), _defineProperty$12(_classNames4, "".concat(prefixCls2, "-bordered"), this.bordered), _defineProperty$12(_classNames4, "".concat(prefixCls2, "-empty"), !data65.length), _defineProperty$12(_classNames4, "".concat(prefixCls2, "-without-column-header"), !showHeader), _classNames4)); var columnsWithRowSelection = this.renderRowSelection({ prefixCls: prefixCls2, locale: mergedLocale, getPopupContainer: realGetPopupContainer }); var columns2 = this.renderColumnsDropdown({ columns: columnsWithRowSelection, prefixCls: prefixCls2, dropdownPrefixCls, locale: mergedLocale, getPopupContainer: realGetPopupContainer }).map(function(column, i2) { var newColumn = _extends$1({}, column); newColumn.key = getColumnKey(newColumn, i2); return newColumn; }); var expandIconColumnIndex = columns2[0] && columns2[0].key === "selection-column" ? 1 : 0; if ("expandIconColumnIndex" in restProps) { expandIconColumnIndex = restProps.expandIconColumnIndex; } var vcTableProps = _extends$1(_extends$1({ key: "table", expandIcon: this.renderExpandIcon(prefixCls2) }, restProps), { customRow: function customRow(record, index2) { return _this12.onRow(prefixCls2, record, index2); }, components: this.sComponents, prefixCls: prefixCls2, data: data65, columns: columns2, showHeader, expandIconColumnIndex, expandIconAsCell, emptyText: mergedLocale.emptyText, transformCellText, class: classString, ref: this.setTableRef }); return createVNode(Table$2, vcTableProps, null); } }, render: function render101() { var _this13 = this; var customizePrefixCls = this.prefixCls, customizeDropdownPrefixCls = this.dropdownPrefixCls, customizeTransformCellText = this.transformCellText; var data65 = this.getCurrentPageData(); var _this$configProvider = this.configProvider, getContextPopupContainer = _this$configProvider.getPopupContainer, tct = _this$configProvider.transformCellText; var getPopupContainer2 = this.getPopupContainer || getContextPopupContainer; var transformCellText = customizeTransformCellText || tct; var loading = this.loading; if (typeof loading === "boolean") { loading = { spinning: loading }; } var getPrefixCls2 = this.configProvider.getPrefixCls; var renderEmpty2 = this.configProvider.renderEmpty; var prefixCls2 = getPrefixCls2("table", customizePrefixCls); var dropdownPrefixCls = getPrefixCls2("dropdown", customizeDropdownPrefixCls); var table2 = createVNode(LocaleReceiver, { "componentName": "Table", "defaultLocale": defaultLocale.Table, "children": function children(locale2) { return _this13.renderTable({ prefixCls: prefixCls2, renderEmpty: renderEmpty2, dropdownPrefixCls, contextLocale: locale2, getPopupContainer: getPopupContainer2, transformCellText }); } }, null); var paginationPatchClass = this.hasPagination() && data65 && data65.length !== 0 ? "".concat(prefixCls2, "-with-pagination") : "".concat(prefixCls2, "-without-pagination"); var spinProps = _extends$1(_extends$1({}, loading), { class: loading && loading.spinning ? "".concat(paginationPatchClass, " ").concat(prefixCls2, "-spin-holder") : "" }); var _this$$attrs = this.$attrs, className = _this$$attrs.class, style = _this$$attrs.style; return createVNode("div", { "class": classNames("".concat(prefixCls2, "-wrapper"), className), "style": style }, [createVNode(Spin, spinProps, { default: function _default8() { return [_this13.renderPagination(prefixCls2, "top"), table2, _this13.renderPagination(prefixCls2, "bottom")]; } })]); } }); var __rest$6 = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var Table = defineComponent({ name: "ATable", Column: T$1.Column, ColumnGroup: T$1.ColumnGroup, inheritAttrs: false, props: defaultTableProps, methods: { normalize: function normalize() { var _this = this; var elements = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var flattenElements = flattenChildren(elements); var columns2 = []; flattenElements.forEach(function(element) { var _a3, _b2, _c, _d; if (!element) { return; } var key2 = getKey$2(element); var style = ((_a3 = element.props) === null || _a3 === void 0 ? void 0 : _a3.style) || {}; var cls = ((_b2 = element.props) === null || _b2 === void 0 ? void 0 : _b2.class) || ""; var props2 = getPropsData(element); var _e = element.children || {}, children = _e.default, restSlots = __rest$6(_e, ["default"]); var column = _extends$1(_extends$1(_extends$1({}, restSlots), props2), { style, class: cls }); if (key2) { column.key = key2; } if ((_c = element.type) === null || _c === void 0 ? void 0 : _c.__ANT_TABLE_COLUMN_GROUP) { column.children = _this.normalize(typeof children === "function" ? children() : children); } else { var customRender = (_d = element.children) === null || _d === void 0 ? void 0 : _d.default; column.customRender = column.customRender || customRender; } columns2.push(column); }); return columns2; }, updateColumns: function updateColumns() { var _this2 = this; var cols = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var columns2 = []; var $slots = this.$slots; cols.forEach(function(col) { var _col$slots = col.slots, slots = _col$slots === void 0 ? {} : _col$slots, restProps = __rest$6(col, ["slots"]); var column = _extends$1({}, restProps); Object.keys(slots).forEach(function(key2) { var name = slots[key2]; if (column[key2] === void 0 && $slots[name]) { column[key2] = $slots[name]; } }); if (col.children) { column.children = _this2.updateColumns(column.children); } columns2.push(column); }); return columns2; } }, render: function render102() { var normalize2 = this.normalize, $slots = this.$slots; var props2 = _extends$1(_extends$1({}, getOptionProps(this)), this.$attrs); var columns2 = props2.columns ? this.updateColumns(props2.columns) : normalize2(getSlot$1(this)); var title = props2.title, footer = props2.footer; var slotTitle = $slots.title, slotFooter = $slots.footer, _$slots$expandedRowRe = $slots.expandedRowRender, expandedRowRender = _$slots$expandedRowRe === void 0 ? props2.expandedRowRender : _$slots$expandedRowRe, expandIcon = $slots.expandIcon; title = title || slotTitle; footer = footer || slotFooter; var tProps = _extends$1(_extends$1({}, props2), { columns: columns2, title, footer, expandedRowRender, expandIcon: this.$props.expandIcon || expandIcon }); return createVNode(T$1, _objectSpread2$2(_objectSpread2$2({}, tProps), {}, { "ref": "table" }), null); } }); Table.install = function(app) { app.component(Table.name, Table); app.component(Table.Column.name, Table.Column); app.component(Table.ColumnGroup.name, Table.ColumnGroup); return app; }; Table.Column; Table.ColumnGroup; var Table$1 = Table; var FileOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z" } }] }, "name": "file", "theme": "outlined" }; var FileOutlinedSvg = FileOutlined$1; function _objectSpread$q(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$r(target, key2, source2[key2]); }); } return target; } function _defineProperty$r(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var FileOutlined = function FileOutlined2(props2, context2) { var p = _objectSpread$q({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$q({}, p, { "icon": FileOutlinedSvg }), null); }; FileOutlined.displayName = "FileOutlined"; FileOutlined.inheritAttrs = false; var FileTwoTone = FileOutlined; var MinusSquareOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" } }, { "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, "name": "minus-square", "theme": "outlined" }; var MinusSquareOutlinedSvg = MinusSquareOutlined$2; function _objectSpread$p(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$q(target, key2, source2[key2]); }); } return target; } function _defineProperty$q(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var MinusSquareOutlined = function MinusSquareOutlined2(props2, context2) { var p = _objectSpread$p({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$p({}, p, { "icon": MinusSquareOutlinedSvg }), null); }; MinusSquareOutlined.displayName = "MinusSquareOutlined"; MinusSquareOutlined.inheritAttrs = false; var MinusSquareOutlined$1 = MinusSquareOutlined; var PlusSquareOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" } }, { "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, "name": "plus-square", "theme": "outlined" }; var PlusSquareOutlinedSvg = PlusSquareOutlined$2; function _objectSpread$o(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$p(target, key2, source2[key2]); }); } return target; } function _defineProperty$p(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var PlusSquareOutlined = function PlusSquareOutlined2(props2, context2) { var p = _objectSpread$o({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$o({}, p, { "icon": PlusSquareOutlinedSvg }), null); }; PlusSquareOutlined.displayName = "PlusSquareOutlined"; PlusSquareOutlined.inheritAttrs = false; var PlusSquareOutlined$1 = PlusSquareOutlined; function _createForOfIteratorHelper(o2, allowArrayLike) { var it = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"]; if (!it) { if (Array.isArray(o2) || (it = _unsupportedIterableToArray$4(o2)) || allowArrayLike && o2 && typeof o2.length === "number") { if (it) o2 = it; var i2 = 0; var F2 = function F3() { }; return { s: F2, n: function n2() { if (i2 >= o2.length) return { done: true }; return { done: false, value: o2[i2++] }; }, e: function e2(_e) { throw _e; }, f: F2 }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s2() { it = it.call(o2); }, n: function n2() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e2(_e2) { didErr = true; err = _e2; }, f: function f2() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function noop$1() { } var ICON_OPEN = "open"; var ICON_CLOSE = "close"; var defaultTitle = "---"; var TreeNode$3 = defineComponent({ name: "TreeNode", mixins: [BaseMixin], inheritAttrs: false, __ANT_TREE_NODE: true, props: initDefaultProps$2({ eventKey: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), prefixCls: PropsTypes.string, root: PropsTypes.object, expanded: PropsTypes.looseBool, selected: PropsTypes.looseBool, checked: PropsTypes.looseBool, loaded: PropsTypes.looseBool, loading: PropsTypes.looseBool, halfChecked: PropsTypes.looseBool, title: PropsTypes.any, pos: PropsTypes.string, dragOver: PropsTypes.looseBool, dragOverGapTop: PropsTypes.looseBool, dragOverGapBottom: PropsTypes.looseBool, isLeaf: PropsTypes.looseBool, checkable: PropsTypes.looseBool, selectable: PropsTypes.looseBool, disabled: PropsTypes.looseBool, disableCheckbox: PropsTypes.looseBool, icon: PropsTypes.any, dataRef: PropsTypes.object, switcherIcon: PropsTypes.any, label: PropsTypes.any, value: PropsTypes.any }, {}), setup: function setup113() { return { vcTree: inject("vcTree", {}), vcTreeNode: inject("vcTreeNode", {}) }; }, data: function data55() { this.children = null; return { dragNodeHighlight: false }; }, created: function created16() { provide("vcTreeNode", this); }, mounted: function mounted30() { var eventKey = this.eventKey, registerTreeNode2 = this.vcTree.registerTreeNode; this.syncLoadData(this.$props); registerTreeNode2 && registerTreeNode2(eventKey, this); }, updated: function updated18() { this.syncLoadData(this.$props); }, beforeUnmount: function beforeUnmount20() { var eventKey = this.eventKey, registerTreeNode2 = this.vcTree.registerTreeNode; registerTreeNode2 && registerTreeNode2(eventKey, null); }, methods: { onSelectorClick: function onSelectorClick(e2) { var onNodeClick2 = this.vcTree.onNodeClick; onNodeClick2(e2, this); if (this.isSelectable()) { this.onSelect(e2); } else { this.onCheck(e2); } }, onSelectorDoubleClick: function onSelectorDoubleClick(e2) { var onNodeDoubleClick2 = this.vcTree.onNodeDoubleClick; onNodeDoubleClick2(e2, this); }, onSelect: function onSelect5(e2) { if (this.isDisabled()) return; var onNodeSelect2 = this.vcTree.onNodeSelect; e2.preventDefault(); onNodeSelect2(e2, this); }, onCheck: function onCheck(e2) { if (this.isDisabled()) return; var disableCheckbox = this.disableCheckbox, checked2 = this.checked; var onNodeCheck2 = this.vcTree.onNodeCheck; if (!this.isCheckable() || disableCheckbox) return; e2.preventDefault(); var targetChecked = !checked2; onNodeCheck2(e2, this, targetChecked); }, onMouseEnter: function onMouseEnter3(e2) { var onNodeMouseEnter2 = this.vcTree.onNodeMouseEnter; onNodeMouseEnter2(e2, this); }, onMouseLeave: function onMouseLeave4(e2) { var onNodeMouseLeave2 = this.vcTree.onNodeMouseLeave; onNodeMouseLeave2(e2, this); }, onContextMenu: function onContextMenu2(e2) { var onNodeContextMenu2 = this.vcTree.onNodeContextMenu; onNodeContextMenu2(e2, this); }, onDragStart: function onDragStart(e2) { var onNodeDragStart2 = this.vcTree.onNodeDragStart; e2.stopPropagation(); this.setState({ dragNodeHighlight: true }); onNodeDragStart2(e2, this); try { e2.dataTransfer.setData("text/plain", ""); } catch (error3) { } }, onDragEnter: function onDragEnter(e2) { var onNodeDragEnter2 = this.vcTree.onNodeDragEnter; e2.preventDefault(); e2.stopPropagation(); onNodeDragEnter2(e2, this); }, onDragOver: function onDragOver(e2) { var onNodeDragOver2 = this.vcTree.onNodeDragOver; e2.preventDefault(); e2.stopPropagation(); onNodeDragOver2(e2, this); }, onDragLeave: function onDragLeave(e2) { var onNodeDragLeave2 = this.vcTree.onNodeDragLeave; e2.stopPropagation(); onNodeDragLeave2(e2, this); }, onDragEnd: function onDragEnd(e2) { var onNodeDragEnd2 = this.vcTree.onNodeDragEnd; e2.stopPropagation(); this.setState({ dragNodeHighlight: false }); onNodeDragEnd2(e2, this); }, onDrop: function onDrop(e2) { var onNodeDrop2 = this.vcTree.onNodeDrop; e2.preventDefault(); e2.stopPropagation(); this.setState({ dragNodeHighlight: false }); onNodeDrop2(e2, this); }, onExpand: function onExpand2(e2) { var onNodeExpand2 = this.vcTree.onNodeExpand; onNodeExpand2(e2, this); }, setSelectHandle: function setSelectHandle(node) { this.selectHandle = node; }, getNodeChildren: function getNodeChildren$1() { var originList = this.children; var targetList = getNodeChildren(originList); if (originList.length !== targetList.length) ; return targetList; }, getNodeState: function getNodeState() { var expanded = this.expanded; if (this.isLeaf2()) { return null; } return expanded ? ICON_OPEN : ICON_CLOSE; }, isLeaf2: function isLeaf2() { var isLeaf = this.isLeaf, loaded2 = this.loaded; var loadData = this.vcTree.loadData; var hasChildren = this.getNodeChildren().length !== 0; if (isLeaf === false) { return false; } return isLeaf || !loadData && !hasChildren || loadData && loaded2 && !hasChildren; }, isDisabled: function isDisabled() { var disabled = this.disabled; var treeDisabled = this.vcTree.disabled; if (disabled === false) { return false; } return !!(treeDisabled || disabled); }, isCheckable: function isCheckable() { var checkable = this.$props.checkable; var treeCheckable = this.vcTree.checkable; if (!treeCheckable || checkable === false) return false; return treeCheckable; }, syncLoadData: function syncLoadData(props2) { var expanded = props2.expanded, loading = props2.loading, loaded2 = props2.loaded; var _this$vcTree = this.vcTree, loadData = _this$vcTree.loadData, onNodeLoad2 = _this$vcTree.onNodeLoad; if (loading) return; if (loadData && expanded && !this.isLeaf2()) { var hasChildren = this.getNodeChildren().length !== 0; if (!hasChildren && !loaded2) { onNodeLoad2(this); } } }, isSelectable: function isSelectable() { var selectable = this.selectable; var treeSelectable = this.vcTree.selectable; if (typeof selectable === "boolean") { return selectable; } return treeSelectable; }, renderSwitcher: function renderSwitcher() { var expanded = this.expanded; var prefixCls2 = this.vcTree.prefixCls; var switcherIcon = getComponent(this, "switcherIcon", {}, false) || getComponent(this.vcTree, "switcherIcon", {}, false); if (this.isLeaf2()) { return createVNode("span", { "key": "switcher", "class": classNames("".concat(prefixCls2, "-switcher"), "".concat(prefixCls2, "-switcher-noop")) }, [typeof switcherIcon === "function" ? switcherIcon(_extends$1(_extends$1(_extends$1({}, this.$props), this.$props.dataRef), { isLeaf: true })) : switcherIcon]); } var switcherCls = classNames("".concat(prefixCls2, "-switcher"), "".concat(prefixCls2, "-switcher_").concat(expanded ? ICON_OPEN : ICON_CLOSE)); return createVNode("span", { "key": "switcher", "onClick": this.onExpand, "class": switcherCls }, [typeof switcherIcon === "function" ? switcherIcon(_extends$1(_extends$1(_extends$1({}, this.$props), this.$props.dataRef), { isLeaf: false })) : switcherIcon]); }, renderCheckbox: function renderCheckbox() { var checked2 = this.checked, halfChecked = this.halfChecked, disableCheckbox = this.disableCheckbox; var prefixCls2 = this.vcTree.prefixCls; var disabled = this.isDisabled(); var checkable = this.isCheckable(); if (!checkable) return null; var $custom = typeof checkable !== "boolean" ? checkable : null; return createVNode("span", { "key": "checkbox", "class": classNames("".concat(prefixCls2, "-checkbox"), checked2 && "".concat(prefixCls2, "-checkbox-checked"), !checked2 && halfChecked && "".concat(prefixCls2, "-checkbox-indeterminate"), (disabled || disableCheckbox) && "".concat(prefixCls2, "-checkbox-disabled")), "onClick": this.onCheck }, [$custom]); }, renderIcon: function renderIcon2() { var loading = this.loading; var prefixCls2 = this.vcTree.prefixCls; return createVNode("span", { "key": "icon", "class": classNames("".concat(prefixCls2, "-iconEle"), "".concat(prefixCls2, "-icon__").concat(this.getNodeState() || "docu"), loading && "".concat(prefixCls2, "-icon_loading")) }, null); }, renderSelector: function renderSelector() { var selected = this.selected, loading = this.loading, dragNodeHighlight = this.dragNodeHighlight; var icon = getComponent(this, "icon", {}, false); var _this$vcTree2 = this.vcTree, prefixCls2 = _this$vcTree2.prefixCls, showIcon = _this$vcTree2.showIcon, treeIcon = _this$vcTree2.icon, draggable = _this$vcTree2.draggable, loadData = _this$vcTree2.loadData; var disabled = this.isDisabled(); var title = getComponent(this, "title", {}, false); var wrapClass = "".concat(prefixCls2, "-node-content-wrapper"); var $icon; if (showIcon) { var currentIcon = icon || treeIcon; $icon = currentIcon ? createVNode("span", { "class": classNames("".concat(prefixCls2, "-iconEle"), "".concat(prefixCls2, "-icon__customize")) }, [typeof currentIcon === "function" ? currentIcon(_extends$1(_extends$1({}, this.$props), this.$props.dataRef)) : currentIcon]) : this.renderIcon(); } else if (loadData && loading) { $icon = this.renderIcon(); } var currentTitle = title; var $title = currentTitle ? createVNode("span", { "class": "".concat(prefixCls2, "-title") }, [typeof currentTitle === "function" ? currentTitle(_extends$1(_extends$1({}, this.$props), this.$props.dataRef)) : currentTitle]) : createVNode("span", { "class": "".concat(prefixCls2, "-title") }, [defaultTitle]); return createVNode("span", { "key": "selector", "ref": this.setSelectHandle, "title": typeof title === "string" ? title : "", "class": classNames("".concat(wrapClass), "".concat(wrapClass, "-").concat(this.getNodeState() || "normal"), !disabled && (selected || dragNodeHighlight) && "".concat(prefixCls2, "-node-selected"), !disabled && draggable && "draggable"), "draggable": !disabled && draggable || void 0, "aria-grabbed": !disabled && draggable || void 0, "onMouseenter": this.onMouseEnter, "onMouseleave": this.onMouseLeave, "onContextmenu": this.onContextMenu, "onClick": this.onSelectorClick, "onDblclick": this.onSelectorDoubleClick, "onDragstart": draggable ? this.onDragStart : noop$1 }, [$icon, $title]); }, renderChildren: function renderChildren3() { var expanded = this.expanded, pos = this.pos; var _this$vcTree3 = this.vcTree, prefixCls2 = _this$vcTree3.prefixCls, openTransitionName = _this$vcTree3.openTransitionName, openAnimation = _this$vcTree3.openAnimation, renderTreeNode2 = _this$vcTree3.renderTreeNode; var animProps = {}; if (openTransitionName) { animProps = getTransitionProps(openTransitionName); } else if (_typeof$2(openAnimation) === "object") { animProps = _extends$1(_extends$1(_extends$1({}, openAnimation), { css: false }), animProps); } var nodeList2 = this.getNodeChildren(); if (nodeList2.length === 0) { return null; } var $children; if (expanded) { $children = createVNode("ul", { "class": classNames("".concat(prefixCls2, "-child-tree"), expanded && "".concat(prefixCls2, "-child-tree-open")), "data-expanded": expanded, "role": "group" }, [mapChildren(nodeList2, function(node, index2) { return renderTreeNode2(node, index2, pos); })]); } return createVNode(Transition, animProps, { default: function _default8() { return [$children]; } }); } }, render: function render103() { var _ref; this.children = getSlot$1(this); var _this$$props = this.$props, dragOver = _this$$props.dragOver, dragOverGapTop = _this$$props.dragOverGapTop, dragOverGapBottom = _this$$props.dragOverGapBottom, isLeaf = _this$$props.isLeaf, expanded = _this$$props.expanded, selected = _this$$props.selected, checked2 = _this$$props.checked, halfChecked = _this$$props.halfChecked, loading = _this$$props.loading; var _this$vcTree4 = this.vcTree, prefixCls2 = _this$vcTree4.prefixCls, filterTreeNode2 = _this$vcTree4.filterTreeNode, draggable = _this$vcTree4.draggable; var disabled = this.isDisabled(); var dataOrAriaAttributeProps = getDataAndAria(_extends$1(_extends$1({}, this.$props), this.$attrs)); var _this$$attrs = this.$attrs, className = _this$$attrs.class, style = _this$$attrs.style; return createVNode("li", _objectSpread2$2({ "class": (_ref = {}, _defineProperty$12(_ref, className, className), _defineProperty$12(_ref, "".concat(prefixCls2, "-treenode-disabled"), disabled), _defineProperty$12(_ref, "".concat(prefixCls2, "-treenode-switcher-").concat(expanded ? "open" : "close"), !isLeaf), _defineProperty$12(_ref, "".concat(prefixCls2, "-treenode-checkbox-checked"), checked2), _defineProperty$12(_ref, "".concat(prefixCls2, "-treenode-checkbox-indeterminate"), halfChecked), _defineProperty$12(_ref, "".concat(prefixCls2, "-treenode-selected"), selected), _defineProperty$12(_ref, "".concat(prefixCls2, "-treenode-loading"), loading), _defineProperty$12(_ref, "drag-over", !disabled && dragOver), _defineProperty$12(_ref, "drag-over-gap-top", !disabled && dragOverGapTop), _defineProperty$12(_ref, "drag-over-gap-bottom", !disabled && dragOverGapBottom), _defineProperty$12(_ref, "filter-node", filterTreeNode2 && filterTreeNode2(this)), _ref), "style": style, "role": "treeitem", "onDragenter": draggable ? this.onDragEnter : noop$1, "onDragover": draggable ? this.onDragOver : noop$1, "onDragleave": draggable ? this.onDragLeave : noop$1, "onDrop": draggable ? this.onDrop : noop$1, "onDragend": draggable ? this.onDragEnd : noop$1 }, dataOrAriaAttributeProps), [this.renderSwitcher(), this.renderCheckbox(), this.renderSelector(), this.renderChildren()]); } }); TreeNode$3.isTreeNode = 1; var TreeNode$4 = TreeNode$3; var __rest$5 = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var DRAG_SIDE_RANGE = 0.25; var DRAG_MIN_GAP = 2; function arrDel(list, value24) { var clone4 = list.slice(); var index2 = clone4.indexOf(value24); if (index2 >= 0) { clone4.splice(index2, 1); } return clone4; } function arrAdd(list, value24) { var clone4 = list.slice(); if (clone4.indexOf(value24) === -1) { clone4.push(value24); } return clone4; } function posToArr(pos) { return pos.split("-"); } function getPosition(level2, index2) { return "".concat(level2, "-").concat(index2); } function isTreeNode(node) { return node.type && node.type.isTreeNode; } function getNodeChildren() { var children = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; return children.filter(isTreeNode); } function isCheckDisabled(node) { var _ref = getOptionProps(node) || {}, disabled = _ref.disabled, disableCheckbox = _ref.disableCheckbox, checkable = _ref.checkable; return !!(disabled || disableCheckbox) || checkable === false; } function traverseTreeNodes(treeNodes, callback2) { function processNode(node, index2, parent2) { var children = node ? getSlot$1(node) : treeNodes; var pos = node ? getPosition(parent2.pos, index2) : 0; var childList = getNodeChildren(children); if (node) { var key2 = node.key; if (!key2 && (key2 === void 0 || key2 === null)) { key2 = pos; } var data65 = { node, index: index2, pos, key: key2, parentPos: parent2.node ? parent2.pos : null }; callback2(data65); } childList.forEach(function(subNode, subIndex) { processNode(subNode, subIndex, { node, pos }); }); } processNode(null); } function mapChildren() { var children = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var func = arguments.length > 1 ? arguments[1] : void 0; var list = children.map(func); if (list.length === 1) { return list[0]; } return list; } function getDragNodesKeys(treeNodes, node) { var _getOptionProps = getOptionProps(node), eventKey = _getOptionProps.eventKey, pos = _getOptionProps.pos; var dragNodesKeys = []; traverseTreeNodes(treeNodes, function(_ref2) { var key2 = _ref2.key; dragNodesKeys.push(key2); }); dragNodesKeys.push(eventKey || pos); return dragNodesKeys; } function calcDropPosition(event, treeNode) { var clientY = event.clientY; var _treeNode$selectHandl = treeNode.selectHandle.getBoundingClientRect(), top = _treeNode$selectHandl.top, bottom = _treeNode$selectHandl.bottom, height = _treeNode$selectHandl.height; var des = Math.max(height * DRAG_SIDE_RANGE, DRAG_MIN_GAP); if (clientY <= top + des) { return -1; } if (clientY >= bottom - des) { return 1; } return 0; } function calcSelectedKeys(selectedKeys2, props2) { if (!selectedKeys2) { return void 0; } var multiple = props2.multiple; if (multiple) { return selectedKeys2.slice(); } if (selectedKeys2.length) { return [selectedKeys2[0]]; } return selectedKeys2; } var internalProcessProps = function internalProcessProps2() { var props2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; return _extends$1(_extends$1({}, props2), { class: props2.class || props2.className, style: props2.style, key: props2.key }); }; function convertDataToTree$1(treeData, processor) { if (!treeData) return []; var _ref3 = processor || {}, _ref3$processProps = _ref3.processProps, processProps2 = _ref3$processProps === void 0 ? internalProcessProps : _ref3$processProps; var list = Array.isArray(treeData) ? treeData : [treeData]; return list.map(function(_a3) { var children = _a3.children, props2 = __rest$5(_a3, ["children"]); var childrenNodes = convertDataToTree$1(children, processor); return createVNode(TreeNode$4, processProps2(props2), { default: function _default8() { return [childrenNodes]; } }); }); } function convertTreeToEntities$1(treeNodes) { var _ref4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, initWrapper2 = _ref4.initWrapper, processEntity2 = _ref4.processEntity, onProcessFinished = _ref4.onProcessFinished; var posEntities = /* @__PURE__ */ new Map(); var keyEntities = /* @__PURE__ */ new Map(); var wrapper = { posEntities, keyEntities }; if (initWrapper2) { wrapper = initWrapper2(wrapper) || wrapper; } traverseTreeNodes(treeNodes, function(item) { var node = item.node, index2 = item.index, pos = item.pos, key2 = item.key, parentPos = item.parentPos; var entity = { node, index: index2, key: key2, pos }; posEntities.set(pos, entity); keyEntities.set(key2, entity); entity.parent = posEntities.get(parentPos); if (entity.parent) { entity.parent.children = entity.parent.children || []; entity.parent.children.push(entity); } if (processEntity2) { processEntity2(entity, wrapper); } }); if (onProcessFinished) { onProcessFinished(wrapper); } return wrapper; } function parseCheckedKeys(keys2) { if (!keys2) { return null; } var keyProps; if (Array.isArray(keys2)) { keyProps = { checkedKeys: keys2, halfCheckedKeys: void 0 }; } else if (_typeof$2(keys2) === "object") { keyProps = { checkedKeys: keys2.checked || void 0, halfCheckedKeys: keys2.halfChecked || void 0 }; } else { return null; } return keyProps; } function conductCheck$1(keyList, isCheck, keyEntities) { var checkStatus2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; var checkedKeys = /* @__PURE__ */ new Map(); var halfCheckedKeys = /* @__PURE__ */ new Map(); (checkStatus2.checkedKeys || []).forEach(function(key3) { checkedKeys.set(key3, true); }); (checkStatus2.halfCheckedKeys || []).forEach(function(key3) { halfCheckedKeys.set(key3, true); }); function conductUp(key3) { if (checkedKeys.get(key3) === isCheck) return; var entity = keyEntities.get(key3); if (!entity) return; var children = entity.children, parent2 = entity.parent, node = entity.node; if (isCheckDisabled(node)) return; var everyChildChecked = true; var someChildChecked = false; (children || []).filter(function(child) { return !isCheckDisabled(child.node); }).forEach(function(_ref5) { var childKey = _ref5.key; var childChecked = checkedKeys.get(childKey); var childHalfChecked = halfCheckedKeys.get(childKey); if (childChecked || childHalfChecked) someChildChecked = true; if (!childChecked) everyChildChecked = false; }); if (isCheck) { checkedKeys.set(key3, everyChildChecked); } else { checkedKeys.set(key3, false); } halfCheckedKeys.set(key3, someChildChecked); if (parent2) { conductUp(parent2.key); } } function conductDown(key3) { if (checkedKeys.get(key3) === isCheck) return; var entity = keyEntities.get(key3); if (!entity) return; var children = entity.children, node = entity.node; if (isCheckDisabled(node)) return; checkedKeys.set(key3, isCheck); (children || []).forEach(function(child) { conductDown(child.key); }); } function conduct(key3) { var entity = keyEntities.get(key3); if (!entity) { return; } var children = entity.children, parent2 = entity.parent, node = entity.node; checkedKeys.set(key3, isCheck); if (isCheckDisabled(node)) return; (children || []).filter(function(child) { return !isCheckDisabled(child.node); }).forEach(function(child) { conductDown(child.key); }); if (parent2) { conductUp(parent2.key); } } (keyList || []).forEach(function(key3) { conduct(key3); }); var checkedKeyList = []; var halfCheckedKeyList = []; var _iterator = _createForOfIteratorHelper(checkedKeys), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done; ) { var _step$value = _slicedToArray$4(_step.value, 2), key2 = _step$value[0], value24 = _step$value[1]; if (value24) { checkedKeyList.push(key2); } } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } var _iterator2 = _createForOfIteratorHelper(halfCheckedKeys), _step2; try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { var _step2$value = _slicedToArray$4(_step2.value, 2), _key = _step2$value[0], _value = _step2$value[1]; if (!checkedKeys.get(_key) && _value) { halfCheckedKeyList.push(_key); } } } catch (err) { _iterator2.e(err); } finally { _iterator2.f(); } return { checkedKeys: checkedKeyList, halfCheckedKeys: halfCheckedKeyList }; } function conductExpandParent(keyList, keyEntities) { var expandedKeys2 = /* @__PURE__ */ new Map(); function conductUp(key2) { if (expandedKeys2.get(key2)) return; var entity = keyEntities.get(key2); if (!entity) return; expandedKeys2.set(key2, true); var parent2 = entity.parent, node = entity.node; var props2 = getOptionProps(node); if (props2 && props2.disabled) return; if (parent2) { conductUp(parent2.key); } } (keyList || []).forEach(function(key2) { conductUp(key2); }); return _toConsumableArray(expandedKeys2.keys()); } function getDataAndAria(props2) { return Object.keys(props2).reduce(function(prev2, key2) { if (key2.substr(0, 5) === "data-" || key2.substr(0, 5) === "aria-") { prev2[key2] = props2[key2]; } return prev2; }, {}); } function getWatch$1() { var keys2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var watch2 = {}; keys2.forEach(function(k2) { watch2[k2] = { handler: function handler7() { this.needSyncKeys[k2] = true; }, flush: "sync" }; }); return watch2; } var Tree$1 = defineComponent({ name: "Tree", mixins: [BaseMixin], provide: function provide2() { return { vcTree: this }; }, inheritAttrs: false, props: initDefaultProps$2({ prefixCls: PropsTypes.string, tabindex: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), children: PropsTypes.any, treeData: PropsTypes.array, showLine: PropsTypes.looseBool, showIcon: PropsTypes.looseBool, icon: PropsTypes.oneOfType([PropsTypes.object, PropsTypes.func]), focusable: PropsTypes.looseBool, selectable: PropsTypes.looseBool, disabled: PropsTypes.looseBool, multiple: PropsTypes.looseBool, checkable: withUndefined(PropsTypes.oneOfType([PropsTypes.object, PropsTypes.looseBool])), checkStrictly: PropsTypes.looseBool, draggable: PropsTypes.looseBool, defaultExpandParent: PropsTypes.looseBool, autoExpandParent: PropsTypes.looseBool, defaultExpandAll: PropsTypes.looseBool, defaultExpandedKeys: PropsTypes.array, expandedKeys: PropsTypes.array, defaultCheckedKeys: PropsTypes.array, checkedKeys: PropsTypes.oneOfType([PropsTypes.array, PropsTypes.object]), defaultSelectedKeys: PropsTypes.array, selectedKeys: PropsTypes.array, loadData: PropsTypes.func, loadedKeys: PropsTypes.array, filterTreeNode: PropsTypes.func, openTransitionName: PropsTypes.string, openAnimation: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.object]), switcherIcon: PropsTypes.any, __propsSymbol__: PropsTypes.any }, { prefixCls: "rc-tree", showLine: false, showIcon: true, selectable: true, multiple: false, checkable: false, disabled: false, checkStrictly: false, draggable: false, defaultExpandParent: true, autoExpandParent: false, defaultExpandAll: false, defaultExpandedKeys: [], defaultCheckedKeys: [], defaultSelectedKeys: [] }), data: function data56() { warning_1(this.$props.__propsSymbol__); warning_1(this.$props.children); this.needSyncKeys = {}; this.domTreeNodes = {}; var state = { _posEntities: /* @__PURE__ */ new Map(), _keyEntities: /* @__PURE__ */ new Map(), _expandedKeys: [], _selectedKeys: [], _checkedKeys: [], _halfCheckedKeys: [], _loadedKeys: [], _loadingKeys: [], _treeNode: [], _prevProps: null, _dragOverNodeKey: "", _dropPosition: null, _dragNodesKeys: [] }; return _extends$1(_extends$1({}, state), this.getDerivedState(getOptionProps(this), state)); }, watch: _extends$1(_extends$1({}, getWatch$1(["treeData", "children", "expandedKeys", "autoExpandParent", "selectedKeys", "checkedKeys", "loadedKeys"])), { __propsSymbol__: function __propsSymbol__() { this.setState(this.getDerivedState(getOptionProps(this), this.$data)); this.needSyncKeys = {}; } }), methods: { getDerivedState: function getDerivedState2(props2, prevState) { var _prevProps = prevState._prevProps; var newState = { _prevProps: _extends$1({}, props2) }; var self2 = this; function needSync(name) { return !_prevProps && name in props2 || _prevProps && self2.needSyncKeys[name]; } var treeNode = null; if (needSync("treeData")) { treeNode = convertDataToTree$1(props2.treeData); } else if (needSync("children")) { treeNode = props2.children; } if (treeNode) { newState._treeNode = treeNode; var entitiesMap = convertTreeToEntities$1(treeNode); newState._keyEntities = entitiesMap.keyEntities; } var keyEntities = newState._keyEntities || prevState._keyEntities; if (needSync("expandedKeys") || _prevProps && needSync("autoExpandParent")) { newState._expandedKeys = props2.autoExpandParent || !_prevProps && props2.defaultExpandParent ? conductExpandParent(props2.expandedKeys, keyEntities) : props2.expandedKeys; } else if (!_prevProps && props2.defaultExpandAll) { newState._expandedKeys = _toConsumableArray(keyEntities.keys()); } else if (!_prevProps && props2.defaultExpandedKeys) { newState._expandedKeys = props2.autoExpandParent || props2.defaultExpandParent ? conductExpandParent(props2.defaultExpandedKeys, keyEntities) : props2.defaultExpandedKeys; } if (props2.selectable) { if (needSync("selectedKeys")) { newState._selectedKeys = calcSelectedKeys(props2.selectedKeys, props2); } else if (!_prevProps && props2.defaultSelectedKeys) { newState._selectedKeys = calcSelectedKeys(props2.defaultSelectedKeys, props2); } } if (props2.checkable) { var checkedKeyEntity; if (needSync("checkedKeys")) { checkedKeyEntity = parseCheckedKeys(props2.checkedKeys) || {}; } else if (!_prevProps && props2.defaultCheckedKeys) { checkedKeyEntity = parseCheckedKeys(props2.defaultCheckedKeys) || {}; } else if (treeNode) { checkedKeyEntity = parseCheckedKeys(props2.checkedKeys) || { checkedKeys: prevState._checkedKeys, halfCheckedKeys: prevState._halfCheckedKeys }; } if (checkedKeyEntity) { var _checkedKeyEntity = checkedKeyEntity, _checkedKeyEntity$che = _checkedKeyEntity.checkedKeys, checkedKeys = _checkedKeyEntity$che === void 0 ? [] : _checkedKeyEntity$che, _checkedKeyEntity$hal = _checkedKeyEntity.halfCheckedKeys, halfCheckedKeys = _checkedKeyEntity$hal === void 0 ? [] : _checkedKeyEntity$hal; if (!props2.checkStrictly) { var conductKeys = conductCheck$1(checkedKeys, true, keyEntities); checkedKeys = conductKeys.checkedKeys; halfCheckedKeys = conductKeys.halfCheckedKeys; } newState._checkedKeys = checkedKeys; newState._halfCheckedKeys = halfCheckedKeys; } } if (needSync("loadedKeys")) { newState._loadedKeys = props2.loadedKeys; } return newState; }, onNodeDragStart: function onNodeDragStart(event, node) { var _expandedKeys = this.$data._expandedKeys; var eventKey = node.eventKey; var children = getSlot$1(node); this.dragNode = node; this.setState({ _dragNodesKeys: getDragNodesKeys(typeof children === "function" ? children() : children, node), _expandedKeys: arrDel(_expandedKeys, eventKey) }); this.__emit("dragstart", { event, node }); }, onNodeDragEnter: function onNodeDragEnter(event, node) { var _this = this; var expandedKeys2 = this.$data._expandedKeys; var pos = node.pos, eventKey = node.eventKey; if (!this.dragNode || !node.selectHandle) return; var dropPosition = calcDropPosition(event, node); if (this.dragNode.eventKey === eventKey && dropPosition === 0) { this.setState({ _dragOverNodeKey: "", _dropPosition: null }); return; } setTimeout(function() { _this.setState({ _dragOverNodeKey: eventKey, _dropPosition: dropPosition }); if (!_this.delayedDragEnterLogic) { _this.delayedDragEnterLogic = {}; } Object.keys(_this.delayedDragEnterLogic).forEach(function(key2) { clearTimeout(_this.delayedDragEnterLogic[key2]); }); _this.delayedDragEnterLogic[pos] = setTimeout(function() { var newExpandedKeys = arrAdd(expandedKeys2, eventKey); if (!hasProp(_this, "expandedKeys")) { _this.setState({ _expandedKeys: newExpandedKeys }); } _this.__emit("dragenter", { event, node, expandedKeys: newExpandedKeys }); }, 400); }, 0); }, onNodeDragOver: function onNodeDragOver(event, node) { var eventKey = node.eventKey; var _this$$data = this.$data, _dragOverNodeKey = _this$$data._dragOverNodeKey, _dropPosition = _this$$data._dropPosition; if (this.dragNode && eventKey === _dragOverNodeKey && node.selectHandle) { var dropPosition = calcDropPosition(event, node); if (dropPosition === _dropPosition) return; this.setState({ _dropPosition: dropPosition }); } this.__emit("dragover", { event, node }); }, onNodeDragLeave: function onNodeDragLeave(event, node) { this.setState({ _dragOverNodeKey: "" }); this.__emit("dragleave", { event, node }); }, onNodeDragEnd: function onNodeDragEnd(event, node) { this.setState({ _dragOverNodeKey: "" }); this.__emit("dragend", { event, node }); this.dragNode = null; }, onNodeDrop: function onNodeDrop(event, node) { var _this$$data2 = this.$data, _this$$data2$_dragNod = _this$$data2._dragNodesKeys, _dragNodesKeys = _this$$data2$_dragNod === void 0 ? [] : _this$$data2$_dragNod, _dropPosition = _this$$data2._dropPosition; var eventKey = node.eventKey, pos = node.pos; this.setState({ _dragOverNodeKey: "" }); if (_dragNodesKeys.indexOf(eventKey) !== -1) { return; } var posArr = posToArr(pos); var dropResult = { event, node, dragNode: this.dragNode, dragNodesKeys: _dragNodesKeys.slice(), dropPosition: _dropPosition + Number(posArr[posArr.length - 1]), dropToGap: false }; if (_dropPosition !== 0) { dropResult.dropToGap = true; } this.__emit("drop", dropResult); this.dragNode = null; }, onNodeClick: function onNodeClick(e2, treeNode) { this.__emit("click", e2, treeNode); }, onNodeDoubleClick: function onNodeDoubleClick(e2, treeNode) { this.__emit("dblclick", e2, treeNode); }, onNodeSelect: function onNodeSelect(e2, treeNode) { var selectedKeys2 = this.$data._selectedKeys; var keyEntities = this.$data._keyEntities; var multiple = this.$props.multiple; var _getOptionProps = getOptionProps(treeNode), selected = _getOptionProps.selected, eventKey = _getOptionProps.eventKey; var targetSelected = !selected; if (!targetSelected) { selectedKeys2 = arrDel(selectedKeys2, eventKey); } else if (!multiple) { selectedKeys2 = [eventKey]; } else { selectedKeys2 = arrAdd(selectedKeys2, eventKey); } var selectedNodes = selectedKeys2.map(function(key2) { var entity = keyEntities.get(key2); if (!entity) return null; return entity.node; }).filter(function(node) { return node; }); this.setUncontrolledState({ _selectedKeys: selectedKeys2 }); var eventObj = { event: "select", selected: targetSelected, node: treeNode, selectedNodes, nativeEvent: e2 }; this.__emit("select", selectedKeys2, eventObj); }, onNodeCheck: function onNodeCheck(e2, treeNode, checked2) { var _this$$data3 = this.$data, keyEntities = _this$$data3._keyEntities, oriCheckedKeys = _this$$data3._checkedKeys, oriHalfCheckedKeys = _this$$data3._halfCheckedKeys; var checkStrictly = this.$props.checkStrictly; var _getOptionProps2 = getOptionProps(treeNode), eventKey = _getOptionProps2.eventKey; var checkedObj; var eventObj = { event: "check", node: treeNode, checked: checked2, nativeEvent: e2 }; if (checkStrictly) { var checkedKeys = checked2 ? arrAdd(oriCheckedKeys, eventKey) : arrDel(oriCheckedKeys, eventKey); var halfCheckedKeys = arrDel(oriHalfCheckedKeys, eventKey); checkedObj = { checked: checkedKeys, halfChecked: halfCheckedKeys }; eventObj.checkedNodes = checkedKeys.map(function(key2) { return keyEntities.get(key2); }).filter(function(entity) { return entity; }).map(function(entity) { return entity.node; }); this.setUncontrolledState({ _checkedKeys: checkedKeys }); } else { var _conductCheck = conductCheck$1([eventKey], checked2, keyEntities, { checkedKeys: oriCheckedKeys, halfCheckedKeys: oriHalfCheckedKeys }), _checkedKeys = _conductCheck.checkedKeys, _halfCheckedKeys = _conductCheck.halfCheckedKeys; checkedObj = _checkedKeys; eventObj.checkedNodes = []; eventObj.checkedNodesPositions = []; eventObj.halfCheckedKeys = _halfCheckedKeys; _checkedKeys.forEach(function(key2) { var entity = keyEntities.get(key2); if (!entity) return; var node = entity.node, pos = entity.pos; eventObj.checkedNodes.push(node); eventObj.checkedNodesPositions.push({ node, pos }); }); this.setUncontrolledState({ _checkedKeys, _halfCheckedKeys }); } this.__emit("check", checkedObj, eventObj); }, onNodeLoad: function onNodeLoad(treeNode) { var _this2 = this; return new Promise(function(resolve) { _this2.setState(function(_ref) { var _ref$_loadedKeys = _ref._loadedKeys, loadedKeys = _ref$_loadedKeys === void 0 ? [] : _ref$_loadedKeys, _ref$_loadingKeys = _ref._loadingKeys, loadingKeys = _ref$_loadingKeys === void 0 ? [] : _ref$_loadingKeys; var loadData = _this2.$props.loadData; var _getOptionProps3 = getOptionProps(treeNode), eventKey = _getOptionProps3.eventKey; if (!loadData || loadedKeys.indexOf(eventKey) !== -1 || loadingKeys.indexOf(eventKey) !== -1) { return {}; } var promise = loadData(treeNode); promise.then(function() { var _this2$$data = _this2.$data, currentLoadedKeys = _this2$$data._loadedKeys, currentLoadingKeys = _this2$$data._loadingKeys; var newLoadedKeys = arrAdd(currentLoadedKeys, eventKey); var newLoadingKeys = arrDel(currentLoadingKeys, eventKey); _this2.__emit("load", newLoadedKeys, { event: "load", node: treeNode }); _this2.setUncontrolledState({ _loadedKeys: newLoadedKeys }); _this2.setState({ _loadingKeys: newLoadingKeys }); resolve(); }); return { _loadingKeys: arrAdd(loadingKeys, eventKey) }; }); }); }, onNodeExpand: function onNodeExpand(e2, treeNode) { var _this3 = this; var expandedKeys2 = this.$data._expandedKeys; var loadData = this.$props.loadData; var _getOptionProps4 = getOptionProps(treeNode), eventKey = _getOptionProps4.eventKey, expanded = _getOptionProps4.expanded; expandedKeys2.indexOf(eventKey); var targetExpanded = !expanded; if (targetExpanded) { expandedKeys2 = arrAdd(expandedKeys2, eventKey); } else { expandedKeys2 = arrDel(expandedKeys2, eventKey); } this.setUncontrolledState({ _expandedKeys: expandedKeys2 }); this.__emit("expand", expandedKeys2, { node: treeNode, expanded: targetExpanded, nativeEvent: e2 }); if (targetExpanded && loadData) { var loadPromise = this.onNodeLoad(treeNode); return loadPromise ? loadPromise.then(function() { _this3.setUncontrolledState({ _expandedKeys: expandedKeys2 }); }) : null; } return null; }, onNodeMouseEnter: function onNodeMouseEnter(event, node) { this.__emit("mouseenter", { event, node }); }, onNodeMouseLeave: function onNodeMouseLeave(event, node) { this.__emit("mouseleave", { event, node }); }, onNodeContextMenu: function onNodeContextMenu(event, node) { event.preventDefault(); this.__emit("rightClick", { event, node }); }, setUncontrolledState: function setUncontrolledState(state) { var needSync = false; var newState = {}; var props2 = getOptionProps(this); Object.keys(state).forEach(function(name) { if (name.replace("_", "") in props2) return; needSync = true; newState[name] = state[name]; }); if (needSync) { this.setState(newState); } }, registerTreeNode: function registerTreeNode(key2, node) { if (node) { this.domTreeNodes[key2] = node; } else { delete this.domTreeNodes[key2]; } }, isKeyChecked: function isKeyChecked(key2) { var _this$$data$_checkedK = this.$data._checkedKeys, checkedKeys = _this$$data$_checkedK === void 0 ? [] : _this$$data$_checkedK; return checkedKeys.indexOf(key2) !== -1; }, renderTreeNode: function renderTreeNode(child, index2) { var level2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; var _this$$data4 = this.$data, keyEntities = _this$$data4._keyEntities, _this$$data4$_expande = _this$$data4._expandedKeys, expandedKeys2 = _this$$data4$_expande === void 0 ? [] : _this$$data4$_expande, _this$$data4$_selecte = _this$$data4._selectedKeys, selectedKeys2 = _this$$data4$_selecte === void 0 ? [] : _this$$data4$_selecte, _this$$data4$_halfChe = _this$$data4._halfCheckedKeys, halfCheckedKeys = _this$$data4$_halfChe === void 0 ? [] : _this$$data4$_halfChe, _this$$data4$_loadedK = _this$$data4._loadedKeys, loadedKeys = _this$$data4$_loadedK === void 0 ? [] : _this$$data4$_loadedK, _this$$data4$_loading = _this$$data4._loadingKeys, loadingKeys = _this$$data4$_loading === void 0 ? [] : _this$$data4$_loading, dragOverNodeKey = _this$$data4._dragOverNodeKey, dropPosition = _this$$data4._dropPosition; var pos = getPosition(level2, index2); var key2 = child.key; if (!key2 && (key2 === void 0 || key2 === null)) { key2 = pos; } if (!keyEntities.get(key2)) { return null; } return cloneElement(child, { eventKey: key2, expanded: expandedKeys2.indexOf(key2) !== -1, selected: selectedKeys2.indexOf(key2) !== -1, loaded: loadedKeys.indexOf(key2) !== -1, loading: loadingKeys.indexOf(key2) !== -1, checked: this.isKeyChecked(key2), halfChecked: halfCheckedKeys.indexOf(key2) !== -1, pos, dragOver: dragOverNodeKey === key2 && dropPosition === 0, dragOverGapTop: dragOverNodeKey === key2 && dropPosition === -1, dragOverGapBottom: dragOverNodeKey === key2 && dropPosition === 1, key: key2 }); } }, render: function render104() { var _this4 = this; var treeNode = this.$data._treeNode; var _this$$props = this.$props, prefixCls2 = _this$$props.prefixCls, focusable = _this$$props.focusable, showLine = _this$$props.showLine, _this$$props$tabindex = _this$$props.tabindex, tabindex = _this$$props$tabindex === void 0 ? 0 : _this$$props$tabindex; var domProps = getDataAndAria(_extends$1(_extends$1({}, this.$props), this.$attrs)); var _this$$attrs = this.$attrs, className = _this$$attrs.class, style = _this$$attrs.style; return createVNode("ul", _objectSpread2$2(_objectSpread2$2({}, domProps), {}, { "class": classNames(prefixCls2, className, _defineProperty$12({}, "".concat(prefixCls2, "-show-line"), showLine)), "style": style, "role": "tree", "unselectable": "on", "tabindex": focusable ? tabindex : null }), [mapChildren(treeNode, function(node, index2) { return _this4.renderTreeNode(node, index2); })]); } }); var Tree$2 = Tree$1; Tree$2.TreeNode = TreeNode$4; var __rest$4 = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var TreeNode$2 = Tree$2.TreeNode; function TreeProps() { return { showLine: PropsTypes.looseBool, multiple: PropsTypes.looseBool, autoExpandParent: PropsTypes.looseBool, checkStrictly: PropsTypes.looseBool, checkable: PropsTypes.looseBool, disabled: PropsTypes.looseBool, defaultExpandAll: PropsTypes.looseBool, defaultExpandParent: PropsTypes.looseBool, defaultExpandedKeys: PropsTypes.arrayOf(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number])), expandedKeys: PropsTypes.arrayOf(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number])), checkedKeys: PropsTypes.oneOfType([PropsTypes.arrayOf(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number])), PropsTypes.shape({ checked: PropsTypes.arrayOf(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number])), halfChecked: PropsTypes.arrayOf(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number])) }).loose]), defaultCheckedKeys: PropsTypes.arrayOf(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number])), selectedKeys: PropsTypes.arrayOf(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number])), defaultSelectedKeys: PropsTypes.arrayOf(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number])), selectable: PropsTypes.looseBool, filterAntTreeNode: PropsTypes.func, loadData: PropsTypes.func, loadedKeys: PropsTypes.arrayOf(PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number])), draggable: PropsTypes.looseBool, showIcon: PropsTypes.looseBool, icon: PropsTypes.func, switcherIcon: PropsTypes.any, prefixCls: PropsTypes.string, filterTreeNode: PropsTypes.func, openAnimation: PropsTypes.any, treeData: { type: Array }, replaceFields: PropsTypes.object, blockNode: PropsTypes.looseBool, onExpand: PropsTypes.func, onCheck: PropsTypes.func, onSelect: PropsTypes.func, onClick: PropsTypes.func, onDoubleclick: PropsTypes.func, onDblclick: PropsTypes.func, "onUpdate:selectedKeys": PropsTypes.func, "onUpdate:checkedKeys": PropsTypes.func, "onUpdate:expandedKeys": PropsTypes.func }; } var Tree = defineComponent({ name: "ATree", inheritAttrs: false, props: initDefaultProps$1(TreeProps(), { checkable: false, showIcon: false, openAnimation: _extends$1(_extends$1({}, animation$1), { appear: null }), blockNode: false }), setup: function setup114() { return { tree: null, configProvider: inject("configProvider", defaultConfigProvider) }; }, TreeNode: TreeNode$2, methods: { renderSwitcherIcon: function renderSwitcherIcon(prefixCls2, switcherIcon, _ref) { var isLeaf = _ref.isLeaf, loading = _ref.loading, expanded = _ref.expanded; var showLine = this.$props.showLine; if (loading) { return createVNode(LoadingOutlined$3, { "class": "".concat(prefixCls2, "-switcher-loading-icon") }, null); } if (isLeaf) { return showLine ? createVNode(FileTwoTone, { "class": "".concat(prefixCls2, "-switcher-line-icon") }, null) : null; } var switcherCls = "".concat(prefixCls2, "-switcher-icon"); if (switcherIcon) { return cloneElement(switcherIcon, { class: switcherCls }); } return showLine ? expanded ? createVNode(MinusSquareOutlined$1, { "class": "".concat(prefixCls2, "-switcher-line-icon") }, null) : createVNode(PlusSquareOutlined$1, { "class": "".concat(prefixCls2, "-switcher-line-icon") }, null) : createVNode(CaretDownFilled$1, { "class": switcherCls }, null); }, updateTreeData: function updateTreeData(treeData) { var _this = this; var $slots = this.$slots; var defaultFields = { children: "children", title: "title", key: "key" }; var replaceFields = _extends$1(_extends$1({}, defaultFields), this.$props.replaceFields); return treeData.map(function(item) { var key2 = item[replaceFields.key]; var children = item[replaceFields.children]; var _item$slots = item.slots, slots = _item$slots === void 0 ? {} : _item$slots, cls = item.class, style = item.style, restProps = __rest$4(item, ["slots", "class", "style"]); var treeNodeProps = _extends$1(_extends$1({}, restProps), { icon: $slots[slots.icon] || restProps.icon, switcherIcon: $slots[slots.switcherIcon] || restProps.switcherIcon, title: $slots[slots.title] || $slots.title || restProps[replaceFields.title], dataRef: item, key: key2, class: cls, style }); if (children) { return _extends$1(_extends$1({}, treeNodeProps), { children: _this.updateTreeData(children) }); } return treeNodeProps; }); }, setTreeRef: function setTreeRef(node) { this.tree = node; }, handleCheck: function handleCheck(checkedObj, eventObj) { this.$emit("update:checkedKeys", checkedObj); this.$emit("check", checkedObj, eventObj); }, handleExpand: function handleExpand(expandedKeys2, eventObj) { this.$emit("update:expandedKeys", expandedKeys2); this.$emit("expand", expandedKeys2, eventObj); }, handleSelect: function handleSelect2(selectedKeys2, eventObj) { this.$emit("update:selectedKeys", selectedKeys2); this.$emit("select", selectedKeys2, eventObj); } }, render: function render105() { var _this2 = this, _classNames; var props2 = getOptionProps(this); var customizePrefixCls = props2.prefixCls, showIcon = props2.showIcon, treeNodes = props2.treeNodes, blockNode = props2.blockNode; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("tree", customizePrefixCls); var _switcherIcon = getComponent(this, "switcherIcon"); var checkable = props2.checkable; var treeData = props2.treeData || treeNodes; if (treeData) { treeData = this.updateTreeData(treeData); } var _a3 = this.$attrs, className = _a3.class, restAttrs = __rest$4(_a3, ["class"]); var vcTreeProps = _extends$1(_extends$1(_extends$1(_extends$1({}, props2), { prefixCls: prefixCls2, checkable: checkable ? createVNode("span", { "class": "".concat(prefixCls2, "-checkbox-inner") }, null) : checkable, children: getSlot$1(this), switcherIcon: function switcherIcon(nodeProps) { return _this2.renderSwitcherIcon(prefixCls2, _switcherIcon, nodeProps); }, ref: this.setTreeRef }), restAttrs), { class: classNames(className, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-icon-hide"), !showIcon), _defineProperty$12(_classNames, "".concat(prefixCls2, "-block-node"), blockNode), _classNames)), onCheck: this.handleCheck, onExpand: this.handleExpand, onSelect: this.handleSelect }); if (treeData) { vcTreeProps.treeData = treeData; } return createVNode(Tree$2, _objectSpread2$2(_objectSpread2$2({}, vcTreeProps), {}, { "__propsSymbol__": [] }), null); } }); var FolderOpenOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z" } }] }, "name": "folder-open", "theme": "outlined" }; var FolderOpenOutlinedSvg = FolderOpenOutlined$2; function _objectSpread$n(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$o(target, key2, source2[key2]); }); } return target; } function _defineProperty$o(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var FolderOpenOutlined = function FolderOpenOutlined2(props2, context2) { var p = _objectSpread$n({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$n({}, p, { "icon": FolderOpenOutlinedSvg }), null); }; FolderOpenOutlined.displayName = "FolderOpenOutlined"; FolderOpenOutlined.inheritAttrs = false; var FolderOpenOutlined$1 = FolderOpenOutlined; var FolderOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z" } }] }, "name": "folder", "theme": "outlined" }; var FolderOutlinedSvg = FolderOutlined$2; function _objectSpread$m(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$n(target, key2, source2[key2]); }); } return target; } function _defineProperty$n(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var FolderOutlined = function FolderOutlined2(props2, context2) { var p = _objectSpread$m({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$m({}, p, { "icon": FolderOutlinedSvg }), null); }; FolderOutlined.displayName = "FolderOutlined"; FolderOutlined.inheritAttrs = false; var FolderOutlined$1 = FolderOutlined; var Record; (function(Record2) { Record2[Record2["None"] = 0] = "None"; Record2[Record2["Start"] = 1] = "Start"; Record2[Record2["End"] = 2] = "End"; })(Record || (Record = {})); function traverseNodesKey(rootChildren, callback2) { var nodeList2 = getNodeChildren(rootChildren) || []; function processNode(node) { var key2 = node.key; var children = getSlot$1(node); if (callback2(key2, node) !== false) { traverseNodesKey(children, callback2); } } nodeList2.forEach(processNode); } function getFullKeyList(children) { var _convertTreeToEntitie = convertTreeToEntities$1(children), keyEntities = _convertTreeToEntitie.keyEntities; return _toConsumableArray(keyEntities.keys()); } function calcRangeKeys(rootChildren, expandedKeys2, startKey, endKey) { var keys2 = []; var record = Record.None; if (startKey && startKey === endKey) { return [startKey]; } if (!startKey || !endKey) { return []; } function matchKey(key2) { return key2 === startKey || key2 === endKey; } traverseNodesKey(rootChildren, function(key2) { if (record === Record.End) { return false; } if (matchKey(key2)) { keys2.push(key2); if (record === Record.None) { record = Record.Start; } else if (record === Record.Start) { record = Record.End; return false; } } else if (record === Record.Start) { keys2.push(key2); } if (expandedKeys2.indexOf(key2) === -1) { return false; } return true; }); return keys2; } function convertDirectoryKeysToNodes(rootChildren, keys2) { var restKeys = _toConsumableArray(keys2); var nodes2 = []; traverseNodesKey(rootChildren, function(key2, node) { var index2 = restKeys.indexOf(key2); if (index2 !== -1) { nodes2.push(node); restKeys.splice(index2, 1); } return !!restKeys.length; }); return nodes2; } function getFullKeyListByTreeData(treeData) { var replaceFields = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var keys2 = []; var _replaceFields$key = replaceFields.key, key2 = _replaceFields$key === void 0 ? "key" : _replaceFields$key, _replaceFields$childr = replaceFields.children, children = _replaceFields$childr === void 0 ? "children" : _replaceFields$childr; (treeData || []).forEach(function(item) { keys2.push(item[key2]); if (item[children]) { keys2 = [].concat(_toConsumableArray(keys2), _toConsumableArray(getFullKeyListByTreeData(item[children], replaceFields))); } }); return keys2; } var __rest$3 = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; function getIcon$1(props2) { var isLeaf = props2.isLeaf, expanded = props2.expanded; if (isLeaf) { return createVNode(FileTwoTone, null, null); } return expanded ? createVNode(FolderOpenOutlined$1, null, null) : createVNode(FolderOutlined$1, null, null); } var DirectoryTree = defineComponent({ name: "ADirectoryTree", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$1(_extends$1(_extends$1({}, TreeProps()), { expandAction: PropsTypes.oneOf([false, "click", "doubleclick", "dblclick"]) }), { showIcon: true, expandAction: "click" }), setup: function setup115() { return { children: null, onDebounceExpand: null, tree: null, lastSelectedKey: "", cachedSelectedKeys: [], configProvider: inject("configProvider", defaultConfigProvider) }; }, data: function data57() { var props2 = getOptionProps(this); var defaultExpandAll = props2.defaultExpandAll, defaultExpandParent = props2.defaultExpandParent, expandedKeys2 = props2.expandedKeys, defaultExpandedKeys = props2.defaultExpandedKeys; var children = getSlot$1(this); var _convertTreeToEntitie = convertTreeToEntities$1(children), keyEntities = _convertTreeToEntitie.keyEntities; var state = {}; state._selectedKeys = props2.selectedKeys || props2.defaultSelectedKeys || []; if (defaultExpandAll) { if (props2.treeData) { state._expandedKeys = getFullKeyListByTreeData(props2.treeData, props2.replaceFields); } else { state._expandedKeys = getFullKeyList(children); } } else if (defaultExpandParent) { state._expandedKeys = conductExpandParent(expandedKeys2 || defaultExpandedKeys, keyEntities); } else { state._expandedKeys = expandedKeys2 || defaultExpandedKeys; } return _extends$1({ _selectedKeys: [], _expandedKeys: [] }, state); }, watch: { expandedKeys: function expandedKeys(val) { this.setState({ _expandedKeys: val }); }, selectedKeys: function selectedKeys(val) { this.setState({ _selectedKeys: val }); } }, created: function created17() { this.onDebounceExpand = debounce$1(this.expandFolderNode, 200, { leading: true }); }, methods: { handleExpand: function handleExpand2(expandedKeys2, info3) { this.setUncontrolledState({ _expandedKeys: expandedKeys2 }); this.$emit("update:expandedKeys", expandedKeys2); this.$emit("expand", expandedKeys2, info3); return void 0; }, handleClick: function handleClick4(event, node) { var expandAction = this.$props.expandAction; if (expandAction === "click") { this.onDebounceExpand(event, node); } this.$emit("click", event, node); }, handleDoubleClick: function handleDoubleClick(event, node) { var expandAction = this.$props.expandAction; if (expandAction === "dblclick" || expandAction === "doubleclick") { this.onDebounceExpand(event, node); } this.$emit("doubleclick", event, node); this.$emit("dblclick", event, node); }, hanldeSelect: function hanldeSelect(keys2, event) { var multiple = this.$props.multiple; var children = this.children || []; var _this$$data$_expanded = this.$data._expandedKeys, expandedKeys2 = _this$$data$_expanded === void 0 ? [] : _this$$data$_expanded; var node = event.node, nativeEvent = event.nativeEvent; var _node$eventKey = node.eventKey, eventKey = _node$eventKey === void 0 ? "" : _node$eventKey; var newState = {}; var newEvent = _extends$1(_extends$1({}, event), { selected: true }); var ctrlPick = nativeEvent.ctrlKey || nativeEvent.metaKey; var shiftPick = nativeEvent.shiftKey; var newSelectedKeys; if (multiple && ctrlPick) { newSelectedKeys = keys2; this.lastSelectedKey = eventKey; this.cachedSelectedKeys = newSelectedKeys; newEvent.selectedNodes = convertDirectoryKeysToNodes(children, newSelectedKeys); } else if (multiple && shiftPick) { newSelectedKeys = Array.from(new Set([].concat(_toConsumableArray(this.cachedSelectedKeys || []), _toConsumableArray(calcRangeKeys(children, expandedKeys2, eventKey, this.lastSelectedKey))))); newEvent.selectedNodes = convertDirectoryKeysToNodes(children, newSelectedKeys); } else { newSelectedKeys = [eventKey]; this.lastSelectedKey = eventKey; this.cachedSelectedKeys = newSelectedKeys; newEvent.selectedNodes = [event.node]; } newState._selectedKeys = newSelectedKeys; this.$emit("update:selectedKeys", newSelectedKeys); this.$emit("select", newSelectedKeys, newEvent); this.setUncontrolledState(newState); }, setTreeRef: function setTreeRef2(node) { this.tree = node; }, expandFolderNode: function expandFolderNode(event, node) { var isLeaf = node.isLeaf; if (isLeaf || event.shiftKey || event.metaKey || event.ctrlKey) { return; } if (this.tree.tree) { var internalTree = this.tree.tree; internalTree.onNodeExpand(event, node); } }, setUncontrolledState: function setUncontrolledState2(state) { var newState = omit(state, Object.keys(getOptionProps(this)).map(function(p) { return "_".concat(p); })); if (Object.keys(newState).length) { this.setState(newState); } }, handleCheck: function handleCheck2(checkedObj, eventObj) { this.$emit("update:checkedKeys", checkedObj); this.$emit("check", checkedObj, eventObj); } }, render: function render106() { var _this = this; this.children = getSlot$1(this); var _a3 = getOptionProps(this), customizePrefixCls = _a3.prefixCls, props2 = __rest$3(_a3, ["prefixCls"]); var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("tree", customizePrefixCls); var _this$$data = this.$data, expandedKeys2 = _this$$data._expandedKeys, selectedKeys2 = _this$$data._selectedKeys; var _b2 = this.$attrs, className = _b2.class, restAttrs = __rest$3(_b2, ["class"]); var connectClassName = classNames("".concat(prefixCls2, "-directory"), className); var treeProps = _extends$1(_extends$1(_extends$1({ icon: getIcon$1 }, restAttrs), omit(props2, ["onUpdate:selectedKeys", "onUpdate:checkedKeys", "onUpdate:expandedKeys"])), { prefixCls: prefixCls2, expandedKeys: expandedKeys2, selectedKeys: selectedKeys2, switcherIcon: getComponent(this, "switcherIcon"), ref: this.setTreeRef, class: connectClassName, onSelect: this.hanldeSelect, onClick: this.handleClick, onDblclick: this.handleDoubleClick, onExpand: this.handleExpand, onCheck: this.handleCheck }); return createVNode(Tree, treeProps, _objectSpread2$2({ default: function _default8() { return [_this.children]; } }, omit(this.$slots, ["default"]))); } }); Tree.TreeNode.name = "ATreeNode"; Tree.DirectoryTree = DirectoryTree; Tree.install = function(app) { app.component(Tree.name, Tree); app.component(Tree.TreeNode.name, Tree.TreeNode); app.component(DirectoryTree.name, DirectoryTree); return app; }; Tree.TreeNode; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function(obj2) { return typeof obj2; }; } else { _typeof = function(obj2) { return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }; } return _typeof(obj); } function _defineProperty$m(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } function ownKeys(object3, enumerableOnly) { var keys2 = Object.keys(object3); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object3); if (enumerableOnly) symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object3, sym).enumerable; }); keys2.push.apply(keys2, symbols); } return keys2; } function _objectSpread2(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? arguments[i2] : {}; if (i2 % 2) { ownKeys(source2, true).forEach(function(key2) { _defineProperty$m(target, key2, source2[key2]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2)); } else { ownKeys(source2).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source2, key2)); }); } } return target; } var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; function getClientPosition(elem) { var box; var x2; var y2; var doc = elem.ownerDocument; var body = doc.body; var docElem = doc && doc.documentElement; box = elem.getBoundingClientRect(); x2 = box.left; y2 = box.top; x2 -= docElem.clientLeft || body.clientLeft || 0; y2 -= docElem.clientTop || body.clientTop || 0; return { left: x2, top: y2 }; } function getScroll(w2, top) { var ret = w2["page".concat(top ? "Y" : "X", "Offset")]; var method3 = "scroll".concat(top ? "Top" : "Left"); if (typeof ret !== "number") { var d2 = w2.document; ret = d2.documentElement[method3]; if (typeof ret !== "number") { ret = d2.body[method3]; } } return ret; } function getScrollLeft(w2) { return getScroll(w2); } function getScrollTop(w2) { return getScroll(w2, true); } function getOffset(el) { var pos = getClientPosition(el); var doc = el.ownerDocument; var w2 = doc.defaultView || doc.parentWindow; pos.left += getScrollLeft(w2); pos.top += getScrollTop(w2); return pos; } function _getComputedStyle(elem, name, computedStyle_) { var val = ""; var d2 = elem.ownerDocument; var computedStyle = computedStyle_ || d2.defaultView.getComputedStyle(elem, null); if (computedStyle) { val = computedStyle.getPropertyValue(name) || computedStyle[name]; } return val; } var _RE_NUM_NO_PX = new RegExp("^(".concat(RE_NUM, ")(?!px)[a-z%]+$"), "i"); var RE_POS = /^(top|right|bottom|left)$/; var CURRENT_STYLE = "currentStyle"; var RUNTIME_STYLE = "runtimeStyle"; var LEFT = "left"; var PX = "px"; function _getComputedStyleIE(elem, name) { var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { var style = elem.style; var left = style[LEFT]; var rsLeft = elem[RUNTIME_STYLE][LEFT]; elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; style[LEFT] = name === "fontSize" ? "1em" : ret || 0; ret = style.pixelLeft + PX; style[LEFT] = left; elem[RUNTIME_STYLE][LEFT] = rsLeft; } return ret === "" ? "auto" : ret; } var getComputedStyleX; if (typeof window !== "undefined") { getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; } function each(arr, fn) { for (var i2 = 0; i2 < arr.length; i2++) { fn(arr[i2]); } } function isBorderBoxFn(elem) { return getComputedStyleX(elem, "boxSizing") === "border-box"; } var BOX_MODELS = ["margin", "border", "padding"]; var CONTENT_INDEX = -1; var PADDING_INDEX = 2; var BORDER_INDEX = 1; var MARGIN_INDEX = 0; function swap(elem, options2, callback2) { var old = {}; var style = elem.style; var name; for (name in options2) { if (options2.hasOwnProperty(name)) { old[name] = style[name]; style[name] = options2[name]; } } callback2.call(elem); for (name in options2) { if (options2.hasOwnProperty(name)) { style[name] = old[name]; } } } function getPBMWidth(elem, props2, which) { var value24 = 0; var prop; var j2; var i2; for (j2 = 0; j2 < props2.length; j2++) { prop = props2[j2]; if (prop) { for (i2 = 0; i2 < which.length; i2++) { var cssProp = void 0; if (prop === "border") { cssProp = "".concat(prop + which[i2], "Width"); } else { cssProp = prop + which[i2]; } value24 += parseFloat(getComputedStyleX(elem, cssProp)) || 0; } } } return value24; } function isWindow(obj) { return obj != null && obj == obj.window; } var domUtils = {}; each(["Width", "Height"], function(name) { domUtils["doc".concat(name)] = function(refWin) { var d2 = refWin.document; return Math.max(d2.documentElement["scroll".concat(name)], d2.body["scroll".concat(name)], domUtils["viewport".concat(name)](d2)); }; domUtils["viewport".concat(name)] = function(win) { var prop = "client".concat(name); var doc = win.document; var body = doc.body; var documentElement = doc.documentElement; var documentElementProp = documentElement[prop]; return doc.compatMode === "CSS1Compat" && documentElementProp || body && body[prop] || documentElementProp; }; }); function getWH(elem, name, extra) { if (isWindow(elem)) { return name === "width" ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); } else if (elem.nodeType === 9) { return name === "width" ? domUtils.docWidth(elem) : domUtils.docHeight(elem); } var which = name === "width" ? ["Left", "Right"] : ["Top", "Bottom"]; var borderBoxValue = name === "width" ? elem.offsetWidth : elem.offsetHeight; getComputedStyleX(elem); var isBorderBox = isBorderBoxFn(elem); var cssBoxValue = 0; if (borderBoxValue == null || borderBoxValue <= 0) { borderBoxValue = void 0; cssBoxValue = getComputedStyleX(elem, name); if (cssBoxValue == null || Number(cssBoxValue) < 0) { cssBoxValue = elem.style[name] || 0; } cssBoxValue = parseFloat(cssBoxValue) || 0; } if (extra === void 0) { extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; } var borderBoxValueOrIsBorderBox = borderBoxValue !== void 0 || isBorderBox; var val = borderBoxValue || cssBoxValue; if (extra === CONTENT_INDEX) { if (borderBoxValueOrIsBorderBox) { return val - getPBMWidth(elem, ["border", "padding"], which); } return cssBoxValue; } if (borderBoxValueOrIsBorderBox) { var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ["border"], which) : getPBMWidth(elem, ["margin"], which); return val + (extra === BORDER_INDEX ? 0 : padding); } return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which); } var cssShow = { position: "absolute", visibility: "hidden", display: "block" }; function getWHIgnoreDisplay(elem) { var val; var args = arguments; if (elem.offsetWidth !== 0) { val = getWH.apply(void 0, args); } else { swap(elem, cssShow, function() { val = getWH.apply(void 0, args); }); } return val; } function css(el, name, v2) { var value24 = v2; if (_typeof(name) === "object") { for (var i2 in name) { if (name.hasOwnProperty(i2)) { css(el, i2, name[i2]); } } return void 0; } if (typeof value24 !== "undefined") { if (typeof value24 === "number") { value24 += "px"; } el.style[name] = value24; return void 0; } return getComputedStyleX(el, name); } each(["width", "height"], function(name) { var first = name.charAt(0).toUpperCase() + name.slice(1); domUtils["outer".concat(first)] = function(el, includeMargin) { return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); }; var which = name === "width" ? ["Left", "Right"] : ["Top", "Bottom"]; domUtils[name] = function(elem, val) { if (val !== void 0) { if (elem) { getComputedStyleX(elem); var isBorderBox = isBorderBoxFn(elem); if (isBorderBox) { val += getPBMWidth(elem, ["padding", "border"], which); } return css(elem, name, val); } return void 0; } return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); }; }); function setOffset(elem, offset4) { if (css(elem, "position") === "static") { elem.style.position = "relative"; } var old = getOffset(elem); var ret = {}; var current2; var key2; for (key2 in offset4) { if (offset4.hasOwnProperty(key2)) { current2 = parseFloat(css(elem, key2)) || 0; ret[key2] = current2 + offset4[key2] - old[key2]; } } css(elem, ret); } var util = _objectSpread2({ getWindow: function getWindow2(node) { var doc = node.ownerDocument || node; return doc.defaultView || doc.parentWindow; }, offset: function offset3(el, value24) { if (typeof value24 !== "undefined") { setOffset(el, value24); } else { return getOffset(el); } }, isWindow, each, css, clone: function clone3(obj) { var ret = {}; for (var i2 in obj) { if (obj.hasOwnProperty(i2)) { ret[i2] = obj[i2]; } } var overflow = obj.overflow; if (overflow) { for (var _i in obj) { if (obj.hasOwnProperty(_i)) { ret.overflow[_i] = obj.overflow[_i]; } } } return ret; }, scrollLeft: function scrollLeft(w2, v2) { if (isWindow(w2)) { if (v2 === void 0) { return getScrollLeft(w2); } window.scrollTo(v2, getScrollTop(w2)); } else { if (v2 === void 0) { return w2.scrollLeft; } w2.scrollLeft = v2; } }, scrollTop: function scrollTop(w2, v2) { if (isWindow(w2)) { if (v2 === void 0) { return getScrollTop(w2); } window.scrollTo(getScrollLeft(w2), v2); } else { if (v2 === void 0) { return w2.scrollTop; } w2.scrollTop = v2; } }, viewportWidth: 0, viewportHeight: 0 }, domUtils); function scrollIntoView(elem, container, config3) { config3 = config3 || {}; if (container.nodeType === 9) { container = util.getWindow(container); } var allowHorizontalScroll = config3.allowHorizontalScroll; var onlyScrollIfNeeded = config3.onlyScrollIfNeeded; var alignWithTop = config3.alignWithTop; var alignWithLeft = config3.alignWithLeft; var offsetTop = config3.offsetTop || 0; var offsetLeft = config3.offsetLeft || 0; var offsetBottom = config3.offsetBottom || 0; var offsetRight = config3.offsetRight || 0; allowHorizontalScroll = allowHorizontalScroll === void 0 ? true : allowHorizontalScroll; var isWin = util.isWindow(container); var elemOffset = util.offset(elem); var eh = util.outerHeight(elem); var ew = util.outerWidth(elem); var containerOffset; var ch; var cw; var containerScroll; var diffTop; var diffBottom; var win; var winScroll; var ww; var wh; if (isWin) { win = container; wh = util.height(win); ww = util.width(win); winScroll = { left: util.scrollLeft(win), top: util.scrollTop(win) }; diffTop = { left: elemOffset.left - winScroll.left - offsetLeft, top: elemOffset.top - winScroll.top - offsetTop }; diffBottom = { left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight, top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom }; containerScroll = winScroll; } else { containerOffset = util.offset(container); ch = container.clientHeight; cw = container.clientWidth; containerScroll = { left: container.scrollLeft, top: container.scrollTop }; diffTop = { left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, "borderLeftWidth")) || 0)) - offsetLeft, top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, "borderTopWidth")) || 0)) - offsetTop }; diffBottom = { left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, "borderRightWidth")) || 0)) + offsetRight, top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, "borderBottomWidth")) || 0)) + offsetBottom }; } if (diffTop.top < 0 || diffBottom.top > 0) { if (alignWithTop === true) { util.scrollTop(container, containerScroll.top + diffTop.top); } else if (alignWithTop === false) { util.scrollTop(container, containerScroll.top + diffBottom.top); } else { if (diffTop.top < 0) { util.scrollTop(container, containerScroll.top + diffTop.top); } else { util.scrollTop(container, containerScroll.top + diffBottom.top); } } } else { if (!onlyScrollIfNeeded) { alignWithTop = alignWithTop === void 0 ? true : !!alignWithTop; if (alignWithTop) { util.scrollTop(container, containerScroll.top + diffTop.top); } else { util.scrollTop(container, containerScroll.top + diffBottom.top); } } } if (allowHorizontalScroll) { if (diffTop.left < 0 || diffBottom.left > 0) { if (alignWithLeft === true) { util.scrollLeft(container, containerScroll.left + diffTop.left); } else if (alignWithLeft === false) { util.scrollLeft(container, containerScroll.left + diffBottom.left); } else { if (diffTop.left < 0) { util.scrollLeft(container, containerScroll.left + diffTop.left); } else { util.scrollLeft(container, containerScroll.left + diffBottom.left); } } } else { if (!onlyScrollIfNeeded) { alignWithLeft = alignWithLeft === void 0 ? true : !!alignWithLeft; if (alignWithLeft) { util.scrollLeft(container, containerScroll.left + diffTop.left); } else { util.scrollLeft(container, containerScroll.left + diffBottom.left); } } } } } function hasClass$1(node, className) { if (node.classList) { return node.classList.contains(className); } var originClass = node.className; return " ".concat(originClass, " ").indexOf(" ".concat(className, " ")) > -1; } var SHOW_ALL = "SHOW_ALL"; var SHOW_PARENT = "SHOW_PARENT"; var SHOW_CHILD = "SHOW_CHILD"; function findPopupContainer(node, prefixClass) { var current2 = node; while (current2) { if (hasClass$1(current2, prefixClass)) { return current2; } current2 = current2.parentNode; } return null; } function toTitle(title) { if (typeof title === "string") { return title; } return null; } function toArray(data65) { if (data65 === void 0 || data65 === null) return []; return Array.isArray(data65) ? data65 : [data65]; } function createRef() { var func = function setRef(node) { func.current = node; }; return func; } var UNSELECTABLE_STYLE = { userSelect: "none", WebkitUserSelect: "none" }; var UNSELECTABLE_ATTRIBUTE = { unselectable: "unselectable" }; function flatToHierarchy(positionList) { if (!positionList.length) { return []; } var entrances = {}; var posMap = {}; var parsedList = positionList.slice().map(function(entity) { var clone4 = _extends$1(_extends$1({}, entity), { fields: entity.pos.split("-") }); delete clone4.children; return clone4; }); parsedList.forEach(function(entity) { posMap[entity.pos] = entity; }); parsedList.sort(function(a2, b2) { return a2.fields.length - b2.fields.length; }); parsedList.forEach(function(entity) { var parentPos = entity.fields.slice(0, -1).join("-"); var parentEntity = posMap[parentPos]; if (!parentEntity) { entrances[entity.pos] = entity; } else { parentEntity.children = parentEntity.children || []; parentEntity.children.push(entity); } delete entity.key; delete entity.fields; }); return Object.keys(entrances).map(function(key2) { return entrances[key2]; }); } var ariaId = 0; function generateAriaId(prefix) { ariaId += 1; return "".concat(prefix, "_").concat(ariaId); } function isLabelInValue(props2) { var treeCheckable = props2.treeCheckable, treeCheckStrictly = props2.treeCheckStrictly, labelInValue = props2.labelInValue; if (treeCheckable && treeCheckStrictly) { return true; } return labelInValue || false; } function parseSimpleTreeData(treeData, _ref) { var id2 = _ref.id, pId = _ref.pId, rootPId = _ref.rootPId; var keyNodes = {}; var rootNodeList = []; var nodeList2 = treeData.map(function(node) { var clone4 = _extends$1({}, node); var key2 = clone4[id2]; keyNodes[key2] = clone4; clone4.key = clone4.key || key2; return clone4; }); nodeList2.forEach(function(node) { var parentKey = node[pId]; var parent2 = keyNodes[parentKey]; if (parent2) { parent2.children = parent2.children || []; parent2.children.push(node); } if (parentKey === rootPId || !parent2 && rootPId === null) { rootNodeList.push(node); } }); return rootNodeList; } function isPosRelated(pos1, pos2) { var fields1 = pos1.split("-"); var fields2 = pos2.split("-"); var minLen = Math.min(fields1.length, fields2.length); for (var i2 = 0; i2 < minLen; i2 += 1) { if (fields1[i2] !== fields2[i2]) { return false; } } return true; } function cleanEntity(_ref2) { var node = _ref2.node, pos = _ref2.pos, children = _ref2.children; var instance = { node, pos }; if (children) { instance.children = children.map(cleanEntity); } return instance; } function getFilterTree(treeNodes, searchValue2, filterFunc, valueEntities, Component) { if (!searchValue2) { return null; } function mapFilteredNodeToData(node) { if (!node || isEmptyElement(node)) return null; var match5 = false; if (filterFunc(searchValue2, node)) { match5 = true; } var children = getSlot$1(node); children = ((typeof children === "function" ? children() : children) || []).map(mapFilteredNodeToData).filter(function(n2) { return n2; }); if (children.length || match5) { return createVNode(Component, _objectSpread2$2(_objectSpread2$2({}, node.props), {}, { "key": valueEntities[getPropsData(node).value].key }), { default: function _default8() { return [children]; } }); } return null; } return treeNodes.map(mapFilteredNodeToData).filter(function(node) { return node; }); } function formatInternalValue(value24, props2) { var valueList = toArray(value24); if (isLabelInValue(props2)) { return valueList.map(function(val) { if (_typeof$2(val) !== "object" || !val) { return { value: "", label: "" }; } return val; }); } return valueList.map(function(val) { return { value: val }; }); } function getLabel(wrappedValue, entity, treeNodeLabelProp) { if (wrappedValue.label) { return wrappedValue.label; } if (entity) { var props2 = getPropsData(entity.node); if (Object.keys(props2).length) { return props2[treeNodeLabelProp]; } } return wrappedValue.value; } function formatSelectorValue(valueList, props2, valueEntities) { var treeNodeLabelProp = props2.treeNodeLabelProp, treeCheckable = props2.treeCheckable, treeCheckStrictly = props2.treeCheckStrictly, showCheckedStrategy = props2.showCheckedStrategy; if (treeCheckable && !treeCheckStrictly) { var values2 = {}; valueList.forEach(function(wrappedValue) { values2[wrappedValue.value] = wrappedValue; }); var hierarchyList = flatToHierarchy(valueList.map(function(_ref3) { var value24 = _ref3.value; return valueEntities[value24]; })); if (showCheckedStrategy === SHOW_PARENT) { return hierarchyList.map(function(_ref4) { var node = _ref4.node; var value24 = getPropsData(node).value; return { label: getLabel(values2[value24], valueEntities[value24], treeNodeLabelProp), value: value24 }; }); } if (showCheckedStrategy === SHOW_CHILD) { var targetValueList = []; var traverse = function traverse2(_ref5) { var node = _ref5.node, children = _ref5.children; var value24 = getPropsData(node).value; if (!children || children.length === 0) { targetValueList.push({ label: getLabel(values2[value24], valueEntities[value24], treeNodeLabelProp), value: value24 }); return; } children.forEach(function(entity) { traverse2(entity); }); }; hierarchyList.forEach(function(entity) { traverse(entity); }); return targetValueList; } } return valueList.map(function(wrappedValue) { return { label: getLabel(wrappedValue, valueEntities[wrappedValue.value], treeNodeLabelProp), value: wrappedValue.value }; }); } function processProps(props2) { var title = props2.title, label = props2.label, key2 = props2.key, value24 = props2.value; var cloneProps = _extends$1({}, props2); if (label && !title) { cloneProps.title = label; } if (!key2 && (key2 === void 0 || key2 === null)) { cloneProps.key = value24; } return cloneProps; } function convertDataToTree(treeData) { return convertDataToTree$1(treeData, { processProps }); } function initWrapper(wrapper) { return _extends$1(_extends$1({}, wrapper), { valueEntities: {} }); } function processEntity(entity, wrapper) { var value24 = getPropsData(entity.node).value; entity.value = value24; var currentEntity = wrapper.valueEntities[value24]; if (currentEntity) { warning_1(false, "Conflict! value of node '".concat(entity.key, "' (").concat(value24, ") has already used by node '").concat(currentEntity.key, "'.")); } wrapper.valueEntities[value24] = entity; } function convertTreeToEntities(treeNodes) { return convertTreeToEntities$1(treeNodes, { initWrapper, processEntity }); } function getHalfCheckedKeys(valueList, valueEntities) { var values2 = {}; valueList.forEach(function(_ref6) { var value24 = _ref6.value; values2[value24] = false; }); valueList.forEach(function(_ref7) { var value24 = _ref7.value; var current2 = valueEntities[value24]; while (current2 && current2.parent) { var parentValue = current2.parent.value; if (parentValue in values2) break; values2[parentValue] = true; current2 = current2.parent; } }); return Object.keys(values2).filter(function(value24) { return values2[value24]; }).map(function(value24) { return valueEntities[value24].key; }); } var conductCheck = conductCheck$1; var BUILT_IN_PLACEMENTS = { bottomLeft: { points: ["tl", "bl"], offset: [0, 4], overflow: { adjustX: 0, adjustY: 1 }, ignoreShake: true }, topLeft: { points: ["bl", "tl"], offset: [0, -4], overflow: { adjustX: 0, adjustY: 1 }, ignoreShake: true } }; var SelectTrigger = { name: "SelectTrigger", inheritAttrs: false, props: { disabled: PropsTypes.looseBool, showSearch: PropsTypes.looseBool, prefixCls: PropsTypes.string, dropdownPopupAlign: PropsTypes.object, dropdownClassName: PropsTypes.string, dropdownStyle: PropsTypes.object, transitionName: PropsTypes.string, animation: PropsTypes.string, getPopupContainer: PropsTypes.func, dropdownMatchSelectWidth: PropsTypes.looseBool, isMultiple: PropsTypes.looseBool, dropdownPrefixCls: PropsTypes.string, dropdownVisibleChange: PropsTypes.func, popupElement: PropsTypes.any, open: PropsTypes.looseBool }, created: function created18() { this.triggerRef = createRef(); }, methods: { getDropdownTransitionName: function getDropdownTransitionName() { var _this$$props = this.$props, transitionName2 = _this$$props.transitionName, animation2 = _this$$props.animation, dropdownPrefixCls = _this$$props.dropdownPrefixCls; if (!transitionName2 && animation2) { return "".concat(dropdownPrefixCls, "-").concat(animation2); } return transitionName2; }, forcePopupAlign: function forcePopupAlign2() { var $trigger = this.triggerRef.current; if ($trigger) { $trigger.forcePopupAlign(); } } }, render: function render107() { var _classNames, _this = this; var _this$$props2 = this.$props, disabled = _this$$props2.disabled, isMultiple2 = _this$$props2.isMultiple, dropdownPopupAlign = _this$$props2.dropdownPopupAlign, dropdownMatchSelectWidth = _this$$props2.dropdownMatchSelectWidth, dropdownClassName = _this$$props2.dropdownClassName, dropdownStyle = _this$$props2.dropdownStyle, dropdownVisibleChange2 = _this$$props2.dropdownVisibleChange, getPopupContainer2 = _this$$props2.getPopupContainer, dropdownPrefixCls = _this$$props2.dropdownPrefixCls, popupElement = _this$$props2.popupElement, open6 = _this$$props2.open; var stretch; if (dropdownMatchSelectWidth !== false) { stretch = dropdownMatchSelectWidth ? "width" : "minWidth"; } return createVNode(Trigger, { "ref": this.triggerRef, "action": disabled ? [] : ["click"], "popupPlacement": "bottomLeft", "builtinPlacements": BUILT_IN_PLACEMENTS, "popupAlign": dropdownPopupAlign, "prefixCls": dropdownPrefixCls, "popupTransitionName": this.getDropdownTransitionName(), "onPopupVisibleChange": dropdownVisibleChange2, "popup": popupElement, "popupVisible": open6, "getPopupContainer": getPopupContainer2, "stretch": stretch, "popupClassName": classNames(dropdownClassName, (_classNames = {}, _defineProperty$12(_classNames, "".concat(dropdownPrefixCls, "--multiple"), isMultiple2), _defineProperty$12(_classNames, "".concat(dropdownPrefixCls, "--single"), !isMultiple2), _classNames)), "popupStyle": dropdownStyle }, { default: function _default8() { return [getSlot$1(_this)]; } }); } }; var SelectTrigger$1 = SelectTrigger; var selectorPropTypes = function selectorPropTypes2() { return { prefixCls: PropsTypes.string, open: PropsTypes.looseBool, selectorValueList: PropsTypes.array, allowClear: PropsTypes.looseBool, showArrow: PropsTypes.looseBool, removeSelected: PropsTypes.func, choiceTransitionName: PropsTypes.string, ariaId: PropsTypes.string, inputIcon: PropsTypes.any, clearIcon: PropsTypes.any, removeIcon: PropsTypes.any, placeholder: PropsTypes.any, disabled: PropsTypes.looseBool, focused: PropsTypes.looseBool, isMultiple: PropsTypes.looseBool, showSearch: PropsTypes.looseBool, searchValue: PropsTypes.string }; }; function noop() { } function generateSelector() { var BaseSelector = { name: "BaseSelector", inheritAttrs: false, mixins: [BaseMixin], props: initDefaultProps$2(_extends$1(_extends$1({}, selectorPropTypes()), { renderSelection: PropsTypes.func.isRequired, renderPlaceholder: PropsTypes.func, tabindex: PropsTypes.oneOfType([PropsTypes.number, PropsTypes.string]) }), { tabindex: 0 }), setup: function setup123() { return { vcTreeSelect: inject("vcTreeSelect", {}) }; }, created: function created24() { this.domRef = createRef(); }, methods: { onFocus: function onFocus5(e2) { var focused = this.$props.focused; var onSelectorFocus2 = this.vcTreeSelect.onSelectorFocus; if (!focused) { onSelectorFocus2(); } this.__emit("focus", e2); }, onBlur: function onBlur6(e2) { var onSelectorBlur2 = this.vcTreeSelect.onSelectorBlur; onSelectorBlur2(); this.__emit("blur", e2); }, focus: function focus25() { this.domRef.current.focus(); }, blur: function blur22() { this.domRef.current.blur(); }, renderClear: function renderClear() { var _this$$props = this.$props, prefixCls2 = _this$$props.prefixCls, allowClear = _this$$props.allowClear, selectorValueList = _this$$props.selectorValueList; var onSelectorClear2 = this.vcTreeSelect.onSelectorClear; if (!allowClear || !selectorValueList.length) { return null; } var clearIcon = getComponent(this, "clearIcon"); return createVNode("span", { "key": "clear", "unselectable": "on", "aria-hidden": "true", "style": "user-select: none;", "class": "".concat(prefixCls2, "-clear"), "onClick": onSelectorClear2 }, [clearIcon]); }, renderArrow: function renderArrow() { var _this$$props2 = this.$props, prefixCls2 = _this$$props2.prefixCls, showArrow = _this$$props2.showArrow; if (!showArrow) { return null; } var inputIcon = getComponent(this, "inputIcon"); return createVNode("span", { "key": "arrow", "class": "".concat(prefixCls2, "-arrow"), "style": { outline: "none", userSelect: "none" } }, [inputIcon]); } }, render: function render123() { var _classNames; var _this$$props3 = this.$props, prefixCls2 = _this$$props3.prefixCls, open6 = _this$$props3.open, focused = _this$$props3.focused, disabled = _this$$props3.disabled, allowClear = _this$$props3.allowClear, ariaId2 = _this$$props3.ariaId, renderSelection3 = _this$$props3.renderSelection, renderPlaceholder = _this$$props3.renderPlaceholder, tabindex = _this$$props3.tabindex, isMultiple2 = _this$$props3.isMultiple, showArrow = _this$$props3.showArrow, showSearch = _this$$props3.showSearch; var _this$$attrs = this.$attrs, className = _this$$attrs.class, style = _this$$attrs.style, _this$$attrs$onClick = _this$$attrs.onClick, onClick7 = _this$$attrs$onClick === void 0 ? noop : _this$$attrs$onClick; var onSelectorKeyDown = this.vcTreeSelect.onSelectorKeyDown; var myTabIndex = tabindex; if (disabled) { myTabIndex = null; } var mergedClassName = classNames(prefixCls2, className, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-focused"), open6 || focused), _defineProperty$12(_classNames, "".concat(prefixCls2, "-multiple"), isMultiple2), _defineProperty$12(_classNames, "".concat(prefixCls2, "-single"), !isMultiple2), _defineProperty$12(_classNames, "".concat(prefixCls2, "-allow-clear"), allowClear), _defineProperty$12(_classNames, "".concat(prefixCls2, "-show-arrow"), showArrow), _defineProperty$12(_classNames, "".concat(prefixCls2, "-disabled"), disabled), _defineProperty$12(_classNames, "".concat(prefixCls2, "-open"), open6), _defineProperty$12(_classNames, "".concat(prefixCls2, "-show-search"), showSearch), _classNames)); return createVNode("div", { "style": style, "onClick": onClick7, "class": mergedClassName, "ref": this.domRef, "role": "combobox", "aria-expanded": open6, "aria-owns": open6 ? ariaId2 : void 0, "aria-controls": open6 ? ariaId2 : void 0, "aria-haspopup": "listbox", "aria-disabled": disabled, "tabindex": myTabIndex, "onFocus": this.onFocus, "onBlur": this.onBlur, "onKeydown": onSelectorKeyDown }, [createVNode("span", { "class": "".concat(prefixCls2, "-selector") }, [renderSelection3(), renderPlaceholder && renderPlaceholder()]), this.renderArrow(), this.renderClear()]); } }; return BaseSelector; } var BaseInput = defineComponent({ props: { value: PropsTypes.string.def("") }, emits: ["change", "input"], setup: function setup116(_p, _ref) { var emit2 = _ref.emit; var inputRef = ref(null); var handleChange17 = function handleChange18(e2) { var composing = e2.target.composing; if (e2.isComposing || composing) { emit2("input", e2); } else { emit2("input", e2); emit2("change", e2); } }; return { inputRef, focus: function focus25() { if (inputRef.value) { inputRef.value.focus(); } }, blur: function blur22() { if (inputRef.value) { inputRef.value.blur(); } }, handleChange: handleChange17 }; }, render: function render108() { return withDirectives(createVNode("input", _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({}, this.$props), this.$attrs), {}, { "onInput": this.handleChange, "onChange": this.handleChange, "ref": "inputRef" }), null), [[antInput$1]]); } }); var BaseInput$1 = BaseInput; var SearchInput = { name: "SearchInput", inheritAttrs: false, props: { open: PropsTypes.looseBool, searchValue: PropsTypes.string, prefixCls: PropsTypes.string, disabled: PropsTypes.looseBool, renderPlaceholder: PropsTypes.func, needAlign: PropsTypes.looseBool, ariaId: PropsTypes.string, isMultiple: PropsTypes.looseBool.def(true), showSearch: PropsTypes.looseBool }, emits: ["mirrorSearchValueChange"], setup: function setup117(props2, _ref) { var emit2 = _ref.emit; var measureRef = ref(); var inputWidth = ref(0); var mirrorSearchValue = ref(props2.searchValue); watch(computed(function() { return props2.searchValue; }), function() { mirrorSearchValue.value = props2.searchValue; }); watch(mirrorSearchValue, function() { emit2("mirrorSearchValueChange", mirrorSearchValue.value); }, { immediate: true }); onMounted(function() { if (props2.isMultiple) { watch(mirrorSearchValue, function() { inputWidth.value = measureRef.value.scrollWidth; }, { flush: "post", immediate: true }); } }); return { measureRef, inputWidth, vcTreeSelect: inject("vcTreeSelect", {}), mirrorSearchValue }; }, created: function created19() { this.inputRef = createRef(); this.prevProps = _extends$1({}, this.$props); }, mounted: function mounted31() { var _this = this; this.$nextTick(function() { var open6 = _this.$props.open; if (open6) { _this.focus(true); } }); }, updated: function updated19() { var _this2 = this; var open6 = this.$props.open; var prevProps = this.prevProps; this.$nextTick(function() { if (open6 && prevProps.open !== open6) { _this2.focus(); } _this2.prevProps = _extends$1({}, _this2.$props); }); }, methods: { focus: function focus20(isDidMount) { var _this3 = this; if (this.inputRef.current) { if (isDidMount) { setTimeout(function() { _this3.inputRef.current.focus(); }, 0); } else { this.inputRef.current.focus(); } } }, blur: function blur17() { if (this.inputRef.current) { this.inputRef.current.blur(); } }, handleInputChange: function handleInputChange2(e2) { var _e$target = e2.target, value24 = _e$target.value, composing = _e$target.composing; var _this$searchValue = this.searchValue, searchValue2 = _this$searchValue === void 0 ? "" : _this$searchValue; if (e2.isComposing || composing || searchValue2 === value24) { this.mirrorSearchValue = value24; return; } this.vcTreeSelect.onSearchInputChange(e2); } }, render: function render109() { var _this$$props = this.$props, searchValue2 = _this$$props.searchValue, prefixCls2 = _this$$props.prefixCls, disabled = _this$$props.disabled, renderPlaceholder = _this$$props.renderPlaceholder, open6 = _this$$props.open, ariaId2 = _this$$props.ariaId, isMultiple2 = _this$$props.isMultiple, showSearch = _this$$props.showSearch; var onSearchInputKeyDown2 = this.vcTreeSelect.onSearchInputKeyDown, handleInputChange3 = this.handleInputChange, mirrorSearchValue = this.mirrorSearchValue, inputWidth = this.inputWidth; return createVNode(Fragment, null, [createVNode("span", { "class": "".concat(prefixCls2, "-selection-search"), "style": isMultiple2 ? { width: inputWidth + "px" } : {} }, [createVNode(BaseInput$1, { "type": "text", "ref": this.inputRef, "onChange": handleInputChange3, "onKeydown": onSearchInputKeyDown2, "value": searchValue2, "disabled": disabled, "readonly": !showSearch, "class": "".concat(prefixCls2, "-selection-search-input"), "aria-label": "filter select", "aria-autocomplete": "list", "aria-controls": open6 ? ariaId2 : void 0, "aria-multiline": "false" }, null), isMultiple2 ? createVNode("span", { "ref": "measureRef", "class": "".concat(prefixCls2, "-selection-search-mirror"), "aria-hidden": true }, [mirrorSearchValue, createTextVNode("\xA0")]) : null]), renderPlaceholder && !mirrorSearchValue ? renderPlaceholder() : null]); } }; var SearchInput$1 = SearchInput; var Selector$1 = generateSelector(); var SingleSelector = { name: "SingleSelector", inheritAttrs: false, props: selectorPropTypes(), created: function created20() { this.selectorRef = createRef(); this.inputRef = createRef(); }, data: function data58() { return { mirrorSearchValue: this.searchValue }; }, watch: { searchValue: function searchValue(val) { this.mirrorSearchValue = val; } }, methods: { onPlaceholderClick: function onPlaceholderClick() { this.inputRef.current.focus(); }, focus: function focus21() { this.selectorRef.current.focus(); }, blur: function blur18() { this.selectorRef.current.blur(); }, _renderPlaceholder: function _renderPlaceholder() { var _this$$props = this.$props, prefixCls2 = _this$$props.prefixCls, placeholder = _this$$props.placeholder, searchPlaceholder = _this$$props.searchPlaceholder, selectorValueList = _this$$props.selectorValueList; var currentPlaceholder = placeholder || searchPlaceholder; if (!currentPlaceholder) return null; var hidden = this.mirrorSearchValue || selectorValueList.length; return createVNode("span", { "style": { display: hidden ? "none" : "block" }, "onClick": this.onPlaceholderClick, "class": "".concat(prefixCls2, "-selection-placeholder") }, [currentPlaceholder]); }, onMirrorSearchValueChange: function onMirrorSearchValueChange(value24) { this.mirrorSearchValue = value24; }, renderSelection: function renderSelection() { var _this$$props2 = this.$props, selectorValueList = _this$$props2.selectorValueList, prefixCls2 = _this$$props2.prefixCls; var selectedValueNodes = []; if (selectorValueList.length && !this.mirrorSearchValue) { var _selectorValueList$ = selectorValueList[0], label = _selectorValueList$.label, value24 = _selectorValueList$.value; selectedValueNodes.push(createVNode("span", { "key": value24, "title": toTitle(label), "class": "".concat(prefixCls2, "-selection-item") }, [label || value24])); } selectedValueNodes.push(createVNode(SearchInput$1, _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({}, this.$props), this.$attrs), {}, { "ref": this.inputRef, "isMultiple": false, "onMirrorSearchValueChange": this.onMirrorSearchValueChange }), null)); return selectedValueNodes; } }, render: function render110() { var props2 = _extends$1(_extends$1(_extends$1({}, getOptionProps(this)), this.$attrs), { renderSelection: this.renderSelection, renderPlaceholder: this._renderPlaceholder, ref: this.selectorRef }); return createVNode(Selector$1, props2, null); } }; var SingleSelector$1 = SingleSelector; var Selection = { mixins: [BaseMixin], inheritAttrs: false, props: { prefixCls: PropsTypes.string, maxTagTextLength: PropsTypes.number, label: PropsTypes.any, value: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.number]), removeIcon: PropsTypes.any }, methods: { onRemove: function onRemove(event) { var value24 = this.$props.value; this.__emit("remove", event, value24); event.stopPropagation(); } }, render: function render111() { var _this$$props = this.$props, prefixCls2 = _this$$props.prefixCls, maxTagTextLength = _this$$props.maxTagTextLength, label = _this$$props.label, value24 = _this$$props.value; var content = label || value24; if (maxTagTextLength && typeof content === "string" && content.length > maxTagTextLength) { content = "".concat(content.slice(0, maxTagTextLength), "..."); } var _this$$attrs = this.$attrs, className = _this$$attrs.class, style = _this$$attrs.style, onRemove2 = _this$$attrs.onRemove; return createVNode("span", _objectSpread2$2(_objectSpread2$2({ "style": _extends$1(_extends$1({}, UNSELECTABLE_STYLE), style) }, UNSELECTABLE_ATTRIBUTE), {}, { "role": "menuitem", "class": classNames("".concat(prefixCls2, "-selection-item"), className), "title": toTitle(label) }), [createVNode("span", { "class": "".concat(prefixCls2, "-selection-item-content") }, [content]), onRemove2 && createVNode("span", { "class": "".concat(prefixCls2, "-selection-item-remove"), "onClick": this.onRemove }, [getComponent(this, "removeIcon")])]); } }; var Selection$1 = Selection; var TREE_SELECT_EMPTY_VALUE_KEY = "RC_TREE_SELECT_EMPTY_VALUE_KEY"; var Selector = generateSelector(); var MultipleSelector = { name: "MultipleSelector", mixins: [BaseMixin], inheritAttrs: false, props: _extends$1(_extends$1(_extends$1({}, selectorPropTypes()), SearchInput$1.props), { selectorValueList: PropsTypes.array, disabled: PropsTypes.looseBool, labelInValue: PropsTypes.looseBool, maxTagCount: PropsTypes.number, maxTagPlaceholder: PropsTypes.any }), setup: function setup118() { return { vcTreeSelect: inject("vcTreeSelect", {}) }; }, created: function created21() { this.inputRef = createRef(); }, methods: { onPlaceholderClick: function onPlaceholderClick2() { this.inputRef.current.focus(); }, focus: function focus22() { this.inputRef.current.focus(); }, blur: function blur19() { this.inputRef.current.blur(); }, _renderPlaceholder: function _renderPlaceholder2() { var _this$$props = this.$props, prefixCls2 = _this$$props.prefixCls, placeholder = _this$$props.placeholder, searchPlaceholder = _this$$props.searchPlaceholder, searchValue2 = _this$$props.searchValue, selectorValueList = _this$$props.selectorValueList; var currentPlaceholder = placeholder || searchPlaceholder; if (!currentPlaceholder) return null; var hidden = searchValue2 || selectorValueList.length; return createVNode("span", { "style": { display: hidden ? "none" : "block" }, "onClick": this.onPlaceholderClick, "class": "".concat(prefixCls2, "-selection-placeholder") }, [currentPlaceholder]); }, onChoiceAnimationLeave: function onChoiceAnimationLeave() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } this.__emit.apply(this, ["choiceAnimationLeave"].concat(args)); }, renderSelection: function renderSelection2() { var _this = this; var _this$$props2 = this.$props, selectorValueList = _this$$props2.selectorValueList, labelInValue = _this$$props2.labelInValue, maxTagCount = _this$$props2.maxTagCount; var children = getSlot$1(this); var onMultipleSelectorRemove2 = this.vcTreeSelect.onMultipleSelectorRemove; var myValueList = selectorValueList; if (maxTagCount >= 0) { myValueList = selectorValueList.slice(0, maxTagCount); } var selectedValueNodes = myValueList.map(function(_ref) { var label = _ref.label, value24 = _ref.value; return createVNode(Selection$1, _objectSpread2$2(_objectSpread2$2({}, _extends$1(_extends$1({}, _this.$props), { label, value: value24, onRemove: onMultipleSelectorRemove2 })), {}, { "key": value24 || TREE_SELECT_EMPTY_VALUE_KEY }), { default: function _default8() { return [children]; } }); }); if (maxTagCount >= 0 && maxTagCount < selectorValueList.length) { var content = "+ ".concat(selectorValueList.length - maxTagCount, " ..."); var maxTagPlaceholder = getComponent(this, "maxTagPlaceholder", {}, false); if (typeof maxTagPlaceholder === "string") { content = maxTagPlaceholder; } else if (typeof maxTagPlaceholder === "function") { var restValueList = selectorValueList.slice(maxTagCount); content = maxTagPlaceholder(labelInValue ? restValueList : restValueList.map(function(_ref2) { var value24 = _ref2.value; return value24; })); } var restNodeSelect = createVNode(Selection$1, _objectSpread2$2(_objectSpread2$2({}, _extends$1(_extends$1({}, this.$props), { label: content, value: null })), {}, { "key": "rc-tree-select-internal-max-tag-counter" }), { default: function _default8() { return [children]; } }); selectedValueNodes.push(restNodeSelect); } selectedValueNodes.push(createVNode(SearchInput$1, _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({ "key": "SearchInput" }, this.$props), this.$attrs), {}, { "ref": this.inputRef }), { default: function _default8() { return [children]; } })); return selectedValueNodes; } }, render: function render112() { var _this2 = this; return createVNode(Selector, _extends$1(_extends$1(_extends$1({}, this.$props), this.$attrs), { tabindex: -1, showArrow: false, renderSelection: this.renderSelection, renderPlaceholder: this._renderPlaceholder }), { default: function _default8() { return [getSlot$1(_this2)]; } }); } }; var MultipleSelector$1 = MultipleSelector; var TreeNode$1 = Tree$2.TreeNode; function SelectNode(_2, _ref) { var attrs = _ref.attrs, slots = _ref.slots; return createVNode(TreeNode$1, attrs, slots); } SelectNode.isTreeNode = true; SelectNode.inheritAttrs = false; SelectNode.displayName = "ATreeSelectNode"; function getDerivedState(nextProps, prevState) { var _ref = prevState || {}, _ref$_prevProps = _ref._prevProps, prevProps = _ref$_prevProps === void 0 ? {} : _ref$_prevProps, loadedKeys = _ref._loadedKeys, expandedKeyList = _ref._expandedKeyList, cachedExpandedKeyList = _ref._cachedExpandedKeyList; var valueList = nextProps.valueList, valueEntities = nextProps.valueEntities, keyEntities = nextProps.keyEntities, treeExpandedKeys = nextProps.treeExpandedKeys, filteredTreeNodes = nextProps.filteredTreeNodes, upperSearchValue = nextProps.upperSearchValue; var newState = { _prevProps: _extends$1({}, nextProps) }; if (valueList !== prevProps.valueList) { newState._keyList = valueList.map(function(_ref2) { var value24 = _ref2.value; return valueEntities[value24]; }).filter(function(entity) { return entity; }).map(function(_ref3) { var key2 = _ref3.key; return key2; }); } if (!treeExpandedKeys && filteredTreeNodes && filteredTreeNodes.length && filteredTreeNodes !== prevProps.filteredTreeNodes) { newState._expandedKeyList = _toConsumableArray(keyEntities.keys()); } if (upperSearchValue && !prevProps.upperSearchValue) { newState._cachedExpandedKeyList = expandedKeyList; } else if (!upperSearchValue && prevProps.upperSearchValue && !treeExpandedKeys) { newState._expandedKeyList = cachedExpandedKeyList || []; newState._cachedExpandedKeyList = []; } if (prevProps.treeExpandedKeys !== treeExpandedKeys) { newState._expandedKeyList = treeExpandedKeys; } if (nextProps.loadData) { newState._loadedKeys = loadedKeys.filter(function(key2) { return keyEntities.has(key2); }); } return newState; } var BasePopup = { mixins: [BaseMixin], inheritAttrs: false, name: "BasePopup", props: { prefixCls: PropsTypes.string, upperSearchValue: PropsTypes.string, valueList: PropsTypes.array, searchHalfCheckedKeys: PropsTypes.array, valueEntities: PropsTypes.object, keyEntities: Map, treeIcon: PropsTypes.looseBool, treeLine: PropsTypes.looseBool, treeNodeFilterProp: PropsTypes.string, treeCheckable: PropsTypes.any, treeCheckStrictly: PropsTypes.looseBool, treeDefaultExpandAll: PropsTypes.looseBool, treeDefaultExpandedKeys: PropsTypes.array, treeExpandedKeys: PropsTypes.array, loadData: PropsTypes.func, multiple: PropsTypes.looseBool, searchValue: PropsTypes.string, treeNodes: PropsTypes.any, filteredTreeNodes: PropsTypes.any, notFoundContent: PropsTypes.any, ariaId: PropsTypes.string, switcherIcon: PropsTypes.any, renderSearch: PropsTypes.func, __propsSymbol__: PropsTypes.any }, setup: function setup119() { return { vcTreeSelect: inject("vcTreeSelect", {}) }; }, watch: { __propsSymbol__: function __propsSymbol__2() { var state = getDerivedState(this.$props, this.$data); this.setState(state); } }, data: function data59() { this.treeRef = createRef(); warning_1(this.$props.__propsSymbol__); var _this$$props = this.$props, treeDefaultExpandAll = _this$$props.treeDefaultExpandAll, treeDefaultExpandedKeys = _this$$props.treeDefaultExpandedKeys, keyEntities = _this$$props.keyEntities; var expandedKeyList = treeDefaultExpandedKeys; if (treeDefaultExpandAll) { expandedKeyList = _toConsumableArray(keyEntities.keys()); } var state = { _keyList: [], _expandedKeyList: expandedKeyList, _cachedExpandedKeyList: [], _loadedKeys: [], _prevProps: {} }; return _extends$1(_extends$1({}, state), getDerivedState(this.$props, state)); }, methods: { onTreeExpand: function onTreeExpand(expandedKeyList) { var _this = this; var treeExpandedKeys = this.$props.treeExpandedKeys; if (!treeExpandedKeys) { this.setState({ _expandedKeyList: expandedKeyList }, function() { _this.__emit("treeExpanded"); }); } this.__emit("treeExpand", expandedKeyList); }, onLoad: function onLoad(loadedKeys) { this.setState({ _loadedKeys: loadedKeys }); }, getTree: function getTree() { return this.treeRef.current; }, getLoadData: function getLoadData() { var _this$$props2 = this.$props, loadData = _this$$props2.loadData, upperSearchValue = _this$$props2.upperSearchValue; if (upperSearchValue) return null; return loadData; }, filterTreeNode: function filterTreeNode(treeNode) { var _this$$props3 = this.$props, upperSearchValue = _this$$props3.upperSearchValue, treeNodeFilterProp = _this$$props3.treeNodeFilterProp; var filterVal = treeNode[treeNodeFilterProp]; if (typeof filterVal === "string") { return upperSearchValue && filterVal.toUpperCase().indexOf(upperSearchValue) !== -1; } return false; }, renderNotFound: function renderNotFound() { var _this$$props4 = this.$props, prefixCls2 = _this$$props4.prefixCls, notFoundContent = _this$$props4.notFoundContent; return createVNode("span", { "class": "".concat(prefixCls2, "-not-found") }, [notFoundContent]); } }, render: function render113() { var _this$$data = this.$data, keyList = _this$$data._keyList, expandedKeyList = _this$$data._expandedKeyList, loadedKeys = _this$$data._loadedKeys; var _this$$props5 = this.$props, prefixCls2 = _this$$props5.prefixCls, treeNodes = _this$$props5.treeNodes, filteredTreeNodes = _this$$props5.filteredTreeNodes, treeIcon = _this$$props5.treeIcon, treeLine = _this$$props5.treeLine, treeCheckable = _this$$props5.treeCheckable, treeCheckStrictly = _this$$props5.treeCheckStrictly, multiple = _this$$props5.multiple, ariaId2 = _this$$props5.ariaId, renderSearch = _this$$props5.renderSearch, switcherIcon = _this$$props5.switcherIcon, searchHalfCheckedKeys = _this$$props5.searchHalfCheckedKeys; var _this$vcTreeSelect = this.vcTreeSelect, onPopupKeyDown = _this$vcTreeSelect.onPopupKeyDown, onTreeNodeSelect2 = _this$vcTreeSelect.onTreeNodeSelect, onTreeNodeCheck2 = _this$vcTreeSelect.onTreeNodeCheck; var loadData = this.getLoadData(); var treeProps = {}; if (treeCheckable) { treeProps.checkedKeys = keyList; } else { treeProps.selectedKeys = keyList; } var $notFound; var $treeNodes; if (filteredTreeNodes) { if (filteredTreeNodes.length) { treeProps.checkStrictly = true; $treeNodes = filteredTreeNodes; if (treeCheckable && !treeCheckStrictly) { treeProps.checkedKeys = { checked: keyList, halfChecked: searchHalfCheckedKeys }; } } else { $notFound = this.renderNotFound(); } } else if (!treeNodes || !treeNodes.length) { $notFound = this.renderNotFound(); } else { $treeNodes = treeNodes; } var $tree; if ($notFound) { $tree = $notFound; } else { var treeAllProps = _extends$1(_extends$1({ prefixCls: "".concat(prefixCls2, "-tree"), showIcon: treeIcon, showLine: treeLine, selectable: !treeCheckable, checkable: treeCheckable, checkStrictly: treeCheckStrictly, multiple, loadData, loadedKeys, expandedKeys: expandedKeyList, filterTreeNode: this.filterTreeNode, switcherIcon }, treeProps), { children: $treeNodes, onSelect: onTreeNodeSelect2, onCheck: onTreeNodeCheck2, onExpand: this.onTreeExpand, onLoad: this.onLoad }); $tree = createVNode(Tree$2, _objectSpread2$2(_objectSpread2$2({}, treeAllProps), {}, { "ref": this.treeRef, "__propsSymbol__": [] }), null); } return createVNode("div", { "role": "listbox", "id": ariaId2, "onKeydown": onPopupKeyDown, "tabindex": -1 }, [renderSearch ? renderSearch() : null, $tree]); } }; var BasePopup$1 = BasePopup; function getWatch() { var keys2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var watch2 = {}; keys2.forEach(function(k2) { watch2[k2] = function() { this.needSyncKeys[k2] = true; }; }); return watch2; } var Select = defineComponent({ name: "Select", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$2({ prefixCls: PropsTypes.string, prefixAria: PropsTypes.string, multiple: PropsTypes.looseBool, showArrow: PropsTypes.looseBool, open: PropsTypes.looseBool, value: PropsTypes.any, autofocus: PropsTypes.looseBool, defaultOpen: PropsTypes.looseBool, defaultValue: PropsTypes.any, showSearch: PropsTypes.looseBool, placeholder: PropsTypes.any, inputValue: PropsTypes.string, searchValue: PropsTypes.string, autoClearSearchValue: PropsTypes.looseBool, searchPlaceholder: PropsTypes.any, disabled: PropsTypes.looseBool, children: PropsTypes.any, labelInValue: PropsTypes.looseBool, maxTagCount: PropsTypes.number, maxTagPlaceholder: PropsTypes.any, maxTagTextLength: PropsTypes.number, showCheckedStrategy: PropsTypes.oneOf([SHOW_ALL, SHOW_PARENT, SHOW_CHILD]), dropdownClassName: PropsTypes.string, dropdownStyle: PropsTypes.object, dropdownVisibleChange: PropsTypes.func, dropdownMatchSelectWidth: PropsTypes.looseBool, treeData: PropsTypes.array, treeDataSimpleMode: withUndefined(PropsTypes.oneOfType([PropsTypes.looseBool, PropsTypes.object])), treeNodeFilterProp: PropsTypes.string, treeNodeLabelProp: PropsTypes.string, treeCheckable: PropsTypes.any, treeCheckStrictly: PropsTypes.looseBool, treeIcon: PropsTypes.looseBool, treeLine: PropsTypes.looseBool, treeDefaultExpandAll: PropsTypes.looseBool, treeDefaultExpandedKeys: PropsTypes.array, treeExpandedKeys: PropsTypes.array, loadData: PropsTypes.func, filterTreeNode: withUndefined(PropsTypes.oneOfType([PropsTypes.func, PropsTypes.looseBool])), notFoundContent: PropsTypes.any, getPopupContainer: PropsTypes.func, allowClear: PropsTypes.looseBool, transitionName: PropsTypes.string, animation: PropsTypes.string, choiceTransitionName: PropsTypes.string, inputIcon: PropsTypes.any, clearIcon: PropsTypes.any, removeIcon: PropsTypes.any, switcherIcon: PropsTypes.any, __propsSymbol__: PropsTypes.any }, { prefixCls: "rc-tree-select", prefixAria: "rc-tree-select", showArrow: true, showSearch: true, autoClearSearchValue: true, showCheckedStrategy: SHOW_CHILD, treeNodeFilterProp: "value", treeNodeLabelProp: "title", treeIcon: false, notFoundContent: "Not Found", dropdownStyle: {}, dropdownVisibleChange: function dropdownVisibleChange() { return true; } }), data: function data60() { warning_1(this.$props.__propsSymbol__); var _this$$props = this.$props, prefixAria = _this$$props.prefixAria, defaultOpen = _this$$props.defaultOpen, open6 = _this$$props.open; this.needSyncKeys = {}; this.selectorRef = createRef(); this.selectTriggerRef = createRef(); this.ariaId = generateAriaId("".concat(prefixAria, "-list")); var state = { _open: open6 || defaultOpen, _valueList: [], _searchHalfCheckedKeys: [], _missValueList: [], _selectorValueList: [], _valueEntities: {}, _posEntities: /* @__PURE__ */ new Map(), _keyEntities: /* @__PURE__ */ new Map(), _searchValue: "", _prevProps: {}, _init: true, _focused: void 0, _treeNodes: void 0, _filteredTreeNodes: void 0 }; var newState = this.getDerivedState(this.$props, state); return _extends$1(_extends$1({}, state), newState); }, watch: _extends$1(_extends$1({}, getWatch(["treeData", "defaultValue", "value"])), { __propsSymbol__: function __propsSymbol__3() { var state = this.getDerivedState(this.$props, this.$data); this.setState(state); this.needSyncKeys = {}; }, _valueList: function _valueList() { var _this = this; this.$nextTick(function() { _this.forcePopupAlign(); }); }, _open: function _open2(open6) { var _this2 = this; this.$nextTick(function() { if (!open6 && !_this2.isSearchValueControlled()) { _this2.setState({ _searchValue: "" }); } if (open6 && !_this2.$data._searchValue) { _this2.setState({ _filteredTreeNodes: null }); } var prefixCls2 = _this2.$props.prefixCls; var _this2$$data = _this2.$data, selectorValueList = _this2$$data._selectorValueList, valueEntities = _this2$$data._valueEntities; var isMultiple2 = _this2.isMultiple(); if (!isMultiple2 && selectorValueList.length && open6 && _this2.popup) { var value24 = selectorValueList[0].value; var _this2$popup$getTree = _this2.popup.getTree(), domTreeNodes = _this2$popup$getTree.domTreeNodes; var _ref = valueEntities[value24] || {}, key2 = _ref.key; var treeNode = domTreeNodes[key2]; if (treeNode) { var domNode = findDOMNode(treeNode); requestAnimationFrame(function() { var popupNode = findDOMNode(_this2.popup); var triggerContainer = findPopupContainer(popupNode, "".concat(prefixCls2, "-dropdown")); if (domNode && triggerContainer) { scrollIntoView(domNode, triggerContainer, { onlyScrollIfNeeded: true, offsetTop: 0 }); } }); } } }); } }), created: function created22() { provide("vcTreeSelect", { onSelectorFocus: this.onSelectorFocus, onSelectorBlur: this.onSelectorBlur, onSelectorKeyDown: this.onComponentKeyDown, onSelectorClear: this.onSelectorClear, onMultipleSelectorRemove: this.onMultipleSelectorRemove, onTreeNodeSelect: this.onTreeNodeSelect, onTreeNodeCheck: this.onTreeNodeCheck, onPopupKeyDown: this.onComponentKeyDown, onSearchInputChange: this.onSearchInputChange, onSearchInputKeyDown: this.onSearchInputKeyDown }); }, mounted: function mounted32() { var _this3 = this; this.$nextTick(function() { var _this3$$props = _this3.$props, autofocus = _this3$$props.autofocus, disabled = _this3$$props.disabled; if (autofocus && !disabled) { _this3.focus(); } }); }, methods: { getDerivedState: function getDerivedState3(nextProps, prevState) { var _prevState$_prevProps = prevState._prevProps, prevProps = _prevState$_prevProps === void 0 ? {} : _prevState$_prevProps; var treeCheckable = nextProps.treeCheckable, treeCheckStrictly = nextProps.treeCheckStrictly, filterTreeNode2 = nextProps.filterTreeNode, treeNodeFilterProp = nextProps.treeNodeFilterProp, treeDataSimpleMode = nextProps.treeDataSimpleMode; var newState = { _prevProps: _extends$1({}, nextProps), _init: false }; var self2 = this; function processState(propName, updater) { if (prevProps[propName] !== nextProps[propName] || self2.needSyncKeys[propName]) { updater(nextProps[propName], prevProps[propName]); return true; } return false; } var valueRefresh = false; processState("open", function(propValue) { newState._open = propValue; }); var treeNodes; var treeDataChanged = false; var treeDataModeChanged = false; processState("treeData", function(propValue) { treeNodes = convertDataToTree(propValue); treeDataChanged = true; }); processState("treeDataSimpleMode", function(propValue, prevValue) { if (!propValue) return; var prev2 = !prevValue || prevValue === true ? {} : prevValue; if (!shallowEqual$1(propValue, prev2)) { treeDataModeChanged = true; } }); if (treeDataSimpleMode && (treeDataChanged || treeDataModeChanged)) { var simpleMapper = _extends$1({ id: "id", pId: "pId", rootPId: null }, treeDataSimpleMode !== true ? treeDataSimpleMode : {}); treeNodes = convertDataToTree(parseSimpleTreeData(nextProps.treeData, simpleMapper)); } if (!nextProps.treeData) { treeNodes = this.children || []; } if (treeNodes) { var entitiesMap = convertTreeToEntities(treeNodes); newState._treeNodes = treeNodes; newState._posEntities = entitiesMap.posEntities; newState._valueEntities = entitiesMap.valueEntities; newState._keyEntities = entitiesMap.keyEntities; valueRefresh = true; } if (prevState._init) { processState("defaultValue", function(propValue) { newState._valueList = formatInternalValue(propValue, nextProps); valueRefresh = true; }); } processState("value", function(propValue) { newState._valueList = formatInternalValue(propValue, nextProps); valueRefresh = true; }); if (valueRefresh) { var missValueList = []; var filteredValueList = []; var keyList = []; var latestValueList = newState._valueList; if (!latestValueList) { latestValueList = [].concat(_toConsumableArray(prevState._valueList), _toConsumableArray(prevState._missValueList)); } var valueLabels = {}; latestValueList.forEach(function(wrapperValue) { var value24 = wrapperValue.value, label = wrapperValue.label; var entity = (newState._valueEntities || prevState._valueEntities)[value24]; valueLabels[value24] = label; if (entity) { keyList.push(entity.key); filteredValueList.push(wrapperValue); return; } missValueList.push(wrapperValue); }); if (treeCheckable && !treeCheckStrictly) { var _conductCheck = conductCheck(keyList, true, newState._keyEntities || prevState._keyEntities), checkedKeys = _conductCheck.checkedKeys; newState._valueList = checkedKeys.map(function(key2) { var val = (newState._keyEntities || prevState._keyEntities).get(key2).value; var wrappedValue = { value: val }; if (valueLabels[val] !== void 0) { wrappedValue.label = valueLabels[val]; } return wrappedValue; }); } else { newState._valueList = filteredValueList; } newState._missValueList = missValueList; newState._selectorValueList = formatSelectorValue(newState._valueList, nextProps, newState._valueEntities || prevState._valueEntities); } processState("inputValue", function(propValue) { if (propValue !== null) { newState._searchValue = propValue; } }); processState("searchValue", function(propValue) { newState._searchValue = propValue; }); if (newState._searchValue !== void 0 || prevState._searchValue && treeNodes) { var searchValue2 = newState._searchValue !== void 0 ? newState._searchValue : prevState._searchValue; var upperSearchValue = String(searchValue2).toUpperCase(); var filterTreeNodeFn = filterTreeNode2; if (filterTreeNode2 === false) { filterTreeNodeFn = function filterTreeNodeFn2() { return true; }; } else if (typeof filterTreeNodeFn !== "function") { filterTreeNodeFn = function filterTreeNodeFn2(_2, node) { var nodeValue = String(getPropsData(node)[treeNodeFilterProp]).toUpperCase(); return nodeValue.indexOf(upperSearchValue) !== -1; }; } newState._filteredTreeNodes = getFilterTree(newState._treeNodes || prevState._treeNodes, searchValue2, filterTreeNodeFn, newState._valueEntities || prevState._valueEntities, SelectNode); } if (valueRefresh && treeCheckable && !treeCheckStrictly && (newState._searchValue || prevState._searchValue)) { newState._searchHalfCheckedKeys = getHalfCheckedKeys(newState._valueList, newState._valueEntities || prevState._valueEntities); } processState("showCheckedStrategy", function() { newState._selectorValueList = newState._selectorValueList || formatSelectorValue(newState._valueList || prevState._valueList, nextProps, newState._valueEntities || prevState._valueEntities); }); return newState; }, onSelectorFocus: function onSelectorFocus() { this.setState({ _focused: true }); }, onSelectorBlur: function onSelectorBlur() { this.setState({ _focused: false }); }, onComponentKeyDown: function onComponentKeyDown(event) { var open6 = this.$data._open; var keyCode = event.keyCode; if (!open6) { if ([KeyCode$1.ENTER, KeyCode$1.DOWN].indexOf(keyCode) !== -1) { this.setOpenState(true); } } else if (KeyCode$1.ESC === keyCode) { this.setOpenState(false); } else if ([KeyCode$1.UP, KeyCode$1.DOWN, KeyCode$1.LEFT, KeyCode$1.RIGHT].indexOf(keyCode) !== -1) { event.stopPropagation(); } }, onDeselect: function onDeselect(wrappedValue, node, nodeEventInfo) { this.__emit("deselect", wrappedValue, node, nodeEventInfo); }, onSelectorClear: function onSelectorClear(event) { var disabled = this.$props.disabled; if (disabled) return; this.triggerChange([], []); if (!this.isSearchValueControlled()) { this.setUncontrolledState({ _searchValue: "", _filteredTreeNodes: null }); } event.stopPropagation(); }, onMultipleSelectorRemove: function onMultipleSelectorRemove(event, removeValue) { event.stopPropagation(); var _this$$data = this.$data, valueList = _this$$data._valueList, missValueList = _this$$data._missValueList, valueEntities = _this$$data._valueEntities; var _this$$props2 = this.$props, treeCheckable = _this$$props2.treeCheckable, treeCheckStrictly = _this$$props2.treeCheckStrictly, treeNodeLabelProp = _this$$props2.treeNodeLabelProp, disabled = _this$$props2.disabled; if (disabled) return; var triggerEntity = valueEntities[removeValue]; var newValueList = valueList; if (triggerEntity) { if (treeCheckable && !treeCheckStrictly) { newValueList = valueList.filter(function(_ref2) { var value24 = _ref2.value; var entity = valueEntities[value24]; return !isPosRelated(entity.pos, triggerEntity.pos); }); } else { newValueList = valueList.filter(function(_ref3) { var value24 = _ref3.value; return value24 !== removeValue; }); } } var triggerNode = triggerEntity ? triggerEntity.node : null; var extraInfo = { triggerValue: removeValue, triggerNode }; var deselectInfo = { node: triggerNode }; if (treeCheckable) { var filteredEntityList = newValueList.map(function(_ref4) { var value24 = _ref4.value; return valueEntities[value24]; }); deselectInfo.event = "check"; deselectInfo.checked = false; deselectInfo.checkedNodes = filteredEntityList.map(function(_ref5) { var node = _ref5.node; return node; }); deselectInfo.checkedNodesPositions = filteredEntityList.map(function(_ref6) { var node = _ref6.node, pos = _ref6.pos; return { node, pos }; }); if (treeCheckStrictly) { extraInfo.allCheckedNodes = deselectInfo.checkedNodes; } else { extraInfo.allCheckedNodes = flatToHierarchy(filteredEntityList).map(function(_ref7) { var node = _ref7.node; return node; }); } } else { deselectInfo.event = "select"; deselectInfo.selected = false; deselectInfo.selectedNodes = newValueList.map(function(_ref8) { var value24 = _ref8.value; return (valueEntities[value24] || {}).node; }); } var newMissValueList = missValueList.filter(function(_ref9) { var value24 = _ref9.value; return value24 !== removeValue; }); var wrappedValue; if (this.isLabelInValue()) { wrappedValue = { label: triggerNode ? getPropsData(triggerNode)[treeNodeLabelProp] : null, value: removeValue }; } else { wrappedValue = removeValue; } this.onDeselect(wrappedValue, triggerNode, deselectInfo); this.triggerChange(newMissValueList, newValueList, extraInfo); }, onValueTrigger: function onValueTrigger(isAdd, nodeList2, nodeEventInfo, nodeExtraInfo) { var node = nodeEventInfo.node; var value24 = node.$props.value; var _this$$data2 = this.$data, missValueList = _this$$data2._missValueList, valueEntities = _this$$data2._valueEntities, keyEntities = _this$$data2._keyEntities, searchValue2 = _this$$data2._searchValue; var _this$$props3 = this.$props, disabled = _this$$props3.disabled, inputValue = _this$$props3.inputValue, treeNodeLabelProp = _this$$props3.treeNodeLabelProp, treeCheckable = _this$$props3.treeCheckable, treeCheckStrictly = _this$$props3.treeCheckStrictly, autoClearSearchValue = _this$$props3.autoClearSearchValue; var label = node.$props[treeNodeLabelProp]; if (disabled) return; var wrappedValue; if (this.isLabelInValue()) { wrappedValue = { value: value24, label }; } else { wrappedValue = value24; } if (isAdd) { this.__emit("select", wrappedValue, node, nodeEventInfo); } else { this.__emit("deselect", wrappedValue, node, nodeEventInfo); } var newValueList = nodeList2.map(function(node2) { var props2 = getPropsData(node2); return { value: props2.value, label: props2[treeNodeLabelProp] }; }); if (treeCheckable && !treeCheckStrictly) { var keyList = newValueList.map(function(_ref10) { var val = _ref10.value; return valueEntities[val].key; }); if (isAdd) { keyList = conductCheck(keyList, true, keyEntities).checkedKeys; } else { keyList = conductCheck([valueEntities[value24].key], false, keyEntities, { checkedKeys: keyList }).checkedKeys; } newValueList = keyList.map(function(key2) { var props2 = getPropsData(keyEntities.get(key2).node); return { value: props2.value, label: props2[treeNodeLabelProp] }; }); } if (autoClearSearchValue || inputValue === null) { if (!this.isSearchValueControlled()) { this.setUncontrolledState({ _searchValue: "", _filteredTreeNodes: null }); } if (searchValue2 && searchValue2.length) { this.__emit("search", ""); } } var extraInfo = _extends$1(_extends$1({}, nodeExtraInfo), { triggerValue: value24, triggerNode: node }); this.triggerChange(missValueList, newValueList, extraInfo); }, onTreeNodeSelect: function onTreeNodeSelect(_2, nodeEventInfo) { var _this$$data3 = this.$data, valueList = _this$$data3._valueList, valueEntities = _this$$data3._valueEntities; var _this$$props4 = this.$props, treeCheckable = _this$$props4.treeCheckable, multiple = _this$$props4.multiple; if (treeCheckable) return; if (!multiple) { this.setOpenState(false); } var isAdd = nodeEventInfo.selected; var selectedValue5 = nodeEventInfo.node.$props.value; var newValueList; if (!multiple) { newValueList = [{ value: selectedValue5 }]; } else { newValueList = valueList.filter(function(_ref11) { var value24 = _ref11.value; return value24 !== selectedValue5; }); if (isAdd) { newValueList.push({ value: selectedValue5 }); } } var selectedNodes = newValueList.map(function(_ref12) { var value24 = _ref12.value; return valueEntities[value24]; }).filter(function(entity) { return entity; }).map(function(_ref13) { var node = _ref13.node; return node; }); this.onValueTrigger(isAdd, selectedNodes, nodeEventInfo, { selected: isAdd }); }, onTreeNodeCheck: function onTreeNodeCheck(_2, nodeEventInfo) { var _this$$data4 = this.$data, searchValue2 = _this$$data4._searchValue, keyEntities = _this$$data4._keyEntities, valueEntities = _this$$data4._valueEntities, valueList = _this$$data4._valueList; var treeCheckStrictly = this.$props.treeCheckStrictly; var checkedNodes = nodeEventInfo.checkedNodes, checkedNodesPositions = nodeEventInfo.checkedNodesPositions; var isAdd = nodeEventInfo.checked; var extraInfo = { checked: isAdd }; var checkedNodeList = checkedNodes; if (searchValue2) { var oriKeyList = valueList.map(function(_ref14) { var value24 = _ref14.value; return valueEntities[value24]; }).filter(function(entity) { return entity; }).map(function(_ref15) { var key2 = _ref15.key; return key2; }); var keyList; if (isAdd) { keyList = Array.from(new Set([].concat(_toConsumableArray(oriKeyList), _toConsumableArray(checkedNodeList.map(function(node) { var _getPropsData = getPropsData(node), value24 = _getPropsData.value; return valueEntities[value24].key; }))))); } else { keyList = conductCheck([getPropsData(nodeEventInfo.node).eventKey], false, keyEntities, { checkedKeys: oriKeyList }).checkedKeys; } checkedNodeList = keyList.map(function(key2) { return keyEntities.get(key2).node; }); extraInfo.allCheckedNodes = keyList.map(function(key2) { return cleanEntity(keyEntities.get(key2)); }); } else if (treeCheckStrictly) { extraInfo.allCheckedNodes = nodeEventInfo.checkedNodes; } else { extraInfo.allCheckedNodes = flatToHierarchy(checkedNodesPositions); } this.onValueTrigger(isAdd, checkedNodeList, nodeEventInfo, extraInfo); }, onDropdownVisibleChange: function onDropdownVisibleChange(open6) { var _this$$props5 = this.$props, multiple = _this$$props5.multiple, treeCheckable = _this$$props5.treeCheckable; var _searchValue = this.$data._searchValue; if (open6 && !multiple && !treeCheckable && _searchValue) { this.setUncontrolledState({ _searchValue: "", _filteredTreeNodes: null }); } this.setOpenState(open6, true); }, onSearchInputChange: function onSearchInputChange(event) { var value24 = event.target.value; var _this$$data5 = this.$data, treeNodes = _this$$data5._treeNodes, valueEntities = _this$$data5._valueEntities; var _this$$props6 = this.$props, filterTreeNode2 = _this$$props6.filterTreeNode, treeNodeFilterProp = _this$$props6.treeNodeFilterProp; this.__emit("search", value24); var isSet2 = false; if (!this.isSearchValueControlled()) { isSet2 = this.setUncontrolledState({ _searchValue: value24 }); this.setOpenState(true); } if (isSet2) { var upperSearchValue = String(value24).toUpperCase(); var filterTreeNodeFn = filterTreeNode2; if (filterTreeNode2 === false) { filterTreeNodeFn = function filterTreeNodeFn2() { return true; }; } else if (!filterTreeNodeFn) { filterTreeNodeFn = function filterTreeNodeFn2(_2, node) { var nodeValue = String(getPropsData(node)[treeNodeFilterProp]).toUpperCase(); return nodeValue.indexOf(upperSearchValue) !== -1; }; } this.setState({ _filteredTreeNodes: getFilterTree(treeNodes, value24, filterTreeNodeFn, valueEntities, SelectNode) }); } }, onSearchInputKeyDown: function onSearchInputKeyDown(event) { var _this$$data6 = this.$data, searchValue2 = _this$$data6._searchValue, valueList = _this$$data6._valueList, valueEntities = _this$$data6._valueEntities; var keyCode = event.keyCode; if (KeyCode$1.BACKSPACE === keyCode && this.isMultiple() && !searchValue2 && valueList.length) { var lastValue = valueList[valueList.length - 1].value; var treeCheckStrictly = this.$props.treeCheckStrictly; if (!treeCheckStrictly) { (function() { var cur = valueEntities[lastValue]; while (cur) { if (valueList.some(function(j2) { return j2.value === cur.value; })) { lastValue = cur.value; cur = cur.parent; } else { cur = null; } } })(); } this.onMultipleSelectorRemove(event, lastValue); } }, onChoiceAnimationLeave: function onChoiceAnimationLeave2() { var _this4 = this; requestAnimationFrame(function() { _this4.forcePopupAlign(); }); }, setPopupRef: function setPopupRef(popup) { this.popup = popup; }, setUncontrolledState: function setUncontrolledState3(state) { var needSync = false; var newState = {}; var props2 = getOptionProps(this); Object.keys(state).forEach(function(name) { if (name.slice(1) in props2) return; needSync = true; newState[name] = state[name]; }); if (needSync) { this.setState(newState); } return needSync; }, setOpenState: function setOpenState(open6) { var byTrigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; var dropdownVisibleChange2 = this.$props.dropdownVisibleChange; if (dropdownVisibleChange2 && dropdownVisibleChange2(open6, { documentClickClose: !open6 && byTrigger }) === false) { return; } this.setUncontrolledState({ _open: open6 }); }, isMultiple: function isMultiple() { var _this$$props7 = this.$props, multiple = _this$$props7.multiple, treeCheckable = _this$$props7.treeCheckable; return !!(multiple || treeCheckable); }, isLabelInValue: function isLabelInValue$1() { return isLabelInValue(this.$props); }, isSearchValueControlled: function isSearchValueControlled() { var props2 = getOptionProps(this); var inputValue = props2.inputValue; if ("searchValue" in props2) return true; return "inputValue" in props2 && inputValue !== null; }, forcePopupAlign: function forcePopupAlign3() { var $trigger = this.selectTriggerRef.current; if ($trigger) { $trigger.forcePopupAlign(); } }, delayForcePopupAlign: function delayForcePopupAlign() { var _this5 = this; requestAnimationFrame(function() { requestAnimationFrame(_this5.forcePopupAlign); }); }, triggerChange: function triggerChange3(missValueList, valueList) { var extraInfo = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; var _this$$data7 = this.$data, valueEntities = _this$$data7._valueEntities, searchValue2 = _this$$data7._searchValue, prevSelectorValueList = _this$$data7._selectorValueList; var props2 = getOptionProps(this); var disabled = props2.disabled, treeCheckable = props2.treeCheckable, treeCheckStrictly = props2.treeCheckStrictly; if (disabled) return; var extra = _extends$1({ preValue: prevSelectorValueList.map(function(_ref16) { var label = _ref16.label, value24 = _ref16.value; return { label, value: value24 }; }) }, extraInfo); var selectorValueList = formatSelectorValue(valueList, props2, valueEntities); if (!("value" in props2)) { var newState = { _missValueList: missValueList, _valueList: valueList, _selectorValueList: selectorValueList }; if (searchValue2 && treeCheckable && !treeCheckStrictly) { newState._searchHalfCheckedKeys = getHalfCheckedKeys(valueList, valueEntities); } this.setState(newState); } if (this.$attrs.onChange) { var connectValueList; if (this.isMultiple()) { connectValueList = [].concat(_toConsumableArray(missValueList), _toConsumableArray(selectorValueList)); } else { connectValueList = selectorValueList.slice(0, 1); } var labelList = null; var returnValue; if (this.isLabelInValue()) { returnValue = connectValueList.map(function(_ref17) { var label = _ref17.label, value24 = _ref17.value; return { label, value: value24 }; }); } else { labelList = []; returnValue = connectValueList.map(function(_ref18) { var label = _ref18.label, value24 = _ref18.value; labelList.push(label); return value24; }); } if (!this.isMultiple()) { returnValue = returnValue[0]; } this.__emit("change", returnValue, labelList, extra); } }, focus: function focus23() { this.selectorRef.current.focus(); }, blur: function blur20() { this.selectorRef.current.blur(); } }, render: function render114() { var _this$$data8 = this.$data, valueList = _this$$data8._valueList, missValueList = _this$$data8._missValueList, selectorValueList = _this$$data8._selectorValueList, searchHalfCheckedKeys = _this$$data8._searchHalfCheckedKeys, valueEntities = _this$$data8._valueEntities, keyEntities = _this$$data8._keyEntities, searchValue2 = _this$$data8._searchValue, open6 = _this$$data8._open, focused = _this$$data8._focused, treeNodes = _this$$data8._treeNodes, filteredTreeNodes = _this$$data8._filteredTreeNodes; var props2 = getOptionProps(this); var prefixCls2 = props2.prefixCls, treeExpandedKeys = props2.treeExpandedKeys; var isMultiple2 = this.isMultiple(); var passProps = _extends$1(_extends$1(_extends$1({}, props2), this.$attrs), { isMultiple: isMultiple2, valueList, searchHalfCheckedKeys, selectorValueList: [].concat(_toConsumableArray(missValueList), _toConsumableArray(selectorValueList)), valueEntities, keyEntities, searchValue: searchValue2, upperSearchValue: (searchValue2 || "").toUpperCase(), open: open6, focused, dropdownPrefixCls: "".concat(prefixCls2, "-dropdown"), ariaId: this.ariaId, onChoiceAnimationLeave: this.onChoiceAnimationLeave, vSlots: this.$slots }); var popupProps = _extends$1(_extends$1({}, passProps), { treeNodes, filteredTreeNodes, treeExpandedKeys, onTreeExpanded: this.delayForcePopupAlign, ref: this.setPopupRef }); var $popup = createVNode(BasePopup$1, _objectSpread2$2(_objectSpread2$2({}, popupProps), {}, { "__propsSymbol__": [] }), null); var Selector2 = isMultiple2 ? MultipleSelector$1 : SingleSelector$1; var $selector = createVNode(Selector2, _objectSpread2$2(_objectSpread2$2({}, passProps), {}, { "isMultiple": isMultiple2, "ref": this.selectorRef }), null); var selectTriggerProps = _extends$1(_extends$1({}, passProps), { popupElement: $popup, dropdownVisibleChange: this.onDropdownVisibleChange, ref: this.selectTriggerRef }); return createVNode(SelectTrigger$1, selectTriggerProps, { default: function _default8() { return [$selector]; } }); } }); Select.TreeNode = SelectNode; Select.SHOW_ALL = SHOW_ALL; Select.SHOW_PARENT = SHOW_PARENT; Select.SHOW_CHILD = SHOW_CHILD; Select.name = "TreeSelect"; var Select$1 = Select; var TreeNode = SelectNode; PropsTypes.shape({ key: PropsTypes.string, value: PropsTypes.string, label: PropsTypes.VNodeChild, slots: PropsTypes.object, children: PropsTypes.array }).loose; var TreeSelectProps = function TreeSelectProps2() { return _extends$1(_extends$1({}, SelectProps()), { autofocus: PropsTypes.looseBool, dropdownStyle: PropsTypes.object, filterTreeNode: withUndefined(PropsTypes.oneOfType([Function, Boolean])), getPopupContainer: PropsTypes.func, labelInValue: PropsTypes.looseBool, loadData: PropsTypes.func, maxTagCount: PropsTypes.number, maxTagPlaceholder: PropsTypes.VNodeChild, value: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.object, PropsTypes.array, PropsTypes.number]), defaultValue: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.object, PropsTypes.array, PropsTypes.number]), multiple: PropsTypes.looseBool, notFoundContent: PropsTypes.VNodeChild, searchPlaceholder: PropsTypes.string, searchValue: PropsTypes.string, showCheckedStrategy: PropsTypes.oneOf(tuple("SHOW_ALL", "SHOW_PARENT", "SHOW_CHILD")), suffixIcon: PropsTypes.VNodeChild, treeCheckable: PropsTypes.looseBool, treeCheckStrictly: PropsTypes.looseBool, treeData: PropsTypes.arrayOf(Object), treeDataSimpleMode: withUndefined(PropsTypes.oneOfType([PropsTypes.looseBool, Object])), dropdownClassName: PropsTypes.string, dropdownMatchSelectWidth: PropsTypes.looseBool, treeDefaultExpandAll: PropsTypes.looseBool, treeExpandedKeys: PropsTypes.array, treeIcon: PropsTypes.looseBool, treeDefaultExpandedKeys: PropsTypes.array, treeNodeFilterProp: PropsTypes.string, treeNodeLabelProp: PropsTypes.string, replaceFields: PropsTypes.object.def({}), clearIcon: PropsTypes.VNodeChild, removeIcon: PropsTypes.VNodeChild, onSelect: PropsTypes.func, onChange: PropsTypes.func, onSearch: PropsTypes.func, onTreeExpand: PropsTypes.func, "onUpdate:treeExpandedKeys": PropsTypes.func, "onUpdate:searchValue": PropsTypes.func, "onUpdate:value": PropsTypes.func }); }; var CaretDownOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" } }] }, "name": "caret-down", "theme": "outlined" }; var CaretDownOutlinedSvg = CaretDownOutlined$2; function _objectSpread$l(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$l(target, key2, source2[key2]); }); } return target; } function _defineProperty$l(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CaretDownOutlined = function CaretDownOutlined2(props2, context2) { var p = _objectSpread$l({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$l({}, p, { "icon": CaretDownOutlinedSvg }), null); }; CaretDownOutlined.displayName = "CaretDownOutlined"; CaretDownOutlined.inheritAttrs = false; var CaretDownOutlined$1 = CaretDownOutlined; var __rest$2 = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; function convertChildrenToData(nodes2) { return flattenChildren(nodes2).map(function(node) { if (!isValidElement(node) || !node.type) { return null; } var _a3 = node.children || {}, d2 = _a3.default, restSlot = __rest$2(_a3, ["default"]); var children = d2 ? d2() : []; var key2 = node.key, _b2 = node.props, value24 = _b2.value, restProps = __rest$2(_b2, ["value"]); var data65 = _extends$1({ key: key2, value: value24 }, restProps); Object.keys(restSlot).forEach(function(p) { if (typeof restSlot[p] === "function") { data65[p] = createVNode(Fragment, null, [restSlot[p]()]); } }); var childData = convertChildrenToData(children); if (childData.length) { data65.children = childData; } return data65; }).filter(function(data65) { return data65; }); } var __rest$1 = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var TreeSelect = defineComponent({ TreeNode, SHOW_ALL, SHOW_PARENT, SHOW_CHILD, name: "ATreeSelect", inheritAttrs: false, props: initDefaultProps$1(TreeSelectProps(), { transitionName: "slide-up", choiceTransitionName: "" }), setup: function setup120() { return { vcTreeSelect: null, configProvider: inject("configProvider", defaultConfigProvider) }; }, created: function created23() { warning$5(this.multiple !== false || !this.treeCheckable, "TreeSelect", "`multiple` will alway be `true` when `treeCheckable` is true"); }, methods: { saveTreeSelect: function saveTreeSelect(node) { this.vcTreeSelect = node; }, focus: function focus24() { this.vcTreeSelect.focus(); }, blur: function blur21() { this.vcTreeSelect.blur(); }, renderSwitcherIcon: function renderSwitcherIcon2(prefixCls2, _ref) { var isLeaf = _ref.isLeaf, loading = _ref.loading; if (loading) { return createVNode(LoadingOutlined$3, { "class": "".concat(prefixCls2, "-switcher-loading-icon") }, null); } if (isLeaf) { return null; } return createVNode(CaretDownOutlined$1, { "class": "".concat(prefixCls2, "-switcher-icon") }, null); }, handleChange: function handleChange15() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } this.$emit("update:value", args[0]); this.$emit.apply(this, ["change"].concat(args)); }, handleTreeExpand: function handleTreeExpand() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } this.$emit("update:treeExpandedKeys", args[0]); this.$emit.apply(this, ["treeExpand"].concat(args)); }, handleSearch: function handleSearch2() { for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } this.$emit("update:searchValue", args[0]); this.$emit.apply(this, ["search"].concat(args)); }, updateTreeData: function updateTreeData2(treeData) { var _this = this; var $slots = this.$slots; var defaultFields = { children: "children", title: "title", key: "key", label: "label", value: "value" }; var replaceFields = _extends$1(_extends$1({}, defaultFields), this.$props.replaceFields); return treeData.map(function(item) { var _item$slots = item.slots, slots = _item$slots === void 0 ? {} : _item$slots; var label = item[replaceFields.label]; var title = item[replaceFields.title]; var value24 = item[replaceFields.value]; var key2 = item[replaceFields.key]; var children = item[replaceFields.children]; var newLabel = typeof label === "function" ? label() : label; var newTitle = typeof title === "function" ? title() : title; if (!newLabel && slots.label && $slots[slots.label]) { newLabel = createVNode(Fragment, null, [$slots[slots.label](item)]); } if (!newTitle && slots.title && $slots[slots.title]) { newTitle = createVNode(Fragment, null, [$slots[slots.title](item)]); } var treeNodeProps = _extends$1(_extends$1({}, item), { title: newTitle || newLabel, value: value24, dataRef: item, key: key2 }); if (children) { return _extends$1(_extends$1({}, treeNodeProps), { children: _this.updateTreeData(children) }); } return treeNodeProps; }); } }, render: function render115() { var _cls, _this2 = this; var props2 = getOptionProps(this); var customizePrefixCls = props2.prefixCls, size = props2.size, dropdownStyle = props2.dropdownStyle, dropdownClassName = props2.dropdownClassName, getPopupContainer2 = props2.getPopupContainer, restProps = __rest$1(props2, ["prefixCls", "size", "dropdownStyle", "dropdownClassName", "getPopupContainer"]); var className = this.$attrs.class; var _this$configProvider = this.configProvider, renderEmpty2 = _this$configProvider.renderEmpty, getPrefixCls2 = _this$configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("select", customizePrefixCls); var notFoundContent = getComponent(this, "notFoundContent"); var removeIcon = getComponent(this, "removeIcon"); var clearIcon = getComponent(this, "clearIcon"); var getContextPopupContainer = this.configProvider.getPopupContainer; var rest = omit(restProps, ["inputIcon", "removeIcon", "clearIcon", "switcherIcon", "suffixIcon"]); var suffixIcon = getComponent(this, "suffixIcon"); suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon; var treeData = props2.treeData; if (treeData) { treeData = this.updateTreeData(treeData); } var cls = (_cls = {}, _defineProperty$12(_cls, "".concat(prefixCls2, "-lg"), size === "large"), _defineProperty$12(_cls, "".concat(prefixCls2, "-sm"), size === "small"), _defineProperty$12(_cls, className, className), _cls); var showSearch = restProps.showSearch; if (!("showSearch" in restProps)) { showSearch = !!(restProps.multiple || restProps.treeCheckable); } var checkable = getComponent(this, "treeCheckable"); if (checkable) { checkable = createVNode("span", { "class": "".concat(prefixCls2, "-tree-checkbox-inner") }, null); } var inputIcon = suffixIcon || createVNode(DownOutlined$1, { "class": "".concat(prefixCls2, "-arrow-icon") }, null); var finalRemoveIcon = removeIcon || createVNode(CloseOutlined$3, { "class": "".concat(prefixCls2, "-remove-icon") }, null); var finalClearIcon = clearIcon || createVNode(CloseCircleFilled$3, { "class": "".concat(prefixCls2, "-clear-icon") }, null); var VcTreeSelectProps = _extends$1(_extends$1(_extends$1(_extends$1({}, this.$attrs), { switcherIcon: function switcherIcon(nodeProps) { return _this2.renderSwitcherIcon(prefixCls2, nodeProps); }, inputIcon, removeIcon: finalRemoveIcon, clearIcon: finalClearIcon }), rest), { showSearch, getPopupContainer: getPopupContainer2 || getContextPopupContainer, dropdownClassName: classNames(dropdownClassName, "".concat(prefixCls2, "-tree-dropdown")), prefixCls: prefixCls2, dropdownStyle: _extends$1({ maxHeight: "100vh", overflow: "auto" }, dropdownStyle), treeCheckable: checkable, notFoundContent: notFoundContent || renderEmpty2("Select"), class: cls, onChange: this.handleChange, onSearch: this.handleSearch, onTreeExpand: this.handleTreeExpand, ref: this.saveTreeSelect, treeData: treeData ? treeData : convertChildrenToData(getSlot$1(this)) }); return createVNode(Select$1, _objectSpread2$2(_objectSpread2$2({}, VcTreeSelectProps), {}, { "__propsSymbol__": [] }), omit(this.$slots, ["default"])); } }); TreeSelect.install = function(app) { app.component(TreeSelect.name, TreeSelect); app.component(TreeSelect.TreeNode.displayName, TreeSelect.TreeNode); return app; }; TreeSelect.TreeNode; var TreeSelect$1 = TreeSelect; function getError(option, xhr2) { var msg = "cannot ".concat(option.method, " ").concat(option.action, " ").concat(xhr2.status, "'"); var err = new Error(msg); err.status = xhr2.status; err.method = option.method; err.url = option.action; return err; } function getBody(xhr2) { var text = xhr2.responseText || xhr2.response; if (!text) { return text; } try { return JSON.parse(text); } catch (e2) { return text; } } function upload(option) { var xhr2 = new window.XMLHttpRequest(); if (option.onProgress && xhr2.upload) { xhr2.upload.onprogress = function progress(e2) { if (e2.total > 0) { e2.percent = e2.loaded / e2.total * 100; } option.onProgress(e2); }; } var formData = new window.FormData(); if (option.data) { Object.keys(option.data).forEach(function(key2) { var value24 = option.data[key2]; if (Array.isArray(value24)) { value24.forEach(function(item) { formData.append("".concat(key2, "[]"), item); }); return; } formData.append(key2, option.data[key2]); }); } formData.append(option.filename, option.file); xhr2.onerror = function error3(e2) { option.onError(e2); }; xhr2.onload = function onload() { if (xhr2.status < 200 || xhr2.status >= 300) { return option.onError(getError(option, xhr2), getBody(xhr2)); } option.onSuccess(getBody(xhr2), xhr2); }; xhr2.open(option.method, option.action, true); if (option.withCredentials && "withCredentials" in xhr2) { xhr2.withCredentials = true; } var headers = option.headers || {}; if (headers["X-Requested-With"] !== null) { xhr2.setRequestHeader("X-Requested-With", "XMLHttpRequest"); } for (var h2 in headers) { if (headers.hasOwnProperty(h2) && headers[h2] !== null) { xhr2.setRequestHeader(h2, headers[h2]); } } xhr2.send(formData); return { abort: function abort4() { xhr2.abort(); } }; } var now = +new Date(); var index$F = 0; function uid() { return "vc-upload-".concat(now, "-").concat(++index$F); } function endsWith(str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; } var attrAccept = function(file, acceptedFiles) { if (file && acceptedFiles) { var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(","); var fileName = file.name || ""; var mimeType = file.type || ""; var baseMimeType = mimeType.replace(/\/.*$/, ""); return acceptedFilesArray.some(function(type2) { var validType = type2.trim(); if (validType.charAt(0) === ".") { return endsWith(fileName.toLowerCase(), validType.toLowerCase()); } else if (/\/\*$/.test(validType)) { return baseMimeType === validType.replace(/\/.*$/, ""); } return mimeType === validType; }); } return true; }; function loopFiles(item, callback2) { var dirReader = item.createReader(); var fileList2 = []; function sequence() { dirReader.readEntries(function(entries2) { var entryList = Array.prototype.slice.apply(entries2); fileList2 = fileList2.concat(entryList); var isFinished = !entryList.length; if (isFinished) { callback2(fileList2); } else { sequence(); } }); } sequence(); } var traverseFileTree = function traverseFileTree2(files, callback2, isAccepted) { var _traverseFileTree = function _traverseFileTree2(item, path2) { path2 = path2 || ""; if (item.isFile) { item.file(function(file2) { if (isAccepted(file2)) { if (item.fullPath && !file2.webkitRelativePath) { Object.defineProperties(file2, { webkitRelativePath: { writable: true } }); file2.webkitRelativePath = item.fullPath.replace(/^\//, ""); Object.defineProperties(file2, { webkitRelativePath: { writable: false } }); } callback2([file2]); } }); } else if (item.isDirectory) { loopFiles(item, function(entries2) { entries2.forEach(function(entryItem) { _traverseFileTree2(entryItem, "".concat(path2).concat(item.name, "/")); }); }); } }; var _iterator = _createForOfIteratorHelper(files), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done; ) { var file = _step.value; _traverseFileTree(file.webkitGetAsEntry()); } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } }; var traverseFileTree$1 = traverseFileTree; var upLoadPropTypes = { componentTag: PropsTypes.string, prefixCls: PropsTypes.string, name: PropsTypes.string, multiple: PropsTypes.looseBool, directory: PropsTypes.looseBool, disabled: PropsTypes.looseBool, accept: PropsTypes.string, data: PropsTypes.oneOfType([PropsTypes.object, PropsTypes.func]), action: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.func]), headers: PropsTypes.object, beforeUpload: PropsTypes.func, customRequest: PropsTypes.func, withCredentials: PropsTypes.looseBool, openFileDialogOnClick: PropsTypes.looseBool, transformFile: PropsTypes.func, method: PropsTypes.string }; var AjaxUploader = { inheritAttrs: false, name: "ajaxUploader", mixins: [BaseMixin], props: upLoadPropTypes, data: function data61() { this.reqs = {}; return { uid: uid() }; }, mounted: function mounted33() { this._isMounted = true; }, beforeUnmount: function beforeUnmount21() { this._isMounted = false; this.abort(); }, methods: { onChange: function onChange6(e2) { var files = e2.target.files; this.uploadFiles(files); this.reset(); }, onClick: function onClick6() { var el = this.$refs.fileInputRef; if (!el) { return; } el.click(); }, onKeyDown: function onKeyDown10(e2) { if (e2.key === "Enter") { this.onClick(); } }, onFileDrop: function onFileDrop(e2) { var _this = this; var multiple = this.$props.multiple; e2.preventDefault(); if (e2.type === "dragover") { return; } if (this.directory) { traverseFileTree$1(e2.dataTransfer.items, this.uploadFiles, function(_file) { return attrAccept(_file, _this.accept); }); } else { var files = partition$1(Array.prototype.slice.call(e2.dataTransfer.files), function(file) { return attrAccept(file, _this.accept); }); var successFiles = files[0]; var errorFiles = files[1]; if (multiple === false) { successFiles = successFiles.slice(0, 1); } this.uploadFiles(successFiles); if (errorFiles.length) { this.__emit("reject", errorFiles); } } }, uploadFiles: function uploadFiles(files) { var _this2 = this; var postFiles = Array.prototype.slice.call(files); postFiles.map(function(file) { file.uid = uid(); return file; }).forEach(function(file) { _this2.upload(file, postFiles); }); }, upload: function upload2(file, fileList2) { var _this3 = this; if (!this.beforeUpload) { return setTimeout(function() { return _this3.post(file); }, 0); } var before = this.beforeUpload(file, fileList2); if (before && before.then) { before.then(function(processedFile) { var processedFileType = Object.prototype.toString.call(processedFile); if (processedFileType === "[object File]" || processedFileType === "[object Blob]") { return _this3.post(processedFile); } return _this3.post(file); }).catch(function(e2) { console && console.log(e2); }); } else if (before !== false) { setTimeout(function() { return _this3.post(file); }, 0); } }, post: function post(file) { var _this4 = this; if (!this._isMounted) { return; } var props2 = this.$props; var data65 = props2.data; var _props$transformFile = props2.transformFile, transformFile = _props$transformFile === void 0 ? function(originFile) { return originFile; } : _props$transformFile; new Promise(function(resolve) { var action = _this4.action; if (typeof action === "function") { return resolve(action(file)); } resolve(action); }).then(function(action) { var uid2 = file.uid; var request2 = _this4.customRequest || upload; var transform2 = Promise.resolve(transformFile(file)).catch(function(e2) { console.error(e2); }); transform2.then(function(transformedFile) { if (typeof data65 === "function") { data65 = data65(file); } var requestOption = { action, filename: _this4.name, data: data65, file: transformedFile, headers: _this4.headers, withCredentials: _this4.withCredentials, method: props2.method || "post", onProgress: function onProgress2(e2) { _this4.__emit("progress", e2, file); }, onSuccess: function onSuccess2(ret, xhr2) { delete _this4.reqs[uid2]; _this4.__emit("success", ret, file, xhr2); }, onError: function onError2(err, ret) { delete _this4.reqs[uid2]; _this4.__emit("error", err, ret, file); } }; _this4.reqs[uid2] = request2(requestOption); _this4.__emit("start", file); }); }); }, reset: function reset() { this.setState({ uid: uid() }); }, abort: function abort(file) { var reqs = this.reqs; if (file) { var uid2 = file; if (file && file.uid) { uid2 = file.uid; } if (reqs[uid2] && reqs[uid2].abort) { reqs[uid2].abort(); } delete reqs[uid2]; } else { Object.keys(reqs).forEach(function(uid3) { if (reqs[uid3] && reqs[uid3].abort) { reqs[uid3].abort(); } delete reqs[uid3]; }); } } }, render: function render116() { var _classNames, _this5 = this; var $props = this.$props, $attrs = this.$attrs; var Tag2 = $props.componentTag, prefixCls2 = $props.prefixCls, disabled = $props.disabled, multiple = $props.multiple, accept = $props.accept, directory = $props.directory, openFileDialogOnClick = $props.openFileDialogOnClick; var className = $attrs.class, style = $attrs.style, id2 = $attrs.id; var cls = classNames((_classNames = {}, _defineProperty$12(_classNames, prefixCls2, true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-disabled"), disabled), _defineProperty$12(_classNames, className, className), _classNames)); var events = disabled ? {} : { onClick: openFileDialogOnClick ? this.onClick : function() { }, onKeydown: openFileDialogOnClick ? this.onKeyDown : function() { }, onDrop: this.onFileDrop, onDragover: this.onFileDrop }; var tagProps2 = _extends$1(_extends$1({}, events), { role: "button", tabindex: disabled ? null : "0", class: cls, style }); return createVNode(Tag2, tagProps2, { default: function _default8() { return [createVNode("input", { "id": id2, "type": "file", "ref": "fileInputRef", "onClick": function onClick7(e2) { return e2.stopPropagation(); }, "key": _this5.uid, "style": { display: "none" }, "accept": accept, "directory": directory ? "directory" : null, "webkitdirectory": directory ? "webkitdirectory" : null, "multiple": multiple, "onChange": _this5.onChange }, null), getSlot$1(_this5)]; } }); } }; var AjaxUpload = AjaxUploader; var IFRAME_STYLE = { position: "absolute", top: 0, opacity: 0, filter: "alpha(opacity=0)", left: 0, zIndex: 9999 }; var IframeUploader = { name: "IframeUploader", mixins: [BaseMixin], props: { componentTag: PropsTypes.string, disabled: PropsTypes.looseBool, prefixCls: PropsTypes.string, accept: PropsTypes.string, multiple: PropsTypes.looseBool, data: PropsTypes.oneOfType([PropsTypes.object, PropsTypes.func]), action: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.func]), name: PropsTypes.string }, data: function data62() { this.file = {}; return { uploading: false }; }, methods: { onLoad: function onLoad2() { if (!this.uploading) { return; } var file = this.file; var response; try { var doc = this.getIframeDocument(); var script = doc.getElementsByTagName("script")[0]; if (script && script.parentNode === doc.body) { doc.body.removeChild(script); } response = doc.body.innerHTML; this.__emit("success", response, file); } catch (err) { warning$5(false, "cross domain error for Upload. Maybe server should return document.domain script. see Note from https://github.com/react-component/upload"); response = "cross-domain"; this.__emit("error", err, null, file); } this.endUpload(); }, onChange: function onChange7() { var _this = this; var target = this.getFormInputNode(); var file = this.file = { uid: uid(), name: target.value && target.value.substring(target.value.lastIndexOf("\\") + 1, target.value.length) }; this.startUpload(); var props2 = this.$props; if (!props2.beforeUpload) { return this.post(file); } var before = props2.beforeUpload(file); if (before && before.then) { before.then(function() { _this.post(file); }, function() { _this.endUpload(); }); } else if (before !== false) { this.post(file); } else { this.endUpload(); } }, getIframeNode: function getIframeNode() { return this.$refs.iframeRef; }, getIframeDocument: function getIframeDocument() { return this.getIframeNode().contentDocument; }, getFormNode: function getFormNode() { return this.getIframeDocument().getElementById("form"); }, getFormInputNode: function getFormInputNode() { return this.getIframeDocument().getElementById("input"); }, getFormDataNode: function getFormDataNode() { return this.getIframeDocument().getElementById("data"); }, getFileForMultiple: function getFileForMultiple(file) { return this.multiple ? [file] : file; }, getIframeHTML: function getIframeHTML(domain) { var domainScript = ""; var domainInput = ""; if (domain) { var script = "script"; domainScript = "<".concat(script, '>document.domain="').concat(domain, '";"); domainInput = ''); } return '\n \n \n \n \n \n '.concat(domainScript, '\n \n \n
\n \n ').concat(domainInput, '\n \n
\n \n \n '); }, initIframeSrc: function initIframeSrc() { if (this.domain) { this.getIframeNode().src = "javascript:void((function(){\n var d = document;\n d.open();\n d.domain='".concat(this.domain, "';\n d.write('');\n d.close();\n })())"); } }, initIframe: function initIframe() { var iframeNode = this.getIframeNode(); var win = iframeNode.contentWindow; var doc; this.domain = this.domain || ""; this.initIframeSrc(); try { doc = win.document; } catch (e2) { this.domain = document.domain; this.initIframeSrc(); win = iframeNode.contentWindow; doc = win.document; } doc.open("text/html", "replace"); doc.write(this.getIframeHTML(this.domain)); doc.close(); this.getFormInputNode().onchange = this.onChange; }, endUpload: function endUpload() { if (this.uploading) { this.file = {}; this.uploading = false; this.setState({ uploading: false }); this.initIframe(); } }, startUpload: function startUpload() { if (!this.uploading) { this.uploading = true; this.setState({ uploading: true }); } }, updateIframeWH: function updateIframeWH() { var rootNode = findDOMNode(this); var iframeNode = this.getIframeNode(); iframeNode.style.height = "".concat(rootNode.offsetHeight, "px"); iframeNode.style.width = "".concat(rootNode.offsetWidth, "px"); }, abort: function abort2(file) { if (file) { var uid2 = file; if (file && file.uid) { uid2 = file.uid; } if (uid2 === this.file.uid) { this.endUpload(); } } else { this.endUpload(); } }, post: function post2(file) { var _this2 = this; var formNode = this.getFormNode(); var dataSpan = this.getFormDataNode(); var data65 = this.$props.data; if (typeof data65 === "function") { data65 = data65(file); } var inputs = document.createDocumentFragment(); for (var key2 in data65) { if (data65.hasOwnProperty(key2)) { var input = document.createElement("input"); input.setAttribute("name", key2); input.value = data65[key2]; inputs.appendChild(input); } } dataSpan.appendChild(inputs); new Promise(function(resolve) { var action = _this2.action; if (typeof action === "function") { return resolve(action(file)); } resolve(action); }).then(function(action) { formNode.setAttribute("action", action); formNode.submit(); dataSpan.innerHTML = ""; _this2.__emit("start", file); }); } }, mounted: function mounted34() { var _this3 = this; this.$nextTick(function() { _this3.updateIframeWH(); _this3.initIframe(); }); }, updated: function updated20() { var _this4 = this; this.$nextTick(function() { _this4.updateIframeWH(); }); }, render: function render117() { var _classNames, _this5 = this; var _this$$props = this.$props, Tag2 = _this$$props.componentTag, disabled = _this$$props.disabled, prefixCls2 = _this$$props.prefixCls; var _this$$attrs = this.$attrs, className = _this$$attrs.class, style = _this$$attrs.style; var iframeStyle = _extends$1(_extends$1({}, IFRAME_STYLE), { display: this.uploading || disabled ? "none" : "" }); var cls = classNames((_classNames = {}, _defineProperty$12(_classNames, prefixCls2, true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-disabled"), disabled), _defineProperty$12(_classNames, className, className), _classNames)); return createVNode(Tag2, { "class": cls, "style": _extends$1({ position: "relative", zIndex: 0 }, style) }, { default: function _default8() { return [createVNode("iframe", { "ref": "iframeRef", "onLoad": _this5.onLoad, "style": iframeStyle }, null), getSlot$1(_this5)]; } }); } }; var IframeUpload = IframeUploader; function empty() { } var uploadProps = { componentTag: PropsTypes.string, prefixCls: PropsTypes.string, action: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.func]), name: PropsTypes.string, multipart: PropsTypes.looseBool, directory: PropsTypes.looseBool, onError: PropsTypes.func, onSuccess: PropsTypes.func, onProgress: PropsTypes.func, onStart: PropsTypes.func, data: PropsTypes.oneOfType([PropsTypes.object, PropsTypes.func]), headers: PropsTypes.object, accept: PropsTypes.string, multiple: PropsTypes.looseBool, disabled: PropsTypes.looseBool, beforeUpload: PropsTypes.func, customRequest: PropsTypes.func, onReady: PropsTypes.func, withCredentials: PropsTypes.looseBool, supportServerRender: PropsTypes.looseBool, openFileDialogOnClick: PropsTypes.looseBool, method: PropsTypes.string }; var Upload$1 = defineComponent({ name: "Upload", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps$2(uploadProps, { componentTag: "span", prefixCls: "rc-upload", data: {}, headers: {}, name: "file", multipart: false, onReady: empty, onStart: empty, onError: empty, onSuccess: empty, supportServerRender: false, multiple: false, beforeUpload: empty, withCredentials: false, openFileDialogOnClick: true }), data: function data63() { this.Component = null; return {}; }, mounted: function mounted35() { var _this = this; this.$nextTick(function() { if (_this.supportServerRender) { _this.Component = _this.getComponent(); _this.$forceUpdate(); nextTick(function() { _this.__emit("ready"); }); } }); }, methods: { getComponent: function getComponent3() { return typeof File !== "undefined" ? AjaxUpload : IframeUpload; }, abort: function abort3(file) { this.$refs.uploaderRef.abort(file); } }, render: function render118() { var _this2 = this; var componentProps2 = _extends$1(_extends$1(_extends$1({}, this.$props), { ref: "uploaderRef" }), this.$attrs); if (this.supportServerRender) { var _ComponentUploader = this.Component; if (_ComponentUploader) { return createVNode(_ComponentUploader, componentProps2, { default: function _default8() { return [getSlot$1(_this2)]; } }); } return null; } var ComponentUploader = this.getComponent(); return createVNode(ComponentUploader, componentProps2, { default: function _default8() { return [getSlot$1(_this2)]; } }); } }); PropsTypes.oneOf(tuple("error", "success", "done", "uploading", "removed")); function UploadFile(_ref) { var uid2 = _ref.uid, name = _ref.name; if (!uid2 && uid2 !== 0) return false; if (!["string", "number"].includes(_typeof$2(uid2))) return false; if (name === "" || typeof name !== "string") return false; return true; } ({ file: PropsTypes.custom(UploadFile), fileList: PropsTypes.arrayOf(PropsTypes.custom(UploadFile)), event: PropsTypes.object }); var ShowUploadListInterface = PropsTypes.shape({ showRemoveIcon: PropsTypes.looseBool, showPreviewIcon: PropsTypes.looseBool }).loose; var UploadLocale = PropsTypes.shape({ uploading: PropsTypes.string, removeFile: PropsTypes.string, downloadFile: PropsTypes.string, uploadError: PropsTypes.string, previewFile: PropsTypes.string }).loose; var UploadProps = { type: PropsTypes.oneOf(tuple("drag", "select")), name: PropsTypes.string, defaultFileList: PropsTypes.arrayOf(PropsTypes.custom(UploadFile)), fileList: PropsTypes.arrayOf(PropsTypes.custom(UploadFile)), action: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.func]), directory: PropsTypes.looseBool, data: PropsTypes.oneOfType([PropsTypes.object, PropsTypes.func]), method: PropsTypes.oneOf(tuple("POST", "PUT", "PATCH", "post", "put", "patch")), headers: PropsTypes.object, showUploadList: PropsTypes.oneOfType([PropsTypes.looseBool, ShowUploadListInterface]), multiple: PropsTypes.looseBool, accept: PropsTypes.string, beforeUpload: PropsTypes.func, listType: PropsTypes.oneOf(tuple("text", "picture", "picture-card")), remove: PropsTypes.func, supportServerRender: PropsTypes.looseBool, disabled: PropsTypes.looseBool, prefixCls: PropsTypes.string, customRequest: PropsTypes.func, withCredentials: PropsTypes.looseBool, openFileDialogOnClick: PropsTypes.looseBool, locale: UploadLocale, height: PropsTypes.number, id: PropsTypes.string, previewFile: PropsTypes.func, transformFile: PropsTypes.func, onChange: PropsTypes.func, onPreview: PropsTypes.func, onRemove: PropsTypes.func, onDownload: PropsTypes.func, "onUpdate:fileList": PropsTypes.func }; ({ fileList: PropsTypes.arrayOf(PropsTypes.custom(UploadFile)), dragState: PropsTypes.string }); var UploadListProps = { listType: PropsTypes.oneOf(tuple("text", "picture", "picture-card")), items: PropsTypes.arrayOf(PropsTypes.custom(UploadFile)), progressAttr: PropsTypes.object, prefixCls: PropsTypes.string, showRemoveIcon: PropsTypes.looseBool, showDownloadIcon: PropsTypes.looseBool, showPreviewIcon: PropsTypes.looseBool, locale: UploadLocale, previewFile: PropsTypes.func, onPreview: PropsTypes.func, onRemove: PropsTypes.func, onDownload: PropsTypes.func }; var __rest = globalThis && globalThis.__rest || function(s2, e2) { var t2 = {}; for (var p in s2) { if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; } if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; }; var Dragger = defineComponent({ name: "AUploadDragger", inheritAttrs: false, props: UploadProps, render: function render119() { var _this = this; var props2 = getOptionProps(this); var height = props2.height, restProps = __rest(props2, ["height"]); var _a3 = this.$attrs, style = _a3.style, restAttrs = __rest(_a3, ["style"]); var draggerProps = _extends$1(_extends$1(_extends$1({}, restProps), restAttrs), { type: "drag", style: _extends$1(_extends$1({}, style), { height }) }); return createVNode(Upload, draggerProps, { default: function _default8() { return [getSlot$1(_this)]; } }); } }); function T() { return true; } function fileToObject(file) { return _extends$1(_extends$1({}, file), { lastModified: file.lastModified, lastModifiedDate: file.lastModifiedDate, name: file.name, size: file.size, type: file.type, uid: file.uid, percent: 0, originFileObj: file }); } function genPercentAdd() { var k2 = 0.1; var i2 = 0.01; var end = 0.98; return function(s2) { var start = s2; if (start >= end) { return start; } start += k2; k2 = k2 - i2; if (k2 < 1e-3) { k2 = 1e-3; } return start; }; } function getFileItem(file, fileList2) { var matchKey = file.uid !== void 0 ? "uid" : "name"; return fileList2.filter(function(item) { return item[matchKey] === file[matchKey]; })[0]; } function removeFileItem(file, fileList2) { var matchKey = file.uid !== void 0 ? "uid" : "name"; var removed = fileList2.filter(function(item) { return item[matchKey] !== file[matchKey]; }); if (removed.length === fileList2.length) { return null; } return removed; } var extname = function extname2() { var url2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; var temp = url2.split("/"); var filename = temp[temp.length - 1]; var filenameWithoutSuffix = filename.split(/#|\?/)[0]; return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [""])[0]; }; var isImageFileType = function isImageFileType2(type2) { return !!type2 && type2.indexOf("image/") === 0; }; var isImageUrl = function isImageUrl2(file) { if (isImageFileType(file.type)) { return true; } var url2 = file.thumbUrl || file.url; var extension = extname(url2); if (/^data:image\//.test(url2) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(extension)) { return true; } if (/^data:/.test(url2)) { return false; } if (extension) { return false; } return true; }; var MEASURE_SIZE = 200; function previewImage(file) { return new Promise(function(resolve) { if (!isImageFileType(file.type)) { resolve(""); return; } var canvas = document.createElement("canvas"); canvas.width = MEASURE_SIZE; canvas.height = MEASURE_SIZE; canvas.style.cssText = "position: fixed; left: 0; top: 0; width: ".concat(MEASURE_SIZE, "px; height: ").concat(MEASURE_SIZE, "px; z-index: 9999; display: none;"); document.body.appendChild(canvas); var ctx = canvas.getContext("2d"); var img = new Image(); img.onload = function() { var width = img.width, height = img.height; var drawWidth = MEASURE_SIZE; var drawHeight = MEASURE_SIZE; var offsetX = 0; var offsetY = 0; if (width < height) { drawHeight = height * (MEASURE_SIZE / width); offsetY = -(drawHeight - drawWidth) / 2; } else { drawWidth = width * (MEASURE_SIZE / height); offsetX = -(drawWidth - drawHeight) / 2; } ctx.drawImage(img, offsetX, offsetY, drawWidth, drawHeight); var dataURL = canvas.toDataURL(); document.body.removeChild(canvas); resolve(dataURL); }; img.src = window.URL.createObjectURL(file); }); } var PaperClipOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z" } }] }, "name": "paper-clip", "theme": "outlined" }; var PaperClipOutlinedSvg = PaperClipOutlined$2; function _objectSpread$k(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$k(target, key2, source2[key2]); }); } return target; } function _defineProperty$k(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var PaperClipOutlined = function PaperClipOutlined2(props2, context2) { var p = _objectSpread$k({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$k({}, p, { "icon": PaperClipOutlinedSvg }), null); }; PaperClipOutlined.displayName = "PaperClipOutlined"; PaperClipOutlined.inheritAttrs = false; var PaperClipOutlined$1 = PaperClipOutlined; var PictureTwoTone$2 = { "icon": function render120(primaryColor, secondaryColor) { return { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z", "fill": primaryColor } }, { "tag": "path", "attrs": { "d": "M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M276 368a28 28 0 1056 0 28 28 0 10-56 0z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z", "fill": primaryColor } }] }; }, "name": "picture", "theme": "twotone" }; var PictureTwoToneSvg = PictureTwoTone$2; function _objectSpread$j(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$j(target, key2, source2[key2]); }); } return target; } function _defineProperty$j(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var PictureTwoTone = function PictureTwoTone2(props2, context2) { var p = _objectSpread$j({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$j({}, p, { "icon": PictureTwoToneSvg }), null); }; PictureTwoTone.displayName = "PictureTwoTone"; PictureTwoTone.inheritAttrs = false; var PictureTwoTone$1 = PictureTwoTone; var DeleteOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, "name": "delete", "theme": "outlined" }; var DeleteOutlinedSvg = DeleteOutlined$2; function _objectSpread$i(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$i(target, key2, source2[key2]); }); } return target; } function _defineProperty$i(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var DeleteOutlined = function DeleteOutlined2(props2, context2) { var p = _objectSpread$i({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$i({}, p, { "icon": DeleteOutlinedSvg }), null); }; DeleteOutlined.displayName = "DeleteOutlined"; DeleteOutlined.inheritAttrs = false; var DeleteOutlined$1 = DeleteOutlined; var DownloadOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "download", "theme": "outlined" }; var DownloadOutlinedSvg = DownloadOutlined$2; function _objectSpread$h(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$h(target, key2, source2[key2]); }); } return target; } function _defineProperty$h(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var DownloadOutlined = function DownloadOutlined2(props2, context2) { var p = _objectSpread$h({}, props2, context2.attrs); return createVNode(AntdIcon$1, _objectSpread$h({}, p, { "icon": DownloadOutlinedSvg }), null); }; DownloadOutlined.displayName = "DownloadOutlined"; DownloadOutlined.inheritAttrs = false; var DownloadOutlined$1 = DownloadOutlined; var UploadList = defineComponent({ name: "AUploadList", mixins: [BaseMixin], props: initDefaultProps$2(UploadListProps, { listType: "text", progressAttr: { strokeWidth: 2, showInfo: false }, showRemoveIcon: true, showDownloadIcon: false, showPreviewIcon: true, previewFile: previewImage }), setup: function setup121() { return { configProvider: inject("configProvider", defaultConfigProvider) }; }, updated: function updated21() { var _this = this; nextTick(function() { var _this$$props = _this.$props, listType = _this$$props.listType, items = _this$$props.items, previewFile = _this$$props.previewFile; if (listType !== "picture" && listType !== "picture-card") { return; } (items || []).forEach(function(file) { if (typeof document === "undefined" || typeof window === "undefined" || !window.FileReader || !window.File || !(file.originFileObj instanceof File || file.originFileObj instanceof Blob) || file.thumbUrl !== void 0) { return; } file.thumbUrl = ""; if (previewFile) { previewFile(file.originFileObj).then(function(previewDataUrl) { file.thumbUrl = previewDataUrl || ""; _this.$forceUpdate(); }); } }); }); }, methods: { handlePreview: function handlePreview(file, e2) { var onPreview = this.$props.onPreview; if (!onPreview) { return; } e2.preventDefault(); return this.$emit("preview", file); }, handleDownload: function handleDownload(file) { var onDownload = this.$props.onDownload; if (typeof onDownload === "function") { this.$emit("download", file); } else if (file.url) { window.open(file.url); } }, handleClose: function handleClose(file) { this.$emit("remove", file); } }, render: function render121() { var _this2 = this, _classNames4; var _getOptionProps = getOptionProps(this), customizePrefixCls = _getOptionProps.prefixCls, _getOptionProps$items = _getOptionProps.items, items = _getOptionProps$items === void 0 ? [] : _getOptionProps$items, listType = _getOptionProps.listType, showPreviewIcon = _getOptionProps.showPreviewIcon, showRemoveIcon = _getOptionProps.showRemoveIcon, showDownloadIcon = _getOptionProps.showDownloadIcon, locale2 = _getOptionProps.locale, progressAttr = _getOptionProps.progressAttr; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("upload", customizePrefixCls); var list = items.map(function(file) { var _classNames, _classNames2; var progress; var icon = file.status === "uploading" ? createVNode(LoadingOutlined$3, null, null) : createVNode(PaperClipOutlined$1, null, null); if (listType === "picture" || listType === "picture-card") { if (listType === "picture-card" && file.status === "uploading") { icon = createVNode("div", { "class": "".concat(prefixCls2, "-list-item-uploading-text") }, [locale2.uploading]); } else if (!file.thumbUrl && !file.url) { icon = createVNode(PictureTwoTone$1, { "class": "".concat(prefixCls2, "-list-item-thumbnail") }, null); } else { var thumbnail = isImageUrl(file) ? createVNode("img", { "src": file.thumbUrl || file.url, "alt": file.name, "class": "".concat(prefixCls2, "-list-item-image") }, null) : createVNode(FileTwoTone, { "class": "".concat(prefixCls2, "-list-item-icon") }, null); icon = createVNode("a", { "class": "".concat(prefixCls2, "-list-item-thumbnail"), "onClick": function onClick7(e2) { return _this2.handlePreview(file, e2); }, "href": file.url || file.thumbUrl, "target": "_blank", "rel": "noopener noreferrer" }, [thumbnail]); } } if (file.status === "uploading") { var progressProps = _extends$1(_extends$1({}, progressAttr), { type: "line", percent: file.percent }); var loadingProgress = "percent" in file ? createVNode(Progress, progressProps, null) : null; progress = createVNode("div", { "class": "".concat(prefixCls2, "-list-item-progress"), "key": "progress" }, [loadingProgress]); } var infoUploadingClass = classNames((_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-list-item"), true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-list-item-").concat(file.status), true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-list-item-list-type-").concat(listType), true), _classNames)); var linkProps = typeof file.linkProps === "string" ? JSON.parse(file.linkProps) : file.linkProps; var removeIcon = showRemoveIcon ? createVNode(DeleteOutlined$1, { "title": locale2.removeFile, "onClick": function onClick7() { return _this2.handleClose(file); } }, null) : null; var downloadIcon = showDownloadIcon && file.status === "done" ? createVNode(DownloadOutlined$1, { "title": locale2.downloadFile, "onClick": function onClick7() { return _this2.handleDownload(file); } }, null) : null; var downloadOrDelete = listType !== "picture-card" && createVNode("span", { "key": "download-delete", "class": "".concat(prefixCls2, "-list-item-card-actions ").concat(listType === "picture" ? "picture" : "") }, [downloadIcon && createVNode("a", { "title": locale2.downloadFile }, [downloadIcon]), removeIcon && createVNode("a", { "title": locale2.removeFile }, [removeIcon])]); var listItemNameClass = classNames((_classNames2 = {}, _defineProperty$12(_classNames2, "".concat(prefixCls2, "-list-item-name"), true), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-list-item-name-icon-count-").concat([downloadIcon, removeIcon].filter(function(x2) { return x2; }).length), true), _classNames2)); var preview = file.url ? [createVNode("a", _objectSpread2$2(_objectSpread2$2({ "target": "_blank", "rel": "noopener noreferrer", "class": listItemNameClass, "title": file.name }, linkProps), {}, { "href": file.url, "onClick": function onClick7(e2) { return _this2.handlePreview(file, e2); } }), [file.name]), downloadOrDelete] : [createVNode("span", { "key": "view", "class": "".concat(prefixCls2, "-list-item-name"), "onClick": function onClick7(e2) { return _this2.handlePreview(file, e2); }, "title": file.name }, [file.name]), downloadOrDelete]; var style = file.url || file.thumbUrl ? void 0 : { pointerEvents: "none", opacity: 0.5 }; var previewIcon = showPreviewIcon ? createVNode("a", { "href": file.url || file.thumbUrl, "target": "_blank", "rel": "noopener noreferrer", "style": style, "onClick": function onClick7(e2) { return _this2.handlePreview(file, e2); }, "title": locale2.previewFile }, [createVNode(EyeOutlined$1, null, null)]) : null; var actions = listType === "picture-card" && file.status !== "uploading" && createVNode("span", { "class": "".concat(prefixCls2, "-list-item-actions") }, [previewIcon, file.status === "done" && downloadIcon, removeIcon]); var message2; if (file.response && typeof file.response === "string") { message2 = file.response; } else { message2 = file.error && file.error.statusText || locale2.uploadError; } var iconAndPreview = createVNode("span", null, [icon, preview]); var transitionProps = getTransitionProps("fade"); var dom = createVNode("div", { "class": infoUploadingClass, "key": file.uid }, [createVNode("div", { "class": "".concat(prefixCls2, "-list-item-info") }, [iconAndPreview]), actions, createVNode(Transition, transitionProps, { default: function _default8() { return [progress]; } })]); var listContainerNameClass = classNames(_defineProperty$12({}, "".concat(prefixCls2, "-list-picture-card-container"), listType === "picture-card")); return createVNode("div", { "key": file.uid, "class": listContainerNameClass }, [file.status === "error" ? createVNode(Tooltip, { "title": message2 }, { default: function _default8() { return [dom]; } }) : createVNode("span", null, [dom])]); }); var listClassNames = classNames((_classNames4 = {}, _defineProperty$12(_classNames4, "".concat(prefixCls2, "-list"), true), _defineProperty$12(_classNames4, "".concat(prefixCls2, "-list-").concat(listType), true), _classNames4)); var animationDirection = listType === "picture-card" ? "animate-inline" : "animate"; var transitionGroupProps = _extends$1(_extends$1({}, getTransitionGroupProps("".concat(prefixCls2, "-").concat(animationDirection))), { class: listClassNames }); return createVNode(TransitionGroup, _objectSpread2$2(_objectSpread2$2({}, transitionGroupProps), {}, { "tag": "div" }), { default: function _default8() { return [list]; } }); } }); var Upload = defineComponent({ name: "AUpload", mixins: [BaseMixin], inheritAttrs: false, Dragger, props: initDefaultProps$1(UploadProps, { type: "select", multiple: false, action: "", data: {}, accept: "", beforeUpload: T, showUploadList: true, listType: "text", disabled: false, supportServerRender: true }), setup: function setup122() { return { upload: null, progressTimer: null, configProvider: inject("configProvider", defaultConfigProvider) }; }, data: function data64() { return { sFileList: this.fileList || this.defaultFileList || [], dragState: "drop" }; }, watch: { fileList: function fileList(val) { this.sFileList = val || []; } }, beforeUnmount: function beforeUnmount22() { this.clearProgressTimer(); }, methods: { onStart: function onStart3(file) { var targetItem = fileToObject(file); targetItem.status = "uploading"; var nextFileList = this.sFileList.concat(); var fileIndex = findIndex(nextFileList, function(_ref) { var uid2 = _ref.uid; return uid2 === targetItem.uid; }); if (fileIndex === -1) { nextFileList.push(targetItem); } else { nextFileList[fileIndex] = targetItem; } this.handleChange({ file: targetItem, fileList: nextFileList }); if (!window.File || (typeof process === "undefined" ? "undefined" : _typeof$2(process)) === "object" && {}.TEST_IE) { this.autoUpdateProgress(0, targetItem); } }, onSuccess: function onSuccess(response, file, xhr2) { this.clearProgressTimer(); try { if (typeof response === "string") { response = JSON.parse(response); } } catch (e2) { } var fileList2 = this.sFileList; var targetItem = getFileItem(file, fileList2); if (!targetItem) { return; } targetItem.status = "done"; targetItem.response = response; targetItem.xhr = xhr2; this.handleChange({ file: _extends$1({}, targetItem), fileList: fileList2 }); }, onProgress: function onProgress(e2, file) { var fileList2 = this.sFileList; var targetItem = getFileItem(file, fileList2); if (!targetItem) { return; } targetItem.percent = e2.percent; this.handleChange({ event: e2, file: _extends$1({}, targetItem), fileList: this.sFileList }); }, onError: function onError(error3, response, file) { this.clearProgressTimer(); var fileList2 = this.sFileList; var targetItem = getFileItem(file, fileList2); if (!targetItem) { return; } targetItem.error = error3; targetItem.response = response; targetItem.status = "error"; this.handleChange({ file: _extends$1({}, targetItem), fileList: fileList2 }); }, onReject: function onReject(fileList2) { this.$emit("reject", fileList2); }, handleRemove: function handleRemove(file) { var _this = this; var onRemove2 = this.remove; var fileList2 = this.$data.sFileList; Promise.resolve(typeof onRemove2 === "function" ? onRemove2(file) : onRemove2).then(function(ret) { if (ret === false) { return; } var removedFileList = removeFileItem(file, fileList2); if (removedFileList) { file.status = "removed"; if (_this.upload) { _this.upload.abort(file); } _this.handleChange({ file, fileList: removedFileList }); } }); }, handleManualRemove: function handleManualRemove(file) { if (this.$refs.uploadRef) { this.$refs.uploadRef.abort(file); } this.handleRemove(file); }, handleChange: function handleChange16(info3) { if (!hasProp(this, "fileList")) { this.setState({ sFileList: info3.fileList }); } this.$emit("update:fileList", info3.fileList); this.$emit("change", info3); }, onFileDrop: function onFileDrop2(e2) { this.setState({ dragState: e2.type }); }, reBeforeUpload: function reBeforeUpload(file, fileList2) { var beforeUpload = this.$props.beforeUpload; var stateFileList = this.$data.sFileList; if (!beforeUpload) { return true; } var result = beforeUpload(file, fileList2); if (result === false) { this.handleChange({ file, fileList: uniqBy(stateFileList.concat(fileList2.map(fileToObject)), function(item) { return item.uid; }) }); return false; } if (result && result.then) { return result; } return true; }, clearProgressTimer: function clearProgressTimer() { clearInterval(this.progressTimer); }, autoUpdateProgress: function autoUpdateProgress(_2, file) { var _this2 = this; var getPercent = genPercentAdd(); var curPercent = 0; this.clearProgressTimer(); this.progressTimer = setInterval(function() { curPercent = getPercent(curPercent); _this2.onProgress({ percent: curPercent * 100 }, file); }, 200); }, renderUploadList: function renderUploadList(locale2) { var _getOptionProps = getOptionProps(this), _getOptionProps$showU = _getOptionProps.showUploadList, showUploadList = _getOptionProps$showU === void 0 ? {} : _getOptionProps$showU, listType = _getOptionProps.listType, previewFile = _getOptionProps.previewFile, disabled = _getOptionProps.disabled, propLocale = _getOptionProps.locale; var showRemoveIcon = showUploadList.showRemoveIcon, showPreviewIcon = showUploadList.showPreviewIcon, showDownloadIcon = showUploadList.showDownloadIcon; var fileList2 = this.$data.sFileList; var _this$$props = this.$props, onDownload = _this$$props.onDownload, onPreview = _this$$props.onPreview; var uploadListProps = { listType, items: fileList2, previewFile, showRemoveIcon: !disabled && showRemoveIcon, showPreviewIcon, showDownloadIcon, locale: _extends$1(_extends$1({}, locale2), propLocale), onRemove: this.handleManualRemove, onDownload, onPreview }; return createVNode(UploadList, uploadListProps, null); } }, render: function render122() { var _classNames2; var _getOptionProps2 = getOptionProps(this), customizePrefixCls = _getOptionProps2.prefixCls, showUploadList = _getOptionProps2.showUploadList, listType = _getOptionProps2.listType, type2 = _getOptionProps2.type, disabled = _getOptionProps2.disabled; var _this$$data = this.$data, fileList2 = _this$$data.sFileList, dragState = _this$$data.dragState; var _this$$attrs = this.$attrs, className = _this$$attrs.class, style = _this$$attrs.style; var getPrefixCls2 = this.configProvider.getPrefixCls; var prefixCls2 = getPrefixCls2("upload", customizePrefixCls); var vcUploadProps = _extends$1(_extends$1({}, this.$props), { prefixCls: prefixCls2, beforeUpload: this.reBeforeUpload, onStart: this.onStart, onError: this.onError, onProgress: this.onProgress, onSuccess: this.onSuccess, onReject: this.onReject, ref: "uploadRef" }); var uploadList = showUploadList ? createVNode(LocaleReceiver, { "componentName": "Upload", "defaultLocale": defaultLocale.Upload, "children": this.renderUploadList }, null) : null; var children = getSlot$1(this); if (type2 === "drag") { var _classNames; var dragCls = classNames(prefixCls2, (_classNames = {}, _defineProperty$12(_classNames, "".concat(prefixCls2, "-drag"), true), _defineProperty$12(_classNames, "".concat(prefixCls2, "-drag-uploading"), fileList2.some(function(file) { return file.status === "uploading"; })), _defineProperty$12(_classNames, "".concat(prefixCls2, "-drag-hover"), dragState === "dragover"), _defineProperty$12(_classNames, "".concat(prefixCls2, "-disabled"), disabled), _classNames)); return createVNode("span", _objectSpread2$2({ "class": className }, getDataAndAria(this.$attrs)), [createVNode("div", { "class": dragCls, "onDrop": this.onFileDrop, "onDragover": this.onFileDrop, "onDragleave": this.onFileDrop, "style": style }, [createVNode(Upload$1, _objectSpread2$2(_objectSpread2$2({}, vcUploadProps), {}, { "class": "".concat(prefixCls2, "-btn") }), { default: function _default8() { return [createVNode("div", { "class": "".concat(prefixCls2, "-drag-container") }, [children])]; } })]), uploadList]); } var uploadButtonCls = classNames(prefixCls2, (_classNames2 = {}, _defineProperty$12(_classNames2, "".concat(prefixCls2, "-select"), true), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-select-").concat(listType), true), _defineProperty$12(_classNames2, "".concat(prefixCls2, "-disabled"), disabled), _classNames2)); if (!children.length || disabled) { delete vcUploadProps.id; } var uploadButton = createVNode("div", { "class": uploadButtonCls, "style": children.length ? void 0 : { display: "none" } }, [createVNode(Upload$1, vcUploadProps, { default: function _default8() { return [children]; } })]); if (listType === "picture-card") { return createVNode("span", { "class": classNames("".concat(prefixCls2, "-picture-card-wrapper"), className) }, [uploadList, uploadButton]); } return createVNode("span", { "class": className }, [uploadButton, uploadList]); } }); Upload.Dragger = Dragger; Upload.install = function(app) { app.component(Upload.name, Upload); app.component(Dragger.name, Dragger); return app; }; var index$E = ""; var index$D = ""; function getSlot(slots, slot = "default", data65) { if (!slots || !Reflect.has(slots, slot)) { return null; } if (!isFunction$3(slots[slot])) { console.error(`${slot} is not a function!`); return null; } const slotFn = slots[slot]; if (!slotFn) return null; return slotFn(data65); } function extendSlots(slots, excludeKeys = []) { const slotKeys = Object.keys(slots); const ret = {}; slotKeys.map((key2) => { if (excludeKeys.includes(key2)) { return null; } ret[key2] = (data65) => getSlot(slots, key2, data65); }); return ret; } function createSimpleTransition(name, origin = "top center 0", mode3) { return defineComponent({ name, props: { group: { type: Boolean, default: false }, mode: { type: String, default: mode3 }, origin: { type: String, default: origin } }, setup(props2, { slots, attrs }) { const onBeforeEnter = (el) => { el.style.transformOrigin = props2.origin; }; return () => { const Tag2 = !props2.group ? Transition$2 : TransitionGroup$1; return createVNode(Tag2, mergeProps$1({ "name": name, "mode": props2.mode }, attrs, { "onBeforeEnter": onBeforeEnter }), { default: () => getSlot(slots) }); }; } }); } function createJavascriptTransition(name, functions, mode3 = "in-out") { return defineComponent({ name, props: { mode: { type: String, default: mode3 } }, setup(props2, { attrs, slots }) { return () => { return createVNode(Transition$2, mergeProps$1({ "name": name, "mode": props2.mode }, attrs, { "onBeforeEnter": functions.beforeEnter, "onEnter": functions.enter, "onLeave": functions.leave, "onAfterLeave": functions.afterLeave, "onLeaveCancelled": functions.afterLeave }), { default: () => getSlot(slots) }); }; } }); } function upperFirst(str) { return str.charAt(0).toUpperCase() + str.slice(1); } function ExpandTransitionGenerator(expandedParentClass = "", x2 = false) { const sizeProperty = x2 ? "width" : "height"; const offsetProperty = `offset${upperFirst(sizeProperty)}`; return { beforeEnter(el) { el._parent = el.parentNode; el._initialStyle = { transition: el.style.transition, overflow: el.style.overflow, [sizeProperty]: el.style[sizeProperty] }; }, enter(el) { const initialStyle = el._initialStyle; el.style.setProperty("transition", "none", "important"); el.style.overflow = "hidden"; void el.offsetHeight; el.style.transition = initialStyle.transition; if (expandedParentClass && el._parent) { el._parent.classList.add(expandedParentClass); } requestAnimationFrame(() => { }); }, afterEnter: resetStyles, enterCancelled: resetStyles, leave(el) { el._initialStyle = { transition: "", overflow: el.style.overflow, [sizeProperty]: el.style[sizeProperty] }; el.style.overflow = "hidden"; el.style[sizeProperty] = `${el[offsetProperty]}px`; void el.offsetHeight; requestAnimationFrame(() => el.style[sizeProperty] = "0"); }, afterLeave, leaveCancelled: afterLeave }; function afterLeave(el) { if (expandedParentClass && el._parent) { el._parent.classList.remove(expandedParentClass); } resetStyles(el); } function resetStyles(el) { const size = el._initialStyle[sizeProperty]; el.style.overflow = el._initialStyle.overflow; if (size != null) el.style[sizeProperty] = size; Reflect.deleteProperty(el, "_initialStyle"); } } function getBoundingClientRect(element) { if (!element || !element.getBoundingClientRect) { return 0; } return element.getBoundingClientRect(); } function trim$1(string2) { return (string2 || "").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, ""); } function hasClass(el, cls) { if (!el || !cls) return false; if (cls.indexOf(" ") !== -1) throw new Error("className should not contain space."); if (el.classList) { return el.classList.contains(cls); } else { return (" " + el.className + " ").indexOf(" " + cls + " ") > -1; } } function addClass(el, cls) { if (!el) return; let curClass = el.className; const classes3 = (cls || "").split(" "); for (let i2 = 0, j2 = classes3.length; i2 < j2; i2++) { const clsName = classes3[i2]; if (!clsName) continue; if (el.classList) { el.classList.add(clsName); } else if (!hasClass(el, clsName)) { curClass += " " + clsName; } } if (!el.classList) { el.className = curClass; } } function removeClass(el, cls) { if (!el || !cls) return; const classes3 = cls.split(" "); let curClass = " " + el.className + " "; for (let i2 = 0, j2 = classes3.length; i2 < j2; i2++) { const clsName = classes3[i2]; if (!clsName) continue; if (el.classList) { el.classList.remove(clsName); } else if (hasClass(el, clsName)) { curClass = curClass.replace(" " + clsName + " ", " "); } } if (!el.classList) { el.className = trim$1(curClass); } } function getViewportOffset(element) { const doc = document.documentElement; const docScrollLeft = doc.scrollLeft; const docScrollTop = doc.scrollTop; const docClientLeft = doc.clientLeft; const docClientTop = doc.clientTop; const pageXOffset2 = window.pageXOffset; const pageYOffset2 = window.pageYOffset; const box = getBoundingClientRect(element); const { left: retLeft, top: rectTop, width: rectWidth, height: rectHeight } = box; const scrollLeft2 = (pageXOffset2 || docScrollLeft) - (docClientLeft || 0); const scrollTop2 = (pageYOffset2 || docScrollTop) - (docClientTop || 0); const offsetLeft = retLeft + pageXOffset2; const offsetTop = rectTop + pageYOffset2; const left = offsetLeft - scrollLeft2; const top = offsetTop - scrollTop2; const clientWidth = window.document.documentElement.clientWidth; const clientHeight = window.document.documentElement.clientHeight; return { left, top, right: clientWidth - rectWidth - left, bottom: clientHeight - rectHeight - top, rightIncludeBody: clientWidth - left, bottomIncludeBody: clientHeight - top }; } function on(element, event, handler7) { if (element && event && handler7) { element.addEventListener(event, handler7, false); } } function off(element, event, handler7) { if (element && event && handler7) { element.removeEventListener(event, handler7, false); } } const _sfc_main$H = defineComponent({ name: "CollapseTransition", setup() { return { on: { beforeEnter(el) { addClass(el, "collapse-transition"); if (!el.dataset) el.dataset = {}; el.dataset.oldPaddingTop = el.style.paddingTop; el.dataset.oldPaddingBottom = el.style.paddingBottom; el.style.height = "0"; el.style.paddingTop = 0; el.style.paddingBottom = 0; }, enter(el) { el.dataset.oldOverflow = el.style.overflow; if (el.scrollHeight !== 0) { el.style.height = el.scrollHeight + "px"; el.style.paddingTop = el.dataset.oldPaddingTop; el.style.paddingBottom = el.dataset.oldPaddingBottom; } else { el.style.height = ""; el.style.paddingTop = el.dataset.oldPaddingTop; el.style.paddingBottom = el.dataset.oldPaddingBottom; } el.style.overflow = "hidden"; }, afterEnter(el) { removeClass(el, "collapse-transition"); el.style.height = ""; el.style.overflow = el.dataset.oldOverflow; }, beforeLeave(el) { if (!el.dataset) el.dataset = {}; el.dataset.oldPaddingTop = el.style.paddingTop; el.dataset.oldPaddingBottom = el.style.paddingBottom; el.dataset.oldOverflow = el.style.overflow; el.style.height = el.scrollHeight + "px"; el.style.overflow = "hidden"; }, leave(el) { if (el.scrollHeight !== 0) { addClass(el, "collapse-transition"); el.style.height = 0; el.style.paddingTop = 0; el.style.paddingBottom = 0; } }, afterLeave(el) { removeClass(el, "collapse-transition"); el.style.height = ""; el.style.overflow = el.dataset.oldOverflow; el.style.paddingTop = el.dataset.oldPaddingTop; el.style.paddingBottom = el.dataset.oldPaddingBottom; } } }; } }); function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createBlock(Transition$2, mergeProps$1({ mode: "out-in" }, toHandlers(_ctx.on)), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16); } var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["render", _sfc_render$w]]); const FadeTransition = createSimpleTransition("fade-transition"); const ScaleTransition = createSimpleTransition("scale-transition"); const SlideYTransition = createSimpleTransition("slide-y-transition"); const ScrollYTransition = createSimpleTransition("scroll-y-transition"); const SlideYReverseTransition = createSimpleTransition("slide-y-reverse-transition"); const ScrollYReverseTransition = createSimpleTransition("scroll-y-reverse-transition"); const SlideXTransition = createSimpleTransition("slide-x-transition"); const ScrollXTransition = createSimpleTransition("scroll-x-transition"); const SlideXReverseTransition = createSimpleTransition("slide-x-reverse-transition"); const ScrollXReverseTransition = createSimpleTransition("scroll-x-reverse-transition"); const ScaleRotateTransition = createSimpleTransition("scale-rotate-transition"); const ExpandXTransition = createJavascriptTransition("expand-x-transition", ExpandTransitionGenerator("", true)); const ExpandTransition = createJavascriptTransition("expand-transition", ExpandTransitionGenerator("")); const isServer = typeof window === "undefined"; function resizeHandler(entries2) { for (const entry of entries2) { const listeners = entry.target.__resizeListeners__ || []; if (listeners.length) { listeners.forEach((fn) => { fn(); }); } } } function addResizeListener(element, fn) { if (isServer) return; if (!element.__resizeListeners__) { element.__resizeListeners__ = []; element.__ro__ = new index$G(resizeHandler); element.__ro__.observe(element); } element.__resizeListeners__.push(fn); } function removeResizeListener(element, fn) { if (!element || !element.__resizeListeners__) return; element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); if (!element.__resizeListeners__.length) { element.__ro__.disconnect(); } } function triggerWindowResize() { const event = document.createEvent("HTMLEvents"); event.initEvent("resize", true, true); event.eventType = "message"; window.dispatchEvent(event); } function useTimeoutFn(handle, wait, native = false) { if (!isFunction$3(handle)) { throw new Error("handle is not Function!"); } const { readyRef, stop: stop2, start } = useTimeoutRef(wait); if (native) { handle(); } else { watch(readyRef, (maturity) => { maturity && handle(); }, { immediate: false }); } return { readyRef, stop: stop2, start }; } function useTimeoutRef(wait) { const readyRef = ref(false); let timer; function stop2() { readyRef.value = false; timer && window.clearTimeout(timer); } function start() { stop2(); timer = setTimeout(() => { readyRef.value = true; }, wait); } start(); tryOnUnmounted(stop2); return { readyRef, stop: stop2, start }; } const _hoisted_1$d = { class: "p-8" }; const __default__$4 = { name: "BzCollapseContainer" }; const _sfc_main$G = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), { props: { title: { type: String, default: "" }, loading: { type: Boolean }, canExpan: { type: Boolean, default: true }, helpMessage: { type: [Array, String], default: "" }, triggerWindowResize: { type: Boolean }, lazyTime: { type: Number, default: 0 } }, setup(__props, { expose }) { const props2 = __props; const show = ref(true); const { prefixCls: prefixCls2 } = useDesign("collapse-container"); function handleExpand3(val) { show.value = isNil(val) ? !show.value : val; if (props2.triggerWindowResize) { useTimeoutFn(triggerWindowResize, 200); } } expose({ handleExpand: handleExpand3 }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass(unref(prefixCls2)) }, [ createVNode(_sfc_main$I, mergeProps$1(props2, { prefixCls: unref(prefixCls2), show: show.value, onExpand: handleExpand3 }), { title: withCtx(() => [ renderSlot(_ctx.$slots, "title") ]), action: withCtx(() => [ renderSlot(_ctx.$slots, "action") ]), _: 3 }, 16, ["prefixCls", "show"]), createElementVNode("div", _hoisted_1$d, [ createVNode(unref(CollapseTransition), { enable: __props.canExpan }, { default: withCtx(() => [ __props.loading ? (openBlock(), createBlock(unref(Skeleton$1), { key: 0, active: __props.loading }, null, 8, ["active"])) : withDirectives((openBlock(), createElementBlock("div", { key: 1, class: normalizeClass(`${unref(prefixCls2)}__body`) }, [ renderSlot(_ctx.$slots, "default") ], 2)), [ [vShow, show.value] ]) ]), _: 3 }, 8, ["enable"]) ]), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(`${unref(prefixCls2)}__footer`) }, [ renderSlot(_ctx.$slots, "footer") ], 2)) : createCommentVNode("", true) ], 2); }; } })); var componentSetting = { scrollbar: { native: false } }; const BAR_MAP = { vertical: { offset: "offsetHeight", scroll: "scrollTop", scrollSize: "scrollHeight", size: "height", key: "vertical", axis: "Y", client: "clientY", direction: "top" }, horizontal: { offset: "offsetWidth", scroll: "scrollLeft", scrollSize: "scrollWidth", size: "width", key: "horizontal", axis: "X", client: "clientX", direction: "left" } }; function renderThumbStyle({ move: move2, size, bar }) { const style = {}; const translate = `translate${bar.axis}(${move2}%)`; style[bar.size] = size; style.transform = translate; style.msTransform = translate; style.webkitTransform = translate; return style; } function extend$1(to2, _from) { return Object.assign(to2, _from); } function toObject(arr) { const res = {}; for (let i2 = 0; i2 < arr.length; i2++) { if (arr[i2]) { extend$1(res, arr[i2]); } } return res; } var Bar = defineComponent({ name: "Bar", props: { vertical: Boolean, size: String, move: Number }, setup(props2) { const instance = getCurrentInstance(); const thumb = ref(); const wrap = inject("scroll-bar-wrap", {}); const bar = computed(() => { return BAR_MAP[props2.vertical ? "vertical" : "horizontal"]; }); const barStore = ref({}); const cursorDown = ref(); const clickThumbHandler = (e2) => { var _a3; if (e2.ctrlKey || e2.button === 2) { return; } (_a3 = window.getSelection()) == null ? void 0 : _a3.removeAllRanges(); startDrag(e2); barStore.value[bar.value.axis] = e2.currentTarget[bar.value.offset] - (e2[bar.value.client] - e2.currentTarget.getBoundingClientRect()[bar.value.direction]); }; const clickTrackHandler = (e2) => { var _a3; const offset4 = Math.abs(e2.target.getBoundingClientRect()[bar.value.direction] - e2[bar.value.client]); const thumbHalf = thumb.value[bar.value.offset] / 2; const thumbPositionPercentage = (offset4 - thumbHalf) * 100 / ((_a3 = instance == null ? void 0 : instance.vnode.el) == null ? void 0 : _a3[bar.value.offset]); wrap.value[bar.value.scroll] = thumbPositionPercentage * wrap.value[bar.value.scrollSize] / 100; }; const startDrag = (e2) => { e2.stopImmediatePropagation(); cursorDown.value = true; on(document, "mousemove", mouseMoveDocumentHandler); on(document, "mouseup", mouseUpDocumentHandler); document.onselectstart = () => false; }; const mouseMoveDocumentHandler = (e2) => { var _a3, _b2; if (cursorDown.value === false) return; const prevPage = barStore.value[bar.value.axis]; if (!prevPage) return; const offset4 = (((_a3 = instance == null ? void 0 : instance.vnode.el) == null ? void 0 : _a3.getBoundingClientRect()[bar.value.direction]) - e2[bar.value.client]) * -1; const thumbClickPosition = thumb.value[bar.value.offset] - prevPage; const thumbPositionPercentage = (offset4 - thumbClickPosition) * 100 / ((_b2 = instance == null ? void 0 : instance.vnode.el) == null ? void 0 : _b2[bar.value.offset]); wrap.value[bar.value.scroll] = thumbPositionPercentage * wrap.value[bar.value.scrollSize] / 100; }; function mouseUpDocumentHandler() { cursorDown.value = false; barStore.value[bar.value.axis] = 0; off(document, "mousemove", mouseMoveDocumentHandler); document.onselectstart = null; } onUnmounted(() => { off(document, "mouseup", mouseUpDocumentHandler); }); return () => h$2("div", { class: ["scrollbar__bar", "is-" + bar.value.key], onMousedown: clickTrackHandler }, h$2("div", { ref: thumb, class: "scrollbar__thumb", onMousedown: clickThumbHandler, style: renderThumbStyle({ size: props2.size, move: props2.move, bar: bar.value }) })); } }); var Scrollbar_vue_vue_type_style_index_0_lang = ""; const { scrollbar } = componentSetting; const _sfc_main$F = defineComponent({ name: "BzScrollbar", components: { Bar }, props: { native: { type: Boolean, default: (_a2 = scrollbar == null ? void 0 : scrollbar.native) != null ? _a2 : false }, wrapStyle: { type: [String, Array], default: "" }, wrapClass: { type: [String, Array], default: "" }, viewClass: { type: [String, Array], default: "" }, viewStyle: { type: [String, Array], default: "" }, noresize: Boolean, tag: { type: String, default: "div" } }, setup(props2) { const sizeWidth = ref("0"); const sizeHeight = ref("0"); const moveX = ref(0); const moveY = ref(0); const wrap = ref(); const resize = ref(); provide("scroll-bar-wrap", wrap); const style = computed(() => { if (Array.isArray(props2.wrapStyle)) { return toObject(props2.wrapStyle); } return props2.wrapStyle; }); const handleScroll = () => { if (!props2.native) { moveY.value = unref(wrap).scrollTop * 100 / unref(wrap).clientHeight; moveX.value = unref(wrap).scrollLeft * 100 / unref(wrap).clientWidth; } }; const update = () => { if (!unref(wrap)) return; const heightPercentage = unref(wrap).clientHeight * 100 / unref(wrap).scrollHeight; const widthPercentage = unref(wrap).clientWidth * 100 / unref(wrap).scrollWidth; sizeHeight.value = heightPercentage < 100 ? heightPercentage + "%" : ""; sizeWidth.value = widthPercentage < 100 ? widthPercentage + "%" : ""; }; onMounted(() => { if (props2.native) return; nextTick(update); if (!props2.noresize) { addResizeListener(unref(resize), update); addResizeListener(unref(wrap), update); addEventListener("resize", update); } }); onBeforeUnmount(() => { if (props2.native) return; if (!props2.noresize) { removeResizeListener(unref(resize), update); removeResizeListener(unref(wrap), update); removeEventListener("resize", update); } }); return { moveX, moveY, sizeWidth, sizeHeight, style, wrap, resize, update, handleScroll }; } }); const _hoisted_1$c = { class: "scrollbar" }; function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) { const _component_bar = resolveComponent("bar"); return openBlock(), createElementBlock("div", _hoisted_1$c, [ createElementVNode("div", { ref: "wrap", class: normalizeClass([_ctx.wrapClass, "scrollbar__wrap", _ctx.native ? "" : "scrollbar__wrap--hidden-default"]), style: normalizeStyle(_ctx.style), onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.handleScroll && _ctx.handleScroll(...args)) }, [ (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), { ref: "resize", class: normalizeClass(["scrollbar__view", _ctx.viewClass]), style: normalizeStyle(_ctx.viewStyle) }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 8, ["class", "style"])) ], 38), !_ctx.native ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ createVNode(_component_bar, { move: _ctx.moveX, size: _ctx.sizeWidth }, null, 8, ["move", "size"]), createVNode(_component_bar, { vertical: "", move: _ctx.moveY, size: _ctx.sizeHeight }, null, 8, ["move", "size"]) ], 64)) : createCommentVNode("", true) ]); } var bzScrollbar = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["render", _sfc_render$v]]); const BzScrollbar = withInstall$1(bzScrollbar); const easeInOutQuad = (t2, b2, c2, d2) => { t2 /= d2 / 2; if (t2 < 1) { return c2 / 2 * t2 * t2 + b2; } t2--; return -c2 / 2 * (t2 * (t2 - 2) - 1) + b2; }; const move = (el, amount) => { el.scrollTop = amount; }; const position = (el) => { return el.scrollTop; }; function useScrollTo({ el, to: to2, duration: duration2 = 500, callback: callback2 }) { const isActiveRef = ref(false); const start = position(el); const change = to2 - start; const increment = 20; let currentTime = 0; duration2 = isUnDef(duration2) ? 500 : duration2; const animateScroll = function() { if (!unref(isActiveRef)) { return; } currentTime += increment; const val = easeInOutQuad(currentTime, start, change, duration2); move(el, val); if (currentTime < duration2 && unref(isActiveRef)) { requestAnimationFrame(animateScroll); } else { if (callback2 && isFunction$3(callback2)) { callback2(); } } }; const run = () => { isActiveRef.value = true; animateScroll(); }; const stop2 = () => { isActiveRef.value = false; }; return { start: run, stop: stop2 }; } const _sfc_main$E = defineComponent({ name: "BzScrollContainer", components: { BzScrollbar }, setup() { const scrollbarRef = ref(null); function scrollTo3(to2, duration2 = 500) { const scrollbar2 = unref(scrollbarRef); if (!scrollbar2) { return; } nextTick(() => { const wrap = unref(scrollbar2.wrap); if (!wrap) { return; } const { start } = useScrollTo({ el: wrap, to: to2, duration: duration2 }); start(); }); } function getScrollWrap() { const scrollbar2 = unref(scrollbarRef); if (!scrollbar2) { return null; } return scrollbar2.wrap; } function scrollBottom() { const scrollbar2 = unref(scrollbarRef); if (!scrollbar2) { return; } nextTick(() => { const wrap = unref(scrollbar2.wrap); if (!wrap) { return; } const scrollHeight = wrap.scrollHeight; const { start } = useScrollTo({ el: wrap, to: scrollHeight }); start(); }); } return { scrollbarRef, scrollTo: scrollTo3, scrollBottom, getScrollWrap }; } }); function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) { const _component_BzScrollbar = resolveComponent("BzScrollbar"); return openBlock(), createBlock(_component_BzScrollbar, mergeProps$1({ ref: "scrollbarRef", class: "bz-scroll-container" }, _ctx.$attrs), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16); } var bzScrollContainer = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["render", _sfc_render$u]]); const BzCollapseContainer = withInstall$1(_sfc_main$G); const BzScrollContainer = withInstall$1(bzScrollContainer); var index$C = ""; var index$B = ""; var index$A = ""; var index$z = ""; var index$y = ""; var index$x = ""; var index$w = ""; var iconsData = { prefix: "ant-design", icons: [ "account-book-filled", "account-book-outlined", "account-book-twotone", "aim-outlined", "alert-filled", "alert-outlined", "alert-twotone", "alibaba-outlined", "align-center-outlined", "align-left-outlined", "align-right-outlined", "alipay-circle-filled", "alipay-circle-outlined", "alipay-outlined", "alipay-square-filled", "aliwangwang-filled", "aliwangwang-outlined", "aliyun-outlined", "amazon-circle-filled", "amazon-outlined", "amazon-square-filled", "android-filled", "android-outlined", "ant-cloud-outlined", "ant-design-outlined", "apartment-outlined", "api-filled", "api-outlined", "api-twotone", "apple-filled", "apple-outlined", "appstore-add-outlined", "appstore-filled", "appstore-outlined", "appstore-twotone", "area-chart-outlined", "arrow-down-outlined", "arrow-left-outlined", "arrow-right-outlined", "arrow-up-outlined", "arrows-alt-outlined", "audio-filled", "audio-muted-outlined", "audio-outlined", "audio-twotone", "audit-outlined", "backward-filled", "backward-outlined", "bank-filled", "bank-outlined", "bank-twotone", "bar-chart-outlined", "barcode-outlined", "bars-outlined", "behance-circle-filled", "behance-outlined", "behance-square-filled", "behance-square-outlined", "bell-filled", "bell-outlined", "bell-twotone", "bg-colors-outlined", "block-outlined", "bold-outlined", "book-filled", "book-outlined", "book-twotone", "border-bottom-outlined", "border-horizontal-outlined", "border-inner-outlined", "border-left-outlined", "border-outer-outlined", "border-outlined", "border-right-outlined", "border-top-outlined", "border-verticle-outlined", "borderless-table-outlined", "box-plot-filled", "box-plot-outlined", "box-plot-twotone", "branches-outlined", "bug-filled", "bug-outlined", "bug-twotone", "build-filled", "build-outlined", "build-twotone", "bulb-filled", "bulb-outlined", "bulb-twotone", "calculator-filled", "calculator-outlined", "calculator-twotone", "calendar-filled", "calendar-outlined", "calendar-twotone", "camera-filled", "camera-outlined", "camera-twotone", "car-filled", "car-outlined", "car-twotone", "caret-down-filled", "caret-down-outlined", "caret-left-filled", "caret-left-outlined", "caret-right-filled", "caret-right-outlined", "caret-up-filled", "caret-up-outlined", "carry-out-filled", "carry-out-outlined", "carry-out-twotone", "check-circle-filled", "check-circle-outlined", "check-circle-twotone", "check-outlined", "check-square-filled", "check-square-outlined", "check-square-twotone", "chrome-filled", "chrome-outlined", "ci-circle-filled", "ci-circle-outlined", "ci-circle-twotone", "ci-outlined", "ci-twotone", "clear-outlined", "clock-circle-filled", "clock-circle-outlined", "clock-circle-twotone", "close-circle-filled", "close-circle-outlined", "close-circle-twotone", "close-outlined", "close-square-filled", "close-square-outlined", "close-square-twotone", "cloud-download-outlined", "cloud-filled", "cloud-outlined", "cloud-server-outlined", "cloud-sync-outlined", "cloud-twotone", "cloud-upload-outlined", "cluster-outlined", "code-filled", "code-outlined", "code-sandbox-circle-filled", "code-sandbox-outlined", "code-sandbox-square-filled", "code-twotone", "codepen-circle-filled", "codepen-circle-outlined", "codepen-outlined", "codepen-square-filled", "coffee-outlined", "column-height-outlined", "column-width-outlined", "comment-outlined", "compass-filled", "compass-outlined", "compass-twotone", "compress-outlined", "console-sql-outlined", "contacts-filled", "contacts-outlined", "contacts-twotone", "container-filled", "container-outlined", "container-twotone", "control-filled", "control-outlined", "control-twotone", "copy-filled", "copy-outlined", "copy-twotone", "copyright-circle-filled", "copyright-circle-outlined", "copyright-circle-twotone", "copyright-outlined", "copyright-twotone", "credit-card-filled", "credit-card-outlined", "credit-card-twotone", "crown-filled", "crown-outlined", "crown-twotone", "customer-service-filled", "customer-service-outlined", "customer-service-twotone", "dash-outlined", "dashboard-filled", "dashboard-outlined", "dashboard-twotone", "database-filled", "database-outlined", "database-twotone", "delete-column-outlined", "delete-filled", "delete-outlined", "delete-row-outlined", "delete-twotone", "delivered-procedure-outlined", "deployment-unit-outlined", "desktop-outlined", "diff-filled", "diff-outlined", "diff-twotone", "dingding-outlined", "dingtalk-circle-filled", "dingtalk-outlined", "dingtalk-square-filled", "disconnect-outlined", "dislike-filled", "dislike-outlined", "dislike-twotone", "dollar-circle-filled", "dollar-circle-outlined", "dollar-circle-twotone", "dollar-outlined", "dollar-twotone", "dot-chart-outlined", "double-left-outlined", "double-right-outlined", "down-circle-filled", "down-circle-outlined", "down-circle-twotone", "down-outlined", "down-square-filled", "down-square-outlined", "down-square-twotone", "download-outlined", "drag-outlined", "dribbble-circle-filled", "dribbble-outlined", "dribbble-square-filled", "dribbble-square-outlined", "dropbox-circle-filled", "dropbox-outlined", "dropbox-square-filled", "edit-filled", "edit-outlined", "edit-twotone", "ellipsis-outlined", "enter-outlined", "environment-filled", "environment-outlined", "environment-twotone", "euro-circle-filled", "euro-circle-outlined", "euro-circle-twotone", "euro-outlined", "euro-twotone", "exception-outlined", "exclamation-circle-filled", "exclamation-circle-outlined", "exclamation-circle-twotone", "exclamation-outlined", "expand-alt-outlined", "expand-outlined", "experiment-filled", "experiment-outlined", "experiment-twotone", "export-outlined", "eye-filled", "eye-invisible-filled", "eye-invisible-outlined", "eye-invisible-twotone", "eye-outlined", "eye-twotone", "facebook-filled", "facebook-outlined", "fall-outlined", "fast-backward-filled", "fast-backward-outlined", "fast-forward-filled", "fast-forward-outlined", "field-binary-outlined", "field-number-outlined", "field-string-outlined", "field-time-outlined", "file-add-filled", "file-add-outlined", "file-add-twotone", "file-done-outlined", "file-excel-filled", "file-excel-outlined", "file-excel-twotone", "file-exclamation-filled", "file-exclamation-outlined", "file-exclamation-twotone", "file-filled", "file-gif-outlined", "file-image-filled", "file-image-outlined", "file-image-twotone", "file-jpg-outlined", "file-markdown-filled", "file-markdown-outlined", "file-markdown-twotone", "file-outlined", "file-pdf-filled", "file-pdf-outlined", "file-pdf-twotone", "file-ppt-filled", "file-ppt-outlined", "file-ppt-twotone", "file-protect-outlined", "file-search-outlined", "file-sync-outlined", "file-text-filled", "file-text-outlined", "file-text-twotone", "file-twotone", "file-unknown-filled", "file-unknown-outlined", "file-unknown-twotone", "file-word-filled", "file-word-outlined", "file-word-twotone", "file-zip-filled", "file-zip-outlined", "file-zip-twotone", "filter-filled", "filter-outlined", "filter-twotone", "fire-filled", "fire-outlined", "fire-twotone", "flag-filled", "flag-outlined", "flag-twotone", "folder-add-filled", "folder-add-outlined", "folder-add-twotone", "folder-filled", "folder-open-filled", "folder-open-outlined", "folder-open-twotone", "folder-outlined", "folder-twotone", "folder-view-outlined", "font-colors-outlined", "font-size-outlined", "fork-outlined", "form-outlined", "format-painter-filled", "format-painter-outlined", "forward-filled", "forward-outlined", "frown-filled", "frown-outlined", "frown-twotone", "fullscreen-exit-outlined", "fullscreen-outlined", "function-outlined", "fund-filled", "fund-outlined", "fund-projection-screen-outlined", "fund-twotone", "fund-view-outlined", "funnel-plot-filled", "funnel-plot-outlined", "funnel-plot-twotone", "gateway-outlined", "gif-outlined", "gift-filled", "gift-outlined", "gift-twotone", "github-filled", "github-outlined", "gitlab-filled", "gitlab-outlined", "global-outlined", "gold-filled", "gold-outlined", "gold-twotone", "golden-filled", "google-circle-filled", "google-outlined", "google-plus-circle-filled", "google-plus-outlined", "google-plus-square-filled", "google-square-filled", "group-outlined", "hdd-filled", "hdd-outlined", "hdd-twotone", "heart-filled", "heart-outlined", "heart-twotone", "heat-map-outlined", "highlight-filled", "highlight-outlined", "highlight-twotone", "history-outlined", "home-filled", "home-outlined", "home-twotone", "hourglass-filled", "hourglass-outlined", "hourglass-twotone", "html5-filled", "html5-outlined", "html5-twotone", "idcard-filled", "idcard-outlined", "idcard-twotone", "ie-circle-filled", "ie-outlined", "ie-square-filled", "import-outlined", "inbox-outlined", "info-circle-filled", "info-circle-outlined", "info-circle-twotone", "info-outlined", "insert-row-above-outlined", "insert-row-below-outlined", "insert-row-left-outlined", "insert-row-right-outlined", "instagram-filled", "instagram-outlined", "insurance-filled", "insurance-outlined", "insurance-twotone", "interaction-filled", "interaction-outlined", "interaction-twotone", "issues-close-outlined", "italic-outlined", "key-outlined", "laptop-outlined", "layout-filled", "layout-outlined", "layout-twotone", "left-circle-filled", "left-circle-outlined", "left-circle-twotone", "left-outlined", "left-square-filled", "left-square-outlined", "left-square-twotone", "like-filled", "like-outlined", "like-twotone", "line-chart-outlined", "line-height-outlined", "line-outlined", "link-outlined", "linkedin-filled", "linkedin-outlined", "loading-3-quarters-outlined", "loading-outlined", "lock-filled", "lock-outlined", "lock-twotone", "login-outlined", "logout-outlined", "mac-command-filled", "mac-command-outlined", "mail-filled", "mail-outlined", "mail-twotone", "man-outlined", "medicine-box-filled", "medicine-box-outlined", "medicine-box-twotone", "medium-circle-filled", "medium-outlined", "medium-square-filled", "medium-workmark-outlined", "meh-filled", "meh-outlined", "meh-twotone", "menu-fold-outlined", "menu-outlined", "menu-unfold-outlined", "merge-cells-outlined", "message-filled", "message-outlined", "message-twotone", "minus-circle-filled", "minus-circle-outlined", "minus-circle-twotone", "minus-outlined", "minus-square-filled", "minus-square-outlined", "minus-square-twotone", "mobile-filled", "mobile-outlined", "mobile-twotone", "money-collect-filled", "money-collect-outlined", "money-collect-twotone", "monitor-outlined", "more-outlined", "node-collapse-outlined", "node-expand-outlined", "node-index-outlined", "notification-filled", "notification-outlined", "notification-twotone", "number-outlined", "one-to-one-outlined", "ordered-list-outlined", "paper-clip-outlined", "partition-outlined", "pause-circle-filled", "pause-circle-outlined", "pause-circle-twotone", "pause-outlined", "pay-circle-filled", "pay-circle-outlined", "percentage-outlined", "phone-filled", "phone-outlined", "phone-twotone", "pic-center-outlined", "pic-left-outlined", "pic-right-outlined", "picture-filled", "picture-outlined", "picture-twotone", "pie-chart-filled", "pie-chart-outlined", "pie-chart-twotone", "play-circle-filled", "play-circle-outlined", "play-circle-twotone", "play-square-filled", "play-square-outlined", "play-square-twotone", "plus-circle-filled", "plus-circle-outlined", "plus-circle-twotone", "plus-outlined", "plus-square-filled", "plus-square-outlined", "plus-square-twotone", "pound-circle-filled", "pound-circle-outlined", "pound-circle-twotone", "pound-outlined", "poweroff-outlined", "printer-filled", "printer-outlined", "printer-twotone", "profile-filled", "profile-outlined", "profile-twotone", "project-filled", "project-outlined", "project-twotone", "property-safety-filled", "property-safety-outlined", "property-safety-twotone", "pull-request-outlined", "pushpin-filled", "pushpin-outlined", "pushpin-twotone", "qq-circle-filled", "qq-outlined", "qq-square-filled", "qrcode-outlined", "question-circle-filled", "question-circle-outlined", "question-circle-twotone", "question-outlined", "radar-chart-outlined", "radius-bottomleft-outlined", "radius-bottomright-outlined", "radius-setting-outlined", "radius-upleft-outlined", "radius-upright-outlined", "read-filled", "read-outlined", "reconciliation-filled", "reconciliation-outlined", "reconciliation-twotone", "red-envelope-filled", "red-envelope-outlined", "red-envelope-twotone", "reddit-circle-filled", "reddit-outlined", "reddit-square-filled", "redo-outlined", "reload-outlined", "rest-filled", "rest-outlined", "rest-twotone", "retweet-outlined", "right-circle-filled", "right-circle-outlined", "right-circle-twotone", "right-outlined", "right-square-filled", "right-square-outlined", "right-square-twotone", "rise-outlined", "robot-filled", "robot-outlined", "rocket-filled", "rocket-outlined", "rocket-twotone", "rollback-outlined", "rotate-left-outlined", "rotate-right-outlined", "safety-certificate-filled", "safety-certificate-outlined", "safety-certificate-twotone", "safety-outlined", "save-filled", "save-outlined", "save-twotone", "scan-outlined", "schedule-filled", "schedule-outlined", "schedule-twotone", "scissor-outlined", "search-outlined", "security-scan-filled", "security-scan-outlined", "security-scan-twotone", "select-outlined", "send-outlined", "setting-filled", "setting-outlined", "setting-twotone", "shake-outlined", "share-alt-outlined", "shop-filled", "shop-outlined", "shop-twotone", "shopping-cart-outlined", "shopping-filled", "shopping-outlined", "shopping-twotone", "shrink-outlined", "signal-filled", "sisternode-outlined", "sketch-circle-filled", "sketch-outlined", "sketch-square-filled", "skin-filled", "skin-outlined", "skin-twotone", "skype-filled", "skype-outlined", "slack-circle-filled", "slack-outlined", "slack-square-filled", "slack-square-outlined", "sliders-filled", "sliders-outlined", "sliders-twotone", "small-dash-outlined", "smile-filled", "smile-outlined", "smile-twotone", "snippets-filled", "snippets-outlined", "snippets-twotone", "solution-outlined", "sort-ascending-outlined", "sort-descending-outlined", "sound-filled", "sound-outlined", "sound-twotone", "split-cells-outlined", "star-filled", "star-outlined", "star-twotone", "step-backward-filled", "step-backward-outlined", "step-forward-filled", "step-forward-outlined", "stock-outlined", "stop-filled", "stop-outlined", "stop-twotone", "strikethrough-outlined", "subnode-outlined", "swap-left-outlined", "swap-outlined", "swap-right-outlined", "switcher-filled", "switcher-outlined", "switcher-twotone", "sync-outlined", "table-outlined", "tablet-filled", "tablet-outlined", "tablet-twotone", "tag-filled", "tag-outlined", "tag-twotone", "tags-filled", "tags-outlined", "tags-twotone", "taobao-circle-filled", "taobao-circle-outlined", "taobao-outlined", "taobao-square-filled", "team-outlined", "thunderbolt-filled", "thunderbolt-outlined", "thunderbolt-twotone", "to-top-outlined", "tool-filled", "tool-outlined", "tool-twotone", "trademark-circle-filled", "trademark-circle-outlined", "trademark-circle-twotone", "trademark-outlined", "transaction-outlined", "translation-outlined", "trophy-filled", "trophy-outlined", "trophy-twotone", "twitter-circle-filled", "twitter-outlined", "twitter-square-filled", "underline-outlined", "undo-outlined", "ungroup-outlined", "unlock-filled", "unlock-outlined", "unlock-twotone", "unordered-list-outlined", "up-circle-filled", "up-circle-outlined", "up-circle-twotone", "up-outlined", "up-square-filled", "up-square-outlined", "up-square-twotone", "upload-outlined", "usb-filled", "usb-outlined", "usb-twotone", "user-add-outlined", "user-delete-outlined", "user-outlined", "user-switch-outlined", "usergroup-add-outlined", "usergroup-delete-outlined", "verified-outlined", "vertical-align-bottom-outlined", "vertical-align-middle-outlined", "vertical-align-top-outlined", "vertical-left-outlined", "vertical-right-outlined", "video-camera-add-outlined", "video-camera-filled", "video-camera-outlined", "video-camera-twotone", "wallet-filled", "wallet-outlined", "wallet-twotone", "warning-filled", "warning-outlined", "warning-twotone", "wechat-filled", "wechat-outlined", "weibo-circle-filled", "weibo-circle-outlined", "weibo-outlined", "weibo-square-filled", "weibo-square-outlined", "whats-app-outlined", "wifi-outlined", "windows-filled", "windows-outlined", "woman-outlined", "yahoo-filled", "yahoo-outlined", "youtube-filled", "youtube-outlined", "yuque-filled", "yuque-outlined", "zhihu-circle-filled", "zhihu-outlined", "zhihu-square-filled", "zoom-in-outlined", "zoom-out-outlined" ] }; function pagination(list, pageNo, pageSize2) { const offset4 = (pageNo - 1) * Number(pageSize2); const ret = offset4 + Number(pageSize2) >= list.length ? list.slice(offset4, list.length) : list.slice(offset4, offset4 + Number(pageSize2)); return ret; } function usePagination$1(list, pageSize2) { const currentPage = ref(1); const pageSizeRef = ref(pageSize2); const getPaginationList = computed(() => { return pagination(unref(list), unref(currentPage), unref(pageSizeRef)); }); const getTotal = computed(() => { return unref(list).length; }); function setCurrentPage(page) { currentPage.value = page; } function setPageSize(pageSize22) { pageSizeRef.value = pageSize22; } return { setCurrentPage, getTotal, setPageSize, getPaginationList }; } function useCopyToClipboard(initial) { const clipboardRef = ref(initial || ""); const isSuccessRef = ref(false); const copiedRef = ref(false); watch(clipboardRef, (str) => { if (isDef(str)) { copiedRef.value = true; isSuccessRef.value = copyTextToClipboard(str); } }, { immediate: !!initial, flush: "sync" }); return { clipboardRef, isSuccessRef, copiedRef }; } function copyTextToClipboard(input, { target = document.body } = {}) { const element = document.createElement("textarea"); const previouslyFocusedElement = document.activeElement; element.value = input; element.setAttribute("readonly", ""); element.style.contain = "strict"; element.style.position = "absolute"; element.style.left = "-9999px"; element.style.fontSize = "12pt"; const selection = document.getSelection(); let originalRange; if (selection && selection.rangeCount > 0) { originalRange = selection.getRangeAt(0); } target.append(element); element.select(); element.selectionStart = 0; element.selectionEnd = input.length; let isSuccess = false; try { isSuccess = document.execCommand("copy"); } catch (e2) { throw new Error(e2); } element.remove(); if (originalRange && selection) { selection.removeAllRanges(); selection.addRange(originalRange); } if (previouslyFocusedElement) { previouslyFocusedElement.focus(); } return isSuccess; } var svgIcons = ["icon-download-count", "icon-dynamic-avatar-1", "icon-dynamic-avatar-2", "icon-dynamic-avatar-3", "icon-dynamic-avatar-4", "icon-dynamic-avatar-5", "icon-dynamic-avatar-6", "icon-moon", "icon-sun", "icon-test", "icon-total-sales", "icon-transaction", "icon-visit-count"]; const _hoisted_1$b = { class: "flex justify-between" }; const _hoisted_2$3 = { key: 0 }; const _hoisted_3$1 = { class: "flex flex-wrap px-8" }; const _hoisted_4 = ["onClick", "title"]; const _hoisted_5 = { key: 0, class: "flex py-8 items-center justify-center" }; const _hoisted_6 = { key: 1, class: "p-8" }; const _hoisted_7 = { key: 0, class: "cursor-pointer px-8 py-8 flex items-center" }; const __default__$3 = { name: "BzIconPicker" }; const _sfc_main$D = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), { props: { value: propTypes$1.string, width: propTypes$1.string.def("100%"), pageSize: propTypes$1.number.def(140), copy: propTypes$1.bool.def(false), mode: propTypes$1.oneOf(["svg", "iconify"]).def("iconify") }, emits: ["change", "update:value"], setup(__props, { emit: emit2 }) { const props2 = __props; function getIcons2() { var _a3, _b2; const data65 = iconsData; const prefix = (_a3 = data65 == null ? void 0 : data65.prefix) != null ? _a3 : ""; let result = []; if (prefix) { result = ((_b2 = data65 == null ? void 0 : data65.icons) != null ? _b2 : []).map((item) => `${prefix}:${item}`); } else if (Array.isArray(iconsData)) { result = iconsData; } return result; } function getSvgIcons() { return svgIcons.map((icon) => icon.replace("icon-", "")); } const isSvgMode = props2.mode === "svg"; const icons = isSvgMode ? getSvgIcons() : getIcons2(); const currentSelect = ref(""); const visible9 = ref(false); const currentList = ref(icons); const { prefixCls: prefixCls2 } = useDesign("icon-picker"); const debounceHandleSearchChange = useDebounceFn(handleSearchChange, 100); const { clipboardRef, isSuccessRef } = useCopyToClipboard(props2.value); const { getPaginationList, getTotal, setCurrentPage } = usePagination$1(currentList, props2.pageSize); watchEffect(() => { currentSelect.value = props2.value; }); watch(() => currentSelect.value, (v2) => { emit2("update:value", v2); return emit2("change", v2); }); function handlePageChange2(page) { setCurrentPage(page); } function handleClick5(icon) { currentSelect.value = icon; if (props2.copy) { clipboardRef.value = icon; if (unref(isSuccessRef)) { message.success("\u590D\u5236\u6210\u529F"); } } } function handleSearchChange(e2) { const value24 = e2.target.value; if (!value24) { setCurrentPage(1); currentList.value = icons; return; } currentList.value = icons.filter((item) => item.includes(value24)); } return (_ctx, _cache) => { return openBlock(), createBlock(unref(Input), { disabled: "", style: normalizeStyle({ width: __props.width }), placeholder: "\u70B9\u51FB\u9009\u62E9\u56FE\u6807", class: normalizeClass(unref(prefixCls2)), value: currentSelect.value, "onUpdate:value": _cache[1] || (_cache[1] = ($event) => currentSelect.value = $event) }, { addonAfter: withCtx(() => [ createVNode(unref(Popover$1), { placement: "bottomLeft", trigger: "click", modelValue: visible9.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible9.value = $event), overlayClassName: `${unref(prefixCls2)}-popover`, overlayStyle: { width: "290px" } }, { title: withCtx(() => [ createElementVNode("div", _hoisted_1$b, [ createVNode(unref(Input), { placeholder: "\u641C\u7D22\u56FE\u6807", onChange: unref(debounceHandleSearchChange), allowClear: "" }, null, 8, ["onChange"]) ]) ]), content: withCtx(() => [ unref(getPaginationList).length ? (openBlock(), createElementBlock("div", _hoisted_2$3, [ createVNode(unref(BzScrollContainer), { style: { "height": "220px" } }, { default: withCtx(() => [ createElementVNode("ul", _hoisted_3$1, [ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getPaginationList), (icon) => { return openBlock(), createElementBlock("li", { key: icon, class: normalizeClass([currentSelect.value === icon ? "border border-primary" : "", "p-8 w-1/8 cursor-pointer mr-8 mt-8 flex justify-center items-center border border-solid hover:border-primary"]), onClick: ($event) => handleClick5(icon), title: icon }, [ isSvgMode ? (openBlock(), createBlock(bzSvgIcon, { key: 0, name: icon }, null, 8, ["name"])) : (openBlock(), createBlock(Icon$2, { key: 1, icon }, null, 8, ["icon"])) ], 10, _hoisted_4); }), 128)) ]) ]), _: 1 }), unref(getTotal) >= __props.pageSize ? (openBlock(), createElementBlock("div", _hoisted_5, [ createVNode(unref(APagination), { showLessItems: "", size: "small", pageSize: __props.pageSize, total: unref(getTotal), onChange: handlePageChange2 }, null, 8, ["pageSize", "total"]) ])) : createCommentVNode("", true) ])) : (openBlock(), createElementBlock("div", _hoisted_6, [ createVNode(unref(AEmpty)) ])) ]), default: withCtx(() => [ isSvgMode && currentSelect.value ? (openBlock(), createElementBlock("span", _hoisted_7, [ createVNode(bzSvgIcon, { name: currentSelect.value }, null, 8, ["name"]) ])) : (openBlock(), createBlock(Icon$2, { key: 1, icon: currentSelect.value || "ion:apps-outline", class: "cursor-pointer px-8 py-4" }, null, 8, ["icon"])) ]), _: 1 }, 8, ["modelValue", "overlayClassName"]) ]), _: 1 }, 8, ["style", "class", "value"]); }; } })); const BzIcon = withInstall$1(Icon$2); const BzSvgIcon = withInstall$1(bzSvgIcon); const BzIconPicker = withInstall$1(_sfc_main$D); const __default__$2 = { name: "BzArrow" }; const _sfc_main$C = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), { props: { expand: { type: Boolean }, up: { type: Boolean }, down: { type: Boolean }, inset: { type: Boolean } }, setup(__props) { const props2 = __props; const { prefixCls: prefixCls2 } = useDesign("basic-arrow"); const getClass2 = computed(() => { const { expand, up: up2, down: down2, inset } = props2; return [ prefixCls2, { [`${prefixCls2}--active`]: expand, up: up2, inset, down: down2 } ]; }); return (_ctx, _cache) => { return openBlock(), createElementBlock("span", { class: normalizeClass(unref(getClass2)) }, [ createVNode(unref(BzIcon), { icon: "ion:chevron-forward", style: normalizeStyle(_ctx.$attrs.iconStyle) }, null, 8, ["style"]) ], 2); }; } })); var index$v = ""; var hueStep = 2; var saturationStep = 0.16; var saturationStep2 = 0.05; var brightnessStep1 = 0.05; var brightnessStep2 = 0.15; var lightColorCount = 5; var darkColorCount = 4; var darkColorMap = [{ index: 7, opacity: 0.15 }, { index: 6, opacity: 0.25 }, { index: 5, opacity: 0.3 }, { index: 5, opacity: 0.45 }, { index: 5, opacity: 0.65 }, { index: 5, opacity: 0.85 }, { index: 4, opacity: 0.9 }, { index: 3, opacity: 0.95 }, { index: 2, opacity: 0.97 }, { index: 1, opacity: 0.98 }]; function getHue(hsv, i2, light) { var hue; if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) { hue = light ? Math.round(hsv.h) - hueStep * i2 : Math.round(hsv.h) + hueStep * i2; } else { hue = light ? Math.round(hsv.h) + hueStep * i2 : Math.round(hsv.h) - hueStep * i2; } if (hue < 0) { hue += 360; } else if (hue >= 360) { hue -= 360; } return hue; } function getSaturation(hsv, i2, light) { if (hsv.h === 0 && hsv.s === 0) { return hsv.s; } var saturation; if (light) { saturation = hsv.s - saturationStep * i2; } else if (i2 === darkColorCount) { saturation = hsv.s + saturationStep; } else { saturation = hsv.s + saturationStep2 * i2; } if (saturation > 1) { saturation = 1; } if (light && i2 === lightColorCount && saturation > 0.1) { saturation = 0.1; } if (saturation < 0.06) { saturation = 0.06; } return Number(saturation.toFixed(2)); } function getValue(hsv, i2, light) { var value24; if (light) { value24 = hsv.v + brightnessStep1 * i2; } else { value24 = hsv.v - brightnessStep2 * i2; } if (value24 > 1) { value24 = 1; } return Number(value24.toFixed(2)); } function generate$1(color) { var opts2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var patterns = []; var pColor = new TinyColor(color); for (var i2 = lightColorCount; i2 > 0; i2 -= 1) { var hsv = pColor.toHsv(); var colorString = new TinyColor({ h: getHue(hsv, i2, true), s: getSaturation(hsv, i2, true), v: getValue(hsv, i2, true) }).toHexString(); patterns.push(colorString); } patterns.push(pColor.toHexString()); for (var _i = 1; _i <= darkColorCount; _i += 1) { var _hsv = pColor.toHsv(); var _colorString = new TinyColor({ h: getHue(_hsv, _i), s: getSaturation(_hsv, _i), v: getValue(_hsv, _i) }).toHexString(); patterns.push(_colorString); } if (opts2.theme === "dark") { return darkColorMap.map(function(_ref) { var index2 = _ref.index, opacity = _ref.opacity; var darkColorString = new TinyColor(opts2.backgroundColor || "#141414").mix(patterns[index2], opacity * 100).toHexString(); return darkColorString; }); } return patterns; } var presetPrimaryColors = { red: "#F5222D", volcano: "#FA541C", orange: "#FA8C16", gold: "#FAAD14", yellow: "#FADB14", lime: "#A0D911", green: "#52C41A", cyan: "#13C2C2", blue: "#1890FF", geekblue: "#2F54EB", purple: "#722ED1", magenta: "#EB2F96", grey: "#666666" }; var presetPalettes = {}; var presetDarkPalettes = {}; Object.keys(presetPrimaryColors).forEach(function(key2) { presetPalettes[key2] = generate$1(presetPrimaryColors[key2]); presetPalettes[key2].primary = presetPalettes[key2][5]; presetDarkPalettes[key2] = generate$1(presetPrimaryColors[key2], { theme: "dark", backgroundColor: "#141414" }); presetDarkPalettes[key2].primary = presetDarkPalettes[key2][5]; }); presetPalettes.red; presetPalettes.volcano; presetPalettes.gold; presetPalettes.orange; presetPalettes.yellow; presetPalettes.lime; presetPalettes.green; presetPalettes.cyan; presetPalettes.blue; presetPalettes.geekblue; presetPalettes.purple; presetPalettes.magenta; presetPalettes.grey; var containers = []; var styleElements = []; var usage = "insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options])."; function createStyleElement() { var styleElement = document.createElement("style"); styleElement.setAttribute("type", "text/css"); return styleElement; } function insertCss(css2, options2) { options2 = options2 || {}; if (css2 === void 0) { throw new Error(usage); } var position2 = options2.prepend === true ? "prepend" : "append"; var container = options2.container !== void 0 ? options2.container : document.querySelector("head"); var containerId = containers.indexOf(container); if (containerId === -1) { containerId = containers.push(container) - 1; styleElements[containerId] = {}; } var styleElement; if (styleElements[containerId] !== void 0 && styleElements[containerId][position2] !== void 0) { styleElement = styleElements[containerId][position2]; } else { styleElement = styleElements[containerId][position2] = createStyleElement(); if (position2 === "prepend") { container.insertBefore(styleElement, container.childNodes[0]); } else { container.appendChild(styleElement); } } if (css2.charCodeAt(0) === 65279) { css2 = css2.substr(1, css2.length); } if (styleElement.styleSheet) { styleElement.styleSheet.cssText += css2; } else { styleElement.textContent += css2; } return styleElement; } function _objectSpread$g(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$g(target, key2, source2[key2]); }); } return target; } function _defineProperty$g(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } function warning(valid, message2) { } function isIconDefinition(target) { return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function"); } function generate(node, key2, rootProps) { if (!rootProps) { return h$2(node.tag, _objectSpread$g({ key: key2 }, node.attrs), (node.children || []).map(function(child, index2) { return generate(child, "".concat(key2, "-").concat(node.tag, "-").concat(index2)); })); } return h$2(node.tag, _objectSpread$g({ key: key2 }, rootProps, node.attrs), (node.children || []).map(function(child, index2) { return generate(child, "".concat(key2, "-").concat(node.tag, "-").concat(index2)); })); } function getSecondaryColor(primaryColor) { return generate$1(primaryColor)[0]; } function normalizeTwoToneColors(twoToneColor) { if (!twoToneColor) { return []; } return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor]; } var iconStyles = "\n.anticon {\n display: inline-block;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n"; var cssInjectedFlag = false; var useInsertStyles = function useInsertStyles3() { var styleStr = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : iconStyles; nextTick(function() { if (!cssInjectedFlag) { if (typeof window !== "undefined" && window.document && window.document.documentElement) { insertCss(styleStr, { prepend: true }); } cssInjectedFlag = true; } }); }; function _objectWithoutProperties$1(source2, excluded) { if (source2 == null) return {}; var target = _objectWithoutPropertiesLoose$1(source2, excluded); var key2, i2; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source2); for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { key2 = sourceSymbolKeys[i2]; if (excluded.indexOf(key2) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source2, key2)) continue; target[key2] = source2[key2]; } } return target; } function _objectWithoutPropertiesLoose$1(source2, excluded) { if (source2 == null) return {}; var target = {}; var sourceKeys = Object.keys(source2); var key2, i2; for (i2 = 0; i2 < sourceKeys.length; i2++) { key2 = sourceKeys[i2]; if (excluded.indexOf(key2) >= 0) continue; target[key2] = source2[key2]; } return target; } function _objectSpread$f(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$f(target, key2, source2[key2]); }); } return target; } function _defineProperty$f(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var twoToneColorPalette = { primaryColor: "#333", secondaryColor: "#E6E6E6", calculated: false }; function setTwoToneColors(_ref) { var primaryColor = _ref.primaryColor, secondaryColor = _ref.secondaryColor; twoToneColorPalette.primaryColor = primaryColor; twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor); twoToneColorPalette.calculated = !!secondaryColor; } function getTwoToneColors() { return _objectSpread$f({}, twoToneColorPalette); } var IconBase = function IconBase3(props2, context2) { var _props$context$attrs = _objectSpread$f({}, props2, context2.attrs), icon = _props$context$attrs.icon, primaryColor = _props$context$attrs.primaryColor, secondaryColor = _props$context$attrs.secondaryColor, restProps = _objectWithoutProperties$1(_props$context$attrs, ["icon", "primaryColor", "secondaryColor"]); var colors = twoToneColorPalette; if (primaryColor) { colors = { primaryColor, secondaryColor: secondaryColor || getSecondaryColor(primaryColor) }; } useInsertStyles(); warning(isIconDefinition(icon)); if (!isIconDefinition(icon)) { return null; } var target = icon; if (target && typeof target.icon === "function") { target = _objectSpread$f({}, target, { icon: target.icon(colors.primaryColor, colors.secondaryColor) }); } return generate(target.icon, "svg-".concat(target.name), _objectSpread$f({}, restProps, { "data-icon": target.name, width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true" })); }; IconBase.props = { icon: Object, primaryColor: String, secondaryColor: String, focusable: String }; IconBase.inheritAttrs = false; IconBase.displayName = "IconBase"; IconBase.getTwoToneColors = getTwoToneColors; IconBase.setTwoToneColors = setTwoToneColors; var VueIcon = IconBase; function _slicedToArray$1(arr, i2) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i2) || _unsupportedIterableToArray$1(arr, i2) || _nonIterableRest$1(); } function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray$1(o2, minLen) { if (!o2) return; if (typeof o2 === "string") return _arrayLikeToArray$1(o2, minLen); var n2 = Object.prototype.toString.call(o2).slice(8, -1); if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; if (n2 === "Map" || n2 === "Set") return Array.from(o2); if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$1(o2, minLen); } function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) { arr2[i2] = arr[i2]; } return arr2; } function _iterableToArrayLimit$1(arr, i2) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = void 0; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i2 && _arr.length === i2) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; } function setTwoToneColor(twoToneColor) { var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor), _normalizeTwoToneColo2 = _slicedToArray$1(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1]; return VueIcon.setTwoToneColors({ primaryColor, secondaryColor }); } function getTwoToneColor() { var colors = VueIcon.getTwoToneColors(); if (!colors.calculated) { return colors.primaryColor; } return [colors.primaryColor, colors.secondaryColor]; } function _slicedToArray(arr, i2) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i2) || _unsupportedIterableToArray(arr, i2) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o2, minLen) { if (!o2) return; if (typeof o2 === "string") return _arrayLikeToArray(o2, minLen); var n2 = Object.prototype.toString.call(o2).slice(8, -1); if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; if (n2 === "Map" || n2 === "Set") return Array.from(o2); if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray(o2, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) { arr2[i2] = arr[i2]; } return arr2; } function _iterableToArrayLimit(arr, i2) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = void 0; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i2 && _arr.length === i2) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _objectSpread$e(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$e(target, key2, source2[key2]); }); } return target; } function _defineProperty$e(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } function _objectWithoutProperties(source2, excluded) { if (source2 == null) return {}; var target = _objectWithoutPropertiesLoose(source2, excluded); var key2, i2; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source2); for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { key2 = sourceSymbolKeys[i2]; if (excluded.indexOf(key2) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source2, key2)) continue; target[key2] = source2[key2]; } } return target; } function _objectWithoutPropertiesLoose(source2, excluded) { if (source2 == null) return {}; var target = {}; var sourceKeys = Object.keys(source2); var key2, i2; for (i2 = 0; i2 < sourceKeys.length; i2++) { key2 = sourceKeys[i2]; if (excluded.indexOf(key2) >= 0) continue; target[key2] = source2[key2]; } return target; } setTwoToneColor("#1890ff"); var Icon = function Icon3(props2, context2) { var _classObj; var _props$context$attrs = _objectSpread$e({}, props2, context2.attrs), cls = _props$context$attrs["class"], icon = _props$context$attrs.icon, spin = _props$context$attrs.spin, rotate = _props$context$attrs.rotate, tabindex = _props$context$attrs.tabindex, twoToneColor = _props$context$attrs.twoToneColor, onClick7 = _props$context$attrs.onClick, restProps = _objectWithoutProperties(_props$context$attrs, ["class", "icon", "spin", "rotate", "tabindex", "twoToneColor", "onClick"]); var classObj = (_classObj = { anticon: true }, _defineProperty$e(_classObj, "anticon-".concat(icon.name), Boolean(icon.name)), _defineProperty$e(_classObj, cls, cls), _classObj); var svgClassString = spin === "" || !!spin || icon.name === "loading" ? "anticon-spin" : ""; var iconTabIndex = tabindex; if (iconTabIndex === void 0 && onClick7) { iconTabIndex = -1; restProps.tabindex = iconTabIndex; } var svgStyle = rotate ? { msTransform: "rotate(".concat(rotate, "deg)"), transform: "rotate(".concat(rotate, "deg)") } : void 0; var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor), _normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1]; return _vue.createVNode("span", _vue.mergeProps(restProps, { "role": "img", "aria-label": icon.name, "onClick": onClick7, "class": classObj }), [_vue.createVNode(VueIcon, { "class": svgClassString, "icon": icon, "primaryColor": primaryColor, "secondaryColor": secondaryColor, "style": svgStyle }, null)]); }; Icon.props = { spin: Boolean, rotate: Number, icon: Object, twoToneColor: String }; Icon.displayName = "AntdIcon"; Icon.inheritAttrs = false; Icon.getTwoToneColor = getTwoToneColor; Icon.setTwoToneColor = setTwoToneColor; var AntdIcon = Icon; function _objectSpread$d(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$d(target, key2, source2[key2]); }); } return target; } function _defineProperty$d(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var ArrowLeftOutlined = function ArrowLeftOutlined3(props2, context2) { var p = _objectSpread$d({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": ArrowLeftOutlinedSvg }), null); }; ArrowLeftOutlined.displayName = "ArrowLeftOutlined"; ArrowLeftOutlined.inheritAttrs = false; var ArrowLeftOutlined$1 = ArrowLeftOutlined; function _objectSpread$c(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$c(target, key2, source2[key2]); }); } return target; } function _defineProperty$c(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CheckCircleFilled = function CheckCircleFilled3(props2, context2) { var p = _objectSpread$c({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": CheckCircleFilledSvg }), null); }; CheckCircleFilled.displayName = "CheckCircleFilled"; CheckCircleFilled.inheritAttrs = false; var CheckCircleFilled$1 = CheckCircleFilled; function _objectSpread$b(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$b(target, key2, source2[key2]); }); } return target; } function _defineProperty$b(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CheckOutlined = function CheckOutlined3(props2, context2) { var p = _objectSpread$b({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": CheckOutlinedSvg }), null); }; CheckOutlined.displayName = "CheckOutlined"; CheckOutlined.inheritAttrs = false; var CheckOutlined$1 = CheckOutlined; function _objectSpread$a(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$a(target, key2, source2[key2]); }); } return target; } function _defineProperty$a(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CloseCircleFilled = function CloseCircleFilled3(props2, context2) { var p = _objectSpread$a({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": CloseCircleFilledSvg }), null); }; CloseCircleFilled.displayName = "CloseCircleFilled"; CloseCircleFilled.inheritAttrs = false; var CloseCircleFilled$1 = CloseCircleFilled; function _objectSpread$9(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$9(target, key2, source2[key2]); }); } return target; } function _defineProperty$9(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var CloseOutlined = function CloseOutlined3(props2, context2) { var p = _objectSpread$9({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": CloseOutlinedSvg }), null); }; CloseOutlined.displayName = "CloseOutlined"; CloseOutlined.inheritAttrs = false; var CloseOutlined$1 = CloseOutlined; var FormOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M904 512h-56c-4.4 0-8 3.6-8 8v320H184V184h320c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V520c0-4.4-3.6-8-8-8z" } }, { "tag": "path", "attrs": { "d": "M355.9 534.9L354 653.8c-.1 8.9 7.1 16.2 16 16.2h.4l118-2.9c2-.1 4-.9 5.4-2.3l415.9-415c3.1-3.1 3.1-8.2 0-11.3L785.4 114.3c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-415.8 415a8.3 8.3 0 00-2.3 5.6zm63.5 23.6L779.7 199l45.2 45.1-360.5 359.7-45.7 1.1.7-46.4z" } }] }, "name": "form", "theme": "outlined" }; var FormOutlinedSvg = FormOutlined$2; function _objectSpread$8(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$8(target, key2, source2[key2]); }); } return target; } function _defineProperty$8(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var FormOutlined = function FormOutlined2(props2, context2) { var p = _objectSpread$8({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": FormOutlinedSvg }), null); }; FormOutlined.displayName = "FormOutlined"; FormOutlined.inheritAttrs = false; var FormOutlined$1 = FormOutlined; var FullscreenExitOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M391 240.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L200 146.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L280 333.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L401 410c5.1.6 9.5-3.7 8.9-8.9L391 240.9zm10.1 373.2L240.8 633c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L146.3 824a8.03 8.03 0 000 11.3l42.4 42.3c3.1 3.1 8.2 3.1 11.3 0L333.7 744l43.7 43.7A8.01 8.01 0 00391 783l18.9-160.1c.6-5.1-3.7-9.4-8.8-8.8zm221.8-204.2L783.2 391c6.6-.8 9.4-8.9 4.7-13.6L744 333.6 877.7 200c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.3a8.03 8.03 0 00-11.3 0L690.3 279.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L614.1 401c-.6 5.2 3.7 9.5 8.8 8.9zM744 690.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L623 614c-5.1-.6-9.5 3.7-8.9 8.9L633 783.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L824 877.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L744 690.4z" } }] }, "name": "fullscreen-exit", "theme": "outlined" }; var FullscreenExitOutlinedSvg = FullscreenExitOutlined$2; function _objectSpread$7(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$7(target, key2, source2[key2]); }); } return target; } function _defineProperty$7(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var FullscreenExitOutlined = function FullscreenExitOutlined2(props2, context2) { var p = _objectSpread$7({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": FullscreenExitOutlinedSvg }), null); }; FullscreenExitOutlined.displayName = "FullscreenExitOutlined"; FullscreenExitOutlined.inheritAttrs = false; var FullscreenExitOutlined$1 = FullscreenExitOutlined; var FullscreenOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M290 236.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0013.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 000 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 00-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z" } }] }, "name": "fullscreen", "theme": "outlined" }; var FullscreenOutlinedSvg = FullscreenOutlined$2; function _objectSpread$6(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$6(target, key2, source2[key2]); }); } return target; } function _defineProperty$6(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var FullscreenOutlined = function FullscreenOutlined2(props2, context2) { var p = _objectSpread$6({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": FullscreenOutlinedSvg }), null); }; FullscreenOutlined.displayName = "FullscreenOutlined"; FullscreenOutlined.inheritAttrs = false; var FullscreenOutlined$1 = FullscreenOutlined; function _objectSpread$5(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$5(target, key2, source2[key2]); }); } return target; } function _defineProperty$5(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var InfoCircleFilled = function InfoCircleFilled3(props2, context2) { var p = _objectSpread$5({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": InfoCircleFilledSvg }), null); }; InfoCircleFilled.displayName = "InfoCircleFilled"; InfoCircleFilled.inheritAttrs = false; var InfoCircleFilled$1 = InfoCircleFilled; function _objectSpread$4(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$4(target, key2, source2[key2]); }); } return target; } function _defineProperty$4(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var InfoCircleOutlined = function InfoCircleOutlined3(props2, context2) { var p = _objectSpread$4({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": InfoCircleOutlinedSvg }), null); }; InfoCircleOutlined.displayName = "InfoCircleOutlined"; InfoCircleOutlined.inheritAttrs = false; var InfoCircleOutlined$1 = InfoCircleOutlined; function _objectSpread$3(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$3(target, key2, source2[key2]); }); } return target; } function _defineProperty$3(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var LeftOutlined = function LeftOutlined3(props2, context2) { var p = _objectSpread$3({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": LeftOutlinedSvg }), null); }; LeftOutlined.displayName = "LeftOutlined"; LeftOutlined.inheritAttrs = false; var LeftOutlined$1 = LeftOutlined; function _objectSpread$2(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$2(target, key2, source2[key2]); }); } return target; } function _defineProperty$2(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var LoadingOutlined = function LoadingOutlined3(props2, context2) { var p = _objectSpread$2({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": LoadingOutlinedSvg }), null); }; LoadingOutlined.displayName = "LoadingOutlined"; LoadingOutlined.inheritAttrs = false; var LoadingOutlined$1 = LoadingOutlined; var MoreOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M456 231a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "more", "theme": "outlined" }; var MoreOutlinedSvg = MoreOutlined$2; function _objectSpread$1(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty$1(target, key2, source2[key2]); }); } return target; } function _defineProperty$1(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var MoreOutlined = function MoreOutlined2(props2, context2) { var p = _objectSpread$1({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": MoreOutlinedSvg }), null); }; MoreOutlined.displayName = "MoreOutlined"; MoreOutlined.inheritAttrs = false; var MoreOutlined$1 = MoreOutlined; function _objectSpread(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source2 = arguments[i2] != null ? Object(arguments[i2]) : {}; var ownKeys2 = Object.keys(source2); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source2).filter(function(sym) { return Object.getOwnPropertyDescriptor(source2, sym).enumerable; })); } ownKeys2.forEach(function(key2) { _defineProperty(target, key2, source2[key2]); }); } return target; } function _defineProperty(obj, key2, value24) { if (key2 in obj) { Object.defineProperty(obj, key2, { value: value24, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value24; } return obj; } var RightOutlined = function RightOutlined3(props2, context2) { var p = _objectSpread({}, props2, context2.attrs); return _vue.createVNode(AntdIcon, _vue.mergeProps(p, { "icon": RightOutlinedSvg }), null); }; RightOutlined.displayName = "RightOutlined"; RightOutlined.inheritAttrs = false; var RightOutlined$1 = RightOutlined; const props$4 = { maxWidth: { type: String, default: "600px" }, showIndex: { type: Boolean }, color: { type: String, default: "#ffffff" }, fontSize: { type: String, default: "14px" }, placement: { type: String, default: "right" }, text: { type: [Array, String] } }; var _sfc_main$B = defineComponent({ name: "BzHelp", components: { Tooltip }, props: props$4, setup(props2, { slots }) { const { prefixCls: prefixCls2 } = useDesign("basic-help"); const getTooltipStyle = computed(() => ({ color: props2.color, fontSize: props2.fontSize })); const getOverlayStyle = computed(() => ({ maxWidth: props2.maxWidth })); function renderTitle2() { const textList = props2.text; if (isString$3(textList)) { return createVNode("p", null, [textList]); } if (isArray$8(textList)) { return textList.map((text, index2) => { return createVNode("p", { "key": text }, [createVNode(Fragment, null, [props2.showIndex ? `${index2 + 1}. ` : "", text])]); }); } return null; } return () => { return createVNode(Tooltip, { "overlayClassName": `${prefixCls2}__wrap`, "title": createVNode("div", { "style": unref(getTooltipStyle) }, [renderTitle2()]), "autoAdjustOverflow": true, "overlayStyle": unref(getOverlayStyle), "placement": props2.placement, "getPopupContainer": () => getPopupContainer() }, { default: () => [createVNode("span", { "class": prefixCls2 }, [getSlot(slots) || createVNode(InfoCircleOutlined$1, null, null)])] }); }; } }); const __default__$1 = { name: "BzTitle" }; const _sfc_main$A = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), { props: { helpMessage: { type: [String, Array], default: "" }, span: { type: Boolean }, normal: { type: Boolean } }, setup(__props) { const props2 = __props; const { prefixCls: prefixCls2 } = useDesign("basic-title"); const slots = useSlots(); const getClass2 = computed(() => [ prefixCls2, { [`${prefixCls2}-show-span`]: props2.span && slots.default }, { [`${prefixCls2}-normal`]: props2.normal } ]); return (_ctx, _cache) => { return openBlock(), createElementBlock("span", { class: normalizeClass(unref(getClass2)) }, [ renderSlot(_ctx.$slots, "default"), __props.helpMessage ? (openBlock(), createBlock(_sfc_main$B, { key: 0, class: normalizeClass(`${unref(prefixCls2)}-help`), text: __props.helpMessage }, null, 8, ["class", "text"])) : createCommentVNode("", true) ], 2); }; } })); const BzArrow = withInstall$1(_sfc_main$C); const BzTitle = withInstall$1(_sfc_main$A); const BzHelp = withInstall$1(_sfc_main$B); const buttonProps = { color: { type: String, validator: (v2) => ["error", "warning", "success", ""].includes(v2) }, loading: { type: Boolean }, disabled: { type: Boolean }, preIcon: { type: String }, postIcon: { type: String }, iconSize: { type: Number, default: 14 }, onClick: { type: Function, default: null } }; const DEFAULT_EXCLUDE_KEYS = ["class", "style"]; const LISTENER_PREFIX = /^on[A-Z]/; function entries(obj) { return Object.keys(obj).map((key2) => [key2, obj[key2]]); } function useAttrs(params = {}) { const instance = getCurrentInstance(); if (!instance) return {}; const { excludeListeners = false, excludeKeys = [], excludeDefaultKeys = true } = params; const attrs = shallowRef({}); const allExcludeKeys = excludeKeys.concat(excludeDefaultKeys ? DEFAULT_EXCLUDE_KEYS : []); instance.attrs = reactive(instance.attrs); watchEffect(() => { const res = entries(instance.attrs).reduce((acm, [key2, val]) => { if (!allExcludeKeys.includes(key2) && !(excludeListeners && LISTENER_PREFIX.test(key2))) { acm[key2] = val; } return acm; }, {}); attrs.value = res; }); return attrs; } const _sfc_main$z = defineComponent({ name: "BzButton", inheritAttrs: false, components: { Button: Button$1, Icon: Icon$2 }, props: buttonProps, setup(props2) { const attrs = useAttrs({ excludeDefaultKeys: false }); const getButtonClass = computed(() => { const { color, disabled } = props2; return [ { [`ant-btn-${color}`]: !!color, [`is-disabled`]: disabled } ]; }); const getBindValue = computed(() => __spreadValues(__spreadValues({}, unref(attrs)), props2)); return { getButtonClass, getBindValue }; } }); function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) { const _component_Icon = resolveComponent("Icon"); const _component_Button = resolveComponent("Button"); return openBlock(), createBlock(_component_Button, mergeProps$1(_ctx.getBindValue, { class: _ctx.getButtonClass, onClick: _ctx.onClick }), { default: withCtx((data65) => [ _ctx.preIcon ? (openBlock(), createBlock(_component_Icon, { key: 0, icon: _ctx.preIcon, size: _ctx.iconSize }, null, 8, ["icon", "size"])) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(data65 || {}))), _ctx.postIcon ? (openBlock(), createBlock(_component_Icon, { key: 1, icon: _ctx.postIcon, size: _ctx.iconSize }, null, 8, ["icon", "size"])) : createCommentVNode("", true) ]), _: 3 }, 16, ["class", "onClick"]); } var bzButton = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$t]]); const props$3 = { enable: { type: Boolean, default: true } }; const _sfc_main$y = defineComponent({ name: "PopButton", inheritAttrs: false, props: props$3, setup(props2, { slots }) { const attrs = useAttrs(); const getBindValues = computed(() => { return Object.assign({ okText: "\u786E\u5B9A", cancelText: "\u53D6\u6D88" }, __spreadValues(__spreadValues({}, props2), unref(attrs))); }); return () => { const bindValues = omit$2(unref(getBindValues), "icon"); const btnBind = omit$2(bindValues, "title"); if (btnBind.disabled) btnBind.color = ""; const Button2 = h$2(bzButton, btnBind, extendSlots(slots)); if (!props2.enable) { return Button2; } return h$2(Popconfirm$1, bindValues, { default: () => Button2 }); }; } }); const BzButton = withInstall$1(bzButton); const PopConfirmButton = withInstall$1(_sfc_main$y); var index$u = ""; var index$t = ""; var index$s = ""; var index$r = ""; const pickerProps = { pickerValue: { type: Object }, radioOptions: { type: Array, default: () => { return [ { key: "\u4ECA\u5929", setValue: () => { return [hooks().startOf("day"), hooks()]; } }, { key: "\u8FD124\u5C0F\u65F6", setValue: () => { return [hooks().subtract(24, "hour"), hooks()]; } }, { key: "\u8FD13\u5929", setValue: () => { return [hooks().subtract(3, "day"), hooks()]; } }, { key: "\u8FD17\u5929", setValue: () => { return [hooks().subtract(7, "day"), hooks()]; } } ]; } }, radioProps: { type: Object } }; const _sfc_main$x = defineComponent({ name: "BzRangePicker", components: { RadioButton: Radio.Button, RadioGroup: Radio.Group, RangePicker: DatePicker$1.RangePicker }, props: pickerProps, emits: ["change", "update:pickerValue"], setup(props2, { emit: emit2 }) { var _a3, _b2; const attrs = useAttrs({ excludeDefaultKeys: false }); const options2 = computed(() => { return props2.radioOptions.map((d2, index2) => ({ id: `${d2}-${index2}`, value: d2 })); }); const rangePickerValue = ref({ key: (_a3 = props2.pickerValue) == null ? void 0 : _a3.key, value: (_b2 = props2.pickerValue) == null ? void 0 : _b2.value }); watch(() => props2.pickerValue, (val) => { rangePickerValue.value = val; }, { immediate: true }); const radioGroupChange = (e2) => { const value24 = e2.target.value; if (value24 === "\u81EA\u5B9A\u4E49") { showDatePicker.value = true; rangePickerValue.value = { key: value24, value: null }; } else { showDatePicker.value = false; const radio = props2.radioOptions.find((d2) => d2.key == value24); rangePickerValue.value = { key: value24, value: (radio == null ? void 0 : radio.setValue) && (radio == null ? void 0 : radio.setValue()) }; emit2("update:pickerValue", rangePickerValue.value); emit2("change", rangePickerValue.value); } }; const onCustomizeClick = () => { if (showDatePicker.value === false) { showDatePicker.value = true; } }; const getBindValue = computed(() => __spreadProps(__spreadValues({}, unref(attrs)), { "v-model:value": rangePickerValue.value.value })); const getBindRadioValue = computed(() => __spreadValues({}, props2.radioProps)); const onChange8 = (dates) => { showDatePicker.value = false; rangePickerValue.value = { key: "\u81EA\u5B9A\u4E49", value: dates }; emit2("change", rangePickerValue.value); emit2("update:pickerValue", rangePickerValue.value); }; const showDatePicker = ref(false); return { rangePickerValue, getBindValue, getBindRadioValue, options: options2, radioGroupChange, onCustomizeClick, attrs, showDatePicker, onChange: onChange8 }; } }); const _hoisted_1$a = /* @__PURE__ */ createTextVNode("\u81EA\u5B9A\u4E49"); const _hoisted_2$2 = /* @__PURE__ */ createElementVNode("span", null, null, -1); function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) { const _component_RadioButton = resolveComponent("RadioButton"); const _component_RadioGroup = resolveComponent("RadioGroup"); const _component_RangePicker = resolveComponent("RangePicker"); return openBlock(), createElementBlock("div", null, [ createVNode(_component_RadioGroup, mergeProps$1(_ctx.getBindRadioValue, { onChange: _ctx.radioGroupChange, value: _ctx.rangePickerValue.key, "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.rangePickerValue.key = $event) }), { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList([..._ctx.radioOptions], (item) => { return openBlock(), createBlock(_component_RadioButton, { value: item.key }, { default: withCtx(() => [ createTextVNode(toDisplayString(item.key), 1) ]), _: 2 }, 1032, ["value"]); }), 256)), createVNode(_component_RadioButton, { value: "\u81EA\u5B9A\u4E49", onClick: _ctx.onCustomizeClick }, { default: withCtx(() => [ _hoisted_1$a ]), _: 1 }, 8, ["onClick"]) ]), _: 1 }, 16, ["onChange", "value"]), createVNode(_component_RangePicker, mergeProps$1(_ctx.getBindValue, { onChange: _ctx.onChange, onOk: _ctx.onChange, open: _ctx.showDatePicker }), { default: withCtx(() => [ _hoisted_2$2 ]), _: 1 }, 16, ["onChange", "onOk", "open"]) ]); } var bzRangePicker = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render$s]]); const BzRangePicker = withInstall$1(bzRangePicker); var index$q = ""; var index$p = ""; var index$o = ""; var index$n = ""; var index$m = ""; function onMountedOrActivated(hook) { let mounted36; onMounted(() => { hook(); nextTick(() => { mounted36 = true; }); }); onActivated(() => { if (mounted36) { hook(); } }); } function useWindowSizeFn(fn, wait = 150, options2) { let handler7 = () => { fn(); }; const handleSize = useDebounceFn(handler7, wait); handler7 = handleSize; const start = () => { if (options2 && options2.immediate) { handler7(); } window.addEventListener("resize", handler7); }; const stop2 = () => { window.removeEventListener("resize", handler7); }; tryOnMounted(() => { start(); }); tryOnUnmounted(() => { stop2(); }); return [start, stop2]; } function useContentHeight(flag, anchorRef, subtractHeightRefs, substractSpaceRefs, upwardSpace = 0, offsetHeightRef = ref(0)) { const contentHeight = ref(null); let compensationHeight = { useLayoutFooter: true }; const setCompensation = (params) => { compensationHeight = params; }; function redoHeight() { nextTick(() => { calcContentHeight(); }); } function calcSubtractSpace(element, direction = "all") { var _a3, _b2, _c, _d; function numberPx(px) { return Number(px.replace(/[^\d]/g, "")); } let subtractHeight = 0; const ZERO_PX = "0px"; if (element) { const cssStyle = getComputedStyle(element); const marginTop = numberPx((_a3 = cssStyle == null ? void 0 : cssStyle.marginTop) != null ? _a3 : ZERO_PX); const marginBottom = numberPx((_b2 = cssStyle == null ? void 0 : cssStyle.marginBottom) != null ? _b2 : ZERO_PX); const paddingTop = numberPx((_c = cssStyle == null ? void 0 : cssStyle.paddingTop) != null ? _c : ZERO_PX); const paddingBottom = numberPx((_d = cssStyle == null ? void 0 : cssStyle.paddingBottom) != null ? _d : ZERO_PX); if (direction === "all") { subtractHeight += marginTop; subtractHeight += marginBottom; subtractHeight += paddingTop; subtractHeight += paddingBottom; } else if (direction === "top") { subtractHeight += marginTop; subtractHeight += paddingTop; } else { subtractHeight += marginBottom; subtractHeight += paddingBottom; } } return subtractHeight; } function getEl(element) { if (element == null) { return null; } return element instanceof HTMLDivElement ? element : element.$el; } async function calcContentHeight() { var _a3; if (!flag.value) { return; } await nextTick(); const anchorEl = getEl(unref(anchorRef)); if (!anchorEl) { return; } const { bottomIncludeBody } = getViewportOffset(anchorEl); let substractHeight = 0; subtractHeightRefs.forEach((item) => { var _a4, _b2; substractHeight += (_b2 = (_a4 = getEl(unref(item))) == null ? void 0 : _a4.offsetHeight) != null ? _b2 : 0; }); let substractSpaceHeight = (_a3 = calcSubtractSpace(anchorEl)) != null ? _a3 : 0; substractSpaceRefs.forEach((item) => { substractSpaceHeight += calcSubtractSpace(getEl(unref(item))); }); let upwardSpaceHeight = 0; function upward(element, upwardLvlOrClass) { if (element && upwardLvlOrClass) { const parent2 = element.parentElement; if (parent2) { if (isString$3(upwardLvlOrClass)) { if (!parent2.classList.contains(upwardLvlOrClass)) { upwardSpaceHeight += calcSubtractSpace(parent2, "bottom"); upward(parent2, upwardLvlOrClass); } else { upwardSpaceHeight += calcSubtractSpace(parent2, "bottom"); } } else if (isNumber$3(upwardLvlOrClass)) { if (upwardLvlOrClass > 0) { upwardSpaceHeight += calcSubtractSpace(parent2, "bottom"); upward(parent2, --upwardLvlOrClass); } } } } } if (isRef(upwardSpace)) { upward(anchorEl, unref(upwardSpace)); } else { upward(anchorEl, upwardSpace); } let height = bottomIncludeBody - unref(offsetHeightRef) - substractHeight - substractSpaceHeight - upwardSpaceHeight; const calcCompensationHeight = () => { var _a4; (_a4 = compensationHeight.elements) == null ? void 0 : _a4.forEach((item) => { var _a5, _b2; height += (_b2 = (_a5 = getEl(unref(item))) == null ? void 0 : _a5.offsetHeight) != null ? _b2 : 0; }); }; calcCompensationHeight(); contentHeight.value = height; } onMountedOrActivated(() => { nextTick(() => { calcContentHeight(); }); }); useWindowSizeFn(() => { calcContentHeight(); }, 50, { immediate: true }); return { redoHeight, setCompensation, contentHeight }; } const _sfc_main$w = defineComponent({ name: "BzPageWrapper", components: { PageHeader: PageHeader$1 }, inheritAttrs: false, props: { title: propTypes$1.string, dense: propTypes$1.bool, ghost: propTypes$1.bool, content: propTypes$1.string, contentStyle: { type: Object }, contentBackground: propTypes$1.bool, contentFullHeight: propTypes$1.bool, contentClass: propTypes$1.string, fixedHeight: propTypes$1.bool, upwardSpace: propTypes$1.oneOfType([propTypes$1.number, propTypes$1.string]).def(0) }, setup(props2, { slots, attrs }) { const wrapperRef = ref(null); const headerRef = ref(null); const contentRef = ref(null); const footerRef = ref(null); const { prefixCls: prefixCls2 } = useDesign("page-wrapper"); provide(PageWrapperFixedHeightKey, computed(() => props2.fixedHeight)); const getIsContentFullHeight = computed(() => { return props2.contentFullHeight; }); const getUpwardSpace = computed(() => props2.upwardSpace); const { redoHeight, setCompensation, contentHeight } = useContentHeight(getIsContentFullHeight, wrapperRef, [headerRef, footerRef], [contentRef], getUpwardSpace); setCompensation({ useLayoutFooter: true, elements: [footerRef] }); const getClass2 = computed(() => { var _a3; return [ prefixCls2, { [`${prefixCls2}--dense`]: props2.dense }, (_a3 = attrs.class) != null ? _a3 : {} ]; }); const getShowHeader = computed(() => props2.content || (slots == null ? void 0 : slots.headerContent) || props2.title || getHeaderSlots.value.length); const getShowFooter = computed(() => (slots == null ? void 0 : slots.leftFooter) || (slots == null ? void 0 : slots.rightFooter)); const getHeaderSlots = computed(() => { return Object.keys(omit$2(slots, "default", "leftFooter", "rightFooter", "headerContent")); }); const getContentStyle = computed(() => { const { contentFullHeight, contentStyle, fixedHeight } = props2; if (!contentFullHeight) { return __spreadValues({}, contentStyle); } const height = `${unref(contentHeight)}px`; return __spreadValues(__spreadProps(__spreadValues({}, contentStyle), { minHeight: height }), fixedHeight ? { height } : {}); }); const getContentClass = computed(() => { const { contentBackground, contentClass } = props2; return [ `${prefixCls2}-content`, contentClass, { [`${prefixCls2}-content-bg`]: contentBackground } ]; }); watch(() => [getShowFooter.value], () => { redoHeight(); }, { flush: "post", immediate: true }); return { getContentStyle, wrapperRef, headerRef, contentRef, footerRef, getClass: getClass2, getHeaderSlots, prefixCls: prefixCls2, getShowHeader, getShowFooter, omit: omit$2, getContentClass }; } }); function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) { const _component_PageHeader = resolveComponent("PageHeader"); return openBlock(), createElementBlock("div", { class: normalizeClass(_ctx.getClass), ref: "wrapperRef" }, [ _ctx.getShowHeader ? (openBlock(), createBlock(_component_PageHeader, mergeProps$1({ key: 0, ghost: _ctx.ghost, title: _ctx.title }, _ctx.omit(_ctx.$attrs, "class"), { ref: "headerRef" }), createSlots({ default: withCtx(() => [ _ctx.content ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ createTextVNode(toDisplayString(_ctx.content), 1) ], 64)) : renderSlot(_ctx.$slots, "headerContent", { key: 1 }) ]), _: 2 }, [ renderList(_ctx.getHeaderSlots, (item) => { return { name: item, fn: withCtx((data65) => [ renderSlot(_ctx.$slots, item, normalizeProps(guardReactiveProps(data65 || {}))) ]) }; }) ]), 1040, ["ghost", "title"])) : createCommentVNode("", true), createElementVNode("div", { class: normalizeClass(["overflow-hidden", _ctx.getContentClass]), style: normalizeStyle(_ctx.getContentStyle), ref: "contentRef" }, [ renderSlot(_ctx.$slots, "default") ], 6) ], 2); } var bzPageWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render$r]]); const BzPageWrapper = withInstall$1(bzPageWrapper); const PageWrapperFixedHeightKey = "PageWrapperFixedHeight"; var index$l = ""; var SizeEnum = /* @__PURE__ */ ((SizeEnum2) => { SizeEnum2["DEFAULT"] = "default"; SizeEnum2["SMALL"] = "small"; SizeEnum2["LARGE"] = "large"; return SizeEnum2; })(SizeEnum || {}); (() => { const map2 = /* @__PURE__ */ new Map(); map2.set("default", 48); map2.set("small", 16); map2.set("large", 64); return map2; })(); const _sfc_main$v = defineComponent({ name: "BzLoading", components: { Spin }, props: { tip: { type: String, default: "" }, size: { type: String, default: SizeEnum.LARGE, validator: (v2) => { return [SizeEnum.DEFAULT, SizeEnum.SMALL, SizeEnum.LARGE].includes(v2); } }, absolute: { type: Boolean, default: false }, loading: { type: Boolean, default: false }, background: { type: String }, theme: { type: String, default: "light" } } }); function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) { const _component_Spin = resolveComponent("Spin"); return withDirectives((openBlock(), createElementBlock("section", { class: normalizeClass(["full-loading", { absolute: _ctx.absolute, [_ctx.theme]: !!_ctx.theme }]), style: normalizeStyle([_ctx.background ? `background-color: ${_ctx.background}` : ""]) }, [ createVNode(_component_Spin, mergeProps$1(_ctx.$attrs, { tip: _ctx.tip, size: _ctx.size, spinning: _ctx.loading }), null, 16, ["tip", "size", "spinning"]) ], 6)), [ [vShow, _ctx.loading] ]); } var bzLoading = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render$q]]); function createLoading(props2, target, wait = false) { let vm = null; const data65 = reactive(__spreadValues({ tip: "", loading: true }, props2)); const LoadingWrap = defineComponent({ render() { return h$2(bzLoading, __spreadValues({}, data65)); } }); vm = createVNode(LoadingWrap); if (wait) { setTimeout(() => { render(vm, document.createElement("div")); }, 0); } else { render(vm, document.createElement("div")); } function close7() { if ((vm == null ? void 0 : vm.el) && vm.el.parentNode) { vm.el.parentNode.removeChild(vm.el); } } function open6(target2 = document.body) { if (!vm || !vm.el) { return; } target2.appendChild(vm.el); } if (target) { open6(target); } return { vm, close: close7, open: open6, setTip: (tip) => { data65.tip = tip; }, setLoading: (loading) => { data65.loading = loading; }, get loading() { return data65.loading; }, get $el() { return vm == null ? void 0 : vm.el; } }; } function useLoading$1(opt) { let props2; let target = document.body; if (Reflect.has(opt, "target") || Reflect.has(opt, "props")) { const options2 = opt; props2 = options2.props || {}; target = options2.target || document.body; } else { props2 = opt; } const instance = createLoading(props2, void 0, true); const open6 = () => { const t2 = unref(target); if (!t2) return; instance.open(t2); }; const close7 = () => { instance.close(); }; const setTip = (tip) => { instance.setTip(tip); }; return [open6, close7, setTip]; } const BzLoading = withInstall$1(bzLoading); var index$k = ""; const modalProps = { visible: { type: Boolean }, scrollTop: { type: Boolean, default: true }, height: { type: Number }, minHeight: { type: Number }, draggable: { type: Boolean, default: true }, centered: { type: Boolean }, cancelText: { type: String, default: "\u53D6\u6D88" }, okText: { type: String, default: "\u786E\u5B9A" }, closeFunc: Function }; const basicProps$3 = Object.assign({}, modalProps, { defaultFullscreen: { type: Boolean }, canFullscreen: { type: Boolean, default: true }, wrapperFooterOffset: { type: Number, default: 0 }, helpMessage: [String, Array], useWrapper: { type: Boolean, default: true }, loading: { type: Boolean }, loadingTip: { type: String }, showCancelBtn: { type: Boolean, default: true }, showOkBtn: { type: Boolean, default: true }, wrapperProps: Object, afterClose: Function, bodyStyle: Object, closable: { type: Boolean, default: true }, closeIcon: Object, confirmLoading: { type: Boolean }, destroyOnClose: { type: Boolean }, footer: Object, getContainer: Function, mask: { type: Boolean, default: true }, maskClosable: { type: Boolean, default: true }, keyboard: { type: Boolean, default: true }, maskStyle: Object, okType: { type: String, default: "primary" }, okButtonProps: Object, cancelButtonProps: Object, title: { type: String }, visible: { type: Boolean }, width: [String, Number], wrapClassName: { type: String }, zIndex: { type: Number } }); function useModalDragMove(context2) { const getStyle3 = (dom, attr) => { return getComputedStyle(dom)[attr]; }; const drag = (wrap) => { if (!wrap) return; wrap.setAttribute("data-drag", unref(context2.draggable)); const dialogHeaderEl = wrap.querySelector(".ant-modal-header"); const dragDom = wrap.querySelector(".ant-modal"); if (!dialogHeaderEl || !dragDom || !unref(context2.draggable)) return; dialogHeaderEl.style.cursor = "move"; dialogHeaderEl.onmousedown = (e2) => { if (!e2) return; const disX = e2.clientX; const disY = e2.clientY; const screenWidth = document.body.clientWidth; const screenHeight = document.documentElement.clientHeight; const dragDomWidth = dragDom.offsetWidth; const dragDomheight = dragDom.offsetHeight; const minDragDomLeft = dragDom.offsetLeft; const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth; const minDragDomTop = dragDom.offsetTop; const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight; const domLeft = getStyle3(dragDom, "left"); const domTop = getStyle3(dragDom, "top"); let styL = +domLeft; let styT = +domTop; if (domLeft.includes("%")) { styL = +document.body.clientWidth * (+domLeft.replace(/%/g, "") / 100); styT = +document.body.clientHeight * (+domTop.replace(/%/g, "") / 100); } else { styL = +domLeft.replace(/px/g, ""); styT = +domTop.replace(/px/g, ""); } document.onmousemove = function(e22) { let left = e22.clientX - disX; let top = e22.clientY - disY; if (-left > minDragDomLeft) { left = -minDragDomLeft; } else if (left > maxDragDomLeft) { left = maxDragDomLeft; } if (-top > minDragDomTop) { top = -minDragDomTop; } else if (top > maxDragDomTop) { top = maxDragDomTop; } dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`; }; document.onmouseup = () => { document.onmousemove = null; document.onmouseup = null; }; }; }; const handleDrag = () => { const dragWraps = document.querySelectorAll(".ant-modal-wrap"); for (const wrap of Array.from(dragWraps)) { if (!wrap) continue; const display = getStyle3(wrap, "display"); const draggable = wrap.getAttribute("data-drag"); if (display !== "none") { if (draggable === null || unref(context2.destroyOnClose)) { drag(wrap); } } } }; watchEffect(() => { if (!unref(context2.visible) || !unref(context2.draggable)) { return; } useTimeoutFn(() => { handleDrag(); }, 30); }); } function _isSlot$3(s2) { return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2); } var Modal = defineComponent({ name: "Modal", inheritAttrs: false, props: basicProps$3, emits: ["cancel"], setup(props2, { slots, emit: emit2 }) { const { visible: visible9, draggable, destroyOnClose } = toRefs(props2); const attrs = useAttrs(); useModalDragMove({ visible: visible9, destroyOnClose, draggable }); const onCancel = (e2) => { emit2("cancel", e2); }; return () => { let _slot; const propsData = __spreadProps(__spreadValues(__spreadValues({}, unref(attrs)), props2), { onCancel }); return createVNode(Modal$1, propsData, _isSlot$3(_slot = extendSlots(slots)) ? _slot : { default: () => [_slot] }); }; } }); const key$2 = Symbol(); function createModalContext(context2) { return createContext(context2, key$2); } function useModalContext() { return useContext(key$2); } const loadingDirective = { mounted(el, binding) { const tip = el.getAttribute("loading-tip"); const background = el.getAttribute("loading-background"); const size = el.getAttribute("loading-size"); const fullscreen = !!binding.modifiers.fullscreen; const instance = createLoading({ tip, background, size: size || "large", loading: !!binding.value, absolute: !fullscreen }, fullscreen ? document.body : el); el.instance = instance; }, updated(el, binding) { var _a3; const instance = el.instance; if (!instance) return; instance.setTip(el.getAttribute("loading-tip")); if (binding.oldValue !== binding.value) { (_a3 = instance.setLoading) == null ? void 0 : _a3.call(instance, binding.value && !instance.loading); } }, unmounted(el) { var _a3; (_a3 = el == null ? void 0 : el.instance) == null ? void 0 : _a3.close(); } }; function setupLoadingDirective(app) { app.directive("loading", loadingDirective); } const props$2 = { loading: { type: Boolean }, useWrapper: { type: Boolean, default: true }, modalHeaderHeight: { type: Number, default: 57 }, modalFooterHeight: { type: Number, default: 74 }, minHeight: { type: Number, default: 200 }, height: { type: Number }, footerOffset: { type: Number, default: 0 }, visible: { type: Boolean }, fullScreen: { type: Boolean }, loadingTip: { type: String } }; const _sfc_main$u = defineComponent({ name: "ModalWrapper", components: { BzScrollContainer }, inheritAttrs: false, props: props$2, emits: ["height-change", "ext-height"], setup(props2, { emit: emit2 }) { const wrapperRef = ref(null); const spinRef = ref(null); const realHeightRef = ref(0); const minRealHeightRef = ref(0); let realHeight = 0; useWindowSizeFn(setModalHeight.bind(null, false)); useMutationObserver(spinRef, () => { setModalHeight(); }, { attributes: true, subtree: true }); createModalContext({ redoModalHeight: setModalHeight }); const spinStyle = computed(() => { return { minHeight: `${props2.minHeight}px`, [props2.fullScreen ? "height" : "maxHeight"]: `${unref(realHeightRef)}px` }; }); watchEffect(() => { props2.useWrapper && setModalHeight(); }); watch(() => props2.fullScreen, (v2) => { setModalHeight(); if (!v2) { realHeightRef.value = minRealHeightRef.value; } else { minRealHeightRef.value = realHeightRef.value; } }); onMounted(() => { const { modalHeaderHeight, modalFooterHeight } = props2; emit2("ext-height", modalHeaderHeight + modalFooterHeight); }); onUnmounted(() => { }); async function scrollTop2() { nextTick(() => { var _a3; const wrapperRefDom = unref(wrapperRef); if (!wrapperRefDom) return; (_a3 = wrapperRefDom == null ? void 0 : wrapperRefDom.scrollTo) == null ? void 0 : _a3.call(wrapperRefDom, 0); }); } async function setModalHeight() { if (!props2.visible) return; const wrapperRefDom = unref(wrapperRef); if (!wrapperRefDom) return; const bodyDom = wrapperRefDom.$el.parentElement; if (!bodyDom) return; await nextTick(); try { const modalDom = bodyDom.parentElement && bodyDom.parentElement.parentElement; if (!modalDom) return; const modalRect = getComputedStyle(modalDom).top; const modalTop = Number.parseInt(modalRect); let maxHeight = window.innerHeight - modalTop * 2 + (props2.footerOffset || 0) - props2.modalFooterHeight - props2.modalHeaderHeight; if (modalTop < 40) { maxHeight -= 26; } await nextTick(); const spinEl = unref(spinRef); if (!spinEl) return; await nextTick(); realHeight = spinEl.scrollHeight; if (props2.fullScreen) { realHeightRef.value = window.innerHeight - props2.modalFooterHeight - props2.modalHeaderHeight - 28; } else { realHeightRef.value = props2.height ? props2.height : realHeight > maxHeight ? maxHeight : realHeight; } emit2("height-change", unref(realHeightRef)); } catch (error3) { console.log(error3); } } return { wrapperRef, spinRef, spinStyle, scrollTop: scrollTop2, setModalHeight }; }, directives: { loading: loadingDirective } }); const _hoisted_1$9 = ["loading-tip"]; function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) { const _component_bz_scrollContainer = resolveComponent("bz-scrollContainer"); const _directive_loading = resolveDirective("loading"); return openBlock(), createBlock(_component_bz_scrollContainer, { ref: "wrapperRef" }, { default: withCtx(() => [ withDirectives((openBlock(), createElementBlock("div", { ref: "spinRef", style: normalizeStyle(_ctx.spinStyle), "loading-tip": _ctx.loadingTip }, [ renderSlot(_ctx.$slots, "default") ], 12, _hoisted_1$9)), [ [_directive_loading, _ctx.loading] ]) ]), _: 3 }, 512); } var ModalWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["render", _sfc_render$p]]); const _sfc_main$t = defineComponent({ name: "ModalClose", components: { Tooltip, FullscreenExitOutlined: FullscreenExitOutlined$1, FullscreenOutlined: FullscreenOutlined$1, CloseOutlined: CloseOutlined$1 }, props: { canFullscreen: { type: Boolean, default: true }, fullScreen: { type: Boolean } }, emits: ["cancel", "fullscreen"], setup(props2, { emit: emit2 }) { const { prefixCls: prefixCls2 } = useDesign("basic-modal-close"); const getClass2 = computed(() => { return [ prefixCls2, `${prefixCls2}--custom`, { [`${prefixCls2}--can-full`]: props2.canFullscreen } ]; }); function handleCancel2(e2) { emit2("cancel", e2); } function handleFullScreen(e2) { e2 == null ? void 0 : e2.stopPropagation(); e2 == null ? void 0 : e2.preventDefault(); emit2("fullscreen"); } return { getClass: getClass2, prefixCls: prefixCls2, handleCancel: handleCancel2, handleFullScreen }; } }); function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) { const _component_FullscreenExitOutlined = resolveComponent("FullscreenExitOutlined"); const _component_Tooltip = resolveComponent("Tooltip"); const _component_FullscreenOutlined = resolveComponent("FullscreenOutlined"); const _component_CloseOutlined = resolveComponent("CloseOutlined"); return openBlock(), createElementBlock("div", { class: normalizeClass(_ctx.getClass) }, [ _ctx.canFullscreen ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ _ctx.fullScreen ? (openBlock(), createBlock(_component_Tooltip, { key: 0, title: "\u8FD8\u539F", placement: "bottom" }, { default: withCtx(() => [ createVNode(_component_FullscreenExitOutlined, { role: "full", onClick: _ctx.handleFullScreen }, null, 8, ["onClick"]) ]), _: 1 })) : (openBlock(), createBlock(_component_Tooltip, { key: 1, title: "\u6700\u5927\u5316", placement: "bottom" }, { default: withCtx(() => [ createVNode(_component_FullscreenOutlined, { role: "close", onClick: _ctx.handleFullScreen }, null, 8, ["onClick"]) ]), _: 1 })) ], 64)) : createCommentVNode("", true), createVNode(_component_Tooltip, { title: "\u5173\u95ED", placement: "bottom" }, { default: withCtx(() => [ createVNode(_component_CloseOutlined, { onClick: _ctx.handleCancel }, null, 8, ["onClick"]) ]), _: 1 }) ], 2); } var ModalClose = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["render", _sfc_render$o]]); const _sfc_main$s = defineComponent({ name: "BzModalFooter", props: basicProps$3, emits: ["ok", "cancel"], setup(_2, { emit: emit2 }) { function handleOk2(e2) { emit2("ok", e2); } function handleCancel2(e2) { emit2("cancel", e2); } return { handleOk: handleOk2, handleCancel: handleCancel2 }; } }); function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) { const _component_bz_button = resolveComponent("bz-button"); return openBlock(), createElementBlock("div", null, [ renderSlot(_ctx.$slots, "insertFooter"), _ctx.showCancelBtn ? (openBlock(), createBlock(_component_bz_button, mergeProps$1({ key: 0 }, _ctx.cancelButtonProps, { onClick: _ctx.handleCancel }), { default: withCtx(() => [ createTextVNode(toDisplayString(_ctx.cancelText), 1) ]), _: 1 }, 16, ["onClick"])) : createCommentVNode("", true), renderSlot(_ctx.$slots, "centerFooter"), _ctx.showOkBtn ? (openBlock(), createBlock(_component_bz_button, mergeProps$1({ key: 1, type: _ctx.okType, onClick: _ctx.handleOk, loading: _ctx.confirmLoading }, _ctx.okButtonProps), { default: withCtx(() => [ createTextVNode(toDisplayString(_ctx.okText), 1) ]), _: 1 }, 16, ["type", "onClick", "loading"])) : createCommentVNode("", true), renderSlot(_ctx.$slots, "appendFooter") ]); } var ModalFooter = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$n]]); const _sfc_main$r = defineComponent({ name: "BzModalHeader", components: { BzTitle }, props: { helpMessage: { type: [String, Array] }, title: { type: String } }, emits: ["dblclick"] }); function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) { const _component_bz_title = resolveComponent("bz-title"); return openBlock(), createBlock(_component_bz_title, { helpMessage: _ctx.helpMessage }, { default: withCtx(() => [ createTextVNode(toDisplayString(_ctx.title), 1) ]), _: 1 }, 8, ["helpMessage"]); } var ModalHeader = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$m]]); function useFullScreen(context2) { const fullScreenRef = ref(false); const getWrapClassName = computed(() => { const clsName = unref(context2.wrapClassName) || ""; return unref(fullScreenRef) ? `fullscreen-modal ${clsName} ` : unref(clsName); }); function handleFullScreen(e2) { e2 && e2.stopPropagation(); fullScreenRef.value = !unref(fullScreenRef); } return { getWrapClassName, handleFullScreen, fullScreenRef }; } const _sfc_main$q = defineComponent({ name: "BzModal", components: { Modal, ModalWrapper, ModalClose, ModalFooter, ModalHeader }, inheritAttrs: false, props: basicProps$3, emits: ["visible-change", "height-change", "cancel", "ok", "register", "update:visible"], setup(props2, { emit: emit2, attrs }) { const visibleRef = ref(false); const propsRef = ref(null); const modalWrapperRef = ref(null); const { prefixCls: prefixCls2 } = useDesign("basic-modal"); const extHeightRef = ref(0); const modalMethods = { setModalProps, emitVisible: void 0, redoModalHeight: () => { nextTick(() => { if (unref(modalWrapperRef)) { unref(modalWrapperRef).setModalHeight(); } }); } }; const instance = getCurrentInstance(); if (instance) { emit2("register", modalMethods, instance.uid); } const getMergeProps = computed(() => { return __spreadValues(__spreadValues({}, props2), unref(propsRef)); }); const { handleFullScreen, getWrapClassName, fullScreenRef } = useFullScreen({ modalWrapperRef, extHeightRef, wrapClassName: toRef(getMergeProps.value, "wrapClassName") }); const getProps2 = computed(() => { const opt = __spreadProps(__spreadValues({}, unref(getMergeProps)), { visible: unref(visibleRef), okButtonProps: void 0, cancelButtonProps: void 0, title: void 0 }); return __spreadProps(__spreadValues({}, opt), { wrapClassName: unref(getWrapClassName) }); }); const getBindValue = computed(() => { const attr = __spreadProps(__spreadValues(__spreadValues({}, attrs), unref(getMergeProps)), { visible: unref(visibleRef), wrapClassName: unref(getWrapClassName) }); if (unref(fullScreenRef)) { return omit$2(attr, ["height", "title"]); } return omit$2(attr, "title"); }); const getWrapperHeight = computed(() => { if (unref(fullScreenRef)) return void 0; return unref(getProps2).height; }); watchEffect(() => { visibleRef.value = !!props2.visible; fullScreenRef.value = !!props2.defaultFullscreen; }); watch(() => unref(visibleRef), (v2) => { var _a3; emit2("visible-change", v2); emit2("update:visible", v2); instance && ((_a3 = modalMethods.emitVisible) == null ? void 0 : _a3.call(modalMethods, v2, instance.uid)); nextTick(() => { if (props2.scrollTop && v2 && unref(modalWrapperRef)) { unref(modalWrapperRef).scrollTop(); } }); }, { immediate: false }); async function handleCancel2(e2) { var _a3, _b2; e2 == null ? void 0 : e2.stopPropagation(); if ((_b2 = (_a3 = e2.target) == null ? void 0 : _a3.classList) == null ? void 0 : _b2.contains(prefixCls2 + "-close--custom")) return; if (props2.closeFunc && isFunction$3(props2.closeFunc)) { const isClose = await props2.closeFunc(); visibleRef.value = !isClose; return; } visibleRef.value = false; emit2("cancel", e2); } function setModalProps(props22) { propsRef.value = deepMerge$1(unref(propsRef) || {}, props22); if (Reflect.has(props22, "visible")) { visibleRef.value = !!props22.visible; } if (Reflect.has(props22, "defaultFullscreen")) { fullScreenRef.value = !!props22.defaultFullscreen; } } function handleOk2(e2) { emit2("ok", e2); } function handleHeightChange(height) { emit2("height-change", height); } function handleExtHeight(height) { extHeightRef.value = height; } function handleTitleDbClick(e2) { if (!props2.canFullscreen) return; e2.stopPropagation(); handleFullScreen(e2); } return { handleCancel: handleCancel2, getBindValue, getProps: getProps2, handleFullScreen, fullScreenRef, getMergeProps, handleOk: handleOk2, visibleRef, omit: omit$2, modalWrapperRef, handleExtHeight, handleHeightChange, handleTitleDbClick, getWrapperHeight }; } }); function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) { const _component_ModalClose = resolveComponent("ModalClose"); const _component_ModalHeader = resolveComponent("ModalHeader"); const _component_ModalFooter = resolveComponent("ModalFooter"); const _component_ModalWrapper = resolveComponent("ModalWrapper"); const _component_Modal = resolveComponent("Modal"); return openBlock(), createBlock(_component_Modal, mergeProps$1(_ctx.getBindValue, { onCancel: _ctx.handleCancel }), createSlots({ default: withCtx(() => [ createVNode(_component_ModalWrapper, mergeProps$1({ useWrapper: _ctx.getProps.useWrapper, footerOffset: _ctx.wrapperFooterOffset, fullScreen: _ctx.fullScreenRef, ref: "modalWrapperRef", loading: _ctx.getProps.loading, "loading-tip": _ctx.getProps.loadingTip, minHeight: _ctx.getProps.minHeight, height: _ctx.getWrapperHeight, visible: _ctx.visibleRef, modalFooterHeight: _ctx.footer !== void 0 && !_ctx.footer ? 0 : void 0 }, _ctx.omit(_ctx.getProps.wrapperProps, "visible", "height", "modalFooterHeight"), { onExtHeight: _ctx.handleExtHeight, onHeightChange: _ctx.handleHeightChange }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16, ["useWrapper", "footerOffset", "fullScreen", "loading", "loading-tip", "minHeight", "height", "visible", "modalFooterHeight", "onExtHeight", "onHeightChange"]) ]), _: 2 }, [ !_ctx.$slots.closeIcon ? { name: "closeIcon", fn: withCtx(() => [ createVNode(_component_ModalClose, { canFullscreen: _ctx.getProps.canFullscreen, fullScreen: _ctx.fullScreenRef, onCancel: _ctx.handleCancel, onFullscreen: _ctx.handleFullScreen }, null, 8, ["canFullscreen", "fullScreen", "onCancel", "onFullscreen"]) ]) } : void 0, !_ctx.$slots.title ? { name: "title", fn: withCtx(() => [ createVNode(_component_ModalHeader, { helpMessage: _ctx.getProps.helpMessage, title: _ctx.getMergeProps.title, onDblclick: _ctx.handleTitleDbClick }, null, 8, ["helpMessage", "title", "onDblclick"]) ]) } : void 0, !_ctx.$slots.footer ? { name: "footer", fn: withCtx(() => [ createVNode(_component_ModalFooter, mergeProps$1(_ctx.getBindValue, { onOk: _ctx.handleOk, onCancel: _ctx.handleCancel }), createSlots({ _: 2 }, [ renderList(Object.keys(_ctx.$slots), (item) => { return { name: item, fn: withCtx((data65) => [ renderSlot(_ctx.$slots, item, normalizeProps(guardReactiveProps(data65 || {}))) ]) }; }) ]), 1040, ["onOk", "onCancel"]) ]) } : void 0, renderList(Object.keys(_ctx.omit(_ctx.$slots, "default")), (item) => { return { name: item, fn: withCtx((data65) => [ renderSlot(_ctx.$slots, item, normalizeProps(guardReactiveProps(data65 || {}))) ]) }; }) ]), 1040, ["onCancel"]); } var bzModal = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$l]]); const projectName = {}.VITE_GLOB_APP_TITLE; function warn(message2) { console.warn(`[${projectName} warn]:${message2}`); } function error(message2) { throw new Error(`[${projectName} error]:${message2}`); } const dataTransfer = reactive({}); const visibleData$1 = reactive({}); function useModal() { const modal = ref(null); const loaded2 = ref(false); const uid2 = ref(""); function register3(modalMethod, uuid2) { if (!getCurrentInstance()) { throw new Error("useModal() can only be used inside setup() or functional components!"); } uid2.value = uuid2; onUnmounted(() => { modal.value = null; loaded2.value = false; dataTransfer[unref(uid2)] = null; }); if (unref(loaded2) && modalMethod === unref(modal)) return; modal.value = modalMethod; loaded2.value = true; modalMethod.emitVisible = (visible9, uid22) => { visibleData$1[uid22] = visible9; }; } const getInstance2 = () => { const instance = unref(modal); if (!instance) { error("useModal instance is undefined!"); } return instance; }; const methods = { setModalProps: (props2) => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setModalProps(props2); }, getVisible: computed(() => { return visibleData$1[~~unref(uid2)]; }), redoModalHeight: () => { var _a3, _b2; (_b2 = (_a3 = getInstance2()) == null ? void 0 : _a3.redoModalHeight) == null ? void 0 : _b2.call(_a3); }, openModal: (visible9 = true, data65, openOnSet = true) => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setModalProps({ visible: visible9 }); if (!data65) return; const id2 = unref(uid2); if (openOnSet) { dataTransfer[id2] = null; dataTransfer[id2] = toRaw(data65); return; } const equal = isEqual$1(toRaw(dataTransfer[id2]), toRaw(data65)); if (!equal) { dataTransfer[id2] = toRaw(data65); } }, closeModal: () => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setModalProps({ visible: false }); } }; return [register3, methods]; } const useModalInner = (callbackFn) => { const modalInstanceRef = ref(null); const currentInstance = getCurrentInstance(); const uidRef = ref(""); const getInstance2 = () => { const instance = unref(modalInstanceRef); if (!instance) { error("useModalInner instance is undefined!"); } return instance; }; const register3 = (modalInstance, uuid2) => { tryOnUnmounted(() => { modalInstanceRef.value = null; }); uidRef.value = uuid2; modalInstanceRef.value = modalInstance; currentInstance == null ? void 0 : currentInstance.emit("register", modalInstance, uuid2); }; watchEffect(() => { const data65 = dataTransfer[unref(uidRef)]; if (!data65) return; if (!callbackFn || !isFunction$3(callbackFn)) return; nextTick(() => { callbackFn(data65); }); }); return [ register3, { changeLoading: (loading = true) => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setModalProps({ loading }); }, getVisible: computed(() => { return visibleData$1[~~unref(uidRef)]; }), changeOkLoading: (loading = true) => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setModalProps({ confirmLoading: loading }); }, closeModal: () => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setModalProps({ visible: false }); }, setModalProps: (props2) => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setModalProps(props2); }, redoModalHeight: () => { var _a3; const callRedo = (_a3 = getInstance2()) == null ? void 0 : _a3.redoModalHeight; callRedo && callRedo(); } } ]; }; const BzModal = withInstall$1(bzModal); var index$j = ""; const footerProps = { confirmLoading: { type: Boolean }, showCancelBtn: { type: Boolean, default: true }, cancelButtonProps: Object, cancelText: { type: String, default: "\u53D6\u6D88" }, showOkBtn: { type: Boolean, default: true }, okButtonProps: Object, okText: { type: String, default: "\u786E\u5B9A" }, okType: { type: String, default: "primary" }, showFooter: { type: Boolean }, footerHeight: { type: [String, Number], default: 60 } }; const basicProps$2 = __spreadValues({ isDetail: { type: Boolean }, title: { type: String, default: "" }, loadingText: { type: String }, showDetailBack: { type: Boolean, default: true }, visible: { type: Boolean }, loading: { type: Boolean }, maskClosable: { type: Boolean, default: true }, getContainer: { type: [Object, String] }, closeFunc: { type: [Function, Object], default: null }, destroyOnClose: { type: Boolean } }, footerProps); const _sfc_main$p = defineComponent({ name: "BasicDrawerFooter", props: __spreadProps(__spreadValues({}, footerProps), { height: { type: String, default: "60px" } }), emits: ["ok", "close"], setup(props2, { emit: emit2 }) { const { prefixCls: prefixCls2 } = useDesign("basic-drawer-footer"); const getStyle3 = computed(() => { const heightStr = `${props2.height}`; return { height: heightStr, lineHeight: `calc(${heightStr} - 1px)` }; }); function handleOk2() { emit2("ok"); } function handleClose2() { emit2("close"); } return { handleOk: handleOk2, prefixCls: prefixCls2, handleClose: handleClose2, getStyle: getStyle3 }; } }); function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) { const _component_bz_button = resolveComponent("bz-button"); return _ctx.showFooter || _ctx.$slots.footer ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(_ctx.prefixCls), style: normalizeStyle(_ctx.getStyle) }, [ !_ctx.$slots.footer ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ renderSlot(_ctx.$slots, "insertFooter"), _ctx.showCancelBtn ? (openBlock(), createBlock(_component_bz_button, mergeProps$1({ key: 0 }, _ctx.cancelButtonProps, { onClick: _ctx.handleClose, class: "mr-2" }), { default: withCtx(() => [ createTextVNode(toDisplayString(_ctx.cancelText), 1) ]), _: 1 }, 16, ["onClick"])) : createCommentVNode("", true), renderSlot(_ctx.$slots, "centerFooter"), _ctx.showOkBtn ? (openBlock(), createBlock(_component_bz_button, mergeProps$1({ key: 1, type: _ctx.okType, onClick: _ctx.handleOk }, _ctx.okButtonProps, { class: "mr-2", loading: _ctx.confirmLoading }), { default: withCtx(() => [ createTextVNode(toDisplayString(_ctx.okText), 1) ]), _: 1 }, 16, ["type", "onClick", "loading"])) : createCommentVNode("", true), renderSlot(_ctx.$slots, "appendFooter") ], 64)) : renderSlot(_ctx.$slots, "footer", { key: 1 }) ], 6)) : createCommentVNode("", true); } var DrawerFooter = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$k]]); const _sfc_main$o = defineComponent({ name: "BasicDrawerHeader", components: { BzTitle, ArrowLeftOutlined: ArrowLeftOutlined$1 }, props: { isDetail: propTypes$1.bool, showDetailBack: propTypes$1.bool, title: propTypes$1.string }, emits: ["close"], setup(_2, { emit: emit2 }) { const { prefixCls: prefixCls2 } = useDesign("basic-drawer-header"); function handleClose2() { emit2("close"); } return { prefixCls: prefixCls2, handleClose: handleClose2 }; } }); const _hoisted_1$8 = { key: 1 }; function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) { const _component_BzTitle = resolveComponent("BzTitle"); const _component_ArrowLeftOutlined = resolveComponent("ArrowLeftOutlined"); return !_ctx.isDetail ? (openBlock(), createBlock(_component_BzTitle, { key: 0, class: normalizeClass(_ctx.prefixCls) }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "title"), createTextVNode(" " + toDisplayString(!_ctx.$slots.title ? _ctx.title : ""), 1) ]), _: 3 }, 8, ["class"])) : (openBlock(), createElementBlock("div", { key: 1, class: normalizeClass([_ctx.prefixCls, `${_ctx.prefixCls}--detail`]) }, [ createElementVNode("span", { class: normalizeClass(`${_ctx.prefixCls}__twrap`) }, [ _ctx.showDetailBack ? (openBlock(), createElementBlock("span", { key: 0, onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClose && _ctx.handleClose(...args)) }, [ createVNode(_component_ArrowLeftOutlined, { class: normalizeClass(`${_ctx.prefixCls}__back`) }, null, 8, ["class"]) ])) : createCommentVNode("", true), _ctx.title ? (openBlock(), createElementBlock("span", _hoisted_1$8, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true) ], 2), createElementVNode("span", { class: normalizeClass(`${_ctx.prefixCls}__toolbar`) }, [ renderSlot(_ctx.$slots, "titleToolbar") ], 2) ], 2)); } var DrawerHeader = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$j]]); const _sfc_main$n = defineComponent({ components: { Drawer: Drawer$1, BzScrollContainer, DrawerFooter, DrawerHeader }, inheritAttrs: false, props: basicProps$2, emits: ["visible-change", "ok", "close", "register"], setup(props2, { emit: emit2 }) { const visibleRef = ref(false); const attrs = useAttrs(); const propsRef = ref(null); const { prefixVar, prefixCls: prefixCls2 } = useDesign("basic-drawer"); const drawerInstance = { setDrawerProps, emitVisible: void 0 }; const instance = getCurrentInstance(); instance && emit2("register", drawerInstance, instance.uid); const getMergeProps = computed(() => { return deepMerge$1(toRaw(props2), unref(propsRef)); }); const getProps2 = computed(() => { const opt = __spreadProps(__spreadValues(__spreadValues({ placement: "right" }, unref(attrs)), unref(getMergeProps)), { visible: unref(visibleRef) }); opt.title = void 0; const { isDetail, width, wrapClassName, getContainer: getContainer5 } = opt; if (isDetail) { if (!width) { opt.width = "100%"; } const detailCls = `${prefixCls2}__detail`; opt.class = wrapClassName ? `${wrapClassName} ${detailCls}` : detailCls; if (!getContainer5) { opt.getContainer = `.${prefixVar}-layout-content`; } } return opt; }); const getBindValues = computed(() => { return __spreadValues(__spreadValues({}, attrs), unref(getProps2)); }); const getFooterHeight = computed(() => { const { footerHeight, showFooter } = unref(getProps2); if (showFooter && footerHeight) { return isNumber$3(footerHeight) ? `${footerHeight}px` : `${footerHeight.replace("px", "")}px`; } return `0px`; }); const getScrollContentStyle = computed(() => { const footerHeight = unref(getFooterHeight); return { position: "relative", height: `calc(100% - ${footerHeight})` }; }); const getLoading = computed(() => { var _a3; return !!((_a3 = unref(getProps2)) == null ? void 0 : _a3.loading); }); watch(() => props2.visible, (newVal, oldVal) => { if (newVal !== oldVal) visibleRef.value = newVal; }, { deep: true }); watch(() => visibleRef.value, (visible9) => { nextTick(() => { var _a3; emit2("visible-change", visible9); instance && ((_a3 = drawerInstance.emitVisible) == null ? void 0 : _a3.call(drawerInstance, visible9, instance.uid)); }); }); async function onClose(e2) { const { closeFunc } = unref(getProps2); emit2("close", e2); if (closeFunc && isFunction$3(closeFunc)) { const res = await closeFunc(); visibleRef.value = !res; return; } visibleRef.value = false; } function setDrawerProps(props22) { propsRef.value = deepMerge$1(unref(propsRef) || {}, props22); if (Reflect.has(props22, "visible")) { visibleRef.value = !!props22.visible; } } function handleOk2() { emit2("ok"); } return { onClose, prefixCls: prefixCls2, getMergeProps, getScrollContentStyle, getProps: getProps2, getLoading, getBindValues, getFooterHeight, handleOk: handleOk2 }; }, directives: { loading: loadingDirective } }); function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) { const _component_DrawerHeader = resolveComponent("DrawerHeader"); const _component_BzScrollContainer = resolveComponent("BzScrollContainer"); const _component_DrawerFooter = resolveComponent("DrawerFooter"); const _component_Drawer = resolveComponent("Drawer"); const _directive_loading = resolveDirective("loading"); return openBlock(), createBlock(_component_Drawer, mergeProps$1({ class: _ctx.prefixCls, onClose: _ctx.onClose }, _ctx.getBindValues), createSlots({ default: withCtx(() => [ withDirectives((openBlock(), createBlock(_component_BzScrollContainer, { style: normalizeStyle(_ctx.getScrollContentStyle), "loading-tip": _ctx.loadingText || "\u52A0\u8F7D\u4E2D..." }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 8, ["style", "loading-tip"])), [ [_directive_loading, _ctx.getLoading] ]), createVNode(_component_DrawerFooter, mergeProps$1(_ctx.getProps, { onClose: _ctx.onClose, onOk: _ctx.handleOk, height: _ctx.getFooterHeight }), createSlots({ _: 2 }, [ renderList(Object.keys(_ctx.$slots), (item) => { return { name: item, fn: withCtx((data65) => [ renderSlot(_ctx.$slots, item, normalizeProps(guardReactiveProps(data65 || {}))) ]) }; }) ]), 1040, ["onClose", "onOk", "height"]) ]), _: 2 }, [ !_ctx.$slots.title ? { name: "title", fn: withCtx(() => [ createVNode(_component_DrawerHeader, { title: _ctx.getMergeProps.title, isDetail: _ctx.isDetail, showDetailBack: _ctx.showDetailBack, onClose: _ctx.onClose }, { titleToolbar: withCtx(() => [ renderSlot(_ctx.$slots, "titleToolbar") ]), _: 3 }, 8, ["title", "isDetail", "showDetailBack", "onClose"]) ]) } : { name: "title", fn: withCtx(() => [ renderSlot(_ctx.$slots, "title") ]) } ]), 1040, ["class", "onClose"]); } var bzDrawer = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$i]]); const dataTransferRef = reactive({}); const visibleData = reactive({}); function useDrawer() { if (!getCurrentInstance()) { throw new Error("useDrawer() can only be used inside setup() or functional components!"); } const drawer = ref(null); const loaded2 = ref(false); const uid2 = ref(""); function register3(drawerInstance, uuid2) { tryOnUnmounted(() => { drawer.value = null; loaded2.value = null; dataTransferRef[unref(uid2)] = null; }); if (unref(loaded2) && drawerInstance === unref(drawer)) { return; } uid2.value = uuid2; drawer.value = drawerInstance; loaded2.value = true; drawerInstance.emitVisible = (visible9, uid22) => { visibleData[uid22] = visible9; }; } const getInstance2 = () => { const instance = unref(drawer); if (!instance) { error("useDrawer instance is undefined!"); } return instance; }; const methods = { setDrawerProps: (props2) => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setDrawerProps(props2); }, getVisible: computed(() => { return visibleData[~~unref(uid2)]; }), openDrawer: (visible9 = true, data65, openOnSet = true) => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setDrawerProps({ visible: visible9 }); if (!data65) return; if (openOnSet) { dataTransferRef[unref(uid2)] = null; dataTransferRef[unref(uid2)] = toRaw(data65); return; } const equal = isEqual$1(toRaw(dataTransferRef[unref(uid2)]), toRaw(data65)); if (!equal) { dataTransferRef[unref(uid2)] = toRaw(data65); } }, closeDrawer: () => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setDrawerProps({ visible: false }); } }; return [register3, methods]; } const useDrawerInner = (callbackFn) => { const drawerInstanceRef = ref(null); const currentInstance = getCurrentInstance(); const uidRef = ref(""); if (!getCurrentInstance()) { throw new Error("useDrawerInner() can only be used inside setup() or functional components!"); } const getInstance2 = () => { const instance = unref(drawerInstanceRef); if (!instance) { error("useDrawerInner instance is undefined!"); return; } return instance; }; const register3 = (modalInstance, uuid2) => { tryOnUnmounted(() => { drawerInstanceRef.value = null; }); uidRef.value = uuid2; drawerInstanceRef.value = modalInstance; currentInstance == null ? void 0 : currentInstance.emit("register", modalInstance, uuid2); }; watchEffect(() => { const data65 = dataTransferRef[unref(uidRef)]; if (!data65) return; if (!callbackFn || !isFunction$3(callbackFn)) return; nextTick(() => { callbackFn(data65); }); }); return [ register3, { changeLoading: (loading = true) => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setDrawerProps({ loading }); }, changeOkLoading: (loading = true) => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setDrawerProps({ confirmLoading: loading }); }, getVisible: computed(() => { return visibleData[~~unref(uidRef)]; }), closeDrawer: () => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setDrawerProps({ visible: false }); }, setDrawerProps: (props2) => { var _a3; (_a3 = getInstance2()) == null ? void 0 : _a3.setDrawerProps(props2); } } ]; }; const BzDrawer = withInstall$1(bzDrawer); var index$i = ""; function _isSlot$2(s2) { return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2); } const prefixCls = "bz-context-menu"; const props$1 = { width: { type: Number, default: 156 }, customEvent: { type: Object, default: null }, styles: { type: Object }, showIcon: { type: Boolean, default: true }, axis: { type: Object, default() { return { x: 0, y: 0 }; } }, items: { type: Array, default() { return []; } } }; const ItemContent = (props2) => { const { item } = props2; return createVNode("span", { "style": "display: inline-block; width: 100%; ", "class": "px-4", "onClick": props2.handler.bind(null, item) }, [props2.showIcon && item.icon && createVNode(BzIcon, { "class": "mr-4", "icon": item.icon }, null), createVNode("span", null, [item.label])]); }; var _sfc_main$m = defineComponent({ name: "BzContextMenu", props: props$1, setup(props2) { const wrapRef = ref(null); const showRef = ref(false); const getStyle3 = computed(() => { const { axis, items, styles, width } = props2; const { x: x2, y: y2 } = axis || { x: 0, y: 0 }; const menuHeight = (items || []).length * 40; const menuWidth = width; const body = document.body; const left = body.clientWidth < x2 + menuWidth ? x2 - menuWidth : x2; const top = body.clientHeight < y2 + menuHeight ? y2 - menuHeight : y2; return __spreadProps(__spreadValues({}, styles), { position: "absolute", width: `${width}px`, left: `${left + 1}px`, top: `${top + 1}px`, zIndex: 9999 }); }); onMounted(() => { nextTick(() => showRef.value = true); }); onUnmounted(() => { const el = unref(wrapRef); el && document.body.removeChild(el); }); function handleAction(item, e2) { const { handler: handler7, disabled } = item; if (disabled) { return; } showRef.value = false; e2 == null ? void 0 : e2.stopPropagation(); e2 == null ? void 0 : e2.preventDefault(); handler7 == null ? void 0 : handler7(); } function renderMenuItem2(items) { const visibleItems = items.filter((item) => !item.hidden); return visibleItems.map((item) => { const { disabled, label, children, divider = false } = item; const contentProps = { item, handler: handleAction, showIcon: props2.showIcon }; if (!children || children.length === 0) { return createVNode(Fragment, null, [createVNode(Menu.Item, { "disabled": disabled, "class": `${prefixCls}__item`, "key": label }, { default: () => [createVNode(ItemContent, contentProps, null)] }), divider ? createVNode(Divider$1, { "key": `d-${label}` }, null) : null]); } if (!unref(showRef)) return null; return createVNode(Menu.SubMenu, { "key": label, "disabled": disabled, "popupClassName": `${prefixCls}__popup` }, { title: () => createVNode(ItemContent, contentProps, null), default: () => renderMenuItem2(children) }); }); } return () => { let _slot; if (!unref(showRef)) { return null; } const { items } = props2; return createVNode("div", { "class": prefixCls }, [createVNode(Menu, { "inlineIndent": 12, "mode": "vertical", "ref": wrapRef, "style": unref(getStyle3) }, _isSlot$2(_slot = renderMenuItem2(items)) ? _slot : { default: () => [_slot] })]); }; } }); const menuManager = { domList: [], resolve: () => { } }; const createContextMenu = function(options2) { const { event } = options2 || {}; event && (event == null ? void 0 : event.preventDefault()); if (!isClient$2) { return; } return new Promise((resolve) => { const body = document.body; const container = document.createElement("div"); const propsData = {}; if (options2.styles) { propsData.styles = options2.styles; } if (options2.items) { propsData.items = options2.items; } if (options2.event) { propsData.customEvent = event; propsData.axis = { x: event.clientX, y: event.clientY }; } const vm = createVNode(_sfc_main$m, propsData); render(vm, container); const handleClick5 = function() { menuManager.resolve(""); }; menuManager.domList.push(container); const remove3 = function() { menuManager.domList.forEach((dom) => { try { dom && body.removeChild(dom); } catch (error3) { } }); body.removeEventListener("click", handleClick5); body.removeEventListener("scroll", handleClick5); }; menuManager.resolve = function(arg) { remove3(); resolve(arg); }; remove3(); body.appendChild(container); body.addEventListener("click", handleClick5); body.addEventListener("scroll", handleClick5); }); }; const destroyContextMenu = function() { if (menuManager) { menuManager.resolve(""); menuManager.domList = []; } }; function useContextMenu(authRemove = true) { if (getCurrentInstance() && authRemove) { onUnmounted(() => { destroyContextMenu(); }); } return [createContextMenu, destroyContextMenu]; } var index$h = ""; function _isSlot$1(s2) { return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2); } const props = { useCollapse: { type: Boolean, default: true }, title: { type: String, default: "" }, size: { type: String, validator: (v2) => ["small", "default", "middle", void 0].includes(v2), default: "small" }, bordered: { type: Boolean, default: true }, column: { type: [Number, Object], default: () => { return { xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }; } }, collapseOptions: { type: Object, default: null }, schema: { type: Array, default: () => [] }, data: { type: Object } }; var _sfc_main$l = defineComponent({ name: "BzDescription", props, emits: ["register"], setup(props2, { slots, emit: emit2 }) { const propsRef = ref(null); const { prefixCls: prefixCls2 } = useDesign("description"); const attrs = useAttrs(); const getMergeProps = computed(() => { return __spreadValues(__spreadValues({}, props2), unref(propsRef)); }); const getProps2 = computed(() => { const opt = __spreadProps(__spreadValues({}, unref(getMergeProps)), { title: void 0 }); return opt; }); const useWrapper = computed(() => !!unref(getMergeProps).title); const getCollapseOptions = computed(() => { return __spreadValues({ canExpand: false }, unref(getProps2).collapseOptions); }); const getDescriptionsProps = computed(() => { return __spreadValues(__spreadValues({}, unref(attrs)), unref(getProps2)); }); function setDescProps(descProps) { propsRef.value = __spreadValues(__spreadValues({}, unref(propsRef)), descProps); } function renderLabel({ label, labelMinWidth, labelStyle }) { if (!labelStyle && !labelMinWidth) { return label; } const labelStyles = __spreadProps(__spreadValues({}, labelStyle), { minWidth: `${labelMinWidth}px ` }); return createVNode("div", { "style": labelStyles }, [label]); } function renderItem() { const { schema: schema2, data: data65 } = unref(getProps2); return unref(schema2).map((item) => { const { render: render123, field, span, show, contentMinWidth } = item; if (show && isFunction$3(show) && !show(data65)) { return null; } const getContent = () => { var _a3; const _data = (_a3 = unref(getProps2)) == null ? void 0 : _a3.data; if (!_data) { return null; } const getField = get(_data, field); if (getField && !toRefs(_data).hasOwnProperty(field)) { return isFunction$3(render123) ? render123("", _data) : ""; } return isFunction$3(render123) ? render123(getField, _data) : getField != null ? getField : ""; }; const width = contentMinWidth; return createVNode(Descriptions$1.Item, { "label": renderLabel(item), "key": field, "span": span }, { default: () => { if (!contentMinWidth) { return getContent(); } const style = { minWidth: `${width}px` }; return createVNode("div", { "style": style }, [getContent()]); } }); }).filter((item) => !!item); } const renderDesc = () => { let _slot; return createVNode(Descriptions$1, mergeProps$1({ "class": `${prefixCls2}` }, unref(getDescriptionsProps)), _isSlot$1(_slot = renderItem()) ? _slot : { default: () => [_slot] }); }; const renderContainer = () => { const content = props2.useCollapse ? renderDesc() : createVNode("div", null, [renderDesc()]); if (!props2.useCollapse) { return content; } const { canExpand, helpMessage } = unref(getCollapseOptions); const { title } = unref(getMergeProps); return createVNode(BzCollapseContainer, { "title": title, "canExpan": canExpand, "helpMessage": helpMessage }, { default: () => content, action: () => getSlot(slots, "action") }); }; const methods = { setDescProps }; emit2("register", methods); return () => unref(useWrapper) ? renderContainer() : renderDesc(); } }); function useDescription(props2) { if (!getCurrentInstance()) { throw new Error("useDescription() can only be used inside setup() or functional components!"); } const desc = ref(null); const loaded2 = ref(false); function register3(instance) { if (unref(loaded2)) { return; } desc.value = instance; props2 && instance.setDescProps(props2); loaded2.value = true; } const methods = { setDescProps: (descProps) => { var _a3; (_a3 = unref(desc)) == null ? void 0 : _a3.setDescProps(descProps); } }; return [register3, methods]; } const BzDescription = withInstall$1(_sfc_main$l); var tinymce$2 = { exports: {} }; (function(module2) { (function() { var typeOf$1 = function(x2) { if (x2 === null) { return "null"; } if (x2 === void 0) { return "undefined"; } var t2 = typeof x2; if (t2 === "object" && (Array.prototype.isPrototypeOf(x2) || x2.constructor && x2.constructor.name === "Array")) { return "array"; } if (t2 === "object" && (String.prototype.isPrototypeOf(x2) || x2.constructor && x2.constructor.name === "String")) { return "string"; } return t2; }; var isEquatableType = function(x2) { return [ "undefined", "boolean", "number", "string", "function", "xml", "null" ].indexOf(x2) !== -1; }; var sort$1 = function(xs, compareFn) { var clone5 = Array.prototype.slice.call(xs); return clone5.sort(compareFn); }; var contramap = function(eqa, f2) { return eq$2(function(x2, y2) { return eqa.eq(f2(x2), f2(y2)); }); }; var eq$2 = function(f2) { return { eq: f2 }; }; var tripleEq = eq$2(function(x2, y2) { return x2 === y2; }); var eqString = tripleEq; var eqArray = function(eqa) { return eq$2(function(x2, y2) { if (x2.length !== y2.length) { return false; } var len = x2.length; for (var i2 = 0; i2 < len; i2++) { if (!eqa.eq(x2[i2], y2[i2])) { return false; } } return true; }); }; var eqSortedArray = function(eqa, compareFn) { return contramap(eqArray(eqa), function(xs) { return sort$1(xs, compareFn); }); }; var eqRecord = function(eqa) { return eq$2(function(x2, y2) { var kx = Object.keys(x2); var ky = Object.keys(y2); if (!eqSortedArray(eqString).eq(kx, ky)) { return false; } var len = kx.length; for (var i2 = 0; i2 < len; i2++) { var q2 = kx[i2]; if (!eqa.eq(x2[q2], y2[q2])) { return false; } } return true; }); }; var eqAny = eq$2(function(x2, y2) { if (x2 === y2) { return true; } var tx = typeOf$1(x2); var ty = typeOf$1(y2); if (tx !== ty) { return false; } if (isEquatableType(tx)) { return x2 === y2; } else if (tx === "array") { return eqArray(eqAny).eq(x2, y2); } else if (tx === "object") { return eqRecord(eqAny).eq(x2, y2); } return false; }); var typeOf = function(x2) { var t2 = typeof x2; if (x2 === null) { return "null"; } else if (t2 === "object" && (Array.prototype.isPrototypeOf(x2) || x2.constructor && x2.constructor.name === "Array")) { return "array"; } else if (t2 === "object" && (String.prototype.isPrototypeOf(x2) || x2.constructor && x2.constructor.name === "String")) { return "string"; } else { return t2; } }; var isType$1 = function(type3) { return function(value25) { return typeOf(value25) === type3; }; }; var isSimpleType = function(type3) { return function(value25) { return typeof value25 === type3; }; }; var eq$1 = function(t2) { return function(a2) { return t2 === a2; }; }; var isString$12 = isType$1("string"); var isObject3 = isType$1("object"); var isArray$12 = isType$1("array"); var isNull2 = eq$1(null); var isBoolean2 = isSimpleType("boolean"); var isUndefined2 = eq$1(void 0); var isNullable = function(a2) { return a2 === null || a2 === void 0; }; var isNonNullable = function(a2) { return !isNullable(a2); }; var isFunction3 = isSimpleType("function"); var isNumber2 = isSimpleType("number"); var noop2 = function() { }; var compose = function(fa, fb) { return function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return fa(fb.apply(null, args)); }; }; var compose1 = function(fbc, fab) { return function(a2) { return fbc(fab(a2)); }; }; var constant2 = function(value25) { return function() { return value25; }; }; var identity2 = function(x2) { return x2; }; var tripleEquals = function(a2, b2) { return a2 === b2; }; function curry(fn) { var initialArgs = []; for (var _i = 1; _i < arguments.length; _i++) { initialArgs[_i - 1] = arguments[_i]; } return function() { var restArgs = []; for (var _i2 = 0; _i2 < arguments.length; _i2++) { restArgs[_i2] = arguments[_i2]; } var all3 = initialArgs.concat(restArgs); return fn.apply(null, all3); }; } var not = function(f2) { return function(t2) { return !f2(t2); }; }; var die = function(msg) { return function() { throw new Error(msg); }; }; var apply2 = function(f2) { return f2(); }; var call2 = function(f2) { f2(); }; var never = constant2(false); var always = constant2(true); var none = function() { return NONE; }; var NONE = function() { var call3 = function(thunk) { return thunk(); }; var id2 = identity2; var me = { fold: function(n2, _s) { return n2(); }, isSome: never, isNone: always, getOr: id2, getOrThunk: call3, getOrDie: function(msg) { throw new Error(msg || "error: getOrDie called on none."); }, getOrNull: constant2(null), getOrUndefined: constant2(void 0), or: id2, orThunk: call3, map: none, each: noop2, bind: none, exists: never, forall: always, filter: function() { return none(); }, toArray: function() { return []; }, toString: constant2("none()") }; return me; }(); var some2 = function(a2) { var constant_a = constant2(a2); var self2 = function() { return me; }; var bind5 = function(f2) { return f2(a2); }; var me = { fold: function(n2, s2) { return s2(a2); }, isSome: always, isNone: never, getOr: constant_a, getOrThunk: constant_a, getOrDie: constant_a, getOrNull: constant_a, getOrUndefined: constant_a, or: self2, orThunk: self2, map: function(f2) { return some2(f2(a2)); }, each: function(f2) { f2(a2); }, bind: bind5, exists: bind5, forall: bind5, filter: function(f2) { return f2(a2) ? me : NONE; }, toArray: function() { return [a2]; }, toString: function() { return "some(" + a2 + ")"; } }; return me; }; var from$1 = function(value25) { return value25 === null || value25 === void 0 ? NONE : some2(value25); }; var Optional = { some: some2, none, from: from$1 }; var nativeSlice = Array.prototype.slice; var nativeIndexOf = Array.prototype.indexOf; var nativePush = Array.prototype.push; var rawIndexOf = function(ts, t2) { return nativeIndexOf.call(ts, t2); }; var indexOf$22 = function(xs, x2) { var r3 = rawIndexOf(xs, x2); return r3 === -1 ? Optional.none() : Optional.some(r3); }; var contains$3 = function(xs, x2) { return rawIndexOf(xs, x2) > -1; }; var exists = function(xs, pred) { for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; if (pred(x2, i2)) { return true; } } return false; }; var map$3 = function(xs, f2) { var len = xs.length; var r3 = new Array(len); for (var i2 = 0; i2 < len; i2++) { var x2 = xs[i2]; r3[i2] = f2(x2, i2); } return r3; }; var each$k = function(xs, f2) { for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; f2(x2, i2); } }; var eachr = function(xs, f2) { for (var i2 = xs.length - 1; i2 >= 0; i2--) { var x2 = xs[i2]; f2(x2, i2); } }; var partition2 = function(xs, pred) { var pass = []; var fail = []; for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; var arr2 = pred(x2, i2) ? pass : fail; arr2.push(x2); } return { pass, fail }; }; var filter$4 = function(xs, pred) { var r3 = []; for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; if (pred(x2, i2)) { r3.push(x2); } } return r3; }; var foldr = function(xs, f2, acc) { eachr(xs, function(x2, i2) { acc = f2(acc, x2, i2); }); return acc; }; var foldl = function(xs, f2, acc) { each$k(xs, function(x2, i2) { acc = f2(acc, x2, i2); }); return acc; }; var findUntil$1 = function(xs, pred, until) { for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; if (pred(x2, i2)) { return Optional.some(x2); } else if (until(x2, i2)) { break; } } return Optional.none(); }; var find$3 = function(xs, pred) { return findUntil$1(xs, pred, never); }; var findIndex$2 = function(xs, pred) { for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; if (pred(x2, i2)) { return Optional.some(i2); } } return Optional.none(); }; var flatten2 = function(xs) { var r3 = []; for (var i2 = 0, len = xs.length; i2 < len; ++i2) { if (!isArray$12(xs[i2])) { throw new Error("Arr.flatten item " + i2 + " was not an array, input: " + xs); } nativePush.apply(r3, xs[i2]); } return r3; }; var bind4 = function(xs, f2) { return flatten2(map$3(xs, f2)); }; var forall = function(xs, pred) { for (var i2 = 0, len = xs.length; i2 < len; ++i2) { var x2 = xs[i2]; if (pred(x2, i2) !== true) { return false; } } return true; }; var reverse = function(xs) { var r3 = nativeSlice.call(xs, 0); r3.reverse(); return r3; }; var difference = function(a1, a2) { return filter$4(a1, function(x2) { return !contains$3(a2, x2); }); }; var mapToObject = function(xs, f2) { var r3 = {}; for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; r3[String(x2)] = f2(x2, i2); } return r3; }; var sort = function(xs, comparator) { var copy = nativeSlice.call(xs, 0); copy.sort(comparator); return copy; }; var get$a = function(xs, i2) { return i2 >= 0 && i2 < xs.length ? Optional.some(xs[i2]) : Optional.none(); }; var head = function(xs) { return get$a(xs, 0); }; var last$2 = function(xs) { return get$a(xs, xs.length - 1); }; var from2 = isFunction3(Array.from) ? Array.from : function(x2) { return nativeSlice.call(x2); }; var findMap = function(arr2, f2) { for (var i2 = 0; i2 < arr2.length; i2++) { var r3 = f2(arr2[i2], i2); if (r3.isSome()) { return r3; } } return Optional.none(); }; var keys2 = Object.keys; var hasOwnProperty$12 = Object.hasOwnProperty; var each$j = function(obj, f2) { var props2 = keys2(obj); for (var k2 = 0, len = props2.length; k2 < len; k2++) { var i2 = props2[k2]; var x2 = obj[i2]; f2(x2, i2); } }; var map$2 = function(obj, f2) { return tupleMap(obj, function(x2, i2) { return { k: i2, v: f2(x2, i2) }; }); }; var tupleMap = function(obj, f2) { var r3 = {}; each$j(obj, function(x2, i2) { var tuple3 = f2(x2, i2); r3[tuple3.k] = tuple3.v; }); return r3; }; var objAcc = function(r3) { return function(x2, i2) { r3[i2] = x2; }; }; var internalFilter = function(obj, pred, onTrue, onFalse) { var r3 = {}; each$j(obj, function(x2, i2) { (pred(x2, i2) ? onTrue : onFalse)(x2, i2); }); return r3; }; var bifilter = function(obj, pred) { var t2 = {}; var f2 = {}; internalFilter(obj, pred, objAcc(t2), objAcc(f2)); return { t: t2, f: f2 }; }; var filter$3 = function(obj, pred) { var t2 = {}; internalFilter(obj, pred, objAcc(t2), noop2); return t2; }; var mapToArray2 = function(obj, f2) { var r3 = []; each$j(obj, function(value25, name2) { r3.push(f2(value25, name2)); }); return r3; }; var values2 = function(obj) { return mapToArray2(obj, identity2); }; var get$9 = function(obj, key2) { return has$22(obj, key2) ? Optional.from(obj[key2]) : Optional.none(); }; var has$22 = function(obj, key2) { return hasOwnProperty$12.call(obj, key2); }; var hasNonNullableKey = function(obj, key2) { return has$22(obj, key2) && obj[key2] !== void 0 && obj[key2] !== null; }; var equal$1 = function(a1, a2, eq3) { if (eq3 === void 0) { eq3 = eqAny; } return eqRecord(eq3).eq(a1, a2); }; var isArray2 = Array.isArray; var toArray$12 = function(obj) { if (!isArray2(obj)) { var array3 = []; for (var i2 = 0, l2 = obj.length; i2 < l2; i2++) { array3[i2] = obj[i2]; } return array3; } else { return obj; } }; var each$i = function(o2, cb, s2) { var n2, l2; if (!o2) { return false; } s2 = s2 || o2; if (o2.length !== void 0) { for (n2 = 0, l2 = o2.length; n2 < l2; n2++) { if (cb.call(s2, o2[n2], n2, o2) === false) { return false; } } } else { for (n2 in o2) { if (has$22(o2, n2)) { if (cb.call(s2, o2[n2], n2, o2) === false) { return false; } } } } return true; }; var map$1 = function(array3, callback2) { var out = []; each$i(array3, function(item, index2) { out.push(callback2(item, index2, array3)); }); return out; }; var filter$2 = function(a2, f2) { var o2 = []; each$i(a2, function(v2, index2) { if (!f2 || f2(v2, index2, a2)) { o2.push(v2); } }); return o2; }; var indexOf$12 = function(a2, v2) { if (a2) { for (var i2 = 0, l2 = a2.length; i2 < l2; i2++) { if (a2[i2] === v2) { return i2; } } } return -1; }; var reduce = function(collection, iteratee, accumulator, thisArg) { var acc = isUndefined2(accumulator) ? collection[0] : accumulator; for (var i2 = 0; i2 < collection.length; i2++) { acc = iteratee.call(thisArg, acc, collection[i2], i2); } return acc; }; var findIndex$1 = function(array3, predicate, thisArg) { var i2, l2; for (i2 = 0, l2 = array3.length; i2 < l2; i2++) { if (predicate.call(thisArg, array3[i2], i2, array3)) { return i2; } } return -1; }; var last$1 = function(collection) { return collection[collection.length - 1]; }; var __assign = function() { __assign = Object.assign || function __assign2(t2) { for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) { s2 = arguments[i2]; for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p)) t2[p] = s2[p]; } return t2; }; return __assign.apply(this, arguments); }; function __rest2(s2, e2) { var t2 = {}; for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t2[p] = s2[p]; if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t2[p[i2]] = s2[p[i2]]; } return t2; } function __spreadArray(to3, from3, pack) { if (pack || arguments.length === 2) for (var i2 = 0, l2 = from3.length, ar; i2 < l2; i2++) { if (ar || !(i2 in from3)) { if (!ar) ar = Array.prototype.slice.call(from3, 0, i2); ar[i2] = from3[i2]; } } return to3.concat(ar || Array.prototype.slice.call(from3)); } var cached2 = function(f2) { var called = false; var r3; return function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (!called) { called = true; r3 = f2.apply(null, args); } return r3; }; }; var DeviceType = function(os2, browser2, userAgent2, mediaMatch2) { var isiPad = os2.isiOS() && /ipad/i.test(userAgent2) === true; var isiPhone = os2.isiOS() && !isiPad; var isMobile2 = os2.isiOS() || os2.isAndroid(); var isTouch2 = isMobile2 || mediaMatch2("(pointer:coarse)"); var isTablet2 = isiPad || !isiPhone && isMobile2 && mediaMatch2("(min-device-width:768px)"); var isPhone2 = isiPhone || isMobile2 && !isTablet2; var iOSwebview = browser2.isSafari() && os2.isiOS() && /safari/i.test(userAgent2) === false; var isDesktop = !isPhone2 && !isTablet2 && !iOSwebview; return { isiPad: constant2(isiPad), isiPhone: constant2(isiPhone), isTablet: constant2(isTablet2), isPhone: constant2(isPhone2), isTouch: constant2(isTouch2), isAndroid: os2.isAndroid, isiOS: os2.isiOS, isWebView: constant2(iOSwebview), isDesktop: constant2(isDesktop) }; }; var firstMatch = function(regexes2, s2) { for (var i2 = 0; i2 < regexes2.length; i2++) { var x2 = regexes2[i2]; if (x2.test(s2)) { return x2; } } return void 0; }; var find$2 = function(regexes2, agent) { var r3 = firstMatch(regexes2, agent); if (!r3) { return { major: 0, minor: 0 }; } var group = function(i2) { return Number(agent.replace(r3, "$" + i2)); }; return nu$4(group(1), group(2)); }; var detect$3 = function(versionRegexes, agent) { var cleanedAgent = String(agent).toLowerCase(); if (versionRegexes.length === 0) { return unknown$2(); } return find$2(versionRegexes, cleanedAgent); }; var unknown$2 = function() { return nu$4(0, 0); }; var nu$4 = function(major, minor) { return { major, minor }; }; var Version = { nu: nu$4, detect: detect$3, unknown: unknown$2 }; var detectBrowser$1 = function(browsers2, userAgentData) { return findMap(userAgentData.brands, function(uaBrand) { var lcBrand = uaBrand.brand.toLowerCase(); return find$3(browsers2, function(browser2) { var _a3; return lcBrand === ((_a3 = browser2.brand) === null || _a3 === void 0 ? void 0 : _a3.toLowerCase()); }).map(function(info3) { return { current: info3.name, version: Version.nu(parseInt(uaBrand.version, 10), 0) }; }); }); }; var detect$2 = function(candidates, userAgent2) { var agent = String(userAgent2).toLowerCase(); return find$3(candidates, function(candidate) { return candidate.search(agent); }); }; var detectBrowser = function(browsers2, userAgent2) { return detect$2(browsers2, userAgent2).map(function(browser2) { var version = Version.detect(browser2.versionRegexes, userAgent2); return { current: browser2.name, version }; }); }; var detectOs = function(oses2, userAgent2) { return detect$2(oses2, userAgent2).map(function(os2) { var version = Version.detect(os2.versionRegexes, userAgent2); return { current: os2.name, version }; }); }; var removeFromStart = function(str, numChars) { return str.substring(numChars); }; var checkRange = function(str, substr, start2) { return substr === "" || str.length >= substr.length && str.substr(start2, start2 + substr.length) === substr; }; var removeLeading = function(str, prefix) { return startsWith(str, prefix) ? removeFromStart(str, prefix.length) : str; }; var contains$2 = function(str, substr) { return str.indexOf(substr) !== -1; }; var startsWith = function(str, prefix) { return checkRange(str, prefix, 0); }; var blank = function(r3) { return function(s2) { return s2.replace(r3, ""); }; }; var trim$4 = blank(/^\s+|\s+$/g); var lTrim = blank(/^\s+/g); var rTrim = blank(/\s+$/g); var isNotEmpty = function(s2) { return s2.length > 0; }; var isEmpty$3 = function(s2) { return !isNotEmpty(s2); }; var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/; var checkContains = function(target) { return function(uastring) { return contains$2(uastring, target); }; }; var browsers = [ { name: "Edge", versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/], search: function(uastring) { return contains$2(uastring, "edge/") && contains$2(uastring, "chrome") && contains$2(uastring, "safari") && contains$2(uastring, "applewebkit"); } }, { name: "Chrome", brand: "Chromium", versionRegexes: [ /.*?chrome\/([0-9]+)\.([0-9]+).*/, normalVersionRegex ], search: function(uastring) { return contains$2(uastring, "chrome") && !contains$2(uastring, "chromeframe"); } }, { name: "IE", versionRegexes: [ /.*?msie\ ?([0-9]+)\.([0-9]+).*/, /.*?rv:([0-9]+)\.([0-9]+).*/ ], search: function(uastring) { return contains$2(uastring, "msie") || contains$2(uastring, "trident"); } }, { name: "Opera", versionRegexes: [ normalVersionRegex, /.*?opera\/([0-9]+)\.([0-9]+).*/ ], search: checkContains("opera") }, { name: "Firefox", versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/], search: checkContains("firefox") }, { name: "Safari", versionRegexes: [ normalVersionRegex, /.*?cpu os ([0-9]+)_([0-9]+).*/ ], search: function(uastring) { return (contains$2(uastring, "safari") || contains$2(uastring, "mobile/")) && contains$2(uastring, "applewebkit"); } } ]; var oses = [ { name: "Windows", search: checkContains("win"), versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/] }, { name: "iOS", search: function(uastring) { return contains$2(uastring, "iphone") || contains$2(uastring, "ipad"); }, versionRegexes: [ /.*?version\/\ ?([0-9]+)\.([0-9]+).*/, /.*cpu os ([0-9]+)_([0-9]+).*/, /.*cpu iphone os ([0-9]+)_([0-9]+).*/ ] }, { name: "Android", search: checkContains("android"), versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/] }, { name: "OSX", search: checkContains("mac os x"), versionRegexes: [/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/] }, { name: "Linux", search: checkContains("linux"), versionRegexes: [] }, { name: "Solaris", search: checkContains("sunos"), versionRegexes: [] }, { name: "FreeBSD", search: checkContains("freebsd"), versionRegexes: [] }, { name: "ChromeOS", search: checkContains("cros"), versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/] } ]; var PlatformInfo = { browsers: constant2(browsers), oses: constant2(oses) }; var edge = "Edge"; var chrome = "Chrome"; var ie$1 = "IE"; var opera = "Opera"; var firefox = "Firefox"; var safari = "Safari"; var unknown$1 = function() { return nu$3({ current: void 0, version: Version.unknown() }); }; var nu$3 = function(info3) { var current2 = info3.current; var version = info3.version; var isBrowser2 = function(name2) { return function() { return current2 === name2; }; }; return { current: current2, version, isEdge: isBrowser2(edge), isChrome: isBrowser2(chrome), isIE: isBrowser2(ie$1), isOpera: isBrowser2(opera), isFirefox: isBrowser2(firefox), isSafari: isBrowser2(safari) }; }; var Browser = { unknown: unknown$1, nu: nu$3, edge: constant2(edge), chrome: constant2(chrome), ie: constant2(ie$1), opera: constant2(opera), firefox: constant2(firefox), safari: constant2(safari) }; var windows = "Windows"; var ios = "iOS"; var android = "Android"; var linux = "Linux"; var osx = "OSX"; var solaris = "Solaris"; var freebsd = "FreeBSD"; var chromeos = "ChromeOS"; var unknown = function() { return nu$2({ current: void 0, version: Version.unknown() }); }; var nu$2 = function(info3) { var current2 = info3.current; var version = info3.version; var isOS = function(name2) { return function() { return current2 === name2; }; }; return { current: current2, version, isWindows: isOS(windows), isiOS: isOS(ios), isAndroid: isOS(android), isOSX: isOS(osx), isLinux: isOS(linux), isSolaris: isOS(solaris), isFreeBSD: isOS(freebsd), isChromeOS: isOS(chromeos) }; }; var OperatingSystem = { unknown, nu: nu$2, windows: constant2(windows), ios: constant2(ios), android: constant2(android), linux: constant2(linux), osx: constant2(osx), solaris: constant2(solaris), freebsd: constant2(freebsd), chromeos: constant2(chromeos) }; var detect$1 = function(userAgent2, userAgentDataOpt, mediaMatch2) { var browsers2 = PlatformInfo.browsers(); var oses2 = PlatformInfo.oses(); var browser2 = userAgentDataOpt.bind(function(userAgentData) { return detectBrowser$1(browsers2, userAgentData); }).orThunk(function() { return detectBrowser(browsers2, userAgent2); }).fold(Browser.unknown, Browser.nu); var os2 = detectOs(oses2, userAgent2).fold(OperatingSystem.unknown, OperatingSystem.nu); var deviceType2 = DeviceType(os2, browser2, userAgent2, mediaMatch2); return { browser: browser2, os: os2, deviceType: deviceType2 }; }; var PlatformDetection = { detect: detect$1 }; var mediaMatch = function(query) { return window.matchMedia(query).matches; }; var platform$2 = cached2(function() { return PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch); }); var detect = function() { return platform$2(); }; var userAgent = navigator.userAgent; var platform$1 = detect(); var browser$4 = platform$1.browser; var os = platform$1.os; var deviceType = platform$1.deviceType; var webkit = /WebKit/.test(userAgent) && !browser$4.isEdge(); var fileApi = "FormData" in window && "FileReader" in window && "URL" in window && !!URL.createObjectURL; var windowsPhone2 = userAgent.indexOf("Windows Phone") !== -1; var Env = { opera: browser$4.isOpera(), webkit, ie: browser$4.isIE() || browser$4.isEdge() ? browser$4.version.major : false, gecko: browser$4.isFirefox(), mac: os.isOSX() || os.isiOS(), iOS: deviceType.isiPad() || deviceType.isiPhone(), android: os.isAndroid(), contentEditable: true, transparentSrc: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", caretAfter: true, range: window.getSelection && "Range" in window, documentMode: browser$4.isIE() ? document.documentMode || 7 : 10, fileApi, ceFalse: true, cacheSuffix: null, container: null, experimentalShadowDom: false, canHaveCSP: !browser$4.isIE(), desktop: deviceType.isDesktop(), windowsPhone: windowsPhone2, browser: { current: browser$4.current, version: browser$4.version, isChrome: browser$4.isChrome, isEdge: browser$4.isEdge, isFirefox: browser$4.isFirefox, isIE: browser$4.isIE, isOpera: browser$4.isOpera, isSafari: browser$4.isSafari }, os: { current: os.current, version: os.version, isAndroid: os.isAndroid, isChromeOS: os.isChromeOS, isFreeBSD: os.isFreeBSD, isiOS: os.isiOS, isLinux: os.isLinux, isOSX: os.isOSX, isSolaris: os.isSolaris, isWindows: os.isWindows }, deviceType: { isDesktop: deviceType.isDesktop, isiPad: deviceType.isiPad, isiPhone: deviceType.isiPhone, isPhone: deviceType.isPhone, isTablet: deviceType.isTablet, isTouch: deviceType.isTouch, isWebView: deviceType.isWebView } }; var whiteSpaceRegExp$2 = /^\s*|\s*$/g; var trim$3 = function(str) { return str === null || str === void 0 ? "" : ("" + str).replace(whiteSpaceRegExp$2, ""); }; var is$3 = function(obj, type3) { if (!type3) { return obj !== void 0; } if (type3 === "array" && isArray2(obj)) { return true; } return typeof obj === type3; }; var makeMap$4 = function(items, delim, map3) { var i2; items = items || []; delim = delim || ","; if (typeof items === "string") { items = items.split(delim); } map3 = map3 || {}; i2 = items.length; while (i2--) { map3[items[i2]] = {}; } return map3; }; var hasOwnProperty2 = has$22; var create$9 = function(s2, p, root2) { var self2 = this; var sp, scn, c2, de = 0; s2 = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s2); var cn = s2[3].match(/(^|\.)(\w+)$/i)[2]; var ns = self2.createNS(s2[3].replace(/\.\w+$/, ""), root2); if (ns[cn]) { return; } if (s2[2] === "static") { ns[cn] = p; if (this.onCreate) { this.onCreate(s2[2], s2[3], ns[cn]); } return; } if (!p[cn]) { p[cn] = function() { }; de = 1; } ns[cn] = p[cn]; self2.extend(ns[cn].prototype, p); if (s2[5]) { sp = self2.resolve(s2[5]).prototype; scn = s2[5].match(/\.(\w+)$/i)[1]; c2 = ns[cn]; if (de) { ns[cn] = function() { return sp[scn].apply(this, arguments); }; } else { ns[cn] = function() { this.parent = sp[scn]; return c2.apply(this, arguments); }; } ns[cn].prototype[cn] = ns[cn]; self2.each(sp, function(f2, n2) { ns[cn].prototype[n2] = sp[n2]; }); self2.each(p, function(f2, n2) { if (sp[n2]) { ns[cn].prototype[n2] = function() { this.parent = sp[n2]; return f2.apply(this, arguments); }; } else { if (n2 !== cn) { ns[cn].prototype[n2] = f2; } } }); } self2.each(p.static, function(f2, n2) { ns[cn][n2] = f2; }); }; var extend$6 = function(obj) { var exts = []; for (var _i = 1; _i < arguments.length; _i++) { exts[_i - 1] = arguments[_i]; } for (var i2 = 0; i2 < exts.length; i2++) { var ext = exts[i2]; for (var name_1 in ext) { if (has$22(ext, name_1)) { var value25 = ext[name_1]; if (value25 !== void 0) { obj[name_1] = value25; } } } } return obj; }; var walk$3 = function(o2, f2, n2, s2) { s2 = s2 || this; if (o2) { if (n2) { o2 = o2[n2]; } each$i(o2, function(o3, i2) { if (f2.call(s2, o3, i2, n2) === false) { return false; } walk$3(o3, f2, n2, s2); }); } }; var createNS = function(n2, o2) { var i2, v2; o2 = o2 || window; n2 = n2.split("."); for (i2 = 0; i2 < n2.length; i2++) { v2 = n2[i2]; if (!o2[v2]) { o2[v2] = {}; } o2 = o2[v2]; } return o2; }; var resolve$3 = function(n2, o2) { var i2, l2; o2 = o2 || window; n2 = n2.split("."); for (i2 = 0, l2 = n2.length; i2 < l2; i2++) { o2 = o2[n2[i2]]; if (!o2) { break; } } return o2; }; var explode$4 = function(s2, d2) { if (!s2 || is$3(s2, "array")) { return s2; } return map$1(s2.split(d2 || ","), trim$3); }; var _addCacheSuffix = function(url2) { var cacheSuffix = Env.cacheSuffix; if (cacheSuffix) { url2 += (url2.indexOf("?") === -1 ? "?" : "&") + cacheSuffix; } return url2; }; var Tools = { trim: trim$3, isArray: isArray2, is: is$3, toArray: toArray$12, makeMap: makeMap$4, each: each$i, map: map$1, grep: filter$2, inArray: indexOf$12, hasOwn: hasOwnProperty2, extend: extend$6, create: create$9, walk: walk$3, createNS, resolve: resolve$3, explode: explode$4, _addCacheSuffix }; var fromHtml$1 = function(html, scope) { var doc2 = scope || document; var div = doc2.createElement("div"); div.innerHTML = html; if (!div.hasChildNodes() || div.childNodes.length > 1) { console.error("HTML does not have a single root node", html); throw new Error("HTML must have a single root node"); } return fromDom$2(div.childNodes[0]); }; var fromTag = function(tag, scope) { var doc2 = scope || document; var node = doc2.createElement(tag); return fromDom$2(node); }; var fromText = function(text, scope) { var doc2 = scope || document; var node = doc2.createTextNode(text); return fromDom$2(node); }; var fromDom$2 = function(node) { if (node === null || node === void 0) { throw new Error("Node cannot be null or undefined"); } return { dom: node }; }; var fromPoint$1 = function(docElm, x2, y2) { return Optional.from(docElm.dom.elementFromPoint(x2, y2)).map(fromDom$2); }; var SugarElement = { fromHtml: fromHtml$1, fromTag, fromText, fromDom: fromDom$2, fromPoint: fromPoint$1 }; var toArray2 = function(target, f2) { var r3 = []; var recurse = function(e2) { r3.push(e2); return f2(e2); }; var cur = f2(target); do { cur = cur.bind(recurse); } while (cur.isSome()); return r3; }; var compareDocumentPosition = function(a2, b2, match7) { return (a2.compareDocumentPosition(b2) & match7) !== 0; }; var documentPositionContainedBy = function(a2, b2) { return compareDocumentPosition(a2, b2, Node.DOCUMENT_POSITION_CONTAINED_BY); }; var COMMENT = 8; var DOCUMENT = 9; var DOCUMENT_FRAGMENT = 11; var ELEMENT = 1; var TEXT = 3; var is$2 = function(element, selector2) { var dom2 = element.dom; if (dom2.nodeType !== ELEMENT) { return false; } else { var elem = dom2; if (elem.matches !== void 0) { return elem.matches(selector2); } else if (elem.msMatchesSelector !== void 0) { return elem.msMatchesSelector(selector2); } else if (elem.webkitMatchesSelector !== void 0) { return elem.webkitMatchesSelector(selector2); } else if (elem.mozMatchesSelector !== void 0) { return elem.mozMatchesSelector(selector2); } else { throw new Error("Browser lacks native selectors"); } } }; var bypassSelector = function(dom2) { return dom2.nodeType !== ELEMENT && dom2.nodeType !== DOCUMENT && dom2.nodeType !== DOCUMENT_FRAGMENT || dom2.childElementCount === 0; }; var all2 = function(selector2, scope) { var base = scope === void 0 ? document : scope.dom; return bypassSelector(base) ? [] : map$3(base.querySelectorAll(selector2), SugarElement.fromDom); }; var one = function(selector2, scope) { var base = scope === void 0 ? document : scope.dom; return bypassSelector(base) ? Optional.none() : Optional.from(base.querySelector(selector2)).map(SugarElement.fromDom); }; var eq2 = function(e1, e2) { return e1.dom === e2.dom; }; var regularContains = function(e1, e2) { var d1 = e1.dom; var d2 = e2.dom; return d1 === d2 ? false : d1.contains(d2); }; var ieContains = function(e1, e2) { return documentPositionContainedBy(e1.dom, e2.dom); }; var contains$1 = function(e1, e2) { return detect().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2); }; typeof window !== "undefined" ? window : Function("return this;")(); var name = function(element) { var r3 = element.dom.nodeName; return r3.toLowerCase(); }; var type2 = function(element) { return element.dom.nodeType; }; var isType = function(t2) { return function(element) { return type2(element) === t2; }; }; var isComment$1 = function(element) { return type2(element) === COMMENT || name(element) === "#comment"; }; var isElement$6 = isType(ELEMENT); var isText$8 = isType(TEXT); var isDocument$2 = isType(DOCUMENT); var isDocumentFragment$1 = isType(DOCUMENT_FRAGMENT); var isTag = function(tag) { return function(e2) { return isElement$6(e2) && name(e2) === tag; }; }; var owner$1 = function(element) { return SugarElement.fromDom(element.dom.ownerDocument); }; var documentOrOwner = function(dos) { return isDocument$2(dos) ? dos : owner$1(dos); }; var documentElement = function(element) { return SugarElement.fromDom(documentOrOwner(element).dom.documentElement); }; var defaultView = function(element) { return SugarElement.fromDom(documentOrOwner(element).dom.defaultView); }; var parent2 = function(element) { return Optional.from(element.dom.parentNode).map(SugarElement.fromDom); }; var parents$1 = function(element, isRoot) { var stop3 = isFunction3(isRoot) ? isRoot : never; var dom2 = element.dom; var ret = []; while (dom2.parentNode !== null && dom2.parentNode !== void 0) { var rawParent = dom2.parentNode; var p = SugarElement.fromDom(rawParent); ret.push(p); if (stop3(p) === true) { break; } else { dom2 = rawParent; } } return ret; }; var siblings = function(element) { var filterSelf = function(elements) { return filter$4(elements, function(x2) { return !eq2(element, x2); }); }; return parent2(element).map(children).map(filterSelf).getOr([]); }; var prevSibling = function(element) { return Optional.from(element.dom.previousSibling).map(SugarElement.fromDom); }; var nextSibling = function(element) { return Optional.from(element.dom.nextSibling).map(SugarElement.fromDom); }; var prevSiblings = function(element) { return reverse(toArray2(element, prevSibling)); }; var nextSiblings = function(element) { return toArray2(element, nextSibling); }; var children = function(element) { return map$3(element.dom.childNodes, SugarElement.fromDom); }; var child$1 = function(element, index2) { var cs = element.dom.childNodes; return Optional.from(cs[index2]).map(SugarElement.fromDom); }; var firstChild = function(element) { return child$1(element, 0); }; var lastChild = function(element) { return child$1(element, element.dom.childNodes.length - 1); }; var childNodesCount = function(element) { return element.dom.childNodes.length; }; var getHead = function(doc2) { var b2 = doc2.dom.head; if (b2 === null || b2 === void 0) { throw new Error("Head is not available yet"); } return SugarElement.fromDom(b2); }; var isShadowRoot = function(dos) { return isDocumentFragment$1(dos) && isNonNullable(dos.dom.host); }; var supported = isFunction3(Element.prototype.attachShadow) && isFunction3(Node.prototype.getRootNode); var isSupported$1 = constant2(supported); var getRootNode = supported ? function(e2) { return SugarElement.fromDom(e2.dom.getRootNode()); } : documentOrOwner; var getStyleContainer = function(dos) { return isShadowRoot(dos) ? dos : getHead(documentOrOwner(dos)); }; var getShadowRoot = function(e2) { var r3 = getRootNode(e2); return isShadowRoot(r3) ? Optional.some(r3) : Optional.none(); }; var getShadowHost = function(e2) { return SugarElement.fromDom(e2.dom.host); }; var getOriginalEventTarget = function(event) { if (isSupported$1() && isNonNullable(event.target)) { var el = SugarElement.fromDom(event.target); if (isElement$6(el) && isOpenShadowHost(el)) { if (event.composed && event.composedPath) { var composedPath = event.composedPath(); if (composedPath) { return head(composedPath); } } } } return Optional.from(event.target); }; var isOpenShadowHost = function(element) { return isNonNullable(element.dom.shadowRoot); }; var before$4 = function(marker, element) { var parent$1 = parent2(marker); parent$1.each(function(v2) { v2.dom.insertBefore(element.dom, marker.dom); }); }; var after$3 = function(marker, element) { var sibling2 = nextSibling(marker); sibling2.fold(function() { var parent$1 = parent2(marker); parent$1.each(function(v2) { append$1(v2, element); }); }, function(v2) { before$4(v2, element); }); }; var prepend = function(parent3, element) { var firstChild$1 = firstChild(parent3); firstChild$1.fold(function() { append$1(parent3, element); }, function(v2) { parent3.dom.insertBefore(element.dom, v2.dom); }); }; var append$1 = function(parent3, element) { parent3.dom.appendChild(element.dom); }; var wrap$3 = function(element, wrapper) { before$4(element, wrapper); append$1(wrapper, element); }; var before$3 = function(marker, elements) { each$k(elements, function(x2) { before$4(marker, x2); }); }; var append = function(parent3, elements) { each$k(elements, function(x2) { append$1(parent3, x2); }); }; var empty2 = function(element) { element.dom.textContent = ""; each$k(children(element), function(rogue) { remove$7(rogue); }); }; var remove$7 = function(element) { var dom2 = element.dom; if (dom2.parentNode !== null) { dom2.parentNode.removeChild(dom2); } }; var unwrap = function(wrapper) { var children$1 = children(wrapper); if (children$1.length > 0) { before$3(wrapper, children$1); } remove$7(wrapper); }; var inBody = function(element) { var dom2 = isText$8(element) ? element.dom.parentNode : element.dom; if (dom2 === void 0 || dom2 === null || dom2.ownerDocument === null) { return false; } var doc2 = dom2.ownerDocument; return getShadowRoot(SugarElement.fromDom(dom2)).fold(function() { return doc2.body.contains(dom2); }, compose1(inBody, getShadowHost)); }; var r2 = function(left, top) { var translate2 = function(x2, y2) { return r2(left + x2, top + y2); }; return { left, top, translate: translate2 }; }; var SugarPosition = r2; var boxPosition = function(dom2) { var box = dom2.getBoundingClientRect(); return SugarPosition(box.left, box.top); }; var firstDefinedOrZero = function(a2, b2) { if (a2 !== void 0) { return a2; } else { return b2 !== void 0 ? b2 : 0; } }; var absolute = function(element) { var doc2 = element.dom.ownerDocument; var body = doc2.body; var win = doc2.defaultView; var html = doc2.documentElement; if (body === element.dom) { return SugarPosition(body.offsetLeft, body.offsetTop); } var scrollTop2 = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageYOffset, html.scrollTop); var scrollLeft2 = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageXOffset, html.scrollLeft); var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop); var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft); return viewport(element).translate(scrollLeft2 - clientLeft, scrollTop2 - clientTop); }; var viewport = function(element) { var dom2 = element.dom; var doc2 = dom2.ownerDocument; var body = doc2.body; if (body === dom2) { return SugarPosition(body.offsetLeft, body.offsetTop); } if (!inBody(element)) { return SugarPosition(0, 0); } return boxPosition(dom2); }; var get$8 = function(_DOC) { var doc2 = _DOC !== void 0 ? _DOC.dom : document; var x2 = doc2.body.scrollLeft || doc2.documentElement.scrollLeft; var y2 = doc2.body.scrollTop || doc2.documentElement.scrollTop; return SugarPosition(x2, y2); }; var to2 = function(x2, y2, _DOC) { var doc2 = _DOC !== void 0 ? _DOC.dom : document; var win = doc2.defaultView; if (win) { win.scrollTo(x2, y2); } }; var intoView = function(element, alignToTop) { var isSafari = detect().browser.isSafari(); if (isSafari && isFunction3(element.dom.scrollIntoViewIfNeeded)) { element.dom.scrollIntoViewIfNeeded(false); } else { element.dom.scrollIntoView(alignToTop); } }; var get$7 = function(_win) { var win = _win === void 0 ? window : _win; if (detect().browser.isFirefox()) { return Optional.none(); } else { return Optional.from(win["visualViewport"]); } }; var bounds = function(x2, y2, width, height) { return { x: x2, y: y2, width, height, right: x2 + width, bottom: y2 + height }; }; var getBounds = function(_win) { var win = _win === void 0 ? window : _win; var doc2 = win.document; var scroll = get$8(SugarElement.fromDom(doc2)); return get$7(win).fold(function() { var html = win.document.documentElement; var width = html.clientWidth; var height = html.clientHeight; return bounds(scroll.left, scroll.top, width, height); }, function(visualViewport) { return bounds(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height); }); }; var isNodeType = function(type3) { return function(node) { return !!node && node.nodeType === type3; }; }; var isRestrictedNode = function(node) { return !!node && !Object.getPrototypeOf(node); }; var isElement$5 = isNodeType(1); var matchNodeNames = function(names2) { var lowercasedNames = names2.map(function(s2) { return s2.toLowerCase(); }); return function(node) { if (node && node.nodeName) { var nodeName = node.nodeName.toLowerCase(); return contains$3(lowercasedNames, nodeName); } return false; }; }; var matchStyleValues = function(name2, values3) { var items = values3.toLowerCase().split(" "); return function(node) { if (isElement$5(node)) { for (var i2 = 0; i2 < items.length; i2++) { var computed2 = node.ownerDocument.defaultView.getComputedStyle(node, null); var cssValue = computed2 ? computed2.getPropertyValue(name2) : null; if (cssValue === items[i2]) { return true; } } } return false; }; }; var hasAttribute2 = function(attrName) { return function(node) { return isElement$5(node) && node.hasAttribute(attrName); }; }; var hasAttributeValue = function(attrName, attrValue) { return function(node) { return isElement$5(node) && node.getAttribute(attrName) === attrValue; }; }; var isBogus$2 = function(node) { return isElement$5(node) && node.hasAttribute("data-mce-bogus"); }; var isBogusAll$1 = function(node) { return isElement$5(node) && node.getAttribute("data-mce-bogus") === "all"; }; var isTable$3 = function(node) { return isElement$5(node) && node.tagName === "TABLE"; }; var hasContentEditableState = function(value25) { return function(node) { if (isElement$5(node)) { if (node.contentEditable === value25) { return true; } if (node.getAttribute("data-mce-contenteditable") === value25) { return true; } } return false; }; }; var isTextareaOrInput = matchNodeNames([ "textarea", "input" ]); var isText$7 = isNodeType(3); var isComment = isNodeType(8); var isDocument$1 = isNodeType(9); var isDocumentFragment = isNodeType(11); var isBr$5 = matchNodeNames(["br"]); var isImg = matchNodeNames(["img"]); var isContentEditableTrue$4 = hasContentEditableState("true"); var isContentEditableFalse$b = hasContentEditableState("false"); var isTableCell$5 = matchNodeNames([ "td", "th" ]); var isMedia$2 = matchNodeNames([ "video", "audio", "object", "embed" ]); var is$1 = function(lhs, rhs, comparator) { if (comparator === void 0) { comparator = tripleEquals; } return lhs.exists(function(left) { return comparator(left, rhs); }); }; var cat = function(arr2) { var r3 = []; var push4 = function(x2) { r3.push(x2); }; for (var i2 = 0; i2 < arr2.length; i2++) { arr2[i2].each(push4); } return r3; }; var lift2 = function(oa, ob, f2) { return oa.isSome() && ob.isSome() ? Optional.some(f2(oa.getOrDie(), ob.getOrDie())) : Optional.none(); }; var lift3 = function(oa, ob, oc, f2) { return oa.isSome() && ob.isSome() && oc.isSome() ? Optional.some(f2(oa.getOrDie(), ob.getOrDie(), oc.getOrDie())) : Optional.none(); }; var someIf = function(b2, a2) { return b2 ? Optional.some(a2) : Optional.none(); }; var isSupported = function(dom2) { return dom2.style !== void 0 && isFunction3(dom2.style.getPropertyValue); }; var rawSet = function(dom2, key2, value25) { if (isString$12(value25) || isBoolean2(value25) || isNumber2(value25)) { dom2.setAttribute(key2, value25 + ""); } else { console.error("Invalid call to Attribute.set. Key ", key2, ":: Value ", value25, ":: Element ", dom2); throw new Error("Attribute value was not simple"); } }; var set$12 = function(element, key2, value25) { rawSet(element.dom, key2, value25); }; var setAll$1 = function(element, attrs) { var dom2 = element.dom; each$j(attrs, function(v2, k2) { rawSet(dom2, k2, v2); }); }; var get$6 = function(element, key2) { var v2 = element.dom.getAttribute(key2); return v2 === null ? void 0 : v2; }; var getOpt = function(element, key2) { return Optional.from(get$6(element, key2)); }; var has$12 = function(element, key2) { var dom2 = element.dom; return dom2 && dom2.hasAttribute ? dom2.hasAttribute(key2) : false; }; var remove$6 = function(element, key2) { element.dom.removeAttribute(key2); }; var clone$3 = function(element) { return foldl(element.dom.attributes, function(acc, attr) { acc[attr.name] = attr.value; return acc; }, {}); }; var internalSet = function(dom2, property2, value25) { if (!isString$12(value25)) { console.error("Invalid call to CSS.set. Property ", property2, ":: Value ", value25, ":: Element ", dom2); throw new Error("CSS value must be a string: " + value25); } if (isSupported(dom2)) { dom2.style.setProperty(property2, value25); } }; var setAll = function(element, css2) { var dom2 = element.dom; each$j(css2, function(v2, k2) { internalSet(dom2, k2, v2); }); }; var get$5 = function(element, property2) { var dom2 = element.dom; var styles = window.getComputedStyle(dom2); var r3 = styles.getPropertyValue(property2); return r3 === "" && !inBody(element) ? getUnsafeProperty(dom2, property2) : r3; }; var getUnsafeProperty = function(dom2, property2) { return isSupported(dom2) ? dom2.style.getPropertyValue(property2) : ""; }; var getRaw = function(element, property2) { var dom2 = element.dom; var raw = getUnsafeProperty(dom2, property2); return Optional.from(raw).filter(function(r3) { return r3.length > 0; }); }; var getAllRaw = function(element) { var css2 = {}; var dom2 = element.dom; if (isSupported(dom2)) { for (var i2 = 0; i2 < dom2.style.length; i2++) { var ruleName = dom2.style.item(i2); css2[ruleName] = dom2.style[ruleName]; } } return css2; }; var reflow = function(e2) { return e2.dom.offsetWidth; }; var browser$3 = detect().browser; var firstElement = function(nodes2) { return find$3(nodes2, isElement$6); }; var getTableCaptionDeltaY = function(elm) { if (browser$3.isFirefox() && name(elm) === "table") { return firstElement(children(elm)).filter(function(elm2) { return name(elm2) === "caption"; }).bind(function(caption) { return firstElement(nextSiblings(caption)).map(function(body) { var bodyTop = body.dom.offsetTop; var captionTop = caption.dom.offsetTop; var captionHeight = caption.dom.offsetHeight; return bodyTop <= captionTop ? -captionHeight : 0; }); }).getOr(0); } else { return 0; } }; var hasChild = function(elm, child2) { return elm.children && contains$3(elm.children, child2); }; var getPos = function(body, elm, rootElm) { var x2 = 0, y2 = 0; var doc2 = body.ownerDocument; rootElm = rootElm ? rootElm : body; if (elm) { if (rootElm === body && elm.getBoundingClientRect && get$5(SugarElement.fromDom(body), "position") === "static") { var pos = elm.getBoundingClientRect(); x2 = pos.left + (doc2.documentElement.scrollLeft || body.scrollLeft) - doc2.documentElement.clientLeft; y2 = pos.top + (doc2.documentElement.scrollTop || body.scrollTop) - doc2.documentElement.clientTop; return { x: x2, y: y2 }; } var offsetParent = elm; while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType && !hasChild(offsetParent, rootElm)) { var castOffsetParent = offsetParent; x2 += castOffsetParent.offsetLeft || 0; y2 += castOffsetParent.offsetTop || 0; offsetParent = castOffsetParent.offsetParent; } offsetParent = elm.parentNode; while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType && !hasChild(offsetParent, rootElm)) { x2 -= offsetParent.scrollLeft || 0; y2 -= offsetParent.scrollTop || 0; offsetParent = offsetParent.parentNode; } y2 += getTableCaptionDeltaY(SugarElement.fromDom(elm)); } return { x: x2, y: y2 }; }; var exports$1 = {}, module$1 = { exports: exports$1 }; (function(define2, exports2, module3, require2) { (function(global2, factory) { typeof exports2 === "object" && typeof module3 !== "undefined" ? module3.exports = factory() : typeof define2 === "function" && define2.amd ? define2(factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.EphoxContactWrapper = factory()); })(this, function() { var commonjsGlobal$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : {}; var promise = { exports: {} }; (function(module4) { (function(root2) { var setTimeoutFunc = setTimeout; function noop3() { } function bind5(fn, thisArg) { return function() { fn.apply(thisArg, arguments); }; } function Promise2(fn) { if (typeof this !== "object") throw new TypeError("Promises must be constructed via new"); if (typeof fn !== "function") throw new TypeError("not a function"); this._state = 0; this._handled = false; this._value = void 0; this._deferreds = []; doResolve(fn, this); } function handle2(self2, deferred) { while (self2._state === 3) { self2 = self2._value; } if (self2._state === 0) { self2._deferreds.push(deferred); return; } self2._handled = true; Promise2._immediateFn(function() { var cb = self2._state === 1 ? deferred.onFulfilled : deferred.onRejected; if (cb === null) { (self2._state === 1 ? resolve2 : reject)(deferred.promise, self2._value); return; } var ret; try { ret = cb(self2._value); } catch (e2) { reject(deferred.promise, e2); return; } resolve2(deferred.promise, ret); }); } function resolve2(self2, newValue) { try { if (newValue === self2) throw new TypeError("A promise cannot be resolved with itself."); if (newValue && (typeof newValue === "object" || typeof newValue === "function")) { var then = newValue.then; if (newValue instanceof Promise2) { self2._state = 3; self2._value = newValue; finale(self2); return; } else if (typeof then === "function") { doResolve(bind5(then, newValue), self2); return; } } self2._state = 1; self2._value = newValue; finale(self2); } catch (e2) { reject(self2, e2); } } function reject(self2, newValue) { self2._state = 2; self2._value = newValue; finale(self2); } function finale(self2) { if (self2._state === 2 && self2._deferreds.length === 0) { Promise2._immediateFn(function() { if (!self2._handled) { Promise2._unhandledRejectionFn(self2._value); } }); } for (var i2 = 0, len = self2._deferreds.length; i2 < len; i2++) { handle2(self2, self2._deferreds[i2]); } self2._deferreds = null; } function Handler(onFulfilled, onRejected, promise2) { this.onFulfilled = typeof onFulfilled === "function" ? onFulfilled : null; this.onRejected = typeof onRejected === "function" ? onRejected : null; this.promise = promise2; } function doResolve(fn, self2) { var done2 = false; try { fn(function(value25) { if (done2) return; done2 = true; resolve2(self2, value25); }, function(reason) { if (done2) return; done2 = true; reject(self2, reason); }); } catch (ex) { if (done2) return; done2 = true; reject(self2, ex); } } Promise2.prototype["catch"] = function(onRejected) { return this.then(null, onRejected); }; Promise2.prototype.then = function(onFulfilled, onRejected) { var prom = new this.constructor(noop3); handle2(this, new Handler(onFulfilled, onRejected, prom)); return prom; }; Promise2.all = function(arr2) { var args = Array.prototype.slice.call(arr2); return new Promise2(function(resolve3, reject2) { if (args.length === 0) return resolve3([]); var remaining = args.length; function res(i3, val) { try { if (val && (typeof val === "object" || typeof val === "function")) { var then = val.then; if (typeof then === "function") { then.call(val, function(val2) { res(i3, val2); }, reject2); return; } } args[i3] = val; if (--remaining === 0) { resolve3(args); } } catch (ex) { reject2(ex); } } for (var i2 = 0; i2 < args.length; i2++) { res(i2, args[i2]); } }); }; Promise2.resolve = function(value25) { if (value25 && typeof value25 === "object" && value25.constructor === Promise2) { return value25; } return new Promise2(function(resolve3) { resolve3(value25); }); }; Promise2.reject = function(value25) { return new Promise2(function(resolve3, reject2) { reject2(value25); }); }; Promise2.race = function(values3) { return new Promise2(function(resolve3, reject2) { for (var i2 = 0, len = values3.length; i2 < len; i2++) { values3[i2].then(resolve3, reject2); } }); }; Promise2._immediateFn = typeof setImmediate === "function" ? function(fn) { setImmediate(fn); } : function(fn) { setTimeoutFunc(fn, 0); }; Promise2._unhandledRejectionFn = function _unhandledRejectionFn(err) { if (typeof console !== "undefined" && console) { console.warn("Possible Unhandled Promise Rejection:", err); } }; Promise2._setImmediateFn = function _setImmediateFn(fn) { Promise2._immediateFn = fn; }; Promise2._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) { Promise2._unhandledRejectionFn = fn; }; if (module4.exports) { module4.exports = Promise2; } else if (!root2.Promise) { root2.Promise = Promise2; } })(commonjsGlobal$1); })(promise); var promisePolyfill = promise.exports; var Global = function() { if (typeof window !== "undefined") { return window; } else { return Function("return this;")(); } }(); var promisePolyfill_1 = { boltExport: Global.Promise || promisePolyfill }; return promisePolyfill_1; }); })(void 0, exports$1, module$1); var Promise$12 = module$1.exports.boltExport; var nu$1 = function(baseFn) { var data66 = Optional.none(); var callbacks2 = []; var map3 = function(f2) { return nu$1(function(nCallback) { get3(function(data67) { nCallback(f2(data67)); }); }); }; var get3 = function(nCallback) { if (isReady()) { call3(nCallback); } else { callbacks2.push(nCallback); } }; var set3 = function(x2) { if (!isReady()) { data66 = Optional.some(x2); run(callbacks2); callbacks2 = []; } }; var isReady = function() { return data66.isSome(); }; var run = function(cbs) { each$k(cbs, call3); }; var call3 = function(cb) { data66.each(function(x2) { setTimeout(function() { cb(x2); }, 0); }); }; baseFn(set3); return { get: get3, map: map3, isReady }; }; var pure$1 = function(a2) { return nu$1(function(callback2) { callback2(a2); }); }; var LazyValue = { nu: nu$1, pure: pure$1 }; var errorReporter = function(err) { setTimeout(function() { throw err; }, 0); }; var make = function(run) { var get3 = function(callback2) { run().then(callback2, errorReporter); }; var map3 = function(fab) { return make(function() { return run().then(fab); }); }; var bind5 = function(aFutureB) { return make(function() { return run().then(function(v2) { return aFutureB(v2).toPromise(); }); }); }; var anonBind = function(futureB) { return make(function() { return run().then(function() { return futureB.toPromise(); }); }); }; var toLazy = function() { return LazyValue.nu(get3); }; var toCached = function() { var cache2 = null; return make(function() { if (cache2 === null) { cache2 = run(); } return cache2; }); }; var toPromise = run; return { map: map3, bind: bind5, anonBind, toLazy, toCached, toPromise, get: get3 }; }; var nu = function(baseFn) { return make(function() { return new Promise$12(baseFn); }); }; var pure = function(a2) { return make(function() { return Promise$12.resolve(a2); }); }; var Future = { nu, pure }; var par$1 = function(asyncValues, nu2) { return nu2(function(callback2) { var r3 = []; var count3 = 0; var cb = function(i2) { return function(value25) { r3[i2] = value25; count3++; if (count3 >= asyncValues.length) { callback2(r3); } }; }; if (asyncValues.length === 0) { callback2([]); } else { each$k(asyncValues, function(asyncValue, i2) { asyncValue.get(cb(i2)); }); } }); }; var par = function(futures) { return par$1(futures, Future.nu); }; var value$1 = function(o2) { var or2 = function(_opt) { return value$1(o2); }; var orThunk = function(_f) { return value$1(o2); }; var map3 = function(f2) { return value$1(f2(o2)); }; var mapError = function(_f) { return value$1(o2); }; var each3 = function(f2) { f2(o2); }; var bind5 = function(f2) { return f2(o2); }; var fold = function(_2, onValue) { return onValue(o2); }; var exists2 = function(f2) { return f2(o2); }; var forall2 = function(f2) { return f2(o2); }; var toOptional = function() { return Optional.some(o2); }; return { isValue: always, isError: never, getOr: constant2(o2), getOrThunk: constant2(o2), getOrDie: constant2(o2), or: or2, orThunk, fold, map: map3, mapError, each: each3, bind: bind5, exists: exists2, forall: forall2, toOptional }; }; var error3 = function(message2) { var getOrThunk = function(f2) { return f2(); }; var getOrDie = function() { return die(String(message2))(); }; var or2 = identity2; var orThunk = function(f2) { return f2(); }; var map3 = function(_f) { return error3(message2); }; var mapError = function(f2) { return error3(f2(message2)); }; var bind5 = function(_f) { return error3(message2); }; var fold = function(onError2, _2) { return onError2(message2); }; return { isValue: never, isError: always, getOr: identity2, getOrThunk, getOrDie, or: or2, orThunk, fold, map: map3, mapError, each: noop2, bind: bind5, exists: never, forall: always, toOptional: Optional.none }; }; var fromOption = function(opt, err) { return opt.fold(function() { return error3(err); }, value$1); }; var Result = { value: value$1, error: error3, fromOption }; var generate$12 = function(cases) { if (!isArray$12(cases)) { throw new Error("cases must be an array"); } if (cases.length === 0) { throw new Error("there must be at least one case"); } var constructors = []; var adt2 = {}; each$k(cases, function(acase, count3) { var keys$12 = keys2(acase); if (keys$12.length !== 1) { throw new Error("one and only one name per case"); } var key2 = keys$12[0]; var value25 = acase[key2]; if (adt2[key2] !== void 0) { throw new Error("duplicate key detected:" + key2); } else if (key2 === "cata") { throw new Error("cannot have a case named cata (sorry)"); } else if (!isArray$12(value25)) { throw new Error("case arguments must be an array"); } constructors.push(key2); adt2[key2] = function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var argLength = args.length; if (argLength !== value25.length) { throw new Error("Wrong number of arguments to case " + key2 + ". Expected " + value25.length + " (" + value25 + "), got " + argLength); } var match7 = function(branches) { var branchKeys = keys2(branches); if (constructors.length !== branchKeys.length) { throw new Error("Wrong number of arguments to match. Expected: " + constructors.join(",") + "\nActual: " + branchKeys.join(",")); } var allReqd = forall(constructors, function(reqKey) { return contains$3(branchKeys, reqKey); }); if (!allReqd) { throw new Error("Not all branches were specified when using match. Specified: " + branchKeys.join(", ") + "\nRequired: " + constructors.join(", ")); } return branches[key2].apply(null, args); }; return { fold: function() { var foldArgs = []; for (var _i2 = 0; _i2 < arguments.length; _i2++) { foldArgs[_i2] = arguments[_i2]; } if (foldArgs.length !== cases.length) { throw new Error("Wrong number of arguments to fold. Expected " + cases.length + ", got " + foldArgs.length); } var target = foldArgs[count3]; return target.apply(null, args); }, match: match7, log: function(label) { console.log(label, { constructors, constructor: key2, params: args }); } }; }; }); return adt2; }; var Adt = { generate: generate$12 }; Adt.generate([ { bothErrors: [ "error1", "error2" ] }, { firstError: [ "error1", "value2" ] }, { secondError: [ "value1", "error2" ] }, { bothValues: [ "value1", "value2" ] } ]); var unite = function(result) { return result.fold(identity2, identity2); }; function ClosestOrAncestor(is3, ancestor2, scope, a2, isRoot) { if (is3(scope, a2)) { return Optional.some(scope); } else if (isFunction3(isRoot) && isRoot(scope)) { return Optional.none(); } else { return ancestor2(scope, a2, isRoot); } } var ancestor$3 = function(scope, predicate, isRoot) { var element = scope.dom; var stop3 = isFunction3(isRoot) ? isRoot : never; while (element.parentNode) { element = element.parentNode; var el = SugarElement.fromDom(element); if (predicate(el)) { return Optional.some(el); } else if (stop3(el)) { break; } } return Optional.none(); }; var closest$3 = function(scope, predicate, isRoot) { var is3 = function(s2, test2) { return test2(s2); }; return ClosestOrAncestor(is3, ancestor$3, scope, predicate, isRoot); }; var sibling$2 = function(scope, predicate) { var element = scope.dom; if (!element.parentNode) { return Optional.none(); } return child(SugarElement.fromDom(element.parentNode), function(x2) { return !eq2(scope, x2) && predicate(x2); }); }; var child = function(scope, predicate) { var pred = function(node) { return predicate(SugarElement.fromDom(node)); }; var result = find$3(scope.dom.childNodes, pred); return result.map(SugarElement.fromDom); }; var ancestor$2 = function(scope, selector2, isRoot) { return ancestor$3(scope, function(e2) { return is$2(e2, selector2); }, isRoot); }; var descendant = function(scope, selector2) { return one(selector2, scope); }; var closest$2 = function(scope, selector2, isRoot) { var is3 = function(element, selector3) { return is$2(element, selector3); }; return ClosestOrAncestor(is3, ancestor$2, scope, selector2, isRoot); }; var promiseObj = window.Promise ? window.Promise : Promise$12; var requestAnimationFramePromise; var requestAnimationFrame2 = function(callback2, element) { var requestAnimationFrameFunc = window.requestAnimationFrame; var vendors = [ "ms", "moz", "webkit" ]; var featurefill = function(cb) { window.setTimeout(cb, 0); }; for (var i2 = 0; i2 < vendors.length && !requestAnimationFrameFunc; i2++) { requestAnimationFrameFunc = window[vendors[i2] + "RequestAnimationFrame"]; } if (!requestAnimationFrameFunc) { requestAnimationFrameFunc = featurefill; } requestAnimationFrameFunc(callback2, element); }; var wrappedSetTimeout = function(callback2, time) { if (typeof time !== "number") { time = 0; } return setTimeout(callback2, time); }; var wrappedSetInterval = function(callback2, time) { if (typeof time !== "number") { time = 1; } return setInterval(callback2, time); }; var wrappedClearTimeout = function(id2) { return clearTimeout(id2); }; var wrappedClearInterval = function(id2) { return clearInterval(id2); }; var debounce2 = function(callback2, time) { var timer; var func = function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } clearTimeout(timer); timer = wrappedSetTimeout(function() { callback2.apply(this, args); }, time); }; func.stop = function() { clearTimeout(timer); }; return func; }; var Delay = { requestAnimationFrame: function(callback2, element) { if (requestAnimationFramePromise) { requestAnimationFramePromise.then(callback2); return; } requestAnimationFramePromise = new promiseObj(function(resolve2) { if (!element) { element = document.body; } requestAnimationFrame2(resolve2, element); }).then(callback2); }, setTimeout: wrappedSetTimeout, setInterval: wrappedSetInterval, setEditorTimeout: function(editor, callback2, time) { return wrappedSetTimeout(function() { if (!editor.removed) { callback2(); } }, time); }, setEditorInterval: function(editor, callback2, time) { var timer = wrappedSetInterval(function() { if (!editor.removed) { callback2(); } else { clearInterval(timer); } }, time); return timer; }, debounce: debounce2, throttle: debounce2, clearInterval: wrappedClearInterval, clearTimeout: wrappedClearTimeout }; var StyleSheetLoader = function(documentOrShadowRoot, settings) { if (settings === void 0) { settings = {}; } var idCount = 0; var loadedStates = {}; var edos = SugarElement.fromDom(documentOrShadowRoot); var doc2 = documentOrOwner(edos); var maxLoadTime = settings.maxLoadTime || 5e3; var _setReferrerPolicy = function(referrerPolicy) { settings.referrerPolicy = referrerPolicy; }; var addStyle = function(element) { append$1(getStyleContainer(edos), element); }; var removeStyle = function(id2) { var styleContainer = getStyleContainer(edos); descendant(styleContainer, "#" + id2).each(remove$7); }; var getOrCreateState = function(url2) { return get$9(loadedStates, url2).getOrThunk(function() { return { id: "mce-u" + idCount++, passed: [], failed: [], count: 0 }; }); }; var load = function(url2, success3, failure) { var link; var urlWithSuffix = Tools._addCacheSuffix(url2); var state = getOrCreateState(urlWithSuffix); loadedStates[urlWithSuffix] = state; state.count++; var resolve2 = function(callbacks2, status) { var i2 = callbacks2.length; while (i2--) { callbacks2[i2](); } state.status = status; state.passed = []; state.failed = []; if (link) { link.onload = null; link.onerror = null; link = null; } }; var passed = function() { return resolve2(state.passed, 2); }; var failed = function() { return resolve2(state.failed, 3); }; var wait = function(testCallback, waitCallback) { if (!testCallback()) { if (Date.now() - startTime < maxLoadTime) { Delay.setTimeout(waitCallback); } else { failed(); } } }; var waitForWebKitLinkLoaded = function() { wait(function() { var styleSheets = documentOrShadowRoot.styleSheets; var i2 = styleSheets.length; while (i2--) { var styleSheet = styleSheets[i2]; var owner2 = styleSheet.ownerNode; if (owner2 && owner2.id === link.id) { passed(); return true; } } return false; }, waitForWebKitLinkLoaded); }; if (success3) { state.passed.push(success3); } if (failure) { state.failed.push(failure); } if (state.status === 1) { return; } if (state.status === 2) { passed(); return; } if (state.status === 3) { failed(); return; } state.status = 1; var linkElem = SugarElement.fromTag("link", doc2.dom); setAll$1(linkElem, { rel: "stylesheet", type: "text/css", id: state.id }); var startTime = Date.now(); if (settings.contentCssCors) { set$12(linkElem, "crossOrigin", "anonymous"); } if (settings.referrerPolicy) { set$12(linkElem, "referrerpolicy", settings.referrerPolicy); } link = linkElem.dom; link.onload = waitForWebKitLinkLoaded; link.onerror = failed; addStyle(linkElem); set$12(linkElem, "href", urlWithSuffix); }; var loadF = function(url2) { return Future.nu(function(resolve2) { load(url2, compose(resolve2, constant2(Result.value(url2))), compose(resolve2, constant2(Result.error(url2)))); }); }; var loadAll = function(urls, success3, failure) { par(map$3(urls, loadF)).get(function(result) { var parts = partition2(result, function(r3) { return r3.isValue(); }); if (parts.fail.length > 0) { failure(parts.fail.map(unite)); } else { success3(parts.pass.map(unite)); } }); }; var unload = function(url2) { var urlWithSuffix = Tools._addCacheSuffix(url2); get$9(loadedStates, urlWithSuffix).each(function(state) { var count3 = --state.count; if (count3 === 0) { delete loadedStates[urlWithSuffix]; removeStyle(state.id); } }); }; var unloadAll = function(urls) { each$k(urls, function(url2) { unload(url2); }); }; return { load, loadAll, unload, unloadAll, _setReferrerPolicy }; }; var create$8 = function() { var map3 = /* @__PURE__ */ new WeakMap(); var forElement = function(referenceElement, settings) { var root2 = getRootNode(referenceElement); var rootDom = root2.dom; return Optional.from(map3.get(rootDom)).getOrThunk(function() { var sl = StyleSheetLoader(rootDom, settings); map3.set(rootDom, sl); return sl; }); }; return { forElement }; }; var instance = create$8(); var DomTreeWalker = function() { function DomTreeWalker2(startNode, rootNode) { this.node = startNode; this.rootNode = rootNode; this.current = this.current.bind(this); this.next = this.next.bind(this); this.prev = this.prev.bind(this); this.prev2 = this.prev2.bind(this); } DomTreeWalker2.prototype.current = function() { return this.node; }; DomTreeWalker2.prototype.next = function(shallow2) { this.node = this.findSibling(this.node, "firstChild", "nextSibling", shallow2); return this.node; }; DomTreeWalker2.prototype.prev = function(shallow2) { this.node = this.findSibling(this.node, "lastChild", "previousSibling", shallow2); return this.node; }; DomTreeWalker2.prototype.prev2 = function(shallow2) { this.node = this.findPreviousNode(this.node, "lastChild", "previousSibling", shallow2); return this.node; }; DomTreeWalker2.prototype.findSibling = function(node, startName, siblingName, shallow2) { var sibling2, parent3; if (node) { if (!shallow2 && node[startName]) { return node[startName]; } if (node !== this.rootNode) { sibling2 = node[siblingName]; if (sibling2) { return sibling2; } for (parent3 = node.parentNode; parent3 && parent3 !== this.rootNode; parent3 = parent3.parentNode) { sibling2 = parent3[siblingName]; if (sibling2) { return sibling2; } } } } }; DomTreeWalker2.prototype.findPreviousNode = function(node, startName, siblingName, shallow2) { var sibling2, parent3, child2; if (node) { sibling2 = node[siblingName]; if (this.rootNode && sibling2 === this.rootNode) { return; } if (sibling2) { if (!shallow2) { for (child2 = sibling2[startName]; child2; child2 = child2[startName]) { if (!child2[startName]) { return child2; } } } return sibling2; } parent3 = node.parentNode; if (parent3 && parent3 !== this.rootNode) { return parent3; } } }; return DomTreeWalker2; }(); var blocks = [ "article", "aside", "details", "div", "dt", "figcaption", "footer", "form", "fieldset", "header", "hgroup", "html", "main", "nav", "section", "summary", "body", "p", "dl", "multicol", "dd", "figure", "address", "center", "blockquote", "h1", "h2", "h3", "h4", "h5", "h6", "listing", "xmp", "pre", "plaintext", "menu", "dir", "ul", "ol", "li", "hr", "table", "tbody", "thead", "tfoot", "th", "tr", "td", "caption" ]; var tableCells = [ "td", "th" ]; var tableSections = [ "thead", "tbody", "tfoot" ]; var textBlocks = [ "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "pre", "form", "blockquote", "center", "dir", "fieldset", "header", "footer", "article", "section", "hgroup", "aside", "nav", "figure" ]; var headings = [ "h1", "h2", "h3", "h4", "h5", "h6" ]; var listItems$1 = [ "li", "dd", "dt" ]; var lists = [ "ul", "ol", "dl" ]; var wsElements = [ "pre", "script", "textarea", "style" ]; var lazyLookup = function(items) { var lookup; return function(node) { lookup = lookup ? lookup : mapToObject(items, always); return has$22(lookup, name(node)); }; }; var isHeading = lazyLookup(headings); var isBlock$2 = lazyLookup(blocks); var isTable$2 = function(node) { return name(node) === "table"; }; var isInline$1 = function(node) { return isElement$6(node) && !isBlock$2(node); }; var isBr$4 = function(node) { return isElement$6(node) && name(node) === "br"; }; var isTextBlock$2 = lazyLookup(textBlocks); var isList = lazyLookup(lists); var isListItem = lazyLookup(listItems$1); var isTableSection = lazyLookup(tableSections); var isTableCell$4 = lazyLookup(tableCells); var isWsPreserveElement = lazyLookup(wsElements); var ancestor$1 = function(scope, selector2, isRoot) { return ancestor$2(scope, selector2, isRoot).isSome(); }; var zeroWidth = "\uFEFF"; var nbsp = "\xA0"; var isZwsp$1 = function(char) { return char === zeroWidth; }; var removeZwsp = function(s2) { return s2.replace(/\uFEFF/g, ""); }; var ZWSP$1 = zeroWidth; var isZwsp = isZwsp$1; var trim$2 = removeZwsp; var isElement$4 = isElement$5; var isText$6 = isText$7; var isCaretContainerBlock$1 = function(node) { if (isText$6(node)) { node = node.parentNode; } return isElement$4(node) && node.hasAttribute("data-mce-caret"); }; var isCaretContainerInline = function(node) { return isText$6(node) && isZwsp(node.data); }; var isCaretContainer$2 = function(node) { return isCaretContainerBlock$1(node) || isCaretContainerInline(node); }; var hasContent = function(node) { return node.firstChild !== node.lastChild || !isBr$5(node.firstChild); }; var insertInline$1 = function(node, before2) { var doc2 = node.ownerDocument; var textNode = doc2.createTextNode(ZWSP$1); var parentNode = node.parentNode; if (!before2) { var sibling2 = node.nextSibling; if (isText$6(sibling2)) { if (isCaretContainer$2(sibling2)) { return sibling2; } if (startsWithCaretContainer$1(sibling2)) { sibling2.splitText(1); return sibling2; } } if (node.nextSibling) { parentNode.insertBefore(textNode, node.nextSibling); } else { parentNode.appendChild(textNode); } } else { var sibling2 = node.previousSibling; if (isText$6(sibling2)) { if (isCaretContainer$2(sibling2)) { return sibling2; } if (endsWithCaretContainer$1(sibling2)) { return sibling2.splitText(sibling2.data.length - 1); } } parentNode.insertBefore(textNode, node); } return textNode; }; var isBeforeInline = function(pos) { var container = pos.container(); if (!isText$7(container)) { return false; } return container.data.charAt(pos.offset()) === ZWSP$1 || pos.isAtStart() && isCaretContainerInline(container.previousSibling); }; var isAfterInline = function(pos) { var container = pos.container(); if (!isText$7(container)) { return false; } return container.data.charAt(pos.offset() - 1) === ZWSP$1 || pos.isAtEnd() && isCaretContainerInline(container.nextSibling); }; var createBogusBr = function() { var br = document.createElement("br"); br.setAttribute("data-mce-bogus", "1"); return br; }; var insertBlock$1 = function(blockName, node, before2) { var doc2 = node.ownerDocument; var blockNode = doc2.createElement(blockName); blockNode.setAttribute("data-mce-caret", before2 ? "before" : "after"); blockNode.setAttribute("data-mce-bogus", "all"); blockNode.appendChild(createBogusBr()); var parentNode = node.parentNode; if (!before2) { if (node.nextSibling) { parentNode.insertBefore(blockNode, node.nextSibling); } else { parentNode.appendChild(blockNode); } } else { parentNode.insertBefore(blockNode, node); } return blockNode; }; var startsWithCaretContainer$1 = function(node) { return isText$6(node) && node.data[0] === ZWSP$1; }; var endsWithCaretContainer$1 = function(node) { return isText$6(node) && node.data[node.data.length - 1] === ZWSP$1; }; var trimBogusBr = function(elm) { var brs = elm.getElementsByTagName("br"); var lastBr = brs[brs.length - 1]; if (isBogus$2(lastBr)) { lastBr.parentNode.removeChild(lastBr); } }; var showCaretContainerBlock = function(caretContainer) { if (caretContainer && caretContainer.hasAttribute("data-mce-caret")) { trimBogusBr(caretContainer); caretContainer.removeAttribute("data-mce-caret"); caretContainer.removeAttribute("data-mce-bogus"); caretContainer.removeAttribute("style"); caretContainer.removeAttribute("_moz_abspos"); return caretContainer; } return null; }; var isRangeInCaretContainerBlock = function(range3) { return isCaretContainerBlock$1(range3.startContainer); }; var isContentEditableTrue$3 = isContentEditableTrue$4; var isContentEditableFalse$a = isContentEditableFalse$b; var isBr$3 = isBr$5; var isText$5 = isText$7; var isInvalidTextElement = matchNodeNames([ "script", "style", "textarea" ]); var isAtomicInline = matchNodeNames([ "img", "input", "textarea", "hr", "iframe", "video", "audio", "object", "embed" ]); var isTable$1 = matchNodeNames(["table"]); var isCaretContainer$1 = isCaretContainer$2; var isCaretCandidate$3 = function(node) { if (isCaretContainer$1(node)) { return false; } if (isText$5(node)) { return !isInvalidTextElement(node.parentNode); } return isAtomicInline(node) || isBr$3(node) || isTable$1(node) || isNonUiContentEditableFalse(node); }; var isUnselectable = function(node) { return isElement$5(node) && node.getAttribute("unselectable") === "true"; }; var isNonUiContentEditableFalse = function(node) { return isUnselectable(node) === false && isContentEditableFalse$a(node); }; var isInEditable = function(node, root2) { for (node = node.parentNode; node && node !== root2; node = node.parentNode) { if (isNonUiContentEditableFalse(node)) { return false; } if (isContentEditableTrue$3(node)) { return true; } } return true; }; var isAtomicContentEditableFalse = function(node) { if (!isNonUiContentEditableFalse(node)) { return false; } return foldl(from2(node.getElementsByTagName("*")), function(result, elm) { return result || isContentEditableTrue$3(elm); }, false) !== true; }; var isAtomic$1 = function(node) { return isAtomicInline(node) || isAtomicContentEditableFalse(node); }; var isEditableCaretCandidate$1 = function(node, root2) { return isCaretCandidate$3(node) && isInEditable(node, root2); }; var whiteSpaceRegExp$1 = /^[ \t\r\n]*$/; var isWhitespaceText = function(text) { return whiteSpaceRegExp$1.test(text); }; var hasWhitespacePreserveParent = function(node, rootNode) { var rootElement = SugarElement.fromDom(rootNode); var startNode = SugarElement.fromDom(node); return ancestor$1(startNode, "pre,code", curry(eq2, rootElement)); }; var isWhitespace = function(node, rootNode) { return isText$7(node) && isWhitespaceText(node.data) && hasWhitespacePreserveParent(node, rootNode) === false; }; var isNamedAnchor = function(node) { return isElement$5(node) && node.nodeName === "A" && !node.hasAttribute("href") && (node.hasAttribute("name") || node.hasAttribute("id")); }; var isContent$1 = function(node, rootNode) { return isCaretCandidate$3(node) && isWhitespace(node, rootNode) === false || isNamedAnchor(node) || isBookmark(node); }; var isBookmark = hasAttribute2("data-mce-bookmark"); var isBogus$1 = hasAttribute2("data-mce-bogus"); var isBogusAll = hasAttributeValue("data-mce-bogus", "all"); var isEmptyNode = function(targetNode, skipBogus) { var brCount = 0; if (isContent$1(targetNode, targetNode)) { return false; } else { var node = targetNode.firstChild; if (!node) { return true; } var walker = new DomTreeWalker(node, targetNode); do { if (skipBogus) { if (isBogusAll(node)) { node = walker.next(true); continue; } if (isBogus$1(node)) { node = walker.next(); continue; } } if (isBr$5(node)) { brCount++; node = walker.next(); continue; } if (isContent$1(node, targetNode)) { return false; } node = walker.next(); } while (node); return brCount <= 1; } }; var isEmpty$2 = function(elm, skipBogus) { if (skipBogus === void 0) { skipBogus = true; } return isEmptyNode(elm.dom, skipBogus); }; var isSpan = function(node) { return node.nodeName.toLowerCase() === "span"; }; var isInlineContent = function(node, root2) { return isNonNullable(node) && (isContent$1(node, root2) || isInline$1(SugarElement.fromDom(node))); }; var surroundedByInlineContent = function(node, root2) { var prev2 = new DomTreeWalker(node, root2).prev(false); var next2 = new DomTreeWalker(node, root2).next(false); var prevIsInline = isUndefined2(prev2) || isInlineContent(prev2, root2); var nextIsInline = isUndefined2(next2) || isInlineContent(next2, root2); return prevIsInline && nextIsInline; }; var isBookmarkNode$2 = function(node) { return isSpan(node) && node.getAttribute("data-mce-type") === "bookmark"; }; var isKeepTextNode = function(node, root2) { return isText$7(node) && node.data.length > 0 && surroundedByInlineContent(node, root2); }; var isKeepElement = function(node) { return isElement$5(node) ? node.childNodes.length > 0 : false; }; var isDocument = function(node) { return isDocumentFragment(node) || isDocument$1(node); }; var trimNode = function(dom2, node, root2) { var rootNode = root2 || node; if (isElement$5(node) && isBookmarkNode$2(node)) { return node; } var children2 = node.childNodes; for (var i2 = children2.length - 1; i2 >= 0; i2--) { trimNode(dom2, children2[i2], rootNode); } if (isElement$5(node)) { var currentChildren = node.childNodes; if (currentChildren.length === 1 && isBookmarkNode$2(currentChildren[0])) { node.parentNode.insertBefore(currentChildren[0], node); } } if (!isDocument(node) && !isContent$1(node, rootNode) && !isKeepElement(node) && !isKeepTextNode(node, rootNode)) { dom2.remove(node); } return node; }; var makeMap$3 = Tools.makeMap; var attrsCharsRegExp = /[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g; var textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g; var rawCharsRegExp = /[<>&\"\']/g; var entityRegExp = /&#([a-z0-9]+);?|&([a-z0-9]+);/gi; var asciiMap = { 128: "\u20AC", 130: "\u201A", 131: "\u0192", 132: "\u201E", 133: "\u2026", 134: "\u2020", 135: "\u2021", 136: "\u02C6", 137: "\u2030", 138: "\u0160", 139: "\u2039", 140: "\u0152", 142: "\u017D", 145: "\u2018", 146: "\u2019", 147: "\u201C", 148: "\u201D", 149: "\u2022", 150: "\u2013", 151: "\u2014", 152: "\u02DC", 153: "\u2122", 154: "\u0161", 155: "\u203A", 156: "\u0153", 158: "\u017E", 159: "\u0178" }; var baseEntities = { '"': """, "'": "'", "<": "<", ">": ">", "&": "&", "`": "`" }; var reverseEntities = { "<": "<", ">": ">", "&": "&", """: '"', "'": "'" }; var nativeDecode = function(text) { var elm = SugarElement.fromTag("div").dom; elm.innerHTML = text; return elm.textContent || elm.innerText || text; }; var buildEntitiesLookup = function(items, radix) { var i2, chr, entity; var lookup = {}; if (items) { items = items.split(","); radix = radix || 10; for (i2 = 0; i2 < items.length; i2 += 2) { chr = String.fromCharCode(parseInt(items[i2], radix)); if (!baseEntities[chr]) { entity = "&" + items[i2 + 1] + ";"; lookup[chr] = entity; lookup[entity] = chr; } } return lookup; } }; var namedEntities = buildEntitiesLookup("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro", 32); var encodeRaw = function(text, attr) { return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { return baseEntities[chr] || chr; }); }; var encodeAllRaw = function(text) { return ("" + text).replace(rawCharsRegExp, function(chr) { return baseEntities[chr] || chr; }); }; var encodeNumeric = function(text, attr) { return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { if (chr.length > 1) { return "&#" + ((chr.charCodeAt(0) - 55296) * 1024 + (chr.charCodeAt(1) - 56320) + 65536) + ";"; } return baseEntities[chr] || "&#" + chr.charCodeAt(0) + ";"; }); }; var encodeNamed = function(text, attr, entities) { entities = entities || namedEntities; return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { return baseEntities[chr] || entities[chr] || chr; }); }; var getEncodeFunc = function(name2, entities) { var entitiesMap = buildEntitiesLookup(entities) || namedEntities; var encodeNamedAndNumeric = function(text, attr) { return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) { if (baseEntities[chr] !== void 0) { return baseEntities[chr]; } if (entitiesMap[chr] !== void 0) { return entitiesMap[chr]; } if (chr.length > 1) { return "&#" + ((chr.charCodeAt(0) - 55296) * 1024 + (chr.charCodeAt(1) - 56320) + 65536) + ";"; } return "&#" + chr.charCodeAt(0) + ";"; }); }; var encodeCustomNamed = function(text, attr) { return encodeNamed(text, attr, entitiesMap); }; var nameMap = makeMap$3(name2.replace(/\+/g, ",")); if (nameMap.named && nameMap.numeric) { return encodeNamedAndNumeric; } if (nameMap.named) { if (entities) { return encodeCustomNamed; } return encodeNamed; } if (nameMap.numeric) { return encodeNumeric; } return encodeRaw; }; var decode2 = function(text) { return text.replace(entityRegExp, function(all3, numeric) { if (numeric) { if (numeric.charAt(0).toLowerCase() === "x") { numeric = parseInt(numeric.substr(1), 16); } else { numeric = parseInt(numeric, 10); } if (numeric > 65535) { numeric -= 65536; return String.fromCharCode(55296 + (numeric >> 10), 56320 + (numeric & 1023)); } return asciiMap[numeric] || String.fromCharCode(numeric); } return reverseEntities[all3] || namedEntities[all3] || nativeDecode(all3); }); }; var Entities = { encodeRaw, encodeAllRaw, encodeNumeric, encodeNamed, getEncodeFunc, decode: decode2 }; var mapCache = {}, dummyObj = {}; var makeMap$2 = Tools.makeMap, each$h = Tools.each, extend$5 = Tools.extend, explode$3 = Tools.explode, inArray$2 = Tools.inArray; var split$1 = function(items, delim) { items = Tools.trim(items); return items ? items.split(delim || " ") : []; }; var createMap = function(defaultValue, extendWith) { var value25 = makeMap$2(defaultValue, " ", makeMap$2(defaultValue.toUpperCase(), " ")); return extend$5(value25, extendWith); }; var getTextRootBlockElements = function(schema2) { return createMap("td th li dt dd figcaption caption details summary", schema2.getTextBlockElements()); }; var compileSchema = function(type3) { var schema2 = {}; var globalAttributes, blockContent; var phrasingContent, flowContent, html4BlockContent, html4PhrasingContent; var add4 = function(name2, attributes3, children2) { var ni, attributesOrder, element; var arrayToMap = function(array3, obj) { var map3 = {}; var i2, l2; for (i2 = 0, l2 = array3.length; i2 < l2; i2++) { map3[array3[i2]] = obj || {}; } return map3; }; children2 = children2 || []; attributes3 = attributes3 || ""; if (typeof children2 === "string") { children2 = split$1(children2); } var names2 = split$1(name2); ni = names2.length; while (ni--) { attributesOrder = split$1([ globalAttributes, attributes3 ].join(" ")); element = { attributes: arrayToMap(attributesOrder), attributesOrder, children: arrayToMap(children2, dummyObj) }; schema2[names2[ni]] = element; } }; var addAttrs = function(name2, attributes3) { var ni, schemaItem, i2, l2; var names2 = split$1(name2); ni = names2.length; var attrs = split$1(attributes3); while (ni--) { schemaItem = schema2[names2[ni]]; for (i2 = 0, l2 = attrs.length; i2 < l2; i2++) { schemaItem.attributes[attrs[i2]] = {}; schemaItem.attributesOrder.push(attrs[i2]); } } }; if (mapCache[type3]) { return mapCache[type3]; } globalAttributes = "id accesskey class dir lang style tabindex title role"; blockContent = "address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul"; phrasingContent = "a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment"; if (type3 !== "html4") { globalAttributes += " contenteditable contextmenu draggable dropzone hidden spellcheck translate"; blockContent += " article aside details dialog figure main header footer hgroup section nav"; phrasingContent += " audio canvas command datalist mark meter output picture progress time wbr video ruby bdi keygen"; } if (type3 !== "html5-strict") { globalAttributes += " xml:lang"; html4PhrasingContent = "acronym applet basefont big font strike tt"; phrasingContent = [ phrasingContent, html4PhrasingContent ].join(" "); each$h(split$1(html4PhrasingContent), function(name2) { add4(name2, "", phrasingContent); }); html4BlockContent = "center dir isindex noframes"; blockContent = [ blockContent, html4BlockContent ].join(" "); flowContent = [ blockContent, phrasingContent ].join(" "); each$h(split$1(html4BlockContent), function(name2) { add4(name2, "", flowContent); }); } flowContent = flowContent || [ blockContent, phrasingContent ].join(" "); add4("html", "manifest", "head body"); add4("head", "", "base command link meta noscript script style title"); add4("title hr noscript br"); add4("base", "href target"); add4("link", "href rel media hreflang type sizes hreflang"); add4("meta", "name http-equiv content charset"); add4("style", "media type scoped"); add4("script", "src async defer type charset"); add4("body", "onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload", flowContent); add4("address dt dd div caption", "", flowContent); add4("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn", "", phrasingContent); add4("blockquote", "cite", flowContent); add4("ol", "reversed start type", "li"); add4("ul", "", "li"); add4("li", "value", flowContent); add4("dl", "", "dt dd"); add4("a", "href target rel media hreflang type", phrasingContent); add4("q", "cite", phrasingContent); add4("ins del", "cite datetime", flowContent); add4("img", "src sizes srcset alt usemap ismap width height"); add4("iframe", "src name width height", flowContent); add4("embed", "src type width height"); add4("object", "data type typemustmatch name usemap form width height", [ flowContent, "param" ].join(" ")); add4("param", "name value"); add4("map", "name", [ flowContent, "area" ].join(" ")); add4("area", "alt coords shape href target rel media hreflang type"); add4("table", "border", "caption colgroup thead tfoot tbody tr" + (type3 === "html4" ? " col" : "")); add4("colgroup", "span", "col"); add4("col", "span"); add4("tbody thead tfoot", "", "tr"); add4("tr", "", "td th"); add4("td", "colspan rowspan headers", flowContent); add4("th", "colspan rowspan headers scope abbr", flowContent); add4("form", "accept-charset action autocomplete enctype method name novalidate target", flowContent); add4("fieldset", "disabled form name", [ flowContent, "legend" ].join(" ")); add4("label", "form for", phrasingContent); add4("input", "accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"); add4("button", "disabled form formaction formenctype formmethod formnovalidate formtarget name type value", type3 === "html4" ? flowContent : phrasingContent); add4("select", "disabled form multiple name required size", "option optgroup"); add4("optgroup", "disabled label", "option"); add4("option", "disabled label selected value"); add4("textarea", "cols dirname disabled form maxlength name readonly required rows wrap"); add4("menu", "type label", [ flowContent, "li" ].join(" ")); add4("noscript", "", flowContent); if (type3 !== "html4") { add4("wbr"); add4("ruby", "", [ phrasingContent, "rt rp" ].join(" ")); add4("figcaption", "", flowContent); add4("mark rt rp summary bdi", "", phrasingContent); add4("canvas", "width height", flowContent); add4("video", "src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered", [ flowContent, "track source" ].join(" ")); add4("audio", "src crossorigin preload autoplay mediagroup loop muted controls buffered volume", [ flowContent, "track source" ].join(" ")); add4("picture", "", "img source"); add4("source", "src srcset type media sizes"); add4("track", "kind src srclang label default"); add4("datalist", "", [ phrasingContent, "option" ].join(" ")); add4("article section nav aside main header footer", "", flowContent); add4("hgroup", "", "h1 h2 h3 h4 h5 h6"); add4("figure", "", [ flowContent, "figcaption" ].join(" ")); add4("time", "datetime", phrasingContent); add4("dialog", "open", flowContent); add4("command", "type label icon disabled checked radiogroup command"); add4("output", "for form name", phrasingContent); add4("progress", "value max", phrasingContent); add4("meter", "value min max low high optimum", phrasingContent); add4("details", "open", [ flowContent, "summary" ].join(" ")); add4("keygen", "autofocus challenge disabled form keytype name"); } if (type3 !== "html5-strict") { addAttrs("script", "language xml:space"); addAttrs("style", "xml:space"); addAttrs("object", "declare classid code codebase codetype archive standby align border hspace vspace"); addAttrs("embed", "align name hspace vspace"); addAttrs("param", "valuetype type"); addAttrs("a", "charset name rev shape coords"); addAttrs("br", "clear"); addAttrs("applet", "codebase archive code object alt name width height align hspace vspace"); addAttrs("img", "name longdesc align border hspace vspace"); addAttrs("iframe", "longdesc frameborder marginwidth marginheight scrolling align"); addAttrs("font basefont", "size color face"); addAttrs("input", "usemap align"); addAttrs("select"); addAttrs("textarea"); addAttrs("h1 h2 h3 h4 h5 h6 div p legend caption", "align"); addAttrs("ul", "type compact"); addAttrs("li", "type"); addAttrs("ol dl menu dir", "compact"); addAttrs("pre", "width xml:space"); addAttrs("hr", "align noshade size width"); addAttrs("isindex", "prompt"); addAttrs("table", "summary width frame rules cellspacing cellpadding align bgcolor"); addAttrs("col", "width align char charoff valign"); addAttrs("colgroup", "width align char charoff valign"); addAttrs("thead", "align char charoff valign"); addAttrs("tr", "align char charoff valign bgcolor"); addAttrs("th", "axis align char charoff valign nowrap bgcolor width height"); addAttrs("form", "accept"); addAttrs("td", "abbr axis scope align char charoff valign nowrap bgcolor width height"); addAttrs("tfoot", "align char charoff valign"); addAttrs("tbody", "align char charoff valign"); addAttrs("area", "nohref"); addAttrs("body", "background bgcolor text link vlink alink"); } if (type3 !== "html4") { addAttrs("input button select textarea", "autofocus"); addAttrs("input textarea", "placeholder"); addAttrs("a", "download"); addAttrs("link script img", "crossorigin"); addAttrs("img", "loading"); addAttrs("iframe", "sandbox seamless allowfullscreen loading"); } each$h(split$1("a form meter progress dfn"), function(name2) { if (schema2[name2]) { delete schema2[name2].children[name2]; } }); delete schema2.caption.children.table; delete schema2.script; mapCache[type3] = schema2; return schema2; }; var compileElementMap = function(value25, mode3) { var styles; if (value25) { styles = {}; if (typeof value25 === "string") { value25 = { "*": value25 }; } each$h(value25, function(value26, key2) { styles[key2] = styles[key2.toUpperCase()] = mode3 === "map" ? makeMap$2(value26, /[, ]/) : explode$3(value26, /[, ]/); }); } return styles; }; var Schema2 = function(settings) { var elements = {}; var children2 = {}; var patternElements = []; var customElementsMap = {}, specialElements = {}; var createLookupTable = function(option, defaultValue, extendWith) { var value25 = settings[option]; if (!value25) { value25 = mapCache[option]; if (!value25) { value25 = createMap(defaultValue, extendWith); mapCache[option] = value25; } } else { value25 = makeMap$2(value25, /[, ]/, makeMap$2(value25.toUpperCase(), /[, ]/)); } return value25; }; settings = settings || {}; var schemaItems = compileSchema(settings.schema); if (settings.verify_html === false) { settings.valid_elements = "*[*]"; } var validStyles = compileElementMap(settings.valid_styles); var invalidStyles = compileElementMap(settings.invalid_styles, "map"); var validClasses = compileElementMap(settings.valid_classes, "map"); var whiteSpaceElementsMap = createLookupTable("whitespace_elements", "pre script noscript style textarea video audio iframe object code"); var selfClosingElementsMap = createLookupTable("self_closing_elements", "colgroup dd dt li option p td tfoot th thead tr"); var shortEndedElementsMap = createLookupTable("short_ended_elements", "area base basefont br col frame hr img input isindex link meta param embed source wbr track"); var boolAttrMap = createLookupTable("boolean_attributes", "checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls"); var nonEmptyOrMoveCaretBeforeOnEnter = "td th iframe video audio object script code"; var nonEmptyElementsMap = createLookupTable("non_empty_elements", nonEmptyOrMoveCaretBeforeOnEnter + " pre", shortEndedElementsMap); var moveCaretBeforeOnEnterElementsMap = createLookupTable("move_caret_before_on_enter_elements", nonEmptyOrMoveCaretBeforeOnEnter + " table", shortEndedElementsMap); var textBlockElementsMap = createLookupTable("text_block_elements", "h1 h2 h3 h4 h5 h6 p div address pre form blockquote center dir fieldset header footer article section hgroup aside main nav figure"); var blockElementsMap = createLookupTable("block_elements", "hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup figcaption details summary", textBlockElementsMap); var textInlineElementsMap = createLookupTable("text_inline_elements", "span strong b em i font s strike u var cite dfn code mark q sup sub samp"); each$h((settings.special || "script noscript iframe noframes noembed title style textarea xmp").split(" "), function(name2) { specialElements[name2] = new RegExp("]*>", "gi"); }); var patternToRegExp = function(str) { return new RegExp("^" + str.replace(/([?+*])/g, ".$1") + "$"); }; var addValidElements = function(validElements) { var ei, el, ai, al, matches2, element, attr, attrData, elementName, attrName, attrType, attributes3, attributesOrder, prefix, outputName, globalAttributes, globalAttributesOrder, value25; var elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/, attrRuleRegExp = /^([!\-])?(\w+[\\:]:\w+|[^=:<]+)?(?:([=:<])(.*))?$/, hasPatternsRegExp = /[*?+]/; if (validElements) { var validElementsArr = split$1(validElements, ","); if (elements["@"]) { globalAttributes = elements["@"].attributes; globalAttributesOrder = elements["@"].attributesOrder; } for (ei = 0, el = validElementsArr.length; ei < el; ei++) { matches2 = elementRuleRegExp.exec(validElementsArr[ei]); if (matches2) { prefix = matches2[1]; elementName = matches2[2]; outputName = matches2[3]; attrData = matches2[5]; attributes3 = {}; attributesOrder = []; element = { attributes: attributes3, attributesOrder }; if (prefix === "#") { element.paddEmpty = true; } if (prefix === "-") { element.removeEmpty = true; } if (matches2[4] === "!") { element.removeEmptyAttrs = true; } if (globalAttributes) { each$j(globalAttributes, function(value26, key2) { attributes3[key2] = value26; }); attributesOrder.push.apply(attributesOrder, globalAttributesOrder); } if (attrData) { attrData = split$1(attrData, "|"); for (ai = 0, al = attrData.length; ai < al; ai++) { matches2 = attrRuleRegExp.exec(attrData[ai]); if (matches2) { attr = {}; attrType = matches2[1]; attrName = matches2[2].replace(/[\\:]:/g, ":"); prefix = matches2[3]; value25 = matches2[4]; if (attrType === "!") { element.attributesRequired = element.attributesRequired || []; element.attributesRequired.push(attrName); attr.required = true; } if (attrType === "-") { delete attributes3[attrName]; attributesOrder.splice(inArray$2(attributesOrder, attrName), 1); continue; } if (prefix) { if (prefix === "=") { element.attributesDefault = element.attributesDefault || []; element.attributesDefault.push({ name: attrName, value: value25 }); attr.defaultValue = value25; } if (prefix === ":") { element.attributesForced = element.attributesForced || []; element.attributesForced.push({ name: attrName, value: value25 }); attr.forcedValue = value25; } if (prefix === "<") { attr.validValues = makeMap$2(value25, "?"); } } if (hasPatternsRegExp.test(attrName)) { element.attributePatterns = element.attributePatterns || []; attr.pattern = patternToRegExp(attrName); element.attributePatterns.push(attr); } else { if (!attributes3[attrName]) { attributesOrder.push(attrName); } attributes3[attrName] = attr; } } } } if (!globalAttributes && elementName === "@") { globalAttributes = attributes3; globalAttributesOrder = attributesOrder; } if (outputName) { element.outputName = elementName; elements[outputName] = element; } if (hasPatternsRegExp.test(elementName)) { element.pattern = patternToRegExp(elementName); patternElements.push(element); } else { elements[elementName] = element; } } } } }; var setValidElements = function(validElements) { elements = {}; patternElements = []; addValidElements(validElements); each$h(schemaItems, function(element, name2) { children2[name2] = element.children; }); }; var addCustomElements = function(customElements) { var customElementRegExp = /^(~)?(.+)$/; if (customElements) { mapCache.text_block_elements = mapCache.block_elements = null; each$h(split$1(customElements, ","), function(rule) { var matches2 = customElementRegExp.exec(rule), inline = matches2[1] === "~", cloneName = inline ? "span" : "div", name2 = matches2[2]; children2[name2] = children2[cloneName]; customElementsMap[name2] = cloneName; if (!inline) { blockElementsMap[name2.toUpperCase()] = {}; blockElementsMap[name2] = {}; } if (!elements[name2]) { var customRule = elements[cloneName]; customRule = extend$5({}, customRule); delete customRule.removeEmptyAttrs; delete customRule.removeEmpty; elements[name2] = customRule; } each$h(children2, function(element, elmName) { if (element[cloneName]) { children2[elmName] = element = extend$5({}, children2[elmName]); element[name2] = element[cloneName]; } }); }); } }; var addValidChildren = function(validChildren) { var childRuleRegExp = /^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/; mapCache[settings.schema] = null; if (validChildren) { each$h(split$1(validChildren, ","), function(rule) { var matches2 = childRuleRegExp.exec(rule); var parent3, prefix; if (matches2) { prefix = matches2[1]; if (prefix) { parent3 = children2[matches2[2]]; } else { parent3 = children2[matches2[2]] = { "#comment": {} }; } parent3 = children2[matches2[2]]; each$h(split$1(matches2[3], "|"), function(child2) { if (prefix === "-") { delete parent3[child2]; } else { parent3[child2] = {}; } }); } }); } }; var getElementRule = function(name2) { var element = elements[name2], i2; if (element) { return element; } i2 = patternElements.length; while (i2--) { element = patternElements[i2]; if (element.pattern.test(name2)) { return element; } } }; if (!settings.valid_elements) { each$h(schemaItems, function(element, name2) { elements[name2] = { attributes: element.attributes, attributesOrder: element.attributesOrder }; children2[name2] = element.children; }); if (settings.schema !== "html5") { each$h(split$1("strong/b em/i"), function(item) { var items = split$1(item, "/"); elements[items[1]].outputName = items[0]; }); } each$h(textInlineElementsMap, function(_val, name2) { if (elements[name2]) { if (settings.padd_empty_block_inline_children) { elements[name2].paddInEmptyBlock = true; } elements[name2].removeEmpty = true; } }); each$h(split$1("ol ul blockquote a table tbody"), function(name2) { if (elements[name2]) { elements[name2].removeEmpty = true; } }); each$h(split$1("p h1 h2 h3 h4 h5 h6 th td pre div address caption li"), function(name2) { elements[name2].paddEmpty = true; }); each$h(split$1("span"), function(name2) { elements[name2].removeEmptyAttrs = true; }); } else { setValidElements(settings.valid_elements); } addCustomElements(settings.custom_elements); addValidChildren(settings.valid_children); addValidElements(settings.extended_valid_elements); addValidChildren("+ol[ul|ol],+ul[ul|ol]"); each$h({ dd: "dl", dt: "dl", li: "ul ol", td: "tr", th: "tr", tr: "tbody thead tfoot", tbody: "table", thead: "table", tfoot: "table", legend: "fieldset", area: "map", param: "video audio object" }, function(parents2, item) { if (elements[item]) { elements[item].parentsRequired = split$1(parents2); } }); if (settings.invalid_elements) { each$h(explode$3(settings.invalid_elements), function(item) { if (elements[item]) { delete elements[item]; } }); } if (!getElementRule("span")) { addValidElements("span[!data-mce-type|*]"); } var getValidStyles = constant2(validStyles); var getInvalidStyles = constant2(invalidStyles); var getValidClasses = constant2(validClasses); var getBoolAttrs = constant2(boolAttrMap); var getBlockElements = constant2(blockElementsMap); var getTextBlockElements = constant2(textBlockElementsMap); var getTextInlineElements = constant2(textInlineElementsMap); var getShortEndedElements = constant2(shortEndedElementsMap); var getSelfClosingElements = constant2(selfClosingElementsMap); var getNonEmptyElements = constant2(nonEmptyElementsMap); var getMoveCaretBeforeOnEnterElements = constant2(moveCaretBeforeOnEnterElementsMap); var getWhiteSpaceElements = constant2(whiteSpaceElementsMap); var getSpecialElements = constant2(specialElements); var isValidChild = function(name2, child2) { var parent3 = children2[name2.toLowerCase()]; return !!(parent3 && parent3[child2.toLowerCase()]); }; var isValid5 = function(name2, attr) { var attrPatterns, i2; var rule = getElementRule(name2); if (rule) { if (attr) { if (rule.attributes[attr]) { return true; } attrPatterns = rule.attributePatterns; if (attrPatterns) { i2 = attrPatterns.length; while (i2--) { if (attrPatterns[i2].pattern.test(name2)) { return true; } } } } else { return true; } } return false; }; var getCustomElements = constant2(customElementsMap); return { children: children2, elements, getValidStyles, getValidClasses, getBlockElements, getInvalidStyles, getShortEndedElements, getTextBlockElements, getTextInlineElements, getBoolAttrs, getElementRule, getSelfClosingElements, getNonEmptyElements, getMoveCaretBeforeOnEnterElements, getWhiteSpaceElements, getSpecialElements, isValidChild, isValid: isValid5, getCustomElements, addValidElements, setValidElements, addCustomElements, addValidChildren }; }; var toHex2 = function(match7, r3, g2, b2) { var hex2 = function(val) { val = parseInt(val, 10).toString(16); return val.length > 1 ? val : "0" + val; }; return "#" + hex2(r3) + hex2(g2) + hex2(b2); }; var Styles = function(settings, schema2) { var _this = this; var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi; var urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi; var styleRegExp = /\s*([^:]+):\s*([^;]+);?/g; var trimRightRegExp = /\s+$/; var i2; var encodingLookup = {}; var validStyles; var invalidStyles; var invisibleChar = zeroWidth; settings = settings || {}; if (schema2) { validStyles = schema2.getValidStyles(); invalidStyles = schema2.getInvalidStyles(); } var encodingItems = (`\\" \\' \\; \\: ; : ` + invisibleChar).split(" "); for (i2 = 0; i2 < encodingItems.length; i2++) { encodingLookup[encodingItems[i2]] = invisibleChar + i2; encodingLookup[invisibleChar + i2] = encodingItems[i2]; } return { toHex: function(color) { return color.replace(rgbRegExp, toHex2); }, parse: function(css2) { var styles = {}; var matches2, name2, value25, isEncoded; var urlConverter = settings.url_converter; var urlConverterScope = settings.url_converter_scope || _this; var compress = function(prefix, suffix, noJoin) { var top = styles[prefix + "-top" + suffix]; if (!top) { return; } var right = styles[prefix + "-right" + suffix]; if (!right) { return; } var bottom = styles[prefix + "-bottom" + suffix]; if (!bottom) { return; } var left = styles[prefix + "-left" + suffix]; if (!left) { return; } var box = [ top, right, bottom, left ]; i2 = box.length - 1; while (i2--) { if (box[i2] !== box[i2 + 1]) { break; } } if (i2 > -1 && noJoin) { return; } styles[prefix + suffix] = i2 === -1 ? box[0] : box.join(" "); delete styles[prefix + "-top" + suffix]; delete styles[prefix + "-right" + suffix]; delete styles[prefix + "-bottom" + suffix]; delete styles[prefix + "-left" + suffix]; }; var canCompress = function(key2) { var value26 = styles[key2], i3; if (!value26) { return; } value26 = value26.split(" "); i3 = value26.length; while (i3--) { if (value26[i3] !== value26[0]) { return false; } } styles[key2] = value26[0]; return true; }; var compress2 = function(target, a2, b2, c2) { if (!canCompress(a2)) { return; } if (!canCompress(b2)) { return; } if (!canCompress(c2)) { return; } styles[target] = styles[a2] + " " + styles[b2] + " " + styles[c2]; delete styles[a2]; delete styles[b2]; delete styles[c2]; }; var encode3 = function(str) { isEncoded = true; return encodingLookup[str]; }; var decode3 = function(str, keepSlashes) { if (isEncoded) { str = str.replace(/\uFEFF[0-9]/g, function(str2) { return encodingLookup[str2]; }); } if (!keepSlashes) { str = str.replace(/\\([\'\";:])/g, "$1"); } return str; }; var decodeSingleHexSequence = function(escSeq) { return String.fromCharCode(parseInt(escSeq.slice(1), 16)); }; var decodeHexSequences = function(value26) { return value26.replace(/\\[0-9a-f]+/gi, decodeSingleHexSequence); }; var processUrl = function(match7, url2, url22, url3, str, str2) { str = str || str2; if (str) { str = decode3(str); return "'" + str.replace(/\'/g, "\\'") + "'"; } url2 = decode3(url2 || url22 || url3); if (!settings.allow_script_urls) { var scriptUrl = url2.replace(/[\s\r\n]+/g, ""); if (/(java|vb)script:/i.test(scriptUrl)) { return ""; } if (!settings.allow_svg_data_urls && /^data:image\/svg/i.test(scriptUrl)) { return ""; } } if (urlConverter) { url2 = urlConverter.call(urlConverterScope, url2, "style"); } return "url('" + url2.replace(/\'/g, "\\'") + "')"; }; if (css2) { css2 = css2.replace(/[\u0000-\u001F]/g, ""); css2 = css2.replace(/\\[\"\';:\uFEFF]/g, encode3).replace(/\"[^\"]+\"|\'[^\']+\'/g, function(str) { return str.replace(/[;:]/g, encode3); }); while (matches2 = styleRegExp.exec(css2)) { styleRegExp.lastIndex = matches2.index + matches2[0].length; name2 = matches2[1].replace(trimRightRegExp, "").toLowerCase(); value25 = matches2[2].replace(trimRightRegExp, ""); if (name2 && value25) { name2 = decodeHexSequences(name2); value25 = decodeHexSequences(value25); if (name2.indexOf(invisibleChar) !== -1 || name2.indexOf('"') !== -1) { continue; } if (!settings.allow_script_urls && (name2 === "behavior" || /expression\s*\(|\/\*|\*\//.test(value25))) { continue; } if (name2 === "font-weight" && value25 === "700") { value25 = "bold"; } else if (name2 === "color" || name2 === "background-color") { value25 = value25.toLowerCase(); } value25 = value25.replace(rgbRegExp, toHex2); value25 = value25.replace(urlOrStrRegExp, processUrl); styles[name2] = isEncoded ? decode3(value25, true) : value25; } } compress("border", "", true); compress("border", "-width"); compress("border", "-color"); compress("border", "-style"); compress("padding", ""); compress("margin", ""); compress2("border", "border-width", "border-style", "border-color"); if (styles.border === "medium none") { delete styles.border; } if (styles["border-image"] === "none") { delete styles["border-image"]; } } return styles; }, serialize: function(styles, elementName) { var css2 = ""; var serializeStyles = function(name2) { var value25; var styleList = validStyles[name2]; if (styleList) { for (var i_1 = 0, l2 = styleList.length; i_1 < l2; i_1++) { name2 = styleList[i_1]; value25 = styles[name2]; if (value25) { css2 += (css2.length > 0 ? " " : "") + name2 + ": " + value25 + ";"; } } } }; var isValid5 = function(name2, elementName2) { var styleMap = invalidStyles["*"]; if (styleMap && styleMap[name2]) { return false; } styleMap = invalidStyles[elementName2]; return !(styleMap && styleMap[name2]); }; if (elementName && validStyles) { serializeStyles("*"); serializeStyles(elementName); } else { each$j(styles, function(value25, name2) { if (value25 && (!invalidStyles || isValid5(name2, elementName))) { css2 += (css2.length > 0 ? " " : "") + name2 + ": " + value25 + ";"; } }); } return css2; } }; }; var deprecated = { keyLocation: true, layerX: true, layerY: true, returnValue: true, webkitMovementX: true, webkitMovementY: true, keyIdentifier: true, mozPressure: true }; var isNativeEvent = function(event) { return event instanceof Event || isFunction3(event.initEvent); }; var hasIsDefaultPrevented = function(event) { return event.isDefaultPrevented === always || event.isDefaultPrevented === never; }; var needsNormalizing = function(event) { return isNullable(event.preventDefault) || isNativeEvent(event); }; var clone$2 = function(originalEvent, data66) { var event = data66 !== null && data66 !== void 0 ? data66 : {}; for (var name_1 in originalEvent) { if (!has$22(deprecated, name_1)) { event[name_1] = originalEvent[name_1]; } } if (isNonNullable(event.composedPath)) { event.composedPath = function() { return originalEvent.composedPath(); }; } return event; }; var normalize$3 = function(type3, originalEvent, fallbackTarget, data66) { var _a3; var event = clone$2(originalEvent, data66); event.type = type3; if (isNullable(event.target)) { event.target = (_a3 = event.srcElement) !== null && _a3 !== void 0 ? _a3 : fallbackTarget; } if (needsNormalizing(originalEvent)) { event.preventDefault = function() { event.defaultPrevented = true; event.isDefaultPrevented = always; if (isFunction3(originalEvent.preventDefault)) { originalEvent.preventDefault(); } else if (isNativeEvent(originalEvent)) { originalEvent.returnValue = false; } }; event.stopPropagation = function() { event.cancelBubble = true; event.isPropagationStopped = always; if (isFunction3(originalEvent.stopPropagation)) { originalEvent.stopPropagation(); } else if (isNativeEvent(originalEvent)) { originalEvent.cancelBubble = true; } }; event.stopImmediatePropagation = function() { event.isImmediatePropagationStopped = always; event.stopPropagation(); }; if (!hasIsDefaultPrevented(event)) { event.isDefaultPrevented = event.defaultPrevented === true ? always : never; event.isPropagationStopped = event.cancelBubble === true ? always : never; event.isImmediatePropagationStopped = never; } } return event; }; var eventExpandoPrefix = "mce-data-"; var mouseEventRe = /^(?:mouse|contextmenu)|click/; var addEvent = function(target, name2, callback2, capture) { if (target.addEventListener) { target.addEventListener(name2, callback2, capture || false); } else if (target.attachEvent) { target.attachEvent("on" + name2, callback2); } }; var removeEvent = function(target, name2, callback2, capture) { if (target.removeEventListener) { target.removeEventListener(name2, callback2, capture || false); } else if (target.detachEvent) { target.detachEvent("on" + name2, callback2); } }; var isMouseEvent = function(event) { return isNonNullable(event) && mouseEventRe.test(event.type); }; var fix = function(originalEvent, data66) { var event = normalize$3(originalEvent.type, originalEvent, document, data66); if (isMouseEvent(originalEvent) && isUndefined2(originalEvent.pageX) && !isUndefined2(originalEvent.clientX)) { var eventDoc = event.target.ownerDocument || document; var doc2 = eventDoc.documentElement; var body = eventDoc.body; var mouseEvent = event; mouseEvent.pageX = originalEvent.clientX + (doc2 && doc2.scrollLeft || body && body.scrollLeft || 0) - (doc2 && doc2.clientLeft || body && body.clientLeft || 0); mouseEvent.pageY = originalEvent.clientY + (doc2 && doc2.scrollTop || body && body.scrollTop || 0) - (doc2 && doc2.clientTop || body && body.clientTop || 0); } if (isUndefined2(event.metaKey)) { event.metaKey = false; } return event; }; var bindOnReady = function(win, callback2, eventUtils) { var doc2 = win.document, event = { type: "ready" }; if (eventUtils.domLoaded) { callback2(event); return; } var isDocReady = function() { return doc2.readyState === "complete" || doc2.readyState === "interactive" && doc2.body; }; var readyHandler = function() { removeEvent(win, "DOMContentLoaded", readyHandler); removeEvent(win, "load", readyHandler); if (!eventUtils.domLoaded) { eventUtils.domLoaded = true; callback2(event); } win = null; }; if (isDocReady()) { readyHandler(); } else { addEvent(win, "DOMContentLoaded", readyHandler); } if (!eventUtils.domLoaded) { addEvent(win, "load", readyHandler); } }; var EventUtils = function() { function EventUtils2() { this.domLoaded = false; this.events = {}; this.count = 1; this.expando = eventExpandoPrefix + (+new Date()).toString(32); this.hasMouseEnterLeave = "onmouseenter" in document.documentElement; this.hasFocusIn = "onfocusin" in document.documentElement; this.count = 1; } EventUtils2.prototype.bind = function(target, names2, callback2, scope) { var self2 = this; var id2, callbackList, i2, name2, fakeName, nativeHandler, capture; var win = window; var defaultNativeHandler = function(evt) { self2.executeHandlers(fix(evt || win.event), id2); }; if (!target || target.nodeType === 3 || target.nodeType === 8) { return; } if (!target[self2.expando]) { id2 = self2.count++; target[self2.expando] = id2; self2.events[id2] = {}; } else { id2 = target[self2.expando]; } scope = scope || target; var namesList = names2.split(" "); i2 = namesList.length; while (i2--) { name2 = namesList[i2]; nativeHandler = defaultNativeHandler; fakeName = capture = false; if (name2 === "DOMContentLoaded") { name2 = "ready"; } if (self2.domLoaded && name2 === "ready" && target.readyState === "complete") { callback2.call(scope, fix({ type: name2 })); continue; } if (!self2.hasMouseEnterLeave) { fakeName = self2.mouseEnterLeave[name2]; if (fakeName) { nativeHandler = function(evt) { var current2 = evt.currentTarget; var related = evt.relatedTarget; if (related && current2.contains) { related = current2.contains(related); } else { while (related && related !== current2) { related = related.parentNode; } } if (!related) { evt = fix(evt || win.event); evt.type = evt.type === "mouseout" ? "mouseleave" : "mouseenter"; evt.target = current2; self2.executeHandlers(evt, id2); } }; } } if (!self2.hasFocusIn && (name2 === "focusin" || name2 === "focusout")) { capture = true; fakeName = name2 === "focusin" ? "focus" : "blur"; nativeHandler = function(evt) { evt = fix(evt || win.event); evt.type = evt.type === "focus" ? "focusin" : "focusout"; self2.executeHandlers(evt, id2); }; } callbackList = self2.events[id2][name2]; if (!callbackList) { self2.events[id2][name2] = callbackList = [{ func: callback2, scope }]; callbackList.fakeName = fakeName; callbackList.capture = capture; callbackList.nativeHandler = nativeHandler; if (name2 === "ready") { bindOnReady(target, nativeHandler, self2); } else { addEvent(target, fakeName || name2, nativeHandler, capture); } } else { if (name2 === "ready" && self2.domLoaded) { callback2(fix({ type: name2 })); } else { callbackList.push({ func: callback2, scope }); } } } target = callbackList = null; return callback2; }; EventUtils2.prototype.unbind = function(target, names2, callback2) { var callbackList, i2, ci, name2, eventMap; if (!target || target.nodeType === 3 || target.nodeType === 8) { return this; } var id2 = target[this.expando]; if (id2) { eventMap = this.events[id2]; if (names2) { var namesList = names2.split(" "); i2 = namesList.length; while (i2--) { name2 = namesList[i2]; callbackList = eventMap[name2]; if (callbackList) { if (callback2) { ci = callbackList.length; while (ci--) { if (callbackList[ci].func === callback2) { var nativeHandler = callbackList.nativeHandler; var fakeName = callbackList.fakeName, capture = callbackList.capture; callbackList = callbackList.slice(0, ci).concat(callbackList.slice(ci + 1)); callbackList.nativeHandler = nativeHandler; callbackList.fakeName = fakeName; callbackList.capture = capture; eventMap[name2] = callbackList; } } } if (!callback2 || callbackList.length === 0) { delete eventMap[name2]; removeEvent(target, callbackList.fakeName || name2, callbackList.nativeHandler, callbackList.capture); } } } } else { each$j(eventMap, function(callbackList2, name3) { removeEvent(target, callbackList2.fakeName || name3, callbackList2.nativeHandler, callbackList2.capture); }); eventMap = {}; } for (name2 in eventMap) { if (has$22(eventMap, name2)) { return this; } } delete this.events[id2]; try { delete target[this.expando]; } catch (ex) { target[this.expando] = null; } } return this; }; EventUtils2.prototype.fire = function(target, name2, args) { var id2; if (!target || target.nodeType === 3 || target.nodeType === 8) { return this; } var event = fix({ type: name2, target }, args); do { id2 = target[this.expando]; if (id2) { this.executeHandlers(event, id2); } target = target.parentNode || target.ownerDocument || target.defaultView || target.parentWindow; } while (target && !event.isPropagationStopped()); return this; }; EventUtils2.prototype.clean = function(target) { var i2, children2; if (!target || target.nodeType === 3 || target.nodeType === 8) { return this; } if (target[this.expando]) { this.unbind(target); } if (!target.getElementsByTagName) { target = target.document; } if (target && target.getElementsByTagName) { this.unbind(target); children2 = target.getElementsByTagName("*"); i2 = children2.length; while (i2--) { target = children2[i2]; if (target[this.expando]) { this.unbind(target); } } } return this; }; EventUtils2.prototype.destroy = function() { this.events = {}; }; EventUtils2.prototype.cancel = function(e2) { if (e2) { e2.preventDefault(); e2.stopImmediatePropagation(); } return false; }; EventUtils2.prototype.executeHandlers = function(evt, id2) { var container = this.events[id2]; var callbackList = container && container[evt.type]; if (callbackList) { for (var i2 = 0, l2 = callbackList.length; i2 < l2; i2++) { var callback2 = callbackList[i2]; if (callback2 && callback2.func.call(callback2.scope, evt) === false) { evt.preventDefault(); } if (evt.isImmediatePropagationStopped()) { return; } } } }; EventUtils2.Event = new EventUtils2(); return EventUtils2; }(); var support, Expr, getText, isXML, tokenize, compile, select$1, outermostContext, sortInput, hasDuplicate, setDocument, document$1, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains2, expando = "sizzle" + -new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function(a2, b2) { if (a2 === b2) { hasDuplicate = true; } return 0; }, strundefined = "undefined", MAX_NEGATIVE = 1 << 31, hasOwn3 = {}.hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push$1 = arr.push, slice$1 = arr.slice, indexOf2 = arr.indexOf || function(elem) { var i2 = 0, len = this.length; for (; i2 < len; i2++) { if (this[i2] === elem) { return i2; } } return -1; }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", whitespace2 = "[\\x20\\t\\r\\n\\f]", identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", attributes2 = "\\[" + whitespace2 + "*(" + identifier + ")(?:" + whitespace2 + "*([*^$|!~]?=)" + whitespace2 + `*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(` + identifier + "))|)" + whitespace2 + "*\\]", pseudos = ":(" + identifier + `)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|` + attributes2 + ")*)|.*)\\)|)", rtrim = new RegExp("^" + whitespace2 + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace2 + "+$", "g"), rcomma = new RegExp("^" + whitespace2 + "*," + whitespace2 + "*"), rcombinators = new RegExp("^" + whitespace2 + "*([>+~]|" + whitespace2 + ")" + whitespace2 + "*"), rattributeQuotes = new RegExp("=" + whitespace2 + `*([^\\]'"]*?)` + whitespace2 + "*\\]", "g"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = { ID: new RegExp("^#(" + identifier + ")"), CLASS: new RegExp("^\\.(" + identifier + ")"), TAG: new RegExp("^(" + identifier + "|[*])"), ATTR: new RegExp("^" + attributes2), PSEUDO: new RegExp("^" + pseudos), CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace2 + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace2 + "*(?:([+-]|)" + whitespace2 + "*(\\d+)|))" + whitespace2 + "*\\)|)", "i"), bool: new RegExp("^(?:" + booleans + ")$", "i"), needsContext: new RegExp("^" + whitespace2 + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace2 + "*((?:-\\d)?\\d*)" + whitespace2 + "*\\)|)(?=[^-]|$)", "i") }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, rquickExpr$1 = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace2 + "?|(" + whitespace2 + ")|.)", "ig"), funescape = function(_2, escaped, escapedWhitespace) { var high = "0x" + escaped - 65536; return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320); }; try { push$1.apply(arr = slice$1.call(preferredDoc.childNodes), preferredDoc.childNodes); arr[preferredDoc.childNodes.length].nodeType; } catch (e2) { push$1 = { apply: arr.length ? function(target, els) { push_native.apply(target, slice$1.call(els)); } : function(target, els) { var j2 = target.length, i2 = 0; while (target[j2++] = els[i2++]) { } target.length = j2 - 1; } }; } var Sizzle = function(selector2, context3, results, seed3) { var match7, elem, m2, nodeType, i2, groups, old, nid, newContext, newSelector; if ((context3 ? context3.ownerDocument || context3 : preferredDoc) !== document$1) { setDocument(context3); } context3 = context3 || document$1; results = results || []; if (!selector2 || typeof selector2 !== "string") { return results; } if ((nodeType = context3.nodeType) !== 1 && nodeType !== 9) { return []; } if (documentIsHTML && !seed3) { if (match7 = rquickExpr$1.exec(selector2)) { if (m2 = match7[1]) { if (nodeType === 9) { elem = context3.getElementById(m2); if (elem && elem.parentNode) { if (elem.id === m2) { results.push(elem); return results; } } else { return results; } } else { if (context3.ownerDocument && (elem = context3.ownerDocument.getElementById(m2)) && contains2(context3, elem) && elem.id === m2) { results.push(elem); return results; } } } else if (match7[2]) { push$1.apply(results, context3.getElementsByTagName(selector2)); return results; } else if ((m2 = match7[3]) && support.getElementsByClassName) { push$1.apply(results, context3.getElementsByClassName(m2)); return results; } } if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector2))) { nid = old = expando; newContext = context3; newSelector = nodeType === 9 && selector2; if (nodeType === 1 && context3.nodeName.toLowerCase() !== "object") { groups = tokenize(selector2); if (old = context3.getAttribute("id")) { nid = old.replace(rescape, "\\$&"); } else { context3.setAttribute("id", nid); } nid = "[id='" + nid + "'] "; i2 = groups.length; while (i2--) { groups[i2] = nid + toSelector(groups[i2]); } newContext = rsibling.test(selector2) && testContext(context3.parentNode) || context3; newSelector = groups.join(","); } if (newSelector) { try { push$1.apply(results, newContext.querySelectorAll(newSelector)); return results; } catch (qsaError) { } finally { if (!old) { context3.removeAttribute("id"); } } } } } return select$1(selector2.replace(rtrim, "$1"), context3, results, seed3); }; function createCache() { var keys3 = []; function cache2(key2, value25) { if (keys3.push(key2 + " ") > Expr.cacheLength) { delete cache2[keys3.shift()]; } return cache2[key2 + " "] = value25; } return cache2; } function markFunction(fn) { fn[expando] = true; return fn; } function siblingCheck(a2, b2) { var cur = b2 && a2, diff3 = cur && a2.nodeType === 1 && b2.nodeType === 1 && (~b2.sourceIndex || MAX_NEGATIVE) - (~a2.sourceIndex || MAX_NEGATIVE); if (diff3) { return diff3; } if (cur) { while (cur = cur.nextSibling) { if (cur === b2) { return -1; } } } return a2 ? 1 : -1; } function createInputPseudo(type3) { return function(elem) { var name2 = elem.nodeName.toLowerCase(); return name2 === "input" && elem.type === type3; }; } function createButtonPseudo(type3) { return function(elem) { var name2 = elem.nodeName.toLowerCase(); return (name2 === "input" || name2 === "button") && elem.type === type3; }; } function createPositionalPseudo(fn) { return markFunction(function(argument) { argument = +argument; return markFunction(function(seed3, matches2) { var j2, matchIndexes = fn([], seed3.length, argument), i2 = matchIndexes.length; while (i2--) { if (seed3[j2 = matchIndexes[i2]]) { seed3[j2] = !(matches2[j2] = seed3[j2]); } } }); }); } function testContext(context3) { return context3 && typeof context3.getElementsByTagName !== strundefined && context3; } support = Sizzle.support = {}; isXML = Sizzle.isXML = function(elem) { var documentElement2 = elem && (elem.ownerDocument || elem).documentElement; return documentElement2 ? documentElement2.nodeName !== "HTML" : false; }; setDocument = Sizzle.setDocument = function(node) { var hasCompare, doc2 = node ? node.ownerDocument || node : preferredDoc, parent3 = doc2.defaultView; function getTop2(win) { try { return win.top; } catch (ex) { } return null; } if (doc2 === document$1 || doc2.nodeType !== 9 || !doc2.documentElement) { return document$1; } document$1 = doc2; docElem = doc2.documentElement; documentIsHTML = !isXML(doc2); if (parent3 && parent3 !== getTop2(parent3)) { if (parent3.addEventListener) { parent3.addEventListener("unload", function() { setDocument(); }, false); } else if (parent3.attachEvent) { parent3.attachEvent("onunload", function() { setDocument(); }); } } support.attributes = true; support.getElementsByTagName = true; support.getElementsByClassName = rnative.test(doc2.getElementsByClassName); support.getById = true; Expr.find.ID = function(id2, context3) { if (typeof context3.getElementById !== strundefined && documentIsHTML) { var m2 = context3.getElementById(id2); return m2 && m2.parentNode ? [m2] : []; } }; Expr.filter.ID = function(id2) { var attrId = id2.replace(runescape, funescape); return function(elem) { return elem.getAttribute("id") === attrId; }; }; Expr.find.TAG = support.getElementsByTagName ? function(tag, context3) { if (typeof context3.getElementsByTagName !== strundefined) { return context3.getElementsByTagName(tag); } } : function(tag, context3) { var elem, tmp = [], i2 = 0, results = context3.getElementsByTagName(tag); if (tag === "*") { while (elem = results[i2++]) { if (elem.nodeType === 1) { tmp.push(elem); } } return tmp; } return results; }; Expr.find.CLASS = support.getElementsByClassName && function(className, context3) { if (documentIsHTML) { return context3.getElementsByClassName(className); } }; rbuggyMatches = []; rbuggyQSA = []; support.disconnectedMatch = true; rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|")); rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|")); hasCompare = rnative.test(docElem.compareDocumentPosition); contains2 = hasCompare || rnative.test(docElem.contains) ? function(a2, b2) { var adown = a2.nodeType === 9 ? a2.documentElement : a2, bup = b2 && b2.parentNode; return a2 === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a2.compareDocumentPosition && a2.compareDocumentPosition(bup) & 16)); } : function(a2, b2) { if (b2) { while (b2 = b2.parentNode) { if (b2 === a2) { return true; } } } return false; }; sortOrder = hasCompare ? function(a2, b2) { if (a2 === b2) { hasDuplicate = true; return 0; } var compare2 = !a2.compareDocumentPosition - !b2.compareDocumentPosition; if (compare2) { return compare2; } compare2 = (a2.ownerDocument || a2) === (b2.ownerDocument || b2) ? a2.compareDocumentPosition(b2) : 1; if (compare2 & 1 || !support.sortDetached && b2.compareDocumentPosition(a2) === compare2) { if (a2 === doc2 || a2.ownerDocument === preferredDoc && contains2(preferredDoc, a2)) { return -1; } if (b2 === doc2 || b2.ownerDocument === preferredDoc && contains2(preferredDoc, b2)) { return 1; } return sortInput ? indexOf2.call(sortInput, a2) - indexOf2.call(sortInput, b2) : 0; } return compare2 & 4 ? -1 : 1; } : function(a2, b2) { if (a2 === b2) { hasDuplicate = true; return 0; } var cur, i2 = 0, aup = a2.parentNode, bup = b2.parentNode, ap = [a2], bp = [b2]; if (!aup || !bup) { return a2 === doc2 ? -1 : b2 === doc2 ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf2.call(sortInput, a2) - indexOf2.call(sortInput, b2) : 0; } else if (aup === bup) { return siblingCheck(a2, b2); } cur = a2; while (cur = cur.parentNode) { ap.unshift(cur); } cur = b2; while (cur = cur.parentNode) { bp.unshift(cur); } while (ap[i2] === bp[i2]) { i2++; } return i2 ? siblingCheck(ap[i2], bp[i2]) : ap[i2] === preferredDoc ? -1 : bp[i2] === preferredDoc ? 1 : 0; }; return doc2; }; Sizzle.matches = function(expr, elements) { return Sizzle(expr, null, null, elements); }; Sizzle.matchesSelector = function(elem, expr) { if ((elem.ownerDocument || elem) !== document$1) { setDocument(elem); } expr = expr.replace(rattributeQuotes, "='$1']"); if (support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) { try { var ret = matches.call(elem, expr); if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) { return ret; } } catch (e2) { } } return Sizzle(expr, document$1, null, [elem]).length > 0; }; Sizzle.contains = function(context3, elem) { if ((context3.ownerDocument || context3) !== document$1) { setDocument(context3); } return contains2(context3, elem); }; Sizzle.attr = function(elem, name2) { if ((elem.ownerDocument || elem) !== document$1) { setDocument(elem); } var fn = Expr.attrHandle[name2.toLowerCase()], val = fn && hasOwn3.call(Expr.attrHandle, name2.toLowerCase()) ? fn(elem, name2, !documentIsHTML) : void 0; return val !== void 0 ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name2) : (val = elem.getAttributeNode(name2)) && val.specified ? val.value : null; }; Sizzle.error = function(msg) { throw new Error("Syntax error, unrecognized expression: " + msg); }; Sizzle.uniqueSort = function(results) { var elem, duplicates = [], j2 = 0, i2 = 0; hasDuplicate = !support.detectDuplicates; sortInput = !support.sortStable && results.slice(0); results.sort(sortOrder); if (hasDuplicate) { while (elem = results[i2++]) { if (elem === results[i2]) { j2 = duplicates.push(i2); } } while (j2--) { results.splice(duplicates[j2], 1); } } sortInput = null; return results; }; getText = Sizzle.getText = function(elem) { var node, ret = "", i2 = 0, nodeType = elem.nodeType; if (!nodeType) { while (node = elem[i2++]) { ret += getText(node); } } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) { if (typeof elem.textContent === "string") { return elem.textContent; } else { for (elem = elem.firstChild; elem; elem = elem.nextSibling) { ret += getText(elem); } } } else if (nodeType === 3 || nodeType === 4) { return elem.nodeValue; } return ret; }; Expr = Sizzle.selectors = { cacheLength: 50, createPseudo: markFunction, match: matchExpr, attrHandle: {}, find: {}, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { ATTR: function(match7) { match7[1] = match7[1].replace(runescape, funescape); match7[3] = (match7[3] || match7[4] || match7[5] || "").replace(runescape, funescape); if (match7[2] === "~=") { match7[3] = " " + match7[3] + " "; } return match7.slice(0, 4); }, CHILD: function(match7) { match7[1] = match7[1].toLowerCase(); if (match7[1].slice(0, 3) === "nth") { if (!match7[3]) { Sizzle.error(match7[0]); } match7[4] = +(match7[4] ? match7[5] + (match7[6] || 1) : 2 * (match7[3] === "even" || match7[3] === "odd")); match7[5] = +(match7[7] + match7[8] || match7[3] === "odd"); } else if (match7[3]) { Sizzle.error(match7[0]); } return match7; }, PSEUDO: function(match7) { var excess, unquoted = !match7[6] && match7[2]; if (matchExpr.CHILD.test(match7[0])) { return null; } if (match7[3]) { match7[2] = match7[4] || match7[5] || ""; } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) { match7[0] = match7[0].slice(0, excess); match7[2] = unquoted.slice(0, excess); } return match7.slice(0, 3); } }, filter: { TAG: function(nodeNameSelector) { var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase(); return nodeNameSelector === "*" ? function() { return true; } : function(elem) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, CLASS: function(className) { var pattern2 = classCache[className + " "]; return pattern2 || (pattern2 = new RegExp("(^|" + whitespace2 + ")" + className + "(" + whitespace2 + "|$)")) && classCache(className, function(elem) { return pattern2.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || ""); }); }, ATTR: function(name2, operator, check) { return function(elem) { var result = Sizzle.attr(elem, name2); if (result == null) { return operator === "!="; } if (!operator) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false; }; }, CHILD: function(type3, what, argument, first2, last3) { var simple = type3.slice(0, 3) !== "nth", forward = type3.slice(-4) !== "last", ofType = what === "of-type"; return first2 === 1 && last3 === 0 ? function(elem) { return !!elem.parentNode; } : function(elem, context3, xml) { var cache2, outerCache, node, diff3, nodeIndex2, start2, dir2 = simple !== forward ? "nextSibling" : "previousSibling", parent3 = elem.parentNode, name2 = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType; if (parent3) { if (simple) { while (dir2) { node = elem; while (node = node[dir2]) { if (ofType ? node.nodeName.toLowerCase() === name2 : node.nodeType === 1) { return false; } } start2 = dir2 = type3 === "only" && !start2 && "nextSibling"; } return true; } start2 = [forward ? parent3.firstChild : parent3.lastChild]; if (forward && useCache) { outerCache = parent3[expando] || (parent3[expando] = {}); cache2 = outerCache[type3] || []; nodeIndex2 = cache2[0] === dirruns && cache2[1]; diff3 = cache2[0] === dirruns && cache2[2]; node = nodeIndex2 && parent3.childNodes[nodeIndex2]; while (node = ++nodeIndex2 && node && node[dir2] || (diff3 = nodeIndex2 = 0) || start2.pop()) { if (node.nodeType === 1 && ++diff3 && node === elem) { outerCache[type3] = [ dirruns, nodeIndex2, diff3 ]; break; } } } else if (useCache && (cache2 = (elem[expando] || (elem[expando] = {}))[type3]) && cache2[0] === dirruns) { diff3 = cache2[1]; } else { while (node = ++nodeIndex2 && node && node[dir2] || (diff3 = nodeIndex2 = 0) || start2.pop()) { if ((ofType ? node.nodeName.toLowerCase() === name2 : node.nodeType === 1) && ++diff3) { if (useCache) { (node[expando] || (node[expando] = {}))[type3] = [ dirruns, diff3 ]; } if (node === elem) { break; } } } } diff3 -= last3; return diff3 === first2 || diff3 % first2 === 0 && diff3 / first2 >= 0; } }; }, PSEUDO: function(pseudo, argument) { var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo); if (fn[expando]) { return fn(argument); } if (fn.length > 1) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed3, matches2) { var idx, matched = fn(seed3, argument), i2 = matched.length; while (i2--) { idx = indexOf2.call(seed3, matched[i2]); seed3[idx] = !(matches2[idx] = matched[i2]); } }) : function(elem) { return fn(elem, 0, args); }; } return fn; } }, pseudos: { not: markFunction(function(selector2) { var input = [], results = [], matcher = compile(selector2.replace(rtrim, "$1")); return matcher[expando] ? markFunction(function(seed3, matches2, context3, xml) { var elem, unmatched = matcher(seed3, null, xml, []), i2 = seed3.length; while (i2--) { if (elem = unmatched[i2]) { seed3[i2] = !(matches2[i2] = elem); } } }) : function(elem, context3, xml) { input[0] = elem; matcher(input, null, xml, results); input[0] = null; return !results.pop(); }; }), has: markFunction(function(selector2) { return function(elem) { return Sizzle(selector2, elem).length > 0; }; }), contains: markFunction(function(text) { text = text.replace(runescape, funescape); return function(elem) { return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1; }; }), lang: markFunction(function(lang2) { if (!ridentifier.test(lang2 || "")) { Sizzle.error("unsupported lang: " + lang2); } lang2 = lang2.replace(runescape, funescape).toLowerCase(); return function(elem) { var elemLang; do { if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) { elemLang = elemLang.toLowerCase(); return elemLang === lang2 || elemLang.indexOf(lang2 + "-") === 0; } } while ((elem = elem.parentNode) && elem.nodeType === 1); return false; }; }), target: function(elem) { var hash2 = window.location && window.location.hash; return hash2 && hash2.slice(1) === elem.id; }, root: function(elem) { return elem === docElem; }, focus: function(elem) { return elem === document$1.activeElement && (!document$1.hasFocus || document$1.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, enabled: function(elem) { return elem.disabled === false; }, disabled: function(elem) { return elem.disabled === true; }, checked: function(elem) { var nodeName = elem.nodeName.toLowerCase(); return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected; }, selected: function(elem) { if (elem.parentNode) { elem.parentNode.selectedIndex; } return elem.selected === true; }, empty: function(elem) { for (elem = elem.firstChild; elem; elem = elem.nextSibling) { if (elem.nodeType < 6) { return false; } } return true; }, parent: function(elem) { return !Expr.pseudos.empty(elem); }, header: function(elem) { return rheader.test(elem.nodeName); }, input: function(elem) { return rinputs.test(elem.nodeName); }, button: function(elem) { var name2 = elem.nodeName.toLowerCase(); return name2 === "input" && elem.type === "button" || name2 === "button"; }, text: function(elem) { var attr; return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text"); }, first: createPositionalPseudo(function() { return [0]; }), last: createPositionalPseudo(function(matchIndexes, length) { return [length - 1]; }), eq: createPositionalPseudo(function(matchIndexes, length, argument) { return [argument < 0 ? argument + length : argument]; }), even: createPositionalPseudo(function(matchIndexes, length) { var i2 = 0; for (; i2 < length; i2 += 2) { matchIndexes.push(i2); } return matchIndexes; }), odd: createPositionalPseudo(function(matchIndexes, length) { var i2 = 1; for (; i2 < length; i2 += 2) { matchIndexes.push(i2); } return matchIndexes; }), lt: createPositionalPseudo(function(matchIndexes, length, argument) { var i2 = argument < 0 ? argument + length : argument; for (; --i2 >= 0; ) { matchIndexes.push(i2); } return matchIndexes; }), gt: createPositionalPseudo(function(matchIndexes, length, argument) { var i2 = argument < 0 ? argument + length : argument; for (; ++i2 < length; ) { matchIndexes.push(i2); } return matchIndexes; }) } }; Expr.pseudos.nth = Expr.pseudos.eq; each$k([ "radio", "checkbox", "file", "password", "image" ], function(i2) { Expr.pseudos[i2] = createInputPseudo(i2); }); each$k([ "submit", "reset" ], function(i2) { Expr.pseudos[i2] = createButtonPseudo(i2); }); function setFilters() { } setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); tokenize = Sizzle.tokenize = function(selector2, parseOnly) { var matched, match7, tokens2, type3, soFar, groups, preFilters, cached3 = tokenCache[selector2 + " "]; if (cached3) { return parseOnly ? 0 : cached3.slice(0); } soFar = selector2; groups = []; preFilters = Expr.preFilter; while (soFar) { if (!matched || (match7 = rcomma.exec(soFar))) { if (match7) { soFar = soFar.slice(match7[0].length) || soFar; } groups.push(tokens2 = []); } matched = false; if (match7 = rcombinators.exec(soFar)) { matched = match7.shift(); tokens2.push({ value: matched, type: match7[0].replace(rtrim, " ") }); soFar = soFar.slice(matched.length); } for (type3 in Expr.filter) { if (!Expr.filter.hasOwnProperty(type3)) { continue; } if ((match7 = matchExpr[type3].exec(soFar)) && (!preFilters[type3] || (match7 = preFilters[type3](match7)))) { matched = match7.shift(); tokens2.push({ value: matched, type: type3, matches: match7 }); soFar = soFar.slice(matched.length); } } if (!matched) { break; } } return parseOnly ? soFar.length : soFar ? Sizzle.error(selector2) : tokenCache(selector2, groups).slice(0); }; function toSelector(tokens2) { var i2 = 0, len = tokens2.length, selector2 = ""; for (; i2 < len; i2++) { selector2 += tokens2[i2].value; } return selector2; } function addCombinator(matcher, combinator, base) { var dir2 = combinator.dir, checkNonElements = base && dir2 === "parentNode", doneName = done++; return combinator.first ? function(elem, context3, xml) { while (elem = elem[dir2]) { if (elem.nodeType === 1 || checkNonElements) { return matcher(elem, context3, xml); } } } : function(elem, context3, xml) { var oldCache, outerCache, newCache = [ dirruns, doneName ]; if (xml) { while (elem = elem[dir2]) { if (elem.nodeType === 1 || checkNonElements) { if (matcher(elem, context3, xml)) { return true; } } } } else { while (elem = elem[dir2]) { if (elem.nodeType === 1 || checkNonElements) { outerCache = elem[expando] || (elem[expando] = {}); if ((oldCache = outerCache[dir2]) && oldCache[0] === dirruns && oldCache[1] === doneName) { return newCache[2] = oldCache[2]; } else { outerCache[dir2] = newCache; if (newCache[2] = matcher(elem, context3, xml)) { return true; } } } } } }; } function elementMatcher(matchers2) { return matchers2.length > 1 ? function(elem, context3, xml) { var i2 = matchers2.length; while (i2--) { if (!matchers2[i2](elem, context3, xml)) { return false; } } return true; } : matchers2[0]; } function multipleContexts(selector2, contexts, results) { var i2 = 0, len = contexts.length; for (; i2 < len; i2++) { Sizzle(selector2, contexts[i2], results); } return results; } function condense(unmatched, map3, filter2, context3, xml) { var elem, newUnmatched = [], i2 = 0, len = unmatched.length, mapped = map3 != null; for (; i2 < len; i2++) { if (elem = unmatched[i2]) { if (!filter2 || filter2(elem, context3, xml)) { newUnmatched.push(elem); if (mapped) { map3.push(i2); } } } } return newUnmatched; } function setMatcher(preFilter, selector2, matcher, postFilter, postFinder, postSelector) { if (postFilter && !postFilter[expando]) { postFilter = setMatcher(postFilter); } if (postFinder && !postFinder[expando]) { postFinder = setMatcher(postFinder, postSelector); } return markFunction(function(seed3, results, context3, xml) { var temp, i2, elem, preMap = [], postMap = [], preexisting = results.length, elems = seed3 || multipleContexts(selector2 || "*", context3.nodeType ? [context3] : context3, []), matcherIn = preFilter && (seed3 || !selector2) ? condense(elems, preMap, preFilter, context3, xml) : elems, matcherOut = matcher ? postFinder || (seed3 ? preFilter : preexisting || postFilter) ? [] : results : matcherIn; if (matcher) { matcher(matcherIn, matcherOut, context3, xml); } if (postFilter) { temp = condense(matcherOut, postMap); postFilter(temp, [], context3, xml); i2 = temp.length; while (i2--) { if (elem = temp[i2]) { matcherOut[postMap[i2]] = !(matcherIn[postMap[i2]] = elem); } } } if (seed3) { if (postFinder || preFilter) { if (postFinder) { temp = []; i2 = matcherOut.length; while (i2--) { if (elem = matcherOut[i2]) { temp.push(matcherIn[i2] = elem); } } postFinder(null, matcherOut = [], temp, xml); } i2 = matcherOut.length; while (i2--) { if ((elem = matcherOut[i2]) && (temp = postFinder ? indexOf2.call(seed3, elem) : preMap[i2]) > -1) { seed3[temp] = !(results[temp] = elem); } } } } else { matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut); if (postFinder) { postFinder(null, results, matcherOut, xml); } else { push$1.apply(results, matcherOut); } } }); } function matcherFromTokens(tokens2) { var checkContext, matcher, j2, len = tokens2.length, leadingRelative = Expr.relative[tokens2[0].type], implicitRelative = leadingRelative || Expr.relative[" "], i2 = leadingRelative ? 1 : 0, matchContext = addCombinator(function(elem) { return elem === checkContext; }, implicitRelative, true), matchAnyContext = addCombinator(function(elem) { return indexOf2.call(checkContext, elem) > -1; }, implicitRelative, true), matchers2 = [function(elem, context3, xml) { var ret = !leadingRelative && (xml || context3 !== outermostContext) || ((checkContext = context3).nodeType ? matchContext(elem, context3, xml) : matchAnyContext(elem, context3, xml)); checkContext = null; return ret; }]; for (; i2 < len; i2++) { if (matcher = Expr.relative[tokens2[i2].type]) { matchers2 = [addCombinator(elementMatcher(matchers2), matcher)]; } else { matcher = Expr.filter[tokens2[i2].type].apply(null, tokens2[i2].matches); if (matcher[expando]) { j2 = ++i2; for (; j2 < len; j2++) { if (Expr.relative[tokens2[j2].type]) { break; } } return setMatcher(i2 > 1 && elementMatcher(matchers2), i2 > 1 && toSelector(tokens2.slice(0, i2 - 1).concat({ value: tokens2[i2 - 2].type === " " ? "*" : "" })).replace(rtrim, "$1"), matcher, i2 < j2 && matcherFromTokens(tokens2.slice(i2, j2)), j2 < len && matcherFromTokens(tokens2 = tokens2.slice(j2)), j2 < len && toSelector(tokens2)); } matchers2.push(matcher); } } return elementMatcher(matchers2); } function matcherFromGroupMatchers(elementMatchers, setMatchers) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function(seed3, context3, xml, results, outermost) { var elem, j2, matcher, matchedCount = 0, i2 = "0", unmatched = seed3 && [], setMatched = [], contextBackup = outermostContext, elems = seed3 || byElement && Expr.find.TAG("*", outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length; if (outermost) { outermostContext = context3 !== document$1 && context3; } for (; i2 !== len && (elem = elems[i2]) != null; i2++) { if (byElement && elem) { j2 = 0; while (matcher = elementMatchers[j2++]) { if (matcher(elem, context3, xml)) { results.push(elem); break; } } if (outermost) { dirruns = dirrunsUnique; } } if (bySet) { if (elem = !matcher && elem) { matchedCount--; } if (seed3) { unmatched.push(elem); } } } matchedCount += i2; if (bySet && i2 !== matchedCount) { j2 = 0; while (matcher = setMatchers[j2++]) { matcher(unmatched, setMatched, context3, xml); } if (seed3) { if (matchedCount > 0) { while (i2--) { if (!(unmatched[i2] || setMatched[i2])) { setMatched[i2] = pop.call(results); } } } setMatched = condense(setMatched); } push$1.apply(results, setMatched); if (outermost && !seed3 && setMatched.length > 0 && matchedCount + setMatchers.length > 1) { Sizzle.uniqueSort(results); } } if (outermost) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; return bySet ? markFunction(superMatcher) : superMatcher; } compile = Sizzle.compile = function(selector2, match7) { var i2, setMatchers = [], elementMatchers = [], cached3 = compilerCache[selector2 + " "]; if (!cached3) { if (!match7) { match7 = tokenize(selector2); } i2 = match7.length; while (i2--) { cached3 = matcherFromTokens(match7[i2]); if (cached3[expando]) { setMatchers.push(cached3); } else { elementMatchers.push(cached3); } } cached3 = compilerCache(selector2, matcherFromGroupMatchers(elementMatchers, setMatchers)); cached3.selector = selector2; } return cached3; }; select$1 = Sizzle.select = function(selector2, context3, results, seed3) { var i2, tokens2, token2, type3, find3, compiled = typeof selector2 === "function" && selector2, match7 = !seed3 && tokenize(selector2 = compiled.selector || selector2); results = results || []; if (match7.length === 1) { tokens2 = match7[0] = match7[0].slice(0); if (tokens2.length > 2 && (token2 = tokens2[0]).type === "ID" && support.getById && context3.nodeType === 9 && documentIsHTML && Expr.relative[tokens2[1].type]) { context3 = (Expr.find.ID(token2.matches[0].replace(runescape, funescape), context3) || [])[0]; if (!context3) { return results; } else if (compiled) { context3 = context3.parentNode; } selector2 = selector2.slice(tokens2.shift().value.length); } i2 = matchExpr.needsContext.test(selector2) ? 0 : tokens2.length; while (i2--) { token2 = tokens2[i2]; if (Expr.relative[type3 = token2.type]) { break; } if (find3 = Expr.find[type3]) { if (seed3 = find3(token2.matches[0].replace(runescape, funescape), rsibling.test(tokens2[0].type) && testContext(context3.parentNode) || context3)) { tokens2.splice(i2, 1); selector2 = seed3.length && toSelector(tokens2); if (!selector2) { push$1.apply(results, seed3); return results; } break; } } } } (compiled || compile(selector2, match7))(seed3, context3, !documentIsHTML, results, rsibling.test(selector2) && testContext(context3.parentNode) || context3); return results; }; support.sortStable = expando.split("").sort(sortOrder).join("") === expando; support.detectDuplicates = !!hasDuplicate; setDocument(); support.sortDetached = true; var doc = document; var push3 = Array.prototype.push; var slice2 = Array.prototype.slice; var rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/; var Event$12 = EventUtils.Event; var skipUniques = Tools.makeMap("children,contents,next,prev"); var isDefined = function(obj) { return typeof obj !== "undefined"; }; var isString3 = function(obj) { return typeof obj === "string"; }; var isWindow2 = function(obj) { return obj && obj === obj.window; }; var createFragment$1 = function(html, fragDoc) { fragDoc = fragDoc || doc; var container = fragDoc.createElement("div"); var frag = fragDoc.createDocumentFragment(); container.innerHTML = html; var node; while (node = container.firstChild) { frag.appendChild(node); } return frag; }; var domManipulate = function(targetNodes, sourceItem, callback2, reverse2) { var i2; if (isString3(sourceItem)) { sourceItem = createFragment$1(sourceItem, getElementDocument(targetNodes[0])); } else if (sourceItem.length && !sourceItem.nodeType) { sourceItem = DomQuery.makeArray(sourceItem); if (reverse2) { for (i2 = sourceItem.length - 1; i2 >= 0; i2--) { domManipulate(targetNodes, sourceItem[i2], callback2, reverse2); } } else { for (i2 = 0; i2 < sourceItem.length; i2++) { domManipulate(targetNodes, sourceItem[i2], callback2, reverse2); } } return targetNodes; } if (sourceItem.nodeType) { i2 = targetNodes.length; while (i2--) { callback2.call(targetNodes[i2], sourceItem); } } return targetNodes; }; var hasClass2 = function(node, className) { return node && className && (" " + node.className + " ").indexOf(" " + className + " ") !== -1; }; var wrap$2 = function(elements, wrapper, all3) { var lastParent, newWrapper; wrapper = DomQuery(wrapper)[0]; elements.each(function() { var self2 = this; if (!all3 || lastParent !== self2.parentNode) { lastParent = self2.parentNode; newWrapper = wrapper.cloneNode(false); self2.parentNode.insertBefore(newWrapper, self2); newWrapper.appendChild(self2); } else { newWrapper.appendChild(self2); } }); return elements; }; var numericCssMap = Tools.makeMap("fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom", " "); var booleanMap = Tools.makeMap("checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected", " "); var propFix = { for: "htmlFor", class: "className", readonly: "readOnly" }; var cssFix = { float: "cssFloat" }; var attrHooks = {}, cssHooks = {}; var DomQueryConstructor = function(selector2, context3) { return new DomQuery.fn.init(selector2, context3); }; var inArray$1 = function(item, array3) { var i2; if (array3.indexOf) { return array3.indexOf(item); } i2 = array3.length; while (i2--) { if (array3[i2] === item) { return i2; } } return -1; }; var whiteSpaceRegExp = /^\s*|\s*$/g; var trim$12 = function(str) { return str === null || str === void 0 ? "" : ("" + str).replace(whiteSpaceRegExp, ""); }; var each$g = function(obj, callback2) { var length, key2, i2, value25; if (obj) { length = obj.length; if (length === void 0) { for (key2 in obj) { if (obj.hasOwnProperty(key2)) { value25 = obj[key2]; if (callback2.call(value25, key2, value25) === false) { break; } } } } else { for (i2 = 0; i2 < length; i2++) { value25 = obj[i2]; if (callback2.call(value25, i2, value25) === false) { break; } } } } return obj; }; var grep$2 = function(array3, callback2) { var out = []; each$g(array3, function(i2, item) { if (callback2(item, i2)) { out.push(item); } }); return out; }; var getElementDocument = function(element) { if (!element) { return doc; } if (element.nodeType === 9) { return element; } return element.ownerDocument; }; DomQueryConstructor.fn = DomQueryConstructor.prototype = { constructor: DomQueryConstructor, selector: "", context: null, length: 0, init: function(selector2, context3) { var self2 = this; var match7, node; if (!selector2) { return self2; } if (selector2.nodeType) { self2.context = self2[0] = selector2; self2.length = 1; return self2; } if (context3 && context3.nodeType) { self2.context = context3; } else { if (context3) { return DomQuery(selector2).attr(context3); } self2.context = context3 = document; } if (isString3(selector2)) { self2.selector = selector2; if (selector2.charAt(0) === "<" && selector2.charAt(selector2.length - 1) === ">" && selector2.length >= 3) { match7 = [ null, selector2, null ]; } else { match7 = rquickExpr.exec(selector2); } if (match7) { if (match7[1]) { node = createFragment$1(selector2, getElementDocument(context3)).firstChild; while (node) { push3.call(self2, node); node = node.nextSibling; } } else { node = getElementDocument(context3).getElementById(match7[2]); if (!node) { return self2; } if (node.id !== match7[2]) { return self2.find(selector2); } self2.length = 1; self2[0] = node; } } else { return DomQuery(context3).find(selector2); } } else { this.add(selector2, false); } return self2; }, toArray: function() { return Tools.toArray(this); }, add: function(items, sort2) { var self2 = this; var nodes2, i2; if (isString3(items)) { return self2.add(DomQuery(items)); } if (sort2 !== false) { nodes2 = DomQuery.unique(self2.toArray().concat(DomQuery.makeArray(items))); self2.length = nodes2.length; for (i2 = 0; i2 < nodes2.length; i2++) { self2[i2] = nodes2[i2]; } } else { push3.apply(self2, DomQuery.makeArray(items)); } return self2; }, attr: function(name2, value25) { var self2 = this; var hook; if (typeof name2 === "object") { each$g(name2, function(name3, value26) { self2.attr(name3, value26); }); } else if (isDefined(value25)) { this.each(function() { var hook2; if (this.nodeType === 1) { hook2 = attrHooks[name2]; if (hook2 && hook2.set) { hook2.set(this, value25); return; } if (value25 === null) { this.removeAttribute(name2, 2); } else { this.setAttribute(name2, value25, 2); } } }); } else { if (self2[0] && self2[0].nodeType === 1) { hook = attrHooks[name2]; if (hook && hook.get) { return hook.get(self2[0], name2); } if (booleanMap[name2]) { return self2.prop(name2) ? name2 : void 0; } value25 = self2[0].getAttribute(name2, 2); if (value25 === null) { value25 = void 0; } } return value25; } return self2; }, removeAttr: function(name2) { return this.attr(name2, null); }, prop: function(name2, value25) { var self2 = this; name2 = propFix[name2] || name2; if (typeof name2 === "object") { each$g(name2, function(name3, value26) { self2.prop(name3, value26); }); } else if (isDefined(value25)) { this.each(function() { if (this.nodeType === 1) { this[name2] = value25; } }); } else { if (self2[0] && self2[0].nodeType && name2 in self2[0]) { return self2[0][name2]; } return value25; } return self2; }, css: function(name2, value25) { var self2 = this; var elm, hook; var camel = function(name3) { return name3.replace(/-(\D)/g, function(a2, b2) { return b2.toUpperCase(); }); }; var dashed = function(name3) { return name3.replace(/[A-Z]/g, function(a2) { return "-" + a2; }); }; if (typeof name2 === "object") { each$g(name2, function(name3, value26) { self2.css(name3, value26); }); } else { if (isDefined(value25)) { name2 = camel(name2); if (typeof value25 === "number" && !numericCssMap[name2]) { value25 = value25.toString() + "px"; } self2.each(function() { var style = this.style; hook = cssHooks[name2]; if (hook && hook.set) { hook.set(this, value25); return; } try { this.style[cssFix[name2] || name2] = value25; } catch (ex) { } if (value25 === null || value25 === "") { if (style.removeProperty) { style.removeProperty(dashed(name2)); } else { style.removeAttribute(name2); } } }); } else { elm = self2[0]; hook = cssHooks[name2]; if (hook && hook.get) { return hook.get(elm); } if (elm.ownerDocument.defaultView) { try { return elm.ownerDocument.defaultView.getComputedStyle(elm, null).getPropertyValue(dashed(name2)); } catch (ex) { return void 0; } } else if (elm.currentStyle) { return elm.currentStyle[camel(name2)]; } else { return ""; } } } return self2; }, remove: function() { var self2 = this; var node, i2 = this.length; while (i2--) { node = self2[i2]; Event$12.clean(node); if (node.parentNode) { node.parentNode.removeChild(node); } } return this; }, empty: function() { var self2 = this; var node, i2 = this.length; while (i2--) { node = self2[i2]; while (node.firstChild) { node.removeChild(node.firstChild); } } return this; }, html: function(value25) { var self2 = this; var i2; if (isDefined(value25)) { i2 = self2.length; try { while (i2--) { self2[i2].innerHTML = value25; } } catch (ex) { DomQuery(self2[i2]).empty().append(value25); } return self2; } return self2[0] ? self2[0].innerHTML : ""; }, text: function(value25) { var self2 = this; var i2; if (isDefined(value25)) { i2 = self2.length; while (i2--) { if ("innerText" in self2[i2]) { self2[i2].innerText = value25; } else { self2[0].textContent = value25; } } return self2; } return self2[0] ? self2[0].innerText || self2[0].textContent : ""; }, append: function() { return domManipulate(this, arguments, function(node) { if (this.nodeType === 1 || this.host && this.host.nodeType === 1) { this.appendChild(node); } }); }, prepend: function() { return domManipulate(this, arguments, function(node) { if (this.nodeType === 1 || this.host && this.host.nodeType === 1) { this.insertBefore(node, this.firstChild); } }, true); }, before: function() { var self2 = this; if (self2[0] && self2[0].parentNode) { return domManipulate(self2, arguments, function(node) { this.parentNode.insertBefore(node, this); }); } return self2; }, after: function() { var self2 = this; if (self2[0] && self2[0].parentNode) { return domManipulate(self2, arguments, function(node) { this.parentNode.insertBefore(node, this.nextSibling); }, true); } return self2; }, appendTo: function(val) { DomQuery(val).append(this); return this; }, prependTo: function(val) { DomQuery(val).prepend(this); return this; }, replaceWith: function(content) { return this.before(content).remove(); }, wrap: function(content) { return wrap$2(this, content); }, wrapAll: function(content) { return wrap$2(this, content, true); }, wrapInner: function(content) { this.each(function() { DomQuery(this).contents().wrapAll(content); }); return this; }, unwrap: function() { return this.parent().each(function() { DomQuery(this).replaceWith(this.childNodes); }); }, clone: function() { var result = []; this.each(function() { result.push(this.cloneNode(true)); }); return DomQuery(result); }, addClass: function(className) { return this.toggleClass(className, true); }, removeClass: function(className) { return this.toggleClass(className, false); }, toggleClass: function(className, state) { var self2 = this; if (typeof className !== "string") { return self2; } if (className.indexOf(" ") !== -1) { each$g(className.split(" "), function() { self2.toggleClass(this, state); }); } else { self2.each(function(index2, node) { var classState = hasClass2(node, className); if (classState !== state) { var existingClassName = node.className; if (classState) { node.className = trim$12((" " + existingClassName + " ").replace(" " + className + " ", " ")); } else { node.className += existingClassName ? " " + className : className; } } }); } return self2; }, hasClass: function(className) { return hasClass2(this[0], className); }, each: function(callback2) { return each$g(this, callback2); }, on: function(name2, callback2) { return this.each(function() { Event$12.bind(this, name2, callback2); }); }, off: function(name2, callback2) { return this.each(function() { Event$12.unbind(this, name2, callback2); }); }, trigger: function(name2) { return this.each(function() { if (typeof name2 === "object") { Event$12.fire(this, name2.type, name2); } else { Event$12.fire(this, name2); } }); }, show: function() { return this.css("display", ""); }, hide: function() { return this.css("display", "none"); }, slice: function() { return DomQuery(slice2.apply(this, arguments)); }, eq: function(index2) { return index2 === -1 ? this.slice(index2) : this.slice(index2, +index2 + 1); }, first: function() { return this.eq(0); }, last: function() { return this.eq(-1); }, find: function(selector2) { var i2, l2; var ret = []; for (i2 = 0, l2 = this.length; i2 < l2; i2++) { DomQuery.find(selector2, this[i2], ret); } return DomQuery(ret); }, filter: function(selector2) { if (typeof selector2 === "function") { return DomQuery(grep$2(this.toArray(), function(item, i2) { return selector2(i2, item); })); } return DomQuery(DomQuery.filter(selector2, this.toArray())); }, closest: function(selector2) { var result = []; if (selector2 instanceof DomQuery) { selector2 = selector2[0]; } this.each(function(i2, node) { while (node) { if (typeof selector2 === "string" && DomQuery(node).is(selector2)) { result.push(node); break; } else if (node === selector2) { result.push(node); break; } node = node.parentNode; } }); return DomQuery(result); }, offset: function(offset4) { var elm, doc2, docElm; var x2 = 0, y2 = 0, pos; if (!offset4) { elm = this[0]; if (elm) { doc2 = elm.ownerDocument; docElm = doc2.documentElement; if (elm.getBoundingClientRect) { pos = elm.getBoundingClientRect(); x2 = pos.left + (docElm.scrollLeft || doc2.body.scrollLeft) - docElm.clientLeft; y2 = pos.top + (docElm.scrollTop || doc2.body.scrollTop) - docElm.clientTop; } } return { left: x2, top: y2 }; } return this.css(offset4); }, push: push3, sort: Array.prototype.sort, splice: Array.prototype.splice }; Tools.extend(DomQueryConstructor, { extend: Tools.extend, makeArray: function(object3) { if (isWindow2(object3) || object3.nodeType) { return [object3]; } return Tools.toArray(object3); }, inArray: inArray$1, isArray: Tools.isArray, each: each$g, trim: trim$12, grep: grep$2, find: Sizzle, expr: Sizzle.selectors, unique: Sizzle.uniqueSort, text: Sizzle.getText, contains: Sizzle.contains, filter: function(expr, elems, not2) { var i2 = elems.length; if (not2) { expr = ":not(" + expr + ")"; } while (i2--) { if (elems[i2].nodeType !== 1) { elems.splice(i2, 1); } } if (elems.length === 1) { elems = DomQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : []; } else { elems = DomQuery.find.matches(expr, elems); } return elems; } }); var dir = function(el, prop, until) { var matched = []; var cur = el[prop]; if (typeof until !== "string" && until instanceof DomQuery) { until = until[0]; } while (cur && cur.nodeType !== 9) { if (until !== void 0) { if (cur === until) { break; } if (typeof until === "string" && DomQuery(cur).is(until)) { break; } } if (cur.nodeType === 1) { matched.push(cur); } cur = cur[prop]; } return matched; }; var sibling$1 = function(node, siblingName, nodeType, until) { var result = []; if (until instanceof DomQuery) { until = until[0]; } for (; node; node = node[siblingName]) { if (nodeType && node.nodeType !== nodeType) { continue; } if (until !== void 0) { if (node === until) { break; } if (typeof until === "string" && DomQuery(node).is(until)) { break; } } result.push(node); } return result; }; var firstSibling = function(node, siblingName, nodeType) { for (node = node[siblingName]; node; node = node[siblingName]) { if (node.nodeType === nodeType) { return node; } } return null; }; each$g({ parent: function(node) { var parent3 = node.parentNode; return parent3 && parent3.nodeType !== 11 ? parent3 : null; }, parents: function(node) { return dir(node, "parentNode"); }, next: function(node) { return firstSibling(node, "nextSibling", 1); }, prev: function(node) { return firstSibling(node, "previousSibling", 1); }, children: function(node) { return sibling$1(node.firstChild, "nextSibling", 1); }, contents: function(node) { return Tools.toArray((node.nodeName === "iframe" ? node.contentDocument || node.contentWindow.document : node).childNodes); } }, function(name2, fn) { DomQueryConstructor.fn[name2] = function(selector2) { var self2 = this; var result = []; self2.each(function() { var nodes2 = fn.call(result, this, selector2, result); if (nodes2) { if (DomQuery.isArray(nodes2)) { result.push.apply(result, nodes2); } else { result.push(nodes2); } } }); if (this.length > 1) { if (!skipUniques[name2]) { result = DomQuery.unique(result); } if (name2.indexOf("parents") === 0) { result = result.reverse(); } } var wrappedResult = DomQuery(result); if (selector2) { return wrappedResult.filter(selector2); } return wrappedResult; }; }); each$g({ parentsUntil: function(node, until) { return dir(node, "parentNode", until); }, nextUntil: function(node, until) { return sibling$1(node, "nextSibling", 1, until).slice(1); }, prevUntil: function(node, until) { return sibling$1(node, "previousSibling", 1, until).slice(1); } }, function(name2, fn) { DomQueryConstructor.fn[name2] = function(selector2, filter2) { var self2 = this; var result = []; self2.each(function() { var nodes2 = fn.call(result, this, selector2, result); if (nodes2) { if (DomQuery.isArray(nodes2)) { result.push.apply(result, nodes2); } else { result.push(nodes2); } } }); if (this.length > 1) { result = DomQuery.unique(result); if (name2.indexOf("parents") === 0 || name2 === "prevUntil") { result = result.reverse(); } } var wrappedResult = DomQuery(result); if (filter2) { return wrappedResult.filter(filter2); } return wrappedResult; }; }); DomQueryConstructor.fn.is = function(selector2) { return !!selector2 && this.filter(selector2).length > 0; }; DomQueryConstructor.fn.init.prototype = DomQueryConstructor.fn; DomQueryConstructor.overrideDefaults = function(callback2) { var defaults2; var sub = function(selector2, context3) { defaults2 = defaults2 || callback2(); if (arguments.length === 0) { selector2 = defaults2.element; } if (!context3) { context3 = defaults2.context; } return new sub.fn.init(selector2, context3); }; DomQuery.extend(sub, this); return sub; }; DomQueryConstructor.attrHooks = attrHooks; DomQueryConstructor.cssHooks = cssHooks; var DomQuery = DomQueryConstructor; var each$f = Tools.each; var grep$1 = Tools.grep; var isIE = Env.ie; var simpleSelectorRe = /^([a-z0-9],?)+$/i; var setupAttrHooks = function(styles, settings, getContext) { var keepValues = settings.keep_values; var keepUrlHook = { set: function($elm, value25, name2) { if (settings.url_converter && value25 !== null) { value25 = settings.url_converter.call(settings.url_converter_scope || getContext(), value25, name2, $elm[0]); } $elm.attr("data-mce-" + name2, value25).attr(name2, value25); }, get: function($elm, name2) { return $elm.attr("data-mce-" + name2) || $elm.attr(name2); } }; var attrHooks2 = { style: { set: function($elm, value25) { if (value25 !== null && typeof value25 === "object") { $elm.css(value25); return; } if (keepValues) { $elm.attr("data-mce-style", value25); } if (value25 !== null && typeof value25 === "string") { $elm.removeAttr("style"); $elm.css(styles.parse(value25)); } else { $elm.attr("style", value25); } }, get: function($elm) { var value25 = $elm.attr("data-mce-style") || $elm.attr("style"); value25 = styles.serialize(styles.parse(value25), $elm[0].nodeName); return value25; } } }; if (keepValues) { attrHooks2.href = attrHooks2.src = keepUrlHook; } return attrHooks2; }; var updateInternalStyleAttr = function(styles, $elm) { var rawValue = $elm.attr("style"); var value25 = styles.serialize(styles.parse(rawValue), $elm[0].nodeName); if (!value25) { value25 = null; } $elm.attr("data-mce-style", value25); }; var findNodeIndex = function(node, normalized) { var idx = 0, lastNodeType, nodeType; if (node) { for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) { nodeType = node.nodeType; if (normalized && nodeType === 3) { if (nodeType === lastNodeType || !node.nodeValue.length) { continue; } } idx++; lastNodeType = nodeType; } } return idx; }; var DOMUtils = function(doc2, settings) { if (settings === void 0) { settings = {}; } var addedStyles = {}; var win = window; var files = {}; var counter2 = 0; var stdMode = true; var boxModel = true; var styleSheetLoader = instance.forElement(SugarElement.fromDom(doc2), { contentCssCors: settings.contentCssCors, referrerPolicy: settings.referrerPolicy }); var boundEvents = []; var schema2 = settings.schema ? settings.schema : Schema2({}); var styles = Styles({ url_converter: settings.url_converter, url_converter_scope: settings.url_converter_scope }, settings.schema); var events = settings.ownEvents ? new EventUtils() : EventUtils.Event; var blockElementsMap = schema2.getBlockElements(); var $2 = DomQuery.overrideDefaults(function() { return { context: doc2, element: self2.getRoot() }; }); var isBlock2 = function(node) { if (typeof node === "string") { return !!blockElementsMap[node]; } else if (node) { var type3 = node.nodeType; if (type3) { return !!(type3 === 1 && blockElementsMap[node.nodeName]); } } return false; }; var get3 = function(elm) { return elm && doc2 && isString$12(elm) ? doc2.getElementById(elm) : elm; }; var $$ = function(elm) { return $2(typeof elm === "string" ? get3(elm) : elm); }; var getAttrib = function(elm, name2, defaultVal) { var hook, value25; var $elm = $$(elm); if ($elm.length) { hook = attrHooks2[name2]; if (hook && hook.get) { value25 = hook.get($elm, name2); } else { value25 = $elm.attr(name2); } } if (typeof value25 === "undefined") { value25 = defaultVal || ""; } return value25; }; var getAttribs = function(elm) { var node = get3(elm); if (!node) { return []; } return node.attributes; }; var setAttrib = function(elm, name2, value25) { if (value25 === "") { value25 = null; } var $elm = $$(elm); var originalValue = $elm.attr(name2); if (!$elm.length) { return; } var hook = attrHooks2[name2]; if (hook && hook.set) { hook.set($elm, value25, name2); } else { $elm.attr(name2, value25); } if (originalValue !== value25 && settings.onSetAttrib) { settings.onSetAttrib({ attrElm: $elm, attrName: name2, attrValue: value25 }); } }; var clone5 = function(node, deep2) { if (!isIE || node.nodeType !== 1 || deep2) { return node.cloneNode(deep2); } else { var clone_1 = doc2.createElement(node.nodeName); each$f(getAttribs(node), function(attr) { setAttrib(clone_1, attr.nodeName, getAttrib(node, attr.nodeName)); }); return clone_1; } }; var getRoot = function() { return settings.root_element || doc2.body; }; var getViewPort = function(argWin) { var vp = getBounds(argWin); return { x: vp.x, y: vp.y, w: vp.width, h: vp.height }; }; var getPos$1 = function(elm, rootElm) { return getPos(doc2.body, get3(elm), rootElm); }; var setStyle2 = function(elm, name2, value25) { var $elm = isString$12(name2) ? $$(elm).css(name2, value25) : $$(elm).css(name2); if (settings.update_styles) { updateInternalStyleAttr(styles, $elm); } }; var setStyles = function(elm, stylesArg) { var $elm = $$(elm).css(stylesArg); if (settings.update_styles) { updateInternalStyleAttr(styles, $elm); } }; var getStyle4 = function(elm, name2, computed2) { var $elm = $$(elm); if (computed2) { return $elm.css(name2); } name2 = name2.replace(/-(\D)/g, function(a2, b2) { return b2.toUpperCase(); }); if (name2 === "float") { name2 = Env.browser.isIE() ? "styleFloat" : "cssFloat"; } return $elm[0] && $elm[0].style ? $elm[0].style[name2] : void 0; }; var getSize = function(elm) { var w2, h2; elm = get3(elm); w2 = getStyle4(elm, "width"); h2 = getStyle4(elm, "height"); if (w2.indexOf("px") === -1) { w2 = 0; } if (h2.indexOf("px") === -1) { h2 = 0; } return { w: parseInt(w2, 10) || elm.offsetWidth || elm.clientWidth, h: parseInt(h2, 10) || elm.offsetHeight || elm.clientHeight }; }; var getRect = function(elm) { elm = get3(elm); var pos = getPos$1(elm); var size = getSize(elm); return { x: pos.x, y: pos.y, w: size.w, h: size.h }; }; var is3 = function(elm, selector2) { var i2; if (!elm) { return false; } if (!Array.isArray(elm)) { if (selector2 === "*") { return elm.nodeType === 1; } if (simpleSelectorRe.test(selector2)) { var selectors = selector2.toLowerCase().split(/,/); var elmName = elm.nodeName.toLowerCase(); for (i2 = selectors.length - 1; i2 >= 0; i2--) { if (selectors[i2] === elmName) { return true; } } return false; } if (elm.nodeType && elm.nodeType !== 1) { return false; } } var elms = !Array.isArray(elm) ? [elm] : elm; return Sizzle(selector2, elms[0].ownerDocument || elms[0], null, elms).length > 0; }; var getParents2 = function(elm, selector2, root2, collect) { var result = []; var selectorVal; var node = get3(elm); collect = collect === void 0; root2 = root2 || (getRoot().nodeName !== "BODY" ? getRoot().parentNode : null); if (Tools.is(selector2, "string")) { selectorVal = selector2; if (selector2 === "*") { selector2 = function(node2) { return node2.nodeType === 1; }; } else { selector2 = function(node2) { return is3(node2, selectorVal); }; } } while (node) { if (node === root2 || isNullable(node.nodeType) || isDocument$1(node) || isDocumentFragment(node)) { break; } if (!selector2 || typeof selector2 === "function" && selector2(node)) { if (collect) { result.push(node); } else { return [node]; } } node = node.parentNode; } return collect ? result : null; }; var getParent4 = function(node, selector2, root2) { var parents2 = getParents2(node, selector2, root2, false); return parents2 && parents2.length > 0 ? parents2[0] : null; }; var _findSib = function(node, selector2, name2) { var func = selector2; if (node) { if (typeof selector2 === "string") { func = function(node2) { return is3(node2, selector2); }; } for (node = node[name2]; node; node = node[name2]) { if (typeof func === "function" && func(node)) { return node; } } } return null; }; var getNext = function(node, selector2) { return _findSib(node, selector2, "nextSibling"); }; var getPrev = function(node, selector2) { return _findSib(node, selector2, "previousSibling"); }; var select3 = function(selector2, scope) { return Sizzle(selector2, get3(scope) || settings.root_element || doc2, []); }; var run = function(elm, func, scope) { var result; var node = typeof elm === "string" ? get3(elm) : elm; if (!node) { return false; } if (Tools.isArray(node) && (node.length || node.length === 0)) { result = []; each$f(node, function(elm2, i2) { if (elm2) { result.push(func.call(scope, typeof elm2 === "string" ? get3(elm2) : elm2, i2)); } }); return result; } var context3 = scope ? scope : this; return func.call(context3, node); }; var setAttribs = function(elm, attrs) { $$(elm).each(function(i2, node) { each$f(attrs, function(value25, name2) { setAttrib(node, name2, value25); }); }); }; var setHTML = function(elm, html) { var $elm = $$(elm); if (isIE) { $elm.each(function(i2, target) { if (target.canHaveHTML === false) { return; } while (target.firstChild) { target.removeChild(target.firstChild); } try { target.innerHTML = "
" + html; target.removeChild(target.firstChild); } catch (ex) { DomQuery("
").html("
" + html).contents().slice(1).appendTo(target); } return html; }); } else { $elm.html(html); } }; var add4 = function(parentElm, name2, attrs, html, create3) { return run(parentElm, function(parentElm2) { var newElm = typeof name2 === "string" ? doc2.createElement(name2) : name2; setAttribs(newElm, attrs); if (html) { if (typeof html !== "string" && html.nodeType) { newElm.appendChild(html); } else if (typeof html === "string") { setHTML(newElm, html); } } return !create3 ? parentElm2.appendChild(newElm) : newElm; }); }; var create2 = function(name2, attrs, html) { return add4(doc2.createElement(name2), name2, attrs, html, true); }; var decode3 = Entities.decode; var encode3 = Entities.encodeAllRaw; var createHTML = function(name2, attrs, html) { var outHtml = "", key2; outHtml += "<" + name2; for (key2 in attrs) { if (hasNonNullableKey(attrs, key2)) { outHtml += " " + key2 + '="' + encode3(attrs[key2]) + '"'; } } if (typeof html !== "undefined") { return outHtml + ">" + html + ""; } return outHtml + " />"; }; var createFragment2 = function(html) { var node; var container = doc2.createElement("div"); var frag = doc2.createDocumentFragment(); frag.appendChild(container); if (html) { container.innerHTML = html; } while (node = container.firstChild) { frag.appendChild(node); } frag.removeChild(container); return frag; }; var remove4 = function(node, keepChildren) { var $node = $$(node); if (keepChildren) { $node.each(function() { var child2; while (child2 = this.firstChild) { if (child2.nodeType === 3 && child2.data.length === 0) { this.removeChild(child2); } else { this.parentNode.insertBefore(child2, this); } } }).remove(); } else { $node.remove(); } return $node.length > 1 ? $node.toArray() : $node[0]; }; var removeAllAttribs = function(e2) { return run(e2, function(e3) { var i2; var attrs = e3.attributes; for (i2 = attrs.length - 1; i2 >= 0; i2--) { e3.removeAttributeNode(attrs.item(i2)); } }); }; var parseStyle = function(cssText) { return styles.parse(cssText); }; var serializeStyle = function(stylesArg, name2) { return styles.serialize(stylesArg, name2); }; var addStyle = function(cssText) { var head2, styleElm; if (self2 !== DOMUtils.DOM && doc2 === document) { if (addedStyles[cssText]) { return; } addedStyles[cssText] = true; } styleElm = doc2.getElementById("mceDefaultStyles"); if (!styleElm) { styleElm = doc2.createElement("style"); styleElm.id = "mceDefaultStyles"; styleElm.type = "text/css"; head2 = doc2.getElementsByTagName("head")[0]; if (head2.firstChild) { head2.insertBefore(styleElm, head2.firstChild); } else { head2.appendChild(styleElm); } } if (styleElm.styleSheet) { styleElm.styleSheet.cssText += cssText; } else { styleElm.appendChild(doc2.createTextNode(cssText)); } }; var loadCSS = function(urls) { if (!urls) { urls = ""; } each$k(urls.split(","), function(url2) { files[url2] = true; styleSheetLoader.load(url2, noop2); }); }; var toggleClass2 = function(elm, cls, state) { $$(elm).toggleClass(cls, state).each(function() { if (this.className === "") { DomQuery(this).attr("class", null); } }); }; var addClass2 = function(elm, cls) { $$(elm).addClass(cls); }; var removeClass2 = function(elm, cls) { toggleClass2(elm, cls, false); }; var hasClass3 = function(elm, cls) { return $$(elm).hasClass(cls); }; var show = function(elm) { $$(elm).show(); }; var hide = function(elm) { $$(elm).hide(); }; var isHidden2 = function(elm) { return $$(elm).css("display") === "none"; }; var uniqueId2 = function(prefix) { return (!prefix ? "mce_" : prefix) + counter2++; }; var getOuterHTML = function(elm) { var node = typeof elm === "string" ? get3(elm) : elm; return isElement$5(node) ? node.outerHTML : DomQuery("
").append(DomQuery(node).clone()).html(); }; var setOuterHTML = function(elm, html) { $$(elm).each(function() { try { if ("outerHTML" in this) { this.outerHTML = html; return; } } catch (ex) { } remove4(DomQuery(this).html(html), true); }); }; var insertAfter2 = function(node, reference) { var referenceNode = get3(reference); return run(node, function(node2) { var parent3 = referenceNode.parentNode; var nextSibling2 = referenceNode.nextSibling; if (nextSibling2) { parent3.insertBefore(node2, nextSibling2); } else { parent3.appendChild(node2); } return node2; }); }; var replace2 = function(newElm, oldElm, keepChildren) { return run(oldElm, function(oldElm2) { if (Tools.is(oldElm2, "array")) { newElm = newElm.cloneNode(true); } if (keepChildren) { each$f(grep$1(oldElm2.childNodes), function(node) { newElm.appendChild(node); }); } return oldElm2.parentNode.replaceChild(newElm, oldElm2); }); }; var rename = function(elm, name2) { var newElm; if (elm.nodeName !== name2.toUpperCase()) { newElm = create2(name2); each$f(getAttribs(elm), function(attrNode) { setAttrib(newElm, attrNode.nodeName, getAttrib(elm, attrNode.nodeName)); }); replace2(newElm, elm, true); } return newElm || elm; }; var findCommonAncestor = function(a2, b2) { var ps = a2, pe; while (ps) { pe = b2; while (pe && ps !== pe) { pe = pe.parentNode; } if (ps === pe) { break; } ps = ps.parentNode; } if (!ps && a2.ownerDocument) { return a2.ownerDocument.documentElement; } return ps; }; var toHex3 = function(rgbVal) { return styles.toHex(Tools.trim(rgbVal)); }; var isNonEmptyElement2 = function(node) { if (isElement$5(node)) { var isNamedAnchor2 = node.nodeName.toLowerCase() === "a" && !getAttrib(node, "href") && getAttrib(node, "id"); if (getAttrib(node, "name") || getAttrib(node, "data-mce-bookmark") || isNamedAnchor2) { return true; } } return false; }; var isEmpty2 = function(node, elements) { var type3, name2, brCount = 0; if (isNonEmptyElement2(node)) { return false; } node = node.firstChild; if (node) { var walker = new DomTreeWalker(node, node.parentNode); var whitespace3 = schema2 ? schema2.getWhiteSpaceElements() : {}; elements = elements || (schema2 ? schema2.getNonEmptyElements() : null); do { type3 = node.nodeType; if (isElement$5(node)) { var bogusVal = node.getAttribute("data-mce-bogus"); if (bogusVal) { node = walker.next(bogusVal === "all"); continue; } name2 = node.nodeName.toLowerCase(); if (elements && elements[name2]) { if (name2 === "br") { brCount++; node = walker.next(); continue; } return false; } if (isNonEmptyElement2(node)) { return false; } } if (type3 === 8) { return false; } if (type3 === 3 && !isWhitespaceText(node.nodeValue)) { return false; } if (type3 === 3 && node.parentNode && whitespace3[node.parentNode.nodeName] && isWhitespaceText(node.nodeValue)) { return false; } node = walker.next(); } while (node); } return brCount <= 1; }; var createRng = function() { return doc2.createRange(); }; var split3 = function(parentElm, splitElm, replacementElm) { var range3 = createRng(); var beforeFragment; var afterFragment; var parentNode; if (parentElm && splitElm) { range3.setStart(parentElm.parentNode, findNodeIndex(parentElm)); range3.setEnd(splitElm.parentNode, findNodeIndex(splitElm)); beforeFragment = range3.extractContents(); range3 = createRng(); range3.setStart(splitElm.parentNode, findNodeIndex(splitElm) + 1); range3.setEnd(parentElm.parentNode, findNodeIndex(parentElm) + 1); afterFragment = range3.extractContents(); parentNode = parentElm.parentNode; parentNode.insertBefore(trimNode(self2, beforeFragment), parentElm); if (replacementElm) { parentNode.insertBefore(replacementElm, parentElm); } else { parentNode.insertBefore(splitElm, parentElm); } parentNode.insertBefore(trimNode(self2, afterFragment), parentElm); remove4(parentElm); return replacementElm || splitElm; } }; var bind5 = function(target, name2, func, scope) { if (Tools.isArray(target)) { var i2 = target.length; var rv = []; while (i2--) { rv[i2] = bind5(target[i2], name2, func, scope); } return rv; } if (settings.collect && (target === doc2 || target === win)) { boundEvents.push([ target, name2, func, scope ]); } var output = events.bind(target, name2, func, scope || self2); return output; }; var unbind = function(target, name2, func) { if (Tools.isArray(target)) { var i2 = target.length; var rv = []; while (i2--) { rv[i2] = unbind(target[i2], name2, func); } return rv; } else { if (boundEvents.length > 0 && (target === doc2 || target === win)) { var i2 = boundEvents.length; while (i2--) { var item = boundEvents[i2]; if (target === item[0] && (!name2 || name2 === item[1]) && (!func || func === item[2])) { events.unbind(item[0], item[1], item[2]); } } } return events.unbind(target, name2, func); } }; var fire = function(target, name2, evt) { return events.fire(target, name2, evt); }; var getContentEditable = function(node) { if (node && isElement$5(node)) { var contentEditable = node.getAttribute("data-mce-contenteditable"); if (contentEditable && contentEditable !== "inherit") { return contentEditable; } return node.contentEditable !== "inherit" ? node.contentEditable : null; } else { return null; } }; var getContentEditableParent = function(node) { var root2 = getRoot(); var state = null; for (; node && node !== root2; node = node.parentNode) { state = getContentEditable(node); if (state !== null) { break; } } return state; }; var destroy4 = function() { if (boundEvents.length > 0) { var i2 = boundEvents.length; while (i2--) { var item = boundEvents[i2]; events.unbind(item[0], item[1], item[2]); } } each$j(files, function(_2, url2) { styleSheetLoader.unload(url2); delete files[url2]; }); if (Sizzle.setDocument) { Sizzle.setDocument(); } }; var isChildOf = function(node, parent3) { if (!isIE) { return node === parent3 || parent3.contains(node); } else { while (node) { if (parent3 === node) { return true; } node = node.parentNode; } return false; } }; var dumpRng = function(r3) { return "startContainer: " + r3.startContainer.nodeName + ", startOffset: " + r3.startOffset + ", endContainer: " + r3.endContainer.nodeName + ", endOffset: " + r3.endOffset; }; var self2 = { doc: doc2, settings, win, files, stdMode, boxModel, styleSheetLoader, boundEvents, styles, schema: schema2, events, isBlock: isBlock2, $: $2, $$, root: null, clone: clone5, getRoot, getViewPort, getRect, getSize, getParent: getParent4, getParents: getParents2, get: get3, getNext, getPrev, select: select3, is: is3, add: add4, create: create2, createHTML, createFragment: createFragment2, remove: remove4, setStyle: setStyle2, getStyle: getStyle4, setStyles, removeAllAttribs, setAttrib, setAttribs, getAttrib, getPos: getPos$1, parseStyle, serializeStyle, addStyle, loadCSS, addClass: addClass2, removeClass: removeClass2, hasClass: hasClass3, toggleClass: toggleClass2, show, hide, isHidden: isHidden2, uniqueId: uniqueId2, setHTML, getOuterHTML, setOuterHTML, decode: decode3, encode: encode3, insertAfter: insertAfter2, replace: replace2, rename, findCommonAncestor, toHex: toHex3, run, getAttribs, isEmpty: isEmpty2, createRng, nodeIndex: findNodeIndex, split: split3, bind: bind5, unbind, fire, getContentEditable, getContentEditableParent, destroy: destroy4, isChildOf, dumpRng }; var attrHooks2 = setupAttrHooks(styles, settings, constant2(self2)); return self2; }; DOMUtils.DOM = DOMUtils(document); DOMUtils.nodeIndex = findNodeIndex; var DOM$a = DOMUtils.DOM; var each$e = Tools.each, grep = Tools.grep; var QUEUED = 0; var LOADING = 1; var LOADED = 2; var FAILED = 3; var ScriptLoader = function() { function ScriptLoader2(settings) { if (settings === void 0) { settings = {}; } this.states = {}; this.queue = []; this.scriptLoadedCallbacks = {}; this.queueLoadedCallbacks = []; this.loading = 0; this.settings = settings; } ScriptLoader2.prototype._setReferrerPolicy = function(referrerPolicy) { this.settings.referrerPolicy = referrerPolicy; }; ScriptLoader2.prototype.loadScript = function(url2, success3, failure) { var dom2 = DOM$a; var elm; var cleanup = function() { dom2.remove(id2); if (elm) { elm.onerror = elm.onload = elm = null; } }; var done2 = function() { cleanup(); success3(); }; var error4 = function() { cleanup(); if (isFunction3(failure)) { failure(); } else { if (typeof console !== "undefined" && console.log) { console.log("Failed to load script: " + url2); } } }; var id2 = dom2.uniqueId(); elm = document.createElement("script"); elm.id = id2; elm.type = "text/javascript"; elm.src = Tools._addCacheSuffix(url2); if (this.settings.referrerPolicy) { dom2.setAttrib(elm, "referrerpolicy", this.settings.referrerPolicy); } elm.onload = done2; elm.onerror = error4; (document.getElementsByTagName("head")[0] || document.body).appendChild(elm); }; ScriptLoader2.prototype.isDone = function(url2) { return this.states[url2] === LOADED; }; ScriptLoader2.prototype.markDone = function(url2) { this.states[url2] = LOADED; }; ScriptLoader2.prototype.add = function(url2, success3, scope, failure) { var state = this.states[url2]; this.queue.push(url2); if (state === void 0) { this.states[url2] = QUEUED; } if (success3) { if (!this.scriptLoadedCallbacks[url2]) { this.scriptLoadedCallbacks[url2] = []; } this.scriptLoadedCallbacks[url2].push({ success: success3, failure, scope: scope || this }); } }; ScriptLoader2.prototype.load = function(url2, success3, scope, failure) { return this.add(url2, success3, scope, failure); }; ScriptLoader2.prototype.remove = function(url2) { delete this.states[url2]; delete this.scriptLoadedCallbacks[url2]; }; ScriptLoader2.prototype.loadQueue = function(success3, scope, failure) { this.loadScripts(this.queue, success3, scope, failure); }; ScriptLoader2.prototype.loadScripts = function(scripts, success3, scope, failure) { var self2 = this; var failures = []; var execCallbacks = function(name2, url2) { each$e(self2.scriptLoadedCallbacks[url2], function(callback2) { if (isFunction3(callback2[name2])) { callback2[name2].call(callback2.scope); } }); self2.scriptLoadedCallbacks[url2] = void 0; }; self2.queueLoadedCallbacks.push({ success: success3, failure, scope: scope || this }); var loadScripts2 = function() { var loadingScripts = grep(scripts); scripts.length = 0; each$e(loadingScripts, function(url2) { if (self2.states[url2] === LOADED) { execCallbacks("success", url2); return; } if (self2.states[url2] === FAILED) { execCallbacks("failure", url2); return; } if (self2.states[url2] !== LOADING) { self2.states[url2] = LOADING; self2.loading++; self2.loadScript(url2, function() { self2.states[url2] = LOADED; self2.loading--; execCallbacks("success", url2); loadScripts2(); }, function() { self2.states[url2] = FAILED; self2.loading--; failures.push(url2); execCallbacks("failure", url2); loadScripts2(); }); } }); if (!self2.loading) { var notifyCallbacks = self2.queueLoadedCallbacks.slice(0); self2.queueLoadedCallbacks.length = 0; each$e(notifyCallbacks, function(callback2) { if (failures.length === 0) { if (isFunction3(callback2.success)) { callback2.success.call(callback2.scope); } } else { if (isFunction3(callback2.failure)) { callback2.failure.call(callback2.scope, failures); } } }); } }; loadScripts2(); }; ScriptLoader2.ScriptLoader = new ScriptLoader2(); return ScriptLoader2; }(); var Cell3 = function(initial) { var value25 = initial; var get3 = function() { return value25; }; var set3 = function(v2) { value25 = v2; }; return { get: get3, set: set3 }; }; var isRaw = function(str) { return isObject3(str) && has$22(str, "raw"); }; var isTokenised = function(str) { return isArray$12(str) && str.length > 1; }; var data65 = {}; var currentCode = Cell3("en"); var getLanguageData = function() { return get$9(data65, currentCode.get()); }; var getData = function() { return map$2(data65, function(value25) { return __assign({}, value25); }); }; var setCode = function(newCode) { if (newCode) { currentCode.set(newCode); } }; var getCode = function() { return currentCode.get(); }; var add$4 = function(code, items) { var langData = data65[code]; if (!langData) { data65[code] = langData = {}; } each$j(items, function(translation, name2) { langData[name2.toLowerCase()] = translation; }); }; var translate = function(text) { var langData = getLanguageData().getOr({}); var toString3 = function(obj) { if (isFunction3(obj)) { return Object.prototype.toString.call(obj); } return !isEmpty2(obj) ? "" + obj : ""; }; var isEmpty2 = function(text2) { return text2 === "" || text2 === null || text2 === void 0; }; var getLangData = function(text2) { var textstr = toString3(text2); return get$9(langData, textstr.toLowerCase()).map(toString3).getOr(textstr); }; var removeContext = function(str) { return str.replace(/{context:\w+}$/, ""); }; if (isEmpty2(text)) { return ""; } if (isRaw(text)) { return toString3(text.raw); } if (isTokenised(text)) { var values_1 = text.slice(1); var substitued = getLangData(text[0]).replace(/\{([0-9]+)\}/g, function($1, $2) { return has$22(values_1, $2) ? toString3(values_1[$2]) : $1; }); return removeContext(substitued); } return removeContext(getLangData(text)); }; var isRtl$1 = function() { return getLanguageData().bind(function(items) { return get$9(items, "_dir"); }).exists(function(dir2) { return dir2 === "rtl"; }); }; var hasCode = function(code) { return has$22(data65, code); }; var I18n = { getData, setCode, getCode, add: add$4, translate, isRtl: isRtl$1, hasCode }; var AddOnManager = function() { var items = []; var urls = {}; var lookup = {}; var _listeners = []; var runListeners = function(name2, state) { var matchedListeners = filter$4(_listeners, function(listener) { return listener.name === name2 && listener.state === state; }); each$k(matchedListeners, function(listener) { return listener.callback(); }); }; var get3 = function(name2) { if (lookup[name2]) { return lookup[name2].instance; } return void 0; }; var dependencies = function(name2) { var result; if (lookup[name2]) { result = lookup[name2].dependencies; } return result || []; }; var requireLangPack = function(name2, languages) { if (AddOnManager.languageLoad !== false) { waitFor(name2, function() { var language = I18n.getCode(); var wrappedLanguages = "," + (languages || "") + ","; if (!language || languages && wrappedLanguages.indexOf("," + language + ",") === -1) { return; } ScriptLoader.ScriptLoader.add(urls[name2] + "/langs/" + language + ".js"); }, "loaded"); } }; var add4 = function(id2, addOn, dependencies2) { var addOnConstructor = addOn; items.push(addOnConstructor); lookup[id2] = { instance: addOnConstructor, dependencies: dependencies2 }; runListeners(id2, "added"); return addOnConstructor; }; var remove4 = function(name2) { delete urls[name2]; delete lookup[name2]; }; var createUrl = function(baseUrl, dep) { if (typeof dep === "object") { return dep; } return typeof baseUrl === "string" ? { prefix: "", resource: dep, suffix: "" } : { prefix: baseUrl.prefix, resource: dep, suffix: baseUrl.suffix }; }; var addComponents = function(pluginName, scripts) { var pluginUrl = urls[pluginName]; each$k(scripts, function(script) { ScriptLoader.ScriptLoader.add(pluginUrl + "/" + script); }); }; var loadDependencies = function(name2, addOnUrl, success3, scope) { var deps = dependencies(name2); each$k(deps, function(dep) { var newUrl = createUrl(addOnUrl, dep); load(newUrl.resource, newUrl, void 0, void 0); }); if (success3) { if (scope) { success3.call(scope); } else { success3.call(ScriptLoader); } } }; var load = function(name2, addOnUrl, success3, scope, failure) { if (urls[name2]) { return; } var urlString = typeof addOnUrl === "string" ? addOnUrl : addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix; if (urlString.indexOf("/") !== 0 && urlString.indexOf("://") === -1) { urlString = AddOnManager.baseURL + "/" + urlString; } urls[name2] = urlString.substring(0, urlString.lastIndexOf("/")); var done2 = function() { runListeners(name2, "loaded"); loadDependencies(name2, addOnUrl, success3, scope); }; if (lookup[name2]) { done2(); } else { ScriptLoader.ScriptLoader.add(urlString, done2, scope, failure); } }; var waitFor = function(name2, callback2, state) { if (state === void 0) { state = "added"; } if (has$22(lookup, name2) && state === "added") { callback2(); } else if (has$22(urls, name2) && state === "loaded") { callback2(); } else { _listeners.push({ name: name2, state, callback: callback2 }); } }; return { items, urls, lookup, _listeners, get: get3, dependencies, requireLangPack, add: add4, remove: remove4, createUrl, addComponents, load, waitFor }; }; AddOnManager.languageLoad = true; AddOnManager.baseURL = ""; AddOnManager.PluginManager = AddOnManager(); AddOnManager.ThemeManager = AddOnManager(); var singleton = function(doRevoke) { var subject = Cell3(Optional.none()); var revoke = function() { return subject.get().each(doRevoke); }; var clear3 = function() { revoke(); subject.set(Optional.none()); }; var isSet2 = function() { return subject.get().isSome(); }; var get3 = function() { return subject.get(); }; var set3 = function(s2) { revoke(); subject.set(Optional.some(s2)); }; return { clear: clear3, isSet: isSet2, get: get3, set: set3 }; }; var value24 = function() { var subject = singleton(noop2); var on3 = function(f2) { return subject.get().each(f2); }; return __assign(__assign({}, subject), { on: on3 }); }; var first = function(fn, rate) { var timer = null; var cancel2 = function() { if (!isNull2(timer)) { clearTimeout(timer); timer = null; } }; var throttle2 = function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (isNull2(timer)) { timer = setTimeout(function() { timer = null; fn.apply(null, args); }, rate); } }; return { cancel: cancel2, throttle: throttle2 }; }; var last2 = function(fn, rate) { var timer = null; var cancel2 = function() { if (!isNull2(timer)) { clearTimeout(timer); timer = null; } }; var throttle2 = function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } cancel2(); timer = setTimeout(function() { timer = null; fn.apply(null, args); }, rate); }; return { cancel: cancel2, throttle: throttle2 }; }; var read$4 = function(element, attr) { var value25 = get$6(element, attr); return value25 === void 0 || value25 === "" ? [] : value25.split(" "); }; var add$3 = function(element, attr, id2) { var old = read$4(element, attr); var nu2 = old.concat([id2]); set$12(element, attr, nu2.join(" ")); return true; }; var remove$5 = function(element, attr, id2) { var nu2 = filter$4(read$4(element, attr), function(v2) { return v2 !== id2; }); if (nu2.length > 0) { set$12(element, attr, nu2.join(" ")); } else { remove$6(element, attr); } return false; }; var supports = function(element) { return element.dom.classList !== void 0; }; var get$4 = function(element) { return read$4(element, "class"); }; var add$2 = function(element, clazz) { return add$3(element, "class", clazz); }; var remove$4 = function(element, clazz) { return remove$5(element, "class", clazz); }; var add$12 = function(element, clazz) { if (supports(element)) { element.dom.classList.add(clazz); } else { add$2(element, clazz); } }; var cleanClass = function(element) { var classList = supports(element) ? element.dom.classList : get$4(element); if (classList.length === 0) { remove$6(element, "class"); } }; var remove$3 = function(element, clazz) { if (supports(element)) { var classList = element.dom.classList; classList.remove(clazz); } else { remove$4(element, clazz); } cleanClass(element); }; var has2 = function(element, clazz) { return supports(element) && element.dom.classList.contains(clazz); }; var descendants$1 = function(scope, predicate) { var result = []; each$k(children(scope), function(x2) { if (predicate(x2)) { result = result.concat([x2]); } result = result.concat(descendants$1(x2, predicate)); }); return result; }; var descendants = function(scope, selector2) { return all2(selector2, scope); }; var annotation = constant2("mce-annotation"); var dataAnnotation = constant2("data-mce-annotation"); var dataAnnotationId = constant2("data-mce-annotation-uid"); var identify = function(editor, annotationName) { var rng = editor.selection.getRng(); var start2 = SugarElement.fromDom(rng.startContainer); var root2 = SugarElement.fromDom(editor.getBody()); var selector2 = annotationName.fold(function() { return "." + annotation(); }, function(an) { return "[" + dataAnnotation() + '="' + an + '"]'; }); var newStart = child$1(start2, rng.startOffset).getOr(start2); var closest2 = closest$2(newStart, selector2, function(n2) { return eq2(n2, root2); }); var getAttr = function(c2, property2) { if (has$12(c2, property2)) { return Optional.some(get$6(c2, property2)); } else { return Optional.none(); } }; return closest2.bind(function(c2) { return getAttr(c2, "" + dataAnnotationId()).bind(function(uid2) { return getAttr(c2, "" + dataAnnotation()).map(function(name2) { var elements = findMarkers(editor, uid2); return { uid: uid2, name: name2, elements }; }); }); }); }; var isAnnotation = function(elem) { return isElement$6(elem) && has2(elem, annotation()); }; var findMarkers = function(editor, uid2) { var body = SugarElement.fromDom(editor.getBody()); return descendants(body, "[" + dataAnnotationId() + '="' + uid2 + '"]'); }; var findAll = function(editor, name2) { var body = SugarElement.fromDom(editor.getBody()); var markers = descendants(body, "[" + dataAnnotation() + '="' + name2 + '"]'); var directory = {}; each$k(markers, function(m2) { var uid2 = get$6(m2, dataAnnotationId()); var nodesAlready = get$9(directory, uid2).getOr([]); directory[uid2] = nodesAlready.concat([m2]); }); return directory; }; var setup$n = function(editor, _registry) { var changeCallbacks = Cell3({}); var initData = function() { return { listeners: [], previous: value24() }; }; var withCallbacks = function(name2, f2) { updateCallbacks2(name2, function(data66) { f2(data66); return data66; }); }; var updateCallbacks2 = function(name2, f2) { var callbackMap = changeCallbacks.get(); var data66 = get$9(callbackMap, name2).getOrThunk(initData); var outputData = f2(data66); callbackMap[name2] = outputData; changeCallbacks.set(callbackMap); }; var fireCallbacks = function(name2, uid2, elements) { withCallbacks(name2, function(data66) { each$k(data66.listeners, function(f2) { return f2(true, name2, { uid: uid2, nodes: map$3(elements, function(elem) { return elem.dom; }) }); }); }); }; var fireNoAnnotation = function(name2) { withCallbacks(name2, function(data66) { each$k(data66.listeners, function(f2) { return f2(false, name2); }); }); }; var onNodeChange = last2(function() { var callbackMap = changeCallbacks.get(); var annotations = sort(keys2(callbackMap)); each$k(annotations, function(name2) { updateCallbacks2(name2, function(data66) { var prev2 = data66.previous.get(); identify(editor, Optional.some(name2)).fold(function() { if (prev2.isSome()) { fireNoAnnotation(name2); data66.previous.clear(); } }, function(_a3) { var uid2 = _a3.uid, name3 = _a3.name, elements = _a3.elements; if (!is$1(prev2, uid2)) { fireCallbacks(name3, uid2, elements); data66.previous.set(uid2); } }); return { previous: data66.previous, listeners: data66.listeners }; }); }); }, 30); editor.on("remove", function() { onNodeChange.cancel(); }); editor.on("NodeChange", function() { onNodeChange.throttle(); }); var addListener = function(name2, f2) { updateCallbacks2(name2, function(data66) { return { previous: data66.previous, listeners: data66.listeners.concat([f2]) }; }); }; return { addListener }; }; var setup$m = function(editor, registry2) { var identifyParserNode = function(span) { return Optional.from(span.attr(dataAnnotation())).bind(registry2.lookup); }; editor.on("init", function() { editor.serializer.addNodeFilter("span", function(spans) { each$k(spans, function(span) { identifyParserNode(span).each(function(settings) { if (settings.persistent === false) { span.unwrap(); } }); }); }); }); }; var create$7 = function() { var annotations = {}; var register4 = function(name2, settings) { annotations[name2] = { name: name2, settings }; }; var lookup = function(name2) { return get$9(annotations, name2).map(function(a2) { return a2.settings; }); }; return { register: register4, lookup }; }; var unique2 = 0; var generate2 = function(prefix) { var date3 = new Date(); var time = date3.getTime(); var random = Math.floor(Math.random() * 1e9); unique2++; return prefix + "_" + random + unique2 + String(time); }; var add3 = function(element, classes3) { each$k(classes3, function(x2) { add$12(element, x2); }); }; var fromHtml = function(html, scope) { var doc2 = scope || document; var div = doc2.createElement("div"); div.innerHTML = html; return children(SugarElement.fromDom(div)); }; var fromDom$1 = function(nodes2) { return map$3(nodes2, SugarElement.fromDom); }; var get$3 = function(element) { return element.dom.innerHTML; }; var set2 = function(element, content) { var owner2 = owner$1(element); var docDom = owner2.dom; var fragment = SugarElement.fromDom(docDom.createDocumentFragment()); var contentElements = fromHtml(content, docDom); append(fragment, contentElements); empty2(element); append$1(element, fragment); }; var clone$12 = function(original, isDeep) { return SugarElement.fromDom(original.dom.cloneNode(isDeep)); }; var shallow = function(original) { return clone$12(original, false); }; var deep$1 = function(original) { return clone$12(original, true); }; var TextWalker = function(startNode, rootNode, isBoundary) { if (isBoundary === void 0) { isBoundary = never; } var walker = new DomTreeWalker(startNode, rootNode); var walk2 = function(direction) { var next2; do { next2 = walker[direction](); } while (next2 && !isText$7(next2) && !isBoundary(next2)); return Optional.from(next2).filter(isText$7); }; return { current: function() { return Optional.from(walker.current()).filter(isText$7); }, next: function() { return walk2("next"); }, prev: function() { return walk2("prev"); }, prev2: function() { return walk2("prev2"); } }; }; var TextSeeker = function(dom2, isBoundary) { var isBlockBoundary = isBoundary ? isBoundary : function(node) { return dom2.isBlock(node) || isBr$5(node) || isContentEditableFalse$b(node); }; var walk2 = function(node, offset4, walker, process3) { if (isText$7(node)) { var newOffset = process3(node, offset4, node.data); if (newOffset !== -1) { return Optional.some({ container: node, offset: newOffset }); } } return walker().bind(function(next2) { return walk2(next2.container, next2.offset, walker, process3); }); }; var backwards = function(node, offset4, process3, root2) { var walker = TextWalker(node, root2, isBlockBoundary); return walk2(node, offset4, function() { return walker.prev().map(function(prev2) { return { container: prev2, offset: prev2.length }; }); }, process3).getOrNull(); }; var forwards = function(node, offset4, process3, root2) { var walker = TextWalker(node, root2, isBlockBoundary); return walk2(node, offset4, function() { return walker.next().map(function(next2) { return { container: next2, offset: 0 }; }); }, process3).getOrNull(); }; return { backwards, forwards }; }; var round$2 = Math.round; var clone4 = function(rect) { if (!rect) { return { left: 0, top: 0, bottom: 0, right: 0, width: 0, height: 0 }; } return { left: round$2(rect.left), top: round$2(rect.top), bottom: round$2(rect.bottom), right: round$2(rect.right), width: round$2(rect.width), height: round$2(rect.height) }; }; var collapse = function(rect, toStart) { rect = clone4(rect); if (toStart) { rect.right = rect.left; } else { rect.left = rect.left + rect.width; rect.right = rect.left; } rect.width = 0; return rect; }; var isEqual3 = function(rect1, rect2) { return rect1.left === rect2.left && rect1.top === rect2.top && rect1.bottom === rect2.bottom && rect1.right === rect2.right; }; var isValidOverflow = function(overflowY, rect1, rect2) { return overflowY >= 0 && overflowY <= Math.min(rect1.height, rect2.height) / 2; }; var isAbove$1 = function(rect1, rect2) { var halfHeight = Math.min(rect2.height / 2, rect1.height / 2); if (rect1.bottom - halfHeight < rect2.top) { return true; } if (rect1.top > rect2.bottom) { return false; } return isValidOverflow(rect2.top - rect1.bottom, rect1, rect2); }; var isBelow$1 = function(rect1, rect2) { if (rect1.top > rect2.bottom) { return true; } if (rect1.bottom < rect2.top) { return false; } return isValidOverflow(rect2.bottom - rect1.top, rect1, rect2); }; var containsXY = function(rect, clientX, clientY) { return clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom; }; var clamp$2 = function(value25, min5, max5) { return Math.min(Math.max(value25, min5), max5); }; var getSelectedNode = function(range3) { var startContainer = range3.startContainer, startOffset = range3.startOffset; if (startContainer.hasChildNodes() && range3.endOffset === startOffset + 1) { return startContainer.childNodes[startOffset]; } return null; }; var getNode$1 = function(container, offset4) { if (isElement$5(container) && container.hasChildNodes()) { var childNodes = container.childNodes; var safeOffset = clamp$2(offset4, 0, childNodes.length - 1); return childNodes[safeOffset]; } else { return container; } }; var getNodeUnsafe = function(container, offset4) { if (offset4 < 0 && isElement$5(container) && container.hasChildNodes()) { return void 0; } else { return getNode$1(container, offset4); } }; var extendingChars = new RegExp("[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962-\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2-\u09E3\u0A01-\u0A02\u0A3C\u0A41-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A70-\u0A71\u0A75\u0A81-\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7-\u0AC8\u0ACD\u0AE2-\u0AE3\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B57\u0B62-\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C62-\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC-\u0CCD\u0CD5-\u0CD6\u0CE2-\u0CE3\u0D01\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62-\u0D63\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0F18-\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039-\u103A\u103D-\u103E\u1058-\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193B\u1A17-\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1ABE\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80-\u1B81\u1BA2-\u1BA5\u1BA8-\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8-\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u20D0-\u20DC\u20DD-\u20E0\u20E1\u20E2-\u20E4\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u302E-\u302F\u3099-\u309A\uA66F\uA670-\uA672\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA825-\uA826\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9E5\uAA29-\uAA2E\uAA31-\uAA32\uAA35-\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEC-\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E-\uFF9F]"); var isExtendingChar = function(ch) { return typeof ch === "string" && ch.charCodeAt(0) >= 768 && extendingChars.test(ch); }; var or = function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return function(x2) { for (var i2 = 0; i2 < args.length; i2++) { if (args[i2](x2)) { return true; } } return false; }; }; var and = function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return function(x2) { for (var i2 = 0; i2 < args.length; i2++) { if (!args[i2](x2)) { return false; } } return true; }; }; var isElement$3 = isElement$5; var isCaretCandidate$2 = isCaretCandidate$3; var isBlock$1 = matchStyleValues("display", "block table"); var isFloated = matchStyleValues("float", "left right"); var isValidElementCaretCandidate = and(isElement$3, isCaretCandidate$2, not(isFloated)); var isNotPre = not(matchStyleValues("white-space", "pre pre-line pre-wrap")); var isText$4 = isText$7; var isBr$2 = isBr$5; var nodeIndex$1 = DOMUtils.nodeIndex; var resolveIndex$1 = getNodeUnsafe; var createRange$1 = function(doc2) { return "createRange" in doc2 ? doc2.createRange() : DOMUtils.DOM.createRng(); }; var isWhiteSpace$1 = function(chr) { return chr && /[\r\n\t ]/.test(chr); }; var isRange = function(rng) { return !!rng.setStart && !!rng.setEnd; }; var isHiddenWhiteSpaceRange = function(range3) { var container = range3.startContainer; var offset4 = range3.startOffset; if (isWhiteSpace$1(range3.toString()) && isNotPre(container.parentNode) && isText$7(container)) { var text = container.data; if (isWhiteSpace$1(text[offset4 - 1]) || isWhiteSpace$1(text[offset4 + 1])) { return true; } } return false; }; var getBrClientRect = function(brNode) { var doc2 = brNode.ownerDocument; var rng = createRange$1(doc2); var nbsp$1 = doc2.createTextNode(nbsp); var parentNode = brNode.parentNode; parentNode.insertBefore(nbsp$1, brNode); rng.setStart(nbsp$1, 0); rng.setEnd(nbsp$1, 1); var clientRect = clone4(rng.getBoundingClientRect()); parentNode.removeChild(nbsp$1); return clientRect; }; var getBoundingClientRectWebKitText = function(rng) { var sc = rng.startContainer; var ec = rng.endContainer; var so = rng.startOffset; var eo = rng.endOffset; if (sc === ec && isText$7(ec) && so === 0 && eo === 1) { var newRng = rng.cloneRange(); newRng.setEndAfter(ec); return getBoundingClientRect$1(newRng); } else { return null; } }; var isZeroRect = function(r3) { return r3.left === 0 && r3.right === 0 && r3.top === 0 && r3.bottom === 0; }; var getBoundingClientRect$1 = function(item) { var clientRect; var clientRects = item.getClientRects(); if (clientRects.length > 0) { clientRect = clone4(clientRects[0]); } else { clientRect = clone4(item.getBoundingClientRect()); } if (!isRange(item) && isBr$2(item) && isZeroRect(clientRect)) { return getBrClientRect(item); } if (isZeroRect(clientRect) && isRange(item)) { return getBoundingClientRectWebKitText(item); } return clientRect; }; var collapseAndInflateWidth = function(clientRect, toStart) { var newClientRect = collapse(clientRect, toStart); newClientRect.width = 1; newClientRect.right = newClientRect.left + 1; return newClientRect; }; var getCaretPositionClientRects = function(caretPosition) { var clientRects = []; var addUniqueAndValidRect = function(clientRect) { if (clientRect.height === 0) { return; } if (clientRects.length > 0) { if (isEqual3(clientRect, clientRects[clientRects.length - 1])) { return; } } clientRects.push(clientRect); }; var addCharacterOffset = function(container2, offset5) { var range3 = createRange$1(container2.ownerDocument); if (offset5 < container2.data.length) { if (isExtendingChar(container2.data[offset5])) { return clientRects; } if (isExtendingChar(container2.data[offset5 - 1])) { range3.setStart(container2, offset5); range3.setEnd(container2, offset5 + 1); if (!isHiddenWhiteSpaceRange(range3)) { addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(range3), false)); return clientRects; } } } if (offset5 > 0) { range3.setStart(container2, offset5 - 1); range3.setEnd(container2, offset5); if (!isHiddenWhiteSpaceRange(range3)) { addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(range3), false)); } } if (offset5 < container2.data.length) { range3.setStart(container2, offset5); range3.setEnd(container2, offset5 + 1); if (!isHiddenWhiteSpaceRange(range3)) { addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(range3), true)); } } }; var container = caretPosition.container(); var offset4 = caretPosition.offset(); if (isText$4(container)) { addCharacterOffset(container, offset4); return clientRects; } if (isElement$3(container)) { if (caretPosition.isAtEnd()) { var node = resolveIndex$1(container, offset4); if (isText$4(node)) { addCharacterOffset(node, node.data.length); } if (isValidElementCaretCandidate(node) && !isBr$2(node)) { addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(node), false)); } } else { var node = resolveIndex$1(container, offset4); if (isText$4(node)) { addCharacterOffset(node, 0); } if (isValidElementCaretCandidate(node) && caretPosition.isAtEnd()) { addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(node), false)); return clientRects; } var beforeNode = resolveIndex$1(caretPosition.container(), caretPosition.offset() - 1); if (isValidElementCaretCandidate(beforeNode) && !isBr$2(beforeNode)) { if (isBlock$1(beforeNode) || isBlock$1(node) || !isValidElementCaretCandidate(node)) { addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(beforeNode), false)); } } if (isValidElementCaretCandidate(node)) { addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(node), true)); } } } return clientRects; }; var CaretPosition = function(container, offset4, clientRects) { var isAtStart = function() { if (isText$4(container)) { return offset4 === 0; } return offset4 === 0; }; var isAtEnd = function() { if (isText$4(container)) { return offset4 >= container.data.length; } return offset4 >= container.childNodes.length; }; var toRange = function() { var range3 = createRange$1(container.ownerDocument); range3.setStart(container, offset4); range3.setEnd(container, offset4); return range3; }; var getClientRects2 = function() { if (!clientRects) { clientRects = getCaretPositionClientRects(CaretPosition(container, offset4)); } return clientRects; }; var isVisible2 = function() { return getClientRects2().length > 0; }; var isEqual4 = function(caretPosition) { return caretPosition && container === caretPosition.container() && offset4 === caretPosition.offset(); }; var getNode2 = function(before2) { return resolveIndex$1(container, before2 ? offset4 - 1 : offset4); }; return { container: constant2(container), offset: constant2(offset4), toRange, getClientRects: getClientRects2, isVisible: isVisible2, isAtStart, isAtEnd, isEqual: isEqual4, getNode: getNode2 }; }; CaretPosition.fromRangeStart = function(range3) { return CaretPosition(range3.startContainer, range3.startOffset); }; CaretPosition.fromRangeEnd = function(range3) { return CaretPosition(range3.endContainer, range3.endOffset); }; CaretPosition.after = function(node) { return CaretPosition(node.parentNode, nodeIndex$1(node) + 1); }; CaretPosition.before = function(node) { return CaretPosition(node.parentNode, nodeIndex$1(node)); }; CaretPosition.isAbove = function(pos1, pos2) { return lift2(head(pos2.getClientRects()), last$2(pos1.getClientRects()), isAbove$1).getOr(false); }; CaretPosition.isBelow = function(pos1, pos2) { return lift2(last$2(pos2.getClientRects()), head(pos1.getClientRects()), isBelow$1).getOr(false); }; CaretPosition.isAtStart = function(pos) { return pos ? pos.isAtStart() : false; }; CaretPosition.isAtEnd = function(pos) { return pos ? pos.isAtEnd() : false; }; CaretPosition.isTextPosition = function(pos) { return pos ? isText$7(pos.container()) : false; }; CaretPosition.isElementPosition = function(pos) { return CaretPosition.isTextPosition(pos) === false; }; var trimEmptyTextNode$1 = function(dom2, node) { if (isText$7(node) && node.data.length === 0) { dom2.remove(node); } }; var insertNode = function(dom2, rng, node) { rng.insertNode(node); trimEmptyTextNode$1(dom2, node.previousSibling); trimEmptyTextNode$1(dom2, node.nextSibling); }; var insertFragment = function(dom2, rng, frag) { var firstChild2 = Optional.from(frag.firstChild); var lastChild2 = Optional.from(frag.lastChild); rng.insertNode(frag); firstChild2.each(function(child2) { return trimEmptyTextNode$1(dom2, child2.previousSibling); }); lastChild2.each(function(child2) { return trimEmptyTextNode$1(dom2, child2.nextSibling); }); }; var rangeInsertNode = function(dom2, rng, node) { if (isDocumentFragment(node)) { insertFragment(dom2, rng, node); } else { insertNode(dom2, rng, node); } }; var isText$3 = isText$7; var isBogus = isBogus$2; var nodeIndex = DOMUtils.nodeIndex; var normalizedParent = function(node) { var parentNode = node.parentNode; if (isBogus(parentNode)) { return normalizedParent(parentNode); } return parentNode; }; var getChildNodes = function(node) { if (!node) { return []; } return reduce(node.childNodes, function(result, node2) { if (isBogus(node2) && node2.nodeName !== "BR") { result = result.concat(getChildNodes(node2)); } else { result.push(node2); } return result; }, []); }; var normalizedTextOffset = function(node, offset4) { while (node = node.previousSibling) { if (!isText$3(node)) { break; } offset4 += node.data.length; } return offset4; }; var equal = function(a2) { return function(b2) { return a2 === b2; }; }; var normalizedNodeIndex = function(node) { var nodes2, index2; nodes2 = getChildNodes(normalizedParent(node)); index2 = findIndex$1(nodes2, equal(node), node); nodes2 = nodes2.slice(0, index2 + 1); var numTextFragments = reduce(nodes2, function(result, node2, i2) { if (isText$3(node2) && isText$3(nodes2[i2 - 1])) { result++; } return result; }, 0); nodes2 = filter$2(nodes2, matchNodeNames([node.nodeName])); index2 = findIndex$1(nodes2, equal(node), node); return index2 - numTextFragments; }; var createPathItem = function(node) { var name2; if (isText$3(node)) { name2 = "text()"; } else { name2 = node.nodeName.toLowerCase(); } return name2 + "[" + normalizedNodeIndex(node) + "]"; }; var parentsUntil$1 = function(root2, node, predicate) { var parents2 = []; for (node = node.parentNode; node !== root2; node = node.parentNode) { if (predicate && predicate(node)) { break; } parents2.push(node); } return parents2; }; var create$6 = function(root2, caretPosition) { var container, offset4, path2 = [], outputOffset, childNodes, parents2; container = caretPosition.container(); offset4 = caretPosition.offset(); if (isText$3(container)) { outputOffset = normalizedTextOffset(container, offset4); } else { childNodes = container.childNodes; if (offset4 >= childNodes.length) { outputOffset = "after"; offset4 = childNodes.length - 1; } else { outputOffset = "before"; } container = childNodes[offset4]; } path2.push(createPathItem(container)); parents2 = parentsUntil$1(root2, container); parents2 = filter$2(parents2, not(isBogus$2)); path2 = path2.concat(map$1(parents2, function(node) { return createPathItem(node); })); return path2.reverse().join("/") + "," + outputOffset; }; var resolvePathItem = function(node, name2, index2) { var nodes2 = getChildNodes(node); nodes2 = filter$2(nodes2, function(node2, index3) { return !isText$3(node2) || !isText$3(nodes2[index3 - 1]); }); nodes2 = filter$2(nodes2, matchNodeNames([name2])); return nodes2[index2]; }; var findTextPosition = function(container, offset4) { var node = container, targetOffset2 = 0, dataLen3; while (isText$3(node)) { dataLen3 = node.data.length; if (offset4 >= targetOffset2 && offset4 <= targetOffset2 + dataLen3) { container = node; offset4 = offset4 - targetOffset2; break; } if (!isText$3(node.nextSibling)) { container = node; offset4 = dataLen3; break; } targetOffset2 += dataLen3; node = node.nextSibling; } if (isText$3(container) && offset4 > container.data.length) { offset4 = container.data.length; } return CaretPosition(container, offset4); }; var resolve$2 = function(root2, path2) { var offset4; if (!path2) { return null; } var parts = path2.split(","); var paths = parts[0].split("/"); offset4 = parts.length > 1 ? parts[1] : "before"; var container = reduce(paths, function(result, value25) { var match7 = /([\w\-\(\)]+)\[([0-9]+)\]/.exec(value25); if (!match7) { return null; } if (match7[1] === "text()") { match7[1] = "#text"; } return resolvePathItem(result, match7[1], parseInt(match7[2], 10)); }, root2); if (!container) { return null; } if (!isText$3(container)) { if (offset4 === "after") { offset4 = nodeIndex(container) + 1; } else { offset4 = nodeIndex(container); } return CaretPosition(container.parentNode, offset4); } return findTextPosition(container, parseInt(offset4, 10)); }; var isContentEditableFalse$9 = isContentEditableFalse$b; var getNormalizedTextOffset = function(trim3, container, offset4) { var node, trimmedOffset; trimmedOffset = trim3(container.data.slice(0, offset4)).length; for (node = container.previousSibling; node && isText$7(node); node = node.previousSibling) { trimmedOffset += trim3(node.data).length; } return trimmedOffset; }; var getPoint2 = function(dom2, trim3, normalized, rng, start2) { var container = rng[start2 ? "startContainer" : "endContainer"]; var offset4 = rng[start2 ? "startOffset" : "endOffset"]; var point = []; var childNodes, after2 = 0; var root2 = dom2.getRoot(); if (isText$7(container)) { point.push(normalized ? getNormalizedTextOffset(trim3, container, offset4) : offset4); } else { childNodes = container.childNodes; if (offset4 >= childNodes.length && childNodes.length) { after2 = 1; offset4 = Math.max(0, childNodes.length - 1); } point.push(dom2.nodeIndex(childNodes[offset4], normalized) + after2); } for (; container && container !== root2; container = container.parentNode) { point.push(dom2.nodeIndex(container, normalized)); } return point; }; var getLocation = function(trim3, selection, normalized, rng) { var dom2 = selection.dom, bookmark = {}; bookmark.start = getPoint2(dom2, trim3, normalized, rng, true); if (!selection.isCollapsed()) { bookmark.end = getPoint2(dom2, trim3, normalized, rng, false); } if (isRangeInCaretContainerBlock(rng)) { bookmark.isFakeCaret = true; } return bookmark; }; var findIndex2 = function(dom2, name2, element) { var count3 = 0; Tools.each(dom2.select(name2), function(node) { if (node.getAttribute("data-mce-bogus") === "all") { return; } if (node === element) { return false; } count3++; }); return count3; }; var moveEndPoint$1 = function(rng, start2) { var container, offset4, childNodes; var prefix = start2 ? "start" : "end"; container = rng[prefix + "Container"]; offset4 = rng[prefix + "Offset"]; if (isElement$5(container) && container.nodeName === "TR") { childNodes = container.childNodes; container = childNodes[Math.min(start2 ? offset4 : offset4 - 1, childNodes.length - 1)]; if (container) { offset4 = start2 ? 0 : container.childNodes.length; rng["set" + (start2 ? "Start" : "End")](container, offset4); } } }; var normalizeTableCellSelection = function(rng) { moveEndPoint$1(rng, true); moveEndPoint$1(rng, false); return rng; }; var findSibling = function(node, offset4) { var sibling2; if (isElement$5(node)) { node = getNode$1(node, offset4); if (isContentEditableFalse$9(node)) { return node; } } if (isCaretContainer$2(node)) { if (isText$7(node) && isCaretContainerBlock$1(node)) { node = node.parentNode; } sibling2 = node.previousSibling; if (isContentEditableFalse$9(sibling2)) { return sibling2; } sibling2 = node.nextSibling; if (isContentEditableFalse$9(sibling2)) { return sibling2; } } }; var findAdjacentContentEditableFalseElm = function(rng) { return findSibling(rng.startContainer, rng.startOffset) || findSibling(rng.endContainer, rng.endOffset); }; var getOffsetBookmark = function(trim3, normalized, selection) { var element = selection.getNode(); var name2 = element ? element.nodeName : null; var rng = selection.getRng(); if (isContentEditableFalse$9(element) || name2 === "IMG") { return { name: name2, index: findIndex2(selection.dom, name2, element) }; } var sibling2 = findAdjacentContentEditableFalseElm(rng); if (sibling2) { name2 = sibling2.tagName; return { name: name2, index: findIndex2(selection.dom, name2, sibling2) }; } return getLocation(trim3, selection, normalized, rng); }; var getCaretBookmark = function(selection) { var rng = selection.getRng(); return { start: create$6(selection.dom.getRoot(), CaretPosition.fromRangeStart(rng)), end: create$6(selection.dom.getRoot(), CaretPosition.fromRangeEnd(rng)) }; }; var getRangeBookmark = function(selection) { return { rng: selection.getRng() }; }; var createBookmarkSpan = function(dom2, id2, filled) { var args = { "data-mce-type": "bookmark", id: id2, "style": "overflow:hidden;line-height:0px" }; return filled ? dom2.create("span", args, "") : dom2.create("span", args); }; var getPersistentBookmark = function(selection, filled) { var dom2 = selection.dom; var rng = selection.getRng(); var id2 = dom2.uniqueId(); var collapsed = selection.isCollapsed(); var element = selection.getNode(); var name2 = element.nodeName; if (name2 === "IMG") { return { name: name2, index: findIndex2(dom2, name2, element) }; } var rng2 = normalizeTableCellSelection(rng.cloneRange()); if (!collapsed) { rng2.collapse(false); var endBookmarkNode = createBookmarkSpan(dom2, id2 + "_end", filled); rangeInsertNode(dom2, rng2, endBookmarkNode); } rng = normalizeTableCellSelection(rng); rng.collapse(true); var startBookmarkNode = createBookmarkSpan(dom2, id2 + "_start", filled); rangeInsertNode(dom2, rng, startBookmarkNode); selection.moveToBookmark({ id: id2, keep: true }); return { id: id2 }; }; var getBookmark$2 = function(selection, type3, normalized) { if (type3 === 2) { return getOffsetBookmark(trim$2, normalized, selection); } else if (type3 === 3) { return getCaretBookmark(selection); } else if (type3) { return getRangeBookmark(selection); } else { return getPersistentBookmark(selection, false); } }; var getUndoBookmark = curry(getOffsetBookmark, identity2, true); var DOM$9 = DOMUtils.DOM; var defaultPreviewStyles = "font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow"; var getBodySetting = function(editor, name2, defaultValue) { var value25 = editor.getParam(name2, defaultValue); if (value25.indexOf("=") !== -1) { var bodyObj = editor.getParam(name2, "", "hash"); return get$9(bodyObj, editor.id).getOr(defaultValue); } else { return value25; } }; var getIframeAttrs = function(editor) { return editor.getParam("iframe_attrs", {}); }; var getDocType = function(editor) { return editor.getParam("doctype", ""); }; var getDocumentBaseUrl = function(editor) { return editor.getParam("document_base_url", ""); }; var getBodyId = function(editor) { return getBodySetting(editor, "body_id", "tinymce"); }; var getBodyClass = function(editor) { return getBodySetting(editor, "body_class", ""); }; var getContentSecurityPolicy = function(editor) { return editor.getParam("content_security_policy", ""); }; var shouldPutBrInPre$1 = function(editor) { return editor.getParam("br_in_pre", true); }; var getForcedRootBlock = function(editor) { if (editor.getParam("force_p_newlines", false)) { return "p"; } var block = editor.getParam("forced_root_block", "p"); if (block === false) { return ""; } else if (block === true) { return "p"; } else { return block; } }; var getForcedRootBlockAttrs = function(editor) { return editor.getParam("forced_root_block_attrs", {}); }; var getBrNewLineSelector = function(editor) { return editor.getParam("br_newline_selector", ".mce-toc h2,figcaption,caption"); }; var getNoNewLineSelector = function(editor) { return editor.getParam("no_newline_selector", ""); }; var shouldKeepStyles = function(editor) { return editor.getParam("keep_styles", true); }; var shouldEndContainerOnEmptyBlock = function(editor) { return editor.getParam("end_container_on_empty_block", false); }; var getFontStyleValues = function(editor) { return Tools.explode(editor.getParam("font_size_style_values", "xx-small,x-small,small,medium,large,x-large,xx-large")); }; var getFontSizeClasses = function(editor) { return Tools.explode(editor.getParam("font_size_classes", "")); }; var getImagesDataImgFilter = function(editor) { return editor.getParam("images_dataimg_filter", always, "function"); }; var isAutomaticUploadsEnabled = function(editor) { return editor.getParam("automatic_uploads", true, "boolean"); }; var shouldReuseFileName = function(editor) { return editor.getParam("images_reuse_filename", false, "boolean"); }; var shouldReplaceBlobUris = function(editor) { return editor.getParam("images_replace_blob_uris", true, "boolean"); }; var getIconPackName = function(editor) { return editor.getParam("icons", "", "string"); }; var getIconsUrl = function(editor) { return editor.getParam("icons_url", "", "string"); }; var getImageUploadUrl = function(editor) { return editor.getParam("images_upload_url", "", "string"); }; var getImageUploadBasePath = function(editor) { return editor.getParam("images_upload_base_path", "", "string"); }; var getImagesUploadCredentials = function(editor) { return editor.getParam("images_upload_credentials", false, "boolean"); }; var getImagesUploadHandler = function(editor) { return editor.getParam("images_upload_handler", null, "function"); }; var shouldUseContentCssCors = function(editor) { return editor.getParam("content_css_cors", false, "boolean"); }; var getReferrerPolicy = function(editor) { return editor.getParam("referrer_policy", "", "string"); }; var getLanguageCode = function(editor) { return editor.getParam("language", "en", "string"); }; var getLanguageUrl = function(editor) { return editor.getParam("language_url", "", "string"); }; var shouldIndentUseMargin = function(editor) { return editor.getParam("indent_use_margin", false); }; var getIndentation = function(editor) { return editor.getParam("indentation", "40px", "string"); }; var getContentCss = function(editor) { var contentCss = editor.getParam("content_css"); if (isString$12(contentCss)) { return map$3(contentCss.split(","), trim$4); } else if (isArray$12(contentCss)) { return contentCss; } else if (contentCss === false || editor.inline) { return []; } else { return ["default"]; } }; var getFontCss = function(editor) { var fontCss = editor.getParam("font_css", []); return isArray$12(fontCss) ? fontCss : map$3(fontCss.split(","), trim$4); }; var getDirectionality = function(editor) { return editor.getParam("directionality", I18n.isRtl() ? "rtl" : void 0); }; var getInlineBoundarySelector = function(editor) { return editor.getParam("inline_boundaries_selector", "a[href],code,.mce-annotation", "string"); }; var getObjectResizing = function(editor) { var selector2 = editor.getParam("object_resizing"); if (selector2 === false || Env.iOS) { return false; } else { return isString$12(selector2) ? selector2 : "table,img,figure.image,div,video,iframe"; } }; var getResizeImgProportional = function(editor) { return editor.getParam("resize_img_proportional", true, "boolean"); }; var getPlaceholder = function(editor) { return editor.getParam("placeholder", DOM$9.getAttrib(editor.getElement(), "placeholder"), "string"); }; var getEventRoot = function(editor) { return editor.getParam("event_root"); }; var getServiceMessage = function(editor) { return editor.getParam("service_message"); }; var getTheme = function(editor) { return editor.getParam("theme"); }; var shouldValidate = function(editor) { return editor.getParam("validate"); }; var isInlineBoundariesEnabled = function(editor) { return editor.getParam("inline_boundaries") !== false; }; var getFormats = function(editor) { return editor.getParam("formats"); }; var getPreviewStyles = function(editor) { var style = editor.getParam("preview_styles", defaultPreviewStyles); if (isString$12(style)) { return style; } else { return ""; } }; var canFormatEmptyLines = function(editor) { return editor.getParam("format_empty_lines", false, "boolean"); }; var getCustomUiSelector = function(editor) { return editor.getParam("custom_ui_selector", "", "string"); }; var getThemeUrl = function(editor) { return editor.getParam("theme_url"); }; var isInline = function(editor) { return editor.getParam("inline"); }; var hasHiddenInput = function(editor) { return editor.getParam("hidden_input"); }; var shouldPatchSubmit = function(editor) { return editor.getParam("submit_patch"); }; var isEncodingXml = function(editor) { return editor.getParam("encoding") === "xml"; }; var shouldAddFormSubmitTrigger = function(editor) { return editor.getParam("add_form_submit_trigger"); }; var shouldAddUnloadTrigger = function(editor) { return editor.getParam("add_unload_trigger"); }; var hasForcedRootBlock = function(editor) { return getForcedRootBlock(editor) !== ""; }; var getCustomUndoRedoLevels = function(editor) { return editor.getParam("custom_undo_redo_levels", 0, "number"); }; var shouldDisableNodeChange = function(editor) { return editor.getParam("disable_nodechange"); }; var isReadOnly$1 = function(editor) { return editor.getParam("readonly"); }; var hasContentCssCors = function(editor) { return editor.getParam("content_css_cors"); }; var getPlugins = function(editor) { return editor.getParam("plugins", "", "string"); }; var getExternalPlugins$1 = function(editor) { return editor.getParam("external_plugins"); }; var shouldBlockUnsupportedDrop = function(editor) { return editor.getParam("block_unsupported_drop", true, "boolean"); }; var isVisualAidsEnabled = function(editor) { return editor.getParam("visual", true, "boolean"); }; var getVisualAidsTableClass = function(editor) { return editor.getParam("visual_table_class", "mce-item-table", "string"); }; var getVisualAidsAnchorClass = function(editor) { return editor.getParam("visual_anchor_class", "mce-item-anchor", "string"); }; var getIframeAriaText = function(editor) { return editor.getParam("iframe_aria_text", "Rich Text Area. Press ALT-0 for help.", "string"); }; var isElement$2 = isElement$5; var isText$2 = isText$7; var removeNode$1 = function(node) { var parentNode = node.parentNode; if (parentNode) { parentNode.removeChild(node); } }; var trimCount = function(text) { var trimmedText = trim$2(text); return { count: text.length - trimmedText.length, text: trimmedText }; }; var deleteZwspChars = function(caretContainer) { var idx; while ((idx = caretContainer.data.lastIndexOf(ZWSP$1)) !== -1) { caretContainer.deleteData(idx, 1); } }; var removeUnchanged = function(caretContainer, pos) { remove$2(caretContainer); return pos; }; var removeTextAndReposition = function(caretContainer, pos) { var before2 = trimCount(caretContainer.data.substr(0, pos.offset())); var after2 = trimCount(caretContainer.data.substr(pos.offset())); var text = before2.text + after2.text; if (text.length > 0) { deleteZwspChars(caretContainer); return CaretPosition(caretContainer, pos.offset() - before2.count); } else { return pos; } }; var removeElementAndReposition = function(caretContainer, pos) { var parentNode = pos.container(); var newPosition = indexOf$22(from2(parentNode.childNodes), caretContainer).map(function(index2) { return index2 < pos.offset() ? CaretPosition(parentNode, pos.offset() - 1) : pos; }).getOr(pos); remove$2(caretContainer); return newPosition; }; var removeTextCaretContainer = function(caretContainer, pos) { return isText$2(caretContainer) && pos.container() === caretContainer ? removeTextAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos); }; var removeElementCaretContainer = function(caretContainer, pos) { return pos.container() === caretContainer.parentNode ? removeElementAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos); }; var removeAndReposition = function(container, pos) { return CaretPosition.isTextPosition(pos) ? removeTextCaretContainer(container, pos) : removeElementCaretContainer(container, pos); }; var remove$2 = function(caretContainerNode) { if (isElement$2(caretContainerNode) && isCaretContainer$2(caretContainerNode)) { if (hasContent(caretContainerNode)) { caretContainerNode.removeAttribute("data-mce-caret"); } else { removeNode$1(caretContainerNode); } } if (isText$2(caretContainerNode)) { deleteZwspChars(caretContainerNode); if (caretContainerNode.data.length === 0) { removeNode$1(caretContainerNode); } } }; var browser$2 = detect().browser; var isContentEditableFalse$8 = isContentEditableFalse$b; var isMedia$1 = isMedia$2; var isTableCell$3 = isTableCell$5; var inlineFakeCaretSelector = "*[contentEditable=false],video,audio,embed,object"; var getAbsoluteClientRect = function(root2, element, before2) { var clientRect = collapse(element.getBoundingClientRect(), before2); var scrollX; var scrollY; if (root2.tagName === "BODY") { var docElm = root2.ownerDocument.documentElement; scrollX = root2.scrollLeft || docElm.scrollLeft; scrollY = root2.scrollTop || docElm.scrollTop; } else { var rootRect = root2.getBoundingClientRect(); scrollX = root2.scrollLeft - rootRect.left; scrollY = root2.scrollTop - rootRect.top; } clientRect.left += scrollX; clientRect.right += scrollX; clientRect.top += scrollY; clientRect.bottom += scrollY; clientRect.width = 1; var margin = element.offsetWidth - element.clientWidth; if (margin > 0) { if (before2) { margin *= -1; } clientRect.left += margin; clientRect.right += margin; } return clientRect; }; var trimInlineCaretContainers = function(root2) { var fakeCaretTargetNodes = descendants(SugarElement.fromDom(root2), inlineFakeCaretSelector); for (var i2 = 0; i2 < fakeCaretTargetNodes.length; i2++) { var node = fakeCaretTargetNodes[i2].dom; var sibling2 = node.previousSibling; if (endsWithCaretContainer$1(sibling2)) { var data66 = sibling2.data; if (data66.length === 1) { sibling2.parentNode.removeChild(sibling2); } else { sibling2.deleteData(data66.length - 1, 1); } } sibling2 = node.nextSibling; if (startsWithCaretContainer$1(sibling2)) { var data66 = sibling2.data; if (data66.length === 1) { sibling2.parentNode.removeChild(sibling2); } else { sibling2.deleteData(0, 1); } } } }; var FakeCaret = function(editor, root2, isBlock2, hasFocus2) { var lastVisualCaret = value24(); var cursorInterval; var caretContainerNode; var rootBlock = getForcedRootBlock(editor); var caretBlock = rootBlock.length > 0 ? rootBlock : "p"; var show = function(before2, element) { var rng; hide(); if (isTableCell$3(element)) { return null; } if (isBlock2(element)) { caretContainerNode = insertBlock$1(caretBlock, element, before2); var clientRect = getAbsoluteClientRect(root2, element, before2); DomQuery(caretContainerNode).css("top", clientRect.top); var caret = DomQuery('
').css(__assign({}, clientRect)).appendTo(root2)[0]; lastVisualCaret.set({ caret, element, before: before2 }); if (before2) { DomQuery(caret).addClass("mce-visual-caret-before"); } startBlink(); rng = element.ownerDocument.createRange(); rng.setStart(caretContainerNode, 0); rng.setEnd(caretContainerNode, 0); } else { caretContainerNode = insertInline$1(element, before2); rng = element.ownerDocument.createRange(); if (isInlineFakeCaretTarget(caretContainerNode.nextSibling)) { rng.setStart(caretContainerNode, 0); rng.setEnd(caretContainerNode, 0); } else { rng.setStart(caretContainerNode, 1); rng.setEnd(caretContainerNode, 1); } return rng; } return rng; }; var hide = function() { trimInlineCaretContainers(root2); if (caretContainerNode) { remove$2(caretContainerNode); caretContainerNode = null; } lastVisualCaret.on(function(caretState) { DomQuery(caretState.caret).remove(); lastVisualCaret.clear(); }); if (cursorInterval) { Delay.clearInterval(cursorInterval); cursorInterval = void 0; } }; var startBlink = function() { cursorInterval = Delay.setInterval(function() { if (hasFocus2()) { DomQuery("div.mce-visual-caret", root2).toggleClass("mce-visual-caret-hidden"); } else { DomQuery("div.mce-visual-caret", root2).addClass("mce-visual-caret-hidden"); } }, 500); }; var reposition2 = function() { lastVisualCaret.on(function(caretState) { var clientRect = getAbsoluteClientRect(root2, caretState.element, caretState.before); DomQuery(caretState.caret).css(__assign({}, clientRect)); }); }; var destroy4 = function() { return Delay.clearInterval(cursorInterval); }; var getCss = function() { return ".mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;}"; }; return { show, hide, getCss, reposition: reposition2, destroy: destroy4 }; }; var isFakeCaretTableBrowser = function() { return browser$2.isIE() || browser$2.isEdge() || browser$2.isFirefox(); }; var isInlineFakeCaretTarget = function(node) { return isContentEditableFalse$8(node) || isMedia$1(node); }; var isFakeCaretTarget = function(node) { return isInlineFakeCaretTarget(node) || isTable$3(node) && isFakeCaretTableBrowser(); }; var isContentEditableFalse$7 = isContentEditableFalse$b; var isMedia = isMedia$2; var isBlockLike = matchStyleValues("display", "block table table-cell table-caption list-item"); var isCaretContainer = isCaretContainer$2; var isCaretContainerBlock = isCaretContainerBlock$1; var isElement$1 = isElement$5; var isCaretCandidate$1 = isCaretCandidate$3; var isForwards = function(direction) { return direction > 0; }; var isBackwards = function(direction) { return direction < 0; }; var skipCaretContainers = function(walk2, shallow2) { var node; while (node = walk2(shallow2)) { if (!isCaretContainerBlock(node)) { return node; } } return null; }; var findNode$1 = function(node, direction, predicateFn, rootNode, shallow2) { var walker = new DomTreeWalker(node, rootNode); var isCefOrCaretContainer = isContentEditableFalse$7(node) || isCaretContainerBlock(node); if (isBackwards(direction)) { if (isCefOrCaretContainer) { node = skipCaretContainers(walker.prev.bind(walker), true); if (predicateFn(node)) { return node; } } while (node = skipCaretContainers(walker.prev.bind(walker), shallow2)) { if (predicateFn(node)) { return node; } } } if (isForwards(direction)) { if (isCefOrCaretContainer) { node = skipCaretContainers(walker.next.bind(walker), true); if (predicateFn(node)) { return node; } } while (node = skipCaretContainers(walker.next.bind(walker), shallow2)) { if (predicateFn(node)) { return node; } } } return null; }; var getParentBlock$2 = function(node, rootNode) { while (node && node !== rootNode) { if (isBlockLike(node)) { return node; } node = node.parentNode; } return null; }; var isInSameBlock = function(caretPosition1, caretPosition2, rootNode) { return getParentBlock$2(caretPosition1.container(), rootNode) === getParentBlock$2(caretPosition2.container(), rootNode); }; var getChildNodeAtRelativeOffset = function(relativeOffset, caretPosition) { if (!caretPosition) { return null; } var container = caretPosition.container(); var offset4 = caretPosition.offset(); if (!isElement$1(container)) { return null; } return container.childNodes[offset4 + relativeOffset]; }; var beforeAfter = function(before2, node) { var range3 = node.ownerDocument.createRange(); if (before2) { range3.setStartBefore(node); range3.setEndBefore(node); } else { range3.setStartAfter(node); range3.setEndAfter(node); } return range3; }; var isNodesInSameBlock = function(root2, node1, node2) { return getParentBlock$2(node1, root2) === getParentBlock$2(node2, root2); }; var lean = function(left, root2, node) { var siblingName = left ? "previousSibling" : "nextSibling"; while (node && node !== root2) { var sibling2 = node[siblingName]; if (isCaretContainer(sibling2)) { sibling2 = sibling2[siblingName]; } if (isContentEditableFalse$7(sibling2) || isMedia(sibling2)) { if (isNodesInSameBlock(root2, sibling2, node)) { return sibling2; } break; } if (isCaretCandidate$1(sibling2)) { break; } node = node.parentNode; } return null; }; var before$2 = curry(beforeAfter, true); var after$2 = curry(beforeAfter, false); var normalizeRange = function(direction, root2, range3) { var node; var leanLeft = curry(lean, true, root2); var leanRight2 = curry(lean, false, root2); var container = range3.startContainer; var offset4 = range3.startOffset; if (isCaretContainerBlock$1(container)) { if (!isElement$1(container)) { container = container.parentNode; } var location_1 = container.getAttribute("data-mce-caret"); if (location_1 === "before") { node = container.nextSibling; if (isFakeCaretTarget(node)) { return before$2(node); } } if (location_1 === "after") { node = container.previousSibling; if (isFakeCaretTarget(node)) { return after$2(node); } } } if (!range3.collapsed) { return range3; } if (isText$7(container)) { if (isCaretContainer(container)) { if (direction === 1) { node = leanRight2(container); if (node) { return before$2(node); } node = leanLeft(container); if (node) { return after$2(node); } } if (direction === -1) { node = leanLeft(container); if (node) { return after$2(node); } node = leanRight2(container); if (node) { return before$2(node); } } return range3; } if (endsWithCaretContainer$1(container) && offset4 >= container.data.length - 1) { if (direction === 1) { node = leanRight2(container); if (node) { return before$2(node); } } return range3; } if (startsWithCaretContainer$1(container) && offset4 <= 1) { if (direction === -1) { node = leanLeft(container); if (node) { return after$2(node); } } return range3; } if (offset4 === container.data.length) { node = leanRight2(container); if (node) { return before$2(node); } return range3; } if (offset4 === 0) { node = leanLeft(container); if (node) { return after$2(node); } return range3; } } return range3; }; var getRelativeCefElm = function(forward, caretPosition) { return Optional.from(getChildNodeAtRelativeOffset(forward ? 0 : -1, caretPosition)).filter(isContentEditableFalse$7); }; var getNormalizedRangeEndPoint = function(direction, root2, range3) { var normalizedRange = normalizeRange(direction, root2, range3); if (direction === -1) { return CaretPosition.fromRangeStart(normalizedRange); } return CaretPosition.fromRangeEnd(normalizedRange); }; var getElementFromPosition = function(pos) { return Optional.from(pos.getNode()).map(SugarElement.fromDom); }; var getElementFromPrevPosition = function(pos) { return Optional.from(pos.getNode(true)).map(SugarElement.fromDom); }; var getVisualCaretPosition = function(walkFn, caretPosition) { while (caretPosition = walkFn(caretPosition)) { if (caretPosition.isVisible()) { return caretPosition; } } return caretPosition; }; var isMoveInsideSameBlock = function(from3, to3) { var inSameBlock = isInSameBlock(from3, to3); if (!inSameBlock && isBr$5(from3.getNode())) { return true; } return inSameBlock; }; var HDirection; (function(HDirection2) { HDirection2[HDirection2["Backwards"] = -1] = "Backwards"; HDirection2[HDirection2["Forwards"] = 1] = "Forwards"; })(HDirection || (HDirection = {})); var isContentEditableFalse$6 = isContentEditableFalse$b; var isText$1 = isText$7; var isElement2 = isElement$5; var isBr$1 = isBr$5; var isCaretCandidate = isCaretCandidate$3; var isAtomic = isAtomic$1; var isEditableCaretCandidate = isEditableCaretCandidate$1; var getParents$3 = function(node, root2) { var parents2 = []; while (node && node !== root2) { parents2.push(node); node = node.parentNode; } return parents2; }; var nodeAtIndex = function(container, offset4) { if (container.hasChildNodes() && offset4 < container.childNodes.length) { return container.childNodes[offset4]; } return null; }; var getCaretCandidatePosition = function(direction, node) { if (isForwards(direction)) { if (isCaretCandidate(node.previousSibling) && !isText$1(node.previousSibling)) { return CaretPosition.before(node); } if (isText$1(node)) { return CaretPosition(node, 0); } } if (isBackwards(direction)) { if (isCaretCandidate(node.nextSibling) && !isText$1(node.nextSibling)) { return CaretPosition.after(node); } if (isText$1(node)) { return CaretPosition(node, node.data.length); } } if (isBackwards(direction)) { if (isBr$1(node)) { return CaretPosition.before(node); } return CaretPosition.after(node); } return CaretPosition.before(node); }; var moveForwardFromBr = function(root2, nextNode) { var nextSibling2 = nextNode.nextSibling; if (nextSibling2 && isCaretCandidate(nextSibling2)) { if (isText$1(nextSibling2)) { return CaretPosition(nextSibling2, 0); } else { return CaretPosition.before(nextSibling2); } } else { return findCaretPosition$1(HDirection.Forwards, CaretPosition.after(nextNode), root2); } }; var findCaretPosition$1 = function(direction, startPos, root2) { var node; var nextNode; var innerNode; var caretPosition; if (!isElement2(root2) || !startPos) { return null; } if (startPos.isEqual(CaretPosition.after(root2)) && root2.lastChild) { caretPosition = CaretPosition.after(root2.lastChild); if (isBackwards(direction) && isCaretCandidate(root2.lastChild) && isElement2(root2.lastChild)) { return isBr$1(root2.lastChild) ? CaretPosition.before(root2.lastChild) : caretPosition; } } else { caretPosition = startPos; } var container = caretPosition.container(); var offset4 = caretPosition.offset(); if (isText$1(container)) { if (isBackwards(direction) && offset4 > 0) { return CaretPosition(container, --offset4); } if (isForwards(direction) && offset4 < container.length) { return CaretPosition(container, ++offset4); } node = container; } else { if (isBackwards(direction) && offset4 > 0) { nextNode = nodeAtIndex(container, offset4 - 1); if (isCaretCandidate(nextNode)) { if (!isAtomic(nextNode)) { innerNode = findNode$1(nextNode, direction, isEditableCaretCandidate, nextNode); if (innerNode) { if (isText$1(innerNode)) { return CaretPosition(innerNode, innerNode.data.length); } return CaretPosition.after(innerNode); } } if (isText$1(nextNode)) { return CaretPosition(nextNode, nextNode.data.length); } return CaretPosition.before(nextNode); } } if (isForwards(direction) && offset4 < container.childNodes.length) { nextNode = nodeAtIndex(container, offset4); if (isCaretCandidate(nextNode)) { if (isBr$1(nextNode)) { return moveForwardFromBr(root2, nextNode); } if (!isAtomic(nextNode)) { innerNode = findNode$1(nextNode, direction, isEditableCaretCandidate, nextNode); if (innerNode) { if (isText$1(innerNode)) { return CaretPosition(innerNode, 0); } return CaretPosition.before(innerNode); } } if (isText$1(nextNode)) { return CaretPosition(nextNode, 0); } return CaretPosition.after(nextNode); } } node = nextNode ? nextNode : caretPosition.getNode(); } if (isForwards(direction) && caretPosition.isAtEnd() || isBackwards(direction) && caretPosition.isAtStart()) { node = findNode$1(node, direction, always, root2, true); if (isEditableCaretCandidate(node, root2)) { return getCaretCandidatePosition(direction, node); } } nextNode = findNode$1(node, direction, isEditableCaretCandidate, root2); var rootContentEditableFalseElm = last$1(filter$4(getParents$3(container, root2), isContentEditableFalse$6)); if (rootContentEditableFalseElm && (!nextNode || !rootContentEditableFalseElm.contains(nextNode))) { if (isForwards(direction)) { caretPosition = CaretPosition.after(rootContentEditableFalseElm); } else { caretPosition = CaretPosition.before(rootContentEditableFalseElm); } return caretPosition; } if (nextNode) { return getCaretCandidatePosition(direction, nextNode); } return null; }; var CaretWalker = function(root2) { return { next: function(caretPosition) { return findCaretPosition$1(HDirection.Forwards, caretPosition, root2); }, prev: function(caretPosition) { return findCaretPosition$1(HDirection.Backwards, caretPosition, root2); } }; }; var walkToPositionIn = function(forward, root2, start2) { var position2 = forward ? CaretPosition.before(start2) : CaretPosition.after(start2); return fromPosition(forward, root2, position2); }; var afterElement = function(node) { return isBr$5(node) ? CaretPosition.before(node) : CaretPosition.after(node); }; var isBeforeOrStart = function(position2) { if (CaretPosition.isTextPosition(position2)) { return position2.offset() === 0; } else { return isCaretCandidate$3(position2.getNode()); } }; var isAfterOrEnd = function(position2) { if (CaretPosition.isTextPosition(position2)) { var container = position2.container(); return position2.offset() === container.data.length; } else { return isCaretCandidate$3(position2.getNode(true)); } }; var isBeforeAfterSameElement = function(from3, to3) { return !CaretPosition.isTextPosition(from3) && !CaretPosition.isTextPosition(to3) && from3.getNode() === to3.getNode(true); }; var isAtBr = function(position2) { return !CaretPosition.isTextPosition(position2) && isBr$5(position2.getNode()); }; var shouldSkipPosition = function(forward, from3, to3) { if (forward) { return !isBeforeAfterSameElement(from3, to3) && !isAtBr(from3) && isAfterOrEnd(from3) && isBeforeOrStart(to3); } else { return !isBeforeAfterSameElement(to3, from3) && isBeforeOrStart(from3) && isAfterOrEnd(to3); } }; var fromPosition = function(forward, root2, pos) { var walker = CaretWalker(root2); return Optional.from(forward ? walker.next(pos) : walker.prev(pos)); }; var navigate = function(forward, root2, from3) { return fromPosition(forward, root2, from3).bind(function(to3) { if (isInSameBlock(from3, to3, root2) && shouldSkipPosition(forward, from3, to3)) { return fromPosition(forward, root2, to3); } else { return Optional.some(to3); } }); }; var navigateIgnore = function(forward, root2, from3, ignoreFilter) { return navigate(forward, root2, from3).bind(function(pos) { return ignoreFilter(pos) ? navigateIgnore(forward, root2, pos, ignoreFilter) : Optional.some(pos); }); }; var positionIn = function(forward, element) { var startNode = forward ? element.firstChild : element.lastChild; if (isText$7(startNode)) { return Optional.some(CaretPosition(startNode, forward ? 0 : startNode.data.length)); } else if (startNode) { if (isCaretCandidate$3(startNode)) { return Optional.some(forward ? CaretPosition.before(startNode) : afterElement(startNode)); } else { return walkToPositionIn(forward, element, startNode); } } else { return Optional.none(); } }; var nextPosition = curry(fromPosition, true); var prevPosition = curry(fromPosition, false); var firstPositionIn = curry(positionIn, true); var lastPositionIn = curry(positionIn, false); var CARET_ID$1 = "_mce_caret"; var isCaretNode = function(node) { return isElement$5(node) && node.id === CARET_ID$1; }; var getParentCaretContainer = function(body, node) { while (node && node !== body) { if (node.id === CARET_ID$1) { return node; } node = node.parentNode; } return null; }; var isStringPathBookmark = function(bookmark) { return isString$12(bookmark.start); }; var isRangeBookmark = function(bookmark) { return has$22(bookmark, "rng"); }; var isIdBookmark = function(bookmark) { return has$22(bookmark, "id"); }; var isIndexBookmark = function(bookmark) { return has$22(bookmark, "name"); }; var isPathBookmark = function(bookmark) { return Tools.isArray(bookmark.start); }; var addBogus = function(dom2, node) { if (isElement$5(node) && dom2.isBlock(node) && !node.innerHTML && !Env.ie) { node.innerHTML = '
'; } return node; }; var resolveCaretPositionBookmark = function(dom2, bookmark) { var pos; var rng = dom2.createRng(); pos = resolve$2(dom2.getRoot(), bookmark.start); rng.setStart(pos.container(), pos.offset()); pos = resolve$2(dom2.getRoot(), bookmark.end); rng.setEnd(pos.container(), pos.offset()); return rng; }; var insertZwsp = function(node, rng) { var textNode = node.ownerDocument.createTextNode(ZWSP$1); node.appendChild(textNode); rng.setStart(textNode, 0); rng.setEnd(textNode, 0); }; var isEmpty$1 = function(node) { return node.hasChildNodes() === false; }; var tryFindRangePosition = function(node, rng) { return lastPositionIn(node).fold(never, function(pos) { rng.setStart(pos.container(), pos.offset()); rng.setEnd(pos.container(), pos.offset()); return true; }); }; var padEmptyCaretContainer = function(root2, node, rng) { if (isEmpty$1(node) && getParentCaretContainer(root2, node)) { insertZwsp(node, rng); return true; } else { return false; } }; var setEndPoint = function(dom2, start2, bookmark, rng) { var point = bookmark[start2 ? "start" : "end"]; var i2, node, offset4, children2; var root2 = dom2.getRoot(); if (point) { offset4 = point[0]; for (node = root2, i2 = point.length - 1; i2 >= 1; i2--) { children2 = node.childNodes; if (padEmptyCaretContainer(root2, node, rng)) { return true; } if (point[i2] > children2.length - 1) { if (padEmptyCaretContainer(root2, node, rng)) { return true; } return tryFindRangePosition(node, rng); } node = children2[point[i2]]; } if (node.nodeType === 3) { offset4 = Math.min(point[0], node.nodeValue.length); } if (node.nodeType === 1) { offset4 = Math.min(point[0], node.childNodes.length); } if (start2) { rng.setStart(node, offset4); } else { rng.setEnd(node, offset4); } } return true; }; var isValidTextNode = function(node) { return isText$7(node) && node.data.length > 0; }; var restoreEndPoint = function(dom2, suffix, bookmark) { var marker = dom2.get(bookmark.id + "_" + suffix), node, idx, next2, prev2; var keep = bookmark.keep; var container, offset4; if (marker) { node = marker.parentNode; if (suffix === "start") { if (!keep) { idx = dom2.nodeIndex(marker); } else { if (marker.hasChildNodes()) { node = marker.firstChild; idx = 1; } else if (isValidTextNode(marker.nextSibling)) { node = marker.nextSibling; idx = 0; } else if (isValidTextNode(marker.previousSibling)) { node = marker.previousSibling; idx = marker.previousSibling.data.length; } else { node = marker.parentNode; idx = dom2.nodeIndex(marker) + 1; } } container = node; offset4 = idx; } else { if (!keep) { idx = dom2.nodeIndex(marker); } else { if (marker.hasChildNodes()) { node = marker.firstChild; idx = 1; } else if (isValidTextNode(marker.previousSibling)) { node = marker.previousSibling; idx = marker.previousSibling.data.length; } else { node = marker.parentNode; idx = dom2.nodeIndex(marker); } } container = node; offset4 = idx; } if (!keep) { prev2 = marker.previousSibling; next2 = marker.nextSibling; Tools.each(Tools.grep(marker.childNodes), function(node2) { if (isText$7(node2)) { node2.nodeValue = node2.nodeValue.replace(/\uFEFF/g, ""); } }); while (marker = dom2.get(bookmark.id + "_" + suffix)) { dom2.remove(marker, true); } if (prev2 && next2 && prev2.nodeType === next2.nodeType && isText$7(prev2) && !Env.opera) { idx = prev2.nodeValue.length; prev2.appendData(next2.nodeValue); dom2.remove(next2); container = prev2; offset4 = idx; } } return Optional.some(CaretPosition(container, offset4)); } else { return Optional.none(); } }; var resolvePaths = function(dom2, bookmark) { var rng = dom2.createRng(); if (setEndPoint(dom2, true, bookmark, rng) && setEndPoint(dom2, false, bookmark, rng)) { return Optional.some(rng); } else { return Optional.none(); } }; var resolveId = function(dom2, bookmark) { var startPos = restoreEndPoint(dom2, "start", bookmark); var endPos = restoreEndPoint(dom2, "end", bookmark); return lift2(startPos, endPos.or(startPos), function(spos, epos) { var rng = dom2.createRng(); rng.setStart(addBogus(dom2, spos.container()), spos.offset()); rng.setEnd(addBogus(dom2, epos.container()), epos.offset()); return rng; }); }; var resolveIndex = function(dom2, bookmark) { return Optional.from(dom2.select(bookmark.name)[bookmark.index]).map(function(elm) { var rng = dom2.createRng(); rng.selectNode(elm); return rng; }); }; var resolve$1 = function(selection, bookmark) { var dom2 = selection.dom; if (bookmark) { if (isPathBookmark(bookmark)) { return resolvePaths(dom2, bookmark); } else if (isStringPathBookmark(bookmark)) { return Optional.some(resolveCaretPositionBookmark(dom2, bookmark)); } else if (isIdBookmark(bookmark)) { return resolveId(dom2, bookmark); } else if (isIndexBookmark(bookmark)) { return resolveIndex(dom2, bookmark); } else if (isRangeBookmark(bookmark)) { return Optional.some(bookmark.rng); } } return Optional.none(); }; var getBookmark$1 = function(selection, type3, normalized) { return getBookmark$2(selection, type3, normalized); }; var moveToBookmark = function(selection, bookmark) { resolve$1(selection, bookmark).each(function(rng) { selection.setRng(rng); }); }; var isBookmarkNode$1 = function(node) { return isElement$5(node) && node.tagName === "SPAN" && node.getAttribute("data-mce-type") === "bookmark"; }; var is2 = function(expected) { return function(actual) { return expected === actual; }; }; var isNbsp = is2(nbsp); var isWhiteSpace = function(chr) { return chr !== "" && " \f\n\r \v".indexOf(chr) !== -1; }; var isContent = function(chr) { return !isWhiteSpace(chr) && !isNbsp(chr); }; var isNode = function(node) { return !!node.nodeType; }; var isInlineBlock = function(node) { return node && /^(IMG)$/.test(node.nodeName); }; var moveStart = function(dom2, selection, rng) { var offset4 = rng.startOffset; var container = rng.startContainer; if (container === rng.endContainer) { if (isInlineBlock(container.childNodes[offset4])) { return; } } if (isElement$5(container)) { var nodes2 = container.childNodes; var walker = void 0; if (offset4 < nodes2.length) { container = nodes2[offset4]; walker = new DomTreeWalker(container, dom2.getParent(container, dom2.isBlock)); } else { container = nodes2[nodes2.length - 1]; walker = new DomTreeWalker(container, dom2.getParent(container, dom2.isBlock)); walker.next(true); } for (var node = walker.current(); node; node = walker.next()) { if (isText$7(node) && !isWhiteSpaceNode$1(node)) { rng.setStart(node, 0); selection.setRng(rng); return; } } } }; var getNonWhiteSpaceSibling = function(node, next2, inc) { if (node) { var nextName = next2 ? "nextSibling" : "previousSibling"; for (node = inc ? node : node[nextName]; node; node = node[nextName]) { if (isElement$5(node) || !isWhiteSpaceNode$1(node)) { return node; } } } }; var isTextBlock$1 = function(editor, name2) { if (isNode(name2)) { name2 = name2.nodeName; } return !!editor.schema.getTextBlockElements()[name2.toLowerCase()]; }; var isValid4 = function(ed, parent3, child2) { return ed.schema.isValidChild(parent3, child2); }; var isWhiteSpaceNode$1 = function(node, allowSpaces) { if (allowSpaces === void 0) { allowSpaces = false; } if (isNonNullable(node) && isText$7(node)) { var data66 = allowSpaces ? node.data.replace(/ /g, "\xA0") : node.data; return isWhitespaceText(data66); } else { return false; } }; var isEmptyTextNode$1 = function(node) { return isNonNullable(node) && isText$7(node) && node.length === 0; }; var replaceVars = function(value25, vars) { if (isFunction3(value25)) { value25 = value25(vars); } else if (isNonNullable(vars)) { value25 = value25.replace(/%(\w+)/g, function(str, name2) { return vars[name2] || str; }); } return value25; }; var isEq$5 = function(str1, str2) { str1 = str1 || ""; str2 = str2 || ""; str1 = "" + (str1.nodeName || str1); str2 = "" + (str2.nodeName || str2); return str1.toLowerCase() === str2.toLowerCase(); }; var normalizeStyleValue = function(dom2, value25, name2) { if (name2 === "color" || name2 === "backgroundColor") { value25 = dom2.toHex(value25); } if (name2 === "fontWeight" && value25 === 700) { value25 = "bold"; } if (name2 === "fontFamily") { value25 = value25.replace(/[\'\"]/g, "").replace(/,\s+/g, ","); } return "" + value25; }; var getStyle3 = function(dom2, node, name2) { return normalizeStyleValue(dom2, dom2.getStyle(node, name2), name2); }; var getTextDecoration = function(dom2, node) { var decoration; dom2.getParent(node, function(n2) { decoration = dom2.getStyle(n2, "text-decoration"); return decoration && decoration !== "none"; }); return decoration; }; var getParents$2 = function(dom2, node, selector2) { return dom2.getParents(node, selector2, dom2.getRoot()); }; var isVariableFormatName = function(editor, formatName) { var hasVariableValues = function(format3) { var isVariableValue = function(val) { return val.length > 1 && val.charAt(0) === "%"; }; return exists([ "styles", "attributes" ], function(key2) { return get$9(format3, key2).exists(function(field) { var fieldValues = isArray$12(field) ? field : values2(field); return exists(fieldValues, isVariableValue); }); }); }; return exists(editor.formatter.get(formatName), hasVariableValues); }; var areSimilarFormats = function(editor, formatName, otherFormatName) { var validKeys2 = [ "inline", "block", "selector", "attributes", "styles", "classes" ]; var filterObj = function(format3) { return filter$3(format3, function(_2, key2) { return exists(validKeys2, function(validKey) { return validKey === key2; }); }); }; return exists(editor.formatter.get(formatName), function(fmt1) { var filteredFmt1 = filterObj(fmt1); return exists(editor.formatter.get(otherFormatName), function(fmt2) { var filteredFmt2 = filterObj(fmt2); return equal$1(filteredFmt1, filteredFmt2); }); }); }; var isBlockFormat = function(format3) { return hasNonNullableKey(format3, "block"); }; var isSelectorFormat = function(format3) { return hasNonNullableKey(format3, "selector"); }; var isInlineFormat = function(format3) { return hasNonNullableKey(format3, "inline"); }; var isMixedFormat = function(format3) { return isSelectorFormat(format3) && isInlineFormat(format3) && is$1(get$9(format3, "mixed"), true); }; var shouldExpandToSelector = function(format3) { return isSelectorFormat(format3) && format3.expand !== false && !isInlineFormat(format3); }; var isBookmarkNode = isBookmarkNode$1; var getParents$1 = getParents$2; var isWhiteSpaceNode = isWhiteSpaceNode$1; var isTextBlock = isTextBlock$1; var isBogusBr = function(node) { return isBr$5(node) && node.getAttribute("data-mce-bogus") && !node.nextSibling; }; var findParentContentEditable = function(dom2, node) { var parent3 = node; while (parent3) { if (isElement$5(parent3) && dom2.getContentEditable(parent3)) { return dom2.getContentEditable(parent3) === "false" ? parent3 : node; } parent3 = parent3.parentNode; } return node; }; var walkText = function(start2, node, offset4, predicate) { var str = node.data; for (var i2 = offset4; start2 ? i2 >= 0 : i2 < str.length; start2 ? i2-- : i2++) { if (predicate(str.charAt(i2))) { return start2 ? i2 + 1 : i2; } } return -1; }; var findSpace = function(start2, node, offset4) { return walkText(start2, node, offset4, function(c2) { return isNbsp(c2) || isWhiteSpace(c2); }); }; var findContent = function(start2, node, offset4) { return walkText(start2, node, offset4, isContent); }; var findWordEndPoint = function(dom2, body, container, offset4, start2, includeTrailingSpaces) { var lastTextNode; var rootNode = dom2.getParent(container, dom2.isBlock) || body; var walk2 = function(container2, offset5, pred) { var textSeeker = TextSeeker(dom2); var walker = start2 ? textSeeker.backwards : textSeeker.forwards; return Optional.from(walker(container2, offset5, function(text, textOffset) { if (isBookmarkNode(text.parentNode)) { return -1; } else { lastTextNode = text; return pred(start2, text, textOffset); } }, rootNode)); }; var spaceResult = walk2(container, offset4, findSpace); return spaceResult.bind(function(result) { return includeTrailingSpaces ? walk2(result.container, result.offset + (start2 ? -1 : 0), findContent) : Optional.some(result); }).orThunk(function() { return lastTextNode ? Optional.some({ container: lastTextNode, offset: start2 ? 0 : lastTextNode.length }) : Optional.none(); }); }; var findSelectorEndPoint = function(dom2, formatList, rng, container, siblingName) { if (isText$7(container) && isEmpty$3(container.data) && container[siblingName]) { container = container[siblingName]; } var parents2 = getParents$1(dom2, container); for (var i2 = 0; i2 < parents2.length; i2++) { for (var y2 = 0; y2 < formatList.length; y2++) { var curFormat = formatList[y2]; if (isNonNullable(curFormat.collapsed) && curFormat.collapsed !== rng.collapsed) { continue; } if (isSelectorFormat(curFormat) && dom2.is(parents2[i2], curFormat.selector)) { return parents2[i2]; } } } return container; }; var findBlockEndPoint = function(editor, formatList, container, siblingName) { var node = container; var dom2 = editor.dom; var root2 = dom2.getRoot(); var format3 = formatList[0]; if (isBlockFormat(format3)) { node = format3.wrapper ? null : dom2.getParent(container, format3.block, root2); } if (!node) { var scopeRoot = dom2.getParent(container, "LI,TD,TH"); node = dom2.getParent(isText$7(container) ? container.parentNode : container, function(node2) { return node2 !== root2 && isTextBlock(editor, node2); }, scopeRoot); } if (node && isBlockFormat(format3) && format3.wrapper) { node = getParents$1(dom2, node, "ul,ol").reverse()[0] || node; } if (!node) { node = container; while (node[siblingName] && !dom2.isBlock(node[siblingName])) { node = node[siblingName]; if (isEq$5(node, "br")) { break; } } } return node || container; }; var isAtBlockBoundary$1 = function(dom2, root2, container, siblingName) { var parent3 = container.parentNode; if (isNonNullable(container[siblingName])) { return false; } else if (parent3 === root2 || isNullable(parent3) || dom2.isBlock(parent3)) { return true; } else { return isAtBlockBoundary$1(dom2, root2, parent3, siblingName); } }; var findParentContainer = function(dom2, formatList, container, offset4, start2) { var parent3 = container; var siblingName = start2 ? "previousSibling" : "nextSibling"; var root2 = dom2.getRoot(); if (isText$7(container) && !isWhiteSpaceNode(container)) { if (start2 ? offset4 > 0 : offset4 < container.data.length) { return container; } } while (true) { if (!formatList[0].block_expand && dom2.isBlock(parent3)) { return parent3; } for (var sibling2 = parent3[siblingName]; sibling2; sibling2 = sibling2[siblingName]) { var allowSpaces = isText$7(sibling2) && !isAtBlockBoundary$1(dom2, root2, sibling2, siblingName); if (!isBookmarkNode(sibling2) && !isBogusBr(sibling2) && !isWhiteSpaceNode(sibling2, allowSpaces)) { return parent3; } } if (parent3 === root2 || parent3.parentNode === root2) { container = parent3; break; } parent3 = parent3.parentNode; } return container; }; var isSelfOrParentBookmark = function(container) { return isBookmarkNode(container.parentNode) || isBookmarkNode(container); }; var expandRng = function(editor, rng, formatList, includeTrailingSpace) { if (includeTrailingSpace === void 0) { includeTrailingSpace = false; } var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset; var dom2 = editor.dom; var format3 = formatList[0]; if (isElement$5(startContainer) && startContainer.hasChildNodes()) { startContainer = getNode$1(startContainer, startOffset); if (isText$7(startContainer)) { startOffset = 0; } } if (isElement$5(endContainer) && endContainer.hasChildNodes()) { endContainer = getNode$1(endContainer, rng.collapsed ? endOffset : endOffset - 1); if (isText$7(endContainer)) { endOffset = endContainer.nodeValue.length; } } startContainer = findParentContentEditable(dom2, startContainer); endContainer = findParentContentEditable(dom2, endContainer); if (isSelfOrParentBookmark(startContainer)) { startContainer = isBookmarkNode(startContainer) ? startContainer : startContainer.parentNode; if (rng.collapsed) { startContainer = startContainer.previousSibling || startContainer; } else { startContainer = startContainer.nextSibling || startContainer; } if (isText$7(startContainer)) { startOffset = rng.collapsed ? startContainer.length : 0; } } if (isSelfOrParentBookmark(endContainer)) { endContainer = isBookmarkNode(endContainer) ? endContainer : endContainer.parentNode; if (rng.collapsed) { endContainer = endContainer.nextSibling || endContainer; } else { endContainer = endContainer.previousSibling || endContainer; } if (isText$7(endContainer)) { endOffset = rng.collapsed ? 0 : endContainer.length; } } if (rng.collapsed) { var startPoint = findWordEndPoint(dom2, editor.getBody(), startContainer, startOffset, true, includeTrailingSpace); startPoint.each(function(_a3) { var container = _a3.container, offset4 = _a3.offset; startContainer = container; startOffset = offset4; }); var endPoint = findWordEndPoint(dom2, editor.getBody(), endContainer, endOffset, false, includeTrailingSpace); endPoint.each(function(_a3) { var container = _a3.container, offset4 = _a3.offset; endContainer = container; endOffset = offset4; }); } if (isInlineFormat(format3) || format3.block_expand) { if (!isInlineFormat(format3) || (!isText$7(startContainer) || startOffset === 0)) { startContainer = findParentContainer(dom2, formatList, startContainer, startOffset, true); } if (!isInlineFormat(format3) || (!isText$7(endContainer) || endOffset === endContainer.nodeValue.length)) { endContainer = findParentContainer(dom2, formatList, endContainer, endOffset, false); } } if (shouldExpandToSelector(format3)) { startContainer = findSelectorEndPoint(dom2, formatList, rng, startContainer, "previousSibling"); endContainer = findSelectorEndPoint(dom2, formatList, rng, endContainer, "nextSibling"); } if (isBlockFormat(format3) || isSelectorFormat(format3)) { startContainer = findBlockEndPoint(editor, formatList, startContainer, "previousSibling"); endContainer = findBlockEndPoint(editor, formatList, endContainer, "nextSibling"); if (isBlockFormat(format3)) { if (!dom2.isBlock(startContainer)) { startContainer = findParentContainer(dom2, formatList, startContainer, startOffset, true); } if (!dom2.isBlock(endContainer)) { endContainer = findParentContainer(dom2, formatList, endContainer, endOffset, false); } } } if (isElement$5(startContainer)) { startOffset = dom2.nodeIndex(startContainer); startContainer = startContainer.parentNode; } if (isElement$5(endContainer)) { endOffset = dom2.nodeIndex(endContainer) + 1; endContainer = endContainer.parentNode; } return { startContainer, startOffset, endContainer, endOffset }; }; var walk$2 = function(dom2, rng, callback2) { var startOffset = rng.startOffset; var startContainer = getNode$1(rng.startContainer, startOffset); var endOffset = rng.endOffset; var endContainer = getNode$1(rng.endContainer, endOffset - 1); var exclude = function(nodes2) { var firstNode = nodes2[0]; if (isText$7(firstNode) && firstNode === startContainer && startOffset >= firstNode.data.length) { nodes2.splice(0, 1); } var lastNode = nodes2[nodes2.length - 1]; if (endOffset === 0 && nodes2.length > 0 && lastNode === endContainer && isText$7(lastNode)) { nodes2.splice(nodes2.length - 1, 1); } return nodes2; }; var collectSiblings = function(node, name2, endNode) { var siblings3 = []; for (; node && node !== endNode; node = node[name2]) { siblings3.push(node); } return siblings3; }; var findEndPoint = function(node, root2) { return dom2.getParent(node, function(node2) { return node2.parentNode === root2; }, root2); }; var walkBoundary = function(startNode, endNode, next2) { var siblingName = next2 ? "nextSibling" : "previousSibling"; for (var node = startNode, parent_1 = node.parentNode; node && node !== endNode; node = parent_1) { parent_1 = node.parentNode; var siblings_1 = collectSiblings(node === startNode ? node : node[siblingName], siblingName); if (siblings_1.length) { if (!next2) { siblings_1.reverse(); } callback2(exclude(siblings_1)); } } }; if (startContainer === endContainer) { return callback2(exclude([startContainer])); } var ancestor2 = dom2.findCommonAncestor(startContainer, endContainer); if (dom2.isChildOf(startContainer, endContainer)) { return walkBoundary(startContainer, ancestor2, true); } if (dom2.isChildOf(endContainer, startContainer)) { return walkBoundary(endContainer, ancestor2); } var startPoint = findEndPoint(startContainer, ancestor2) || startContainer; var endPoint = findEndPoint(endContainer, ancestor2) || endContainer; walkBoundary(startContainer, startPoint, true); var siblings2 = collectSiblings(startPoint === startContainer ? startPoint : startPoint.nextSibling, "nextSibling", endPoint === endContainer ? endPoint.nextSibling : endPoint); if (siblings2.length) { callback2(exclude(siblings2)); } walkBoundary(endContainer, endPoint); }; var getRanges = function(selection) { var ranges = []; if (selection) { for (var i2 = 0; i2 < selection.rangeCount; i2++) { ranges.push(selection.getRangeAt(i2)); } } return ranges; }; var getSelectedNodes = function(ranges) { return bind4(ranges, function(range3) { var node = getSelectedNode(range3); return node ? [SugarElement.fromDom(node)] : []; }); }; var hasMultipleRanges = function(selection) { return getRanges(selection).length > 1; }; var getCellsFromRanges = function(ranges) { return filter$4(getSelectedNodes(ranges), isTableCell$4); }; var getCellsFromElement = function(elm) { return descendants(elm, "td[data-mce-selected],th[data-mce-selected]"); }; var getCellsFromElementOrRanges = function(ranges, element) { var selectedCells = getCellsFromElement(element); return selectedCells.length > 0 ? selectedCells : getCellsFromRanges(ranges); }; var getCellsFromEditor = function(editor) { return getCellsFromElementOrRanges(getRanges(editor.selection.getSel()), SugarElement.fromDom(editor.getBody())); }; var getClosestTable = function(cell, isRoot) { return ancestor$2(cell, "table", isRoot); }; var getStartNode = function(rng) { var sc = rng.startContainer, so = rng.startOffset; if (isText$7(sc)) { return so === 0 ? Optional.some(SugarElement.fromDom(sc)) : Optional.none(); } else { return Optional.from(sc.childNodes[so]).map(SugarElement.fromDom); } }; var getEndNode = function(rng) { var ec = rng.endContainer, eo = rng.endOffset; if (isText$7(ec)) { return eo === ec.data.length ? Optional.some(SugarElement.fromDom(ec)) : Optional.none(); } else { return Optional.from(ec.childNodes[eo - 1]).map(SugarElement.fromDom); } }; var getFirstChildren = function(node) { return firstChild(node).fold(constant2([node]), function(child2) { return [node].concat(getFirstChildren(child2)); }); }; var getLastChildren$1 = function(node) { return lastChild(node).fold(constant2([node]), function(child2) { if (name(child2) === "br") { return prevSibling(child2).map(function(sibling2) { return [node].concat(getLastChildren$1(sibling2)); }).getOr([]); } else { return [node].concat(getLastChildren$1(child2)); } }); }; var hasAllContentsSelected = function(elm, rng) { return lift2(getStartNode(rng), getEndNode(rng), function(startNode, endNode) { var start2 = find$3(getFirstChildren(elm), curry(eq2, startNode)); var end2 = find$3(getLastChildren$1(elm), curry(eq2, endNode)); return start2.isSome() && end2.isSome(); }).getOr(false); }; var moveEndPoint = function(dom2, rng, node, start2) { var root2 = node, walker = new DomTreeWalker(node, root2); var moveCaretBeforeOnEnterElementsMap = filter$3(dom2.schema.getMoveCaretBeforeOnEnterElements(), function(_2, name2) { return !contains$3([ "td", "th", "table" ], name2.toLowerCase()); }); do { if (isText$7(node) && Tools.trim(node.nodeValue).length !== 0) { if (start2) { rng.setStart(node, 0); } else { rng.setEnd(node, node.nodeValue.length); } return; } if (moveCaretBeforeOnEnterElementsMap[node.nodeName]) { if (start2) { rng.setStartBefore(node); } else { if (node.nodeName === "BR") { rng.setEndBefore(node); } else { rng.setEndAfter(node); } } return; } } while (node = start2 ? walker.next() : walker.prev()); if (root2.nodeName === "BODY") { if (start2) { rng.setStart(root2, 0); } else { rng.setEnd(root2, root2.childNodes.length); } } }; var hasAnyRanges = function(editor) { var sel = editor.selection.getSel(); return sel && sel.rangeCount > 0; }; var runOnRanges = function(editor, executor) { var fakeSelectionNodes = getCellsFromEditor(editor); if (fakeSelectionNodes.length > 0) { each$k(fakeSelectionNodes, function(elem) { var node = elem.dom; var fakeNodeRng = editor.dom.createRng(); fakeNodeRng.setStartBefore(node); fakeNodeRng.setEndAfter(node); executor(fakeNodeRng, true); }); } else { executor(editor.selection.getRng(), false); } }; var preserve = function(selection, fillBookmark, executor) { var bookmark = getPersistentBookmark(selection, fillBookmark); executor(bookmark); selection.moveToBookmark(bookmark); }; var NodeValue = function(is3, name2) { var get3 = function(element) { if (!is3(element)) { throw new Error("Can only get " + name2 + " value of a " + name2 + " node"); } return getOption2(element).getOr(""); }; var getOption2 = function(element) { return is3(element) ? Optional.from(element.dom.nodeValue) : Optional.none(); }; var set3 = function(element, value25) { if (!is3(element)) { throw new Error("Can only set raw " + name2 + " value of a " + name2 + " node"); } element.dom.nodeValue = value25; }; return { get: get3, getOption: getOption2, set: set3 }; }; var api$12 = NodeValue(isText$8, "text"); var get$22 = function(element) { return api$12.get(element); }; var isZeroWidth = function(elem) { return isText$8(elem) && get$22(elem) === ZWSP$1; }; var context2 = function(editor, elem, wrapName, nodeName) { return parent2(elem).fold(function() { return "skipping"; }, function(parent3) { if (nodeName === "br" || isZeroWidth(elem)) { return "valid"; } else if (isAnnotation(elem)) { return "existing"; } else if (isCaretNode(elem.dom)) { return "caret"; } else if (!isValid4(editor, wrapName, nodeName) || !isValid4(editor, name(parent3), wrapName)) { return "invalid-child"; } else { return "valid"; } }); }; var applyWordGrab = function(editor, rng) { var r3 = expandRng(editor, rng, [{ inline: "span" }]); rng.setStart(r3.startContainer, r3.startOffset); rng.setEnd(r3.endContainer, r3.endOffset); editor.selection.setRng(rng); }; var makeAnnotation = function(eDoc, _a3, annotationName, decorate) { var _b2 = _a3.uid, uid2 = _b2 === void 0 ? generate2("mce-annotation") : _b2, data66 = __rest2(_a3, ["uid"]); var master = SugarElement.fromTag("span", eDoc); add$12(master, annotation()); set$12(master, "" + dataAnnotationId(), uid2); set$12(master, "" + dataAnnotation(), annotationName); var _c = decorate(uid2, data66), _d = _c.attributes, attributes3 = _d === void 0 ? {} : _d, _e = _c.classes, classes3 = _e === void 0 ? [] : _e; setAll$1(master, attributes3); add3(master, classes3); return master; }; var annotate = function(editor, rng, annotationName, decorate, data66) { var newWrappers = []; var master = makeAnnotation(editor.getDoc(), data66, annotationName, decorate); var wrapper = value24(); var finishWrapper = function() { wrapper.clear(); }; var getOrOpenWrapper = function() { return wrapper.get().getOrThunk(function() { var nu2 = shallow(master); newWrappers.push(nu2); wrapper.set(nu2); return nu2; }); }; var processElements = function(elems) { each$k(elems, processElement); }; var processElement = function(elem) { var ctx = context2(editor, elem, "span", name(elem)); switch (ctx) { case "invalid-child": { finishWrapper(); var children$1 = children(elem); processElements(children$1); finishWrapper(); break; } case "valid": { var w2 = getOrOpenWrapper(); wrap$3(elem, w2); break; } } }; var processNodes = function(nodes2) { var elems = map$3(nodes2, SugarElement.fromDom); processElements(elems); }; walk$2(editor.dom, rng, function(nodes2) { finishWrapper(); processNodes(nodes2); }); return newWrappers; }; var annotateWithBookmark = function(editor, name2, settings, data66) { editor.undoManager.transact(function() { var selection = editor.selection; var initialRng = selection.getRng(); var hasFakeSelection = getCellsFromEditor(editor).length > 0; if (initialRng.collapsed && !hasFakeSelection) { applyWordGrab(editor, initialRng); } if (selection.getRng().collapsed && !hasFakeSelection) { var wrapper = makeAnnotation(editor.getDoc(), data66, name2, settings.decorate); set2(wrapper, nbsp); selection.getRng().insertNode(wrapper.dom); selection.select(wrapper.dom); } else { preserve(selection, false, function() { runOnRanges(editor, function(selectionRng) { annotate(editor, selectionRng, name2, settings.decorate, data66); }); }); } }); }; var Annotator = function(editor) { var registry2 = create$7(); setup$m(editor, registry2); var changes = setup$n(editor); return { register: function(name2, settings) { registry2.register(name2, settings); }, annotate: function(name2, data66) { registry2.lookup(name2).each(function(settings) { annotateWithBookmark(editor, name2, settings, data66); }); }, annotationChanged: function(name2, callback2) { changes.addListener(name2, callback2); }, remove: function(name2) { identify(editor, Optional.some(name2)).each(function(_a3) { var elements = _a3.elements; each$k(elements, unwrap); }); }, getAll: function(name2) { var directory = findAll(editor, name2); return map$2(directory, function(elems) { return map$3(elems, function(elem) { return elem.dom; }); }); } }; }; var BookmarkManager = function(selection) { return { getBookmark: curry(getBookmark$1, selection), moveToBookmark: curry(moveToBookmark, selection) }; }; BookmarkManager.isBookmarkNode = isBookmarkNode$1; var getContentEditableRoot$1 = function(root2, node) { while (node && node !== root2) { if (isContentEditableTrue$4(node) || isContentEditableFalse$b(node)) { return node; } node = node.parentNode; } return null; }; var isXYWithinRange = function(clientX, clientY, range3) { if (range3.collapsed) { return false; } if (Env.browser.isIE() && range3.startOffset === range3.endOffset - 1 && range3.startContainer === range3.endContainer) { var elm = range3.startContainer.childNodes[range3.startOffset]; if (isElement$5(elm)) { return exists(elm.getClientRects(), function(rect) { return containsXY(rect, clientX, clientY); }); } } return exists(range3.getClientRects(), function(rect) { return containsXY(rect, clientX, clientY); }); }; var firePreProcess = function(editor, args) { return editor.fire("PreProcess", args); }; var firePostProcess = function(editor, args) { return editor.fire("PostProcess", args); }; var fireRemove = function(editor) { return editor.fire("remove"); }; var fireDetach = function(editor) { return editor.fire("detach"); }; var fireSwitchMode = function(editor, mode3) { return editor.fire("SwitchMode", { mode: mode3 }); }; var fireObjectResizeStart = function(editor, target, width, height, origin) { editor.fire("ObjectResizeStart", { target, width, height, origin }); }; var fireObjectResized = function(editor, target, width, height, origin) { editor.fire("ObjectResized", { target, width, height, origin }); }; var firePreInit = function(editor) { return editor.fire("PreInit"); }; var firePostRender = function(editor) { return editor.fire("PostRender"); }; var fireInit = function(editor) { return editor.fire("Init"); }; var firePlaceholderToggle = function(editor, state) { return editor.fire("PlaceholderToggle", { state }); }; var fireError = function(editor, errorType, error4) { return editor.fire(errorType, error4); }; var fireFormatApply = function(editor, format3, node, vars) { return editor.fire("FormatApply", { format: format3, node, vars }); }; var fireFormatRemove = function(editor, format3, node, vars) { return editor.fire("FormatRemove", { format: format3, node, vars }); }; var VK = { BACKSPACE: 8, DELETE: 46, DOWN: 40, ENTER: 13, ESC: 27, LEFT: 37, RIGHT: 39, SPACEBAR: 32, TAB: 9, UP: 38, PAGE_UP: 33, PAGE_DOWN: 34, END: 35, HOME: 36, modifierPressed: function(e2) { return e2.shiftKey || e2.ctrlKey || e2.altKey || VK.metaKeyPressed(e2); }, metaKeyPressed: function(e2) { return Env.mac ? e2.metaKey : e2.ctrlKey && !e2.altKey; } }; var isContentEditableFalse$5 = isContentEditableFalse$b; var ControlSelection = function(selection, editor) { var elementSelectionAttr = "data-mce-selected"; var dom2 = editor.dom, each3 = Tools.each; var selectedElm, selectedElmGhost, resizeHelper, selectedHandle, resizeBackdrop; var startX, startY, selectedElmX, selectedElmY, startW, startH, ratio, resizeStarted; var width, height; var editableDoc = editor.getDoc(), rootDocument = document; var abs2 = Math.abs, round3 = Math.round, rootElement = editor.getBody(); var startScrollWidth, startScrollHeight; var resizeHandles = { nw: [ 0, 0, -1, -1 ], ne: [ 1, 0, 1, -1 ], se: [ 1, 1, 1, 1 ], sw: [ 0, 1, -1, 1 ] }; var isImage = function(elm) { return elm && (elm.nodeName === "IMG" || editor.dom.is(elm, "figure.image")); }; var isMedia2 = function(elm) { return isMedia$2(elm) || dom2.hasClass(elm, "mce-preview-object"); }; var isEventOnImageOutsideRange = function(evt, range3) { if (evt.type === "longpress" || evt.type.indexOf("touch") === 0) { var touch = evt.touches[0]; return isImage(evt.target) && !isXYWithinRange(touch.clientX, touch.clientY, range3); } else { return isImage(evt.target) && !isXYWithinRange(evt.clientX, evt.clientY, range3); } }; var contextMenuSelectImage = function(evt) { var target = evt.target; if (isEventOnImageOutsideRange(evt, editor.selection.getRng()) && !evt.isDefaultPrevented()) { editor.selection.select(target); } }; var getResizeTargets = function(elm) { if (dom2.is(elm, "figure.image")) { return [elm.querySelector("img")]; } else if (dom2.hasClass(elm, "mce-preview-object") && isNonNullable(elm.firstElementChild)) { return [ elm, elm.firstElementChild ]; } else { return [elm]; } }; var isResizable = function(elm) { var selector2 = getObjectResizing(editor); if (!selector2) { return false; } if (elm.getAttribute("data-mce-resize") === "false") { return false; } if (elm === editor.getBody()) { return false; } if (dom2.hasClass(elm, "mce-preview-object")) { return is$2(SugarElement.fromDom(elm.firstElementChild), selector2); } else { return is$2(SugarElement.fromDom(elm), selector2); } }; var createGhostElement = function(elm) { if (isMedia2(elm)) { return dom2.create("img", { src: Env.transparentSrc }); } else { return elm.cloneNode(true); } }; var setSizeProp = function(element, name2, value25) { if (isNonNullable(value25)) { var targets = getResizeTargets(element); each$k(targets, function(target) { if (target.style[name2] || !editor.schema.isValid(target.nodeName.toLowerCase(), name2)) { dom2.setStyle(target, name2, value25); } else { dom2.setAttrib(target, name2, "" + value25); } }); } }; var setGhostElmSize = function(ghostElm, width2, height2) { setSizeProp(ghostElm, "width", width2); setSizeProp(ghostElm, "height", height2); }; var resizeGhostElement = function(e2) { var deltaX, deltaY, proportional; var resizeHelperX, resizeHelperY; deltaX = e2.screenX - startX; deltaY = e2.screenY - startY; width = deltaX * selectedHandle[2] + startW; height = deltaY * selectedHandle[3] + startH; width = width < 5 ? 5 : width; height = height < 5 ? 5 : height; if ((isImage(selectedElm) || isMedia2(selectedElm)) && getResizeImgProportional(editor) !== false) { proportional = !VK.modifierPressed(e2); } else { proportional = VK.modifierPressed(e2); } if (proportional) { if (abs2(deltaX) > abs2(deltaY)) { height = round3(width * ratio); width = round3(height / ratio); } else { width = round3(height / ratio); height = round3(width * ratio); } } setGhostElmSize(selectedElmGhost, width, height); resizeHelperX = selectedHandle.startPos.x + deltaX; resizeHelperY = selectedHandle.startPos.y + deltaY; resizeHelperX = resizeHelperX > 0 ? resizeHelperX : 0; resizeHelperY = resizeHelperY > 0 ? resizeHelperY : 0; dom2.setStyles(resizeHelper, { left: resizeHelperX, top: resizeHelperY, display: "block" }); resizeHelper.innerHTML = width + " × " + height; if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) { dom2.setStyle(selectedElmGhost, "left", selectedElmX + (startW - width)); } if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) { dom2.setStyle(selectedElmGhost, "top", selectedElmY + (startH - height)); } deltaX = rootElement.scrollWidth - startScrollWidth; deltaY = rootElement.scrollHeight - startScrollHeight; if (deltaX + deltaY !== 0) { dom2.setStyles(resizeHelper, { left: resizeHelperX - deltaX, top: resizeHelperY - deltaY }); } if (!resizeStarted) { fireObjectResizeStart(editor, selectedElm, startW, startH, "corner-" + selectedHandle.name); resizeStarted = true; } }; var endGhostResize = function() { var wasResizeStarted = resizeStarted; resizeStarted = false; if (wasResizeStarted) { setSizeProp(selectedElm, "width", width); setSizeProp(selectedElm, "height", height); } dom2.unbind(editableDoc, "mousemove", resizeGhostElement); dom2.unbind(editableDoc, "mouseup", endGhostResize); if (rootDocument !== editableDoc) { dom2.unbind(rootDocument, "mousemove", resizeGhostElement); dom2.unbind(rootDocument, "mouseup", endGhostResize); } dom2.remove(selectedElmGhost); dom2.remove(resizeHelper); dom2.remove(resizeBackdrop); showResizeRect(selectedElm); if (wasResizeStarted) { fireObjectResized(editor, selectedElm, width, height, "corner-" + selectedHandle.name); dom2.setAttrib(selectedElm, "style", dom2.getAttrib(selectedElm, "style")); } editor.nodeChanged(); }; var showResizeRect = function(targetElm) { unbindResizeHandleEvents(); var position2 = dom2.getPos(targetElm, rootElement); var selectedElmX2 = position2.x; var selectedElmY2 = position2.y; var rect = targetElm.getBoundingClientRect(); var targetWidth = rect.width || rect.right - rect.left; var targetHeight = rect.height || rect.bottom - rect.top; if (selectedElm !== targetElm) { hideResizeRect(); selectedElm = targetElm; width = height = 0; } var e2 = editor.fire("ObjectSelected", { target: targetElm }); var selectedValue5 = dom2.getAttrib(selectedElm, elementSelectionAttr, "1"); if (isResizable(targetElm) && !e2.isDefaultPrevented()) { each3(resizeHandles, function(handle2, name2) { var handleElm; var startDrag = function(e3) { var target = getResizeTargets(selectedElm)[0]; startX = e3.screenX; startY = e3.screenY; startW = target.clientWidth; startH = target.clientHeight; ratio = startH / startW; selectedHandle = handle2; selectedHandle.name = name2; selectedHandle.startPos = { x: targetWidth * handle2[0] + selectedElmX2, y: targetHeight * handle2[1] + selectedElmY2 }; startScrollWidth = rootElement.scrollWidth; startScrollHeight = rootElement.scrollHeight; resizeBackdrop = dom2.add(rootElement, "div", { "class": "mce-resize-backdrop", "data-mce-bogus": "all" }); dom2.setStyles(resizeBackdrop, { position: "fixed", left: "0", top: "0", width: "100%", height: "100%" }); selectedElmGhost = createGhostElement(selectedElm); dom2.addClass(selectedElmGhost, "mce-clonedresizable"); dom2.setAttrib(selectedElmGhost, "data-mce-bogus", "all"); selectedElmGhost.contentEditable = "false"; dom2.setStyles(selectedElmGhost, { left: selectedElmX2, top: selectedElmY2, margin: 0 }); setGhostElmSize(selectedElmGhost, targetWidth, targetHeight); selectedElmGhost.removeAttribute(elementSelectionAttr); rootElement.appendChild(selectedElmGhost); dom2.bind(editableDoc, "mousemove", resizeGhostElement); dom2.bind(editableDoc, "mouseup", endGhostResize); if (rootDocument !== editableDoc) { dom2.bind(rootDocument, "mousemove", resizeGhostElement); dom2.bind(rootDocument, "mouseup", endGhostResize); } resizeHelper = dom2.add(rootElement, "div", { "class": "mce-resize-helper", "data-mce-bogus": "all" }, startW + " × " + startH); }; handleElm = dom2.get("mceResizeHandle" + name2); if (handleElm) { dom2.remove(handleElm); } handleElm = dom2.add(rootElement, "div", { "id": "mceResizeHandle" + name2, "data-mce-bogus": "all", "class": "mce-resizehandle", "unselectable": true, "style": "cursor:" + name2 + "-resize; margin:0; padding:0" }); if (Env.ie === 11) { handleElm.contentEditable = false; } dom2.bind(handleElm, "mousedown", function(e3) { e3.stopImmediatePropagation(); e3.preventDefault(); startDrag(e3); }); handle2.elm = handleElm; dom2.setStyles(handleElm, { left: targetWidth * handle2[0] + selectedElmX2 - handleElm.offsetWidth / 2, top: targetHeight * handle2[1] + selectedElmY2 - handleElm.offsetHeight / 2 }); }); } else { hideResizeRect(); } if (!dom2.getAttrib(selectedElm, elementSelectionAttr)) { selectedElm.setAttribute(elementSelectionAttr, selectedValue5); } }; var hideResizeRect = function() { unbindResizeHandleEvents(); if (selectedElm) { selectedElm.removeAttribute(elementSelectionAttr); } each$j(resizeHandles, function(value25, name2) { var handleElm = dom2.get("mceResizeHandle" + name2); if (handleElm) { dom2.unbind(handleElm); dom2.remove(handleElm); } }); }; var updateResizeRect = function(e2) { var startElm, controlElm; var isChildOrEqual = function(node, parent3) { if (node) { do { if (node === parent3) { return true; } } while (node = node.parentNode); } }; if (resizeStarted || editor.removed) { return; } each3(dom2.select("img[data-mce-selected],hr[data-mce-selected]"), function(img) { img.removeAttribute(elementSelectionAttr); }); controlElm = e2.type === "mousedown" ? e2.target : selection.getNode(); controlElm = dom2.$(controlElm).closest("table,img,figure.image,hr,video,span.mce-preview-object")[0]; if (isChildOrEqual(controlElm, rootElement)) { disableGeckoResize(); startElm = selection.getStart(true); if (isChildOrEqual(startElm, controlElm) && isChildOrEqual(selection.getEnd(true), controlElm)) { showResizeRect(controlElm); return; } } hideResizeRect(); }; var isWithinContentEditableFalse = function(elm) { return isContentEditableFalse$5(getContentEditableRoot$1(editor.getBody(), elm)); }; var unbindResizeHandleEvents = function() { each$j(resizeHandles, function(handle2) { if (handle2.elm) { dom2.unbind(handle2.elm); delete handle2.elm; } }); }; var disableGeckoResize = function() { try { editor.getDoc().execCommand("enableObjectResizing", false, "false"); } catch (ex) { } }; editor.on("init", function() { disableGeckoResize(); if (Env.browser.isIE() || Env.browser.isEdge()) { editor.on("mousedown click", function(e2) { var target = e2.target, nodeName = target.nodeName; if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName) && !isWithinContentEditableFalse(target)) { if (e2.button !== 2) { editor.selection.select(target, nodeName === "TABLE"); } if (e2.type === "mousedown") { editor.nodeChanged(); } } }); var handleMSControlSelect_1 = function(e2) { var delayedSelect = function(node) { Delay.setEditorTimeout(editor, function() { return editor.selection.select(node); }); }; if (isWithinContentEditableFalse(e2.target) || isMedia$2(e2.target)) { e2.preventDefault(); delayedSelect(e2.target); return; } if (/^(TABLE|IMG|HR)$/.test(e2.target.nodeName)) { e2.preventDefault(); if (e2.target.tagName === "IMG") { delayedSelect(e2.target); } } }; dom2.bind(rootElement, "mscontrolselect", handleMSControlSelect_1); editor.on("remove", function() { return dom2.unbind(rootElement, "mscontrolselect", handleMSControlSelect_1); }); } var throttledUpdateResizeRect = Delay.throttle(function(e2) { if (!editor.composing) { updateResizeRect(e2); } }); editor.on("NodeChange ResizeEditor ResizeWindow ResizeContent drop", throttledUpdateResizeRect); editor.on("keyup compositionend", function(e2) { if (selectedElm && selectedElm.nodeName === "TABLE") { throttledUpdateResizeRect(e2); } }); editor.on("hide blur", hideResizeRect); editor.on("contextmenu longpress", contextMenuSelectImage, true); }); editor.on("remove", unbindResizeHandleEvents); var destroy4 = function() { selectedElm = selectedElmGhost = resizeBackdrop = null; }; return { isResizable, showResizeRect, hideResizeRect, updateResizeRect, destroy: destroy4 }; }; var hasCeProperty = function(node) { return isContentEditableTrue$4(node) || isContentEditableFalse$b(node); }; var findParent$1 = function(node, rootNode, predicate) { while (node && node !== rootNode) { if (predicate(node)) { return node; } node = node.parentNode; } return null; }; var findClosestIeRange = function(clientX, clientY, doc2) { var rects; var element = doc2.elementFromPoint(clientX, clientY); var rng = doc2.body.createTextRange(); if (!element || element.tagName === "HTML") { element = doc2.body; } rng.moveToElementText(element); rects = Tools.toArray(rng.getClientRects()); rects = rects.sort(function(a2, b2) { a2 = Math.abs(Math.max(a2.top - clientY, a2.bottom - clientY)); b2 = Math.abs(Math.max(b2.top - clientY, b2.bottom - clientY)); return a2 - b2; }); if (rects.length > 0) { clientY = (rects[0].bottom + rects[0].top) / 2; try { rng.moveToPoint(clientX, clientY); rng.collapse(true); return rng; } catch (ex) { } } return null; }; var moveOutOfContentEditableFalse = function(rng, rootNode) { var parentElement = rng && rng.parentElement ? rng.parentElement() : null; return isContentEditableFalse$b(findParent$1(parentElement, rootNode, hasCeProperty)) ? null : rng; }; var fromPoint = function(clientX, clientY, doc2) { var rng, point; var pointDoc = doc2; if (pointDoc.caretPositionFromPoint) { point = pointDoc.caretPositionFromPoint(clientX, clientY); if (point) { rng = doc2.createRange(); rng.setStart(point.offsetNode, point.offset); rng.collapse(true); } } else if (pointDoc.caretRangeFromPoint) { rng = pointDoc.caretRangeFromPoint(clientX, clientY); } else if (pointDoc.body.createTextRange) { rng = pointDoc.body.createTextRange(); try { rng.moveToPoint(clientX, clientY); rng.collapse(true); } catch (ex) { rng = findClosestIeRange(clientX, clientY, doc2); } return moveOutOfContentEditableFalse(rng, doc2.body); } return rng; }; var isEq$4 = function(rng1, rng2) { return rng1 && rng2 && (rng1.startContainer === rng2.startContainer && rng1.startOffset === rng2.startOffset) && (rng1.endContainer === rng2.endContainer && rng1.endOffset === rng2.endOffset); }; var findParent = function(node, rootNode, predicate) { while (node && node !== rootNode) { if (predicate(node)) { return node; } node = node.parentNode; } return null; }; var hasParent$1 = function(node, rootNode, predicate) { return findParent(node, rootNode, predicate) !== null; }; var hasParentWithName = function(node, rootNode, name2) { return hasParent$1(node, rootNode, function(node2) { return node2.nodeName === name2; }); }; var isTable = function(node) { return node && node.nodeName === "TABLE"; }; var isTableCell$2 = function(node) { return node && /^(TD|TH|CAPTION)$/.test(node.nodeName); }; var isCeFalseCaretContainer = function(node, rootNode) { return isCaretContainer$2(node) && hasParent$1(node, rootNode, isCaretNode) === false; }; var hasBrBeforeAfter = function(dom2, node, left) { var walker = new DomTreeWalker(node, dom2.getParent(node.parentNode, dom2.isBlock) || dom2.getRoot()); while (node = walker[left ? "prev" : "next"]()) { if (isBr$5(node)) { return true; } } }; var isPrevNode = function(node, name2) { return node.previousSibling && node.previousSibling.nodeName === name2; }; var hasContentEditableFalseParent = function(body, node) { while (node && node !== body) { if (isContentEditableFalse$b(node)) { return true; } node = node.parentNode; } return false; }; var findTextNodeRelative = function(dom2, isAfterNode, collapsed, left, startNode) { var lastInlineElement; var body = dom2.getRoot(); var node; var nonEmptyElementsMap = dom2.schema.getNonEmptyElements(); var parentBlockContainer = dom2.getParent(startNode.parentNode, dom2.isBlock) || body; if (left && isBr$5(startNode) && isAfterNode && dom2.isEmpty(parentBlockContainer)) { return Optional.some(CaretPosition(startNode.parentNode, dom2.nodeIndex(startNode))); } var walker = new DomTreeWalker(startNode, parentBlockContainer); while (node = walker[left ? "prev" : "next"]()) { if (dom2.getContentEditableParent(node) === "false" || isCeFalseCaretContainer(node, body)) { return Optional.none(); } if (isText$7(node) && node.nodeValue.length > 0) { if (hasParentWithName(node, body, "A") === false) { return Optional.some(CaretPosition(node, left ? node.nodeValue.length : 0)); } return Optional.none(); } if (dom2.isBlock(node) || nonEmptyElementsMap[node.nodeName.toLowerCase()]) { return Optional.none(); } lastInlineElement = node; } if (collapsed && lastInlineElement) { return Optional.some(CaretPosition(lastInlineElement, 0)); } return Optional.none(); }; var normalizeEndPoint = function(dom2, collapsed, start2, rng) { var container, offset4; var body = dom2.getRoot(); var node; var directionLeft, normalized = false; container = rng[(start2 ? "start" : "end") + "Container"]; offset4 = rng[(start2 ? "start" : "end") + "Offset"]; var isAfterNode = isElement$5(container) && offset4 === container.childNodes.length; var nonEmptyElementsMap = dom2.schema.getNonEmptyElements(); directionLeft = start2; if (isCaretContainer$2(container)) { return Optional.none(); } if (isElement$5(container) && offset4 > container.childNodes.length - 1) { directionLeft = false; } if (isDocument$1(container)) { container = body; offset4 = 0; } if (container === body) { if (directionLeft) { node = container.childNodes[offset4 > 0 ? offset4 - 1 : 0]; if (node) { if (isCaretContainer$2(node)) { return Optional.none(); } if (nonEmptyElementsMap[node.nodeName] || isTable(node)) { return Optional.none(); } } } if (container.hasChildNodes()) { offset4 = Math.min(!directionLeft && offset4 > 0 ? offset4 - 1 : offset4, container.childNodes.length - 1); container = container.childNodes[offset4]; offset4 = isText$7(container) && isAfterNode ? container.data.length : 0; if (!collapsed && container === body.lastChild && isTable(container)) { return Optional.none(); } if (hasContentEditableFalseParent(body, container) || isCaretContainer$2(container)) { return Optional.none(); } if (container.hasChildNodes() && isTable(container) === false) { node = container; var walker = new DomTreeWalker(container, body); do { if (isContentEditableFalse$b(node) || isCaretContainer$2(node)) { normalized = false; break; } if (isText$7(node) && node.nodeValue.length > 0) { offset4 = directionLeft ? 0 : node.nodeValue.length; container = node; normalized = true; break; } if (nonEmptyElementsMap[node.nodeName.toLowerCase()] && !isTableCell$2(node)) { offset4 = dom2.nodeIndex(node); container = node.parentNode; if (!directionLeft) { offset4++; } normalized = true; break; } } while (node = directionLeft ? walker.next() : walker.prev()); } } } if (collapsed) { if (isText$7(container) && offset4 === 0) { findTextNodeRelative(dom2, isAfterNode, collapsed, true, container).each(function(pos) { container = pos.container(); offset4 = pos.offset(); normalized = true; }); } if (isElement$5(container)) { node = container.childNodes[offset4]; if (!node) { node = container.childNodes[offset4 - 1]; } if (node && isBr$5(node) && !isPrevNode(node, "A") && !hasBrBeforeAfter(dom2, node, false) && !hasBrBeforeAfter(dom2, node, true)) { findTextNodeRelative(dom2, isAfterNode, collapsed, true, node).each(function(pos) { container = pos.container(); offset4 = pos.offset(); normalized = true; }); } } } if (directionLeft && !collapsed && isText$7(container) && offset4 === container.nodeValue.length) { findTextNodeRelative(dom2, isAfterNode, collapsed, false, container).each(function(pos) { container = pos.container(); offset4 = pos.offset(); normalized = true; }); } return normalized ? Optional.some(CaretPosition(container, offset4)) : Optional.none(); }; var normalize$2 = function(dom2, rng) { var collapsed = rng.collapsed, normRng = rng.cloneRange(); var startPos = CaretPosition.fromRangeStart(rng); normalizeEndPoint(dom2, collapsed, true, normRng).each(function(pos) { if (!collapsed || !CaretPosition.isAbove(startPos, pos)) { normRng.setStart(pos.container(), pos.offset()); } }); if (!collapsed) { normalizeEndPoint(dom2, collapsed, false, normRng).each(function(pos) { normRng.setEnd(pos.container(), pos.offset()); }); } if (collapsed) { normRng.collapse(true); } return isEq$4(rng, normRng) ? Optional.none() : Optional.some(normRng); }; var splitText = function(node, offset4) { return node.splitText(offset4); }; var split2 = function(rng) { var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset; if (startContainer === endContainer && isText$7(startContainer)) { if (startOffset > 0 && startOffset < startContainer.nodeValue.length) { endContainer = splitText(startContainer, startOffset); startContainer = endContainer.previousSibling; if (endOffset > startOffset) { endOffset = endOffset - startOffset; startContainer = endContainer = splitText(endContainer, endOffset).previousSibling; endOffset = endContainer.nodeValue.length; startOffset = 0; } else { endOffset = 0; } } } else { if (isText$7(startContainer) && startOffset > 0 && startOffset < startContainer.nodeValue.length) { startContainer = splitText(startContainer, startOffset); startOffset = 0; } if (isText$7(endContainer) && endOffset > 0 && endOffset < endContainer.nodeValue.length) { endContainer = splitText(endContainer, endOffset).previousSibling; endOffset = endContainer.nodeValue.length; } } return { startContainer, startOffset, endContainer, endOffset }; }; var RangeUtils = function(dom2) { var walk2 = function(rng, callback2) { return walk$2(dom2, rng, callback2); }; var split$12 = split2; var normalize3 = function(rng) { return normalize$2(dom2, rng).fold(never, function(normalizedRng) { rng.setStart(normalizedRng.startContainer, normalizedRng.startOffset); rng.setEnd(normalizedRng.endContainer, normalizedRng.endOffset); return true; }); }; return { walk: walk2, split: split$12, normalize: normalize3 }; }; RangeUtils.compareRanges = isEq$4; RangeUtils.getCaretRangeFromPoint = fromPoint; RangeUtils.getSelectedNode = getSelectedNode; RangeUtils.getNode = getNode$1; var Dimension = function(name2, getOffset2) { var set3 = function(element, h2) { if (!isNumber2(h2) && !h2.match(/^[0-9]+$/)) { throw new Error(name2 + ".set accepts only positive integer values. Value was " + h2); } var dom2 = element.dom; if (isSupported(dom2)) { dom2.style[name2] = h2 + "px"; } }; var get3 = function(element) { var r3 = getOffset2(element); if (r3 <= 0 || r3 === null) { var css2 = get$5(element, name2); return parseFloat(css2) || 0; } return r3; }; var getOuter = get3; var aggregate = function(element, properties) { return foldl(properties, function(acc, property2) { var val = get$5(element, property2); var value25 = val === void 0 ? 0 : parseInt(val, 10); return isNaN(value25) ? acc : acc + value25; }, 0); }; var max5 = function(element, value25, properties) { var cumulativeInclusions = aggregate(element, properties); var absoluteMax = value25 > cumulativeInclusions ? value25 - cumulativeInclusions : 0; return absoluteMax; }; return { set: set3, get: get3, getOuter, aggregate, max: max5 }; }; var api2 = Dimension("height", function(element) { var dom2 = element.dom; return inBody(element) ? dom2.getBoundingClientRect().height : dom2.offsetHeight; }); var get$12 = function(element) { return api2.get(element); }; var walkUp = function(navigation, doc2) { var frame = navigation.view(doc2); return frame.fold(constant2([]), function(f2) { var parent3 = navigation.owner(f2); var rest = walkUp(navigation, parent3); return [f2].concat(rest); }); }; var pathTo = function(element, navigation) { var d2 = navigation.owner(element); return walkUp(navigation, d2); }; var view = function(doc2) { var _a3; var element = doc2.dom === document ? Optional.none() : Optional.from((_a3 = doc2.dom.defaultView) === null || _a3 === void 0 ? void 0 : _a3.frameElement); return element.map(SugarElement.fromDom); }; var owner = function(element) { return documentOrOwner(element); }; var Navigation = /* @__PURE__ */ Object.freeze({ __proto__: null, view, owner }); var find$12 = function(element) { var doc2 = SugarElement.fromDom(document); var scroll = get$8(doc2); var frames = pathTo(element, Navigation); var offset4 = viewport(element); var r3 = foldr(frames, function(b2, a2) { var loc = viewport(a2); return { left: b2.left + loc.left, top: b2.top + loc.top }; }, { left: 0, top: 0 }); return SugarPosition(r3.left + offset4.left + scroll.left, r3.top + offset4.top + scroll.top); }; var excludeFromDescend = function(element) { return name(element) === "textarea"; }; var fireScrollIntoViewEvent = function(editor, data66) { var scrollEvent = editor.fire("ScrollIntoView", data66); return scrollEvent.isDefaultPrevented(); }; var fireAfterScrollIntoViewEvent = function(editor, data66) { editor.fire("AfterScrollIntoView", data66); }; var descend = function(element, offset4) { var children$1 = children(element); if (children$1.length === 0 || excludeFromDescend(element)) { return { element, offset: offset4 }; } else if (offset4 < children$1.length && !excludeFromDescend(children$1[offset4])) { return { element: children$1[offset4], offset: 0 }; } else { var last3 = children$1[children$1.length - 1]; if (excludeFromDescend(last3)) { return { element, offset: offset4 }; } else { if (name(last3) === "img") { return { element: last3, offset: 1 }; } else if (isText$8(last3)) { return { element: last3, offset: get$22(last3).length }; } else { return { element: last3, offset: children(last3).length }; } } } }; var markerInfo = function(element, cleanupFun) { var pos = absolute(element); var height = get$12(element); return { element, bottom: pos.top + height, height, pos, cleanup: cleanupFun }; }; var createMarker = function(element, offset4) { var startPoint = descend(element, offset4); var span = SugarElement.fromHtml('' + ZWSP$1 + ""); before$4(startPoint.element, span); return markerInfo(span, function() { return remove$7(span); }); }; var elementMarker = function(element) { return markerInfo(SugarElement.fromDom(element), noop2); }; var withMarker = function(editor, f2, rng, alignToTop) { preserveWith(editor, function(_s, _e) { return applyWithMarker(editor, f2, rng, alignToTop); }, rng); }; var withScrollEvents = function(editor, doc2, f2, marker, alignToTop) { var data66 = { elm: marker.element.dom, alignToTop }; if (fireScrollIntoViewEvent(editor, data66)) { return; } var scrollTop2 = get$8(doc2).top; f2(doc2, scrollTop2, marker, alignToTop); fireAfterScrollIntoViewEvent(editor, data66); }; var applyWithMarker = function(editor, f2, rng, alignToTop) { var body = SugarElement.fromDom(editor.getBody()); var doc2 = SugarElement.fromDom(editor.getDoc()); reflow(body); var marker = createMarker(SugarElement.fromDom(rng.startContainer), rng.startOffset); withScrollEvents(editor, doc2, f2, marker, alignToTop); marker.cleanup(); }; var withElement = function(editor, element, f2, alignToTop) { var doc2 = SugarElement.fromDom(editor.getDoc()); withScrollEvents(editor, doc2, f2, elementMarker(element), alignToTop); }; var preserveWith = function(editor, f2, rng) { var startElement = rng.startContainer; var startOffset = rng.startOffset; var endElement = rng.endContainer; var endOffset = rng.endOffset; f2(SugarElement.fromDom(startElement), SugarElement.fromDom(endElement)); var newRng = editor.dom.createRng(); newRng.setStart(startElement, startOffset); newRng.setEnd(endElement, endOffset); editor.selection.setRng(rng); }; var scrollToMarker = function(marker, viewHeight, alignToTop, doc2) { var pos = marker.pos; if (alignToTop) { to2(pos.left, pos.top, doc2); } else { var y2 = pos.top - viewHeight + marker.height; to2(pos.left, y2, doc2); } }; var intoWindowIfNeeded = function(doc2, scrollTop2, viewHeight, marker, alignToTop) { var viewportBottom = viewHeight + scrollTop2; var markerTop = marker.pos.top; var markerBottom = marker.bottom; var largerThanViewport = markerBottom - markerTop >= viewHeight; if (markerTop < scrollTop2) { scrollToMarker(marker, viewHeight, alignToTop !== false, doc2); } else if (markerTop > viewportBottom) { var align = largerThanViewport ? alignToTop !== false : alignToTop === true; scrollToMarker(marker, viewHeight, align, doc2); } else if (markerBottom > viewportBottom && !largerThanViewport) { scrollToMarker(marker, viewHeight, alignToTop === true, doc2); } }; var intoWindow = function(doc2, scrollTop2, marker, alignToTop) { var viewHeight = doc2.dom.defaultView.innerHeight; intoWindowIfNeeded(doc2, scrollTop2, viewHeight, marker, alignToTop); }; var intoFrame = function(doc2, scrollTop2, marker, alignToTop) { var frameViewHeight = doc2.dom.defaultView.innerHeight; intoWindowIfNeeded(doc2, scrollTop2, frameViewHeight, marker, alignToTop); var op = find$12(marker.element); var viewportBounds = getBounds(window); if (op.top < viewportBounds.y) { intoView(marker.element, alignToTop !== false); } else if (op.top > viewportBounds.bottom) { intoView(marker.element, alignToTop === true); } }; var rangeIntoWindow = function(editor, rng, alignToTop) { return withMarker(editor, intoWindow, rng, alignToTop); }; var elementIntoWindow = function(editor, element, alignToTop) { return withElement(editor, element, intoWindow, alignToTop); }; var rangeIntoFrame = function(editor, rng, alignToTop) { return withMarker(editor, intoFrame, rng, alignToTop); }; var elementIntoFrame = function(editor, element, alignToTop) { return withElement(editor, element, intoFrame, alignToTop); }; var scrollElementIntoView = function(editor, element, alignToTop) { var scroller = editor.inline ? elementIntoWindow : elementIntoFrame; scroller(editor, element, alignToTop); }; var scrollRangeIntoView = function(editor, rng, alignToTop) { var scroller = editor.inline ? rangeIntoWindow : rangeIntoFrame; scroller(editor, rng, alignToTop); }; var getDocument2 = function() { return SugarElement.fromDom(document); }; var focus$1 = function(element) { return element.dom.focus(); }; var hasFocus$1 = function(element) { var root2 = getRootNode(element).dom; return element.dom === root2.activeElement; }; var active = function(root2) { if (root2 === void 0) { root2 = getDocument2(); } return Optional.from(root2.dom.activeElement).map(SugarElement.fromDom); }; var search = function(element) { return active(getRootNode(element)).filter(function(e2) { return element.dom.contains(e2.dom); }); }; var create$5 = function(start2, soffset, finish, foffset) { return { start: start2, soffset, finish, foffset }; }; var SimRange = { create: create$5 }; var adt$1 = Adt.generate([ { before: ["element"] }, { on: [ "element", "offset" ] }, { after: ["element"] } ]); var cata = function(subject, onBefore, onOn, onAfter) { return subject.fold(onBefore, onOn, onAfter); }; var getStart$2 = function(situ) { return situ.fold(identity2, identity2, identity2); }; var before$1 = adt$1.before; var on2 = adt$1.on; var after$1 = adt$1.after; var Situ = { before: before$1, on: on2, after: after$1, cata, getStart: getStart$2 }; var adt = Adt.generate([ { domRange: ["rng"] }, { relative: [ "startSitu", "finishSitu" ] }, { exact: [ "start", "soffset", "finish", "foffset" ] } ]); var exactFromRange = function(simRange) { return adt.exact(simRange.start, simRange.soffset, simRange.finish, simRange.foffset); }; var getStart$1 = function(selection) { return selection.match({ domRange: function(rng) { return SugarElement.fromDom(rng.startContainer); }, relative: function(startSitu, _finishSitu) { return Situ.getStart(startSitu); }, exact: function(start2, _soffset, _finish, _foffset) { return start2; } }); }; var domRange = adt.domRange; var relative = adt.relative; var exact = adt.exact; var getWin = function(selection) { var start2 = getStart$1(selection); return defaultView(start2); }; var range2 = SimRange.create; var SimSelection = { domRange, relative, exact, exactFromRange, getWin, range: range2 }; var browser$1 = detect().browser; var clamp$1 = function(offset4, element) { var max5 = isText$8(element) ? get$22(element).length : children(element).length + 1; if (offset4 > max5) { return max5; } else if (offset4 < 0) { return 0; } return offset4; }; var normalizeRng = function(rng) { return SimSelection.range(rng.start, clamp$1(rng.soffset, rng.start), rng.finish, clamp$1(rng.foffset, rng.finish)); }; var isOrContains = function(root2, elm) { return !isRestrictedNode(elm.dom) && (contains$1(root2, elm) || eq2(root2, elm)); }; var isRngInRoot = function(root2) { return function(rng) { return isOrContains(root2, rng.start) && isOrContains(root2, rng.finish); }; }; var shouldStore = function(editor) { return editor.inline === true || browser$1.isIE(); }; var nativeRangeToSelectionRange = function(r3) { return SimSelection.range(SugarElement.fromDom(r3.startContainer), r3.startOffset, SugarElement.fromDom(r3.endContainer), r3.endOffset); }; var readRange = function(win) { var selection = win.getSelection(); var rng = !selection || selection.rangeCount === 0 ? Optional.none() : Optional.from(selection.getRangeAt(0)); return rng.map(nativeRangeToSelectionRange); }; var getBookmark = function(root2) { var win = defaultView(root2); return readRange(win.dom).filter(isRngInRoot(root2)); }; var validate3 = function(root2, bookmark) { return Optional.from(bookmark).filter(isRngInRoot(root2)).map(normalizeRng); }; var bookmarkToNativeRng = function(bookmark) { var rng = document.createRange(); try { rng.setStart(bookmark.start.dom, bookmark.soffset); rng.setEnd(bookmark.finish.dom, bookmark.foffset); return Optional.some(rng); } catch (_2) { return Optional.none(); } }; var store = function(editor) { var newBookmark = shouldStore(editor) ? getBookmark(SugarElement.fromDom(editor.getBody())) : Optional.none(); editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark; }; var storeNative = function(editor, rng) { var root2 = SugarElement.fromDom(editor.getBody()); var range3 = shouldStore(editor) ? Optional.from(rng) : Optional.none(); var newBookmark = range3.map(nativeRangeToSelectionRange).filter(isRngInRoot(root2)); editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark; }; var getRng = function(editor) { var bookmark = editor.bookmark ? editor.bookmark : Optional.none(); return bookmark.bind(function(x2) { return validate3(SugarElement.fromDom(editor.getBody()), x2); }).bind(bookmarkToNativeRng); }; var restore = function(editor) { getRng(editor).each(function(rng) { return editor.selection.setRng(rng); }); }; var isEditorUIElement$1 = function(elm) { var className = elm.className.toString(); return className.indexOf("tox-") !== -1 || className.indexOf("mce-") !== -1; }; var FocusManager = { isEditorUIElement: isEditorUIElement$1 }; var isManualNodeChange = function(e2) { return e2.type === "nodechange" && e2.selectionChange; }; var registerPageMouseUp = function(editor, throttledStore) { var mouseUpPage = function() { throttledStore.throttle(); }; DOMUtils.DOM.bind(document, "mouseup", mouseUpPage); editor.on("remove", function() { DOMUtils.DOM.unbind(document, "mouseup", mouseUpPage); }); }; var registerFocusOut = function(editor) { editor.on("focusout", function() { store(editor); }); }; var registerMouseUp = function(editor, throttledStore) { editor.on("mouseup touchend", function(_e) { throttledStore.throttle(); }); }; var registerEditorEvents = function(editor, throttledStore) { var browser2 = detect().browser; if (browser2.isIE()) { registerFocusOut(editor); } else { registerMouseUp(editor, throttledStore); } editor.on("keyup NodeChange", function(e2) { if (!isManualNodeChange(e2)) { store(editor); } }); }; var register$3 = function(editor) { var throttledStore = first(function() { store(editor); }, 0); editor.on("init", function() { if (editor.inline) { registerPageMouseUp(editor, throttledStore); } registerEditorEvents(editor, throttledStore); }); editor.on("remove", function() { throttledStore.cancel(); }); }; var documentFocusInHandler; var DOM$8 = DOMUtils.DOM; var isEditorUIElement = function(elm) { return FocusManager.isEditorUIElement(elm); }; var isEditorContentAreaElement = function(elm) { var classList = elm.classList; if (classList !== void 0) { return classList.contains("tox-edit-area") || classList.contains("tox-edit-area__iframe") || classList.contains("mce-content-body"); } else { return false; } }; var isUIElement = function(editor, elm) { var customSelector = getCustomUiSelector(editor); var parent3 = DOM$8.getParent(elm, function(elm2) { return isEditorUIElement(elm2) || (customSelector ? editor.dom.is(elm2, customSelector) : false); }); return parent3 !== null; }; var getActiveElement = function(editor) { try { var root2 = getRootNode(SugarElement.fromDom(editor.getElement())); return active(root2).fold(function() { return document.body; }, function(x2) { return x2.dom; }); } catch (ex) { return document.body; } }; var registerEvents$1 = function(editorManager, e2) { var editor = e2.editor; register$3(editor); editor.on("focusin", function() { var focusedEditor = editorManager.focusedEditor; if (focusedEditor !== editor) { if (focusedEditor) { focusedEditor.fire("blur", { focusedEditor: editor }); } editorManager.setActive(editor); editorManager.focusedEditor = editor; editor.fire("focus", { blurredEditor: focusedEditor }); editor.focus(true); } }); editor.on("focusout", function() { Delay.setEditorTimeout(editor, function() { var focusedEditor = editorManager.focusedEditor; if (!isUIElement(editor, getActiveElement(editor)) && focusedEditor === editor) { editor.fire("blur", { focusedEditor: null }); editorManager.focusedEditor = null; } }); }); if (!documentFocusInHandler) { documentFocusInHandler = function(e3) { var activeEditor = editorManager.activeEditor; if (activeEditor) { getOriginalEventTarget(e3).each(function(target) { if (target.ownerDocument === document) { if (target !== document.body && !isUIElement(activeEditor, target) && editorManager.focusedEditor === activeEditor) { activeEditor.fire("blur", { focusedEditor: null }); editorManager.focusedEditor = null; } } }); } }; DOM$8.bind(document, "focusin", documentFocusInHandler); } }; var unregisterDocumentEvents = function(editorManager, e2) { if (editorManager.focusedEditor === e2.editor) { editorManager.focusedEditor = null; } if (!editorManager.activeEditor) { DOM$8.unbind(document, "focusin", documentFocusInHandler); documentFocusInHandler = null; } }; var setup$l = function(editorManager) { editorManager.on("AddEditor", curry(registerEvents$1, editorManager)); editorManager.on("RemoveEditor", curry(unregisterDocumentEvents, editorManager)); }; var getContentEditableHost = function(editor, node) { return editor.dom.getParent(node, function(node2) { return editor.dom.getContentEditable(node2) === "true"; }); }; var getCollapsedNode = function(rng) { return rng.collapsed ? Optional.from(getNode$1(rng.startContainer, rng.startOffset)).map(SugarElement.fromDom) : Optional.none(); }; var getFocusInElement = function(root2, rng) { return getCollapsedNode(rng).bind(function(node) { if (isTableSection(node)) { return Optional.some(node); } else if (contains$1(root2, node) === false) { return Optional.some(root2); } else { return Optional.none(); } }); }; var normalizeSelection$1 = function(editor, rng) { getFocusInElement(SugarElement.fromDom(editor.getBody()), rng).bind(function(elm) { return firstPositionIn(elm.dom); }).fold(function() { editor.selection.normalize(); return; }, function(caretPos) { return editor.selection.setRng(caretPos.toRange()); }); }; var focusBody = function(body) { if (body.setActive) { try { body.setActive(); } catch (ex) { body.focus(); } } else { body.focus(); } }; var hasElementFocus = function(elm) { return hasFocus$1(elm) || search(elm).isSome(); }; var hasIframeFocus = function(editor) { return editor.iframeElement && hasFocus$1(SugarElement.fromDom(editor.iframeElement)); }; var hasInlineFocus = function(editor) { var rawBody = editor.getBody(); return rawBody && hasElementFocus(SugarElement.fromDom(rawBody)); }; var hasUiFocus = function(editor) { var dos = getRootNode(SugarElement.fromDom(editor.getElement())); return active(dos).filter(function(elem) { return !isEditorContentAreaElement(elem.dom) && isUIElement(editor, elem.dom); }).isSome(); }; var hasFocus = function(editor) { return editor.inline ? hasInlineFocus(editor) : hasIframeFocus(editor); }; var hasEditorOrUiFocus = function(editor) { return hasFocus(editor) || hasUiFocus(editor); }; var focusEditor = function(editor) { var selection = editor.selection; var body = editor.getBody(); var rng = selection.getRng(); editor.quirks.refreshContentEditable(); if (editor.bookmark !== void 0 && hasFocus(editor) === false) { getRng(editor).each(function(bookmarkRng) { editor.selection.setRng(bookmarkRng); rng = bookmarkRng; }); } var contentEditableHost = getContentEditableHost(editor, selection.getNode()); if (editor.$.contains(body, contentEditableHost)) { focusBody(contentEditableHost); normalizeSelection$1(editor, rng); activateEditor(editor); return; } if (!editor.inline) { if (!Env.opera) { focusBody(body); } editor.getWin().focus(); } if (Env.gecko || editor.inline) { focusBody(body); normalizeSelection$1(editor, rng); } activateEditor(editor); }; var activateEditor = function(editor) { return editor.editorManager.setActive(editor); }; var focus25 = function(editor, skipFocus) { if (editor.removed) { return; } if (skipFocus) { activateEditor(editor); } else { focusEditor(editor); } }; var getEndpointElement = function(root2, rng, start2, real, resolve2) { var container = start2 ? rng.startContainer : rng.endContainer; var offset4 = start2 ? rng.startOffset : rng.endOffset; return Optional.from(container).map(SugarElement.fromDom).map(function(elm) { return !real || !rng.collapsed ? child$1(elm, resolve2(elm, offset4)).getOr(elm) : elm; }).bind(function(elm) { return isElement$6(elm) ? Optional.some(elm) : parent2(elm).filter(isElement$6); }).map(function(elm) { return elm.dom; }).getOr(root2); }; var getStart = function(root2, rng, real) { return getEndpointElement(root2, rng, true, real, function(elm, offset4) { return Math.min(childNodesCount(elm), offset4); }); }; var getEnd = function(root2, rng, real) { return getEndpointElement(root2, rng, false, real, function(elm, offset4) { return offset4 > 0 ? offset4 - 1 : offset4; }); }; var skipEmptyTextNodes = function(node, forwards) { var orig = node; while (node && isText$7(node) && node.length === 0) { node = forwards ? node.nextSibling : node.previousSibling; } return node || orig; }; var getNode = function(root2, rng) { var elm, startContainer, endContainer; if (!rng) { return root2; } startContainer = rng.startContainer; endContainer = rng.endContainer; var startOffset = rng.startOffset; var endOffset = rng.endOffset; elm = rng.commonAncestorContainer; if (!rng.collapsed) { if (startContainer === endContainer) { if (endOffset - startOffset < 2) { if (startContainer.hasChildNodes()) { elm = startContainer.childNodes[startOffset]; } } } if (startContainer.nodeType === 3 && endContainer.nodeType === 3) { if (startContainer.length === startOffset) { startContainer = skipEmptyTextNodes(startContainer.nextSibling, true); } else { startContainer = startContainer.parentNode; } if (endOffset === 0) { endContainer = skipEmptyTextNodes(endContainer.previousSibling, false); } else { endContainer = endContainer.parentNode; } if (startContainer && startContainer === endContainer) { return startContainer; } } } if (elm && elm.nodeType === 3) { return elm.parentNode; } return elm; }; var getSelectedBlocks = function(dom2, rng, startElm, endElm) { var node; var selectedBlocks = []; var root2 = dom2.getRoot(); startElm = dom2.getParent(startElm || getStart(root2, rng, rng.collapsed), dom2.isBlock); endElm = dom2.getParent(endElm || getEnd(root2, rng, rng.collapsed), dom2.isBlock); if (startElm && startElm !== root2) { selectedBlocks.push(startElm); } if (startElm && endElm && startElm !== endElm) { node = startElm; var walker = new DomTreeWalker(startElm, root2); while ((node = walker.next()) && node !== endElm) { if (dom2.isBlock(node)) { selectedBlocks.push(node); } } } if (endElm && startElm !== endElm && endElm !== root2) { selectedBlocks.push(endElm); } return selectedBlocks; }; var select2 = function(dom2, node, content) { return Optional.from(node).map(function(node2) { var idx = dom2.nodeIndex(node2); var rng = dom2.createRng(); rng.setStart(node2.parentNode, idx); rng.setEnd(node2.parentNode, idx + 1); if (content) { moveEndPoint(dom2, rng, node2, true); moveEndPoint(dom2, rng, node2, false); } return rng; }); }; var processRanges = function(editor, ranges) { return map$3(ranges, function(range3) { var evt = editor.fire("GetSelectionRange", { range: range3 }); return evt.range !== range3 ? evt.range : range3; }); }; var typeLookup = { "#text": 3, "#comment": 8, "#cdata": 4, "#pi": 7, "#doctype": 10, "#document-fragment": 11 }; var walk$1 = function(node, root2, prev2) { var startName = prev2 ? "lastChild" : "firstChild"; var siblingName = prev2 ? "prev" : "next"; if (node[startName]) { return node[startName]; } if (node !== root2) { var sibling2 = node[siblingName]; if (sibling2) { return sibling2; } for (var parent_1 = node.parent; parent_1 && parent_1 !== root2; parent_1 = parent_1.parent) { sibling2 = parent_1[siblingName]; if (sibling2) { return sibling2; } } } }; var isEmptyTextNode = function(node) { if (!isWhitespaceText(node.value)) { return false; } var parentNode = node.parent; if (parentNode && (parentNode.name !== "span" || parentNode.attr("style")) && /^[ ]+$/.test(node.value)) { return false; } return true; }; var isNonEmptyElement = function(node) { var isNamedAnchor2 = node.name === "a" && !node.attr("href") && node.attr("id"); return node.attr("name") || node.attr("id") && !node.firstChild || node.attr("data-mce-bookmark") || isNamedAnchor2; }; var AstNode = function() { function AstNode2(name2, type3) { this.name = name2; this.type = type3; if (type3 === 1) { this.attributes = []; this.attributes.map = {}; } } AstNode2.create = function(name2, attrs) { var node = new AstNode2(name2, typeLookup[name2] || 1); if (attrs) { each$j(attrs, function(value25, attrName) { node.attr(attrName, value25); }); } return node; }; AstNode2.prototype.replace = function(node) { var self2 = this; if (node.parent) { node.remove(); } self2.insert(node, self2); self2.remove(); return self2; }; AstNode2.prototype.attr = function(name2, value25) { var self2 = this; var attrs; if (typeof name2 !== "string") { if (name2 !== void 0 && name2 !== null) { each$j(name2, function(value26, key2) { self2.attr(key2, value26); }); } return self2; } if (attrs = self2.attributes) { if (value25 !== void 0) { if (value25 === null) { if (name2 in attrs.map) { delete attrs.map[name2]; var i2 = attrs.length; while (i2--) { if (attrs[i2].name === name2) { attrs.splice(i2, 1); return self2; } } } return self2; } if (name2 in attrs.map) { var i2 = attrs.length; while (i2--) { if (attrs[i2].name === name2) { attrs[i2].value = value25; break; } } } else { attrs.push({ name: name2, value: value25 }); } attrs.map[name2] = value25; return self2; } return attrs.map[name2]; } }; AstNode2.prototype.clone = function() { var self2 = this; var clone5 = new AstNode2(self2.name, self2.type); var selfAttrs; if (selfAttrs = self2.attributes) { var cloneAttrs = []; cloneAttrs.map = {}; for (var i2 = 0, l2 = selfAttrs.length; i2 < l2; i2++) { var selfAttr = selfAttrs[i2]; if (selfAttr.name !== "id") { cloneAttrs[cloneAttrs.length] = { name: selfAttr.name, value: selfAttr.value }; cloneAttrs.map[selfAttr.name] = selfAttr.value; } } clone5.attributes = cloneAttrs; } clone5.value = self2.value; clone5.shortEnded = self2.shortEnded; return clone5; }; AstNode2.prototype.wrap = function(wrapper) { var self2 = this; self2.parent.insert(wrapper, self2); wrapper.append(self2); return self2; }; AstNode2.prototype.unwrap = function() { var self2 = this; for (var node = self2.firstChild; node; ) { var next2 = node.next; self2.insert(node, self2, true); node = next2; } self2.remove(); }; AstNode2.prototype.remove = function() { var self2 = this, parent3 = self2.parent, next2 = self2.next, prev2 = self2.prev; if (parent3) { if (parent3.firstChild === self2) { parent3.firstChild = next2; if (next2) { next2.prev = null; } } else { prev2.next = next2; } if (parent3.lastChild === self2) { parent3.lastChild = prev2; if (prev2) { prev2.next = null; } } else { next2.prev = prev2; } self2.parent = self2.next = self2.prev = null; } return self2; }; AstNode2.prototype.append = function(node) { var self2 = this; if (node.parent) { node.remove(); } var last3 = self2.lastChild; if (last3) { last3.next = node; node.prev = last3; self2.lastChild = node; } else { self2.lastChild = self2.firstChild = node; } node.parent = self2; return node; }; AstNode2.prototype.insert = function(node, refNode, before2) { if (node.parent) { node.remove(); } var parent3 = refNode.parent || this; if (before2) { if (refNode === parent3.firstChild) { parent3.firstChild = node; } else { refNode.prev.next = node; } node.prev = refNode.prev; node.next = refNode; refNode.prev = node; } else { if (refNode === parent3.lastChild) { parent3.lastChild = node; } else { refNode.next.prev = node; } node.next = refNode.next; node.prev = refNode; refNode.next = node; } node.parent = parent3; return node; }; AstNode2.prototype.getAll = function(name2) { var self2 = this; var collection = []; for (var node = self2.firstChild; node; node = walk$1(node, self2)) { if (node.name === name2) { collection.push(node); } } return collection; }; AstNode2.prototype.children = function() { var self2 = this; var collection = []; for (var node = self2.firstChild; node; node = node.next) { collection.push(node); } return collection; }; AstNode2.prototype.empty = function() { var self2 = this; if (self2.firstChild) { var nodes2 = []; for (var node = self2.firstChild; node; node = walk$1(node, self2)) { nodes2.push(node); } var i2 = nodes2.length; while (i2--) { var node = nodes2[i2]; node.parent = node.firstChild = node.lastChild = node.next = node.prev = null; } } self2.firstChild = self2.lastChild = null; return self2; }; AstNode2.prototype.isEmpty = function(elements, whitespace3, predicate) { if (whitespace3 === void 0) { whitespace3 = {}; } var self2 = this; var node = self2.firstChild; if (isNonEmptyElement(self2)) { return false; } if (node) { do { if (node.type === 1) { if (node.attr("data-mce-bogus")) { continue; } if (elements[node.name]) { return false; } if (isNonEmptyElement(node)) { return false; } } if (node.type === 8) { return false; } if (node.type === 3 && !isEmptyTextNode(node)) { return false; } if (node.type === 3 && node.parent && whitespace3[node.parent.name] && isWhitespaceText(node.value)) { return false; } if (predicate && predicate(node)) { return false; } } while (node = walk$1(node, self2)); } return true; }; AstNode2.prototype.walk = function(prev2) { return walk$1(this, null, prev2); }; return AstNode2; }(); var extractBase64DataUris = function(html) { var dataImageUri = /data:[^;<"'\s]+;base64,([a-z0-9\+\/=\s]+)/gi; var chunks = []; var uris = {}; var prefix = generate2("img"); var matches2; var index2 = 0; var count3 = 0; while (matches2 = dataImageUri.exec(html)) { var uri = matches2[0]; var imageId = prefix + "_" + count3++; uris[imageId] = uri; if (index2 < matches2.index) { chunks.push(html.substr(index2, matches2.index - index2)); } chunks.push(imageId); index2 = matches2.index + uri.length; } var re2 = new RegExp(prefix + "_[0-9]+", "g"); if (index2 === 0) { return { prefix, uris, html, re: re2 }; } else { if (index2 < html.length) { chunks.push(html.substr(index2)); } return { prefix, uris, html: chunks.join(""), re: re2 }; } }; var restoreDataUris = function(html, result) { return html.replace(result.re, function(imageId) { return get$9(result.uris, imageId).getOr(imageId); }); }; var parseDataUri$1 = function(uri) { var matches2 = /data:([^;]+);base64,([a-z0-9\+\/=\s]+)/i.exec(uri); if (matches2) { return Optional.some({ type: matches2[1], data: decodeURIComponent(matches2[2]) }); } else { return Optional.none(); } }; var each$d = Tools.each, trim2 = Tools.trim; var queryParts = "source protocol authority userInfo user password host port relative path directory file query anchor".split(" "); var DEFAULT_PORTS = { ftp: 21, http: 80, https: 443, mailto: 25 }; var safeSvgDataUrlElements = [ "img", "video" ]; var blockSvgDataUris = function(allowSvgDataUrls, tagName) { if (isNonNullable(allowSvgDataUrls)) { return !allowSvgDataUrls; } else { return isNonNullable(tagName) ? !contains$3(safeSvgDataUrlElements, tagName) : true; } }; var isInvalidUri = function(settings, uri, tagName) { if (settings.allow_html_data_urls) { return false; } else if (/^data:image\//i.test(uri)) { return blockSvgDataUris(settings.allow_svg_data_urls, tagName) && /^data:image\/svg\+xml/i.test(uri); } else { return /^data:/i.test(uri); } }; var URI = function() { function URI2(url2, settings) { url2 = trim2(url2); this.settings = settings || {}; var baseUri = this.settings.base_uri; var self2 = this; if (/^([\w\-]+):([^\/]{2})/i.test(url2) || /^\s*#/.test(url2)) { self2.source = url2; return; } var isProtocolRelative = url2.indexOf("//") === 0; if (url2.indexOf("/") === 0 && !isProtocolRelative) { url2 = (baseUri ? baseUri.protocol || "http" : "http") + "://mce_host" + url2; } if (!/^[\w\-]*:?\/\//.test(url2)) { var baseUrl = this.settings.base_uri ? this.settings.base_uri.path : new URI2(document.location.href).directory; if (this.settings.base_uri && this.settings.base_uri.protocol == "") { url2 = "//mce_host" + self2.toAbsPath(baseUrl, url2); } else { var match7 = /([^#?]*)([#?]?.*)/.exec(url2); url2 = (baseUri && baseUri.protocol || "http") + "://mce_host" + self2.toAbsPath(baseUrl, match7[1]) + match7[2]; } } url2 = url2.replace(/@@/g, "(mce_at)"); var urlMatch = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url2); each$d(queryParts, function(v2, i2) { var part = urlMatch[i2]; if (part) { part = part.replace(/\(mce_at\)/g, "@@"); } self2[v2] = part; }); if (baseUri) { if (!self2.protocol) { self2.protocol = baseUri.protocol; } if (!self2.userInfo) { self2.userInfo = baseUri.userInfo; } if (!self2.port && self2.host === "mce_host") { self2.port = baseUri.port; } if (!self2.host || self2.host === "mce_host") { self2.host = baseUri.host; } self2.source = ""; } if (isProtocolRelative) { self2.protocol = ""; } } URI2.parseDataUri = function(uri) { var type3; var uriComponents = decodeURIComponent(uri).split(","); var matches2 = /data:([^;]+)/.exec(uriComponents[0]); if (matches2) { type3 = matches2[1]; } return { type: type3, data: uriComponents[1] }; }; URI2.isDomSafe = function(uri, context3, options2) { if (options2 === void 0) { options2 = {}; } if (options2.allow_script_urls) { return true; } else { var decodedUri = Entities.decode(uri).replace(/[\s\u0000-\u001F]+/g, ""); try { decodedUri = decodeURIComponent(decodedUri); } catch (ex) { decodedUri = unescape(decodedUri); } if (/((java|vb)script|mhtml):/i.test(decodedUri)) { return false; } return !isInvalidUri(options2, decodedUri, context3); } }; URI2.getDocumentBaseUrl = function(loc) { var baseUrl; if (loc.protocol.indexOf("http") !== 0 && loc.protocol !== "file:") { baseUrl = loc.href; } else { baseUrl = loc.protocol + "//" + loc.host + loc.pathname; } if (/^[^:]+:\/\/\/?[^\/]+\//.test(baseUrl)) { baseUrl = baseUrl.replace(/[\?#].*$/, "").replace(/[\/\\][^\/]+$/, ""); if (!/[\/\\]$/.test(baseUrl)) { baseUrl += "/"; } } return baseUrl; }; URI2.prototype.setPath = function(path2) { var pathMatch = /^(.*?)\/?(\w+)?$/.exec(path2); this.path = pathMatch[0]; this.directory = pathMatch[1]; this.file = pathMatch[2]; this.source = ""; this.getURI(); }; URI2.prototype.toRelative = function(uri) { var output; if (uri === "./") { return uri; } var relativeUri = new URI2(uri, { base_uri: this }); if (relativeUri.host !== "mce_host" && this.host !== relativeUri.host && relativeUri.host || this.port !== relativeUri.port || this.protocol !== relativeUri.protocol && relativeUri.protocol !== "") { return relativeUri.getURI(); } var tu = this.getURI(), uu = relativeUri.getURI(); if (tu === uu || tu.charAt(tu.length - 1) === "/" && tu.substr(0, tu.length - 1) === uu) { return tu; } output = this.toRelPath(this.path, relativeUri.path); if (relativeUri.query) { output += "?" + relativeUri.query; } if (relativeUri.anchor) { output += "#" + relativeUri.anchor; } return output; }; URI2.prototype.toAbsolute = function(uri, noHost) { var absoluteUri = new URI2(uri, { base_uri: this }); return absoluteUri.getURI(noHost && this.isSameOrigin(absoluteUri)); }; URI2.prototype.isSameOrigin = function(uri) { if (this.host == uri.host && this.protocol == uri.protocol) { if (this.port == uri.port) { return true; } var defaultPort = DEFAULT_PORTS[this.protocol]; if (defaultPort && (this.port || defaultPort) == (uri.port || defaultPort)) { return true; } } return false; }; URI2.prototype.toRelPath = function(base, path2) { var breakPoint = 0, out = "", i2, l2; var normalizedBase = base.substring(0, base.lastIndexOf("/")).split("/"); var items = path2.split("/"); if (normalizedBase.length >= items.length) { for (i2 = 0, l2 = normalizedBase.length; i2 < l2; i2++) { if (i2 >= items.length || normalizedBase[i2] !== items[i2]) { breakPoint = i2 + 1; break; } } } if (normalizedBase.length < items.length) { for (i2 = 0, l2 = items.length; i2 < l2; i2++) { if (i2 >= normalizedBase.length || normalizedBase[i2] !== items[i2]) { breakPoint = i2 + 1; break; } } } if (breakPoint === 1) { return path2; } for (i2 = 0, l2 = normalizedBase.length - (breakPoint - 1); i2 < l2; i2++) { out += "../"; } for (i2 = breakPoint - 1, l2 = items.length; i2 < l2; i2++) { if (i2 !== breakPoint - 1) { out += "/" + items[i2]; } else { out += items[i2]; } } return out; }; URI2.prototype.toAbsPath = function(base, path2) { var i2, nb = 0, o2 = [], outPath; var tr = /\/$/.test(path2) ? "/" : ""; var normalizedBase = base.split("/"); var normalizedPath = path2.split("/"); each$d(normalizedBase, function(k2) { if (k2) { o2.push(k2); } }); normalizedBase = o2; for (i2 = normalizedPath.length - 1, o2 = []; i2 >= 0; i2--) { if (normalizedPath[i2].length === 0 || normalizedPath[i2] === ".") { continue; } if (normalizedPath[i2] === "..") { nb++; continue; } if (nb > 0) { nb--; continue; } o2.push(normalizedPath[i2]); } i2 = normalizedBase.length - nb; if (i2 <= 0) { outPath = reverse(o2).join("/"); } else { outPath = normalizedBase.slice(0, i2).join("/") + "/" + reverse(o2).join("/"); } if (outPath.indexOf("/") !== 0) { outPath = "/" + outPath; } if (tr && outPath.lastIndexOf("/") !== outPath.length - 1) { outPath += tr; } return outPath; }; URI2.prototype.getURI = function(noProtoHost) { if (noProtoHost === void 0) { noProtoHost = false; } var s2; if (!this.source || noProtoHost) { s2 = ""; if (!noProtoHost) { if (this.protocol) { s2 += this.protocol + "://"; } else { s2 += "//"; } if (this.userInfo) { s2 += this.userInfo + "@"; } if (this.host) { s2 += this.host; } if (this.port) { s2 += ":" + this.port; } } if (this.path) { s2 += this.path; } if (this.query) { s2 += "?" + this.query; } if (this.anchor) { s2 += "#" + this.anchor; } this.source = s2; } return this.source; }; return URI2; }(); var filteredClobberElements = Tools.makeMap("button,fieldset,form,iframe,img,image,input,object,output,select,textarea"); var isValidPrefixAttrName = function(name2) { return name2.indexOf("data-") === 0 || name2.indexOf("aria-") === 0; }; var lazyTempDocument$1 = cached2(function() { return document.implementation.createHTMLDocument("parser"); }); var findMatchingEndTagIndex = function(schema2, html, startIndex) { var startTagRegExp = /<([!?\/])?([A-Za-z0-9\-_:.]+)/g; var endTagRegExp = /(?:\s(?:[^'">]+(?:"[^"]*"|'[^']*'))*[^"'>]*(?:"[^">]*|'[^'>]*)?|\s*|\/)>/g; var shortEndedElements = schema2.getShortEndedElements(); var count3 = 1, index2 = startIndex; while (count3 !== 0) { startTagRegExp.lastIndex = index2; while (true) { var startMatch = startTagRegExp.exec(html); if (startMatch === null) { return index2; } else if (startMatch[1] === "!") { if (startsWith(startMatch[2], "--")) { index2 = findCommentEndIndex(html, false, startMatch.index + "!--".length); } else { index2 = findCommentEndIndex(html, true, startMatch.index + 1); } break; } else { endTagRegExp.lastIndex = startTagRegExp.lastIndex; var endMatch = endTagRegExp.exec(html); if (isNull2(endMatch) || endMatch.index !== startTagRegExp.lastIndex) { continue; } if (startMatch[1] === "/") { count3 -= 1; } else if (!has$22(shortEndedElements, startMatch[2])) { count3 += 1; } index2 = startTagRegExp.lastIndex + endMatch[0].length; break; } } } return index2; }; var isConditionalComment = function(html, startIndex) { return /^\s*\[if [\w\W]+\]>.*/.test(html.substr(startIndex)); }; var findCommentEndIndex = function(html, isBogus2, startIndex) { if (startIndex === void 0) { startIndex = 0; } var lcHtml = html.toLowerCase(); if (lcHtml.indexOf("[if ", startIndex) !== -1 && isConditionalComment(lcHtml, startIndex)) { var endIfIndex = lcHtml.indexOf("[endif]", startIndex); return lcHtml.indexOf(">", endIfIndex); } else { if (isBogus2) { var endIndex = lcHtml.indexOf(">", startIndex); return endIndex !== -1 ? endIndex : lcHtml.length; } else { var endCommentRegexp = /--!?>/g; endCommentRegexp.lastIndex = startIndex; var match7 = endCommentRegexp.exec(html); return match7 ? match7.index + match7[0].length : lcHtml.length; } } }; var checkBogusAttribute = function(regExp, attrString) { var matches2 = regExp.exec(attrString); if (matches2) { var name_1 = matches2[1]; var value25 = matches2[2]; return typeof name_1 === "string" && name_1.toLowerCase() === "data-mce-bogus" ? value25 : null; } else { return null; } }; var SaxParser = function(settings, schema2) { if (schema2 === void 0) { schema2 = Schema2(); } settings = settings || {}; var doc2 = lazyTempDocument$1(); var form = doc2.createElement("form"); if (settings.fix_self_closing !== false) { settings.fix_self_closing = true; } var comment = settings.comment ? settings.comment : noop2; var cdata = settings.cdata ? settings.cdata : noop2; var text = settings.text ? settings.text : noop2; var start2 = settings.start ? settings.start : noop2; var end2 = settings.end ? settings.end : noop2; var pi = settings.pi ? settings.pi : noop2; var doctype = settings.doctype ? settings.doctype : noop2; var parseInternal = function(base64Extract, format3) { if (format3 === void 0) { format3 = "html"; } var html = base64Extract.html; var matches2, index2 = 0, value25, endRegExp; var stack = []; var attrList, i2, textData, name2; var isInternalElement, isShortEnded; var elementRule, isValidElement2, attr, attribsValue, validAttributesMap, validAttributePatterns; var attributesRequired, attributesDefault, attributesForced; var anyAttributesRequired, attrValue, idCount = 0; var decode3 = Entities.decode; var filteredUrlAttrs = Tools.makeMap("src,href,data,background,action,formaction,poster,xlink:href"); var parsingMode = format3 === "html" ? 0 : 1; var processEndTag = function(name3) { var pos, i3; pos = stack.length; while (pos--) { if (stack[pos].name === name3) { break; } } if (pos >= 0) { for (i3 = stack.length - 1; i3 >= pos; i3--) { name3 = stack[i3]; if (name3.valid) { end2(name3.name); } } stack.length = pos; } }; var processText = function(value26, raw) { return text(restoreDataUris(value26, base64Extract), raw); }; var processComment = function(value26) { if (value26 === "") { return; } if (value26.charAt(0) === ">") { value26 = " " + value26; } if (!settings.allow_conditional_comments && value26.substr(0, 3).toLowerCase() === "[if") { value26 = " " + value26; } comment(restoreDataUris(value26, base64Extract)); }; var processAttr = function(value26) { return restoreDataUris(value26, base64Extract); }; var processMalformedComment = function(value26, startIndex) { var startTag = value26 || ""; var isBogus2 = !startsWith(startTag, "--"); var endIndex = findCommentEndIndex(html, isBogus2, startIndex); value26 = html.substr(startIndex, endIndex - startIndex); processComment(isBogus2 ? startTag + value26 : value26); return endIndex + 1; }; var parseAttribute = function(tagName, name3, value26, val2, val3) { name3 = name3.toLowerCase(); value26 = processAttr(name3 in fillAttrsMap ? name3 : decode3(value26 || val2 || val3 || "")); if (validate4 && !isInternalElement && isValidPrefixAttrName(name3) === false) { var attrRule = validAttributesMap[name3]; if (!attrRule && validAttributePatterns) { var i_1 = validAttributePatterns.length; while (i_1--) { attrRule = validAttributePatterns[i_1]; if (attrRule.pattern.test(name3)) { break; } } if (i_1 === -1) { attrRule = null; } } if (!attrRule) { return; } if (attrRule.validValues && !(value26 in attrRule.validValues)) { return; } } var isNameOrId = name3 === "name" || name3 === "id"; if (isNameOrId && tagName in filteredClobberElements && (value26 in doc2 || value26 in form)) { return; } if (filteredUrlAttrs[name3] && !URI.isDomSafe(value26, tagName, settings)) { return; } if (isInternalElement && (name3 in filteredUrlAttrs || name3.indexOf("on") === 0)) { return; } attrList.map[name3] = value26; attrList.push({ name: name3, value: value26 }); }; var tokenRegExp = new RegExp(`<(?:(?:!--([\\w\\W]*?)--!?>)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:![Dd][Oo][Cc][Tt][Yy][Pp][Ee]([\\w\\W]*?)>)|(?:!(--)?)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)>)|(?:([A-Za-z][A-Za-z0-9\\-_:.]*)(\\s(?:[^'">]+(?:"[^"]*"|'[^']*'))*[^"'>]*(?:"[^">]*|'[^'>]*)?|\\s*|\\/)>))`, "g"); var attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g; var shortEndedElements = schema2.getShortEndedElements(); var selfClosing = settings.self_closing_elements || schema2.getSelfClosingElements(); var fillAttrsMap = schema2.getBoolAttrs(); var validate4 = settings.validate; var removeInternalElements = settings.remove_internals; var fixSelfClosing = settings.fix_self_closing; var specialElements = schema2.getSpecialElements(); var processHtml = html + ">"; while (matches2 = tokenRegExp.exec(processHtml)) { var matchText = matches2[0]; if (index2 < matches2.index) { processText(decode3(html.substr(index2, matches2.index - index2))); } if (value25 = matches2[7]) { value25 = value25.toLowerCase(); if (value25.charAt(0) === ":") { value25 = value25.substr(1); } processEndTag(value25); } else if (value25 = matches2[8]) { if (matches2.index + matchText.length > html.length) { processText(decode3(html.substr(matches2.index))); index2 = matches2.index + matchText.length; continue; } value25 = value25.toLowerCase(); if (value25.charAt(0) === ":") { value25 = value25.substr(1); } isShortEnded = value25 in shortEndedElements; if (fixSelfClosing && selfClosing[value25] && stack.length > 0 && stack[stack.length - 1].name === value25) { processEndTag(value25); } var bogusValue = checkBogusAttribute(attrRegExp, matches2[9]); if (bogusValue !== null) { if (bogusValue === "all") { index2 = findMatchingEndTagIndex(schema2, html, tokenRegExp.lastIndex); tokenRegExp.lastIndex = index2; continue; } isValidElement2 = false; } if (!validate4 || (elementRule = schema2.getElementRule(value25))) { isValidElement2 = true; if (validate4) { validAttributesMap = elementRule.attributes; validAttributePatterns = elementRule.attributePatterns; } if (attribsValue = matches2[9]) { isInternalElement = attribsValue.indexOf("data-mce-type") !== -1; if (isInternalElement && removeInternalElements) { isValidElement2 = false; } attrList = []; attrList.map = {}; attribsValue.replace(attrRegExp, function(match7, name3, val, val2, val3) { parseAttribute(value25, name3, val, val2, val3); return ""; }); } else { attrList = []; attrList.map = {}; } if (validate4 && !isInternalElement) { attributesRequired = elementRule.attributesRequired; attributesDefault = elementRule.attributesDefault; attributesForced = elementRule.attributesForced; anyAttributesRequired = elementRule.removeEmptyAttrs; if (anyAttributesRequired && !attrList.length) { isValidElement2 = false; } if (attributesForced) { i2 = attributesForced.length; while (i2--) { attr = attributesForced[i2]; name2 = attr.name; attrValue = attr.value; if (attrValue === "{$uid}") { attrValue = "mce_" + idCount++; } attrList.map[name2] = attrValue; attrList.push({ name: name2, value: attrValue }); } } if (attributesDefault) { i2 = attributesDefault.length; while (i2--) { attr = attributesDefault[i2]; name2 = attr.name; if (!(name2 in attrList.map)) { attrValue = attr.value; if (attrValue === "{$uid}") { attrValue = "mce_" + idCount++; } attrList.map[name2] = attrValue; attrList.push({ name: name2, value: attrValue }); } } } if (attributesRequired) { i2 = attributesRequired.length; while (i2--) { if (attributesRequired[i2] in attrList.map) { break; } } if (i2 === -1) { isValidElement2 = false; } } if (attr = attrList.map["data-mce-bogus"]) { if (attr === "all") { index2 = findMatchingEndTagIndex(schema2, html, tokenRegExp.lastIndex); tokenRegExp.lastIndex = index2; continue; } isValidElement2 = false; } } if (isValidElement2) { start2(value25, attrList, isShortEnded); } } else { isValidElement2 = false; } if (endRegExp = specialElements[value25]) { endRegExp.lastIndex = index2 = matches2.index + matchText.length; if (matches2 = endRegExp.exec(html)) { if (isValidElement2) { textData = html.substr(index2, matches2.index - index2); } index2 = matches2.index + matches2[0].length; } else { textData = html.substr(index2); index2 = html.length; } if (isValidElement2) { if (textData.length > 0) { processText(textData, true); } end2(value25); } tokenRegExp.lastIndex = index2; continue; } if (!isShortEnded) { if (!attribsValue || attribsValue.indexOf("/") !== attribsValue.length - 1) { stack.push({ name: value25, valid: isValidElement2 }); } else if (isValidElement2) { end2(value25); } } } else if (value25 = matches2[1]) { processComment(value25); } else if (value25 = matches2[2]) { var isValidCdataSection = parsingMode === 1 || settings.preserve_cdata || stack.length > 0 && schema2.isValidChild(stack[stack.length - 1].name, "#cdata"); if (isValidCdataSection) { cdata(value25); } else { index2 = processMalformedComment("", matches2.index + 2); tokenRegExp.lastIndex = index2; continue; } } else if (value25 = matches2[3]) { doctype(value25); } else if ((value25 = matches2[4]) || matchText === "= 0; i2--) { value25 = stack[i2]; if (value25.valid) { end2(value25.name); } } }; var parse2 = function(html, format3) { if (format3 === void 0) { format3 = "html"; } parseInternal(extractBase64DataUris(html), format3); }; return { parse: parse2 }; }; SaxParser.findEndTag = findMatchingEndTagIndex; var trimHtml = function(tempAttrs, html) { var trimContentRegExp = new RegExp(["\\s?(" + tempAttrs.join("|") + ')="[^"]+"'].join("|"), "gi"); return html.replace(trimContentRegExp, ""); }; var trimInternal = function(serializer, html) { var bogusAllRegExp = /<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g; var schema2 = serializer.schema; var content = trimHtml(serializer.getTempAttrs(), html); var shortEndedElements = schema2.getShortEndedElements(); var matches2; while (matches2 = bogusAllRegExp.exec(content)) { var index2 = bogusAllRegExp.lastIndex; var matchLength = matches2[0].length; var endTagIndex = void 0; if (shortEndedElements[matches2[1]]) { endTagIndex = index2; } else { endTagIndex = SaxParser.findEndTag(schema2, content, index2); } content = content.substring(0, index2 - matchLength) + content.substring(endTagIndex); bogusAllRegExp.lastIndex = index2 - matchLength; } return trim$2(content); }; var trimExternal = trimInternal; var trimEmptyContents = function(editor, html) { var blockName = getForcedRootBlock(editor); var emptyRegExp = new RegExp("^(<" + blockName + "[^>]*>( | |\\s|\xA0|
|)<\\/" + blockName + ">[\r\n]*|
[\r\n]*)$"); return html.replace(emptyRegExp, ""); }; var setupArgs$3 = function(args, format3) { return __assign(__assign({}, args), { format: format3, get: true, getInner: true }); }; var getContentFromBody = function(editor, args, format3, body) { var defaultedArgs = setupArgs$3(args, format3); var updatedArgs = args.no_events ? defaultedArgs : editor.fire("BeforeGetContent", defaultedArgs); var content; if (updatedArgs.format === "raw") { content = Tools.trim(trimExternal(editor.serializer, body.innerHTML)); } else if (updatedArgs.format === "text") { content = editor.dom.isEmpty(body) ? "" : trim$2(body.innerText || body.textContent); } else if (updatedArgs.format === "tree") { content = editor.serializer.serialize(body, updatedArgs); } else { content = trimEmptyContents(editor, editor.serializer.serialize(body, updatedArgs)); } if (!contains$3([ "text", "tree" ], updatedArgs.format) && !isWsPreserveElement(SugarElement.fromDom(body))) { updatedArgs.content = Tools.trim(content); } else { updatedArgs.content = content; } if (updatedArgs.no_events) { return updatedArgs.content; } else { return editor.fire("GetContent", updatedArgs).content; } }; var getContentInternal = function(editor, args, format3) { return Optional.from(editor.getBody()).fold(constant2(args.format === "tree" ? new AstNode("body", 11) : ""), function(body) { return getContentFromBody(editor, args, format3, body); }); }; var each$c = Tools.each; var ElementUtils = function(dom2) { var compare2 = function(node1, node2) { if (node1.nodeName !== node2.nodeName) { return false; } var getAttribs = function(node) { var attribs = {}; each$c(dom2.getAttribs(node), function(attr) { var name2 = attr.nodeName.toLowerCase(); if (name2.indexOf("_") !== 0 && name2 !== "style" && name2.indexOf("data-") !== 0) { attribs[name2] = dom2.getAttrib(node, name2); } }); return attribs; }; var compareObjects = function(obj1, obj2) { var value25, name2; for (name2 in obj1) { if (has$22(obj1, name2)) { value25 = obj2[name2]; if (typeof value25 === "undefined") { return false; } if (obj1[name2] !== value25) { return false; } delete obj2[name2]; } } for (name2 in obj2) { if (has$22(obj2, name2)) { return false; } } return true; }; if (!compareObjects(getAttribs(node1), getAttribs(node2))) { return false; } if (!compareObjects(dom2.parseStyle(dom2.getAttrib(node1, "style")), dom2.parseStyle(dom2.getAttrib(node2, "style")))) { return false; } return !isBookmarkNode$1(node1) && !isBookmarkNode$1(node2); }; return { compare: compare2 }; }; var makeMap$1 = Tools.makeMap; var Writer = function(settings) { var html = []; settings = settings || {}; var indent = settings.indent; var indentBefore = makeMap$1(settings.indent_before || ""); var indentAfter = makeMap$1(settings.indent_after || ""); var encode3 = Entities.getEncodeFunc(settings.entity_encoding || "raw", settings.entities); var htmlOutput = settings.element_format === "html"; return { start: function(name2, attrs, empty3) { var i2, l2, attr, value25; if (indent && indentBefore[name2] && html.length > 0) { value25 = html[html.length - 1]; if (value25.length > 0 && value25 !== "\n") { html.push("\n"); } } html.push("<", name2); if (attrs) { for (i2 = 0, l2 = attrs.length; i2 < l2; i2++) { attr = attrs[i2]; html.push(" ", attr.name, '="', encode3(attr.value, true), '"'); } } if (!empty3 || htmlOutput) { html[html.length] = ">"; } else { html[html.length] = " />"; } if (empty3 && indent && indentAfter[name2] && html.length > 0) { value25 = html[html.length - 1]; if (value25.length > 0 && value25 !== "\n") { html.push("\n"); } } }, end: function(name2) { var value25; html.push(""); if (indent && indentAfter[name2] && html.length > 0) { value25 = html[html.length - 1]; if (value25.length > 0 && value25 !== "\n") { html.push("\n"); } } }, text: function(text, raw) { if (text.length > 0) { html[html.length] = raw ? text : encode3(text); } }, cdata: function(text) { html.push(""); }, comment: function(text) { html.push(""); }, pi: function(name2, text) { if (text) { html.push(""); } else { html.push(""); } if (indent) { html.push("\n"); } }, doctype: function(text) { html.push("", indent ? "\n" : ""); }, reset: function() { html.length = 0; }, getContent: function() { return html.join("").replace(/\n$/, ""); } }; }; var HtmlSerializer = function(settings, schema2) { if (schema2 === void 0) { schema2 = Schema2(); } var writer = Writer(settings); settings = settings || {}; settings.validate = "validate" in settings ? settings.validate : true; var serialize2 = function(node) { var validate4 = settings.validate; var handlers = { 3: function(node2) { writer.text(node2.value, node2.raw); }, 8: function(node2) { writer.comment(node2.value); }, 7: function(node2) { writer.pi(node2.name, node2.value); }, 10: function(node2) { writer.doctype(node2.value); }, 4: function(node2) { writer.cdata(node2.value); }, 11: function(node2) { if (node2 = node2.firstChild) { do { walk2(node2); } while (node2 = node2.next); } } }; writer.reset(); var walk2 = function(node2) { var handler7 = handlers[node2.type]; if (!handler7) { var name_1 = node2.name; var isEmpty2 = node2.shortEnded; var attrs = node2.attributes; if (validate4 && attrs && attrs.length > 1) { var sortedAttrs = []; sortedAttrs.map = {}; var elementRule = schema2.getElementRule(node2.name); if (elementRule) { for (var i2 = 0, l2 = elementRule.attributesOrder.length; i2 < l2; i2++) { var attrName = elementRule.attributesOrder[i2]; if (attrName in attrs.map) { var attrValue = attrs.map[attrName]; sortedAttrs.map[attrName] = attrValue; sortedAttrs.push({ name: attrName, value: attrValue }); } } for (var i2 = 0, l2 = attrs.length; i2 < l2; i2++) { var attrName = attrs[i2].name; if (!(attrName in sortedAttrs.map)) { var attrValue = attrs.map[attrName]; sortedAttrs.map[attrName] = attrValue; sortedAttrs.push({ name: attrName, value: attrValue }); } } attrs = sortedAttrs; } } writer.start(node2.name, attrs, isEmpty2); if (!isEmpty2) { if (node2 = node2.firstChild) { do { walk2(node2); } while (node2 = node2.next); } writer.end(name_1); } } else { handler7(node2); } }; if (node.type === 1 && !settings.inner) { walk2(node); } else { handlers[11](node); } return writer.getContent(); }; return { serialize: serialize2 }; }; var nonInheritableStyles = /* @__PURE__ */ new Set(); (function() { var nonInheritableStylesArr = [ "margin", "margin-left", "margin-right", "margin-top", "margin-bottom", "padding", "padding-left", "padding-right", "padding-top", "padding-bottom", "border", "border-width", "border-style", "border-color", "background", "background-attachment", "background-clip", "background-color", "background-image", "background-origin", "background-position", "background-repeat", "background-size", "float", "position", "left", "right", "top", "bottom", "z-index", "display", "transform", "width", "max-width", "min-width", "height", "max-height", "min-height", "overflow", "overflow-x", "overflow-y", "text-overflow", "vertical-align", "transition", "transition-delay", "transition-duration", "transition-property", "transition-timing-function" ]; each$k(nonInheritableStylesArr, function(style) { nonInheritableStyles.add(style); }); })(); var shorthandStyleProps = [ "font", "text-decoration", "text-emphasis" ]; var getStyleProps = function(dom2, node) { return keys2(dom2.parseStyle(dom2.getAttrib(node, "style"))); }; var isNonInheritableStyle = function(style) { return nonInheritableStyles.has(style); }; var hasInheritableStyles = function(dom2, node) { return forall(getStyleProps(dom2, node), function(style) { return !isNonInheritableStyle(style); }); }; var getLonghandStyleProps = function(styles) { return filter$4(styles, function(style) { return exists(shorthandStyleProps, function(prop) { return startsWith(style, prop); }); }); }; var hasStyleConflict = function(dom2, node, parentNode) { var nodeStyleProps = getStyleProps(dom2, node); var parentNodeStyleProps = getStyleProps(dom2, parentNode); var valueMismatch = function(prop) { var nodeValue = dom2.getStyle(node, prop); var parentValue = dom2.getStyle(parentNode, prop); return isNotEmpty(nodeValue) && isNotEmpty(parentValue) && nodeValue !== parentValue; }; return exists(nodeStyleProps, function(nodeStyleProp) { var propExists = function(props2) { return exists(props2, function(prop) { return prop === nodeStyleProp; }); }; if (!propExists(parentNodeStyleProps) && propExists(shorthandStyleProps)) { var longhandProps = getLonghandStyleProps(parentNodeStyleProps); return exists(longhandProps, valueMismatch); } else { return valueMismatch(nodeStyleProp); } }); }; var isChar = function(forward, predicate, pos) { return Optional.from(pos.container()).filter(isText$7).exists(function(text) { var delta = forward ? 0 : -1; return predicate(text.data.charAt(pos.offset() + delta)); }); }; var isBeforeSpace = curry(isChar, true, isWhiteSpace); var isAfterSpace = curry(isChar, false, isWhiteSpace); var isEmptyText = function(pos) { var container = pos.container(); return isText$7(container) && (container.data.length === 0 || isZwsp(container.data) && BookmarkManager.isBookmarkNode(container.parentNode)); }; var matchesElementPosition = function(before2, predicate) { return function(pos) { return Optional.from(getChildNodeAtRelativeOffset(before2 ? 0 : -1, pos)).filter(predicate).isSome(); }; }; var isImageBlock = function(node) { return isImg(node) && get$5(SugarElement.fromDom(node), "display") === "block"; }; var isCefNode = function(node) { return isContentEditableFalse$b(node) && !isBogusAll$1(node); }; var isBeforeImageBlock = matchesElementPosition(true, isImageBlock); var isAfterImageBlock = matchesElementPosition(false, isImageBlock); var isBeforeMedia = matchesElementPosition(true, isMedia$2); var isAfterMedia = matchesElementPosition(false, isMedia$2); var isBeforeTable = matchesElementPosition(true, isTable$3); var isAfterTable = matchesElementPosition(false, isTable$3); var isBeforeContentEditableFalse = matchesElementPosition(true, isCefNode); var isAfterContentEditableFalse = matchesElementPosition(false, isCefNode); var getLastChildren = function(elm) { var children2 = []; var rawNode = elm.dom; while (rawNode) { children2.push(SugarElement.fromDom(rawNode)); rawNode = rawNode.lastChild; } return children2; }; var removeTrailingBr = function(elm) { var allBrs = descendants(elm, "br"); var brs = filter$4(getLastChildren(elm).slice(-1), isBr$4); if (allBrs.length === brs.length) { each$k(brs, remove$7); } }; var fillWithPaddingBr = function(elm) { empty2(elm); append$1(elm, SugarElement.fromHtml('
')); }; var trimBlockTrailingBr = function(elm) { lastChild(elm).each(function(lastChild2) { prevSibling(lastChild2).each(function(lastChildPrevSibling) { if (isBlock$2(elm) && isBr$4(lastChild2) && isBlock$2(lastChildPrevSibling)) { remove$7(lastChild2); } }); }); }; var dropLast = function(xs) { return xs.slice(0, -1); }; var parentsUntil = function(start2, root2, predicate) { if (contains$1(root2, start2)) { return dropLast(parents$1(start2, function(elm) { return predicate(elm) || eq2(elm, root2); })); } else { return []; } }; var parents = function(start2, root2) { return parentsUntil(start2, root2, never); }; var parentsAndSelf = function(start2, root2) { return [start2].concat(parents(start2, root2)); }; var navigateIgnoreEmptyTextNodes = function(forward, root2, from3) { return navigateIgnore(forward, root2, from3, isEmptyText); }; var getClosestBlock$1 = function(root2, pos) { return find$3(parentsAndSelf(SugarElement.fromDom(pos.container()), root2), isBlock$2); }; var isAtBeforeAfterBlockBoundary = function(forward, root2, pos) { return navigateIgnoreEmptyTextNodes(forward, root2.dom, pos).forall(function(newPos) { return getClosestBlock$1(root2, pos).fold(function() { return isInSameBlock(newPos, pos, root2.dom) === false; }, function(fromBlock) { return isInSameBlock(newPos, pos, root2.dom) === false && contains$1(fromBlock, SugarElement.fromDom(newPos.container())); }); }); }; var isAtBlockBoundary = function(forward, root2, pos) { return getClosestBlock$1(root2, pos).fold(function() { return navigateIgnoreEmptyTextNodes(forward, root2.dom, pos).forall(function(newPos) { return isInSameBlock(newPos, pos, root2.dom) === false; }); }, function(parent3) { return navigateIgnoreEmptyTextNodes(forward, parent3.dom, pos).isNone(); }); }; var isAtStartOfBlock = curry(isAtBlockBoundary, false); var isAtEndOfBlock = curry(isAtBlockBoundary, true); var isBeforeBlock = curry(isAtBeforeAfterBlockBoundary, false); var isAfterBlock = curry(isAtBeforeAfterBlockBoundary, true); var isBr = function(pos) { return getElementFromPosition(pos).exists(isBr$4); }; var findBr = function(forward, root2, pos) { var parentBlocks = filter$4(parentsAndSelf(SugarElement.fromDom(pos.container()), root2), isBlock$2); var scope = head(parentBlocks).getOr(root2); return fromPosition(forward, scope.dom, pos).filter(isBr); }; var isBeforeBr$1 = function(root2, pos) { return getElementFromPosition(pos).exists(isBr$4) || findBr(true, root2, pos).isSome(); }; var isAfterBr = function(root2, pos) { return getElementFromPrevPosition(pos).exists(isBr$4) || findBr(false, root2, pos).isSome(); }; var findPreviousBr = curry(findBr, false); var findNextBr = curry(findBr, true); var isInMiddleOfText = function(pos) { return CaretPosition.isTextPosition(pos) && !pos.isAtStart() && !pos.isAtEnd(); }; var getClosestBlock = function(root2, pos) { var parentBlocks = filter$4(parentsAndSelf(SugarElement.fromDom(pos.container()), root2), isBlock$2); return head(parentBlocks).getOr(root2); }; var hasSpaceBefore = function(root2, pos) { if (isInMiddleOfText(pos)) { return isAfterSpace(pos); } else { return isAfterSpace(pos) || prevPosition(getClosestBlock(root2, pos).dom, pos).exists(isAfterSpace); } }; var hasSpaceAfter = function(root2, pos) { if (isInMiddleOfText(pos)) { return isBeforeSpace(pos); } else { return isBeforeSpace(pos) || nextPosition(getClosestBlock(root2, pos).dom, pos).exists(isBeforeSpace); } }; var isPreValue = function(value25) { return contains$3([ "pre", "pre-wrap" ], value25); }; var isInPre = function(pos) { return getElementFromPosition(pos).bind(function(elm) { return closest$3(elm, isElement$6); }).exists(function(elm) { return isPreValue(get$5(elm, "white-space")); }); }; var isAtBeginningOfBody = function(root2, pos) { return prevPosition(root2.dom, pos).isNone(); }; var isAtEndOfBody = function(root2, pos) { return nextPosition(root2.dom, pos).isNone(); }; var isAtLineBoundary = function(root2, pos) { return isAtBeginningOfBody(root2, pos) || isAtEndOfBody(root2, pos) || isAtStartOfBlock(root2, pos) || isAtEndOfBlock(root2, pos) || isAfterBr(root2, pos) || isBeforeBr$1(root2, pos); }; var needsToHaveNbsp = function(root2, pos) { if (isInPre(pos)) { return false; } else { return isAtLineBoundary(root2, pos) || hasSpaceBefore(root2, pos) || hasSpaceAfter(root2, pos); } }; var needsToBeNbspLeft = function(root2, pos) { if (isInPre(pos)) { return false; } else { return isAtStartOfBlock(root2, pos) || isBeforeBlock(root2, pos) || isAfterBr(root2, pos) || hasSpaceBefore(root2, pos); } }; var leanRight = function(pos) { var container = pos.container(); var offset4 = pos.offset(); if (isText$7(container) && offset4 < container.data.length) { return CaretPosition(container, offset4 + 1); } else { return pos; } }; var needsToBeNbspRight = function(root2, pos) { if (isInPre(pos)) { return false; } else { return isAtEndOfBlock(root2, pos) || isAfterBlock(root2, pos) || isBeforeBr$1(root2, pos) || hasSpaceAfter(root2, pos); } }; var needsToBeNbsp = function(root2, pos) { return needsToBeNbspLeft(root2, pos) || needsToBeNbspRight(root2, leanRight(pos)); }; var isNbspAt = function(text, offset4) { return isNbsp(text.charAt(offset4)); }; var hasNbsp = function(pos) { var container = pos.container(); return isText$7(container) && contains$2(container.data, nbsp); }; var normalizeNbspMiddle = function(text) { var chars = text.split(""); return map$3(chars, function(chr, i2) { if (isNbsp(chr) && i2 > 0 && i2 < chars.length - 1 && isContent(chars[i2 - 1]) && isContent(chars[i2 + 1])) { return " "; } else { return chr; } }).join(""); }; var normalizeNbspAtStart = function(root2, node) { var text = node.data; var firstPos = CaretPosition(node, 0); if (isNbspAt(text, 0) && !needsToBeNbsp(root2, firstPos)) { node.data = " " + text.slice(1); return true; } else { return false; } }; var normalizeNbspInMiddleOfTextNode = function(node) { var text = node.data; var newText = normalizeNbspMiddle(text); if (newText !== text) { node.data = newText; return true; } else { return false; } }; var normalizeNbspAtEnd = function(root2, node) { var text = node.data; var lastPos = CaretPosition(node, text.length - 1); if (isNbspAt(text, text.length - 1) && !needsToBeNbsp(root2, lastPos)) { node.data = text.slice(0, -1) + " "; return true; } else { return false; } }; var normalizeNbsps = function(root2, pos) { return Optional.some(pos).filter(hasNbsp).bind(function(pos2) { var container = pos2.container(); var normalized = normalizeNbspAtStart(root2, container) || normalizeNbspInMiddleOfTextNode(container) || normalizeNbspAtEnd(root2, container); return normalized ? Optional.some(pos2) : Optional.none(); }); }; var normalizeNbspsInEditor = function(editor) { var root2 = SugarElement.fromDom(editor.getBody()); if (editor.selection.isCollapsed()) { normalizeNbsps(root2, CaretPosition.fromRangeStart(editor.selection.getRng())).each(function(pos) { editor.selection.setRng(pos.toRange()); }); } }; var normalizeContent = function(content, isStartOfContent, isEndOfContent) { var result = foldl(content, function(acc, c2) { if (isWhiteSpace(c2) || isNbsp(c2)) { if (acc.previousCharIsSpace || acc.str === "" && isStartOfContent || acc.str.length === content.length - 1 && isEndOfContent) { return { previousCharIsSpace: false, str: acc.str + nbsp }; } else { return { previousCharIsSpace: true, str: acc.str + " " }; } } else { return { previousCharIsSpace: false, str: acc.str + c2 }; } }, { previousCharIsSpace: false, str: "" }); return result.str; }; var normalize$1 = function(node, offset4, count3) { if (count3 === 0) { return; } var elm = SugarElement.fromDom(node); var root2 = ancestor$3(elm, isBlock$2).getOr(elm); var whitespace3 = node.data.slice(offset4, offset4 + count3); var isEndOfContent = offset4 + count3 >= node.data.length && needsToBeNbspRight(root2, CaretPosition(node, node.data.length)); var isStartOfContent = offset4 === 0 && needsToBeNbspLeft(root2, CaretPosition(node, 0)); node.replaceData(offset4, count3, normalizeContent(whitespace3, isStartOfContent, isEndOfContent)); }; var normalizeWhitespaceAfter = function(node, offset4) { var content = node.data.slice(offset4); var whitespaceCount = content.length - lTrim(content).length; normalize$1(node, offset4, whitespaceCount); }; var normalizeWhitespaceBefore = function(node, offset4) { var content = node.data.slice(0, offset4); var whitespaceCount = content.length - rTrim(content).length; normalize$1(node, offset4 - whitespaceCount, whitespaceCount); }; var mergeTextNodes = function(prevNode, nextNode, normalizeWhitespace, mergeToPrev) { if (mergeToPrev === void 0) { mergeToPrev = true; } var whitespaceOffset = rTrim(prevNode.data).length; var newNode = mergeToPrev ? prevNode : nextNode; var removeNode2 = mergeToPrev ? nextNode : prevNode; if (mergeToPrev) { newNode.appendData(removeNode2.data); } else { newNode.insertData(0, removeNode2.data); } remove$7(SugarElement.fromDom(removeNode2)); if (normalizeWhitespace) { normalizeWhitespaceAfter(newNode, whitespaceOffset); } return newNode; }; var needsReposition = function(pos, elm) { var container = pos.container(); var offset4 = pos.offset(); return CaretPosition.isTextPosition(pos) === false && container === elm.parentNode && offset4 > CaretPosition.before(elm).offset(); }; var reposition = function(elm, pos) { return needsReposition(pos, elm) ? CaretPosition(pos.container(), pos.offset() - 1) : pos; }; var beforeOrStartOf = function(node) { return isText$7(node) ? CaretPosition(node, 0) : CaretPosition.before(node); }; var afterOrEndOf = function(node) { return isText$7(node) ? CaretPosition(node, node.data.length) : CaretPosition.after(node); }; var getPreviousSiblingCaretPosition = function(elm) { if (isCaretCandidate$3(elm.previousSibling)) { return Optional.some(afterOrEndOf(elm.previousSibling)); } else { return elm.previousSibling ? lastPositionIn(elm.previousSibling) : Optional.none(); } }; var getNextSiblingCaretPosition = function(elm) { if (isCaretCandidate$3(elm.nextSibling)) { return Optional.some(beforeOrStartOf(elm.nextSibling)); } else { return elm.nextSibling ? firstPositionIn(elm.nextSibling) : Optional.none(); } }; var findCaretPositionBackwardsFromElm = function(rootElement, elm) { var startPosition = CaretPosition.before(elm.previousSibling ? elm.previousSibling : elm.parentNode); return prevPosition(rootElement, startPosition).fold(function() { return nextPosition(rootElement, CaretPosition.after(elm)); }, Optional.some); }; var findCaretPositionForwardsFromElm = function(rootElement, elm) { return nextPosition(rootElement, CaretPosition.after(elm)).fold(function() { return prevPosition(rootElement, CaretPosition.before(elm)); }, Optional.some); }; var findCaretPositionBackwards = function(rootElement, elm) { return getPreviousSiblingCaretPosition(elm).orThunk(function() { return getNextSiblingCaretPosition(elm); }).orThunk(function() { return findCaretPositionBackwardsFromElm(rootElement, elm); }); }; var findCaretPositionForward = function(rootElement, elm) { return getNextSiblingCaretPosition(elm).orThunk(function() { return getPreviousSiblingCaretPosition(elm); }).orThunk(function() { return findCaretPositionForwardsFromElm(rootElement, elm); }); }; var findCaretPosition = function(forward, rootElement, elm) { return forward ? findCaretPositionForward(rootElement, elm) : findCaretPositionBackwards(rootElement, elm); }; var findCaretPosOutsideElmAfterDelete = function(forward, rootElement, elm) { return findCaretPosition(forward, rootElement, elm).map(curry(reposition, elm)); }; var setSelection$1 = function(editor, forward, pos) { pos.fold(function() { editor.focus(); }, function(pos2) { editor.selection.setRng(pos2.toRange(), forward); }); }; var eqRawNode = function(rawNode) { return function(elm) { return elm.dom === rawNode; }; }; var isBlock = function(editor, elm) { return elm && has$22(editor.schema.getBlockElements(), name(elm)); }; var paddEmptyBlock = function(elm) { if (isEmpty$2(elm)) { var br = SugarElement.fromHtml('
'); empty2(elm); append$1(elm, br); return Optional.some(CaretPosition.before(br.dom)); } else { return Optional.none(); } }; var deleteNormalized = function(elm, afterDeletePosOpt, normalizeWhitespace) { var prevTextOpt = prevSibling(elm).filter(isText$8); var nextTextOpt = nextSibling(elm).filter(isText$8); remove$7(elm); return lift3(prevTextOpt, nextTextOpt, afterDeletePosOpt, function(prev2, next2, pos) { var prevNode = prev2.dom, nextNode = next2.dom; var offset4 = prevNode.data.length; mergeTextNodes(prevNode, nextNode, normalizeWhitespace); return pos.container() === nextNode ? CaretPosition(prevNode, offset4) : pos; }).orThunk(function() { if (normalizeWhitespace) { prevTextOpt.each(function(elm2) { return normalizeWhitespaceBefore(elm2.dom, elm2.dom.length); }); nextTextOpt.each(function(elm2) { return normalizeWhitespaceAfter(elm2.dom, 0); }); } return afterDeletePosOpt; }); }; var isInlineElement = function(editor, element) { return has$22(editor.schema.getTextInlineElements(), name(element)); }; var deleteElement$2 = function(editor, forward, elm, moveCaret2) { if (moveCaret2 === void 0) { moveCaret2 = true; } var afterDeletePos = findCaretPosOutsideElmAfterDelete(forward, editor.getBody(), elm.dom); var parentBlock = ancestor$3(elm, curry(isBlock, editor), eqRawNode(editor.getBody())); var normalizedAfterDeletePos = deleteNormalized(elm, afterDeletePos, isInlineElement(editor, elm)); if (editor.dom.isEmpty(editor.getBody())) { editor.setContent(""); editor.selection.setCursorLocation(); } else { parentBlock.bind(paddEmptyBlock).fold(function() { if (moveCaret2) { setSelection$1(editor, forward, normalizedAfterDeletePos); } }, function(paddPos) { if (moveCaret2) { setSelection$1(editor, forward, Optional.some(paddPos)); } }); } }; var isRootFromElement = function(root2) { return function(cur) { return eq2(root2, cur); }; }; var getTableCells = function(table2) { return descendants(table2, "td,th"); }; var getTableDetailsFromRange = function(rng, isRoot) { var getTable2 = function(node) { return getClosestTable(SugarElement.fromDom(node), isRoot); }; var startTable = getTable2(rng.startContainer); var endTable = getTable2(rng.endContainer); var isStartInTable = startTable.isSome(); var isEndInTable = endTable.isSome(); var isSameTable = lift2(startTable, endTable, eq2).getOr(false); var isMultiTable = !isSameTable && isStartInTable && isEndInTable; return { startTable, endTable, isStartInTable, isEndInTable, isSameTable, isMultiTable }; }; var tableCellRng = function(start2, end2) { return { start: start2, end: end2 }; }; var tableSelection = function(rng, table2, cells) { return { rng, table: table2, cells }; }; var deleteAction = Adt.generate([ { singleCellTable: [ "rng", "cell" ] }, { fullTable: ["table"] }, { partialTable: [ "cells", "outsideDetails" ] }, { multiTable: [ "startTableCells", "endTableCells", "betweenRng" ] } ]); var getClosestCell$1 = function(container, isRoot) { return closest$2(SugarElement.fromDom(container), "td,th", isRoot); }; var isExpandedCellRng = function(cellRng) { return !eq2(cellRng.start, cellRng.end); }; var getTableFromCellRng = function(cellRng, isRoot) { return getClosestTable(cellRng.start, isRoot).bind(function(startParentTable) { return getClosestTable(cellRng.end, isRoot).bind(function(endParentTable) { return someIf(eq2(startParentTable, endParentTable), startParentTable); }); }); }; var isSingleCellTable = function(cellRng, isRoot) { return !isExpandedCellRng(cellRng) && getTableFromCellRng(cellRng, isRoot).exists(function(table2) { var rows = table2.dom.rows; return rows.length === 1 && rows[0].cells.length === 1; }); }; var getCellRng = function(rng, isRoot) { var startCell = getClosestCell$1(rng.startContainer, isRoot); var endCell = getClosestCell$1(rng.endContainer, isRoot); return lift2(startCell, endCell, tableCellRng); }; var getCellRangeFromStartTable = function(isRoot) { return function(startCell) { return getClosestTable(startCell, isRoot).bind(function(table2) { return last$2(getTableCells(table2)).map(function(endCell) { return tableCellRng(startCell, endCell); }); }); }; }; var getCellRangeFromEndTable = function(isRoot) { return function(endCell) { return getClosestTable(endCell, isRoot).bind(function(table2) { return head(getTableCells(table2)).map(function(startCell) { return tableCellRng(startCell, endCell); }); }); }; }; var getTableSelectionFromCellRng = function(isRoot) { return function(cellRng) { return getTableFromCellRng(cellRng, isRoot).map(function(table2) { return tableSelection(cellRng, table2, getTableCells(table2)); }); }; }; var getTableSelections = function(cellRng, selectionDetails, rng, isRoot) { if (rng.collapsed || !cellRng.forall(isExpandedCellRng)) { return Optional.none(); } else if (selectionDetails.isSameTable) { var sameTableSelection = cellRng.bind(getTableSelectionFromCellRng(isRoot)); return Optional.some({ start: sameTableSelection, end: sameTableSelection }); } else { var startCell = getClosestCell$1(rng.startContainer, isRoot); var endCell = getClosestCell$1(rng.endContainer, isRoot); var startTableSelection = startCell.bind(getCellRangeFromStartTable(isRoot)).bind(getTableSelectionFromCellRng(isRoot)); var endTableSelection = endCell.bind(getCellRangeFromEndTable(isRoot)).bind(getTableSelectionFromCellRng(isRoot)); return Optional.some({ start: startTableSelection, end: endTableSelection }); } }; var getCellIndex = function(cells, cell) { return findIndex$2(cells, function(x2) { return eq2(x2, cell); }); }; var getSelectedCells = function(tableSelection2) { return lift2(getCellIndex(tableSelection2.cells, tableSelection2.rng.start), getCellIndex(tableSelection2.cells, tableSelection2.rng.end), function(startIndex, endIndex) { return tableSelection2.cells.slice(startIndex, endIndex + 1); }); }; var isSingleCellTableContentSelected = function(optCellRng, rng, isRoot) { return optCellRng.exists(function(cellRng) { return isSingleCellTable(cellRng, isRoot) && hasAllContentsSelected(cellRng.start, rng); }); }; var unselectCells = function(rng, selectionDetails) { var startTable = selectionDetails.startTable, endTable = selectionDetails.endTable; var otherContentRng = rng.cloneRange(); startTable.each(function(table2) { return otherContentRng.setStartAfter(table2.dom); }); endTable.each(function(table2) { return otherContentRng.setEndBefore(table2.dom); }); return otherContentRng; }; var handleSingleTable = function(cellRng, selectionDetails, rng, isRoot) { return getTableSelections(cellRng, selectionDetails, rng, isRoot).bind(function(_a3) { var start2 = _a3.start, end2 = _a3.end; return start2.or(end2); }).bind(function(tableSelection2) { var isSameTable = selectionDetails.isSameTable; var selectedCells = getSelectedCells(tableSelection2).getOr([]); if (isSameTable && tableSelection2.cells.length === selectedCells.length) { return Optional.some(deleteAction.fullTable(tableSelection2.table)); } else if (selectedCells.length > 0) { if (isSameTable) { return Optional.some(deleteAction.partialTable(selectedCells, Optional.none())); } else { var otherContentRng = unselectCells(rng, selectionDetails); return Optional.some(deleteAction.partialTable(selectedCells, Optional.some(__assign(__assign({}, selectionDetails), { rng: otherContentRng })))); } } else { return Optional.none(); } }); }; var handleMultiTable = function(cellRng, selectionDetails, rng, isRoot) { return getTableSelections(cellRng, selectionDetails, rng, isRoot).bind(function(_a3) { var start2 = _a3.start, end2 = _a3.end; var startTableSelectedCells = start2.bind(getSelectedCells).getOr([]); var endTableSelectedCells = end2.bind(getSelectedCells).getOr([]); if (startTableSelectedCells.length > 0 && endTableSelectedCells.length > 0) { var otherContentRng = unselectCells(rng, selectionDetails); return Optional.some(deleteAction.multiTable(startTableSelectedCells, endTableSelectedCells, otherContentRng)); } else { return Optional.none(); } }); }; var getActionFromRange = function(root2, rng) { var isRoot = isRootFromElement(root2); var optCellRng = getCellRng(rng, isRoot); var selectionDetails = getTableDetailsFromRange(rng, isRoot); if (isSingleCellTableContentSelected(optCellRng, rng, isRoot)) { return optCellRng.map(function(cellRng) { return deleteAction.singleCellTable(rng, cellRng.start); }); } else if (selectionDetails.isMultiTable) { return handleMultiTable(optCellRng, selectionDetails, rng, isRoot); } else { return handleSingleTable(optCellRng, selectionDetails, rng, isRoot); } }; var freefallRtl = function(root2) { var child2 = isComment$1(root2) ? prevSibling(root2) : lastChild(root2); return child2.bind(freefallRtl).orThunk(function() { return Optional.some(root2); }); }; var cleanCells = function(cells) { return each$k(cells, function(cell) { remove$6(cell, "contenteditable"); fillWithPaddingBr(cell); }); }; var getOutsideBlock = function(editor, container) { return Optional.from(editor.dom.getParent(container, editor.dom.isBlock)).map(SugarElement.fromDom); }; var handleEmptyBlock = function(editor, startInTable, emptyBlock2) { emptyBlock2.each(function(block) { if (startInTable) { remove$7(block); } else { fillWithPaddingBr(block); editor.selection.setCursorLocation(block.dom, 0); } }); }; var deleteContentInsideCell = function(editor, cell, rng, isFirstCellInSelection) { var insideTableRng = rng.cloneRange(); if (isFirstCellInSelection) { insideTableRng.setStart(rng.startContainer, rng.startOffset); insideTableRng.setEndAfter(cell.dom.lastChild); } else { insideTableRng.setStartBefore(cell.dom.firstChild); insideTableRng.setEnd(rng.endContainer, rng.endOffset); } deleteCellContents(editor, insideTableRng, cell, false); }; var collapseAndRestoreCellSelection = function(editor) { var selectedCells = getCellsFromEditor(editor); var selectedNode = SugarElement.fromDom(editor.selection.getNode()); if (isTableCell$5(selectedNode.dom) && isEmpty$2(selectedNode)) { editor.selection.setCursorLocation(selectedNode.dom, 0); } else { editor.selection.collapse(true); } if (selectedCells.length > 1 && exists(selectedCells, function(cell) { return eq2(cell, selectedNode); })) { set$12(selectedNode, "data-mce-selected", "1"); } }; var emptySingleTableCells = function(editor, cells, outsideDetails) { var editorRng = editor.selection.getRng(); var cellsToClean = outsideDetails.bind(function(_a3) { var rng = _a3.rng, isStartInTable = _a3.isStartInTable; var outsideBlock = getOutsideBlock(editor, isStartInTable ? rng.endContainer : rng.startContainer); rng.deleteContents(); handleEmptyBlock(editor, isStartInTable, outsideBlock.filter(isEmpty$2)); var endPointCell = isStartInTable ? cells[0] : cells[cells.length - 1]; deleteContentInsideCell(editor, endPointCell, editorRng, isStartInTable); if (!isEmpty$2(endPointCell)) { return Optional.some(isStartInTable ? cells.slice(1) : cells.slice(0, -1)); } else { return Optional.none(); } }).getOr(cells); cleanCells(cellsToClean); collapseAndRestoreCellSelection(editor); return true; }; var emptyMultiTableCells = function(editor, startTableCells, endTableCells, betweenRng) { var rng = editor.selection.getRng(); var startCell = startTableCells[0]; var endCell = endTableCells[endTableCells.length - 1]; deleteContentInsideCell(editor, startCell, rng, true); deleteContentInsideCell(editor, endCell, rng, false); var startTableCellsToClean = isEmpty$2(startCell) ? startTableCells : startTableCells.slice(1); var endTableCellsToClean = isEmpty$2(endCell) ? endTableCells : endTableCells.slice(0, -1); cleanCells(startTableCellsToClean.concat(endTableCellsToClean)); betweenRng.deleteContents(); collapseAndRestoreCellSelection(editor); return true; }; var deleteCellContents = function(editor, rng, cell, moveSelection2) { if (moveSelection2 === void 0) { moveSelection2 = true; } rng.deleteContents(); var lastNode = freefallRtl(cell).getOr(cell); var lastBlock = SugarElement.fromDom(editor.dom.getParent(lastNode.dom, editor.dom.isBlock)); if (isEmpty$2(lastBlock)) { fillWithPaddingBr(lastBlock); if (moveSelection2) { editor.selection.setCursorLocation(lastBlock.dom, 0); } } if (!eq2(cell, lastBlock)) { var additionalCleanupNodes = is$1(parent2(lastBlock), cell) ? [] : siblings(lastBlock); each$k(additionalCleanupNodes.concat(children(cell)), function(node) { if (!eq2(node, lastBlock) && !contains$1(node, lastBlock) && isEmpty$2(node)) { remove$7(node); } }); } return true; }; var deleteTableElement = function(editor, table2) { deleteElement$2(editor, false, table2); return true; }; var deleteCellRange = function(editor, rootElm, rng) { return getActionFromRange(rootElm, rng).map(function(action2) { return action2.fold(curry(deleteCellContents, editor), curry(deleteTableElement, editor), curry(emptySingleTableCells, editor), curry(emptyMultiTableCells, editor)); }); }; var deleteCaptionRange = function(editor, caption) { return emptyElement(editor, caption); }; var deleteTableRange = function(editor, rootElm, rng, startElm) { return getParentCaption(rootElm, startElm).fold(function() { return deleteCellRange(editor, rootElm, rng); }, function(caption) { return deleteCaptionRange(editor, caption); }).getOr(false); }; var deleteRange$2 = function(editor, startElm, selectedCells) { var rootNode = SugarElement.fromDom(editor.getBody()); var rng = editor.selection.getRng(); return selectedCells.length !== 0 ? emptySingleTableCells(editor, selectedCells, Optional.none()) : deleteTableRange(editor, rootNode, rng, startElm); }; var getParentCell = function(rootElm, elm) { return find$3(parentsAndSelf(elm, rootElm), isTableCell$4); }; var getParentCaption = function(rootElm, elm) { return find$3(parentsAndSelf(elm, rootElm), isTag("caption")); }; var deleteBetweenCells = function(editor, rootElm, forward, fromCell, from3) { return navigate(forward, editor.getBody(), from3).bind(function(to3) { return getParentCell(rootElm, SugarElement.fromDom(to3.getNode())).map(function(toCell) { return eq2(toCell, fromCell) === false; }); }); }; var emptyElement = function(editor, elm) { fillWithPaddingBr(elm); editor.selection.setCursorLocation(elm.dom, 0); return Optional.some(true); }; var isDeleteOfLastCharPos = function(fromCaption, forward, from3, to3) { return firstPositionIn(fromCaption.dom).bind(function(first2) { return lastPositionIn(fromCaption.dom).map(function(last3) { return forward ? from3.isEqual(first2) && to3.isEqual(last3) : from3.isEqual(last3) && to3.isEqual(first2); }); }).getOr(true); }; var emptyCaretCaption = function(editor, elm) { return emptyElement(editor, elm); }; var validateCaretCaption = function(rootElm, fromCaption, to3) { return getParentCaption(rootElm, SugarElement.fromDom(to3.getNode())).map(function(toCaption) { return eq2(toCaption, fromCaption) === false; }); }; var deleteCaretInsideCaption = function(editor, rootElm, forward, fromCaption, from3) { return navigate(forward, editor.getBody(), from3).bind(function(to3) { return isDeleteOfLastCharPos(fromCaption, forward, from3, to3) ? emptyCaretCaption(editor, fromCaption) : validateCaretCaption(rootElm, fromCaption, to3); }).or(Optional.some(true)); }; var deleteCaretCells = function(editor, forward, rootElm, startElm) { var from3 = CaretPosition.fromRangeStart(editor.selection.getRng()); return getParentCell(rootElm, startElm).bind(function(fromCell) { return isEmpty$2(fromCell) ? emptyElement(editor, fromCell) : deleteBetweenCells(editor, rootElm, forward, fromCell, from3); }).getOr(false); }; var deleteCaretCaption = function(editor, forward, rootElm, fromCaption) { var from3 = CaretPosition.fromRangeStart(editor.selection.getRng()); return isEmpty$2(fromCaption) ? emptyElement(editor, fromCaption) : deleteCaretInsideCaption(editor, rootElm, forward, fromCaption, from3); }; var isNearTable = function(forward, pos) { return forward ? isBeforeTable(pos) : isAfterTable(pos); }; var isBeforeOrAfterTable = function(editor, forward) { var fromPos = CaretPosition.fromRangeStart(editor.selection.getRng()); return isNearTable(forward, fromPos) || fromPosition(forward, editor.getBody(), fromPos).exists(function(pos) { return isNearTable(forward, pos); }); }; var deleteCaret$3 = function(editor, forward, startElm) { var rootElm = SugarElement.fromDom(editor.getBody()); return getParentCaption(rootElm, startElm).fold(function() { return deleteCaretCells(editor, forward, rootElm, startElm) || isBeforeOrAfterTable(editor, forward); }, function(fromCaption) { return deleteCaretCaption(editor, forward, rootElm, fromCaption).getOr(false); }); }; var backspaceDelete$9 = function(editor, forward) { var startElm = SugarElement.fromDom(editor.selection.getStart(true)); var cells = getCellsFromEditor(editor); return editor.selection.isCollapsed() && cells.length === 0 ? deleteCaret$3(editor, forward, startElm) : deleteRange$2(editor, startElm, cells); }; var createRange = function(sc, so, ec, eo) { var rng = document.createRange(); rng.setStart(sc, so); rng.setEnd(ec, eo); return rng; }; var normalizeBlockSelectionRange = function(rng) { var startPos = CaretPosition.fromRangeStart(rng); var endPos = CaretPosition.fromRangeEnd(rng); var rootNode = rng.commonAncestorContainer; return fromPosition(false, rootNode, endPos).map(function(newEndPos) { if (!isInSameBlock(startPos, endPos, rootNode) && isInSameBlock(startPos, newEndPos, rootNode)) { return createRange(startPos.container(), startPos.offset(), newEndPos.container(), newEndPos.offset()); } else { return rng; } }).getOr(rng); }; var normalize2 = function(rng) { return rng.collapsed ? rng : normalizeBlockSelectionRange(rng); }; var hasOnlyOneChild$1 = function(node) { return node.firstChild && node.firstChild === node.lastChild; }; var isPaddingNode = function(node) { return node.name === "br" || node.value === nbsp; }; var isPaddedEmptyBlock = function(schema2, node) { var blockElements = schema2.getBlockElements(); return blockElements[node.name] && hasOnlyOneChild$1(node) && isPaddingNode(node.firstChild); }; var isEmptyFragmentElement = function(schema2, node) { var nonEmptyElements = schema2.getNonEmptyElements(); return node && (node.isEmpty(nonEmptyElements) || isPaddedEmptyBlock(schema2, node)); }; var isListFragment = function(schema2, fragment) { var firstChild2 = fragment.firstChild; var lastChild2 = fragment.lastChild; if (firstChild2 && firstChild2.name === "meta") { firstChild2 = firstChild2.next; } if (lastChild2 && lastChild2.attr("id") === "mce_marker") { lastChild2 = lastChild2.prev; } if (isEmptyFragmentElement(schema2, lastChild2)) { lastChild2 = lastChild2.prev; } if (!firstChild2 || firstChild2 !== lastChild2) { return false; } return firstChild2.name === "ul" || firstChild2.name === "ol"; }; var cleanupDomFragment = function(domFragment) { var firstChild2 = domFragment.firstChild; var lastChild2 = domFragment.lastChild; if (firstChild2 && firstChild2.nodeName === "META") { firstChild2.parentNode.removeChild(firstChild2); } if (lastChild2 && lastChild2.id === "mce_marker") { lastChild2.parentNode.removeChild(lastChild2); } return domFragment; }; var toDomFragment = function(dom2, serializer, fragment) { var html = serializer.serialize(fragment); var domFragment = dom2.createFragment(html); return cleanupDomFragment(domFragment); }; var listItems = function(elm) { return filter$4(elm.childNodes, function(child2) { return child2.nodeName === "LI"; }); }; var isPadding = function(node) { return node.data === nbsp || isBr$5(node); }; var isListItemPadded = function(node) { return node && node.firstChild && node.firstChild === node.lastChild && isPadding(node.firstChild); }; var isEmptyOrPadded = function(elm) { return !elm.firstChild || isListItemPadded(elm); }; var trimListItems = function(elms) { return elms.length > 0 && isEmptyOrPadded(elms[elms.length - 1]) ? elms.slice(0, -1) : elms; }; var getParentLi = function(dom2, node) { var parentBlock = dom2.getParent(node, dom2.isBlock); return parentBlock && parentBlock.nodeName === "LI" ? parentBlock : null; }; var isParentBlockLi = function(dom2, node) { return !!getParentLi(dom2, node); }; var getSplit = function(parentNode, rng) { var beforeRng = rng.cloneRange(); var afterRng = rng.cloneRange(); beforeRng.setStartBefore(parentNode); afterRng.setEndAfter(parentNode); return [ beforeRng.cloneContents(), afterRng.cloneContents() ]; }; var findFirstIn = function(node, rootNode) { var caretPos = CaretPosition.before(node); var caretWalker = CaretWalker(rootNode); var newCaretPos = caretWalker.next(caretPos); return newCaretPos ? newCaretPos.toRange() : null; }; var findLastOf = function(node, rootNode) { var caretPos = CaretPosition.after(node); var caretWalker = CaretWalker(rootNode); var newCaretPos = caretWalker.prev(caretPos); return newCaretPos ? newCaretPos.toRange() : null; }; var insertMiddle = function(target, elms, rootNode, rng) { var parts = getSplit(target, rng); var parentElm = target.parentNode; parentElm.insertBefore(parts[0], target); Tools.each(elms, function(li) { parentElm.insertBefore(li, target); }); parentElm.insertBefore(parts[1], target); parentElm.removeChild(target); return findLastOf(elms[elms.length - 1], rootNode); }; var insertBefore$1 = function(target, elms, rootNode) { var parentElm = target.parentNode; Tools.each(elms, function(elm) { parentElm.insertBefore(elm, target); }); return findFirstIn(target, rootNode); }; var insertAfter$1 = function(target, elms, rootNode, dom2) { dom2.insertAfter(elms.reverse(), target); return findLastOf(elms[0], rootNode); }; var insertAtCaret$1 = function(serializer, dom2, rng, fragment) { var domFragment = toDomFragment(dom2, serializer, fragment); var liTarget = getParentLi(dom2, rng.startContainer); var liElms = trimListItems(listItems(domFragment.firstChild)); var BEGINNING = 1, END = 2; var rootNode = dom2.getRoot(); var isAt = function(location) { var caretPos = CaretPosition.fromRangeStart(rng); var caretWalker = CaretWalker(dom2.getRoot()); var newPos = location === BEGINNING ? caretWalker.prev(caretPos) : caretWalker.next(caretPos); return newPos ? getParentLi(dom2, newPos.getNode()) !== liTarget : true; }; if (isAt(BEGINNING)) { return insertBefore$1(liTarget, liElms, rootNode); } else if (isAt(END)) { return insertAfter$1(liTarget, liElms, rootNode, dom2); } return insertMiddle(liTarget, liElms, rootNode, rng); }; var trimOrPadLeftRight = function(dom2, rng, html) { var root2 = SugarElement.fromDom(dom2.getRoot()); if (needsToBeNbspLeft(root2, CaretPosition.fromRangeStart(rng))) { html = html.replace(/^ /, " "); } else { html = html.replace(/^ /, " "); } if (needsToBeNbspRight(root2, CaretPosition.fromRangeEnd(rng))) { html = html.replace(/( | )()?$/, " "); } else { html = html.replace(/ ()?$/, " "); } return html; }; var isTableCell$1 = isTableCell$5; var isTableCellContentSelected = function(dom2, rng, cell) { if (cell !== null) { var endCell = dom2.getParent(rng.endContainer, isTableCell$1); return cell === endCell && hasAllContentsSelected(SugarElement.fromDom(cell), rng); } else { return false; } }; var validInsertion = function(editor, value25, parentNode) { if (parentNode.getAttribute("data-mce-bogus") === "all") { parentNode.parentNode.insertBefore(editor.dom.createFragment(value25), parentNode); } else { var node = parentNode.firstChild; var node2 = parentNode.lastChild; if (!node || node === node2 && node.nodeName === "BR") { editor.dom.setHTML(parentNode, value25); } else { editor.selection.setContent(value25); } } }; var trimBrsFromTableCell = function(dom2, elm) { Optional.from(dom2.getParent(elm, "td,th")).map(SugarElement.fromDom).each(trimBlockTrailingBr); }; var reduceInlineTextElements = function(editor, merge5) { var textInlineElements = editor.schema.getTextInlineElements(); var dom2 = editor.dom; if (merge5) { var root_1 = editor.getBody(); var elementUtils_1 = ElementUtils(dom2); Tools.each(dom2.select("*[data-mce-fragment]"), function(node) { var isInline2 = isNonNullable(textInlineElements[node.nodeName.toLowerCase()]); if (isInline2 && hasInheritableStyles(dom2, node)) { for (var parentNode = node.parentNode; isNonNullable(parentNode) && parentNode !== root_1; parentNode = parentNode.parentNode) { var styleConflict = hasStyleConflict(dom2, node, parentNode); if (styleConflict) { break; } if (elementUtils_1.compare(parentNode, node)) { dom2.remove(node, true); break; } } } }); } }; var markFragmentElements = function(fragment) { var node = fragment; while (node = node.walk()) { if (node.type === 1) { node.attr("data-mce-fragment", "1"); } } }; var unmarkFragmentElements = function(elm) { Tools.each(elm.getElementsByTagName("*"), function(elm2) { elm2.removeAttribute("data-mce-fragment"); }); }; var isPartOfFragment = function(node) { return !!node.getAttribute("data-mce-fragment"); }; var canHaveChildren = function(editor, node) { return node && !editor.schema.getShortEndedElements()[node.nodeName]; }; var moveSelectionToMarker = function(editor, marker) { var nextRng; var dom2 = editor.dom; var selection = editor.selection; if (!marker) { return; } selection.scrollIntoView(marker); var parentEditableElm = getContentEditableRoot$1(editor.getBody(), marker); if (dom2.getContentEditable(parentEditableElm) === "false") { dom2.remove(marker); selection.select(parentEditableElm); return; } var rng = dom2.createRng(); var node = marker.previousSibling; if (isText$7(node)) { rng.setStart(node, node.nodeValue.length); if (!Env.ie) { var node2 = marker.nextSibling; if (isText$7(node2)) { node.appendData(node2.data); node2.parentNode.removeChild(node2); } } } else { rng.setStartBefore(marker); rng.setEndBefore(marker); } var findNextCaretRng = function(rng2) { var caretPos = CaretPosition.fromRangeStart(rng2); var caretWalker = CaretWalker(editor.getBody()); caretPos = caretWalker.next(caretPos); if (caretPos) { return caretPos.toRange(); } }; var parentBlock = dom2.getParent(marker, dom2.isBlock); dom2.remove(marker); if (parentBlock && dom2.isEmpty(parentBlock)) { editor.$(parentBlock).empty(); rng.setStart(parentBlock, 0); rng.setEnd(parentBlock, 0); if (!isTableCell$1(parentBlock) && !isPartOfFragment(parentBlock) && (nextRng = findNextCaretRng(rng))) { rng = nextRng; dom2.remove(parentBlock); } else { dom2.add(parentBlock, dom2.create("br", { "data-mce-bogus": "1" })); } } selection.setRng(rng); }; var deleteSelectedContent = function(editor) { var dom2 = editor.dom; var rng = normalize2(editor.selection.getRng()); editor.selection.setRng(rng); var startCell = dom2.getParent(rng.startContainer, isTableCell$1); if (isTableCellContentSelected(dom2, rng, startCell)) { deleteCellContents(editor, rng, SugarElement.fromDom(startCell)); } else { editor.getDoc().execCommand("Delete", false, null); } }; var insertHtmlAtCaret = function(editor, value25, details) { var parentNode; var rng, node; var selection = editor.selection; var dom2 = editor.dom; if (/^ | $/.test(value25)) { value25 = trimOrPadLeftRight(dom2, selection.getRng(), value25); } var parser = editor.parser; var merge5 = details.merge; var serializer = HtmlSerializer({ validate: shouldValidate(editor) }, editor.schema); var bookmarkHtml = ''; var args = editor.fire("BeforeSetContent", { content: value25, format: "html", selection: true, paste: details.paste }); if (args.isDefaultPrevented()) { editor.fire("SetContent", { content: args.content, format: "html", selection: true, paste: details.paste }); return; } value25 = args.content; if (value25.indexOf("{$caret}") === -1) { value25 += "{$caret}"; } value25 = value25.replace(/\{\$caret\}/, bookmarkHtml); rng = selection.getRng(); var caretElement = rng.startContainer || (rng.parentElement ? rng.parentElement() : null); var body = editor.getBody(); if (caretElement === body && selection.isCollapsed()) { if (dom2.isBlock(body.firstChild) && canHaveChildren(editor, body.firstChild) && dom2.isEmpty(body.firstChild)) { rng = dom2.createRng(); rng.setStart(body.firstChild, 0); rng.setEnd(body.firstChild, 0); selection.setRng(rng); } } if (!selection.isCollapsed()) { deleteSelectedContent(editor); } parentNode = selection.getNode(); var parserArgs = { context: parentNode.nodeName.toLowerCase(), data: details.data, insert: true }; var fragment = parser.parse(value25, parserArgs); if (details.paste === true && isListFragment(editor.schema, fragment) && isParentBlockLi(dom2, parentNode)) { rng = insertAtCaret$1(serializer, dom2, selection.getRng(), fragment); selection.setRng(rng); editor.fire("SetContent", args); return; } markFragmentElements(fragment); node = fragment.lastChild; if (node.attr("id") === "mce_marker") { var marker = node; for (node = node.prev; node; node = node.walk(true)) { if (node.type === 3 || !dom2.isBlock(node.name)) { if (editor.schema.isValidChild(node.parent.name, "span")) { node.parent.insert(marker, node, node.name === "br"); } break; } } } editor._selectionOverrides.showBlockCaretContainer(parentNode); if (!parserArgs.invalid) { value25 = serializer.serialize(fragment); validInsertion(editor, value25, parentNode); } else { editor.selection.setContent(bookmarkHtml); parentNode = selection.getNode(); var rootNode = editor.getBody(); if (parentNode.nodeType === 9) { parentNode = node = rootNode; } else { node = parentNode; } while (node !== rootNode) { parentNode = node; node = node.parentNode; } value25 = parentNode === rootNode ? rootNode.innerHTML : dom2.getOuterHTML(parentNode); value25 = serializer.serialize(parser.parse(value25.replace(//i, function() { return serializer.serialize(fragment); }))); if (parentNode === rootNode) { dom2.setHTML(rootNode, value25); } else { dom2.setOuterHTML(parentNode, value25); } } reduceInlineTextElements(editor, merge5); moveSelectionToMarker(editor, dom2.get("mce_marker")); unmarkFragmentElements(editor.getBody()); trimBrsFromTableCell(dom2, selection.getStart()); editor.fire("SetContent", args); editor.addVisual(); }; var traverse = function(node, fn) { fn(node); if (node.firstChild) { traverse(node.firstChild, fn); } if (node.next) { traverse(node.next, fn); } }; var findMatchingNodes = function(nodeFilters, attributeFilters, node) { var nodeMatches = {}; var attrMatches = {}; var matches2 = []; if (node.firstChild) { traverse(node.firstChild, function(node2) { each$k(nodeFilters, function(filter2) { if (filter2.name === node2.name) { if (nodeMatches[filter2.name]) { nodeMatches[filter2.name].nodes.push(node2); } else { nodeMatches[filter2.name] = { filter: filter2, nodes: [node2] }; } } }); each$k(attributeFilters, function(filter2) { if (typeof node2.attr(filter2.name) === "string") { if (attrMatches[filter2.name]) { attrMatches[filter2.name].nodes.push(node2); } else { attrMatches[filter2.name] = { filter: filter2, nodes: [node2] }; } } }); }); } for (var name_1 in nodeMatches) { if (has$22(nodeMatches, name_1)) { matches2.push(nodeMatches[name_1]); } } for (var name_2 in attrMatches) { if (has$22(attrMatches, name_2)) { matches2.push(attrMatches[name_2]); } } return matches2; }; var filter$1 = function(nodeFilters, attributeFilters, node) { var matches2 = findMatchingNodes(nodeFilters, attributeFilters, node); each$k(matches2, function(match7) { each$k(match7.filter.callbacks, function(callback2) { callback2(match7.nodes, match7.filter.name, {}); }); }); }; var defaultFormat$1 = "html"; var isTreeNode2 = function(content) { return content instanceof AstNode; }; var moveSelection = function(editor) { if (hasFocus(editor)) { firstPositionIn(editor.getBody()).each(function(pos) { var node = pos.getNode(); var caretPos = isTable$3(node) ? firstPositionIn(node).getOr(pos) : pos; editor.selection.setRng(caretPos.toRange()); }); } }; var setEditorHtml = function(editor, html, noSelection) { editor.dom.setHTML(editor.getBody(), html); if (noSelection !== true) { moveSelection(editor); } }; var setContentString = function(editor, body, content, args) { if (content.length === 0 || /^\s+$/.test(content)) { var padd = '
'; if (body.nodeName === "TABLE") { content = "" + padd + ""; } else if (/^(UL|OL)$/.test(body.nodeName)) { content = "
  • " + padd + "
  • "; } var forcedRootBlockName = getForcedRootBlock(editor); if (forcedRootBlockName && editor.schema.isValidChild(body.nodeName.toLowerCase(), forcedRootBlockName.toLowerCase())) { content = padd; content = editor.dom.createHTML(forcedRootBlockName, getForcedRootBlockAttrs(editor), content); } else if (!content) { content = '
    '; } setEditorHtml(editor, content, args.no_selection); editor.fire("SetContent", args); } else { if (args.format !== "raw") { content = HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(editor.parser.parse(content, { isRootContent: true, insert: true })); } args.content = isWsPreserveElement(SugarElement.fromDom(body)) ? content : Tools.trim(content); setEditorHtml(editor, args.content, args.no_selection); if (!args.no_events) { editor.fire("SetContent", args); } } return args.content; }; var setContentTree = function(editor, body, content, args) { filter$1(editor.parser.getNodeFilters(), editor.parser.getAttributeFilters(), content); var html = HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(content); args.content = isWsPreserveElement(SugarElement.fromDom(body)) ? html : Tools.trim(html); setEditorHtml(editor, args.content, args.no_selection); if (!args.no_events) { editor.fire("SetContent", args); } return content; }; var setupArgs$2 = function(args, content) { return __assign(__assign({ format: defaultFormat$1 }, args), { set: true, content: isTreeNode2(content) ? "" : content }); }; var setContentInternal = function(editor, content, args) { var defaultedArgs = setupArgs$2(args, content); var updatedArgs = args.no_events ? defaultedArgs : editor.fire("BeforeSetContent", defaultedArgs); if (!isTreeNode2(content)) { content = updatedArgs.content; } return Optional.from(editor.getBody()).fold(constant2(content), function(body) { return isTreeNode2(content) ? setContentTree(editor, body, content, updatedArgs) : setContentString(editor, body, content, updatedArgs); }); }; var sibling = function(scope, predicate) { return sibling$2(scope, predicate).isSome(); }; var ensureIsRoot = function(isRoot) { return isFunction3(isRoot) ? isRoot : never; }; var ancestor = function(scope, transform2, isRoot) { var element = scope.dom; var stop3 = ensureIsRoot(isRoot); while (element.parentNode) { element = element.parentNode; var el = SugarElement.fromDom(element); var transformed = transform2(el); if (transformed.isSome()) { return transformed; } else if (stop3(el)) { break; } } return Optional.none(); }; var closest$1 = function(scope, transform2, isRoot) { var current2 = transform2(scope); var stop3 = ensureIsRoot(isRoot); return current2.orThunk(function() { return stop3(scope) ? Optional.none() : ancestor(scope, transform2, stop3); }); }; var isEq$3 = isEq$5; var matchesUnInheritedFormatSelector = function(ed, node, name2) { var formatList = ed.formatter.get(name2); if (formatList) { for (var i2 = 0; i2 < formatList.length; i2++) { var format3 = formatList[i2]; if (isSelectorFormat(format3) && format3.inherit === false && ed.dom.is(node, format3.selector)) { return true; } } } return false; }; var matchParents = function(editor, node, name2, vars, similar) { var root2 = editor.dom.getRoot(); if (node === root2) { return false; } node = editor.dom.getParent(node, function(node2) { if (matchesUnInheritedFormatSelector(editor, node2, name2)) { return true; } return node2.parentNode === root2 || !!matchNode(editor, node2, name2, vars, true); }); return !!matchNode(editor, node, name2, vars, similar); }; var matchName$1 = function(dom2, node, format3) { if (isEq$3(node, format3.inline)) { return true; } if (isEq$3(node, format3.block)) { return true; } if (format3.selector) { return node.nodeType === 1 && dom2.is(node, format3.selector); } }; var matchItems = function(dom2, node, format3, itemName, similar, vars) { var items = format3[itemName]; if (isFunction3(format3.onmatch)) { return format3.onmatch(node, format3, itemName); } if (items) { if (isUndefined2(items.length)) { for (var key2 in items) { if (has$22(items, key2)) { var value25 = itemName === "attributes" ? dom2.getAttrib(node, key2) : getStyle3(dom2, node, key2); var expectedValue = replaceVars(items[key2], vars); var isEmptyValue2 = isNullable(value25) || isEmpty$3(value25); if (isEmptyValue2 && isNullable(expectedValue)) { continue; } if (similar && isEmptyValue2 && !format3.exact) { return false; } if ((!similar || format3.exact) && !isEq$3(value25, normalizeStyleValue(dom2, expectedValue, key2))) { return false; } } } } else { for (var i2 = 0; i2 < items.length; i2++) { if (itemName === "attributes" ? dom2.getAttrib(node, items[i2]) : getStyle3(dom2, node, items[i2])) { return true; } } } } return true; }; var matchNode = function(ed, node, name2, vars, similar) { var formatList = ed.formatter.get(name2); var dom2 = ed.dom; if (formatList && node) { for (var i2 = 0; i2 < formatList.length; i2++) { var format3 = formatList[i2]; if (matchName$1(ed.dom, node, format3) && matchItems(dom2, node, format3, "attributes", similar, vars) && matchItems(dom2, node, format3, "styles", similar, vars)) { var classes3 = format3.classes; if (classes3) { for (var x2 = 0; x2 < classes3.length; x2++) { if (!ed.dom.hasClass(node, replaceVars(classes3[x2], vars))) { return; } } } return format3; } } } }; var match$2 = function(editor, name2, vars, node, similar) { if (node) { return matchParents(editor, node, name2, vars, similar); } node = editor.selection.getNode(); if (matchParents(editor, node, name2, vars, similar)) { return true; } var startNode = editor.selection.getStart(); if (startNode !== node) { if (matchParents(editor, startNode, name2, vars, similar)) { return true; } } return false; }; var matchAll = function(editor, names2, vars) { var matchedFormatNames = []; var checkedMap = {}; var startElement = editor.selection.getStart(); editor.dom.getParent(startElement, function(node) { for (var i2 = 0; i2 < names2.length; i2++) { var name_1 = names2[i2]; if (!checkedMap[name_1] && matchNode(editor, node, name_1, vars)) { checkedMap[name_1] = true; matchedFormatNames.push(name_1); } } }, editor.dom.getRoot()); return matchedFormatNames; }; var closest = function(editor, names2) { var isRoot = function(elm) { return eq2(elm, SugarElement.fromDom(editor.getBody())); }; var match7 = function(elm, name2) { return matchNode(editor, elm.dom, name2) ? Optional.some(name2) : Optional.none(); }; return Optional.from(editor.selection.getStart(true)).bind(function(rawElm) { return closest$1(SugarElement.fromDom(rawElm), function(elm) { return findMap(names2, function(name2) { return match7(elm, name2); }); }, isRoot); }).getOrNull(); }; var canApply = function(editor, name2) { var formatList = editor.formatter.get(name2); var dom2 = editor.dom; if (formatList) { var startNode = editor.selection.getStart(); var parents2 = getParents$2(dom2, startNode); for (var x2 = formatList.length - 1; x2 >= 0; x2--) { var format3 = formatList[x2]; if (!isSelectorFormat(format3) || isNonNullable(format3.defaultBlock)) { return true; } for (var i2 = parents2.length - 1; i2 >= 0; i2--) { if (dom2.is(parents2[i2], format3.selector)) { return true; } } } } return false; }; var matchAllOnNode = function(editor, node, formatNames) { return foldl(formatNames, function(acc, name2) { var matchSimilar = isVariableFormatName(editor, name2); if (editor.formatter.matchNode(node, name2, {}, matchSimilar)) { return acc.concat([name2]); } else { return acc; } }, []); }; var ZWSP = ZWSP$1, CARET_ID = "_mce_caret"; var importNode = function(ownerDocument, node) { return ownerDocument.importNode(node, true); }; var getEmptyCaretContainers = function(node) { var nodes2 = []; while (node) { if (node.nodeType === 3 && node.nodeValue !== ZWSP || node.childNodes.length > 1) { return []; } if (node.nodeType === 1) { nodes2.push(node); } node = node.firstChild; } return nodes2; }; var isCaretContainerEmpty = function(node) { return getEmptyCaretContainers(node).length > 0; }; var findFirstTextNode = function(node) { if (node) { var walker = new DomTreeWalker(node, node); for (node = walker.current(); node; node = walker.next()) { if (isText$7(node)) { return node; } } } return null; }; var createCaretContainer = function(fill) { var caretContainer = SugarElement.fromTag("span"); setAll$1(caretContainer, { "id": CARET_ID, "data-mce-bogus": "1", "data-mce-type": "format-caret" }); if (fill) { append$1(caretContainer, SugarElement.fromText(ZWSP)); } return caretContainer; }; var trimZwspFromCaretContainer = function(caretContainerNode) { var textNode = findFirstTextNode(caretContainerNode); if (textNode && textNode.nodeValue.charAt(0) === ZWSP) { textNode.deleteData(0, 1); } return textNode; }; var removeCaretContainerNode = function(editor, node, moveCaret2) { if (moveCaret2 === void 0) { moveCaret2 = true; } var dom2 = editor.dom, selection = editor.selection; if (isCaretContainerEmpty(node)) { deleteElement$2(editor, false, SugarElement.fromDom(node), moveCaret2); } else { var rng = selection.getRng(); var block = dom2.getParent(node, dom2.isBlock); var startContainer = rng.startContainer; var startOffset = rng.startOffset; var endContainer = rng.endContainer; var endOffset = rng.endOffset; var textNode = trimZwspFromCaretContainer(node); dom2.remove(node, true); if (startContainer === textNode && startOffset > 0) { rng.setStart(textNode, startOffset - 1); } if (endContainer === textNode && endOffset > 0) { rng.setEnd(textNode, endOffset - 1); } if (block && dom2.isEmpty(block)) { fillWithPaddingBr(SugarElement.fromDom(block)); } selection.setRng(rng); } }; var removeCaretContainer = function(editor, node, moveCaret2) { if (moveCaret2 === void 0) { moveCaret2 = true; } var dom2 = editor.dom, selection = editor.selection; if (!node) { node = getParentCaretContainer(editor.getBody(), selection.getStart()); if (!node) { while (node = dom2.get(CARET_ID)) { removeCaretContainerNode(editor, node, false); } } } else { removeCaretContainerNode(editor, node, moveCaret2); } }; var insertCaretContainerNode = function(editor, caretContainer, formatNode) { var dom2 = editor.dom, block = dom2.getParent(formatNode, curry(isTextBlock$1, editor)); if (block && dom2.isEmpty(block)) { formatNode.parentNode.replaceChild(caretContainer, formatNode); } else { removeTrailingBr(SugarElement.fromDom(formatNode)); if (dom2.isEmpty(formatNode)) { formatNode.parentNode.replaceChild(caretContainer, formatNode); } else { dom2.insertAfter(caretContainer, formatNode); } } }; var appendNode = function(parentNode, node) { parentNode.appendChild(node); return node; }; var insertFormatNodesIntoCaretContainer = function(formatNodes, caretContainer) { var innerMostFormatNode = foldr(formatNodes, function(parentNode, formatNode) { return appendNode(parentNode, formatNode.cloneNode(false)); }, caretContainer); return appendNode(innerMostFormatNode, innerMostFormatNode.ownerDocument.createTextNode(ZWSP)); }; var cleanFormatNode = function(editor, caretContainer, formatNode, name2, vars, similar) { var formatter = editor.formatter; var dom2 = editor.dom; var validFormats = filter$4(keys2(formatter.get()), function(formatName) { return formatName !== name2 && !contains$2(formatName, "removeformat"); }); var matchedFormats = matchAllOnNode(editor, formatNode, validFormats); var uniqueFormats = filter$4(matchedFormats, function(fmtName) { return !areSimilarFormats(editor, fmtName, name2); }); if (uniqueFormats.length > 0) { var clonedFormatNode = formatNode.cloneNode(false); dom2.add(caretContainer, clonedFormatNode); formatter.remove(name2, vars, clonedFormatNode, similar); dom2.remove(clonedFormatNode); return Optional.some(clonedFormatNode); } else { return Optional.none(); } }; var applyCaretFormat = function(editor, name2, vars) { var caretContainer, textNode; var selection = editor.selection; var selectionRng = selection.getRng(); var offset4 = selectionRng.startOffset; var container = selectionRng.startContainer; var text = container.nodeValue; caretContainer = getParentCaretContainer(editor.getBody(), selection.getStart()); if (caretContainer) { textNode = findFirstTextNode(caretContainer); } var wordcharRegex = /[^\s\u00a0\u00ad\u200b\ufeff]/; if (text && offset4 > 0 && offset4 < text.length && wordcharRegex.test(text.charAt(offset4)) && wordcharRegex.test(text.charAt(offset4 - 1))) { var bookmark = selection.getBookmark(); selectionRng.collapse(true); var rng = expandRng(editor, selectionRng, editor.formatter.get(name2)); rng = split2(rng); editor.formatter.apply(name2, vars, rng); selection.moveToBookmark(bookmark); } else { if (!caretContainer || textNode.nodeValue !== ZWSP) { caretContainer = importNode(editor.getDoc(), createCaretContainer(true).dom); textNode = caretContainer.firstChild; selectionRng.insertNode(caretContainer); offset4 = 1; editor.formatter.apply(name2, vars, caretContainer); } else { editor.formatter.apply(name2, vars, caretContainer); } selection.setCursorLocation(textNode, offset4); } }; var removeCaretFormat = function(editor, name2, vars, similar) { var dom2 = editor.dom; var selection = editor.selection; var hasContentAfter, node, formatNode; var parents2 = []; var rng = selection.getRng(); var container = rng.startContainer; var offset4 = rng.startOffset; node = container; if (container.nodeType === 3) { if (offset4 !== container.nodeValue.length) { hasContentAfter = true; } node = node.parentNode; } while (node) { if (matchNode(editor, node, name2, vars, similar)) { formatNode = node; break; } if (node.nextSibling) { hasContentAfter = true; } parents2.push(node); node = node.parentNode; } if (!formatNode) { return; } if (hasContentAfter) { var bookmark = selection.getBookmark(); rng.collapse(true); var expandedRng = expandRng(editor, rng, editor.formatter.get(name2), true); expandedRng = split2(expandedRng); editor.formatter.remove(name2, vars, expandedRng, similar); selection.moveToBookmark(bookmark); } else { var caretContainer = getParentCaretContainer(editor.getBody(), formatNode); var newCaretContainer = createCaretContainer(false).dom; insertCaretContainerNode(editor, newCaretContainer, caretContainer !== null ? caretContainer : formatNode); var cleanedFormatNode = cleanFormatNode(editor, newCaretContainer, formatNode, name2, vars, similar); var caretTextNode = insertFormatNodesIntoCaretContainer(parents2.concat(cleanedFormatNode.toArray()), newCaretContainer); removeCaretContainerNode(editor, caretContainer, false); selection.setCursorLocation(caretTextNode, 1); if (dom2.isEmpty(formatNode)) { dom2.remove(formatNode); } } }; var disableCaretContainer = function(editor, keyCode) { var selection = editor.selection, body = editor.getBody(); removeCaretContainer(editor, null, false); if ((keyCode === 8 || keyCode === 46) && selection.isCollapsed() && selection.getStart().innerHTML === ZWSP) { removeCaretContainer(editor, getParentCaretContainer(body, selection.getStart())); } if (keyCode === 37 || keyCode === 39) { removeCaretContainer(editor, getParentCaretContainer(body, selection.getStart())); } }; var setup$k = function(editor) { editor.on("mouseup keydown", function(e2) { disableCaretContainer(editor, e2.keyCode); }); }; var replaceWithCaretFormat = function(targetNode, formatNodes) { var caretContainer = createCaretContainer(false); var innerMost = insertFormatNodesIntoCaretContainer(formatNodes, caretContainer.dom); before$4(SugarElement.fromDom(targetNode), caretContainer); remove$7(SugarElement.fromDom(targetNode)); return CaretPosition(innerMost, 0); }; var isFormatElement = function(editor, element) { var inlineElements = editor.schema.getTextInlineElements(); return has$22(inlineElements, name(element)) && !isCaretNode(element.dom) && !isBogus$2(element.dom); }; var isEmptyCaretFormatElement = function(element) { return isCaretNode(element.dom) && isCaretContainerEmpty(element.dom); }; var postProcessHooks = {}; var filter = filter$2; var each$b = each$i; var addPostProcessHook = function(name2, hook) { var hooks2 = postProcessHooks[name2]; if (!hooks2) { postProcessHooks[name2] = []; } postProcessHooks[name2].push(hook); }; var postProcess$1 = function(name2, editor) { each$b(postProcessHooks[name2], function(hook) { hook(editor); }); }; addPostProcessHook("pre", function(editor) { var rng = editor.selection.getRng(); var blocks2; var hasPreSibling = function(pre) { return isPre(pre.previousSibling) && indexOf$12(blocks2, pre.previousSibling) !== -1; }; var joinPre = function(pre1, pre2) { DomQuery(pre2).remove(); DomQuery(pre1).append("

    ").append(pre2.childNodes); }; var isPre = matchNodeNames(["pre"]); if (!rng.collapsed) { blocks2 = editor.selection.getSelectedBlocks(); each$b(filter(filter(blocks2, isPre), hasPreSibling), function(pre) { joinPre(pre.previousSibling, pre); }); } }); var each$a = Tools.each; var isElementNode$1 = function(node) { return isElement$5(node) && !isBookmarkNode$1(node) && !isCaretNode(node) && !isBogus$2(node); }; var findElementSibling = function(node, siblingName) { for (var sibling2 = node; sibling2; sibling2 = sibling2[siblingName]) { if (isText$7(sibling2) && isNotEmpty(sibling2.data)) { return node; } if (isElement$5(sibling2) && !isBookmarkNode$1(sibling2)) { return sibling2; } } return node; }; var mergeSiblingsNodes = function(dom2, prev2, next2) { var elementUtils = ElementUtils(dom2); if (prev2 && next2) { prev2 = findElementSibling(prev2, "previousSibling"); next2 = findElementSibling(next2, "nextSibling"); if (elementUtils.compare(prev2, next2)) { for (var sibling2 = prev2.nextSibling; sibling2 && sibling2 !== next2; ) { var tmpSibling = sibling2; sibling2 = sibling2.nextSibling; prev2.appendChild(tmpSibling); } dom2.remove(next2); Tools.each(Tools.grep(next2.childNodes), function(node) { prev2.appendChild(node); }); return prev2; } } return next2; }; var mergeSiblings = function(dom2, format3, vars, node) { if (node && format3.merge_siblings !== false) { var newNode = mergeSiblingsNodes(dom2, getNonWhiteSpaceSibling(node), node); mergeSiblingsNodes(dom2, newNode, getNonWhiteSpaceSibling(newNode, true)); } }; var clearChildStyles = function(dom2, format3, node) { if (format3.clear_child_styles) { var selector2 = format3.links ? "*:not(a)" : "*"; each$a(dom2.select(selector2, node), function(node2) { if (isElementNode$1(node2)) { each$a(format3.styles, function(value25, name2) { dom2.setStyle(node2, name2, ""); }); } }); } }; var processChildElements = function(node, filter2, process3) { each$a(node.childNodes, function(node2) { if (isElementNode$1(node2)) { if (filter2(node2)) { process3(node2); } if (node2.hasChildNodes()) { processChildElements(node2, filter2, process3); } } }); }; var unwrapEmptySpan = function(dom2, node) { if (node.nodeName === "SPAN" && dom2.getAttribs(node).length === 0) { dom2.remove(node, true); } }; var hasStyle = function(dom2, name2) { return function(node) { return !!(node && getStyle3(dom2, node, name2)); }; }; var applyStyle = function(dom2, name2, value25) { return function(node) { dom2.setStyle(node, name2, value25); if (node.getAttribute("style") === "") { node.removeAttribute("style"); } unwrapEmptySpan(dom2, node); }; }; var removeResult = Adt.generate([ { keep: [] }, { rename: ["name"] }, { removed: [] } ]); var MCE_ATTR_RE = /^(src|href|style)$/; var each$9 = Tools.each; var isEq$2 = isEq$5; var isTableCellOrRow = function(node) { return /^(TR|TH|TD)$/.test(node.nodeName); }; var isChildOfInlineParent = function(dom2, node, parent3) { return dom2.isChildOf(node, parent3) && node !== parent3 && !dom2.isBlock(parent3); }; var getContainer5 = function(ed, rng, start2) { var container = rng[start2 ? "startContainer" : "endContainer"]; var offset4 = rng[start2 ? "startOffset" : "endOffset"]; if (isElement$5(container)) { var lastIdx = container.childNodes.length - 1; if (!start2 && offset4) { offset4--; } container = container.childNodes[offset4 > lastIdx ? lastIdx : offset4]; } if (isText$7(container) && start2 && offset4 >= container.nodeValue.length) { container = new DomTreeWalker(container, ed.getBody()).next() || container; } if (isText$7(container) && !start2 && offset4 === 0) { container = new DomTreeWalker(container, ed.getBody()).prev() || container; } return container; }; var normalizeTableSelection = function(node, start2) { var prop = start2 ? "firstChild" : "lastChild"; if (isTableCellOrRow(node) && node[prop]) { var childNode = node[prop]; if (node.nodeName === "TR") { return childNode[prop] || childNode; } else { return childNode; } } return node; }; var wrap$1 = function(dom2, node, name2, attrs) { var wrapper = dom2.create(name2, attrs); node.parentNode.insertBefore(wrapper, node); wrapper.appendChild(node); return wrapper; }; var wrapWithSiblings = function(dom2, node, next2, name2, attrs) { var start2 = SugarElement.fromDom(node); var wrapper = SugarElement.fromDom(dom2.create(name2, attrs)); var siblings2 = next2 ? nextSiblings(start2) : prevSiblings(start2); append(wrapper, siblings2); if (next2) { before$4(start2, wrapper); prepend(wrapper, start2); } else { after$3(start2, wrapper); append$1(wrapper, start2); } return wrapper.dom; }; var matchName2 = function(dom2, node, format3) { if (isInlineFormat(format3) && isEq$2(node, format3.inline)) { return true; } if (isBlockFormat(format3) && isEq$2(node, format3.block)) { return true; } if (isSelectorFormat(format3)) { return isElement$5(node) && dom2.is(node, format3.selector); } }; var isColorFormatAndAnchor = function(node, format3) { return format3.links && node.nodeName === "A"; }; var find2 = function(dom2, node, next2, inc) { var sibling2 = getNonWhiteSpaceSibling(node, next2, inc); return isNullable(sibling2) || sibling2.nodeName === "BR" || dom2.isBlock(sibling2); }; var removeNode = function(ed, node, format3) { var parentNode = node.parentNode; var rootBlockElm; var dom2 = ed.dom, forcedRootBlock = getForcedRootBlock(ed); if (isBlockFormat(format3)) { if (!forcedRootBlock) { if (dom2.isBlock(node) && !dom2.isBlock(parentNode)) { if (!find2(dom2, node, false) && !find2(dom2, node.firstChild, true, true)) { node.insertBefore(dom2.create("br"), node.firstChild); } if (!find2(dom2, node, true) && !find2(dom2, node.lastChild, false, true)) { node.appendChild(dom2.create("br")); } } } else { if (parentNode === dom2.getRoot()) { if (!format3.list_block || !isEq$2(node, format3.list_block)) { each$k(from2(node.childNodes), function(node2) { if (isValid4(ed, forcedRootBlock, node2.nodeName.toLowerCase())) { if (!rootBlockElm) { rootBlockElm = wrap$1(dom2, node2, forcedRootBlock); dom2.setAttribs(rootBlockElm, ed.settings.forced_root_block_attrs); } else { rootBlockElm.appendChild(node2); } } else { rootBlockElm = null; } }); } } } } if (isMixedFormat(format3) && !isEq$2(format3.inline, node)) { return; } dom2.remove(node, true); }; var removeFormatInternal = function(ed, format3, vars, node, compareNode) { var stylesModified; var dom2 = ed.dom; if (!matchName2(dom2, node, format3) && !isColorFormatAndAnchor(node, format3)) { return removeResult.keep(); } var elm = node; if (isInlineFormat(format3) && format3.remove === "all" && isArray$12(format3.preserve_attributes)) { var attrsToPreserve = filter$4(dom2.getAttribs(elm), function(attr) { return contains$3(format3.preserve_attributes, attr.name.toLowerCase()); }); dom2.removeAllAttribs(elm); each$k(attrsToPreserve, function(attr) { return dom2.setAttrib(elm, attr.name, attr.value); }); if (attrsToPreserve.length > 0) { return removeResult.rename("span"); } } if (format3.remove !== "all") { each$9(format3.styles, function(value25, name2) { value25 = normalizeStyleValue(dom2, replaceVars(value25, vars), name2 + ""); if (isNumber2(name2)) { name2 = value25; compareNode = null; } if (format3.remove_similar || (!compareNode || isEq$2(getStyle3(dom2, compareNode, name2), value25))) { dom2.setStyle(elm, name2, ""); } stylesModified = true; }); if (stylesModified && dom2.getAttrib(elm, "style") === "") { elm.removeAttribute("style"); elm.removeAttribute("data-mce-style"); } each$9(format3.attributes, function(value25, name2) { var valueOut; value25 = replaceVars(value25, vars); if (isNumber2(name2)) { name2 = value25; compareNode = null; } if (format3.remove_similar || (!compareNode || isEq$2(dom2.getAttrib(compareNode, name2), value25))) { if (name2 === "class") { value25 = dom2.getAttrib(elm, name2); if (value25) { valueOut = ""; each$k(value25.split(/\s+/), function(cls) { if (/mce\-\w+/.test(cls)) { valueOut += (valueOut ? " " : "") + cls; } }); if (valueOut) { dom2.setAttrib(elm, name2, valueOut); return; } } } if (MCE_ATTR_RE.test(name2)) { elm.removeAttribute("data-mce-" + name2); } if (name2 === "style" && matchNodeNames(["li"])(elm) && dom2.getStyle(elm, "list-style-type") === "none") { elm.removeAttribute(name2); dom2.setStyle(elm, "list-style-type", "none"); return; } if (name2 === "class") { elm.removeAttribute("className"); } elm.removeAttribute(name2); } }); each$9(format3.classes, function(value25) { value25 = replaceVars(value25, vars); if (!compareNode || dom2.hasClass(compareNode, value25)) { dom2.removeClass(elm, value25); } }); var attrs = dom2.getAttribs(elm); for (var i2 = 0; i2 < attrs.length; i2++) { var attrName = attrs[i2].nodeName; if (attrName.indexOf("_") !== 0 && attrName.indexOf("data-") !== 0) { return removeResult.keep(); } } } if (format3.remove !== "none") { removeNode(ed, elm, format3); return removeResult.removed(); } return removeResult.keep(); }; var removeFormat$1 = function(ed, format3, vars, node, compareNode) { return removeFormatInternal(ed, format3, vars, node, compareNode).fold(never, function(newName) { ed.dom.rename(node, newName); return true; }, always); }; var findFormatRoot = function(editor, container, name2, vars, similar) { var formatRoot; each$k(getParents$2(editor.dom, container.parentNode).reverse(), function(parent3) { if (!formatRoot && parent3.id !== "_start" && parent3.id !== "_end") { var format3 = matchNode(editor, parent3, name2, vars, similar); if (format3 && format3.split !== false) { formatRoot = parent3; } } }); return formatRoot; }; var removeFormatFromClone = function(editor, format3, vars, clone5) { return removeFormatInternal(editor, format3, vars, clone5, clone5).fold(constant2(clone5), function(newName) { var fragment = editor.dom.createFragment(); fragment.appendChild(clone5); return editor.dom.rename(clone5, newName); }, constant2(null)); }; var wrapAndSplit = function(editor, formatList, formatRoot, container, target, split3, format3, vars) { var clone5, lastClone, firstClone; var dom2 = editor.dom; if (formatRoot) { var formatRootParent = formatRoot.parentNode; for (var parent_1 = container.parentNode; parent_1 && parent_1 !== formatRootParent; parent_1 = parent_1.parentNode) { clone5 = dom2.clone(parent_1, false); for (var i2 = 0; i2 < formatList.length; i2++) { clone5 = removeFormatFromClone(editor, formatList[i2], vars, clone5); if (clone5 === null) { break; } } if (clone5) { if (lastClone) { clone5.appendChild(lastClone); } if (!firstClone) { firstClone = clone5; } lastClone = clone5; } } if (split3 && (!format3.mixed || !dom2.isBlock(formatRoot))) { container = dom2.split(formatRoot, container); } if (lastClone) { target.parentNode.insertBefore(lastClone, target); firstClone.appendChild(target); if (isInlineFormat(format3)) { mergeSiblings(dom2, format3, vars, lastClone); } } } return container; }; var remove$1 = function(ed, name2, vars, node, similar) { var formatList = ed.formatter.get(name2); var format3 = formatList[0]; var contentEditable = true; var dom2 = ed.dom; var selection = ed.selection; var splitToFormatRoot = function(container) { var formatRoot = findFormatRoot(ed, container, name2, vars, similar); return wrapAndSplit(ed, formatList, formatRoot, container, container, true, format3, vars); }; var isRemoveBookmarkNode = function(node2) { return isBookmarkNode$1(node2) && isElement$5(node2) && (node2.id === "_start" || node2.id === "_end"); }; var removeNodeFormat = function(node2) { return exists(formatList, function(fmt) { return removeFormat$1(ed, fmt, vars, node2, node2); }); }; var process3 = function(node2) { var lastContentEditable = true; var hasContentEditableState2 = false; if (isElement$5(node2) && dom2.getContentEditable(node2)) { lastContentEditable = contentEditable; contentEditable = dom2.getContentEditable(node2) === "true"; hasContentEditableState2 = true; } var children2 = from2(node2.childNodes); if (contentEditable && !hasContentEditableState2) { var removed = removeNodeFormat(node2); var currentNodeMatches = removed || exists(formatList, function(f2) { return matchName$1(dom2, node2, f2); }); var parentNode = node2.parentNode; if (!currentNodeMatches && isNonNullable(parentNode) && shouldExpandToSelector(format3)) { removeNodeFormat(parentNode); } } if (format3.deep) { if (children2.length) { for (var i3 = 0; i3 < children2.length; i3++) { process3(children2[i3]); } if (hasContentEditableState2) { contentEditable = lastContentEditable; } } } var textDecorations = [ "underline", "line-through", "overline" ]; each$k(textDecorations, function(decoration) { if (isElement$5(node2) && ed.dom.getStyle(node2, "text-decoration") === decoration && node2.parentNode && getTextDecoration(dom2, node2.parentNode) === decoration) { removeFormat$1(ed, { deep: false, exact: true, inline: "span", styles: { textDecoration: decoration } }, null, node2); } }); }; var unwrap2 = function(start2) { var node2 = dom2.get(start2 ? "_start" : "_end"); var out = node2[start2 ? "firstChild" : "lastChild"]; if (isRemoveBookmarkNode(out)) { out = out[start2 ? "firstChild" : "lastChild"]; } if (isText$7(out) && out.data.length === 0) { out = start2 ? node2.previousSibling || node2.nextSibling : node2.nextSibling || node2.previousSibling; } dom2.remove(node2, true); return out; }; var removeRngStyle = function(rng2) { var startContainer, endContainer; var expandedRng = expandRng(ed, rng2, formatList, rng2.collapsed); if (format3.split) { expandedRng = split2(expandedRng); startContainer = getContainer5(ed, expandedRng, true); endContainer = getContainer5(ed, expandedRng); if (startContainer !== endContainer) { startContainer = normalizeTableSelection(startContainer, true); endContainer = normalizeTableSelection(endContainer, false); if (isChildOfInlineParent(dom2, startContainer, endContainer)) { var marker = Optional.from(startContainer.firstChild).getOr(startContainer); splitToFormatRoot(wrapWithSiblings(dom2, marker, true, "span", { "id": "_start", "data-mce-type": "bookmark" })); unwrap2(true); return; } if (isChildOfInlineParent(dom2, endContainer, startContainer)) { var marker = Optional.from(endContainer.lastChild).getOr(endContainer); splitToFormatRoot(wrapWithSiblings(dom2, marker, false, "span", { "id": "_end", "data-mce-type": "bookmark" })); unwrap2(false); return; } startContainer = wrap$1(dom2, startContainer, "span", { "id": "_start", "data-mce-type": "bookmark" }); endContainer = wrap$1(dom2, endContainer, "span", { "id": "_end", "data-mce-type": "bookmark" }); var newRng = dom2.createRng(); newRng.setStartAfter(startContainer); newRng.setEndBefore(endContainer); walk$2(dom2, newRng, function(nodes2) { each$k(nodes2, function(n2) { if (!isBookmarkNode$1(n2) && !isBookmarkNode$1(n2.parentNode)) { splitToFormatRoot(n2); } }); }); splitToFormatRoot(startContainer); splitToFormatRoot(endContainer); startContainer = unwrap2(true); endContainer = unwrap2(); } else { startContainer = endContainer = splitToFormatRoot(startContainer); } expandedRng.startContainer = startContainer.parentNode ? startContainer.parentNode : startContainer; expandedRng.startOffset = dom2.nodeIndex(startContainer); expandedRng.endContainer = endContainer.parentNode ? endContainer.parentNode : endContainer; expandedRng.endOffset = dom2.nodeIndex(endContainer) + 1; } walk$2(dom2, expandedRng, function(nodes2) { each$k(nodes2, process3); }); }; if (node) { if (isNode(node)) { var rng = dom2.createRng(); rng.setStartBefore(node); rng.setEndAfter(node); removeRngStyle(rng); } else { removeRngStyle(node); } fireFormatRemove(ed, name2, node, vars); return; } if (dom2.getContentEditable(selection.getNode()) === "false") { node = selection.getNode(); for (var i2 = 0; i2 < formatList.length; i2++) { if (formatList[i2].ceFalseOverride) { if (removeFormat$1(ed, formatList[i2], vars, node, node)) { break; } } } fireFormatRemove(ed, name2, node, vars); return; } if (!selection.isCollapsed() || !isInlineFormat(format3) || getCellsFromEditor(ed).length) { preserve(selection, true, function() { runOnRanges(ed, removeRngStyle); }); if (isInlineFormat(format3) && match$2(ed, name2, vars, selection.getStart())) { moveStart(dom2, selection, selection.getRng()); } ed.nodeChanged(); } else { removeCaretFormat(ed, name2, vars, similar); } fireFormatRemove(ed, name2, node, vars); }; var each$8 = Tools.each; var mergeTextDecorationsAndColor = function(dom2, format3, vars, node) { var processTextDecorationsAndColor = function(n2) { if (n2.nodeType === 1 && n2.parentNode && n2.parentNode.nodeType === 1) { var textDecoration = getTextDecoration(dom2, n2.parentNode); if (dom2.getStyle(n2, "color") && textDecoration) { dom2.setStyle(n2, "text-decoration", textDecoration); } else if (dom2.getStyle(n2, "text-decoration") === textDecoration) { dom2.setStyle(n2, "text-decoration", null); } } }; if (format3.styles && (format3.styles.color || format3.styles.textDecoration)) { Tools.walk(node, processTextDecorationsAndColor, "childNodes"); processTextDecorationsAndColor(node); } }; var mergeBackgroundColorAndFontSize = function(dom2, format3, vars, node) { if (format3.styles && format3.styles.backgroundColor) { processChildElements(node, hasStyle(dom2, "fontSize"), applyStyle(dom2, "backgroundColor", replaceVars(format3.styles.backgroundColor, vars))); } }; var mergeSubSup = function(dom2, format3, vars, node) { if (isInlineFormat(format3) && (format3.inline === "sub" || format3.inline === "sup")) { processChildElements(node, hasStyle(dom2, "fontSize"), applyStyle(dom2, "fontSize", "")); dom2.remove(dom2.select(format3.inline === "sup" ? "sub" : "sup", node), true); } }; var mergeWithChildren = function(editor, formatList, vars, node) { each$8(formatList, function(format3) { if (isInlineFormat(format3)) { each$8(editor.dom.select(format3.inline, node), function(child2) { if (!isElementNode$1(child2)) { return; } removeFormat$1(editor, format3, vars, child2, format3.exact ? child2 : null); }); } clearChildStyles(editor.dom, format3, node); }); }; var mergeWithParents = function(editor, format3, name2, vars, node) { if (matchNode(editor, node.parentNode, name2, vars)) { if (removeFormat$1(editor, format3, vars, node)) { return; } } if (format3.merge_with_parents) { editor.dom.getParent(node.parentNode, function(parent3) { if (matchNode(editor, parent3, name2, vars)) { removeFormat$1(editor, format3, vars, node); return true; } }); } }; var each$7 = Tools.each; var isElementNode = function(node) { return isElement$5(node) && !isBookmarkNode$1(node) && !isCaretNode(node) && !isBogus$2(node); }; var canFormatBR = function(editor, format3, node, parentName) { if (canFormatEmptyLines(editor) && isInlineFormat(format3)) { var validBRParentElements = getTextRootBlockElements(editor.schema); var hasCaretNodeSibling = sibling(SugarElement.fromDom(node), function(sibling2) { return isCaretNode(sibling2.dom); }); return hasNonNullableKey(validBRParentElements, parentName) && isEmpty$2(SugarElement.fromDom(node.parentNode), false) && !hasCaretNodeSibling; } else { return false; } }; var applyFormat$1 = function(ed, name2, vars, node) { var formatList = ed.formatter.get(name2); var format3 = formatList[0]; var isCollapsed = !node && ed.selection.isCollapsed(); var dom2 = ed.dom; var selection = ed.selection; var setElementFormat = function(elm, fmt) { if (fmt === void 0) { fmt = format3; } if (isFunction3(fmt.onformat)) { fmt.onformat(elm, fmt, vars, node); } each$7(fmt.styles, function(value25, name3) { dom2.setStyle(elm, name3, replaceVars(value25, vars)); }); if (fmt.styles) { var styleVal = dom2.getAttrib(elm, "style"); if (styleVal) { dom2.setAttrib(elm, "data-mce-style", styleVal); } } each$7(fmt.attributes, function(value25, name3) { dom2.setAttrib(elm, name3, replaceVars(value25, vars)); }); each$7(fmt.classes, function(value25) { value25 = replaceVars(value25, vars); if (!dom2.hasClass(elm, value25)) { dom2.addClass(elm, value25); } }); }; var applyNodeStyle = function(formatList2, node2) { var found = false; each$7(formatList2, function(format4) { if (!isSelectorFormat(format4)) { return false; } if (isNonNullable(format4.collapsed) && format4.collapsed !== isCollapsed) { return; } if (dom2.is(node2, format4.selector) && !isCaretNode(node2)) { setElementFormat(node2, format4); found = true; return false; } }); return found; }; var createWrapElement = function(wrapName) { if (isString$12(wrapName)) { var wrapElm = dom2.create(wrapName); setElementFormat(wrapElm); return wrapElm; } else { return null; } }; var applyRngStyle = function(dom3, rng2, nodeSpecific) { var newWrappers = []; var contentEditable = true; var wrapName = format3.inline || format3.block; var wrapElm = createWrapElement(wrapName); walk$2(dom3, rng2, function(nodes2) { var currentWrapElm; var process3 = function(node2) { var hasContentEditableState2 = false; var lastContentEditable = contentEditable; var nodeName = node2.nodeName.toLowerCase(); var parentNode = node2.parentNode; var parentName = parentNode.nodeName.toLowerCase(); if (isElement$5(node2) && dom3.getContentEditable(node2)) { lastContentEditable = contentEditable; contentEditable = dom3.getContentEditable(node2) === "true"; hasContentEditableState2 = true; } if (isBr$5(node2) && !canFormatBR(ed, format3, node2, parentName)) { currentWrapElm = null; if (isBlockFormat(format3)) { dom3.remove(node2); } return; } if (isBlockFormat(format3) && format3.wrapper && matchNode(ed, node2, name2, vars)) { currentWrapElm = null; return; } if (contentEditable && !hasContentEditableState2 && isBlockFormat(format3) && !format3.wrapper && isTextBlock$1(ed, nodeName) && isValid4(ed, parentName, wrapName)) { var elm = dom3.rename(node2, wrapName); setElementFormat(elm); newWrappers.push(elm); currentWrapElm = null; return; } if (isSelectorFormat(format3)) { var found = applyNodeStyle(formatList, node2); if (!found && isNonNullable(parentNode) && shouldExpandToSelector(format3)) { found = applyNodeStyle(formatList, parentNode); } if (!isInlineFormat(format3) || found) { currentWrapElm = null; return; } } if (contentEditable && !hasContentEditableState2 && isValid4(ed, wrapName, nodeName) && isValid4(ed, parentName, wrapName) && !(!nodeSpecific && isText$7(node2) && isZwsp(node2.data)) && !isCaretNode(node2) && (!isInlineFormat(format3) || !dom3.isBlock(node2))) { if (!currentWrapElm) { currentWrapElm = dom3.clone(wrapElm, false); node2.parentNode.insertBefore(currentWrapElm, node2); newWrappers.push(currentWrapElm); } currentWrapElm.appendChild(node2); } else { currentWrapElm = null; each$k(from2(node2.childNodes), process3); if (hasContentEditableState2) { contentEditable = lastContentEditable; } currentWrapElm = null; } }; each$k(nodes2, process3); }); if (format3.links === true) { each$k(newWrappers, function(node2) { var process3 = function(node3) { if (node3.nodeName === "A") { setElementFormat(node3, format3); } each$k(from2(node3.childNodes), process3); }; process3(node2); }); } each$k(newWrappers, function(node2) { var getChildCount = function(node3) { var count3 = 0; each$k(node3.childNodes, function(node4) { if (!isEmptyTextNode$1(node4) && !isBookmarkNode$1(node4)) { count3++; } }); return count3; }; var mergeStyles = function(node3) { var childElement = find$3(node3.childNodes, isElementNode).filter(function(child2) { return matchName$1(dom3, child2, format3); }); return childElement.map(function(child2) { var clone5 = dom3.clone(child2, false); setElementFormat(clone5); dom3.replace(clone5, node3, true); dom3.remove(child2, true); return clone5; }).getOr(node3); }; var childCount = getChildCount(node2); if ((newWrappers.length > 1 || !dom3.isBlock(node2)) && childCount === 0) { dom3.remove(node2, true); return; } if (isInlineFormat(format3) || isBlockFormat(format3) && format3.wrapper) { if (!format3.exact && childCount === 1) { node2 = mergeStyles(node2); } mergeWithChildren(ed, formatList, vars, node2); mergeWithParents(ed, format3, name2, vars, node2); mergeBackgroundColorAndFontSize(dom3, format3, vars, node2); mergeTextDecorationsAndColor(dom3, format3, vars, node2); mergeSubSup(dom3, format3, vars, node2); mergeSiblings(dom3, format3, vars, node2); } }); }; if (dom2.getContentEditable(selection.getNode()) === "false") { node = selection.getNode(); for (var i2 = 0, l2 = formatList.length; i2 < l2; i2++) { var formatItem = formatList[i2]; if (formatItem.ceFalseOverride && isSelectorFormat(formatItem) && dom2.is(node, formatItem.selector)) { setElementFormat(node, formatItem); break; } } fireFormatApply(ed, name2, node, vars); return; } if (format3) { if (node) { if (isNode(node)) { if (!applyNodeStyle(formatList, node)) { var rng = dom2.createRng(); rng.setStartBefore(node); rng.setEndAfter(node); applyRngStyle(dom2, expandRng(ed, rng, formatList), true); } } else { applyRngStyle(dom2, node, true); } } else { if (!isCollapsed || !isInlineFormat(format3) || getCellsFromEditor(ed).length) { var curSelNode = selection.getNode(); var firstFormat = formatList[0]; if (!ed.settings.forced_root_block && firstFormat.defaultBlock && !dom2.getParent(curSelNode, dom2.isBlock)) { applyFormat$1(ed, firstFormat.defaultBlock); } selection.setRng(normalize2(selection.getRng())); preserve(selection, true, function() { runOnRanges(ed, function(selectionRng, fake) { var expandedRng = fake ? selectionRng : expandRng(ed, selectionRng, formatList); applyRngStyle(dom2, expandedRng, false); }); }); moveStart(dom2, selection, selection.getRng()); ed.nodeChanged(); } else { applyCaretFormat(ed, name2, vars); } } postProcess$1(name2, ed); } fireFormatApply(ed, name2, node, vars); }; var hasVars = function(value25) { return has$22(value25, "vars"); }; var setup$j = function(registeredFormatListeners, editor) { registeredFormatListeners.set({}); editor.on("NodeChange", function(e2) { updateAndFireChangeCallbacks(editor, e2.element, registeredFormatListeners.get()); }); editor.on("FormatApply FormatRemove", function(e2) { var element = Optional.from(e2.node).map(function(nodeOrRange) { return isNode(nodeOrRange) ? nodeOrRange : nodeOrRange.startContainer; }).bind(function(node) { return isElement$5(node) ? Optional.some(node) : Optional.from(node.parentElement); }).getOrThunk(function() { return fallbackElement(editor); }); updateAndFireChangeCallbacks(editor, element, registeredFormatListeners.get()); }); }; var fallbackElement = function(editor) { return editor.selection.getStart(); }; var matchingNode = function(editor, parents2, format3, similar, vars) { var isMatchingNode = function(node) { var matchingFormat = editor.formatter.matchNode(node, format3, vars !== null && vars !== void 0 ? vars : {}, similar); return !isUndefined2(matchingFormat); }; var isUnableToMatch = function(node) { if (matchesUnInheritedFormatSelector(editor, node, format3)) { return true; } else { if (!similar) { return isNonNullable(editor.formatter.matchNode(node, format3, vars, true)); } else { return false; } } }; return findUntil$1(parents2, isMatchingNode, isUnableToMatch); }; var getParents = function(editor, elm) { var element = elm !== null && elm !== void 0 ? elm : fallbackElement(editor); return filter$4(getParents$2(editor.dom, element), function(node) { return isElement$5(node) && !isBogus$2(node); }); }; var updateAndFireChangeCallbacks = function(editor, elm, registeredCallbacks) { var parents2 = getParents(editor, elm); each$j(registeredCallbacks, function(data66, format3) { var runIfChanged = function(spec) { var match7 = matchingNode(editor, parents2, format3, spec.similar, hasVars(spec) ? spec.vars : void 0); var isSet2 = match7.isSome(); if (spec.state.get() !== isSet2) { spec.state.set(isSet2); var node_1 = match7.getOr(elm); if (hasVars(spec)) { spec.callback(isSet2, { node: node_1, format: format3, parents: parents2 }); } else { each$k(spec.callbacks, function(callback2) { return callback2(isSet2, { node: node_1, format: format3, parents: parents2 }); }); } } }; each$k([ data66.withSimilar, data66.withoutSimilar ], runIfChanged); each$k(data66.withVars, runIfChanged); }); }; var addListeners = function(editor, registeredFormatListeners, formats2, callback2, similar, vars) { var formatChangeItems = registeredFormatListeners.get(); each$k(formats2.split(","), function(format3) { var group = get$9(formatChangeItems, format3).getOrThunk(function() { var base = { withSimilar: { state: Cell3(false), similar: true, callbacks: [] }, withoutSimilar: { state: Cell3(false), similar: false, callbacks: [] }, withVars: [] }; formatChangeItems[format3] = base; return base; }); var getCurrent = function() { var parents2 = getParents(editor); return matchingNode(editor, parents2, format3, similar, vars).isSome(); }; if (isUndefined2(vars)) { var toAppendTo = similar ? group.withSimilar : group.withoutSimilar; toAppendTo.callbacks.push(callback2); if (toAppendTo.callbacks.length === 1) { toAppendTo.state.set(getCurrent()); } } else { group.withVars.push({ state: Cell3(getCurrent()), similar, vars, callback: callback2 }); } }); registeredFormatListeners.set(formatChangeItems); }; var removeListeners = function(registeredFormatListeners, formats2, callback2) { var formatChangeItems = registeredFormatListeners.get(); each$k(formats2.split(","), function(format3) { return get$9(formatChangeItems, format3).each(function(group) { formatChangeItems[format3] = { withSimilar: __assign(__assign({}, group.withSimilar), { callbacks: filter$4(group.withSimilar.callbacks, function(cb) { return cb !== callback2; }) }), withoutSimilar: __assign(__assign({}, group.withoutSimilar), { callbacks: filter$4(group.withoutSimilar.callbacks, function(cb) { return cb !== callback2; }) }), withVars: filter$4(group.withVars, function(item) { return item.callback !== callback2; }) }; }); }); registeredFormatListeners.set(formatChangeItems); }; var formatChangedInternal = function(editor, registeredFormatListeners, formats2, callback2, similar, vars) { if (registeredFormatListeners.get() === null) { setup$j(registeredFormatListeners, editor); } addListeners(editor, registeredFormatListeners, formats2, callback2, similar, vars); return { unbind: function() { return removeListeners(registeredFormatListeners, formats2, callback2); } }; }; var toggle = function(editor, name2, vars, node) { var fmt = editor.formatter.get(name2); if (match$2(editor, name2, vars, node) && (!("toggle" in fmt[0]) || fmt[0].toggle)) { remove$1(editor, name2, vars, node); } else { applyFormat$1(editor, name2, vars, node); } }; var fromElements = function(elements, scope) { var doc2 = scope || document; var fragment = doc2.createDocumentFragment(); each$k(elements, function(element) { fragment.appendChild(element.dom); }); return SugarElement.fromDom(fragment); }; var tableModel = function(element, width, rows) { return { element, width, rows }; }; var tableRow = function(element, cells) { return { element, cells }; }; var cellPosition = function(x2, y2) { return { x: x2, y: y2 }; }; var getSpan = function(td, key2) { var value25 = parseInt(get$6(td, key2), 10); return isNaN(value25) ? 1 : value25; }; var fillout = function(table2, x2, y2, tr, td) { var rowspan = getSpan(td, "rowspan"); var colspan = getSpan(td, "colspan"); var rows = table2.rows; for (var y22 = y2; y22 < y2 + rowspan; y22++) { if (!rows[y22]) { rows[y22] = tableRow(deep$1(tr), []); } for (var x22 = x2; x22 < x2 + colspan; x22++) { var cells = rows[y22].cells; cells[x22] = y22 === y2 && x22 === x2 ? td : shallow(td); } } }; var cellExists = function(table2, x2, y2) { var rows = table2.rows; var cells = rows[y2] ? rows[y2].cells : []; return !!cells[x2]; }; var skipCellsX = function(table2, x2, y2) { while (cellExists(table2, x2, y2)) { x2++; } return x2; }; var getWidth = function(rows) { return foldl(rows, function(acc, row) { return row.cells.length > acc ? row.cells.length : acc; }, 0); }; var findElementPos = function(table2, element) { var rows = table2.rows; for (var y2 = 0; y2 < rows.length; y2++) { var cells = rows[y2].cells; for (var x2 = 0; x2 < cells.length; x2++) { if (eq2(cells[x2], element)) { return Optional.some(cellPosition(x2, y2)); } } } return Optional.none(); }; var extractRows = function(table2, sx, sy, ex, ey) { var newRows = []; var rows = table2.rows; for (var y2 = sy; y2 <= ey; y2++) { var cells = rows[y2].cells; var slice3 = sx < ex ? cells.slice(sx, ex + 1) : cells.slice(ex, sx + 1); newRows.push(tableRow(rows[y2].element, slice3)); } return newRows; }; var subTable = function(table2, startPos, endPos) { var sx = startPos.x, sy = startPos.y; var ex = endPos.x, ey = endPos.y; var newRows = sy < ey ? extractRows(table2, sx, sy, ex, ey) : extractRows(table2, sx, ey, ex, sy); return tableModel(table2.element, getWidth(newRows), newRows); }; var createDomTable = function(table2, rows) { var tableElement = shallow(table2.element); var tableBody = SugarElement.fromTag("tbody"); append(tableBody, rows); append$1(tableElement, tableBody); return tableElement; }; var modelRowsToDomRows = function(table2) { return map$3(table2.rows, function(row) { var cells = map$3(row.cells, function(cell) { var td = deep$1(cell); remove$6(td, "colspan"); remove$6(td, "rowspan"); return td; }); var tr = shallow(row.element); append(tr, cells); return tr; }); }; var fromDom = function(tableElm) { var table2 = tableModel(shallow(tableElm), 0, []); each$k(descendants(tableElm, "tr"), function(tr, y2) { each$k(descendants(tr, "td,th"), function(td, x2) { fillout(table2, skipCellsX(table2, x2, y2), y2, tr, td); }); }); return tableModel(table2.element, getWidth(table2.rows), table2.rows); }; var toDom = function(table2) { return createDomTable(table2, modelRowsToDomRows(table2)); }; var subsection = function(table2, startElement, endElement) { return findElementPos(table2, startElement).bind(function(startPos) { return findElementPos(table2, endElement).map(function(endPos) { return subTable(table2, startPos, endPos); }); }); }; var findParentListContainer = function(parents2) { return find$3(parents2, function(elm) { return name(elm) === "ul" || name(elm) === "ol"; }); }; var getFullySelectedListWrappers = function(parents2, rng) { return find$3(parents2, function(elm) { return name(elm) === "li" && hasAllContentsSelected(elm, rng); }).fold(constant2([]), function(_li) { return findParentListContainer(parents2).map(function(listCont) { var listElm = SugarElement.fromTag(name(listCont)); var listStyles = filter$3(getAllRaw(listCont), function(_style, name2) { return startsWith(name2, "list-style"); }); setAll(listElm, listStyles); return [ SugarElement.fromTag("li"), listElm ]; }).getOr([]); }); }; var wrap = function(innerElm, elms) { var wrapped = foldl(elms, function(acc, elm) { append$1(elm, acc); return elm; }, innerElm); return elms.length > 0 ? fromElements([wrapped]) : wrapped; }; var directListWrappers = function(commonAnchorContainer) { if (isListItem(commonAnchorContainer)) { return parent2(commonAnchorContainer).filter(isList).fold(constant2([]), function(listElm) { return [ commonAnchorContainer, listElm ]; }); } else { return isList(commonAnchorContainer) ? [commonAnchorContainer] : []; } }; var getWrapElements = function(rootNode, rng) { var commonAnchorContainer = SugarElement.fromDom(rng.commonAncestorContainer); var parents2 = parentsAndSelf(commonAnchorContainer, rootNode); var wrapElements = filter$4(parents2, function(elm) { return isInline$1(elm) || isHeading(elm); }); var listWrappers = getFullySelectedListWrappers(parents2, rng); var allWrappers = wrapElements.concat(listWrappers.length ? listWrappers : directListWrappers(commonAnchorContainer)); return map$3(allWrappers, shallow); }; var emptyFragment = function() { return fromElements([]); }; var getFragmentFromRange = function(rootNode, rng) { return wrap(SugarElement.fromDom(rng.cloneContents()), getWrapElements(rootNode, rng)); }; var getParentTable = function(rootElm, cell) { return ancestor$2(cell, "table", curry(eq2, rootElm)); }; var getTableFragment = function(rootNode, selectedTableCells) { return getParentTable(rootNode, selectedTableCells[0]).bind(function(tableElm) { var firstCell = selectedTableCells[0]; var lastCell = selectedTableCells[selectedTableCells.length - 1]; var fullTableModel = fromDom(tableElm); return subsection(fullTableModel, firstCell, lastCell).map(function(sectionedTableModel) { return fromElements([toDom(sectionedTableModel)]); }); }).getOrThunk(emptyFragment); }; var getSelectionFragment = function(rootNode, ranges) { return ranges.length > 0 && ranges[0].collapsed ? emptyFragment() : getFragmentFromRange(rootNode, ranges[0]); }; var read$3 = function(rootNode, ranges) { var selectedCells = getCellsFromElementOrRanges(ranges, rootNode); return selectedCells.length > 0 ? getTableFragment(rootNode, selectedCells) : getSelectionFragment(rootNode, ranges); }; var trimLeadingCollapsibleText = function(text) { return text.replace(/^[ \f\n\r\t\v]+/, ""); }; var isCollapsibleWhitespace = function(text, index2) { return index2 >= 0 && index2 < text.length && isWhiteSpace(text.charAt(index2)); }; var getInnerText = function(bin, shouldTrim) { var text = trim$2(bin.innerText); return shouldTrim ? trimLeadingCollapsibleText(text) : text; }; var getContextNodeName = function(parentBlockOpt) { return parentBlockOpt.map(function(block) { return block.nodeName; }).getOr("div").toLowerCase(); }; var getTextContent = function(editor) { return Optional.from(editor.selection.getRng()).map(function(rng) { var parentBlockOpt = Optional.from(editor.dom.getParent(rng.commonAncestorContainer, editor.dom.isBlock)); var body = editor.getBody(); var contextNodeName = getContextNodeName(parentBlockOpt); var shouldTrimSpaces = Env.browser.isIE() && contextNodeName !== "pre"; var bin = editor.dom.add(body, contextNodeName, { "data-mce-bogus": "all", "style": "overflow: hidden; opacity: 0;" }, rng.cloneContents()); var text = getInnerText(bin, shouldTrimSpaces); var nonRenderedText = trim$2(bin.textContent); editor.dom.remove(bin); if (isCollapsibleWhitespace(nonRenderedText, 0) || isCollapsibleWhitespace(nonRenderedText, nonRenderedText.length - 1)) { var parentBlock = parentBlockOpt.getOr(body); var parentBlockText = getInnerText(parentBlock, shouldTrimSpaces); var textIndex = parentBlockText.indexOf(text); if (textIndex === -1) { return text; } else { var hasProceedingSpace = isCollapsibleWhitespace(parentBlockText, textIndex - 1); var hasTrailingSpace = isCollapsibleWhitespace(parentBlockText, textIndex + text.length); return (hasProceedingSpace ? " " : "") + text + (hasTrailingSpace ? " " : ""); } } else { return text; } }).getOr(""); }; var getSerializedContent = function(editor, args) { var rng = editor.selection.getRng(), tmpElm = editor.dom.create("body"); var sel = editor.selection.getSel(); var ranges = processRanges(editor, getRanges(sel)); var fragment = args.contextual ? read$3(SugarElement.fromDom(editor.getBody()), ranges).dom : rng.cloneContents(); if (fragment) { tmpElm.appendChild(fragment); } return editor.selection.serializer.serialize(tmpElm, args); }; var setupArgs$1 = function(args, format3) { return __assign(__assign({}, args), { format: format3, get: true, selection: true }); }; var getSelectedContentInternal = function(editor, format3, args) { if (args === void 0) { args = {}; } var defaultedArgs = setupArgs$1(args, format3); var updatedArgs = editor.fire("BeforeGetContent", defaultedArgs); if (updatedArgs.isDefaultPrevented()) { editor.fire("GetContent", updatedArgs); return updatedArgs.content; } if (updatedArgs.format === "text") { return getTextContent(editor); } else { updatedArgs.getInner = true; var content = getSerializedContent(editor, updatedArgs); if (updatedArgs.format === "tree") { return content; } else { updatedArgs.content = editor.selection.isCollapsed() ? "" : content; editor.fire("GetContent", updatedArgs); return updatedArgs.content; } } }; var KEEP = 0, INSERT = 1, DELETE = 2; var diff2 = function(left, right) { var size = left.length + right.length + 2; var vDown = new Array(size); var vUp = new Array(size); var snake = function(start2, end2, diag) { return { start: start2, end: end2, diag }; }; var buildScript = function(start1, end1, start2, end2, script2) { var middle = getMiddleSnake(start1, end1, start2, end2); if (middle === null || middle.start === end1 && middle.diag === end1 - end2 || middle.end === start1 && middle.diag === start1 - start2) { var i2 = start1; var j2 = start2; while (i2 < end1 || j2 < end2) { if (i2 < end1 && j2 < end2 && left[i2] === right[j2]) { script2.push([ KEEP, left[i2] ]); ++i2; ++j2; } else { if (end1 - start1 > end2 - start2) { script2.push([ DELETE, left[i2] ]); ++i2; } else { script2.push([ INSERT, right[j2] ]); ++j2; } } } } else { buildScript(start1, middle.start, start2, middle.start - middle.diag, script2); for (var i22 = middle.start; i22 < middle.end; ++i22) { script2.push([ KEEP, left[i22] ]); } buildScript(middle.end, end1, middle.end - middle.diag, end2, script2); } }; var buildSnake = function(start2, diag, end1, end2) { var end3 = start2; while (end3 - diag < end2 && end3 < end1 && left[end3] === right[end3 - diag]) { ++end3; } return snake(start2, end3, diag); }; var getMiddleSnake = function(start1, end1, start2, end2) { var m2 = end1 - start1; var n2 = end2 - start2; if (m2 === 0 || n2 === 0) { return null; } var delta = m2 - n2; var sum = n2 + m2; var offset4 = (sum % 2 === 0 ? sum : sum + 1) / 2; vDown[1 + offset4] = start1; vUp[1 + offset4] = end1 + 1; var d2, k2, i2, x2, y2; for (d2 = 0; d2 <= offset4; ++d2) { for (k2 = -d2; k2 <= d2; k2 += 2) { i2 = k2 + offset4; if (k2 === -d2 || k2 !== d2 && vDown[i2 - 1] < vDown[i2 + 1]) { vDown[i2] = vDown[i2 + 1]; } else { vDown[i2] = vDown[i2 - 1] + 1; } x2 = vDown[i2]; y2 = x2 - start1 + start2 - k2; while (x2 < end1 && y2 < end2 && left[x2] === right[y2]) { vDown[i2] = ++x2; ++y2; } if (delta % 2 !== 0 && delta - d2 <= k2 && k2 <= delta + d2) { if (vUp[i2 - delta] <= vDown[i2]) { return buildSnake(vUp[i2 - delta], k2 + start1 - start2, end1, end2); } } } for (k2 = delta - d2; k2 <= delta + d2; k2 += 2) { i2 = k2 + offset4 - delta; if (k2 === delta - d2 || k2 !== delta + d2 && vUp[i2 + 1] <= vUp[i2 - 1]) { vUp[i2] = vUp[i2 + 1] - 1; } else { vUp[i2] = vUp[i2 - 1]; } x2 = vUp[i2] - 1; y2 = x2 - start1 + start2 - k2; while (x2 >= start1 && y2 >= start2 && left[x2] === right[y2]) { vUp[i2] = x2--; y2--; } if (delta % 2 === 0 && -d2 <= k2 && k2 <= d2) { if (vUp[i2] <= vDown[i2 + delta]) { return buildSnake(vUp[i2], k2 + start1 - start2, end1, end2); } } } } }; var script = []; buildScript(0, left.length, 0, right.length, script); return script; }; var getOuterHtml = function(elm) { if (isElement$5(elm)) { return elm.outerHTML; } else if (isText$7(elm)) { return Entities.encodeRaw(elm.data, false); } else if (isComment(elm)) { return ""; } return ""; }; var createFragment = function(html) { var node; var container = document.createElement("div"); var frag = document.createDocumentFragment(); if (html) { container.innerHTML = html; } while (node = container.firstChild) { frag.appendChild(node); } return frag; }; var insertAt = function(elm, html, index2) { var fragment = createFragment(html); if (elm.hasChildNodes() && index2 < elm.childNodes.length) { var target = elm.childNodes[index2]; target.parentNode.insertBefore(fragment, target); } else { elm.appendChild(fragment); } }; var removeAt = function(elm, index2) { if (elm.hasChildNodes() && index2 < elm.childNodes.length) { var target = elm.childNodes[index2]; target.parentNode.removeChild(target); } }; var applyDiff = function(diff3, elm) { var index2 = 0; each$k(diff3, function(action2) { if (action2[0] === KEEP) { index2++; } else if (action2[0] === INSERT) { insertAt(elm, action2[1], index2); index2++; } else if (action2[0] === DELETE) { removeAt(elm, index2); } }); }; var read$2 = function(elm) { return filter$4(map$3(from2(elm.childNodes), getOuterHtml), function(item) { return item.length > 0; }); }; var write = function(fragments, elm) { var currentFragments = map$3(from2(elm.childNodes), getOuterHtml); applyDiff(diff2(currentFragments, fragments), elm); return elm; }; var lazyTempDocument = cached2(function() { return document.implementation.createHTMLDocument("undo"); }); var hasIframes = function(html) { return html.indexOf("") !== -1; }; var createFragmentedLevel = function(fragments) { return { type: "fragmented", fragments, content: "", bookmark: null, beforeBookmark: null }; }; var createCompleteLevel = function(content) { return { type: "complete", fragments: null, content, bookmark: null, beforeBookmark: null }; }; var createFromEditor = function(editor) { var fragments = read$2(editor.getBody()); var trimmedFragments = bind4(fragments, function(html) { var trimmed = trimInternal(editor.serializer, html); return trimmed.length > 0 ? [trimmed] : []; }); var content = trimmedFragments.join(""); return hasIframes(content) ? createFragmentedLevel(trimmedFragments) : createCompleteLevel(content); }; var applyToEditor = function(editor, level2, before2) { var bookmark = before2 ? level2.beforeBookmark : level2.bookmark; if (level2.type === "fragmented") { write(level2.fragments, editor.getBody()); } else { editor.setContent(level2.content, { format: "raw", no_selection: isNonNullable(bookmark) && isPathBookmark(bookmark) ? !bookmark.isFakeCaret : true }); } editor.selection.moveToBookmark(bookmark); }; var getLevelContent = function(level2) { return level2.type === "fragmented" ? level2.fragments.join("") : level2.content; }; var getCleanLevelContent = function(level2) { var elm = SugarElement.fromTag("body", lazyTempDocument()); set2(elm, getLevelContent(level2)); each$k(descendants(elm, "*[data-mce-bogus]"), unwrap); return get$3(elm); }; var hasEqualContent = function(level1, level2) { return getLevelContent(level1) === getLevelContent(level2); }; var hasEqualCleanedContent = function(level1, level2) { return getCleanLevelContent(level1) === getCleanLevelContent(level2); }; var isEq$1 = function(level1, level2) { if (!level1 || !level2) { return false; } else if (hasEqualContent(level1, level2)) { return true; } else { return hasEqualCleanedContent(level1, level2); } }; var isUnlocked = function(locks) { return locks.get() === 0; }; var setTyping = function(undoManager, typing, locks) { if (isUnlocked(locks)) { undoManager.typing = typing; } }; var endTyping = function(undoManager, locks) { if (undoManager.typing) { setTyping(undoManager, false, locks); undoManager.add(); } }; var endTypingLevelIgnoreLocks = function(undoManager) { if (undoManager.typing) { undoManager.typing = false; undoManager.add(); } }; var beforeChange$1 = function(editor, locks, beforeBookmark) { if (isUnlocked(locks)) { beforeBookmark.set(getUndoBookmark(editor.selection)); } }; var addUndoLevel$1 = function(editor, undoManager, index2, locks, beforeBookmark, level2, event) { var currentLevel = createFromEditor(editor); level2 = level2 || {}; level2 = Tools.extend(level2, currentLevel); if (isUnlocked(locks) === false || editor.removed) { return null; } var lastLevel = undoManager.data[index2.get()]; if (editor.fire("BeforeAddUndo", { level: level2, lastLevel, originalEvent: event }).isDefaultPrevented()) { return null; } if (lastLevel && isEq$1(lastLevel, level2)) { return null; } if (undoManager.data[index2.get()]) { beforeBookmark.get().each(function(bm) { undoManager.data[index2.get()].beforeBookmark = bm; }); } var customUndoRedoLevels = getCustomUndoRedoLevels(editor); if (customUndoRedoLevels) { if (undoManager.data.length > customUndoRedoLevels) { for (var i2 = 0; i2 < undoManager.data.length - 1; i2++) { undoManager.data[i2] = undoManager.data[i2 + 1]; } undoManager.data.length--; index2.set(undoManager.data.length); } } level2.bookmark = getUndoBookmark(editor.selection); if (index2.get() < undoManager.data.length - 1) { undoManager.data.length = index2.get() + 1; } undoManager.data.push(level2); index2.set(undoManager.data.length - 1); var args = { level: level2, lastLevel, originalEvent: event }; if (index2.get() > 0) { editor.setDirty(true); editor.fire("AddUndo", args); editor.fire("change", args); } else { editor.fire("AddUndo", args); } return level2; }; var clear$1 = function(editor, undoManager, index2) { undoManager.data = []; index2.set(0); undoManager.typing = false; editor.fire("ClearUndos"); }; var extra$1 = function(editor, undoManager, index2, callback1, callback2) { if (undoManager.transact(callback1)) { var bookmark = undoManager.data[index2.get()].bookmark; var lastLevel = undoManager.data[index2.get() - 1]; applyToEditor(editor, lastLevel, true); if (undoManager.transact(callback2)) { undoManager.data[index2.get() - 1].beforeBookmark = bookmark; } } }; var redo$1 = function(editor, index2, data66) { var level2; if (index2.get() < data66.length - 1) { index2.set(index2.get() + 1); level2 = data66[index2.get()]; applyToEditor(editor, level2, false); editor.setDirty(true); editor.fire("Redo", { level: level2 }); } return level2; }; var undo$1 = function(editor, undoManager, locks, index2) { var level2; if (undoManager.typing) { undoManager.add(); undoManager.typing = false; setTyping(undoManager, false, locks); } if (index2.get() > 0) { index2.set(index2.get() - 1); level2 = undoManager.data[index2.get()]; applyToEditor(editor, level2, true); editor.setDirty(true); editor.fire("Undo", { level: level2 }); } return level2; }; var reset$1 = function(undoManager) { undoManager.clear(); undoManager.add(); }; var hasUndo$1 = function(editor, undoManager, index2) { return index2.get() > 0 || undoManager.typing && undoManager.data[0] && !isEq$1(createFromEditor(editor), undoManager.data[0]); }; var hasRedo$1 = function(undoManager, index2) { return index2.get() < undoManager.data.length - 1 && !undoManager.typing; }; var transact$1 = function(undoManager, locks, callback2) { endTyping(undoManager, locks); undoManager.beforeChange(); undoManager.ignore(callback2); return undoManager.add(); }; var ignore$1 = function(locks, callback2) { try { locks.set(locks.get() + 1); callback2(); } finally { locks.set(locks.get() - 1); } }; var addVisualInternal = function(editor, elm) { var dom2 = editor.dom; var scope = isNonNullable(elm) ? elm : editor.getBody(); if (isUndefined2(editor.hasVisual)) { editor.hasVisual = isVisualAidsEnabled(editor); } each$k(dom2.select("table,a", scope), function(matchedElm) { switch (matchedElm.nodeName) { case "TABLE": var cls = getVisualAidsTableClass(editor); var value25 = dom2.getAttrib(matchedElm, "border"); if ((!value25 || value25 === "0") && editor.hasVisual) { dom2.addClass(matchedElm, cls); } else { dom2.removeClass(matchedElm, cls); } break; case "A": if (!dom2.getAttrib(matchedElm, "href")) { var value_1 = dom2.getAttrib(matchedElm, "name") || matchedElm.id; var cls_1 = getVisualAidsAnchorClass(editor); if (value_1 && editor.hasVisual) { dom2.addClass(matchedElm, cls_1); } else { dom2.removeClass(matchedElm, cls_1); } } break; } }); editor.fire("VisualAid", { element: elm, hasVisual: editor.hasVisual }); }; var makePlainAdaptor = function(editor) { return { undoManager: { beforeChange: function(locks, beforeBookmark) { return beforeChange$1(editor, locks, beforeBookmark); }, add: function(undoManager, index2, locks, beforeBookmark, level2, event) { return addUndoLevel$1(editor, undoManager, index2, locks, beforeBookmark, level2, event); }, undo: function(undoManager, locks, index2) { return undo$1(editor, undoManager, locks, index2); }, redo: function(index2, data66) { return redo$1(editor, index2, data66); }, clear: function(undoManager, index2) { return clear$1(editor, undoManager, index2); }, reset: function(undoManager) { return reset$1(undoManager); }, hasUndo: function(undoManager, index2) { return hasUndo$1(editor, undoManager, index2); }, hasRedo: function(undoManager, index2) { return hasRedo$1(undoManager, index2); }, transact: function(undoManager, locks, callback2) { return transact$1(undoManager, locks, callback2); }, ignore: function(locks, callback2) { return ignore$1(locks, callback2); }, extra: function(undoManager, index2, callback1, callback2) { return extra$1(editor, undoManager, index2, callback1, callback2); } }, formatter: { match: function(name2, vars, node, similar) { return match$2(editor, name2, vars, node, similar); }, matchAll: function(names2, vars) { return matchAll(editor, names2, vars); }, matchNode: function(node, name2, vars, similar) { return matchNode(editor, node, name2, vars, similar); }, canApply: function(name2) { return canApply(editor, name2); }, closest: function(names2) { return closest(editor, names2); }, apply: function(name2, vars, node) { return applyFormat$1(editor, name2, vars, node); }, remove: function(name2, vars, node, similar) { return remove$1(editor, name2, vars, node, similar); }, toggle: function(name2, vars, node) { return toggle(editor, name2, vars, node); }, formatChanged: function(registeredFormatListeners, formats2, callback2, similar, vars) { return formatChangedInternal(editor, registeredFormatListeners, formats2, callback2, similar, vars); } }, editor: { getContent: function(args, format3) { return getContentInternal(editor, args, format3); }, setContent: function(content, args) { return setContentInternal(editor, content, args); }, insertContent: function(value25, details) { return insertHtmlAtCaret(editor, value25, details); }, addVisual: function(elm) { return addVisualInternal(editor, elm); } }, selection: { getContent: function(format3, args) { return getSelectedContentInternal(editor, format3, args); } }, raw: { getModel: function() { return Optional.none(); } } }; }; var makeRtcAdaptor = function(rtcEditor) { var defaultVars = function(vars) { return isObject3(vars) ? vars : {}; }; var undoManager = rtcEditor.undoManager, formatter = rtcEditor.formatter, editor = rtcEditor.editor, selection = rtcEditor.selection, raw = rtcEditor.raw; return { undoManager: { beforeChange: undoManager.beforeChange, add: undoManager.add, undo: undoManager.undo, redo: undoManager.redo, clear: undoManager.clear, reset: undoManager.reset, hasUndo: undoManager.hasUndo, hasRedo: undoManager.hasRedo, transact: function(_undoManager, _locks, fn) { return undoManager.transact(fn); }, ignore: function(_locks, callback2) { return undoManager.ignore(callback2); }, extra: function(_undoManager, _index, callback1, callback2) { return undoManager.extra(callback1, callback2); } }, formatter: { match: function(name2, vars, _node, similar) { return formatter.match(name2, defaultVars(vars), similar); }, matchAll: formatter.matchAll, matchNode: formatter.matchNode, canApply: function(name2) { return formatter.canApply(name2); }, closest: function(names2) { return formatter.closest(names2); }, apply: function(name2, vars, _node) { return formatter.apply(name2, defaultVars(vars)); }, remove: function(name2, vars, _node, _similar) { return formatter.remove(name2, defaultVars(vars)); }, toggle: function(name2, vars, _node) { return formatter.toggle(name2, defaultVars(vars)); }, formatChanged: function(_rfl, formats2, callback2, similar, vars) { return formatter.formatChanged(formats2, callback2, similar, vars); } }, editor: { getContent: function(args, _format) { return editor.getContent(args); }, setContent: function(content, args) { return editor.setContent(content, args); }, insertContent: function(content, _details) { return editor.insertContent(content); }, addVisual: editor.addVisual }, selection: { getContent: function(_format, args) { return selection.getContent(args); } }, raw: { getModel: function() { return Optional.some(raw.getRawModel()); } } }; }; var makeNoopAdaptor = function() { var nul = constant2(null); var empty3 = constant2(""); return { undoManager: { beforeChange: noop2, add: nul, undo: nul, redo: nul, clear: noop2, reset: noop2, hasUndo: never, hasRedo: never, transact: nul, ignore: noop2, extra: noop2 }, formatter: { match: never, matchAll: constant2([]), matchNode: constant2(void 0), canApply: never, closest: empty3, apply: noop2, remove: noop2, toggle: noop2, formatChanged: constant2({ unbind: noop2 }) }, editor: { getContent: empty3, setContent: empty3, insertContent: noop2, addVisual: noop2 }, selection: { getContent: empty3 }, raw: { getModel: constant2(Optional.none()) } }; }; var isRtc = function(editor) { return has$22(editor.plugins, "rtc"); }; var getRtcSetup = function(editor) { return get$9(editor.plugins, "rtc").bind(function(rtcPlugin) { return Optional.from(rtcPlugin.setup); }); }; var setup$i = function(editor) { var editorCast = editor; return getRtcSetup(editor).fold(function() { editorCast.rtcInstance = makePlainAdaptor(editor); return Optional.none(); }, function(setup124) { editorCast.rtcInstance = makeNoopAdaptor(); return Optional.some(function() { return setup124().then(function(rtcEditor) { editorCast.rtcInstance = makeRtcAdaptor(rtcEditor); return rtcEditor.rtc.isRemote; }); }); }); }; var getRtcInstanceWithFallback = function(editor) { return editor.rtcInstance ? editor.rtcInstance : makePlainAdaptor(editor); }; var getRtcInstanceWithError = function(editor) { var rtcInstance = editor.rtcInstance; if (!rtcInstance) { throw new Error("Failed to get RTC instance not yet initialized."); } else { return rtcInstance; } }; var beforeChange = function(editor, locks, beforeBookmark) { getRtcInstanceWithError(editor).undoManager.beforeChange(locks, beforeBookmark); }; var addUndoLevel = function(editor, undoManager, index2, locks, beforeBookmark, level2, event) { return getRtcInstanceWithError(editor).undoManager.add(undoManager, index2, locks, beforeBookmark, level2, event); }; var undo = function(editor, undoManager, locks, index2) { return getRtcInstanceWithError(editor).undoManager.undo(undoManager, locks, index2); }; var redo = function(editor, index2, data66) { return getRtcInstanceWithError(editor).undoManager.redo(index2, data66); }; var clear2 = function(editor, undoManager, index2) { getRtcInstanceWithError(editor).undoManager.clear(undoManager, index2); }; var reset2 = function(editor, undoManager) { getRtcInstanceWithError(editor).undoManager.reset(undoManager); }; var hasUndo = function(editor, undoManager, index2) { return getRtcInstanceWithError(editor).undoManager.hasUndo(undoManager, index2); }; var hasRedo = function(editor, undoManager, index2) { return getRtcInstanceWithError(editor).undoManager.hasRedo(undoManager, index2); }; var transact = function(editor, undoManager, locks, callback2) { return getRtcInstanceWithError(editor).undoManager.transact(undoManager, locks, callback2); }; var ignore = function(editor, locks, callback2) { getRtcInstanceWithError(editor).undoManager.ignore(locks, callback2); }; var extra = function(editor, undoManager, index2, callback1, callback2) { getRtcInstanceWithError(editor).undoManager.extra(undoManager, index2, callback1, callback2); }; var matchFormat = function(editor, name2, vars, node, similar) { return getRtcInstanceWithError(editor).formatter.match(name2, vars, node, similar); }; var matchAllFormats = function(editor, names2, vars) { return getRtcInstanceWithError(editor).formatter.matchAll(names2, vars); }; var matchNodeFormat = function(editor, node, name2, vars, similar) { return getRtcInstanceWithError(editor).formatter.matchNode(node, name2, vars, similar); }; var canApplyFormat = function(editor, name2) { return getRtcInstanceWithError(editor).formatter.canApply(name2); }; var closestFormat = function(editor, names2) { return getRtcInstanceWithError(editor).formatter.closest(names2); }; var applyFormat = function(editor, name2, vars, node) { getRtcInstanceWithError(editor).formatter.apply(name2, vars, node); }; var removeFormat = function(editor, name2, vars, node, similar) { getRtcInstanceWithError(editor).formatter.remove(name2, vars, node, similar); }; var toggleFormat = function(editor, name2, vars, node) { getRtcInstanceWithError(editor).formatter.toggle(name2, vars, node); }; var formatChanged = function(editor, registeredFormatListeners, formats2, callback2, similar, vars) { return getRtcInstanceWithError(editor).formatter.formatChanged(registeredFormatListeners, formats2, callback2, similar, vars); }; var getContent$2 = function(editor, args, format3) { return getRtcInstanceWithFallback(editor).editor.getContent(args, format3); }; var setContent$2 = function(editor, content, args) { return getRtcInstanceWithFallback(editor).editor.setContent(content, args); }; var insertContent = function(editor, value25, details) { return getRtcInstanceWithFallback(editor).editor.insertContent(value25, details); }; var getSelectedContent = function(editor, format3, args) { return getRtcInstanceWithError(editor).selection.getContent(format3, args); }; var addVisual$1 = function(editor, elm) { return getRtcInstanceWithError(editor).editor.addVisual(elm); }; var getContent$1 = function(editor, args) { if (args === void 0) { args = {}; } var format3 = args.format ? args.format : "html"; return getSelectedContent(editor, format3, args); }; var removeEmpty = function(text) { if (text.dom.length === 0) { remove$7(text); return Optional.none(); } else { return Optional.some(text); } }; var walkPastBookmark = function(node, start2) { return node.filter(function(elm) { return BookmarkManager.isBookmarkNode(elm.dom); }).bind(start2 ? nextSibling : prevSibling); }; var merge4 = function(outer, inner, rng, start2) { var outerElm = outer.dom; var innerElm = inner.dom; var oldLength = start2 ? outerElm.length : innerElm.length; if (start2) { mergeTextNodes(outerElm, innerElm, false, !start2); rng.setStart(innerElm, oldLength); } else { mergeTextNodes(innerElm, outerElm, false, !start2); rng.setEnd(innerElm, oldLength); } }; var normalizeTextIfRequired = function(inner, start2) { parent2(inner).each(function(root2) { var text = inner.dom; if (start2 && needsToBeNbspLeft(root2, CaretPosition(text, 0))) { normalizeWhitespaceAfter(text, 0); } else if (!start2 && needsToBeNbspRight(root2, CaretPosition(text, text.length))) { normalizeWhitespaceBefore(text, text.length); } }); }; var mergeAndNormalizeText = function(outerNode, innerNode, rng, start2) { outerNode.bind(function(outer) { var normalizer = start2 ? normalizeWhitespaceBefore : normalizeWhitespaceAfter; normalizer(outer.dom, start2 ? outer.dom.length : 0); return innerNode.filter(isText$8).map(function(inner) { return merge4(outer, inner, rng, start2); }); }).orThunk(function() { var innerTextNode = walkPastBookmark(innerNode, start2).or(innerNode).filter(isText$8); return innerTextNode.map(function(inner) { return normalizeTextIfRequired(inner, start2); }); }); }; var rngSetContent = function(rng, fragment) { var firstChild2 = Optional.from(fragment.firstChild).map(SugarElement.fromDom); var lastChild2 = Optional.from(fragment.lastChild).map(SugarElement.fromDom); rng.deleteContents(); rng.insertNode(fragment); var prevText = firstChild2.bind(prevSibling).filter(isText$8).bind(removeEmpty); var nextText = lastChild2.bind(nextSibling).filter(isText$8).bind(removeEmpty); mergeAndNormalizeText(prevText, firstChild2, rng, true); mergeAndNormalizeText(nextText, lastChild2, rng, false); rng.collapse(false); }; var setupArgs = function(args, content) { return __assign(__assign({ format: "html" }, args), { set: true, selection: true, content }); }; var cleanContent = function(editor, args) { if (args.format !== "raw") { var rng = editor.selection.getRng(); var contextBlock = editor.dom.getParent(rng.commonAncestorContainer, editor.dom.isBlock); var contextArgs = contextBlock ? { context: contextBlock.nodeName.toLowerCase() } : {}; var node = editor.parser.parse(args.content, __assign(__assign({ isRootContent: true, forced_root_block: false }, contextArgs), args)); return HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(node); } else { return args.content; } }; var setContent$1 = function(editor, content, args) { if (args === void 0) { args = {}; } var defaultedArgs = setupArgs(args, content); var updatedArgs = defaultedArgs; if (!defaultedArgs.no_events) { var eventArgs = editor.fire("BeforeSetContent", defaultedArgs); if (eventArgs.isDefaultPrevented()) { editor.fire("SetContent", eventArgs); return; } else { updatedArgs = eventArgs; } } updatedArgs.content = cleanContent(editor, updatedArgs); var rng = editor.selection.getRng(); rngSetContent(rng, rng.createContextualFragment(updatedArgs.content)); editor.selection.setRng(rng); scrollRangeIntoView(editor, rng); if (!updatedArgs.no_events) { editor.fire("SetContent", updatedArgs); } }; var deleteFromCallbackMap = function(callbackMap, selector2, callback2) { if (callbackMap && has$22(callbackMap, selector2)) { var newCallbacks = filter$4(callbackMap[selector2], function(cb) { return cb !== callback2; }); if (newCallbacks.length === 0) { delete callbackMap[selector2]; } else { callbackMap[selector2] = newCallbacks; } } }; function SelectorChanged(dom2, editor) { var selectorChangedData; var currentSelectors; var findMatchingNode = function(selector2, nodes2) { return find$3(nodes2, function(node) { return dom2.is(node, selector2); }); }; var getParents2 = function(elem) { return dom2.getParents(elem, null, dom2.getRoot()); }; return { selectorChangedWithUnbind: function(selector2, callback2) { if (!selectorChangedData) { selectorChangedData = {}; currentSelectors = {}; editor.on("NodeChange", function(e2) { var node = e2.element; var parents2 = getParents2(node); var matchedSelectors = {}; Tools.each(selectorChangedData, function(callbacks2, selector3) { findMatchingNode(selector3, parents2).each(function(node2) { if (!currentSelectors[selector3]) { each$k(callbacks2, function(callback3) { callback3(true, { node: node2, selector: selector3, parents: parents2 }); }); currentSelectors[selector3] = callbacks2; } matchedSelectors[selector3] = callbacks2; }); }); Tools.each(currentSelectors, function(callbacks2, selector3) { if (!matchedSelectors[selector3]) { delete currentSelectors[selector3]; Tools.each(callbacks2, function(callback3) { callback3(false, { node, selector: selector3, parents: parents2 }); }); } }); }); } if (!selectorChangedData[selector2]) { selectorChangedData[selector2] = []; } selectorChangedData[selector2].push(callback2); findMatchingNode(selector2, getParents2(editor.selection.getStart())).each(function() { currentSelectors[selector2] = selectorChangedData[selector2]; }); return { unbind: function() { deleteFromCallbackMap(selectorChangedData, selector2, callback2); deleteFromCallbackMap(currentSelectors, selector2, callback2); } }; } }; } var isNativeIeSelection = function(rng) { return !!rng.select; }; var isAttachedToDom = function(node) { return !!(node && node.ownerDocument) && contains$1(SugarElement.fromDom(node.ownerDocument), SugarElement.fromDom(node)); }; var isValidRange = function(rng) { if (!rng) { return false; } else if (isNativeIeSelection(rng)) { return true; } else { return isAttachedToDom(rng.startContainer) && isAttachedToDom(rng.endContainer); } }; var EditorSelection = function(dom2, win, serializer, editor) { var selectedRange; var explicitRange; var selectorChangedWithUnbind = SelectorChanged(dom2, editor).selectorChangedWithUnbind; var setCursorLocation = function(node, offset4) { var rng = dom2.createRng(); if (isNonNullable(node) && isNonNullable(offset4)) { rng.setStart(node, offset4); rng.setEnd(node, offset4); setRng(rng); collapse2(false); } else { moveEndPoint(dom2, rng, editor.getBody(), true); setRng(rng); } }; var getContent2 = function(args) { return getContent$1(editor, args); }; var setContent2 = function(content, args) { return setContent$1(editor, content, args); }; var getStart$12 = function(real) { return getStart(editor.getBody(), getRng$1(), real); }; var getEnd$1 = function(real) { return getEnd(editor.getBody(), getRng$1(), real); }; var getBookmark2 = function(type3, normalized) { return bookmarkManager.getBookmark(type3, normalized); }; var moveToBookmark2 = function(bookmark) { return bookmarkManager.moveToBookmark(bookmark); }; var select$12 = function(node, content) { select2(dom2, node, content).each(setRng); return node; }; var isCollapsed = function() { var rng = getRng$1(), sel = getSel(); if (!rng || rng.item) { return false; } if (rng.compareEndPoints) { return rng.compareEndPoints("StartToEnd", rng) === 0; } return !sel || rng.collapsed; }; var collapse2 = function(toStart) { var rng = getRng$1(); rng.collapse(!!toStart); setRng(rng); }; var getSel = function() { return win.getSelection ? win.getSelection() : win.document.selection; }; var getRng$1 = function() { var selection, rng, elm; var tryCompareBoundaryPoints = function(how, sourceRange, destinationRange) { try { return sourceRange.compareBoundaryPoints(how, destinationRange); } catch (ex) { return -1; } }; var doc2 = win.document; if (editor.bookmark !== void 0 && hasFocus(editor) === false) { var bookmark = getRng(editor); if (bookmark.isSome()) { return bookmark.map(function(r3) { return processRanges(editor, [r3])[0]; }).getOr(doc2.createRange()); } } try { if ((selection = getSel()) && !isRestrictedNode(selection.anchorNode)) { if (selection.rangeCount > 0) { rng = selection.getRangeAt(0); } else { rng = selection.createRange ? selection.createRange() : doc2.createRange(); } rng = processRanges(editor, [rng])[0]; } } catch (ex) { } if (!rng) { rng = doc2.createRange ? doc2.createRange() : doc2.body.createTextRange(); } if (rng.setStart && rng.startContainer.nodeType === 9 && rng.collapsed) { elm = dom2.getRoot(); rng.setStart(elm, 0); rng.setEnd(elm, 0); } if (selectedRange && explicitRange) { if (tryCompareBoundaryPoints(rng.START_TO_START, rng, selectedRange) === 0 && tryCompareBoundaryPoints(rng.END_TO_END, rng, selectedRange) === 0) { rng = explicitRange; } else { selectedRange = null; explicitRange = null; } } return rng; }; var setRng = function(rng, forward) { var node; if (!isValidRange(rng)) { return; } var ieRange = isNativeIeSelection(rng) ? rng : null; if (ieRange) { explicitRange = null; try { ieRange.select(); } catch (ex) { } return; } var sel = getSel(); var evt = editor.fire("SetSelectionRange", { range: rng, forward }); rng = evt.range; if (sel) { explicitRange = rng; try { sel.removeAllRanges(); sel.addRange(rng); } catch (ex) { } if (forward === false && sel.extend) { sel.collapse(rng.endContainer, rng.endOffset); sel.extend(rng.startContainer, rng.startOffset); } selectedRange = sel.rangeCount > 0 ? sel.getRangeAt(0) : null; } if (!rng.collapsed && rng.startContainer === rng.endContainer && sel.setBaseAndExtent && !Env.ie) { if (rng.endOffset - rng.startOffset < 2) { if (rng.startContainer.hasChildNodes()) { node = rng.startContainer.childNodes[rng.startOffset]; if (node && node.tagName === "IMG") { sel.setBaseAndExtent(rng.startContainer, rng.startOffset, rng.endContainer, rng.endOffset); if (sel.anchorNode !== rng.startContainer || sel.focusNode !== rng.endContainer) { sel.setBaseAndExtent(node, 0, node, 1); } } } } } editor.fire("AfterSetSelectionRange", { range: rng, forward }); }; var setNode = function(elm) { setContent2(dom2.getOuterHTML(elm)); return elm; }; var getNode$12 = function() { return getNode(editor.getBody(), getRng$1()); }; var getSelectedBlocks$1 = function(startElm, endElm) { return getSelectedBlocks(dom2, getRng$1(), startElm, endElm); }; var isForward = function() { var sel = getSel(); var anchorNode = sel === null || sel === void 0 ? void 0 : sel.anchorNode; var focusNode = sel === null || sel === void 0 ? void 0 : sel.focusNode; if (!sel || !anchorNode || !focusNode || isRestrictedNode(anchorNode) || isRestrictedNode(focusNode)) { return true; } var anchorRange = dom2.createRng(); anchorRange.setStart(anchorNode, sel.anchorOffset); anchorRange.collapse(true); var focusRange = dom2.createRng(); focusRange.setStart(focusNode, sel.focusOffset); focusRange.collapse(true); return anchorRange.compareBoundaryPoints(anchorRange.START_TO_START, focusRange) <= 0; }; var normalize3 = function() { var rng = getRng$1(); var sel = getSel(); if (!hasMultipleRanges(sel) && hasAnyRanges(editor)) { var normRng = normalize$2(dom2, rng); normRng.each(function(normRng2) { setRng(normRng2, isForward()); }); return normRng.getOr(rng); } return rng; }; var selectorChanged = function(selector2, callback2) { selectorChangedWithUnbind(selector2, callback2); return exports2; }; var getScrollContainer = function() { var scrollContainer; var node = dom2.getRoot(); while (node && node.nodeName !== "BODY") { if (node.scrollHeight > node.clientHeight) { scrollContainer = node; break; } node = node.parentNode; } return scrollContainer; }; var scrollIntoView2 = function(elm, alignToTop) { if (isNonNullable(elm)) { scrollElementIntoView(editor, elm, alignToTop); } else { scrollRangeIntoView(editor, getRng$1(), alignToTop); } }; var placeCaretAt = function(clientX, clientY) { return setRng(fromPoint(clientX, clientY, editor.getDoc())); }; var getBoundingClientRect3 = function() { var rng = getRng$1(); return rng.collapsed ? CaretPosition.fromRangeStart(rng).getClientRects()[0] : rng.getBoundingClientRect(); }; var destroy4 = function() { win = selectedRange = explicitRange = null; controlSelection.destroy(); }; var exports2 = { bookmarkManager: null, controlSelection: null, dom: dom2, win, serializer, editor, collapse: collapse2, setCursorLocation, getContent: getContent2, setContent: setContent2, getBookmark: getBookmark2, moveToBookmark: moveToBookmark2, select: select$12, isCollapsed, isForward, setNode, getNode: getNode$12, getSel, setRng, getRng: getRng$1, getStart: getStart$12, getEnd: getEnd$1, getSelectedBlocks: getSelectedBlocks$1, normalize: normalize3, selectorChanged, selectorChangedWithUnbind, getScrollContainer, scrollIntoView: scrollIntoView2, placeCaretAt, getBoundingClientRect: getBoundingClientRect3, destroy: destroy4 }; var bookmarkManager = BookmarkManager(exports2); var controlSelection = ControlSelection(exports2, editor); exports2.bookmarkManager = bookmarkManager; exports2.controlSelection = controlSelection; return exports2; }; var removeAttrs = function(node, names2) { each$k(names2, function(name2) { node.attr(name2, null); }); }; var addFontToSpansFilter = function(domParser, styles, fontSizes) { domParser.addNodeFilter("font", function(nodes2) { each$k(nodes2, function(node) { var props2 = styles.parse(node.attr("style")); var color = node.attr("color"); var face = node.attr("face"); var size = node.attr("size"); if (color) { props2.color = color; } if (face) { props2["font-family"] = face; } if (size) { props2["font-size"] = fontSizes[parseInt(node.attr("size"), 10) - 1]; } node.name = "span"; node.attr("style", styles.serialize(props2)); removeAttrs(node, [ "color", "face", "size" ]); }); }); }; var addStrikeToSpanFilter = function(domParser, styles) { domParser.addNodeFilter("strike", function(nodes2) { each$k(nodes2, function(node) { var props2 = styles.parse(node.attr("style")); props2["text-decoration"] = "line-through"; node.name = "span"; node.attr("style", styles.serialize(props2)); }); }); }; var addFilters = function(domParser, settings) { var styles = Styles(); if (settings.convert_fonts_to_spans) { addFontToSpansFilter(domParser, styles, Tools.explode(settings.font_size_legacy_values)); } addStrikeToSpanFilter(domParser, styles); }; var register$2 = function(domParser, settings) { if (settings.inline_styles) { addFilters(domParser, settings); } }; var blobUriToBlob = function(url2) { return new promiseObj(function(resolve2, reject) { var rejectWithError = function() { reject("Cannot convert " + url2 + " to Blob. Resource might not exist or is inaccessible."); }; try { var xhr_1 = new XMLHttpRequest(); xhr_1.open("GET", url2, true); xhr_1.responseType = "blob"; xhr_1.onload = function() { if (xhr_1.status === 200) { resolve2(xhr_1.response); } else { rejectWithError(); } }; xhr_1.onerror = rejectWithError; xhr_1.send(); } catch (ex) { rejectWithError(); } }); }; var parseDataUri = function(uri) { var type3; var uriParts = decodeURIComponent(uri).split(","); var matches2 = /data:([^;]+)/.exec(uriParts[0]); if (matches2) { type3 = matches2[1]; } return { type: type3, data: uriParts[1] }; }; var buildBlob = function(type3, data66) { var str; try { str = atob(data66); } catch (e2) { return Optional.none(); } var arr2 = new Uint8Array(str.length); for (var i2 = 0; i2 < arr2.length; i2++) { arr2[i2] = str.charCodeAt(i2); } return Optional.some(new Blob([arr2], { type: type3 })); }; var dataUriToBlob = function(uri) { return new promiseObj(function(resolve2) { var _a3 = parseDataUri(uri), type3 = _a3.type, data66 = _a3.data; buildBlob(type3, data66).fold(function() { return resolve2(new Blob([])); }, resolve2); }); }; var uriToBlob = function(url2) { if (url2.indexOf("blob:") === 0) { return blobUriToBlob(url2); } if (url2.indexOf("data:") === 0) { return dataUriToBlob(url2); } return null; }; var blobToDataUri = function(blob) { return new promiseObj(function(resolve2) { var reader = new FileReader(); reader.onloadend = function() { resolve2(reader.result); }; reader.readAsDataURL(blob); }); }; var count$1 = 0; var uniqueId = function(prefix) { return (prefix || "blobid") + count$1++; }; var imageToBlobInfo = function(blobCache, img, resolve2, reject) { var base64, blobInfo; if (img.src.indexOf("blob:") === 0) { blobInfo = blobCache.getByUri(img.src); if (blobInfo) { resolve2({ image: img, blobInfo }); } else { uriToBlob(img.src).then(function(blob) { blobToDataUri(blob).then(function(dataUri) { base64 = parseDataUri(dataUri).data; blobInfo = blobCache.create(uniqueId(), blob, base64); blobCache.add(blobInfo); resolve2({ image: img, blobInfo }); }); }, function(err) { reject(err); }); } return; } var _a3 = parseDataUri(img.src), data66 = _a3.data, type3 = _a3.type; base64 = data66; blobInfo = blobCache.getByData(base64, type3); if (blobInfo) { resolve2({ image: img, blobInfo }); } else { uriToBlob(img.src).then(function(blob) { blobInfo = blobCache.create(uniqueId(), blob, base64); blobCache.add(blobInfo); resolve2({ image: img, blobInfo }); }, function(err) { reject(err); }); } }; var getAllImages = function(elm) { return elm ? from2(elm.getElementsByTagName("img")) : []; }; var ImageScanner = function(uploadStatus, blobCache) { var cachedPromises = {}; var findAll2 = function(elm, predicate) { if (!predicate) { predicate = always; } var images = filter$4(getAllImages(elm), function(img) { var src2 = img.src; if (!Env.fileApi) { return false; } if (img.hasAttribute("data-mce-bogus")) { return false; } if (img.hasAttribute("data-mce-placeholder")) { return false; } if (!src2 || src2 === Env.transparentSrc) { return false; } if (src2.indexOf("blob:") === 0) { return !uploadStatus.isUploaded(src2) && predicate(img); } if (src2.indexOf("data:") === 0) { return predicate(img); } return false; }); var promises = map$3(images, function(img) { if (cachedPromises[img.src] !== void 0) { return new promiseObj(function(resolve2) { cachedPromises[img.src].then(function(imageInfo) { if (typeof imageInfo === "string") { return imageInfo; } resolve2({ image: img, blobInfo: imageInfo.blobInfo }); }); }); } var newPromise = new promiseObj(function(resolve2, reject) { imageToBlobInfo(blobCache, img, resolve2, reject); }).then(function(result) { delete cachedPromises[result.image.src]; return result; }).catch(function(error4) { delete cachedPromises[img.src]; return error4; }); cachedPromises[img.src] = newPromise; return newPromise; }); return promiseObj.all(promises); }; return { findAll: findAll2 }; }; var paddEmptyNode = function(settings, args, blockElements, node) { var brPreferred = settings.padd_empty_with_br || args.insert; if (brPreferred && blockElements[node.name]) { node.empty().append(new AstNode("br", 1)).shortEnded = true; } else { node.empty().append(new AstNode("#text", 3)).value = nbsp; } }; var isPaddedWithNbsp = function(node) { return hasOnlyChild(node, "#text") && node.firstChild.value === nbsp; }; var hasOnlyChild = function(node, name2) { return node && node.firstChild && node.firstChild === node.lastChild && node.firstChild.name === name2; }; var isPadded = function(schema2, node) { var rule = schema2.getElementRule(node.name); return rule && rule.paddEmpty; }; var isEmpty = function(schema2, nonEmptyElements, whitespaceElements, node) { return node.isEmpty(nonEmptyElements, whitespaceElements, function(node2) { return isPadded(schema2, node2); }); }; var isLineBreakNode = function(node, blockElements) { return node && (has$22(blockElements, node.name) || node.name === "br"); }; var isBogusImage = function(img) { return isNonNullable(img.attr("data-mce-bogus")); }; var isInternalImageSource = function(img) { return img.attr("src") === Env.transparentSrc || isNonNullable(img.attr("data-mce-placeholder")); }; var isValidDataImg = function(img, settings) { if (settings.images_dataimg_filter) { var imgElem_1 = new Image(); imgElem_1.src = img.attr("src"); each$j(img.attributes.map, function(value25, key2) { imgElem_1.setAttribute(key2, value25); }); return settings.images_dataimg_filter(imgElem_1); } else { return true; } }; var registerBase64ImageFilter = function(parser, settings) { var blobCache = settings.blob_cache; var processImage = function(img) { var inputSrc = img.attr("src"); if (isInternalImageSource(img) || isBogusImage(img)) { return; } parseDataUri$1(inputSrc).filter(function() { return isValidDataImg(img, settings); }).bind(function(_a3) { var type3 = _a3.type, data66 = _a3.data; return Optional.from(blobCache.getByData(data66, type3)).orThunk(function() { return buildBlob(type3, data66).map(function(blob) { var blobInfo = blobCache.create(uniqueId(), blob, data66); blobCache.add(blobInfo); return blobInfo; }); }); }).each(function(blobInfo) { img.attr("src", blobInfo.blobUri()); }); }; if (blobCache) { parser.addAttributeFilter("src", function(nodes2) { return each$k(nodes2, processImage); }); } }; var register$1 = function(parser, settings) { var schema2 = parser.schema; if (settings.remove_trailing_brs) { parser.addNodeFilter("br", function(nodes2, _2, args) { var i2; var l2 = nodes2.length; var node; var blockElements = Tools.extend({}, schema2.getBlockElements()); var nonEmptyElements = schema2.getNonEmptyElements(); var parent3, lastParent, prev2, prevName; var whiteSpaceElements = schema2.getWhiteSpaceElements(); var elementRule, textNode; blockElements.body = 1; for (i2 = 0; i2 < l2; i2++) { node = nodes2[i2]; parent3 = node.parent; if (blockElements[node.parent.name] && node === parent3.lastChild) { prev2 = node.prev; while (prev2) { prevName = prev2.name; if (prevName !== "span" || prev2.attr("data-mce-type") !== "bookmark") { if (prevName === "br") { node = null; } break; } prev2 = prev2.prev; } if (node) { node.remove(); if (isEmpty(schema2, nonEmptyElements, whiteSpaceElements, parent3)) { elementRule = schema2.getElementRule(parent3.name); if (elementRule) { if (elementRule.removeEmpty) { parent3.remove(); } else if (elementRule.paddEmpty) { paddEmptyNode(settings, args, blockElements, parent3); } } } } } else { lastParent = node; while (parent3 && parent3.firstChild === lastParent && parent3.lastChild === lastParent) { lastParent = parent3; if (blockElements[parent3.name]) { break; } parent3 = parent3.parent; } if (lastParent === parent3 && settings.padd_empty_with_br !== true) { textNode = new AstNode("#text", 3); textNode.value = nbsp; node.replace(textNode); } } } }); } parser.addAttributeFilter("href", function(nodes2) { var i2 = nodes2.length; var appendRel = function(rel) { var parts = rel.split(" ").filter(function(p) { return p.length > 0; }); return parts.concat(["noopener"]).sort().join(" "); }; var addNoOpener = function(rel) { var newRel = rel ? Tools.trim(rel) : ""; if (!/\b(noopener)\b/g.test(newRel)) { return appendRel(newRel); } else { return newRel; } }; if (!settings.allow_unsafe_link_target) { while (i2--) { var node = nodes2[i2]; if (node.name === "a" && node.attr("target") === "_blank") { node.attr("rel", addNoOpener(node.attr("rel"))); } } } }); if (!settings.allow_html_in_named_anchor) { parser.addAttributeFilter("id,name", function(nodes2) { var i2 = nodes2.length, sibling2, prevSibling2, parent3, node; while (i2--) { node = nodes2[i2]; if (node.name === "a" && node.firstChild && !node.attr("href")) { parent3 = node.parent; sibling2 = node.lastChild; do { prevSibling2 = sibling2.prev; parent3.insert(sibling2, node); sibling2 = prevSibling2; } while (sibling2); } } }); } if (settings.fix_list_elements) { parser.addNodeFilter("ul,ol", function(nodes2) { var i2 = nodes2.length, node, parentNode; while (i2--) { node = nodes2[i2]; parentNode = node.parent; if (parentNode.name === "ul" || parentNode.name === "ol") { if (node.prev && node.prev.name === "li") { node.prev.append(node); } else { var li = new AstNode("li", 1); li.attr("style", "list-style-type: none"); node.wrap(li); } } } }); } if (settings.validate && schema2.getValidClasses()) { parser.addAttributeFilter("class", function(nodes2) { var validClasses = schema2.getValidClasses(); var i2 = nodes2.length; while (i2--) { var node = nodes2[i2]; var classList = node.attr("class").split(" "); var classValue = ""; for (var ci = 0; ci < classList.length; ci++) { var className = classList[ci]; var valid = false; var validClassesMap = validClasses["*"]; if (validClassesMap && validClassesMap[className]) { valid = true; } validClassesMap = validClasses[node.name]; if (!valid && validClassesMap && validClassesMap[className]) { valid = true; } if (valid) { if (classValue) { classValue += " "; } classValue += className; } } if (!classValue.length) { classValue = null; } node.attr("class", classValue); } }); } registerBase64ImageFilter(parser, settings); }; var makeMap = Tools.makeMap, each$6 = Tools.each, explode$2 = Tools.explode, extend$4 = Tools.extend; var DomParser = function(settings, schema2) { if (schema2 === void 0) { schema2 = Schema2(); } var nodeFilters = {}; var attributeFilters = []; var matchedNodes = {}; var matchedAttributes = {}; settings = settings || {}; settings.validate = "validate" in settings ? settings.validate : true; settings.root_name = settings.root_name || "body"; var fixInvalidChildren = function(nodes2) { var nonSplitableElements = makeMap("tr,td,th,tbody,thead,tfoot,table"); var nonEmptyElements = schema2.getNonEmptyElements(); var whitespaceElements = schema2.getWhiteSpaceElements(); var textBlockElements = schema2.getTextBlockElements(); var specialElements = schema2.getSpecialElements(); var removeOrUnwrapInvalidNode = function(node2, originalNodeParent) { if (originalNodeParent === void 0) { originalNodeParent = node2.parent; } if (specialElements[node2.name]) { node2.empty().remove(); } else { var children2 = node2.children(); for (var _i = 0, children_1 = children2; _i < children_1.length; _i++) { var childNode2 = children_1[_i]; if (!schema2.isValidChild(originalNodeParent.name, childNode2.name)) { removeOrUnwrapInvalidNode(childNode2, originalNodeParent); } } node2.unwrap(); } }; for (var ni = 0; ni < nodes2.length; ni++) { var node = nodes2[ni]; var parent_1 = void 0, newParent = void 0, tempNode = void 0; if (!node.parent || node.fixed) { continue; } if (textBlockElements[node.name] && node.parent.name === "li") { var sibling2 = node.next; while (sibling2) { if (textBlockElements[sibling2.name]) { sibling2.name = "li"; sibling2.fixed = true; node.parent.insert(sibling2, node.parent); } else { break; } sibling2 = sibling2.next; } node.unwrap(); continue; } var parents2 = [node]; for (parent_1 = node.parent; parent_1 && !schema2.isValidChild(parent_1.name, node.name) && !nonSplitableElements[parent_1.name]; parent_1 = parent_1.parent) { parents2.push(parent_1); } if (parent_1 && parents2.length > 1) { if (schema2.isValidChild(parent_1.name, node.name)) { parents2.reverse(); newParent = filterNode(parents2[0].clone()); var currentNode = newParent; for (var i2 = 0; i2 < parents2.length - 1; i2++) { if (schema2.isValidChild(currentNode.name, parents2[i2].name)) { tempNode = filterNode(parents2[i2].clone()); currentNode.append(tempNode); } else { tempNode = currentNode; } for (var childNode = parents2[i2].firstChild; childNode && childNode !== parents2[i2 + 1]; ) { var nextNode = childNode.next; tempNode.append(childNode); childNode = nextNode; } currentNode = tempNode; } if (!isEmpty(schema2, nonEmptyElements, whitespaceElements, newParent)) { parent_1.insert(newParent, parents2[0], true); parent_1.insert(node, newParent); } else { parent_1.insert(node, parents2[0], true); } parent_1 = parents2[0]; if (isEmpty(schema2, nonEmptyElements, whitespaceElements, parent_1) || hasOnlyChild(parent_1, "br")) { parent_1.empty().remove(); } } else { removeOrUnwrapInvalidNode(node); } } else if (node.parent) { if (node.name === "li") { var sibling2 = node.prev; if (sibling2 && (sibling2.name === "ul" || sibling2.name === "ol")) { sibling2.append(node); continue; } sibling2 = node.next; if (sibling2 && (sibling2.name === "ul" || sibling2.name === "ol")) { sibling2.insert(node, sibling2.firstChild, true); continue; } node.wrap(filterNode(new AstNode("ul", 1))); continue; } if (schema2.isValidChild(node.parent.name, "div") && schema2.isValidChild("div", node.name)) { node.wrap(filterNode(new AstNode("div", 1))); } else { removeOrUnwrapInvalidNode(node); } } } }; var filterNode = function(node) { var name2 = node.name; if (name2 in nodeFilters) { var list = matchedNodes[name2]; if (list) { list.push(node); } else { matchedNodes[name2] = [node]; } } var i2 = attributeFilters.length; while (i2--) { var attrName = attributeFilters[i2].name; if (attrName in node.attributes.map) { var list = matchedAttributes[attrName]; if (list) { list.push(node); } else { matchedAttributes[attrName] = [node]; } } } return node; }; var addNodeFilter = function(name2, callback2) { each$6(explode$2(name2), function(name3) { var list = nodeFilters[name3]; if (!list) { nodeFilters[name3] = list = []; } list.push(callback2); }); }; var getNodeFilters = function() { var out = []; for (var name_1 in nodeFilters) { if (has$22(nodeFilters, name_1)) { out.push({ name: name_1, callbacks: nodeFilters[name_1] }); } } return out; }; var addAttributeFilter = function(name2, callback2) { each$6(explode$2(name2), function(name3) { var i2; for (i2 = 0; i2 < attributeFilters.length; i2++) { if (attributeFilters[i2].name === name3) { attributeFilters[i2].callbacks.push(callback2); return; } } attributeFilters.push({ name: name3, callbacks: [callback2] }); }); }; var getAttributeFilters = function() { return [].concat(attributeFilters); }; var parse2 = function(html, args) { var nodes2, i2, l2, fi, fl, list, name2; var invalidChildren = []; var node; var getRootBlockName = function(name3) { if (name3 === false) { return ""; } else if (name3 === true) { return "p"; } else { return name3; } }; args = args || {}; matchedNodes = {}; matchedAttributes = {}; var blockElements = extend$4(makeMap("script,style,head,html,body,title,meta,param"), schema2.getBlockElements()); var textRootBlockElements = getTextRootBlockElements(schema2); var nonEmptyElements = schema2.getNonEmptyElements(); var children2 = schema2.children; var validate4 = settings.validate; var forcedRootBlockName = "forced_root_block" in args ? args.forced_root_block : settings.forced_root_block; var rootBlockName = getRootBlockName(forcedRootBlockName); var whiteSpaceElements = schema2.getWhiteSpaceElements(); var startWhiteSpaceRegExp = /^[ \t\r\n]+/; var endWhiteSpaceRegExp = /[ \t\r\n]+$/; var allWhiteSpaceRegExp = /[ \t\r\n]+/g; var isAllWhiteSpaceRegExp = /^[ \t\r\n]+$/; var isInWhiteSpacePreservedElement = has$22(whiteSpaceElements, args.context) || has$22(whiteSpaceElements, settings.root_name); var addRootBlocks2 = function() { var node2 = rootNode.firstChild, rootBlockNode = null; var trim3 = function(rootBlock) { if (rootBlock) { node2 = rootBlock.firstChild; if (node2 && node2.type === 3) { node2.value = node2.value.replace(startWhiteSpaceRegExp, ""); } node2 = rootBlock.lastChild; if (node2 && node2.type === 3) { node2.value = node2.value.replace(endWhiteSpaceRegExp, ""); } } }; if (!schema2.isValidChild(rootNode.name, rootBlockName.toLowerCase())) { return; } while (node2) { var next2 = node2.next; if (node2.type === 3 || node2.type === 1 && node2.name !== "p" && !blockElements[node2.name] && !node2.attr("data-mce-type")) { if (!rootBlockNode) { rootBlockNode = createNode(rootBlockName, 1); rootBlockNode.attr(settings.forced_root_block_attrs); rootNode.insert(rootBlockNode, node2); rootBlockNode.append(node2); } else { rootBlockNode.append(node2); } } else { trim3(rootBlockNode); rootBlockNode = null; } node2 = next2; } trim3(rootBlockNode); }; var createNode = function(name3, type3) { var node2 = new AstNode(name3, type3); var list2; if (name3 in nodeFilters) { list2 = matchedNodes[name3]; if (list2) { list2.push(node2); } else { matchedNodes[name3] = [node2]; } } return node2; }; var removeWhitespaceBefore = function(node2) { var blockElements2 = schema2.getBlockElements(); for (var textNode = node2.prev; textNode && textNode.type === 3; ) { var textVal = textNode.value.replace(endWhiteSpaceRegExp, ""); if (textVal.length > 0) { textNode.value = textVal; return; } var textNodeNext = textNode.next; if (textNodeNext) { if (textNodeNext.type === 3 && textNodeNext.value.length) { textNode = textNode.prev; continue; } if (!blockElements2[textNodeNext.name] && textNodeNext.name !== "script" && textNodeNext.name !== "style") { textNode = textNode.prev; continue; } } var sibling2 = textNode.prev; textNode.remove(); textNode = sibling2; } }; var cloneAndExcludeBlocks = function(input) { var output = {}; for (var name_2 in input) { if (name_2 !== "li" && name_2 !== "p") { output[name_2] = input[name_2]; } } return output; }; var isTextRootBlockEmpty = function(node2) { var tempNode = node2; while (isNonNullable(tempNode)) { if (tempNode.name in textRootBlockElements) { return isEmpty(schema2, nonEmptyElements, whiteSpaceElements, tempNode); } else { tempNode = tempNode.parent; } } return false; }; var parser = SaxParser({ validate: validate4, document: settings.document, allow_html_data_urls: settings.allow_html_data_urls, allow_svg_data_urls: settings.allow_svg_data_urls, allow_script_urls: settings.allow_script_urls, allow_conditional_comments: settings.allow_conditional_comments, preserve_cdata: settings.preserve_cdata, self_closing_elements: cloneAndExcludeBlocks(schema2.getSelfClosingElements()), cdata: function(text) { node.append(createNode("#cdata", 4)).value = text; }, text: function(text, raw) { var textNode; if (!isInWhiteSpacePreservedElement) { text = text.replace(allWhiteSpaceRegExp, " "); if (isLineBreakNode(node.lastChild, blockElements)) { text = text.replace(startWhiteSpaceRegExp, ""); } } if (text.length !== 0) { textNode = createNode("#text", 3); textNode.raw = !!raw; node.append(textNode).value = text; } }, comment: function(text) { node.append(createNode("#comment", 8)).value = text; }, pi: function(name3, text) { node.append(createNode(name3, 7)).value = text; removeWhitespaceBefore(node); }, doctype: function(text) { var newNode = node.append(createNode("#doctype", 10)); newNode.value = text; removeWhitespaceBefore(node); }, start: function(name3, attrs, empty3) { var elementRule = validate4 ? schema2.getElementRule(name3) : {}; if (elementRule) { var newNode = createNode(elementRule.outputName || name3, 1); newNode.attributes = attrs; newNode.shortEnded = empty3; node.append(newNode); var parent_2 = children2[node.name]; if (parent_2 && children2[newNode.name] && !parent_2[newNode.name]) { invalidChildren.push(newNode); } var attrFiltersLen = attributeFilters.length; while (attrFiltersLen--) { var attrName = attributeFilters[attrFiltersLen].name; if (attrName in attrs.map) { list = matchedAttributes[attrName]; if (list) { list.push(newNode); } else { matchedAttributes[attrName] = [newNode]; } } } if (blockElements[name3]) { removeWhitespaceBefore(newNode); } if (!empty3) { node = newNode; } if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name3]) { isInWhiteSpacePreservedElement = true; } } }, end: function(name3) { var textNode, text, sibling2; var elementRule = validate4 ? schema2.getElementRule(name3) : {}; if (elementRule) { if (blockElements[name3]) { if (!isInWhiteSpacePreservedElement) { textNode = node.firstChild; if (textNode && textNode.type === 3) { text = textNode.value.replace(startWhiteSpaceRegExp, ""); if (text.length > 0) { textNode.value = text; textNode = textNode.next; } else { sibling2 = textNode.next; textNode.remove(); textNode = sibling2; while (textNode && textNode.type === 3) { text = textNode.value; sibling2 = textNode.next; if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) { textNode.remove(); textNode = sibling2; } textNode = sibling2; } } } textNode = node.lastChild; if (textNode && textNode.type === 3) { text = textNode.value.replace(endWhiteSpaceRegExp, ""); if (text.length > 0) { textNode.value = text; textNode = textNode.prev; } else { sibling2 = textNode.prev; textNode.remove(); textNode = sibling2; while (textNode && textNode.type === 3) { text = textNode.value; sibling2 = textNode.prev; if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) { textNode.remove(); textNode = sibling2; } textNode = sibling2; } } } } } if (isInWhiteSpacePreservedElement && whiteSpaceElements[name3]) { isInWhiteSpacePreservedElement = false; } var isNodeEmpty = isEmpty(schema2, nonEmptyElements, whiteSpaceElements, node); var parentNode = node.parent; if (elementRule.paddInEmptyBlock && isNodeEmpty && isTextRootBlockEmpty(node)) { paddEmptyNode(settings, args, blockElements, node); } else if (elementRule.removeEmpty && isNodeEmpty) { if (blockElements[node.name]) { node.empty().remove(); } else { node.unwrap(); } } else if (elementRule.paddEmpty && (isPaddedWithNbsp(node) || isNodeEmpty)) { paddEmptyNode(settings, args, blockElements, node); } node = parentNode; } } }, schema2); var rootNode = node = new AstNode(args.context || settings.root_name, 11); parser.parse(html, args.format); if (validate4 && invalidChildren.length) { if (!args.context) { fixInvalidChildren(invalidChildren); } else { args.invalid = true; } } if (rootBlockName && (rootNode.name === "body" || args.isRootContent)) { addRootBlocks2(); } if (!args.invalid) { for (name2 in matchedNodes) { if (!has$22(matchedNodes, name2)) { continue; } list = nodeFilters[name2]; nodes2 = matchedNodes[name2]; fi = nodes2.length; while (fi--) { if (!nodes2[fi].parent) { nodes2.splice(fi, 1); } } for (i2 = 0, l2 = list.length; i2 < l2; i2++) { list[i2](nodes2, name2, args); } } for (i2 = 0, l2 = attributeFilters.length; i2 < l2; i2++) { list = attributeFilters[i2]; if (list.name in matchedAttributes) { nodes2 = matchedAttributes[list.name]; fi = nodes2.length; while (fi--) { if (!nodes2[fi].parent) { nodes2.splice(fi, 1); } } for (fi = 0, fl = list.callbacks.length; fi < fl; fi++) { list.callbacks[fi](nodes2, list.name, args); } } } } return rootNode; }; var exports2 = { schema: schema2, addAttributeFilter, getAttributeFilters, addNodeFilter, getNodeFilters, filterNode, parse: parse2 }; register$1(exports2, settings); register$2(exports2, settings); return exports2; }; var register3 = function(htmlParser, settings, dom2) { htmlParser.addAttributeFilter("data-mce-tabindex", function(nodes2, name2) { var i2 = nodes2.length; while (i2--) { var node = nodes2[i2]; node.attr("tabindex", node.attr("data-mce-tabindex")); node.attr(name2, null); } }); htmlParser.addAttributeFilter("src,href,style", function(nodes2, name2) { var internalName = "data-mce-" + name2; var urlConverter = settings.url_converter; var urlConverterScope = settings.url_converter_scope; var i2 = nodes2.length; while (i2--) { var node = nodes2[i2]; var value25 = node.attr(internalName); if (value25 !== void 0) { node.attr(name2, value25.length > 0 ? value25 : null); node.attr(internalName, null); } else { value25 = node.attr(name2); if (name2 === "style") { value25 = dom2.serializeStyle(dom2.parseStyle(value25), node.name); } else if (urlConverter) { value25 = urlConverter.call(urlConverterScope, value25, name2, node.name); } node.attr(name2, value25.length > 0 ? value25 : null); } } }); htmlParser.addAttributeFilter("class", function(nodes2) { var i2 = nodes2.length; while (i2--) { var node = nodes2[i2]; var value25 = node.attr("class"); if (value25) { value25 = node.attr("class").replace(/(?:^|\s)mce-item-\w+(?!\S)/g, ""); node.attr("class", value25.length > 0 ? value25 : null); } } }); htmlParser.addAttributeFilter("data-mce-type", function(nodes2, name2, args) { var i2 = nodes2.length; while (i2--) { var node = nodes2[i2]; if (node.attr("data-mce-type") === "bookmark" && !args.cleanup) { var hasChildren = Optional.from(node.firstChild).exists(function(firstChild2) { return !isZwsp(firstChild2.value); }); if (hasChildren) { node.unwrap(); } else { node.remove(); } } } }); htmlParser.addNodeFilter("noscript", function(nodes2) { var i2 = nodes2.length; while (i2--) { var node = nodes2[i2].firstChild; if (node) { node.value = Entities.decode(node.value); } } }); htmlParser.addNodeFilter("script,style", function(nodes2, name2) { var trim3 = function(value26) { return value26.replace(/()/g, "\n").replace(/^[\r\n]*|[\r\n]*$/g, "").replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, ""); }; var i2 = nodes2.length; while (i2--) { var node = nodes2[i2]; var value25 = node.firstChild ? node.firstChild.value : ""; if (name2 === "script") { var type3 = node.attr("type"); if (type3) { node.attr("type", type3 === "mce-no/type" ? null : type3.replace(/^mce\-/, "")); } if (settings.element_format === "xhtml" && value25.length > 0) { node.firstChild.value = "// "; } } else { if (settings.element_format === "xhtml" && value25.length > 0) { node.firstChild.value = ""; } } } }); htmlParser.addNodeFilter("#comment", function(nodes2) { var i2 = nodes2.length; while (i2--) { var node = nodes2[i2]; if (settings.preserve_cdata && node.value.indexOf("[CDATA[") === 0) { node.name = "#cdata"; node.type = 4; node.value = dom2.decode(node.value.replace(/^\[CDATA\[|\]\]$/g, "")); } else if (node.value.indexOf("mce:protected ") === 0) { node.name = "#text"; node.type = 3; node.raw = true; node.value = unescape(node.value).substr(14); } } }); htmlParser.addNodeFilter("xml:namespace,input", function(nodes2, name2) { var i2 = nodes2.length; while (i2--) { var node = nodes2[i2]; if (node.type === 7) { node.remove(); } else if (node.type === 1) { if (name2 === "input" && !node.attr("type")) { node.attr("type", "text"); } } } }); htmlParser.addAttributeFilter("data-mce-type", function(nodes2) { each$k(nodes2, function(node) { if (node.attr("data-mce-type") === "format-caret") { if (node.isEmpty(htmlParser.schema.getNonEmptyElements())) { node.remove(); } else { node.unwrap(); } } }); }); htmlParser.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-type,data-mce-resize,data-mce-placeholder", function(nodes2, name2) { var i2 = nodes2.length; while (i2--) { nodes2[i2].attr(name2, null); } }); }; var trimTrailingBr = function(rootNode) { var isBr2 = function(node) { return node && node.name === "br"; }; var brNode1 = rootNode.lastChild; if (isBr2(brNode1)) { var brNode2 = brNode1.prev; if (isBr2(brNode2)) { brNode1.remove(); brNode2.remove(); } } }; var preProcess = function(editor, node, args) { var oldDoc; var dom2 = editor.dom; var clonedNode = node.cloneNode(true); var impl = document.implementation; if (impl.createHTMLDocument) { var doc_1 = impl.createHTMLDocument(""); Tools.each(clonedNode.nodeName === "BODY" ? clonedNode.childNodes : [clonedNode], function(node2) { doc_1.body.appendChild(doc_1.importNode(node2, true)); }); if (clonedNode.nodeName !== "BODY") { clonedNode = doc_1.body.firstChild; } else { clonedNode = doc_1.body; } oldDoc = dom2.doc; dom2.doc = doc_1; } firePreProcess(editor, __assign(__assign({}, args), { node: clonedNode })); if (oldDoc) { dom2.doc = oldDoc; } return clonedNode; }; var shouldFireEvent = function(editor, args) { return editor && editor.hasEventListeners("PreProcess") && !args.no_events; }; var process2 = function(editor, node, args) { return shouldFireEvent(editor, args) ? preProcess(editor, node, args) : node; }; var addTempAttr = function(htmlParser, tempAttrs, name2) { if (Tools.inArray(tempAttrs, name2) === -1) { htmlParser.addAttributeFilter(name2, function(nodes2, name3) { var i2 = nodes2.length; while (i2--) { nodes2[i2].attr(name3, null); } }); tempAttrs.push(name2); } }; var postProcess = function(editor, args, content) { if (!args.no_events && editor) { var outArgs = firePostProcess(editor, __assign(__assign({}, args), { content })); return outArgs.content; } else { return content; } }; var getHtmlFromNode = function(dom2, node, args) { var html = trim$2(args.getInner ? node.innerHTML : dom2.getOuterHTML(node)); return args.selection || isWsPreserveElement(SugarElement.fromDom(node)) ? html : Tools.trim(html); }; var parseHtml = function(htmlParser, html, args) { var parserArgs = args.selection ? __assign({ forced_root_block: false }, args) : args; var rootNode = htmlParser.parse(html, parserArgs); trimTrailingBr(rootNode); return rootNode; }; var serializeNode = function(settings, schema2, node) { var htmlSerializer = HtmlSerializer(settings, schema2); return htmlSerializer.serialize(node); }; var toHtml = function(editor, settings, schema2, rootNode, args) { var content = serializeNode(settings, schema2, rootNode); return postProcess(editor, args, content); }; var DomSerializerImpl = function(settings, editor) { var tempAttrs = ["data-mce-selected"]; var dom2 = editor && editor.dom ? editor.dom : DOMUtils.DOM; var schema2 = editor && editor.schema ? editor.schema : Schema2(settings); settings.entity_encoding = settings.entity_encoding || "named"; settings.remove_trailing_brs = "remove_trailing_brs" in settings ? settings.remove_trailing_brs : true; var htmlParser = DomParser(settings, schema2); register3(htmlParser, settings, dom2); var serialize2 = function(node, parserArgs) { if (parserArgs === void 0) { parserArgs = {}; } var args = __assign({ format: "html" }, parserArgs); var targetNode = process2(editor, node, args); var html = getHtmlFromNode(dom2, targetNode, args); var rootNode = parseHtml(htmlParser, html, args); return args.format === "tree" ? rootNode : toHtml(editor, settings, schema2, rootNode, args); }; return { schema: schema2, addNodeFilter: htmlParser.addNodeFilter, addAttributeFilter: htmlParser.addAttributeFilter, serialize: serialize2, addRules: schema2.addValidElements, setRules: schema2.setValidElements, addTempAttr: curry(addTempAttr, htmlParser, tempAttrs), getTempAttrs: constant2(tempAttrs), getNodeFilters: htmlParser.getNodeFilters, getAttributeFilters: htmlParser.getAttributeFilters }; }; var DomSerializer = function(settings, editor) { var domSerializer = DomSerializerImpl(settings, editor); return { schema: domSerializer.schema, addNodeFilter: domSerializer.addNodeFilter, addAttributeFilter: domSerializer.addAttributeFilter, serialize: domSerializer.serialize, addRules: domSerializer.addRules, setRules: domSerializer.setRules, addTempAttr: domSerializer.addTempAttr, getTempAttrs: domSerializer.getTempAttrs, getNodeFilters: domSerializer.getNodeFilters, getAttributeFilters: domSerializer.getAttributeFilters }; }; var defaultFormat2 = "html"; var getContent = function(editor, args) { if (args === void 0) { args = {}; } var format3 = args.format ? args.format : defaultFormat2; return getContent$2(editor, args, format3); }; var setContent = function(editor, content, args) { if (args === void 0) { args = {}; } return setContent$2(editor, content, args); }; var DOM$7 = DOMUtils.DOM; var restoreOriginalStyles = function(editor) { DOM$7.setStyle(editor.id, "display", editor.orgDisplay); }; var safeDestroy = function(x2) { return Optional.from(x2).each(function(x3) { return x3.destroy(); }); }; var clearDomReferences = function(editor) { editor.contentAreaContainer = editor.formElement = editor.container = editor.editorContainer = null; editor.bodyElement = editor.contentDocument = editor.contentWindow = null; editor.iframeElement = editor.targetElm = null; if (editor.selection) { editor.selection = editor.selection.win = editor.selection.dom = editor.selection.dom.doc = null; } }; var restoreForm = function(editor) { var form = editor.formElement; if (form) { if (form._mceOldSubmit) { form.submit = form._mceOldSubmit; form._mceOldSubmit = null; } DOM$7.unbind(form, "submit reset", editor.formEventDelegate); } }; var remove3 = function(editor) { if (!editor.removed) { var _selectionOverrides = editor._selectionOverrides, editorUpload = editor.editorUpload; var body = editor.getBody(); var element = editor.getElement(); if (body) { editor.save({ is_removing: true }); } editor.removed = true; editor.unbindAllNativeEvents(); if (editor.hasHiddenInput && element) { DOM$7.remove(element.nextSibling); } fireRemove(editor); editor.editorManager.remove(editor); if (!editor.inline && body) { restoreOriginalStyles(editor); } fireDetach(editor); DOM$7.remove(editor.getContainer()); safeDestroy(_selectionOverrides); safeDestroy(editorUpload); editor.destroy(); } }; var destroy3 = function(editor, automatic) { var selection = editor.selection, dom2 = editor.dom; if (editor.destroyed) { return; } if (!automatic && !editor.removed) { editor.remove(); return; } if (!automatic) { editor.editorManager.off("beforeunload", editor._beforeUnload); if (editor.theme && editor.theme.destroy) { editor.theme.destroy(); } safeDestroy(selection); safeDestroy(dom2); } restoreForm(editor); clearDomReferences(editor); editor.destroyed = true; }; var deep = function(old, nu2) { var bothObjects = isObject3(old) && isObject3(nu2); return bothObjects ? deepMerge2(old, nu2) : nu2; }; var baseMerge2 = function(merger) { return function() { var objects = []; for (var _i = 0; _i < arguments.length; _i++) { objects[_i] = arguments[_i]; } if (objects.length === 0) { throw new Error("Can't merge zero objects"); } var ret = {}; for (var j2 = 0; j2 < objects.length; j2++) { var curObject = objects[j2]; for (var key2 in curObject) { if (has$22(curObject, key2)) { ret[key2] = merger(ret[key2], curObject[key2]); } } } return ret; }; }; var deepMerge2 = baseMerge2(deep); var deprecatedSettings = "autoresize_on_init,content_editable_state,convert_fonts_to_spans,inline_styles,padd_empty_with_br,block_elements,boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,non_empty_elements,self_closing_elements,short_ended_elements,special,spellchecker_select_languages,spellchecker_whitelist,tab_focus,table_responsive_width,text_block_elements,text_inline_elements,toolbar_drawer,types,validate,whitespace_elements,paste_word_valid_elements,paste_retain_style_properties,paste_convert_word_fake_lists".split(","); var deprecatedPlugins = "bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,textcolor".split(","); var movedToPremiumPlugins = "imagetools,toc".split(","); var getDeprecatedSettings = function(settings) { var settingNames = filter$4(deprecatedSettings, function(setting) { return has$22(settings, setting); }); var forcedRootBlock = settings.forced_root_block; if (forcedRootBlock === false || forcedRootBlock === "") { settingNames.push("forced_root_block (false only)"); } return sort(settingNames); }; var getDeprecatedPlugins = function(settings) { var plugins2 = Tools.makeMap(settings.plugins, " "); var hasPlugin = function(plugin) { return has$22(plugins2, plugin); }; var pluginNames = __spreadArray(__spreadArray([], filter$4(deprecatedPlugins, hasPlugin), true), bind4(movedToPremiumPlugins, function(plugin) { return hasPlugin(plugin) ? [plugin + " (moving to premium)"] : []; }), true); return sort(pluginNames); }; var logDeprecationsWarning = function(rawSettings, finalSettings) { var deprecatedSettings2 = getDeprecatedSettings(rawSettings); var deprecatedPlugins2 = getDeprecatedPlugins(finalSettings); var hasDeprecatedPlugins = deprecatedPlugins2.length > 0; var hasDeprecatedSettings = deprecatedSettings2.length > 0; var isLegacyMobileTheme = finalSettings.theme === "mobile"; if (hasDeprecatedPlugins || hasDeprecatedSettings || isLegacyMobileTheme) { var listJoiner = "\n- "; var themesMessage = isLegacyMobileTheme ? "\n\nThemes:" + listJoiner + "mobile" : ""; var pluginsMessage = hasDeprecatedPlugins ? "\n\nPlugins:" + listJoiner + deprecatedPlugins2.join(listJoiner) : ""; var settingsMessage = hasDeprecatedSettings ? "\n\nSettings:" + listJoiner + deprecatedSettings2.join(listJoiner) : ""; console.warn("The following deprecated features are currently enabled, these will be removed in TinyMCE 6.0. See https://www.tiny.cloud/docs/release-notes/6.0-upcoming-changes/ for more information." + themesMessage + pluginsMessage + settingsMessage); } }; var sectionResult = function(sections, settings) { return { sections: constant2(sections), settings: constant2(settings) }; }; var deviceDetection = detect().deviceType; var isTouch = deviceDetection.isTouch(); var isPhone = deviceDetection.isPhone(); var isTablet = deviceDetection.isTablet(); var legacyMobilePlugins = [ "lists", "autolink", "autosave" ]; var defaultTouchSettings = { table_grid: false, object_resizing: false, resize: false }; var normalizePlugins = function(plugins2) { var pluginNames = isArray$12(plugins2) ? plugins2.join(" ") : plugins2; var trimmedPlugins = map$3(isString$12(pluginNames) ? pluginNames.split(" ") : [], trim$4); return filter$4(trimmedPlugins, function(item) { return item.length > 0; }); }; var filterLegacyMobilePlugins = function(plugins2) { return filter$4(plugins2, curry(contains$3, legacyMobilePlugins)); }; var extractSections = function(keys3, settings) { var result = bifilter(settings, function(value25, key2) { return contains$3(keys3, key2); }); return sectionResult(result.t, result.f); }; var getSection = function(sectionResult2, name2, defaults2) { if (defaults2 === void 0) { defaults2 = {}; } var sections = sectionResult2.sections(); var sectionSettings = get$9(sections, name2).getOr({}); return Tools.extend({}, defaults2, sectionSettings); }; var hasSection = function(sectionResult2, name2) { return has$22(sectionResult2.sections(), name2); }; var isSectionTheme = function(sectionResult2, name2, theme) { var section = sectionResult2.sections(); return hasSection(sectionResult2, name2) && section[name2].theme === theme; }; var getSectionConfig = function(sectionResult2, name2) { return hasSection(sectionResult2, name2) ? sectionResult2.sections()[name2] : {}; }; var getToolbarMode = function(settings, defaultVal) { return get$9(settings, "toolbar_mode").orThunk(function() { return get$9(settings, "toolbar_drawer").map(function(val) { return val === false ? "wrap" : val; }); }).getOr(defaultVal); }; var getDefaultSettings = function(settings, id2, documentBaseUrl, isTouch2, editor) { var baseDefaults = { id: id2, theme: "silver", toolbar_mode: getToolbarMode(settings, "floating"), plugins: "", document_base_url: documentBaseUrl, add_form_submit_trigger: true, submit_patch: true, add_unload_trigger: true, convert_urls: true, relative_urls: true, remove_script_host: true, object_resizing: true, doctype: "", visual: true, font_size_legacy_values: "xx-small,small,medium,large,x-large,xx-large,300%", forced_root_block: "p", hidden_input: true, inline_styles: true, convert_fonts_to_spans: true, indent: true, indent_before: "p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist", indent_after: "p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist", entity_encoding: "named", url_converter: editor.convertURL, url_converter_scope: editor }; return __assign(__assign({}, baseDefaults), isTouch2 ? defaultTouchSettings : {}); }; var getDefaultMobileSettings = function(mobileSettings, isPhone2) { var defaultMobileSettings = { resize: false, toolbar_mode: getToolbarMode(mobileSettings, "scrolling"), toolbar_sticky: false }; var defaultPhoneSettings = { menubar: false }; return __assign(__assign(__assign({}, defaultTouchSettings), defaultMobileSettings), isPhone2 ? defaultPhoneSettings : {}); }; var getExternalPlugins = function(overrideSettings, settings) { var userDefinedExternalPlugins = settings.external_plugins ? settings.external_plugins : {}; if (overrideSettings && overrideSettings.external_plugins) { return Tools.extend({}, overrideSettings.external_plugins, userDefinedExternalPlugins); } else { return userDefinedExternalPlugins; } }; var combinePlugins = function(forcedPlugins, plugins2) { return [].concat(normalizePlugins(forcedPlugins)).concat(normalizePlugins(plugins2)); }; var getPlatformPlugins = function(isMobileDevice, sectionResult2, desktopPlugins, mobilePlugins) { if (isMobileDevice && isSectionTheme(sectionResult2, "mobile", "mobile")) { return filterLegacyMobilePlugins(mobilePlugins); } else if (isMobileDevice && hasSection(sectionResult2, "mobile")) { return mobilePlugins; } else { return desktopPlugins; } }; var processPlugins = function(isMobileDevice, sectionResult2, defaultOverrideSettings, settings) { var forcedPlugins = normalizePlugins(defaultOverrideSettings.forced_plugins); var desktopPlugins = normalizePlugins(settings.plugins); var mobileConfig = getSectionConfig(sectionResult2, "mobile"); var mobilePlugins = mobileConfig.plugins ? normalizePlugins(mobileConfig.plugins) : desktopPlugins; var platformPlugins = getPlatformPlugins(isMobileDevice, sectionResult2, desktopPlugins, mobilePlugins); var combinedPlugins = combinePlugins(forcedPlugins, platformPlugins); if (Env.browser.isIE() && contains$3(combinedPlugins, "rtc")) { throw new Error("RTC plugin is not supported on IE 11."); } return Tools.extend(settings, { plugins: combinedPlugins.join(" ") }); }; var isOnMobile = function(isMobileDevice, sectionResult2) { return isMobileDevice && hasSection(sectionResult2, "mobile"); }; var combineSettings = function(isMobileDevice, isPhone2, defaultSettings, defaultOverrideSettings, settings) { var defaultDeviceSettings = isMobileDevice ? { mobile: getDefaultMobileSettings(settings.mobile || {}, isPhone2) } : {}; var sectionResult2 = extractSections(["mobile"], deepMerge2(defaultDeviceSettings, settings)); var extendedSettings = Tools.extend(defaultSettings, defaultOverrideSettings, sectionResult2.settings(), isOnMobile(isMobileDevice, sectionResult2) ? getSection(sectionResult2, "mobile") : {}, { validate: true, external_plugins: getExternalPlugins(defaultOverrideSettings, sectionResult2.settings()) }); return processPlugins(isMobileDevice, sectionResult2, defaultOverrideSettings, extendedSettings); }; var getEditorSettings = function(editor, id2, documentBaseUrl, defaultOverrideSettings, settings) { var defaultSettings = getDefaultSettings(settings, id2, documentBaseUrl, isTouch, editor); var finalSettings = combineSettings(isPhone || isTablet, isPhone, defaultSettings, defaultOverrideSettings, settings); if (finalSettings.deprecation_warnings !== false) { logDeprecationsWarning(settings, finalSettings); } return finalSettings; }; var getFiltered = function(predicate, editor, name2) { return Optional.from(editor.settings[name2]).filter(predicate); }; var getParamObject = function(value25) { var output = {}; if (typeof value25 === "string") { each$k(value25.indexOf("=") > 0 ? value25.split(/[;,](?![^=;,]*(?:[;,]|$))/) : value25.split(","), function(val) { var arr2 = val.split("="); if (arr2.length > 1) { output[Tools.trim(arr2[0])] = Tools.trim(arr2[1]); } else { output[Tools.trim(arr2[0])] = Tools.trim(arr2[0]); } }); } else { output = value25; } return output; }; var isArrayOf = function(p) { return function(a2) { return isArray$12(a2) && forall(a2, p); }; }; var getParam = function(editor, name2, defaultVal, type3) { var value25 = name2 in editor.settings ? editor.settings[name2] : defaultVal; if (type3 === "hash") { return getParamObject(value25); } else if (type3 === "string") { return getFiltered(isString$12, editor, name2).getOr(defaultVal); } else if (type3 === "number") { return getFiltered(isNumber2, editor, name2).getOr(defaultVal); } else if (type3 === "boolean") { return getFiltered(isBoolean2, editor, name2).getOr(defaultVal); } else if (type3 === "object") { return getFiltered(isObject3, editor, name2).getOr(defaultVal); } else if (type3 === "array") { return getFiltered(isArray$12, editor, name2).getOr(defaultVal); } else if (type3 === "string[]") { return getFiltered(isArrayOf(isString$12), editor, name2).getOr(defaultVal); } else if (type3 === "function") { return getFiltered(isFunction3, editor, name2).getOr(defaultVal); } else { return value25; } }; var CreateIconManager = function() { var lookup = {}; var add4 = function(id2, iconPack) { lookup[id2] = iconPack; }; var get3 = function(id2) { if (lookup[id2]) { return lookup[id2]; } return { icons: {} }; }; var has3 = function(id2) { return has$22(lookup, id2); }; return { add: add4, get: get3, has: has3 }; }; var IconManager = CreateIconManager(); var getProp = function(propName, elm) { var rawElm = elm.dom; return rawElm[propName]; }; var getComputedSizeProp = function(propName, elm) { return parseInt(get$5(elm, propName), 10); }; var getClientWidth = curry(getProp, "clientWidth"); var getClientHeight = curry(getProp, "clientHeight"); var getMarginTop = curry(getComputedSizeProp, "margin-top"); var getMarginLeft = curry(getComputedSizeProp, "margin-left"); var getBoundingClientRect2 = function(elm) { return elm.dom.getBoundingClientRect(); }; var isInsideElementContentArea = function(bodyElm, clientX, clientY) { var clientWidth = getClientWidth(bodyElm); var clientHeight = getClientHeight(bodyElm); return clientX >= 0 && clientY >= 0 && clientX <= clientWidth && clientY <= clientHeight; }; var transpose = function(inline, elm, clientX, clientY) { var clientRect = getBoundingClientRect2(elm); var deltaX = inline ? clientRect.left + elm.dom.clientLeft + getMarginLeft(elm) : 0; var deltaY = inline ? clientRect.top + elm.dom.clientTop + getMarginTop(elm) : 0; var x2 = clientX - deltaX; var y2 = clientY - deltaY; return { x: x2, y: y2 }; }; var isXYInContentArea = function(editor, clientX, clientY) { var bodyElm = SugarElement.fromDom(editor.getBody()); var targetElm = editor.inline ? bodyElm : documentElement(bodyElm); var transposedPoint = transpose(editor.inline, targetElm, clientX, clientY); return isInsideElementContentArea(targetElm, transposedPoint.x, transposedPoint.y); }; var fromDomSafe = function(node) { return Optional.from(node).map(SugarElement.fromDom); }; var isEditorAttachedToDom = function(editor) { var rawContainer = editor.inline ? editor.getBody() : editor.getContentAreaContainer(); return fromDomSafe(rawContainer).map(inBody).getOr(false); }; var NotificationManagerImpl = function() { var unimplemented = function() { throw new Error("Theme did not provide a NotificationManager implementation."); }; return { open: unimplemented, close: unimplemented, reposition: unimplemented, getArgs: unimplemented }; }; var NotificationManager = function(editor) { var notifications = []; var getImplementation = function() { var theme = editor.theme; return theme && theme.getNotificationManagerImpl ? theme.getNotificationManagerImpl() : NotificationManagerImpl(); }; var getTopNotification = function() { return Optional.from(notifications[0]); }; var isEqual4 = function(a2, b2) { return a2.type === b2.type && a2.text === b2.text && !a2.progressBar && !a2.timeout && !b2.progressBar && !b2.timeout; }; var reposition2 = function() { if (notifications.length > 0) { getImplementation().reposition(notifications); } }; var addNotification = function(notification2) { notifications.push(notification2); }; var closeNotification = function(notification2) { findIndex$2(notifications, function(otherNotification) { return otherNotification === notification2; }).each(function(index2) { notifications.splice(index2, 1); }); }; var open6 = function(spec, fireEvent2) { if (fireEvent2 === void 0) { fireEvent2 = true; } if (editor.removed || !isEditorAttachedToDom(editor)) { return; } if (fireEvent2) { editor.fire("BeforeOpenNotification", { notification: spec }); } return find$3(notifications, function(notification2) { return isEqual4(getImplementation().getArgs(notification2), spec); }).getOrThunk(function() { editor.editorManager.setActive(editor); var notification2 = getImplementation().open(spec, function() { closeNotification(notification2); reposition2(); getTopNotification().fold(function() { return editor.focus(); }, function(top) { return focus$1(SugarElement.fromDom(top.getEl())); }); }); addNotification(notification2); reposition2(); editor.fire("OpenNotification", { notification: __assign({}, notification2) }); return notification2; }); }; var close7 = function() { getTopNotification().each(function(notification2) { getImplementation().close(notification2); closeNotification(notification2); reposition2(); }); }; var getNotifications = constant2(notifications); var registerEvents2 = function(editor2) { editor2.on("SkinLoaded", function() { var serviceMessage = getServiceMessage(editor2); if (serviceMessage) { open6({ text: serviceMessage, type: "warning", timeout: 0 }, false); } reposition2(); }); editor2.on("show ResizeEditor ResizeWindow NodeChange", function() { Delay.requestAnimationFrame(reposition2); }); editor2.on("remove", function() { each$k(notifications.slice(), function(notification2) { getImplementation().close(notification2); }); }); }; registerEvents2(editor); return { open: open6, close: close7, getNotifications }; }; var PluginManager = AddOnManager.PluginManager; var ThemeManager = AddOnManager.ThemeManager; function WindowManagerImpl() { var unimplemented = function() { throw new Error("Theme did not provide a WindowManager implementation."); }; return { open: unimplemented, openUrl: unimplemented, alert: unimplemented, confirm: unimplemented, close: unimplemented, getParams: unimplemented, setParams: unimplemented }; } var WindowManager = function(editor) { var dialogs = []; var getImplementation = function() { var theme = editor.theme; return theme && theme.getWindowManagerImpl ? theme.getWindowManagerImpl() : WindowManagerImpl(); }; var funcBind = function(scope, f2) { return function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return f2 ? f2.apply(scope, args) : void 0; }; }; var fireOpenEvent = function(dialog) { editor.fire("OpenWindow", { dialog }); }; var fireCloseEvent = function(dialog) { editor.fire("CloseWindow", { dialog }); }; var addDialog = function(dialog) { dialogs.push(dialog); fireOpenEvent(dialog); }; var closeDialog = function(dialog) { fireCloseEvent(dialog); dialogs = filter$4(dialogs, function(otherDialog) { return otherDialog !== dialog; }); if (dialogs.length === 0) { editor.focus(); } }; var getTopDialog = function() { return Optional.from(dialogs[dialogs.length - 1]); }; var storeSelectionAndOpenDialog = function(openDialog) { editor.editorManager.setActive(editor); store(editor); var dialog = openDialog(); addDialog(dialog); return dialog; }; var open6 = function(args, params) { return storeSelectionAndOpenDialog(function() { return getImplementation().open(args, params, closeDialog); }); }; var openUrl = function(args) { return storeSelectionAndOpenDialog(function() { return getImplementation().openUrl(args, closeDialog); }); }; var alert = function(message2, callback2, scope) { var windowManagerImpl = getImplementation(); windowManagerImpl.alert(message2, funcBind(scope ? scope : windowManagerImpl, callback2)); }; var confirm3 = function(message2, callback2, scope) { var windowManagerImpl = getImplementation(); windowManagerImpl.confirm(message2, funcBind(scope ? scope : windowManagerImpl, callback2)); }; var close7 = function() { getTopDialog().each(function(dialog) { getImplementation().close(dialog); closeDialog(dialog); }); }; editor.on("remove", function() { each$k(dialogs, function(dialog) { getImplementation().close(dialog); }); }); return { open: open6, openUrl, alert, confirm: confirm3, close: close7 }; }; var displayNotification = function(editor, message2) { editor.notificationManager.open({ type: "error", text: message2 }); }; var displayError = function(editor, message2) { if (editor._skinLoaded) { displayNotification(editor, message2); } else { editor.on("SkinLoaded", function() { displayNotification(editor, message2); }); } }; var uploadError = function(editor, message2) { displayError(editor, I18n.translate([ "Failed to upload image: {0}", message2 ])); }; var logError = function(editor, errorType, msg) { fireError(editor, errorType, { message: msg }); console.error(msg); }; var createLoadError = function(type3, url2, name2) { return name2 ? "Failed to load " + type3 + ": " + name2 + " from url " + url2 : "Failed to load " + type3 + " url: " + url2; }; var pluginLoadError = function(editor, url2, name2) { logError(editor, "PluginLoadError", createLoadError("plugin", url2, name2)); }; var iconsLoadError = function(editor, url2, name2) { logError(editor, "IconsLoadError", createLoadError("icons", url2, name2)); }; var languageLoadError = function(editor, url2, name2) { logError(editor, "LanguageLoadError", createLoadError("language", url2, name2)); }; var pluginInitError = function(editor, name2, err) { var message2 = I18n.translate([ "Failed to initialize plugin: {0}", name2 ]); fireError(editor, "PluginLoadError", { message: message2 }); initError(message2, err); displayError(editor, message2); }; var initError = function(message2) { var x2 = []; for (var _i = 1; _i < arguments.length; _i++) { x2[_i - 1] = arguments[_i]; } var console2 = window.console; if (console2) { if (console2.error) { console2.error.apply(console2, __spreadArray([message2], x2, false)); } else { console2.log.apply(console2, __spreadArray([message2], x2, false)); } } }; var isContentCssSkinName = function(url2) { return /^[a-z0-9\-]+$/i.test(url2); }; var getContentCssUrls = function(editor) { return transformToUrls(editor, getContentCss(editor)); }; var getFontCssUrls = function(editor) { return transformToUrls(editor, getFontCss(editor)); }; var transformToUrls = function(editor, cssLinks) { var skinUrl = editor.editorManager.baseURL + "/skins/content"; var suffix = editor.editorManager.suffix; var contentCssFile = "content" + suffix + ".css"; var inline = editor.inline === true; return map$3(cssLinks, function(url2) { if (isContentCssSkinName(url2) && !inline) { return skinUrl + "/" + url2 + "/" + contentCssFile; } else { return editor.documentBaseURI.toAbsolute(url2); } }); }; var appendContentCssFromSettings = function(editor) { editor.contentCSS = editor.contentCSS.concat(getContentCssUrls(editor), getFontCssUrls(editor)); }; var UploadStatus = function() { var PENDING = 1, UPLOADED = 2; var blobUriStatuses = {}; var createStatus = function(status, resultUri) { return { status, resultUri }; }; var hasBlobUri = function(blobUri) { return blobUri in blobUriStatuses; }; var getResultUri = function(blobUri) { var result = blobUriStatuses[blobUri]; return result ? result.resultUri : null; }; var isPending2 = function(blobUri) { return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === PENDING : false; }; var isUploaded = function(blobUri) { return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === UPLOADED : false; }; var markPending = function(blobUri) { blobUriStatuses[blobUri] = createStatus(PENDING, null); }; var markUploaded = function(blobUri, resultUri) { blobUriStatuses[blobUri] = createStatus(UPLOADED, resultUri); }; var removeFailed = function(blobUri) { delete blobUriStatuses[blobUri]; }; var destroy4 = function() { blobUriStatuses = {}; }; return { hasBlobUri, getResultUri, isPending: isPending2, isUploaded, markPending, markUploaded, removeFailed, destroy: destroy4 }; }; var count2 = 0; var seed2 = function() { var rnd = function() { return Math.round(Math.random() * 4294967295).toString(36); }; var now2 = new Date().getTime(); return "s" + now2.toString(36) + rnd() + rnd() + rnd(); }; var uuid2 = function(prefix) { return prefix + count2++ + seed2(); }; var BlobCache = function() { var cache2 = []; var mimeToExt = function(mime) { var mimes = { "image/jpeg": "jpg", "image/jpg": "jpg", "image/gif": "gif", "image/png": "png", "image/apng": "apng", "image/avif": "avif", "image/svg+xml": "svg", "image/webp": "webp", "image/bmp": "bmp", "image/tiff": "tiff" }; return mimes[mime.toLowerCase()] || "dat"; }; var create2 = function(o2, blob, base64, name2, filename) { if (isString$12(o2)) { var id2 = o2; return toBlobInfo({ id: id2, name: name2, filename, blob, base64 }); } else if (isObject3(o2)) { return toBlobInfo(o2); } else { throw new Error("Unknown input type"); } }; var toBlobInfo = function(o2) { if (!o2.blob || !o2.base64) { throw new Error("blob and base64 representations of the image are required for BlobInfo to be created"); } var id2 = o2.id || uuid2("blobid"); var name2 = o2.name || id2; var blob = o2.blob; return { id: constant2(id2), name: constant2(name2), filename: constant2(o2.filename || name2 + "." + mimeToExt(blob.type)), blob: constant2(blob), base64: constant2(o2.base64), blobUri: constant2(o2.blobUri || URL.createObjectURL(blob)), uri: constant2(o2.uri) }; }; var add4 = function(blobInfo) { if (!get3(blobInfo.id())) { cache2.push(blobInfo); } }; var findFirst = function(predicate) { return find$3(cache2, predicate).getOrUndefined(); }; var get3 = function(id2) { return findFirst(function(cachedBlobInfo) { return cachedBlobInfo.id() === id2; }); }; var getByUri = function(blobUri) { return findFirst(function(blobInfo) { return blobInfo.blobUri() === blobUri; }); }; var getByData = function(base64, type3) { return findFirst(function(blobInfo) { return blobInfo.base64() === base64 && blobInfo.blob().type === type3; }); }; var removeByUri = function(blobUri) { cache2 = filter$4(cache2, function(blobInfo) { if (blobInfo.blobUri() === blobUri) { URL.revokeObjectURL(blobInfo.blobUri()); return false; } return true; }); }; var destroy4 = function() { each$k(cache2, function(cachedBlobInfo) { URL.revokeObjectURL(cachedBlobInfo.blobUri()); }); cache2 = []; }; return { create: create2, add: add4, get: get3, getByUri, getByData, findFirst, removeByUri, destroy: destroy4 }; }; var Uploader = function(uploadStatus, settings) { var pendingPromises = {}; var pathJoin = function(path1, path2) { if (path1) { return path1.replace(/\/$/, "") + "/" + path2.replace(/^\//, ""); } return path2; }; var defaultHandler = function(blobInfo, success3, failure, progress) { var xhr2 = new XMLHttpRequest(); xhr2.open("POST", settings.url); xhr2.withCredentials = settings.credentials; xhr2.upload.onprogress = function(e2) { progress(e2.loaded / e2.total * 100); }; xhr2.onerror = function() { failure("Image upload failed due to a XHR Transport error. Code: " + xhr2.status); }; xhr2.onload = function() { if (xhr2.status < 200 || xhr2.status >= 300) { failure("HTTP Error: " + xhr2.status); return; } var json = JSON.parse(xhr2.responseText); if (!json || typeof json.location !== "string") { failure("Invalid JSON: " + xhr2.responseText); return; } success3(pathJoin(settings.basePath, json.location)); }; var formData = new FormData(); formData.append("file", blobInfo.blob(), blobInfo.filename()); xhr2.send(formData); }; var noUpload = function() { return new promiseObj(function(resolve2) { resolve2([]); }); }; var handlerSuccess = function(blobInfo, url2) { return { url: url2, blobInfo, status: true }; }; var handlerFailure = function(blobInfo, message2, options2) { return { url: "", blobInfo, status: false, error: { message: message2, options: options2 } }; }; var resolvePending = function(blobUri, result) { Tools.each(pendingPromises[blobUri], function(resolve2) { resolve2(result); }); delete pendingPromises[blobUri]; }; var uploadBlobInfo = function(blobInfo, handler7, openNotification2) { uploadStatus.markPending(blobInfo.blobUri()); return new promiseObj(function(resolve2) { var notification2, progress; try { var closeNotification_1 = function() { if (notification2) { notification2.close(); progress = noop2; } }; var success3 = function(url2) { closeNotification_1(); uploadStatus.markUploaded(blobInfo.blobUri(), url2); resolvePending(blobInfo.blobUri(), handlerSuccess(blobInfo, url2)); resolve2(handlerSuccess(blobInfo, url2)); }; var failure = function(error4, options2) { var failureOptions = options2 ? options2 : {}; closeNotification_1(); uploadStatus.removeFailed(blobInfo.blobUri()); resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error4, failureOptions)); resolve2(handlerFailure(blobInfo, error4, failureOptions)); }; progress = function(percent) { if (percent < 0 || percent > 100) { return; } Optional.from(notification2).orThunk(function() { return Optional.from(openNotification2).map(apply2); }).each(function(n2) { notification2 = n2; n2.progressBar.value(percent); }); }; handler7(blobInfo, success3, failure, progress); } catch (ex) { resolve2(handlerFailure(blobInfo, ex.message, {})); } }); }; var isDefaultHandler = function(handler7) { return handler7 === defaultHandler; }; var pendingUploadBlobInfo = function(blobInfo) { var blobUri = blobInfo.blobUri(); return new promiseObj(function(resolve2) { pendingPromises[blobUri] = pendingPromises[blobUri] || []; pendingPromises[blobUri].push(resolve2); }); }; var uploadBlobs = function(blobInfos, openNotification2) { blobInfos = Tools.grep(blobInfos, function(blobInfo) { return !uploadStatus.isUploaded(blobInfo.blobUri()); }); return promiseObj.all(Tools.map(blobInfos, function(blobInfo) { return uploadStatus.isPending(blobInfo.blobUri()) ? pendingUploadBlobInfo(blobInfo) : uploadBlobInfo(blobInfo, settings.handler, openNotification2); })); }; var upload3 = function(blobInfos, openNotification2) { return !settings.url && isDefaultHandler(settings.handler) ? noUpload() : uploadBlobs(blobInfos, openNotification2); }; if (isFunction3(settings.handler) === false) { settings.handler = defaultHandler; } return { upload: upload3 }; }; var openNotification = function(editor) { return function() { return editor.notificationManager.open({ text: editor.translate("Image uploading..."), type: "info", timeout: -1, progressBar: true }); }; }; var createUploader = function(editor, uploadStatus) { return Uploader(uploadStatus, { url: getImageUploadUrl(editor), basePath: getImageUploadBasePath(editor), credentials: getImagesUploadCredentials(editor), handler: getImagesUploadHandler(editor) }); }; var ImageUploader = function(editor) { var uploadStatus = UploadStatus(); var uploader = createUploader(editor, uploadStatus); return { upload: function(blobInfos, showNotification) { if (showNotification === void 0) { showNotification = true; } return uploader.upload(blobInfos, showNotification ? openNotification(editor) : void 0); } }; }; var UploadChangeHandler = function(editor) { var lastChangedLevel = Cell3(null); editor.on("change AddUndo", function(e2) { lastChangedLevel.set(__assign({}, e2.level)); }); var fireIfChanged = function() { var data66 = editor.undoManager.data; last$2(data66).filter(function(level2) { return !isEq$1(lastChangedLevel.get(), level2); }).each(function(level2) { editor.setDirty(true); editor.fire("change", { level: level2, lastLevel: get$a(data66, data66.length - 2).getOrNull() }); }); }; return { fireIfChanged }; }; var EditorUpload = function(editor) { var blobCache = BlobCache(); var uploader, imageScanner; var uploadStatus = UploadStatus(); var urlFilters = []; var changeHandler = UploadChangeHandler(editor); var aliveGuard = function(callback2) { return function(result) { if (editor.selection) { return callback2(result); } return []; }; }; var cacheInvalidator = function(url2) { return url2 + (url2.indexOf("?") === -1 ? "?" : "&") + new Date().getTime(); }; var replaceString = function(content, search2, replace2) { var index2 = 0; do { index2 = content.indexOf(search2, index2); if (index2 !== -1) { content = content.substring(0, index2) + replace2 + content.substr(index2 + search2.length); index2 += replace2.length - search2.length + 1; } } while (index2 !== -1); return content; }; var replaceImageUrl = function(content, targetUrl, replacementUrl) { var replacementString = 'src="' + replacementUrl + '"' + (replacementUrl === Env.transparentSrc ? ' data-mce-placeholder="1"' : ""); content = replaceString(content, 'src="' + targetUrl + '"', replacementString); content = replaceString(content, 'data-mce-src="' + targetUrl + '"', 'data-mce-src="' + replacementUrl + '"'); return content; }; var replaceUrlInUndoStack = function(targetUrl, replacementUrl) { each$k(editor.undoManager.data, function(level2) { if (level2.type === "fragmented") { level2.fragments = map$3(level2.fragments, function(fragment) { return replaceImageUrl(fragment, targetUrl, replacementUrl); }); } else { level2.content = replaceImageUrl(level2.content, targetUrl, replacementUrl); } }); }; var replaceImageUriInView = function(image, resultUri) { var src2 = editor.convertURL(resultUri, "src"); replaceUrlInUndoStack(image.src, resultUri); editor.$(image).attr({ "src": shouldReuseFileName(editor) ? cacheInvalidator(resultUri) : resultUri, "data-mce-src": src2 }); }; var uploadImages = function(callback2) { if (!uploader) { uploader = createUploader(editor, uploadStatus); } return scanForImages().then(aliveGuard(function(imageInfos) { var blobInfos = map$3(imageInfos, function(imageInfo) { return imageInfo.blobInfo; }); return uploader.upload(blobInfos, openNotification(editor)).then(aliveGuard(function(result) { var imagesToRemove = []; var filteredResult = map$3(result, function(uploadInfo, index2) { var blobInfo = imageInfos[index2].blobInfo; var image = imageInfos[index2].image; if (uploadInfo.status && shouldReplaceBlobUris(editor)) { blobCache.removeByUri(image.src); if (isRtc(editor)) ; else { replaceImageUriInView(image, uploadInfo.url); } } else if (uploadInfo.error) { if (uploadInfo.error.options.remove) { replaceUrlInUndoStack(image.getAttribute("src"), Env.transparentSrc); imagesToRemove.push(image); } uploadError(editor, uploadInfo.error.message); } return { element: image, status: uploadInfo.status, uploadUri: uploadInfo.url, blobInfo }; }); if (filteredResult.length > 0) { changeHandler.fireIfChanged(); } if (imagesToRemove.length > 0) { if (isRtc(editor)) { console.error("Removing images on failed uploads is currently unsupported for RTC"); } else { editor.undoManager.transact(function() { each$k(imagesToRemove, function(element) { editor.dom.remove(element); blobCache.removeByUri(element.src); }); }); } } if (callback2) { callback2(filteredResult); } return filteredResult; })); })); }; var uploadImagesAuto = function(callback2) { if (isAutomaticUploadsEnabled(editor)) { return uploadImages(callback2); } }; var isValidDataUriImage = function(imgElm) { if (forall(urlFilters, function(filter2) { return filter2(imgElm); }) === false) { return false; } if (imgElm.getAttribute("src").indexOf("data:") === 0) { var dataImgFilter = getImagesDataImgFilter(editor); return dataImgFilter(imgElm); } return true; }; var addFilter = function(filter2) { urlFilters.push(filter2); }; var scanForImages = function() { if (!imageScanner) { imageScanner = ImageScanner(uploadStatus, blobCache); } return imageScanner.findAll(editor.getBody(), isValidDataUriImage).then(aliveGuard(function(result) { result = filter$4(result, function(resultItem) { if (typeof resultItem === "string") { displayError(editor, resultItem); return false; } return true; }); if (isRtc(editor)) ; else { each$k(result, function(resultItem) { replaceUrlInUndoStack(resultItem.image.src, resultItem.blobInfo.blobUri()); resultItem.image.src = resultItem.blobInfo.blobUri(); resultItem.image.removeAttribute("data-mce-src"); }); } return result; })); }; var destroy4 = function() { blobCache.destroy(); uploadStatus.destroy(); imageScanner = uploader = null; }; var replaceBlobUris = function(content) { return content.replace(/src="(blob:[^"]+)"/g, function(match7, blobUri) { var resultUri = uploadStatus.getResultUri(blobUri); if (resultUri) { return 'src="' + resultUri + '"'; } var blobInfo = blobCache.getByUri(blobUri); if (!blobInfo) { blobInfo = foldl(editor.editorManager.get(), function(result, editor2) { return result || editor2.editorUpload && editor2.editorUpload.blobCache.getByUri(blobUri); }, null); } if (blobInfo) { var blob = blobInfo.blob(); return 'src="data:' + blob.type + ";base64," + blobInfo.base64() + '"'; } return match7; }); }; editor.on("SetContent", function() { if (isAutomaticUploadsEnabled(editor)) { uploadImagesAuto(); } else { scanForImages(); } }); editor.on("RawSaveContent", function(e2) { e2.content = replaceBlobUris(e2.content); }); editor.on("GetContent", function(e2) { if (e2.source_view || e2.format === "raw" || e2.format === "tree") { return; } e2.content = replaceBlobUris(e2.content); }); editor.on("PostRender", function() { editor.parser.addNodeFilter("img", function(images) { each$k(images, function(img) { var src2 = img.attr("src"); if (blobCache.getByUri(src2)) { return; } var resultUri = uploadStatus.getResultUri(src2); if (resultUri) { img.attr("src", resultUri); } }); }); }); return { blobCache, addFilter, uploadImages, uploadImagesAuto, scanForImages, destroy: destroy4 }; }; var get2 = function(dom2) { var formats2 = { valigntop: [{ selector: "td,th", styles: { verticalAlign: "top" } }], valignmiddle: [{ selector: "td,th", styles: { verticalAlign: "middle" } }], valignbottom: [{ selector: "td,th", styles: { verticalAlign: "bottom" } }], alignleft: [ { selector: "figure.image", collapsed: false, classes: "align-left", ceFalseOverride: true, preview: "font-family font-size" }, { selector: "figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li", styles: { textAlign: "left" }, inherit: false, preview: false, defaultBlock: "div" }, { selector: "img,table,audio,video", collapsed: false, styles: { float: "left" }, preview: "font-family font-size" } ], aligncenter: [ { selector: "figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li", styles: { textAlign: "center" }, inherit: false, preview: "font-family font-size", defaultBlock: "div" }, { selector: "figure.image", collapsed: false, classes: "align-center", ceFalseOverride: true, preview: "font-family font-size" }, { selector: "img,audio,video", collapsed: false, styles: { display: "block", marginLeft: "auto", marginRight: "auto" }, preview: false }, { selector: "table", collapsed: false, styles: { marginLeft: "auto", marginRight: "auto" }, preview: "font-family font-size" } ], alignright: [ { selector: "figure.image", collapsed: false, classes: "align-right", ceFalseOverride: true, preview: "font-family font-size" }, { selector: "figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li", styles: { textAlign: "right" }, inherit: false, preview: "font-family font-size", defaultBlock: "div" }, { selector: "img,table,audio,video", collapsed: false, styles: { float: "right" }, preview: "font-family font-size" } ], alignjustify: [{ selector: "figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li", styles: { textAlign: "justify" }, inherit: false, defaultBlock: "div", preview: "font-family font-size" }], bold: [ { inline: "strong", remove: "all", preserve_attributes: [ "class", "style" ] }, { inline: "span", styles: { fontWeight: "bold" } }, { inline: "b", remove: "all", preserve_attributes: [ "class", "style" ] } ], italic: [ { inline: "em", remove: "all", preserve_attributes: [ "class", "style" ] }, { inline: "span", styles: { fontStyle: "italic" } }, { inline: "i", remove: "all", preserve_attributes: [ "class", "style" ] } ], underline: [ { inline: "span", styles: { textDecoration: "underline" }, exact: true }, { inline: "u", remove: "all", preserve_attributes: [ "class", "style" ] } ], strikethrough: [ { inline: "span", styles: { textDecoration: "line-through" }, exact: true }, { inline: "strike", remove: "all", preserve_attributes: [ "class", "style" ] }, { inline: "s", remove: "all", preserve_attributes: [ "class", "style" ] } ], forecolor: { inline: "span", styles: { color: "%value" }, links: true, remove_similar: true, clear_child_styles: true }, hilitecolor: { inline: "span", styles: { backgroundColor: "%value" }, links: true, remove_similar: true, clear_child_styles: true }, fontname: { inline: "span", toggle: false, styles: { fontFamily: "%value" }, clear_child_styles: true }, fontsize: { inline: "span", toggle: false, styles: { fontSize: "%value" }, clear_child_styles: true }, lineheight: { selector: "h1,h2,h3,h4,h5,h6,p,li,td,th,div", defaultBlock: "p", styles: { lineHeight: "%value" } }, fontsize_class: { inline: "span", attributes: { class: "%value" } }, blockquote: { block: "blockquote", wrapper: true, remove: "all" }, subscript: { inline: "sub" }, superscript: { inline: "sup" }, code: { inline: "code" }, link: { inline: "a", selector: "a", remove: "all", split: true, deep: true, onmatch: function(node, _fmt, _itemName) { return isElement$5(node) && node.hasAttribute("href"); }, onformat: function(elm, _fmt, vars) { Tools.each(vars, function(value25, key2) { dom2.setAttrib(elm, key2, value25); }); } }, lang: { inline: "span", clear_child_styles: true, remove_similar: true, attributes: { "lang": "%value", "data-mce-lang": function(vars) { var _a3; return (_a3 = vars === null || vars === void 0 ? void 0 : vars.customValue) !== null && _a3 !== void 0 ? _a3 : null; } } }, removeformat: [ { selector: "b,strong,em,i,font,u,strike,s,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins,small", remove: "all", split: true, expand: false, block_expand: true, deep: true }, { selector: "span", attributes: [ "style", "class" ], remove: "empty", split: true, expand: false, deep: true }, { selector: "*", attributes: [ "style", "class" ], split: false, expand: false, deep: true } ] }; Tools.each("p h1 h2 h3 h4 h5 h6 div address pre dt dd samp".split(/\s/), function(name2) { formats2[name2] = { block: name2, remove: "all" }; }); return formats2; }; var FormatRegistry = function(editor) { var formats2 = {}; var get$13 = function(name2) { return isNonNullable(name2) ? formats2[name2] : formats2; }; var has3 = function(name2) { return has$22(formats2, name2); }; var register4 = function(name2, format3) { if (name2) { if (!isString$12(name2)) { each$j(name2, function(format4, name3) { register4(name3, format4); }); } else { if (!isArray$12(format3)) { format3 = [format3]; } each$k(format3, function(format4) { if (isUndefined2(format4.deep)) { format4.deep = !isSelectorFormat(format4); } if (isUndefined2(format4.split)) { format4.split = !isSelectorFormat(format4) || isInlineFormat(format4); } if (isUndefined2(format4.remove) && isSelectorFormat(format4) && !isInlineFormat(format4)) { format4.remove = "none"; } if (isSelectorFormat(format4) && isInlineFormat(format4)) { format4.mixed = true; format4.block_expand = true; } if (isString$12(format4.classes)) { format4.classes = format4.classes.split(/\s+/); } }); formats2[name2] = format3; } } }; var unregister2 = function(name2) { if (name2 && formats2[name2]) { delete formats2[name2]; } return formats2; }; register4(get2(editor.dom)); register4(getFormats(editor)); return { get: get$13, has: has3, register: register4, unregister: unregister2 }; }; var each$5 = Tools.each; var dom = DOMUtils.DOM; var parsedSelectorToHtml = function(ancestry, editor) { var elm, item, fragment; var schema2 = editor && editor.schema || Schema2({}); var decorate = function(elm2, item2) { if (item2.classes.length) { dom.addClass(elm2, item2.classes.join(" ")); } dom.setAttribs(elm2, item2.attrs); }; var createElement = function(sItem) { item = typeof sItem === "string" ? { name: sItem, classes: [], attrs: {} } : sItem; var elm2 = dom.create(item.name); decorate(elm2, item); return elm2; }; var getRequiredParent = function(elm2, candidate) { var name2 = typeof elm2 !== "string" ? elm2.nodeName.toLowerCase() : elm2; var elmRule = schema2.getElementRule(name2); var parentsRequired = elmRule && elmRule.parentsRequired; if (parentsRequired && parentsRequired.length) { return candidate && Tools.inArray(parentsRequired, candidate) !== -1 ? candidate : parentsRequired[0]; } else { return false; } }; var wrapInHtml = function(elm2, ancestry2, siblings2) { var parent3, parentCandidate; var ancestor2 = ancestry2.length > 0 && ancestry2[0]; var ancestorName = ancestor2 && ancestor2.name; var parentRequired = getRequiredParent(elm2, ancestorName); if (parentRequired) { if (ancestorName === parentRequired) { parentCandidate = ancestry2[0]; ancestry2 = ancestry2.slice(1); } else { parentCandidate = parentRequired; } } else if (ancestor2) { parentCandidate = ancestry2[0]; ancestry2 = ancestry2.slice(1); } else if (!siblings2) { return elm2; } if (parentCandidate) { parent3 = createElement(parentCandidate); parent3.appendChild(elm2); } if (siblings2) { if (!parent3) { parent3 = dom.create("div"); parent3.appendChild(elm2); } Tools.each(siblings2, function(sibling2) { var siblingElm = createElement(sibling2); parent3.insertBefore(siblingElm, elm2); }); } return wrapInHtml(parent3, ancestry2, parentCandidate && parentCandidate.siblings); }; if (ancestry && ancestry.length) { item = ancestry[0]; elm = createElement(item); fragment = dom.create("div"); fragment.appendChild(wrapInHtml(elm, ancestry.slice(1), item.siblings)); return fragment; } else { return ""; } }; var parseSelectorItem = function(item) { var tagName; var obj = { classes: [], attrs: {} }; item = obj.selector = Tools.trim(item); if (item !== "*") { tagName = item.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g, function($0, $1, $2, $3, $4) { switch ($1) { case "#": obj.attrs.id = $2; break; case ".": obj.classes.push($2); break; case ":": if (Tools.inArray("checked disabled enabled read-only required".split(" "), $2) !== -1) { obj.attrs[$2] = $2; } break; } if ($3 === "[") { var m2 = $4.match(/([\w\-]+)(?:\=\"([^\"]+))?/); if (m2) { obj.attrs[m2[1]] = m2[2]; } } return ""; }); } obj.name = tagName || "div"; return obj; }; var parseSelector = function(selector2) { if (!selector2 || typeof selector2 !== "string") { return []; } selector2 = selector2.split(/\s*,\s*/)[0]; selector2 = selector2.replace(/\s*(~\+|~|\+|>)\s*/g, "$1"); return Tools.map(selector2.split(/(?:>|\s+(?![^\[\]]+\]))/), function(item) { var siblings2 = Tools.map(item.split(/(?:~\+|~|\+)/), parseSelectorItem); var obj = siblings2.pop(); if (siblings2.length) { obj.siblings = siblings2; } return obj; }).reverse(); }; var getCssText = function(editor, format3) { var name2, previewFrag; var previewCss = "", parentFontSize; var previewStyles = getPreviewStyles(editor); if (previewStyles === "") { return ""; } var removeVars = function(val) { return val.replace(/%(\w+)/g, ""); }; if (typeof format3 === "string") { format3 = editor.formatter.get(format3); if (!format3) { return; } format3 = format3[0]; } if ("preview" in format3) { var previewOpt = get$9(format3, "preview"); if (is$1(previewOpt, false)) { return ""; } else { previewStyles = previewOpt.getOr(previewStyles); } } name2 = format3.block || format3.inline || "span"; var items = parseSelector(format3.selector); if (items.length) { if (!items[0].name) { items[0].name = name2; } name2 = format3.selector; previewFrag = parsedSelectorToHtml(items, editor); } else { previewFrag = parsedSelectorToHtml([name2], editor); } var previewElm = dom.select(name2, previewFrag)[0] || previewFrag.firstChild; each$5(format3.styles, function(value25, name3) { var newValue = removeVars(value25); if (newValue) { dom.setStyle(previewElm, name3, newValue); } }); each$5(format3.attributes, function(value25, name3) { var newValue = removeVars(value25); if (newValue) { dom.setAttrib(previewElm, name3, newValue); } }); each$5(format3.classes, function(value25) { var newValue = removeVars(value25); if (!dom.hasClass(previewElm, newValue)) { dom.addClass(previewElm, newValue); } }); editor.fire("PreviewFormats"); dom.setStyles(previewFrag, { position: "absolute", left: -65535 }); editor.getBody().appendChild(previewFrag); parentFontSize = dom.getStyle(editor.getBody(), "fontSize", true); parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0; each$5(previewStyles.split(" "), function(name3) { var value25 = dom.getStyle(previewElm, name3, true); if (name3 === "background-color" && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value25)) { value25 = dom.getStyle(editor.getBody(), name3, true); if (dom.toHex(value25).toLowerCase() === "#ffffff") { return; } } if (name3 === "color") { if (dom.toHex(value25).toLowerCase() === "#000000") { return; } } if (name3 === "font-size") { if (/em|%$/.test(value25)) { if (parentFontSize === 0) { return; } var numValue = parseFloat(value25) / (/%$/.test(value25) ? 100 : 1); value25 = numValue * parentFontSize + "px"; } } if (name3 === "border" && value25) { previewCss += "padding:0 2px;"; } previewCss += name3 + ":" + value25 + ";"; }); editor.fire("AfterPreviewFormats"); dom.remove(previewFrag); return previewCss; }; var setup$h = function(editor) { editor.addShortcut("meta+b", "", "Bold"); editor.addShortcut("meta+i", "", "Italic"); editor.addShortcut("meta+u", "", "Underline"); for (var i2 = 1; i2 <= 6; i2++) { editor.addShortcut("access+" + i2, "", [ "FormatBlock", false, "h" + i2 ]); } editor.addShortcut("access+7", "", [ "FormatBlock", false, "p" ]); editor.addShortcut("access+8", "", [ "FormatBlock", false, "div" ]); editor.addShortcut("access+9", "", [ "FormatBlock", false, "address" ]); }; var Formatter = function(editor) { var formats2 = FormatRegistry(editor); var formatChangeState = Cell3(null); setup$h(editor); setup$k(editor); return { get: formats2.get, has: formats2.has, register: formats2.register, unregister: formats2.unregister, apply: function(name2, vars, node) { applyFormat(editor, name2, vars, node); }, remove: function(name2, vars, node, similar) { removeFormat(editor, name2, vars, node, similar); }, toggle: function(name2, vars, node) { toggleFormat(editor, name2, vars, node); }, match: function(name2, vars, node, similar) { return matchFormat(editor, name2, vars, node, similar); }, closest: function(names2) { return closestFormat(editor, names2); }, matchAll: function(names2, vars) { return matchAllFormats(editor, names2, vars); }, matchNode: function(node, name2, vars, similar) { return matchNodeFormat(editor, node, name2, vars, similar); }, canApply: function(name2) { return canApplyFormat(editor, name2); }, formatChanged: function(formats3, callback2, similar, vars) { return formatChanged(editor, formatChangeState, formats3, callback2, similar, vars); }, getCssText: curry(getCssText, editor) }; }; var shouldIgnoreCommand = function(cmd) { switch (cmd.toLowerCase()) { case "undo": case "redo": case "mcerepaint": case "mcefocus": return true; default: return false; } }; var registerEvents = function(editor, undoManager, locks) { var isFirstTypedCharacter = Cell3(false); var addNonTypingUndoLevel = function(e2) { setTyping(undoManager, false, locks); undoManager.add({}, e2); }; editor.on("init", function() { undoManager.add(); }); editor.on("BeforeExecCommand", function(e2) { var cmd = e2.command; if (!shouldIgnoreCommand(cmd)) { endTyping(undoManager, locks); undoManager.beforeChange(); } }); editor.on("ExecCommand", function(e2) { var cmd = e2.command; if (!shouldIgnoreCommand(cmd)) { addNonTypingUndoLevel(e2); } }); editor.on("ObjectResizeStart cut", function() { undoManager.beforeChange(); }); editor.on("SaveContent ObjectResized blur", addNonTypingUndoLevel); editor.on("dragend", addNonTypingUndoLevel); editor.on("keyup", function(e2) { var keyCode = e2.keyCode; if (e2.isDefaultPrevented()) { return; } if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45 || e2.ctrlKey) { addNonTypingUndoLevel(); editor.nodeChanged(); } if (keyCode === 46 || keyCode === 8) { editor.nodeChanged(); } if (isFirstTypedCharacter.get() && undoManager.typing && isEq$1(createFromEditor(editor), undoManager.data[0]) === false) { if (editor.isDirty() === false) { editor.setDirty(true); editor.fire("change", { level: undoManager.data[0], lastLevel: null }); } editor.fire("TypingUndo"); isFirstTypedCharacter.set(false); editor.nodeChanged(); } }); editor.on("keydown", function(e2) { var keyCode = e2.keyCode; if (e2.isDefaultPrevented()) { return; } if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45) { if (undoManager.typing) { addNonTypingUndoLevel(e2); } return; } var modKey = e2.ctrlKey && !e2.altKey || e2.metaKey; if ((keyCode < 16 || keyCode > 20) && keyCode !== 224 && keyCode !== 91 && !undoManager.typing && !modKey) { undoManager.beforeChange(); setTyping(undoManager, true, locks); undoManager.add({}, e2); isFirstTypedCharacter.set(true); } }); editor.on("mousedown", function(e2) { if (undoManager.typing) { addNonTypingUndoLevel(e2); } }); var isInsertReplacementText = function(event) { return event.inputType === "insertReplacementText"; }; var isInsertTextDataNull = function(event) { return event.inputType === "insertText" && event.data === null; }; var isInsertFromPasteOrDrop = function(event) { return event.inputType === "insertFromPaste" || event.inputType === "insertFromDrop"; }; editor.on("input", function(e2) { if (e2.inputType && (isInsertReplacementText(e2) || isInsertTextDataNull(e2) || isInsertFromPasteOrDrop(e2))) { addNonTypingUndoLevel(e2); } }); editor.on("AddUndo Undo Redo ClearUndos", function(e2) { if (!e2.isDefaultPrevented()) { editor.nodeChanged(); } }); }; var addKeyboardShortcuts = function(editor) { editor.addShortcut("meta+z", "", "Undo"); editor.addShortcut("meta+y,meta+shift+z", "", "Redo"); }; var UndoManager = function(editor) { var beforeBookmark = value24(); var locks = Cell3(0); var index2 = Cell3(0); var undoManager = { data: [], typing: false, beforeChange: function() { beforeChange(editor, locks, beforeBookmark); }, add: function(level2, event) { return addUndoLevel(editor, undoManager, index2, locks, beforeBookmark, level2, event); }, undo: function() { return undo(editor, undoManager, locks, index2); }, redo: function() { return redo(editor, index2, undoManager.data); }, clear: function() { clear2(editor, undoManager, index2); }, reset: function() { reset2(editor, undoManager); }, hasUndo: function() { return hasUndo(editor, undoManager, index2); }, hasRedo: function() { return hasRedo(editor, undoManager, index2); }, transact: function(callback2) { return transact(editor, undoManager, locks, callback2); }, ignore: function(callback2) { ignore(editor, locks, callback2); }, extra: function(callback1, callback2) { extra(editor, undoManager, index2, callback1, callback2); } }; if (!isRtc(editor)) { registerEvents(editor, undoManager, locks); } addKeyboardShortcuts(editor); return undoManager; }; var nonTypingKeycodes = [ 9, 27, VK.HOME, VK.END, 19, 20, 44, 144, 145, 33, 34, 45, 16, 17, 18, 91, 92, 93, VK.DOWN, VK.UP, VK.LEFT, VK.RIGHT ].concat(Env.browser.isFirefox() ? [224] : []); var placeholderAttr = "data-mce-placeholder"; var isKeyboardEvent = function(e2) { return e2.type === "keydown" || e2.type === "keyup"; }; var isDeleteEvent = function(e2) { var keyCode = e2.keyCode; return keyCode === VK.BACKSPACE || keyCode === VK.DELETE; }; var isNonTypingKeyboardEvent = function(e2) { if (isKeyboardEvent(e2)) { var keyCode = e2.keyCode; return !isDeleteEvent(e2) && (VK.metaKeyPressed(e2) || e2.altKey || keyCode >= 112 && keyCode <= 123 || contains$3(nonTypingKeycodes, keyCode)); } else { return false; } }; var isTypingKeyboardEvent = function(e2) { return isKeyboardEvent(e2) && !(isDeleteEvent(e2) || e2.type === "keyup" && e2.keyCode === 229); }; var isVisuallyEmpty = function(dom2, rootElm, forcedRootBlock) { if (isEmpty$2(SugarElement.fromDom(rootElm), false)) { var isForcedRootBlockFalse = forcedRootBlock === ""; var firstElement2 = rootElm.firstElementChild; if (!firstElement2) { return true; } else if (dom2.getStyle(rootElm.firstElementChild, "padding-left") || dom2.getStyle(rootElm.firstElementChild, "padding-right")) { return false; } else { return isForcedRootBlockFalse ? !dom2.isBlock(firstElement2) : forcedRootBlock === firstElement2.nodeName.toLowerCase(); } } else { return false; } }; var setup$g = function(editor) { var dom2 = editor.dom; var rootBlock = getForcedRootBlock(editor); var placeholder = getPlaceholder(editor); var updatePlaceholder = function(e2, initial) { if (isNonTypingKeyboardEvent(e2)) { return; } var body = editor.getBody(); var showPlaceholder = isTypingKeyboardEvent(e2) ? false : isVisuallyEmpty(dom2, body, rootBlock); var isPlaceholderShown = dom2.getAttrib(body, placeholderAttr) !== ""; if (isPlaceholderShown !== showPlaceholder || initial) { dom2.setAttrib(body, placeholderAttr, showPlaceholder ? placeholder : null); dom2.setAttrib(body, "aria-placeholder", showPlaceholder ? placeholder : null); firePlaceholderToggle(editor, showPlaceholder); editor.on(showPlaceholder ? "keydown" : "keyup", updatePlaceholder); editor.off(showPlaceholder ? "keyup" : "keydown", updatePlaceholder); } }; if (placeholder) { editor.on("init", function(e2) { updatePlaceholder(e2, true); editor.on("change SetContent ExecCommand", updatePlaceholder); editor.on("paste", function(e3) { return Delay.setEditorTimeout(editor, function() { return updatePlaceholder(e3); }); }); }); } }; var strongRtl = /[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/; var hasStrongRtl = function(text) { return strongRtl.test(text); }; var isInlineTarget = function(editor, elm) { return is$2(SugarElement.fromDom(elm), getInlineBoundarySelector(editor)); }; var isRtl = function(element) { return DOMUtils.DOM.getStyle(element, "direction", true) === "rtl" || hasStrongRtl(element.textContent); }; var findInlineParents = function(isInlineTarget2, rootNode, pos) { return filter$4(DOMUtils.DOM.getParents(pos.container(), "*", rootNode), isInlineTarget2); }; var findRootInline = function(isInlineTarget2, rootNode, pos) { var parents2 = findInlineParents(isInlineTarget2, rootNode, pos); return Optional.from(parents2[parents2.length - 1]); }; var hasSameParentBlock = function(rootNode, node1, node2) { var block1 = getParentBlock$2(node1, rootNode); var block2 = getParentBlock$2(node2, rootNode); return block1 && block1 === block2; }; var isAtZwsp = function(pos) { return isBeforeInline(pos) || isAfterInline(pos); }; var normalizePosition = function(forward, pos) { if (!pos) { return pos; } var container = pos.container(), offset4 = pos.offset(); if (forward) { if (isCaretContainerInline(container)) { if (isText$7(container.nextSibling)) { return CaretPosition(container.nextSibling, 0); } else { return CaretPosition.after(container); } } else { return isBeforeInline(pos) ? CaretPosition(container, offset4 + 1) : pos; } } else { if (isCaretContainerInline(container)) { if (isText$7(container.previousSibling)) { return CaretPosition(container.previousSibling, container.previousSibling.data.length); } else { return CaretPosition.before(container); } } else { return isAfterInline(pos) ? CaretPosition(container, offset4 - 1) : pos; } } }; var normalizeForwards = curry(normalizePosition, true); var normalizeBackwards = curry(normalizePosition, false); var isBeforeRoot = function(rootNode) { return function(elm) { return eq2(rootNode, SugarElement.fromDom(elm.dom.parentNode)); }; }; var isTextBlockOrListItem = function(element) { return isTextBlock$2(element) || isListItem(element); }; var getParentBlock$1 = function(rootNode, elm) { if (contains$1(rootNode, elm)) { return closest$3(elm, isTextBlockOrListItem, isBeforeRoot(rootNode)); } else { return Optional.none(); } }; var placeCaretInEmptyBody = function(editor) { var body = editor.getBody(); var node = body.firstChild && editor.dom.isBlock(body.firstChild) ? body.firstChild : body; editor.selection.setCursorLocation(node, 0); }; var paddEmptyBody = function(editor) { if (editor.dom.isEmpty(editor.getBody())) { editor.setContent(""); placeCaretInEmptyBody(editor); } }; var willDeleteLastPositionInElement = function(forward, fromPos, elm) { return lift2(firstPositionIn(elm), lastPositionIn(elm), function(firstPos, lastPos) { var normalizedFirstPos = normalizePosition(true, firstPos); var normalizedLastPos = normalizePosition(false, lastPos); var normalizedFromPos = normalizePosition(false, fromPos); if (forward) { return nextPosition(elm, normalizedFromPos).exists(function(nextPos) { return nextPos.isEqual(normalizedLastPos) && fromPos.isEqual(normalizedFirstPos); }); } else { return prevPosition(elm, normalizedFromPos).exists(function(prevPos) { return prevPos.isEqual(normalizedFirstPos) && fromPos.isEqual(normalizedLastPos); }); } }).getOr(true); }; var blockPosition = function(block, position2) { return { block, position: position2 }; }; var blockBoundary = function(from3, to3) { return { from: from3, to: to3 }; }; var getBlockPosition = function(rootNode, pos) { var rootElm = SugarElement.fromDom(rootNode); var containerElm = SugarElement.fromDom(pos.container()); return getParentBlock$1(rootElm, containerElm).map(function(block) { return blockPosition(block, pos); }); }; var isDifferentBlocks = function(blockBoundary2) { return eq2(blockBoundary2.from.block, blockBoundary2.to.block) === false; }; var hasSameParent = function(blockBoundary2) { return parent2(blockBoundary2.from.block).bind(function(parent1) { return parent2(blockBoundary2.to.block).filter(function(parent22) { return eq2(parent1, parent22); }); }).isSome(); }; var isEditable$1 = function(blockBoundary2) { return isContentEditableFalse$b(blockBoundary2.from.block.dom) === false && isContentEditableFalse$b(blockBoundary2.to.block.dom) === false; }; var skipLastBr = function(rootNode, forward, blockPosition2) { if (isBr$5(blockPosition2.position.getNode()) && isEmpty$2(blockPosition2.block) === false) { return positionIn(false, blockPosition2.block.dom).bind(function(lastPositionInBlock) { if (lastPositionInBlock.isEqual(blockPosition2.position)) { return fromPosition(forward, rootNode, lastPositionInBlock).bind(function(to3) { return getBlockPosition(rootNode, to3); }); } else { return Optional.some(blockPosition2); } }).getOr(blockPosition2); } else { return blockPosition2; } }; var readFromRange = function(rootNode, forward, rng) { var fromBlockPos = getBlockPosition(rootNode, CaretPosition.fromRangeStart(rng)); var toBlockPos = fromBlockPos.bind(function(blockPos) { return fromPosition(forward, rootNode, blockPos.position).bind(function(to3) { return getBlockPosition(rootNode, to3).map(function(blockPos2) { return skipLastBr(rootNode, forward, blockPos2); }); }); }); return lift2(fromBlockPos, toBlockPos, blockBoundary).filter(function(blockBoundary2) { return isDifferentBlocks(blockBoundary2) && hasSameParent(blockBoundary2) && isEditable$1(blockBoundary2); }); }; var read$1 = function(rootNode, forward, rng) { return rng.collapsed ? readFromRange(rootNode, forward, rng) : Optional.none(); }; var getChildrenUntilBlockBoundary = function(block) { var children$1 = children(block); return findIndex$2(children$1, isBlock$2).fold(constant2(children$1), function(index2) { return children$1.slice(0, index2); }); }; var extractChildren = function(block) { var children2 = getChildrenUntilBlockBoundary(block); each$k(children2, remove$7); return children2; }; var removeEmptyRoot = function(rootNode, block) { var parents2 = parentsAndSelf(block, rootNode); return find$3(parents2.reverse(), function(element) { return isEmpty$2(element); }).each(remove$7); }; var isEmptyBefore = function(el) { return filter$4(prevSiblings(el), function(el2) { return !isEmpty$2(el2); }).length === 0; }; var nestedBlockMerge = function(rootNode, fromBlock, toBlock, insertionPoint) { if (isEmpty$2(toBlock)) { fillWithPaddingBr(toBlock); return firstPositionIn(toBlock.dom); } if (isEmptyBefore(insertionPoint) && isEmpty$2(fromBlock)) { before$4(insertionPoint, SugarElement.fromTag("br")); } var position2 = prevPosition(toBlock.dom, CaretPosition.before(insertionPoint.dom)); each$k(extractChildren(fromBlock), function(child2) { before$4(insertionPoint, child2); }); removeEmptyRoot(rootNode, fromBlock); return position2; }; var sidelongBlockMerge = function(rootNode, fromBlock, toBlock) { if (isEmpty$2(toBlock)) { remove$7(toBlock); if (isEmpty$2(fromBlock)) { fillWithPaddingBr(fromBlock); } return firstPositionIn(fromBlock.dom); } var position2 = lastPositionIn(toBlock.dom); each$k(extractChildren(fromBlock), function(child2) { append$1(toBlock, child2); }); removeEmptyRoot(rootNode, fromBlock); return position2; }; var findInsertionPoint = function(toBlock, block) { var parentsAndSelf$1 = parentsAndSelf(block, toBlock); return Optional.from(parentsAndSelf$1[parentsAndSelf$1.length - 1]); }; var getInsertionPoint = function(fromBlock, toBlock) { return contains$1(toBlock, fromBlock) ? findInsertionPoint(toBlock, fromBlock) : Optional.none(); }; var trimBr = function(first2, block) { positionIn(first2, block.dom).map(function(position2) { return position2.getNode(); }).map(SugarElement.fromDom).filter(isBr$4).each(remove$7); }; var mergeBlockInto = function(rootNode, fromBlock, toBlock) { trimBr(true, fromBlock); trimBr(false, toBlock); return getInsertionPoint(fromBlock, toBlock).fold(curry(sidelongBlockMerge, rootNode, fromBlock, toBlock), curry(nestedBlockMerge, rootNode, fromBlock, toBlock)); }; var mergeBlocks = function(rootNode, forward, block1, block2) { return forward ? mergeBlockInto(rootNode, block2, block1) : mergeBlockInto(rootNode, block1, block2); }; var backspaceDelete$8 = function(editor, forward) { var rootNode = SugarElement.fromDom(editor.getBody()); var position2 = read$1(rootNode.dom, forward, editor.selection.getRng()).bind(function(blockBoundary2) { return mergeBlocks(rootNode, forward, blockBoundary2.from.block, blockBoundary2.to.block); }); position2.each(function(pos) { editor.selection.setRng(pos.toRange()); }); return position2.isSome(); }; var deleteRangeMergeBlocks = function(rootNode, selection) { var rng = selection.getRng(); return lift2(getParentBlock$1(rootNode, SugarElement.fromDom(rng.startContainer)), getParentBlock$1(rootNode, SugarElement.fromDom(rng.endContainer)), function(block1, block2) { if (eq2(block1, block2) === false) { rng.deleteContents(); mergeBlocks(rootNode, true, block1, block2).each(function(pos) { selection.setRng(pos.toRange()); }); return true; } else { return false; } }).getOr(false); }; var isRawNodeInTable = function(root2, rawNode) { var node = SugarElement.fromDom(rawNode); var isRoot = curry(eq2, root2); return ancestor$3(node, isTableCell$4, isRoot).isSome(); }; var isSelectionInTable = function(root2, rng) { return isRawNodeInTable(root2, rng.startContainer) || isRawNodeInTable(root2, rng.endContainer); }; var isEverythingSelected = function(root2, rng) { var noPrevious = prevPosition(root2.dom, CaretPosition.fromRangeStart(rng)).isNone(); var noNext = nextPosition(root2.dom, CaretPosition.fromRangeEnd(rng)).isNone(); return !isSelectionInTable(root2, rng) && noPrevious && noNext; }; var emptyEditor = function(editor) { editor.setContent(""); editor.selection.setCursorLocation(); return true; }; var deleteRange$1 = function(editor) { var rootNode = SugarElement.fromDom(editor.getBody()); var rng = editor.selection.getRng(); return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection); }; var backspaceDelete$7 = function(editor, _forward) { return editor.selection.isCollapsed() ? false : deleteRange$1(editor); }; var isContentEditableTrue$2 = isContentEditableTrue$4; var isContentEditableFalse$4 = isContentEditableFalse$b; var showCaret = function(direction, editor, node, before2, scrollIntoView2) { return Optional.from(editor._selectionOverrides.showCaret(direction, node, before2, scrollIntoView2)); }; var getNodeRange = function(node) { var rng = node.ownerDocument.createRange(); rng.selectNode(node); return rng; }; var selectNode = function(editor, node) { var e2 = editor.fire("BeforeObjectSelected", { target: node }); if (e2.isDefaultPrevented()) { return Optional.none(); } return Optional.some(getNodeRange(node)); }; var renderCaretAtRange = function(editor, range3, scrollIntoView2) { var normalizedRange = normalizeRange(1, editor.getBody(), range3); var caretPosition = CaretPosition.fromRangeStart(normalizedRange); var caretPositionNode = caretPosition.getNode(); if (isInlineFakeCaretTarget(caretPositionNode)) { return showCaret(1, editor, caretPositionNode, !caretPosition.isAtEnd(), false); } var caretPositionBeforeNode = caretPosition.getNode(true); if (isInlineFakeCaretTarget(caretPositionBeforeNode)) { return showCaret(1, editor, caretPositionBeforeNode, false, false); } var ceRoot = editor.dom.getParent(caretPosition.getNode(), function(node) { return isContentEditableFalse$4(node) || isContentEditableTrue$2(node); }); if (isInlineFakeCaretTarget(ceRoot)) { return showCaret(1, editor, ceRoot, false, scrollIntoView2); } return Optional.none(); }; var renderRangeCaret = function(editor, range3, scrollIntoView2) { return range3.collapsed ? renderCaretAtRange(editor, range3, scrollIntoView2).getOr(range3) : range3; }; var isBeforeBoundary = function(pos) { return isBeforeContentEditableFalse(pos) || isBeforeMedia(pos); }; var isAfterBoundary = function(pos) { return isAfterContentEditableFalse(pos) || isAfterMedia(pos); }; var trimEmptyTextNode = function(dom2, node) { if (isText$7(node) && node.data.length === 0) { dom2.remove(node); } }; var deleteContentAndShowCaret = function(editor, range3, node, direction, forward, peekCaretPosition) { showCaret(direction, editor, peekCaretPosition.getNode(!forward), forward, true).each(function(caretRange) { if (range3.collapsed) { var deleteRange2 = range3.cloneRange(); if (forward) { deleteRange2.setEnd(caretRange.startContainer, caretRange.startOffset); } else { deleteRange2.setStart(caretRange.endContainer, caretRange.endOffset); } deleteRange2.deleteContents(); } else { range3.deleteContents(); } editor.selection.setRng(caretRange); }); trimEmptyTextNode(editor.dom, node); return true; }; var deleteBoundaryText = function(editor, forward) { var range3 = editor.selection.getRng(); if (!isText$7(range3.commonAncestorContainer)) { return false; } var direction = forward ? HDirection.Forwards : HDirection.Backwards; var caretWalker = CaretWalker(editor.getBody()); var getNextPosFn = curry(getVisualCaretPosition, forward ? caretWalker.next : caretWalker.prev); var isBeforeFn = forward ? isBeforeBoundary : isAfterBoundary; var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range3); var nextCaretPosition = normalizePosition(forward, getNextPosFn(caretPosition)); if (!nextCaretPosition || !isMoveInsideSameBlock(caretPosition, nextCaretPosition)) { return false; } else if (isBeforeFn(nextCaretPosition)) { return deleteContentAndShowCaret(editor, range3, caretPosition.getNode(), direction, forward, nextCaretPosition); } var peekCaretPosition = getNextPosFn(nextCaretPosition); if (peekCaretPosition && isBeforeFn(peekCaretPosition)) { if (isMoveInsideSameBlock(nextCaretPosition, peekCaretPosition)) { return deleteContentAndShowCaret(editor, range3, caretPosition.getNode(), direction, forward, peekCaretPosition); } } return false; }; var backspaceDelete$6 = function(editor, forward) { return deleteBoundaryText(editor, forward); }; var isCompoundElement = function(node) { return isTableCell$4(SugarElement.fromDom(node)) || isListItem(SugarElement.fromDom(node)); }; var DeleteAction = Adt.generate([ { remove: ["element"] }, { moveToElement: ["element"] }, { moveToPosition: ["position"] } ]); var isAtContentEditableBlockCaret = function(forward, from3) { var elm = from3.getNode(forward === false); var caretLocation = forward ? "after" : "before"; return isElement$5(elm) && elm.getAttribute("data-mce-caret") === caretLocation; }; var isDeleteFromCefDifferentBlocks = function(root2, forward, from3, to3) { var inSameBlock = function(elm) { return isInline$1(SugarElement.fromDom(elm)) && !isInSameBlock(from3, to3, root2); }; return getRelativeCefElm(!forward, from3).fold(function() { return getRelativeCefElm(forward, to3).fold(never, inSameBlock); }, inSameBlock); }; var deleteEmptyBlockOrMoveToCef = function(root2, forward, from3, to3) { var toCefElm = to3.getNode(forward === false); return getParentBlock$1(SugarElement.fromDom(root2), SugarElement.fromDom(from3.getNode())).map(function(blockElm) { return isEmpty$2(blockElm) ? DeleteAction.remove(blockElm.dom) : DeleteAction.moveToElement(toCefElm); }).orThunk(function() { return Optional.some(DeleteAction.moveToElement(toCefElm)); }); }; var findCefPosition = function(root2, forward, from3) { return fromPosition(forward, root2, from3).bind(function(to3) { if (isCompoundElement(to3.getNode())) { return Optional.none(); } else if (isDeleteFromCefDifferentBlocks(root2, forward, from3, to3)) { return Optional.none(); } else if (forward && isContentEditableFalse$b(to3.getNode())) { return deleteEmptyBlockOrMoveToCef(root2, forward, from3, to3); } else if (forward === false && isContentEditableFalse$b(to3.getNode(true))) { return deleteEmptyBlockOrMoveToCef(root2, forward, from3, to3); } else if (forward && isAfterContentEditableFalse(from3)) { return Optional.some(DeleteAction.moveToPosition(to3)); } else if (forward === false && isBeforeContentEditableFalse(from3)) { return Optional.some(DeleteAction.moveToPosition(to3)); } else { return Optional.none(); } }); }; var getContentEditableBlockAction = function(forward, elm) { if (forward && isContentEditableFalse$b(elm.nextSibling)) { return Optional.some(DeleteAction.moveToElement(elm.nextSibling)); } else if (forward === false && isContentEditableFalse$b(elm.previousSibling)) { return Optional.some(DeleteAction.moveToElement(elm.previousSibling)); } else { return Optional.none(); } }; var skipMoveToActionFromInlineCefToContent = function(root2, from3, deleteAction2) { return deleteAction2.fold(function(elm) { return Optional.some(DeleteAction.remove(elm)); }, function(elm) { return Optional.some(DeleteAction.moveToElement(elm)); }, function(to3) { if (isInSameBlock(from3, to3, root2)) { return Optional.none(); } else { return Optional.some(DeleteAction.moveToPosition(to3)); } }); }; var getContentEditableAction = function(root2, forward, from3) { if (isAtContentEditableBlockCaret(forward, from3)) { return getContentEditableBlockAction(forward, from3.getNode(forward === false)).fold(function() { return findCefPosition(root2, forward, from3); }, Optional.some); } else { return findCefPosition(root2, forward, from3).bind(function(deleteAction2) { return skipMoveToActionFromInlineCefToContent(root2, from3, deleteAction2); }); } }; var read = function(root2, forward, rng) { var normalizedRange = normalizeRange(forward ? 1 : -1, root2, rng); var from3 = CaretPosition.fromRangeStart(normalizedRange); var rootElement = SugarElement.fromDom(root2); if (forward === false && isAfterContentEditableFalse(from3)) { return Optional.some(DeleteAction.remove(from3.getNode(true))); } else if (forward && isBeforeContentEditableFalse(from3)) { return Optional.some(DeleteAction.remove(from3.getNode())); } else if (forward === false && isBeforeContentEditableFalse(from3) && isAfterBr(rootElement, from3)) { return findPreviousBr(rootElement, from3).map(function(br) { return DeleteAction.remove(br.getNode()); }); } else if (forward && isAfterContentEditableFalse(from3) && isBeforeBr$1(rootElement, from3)) { return findNextBr(rootElement, from3).map(function(br) { return DeleteAction.remove(br.getNode()); }); } else { return getContentEditableAction(root2, forward, from3); } }; var deleteElement$1 = function(editor, forward) { return function(element) { editor._selectionOverrides.hideFakeCaret(); deleteElement$2(editor, forward, SugarElement.fromDom(element)); return true; }; }; var moveToElement = function(editor, forward) { return function(element) { var pos = forward ? CaretPosition.before(element) : CaretPosition.after(element); editor.selection.setRng(pos.toRange()); return true; }; }; var moveToPosition = function(editor) { return function(pos) { editor.selection.setRng(pos.toRange()); return true; }; }; var getAncestorCe = function(editor, node) { return Optional.from(getContentEditableRoot$1(editor.getBody(), node)); }; var backspaceDeleteCaret = function(editor, forward) { var selectedNode = editor.selection.getNode(); return getAncestorCe(editor, selectedNode).filter(isContentEditableFalse$b).fold(function() { return read(editor.getBody(), forward, editor.selection.getRng()).exists(function(deleteAction2) { return deleteAction2.fold(deleteElement$1(editor, forward), moveToElement(editor, forward), moveToPosition(editor)); }); }, always); }; var deleteOffscreenSelection = function(rootElement) { each$k(descendants(rootElement, ".mce-offscreen-selection"), remove$7); }; var backspaceDeleteRange = function(editor, forward) { var selectedNode = editor.selection.getNode(); if (isContentEditableFalse$b(selectedNode) && !isTableCell$5(selectedNode)) { var hasCefAncestor = getAncestorCe(editor, selectedNode.parentNode).filter(isContentEditableFalse$b); return hasCefAncestor.fold(function() { deleteOffscreenSelection(SugarElement.fromDom(editor.getBody())); deleteElement$2(editor, forward, SugarElement.fromDom(editor.selection.getNode())); paddEmptyBody(editor); return true; }, always); } return false; }; var paddEmptyElement = function(editor) { var dom2 = editor.dom, selection = editor.selection; var ceRoot = getContentEditableRoot$1(editor.getBody(), selection.getNode()); if (isContentEditableTrue$4(ceRoot) && dom2.isBlock(ceRoot) && dom2.isEmpty(ceRoot)) { var br = dom2.create("br", { "data-mce-bogus": "1" }); dom2.setHTML(ceRoot, ""); ceRoot.appendChild(br); selection.setRng(CaretPosition.before(br).toRange()); } return true; }; var backspaceDelete$5 = function(editor, forward) { if (editor.selection.isCollapsed()) { return backspaceDeleteCaret(editor, forward); } else { return backspaceDeleteRange(editor, forward); } }; var deleteCaret$2 = function(editor, forward) { var fromPos = CaretPosition.fromRangeStart(editor.selection.getRng()); return fromPosition(forward, editor.getBody(), fromPos).filter(function(pos) { return forward ? isBeforeImageBlock(pos) : isAfterImageBlock(pos); }).bind(function(pos) { return Optional.from(getChildNodeAtRelativeOffset(forward ? 0 : -1, pos)); }).exists(function(elm) { editor.selection.select(elm); return true; }); }; var backspaceDelete$4 = function(editor, forward) { return editor.selection.isCollapsed() ? deleteCaret$2(editor, forward) : false; }; var isText = isText$7; var startsWithCaretContainer = function(node) { return isText(node) && node.data[0] === ZWSP$1; }; var endsWithCaretContainer = function(node) { return isText(node) && node.data[node.data.length - 1] === ZWSP$1; }; var createZwsp = function(node) { return node.ownerDocument.createTextNode(ZWSP$1); }; var insertBefore = function(node) { if (isText(node.previousSibling)) { if (endsWithCaretContainer(node.previousSibling)) { return node.previousSibling; } else { node.previousSibling.appendData(ZWSP$1); return node.previousSibling; } } else if (isText(node)) { if (startsWithCaretContainer(node)) { return node; } else { node.insertData(0, ZWSP$1); return node; } } else { var newNode = createZwsp(node); node.parentNode.insertBefore(newNode, node); return newNode; } }; var insertAfter = function(node) { if (isText(node.nextSibling)) { if (startsWithCaretContainer(node.nextSibling)) { return node.nextSibling; } else { node.nextSibling.insertData(0, ZWSP$1); return node.nextSibling; } } else if (isText(node)) { if (endsWithCaretContainer(node)) { return node; } else { node.appendData(ZWSP$1); return node; } } else { var newNode = createZwsp(node); if (node.nextSibling) { node.parentNode.insertBefore(newNode, node.nextSibling); } else { node.parentNode.appendChild(newNode); } return newNode; } }; var insertInline = function(before2, node) { return before2 ? insertBefore(node) : insertAfter(node); }; var insertInlineBefore = curry(insertInline, true); var insertInlineAfter = curry(insertInline, false); var insertInlinePos = function(pos, before2) { if (isText$7(pos.container())) { return insertInline(before2, pos.container()); } else { return insertInline(before2, pos.getNode()); } }; var isPosCaretContainer = function(pos, caret) { var caretNode = caret.get(); return caretNode && pos.container() === caretNode && isCaretContainerInline(caretNode); }; var renderCaret = function(caret, location) { return location.fold(function(element) { remove$2(caret.get()); var text = insertInlineBefore(element); caret.set(text); return Optional.some(CaretPosition(text, text.length - 1)); }, function(element) { return firstPositionIn(element).map(function(pos) { if (!isPosCaretContainer(pos, caret)) { remove$2(caret.get()); var text = insertInlinePos(pos, true); caret.set(text); return CaretPosition(text, 1); } else { return CaretPosition(caret.get(), 1); } }); }, function(element) { return lastPositionIn(element).map(function(pos) { if (!isPosCaretContainer(pos, caret)) { remove$2(caret.get()); var text = insertInlinePos(pos, false); caret.set(text); return CaretPosition(text, text.length - 1); } else { return CaretPosition(caret.get(), caret.get().length - 1); } }); }, function(element) { remove$2(caret.get()); var text = insertInlineAfter(element); caret.set(text); return Optional.some(CaretPosition(text, 1)); }); }; var evaluateUntil = function(fns, args) { for (var i2 = 0; i2 < fns.length; i2++) { var result = fns[i2].apply(null, args); if (result.isSome()) { return result; } } return Optional.none(); }; var Location = Adt.generate([ { before: ["element"] }, { start: ["element"] }, { end: ["element"] }, { after: ["element"] } ]); var rescope$1 = function(rootNode, node) { var parentBlock = getParentBlock$2(node, rootNode); return parentBlock ? parentBlock : rootNode; }; var before = function(isInlineTarget2, rootNode, pos) { var nPos = normalizeForwards(pos); var scope = rescope$1(rootNode, nPos.container()); return findRootInline(isInlineTarget2, scope, nPos).fold(function() { return nextPosition(scope, nPos).bind(curry(findRootInline, isInlineTarget2, scope)).map(function(inline) { return Location.before(inline); }); }, Optional.none); }; var isNotInsideFormatCaretContainer = function(rootNode, elm) { return getParentCaretContainer(rootNode, elm) === null; }; var findInsideRootInline = function(isInlineTarget2, rootNode, pos) { return findRootInline(isInlineTarget2, rootNode, pos).filter(curry(isNotInsideFormatCaretContainer, rootNode)); }; var start$1 = function(isInlineTarget2, rootNode, pos) { var nPos = normalizeBackwards(pos); return findInsideRootInline(isInlineTarget2, rootNode, nPos).bind(function(inline) { var prevPos = prevPosition(inline, nPos); return prevPos.isNone() ? Optional.some(Location.start(inline)) : Optional.none(); }); }; var end = function(isInlineTarget2, rootNode, pos) { var nPos = normalizeForwards(pos); return findInsideRootInline(isInlineTarget2, rootNode, nPos).bind(function(inline) { var nextPos = nextPosition(inline, nPos); return nextPos.isNone() ? Optional.some(Location.end(inline)) : Optional.none(); }); }; var after = function(isInlineTarget2, rootNode, pos) { var nPos = normalizeBackwards(pos); var scope = rescope$1(rootNode, nPos.container()); return findRootInline(isInlineTarget2, scope, nPos).fold(function() { return prevPosition(scope, nPos).bind(curry(findRootInline, isInlineTarget2, scope)).map(function(inline) { return Location.after(inline); }); }, Optional.none); }; var isValidLocation = function(location) { return isRtl(getElement2(location)) === false; }; var readLocation = function(isInlineTarget2, rootNode, pos) { var location = evaluateUntil([ before, start$1, end, after ], [ isInlineTarget2, rootNode, pos ]); return location.filter(isValidLocation); }; var getElement2 = function(location) { return location.fold(identity2, identity2, identity2, identity2); }; var getName = function(location) { return location.fold(constant2("before"), constant2("start"), constant2("end"), constant2("after")); }; var outside = function(location) { return location.fold(Location.before, Location.before, Location.after, Location.after); }; var inside = function(location) { return location.fold(Location.start, Location.start, Location.end, Location.end); }; var isEq = function(location1, location2) { return getName(location1) === getName(location2) && getElement2(location1) === getElement2(location2); }; var betweenInlines = function(forward, isInlineTarget2, rootNode, from3, to3, location) { return lift2(findRootInline(isInlineTarget2, rootNode, from3), findRootInline(isInlineTarget2, rootNode, to3), function(fromInline, toInline) { if (fromInline !== toInline && hasSameParentBlock(rootNode, fromInline, toInline)) { return Location.after(forward ? fromInline : toInline); } else { return location; } }).getOr(location); }; var skipNoMovement = function(fromLocation, toLocation) { return fromLocation.fold(always, function(fromLocation2) { return !isEq(fromLocation2, toLocation); }); }; var findLocationTraverse = function(forward, isInlineTarget2, rootNode, fromLocation, pos) { var from3 = normalizePosition(forward, pos); var to3 = fromPosition(forward, rootNode, from3).map(curry(normalizePosition, forward)); var location = to3.fold(function() { return fromLocation.map(outside); }, function(to4) { return readLocation(isInlineTarget2, rootNode, to4).map(curry(betweenInlines, forward, isInlineTarget2, rootNode, from3, to4)).filter(curry(skipNoMovement, fromLocation)); }); return location.filter(isValidLocation); }; var findLocationSimple = function(forward, location) { if (forward) { return location.fold(compose(Optional.some, Location.start), Optional.none, compose(Optional.some, Location.after), Optional.none); } else { return location.fold(Optional.none, compose(Optional.some, Location.before), Optional.none, compose(Optional.some, Location.end)); } }; var findLocation$1 = function(forward, isInlineTarget2, rootNode, pos) { var from3 = normalizePosition(forward, pos); var fromLocation = readLocation(isInlineTarget2, rootNode, from3); return readLocation(isInlineTarget2, rootNode, from3).bind(curry(findLocationSimple, forward)).orThunk(function() { return findLocationTraverse(forward, isInlineTarget2, rootNode, fromLocation, pos); }); }; curry(findLocation$1, false); curry(findLocation$1, true); var hasSelectionModifyApi = function(editor) { return isFunction3(editor.selection.getSel().modify); }; var moveRel = function(forward, selection, pos) { var delta = forward ? 1 : -1; selection.setRng(CaretPosition(pos.container(), pos.offset() + delta).toRange()); selection.getSel().modify("move", forward ? "forward" : "backward", "word"); return true; }; var moveByWord = function(forward, editor) { var rng = editor.selection.getRng(); var pos = forward ? CaretPosition.fromRangeEnd(rng) : CaretPosition.fromRangeStart(rng); if (!hasSelectionModifyApi(editor)) { return false; } else if (forward && isBeforeInline(pos)) { return moveRel(true, editor.selection, pos); } else if (!forward && isAfterInline(pos)) { return moveRel(false, editor.selection, pos); } else { return false; } }; var BreakType; (function(BreakType2) { BreakType2[BreakType2["Br"] = 0] = "Br"; BreakType2[BreakType2["Block"] = 1] = "Block"; BreakType2[BreakType2["Wrap"] = 2] = "Wrap"; BreakType2[BreakType2["Eol"] = 3] = "Eol"; })(BreakType || (BreakType = {})); var flip2 = function(direction, positions) { return direction === HDirection.Backwards ? reverse(positions) : positions; }; var walk = function(direction, caretWalker, pos) { return direction === HDirection.Forwards ? caretWalker.next(pos) : caretWalker.prev(pos); }; var getBreakType = function(scope, direction, currentPos, nextPos) { if (isBr$5(nextPos.getNode(direction === HDirection.Forwards))) { return BreakType.Br; } else if (isInSameBlock(currentPos, nextPos) === false) { return BreakType.Block; } else { return BreakType.Wrap; } }; var getPositionsUntil = function(predicate, direction, scope, start2) { var caretWalker = CaretWalker(scope); var currentPos = start2; var positions = []; while (currentPos) { var nextPos = walk(direction, caretWalker, currentPos); if (!nextPos) { break; } if (isBr$5(nextPos.getNode(false))) { if (direction === HDirection.Forwards) { return { positions: flip2(direction, positions).concat([nextPos]), breakType: BreakType.Br, breakAt: Optional.some(nextPos) }; } else { return { positions: flip2(direction, positions), breakType: BreakType.Br, breakAt: Optional.some(nextPos) }; } } if (!nextPos.isVisible()) { currentPos = nextPos; continue; } if (predicate(currentPos, nextPos)) { var breakType = getBreakType(scope, direction, currentPos, nextPos); return { positions: flip2(direction, positions), breakType, breakAt: Optional.some(nextPos) }; } positions.push(nextPos); currentPos = nextPos; } return { positions: flip2(direction, positions), breakType: BreakType.Eol, breakAt: Optional.none() }; }; var getAdjacentLinePositions = function(direction, getPositionsUntilBreak, scope, start2) { return getPositionsUntilBreak(scope, start2).breakAt.map(function(pos) { var positions = getPositionsUntilBreak(scope, pos).positions; return direction === HDirection.Backwards ? positions.concat(pos) : [pos].concat(positions); }).getOr([]); }; var findClosestHorizontalPositionFromPoint = function(positions, x2) { return foldl(positions, function(acc, newPos) { return acc.fold(function() { return Optional.some(newPos); }, function(lastPos) { return lift2(head(lastPos.getClientRects()), head(newPos.getClientRects()), function(lastRect, newRect) { var lastDist = Math.abs(x2 - lastRect.left); var newDist = Math.abs(x2 - newRect.left); return newDist <= lastDist ? newPos : lastPos; }).or(acc); }); }, Optional.none()); }; var findClosestHorizontalPosition = function(positions, pos) { return head(pos.getClientRects()).bind(function(targetRect) { return findClosestHorizontalPositionFromPoint(positions, targetRect.left); }); }; var getPositionsUntilPreviousLine = curry(getPositionsUntil, CaretPosition.isAbove, -1); var getPositionsUntilNextLine = curry(getPositionsUntil, CaretPosition.isBelow, 1); var getPositionsAbove = curry(getAdjacentLinePositions, -1, getPositionsUntilPreviousLine); var getPositionsBelow = curry(getAdjacentLinePositions, 1, getPositionsUntilNextLine); var isAtFirstLine = function(scope, pos) { return getPositionsUntilPreviousLine(scope, pos).breakAt.isNone(); }; var isAtLastLine = function(scope, pos) { return getPositionsUntilNextLine(scope, pos).breakAt.isNone(); }; var getFirstLinePositions = function(scope) { return firstPositionIn(scope).map(function(pos) { return [pos].concat(getPositionsUntilNextLine(scope, pos).positions); }).getOr([]); }; var getLastLinePositions = function(scope) { return lastPositionIn(scope).map(function(pos) { return getPositionsUntilPreviousLine(scope, pos).positions.concat(pos); }).getOr([]); }; var getNodeClientRects = function(node) { var toArrayWithNode = function(clientRects) { return map$3(clientRects, function(rect) { var clientRect = clone4(rect); clientRect.node = node; return clientRect; }); }; if (isElement$5(node)) { return toArrayWithNode(node.getClientRects()); } if (isText$7(node)) { var rng = node.ownerDocument.createRange(); rng.setStart(node, 0); rng.setEnd(node, node.data.length); return toArrayWithNode(rng.getClientRects()); } }; var getClientRects = function(nodes2) { return bind4(nodes2, getNodeClientRects); }; var VDirection; (function(VDirection2) { VDirection2[VDirection2["Up"] = -1] = "Up"; VDirection2[VDirection2["Down"] = 1] = "Down"; })(VDirection || (VDirection = {})); var findUntil = function(direction, root2, predicateFn, node) { while (node = findNode$1(node, direction, isEditableCaretCandidate$1, root2)) { if (predicateFn(node)) { return; } } }; var walkUntil$1 = function(direction, isAboveFn, isBeflowFn, root2, predicateFn, caretPosition) { var line = 0; var result = []; var add4 = function(node2) { var clientRects = getClientRects([node2]); if (direction === -1) { clientRects = clientRects.reverse(); } for (var i2 = 0; i2 < clientRects.length; i2++) { var clientRect = clientRects[i2]; if (isBeflowFn(clientRect, targetClientRect)) { continue; } if (result.length > 0 && isAboveFn(clientRect, last$1(result))) { line++; } clientRect.line = line; if (predicateFn(clientRect)) { return true; } result.push(clientRect); } }; var targetClientRect = last$1(caretPosition.getClientRects()); if (!targetClientRect) { return result; } var node = caretPosition.getNode(); add4(node); findUntil(direction, root2, add4, node); return result; }; var aboveLineNumber = function(lineNumber, clientRect) { return clientRect.line > lineNumber; }; var isLineNumber = function(lineNumber, clientRect) { return clientRect.line === lineNumber; }; var upUntil = curry(walkUntil$1, VDirection.Up, isAbove$1, isBelow$1); var downUntil = curry(walkUntil$1, VDirection.Down, isBelow$1, isAbove$1); var positionsUntil = function(direction, root2, predicateFn, node) { var caretWalker = CaretWalker(root2); var walkFn; var isBelowFn; var isAboveFn; var caretPosition; var result = []; var line = 0; var getClientRect = function(caretPosition2) { if (direction === 1) { return last$1(caretPosition2.getClientRects()); } return last$1(caretPosition2.getClientRects()); }; if (direction === 1) { walkFn = caretWalker.next; isBelowFn = isBelow$1; isAboveFn = isAbove$1; caretPosition = CaretPosition.after(node); } else { walkFn = caretWalker.prev; isBelowFn = isAbove$1; isAboveFn = isBelow$1; caretPosition = CaretPosition.before(node); } var targetClientRect = getClientRect(caretPosition); do { if (!caretPosition.isVisible()) { continue; } var rect = getClientRect(caretPosition); if (isAboveFn(rect, targetClientRect)) { continue; } if (result.length > 0 && isBelowFn(rect, last$1(result))) { line++; } var clientRect = clone4(rect); clientRect.position = caretPosition; clientRect.line = line; if (predicateFn(clientRect)) { return result; } result.push(clientRect); } while (caretPosition = walkFn(caretPosition)); return result; }; var isAboveLine = function(lineNumber) { return function(clientRect) { return aboveLineNumber(lineNumber, clientRect); }; }; var isLine = function(lineNumber) { return function(clientRect) { return isLineNumber(lineNumber, clientRect); }; }; var isContentEditableFalse$3 = isContentEditableFalse$b; var findNode = findNode$1; var distanceToRectLeft = function(clientRect, clientX) { return Math.abs(clientRect.left - clientX); }; var distanceToRectRight = function(clientRect, clientX) { return Math.abs(clientRect.right - clientX); }; var isInsideX = function(clientX, clientRect) { return clientX >= clientRect.left && clientX <= clientRect.right; }; var isInsideY = function(clientY, clientRect) { return clientY >= clientRect.top && clientY <= clientRect.bottom; }; var isNodeClientRect = function(rect) { return hasNonNullableKey(rect, "node"); }; var findClosestClientRect = function(clientRects, clientX, allowInside) { if (allowInside === void 0) { allowInside = always; } return reduce(clientRects, function(oldClientRect, clientRect) { if (isInsideX(clientX, clientRect)) { return allowInside(clientRect) ? clientRect : oldClientRect; } if (isInsideX(clientX, oldClientRect)) { return allowInside(oldClientRect) ? oldClientRect : clientRect; } var oldDistance = Math.min(distanceToRectLeft(oldClientRect, clientX), distanceToRectRight(oldClientRect, clientX)); var newDistance = Math.min(distanceToRectLeft(clientRect, clientX), distanceToRectRight(clientRect, clientX)); if (newDistance === oldDistance && isNodeClientRect(clientRect) && isContentEditableFalse$3(clientRect.node)) { return clientRect; } if (newDistance < oldDistance) { return clientRect; } return oldClientRect; }); }; var walkUntil = function(direction, root2, predicateFn, startNode, includeChildren) { var node = findNode(startNode, direction, isEditableCaretCandidate$1, root2, !includeChildren); do { if (!node || predicateFn(node)) { return; } } while (node = findNode(node, direction, isEditableCaretCandidate$1, root2)); }; var findLineNodeRects = function(root2, targetNodeRect, includeChildren) { if (includeChildren === void 0) { includeChildren = true; } var clientRects = []; var collect = function(checkPosFn, node) { var lineRects = filter$4(getClientRects([node]), function(clientRect) { return !checkPosFn(clientRect, targetNodeRect); }); clientRects = clientRects.concat(lineRects); return lineRects.length === 0; }; clientRects.push(targetNodeRect); walkUntil(VDirection.Up, root2, curry(collect, isAbove$1), targetNodeRect.node, includeChildren); walkUntil(VDirection.Down, root2, curry(collect, isBelow$1), targetNodeRect.node, includeChildren); return clientRects; }; var getFakeCaretTargets = function(root2) { return filter$4(from2(root2.getElementsByTagName("*")), isFakeCaretTarget); }; var caretInfo = function(clientRect, clientX) { return { node: clientRect.node, before: distanceToRectLeft(clientRect, clientX) < distanceToRectRight(clientRect, clientX) }; }; var closestFakeCaret = function(root2, clientX, clientY) { var fakeTargetNodeRects = getClientRects(getFakeCaretTargets(root2)); var targetNodeRects = filter$4(fakeTargetNodeRects, curry(isInsideY, clientY)); var checkInside = function(clientRect) { return !isTable$3(clientRect.node) && !isMedia$2(clientRect.node); }; var closestNodeRect = findClosestClientRect(targetNodeRects, clientX, checkInside); if (closestNodeRect) { var includeChildren = checkInside(closestNodeRect); closestNodeRect = findClosestClientRect(findLineNodeRects(root2, closestNodeRect, includeChildren), clientX, checkInside); if (closestNodeRect && isFakeCaretTarget(closestNodeRect.node)) { return caretInfo(closestNodeRect, clientX); } } return null; }; var moveToRange = function(editor, rng) { editor.selection.setRng(rng); scrollRangeIntoView(editor, editor.selection.getRng()); }; var renderRangeCaretOpt = function(editor, range3, scrollIntoView2) { return Optional.some(renderRangeCaret(editor, range3, scrollIntoView2)); }; var moveHorizontally = function(editor, direction, range3, isBefore2, isAfter2, isElement3) { var forwards = direction === HDirection.Forwards; var caretWalker = CaretWalker(editor.getBody()); var getNextPosFn = curry(getVisualCaretPosition, forwards ? caretWalker.next : caretWalker.prev); var isBeforeFn = forwards ? isBefore2 : isAfter2; if (!range3.collapsed) { var node = getSelectedNode(range3); if (isElement3(node)) { return showCaret(direction, editor, node, direction === HDirection.Backwards, false); } } var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range3); if (isBeforeFn(caretPosition)) { return selectNode(editor, caretPosition.getNode(!forwards)); } var nextCaretPosition = normalizePosition(forwards, getNextPosFn(caretPosition)); var rangeIsInContainerBlock = isRangeInCaretContainerBlock(range3); if (!nextCaretPosition) { return rangeIsInContainerBlock ? Optional.some(range3) : Optional.none(); } if (isBeforeFn(nextCaretPosition)) { return showCaret(direction, editor, nextCaretPosition.getNode(!forwards), forwards, false); } var peekCaretPosition = getNextPosFn(nextCaretPosition); if (peekCaretPosition && isBeforeFn(peekCaretPosition)) { if (isMoveInsideSameBlock(nextCaretPosition, peekCaretPosition)) { return showCaret(direction, editor, peekCaretPosition.getNode(!forwards), forwards, false); } } if (rangeIsInContainerBlock) { return renderRangeCaretOpt(editor, nextCaretPosition.toRange(), false); } return Optional.none(); }; var moveVertically = function(editor, direction, range3, isBefore2, isAfter2, isElement3) { var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range3); var caretClientRect = last$1(caretPosition.getClientRects()); var forwards = direction === VDirection.Down; if (!caretClientRect) { return Optional.none(); } var walkerFn = forwards ? downUntil : upUntil; var linePositions = walkerFn(editor.getBody(), isAboveLine(1), caretPosition); var nextLinePositions = filter$4(linePositions, isLine(1)); var clientX = caretClientRect.left; var nextLineRect = findClosestClientRect(nextLinePositions, clientX); if (nextLineRect && isElement3(nextLineRect.node)) { var dist1 = Math.abs(clientX - nextLineRect.left); var dist2 = Math.abs(clientX - nextLineRect.right); return showCaret(direction, editor, nextLineRect.node, dist1 < dist2, false); } var currentNode; if (isBefore2(caretPosition)) { currentNode = caretPosition.getNode(); } else if (isAfter2(caretPosition)) { currentNode = caretPosition.getNode(true); } else { currentNode = getSelectedNode(range3); } if (currentNode) { var caretPositions = positionsUntil(direction, editor.getBody(), isAboveLine(1), currentNode); var closestNextLineRect = findClosestClientRect(filter$4(caretPositions, isLine(1)), clientX); if (closestNextLineRect) { return renderRangeCaretOpt(editor, closestNextLineRect.position.toRange(), false); } closestNextLineRect = last$1(filter$4(caretPositions, isLine(0))); if (closestNextLineRect) { return renderRangeCaretOpt(editor, closestNextLineRect.position.toRange(), false); } } if (nextLinePositions.length === 0) { return getLineEndPoint(editor, forwards).filter(forwards ? isAfter2 : isBefore2).map(function(pos) { return renderRangeCaret(editor, pos.toRange(), false); }); } return Optional.none(); }; var getLineEndPoint = function(editor, forward) { var rng = editor.selection.getRng(); var body = editor.getBody(); if (forward) { var from3 = CaretPosition.fromRangeEnd(rng); var result = getPositionsUntilNextLine(body, from3); return last$2(result.positions); } else { var from3 = CaretPosition.fromRangeStart(rng); var result = getPositionsUntilPreviousLine(body, from3); return head(result.positions); } }; var moveToLineEndPoint$3 = function(editor, forward, isElementPosition) { return getLineEndPoint(editor, forward).filter(isElementPosition).exists(function(pos) { editor.selection.setRng(pos.toRange()); return true; }); }; var setCaretPosition = function(editor, pos) { var rng = editor.dom.createRng(); rng.setStart(pos.container(), pos.offset()); rng.setEnd(pos.container(), pos.offset()); editor.selection.setRng(rng); }; var setSelected = function(state, elm) { if (state) { elm.setAttribute("data-mce-selected", "inline-boundary"); } else { elm.removeAttribute("data-mce-selected"); } }; var renderCaretLocation = function(editor, caret, location) { return renderCaret(caret, location).map(function(pos) { setCaretPosition(editor, pos); return location; }); }; var findLocation = function(editor, caret, forward) { var rootNode = editor.getBody(); var from3 = CaretPosition.fromRangeStart(editor.selection.getRng()); var isInlineTarget$1 = curry(isInlineTarget, editor); var location = findLocation$1(forward, isInlineTarget$1, rootNode, from3); return location.bind(function(location2) { return renderCaretLocation(editor, caret, location2); }); }; var toggleInlines = function(isInlineTarget2, dom2, elms) { var inlineBoundaries = map$3(descendants(SugarElement.fromDom(dom2.getRoot()), '*[data-mce-selected="inline-boundary"]'), function(e2) { return e2.dom; }); var selectedInlines = filter$4(inlineBoundaries, isInlineTarget2); var targetInlines = filter$4(elms, isInlineTarget2); each$k(difference(selectedInlines, targetInlines), curry(setSelected, false)); each$k(difference(targetInlines, selectedInlines), curry(setSelected, true)); }; var safeRemoveCaretContainer = function(editor, caret) { if (editor.selection.isCollapsed() && editor.composing !== true && caret.get()) { var pos = CaretPosition.fromRangeStart(editor.selection.getRng()); if (CaretPosition.isTextPosition(pos) && isAtZwsp(pos) === false) { setCaretPosition(editor, removeAndReposition(caret.get(), pos)); caret.set(null); } } }; var renderInsideInlineCaret = function(isInlineTarget2, editor, caret, elms) { if (editor.selection.isCollapsed()) { var inlines = filter$4(elms, isInlineTarget2); each$k(inlines, function(_inline) { var pos = CaretPosition.fromRangeStart(editor.selection.getRng()); readLocation(isInlineTarget2, editor.getBody(), pos).bind(function(location) { return renderCaretLocation(editor, caret, location); }); }); } }; var move$2 = function(editor, caret, forward) { return isInlineBoundariesEnabled(editor) ? findLocation(editor, caret, forward).isSome() : false; }; var moveWord = function(forward, editor, _caret) { return isInlineBoundariesEnabled(editor) ? moveByWord(forward, editor) : false; }; var setupSelectedState = function(editor) { var caret = Cell3(null); var isInlineTarget$1 = curry(isInlineTarget, editor); editor.on("NodeChange", function(e2) { if (isInlineBoundariesEnabled(editor) && !(Env.browser.isIE() && e2.initial)) { toggleInlines(isInlineTarget$1, editor.dom, e2.parents); safeRemoveCaretContainer(editor, caret); renderInsideInlineCaret(isInlineTarget$1, editor, caret, e2.parents); } }); return caret; }; var moveNextWord = curry(moveWord, true); var movePrevWord = curry(moveWord, false); var moveToLineEndPoint$2 = function(editor, forward, caret) { if (isInlineBoundariesEnabled(editor)) { var linePoint = getLineEndPoint(editor, forward).getOrThunk(function() { var rng = editor.selection.getRng(); return forward ? CaretPosition.fromRangeEnd(rng) : CaretPosition.fromRangeStart(rng); }); return readLocation(curry(isInlineTarget, editor), editor.getBody(), linePoint).exists(function(loc) { var outsideLoc = outside(loc); return renderCaret(caret, outsideLoc).exists(function(pos) { setCaretPosition(editor, pos); return true; }); }); } else { return false; } }; var rangeFromPositions = function(from3, to3) { var range3 = document.createRange(); range3.setStart(from3.container(), from3.offset()); range3.setEnd(to3.container(), to3.offset()); return range3; }; var hasOnlyTwoOrLessPositionsLeft = function(elm) { return lift2(firstPositionIn(elm), lastPositionIn(elm), function(firstPos, lastPos) { var normalizedFirstPos = normalizePosition(true, firstPos); var normalizedLastPos = normalizePosition(false, lastPos); return nextPosition(elm, normalizedFirstPos).forall(function(pos) { return pos.isEqual(normalizedLastPos); }); }).getOr(true); }; var setCaretLocation = function(editor, caret) { return function(location) { return renderCaret(caret, location).exists(function(pos) { setCaretPosition(editor, pos); return true; }); }; }; var deleteFromTo = function(editor, caret, from3, to3) { var rootNode = editor.getBody(); var isInlineTarget$1 = curry(isInlineTarget, editor); editor.undoManager.ignore(function() { editor.selection.setRng(rangeFromPositions(from3, to3)); editor.execCommand("Delete"); readLocation(isInlineTarget$1, rootNode, CaretPosition.fromRangeStart(editor.selection.getRng())).map(inside).map(setCaretLocation(editor, caret)); }); editor.nodeChanged(); }; var rescope = function(rootNode, node) { var parentBlock = getParentBlock$2(node, rootNode); return parentBlock ? parentBlock : rootNode; }; var backspaceDeleteCollapsed = function(editor, caret, forward, from3) { var rootNode = rescope(editor.getBody(), from3.container()); var isInlineTarget$1 = curry(isInlineTarget, editor); var fromLocation = readLocation(isInlineTarget$1, rootNode, from3); return fromLocation.bind(function(location) { if (forward) { return location.fold(constant2(Optional.some(inside(location))), Optional.none, constant2(Optional.some(outside(location))), Optional.none); } else { return location.fold(Optional.none, constant2(Optional.some(outside(location))), Optional.none, constant2(Optional.some(inside(location)))); } }).map(setCaretLocation(editor, caret)).getOrThunk(function() { var toPosition = navigate(forward, rootNode, from3); var toLocation = toPosition.bind(function(pos) { return readLocation(isInlineTarget$1, rootNode, pos); }); return lift2(fromLocation, toLocation, function() { return findRootInline(isInlineTarget$1, rootNode, from3).exists(function(elm) { if (hasOnlyTwoOrLessPositionsLeft(elm)) { deleteElement$2(editor, forward, SugarElement.fromDom(elm)); return true; } else { return false; } }); }).orThunk(function() { return toLocation.bind(function(_2) { return toPosition.map(function(to3) { if (forward) { deleteFromTo(editor, caret, from3, to3); } else { deleteFromTo(editor, caret, to3, from3); } return true; }); }); }).getOr(false); }); }; var backspaceDelete$3 = function(editor, caret, forward) { if (editor.selection.isCollapsed() && isInlineBoundariesEnabled(editor)) { var from3 = CaretPosition.fromRangeStart(editor.selection.getRng()); return backspaceDeleteCollapsed(editor, caret, forward, from3); } return false; }; var getParentInlines = function(rootElm, startElm) { var parents2 = parentsAndSelf(startElm, rootElm); return findIndex$2(parents2, isBlock$2).fold(constant2(parents2), function(index2) { return parents2.slice(0, index2); }); }; var hasOnlyOneChild = function(elm) { return childNodesCount(elm) === 1; }; var deleteLastPosition = function(forward, editor, target, parentInlines) { var isFormatElement$1 = curry(isFormatElement, editor); var formatNodes = map$3(filter$4(parentInlines, isFormatElement$1), function(elm) { return elm.dom; }); if (formatNodes.length === 0) { deleteElement$2(editor, forward, target); } else { var pos = replaceWithCaretFormat(target.dom, formatNodes); editor.selection.setRng(pos.toRange()); } }; var deleteCaret$1 = function(editor, forward) { var rootElm = SugarElement.fromDom(editor.getBody()); var startElm = SugarElement.fromDom(editor.selection.getStart()); var parentInlines = filter$4(getParentInlines(rootElm, startElm), hasOnlyOneChild); return last$2(parentInlines).exists(function(target) { var fromPos = CaretPosition.fromRangeStart(editor.selection.getRng()); if (willDeleteLastPositionInElement(forward, fromPos, target.dom) && !isEmptyCaretFormatElement(target)) { deleteLastPosition(forward, editor, target, parentInlines); return true; } else { return false; } }); }; var backspaceDelete$2 = function(editor, forward) { return editor.selection.isCollapsed() ? deleteCaret$1(editor, forward) : false; }; var deleteElement = function(editor, forward, element) { editor._selectionOverrides.hideFakeCaret(); deleteElement$2(editor, forward, SugarElement.fromDom(element)); return true; }; var deleteCaret = function(editor, forward) { var isNearMedia = forward ? isBeforeMedia : isAfterMedia; var direction = forward ? HDirection.Forwards : HDirection.Backwards; var fromPos = getNormalizedRangeEndPoint(direction, editor.getBody(), editor.selection.getRng()); if (isNearMedia(fromPos)) { return deleteElement(editor, forward, fromPos.getNode(!forward)); } else { return Optional.from(normalizePosition(forward, fromPos)).filter(function(pos) { return isNearMedia(pos) && isMoveInsideSameBlock(fromPos, pos); }).exists(function(pos) { return deleteElement(editor, forward, pos.getNode(!forward)); }); } }; var deleteRange = function(editor, forward) { var selectedNode = editor.selection.getNode(); return isMedia$2(selectedNode) ? deleteElement(editor, forward, selectedNode) : false; }; var backspaceDelete$1 = function(editor, forward) { return editor.selection.isCollapsed() ? deleteCaret(editor, forward) : deleteRange(editor, forward); }; var isEditable = function(target) { return closest$3(target, function(elm) { return isContentEditableTrue$4(elm.dom) || isContentEditableFalse$b(elm.dom); }).exists(function(elm) { return isContentEditableTrue$4(elm.dom); }); }; var parseIndentValue = function(value25) { var number3 = parseInt(value25, 10); return isNaN(number3) ? 0 : number3; }; var getIndentStyleName = function(useMargin, element) { var indentStyleName = useMargin || isTable$2(element) ? "margin" : "padding"; var suffix = get$5(element, "direction") === "rtl" ? "-right" : "-left"; return indentStyleName + suffix; }; var indentElement = function(dom2, command, useMargin, value25, unit, element) { var indentStyleName = getIndentStyleName(useMargin, SugarElement.fromDom(element)); if (command === "outdent") { var styleValue = Math.max(0, parseIndentValue(element.style[indentStyleName]) - value25); dom2.setStyle(element, indentStyleName, styleValue ? styleValue + unit : ""); } else { var styleValue = parseIndentValue(element.style[indentStyleName]) + value25 + unit; dom2.setStyle(element, indentStyleName, styleValue); } }; var validateBlocks = function(editor, blocks2) { return forall(blocks2, function(block) { var indentStyleName = getIndentStyleName(shouldIndentUseMargin(editor), block); var intentValue = getRaw(block, indentStyleName).map(parseIndentValue).getOr(0); var contentEditable = editor.dom.getContentEditable(block.dom); return contentEditable !== "false" && intentValue > 0; }); }; var canOutdent = function(editor) { var blocks2 = getBlocksToIndent(editor); return !editor.mode.isReadOnly() && (blocks2.length > 1 || validateBlocks(editor, blocks2)); }; var isListComponent = function(el) { return isList(el) || isListItem(el); }; var parentIsListComponent = function(el) { return parent2(el).exists(isListComponent); }; var getBlocksToIndent = function(editor) { return filter$4(fromDom$1(editor.selection.getSelectedBlocks()), function(el) { return !isListComponent(el) && !parentIsListComponent(el) && isEditable(el); }); }; var handle = function(editor, command) { var dom2 = editor.dom, selection = editor.selection, formatter = editor.formatter; var indentation = getIndentation(editor); var indentUnit = /[a-z%]+$/i.exec(indentation)[0]; var indentValue = parseInt(indentation, 10); var useMargin = shouldIndentUseMargin(editor); var forcedRootBlock = getForcedRootBlock(editor); if (!editor.queryCommandState("InsertUnorderedList") && !editor.queryCommandState("InsertOrderedList")) { if (forcedRootBlock === "" && !dom2.getParent(selection.getNode(), dom2.isBlock)) { formatter.apply("div"); } } each$k(getBlocksToIndent(editor), function(block) { indentElement(dom2, command, useMargin, indentValue, indentUnit, block.dom); }); }; var backspaceDelete = function(editor, _forward) { if (editor.selection.isCollapsed() && canOutdent(editor)) { var dom2 = editor.dom; var rng = editor.selection.getRng(); var pos = CaretPosition.fromRangeStart(rng); var block = dom2.getParent(rng.startContainer, dom2.isBlock); if (block !== null && isAtStartOfBlock(SugarElement.fromDom(block), pos)) { handle(editor, "outdent"); return true; } } return false; }; var nativeCommand = function(editor, command) { editor.getDoc().execCommand(command, false, null); }; var deleteCommand = function(editor, caret) { if (backspaceDelete(editor)) { return; } else if (backspaceDelete$5(editor, false)) { return; } else if (backspaceDelete$6(editor, false)) { return; } else if (backspaceDelete$3(editor, caret, false)) { return; } else if (backspaceDelete$8(editor, false)) { return; } else if (backspaceDelete$9(editor)) { return; } else if (backspaceDelete$4(editor, false)) { return; } else if (backspaceDelete$1(editor, false)) { return; } else if (backspaceDelete$7(editor)) { return; } else if (backspaceDelete$2(editor, false)) { return; } else { nativeCommand(editor, "Delete"); paddEmptyBody(editor); } }; var forwardDeleteCommand = function(editor, caret) { if (backspaceDelete$5(editor, true)) { return; } else if (backspaceDelete$6(editor, true)) { return; } else if (backspaceDelete$3(editor, caret, true)) { return; } else if (backspaceDelete$8(editor, true)) { return; } else if (backspaceDelete$9(editor)) { return; } else if (backspaceDelete$4(editor, true)) { return; } else if (backspaceDelete$1(editor, true)) { return; } else if (backspaceDelete$7(editor)) { return; } else if (backspaceDelete$2(editor, true)) { return; } else { nativeCommand(editor, "ForwardDelete"); } }; var setup$f = function(editor, caret) { editor.addCommand("delete", function() { deleteCommand(editor, caret); }); editor.addCommand("forwardDelete", function() { forwardDeleteCommand(editor, caret); }); }; var SIGNIFICANT_MOVE = 5; var LONGPRESS_DELAY = 400; var getTouch = function(event) { if (event.touches === void 0 || event.touches.length !== 1) { return Optional.none(); } return Optional.some(event.touches[0]); }; var isFarEnough = function(touch, data66) { var distX = Math.abs(touch.clientX - data66.x); var distY = Math.abs(touch.clientY - data66.y); return distX > SIGNIFICANT_MOVE || distY > SIGNIFICANT_MOVE; }; var setup$e = function(editor) { var startData = value24(); var longpressFired = Cell3(false); var debounceLongpress = last2(function(e2) { editor.fire("longpress", __assign(__assign({}, e2), { type: "longpress" })); longpressFired.set(true); }, LONGPRESS_DELAY); editor.on("touchstart", function(e2) { getTouch(e2).each(function(touch) { debounceLongpress.cancel(); var data66 = { x: touch.clientX, y: touch.clientY, target: e2.target }; debounceLongpress.throttle(e2); longpressFired.set(false); startData.set(data66); }); }, true); editor.on("touchmove", function(e2) { debounceLongpress.cancel(); getTouch(e2).each(function(touch) { startData.on(function(data66) { if (isFarEnough(touch, data66)) { startData.clear(); longpressFired.set(false); editor.fire("longpresscancel"); } }); }); }, true); editor.on("touchend touchcancel", function(e2) { debounceLongpress.cancel(); if (e2.type === "touchcancel") { return; } startData.get().filter(function(data66) { return data66.target.isEqualNode(e2.target); }).each(function() { if (longpressFired.get()) { e2.preventDefault(); } else { editor.fire("tap", __assign(__assign({}, e2), { type: "tap" })); } }); }, true); }; var isBlockElement = function(blockElements, node) { return has$22(blockElements, node.nodeName); }; var isValidTarget = function(blockElements, node) { if (isText$7(node)) { return true; } else if (isElement$5(node)) { return !isBlockElement(blockElements, node) && !isBookmarkNode$1(node); } else { return false; } }; var hasBlockParent = function(blockElements, root2, node) { return exists(parents(SugarElement.fromDom(node), SugarElement.fromDom(root2)), function(elm) { return isBlockElement(blockElements, elm.dom); }); }; var shouldRemoveTextNode = function(blockElements, node) { if (isText$7(node)) { if (node.nodeValue.length === 0) { return true; } else if (/^\s+$/.test(node.nodeValue) && (!node.nextSibling || isBlockElement(blockElements, node.nextSibling))) { return true; } } return false; }; var addRootBlocks = function(editor) { var dom2 = editor.dom, selection = editor.selection; var schema2 = editor.schema, blockElements = schema2.getBlockElements(); var node = selection.getStart(); var rootNode = editor.getBody(); var rootBlockNode, tempNode, wrapped; var forcedRootBlock = getForcedRootBlock(editor); if (!node || !isElement$5(node) || !forcedRootBlock) { return; } var rootNodeName = rootNode.nodeName.toLowerCase(); if (!schema2.isValidChild(rootNodeName, forcedRootBlock.toLowerCase()) || hasBlockParent(blockElements, rootNode, node)) { return; } var rng = selection.getRng(); var startContainer = rng.startContainer; var startOffset = rng.startOffset; var endContainer = rng.endContainer; var endOffset = rng.endOffset; var restoreSelection = hasFocus(editor); node = rootNode.firstChild; while (node) { if (isValidTarget(blockElements, node)) { if (shouldRemoveTextNode(blockElements, node)) { tempNode = node; node = node.nextSibling; dom2.remove(tempNode); continue; } if (!rootBlockNode) { rootBlockNode = dom2.create(forcedRootBlock, getForcedRootBlockAttrs(editor)); node.parentNode.insertBefore(rootBlockNode, node); wrapped = true; } tempNode = node; node = node.nextSibling; rootBlockNode.appendChild(tempNode); } else { rootBlockNode = null; node = node.nextSibling; } } if (wrapped && restoreSelection) { rng.setStart(startContainer, startOffset); rng.setEnd(endContainer, endOffset); selection.setRng(rng); editor.nodeChanged(); } }; var setup$d = function(editor) { if (getForcedRootBlock(editor)) { editor.on("NodeChange", curry(addRootBlocks, editor)); } }; var findBlockCaretContainer = function(editor) { return descendant(SugarElement.fromDom(editor.getBody()), "*[data-mce-caret]").map(function(elm) { return elm.dom; }).getOrNull(); }; var removeIeControlRect = function(editor) { editor.selection.setRng(editor.selection.getRng()); }; var showBlockCaretContainer = function(editor, blockCaretContainer) { if (blockCaretContainer.hasAttribute("data-mce-caret")) { showCaretContainerBlock(blockCaretContainer); removeIeControlRect(editor); editor.selection.scrollIntoView(blockCaretContainer); } }; var handleBlockContainer = function(editor, e2) { var blockCaretContainer = findBlockCaretContainer(editor); if (!blockCaretContainer) { return; } if (e2.type === "compositionstart") { e2.preventDefault(); e2.stopPropagation(); showBlockCaretContainer(editor, blockCaretContainer); return; } if (hasContent(blockCaretContainer)) { showBlockCaretContainer(editor, blockCaretContainer); editor.undoManager.add(); } }; var setup$c = function(editor) { editor.on("keyup compositionstart", curry(handleBlockContainer, editor)); }; var isContentEditableFalse$2 = isContentEditableFalse$b; var moveToCeFalseHorizontally = function(direction, editor, range3) { return moveHorizontally(editor, direction, range3, isBeforeContentEditableFalse, isAfterContentEditableFalse, isContentEditableFalse$2); }; var moveToCeFalseVertically = function(direction, editor, range3) { var isBefore2 = function(caretPosition) { return isBeforeContentEditableFalse(caretPosition) || isBeforeTable(caretPosition); }; var isAfter2 = function(caretPosition) { return isAfterContentEditableFalse(caretPosition) || isAfterTable(caretPosition); }; return moveVertically(editor, direction, range3, isBefore2, isAfter2, isContentEditableFalse$2); }; var createTextBlock = function(editor) { var textBlock = editor.dom.create(getForcedRootBlock(editor)); if (!Env.ie || Env.ie >= 11) { textBlock.innerHTML = '
    '; } return textBlock; }; var exitPreBlock = function(editor, direction, range3) { var caretWalker = CaretWalker(editor.getBody()); var getVisualCaretPosition$1 = curry(getVisualCaretPosition, direction === 1 ? caretWalker.next : caretWalker.prev); if (range3.collapsed && hasForcedRootBlock(editor)) { var pre = editor.dom.getParent(range3.startContainer, "PRE"); if (!pre) { return; } var caretPos = getVisualCaretPosition$1(CaretPosition.fromRangeStart(range3)); if (!caretPos) { var newBlock = createTextBlock(editor); if (direction === 1) { editor.$(pre).after(newBlock); } else { editor.$(pre).before(newBlock); } editor.selection.select(newBlock, true); editor.selection.collapse(); } } }; var getHorizontalRange = function(editor, forward) { var direction = forward ? HDirection.Forwards : HDirection.Backwards; var range3 = editor.selection.getRng(); return moveToCeFalseHorizontally(direction, editor, range3).orThunk(function() { exitPreBlock(editor, direction, range3); return Optional.none(); }); }; var getVerticalRange = function(editor, down2) { var direction = down2 ? 1 : -1; var range3 = editor.selection.getRng(); return moveToCeFalseVertically(direction, editor, range3).orThunk(function() { exitPreBlock(editor, direction, range3); return Optional.none(); }); }; var moveH$2 = function(editor, forward) { return getHorizontalRange(editor, forward).exists(function(newRange) { moveToRange(editor, newRange); return true; }); }; var moveV$3 = function(editor, down2) { return getVerticalRange(editor, down2).exists(function(newRange) { moveToRange(editor, newRange); return true; }); }; var moveToLineEndPoint$1 = function(editor, forward) { var isCefPosition = forward ? isAfterContentEditableFalse : isBeforeContentEditableFalse; return moveToLineEndPoint$3(editor, forward, isCefPosition); }; var isTarget = function(node) { return contains$3(["figcaption"], name(node)); }; var rangeBefore = function(target) { var rng = document.createRange(); rng.setStartBefore(target.dom); rng.setEndBefore(target.dom); return rng; }; var insertElement = function(root2, elm, forward) { if (forward) { append$1(root2, elm); } else { prepend(root2, elm); } }; var insertBr = function(root2, forward) { var br = SugarElement.fromTag("br"); insertElement(root2, br, forward); return rangeBefore(br); }; var insertBlock = function(root2, forward, blockName, attrs) { var block = SugarElement.fromTag(blockName); var br = SugarElement.fromTag("br"); setAll$1(block, attrs); append$1(block, br); insertElement(root2, block, forward); return rangeBefore(br); }; var insertEmptyLine = function(root2, rootBlockName, attrs, forward) { if (rootBlockName === "") { return insertBr(root2, forward); } else { return insertBlock(root2, forward, rootBlockName, attrs); } }; var getClosestTargetBlock = function(pos, root2) { var isRoot = curry(eq2, root2); return closest$3(SugarElement.fromDom(pos.container()), isBlock$2, isRoot).filter(isTarget); }; var isAtFirstOrLastLine = function(root2, forward, pos) { return forward ? isAtLastLine(root2.dom, pos) : isAtFirstLine(root2.dom, pos); }; var moveCaretToNewEmptyLine = function(editor, forward) { var root2 = SugarElement.fromDom(editor.getBody()); var pos = CaretPosition.fromRangeStart(editor.selection.getRng()); var rootBlock = getForcedRootBlock(editor); var rootBlockAttrs = getForcedRootBlockAttrs(editor); return getClosestTargetBlock(pos, root2).exists(function() { if (isAtFirstOrLastLine(root2, forward, pos)) { var rng = insertEmptyLine(root2, rootBlock, rootBlockAttrs, forward); editor.selection.setRng(rng); return true; } else { return false; } }); }; var moveV$2 = function(editor, forward) { if (editor.selection.isCollapsed()) { return moveCaretToNewEmptyLine(editor, forward); } else { return false; } }; var defaultPatterns = function(patterns) { return map$3(patterns, function(pattern2) { return __assign({ shiftKey: false, altKey: false, ctrlKey: false, metaKey: false, keyCode: 0, action: noop2 }, pattern2); }); }; var matchesEvent = function(pattern2, evt) { return evt.keyCode === pattern2.keyCode && evt.shiftKey === pattern2.shiftKey && evt.altKey === pattern2.altKey && evt.ctrlKey === pattern2.ctrlKey && evt.metaKey === pattern2.metaKey; }; var match$12 = function(patterns, evt) { return bind4(defaultPatterns(patterns), function(pattern2) { return matchesEvent(pattern2, evt) ? [pattern2] : []; }); }; var action = function(f2) { var x2 = []; for (var _i = 1; _i < arguments.length; _i++) { x2[_i - 1] = arguments[_i]; } return function() { return f2.apply(null, x2); }; }; var execute = function(patterns, evt) { return find$3(match$12(patterns, evt), function(pattern2) { return pattern2.action(); }); }; var moveH$1 = function(editor, forward) { var direction = forward ? HDirection.Forwards : HDirection.Backwards; var range3 = editor.selection.getRng(); return moveHorizontally(editor, direction, range3, isBeforeMedia, isAfterMedia, isMedia$2).exists(function(newRange) { moveToRange(editor, newRange); return true; }); }; var moveV$1 = function(editor, down2) { var direction = down2 ? 1 : -1; var range3 = editor.selection.getRng(); return moveVertically(editor, direction, range3, isBeforeMedia, isAfterMedia, isMedia$2).exists(function(newRange) { moveToRange(editor, newRange); return true; }); }; var moveToLineEndPoint = function(editor, forward) { var isNearMedia = forward ? isAfterMedia : isBeforeMedia; return moveToLineEndPoint$3(editor, forward, isNearMedia); }; var deflate = function(rect, delta) { return { left: rect.left - delta, top: rect.top - delta, right: rect.right + delta * 2, bottom: rect.bottom + delta * 2, width: rect.width + delta, height: rect.height + delta }; }; var getCorners = function(getYAxisValue, tds) { return bind4(tds, function(td) { var rect = deflate(clone4(td.getBoundingClientRect()), -1); return [ { x: rect.left, y: getYAxisValue(rect), cell: td }, { x: rect.right, y: getYAxisValue(rect), cell: td } ]; }); }; var findClosestCorner = function(corners, x2, y2) { return foldl(corners, function(acc, newCorner) { return acc.fold(function() { return Optional.some(newCorner); }, function(oldCorner) { var oldDist = Math.sqrt(Math.abs(oldCorner.x - x2) + Math.abs(oldCorner.y - y2)); var newDist = Math.sqrt(Math.abs(newCorner.x - x2) + Math.abs(newCorner.y - y2)); return Optional.some(newDist < oldDist ? newCorner : oldCorner); }); }, Optional.none()); }; var getClosestCell = function(getYAxisValue, isTargetCorner, table2, x2, y2) { var cells = descendants(SugarElement.fromDom(table2), "td,th,caption").map(function(e2) { return e2.dom; }); var corners = filter$4(getCorners(getYAxisValue, cells), function(corner) { return isTargetCorner(corner, y2); }); return findClosestCorner(corners, x2, y2).map(function(corner) { return corner.cell; }); }; var getBottomValue = function(rect) { return rect.bottom; }; var getTopValue = function(rect) { return rect.top; }; var isAbove = function(corner, y2) { return corner.y < y2; }; var isBelow = function(corner, y2) { return corner.y > y2; }; var getClosestCellAbove = curry(getClosestCell, getBottomValue, isAbove); var getClosestCellBelow = curry(getClosestCell, getTopValue, isBelow); var findClosestPositionInAboveCell = function(table2, pos) { return head(pos.getClientRects()).bind(function(rect) { return getClosestCellAbove(table2, rect.left, rect.top); }).bind(function(cell) { return findClosestHorizontalPosition(getLastLinePositions(cell), pos); }); }; var findClosestPositionInBelowCell = function(table2, pos) { return last$2(pos.getClientRects()).bind(function(rect) { return getClosestCellBelow(table2, rect.left, rect.top); }).bind(function(cell) { return findClosestHorizontalPosition(getFirstLinePositions(cell), pos); }); }; var hasNextBreak = function(getPositionsUntil2, scope, lineInfo) { return lineInfo.breakAt.exists(function(breakPos) { return getPositionsUntil2(scope, breakPos).breakAt.isSome(); }); }; var startsWithWrapBreak = function(lineInfo) { return lineInfo.breakType === BreakType.Wrap && lineInfo.positions.length === 0; }; var startsWithBrBreak = function(lineInfo) { return lineInfo.breakType === BreakType.Br && lineInfo.positions.length === 1; }; var isAtTableCellLine = function(getPositionsUntil2, scope, pos) { var lineInfo = getPositionsUntil2(scope, pos); if (startsWithWrapBreak(lineInfo) || !isBr$5(pos.getNode()) && startsWithBrBreak(lineInfo)) { return !hasNextBreak(getPositionsUntil2, scope, lineInfo); } else { return lineInfo.breakAt.isNone(); } }; var isAtFirstTableCellLine = curry(isAtTableCellLine, getPositionsUntilPreviousLine); var isAtLastTableCellLine = curry(isAtTableCellLine, getPositionsUntilNextLine); var isCaretAtStartOrEndOfTable = function(forward, rng, table2) { var caretPos = CaretPosition.fromRangeStart(rng); return positionIn(!forward, table2).exists(function(pos) { return pos.isEqual(caretPos); }); }; var navigateHorizontally = function(editor, forward, table2, _td) { var rng = editor.selection.getRng(); var direction = forward ? 1 : -1; if (isFakeCaretTableBrowser() && isCaretAtStartOrEndOfTable(forward, rng, table2)) { showCaret(direction, editor, table2, !forward, false).each(function(newRng) { moveToRange(editor, newRng); }); return true; } return false; }; var getClosestAbovePosition = function(root2, table2, start2) { return findClosestPositionInAboveCell(table2, start2).orThunk(function() { return head(start2.getClientRects()).bind(function(rect) { return findClosestHorizontalPositionFromPoint(getPositionsAbove(root2, CaretPosition.before(table2)), rect.left); }); }).getOr(CaretPosition.before(table2)); }; var getClosestBelowPosition = function(root2, table2, start2) { return findClosestPositionInBelowCell(table2, start2).orThunk(function() { return head(start2.getClientRects()).bind(function(rect) { return findClosestHorizontalPositionFromPoint(getPositionsBelow(root2, CaretPosition.after(table2)), rect.left); }); }).getOr(CaretPosition.after(table2)); }; var getTable = function(previous, pos) { var node = pos.getNode(previous); return isElement$5(node) && node.nodeName === "TABLE" ? Optional.some(node) : Optional.none(); }; var renderBlock = function(down2, editor, table2, pos) { var forcedRootBlock = getForcedRootBlock(editor); if (forcedRootBlock) { editor.undoManager.transact(function() { var element = SugarElement.fromTag(forcedRootBlock); setAll$1(element, getForcedRootBlockAttrs(editor)); append$1(element, SugarElement.fromTag("br")); if (down2) { after$3(SugarElement.fromDom(table2), element); } else { before$4(SugarElement.fromDom(table2), element); } var rng = editor.dom.createRng(); rng.setStart(element.dom, 0); rng.setEnd(element.dom, 0); moveToRange(editor, rng); }); } else { moveToRange(editor, pos.toRange()); } }; var moveCaret = function(editor, down2, pos) { var table2 = down2 ? getTable(true, pos) : getTable(false, pos); var last3 = down2 === false; table2.fold(function() { return moveToRange(editor, pos.toRange()); }, function(table3) { return positionIn(last3, editor.getBody()).filter(function(lastPos) { return lastPos.isEqual(pos); }).fold(function() { return moveToRange(editor, pos.toRange()); }, function(_2) { return renderBlock(down2, editor, table3, pos); }); }); }; var navigateVertically = function(editor, down2, table2, td) { var rng = editor.selection.getRng(); var pos = CaretPosition.fromRangeStart(rng); var root2 = editor.getBody(); if (!down2 && isAtFirstTableCellLine(td, pos)) { var newPos = getClosestAbovePosition(root2, table2, pos); moveCaret(editor, down2, newPos); return true; } else if (down2 && isAtLastTableCellLine(td, pos)) { var newPos = getClosestBelowPosition(root2, table2, pos); moveCaret(editor, down2, newPos); return true; } else { return false; } }; var move$1 = function(editor, forward, mover) { return Optional.from(editor.dom.getParent(editor.selection.getNode(), "td,th")).bind(function(td) { return Optional.from(editor.dom.getParent(td, "table")).map(function(table2) { return mover(editor, forward, table2, td); }); }).getOr(false); }; var moveH = function(editor, forward) { return move$1(editor, forward, navigateHorizontally); }; var moveV = function(editor, forward) { return move$1(editor, forward, navigateVertically); }; var executeKeydownOverride$3 = function(editor, caret, evt) { var os2 = detect().os; execute([ { keyCode: VK.RIGHT, action: action(moveH$2, editor, true) }, { keyCode: VK.LEFT, action: action(moveH$2, editor, false) }, { keyCode: VK.UP, action: action(moveV$3, editor, false) }, { keyCode: VK.DOWN, action: action(moveV$3, editor, true) }, { keyCode: VK.RIGHT, action: action(moveH, editor, true) }, { keyCode: VK.LEFT, action: action(moveH, editor, false) }, { keyCode: VK.UP, action: action(moveV, editor, false) }, { keyCode: VK.DOWN, action: action(moveV, editor, true) }, { keyCode: VK.RIGHT, action: action(moveH$1, editor, true) }, { keyCode: VK.LEFT, action: action(moveH$1, editor, false) }, { keyCode: VK.UP, action: action(moveV$1, editor, false) }, { keyCode: VK.DOWN, action: action(moveV$1, editor, true) }, { keyCode: VK.RIGHT, action: action(move$2, editor, caret, true) }, { keyCode: VK.LEFT, action: action(move$2, editor, caret, false) }, { keyCode: VK.RIGHT, ctrlKey: !os2.isOSX(), altKey: os2.isOSX(), action: action(moveNextWord, editor, caret) }, { keyCode: VK.LEFT, ctrlKey: !os2.isOSX(), altKey: os2.isOSX(), action: action(movePrevWord, editor, caret) }, { keyCode: VK.UP, action: action(moveV$2, editor, false) }, { keyCode: VK.DOWN, action: action(moveV$2, editor, true) } ], evt).each(function(_2) { evt.preventDefault(); }); }; var setup$b = function(editor, caret) { editor.on("keydown", function(evt) { if (evt.isDefaultPrevented() === false) { executeKeydownOverride$3(editor, caret, evt); } }); }; var executeKeydownOverride$2 = function(editor, caret, evt) { execute([ { keyCode: VK.BACKSPACE, action: action(backspaceDelete, editor, false) }, { keyCode: VK.BACKSPACE, action: action(backspaceDelete$5, editor, false) }, { keyCode: VK.DELETE, action: action(backspaceDelete$5, editor, true) }, { keyCode: VK.BACKSPACE, action: action(backspaceDelete$6, editor, false) }, { keyCode: VK.DELETE, action: action(backspaceDelete$6, editor, true) }, { keyCode: VK.BACKSPACE, action: action(backspaceDelete$3, editor, caret, false) }, { keyCode: VK.DELETE, action: action(backspaceDelete$3, editor, caret, true) }, { keyCode: VK.BACKSPACE, action: action(backspaceDelete$9, editor, false) }, { keyCode: VK.DELETE, action: action(backspaceDelete$9, editor, true) }, { keyCode: VK.BACKSPACE, action: action(backspaceDelete$4, editor, false) }, { keyCode: VK.DELETE, action: action(backspaceDelete$4, editor, true) }, { keyCode: VK.BACKSPACE, action: action(backspaceDelete$1, editor, false) }, { keyCode: VK.DELETE, action: action(backspaceDelete$1, editor, true) }, { keyCode: VK.BACKSPACE, action: action(backspaceDelete$7, editor, false) }, { keyCode: VK.DELETE, action: action(backspaceDelete$7, editor, true) }, { keyCode: VK.BACKSPACE, action: action(backspaceDelete$8, editor, false) }, { keyCode: VK.DELETE, action: action(backspaceDelete$8, editor, true) }, { keyCode: VK.BACKSPACE, action: action(backspaceDelete$2, editor, false) }, { keyCode: VK.DELETE, action: action(backspaceDelete$2, editor, true) } ], evt).each(function(_2) { evt.preventDefault(); }); }; var executeKeyupOverride = function(editor, evt) { execute([ { keyCode: VK.BACKSPACE, action: action(paddEmptyElement, editor) }, { keyCode: VK.DELETE, action: action(paddEmptyElement, editor) } ], evt); }; var setup$a = function(editor, caret) { editor.on("keydown", function(evt) { if (evt.isDefaultPrevented() === false) { executeKeydownOverride$2(editor, caret, evt); } }); editor.on("keyup", function(evt) { if (evt.isDefaultPrevented() === false) { executeKeyupOverride(editor, evt); } }); }; var firstNonWhiteSpaceNodeSibling = function(node) { while (node) { if (node.nodeType === 1 || node.nodeType === 3 && node.data && /[\r\n\s]/.test(node.data)) { return node; } node = node.nextSibling; } }; var moveToCaretPosition = function(editor, root2) { var node, lastNode = root2; var dom2 = editor.dom; var moveCaretBeforeOnEnterElementsMap = editor.schema.getMoveCaretBeforeOnEnterElements(); if (!root2) { return; } if (/^(LI|DT|DD)$/.test(root2.nodeName)) { var firstChild2 = firstNonWhiteSpaceNodeSibling(root2.firstChild); if (firstChild2 && /^(UL|OL|DL)$/.test(firstChild2.nodeName)) { root2.insertBefore(dom2.doc.createTextNode(nbsp), root2.firstChild); } } var rng = dom2.createRng(); root2.normalize(); if (root2.hasChildNodes()) { var walker = new DomTreeWalker(root2, root2); while (node = walker.current()) { if (isText$7(node)) { rng.setStart(node, 0); rng.setEnd(node, 0); break; } if (moveCaretBeforeOnEnterElementsMap[node.nodeName.toLowerCase()]) { rng.setStartBefore(node); rng.setEndBefore(node); break; } lastNode = node; node = walker.next(); } if (!node) { rng.setStart(lastNode, 0); rng.setEnd(lastNode, 0); } } else { if (isBr$5(root2)) { if (root2.nextSibling && dom2.isBlock(root2.nextSibling)) { rng.setStartBefore(root2); rng.setEndBefore(root2); } else { rng.setStartAfter(root2); rng.setEndAfter(root2); } } else { rng.setStart(root2, 0); rng.setEnd(root2, 0); } } editor.selection.setRng(rng); scrollRangeIntoView(editor, rng); }; var getEditableRoot$1 = function(dom2, node) { var root2 = dom2.getRoot(); var parent3, editableRoot; parent3 = node; while (parent3 !== root2 && dom2.getContentEditable(parent3) !== "false") { if (dom2.getContentEditable(parent3) === "true") { editableRoot = parent3; } parent3 = parent3.parentNode; } return parent3 !== root2 ? editableRoot : root2; }; var getParentBlock = function(editor) { return Optional.from(editor.dom.getParent(editor.selection.getStart(true), editor.dom.isBlock)); }; var getParentBlockName = function(editor) { return getParentBlock(editor).fold(constant2(""), function(parentBlock) { return parentBlock.nodeName.toUpperCase(); }); }; var isListItemParentBlock = function(editor) { return getParentBlock(editor).filter(function(elm) { return isListItem(SugarElement.fromDom(elm)); }).isSome(); }; var hasFirstChild = function(elm, name2) { return elm.firstChild && elm.firstChild.nodeName === name2; }; var isFirstChild = function(elm) { var _a3; return ((_a3 = elm.parentNode) === null || _a3 === void 0 ? void 0 : _a3.firstChild) === elm; }; var hasParent = function(elm, parentName) { return elm && elm.parentNode && elm.parentNode.nodeName === parentName; }; var isListBlock = function(elm) { return elm && /^(OL|UL|LI)$/.test(elm.nodeName); }; var isNestedList = function(elm) { return isListBlock(elm) && isListBlock(elm.parentNode); }; var getContainerBlock = function(containerBlock) { var containerBlockParent = containerBlock.parentNode; if (/^(LI|DT|DD)$/.test(containerBlockParent.nodeName)) { return containerBlockParent; } return containerBlock; }; var isFirstOrLastLi = function(containerBlock, parentBlock, first2) { var node = containerBlock[first2 ? "firstChild" : "lastChild"]; while (node) { if (isElement$5(node)) { break; } node = node[first2 ? "nextSibling" : "previousSibling"]; } return node === parentBlock; }; var insert$3 = function(editor, createNewBlock, containerBlock, parentBlock, newBlockName) { var dom2 = editor.dom; var rng = editor.selection.getRng(); if (containerBlock === editor.getBody()) { return; } if (isNestedList(containerBlock)) { newBlockName = "LI"; } var newBlock = newBlockName ? createNewBlock(newBlockName) : dom2.create("BR"); if (isFirstOrLastLi(containerBlock, parentBlock, true) && isFirstOrLastLi(containerBlock, parentBlock, false)) { if (hasParent(containerBlock, "LI")) { var containerBlockParent = getContainerBlock(containerBlock); dom2.insertAfter(newBlock, containerBlockParent); if (isFirstChild(containerBlock)) { dom2.remove(containerBlockParent); } else { dom2.remove(containerBlock); } } else { dom2.replace(newBlock, containerBlock); } } else if (isFirstOrLastLi(containerBlock, parentBlock, true)) { if (hasParent(containerBlock, "LI")) { dom2.insertAfter(newBlock, getContainerBlock(containerBlock)); newBlock.appendChild(dom2.doc.createTextNode(" ")); newBlock.appendChild(containerBlock); } else { containerBlock.parentNode.insertBefore(newBlock, containerBlock); } dom2.remove(parentBlock); } else if (isFirstOrLastLi(containerBlock, parentBlock, false)) { dom2.insertAfter(newBlock, getContainerBlock(containerBlock)); dom2.remove(parentBlock); } else { containerBlock = getContainerBlock(containerBlock); var tmpRng = rng.cloneRange(); tmpRng.setStartAfter(parentBlock); tmpRng.setEndAfter(containerBlock); var fragment = tmpRng.extractContents(); if (newBlockName === "LI" && hasFirstChild(fragment, "LI")) { newBlock = fragment.firstChild; dom2.insertAfter(fragment, containerBlock); } else { dom2.insertAfter(fragment, containerBlock); dom2.insertAfter(newBlock, containerBlock); } dom2.remove(parentBlock); } moveToCaretPosition(editor, newBlock); }; var trimZwsp = function(fragment) { each$k(descendants$1(SugarElement.fromDom(fragment), isText$8), function(text) { var rawNode = text.dom; rawNode.nodeValue = trim$2(rawNode.nodeValue); }); }; var isEmptyAnchor = function(dom2, elm) { return elm && elm.nodeName === "A" && dom2.isEmpty(elm); }; var isTableCell = function(node) { return node && /^(TD|TH|CAPTION)$/.test(node.nodeName); }; var emptyBlock = function(elm) { elm.innerHTML = '
    '; }; var containerAndSiblingName = function(container, nodeName) { return container.nodeName === nodeName || container.previousSibling && container.previousSibling.nodeName === nodeName; }; var canSplitBlock = function(dom2, node) { return node && dom2.isBlock(node) && !/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) && !/^(fixed|absolute)/i.test(node.style.position) && dom2.getContentEditable(node) !== "true"; }; var trimInlineElementsOnLeftSideOfBlock = function(dom2, nonEmptyElementsMap, block) { var node = block; var firstChilds = []; var i2; if (!node) { return; } while (node = node.firstChild) { if (dom2.isBlock(node)) { return; } if (isElement$5(node) && !nonEmptyElementsMap[node.nodeName.toLowerCase()]) { firstChilds.push(node); } } i2 = firstChilds.length; while (i2--) { node = firstChilds[i2]; if (!node.hasChildNodes() || node.firstChild === node.lastChild && node.firstChild.nodeValue === "") { dom2.remove(node); } else { if (isEmptyAnchor(dom2, node)) { dom2.remove(node); } } } }; var normalizeZwspOffset = function(start2, container, offset4) { if (isText$7(container) === false) { return offset4; } else if (start2) { return offset4 === 1 && container.data.charAt(offset4 - 1) === ZWSP$1 ? 0 : offset4; } else { return offset4 === container.data.length - 1 && container.data.charAt(offset4) === ZWSP$1 ? container.data.length : offset4; } }; var includeZwspInRange = function(rng) { var newRng = rng.cloneRange(); newRng.setStart(rng.startContainer, normalizeZwspOffset(true, rng.startContainer, rng.startOffset)); newRng.setEnd(rng.endContainer, normalizeZwspOffset(false, rng.endContainer, rng.endOffset)); return newRng; }; var trimLeadingLineBreaks = function(node) { do { if (isText$7(node)) { node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, ""); } node = node.firstChild; } while (node); }; var getEditableRoot = function(dom2, node) { var root2 = dom2.getRoot(); var parent3, editableRoot; parent3 = node; while (parent3 !== root2 && dom2.getContentEditable(parent3) !== "false") { if (dom2.getContentEditable(parent3) === "true") { editableRoot = parent3; } parent3 = parent3.parentNode; } return parent3 !== root2 ? editableRoot : root2; }; var applyAttributes = function(editor, node, forcedRootBlockAttrs) { var dom2 = editor.dom; Optional.from(forcedRootBlockAttrs.style).map(dom2.parseStyle).each(function(attrStyles) { var currentStyles = getAllRaw(SugarElement.fromDom(node)); var newStyles = __assign(__assign({}, currentStyles), attrStyles); dom2.setStyles(node, newStyles); }); var attrClassesOpt = Optional.from(forcedRootBlockAttrs.class).map(function(attrClasses) { return attrClasses.split(/\s+/); }); var currentClassesOpt = Optional.from(node.className).map(function(currentClasses) { return filter$4(currentClasses.split(/\s+/), function(clazz) { return clazz !== ""; }); }); lift2(attrClassesOpt, currentClassesOpt, function(attrClasses, currentClasses) { var filteredClasses = filter$4(currentClasses, function(clazz) { return !contains$3(attrClasses, clazz); }); var newClasses = __spreadArray(__spreadArray([], attrClasses, true), filteredClasses, true); dom2.setAttrib(node, "class", newClasses.join(" ")); }); var appliedAttrs = [ "style", "class" ]; var remainingAttrs = filter$3(forcedRootBlockAttrs, function(_2, attrs) { return !contains$3(appliedAttrs, attrs); }); dom2.setAttribs(node, remainingAttrs); }; var setForcedBlockAttrs = function(editor, node) { var forcedRootBlockName = getForcedRootBlock(editor); if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) { var forcedRootBlockAttrs = getForcedRootBlockAttrs(editor); applyAttributes(editor, node, forcedRootBlockAttrs); } }; var wrapSelfAndSiblingsInDefaultBlock = function(editor, newBlockName, rng, container, offset4) { var newBlock, parentBlock, startNode, node, next2, rootBlockName; var blockName = newBlockName || "P"; var dom2 = editor.dom, editableRoot = getEditableRoot(dom2, container); parentBlock = dom2.getParent(container, dom2.isBlock); if (!parentBlock || !canSplitBlock(dom2, parentBlock)) { parentBlock = parentBlock || editableRoot; if (parentBlock === editor.getBody() || isTableCell(parentBlock)) { rootBlockName = parentBlock.nodeName.toLowerCase(); } else { rootBlockName = parentBlock.parentNode.nodeName.toLowerCase(); } if (!parentBlock.hasChildNodes()) { newBlock = dom2.create(blockName); setForcedBlockAttrs(editor, newBlock); parentBlock.appendChild(newBlock); rng.setStart(newBlock, 0); rng.setEnd(newBlock, 0); return newBlock; } node = container; while (node.parentNode !== parentBlock) { node = node.parentNode; } while (node && !dom2.isBlock(node)) { startNode = node; node = node.previousSibling; } if (startNode && editor.schema.isValidChild(rootBlockName, blockName.toLowerCase())) { newBlock = dom2.create(blockName); setForcedBlockAttrs(editor, newBlock); startNode.parentNode.insertBefore(newBlock, startNode); node = startNode; while (node && !dom2.isBlock(node)) { next2 = node.nextSibling; newBlock.appendChild(node); node = next2; } rng.setStart(container, offset4); rng.setEnd(container, offset4); } } return container; }; var addBrToBlockIfNeeded = function(dom2, block) { block.normalize(); var lastChild2 = block.lastChild; if (!lastChild2 || /^(left|right)$/gi.test(dom2.getStyle(lastChild2, "float", true))) { dom2.add(block, "br"); } }; var insert$2 = function(editor, evt) { var tmpRng, container, offset4, parentBlock; var newBlock, fragment, containerBlock, parentBlockName, newBlockName, isAfterLastNodeInContainer; var dom2 = editor.dom; var schema2 = editor.schema, nonEmptyElementsMap = schema2.getNonEmptyElements(); var rng = editor.selection.getRng(); var createNewBlock = function(name2) { var node = container, block, clonedNode, caretNode; var textInlineElements = schema2.getTextInlineElements(); if (name2 || parentBlockName === "TABLE" || parentBlockName === "HR") { block = dom2.create(name2 || newBlockName); } else { block = parentBlock.cloneNode(false); } caretNode = block; if (shouldKeepStyles(editor) === false) { dom2.setAttrib(block, "style", null); dom2.setAttrib(block, "class", null); } else { do { if (textInlineElements[node.nodeName]) { if (isCaretNode(node) || isBookmarkNode$1(node)) { continue; } clonedNode = node.cloneNode(false); dom2.setAttrib(clonedNode, "id", ""); if (block.hasChildNodes()) { clonedNode.appendChild(block.firstChild); block.appendChild(clonedNode); } else { caretNode = clonedNode; block.appendChild(clonedNode); } } } while ((node = node.parentNode) && node !== editableRoot); } setForcedBlockAttrs(editor, block); emptyBlock(caretNode); return block; }; var isCaretAtStartOrEndOfBlock = function(start2) { var node, name2; var normalizedOffset = normalizeZwspOffset(start2, container, offset4); if (isText$7(container) && (start2 ? normalizedOffset > 0 : normalizedOffset < container.nodeValue.length)) { return false; } if (container.parentNode === parentBlock && isAfterLastNodeInContainer && !start2) { return true; } if (start2 && isElement$5(container) && container === parentBlock.firstChild) { return true; } if (containerAndSiblingName(container, "TABLE") || containerAndSiblingName(container, "HR")) { return isAfterLastNodeInContainer && !start2 || !isAfterLastNodeInContainer && start2; } var walker = new DomTreeWalker(container, parentBlock); if (isText$7(container)) { if (start2 && normalizedOffset === 0) { walker.prev(); } else if (!start2 && normalizedOffset === container.nodeValue.length) { walker.next(); } } while (node = walker.current()) { if (isElement$5(node)) { if (!node.getAttribute("data-mce-bogus")) { name2 = node.nodeName.toLowerCase(); if (nonEmptyElementsMap[name2] && name2 !== "br") { return false; } } } else if (isText$7(node) && !isWhitespaceText(node.nodeValue)) { return false; } if (start2) { walker.prev(); } else { walker.next(); } } return true; }; var insertNewBlockAfter = function() { if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName !== "HGROUP") { newBlock = createNewBlock(newBlockName); } else { newBlock = createNewBlock(); } if (shouldEndContainerOnEmptyBlock(editor) && canSplitBlock(dom2, containerBlock) && dom2.isEmpty(parentBlock)) { newBlock = dom2.split(containerBlock, parentBlock); } else { dom2.insertAfter(newBlock, parentBlock); } moveToCaretPosition(editor, newBlock); }; normalize$2(dom2, rng).each(function(normRng) { rng.setStart(normRng.startContainer, normRng.startOffset); rng.setEnd(normRng.endContainer, normRng.endOffset); }); container = rng.startContainer; offset4 = rng.startOffset; newBlockName = getForcedRootBlock(editor); var shiftKey = !!(evt && evt.shiftKey); var ctrlKey = !!(evt && evt.ctrlKey); if (isElement$5(container) && container.hasChildNodes()) { isAfterLastNodeInContainer = offset4 > container.childNodes.length - 1; container = container.childNodes[Math.min(offset4, container.childNodes.length - 1)] || container; if (isAfterLastNodeInContainer && isText$7(container)) { offset4 = container.nodeValue.length; } else { offset4 = 0; } } var editableRoot = getEditableRoot(dom2, container); if (!editableRoot) { return; } if (newBlockName && !shiftKey || !newBlockName && shiftKey) { container = wrapSelfAndSiblingsInDefaultBlock(editor, newBlockName, rng, container, offset4); } parentBlock = dom2.getParent(container, dom2.isBlock); containerBlock = parentBlock ? dom2.getParent(parentBlock.parentNode, dom2.isBlock) : null; parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ""; var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ""; if (containerBlockName === "LI" && !ctrlKey) { parentBlock = containerBlock; containerBlock = containerBlock.parentNode; parentBlockName = containerBlockName; } if (/^(LI|DT|DD)$/.test(parentBlockName)) { if (dom2.isEmpty(parentBlock)) { insert$3(editor, createNewBlock, containerBlock, parentBlock, newBlockName); return; } } if (newBlockName && parentBlock === editor.getBody()) { return; } newBlockName = newBlockName || "P"; if (isCaretContainerBlock$1(parentBlock)) { newBlock = showCaretContainerBlock(parentBlock); if (dom2.isEmpty(parentBlock)) { emptyBlock(parentBlock); } setForcedBlockAttrs(editor, newBlock); moveToCaretPosition(editor, newBlock); } else if (isCaretAtStartOrEndOfBlock()) { insertNewBlockAfter(); } else if (isCaretAtStartOrEndOfBlock(true)) { newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock); moveToCaretPosition(editor, containerAndSiblingName(parentBlock, "HR") ? newBlock : parentBlock); } else { tmpRng = includeZwspInRange(rng).cloneRange(); tmpRng.setEndAfter(parentBlock); fragment = tmpRng.extractContents(); trimZwsp(fragment); trimLeadingLineBreaks(fragment); newBlock = fragment.firstChild; dom2.insertAfter(fragment, parentBlock); trimInlineElementsOnLeftSideOfBlock(dom2, nonEmptyElementsMap, newBlock); addBrToBlockIfNeeded(dom2, parentBlock); if (dom2.isEmpty(parentBlock)) { emptyBlock(parentBlock); } newBlock.normalize(); if (dom2.isEmpty(newBlock)) { dom2.remove(newBlock); insertNewBlockAfter(); } else { setForcedBlockAttrs(editor, newBlock); moveToCaretPosition(editor, newBlock); } } dom2.setAttrib(newBlock, "id", ""); editor.fire("NewBlock", { newBlock }); }; var hasRightSideContent = function(schema2, container, parentBlock) { var walker = new DomTreeWalker(container, parentBlock); var node; var nonEmptyElementsMap = schema2.getNonEmptyElements(); while (node = walker.next()) { if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) { return true; } } }; var moveSelectionToBr = function(editor, brElm, extraBr) { var rng = editor.dom.createRng(); if (!extraBr) { rng.setStartAfter(brElm); rng.setEndAfter(brElm); } else { rng.setStartBefore(brElm); rng.setEndBefore(brElm); } editor.selection.setRng(rng); scrollRangeIntoView(editor, rng); }; var insertBrAtCaret = function(editor, evt) { var selection = editor.selection; var dom2 = editor.dom; var rng = selection.getRng(); var brElm; var extraBr; normalize$2(dom2, rng).each(function(normRng) { rng.setStart(normRng.startContainer, normRng.startOffset); rng.setEnd(normRng.endContainer, normRng.endOffset); }); var offset4 = rng.startOffset; var container = rng.startContainer; if (container.nodeType === 1 && container.hasChildNodes()) { var isAfterLastNodeInContainer = offset4 > container.childNodes.length - 1; container = container.childNodes[Math.min(offset4, container.childNodes.length - 1)] || container; if (isAfterLastNodeInContainer && container.nodeType === 3) { offset4 = container.nodeValue.length; } else { offset4 = 0; } } var parentBlock = dom2.getParent(container, dom2.isBlock); var containerBlock = parentBlock ? dom2.getParent(parentBlock.parentNode, dom2.isBlock) : null; var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ""; var isControlKey = !!(evt && evt.ctrlKey); if (containerBlockName === "LI" && !isControlKey) { parentBlock = containerBlock; } if (container && container.nodeType === 3 && offset4 >= container.nodeValue.length) { if (!hasRightSideContent(editor.schema, container, parentBlock)) { brElm = dom2.create("br"); rng.insertNode(brElm); rng.setStartAfter(brElm); rng.setEndAfter(brElm); extraBr = true; } } brElm = dom2.create("br"); rangeInsertNode(dom2, rng, brElm); moveSelectionToBr(editor, brElm, extraBr); editor.undoManager.add(); }; var insertBrBefore = function(editor, inline) { var br = SugarElement.fromTag("br"); before$4(SugarElement.fromDom(inline), br); editor.undoManager.add(); }; var insertBrAfter = function(editor, inline) { if (!hasBrAfter(editor.getBody(), inline)) { after$3(SugarElement.fromDom(inline), SugarElement.fromTag("br")); } var br = SugarElement.fromTag("br"); after$3(SugarElement.fromDom(inline), br); moveSelectionToBr(editor, br.dom, false); editor.undoManager.add(); }; var isBeforeBr = function(pos) { return isBr$5(pos.getNode()); }; var hasBrAfter = function(rootNode, startNode) { if (isBeforeBr(CaretPosition.after(startNode))) { return true; } else { return nextPosition(rootNode, CaretPosition.after(startNode)).map(function(pos) { return isBr$5(pos.getNode()); }).getOr(false); } }; var isAnchorLink = function(elm) { return elm && elm.nodeName === "A" && "href" in elm; }; var isInsideAnchor = function(location) { return location.fold(never, isAnchorLink, isAnchorLink, never); }; var readInlineAnchorLocation = function(editor) { var isInlineTarget$1 = curry(isInlineTarget, editor); var position2 = CaretPosition.fromRangeStart(editor.selection.getRng()); return readLocation(isInlineTarget$1, editor.getBody(), position2).filter(isInsideAnchor); }; var insertBrOutsideAnchor = function(editor, location) { location.fold(noop2, curry(insertBrBefore, editor), curry(insertBrAfter, editor), noop2); }; var insert$1 = function(editor, evt) { var anchorLocation = readInlineAnchorLocation(editor); if (anchorLocation.isSome()) { anchorLocation.each(curry(insertBrOutsideAnchor, editor)); } else { insertBrAtCaret(editor, evt); } }; var matchesSelector = function(editor, selector2) { return getParentBlock(editor).filter(function(parentBlock) { return selector2.length > 0 && is$2(SugarElement.fromDom(parentBlock), selector2); }).isSome(); }; var shouldInsertBr = function(editor) { return matchesSelector(editor, getBrNewLineSelector(editor)); }; var shouldBlockNewLine$1 = function(editor) { return matchesSelector(editor, getNoNewLineSelector(editor)); }; var newLineAction = Adt.generate([ { br: [] }, { block: [] }, { none: [] } ]); var shouldBlockNewLine = function(editor, _shiftKey) { return shouldBlockNewLine$1(editor); }; var isBrMode = function(requiredState) { return function(editor, _shiftKey) { var brMode = getForcedRootBlock(editor) === ""; return brMode === requiredState; }; }; var inListBlock = function(requiredState) { return function(editor, _shiftKey) { return isListItemParentBlock(editor) === requiredState; }; }; var inBlock = function(blockName, requiredState) { return function(editor, _shiftKey) { var state = getParentBlockName(editor) === blockName.toUpperCase(); return state === requiredState; }; }; var inPreBlock = function(requiredState) { return inBlock("pre", requiredState); }; var inSummaryBlock = function() { return inBlock("summary", true); }; var shouldPutBrInPre = function(requiredState) { return function(editor, _shiftKey) { return shouldPutBrInPre$1(editor) === requiredState; }; }; var inBrContext = function(editor, _shiftKey) { return shouldInsertBr(editor); }; var hasShiftKey = function(_editor, shiftKey) { return shiftKey; }; var canInsertIntoEditableRoot = function(editor) { var forcedRootBlock = getForcedRootBlock(editor); var rootEditable = getEditableRoot$1(editor.dom, editor.selection.getStart()); return rootEditable && editor.schema.isValidChild(rootEditable.nodeName, forcedRootBlock ? forcedRootBlock : "P"); }; var match5 = function(predicates, action2) { return function(editor, shiftKey) { var isMatch = foldl(predicates, function(res, p) { return res && p(editor, shiftKey); }, true); return isMatch ? Optional.some(action2) : Optional.none(); }; }; var getAction = function(editor, evt) { return evaluateUntil([ match5([shouldBlockNewLine], newLineAction.none()), match5([inSummaryBlock()], newLineAction.br()), match5([ inPreBlock(true), shouldPutBrInPre(false), hasShiftKey ], newLineAction.br()), match5([ inPreBlock(true), shouldPutBrInPre(false) ], newLineAction.block()), match5([ inPreBlock(true), shouldPutBrInPre(true), hasShiftKey ], newLineAction.block()), match5([ inPreBlock(true), shouldPutBrInPre(true) ], newLineAction.br()), match5([ inListBlock(true), hasShiftKey ], newLineAction.br()), match5([inListBlock(true)], newLineAction.block()), match5([ isBrMode(true), hasShiftKey, canInsertIntoEditableRoot ], newLineAction.block()), match5([isBrMode(true)], newLineAction.br()), match5([inBrContext], newLineAction.br()), match5([ isBrMode(false), hasShiftKey ], newLineAction.br()), match5([canInsertIntoEditableRoot], newLineAction.block()) ], [ editor, !!(evt && evt.shiftKey) ]).getOr(newLineAction.none()); }; var insert = function(editor, evt) { getAction(editor, evt).fold(function() { insert$1(editor, evt); }, function() { insert$2(editor, evt); }, noop2); }; var handleEnterKeyEvent = function(editor, event) { if (event.isDefaultPrevented()) { return; } event.preventDefault(); endTypingLevelIgnoreLocks(editor.undoManager); editor.undoManager.transact(function() { if (editor.selection.isCollapsed() === false) { editor.execCommand("Delete"); } insert(editor, event); }); }; var setup$9 = function(editor) { editor.on("keydown", function(event) { if (event.keyCode === VK.ENTER) { handleEnterKeyEvent(editor, event); } }); }; var executeKeydownOverride$1 = function(editor, caret, evt) { execute([ { keyCode: VK.END, action: action(moveToLineEndPoint$1, editor, true) }, { keyCode: VK.HOME, action: action(moveToLineEndPoint$1, editor, false) }, { keyCode: VK.END, action: action(moveToLineEndPoint, editor, true) }, { keyCode: VK.HOME, action: action(moveToLineEndPoint, editor, false) }, { keyCode: VK.END, action: action(moveToLineEndPoint$2, editor, true, caret) }, { keyCode: VK.HOME, action: action(moveToLineEndPoint$2, editor, false, caret) } ], evt).each(function(_2) { evt.preventDefault(); }); }; var setup$8 = function(editor, caret) { editor.on("keydown", function(evt) { if (evt.isDefaultPrevented() === false) { executeKeydownOverride$1(editor, caret, evt); } }); }; var browser = detect().browser; var setupIeInput = function(editor) { var keypressThrotter = first(function() { if (!editor.composing) { normalizeNbspsInEditor(editor); } }, 0); if (browser.isIE()) { editor.on("keypress", function(_e) { keypressThrotter.throttle(); }); editor.on("remove", function(_e) { keypressThrotter.cancel(); }); } }; var setup$7 = function(editor) { setupIeInput(editor); editor.on("input", function(e2) { if (e2.isComposing === false) { normalizeNbspsInEditor(editor); } }); }; var platform = detect(); var executeKeyupAction = function(editor, caret, evt) { execute([ { keyCode: VK.PAGE_UP, action: action(moveToLineEndPoint$2, editor, false, caret) }, { keyCode: VK.PAGE_DOWN, action: action(moveToLineEndPoint$2, editor, true, caret) } ], evt); }; var stopImmediatePropagation = function(e2) { return e2.stopImmediatePropagation(); }; var isPageUpDown = function(evt) { return evt.keyCode === VK.PAGE_UP || evt.keyCode === VK.PAGE_DOWN; }; var setNodeChangeBlocker = function(blocked, editor, block) { if (block && !blocked.get()) { editor.on("NodeChange", stopImmediatePropagation, true); } else if (!block && blocked.get()) { editor.off("NodeChange", stopImmediatePropagation); } blocked.set(block); }; var setup$6 = function(editor, caret) { if (platform.os.isOSX()) { return; } var blocked = Cell3(false); editor.on("keydown", function(evt) { if (isPageUpDown(evt)) { setNodeChangeBlocker(blocked, editor, true); } }); editor.on("keyup", function(evt) { if (evt.isDefaultPrevented() === false) { executeKeyupAction(editor, caret, evt); } if (isPageUpDown(evt) && blocked.get()) { setNodeChangeBlocker(blocked, editor, false); editor.nodeChanged(); } }); }; var insertTextAtPosition = function(text, pos) { var container = pos.container(); var offset4 = pos.offset(); if (isText$7(container)) { container.insertData(offset4, text); return Optional.some(CaretPosition(container, offset4 + text.length)); } else { return getElementFromPosition(pos).map(function(elm) { var textNode = SugarElement.fromText(text); if (pos.isAtEnd()) { after$3(elm, textNode); } else { before$4(elm, textNode); } return CaretPosition(textNode.dom, text.length); }); } }; var insertNbspAtPosition = curry(insertTextAtPosition, nbsp); var insertSpaceAtPosition = curry(insertTextAtPosition, " "); var locationToCaretPosition = function(root2) { return function(location) { return location.fold(function(element) { return prevPosition(root2.dom, CaretPosition.before(element)); }, function(element) { return firstPositionIn(element); }, function(element) { return lastPositionIn(element); }, function(element) { return nextPosition(root2.dom, CaretPosition.after(element)); }); }; }; var insertInlineBoundarySpaceOrNbsp = function(root2, pos) { return function(checkPos) { return needsToHaveNbsp(root2, checkPos) ? insertNbspAtPosition(pos) : insertSpaceAtPosition(pos); }; }; var setSelection = function(editor) { return function(pos) { editor.selection.setRng(pos.toRange()); editor.nodeChanged(); return true; }; }; var insertSpaceOrNbspAtSelection = function(editor) { var pos = CaretPosition.fromRangeStart(editor.selection.getRng()); var root2 = SugarElement.fromDom(editor.getBody()); if (editor.selection.isCollapsed()) { var isInlineTarget$1 = curry(isInlineTarget, editor); var caretPosition = CaretPosition.fromRangeStart(editor.selection.getRng()); return readLocation(isInlineTarget$1, editor.getBody(), caretPosition).bind(locationToCaretPosition(root2)).bind(insertInlineBoundarySpaceOrNbsp(root2, pos)).exists(setSelection(editor)); } else { return false; } }; var executeKeydownOverride = function(editor, evt) { execute([{ keyCode: VK.SPACEBAR, action: action(insertSpaceOrNbspAtSelection, editor) }], evt).each(function(_2) { evt.preventDefault(); }); }; var setup$5 = function(editor) { editor.on("keydown", function(evt) { if (evt.isDefaultPrevented() === false) { executeKeydownOverride(editor, evt); } }); }; var registerKeyboardOverrides = function(editor) { var caret = setupSelectedState(editor); setup$c(editor); setup$b(editor, caret); setup$a(editor, caret); setup$9(editor); setup$5(editor); setup$7(editor); setup$8(editor, caret); setup$6(editor, caret); return caret; }; var setup$4 = function(editor) { if (!isRtc(editor)) { return registerKeyboardOverrides(editor); } else { return Cell3(null); } }; var NodeChange = function() { function NodeChange2(editor) { this.lastPath = []; this.editor = editor; var lastRng; var self2 = this; if (!("onselectionchange" in editor.getDoc())) { editor.on("NodeChange click mouseup keyup focus", function(e2) { var nativeRng = editor.selection.getRng(); var fakeRng = { startContainer: nativeRng.startContainer, startOffset: nativeRng.startOffset, endContainer: nativeRng.endContainer, endOffset: nativeRng.endOffset }; if (e2.type === "nodechange" || !isEq$4(fakeRng, lastRng)) { editor.fire("SelectionChange"); } lastRng = fakeRng; }); } editor.on("contextmenu", function() { editor.fire("SelectionChange"); }); editor.on("SelectionChange", function() { var startElm = editor.selection.getStart(true); if (!startElm || !Env.range && editor.selection.isCollapsed()) { return; } if (hasAnyRanges(editor) && !self2.isSameElementPath(startElm) && editor.dom.isChildOf(startElm, editor.getBody())) { editor.nodeChanged({ selectionChange: true }); } }); editor.on("mouseup", function(e2) { if (!e2.isDefaultPrevented() && hasAnyRanges(editor)) { if (editor.selection.getNode().nodeName === "IMG") { Delay.setEditorTimeout(editor, function() { editor.nodeChanged(); }); } else { editor.nodeChanged(); } } }); } NodeChange2.prototype.nodeChanged = function(args) { var selection = this.editor.selection; var node, parents2, root2; if (this.editor.initialized && selection && !shouldDisableNodeChange(this.editor) && !this.editor.mode.isReadOnly()) { root2 = this.editor.getBody(); node = selection.getStart(true) || root2; if (node.ownerDocument !== this.editor.getDoc() || !this.editor.dom.isChildOf(node, root2)) { node = root2; } parents2 = []; this.editor.dom.getParent(node, function(node2) { if (node2 === root2) { return true; } parents2.push(node2); }); args = args || {}; args.element = node; args.parents = parents2; this.editor.fire("NodeChange", args); } }; NodeChange2.prototype.isSameElementPath = function(startElm) { var i2; var currentPath = this.editor.$(startElm).parentsUntil(this.editor.getBody()).add(startElm); if (currentPath.length === this.lastPath.length) { for (i2 = currentPath.length; i2 >= 0; i2--) { if (currentPath[i2] !== this.lastPath[i2]) { break; } } if (i2 === -1) { this.lastPath = currentPath; return true; } } this.lastPath = currentPath; return false; }; return NodeChange2; }(); var preventSummaryToggle = function(editor) { editor.on("click", function(e2) { if (editor.dom.getParent(e2.target, "details")) { e2.preventDefault(); } }); }; var filterDetails = function(editor) { editor.parser.addNodeFilter("details", function(elms) { each$k(elms, function(details) { details.attr("data-mce-open", details.attr("open")); details.attr("open", "open"); }); }); editor.serializer.addNodeFilter("details", function(elms) { each$k(elms, function(details) { var open6 = details.attr("data-mce-open"); details.attr("open", isString$12(open6) ? open6 : null); details.attr("data-mce-open", null); }); }); }; var setup$3 = function(editor) { preventSummaryToggle(editor); filterDetails(editor); }; var isTextBlockNode = function(node) { return isElement$5(node) && isTextBlock$2(SugarElement.fromDom(node)); }; var normalizeSelection = function(editor) { var rng = editor.selection.getRng(); var startPos = CaretPosition.fromRangeStart(rng); var endPos = CaretPosition.fromRangeEnd(rng); if (CaretPosition.isElementPosition(startPos)) { var container = startPos.container(); if (isTextBlockNode(container)) { firstPositionIn(container).each(function(pos) { return rng.setStart(pos.container(), pos.offset()); }); } } if (CaretPosition.isElementPosition(endPos)) { var container = startPos.container(); if (isTextBlockNode(container)) { lastPositionIn(container).each(function(pos) { return rng.setEnd(pos.container(), pos.offset()); }); } } editor.selection.setRng(normalize2(rng)); }; var setup$2 = function(editor) { editor.on("click", function(e2) { if (e2.detail >= 3) { normalizeSelection(editor); } }); }; var getAbsolutePosition = function(elm) { var clientRect = elm.getBoundingClientRect(); var doc2 = elm.ownerDocument; var docElem2 = doc2.documentElement; var win = doc2.defaultView; return { top: clientRect.top + win.pageYOffset - docElem2.clientTop, left: clientRect.left + win.pageXOffset - docElem2.clientLeft }; }; var getBodyPosition = function(editor) { return editor.inline ? getAbsolutePosition(editor.getBody()) : { left: 0, top: 0 }; }; var getScrollPosition = function(editor) { var body = editor.getBody(); return editor.inline ? { left: body.scrollLeft, top: body.scrollTop } : { left: 0, top: 0 }; }; var getBodyScroll = function(editor) { var body = editor.getBody(), docElm = editor.getDoc().documentElement; var inlineScroll = { left: body.scrollLeft, top: body.scrollTop }; var iframeScroll = { left: body.scrollLeft || docElm.scrollLeft, top: body.scrollTop || docElm.scrollTop }; return editor.inline ? inlineScroll : iframeScroll; }; var getMousePosition2 = function(editor, event) { if (event.target.ownerDocument !== editor.getDoc()) { var iframePosition = getAbsolutePosition(editor.getContentAreaContainer()); var scrollPosition = getBodyScroll(editor); return { left: event.pageX - iframePosition.left + scrollPosition.left, top: event.pageY - iframePosition.top + scrollPosition.top }; } return { left: event.pageX, top: event.pageY }; }; var calculatePosition = function(bodyPosition, scrollPosition, mousePosition2) { return { pageX: mousePosition2.left - bodyPosition.left + scrollPosition.left, pageY: mousePosition2.top - bodyPosition.top + scrollPosition.top }; }; var calc = function(editor, event) { return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition2(editor, event)); }; var isContentEditableFalse$1 = isContentEditableFalse$b, isContentEditableTrue$1 = isContentEditableTrue$4; var isDraggable = function(rootElm, elm) { return isContentEditableFalse$1(elm) && elm !== rootElm; }; var isValidDropTarget = function(editor, targetElement, dragElement) { if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) { return false; } return !isContentEditableFalse$1(targetElement); }; var cloneElement2 = function(elm) { var cloneElm = elm.cloneNode(true); cloneElm.removeAttribute("data-mce-selected"); return cloneElm; }; var createGhost = function(editor, elm, width, height) { var dom2 = editor.dom; var clonedElm = elm.cloneNode(true); dom2.setStyles(clonedElm, { width, height }); dom2.setAttrib(clonedElm, "data-mce-selected", null); var ghostElm = dom2.create("div", { "class": "mce-drag-container", "data-mce-bogus": "all", "unselectable": "on", "contenteditable": "false" }); dom2.setStyles(ghostElm, { position: "absolute", opacity: 0.5, overflow: "hidden", border: 0, padding: 0, margin: 0, width, height }); dom2.setStyles(clonedElm, { margin: 0, boxSizing: "border-box" }); ghostElm.appendChild(clonedElm); return ghostElm; }; var appendGhostToBody = function(ghostElm, bodyElm) { if (ghostElm.parentNode !== bodyElm) { bodyElm.appendChild(ghostElm); } }; var moveGhost = function(ghostElm, position2, width, height, maxX, maxY) { var overflowX = 0, overflowY = 0; ghostElm.style.left = position2.pageX + "px"; ghostElm.style.top = position2.pageY + "px"; if (position2.pageX + width > maxX) { overflowX = position2.pageX + width - maxX; } if (position2.pageY + height > maxY) { overflowY = position2.pageY + height - maxY; } ghostElm.style.width = width - overflowX + "px"; ghostElm.style.height = height - overflowY + "px"; }; var removeElement = function(elm) { if (elm && elm.parentNode) { elm.parentNode.removeChild(elm); } }; var isLeftMouseButtonPressed = function(e2) { return e2.button === 0; }; var applyRelPos = function(state, position2) { return { pageX: position2.pageX - state.relX, pageY: position2.pageY + 5 }; }; var start = function(state, editor) { return function(e2) { if (isLeftMouseButtonPressed(e2)) { var ceElm = find$3(editor.dom.getParents(e2.target), or(isContentEditableFalse$1, isContentEditableTrue$1)).getOr(null); if (isDraggable(editor.getBody(), ceElm)) { var elmPos = editor.dom.getPos(ceElm); var bodyElm = editor.getBody(); var docElm = editor.getDoc().documentElement; state.set({ element: ceElm, dragging: false, screenX: e2.screenX, screenY: e2.screenY, maxX: (editor.inline ? bodyElm.scrollWidth : docElm.offsetWidth) - 2, maxY: (editor.inline ? bodyElm.scrollHeight : docElm.offsetHeight) - 2, relX: e2.pageX - elmPos.x, relY: e2.pageY - elmPos.y, width: ceElm.offsetWidth, height: ceElm.offsetHeight, ghost: createGhost(editor, ceElm, ceElm.offsetWidth, ceElm.offsetHeight) }); } } }; }; var move2 = function(state, editor) { var throttledPlaceCaretAt = Delay.throttle(function(clientX, clientY) { editor._selectionOverrides.hideFakeCaret(); editor.selection.placeCaretAt(clientX, clientY); }, 0); editor.on("remove", throttledPlaceCaretAt.stop); return function(e2) { return state.on(function(state2) { var movement = Math.max(Math.abs(e2.screenX - state2.screenX), Math.abs(e2.screenY - state2.screenY)); if (!state2.dragging && movement > 10) { var args = editor.fire("dragstart", { target: state2.element }); if (args.isDefaultPrevented()) { return; } state2.dragging = true; editor.focus(); } if (state2.dragging) { var targetPos = applyRelPos(state2, calc(editor, e2)); appendGhostToBody(state2.ghost, editor.getBody()); moveGhost(state2.ghost, targetPos, state2.width, state2.height, state2.maxX, state2.maxY); throttledPlaceCaretAt(e2.clientX, e2.clientY); } }); }; }; var getRawTarget = function(selection) { var rng = selection.getSel().getRangeAt(0); var startContainer = rng.startContainer; return startContainer.nodeType === 3 ? startContainer.parentNode : startContainer; }; var drop = function(state, editor) { return function(e2) { state.on(function(state2) { if (state2.dragging) { if (isValidDropTarget(editor, getRawTarget(editor.selection), state2.element)) { var targetClone_1 = cloneElement2(state2.element); var args = editor.fire("drop", { clientX: e2.clientX, clientY: e2.clientY }); if (!args.isDefaultPrevented()) { editor.undoManager.transact(function() { removeElement(state2.element); editor.insertContent(editor.dom.getOuterHTML(targetClone_1)); editor._selectionOverrides.hideFakeCaret(); }); } } editor.fire("dragend"); } }); removeDragState(state); }; }; var stop2 = function(state, editor) { return function() { state.on(function(state2) { if (state2.dragging) { editor.fire("dragend"); } }); removeDragState(state); }; }; var removeDragState = function(state) { state.on(function(state2) { removeElement(state2.ghost); }); state.clear(); }; var bindFakeDragEvents = function(editor) { var state = value24(); var pageDom = DOMUtils.DOM; var rootDocument = document; var dragStartHandler = start(state, editor); var dragHandler = move2(state, editor); var dropHandler = drop(state, editor); var dragEndHandler = stop2(state, editor); editor.on("mousedown", dragStartHandler); editor.on("mousemove", dragHandler); editor.on("mouseup", dropHandler); pageDom.bind(rootDocument, "mousemove", dragHandler); pageDom.bind(rootDocument, "mouseup", dragEndHandler); editor.on("remove", function() { pageDom.unbind(rootDocument, "mousemove", dragHandler); pageDom.unbind(rootDocument, "mouseup", dragEndHandler); }); editor.on("keydown", function(e2) { if (e2.keyCode === VK.ESC) { dragEndHandler(); } }); }; var blockIeDrop = function(editor) { editor.on("drop", function(e2) { var realTarget = typeof e2.clientX !== "undefined" ? editor.getDoc().elementFromPoint(e2.clientX, e2.clientY) : null; if (isContentEditableFalse$1(realTarget) || editor.dom.getContentEditableParent(realTarget) === "false") { e2.preventDefault(); } }); }; var blockUnsupportedFileDrop = function(editor) { var preventFileDrop = function(e2) { if (!e2.isDefaultPrevented()) { var dataTransfer2 = e2.dataTransfer; if (dataTransfer2 && (contains$3(dataTransfer2.types, "Files") || dataTransfer2.files.length > 0)) { e2.preventDefault(); if (e2.type === "drop") { displayError(editor, "Dropped file type is not supported"); } } } }; var preventFileDropIfUIElement = function(e2) { if (isUIElement(editor, e2.target)) { preventFileDrop(e2); } }; var setup124 = function() { var pageDom = DOMUtils.DOM; var dom2 = editor.dom; var doc2 = document; var editorRoot = editor.inline ? editor.getBody() : editor.getDoc(); var eventNames = [ "drop", "dragover" ]; each$k(eventNames, function(name2) { pageDom.bind(doc2, name2, preventFileDropIfUIElement); dom2.bind(editorRoot, name2, preventFileDrop); }); editor.on("remove", function() { each$k(eventNames, function(name2) { pageDom.unbind(doc2, name2, preventFileDropIfUIElement); dom2.unbind(editorRoot, name2, preventFileDrop); }); }); }; editor.on("init", function() { Delay.setEditorTimeout(editor, setup124, 0); }); }; var init$2 = function(editor) { bindFakeDragEvents(editor); blockIeDrop(editor); if (shouldBlockUnsupportedDrop(editor)) { blockUnsupportedFileDrop(editor); } }; var setup$1 = function(editor) { var renderFocusCaret = first(function() { if (!editor.removed && editor.getBody().contains(document.activeElement)) { var rng = editor.selection.getRng(); if (rng.collapsed) { var caretRange = renderRangeCaret(editor, rng, false); editor.selection.setRng(caretRange); } } }, 0); editor.on("focus", function() { renderFocusCaret.throttle(); }); editor.on("blur", function() { renderFocusCaret.cancel(); }); }; var setup123 = function(editor) { editor.on("init", function() { editor.on("focusin", function(e2) { var target = e2.target; if (isMedia$2(target)) { var ceRoot = getContentEditableRoot$1(editor.getBody(), target); var node = isContentEditableFalse$b(ceRoot) ? ceRoot : target; if (editor.selection.getNode() !== node) { selectNode(editor, node).each(function(rng) { return editor.selection.setRng(rng); }); } } }); }); }; var isContentEditableTrue = isContentEditableTrue$4; var isContentEditableFalse = isContentEditableFalse$b; var getContentEditableRoot = function(editor, node) { return getContentEditableRoot$1(editor.getBody(), node); }; var SelectionOverrides = function(editor) { var selection = editor.selection, dom2 = editor.dom; var isBlock2 = dom2.isBlock; var rootNode = editor.getBody(); var fakeCaret = FakeCaret(editor, rootNode, isBlock2, function() { return hasFocus(editor); }); var realSelectionId = "sel-" + dom2.uniqueId(); var elementSelectionAttr = "data-mce-selected"; var selectedElement; var isFakeSelectionElement = function(node) { return dom2.hasClass(node, "mce-offscreen-selection"); }; var isFakeSelectionTargetElement = function(node) { return node !== rootNode && (isContentEditableFalse(node) || isMedia$2(node)) && dom2.isChildOf(node, rootNode); }; var isNearFakeSelectionElement = function(pos) { return isBeforeContentEditableFalse(pos) || isAfterContentEditableFalse(pos) || isBeforeMedia(pos) || isAfterMedia(pos); }; var getRealSelectionElement = function() { var container = dom2.get(realSelectionId); return container ? container.getElementsByTagName("*")[0] : container; }; var setRange = function(range3) { if (range3) { selection.setRng(range3); } }; var getRange = selection.getRng; var showCaret2 = function(direction, node, before2, scrollIntoView2) { if (scrollIntoView2 === void 0) { scrollIntoView2 = true; } var e2 = editor.fire("ShowCaret", { target: node, direction, before: before2 }); if (e2.isDefaultPrevented()) { return null; } if (scrollIntoView2) { selection.scrollIntoView(node, direction === -1); } return fakeCaret.show(before2, node); }; var showBlockCaretContainer2 = function(blockCaretContainer) { if (blockCaretContainer.hasAttribute("data-mce-caret")) { showCaretContainerBlock(blockCaretContainer); setRange(getRange()); selection.scrollIntoView(blockCaretContainer); } }; var registerEvents2 = function() { editor.on("mouseup", function(e2) { var range3 = getRange(); if (range3.collapsed && isXYInContentArea(editor, e2.clientX, e2.clientY)) { renderCaretAtRange(editor, range3, false).each(setRange); } }); editor.on("click", function(e2) { var contentEditableRoot = getContentEditableRoot(editor, e2.target); if (contentEditableRoot) { if (isContentEditableFalse(contentEditableRoot)) { e2.preventDefault(); editor.focus(); } if (isContentEditableTrue(contentEditableRoot)) { if (dom2.isChildOf(contentEditableRoot, selection.getNode())) { removeElementSelection(); } } } }); editor.on("blur NewBlock", removeElementSelection); editor.on("ResizeWindow FullscreenStateChanged", fakeCaret.reposition); var hasNormalCaretPosition = function(elm) { var start2 = elm.firstChild; if (isNullable(start2)) { return false; } var startPos = CaretPosition.before(start2); if (isBr$5(startPos.getNode()) && elm.childNodes.length === 1) { return !isNearFakeSelectionElement(startPos); } else { var caretWalker = CaretWalker(elm); var newPos = caretWalker.next(startPos); return newPos && !isNearFakeSelectionElement(newPos); } }; var isInSameBlock2 = function(node1, node2) { var block1 = dom2.getParent(node1, isBlock2); var block2 = dom2.getParent(node2, isBlock2); return block1 === block2; }; var hasBetterMouseTarget = function(targetNode, caretNode) { var targetBlock = dom2.getParent(targetNode, isBlock2); var caretBlock = dom2.getParent(caretNode, isBlock2); if (isNullable(targetBlock)) { return false; } if (targetNode !== caretBlock && dom2.isChildOf(targetBlock, caretBlock) && isContentEditableFalse(getContentEditableRoot(editor, targetBlock)) === false) { return true; } return !dom2.isChildOf(caretBlock, targetBlock) && !isInSameBlock2(targetBlock, caretBlock) && hasNormalCaretPosition(targetBlock); }; editor.on("tap", function(e2) { var targetElm = e2.target; var contentEditableRoot = getContentEditableRoot(editor, targetElm); if (isContentEditableFalse(contentEditableRoot)) { e2.preventDefault(); selectNode(editor, contentEditableRoot).each(setElementSelection); } else if (isFakeSelectionTargetElement(targetElm)) { selectNode(editor, targetElm).each(setElementSelection); } }, true); editor.on("mousedown", function(e2) { var targetElm = e2.target; if (targetElm !== rootNode && targetElm.nodeName !== "HTML" && !dom2.isChildOf(targetElm, rootNode)) { return; } if (isXYInContentArea(editor, e2.clientX, e2.clientY) === false) { return; } var contentEditableRoot = getContentEditableRoot(editor, targetElm); if (contentEditableRoot) { if (isContentEditableFalse(contentEditableRoot)) { e2.preventDefault(); selectNode(editor, contentEditableRoot).each(setElementSelection); } else { removeElementSelection(); if (!(isContentEditableTrue(contentEditableRoot) && e2.shiftKey) && !isXYWithinRange(e2.clientX, e2.clientY, selection.getRng())) { hideFakeCaret(); selection.placeCaretAt(e2.clientX, e2.clientY); } } } else if (isFakeSelectionTargetElement(targetElm)) { selectNode(editor, targetElm).each(setElementSelection); } else if (isFakeCaretTarget(targetElm) === false) { removeElementSelection(); hideFakeCaret(); var fakeCaretInfo = closestFakeCaret(rootNode, e2.clientX, e2.clientY); if (fakeCaretInfo) { if (!hasBetterMouseTarget(targetElm, fakeCaretInfo.node)) { e2.preventDefault(); var range3 = showCaret2(1, fakeCaretInfo.node, fakeCaretInfo.before, false); setRange(range3); editor.getBody().focus(); } } } }); editor.on("keypress", function(e2) { if (VK.modifierPressed(e2)) { return; } if (isContentEditableFalse(selection.getNode())) { e2.preventDefault(); } }); editor.on("GetSelectionRange", function(e2) { var rng = e2.range; if (selectedElement) { if (!selectedElement.parentNode) { selectedElement = null; return; } rng = rng.cloneRange(); rng.selectNode(selectedElement); e2.range = rng; } }); editor.on("SetSelectionRange", function(e2) { e2.range = normalizeShortEndedElementSelection(e2.range); var rng = setElementSelection(e2.range, e2.forward); if (rng) { e2.range = rng; } }); var isPasteBin = function(node) { return node.id === "mcepastebin"; }; editor.on("AfterSetSelectionRange", function(e2) { var rng = e2.range; var parentNode = rng.startContainer.parentNode; if (!isRangeInCaretContainer(rng) && !isPasteBin(parentNode)) { hideFakeCaret(); } if (!isFakeSelectionElement(parentNode)) { removeElementSelection(); } }); editor.on("copy", function(e2) { var clipboardData = e2.clipboardData; if (!e2.isDefaultPrevented() && e2.clipboardData && !Env.ie) { var realSelectionElement = getRealSelectionElement(); if (realSelectionElement) { e2.preventDefault(); clipboardData.clearData(); clipboardData.setData("text/html", realSelectionElement.outerHTML); clipboardData.setData("text/plain", realSelectionElement.outerText || realSelectionElement.innerText); } } }); init$2(editor); setup$1(editor); setup123(editor); }; var isWithinCaretContainer = function(node) { return isCaretContainer$2(node) || startsWithCaretContainer$1(node) || endsWithCaretContainer$1(node); }; var isRangeInCaretContainer = function(rng) { return isWithinCaretContainer(rng.startContainer) || isWithinCaretContainer(rng.endContainer); }; var normalizeShortEndedElementSelection = function(rng) { var shortEndedElements = editor.schema.getShortEndedElements(); var newRng = dom2.createRng(); var startContainer = rng.startContainer; var startOffset = rng.startOffset; var endContainer = rng.endContainer; var endOffset = rng.endOffset; if (has$22(shortEndedElements, startContainer.nodeName.toLowerCase())) { if (startOffset === 0) { newRng.setStartBefore(startContainer); } else { newRng.setStartAfter(startContainer); } } else { newRng.setStart(startContainer, startOffset); } if (has$22(shortEndedElements, endContainer.nodeName.toLowerCase())) { if (endOffset === 0) { newRng.setEndBefore(endContainer); } else { newRng.setEndAfter(endContainer); } } else { newRng.setEnd(endContainer, endOffset); } return newRng; }; var setupOffscreenSelection = function(node, targetClone, origTargetClone) { var $2 = editor.$; var $realSelectionContainer = descendant(SugarElement.fromDom(editor.getBody()), "#" + realSelectionId).fold(function() { return $2([]); }, function(elm) { return $2([elm.dom]); }); if ($realSelectionContainer.length === 0) { $realSelectionContainer = $2('
    ').attr("id", realSelectionId); $realSelectionContainer.appendTo(editor.getBody()); } var newRange = dom2.createRng(); if (targetClone === origTargetClone && Env.ie) { $realSelectionContainer.empty().append('

    \xA0

    ').append(targetClone); newRange.setStartAfter($realSelectionContainer[0].firstChild.firstChild); newRange.setEndAfter(targetClone); } else { $realSelectionContainer.empty().append(nbsp).append(targetClone).append(nbsp); newRange.setStart($realSelectionContainer[0].firstChild, 1); newRange.setEnd($realSelectionContainer[0].lastChild, 0); } $realSelectionContainer.css({ top: dom2.getPos(node, editor.getBody()).y }); $realSelectionContainer[0].focus(); var sel = selection.getSel(); sel.removeAllRanges(); sel.addRange(newRange); return newRange; }; var selectElement = function(elm) { var targetClone = elm.cloneNode(true); var e2 = editor.fire("ObjectSelected", { target: elm, targetClone }); if (e2.isDefaultPrevented()) { return null; } var range3 = setupOffscreenSelection(elm, e2.targetClone, targetClone); var nodeElm = SugarElement.fromDom(elm); each$k(descendants(SugarElement.fromDom(editor.getBody()), "*[data-mce-selected]"), function(elm2) { if (!eq2(nodeElm, elm2)) { remove$6(elm2, elementSelectionAttr); } }); if (!dom2.getAttrib(elm, elementSelectionAttr)) { elm.setAttribute(elementSelectionAttr, "1"); } selectedElement = elm; hideFakeCaret(); return range3; }; var setElementSelection = function(range3, forward) { if (!range3) { return null; } if (range3.collapsed) { if (!isRangeInCaretContainer(range3)) { var dir2 = forward ? 1 : -1; var caretPosition = getNormalizedRangeEndPoint(dir2, rootNode, range3); var beforeNode = caretPosition.getNode(!forward); if (isFakeCaretTarget(beforeNode)) { return showCaret2(dir2, beforeNode, forward ? !caretPosition.isAtEnd() : false, false); } var afterNode = caretPosition.getNode(forward); if (isFakeCaretTarget(afterNode)) { return showCaret2(dir2, afterNode, forward ? false : !caretPosition.isAtEnd(), false); } } return null; } var startContainer = range3.startContainer; var startOffset = range3.startOffset; var endOffset = range3.endOffset; if (startContainer.nodeType === 3 && startOffset === 0 && isContentEditableFalse(startContainer.parentNode)) { startContainer = startContainer.parentNode; startOffset = dom2.nodeIndex(startContainer); startContainer = startContainer.parentNode; } if (startContainer.nodeType !== 1) { return null; } if (endOffset === startOffset + 1 && startContainer === range3.endContainer) { var node = startContainer.childNodes[startOffset]; if (isFakeSelectionTargetElement(node)) { return selectElement(node); } } return null; }; var removeElementSelection = function() { if (selectedElement) { selectedElement.removeAttribute(elementSelectionAttr); } descendant(SugarElement.fromDom(editor.getBody()), "#" + realSelectionId).each(remove$7); selectedElement = null; }; var destroy4 = function() { fakeCaret.destroy(); selectedElement = null; }; var hideFakeCaret = function() { fakeCaret.hide(); }; if (Env.ceFalse && !isRtc(editor)) { registerEvents2(); } return { showCaret: showCaret2, showBlockCaretContainer: showBlockCaretContainer2, hideFakeCaret, destroy: destroy4 }; }; var Quirks = function(editor) { var each3 = Tools.each; var BACKSPACE = VK.BACKSPACE, DELETE2 = VK.DELETE, dom2 = editor.dom, selection = editor.selection, parser = editor.parser; var isGecko = Env.gecko, isIE2 = Env.ie, isWebKit = Env.webkit; var mceInternalUrlPrefix = "data:text/mce-internal,"; var mceInternalDataType = isIE2 ? "Text" : "URL"; var setEditorCommandState2 = function(cmd, state) { try { editor.getDoc().execCommand(cmd, false, state); } catch (ex) { } }; var isDefaultPrevented = function(e2) { return e2.isDefaultPrevented(); }; var setMceInternalContent = function(e2) { var selectionHtml, internalContent; if (e2.dataTransfer) { if (editor.selection.isCollapsed() && e2.target.tagName === "IMG") { selection.select(e2.target); } selectionHtml = editor.selection.getContent(); if (selectionHtml.length > 0) { internalContent = mceInternalUrlPrefix + escape(editor.id) + "," + escape(selectionHtml); e2.dataTransfer.setData(mceInternalDataType, internalContent); } } }; var getMceInternalContent = function(e2) { var internalContent; if (e2.dataTransfer) { internalContent = e2.dataTransfer.getData(mceInternalDataType); if (internalContent && internalContent.indexOf(mceInternalUrlPrefix) >= 0) { internalContent = internalContent.substr(mceInternalUrlPrefix.length).split(","); return { id: unescape(internalContent[0]), html: unescape(internalContent[1]) }; } } return null; }; var insertClipboardContents = function(content, internal) { if (editor.queryCommandSupported("mceInsertClipboardContent")) { editor.execCommand("mceInsertClipboardContent", false, { content, internal }); } else { editor.execCommand("mceInsertContent", false, content); } }; var emptyEditorWhenDeleting = function() { var serializeRng = function(rng) { var body = dom2.create("body"); var contents = rng.cloneContents(); body.appendChild(contents); return selection.serializer.serialize(body, { format: "html" }); }; var allContentsSelected = function(rng) { var selection2 = serializeRng(rng); var allRng = dom2.createRng(); allRng.selectNode(editor.getBody()); var allSelection = serializeRng(allRng); return selection2 === allSelection; }; editor.on("keydown", function(e2) { var keyCode = e2.keyCode; var isCollapsed, body; if (!isDefaultPrevented(e2) && (keyCode === DELETE2 || keyCode === BACKSPACE)) { isCollapsed = editor.selection.isCollapsed(); body = editor.getBody(); if (isCollapsed && !dom2.isEmpty(body)) { return; } if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) { return; } e2.preventDefault(); editor.setContent(""); if (body.firstChild && dom2.isBlock(body.firstChild)) { editor.selection.setCursorLocation(body.firstChild, 0); } else { editor.selection.setCursorLocation(body, 0); } editor.nodeChanged(); } }); }; var selectAll = function() { editor.shortcuts.add("meta+a", null, "SelectAll"); }; var documentElementEditingFocus = function() { if (!editor.inline) { dom2.bind(editor.getDoc(), "mousedown mouseup", function(e2) { var rng; if (e2.target === editor.getDoc().documentElement) { rng = selection.getRng(); editor.getBody().focus(); if (e2.type === "mousedown") { if (isCaretContainer$2(rng.startContainer)) { return; } selection.placeCaretAt(e2.clientX, e2.clientY); } else { selection.setRng(rng); } } }); } }; var removeHrOnBackspace = function() { editor.on("keydown", function(e2) { if (!isDefaultPrevented(e2) && e2.keyCode === BACKSPACE) { if (!editor.getBody().getElementsByTagName("hr").length) { return; } if (selection.isCollapsed() && selection.getRng().startOffset === 0) { var node = selection.getNode(); var previousSibling = node.previousSibling; if (node.nodeName === "HR") { dom2.remove(node); e2.preventDefault(); return; } if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "hr") { dom2.remove(previousSibling); e2.preventDefault(); } } } }); }; var focusBody2 = function() { if (!Range.prototype.getClientRects) { editor.on("mousedown", function(e2) { if (!isDefaultPrevented(e2) && e2.target.nodeName === "HTML") { var body_1 = editor.getBody(); body_1.blur(); Delay.setEditorTimeout(editor, function() { body_1.focus(); }); } }); } }; var selectControlElements = function() { editor.on("click", function(e2) { var target = e2.target; if (/^(IMG|HR)$/.test(target.nodeName) && dom2.getContentEditableParent(target) !== "false") { e2.preventDefault(); editor.selection.select(target); editor.nodeChanged(); } if (target.nodeName === "A" && dom2.hasClass(target, "mce-item-anchor")) { e2.preventDefault(); selection.select(target); } }); }; var removeStylesWhenDeletingAcrossBlockElements = function() { var getAttributeApplyFunction = function() { var template = dom2.getAttribs(selection.getStart().cloneNode(false)); return function() { var target = selection.getStart(); if (target !== editor.getBody()) { dom2.setAttrib(target, "style", null); each3(template, function(attr) { target.setAttributeNode(attr.cloneNode(true)); }); } }; }; var isSelectionAcrossElements = function() { return !selection.isCollapsed() && dom2.getParent(selection.getStart(), dom2.isBlock) !== dom2.getParent(selection.getEnd(), dom2.isBlock); }; editor.on("keypress", function(e2) { var applyAttributes2; if (!isDefaultPrevented(e2) && (e2.keyCode === 8 || e2.keyCode === 46) && isSelectionAcrossElements()) { applyAttributes2 = getAttributeApplyFunction(); editor.getDoc().execCommand("delete", false, null); applyAttributes2(); e2.preventDefault(); return false; } }); dom2.bind(editor.getDoc(), "cut", function(e2) { var applyAttributes2; if (!isDefaultPrevented(e2) && isSelectionAcrossElements()) { applyAttributes2 = getAttributeApplyFunction(); Delay.setEditorTimeout(editor, function() { applyAttributes2(); }); } }); }; var disableBackspaceIntoATable = function() { editor.on("keydown", function(e2) { if (!isDefaultPrevented(e2) && e2.keyCode === BACKSPACE) { if (selection.isCollapsed() && selection.getRng().startOffset === 0) { var previousSibling = selection.getNode().previousSibling; if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "table") { e2.preventDefault(); return false; } } } }); }; var removeBlockQuoteOnBackSpace = function() { editor.on("keydown", function(e2) { var rng, parent3; if (isDefaultPrevented(e2) || e2.keyCode !== VK.BACKSPACE) { return; } rng = selection.getRng(); var container = rng.startContainer; var offset4 = rng.startOffset; var root2 = dom2.getRoot(); parent3 = container; if (!rng.collapsed || offset4 !== 0) { return; } while (parent3 && parent3.parentNode && parent3.parentNode.firstChild === parent3 && parent3.parentNode !== root2) { parent3 = parent3.parentNode; } if (parent3.tagName === "BLOCKQUOTE") { editor.formatter.toggle("blockquote", null, parent3); rng = dom2.createRng(); rng.setStart(container, 0); rng.setEnd(container, 0); selection.setRng(rng); } }); }; var setGeckoEditingOptions = function() { var setOpts = function() { setEditorCommandState2("StyleWithCSS", false); setEditorCommandState2("enableInlineTableEditing", false); if (!getObjectResizing(editor)) { setEditorCommandState2("enableObjectResizing", false); } }; if (!isReadOnly$1(editor)) { editor.on("BeforeExecCommand mousedown", setOpts); } }; var addBrAfterLastLinks = function() { var fixLinks = function() { each3(dom2.select("a"), function(node) { var parentNode = node.parentNode; var root2 = dom2.getRoot(); if (parentNode.lastChild === node) { while (parentNode && !dom2.isBlock(parentNode)) { if (parentNode.parentNode.lastChild !== parentNode || parentNode === root2) { return; } parentNode = parentNode.parentNode; } dom2.add(parentNode, "br", { "data-mce-bogus": 1 }); } }); }; editor.on("SetContent ExecCommand", function(e2) { if (e2.type === "setcontent" || e2.command === "mceInsertLink") { fixLinks(); } }); }; var setDefaultBlockType = function() { if (getForcedRootBlock(editor)) { editor.on("init", function() { setEditorCommandState2("DefaultParagraphSeparator", getForcedRootBlock(editor)); }); } }; var normalizeSelection2 = function() { editor.on("keyup focusin mouseup", function(e2) { if (!VK.modifierPressed(e2)) { selection.normalize(); } }, true); }; var showBrokenImageIcon = function() { editor.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}"); }; var restoreFocusOnKeyDown = function() { if (!editor.inline) { editor.on("keydown", function() { if (document.activeElement === document.body) { editor.getWin().focus(); } }); } }; var bodyHeight = function() { if (!editor.inline) { editor.contentStyles.push("body {min-height: 150px}"); editor.on("click", function(e2) { var rng; if (e2.target.nodeName === "HTML") { if (Env.ie > 11) { editor.getBody().focus(); return; } rng = editor.selection.getRng(); editor.getBody().focus(); editor.selection.setRng(rng); editor.selection.normalize(); editor.nodeChanged(); } }); } }; var blockCmdArrowNavigation = function() { if (Env.mac) { editor.on("keydown", function(e2) { if (VK.metaKeyPressed(e2) && !e2.shiftKey && (e2.keyCode === 37 || e2.keyCode === 39)) { e2.preventDefault(); var selection_1 = editor.selection.getSel(); selection_1.modify("move", e2.keyCode === 37 ? "backward" : "forward", "lineboundary"); } }); } }; var disableAutoUrlDetect = function() { setEditorCommandState2("AutoUrlDetect", false); }; var tapLinksAndImages = function() { editor.on("click", function(e2) { var elm = e2.target; do { if (elm.tagName === "A") { e2.preventDefault(); return; } } while (elm = elm.parentNode); }); editor.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}"); }; var blockFormSubmitInsideEditor = function() { editor.on("init", function() { editor.dom.bind(editor.getBody(), "submit", function(e2) { e2.preventDefault(); }); }); }; var removeAppleInterchangeBrs = function() { parser.addNodeFilter("br", function(nodes2) { var i2 = nodes2.length; while (i2--) { if (nodes2[i2].attr("class") === "Apple-interchange-newline") { nodes2[i2].remove(); } } }); }; var ieInternalDragAndDrop = function() { editor.on("dragstart", function(e2) { setMceInternalContent(e2); }); editor.on("drop", function(e2) { if (!isDefaultPrevented(e2)) { var internalContent = getMceInternalContent(e2); if (internalContent && internalContent.id !== editor.id) { e2.preventDefault(); var rng = fromPoint(e2.x, e2.y, editor.getDoc()); selection.setRng(rng); insertClipboardContents(internalContent.html, true); } } }); }; var refreshContentEditable = noop2; var isHidden2 = function() { if (!isGecko || editor.removed) { return false; } var sel = editor.selection.getSel(); return !sel || !sel.rangeCount || sel.rangeCount === 0; }; var setupRtc = function() { if (isWebKit) { documentElementEditingFocus(); selectControlElements(); blockFormSubmitInsideEditor(); selectAll(); if (Env.iOS) { restoreFocusOnKeyDown(); bodyHeight(); tapLinksAndImages(); } } if (isGecko) { focusBody2(); setGeckoEditingOptions(); showBrokenImageIcon(); blockCmdArrowNavigation(); } }; var setup124 = function() { removeBlockQuoteOnBackSpace(); emptyEditorWhenDeleting(); if (!Env.windowsPhone) { normalizeSelection2(); } if (isWebKit) { documentElementEditingFocus(); selectControlElements(); setDefaultBlockType(); blockFormSubmitInsideEditor(); disableBackspaceIntoATable(); removeAppleInterchangeBrs(); if (Env.iOS) { restoreFocusOnKeyDown(); bodyHeight(); tapLinksAndImages(); } else { selectAll(); } } if (Env.ie >= 11) { bodyHeight(); disableBackspaceIntoATable(); } if (Env.ie) { selectAll(); disableAutoUrlDetect(); ieInternalDragAndDrop(); } if (isGecko) { removeHrOnBackspace(); focusBody2(); removeStylesWhenDeletingAcrossBlockElements(); setGeckoEditingOptions(); addBrAfterLastLinks(); showBrokenImageIcon(); blockCmdArrowNavigation(); disableBackspaceIntoATable(); } }; if (isRtc(editor)) { setupRtc(); } else { setup124(); } return { refreshContentEditable, isHidden: isHidden2 }; }; var DOM$6 = DOMUtils.DOM; var appendStyle = function(editor, text) { var body = SugarElement.fromDom(editor.getBody()); var container = getStyleContainer(getRootNode(body)); var style = SugarElement.fromTag("style"); set$12(style, "type", "text/css"); append$1(style, SugarElement.fromText(text)); append$1(container, style); editor.on("remove", function() { remove$7(style); }); }; var getRootName = function(editor) { return editor.inline ? editor.getElement().nodeName.toLowerCase() : void 0; }; var removeUndefined = function(obj) { return filter$3(obj, function(v2) { return isUndefined2(v2) === false; }); }; var mkSchemaSettings = function(editor) { var settings = editor.settings; return removeUndefined({ block_elements: settings.block_elements, boolean_attributes: settings.boolean_attributes, custom_elements: settings.custom_elements, extended_valid_elements: settings.extended_valid_elements, invalid_elements: settings.invalid_elements, invalid_styles: settings.invalid_styles, move_caret_before_on_enter_elements: settings.move_caret_before_on_enter_elements, non_empty_elements: settings.non_empty_elements, schema: settings.schema, self_closing_elements: settings.self_closing_elements, short_ended_elements: settings.short_ended_elements, special: settings.special, text_block_elements: settings.text_block_elements, text_inline_elements: settings.text_inline_elements, valid_children: settings.valid_children, valid_classes: settings.valid_classes, valid_elements: settings.valid_elements, valid_styles: settings.valid_styles, verify_html: settings.verify_html, whitespace_elements: settings.whitespace_elements, padd_empty_block_inline_children: settings.format_empty_lines }); }; var mkParserSettings = function(editor) { var settings = editor.settings; var blobCache = editor.editorUpload.blobCache; return removeUndefined({ allow_conditional_comments: settings.allow_conditional_comments, allow_html_data_urls: settings.allow_html_data_urls, allow_svg_data_urls: settings.allow_svg_data_urls, allow_html_in_named_anchor: settings.allow_html_in_named_anchor, allow_script_urls: settings.allow_script_urls, allow_unsafe_link_target: settings.allow_unsafe_link_target, convert_fonts_to_spans: settings.convert_fonts_to_spans, fix_list_elements: settings.fix_list_elements, font_size_legacy_values: settings.font_size_legacy_values, forced_root_block: settings.forced_root_block, forced_root_block_attrs: settings.forced_root_block_attrs, padd_empty_with_br: settings.padd_empty_with_br, preserve_cdata: settings.preserve_cdata, remove_trailing_brs: settings.remove_trailing_brs, inline_styles: settings.inline_styles, root_name: getRootName(editor), validate: true, blob_cache: blobCache, document: editor.getDoc(), images_dataimg_filter: settings.images_dataimg_filter }); }; var mkSerializerSettings = function(editor) { var settings = editor.settings; return __assign(__assign(__assign({}, mkParserSettings(editor)), mkSchemaSettings(editor)), removeUndefined({ url_converter: settings.url_converter, url_converter_scope: settings.url_converter_scope, element_format: settings.element_format, entities: settings.entities, entity_encoding: settings.entity_encoding, indent: settings.indent, indent_after: settings.indent_after, indent_before: settings.indent_before })); }; var createParser = function(editor) { var parser = DomParser(mkParserSettings(editor), editor.schema); parser.addAttributeFilter("src,href,style,tabindex", function(nodes2, name2) { var i2 = nodes2.length, node, value25; var dom2 = editor.dom; var internalName = "data-mce-" + name2; while (i2--) { node = nodes2[i2]; value25 = node.attr(name2); if (value25 && !node.attr(internalName)) { if (value25.indexOf("data:") === 0 || value25.indexOf("blob:") === 0) { continue; } if (name2 === "style") { value25 = dom2.serializeStyle(dom2.parseStyle(value25), node.name); if (!value25.length) { value25 = null; } node.attr(internalName, value25); node.attr(name2, value25); } else if (name2 === "tabindex") { node.attr(internalName, value25); node.attr(name2, null); } else { node.attr(internalName, editor.convertURL(value25, name2, node.name)); } } } }); parser.addNodeFilter("script", function(nodes2) { var i2 = nodes2.length; while (i2--) { var node = nodes2[i2]; var type3 = node.attr("type") || "no/type"; if (type3.indexOf("mce-") !== 0) { node.attr("type", "mce-" + type3); } } }); if (editor.settings.preserve_cdata) { parser.addNodeFilter("#cdata", function(nodes2) { var i2 = nodes2.length; while (i2--) { var node = nodes2[i2]; node.type = 8; node.name = "#comment"; node.value = "[CDATA[" + editor.dom.encode(node.value) + "]]"; } }); } parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div", function(nodes2) { var i2 = nodes2.length; var nonEmptyElements = editor.schema.getNonEmptyElements(); while (i2--) { var node = nodes2[i2]; if (node.isEmpty(nonEmptyElements) && node.getAll("br").length === 0) { node.append(new AstNode("br", 1)).shortEnded = true; } } }); return parser; }; var autoFocus = function(editor) { if (editor.settings.auto_focus) { Delay.setEditorTimeout(editor, function() { var focusEditor2; if (editor.settings.auto_focus === true) { focusEditor2 = editor; } else { focusEditor2 = editor.editorManager.get(editor.settings.auto_focus); } if (!focusEditor2.destroyed) { focusEditor2.focus(); } }, 100); } }; var moveSelectionToFirstCaretPosition = function(editor) { var root2 = editor.dom.getRoot(); if (!editor.inline && (!hasAnyRanges(editor) || editor.selection.getStart(true) === root2)) { firstPositionIn(root2).each(function(pos) { var node = pos.getNode(); var caretPos = isTable$3(node) ? firstPositionIn(node).getOr(pos) : pos; if (Env.browser.isIE()) { storeNative(editor, caretPos.toRange()); } else { editor.selection.setRng(caretPos.toRange()); } }); } }; var initEditor = function(editor) { editor.bindPendingEventDelegates(); editor.initialized = true; fireInit(editor); editor.focus(true); moveSelectionToFirstCaretPosition(editor); editor.nodeChanged({ initial: true }); editor.execCallback("init_instance_callback", editor); autoFocus(editor); }; var getStyleSheetLoader$1 = function(editor) { return editor.inline ? editor.ui.styleSheetLoader : editor.dom.styleSheetLoader; }; var makeStylesheetLoadingPromises = function(editor, css2, framedFonts) { var promises = [new promiseObj(function(resolve2, reject) { return getStyleSheetLoader$1(editor).loadAll(css2, resolve2, reject); })]; if (editor.inline) { return promises; } else { return promises.concat([new promiseObj(function(resolve2, reject) { return editor.ui.styleSheetLoader.loadAll(framedFonts, resolve2, reject); })]); } }; var loadContentCss = function(editor) { var styleSheetLoader = getStyleSheetLoader$1(editor); var fontCss = getFontCss(editor); var css2 = editor.contentCSS; var removeCss = function() { styleSheetLoader.unloadAll(css2); if (!editor.inline) { editor.ui.styleSheetLoader.unloadAll(fontCss); } }; var loaded2 = function() { if (editor.removed) { removeCss(); } else { editor.on("remove", removeCss); } }; if (editor.contentStyles.length > 0) { var contentCssText_1 = ""; Tools.each(editor.contentStyles, function(style) { contentCssText_1 += style + "\r\n"; }); editor.dom.addStyle(contentCssText_1); } var allStylesheets = promiseObj.all(makeStylesheetLoadingPromises(editor, css2, fontCss)).then(loaded2).catch(loaded2); if (editor.settings.content_style) { appendStyle(editor, editor.settings.content_style); } return allStylesheets; }; var preInit = function(editor) { var settings = editor.settings, doc2 = editor.getDoc(), body = editor.getBody(); firePreInit(editor); if (!settings.browser_spellcheck && !settings.gecko_spellcheck) { doc2.body.spellcheck = false; DOM$6.setAttrib(body, "spellcheck", "false"); } editor.quirks = Quirks(editor); firePostRender(editor); var directionality = getDirectionality(editor); if (directionality !== void 0) { body.dir = directionality; } if (settings.protect) { editor.on("BeforeSetContent", function(e2) { Tools.each(settings.protect, function(pattern2) { e2.content = e2.content.replace(pattern2, function(str) { return ""; }); }); }); } editor.on("SetContent", function() { editor.addVisual(editor.getBody()); }); editor.on("compositionstart compositionend", function(e2) { editor.composing = e2.type === "compositionstart"; }); }; var loadInitialContent = function(editor) { if (!isRtc(editor)) { editor.load({ initial: true, format: "html" }); } editor.startContent = editor.getContent({ format: "raw" }); }; var initEditorWithInitialContent = function(editor) { if (editor.removed !== true) { loadInitialContent(editor); initEditor(editor); } }; var initContentBody = function(editor, skipWrite) { var settings = editor.settings; var targetElm = editor.getElement(); var doc2 = editor.getDoc(); if (!settings.inline) { editor.getElement().style.visibility = editor.orgVisibility; } if (!skipWrite && !editor.inline) { doc2.open(); doc2.write(editor.iframeHTML); doc2.close(); } if (editor.inline) { DOM$6.addClass(targetElm, "mce-content-body"); editor.contentDocument = doc2 = document; editor.contentWindow = window; editor.bodyElement = targetElm; editor.contentAreaContainer = targetElm; } var body = editor.getBody(); body.disabled = true; editor.readonly = !!settings.readonly; if (!editor.readonly) { if (editor.inline && DOM$6.getStyle(body, "position", true) === "static") { body.style.position = "relative"; } body.contentEditable = editor.getParam("content_editable_state", true); } body.disabled = false; editor.editorUpload = EditorUpload(editor); editor.schema = Schema2(mkSchemaSettings(editor)); editor.dom = DOMUtils(doc2, { keep_values: true, url_converter: editor.convertURL, url_converter_scope: editor, hex_colors: settings.force_hex_style_colors, update_styles: true, root_element: editor.inline ? editor.getBody() : null, collect: function() { return editor.inline; }, schema: editor.schema, contentCssCors: shouldUseContentCssCors(editor), referrerPolicy: getReferrerPolicy(editor), onSetAttrib: function(e2) { editor.fire("SetAttrib", e2); } }); editor.parser = createParser(editor); editor.serializer = DomSerializer(mkSerializerSettings(editor), editor); editor.selection = EditorSelection(editor.dom, editor.getWin(), editor.serializer, editor); editor.annotator = Annotator(editor); editor.formatter = Formatter(editor); editor.undoManager = UndoManager(editor); editor._nodeChangeDispatcher = new NodeChange(editor); editor._selectionOverrides = SelectionOverrides(editor); setup$e(editor); setup$3(editor); if (!isRtc(editor)) { setup$2(editor); } var caret = setup$4(editor); setup$f(editor, caret); setup$d(editor); setup$g(editor); var setupRtcThunk = setup$i(editor); preInit(editor); setupRtcThunk.fold(function() { loadContentCss(editor).then(function() { return initEditorWithInitialContent(editor); }); }, function(setupRtc) { editor.setProgressState(true); loadContentCss(editor).then(function() { setupRtc().then(function(_rtcMode) { editor.setProgressState(false); initEditorWithInitialContent(editor); }, function(err) { editor.notificationManager.open({ type: "error", text: String(err) }); initEditorWithInitialContent(editor); }); }); }); }; var DOM$5 = DOMUtils.DOM; var relaxDomain = function(editor, ifr) { if (document.domain !== window.location.hostname && Env.browser.isIE()) { var bodyUuid = uuid2("mce"); editor[bodyUuid] = function() { initContentBody(editor); }; var domainRelaxUrl = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinymce.get("' + editor.id + '");document.write(ed.iframeHTML);document.close();ed.' + bodyUuid + "(true);})()"; DOM$5.setAttrib(ifr, "src", domainRelaxUrl); return true; } return false; }; var createIframeElement = function(id2, title, height, customAttrs) { var iframe = SugarElement.fromTag("iframe"); setAll$1(iframe, customAttrs); setAll$1(iframe, { id: id2 + "_ifr", frameBorder: "0", allowTransparency: "true", title }); add$12(iframe, "tox-edit-area__iframe"); return iframe; }; var getIframeHtml = function(editor) { var iframeHTML = getDocType(editor) + ""; if (getDocumentBaseUrl(editor) !== editor.documentBaseUrl) { iframeHTML += ''; } iframeHTML += ''; var bodyId = getBodyId(editor); var bodyClass = getBodyClass(editor); var translatedAriaText = editor.translate(getIframeAriaText(editor)); if (getContentSecurityPolicy(editor)) { iframeHTML += ''; } iframeHTML += "" + ('') + "
    "; return iframeHTML; }; var createIframe = function(editor, o2) { var iframeTitle = editor.translate("Rich Text Area"); var ifr = createIframeElement(editor.id, iframeTitle, o2.height, getIframeAttrs(editor)).dom; ifr.onload = function() { ifr.onload = null; editor.fire("load"); }; var isDomainRelaxed = relaxDomain(editor, ifr); editor.contentAreaContainer = o2.iframeContainer; editor.iframeElement = ifr; editor.iframeHTML = getIframeHtml(editor); DOM$5.add(o2.iframeContainer, ifr); return isDomainRelaxed; }; var init$1 = function(editor, boxInfo) { var isDomainRelaxed = createIframe(editor, boxInfo); if (boxInfo.editorContainer) { DOM$5.get(boxInfo.editorContainer).style.display = editor.orgDisplay; editor.hidden = DOM$5.isHidden(boxInfo.editorContainer); } editor.getElement().style.display = "none"; DOM$5.setAttrib(editor.id, "aria-hidden", "true"); if (!isDomainRelaxed) { initContentBody(editor); } }; var DOM$4 = DOMUtils.DOM; var initPlugin = function(editor, initializedPlugins, plugin) { var Plugin = PluginManager.get(plugin); var pluginUrl = PluginManager.urls[plugin] || editor.documentBaseUrl.replace(/\/$/, ""); plugin = Tools.trim(plugin); if (Plugin && Tools.inArray(initializedPlugins, plugin) === -1) { Tools.each(PluginManager.dependencies(plugin), function(dep) { initPlugin(editor, initializedPlugins, dep); }); if (editor.plugins[plugin]) { return; } try { var pluginInstance = new Plugin(editor, pluginUrl, editor.$); editor.plugins[plugin] = pluginInstance; if (pluginInstance.init) { pluginInstance.init(editor, pluginUrl); initializedPlugins.push(plugin); } } catch (e2) { pluginInitError(editor, plugin, e2); } } }; var trimLegacyPrefix = function(name2) { return name2.replace(/^\-/, ""); }; var initPlugins = function(editor) { var initializedPlugins = []; Tools.each(getPlugins(editor).split(/[ ,]/), function(name2) { initPlugin(editor, initializedPlugins, trimLegacyPrefix(name2)); }); }; var initIcons = function(editor) { var iconPackName = Tools.trim(getIconPackName(editor)); var currentIcons = editor.ui.registry.getAll().icons; var loadIcons3 = __assign(__assign({}, IconManager.get("default").icons), IconManager.get(iconPackName).icons); each$j(loadIcons3, function(svgData, icon) { if (!has$22(currentIcons, icon)) { editor.ui.registry.addIcon(icon, svgData); } }); }; var initTheme = function(editor) { var theme = getTheme(editor); if (isString$12(theme)) { editor.settings.theme = trimLegacyPrefix(theme); var Theme = ThemeManager.get(theme); editor.theme = new Theme(editor, ThemeManager.urls[theme]); if (editor.theme.init) { editor.theme.init(editor, ThemeManager.urls[theme] || editor.documentBaseUrl.replace(/\/$/, ""), editor.$); } } else { editor.theme = {}; } }; var renderFromLoadedTheme = function(editor) { return editor.theme.renderUI(); }; var renderFromThemeFunc = function(editor) { var elm = editor.getElement(); var theme = getTheme(editor); var info3 = theme(editor, elm); if (info3.editorContainer.nodeType) { info3.editorContainer.id = info3.editorContainer.id || editor.id + "_parent"; } if (info3.iframeContainer && info3.iframeContainer.nodeType) { info3.iframeContainer.id = info3.iframeContainer.id || editor.id + "_iframecontainer"; } info3.height = info3.iframeHeight ? info3.iframeHeight : elm.offsetHeight; return info3; }; var createThemeFalseResult = function(element) { return { editorContainer: element, iframeContainer: element, api: {} }; }; var renderThemeFalseIframe = function(targetElement) { var iframeContainer = DOM$4.create("div"); DOM$4.insertAfter(iframeContainer, targetElement); return createThemeFalseResult(iframeContainer); }; var renderThemeFalse = function(editor) { var targetElement = editor.getElement(); return editor.inline ? createThemeFalseResult(null) : renderThemeFalseIframe(targetElement); }; var renderThemeUi = function(editor) { var elm = editor.getElement(); editor.orgDisplay = elm.style.display; if (isString$12(getTheme(editor))) { return renderFromLoadedTheme(editor); } else if (isFunction3(getTheme(editor))) { return renderFromThemeFunc(editor); } else { return renderThemeFalse(editor); } }; var augmentEditorUiApi = function(editor, api3) { var uiApiFacade = { show: Optional.from(api3.show).getOr(noop2), hide: Optional.from(api3.hide).getOr(noop2), disable: Optional.from(api3.disable).getOr(noop2), isDisabled: Optional.from(api3.isDisabled).getOr(never), enable: function() { if (!editor.mode.isReadOnly()) { Optional.from(api3.enable).map(call2); } } }; editor.ui = __assign(__assign({}, editor.ui), uiApiFacade); }; var init = function(editor) { editor.fire("ScriptsLoaded"); initIcons(editor); initTheme(editor); initPlugins(editor); var renderInfo = renderThemeUi(editor); augmentEditorUiApi(editor, Optional.from(renderInfo.api).getOr({})); var boxInfo = { editorContainer: renderInfo.editorContainer, iframeContainer: renderInfo.iframeContainer }; editor.editorContainer = boxInfo.editorContainer ? boxInfo.editorContainer : null; appendContentCssFromSettings(editor); if (editor.inline) { return initContentBody(editor); } else { return init$1(editor, boxInfo); } }; var DOM$3 = DOMUtils.DOM; var hasSkipLoadPrefix = function(name2) { return name2.charAt(0) === "-"; }; var loadLanguage = function(scriptLoader, editor) { var languageCode = getLanguageCode(editor); var languageUrl = getLanguageUrl(editor); if (I18n.hasCode(languageCode) === false && languageCode !== "en") { var url_1 = languageUrl !== "" ? languageUrl : editor.editorManager.baseURL + "/langs/" + languageCode + ".js"; scriptLoader.add(url_1, noop2, void 0, function() { languageLoadError(editor, url_1, languageCode); }); } }; var loadTheme = function(scriptLoader, editor, suffix, callback2) { var theme = getTheme(editor); if (isString$12(theme)) { if (!hasSkipLoadPrefix(theme) && !has$22(ThemeManager.urls, theme)) { var themeUrl = getThemeUrl(editor); if (themeUrl) { ThemeManager.load(theme, editor.documentBaseURI.toAbsolute(themeUrl)); } else { ThemeManager.load(theme, "themes/" + theme + "/theme" + suffix + ".js"); } } scriptLoader.loadQueue(function() { ThemeManager.waitFor(theme, callback2); }); } else { callback2(); } }; var getIconsUrlMetaFromUrl = function(editor) { return Optional.from(getIconsUrl(editor)).filter(function(url2) { return url2.length > 0; }).map(function(url2) { return { url: url2, name: Optional.none() }; }); }; var getIconsUrlMetaFromName = function(editor, name2, suffix) { return Optional.from(name2).filter(function(name3) { return name3.length > 0 && !IconManager.has(name3); }).map(function(name3) { return { url: editor.editorManager.baseURL + "/icons/" + name3 + "/icons" + suffix + ".js", name: Optional.some(name3) }; }); }; var loadIcons2 = function(scriptLoader, editor, suffix) { var defaultIconsUrl = getIconsUrlMetaFromName(editor, "default", suffix); var customIconsUrl = getIconsUrlMetaFromUrl(editor).orThunk(function() { return getIconsUrlMetaFromName(editor, getIconPackName(editor), ""); }); each$k(cat([ defaultIconsUrl, customIconsUrl ]), function(urlMeta) { scriptLoader.add(urlMeta.url, noop2, void 0, function() { iconsLoadError(editor, urlMeta.url, urlMeta.name.getOrUndefined()); }); }); }; var loadPlugins = function(editor, suffix) { Tools.each(getExternalPlugins$1(editor), function(url2, name2) { PluginManager.load(name2, url2, noop2, void 0, function() { pluginLoadError(editor, url2, name2); }); editor.settings.plugins += " " + name2; }); Tools.each(getPlugins(editor).split(/[ ,]/), function(plugin) { plugin = Tools.trim(plugin); if (plugin && !PluginManager.urls[plugin]) { if (hasSkipLoadPrefix(plugin)) { plugin = plugin.substr(1, plugin.length); var dependencies = PluginManager.dependencies(plugin); Tools.each(dependencies, function(depPlugin) { var defaultSettings = { prefix: "plugins/", resource: depPlugin, suffix: "/plugin" + suffix + ".js" }; var dep = PluginManager.createUrl(defaultSettings, depPlugin); PluginManager.load(dep.resource, dep, noop2, void 0, function() { pluginLoadError(editor, dep.prefix + dep.resource + dep.suffix, dep.resource); }); }); } else { var url_2 = { prefix: "plugins/", resource: plugin, suffix: "/plugin" + suffix + ".js" }; PluginManager.load(plugin, url_2, noop2, void 0, function() { pluginLoadError(editor, url_2.prefix + url_2.resource + url_2.suffix, plugin); }); } } }); }; var loadScripts = function(editor, suffix) { var scriptLoader = ScriptLoader.ScriptLoader; loadTheme(scriptLoader, editor, suffix, function() { loadLanguage(scriptLoader, editor); loadIcons2(scriptLoader, editor, suffix); loadPlugins(editor, suffix); scriptLoader.loadQueue(function() { if (!editor.removed) { init(editor); } }, editor, function() { if (!editor.removed) { init(editor); } }); }); }; var getStyleSheetLoader = function(element, editor) { return instance.forElement(element, { contentCssCors: hasContentCssCors(editor), referrerPolicy: getReferrerPolicy(editor) }); }; var render123 = function(editor) { var id2 = editor.id; I18n.setCode(getLanguageCode(editor)); var readyHandler = function() { DOM$3.unbind(window, "ready", readyHandler); editor.render(); }; if (!EventUtils.Event.domLoaded) { DOM$3.bind(window, "ready", readyHandler); return; } if (!editor.getElement()) { return; } if (!Env.contentEditable) { return; } var element = SugarElement.fromDom(editor.getElement()); var snapshot = clone$3(element); editor.on("remove", function() { eachr(element.dom.attributes, function(attr) { return remove$6(element, attr.name); }); setAll$1(element, snapshot); }); editor.ui.styleSheetLoader = getStyleSheetLoader(element, editor); if (!isInline(editor)) { editor.orgVisibility = editor.getElement().style.visibility; editor.getElement().style.visibility = "hidden"; } else { editor.inline = true; } var form = editor.getElement().form || DOM$3.getParent(id2, "form"); if (form) { editor.formElement = form; if (hasHiddenInput(editor) && !isTextareaOrInput(editor.getElement())) { DOM$3.insertAfter(DOM$3.create("input", { type: "hidden", name: id2 }), id2); editor.hasHiddenInput = true; } editor.formEventDelegate = function(e2) { editor.fire(e2.type, e2); }; DOM$3.bind(form, "submit reset", editor.formEventDelegate); editor.on("reset", function() { editor.resetContent(); }); if (shouldPatchSubmit(editor) && !form.submit.nodeType && !form.submit.length && !form._mceOldSubmit) { form._mceOldSubmit = form.submit; form.submit = function() { editor.editorManager.triggerSave(); editor.setDirty(false); return form._mceOldSubmit(form); }; } } editor.windowManager = WindowManager(editor); editor.notificationManager = NotificationManager(editor); if (isEncodingXml(editor)) { editor.on("GetContent", function(e2) { if (e2.save) { e2.content = DOM$3.encode(e2.content); } }); } if (shouldAddFormSubmitTrigger(editor)) { editor.on("submit", function() { if (editor.initialized) { editor.save(); } }); } if (shouldAddUnloadTrigger(editor)) { editor._beforeUnload = function() { if (editor.initialized && !editor.destroyed && !editor.isHidden()) { editor.save({ format: "raw", no_events: true, set_dirty: false }); } }; editor.editorManager.on("BeforeUnload", editor._beforeUnload); } editor.editorManager.add(editor); loadScripts(editor, editor.suffix); }; var addVisual = function(editor, elm) { return addVisual$1(editor, elm); }; var legacyPropNames = { "font-size": "size", "font-family": "face" }; var getSpecifiedFontProp = function(propName, rootElm, elm) { var getProperty = function(elm2) { return getRaw(elm2, propName).orThunk(function() { if (name(elm2) === "font") { return get$9(legacyPropNames, propName).bind(function(legacyPropName) { return getOpt(elm2, legacyPropName); }); } else { return Optional.none(); } }); }; var isRoot = function(elm2) { return eq2(SugarElement.fromDom(rootElm), elm2); }; return closest$1(SugarElement.fromDom(elm), function(elm2) { return getProperty(elm2); }, isRoot); }; var normalizeFontFamily = function(fontFamily) { return fontFamily.replace(/[\'\"\\]/g, "").replace(/,\s+/g, ","); }; var getComputedFontProp = function(propName, elm) { return Optional.from(DOMUtils.DOM.getStyle(elm, propName, true)); }; var getFontProp = function(propName) { return function(rootElm, elm) { return Optional.from(elm).map(SugarElement.fromDom).filter(isElement$6).bind(function(element) { return getSpecifiedFontProp(propName, rootElm, element.dom).or(getComputedFontProp(propName, element.dom)); }).getOr(""); }; }; var getFontSize = getFontProp("font-size"); var getFontFamily = compose(normalizeFontFamily, getFontProp("font-family")); var findFirstCaretElement = function(editor) { return firstPositionIn(editor.getBody()).map(function(caret) { var container = caret.container(); return isText$7(container) ? container.parentNode : container; }); }; var getCaretElement = function(editor) { return Optional.from(editor.selection.getRng()).bind(function(rng) { var root2 = editor.getBody(); var atStartOfNode = rng.startContainer === root2 && rng.startOffset === 0; return atStartOfNode ? Optional.none() : Optional.from(editor.selection.getStart(true)); }); }; var bindRange = function(editor, binder) { return getCaretElement(editor).orThunk(curry(findFirstCaretElement, editor)).map(SugarElement.fromDom).filter(isElement$6).bind(binder); }; var mapRange = function(editor, mapper) { return bindRange(editor, compose1(Optional.some, mapper)); }; var fromFontSizeNumber = function(editor, value25) { if (/^[0-9.]+$/.test(value25)) { var fontSizeNumber = parseInt(value25, 10); if (fontSizeNumber >= 1 && fontSizeNumber <= 7) { var fontSizes = getFontStyleValues(editor); var fontClasses = getFontSizeClasses(editor); if (fontClasses) { return fontClasses[fontSizeNumber - 1] || value25; } else { return fontSizes[fontSizeNumber - 1] || value25; } } else { return value25; } } else { return value25; } }; var normalizeFontNames = function(font) { var fonts = font.split(/\s*,\s*/); return map$3(fonts, function(font2) { if (font2.indexOf(" ") !== -1 && !(startsWith(font2, '"') || startsWith(font2, "'"))) { return "'" + font2 + "'"; } else { return font2; } }).join(","); }; var fontNameAction = function(editor, value25) { var font = fromFontSizeNumber(editor, value25); editor.formatter.toggle("fontname", { value: normalizeFontNames(font) }); editor.nodeChanged(); }; var fontNameQuery = function(editor) { return mapRange(editor, function(elm) { return getFontFamily(editor.getBody(), elm.dom); }).getOr(""); }; var fontSizeAction = function(editor, value25) { editor.formatter.toggle("fontsize", { value: fromFontSizeNumber(editor, value25) }); editor.nodeChanged(); }; var fontSizeQuery = function(editor) { return mapRange(editor, function(elm) { return getFontSize(editor.getBody(), elm.dom); }).getOr(""); }; var lineHeightQuery = function(editor) { return mapRange(editor, function(elm) { var root2 = SugarElement.fromDom(editor.getBody()); var specifiedStyle = closest$1(elm, function(elm2) { return getRaw(elm2, "line-height"); }, curry(eq2, root2)); var computedStyle = function() { var lineHeight = parseFloat(get$5(elm, "line-height")); var fontSize = parseFloat(get$5(elm, "font-size")); return String(lineHeight / fontSize); }; return specifiedStyle.getOrThunk(computedStyle); }).getOr(""); }; var lineHeightAction = function(editor, lineHeight) { editor.formatter.toggle("lineheight", { value: String(lineHeight) }); editor.nodeChanged(); }; var processValue = function(value25) { if (typeof value25 !== "string") { var details = Tools.extend({ paste: value25.paste, data: { paste: value25.paste } }, value25); return { content: value25.content, details }; } return { content: value25, details: {} }; }; var insertAtCaret = function(editor, value25) { var result = processValue(value25); insertContent(editor, result.content, result.details); }; var each$4 = Tools.each; var map2 = Tools.map, inArray = Tools.inArray; var EditorCommands = function() { function EditorCommands2(editor) { this.commands = { state: {}, exec: {}, value: {} }; this.editor = editor; this.setupCommands(editor); } EditorCommands2.prototype.execCommand = function(command, ui, value25, args) { var func, state = false; var self2 = this; if (self2.editor.removed) { return; } if (command.toLowerCase() !== "mcefocus") { if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) { self2.editor.focus(); } else { restore(self2.editor); } } args = self2.editor.fire("BeforeExecCommand", { command, ui, value: value25 }); if (args.isDefaultPrevented()) { return false; } var customCommand = command.toLowerCase(); if (func = self2.commands.exec[customCommand]) { func(customCommand, ui, value25); self2.editor.fire("ExecCommand", { command, ui, value: value25 }); return true; } each$4(this.editor.plugins, function(p) { if (p.execCommand && p.execCommand(command, ui, value25)) { self2.editor.fire("ExecCommand", { command, ui, value: value25 }); state = true; return false; } }); if (state) { return state; } if (self2.editor.theme && self2.editor.theme.execCommand && self2.editor.theme.execCommand(command, ui, value25)) { self2.editor.fire("ExecCommand", { command, ui, value: value25 }); return true; } try { state = self2.editor.getDoc().execCommand(command, ui, value25); } catch (ex) { } if (state) { self2.editor.fire("ExecCommand", { command, ui, value: value25 }); return true; } return false; }; EditorCommands2.prototype.queryCommandState = function(command) { var func; if (this.editor.quirks.isHidden() || this.editor.removed) { return; } command = command.toLowerCase(); if (func = this.commands.state[command]) { return func(command); } try { return this.editor.getDoc().queryCommandState(command); } catch (ex) { } return false; }; EditorCommands2.prototype.queryCommandValue = function(command) { var func; if (this.editor.quirks.isHidden() || this.editor.removed) { return; } command = command.toLowerCase(); if (func = this.commands.value[command]) { return func(command); } try { return this.editor.getDoc().queryCommandValue(command); } catch (ex) { } }; EditorCommands2.prototype.addCommands = function(commandList, type3) { if (type3 === void 0) { type3 = "exec"; } var self2 = this; each$4(commandList, function(callback2, command) { each$4(command.toLowerCase().split(","), function(command2) { self2.commands[type3][command2] = callback2; }); }); }; EditorCommands2.prototype.addCommand = function(command, callback2, scope) { var _this = this; command = command.toLowerCase(); this.commands.exec[command] = function(command2, ui, value25, args) { return callback2.call(scope || _this.editor, ui, value25, args); }; }; EditorCommands2.prototype.queryCommandSupported = function(command) { command = command.toLowerCase(); if (this.commands.exec[command]) { return true; } try { return this.editor.getDoc().queryCommandSupported(command); } catch (ex) { } return false; }; EditorCommands2.prototype.addQueryStateHandler = function(command, callback2, scope) { var _this = this; command = command.toLowerCase(); this.commands.state[command] = function() { return callback2.call(scope || _this.editor); }; }; EditorCommands2.prototype.addQueryValueHandler = function(command, callback2, scope) { var _this = this; command = command.toLowerCase(); this.commands.value[command] = function() { return callback2.call(scope || _this.editor); }; }; EditorCommands2.prototype.hasCustomCommand = function(command) { command = command.toLowerCase(); return !!this.commands.exec[command]; }; EditorCommands2.prototype.execNativeCommand = function(command, ui, value25) { if (ui === void 0) { ui = false; } if (value25 === void 0) { value25 = null; } return this.editor.getDoc().execCommand(command, ui, value25); }; EditorCommands2.prototype.isFormatMatch = function(name2) { return this.editor.formatter.match(name2); }; EditorCommands2.prototype.toggleFormat = function(name2, value25) { this.editor.formatter.toggle(name2, value25); this.editor.nodeChanged(); }; EditorCommands2.prototype.storeSelection = function(type3) { this.selectionBookmark = this.editor.selection.getBookmark(type3); }; EditorCommands2.prototype.restoreSelection = function() { this.editor.selection.moveToBookmark(this.selectionBookmark); }; EditorCommands2.prototype.setupCommands = function(editor) { var self2 = this; this.addCommands({ "mceResetDesignMode,mceBeginUndoLevel": noop2, "mceEndUndoLevel,mceAddUndoLevel": function() { editor.undoManager.add(); }, "mceFocus": function(_command, _ui, value25) { focus25(editor, value25); }, "Cut,Copy,Paste": function(command) { var doc2 = editor.getDoc(); var failed; try { self2.execNativeCommand(command); } catch (ex) { failed = true; } if (command === "paste" && !doc2.queryCommandEnabled(command)) { failed = true; } if (failed || !doc2.queryCommandSupported(command)) { var msg = editor.translate("Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead."); if (Env.mac) { msg = msg.replace(/Ctrl\+/g, "\u2318+"); } editor.notificationManager.open({ text: msg, type: "error" }); } }, "unlink": function() { if (editor.selection.isCollapsed()) { var elm = editor.dom.getParent(editor.selection.getStart(), "a"); if (elm) { editor.dom.remove(elm, true); } return; } editor.formatter.remove("link"); }, "JustifyLeft,JustifyCenter,JustifyRight,JustifyFull,JustifyNone": function(command) { var align = command.substring(7); if (align === "full") { align = "justify"; } each$4("left,center,right,justify".split(","), function(name2) { if (align !== name2) { editor.formatter.remove("align" + name2); } }); if (align !== "none") { self2.toggleFormat("align" + align); } }, "InsertUnorderedList,InsertOrderedList": function(command) { var listParent; self2.execNativeCommand(command); var listElm = editor.dom.getParent(editor.selection.getNode(), "ol,ul"); if (listElm) { listParent = listElm.parentNode; if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) { self2.storeSelection(); editor.dom.split(listParent, listElm); self2.restoreSelection(); } } }, "Bold,Italic,Underline,Strikethrough,Superscript,Subscript": function(command) { self2.toggleFormat(command); }, "ForeColor,HiliteColor": function(command, ui, value25) { self2.toggleFormat(command, { value: value25 }); }, "FontName": function(command, ui, value25) { fontNameAction(editor, value25); }, "FontSize": function(command, ui, value25) { fontSizeAction(editor, value25); }, "LineHeight": function(command, ui, value25) { lineHeightAction(editor, value25); }, "Lang": function(command, ui, lang2) { self2.toggleFormat(command, { value: lang2.code, customValue: lang2.customCode }); }, "RemoveFormat": function(command) { editor.formatter.remove(command); }, "mceBlockQuote": function() { self2.toggleFormat("blockquote"); }, "FormatBlock": function(command, ui, value25) { return self2.toggleFormat(value25 || "p"); }, "mceCleanup": function() { var bookmark = editor.selection.getBookmark(); editor.setContent(editor.getContent()); editor.selection.moveToBookmark(bookmark); }, "mceRemoveNode": function(command, ui, value25) { var node = value25 || editor.selection.getNode(); if (node !== editor.getBody()) { self2.storeSelection(); editor.dom.remove(node, true); self2.restoreSelection(); } }, "mceSelectNodeDepth": function(command, ui, value25) { var counter2 = 0; editor.dom.getParent(editor.selection.getNode(), function(node) { if (node.nodeType === 1 && counter2++ === value25) { editor.selection.select(node); return false; } }, editor.getBody()); }, "mceSelectNode": function(command, ui, value25) { editor.selection.select(value25); }, "mceInsertContent": function(command, ui, value25) { insertAtCaret(editor, value25); }, "mceInsertRawHTML": function(command, ui, value25) { editor.selection.setContent("tiny_mce_marker"); var content = editor.getContent(); editor.setContent(content.replace(/tiny_mce_marker/g, function() { return value25; })); }, "mceInsertNewLine": function(command, ui, value25) { insert(editor, value25); }, "mceToggleFormat": function(command, ui, value25) { self2.toggleFormat(value25); }, "mceSetContent": function(command, ui, value25) { editor.setContent(value25); }, "Indent,Outdent": function(command) { handle(editor, command); }, "mceRepaint": noop2, "InsertHorizontalRule": function() { editor.execCommand("mceInsertContent", false, "
    "); }, "mceToggleVisualAid": function() { editor.hasVisual = !editor.hasVisual; editor.addVisual(); }, "mceReplaceContent": function(command, ui, value25) { editor.execCommand("mceInsertContent", false, value25.replace(/\{\$selection\}/g, editor.selection.getContent({ format: "text" }))); }, "mceInsertLink": function(command, ui, value25) { if (typeof value25 === "string") { value25 = { href: value25 }; } var anchor = editor.dom.getParent(editor.selection.getNode(), "a"); value25.href = value25.href.replace(/ /g, "%20"); if (!anchor || !value25.href) { editor.formatter.remove("link"); } if (value25.href) { editor.formatter.apply("link", value25, anchor); } }, "selectAll": function() { var editingHost = editor.dom.getParent(editor.selection.getStart(), isContentEditableTrue$4); if (editingHost) { var rng = editor.dom.createRng(); rng.selectNodeContents(editingHost); editor.selection.setRng(rng); } }, "mceNewDocument": function() { editor.setContent(""); }, "InsertLineBreak": function(command, ui, value25) { insert$1(editor, value25); return true; } }); var alignStates = function(name2) { return function() { var selection = editor.selection; var nodes2 = selection.isCollapsed() ? [editor.dom.getParent(selection.getNode(), editor.dom.isBlock)] : selection.getSelectedBlocks(); var matches2 = map2(nodes2, function(node) { return !!editor.formatter.matchNode(node, name2); }); return inArray(matches2, true) !== -1; }; }; self2.addCommands({ "JustifyLeft": alignStates("alignleft"), "JustifyCenter": alignStates("aligncenter"), "JustifyRight": alignStates("alignright"), "JustifyFull": alignStates("alignjustify"), "Bold,Italic,Underline,Strikethrough,Superscript,Subscript": function(command) { return self2.isFormatMatch(command); }, "mceBlockQuote": function() { return self2.isFormatMatch("blockquote"); }, "Outdent": function() { return canOutdent(editor); }, "InsertUnorderedList,InsertOrderedList": function(command) { var list = editor.dom.getParent(editor.selection.getNode(), "ul,ol"); return list && (command === "insertunorderedlist" && list.tagName === "UL" || command === "insertorderedlist" && list.tagName === "OL"); } }, "state"); self2.addCommands({ Undo: function() { editor.undoManager.undo(); }, Redo: function() { editor.undoManager.redo(); } }); self2.addQueryValueHandler("FontName", function() { return fontNameQuery(editor); }, this); self2.addQueryValueHandler("FontSize", function() { return fontSizeQuery(editor); }, this); self2.addQueryValueHandler("LineHeight", function() { return lineHeightQuery(editor); }, this); }; return EditorCommands2; }(); var internalContentEditableAttr = "data-mce-contenteditable"; var toggleClass = function(elm, cls, state) { if (has2(elm, cls) && state === false) { remove$3(elm, cls); } else if (state) { add$12(elm, cls); } }; var setEditorCommandState = function(editor, cmd, state) { try { editor.getDoc().execCommand(cmd, false, String(state)); } catch (ex) { } }; var setContentEditable = function(elm, state) { elm.dom.contentEditable = state ? "true" : "false"; }; var switchOffContentEditableTrue = function(elm) { each$k(descendants(elm, '*[contenteditable="true"]'), function(elm2) { set$12(elm2, internalContentEditableAttr, "true"); setContentEditable(elm2, false); }); }; var switchOnContentEditableTrue = function(elm) { each$k(descendants(elm, "*[" + internalContentEditableAttr + '="true"]'), function(elm2) { remove$6(elm2, internalContentEditableAttr); setContentEditable(elm2, true); }); }; var removeFakeSelection = function(editor) { Optional.from(editor.selection.getNode()).each(function(elm) { elm.removeAttribute("data-mce-selected"); }); }; var restoreFakeSelection = function(editor) { editor.selection.setRng(editor.selection.getRng()); }; var toggleReadOnly = function(editor, state) { var body = SugarElement.fromDom(editor.getBody()); toggleClass(body, "mce-content-readonly", state); if (state) { editor.selection.controlSelection.hideResizeRect(); editor._selectionOverrides.hideFakeCaret(); removeFakeSelection(editor); editor.readonly = true; setContentEditable(body, false); switchOffContentEditableTrue(body); } else { editor.readonly = false; setContentEditable(body, true); switchOnContentEditableTrue(body); setEditorCommandState(editor, "StyleWithCSS", false); setEditorCommandState(editor, "enableInlineTableEditing", false); setEditorCommandState(editor, "enableObjectResizing", false); if (hasEditorOrUiFocus(editor)) { editor.focus(); } restoreFakeSelection(editor); editor.nodeChanged(); } }; var isReadOnly = function(editor) { return editor.readonly; }; var registerFilters = function(editor) { editor.parser.addAttributeFilter("contenteditable", function(nodes2) { if (isReadOnly(editor)) { each$k(nodes2, function(node) { node.attr(internalContentEditableAttr, node.attr("contenteditable")); node.attr("contenteditable", "false"); }); } }); editor.serializer.addAttributeFilter(internalContentEditableAttr, function(nodes2) { if (isReadOnly(editor)) { each$k(nodes2, function(node) { node.attr("contenteditable", node.attr(internalContentEditableAttr)); }); } }); editor.serializer.addTempAttr(internalContentEditableAttr); }; var registerReadOnlyContentFilters = function(editor) { if (editor.serializer) { registerFilters(editor); } else { editor.on("PreInit", function() { registerFilters(editor); }); } }; var isClickEvent = function(e2) { return e2.type === "click"; }; var getAnchorHrefOpt = function(editor, elm) { var isRoot = function(elm2) { return eq2(elm2, SugarElement.fromDom(editor.getBody())); }; return closest$2(elm, "a", isRoot).bind(function(a2) { return getOpt(a2, "href"); }); }; var processReadonlyEvents = function(editor, e2) { if (isClickEvent(e2) && !VK.metaKeyPressed(e2)) { var elm = SugarElement.fromDom(e2.target); getAnchorHrefOpt(editor, elm).each(function(href) { e2.preventDefault(); if (/^#/.test(href)) { var targetEl = editor.dom.select(href + ',[name="' + removeLeading(href, "#") + '"]'); if (targetEl.length) { editor.selection.scrollIntoView(targetEl[0], true); } } else { window.open(href, "_blank", "rel=noopener noreferrer,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes"); } }); } }; var registerReadOnlySelectionBlockers = function(editor) { editor.on("ShowCaret", function(e2) { if (isReadOnly(editor)) { e2.preventDefault(); } }); editor.on("ObjectSelected", function(e2) { if (isReadOnly(editor)) { e2.preventDefault(); } }); }; var nativeEvents = Tools.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchmove touchend touchcancel", " "); var EventDispatcher = function() { function EventDispatcher2(settings) { this.bindings = {}; this.settings = settings || {}; this.scope = this.settings.scope || this; this.toggleEvent = this.settings.toggleEvent || never; } EventDispatcher2.isNative = function(name2) { return !!nativeEvents[name2.toLowerCase()]; }; EventDispatcher2.prototype.fire = function(name2, args) { var lcName = name2.toLowerCase(); var event = normalize$3(lcName, args || {}, this.scope); if (this.settings.beforeFire) { this.settings.beforeFire(event); } var handlers = this.bindings[lcName]; if (handlers) { for (var i2 = 0, l2 = handlers.length; i2 < l2; i2++) { var callback2 = handlers[i2]; if (callback2.removed) { continue; } if (callback2.once) { this.off(lcName, callback2.func); } if (event.isImmediatePropagationStopped()) { return event; } if (callback2.func.call(this.scope, event) === false) { event.preventDefault(); return event; } } } return event; }; EventDispatcher2.prototype.on = function(name2, callback2, prepend2, extra2) { if (callback2 === false) { callback2 = never; } if (callback2) { var wrappedCallback = { func: callback2, removed: false }; if (extra2) { Tools.extend(wrappedCallback, extra2); } var names2 = name2.toLowerCase().split(" "); var i2 = names2.length; while (i2--) { var currentName = names2[i2]; var handlers = this.bindings[currentName]; if (!handlers) { handlers = []; this.toggleEvent(currentName, true); } if (prepend2) { handlers = __spreadArray([wrappedCallback], handlers, true); } else { handlers = __spreadArray(__spreadArray([], handlers, true), [wrappedCallback], false); } this.bindings[currentName] = handlers; } } return this; }; EventDispatcher2.prototype.off = function(name2, callback2) { var _this = this; if (name2) { var names2 = name2.toLowerCase().split(" "); var i2 = names2.length; while (i2--) { var currentName = names2[i2]; var handlers = this.bindings[currentName]; if (!currentName) { each$j(this.bindings, function(_value, bindingName) { _this.toggleEvent(bindingName, false); delete _this.bindings[bindingName]; }); return this; } if (handlers) { if (!callback2) { handlers.length = 0; } else { var filteredHandlers = partition2(handlers, function(handler7) { return handler7.func === callback2; }); handlers = filteredHandlers.fail; this.bindings[currentName] = handlers; each$k(filteredHandlers.pass, function(handler7) { handler7.removed = true; }); } if (!handlers.length) { this.toggleEvent(name2, false); delete this.bindings[currentName]; } } } } else { each$j(this.bindings, function(_value, name3) { _this.toggleEvent(name3, false); }); this.bindings = {}; } return this; }; EventDispatcher2.prototype.once = function(name2, callback2, prepend2) { return this.on(name2, callback2, prepend2, { once: true }); }; EventDispatcher2.prototype.has = function(name2) { name2 = name2.toLowerCase(); return !(!this.bindings[name2] || this.bindings[name2].length === 0); }; return EventDispatcher2; }(); var getEventDispatcher = function(obj) { if (!obj._eventDispatcher) { obj._eventDispatcher = new EventDispatcher({ scope: obj, toggleEvent: function(name2, state) { if (EventDispatcher.isNative(name2) && obj.toggleNativeEvent) { obj.toggleNativeEvent(name2, state); } } }); } return obj._eventDispatcher; }; var Observable = { fire: function(name2, args, bubble2) { var self2 = this; if (self2.removed && name2 !== "remove" && name2 !== "detach") { return args; } var dispatcherArgs = getEventDispatcher(self2).fire(name2, args); if (bubble2 !== false && self2.parent) { var parent_1 = self2.parent(); while (parent_1 && !dispatcherArgs.isPropagationStopped()) { parent_1.fire(name2, dispatcherArgs, false); parent_1 = parent_1.parent(); } } return dispatcherArgs; }, on: function(name2, callback2, prepend2) { return getEventDispatcher(this).on(name2, callback2, prepend2); }, off: function(name2, callback2) { return getEventDispatcher(this).off(name2, callback2); }, once: function(name2, callback2) { return getEventDispatcher(this).once(name2, callback2); }, hasEventListeners: function(name2) { return getEventDispatcher(this).has(name2); } }; var DOM$2 = DOMUtils.DOM; var customEventRootDelegates; var getEventTarget = function(editor, eventName) { if (eventName === "selectionchange") { return editor.getDoc(); } if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) { return editor.getDoc().documentElement; } var eventRoot = getEventRoot(editor); if (eventRoot) { if (!editor.eventRoot) { editor.eventRoot = DOM$2.select(eventRoot)[0]; } return editor.eventRoot; } return editor.getBody(); }; var isListening = function(editor) { return !editor.hidden && !isReadOnly(editor); }; var fireEvent = function(editor, eventName, e2) { if (isListening(editor)) { editor.fire(eventName, e2); } else if (isReadOnly(editor)) { processReadonlyEvents(editor, e2); } }; var bindEventDelegate = function(editor, eventName) { var delegate; if (!editor.delegates) { editor.delegates = {}; } if (editor.delegates[eventName] || editor.removed) { return; } var eventRootElm = getEventTarget(editor, eventName); if (getEventRoot(editor)) { if (!customEventRootDelegates) { customEventRootDelegates = {}; editor.editorManager.on("removeEditor", function() { if (!editor.editorManager.activeEditor) { if (customEventRootDelegates) { each$j(customEventRootDelegates, function(_value, name2) { editor.dom.unbind(getEventTarget(editor, name2)); }); customEventRootDelegates = null; } } }); } if (customEventRootDelegates[eventName]) { return; } delegate = function(e2) { var target = e2.target; var editors2 = editor.editorManager.get(); var i2 = editors2.length; while (i2--) { var body = editors2[i2].getBody(); if (body === target || DOM$2.isChildOf(target, body)) { fireEvent(editors2[i2], eventName, e2); } } }; customEventRootDelegates[eventName] = delegate; DOM$2.bind(eventRootElm, eventName, delegate); } else { delegate = function(e2) { fireEvent(editor, eventName, e2); }; DOM$2.bind(eventRootElm, eventName, delegate); editor.delegates[eventName] = delegate; } }; var EditorObservable = __assign(__assign({}, Observable), { bindPendingEventDelegates: function() { var self2 = this; Tools.each(self2._pendingNativeEvents, function(name2) { bindEventDelegate(self2, name2); }); }, toggleNativeEvent: function(name2, state) { var self2 = this; if (name2 === "focus" || name2 === "blur") { return; } if (self2.removed) { return; } if (state) { if (self2.initialized) { bindEventDelegate(self2, name2); } else { if (!self2._pendingNativeEvents) { self2._pendingNativeEvents = [name2]; } else { self2._pendingNativeEvents.push(name2); } } } else if (self2.initialized) { self2.dom.unbind(getEventTarget(self2, name2), name2, self2.delegates[name2]); delete self2.delegates[name2]; } }, unbindAllNativeEvents: function() { var self2 = this; var body = self2.getBody(); var dom2 = self2.dom; if (self2.delegates) { each$j(self2.delegates, function(value25, name2) { self2.dom.unbind(getEventTarget(self2, name2), name2, value25); }); delete self2.delegates; } if (!self2.inline && body && dom2) { body.onload = null; dom2.unbind(self2.getWin()); dom2.unbind(self2.getDoc()); } if (dom2) { dom2.unbind(body); dom2.unbind(self2.getContainer()); } } }); var defaultModes = [ "design", "readonly" ]; var switchToMode = function(editor, activeMode, availableModes, mode3) { var oldMode = availableModes[activeMode.get()]; var newMode = availableModes[mode3]; try { newMode.activate(); } catch (e2) { console.error("problem while activating editor mode " + mode3 + ":", e2); return; } oldMode.deactivate(); if (oldMode.editorReadOnly !== newMode.editorReadOnly) { toggleReadOnly(editor, newMode.editorReadOnly); } activeMode.set(mode3); fireSwitchMode(editor, mode3); }; var setMode = function(editor, availableModes, activeMode, mode3) { if (mode3 === activeMode.get()) { return; } else if (!has$22(availableModes, mode3)) { throw new Error("Editor mode '" + mode3 + "' is invalid"); } if (editor.initialized) { switchToMode(editor, activeMode, availableModes, mode3); } else { editor.on("init", function() { return switchToMode(editor, activeMode, availableModes, mode3); }); } }; var registerMode = function(availableModes, mode3, api3) { var _a3; if (contains$3(defaultModes, mode3)) { throw new Error("Cannot override default mode " + mode3); } return __assign(__assign({}, availableModes), (_a3 = {}, _a3[mode3] = __assign(__assign({}, api3), { deactivate: function() { try { api3.deactivate(); } catch (e2) { console.error("problem while deactivating editor mode " + mode3 + ":", e2); } } }), _a3)); }; var create$4 = function(editor) { var activeMode = Cell3("design"); var availableModes = Cell3({ design: { activate: noop2, deactivate: noop2, editorReadOnly: false }, readonly: { activate: noop2, deactivate: noop2, editorReadOnly: true } }); registerReadOnlyContentFilters(editor); registerReadOnlySelectionBlockers(editor); return { isReadOnly: function() { return isReadOnly(editor); }, set: function(mode3) { return setMode(editor, availableModes.get(), activeMode, mode3); }, get: function() { return activeMode.get(); }, register: function(mode3, api3) { availableModes.set(registerMode(availableModes.get(), mode3, api3)); } }; }; var each$3 = Tools.each, explode$1 = Tools.explode; var keyCodeLookup = { f1: 112, f2: 113, f3: 114, f4: 115, f5: 116, f6: 117, f7: 118, f8: 119, f9: 120, f10: 121, f11: 122, f12: 123 }; var modifierNames = Tools.makeMap("alt,ctrl,shift,meta,access"); var parseShortcut = function(pattern2) { var key2; var shortcut = {}; each$3(explode$1(pattern2.toLowerCase(), "+"), function(value25) { if (value25 in modifierNames) { shortcut[value25] = true; } else { if (/^[0-9]{2,}$/.test(value25)) { shortcut.keyCode = parseInt(value25, 10); } else { shortcut.charCode = value25.charCodeAt(0); shortcut.keyCode = keyCodeLookup[value25] || value25.toUpperCase().charCodeAt(0); } } }); var id2 = [shortcut.keyCode]; for (key2 in modifierNames) { if (shortcut[key2]) { id2.push(key2); } else { shortcut[key2] = false; } } shortcut.id = id2.join(","); if (shortcut.access) { shortcut.alt = true; if (Env.mac) { shortcut.ctrl = true; } else { shortcut.shift = true; } } if (shortcut.meta) { if (Env.mac) { shortcut.meta = true; } else { shortcut.ctrl = true; shortcut.meta = false; } } return shortcut; }; var Shortcuts = function() { function Shortcuts2(editor) { this.shortcuts = {}; this.pendingPatterns = []; this.editor = editor; var self2 = this; editor.on("keyup keypress keydown", function(e2) { if ((self2.hasModifier(e2) || self2.isFunctionKey(e2)) && !e2.isDefaultPrevented()) { each$3(self2.shortcuts, function(shortcut) { if (self2.matchShortcut(e2, shortcut)) { self2.pendingPatterns = shortcut.subpatterns.slice(0); if (e2.type === "keydown") { self2.executeShortcutAction(shortcut); } return true; } }); if (self2.matchShortcut(e2, self2.pendingPatterns[0])) { if (self2.pendingPatterns.length === 1) { if (e2.type === "keydown") { self2.executeShortcutAction(self2.pendingPatterns[0]); } } self2.pendingPatterns.shift(); } } }); } Shortcuts2.prototype.add = function(pattern2, desc, cmdFunc, scope) { var self2 = this; var func = self2.normalizeCommandFunc(cmdFunc); each$3(explode$1(Tools.trim(pattern2)), function(pattern3) { var shortcut = self2.createShortcut(pattern3, desc, func, scope); self2.shortcuts[shortcut.id] = shortcut; }); return true; }; Shortcuts2.prototype.remove = function(pattern2) { var shortcut = this.createShortcut(pattern2); if (this.shortcuts[shortcut.id]) { delete this.shortcuts[shortcut.id]; return true; } return false; }; Shortcuts2.prototype.normalizeCommandFunc = function(cmdFunc) { var self2 = this; var cmd = cmdFunc; if (typeof cmd === "string") { return function() { self2.editor.execCommand(cmd, false, null); }; } else if (Tools.isArray(cmd)) { return function() { self2.editor.execCommand(cmd[0], cmd[1], cmd[2]); }; } else { return cmd; } }; Shortcuts2.prototype.createShortcut = function(pattern2, desc, cmdFunc, scope) { var shortcuts = Tools.map(explode$1(pattern2, ">"), parseShortcut); shortcuts[shortcuts.length - 1] = Tools.extend(shortcuts[shortcuts.length - 1], { func: cmdFunc, scope: scope || this.editor }); return Tools.extend(shortcuts[0], { desc: this.editor.translate(desc), subpatterns: shortcuts.slice(1) }); }; Shortcuts2.prototype.hasModifier = function(e2) { return e2.altKey || e2.ctrlKey || e2.metaKey; }; Shortcuts2.prototype.isFunctionKey = function(e2) { return e2.type === "keydown" && e2.keyCode >= 112 && e2.keyCode <= 123; }; Shortcuts2.prototype.matchShortcut = function(e2, shortcut) { if (!shortcut) { return false; } if (shortcut.ctrl !== e2.ctrlKey || shortcut.meta !== e2.metaKey) { return false; } if (shortcut.alt !== e2.altKey || shortcut.shift !== e2.shiftKey) { return false; } if (e2.keyCode === shortcut.keyCode || e2.charCode && e2.charCode === shortcut.charCode) { e2.preventDefault(); return true; } return false; }; Shortcuts2.prototype.executeShortcutAction = function(shortcut) { return shortcut.func ? shortcut.func.call(shortcut.scope) : null; }; return Shortcuts2; }(); var create$3 = function() { var buttons = {}; var menuItems = {}; var popups = {}; var icons = {}; var contextMenus = {}; var contextToolbars = {}; var sidebars = {}; var add4 = function(collection, type3) { return function(name2, spec) { return collection[name2.toLowerCase()] = __assign(__assign({}, spec), { type: type3 }); }; }; var addIcon2 = function(name2, svgData) { return icons[name2.toLowerCase()] = svgData; }; return { addButton: add4(buttons, "button"), addGroupToolbarButton: add4(buttons, "grouptoolbarbutton"), addToggleButton: add4(buttons, "togglebutton"), addMenuButton: add4(buttons, "menubutton"), addSplitButton: add4(buttons, "splitbutton"), addMenuItem: add4(menuItems, "menuitem"), addNestedMenuItem: add4(menuItems, "nestedmenuitem"), addToggleMenuItem: add4(menuItems, "togglemenuitem"), addAutocompleter: add4(popups, "autocompleter"), addContextMenu: add4(contextMenus, "contextmenu"), addContextToolbar: add4(contextToolbars, "contexttoolbar"), addContextForm: add4(contextToolbars, "contextform"), addSidebar: add4(sidebars, "sidebar"), addIcon: addIcon2, getAll: function() { return { buttons, menuItems, icons, popups, contextMenus, contextToolbars, sidebars }; } }; }; var registry = function() { var bridge = create$3(); return { addAutocompleter: bridge.addAutocompleter, addButton: bridge.addButton, addContextForm: bridge.addContextForm, addContextMenu: bridge.addContextMenu, addContextToolbar: bridge.addContextToolbar, addIcon: bridge.addIcon, addMenuButton: bridge.addMenuButton, addMenuItem: bridge.addMenuItem, addNestedMenuItem: bridge.addNestedMenuItem, addSidebar: bridge.addSidebar, addSplitButton: bridge.addSplitButton, addToggleButton: bridge.addToggleButton, addGroupToolbarButton: bridge.addGroupToolbarButton, addToggleMenuItem: bridge.addToggleMenuItem, getAll: bridge.getAll }; }; var DOM$1 = DOMUtils.DOM; var extend$3 = Tools.extend, each$2 = Tools.each; var resolve = Tools.resolve; var ie = Env.ie; var Editor = function() { function Editor2(id2, settings, editorManager) { var _this = this; this.plugins = {}; this.contentCSS = []; this.contentStyles = []; this.loadedCSS = {}; this.isNotDirty = false; this.editorManager = editorManager; this.documentBaseUrl = editorManager.documentBaseURL; extend$3(this, EditorObservable); this.settings = getEditorSettings(this, id2, this.documentBaseUrl, editorManager.defaultSettings, settings); if (this.settings.suffix) { editorManager.suffix = this.settings.suffix; } this.suffix = editorManager.suffix; if (this.settings.base_url) { editorManager._setBaseUrl(this.settings.base_url); } this.baseUri = editorManager.baseURI; if (this.settings.referrer_policy) { ScriptLoader.ScriptLoader._setReferrerPolicy(this.settings.referrer_policy); DOMUtils.DOM.styleSheetLoader._setReferrerPolicy(this.settings.referrer_policy); } AddOnManager.languageLoad = this.settings.language_load; AddOnManager.baseURL = editorManager.baseURL; this.id = id2; this.setDirty(false); this.documentBaseURI = new URI(this.settings.document_base_url, { base_uri: this.baseUri }); this.baseURI = this.baseUri; this.inline = !!this.settings.inline; this.shortcuts = new Shortcuts(this); this.editorCommands = new EditorCommands(this); if (this.settings.cache_suffix) { Env.cacheSuffix = this.settings.cache_suffix.replace(/^[\?\&]+/, ""); } this.ui = { registry: registry(), styleSheetLoader: void 0, show: noop2, hide: noop2, enable: noop2, disable: noop2, isDisabled: never }; var self2 = this; var modeInstance = create$4(self2); this.mode = modeInstance; this.setMode = modeInstance.set; editorManager.fire("SetupEditor", { editor: this }); this.execCallback("setup", this); this.$ = DomQuery.overrideDefaults(function() { return { context: _this.inline ? _this.getBody() : _this.getDoc(), element: _this.getBody() }; }); } Editor2.prototype.render = function() { render123(this); }; Editor2.prototype.focus = function(skipFocus) { this.execCommand("mceFocus", false, skipFocus); }; Editor2.prototype.hasFocus = function() { return hasFocus(this); }; Editor2.prototype.execCallback = function(name2) { var x2 = []; for (var _i = 1; _i < arguments.length; _i++) { x2[_i - 1] = arguments[_i]; } var self2 = this; var callback2 = self2.settings[name2], scope; if (!callback2) { return; } if (self2.callbackLookup && (scope = self2.callbackLookup[name2])) { callback2 = scope.func; scope = scope.scope; } if (typeof callback2 === "string") { scope = callback2.replace(/\.\w+$/, ""); scope = scope ? resolve(scope) : 0; callback2 = resolve(callback2); self2.callbackLookup = self2.callbackLookup || {}; self2.callbackLookup[name2] = { func: callback2, scope }; } return callback2.apply(scope || self2, x2); }; Editor2.prototype.translate = function(text) { return I18n.translate(text); }; Editor2.prototype.getParam = function(name2, defaultVal, type3) { return getParam(this, name2, defaultVal, type3); }; Editor2.prototype.hasPlugin = function(name2, loaded2) { var hasPlugin = contains$3(getPlugins(this).split(/[ ,]/), name2); if (hasPlugin) { return loaded2 ? PluginManager.get(name2) !== void 0 : true; } else { return false; } }; Editor2.prototype.nodeChanged = function(args) { this._nodeChangeDispatcher.nodeChanged(args); }; Editor2.prototype.addCommand = function(name2, callback2, scope) { this.editorCommands.addCommand(name2, callback2, scope); }; Editor2.prototype.addQueryStateHandler = function(name2, callback2, scope) { this.editorCommands.addQueryStateHandler(name2, callback2, scope); }; Editor2.prototype.addQueryValueHandler = function(name2, callback2, scope) { this.editorCommands.addQueryValueHandler(name2, callback2, scope); }; Editor2.prototype.addShortcut = function(pattern2, desc, cmdFunc, scope) { this.shortcuts.add(pattern2, desc, cmdFunc, scope); }; Editor2.prototype.execCommand = function(cmd, ui, value25, args) { return this.editorCommands.execCommand(cmd, ui, value25, args); }; Editor2.prototype.queryCommandState = function(cmd) { return this.editorCommands.queryCommandState(cmd); }; Editor2.prototype.queryCommandValue = function(cmd) { return this.editorCommands.queryCommandValue(cmd); }; Editor2.prototype.queryCommandSupported = function(cmd) { return this.editorCommands.queryCommandSupported(cmd); }; Editor2.prototype.show = function() { var self2 = this; if (self2.hidden) { self2.hidden = false; if (self2.inline) { self2.getBody().contentEditable = "true"; } else { DOM$1.show(self2.getContainer()); DOM$1.hide(self2.id); } self2.load(); self2.fire("show"); } }; Editor2.prototype.hide = function() { var self2 = this, doc2 = self2.getDoc(); if (!self2.hidden) { if (ie && doc2 && !self2.inline) { doc2.execCommand("SelectAll"); } self2.save(); if (self2.inline) { self2.getBody().contentEditable = "false"; if (self2 === self2.editorManager.focusedEditor) { self2.editorManager.focusedEditor = null; } } else { DOM$1.hide(self2.getContainer()); DOM$1.setStyle(self2.id, "display", self2.orgDisplay); } self2.hidden = true; self2.fire("hide"); } }; Editor2.prototype.isHidden = function() { return !!this.hidden; }; Editor2.prototype.setProgressState = function(state, time) { this.fire("ProgressState", { state, time }); }; Editor2.prototype.load = function(args) { var self2 = this; var elm = self2.getElement(), html; if (self2.removed) { return ""; } if (elm) { args = args || {}; args.load = true; var value25 = isTextareaOrInput(elm) ? elm.value : elm.innerHTML; html = self2.setContent(value25, args); args.element = elm; if (!args.no_events) { self2.fire("LoadContent", args); } args.element = elm = null; return html; } }; Editor2.prototype.save = function(args) { var self2 = this; var elm = self2.getElement(), html, form; if (!elm || !self2.initialized || self2.removed) { return; } args = args || {}; args.save = true; args.element = elm; html = args.content = self2.getContent(args); if (!args.no_events) { self2.fire("SaveContent", args); } if (args.format === "raw") { self2.fire("RawSaveContent", args); } html = args.content; if (!isTextareaOrInput(elm)) { if (args.is_removing || !self2.inline) { elm.innerHTML = html; } if (form = DOM$1.getParent(self2.id, "form")) { each$2(form.elements, function(elm2) { if (elm2.name === self2.id) { elm2.value = html; return false; } }); } } else { elm.value = html; } args.element = elm = null; if (args.set_dirty !== false) { self2.setDirty(false); } return html; }; Editor2.prototype.setContent = function(content, args) { return setContent(this, content, args); }; Editor2.prototype.getContent = function(args) { return getContent(this, args); }; Editor2.prototype.insertContent = function(content, args) { if (args) { content = extend$3({ content }, args); } this.execCommand("mceInsertContent", false, content); }; Editor2.prototype.resetContent = function(initialContent) { if (initialContent === void 0) { setContent(this, this.startContent, { format: "raw" }); } else { setContent(this, initialContent); } this.undoManager.reset(); this.setDirty(false); this.nodeChanged(); }; Editor2.prototype.isDirty = function() { return !this.isNotDirty; }; Editor2.prototype.setDirty = function(state) { var oldState = !this.isNotDirty; this.isNotDirty = !state; if (state && state !== oldState) { this.fire("dirty"); } }; Editor2.prototype.getContainer = function() { var self2 = this; if (!self2.container) { self2.container = DOM$1.get(self2.editorContainer || self2.id + "_parent"); } return self2.container; }; Editor2.prototype.getContentAreaContainer = function() { return this.contentAreaContainer; }; Editor2.prototype.getElement = function() { if (!this.targetElm) { this.targetElm = DOM$1.get(this.id); } return this.targetElm; }; Editor2.prototype.getWin = function() { var self2 = this; var elm; if (!self2.contentWindow) { elm = self2.iframeElement; if (elm) { self2.contentWindow = elm.contentWindow; } } return self2.contentWindow; }; Editor2.prototype.getDoc = function() { var self2 = this; var win; if (!self2.contentDocument) { win = self2.getWin(); if (win) { self2.contentDocument = win.document; } } return self2.contentDocument; }; Editor2.prototype.getBody = function() { var doc2 = this.getDoc(); return this.bodyElement || (doc2 ? doc2.body : null); }; Editor2.prototype.convertURL = function(url2, name2, elm) { var self2 = this, settings = self2.settings; if (settings.urlconverter_callback) { return self2.execCallback("urlconverter_callback", url2, elm, true, name2); } if (!settings.convert_urls || elm && elm.nodeName === "LINK" || url2.indexOf("file:") === 0 || url2.length === 0) { return url2; } if (settings.relative_urls) { return self2.documentBaseURI.toRelative(url2); } url2 = self2.documentBaseURI.toAbsolute(url2, settings.remove_script_host); return url2; }; Editor2.prototype.addVisual = function(elm) { addVisual(this, elm); }; Editor2.prototype.remove = function() { remove3(this); }; Editor2.prototype.destroy = function(automatic) { destroy3(this, automatic); }; Editor2.prototype.uploadImages = function(callback2) { return this.editorUpload.uploadImages(callback2); }; Editor2.prototype._scanForImages = function() { return this.editorUpload.scanForImages(); }; Editor2.prototype.addButton = function() { throw new Error("editor.addButton has been removed in tinymce 5x, use editor.ui.registry.addButton or editor.ui.registry.addToggleButton or editor.ui.registry.addSplitButton instead"); }; Editor2.prototype.addSidebar = function() { throw new Error("editor.addSidebar has been removed in tinymce 5x, use editor.ui.registry.addSidebar instead"); }; Editor2.prototype.addMenuItem = function() { throw new Error("editor.addMenuItem has been removed in tinymce 5x, use editor.ui.registry.addMenuItem instead"); }; Editor2.prototype.addContextToolbar = function() { throw new Error("editor.addContextToolbar has been removed in tinymce 5x, use editor.ui.registry.addContextToolbar instead"); }; return Editor2; }(); var DOM = DOMUtils.DOM; var explode = Tools.explode, each$12 = Tools.each, extend$22 = Tools.extend; var instanceCounter = 0, boundGlobalEvents = false; var beforeUnloadDelegate; var legacyEditors = []; var editors = []; var isValidLegacyKey = function(id2) { return id2 !== "length"; }; var globalEventDelegate = function(e2) { var type3 = e2.type; each$12(EditorManager.get(), function(editor) { switch (type3) { case "scroll": editor.fire("ScrollWindow", e2); break; case "resize": editor.fire("ResizeWindow", e2); break; } }); }; var toggleGlobalEvents = function(state) { if (state !== boundGlobalEvents) { if (state) { DomQuery(window).on("resize scroll", globalEventDelegate); } else { DomQuery(window).off("resize scroll", globalEventDelegate); } boundGlobalEvents = state; } }; var removeEditorFromList = function(targetEditor) { var oldEditors = editors; delete legacyEditors[targetEditor.id]; for (var i2 = 0; i2 < legacyEditors.length; i2++) { if (legacyEditors[i2] === targetEditor) { legacyEditors.splice(i2, 1); break; } } editors = filter$4(editors, function(editor) { return targetEditor !== editor; }); if (EditorManager.activeEditor === targetEditor) { EditorManager.activeEditor = editors.length > 0 ? editors[0] : null; } if (EditorManager.focusedEditor === targetEditor) { EditorManager.focusedEditor = null; } return oldEditors.length !== editors.length; }; var purgeDestroyedEditor = function(editor) { if (editor && editor.initialized && !(editor.getContainer() || editor.getBody()).parentNode) { removeEditorFromList(editor); editor.unbindAllNativeEvents(); editor.destroy(true); editor.removed = true; editor = null; } return editor; }; var isQuirksMode = document.compatMode !== "CSS1Compat"; var EditorManager = __assign(__assign({}, Observable), { baseURI: null, baseURL: null, defaultSettings: {}, documentBaseURL: null, suffix: null, $: DomQuery, majorVersion: "5", minorVersion: "10.7", releaseDate: "2022-12-06", editors: legacyEditors, i18n: I18n, activeEditor: null, focusedEditor: null, settings: {}, setup: function() { var self2 = this; var baseURL, documentBaseURL, suffix = ""; documentBaseURL = URI.getDocumentBaseUrl(document.location); if (/^[^:]+:\/\/\/?[^\/]+\//.test(documentBaseURL)) { documentBaseURL = documentBaseURL.replace(/[\?#].*$/, "").replace(/[\/\\][^\/]+$/, ""); if (!/[\/\\]$/.test(documentBaseURL)) { documentBaseURL += "/"; } } var preInit2 = window.tinymce || window.tinyMCEPreInit; if (preInit2) { baseURL = preInit2.base || preInit2.baseURL; suffix = preInit2.suffix; } else { var scripts = document.getElementsByTagName("script"); for (var i2 = 0; i2 < scripts.length; i2++) { var src2 = scripts[i2].src || ""; if (src2 === "") { continue; } var srcScript = src2.substring(src2.lastIndexOf("/")); if (/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(src2)) { if (srcScript.indexOf(".min") !== -1) { suffix = ".min"; } baseURL = src2.substring(0, src2.lastIndexOf("/")); break; } } if (!baseURL && document.currentScript) { var src2 = document.currentScript.src; if (src2.indexOf(".min") !== -1) { suffix = ".min"; } baseURL = src2.substring(0, src2.lastIndexOf("/")); } } self2.baseURL = new URI(documentBaseURL).toAbsolute(baseURL); self2.documentBaseURL = documentBaseURL; self2.baseURI = new URI(self2.baseURL); self2.suffix = suffix; setup$l(self2); }, overrideDefaults: function(defaultSettings) { var baseUrl = defaultSettings.base_url; if (baseUrl) { this._setBaseUrl(baseUrl); } var suffix = defaultSettings.suffix; if (defaultSettings.suffix) { this.suffix = suffix; } this.defaultSettings = defaultSettings; var pluginBaseUrls = defaultSettings.plugin_base_urls; if (pluginBaseUrls !== void 0) { each$j(pluginBaseUrls, function(pluginBaseUrl, pluginName) { AddOnManager.PluginManager.urls[pluginName] = pluginBaseUrl; }); } }, init: function(settings) { var self2 = this; var result; var invalidInlineTargets = Tools.makeMap("area base basefont br col frame hr img input isindex link meta param embed source wbr track colgroup option table tbody tfoot thead tr th td script noscript style textarea video audio iframe object menu", " "); var isInvalidInlineTarget = function(settings2, elm) { return settings2.inline && elm.tagName.toLowerCase() in invalidInlineTargets; }; var createId = function(elm) { var id2 = elm.id; if (!id2) { id2 = get$9(elm, "name").filter(function(name2) { return !DOM.get(name2); }).getOrThunk(DOM.uniqueId); elm.setAttribute("id", id2); } return id2; }; var execCallback = function(name2) { var callback2 = settings[name2]; if (!callback2) { return; } return callback2.apply(self2, []); }; var hasClass3 = function(elm, className) { return className.constructor === RegExp ? className.test(elm.className) : DOM.hasClass(elm, className); }; var findTargets = function(settings2) { var targets = []; if (Env.browser.isIE() && Env.browser.version.major < 11) { initError("TinyMCE does not support the browser you are using. For a list of supported browsers please see: https://www.tinymce.com/docs/get-started/system-requirements/"); return []; } else if (isQuirksMode) { initError("Failed to initialize the editor as the document is not in standards mode. TinyMCE requires standards mode."); return []; } if (settings2.types) { each$12(settings2.types, function(type3) { targets = targets.concat(DOM.select(type3.selector)); }); return targets; } else if (settings2.selector) { return DOM.select(settings2.selector); } else if (settings2.target) { return [settings2.target]; } switch (settings2.mode) { case "exact": var l2 = settings2.elements || ""; if (l2.length > 0) { each$12(explode(l2), function(id2) { var elm = DOM.get(id2); if (elm) { targets.push(elm); } else { each$12(document.forms, function(f2) { each$12(f2.elements, function(e2) { if (e2.name === id2) { id2 = "mce_editor_" + instanceCounter++; DOM.setAttrib(e2, "id", id2); targets.push(e2); } }); }); } }); } break; case "textareas": case "specific_textareas": each$12(DOM.select("textarea"), function(elm) { if (settings2.editor_deselector && hasClass3(elm, settings2.editor_deselector)) { return; } if (!settings2.editor_selector || hasClass3(elm, settings2.editor_selector)) { targets.push(elm); } }); break; } return targets; }; var provideResults = function(editors2) { result = editors2; }; var initEditors = function() { var initCount = 0; var editors2 = []; var targets; var createEditor = function(id2, settings2, targetElm) { var editor = new Editor(id2, settings2, self2); editors2.push(editor); editor.on("init", function() { if (++initCount === targets.length) { provideResults(editors2); } }); editor.targetElm = editor.targetElm || targetElm; editor.render(); }; DOM.unbind(window, "ready", initEditors); execCallback("onpageload"); targets = DomQuery.unique(findTargets(settings)); if (settings.types) { each$12(settings.types, function(type3) { Tools.each(targets, function(elm) { if (DOM.is(elm, type3.selector)) { createEditor(createId(elm), extend$22({}, settings, type3), elm); return false; } return true; }); }); return; } Tools.each(targets, function(elm) { purgeDestroyedEditor(self2.get(elm.id)); }); targets = Tools.grep(targets, function(elm) { return !self2.get(elm.id); }); if (targets.length === 0) { provideResults([]); } else { each$12(targets, function(elm) { if (isInvalidInlineTarget(settings, elm)) { initError("Could not initialize inline editor on invalid inline target element", elm); } else { createEditor(createId(elm), settings, elm); } }); } }; self2.settings = settings; DOM.bind(window, "ready", initEditors); return new promiseObj(function(resolve2) { if (result) { resolve2(result); } else { provideResults = function(editors2) { resolve2(editors2); }; } }); }, get: function(id2) { if (arguments.length === 0) { return editors.slice(0); } else if (isString$12(id2)) { return find$3(editors, function(editor) { return editor.id === id2; }).getOr(null); } else if (isNumber2(id2)) { return editors[id2] ? editors[id2] : null; } else { return null; } }, add: function(editor) { var self2 = this; var existingEditor = legacyEditors[editor.id]; if (existingEditor === editor) { return editor; } if (self2.get(editor.id) === null) { if (isValidLegacyKey(editor.id)) { legacyEditors[editor.id] = editor; } legacyEditors.push(editor); editors.push(editor); } toggleGlobalEvents(true); self2.activeEditor = editor; self2.fire("AddEditor", { editor }); if (!beforeUnloadDelegate) { beforeUnloadDelegate = function(e2) { var event = self2.fire("BeforeUnload"); if (event.returnValue) { e2.preventDefault(); e2.returnValue = event.returnValue; return event.returnValue; } }; window.addEventListener("beforeunload", beforeUnloadDelegate); } return editor; }, createEditor: function(id2, settings) { return this.add(new Editor(id2, settings, this)); }, remove: function(selector2) { var self2 = this; var i2, editor; if (!selector2) { for (i2 = editors.length - 1; i2 >= 0; i2--) { self2.remove(editors[i2]); } return; } if (isString$12(selector2)) { each$12(DOM.select(selector2), function(elm) { editor = self2.get(elm.id); if (editor) { self2.remove(editor); } }); return; } editor = selector2; if (isNull2(self2.get(editor.id))) { return null; } if (removeEditorFromList(editor)) { self2.fire("RemoveEditor", { editor }); } if (editors.length === 0) { window.removeEventListener("beforeunload", beforeUnloadDelegate); } editor.remove(); toggleGlobalEvents(editors.length > 0); return editor; }, execCommand: function(cmd, ui, value25) { var self2 = this, editor = self2.get(value25); switch (cmd) { case "mceAddEditor": if (!self2.get(value25)) { new Editor(value25, self2.settings, self2).render(); } return true; case "mceRemoveEditor": if (editor) { editor.remove(); } return true; case "mceToggleEditor": if (!editor) { self2.execCommand("mceAddEditor", false, value25); return true; } if (editor.isHidden()) { editor.show(); } else { editor.hide(); } return true; } if (self2.activeEditor) { return self2.activeEditor.execCommand(cmd, ui, value25); } return false; }, triggerSave: function() { each$12(editors, function(editor) { editor.save(); }); }, addI18n: function(code, items) { I18n.add(code, items); }, translate: function(text) { return I18n.translate(text); }, setActive: function(editor) { var activeEditor = this.activeEditor; if (this.activeEditor !== editor) { if (activeEditor) { activeEditor.fire("deactivate", { relatedTarget: editor }); } editor.fire("activate", { relatedTarget: activeEditor }); } this.activeEditor = editor; }, _setBaseUrl: function(baseUrl) { this.baseURL = new URI(this.documentBaseURL).toAbsolute(baseUrl.replace(/\/+$/, "")); this.baseURI = new URI(this.baseURL); } }); EditorManager.setup(); var min$1 = Math.min, max$1 = Math.max, round$1 = Math.round; var relativePosition = function(rect, targetRect, rel) { var x2 = targetRect.x; var y2 = targetRect.y; var w2 = rect.w; var h2 = rect.h; var targetW = targetRect.w; var targetH = targetRect.h; var relChars = (rel || "").split(""); if (relChars[0] === "b") { y2 += targetH; } if (relChars[1] === "r") { x2 += targetW; } if (relChars[0] === "c") { y2 += round$1(targetH / 2); } if (relChars[1] === "c") { x2 += round$1(targetW / 2); } if (relChars[3] === "b") { y2 -= h2; } if (relChars[4] === "r") { x2 -= w2; } if (relChars[3] === "c") { y2 -= round$1(h2 / 2); } if (relChars[4] === "c") { x2 -= round$1(w2 / 2); } return create$2(x2, y2, w2, h2); }; var findBestRelativePosition = function(rect, targetRect, constrainRect, rels) { var pos, i2; for (i2 = 0; i2 < rels.length; i2++) { pos = relativePosition(rect, targetRect, rels[i2]); if (pos.x >= constrainRect.x && pos.x + pos.w <= constrainRect.w + constrainRect.x && pos.y >= constrainRect.y && pos.y + pos.h <= constrainRect.h + constrainRect.y) { return rels[i2]; } } return null; }; var inflate = function(rect, w2, h2) { return create$2(rect.x - w2, rect.y - h2, rect.w + w2 * 2, rect.h + h2 * 2); }; var intersect = function(rect, cropRect) { var x1 = max$1(rect.x, cropRect.x); var y1 = max$1(rect.y, cropRect.y); var x2 = min$1(rect.x + rect.w, cropRect.x + cropRect.w); var y2 = min$1(rect.y + rect.h, cropRect.y + cropRect.h); if (x2 - x1 < 0 || y2 - y1 < 0) { return null; } return create$2(x1, y1, x2 - x1, y2 - y1); }; var clamp = function(rect, clampRect, fixedSize) { var x1 = rect.x; var y1 = rect.y; var x2 = rect.x + rect.w; var y2 = rect.y + rect.h; var cx2 = clampRect.x + clampRect.w; var cy2 = clampRect.y + clampRect.h; var underflowX1 = max$1(0, clampRect.x - x1); var underflowY1 = max$1(0, clampRect.y - y1); var overflowX2 = max$1(0, x2 - cx2); var overflowY2 = max$1(0, y2 - cy2); x1 += underflowX1; y1 += underflowY1; if (fixedSize) { x2 += underflowX1; y2 += underflowY1; x1 -= overflowX2; y1 -= overflowY2; } x2 -= overflowX2; y2 -= overflowY2; return create$2(x1, y1, x2 - x1, y2 - y1); }; var create$2 = function(x2, y2, w2, h2) { return { x: x2, y: y2, w: w2, h: h2 }; }; var fromClientRect = function(clientRect) { return create$2(clientRect.left, clientRect.top, clientRect.width, clientRect.height); }; var Rect = { inflate, relativePosition, findBestRelativePosition, intersect, clamp, create: create$2, fromClientRect }; var awaiter = function(resolveCb, rejectCb, timeout) { if (timeout === void 0) { timeout = 1e3; } var done2 = false; var timer = null; var complete = function(completer) { return function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (!done2) { done2 = true; if (timer !== null) { clearTimeout(timer); timer = null; } completer.apply(null, args); } }; }; var resolve2 = complete(resolveCb); var reject = complete(rejectCb); var start2 = function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (!done2 && timer === null) { timer = setTimeout(function() { return reject.apply(null, args); }, timeout); } }; return { start: start2, resolve: resolve2, reject }; }; var create$1 = function() { var tasks = {}; var resultFns = {}; var load = function(id2, url2) { var loadErrMsg = 'Script at URL "' + url2 + '" failed to load'; var runErrMsg = 'Script at URL "' + url2 + "\" did not call `tinymce.Resource.add('" + id2 + "', data)` within 1 second"; if (tasks[id2] !== void 0) { return tasks[id2]; } else { var task = new promiseObj(function(resolve2, reject) { var waiter = awaiter(resolve2, reject); resultFns[id2] = waiter.resolve; ScriptLoader.ScriptLoader.loadScript(url2, function() { return waiter.start(runErrMsg); }, function() { return waiter.reject(loadErrMsg); }); }); tasks[id2] = task; return task; } }; var add4 = function(id2, data66) { if (resultFns[id2] !== void 0) { resultFns[id2](data66); delete resultFns[id2]; } tasks[id2] = promiseObj.resolve(data66); }; return { load, add: add4 }; }; var Resource = create$1(); var each2 = Tools.each, extend$12 = Tools.extend; var extendClass, initializing; var Class = function() { }; Class.extend = extendClass = function(props2) { var self2 = this; var _super = self2.prototype; var Class2 = function() { var i2, mixins, mixin; var self3 = this; if (!initializing) { if (self3.init) { self3.init.apply(self3, arguments); } mixins = self3.Mixins; if (mixins) { i2 = mixins.length; while (i2--) { mixin = mixins[i2]; if (mixin.init) { mixin.init.apply(self3, arguments); } } } } }; var dummy = function() { return this; }; var createMethod = function(name2, fn) { return function() { var self3 = this; var tmp = self3._super; self3._super = _super[name2]; var ret = fn.apply(self3, arguments); self3._super = tmp; return ret; }; }; initializing = true; var prototype = new self2(); initializing = false; if (props2.Mixins) { each2(props2.Mixins, function(mixin) { for (var name_1 in mixin) { if (name_1 !== "init") { props2[name_1] = mixin[name_1]; } } }); if (_super.Mixins) { props2.Mixins = _super.Mixins.concat(props2.Mixins); } } if (props2.Methods) { each2(props2.Methods.split(","), function(name2) { props2[name2] = dummy; }); } if (props2.Properties) { each2(props2.Properties.split(","), function(name2) { var fieldName = "_" + name2; props2[name2] = function(value25) { var self3 = this; if (value25 !== void 0) { self3[fieldName] = value25; return self3; } return self3[fieldName]; }; }); } if (props2.Statics) { each2(props2.Statics, function(func, name2) { Class2[name2] = func; }); } if (props2.Defaults && _super.Defaults) { props2.Defaults = extend$12({}, _super.Defaults, props2.Defaults); } each$j(props2, function(member, name2) { if (typeof member === "function" && _super[name2]) { prototype[name2] = createMethod(name2, member); } else { prototype[name2] = member; } }); Class2.prototype = prototype; Class2.constructor = Class2; Class2.extend = extendClass; return Class2; }; var min4 = Math.min, max4 = Math.max, round2 = Math.round; var Color = function(value25) { var self2 = {}; var r3 = 0, g2 = 0, b2 = 0; var rgb2hsv = function(r4, g3, b3) { var h2, s2, v2; h2 = 0; s2 = 0; v2 = 0; r4 = r4 / 255; g3 = g3 / 255; b3 = b3 / 255; var minRGB = min4(r4, min4(g3, b3)); var maxRGB = max4(r4, max4(g3, b3)); if (minRGB === maxRGB) { v2 = minRGB; return { h: 0, s: 0, v: v2 * 100 }; } var d2 = r4 === minRGB ? g3 - b3 : b3 === minRGB ? r4 - g3 : b3 - r4; h2 = r4 === minRGB ? 3 : b3 === minRGB ? 1 : 5; h2 = 60 * (h2 - d2 / (maxRGB - minRGB)); s2 = (maxRGB - minRGB) / maxRGB; v2 = maxRGB; return { h: round2(h2), s: round2(s2 * 100), v: round2(v2 * 100) }; }; var hsvToRgb2 = function(hue, saturation, brightness) { hue = (parseInt(hue, 10) || 0) % 360; saturation = parseInt(saturation, 10) / 100; brightness = parseInt(brightness, 10) / 100; saturation = max4(0, min4(saturation, 1)); brightness = max4(0, min4(brightness, 1)); if (saturation === 0) { r3 = g2 = b2 = round2(255 * brightness); return; } var side = hue / 60; var chroma = brightness * saturation; var x2 = chroma * (1 - Math.abs(side % 2 - 1)); var match7 = brightness - chroma; switch (Math.floor(side)) { case 0: r3 = chroma; g2 = x2; b2 = 0; break; case 1: r3 = x2; g2 = chroma; b2 = 0; break; case 2: r3 = 0; g2 = chroma; b2 = x2; break; case 3: r3 = 0; g2 = x2; b2 = chroma; break; case 4: r3 = x2; g2 = 0; b2 = chroma; break; case 5: r3 = chroma; g2 = 0; b2 = x2; break; default: r3 = g2 = b2 = 0; } r3 = round2(255 * (r3 + match7)); g2 = round2(255 * (g2 + match7)); b2 = round2(255 * (b2 + match7)); }; var toHex3 = function() { var hex2 = function(val) { val = parseInt(val, 10).toString(16); return val.length > 1 ? val : "0" + val; }; return "#" + hex2(r3) + hex2(g2) + hex2(b2); }; var toRgb = function() { return { r: r3, g: g2, b: b2 }; }; var toHsv2 = function() { return rgb2hsv(r3, g2, b2); }; var parse2 = function(value26) { var matches2; if (typeof value26 === "object") { if ("r" in value26) { r3 = value26.r; g2 = value26.g; b2 = value26.b; } else if ("v" in value26) { hsvToRgb2(value26.h, value26.s, value26.v); } } else { if (matches2 = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(value26)) { r3 = parseInt(matches2[1], 10); g2 = parseInt(matches2[2], 10); b2 = parseInt(matches2[3], 10); } else if (matches2 = /#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(value26)) { r3 = parseInt(matches2[1], 16); g2 = parseInt(matches2[2], 16); b2 = parseInt(matches2[3], 16); } else if (matches2 = /#([0-F])([0-F])([0-F])/gi.exec(value26)) { r3 = parseInt(matches2[1] + matches2[1], 16); g2 = parseInt(matches2[2] + matches2[2], 16); b2 = parseInt(matches2[3] + matches2[3], 16); } } r3 = r3 < 0 ? 0 : r3 > 255 ? 255 : r3; g2 = g2 < 0 ? 0 : g2 > 255 ? 255 : g2; b2 = b2 < 0 ? 0 : b2 > 255 ? 255 : b2; return self2; }; if (value25) { parse2(value25); } self2.toRgb = toRgb; self2.toHsv = toHsv2; self2.toHex = toHex3; self2.parse = parse2; return self2; }; var serialize = function(obj) { var data66 = JSON.stringify(obj); if (!isString$12(data66)) { return data66; } return data66.replace(/[\u0080-\uFFFF]/g, function(match7) { var hexCode = match7.charCodeAt(0).toString(16); return "\\u" + "0000".substring(hexCode.length) + hexCode; }); }; var JSONUtils = { serialize, parse: function(text) { try { return JSON.parse(text); } catch (ex) { } } }; var JSONP = { callbacks: {}, count: 0, send: function(settings) { var self2 = this, dom2 = DOMUtils.DOM, count3 = settings.count !== void 0 ? settings.count : self2.count; var id2 = "tinymce_jsonp_" + count3; self2.callbacks[count3] = function(json) { dom2.remove(id2); delete self2.callbacks[count3]; settings.callback(json); }; dom2.add(dom2.doc.body, "script", { id: id2, src: settings.url, type: "text/javascript" }); self2.count++; } }; var XHR = __assign(__assign({}, Observable), { send: function(settings) { var xhr2, count3 = 0; var ready = function() { if (!settings.async || xhr2.readyState === 4 || count3++ > 1e4) { if (settings.success && count3 < 1e4 && xhr2.status === 200) { settings.success.call(settings.success_scope, "" + xhr2.responseText, xhr2, settings); } else if (settings.error) { settings.error.call(settings.error_scope, count3 > 1e4 ? "TIMED_OUT" : "GENERAL", xhr2, settings); } xhr2 = null; } else { Delay.setTimeout(ready, 10); } }; settings.scope = settings.scope || this; settings.success_scope = settings.success_scope || settings.scope; settings.error_scope = settings.error_scope || settings.scope; settings.async = settings.async !== false; settings.data = settings.data || ""; XHR.fire("beforeInitialize", { settings }); xhr2 = new XMLHttpRequest(); if (xhr2.overrideMimeType) { xhr2.overrideMimeType(settings.content_type); } xhr2.open(settings.type || (settings.data ? "POST" : "GET"), settings.url, settings.async); if (settings.crossDomain) { xhr2.withCredentials = true; } if (settings.content_type) { xhr2.setRequestHeader("Content-Type", settings.content_type); } if (settings.requestheaders) { Tools.each(settings.requestheaders, function(header) { xhr2.setRequestHeader(header.key, header.value); }); } xhr2.setRequestHeader("X-Requested-With", "XMLHttpRequest"); xhr2 = XHR.fire("beforeSend", { xhr: xhr2, settings }).xhr; xhr2.send(settings.data); if (!settings.async) { return ready(); } Delay.setTimeout(ready, 10); } }); var extend2 = Tools.extend; var JSONRequest = function() { function JSONRequest2(settings) { this.settings = extend2({}, settings); this.count = 0; } JSONRequest2.sendRPC = function(o2) { return new JSONRequest2().send(o2); }; JSONRequest2.prototype.send = function(args) { var ecb = args.error, scb = args.success; var xhrArgs = extend2(this.settings, args); xhrArgs.success = function(c2, x2) { c2 = JSONUtils.parse(c2); if (typeof c2 === "undefined") { c2 = { error: "JSON Parse error." }; } if (c2.error) { ecb.call(xhrArgs.error_scope || xhrArgs.scope, c2.error, x2); } else { scb.call(xhrArgs.success_scope || xhrArgs.scope, c2.result); } }; xhrArgs.error = function(ty, x2) { if (ecb) { ecb.call(xhrArgs.error_scope || xhrArgs.scope, ty, x2); } }; xhrArgs.data = JSONUtils.serialize({ id: args.id || "c" + this.count++, method: args.method, params: args.params }); xhrArgs.content_type = "application/json"; XHR.send(xhrArgs); }; return JSONRequest2; }(); var create = function() { return function() { var data66 = {}; var keys3 = []; var storage2 = { getItem: function(key2) { var item = data66[key2]; return item ? item : null; }, setItem: function(key2, value25) { keys3.push(key2); data66[key2] = String(value25); }, key: function(index2) { return keys3[index2]; }, removeItem: function(key2) { keys3 = keys3.filter(function(k2) { return k2 === key2; }); delete data66[key2]; }, clear: function() { keys3 = []; data66 = {}; }, length: 0 }; Object.defineProperty(storage2, "length", { get: function() { return keys3.length; }, configurable: false, enumerable: false }); return storage2; }(); }; var localStorage; try { var test = "__storage_test__"; localStorage = window.localStorage; localStorage.setItem(test, test); localStorage.removeItem(test); } catch (e2) { localStorage = create(); } var LocalStorage = localStorage; var publicApi = { geom: { Rect }, util: { Promise: promiseObj, Delay, Tools, VK, URI, Class, EventDispatcher, Observable, I18n, XHR, JSON: JSONUtils, JSONRequest, JSONP, LocalStorage, Color, ImageUploader }, dom: { EventUtils, Sizzle, DomQuery, TreeWalker: DomTreeWalker, TextSeeker, DOMUtils, ScriptLoader, RangeUtils, Serializer: DomSerializer, StyleSheetLoader, ControlSelection, BookmarkManager, Selection: EditorSelection, Event: EventUtils.Event }, html: { Styles, Entities, Node: AstNode, Schema: Schema2, SaxParser, DomParser, Writer, Serializer: HtmlSerializer }, Env, AddOnManager, Annotator, Formatter, UndoManager, EditorCommands, WindowManager, NotificationManager, EditorObservable, Shortcuts, Editor, FocusManager, EditorManager, DOM: DOMUtils.DOM, ScriptLoader: ScriptLoader.ScriptLoader, PluginManager, ThemeManager, IconManager, Resource, trim: Tools.trim, isArray: Tools.isArray, is: Tools.is, toArray: Tools.toArray, makeMap: Tools.makeMap, each: Tools.each, map: Tools.map, grep: Tools.grep, inArray: Tools.inArray, extend: Tools.extend, create: Tools.create, walk: Tools.walk, createNS: Tools.createNS, resolve: Tools.resolve, explode: Tools.explode, _addCacheSuffix: Tools._addCacheSuffix, isOpera: Env.opera, isWebKit: Env.webkit, isIE: Env.ie, isGecko: Env.gecko, isMac: Env.mac }; var tinymce2 = Tools.extend(EditorManager, publicApi); var exportToModuleLoaders = function(tinymce3) { { try { module2.exports = tinymce3; } catch (_2) { } } }; var exportToWindowGlobal = function(tinymce3) { window.tinymce = tinymce3; window.tinyMCE = tinymce3; }; exportToWindowGlobal(tinymce2); exportToModuleLoaders(tinymce2); })(); })(tinymce$2); var tinymce$1 = tinymce$2.exports; (function() { var typeOf = function(x2) { var t3 = typeof x2; if (x2 === null) { return "null"; } else if (t3 === "object" && (Array.prototype.isPrototypeOf(x2) || x2.constructor && x2.constructor.name === "Array")) { return "array"; } else if (t3 === "object" && (String.prototype.isPrototypeOf(x2) || x2.constructor && x2.constructor.name === "String")) { return "string"; } else { return t3; } }; var isType$1 = function(type3) { return function(value25) { return typeOf(value25) === type3; }; }; var isSimpleType = function(type3) { return function(value25) { return typeof value25 === type3; }; }; var eq$1 = function(t3) { return function(a2) { return t3 === a2; }; }; var isString3 = isType$1("string"); var isObject3 = isType$1("object"); var isArray2 = isType$1("array"); var isNull2 = eq$1(null); var isBoolean2 = isSimpleType("boolean"); var isUndefined2 = eq$1(void 0); var isNullable = function(a2) { return a2 === null || a2 === void 0; }; var isNonNullable = function(a2) { return !isNullable(a2); }; var isFunction3 = isSimpleType("function"); var isNumber2 = isSimpleType("number"); var isArrayOf = function(value25, pred) { if (isArray2(value25)) { for (var i2 = 0, len = value25.length; i2 < len; ++i2) { if (!pred(value25[i2])) { return false; } } return true; } return false; }; var noop2 = function() { }; var noarg = function(f2) { return function() { return f2(); }; }; var compose = function(fa, fb) { return function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return fa(fb.apply(null, args)); }; }; var compose1 = function(fbc, fab) { return function(a2) { return fbc(fab(a2)); }; }; var constant$1 = function(value25) { return function() { return value25; }; }; var identity$1 = function(x2) { return x2; }; var tripleEquals = function(a2, b3) { return a2 === b3; }; function curry(fn) { var initialArgs = []; for (var _i = 1; _i < arguments.length; _i++) { initialArgs[_i - 1] = arguments[_i]; } return function() { var restArgs = []; for (var _i2 = 0; _i2 < arguments.length; _i2++) { restArgs[_i2] = arguments[_i2]; } var all3 = initialArgs.concat(restArgs); return fn.apply(null, all3); }; } var not = function(f2) { return function(t3) { return !f2(t3); }; }; var die = function(msg) { return function() { throw new Error(msg); }; }; var never = constant$1(false); var always = constant$1(true); var global$g = tinymce.util.Tools.resolve("tinymce.ThemeManager"); var __assign = function() { __assign = Object.assign || function __assign2(t3) { for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) { s2 = arguments[i2]; for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p)) t3[p] = s2[p]; } return t3; }; return __assign.apply(this, arguments); }; function __rest2(s2, e2) { var t3 = {}; for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p) && e2.indexOf(p) < 0) t3[p] = s2[p]; if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p = Object.getOwnPropertySymbols(s2); i2 < p.length; i2++) { if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i2])) t3[p[i2]] = s2[p[i2]]; } return t3; } function __spreadArray(to3, from3, pack) { if (pack || arguments.length === 2) for (var i2 = 0, l3 = from3.length, ar; i2 < l3; i2++) { if (ar || !(i2 in from3)) { if (!ar) ar = Array.prototype.slice.call(from3, 0, i2); ar[i2] = from3[i2]; } } return to3.concat(ar || Array.prototype.slice.call(from3)); } var none = function() { return NONE; }; var NONE = function() { var call2 = function(thunk2) { return thunk2(); }; var id2 = identity$1; var me = { fold: function(n2, _s) { return n2(); }, isSome: never, isNone: always, getOr: id2, getOrThunk: call2, getOrDie: function(msg) { throw new Error(msg || "error: getOrDie called on none."); }, getOrNull: constant$1(null), getOrUndefined: constant$1(void 0), or: id2, orThunk: call2, map: none, each: noop2, bind: none, exists: never, forall: always, filter: function() { return none(); }, toArray: function() { return []; }, toString: constant$1("none()") }; return me; }(); var some2 = function(a2) { var constant_a = constant$1(a2); var self2 = function() { return me; }; var bind5 = function(f2) { return f2(a2); }; var me = { fold: function(n2, s2) { return s2(a2); }, isSome: always, isNone: never, getOr: constant_a, getOrThunk: constant_a, getOrDie: constant_a, getOrNull: constant_a, getOrUndefined: constant_a, or: self2, orThunk: self2, map: function(f2) { return some2(f2(a2)); }, each: function(f2) { f2(a2); }, bind: bind5, exists: bind5, forall: bind5, filter: function(f2) { return f2(a2) ? me : NONE; }, toArray: function() { return [a2]; }, toString: function() { return "some(" + a2 + ")"; } }; return me; }; var from$1 = function(value25) { return value25 === null || value25 === void 0 ? NONE : some2(value25); }; var Optional = { some: some2, none, from: from$1 }; var nativeSlice = Array.prototype.slice; var nativeIndexOf = Array.prototype.indexOf; var nativePush = Array.prototype.push; var rawIndexOf = function(ts, t3) { return nativeIndexOf.call(ts, t3); }; var indexOf2 = function(xs, x2) { var r3 = rawIndexOf(xs, x2); return r3 === -1 ? Optional.none() : Optional.some(r3); }; var contains$2 = function(xs, x2) { return rawIndexOf(xs, x2) > -1; }; var exists = function(xs, pred) { for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; if (pred(x2, i2)) { return true; } } return false; }; var range$2 = function(num, f2) { var r3 = []; for (var i2 = 0; i2 < num; i2++) { r3.push(f2(i2)); } return r3; }; var chunk$1 = function(array3, size) { var r3 = []; for (var i2 = 0; i2 < array3.length; i2 += size) { var s2 = nativeSlice.call(array3, i2, i2 + size); r3.push(s2); } return r3; }; var map$2 = function(xs, f2) { var len = xs.length; var r3 = new Array(len); for (var i2 = 0; i2 < len; i2++) { var x2 = xs[i2]; r3[i2] = f2(x2, i2); } return r3; }; var each$12 = function(xs, f2) { for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; f2(x2, i2); } }; var eachr = function(xs, f2) { for (var i2 = xs.length - 1; i2 >= 0; i2--) { var x2 = xs[i2]; f2(x2, i2); } }; var partition$3 = function(xs, pred) { var pass = []; var fail = []; for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; var arr = pred(x2, i2) ? pass : fail; arr.push(x2); } return { pass, fail }; }; var filter$2 = function(xs, pred) { var r3 = []; for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; if (pred(x2, i2)) { r3.push(x2); } } return r3; }; var foldr = function(xs, f2, acc) { eachr(xs, function(x2, i2) { acc = f2(acc, x2, i2); }); return acc; }; var foldl = function(xs, f2, acc) { each$12(xs, function(x2, i2) { acc = f2(acc, x2, i2); }); return acc; }; var findUntil = function(xs, pred, until) { for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; if (pred(x2, i2)) { return Optional.some(x2); } else if (until(x2, i2)) { break; } } return Optional.none(); }; var find$5 = function(xs, pred) { return findUntil(xs, pred, never); }; var findIndex$1 = function(xs, pred) { for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; if (pred(x2, i2)) { return Optional.some(i2); } } return Optional.none(); }; var flatten2 = function(xs) { var r3 = []; for (var i2 = 0, len = xs.length; i2 < len; ++i2) { if (!isArray2(xs[i2])) { throw new Error("Arr.flatten item " + i2 + " was not an array, input: " + xs); } nativePush.apply(r3, xs[i2]); } return r3; }; var bind$32 = function(xs, f2) { return flatten2(map$2(xs, f2)); }; var forall = function(xs, pred) { for (var i2 = 0, len = xs.length; i2 < len; ++i2) { var x2 = xs[i2]; if (pred(x2, i2) !== true) { return false; } } return true; }; var reverse = function(xs) { var r3 = nativeSlice.call(xs, 0); r3.reverse(); return r3; }; var difference = function(a1, a2) { return filter$2(a1, function(x2) { return !contains$2(a2, x2); }); }; var mapToObject = function(xs, f2) { var r3 = {}; for (var i2 = 0, len = xs.length; i2 < len; i2++) { var x2 = xs[i2]; r3[String(x2)] = f2(x2, i2); } return r3; }; var pure$2 = function(x2) { return [x2]; }; var sort = function(xs, comparator) { var copy = nativeSlice.call(xs, 0); copy.sort(comparator); return copy; }; var get$f = function(xs, i2) { return i2 >= 0 && i2 < xs.length ? Optional.some(xs[i2]) : Optional.none(); }; var head = function(xs) { return get$f(xs, 0); }; var last$2 = function(xs) { return get$f(xs, xs.length - 1); }; var from2 = isFunction3(Array.from) ? Array.from : function(x2) { return nativeSlice.call(x2); }; var findMap = function(arr, f2) { for (var i2 = 0; i2 < arr.length; i2++) { var r3 = f2(arr[i2], i2); if (r3.isSome()) { return r3; } } return Optional.none(); }; var keys2 = Object.keys; var hasOwnProperty$12 = Object.hasOwnProperty; var each2 = function(obj, f2) { var props2 = keys2(obj); for (var k2 = 0, len = props2.length; k2 < len; k2++) { var i2 = props2[k2]; var x2 = obj[i2]; f2(x2, i2); } }; var map$1 = function(obj, f2) { return tupleMap(obj, function(x2, i2) { return { k: i2, v: f2(x2, i2) }; }); }; var tupleMap = function(obj, f2) { var r3 = {}; each2(obj, function(x2, i2) { var tuple3 = f2(x2, i2); r3[tuple3.k] = tuple3.v; }); return r3; }; var objAcc = function(r3) { return function(x2, i2) { r3[i2] = x2; }; }; var internalFilter = function(obj, pred, onTrue, onFalse) { var r3 = {}; each2(obj, function(x2, i2) { (pred(x2, i2) ? onTrue : onFalse)(x2, i2); }); return r3; }; var filter$1 = function(obj, pred) { var t3 = {}; internalFilter(obj, pred, objAcc(t3), noop2); return t3; }; var mapToArray2 = function(obj, f2) { var r3 = []; each2(obj, function(value25, name2) { r3.push(f2(value25, name2)); }); return r3; }; var find$4 = function(obj, pred) { var props2 = keys2(obj); for (var k2 = 0, len = props2.length; k2 < len; k2++) { var i2 = props2[k2]; var x2 = obj[i2]; if (pred(x2, i2, obj)) { return Optional.some(x2); } } return Optional.none(); }; var values2 = function(obj) { return mapToArray2(obj, identity$1); }; var get$e = function(obj, key2) { return has$22(obj, key2) ? Optional.from(obj[key2]) : Optional.none(); }; var has$22 = function(obj, key2) { return hasOwnProperty$12.call(obj, key2); }; var hasNonNullableKey = function(obj, key2) { return has$22(obj, key2) && obj[key2] !== void 0 && obj[key2] !== null; }; var is$1 = function(lhs, rhs, comparator) { if (comparator === void 0) { comparator = tripleEquals; } return lhs.exists(function(left2) { return comparator(left2, rhs); }); }; var equals = function(lhs, rhs, comparator) { if (comparator === void 0) { comparator = tripleEquals; } return lift2(lhs, rhs, comparator).getOr(lhs.isNone() && rhs.isNone()); }; var cat = function(arr) { var r3 = []; var push3 = function(x2) { r3.push(x2); }; for (var i2 = 0; i2 < arr.length; i2++) { arr[i2].each(push3); } return r3; }; var sequence = function(arr) { var r3 = []; for (var i2 = 0; i2 < arr.length; i2++) { var x2 = arr[i2]; if (x2.isSome()) { r3.push(x2.getOrDie()); } else { return Optional.none(); } } return Optional.some(r3); }; var lift2 = function(oa, ob, f2) { return oa.isSome() && ob.isSome() ? Optional.some(f2(oa.getOrDie(), ob.getOrDie())) : Optional.none(); }; var lift3 = function(oa, ob, oc, f2) { return oa.isSome() && ob.isSome() && oc.isSome() ? Optional.some(f2(oa.getOrDie(), ob.getOrDie(), oc.getOrDie())) : Optional.none(); }; var mapFrom = function(a2, f2) { return a2 !== void 0 && a2 !== null ? Optional.some(f2(a2)) : Optional.none(); }; var someIf = function(b3, a2) { return b3 ? Optional.some(a2) : Optional.none(); }; var addToEnd = function(str, suffix2) { return str + suffix2; }; var removeFromStart = function(str, numChars) { return str.substring(numChars); }; var checkRange = function(str, substr, start) { return substr === "" || str.length >= substr.length && str.substr(start, start + substr.length) === substr; }; var removeLeading = function(str, prefix2) { return startsWith(str, prefix2) ? removeFromStart(str, prefix2.length) : str; }; var ensureTrailing = function(str, suffix2) { return endsWith2(str, suffix2) ? str : addToEnd(str, suffix2); }; var contains$1 = function(str, substr) { return str.indexOf(substr) !== -1; }; var startsWith = function(str, prefix2) { return checkRange(str, prefix2, 0); }; var endsWith2 = function(str, suffix2) { return checkRange(str, suffix2, str.length - suffix2.length); }; var blank = function(r3) { return function(s2) { return s2.replace(r3, ""); }; }; var trim$12 = blank(/^\s+|\s+$/g); var isNotEmpty = function(s2) { return s2.length > 0; }; var isEmpty = function(s2) { return !isNotEmpty(s2); }; var isSupported$1 = function(dom2) { return dom2.style !== void 0 && isFunction3(dom2.style.getPropertyValue); }; var fromHtml$2 = function(html2, scope) { var doc = scope || document; var div = doc.createElement("div"); div.innerHTML = html2; if (!div.hasChildNodes() || div.childNodes.length > 1) { console.error("HTML does not have a single root node", html2); throw new Error("HTML must have a single root node"); } return fromDom(div.childNodes[0]); }; var fromTag = function(tag, scope) { var doc = scope || document; var node = doc.createElement(tag); return fromDom(node); }; var fromText = function(text2, scope) { var doc = scope || document; var node = doc.createTextNode(text2); return fromDom(node); }; var fromDom = function(node) { if (node === null || node === void 0) { throw new Error("Node cannot be null or undefined"); } return { dom: node }; }; var fromPoint = function(docElm, x2, y2) { return Optional.from(docElm.dom.elementFromPoint(x2, y2)).map(fromDom); }; var SugarElement = { fromHtml: fromHtml$2, fromTag, fromText, fromDom, fromPoint }; typeof window !== "undefined" ? window : Function("return this;")(); var DOCUMENT = 9; var DOCUMENT_FRAGMENT = 11; var ELEMENT = 1; var TEXT = 3; var name$2 = function(element2) { var r3 = element2.dom.nodeName; return r3.toLowerCase(); }; var type2 = function(element2) { return element2.dom.nodeType; }; var isType = function(t3) { return function(element2) { return type2(element2) === t3; }; }; var isElement$2 = isType(ELEMENT); var isText$1 = isType(TEXT); var isDocument = isType(DOCUMENT); var isDocumentFragment = isType(DOCUMENT_FRAGMENT); var cached2 = function(f2) { var called = false; var r3; return function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (!called) { called = true; r3 = f2.apply(null, args); } return r3; }; }; var DeviceType = function(os, browser, userAgent, mediaMatch2) { var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true; var isiPhone = os.isiOS() && !isiPad; var isMobile2 = os.isiOS() || os.isAndroid(); var isTouch2 = isMobile2 || mediaMatch2("(pointer:coarse)"); var isTablet = isiPad || !isiPhone && isMobile2 && mediaMatch2("(min-device-width:768px)"); var isPhone = isiPhone || isMobile2 && !isTablet; var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false; var isDesktop = !isPhone && !isTablet && !iOSwebview; return { isiPad: constant$1(isiPad), isiPhone: constant$1(isiPhone), isTablet: constant$1(isTablet), isPhone: constant$1(isPhone), isTouch: constant$1(isTouch2), isAndroid: os.isAndroid, isiOS: os.isiOS, isWebView: constant$1(iOSwebview), isDesktop: constant$1(isDesktop) }; }; var firstMatch = function(regexes2, s2) { for (var i2 = 0; i2 < regexes2.length; i2++) { var x2 = regexes2[i2]; if (x2.test(s2)) { return x2; } } return void 0; }; var find$3 = function(regexes2, agent) { var r3 = firstMatch(regexes2, agent); if (!r3) { return { major: 0, minor: 0 }; } var group2 = function(i2) { return Number(agent.replace(r3, "$" + i2)); }; return nu$d(group2(1), group2(2)); }; var detect$4 = function(versionRegexes, agent) { var cleanedAgent = String(agent).toLowerCase(); if (versionRegexes.length === 0) { return unknown$3(); } return find$3(versionRegexes, cleanedAgent); }; var unknown$3 = function() { return nu$d(0, 0); }; var nu$d = function(major, minor) { return { major, minor }; }; var Version = { nu: nu$d, detect: detect$4, unknown: unknown$3 }; var detectBrowser$1 = function(browsers2, userAgentData) { return findMap(userAgentData.brands, function(uaBrand) { var lcBrand = uaBrand.brand.toLowerCase(); return find$5(browsers2, function(browser) { var _a4; return lcBrand === ((_a4 = browser.brand) === null || _a4 === void 0 ? void 0 : _a4.toLowerCase()); }).map(function(info3) { return { current: info3.name, version: Version.nu(parseInt(uaBrand.version, 10), 0) }; }); }); }; var detect$3 = function(candidates, userAgent) { var agent = String(userAgent).toLowerCase(); return find$5(candidates, function(candidate) { return candidate.search(agent); }); }; var detectBrowser = function(browsers2, userAgent) { return detect$3(browsers2, userAgent).map(function(browser) { var version = Version.detect(browser.versionRegexes, userAgent); return { current: browser.name, version }; }); }; var detectOs = function(oses2, userAgent) { return detect$3(oses2, userAgent).map(function(os) { var version = Version.detect(os.versionRegexes, userAgent); return { current: os.name, version }; }); }; var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/; var checkContains = function(target) { return function(uastring) { return contains$1(uastring, target); }; }; var browsers = [ { name: "Edge", versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/], search: function(uastring) { return contains$1(uastring, "edge/") && contains$1(uastring, "chrome") && contains$1(uastring, "safari") && contains$1(uastring, "applewebkit"); } }, { name: "Chrome", brand: "Chromium", versionRegexes: [ /.*?chrome\/([0-9]+)\.([0-9]+).*/, normalVersionRegex ], search: function(uastring) { return contains$1(uastring, "chrome") && !contains$1(uastring, "chromeframe"); } }, { name: "IE", versionRegexes: [ /.*?msie\ ?([0-9]+)\.([0-9]+).*/, /.*?rv:([0-9]+)\.([0-9]+).*/ ], search: function(uastring) { return contains$1(uastring, "msie") || contains$1(uastring, "trident"); } }, { name: "Opera", versionRegexes: [ normalVersionRegex, /.*?opera\/([0-9]+)\.([0-9]+).*/ ], search: checkContains("opera") }, { name: "Firefox", versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/], search: checkContains("firefox") }, { name: "Safari", versionRegexes: [ normalVersionRegex, /.*?cpu os ([0-9]+)_([0-9]+).*/ ], search: function(uastring) { return (contains$1(uastring, "safari") || contains$1(uastring, "mobile/")) && contains$1(uastring, "applewebkit"); } } ]; var oses = [ { name: "Windows", search: checkContains("win"), versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/] }, { name: "iOS", search: function(uastring) { return contains$1(uastring, "iphone") || contains$1(uastring, "ipad"); }, versionRegexes: [ /.*?version\/\ ?([0-9]+)\.([0-9]+).*/, /.*cpu os ([0-9]+)_([0-9]+).*/, /.*cpu iphone os ([0-9]+)_([0-9]+).*/ ] }, { name: "Android", search: checkContains("android"), versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/] }, { name: "OSX", search: checkContains("mac os x"), versionRegexes: [/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/] }, { name: "Linux", search: checkContains("linux"), versionRegexes: [] }, { name: "Solaris", search: checkContains("sunos"), versionRegexes: [] }, { name: "FreeBSD", search: checkContains("freebsd"), versionRegexes: [] }, { name: "ChromeOS", search: checkContains("cros"), versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/] } ]; var PlatformInfo = { browsers: constant$1(browsers), oses: constant$1(oses) }; var edge = "Edge"; var chrome = "Chrome"; var ie = "IE"; var opera = "Opera"; var firefox = "Firefox"; var safari = "Safari"; var unknown$2 = function() { return nu$c({ current: void 0, version: Version.unknown() }); }; var nu$c = function(info3) { var current2 = info3.current; var version = info3.version; var isBrowser2 = function(name2) { return function() { return current2 === name2; }; }; return { current: current2, version, isEdge: isBrowser2(edge), isChrome: isBrowser2(chrome), isIE: isBrowser2(ie), isOpera: isBrowser2(opera), isFirefox: isBrowser2(firefox), isSafari: isBrowser2(safari) }; }; var Browser = { unknown: unknown$2, nu: nu$c, edge: constant$1(edge), chrome: constant$1(chrome), ie: constant$1(ie), opera: constant$1(opera), firefox: constant$1(firefox), safari: constant$1(safari) }; var windows = "Windows"; var ios = "iOS"; var android = "Android"; var linux = "Linux"; var osx = "OSX"; var solaris = "Solaris"; var freebsd = "FreeBSD"; var chromeos = "ChromeOS"; var unknown$1 = function() { return nu$b({ current: void 0, version: Version.unknown() }); }; var nu$b = function(info3) { var current2 = info3.current; var version = info3.version; var isOS = function(name2) { return function() { return current2 === name2; }; }; return { current: current2, version, isWindows: isOS(windows), isiOS: isOS(ios), isAndroid: isOS(android), isOSX: isOS(osx), isLinux: isOS(linux), isSolaris: isOS(solaris), isFreeBSD: isOS(freebsd), isChromeOS: isOS(chromeos) }; }; var OperatingSystem = { unknown: unknown$1, nu: nu$b, windows: constant$1(windows), ios: constant$1(ios), android: constant$1(android), linux: constant$1(linux), osx: constant$1(osx), solaris: constant$1(solaris), freebsd: constant$1(freebsd), chromeos: constant$1(chromeos) }; var detect$2 = function(userAgent, userAgentDataOpt, mediaMatch2) { var browsers2 = PlatformInfo.browsers(); var oses2 = PlatformInfo.oses(); var browser = userAgentDataOpt.bind(function(userAgentData) { return detectBrowser$1(browsers2, userAgentData); }).orThunk(function() { return detectBrowser(browsers2, userAgent); }).fold(Browser.unknown, Browser.nu); var os = detectOs(oses2, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu); var deviceType = DeviceType(os, browser, userAgent, mediaMatch2); return { browser, os, deviceType }; }; var PlatformDetection = { detect: detect$2 }; var mediaMatch = function(query2) { return window.matchMedia(query2).matches; }; var platform = cached2(function() { return PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch); }); var detect$1 = function() { return platform(); }; var compareDocumentPosition = function(a2, b3, match5) { return (a2.compareDocumentPosition(b3) & match5) !== 0; }; var documentPositionContainedBy = function(a2, b3) { return compareDocumentPosition(a2, b3, Node.DOCUMENT_POSITION_CONTAINED_BY); }; var is2 = function(element2, selector2) { var dom2 = element2.dom; if (dom2.nodeType !== ELEMENT) { return false; } else { var elem = dom2; if (elem.matches !== void 0) { return elem.matches(selector2); } else if (elem.msMatchesSelector !== void 0) { return elem.msMatchesSelector(selector2); } else if (elem.webkitMatchesSelector !== void 0) { return elem.webkitMatchesSelector(selector2); } else if (elem.mozMatchesSelector !== void 0) { return elem.mozMatchesSelector(selector2); } else { throw new Error("Browser lacks native selectors"); } } }; var bypassSelector = function(dom2) { return dom2.nodeType !== ELEMENT && dom2.nodeType !== DOCUMENT && dom2.nodeType !== DOCUMENT_FRAGMENT || dom2.childElementCount === 0; }; var all$3 = function(selector2, scope) { var base2 = scope === void 0 ? document : scope.dom; return bypassSelector(base2) ? [] : map$2(base2.querySelectorAll(selector2), SugarElement.fromDom); }; var one = function(selector2, scope) { var base2 = scope === void 0 ? document : scope.dom; return bypassSelector(base2) ? Optional.none() : Optional.from(base2.querySelector(selector2)).map(SugarElement.fromDom); }; var eq2 = function(e1, e2) { return e1.dom === e2.dom; }; var regularContains = function(e1, e2) { var d1 = e1.dom; var d2 = e2.dom; return d1 === d2 ? false : d1.contains(d2); }; var ieContains = function(e1, e2) { return documentPositionContainedBy(e1.dom, e2.dom); }; var contains2 = function(e1, e2) { return detect$1().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2); }; var owner$4 = function(element2) { return SugarElement.fromDom(element2.dom.ownerDocument); }; var documentOrOwner = function(dos) { return isDocument(dos) ? dos : owner$4(dos); }; var documentElement = function(element2) { return SugarElement.fromDom(documentOrOwner(element2).dom.documentElement); }; var defaultView = function(element2) { return SugarElement.fromDom(documentOrOwner(element2).dom.defaultView); }; var parent2 = function(element2) { return Optional.from(element2.dom.parentNode).map(SugarElement.fromDom); }; var parentNode = function(element2) { return parent2(element2); }; var offsetParent = function(element2) { return Optional.from(element2.dom.offsetParent).map(SugarElement.fromDom); }; var nextSibling = function(element2) { return Optional.from(element2.dom.nextSibling).map(SugarElement.fromDom); }; var children = function(element2) { return map$2(element2.dom.childNodes, SugarElement.fromDom); }; var child$2 = function(element2, index2) { var cs = element2.dom.childNodes; return Optional.from(cs[index2]).map(SugarElement.fromDom); }; var firstChild = function(element2) { return child$2(element2, 0); }; var spot = function(element2, offset5) { return { element: element2, offset: offset5 }; }; var leaf = function(element2, offset5) { var cs = children(element2); return cs.length > 0 && offset5 < cs.length ? spot(cs[offset5], 0) : spot(element2, offset5); }; var isShadowRoot = function(dos) { return isDocumentFragment(dos) && isNonNullable(dos.dom.host); }; var supported = isFunction3(Element.prototype.attachShadow) && isFunction3(Node.prototype.getRootNode); var isSupported = constant$1(supported); var getRootNode = supported ? function(e2) { return SugarElement.fromDom(e2.dom.getRootNode()); } : documentOrOwner; var getContentContainer = function(dos) { return isShadowRoot(dos) ? dos : SugarElement.fromDom(documentOrOwner(dos).dom.body); }; var isInShadowRoot = function(e2) { return getShadowRoot(e2).isSome(); }; var getShadowRoot = function(e2) { var r3 = getRootNode(e2); return isShadowRoot(r3) ? Optional.some(r3) : Optional.none(); }; var getShadowHost = function(e2) { return SugarElement.fromDom(e2.dom.host); }; var getOriginalEventTarget = function(event) { if (isSupported() && isNonNullable(event.target)) { var el = SugarElement.fromDom(event.target); if (isElement$2(el) && isOpenShadowHost(el)) { if (event.composed && event.composedPath) { var composedPath = event.composedPath(); if (composedPath) { return head(composedPath); } } } } return Optional.from(event.target); }; var isOpenShadowHost = function(element2) { return isNonNullable(element2.dom.shadowRoot); }; var inBody = function(element2) { var dom2 = isText$1(element2) ? element2.dom.parentNode : element2.dom; if (dom2 === void 0 || dom2 === null || dom2.ownerDocument === null) { return false; } var doc = dom2.ownerDocument; return getShadowRoot(SugarElement.fromDom(dom2)).fold(function() { return doc.body.contains(dom2); }, compose1(inBody, getShadowHost)); }; var body = function() { return getBody2(SugarElement.fromDom(document)); }; var getBody2 = function(doc) { var b3 = doc.dom.body; if (b3 === null || b3 === void 0) { throw new Error("Body is not available yet"); } return SugarElement.fromDom(b3); }; var rawSet = function(dom2, key2, value25) { if (isString3(value25) || isBoolean2(value25) || isNumber2(value25)) { dom2.setAttribute(key2, value25 + ""); } else { console.error("Invalid call to Attribute.set. Key ", key2, ":: Value ", value25, ":: Element ", dom2); throw new Error("Attribute value was not simple"); } }; var set$8 = function(element2, key2, value25) { rawSet(element2.dom, key2, value25); }; var setAll$1 = function(element2, attrs) { var dom2 = element2.dom; each2(attrs, function(v2, k2) { rawSet(dom2, k2, v2); }); }; var get$d = function(element2, key2) { var v2 = element2.dom.getAttribute(key2); return v2 === null ? void 0 : v2; }; var getOpt = function(element2, key2) { return Optional.from(get$d(element2, key2)); }; var has$12 = function(element2, key2) { var dom2 = element2.dom; return dom2 && dom2.hasAttribute ? dom2.hasAttribute(key2) : false; }; var remove$7 = function(element2, key2) { element2.dom.removeAttribute(key2); }; var internalSet = function(dom2, property2, value25) { if (!isString3(value25)) { console.error("Invalid call to CSS.set. Property ", property2, ":: Value ", value25, ":: Element ", dom2); throw new Error("CSS value must be a string: " + value25); } if (isSupported$1(dom2)) { dom2.style.setProperty(property2, value25); } }; var internalRemove = function(dom2, property2) { if (isSupported$1(dom2)) { dom2.style.removeProperty(property2); } }; var set$7 = function(element2, property2, value25) { var dom2 = element2.dom; internalSet(dom2, property2, value25); }; var setAll = function(element2, css2) { var dom2 = element2.dom; each2(css2, function(v2, k2) { internalSet(dom2, k2, v2); }); }; var setOptions = function(element2, css2) { var dom2 = element2.dom; each2(css2, function(v2, k2) { v2.fold(function() { internalRemove(dom2, k2); }, function(value25) { internalSet(dom2, k2, value25); }); }); }; var get$c = function(element2, property2) { var dom2 = element2.dom; var styles = window.getComputedStyle(dom2); var r3 = styles.getPropertyValue(property2); return r3 === "" && !inBody(element2) ? getUnsafeProperty(dom2, property2) : r3; }; var getUnsafeProperty = function(dom2, property2) { return isSupported$1(dom2) ? dom2.style.getPropertyValue(property2) : ""; }; var getRaw = function(element2, property2) { var dom2 = element2.dom; var raw = getUnsafeProperty(dom2, property2); return Optional.from(raw).filter(function(r3) { return r3.length > 0; }); }; var getAllRaw = function(element2) { var css2 = {}; var dom2 = element2.dom; if (isSupported$1(dom2)) { for (var i2 = 0; i2 < dom2.style.length; i2++) { var ruleName = dom2.style.item(i2); css2[ruleName] = dom2.style[ruleName]; } } return css2; }; var isValidValue = function(tag, property2, value25) { var element2 = SugarElement.fromTag(tag); set$7(element2, property2, value25); var style = getRaw(element2, property2); return style.isSome(); }; var remove$6 = function(element2, property2) { var dom2 = element2.dom; internalRemove(dom2, property2); if (is$1(getOpt(element2, "style").map(trim$12), "")) { remove$7(element2, "style"); } }; var reflow = function(e2) { return e2.dom.offsetWidth; }; var Dimension = function(name2, getOffset3) { var set3 = function(element2, h2) { if (!isNumber2(h2) && !h2.match(/^[0-9]+$/)) { throw new Error(name2 + ".set accepts only positive integer values. Value was " + h2); } var dom2 = element2.dom; if (isSupported$1(dom2)) { dom2.style[name2] = h2 + "px"; } }; var get3 = function(element2) { var r3 = getOffset3(element2); if (r3 <= 0 || r3 === null) { var css2 = get$c(element2, name2); return parseFloat(css2) || 0; } return r3; }; var getOuter2 = get3; var aggregate = function(element2, properties2) { return foldl(properties2, function(acc, property2) { var val = get$c(element2, property2); var value25 = val === void 0 ? 0 : parseInt(val, 10); return isNaN(value25) ? acc : acc + value25; }, 0); }; var max5 = function(element2, value25, properties2) { var cumulativeInclusions = aggregate(element2, properties2); var absoluteMax = value25 > cumulativeInclusions ? value25 - cumulativeInclusions : 0; return absoluteMax; }; return { set: set3, get: get3, getOuter: getOuter2, aggregate, max: max5 }; }; var api$3 = Dimension("height", function(element2) { var dom2 = element2.dom; return inBody(element2) ? dom2.getBoundingClientRect().height : dom2.offsetHeight; }); var get$b = function(element2) { return api$3.get(element2); }; var getOuter$2 = function(element2) { return api$3.getOuter(element2); }; var setMax$1 = function(element2, value25) { var inclusions = [ "margin-top", "border-top-width", "padding-top", "padding-bottom", "border-bottom-width", "margin-bottom" ]; var absMax = api$3.max(element2, value25, inclusions); set$7(element2, "max-height", absMax + "px"); }; var r$12 = function(left2, top2) { var translate2 = function(x2, y2) { return r$12(left2 + x2, top2 + y2); }; return { left: left2, top: top2, translate: translate2 }; }; var SugarPosition = r$12; var boxPosition = function(dom2) { var box2 = dom2.getBoundingClientRect(); return SugarPosition(box2.left, box2.top); }; var firstDefinedOrZero = function(a2, b3) { if (a2 !== void 0) { return a2; } else { return b3 !== void 0 ? b3 : 0; } }; var absolute$3 = function(element2) { var doc = element2.dom.ownerDocument; var body2 = doc.body; var win2 = doc.defaultView; var html2 = doc.documentElement; if (body2 === element2.dom) { return SugarPosition(body2.offsetLeft, body2.offsetTop); } var scrollTop2 = firstDefinedOrZero(win2 === null || win2 === void 0 ? void 0 : win2.pageYOffset, html2.scrollTop); var scrollLeft2 = firstDefinedOrZero(win2 === null || win2 === void 0 ? void 0 : win2.pageXOffset, html2.scrollLeft); var clientTop = firstDefinedOrZero(html2.clientTop, body2.clientTop); var clientLeft = firstDefinedOrZero(html2.clientLeft, body2.clientLeft); return viewport$1(element2).translate(scrollLeft2 - clientLeft, scrollTop2 - clientTop); }; var viewport$1 = function(element2) { var dom2 = element2.dom; var doc = dom2.ownerDocument; var body2 = doc.body; if (body2 === dom2) { return SugarPosition(body2.offsetLeft, body2.offsetTop); } if (!inBody(element2)) { return SugarPosition(0, 0); } return boxPosition(dom2); }; var api$2 = Dimension("width", function(element2) { return element2.dom.offsetWidth; }); var set$6 = function(element2, h2) { return api$2.set(element2, h2); }; var get$a = function(element2) { return api$2.get(element2); }; var getOuter$1 = function(element2) { return api$2.getOuter(element2); }; var setMax = function(element2, value25) { var inclusions = [ "margin-left", "border-left-width", "padding-left", "padding-right", "border-right-width", "margin-right" ]; var absMax = api$2.max(element2, value25, inclusions); set$7(element2, "max-width", absMax + "px"); }; var mkEvent = function(target, x2, y2, stop3, prevent, kill, raw) { return { target, x: x2, y: y2, stop: stop3, prevent, kill, raw }; }; var fromRawEvent$1 = function(rawEvent) { var target = SugarElement.fromDom(getOriginalEventTarget(rawEvent).getOr(rawEvent.target)); var stop3 = function() { return rawEvent.stopPropagation(); }; var prevent = function() { return rawEvent.preventDefault(); }; var kill = compose(prevent, stop3); return mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop3, prevent, kill, rawEvent); }; var handle = function(filter2, handler7) { return function(rawEvent) { if (filter2(rawEvent)) { handler7(fromRawEvent$1(rawEvent)); } }; }; var binder = function(element2, event, filter2, handler7, useCapture) { var wrapped = handle(filter2, handler7); element2.dom.addEventListener(event, wrapped, useCapture); return { unbind: curry(unbind, element2, event, wrapped, useCapture) }; }; var bind$22 = function(element2, event, filter2, handler7) { return binder(element2, event, filter2, handler7, false); }; var capture$1 = function(element2, event, filter2, handler7) { return binder(element2, event, filter2, handler7, true); }; var unbind = function(element2, event, handler7, useCapture) { element2.dom.removeEventListener(event, handler7, useCapture); }; var before$2 = function(marker, element2) { var parent$1 = parent2(marker); parent$1.each(function(v2) { v2.dom.insertBefore(element2.dom, marker.dom); }); }; var after$2 = function(marker, element2) { var sibling = nextSibling(marker); sibling.fold(function() { var parent$1 = parent2(marker); parent$1.each(function(v2) { append$2(v2, element2); }); }, function(v2) { before$2(v2, element2); }); }; var prepend$1 = function(parent3, element2) { var firstChild$1 = firstChild(parent3); firstChild$1.fold(function() { append$2(parent3, element2); }, function(v2) { parent3.dom.insertBefore(element2.dom, v2.dom); }); }; var append$2 = function(parent3, element2) { parent3.dom.appendChild(element2.dom); }; var appendAt = function(parent3, element2, index2) { child$2(parent3, index2).fold(function() { append$2(parent3, element2); }, function(v2) { before$2(v2, element2); }); }; var before$1 = function(marker, elements) { each$12(elements, function(x2) { before$2(marker, x2); }); }; var append$1 = function(parent3, elements) { each$12(elements, function(x2) { append$2(parent3, x2); }); }; var empty2 = function(element2) { element2.dom.textContent = ""; each$12(children(element2), function(rogue) { remove$5(rogue); }); }; var remove$5 = function(element2) { var dom2 = element2.dom; if (dom2.parentNode !== null) { dom2.parentNode.removeChild(dom2); } }; var unwrap = function(wrapper) { var children$1 = children(wrapper); if (children$1.length > 0) { before$1(wrapper, children$1); } remove$5(wrapper); }; var get$9 = function(_DOC) { var doc = _DOC !== void 0 ? _DOC.dom : document; var x2 = doc.body.scrollLeft || doc.documentElement.scrollLeft; var y2 = doc.body.scrollTop || doc.documentElement.scrollTop; return SugarPosition(x2, y2); }; var to2 = function(x2, y2, _DOC) { var doc = _DOC !== void 0 ? _DOC.dom : document; var win2 = doc.defaultView; if (win2) { win2.scrollTo(x2, y2); } }; var get$8 = function(_win) { var win2 = _win === void 0 ? window : _win; if (detect$1().browser.isFirefox()) { return Optional.none(); } else { return Optional.from(win2["visualViewport"]); } }; var bounds$1 = function(x2, y2, width2, height2) { return { x: x2, y: y2, width: width2, height: height2, right: x2 + width2, bottom: y2 + height2 }; }; var getBounds$3 = function(_win) { var win2 = _win === void 0 ? window : _win; var doc = win2.document; var scroll = get$9(SugarElement.fromDom(doc)); return get$8(win2).fold(function() { var html2 = win2.document.documentElement; var width2 = html2.clientWidth; var height2 = html2.clientHeight; return bounds$1(scroll.left, scroll.top, width2, height2); }, function(visualViewport) { return bounds$1(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height); }); }; var walkUp = function(navigation, doc) { var frame = navigation.view(doc); return frame.fold(constant$1([]), function(f2) { var parent3 = navigation.owner(f2); var rest = walkUp(navigation, parent3); return [f2].concat(rest); }); }; var pathTo = function(element2, navigation) { var d2 = navigation.owner(element2); var paths = walkUp(navigation, d2); return Optional.some(paths); }; var view = function(doc) { var _a4; var element2 = doc.dom === document ? Optional.none() : Optional.from((_a4 = doc.dom.defaultView) === null || _a4 === void 0 ? void 0 : _a4.frameElement); return element2.map(SugarElement.fromDom); }; var owner$3 = function(element2) { return owner$4(element2); }; var Navigation = /* @__PURE__ */ Object.freeze({ __proto__: null, view, owner: owner$3 }); var find$2 = function(element2) { var doc = SugarElement.fromDom(document); var scroll = get$9(doc); var path3 = pathTo(element2, Navigation); return path3.fold(curry(absolute$3, element2), function(frames) { var offset5 = viewport$1(element2); var r3 = foldr(frames, function(b3, a2) { var loc = viewport$1(a2); return { left: b3.left + loc.left, top: b3.top + loc.top }; }, { left: 0, top: 0 }); return SugarPosition(r3.left + offset5.left + scroll.left, r3.top + offset5.top + scroll.top); }); }; var pointed = function(point2, width2, height2) { return { point: point2, width: width2, height: height2 }; }; var rect = function(x2, y2, width2, height2) { return { x: x2, y: y2, width: width2, height: height2 }; }; var bounds = function(x2, y2, width2, height2) { return { x: x2, y: y2, width: width2, height: height2, right: x2 + width2, bottom: y2 + height2 }; }; var box$1 = function(element2) { var xy = absolute$3(element2); var w2 = getOuter$1(element2); var h2 = getOuter$2(element2); return bounds(xy.left, xy.top, w2, h2); }; var absolute$2 = function(element2) { var position3 = find$2(element2); var width2 = getOuter$1(element2); var height2 = getOuter$2(element2); return bounds(position3.left, position3.top, width2, height2); }; var win = function() { return getBounds$3(window); }; var value$3 = function(o2) { var or = function(_opt) { return value$3(o2); }; var orThunk = function(_f) { return value$3(o2); }; var map3 = function(f2) { return value$3(f2(o2)); }; var mapError2 = function(_f) { return value$3(o2); }; var each3 = function(f2) { f2(o2); }; var bind5 = function(f2) { return f2(o2); }; var fold2 = function(_2, onValue) { return onValue(o2); }; var exists2 = function(f2) { return f2(o2); }; var forall2 = function(f2) { return f2(o2); }; var toOptional = function() { return Optional.some(o2); }; return { isValue: always, isError: never, getOr: constant$1(o2), getOrThunk: constant$1(o2), getOrDie: constant$1(o2), or, orThunk, fold: fold2, map: map3, mapError: mapError2, each: each3, bind: bind5, exists: exists2, forall: forall2, toOptional }; }; var error$12 = function(message2) { var getOrThunk = function(f2) { return f2(); }; var getOrDie2 = function() { return die(String(message2))(); }; var or = identity$1; var orThunk = function(f2) { return f2(); }; var map3 = function(_f) { return error$12(message2); }; var mapError2 = function(f2) { return error$12(f2(message2)); }; var bind5 = function(_f) { return error$12(message2); }; var fold2 = function(onError2, _2) { return onError2(message2); }; return { isValue: never, isError: always, getOr: identity$1, getOrThunk, getOrDie: getOrDie2, or, orThunk, fold: fold2, map: map3, mapError: mapError2, each: noop2, bind: bind5, exists: never, forall: always, toOptional: Optional.none }; }; var fromOption = function(opt, err) { return opt.fold(function() { return error$12(err); }, value$3); }; var Result = { value: value$3, error: error$12, fromOption }; var SimpleResultType; (function(SimpleResultType2) { SimpleResultType2[SimpleResultType2["Error"] = 0] = "Error"; SimpleResultType2[SimpleResultType2["Value"] = 1] = "Value"; })(SimpleResultType || (SimpleResultType = {})); var fold$1 = function(res, onError2, onValue) { return res.stype === SimpleResultType.Error ? onError2(res.serror) : onValue(res.svalue); }; var partition$2 = function(results) { var values3 = []; var errors = []; each$12(results, function(obj) { fold$1(obj, function(err) { return errors.push(err); }, function(val) { return values3.push(val); }); }); return { values: values3, errors }; }; var mapError = function(res, f2) { if (res.stype === SimpleResultType.Error) { return { stype: SimpleResultType.Error, serror: f2(res.serror) }; } else { return res; } }; var map2 = function(res, f2) { if (res.stype === SimpleResultType.Value) { return { stype: SimpleResultType.Value, svalue: f2(res.svalue) }; } else { return res; } }; var bind$12 = function(res, f2) { if (res.stype === SimpleResultType.Value) { return f2(res.svalue); } else { return res; } }; var bindError = function(res, f2) { if (res.stype === SimpleResultType.Error) { return f2(res.serror); } else { return res; } }; var svalue = function(v2) { return { stype: SimpleResultType.Value, svalue: v2 }; }; var serror = function(e2) { return { stype: SimpleResultType.Error, serror: e2 }; }; var toResult$1 = function(res) { return fold$1(res, Result.error, Result.value); }; var fromResult$1 = function(res) { return res.fold(serror, svalue); }; var SimpleResult = { fromResult: fromResult$1, toResult: toResult$1, svalue, partition: partition$2, serror, bind: bind$12, bindError, map: map2, mapError, fold: fold$1 }; var field$2 = function(key2, newKey, presence, prop) { return { tag: "field", key: key2, newKey, presence, prop }; }; var customField$1 = function(newKey, instantiator) { return { tag: "custom", newKey, instantiator }; }; var fold = function(value25, ifField, ifCustom) { switch (value25.tag) { case "field": return ifField(value25.key, value25.newKey, value25.presence, value25.prop); case "custom": return ifCustom(value25.newKey, value25.instantiator); } }; var shallow$1 = function(old, nu2) { return nu2; }; var deep = function(old, nu2) { var bothObjects = isObject3(old) && isObject3(nu2); return bothObjects ? deepMerge2(old, nu2) : nu2; }; var baseMerge2 = function(merger) { return function() { var objects = []; for (var _i = 0; _i < arguments.length; _i++) { objects[_i] = arguments[_i]; } if (objects.length === 0) { throw new Error("Can't merge zero objects"); } var ret = {}; for (var j2 = 0; j2 < objects.length; j2++) { var curObject = objects[j2]; for (var key2 in curObject) { if (has$22(curObject, key2)) { ret[key2] = merger(ret[key2], curObject[key2]); } } } return ret; }; }; var deepMerge2 = baseMerge2(deep); var merge$12 = baseMerge2(shallow$1); var required$2 = function() { return { tag: "required", process: {} }; }; var defaultedThunk = function(fallbackThunk) { return { tag: "defaultedThunk", process: fallbackThunk }; }; var defaulted$1 = function(fallback2) { return defaultedThunk(constant$1(fallback2)); }; var asOption = function() { return { tag: "option", process: {} }; }; var mergeWithThunk = function(baseThunk) { return { tag: "mergeWithThunk", process: baseThunk }; }; var mergeWith = function(base2) { return mergeWithThunk(constant$1(base2)); }; var mergeValues$1 = function(values3, base2) { return values3.length > 0 ? SimpleResult.svalue(deepMerge2(base2, merge$12.apply(void 0, values3))) : SimpleResult.svalue(base2); }; var mergeErrors$1 = function(errors) { return compose(SimpleResult.serror, flatten2)(errors); }; var consolidateObj = function(objects, base2) { var partition3 = SimpleResult.partition(objects); return partition3.errors.length > 0 ? mergeErrors$1(partition3.errors) : mergeValues$1(partition3.values, base2); }; var consolidateArr = function(objects) { var partitions = SimpleResult.partition(objects); return partitions.errors.length > 0 ? mergeErrors$1(partitions.errors) : SimpleResult.svalue(partitions.values); }; var ResultCombine = { consolidateObj, consolidateArr }; var formatObj = function(input2) { return isObject3(input2) && keys2(input2).length > 100 ? " removed due to size" : JSON.stringify(input2, null, 2); }; var formatErrors = function(errors) { var es = errors.length > 10 ? errors.slice(0, 10).concat([{ path: [], getErrorInfo: constant$1("... (only showing first ten failures)") }]) : errors; return map$2(es, function(e2) { return "Failed path: (" + e2.path.join(" > ") + ")\n" + e2.getErrorInfo(); }); }; var nu$a = function(path3, getErrorInfo) { return SimpleResult.serror([{ path: path3, getErrorInfo }]); }; var missingRequired = function(path3, key2, obj) { return nu$a(path3, function() { return 'Could not find valid *required* value for "' + key2 + '" in ' + formatObj(obj); }); }; var missingKey = function(path3, key2) { return nu$a(path3, function() { return 'Choice schema did not contain choice key: "' + key2 + '"'; }); }; var missingBranch = function(path3, branches, branch) { return nu$a(path3, function() { return 'The chosen schema: "' + branch + '" did not exist in branches: ' + formatObj(branches); }); }; var unsupportedFields = function(path3, unsupported) { return nu$a(path3, function() { return "There are unsupported fields: [" + unsupported.join(", ") + "] specified"; }); }; var custom = function(path3, err) { return nu$a(path3, constant$1(err)); }; var value$2 = function(validator4) { var extract2 = function(path3, val) { return SimpleResult.bindError(validator4(val), function(err) { return custom(path3, err); }); }; var toString4 = constant$1("val"); return { extract: extract2, toString: toString4 }; }; var anyValue$1 = value$2(SimpleResult.svalue); var requiredAccess = function(path3, obj, key2, bundle) { return get$e(obj, key2).fold(function() { return missingRequired(path3, key2, obj); }, bundle); }; var fallbackAccess = function(obj, key2, fallback2, bundle) { var v2 = get$e(obj, key2).getOrThunk(function() { return fallback2(obj); }); return bundle(v2); }; var optionAccess = function(obj, key2, bundle) { return bundle(get$e(obj, key2)); }; var optionDefaultedAccess = function(obj, key2, fallback2, bundle) { var opt = get$e(obj, key2).map(function(val) { return val === true ? fallback2(obj) : val; }); return bundle(opt); }; var extractField = function(field2, path3, obj, key2, prop) { var bundle = function(av) { return prop.extract(path3.concat([key2]), av); }; var bundleAsOption = function(optValue) { return optValue.fold(function() { return SimpleResult.svalue(Optional.none()); }, function(ov) { var result = prop.extract(path3.concat([key2]), ov); return SimpleResult.map(result, Optional.some); }); }; switch (field2.tag) { case "required": return requiredAccess(path3, obj, key2, bundle); case "defaultedThunk": return fallbackAccess(obj, key2, field2.process, bundle); case "option": return optionAccess(obj, key2, bundleAsOption); case "defaultedOptionThunk": return optionDefaultedAccess(obj, key2, field2.process, bundleAsOption); case "mergeWithThunk": { return fallbackAccess(obj, key2, constant$1({}), function(v2) { var result = deepMerge2(field2.process(obj), v2); return bundle(result); }); } } }; var extractFields = function(path3, obj, fields2) { var success3 = {}; var errors = []; for (var _i = 0, fields_1 = fields2; _i < fields_1.length; _i++) { var field2 = fields_1[_i]; fold(field2, function(key2, newKey, presence, prop) { var result = extractField(presence, path3, obj, key2, prop); SimpleResult.fold(result, function(err) { errors.push.apply(errors, err); }, function(res) { success3[newKey] = res; }); }, function(newKey, instantiator) { success3[newKey] = instantiator(obj); }); } return errors.length > 0 ? SimpleResult.serror(errors) : SimpleResult.svalue(success3); }; var valueThunk = function(getDelegate) { var extract2 = function(path3, val) { return getDelegate().extract(path3, val); }; var toString4 = function() { return getDelegate().toString(); }; return { extract: extract2, toString: toString4 }; }; var getSetKeys = function(obj) { return keys2(filter$1(obj, isNonNullable)); }; var objOfOnly = function(fields2) { var delegate = objOf(fields2); var fieldNames = foldr(fields2, function(acc, value25) { return fold(value25, function(key2) { var _a4; return deepMerge2(acc, (_a4 = {}, _a4[key2] = true, _a4)); }, constant$1(acc)); }, {}); var extract2 = function(path3, o2) { var keys3 = isBoolean2(o2) ? [] : getSetKeys(o2); var extra = filter$2(keys3, function(k2) { return !hasNonNullableKey(fieldNames, k2); }); return extra.length === 0 ? delegate.extract(path3, o2) : unsupportedFields(path3, extra); }; return { extract: extract2, toString: delegate.toString }; }; var objOf = function(values3) { var extract2 = function(path3, o2) { return extractFields(path3, o2, values3); }; var toString4 = function() { var fieldStrings = map$2(values3, function(value25) { return fold(value25, function(key2, _okey, _presence, prop) { return key2 + " -> " + prop.toString(); }, function(newKey, _instantiator) { return "state(" + newKey + ")"; }); }); return "obj{\n" + fieldStrings.join("\n") + "}"; }; return { extract: extract2, toString: toString4 }; }; var arrOf = function(prop) { var extract2 = function(path3, array3) { var results = map$2(array3, function(a2, i2) { return prop.extract(path3.concat(["[" + i2 + "]"]), a2); }); return ResultCombine.consolidateArr(results); }; var toString4 = function() { return "array(" + prop.toString() + ")"; }; return { extract: extract2, toString: toString4 }; }; var oneOf = function(props2) { var extract2 = function(path3, val) { var errors = []; for (var _i = 0, props_1 = props2; _i < props_1.length; _i++) { var prop = props_1[_i]; var res = prop.extract(path3, val); if (res.stype === SimpleResultType.Value) { return res; } errors.push(res); } return ResultCombine.consolidateArr(errors); }; var toString4 = function() { return "oneOf(" + map$2(props2, function(prop) { return prop.toString(); }).join(", ") + ")"; }; return { extract: extract2, toString: toString4 }; }; var setOf$1 = function(validator4, prop) { var validateKeys = function(path3, keys3) { return arrOf(value$2(validator4)).extract(path3, keys3); }; var extract2 = function(path3, o2) { var keys$12 = keys2(o2); var validatedKeys = validateKeys(path3, keys$12); return SimpleResult.bind(validatedKeys, function(validKeys2) { var schema3 = map$2(validKeys2, function(vk) { return field$2(vk, vk, required$2(), prop); }); return objOf(schema3).extract(path3, o2); }); }; var toString4 = function() { return "setOf(" + prop.toString() + ")"; }; return { extract: extract2, toString: toString4 }; }; var thunk = function(_desc, processor) { var getP = cached2(processor); var extract2 = function(path3, val) { return getP().extract(path3, val); }; var toString4 = function() { return getP().toString(); }; return { extract: extract2, toString: toString4 }; }; var arrOfObj = compose(arrOf, objOf); var anyValue = constant$1(anyValue$1); var typedValue = function(validator4, expectedType) { return value$2(function(a2) { var actualType = typeof a2; return validator4(a2) ? SimpleResult.svalue(a2) : SimpleResult.serror("Expected type: " + expectedType + " but got: " + actualType); }); }; var number3 = typedValue(isNumber2, "number"); var string2 = typedValue(isString3, "string"); var boolean = typedValue(isBoolean2, "boolean"); var functionProcessor = typedValue(isFunction3, "function"); var isPostMessageable = function(val) { if (Object(val) !== val) { return true; } switch ({}.toString.call(val).slice(8, -1)) { case "Boolean": case "Number": case "String": case "Date": case "RegExp": case "Blob": case "FileList": case "ImageData": case "ImageBitmap": case "ArrayBuffer": return true; case "Array": case "Object": return Object.keys(val).every(function(prop) { return isPostMessageable(val[prop]); }); default: return false; } }; var postMessageable = value$2(function(a2) { if (isPostMessageable(a2)) { return SimpleResult.svalue(a2); } else { return SimpleResult.serror("Expected value to be acceptable for sending via postMessage"); } }); var chooseFrom = function(path3, input2, branches, ch) { var fields2 = get$e(branches, ch); return fields2.fold(function() { return missingBranch(path3, branches, ch); }, function(vp) { return vp.extract(path3.concat(["branch: " + ch]), input2); }); }; var choose$2 = function(key2, branches) { var extract2 = function(path3, input2) { var choice = get$e(input2, key2); return choice.fold(function() { return missingKey(path3, key2); }, function(chosen) { return chooseFrom(path3, input2, branches, chosen); }); }; var toString4 = function() { return "chooseOn(" + key2 + "). Possible values: " + keys2(branches); }; return { extract: extract2, toString: toString4 }; }; var arrOfVal = function() { return arrOf(anyValue$1); }; var valueOf2 = function(validator4) { return value$2(function(v2) { return validator4(v2).fold(SimpleResult.serror, SimpleResult.svalue); }); }; var setOf = function(validator4, prop) { return setOf$1(function(v2) { return SimpleResult.fromResult(validator4(v2)); }, prop); }; var extractValue = function(label, prop, obj) { var res = prop.extract([label], obj); return SimpleResult.mapError(res, function(errs) { return { input: obj, errors: errs }; }); }; var asRaw = function(label, prop, obj) { return SimpleResult.toResult(extractValue(label, prop, obj)); }; var getOrDie = function(extraction) { return extraction.fold(function(errInfo) { throw new Error(formatError(errInfo)); }, identity$1); }; var asRawOrDie$1 = function(label, prop, obj) { return getOrDie(asRaw(label, prop, obj)); }; var formatError = function(errInfo) { return "Errors: \n" + formatErrors(errInfo.errors).join("\n") + "\n\nInput object: " + formatObj(errInfo.input); }; var choose$1 = function(key2, branches) { return choose$2(key2, map$1(branches, objOf)); }; var thunkOf = function(desc, schema3) { return thunk(desc, schema3); }; var field$1 = field$2; var customField = customField$1; var validateEnum = function(values3) { return valueOf2(function(value25) { return contains$2(values3, value25) ? Result.value(value25) : Result.error('Unsupported value: "' + value25 + '", choose one of "' + values3.join(", ") + '".'); }); }; var required$12 = function(key2) { return field$1(key2, key2, required$2(), anyValue()); }; var requiredOf = function(key2, schema3) { return field$1(key2, key2, required$2(), schema3); }; var requiredNumber = function(key2) { return requiredOf(key2, number3); }; var requiredString = function(key2) { return requiredOf(key2, string2); }; var requiredStringEnum = function(key2, values3) { return field$1(key2, key2, required$2(), validateEnum(values3)); }; var requiredBoolean = function(key2) { return requiredOf(key2, boolean); }; var requiredFunction = function(key2) { return requiredOf(key2, functionProcessor); }; var forbid = function(key2, message2) { return field$1(key2, key2, asOption(), value$2(function(_v) { return SimpleResult.serror("The field: " + key2 + " is forbidden. " + message2); })); }; var requiredObjOf = function(key2, objSchema) { return field$1(key2, key2, required$2(), objOf(objSchema)); }; var requiredArrayOfObj = function(key2, objFields) { return field$1(key2, key2, required$2(), arrOfObj(objFields)); }; var requiredArrayOf = function(key2, schema3) { return field$1(key2, key2, required$2(), arrOf(schema3)); }; var option = function(key2) { return field$1(key2, key2, asOption(), anyValue()); }; var optionOf = function(key2, schema3) { return field$1(key2, key2, asOption(), schema3); }; var optionNumber = function(key2) { return optionOf(key2, number3); }; var optionString = function(key2) { return optionOf(key2, string2); }; var optionFunction = function(key2) { return optionOf(key2, functionProcessor); }; var optionArrayOf = function(key2, schema3) { return optionOf(key2, arrOf(schema3)); }; var optionObjOf = function(key2, objSchema) { return optionOf(key2, objOf(objSchema)); }; var optionObjOfOnly = function(key2, objSchema) { return optionOf(key2, objOfOnly(objSchema)); }; var defaulted = function(key2, fallback2) { return field$1(key2, key2, defaulted$1(fallback2), anyValue()); }; var defaultedOf = function(key2, fallback2, schema3) { return field$1(key2, key2, defaulted$1(fallback2), schema3); }; var defaultedNumber = function(key2, fallback2) { return defaultedOf(key2, fallback2, number3); }; var defaultedString = function(key2, fallback2) { return defaultedOf(key2, fallback2, string2); }; var defaultedStringEnum = function(key2, fallback2, values3) { return defaultedOf(key2, fallback2, validateEnum(values3)); }; var defaultedBoolean = function(key2, fallback2) { return defaultedOf(key2, fallback2, boolean); }; var defaultedFunction = function(key2, fallback2) { return defaultedOf(key2, fallback2, functionProcessor); }; var defaultedPostMsg = function(key2, fallback2) { return defaultedOf(key2, fallback2, postMessageable); }; var defaultedArrayOf = function(key2, fallback2, schema3) { return defaultedOf(key2, fallback2, arrOf(schema3)); }; var defaultedObjOf = function(key2, fallback2, objSchema) { return defaultedOf(key2, fallback2, objOf(objSchema)); }; var Cell3 = function(initial) { var value25 = initial; var get3 = function() { return value25; }; var set3 = function(v2) { value25 = v2; }; return { get: get3, set: set3 }; }; var generate$7 = function(cases) { if (!isArray2(cases)) { throw new Error("cases must be an array"); } if (cases.length === 0) { throw new Error("there must be at least one case"); } var constructors = []; var adt2 = {}; each$12(cases, function(acase, count3) { var keys$12 = keys2(acase); if (keys$12.length !== 1) { throw new Error("one and only one name per case"); } var key2 = keys$12[0]; var value25 = acase[key2]; if (adt2[key2] !== void 0) { throw new Error("duplicate key detected:" + key2); } else if (key2 === "cata") { throw new Error("cannot have a case named cata (sorry)"); } else if (!isArray2(value25)) { throw new Error("case arguments must be an array"); } constructors.push(key2); adt2[key2] = function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var argLength = args.length; if (argLength !== value25.length) { throw new Error("Wrong number of arguments to case " + key2 + ". Expected " + value25.length + " (" + value25 + "), got " + argLength); } var match5 = function(branches) { var branchKeys = keys2(branches); if (constructors.length !== branchKeys.length) { throw new Error("Wrong number of arguments to match. Expected: " + constructors.join(",") + "\nActual: " + branchKeys.join(",")); } var allReqd = forall(constructors, function(reqKey) { return contains$2(branchKeys, reqKey); }); if (!allReqd) { throw new Error("Not all branches were specified when using match. Specified: " + branchKeys.join(", ") + "\nRequired: " + constructors.join(", ")); } return branches[key2].apply(null, args); }; return { fold: function() { var foldArgs = []; for (var _i2 = 0; _i2 < arguments.length; _i2++) { foldArgs[_i2] = arguments[_i2]; } if (foldArgs.length !== cases.length) { throw new Error("Wrong number of arguments to fold. Expected " + cases.length + ", got " + foldArgs.length); } var target = foldArgs[count3]; return target.apply(null, args); }, match: match5, log: function(label) { console.log(label, { constructors, constructor: key2, params: args }); } }; }; }); return adt2; }; var Adt = { generate: generate$7 }; Adt.generate([ { bothErrors: [ "error1", "error2" ] }, { firstError: [ "error1", "value2" ] }, { secondError: [ "value1", "error2" ] }, { bothValues: [ "value1", "value2" ] } ]); var partition$12 = function(results) { var errors = []; var values3 = []; each$12(results, function(result) { result.fold(function(err) { errors.push(err); }, function(value25) { values3.push(value25); }); }); return { errors, values: values3 }; }; var exclude$1 = function(obj, fields2) { var r3 = {}; each2(obj, function(v2, k2) { if (!contains$2(fields2, k2)) { r3[k2] = v2; } }); return r3; }; var wrap$2 = function(key2, value25) { var _a4; return _a4 = {}, _a4[key2] = value25, _a4; }; var wrapAll$1 = function(keyvalues) { var r3 = {}; each$12(keyvalues, function(kv) { r3[kv.key] = kv.value; }); return r3; }; var exclude = function(obj, fields2) { return exclude$1(obj, fields2); }; var wrap$1 = function(key2, value25) { return wrap$2(key2, value25); }; var wrapAll = function(keyvalues) { return wrapAll$1(keyvalues); }; var mergeValues = function(values3, base2) { return values3.length === 0 ? Result.value(base2) : Result.value(deepMerge2(base2, merge$12.apply(void 0, values3))); }; var mergeErrors = function(errors) { return Result.error(flatten2(errors)); }; var consolidate = function(objs, base2) { var partitions = partition$12(objs); return partitions.errors.length > 0 ? mergeErrors(partitions.errors) : mergeValues(partitions.values, base2); }; var ensureIsRoot = function(isRoot) { return isFunction3(isRoot) ? isRoot : never; }; var ancestor$2 = function(scope, transform3, isRoot) { var element2 = scope.dom; var stop3 = ensureIsRoot(isRoot); while (element2.parentNode) { element2 = element2.parentNode; var el = SugarElement.fromDom(element2); var transformed = transform3(el); if (transformed.isSome()) { return transformed; } else if (stop3(el)) { break; } } return Optional.none(); }; var closest$4 = function(scope, transform3, isRoot) { var current2 = transform3(scope); var stop3 = ensureIsRoot(isRoot); return current2.orThunk(function() { return stop3(scope) ? Optional.none() : ancestor$2(scope, transform3, stop3); }); }; var isSource = function(component, simulatedEvent) { return eq2(component.element, simulatedEvent.event.target); }; var defaultEventHandler = { can: always, abort: never, run: noop2 }; var nu$9 = function(parts2) { if (!hasNonNullableKey(parts2, "can") && !hasNonNullableKey(parts2, "abort") && !hasNonNullableKey(parts2, "run")) { throw new Error("EventHandler defined by: " + JSON.stringify(parts2, null, 2) + " does not have can, abort, or run!"); } return __assign(__assign({}, defaultEventHandler), parts2); }; var all$2 = function(handlers2, f2) { return function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return foldl(handlers2, function(acc, handler7) { return acc && f2(handler7).apply(void 0, args); }, true); }; }; var any2 = function(handlers2, f2) { return function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return foldl(handlers2, function(acc, handler7) { return acc || f2(handler7).apply(void 0, args); }, false); }; }; var read$2 = function(handler7) { return isFunction3(handler7) ? { can: always, abort: never, run: handler7 } : handler7; }; var fuse$1 = function(handlers2) { var can2 = all$2(handlers2, function(handler7) { return handler7.can; }); var abort5 = any2(handlers2, function(handler7) { return handler7.abort; }); var run2 = function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } each$12(handlers2, function(handler7) { handler7.run.apply(void 0, args); }); }; return { can: can2, abort: abort5, run: run2 }; }; var constant2 = constant$1; var touchstart = constant2("touchstart"); var touchmove = constant2("touchmove"); var touchend = constant2("touchend"); var touchcancel = constant2("touchcancel"); var mousedown = constant2("mousedown"); var mousemove = constant2("mousemove"); var mouseout = constant2("mouseout"); var mouseup = constant2("mouseup"); var mouseover = constant2("mouseover"); var focusin = constant2("focusin"); var focusout = constant2("focusout"); var keydown = constant2("keydown"); var keyup = constant2("keyup"); var input = constant2("input"); var change = constant2("change"); var click = constant2("click"); var transitioncancel = constant2("transitioncancel"); var transitionend = constant2("transitionend"); var transitionstart = constant2("transitionstart"); var selectstart = constant2("selectstart"); var prefixName = function(name2) { return constant$1("alloy." + name2); }; var alloy = { tap: prefixName("tap") }; var focus$4 = prefixName("focus"); var postBlur = prefixName("blur.post"); var postPaste = prefixName("paste.post"); var receive = prefixName("receive"); var execute$5 = prefixName("execute"); var focusItem = prefixName("focus.item"); var tap = alloy.tap; var longpress = prefixName("longpress"); var sandboxClose = prefixName("sandbox.close"); var typeaheadCancel = prefixName("typeahead.cancel"); var systemInit = prefixName("system.init"); var documentTouchmove = prefixName("system.touchmove"); var documentTouchend = prefixName("system.touchend"); var windowScroll = prefixName("system.scroll"); var windowResize = prefixName("system.resize"); var attachedToDom = prefixName("system.attached"); var detachedFromDom = prefixName("system.detached"); var dismissRequested = prefixName("system.dismissRequested"); var repositionRequested = prefixName("system.repositionRequested"); var focusShifted = prefixName("focusmanager.shifted"); var slotVisibility = prefixName("slotcontainer.visibility"); var changeTab = prefixName("change.tab"); var dismissTab = prefixName("dismiss.tab"); var highlight$1 = prefixName("highlight"); var dehighlight$1 = prefixName("dehighlight"); var emit2 = function(component, event) { dispatchWith(component, component.element, event, {}); }; var emitWith = function(component, event, properties2) { dispatchWith(component, component.element, event, properties2); }; var emitExecute = function(component) { emit2(component, execute$5()); }; var dispatch2 = function(component, target, event) { dispatchWith(component, target, event, {}); }; var dispatchWith = function(component, target, event, properties2) { var data65 = __assign({ target }, properties2); component.getSystem().triggerEvent(event, target, data65); }; var dispatchEvent = function(component, target, event, simulatedEvent) { component.getSystem().triggerEvent(event, target, simulatedEvent.event); }; var derive$2 = function(configs) { return wrapAll(configs); }; var abort4 = function(name2, predicate) { return { key: name2, value: nu$9({ abort: predicate }) }; }; var can = function(name2, predicate) { return { key: name2, value: nu$9({ can: predicate }) }; }; var preventDefault2 = function(name2) { return { key: name2, value: nu$9({ run: function(component, simulatedEvent) { simulatedEvent.event.prevent(); } }) }; }; var run$1 = function(name2, handler7) { return { key: name2, value: nu$9({ run: handler7 }) }; }; var runActionExtra = function(name2, action, extra) { return { key: name2, value: nu$9({ run: function(component, simulatedEvent) { action.apply(void 0, [ component, simulatedEvent ].concat(extra)); } }) }; }; var runOnName = function(name2) { return function(handler7) { return run$1(name2, handler7); }; }; var runOnSourceName = function(name2) { return function(handler7) { return { key: name2, value: nu$9({ run: function(component, simulatedEvent) { if (isSource(component, simulatedEvent)) { handler7(component, simulatedEvent); } } }) }; }; }; var redirectToUid = function(name2, uid2) { return run$1(name2, function(component, simulatedEvent) { component.getSystem().getByUid(uid2).each(function(redirectee) { dispatchEvent(redirectee, redirectee.element, name2, simulatedEvent); }); }); }; var redirectToPart = function(name2, detail, partName) { var uid2 = detail.partUids[partName]; return redirectToUid(name2, uid2); }; var runWithTarget = function(name2, f2) { return run$1(name2, function(component, simulatedEvent) { var ev = simulatedEvent.event; var target = component.getSystem().getByDom(ev.target).getOrThunk(function() { var closest2 = closest$4(ev.target, function(el) { return component.getSystem().getByDom(el).toOptional(); }, never); return closest2.getOr(component); }); f2(component, target, simulatedEvent); }); }; var cutter = function(name2) { return run$1(name2, function(component, simulatedEvent) { simulatedEvent.cut(); }); }; var stopper = function(name2) { return run$1(name2, function(component, simulatedEvent) { simulatedEvent.stop(); }); }; var runOnSource = function(name2, f2) { return runOnSourceName(name2)(f2); }; var runOnAttached = runOnSourceName(attachedToDom()); var runOnDetached = runOnSourceName(detachedFromDom()); var runOnInit = runOnSourceName(systemInit()); var runOnExecute$1 = runOnName(execute$5()); var fromHtml$1 = function(html2, scope) { var doc = scope || document; var div = doc.createElement("div"); div.innerHTML = html2; return children(SugarElement.fromDom(div)); }; var get$7 = function(element2) { return element2.dom.innerHTML; }; var set$5 = function(element2, content) { var owner2 = owner$4(element2); var docDom = owner2.dom; var fragment = SugarElement.fromDom(docDom.createDocumentFragment()); var contentElements = fromHtml$1(content, docDom); append$1(fragment, contentElements); empty2(element2); append$2(element2, fragment); }; var getOuter = function(element2) { var container = SugarElement.fromTag("div"); var clone5 = SugarElement.fromDom(element2.dom.cloneNode(true)); append$2(container, clone5); return get$7(container); }; var clone$2 = function(original2, isDeep) { return SugarElement.fromDom(original2.dom.cloneNode(isDeep)); }; var shallow = function(original2) { return clone$2(original2, false); }; var getHtml = function(element2) { if (isShadowRoot(element2)) { return "#shadow-root"; } else { var clone5 = shallow(element2); return getOuter(clone5); } }; var element = function(elem) { return getHtml(elem); }; var isRecursive = function(component, originator, target) { return eq2(originator, component.element) && !eq2(originator, target); }; var events$i = derive$2([can(focus$4(), function(component, simulatedEvent) { var event = simulatedEvent.event; var originator = event.originator; var target = event.target; if (isRecursive(component, originator, target)) { console.warn(focus$4() + " did not get interpreted by the desired target. \nOriginator: " + element(originator) + "\nTarget: " + element(target) + "\nCheck the " + focus$4() + " event handlers"); return false; } else { return true; } })]); var DefaultEvents = /* @__PURE__ */ Object.freeze({ __proto__: null, events: events$i }); var unique2 = 0; var generate$6 = function(prefix2) { var date3 = new Date(); var time = date3.getTime(); var random = Math.floor(Math.random() * 1e9); unique2++; return prefix2 + "_" + random + unique2 + String(time); }; var prefix$1 = constant$1("alloy-id-"); var idAttr$1 = constant$1("data-alloy-id"); var prefix = prefix$1(); var idAttr = idAttr$1(); var write = function(label, elem) { var id2 = generate$6(prefix + label); writeOnly(elem, id2); return id2; }; var writeOnly = function(elem, uid2) { Object.defineProperty(elem.dom, idAttr, { value: uid2, writable: true }); }; var read$1 = function(elem) { var id2 = isElement$2(elem) ? elem.dom[idAttr] : null; return Optional.from(id2); }; var generate$5 = function(prefix2) { return generate$6(prefix2); }; var make$8 = identity$1; var NoContextApi = function(getComp) { var getMessage = function(event) { return "The component must be in a context to execute: " + event + (getComp ? "\n" + element(getComp().element) + " is not in context." : ""); }; var fail = function(event) { return function() { throw new Error(getMessage(event)); }; }; var warn2 = function(event) { return function() { console.warn(getMessage(event)); }; }; return { debugInfo: constant$1("fake"), triggerEvent: warn2("triggerEvent"), triggerFocus: warn2("triggerFocus"), triggerEscape: warn2("triggerEscape"), broadcast: warn2("broadcast"), broadcastOn: warn2("broadcastOn"), broadcastEvent: warn2("broadcastEvent"), build: fail("build"), addToWorld: fail("addToWorld"), removeFromWorld: fail("removeFromWorld"), addToGui: fail("addToGui"), removeFromGui: fail("removeFromGui"), getByUid: fail("getByUid"), getByDom: fail("getByDom"), isConnected: never }; }; var singleton$1 = NoContextApi(); var markAsBehaviourApi = function(f2, apiName, apiFunction) { var delegate = apiFunction.toString(); var endIndex = delegate.indexOf(")") + 1; var openBracketIndex = delegate.indexOf("("); var parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\s*/); f2.toFunctionAnnotation = function() { return { name: apiName, parameters: cleanParameters(parameters.slice(0, 1).concat(parameters.slice(3))) }; }; return f2; }; var cleanParameters = function(parameters) { return map$2(parameters, function(p) { return endsWith2(p, "/*") ? p.substring(0, p.length - "/*".length) : p; }); }; var markAsExtraApi = function(f2, extraName) { var delegate = f2.toString(); var endIndex = delegate.indexOf(")") + 1; var openBracketIndex = delegate.indexOf("("); var parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\s*/); f2.toFunctionAnnotation = function() { return { name: extraName, parameters: cleanParameters(parameters) }; }; return f2; }; var markAsSketchApi = function(f2, apiFunction) { var delegate = apiFunction.toString(); var endIndex = delegate.indexOf(")") + 1; var openBracketIndex = delegate.indexOf("("); var parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\s*/); f2.toFunctionAnnotation = function() { return { name: "OVERRIDE", parameters: cleanParameters(parameters.slice(1)) }; }; return f2; }; var premadeTag = generate$6("alloy-premade"); var premade$1 = function(comp) { return wrap$1(premadeTag, comp); }; var getPremade = function(spec) { return get$e(spec, premadeTag); }; var makeApi = function(f2) { return markAsSketchApi(function(component) { var rest = []; for (var _i = 1; _i < arguments.length; _i++) { rest[_i - 1] = arguments[_i]; } return f2.apply(void 0, __spreadArray([ component.getApis(), component ], rest, false)); }, f2); }; var NoState = { init: function() { return nu$8({ readState: constant$1("No State required") }); } }; var nu$8 = function(spec) { return spec; }; var generateFrom$1 = function(spec, all3) { var schema3 = map$2(all3, function(a2) { return optionObjOf(a2.name(), [ required$12("config"), defaulted("state", NoState) ]); }); var validated = asRaw("component.behaviours", objOf(schema3), spec.behaviours).fold(function(errInfo) { throw new Error(formatError(errInfo) + "\nComplete spec:\n" + JSON.stringify(spec, null, 2)); }, identity$1); return { list: all3, data: map$1(validated, function(optBlobThunk) { var output2 = optBlobThunk.map(function(blob) { return { config: blob.config, state: blob.state.init(blob.config) }; }); return constant$1(output2); }) }; }; var getBehaviours$3 = function(bData) { return bData.list; }; var getData$2 = function(bData) { return bData.data; }; var byInnerKey = function(data65, tuple3) { var r3 = {}; each2(data65, function(detail, key2) { each2(detail, function(value25, indexKey) { var chain = get$e(r3, indexKey).getOr([]); r3[indexKey] = chain.concat([tuple3(key2, value25)]); }); }); return r3; }; var nu$7 = function(s2) { return { classes: isUndefined2(s2.classes) ? [] : s2.classes, attributes: isUndefined2(s2.attributes) ? {} : s2.attributes, styles: isUndefined2(s2.styles) ? {} : s2.styles }; }; var merge4 = function(defnA, mod2) { return __assign(__assign({}, defnA), { attributes: __assign(__assign({}, defnA.attributes), mod2.attributes), styles: __assign(__assign({}, defnA.styles), mod2.styles), classes: defnA.classes.concat(mod2.classes) }); }; var combine$2 = function(info3, baseMod, behaviours2, base2) { var modsByBehaviour = __assign({}, baseMod); each$12(behaviours2, function(behaviour) { modsByBehaviour[behaviour.name()] = behaviour.exhibit(info3, base2); }); var byAspect = byInnerKey(modsByBehaviour, function(name2, modification) { return { name: name2, modification }; }); var combineObjects = function(objects) { return foldr(objects, function(b3, a2) { return __assign(__assign({}, a2.modification), b3); }, {}); }; var combinedClasses = foldr(byAspect.classes, function(b3, a2) { return a2.modification.concat(b3); }, []); var combinedAttributes = combineObjects(byAspect.attributes); var combinedStyles = combineObjects(byAspect.styles); return nu$7({ classes: combinedClasses, attributes: combinedAttributes, styles: combinedStyles }); }; var sortKeys = function(label, keyName, array3, order) { try { var sorted = sort(array3, function(a2, b3) { var aKey = a2[keyName]; var bKey = b3[keyName]; var aIndex = order.indexOf(aKey); var bIndex = order.indexOf(bKey); if (aIndex === -1) { throw new Error("The ordering for " + label + " does not have an entry for " + aKey + ".\nOrder specified: " + JSON.stringify(order, null, 2)); } if (bIndex === -1) { throw new Error("The ordering for " + label + " does not have an entry for " + bKey + ".\nOrder specified: " + JSON.stringify(order, null, 2)); } if (aIndex < bIndex) { return -1; } else if (bIndex < aIndex) { return 1; } else { return 0; } }); return Result.value(sorted); } catch (err) { return Result.error([err]); } }; var uncurried = function(handler7, purpose) { return { handler: handler7, purpose }; }; var curried = function(handler7, purpose) { return { cHandler: handler7, purpose }; }; var curryArgs = function(descHandler, extraArgs) { return curried(curry.apply(void 0, [descHandler.handler].concat(extraArgs)), descHandler.purpose); }; var getCurried = function(descHandler) { return descHandler.cHandler; }; var behaviourTuple = function(name2, handler7) { return { name: name2, handler: handler7 }; }; var nameToHandlers = function(behaviours2, info3) { var r3 = {}; each$12(behaviours2, function(behaviour) { r3[behaviour.name()] = behaviour.handlers(info3); }); return r3; }; var groupByEvents = function(info3, behaviours2, base2) { var behaviourEvents = __assign(__assign({}, base2), nameToHandlers(behaviours2, info3)); return byInnerKey(behaviourEvents, behaviourTuple); }; var combine$1 = function(info3, eventOrder, behaviours2, base2) { var byEventName = groupByEvents(info3, behaviours2, base2); return combineGroups(byEventName, eventOrder); }; var assemble = function(rawHandler) { var handler7 = read$2(rawHandler); return function(component, simulatedEvent) { var rest = []; for (var _i = 2; _i < arguments.length; _i++) { rest[_i - 2] = arguments[_i]; } var args = [ component, simulatedEvent ].concat(rest); if (handler7.abort.apply(void 0, args)) { simulatedEvent.stop(); } else if (handler7.can.apply(void 0, args)) { handler7.run.apply(void 0, args); } }; }; var missingOrderError = function(eventName, tuples) { return Result.error(["The event (" + eventName + ') has more than one behaviour that listens to it.\nWhen this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).\nThe behaviours that can trigger it are: ' + JSON.stringify(map$2(tuples, function(c2) { return c2.name; }), null, 2)]); }; var fuse = function(tuples, eventOrder, eventName) { var order = eventOrder[eventName]; if (!order) { return missingOrderError(eventName, tuples); } else { return sortKeys("Event: " + eventName, "name", tuples, order).map(function(sortedTuples) { var handlers2 = map$2(sortedTuples, function(tuple3) { return tuple3.handler; }); return fuse$1(handlers2); }); } }; var combineGroups = function(byEventName, eventOrder) { var r3 = mapToArray2(byEventName, function(tuples, eventName) { var combined = tuples.length === 1 ? Result.value(tuples[0].handler) : fuse(tuples, eventOrder, eventName); return combined.map(function(handler7) { var assembled = assemble(handler7); var purpose = tuples.length > 1 ? filter$2(eventOrder[eventName], function(o2) { return exists(tuples, function(t3) { return t3.name === o2; }); }).join(" > ") : tuples[0].name; return wrap$1(eventName, uncurried(assembled, purpose)); }); }); return consolidate(r3, {}); }; var _a$2; var baseBehaviour = "alloy.base.behaviour"; var schema$z = objOf([ field$1("dom", "dom", required$2(), objOf([ required$12("tag"), defaulted("styles", {}), defaulted("classes", []), defaulted("attributes", {}), option("value"), option("innerHtml") ])), required$12("components"), required$12("uid"), defaulted("events", {}), defaulted("apis", {}), field$1("eventOrder", "eventOrder", mergeWith((_a$2 = {}, _a$2[execute$5()] = [ "disabling", baseBehaviour, "toggling", "typeaheadevents" ], _a$2[focus$4()] = [ baseBehaviour, "focusing", "keying" ], _a$2[systemInit()] = [ baseBehaviour, "disabling", "toggling", "representing" ], _a$2[input()] = [ baseBehaviour, "representing", "streaming", "invalidating" ], _a$2[detachedFromDom()] = [ baseBehaviour, "representing", "item-events", "tooltipping" ], _a$2[mousedown()] = [ "focusing", baseBehaviour, "item-type-events" ], _a$2[touchstart()] = [ "focusing", baseBehaviour, "item-type-events" ], _a$2[mouseover()] = [ "item-type-events", "tooltipping" ], _a$2[receive()] = [ "receiving", "reflecting", "tooltipping" ], _a$2)), anyValue()), option("domModification") ]); var toInfo = function(spec) { return asRaw("custom.definition", schema$z, spec); }; var toDefinition = function(detail) { return __assign(__assign({}, detail.dom), { uid: detail.uid, domChildren: map$2(detail.components, function(comp) { return comp.element; }) }); }; var toModification = function(detail) { return detail.domModification.fold(function() { return nu$7({}); }, nu$7); }; var toEvents = function(info3) { return info3.events; }; var read = function(element2, attr) { var value25 = get$d(element2, attr); return value25 === void 0 || value25 === "" ? [] : value25.split(" "); }; var add$4 = function(element2, attr, id2) { var old = read(element2, attr); var nu2 = old.concat([id2]); set$8(element2, attr, nu2.join(" ")); return true; }; var remove$4 = function(element2, attr, id2) { var nu2 = filter$2(read(element2, attr), function(v2) { return v2 !== id2; }); if (nu2.length > 0) { set$8(element2, attr, nu2.join(" ")); } else { remove$7(element2, attr); } return false; }; var supports = function(element2) { return element2.dom.classList !== void 0; }; var get$6 = function(element2) { return read(element2, "class"); }; var add$3 = function(element2, clazz) { return add$4(element2, "class", clazz); }; var remove$3 = function(element2, clazz) { return remove$4(element2, "class", clazz); }; var add$2 = function(element2, clazz) { if (supports(element2)) { element2.dom.classList.add(clazz); } else { add$3(element2, clazz); } }; var cleanClass = function(element2) { var classList = supports(element2) ? element2.dom.classList : get$6(element2); if (classList.length === 0) { remove$7(element2, "class"); } }; var remove$2 = function(element2, clazz) { if (supports(element2)) { var classList = element2.dom.classList; classList.remove(clazz); } else { remove$3(element2, clazz); } cleanClass(element2); }; var has2 = function(element2, clazz) { return supports(element2) && element2.dom.classList.contains(clazz); }; var add$12 = function(element2, classes4) { each$12(classes4, function(x2) { add$2(element2, x2); }); }; var remove$1 = function(element2, classes4) { each$12(classes4, function(x2) { remove$2(element2, x2); }); }; var hasAll = function(element2, classes4) { return forall(classes4, function(clazz) { return has2(element2, clazz); }); }; var get$5 = function(element2) { return element2.dom.value; }; var set$4 = function(element2, value25) { if (value25 === void 0) { throw new Error("Value.set was undefined"); } element2.dom.value = value25; }; var renderToDom = function(definition) { var subject = SugarElement.fromTag(definition.tag); setAll$1(subject, definition.attributes); add$12(subject, definition.classes); setAll(subject, definition.styles); definition.innerHtml.each(function(html2) { return set$5(subject, html2); }); var children2 = definition.domChildren; append$1(subject, children2); definition.value.each(function(value25) { set$4(subject, value25); }); if (!definition.uid) { debugger; } writeOnly(subject, definition.uid); return subject; }; var getBehaviours$2 = function(spec) { var behaviours2 = get$e(spec, "behaviours").getOr({}); return bind$32(keys2(behaviours2), function(name2) { var behaviour = behaviours2[name2]; return isNonNullable(behaviour) ? [behaviour.me] : []; }); }; var generateFrom = function(spec, all3) { return generateFrom$1(spec, all3); }; var generate$4 = function(spec) { var all3 = getBehaviours$2(spec); return generateFrom(spec, all3); }; var getDomDefinition = function(info3, bList, bData) { var definition = toDefinition(info3); var infoModification = toModification(info3); var baseModification = { "alloy.base.modification": infoModification }; var modification = bList.length > 0 ? combine$2(bData, baseModification, bList, definition) : infoModification; return merge4(definition, modification); }; var getEvents2 = function(info3, bList, bData) { var baseEvents = { "alloy.base.behaviour": toEvents(info3) }; return combine$1(bData, info3.eventOrder, bList, baseEvents).getOrDie(); }; var build$2 = function(spec) { var getMe = function() { return me; }; var systemApi = Cell3(singleton$1); var info3 = getOrDie(toInfo(spec)); var bBlob = generate$4(spec); var bList = getBehaviours$3(bBlob); var bData = getData$2(bBlob); var modDefinition = getDomDefinition(info3, bList, bData); var item2 = renderToDom(modDefinition); var events2 = getEvents2(info3, bList, bData); var subcomponents = Cell3(info3.components); var connect = function(newApi) { systemApi.set(newApi); }; var disconnect = function() { systemApi.set(NoContextApi(getMe)); }; var syncComponents = function() { var children$1 = children(item2); var subs2 = bind$32(children$1, function(child2) { return systemApi.get().getByDom(child2).fold(function() { return []; }, pure$2); }); subcomponents.set(subs2); }; var config4 = function(behaviour) { var b3 = bData; var f2 = isFunction3(b3[behaviour.name()]) ? b3[behaviour.name()] : function() { throw new Error("Could not find " + behaviour.name() + " in " + JSON.stringify(spec, null, 2)); }; return f2(); }; var hasConfigured = function(behaviour) { return isFunction3(bData[behaviour.name()]); }; var getApis = function() { return info3.apis; }; var readState = function(behaviourName) { return bData[behaviourName]().map(function(b3) { return b3.state.readState(); }).getOr("not enabled"); }; var me = { uid: spec.uid, getSystem: systemApi.get, config: config4, hasConfigured, spec, readState, getApis, connect, disconnect, element: item2, syncComponents, components: subcomponents.get, events: events2 }; return me; }; var buildSubcomponents = function(spec) { var components4 = get$e(spec, "components").getOr([]); return map$2(components4, build$1); }; var buildFromSpec = function(userSpec) { var _a4 = make$8(userSpec), specEvents = _a4.events, spec = __rest2(_a4, ["events"]); var components4 = buildSubcomponents(spec); var completeSpec = __assign(__assign({}, spec), { events: __assign(__assign({}, DefaultEvents), specEvents), components: components4 }); return Result.value(build$2(completeSpec)); }; var text$1 = function(textContent) { var element2 = SugarElement.fromText(textContent); return external$2({ element: element2 }); }; var external$2 = function(spec) { var extSpec = asRawOrDie$1("external.component", objOfOnly([ required$12("element"), option("uid") ]), spec); var systemApi = Cell3(NoContextApi()); var connect = function(newApi) { systemApi.set(newApi); }; var disconnect = function() { systemApi.set(NoContextApi(function() { return me; })); }; var uid2 = extSpec.uid.getOrThunk(function() { return generate$5("external"); }); writeOnly(extSpec.element, uid2); var me = { uid: uid2, getSystem: systemApi.get, config: Optional.none, hasConfigured: never, connect, disconnect, getApis: function() { return {}; }, element: extSpec.element, spec, readState: constant$1("No state"), syncComponents: noop2, components: constant$1([]), events: {} }; return premade$1(me); }; var uids = generate$5; var isSketchSpec$1 = function(spec) { return has$22(spec, "uid"); }; var build$1 = function(spec) { return getPremade(spec).getOrThunk(function() { var userSpecWithUid = isSketchSpec$1(spec) ? spec : __assign({ uid: uids("") }, spec); return buildFromSpec(userSpecWithUid).getOrDie(); }); }; var premade = premade$1; function ClosestOrAncestor(is3, ancestor2, scope, a2, isRoot) { if (is3(scope, a2)) { return Optional.some(scope); } else if (isFunction3(isRoot) && isRoot(scope)) { return Optional.none(); } else { return ancestor2(scope, a2, isRoot); } } var ancestor$1 = function(scope, predicate, isRoot) { var element2 = scope.dom; var stop3 = isFunction3(isRoot) ? isRoot : never; while (element2.parentNode) { element2 = element2.parentNode; var el = SugarElement.fromDom(element2); if (predicate(el)) { return Optional.some(el); } else if (stop3(el)) { break; } } return Optional.none(); }; var closest$3 = function(scope, predicate, isRoot) { var is3 = function(s2, test) { return test(s2); }; return ClosestOrAncestor(is3, ancestor$1, scope, predicate, isRoot); }; var child$1 = function(scope, predicate) { var pred = function(node) { return predicate(SugarElement.fromDom(node)); }; var result = find$5(scope.dom.childNodes, pred); return result.map(SugarElement.fromDom); }; var descendant$1 = function(scope, predicate) { var descend = function(node) { for (var i2 = 0; i2 < node.childNodes.length; i2++) { var child_1 = SugarElement.fromDom(node.childNodes[i2]); if (predicate(child_1)) { return Optional.some(child_1); } var res = descend(node.childNodes[i2]); if (res.isSome()) { return res; } } return Optional.none(); }; return descend(scope.dom); }; var closest$2 = function(scope, predicate, isRoot) { return closest$3(scope, predicate, isRoot).isSome(); }; var ancestor = function(scope, selector2, isRoot) { return ancestor$1(scope, function(e2) { return is2(e2, selector2); }, isRoot); }; var child = function(scope, selector2) { return child$1(scope, function(e2) { return is2(e2, selector2); }); }; var descendant = function(scope, selector2) { return one(selector2, scope); }; var closest$1 = function(scope, selector2, isRoot) { var is$12 = function(element2, selector3) { return is2(element2, selector3); }; return ClosestOrAncestor(is$12, ancestor, scope, selector2, isRoot); }; var find$12 = function(queryElem) { var dependent = closest$3(queryElem, function(elem) { if (!isElement$2(elem)) { return false; } var id2 = get$d(elem, "id"); return id2 !== void 0 && id2.indexOf("aria-owns") > -1; }); return dependent.bind(function(dep) { var id2 = get$d(dep, "id"); var dos = getRootNode(dep); return descendant(dos, '[aria-owns="' + id2 + '"]'); }); }; var manager = function() { var ariaId2 = generate$6("aria-owns"); var link = function(elem) { set$8(elem, "aria-owns", ariaId2); }; var unlink = function(elem) { remove$7(elem, "aria-owns"); }; return { id: ariaId2, link, unlink }; }; var isAriaPartOf = function(component, queryElem) { return find$12(queryElem).exists(function(owner2) { return isPartOf$1(component, owner2); }); }; var isPartOf$1 = function(component, queryElem) { return closest$2(queryElem, function(el) { return eq2(el, component.element); }, never) || isAriaPartOf(component, queryElem); }; var unknown = "unknown"; var EventConfiguration; (function(EventConfiguration2) { EventConfiguration2[EventConfiguration2["STOP"] = 0] = "STOP"; EventConfiguration2[EventConfiguration2["NORMAL"] = 1] = "NORMAL"; EventConfiguration2[EventConfiguration2["LOGGING"] = 2] = "LOGGING"; })(EventConfiguration || (EventConfiguration = {})); var eventConfig = Cell3({}); var makeEventLogger = function(eventName, initialTarget) { var sequence2 = []; var startTime = new Date().getTime(); return { logEventCut: function(_name, target, purpose) { sequence2.push({ outcome: "cut", target, purpose }); }, logEventStopped: function(_name, target, purpose) { sequence2.push({ outcome: "stopped", target, purpose }); }, logNoParent: function(_name, target, purpose) { sequence2.push({ outcome: "no-parent", target, purpose }); }, logEventNoHandlers: function(_name, target) { sequence2.push({ outcome: "no-handlers-left", target }); }, logEventResponse: function(_name, target, purpose) { sequence2.push({ outcome: "response", purpose, target }); }, write: function() { var finishTime = new Date().getTime(); if (contains$2([ "mousemove", "mouseover", "mouseout", systemInit() ], eventName)) { return; } console.log(eventName, { event: eventName, time: finishTime - startTime, target: initialTarget.dom, sequence: map$2(sequence2, function(s2) { if (!contains$2([ "cut", "stopped", "response" ], s2.outcome)) { return s2.outcome; } else { return "{" + s2.purpose + "} " + s2.outcome + " at (" + element(s2.target) + ")"; } }) }); } }; }; var processEvent = function(eventName, initialTarget, f2) { var status = get$e(eventConfig.get(), eventName).orThunk(function() { var patterns = keys2(eventConfig.get()); return findMap(patterns, function(p) { return eventName.indexOf(p) > -1 ? Optional.some(eventConfig.get()[p]) : Optional.none(); }); }).getOr(EventConfiguration.NORMAL); switch (status) { case EventConfiguration.NORMAL: return f2(noLogger()); case EventConfiguration.LOGGING: { var logger = makeEventLogger(eventName, initialTarget); var output2 = f2(logger); logger.write(); return output2; } case EventConfiguration.STOP: return true; } }; var path2 = [ "alloy/data/Fields", "alloy/debugging/Debugging" ]; var getTrace = function() { var err = new Error(); if (err.stack !== void 0) { var lines = err.stack.split("\n"); return find$5(lines, function(line) { return line.indexOf("alloy") > 0 && !exists(path2, function(p) { return line.indexOf(p) > -1; }); }).getOr(unknown); } else { return unknown; } }; var ignoreEvent = { logEventCut: noop2, logEventStopped: noop2, logNoParent: noop2, logEventNoHandlers: noop2, logEventResponse: noop2, write: noop2 }; var monitorEvent = function(eventName, initialTarget, f2) { return processEvent(eventName, initialTarget, f2); }; var noLogger = constant$1(ignoreEvent); var menuFields = constant$1([ required$12("menu"), required$12("selectedMenu") ]); var itemFields = constant$1([ required$12("item"), required$12("selectedItem") ]); constant$1(objOf(itemFields().concat(menuFields()))); var itemSchema$3 = constant$1(objOf(itemFields())); var _initSize = requiredObjOf("initSize", [ required$12("numColumns"), required$12("numRows") ]); var itemMarkers = function() { return requiredOf("markers", itemSchema$3()); }; var tieredMenuMarkers = function() { return requiredObjOf("markers", [required$12("backgroundMenu")].concat(menuFields()).concat(itemFields())); }; var markers$1 = function(required3) { return requiredObjOf("markers", map$2(required3, required$12)); }; var onPresenceHandler = function(label, fieldName, presence) { getTrace(); return field$1(fieldName, fieldName, presence, valueOf2(function(f2) { return Result.value(function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return f2.apply(void 0, args); }); })); }; var onHandler = function(fieldName) { return onPresenceHandler("onHandler", fieldName, defaulted$1(noop2)); }; var onKeyboardHandler = function(fieldName) { return onPresenceHandler("onKeyboardHandler", fieldName, defaulted$1(Optional.none)); }; var onStrictHandler = function(fieldName) { return onPresenceHandler("onHandler", fieldName, required$2()); }; var onStrictKeyboardHandler = function(fieldName) { return onPresenceHandler("onKeyboardHandler", fieldName, required$2()); }; var output$1 = function(name2, value25) { return customField(name2, constant$1(value25)); }; var snapshot = function(name2) { return customField(name2, identity$1); }; var initSize = constant$1(_initSize); var nu$6 = function(x2, y2, bubble2, direction, placement3, boundsRestriction2, labelPrefix2, alwaysFit) { if (alwaysFit === void 0) { alwaysFit = false; } return { x: x2, y: y2, bubble: bubble2, direction, placement: placement3, restriction: boundsRestriction2, label: labelPrefix2 + "-" + placement3, alwaysFit }; }; var adt$a = Adt.generate([ { southeast: [] }, { southwest: [] }, { northeast: [] }, { northwest: [] }, { south: [] }, { north: [] }, { east: [] }, { west: [] } ]); var cata$2 = function(subject, southeast2, southwest2, northeast2, northwest2, south2, north2, east2, west2) { return subject.fold(southeast2, southwest2, northeast2, northwest2, south2, north2, east2, west2); }; var cataVertical = function(subject, south2, middle, north2) { return subject.fold(south2, south2, north2, north2, south2, north2, middle, middle); }; var cataHorizontal = function(subject, east2, middle, west2) { return subject.fold(east2, west2, east2, west2, middle, middle, east2, west2); }; var southeast$3 = adt$a.southeast; var southwest$3 = adt$a.southwest; var northeast$3 = adt$a.northeast; var northwest$3 = adt$a.northwest; var south$3 = adt$a.south; var north$3 = adt$a.north; var east$3 = adt$a.east; var west$3 = adt$a.west; var cycleBy = function(value25, delta, min5, max5) { var r3 = value25 + delta; if (r3 > max5) { return min5; } else if (r3 < min5) { return max5; } else { return r3; } }; var clamp$1 = function(value25, min5, max5) { return Math.min(Math.max(value25, min5), max5); }; var getRestriction = function(anchor2, restriction) { switch (restriction) { case 1: return anchor2.x; case 0: return anchor2.x + anchor2.width; case 2: return anchor2.y; case 3: return anchor2.y + anchor2.height; } }; var boundsRestriction = function(anchor2, restrictions) { return mapToObject([ "left", "right", "top", "bottom" ], function(dir) { return get$e(restrictions, dir).map(function(restriction) { return getRestriction(anchor2, restriction); }); }); }; var adjustBounds = function(bounds$12, restriction, bubbleOffset) { var applyRestriction = function(dir, current2) { return restriction[dir].map(function(pos) { var isVerticalAxis = dir === "top" || dir === "bottom"; var offset5 = isVerticalAxis ? bubbleOffset.top : bubbleOffset.left; var comparator = dir === "left" || dir === "top" ? Math.max : Math.min; var newPos = comparator(pos, current2) + offset5; return isVerticalAxis ? clamp$1(newPos, bounds$12.y, bounds$12.bottom) : clamp$1(newPos, bounds$12.x, bounds$12.right); }).getOr(current2); }; var adjustedLeft = applyRestriction("left", bounds$12.x); var adjustedTop = applyRestriction("top", bounds$12.y); var adjustedRight = applyRestriction("right", bounds$12.right); var adjustedBottom = applyRestriction("bottom", bounds$12.bottom); return bounds(adjustedLeft, adjustedTop, adjustedRight - adjustedLeft, adjustedBottom - adjustedTop); }; var labelPrefix$2 = "layout"; var eastX$1 = function(anchor2) { return anchor2.x; }; var middleX$1 = function(anchor2, element2) { return anchor2.x + anchor2.width / 2 - element2.width / 2; }; var westX$1 = function(anchor2, element2) { return anchor2.x + anchor2.width - element2.width; }; var northY$2 = function(anchor2, element2) { return anchor2.y - element2.height; }; var southY$2 = function(anchor2) { return anchor2.y + anchor2.height; }; var centreY$1 = function(anchor2, element2) { return anchor2.y + anchor2.height / 2 - element2.height / 2; }; var eastEdgeX$1 = function(anchor2) { return anchor2.x + anchor2.width; }; var westEdgeX$1 = function(anchor2, element2) { return anchor2.x - element2.width; }; var southeast$2 = function(anchor2, element2, bubbles) { return nu$6(eastX$1(anchor2), southY$2(anchor2), bubbles.southeast(), southeast$3(), "southeast", boundsRestriction(anchor2, { left: 1, top: 3 }), labelPrefix$2); }; var southwest$2 = function(anchor2, element2, bubbles) { return nu$6(westX$1(anchor2, element2), southY$2(anchor2), bubbles.southwest(), southwest$3(), "southwest", boundsRestriction(anchor2, { right: 0, top: 3 }), labelPrefix$2); }; var northeast$2 = function(anchor2, element2, bubbles) { return nu$6(eastX$1(anchor2), northY$2(anchor2, element2), bubbles.northeast(), northeast$3(), "northeast", boundsRestriction(anchor2, { left: 1, bottom: 2 }), labelPrefix$2); }; var northwest$2 = function(anchor2, element2, bubbles) { return nu$6(westX$1(anchor2, element2), northY$2(anchor2, element2), bubbles.northwest(), northwest$3(), "northwest", boundsRestriction(anchor2, { right: 0, bottom: 2 }), labelPrefix$2); }; var north$2 = function(anchor2, element2, bubbles) { return nu$6(middleX$1(anchor2, element2), northY$2(anchor2, element2), bubbles.north(), north$3(), "north", boundsRestriction(anchor2, { bottom: 2 }), labelPrefix$2); }; var south$2 = function(anchor2, element2, bubbles) { return nu$6(middleX$1(anchor2, element2), southY$2(anchor2), bubbles.south(), south$3(), "south", boundsRestriction(anchor2, { top: 3 }), labelPrefix$2); }; var east$2 = function(anchor2, element2, bubbles) { return nu$6(eastEdgeX$1(anchor2), centreY$1(anchor2, element2), bubbles.east(), east$3(), "east", boundsRestriction(anchor2, { left: 0 }), labelPrefix$2); }; var west$2 = function(anchor2, element2, bubbles) { return nu$6(westEdgeX$1(anchor2, element2), centreY$1(anchor2, element2), bubbles.west(), west$3(), "west", boundsRestriction(anchor2, { right: 1 }), labelPrefix$2); }; var all$1 = function() { return [ southeast$2, southwest$2, northeast$2, northwest$2, south$2, north$2, east$2, west$2 ]; }; var allRtl$1 = function() { return [ southwest$2, southeast$2, northwest$2, northeast$2, south$2, north$2, east$2, west$2 ]; }; var aboveOrBelow = function() { return [ northeast$2, northwest$2, southeast$2, southwest$2, north$2, south$2 ]; }; var aboveOrBelowRtl = function() { return [ northwest$2, northeast$2, southwest$2, southeast$2, north$2, south$2 ]; }; var belowOrAbove = function() { return [ southeast$2, southwest$2, northeast$2, northwest$2, south$2, north$2 ]; }; var belowOrAboveRtl = function() { return [ southwest$2, southeast$2, northwest$2, northeast$2, south$2, north$2 ]; }; var chooseChannels = function(channels, message2) { return message2.universal ? channels : filter$2(channels, function(ch) { return contains$2(message2.channels, ch); }); }; var events$h = function(receiveConfig) { return derive$2([run$1(receive(), function(component, message2) { var channelMap = receiveConfig.channels; var channels = keys2(channelMap); var receivingData = message2; var targetChannels = chooseChannels(channels, receivingData); each$12(targetChannels, function(ch) { var channelInfo = channelMap[ch]; var channelSchema = channelInfo.schema; var data65 = asRawOrDie$1("channel[" + ch + "] data\nReceiver: " + element(component.element), channelSchema, receivingData.data); channelInfo.onReceive(component, data65); }); })]); }; var ActiveReceiving = /* @__PURE__ */ Object.freeze({ __proto__: null, events: events$h }); var ReceivingSchema = [requiredOf("channels", setOf(Result.value, objOfOnly([ onStrictHandler("onReceive"), defaulted("schema", anyValue()) ])))]; var executeEvent = function(bConfig, bState, executor) { return runOnExecute$1(function(component) { executor(component, bConfig, bState); }); }; var loadEvent = function(bConfig, bState, f2) { return runOnInit(function(component, _simulatedEvent) { f2(component, bConfig, bState); }); }; var create$9 = function(schema3, name2, active2, apis, extra, state) { var configSchema = objOfOnly(schema3); var schemaSchema = optionObjOf(name2, [optionObjOfOnly("config", schema3)]); return doCreate(configSchema, schemaSchema, name2, active2, apis, extra, state); }; var createModes$1 = function(modes, name2, active2, apis, extra, state) { var configSchema = modes; var schemaSchema = optionObjOf(name2, [optionOf("config", modes)]); return doCreate(configSchema, schemaSchema, name2, active2, apis, extra, state); }; var wrapApi = function(bName, apiFunction, apiName) { var f2 = function(component) { var rest = []; for (var _i = 1; _i < arguments.length; _i++) { rest[_i - 1] = arguments[_i]; } var args = [component].concat(rest); return component.config({ name: constant$1(bName) }).fold(function() { throw new Error("We could not find any behaviour configuration for: " + bName + ". Using API: " + apiName); }, function(info3) { var rest2 = Array.prototype.slice.call(args, 1); return apiFunction.apply(void 0, [ component, info3.config, info3.state ].concat(rest2)); }); }; return markAsBehaviourApi(f2, apiName, apiFunction); }; var revokeBehaviour = function(name2) { return { key: name2, value: void 0 }; }; var doCreate = function(configSchema, schemaSchema, name2, active2, apis, extra, state) { var getConfig2 = function(info3) { return hasNonNullableKey(info3, name2) ? info3[name2]() : Optional.none(); }; var wrappedApis = map$1(apis, function(apiF, apiName) { return wrapApi(name2, apiF, apiName); }); var wrappedExtra = map$1(extra, function(extraF, extraName) { return markAsExtraApi(extraF, extraName); }); var me = __assign(__assign(__assign({}, wrappedExtra), wrappedApis), { revoke: curry(revokeBehaviour, name2), config: function(spec) { var prepared = asRawOrDie$1(name2 + "-config", configSchema, spec); return { key: name2, value: { config: prepared, me, configAsRaw: cached2(function() { return asRawOrDie$1(name2 + "-config", configSchema, spec); }), initialConfig: spec, state } }; }, schema: constant$1(schemaSchema), exhibit: function(info3, base2) { return lift2(getConfig2(info3), get$e(active2, "exhibit"), function(behaviourInfo, exhibitor) { return exhibitor(base2, behaviourInfo.config, behaviourInfo.state); }).getOrThunk(function() { return nu$7({}); }); }, name: constant$1(name2), handlers: function(info3) { return getConfig2(info3).map(function(behaviourInfo) { var getEvents3 = get$e(active2, "events").getOr(function() { return {}; }); return getEvents3(behaviourInfo.config, behaviourInfo.state); }).getOr({}); } }); return me; }; var derive$1 = function(capabilities) { return wrapAll(capabilities); }; var simpleSchema = objOfOnly([ required$12("fields"), required$12("name"), defaulted("active", {}), defaulted("apis", {}), defaulted("state", NoState), defaulted("extra", {}) ]); var create$8 = function(data65) { var value25 = asRawOrDie$1("Creating behaviour: " + data65.name, simpleSchema, data65); return create$9(value25.fields, value25.name, value25.active, value25.apis, value25.extra, value25.state); }; var modeSchema = objOfOnly([ required$12("branchKey"), required$12("branches"), required$12("name"), defaulted("active", {}), defaulted("apis", {}), defaulted("state", NoState), defaulted("extra", {}) ]); var createModes = function(data65) { var value25 = asRawOrDie$1("Creating behaviour: " + data65.name, modeSchema, data65); return createModes$1(choose$1(value25.branchKey, value25.branches), value25.name, value25.active, value25.apis, value25.extra, value25.state); }; var revoke = constant$1(void 0); var Receiving = create$8({ fields: ReceivingSchema, name: "receiving", active: ActiveReceiving }); var exhibit$6 = function(base2, posConfig) { return nu$7({ classes: [], styles: posConfig.useFixed() ? {} : { position: "relative" } }); }; var ActivePosition = /* @__PURE__ */ Object.freeze({ __proto__: null, exhibit: exhibit$6 }); var getDocument2 = function() { return SugarElement.fromDom(document); }; var focus$3 = function(element2) { return element2.dom.focus(); }; var blur$1 = function(element2) { return element2.dom.blur(); }; var hasFocus = function(element2) { var root2 = getRootNode(element2).dom; return element2.dom === root2.activeElement; }; var active = function(root2) { if (root2 === void 0) { root2 = getDocument2(); } return Optional.from(root2.dom.activeElement).map(SugarElement.fromDom); }; var search = function(element2) { return active(getRootNode(element2)).filter(function(e2) { return element2.dom.contains(e2.dom); }); }; var preserve$1 = function(f2, container) { var dos = getRootNode(container); var refocus = active(dos).bind(function(focused) { var hasFocus2 = function(elem) { return eq2(focused, elem); }; return hasFocus2(container) ? Optional.some(container) : descendant$1(container, hasFocus2); }); var result = f2(container); refocus.each(function(oldFocus) { active(dos).filter(function(newFocus) { return eq2(newFocus, oldFocus); }).fold(function() { focus$3(oldFocus); }, noop2); }); return result; }; var NuPositionCss = function(position3, left2, top2, right2, bottom2) { var toPx = function(num) { return num + "px"; }; return { position: position3, left: left2.map(toPx), top: top2.map(toPx), right: right2.map(toPx), bottom: bottom2.map(toPx) }; }; var toOptions = function(position3) { return __assign(__assign({}, position3), { position: Optional.some(position3.position) }); }; var applyPositionCss = function(element2, position3) { setOptions(element2, toOptions(position3)); }; var adt$9 = Adt.generate([ { none: [] }, { relative: [ "x", "y", "width", "height" ] }, { fixed: [ "x", "y", "width", "height" ] } ]); var positionWithDirection = function(posName, decision, x2, y2, width2, height2) { var decisionRect = decision.rect; var decisionX = decisionRect.x - x2; var decisionY = decisionRect.y - y2; var decisionWidth = decisionRect.width; var decisionHeight = decisionRect.height; var decisionRight = width2 - (decisionX + decisionWidth); var decisionBottom = height2 - (decisionY + decisionHeight); var left2 = Optional.some(decisionX); var top2 = Optional.some(decisionY); var right2 = Optional.some(decisionRight); var bottom2 = Optional.some(decisionBottom); var none2 = Optional.none(); return cata$2(decision.direction, function() { return NuPositionCss(posName, left2, top2, none2, none2); }, function() { return NuPositionCss(posName, none2, top2, right2, none2); }, function() { return NuPositionCss(posName, left2, none2, none2, bottom2); }, function() { return NuPositionCss(posName, none2, none2, right2, bottom2); }, function() { return NuPositionCss(posName, left2, top2, none2, none2); }, function() { return NuPositionCss(posName, left2, none2, none2, bottom2); }, function() { return NuPositionCss(posName, left2, top2, none2, none2); }, function() { return NuPositionCss(posName, none2, top2, right2, none2); }); }; var reposition = function(origin, decision) { return origin.fold(function() { var decisionRect = decision.rect; return NuPositionCss("absolute", Optional.some(decisionRect.x), Optional.some(decisionRect.y), Optional.none(), Optional.none()); }, function(x2, y2, width2, height2) { return positionWithDirection("absolute", decision, x2, y2, width2, height2); }, function(x2, y2, width2, height2) { return positionWithDirection("fixed", decision, x2, y2, width2, height2); }); }; var toBox = function(origin, element2) { var rel = curry(find$2, element2); var position3 = origin.fold(rel, rel, function() { var scroll = get$9(); return find$2(element2).translate(-scroll.left, -scroll.top); }); var width2 = getOuter$1(element2); var height2 = getOuter$2(element2); return bounds(position3.left, position3.top, width2, height2); }; var viewport = function(origin, getBounds2) { return getBounds2.fold(function() { return origin.fold(win, win, bounds); }, function(b3) { return origin.fold(b3, b3, function() { var bounds$12 = b3(); var pos = translate$2(origin, bounds$12.x, bounds$12.y); return bounds(pos.left, pos.top, bounds$12.width, bounds$12.height); }); }); }; var translate$2 = function(origin, x2, y2) { var pos = SugarPosition(x2, y2); var removeScroll = function() { var outerScroll = get$9(); return pos.translate(-outerScroll.left, -outerScroll.top); }; return origin.fold(constant$1(pos), constant$1(pos), removeScroll); }; var cata$1 = function(subject, onNone, onRelative, onFixed) { return subject.fold(onNone, onRelative, onFixed); }; adt$9.none; var relative$1 = adt$9.relative; var fixed$1 = adt$9.fixed; var anchor = function(anchorBox, origin) { return { anchorBox, origin }; }; var box = function(anchorBox, origin) { return anchor(anchorBox, origin); }; var placementAttribute = "data-alloy-placement"; var setPlacement$1 = function(element2, placement3) { set$8(element2, placementAttribute, placement3); }; var getPlacement = function(element2) { return getOpt(element2, placementAttribute); }; var reset$2 = function(element2) { return remove$7(element2, placementAttribute); }; var adt$8 = Adt.generate([ { fit: ["reposition"] }, { nofit: [ "reposition", "visibleW", "visibleH", "isVisible" ] } ]); var determinePosition = function(box2, bounds2) { var boundsX = bounds2.x, boundsY = bounds2.y, boundsRight = bounds2.right, boundsBottom = bounds2.bottom; var x2 = box2.x, y2 = box2.y, right2 = box2.right, bottom2 = box2.bottom, width2 = box2.width, height2 = box2.height; var xInBounds = x2 >= boundsX && x2 <= boundsRight; var yInBounds = y2 >= boundsY && y2 <= boundsBottom; var originInBounds = xInBounds && yInBounds; var rightInBounds = right2 <= boundsRight && right2 >= boundsX; var bottomInBounds = bottom2 <= boundsBottom && bottom2 >= boundsY; var sizeInBounds = rightInBounds && bottomInBounds; var visibleW = Math.min(width2, x2 >= boundsX ? boundsRight - x2 : right2 - boundsX); var visibleH = Math.min(height2, y2 >= boundsY ? boundsBottom - y2 : bottom2 - boundsY); return { originInBounds, sizeInBounds, visibleW, visibleH }; }; var calcReposition = function(box2, bounds$12) { var boundsX = bounds$12.x, boundsY = bounds$12.y, boundsRight = bounds$12.right, boundsBottom = bounds$12.bottom; var x2 = box2.x, y2 = box2.y, width2 = box2.width, height2 = box2.height; var maxX2 = Math.max(boundsX, boundsRight - width2); var maxY2 = Math.max(boundsY, boundsBottom - height2); var restrictedX = clamp$1(x2, boundsX, maxX2); var restrictedY = clamp$1(y2, boundsY, maxY2); var restrictedWidth = Math.min(restrictedX + width2, boundsRight) - restrictedX; var restrictedHeight = Math.min(restrictedY + height2, boundsBottom) - restrictedY; return bounds(restrictedX, restrictedY, restrictedWidth, restrictedHeight); }; var calcMaxSizes = function(direction, box2, bounds2) { var upAvailable = constant$1(box2.bottom - bounds2.y); var downAvailable = constant$1(bounds2.bottom - box2.y); var maxHeight = cataVertical(direction, downAvailable, downAvailable, upAvailable); var westAvailable = constant$1(box2.right - bounds2.x); var eastAvailable = constant$1(bounds2.right - box2.x); var maxWidth = cataHorizontal(direction, eastAvailable, eastAvailable, westAvailable); return { maxWidth, maxHeight }; }; var attempt = function(candidate, width2, height2, bounds$12) { var bubble2 = candidate.bubble; var bubbleOffset = bubble2.offset; var adjustedBounds = adjustBounds(bounds$12, candidate.restriction, bubbleOffset); var newX = candidate.x + bubbleOffset.left; var newY = candidate.y + bubbleOffset.top; var box2 = bounds(newX, newY, width2, height2); var _a4 = determinePosition(box2, adjustedBounds), originInBounds = _a4.originInBounds, sizeInBounds = _a4.sizeInBounds, visibleW = _a4.visibleW, visibleH = _a4.visibleH; var fits = originInBounds && sizeInBounds; var fittedBox = fits ? box2 : calcReposition(box2, adjustedBounds); var isPartlyVisible = fittedBox.width > 0 && fittedBox.height > 0; var _b2 = calcMaxSizes(candidate.direction, fittedBox, bounds$12), maxWidth = _b2.maxWidth, maxHeight = _b2.maxHeight; var reposition2 = { rect: fittedBox, maxHeight, maxWidth, direction: candidate.direction, placement: candidate.placement, classes: { on: bubble2.classesOn, off: bubble2.classesOff }, layout: candidate.label, testY: newY }; return fits || candidate.alwaysFit ? adt$8.fit(reposition2) : adt$8.nofit(reposition2, visibleW, visibleH, isPartlyVisible); }; var attempts = function(element2, candidates, anchorBox, elementBox, bubbles, bounds2) { var panelWidth = elementBox.width; var panelHeight = elementBox.height; var attemptBestFit = function(layout2, reposition2, visibleW, visibleH, isVisible3) { var next2 = layout2(anchorBox, elementBox, bubbles, element2, bounds2); var attemptLayout = attempt(next2, panelWidth, panelHeight, bounds2); return attemptLayout.fold(constant$1(attemptLayout), function(newReposition, newVisibleW, newVisibleH, newIsVisible) { var improved = isVisible3 === newIsVisible ? newVisibleH > visibleH || newVisibleW > visibleW : !isVisible3 && newIsVisible; return improved ? attemptLayout : adt$8.nofit(reposition2, visibleW, visibleH, isVisible3); }); }; var abc = foldl(candidates, function(b3, a2) { var bestNext = curry(attemptBestFit, a2); return b3.fold(constant$1(b3), bestNext); }, adt$8.nofit({ rect: anchorBox, maxHeight: elementBox.height, maxWidth: elementBox.width, direction: southeast$3(), placement: "southeast", classes: { on: [], off: [] }, layout: "none", testY: anchorBox.y }, -1, -1, false)); return abc.fold(identity$1, identity$1); }; var singleton = function(doRevoke) { var subject = Cell3(Optional.none()); var revoke2 = function() { return subject.get().each(doRevoke); }; var clear3 = function() { revoke2(); subject.set(Optional.none()); }; var isSet2 = function() { return subject.get().isSome(); }; var get3 = function() { return subject.get(); }; var set3 = function(s2) { revoke2(); subject.set(Optional.some(s2)); }; return { clear: clear3, isSet: isSet2, get: get3, set: set3 }; }; var destroyable = function() { return singleton(function(s2) { return s2.destroy(); }); }; var unbindable = function() { return singleton(function(s2) { return s2.unbind(); }); }; var api$12 = function() { var subject = destroyable(); var run2 = function(f2) { return subject.get().each(f2); }; return __assign(__assign({}, subject), { run: run2 }); }; var value$1 = function() { var subject = singleton(noop2); var on3 = function(f2) { return subject.get().each(f2); }; return __assign(__assign({}, subject), { on: on3 }); }; var filter = always; var bind4 = function(element2, event, handler7) { return bind$22(element2, event, filter, handler7); }; var capture = function(element2, event, handler7) { return capture$1(element2, event, filter, handler7); }; var fromRawEvent = fromRawEvent$1; var properties = [ "top", "bottom", "right", "left" ]; var timerAttr = "data-alloy-transition-timer"; var isTransitioning$1 = function(element2, transition) { return hasAll(element2, transition.classes); }; var shouldApplyTransitionCss = function(transition, decision, lastPlacement) { return lastPlacement.exists(function(placer) { var mode3 = transition.mode; return mode3 === "all" ? true : placer[mode3] !== decision[mode3]; }); }; var hasChanges = function(position3, intermediate) { var round3 = function(value25) { return parseFloat(value25).toFixed(3); }; return find$4(intermediate, function(value25, key2) { var newValue = position3[key2].map(round3); var val = value25.map(round3); return !equals(newValue, val); }).isSome(); }; var getTransitionDuration = function(element2) { var get3 = function(name2) { var style = get$c(element2, name2); var times = isString3(style) ? style.split(/\s*,\s*/) : []; return filter$2(times, isNotEmpty); }; var parse3 = function(value25) { if (isString3(value25) && /^[\d.]+/.test(value25)) { var num = parseFloat(value25); return endsWith2(value25, "ms") ? num : num * 1e3; } else { return 0; } }; var delay = get3("transition-delay"); var duration2 = get3("transition-duration"); return foldl(duration2, function(acc, dur, i2) { var time = parse3(delay[i2]) + parse3(dur); return Math.max(acc, time); }, 0); }; var setupTransitionListeners = function(element2, transition) { var transitionEnd2 = unbindable(); var transitionCancel = unbindable(); var timer; var isSourceTransition = function(e2) { var _a4; var pseudoElement = (_a4 = e2.raw.pseudoElement) !== null && _a4 !== void 0 ? _a4 : ""; return eq2(e2.target, element2) && isEmpty(pseudoElement) && contains$2(properties, e2.raw.propertyName); }; var transitionDone = function(e2) { if (isNullable(e2) || isSourceTransition(e2)) { transitionEnd2.clear(); transitionCancel.clear(); var type3 = e2 === null || e2 === void 0 ? void 0 : e2.raw.type; if (isNullable(type3) || type3 === transitionend()) { clearTimeout(timer); remove$7(element2, timerAttr); remove$1(element2, transition.classes); } } }; var transitionStarted = function() { transitionEnd2.set(bind4(element2, transitionend(), transitionDone)); transitionCancel.set(bind4(element2, transitioncancel(), transitionDone)); }; if ("ontransitionstart" in element2.dom) { var transitionStart_1 = bind4(element2, transitionstart(), function(e2) { if (isSourceTransition(e2)) { transitionStart_1.unbind(); transitionStarted(); } }); } else { transitionStarted(); } var duration2 = getTransitionDuration(element2); requestAnimationFrame(function() { timer = setTimeout(transitionDone, duration2 + 17); set$8(element2, timerAttr, timer); }); }; var startTransitioning = function(element2, transition) { add$12(element2, transition.classes); getOpt(element2, timerAttr).each(function(timerId) { clearTimeout(parseInt(timerId, 10)); remove$7(element2, timerAttr); }); setupTransitionListeners(element2, transition); }; var applyTransitionCss = function(element2, origin, position3, transition, decision, lastPlacement) { var shouldTransition = shouldApplyTransitionCss(transition, decision, lastPlacement); if (shouldTransition || isTransitioning$1(element2, transition)) { set$7(element2, "position", position3.position); var rect2 = toBox(origin, element2); var intermediatePosition_1 = reposition(origin, __assign(__assign({}, decision), { rect: rect2 })); var intermediateCssOptions = mapToObject(properties, function(prop) { return intermediatePosition_1[prop]; }); if (hasChanges(position3, intermediateCssOptions)) { setOptions(element2, intermediateCssOptions); if (shouldTransition) { startTransitioning(element2, transition); } reflow(element2); } } else { remove$1(element2, transition.classes); } }; var elementSize = function(p) { return { width: getOuter$1(p), height: getOuter$2(p) }; }; var layout = function(anchorBox, element2, bubbles, options2) { remove$6(element2, "max-height"); remove$6(element2, "max-width"); var elementBox = elementSize(element2); return attempts(element2, options2.preference, anchorBox, elementBox, bubbles, options2.bounds); }; var setClasses = function(element2, decision) { var classInfo = decision.classes; remove$1(element2, classInfo.off); add$12(element2, classInfo.on); }; var setHeight = function(element2, decision, options2) { var maxHeightFunction = options2.maxHeightFunction; maxHeightFunction(element2, decision.maxHeight); }; var setWidth = function(element2, decision, options2) { var maxWidthFunction = options2.maxWidthFunction; maxWidthFunction(element2, decision.maxWidth); }; var position$2 = function(element2, decision, options2) { var positionCss = reposition(options2.origin, decision); options2.transition.each(function(transition) { applyTransitionCss(element2, options2.origin, positionCss, transition, decision, options2.lastPlacement); }); applyPositionCss(element2, positionCss); }; var setPlacement = function(element2, decision) { setPlacement$1(element2, decision.placement); }; var setMaxHeight = function(element2, maxHeight) { setMax$1(element2, Math.floor(maxHeight)); }; var anchored = constant$1(function(element2, available) { setMaxHeight(element2, available); setAll(element2, { "overflow-x": "hidden", "overflow-y": "auto" }); }); var expandable$1 = constant$1(function(element2, available) { setMaxHeight(element2, available); }); var defaultOr = function(options2, key2, dephault) { return options2[key2] === void 0 ? dephault : options2[key2]; }; var simple = function(anchor2, element2, bubble2, layouts2, lastPlacement, getBounds2, overrideOptions, transition) { var maxHeightFunction = defaultOr(overrideOptions, "maxHeightFunction", anchored()); var maxWidthFunction = defaultOr(overrideOptions, "maxWidthFunction", noop2); var anchorBox = anchor2.anchorBox; var origin = anchor2.origin; var options2 = { bounds: viewport(origin, getBounds2), origin, preference: layouts2, maxHeightFunction, maxWidthFunction, lastPlacement, transition }; return go2(anchorBox, element2, bubble2, options2); }; var go2 = function(anchorBox, element2, bubble2, options2) { var decision = layout(anchorBox, element2, bubble2, options2); position$2(element2, decision, options2); setPlacement(element2, decision); setClasses(element2, decision); setHeight(element2, decision, options2); setWidth(element2, decision, options2); return { layout: decision.layout, placement: decision.placement }; }; var allAlignments = [ "valignCentre", "alignLeft", "alignRight", "alignCentre", "top", "bottom", "left", "right", "inset" ]; var nu$5 = function(xOffset, yOffset, classes4, insetModifier) { if (insetModifier === void 0) { insetModifier = 1; } var insetXOffset = xOffset * insetModifier; var insetYOffset = yOffset * insetModifier; var getClasses2 = function(prop) { return get$e(classes4, prop).getOr([]); }; var make2 = function(xDelta, yDelta, alignmentsOn) { var alignmentsOff = difference(allAlignments, alignmentsOn); return { offset: SugarPosition(xDelta, yDelta), classesOn: bind$32(alignmentsOn, getClasses2), classesOff: bind$32(alignmentsOff, getClasses2) }; }; return { southeast: function() { return make2(-xOffset, yOffset, [ "top", "alignLeft" ]); }, southwest: function() { return make2(xOffset, yOffset, [ "top", "alignRight" ]); }, south: function() { return make2(-xOffset / 2, yOffset, [ "top", "alignCentre" ]); }, northeast: function() { return make2(-xOffset, -yOffset, [ "bottom", "alignLeft" ]); }, northwest: function() { return make2(xOffset, -yOffset, [ "bottom", "alignRight" ]); }, north: function() { return make2(-xOffset / 2, -yOffset, [ "bottom", "alignCentre" ]); }, east: function() { return make2(xOffset, -yOffset / 2, [ "valignCentre", "left" ]); }, west: function() { return make2(-xOffset, -yOffset / 2, [ "valignCentre", "right" ]); }, insetNortheast: function() { return make2(insetXOffset, insetYOffset, [ "top", "alignLeft", "inset" ]); }, insetNorthwest: function() { return make2(-insetXOffset, insetYOffset, [ "top", "alignRight", "inset" ]); }, insetNorth: function() { return make2(-insetXOffset / 2, insetYOffset, [ "top", "alignCentre", "inset" ]); }, insetSoutheast: function() { return make2(insetXOffset, -insetYOffset, [ "bottom", "alignLeft", "inset" ]); }, insetSouthwest: function() { return make2(-insetXOffset, -insetYOffset, [ "bottom", "alignRight", "inset" ]); }, insetSouth: function() { return make2(-insetXOffset / 2, -insetYOffset, [ "bottom", "alignCentre", "inset" ]); }, insetEast: function() { return make2(-insetXOffset, -insetYOffset / 2, [ "valignCentre", "right", "inset" ]); }, insetWest: function() { return make2(insetXOffset, -insetYOffset / 2, [ "valignCentre", "left", "inset" ]); } }; }; var fallback = function() { return nu$5(0, 0, {}); }; var nu$4 = identity$1; var onDirection = function(isLtr, isRtl) { return function(element2) { return getDirection(element2) === "rtl" ? isRtl : isLtr; }; }; var getDirection = function(element2) { return get$c(element2, "direction") === "rtl" ? "rtl" : "ltr"; }; var AttributeValue; (function(AttributeValue2) { AttributeValue2["TopToBottom"] = "toptobottom"; AttributeValue2["BottomToTop"] = "bottomtotop"; })(AttributeValue || (AttributeValue = {})); var Attribute = "data-alloy-vertical-dir"; var isBottomToTopDir = function(el) { return closest$2(el, function(current2) { return isElement$2(current2) && get$d(current2, "data-alloy-vertical-dir") === AttributeValue.BottomToTop; }); }; var schema$y = function() { return optionObjOf("layouts", [ required$12("onLtr"), required$12("onRtl"), option("onBottomLtr"), option("onBottomRtl") ]); }; var get$4 = function(elem, info3, defaultLtr, defaultRtl, defaultBottomLtr, defaultBottomRtl, dirElement) { var isBottomToTop = dirElement.map(isBottomToTopDir).getOr(false); var customLtr = info3.layouts.map(function(ls) { return ls.onLtr(elem); }); var customRtl = info3.layouts.map(function(ls) { return ls.onRtl(elem); }); var ltr = isBottomToTop ? info3.layouts.bind(function(ls) { return ls.onBottomLtr.map(function(f3) { return f3(elem); }); }).or(customLtr).getOr(defaultBottomLtr) : customLtr.getOr(defaultLtr); var rtl = isBottomToTop ? info3.layouts.bind(function(ls) { return ls.onBottomRtl.map(function(f3) { return f3(elem); }); }).or(customRtl).getOr(defaultBottomRtl) : customRtl.getOr(defaultRtl); var f2 = onDirection(ltr, rtl); return f2(elem); }; var placement$4 = function(component, anchorInfo, origin) { var hotspot = anchorInfo.hotspot; var anchorBox = toBox(origin, hotspot.element); var layouts2 = get$4(component.element, anchorInfo, belowOrAbove(), belowOrAboveRtl(), aboveOrBelow(), aboveOrBelowRtl(), Optional.some(anchorInfo.hotspot.element)); return Optional.some(nu$4({ anchorBox, bubble: anchorInfo.bubble.getOr(fallback()), overrides: anchorInfo.overrides, layouts: layouts2, placer: Optional.none() })); }; var HotspotAnchor = [ required$12("hotspot"), option("bubble"), defaulted("overrides", {}), schema$y(), output$1("placement", placement$4) ]; var placement$3 = function(component, anchorInfo, origin) { var pos = translate$2(origin, anchorInfo.x, anchorInfo.y); var anchorBox = bounds(pos.left, pos.top, anchorInfo.width, anchorInfo.height); var layouts2 = get$4(component.element, anchorInfo, all$1(), allRtl$1(), all$1(), allRtl$1(), Optional.none()); return Optional.some(nu$4({ anchorBox, bubble: anchorInfo.bubble, overrides: anchorInfo.overrides, layouts: layouts2, placer: Optional.none() })); }; var MakeshiftAnchor = [ required$12("x"), required$12("y"), defaulted("height", 0), defaulted("width", 0), defaulted("bubble", fallback()), defaulted("overrides", {}), schema$y(), output$1("placement", placement$3) ]; var adt$7 = Adt.generate([ { screen: ["point"] }, { absolute: [ "point", "scrollLeft", "scrollTop" ] } ]); var toFixed = function(pos) { return pos.fold(identity$1, function(point2, scrollLeft2, scrollTop2) { return point2.translate(-scrollLeft2, -scrollTop2); }); }; var toAbsolute = function(pos) { return pos.fold(identity$1, identity$1); }; var sum = function(points) { return foldl(points, function(b3, a2) { return b3.translate(a2.left, a2.top); }, SugarPosition(0, 0)); }; var sumAsFixed = function(positions) { var points = map$2(positions, toFixed); return sum(points); }; var sumAsAbsolute = function(positions) { var points = map$2(positions, toAbsolute); return sum(points); }; var screen = adt$7.screen; var absolute$1 = adt$7.absolute; var getOffset2 = function(component, origin, anchorInfo) { var win2 = defaultView(anchorInfo.root).dom; var hasSameOwner = function(frame) { var frameOwner = owner$4(frame); var compOwner = owner$4(component.element); return eq2(frameOwner, compOwner); }; return Optional.from(win2.frameElement).map(SugarElement.fromDom).filter(hasSameOwner).map(absolute$3); }; var getRootPoint = function(component, origin, anchorInfo) { var doc = owner$4(component.element); var outerScroll = get$9(doc); var offset5 = getOffset2(component, origin, anchorInfo).getOr(outerScroll); return absolute$1(offset5, outerScroll.left, outerScroll.top); }; var getBox = function(left2, top2, width2, height2) { var point2 = screen(SugarPosition(left2, top2)); return Optional.some(pointed(point2, width2, height2)); }; var calcNewAnchor = function(optBox, rootPoint, anchorInfo, origin, elem) { return optBox.map(function(box2) { var points = [ rootPoint, box2.point ]; var topLeft = cata$1(origin, function() { return sumAsAbsolute(points); }, function() { return sumAsAbsolute(points); }, function() { return sumAsFixed(points); }); var anchorBox = rect(topLeft.left, topLeft.top, box2.width, box2.height); var layoutsLtr = anchorInfo.showAbove ? aboveOrBelow() : belowOrAbove(); var layoutsRtl = anchorInfo.showAbove ? aboveOrBelowRtl() : belowOrAboveRtl(); var layouts2 = get$4(elem, anchorInfo, layoutsLtr, layoutsRtl, layoutsLtr, layoutsRtl, Optional.none()); return nu$4({ anchorBox, bubble: anchorInfo.bubble.getOr(fallback()), overrides: anchorInfo.overrides, layouts: layouts2, placer: Optional.none() }); }); }; var placement$2 = function(component, anchorInfo, origin) { var rootPoint = getRootPoint(component, origin, anchorInfo); return anchorInfo.node.filter(inBody).bind(function(target) { var rect2 = target.dom.getBoundingClientRect(); var nodeBox = getBox(rect2.left, rect2.top, rect2.width, rect2.height); var elem = anchorInfo.node.getOr(component.element); return calcNewAnchor(nodeBox, rootPoint, anchorInfo, origin, elem); }); }; var NodeAnchor = [ required$12("node"), required$12("root"), option("bubble"), schema$y(), defaulted("overrides", {}), defaulted("showAbove", false), output$1("placement", placement$2) ]; var zeroWidth = "\uFEFF"; var nbsp = "\xA0"; var create$7 = function(start, soffset, finish, foffset) { return { start, soffset, finish, foffset }; }; var SimRange = { create: create$7 }; var adt$6 = Adt.generate([ { before: ["element"] }, { on: [ "element", "offset" ] }, { after: ["element"] } ]); var cata = function(subject, onBefore, onOn, onAfter) { return subject.fold(onBefore, onOn, onAfter); }; var getStart$1 = function(situ) { return situ.fold(identity$1, identity$1, identity$1); }; var before = adt$6.before; var on$1 = adt$6.on; var after$1 = adt$6.after; var Situ = { before, on: on$1, after: after$1, cata, getStart: getStart$1 }; var adt$5 = Adt.generate([ { domRange: ["rng"] }, { relative: [ "startSitu", "finishSitu" ] }, { exact: [ "start", "soffset", "finish", "foffset" ] } ]); var exactFromRange = function(simRange) { return adt$5.exact(simRange.start, simRange.soffset, simRange.finish, simRange.foffset); }; var getStart = function(selection) { return selection.match({ domRange: function(rng) { return SugarElement.fromDom(rng.startContainer); }, relative: function(startSitu, _finishSitu) { return Situ.getStart(startSitu); }, exact: function(start, _soffset, _finish, _foffset) { return start; } }); }; var domRange = adt$5.domRange; var relative = adt$5.relative; var exact = adt$5.exact; var getWin = function(selection) { var start = getStart(selection); return defaultView(start); }; var range$1 = SimRange.create; var SimSelection = { domRange, relative, exact, exactFromRange, getWin, range: range$1 }; var setStart = function(rng, situ) { situ.fold(function(e2) { rng.setStartBefore(e2.dom); }, function(e2, o2) { rng.setStart(e2.dom, o2); }, function(e2) { rng.setStartAfter(e2.dom); }); }; var setFinish = function(rng, situ) { situ.fold(function(e2) { rng.setEndBefore(e2.dom); }, function(e2, o2) { rng.setEnd(e2.dom, o2); }, function(e2) { rng.setEndAfter(e2.dom); }); }; var relativeToNative = function(win2, startSitu, finishSitu) { var range3 = win2.document.createRange(); setStart(range3, startSitu); setFinish(range3, finishSitu); return range3; }; var exactToNative = function(win2, start, soffset, finish, foffset) { var rng = win2.document.createRange(); rng.setStart(start.dom, soffset); rng.setEnd(finish.dom, foffset); return rng; }; var toRect = function(rect2) { return { left: rect2.left, top: rect2.top, right: rect2.right, bottom: rect2.bottom, width: rect2.width, height: rect2.height }; }; var getFirstRect$1 = function(rng) { var rects = rng.getClientRects(); var rect2 = rects.length > 0 ? rects[0] : rng.getBoundingClientRect(); return rect2.width > 0 || rect2.height > 0 ? Optional.some(rect2).map(toRect) : Optional.none(); }; var getBounds$2 = function(rng) { var rect2 = rng.getBoundingClientRect(); return rect2.width > 0 || rect2.height > 0 ? Optional.some(rect2).map(toRect) : Optional.none(); }; var adt$4 = Adt.generate([ { ltr: [ "start", "soffset", "finish", "foffset" ] }, { rtl: [ "start", "soffset", "finish", "foffset" ] } ]); var fromRange = function(win2, type3, range3) { return type3(SugarElement.fromDom(range3.startContainer), range3.startOffset, SugarElement.fromDom(range3.endContainer), range3.endOffset); }; var getRanges = function(win2, selection) { return selection.match({ domRange: function(rng) { return { ltr: constant$1(rng), rtl: Optional.none }; }, relative: function(startSitu, finishSitu) { return { ltr: cached2(function() { return relativeToNative(win2, startSitu, finishSitu); }), rtl: cached2(function() { return Optional.some(relativeToNative(win2, finishSitu, startSitu)); }) }; }, exact: function(start, soffset, finish, foffset) { return { ltr: cached2(function() { return exactToNative(win2, start, soffset, finish, foffset); }), rtl: cached2(function() { return Optional.some(exactToNative(win2, finish, foffset, start, soffset)); }) }; } }); }; var doDiagnose = function(win2, ranges) { var rng = ranges.ltr(); if (rng.collapsed) { var reversed = ranges.rtl().filter(function(rev) { return rev.collapsed === false; }); return reversed.map(function(rev) { return adt$4.rtl(SugarElement.fromDom(rev.endContainer), rev.endOffset, SugarElement.fromDom(rev.startContainer), rev.startOffset); }).getOrThunk(function() { return fromRange(win2, adt$4.ltr, rng); }); } else { return fromRange(win2, adt$4.ltr, rng); } }; var diagnose = function(win2, selection) { var ranges = getRanges(win2, selection); return doDiagnose(win2, ranges); }; var asLtrRange = function(win2, selection) { var diagnosis = diagnose(win2, selection); return diagnosis.match({ ltr: function(start, soffset, finish, foffset) { var rng = win2.document.createRange(); rng.setStart(start.dom, soffset); rng.setEnd(finish.dom, foffset); return rng; }, rtl: function(start, soffset, finish, foffset) { var rng = win2.document.createRange(); rng.setStart(finish.dom, foffset); rng.setEnd(start.dom, soffset); return rng; } }); }; adt$4.ltr; adt$4.rtl; var NodeValue = function(is3, name2) { var get3 = function(element2) { if (!is3(element2)) { throw new Error("Can only get " + name2 + " value of a " + name2 + " node"); } return getOption3(element2).getOr(""); }; var getOption3 = function(element2) { return is3(element2) ? Optional.from(element2.dom.nodeValue) : Optional.none(); }; var set3 = function(element2, value25) { if (!is3(element2)) { throw new Error("Can only set raw " + name2 + " value of a " + name2 + " node"); } element2.dom.nodeValue = value25; }; return { get: get3, getOption: getOption3, set: set3 }; }; var api2 = NodeValue(isText$1, "text"); var get$3 = function(element2) { return api2.get(element2); }; var getOption2 = function(element2) { return api2.getOption(element2); }; var getEnd = function(element2) { return name$2(element2) === "img" ? 1 : getOption2(element2).fold(function() { return children(element2).length; }, function(v2) { return v2.length; }); }; var isTextNodeWithCursorPosition = function(el) { return getOption2(el).filter(function(text2) { return text2.trim().length !== 0 || text2.indexOf(nbsp) > -1; }).isSome(); }; var elementsWithCursorPosition = [ "img", "br" ]; var isCursorPosition = function(elem) { var hasCursorPosition = isTextNodeWithCursorPosition(elem); return hasCursorPosition || contains$2(elementsWithCursorPosition, name$2(elem)); }; var last$1 = function(element2) { return descendantRtl(element2, isCursorPosition); }; var descendantRtl = function(scope, predicate) { var descend = function(element2) { var children$1 = children(element2); for (var i2 = children$1.length - 1; i2 >= 0; i2--) { var child2 = children$1[i2]; if (predicate(child2)) { return Optional.some(child2); } var res = descend(child2); if (res.isSome()) { return res; } } return Optional.none(); }; return descend(scope); }; var descendants = function(scope, selector2) { return all$3(selector2, scope); }; var makeRange = function(start, soffset, finish, foffset) { var doc = owner$4(start); var rng = doc.dom.createRange(); rng.setStart(start.dom, soffset); rng.setEnd(finish.dom, foffset); return rng; }; var after = function(start, soffset, finish, foffset) { var r3 = makeRange(start, soffset, finish, foffset); var same = eq2(start, finish) && soffset === foffset; return r3.collapsed && !same; }; var getNativeSelection = function(win2) { return Optional.from(win2.getSelection()); }; var readRange = function(selection) { if (selection.rangeCount > 0) { var firstRng = selection.getRangeAt(0); var lastRng = selection.getRangeAt(selection.rangeCount - 1); return Optional.some(SimRange.create(SugarElement.fromDom(firstRng.startContainer), firstRng.startOffset, SugarElement.fromDom(lastRng.endContainer), lastRng.endOffset)); } else { return Optional.none(); } }; var doGetExact = function(selection) { if (selection.anchorNode === null || selection.focusNode === null) { return readRange(selection); } else { var anchor2 = SugarElement.fromDom(selection.anchorNode); var focus_1 = SugarElement.fromDom(selection.focusNode); return after(anchor2, selection.anchorOffset, focus_1, selection.focusOffset) ? Optional.some(SimRange.create(anchor2, selection.anchorOffset, focus_1, selection.focusOffset)) : readRange(selection); } }; var getExact = function(win2) { return getNativeSelection(win2).filter(function(sel) { return sel.rangeCount > 0; }).bind(doGetExact); }; var getFirstRect = function(win2, selection) { var rng = asLtrRange(win2, selection); return getFirstRect$1(rng); }; var getBounds$1 = function(win2, selection) { var rng = asLtrRange(win2, selection); return getBounds$2(rng); }; var point$1 = function(element2, offset5) { return { element: element2, offset: offset5 }; }; var descendOnce$1 = function(element2, offset5) { var children$1 = children(element2); if (children$1.length === 0) { return point$1(element2, offset5); } else if (offset5 < children$1.length) { return point$1(children$1[offset5], 0); } else { var last3 = children$1[children$1.length - 1]; var len = isText$1(last3) ? get$3(last3).length : children(last3).length; return point$1(last3, len); } }; var descendOnce = function(element2, offset5) { return isText$1(element2) ? point$1(element2, offset5) : descendOnce$1(element2, offset5); }; var getAnchorSelection = function(win2, anchorInfo) { var getSelection = anchorInfo.getSelection.getOrThunk(function() { return function() { return getExact(win2); }; }); return getSelection().map(function(sel) { var modStart = descendOnce(sel.start, sel.soffset); var modFinish = descendOnce(sel.finish, sel.foffset); return SimSelection.range(modStart.element, modStart.offset, modFinish.element, modFinish.offset); }); }; var placement$1 = function(component, anchorInfo, origin) { var win2 = defaultView(anchorInfo.root).dom; var rootPoint = getRootPoint(component, origin, anchorInfo); var selectionBox = getAnchorSelection(win2, anchorInfo).bind(function(sel) { var optRect = getBounds$1(win2, SimSelection.exactFromRange(sel)).orThunk(function() { var x2 = SugarElement.fromText(zeroWidth); before$2(sel.start, x2); var rect2 = getFirstRect(win2, SimSelection.exact(x2, 0, x2, 1)); remove$5(x2); return rect2; }); return optRect.bind(function(rawRect) { return getBox(rawRect.left, rawRect.top, rawRect.width, rawRect.height); }); }); var targetElement = getAnchorSelection(win2, anchorInfo).bind(function(sel) { return isElement$2(sel.start) ? Optional.some(sel.start) : parentNode(sel.start); }); var elem = targetElement.getOr(component.element); return calcNewAnchor(selectionBox, rootPoint, anchorInfo, origin, elem); }; var SelectionAnchor = [ option("getSelection"), required$12("root"), option("bubble"), schema$y(), defaulted("overrides", {}), defaulted("showAbove", false), output$1("placement", placement$1) ]; var labelPrefix$1 = "link-layout"; var eastX = function(anchor2) { return anchor2.x + anchor2.width; }; var westX = function(anchor2, element2) { return anchor2.x - element2.width; }; var northY$1 = function(anchor2, element2) { return anchor2.y - element2.height + anchor2.height; }; var southY$1 = function(anchor2) { return anchor2.y; }; var southeast$1 = function(anchor2, element2, bubbles) { return nu$6(eastX(anchor2), southY$1(anchor2), bubbles.southeast(), southeast$3(), "southeast", boundsRestriction(anchor2, { left: 0, top: 2 }), labelPrefix$1); }; var southwest$1 = function(anchor2, element2, bubbles) { return nu$6(westX(anchor2, element2), southY$1(anchor2), bubbles.southwest(), southwest$3(), "southwest", boundsRestriction(anchor2, { right: 1, top: 2 }), labelPrefix$1); }; var northeast$1 = function(anchor2, element2, bubbles) { return nu$6(eastX(anchor2), northY$1(anchor2, element2), bubbles.northeast(), northeast$3(), "northeast", boundsRestriction(anchor2, { left: 0, bottom: 3 }), labelPrefix$1); }; var northwest$1 = function(anchor2, element2, bubbles) { return nu$6(westX(anchor2, element2), northY$1(anchor2, element2), bubbles.northwest(), northwest$3(), "northwest", boundsRestriction(anchor2, { right: 1, bottom: 3 }), labelPrefix$1); }; var all2 = function() { return [ southeast$1, southwest$1, northeast$1, northwest$1 ]; }; var allRtl = function() { return [ southwest$1, southeast$1, northwest$1, northeast$1 ]; }; var placement2 = function(component, submenuInfo, origin) { var anchorBox = toBox(origin, submenuInfo.item.element); var layouts2 = get$4(component.element, submenuInfo, all2(), allRtl(), all2(), allRtl(), Optional.none()); return Optional.some(nu$4({ anchorBox, bubble: fallback(), overrides: submenuInfo.overrides, layouts: layouts2, placer: Optional.none() })); }; var SubmenuAnchor = [ required$12("item"), schema$y(), defaulted("overrides", {}), output$1("placement", placement2) ]; var AnchorSchema = choose$1("type", { selection: SelectionAnchor, node: NodeAnchor, hotspot: HotspotAnchor, submenu: SubmenuAnchor, makeshift: MakeshiftAnchor }); var TransitionSchema = [ requiredArrayOf("classes", string2), defaultedStringEnum("mode", "all", [ "all", "layout", "placement" ]) ]; var PositionSchema = [ defaulted("useFixed", never), option("getBounds") ]; var PlacementSchema = [ requiredOf("anchor", AnchorSchema), optionObjOf("transition", TransitionSchema) ]; var getFixedOrigin = function() { var html2 = document.documentElement; return fixed$1(0, 0, html2.clientWidth, html2.clientHeight); }; var getRelativeOrigin = function(component) { var position3 = absolute$3(component.element); var bounds2 = component.element.dom.getBoundingClientRect(); return relative$1(position3.left, position3.top, bounds2.width, bounds2.height); }; var place = function(component, origin, anchoring, getBounds2, placee, lastPlace, transition) { var anchor2 = box(anchoring.anchorBox, origin); return simple(anchor2, placee.element, anchoring.bubble, anchoring.layouts, lastPlace, getBounds2, anchoring.overrides, transition); }; var position$1 = function(component, posConfig, posState, placee, placementSpec) { positionWithin(component, posConfig, posState, placee, placementSpec, Optional.none()); }; var positionWithin = function(component, posConfig, posState, placee, placementSpec, boxElement) { var boundsBox = boxElement.map(box$1); return positionWithinBounds(component, posConfig, posState, placee, placementSpec, boundsBox); }; var positionWithinBounds = function(component, posConfig, posState, placee, placementSpec, bounds2) { var placeeDetail = asRawOrDie$1("placement.info", objOf(PlacementSchema), placementSpec); var anchorage = placeeDetail.anchor; var element2 = placee.element; var placeeState = posState.get(placee.uid); preserve$1(function() { set$7(element2, "position", "fixed"); var oldVisibility = getRaw(element2, "visibility"); set$7(element2, "visibility", "hidden"); var origin = posConfig.useFixed() ? getFixedOrigin() : getRelativeOrigin(component); var placer = anchorage.placement; var getBounds2 = bounds2.map(constant$1).or(posConfig.getBounds); placer(component, anchorage, origin).each(function(anchoring) { var doPlace = anchoring.placer.getOr(place); var newState = doPlace(component, origin, anchoring, getBounds2, placee, placeeState, placeeDetail.transition); posState.set(placee.uid, newState); }); oldVisibility.fold(function() { remove$6(element2, "visibility"); }, function(vis) { set$7(element2, "visibility", vis); }); if (getRaw(element2, "left").isNone() && getRaw(element2, "top").isNone() && getRaw(element2, "right").isNone() && getRaw(element2, "bottom").isNone() && is$1(getRaw(element2, "position"), "fixed")) { remove$6(element2, "position"); } }, element2); }; var getMode = function(component, pConfig, _pState) { return pConfig.useFixed() ? "fixed" : "absolute"; }; var reset$1 = function(component, pConfig, posState, placee) { var element2 = placee.element; each$12([ "position", "left", "right", "top", "bottom" ], function(prop) { return remove$6(element2, prop); }); reset$2(element2); posState.clear(placee.uid); }; var PositionApis = /* @__PURE__ */ Object.freeze({ __proto__: null, position: position$1, positionWithin, positionWithinBounds, getMode, reset: reset$1 }); var init$g = function() { var state = {}; var set3 = function(id2, data65) { state[id2] = data65; }; var get3 = function(id2) { return get$e(state, id2); }; var clear3 = function(id2) { if (isNonNullable(id2)) { delete state[id2]; } else { state = {}; } }; return nu$8({ readState: function() { return state; }, clear: clear3, set: set3, get: get3 }); }; var PositioningState = /* @__PURE__ */ Object.freeze({ __proto__: null, init: init$g }); var Positioning = create$8({ fields: PositionSchema, name: "positioning", active: ActivePosition, apis: PositionApis, state: PositioningState }); var fireDetaching = function(component) { emit2(component, detachedFromDom()); var children2 = component.components(); each$12(children2, fireDetaching); }; var fireAttaching = function(component) { var children2 = component.components(); each$12(children2, fireAttaching); emit2(component, attachedToDom()); }; var attach$1 = function(parent3, child2) { append$2(parent3.element, child2.element); }; var detachChildren$1 = function(component) { each$12(component.components(), function(childComp) { return remove$5(childComp.element); }); empty2(component.element); component.syncComponents(); }; var replaceChildren = function(component, newChildren) { var subs2 = component.components(); detachChildren$1(component); var deleted = difference(subs2, newChildren); each$12(deleted, function(comp) { fireDetaching(comp); component.getSystem().removeFromWorld(comp); }); each$12(newChildren, function(childComp) { if (!childComp.getSystem().isConnected()) { component.getSystem().addToWorld(childComp); attach$1(component, childComp); if (inBody(component.element)) { fireAttaching(childComp); } } else { attach$1(component, childComp); } component.syncComponents(); }); }; var attach = function(parent3, child2) { attachWith(parent3, child2, append$2); }; var attachWith = function(parent3, child2, insertion) { parent3.getSystem().addToWorld(child2); insertion(parent3.element, child2.element); if (inBody(parent3.element)) { fireAttaching(child2); } parent3.syncComponents(); }; var doDetach = function(component) { fireDetaching(component); remove$5(component.element); component.getSystem().removeFromWorld(component); }; var detach = function(component) { var parent$1 = parent2(component.element).bind(function(p) { return component.getSystem().getByDom(p).toOptional(); }); doDetach(component); parent$1.each(function(p) { p.syncComponents(); }); }; var detachChildren = function(component) { var subs2 = component.components(); each$12(subs2, doDetach); empty2(component.element); component.syncComponents(); }; var attachSystem = function(element2, guiSystem) { attachSystemWith(element2, guiSystem, append$2); }; var attachSystemAfter = function(element2, guiSystem) { attachSystemWith(element2, guiSystem, after$2); }; var attachSystemWith = function(element2, guiSystem, inserter) { inserter(element2, guiSystem.element); var children$1 = children(guiSystem.element); each$12(children$1, function(child2) { guiSystem.getByDom(child2).each(fireAttaching); }); }; var detachSystem = function(guiSystem) { var children$1 = children(guiSystem.element); each$12(children$1, function(child2) { guiSystem.getByDom(child2).each(fireDetaching); }); remove$5(guiSystem.element); }; var rebuild = function(sandbox, sConfig, sState, data65) { sState.get().each(function(_data) { detachChildren(sandbox); }); var point2 = sConfig.getAttachPoint(sandbox); attach(point2, sandbox); var built = sandbox.getSystem().build(data65); attach(sandbox, built); sState.set(built); return built; }; var open$1 = function(sandbox, sConfig, sState, data65) { var newState = rebuild(sandbox, sConfig, sState, data65); sConfig.onOpen(sandbox, newState); return newState; }; var setContent = function(sandbox, sConfig, sState, data65) { return sState.get().map(function() { return rebuild(sandbox, sConfig, sState, data65); }); }; var openWhileCloaked = function(sandbox, sConfig, sState, data65, transaction) { cloak(sandbox, sConfig); open$1(sandbox, sConfig, sState, data65); transaction(); decloak(sandbox, sConfig); }; var close$1 = function(sandbox, sConfig, sState) { sState.get().each(function(data65) { detachChildren(sandbox); detach(sandbox); sConfig.onClose(sandbox, data65); sState.clear(); }); }; var isOpen$1 = function(_sandbox, _sConfig, sState) { return sState.isOpen(); }; var isPartOf = function(sandbox, sConfig, sState, queryElem) { return isOpen$1(sandbox, sConfig, sState) && sState.get().exists(function(data65) { return sConfig.isPartOf(sandbox, data65, queryElem); }); }; var getState$2 = function(_sandbox, _sConfig, sState) { return sState.get(); }; var store = function(sandbox, cssKey, attr, newValue) { getRaw(sandbox.element, cssKey).fold(function() { remove$7(sandbox.element, attr); }, function(v2) { set$8(sandbox.element, attr, v2); }); set$7(sandbox.element, cssKey, newValue); }; var restore = function(sandbox, cssKey, attr) { getOpt(sandbox.element, attr).fold(function() { return remove$6(sandbox.element, cssKey); }, function(oldValue) { return set$7(sandbox.element, cssKey, oldValue); }); }; var cloak = function(sandbox, sConfig, _sState) { var sink = sConfig.getAttachPoint(sandbox); set$7(sandbox.element, "position", Positioning.getMode(sink)); store(sandbox, "visibility", sConfig.cloakVisibilityAttr, "hidden"); }; var hasPosition = function(element2) { return exists([ "top", "left", "right", "bottom" ], function(pos) { return getRaw(element2, pos).isSome(); }); }; var decloak = function(sandbox, sConfig, _sState) { if (!hasPosition(sandbox.element)) { remove$6(sandbox.element, "position"); } restore(sandbox, "visibility", sConfig.cloakVisibilityAttr); }; var SandboxApis = /* @__PURE__ */ Object.freeze({ __proto__: null, cloak, decloak, open: open$1, openWhileCloaked, close: close$1, isOpen: isOpen$1, isPartOf, getState: getState$2, setContent }); var events$g = function(sandboxConfig, sandboxState) { return derive$2([run$1(sandboxClose(), function(sandbox, _simulatedEvent) { close$1(sandbox, sandboxConfig, sandboxState); })]); }; var ActiveSandbox = /* @__PURE__ */ Object.freeze({ __proto__: null, events: events$g }); var SandboxSchema = [ onHandler("onOpen"), onHandler("onClose"), required$12("isPartOf"), required$12("getAttachPoint"), defaulted("cloakVisibilityAttr", "data-precloak-visibility") ]; var init$f = function() { var contents2 = value$1(); var readState = constant$1("not-implemented"); return nu$8({ readState, isOpen: contents2.isSet, clear: contents2.clear, set: contents2.set, get: contents2.get }); }; var SandboxState = /* @__PURE__ */ Object.freeze({ __proto__: null, init: init$f }); var Sandboxing = create$8({ fields: SandboxSchema, name: "sandboxing", active: ActiveSandbox, apis: SandboxApis, state: SandboxState }); var dismissPopups = constant$1("dismiss.popups"); var repositionPopups = constant$1("reposition.popups"); var mouseReleased = constant$1("mouse.released"); var schema$x = objOfOnly([ defaulted("isExtraPart", never), optionObjOf("fireEventInstead", [defaulted("event", dismissRequested())]) ]); var receivingChannel$1 = function(rawSpec) { var _a4; var detail = asRawOrDie$1("Dismissal", schema$x, rawSpec); return _a4 = {}, _a4[dismissPopups()] = { schema: objOfOnly([required$12("target")]), onReceive: function(sandbox, data65) { if (Sandboxing.isOpen(sandbox)) { var isPart = Sandboxing.isPartOf(sandbox, data65.target) || detail.isExtraPart(sandbox, data65.target); if (!isPart) { detail.fireEventInstead.fold(function() { return Sandboxing.close(sandbox); }, function(fe) { return emit2(sandbox, fe.event); }); } } } }, _a4; }; var schema$w = objOfOnly([ optionObjOf("fireEventInstead", [defaulted("event", repositionRequested())]), requiredFunction("doReposition") ]); var receivingChannel = function(rawSpec) { var _a4; var detail = asRawOrDie$1("Reposition", schema$w, rawSpec); return _a4 = {}, _a4[repositionPopups()] = { onReceive: function(sandbox) { if (Sandboxing.isOpen(sandbox)) { detail.fireEventInstead.fold(function() { return detail.doReposition(sandbox); }, function(fe) { return emit2(sandbox, fe.event); }); } } }, _a4; }; var onLoad$5 = function(component, repConfig, repState) { repConfig.store.manager.onLoad(component, repConfig, repState); }; var onUnload$2 = function(component, repConfig, repState) { repConfig.store.manager.onUnload(component, repConfig, repState); }; var setValue$3 = function(component, repConfig, repState, data65) { repConfig.store.manager.setValue(component, repConfig, repState, data65); }; var getValue$3 = function(component, repConfig, repState) { return repConfig.store.manager.getValue(component, repConfig, repState); }; var getState$1 = function(component, repConfig, repState) { return repState; }; var RepresentApis = /* @__PURE__ */ Object.freeze({ __proto__: null, onLoad: onLoad$5, onUnload: onUnload$2, setValue: setValue$3, getValue: getValue$3, getState: getState$1 }); var events$f = function(repConfig, repState) { var es = repConfig.resetOnDom ? [ runOnAttached(function(comp, _se) { onLoad$5(comp, repConfig, repState); }), runOnDetached(function(comp, _se) { onUnload$2(comp, repConfig, repState); }) ] : [loadEvent(repConfig, repState, onLoad$5)]; return derive$2(es); }; var ActiveRepresenting = /* @__PURE__ */ Object.freeze({ __proto__: null, events: events$f }); var memory$1 = function() { var data65 = Cell3(null); var readState = function() { return { mode: "memory", value: data65.get() }; }; var isNotSet = function() { return data65.get() === null; }; var clear3 = function() { data65.set(null); }; return nu$8({ set: data65.set, get: data65.get, isNotSet, clear: clear3, readState }); }; var manual = function() { var readState = noop2; return nu$8({ readState }); }; var dataset = function() { var dataByValue = Cell3({}); var dataByText = Cell3({}); var readState = function() { return { mode: "dataset", dataByValue: dataByValue.get(), dataByText: dataByText.get() }; }; var clear3 = function() { dataByValue.set({}); dataByText.set({}); }; var lookup2 = function(itemString) { return get$e(dataByValue.get(), itemString).orThunk(function() { return get$e(dataByText.get(), itemString); }); }; var update = function(items) { var currentDataByValue = dataByValue.get(); var currentDataByText = dataByText.get(); var newDataByValue = {}; var newDataByText = {}; each$12(items, function(item2) { newDataByValue[item2.value] = item2; get$e(item2, "meta").each(function(meta) { get$e(meta, "text").each(function(text2) { newDataByText[text2] = item2; }); }); }); dataByValue.set(__assign(__assign({}, currentDataByValue), newDataByValue)); dataByText.set(__assign(__assign({}, currentDataByText), newDataByText)); }; return nu$8({ readState, lookup: lookup2, update, clear: clear3 }); }; var init$e = function(spec) { return spec.store.manager.state(spec); }; var RepresentState = /* @__PURE__ */ Object.freeze({ __proto__: null, memory: memory$1, dataset, manual, init: init$e }); var setValue$2 = function(component, repConfig, repState, data65) { var store2 = repConfig.store; repState.update([data65]); store2.setValue(component, data65); repConfig.onSetValue(component, data65); }; var getValue$22 = function(component, repConfig, repState) { var store2 = repConfig.store; var key2 = store2.getDataKey(component); return repState.lookup(key2).getOrThunk(function() { return store2.getFallbackEntry(key2); }); }; var onLoad$4 = function(component, repConfig, repState) { var store2 = repConfig.store; store2.initialValue.each(function(data65) { setValue$2(component, repConfig, repState, data65); }); }; var onUnload$1 = function(component, repConfig, repState) { repState.clear(); }; var DatasetStore = [ option("initialValue"), required$12("getFallbackEntry"), required$12("getDataKey"), required$12("setValue"), output$1("manager", { setValue: setValue$2, getValue: getValue$22, onLoad: onLoad$4, onUnload: onUnload$1, state: dataset }) ]; var getValue$12 = function(component, repConfig, _repState) { return repConfig.store.getValue(component); }; var setValue$1 = function(component, repConfig, _repState, data65) { repConfig.store.setValue(component, data65); repConfig.onSetValue(component, data65); }; var onLoad$3 = function(component, repConfig, _repState) { repConfig.store.initialValue.each(function(data65) { repConfig.store.setValue(component, data65); }); }; var ManualStore = [ required$12("getValue"), defaulted("setValue", noop2), option("initialValue"), output$1("manager", { setValue: setValue$1, getValue: getValue$12, onLoad: onLoad$3, onUnload: noop2, state: NoState.init }) ]; var setValue9 = function(component, repConfig, repState, data65) { repState.set(data65); repConfig.onSetValue(component, data65); }; var getValue2 = function(component, repConfig, repState) { return repState.get(); }; var onLoad$2 = function(component, repConfig, repState) { repConfig.store.initialValue.each(function(initVal) { if (repState.isNotSet()) { repState.set(initVal); } }); }; var onUnload = function(component, repConfig, repState) { repState.clear(); }; var MemoryStore = [ option("initialValue"), output$1("manager", { setValue: setValue9, getValue: getValue2, onLoad: onLoad$2, onUnload, state: memory$1 }) ]; var RepresentSchema = [ defaultedOf("store", { mode: "memory" }, choose$1("mode", { memory: MemoryStore, manual: ManualStore, dataset: DatasetStore })), onHandler("onSetValue"), defaulted("resetOnDom", false) ]; var Representing = create$8({ fields: RepresentSchema, name: "representing", active: ActiveRepresenting, apis: RepresentApis, extra: { setValueFrom: function(component, source2) { var value25 = Representing.getValue(source2); Representing.setValue(component, value25); } }, state: RepresentState }); var field = function(name2, forbidden) { return defaultedObjOf(name2, {}, map$2(forbidden, function(f2) { return forbid(f2.name(), "Cannot configure " + f2.name() + " for " + name2); }).concat([customField("dump", identity$1)])); }; var get$22 = function(data65) { return data65.dump; }; var augment = function(data65, original2) { return __assign(__assign({}, derive$1(original2)), data65.dump); }; var SketchBehaviours = { field, augment, get: get$22 }; var _placeholder = "placeholder"; var adt$3 = Adt.generate([ { single: [ "required", "valueThunk" ] }, { multiple: [ "required", "valueThunks" ] } ]); var isSubstituted = function(spec) { return has$22(spec, "uiType"); }; var subPlaceholder = function(owner2, detail, compSpec, placeholders) { if (owner2.exists(function(o2) { return o2 !== compSpec.owner; })) { return adt$3.single(true, constant$1(compSpec)); } return get$e(placeholders, compSpec.name).fold(function() { throw new Error("Unknown placeholder component: " + compSpec.name + "\nKnown: [" + keys2(placeholders) + "]\nNamespace: " + owner2.getOr("none") + "\nSpec: " + JSON.stringify(compSpec, null, 2)); }, function(newSpec) { return newSpec.replace(); }); }; var scan2 = function(owner2, detail, compSpec, placeholders) { if (isSubstituted(compSpec) && compSpec.uiType === _placeholder) { return subPlaceholder(owner2, detail, compSpec, placeholders); } else { return adt$3.single(false, constant$1(compSpec)); } }; var substitute = function(owner2, detail, compSpec, placeholders) { var base2 = scan2(owner2, detail, compSpec, placeholders); return base2.fold(function(req, valueThunk2) { var value25 = isSubstituted(compSpec) ? valueThunk2(detail, compSpec.config, compSpec.validated) : valueThunk2(detail); var childSpecs = get$e(value25, "components").getOr([]); var substituted = bind$32(childSpecs, function(c2) { return substitute(owner2, detail, c2, placeholders); }); return [__assign(__assign({}, value25), { components: substituted })]; }, function(req, valuesThunk) { if (isSubstituted(compSpec)) { var values3 = valuesThunk(detail, compSpec.config, compSpec.validated); var preprocessor = compSpec.validated.preprocess.getOr(identity$1); return preprocessor(values3); } else { return valuesThunk(detail); } }); }; var substituteAll = function(owner2, detail, components4, placeholders) { return bind$32(components4, function(c2) { return substitute(owner2, detail, c2, placeholders); }); }; var oneReplace = function(label, replacements) { var called = false; var used = function() { return called; }; var replace2 = function() { if (called) { throw new Error("Trying to use the same placeholder more than once: " + label); } called = true; return replacements; }; var required3 = function() { return replacements.fold(function(req, _2) { return req; }, function(req, _2) { return req; }); }; return { name: constant$1(label), required: required3, used, replace: replace2 }; }; var substitutePlaces = function(owner2, detail, components4, placeholders) { var ps = map$1(placeholders, function(ph, name2) { return oneReplace(name2, ph); }); var outcome = substituteAll(owner2, detail, components4, ps); each2(ps, function(p) { if (p.used() === false && p.required()) { throw new Error("Placeholder: " + p.name() + " was not found in components list\nNamespace: " + owner2.getOr("none") + "\nComponents: " + JSON.stringify(detail.components, null, 2)); } }); return outcome; }; var single$2 = adt$3.single; var multiple = adt$3.multiple; var placeholder = constant$1(_placeholder); var adt$2 = Adt.generate([ { required: ["data"] }, { external: ["data"] }, { optional: ["data"] }, { group: ["data"] } ]); var fFactory = defaulted("factory", { sketch: identity$1 }); var fSchema = defaulted("schema", []); var fName = required$12("name"); var fPname = field$1("pname", "pname", defaultedThunk(function(typeSpec) { return ""; }), anyValue()); var fGroupSchema = customField("schema", function() { return [option("preprocess")]; }); var fDefaults = defaulted("defaults", constant$1({})); var fOverrides = defaulted("overrides", constant$1({})); var requiredSpec = objOf([ fFactory, fSchema, fName, fPname, fDefaults, fOverrides ]); var externalSpec = objOf([ fFactory, fSchema, fName, fDefaults, fOverrides ]); var optionalSpec = objOf([ fFactory, fSchema, fName, fPname, fDefaults, fOverrides ]); var groupSpec = objOf([ fFactory, fGroupSchema, fName, required$12("unit"), fPname, fDefaults, fOverrides ]); var asNamedPart = function(part2) { return part2.fold(Optional.some, Optional.none, Optional.some, Optional.some); }; var name$1 = function(part2) { var get3 = function(data65) { return data65.name; }; return part2.fold(get3, get3, get3, get3); }; var asCommon = function(part2) { return part2.fold(identity$1, identity$1, identity$1, identity$1); }; var convert = function(adtConstructor, partSchema) { return function(spec) { var data65 = asRawOrDie$1("Converting part type", partSchema, spec); return adtConstructor(data65); }; }; var required2 = convert(adt$2.required, requiredSpec); var external$1 = convert(adt$2.external, externalSpec); var optional = convert(adt$2.optional, optionalSpec); var group = convert(adt$2.group, groupSpec); var original = constant$1("entirety"); var PartType = /* @__PURE__ */ Object.freeze({ __proto__: null, required: required2, external: external$1, optional, group, asNamedPart, name: name$1, asCommon, original }); var combine3 = function(detail, data65, partSpec, partValidated) { return deepMerge2(data65.defaults(detail, partSpec, partValidated), partSpec, { uid: detail.partUids[data65.name] }, data65.overrides(detail, partSpec, partValidated)); }; var subs = function(owner2, detail, parts2) { var internals = {}; var externals = {}; each$12(parts2, function(part2) { part2.fold(function(data65) { internals[data65.pname] = single$2(true, function(detail2, partSpec, partValidated) { return data65.factory.sketch(combine3(detail2, data65, partSpec, partValidated)); }); }, function(data65) { var partSpec = detail.parts[data65.name]; externals[data65.name] = constant$1(data65.factory.sketch(combine3(detail, data65, partSpec[original()]), partSpec)); }, function(data65) { internals[data65.pname] = single$2(false, function(detail2, partSpec, partValidated) { return data65.factory.sketch(combine3(detail2, data65, partSpec, partValidated)); }); }, function(data65) { internals[data65.pname] = multiple(true, function(detail2, _partSpec, _partValidated) { var units2 = detail2[data65.name]; return map$2(units2, function(u2) { return data65.factory.sketch(deepMerge2(data65.defaults(detail2, u2, _partValidated), u2, data65.overrides(detail2, u2))); }); }); }); }); return { internals: constant$1(internals), externals: constant$1(externals) }; }; var generate$32 = function(owner2, parts2) { var r3 = {}; each$12(parts2, function(part2) { asNamedPart(part2).each(function(np) { var g2 = doGenerateOne(owner2, np.pname); r3[np.name] = function(config4) { var validated = asRawOrDie$1("Part: " + np.name + " in " + owner2, objOf(np.schema), config4); return __assign(__assign({}, g2), { config: config4, validated }); }; }); }); return r3; }; var doGenerateOne = function(owner2, pname) { return { uiType: placeholder(), owner: owner2, name: pname }; }; var generateOne$1 = function(owner2, pname, config4) { return { uiType: placeholder(), owner: owner2, name: pname, config: config4, validated: {} }; }; var schemas = function(parts2) { return bind$32(parts2, function(part2) { return part2.fold(Optional.none, Optional.some, Optional.none, Optional.none).map(function(data65) { return requiredObjOf(data65.name, data65.schema.concat([snapshot(original())])); }).toArray(); }); }; var names2 = function(parts2) { return map$2(parts2, name$1); }; var substitutes = function(owner2, detail, parts2) { return subs(owner2, detail, parts2); }; var components$1 = function(owner2, detail, internals) { return substitutePlaces(Optional.some(owner2), detail, detail.components, internals); }; var getPart = function(component, detail, partKey) { var uid2 = detail.partUids[partKey]; return component.getSystem().getByUid(uid2).toOptional(); }; var getPartOrDie = function(component, detail, partKey) { return getPart(component, detail, partKey).getOrDie("Could not find part: " + partKey); }; var getParts = function(component, detail, partKeys) { var r3 = {}; var uids2 = detail.partUids; var system = component.getSystem(); each$12(partKeys, function(pk) { r3[pk] = constant$1(system.getByUid(uids2[pk])); }); return r3; }; var getAllParts = function(component, detail) { var system = component.getSystem(); return map$1(detail.partUids, function(pUid, _k) { return constant$1(system.getByUid(pUid)); }); }; var getAllPartNames = function(detail) { return keys2(detail.partUids); }; var getPartsOrDie = function(component, detail, partKeys) { var r3 = {}; var uids2 = detail.partUids; var system = component.getSystem(); each$12(partKeys, function(pk) { r3[pk] = constant$1(system.getByUid(uids2[pk]).getOrDie()); }); return r3; }; var defaultUids = function(baseUid, partTypes) { var partNames = names2(partTypes); return wrapAll(map$2(partNames, function(pn) { return { key: pn, value: baseUid + "-" + pn }; })); }; var defaultUidsSchema = function(partTypes) { return field$1("partUids", "partUids", mergeWithThunk(function(spec) { return defaultUids(spec.uid, partTypes); }), anyValue()); }; var AlloyParts = /* @__PURE__ */ Object.freeze({ __proto__: null, generate: generate$32, generateOne: generateOne$1, schemas, names: names2, substitutes, components: components$1, defaultUids, defaultUidsSchema, getAllParts, getAllPartNames, getPart, getPartOrDie, getParts, getPartsOrDie }); var base = function(partSchemas, partUidsSchemas) { var ps = partSchemas.length > 0 ? [requiredObjOf("parts", partSchemas)] : []; return ps.concat([ required$12("uid"), defaulted("dom", {}), defaulted("components", []), snapshot("originalSpec"), defaulted("debug.sketcher", {}) ]).concat(partUidsSchemas); }; var asRawOrDie = function(label, schema3, spec, partSchemas, partUidsSchemas) { var baseS = base(partSchemas, partUidsSchemas); return asRawOrDie$1(label + " [SpecSchema]", objOfOnly(baseS.concat(schema3)), spec); }; var single$1 = function(owner2, schema3, factory2, spec) { var specWithUid = supplyUid(spec); var detail = asRawOrDie(owner2, schema3, specWithUid, [], []); return factory2(detail, specWithUid); }; var composite$1 = function(owner2, schema3, partTypes, factory2, spec) { var specWithUid = supplyUid(spec); var partSchemas = schemas(partTypes); var partUidsSchema = defaultUidsSchema(partTypes); var detail = asRawOrDie(owner2, schema3, specWithUid, partSchemas, [partUidsSchema]); var subs2 = substitutes(owner2, detail, partTypes); var components4 = components$1(owner2, detail, subs2.internals()); return factory2(detail, components4, specWithUid, subs2.externals()); }; var hasUid = function(spec) { return has$22(spec, "uid"); }; var supplyUid = function(spec) { return hasUid(spec) ? spec : __assign(__assign({}, spec), { uid: generate$5("uid") }); }; var isSketchSpec = function(spec) { return spec.uid !== void 0; }; var singleSchema = objOfOnly([ required$12("name"), required$12("factory"), required$12("configFields"), defaulted("apis", {}), defaulted("extraApis", {}) ]); var compositeSchema = objOfOnly([ required$12("name"), required$12("factory"), required$12("configFields"), required$12("partFields"), defaulted("apis", {}), defaulted("extraApis", {}) ]); var single = function(rawConfig) { var config4 = asRawOrDie$1("Sketcher for " + rawConfig.name, singleSchema, rawConfig); var sketch2 = function(spec) { return single$1(config4.name, config4.configFields, config4.factory, spec); }; var apis = map$1(config4.apis, makeApi); var extraApis = map$1(config4.extraApis, function(f2, k2) { return markAsExtraApi(f2, k2); }); return __assign(__assign({ name: config4.name, configFields: config4.configFields, sketch: sketch2 }, apis), extraApis); }; var composite = function(rawConfig) { var config4 = asRawOrDie$1("Sketcher for " + rawConfig.name, compositeSchema, rawConfig); var sketch2 = function(spec) { return composite$1(config4.name, config4.configFields, config4.partFields, config4.factory, spec); }; var parts2 = generate$32(config4.name, config4.partFields); var apis = map$1(config4.apis, makeApi); var extraApis = map$1(config4.extraApis, function(f2, k2) { return markAsExtraApi(f2, k2); }); return __assign(__assign({ name: config4.name, partFields: config4.partFields, configFields: config4.configFields, sketch: sketch2, parts: parts2 }, apis), extraApis); }; var inside = function(target) { return name$2(target) === "input" && get$d(target, "type") !== "radio" || name$2(target) === "textarea"; }; var getCurrent = function(component, composeConfig, _composeState) { return composeConfig.find(component); }; var ComposeApis = /* @__PURE__ */ Object.freeze({ __proto__: null, getCurrent }); var ComposeSchema = [required$12("find")]; var Composing = create$8({ fields: ComposeSchema, name: "composing", apis: ComposeApis }); var nativeDisabled = [ "input", "button", "textarea", "select" ]; var onLoad$1 = function(component, disableConfig, disableState) { var f2 = disableConfig.disabled() ? disable$1 : enable$1; f2(component, disableConfig); }; var hasNative = function(component, config4) { return config4.useNative === true && contains$2(nativeDisabled, name$2(component.element)); }; var nativeIsDisabled = function(component) { return has$12(component.element, "disabled"); }; var nativeDisable = function(component) { set$8(component.element, "disabled", "disabled"); }; var nativeEnable = function(component) { remove$7(component.element, "disabled"); }; var ariaIsDisabled = function(component) { return get$d(component.element, "aria-disabled") === "true"; }; var ariaDisable = function(component) { set$8(component.element, "aria-disabled", "true"); }; var ariaEnable = function(component) { set$8(component.element, "aria-disabled", "false"); }; var disable$1 = function(component, disableConfig, _disableState) { disableConfig.disableClass.each(function(disableClass) { add$2(component.element, disableClass); }); var f2 = hasNative(component, disableConfig) ? nativeDisable : ariaDisable; f2(component); disableConfig.onDisabled(component); }; var enable$1 = function(component, disableConfig, _disableState) { disableConfig.disableClass.each(function(disableClass) { remove$2(component.element, disableClass); }); var f2 = hasNative(component, disableConfig) ? nativeEnable : ariaEnable; f2(component); disableConfig.onEnabled(component); }; var isDisabled2 = function(component, disableConfig) { return hasNative(component, disableConfig) ? nativeIsDisabled(component) : ariaIsDisabled(component); }; var set$3 = function(component, disableConfig, disableState, disabled) { var f2 = disabled ? disable$1 : enable$1; f2(component, disableConfig); }; var DisableApis = /* @__PURE__ */ Object.freeze({ __proto__: null, enable: enable$1, disable: disable$1, isDisabled: isDisabled2, onLoad: onLoad$1, set: set$3 }); var exhibit$5 = function(base2, disableConfig) { return nu$7({ classes: disableConfig.disabled() ? disableConfig.disableClass.toArray() : [] }); }; var events$e = function(disableConfig, disableState) { return derive$2([ abort4(execute$5(), function(component, _simulatedEvent) { return isDisabled2(component, disableConfig); }), loadEvent(disableConfig, disableState, onLoad$1) ]); }; var ActiveDisable = /* @__PURE__ */ Object.freeze({ __proto__: null, exhibit: exhibit$5, events: events$e }); var DisableSchema = [ defaultedFunction("disabled", never), defaulted("useNative", true), option("disableClass"), onHandler("onDisabled"), onHandler("onEnabled") ]; var Disabling = create$8({ fields: DisableSchema, name: "disabling", active: ActiveDisable, apis: DisableApis }); var dehighlightAllExcept = function(component, hConfig, hState, skip) { var highlighted = descendants(component.element, "." + hConfig.highlightClass); each$12(highlighted, function(h2) { if (!exists(skip, function(skipComp) { return skipComp.element === h2; })) { remove$2(h2, hConfig.highlightClass); component.getSystem().getByDom(h2).each(function(target) { hConfig.onDehighlight(component, target); emit2(target, dehighlight$1()); }); } }); }; var dehighlightAll = function(component, hConfig, hState) { return dehighlightAllExcept(component, hConfig, hState, []); }; var dehighlight = function(component, hConfig, hState, target) { if (isHighlighted(component, hConfig, hState, target)) { remove$2(target.element, hConfig.highlightClass); hConfig.onDehighlight(component, target); emit2(target, dehighlight$1()); } }; var highlight = function(component, hConfig, hState, target) { dehighlightAllExcept(component, hConfig, hState, [target]); if (!isHighlighted(component, hConfig, hState, target)) { add$2(target.element, hConfig.highlightClass); hConfig.onHighlight(component, target); emit2(target, highlight$1()); } }; var highlightFirst = function(component, hConfig, hState) { getFirst(component, hConfig).each(function(firstComp) { highlight(component, hConfig, hState, firstComp); }); }; var highlightLast = function(component, hConfig, hState) { getLast(component, hConfig).each(function(lastComp) { highlight(component, hConfig, hState, lastComp); }); }; var highlightAt = function(component, hConfig, hState, index2) { getByIndex(component, hConfig, hState, index2).fold(function(err) { throw err; }, function(firstComp) { highlight(component, hConfig, hState, firstComp); }); }; var highlightBy = function(component, hConfig, hState, predicate) { var candidates = getCandidates(component, hConfig); var targetComp = find$5(candidates, predicate); targetComp.each(function(c2) { highlight(component, hConfig, hState, c2); }); }; var isHighlighted = function(component, hConfig, hState, queryTarget) { return has2(queryTarget.element, hConfig.highlightClass); }; var getHighlighted = function(component, hConfig, _hState) { return descendant(component.element, "." + hConfig.highlightClass).bind(function(e2) { return component.getSystem().getByDom(e2).toOptional(); }); }; var getByIndex = function(component, hConfig, hState, index2) { var items = descendants(component.element, "." + hConfig.itemClass); return Optional.from(items[index2]).fold(function() { return Result.error(new Error("No element found with index " + index2)); }, component.getSystem().getByDom); }; var getFirst = function(component, hConfig, _hState) { return descendant(component.element, "." + hConfig.itemClass).bind(function(e2) { return component.getSystem().getByDom(e2).toOptional(); }); }; var getLast = function(component, hConfig, _hState) { var items = descendants(component.element, "." + hConfig.itemClass); var last3 = items.length > 0 ? Optional.some(items[items.length - 1]) : Optional.none(); return last3.bind(function(c2) { return component.getSystem().getByDom(c2).toOptional(); }); }; var getDelta$2 = function(component, hConfig, hState, delta) { var items = descendants(component.element, "." + hConfig.itemClass); var current2 = findIndex$1(items, function(item2) { return has2(item2, hConfig.highlightClass); }); return current2.bind(function(selected) { var dest = cycleBy(selected, delta, 0, items.length - 1); return component.getSystem().getByDom(items[dest]).toOptional(); }); }; var getPrevious = function(component, hConfig, hState) { return getDelta$2(component, hConfig, hState, -1); }; var getNext = function(component, hConfig, hState) { return getDelta$2(component, hConfig, hState, 1); }; var getCandidates = function(component, hConfig, _hState) { var items = descendants(component.element, "." + hConfig.itemClass); return cat(map$2(items, function(i2) { return component.getSystem().getByDom(i2).toOptional(); })); }; var HighlightApis = /* @__PURE__ */ Object.freeze({ __proto__: null, dehighlightAll, dehighlight, highlight, highlightFirst, highlightLast, highlightAt, highlightBy, isHighlighted, getHighlighted, getFirst, getLast, getPrevious, getNext, getCandidates }); var HighlightSchema = [ required$12("highlightClass"), required$12("itemClass"), onHandler("onHighlight"), onHandler("onDehighlight") ]; var Highlighting = create$8({ fields: HighlightSchema, name: "highlighting", apis: HighlightApis }); var BACKSPACE = [8]; var TAB = [9]; var ENTER = [13]; var ESCAPE = [27]; var SPACE = [32]; var LEFT2 = [37]; var UP = [38]; var RIGHT = [39]; var DOWN = [40]; var cyclePrev = function(values3, index2, predicate) { var before2 = reverse(values3.slice(0, index2)); var after2 = reverse(values3.slice(index2 + 1)); return find$5(before2.concat(after2), predicate); }; var tryPrev = function(values3, index2, predicate) { var before2 = reverse(values3.slice(0, index2)); return find$5(before2, predicate); }; var cycleNext = function(values3, index2, predicate) { var before2 = values3.slice(0, index2); var after2 = values3.slice(index2 + 1); return find$5(after2.concat(before2), predicate); }; var tryNext = function(values3, index2, predicate) { var after2 = values3.slice(index2 + 1); return find$5(after2, predicate); }; var inSet = function(keys3) { return function(event) { var raw = event.raw; return contains$2(keys3, raw.which); }; }; var and = function(preds) { return function(event) { return forall(preds, function(pred) { return pred(event); }); }; }; var isShift = function(event) { var raw = event.raw; return raw.shiftKey === true; }; var isControl = function(event) { var raw = event.raw; return raw.ctrlKey === true; }; var isNotShift = not(isShift); var rule = function(matches, action) { return { matches, classification: action }; }; var choose = function(transitions, event) { var transition = find$5(transitions, function(t3) { return t3.matches(event); }); return transition.map(function(t3) { return t3.classification; }); }; var reportFocusShifting = function(component, prevFocus, newFocus) { var noChange = prevFocus.exists(function(p) { return newFocus.exists(function(n2) { return eq2(n2, p); }); }); if (!noChange) { emitWith(component, focusShifted(), { prevFocus, newFocus }); } }; var dom$2 = function() { var get3 = function(component) { return search(component.element); }; var set3 = function(component, focusee) { var prevFocus = get3(component); component.getSystem().triggerFocus(focusee, component.element); var newFocus = get3(component); reportFocusShifting(component, prevFocus, newFocus); }; return { get: get3, set: set3 }; }; var highlights = function() { var get3 = function(component) { return Highlighting.getHighlighted(component).map(function(item2) { return item2.element; }); }; var set3 = function(component, element2) { var prevFocus = get3(component); component.getSystem().getByDom(element2).fold(noop2, function(item2) { Highlighting.highlight(component, item2); }); var newFocus = get3(component); reportFocusShifting(component, prevFocus, newFocus); }; return { get: get3, set: set3 }; }; var FocusInsideModes; (function(FocusInsideModes2) { FocusInsideModes2["OnFocusMode"] = "onFocus"; FocusInsideModes2["OnEnterOrSpaceMode"] = "onEnterOrSpace"; FocusInsideModes2["OnApiMode"] = "onApi"; })(FocusInsideModes || (FocusInsideModes = {})); var typical = function(infoSchema, stateInit, getKeydownRules2, getKeyupRules2, optFocusIn) { var schema3 = function() { return infoSchema.concat([ defaulted("focusManager", dom$2()), defaultedOf("focusInside", "onFocus", valueOf2(function(val) { return contains$2([ "onFocus", "onEnterOrSpace", "onApi" ], val) ? Result.value(val) : Result.error("Invalid value for focusInside"); })), output$1("handler", me), output$1("state", stateInit), output$1("sendFocusIn", optFocusIn) ]); }; var processKey = function(component, simulatedEvent, getRules, keyingConfig, keyingState) { var rules2 = getRules(component, simulatedEvent, keyingConfig, keyingState); return choose(rules2, simulatedEvent.event).bind(function(rule2) { return rule2(component, simulatedEvent, keyingConfig, keyingState); }); }; var toEvents2 = function(keyingConfig, keyingState) { var onFocusHandler = keyingConfig.focusInside !== FocusInsideModes.OnFocusMode ? Optional.none() : optFocusIn(keyingConfig).map(function(focusIn2) { return run$1(focus$4(), function(component, simulatedEvent) { focusIn2(component, keyingConfig, keyingState); simulatedEvent.stop(); }); }); var tryGoInsideComponent = function(component, simulatedEvent) { var isEnterOrSpace = inSet(SPACE.concat(ENTER))(simulatedEvent.event); if (keyingConfig.focusInside === FocusInsideModes.OnEnterOrSpaceMode && isEnterOrSpace && isSource(component, simulatedEvent)) { optFocusIn(keyingConfig).each(function(focusIn2) { focusIn2(component, keyingConfig, keyingState); simulatedEvent.stop(); }); } }; var keyboardEvents = [ run$1(keydown(), function(component, simulatedEvent) { processKey(component, simulatedEvent, getKeydownRules2, keyingConfig, keyingState).fold(function() { tryGoInsideComponent(component, simulatedEvent); }, function(_2) { simulatedEvent.stop(); }); }), run$1(keyup(), function(component, simulatedEvent) { processKey(component, simulatedEvent, getKeyupRules2, keyingConfig, keyingState).each(function(_2) { simulatedEvent.stop(); }); }) ]; return derive$2(onFocusHandler.toArray().concat(keyboardEvents)); }; var me = { schema: schema3, processKey, toEvents: toEvents2 }; return me; }; var create$6 = function(cyclicField) { var schema3 = [ option("onEscape"), option("onEnter"), defaulted("selector", '[data-alloy-tabstop="true"]:not(:disabled)'), defaulted("firstTabstop", 0), defaulted("useTabstopAt", always), option("visibilitySelector") ].concat([cyclicField]); var isVisible3 = function(tabbingConfig, element2) { var target = tabbingConfig.visibilitySelector.bind(function(sel) { return closest$1(element2, sel); }).getOr(element2); return get$b(target) > 0; }; var findInitial = function(component, tabbingConfig) { var tabstops = descendants(component.element, tabbingConfig.selector); var visibles = filter$2(tabstops, function(elem) { return isVisible3(tabbingConfig, elem); }); return Optional.from(visibles[tabbingConfig.firstTabstop]); }; var findCurrent2 = function(component, tabbingConfig) { return tabbingConfig.focusManager.get(component).bind(function(elem) { return closest$1(elem, tabbingConfig.selector); }); }; var isTabstop = function(tabbingConfig, element2) { return isVisible3(tabbingConfig, element2) && tabbingConfig.useTabstopAt(element2); }; var focusIn2 = function(component, tabbingConfig, _tabbingState) { findInitial(component, tabbingConfig).each(function(target) { tabbingConfig.focusManager.set(component, target); }); }; var goFromTabstop = function(component, tabstops, stopIndex, tabbingConfig, cycle) { return cycle(tabstops, stopIndex, function(elem) { return isTabstop(tabbingConfig, elem); }).fold(function() { return tabbingConfig.cyclic ? Optional.some(true) : Optional.none(); }, function(target) { tabbingConfig.focusManager.set(component, target); return Optional.some(true); }); }; var go3 = function(component, _simulatedEvent, tabbingConfig, cycle) { var tabstops = descendants(component.element, tabbingConfig.selector); return findCurrent2(component, tabbingConfig).bind(function(tabstop) { var optStopIndex = findIndex$1(tabstops, curry(eq2, tabstop)); return optStopIndex.bind(function(stopIndex) { return goFromTabstop(component, tabstops, stopIndex, tabbingConfig, cycle); }); }); }; var goBackwards = function(component, simulatedEvent, tabbingConfig) { var navigate = tabbingConfig.cyclic ? cyclePrev : tryPrev; return go3(component, simulatedEvent, tabbingConfig, navigate); }; var goForwards = function(component, simulatedEvent, tabbingConfig) { var navigate = tabbingConfig.cyclic ? cycleNext : tryNext; return go3(component, simulatedEvent, tabbingConfig, navigate); }; var execute2 = function(component, simulatedEvent, tabbingConfig) { return tabbingConfig.onEnter.bind(function(f2) { return f2(component, simulatedEvent); }); }; var exit = function(component, simulatedEvent, tabbingConfig) { return tabbingConfig.onEscape.bind(function(f2) { return f2(component, simulatedEvent); }); }; var getKeydownRules2 = constant$1([ rule(and([ isShift, inSet(TAB) ]), goBackwards), rule(inSet(TAB), goForwards), rule(inSet(ESCAPE), exit), rule(and([ isNotShift, inSet(ENTER) ]), execute2) ]); var getKeyupRules2 = constant$1([]); return typical(schema3, NoState.init, getKeydownRules2, getKeyupRules2, function() { return Optional.some(focusIn2); }); }; var AcyclicType = create$6(customField("cyclic", never)); var CyclicType = create$6(customField("cyclic", always)); var doDefaultExecute = function(component, _simulatedEvent, focused) { dispatch2(component, focused, execute$5()); return Optional.some(true); }; var defaultExecute = function(component, simulatedEvent, focused) { var isComplex = inside(focused) && inSet(SPACE)(simulatedEvent.event); return isComplex ? Optional.none() : doDefaultExecute(component, simulatedEvent, focused); }; var stopEventForFirefox = function(_component, _simulatedEvent) { return Optional.some(true); }; var schema$v = [ defaulted("execute", defaultExecute), defaulted("useSpace", false), defaulted("useEnter", true), defaulted("useControlEnter", false), defaulted("useDown", false) ]; var execute$4 = function(component, simulatedEvent, executeConfig) { return executeConfig.execute(component, simulatedEvent, component.element); }; var getKeydownRules$5 = function(component, _simulatedEvent, executeConfig, _executeState) { var spaceExec = executeConfig.useSpace && !inside(component.element) ? SPACE : []; var enterExec = executeConfig.useEnter ? ENTER : []; var downExec = executeConfig.useDown ? DOWN : []; var execKeys = spaceExec.concat(enterExec).concat(downExec); return [rule(inSet(execKeys), execute$4)].concat(executeConfig.useControlEnter ? [rule(and([ isControl, inSet(ENTER) ]), execute$4)] : []); }; var getKeyupRules$5 = function(component, _simulatedEvent, executeConfig, _executeState) { return executeConfig.useSpace && !inside(component.element) ? [rule(inSet(SPACE), stopEventForFirefox)] : []; }; var ExecutionType = typical(schema$v, NoState.init, getKeydownRules$5, getKeyupRules$5, function() { return Optional.none(); }); var flatgrid$1 = function() { var dimensions = value$1(); var setGridSize = function(numRows, numColumns) { dimensions.set({ numRows, numColumns }); }; var getNumRows = function() { return dimensions.get().map(function(d2) { return d2.numRows; }); }; var getNumColumns = function() { return dimensions.get().map(function(d2) { return d2.numColumns; }); }; return nu$8({ readState: function() { return dimensions.get().map(function(d2) { return { numRows: String(d2.numRows), numColumns: String(d2.numColumns) }; }).getOr({ numRows: "?", numColumns: "?" }); }, setGridSize, getNumRows, getNumColumns }); }; var init$d = function(spec) { return spec.state(spec); }; var KeyingState = /* @__PURE__ */ Object.freeze({ __proto__: null, flatgrid: flatgrid$1, init: init$d }); var useH = function(movement) { return function(component, simulatedEvent, config4, state) { var move3 = movement(component.element); return use2(move3, component, simulatedEvent, config4, state); }; }; var west$1 = function(moveLeft2, moveRight2) { var movement = onDirection(moveLeft2, moveRight2); return useH(movement); }; var east$1 = function(moveLeft2, moveRight2) { var movement = onDirection(moveRight2, moveLeft2); return useH(movement); }; var useV = function(move3) { return function(component, simulatedEvent, config4, state) { return use2(move3, component, simulatedEvent, config4, state); }; }; var use2 = function(move3, component, simulatedEvent, config4, state) { var outcome = config4.focusManager.get(component).bind(function(focused) { return move3(component.element, focused, config4, state); }); return outcome.map(function(newFocus) { config4.focusManager.set(component, newFocus); return true; }); }; var north$1 = useV; var south$1 = useV; var move$1 = useV; var isHidden$1 = function(dom2) { return dom2.offsetWidth <= 0 && dom2.offsetHeight <= 0; }; var isVisible2 = function(element2) { return !isHidden$1(element2.dom); }; var locate = function(candidates, predicate) { return findIndex$1(candidates, predicate).map(function(index2) { return { index: index2, candidates }; }); }; var locateVisible = function(container, current2, selector2) { var predicate = function(x2) { return eq2(x2, current2); }; var candidates = descendants(container, selector2); var visible9 = filter$2(candidates, isVisible2); return locate(visible9, predicate); }; var findIndex2 = function(elements, target) { return findIndex$1(elements, function(elem) { return eq2(target, elem); }); }; var withGrid = function(values3, index2, numCols, f2) { var oldRow = Math.floor(index2 / numCols); var oldColumn = index2 % numCols; return f2(oldRow, oldColumn).bind(function(address) { var newIndex = address.row * numCols + address.column; return newIndex >= 0 && newIndex < values3.length ? Optional.some(values3[newIndex]) : Optional.none(); }); }; var cycleHorizontal$1 = function(values3, index2, numRows, numCols, delta) { return withGrid(values3, index2, numCols, function(oldRow, oldColumn) { var onLastRow = oldRow === numRows - 1; var colsInRow = onLastRow ? values3.length - oldRow * numCols : numCols; var newColumn = cycleBy(oldColumn, delta, 0, colsInRow - 1); return Optional.some({ row: oldRow, column: newColumn }); }); }; var cycleVertical$1 = function(values3, index2, numRows, numCols, delta) { return withGrid(values3, index2, numCols, function(oldRow, oldColumn) { var newRow = cycleBy(oldRow, delta, 0, numRows - 1); var onLastRow = newRow === numRows - 1; var colsInRow = onLastRow ? values3.length - newRow * numCols : numCols; var newCol = clamp$1(oldColumn, 0, colsInRow - 1); return Optional.some({ row: newRow, column: newCol }); }); }; var cycleRight$1 = function(values3, index2, numRows, numCols) { return cycleHorizontal$1(values3, index2, numRows, numCols, 1); }; var cycleLeft$1 = function(values3, index2, numRows, numCols) { return cycleHorizontal$1(values3, index2, numRows, numCols, -1); }; var cycleUp$1 = function(values3, index2, numRows, numCols) { return cycleVertical$1(values3, index2, numRows, numCols, -1); }; var cycleDown$1 = function(values3, index2, numRows, numCols) { return cycleVertical$1(values3, index2, numRows, numCols, 1); }; var schema$u = [ required$12("selector"), defaulted("execute", defaultExecute), onKeyboardHandler("onEscape"), defaulted("captureTab", false), initSize() ]; var focusIn$3 = function(component, gridConfig, _gridState) { descendant(component.element, gridConfig.selector).each(function(first2) { gridConfig.focusManager.set(component, first2); }); }; var findCurrent$1 = function(component, gridConfig) { return gridConfig.focusManager.get(component).bind(function(elem) { return closest$1(elem, gridConfig.selector); }); }; var execute$3 = function(component, simulatedEvent, gridConfig, _gridState) { return findCurrent$1(component, gridConfig).bind(function(focused) { return gridConfig.execute(component, simulatedEvent, focused); }); }; var doMove$2 = function(cycle) { return function(element2, focused, gridConfig, gridState) { return locateVisible(element2, focused, gridConfig.selector).bind(function(identified) { return cycle(identified.candidates, identified.index, gridState.getNumRows().getOr(gridConfig.initSize.numRows), gridState.getNumColumns().getOr(gridConfig.initSize.numColumns)); }); }; }; var handleTab = function(_component, _simulatedEvent, gridConfig) { return gridConfig.captureTab ? Optional.some(true) : Optional.none(); }; var doEscape$1 = function(component, simulatedEvent, gridConfig) { return gridConfig.onEscape(component, simulatedEvent); }; var moveLeft$3 = doMove$2(cycleLeft$1); var moveRight$3 = doMove$2(cycleRight$1); var moveNorth$1 = doMove$2(cycleUp$1); var moveSouth$1 = doMove$2(cycleDown$1); var getKeydownRules$4 = constant$1([ rule(inSet(LEFT2), west$1(moveLeft$3, moveRight$3)), rule(inSet(RIGHT), east$1(moveLeft$3, moveRight$3)), rule(inSet(UP), north$1(moveNorth$1)), rule(inSet(DOWN), south$1(moveSouth$1)), rule(and([ isShift, inSet(TAB) ]), handleTab), rule(and([ isNotShift, inSet(TAB) ]), handleTab), rule(inSet(ESCAPE), doEscape$1), rule(inSet(SPACE.concat(ENTER)), execute$3) ]); var getKeyupRules$4 = constant$1([rule(inSet(SPACE), stopEventForFirefox)]); var FlatgridType = typical(schema$u, flatgrid$1, getKeydownRules$4, getKeyupRules$4, function() { return Optional.some(focusIn$3); }); var horizontal = function(container, selector2, current2, delta) { var isDisabledButton = function(candidate) { return name$2(candidate) === "button" && get$d(candidate, "disabled") === "disabled"; }; var tryCycle = function(initial, index2, candidates) { var newIndex = cycleBy(index2, delta, 0, candidates.length - 1); if (newIndex === initial) { return Optional.none(); } else { return isDisabledButton(candidates[newIndex]) ? tryCycle(initial, newIndex, candidates) : Optional.from(candidates[newIndex]); } }; return locateVisible(container, current2, selector2).bind(function(identified) { var index2 = identified.index; var candidates = identified.candidates; return tryCycle(index2, index2, candidates); }); }; var schema$t = [ required$12("selector"), defaulted("getInitial", Optional.none), defaulted("execute", defaultExecute), onKeyboardHandler("onEscape"), defaulted("executeOnMove", false), defaulted("allowVertical", true) ]; var findCurrent = function(component, flowConfig) { return flowConfig.focusManager.get(component).bind(function(elem) { return closest$1(elem, flowConfig.selector); }); }; var execute$2 = function(component, simulatedEvent, flowConfig) { return findCurrent(component, flowConfig).bind(function(focused) { return flowConfig.execute(component, simulatedEvent, focused); }); }; var focusIn$2 = function(component, flowConfig, _state) { flowConfig.getInitial(component).orThunk(function() { return descendant(component.element, flowConfig.selector); }).each(function(first2) { flowConfig.focusManager.set(component, first2); }); }; var moveLeft$2 = function(element2, focused, info3) { return horizontal(element2, info3.selector, focused, -1); }; var moveRight$2 = function(element2, focused, info3) { return horizontal(element2, info3.selector, focused, 1); }; var doMove$1 = function(movement) { return function(component, simulatedEvent, flowConfig, flowState) { return movement(component, simulatedEvent, flowConfig, flowState).bind(function() { return flowConfig.executeOnMove ? execute$2(component, simulatedEvent, flowConfig) : Optional.some(true); }); }; }; var doEscape = function(component, simulatedEvent, flowConfig) { return flowConfig.onEscape(component, simulatedEvent); }; var getKeydownRules$3 = function(_component, _se, flowConfig, _flowState) { var westMovers = LEFT2.concat(flowConfig.allowVertical ? UP : []); var eastMovers = RIGHT.concat(flowConfig.allowVertical ? DOWN : []); return [ rule(inSet(westMovers), doMove$1(west$1(moveLeft$2, moveRight$2))), rule(inSet(eastMovers), doMove$1(east$1(moveLeft$2, moveRight$2))), rule(inSet(ENTER), execute$2), rule(inSet(SPACE), execute$2), rule(inSet(ESCAPE), doEscape) ]; }; var getKeyupRules$3 = constant$1([rule(inSet(SPACE), stopEventForFirefox)]); var FlowType = typical(schema$t, NoState.init, getKeydownRules$3, getKeyupRules$3, function() { return Optional.some(focusIn$2); }); var toCell = function(matrix2, rowIndex, columnIndex) { return Optional.from(matrix2[rowIndex]).bind(function(row) { return Optional.from(row[columnIndex]).map(function(cell) { return { rowIndex, columnIndex, cell }; }); }); }; var cycleHorizontal = function(matrix2, rowIndex, startCol, deltaCol) { var row = matrix2[rowIndex]; var colsInRow = row.length; var newColIndex = cycleBy(startCol, deltaCol, 0, colsInRow - 1); return toCell(matrix2, rowIndex, newColIndex); }; var cycleVertical = function(matrix2, colIndex, startRow, deltaRow) { var nextRowIndex = cycleBy(startRow, deltaRow, 0, matrix2.length - 1); var colsInNextRow = matrix2[nextRowIndex].length; var nextColIndex = clamp$1(colIndex, 0, colsInNextRow - 1); return toCell(matrix2, nextRowIndex, nextColIndex); }; var moveHorizontal = function(matrix2, rowIndex, startCol, deltaCol) { var row = matrix2[rowIndex]; var colsInRow = row.length; var newColIndex = clamp$1(startCol + deltaCol, 0, colsInRow - 1); return toCell(matrix2, rowIndex, newColIndex); }; var moveVertical = function(matrix2, colIndex, startRow, deltaRow) { var nextRowIndex = clamp$1(startRow + deltaRow, 0, matrix2.length - 1); var colsInNextRow = matrix2[nextRowIndex].length; var nextColIndex = clamp$1(colIndex, 0, colsInNextRow - 1); return toCell(matrix2, nextRowIndex, nextColIndex); }; var cycleRight = function(matrix2, startRow, startCol) { return cycleHorizontal(matrix2, startRow, startCol, 1); }; var cycleLeft = function(matrix2, startRow, startCol) { return cycleHorizontal(matrix2, startRow, startCol, -1); }; var cycleUp = function(matrix2, startRow, startCol) { return cycleVertical(matrix2, startCol, startRow, -1); }; var cycleDown = function(matrix2, startRow, startCol) { return cycleVertical(matrix2, startCol, startRow, 1); }; var moveLeft$1 = function(matrix2, startRow, startCol) { return moveHorizontal(matrix2, startRow, startCol, -1); }; var moveRight$1 = function(matrix2, startRow, startCol) { return moveHorizontal(matrix2, startRow, startCol, 1); }; var moveUp$1 = function(matrix2, startRow, startCol) { return moveVertical(matrix2, startCol, startRow, -1); }; var moveDown$1 = function(matrix2, startRow, startCol) { return moveVertical(matrix2, startCol, startRow, 1); }; var schema$s = [ requiredObjOf("selectors", [ required$12("row"), required$12("cell") ]), defaulted("cycles", true), defaulted("previousSelector", Optional.none), defaulted("execute", defaultExecute) ]; var focusIn$1 = function(component, matrixConfig, _state) { var focused = matrixConfig.previousSelector(component).orThunk(function() { var selectors = matrixConfig.selectors; return descendant(component.element, selectors.cell); }); focused.each(function(cell) { matrixConfig.focusManager.set(component, cell); }); }; var execute$1 = function(component, simulatedEvent, matrixConfig) { return search(component.element).bind(function(focused) { return matrixConfig.execute(component, simulatedEvent, focused); }); }; var toMatrix = function(rows, matrixConfig) { return map$2(rows, function(row) { return descendants(row, matrixConfig.selectors.cell); }); }; var doMove = function(ifCycle, ifMove) { return function(element2, focused, matrixConfig) { var move3 = matrixConfig.cycles ? ifCycle : ifMove; return closest$1(focused, matrixConfig.selectors.row).bind(function(inRow) { var cellsInRow = descendants(inRow, matrixConfig.selectors.cell); return findIndex2(cellsInRow, focused).bind(function(colIndex) { var allRows = descendants(element2, matrixConfig.selectors.row); return findIndex2(allRows, inRow).bind(function(rowIndex) { var matrix2 = toMatrix(allRows, matrixConfig); return move3(matrix2, rowIndex, colIndex).map(function(next2) { return next2.cell; }); }); }); }); }; }; var moveLeft = doMove(cycleLeft, moveLeft$1); var moveRight = doMove(cycleRight, moveRight$1); var moveNorth = doMove(cycleUp, moveUp$1); var moveSouth = doMove(cycleDown, moveDown$1); var getKeydownRules$2 = constant$1([ rule(inSet(LEFT2), west$1(moveLeft, moveRight)), rule(inSet(RIGHT), east$1(moveLeft, moveRight)), rule(inSet(UP), north$1(moveNorth)), rule(inSet(DOWN), south$1(moveSouth)), rule(inSet(SPACE.concat(ENTER)), execute$1) ]); var getKeyupRules$2 = constant$1([rule(inSet(SPACE), stopEventForFirefox)]); var MatrixType = typical(schema$s, NoState.init, getKeydownRules$2, getKeyupRules$2, function() { return Optional.some(focusIn$1); }); var schema$r = [ required$12("selector"), defaulted("execute", defaultExecute), defaulted("moveOnTab", false) ]; var execute = function(component, simulatedEvent, menuConfig) { return menuConfig.focusManager.get(component).bind(function(focused) { return menuConfig.execute(component, simulatedEvent, focused); }); }; var focusIn = function(component, menuConfig, _state) { descendant(component.element, menuConfig.selector).each(function(first2) { menuConfig.focusManager.set(component, first2); }); }; var moveUp = function(element2, focused, info3) { return horizontal(element2, info3.selector, focused, -1); }; var moveDown = function(element2, focused, info3) { return horizontal(element2, info3.selector, focused, 1); }; var fireShiftTab = function(component, simulatedEvent, menuConfig, menuState) { return menuConfig.moveOnTab ? move$1(moveUp)(component, simulatedEvent, menuConfig, menuState) : Optional.none(); }; var fireTab = function(component, simulatedEvent, menuConfig, menuState) { return menuConfig.moveOnTab ? move$1(moveDown)(component, simulatedEvent, menuConfig, menuState) : Optional.none(); }; var getKeydownRules$1 = constant$1([ rule(inSet(UP), move$1(moveUp)), rule(inSet(DOWN), move$1(moveDown)), rule(and([ isShift, inSet(TAB) ]), fireShiftTab), rule(and([ isNotShift, inSet(TAB) ]), fireTab), rule(inSet(ENTER), execute), rule(inSet(SPACE), execute) ]); var getKeyupRules$1 = constant$1([rule(inSet(SPACE), stopEventForFirefox)]); var MenuType = typical(schema$r, NoState.init, getKeydownRules$1, getKeyupRules$1, function() { return Optional.some(focusIn); }); var schema$q = [ onKeyboardHandler("onSpace"), onKeyboardHandler("onEnter"), onKeyboardHandler("onShiftEnter"), onKeyboardHandler("onLeft"), onKeyboardHandler("onRight"), onKeyboardHandler("onTab"), onKeyboardHandler("onShiftTab"), onKeyboardHandler("onUp"), onKeyboardHandler("onDown"), onKeyboardHandler("onEscape"), defaulted("stopSpaceKeyup", false), option("focusIn") ]; var getKeydownRules = function(component, simulatedEvent, specialInfo) { return [ rule(inSet(SPACE), specialInfo.onSpace), rule(and([ isNotShift, inSet(ENTER) ]), specialInfo.onEnter), rule(and([ isShift, inSet(ENTER) ]), specialInfo.onShiftEnter), rule(and([ isShift, inSet(TAB) ]), specialInfo.onShiftTab), rule(and([ isNotShift, inSet(TAB) ]), specialInfo.onTab), rule(inSet(UP), specialInfo.onUp), rule(inSet(DOWN), specialInfo.onDown), rule(inSet(LEFT2), specialInfo.onLeft), rule(inSet(RIGHT), specialInfo.onRight), rule(inSet(SPACE), specialInfo.onSpace), rule(inSet(ESCAPE), specialInfo.onEscape) ]; }; var getKeyupRules = function(component, simulatedEvent, specialInfo) { return specialInfo.stopSpaceKeyup ? [rule(inSet(SPACE), stopEventForFirefox)] : []; }; var SpecialType = typical(schema$q, NoState.init, getKeydownRules, getKeyupRules, function(specialInfo) { return specialInfo.focusIn; }); var acyclic = AcyclicType.schema(); var cyclic = CyclicType.schema(); var flow = FlowType.schema(); var flatgrid = FlatgridType.schema(); var matrix = MatrixType.schema(); var execution = ExecutionType.schema(); var menu = MenuType.schema(); var special = SpecialType.schema(); var KeyboardBranches = /* @__PURE__ */ Object.freeze({ __proto__: null, acyclic, cyclic, flow, flatgrid, matrix, execution, menu, special }); var isFlatgridState = function(keyState) { return hasNonNullableKey(keyState, "setGridSize"); }; var Keying = createModes({ branchKey: "mode", branches: KeyboardBranches, name: "keying", active: { events: function(keyingConfig, keyingState) { var handler7 = keyingConfig.handler; return handler7.toEvents(keyingConfig, keyingState); } }, apis: { focusIn: function(component, keyConfig, keyState) { keyConfig.sendFocusIn(keyConfig).fold(function() { component.getSystem().triggerFocus(component.element, component.element); }, function(sendFocusIn) { sendFocusIn(component, keyConfig, keyState); }); }, setGridSize: function(component, keyConfig, keyState, numRows, numColumns) { if (!isFlatgridState(keyState)) { console.error("Layout does not support setGridSize"); } else { keyState.setGridSize(numRows, numColumns); } } }, state: KeyingState }); var set$2 = function(component, replaceConfig, replaceState, data65) { preserve$1(function() { var newChildren = map$2(data65, component.getSystem().build); replaceChildren(component, newChildren); }, component.element); }; var insert = function(component, replaceConfig, insertion, childSpec) { var child2 = component.getSystem().build(childSpec); attachWith(component, child2, insertion); }; var append = function(component, replaceConfig, replaceState, appendee) { insert(component, replaceConfig, append$2, appendee); }; var prepend = function(component, replaceConfig, replaceState, prependee) { insert(component, replaceConfig, prepend$1, prependee); }; var remove3 = function(component, replaceConfig, replaceState, removee) { var children2 = contents(component); var foundChild = find$5(children2, function(child2) { return eq2(removee.element, child2.element); }); foundChild.each(detach); }; var contents = function(component, _replaceConfig) { return component.components(); }; var replaceAt = function(component, replaceConfig, replaceState, replaceeIndex, replacer) { var children2 = contents(component); return Optional.from(children2[replaceeIndex]).map(function(replacee) { remove3(component, replaceConfig, replaceState, replacee); replacer.each(function(r3) { insert(component, replaceConfig, function(p, c2) { appendAt(p, c2, replaceeIndex); }, r3); }); return replacee; }); }; var replaceBy = function(component, replaceConfig, replaceState, replaceePred, replacer) { var children2 = contents(component); return findIndex$1(children2, replaceePred).bind(function(replaceeIndex) { return replaceAt(component, replaceConfig, replaceState, replaceeIndex, replacer); }); }; var ReplaceApis = /* @__PURE__ */ Object.freeze({ __proto__: null, append, prepend, remove: remove3, replaceAt, replaceBy, set: set$2, contents }); var Replacing = create$8({ fields: [], name: "replacing", apis: ReplaceApis }); var events$d = function(name2, eventHandlers) { var events2 = derive$2(eventHandlers); return create$8({ fields: [required$12("enabled")], name: name2, active: { events: constant$1(events2) } }); }; var config3 = function(name2, eventHandlers) { var me = events$d(name2, eventHandlers); return { key: name2, value: { config: {}, me, configAsRaw: constant$1({}), initialConfig: {}, state: NoState } }; }; var focus$2 = function(component, focusConfig) { if (!focusConfig.ignore) { focus$3(component.element); focusConfig.onFocus(component); } }; var blur22 = function(component, focusConfig) { if (!focusConfig.ignore) { blur$1(component.element); } }; var isFocused = function(component) { return hasFocus(component.element); }; var FocusApis = /* @__PURE__ */ Object.freeze({ __proto__: null, focus: focus$2, blur: blur22, isFocused }); var exhibit$4 = function(base2, focusConfig) { var mod2 = focusConfig.ignore ? {} : { attributes: { tabindex: "-1" } }; return nu$7(mod2); }; var events$c = function(focusConfig) { return derive$2([run$1(focus$4(), function(component, simulatedEvent) { focus$2(component, focusConfig); simulatedEvent.stop(); })].concat(focusConfig.stopMousedown ? [run$1(mousedown(), function(_2, simulatedEvent) { simulatedEvent.event.prevent(); })] : [])); }; var ActiveFocus = /* @__PURE__ */ Object.freeze({ __proto__: null, exhibit: exhibit$4, events: events$c }); var FocusSchema = [ onHandler("onFocus"), defaulted("stopMousedown", false), defaulted("ignore", false) ]; var Focusing = create$8({ fields: FocusSchema, name: "focusing", active: ActiveFocus, apis: FocusApis }); var SetupBehaviourCellState = function(initialState) { var init2 = function() { var cell = Cell3(initialState); var get3 = function() { return cell.get(); }; var set3 = function(newState) { return cell.set(newState); }; var clear3 = function() { return cell.set(initialState); }; var readState = function() { return cell.get(); }; return { get: get3, set: set3, clear: clear3, readState }; }; return { init: init2 }; }; var updateAriaState = function(component, toggleConfig, toggleState) { var ariaInfo = toggleConfig.aria; ariaInfo.update(component, ariaInfo, toggleState.get()); }; var updateClass = function(component, toggleConfig, toggleState) { toggleConfig.toggleClass.each(function(toggleClass) { if (toggleState.get()) { add$2(component.element, toggleClass); } else { remove$2(component.element, toggleClass); } }); }; var toggle$2 = function(component, toggleConfig, toggleState) { set$12(component, toggleConfig, toggleState, !toggleState.get()); }; var on2 = function(component, toggleConfig, toggleState) { toggleState.set(true); updateClass(component, toggleConfig, toggleState); updateAriaState(component, toggleConfig, toggleState); }; var off2 = function(component, toggleConfig, toggleState) { toggleState.set(false); updateClass(component, toggleConfig, toggleState); updateAriaState(component, toggleConfig, toggleState); }; var set$12 = function(component, toggleConfig, toggleState, state) { var action = state ? on2 : off2; action(component, toggleConfig, toggleState); }; var isOn3 = function(component, toggleConfig, toggleState) { return toggleState.get(); }; var onLoad3 = function(component, toggleConfig, toggleState) { set$12(component, toggleConfig, toggleState, toggleConfig.selected); }; var ToggleApis = /* @__PURE__ */ Object.freeze({ __proto__: null, onLoad: onLoad3, toggle: toggle$2, isOn: isOn3, on: on2, off: off2, set: set$12 }); var exhibit$3 = function() { return nu$7({}); }; var events$b = function(toggleConfig, toggleState) { var execute2 = executeEvent(toggleConfig, toggleState, toggle$2); var load = loadEvent(toggleConfig, toggleState, onLoad3); return derive$2(flatten2([ toggleConfig.toggleOnExecute ? [execute2] : [], [load] ])); }; var ActiveToggle = /* @__PURE__ */ Object.freeze({ __proto__: null, exhibit: exhibit$3, events: events$b }); var updatePressed = function(component, ariaInfo, status) { set$8(component.element, "aria-pressed", status); if (ariaInfo.syncWithExpanded) { updateExpanded(component, ariaInfo, status); } }; var updateSelected = function(component, ariaInfo, status) { set$8(component.element, "aria-selected", status); }; var updateChecked = function(component, ariaInfo, status) { set$8(component.element, "aria-checked", status); }; var updateExpanded = function(component, ariaInfo, status) { set$8(component.element, "aria-expanded", status); }; var ToggleSchema = [ defaulted("selected", false), option("toggleClass"), defaulted("toggleOnExecute", true), defaultedOf("aria", { mode: "none" }, choose$1("mode", { pressed: [ defaulted("syncWithExpanded", false), output$1("update", updatePressed) ], checked: [output$1("update", updateChecked)], expanded: [output$1("update", updateExpanded)], selected: [output$1("update", updateSelected)], none: [output$1("update", noop2)] })) ]; var Toggling = create$8({ fields: ToggleSchema, name: "toggling", active: ActiveToggle, apis: ToggleApis, state: SetupBehaviourCellState(false) }); var pointerEvents = function() { var onClick7 = function(component, simulatedEvent) { simulatedEvent.stop(); emitExecute(component); }; return [ run$1(click(), onClick7), run$1(tap(), onClick7), cutter(touchstart()), cutter(mousedown()) ]; }; var events$a = function(optAction) { var executeHandler = function(action) { return runOnExecute$1(function(component, simulatedEvent) { action(component); simulatedEvent.stop(); }); }; return derive$2(flatten2([ optAction.map(executeHandler).toArray(), pointerEvents() ])); }; var hoverEvent = "alloy.item-hover"; var focusEvent = "alloy.item-focus"; var onHover = function(item2) { if (search(item2.element).isNone() || Focusing.isFocused(item2)) { if (!Focusing.isFocused(item2)) { Focusing.focus(item2); } emitWith(item2, hoverEvent, { item: item2 }); } }; var onFocus$1 = function(item2) { emitWith(item2, focusEvent, { item: item2 }); }; var hover = constant$1(hoverEvent); var focus$1 = constant$1(focusEvent); var builder$2 = function(detail) { return { dom: detail.dom, domModification: __assign(__assign({}, detail.domModification), { attributes: __assign(__assign(__assign({ "role": detail.toggling.isSome() ? "menuitemcheckbox" : "menuitem" }, detail.domModification.attributes), { "aria-haspopup": detail.hasSubmenu }), detail.hasSubmenu ? { "aria-expanded": false } : {}) }), behaviours: SketchBehaviours.augment(detail.itemBehaviours, [ detail.toggling.fold(Toggling.revoke, function(tConfig) { return Toggling.config(__assign({ aria: { mode: "checked" } }, tConfig)); }), Focusing.config({ ignore: detail.ignoreFocus, stopMousedown: detail.ignoreFocus, onFocus: function(component) { onFocus$1(component); } }), Keying.config({ mode: "execution" }), Representing.config({ store: { mode: "memory", initialValue: detail.data } }), config3("item-type-events", __spreadArray(__spreadArray([], pointerEvents(), true), [ run$1(mouseover(), onHover), run$1(focusItem(), Focusing.focus) ], false)) ]), components: detail.components, eventOrder: detail.eventOrder }; }; var schema$p = [ required$12("data"), required$12("components"), required$12("dom"), defaulted("hasSubmenu", false), option("toggling"), SketchBehaviours.field("itemBehaviours", [ Toggling, Focusing, Keying, Representing ]), defaulted("ignoreFocus", false), defaulted("domModification", {}), output$1("builder", builder$2), defaulted("eventOrder", {}) ]; var builder$1 = function(detail) { return { dom: detail.dom, components: detail.components, events: derive$2([stopper(focusItem())]) }; }; var schema$o = [ required$12("dom"), required$12("components"), output$1("builder", builder$1) ]; var owner$2 = constant$1("item-widget"); var parts$h = constant$1([required2({ name: "widget", overrides: function(detail) { return { behaviours: derive$1([Representing.config({ store: { mode: "manual", getValue: function(_component) { return detail.data; }, setValue: noop2 } })]) }; } })]); var builder = function(detail) { var subs2 = substitutes(owner$2(), detail, parts$h()); var components4 = components$1(owner$2(), detail, subs2.internals()); var focusWidget = function(component) { return getPart(component, detail, "widget").map(function(widget) { Keying.focusIn(widget); return widget; }); }; var onHorizontalArrow = function(component, simulatedEvent) { return inside(simulatedEvent.event.target) ? Optional.none() : function() { if (detail.autofocus) { simulatedEvent.setSource(component.element); return Optional.none(); } else { return Optional.none(); } }(); }; return { dom: detail.dom, components: components4, domModification: detail.domModification, events: derive$2([ runOnExecute$1(function(component, simulatedEvent) { focusWidget(component).each(function(_widget) { simulatedEvent.stop(); }); }), run$1(mouseover(), onHover), run$1(focusItem(), function(component, _simulatedEvent) { if (detail.autofocus) { focusWidget(component); } else { Focusing.focus(component); } }) ]), behaviours: SketchBehaviours.augment(detail.widgetBehaviours, [ Representing.config({ store: { mode: "memory", initialValue: detail.data } }), Focusing.config({ ignore: detail.ignoreFocus, onFocus: function(component) { onFocus$1(component); } }), Keying.config({ mode: "special", focusIn: detail.autofocus ? function(component) { focusWidget(component); } : revoke(), onLeft: onHorizontalArrow, onRight: onHorizontalArrow, onEscape: function(component, simulatedEvent) { if (!Focusing.isFocused(component) && !detail.autofocus) { Focusing.focus(component); return Optional.some(true); } else if (detail.autofocus) { simulatedEvent.setSource(component.element); return Optional.none(); } else { return Optional.none(); } } }) ]) }; }; var schema$n = [ required$12("uid"), required$12("data"), required$12("components"), required$12("dom"), defaulted("autofocus", false), defaulted("ignoreFocus", false), SketchBehaviours.field("widgetBehaviours", [ Representing, Focusing, Keying ]), defaulted("domModification", {}), defaultUidsSchema(parts$h()), output$1("builder", builder) ]; var itemSchema$2 = choose$1("type", { widget: schema$n, item: schema$p, separator: schema$o }); var configureGrid = function(detail, movementInfo) { return { mode: "flatgrid", selector: "." + detail.markers.item, initSize: { numColumns: movementInfo.initSize.numColumns, numRows: movementInfo.initSize.numRows }, focusManager: detail.focusManager }; }; var configureMatrix = function(detail, movementInfo) { return { mode: "matrix", selectors: { row: movementInfo.rowSelector, cell: "." + detail.markers.item }, focusManager: detail.focusManager }; }; var configureMenu = function(detail, movementInfo) { return { mode: "menu", selector: "." + detail.markers.item, moveOnTab: movementInfo.moveOnTab, focusManager: detail.focusManager }; }; var parts$g = constant$1([group({ factory: { sketch: function(spec) { var itemInfo = asRawOrDie$1("menu.spec item", itemSchema$2, spec); return itemInfo.builder(itemInfo); } }, name: "items", unit: "item", defaults: function(detail, u2) { return has$22(u2, "uid") ? u2 : __assign(__assign({}, u2), { uid: generate$5("item") }); }, overrides: function(detail, u2) { return { type: u2.type, ignoreFocus: detail.fakeFocus, domModification: { classes: [detail.markers.item] } }; } })]); var schema$m = constant$1([ required$12("value"), required$12("items"), required$12("dom"), required$12("components"), defaulted("eventOrder", {}), field("menuBehaviours", [ Highlighting, Representing, Composing, Keying ]), defaultedOf("movement", { mode: "menu", moveOnTab: true }, choose$1("mode", { grid: [ initSize(), output$1("config", configureGrid) ], matrix: [ output$1("config", configureMatrix), required$12("rowSelector") ], menu: [ defaulted("moveOnTab", true), output$1("config", configureMenu) ] })), itemMarkers(), defaulted("fakeFocus", false), defaulted("focusManager", dom$2()), onHandler("onHighlight") ]); var focus25 = constant$1("alloy.menu-focus"); var make$7 = function(detail, components4, _spec, _externals) { return { uid: detail.uid, dom: detail.dom, markers: detail.markers, behaviours: augment(detail.menuBehaviours, [ Highlighting.config({ highlightClass: detail.markers.selectedItem, itemClass: detail.markers.item, onHighlight: detail.onHighlight }), Representing.config({ store: { mode: "memory", initialValue: detail.value } }), Composing.config({ find: Optional.some }), Keying.config(detail.movement.config(detail, detail.movement)) ]), events: derive$2([ run$1(focus$1(), function(menu2, simulatedEvent) { var event = simulatedEvent.event; menu2.getSystem().getByDom(event.target).each(function(item2) { Highlighting.highlight(menu2, item2); simulatedEvent.stop(); emitWith(menu2, focus25(), { menu: menu2, item: item2 }); }); }), run$1(hover(), function(menu2, simulatedEvent) { var item2 = simulatedEvent.event.item; Highlighting.highlight(menu2, item2); }) ]), components: components4, eventOrder: detail.eventOrder, domModification: { attributes: { role: "menu" } } }; }; var Menu2 = composite({ name: "Menu", configFields: schema$m(), partFields: parts$g(), factory: make$7 }); var transpose$1 = function(obj) { return tupleMap(obj, function(v2, k2) { return { k: v2, v: k2 }; }); }; var trace = function(items, byItem, byMenu, finish) { return get$e(byMenu, finish).bind(function(triggerItem) { return get$e(items, triggerItem).bind(function(triggerMenu) { var rest = trace(items, byItem, byMenu, triggerMenu); return Optional.some([triggerMenu].concat(rest)); }); }).getOr([]); }; var generate$22 = function(menus, expansions) { var items = {}; each2(menus, function(menuItems, menu2) { each$12(menuItems, function(item2) { items[item2] = menu2; }); }); var byItem = expansions; var byMenu = transpose$1(expansions); var menuPaths = map$1(byMenu, function(_triggerItem, submenu) { return [submenu].concat(trace(items, byItem, byMenu, submenu)); }); return map$1(items, function(menu2) { return get$e(menuPaths, menu2).getOr([menu2]); }); }; var init$c = function() { var expansions = Cell3({}); var menus = Cell3({}); var paths = Cell3({}); var primary = value$1(); var directory = Cell3({}); var clear3 = function() { expansions.set({}); menus.set({}); paths.set({}); primary.clear(); }; var isClear = function() { return primary.get().isNone(); }; var setMenuBuilt = function(menuName, built) { var _a4; menus.set(__assign(__assign({}, menus.get()), (_a4 = {}, _a4[menuName] = { type: "prepared", menu: built }, _a4))); }; var setContents = function(sPrimary, sMenus, sExpansions, dir) { primary.set(sPrimary); expansions.set(sExpansions); menus.set(sMenus); directory.set(dir); var sPaths = generate$22(dir, sExpansions); paths.set(sPaths); }; var getTriggeringItem = function(menuValue) { return find$4(expansions.get(), function(v2, _k) { return v2 === menuValue; }); }; var getTriggerData = function(menuValue, getItemByValue, path3) { return getPreparedMenu(menuValue).bind(function(menu2) { return getTriggeringItem(menuValue).bind(function(triggeringItemValue) { return getItemByValue(triggeringItemValue).map(function(triggeredItem) { return { triggeredMenu: menu2, triggeringItem: triggeredItem, triggeringPath: path3 }; }); }); }); }; var getTriggeringPath = function(itemValue, getItemByValue) { var extraPath = filter$2(lookupItem(itemValue).toArray(), function(menuValue) { return getPreparedMenu(menuValue).isSome(); }); return get$e(paths.get(), itemValue).bind(function(path3) { var revPath = reverse(extraPath.concat(path3)); var triggers = bind$32(revPath, function(menuValue, menuIndex) { return getTriggerData(menuValue, getItemByValue, revPath.slice(0, menuIndex + 1)).fold(function() { return is$1(primary.get(), menuValue) ? [] : [Optional.none()]; }, function(data65) { return [Optional.some(data65)]; }); }); return sequence(triggers); }); }; var expand2 = function(itemValue) { return get$e(expansions.get(), itemValue).map(function(menu2) { var current2 = get$e(paths.get(), itemValue).getOr([]); return [menu2].concat(current2); }); }; var collapse = function(itemValue) { return get$e(paths.get(), itemValue).bind(function(path3) { return path3.length > 1 ? Optional.some(path3.slice(1)) : Optional.none(); }); }; var refresh2 = function(itemValue) { return get$e(paths.get(), itemValue); }; var getPreparedMenu = function(menuValue) { return lookupMenu(menuValue).bind(extractPreparedMenu); }; var lookupMenu = function(menuValue) { return get$e(menus.get(), menuValue); }; var lookupItem = function(itemValue) { return get$e(expansions.get(), itemValue); }; var otherMenus = function(path3) { var menuValues = directory.get(); return difference(keys2(menuValues), path3); }; var getPrimary = function() { return primary.get().bind(getPreparedMenu); }; var getMenus2 = function() { return menus.get(); }; return { setMenuBuilt, setContents, expand: expand2, refresh: refresh2, collapse, lookupMenu, lookupItem, otherMenus, getPrimary, getMenus: getMenus2, clear: clear3, isClear, getTriggeringPath }; }; var extractPreparedMenu = function(prep) { return prep.type === "prepared" ? Optional.some(prep.menu) : Optional.none(); }; var LayeredState = { init: init$c, extractPreparedMenu }; var make$6 = function(detail, _rawUiSpec) { var submenuParentItems = value$1(); var buildMenus = function(container, primaryName, menus) { return map$1(menus, function(spec, name2) { var makeSketch = function() { return Menu2.sketch(__assign(__assign({}, spec), { value: name2, markers: detail.markers, fakeFocus: detail.fakeFocus, onHighlight: detail.onHighlight, focusManager: detail.fakeFocus ? highlights() : dom$2() })); }; return name2 === primaryName ? { type: "prepared", menu: container.getSystem().build(makeSketch()) } : { type: "notbuilt", nbMenu: makeSketch }; }); }; var layeredState = LayeredState.init(); var setup124 = function(container) { var componentMap2 = buildMenus(container, detail.data.primary, detail.data.menus); var directory = toDirectory(); layeredState.setContents(detail.data.primary, componentMap2, detail.data.expansions, directory); return layeredState.getPrimary(); }; var getItemValue = function(item2) { return Representing.getValue(item2).value; }; var getItemByValue = function(_container, menus, itemValue) { return findMap(menus, function(menu2) { if (!menu2.getSystem().isConnected()) { return Optional.none(); } var candidates = Highlighting.getCandidates(menu2); return find$5(candidates, function(c2) { return getItemValue(c2) === itemValue; }); }); }; var toDirectory = function(_container) { return map$1(detail.data.menus, function(data65, _menuName) { return bind$32(data65.items, function(item2) { return item2.type === "separator" ? [] : [item2.data.value]; }); }); }; var setActiveMenu = function(container, menu2) { Highlighting.highlight(container, menu2); Highlighting.getHighlighted(menu2).orThunk(function() { return Highlighting.getFirst(menu2); }).each(function(item2) { dispatch2(container, item2.element, focusItem()); }); }; var getMenus2 = function(state, menuValues) { return cat(map$2(menuValues, function(mv) { return state.lookupMenu(mv).bind(function(prep) { return prep.type === "prepared" ? Optional.some(prep.menu) : Optional.none(); }); })); }; var closeOthers = function(container, state, path3) { var others = getMenus2(state, state.otherMenus(path3)); each$12(others, function(o2) { remove$1(o2.element, [detail.markers.backgroundMenu]); if (!detail.stayInDom) { Replacing.remove(container, o2); } }); }; var getSubmenuParents = function(container) { return submenuParentItems.get().getOrThunk(function() { var r3 = {}; var items = descendants(container.element, "." + detail.markers.item); var parentItems = filter$2(items, function(i2) { return get$d(i2, "aria-haspopup") === "true"; }); each$12(parentItems, function(i2) { container.getSystem().getByDom(i2).each(function(itemComp) { var key2 = getItemValue(itemComp); r3[key2] = itemComp; }); }); submenuParentItems.set(r3); return r3; }); }; var updateAriaExpansions = function(container, path3) { var parentItems = getSubmenuParents(container); each2(parentItems, function(v2, k2) { var expanded = contains$2(path3, k2); set$8(v2.element, "aria-expanded", expanded); }); }; var updateMenuPath = function(container, state, path3) { return Optional.from(path3[0]).bind(function(latestMenuName) { return state.lookupMenu(latestMenuName).bind(function(menuPrep) { if (menuPrep.type === "notbuilt") { return Optional.none(); } else { var activeMenu = menuPrep.menu; var rest = getMenus2(state, path3.slice(1)); each$12(rest, function(r3) { add$2(r3.element, detail.markers.backgroundMenu); }); if (!inBody(activeMenu.element)) { Replacing.append(container, premade(activeMenu)); } remove$1(activeMenu.element, [detail.markers.backgroundMenu]); setActiveMenu(container, activeMenu); closeOthers(container, state, path3); return Optional.some(activeMenu); } }); }); }; var ExpandHighlightDecision; (function(ExpandHighlightDecision2) { ExpandHighlightDecision2[ExpandHighlightDecision2["HighlightSubmenu"] = 0] = "HighlightSubmenu"; ExpandHighlightDecision2[ExpandHighlightDecision2["HighlightParent"] = 1] = "HighlightParent"; })(ExpandHighlightDecision || (ExpandHighlightDecision = {})); var buildIfRequired = function(container, menuName, menuPrep) { if (menuPrep.type === "notbuilt") { var menu2 = container.getSystem().build(menuPrep.nbMenu()); layeredState.setMenuBuilt(menuName, menu2); return menu2; } else { return menuPrep.menu; } }; var expandRight = function(container, item2, decision) { if (decision === void 0) { decision = ExpandHighlightDecision.HighlightSubmenu; } if (item2.hasConfigured(Disabling) && Disabling.isDisabled(item2)) { return Optional.some(item2); } else { var value25 = getItemValue(item2); return layeredState.expand(value25).bind(function(path3) { updateAriaExpansions(container, path3); return Optional.from(path3[0]).bind(function(menuName) { return layeredState.lookupMenu(menuName).bind(function(activeMenuPrep) { var activeMenu = buildIfRequired(container, menuName, activeMenuPrep); if (!inBody(activeMenu.element)) { Replacing.append(container, premade(activeMenu)); } detail.onOpenSubmenu(container, item2, activeMenu, reverse(path3)); if (decision === ExpandHighlightDecision.HighlightSubmenu) { Highlighting.highlightFirst(activeMenu); return updateMenuPath(container, layeredState, path3); } else { Highlighting.dehighlightAll(activeMenu); return Optional.some(item2); } }); }); }); } }; var collapseLeft = function(container, item2) { var value25 = getItemValue(item2); return layeredState.collapse(value25).bind(function(path3) { updateAriaExpansions(container, path3); return updateMenuPath(container, layeredState, path3).map(function(activeMenu) { detail.onCollapseMenu(container, item2, activeMenu); return activeMenu; }); }); }; var updateView = function(container, item2) { var value25 = getItemValue(item2); return layeredState.refresh(value25).bind(function(path3) { updateAriaExpansions(container, path3); return updateMenuPath(container, layeredState, path3); }); }; var onRight2 = function(container, item2) { return inside(item2.element) ? Optional.none() : expandRight(container, item2, ExpandHighlightDecision.HighlightSubmenu); }; var onLeft2 = function(container, item2) { return inside(item2.element) ? Optional.none() : collapseLeft(container, item2); }; var onEscape = function(container, item2) { return collapseLeft(container, item2).orThunk(function() { return detail.onEscape(container, item2).map(function() { return container; }); }); }; var keyOnItem = function(f2) { return function(container, simulatedEvent) { return closest$1(simulatedEvent.getSource(), "." + detail.markers.item).bind(function(target) { return container.getSystem().getByDom(target).toOptional().bind(function(item2) { return f2(container, item2).map(always); }); }); }; }; var events2 = derive$2([ run$1(focus25(), function(sandbox, simulatedEvent) { var item2 = simulatedEvent.event.item; layeredState.lookupItem(getItemValue(item2)).each(function() { var menu2 = simulatedEvent.event.menu; Highlighting.highlight(sandbox, menu2); var value25 = getItemValue(simulatedEvent.event.item); layeredState.refresh(value25).each(function(path3) { return closeOthers(sandbox, layeredState, path3); }); }); }), runOnExecute$1(function(component, simulatedEvent) { var target = simulatedEvent.event.target; component.getSystem().getByDom(target).each(function(item2) { var itemValue = getItemValue(item2); if (itemValue.indexOf("collapse-item") === 0) { collapseLeft(component, item2); } expandRight(component, item2, ExpandHighlightDecision.HighlightSubmenu).fold(function() { detail.onExecute(component, item2); }, noop2); }); }), runOnAttached(function(container, _simulatedEvent) { setup124(container).each(function(primary) { Replacing.append(container, premade(primary)); detail.onOpenMenu(container, primary); if (detail.highlightImmediately) { setActiveMenu(container, primary); } }); }) ].concat(detail.navigateOnHover ? [run$1(hover(), function(sandbox, simulatedEvent) { var item2 = simulatedEvent.event.item; updateView(sandbox, item2); expandRight(sandbox, item2, ExpandHighlightDecision.HighlightParent); detail.onHover(sandbox, item2); })] : [])); var getActiveItem = function(container) { return Highlighting.getHighlighted(container).bind(Highlighting.getHighlighted); }; var collapseMenuApi = function(container) { getActiveItem(container).each(function(currentItem) { collapseLeft(container, currentItem); }); }; var highlightPrimary = function(container) { layeredState.getPrimary().each(function(primary) { setActiveMenu(container, primary); }); }; var extractMenuFromContainer = function(container) { return Optional.from(container.components()[0]).filter(function(comp) { return get$d(comp.element, "role") === "menu"; }); }; var repositionMenus2 = function(container) { var maybeActivePrimary = layeredState.getPrimary().bind(function(primary) { return getActiveItem(container).bind(function(currentItem) { var itemValue = getItemValue(currentItem); var allMenus = values2(layeredState.getMenus()); var preparedMenus = cat(map$2(allMenus, LayeredState.extractPreparedMenu)); return layeredState.getTriggeringPath(itemValue, function(v2) { return getItemByValue(container, preparedMenus, v2); }); }).map(function(triggeringPath) { return { primary, triggeringPath }; }); }); maybeActivePrimary.fold(function() { extractMenuFromContainer(container).each(function(primaryMenu) { detail.onRepositionMenu(container, primaryMenu, []); }); }, function(_a4) { var primary = _a4.primary, triggeringPath = _a4.triggeringPath; detail.onRepositionMenu(container, primary, triggeringPath); }); }; var apis = { collapseMenu: collapseMenuApi, highlightPrimary, repositionMenus: repositionMenus2 }; return { uid: detail.uid, dom: detail.dom, markers: detail.markers, behaviours: augment(detail.tmenuBehaviours, [ Keying.config({ mode: "special", onRight: keyOnItem(onRight2), onLeft: keyOnItem(onLeft2), onEscape: keyOnItem(onEscape), focusIn: function(container, _keyInfo) { layeredState.getPrimary().each(function(primary) { dispatch2(container, primary.element, focusItem()); }); } }), Highlighting.config({ highlightClass: detail.markers.selectedMenu, itemClass: detail.markers.menu }), Composing.config({ find: function(container) { return Highlighting.getHighlighted(container); } }), Replacing.config({}) ]), eventOrder: detail.eventOrder, apis, events: events2 }; }; var collapseItem$1 = constant$1("collapse-item"); var tieredData = function(primary, menus, expansions) { return { primary, menus, expansions }; }; var singleData = function(name2, menu2) { return { primary: name2, menus: wrap$1(name2, menu2), expansions: {} }; }; var collapseItem = function(text2) { return { value: generate$6(collapseItem$1()), meta: { text: text2 } }; }; var tieredMenu = single({ name: "TieredMenu", configFields: [ onStrictKeyboardHandler("onExecute"), onStrictKeyboardHandler("onEscape"), onStrictHandler("onOpenMenu"), onStrictHandler("onOpenSubmenu"), onHandler("onRepositionMenu"), onHandler("onCollapseMenu"), defaulted("highlightImmediately", true), requiredObjOf("data", [ required$12("primary"), required$12("menus"), required$12("expansions") ]), defaulted("fakeFocus", false), onHandler("onHighlight"), onHandler("onHover"), tieredMenuMarkers(), required$12("dom"), defaulted("navigateOnHover", true), defaulted("stayInDom", false), field("tmenuBehaviours", [ Keying, Highlighting, Composing, Replacing ]), defaulted("eventOrder", {}) ], apis: { collapseMenu: function(apis, tmenu) { apis.collapseMenu(tmenu); }, highlightPrimary: function(apis, tmenu) { apis.highlightPrimary(tmenu); }, repositionMenus: function(apis, tmenu) { apis.repositionMenus(tmenu); } }, factory: make$6, extraApis: { tieredData, singleData, collapseItem } }); var makeMenu = function(detail, menuSandbox, placementSpec, menuSpec, getBounds2) { var lazySink = function() { return detail.lazySink(menuSandbox); }; var layouts2 = menuSpec.type === "horizontal" ? { layouts: { onLtr: function() { return belowOrAbove(); }, onRtl: function() { return belowOrAboveRtl(); } } } : {}; var isFirstTierSubmenu = function(triggeringPaths) { return triggeringPaths.length === 2; }; var getSubmenuLayouts = function(triggeringPaths) { return isFirstTierSubmenu(triggeringPaths) ? layouts2 : {}; }; return tieredMenu.sketch({ dom: { tag: "div" }, data: menuSpec.data, markers: menuSpec.menu.markers, highlightImmediately: menuSpec.menu.highlightImmediately, onEscape: function() { Sandboxing.close(menuSandbox); detail.onEscape.map(function(handler7) { return handler7(menuSandbox); }); return Optional.some(true); }, onExecute: function() { return Optional.some(true); }, onOpenMenu: function(tmenu, menu2) { Positioning.positionWithinBounds(lazySink().getOrDie(), menu2, placementSpec, getBounds2()); }, onOpenSubmenu: function(tmenu, item2, submenu, triggeringPaths) { var sink = lazySink().getOrDie(); Positioning.position(sink, submenu, { anchor: __assign({ type: "submenu", item: item2 }, getSubmenuLayouts(triggeringPaths)) }); }, onRepositionMenu: function(tmenu, primaryMenu, submenuTriggers) { var sink = lazySink().getOrDie(); Positioning.positionWithinBounds(sink, primaryMenu, placementSpec, getBounds2()); each$12(submenuTriggers, function(st) { var submenuLayouts = getSubmenuLayouts(st.triggeringPath); Positioning.position(sink, st.triggeredMenu, { anchor: __assign({ type: "submenu", item: st.triggeringItem }, submenuLayouts) }); }); } }); }; var factory$m = function(detail, spec) { var isPartOfRelated = function(sandbox, queryElem) { var related = detail.getRelated(sandbox); return related.exists(function(rel) { return isPartOf$1(rel, queryElem); }); }; var setContent2 = function(sandbox, thing) { Sandboxing.setContent(sandbox, thing); }; var showAt = function(sandbox, thing, placementSpec) { showWithin(sandbox, thing, placementSpec, Optional.none()); }; var showWithin = function(sandbox, thing, placementSpec, boxElement) { showWithinBounds(sandbox, thing, placementSpec, function() { return boxElement.map(function(elem) { return box$1(elem); }); }); }; var showWithinBounds = function(sandbox, thing, placementSpec, getBounds2) { var sink = detail.lazySink(sandbox).getOrDie(); Sandboxing.openWhileCloaked(sandbox, thing, function() { return Positioning.positionWithinBounds(sink, sandbox, placementSpec, getBounds2()); }); Representing.setValue(sandbox, Optional.some({ mode: "position", config: placementSpec, getBounds: getBounds2 })); }; var showMenuAt = function(sandbox, placementSpec, menuSpec) { showMenuWithinBounds(sandbox, placementSpec, menuSpec, Optional.none); }; var showMenuWithinBounds = function(sandbox, placementSpec, menuSpec, getBounds2) { var menu2 = makeMenu(detail, sandbox, placementSpec, menuSpec, getBounds2); Sandboxing.open(sandbox, menu2); Representing.setValue(sandbox, Optional.some({ mode: "menu", menu: menu2 })); }; var hide = function(sandbox) { if (Sandboxing.isOpen(sandbox)) { Representing.setValue(sandbox, Optional.none()); Sandboxing.close(sandbox); } }; var getContent = function(sandbox) { return Sandboxing.getState(sandbox); }; var reposition2 = function(sandbox) { if (Sandboxing.isOpen(sandbox)) { Representing.getValue(sandbox).each(function(state) { switch (state.mode) { case "menu": Sandboxing.getState(sandbox).each(tieredMenu.repositionMenus); break; case "position": var sink = detail.lazySink(sandbox).getOrDie(); Positioning.positionWithinBounds(sink, sandbox, state.config, state.getBounds()); break; } }); } }; var apis = { setContent: setContent2, showAt, showWithin, showWithinBounds, showMenuAt, showMenuWithinBounds, hide, getContent, reposition: reposition2, isOpen: Sandboxing.isOpen }; return { uid: detail.uid, dom: detail.dom, behaviours: augment(detail.inlineBehaviours, [ Sandboxing.config({ isPartOf: function(sandbox, data65, queryElem) { return isPartOf$1(data65, queryElem) || isPartOfRelated(sandbox, queryElem); }, getAttachPoint: function(sandbox) { return detail.lazySink(sandbox).getOrDie(); }, onOpen: function(sandbox) { detail.onShow(sandbox); }, onClose: function(sandbox) { detail.onHide(sandbox); } }), Representing.config({ store: { mode: "memory", initialValue: Optional.none() } }), Receiving.config({ channels: __assign(__assign({}, receivingChannel$1(__assign({ isExtraPart: spec.isExtraPart }, detail.fireDismissalEventInstead.map(function(fe) { return { fireEventInstead: { event: fe.event } }; }).getOr({})))), receivingChannel(__assign(__assign({}, detail.fireRepositionEventInstead.map(function(fe) { return { fireEventInstead: { event: fe.event } }; }).getOr({})), { doReposition: reposition2 }))) }) ]), eventOrder: detail.eventOrder, apis }; }; var InlineView = single({ name: "InlineView", configFields: [ required$12("lazySink"), onHandler("onShow"), onHandler("onHide"), optionFunction("onEscape"), field("inlineBehaviours", [ Sandboxing, Representing, Receiving ]), optionObjOf("fireDismissalEventInstead", [defaulted("event", dismissRequested())]), optionObjOf("fireRepositionEventInstead", [defaulted("event", repositionRequested())]), defaulted("getRelated", Optional.none), defaulted("isExtraPart", never), defaulted("eventOrder", Optional.none) ], factory: factory$m, apis: { showAt: function(apis, component, anchor2, thing) { apis.showAt(component, anchor2, thing); }, showWithin: function(apis, component, anchor2, thing, boxElement) { apis.showWithin(component, anchor2, thing, boxElement); }, showWithinBounds: function(apis, component, anchor2, thing, bounds2) { apis.showWithinBounds(component, anchor2, thing, bounds2); }, showMenuAt: function(apis, component, anchor2, menuSpec) { apis.showMenuAt(component, anchor2, menuSpec); }, showMenuWithinBounds: function(apis, component, anchor2, menuSpec, bounds2) { apis.showMenuWithinBounds(component, anchor2, menuSpec, bounds2); }, hide: function(apis, component) { apis.hide(component); }, isOpen: function(apis, component) { return apis.isOpen(component); }, getContent: function(apis, component) { return apis.getContent(component); }, setContent: function(apis, component, thing) { apis.setContent(component, thing); }, reposition: function(apis, component) { apis.reposition(component); } } }); var labelPrefix = "layout-inset"; var westEdgeX = function(anchor2) { return anchor2.x; }; var middleX = function(anchor2, element2) { return anchor2.x + anchor2.width / 2 - element2.width / 2; }; var eastEdgeX = function(anchor2, element2) { return anchor2.x + anchor2.width - element2.width; }; var northY = function(anchor2) { return anchor2.y; }; var southY = function(anchor2, element2) { return anchor2.y + anchor2.height - element2.height; }; var centreY = function(anchor2, element2) { return anchor2.y + anchor2.height / 2 - element2.height / 2; }; var southwest = function(anchor2, element2, bubbles) { return nu$6(eastEdgeX(anchor2, element2), southY(anchor2, element2), bubbles.insetSouthwest(), northwest$3(), "southwest", boundsRestriction(anchor2, { right: 0, bottom: 3 }), labelPrefix); }; var southeast = function(anchor2, element2, bubbles) { return nu$6(westEdgeX(anchor2), southY(anchor2, element2), bubbles.insetSoutheast(), northeast$3(), "southeast", boundsRestriction(anchor2, { left: 1, bottom: 3 }), labelPrefix); }; var northwest = function(anchor2, element2, bubbles) { return nu$6(eastEdgeX(anchor2, element2), northY(anchor2), bubbles.insetNorthwest(), southwest$3(), "northwest", boundsRestriction(anchor2, { right: 0, top: 2 }), labelPrefix); }; var northeast = function(anchor2, element2, bubbles) { return nu$6(westEdgeX(anchor2), northY(anchor2), bubbles.insetNortheast(), southeast$3(), "northeast", boundsRestriction(anchor2, { left: 1, top: 2 }), labelPrefix); }; var north = function(anchor2, element2, bubbles) { return nu$6(middleX(anchor2, element2), northY(anchor2), bubbles.insetNorth(), south$3(), "north", boundsRestriction(anchor2, { top: 2 }), labelPrefix); }; var south = function(anchor2, element2, bubbles) { return nu$6(middleX(anchor2, element2), southY(anchor2, element2), bubbles.insetSouth(), north$3(), "south", boundsRestriction(anchor2, { bottom: 3 }), labelPrefix); }; var east = function(anchor2, element2, bubbles) { return nu$6(eastEdgeX(anchor2, element2), centreY(anchor2, element2), bubbles.insetEast(), west$3(), "east", boundsRestriction(anchor2, { right: 0 }), labelPrefix); }; var west = function(anchor2, element2, bubbles) { return nu$6(westEdgeX(anchor2), centreY(anchor2, element2), bubbles.insetWest(), east$3(), "west", boundsRestriction(anchor2, { left: 1 }), labelPrefix); }; var lookupPreserveLayout = function(lastPlacement) { switch (lastPlacement) { case "north": return north; case "northeast": return northeast; case "northwest": return northwest; case "south": return south; case "southeast": return southeast; case "southwest": return southwest; case "east": return east; case "west": return west; } }; var preserve = function(anchor2, element2, bubbles, placee, bounds2) { var layout2 = getPlacement(placee).map(lookupPreserveLayout).getOr(north); return layout2(anchor2, element2, bubbles, placee, bounds2); }; var lookupFlippedLayout = function(lastPlacement) { switch (lastPlacement) { case "north": return south; case "northeast": return southeast; case "northwest": return southwest; case "south": return north; case "southeast": return northeast; case "southwest": return northwest; case "east": return west; case "west": return east; } }; var flip$2 = function(anchor2, element2, bubbles, placee, bounds2) { var layout2 = getPlacement(placee).map(lookupFlippedLayout).getOr(north); return layout2(anchor2, element2, bubbles, placee, bounds2); }; var global$f = tinymce.util.Tools.resolve("tinymce.util.Delay"); var factory$l = function(detail) { var events2 = events$a(detail.action); var tag = detail.dom.tag; var lookupAttr = function(attr) { return get$e(detail.dom, "attributes").bind(function(attrs) { return get$e(attrs, attr); }); }; var getModAttributes = function() { if (tag === "button") { var type3 = lookupAttr("type").getOr("button"); var roleAttrs = lookupAttr("role").map(function(role2) { return { role: role2 }; }).getOr({}); return __assign({ type: type3 }, roleAttrs); } else { var role = lookupAttr("role").getOr("button"); return { role }; } }; return { uid: detail.uid, dom: detail.dom, components: detail.components, events: events2, behaviours: SketchBehaviours.augment(detail.buttonBehaviours, [ Focusing.config({}), Keying.config({ mode: "execution", useSpace: true, useEnter: true }) ]), domModification: { attributes: getModAttributes() }, eventOrder: detail.eventOrder }; }; var Button2 = single({ name: "Button", factory: factory$l, configFields: [ defaulted("uid", void 0), required$12("dom"), defaulted("components", []), SketchBehaviours.field("buttonBehaviours", [ Focusing, Keying ]), option("action"), option("role"), defaulted("eventOrder", {}) ] }); var record = function(spec) { var uid2 = isSketchSpec(spec) && hasNonNullableKey(spec, "uid") ? spec.uid : generate$5("memento"); var get3 = function(anyInSystem) { return anyInSystem.getSystem().getByUid(uid2).getOrDie(); }; var getOpt2 = function(anyInSystem) { return anyInSystem.getSystem().getByUid(uid2).toOptional(); }; var asSpec = function() { return __assign(__assign({}, spec), { uid: uid2 }); }; return { get: get3, getOpt: getOpt2, asSpec }; }; var global$e = tinymce.util.Tools.resolve("tinymce.util.I18n"); var rtlTransform = { "indent": true, "outdent": true, "table-insert-column-after": true, "table-insert-column-before": true, "paste-column-after": true, "paste-column-before": true, "unordered-list": true, "list-bull-circle": true, "list-bull-default": true, "list-bull-square": true }; var defaultIconName = "temporary-placeholder"; var defaultIcon = function(icons) { return function() { return get$e(icons, defaultIconName).getOr("!not found!"); }; }; var getIconName = function(name2, icons) { var lcName = name2.toLowerCase(); if (global$e.isRtl()) { var rtlName = ensureTrailing(lcName, "-rtl"); return has$22(icons, rtlName) ? rtlName : lcName; } else { return lcName; } }; var lookupIcon = function(name2, icons) { return get$e(icons, getIconName(name2, icons)); }; var get$12 = function(name2, iconProvider) { var icons = iconProvider(); return lookupIcon(name2, icons).getOrThunk(defaultIcon(icons)); }; var getOr = function(name2, iconProvider, fallbackIcon) { var icons = iconProvider(); return lookupIcon(name2, icons).or(fallbackIcon).getOrThunk(defaultIcon(icons)); }; var needsRtlTransform = function(iconName) { return global$e.isRtl() ? has$22(rtlTransform, iconName) : false; }; var addFocusableBehaviour = function() { return config3("add-focusable", [runOnAttached(function(comp) { child(comp.element, "svg").each(function(svg2) { return set$8(svg2, "focusable", "false"); }); })]); }; var renderIcon$2 = function(spec, iconName, icons, fallbackIcon) { var _a4, _b2; var rtlIconClasses = needsRtlTransform(iconName) ? ["tox-icon--flip"] : []; var iconHtml = get$e(icons, getIconName(iconName, icons)).or(fallbackIcon).getOrThunk(defaultIcon(icons)); return { dom: { tag: spec.tag, attributes: (_a4 = spec.attributes) !== null && _a4 !== void 0 ? _a4 : {}, classes: spec.classes.concat(rtlIconClasses), innerHtml: iconHtml }, behaviours: derive$1(__spreadArray(__spreadArray([], (_b2 = spec.behaviours) !== null && _b2 !== void 0 ? _b2 : [], true), [addFocusableBehaviour()], false)) }; }; var render$3 = function(iconName, spec, iconProvider, fallbackIcon) { if (fallbackIcon === void 0) { fallbackIcon = Optional.none(); } return renderIcon$2(spec, iconName, iconProvider(), fallbackIcon); }; var renderFirst = function(iconNames, spec, iconProvider) { var icons = iconProvider(); var iconName = find$5(iconNames, function(name2) { return has$22(icons, getIconName(name2, icons)); }); return renderIcon$2(spec, iconName.getOr(defaultIconName), icons, Optional.none()); }; var notificationIconMap = { success: "checkmark", error: "warning", err: "error", warning: "warning", warn: "warning", info: "info" }; var factory$k = function(detail) { var memBannerText = record({ dom: { tag: "p", innerHtml: detail.translationProvider(detail.text) }, behaviours: derive$1([Replacing.config({})]) }); var renderPercentBar = function(percent) { return { dom: { tag: "div", classes: ["tox-bar"], attributes: { style: "width: " + percent + "%" } } }; }; var renderPercentText = function(percent) { return { dom: { tag: "div", classes: ["tox-text"], innerHtml: percent + "%" } }; }; var memBannerProgress = record({ dom: { tag: "div", classes: detail.progress ? [ "tox-progress-bar", "tox-progress-indicator" ] : ["tox-progress-bar"] }, components: [ { dom: { tag: "div", classes: ["tox-bar-container"] }, components: [renderPercentBar(0)] }, renderPercentText(0) ], behaviours: derive$1([Replacing.config({})]) }); var updateProgress = function(comp, percent) { if (comp.getSystem().isConnected()) { memBannerProgress.getOpt(comp).each(function(progress) { Replacing.set(progress, [ { dom: { tag: "div", classes: ["tox-bar-container"] }, components: [renderPercentBar(percent)] }, renderPercentText(percent) ]); }); } }; var updateText = function(comp, text2) { if (comp.getSystem().isConnected()) { var banner = memBannerText.get(comp); Replacing.set(banner, [text$1(text2)]); } }; var apis = { updateProgress, updateText }; var iconChoices = flatten2([ detail.icon.toArray(), detail.level.toArray(), detail.level.bind(function(level2) { return Optional.from(notificationIconMap[level2]); }).toArray() ]); var memButton = record(Button2.sketch({ dom: { tag: "button", classes: [ "tox-notification__dismiss", "tox-button", "tox-button--naked", "tox-button--icon" ] }, components: [render$3("close", { tag: "div", classes: ["tox-icon"], attributes: { "aria-label": detail.translationProvider("Close") } }, detail.iconProvider)], action: function(comp) { detail.onAction(comp); } })); var notificationIconSpec = renderFirst(iconChoices, { tag: "div", classes: ["tox-notification__icon"] }, detail.iconProvider); var notificationBodySpec = { dom: { tag: "div", classes: ["tox-notification__body"] }, components: [memBannerText.asSpec()], behaviours: derive$1([Replacing.config({})]) }; var components4 = [ notificationIconSpec, notificationBodySpec ]; return { uid: detail.uid, dom: { tag: "div", attributes: { role: "alert" }, classes: detail.level.map(function(level2) { return [ "tox-notification", "tox-notification--in", "tox-notification--" + level2 ]; }).getOr([ "tox-notification", "tox-notification--in" ]) }, behaviours: derive$1([ Focusing.config({}), config3("notification-events", [run$1(focusin(), function(comp) { memButton.getOpt(comp).each(Focusing.focus); })]) ]), components: components4.concat(detail.progress ? [memBannerProgress.asSpec()] : []).concat(!detail.closeButton ? [] : [memButton.asSpec()]), apis }; }; var Notification2 = single({ name: "Notification", factory: factory$k, configFields: [ option("level"), required$12("progress"), required$12("icon"), required$12("onAction"), required$12("text"), required$12("iconProvider"), required$12("translationProvider"), defaultedBoolean("closeButton", true) ], apis: { updateProgress: function(apis, comp, percent) { apis.updateProgress(comp, percent); }, updateText: function(apis, comp, text2) { apis.updateText(comp, text2); } } }); function NotificationManagerImpl(editor, extras, uiMothership) { var sharedBackstage = extras.backstage.shared; var getLayoutDirection = function(rel) { switch (rel) { case "bc-bc": return south; case "tc-tc": return north; case "tc-bc": return north$2; case "bc-tc": default: return south$2; } }; var reposition2 = function(notifications) { if (notifications.length > 0) { each$12(notifications, function(notification2, index2) { if (index2 === 0) { notification2.moveRel(null, "banner"); } else { notification2.moveRel(notifications[index2 - 1].getEl(), "bc-tc"); } }); } }; var open7 = function(settings, closeCallback) { var hideCloseButton = !settings.closeButton && settings.timeout && (settings.timeout > 0 || settings.timeout < 0); var close9 = function() { closeCallback(); InlineView.hide(notificationWrapper); }; var notification2 = build$1(Notification2.sketch({ text: settings.text, level: contains$2([ "success", "error", "warning", "warn", "info" ], settings.type) ? settings.type : void 0, progress: settings.progressBar === true, icon: Optional.from(settings.icon), closeButton: !hideCloseButton, onAction: close9, iconProvider: sharedBackstage.providers.icons, translationProvider: sharedBackstage.providers.translate })); var notificationWrapper = build$1(InlineView.sketch(__assign({ dom: { tag: "div", classes: ["tox-notifications-container"] }, lazySink: sharedBackstage.getSink, fireDismissalEventInstead: {} }, sharedBackstage.header.isPositionedAtTop() ? {} : { fireRepositionEventInstead: {} }))); uiMothership.add(notificationWrapper); if (settings.timeout > 0) { global$f.setTimeout(function() { close9(); }, settings.timeout); } var getBounds2 = function() { var contentArea = box$1(SugarElement.fromDom(editor.getContentAreaContainer())); var win$1 = win(); var x2 = clamp$1(win$1.x, contentArea.x, contentArea.right); var y2 = clamp$1(win$1.y, contentArea.y, contentArea.bottom); var right2 = Math.max(contentArea.right, win$1.right); var bottom2 = Math.max(contentArea.bottom, win$1.bottom); return Optional.some(bounds(x2, y2, right2 - x2, bottom2 - y2)); }; return { close: close9, moveTo: function(x2, y2) { InlineView.showAt(notificationWrapper, premade(notification2), { anchor: { type: "makeshift", x: x2, y: y2 } }); }, moveRel: function(element2, rel) { var notificationSpec = premade(notification2); var anchorOverrides2 = { maxHeightFunction: expandable$1() }; if (rel !== "banner" && isNonNullable(element2)) { var layoutDirection_1 = getLayoutDirection(rel); var nodeAnchor = { type: "node", root: body(), node: Optional.some(SugarElement.fromDom(element2)), overrides: anchorOverrides2, layouts: { onRtl: function() { return [layoutDirection_1]; }, onLtr: function() { return [layoutDirection_1]; } } }; InlineView.showWithinBounds(notificationWrapper, notificationSpec, { anchor: nodeAnchor }, getBounds2); } else { var anchor2 = __assign(__assign({}, sharedBackstage.anchors.banner()), { overrides: anchorOverrides2 }); InlineView.showWithinBounds(notificationWrapper, notificationSpec, { anchor: anchor2 }, getBounds2); } }, text: function(nuText) { Notification2.updateText(notification2, nuText); }, settings, getEl: function() { return notification2.element.dom; }, progressBar: { value: function(percent) { Notification2.updateProgress(notification2, percent); } } }; }; var close8 = function(notification2) { notification2.close(); }; var getArgs = function(notification2) { return notification2.settings; }; return { open: open7, close: close8, reposition: reposition2, getArgs }; } var first = function(fn, rate) { var timer = null; var cancel2 = function() { if (!isNull2(timer)) { clearTimeout(timer); timer = null; } }; var throttle3 = function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (isNull2(timer)) { timer = setTimeout(function() { timer = null; fn.apply(null, args); }, rate); } }; return { cancel: cancel2, throttle: throttle3 }; }; var last2 = function(fn, rate) { var timer = null; var cancel2 = function() { if (!isNull2(timer)) { clearTimeout(timer); timer = null; } }; var throttle3 = function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } cancel2(); timer = setTimeout(function() { timer = null; fn.apply(null, args); }, rate); }; return { cancel: cancel2, throttle: throttle3 }; }; var global$d = tinymce.util.Tools.resolve("tinymce.dom.TextSeeker"); var isBoundary = function(dom2, node) { return dom2.isBlock(node) || contains$2([ "BR", "IMG", "HR", "INPUT" ], node.nodeName) || dom2.getContentEditable(node) === "false"; }; var repeatLeft = function(dom2, node, offset5, process3, rootNode) { var search2 = global$d(dom2, function(node2) { return isBoundary(dom2, node2); }); return Optional.from(search2.backwards(node, offset5, process3, rootNode)); }; var autocompleteSelector = "[data-mce-autocompleter]"; var create$5 = function(editor, range3) { return detect(SugarElement.fromDom(editor.selection.getNode())).getOrThunk(function() { var wrapper = SugarElement.fromHtml('', editor.getDoc()); append$2(wrapper, SugarElement.fromDom(range3.extractContents())); range3.insertNode(wrapper.dom); parent2(wrapper).each(function(elm) { return elm.dom.normalize(); }); last$1(wrapper).map(function(last3) { editor.selection.setCursorLocation(last3.dom, getEnd(last3)); }); return wrapper; }); }; var detect = function(elm) { return closest$1(elm, autocompleteSelector); }; var isValidTextRange = function(rng) { return rng.collapsed && rng.startContainer.nodeType === 3; }; var getText = function(rng) { return rng.toString().replace(/\u00A0/g, " ").replace(/\uFEFF/g, ""); }; var isWhitespace = function(chr) { return chr !== "" && " \xA0\f\n\r \v".indexOf(chr) !== -1; }; var stripTriggerChar = function(text2, triggerCh) { return text2.substring(triggerCh.length); }; var findChar = function(text2, index2, ch) { var i2; for (i2 = index2 - 1; i2 >= 0; i2--) { var char = text2.charAt(i2); if (isWhitespace(char)) { return Optional.none(); } if (char === ch) { break; } } return Optional.some(i2); }; var findStart = function(dom2, initRange, ch, minChars) { if (minChars === void 0) { minChars = 0; } if (!isValidTextRange(initRange)) { return Optional.none(); } var findTriggerChIndex = function(element2, offset5, text2) { return findChar(text2, offset5, ch).getOr(offset5); }; var root2 = dom2.getParent(initRange.startContainer, dom2.isBlock) || dom2.getRoot(); return repeatLeft(dom2, initRange.startContainer, initRange.startOffset, findTriggerChIndex, root2).bind(function(spot2) { var range3 = initRange.cloneRange(); range3.setStart(spot2.container, spot2.offset); range3.setEnd(initRange.endContainer, initRange.endOffset); if (range3.collapsed) { return Optional.none(); } var text2 = getText(range3); var triggerCharIndex = text2.lastIndexOf(ch); if (triggerCharIndex !== 0 || stripTriggerChar(text2, ch).length < minChars) { return Optional.none(); } else { return Optional.some({ text: stripTriggerChar(text2, ch), range: range3, triggerChar: ch }); } }); }; var getContext = function(dom2, initRange, ch, minChars) { if (minChars === void 0) { minChars = 0; } return detect(SugarElement.fromDom(initRange.startContainer)).fold(function() { return findStart(dom2, initRange, ch, minChars); }, function(elm) { var range3 = dom2.createRng(); range3.selectNode(elm.dom); var text2 = getText(range3); return Optional.some({ range: range3, text: stripTriggerChar(text2, ch), triggerChar: ch }); }); }; var setup$e = function(api3, editor) { editor.on("keypress compositionend", api3.onKeypress.throttle); editor.on("remove", api3.onKeypress.cancel); var redirectKeyToItem = function(item2, e2) { emitWith(item2, keydown(), { raw: e2 }); }; editor.on("keydown", function(e2) { var getItem = function() { return api3.getView().bind(Highlighting.getHighlighted); }; if (e2.which === 8) { api3.onKeypress.throttle(e2); } if (api3.isActive()) { if (e2.which === 27) { api3.cancelIfNecessary(); } if (api3.isMenuOpen()) { if (e2.which === 13) { getItem().each(emitExecute); e2.preventDefault(); } else if (e2.which === 40) { getItem().fold(function() { api3.getView().each(Highlighting.highlightFirst); }, function(item2) { redirectKeyToItem(item2, e2); }); e2.preventDefault(); e2.stopImmediatePropagation(); } else if (e2.which === 37 || e2.which === 38 || e2.which === 39) { getItem().each(function(item2) { redirectKeyToItem(item2, e2); e2.preventDefault(); e2.stopImmediatePropagation(); }); } } else { if (e2.which === 13 || e2.which === 38 || e2.which === 40) { api3.cancelIfNecessary(); } } } }); editor.on("NodeChange", function(e2) { if (api3.isActive() && !api3.isProcessingAction() && detect(SugarElement.fromDom(e2.element)).isNone()) { api3.cancelIfNecessary(); } }); }; var AutocompleterEditorEvents = { setup: setup$e }; var global$c = tinymce.util.Tools.resolve("tinymce.util.Promise"); var point = function(container, offset5) { return { container, offset: offset5 }; }; var isText = function(node) { return node.nodeType === TEXT; }; var isElement$1 = function(node) { return node.nodeType === ELEMENT; }; var toLast = function(node) { if (isText(node)) { return point(node, node.data.length); } else { var children2 = node.childNodes; return children2.length > 0 ? toLast(children2[children2.length - 1]) : point(node, children2.length); } }; var toLeaf = function(node, offset5) { var children2 = node.childNodes; if (children2.length > 0 && offset5 < children2.length) { return toLeaf(children2[offset5], 0); } else if (children2.length > 0 && isElement$1(node) && children2.length === offset5) { return toLast(children2[children2.length - 1]); } else { return point(node, offset5); } }; var isPreviousCharContent = function(dom2, leaf2) { return repeatLeft(dom2, leaf2.container, leaf2.offset, function(element2, offset5) { return offset5 === 0 ? -1 : offset5; }, dom2.getRoot()).filter(function(spot2) { var char = spot2.container.data.charAt(spot2.offset - 1); return !isWhitespace(char); }).isSome(); }; var isStartOfWord = function(dom2) { return function(rng) { var leaf2 = toLeaf(rng.startContainer, rng.startOffset); return !isPreviousCharContent(dom2, leaf2); }; }; var getTriggerContext = function(dom2, initRange, database) { return findMap(database.triggerChars, function(ch) { return getContext(dom2, initRange, ch); }); }; var lookup$2 = function(editor, getDatabase) { var database = getDatabase(); var rng = editor.selection.getRng(); return getTriggerContext(editor.dom, rng, database).bind(function(context2) { return lookupWithContext(editor, getDatabase, context2); }); }; var lookupWithContext = function(editor, getDatabase, context2, fetchOptions) { if (fetchOptions === void 0) { fetchOptions = {}; } var database = getDatabase(); var rng = editor.selection.getRng(); var startText = rng.startContainer.nodeValue; var autocompleters = filter$2(database.lookupByChar(context2.triggerChar), function(autocompleter) { return context2.text.length >= autocompleter.minChars && autocompleter.matches.getOrThunk(function() { return isStartOfWord(editor.dom); })(context2.range, startText, context2.text); }); if (autocompleters.length === 0) { return Optional.none(); } var lookupData = global$c.all(map$2(autocompleters, function(ac) { var fetchResult = ac.fetch(context2.text, ac.maxResults, fetchOptions); return fetchResult.then(function(results) { return { matchText: context2.text, items: results, columns: ac.columns, onAction: ac.onAction, highlightOn: ac.highlightOn }; }); })); return Optional.some({ lookupData, context: context2 }); }; var separatorMenuItemSchema = objOf([ requiredString("type"), optionString("text") ]); var createSeparatorMenuItem = function(spec) { return asRaw("separatormenuitem", separatorMenuItemSchema, spec); }; var autocompleterItemSchema = objOf([ defaulted("type", "autocompleteitem"), defaulted("active", false), defaulted("disabled", false), defaulted("meta", {}), requiredString("value"), optionString("text"), optionString("icon") ]); var autocompleterSchema = objOf([ requiredString("type"), requiredString("ch"), defaultedNumber("minChars", 1), defaulted("columns", 1), defaultedNumber("maxResults", 10), optionFunction("matches"), requiredFunction("fetch"), requiredFunction("onAction"), defaultedArrayOf("highlightOn", [], string2) ]); var createSeparatorItem = function(spec) { return asRaw("Autocompleter.Separator", separatorMenuItemSchema, spec); }; var createAutocompleterItem = function(spec) { return asRaw("Autocompleter.Item", autocompleterItemSchema, spec); }; var createAutocompleter = function(spec) { return asRaw("Autocompleter", autocompleterSchema, spec); }; var baseToolbarButtonFields = [ defaultedBoolean("disabled", false), optionString("tooltip"), optionString("icon"), optionString("text"), defaultedFunction("onSetup", function() { return noop2; }) ]; var toolbarButtonSchema = objOf([ requiredString("type"), requiredFunction("onAction") ].concat(baseToolbarButtonFields)); var createToolbarButton = function(spec) { return asRaw("toolbarbutton", toolbarButtonSchema, spec); }; var baseToolbarToggleButtonFields = [defaultedBoolean("active", false)].concat(baseToolbarButtonFields); var toggleButtonSchema = objOf(baseToolbarToggleButtonFields.concat([ requiredString("type"), requiredFunction("onAction") ])); var createToggleButton = function(spec) { return asRaw("ToggleButton", toggleButtonSchema, spec); }; var contextBarFields = [ defaultedFunction("predicate", never), defaultedStringEnum("scope", "node", [ "node", "editor" ]), defaultedStringEnum("position", "selection", [ "node", "selection", "line" ]) ]; var contextButtonFields = baseToolbarButtonFields.concat([ defaulted("type", "contextformbutton"), defaulted("primary", false), requiredFunction("onAction"), customField("original", identity$1) ]); var contextToggleButtonFields = baseToolbarToggleButtonFields.concat([ defaulted("type", "contextformbutton"), defaulted("primary", false), requiredFunction("onAction"), customField("original", identity$1) ]); var launchButtonFields = baseToolbarButtonFields.concat([defaulted("type", "contextformbutton")]); var launchToggleButtonFields = baseToolbarToggleButtonFields.concat([defaulted("type", "contextformtogglebutton")]); var toggleOrNormal = choose$1("type", { contextformbutton: contextButtonFields, contextformtogglebutton: contextToggleButtonFields }); var contextFormSchema = objOf([ defaulted("type", "contextform"), defaultedFunction("initValue", constant$1("")), optionString("label"), requiredArrayOf("commands", toggleOrNormal), optionOf("launch", choose$1("type", { contextformbutton: launchButtonFields, contextformtogglebutton: launchToggleButtonFields })) ].concat(contextBarFields)); var createContextForm = function(spec) { return asRaw("ContextForm", contextFormSchema, spec); }; var contextToolbarSchema = objOf([ defaulted("type", "contexttoolbar"), requiredString("items") ].concat(contextBarFields)); var createContextToolbar = function(spec) { return asRaw("ContextToolbar", contextToolbarSchema, spec); }; var stringArray = function(a2) { var all3 = {}; each$12(a2, function(key2) { all3[key2] = {}; }); return keys2(all3); }; var register$b = function(editor) { var popups = editor.ui.registry.getAll().popups; var dataset2 = map$1(popups, function(popup) { return createAutocompleter(popup).fold(function(err) { throw new Error(formatError(err)); }, identity$1); }); var triggerChars = stringArray(mapToArray2(dataset2, function(v2) { return v2.ch; })); var datasetValues = values2(dataset2); var lookupByChar = function(ch) { return filter$2(datasetValues, function(dv) { return dv.ch === ch; }); }; return { dataset: dataset2, triggerChars, lookupByChar }; }; var ItemResponse; (function(ItemResponse2) { ItemResponse2[ItemResponse2["CLOSE_ON_EXECUTE"] = 0] = "CLOSE_ON_EXECUTE"; ItemResponse2[ItemResponse2["BUBBLE_TO_SANDBOX"] = 1] = "BUBBLE_TO_SANDBOX"; })(ItemResponse || (ItemResponse = {})); var ItemResponse$1 = ItemResponse; var navClass = "tox-menu-nav__js"; var selectableClass = "tox-collection__item"; var colorClass = "tox-swatch"; var presetClasses = { normal: navClass, color: colorClass }; var tickedClass = "tox-collection__item--enabled"; var groupHeadingClass = "tox-collection__group-heading"; var iconClass = "tox-collection__item-icon"; var textClass = "tox-collection__item-label"; var accessoryClass = "tox-collection__item-accessory"; var caretClass = "tox-collection__item-caret"; var checkmarkClass = "tox-collection__item-checkmark"; var activeClass = "tox-collection__item--active"; var containerClass = "tox-collection__item-container"; var containerColumnClass = "tox-collection__item-container--column"; var containerRowClass = "tox-collection__item-container--row"; var containerAlignRightClass = "tox-collection__item-container--align-right"; var containerAlignLeftClass = "tox-collection__item-container--align-left"; var containerValignTopClass = "tox-collection__item-container--valign-top"; var containerValignMiddleClass = "tox-collection__item-container--valign-middle"; var containerValignBottomClass = "tox-collection__item-container--valign-bottom"; var classForPreset = function(presets) { return get$e(presetClasses, presets).getOr(navClass); }; var forMenu = function(presets) { if (presets === "color") { return "tox-swatches"; } else { return "tox-menu"; } }; var classes3 = function(presets) { return { backgroundMenu: "tox-background-menu", selectedMenu: "tox-selected-menu", selectedItem: "tox-collection__item--active", hasIcons: "tox-menu--has-icons", menu: forMenu(presets), tieredMenu: "tox-tiered-menu" }; }; var markers = function(presets) { var menuClasses = classes3(presets); return { backgroundMenu: menuClasses.backgroundMenu, selectedMenu: menuClasses.selectedMenu, menu: menuClasses.menu, selectedItem: menuClasses.selectedItem, item: classForPreset(presets) }; }; var dom$1 = function(hasIcons, columns2, presets) { var menuClasses = classes3(presets); return { tag: "div", classes: flatten2([ [ menuClasses.menu, "tox-menu-" + columns2 + "-column" ], hasIcons ? [menuClasses.hasIcons] : [] ]) }; }; var components3 = [Menu2.parts.items({})]; var part = function(hasIcons, columns2, presets) { var menuClasses = classes3(presets); var d2 = { tag: "div", classes: flatten2([[menuClasses.tieredMenu]]) }; return { dom: d2, markers: markers(presets) }; }; var chunk = function(rowDom, numColumns) { return function(items) { var chunks = chunk$1(items, numColumns); return map$2(chunks, function(c2) { return { dom: rowDom, components: c2 }; }); }; }; var forSwatch = function(columns2) { return { dom: { tag: "div", classes: [ "tox-menu", "tox-swatches-menu" ] }, components: [{ dom: { tag: "div", classes: ["tox-swatches"] }, components: [Menu2.parts.items({ preprocess: columns2 !== "auto" ? chunk({ tag: "div", classes: ["tox-swatches__row"] }, columns2) : identity$1 })] }] }; }; var forToolbar = function(columns2) { return { dom: { tag: "div", classes: [ "tox-menu", "tox-collection", "tox-collection--toolbar", "tox-collection--toolbar-lg" ] }, components: [Menu2.parts.items({ preprocess: chunk({ tag: "div", classes: ["tox-collection__group"] }, columns2) })] }; }; var preprocessCollection = function(items, isSeparator2) { var allSplits = []; var currentSplit = []; each$12(items, function(item2, i2) { if (isSeparator2(item2, i2)) { if (currentSplit.length > 0) { allSplits.push(currentSplit); } currentSplit = []; if (has$22(item2.dom, "innerHtml")) { currentSplit.push(item2); } } else { currentSplit.push(item2); } }); if (currentSplit.length > 0) { allSplits.push(currentSplit); } return map$2(allSplits, function(s2) { return { dom: { tag: "div", classes: ["tox-collection__group"] }, components: s2 }; }); }; var forCollection = function(columns2, initItems, _hasIcons) { return { dom: { tag: "div", classes: [ "tox-menu", "tox-collection" ].concat(columns2 === 1 ? ["tox-collection--list"] : ["tox-collection--grid"]) }, components: [Menu2.parts.items({ preprocess: function(items) { if (columns2 !== "auto" && columns2 > 1) { return chunk({ tag: "div", classes: ["tox-collection__group"] }, columns2)(items); } else { return preprocessCollection(items, function(_item, i2) { return initItems[i2].type === "separator"; }); } } })] }; }; var forHorizontalCollection = function(initItems, _hasIcons) { return { dom: { tag: "div", classes: [ "tox-collection", "tox-collection--horizontal" ] }, components: [Menu2.parts.items({ preprocess: function(items) { return preprocessCollection(items, function(_item, i2) { return initItems[i2].type === "separator"; }); } })] }; }; var menuHasIcons = function(xs) { return exists(xs, function(item2) { return "icon" in item2 && item2.icon !== void 0; }); }; var handleError = function(error4) { console.error(formatError(error4)); console.log(error4); return Optional.none(); }; var createHorizontalPartialMenuWithAlloyItems = function(value25, _hasIcons, items, _columns, _presets) { var structure = forHorizontalCollection(items); return { value: value25, dom: structure.dom, components: structure.components, items }; }; var createPartialMenuWithAlloyItems = function(value25, hasIcons, items, columns2, presets) { if (presets === "color") { var structure = forSwatch(columns2); return { value: value25, dom: structure.dom, components: structure.components, items }; } if (presets === "normal" && columns2 === "auto") { var structure = forCollection(columns2, items); return { value: value25, dom: structure.dom, components: structure.components, items }; } if (presets === "normal" && columns2 === 1) { var structure = forCollection(1, items); return { value: value25, dom: structure.dom, components: structure.components, items }; } if (presets === "normal") { var structure = forCollection(columns2, items); return { value: value25, dom: structure.dom, components: structure.components, items }; } if (presets === "listpreview" && columns2 !== "auto") { var structure = forToolbar(columns2); return { value: value25, dom: structure.dom, components: structure.components, items }; } return { value: value25, dom: dom$1(hasIcons, columns2, presets), components: components3, items }; }; var cardImageFields = [ requiredString("type"), requiredString("src"), optionString("alt"), defaultedArrayOf("classes", [], string2) ]; var cardImageSchema = objOf(cardImageFields); var cardTextFields = [ requiredString("type"), requiredString("text"), optionString("name"), defaultedArrayOf("classes", ["tox-collection__item-label"], string2) ]; var cardTextSchema = objOf(cardTextFields); var itemSchema$1 = valueThunk(function() { return choose$2("type", { cardimage: cardImageSchema, cardtext: cardTextSchema, cardcontainer: cardContainerSchema }); }); var cardContainerSchema = objOf([ requiredString("type"), defaultedString("direction", "horizontal"), defaultedString("align", "left"), defaultedString("valign", "middle"), requiredArrayOf("items", itemSchema$1) ]); var commonMenuItemFields = [ defaultedBoolean("disabled", false), optionString("text"), optionString("shortcut"), field$1("value", "value", defaultedThunk(function() { return generate$6("menuitem-value"); }), anyValue()), defaulted("meta", {}) ]; var cardMenuItemSchema = objOf([ requiredString("type"), optionString("label"), requiredArrayOf("items", itemSchema$1), defaultedFunction("onSetup", function() { return noop2; }), defaultedFunction("onAction", noop2) ].concat(commonMenuItemFields)); var createCardMenuItem = function(spec) { return asRaw("cardmenuitem", cardMenuItemSchema, spec); }; var choiceMenuItemSchema = objOf([ requiredString("type"), defaultedBoolean("active", false), optionString("icon") ].concat(commonMenuItemFields)); var createChoiceMenuItem = function(spec) { return asRaw("choicemenuitem", choiceMenuItemSchema, spec); }; var baseFields = [ requiredString("type"), requiredString("fancytype"), defaultedFunction("onAction", noop2) ]; var insertTableFields = [defaulted("initData", {})].concat(baseFields); var colorSwatchFields = [defaultedObjOf("initData", {}, [ defaultedBoolean("allowCustomColors", true), optionArrayOf("colors", anyValue()) ])].concat(baseFields); var fancyMenuItemSchema = choose$1("fancytype", { inserttable: insertTableFields, colorswatch: colorSwatchFields }); var createFancyMenuItem = function(spec) { return asRaw("fancymenuitem", fancyMenuItemSchema, spec); }; var menuItemSchema = objOf([ requiredString("type"), defaultedFunction("onSetup", function() { return noop2; }), defaultedFunction("onAction", noop2), optionString("icon") ].concat(commonMenuItemFields)); var createMenuItem = function(spec) { return asRaw("menuitem", menuItemSchema, spec); }; var nestedMenuItemSchema = objOf([ requiredString("type"), requiredFunction("getSubmenuItems"), defaultedFunction("onSetup", function() { return noop2; }), optionString("icon") ].concat(commonMenuItemFields)); var createNestedMenuItem = function(spec) { return asRaw("nestedmenuitem", nestedMenuItemSchema, spec); }; var toggleMenuItemSchema = objOf([ requiredString("type"), optionString("icon"), defaultedBoolean("active", false), defaultedFunction("onSetup", function() { return noop2; }), requiredFunction("onAction") ].concat(commonMenuItemFields)); var createToggleMenuItem = function(spec) { return asRaw("togglemenuitem", toggleMenuItemSchema, spec); }; var detectSize = function(comp, margin, selectorClass) { var descendants$1 = descendants(comp.element, "." + selectorClass); if (descendants$1.length > 0) { var columnLength = findIndex$1(descendants$1, function(c2) { var thisTop = c2.dom.getBoundingClientRect().top; var cTop = descendants$1[0].dom.getBoundingClientRect().top; return Math.abs(thisTop - cTop) > margin; }).getOr(descendants$1.length); return Optional.some({ numColumns: columnLength, numRows: Math.ceil(descendants$1.length / columnLength) }); } else { return Optional.none(); } }; var namedEvents = function(name2, handlers2) { return derive$1([config3(name2, handlers2)]); }; var unnamedEvents = function(handlers2) { return namedEvents(generate$6("unnamed-events"), handlers2); }; var SimpleBehaviours = { namedEvents, unnamedEvents }; var ExclusivityChannel = generate$6("tooltip.exclusive"); var ShowTooltipEvent = generate$6("tooltip.show"); var HideTooltipEvent = generate$6("tooltip.hide"); var hideAllExclusive = function(component, _tConfig, _tState) { component.getSystem().broadcastOn([ExclusivityChannel], {}); }; var setComponents = function(component, tConfig, tState, specs) { tState.getTooltip().each(function(tooltip) { if (tooltip.getSystem().isConnected()) { Replacing.set(tooltip, specs); } }); }; var TooltippingApis = /* @__PURE__ */ Object.freeze({ __proto__: null, hideAllExclusive, setComponents }); var events$9 = function(tooltipConfig, state) { var hide = function(comp) { state.getTooltip().each(function(p) { detach(p); tooltipConfig.onHide(comp, p); state.clearTooltip(); }); state.clearTimer(); }; var show2 = function(comp) { if (!state.isShowing()) { hideAllExclusive(comp); var sink = tooltipConfig.lazySink(comp).getOrDie(); var popup = comp.getSystem().build({ dom: tooltipConfig.tooltipDom, components: tooltipConfig.tooltipComponents, events: derive$2(tooltipConfig.mode === "normal" ? [ run$1(mouseover(), function(_2) { emit2(comp, ShowTooltipEvent); }), run$1(mouseout(), function(_2) { emit2(comp, HideTooltipEvent); }) ] : []), behaviours: derive$1([Replacing.config({})]) }); state.setTooltip(popup); attach(sink, popup); tooltipConfig.onShow(comp, popup); Positioning.position(sink, popup, { anchor: tooltipConfig.anchor(comp) }); } }; return derive$2(flatten2([ [ run$1(ShowTooltipEvent, function(comp) { state.resetTimer(function() { show2(comp); }, tooltipConfig.delay); }), run$1(HideTooltipEvent, function(comp) { state.resetTimer(function() { hide(comp); }, tooltipConfig.delay); }), run$1(receive(), function(comp, message2) { var receivingData = message2; if (!receivingData.universal) { if (contains$2(receivingData.channels, ExclusivityChannel)) { hide(comp); } } }), runOnDetached(function(comp) { hide(comp); }) ], tooltipConfig.mode === "normal" ? [ run$1(focusin(), function(comp) { emit2(comp, ShowTooltipEvent); }), run$1(postBlur(), function(comp) { emit2(comp, HideTooltipEvent); }), run$1(mouseover(), function(comp) { emit2(comp, ShowTooltipEvent); }), run$1(mouseout(), function(comp) { emit2(comp, HideTooltipEvent); }) ] : [ run$1(highlight$1(), function(comp, _se) { emit2(comp, ShowTooltipEvent); }), run$1(dehighlight$1(), function(comp) { emit2(comp, HideTooltipEvent); }) ] ])); }; var ActiveTooltipping = /* @__PURE__ */ Object.freeze({ __proto__: null, events: events$9 }); var TooltippingSchema = [ required$12("lazySink"), required$12("tooltipDom"), defaulted("exclusive", true), defaulted("tooltipComponents", []), defaulted("delay", 300), defaultedStringEnum("mode", "normal", [ "normal", "follow-highlight" ]), defaulted("anchor", function(comp) { return { type: "hotspot", hotspot: comp, layouts: { onLtr: constant$1([ south$2, north$2, southeast$2, northeast$2, southwest$2, northwest$2 ]), onRtl: constant$1([ south$2, north$2, southeast$2, northeast$2, southwest$2, northwest$2 ]) } }; }), onHandler("onHide"), onHandler("onShow") ]; var init$b = function() { var timer = value$1(); var popup = value$1(); var clearTimer = function() { timer.on(clearTimeout); }; var resetTimer = function(f2, delay) { clearTimer(); timer.set(setTimeout(f2, delay)); }; var readState = constant$1("not-implemented"); return nu$8({ getTooltip: popup.get, isShowing: popup.isSet, setTooltip: popup.set, clearTooltip: popup.clear, clearTimer, resetTimer, readState }); }; var TooltippingState = /* @__PURE__ */ Object.freeze({ __proto__: null, init: init$b }); var Tooltipping = create$8({ fields: TooltippingSchema, name: "tooltipping", active: ActiveTooltipping, state: TooltippingState, apis: TooltippingApis }); var escape2 = function(text2) { return text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); }; var global$b = tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"); var global$a = tinymce.util.Tools.resolve("tinymce.EditorManager"); var getSkinUrl = function(editor) { var skin = editor.getParam("skin"); var skinUrl = editor.getParam("skin_url"); if (skin !== false) { var skinName = skin ? skin : "oxide"; if (skinUrl) { skinUrl = editor.documentBaseURI.toAbsolute(skinUrl); } else { skinUrl = global$a.baseURL + "/skins/ui/" + skinName; } } return skinUrl; }; var isReadOnly = function(editor) { return editor.getParam("readonly", false, "boolean"); }; var isSkinDisabled = function(editor) { return editor.getParam("skin") === false; }; var getHeightSetting = function(editor) { return editor.getParam("height", Math.max(editor.getElement().offsetHeight, 200)); }; var getWidthSetting = function(editor) { return editor.getParam("width", global$b.DOM.getStyle(editor.getElement(), "width")); }; var getMinWidthSetting = function(editor) { return Optional.from(editor.getParam("min_width")).filter(isNumber2); }; var getMinHeightSetting = function(editor) { return Optional.from(editor.getParam("min_height")).filter(isNumber2); }; var getMaxWidthSetting = function(editor) { return Optional.from(editor.getParam("max_width")).filter(isNumber2); }; var getMaxHeightSetting = function(editor) { return Optional.from(editor.getParam("max_height")).filter(isNumber2); }; var getUserStyleFormats = function(editor) { return Optional.from(editor.getParam("style_formats")).filter(isArray2); }; var isMergeStyleFormats = function(editor) { return editor.getParam("style_formats_merge", false, "boolean"); }; var getLineHeightFormats = function(editor) { return editor.getParam("lineheight_formats", "1 1.1 1.2 1.3 1.4 1.5 2", "string").split(" "); }; var getContentLanguages = function(editor) { return editor.getParam("content_langs", void 0, "array"); }; var getRemovedMenuItems = function(editor) { return editor.getParam("removed_menuitems", ""); }; var isMenubarEnabled = function(editor) { return editor.getParam("menubar", true, "boolean") !== false; }; var isToolbarEnabled = function(editor) { var toolbar2 = editor.getParam("toolbar", true); var isToolbarTrue = toolbar2 === true; var isToolbarString = isString3(toolbar2); var isToolbarObjectArray = isArray2(toolbar2) && toolbar2.length > 0; return !isMultipleToolbars(editor) && (isToolbarObjectArray || isToolbarString || isToolbarTrue); }; var getMultipleToolbarsSetting = function(editor) { var toolbars = range$2(9, function(num) { return editor.getParam("toolbar" + (num + 1), false, "string"); }); var toolbarArray = filter$2(toolbars, function(toolbar2) { return typeof toolbar2 === "string"; }); return toolbarArray.length > 0 ? Optional.some(toolbarArray) : Optional.none(); }; var isMultipleToolbars = function(editor) { return getMultipleToolbarsSetting(editor).fold(function() { var toolbar2 = editor.getParam("toolbar", [], "string[]"); return toolbar2.length > 0; }, always); }; var ToolbarMode; (function(ToolbarMode2) { ToolbarMode2["default"] = "wrap"; ToolbarMode2["floating"] = "floating"; ToolbarMode2["sliding"] = "sliding"; ToolbarMode2["scrolling"] = "scrolling"; })(ToolbarMode || (ToolbarMode = {})); var getToolbarMode = function(editor) { return editor.getParam("toolbar_mode", "", "string"); }; var ToolbarLocation; (function(ToolbarLocation2) { ToolbarLocation2["auto"] = "auto"; ToolbarLocation2["top"] = "top"; ToolbarLocation2["bottom"] = "bottom"; })(ToolbarLocation || (ToolbarLocation = {})); var getToolbarGroups = function(editor) { return editor.getParam("toolbar_groups", {}, "object"); }; var getToolbarLocation = function(editor) { return editor.getParam("toolbar_location", ToolbarLocation.auto, "string"); }; var isToolbarLocationBottom = function(editor) { return getToolbarLocation(editor) === ToolbarLocation.bottom; }; var fixedContainerSelector = function(editor) { return editor.getParam("fixed_toolbar_container", "", "string"); }; var fixedToolbarContainerTarget = function(editor) { return editor.getParam("fixed_toolbar_container_target"); }; var isToolbarPersist = function(editor) { return editor.getParam("toolbar_persist", false, "boolean"); }; var fixedContainerTarget = function(editor) { if (!editor.inline) { return Optional.none(); } var selector2 = fixedContainerSelector(editor); if (selector2.length > 0) { return descendant(body(), selector2); } var element2 = fixedToolbarContainerTarget(editor); if (isNonNullable(element2)) { return Optional.some(SugarElement.fromDom(element2)); } return Optional.none(); }; var useFixedContainer = function(editor) { return editor.inline && fixedContainerTarget(editor).isSome(); }; var getUiContainer = function(editor) { var fixedContainer = fixedContainerTarget(editor); return fixedContainer.getOrThunk(function() { return getContentContainer(getRootNode(SugarElement.fromDom(editor.getElement()))); }); }; var isDistractionFree = function(editor) { return editor.inline && !isMenubarEnabled(editor) && !isToolbarEnabled(editor) && !isMultipleToolbars(editor); }; var isStickyToolbar = function(editor) { var isStickyToolbar2 = editor.getParam("toolbar_sticky", false, "boolean"); return (isStickyToolbar2 || editor.inline) && !useFixedContainer(editor) && !isDistractionFree(editor); }; var getStickyToolbarOffset = function(editor) { return editor.getParam("toolbar_sticky_offset", 0, "number"); }; var isDraggableModal$1 = function(editor) { return editor.getParam("draggable_modal", false, "boolean"); }; var getMenus = function(editor) { var menu2 = editor.getParam("menu"); if (menu2) { return map$1(menu2, function(menu3) { return __assign(__assign({}, menu3), { items: menu3.items }); }); } else { return {}; } }; var getMenubar = function(editor) { return editor.getParam("menubar"); }; var getToolbar = function(editor) { return editor.getParam("toolbar", true); }; var getFilePickerCallback = function(editor) { return editor.getParam("file_picker_callback"); }; var getFilePickerTypes = function(editor) { return editor.getParam("file_picker_types"); }; var getFileBrowserCallbackTypes = function(editor) { return editor.getParam("file_browser_callback_types"); }; var noTypeaheadUrls = function(editor) { return editor.getParam("typeahead_urls") === false; }; var getAnchorTop = function(editor) { return editor.getParam("anchor_top", "#top"); }; var getAnchorBottom = function(editor) { return editor.getParam("anchor_bottom", "#bottom"); }; var getFilePickerValidatorHandler = function(editor) { var handler7 = editor.getParam("file_picker_validator_handler", void 0, "function"); if (handler7 === void 0) { return editor.getParam("filepicker_validator_handler", void 0, "function"); } else { return handler7; } }; var ReadOnlyChannel = "silver.readonly"; var ReadOnlyDataSchema = objOf([requiredBoolean("readonly")]); var broadcastReadonly = function(uiComponents, readonly2) { var outerContainer = uiComponents.outerContainer; var target = outerContainer.element; if (readonly2) { uiComponents.mothership.broadcastOn([dismissPopups()], { target }); uiComponents.uiMothership.broadcastOn([dismissPopups()], { target }); } uiComponents.mothership.broadcastOn([ReadOnlyChannel], { readonly: readonly2 }); uiComponents.uiMothership.broadcastOn([ReadOnlyChannel], { readonly: readonly2 }); }; var setupReadonlyModeSwitch = function(editor, uiComponents) { editor.on("init", function() { if (editor.mode.isReadOnly()) { broadcastReadonly(uiComponents, true); } }); editor.on("SwitchMode", function() { return broadcastReadonly(uiComponents, editor.mode.isReadOnly()); }); if (isReadOnly(editor)) { editor.setMode("readonly"); } }; var receivingConfig = function() { var _a4; return Receiving.config({ channels: (_a4 = {}, _a4[ReadOnlyChannel] = { schema: ReadOnlyDataSchema, onReceive: function(comp, data65) { Disabling.set(comp, data65.readonly); } }, _a4) }); }; var item = function(disabled) { return Disabling.config({ disabled, disableClass: "tox-collection__item--state-disabled" }); }; var button = function(disabled) { return Disabling.config({ disabled }); }; var splitButton = function(disabled) { return Disabling.config({ disabled, disableClass: "tox-tbtn--disabled" }); }; var toolbarButton = function(disabled) { return Disabling.config({ disabled, disableClass: "tox-tbtn--disabled", useNative: false }); }; var DisablingConfigs = { item, button, splitButton, toolbarButton }; var runWithApi = function(info3, comp) { var api3 = info3.getApi(comp); return function(f2) { f2(api3); }; }; var onControlAttached = function(info3, editorOffCell) { return runOnAttached(function(comp) { var run2 = runWithApi(info3, comp); run2(function(api3) { var onDestroy = info3.onSetup(api3); if (isFunction3(onDestroy)) { editorOffCell.set(onDestroy); } }); }); }; var onControlDetached = function(getApi2, editorOffCell) { return runOnDetached(function(comp) { return runWithApi(getApi2, comp)(editorOffCell.get()); }); }; var _a$1; var onMenuItemExecute = function(info3, itemResponse) { return runOnExecute$1(function(comp, simulatedEvent) { runWithApi(info3, comp)(info3.onAction); if (!info3.triggersSubmenu && itemResponse === ItemResponse$1.CLOSE_ON_EXECUTE) { emit2(comp, sandboxClose()); simulatedEvent.stop(); } }); }; var menuItemEventOrder = (_a$1 = {}, _a$1[execute$5()] = [ "disabling", "alloy.base.behaviour", "toggling", "item-events" ], _a$1); var componentRenderPipeline = cat; var renderCommonItem = function(spec, structure, itemResponse, providersbackstage) { var editorOffCell = Cell3(noop2); return { type: "item", dom: structure.dom, components: componentRenderPipeline(structure.optComponents), data: spec.data, eventOrder: menuItemEventOrder, hasSubmenu: spec.triggersSubmenu, itemBehaviours: derive$1([ config3("item-events", [ onMenuItemExecute(spec, itemResponse), onControlAttached(spec, editorOffCell), onControlDetached(spec, editorOffCell) ]), DisablingConfigs.item(function() { return spec.disabled || providersbackstage.isDisabled(); }), receivingConfig(), Replacing.config({}) ].concat(spec.itemBehaviours)) }; }; var buildData = function(source2) { return { value: source2.value, meta: __assign({ text: source2.text.getOr("") }, source2.meta) }; }; var global$9 = tinymce.util.Tools.resolve("tinymce.Env"); var convertText = function(source2) { var mac = { alt: "⌥", ctrl: "⌃", shift: "⇧", meta: "⌘", access: "⌃⌥" }; var other = { meta: "Ctrl", access: "Shift+Alt" }; var replace2 = global$9.mac ? mac : other; var shortcut = source2.split("+"); var updated22 = map$2(shortcut, function(segment) { var search2 = segment.toLowerCase().trim(); return has$22(replace2, search2) ? replace2[search2] : segment; }); return global$9.mac ? updated22.join("") : updated22.join("+"); }; var renderIcon$1 = function(name2, icons, classes4) { if (classes4 === void 0) { classes4 = [iconClass]; } return render$3(name2, { tag: "div", classes: classes4 }, icons); }; var renderText = function(text2) { return { dom: { tag: "div", classes: [textClass] }, components: [text$1(global$e.translate(text2))] }; }; var renderHtml = function(html2, classes4) { return { dom: { tag: "div", classes: classes4, innerHtml: html2 } }; }; var renderStyledText = function(style, text2) { return { dom: { tag: "div", classes: [textClass] }, components: [{ dom: { tag: style.tag, styles: style.styles }, components: [text$1(global$e.translate(text2))] }] }; }; var renderShortcut = function(shortcut) { return { dom: { tag: "div", classes: [accessoryClass], innerHtml: convertText(shortcut) } }; }; var renderCheckmark = function(icons) { return renderIcon$1("checkmark", icons, [checkmarkClass]); }; var renderSubmenuCaret = function(icons) { return renderIcon$1("chevron-right", icons, [caretClass]); }; var renderDownwardsCaret = function(icons) { return renderIcon$1("chevron-down", icons, [caretClass]); }; var renderContainer = function(container, components4) { var directionClass = container.direction === "vertical" ? containerColumnClass : containerRowClass; var alignClass = container.align === "left" ? containerAlignLeftClass : containerAlignRightClass; var getValignClass = function() { switch (container.valign) { case "top": return containerValignTopClass; case "middle": return containerValignMiddleClass; case "bottom": return containerValignBottomClass; } }; return { dom: { tag: "div", classes: [ containerClass, directionClass, alignClass, getValignClass() ] }, components: components4 }; }; var renderImage = function(src2, classes4, alt) { return { dom: { tag: "img", classes: classes4, attributes: { src: src2, alt: alt.getOr("") } } }; }; var renderColorStructure = function(item2, providerBackstage, fallbackIcon) { var colorPickerCommand = "custom"; var removeColorCommand = "remove"; var itemText = item2.ariaLabel; var itemValue = item2.value; var iconSvg = item2.iconContent.map(function(name2) { return getOr(name2, providerBackstage.icons, fallbackIcon); }); var getDom = function() { var common = colorClass; var icon = iconSvg.getOr(""); var attributes2 = itemText.map(function(text2) { return { title: providerBackstage.translate(text2) }; }).getOr({}); var baseDom = { tag: "div", attributes: attributes2, classes: [common] }; if (itemValue === colorPickerCommand) { return __assign(__assign({}, baseDom), { tag: "button", classes: __spreadArray(__spreadArray([], baseDom.classes, true), ["tox-swatches__picker-btn"], false), innerHtml: icon }); } else if (itemValue === removeColorCommand) { return __assign(__assign({}, baseDom), { classes: __spreadArray(__spreadArray([], baseDom.classes, true), ["tox-swatch--remove"], false), innerHtml: icon }); } else { return __assign(__assign({}, baseDom), { attributes: __assign(__assign({}, baseDom.attributes), { "data-mce-color": itemValue }), styles: { "background-color": itemValue } }); } }; return { dom: getDom(), optComponents: [] }; }; var renderItemDomStructure = function(ariaLabel) { var domTitle = ariaLabel.map(function(label) { return { attributes: { title: global$e.translate(label) } }; }).getOr({}); return __assign({ tag: "div", classes: [ navClass, selectableClass ] }, domTitle); }; var renderNormalItemStructure = function(info3, providersBackstage, renderIcons, fallbackIcon) { var iconSpec = { tag: "div", classes: [iconClass] }; var renderIcon4 = function(iconName) { return render$3(iconName, iconSpec, providersBackstage.icons, fallbackIcon); }; var renderEmptyIcon = function() { return Optional.some({ dom: iconSpec }); }; var leftIcon = renderIcons ? info3.iconContent.map(renderIcon4).orThunk(renderEmptyIcon) : Optional.none(); var checkmark = info3.checkMark; var textRender = Optional.from(info3.meta).fold(function() { return renderText; }, function(meta) { return has$22(meta, "style") ? curry(renderStyledText, meta.style) : renderText; }); var content = info3.htmlContent.fold(function() { return info3.textContent.map(textRender); }, function(html2) { return Optional.some(renderHtml(html2, [textClass])); }); var menuItem = { dom: renderItemDomStructure(info3.ariaLabel), optComponents: [ leftIcon, content, info3.shortcutContent.map(renderShortcut), checkmark, info3.caret ] }; return menuItem; }; var renderItemStructure = function(info3, providersBackstage, renderIcons, fallbackIcon) { if (fallbackIcon === void 0) { fallbackIcon = Optional.none(); } if (info3.presets === "color") { return renderColorStructure(info3, providersBackstage, fallbackIcon); } else { return renderNormalItemStructure(info3, providersBackstage, renderIcons, fallbackIcon); } }; var tooltipBehaviour = function(meta, sharedBackstage) { return get$e(meta, "tooltipWorker").map(function(tooltipWorker) { return [Tooltipping.config({ lazySink: sharedBackstage.getSink, tooltipDom: { tag: "div", classes: ["tox-tooltip-worker-container"] }, tooltipComponents: [], anchor: function(comp) { return { type: "submenu", item: comp, overrides: { maxHeightFunction: expandable$1 } }; }, mode: "follow-highlight", onShow: function(component, _tooltip) { tooltipWorker(function(elm) { Tooltipping.setComponents(component, [external$2({ element: SugarElement.fromDom(elm) })]); }); } })]; }).getOr([]); }; var encodeText = function(text2) { return global$b.DOM.encode(text2); }; var replaceText = function(text2, matchText) { var translated = global$e.translate(text2); var encoded = encodeText(translated); if (matchText.length > 0) { var escapedMatchRegex = new RegExp(escape2(matchText), "gi"); return encoded.replace(escapedMatchRegex, function(match5) { return '' + match5 + ""; }); } else { return encoded; } }; var renderAutocompleteItem = function(spec, matchText, useText, presets, onItemValueHandler, itemResponse, sharedBackstage, renderIcons) { if (renderIcons === void 0) { renderIcons = true; } var structure = renderItemStructure({ presets, textContent: Optional.none(), htmlContent: useText ? spec.text.map(function(text2) { return replaceText(text2, matchText); }) : Optional.none(), ariaLabel: spec.text, iconContent: spec.icon, shortcutContent: Optional.none(), checkMark: Optional.none(), caret: Optional.none(), value: spec.value }, sharedBackstage.providers, renderIcons, spec.icon); return renderCommonItem({ data: buildData(spec), disabled: spec.disabled, getApi: constant$1({}), onAction: function(_api2) { return onItemValueHandler(spec.value, spec.meta); }, onSetup: constant$1(noop2), triggersSubmenu: false, itemBehaviours: tooltipBehaviour(spec.meta, sharedBackstage) }, structure, itemResponse, sharedBackstage.providers); }; var render$2 = function(items, extras) { return map$2(items, function(item2) { switch (item2.type) { case "cardcontainer": return renderContainer(item2, render$2(item2.items, extras)); case "cardimage": return renderImage(item2.src, item2.classes, item2.alt); case "cardtext": var shouldHighlight = item2.name.exists(function(name2) { return contains$2(extras.cardText.highlightOn, name2); }); var matchText = shouldHighlight ? Optional.from(extras.cardText.matchText).getOr("") : ""; return renderHtml(replaceText(item2.text, matchText), item2.classes); } }); }; var renderCardMenuItem = function(spec, itemResponse, sharedBackstage, extras) { var getApi2 = function(component) { return { isDisabled: function() { return Disabling.isDisabled(component); }, setDisabled: function(state) { Disabling.set(component, state); each$12(descendants(component.element, "*"), function(elm) { component.getSystem().getByDom(elm).each(function(comp) { if (comp.hasConfigured(Disabling)) { Disabling.set(comp, state); } }); }); } }; }; var structure = { dom: renderItemDomStructure(spec.label), optComponents: [Optional.some({ dom: { tag: "div", classes: [ containerClass, containerRowClass ] }, components: render$2(spec.items, extras) })] }; return renderCommonItem({ data: buildData(__assign({ text: Optional.none() }, spec)), disabled: spec.disabled, getApi: getApi2, onAction: spec.onAction, onSetup: spec.onSetup, triggersSubmenu: false, itemBehaviours: Optional.from(extras.itemBehaviours).getOr([]) }, structure, itemResponse, sharedBackstage.providers); }; var renderChoiceItem = function(spec, useText, presets, onItemValueHandler, isSelected, itemResponse, providersBackstage, renderIcons) { if (renderIcons === void 0) { renderIcons = true; } var getApi2 = function(component) { return { setActive: function(state) { Toggling.set(component, state); }, isActive: function() { return Toggling.isOn(component); }, isDisabled: function() { return Disabling.isDisabled(component); }, setDisabled: function(state) { return Disabling.set(component, state); } }; }; var structure = renderItemStructure({ presets, textContent: useText ? spec.text : Optional.none(), htmlContent: Optional.none(), ariaLabel: spec.text, iconContent: spec.icon, shortcutContent: useText ? spec.shortcut : Optional.none(), checkMark: useText ? Optional.some(renderCheckmark(providersBackstage.icons)) : Optional.none(), caret: Optional.none(), value: spec.value }, providersBackstage, renderIcons); return deepMerge2(renderCommonItem({ data: buildData(spec), disabled: spec.disabled, getApi: getApi2, onAction: function(_api2) { return onItemValueHandler(spec.value); }, onSetup: function(api3) { api3.setActive(isSelected); return noop2; }, triggersSubmenu: false, itemBehaviours: [] }, structure, itemResponse, providersBackstage), { toggling: { toggleClass: tickedClass, toggleOnExecute: false, selected: spec.active } }); }; var parts$f = generate$32(owner$2(), parts$h()); var hexColour = function(value25) { return { value: value25 }; }; var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; var longformRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; var isHexString = function(hex2) { return shorthandRegex.test(hex2) || longformRegex.test(hex2); }; var normalizeHex = function(hex2) { return removeLeading(hex2, "#").toUpperCase(); }; var fromString$1 = function(hex2) { return isHexString(hex2) ? Optional.some({ value: normalizeHex(hex2) }) : Optional.none(); }; var getLongForm = function(hex2) { var hexString = hex2.value.replace(shorthandRegex, function(m2, r3, g2, b3) { return r3 + r3 + g2 + g2 + b3 + b3; }); return { value: hexString }; }; var extractValues = function(hex2) { var longForm = getLongForm(hex2); var splitForm = longformRegex.exec(longForm.value); return splitForm === null ? [ "FFFFFF", "FF", "FF", "FF" ] : splitForm; }; var toHex2 = function(component) { var hex2 = component.toString(16); return (hex2.length === 1 ? "0" + hex2 : hex2).toUpperCase(); }; var fromRgba = function(rgbaColour2) { var value25 = toHex2(rgbaColour2.red) + toHex2(rgbaColour2.green) + toHex2(rgbaColour2.blue); return hexColour(value25); }; var min4 = Math.min; var max4 = Math.max; var round$1 = Math.round; var rgbRegex = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)/; var rgbaRegex = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/; var rgbaColour = function(red2, green, blue, alpha) { return { red: red2, green, blue, alpha }; }; var isRgbaComponent = function(value25) { var num = parseInt(value25, 10); return num.toString() === value25 && num >= 0 && num <= 255; }; var fromHsv = function(hsv) { var r3; var g2; var b3; var hue = (hsv.hue || 0) % 360; var saturation = hsv.saturation / 100; var brightness2 = hsv.value / 100; saturation = max4(0, min4(saturation, 1)); brightness2 = max4(0, min4(brightness2, 1)); if (saturation === 0) { r3 = g2 = b3 = round$1(255 * brightness2); return rgbaColour(r3, g2, b3, 1); } var side = hue / 60; var chroma = brightness2 * saturation; var x2 = chroma * (1 - Math.abs(side % 2 - 1)); var match5 = brightness2 - chroma; switch (Math.floor(side)) { case 0: r3 = chroma; g2 = x2; b3 = 0; break; case 1: r3 = x2; g2 = chroma; b3 = 0; break; case 2: r3 = 0; g2 = chroma; b3 = x2; break; case 3: r3 = 0; g2 = x2; b3 = chroma; break; case 4: r3 = x2; g2 = 0; b3 = chroma; break; case 5: r3 = chroma; g2 = 0; b3 = x2; break; default: r3 = g2 = b3 = 0; } r3 = round$1(255 * (r3 + match5)); g2 = round$1(255 * (g2 + match5)); b3 = round$1(255 * (b3 + match5)); return rgbaColour(r3, g2, b3, 1); }; var fromHex = function(hexColour2) { var result = extractValues(hexColour2); var red2 = parseInt(result[1], 16); var green = parseInt(result[2], 16); var blue = parseInt(result[3], 16); return rgbaColour(red2, green, blue, 1); }; var fromStringValues = function(red2, green, blue, alpha) { var r3 = parseInt(red2, 10); var g2 = parseInt(green, 10); var b3 = parseInt(blue, 10); var a2 = parseFloat(alpha); return rgbaColour(r3, g2, b3, a2); }; var fromString = function(rgbaString) { if (rgbaString === "transparent") { return Optional.some(rgbaColour(0, 0, 0, 0)); } var rgbMatch = rgbRegex.exec(rgbaString); if (rgbMatch !== null) { return Optional.some(fromStringValues(rgbMatch[1], rgbMatch[2], rgbMatch[3], "1")); } var rgbaMatch = rgbaRegex.exec(rgbaString); if (rgbaMatch !== null) { return Optional.some(fromStringValues(rgbaMatch[1], rgbaMatch[2], rgbaMatch[3], rgbaMatch[4])); } return Optional.none(); }; var toString3 = function(rgba) { return "rgba(" + rgba.red + "," + rgba.green + "," + rgba.blue + "," + rgba.alpha + ")"; }; var red = rgbaColour(255, 0, 0, 1); var fireSkinLoaded$1 = function(editor) { return editor.fire("SkinLoaded"); }; var fireSkinLoadError$1 = function(editor, error4) { return editor.fire("SkinLoadError", error4); }; var fireResizeEditor = function(editor) { return editor.fire("ResizeEditor"); }; var fireResizeContent = function(editor, e2) { return editor.fire("ResizeContent", e2); }; var fireScrollContent = function(editor, e2) { return editor.fire("ScrollContent", e2); }; var fireTextColorChange = function(editor, data65) { return editor.fire("TextColorChange", data65); }; var hsvColour = function(hue, saturation, value25) { return { hue, saturation, value: value25 }; }; var fromRgb = function(rgbaColour2) { var h2 = 0; var s2 = 0; var v2 = 0; var r3 = rgbaColour2.red / 255; var g2 = rgbaColour2.green / 255; var b3 = rgbaColour2.blue / 255; var minRGB = Math.min(r3, Math.min(g2, b3)); var maxRGB = Math.max(r3, Math.max(g2, b3)); if (minRGB === maxRGB) { v2 = minRGB; return hsvColour(0, 0, v2 * 100); } var d2 = r3 === minRGB ? g2 - b3 : b3 === minRGB ? r3 - g2 : b3 - r3; h2 = r3 === minRGB ? 3 : b3 === minRGB ? 1 : 5; h2 = 60 * (h2 - d2 / (maxRGB - minRGB)); s2 = (maxRGB - minRGB) / maxRGB; v2 = maxRGB; return hsvColour(Math.round(h2), Math.round(s2 * 100), Math.round(v2 * 100)); }; var hexToHsv = function(hex2) { return fromRgb(fromHex(hex2)); }; var hsvToHex = function(hsv) { return fromRgba(fromHsv(hsv)); }; var anyToHex = function(color) { return fromString$1(color).orThunk(function() { return fromString(color).map(fromRgba); }).getOrThunk(function() { var canvas = document.createElement("canvas"); canvas.height = 1; canvas.width = 1; var canvasContext = canvas.getContext("2d"); canvasContext.clearRect(0, 0, canvas.width, canvas.height); canvasContext.fillStyle = "#FFFFFF"; canvasContext.fillStyle = color; canvasContext.fillRect(0, 0, 1, 1); var rgba = canvasContext.getImageData(0, 0, 1, 1).data; var r3 = rgba[0]; var g2 = rgba[1]; var b3 = rgba[2]; var a2 = rgba[3]; return fromRgba(rgbaColour(r3, g2, b3, a2)); }); }; var global$8 = tinymce.util.Tools.resolve("tinymce.util.LocalStorage"); var storageName = "tinymce-custom-colors"; function ColorCache(max5) { if (max5 === void 0) { max5 = 10; } var storageString = global$8.getItem(storageName); var localstorage = isString3(storageString) ? JSON.parse(storageString) : []; var prune = function(list) { var diff2 = max5 - list.length; return diff2 < 0 ? list.slice(0, max5) : list; }; var cache2 = prune(localstorage); var add4 = function(key2) { indexOf2(cache2, key2).each(remove4); cache2.unshift(key2); if (cache2.length > max5) { cache2.pop(); } global$8.setItem(storageName, JSON.stringify(cache2)); }; var remove4 = function(idx) { cache2.splice(idx, 1); }; var state = function() { return cache2.slice(0); }; return { add: add4, state }; } var choiceItem = "choiceitem"; var defaultColors = [ { type: choiceItem, text: "Light Green", value: "#BFEDD2" }, { type: choiceItem, text: "Light Yellow", value: "#FBEEB8" }, { type: choiceItem, text: "Light Red", value: "#F8CAC6" }, { type: choiceItem, text: "Light Purple", value: "#ECCAFA" }, { type: choiceItem, text: "Light Blue", value: "#C2E0F4" }, { type: choiceItem, text: "Green", value: "#2DC26B" }, { type: choiceItem, text: "Yellow", value: "#F1C40F" }, { type: choiceItem, text: "Red", value: "#E03E2D" }, { type: choiceItem, text: "Purple", value: "#B96AD9" }, { type: choiceItem, text: "Blue", value: "#3598DB" }, { type: choiceItem, text: "Dark Turquoise", value: "#169179" }, { type: choiceItem, text: "Orange", value: "#E67E23" }, { type: choiceItem, text: "Dark Red", value: "#BA372A" }, { type: choiceItem, text: "Dark Purple", value: "#843FA1" }, { type: choiceItem, text: "Dark Blue", value: "#236FA1" }, { type: choiceItem, text: "Light Gray", value: "#ECF0F1" }, { type: choiceItem, text: "Medium Gray", value: "#CED4D9" }, { type: choiceItem, text: "Gray", value: "#95A5A6" }, { type: choiceItem, text: "Dark Gray", value: "#7E8C8D" }, { type: choiceItem, text: "Navy Blue", value: "#34495E" }, { type: choiceItem, text: "Black", value: "#000000" }, { type: choiceItem, text: "White", value: "#ffffff" } ]; var colorCache = ColorCache(10); var mapColors = function(colorMap) { var colors = []; for (var i2 = 0; i2 < colorMap.length; i2 += 2) { colors.push({ text: colorMap[i2 + 1], value: "#" + anyToHex(colorMap[i2]).value, type: "choiceitem" }); } return colors; }; var getColorCols$2 = function(editor, defaultCols) { return editor.getParam("color_cols", defaultCols, "number"); }; var hasCustomColors$1 = function(editor) { return editor.getParam("custom_colors") !== false; }; var getColorMap = function(editor) { return editor.getParam("color_map"); }; var getColors$2 = function(editor) { var unmapped = getColorMap(editor); return unmapped !== void 0 ? mapColors(unmapped) : defaultColors; }; var getCurrentColors = function() { return map$2(colorCache.state(), function(color) { return { type: choiceItem, text: color, value: color }; }); }; var addColor = function(color) { colorCache.add(color); }; var fallbackColor = "#000000"; var getCurrentColor = function(editor, format3) { var color; editor.dom.getParents(editor.selection.getStart(), function(elm) { var value25; if (value25 = elm.style[format3 === "forecolor" ? "color" : "background-color"]) { color = color ? color : value25; } }); return Optional.from(color); }; var applyFormat = function(editor, format3, value25) { editor.undoManager.transact(function() { editor.focus(); editor.formatter.apply(format3, { value: value25 }); editor.nodeChanged(); }); }; var removeFormat = function(editor, format3) { editor.undoManager.transact(function() { editor.focus(); editor.formatter.remove(format3, { value: null }, null, true); editor.nodeChanged(); }); }; var registerCommands = function(editor) { editor.addCommand("mceApplyTextcolor", function(format3, value25) { applyFormat(editor, format3, value25); }); editor.addCommand("mceRemoveTextcolor", function(format3) { removeFormat(editor, format3); }); }; var calcCols = function(colors) { return Math.max(5, Math.ceil(Math.sqrt(colors))); }; var getColorCols$1 = function(editor) { var colors = getColors$2(editor); var defaultCols = calcCols(colors.length); return getColorCols$2(editor, defaultCols); }; var getAdditionalColors = function(hasCustom) { var type3 = "choiceitem"; var remove4 = { type: type3, text: "Remove color", icon: "color-swatch-remove-color", value: "remove" }; var custom2 = { type: type3, text: "Custom color", icon: "color-picker", value: "custom" }; return hasCustom ? [ remove4, custom2 ] : [remove4]; }; var applyColor = function(editor, format3, value25, onChoice) { if (value25 === "custom") { var dialog = colorPickerDialog(editor); dialog(function(colorOpt) { colorOpt.each(function(color) { addColor(color); editor.execCommand("mceApplyTextcolor", format3, color); onChoice(color); }); }, fallbackColor); } else if (value25 === "remove") { onChoice(""); editor.execCommand("mceRemoveTextcolor", format3); } else { onChoice(value25); editor.execCommand("mceApplyTextcolor", format3, value25); } }; var getColors$1 = function(colors, hasCustom) { return colors.concat(getCurrentColors().concat(getAdditionalColors(hasCustom))); }; var getFetch$1 = function(colors, hasCustom) { return function(callback2) { callback2(getColors$1(colors, hasCustom)); }; }; var setIconColor = function(splitButtonApi, name2, newColor) { var id2 = name2 === "forecolor" ? "tox-icon-text-color__color" : "tox-icon-highlight-bg-color__color"; splitButtonApi.setIconFill(id2, newColor); }; var registerTextColorButton = function(editor, name2, format3, tooltip, lastColor) { editor.ui.registry.addSplitButton(name2, { tooltip, presets: "color", icon: name2 === "forecolor" ? "text-color" : "highlight-bg-color", select: function(value25) { var optCurrentRgb = getCurrentColor(editor, format3); return optCurrentRgb.bind(function(currentRgb) { return fromString(currentRgb).map(function(rgba) { var currentHex = fromRgba(rgba).value; return contains$1(value25.toLowerCase(), currentHex); }); }).getOr(false); }, columns: getColorCols$1(editor), fetch: getFetch$1(getColors$2(editor), hasCustomColors$1(editor)), onAction: function(_splitButtonApi) { applyColor(editor, format3, lastColor.get(), noop2); }, onItemAction: function(_splitButtonApi, value25) { applyColor(editor, format3, value25, function(newColor) { lastColor.set(newColor); fireTextColorChange(editor, { name: name2, color: newColor }); }); }, onSetup: function(splitButtonApi) { setIconColor(splitButtonApi, name2, lastColor.get()); var handler7 = function(e2) { if (e2.name === name2) { setIconColor(splitButtonApi, e2.name, e2.color); } }; editor.on("TextColorChange", handler7); return function() { editor.off("TextColorChange", handler7); }; } }); }; var registerTextColorMenuItem = function(editor, name2, format3, text2) { editor.ui.registry.addNestedMenuItem(name2, { text: text2, icon: name2 === "forecolor" ? "text-color" : "highlight-bg-color", getSubmenuItems: function() { return [{ type: "fancymenuitem", fancytype: "colorswatch", onAction: function(data65) { applyColor(editor, format3, data65.value, noop2); } }]; } }); }; var colorPickerDialog = function(editor) { return function(callback2, value25) { var isValid4 = false; var onSubmit = function(api3) { var data65 = api3.getData(); var hex2 = data65.colorpicker; if (isValid4) { callback2(Optional.from(hex2)); api3.close(); } else { editor.windowManager.alert(editor.translate([ "Invalid hex color code: {0}", hex2 ])); } }; var onAction = function(_api2, details) { if (details.name === "hex-valid") { isValid4 = details.value; } }; var initialData = { colorpicker: value25 }; editor.windowManager.open({ title: "Color Picker", size: "normal", body: { type: "panel", items: [{ type: "colorpicker", name: "colorpicker", label: "Color" }] }, buttons: [ { type: "cancel", name: "cancel", text: "Cancel" }, { type: "submit", name: "save", text: "Save", primary: true } ], initialData, onAction, onSubmit, onClose: noop2, onCancel: function() { callback2(Optional.none()); } }); }; }; var register$a = function(editor) { registerCommands(editor); var lastForeColor = Cell3(fallbackColor); var lastBackColor = Cell3(fallbackColor); registerTextColorButton(editor, "forecolor", "forecolor", "Text color", lastForeColor); registerTextColorButton(editor, "backcolor", "hilitecolor", "Background color", lastBackColor); registerTextColorMenuItem(editor, "forecolor", "forecolor", "Text color"); registerTextColorMenuItem(editor, "backcolor", "hilitecolor", "Background color"); }; var createPartialChoiceMenu = function(value25, items, onItemValueHandler, columns2, presets, itemResponse, select3, providersBackstage) { var hasIcons = menuHasIcons(items); var presetItemTypes = presets !== "color" ? "normal" : "color"; var alloyItems = createChoiceItems(items, onItemValueHandler, columns2, presetItemTypes, itemResponse, select3, providersBackstage); return createPartialMenuWithAlloyItems(value25, hasIcons, alloyItems, columns2, presets); }; var createChoiceItems = function(items, onItemValueHandler, columns2, itemPresets, itemResponse, select3, providersBackstage) { return cat(map$2(items, function(item2) { if (item2.type === "choiceitem") { return createChoiceMenuItem(item2).fold(handleError, function(d2) { return Optional.some(renderChoiceItem(d2, columns2 === 1, itemPresets, onItemValueHandler, select3(item2.value), itemResponse, providersBackstage, menuHasIcons(items))); }); } else { return Optional.none(); } })); }; var deriveMenuMovement = function(columns2, presets) { var menuMarkers = markers(presets); if (columns2 === 1) { return { mode: "menu", moveOnTab: true }; } else if (columns2 === "auto") { return { mode: "grid", selector: "." + menuMarkers.item, initSize: { numColumns: 1, numRows: 1 } }; } else { var rowClass = presets === "color" ? "tox-swatches__row" : "tox-collection__group"; return { mode: "matrix", rowSelector: "." + rowClass }; } }; var deriveCollectionMovement = function(columns2, presets) { if (columns2 === 1) { return { mode: "menu", moveOnTab: false, selector: ".tox-collection__item" }; } else if (columns2 === "auto") { return { mode: "flatgrid", selector: ".tox-collection__item", initSize: { numColumns: 1, numRows: 1 } }; } else { return { mode: "matrix", selectors: { row: presets === "color" ? ".tox-swatches__row" : ".tox-collection__group", cell: presets === "color" ? "." + colorClass : "." + selectableClass } }; } }; var renderColorSwatchItem = function(spec, backstage) { var items = getColorItems(spec, backstage); var columns2 = backstage.colorinput.getColorCols(); var presets = "color"; var menuSpec = createPartialChoiceMenu(generate$6("menu-value"), items, function(value25) { spec.onAction({ value: value25 }); }, columns2, presets, ItemResponse$1.CLOSE_ON_EXECUTE, never, backstage.shared.providers); var widgetSpec = __assign(__assign({}, menuSpec), { markers: markers(presets), movement: deriveMenuMovement(columns2, presets) }); return { type: "widget", data: { value: generate$6("widget-id") }, dom: { tag: "div", classes: ["tox-fancymenuitem"] }, autofocus: true, components: [parts$f.widget(Menu2.sketch(widgetSpec))] }; }; var getColorItems = function(spec, backstage) { var useCustomColors = spec.initData.allowCustomColors && backstage.colorinput.hasCustomColors(); return spec.initData.colors.fold(function() { return getColors$1(backstage.colorinput.getColors(), useCustomColors); }, function(colors) { return colors.concat(getAdditionalColors(useCustomColors)); }); }; var cellOverEvent = generate$6("cell-over"); var cellExecuteEvent = generate$6("cell-execute"); var makeCell = function(row, col, labelId) { var _a4; var emitCellOver = function(c2) { return emitWith(c2, cellOverEvent, { row, col }); }; var emitExecute2 = function(c2) { return emitWith(c2, cellExecuteEvent, { row, col }); }; var onClick7 = function(c2, se) { se.stop(); emitExecute2(c2); }; return build$1({ dom: { tag: "div", attributes: (_a4 = { role: "button" }, _a4["aria-labelledby"] = labelId, _a4) }, behaviours: derive$1([ config3("insert-table-picker-cell", [ run$1(mouseover(), Focusing.focus), run$1(execute$5(), emitExecute2), run$1(click(), onClick7), run$1(tap(), onClick7) ]), Toggling.config({ toggleClass: "tox-insert-table-picker__selected", toggleOnExecute: false }), Focusing.config({ onFocus: emitCellOver }) ]) }); }; var makeCells = function(labelId, numRows, numCols) { var cells = []; for (var i2 = 0; i2 < numRows; i2++) { var row = []; for (var j2 = 0; j2 < numCols; j2++) { row.push(makeCell(i2, j2, labelId)); } cells.push(row); } return cells; }; var selectCells = function(cells, selectedRow, selectedColumn, numRows, numColumns) { for (var i2 = 0; i2 < numRows; i2++) { for (var j2 = 0; j2 < numColumns; j2++) { Toggling.set(cells[i2][j2], i2 <= selectedRow && j2 <= selectedColumn); } } }; var makeComponents = function(cells) { return bind$32(cells, function(cellRow) { return map$2(cellRow, premade); }); }; var makeLabelText = function(row, col) { return text$1(col + "x" + row); }; var renderInsertTableMenuItem = function(spec) { var numRows = 10; var numColumns = 10; var sizeLabelId = generate$6("size-label"); var cells = makeCells(sizeLabelId, numRows, numColumns); var emptyLabelText = makeLabelText(0, 0); var memLabel = record({ dom: { tag: "span", classes: ["tox-insert-table-picker__label"], attributes: { id: sizeLabelId } }, components: [emptyLabelText], behaviours: derive$1([Replacing.config({})]) }); return { type: "widget", data: { value: generate$6("widget-id") }, dom: { tag: "div", classes: ["tox-fancymenuitem"] }, autofocus: true, components: [parts$f.widget({ dom: { tag: "div", classes: ["tox-insert-table-picker"] }, components: makeComponents(cells).concat(memLabel.asSpec()), behaviours: derive$1([ config3("insert-table-picker", [ runOnAttached(function(c2) { Replacing.set(memLabel.get(c2), [emptyLabelText]); }), runWithTarget(cellOverEvent, function(c2, t3, e2) { var _a4 = e2.event, row = _a4.row, col = _a4.col; selectCells(cells, row, col, numRows, numColumns); Replacing.set(memLabel.get(c2), [makeLabelText(row + 1, col + 1)]); }), runWithTarget(cellExecuteEvent, function(c2, _2, e2) { var _a4 = e2.event, row = _a4.row, col = _a4.col; spec.onAction({ numRows: row + 1, numColumns: col + 1 }); emit2(c2, sandboxClose()); }) ]), Keying.config({ initSize: { numRows, numColumns }, mode: "flatgrid", selector: '[role="button"]' }) ]) })] }; }; var fancyMenuItems = { inserttable: renderInsertTableMenuItem, colorswatch: renderColorSwatchItem }; var renderFancyMenuItem = function(spec, backstage) { return get$e(fancyMenuItems, spec.fancytype).map(function(render124) { return render124(spec, backstage); }); }; var renderNestedItem = function(spec, itemResponse, providersBackstage, renderIcons, downwardsCaret) { if (renderIcons === void 0) { renderIcons = true; } if (downwardsCaret === void 0) { downwardsCaret = false; } var caret = downwardsCaret ? renderDownwardsCaret(providersBackstage.icons) : renderSubmenuCaret(providersBackstage.icons); var getApi2 = function(component) { return { isDisabled: function() { return Disabling.isDisabled(component); }, setDisabled: function(state) { return Disabling.set(component, state); } }; }; var structure = renderItemStructure({ presets: "normal", iconContent: spec.icon, textContent: spec.text, htmlContent: Optional.none(), ariaLabel: spec.text, caret: Optional.some(caret), checkMark: Optional.none(), shortcutContent: spec.shortcut }, providersBackstage, renderIcons); return renderCommonItem({ data: buildData(spec), getApi: getApi2, disabled: spec.disabled, onAction: noop2, onSetup: spec.onSetup, triggersSubmenu: true, itemBehaviours: [] }, structure, itemResponse, providersBackstage); }; var renderNormalItem = function(spec, itemResponse, providersBackstage, renderIcons) { if (renderIcons === void 0) { renderIcons = true; } var getApi2 = function(component) { return { isDisabled: function() { return Disabling.isDisabled(component); }, setDisabled: function(state) { return Disabling.set(component, state); } }; }; var structure = renderItemStructure({ presets: "normal", iconContent: spec.icon, textContent: spec.text, htmlContent: Optional.none(), ariaLabel: spec.text, caret: Optional.none(), checkMark: Optional.none(), shortcutContent: spec.shortcut }, providersBackstage, renderIcons); return renderCommonItem({ data: buildData(spec), getApi: getApi2, disabled: spec.disabled, onAction: spec.onAction, onSetup: spec.onSetup, triggersSubmenu: false, itemBehaviours: [] }, structure, itemResponse, providersBackstage); }; var renderSeparatorItem = function(spec) { var innerHtml = spec.text.fold(function() { return {}; }, function(text2) { return { innerHtml: text2 }; }); return { type: "separator", dom: __assign({ tag: "div", classes: [ selectableClass, groupHeadingClass ] }, innerHtml), components: [] }; }; var renderToggleMenuItem = function(spec, itemResponse, providersBackstage, renderIcons) { if (renderIcons === void 0) { renderIcons = true; } var getApi2 = function(component) { return { setActive: function(state) { Toggling.set(component, state); }, isActive: function() { return Toggling.isOn(component); }, isDisabled: function() { return Disabling.isDisabled(component); }, setDisabled: function(state) { return Disabling.set(component, state); } }; }; var structure = renderItemStructure({ iconContent: spec.icon, textContent: spec.text, htmlContent: Optional.none(), ariaLabel: spec.text, checkMark: Optional.some(renderCheckmark(providersBackstage.icons)), caret: Optional.none(), shortcutContent: spec.shortcut, presets: "normal", meta: spec.meta }, providersBackstage, renderIcons); return deepMerge2(renderCommonItem({ data: buildData(spec), disabled: spec.disabled, getApi: getApi2, onAction: spec.onAction, onSetup: spec.onSetup, triggersSubmenu: false, itemBehaviours: [] }, structure, itemResponse, providersBackstage), { toggling: { toggleClass: tickedClass, toggleOnExecute: false, selected: spec.active } }); }; var autocomplete = renderAutocompleteItem; var separator$3 = renderSeparatorItem; var normal = renderNormalItem; var nested = renderNestedItem; var toggle$1 = renderToggleMenuItem; var fancy = renderFancyMenuItem; var card = renderCardMenuItem; var FocusMode; (function(FocusMode2) { FocusMode2[FocusMode2["ContentFocus"] = 0] = "ContentFocus"; FocusMode2[FocusMode2["UiFocus"] = 1] = "UiFocus"; })(FocusMode || (FocusMode = {})); var createMenuItemFromBridge = function(item2, itemResponse, backstage, menuHasIcons2, isHorizontalMenu) { var providersBackstage = backstage.shared.providers; var parseForHorizontalMenu = function(menuitem) { return !isHorizontalMenu ? menuitem : __assign(__assign({}, menuitem), { shortcut: Optional.none(), icon: menuitem.text.isSome() ? Optional.none() : menuitem.icon }); }; switch (item2.type) { case "menuitem": return createMenuItem(item2).fold(handleError, function(d2) { return Optional.some(normal(parseForHorizontalMenu(d2), itemResponse, providersBackstage, menuHasIcons2)); }); case "nestedmenuitem": return createNestedMenuItem(item2).fold(handleError, function(d2) { return Optional.some(nested(parseForHorizontalMenu(d2), itemResponse, providersBackstage, menuHasIcons2, isHorizontalMenu)); }); case "togglemenuitem": return createToggleMenuItem(item2).fold(handleError, function(d2) { return Optional.some(toggle$1(parseForHorizontalMenu(d2), itemResponse, providersBackstage, menuHasIcons2)); }); case "separator": return createSeparatorMenuItem(item2).fold(handleError, function(d2) { return Optional.some(separator$3(d2)); }); case "fancymenuitem": return createFancyMenuItem(item2).fold(handleError, function(d2) { return fancy(parseForHorizontalMenu(d2), backstage); }); default: { console.error("Unknown item in general menu", item2); return Optional.none(); } } }; var createAutocompleteItems = function(items, matchText, onItemValueHandler, columns2, itemResponse, sharedBackstage, highlightOn) { var renderText2 = columns2 === 1; var renderIcons = !renderText2 || menuHasIcons(items); return cat(map$2(items, function(item2) { switch (item2.type) { case "separator": return createSeparatorItem(item2).fold(handleError, function(d2) { return Optional.some(separator$3(d2)); }); case "cardmenuitem": return createCardMenuItem(item2).fold(handleError, function(d2) { return Optional.some(card(__assign(__assign({}, d2), { onAction: function(api3) { d2.onAction(api3); onItemValueHandler(d2.value, d2.meta); } }), itemResponse, sharedBackstage, { itemBehaviours: tooltipBehaviour(d2.meta, sharedBackstage), cardText: { matchText, highlightOn } })); }); case "autocompleteitem": default: return createAutocompleterItem(item2).fold(handleError, function(d2) { return Optional.some(autocomplete(d2, matchText, renderText2, "normal", onItemValueHandler, itemResponse, sharedBackstage, renderIcons)); }); } })); }; var createPartialMenu = function(value25, items, itemResponse, backstage, isHorizontalMenu) { var hasIcons = menuHasIcons(items); var alloyItems = cat(map$2(items, function(item2) { var itemHasIcon = function(i2) { return isHorizontalMenu ? !has$22(i2, "text") : hasIcons; }; var createItem = function(i2) { return createMenuItemFromBridge(i2, itemResponse, backstage, itemHasIcon(i2), isHorizontalMenu); }; if (item2.type === "nestedmenuitem" && item2.getSubmenuItems().length <= 0) { return createItem(__assign(__assign({}, item2), { disabled: true })); } else { return createItem(item2); } })); var createPartial = isHorizontalMenu ? createHorizontalPartialMenuWithAlloyItems : createPartialMenuWithAlloyItems; return createPartial(value25, hasIcons, alloyItems, 1, "normal"); }; var createTieredDataFrom = function(partialMenu) { return tieredMenu.singleData(partialMenu.value, partialMenu); }; var createMenuFrom = function(partialMenu, columns2, focusMode, presets) { var focusManager = focusMode === FocusMode.ContentFocus ? highlights() : dom$2(); var movement = deriveMenuMovement(columns2, presets); var menuMarkers = markers(presets); return { dom: partialMenu.dom, components: partialMenu.components, items: partialMenu.items, value: partialMenu.value, markers: { selectedItem: menuMarkers.selectedItem, item: menuMarkers.item }, movement, fakeFocus: focusMode === FocusMode.ContentFocus, focusManager, menuBehaviours: SimpleBehaviours.unnamedEvents(columns2 !== "auto" ? [] : [runOnAttached(function(comp, _se) { detectSize(comp, 4, menuMarkers.item).each(function(_a4) { var numColumns = _a4.numColumns, numRows = _a4.numRows; Keying.setGridSize(comp, numRows, numColumns); }); })]) }; }; var register$9 = function(editor, sharedBackstage) { var activeAutocompleter = value$1(); var processingAction = Cell3(false); var autocompleter = build$1(InlineView.sketch({ dom: { tag: "div", classes: ["tox-autocompleter"] }, components: [], fireDismissalEventInstead: {}, inlineBehaviours: derive$1([config3("dismissAutocompleter", [run$1(dismissRequested(), function() { return cancelIfNecessary(); })])]), lazySink: sharedBackstage.getSink })); var isMenuOpen = function() { return InlineView.isOpen(autocompleter); }; var isActive = function() { return activeAutocompleter.get().isSome(); }; var hideIfNecessary = function() { if (isActive()) { InlineView.hide(autocompleter); } }; var cancelIfNecessary = function() { if (isActive()) { var lastElement = activeAutocompleter.get().map(function(ac) { return ac.element; }); detect(lastElement.getOr(SugarElement.fromDom(editor.selection.getNode()))).each(unwrap); hideIfNecessary(); activeAutocompleter.clear(); processingAction.set(false); } }; var getAutocompleters = cached2(function() { return register$b(editor); }); var getCombinedItems = function(triggerChar, matches) { var columns2 = findMap(matches, function(m2) { return Optional.from(m2.columns); }).getOr(1); return bind$32(matches, function(match5) { var choices = match5.items; return createAutocompleteItems(choices, match5.matchText, function(itemValue, itemMeta) { var nr = editor.selection.getRng(); getContext(editor.dom, nr, triggerChar).fold(function() { return console.error("Lost context. Cursor probably moved"); }, function(_a4) { var range3 = _a4.range; var autocompleterApi = { hide: function() { cancelIfNecessary(); }, reload: function(fetchOptions) { hideIfNecessary(); load(fetchOptions); } }; processingAction.set(true); match5.onAction(autocompleterApi, range3, itemValue, itemMeta); processingAction.set(false); }); }, columns2, ItemResponse$1.BUBBLE_TO_SANDBOX, sharedBackstage, match5.highlightOn); }); }; var commenceIfNecessary = function(context2) { if (!isActive()) { var wrapper = create$5(editor, context2.range); activeAutocompleter.set({ triggerChar: context2.triggerChar, element: wrapper, matchLength: context2.text.length }); processingAction.set(false); } }; var display = function(ac, context2, lookupData, items) { ac.matchLength = context2.text.length; var columns2 = findMap(lookupData, function(ld) { return Optional.from(ld.columns); }).getOr(1); InlineView.showAt(autocompleter, Menu2.sketch(createMenuFrom(createPartialMenuWithAlloyItems("autocompleter-value", true, items, columns2, "normal"), columns2, FocusMode.ContentFocus, "normal")), { anchor: { type: "node", root: SugarElement.fromDom(editor.getBody()), node: Optional.from(ac.element) } }); InlineView.getContent(autocompleter).each(Highlighting.highlightFirst); }; var doLookup = function(fetchOptions) { return activeAutocompleter.get().map(function(ac) { return getContext(editor.dom, editor.selection.getRng(), ac.triggerChar).bind(function(newContext) { return lookupWithContext(editor, getAutocompleters, newContext, fetchOptions); }); }).getOrThunk(function() { return lookup$2(editor, getAutocompleters); }); }; var load = function(fetchOptions) { doLookup(fetchOptions).fold(cancelIfNecessary, function(lookupInfo) { commenceIfNecessary(lookupInfo.context); lookupInfo.lookupData.then(function(lookupData) { activeAutocompleter.get().map(function(ac) { var context2 = lookupInfo.context; if (ac.triggerChar === context2.triggerChar) { var combinedItems = getCombinedItems(context2.triggerChar, lookupData); if (combinedItems.length > 0) { display(ac, context2, lookupData, combinedItems); } else if (context2.text.length - ac.matchLength >= 10) { cancelIfNecessary(); } else { hideIfNecessary(); } } }); }); }); }; var onKeypress = last2(function(e2) { if (e2.which === 27) { return; } load(); }, 50); var autocompleterUiApi = { onKeypress, cancelIfNecessary, isMenuOpen, isActive, isProcessingAction: processingAction.get, getView: function() { return InlineView.getContent(autocompleter); } }; if (editor.hasPlugin("rtc") === false) { AutocompleterEditorEvents.setup(autocompleterUiApi, editor); } }; var Autocompleter = { register: register$9 }; var closest = function(scope, selector2, isRoot) { return closest$1(scope, selector2, isRoot).isSome(); }; var DelayedFunction = function(fun, delay) { var ref2 = null; var schedule = function() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } ref2 = setTimeout(function() { fun.apply(null, args); ref2 = null; }, delay); }; var cancel2 = function() { if (ref2 !== null) { clearTimeout(ref2); ref2 = null; } }; return { cancel: cancel2, schedule }; }; var SIGNIFICANT_MOVE = 5; var LONGPRESS_DELAY = 400; var getTouch = function(event) { var raw = event.raw; if (raw.touches === void 0 || raw.touches.length !== 1) { return Optional.none(); } return Optional.some(raw.touches[0]); }; var isFarEnough = function(touch2, data65) { var distX = Math.abs(touch2.clientX - data65.x); var distY = Math.abs(touch2.clientY - data65.y); return distX > SIGNIFICANT_MOVE || distY > SIGNIFICANT_MOVE; }; var monitor = function(settings) { var startData = value$1(); var longpressFired = Cell3(false); var longpress$1 = DelayedFunction(function(event) { settings.triggerEvent(longpress(), event); longpressFired.set(true); }, LONGPRESS_DELAY); var handleTouchstart = function(event) { getTouch(event).each(function(touch2) { longpress$1.cancel(); var data65 = { x: touch2.clientX, y: touch2.clientY, target: event.target }; longpress$1.schedule(event); longpressFired.set(false); startData.set(data65); }); return Optional.none(); }; var handleTouchmove = function(event) { longpress$1.cancel(); getTouch(event).each(function(touch2) { startData.on(function(data65) { if (isFarEnough(touch2, data65)) { startData.clear(); } }); }); return Optional.none(); }; var handleTouchend = function(event) { longpress$1.cancel(); var isSame2 = function(data65) { return eq2(data65.target, event.target); }; return startData.get().filter(isSame2).map(function(_data) { if (longpressFired.get()) { event.prevent(); return false; } else { return settings.triggerEvent(tap(), event); } }); }; var handlers2 = wrapAll([ { key: touchstart(), value: handleTouchstart }, { key: touchmove(), value: handleTouchmove }, { key: touchend(), value: handleTouchend } ]); var fireIfReady = function(event, type3) { return get$e(handlers2, type3).bind(function(handler7) { return handler7(event); }); }; return { fireIfReady }; }; var isDangerous = function(event) { var keyEv = event.raw; return keyEv.which === BACKSPACE[0] && !contains$2([ "input", "textarea" ], name$2(event.target)) && !closest(event.target, '[contenteditable="true"]'); }; var isFirefox = function() { return detect$1().browser.isFirefox(); }; var bindFocus = function(container, handler7) { if (isFirefox()) { return capture(container, "focus", handler7); } else { return bind4(container, "focusin", handler7); } }; var bindBlur = function(container, handler7) { if (isFirefox()) { return capture(container, "blur", handler7); } else { return bind4(container, "focusout", handler7); } }; var setup$d = function(container, rawSettings) { var settings = __assign({ stopBackspace: true }, rawSettings); var pointerEvents2 = [ "touchstart", "touchmove", "touchend", "touchcancel", "gesturestart", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "click" ]; var tapEvent = monitor(settings); var simpleEvents = map$2(pointerEvents2.concat([ "selectstart", "input", "contextmenu", "change", "transitionend", "transitioncancel", "drag", "dragstart", "dragend", "dragenter", "dragleave", "dragover", "drop", "keyup" ]), function(type3) { return bind4(container, type3, function(event) { tapEvent.fireIfReady(event, type3).each(function(tapStopped) { if (tapStopped) { event.kill(); } }); var stopped = settings.triggerEvent(type3, event); if (stopped) { event.kill(); } }); }); var pasteTimeout = value$1(); var onPaste = bind4(container, "paste", function(event) { tapEvent.fireIfReady(event, "paste").each(function(tapStopped) { if (tapStopped) { event.kill(); } }); var stopped = settings.triggerEvent("paste", event); if (stopped) { event.kill(); } pasteTimeout.set(setTimeout(function() { settings.triggerEvent(postPaste(), event); }, 0)); }); var onKeydown2 = bind4(container, "keydown", function(event) { var stopped = settings.triggerEvent("keydown", event); if (stopped) { event.kill(); } else if (settings.stopBackspace && isDangerous(event)) { event.prevent(); } }); var onFocusIn = bindFocus(container, function(event) { var stopped = settings.triggerEvent("focusin", event); if (stopped) { event.kill(); } }); var focusoutTimeout = value$1(); var onFocusOut = bindBlur(container, function(event) { var stopped = settings.triggerEvent("focusout", event); if (stopped) { event.kill(); } focusoutTimeout.set(setTimeout(function() { settings.triggerEvent(postBlur(), event); }, 0)); }); var unbind2 = function() { each$12(simpleEvents, function(e2) { e2.unbind(); }); onKeydown2.unbind(); onFocusIn.unbind(); onFocusOut.unbind(); onPaste.unbind(); pasteTimeout.on(clearTimeout); focusoutTimeout.on(clearTimeout); }; return { unbind: unbind2 }; }; var derive = function(rawEvent, rawTarget) { var source2 = get$e(rawEvent, "target").getOr(rawTarget); return Cell3(source2); }; var fromSource = function(event, source2) { var stopper2 = Cell3(false); var cutter2 = Cell3(false); var stop3 = function() { stopper2.set(true); }; var cut = function() { cutter2.set(true); }; return { stop: stop3, cut, isStopped: stopper2.get, isCut: cutter2.get, event, setSource: source2.set, getSource: source2.get }; }; var fromExternal = function(event) { var stopper2 = Cell3(false); var stop3 = function() { stopper2.set(true); }; return { stop: stop3, cut: noop2, isStopped: stopper2.get, isCut: never, event, setSource: die("Cannot set source of a broadcasted event"), getSource: die("Cannot get source of a broadcasted event") }; }; var adt$1 = Adt.generate([ { stopped: [] }, { resume: ["element"] }, { complete: [] } ]); var doTriggerHandler = function(lookup2, eventType, rawEvent, target, source2, logger) { var handler7 = lookup2(eventType, target); var simulatedEvent = fromSource(rawEvent, source2); return handler7.fold(function() { logger.logEventNoHandlers(eventType, target); return adt$1.complete(); }, function(handlerInfo) { var descHandler = handlerInfo.descHandler; var eventHandler2 = getCurried(descHandler); eventHandler2(simulatedEvent); if (simulatedEvent.isStopped()) { logger.logEventStopped(eventType, handlerInfo.element, descHandler.purpose); return adt$1.stopped(); } else if (simulatedEvent.isCut()) { logger.logEventCut(eventType, handlerInfo.element, descHandler.purpose); return adt$1.complete(); } else { return parent2(handlerInfo.element).fold(function() { logger.logNoParent(eventType, handlerInfo.element, descHandler.purpose); return adt$1.complete(); }, function(parent3) { logger.logEventResponse(eventType, handlerInfo.element, descHandler.purpose); return adt$1.resume(parent3); }); } }); }; var doTriggerOnUntilStopped = function(lookup2, eventType, rawEvent, rawTarget, source2, logger) { return doTriggerHandler(lookup2, eventType, rawEvent, rawTarget, source2, logger).fold(always, function(parent3) { return doTriggerOnUntilStopped(lookup2, eventType, rawEvent, parent3, source2, logger); }, never); }; var triggerHandler = function(lookup2, eventType, rawEvent, target, logger) { var source2 = derive(rawEvent, target); return doTriggerHandler(lookup2, eventType, rawEvent, target, source2, logger); }; var broadcast = function(listeners, rawEvent, _logger) { var simulatedEvent = fromExternal(rawEvent); each$12(listeners, function(listener) { var descHandler = listener.descHandler; var handler7 = getCurried(descHandler); handler7(simulatedEvent); }); return simulatedEvent.isStopped(); }; var triggerUntilStopped = function(lookup2, eventType, rawEvent, logger) { return triggerOnUntilStopped(lookup2, eventType, rawEvent, rawEvent.target, logger); }; var triggerOnUntilStopped = function(lookup2, eventType, rawEvent, rawTarget, logger) { var source2 = derive(rawEvent, rawTarget); return doTriggerOnUntilStopped(lookup2, eventType, rawEvent, rawTarget, source2, logger); }; var eventHandler = function(element2, descHandler) { return { element: element2, descHandler }; }; var broadcastHandler = function(id2, handler7) { return { id: id2, descHandler: handler7 }; }; var EventRegistry = function() { var registry = {}; var registerId = function(extraArgs, id2, events2) { each2(events2, function(v2, k2) { var handlers2 = registry[k2] !== void 0 ? registry[k2] : {}; handlers2[id2] = curryArgs(v2, extraArgs); registry[k2] = handlers2; }); }; var findHandler = function(handlers2, elem) { return read$1(elem).bind(function(id2) { return get$e(handlers2, id2); }).map(function(descHandler) { return eventHandler(elem, descHandler); }); }; var filterByType = function(type3) { return get$e(registry, type3).map(function(handlers2) { return mapToArray2(handlers2, function(f2, id2) { return broadcastHandler(id2, f2); }); }).getOr([]); }; var find3 = function(isAboveRoot, type3, target) { return get$e(registry, type3).bind(function(handlers2) { return closest$4(target, function(elem) { return findHandler(handlers2, elem); }, isAboveRoot); }); }; var unregisterId = function(id2) { each2(registry, function(handlersById, _eventName) { if (has$22(handlersById, id2)) { delete handlersById[id2]; } }); }; return { registerId, unregisterId, filterByType, find: find3 }; }; var Registry = function() { var events2 = EventRegistry(); var components4 = {}; var readOrTag = function(component) { var elem = component.element; return read$1(elem).getOrThunk(function() { return write("uid-", component.element); }); }; var failOnDuplicate = function(component, tagId) { var conflict = components4[tagId]; if (conflict === component) { unregister2(component); } else { throw new Error('The tagId "' + tagId + '" is already used by: ' + element(conflict.element) + "\nCannot use it for: " + element(component.element) + "\nThe conflicting element is" + (inBody(conflict.element) ? " " : " not ") + "already in the DOM"); } }; var register4 = function(component) { var tagId = readOrTag(component); if (hasNonNullableKey(components4, tagId)) { failOnDuplicate(component, tagId); } var extraArgs = [component]; events2.registerId(extraArgs, tagId, component.events); components4[tagId] = component; }; var unregister2 = function(component) { read$1(component.element).each(function(tagId) { delete components4[tagId]; events2.unregisterId(tagId); }); }; var filter2 = function(type3) { return events2.filterByType(type3); }; var find3 = function(isAboveRoot, type3, target) { return events2.find(isAboveRoot, type3, target); }; var getById = function(id2) { return get$e(components4, id2); }; return { find: find3, filter: filter2, register: register4, unregister: unregister2, getById }; }; var factory$j = function(detail) { var _a4 = detail.dom, attributes2 = _a4.attributes, domWithoutAttributes = __rest2(_a4, ["attributes"]); return { uid: detail.uid, dom: __assign({ tag: "div", attributes: __assign({ role: "presentation" }, attributes2) }, domWithoutAttributes), components: detail.components, behaviours: get$22(detail.containerBehaviours), events: detail.events, domModification: detail.domModification, eventOrder: detail.eventOrder }; }; var Container = single({ name: "Container", factory: factory$j, configFields: [ defaulted("components", []), field("containerBehaviours", []), defaulted("events", {}), defaulted("domModification", {}), defaulted("eventOrder", {}) ] }); var takeover = function(root2) { var isAboveRoot = function(el) { return parent2(root2.element).fold(always, function(parent3) { return eq2(el, parent3); }); }; var registry = Registry(); var lookup2 = function(eventName, target) { return registry.find(isAboveRoot, eventName, target); }; var domEvents = setup$d(root2.element, { triggerEvent: function(eventName, event) { return monitorEvent(eventName, event.target, function(logger) { return triggerUntilStopped(lookup2, eventName, event, logger); }); } }); var systemApi = { debugInfo: constant$1("real"), triggerEvent: function(eventName, target, data65) { monitorEvent(eventName, target, function(logger) { return triggerOnUntilStopped(lookup2, eventName, data65, target, logger); }); }, triggerFocus: function(target, originator) { read$1(target).fold(function() { focus$3(target); }, function(_alloyId) { monitorEvent(focus$4(), target, function(logger) { triggerHandler(lookup2, focus$4(), { originator, kill: noop2, prevent: noop2, target }, target, logger); return false; }); }); }, triggerEscape: function(comp, simulatedEvent) { systemApi.triggerEvent("keydown", comp.element, simulatedEvent.event); }, getByUid: function(uid2) { return getByUid(uid2); }, getByDom: function(elem) { return getByDom(elem); }, build: build$1, addToGui: function(c2) { add4(c2); }, removeFromGui: function(c2) { remove4(c2); }, addToWorld: function(c2) { addToWorld(c2); }, removeFromWorld: function(c2) { removeFromWorld(c2); }, broadcast: function(message2) { broadcast$1(message2); }, broadcastOn: function(channels, message2) { broadcastOn(channels, message2); }, broadcastEvent: function(eventName, event) { broadcastEvent(eventName, event); }, isConnected: always }; var addToWorld = function(component) { component.connect(systemApi); if (!isText$1(component.element)) { registry.register(component); each$12(component.components(), addToWorld); systemApi.triggerEvent(systemInit(), component.element, { target: component.element }); } }; var removeFromWorld = function(component) { if (!isText$1(component.element)) { each$12(component.components(), removeFromWorld); registry.unregister(component); } component.disconnect(); }; var add4 = function(component) { attach(root2, component); }; var remove4 = function(component) { detach(component); }; var destroy3 = function() { domEvents.unbind(); remove$5(root2.element); }; var broadcastData = function(data65) { var receivers = registry.filter(receive()); each$12(receivers, function(receiver) { var descHandler = receiver.descHandler; var handler7 = getCurried(descHandler); handler7(data65); }); }; var broadcast$1 = function(message2) { broadcastData({ universal: true, data: message2 }); }; var broadcastOn = function(channels, message2) { broadcastData({ universal: false, channels, data: message2 }); }; var broadcastEvent = function(eventName, event) { var listeners = registry.filter(eventName); return broadcast(listeners, event); }; var getByUid = function(uid2) { return registry.getById(uid2).fold(function() { return Result.error(new Error('Could not find component with uid: "' + uid2 + '" in system.')); }, Result.value); }; var getByDom = function(elem) { var uid2 = read$1(elem).getOr("not found"); return getByUid(uid2); }; addToWorld(root2); return { root: root2, element: root2.element, destroy: destroy3, add: add4, remove: remove4, getByUid, getByDom, addToWorld, removeFromWorld, broadcast: broadcast$1, broadcastOn, broadcastEvent }; }; var renderBar = function(spec, backstage) { return { dom: { tag: "div", classes: [ "tox-bar", "tox-form__controls-h-stack" ] }, components: map$2(spec.items, backstage.interpreter) }; }; var schema$l = constant$1([ defaulted("prefix", "form-field"), field("fieldBehaviours", [ Composing, Representing ]) ]); var parts$e = constant$1([ optional({ schema: [required$12("dom")], name: "label" }), optional({ factory: { sketch: function(spec) { return { uid: spec.uid, dom: { tag: "span", styles: { display: "none" }, attributes: { "aria-hidden": "true" }, innerHtml: spec.text } }; } }, schema: [required$12("text")], name: "aria-descriptor" }), required2({ factory: { sketch: function(spec) { var excludeFactory = exclude(spec, ["factory"]); return spec.factory.sketch(excludeFactory); } }, schema: [required$12("factory")], name: "field" }) ]); var factory$i = function(detail, components4, _spec, _externals) { var behaviours2 = augment(detail.fieldBehaviours, [ Composing.config({ find: function(container) { return getPart(container, detail, "field"); } }), Representing.config({ store: { mode: "manual", getValue: function(field2) { return Composing.getCurrent(field2).bind(Representing.getValue); }, setValue: function(field2, value25) { Composing.getCurrent(field2).each(function(current2) { Representing.setValue(current2, value25); }); } } }) ]); var events2 = derive$2([runOnAttached(function(component, _simulatedEvent) { var ps = getParts(component, detail, [ "label", "field", "aria-descriptor" ]); ps.field().each(function(field2) { var id2 = generate$6(detail.prefix); ps.label().each(function(label) { set$8(label.element, "for", id2); set$8(field2.element, "id", id2); }); ps["aria-descriptor"]().each(function(descriptor) { var descriptorId = generate$6(detail.prefix); set$8(descriptor.element, "id", descriptorId); set$8(field2.element, "aria-describedby", descriptorId); }); }); })]); var apis = { getField: function(container) { return getPart(container, detail, "field"); }, getLabel: function(container) { return getPart(container, detail, "label"); } }; return { uid: detail.uid, dom: detail.dom, components: components4, behaviours: behaviours2, events: events2, apis }; }; var FormField = composite({ name: "FormField", configFields: schema$l(), partFields: parts$e(), factory: factory$i, apis: { getField: function(apis, comp) { return apis.getField(comp); }, getLabel: function(apis, comp) { return apis.getLabel(comp); } } }); var exhibit$2 = function(base2, tabConfig) { return nu$7({ attributes: wrapAll([{ key: tabConfig.tabAttr, value: "true" }]) }); }; var ActiveTabstopping = /* @__PURE__ */ Object.freeze({ __proto__: null, exhibit: exhibit$2 }); var TabstopSchema = [defaulted("tabAttr", "data-alloy-tabstop")]; var Tabstopping = create$8({ fields: TabstopSchema, name: "tabstopping", active: ActiveTabstopping }); var global$7 = tinymce.util.Tools.resolve("tinymce.html.Entities"); var renderFormFieldWith = function(pLabel, pField, extraClasses, extraBehaviours) { var spec = renderFormFieldSpecWith(pLabel, pField, extraClasses, extraBehaviours); return FormField.sketch(spec); }; var renderFormField = function(pLabel, pField) { return renderFormFieldWith(pLabel, pField, [], []); }; var renderFormFieldSpecWith = function(pLabel, pField, extraClasses, extraBehaviours) { return { dom: renderFormFieldDomWith(extraClasses), components: pLabel.toArray().concat([pField]), fieldBehaviours: derive$1(extraBehaviours) }; }; var renderFormFieldDom = function() { return renderFormFieldDomWith([]); }; var renderFormFieldDomWith = function(extraClasses) { return { tag: "div", classes: ["tox-form__group"].concat(extraClasses) }; }; var renderLabel$2 = function(label, providersBackstage) { return FormField.parts.label({ dom: { tag: "label", classes: ["tox-label"], innerHtml: providersBackstage.translate(label) } }); }; var formChangeEvent = generate$6("form-component-change"); var formCloseEvent = generate$6("form-close"); var formCancelEvent = generate$6("form-cancel"); var formActionEvent = generate$6("form-action"); var formSubmitEvent = generate$6("form-submit"); var formBlockEvent = generate$6("form-block"); var formUnblockEvent = generate$6("form-unblock"); var formTabChangeEvent = generate$6("form-tabchange"); var formResizeEvent = generate$6("form-resize"); var renderCollection = function(spec, providersBackstage) { var _a4; var pLabel = spec.label.map(function(label) { return renderLabel$2(label, providersBackstage); }); var runOnItem = function(f2) { return function(comp, se) { closest$1(se.event.target, "[data-collection-item-value]").each(function(target) { f2(comp, se, target, get$d(target, "data-collection-item-value")); }); }; }; var setContents = function(comp, items) { var htmlLines = map$2(items, function(item2) { var itemText = global$e.translate(item2.text); var textContent = spec.columns === 1 ? '
    ' + itemText + "
    " : ""; var iconContent = '
    ' + item2.icon + "
    "; var mapItemName = { "_": " ", " - ": " ", "-": " " }; var ariaLabel = itemText.replace(/\_| \- |\-/g, function(match5) { return mapItemName[match5]; }); var disabledClass = providersBackstage.isDisabled() ? " tox-collection__item--state-disabled" : ""; return '
    ' + iconContent + textContent + "
    "; }); var chunks = spec.columns !== "auto" && spec.columns > 1 ? chunk$1(htmlLines, spec.columns) : [htmlLines]; var html2 = map$2(chunks, function(ch) { return '
    ' + ch.join("") + "
    "; }); set$5(comp.element, html2.join("")); }; var onClick7 = runOnItem(function(comp, se, tgt, itemValue) { se.stop(); if (!providersBackstage.isDisabled()) { emitWith(comp, formActionEvent, { name: spec.name, value: itemValue }); } }); var collectionEvents = [ run$1(mouseover(), runOnItem(function(comp, se, tgt) { focus$3(tgt); })), run$1(click(), onClick7), run$1(tap(), onClick7), run$1(focusin(), runOnItem(function(comp, se, tgt) { descendant(comp.element, "." + activeClass).each(function(currentActive) { remove$2(currentActive, activeClass); }); add$2(tgt, activeClass); })), run$1(focusout(), runOnItem(function(comp) { descendant(comp.element, "." + activeClass).each(function(currentActive) { remove$2(currentActive, activeClass); }); })), runOnExecute$1(runOnItem(function(comp, se, tgt, itemValue) { emitWith(comp, formActionEvent, { name: spec.name, value: itemValue }); })) ]; var iterCollectionItems = function(comp, applyAttributes) { return map$2(descendants(comp.element, ".tox-collection__item"), applyAttributes); }; var pField = FormField.parts.field({ dom: { tag: "div", classes: ["tox-collection"].concat(spec.columns !== 1 ? ["tox-collection--grid"] : ["tox-collection--list"]) }, components: [], factory: { sketch: identity$1 }, behaviours: derive$1([ Disabling.config({ disabled: providersBackstage.isDisabled, onDisabled: function(comp) { iterCollectionItems(comp, function(childElm) { add$2(childElm, "tox-collection__item--state-disabled"); set$8(childElm, "aria-disabled", true); }); }, onEnabled: function(comp) { iterCollectionItems(comp, function(childElm) { remove$2(childElm, "tox-collection__item--state-disabled"); remove$7(childElm, "aria-disabled"); }); } }), receivingConfig(), Replacing.config({}), Representing.config({ store: { mode: "memory", initialValue: [] }, onSetValue: function(comp, items) { setContents(comp, items); if (spec.columns === "auto") { detectSize(comp, 5, "tox-collection__item").each(function(_a5) { var numRows = _a5.numRows, numColumns = _a5.numColumns; Keying.setGridSize(comp, numRows, numColumns); }); } emit2(comp, formResizeEvent); } }), Tabstopping.config({}), Keying.config(deriveCollectionMovement(spec.columns, "normal")), config3("collection-events", collectionEvents) ]), eventOrder: (_a4 = {}, _a4[execute$5()] = [ "disabling", "alloy.base.behaviour", "collection-events" ], _a4) }); var extraClasses = ["tox-form__group--collection"]; return renderFormFieldWith(pLabel, pField, extraClasses, []); }; var schema$k = constant$1([ option("data"), defaulted("inputAttributes", {}), defaulted("inputStyles", {}), defaulted("tag", "input"), defaulted("inputClasses", []), onHandler("onSetValue"), defaulted("styles", {}), defaulted("eventOrder", {}), field("inputBehaviours", [ Representing, Focusing ]), defaulted("selectOnFocus", true) ]); var focusBehaviours = function(detail) { return derive$1([Focusing.config({ onFocus: !detail.selectOnFocus ? noop2 : function(component) { var input2 = component.element; var value25 = get$5(input2); input2.dom.setSelectionRange(0, value25.length); } })]); }; var behaviours = function(detail) { return __assign(__assign({}, focusBehaviours(detail)), augment(detail.inputBehaviours, [Representing.config({ store: __assign(__assign({ mode: "manual" }, detail.data.map(function(data65) { return { initialValue: data65 }; }).getOr({})), { getValue: function(input2) { return get$5(input2.element); }, setValue: function(input2, data65) { var current2 = get$5(input2.element); if (current2 !== data65) { set$4(input2.element, data65); } } }), onSetValue: detail.onSetValue })])); }; var dom = function(detail) { return { tag: detail.tag, attributes: __assign({ type: "text" }, detail.inputAttributes), styles: detail.inputStyles, classes: detail.inputClasses }; }; var factory$h = function(detail, _spec) { return { uid: detail.uid, dom: dom(detail), components: [], behaviours: behaviours(detail), eventOrder: detail.eventOrder }; }; var Input2 = single({ name: "Input", configFields: schema$k(), factory: factory$h }); var exports$1 = {}, module2 = { exports: exports$1 }; (function(define2, exports2, module3, require2) { (function(global2, factory2) { typeof exports2 === "object" && typeof module3 !== "undefined" ? module3.exports = factory2() : typeof define2 === "function" && define2.amd ? define2(factory2) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.EphoxContactWrapper = factory2()); })(this, function() { var commonjsGlobal$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : {}; var promise = { exports: {} }; (function(module4) { (function(root2) { var setTimeoutFunc = setTimeout; function noop3() { } function bind5(fn, thisArg) { return function() { fn.apply(thisArg, arguments); }; } function Promise2(fn) { if (typeof this !== "object") throw new TypeError("Promises must be constructed via new"); if (typeof fn !== "function") throw new TypeError("not a function"); this._state = 0; this._handled = false; this._value = void 0; this._deferreds = []; doResolve(fn, this); } function handle2(self2, deferred) { while (self2._state === 3) { self2 = self2._value; } if (self2._state === 0) { self2._deferreds.push(deferred); return; } self2._handled = true; Promise2._immediateFn(function() { var cb = self2._state === 1 ? deferred.onFulfilled : deferred.onRejected; if (cb === null) { (self2._state === 1 ? resolve : reject)(deferred.promise, self2._value); return; } var ret; try { ret = cb(self2._value); } catch (e2) { reject(deferred.promise, e2); return; } resolve(deferred.promise, ret); }); } function resolve(self2, newValue) { try { if (newValue === self2) throw new TypeError("A promise cannot be resolved with itself."); if (newValue && (typeof newValue === "object" || typeof newValue === "function")) { var then = newValue.then; if (newValue instanceof Promise2) { self2._state = 3; self2._value = newValue; finale(self2); return; } else if (typeof then === "function") { doResolve(bind5(then, newValue), self2); return; } } self2._state = 1; self2._value = newValue; finale(self2); } catch (e2) { reject(self2, e2); } } function reject(self2, newValue) { self2._state = 2; self2._value = newValue; finale(self2); } function finale(self2) { if (self2._state === 2 && self2._deferreds.length === 0) { Promise2._immediateFn(function() { if (!self2._handled) { Promise2._unhandledRejectionFn(self2._value); } }); } for (var i2 = 0, len = self2._deferreds.length; i2 < len; i2++) { handle2(self2, self2._deferreds[i2]); } self2._deferreds = null; } function Handler(onFulfilled, onRejected, promise2) { this.onFulfilled = typeof onFulfilled === "function" ? onFulfilled : null; this.onRejected = typeof onRejected === "function" ? onRejected : null; this.promise = promise2; } function doResolve(fn, self2) { var done = false; try { fn(function(value25) { if (done) return; done = true; resolve(self2, value25); }, function(reason) { if (done) return; done = true; reject(self2, reason); }); } catch (ex) { if (done) return; done = true; reject(self2, ex); } } Promise2.prototype["catch"] = function(onRejected) { return this.then(null, onRejected); }; Promise2.prototype.then = function(onFulfilled, onRejected) { var prom = new this.constructor(noop3); handle2(this, new Handler(onFulfilled, onRejected, prom)); return prom; }; Promise2.all = function(arr) { var args = Array.prototype.slice.call(arr); return new Promise2(function(resolve2, reject2) { if (args.length === 0) return resolve2([]); var remaining = args.length; function res(i3, val) { try { if (val && (typeof val === "object" || typeof val === "function")) { var then = val.then; if (typeof then === "function") { then.call(val, function(val2) { res(i3, val2); }, reject2); return; } } args[i3] = val; if (--remaining === 0) { resolve2(args); } } catch (ex) { reject2(ex); } } for (var i2 = 0; i2 < args.length; i2++) { res(i2, args[i2]); } }); }; Promise2.resolve = function(value25) { if (value25 && typeof value25 === "object" && value25.constructor === Promise2) { return value25; } return new Promise2(function(resolve2) { resolve2(value25); }); }; Promise2.reject = function(value25) { return new Promise2(function(resolve2, reject2) { reject2(value25); }); }; Promise2.race = function(values3) { return new Promise2(function(resolve2, reject2) { for (var i2 = 0, len = values3.length; i2 < len; i2++) { values3[i2].then(resolve2, reject2); } }); }; Promise2._immediateFn = typeof setImmediate === "function" ? function(fn) { setImmediate(fn); } : function(fn) { setTimeoutFunc(fn, 0); }; Promise2._unhandledRejectionFn = function _unhandledRejectionFn(err) { if (typeof console !== "undefined" && console) { console.warn("Possible Unhandled Promise Rejection:", err); } }; Promise2._setImmediateFn = function _setImmediateFn(fn) { Promise2._immediateFn = fn; }; Promise2._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) { Promise2._unhandledRejectionFn = fn; }; if (module4.exports) { module4.exports = Promise2; } else if (!root2.Promise) { root2.Promise = Promise2; } })(commonjsGlobal$1); })(promise); var promisePolyfill = promise.exports; var Global = function() { if (typeof window !== "undefined") { return window; } else { return Function("return this;")(); } }(); var promisePolyfill_1 = { boltExport: Global.Promise || promisePolyfill }; return promisePolyfill_1; }); })(void 0, exports$1, module2); var Promise$12 = module2.exports.boltExport; var nu$3 = function(baseFn) { var data65 = Optional.none(); var callbacks2 = []; var map3 = function(f2) { return nu$3(function(nCallback) { get3(function(data66) { nCallback(f2(data66)); }); }); }; var get3 = function(nCallback) { if (isReady()) { call2(nCallback); } else { callbacks2.push(nCallback); } }; var set3 = function(x2) { if (!isReady()) { data65 = Optional.some(x2); run2(callbacks2); callbacks2 = []; } }; var isReady = function() { return data65.isSome(); }; var run2 = function(cbs) { each$12(cbs, call2); }; var call2 = function(cb) { data65.each(function(x2) { setTimeout(function() { cb(x2); }, 0); }); }; baseFn(set3); return { get: get3, map: map3, isReady }; }; var pure$1 = function(a2) { return nu$3(function(callback2) { callback2(a2); }); }; var LazyValue = { nu: nu$3, pure: pure$1 }; var errorReporter = function(err) { setTimeout(function() { throw err; }, 0); }; var make$5 = function(run2) { var get3 = function(callback2) { run2().then(callback2, errorReporter); }; var map3 = function(fab) { return make$5(function() { return run2().then(fab); }); }; var bind5 = function(aFutureB) { return make$5(function() { return run2().then(function(v2) { return aFutureB(v2).toPromise(); }); }); }; var anonBind = function(futureB) { return make$5(function() { return run2().then(function() { return futureB.toPromise(); }); }); }; var toLazy = function() { return LazyValue.nu(get3); }; var toCached = function() { var cache2 = null; return make$5(function() { if (cache2 === null) { cache2 = run2(); } return cache2; }); }; var toPromise = run2; return { map: map3, bind: bind5, anonBind, toLazy, toCached, toPromise, get: get3 }; }; var nu$2 = function(baseFn) { return make$5(function() { return new Promise$12(baseFn); }); }; var pure = function(a2) { return make$5(function() { return Promise$12.resolve(a2); }); }; var Future = { nu: nu$2, pure }; var ariaElements = [ "input", "textarea" ]; var isAriaElement = function(elem) { var name2 = name$2(elem); return contains$2(ariaElements, name2); }; var markValid = function(component, invalidConfig) { var elem = invalidConfig.getRoot(component).getOr(component.element); remove$2(elem, invalidConfig.invalidClass); invalidConfig.notify.each(function(notifyInfo) { if (isAriaElement(component.element)) { set$8(component.element, "aria-invalid", false); } notifyInfo.getContainer(component).each(function(container) { set$5(container, notifyInfo.validHtml); }); notifyInfo.onValid(component); }); }; var markInvalid = function(component, invalidConfig, invalidState, text2) { var elem = invalidConfig.getRoot(component).getOr(component.element); add$2(elem, invalidConfig.invalidClass); invalidConfig.notify.each(function(notifyInfo) { if (isAriaElement(component.element)) { set$8(component.element, "aria-invalid", true); } notifyInfo.getContainer(component).each(function(container) { set$5(container, text2); }); notifyInfo.onInvalid(component, text2); }); }; var query = function(component, invalidConfig, _invalidState) { return invalidConfig.validator.fold(function() { return Future.pure(Result.value(true)); }, function(validatorInfo) { return validatorInfo.validate(component); }); }; var run = function(component, invalidConfig, invalidState) { invalidConfig.notify.each(function(notifyInfo) { notifyInfo.onValidate(component); }); return query(component, invalidConfig).map(function(valid) { if (component.getSystem().isConnected()) { return valid.fold(function(err) { markInvalid(component, invalidConfig, invalidState, err); return Result.error(err); }, function(v2) { markValid(component, invalidConfig); return Result.value(v2); }); } else { return Result.error("No longer in system"); } }); }; var isInvalid = function(component, invalidConfig) { var elem = invalidConfig.getRoot(component).getOr(component.element); return has2(elem, invalidConfig.invalidClass); }; var InvalidateApis = /* @__PURE__ */ Object.freeze({ __proto__: null, markValid, markInvalid, query, run, isInvalid }); var events$8 = function(invalidConfig, invalidState) { return invalidConfig.validator.map(function(validatorInfo) { return derive$2([run$1(validatorInfo.onEvent, function(component) { run(component, invalidConfig, invalidState).get(identity$1); })].concat(validatorInfo.validateOnLoad ? [runOnAttached(function(component) { run(component, invalidConfig, invalidState).get(noop2); })] : [])); }).getOr({}); }; var ActiveInvalidate = /* @__PURE__ */ Object.freeze({ __proto__: null, events: events$8 }); var InvalidateSchema = [ required$12("invalidClass"), defaulted("getRoot", Optional.none), optionObjOf("notify", [ defaulted("aria", "alert"), defaulted("getContainer", Optional.none), defaulted("validHtml", ""), onHandler("onValid"), onHandler("onInvalid"), onHandler("onValidate") ]), optionObjOf("validator", [ required$12("validate"), defaulted("onEvent", "input"), defaulted("validateOnLoad", true) ]) ]; var Invalidating = create$8({ fields: InvalidateSchema, name: "invalidating", active: ActiveInvalidate, apis: InvalidateApis, extra: { validation: function(validator4) { return function(component) { var v2 = Representing.getValue(component); return Future.pure(validator4(v2)); }; } } }); var getCoupled = function(component, coupleConfig, coupleState, name2) { return coupleState.getOrCreate(component, coupleConfig, name2); }; var CouplingApis = /* @__PURE__ */ Object.freeze({ __proto__: null, getCoupled }); var CouplingSchema = [requiredOf("others", setOf(Result.value, anyValue()))]; var init$a = function() { var coupled = {}; var getOrCreate = function(component, coupleConfig, name2) { var available = keys2(coupleConfig.others); if (!available) { throw new Error("Cannot find coupled component: " + name2 + ". Known coupled components: " + JSON.stringify(available, null, 2)); } else { return get$e(coupled, name2).getOrThunk(function() { var builder2 = get$e(coupleConfig.others, name2).getOrDie("No information found for coupled component: " + name2); var spec = builder2(component); var built = component.getSystem().build(spec); coupled[name2] = built; return built; }); } }; var readState = constant$1({}); return nu$8({ readState, getOrCreate }); }; var CouplingState = /* @__PURE__ */ Object.freeze({ __proto__: null, init: init$a }); var Coupling = create$8({ fields: CouplingSchema, name: "coupling", apis: CouplingApis, state: CouplingState }); var suffix = constant$1("sink"); var partType$1 = constant$1(optional({ name: suffix(), overrides: constant$1({ dom: { tag: "div" }, behaviours: derive$1([Positioning.config({ useFixed: always })]), events: derive$2([ cutter(keydown()), cutter(mousedown()), cutter(click()) ]) }) })); var HighlightOnOpen; (function(HighlightOnOpen2) { HighlightOnOpen2[HighlightOnOpen2["HighlightFirst"] = 0] = "HighlightFirst"; HighlightOnOpen2[HighlightOnOpen2["HighlightNone"] = 1] = "HighlightNone"; })(HighlightOnOpen || (HighlightOnOpen = {})); var getAnchor = function(detail, component) { var hotspot = detail.getHotspot(component).getOr(component); var type3 = "hotspot"; var overrides = detail.getAnchorOverrides(); return detail.layouts.fold(function() { return { type: type3, hotspot, overrides }; }, function(layouts2) { return { type: type3, hotspot, overrides, layouts: layouts2 }; }); }; var fetch2 = function(detail, mapFetch, component) { var fetcher = detail.fetch; return fetcher(component).map(mapFetch); }; var openF = function(detail, mapFetch, anchor2, component, sandbox, externals, highlightOnOpen) { var futureData = fetch2(detail, mapFetch, component); var getLazySink = getSink(component, detail); return futureData.map(function(tdata) { return tdata.bind(function(data65) { return Optional.from(tieredMenu.sketch(__assign(__assign({}, externals.menu()), { uid: generate$5(""), data: data65, highlightImmediately: highlightOnOpen === HighlightOnOpen.HighlightFirst, onOpenMenu: function(tmenu, menu2) { var sink = getLazySink().getOrDie(); Positioning.position(sink, menu2, { anchor: anchor2 }); Sandboxing.decloak(sandbox); }, onOpenSubmenu: function(tmenu, item2, submenu) { var sink = getLazySink().getOrDie(); Positioning.position(sink, submenu, { anchor: { type: "submenu", item: item2 } }); Sandboxing.decloak(sandbox); }, onRepositionMenu: function(tmenu, primaryMenu, submenuTriggers) { var sink = getLazySink().getOrDie(); Positioning.position(sink, primaryMenu, { anchor: anchor2 }); each$12(submenuTriggers, function(st) { Positioning.position(sink, st.triggeredMenu, { anchor: { type: "submenu", item: st.triggeringItem } }); }); }, onEscape: function() { Focusing.focus(component); Sandboxing.close(sandbox); return Optional.some(true); } }))); }); }); }; var open6 = function(detail, mapFetch, hotspot, sandbox, externals, onOpenSync, highlightOnOpen) { var anchor2 = getAnchor(detail, hotspot); var processed = openF(detail, mapFetch, anchor2, hotspot, sandbox, externals, highlightOnOpen); return processed.map(function(tdata) { tdata.fold(function() { if (Sandboxing.isOpen(sandbox)) { Sandboxing.close(sandbox); } }, function(data65) { Sandboxing.cloak(sandbox); Sandboxing.open(sandbox, data65); onOpenSync(sandbox); }); return sandbox; }); }; var close7 = function(detail, mapFetch, component, sandbox, _externals, _onOpenSync, _highlightOnOpen) { Sandboxing.close(sandbox); return Future.pure(sandbox); }; var togglePopup = function(detail, mapFetch, hotspot, externals, onOpenSync, highlightOnOpen) { var sandbox = Coupling.getCoupled(hotspot, "sandbox"); var showing = Sandboxing.isOpen(sandbox); var action = showing ? close7 : open6; return action(detail, mapFetch, hotspot, sandbox, externals, onOpenSync, highlightOnOpen); }; var matchWidth = function(hotspot, container, useMinWidth) { var menu2 = Composing.getCurrent(container).getOr(container); var buttonWidth = get$a(hotspot.element); if (useMinWidth) { set$7(menu2.element, "min-width", buttonWidth + "px"); } else { set$6(menu2.element, buttonWidth); } }; var getSink = function(anyInSystem, sinkDetail) { return anyInSystem.getSystem().getByUid(sinkDetail.uid + "-" + suffix()).map(function(internalSink) { return function() { return Result.value(internalSink); }; }).getOrThunk(function() { return sinkDetail.lazySink.fold(function() { return function() { return Result.error(new Error("No internal sink is specified, nor could an external sink be found")); }; }, function(lazySinkFn) { return function() { return lazySinkFn(anyInSystem); }; }); }); }; var doRepositionMenus = function(sandbox) { Sandboxing.getState(sandbox).each(function(tmenu) { tieredMenu.repositionMenus(tmenu); }); }; var makeSandbox$1 = function(detail, hotspot, extras) { var ariaOwner = manager(); var onOpen = function(component, menu2) { var anchor2 = getAnchor(detail, hotspot); ariaOwner.link(hotspot.element); if (detail.matchWidth) { matchWidth(anchor2.hotspot, menu2, detail.useMinWidth); } detail.onOpen(anchor2, component, menu2); if (extras !== void 0 && extras.onOpen !== void 0) { extras.onOpen(component, menu2); } }; var onClose = function(component, menu2) { ariaOwner.unlink(hotspot.element); if (extras !== void 0 && extras.onClose !== void 0) { extras.onClose(component, menu2); } }; var lazySink = getSink(hotspot, detail); return { dom: { tag: "div", classes: detail.sandboxClasses, attributes: { id: ariaOwner.id, role: "listbox" } }, behaviours: SketchBehaviours.augment(detail.sandboxBehaviours, [ Representing.config({ store: { mode: "memory", initialValue: hotspot } }), Sandboxing.config({ onOpen, onClose, isPartOf: function(container, data65, queryElem) { return isPartOf$1(data65, queryElem) || isPartOf$1(hotspot, queryElem); }, getAttachPoint: function() { return lazySink().getOrDie(); } }), Composing.config({ find: function(sandbox) { return Sandboxing.getState(sandbox).bind(function(menu2) { return Composing.getCurrent(menu2); }); } }), Receiving.config({ channels: __assign(__assign({}, receivingChannel$1({ isExtraPart: never })), receivingChannel({ doReposition: doRepositionMenus })) }) ]) }; }; var repositionMenus = function(comp) { var sandbox = Coupling.getCoupled(comp, "sandbox"); doRepositionMenus(sandbox); }; var sandboxFields = function() { return [ defaulted("sandboxClasses", []), SketchBehaviours.field("sandboxBehaviours", [ Composing, Receiving, Sandboxing, Representing ]) ]; }; var schema$j = constant$1([ required$12("dom"), required$12("fetch"), onHandler("onOpen"), onKeyboardHandler("onExecute"), defaulted("getHotspot", Optional.some), defaulted("getAnchorOverrides", constant$1({})), schema$y(), field("dropdownBehaviours", [ Toggling, Coupling, Keying, Focusing ]), required$12("toggleClass"), defaulted("eventOrder", {}), option("lazySink"), defaulted("matchWidth", false), defaulted("useMinWidth", false), option("role") ].concat(sandboxFields())); var parts$d = constant$1([ external$1({ schema: [tieredMenuMarkers()], name: "menu", defaults: function(detail) { return { onExecute: detail.onExecute }; } }), partType$1() ]); var factory$g = function(detail, components4, _spec, externals) { var _a4; var lookupAttr = function(attr) { return get$e(detail.dom, "attributes").bind(function(attrs) { return get$e(attrs, attr); }); }; var switchToMenu = function(sandbox) { Sandboxing.getState(sandbox).each(function(tmenu) { tieredMenu.highlightPrimary(tmenu); }); }; var action = function(component) { var onOpenSync = switchToMenu; togglePopup(detail, identity$1, component, externals, onOpenSync, HighlightOnOpen.HighlightFirst).get(noop2); }; var apis = { expand: function(comp) { if (!Toggling.isOn(comp)) { togglePopup(detail, identity$1, comp, externals, noop2, HighlightOnOpen.HighlightNone).get(noop2); } }, open: function(comp) { if (!Toggling.isOn(comp)) { togglePopup(detail, identity$1, comp, externals, noop2, HighlightOnOpen.HighlightFirst).get(noop2); } }, isOpen: Toggling.isOn, close: function(comp) { if (Toggling.isOn(comp)) { togglePopup(detail, identity$1, comp, externals, noop2, HighlightOnOpen.HighlightFirst).get(noop2); } }, repositionMenus: function(comp) { if (Toggling.isOn(comp)) { repositionMenus(comp); } } }; var triggerExecute = function(comp, _se) { emitExecute(comp); return Optional.some(true); }; return { uid: detail.uid, dom: detail.dom, components: components4, behaviours: augment(detail.dropdownBehaviours, [ Toggling.config({ toggleClass: detail.toggleClass, aria: { mode: "expanded" } }), Coupling.config({ others: { sandbox: function(hotspot) { return makeSandbox$1(detail, hotspot, { onOpen: function() { return Toggling.on(hotspot); }, onClose: function() { return Toggling.off(hotspot); } }); } } }), Keying.config({ mode: "special", onSpace: triggerExecute, onEnter: triggerExecute, onDown: function(comp, _se) { if (Dropdown2.isOpen(comp)) { var sandbox = Coupling.getCoupled(comp, "sandbox"); switchToMenu(sandbox); } else { Dropdown2.open(comp); } return Optional.some(true); }, onEscape: function(comp, _se) { if (Dropdown2.isOpen(comp)) { Dropdown2.close(comp); return Optional.some(true); } else { return Optional.none(); } } }), Focusing.config({}) ]), events: events$a(Optional.some(action)), eventOrder: __assign(__assign({}, detail.eventOrder), (_a4 = {}, _a4[execute$5()] = [ "disabling", "toggling", "alloy.base.behaviour" ], _a4)), apis, domModification: { attributes: __assign(__assign({ "aria-haspopup": "true" }, detail.role.fold(function() { return {}; }, function(role) { return { role }; })), detail.dom.tag === "button" ? { type: lookupAttr("type").getOr("button") } : {}) } }; }; var Dropdown2 = composite({ name: "Dropdown", configFields: schema$j(), partFields: parts$d(), factory: factory$g, apis: { open: function(apis, comp) { return apis.open(comp); }, expand: function(apis, comp) { return apis.expand(comp); }, close: function(apis, comp) { return apis.close(comp); }, isOpen: function(apis, comp) { return apis.isOpen(comp); }, repositionMenus: function(apis, comp) { return apis.repositionMenus(comp); } } }); var exhibit$1 = function() { return nu$7({ styles: { "-webkit-user-select": "none", "user-select": "none", "-ms-user-select": "none", "-moz-user-select": "-moz-none" }, attributes: { unselectable: "on" } }); }; var events$7 = function() { return derive$2([abort4(selectstart(), always)]); }; var ActiveUnselecting = /* @__PURE__ */ Object.freeze({ __proto__: null, events: events$7, exhibit: exhibit$1 }); var Unselecting = create$8({ fields: [], name: "unselecting", active: ActiveUnselecting }); var renderPanelButton = function(spec, sharedBackstage) { return Dropdown2.sketch({ dom: spec.dom, components: spec.components, toggleClass: "mce-active", dropdownBehaviours: derive$1([ DisablingConfigs.button(sharedBackstage.providers.isDisabled), receivingConfig(), Unselecting.config({}), Tabstopping.config({}) ]), layouts: spec.layouts, sandboxClasses: ["tox-dialog__popups"], lazySink: sharedBackstage.getSink, fetch: function(comp) { return Future.nu(function(callback2) { return spec.fetch(callback2); }).map(function(items) { return Optional.from(createTieredDataFrom(deepMerge2(createPartialChoiceMenu(generate$6("menu-value"), items, function(value25) { spec.onItemAction(comp, value25); }, spec.columns, spec.presets, ItemResponse$1.CLOSE_ON_EXECUTE, never, sharedBackstage.providers), { movement: deriveMenuMovement(spec.columns, spec.presets) }))); }); }, parts: { menu: part(false, 1, spec.presets) } }); }; var colorInputChangeEvent = generate$6("color-input-change"); var colorSwatchChangeEvent = generate$6("color-swatch-change"); var colorPickerCancelEvent = generate$6("color-picker-cancel"); var renderColorInput = function(spec, sharedBackstage, colorInputBackstage) { var pField = FormField.parts.field({ factory: Input2, inputClasses: ["tox-textfield"], onSetValue: function(c2) { return Invalidating.run(c2).get(noop2); }, inputBehaviours: derive$1([ Disabling.config({ disabled: sharedBackstage.providers.isDisabled }), receivingConfig(), Tabstopping.config({}), Invalidating.config({ invalidClass: "tox-textbox-field-invalid", getRoot: function(comp) { return parent2(comp.element); }, notify: { onValid: function(comp) { var val = Representing.getValue(comp); emitWith(comp, colorInputChangeEvent, { color: val }); } }, validator: { validateOnLoad: false, validate: function(input2) { var inputValue = Representing.getValue(input2); if (inputValue.length === 0) { return Future.pure(Result.value(true)); } else { var span = SugarElement.fromTag("span"); set$7(span, "background-color", inputValue); var res = getRaw(span, "background-color").fold(function() { return Result.error("blah"); }, function(_2) { return Result.value(inputValue); }); return Future.pure(res); } } } }) ]), selectOnFocus: false }); var pLabel = spec.label.map(function(label) { return renderLabel$2(label, sharedBackstage.providers); }); var emitSwatchChange = function(colorBit, value25) { emitWith(colorBit, colorSwatchChangeEvent, { value: value25 }); }; var onItemAction = function(comp, value25) { memColorButton.getOpt(comp).each(function(colorBit) { if (value25 === "custom") { colorInputBackstage.colorPicker(function(valueOpt) { valueOpt.fold(function() { return emit2(colorBit, colorPickerCancelEvent); }, function(value26) { emitSwatchChange(colorBit, value26); addColor(value26); }); }, "#ffffff"); } else if (value25 === "remove") { emitSwatchChange(colorBit, ""); } else { emitSwatchChange(colorBit, value25); } }); }; var memColorButton = record(renderPanelButton({ dom: { tag: "span", attributes: { "aria-label": sharedBackstage.providers.translate("Color swatch") } }, layouts: { onRtl: function() { return [ southwest$2, southeast$2, south$2 ]; }, onLtr: function() { return [ southeast$2, southwest$2, south$2 ]; } }, components: [], fetch: getFetch$1(colorInputBackstage.getColors(), colorInputBackstage.hasCustomColors()), columns: colorInputBackstage.getColorCols(), presets: "color", onItemAction }, sharedBackstage)); return FormField.sketch({ dom: { tag: "div", classes: ["tox-form__group"] }, components: pLabel.toArray().concat([{ dom: { tag: "div", classes: ["tox-color-input"] }, components: [ pField, memColorButton.asSpec() ] }]), fieldBehaviours: derive$1([config3("form-field-events", [ run$1(colorInputChangeEvent, function(comp, se) { memColorButton.getOpt(comp).each(function(colorButton) { set$7(colorButton.element, "background-color", se.event.color); }); emitWith(comp, formChangeEvent, { name: spec.name }); }), run$1(colorSwatchChangeEvent, function(comp, se) { FormField.getField(comp).each(function(field2) { Representing.setValue(field2, se.event.value); Composing.getCurrent(comp).each(Focusing.focus); }); }), run$1(colorPickerCancelEvent, function(comp, _se) { FormField.getField(comp).each(function(_field) { Composing.getCurrent(comp).each(Focusing.focus); }); }) ])]) }); }; var labelPart = optional({ schema: [required$12("dom")], name: "label" }); var edgePart = function(name2) { return optional({ name: "" + name2 + "-edge", overrides: function(detail) { var action = detail.model.manager.edgeActions[name2]; return action.fold(function() { return {}; }, function(a2) { return { events: derive$2([ runActionExtra(touchstart(), function(comp, se, d2) { return a2(comp, d2); }, [detail]), runActionExtra(mousedown(), function(comp, se, d2) { return a2(comp, d2); }, [detail]), runActionExtra(mousemove(), function(comp, se, det) { if (det.mouseIsDown.get()) { a2(comp, det); } }, [detail]) ]) }; }); } }); }; var tlEdgePart = edgePart("top-left"); var tedgePart = edgePart("top"); var trEdgePart = edgePart("top-right"); var redgePart = edgePart("right"); var brEdgePart = edgePart("bottom-right"); var bedgePart = edgePart("bottom"); var blEdgePart = edgePart("bottom-left"); var ledgePart = edgePart("left"); var thumbPart = required2({ name: "thumb", defaults: constant$1({ dom: { styles: { position: "absolute" } } }), overrides: function(detail) { return { events: derive$2([ redirectToPart(touchstart(), detail, "spectrum"), redirectToPart(touchmove(), detail, "spectrum"), redirectToPart(touchend(), detail, "spectrum"), redirectToPart(mousedown(), detail, "spectrum"), redirectToPart(mousemove(), detail, "spectrum"), redirectToPart(mouseup(), detail, "spectrum") ]) }; } }); var spectrumPart = required2({ schema: [customField("mouseIsDown", function() { return Cell3(false); })], name: "spectrum", overrides: function(detail) { var modelDetail = detail.model; var model = modelDetail.manager; var setValueFrom2 = function(component, simulatedEvent) { return model.getValueFromEvent(simulatedEvent).map(function(value25) { return model.setValueFrom(component, detail, value25); }); }; return { behaviours: derive$1([ Keying.config({ mode: "special", onLeft: function(spectrum) { return model.onLeft(spectrum, detail); }, onRight: function(spectrum) { return model.onRight(spectrum, detail); }, onUp: function(spectrum) { return model.onUp(spectrum, detail); }, onDown: function(spectrum) { return model.onDown(spectrum, detail); } }), Focusing.config({}) ]), events: derive$2([ run$1(touchstart(), setValueFrom2), run$1(touchmove(), setValueFrom2), run$1(mousedown(), setValueFrom2), run$1(mousemove(), function(spectrum, se) { if (detail.mouseIsDown.get()) { setValueFrom2(spectrum, se); } }) ]) }; } }); var SliderParts = [ labelPart, ledgePart, redgePart, tedgePart, bedgePart, tlEdgePart, trEdgePart, blEdgePart, brEdgePart, thumbPart, spectrumPart ]; var _sliderChangeEvent = "slider.change.value"; var sliderChangeEvent = constant$1(_sliderChangeEvent); var isTouchEvent$2 = function(evt) { return evt.type.indexOf("touch") !== -1; }; var getEventSource = function(simulatedEvent) { var evt = simulatedEvent.event.raw; if (isTouchEvent$2(evt)) { var touchEvent = evt; return touchEvent.touches !== void 0 && touchEvent.touches.length === 1 ? Optional.some(touchEvent.touches[0]).map(function(t3) { return SugarPosition(t3.clientX, t3.clientY); }) : Optional.none(); } else { var mouseEvent = evt; return mouseEvent.clientX !== void 0 ? Optional.some(mouseEvent).map(function(me) { return SugarPosition(me.clientX, me.clientY); }) : Optional.none(); } }; var t2 = "top", r2 = "right", b2 = "bottom", l2 = "left"; var minX = function(detail) { return detail.model.minX; }; var minY = function(detail) { return detail.model.minY; }; var min1X = function(detail) { return detail.model.minX - 1; }; var min1Y = function(detail) { return detail.model.minY - 1; }; var maxX = function(detail) { return detail.model.maxX; }; var maxY = function(detail) { return detail.model.maxY; }; var max1X = function(detail) { return detail.model.maxX + 1; }; var max1Y = function(detail) { return detail.model.maxY + 1; }; var range2 = function(detail, max5, min5) { return max5(detail) - min5(detail); }; var xRange = function(detail) { return range2(detail, maxX, minX); }; var yRange = function(detail) { return range2(detail, maxY, minY); }; var halfX = function(detail) { return xRange(detail) / 2; }; var halfY = function(detail) { return yRange(detail) / 2; }; var step = function(detail) { return detail.stepSize; }; var snap = function(detail) { return detail.snapToGrid; }; var snapStart = function(detail) { return detail.snapStart; }; var rounded = function(detail) { return detail.rounded; }; var hasEdge = function(detail, edgeName) { return detail[edgeName + "-edge"] !== void 0; }; var hasLEdge = function(detail) { return hasEdge(detail, l2); }; var hasREdge = function(detail) { return hasEdge(detail, r2); }; var hasTEdge = function(detail) { return hasEdge(detail, t2); }; var hasBEdge = function(detail) { return hasEdge(detail, b2); }; var currentValue = function(detail) { return detail.model.value.get(); }; var xValue = function(x2) { return { x: x2 }; }; var yValue = function(y2) { return { y: y2 }; }; var xyValue = function(x2, y2) { return { x: x2, y: y2 }; }; var fireSliderChange$3 = function(component, value25) { emitWith(component, sliderChangeEvent(), { value: value25 }); }; var setToTLEdgeXY = function(edge2, detail) { fireSliderChange$3(edge2, xyValue(min1X(detail), min1Y(detail))); }; var setToTEdge = function(edge2, detail) { fireSliderChange$3(edge2, yValue(min1Y(detail))); }; var setToTEdgeXY = function(edge2, detail) { fireSliderChange$3(edge2, xyValue(halfX(detail), min1Y(detail))); }; var setToTREdgeXY = function(edge2, detail) { fireSliderChange$3(edge2, xyValue(max1X(detail), min1Y(detail))); }; var setToREdge = function(edge2, detail) { fireSliderChange$3(edge2, xValue(max1X(detail))); }; var setToREdgeXY = function(edge2, detail) { fireSliderChange$3(edge2, xyValue(max1X(detail), halfY(detail))); }; var setToBREdgeXY = function(edge2, detail) { fireSliderChange$3(edge2, xyValue(max1X(detail), max1Y(detail))); }; var setToBEdge = function(edge2, detail) { fireSliderChange$3(edge2, yValue(max1Y(detail))); }; var setToBEdgeXY = function(edge2, detail) { fireSliderChange$3(edge2, xyValue(halfX(detail), max1Y(detail))); }; var setToBLEdgeXY = function(edge2, detail) { fireSliderChange$3(edge2, xyValue(min1X(detail), max1Y(detail))); }; var setToLEdge = function(edge2, detail) { fireSliderChange$3(edge2, xValue(min1X(detail))); }; var setToLEdgeXY = function(edge2, detail) { fireSliderChange$3(edge2, xyValue(min1X(detail), halfY(detail))); }; var reduceBy = function(value25, min5, max5, step2) { if (value25 < min5) { return value25; } else if (value25 > max5) { return max5; } else if (value25 === min5) { return min5 - 1; } else { return Math.max(min5, value25 - step2); } }; var increaseBy = function(value25, min5, max5, step2) { if (value25 > max5) { return value25; } else if (value25 < min5) { return min5; } else if (value25 === max5) { return max5 + 1; } else { return Math.min(max5, value25 + step2); } }; var capValue = function(value25, min5, max5) { return Math.max(min5, Math.min(max5, value25)); }; var snapValueOf = function(value25, min5, max5, step2, snapStart2) { return snapStart2.fold(function() { var initValue = value25 - min5; var extraValue = Math.round(initValue / step2) * step2; return capValue(min5 + extraValue, min5 - 1, max5 + 1); }, function(start) { var remainder = (value25 - start) % step2; var adjustment = Math.round(remainder / step2); var rawSteps = Math.floor((value25 - start) / step2); var maxSteps = Math.floor((max5 - start) / step2); var numSteps = Math.min(maxSteps, rawSteps + adjustment); var r3 = start + numSteps * step2; return Math.max(start, r3); }); }; var findOffsetOf = function(value25, min5, max5) { return Math.min(max5, Math.max(value25, min5)) - min5; }; var findValueOf = function(args) { var min5 = args.min, max5 = args.max, range3 = args.range, value25 = args.value, step2 = args.step, snap2 = args.snap, snapStart2 = args.snapStart, rounded2 = args.rounded, hasMinEdge = args.hasMinEdge, hasMaxEdge = args.hasMaxEdge, minBound = args.minBound, maxBound = args.maxBound, screenRange = args.screenRange; var capMin = hasMinEdge ? min5 - 1 : min5; var capMax = hasMaxEdge ? max5 + 1 : max5; if (value25 < minBound) { return capMin; } else if (value25 > maxBound) { return capMax; } else { var offset5 = findOffsetOf(value25, minBound, maxBound); var newValue = capValue(offset5 / screenRange * range3 + min5, capMin, capMax); if (snap2 && newValue >= min5 && newValue <= max5) { return snapValueOf(newValue, min5, max5, step2, snapStart2); } else if (rounded2) { return Math.round(newValue); } else { return newValue; } } }; var findOffsetOfValue$2 = function(args) { var min5 = args.min, max5 = args.max, range3 = args.range, value25 = args.value, hasMinEdge = args.hasMinEdge, hasMaxEdge = args.hasMaxEdge, maxBound = args.maxBound, maxOffset = args.maxOffset, centerMinEdge = args.centerMinEdge, centerMaxEdge = args.centerMaxEdge; if (value25 < min5) { return hasMinEdge ? 0 : centerMinEdge; } else if (value25 > max5) { return hasMaxEdge ? maxBound : centerMaxEdge; } else { return (value25 - min5) / range3 * maxOffset; } }; var top = "top", right = "right", bottom = "bottom", left = "left", width = "width", height = "height"; var getBounds = function(component) { return component.element.dom.getBoundingClientRect(); }; var getBoundsProperty = function(bounds2, property2) { return bounds2[property2]; }; var getMinXBounds = function(component) { var bounds2 = getBounds(component); return getBoundsProperty(bounds2, left); }; var getMaxXBounds = function(component) { var bounds2 = getBounds(component); return getBoundsProperty(bounds2, right); }; var getMinYBounds = function(component) { var bounds2 = getBounds(component); return getBoundsProperty(bounds2, top); }; var getMaxYBounds = function(component) { var bounds2 = getBounds(component); return getBoundsProperty(bounds2, bottom); }; var getXScreenRange = function(component) { var bounds2 = getBounds(component); return getBoundsProperty(bounds2, width); }; var getYScreenRange = function(component) { var bounds2 = getBounds(component); return getBoundsProperty(bounds2, height); }; var getCenterOffsetOf = function(componentMinEdge, componentMaxEdge, spectrumMinEdge) { return (componentMinEdge + componentMaxEdge) / 2 - spectrumMinEdge; }; var getXCenterOffSetOf = function(component, spectrum) { var componentBounds = getBounds(component); var spectrumBounds = getBounds(spectrum); var componentMinEdge = getBoundsProperty(componentBounds, left); var componentMaxEdge = getBoundsProperty(componentBounds, right); var spectrumMinEdge = getBoundsProperty(spectrumBounds, left); return getCenterOffsetOf(componentMinEdge, componentMaxEdge, spectrumMinEdge); }; var getYCenterOffSetOf = function(component, spectrum) { var componentBounds = getBounds(component); var spectrumBounds = getBounds(spectrum); var componentMinEdge = getBoundsProperty(componentBounds, top); var componentMaxEdge = getBoundsProperty(componentBounds, bottom); var spectrumMinEdge = getBoundsProperty(spectrumBounds, top); return getCenterOffsetOf(componentMinEdge, componentMaxEdge, spectrumMinEdge); }; var fireSliderChange$2 = function(spectrum, value25) { emitWith(spectrum, sliderChangeEvent(), { value: value25 }); }; var sliderValue$2 = function(x2) { return { x: x2 }; }; var findValueOfOffset$1 = function(spectrum, detail, left2) { var args = { min: minX(detail), max: maxX(detail), range: xRange(detail), value: left2, step: step(detail), snap: snap(detail), snapStart: snapStart(detail), rounded: rounded(detail), hasMinEdge: hasLEdge(detail), hasMaxEdge: hasREdge(detail), minBound: getMinXBounds(spectrum), maxBound: getMaxXBounds(spectrum), screenRange: getXScreenRange(spectrum) }; return findValueOf(args); }; var setValueFrom$2 = function(spectrum, detail, value25) { var xValue2 = findValueOfOffset$1(spectrum, detail, value25); var sliderVal = sliderValue$2(xValue2); fireSliderChange$2(spectrum, sliderVal); return xValue2; }; var setToMin$2 = function(spectrum, detail) { var min5 = minX(detail); fireSliderChange$2(spectrum, sliderValue$2(min5)); }; var setToMax$2 = function(spectrum, detail) { var max5 = maxX(detail); fireSliderChange$2(spectrum, sliderValue$2(max5)); }; var moveBy$2 = function(direction, spectrum, detail) { var f2 = direction > 0 ? increaseBy : reduceBy; var xValue2 = f2(currentValue(detail).x, minX(detail), maxX(detail), step(detail)); fireSliderChange$2(spectrum, sliderValue$2(xValue2)); return Optional.some(xValue2); }; var handleMovement$2 = function(direction) { return function(spectrum, detail) { return moveBy$2(direction, spectrum, detail).map(always); }; }; var getValueFromEvent$2 = function(simulatedEvent) { var pos = getEventSource(simulatedEvent); return pos.map(function(p) { return p.left; }); }; var findOffsetOfValue$1 = function(spectrum, detail, value25, minEdge, maxEdge) { var minOffset = 0; var maxOffset = getXScreenRange(spectrum); var centerMinEdge = minEdge.bind(function(edge2) { return Optional.some(getXCenterOffSetOf(edge2, spectrum)); }).getOr(minOffset); var centerMaxEdge = maxEdge.bind(function(edge2) { return Optional.some(getXCenterOffSetOf(edge2, spectrum)); }).getOr(maxOffset); var args = { min: minX(detail), max: maxX(detail), range: xRange(detail), value: value25, hasMinEdge: hasLEdge(detail), hasMaxEdge: hasREdge(detail), minBound: getMinXBounds(spectrum), minOffset, maxBound: getMaxXBounds(spectrum), maxOffset, centerMinEdge, centerMaxEdge }; return findOffsetOfValue$2(args); }; var findPositionOfValue$1 = function(slider, spectrum, value25, minEdge, maxEdge, detail) { var offset5 = findOffsetOfValue$1(spectrum, detail, value25, minEdge, maxEdge); return getMinXBounds(spectrum) - getMinXBounds(slider) + offset5; }; var setPositionFromValue$2 = function(slider, thumb, detail, edges) { var value25 = currentValue(detail); var pos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value25.x, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail); var thumbRadius = get$a(thumb.element) / 2; set$7(thumb.element, "left", pos - thumbRadius + "px"); }; var onLeft$2 = handleMovement$2(-1); var onRight$2 = handleMovement$2(1); var onUp$2 = Optional.none; var onDown$2 = Optional.none; var edgeActions$2 = { "top-left": Optional.none(), "top": Optional.none(), "top-right": Optional.none(), "right": Optional.some(setToREdge), "bottom-right": Optional.none(), "bottom": Optional.none(), "bottom-left": Optional.none(), "left": Optional.some(setToLEdge) }; var HorizontalModel = /* @__PURE__ */ Object.freeze({ __proto__: null, setValueFrom: setValueFrom$2, setToMin: setToMin$2, setToMax: setToMax$2, findValueOfOffset: findValueOfOffset$1, getValueFromEvent: getValueFromEvent$2, findPositionOfValue: findPositionOfValue$1, setPositionFromValue: setPositionFromValue$2, onLeft: onLeft$2, onRight: onRight$2, onUp: onUp$2, onDown: onDown$2, edgeActions: edgeActions$2 }); var fireSliderChange$1 = function(spectrum, value25) { emitWith(spectrum, sliderChangeEvent(), { value: value25 }); }; var sliderValue$1 = function(y2) { return { y: y2 }; }; var findValueOfOffset = function(spectrum, detail, top2) { var args = { min: minY(detail), max: maxY(detail), range: yRange(detail), value: top2, step: step(detail), snap: snap(detail), snapStart: snapStart(detail), rounded: rounded(detail), hasMinEdge: hasTEdge(detail), hasMaxEdge: hasBEdge(detail), minBound: getMinYBounds(spectrum), maxBound: getMaxYBounds(spectrum), screenRange: getYScreenRange(spectrum) }; return findValueOf(args); }; var setValueFrom$1 = function(spectrum, detail, value25) { var yValue2 = findValueOfOffset(spectrum, detail, value25); var sliderVal = sliderValue$1(yValue2); fireSliderChange$1(spectrum, sliderVal); return yValue2; }; var setToMin$1 = function(spectrum, detail) { var min5 = minY(detail); fireSliderChange$1(spectrum, sliderValue$1(min5)); }; var setToMax$1 = function(spectrum, detail) { var max5 = maxY(detail); fireSliderChange$1(spectrum, sliderValue$1(max5)); }; var moveBy$1 = function(direction, spectrum, detail) { var f2 = direction > 0 ? increaseBy : reduceBy; var yValue2 = f2(currentValue(detail).y, minY(detail), maxY(detail), step(detail)); fireSliderChange$1(spectrum, sliderValue$1(yValue2)); return Optional.some(yValue2); }; var handleMovement$1 = function(direction) { return function(spectrum, detail) { return moveBy$1(direction, spectrum, detail).map(always); }; }; var getValueFromEvent$1 = function(simulatedEvent) { var pos = getEventSource(simulatedEvent); return pos.map(function(p) { return p.top; }); }; var findOffsetOfValue = function(spectrum, detail, value25, minEdge, maxEdge) { var minOffset = 0; var maxOffset = getYScreenRange(spectrum); var centerMinEdge = minEdge.bind(function(edge2) { return Optional.some(getYCenterOffSetOf(edge2, spectrum)); }).getOr(minOffset); var centerMaxEdge = maxEdge.bind(function(edge2) { return Optional.some(getYCenterOffSetOf(edge2, spectrum)); }).getOr(maxOffset); var args = { min: minY(detail), max: maxY(detail), range: yRange(detail), value: value25, hasMinEdge: hasTEdge(detail), hasMaxEdge: hasBEdge(detail), minBound: getMinYBounds(spectrum), minOffset, maxBound: getMaxYBounds(spectrum), maxOffset, centerMinEdge, centerMaxEdge }; return findOffsetOfValue$2(args); }; var findPositionOfValue = function(slider, spectrum, value25, minEdge, maxEdge, detail) { var offset5 = findOffsetOfValue(spectrum, detail, value25, minEdge, maxEdge); return getMinYBounds(spectrum) - getMinYBounds(slider) + offset5; }; var setPositionFromValue$1 = function(slider, thumb, detail, edges) { var value25 = currentValue(detail); var pos = findPositionOfValue(slider, edges.getSpectrum(slider), value25.y, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail); var thumbRadius = get$b(thumb.element) / 2; set$7(thumb.element, "top", pos - thumbRadius + "px"); }; var onLeft$1 = Optional.none; var onRight$1 = Optional.none; var onUp$1 = handleMovement$1(-1); var onDown$1 = handleMovement$1(1); var edgeActions$1 = { "top-left": Optional.none(), "top": Optional.some(setToTEdge), "top-right": Optional.none(), "right": Optional.none(), "bottom-right": Optional.none(), "bottom": Optional.some(setToBEdge), "bottom-left": Optional.none(), "left": Optional.none() }; var VerticalModel = /* @__PURE__ */ Object.freeze({ __proto__: null, setValueFrom: setValueFrom$1, setToMin: setToMin$1, setToMax: setToMax$1, findValueOfOffset, getValueFromEvent: getValueFromEvent$1, findPositionOfValue, setPositionFromValue: setPositionFromValue$1, onLeft: onLeft$1, onRight: onRight$1, onUp: onUp$1, onDown: onDown$1, edgeActions: edgeActions$1 }); var fireSliderChange = function(spectrum, value25) { emitWith(spectrum, sliderChangeEvent(), { value: value25 }); }; var sliderValue = function(x2, y2) { return { x: x2, y: y2 }; }; var setValueFrom = function(spectrum, detail, value25) { var xValue2 = findValueOfOffset$1(spectrum, detail, value25.left); var yValue2 = findValueOfOffset(spectrum, detail, value25.top); var val = sliderValue(xValue2, yValue2); fireSliderChange(spectrum, val); return val; }; var moveBy = function(direction, isVerticalMovement, spectrum, detail) { var f2 = direction > 0 ? increaseBy : reduceBy; var xValue2 = isVerticalMovement ? currentValue(detail).x : f2(currentValue(detail).x, minX(detail), maxX(detail), step(detail)); var yValue2 = !isVerticalMovement ? currentValue(detail).y : f2(currentValue(detail).y, minY(detail), maxY(detail), step(detail)); fireSliderChange(spectrum, sliderValue(xValue2, yValue2)); return Optional.some(xValue2); }; var handleMovement = function(direction, isVerticalMovement) { return function(spectrum, detail) { return moveBy(direction, isVerticalMovement, spectrum, detail).map(always); }; }; var setToMin = function(spectrum, detail) { var mX = minX(detail); var mY = minY(detail); fireSliderChange(spectrum, sliderValue(mX, mY)); }; var setToMax = function(spectrum, detail) { var mX = maxX(detail); var mY = maxY(detail); fireSliderChange(spectrum, sliderValue(mX, mY)); }; var getValueFromEvent2 = function(simulatedEvent) { return getEventSource(simulatedEvent); }; var setPositionFromValue = function(slider, thumb, detail, edges) { var value25 = currentValue(detail); var xPos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value25.x, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail); var yPos = findPositionOfValue(slider, edges.getSpectrum(slider), value25.y, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail); var thumbXRadius = get$a(thumb.element) / 2; var thumbYRadius = get$b(thumb.element) / 2; set$7(thumb.element, "left", xPos - thumbXRadius + "px"); set$7(thumb.element, "top", yPos - thumbYRadius + "px"); }; var onLeft = handleMovement(-1, false); var onRight = handleMovement(1, false); var onUp = handleMovement(-1, true); var onDown = handleMovement(1, true); var edgeActions = { "top-left": Optional.some(setToTLEdgeXY), "top": Optional.some(setToTEdgeXY), "top-right": Optional.some(setToTREdgeXY), "right": Optional.some(setToREdgeXY), "bottom-right": Optional.some(setToBREdgeXY), "bottom": Optional.some(setToBEdgeXY), "bottom-left": Optional.some(setToBLEdgeXY), "left": Optional.some(setToLEdgeXY) }; var TwoDModel = /* @__PURE__ */ Object.freeze({ __proto__: null, setValueFrom, setToMin, setToMax, getValueFromEvent: getValueFromEvent2, setPositionFromValue, onLeft, onRight, onUp, onDown, edgeActions }); var SliderSchema = [ defaulted("stepSize", 1), defaulted("onChange", noop2), defaulted("onChoose", noop2), defaulted("onInit", noop2), defaulted("onDragStart", noop2), defaulted("onDragEnd", noop2), defaulted("snapToGrid", false), defaulted("rounded", true), option("snapStart"), requiredOf("model", choose$1("mode", { x: [ defaulted("minX", 0), defaulted("maxX", 100), customField("value", function(spec) { return Cell3(spec.mode.minX); }), required$12("getInitialValue"), output$1("manager", HorizontalModel) ], y: [ defaulted("minY", 0), defaulted("maxY", 100), customField("value", function(spec) { return Cell3(spec.mode.minY); }), required$12("getInitialValue"), output$1("manager", VerticalModel) ], xy: [ defaulted("minX", 0), defaulted("maxX", 100), defaulted("minY", 0), defaulted("maxY", 100), customField("value", function(spec) { return Cell3({ x: spec.mode.minX, y: spec.mode.minY }); }), required$12("getInitialValue"), output$1("manager", TwoDModel) ] })), field("sliderBehaviours", [ Keying, Representing ]), customField("mouseIsDown", function() { return Cell3(false); }) ]; var sketch$2 = function(detail, components4, _spec, _externals) { var _a4; var getThumb = function(component) { return getPartOrDie(component, detail, "thumb"); }; var getSpectrum = function(component) { return getPartOrDie(component, detail, "spectrum"); }; var getLeftEdge = function(component) { return getPart(component, detail, "left-edge"); }; var getRightEdge = function(component) { return getPart(component, detail, "right-edge"); }; var getTopEdge = function(component) { return getPart(component, detail, "top-edge"); }; var getBottomEdge = function(component) { return getPart(component, detail, "bottom-edge"); }; var modelDetail = detail.model; var model = modelDetail.manager; var refresh2 = function(slider, thumb) { model.setPositionFromValue(slider, thumb, detail, { getLeftEdge, getRightEdge, getTopEdge, getBottomEdge, getSpectrum }); }; var setValue10 = function(slider, newValue) { modelDetail.value.set(newValue); var thumb = getThumb(slider); refresh2(slider, thumb); }; var changeValue = function(slider, newValue) { setValue10(slider, newValue); var thumb = getThumb(slider); detail.onChange(slider, thumb, newValue); return Optional.some(true); }; var resetToMin = function(slider) { model.setToMin(slider, detail); }; var resetToMax = function(slider) { model.setToMax(slider, detail); }; var choose2 = function(slider) { var fireOnChoose = function() { getPart(slider, detail, "thumb").each(function(thumb) { var value25 = modelDetail.value.get(); detail.onChoose(slider, thumb, value25); }); }; var wasDown = detail.mouseIsDown.get(); detail.mouseIsDown.set(false); if (wasDown) { fireOnChoose(); } }; var onDragStart2 = function(slider, simulatedEvent) { simulatedEvent.stop(); detail.mouseIsDown.set(true); detail.onDragStart(slider, getThumb(slider)); }; var onDragEnd2 = function(slider, simulatedEvent) { simulatedEvent.stop(); detail.onDragEnd(slider, getThumb(slider)); choose2(slider); }; return { uid: detail.uid, dom: detail.dom, components: components4, behaviours: augment(detail.sliderBehaviours, [ Keying.config({ mode: "special", focusIn: function(slider) { return getPart(slider, detail, "spectrum").map(Keying.focusIn).map(always); } }), Representing.config({ store: { mode: "manual", getValue: function(_2) { return modelDetail.value.get(); } } }), Receiving.config({ channels: (_a4 = {}, _a4[mouseReleased()] = { onReceive: choose2 }, _a4) }) ]), events: derive$2([ run$1(sliderChangeEvent(), function(slider, simulatedEvent) { changeValue(slider, simulatedEvent.event.value); }), runOnAttached(function(slider, _simulatedEvent) { var getInitial = modelDetail.getInitialValue(); modelDetail.value.set(getInitial); var thumb = getThumb(slider); refresh2(slider, thumb); var spectrum = getSpectrum(slider); detail.onInit(slider, thumb, spectrum, modelDetail.value.get()); }), run$1(touchstart(), onDragStart2), run$1(touchend(), onDragEnd2), run$1(mousedown(), onDragStart2), run$1(mouseup(), onDragEnd2) ]), apis: { resetToMin, resetToMax, setValue: setValue10, refresh: refresh2 }, domModification: { styles: { position: "relative" } } }; }; var Slider2 = composite({ name: "Slider", configFields: SliderSchema, partFields: SliderParts, factory: sketch$2, apis: { setValue: function(apis, slider, value25) { apis.setValue(slider, value25); }, resetToMin: function(apis, slider) { apis.resetToMin(slider); }, resetToMax: function(apis, slider) { apis.resetToMax(slider); }, refresh: function(apis, slider) { apis.refresh(slider); } } }); var fieldsUpdate = generate$6("rgb-hex-update"); var sliderUpdate = generate$6("slider-update"); var paletteUpdate = generate$6("palette-update"); var sliderFactory = function(translate2, getClass2) { var spectrum = Slider2.parts.spectrum({ dom: { tag: "div", classes: [getClass2("hue-slider-spectrum")], attributes: { role: "presentation" } } }); var thumb = Slider2.parts.thumb({ dom: { tag: "div", classes: [getClass2("hue-slider-thumb")], attributes: { role: "presentation" } } }); return Slider2.sketch({ dom: { tag: "div", classes: [getClass2("hue-slider")], attributes: { role: "presentation" } }, rounded: false, model: { mode: "y", getInitialValue: constant$1({ y: 0 }) }, components: [ spectrum, thumb ], sliderBehaviours: derive$1([Focusing.config({})]), onChange: function(slider, _thumb, value25) { emitWith(slider, sliderUpdate, { value: value25 }); } }); }; var owner$1 = "form"; var schema$i = [field("formBehaviours", [Representing])]; var getPartName$1 = function(name2) { return ""; }; var sketch$1 = function(fSpec) { var parts2 = function() { var record2 = []; var field2 = function(name2, config4) { record2.push(name2); return generateOne$1(owner$1, getPartName$1(name2), config4); }; return { field: field2, record: constant$1(record2) }; }(); var spec = fSpec(parts2); var partNames = parts2.record(); var fieldParts = map$2(partNames, function(n2) { return required2({ name: n2, pname: getPartName$1(n2) }); }); return composite$1(owner$1, schema$i, fieldParts, make$4, spec); }; var toResult = function(o2, e2) { return o2.fold(function() { return Result.error(e2); }, Result.value); }; var make$4 = function(detail, components4) { return { uid: detail.uid, dom: detail.dom, components: components4, behaviours: augment(detail.formBehaviours, [Representing.config({ store: { mode: "manual", getValue: function(form) { var resPs = getAllParts(form, detail); return map$1(resPs, function(resPThunk, pName) { return resPThunk().bind(function(v2) { var opt = Composing.getCurrent(v2); return toResult(opt, new Error("Cannot find a current component to extract the value from for form part '" + pName + "': " + element(v2.element))); }).map(Representing.getValue); }); }, setValue: function(form, values3) { each2(values3, function(newValue, key2) { getPart(form, detail, key2).each(function(wrapper) { Composing.getCurrent(wrapper).each(function(field2) { Representing.setValue(field2, newValue); }); }); }); } } })]), apis: { getField: function(form, key2) { return getPart(form, detail, key2).bind(Composing.getCurrent); } } }; }; var Form2 = { getField: makeApi(function(apis, component, key2) { return apis.getField(component, key2); }), sketch: sketch$1 }; var validInput = generate$6("valid-input"); var invalidInput = generate$6("invalid-input"); var validatingInput = generate$6("validating-input"); var translatePrefix = "colorcustom.rgb."; var rgbFormFactory = function(translate2, getClass2, onValidHexx, onInvalidHexx) { var invalidation = function(label, isValid4) { return Invalidating.config({ invalidClass: getClass2("invalid"), notify: { onValidate: function(comp) { emitWith(comp, validatingInput, { type: label }); }, onValid: function(comp) { emitWith(comp, validInput, { type: label, value: Representing.getValue(comp) }); }, onInvalid: function(comp) { emitWith(comp, invalidInput, { type: label, value: Representing.getValue(comp) }); } }, validator: { validate: function(comp) { var value25 = Representing.getValue(comp); var res = isValid4(value25) ? Result.value(true) : Result.error(translate2("aria.input.invalid")); return Future.pure(res); }, validateOnLoad: false } }); }; var renderTextField2 = function(isValid4, name2, label, description, data65) { var helptext = translate2(translatePrefix + "range"); var pLabel = FormField.parts.label({ dom: { tag: "label", innerHtml: label, attributes: { "aria-label": description } } }); var pField = FormField.parts.field({ data: data65, factory: Input2, inputAttributes: __assign({ type: "text" }, name2 === "hex" ? { "aria-live": "polite" } : {}), inputClasses: [getClass2("textfield")], inputBehaviours: derive$1([ invalidation(name2, isValid4), Tabstopping.config({}) ]), onSetValue: function(input2) { if (Invalidating.isInvalid(input2)) { var run2 = Invalidating.run(input2); run2.get(noop2); } } }); var comps = [ pLabel, pField ]; var concats = name2 !== "hex" ? [FormField.parts["aria-descriptor"]({ text: helptext })] : []; var components4 = comps.concat(concats); return { dom: { tag: "div", attributes: { role: "presentation" } }, components: components4 }; }; var copyRgbToHex = function(form, rgba) { var hex2 = fromRgba(rgba); Form2.getField(form, "hex").each(function(hexField) { if (!Focusing.isFocused(hexField)) { Representing.setValue(form, { hex: hex2.value }); } }); return hex2; }; var copyRgbToForm = function(form, rgb) { var red2 = rgb.red; var green = rgb.green; var blue = rgb.blue; Representing.setValue(form, { red: red2, green, blue }); }; var memPreview = record({ dom: { tag: "div", classes: [getClass2("rgba-preview")], styles: { "background-color": "white" }, attributes: { role: "presentation" } } }); var updatePreview = function(anyInSystem, hex2) { memPreview.getOpt(anyInSystem).each(function(preview) { set$7(preview.element, "background-color", "#" + hex2.value); }); }; var factory2 = function() { var state = { red: Cell3(Optional.some(255)), green: Cell3(Optional.some(255)), blue: Cell3(Optional.some(255)), hex: Cell3(Optional.some("ffffff")) }; var copyHexToRgb = function(form, hex2) { var rgb = fromHex(hex2); copyRgbToForm(form, rgb); setValueRgb(rgb); }; var get3 = function(prop) { return state[prop].get(); }; var set3 = function(prop, value25) { state[prop].set(value25); }; var getValueRgb = function() { return get3("red").bind(function(red2) { return get3("green").bind(function(green) { return get3("blue").map(function(blue) { return rgbaColour(red2, green, blue, 1); }); }); }); }; var setValueRgb = function(rgb) { var red2 = rgb.red; var green = rgb.green; var blue = rgb.blue; set3("red", Optional.some(red2)); set3("green", Optional.some(green)); set3("blue", Optional.some(blue)); }; var onInvalidInput = function(form, simulatedEvent) { var data65 = simulatedEvent.event; if (data65.type !== "hex") { set3(data65.type, Optional.none()); } else { onInvalidHexx(form); } }; var onValidHex = function(form, value25) { onValidHexx(form); var hex2 = hexColour(value25); set3("hex", Optional.some(value25)); var rgb = fromHex(hex2); copyRgbToForm(form, rgb); setValueRgb(rgb); emitWith(form, fieldsUpdate, { hex: hex2 }); updatePreview(form, hex2); }; var onValidRgb = function(form, prop, value25) { var val = parseInt(value25, 10); set3(prop, Optional.some(val)); getValueRgb().each(function(rgb) { var hex2 = copyRgbToHex(form, rgb); emitWith(form, fieldsUpdate, { hex: hex2 }); updatePreview(form, hex2); }); }; var isHexInputEvent = function(data65) { return data65.type === "hex"; }; var onValidInput = function(form, simulatedEvent) { var data65 = simulatedEvent.event; if (isHexInputEvent(data65)) { onValidHex(form, data65.value); } else { onValidRgb(form, data65.type, data65.value); } }; var formPartStrings = function(key2) { return { label: translate2(translatePrefix + key2 + ".label"), description: translate2(translatePrefix + key2 + ".description") }; }; var redStrings = formPartStrings("red"); var greenStrings = formPartStrings("green"); var blueStrings = formPartStrings("blue"); var hexStrings = formPartStrings("hex"); return deepMerge2(Form2.sketch(function(parts2) { return { dom: { tag: "form", classes: [getClass2("rgb-form")], attributes: { "aria-label": translate2("aria.color.picker") } }, components: [ parts2.field("red", FormField.sketch(renderTextField2(isRgbaComponent, "red", redStrings.label, redStrings.description, 255))), parts2.field("green", FormField.sketch(renderTextField2(isRgbaComponent, "green", greenStrings.label, greenStrings.description, 255))), parts2.field("blue", FormField.sketch(renderTextField2(isRgbaComponent, "blue", blueStrings.label, blueStrings.description, 255))), parts2.field("hex", FormField.sketch(renderTextField2(isHexString, "hex", hexStrings.label, hexStrings.description, "ffffff"))), memPreview.asSpec() ], formBehaviours: derive$1([ Invalidating.config({ invalidClass: getClass2("form-invalid") }), config3("rgb-form-events", [ run$1(validInput, onValidInput), run$1(invalidInput, onInvalidInput), run$1(validatingInput, onInvalidInput) ]) ]) }; }), { apis: { updateHex: function(form, hex2) { Representing.setValue(form, { hex: hex2.value }); copyHexToRgb(form, hex2); updatePreview(form, hex2); } } }); }; var rgbFormSketcher = single({ factory: factory2, name: "RgbForm", configFields: [], apis: { updateHex: function(apis, form, hex2) { apis.updateHex(form, hex2); } }, extraApis: {} }); return rgbFormSketcher; }; var paletteFactory = function(_translate, getClass2) { var spectrumPart2 = Slider2.parts.spectrum({ dom: { tag: "canvas", attributes: { role: "presentation" }, classes: [getClass2("sv-palette-spectrum")] } }); var thumbPart2 = Slider2.parts.thumb({ dom: { tag: "div", attributes: { role: "presentation" }, classes: [getClass2("sv-palette-thumb")], innerHtml: "' } }); var setColour = function(canvas, rgba) { var width2 = canvas.width, height2 = canvas.height; var ctx = canvas.getContext("2d"); if (ctx === null) { return; } ctx.fillStyle = rgba; ctx.fillRect(0, 0, width2, height2); var grdWhite = ctx.createLinearGradient(0, 0, width2, 0); grdWhite.addColorStop(0, "rgba(255,255,255,1)"); grdWhite.addColorStop(1, "rgba(255,255,255,0)"); ctx.fillStyle = grdWhite; ctx.fillRect(0, 0, width2, height2); var grdBlack = ctx.createLinearGradient(0, 0, 0, height2); grdBlack.addColorStop(0, "rgba(0,0,0,0)"); grdBlack.addColorStop(1, "rgba(0,0,0,1)"); ctx.fillStyle = grdBlack; ctx.fillRect(0, 0, width2, height2); }; var setPaletteHue = function(slider, hue) { var canvas = slider.components()[0].element.dom; var hsv = hsvColour(hue, 100, 100); var rgba = fromHsv(hsv); setColour(canvas, toString3(rgba)); }; var setPaletteThumb = function(slider, hex2) { var hsv = fromRgb(fromHex(hex2)); Slider2.setValue(slider, { x: hsv.saturation, y: 100 - hsv.value }); }; var factory2 = function(_detail) { var getInitialValue = constant$1({ x: 0, y: 0 }); var onChange8 = function(slider, _thumb, value25) { emitWith(slider, paletteUpdate, { value: value25 }); }; var onInit = function(_slider, _thumb, spectrum, _value) { setColour(spectrum.element.dom, toString3(red)); }; var sliderBehaviours = derive$1([ Composing.config({ find: Optional.some }), Focusing.config({}) ]); return Slider2.sketch({ dom: { tag: "div", attributes: { role: "presentation" }, classes: [getClass2("sv-palette")] }, model: { mode: "xy", getInitialValue }, rounded: false, components: [ spectrumPart2, thumbPart2 ], onChange: onChange8, onInit, sliderBehaviours }); }; var saturationBrightnessPaletteSketcher = single({ factory: factory2, name: "SaturationBrightnessPalette", configFields: [], apis: { setHue: function(_apis, slider, hue) { setPaletteHue(slider, hue); }, setThumb: function(_apis, slider, hex2) { setPaletteThumb(slider, hex2); } }, extraApis: {} }); return saturationBrightnessPaletteSketcher; }; var makeFactory = function(translate2, getClass2) { var factory2 = function(detail) { var rgbForm = rgbFormFactory(translate2, getClass2, detail.onValidHex, detail.onInvalidHex); var sbPalette = paletteFactory(translate2, getClass2); var hueSliderToDegrees = function(hue) { return (100 - hue) / 100 * 360; }; var hueDegreesToSlider = function(hue) { return 100 - hue / 360 * 100; }; var state = { paletteRgba: Cell3(red), paletteHue: Cell3(0) }; var memSlider = record(sliderFactory(translate2, getClass2)); var memPalette = record(sbPalette.sketch({})); var memRgb = record(rgbForm.sketch({})); var updatePalette = function(anyInSystem, _hex, hue) { memPalette.getOpt(anyInSystem).each(function(palette) { sbPalette.setHue(palette, hue); }); }; var updateFields = function(anyInSystem, hex2) { memRgb.getOpt(anyInSystem).each(function(form) { rgbForm.updateHex(form, hex2); }); }; var updateSlider = function(anyInSystem, _hex, hue) { memSlider.getOpt(anyInSystem).each(function(slider) { Slider2.setValue(slider, { y: hueDegreesToSlider(hue) }); }); }; var updatePaletteThumb = function(anyInSystem, hex2) { memPalette.getOpt(anyInSystem).each(function(palette) { sbPalette.setThumb(palette, hex2); }); }; var updateState = function(hex2, hue) { var rgba = fromHex(hex2); state.paletteRgba.set(rgba); state.paletteHue.set(hue); }; var runUpdates = function(anyInSystem, hex2, hue, updates) { updateState(hex2, hue); each$12(updates, function(update) { update(anyInSystem, hex2, hue); }); }; var onPaletteUpdate = function() { var updates = [updateFields]; return function(form, simulatedEvent) { var value25 = simulatedEvent.event.value; var oldHue = state.paletteHue.get(); var newHsv = hsvColour(oldHue, value25.x, 100 - value25.y); var newHex = hsvToHex(newHsv); runUpdates(form, newHex, oldHue, updates); }; }; var onSliderUpdate = function() { var updates = [ updatePalette, updateFields ]; return function(form, simulatedEvent) { var hue = hueSliderToDegrees(simulatedEvent.event.value.y); var oldRgb = state.paletteRgba.get(); var oldHsv = fromRgb(oldRgb); var newHsv = hsvColour(hue, oldHsv.saturation, oldHsv.value); var newHex = hsvToHex(newHsv); runUpdates(form, newHex, hue, updates); }; }; var onFieldsUpdate = function() { var updates = [ updatePalette, updateSlider, updatePaletteThumb ]; return function(form, simulatedEvent) { var hex2 = simulatedEvent.event.hex; var hsv = hexToHsv(hex2); runUpdates(form, hex2, hsv.hue, updates); }; }; return { uid: detail.uid, dom: detail.dom, components: [ memPalette.asSpec(), memSlider.asSpec(), memRgb.asSpec() ], behaviours: derive$1([ config3("colour-picker-events", [ run$1(fieldsUpdate, onFieldsUpdate()), run$1(paletteUpdate, onPaletteUpdate()), run$1(sliderUpdate, onSliderUpdate()) ]), Composing.config({ find: function(comp) { return memRgb.getOpt(comp); } }), Keying.config({ mode: "acyclic" }) ]) }; }; var colourPickerSketcher = single({ name: "ColourPicker", configFields: [ required$12("dom"), defaulted("onValidHex", noop2), defaulted("onInvalidHex", noop2) ], factory: factory2 }); return colourPickerSketcher; }; var self$1 = function() { return Composing.config({ find: Optional.some }); }; var memento$1 = function(mem) { return Composing.config({ find: mem.getOpt }); }; var childAt = function(index2) { return Composing.config({ find: function(comp) { return child$2(comp.element, index2).bind(function(element2) { return comp.getSystem().getByDom(element2).toOptional(); }); } }); }; var ComposingConfigs = { self: self$1, memento: memento$1, childAt }; var english = { "colorcustom.rgb.red.label": "R", "colorcustom.rgb.red.description": "Red component", "colorcustom.rgb.green.label": "G", "colorcustom.rgb.green.description": "Green component", "colorcustom.rgb.blue.label": "B", "colorcustom.rgb.blue.description": "Blue component", "colorcustom.rgb.hex.label": "#", "colorcustom.rgb.hex.description": "Hex color code", "colorcustom.rgb.range": "Range 0 to 255", "colorcustom.sb.saturation": "Saturation", "colorcustom.sb.brightness": "Brightness", "colorcustom.sb.picker": "Saturation and Brightness Picker", "colorcustom.sb.palette": "Saturation and Brightness Palette", "colorcustom.sb.instructions": "Use arrow keys to select saturation and brightness, on x and y axes", "colorcustom.hue.hue": "Hue", "colorcustom.hue.slider": "Hue Slider", "colorcustom.hue.palette": "Hue Palette", "colorcustom.hue.instructions": "Use arrow keys to select a hue", "aria.color.picker": "Color Picker", "aria.input.invalid": "Invalid input" }; var getEnglishText = function(key2) { return english[key2]; }; var translate$1 = function(key2) { return getEnglishText(key2); }; var renderColorPicker = function(_spec) { var getClass2 = function(key2) { return "tox-" + key2; }; var colourPickerFactory = makeFactory(translate$1, getClass2); var onValidHex = function(form) { emitWith(form, formActionEvent, { name: "hex-valid", value: true }); }; var onInvalidHex = function(form) { emitWith(form, formActionEvent, { name: "hex-valid", value: false }); }; var memPicker = record(colourPickerFactory.sketch({ dom: { tag: "div", classes: [getClass2("color-picker-container")], attributes: { role: "presentation" } }, onValidHex, onInvalidHex })); return { dom: { tag: "div" }, components: [memPicker.asSpec()], behaviours: derive$1([ Representing.config({ store: { mode: "manual", getValue: function(comp) { var picker = memPicker.get(comp); var optRgbForm = Composing.getCurrent(picker); var optHex = optRgbForm.bind(function(rgbForm) { var formValues = Representing.getValue(rgbForm); return formValues.hex; }); return optHex.map(function(hex2) { return "#" + hex2; }).getOr(""); }, setValue: function(comp, newValue) { var pattern3 = /^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/; var m2 = pattern3.exec(newValue); var picker = memPicker.get(comp); var optRgbForm = Composing.getCurrent(picker); optRgbForm.fold(function() { console.log("Can not find form"); }, function(rgbForm) { Representing.setValue(rgbForm, { hex: Optional.from(m2[1]).getOr("") }); Form2.getField(rgbForm, "hex").each(function(hexField) { emit2(hexField, input()); }); }); } } }), ComposingConfigs.self() ]) }; }; var global$6 = tinymce.util.Tools.resolve("tinymce.Resource"); var isOldCustomEditor = function(spec) { return has$22(spec, "init"); }; var renderCustomEditor = function(spec) { var editorApi = value$1(); var memReplaced = record({ dom: { tag: spec.tag } }); var initialValue = value$1(); return { dom: { tag: "div", classes: ["tox-custom-editor"] }, behaviours: derive$1([ config3("custom-editor-events", [runOnAttached(function(component) { memReplaced.getOpt(component).each(function(ta) { (isOldCustomEditor(spec) ? spec.init(ta.element.dom) : global$6.load(spec.scriptId, spec.scriptUrl).then(function(init2) { return init2(ta.element.dom, spec.settings); })).then(function(ea) { initialValue.on(function(cvalue) { ea.setValue(cvalue); }); initialValue.clear(); editorApi.set(ea); }); }); })]), Representing.config({ store: { mode: "manual", getValue: function() { return editorApi.get().fold(function() { return initialValue.get().getOr(""); }, function(ed) { return ed.getValue(); }); }, setValue: function(component, value25) { editorApi.get().fold(function() { initialValue.set(value25); }, function(ed) { return ed.setValue(value25); }); } } }), ComposingConfigs.self() ]), components: [memReplaced.asSpec()] }; }; var global$5 = tinymce.util.Tools.resolve("tinymce.util.Tools"); var processors = objOf([ defaulted("preprocess", identity$1), defaulted("postprocess", identity$1) ]); var memento = function(mem, rawProcessors) { var ps = asRawOrDie$1("RepresentingConfigs.memento processors", processors, rawProcessors); return Representing.config({ store: { mode: "manual", getValue: function(comp) { var other = mem.get(comp); var rawValue = Representing.getValue(other); return ps.postprocess(rawValue); }, setValue: function(comp, rawValue) { var newValue = ps.preprocess(rawValue); var other = mem.get(comp); Representing.setValue(other, newValue); } } }); }; var withComp = function(optInitialValue, getter, setter) { return Representing.config(deepMerge2({ store: { mode: "manual", getValue: getter, setValue: setter } }, optInitialValue.map(function(initialValue) { return { store: { initialValue } }; }).getOr({}))); }; var withElement = function(initialValue, getter, setter) { return withComp(initialValue, function(c2) { return getter(c2.element); }, function(c2, v2) { return setter(c2.element, v2); }); }; var domValue = function(optInitialValue) { return withElement(optInitialValue, get$5, set$4); }; var domHtml = function(optInitialValue) { return withElement(optInitialValue, get$7, set$5); }; var memory = function(initialValue) { return Representing.config({ store: { mode: "memory", initialValue } }); }; var RepresentingConfigs = { memento, withElement, withComp, domValue, domHtml, memory }; var defaultImageFileTypes = "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp"; var filterByExtension = function(files, providersBackstage) { var allowedImageFileTypes = global$5.explode(providersBackstage.getSetting("images_file_types", defaultImageFileTypes, "string")); var isFileInAllowedTypes = function(file) { return exists(allowedImageFileTypes, function(type3) { return endsWith2(file.name.toLowerCase(), "." + type3.toLowerCase()); }); }; return filter$2(from2(files), isFileInAllowedTypes); }; var renderDropZone = function(spec, providersBackstage) { var stopper2 = function(_2, se) { se.stop(); }; var sequence2 = function(actions) { return function(comp, se) { each$12(actions, function(a2) { a2(comp, se); }); }; }; var onDrop2 = function(comp, se) { if (!Disabling.isDisabled(comp)) { var transferEvent = se.event.raw; handleFiles(comp, transferEvent.dataTransfer.files); } }; var onSelect6 = function(component, simulatedEvent) { var input2 = simulatedEvent.event.raw.target; handleFiles(component, input2.files); }; var handleFiles = function(component, files) { Representing.setValue(component, filterByExtension(files, providersBackstage)); emitWith(component, formChangeEvent, { name: spec.name }); }; var memInput = record({ dom: { tag: "input", attributes: { type: "file", accept: "image/*" }, styles: { display: "none" } }, behaviours: derive$1([config3("input-file-events", [ cutter(click()), cutter(tap()) ])]) }); var renderField = function(s2) { return { uid: s2.uid, dom: { tag: "div", classes: ["tox-dropzone-container"] }, behaviours: derive$1([ RepresentingConfigs.memory([]), ComposingConfigs.self(), Disabling.config({}), Toggling.config({ toggleClass: "dragenter", toggleOnExecute: false }), config3("dropzone-events", [ run$1("dragenter", sequence2([ stopper2, Toggling.toggle ])), run$1("dragleave", sequence2([ stopper2, Toggling.toggle ])), run$1("dragover", stopper2), run$1("drop", sequence2([ stopper2, onDrop2 ])), run$1(change(), onSelect6) ]) ]), components: [{ dom: { tag: "div", classes: ["tox-dropzone"], styles: {} }, components: [ { dom: { tag: "p", innerHtml: providersBackstage.translate("Drop an image here") } }, Button2.sketch({ dom: { tag: "button", innerHtml: providersBackstage.translate("Browse for an image"), styles: { position: "relative" }, classes: [ "tox-button", "tox-button--secondary" ] }, components: [memInput.asSpec()], action: function(comp) { var inputComp = memInput.get(comp); inputComp.element.dom.click(); }, buttonBehaviours: derive$1([ Tabstopping.config({}), DisablingConfigs.button(providersBackstage.isDisabled), receivingConfig() ]) }) ] }] }; }; var pLabel = spec.label.map(function(label) { return renderLabel$2(label, providersBackstage); }); var pField = FormField.parts.field({ factory: { sketch: renderField } }); return renderFormFieldWith(pLabel, pField, ["tox-form__group--stretched"], []); }; var renderGrid = function(spec, backstage) { return { dom: { tag: "div", classes: [ "tox-form__grid", "tox-form__grid--" + spec.columns + "col" ] }, components: map$2(spec.items, backstage.interpreter) }; }; var beforeObject = generate$6("alloy-fake-before-tabstop"); var afterObject = generate$6("alloy-fake-after-tabstop"); var craftWithClasses = function(classes4) { return { dom: { tag: "div", styles: { width: "1px", height: "1px", outline: "none" }, attributes: { tabindex: "0" }, classes: classes4 }, behaviours: derive$1([ Focusing.config({ ignore: true }), Tabstopping.config({}) ]) }; }; var craft = function(spec) { return { dom: { tag: "div", classes: ["tox-navobj"] }, components: [ craftWithClasses([beforeObject]), spec, craftWithClasses([afterObject]) ], behaviours: derive$1([ComposingConfigs.childAt(1)]) }; }; var triggerTab = function(placeholder2, shiftKey) { emitWith(placeholder2, keydown(), { raw: { which: 9, shiftKey } }); }; var onFocus5 = function(container, targetComp) { var target = targetComp.element; if (has2(target, beforeObject)) { triggerTab(container, true); } else if (has2(target, afterObject)) { triggerTab(container, false); } }; var isPseudoStop = function(element2) { return closest(element2, [ "." + beforeObject, "." + afterObject ].join(","), never); }; var platformNeedsSandboxing = !(detect$1().browser.isIE() || detect$1().browser.isEdge()); var getDynamicSource = function(isSandbox) { var cachedValue = Cell3(""); return { getValue: function(_frameComponent) { return cachedValue.get(); }, setValue: function(frameComponent, html2) { if (!isSandbox) { set$8(frameComponent.element, "src", "javascript:''"); var doc = frameComponent.element.dom.contentWindow.document; doc.open(); doc.write(html2); doc.close(); } else { set$8(frameComponent.element, "srcdoc", html2); } cachedValue.set(html2); } }; }; var renderIFrame = function(spec, providersBackstage) { var isSandbox = platformNeedsSandboxing && spec.sandboxed; var attributes2 = __assign(__assign({}, spec.label.map(function(title) { return { title }; }).getOr({})), isSandbox ? { sandbox: "allow-scripts allow-same-origin" } : {}); var sourcing = getDynamicSource(isSandbox); var pLabel = spec.label.map(function(label) { return renderLabel$2(label, providersBackstage); }); var factory2 = function(newSpec) { return craft({ uid: newSpec.uid, dom: { tag: "iframe", attributes: attributes2 }, behaviours: derive$1([ Tabstopping.config({}), Focusing.config({}), RepresentingConfigs.withComp(Optional.none(), sourcing.getValue, sourcing.setValue) ]) }); }; var pField = FormField.parts.field({ factory: { sketch: factory2 } }); return renderFormFieldWith(pLabel, pField, ["tox-form__group--stretched"], []); }; var create$4 = function(width2, height2) { return resize$3(document.createElement("canvas"), width2, height2); }; var clone$12 = function(canvas) { var tCanvas = create$4(canvas.width, canvas.height); var ctx = get2dContext(tCanvas); ctx.drawImage(canvas, 0, 0); return tCanvas; }; var get2dContext = function(canvas) { return canvas.getContext("2d"); }; var resize$3 = function(canvas, width2, height2) { canvas.width = width2; canvas.height = height2; return canvas; }; var getWidth$1 = function(image) { return image.naturalWidth || image.width; }; var getHeight$1 = function(image) { return image.naturalHeight || image.height; }; var blobToImage = function(blob) { return new Promise$12(function(resolve, reject) { var blobUrl = URL.createObjectURL(blob); var image = new Image(); var removeListeners = function() { image.removeEventListener("load", loaded2); image.removeEventListener("error", error4); }; var loaded2 = function() { removeListeners(); resolve(image); }; var error4 = function() { removeListeners(); reject("Unable to load data of type " + blob.type + ": " + blobUrl); }; image.addEventListener("load", loaded2); image.addEventListener("error", error4); image.src = blobUrl; if (image.complete) { setTimeout(loaded2, 0); } }); }; var dataUriToBlobSync = function(uri) { var data65 = uri.split(","); var matches = /data:([^;]+)/.exec(data65[0]); if (!matches) { return Optional.none(); } var mimetype = matches[1]; var base64 = data65[1]; var sliceSize = 1024; var byteCharacters = atob(base64); var bytesLength = byteCharacters.length; var slicesCount = Math.ceil(bytesLength / sliceSize); var byteArrays = new Array(slicesCount); for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) { var begin = sliceIndex * sliceSize; var end = Math.min(begin + sliceSize, bytesLength); var bytes = new Array(end - begin); for (var offset5 = begin, i2 = 0; offset5 < end; ++i2, ++offset5) { bytes[i2] = byteCharacters[offset5].charCodeAt(0); } byteArrays[sliceIndex] = new Uint8Array(bytes); } return Optional.some(new Blob(byteArrays, { type: mimetype })); }; var dataUriToBlob = function(uri) { return new Promise$12(function(resolve, reject) { dataUriToBlobSync(uri).fold(function() { reject("uri is not base64: " + uri); }, resolve); }); }; var canvasToBlob = function(canvas, type3, quality) { type3 = type3 || "image/png"; if (isFunction3(HTMLCanvasElement.prototype.toBlob)) { return new Promise$12(function(resolve, reject) { canvas.toBlob(function(blob) { if (blob) { resolve(blob); } else { reject(); } }, type3, quality); }); } else { return dataUriToBlob(canvas.toDataURL(type3, quality)); } }; var canvasToDataURL = function(canvas, type3, quality) { type3 = type3 || "image/png"; return canvas.toDataURL(type3, quality); }; var blobToCanvas = function(blob) { return blobToImage(blob).then(function(image) { revokeImageUrl(image); var canvas = create$4(getWidth$1(image), getHeight$1(image)); var context2 = get2dContext(canvas); context2.drawImage(image, 0, 0); return canvas; }); }; var blobToDataUri = function(blob) { return new Promise$12(function(resolve) { var reader = new FileReader(); reader.onloadend = function() { resolve(reader.result); }; reader.readAsDataURL(blob); }); }; var revokeImageUrl = function(image) { URL.revokeObjectURL(image.src); }; var create$3 = function(getCanvas, blob, uri) { var initialType = blob.type; var getType2 = constant$1(initialType); var toBlob = function() { return Promise$12.resolve(blob); }; var toDataURL = constant$1(uri); var toBase64 = function() { return uri.split(",")[1]; }; var toAdjustedBlob = function(type3, quality) { return getCanvas.then(function(canvas) { return canvasToBlob(canvas, type3, quality); }); }; var toAdjustedDataURL = function(type3, quality) { return getCanvas.then(function(canvas) { return canvasToDataURL(canvas, type3, quality); }); }; var toAdjustedBase64 = function(type3, quality) { return toAdjustedDataURL(type3, quality).then(function(dataurl) { return dataurl.split(",")[1]; }); }; var toCanvas = function() { return getCanvas.then(clone$12); }; return { getType: getType2, toBlob, toDataURL, toBase64, toAdjustedBlob, toAdjustedDataURL, toAdjustedBase64, toCanvas }; }; var fromBlob = function(blob) { return blobToDataUri(blob).then(function(uri) { return create$3(blobToCanvas(blob), blob, uri); }); }; var fromCanvas = function(canvas, type3) { return canvasToBlob(canvas, type3).then(function(blob) { return create$3(Promise$12.resolve(canvas), blob, canvas.toDataURL()); }); }; var blobToImageResult = function(blob) { return fromBlob(blob); }; var clamp = function(value25, min5, max5) { var parsedValue = typeof value25 === "string" ? parseFloat(value25) : value25; if (parsedValue > max5) { parsedValue = max5; } else if (parsedValue < min5) { parsedValue = min5; } return parsedValue; }; var identity2 = function() { return [ 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 ]; }; var DELTA_INDEX = [ 0, 0.01, 0.02, 0.04, 0.05, 0.06, 0.07, 0.08, 0.1, 0.11, 0.12, 0.14, 0.15, 0.16, 0.17, 0.18, 0.2, 0.21, 0.22, 0.24, 0.25, 0.27, 0.28, 0.3, 0.32, 0.34, 0.36, 0.38, 0.4, 0.42, 0.44, 0.46, 0.48, 0.5, 0.53, 0.56, 0.59, 0.62, 0.65, 0.68, 0.71, 0.74, 0.77, 0.8, 0.83, 0.86, 0.89, 0.92, 0.95, 0.98, 1, 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, 1.84, 1.9, 1.96, 2, 2.12, 2.25, 2.37, 2.5, 2.62, 2.75, 2.87, 3, 3.2, 3.4, 3.6, 3.8, 4, 4.3, 4.7, 4.9, 5, 5.5, 6, 6.5, 6.8, 7, 7.3, 7.5, 7.8, 8, 8.4, 8.7, 9, 9.4, 9.6, 9.8, 10 ]; var multiply = function(matrix1, matrix2) { var col = []; var out = new Array(25); var val; for (var i2 = 0; i2 < 5; i2++) { for (var j2 = 0; j2 < 5; j2++) { col[j2] = matrix2[j2 + i2 * 5]; } for (var j2 = 0; j2 < 5; j2++) { val = 0; for (var k2 = 0; k2 < 5; k2++) { val += matrix1[j2 + k2 * 5] * col[k2]; } out[j2 + i2 * 5] = val; } } return out; }; var adjustContrast = function(matrix2, value25) { var x2; value25 = clamp(value25, -1, 1); value25 *= 100; if (value25 < 0) { x2 = 127 + value25 / 100 * 127; } else { x2 = value25 % 1; if (x2 === 0) { x2 = DELTA_INDEX[value25]; } else { x2 = DELTA_INDEX[Math.floor(value25)] * (1 - x2) + DELTA_INDEX[Math.floor(value25) + 1] * x2; } x2 = x2 * 127 + 127; } return multiply(matrix2, [ x2 / 127, 0, 0, 0, 0.5 * (127 - x2), 0, x2 / 127, 0, 0, 0.5 * (127 - x2), 0, 0, x2 / 127, 0, 0.5 * (127 - x2), 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 ]); }; var adjustBrightness = function(matrix2, value25) { value25 = clamp(255 * value25, -255, 255); return multiply(matrix2, [ 1, 0, 0, 0, value25, 0, 1, 0, 0, value25, 0, 0, 1, 0, value25, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 ]); }; var adjustColors = function(matrix2, adjustR, adjustG, adjustB) { adjustR = clamp(adjustR, 0, 2); adjustG = clamp(adjustG, 0, 2); adjustB = clamp(adjustB, 0, 2); return multiply(matrix2, [ adjustR, 0, 0, 0, 0, 0, adjustG, 0, 0, 0, 0, 0, adjustB, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 ]); }; var colorFilter = function(ir, matrix2) { return ir.toCanvas().then(function(canvas) { return applyColorFilter(canvas, ir.getType(), matrix2); }); }; var applyColorFilter = function(canvas, type3, matrix2) { var context2 = get2dContext(canvas); var applyMatrix = function(pixelsData, m2) { var r3, g2, b3, a2; var data65 = pixelsData.data, m0 = m2[0], m1 = m2[1], m22 = m2[2], m3 = m2[3], m4 = m2[4], m5 = m2[5], m6 = m2[6], m7 = m2[7], m8 = m2[8], m9 = m2[9], m10 = m2[10], m11 = m2[11], m12 = m2[12], m13 = m2[13], m14 = m2[14], m15 = m2[15], m16 = m2[16], m17 = m2[17], m18 = m2[18], m19 = m2[19]; for (var i2 = 0; i2 < data65.length; i2 += 4) { r3 = data65[i2]; g2 = data65[i2 + 1]; b3 = data65[i2 + 2]; a2 = data65[i2 + 3]; data65[i2] = r3 * m0 + g2 * m1 + b3 * m22 + a2 * m3 + m4; data65[i2 + 1] = r3 * m5 + g2 * m6 + b3 * m7 + a2 * m8 + m9; data65[i2 + 2] = r3 * m10 + g2 * m11 + b3 * m12 + a2 * m13 + m14; data65[i2 + 3] = r3 * m15 + g2 * m16 + b3 * m17 + a2 * m18 + m19; } return pixelsData; }; var pixels = applyMatrix(context2.getImageData(0, 0, canvas.width, canvas.height), matrix2); context2.putImageData(pixels, 0, 0); return fromCanvas(canvas, type3); }; var convoluteFilter = function(ir, matrix2) { return ir.toCanvas().then(function(canvas) { return applyConvoluteFilter(canvas, ir.getType(), matrix2); }); }; var applyConvoluteFilter = function(canvas, type3, matrix2) { var context2 = get2dContext(canvas); var applyMatrix = function(pIn, pOut, aMatrix) { var clamp2 = function(value25, min5, max5) { if (value25 > max5) { value25 = max5; } else if (value25 < min5) { value25 = min5; } return value25; }; var side = Math.round(Math.sqrt(aMatrix.length)); var halfSide = Math.floor(side / 2); var rgba = pIn.data; var drgba = pOut.data; var w2 = pIn.width; var h2 = pIn.height; for (var y2 = 0; y2 < h2; y2++) { for (var x2 = 0; x2 < w2; x2++) { var r3 = 0; var g2 = 0; var b3 = 0; for (var cy = 0; cy < side; cy++) { for (var cx = 0; cx < side; cx++) { var scx = clamp2(x2 + cx - halfSide, 0, w2 - 1); var scy = clamp2(y2 + cy - halfSide, 0, h2 - 1); var innerOffset = (scy * w2 + scx) * 4; var wt = aMatrix[cy * side + cx]; r3 += rgba[innerOffset] * wt; g2 += rgba[innerOffset + 1] * wt; b3 += rgba[innerOffset + 2] * wt; } } var offset5 = (y2 * w2 + x2) * 4; drgba[offset5] = clamp2(r3, 0, 255); drgba[offset5 + 1] = clamp2(g2, 0, 255); drgba[offset5 + 2] = clamp2(b3, 0, 255); } } return pOut; }; var pixelsIn = context2.getImageData(0, 0, canvas.width, canvas.height); var pixelsOut = context2.getImageData(0, 0, canvas.width, canvas.height); pixelsOut = applyMatrix(pixelsIn, pixelsOut, matrix2); context2.putImageData(pixelsOut, 0, 0); return fromCanvas(canvas, type3); }; var functionColorFilter = function(colorFn) { var filterImpl = function(canvas, type3, value25) { var context2 = get2dContext(canvas); var lookup2 = new Array(256); var applyLookup = function(pixelsData, lookupData) { var data65 = pixelsData.data; for (var i3 = 0; i3 < data65.length; i3 += 4) { data65[i3] = lookupData[data65[i3]]; data65[i3 + 1] = lookupData[data65[i3 + 1]]; data65[i3 + 2] = lookupData[data65[i3 + 2]]; } return pixelsData; }; for (var i2 = 0; i2 < lookup2.length; i2++) { lookup2[i2] = colorFn(i2, value25); } var pixels = applyLookup(context2.getImageData(0, 0, canvas.width, canvas.height), lookup2); context2.putImageData(pixels, 0, 0); return fromCanvas(canvas, type3); }; return function(ir, value25) { return ir.toCanvas().then(function(canvas) { return filterImpl(canvas, ir.getType(), value25); }); }; }; var complexAdjustableColorFilter = function(matrixAdjustFn) { return function(ir, adjust) { return colorFilter(ir, matrixAdjustFn(identity2(), adjust)); }; }; var basicColorFilter = function(matrix2) { return function(ir) { return colorFilter(ir, matrix2); }; }; var basicConvolutionFilter = function(kernel) { return function(ir) { return convoluteFilter(ir, kernel); }; }; var invert$1 = basicColorFilter([ -1, 0, 0, 0, 255, 0, -1, 0, 0, 255, 0, 0, -1, 0, 255, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 ]); var brightness$1 = complexAdjustableColorFilter(adjustBrightness); var contrast$1 = complexAdjustableColorFilter(adjustContrast); var colorize$1 = function(ir, adjustR, adjustG, adjustB) { return colorFilter(ir, adjustColors(identity2(), adjustR, adjustG, adjustB)); }; var sharpen$1 = basicConvolutionFilter([ 0, -1, 0, -1, 5, -1, 0, -1, 0 ]); var gamma$1 = functionColorFilter(function(color, value25) { return Math.pow(color / 255, 1 - value25) * 255; }); var scale = function(image, dW, dH) { var sW = getWidth$1(image); var sH = getHeight$1(image); var wRatio = dW / sW; var hRatio = dH / sH; var scaleCapped = false; if (wRatio < 0.5 || wRatio > 2) { wRatio = wRatio < 0.5 ? 0.5 : 2; scaleCapped = true; } if (hRatio < 0.5 || hRatio > 2) { hRatio = hRatio < 0.5 ? 0.5 : 2; scaleCapped = true; } var scaled = _scale(image, wRatio, hRatio); return !scaleCapped ? scaled : scaled.then(function(tCanvas) { return scale(tCanvas, dW, dH); }); }; var _scale = function(image, wRatio, hRatio) { return new Promise$12(function(resolve) { var sW = getWidth$1(image); var sH = getHeight$1(image); var dW = Math.floor(sW * wRatio); var dH = Math.floor(sH * hRatio); var canvas = create$4(dW, dH); var context2 = get2dContext(canvas); context2.drawImage(image, 0, 0, sW, sH, 0, 0, dW, dH); resolve(canvas); }); }; var ceilWithPrecision = function(num, precision) { if (precision === void 0) { precision = 2; } var mul = Math.pow(10, precision); var upper = Math.round(num * mul); return Math.ceil(upper / mul); }; var rotate$1 = function(ir, angle) { return ir.toCanvas().then(function(canvas) { return applyRotate(canvas, ir.getType(), angle); }); }; var applyRotate = function(image, type3, angle) { var degrees = angle < 0 ? 360 + angle : angle; var rad = degrees * Math.PI / 180; var width2 = image.width; var height2 = image.height; var sin = Math.sin(rad); var cos = Math.cos(rad); var newWidth = ceilWithPrecision(Math.abs(width2 * cos) + Math.abs(height2 * sin)); var newHeight = ceilWithPrecision(Math.abs(width2 * sin) + Math.abs(height2 * cos)); var canvas = create$4(newWidth, newHeight); var context2 = get2dContext(canvas); context2.translate(newWidth / 2, newHeight / 2); context2.rotate(rad); context2.drawImage(image, -width2 / 2, -height2 / 2); return fromCanvas(canvas, type3); }; var flip$1 = function(ir, axis) { return ir.toCanvas().then(function(canvas) { return applyFlip(canvas, ir.getType(), axis); }); }; var applyFlip = function(image, type3, axis) { var canvas = create$4(image.width, image.height); var context2 = get2dContext(canvas); if (axis === "v") { context2.scale(1, -1); context2.drawImage(image, 0, -canvas.height); } else { context2.scale(-1, 1); context2.drawImage(image, -canvas.width, 0); } return fromCanvas(canvas, type3); }; var crop$1 = function(ir, x2, y2, w2, h2) { return ir.toCanvas().then(function(canvas) { return applyCrop(canvas, ir.getType(), x2, y2, w2, h2); }); }; var applyCrop = function(image, type3, x2, y2, w2, h2) { var canvas = create$4(w2, h2); var context2 = get2dContext(canvas); context2.drawImage(image, -x2, -y2); return fromCanvas(canvas, type3); }; var resize$2 = function(ir, w2, h2) { return ir.toCanvas().then(function(canvas) { return scale(canvas, w2, h2).then(function(newCanvas) { return fromCanvas(newCanvas, ir.getType()); }); }); }; var invert = function(ir) { return invert$1(ir); }; var sharpen = function(ir) { return sharpen$1(ir); }; var gamma = function(ir, value25) { return gamma$1(ir, value25); }; var colorize = function(ir, adjustR, adjustG, adjustB) { return colorize$1(ir, adjustR, adjustG, adjustB); }; var brightness = function(ir, adjust) { return brightness$1(ir, adjust); }; var contrast = function(ir, adjust) { return contrast$1(ir, adjust); }; var flip2 = function(ir, axis) { return flip$1(ir, axis); }; var crop = function(ir, x2, y2, w2, h2) { return crop$1(ir, x2, y2, w2, h2); }; var resize$1 = function(ir, w2, h2) { return resize$2(ir, w2, h2); }; var rotate = function(ir, angle) { return rotate$1(ir, angle); }; var renderIcon3 = function(iconName, iconsProvider, behaviours2) { return render$3(iconName, { tag: "span", classes: [ "tox-icon", "tox-tbtn__icon-wrap" ], behaviours: behaviours2 }, iconsProvider); }; var renderIconFromPack = function(iconName, iconsProvider) { return renderIcon3(iconName, iconsProvider, []); }; var renderReplacableIconFromPack = function(iconName, iconsProvider) { return renderIcon3(iconName, iconsProvider, [Replacing.config({})]); }; var renderLabel$1 = function(text2, prefix2, providersBackstage) { return { dom: { tag: "span", innerHtml: providersBackstage.translate(text2), classes: [prefix2 + "__select-label"] }, behaviours: derive$1([Replacing.config({})]) }; }; var _a3; var internalToolbarButtonExecute = generate$6("toolbar.button.execute"); var onToolbarButtonExecute = function(info3) { return runOnExecute$1(function(comp, _simulatedEvent) { runWithApi(info3, comp)(function(itemApi) { emitWith(comp, internalToolbarButtonExecute, { buttonApi: itemApi }); info3.onAction(itemApi); }); }); }; var toolbarButtonEventOrder = (_a3 = {}, _a3[execute$5()] = [ "disabling", "alloy.base.behaviour", "toggling", "toolbar-button-events" ], _a3); var updateMenuText = generate$6("update-menu-text"); var updateMenuIcon = generate$6("update-menu-icon"); var renderCommonDropdown = function(spec, prefix2, sharedBackstage) { var editorOffCell = Cell3(noop2); var optMemDisplayText = spec.text.map(function(text2) { return record(renderLabel$1(text2, prefix2, sharedBackstage.providers)); }); var optMemDisplayIcon = spec.icon.map(function(iconName) { return record(renderReplacableIconFromPack(iconName, sharedBackstage.providers.icons)); }); var onLeftOrRightInMenu = function(comp, se) { var dropdown = Representing.getValue(comp); Focusing.focus(dropdown); emitWith(dropdown, "keydown", { raw: se.event.raw }); Dropdown2.close(dropdown); return Optional.some(true); }; var role = spec.role.fold(function() { return {}; }, function(role2) { return { role: role2 }; }); var tooltipAttributes = spec.tooltip.fold(function() { return {}; }, function(tooltip) { var translatedTooltip = sharedBackstage.providers.translate(tooltip); return { "title": translatedTooltip, "aria-label": translatedTooltip }; }); var iconSpec = render$3("chevron-down", { tag: "div", classes: [prefix2 + "__select-chevron"] }, sharedBackstage.providers.icons); var memDropdown = record(Dropdown2.sketch(__assign(__assign(__assign({}, spec.uid ? { uid: spec.uid } : {}), role), { dom: { tag: "button", classes: [ prefix2, prefix2 + "--select" ].concat(map$2(spec.classes, function(c2) { return prefix2 + "--" + c2; })), attributes: __assign({}, tooltipAttributes) }, components: componentRenderPipeline([ optMemDisplayIcon.map(function(mem) { return mem.asSpec(); }), optMemDisplayText.map(function(mem) { return mem.asSpec(); }), Optional.some(iconSpec) ]), matchWidth: true, useMinWidth: true, dropdownBehaviours: derive$1(__spreadArray(__spreadArray([], spec.dropdownBehaviours, true), [ DisablingConfigs.button(function() { return spec.disabled || sharedBackstage.providers.isDisabled(); }), receivingConfig(), Unselecting.config({}), Replacing.config({}), config3("dropdown-events", [ onControlAttached(spec, editorOffCell), onControlDetached(spec, editorOffCell) ]), config3("menubutton-update-display-text", [ run$1(updateMenuText, function(comp, se) { optMemDisplayText.bind(function(mem) { return mem.getOpt(comp); }).each(function(displayText) { Replacing.set(displayText, [text$1(sharedBackstage.providers.translate(se.event.text))]); }); }), run$1(updateMenuIcon, function(comp, se) { optMemDisplayIcon.bind(function(mem) { return mem.getOpt(comp); }).each(function(displayIcon) { Replacing.set(displayIcon, [renderReplacableIconFromPack(se.event.icon, sharedBackstage.providers.icons)]); }); }) ]) ], false)), eventOrder: deepMerge2(toolbarButtonEventOrder, { mousedown: [ "focusing", "alloy.base.behaviour", "item-type-events", "normal-dropdown-events" ] }), sandboxBehaviours: derive$1([Keying.config({ mode: "special", onLeft: onLeftOrRightInMenu, onRight: onLeftOrRightInMenu })]), lazySink: sharedBackstage.getSink, toggleClass: prefix2 + "--active", parts: { menu: part(false, spec.columns, spec.presets) }, fetch: function(comp) { return Future.nu(curry(spec.fetch, comp)); } }))); return memDropdown.asSpec(); }; var isMenuItemReference = function(item2) { return isString3(item2); }; var isSeparator$1 = function(item2) { return item2.type === "separator"; }; var isExpandingMenuItem = function(item2) { return has$22(item2, "getSubmenuItems"); }; var separator$2 = { type: "separator" }; var unwrapReferences = function(items, menuItems) { var realItems = foldl(items, function(acc, item2) { if (isMenuItemReference(item2)) { if (item2 === "") { return acc; } else if (item2 === "|") { return acc.length > 0 && !isSeparator$1(acc[acc.length - 1]) ? acc.concat([separator$2]) : acc; } else if (has$22(menuItems, item2.toLowerCase())) { return acc.concat([menuItems[item2.toLowerCase()]]); } else { return acc; } } else { return acc.concat([item2]); } }, []); if (realItems.length > 0 && isSeparator$1(realItems[realItems.length - 1])) { realItems.pop(); } return realItems; }; var getFromExpandingItem = function(item2, menuItems) { var submenuItems = item2.getSubmenuItems(); var rest = expand(submenuItems, menuItems); var newMenus = deepMerge2(rest.menus, wrap$1(item2.value, rest.items)); var newExpansions = deepMerge2(rest.expansions, wrap$1(item2.value, item2.value)); return { item: item2, menus: newMenus, expansions: newExpansions }; }; var getFromItem = function(item2, menuItems) { return isExpandingMenuItem(item2) ? getFromExpandingItem(item2, menuItems) : { item: item2, menus: {}, expansions: {} }; }; var generateValueIfRequired = function(item2) { if (isSeparator$1(item2)) { return item2; } else { var itemValue = get$e(item2, "value").getOrThunk(function() { return generate$6("generated-menu-item"); }); return deepMerge2({ value: itemValue }, item2); } }; var expand = function(items, menuItems) { var realItems = unwrapReferences(isString3(items) ? items.split(" ") : items, menuItems); return foldr(realItems, function(acc, item2) { var itemWithValue = generateValueIfRequired(item2); var newData = getFromItem(itemWithValue, menuItems); return { menus: deepMerge2(acc.menus, newData.menus), items: [newData.item].concat(acc.items), expansions: deepMerge2(acc.expansions, newData.expansions) }; }, { menus: {}, expansions: {}, items: [] }); }; var build = function(items, itemResponse, backstage, isHorizontalMenu) { var primary = generate$6("primary-menu"); var data65 = expand(items, backstage.shared.providers.menuItems()); if (data65.items.length === 0) { return Optional.none(); } var mainMenu = createPartialMenu(primary, data65.items, itemResponse, backstage, isHorizontalMenu); var submenus = map$1(data65.menus, function(menuItems, menuName) { return createPartialMenu(menuName, menuItems, itemResponse, backstage, false); }); var menus = deepMerge2(submenus, wrap$1(primary, mainMenu)); return Optional.from(tieredMenu.tieredData(primary, menus, data65.expansions)); }; var getMenuButtonApi = function(component) { return { isDisabled: function() { return Disabling.isDisabled(component); }, setDisabled: function(state) { return Disabling.set(component, state); }, setActive: function(state) { var elm = component.element; if (state) { add$2(elm, "tox-tbtn--enabled"); set$8(elm, "aria-pressed", true); } else { remove$2(elm, "tox-tbtn--enabled"); remove$7(elm, "aria-pressed"); } }, isActive: function() { return has2(component.element, "tox-tbtn--enabled"); } }; }; var renderMenuButton = function(spec, prefix2, backstage, role) { return renderCommonDropdown({ text: spec.text, icon: spec.icon, tooltip: spec.tooltip, role, fetch: function(_comp, callback2) { spec.fetch(function(items) { callback2(build(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage, false)); }); }, onSetup: spec.onSetup, getApi: getMenuButtonApi, columns: 1, presets: "normal", classes: [], dropdownBehaviours: [Tabstopping.config({})] }, prefix2, backstage.shared); }; var getFetch2 = function(items, getButton, backstage) { var getMenuItemAction = function(item2) { return function(api3) { var newValue = !api3.isActive(); api3.setActive(newValue); item2.storage.set(newValue); backstage.shared.getSink().each(function(sink) { getButton().getOpt(sink).each(function(orig) { focus$3(orig.element); emitWith(orig, formActionEvent, { name: item2.name, value: item2.storage.get() }); }); }); }; }; var getMenuItemSetup = function(item2) { return function(api3) { api3.setActive(item2.storage.get()); }; }; return function(success3) { success3(map$2(items, function(item2) { var text2 = item2.text.fold(function() { return {}; }, function(text3) { return { text: text3 }; }); return __assign(__assign({ type: item2.type, active: false }, text2), { onAction: getMenuItemAction(item2), onSetup: getMenuItemSetup(item2) }); })); }; }; var renderCommonSpec = function(spec, actionOpt, extraBehaviours, dom2, components4, providersBackstage) { if (extraBehaviours === void 0) { extraBehaviours = []; } var action = actionOpt.fold(function() { return {}; }, function(action2) { return { action: action2 }; }); var common = __assign({ buttonBehaviours: derive$1([ DisablingConfigs.button(function() { return spec.disabled || providersBackstage.isDisabled(); }), receivingConfig(), Tabstopping.config({}), config3("button press", [ preventDefault2("click"), preventDefault2("mousedown") ]) ].concat(extraBehaviours)), eventOrder: { click: [ "button press", "alloy.base.behaviour" ], mousedown: [ "button press", "alloy.base.behaviour" ] } }, action); var domFinal = deepMerge2(common, { dom: dom2 }); return deepMerge2(domFinal, { components: components4 }); }; var renderIconButtonSpec = function(spec, action, providersBackstage, extraBehaviours) { if (extraBehaviours === void 0) { extraBehaviours = []; } var tooltipAttributes = spec.tooltip.map(function(tooltip) { return { "aria-label": providersBackstage.translate(tooltip), "title": providersBackstage.translate(tooltip) }; }).getOr({}); var dom2 = { tag: "button", classes: ["tox-tbtn"], attributes: tooltipAttributes }; var icon = spec.icon.map(function(iconName) { return renderIconFromPack(iconName, providersBackstage.icons); }); var components4 = componentRenderPipeline([icon]); return renderCommonSpec(spec, action, extraBehaviours, dom2, components4, providersBackstage); }; var renderIconButton = function(spec, action, providersBackstage, extraBehaviours) { if (extraBehaviours === void 0) { extraBehaviours = []; } var iconButtonSpec = renderIconButtonSpec(spec, Optional.some(action), providersBackstage, extraBehaviours); return Button2.sketch(iconButtonSpec); }; var renderButtonSpec = function(spec, action, providersBackstage, extraBehaviours, extraClasses) { if (extraBehaviours === void 0) { extraBehaviours = []; } if (extraClasses === void 0) { extraClasses = []; } var translatedText = providersBackstage.translate(spec.text); var icon = spec.icon ? spec.icon.map(function(iconName) { return renderIconFromPack(iconName, providersBackstage.icons); }) : Optional.none(); var components4 = icon.isSome() ? componentRenderPipeline([icon]) : []; var innerHtml = icon.isSome() ? {} : { innerHtml: translatedText }; var classes4 = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], !spec.primary && !spec.borderless ? [ "tox-button", "tox-button--secondary" ] : ["tox-button"], true), icon.isSome() ? ["tox-button--icon"] : [], true), spec.borderless ? ["tox-button--naked"] : [], true), extraClasses, true); var dom2 = __assign(__assign({ tag: "button", classes: classes4 }, innerHtml), { attributes: { title: translatedText } }); return renderCommonSpec(spec, action, extraBehaviours, dom2, components4, providersBackstage); }; var renderButton = function(spec, action, providersBackstage, extraBehaviours, extraClasses) { if (extraBehaviours === void 0) { extraBehaviours = []; } if (extraClasses === void 0) { extraClasses = []; } var buttonSpec = renderButtonSpec(spec, Optional.some(action), providersBackstage, extraBehaviours, extraClasses); return Button2.sketch(buttonSpec); }; var getAction = function(name2, buttonType) { return function(comp) { if (buttonType === "custom") { emitWith(comp, formActionEvent, { name: name2, value: {} }); } else if (buttonType === "submit") { emit2(comp, formSubmitEvent); } else if (buttonType === "cancel") { emit2(comp, formCancelEvent); } else { console.error("Unknown button type: ", buttonType); } }; }; var isMenuFooterButtonSpec = function(spec, buttonType) { return buttonType === "menu"; }; var isNormalFooterButtonSpec = function(spec, buttonType) { return buttonType === "custom" || buttonType === "cancel" || buttonType === "submit"; }; var renderFooterButton = function(spec, buttonType, backstage) { if (isMenuFooterButtonSpec(spec, buttonType)) { var getButton = function() { return memButton_1; }; var menuButtonSpec = spec; var fixedSpec = __assign(__assign({}, spec), { onSetup: function(api3) { api3.setDisabled(spec.disabled); return noop2; }, fetch: getFetch2(menuButtonSpec.items, getButton, backstage) }); var memButton_1 = record(renderMenuButton(fixedSpec, "tox-tbtn", backstage, Optional.none())); return memButton_1.asSpec(); } else if (isNormalFooterButtonSpec(spec, buttonType)) { var action = getAction(spec.name, buttonType); var buttonSpec = __assign(__assign({}, spec), { borderless: false }); return renderButton(buttonSpec, action, backstage.shared.providers, []); } else { console.error("Unknown footer button type: ", buttonType); } }; var renderDialogButton = function(spec, providersBackstage) { var action = getAction(spec.name, "custom"); return renderFormField(Optional.none(), FormField.parts.field(__assign({ factory: Button2 }, renderButtonSpec(spec, Optional.some(action), providersBackstage, [ RepresentingConfigs.memory(""), ComposingConfigs.self() ])))); }; var schema$h = constant$1([ defaulted("field1Name", "field1"), defaulted("field2Name", "field2"), onStrictHandler("onLockedChange"), markers$1(["lockClass"]), defaulted("locked", false), SketchBehaviours.field("coupledFieldBehaviours", [ Composing, Representing ]) ]); var getField = function(comp, detail, partName) { return getPart(comp, detail, partName).bind(Composing.getCurrent); }; var coupledPart = function(selfName, otherName) { return required2({ factory: FormField, name: selfName, overrides: function(detail) { return { fieldBehaviours: derive$1([config3("coupled-input-behaviour", [run$1(input(), function(me) { getField(me, detail, otherName).each(function(other) { getPart(me, detail, "lock").each(function(lock) { if (Toggling.isOn(lock)) { detail.onLockedChange(me, other, lock); } }); }); })])]) }; } }); }; var parts$c = constant$1([ coupledPart("field1", "field2"), coupledPart("field2", "field1"), required2({ factory: Button2, schema: [required$12("dom")], name: "lock", overrides: function(detail) { return { buttonBehaviours: derive$1([Toggling.config({ selected: detail.locked, toggleClass: detail.markers.lockClass, aria: { mode: "pressed" } })]) }; } }) ]); var factory$f = function(detail, components4, _spec, _externals) { return { uid: detail.uid, dom: detail.dom, components: components4, behaviours: SketchBehaviours.augment(detail.coupledFieldBehaviours, [ Composing.config({ find: Optional.some }), Representing.config({ store: { mode: "manual", getValue: function(comp) { var _a4; var parts2 = getPartsOrDie(comp, detail, [ "field1", "field2" ]); return _a4 = {}, _a4[detail.field1Name] = Representing.getValue(parts2.field1()), _a4[detail.field2Name] = Representing.getValue(parts2.field2()), _a4; }, setValue: function(comp, value25) { var parts2 = getPartsOrDie(comp, detail, [ "field1", "field2" ]); if (hasNonNullableKey(value25, detail.field1Name)) { Representing.setValue(parts2.field1(), value25[detail.field1Name]); } if (hasNonNullableKey(value25, detail.field2Name)) { Representing.setValue(parts2.field2(), value25[detail.field2Name]); } } } }) ]), apis: { getField1: function(component) { return getPart(component, detail, "field1"); }, getField2: function(component) { return getPart(component, detail, "field2"); }, getLock: function(component) { return getPart(component, detail, "lock"); } } }; }; var FormCoupledInputs = composite({ name: "FormCoupledInputs", configFields: schema$h(), partFields: parts$c(), factory: factory$f, apis: { getField1: function(apis, component) { return apis.getField1(component); }, getField2: function(apis, component) { return apis.getField2(component); }, getLock: function(apis, component) { return apis.getLock(component); } } }); var formatSize = function(size) { var unitDec = { "": 0, "px": 0, "pt": 1, "mm": 1, "pc": 2, "ex": 2, "em": 2, "ch": 2, "rem": 2, "cm": 3, "in": 4, "%": 4 }; var maxDecimal = function(unit) { return unit in unitDec ? unitDec[unit] : 1; }; var numText = size.value.toFixed(maxDecimal(size.unit)); if (numText.indexOf(".") !== -1) { numText = numText.replace(/\.?0*$/, ""); } return numText + size.unit; }; var parseSize = function(sizeText) { var numPattern = /^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/; var match5 = numPattern.exec(sizeText); if (match5 !== null) { var value25 = parseFloat(match5[1]); var unit = match5[2]; return Result.value({ value: value25, unit }); } else { return Result.error(sizeText); } }; var convertUnit = function(size, unit) { var inInch = { "": 96, "px": 96, "pt": 72, "cm": 2.54, "pc": 12, "mm": 25.4, "in": 1 }; var supported2 = function(u2) { return has$22(inInch, u2); }; if (size.unit === unit) { return Optional.some(size.value); } else if (supported2(size.unit) && supported2(unit)) { if (inInch[size.unit] === inInch[unit]) { return Optional.some(size.value); } else { return Optional.some(size.value / inInch[size.unit] * inInch[unit]); } } else { return Optional.none(); } }; var noSizeConversion = function(_input) { return Optional.none(); }; var ratioSizeConversion = function(scale2, unit) { return function(size) { return convertUnit(size, unit).map(function(value25) { return { value: value25 * scale2, unit }; }); }; }; var makeRatioConverter = function(currentFieldText, otherFieldText) { var cValue = parseSize(currentFieldText).toOptional(); var oValue = parseSize(otherFieldText).toOptional(); return lift2(cValue, oValue, function(cSize, oSize) { return convertUnit(cSize, oSize.unit).map(function(val) { return oSize.value / val; }).map(function(r3) { return ratioSizeConversion(r3, oSize.unit); }).getOr(noSizeConversion); }).getOr(noSizeConversion); }; var renderSizeInput = function(spec, providersBackstage) { var converter = noSizeConversion; var ratioEvent = generate$6("ratio-event"); var makeIcon = function(iconName) { return render$3(iconName, { tag: "span", classes: [ "tox-icon", "tox-lock-icon__" + iconName ] }, providersBackstage.icons); }; var pLock = FormCoupledInputs.parts.lock({ dom: { tag: "button", classes: [ "tox-lock", "tox-button", "tox-button--naked", "tox-button--icon" ], attributes: { title: providersBackstage.translate(spec.label.getOr("Constrain proportions")) } }, components: [ makeIcon("lock"), makeIcon("unlock") ], buttonBehaviours: derive$1([ Disabling.config({ disabled: function() { return spec.disabled || providersBackstage.isDisabled(); } }), receivingConfig(), Tabstopping.config({}) ]) }); var formGroup = function(components4) { return { dom: { tag: "div", classes: ["tox-form__group"] }, components: components4 }; }; var getFieldPart = function(isField1) { return FormField.parts.field({ factory: Input2, inputClasses: ["tox-textfield"], inputBehaviours: derive$1([ Disabling.config({ disabled: function() { return spec.disabled || providersBackstage.isDisabled(); } }), receivingConfig(), Tabstopping.config({}), config3("size-input-events", [ run$1(focusin(), function(component, _simulatedEvent) { emitWith(component, ratioEvent, { isField1 }); }), run$1(change(), function(component, _simulatedEvent) { emitWith(component, formChangeEvent, { name: spec.name }); }) ]) ]), selectOnFocus: false }); }; var getLabel3 = function(label) { return { dom: { tag: "label", classes: ["tox-label"], innerHtml: providersBackstage.translate(label) } }; }; var widthField = FormCoupledInputs.parts.field1(formGroup([ FormField.parts.label(getLabel3("Width")), getFieldPart(true) ])); var heightField = FormCoupledInputs.parts.field2(formGroup([ FormField.parts.label(getLabel3("Height")), getFieldPart(false) ])); return FormCoupledInputs.sketch({ dom: { tag: "div", classes: ["tox-form__group"] }, components: [{ dom: { tag: "div", classes: ["tox-form__controls-h-stack"] }, components: [ widthField, heightField, formGroup([ getLabel3(" "), pLock ]) ] }], field1Name: "width", field2Name: "height", locked: true, markers: { lockClass: "tox-locked" }, onLockedChange: function(current2, other, _lock) { parseSize(Representing.getValue(current2)).each(function(size) { converter(size).each(function(newSize) { Representing.setValue(other, formatSize(newSize)); }); }); }, coupledFieldBehaviours: derive$1([ Disabling.config({ disabled: function() { return spec.disabled || providersBackstage.isDisabled(); }, onDisabled: function(comp) { FormCoupledInputs.getField1(comp).bind(FormField.getField).each(Disabling.disable); FormCoupledInputs.getField2(comp).bind(FormField.getField).each(Disabling.disable); FormCoupledInputs.getLock(comp).each(Disabling.disable); }, onEnabled: function(comp) { FormCoupledInputs.getField1(comp).bind(FormField.getField).each(Disabling.enable); FormCoupledInputs.getField2(comp).bind(FormField.getField).each(Disabling.enable); FormCoupledInputs.getLock(comp).each(Disabling.enable); } }), receivingConfig(), config3("size-input-events2", [run$1(ratioEvent, function(component, simulatedEvent) { var isField1 = simulatedEvent.event.isField1; var optCurrent = isField1 ? FormCoupledInputs.getField1(component) : FormCoupledInputs.getField2(component); var optOther = isField1 ? FormCoupledInputs.getField2(component) : FormCoupledInputs.getField1(component); var value1 = optCurrent.map(Representing.getValue).getOr(""); var value25 = optOther.map(Representing.getValue).getOr(""); converter = makeRatioConverter(value1, value25); })]) ]) }); }; var undo = constant$1(generate$6("undo")); var redo = constant$1(generate$6("redo")); var zoom = constant$1(generate$6("zoom")); var back = constant$1(generate$6("back")); var apply$1 = constant$1(generate$6("apply")); var swap2 = constant$1(generate$6("swap")); var transform$1 = constant$1(generate$6("transform")); var tempTransform = constant$1(generate$6("temp-transform")); var transformApply = constant$1(generate$6("transform-apply")); var internal = { undo, redo, zoom, back, apply: apply$1, swap: swap2, transform: transform$1, tempTransform, transformApply }; var saveState = constant$1("save-state"); var disable = constant$1("disable"); var enable = constant$1("enable"); var external = { formActionEvent, saveState, disable, enable }; var renderEditPanel = function(imagePanel, providersBackstage) { var createButton2 = function(text2, action, disabled, primary) { return record(renderButton({ name: text2, text: text2, disabled, primary, icon: Optional.none(), borderless: false }, action, providersBackstage)); }; var createIconButton = function(icon, tooltip, action, disabled) { return record(renderIconButton({ name: icon, icon: Optional.some(icon), tooltip: Optional.some(tooltip), disabled, primary: false, borderless: false }, action, providersBackstage)); }; var disableAllComponents = function(comps, eventcomp) { comps.map(function(mem) { var component = mem.get(eventcomp); if (component.hasConfigured(Disabling)) { Disabling.disable(component); } }); }; var enableAllComponents = function(comps, eventcomp) { comps.map(function(mem) { var component = mem.get(eventcomp); if (component.hasConfigured(Disabling)) { Disabling.enable(component); } }); }; var panelDom = { tag: "div", classes: [ "tox-image-tools__toolbar", "tox-image-tools-edit-panel" ] }; var noop$12 = noop2; var emit$1 = function(comp, event, data65) { emitWith(comp, event, data65); }; var emitDisable = function(component) { return emit2(component, external.disable()); }; var emitEnable = function(component) { return emit2(component, external.enable()); }; var emitTransform = function(comp, transform3) { emitDisable(comp); emit$1(comp, internal.transform(), { transform: transform3 }); emitEnable(comp); }; var emitTempTransform = function(comp, transform3) { emitDisable(comp); emit$1(comp, internal.tempTransform(), { transform: transform3 }); emitEnable(comp); }; var getBackSwap = function(anyInSystem) { return function() { memContainer.getOpt(anyInSystem).each(function(container2) { Replacing.set(container2, [ButtonPanel]); }); }; }; var emitTransformApply = function(comp, transform3) { emitDisable(comp); emit$1(comp, internal.transformApply(), { transform: transform3, swap: getBackSwap(comp) }); emitEnable(comp); }; var createBackButton = function() { return createButton2("Back", function(button2) { return emit$1(button2, internal.back(), { swap: getBackSwap(button2) }); }, false, false); }; var createSpacer = function() { return record({ dom: { tag: "div", classes: ["tox-spacer"] }, behaviours: derive$1([Disabling.config({})]) }); }; var createApplyButton = function() { return createButton2("Apply", function(button2) { return emit$1(button2, internal.apply(), { swap: getBackSwap(button2) }); }, true, true); }; var makeCropTransform = function() { return function(ir) { var rect2 = imagePanel.getRect(); return crop(ir, rect2.x, rect2.y, rect2.w, rect2.h); }; }; var cropPanelComponents = [ createBackButton(), createSpacer(), createButton2("Apply", function(button2) { var transform3 = makeCropTransform(); emitTransformApply(button2, transform3); imagePanel.hideCrop(); }, false, true) ]; var CropPanel = Container.sketch({ dom: panelDom, components: cropPanelComponents.map(function(mem) { return mem.asSpec(); }), containerBehaviours: derive$1([config3("image-tools-crop-buttons-events", [ run$1(external.disable(), function(comp, _se) { disableAllComponents(cropPanelComponents, comp); }), run$1(external.enable(), function(comp, _se) { enableAllComponents(cropPanelComponents, comp); }) ])]) }); var memSize = record(renderSizeInput({ name: "size", label: Optional.none(), constrain: true, disabled: false }, providersBackstage)); var makeResizeTransform = function(width2, height2) { return function(ir) { return resize$1(ir, width2, height2); }; }; var resizePanelComponents = [ createBackButton(), createSpacer(), memSize, createSpacer(), createButton2("Apply", function(button2) { memSize.getOpt(button2).each(function(sizeInput) { var value25 = Representing.getValue(sizeInput); var width2 = parseInt(value25.width, 10); var height2 = parseInt(value25.height, 10); var transform3 = makeResizeTransform(width2, height2); emitTransformApply(button2, transform3); }); }, false, true) ]; var ResizePanel = Container.sketch({ dom: panelDom, components: resizePanelComponents.map(function(mem) { return mem.asSpec(); }), containerBehaviours: derive$1([config3("image-tools-resize-buttons-events", [ run$1(external.disable(), function(comp, _se) { disableAllComponents(resizePanelComponents, comp); }), run$1(external.enable(), function(comp, _se) { enableAllComponents(resizePanelComponents, comp); }) ])]) }); var makeValueTransform = function(transform3, value25) { return function(ir) { return transform3(ir, value25); }; }; var horizontalFlip = makeValueTransform(flip2, "h"); var verticalFlip = makeValueTransform(flip2, "v"); var counterclockwiseRotate = makeValueTransform(rotate, -90); var clockwiseRotate = makeValueTransform(rotate, 90); var flipRotateOnAction = function(comp, operation) { emitTempTransform(comp, operation); }; var flipRotateComponents = [ createBackButton(), createSpacer(), createIconButton("flip-horizontally", "Flip horizontally", function(button2) { flipRotateOnAction(button2, horizontalFlip); }, false), createIconButton("flip-vertically", "Flip vertically", function(button2) { flipRotateOnAction(button2, verticalFlip); }, false), createIconButton("rotate-left", "Rotate counterclockwise", function(button2) { flipRotateOnAction(button2, counterclockwiseRotate); }, false), createIconButton("rotate-right", "Rotate clockwise", function(button2) { flipRotateOnAction(button2, clockwiseRotate); }, false), createSpacer(), createApplyButton() ]; var FlipRotatePanel = Container.sketch({ dom: panelDom, components: flipRotateComponents.map(function(mem) { return mem.asSpec(); }), containerBehaviours: derive$1([config3("image-tools-fliprotate-buttons-events", [ run$1(external.disable(), function(comp, _se) { disableAllComponents(flipRotateComponents, comp); }), run$1(external.enable(), function(comp, _se) { enableAllComponents(flipRotateComponents, comp); }) ])]) }); var makeSlider = function(label, onChoose, min5, value25, max5) { var labelPart2 = Slider2.parts.label({ dom: { tag: "label", classes: ["tox-label"], innerHtml: providersBackstage.translate(label) } }); var spectrum = Slider2.parts.spectrum({ dom: { tag: "div", classes: ["tox-slider__rail"], attributes: { role: "presentation" } } }); var thumb = Slider2.parts.thumb({ dom: { tag: "div", classes: ["tox-slider__handle"], attributes: { role: "presentation" } } }); return record(Slider2.sketch({ dom: { tag: "div", classes: ["tox-slider"], attributes: { role: "presentation" } }, model: { mode: "x", minX: min5, maxX: max5, getInitialValue: constant$1({ x: value25 }) }, components: [ labelPart2, spectrum, thumb ], sliderBehaviours: derive$1([Focusing.config({})]), onChoose })); }; var makeVariableSlider = function(label, transform3, min5, value25, max5) { var onChoose = function(slider, _thumb, value26) { var valTransform = makeValueTransform(transform3, value26.x / 100); emitTransform(slider, valTransform); }; return makeSlider(label, onChoose, min5, value25, max5); }; var variableFilterPanelComponents = function(label, transform3, min5, value25, max5) { return [ createBackButton(), makeVariableSlider(label, transform3, min5, value25, max5), createApplyButton() ]; }; var createVariableFilterPanel = function(label, transform3, min5, value25, max5) { var filterPanelComponents2 = variableFilterPanelComponents(label, transform3, min5, value25, max5); return Container.sketch({ dom: panelDom, components: filterPanelComponents2.map(function(mem) { return mem.asSpec(); }), containerBehaviours: derive$1([config3("image-tools-filter-panel-buttons-events", [ run$1(external.disable(), function(comp, _se) { disableAllComponents(filterPanelComponents2, comp); }), run$1(external.enable(), function(comp, _se) { enableAllComponents(filterPanelComponents2, comp); }) ])]) }); }; var filterPanelComponents = [ createBackButton(), createSpacer(), createApplyButton() ]; var FilterPanel = Container.sketch({ dom: panelDom, components: filterPanelComponents.map(function(mem) { return mem.asSpec(); }) }); var BrightnessPanel = createVariableFilterPanel("Brightness", brightness, -100, 0, 100); var ContrastPanel = createVariableFilterPanel("Contrast", contrast, -100, 0, 100); var GammaPanel = createVariableFilterPanel("Gamma", gamma, -100, 0, 100); var makeColorTransform = function(red2, green, blue) { return function(ir) { return colorize(ir, red2, green, blue); }; }; var makeColorSlider = function(label) { var onChoose = function(slider, _thumb, _value) { var redOpt = memRed.getOpt(slider); var blueOpt = memBlue.getOpt(slider); var greenOpt = memGreen.getOpt(slider); redOpt.each(function(red2) { blueOpt.each(function(blue) { greenOpt.each(function(green) { var r3 = Representing.getValue(red2).x / 100; var g2 = Representing.getValue(green).x / 100; var b3 = Representing.getValue(blue).x / 100; var transform3 = makeColorTransform(r3, g2, b3); emitTransform(slider, transform3); }); }); }); }; return makeSlider(label, onChoose, 0, 100, 200); }; var memRed = makeColorSlider("R"); var memGreen = makeColorSlider("G"); var memBlue = makeColorSlider("B"); var colorizePanelComponents = [ createBackButton(), memRed, memGreen, memBlue, createApplyButton() ]; var ColorizePanel = Container.sketch({ dom: panelDom, components: colorizePanelComponents.map(function(mem) { return mem.asSpec(); }) }); var getTransformPanelEvent = function(panel, transform3, update) { return function(button2) { var swap3 = function() { memContainer.getOpt(button2).each(function(container2) { Replacing.set(container2, [panel]); update(container2); }); }; emit$1(button2, internal.swap(), { transform: transform3, swap: swap3 }); }; }; var cropPanelUpdate = function(_anyInSystem) { imagePanel.showCrop(); }; var resizePanelUpdate = function(anyInSystem) { memSize.getOpt(anyInSystem).each(function(sizeInput) { var measurements = imagePanel.getMeasurements(); var width2 = measurements.width; var height2 = measurements.height; Representing.setValue(sizeInput, { width: width2, height: height2 }); }); }; var sharpenTransform = Optional.some(sharpen); var invertTransform = Optional.some(invert); var buttonPanelComponents = [ createIconButton("crop", "Crop", getTransformPanelEvent(CropPanel, Optional.none(), cropPanelUpdate), false), createIconButton("resize", "Resize", getTransformPanelEvent(ResizePanel, Optional.none(), resizePanelUpdate), false), createIconButton("orientation", "Orientation", getTransformPanelEvent(FlipRotatePanel, Optional.none(), noop$12), false), createIconButton("brightness", "Brightness", getTransformPanelEvent(BrightnessPanel, Optional.none(), noop$12), false), createIconButton("sharpen", "Sharpen", getTransformPanelEvent(FilterPanel, sharpenTransform, noop$12), false), createIconButton("contrast", "Contrast", getTransformPanelEvent(ContrastPanel, Optional.none(), noop$12), false), createIconButton("color-levels", "Color levels", getTransformPanelEvent(ColorizePanel, Optional.none(), noop$12), false), createIconButton("gamma", "Gamma", getTransformPanelEvent(GammaPanel, Optional.none(), noop$12), false), createIconButton("invert", "Invert", getTransformPanelEvent(FilterPanel, invertTransform, noop$12), false) ]; var ButtonPanel = Container.sketch({ dom: panelDom, components: buttonPanelComponents.map(function(mem) { return mem.asSpec(); }) }); var container = Container.sketch({ dom: { tag: "div" }, components: [ButtonPanel], containerBehaviours: derive$1([Replacing.config({})]) }); var memContainer = record(container); var getApplyButton = function(anyInSystem) { return memContainer.getOpt(anyInSystem).map(function(container2) { var panel = container2.components()[0]; return panel.components()[panel.components().length - 1]; }); }; return { memContainer, getApplyButton }; }; var global$4 = tinymce.util.Tools.resolve("tinymce.geom.Rect"); var global$3 = tinymce.util.Tools.resolve("tinymce.util.Observable"); var global$2 = tinymce.util.Tools.resolve("tinymce.util.VK"); var getDocumentSize = function(doc) { var max5 = Math.max; var documentElement2 = doc.documentElement; var body2 = doc.body; var scrollWidth = max5(documentElement2.scrollWidth, body2.scrollWidth); var clientWidth = max5(documentElement2.clientWidth, body2.clientWidth); var offsetWidth = max5(documentElement2.offsetWidth, body2.offsetWidth); var scrollHeight = max5(documentElement2.scrollHeight, body2.scrollHeight); var clientHeight = max5(documentElement2.clientHeight, body2.clientHeight); var offsetHeight = max5(documentElement2.offsetHeight, body2.offsetHeight); return { width: scrollWidth < offsetWidth ? clientWidth : scrollWidth, height: scrollHeight < offsetHeight ? clientHeight : scrollHeight }; }; var isTouchEvent$1 = function(e2) { return isNonNullable(e2.changedTouches); }; var updateWithTouchData = function(e2) { if (isTouchEvent$1(e2)) { var keys3 = "screenX screenY pageX pageY clientX clientY".split(" "); for (var i2 = 0; i2 < keys3.length; i2++) { e2[keys3[i2]] = e2.changedTouches[0][keys3[i2]]; } } }; function DragHelper(id2, settings) { var _a4, _b2, _c; var eventOverlay; var handleEvents = []; var overlayEvents = []; var doc = (_a4 = settings.document) !== null && _a4 !== void 0 ? _a4 : document; var root2 = (_b2 = settings.root) !== null && _b2 !== void 0 ? _b2 : doc; var sugarDoc = SugarElement.fromDom(doc); var downButton; var startX; var startY; var handleElement = SugarElement.fromDom(root2.getElementById((_c = settings.handle) !== null && _c !== void 0 ? _c : id2)); var start = function(e2) { var rawEvent = e2.raw; var docSize = getDocumentSize(doc); updateWithTouchData(rawEvent); e2.prevent(); downButton = rawEvent.button; startX = rawEvent.screenX; startY = rawEvent.screenY; var cursor = get$c(handleElement, "cursor"); eventOverlay = SugarElement.fromTag("div", doc); setAll(eventOverlay, { "position": "absolute", "top": "0", "left": "0", "width": docSize.width + "px", "height": docSize.height + "px", "z-index": 2147483647 + "", "opacity": "0.0001", cursor }); append$2(getBody2(sugarDoc), eventOverlay); overlayEvents.push(bind4(sugarDoc, "mousemove", drag), bind4(sugarDoc, "touchmove", drag), bind4(sugarDoc, "mouseup", stop3), bind4(sugarDoc, "touchend", stop3)); settings.start(rawEvent); }; var drag = function(e2) { var rawEvent = e2.raw; updateWithTouchData(rawEvent); if (rawEvent.button !== downButton) { return stop3(e2); } rawEvent.deltaX = rawEvent.screenX - startX; rawEvent.deltaY = rawEvent.screenY - startY; e2.prevent(); settings.drag(rawEvent); }; var stop3 = function(e2) { updateWithTouchData(e2.raw); each$12(overlayEvents, function(e3) { return e3.unbind(); }); overlayEvents = []; remove$5(eventOverlay); if (settings.stop) { settings.stop(e2.raw); } }; var destroy3 = function() { each$12(overlayEvents.concat(handleEvents), function(e2) { return e2.unbind(); }); overlayEvents = []; handleEvents = []; if (isNonNullable(eventOverlay)) { remove$5(eventOverlay); } }; handleEvents.push(bind4(handleElement, "mousedown", start), bind4(handleElement, "touchstart", start)); return { destroy: destroy3 }; } var count2 = 0; var create$2 = function(currentRect, viewPortRect, clampRect, containerElm, action) { var dragHelpers; var events2 = []; var prefix2 = "tox-"; var id2 = prefix2 + "crid-" + count2++; var container = SugarElement.fromDom(containerElm); var handles = [ { name: "move", xMul: 0, yMul: 0, deltaX: 1, deltaY: 1, deltaW: 0, deltaH: 0, label: "Crop Mask" }, { name: "nw", xMul: 0, yMul: 0, deltaX: 1, deltaY: 1, deltaW: -1, deltaH: -1, label: "Top Left Crop Handle" }, { name: "ne", xMul: 1, yMul: 0, deltaX: 0, deltaY: 1, deltaW: 1, deltaH: -1, label: "Top Right Crop Handle" }, { name: "sw", xMul: 0, yMul: 1, deltaX: 1, deltaY: 0, deltaW: -1, deltaH: 1, label: "Bottom Left Crop Handle" }, { name: "se", xMul: 1, yMul: 1, deltaX: 0, deltaY: 0, deltaW: 1, deltaH: 1, label: "Bottom Right Crop Handle" } ]; var blockers = [ "top", "right", "bottom", "left" ]; var getAbsoluteRect = function(outerRect, relativeRect) { return { x: relativeRect.x + outerRect.x, y: relativeRect.y + outerRect.y, w: relativeRect.w, h: relativeRect.h }; }; var getRelativeRect = function(outerRect, innerRect) { return { x: innerRect.x - outerRect.x, y: innerRect.y - outerRect.y, w: innerRect.w, h: innerRect.h }; }; var getInnerRect = function() { return getRelativeRect(clampRect, currentRect); }; var moveRect = function(handle2, startRect, deltaX, deltaY) { var x2 = startRect.x + deltaX * handle2.deltaX; var y2 = startRect.y + deltaY * handle2.deltaY; var w2 = Math.max(20, startRect.w + deltaX * handle2.deltaW); var h2 = Math.max(20, startRect.h + deltaY * handle2.deltaH); var rect2 = currentRect = global$4.clamp({ x: x2, y: y2, w: w2, h: h2 }, clampRect, handle2.name === "move"); rect2 = getRelativeRect(clampRect, rect2); instance.fire("updateRect", { rect: rect2 }); setInnerRect(rect2); }; var render124 = function() { var createDragHelper = function(handle2) { var startRect; return DragHelper(id2, { document: containerElm.ownerDocument, root: getRootNode(container).dom, handle: id2 + "-" + handle2.name, start: function() { startRect = currentRect; }, drag: function(e2) { moveRect(handle2, startRect, e2.deltaX, e2.deltaY); } }); }; var cropContainer = SugarElement.fromTag("div"); setAll$1(cropContainer, { id: id2, "class": prefix2 + "croprect-container", "role": "grid", "aria-dropeffect": "execute" }); append$2(container, cropContainer); each$12(blockers, function(blocker) { descendant(container, "#" + id2).each(function(blockerElm) { var cropBlocker = SugarElement.fromTag("div"); setAll$1(cropBlocker, { "id": id2 + "-" + blocker, "class": prefix2 + "croprect-block", "data-mce-bogus": "all" }); set$7(cropBlocker, "display", "none"); append$2(blockerElm, cropBlocker); }); }); each$12(handles, function(handle2) { descendant(container, "#" + id2).each(function(handleElm) { var cropHandle = SugarElement.fromTag("div"); setAll$1(cropHandle, { "id": id2 + "-" + handle2.name, "aria-label": handle2.label, "aria-grabbed": "false", "data-mce-bogus": "all", "role": "gridcell", "tabindex": "-1", "title": handle2.label }); add$12(cropHandle, [ prefix2 + "croprect-handle", prefix2 + "croprect-handle-" + handle2.name ]); set$7(cropHandle, "display", "none"); append$2(handleElm, cropHandle); }); }); dragHelpers = map$2(handles, createDragHelper); repaint(currentRect); var handleFocus = function(e2) { set$8(e2.target, "aria-grabbed", e2.raw.type === "focus" ? "true" : "false"); }; var handleKeydown = function(e2) { var activeHandle; each$12(handles, function(handle2) { if (get$d(e2.target, "id") === id2 + "-" + handle2.name) { activeHandle = handle2; return false; } }); var moveAndBlock = function(evt, handle2, startRect, deltaX, deltaY) { evt.stopPropagation(); evt.preventDefault(); moveRect(activeHandle, startRect, deltaX, deltaY); }; switch (e2.raw.keyCode) { case global$2.LEFT: moveAndBlock(e2, activeHandle, currentRect, -10, 0); break; case global$2.RIGHT: moveAndBlock(e2, activeHandle, currentRect, 10, 0); break; case global$2.UP: moveAndBlock(e2, activeHandle, currentRect, 0, -10); break; case global$2.DOWN: moveAndBlock(e2, activeHandle, currentRect, 0, 10); break; case global$2.ENTER: case global$2.SPACEBAR: e2.prevent(); action(); break; } }; events2.push(bind4(container, "focusin", handleFocus), bind4(container, "focusout", handleFocus), bind4(container, "keydown", handleKeydown)); }; var toggleVisibility = function(state) { var selectors = __spreadArray(__spreadArray([], map$2(handles, function(handle2) { return "#" + id2 + "-" + handle2.name; }), true), map$2(blockers, function(blocker) { return "#" + id2 + "-" + blocker; }), true).join(","); var elems = descendants(container, selectors); if (state) { each$12(elems, function(elm) { return remove$6(elm, "display"); }); } else { each$12(elems, function(elm) { return set$7(elm, "display", "none"); }); } }; var repaint = function(rect2) { var updateElementRect = function(name2, newRect) { descendant(container, "#" + id2 + "-" + name2).each(function(elm) { setAll(elm, { left: newRect.x + "px", top: newRect.y + "px", width: Math.max(0, newRect.w) + "px", height: Math.max(0, newRect.h) + "px" }); }); }; each$12(handles, function(handle2) { descendant(container, "#" + id2 + "-" + handle2.name).each(function(elm) { setAll(elm, { left: rect2.w * handle2.xMul + rect2.x + "px", top: rect2.h * handle2.yMul + rect2.y + "px" }); }); }); updateElementRect("top", { x: viewPortRect.x, y: viewPortRect.y, w: viewPortRect.w, h: rect2.y - viewPortRect.y }); updateElementRect("right", { x: rect2.x + rect2.w, y: rect2.y, w: viewPortRect.w - rect2.x - rect2.w + viewPortRect.x, h: rect2.h }); updateElementRect("bottom", { x: viewPortRect.x, y: rect2.y + rect2.h, w: viewPortRect.w, h: viewPortRect.h - rect2.y - rect2.h + viewPortRect.y }); updateElementRect("left", { x: viewPortRect.x, y: rect2.y, w: rect2.x - viewPortRect.x, h: rect2.h }); updateElementRect("move", rect2); }; var setRect = function(rect2) { currentRect = rect2; repaint(currentRect); }; var setViewPortRect = function(rect2) { viewPortRect = rect2; repaint(currentRect); }; var setInnerRect = function(rect2) { setRect(getAbsoluteRect(clampRect, rect2)); }; var setClampRect = function(rect2) { clampRect = rect2; repaint(currentRect); }; var destroy3 = function() { each$12(dragHelpers, function(helper) { return helper.destroy(); }); dragHelpers = []; each$12(events2, function(e2) { return e2.unbind(); }); events2 = []; }; render124(); var instance = __assign(__assign({}, global$3), { toggleVisibility, setClampRect, setRect, getInnerRect, setInnerRect, setViewPortRect, destroy: destroy3 }); return instance; }; var CropRect = { create: create$2 }; var loadImage = function(image) { return new global$c(function(resolve) { var loaded2 = function() { image.removeEventListener("load", loaded2); resolve(image); }; if (image.complete) { resolve(image); } else { image.addEventListener("load", loaded2); } }); }; var renderImagePanel = function(initialUrl) { var memBg = record({ dom: { tag: "div", classes: ["tox-image-tools__image-bg"], attributes: { role: "presentation" } } }); var zoomState = Cell3(1); var cropRect = api$12(); var rectState = Cell3({ x: 0, y: 0, w: 1, h: 1 }); var viewRectState = Cell3({ x: 0, y: 0, w: 1, h: 1 }); var repaintImg = function(anyInSystem, img) { memContainer.getOpt(anyInSystem).each(function(panel) { var zoom3 = zoomState.get(); var panelW = get$a(panel.element); var panelH = get$b(panel.element); var width2 = img.dom.naturalWidth * zoom3; var height2 = img.dom.naturalHeight * zoom3; var left2 = Math.max(0, panelW / 2 - width2 / 2); var top2 = Math.max(0, panelH / 2 - height2 / 2); var css2 = { left: left2.toString() + "px", top: top2.toString() + "px", width: width2.toString() + "px", height: height2.toString() + "px", position: "absolute" }; setAll(img, css2); memBg.getOpt(panel).each(function(bg) { setAll(bg.element, css2); }); cropRect.run(function(cRect) { var rect2 = rectState.get(); cRect.setRect({ x: rect2.x * zoom3 + left2, y: rect2.y * zoom3 + top2, w: rect2.w * zoom3, h: rect2.h * zoom3 }); cRect.setClampRect({ x: left2, y: top2, w: width2, h: height2 }); cRect.setViewPortRect({ x: 0, y: 0, w: panelW, h: panelH }); }); }); }; var zoomFit = function(anyInSystem, img) { memContainer.getOpt(anyInSystem).each(function(panel) { var panelW = get$a(panel.element); var panelH = get$b(panel.element); var width2 = img.dom.naturalWidth; var height2 = img.dom.naturalHeight; var zoom3 = Math.min(panelW / width2, panelH / height2); if (zoom3 >= 1) { zoomState.set(1); } else { zoomState.set(zoom3); } }); }; var updateSrc = function(anyInSystem, url2) { var img = SugarElement.fromTag("img"); set$8(img, "src", url2); return loadImage(img.dom).then(function() { if (anyInSystem.getSystem().isConnected()) { memContainer.getOpt(anyInSystem).map(function(panel) { var aImg = external$2({ element: img }); Replacing.replaceAt(panel, 1, Optional.some(aImg)); var lastViewRect = viewRectState.get(); var viewRect = { x: 0, y: 0, w: img.dom.naturalWidth, h: img.dom.naturalHeight }; viewRectState.set(viewRect); var rect2 = global$4.inflate(viewRect, -20, -20); rectState.set(rect2); if (lastViewRect.w !== viewRect.w || lastViewRect.h !== viewRect.h) { zoomFit(panel, img); } repaintImg(panel, img); }); } }); }; var zoom2 = function(anyInSystem, direction) { var currentZoom = zoomState.get(); var newZoom = direction > 0 ? Math.min(2, currentZoom + 0.1) : Math.max(0.1, currentZoom - 0.1); zoomState.set(newZoom); memContainer.getOpt(anyInSystem).each(function(panel) { var img = panel.components()[1].element; repaintImg(panel, img); }); }; var showCrop = function() { cropRect.run(function(cRect) { cRect.toggleVisibility(true); }); }; var hideCrop = function() { cropRect.run(function(cRect) { cRect.toggleVisibility(false); }); }; var getRect = function() { return rectState.get(); }; var container = Container.sketch({ dom: { tag: "div", classes: ["tox-image-tools__image"] }, components: [ memBg.asSpec(), { dom: { tag: "img", attributes: { src: initialUrl } } }, { dom: { tag: "div" }, behaviours: derive$1([config3("image-panel-crop-events", [ runOnAttached(function(comp) { memContainer.getOpt(comp).each(function(container2) { var el = container2.element.dom; var cRect = CropRect.create({ x: 10, y: 10, w: 100, h: 100 }, { x: 0, y: 0, w: 200, h: 200 }, { x: 0, y: 0, w: 200, h: 200 }, el, noop2); cRect.toggleVisibility(false); cRect.on("updateRect", function(e2) { var rect2 = e2.rect; var zoom3 = zoomState.get(); var newRect = { x: Math.round(rect2.x / zoom3), y: Math.round(rect2.y / zoom3), w: Math.round(rect2.w / zoom3), h: Math.round(rect2.h / zoom3) }; rectState.set(newRect); }); cropRect.set(cRect); }); }), runOnDetached(function() { cropRect.clear(); }) ])]) } ], containerBehaviours: derive$1([ Replacing.config({}), config3("image-panel-events", [runOnAttached(function(comp) { updateSrc(comp, initialUrl); })]) ]) }); var memContainer = record(container); var getMeasurements = function() { var viewRect = viewRectState.get(); return { width: viewRect.w, height: viewRect.h }; }; return { memContainer, updateSrc, zoom: zoom2, showCrop, hideCrop, getRect, getMeasurements }; }; var createButton = function(innerHtml, icon, disabled, action, providersBackstage) { return renderIconButton({ name: innerHtml, icon: Optional.some(icon), disabled, tooltip: Optional.some(innerHtml), primary: false, borderless: false }, action, providersBackstage); }; var setButtonEnabled = function(button2, enabled) { if (enabled) { Disabling.enable(button2); } else { Disabling.disable(button2); } }; var renderSideBar = function(providersBackstage) { var updateButtonUndoStates = function(anyInSystem, undoEnabled, redoEnabled) { memUndo.getOpt(anyInSystem).each(function(undo2) { setButtonEnabled(undo2, undoEnabled); }); memRedo.getOpt(anyInSystem).each(function(redo2) { setButtonEnabled(redo2, redoEnabled); }); }; var memUndo = record(createButton("Undo", "undo", true, function(button2) { emitWith(button2, internal.undo(), { direction: 1 }); }, providersBackstage)); var memRedo = record(createButton("Redo", "redo", true, function(button2) { emitWith(button2, internal.redo(), { direction: 1 }); }, providersBackstage)); var container = Container.sketch({ dom: { tag: "div", classes: [ "tox-image-tools__toolbar", "tox-image-tools__sidebar" ] }, components: [ memUndo.asSpec(), memRedo.asSpec(), createButton("Zoom in", "zoom-in", false, function(button2) { emitWith(button2, internal.zoom(), { direction: 1 }); }, providersBackstage), createButton("Zoom out", "zoom-out", false, function(button2) { emitWith(button2, internal.zoom(), { direction: -1 }); }, providersBackstage) ] }); return { container, updateButtonUndoStates }; }; function UndoStack() { var data65 = []; var index2 = -1; var add4 = function(state) { var removed = data65.splice(++index2); data65.push(state); return { state, removed }; }; var undo2 = function() { if (canUndo()) { return data65[--index2]; } }; var redo2 = function() { if (canRedo()) { return data65[++index2]; } }; var canUndo = function() { return index2 > 0; }; var canRedo = function() { return index2 !== -1 && index2 < data65.length - 1; }; return { data: data65, add: add4, undo: undo2, redo: redo2, canUndo, canRedo }; } var makeState = function(initialState) { var blobState = Cell3(initialState); var tempState = value$1(); var undoStack = UndoStack(); undoStack.add(initialState); var getBlobState = function() { return blobState.get(); }; var setBlobState = function(state) { blobState.set(state); }; var getTempState = function() { return tempState.get().getOrThunk(blobState.get); }; var updateTempState = function(blob) { var newTempState = createState(blob); destroyTempState(); tempState.set(newTempState); return newTempState.url; }; var createState = function(blob) { return { blob, url: URL.createObjectURL(blob) }; }; var destroyState = function(state) { URL.revokeObjectURL(state.url); }; var destroyStates = function(states) { global$5.each(states, destroyState); }; var destroyTempState = function() { tempState.on(destroyState); tempState.clear(); }; var addBlobState = function(blob) { var newState = createState(blob); setBlobState(newState); var removed = undoStack.add(newState).removed; destroyStates(removed); return newState.url; }; var addTempState = function(blob) { var newState = createState(blob); tempState.set(newState); return newState.url; }; var applyTempState = function(postApply) { return tempState.get().fold(noop2, function(temp) { addBlobState(temp.blob); postApply(); }); }; var undo2 = function() { var currentState = undoStack.undo(); setBlobState(currentState); return currentState.url; }; var redo2 = function() { var currentState = undoStack.redo(); setBlobState(currentState); return currentState.url; }; var getHistoryStates = function() { var undoEnabled = undoStack.canUndo(); var redoEnabled = undoStack.canRedo(); return { undoEnabled, redoEnabled }; }; return { getBlobState, setBlobState, addBlobState, getTempState, updateTempState, addTempState, applyTempState, destroyTempState, undo: undo2, redo: redo2, getHistoryStates }; }; var renderImageTools = function(detail, providersBackstage) { var state = makeState(detail.currentState); var zoom2 = function(anyInSystem, simulatedEvent) { var direction = simulatedEvent.event.direction; imagePanel.zoom(anyInSystem, direction); }; var updateButtonUndoStates = function(anyInSystem) { var historyStates = state.getHistoryStates(); sideBar.updateButtonUndoStates(anyInSystem, historyStates.undoEnabled, historyStates.redoEnabled); emitWith(anyInSystem, external.formActionEvent, { name: external.saveState(), value: historyStates.undoEnabled }); }; var disableUndoRedo = function(anyInSystem) { sideBar.updateButtonUndoStates(anyInSystem, false, false); }; var undo2 = function(anyInSystem, _simulatedEvent) { var url2 = state.undo(); updateSrc(anyInSystem, url2).then(function(_oImg) { unblock2(anyInSystem); updateButtonUndoStates(anyInSystem); }); }; var redo2 = function(anyInSystem, _simulatedEvent) { var url2 = state.redo(); updateSrc(anyInSystem, url2).then(function(_oImg) { unblock2(anyInSystem); updateButtonUndoStates(anyInSystem); }); }; var imageResultToBlob = function(ir) { return ir.toBlob(); }; var block2 = function(anyInSystem) { emitWith(anyInSystem, external.formActionEvent, { name: external.disable(), value: {} }); }; var unblock2 = function(anyInSystem) { editPanel.getApplyButton(anyInSystem).each(function(applyButton) { Disabling.enable(applyButton); }); emitWith(anyInSystem, external.formActionEvent, { name: external.enable(), value: {} }); }; var updateSrc = function(anyInSystem, src2) { block2(anyInSystem); return imagePanel.updateSrc(anyInSystem, src2); }; var blobManipulate = function(anyInSystem, blob, filter2, action, swap4) { block2(anyInSystem); blobToImageResult(blob).then(filter2).then(imageResultToBlob).then(action).then(function(url2) { return updateSrc(anyInSystem, url2); }).then(function() { updateButtonUndoStates(anyInSystem); swap4(); unblock2(anyInSystem); }).catch(function(err) { console.log(err); if (anyInSystem.getSystem().isConnected()) { unblock2(anyInSystem); } }); }; var manipulate = function(anyInSystem, filter2, swap4) { var blob = state.getBlobState().blob; var action = function(blob2) { return state.updateTempState(blob2); }; blobManipulate(anyInSystem, blob, filter2, action, swap4); }; var tempManipulate = function(anyInSystem, filter2) { var blob = state.getTempState().blob; var action = function(blob2) { return state.addTempState(blob2); }; blobManipulate(anyInSystem, blob, filter2, action, noop2); }; var manipulateApply = function(anyInSystem, filter2, swap4) { var blob = state.getBlobState().blob; var action = function(blob2) { var url2 = state.addBlobState(blob2); destroyTempState(anyInSystem); return url2; }; blobManipulate(anyInSystem, blob, filter2, action, swap4); }; var apply3 = function(anyInSystem, simulatedEvent) { var postApply = function() { destroyTempState(anyInSystem); var swap4 = simulatedEvent.event.swap; swap4(); }; state.applyTempState(postApply); }; var destroyTempState = function(anyInSystem) { var currentUrl = state.getBlobState().url; state.destroyTempState(); updateButtonUndoStates(anyInSystem); return currentUrl; }; var cancel2 = function(anyInSystem) { var currentUrl = destroyTempState(anyInSystem); updateSrc(anyInSystem, currentUrl).then(function(_oImg) { unblock2(anyInSystem); }); }; var back2 = function(anyInSystem, simulatedEvent) { cancel2(anyInSystem); var swap4 = simulatedEvent.event.swap; swap4(); imagePanel.hideCrop(); }; var transform3 = function(anyInSystem, simulatedEvent) { return manipulate(anyInSystem, simulatedEvent.event.transform, noop2); }; var tempTransform2 = function(anyInSystem, simulatedEvent) { return tempManipulate(anyInSystem, simulatedEvent.event.transform); }; var transformApply2 = function(anyInSystem, simulatedEvent) { return manipulateApply(anyInSystem, simulatedEvent.event.transform, simulatedEvent.event.swap); }; var imagePanel = renderImagePanel(detail.currentState.url); var sideBar = renderSideBar(providersBackstage); var editPanel = renderEditPanel(imagePanel, providersBackstage); var swap3 = function(anyInSystem, simulatedEvent) { disableUndoRedo(anyInSystem); var transform4 = simulatedEvent.event.transform; var swap4 = simulatedEvent.event.swap; transform4.fold(function() { swap4(); }, function(transform5) { manipulate(anyInSystem, transform5, swap4); }); }; return { dom: { tag: "div", attributes: { role: "presentation" } }, components: [ editPanel.memContainer.asSpec(), imagePanel.memContainer.asSpec(), sideBar.container ], behaviours: derive$1([ Representing.config({ store: { mode: "manual", getValue: function() { return state.getBlobState(); } } }), config3("image-tools-events", [ run$1(internal.undo(), undo2), run$1(internal.redo(), redo2), run$1(internal.zoom(), zoom2), run$1(internal.back(), back2), run$1(internal.apply(), apply3), run$1(internal.transform(), transform3), run$1(internal.tempTransform(), tempTransform2), run$1(internal.transformApply(), transformApply2), run$1(internal.swap(), swap3) ]), ComposingConfigs.self() ]) }; }; var renderLabel = function(spec, backstageShared) { var label = { dom: { tag: "label", innerHtml: backstageShared.providers.translate(spec.label), classes: ["tox-label"] } }; var comps = map$2(spec.items, backstageShared.interpreter); return { dom: { tag: "div", classes: ["tox-form__group"] }, components: [label].concat(comps), behaviours: derive$1([ ComposingConfigs.self(), Replacing.config({}), RepresentingConfigs.domHtml(Optional.none()), Keying.config({ mode: "acyclic" }) ]) }; }; var isSingleListItem = function(item2) { return !has$22(item2, "items"); }; var dataAttribute = "data-value"; var fetchItems = function(dropdownComp, name2, items, selectedValue5) { return map$2(items, function(item2) { if (!isSingleListItem(item2)) { return { type: "nestedmenuitem", text: item2.text, getSubmenuItems: function() { return fetchItems(dropdownComp, name2, item2.items, selectedValue5); } }; } else { return { type: "togglemenuitem", text: item2.text, value: item2.value, active: item2.value === selectedValue5, onAction: function() { Representing.setValue(dropdownComp, item2.value); emitWith(dropdownComp, formChangeEvent, { name: name2 }); Focusing.focus(dropdownComp); } }; } }); }; var findItemByValue = function(items, value25) { return findMap(items, function(item2) { if (!isSingleListItem(item2)) { return findItemByValue(item2.items, value25); } else { return someIf(item2.value === value25, item2); } }); }; var renderListBox = function(spec, backstage) { var providersBackstage = backstage.shared.providers; var initialItem = head(spec.items).filter(isSingleListItem); var pLabel = spec.label.map(function(label) { return renderLabel$2(label, providersBackstage); }); var pField = FormField.parts.field({ dom: {}, factory: { sketch: function(sketchSpec) { return renderCommonDropdown({ uid: sketchSpec.uid, text: initialItem.map(function(item2) { return item2.text; }), icon: Optional.none(), tooltip: spec.label, role: Optional.none(), fetch: function(comp, callback2) { var items = fetchItems(comp, spec.name, spec.items, Representing.getValue(comp)); callback2(build(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage, false)); }, onSetup: constant$1(noop2), getApi: constant$1({}), columns: 1, presets: "normal", classes: [], dropdownBehaviours: [ Tabstopping.config({}), Representing.config({ store: { mode: "manual", initialValue: initialItem.map(function(item2) { return item2.value; }).getOr(""), getValue: function(comp) { return get$d(comp.element, dataAttribute); }, setValue: function(comp, data65) { findItemByValue(spec.items, data65).each(function(item2) { set$8(comp.element, dataAttribute, item2.value); emitWith(comp, updateMenuText, { text: item2.text }); }); } } }) ] }, "tox-listbox", backstage.shared); } } }); var listBoxWrap = { dom: { tag: "div", classes: ["tox-listboxfield"] }, components: [pField] }; return FormField.sketch({ dom: { tag: "div", classes: ["tox-form__group"] }, components: flatten2([ pLabel.toArray(), [listBoxWrap] ]), fieldBehaviours: derive$1([Disabling.config({ disabled: constant$1(spec.disabled), onDisabled: function(comp) { FormField.getField(comp).each(Disabling.disable); }, onEnabled: function(comp) { FormField.getField(comp).each(Disabling.enable); } })]) }); }; var renderPanel = function(spec, backstage) { return { dom: { tag: "div", classes: spec.classes }, components: map$2(spec.items, backstage.shared.interpreter) }; }; var factory$e = function(detail, _spec) { var options2 = map$2(detail.options, function(option2) { return { dom: { tag: "option", value: option2.value, innerHtml: option2.text } }; }); var initialValues = detail.data.map(function(v2) { return wrap$1("initialValue", v2); }).getOr({}); return { uid: detail.uid, dom: { tag: "select", classes: detail.selectClasses, attributes: detail.selectAttributes }, components: options2, behaviours: augment(detail.selectBehaviours, [ Focusing.config({}), Representing.config({ store: __assign({ mode: "manual", getValue: function(select3) { return get$5(select3.element); }, setValue: function(select3, newValue) { var found = find$5(detail.options, function(opt) { return opt.value === newValue; }); if (found.isSome()) { set$4(select3.element, newValue); } } }, initialValues) }) ]) }; }; var HtmlSelect = single({ name: "HtmlSelect", configFields: [ required$12("options"), field("selectBehaviours", [ Focusing, Representing ]), defaulted("selectClasses", []), defaulted("selectAttributes", {}), option("data") ], factory: factory$e }); var renderSelectBox = function(spec, providersBackstage) { var translatedOptions = map$2(spec.items, function(item2) { return { text: providersBackstage.translate(item2.text), value: item2.value }; }); var pLabel = spec.label.map(function(label) { return renderLabel$2(label, providersBackstage); }); var pField = FormField.parts.field({ dom: {}, selectAttributes: { size: spec.size }, options: translatedOptions, factory: HtmlSelect, selectBehaviours: derive$1([ Disabling.config({ disabled: function() { return spec.disabled || providersBackstage.isDisabled(); } }), Tabstopping.config({}), config3("selectbox-change", [run$1(change(), function(component, _2) { emitWith(component, formChangeEvent, { name: spec.name }); })]) ]) }); var chevron = spec.size > 1 ? Optional.none() : Optional.some(render$3("chevron-down", { tag: "div", classes: ["tox-selectfield__icon-js"] }, providersBackstage.icons)); var selectWrap = { dom: { tag: "div", classes: ["tox-selectfield"] }, components: flatten2([ [pField], chevron.toArray() ]) }; return FormField.sketch({ dom: { tag: "div", classes: ["tox-form__group"] }, components: flatten2([ pLabel.toArray(), [selectWrap] ]), fieldBehaviours: derive$1([ Disabling.config({ disabled: function() { return spec.disabled || providersBackstage.isDisabled(); }, onDisabled: function(comp) { FormField.getField(comp).each(Disabling.disable); }, onEnabled: function(comp) { FormField.getField(comp).each(Disabling.enable); } }), receivingConfig() ]) }); }; var renderTable3 = function(spec, providersBackstage) { var renderTh = function(text2) { return { dom: { tag: "th", innerHtml: providersBackstage.translate(text2) } }; }; var renderHeader3 = function(header) { return { dom: { tag: "thead" }, components: [{ dom: { tag: "tr" }, components: map$2(header, renderTh) }] }; }; var renderTd = function(text2) { return { dom: { tag: "td", innerHtml: providersBackstage.translate(text2) } }; }; var renderTr = function(row) { return { dom: { tag: "tr" }, components: map$2(row, renderTd) }; }; var renderRows3 = function(rows) { return { dom: { tag: "tbody" }, components: map$2(rows, renderTr) }; }; return { dom: { tag: "table", classes: ["tox-dialog__table"] }, components: [ renderHeader3(spec.header), renderRows3(spec.cells) ], behaviours: derive$1([ Tabstopping.config({}), Focusing.config({}) ]) }; }; var renderTextField = function(spec, providersBackstage) { var pLabel = spec.label.map(function(label) { return renderLabel$2(label, providersBackstage); }); var baseInputBehaviours = [ Disabling.config({ disabled: function() { return spec.disabled || providersBackstage.isDisabled(); } }), receivingConfig(), Keying.config({ mode: "execution", useEnter: spec.multiline !== true, useControlEnter: spec.multiline === true, execute: function(comp) { emit2(comp, formSubmitEvent); return Optional.some(true); } }), config3("textfield-change", [ run$1(input(), function(component, _2) { emitWith(component, formChangeEvent, { name: spec.name }); }), run$1(postPaste(), function(component, _2) { emitWith(component, formChangeEvent, { name: spec.name }); }) ]), Tabstopping.config({}) ]; var validatingBehaviours = spec.validation.map(function(vl) { return Invalidating.config({ getRoot: function(input2) { return parent2(input2.element); }, invalidClass: "tox-invalid", validator: { validate: function(input2) { var v2 = Representing.getValue(input2); var result = vl.validator(v2); return Future.pure(result === true ? Result.value(v2) : Result.error(result)); }, validateOnLoad: vl.validateOnLoad } }); }).toArray(); var placeholder2 = spec.placeholder.fold(constant$1({}), function(p) { return { placeholder: providersBackstage.translate(p) }; }); var inputMode = spec.inputMode.fold(constant$1({}), function(mode3) { return { inputmode: mode3 }; }); var inputAttributes = __assign(__assign({}, placeholder2), inputMode); var pField = FormField.parts.field({ tag: spec.multiline === true ? "textarea" : "input", inputAttributes, inputClasses: [spec.classname], inputBehaviours: derive$1(flatten2([ baseInputBehaviours, validatingBehaviours ])), selectOnFocus: false, factory: Input2 }); var extraClasses = spec.flex ? ["tox-form__group--stretched"] : []; var extraClasses2 = extraClasses.concat(spec.maximized ? ["tox-form-group--maximize"] : []); var extraBehaviours = [ Disabling.config({ disabled: function() { return spec.disabled || providersBackstage.isDisabled(); }, onDisabled: function(comp) { FormField.getField(comp).each(Disabling.disable); }, onEnabled: function(comp) { FormField.getField(comp).each(Disabling.enable); } }), receivingConfig() ]; return renderFormFieldWith(pLabel, pField, extraClasses2, extraBehaviours); }; var renderInput2 = function(spec, providersBackstage) { return renderTextField({ name: spec.name, multiline: false, label: spec.label, inputMode: spec.inputMode, placeholder: spec.placeholder, flex: false, disabled: spec.disabled, classname: "tox-textfield", validation: Optional.none(), maximized: spec.maximized }, providersBackstage); }; var renderTextarea = function(spec, providersBackstage) { return renderTextField({ name: spec.name, multiline: true, label: spec.label, inputMode: Optional.none(), placeholder: spec.placeholder, flex: true, disabled: spec.disabled, classname: "tox-textarea", validation: Optional.none(), maximized: spec.maximized }, providersBackstage); }; var events$6 = function(streamConfig, streamState) { var streams = streamConfig.stream.streams; var processor = streams.setup(streamConfig, streamState); return derive$2([ run$1(streamConfig.event, processor), runOnDetached(function() { return streamState.cancel(); }) ].concat(streamConfig.cancelEvent.map(function(e2) { return [run$1(e2, function() { return streamState.cancel(); })]; }).getOr([]))); }; var ActiveStreaming = /* @__PURE__ */ Object.freeze({ __proto__: null, events: events$6 }); var throttle2 = function(_config) { var state = Cell3(null); var readState = function() { return { timer: state.get() !== null ? "set" : "unset" }; }; var setTimer = function(t3) { state.set(t3); }; var cancel2 = function() { var t3 = state.get(); if (t3 !== null) { t3.cancel(); } }; return nu$8({ readState, setTimer, cancel: cancel2 }); }; var init$9 = function(spec) { return spec.stream.streams.state(spec); }; var StreamingState = /* @__PURE__ */ Object.freeze({ __proto__: null, throttle: throttle2, init: init$9 }); var setup$c = function(streamInfo, streamState) { var sInfo = streamInfo.stream; var throttler = last2(streamInfo.onStream, sInfo.delay); streamState.setTimer(throttler); return function(component, simulatedEvent) { throttler.throttle(component, simulatedEvent); if (sInfo.stopEvent) { simulatedEvent.stop(); } }; }; var StreamingSchema = [ requiredOf("stream", choose$1("mode", { throttle: [ required$12("delay"), defaulted("stopEvent", true), output$1("streams", { setup: setup$c, state: throttle2 }) ] })), defaulted("event", "input"), option("cancelEvent"), onStrictHandler("onStream") ]; var Streaming = create$8({ fields: StreamingSchema, name: "streaming", active: ActiveStreaming, state: StreamingState }); var setValueFromItem = function(model, input2, item2) { var itemData = Representing.getValue(item2); Representing.setValue(input2, itemData); setCursorAtEnd(input2); }; var setSelectionOn = function(input2, f2) { var el = input2.element; var value25 = get$5(el); var node = el.dom; if (get$d(el, "type") !== "number") { f2(node, value25); } }; var setCursorAtEnd = function(input2) { setSelectionOn(input2, function(node, value25) { return node.setSelectionRange(value25.length, value25.length); }); }; var setSelectionToEnd = function(input2, startOffset) { setSelectionOn(input2, function(node, value25) { return node.setSelectionRange(startOffset, value25.length); }); }; var attemptSelectOver = function(model, input2, item2) { if (!model.selectsOver) { return Optional.none(); } else { var currentValue2 = Representing.getValue(input2); var inputDisplay_1 = model.getDisplayText(currentValue2); var itemValue = Representing.getValue(item2); var itemDisplay = model.getDisplayText(itemValue); return itemDisplay.indexOf(inputDisplay_1) === 0 ? Optional.some(function() { setValueFromItem(model, input2, item2); setSelectionToEnd(input2, inputDisplay_1.length); }) : Optional.none(); } }; var itemExecute = constant$1("alloy.typeahead.itemexecute"); var make$3 = function(detail, components4, spec, externals) { var navigateList = function(comp, simulatedEvent, highlighter) { detail.previewing.set(false); var sandbox = Coupling.getCoupled(comp, "sandbox"); if (Sandboxing.isOpen(sandbox)) { Composing.getCurrent(sandbox).each(function(menu2) { Highlighting.getHighlighted(menu2).fold(function() { highlighter(menu2); }, function() { dispatchEvent(sandbox, menu2.element, "keydown", simulatedEvent); }); }); } else { var onOpenSync = function(sandbox2) { Composing.getCurrent(sandbox2).each(highlighter); }; open6(detail, mapFetch(comp), comp, sandbox, externals, onOpenSync, HighlightOnOpen.HighlightFirst).get(noop2); } }; var focusBehaviours$1 = focusBehaviours(detail); var mapFetch = function(comp) { return function(tdata) { return tdata.map(function(data65) { var menus = values2(data65.menus); var items = bind$32(menus, function(menu2) { return filter$2(menu2.items, function(item2) { return item2.type === "item"; }); }); var repState = Representing.getState(comp); repState.update(map$2(items, function(item2) { return item2.data; })); return data65; }); }; }; var behaviours2 = [ Focusing.config({}), Representing.config({ onSetValue: detail.onSetValue, store: __assign({ mode: "dataset", getDataKey: function(comp) { return get$5(comp.element); }, getFallbackEntry: function(itemString) { return { value: itemString, meta: {} }; }, setValue: function(comp, data65) { set$4(comp.element, detail.model.getDisplayText(data65)); } }, detail.initialData.map(function(d2) { return wrap$1("initialValue", d2); }).getOr({})) }), Streaming.config({ stream: { mode: "throttle", delay: detail.responseTime, stopEvent: false }, onStream: function(component, _simulatedEvent) { var sandbox = Coupling.getCoupled(component, "sandbox"); var focusInInput = Focusing.isFocused(component); if (focusInInput) { if (get$5(component.element).length >= detail.minChars) { var previousValue_1 = Composing.getCurrent(sandbox).bind(function(menu2) { return Highlighting.getHighlighted(menu2).map(Representing.getValue); }); detail.previewing.set(true); var onOpenSync = function(_sandbox) { Composing.getCurrent(sandbox).each(function(menu2) { previousValue_1.fold(function() { if (detail.model.selectsOver) { Highlighting.highlightFirst(menu2); } }, function(pv) { Highlighting.highlightBy(menu2, function(item2) { var itemData = Representing.getValue(item2); return itemData.value === pv.value; }); Highlighting.getHighlighted(menu2).orThunk(function() { Highlighting.highlightFirst(menu2); return Optional.none(); }); }); }); }; open6(detail, mapFetch(component), component, sandbox, externals, onOpenSync, HighlightOnOpen.HighlightFirst).get(noop2); } } }, cancelEvent: typeaheadCancel() }), Keying.config({ mode: "special", onDown: function(comp, simulatedEvent) { navigateList(comp, simulatedEvent, Highlighting.highlightFirst); return Optional.some(true); }, onEscape: function(comp) { var sandbox = Coupling.getCoupled(comp, "sandbox"); if (Sandboxing.isOpen(sandbox)) { Sandboxing.close(sandbox); return Optional.some(true); } return Optional.none(); }, onUp: function(comp, simulatedEvent) { navigateList(comp, simulatedEvent, Highlighting.highlightLast); return Optional.some(true); }, onEnter: function(comp) { var sandbox = Coupling.getCoupled(comp, "sandbox"); var sandboxIsOpen = Sandboxing.isOpen(sandbox); if (sandboxIsOpen && !detail.previewing.get()) { return Composing.getCurrent(sandbox).bind(function(menu2) { return Highlighting.getHighlighted(menu2); }).map(function(item2) { emitWith(comp, itemExecute(), { item: item2 }); return true; }); } else { var currentValue2 = Representing.getValue(comp); emit2(comp, typeaheadCancel()); detail.onExecute(sandbox, comp, currentValue2); if (sandboxIsOpen) { Sandboxing.close(sandbox); } return Optional.some(true); } } }), Toggling.config({ toggleClass: detail.markers.openClass, aria: { mode: "expanded" } }), Coupling.config({ others: { sandbox: function(hotspot) { return makeSandbox$1(detail, hotspot, { onOpen: function() { return Toggling.on(hotspot); }, onClose: function() { return Toggling.off(hotspot); } }); } } }), config3("typeaheadevents", [ runOnExecute$1(function(comp) { var onOpenSync = noop2; togglePopup(detail, mapFetch(comp), comp, externals, onOpenSync, HighlightOnOpen.HighlightFirst).get(noop2); }), run$1(itemExecute(), function(comp, se) { var sandbox = Coupling.getCoupled(comp, "sandbox"); setValueFromItem(detail.model, comp, se.event.item); emit2(comp, typeaheadCancel()); detail.onItemExecute(comp, sandbox, se.event.item, Representing.getValue(comp)); Sandboxing.close(sandbox); setCursorAtEnd(comp); }) ].concat(detail.dismissOnBlur ? [run$1(postBlur(), function(typeahead) { var sandbox = Coupling.getCoupled(typeahead, "sandbox"); if (search(sandbox.element).isNone()) { Sandboxing.close(sandbox); } })] : [])) ]; return { uid: detail.uid, dom: dom(deepMerge2(detail, { inputAttributes: { "role": "combobox", "aria-autocomplete": "list", "aria-haspopup": "true" } })), behaviours: __assign(__assign({}, focusBehaviours$1), augment(detail.typeaheadBehaviours, behaviours2)), eventOrder: detail.eventOrder }; }; var schema$g = constant$1([ option("lazySink"), required$12("fetch"), defaulted("minChars", 5), defaulted("responseTime", 1e3), onHandler("onOpen"), defaulted("getHotspot", Optional.some), defaulted("getAnchorOverrides", constant$1({})), defaulted("layouts", Optional.none()), defaulted("eventOrder", {}), defaultedObjOf("model", {}, [ defaulted("getDisplayText", function(itemData) { return itemData.meta !== void 0 && itemData.meta.text !== void 0 ? itemData.meta.text : itemData.value; }), defaulted("selectsOver", true), defaulted("populateFromBrowse", true) ]), onHandler("onSetValue"), onKeyboardHandler("onExecute"), onHandler("onItemExecute"), defaulted("inputClasses", []), defaulted("inputAttributes", {}), defaulted("inputStyles", {}), defaulted("matchWidth", true), defaulted("useMinWidth", false), defaulted("dismissOnBlur", true), markers$1(["openClass"]), option("initialData"), field("typeaheadBehaviours", [ Focusing, Representing, Streaming, Keying, Toggling, Coupling ]), customField("previewing", function() { return Cell3(true); }) ].concat(schema$k()).concat(sandboxFields())); var parts$b = constant$1([external$1({ schema: [tieredMenuMarkers()], name: "menu", overrides: function(detail) { return { fakeFocus: true, onHighlight: function(menu2, item2) { if (!detail.previewing.get()) { menu2.getSystem().getByUid(detail.uid).each(function(input2) { if (detail.model.populateFromBrowse) { setValueFromItem(detail.model, input2, item2); } }); } else { menu2.getSystem().getByUid(detail.uid).each(function(input2) { attemptSelectOver(detail.model, input2, item2).fold(function() { return Highlighting.dehighlight(menu2, item2); }, function(fn) { return fn(); }); }); } detail.previewing.set(false); }, onExecute: function(menu2, item2) { return menu2.getSystem().getByUid(detail.uid).toOptional().map(function(typeahead) { emitWith(typeahead, itemExecute(), { item: item2 }); return true; }); }, onHover: function(menu2, item2) { detail.previewing.set(false); menu2.getSystem().getByUid(detail.uid).each(function(input2) { if (detail.model.populateFromBrowse) { setValueFromItem(detail.model, input2, item2); } }); } }; } })]); var Typeahead = composite({ name: "Typeahead", configFields: schema$g(), partFields: parts$b(), factory: make$3 }); var wrap = function(delegate) { var toCached = function() { return wrap(delegate.toCached()); }; var bindFuture = function(f2) { return wrap(delegate.bind(function(resA) { return resA.fold(function(err) { return Future.pure(Result.error(err)); }, function(a2) { return f2(a2); }); })); }; var bindResult = function(f2) { return wrap(delegate.map(function(resA) { return resA.bind(f2); })); }; var mapResult = function(f2) { return wrap(delegate.map(function(resA) { return resA.map(f2); })); }; var mapError2 = function(f2) { return wrap(delegate.map(function(resA) { return resA.mapError(f2); })); }; var foldResult = function(whenError, whenValue) { return delegate.map(function(res) { return res.fold(whenError, whenValue); }); }; var withTimeout = function(timeout, errorThunk) { return wrap(Future.nu(function(callback2) { var timedOut = false; var timer = setTimeout(function() { timedOut = true; callback2(Result.error(errorThunk())); }, timeout); delegate.get(function(result) { if (!timedOut) { clearTimeout(timer); callback2(result); } }); })); }; return __assign(__assign({}, delegate), { toCached, bindFuture, bindResult, mapResult, mapError: mapError2, foldResult, withTimeout }); }; var nu$1 = function(worker) { return wrap(Future.nu(worker)); }; var value24 = function(value25) { return wrap(Future.pure(Result.value(value25))); }; var error3 = function(error4) { return wrap(Future.pure(Result.error(error4))); }; var fromResult = function(result) { return wrap(Future.pure(result)); }; var fromFuture = function(future) { return wrap(future.map(Result.value)); }; var fromPromise = function(promise) { return nu$1(function(completer) { promise.then(function(value25) { completer(Result.value(value25)); }, function(error4) { completer(Result.error(error4)); }); }); }; var FutureResult = { nu: nu$1, wrap, pure: value24, value: value24, error: error3, fromResult, fromFuture, fromPromise }; var separator$1 = { type: "separator" }; var toMenuItem = function(target) { return { type: "menuitem", value: target.url, text: target.title, meta: { attach: target.attach }, onAction: noop2 }; }; var staticMenuItem = function(title, url2) { return { type: "menuitem", value: url2, text: title, meta: { attach: void 0 }, onAction: noop2 }; }; var toMenuItems = function(targets) { return map$2(targets, toMenuItem); }; var filterLinkTargets = function(type3, targets) { return filter$2(targets, function(target) { return target.type === type3; }); }; var filteredTargets = function(type3, targets) { return toMenuItems(filterLinkTargets(type3, targets)); }; var headerTargets = function(linkInfo) { return filteredTargets("header", linkInfo.targets); }; var anchorTargets = function(linkInfo) { return filteredTargets("anchor", linkInfo.targets); }; var anchorTargetTop = function(linkInfo) { return Optional.from(linkInfo.anchorTop).map(function(url2) { return staticMenuItem("", url2); }).toArray(); }; var anchorTargetBottom = function(linkInfo) { return Optional.from(linkInfo.anchorBottom).map(function(url2) { return staticMenuItem("", url2); }).toArray(); }; var historyTargets = function(history) { return map$2(history, function(url2) { return staticMenuItem(url2, url2); }); }; var joinMenuLists = function(items) { return foldl(items, function(a2, b3) { var bothEmpty = a2.length === 0 || b3.length === 0; return bothEmpty ? a2.concat(b3) : a2.concat(separator$1, b3); }, []); }; var filterByQuery = function(term, menuItems) { var lowerCaseTerm = term.toLowerCase(); return filter$2(menuItems, function(item2) { var text2 = item2.meta !== void 0 && item2.meta.text !== void 0 ? item2.meta.text : item2.text; return contains$1(text2.toLowerCase(), lowerCaseTerm) || contains$1(item2.value.toLowerCase(), lowerCaseTerm); }); }; var getItems = function(fileType, input2, urlBackstage) { var urlInputValue = Representing.getValue(input2); var term = urlInputValue.meta.text !== void 0 ? urlInputValue.meta.text : urlInputValue.value; var info3 = urlBackstage.getLinkInformation(); return info3.fold(function() { return []; }, function(linkInfo) { var history = filterByQuery(term, historyTargets(urlBackstage.getHistory(fileType))); return fileType === "file" ? joinMenuLists([ history, filterByQuery(term, headerTargets(linkInfo)), filterByQuery(term, flatten2([ anchorTargetTop(linkInfo), anchorTargets(linkInfo), anchorTargetBottom(linkInfo) ])) ]) : history; }); }; var errorId = generate$6("aria-invalid"); var renderUrlInput = function(spec, backstage, urlBackstage) { var _a4; var providersBackstage = backstage.shared.providers; var updateHistory = function(component) { var urlEntry = Representing.getValue(component); urlBackstage.addToHistory(urlEntry.value, spec.filetype); }; var pField = FormField.parts.field({ factory: Typeahead, dismissOnBlur: true, inputClasses: ["tox-textfield"], sandboxClasses: ["tox-dialog__popups"], inputAttributes: { "aria-errormessage": errorId, "type": "url" }, minChars: 0, responseTime: 0, fetch: function(input2) { var items = getItems(spec.filetype, input2, urlBackstage); var tdata = build(items, ItemResponse$1.BUBBLE_TO_SANDBOX, backstage, false); return Future.pure(tdata); }, getHotspot: function(comp) { return memUrlBox.getOpt(comp); }, onSetValue: function(comp, _newValue) { if (comp.hasConfigured(Invalidating)) { Invalidating.run(comp).get(noop2); } }, typeaheadBehaviours: derive$1(flatten2([ urlBackstage.getValidationHandler().map(function(handler7) { return Invalidating.config({ getRoot: function(comp) { return parent2(comp.element); }, invalidClass: "tox-control-wrap--status-invalid", notify: { onInvalid: function(comp, err) { memInvalidIcon.getOpt(comp).each(function(invalidComp) { set$8(invalidComp.element, "title", providersBackstage.translate(err)); }); } }, validator: { validate: function(input2) { var urlEntry = Representing.getValue(input2); return FutureResult.nu(function(completer) { handler7({ type: spec.filetype, url: urlEntry.value }, function(validation) { if (validation.status === "invalid") { var err = Result.error(validation.message); completer(err); } else { var val = Result.value(validation.message); completer(val); } }); }); }, validateOnLoad: false } }); }).toArray(), [ Disabling.config({ disabled: function() { return spec.disabled || providersBackstage.isDisabled(); } }), Tabstopping.config({}), config3("urlinput-events", flatten2([ spec.filetype === "file" ? [run$1(input(), function(comp) { emitWith(comp, formChangeEvent, { name: spec.name }); })] : [], [ run$1(change(), function(comp) { emitWith(comp, formChangeEvent, { name: spec.name }); updateHistory(comp); }), run$1(postPaste(), function(comp) { emitWith(comp, formChangeEvent, { name: spec.name }); updateHistory(comp); }) ] ])) ] ])), eventOrder: (_a4 = {}, _a4[input()] = [ "streaming", "urlinput-events", "invalidating" ], _a4), model: { getDisplayText: function(itemData) { return itemData.value; }, selectsOver: false, populateFromBrowse: false }, markers: { openClass: "tox-textfield--popup-open" }, lazySink: backstage.shared.getSink, parts: { menu: part(false, 1, "normal") }, onExecute: function(_menu, component, _entry) { emitWith(component, formSubmitEvent, {}); }, onItemExecute: function(typeahead, _sandbox, _item, _value) { updateHistory(typeahead); emitWith(typeahead, formChangeEvent, { name: spec.name }); } }); var pLabel = spec.label.map(function(label) { return renderLabel$2(label, providersBackstage); }); var makeIcon = function(name2, errId, icon, label) { if (icon === void 0) { icon = name2; } if (label === void 0) { label = name2; } return render$3(icon, { tag: "div", classes: [ "tox-icon", "tox-control-wrap__status-icon-" + name2 ], attributes: __assign({ "title": providersBackstage.translate(label), "aria-live": "polite" }, errId.fold(function() { return {}; }, function(id2) { return { id: id2 }; })) }, providersBackstage.icons); }; var memInvalidIcon = record(makeIcon("invalid", Optional.some(errorId), "warning")); var memStatus = record({ dom: { tag: "div", classes: ["tox-control-wrap__status-icon-wrap"] }, components: [memInvalidIcon.asSpec()] }); var optUrlPicker = urlBackstage.getUrlPicker(spec.filetype); var browseUrlEvent = generate$6("browser.url.event"); var memUrlBox = record({ dom: { tag: "div", classes: ["tox-control-wrap"] }, components: [ pField, memStatus.asSpec() ], behaviours: derive$1([Disabling.config({ disabled: function() { return spec.disabled || providersBackstage.isDisabled(); } })]) }); var memUrlPickerButton = record(renderButton({ name: spec.name, icon: Optional.some("browse"), text: spec.label.getOr(""), disabled: spec.disabled, primary: false, borderless: true }, function(component) { return emit2(component, browseUrlEvent); }, providersBackstage, [], ["tox-browse-url"])); var controlHWrapper = function() { return { dom: { tag: "div", classes: ["tox-form__controls-h-stack"] }, components: flatten2([ [memUrlBox.asSpec()], optUrlPicker.map(function() { return memUrlPickerButton.asSpec(); }).toArray() ]) }; }; var openUrlPicker = function(comp) { Composing.getCurrent(comp).each(function(field2) { var componentData = Representing.getValue(field2); var urlData = __assign({ fieldname: spec.name }, componentData); optUrlPicker.each(function(picker) { picker(urlData).get(function(chosenData) { Representing.setValue(field2, chosenData); emitWith(comp, formChangeEvent, { name: spec.name }); }); }); }); }; return FormField.sketch({ dom: renderFormFieldDom(), components: pLabel.toArray().concat([controlHWrapper()]), fieldBehaviours: derive$1([ Disabling.config({ disabled: function() { return spec.disabled || providersBackstage.isDisabled(); }, onDisabled: function(comp) { FormField.getField(comp).each(Disabling.disable); memUrlPickerButton.getOpt(comp).each(Disabling.disable); }, onEnabled: function(comp) { FormField.getField(comp).each(Disabling.enable); memUrlPickerButton.getOpt(comp).each(Disabling.enable); } }), receivingConfig(), config3("url-input-events", [run$1(browseUrlEvent, openUrlPicker)]) ]) }); }; var renderAlertBanner = function(spec, providersBackstage) { return Container.sketch({ dom: { tag: "div", attributes: { role: "alert" }, classes: [ "tox-notification", "tox-notification--in", "tox-notification--" + spec.level ] }, components: [ { dom: { tag: "div", classes: ["tox-notification__icon"] }, components: [Button2.sketch({ dom: { tag: "button", classes: [ "tox-button", "tox-button--naked", "tox-button--icon" ], innerHtml: get$12(spec.icon, providersBackstage.icons), attributes: { title: providersBackstage.translate(spec.iconTooltip) } }, action: function(comp) { emitWith(comp, formActionEvent, { name: "alert-banner", value: spec.url }); }, buttonBehaviours: derive$1([addFocusableBehaviour()]) })] }, { dom: { tag: "div", classes: ["tox-notification__body"], innerHtml: providersBackstage.translate(spec.text) } } ] }); }; var renderCheckbox2 = function(spec, providerBackstage) { var repBehaviour = Representing.config({ store: { mode: "manual", getValue: function(comp) { var el = comp.element.dom; return el.checked; }, setValue: function(comp, value25) { var el = comp.element.dom; el.checked = value25; } } }); var toggleCheckboxHandler = function(comp) { comp.element.dom.click(); return Optional.some(true); }; var pField = FormField.parts.field({ factory: { sketch: identity$1 }, dom: { tag: "input", classes: ["tox-checkbox__input"], attributes: { type: "checkbox" } }, behaviours: derive$1([ ComposingConfigs.self(), Disabling.config({ disabled: function() { return spec.disabled || providerBackstage.isDisabled(); } }), Tabstopping.config({}), Focusing.config({}), repBehaviour, Keying.config({ mode: "special", onEnter: toggleCheckboxHandler, onSpace: toggleCheckboxHandler, stopSpaceKeyup: true }), config3("checkbox-events", [run$1(change(), function(component, _2) { emitWith(component, formChangeEvent, { name: spec.name }); })]) ]) }); var pLabel = FormField.parts.label({ dom: { tag: "span", classes: ["tox-checkbox__label"], innerHtml: providerBackstage.translate(spec.label) }, behaviours: derive$1([Unselecting.config({})]) }); var makeIcon = function(className) { var iconName = className === "checked" ? "selected" : "unselected"; return render$3(iconName, { tag: "span", classes: [ "tox-icon", "tox-checkbox-icon__" + className ] }, providerBackstage.icons); }; var memIcons = record({ dom: { tag: "div", classes: ["tox-checkbox__icons"] }, components: [ makeIcon("checked"), makeIcon("unchecked") ] }); return FormField.sketch({ dom: { tag: "label", classes: ["tox-checkbox"] }, components: [ pField, memIcons.asSpec(), pLabel ], fieldBehaviours: derive$1([ Disabling.config({ disabled: function() { return spec.disabled || providerBackstage.isDisabled(); }, disableClass: "tox-checkbox--disabled", onDisabled: function(comp) { FormField.getField(comp).each(Disabling.disable); }, onEnabled: function(comp) { FormField.getField(comp).each(Disabling.enable); } }), receivingConfig() ]) }); }; var renderHtmlPanel = function(spec) { if (spec.presets === "presentation") { return Container.sketch({ dom: { tag: "div", classes: ["tox-form__group"], innerHtml: spec.html } }); } else { return Container.sketch({ dom: { tag: "div", classes: ["tox-form__group"], innerHtml: spec.html, attributes: { role: "document" } }, containerBehaviours: derive$1([ Tabstopping.config({}), Focusing.config({}) ]) }); } }; var make$2 = function(render124) { return function(parts2, spec, backstage) { return get$e(spec, "name").fold(function() { return render124(spec, backstage); }, function(fieldName) { return parts2.field(fieldName, render124(spec, backstage)); }); }; }; var makeIframe = function(render124) { return function(parts2, spec, backstage) { var iframeSpec = deepMerge2(spec, { source: "dynamic" }); return make$2(render124)(parts2, iframeSpec, backstage); }; }; var factories = { bar: make$2(function(spec, backstage) { return renderBar(spec, backstage.shared); }), collection: make$2(function(spec, backstage) { return renderCollection(spec, backstage.shared.providers); }), alertbanner: make$2(function(spec, backstage) { return renderAlertBanner(spec, backstage.shared.providers); }), input: make$2(function(spec, backstage) { return renderInput2(spec, backstage.shared.providers); }), textarea: make$2(function(spec, backstage) { return renderTextarea(spec, backstage.shared.providers); }), label: make$2(function(spec, backstage) { return renderLabel(spec, backstage.shared); }), iframe: makeIframe(function(spec, backstage) { return renderIFrame(spec, backstage.shared.providers); }), button: make$2(function(spec, backstage) { return renderDialogButton(spec, backstage.shared.providers); }), checkbox: make$2(function(spec, backstage) { return renderCheckbox2(spec, backstage.shared.providers); }), colorinput: make$2(function(spec, backstage) { return renderColorInput(spec, backstage.shared, backstage.colorinput); }), colorpicker: make$2(renderColorPicker), dropzone: make$2(function(spec, backstage) { return renderDropZone(spec, backstage.shared.providers); }), grid: make$2(function(spec, backstage) { return renderGrid(spec, backstage.shared); }), listbox: make$2(function(spec, backstage) { return renderListBox(spec, backstage); }), selectbox: make$2(function(spec, backstage) { return renderSelectBox(spec, backstage.shared.providers); }), sizeinput: make$2(function(spec, backstage) { return renderSizeInput(spec, backstage.shared.providers); }), urlinput: make$2(function(spec, backstage) { return renderUrlInput(spec, backstage, backstage.urlinput); }), customeditor: make$2(renderCustomEditor), htmlpanel: make$2(renderHtmlPanel), imagetools: make$2(function(spec, backstage) { return renderImageTools(spec, backstage.shared.providers); }), table: make$2(function(spec, backstage) { return renderTable3(spec, backstage.shared.providers); }), panel: make$2(function(spec, backstage) { return renderPanel(spec, backstage); }) }; var noFormParts = { field: function(_name, spec) { return spec; } }; var interpretInForm = function(parts2, spec, oldBackstage) { var newBackstage = deepMerge2(oldBackstage, { shared: { interpreter: function(childSpec) { return interpretParts(parts2, childSpec, newBackstage); } } }); return interpretParts(parts2, spec, newBackstage); }; var interpretParts = function(parts2, spec, backstage) { return get$e(factories, spec.type).fold(function() { console.error('Unknown factory type "' + spec.type + '", defaulting to container: ', spec); return spec; }, function(factory2) { return factory2(parts2, spec, backstage); }); }; var interpretWithoutForm = function(spec, backstage) { var parts2 = noFormParts; return interpretParts(parts2, spec, backstage); }; var bubbleAlignments$2 = { valignCentre: [], alignCentre: [], alignLeft: [], alignRight: [], right: [], left: [], bottom: [], top: [] }; var getInlineDialogAnchor = function(contentAreaElement, lazyAnchorbar, lazyUseEditableAreaAnchor) { var bubbleSize2 = 12; var overrides = { maxHeightFunction: expandable$1() }; var editableAreaAnchor = function() { return { type: "node", root: getContentContainer(contentAreaElement()), node: Optional.from(contentAreaElement()), bubble: nu$5(bubbleSize2, bubbleSize2, bubbleAlignments$2), layouts: { onRtl: function() { return [northeast]; }, onLtr: function() { return [northwest]; } }, overrides }; }; var standardAnchor = function() { return { type: "hotspot", hotspot: lazyAnchorbar(), bubble: nu$5(-bubbleSize2, bubbleSize2, bubbleAlignments$2), layouts: { onRtl: function() { return [southeast$2]; }, onLtr: function() { return [southwest$2]; } }, overrides }; }; return function() { return lazyUseEditableAreaAnchor() ? editableAreaAnchor() : standardAnchor(); }; }; var getBannerAnchor = function(contentAreaElement, lazyAnchorbar, lazyUseEditableAreaAnchor) { var editableAreaAnchor = function() { return { type: "node", root: getContentContainer(contentAreaElement()), node: Optional.from(contentAreaElement()), layouts: { onRtl: function() { return [north]; }, onLtr: function() { return [north]; } } }; }; var standardAnchor = function() { return { type: "hotspot", hotspot: lazyAnchorbar(), layouts: { onRtl: function() { return [south$2]; }, onLtr: function() { return [south$2]; } } }; }; return function() { return lazyUseEditableAreaAnchor() ? editableAreaAnchor() : standardAnchor(); }; }; var getCursorAnchor = function(editor, bodyElement) { return function() { return { type: "selection", root: bodyElement(), getSelection: function() { var rng = editor.selection.getRng(); return Optional.some(SimSelection.range(SugarElement.fromDom(rng.startContainer), rng.startOffset, SugarElement.fromDom(rng.endContainer), rng.endOffset)); } }; }; }; var getNodeAnchor$1 = function(bodyElement) { return function(element2) { return { type: "node", root: bodyElement(), node: element2 }; }; }; var getAnchors = function(editor, lazyAnchorbar, isToolbarTop) { var useFixedToolbarContainer = useFixedContainer(editor); var bodyElement = function() { return SugarElement.fromDom(editor.getBody()); }; var contentAreaElement = function() { return SugarElement.fromDom(editor.getContentAreaContainer()); }; var lazyUseEditableAreaAnchor = function() { return useFixedToolbarContainer || !isToolbarTop(); }; return { inlineDialog: getInlineDialogAnchor(contentAreaElement, lazyAnchorbar, lazyUseEditableAreaAnchor), banner: getBannerAnchor(contentAreaElement, lazyAnchorbar, lazyUseEditableAreaAnchor), cursor: getCursorAnchor(editor, bodyElement), node: getNodeAnchor$1(bodyElement) }; }; var colorPicker = function(editor) { return function(callback2, value25) { var dialog = colorPickerDialog(editor); dialog(callback2, value25); }; }; var hasCustomColors = function(editor) { return function() { return hasCustomColors$1(editor); }; }; var getColors = function(editor) { return function() { return getColors$2(editor); }; }; var getColorCols = function(editor) { return function() { return getColorCols$1(editor); }; }; var ColorInputBackstage = function(editor) { return { colorPicker: colorPicker(editor), hasCustomColors: hasCustomColors(editor), getColors: getColors(editor), getColorCols: getColorCols(editor) }; }; var isDraggableModal = function(editor) { return function() { return isDraggableModal$1(editor); }; }; var DialogBackstage = function(editor) { return { isDraggableModal: isDraggableModal(editor) }; }; var HeaderBackstage = function(editor) { var mode3 = Cell3(isToolbarLocationBottom(editor) ? "bottom" : "top"); return { isPositionedAtTop: function() { return mode3.get() === "top"; }, getDockingMode: mode3.get, setDockingMode: mode3.set }; }; var defaultStyleFormats = [ { title: "Headings", items: [ { title: "Heading 1", format: "h1" }, { title: "Heading 2", format: "h2" }, { title: "Heading 3", format: "h3" }, { title: "Heading 4", format: "h4" }, { title: "Heading 5", format: "h5" }, { title: "Heading 6", format: "h6" } ] }, { title: "Inline", items: [ { title: "Bold", format: "bold" }, { title: "Italic", format: "italic" }, { title: "Underline", format: "underline" }, { title: "Strikethrough", format: "strikethrough" }, { title: "Superscript", format: "superscript" }, { title: "Subscript", format: "subscript" }, { title: "Code", format: "code" } ] }, { title: "Blocks", items: [ { title: "Paragraph", format: "p" }, { title: "Blockquote", format: "blockquote" }, { title: "Div", format: "div" }, { title: "Pre", format: "pre" } ] }, { title: "Align", items: [ { title: "Left", format: "alignleft" }, { title: "Center", format: "aligncenter" }, { title: "Right", format: "alignright" }, { title: "Justify", format: "alignjustify" } ] } ]; var isNestedFormat = function(format3) { return has$22(format3, "items"); }; var isBlockFormat = function(format3) { return has$22(format3, "block"); }; var isInlineFormat = function(format3) { return has$22(format3, "inline"); }; var isSelectorFormat = function(format3) { return has$22(format3, "selector"); }; var mapFormats = function(userFormats) { return foldl(userFormats, function(acc, fmt) { if (isNestedFormat(fmt)) { var result = mapFormats(fmt.items); return { customFormats: acc.customFormats.concat(result.customFormats), formats: acc.formats.concat([{ title: fmt.title, items: result.formats }]) }; } else if (isInlineFormat(fmt) || isBlockFormat(fmt) || isSelectorFormat(fmt)) { var formatName = isString3(fmt.name) ? fmt.name : fmt.title.toLowerCase(); var formatNameWithPrefix = "custom-" + formatName; return { customFormats: acc.customFormats.concat([{ name: formatNameWithPrefix, format: fmt }]), formats: acc.formats.concat([{ title: fmt.title, format: formatNameWithPrefix, icon: fmt.icon }]) }; } else { return __assign(__assign({}, acc), { formats: acc.formats.concat(fmt) }); } }, { customFormats: [], formats: [] }); }; var registerCustomFormats = function(editor, userFormats) { var result = mapFormats(userFormats); var registerFormats = function(customFormats) { each$12(customFormats, function(fmt) { if (!editor.formatter.has(fmt.name)) { editor.formatter.register(fmt.name, fmt.format); } }); }; if (editor.formatter) { registerFormats(result.customFormats); } else { editor.on("init", function() { registerFormats(result.customFormats); }); } return result.formats; }; var getStyleFormats = function(editor) { return getUserStyleFormats(editor).map(function(userFormats) { var registeredUserFormats = registerCustomFormats(editor, userFormats); return isMergeStyleFormats(editor) ? defaultStyleFormats.concat(registeredUserFormats) : registeredUserFormats; }).getOr(defaultStyleFormats); }; var processBasic = function(item2, isSelectedFor, getPreviewFor) { var formatterSpec = { type: "formatter", isSelected: isSelectedFor(item2.format), getStylePreview: getPreviewFor(item2.format) }; return deepMerge2(item2, formatterSpec); }; var register$8 = function(editor, formats2, isSelectedFor, getPreviewFor) { var enrichSupported = function(item2) { return processBasic(item2, isSelectedFor, getPreviewFor); }; var enrichMenu = function(item2) { var submenuSpec = { type: "submenu" }; return deepMerge2(item2, submenuSpec); }; var enrichCustom = function(item2) { var formatName = isString3(item2.name) ? item2.name : generate$6(item2.title); var formatNameWithPrefix = "custom-" + formatName; var customSpec = { type: "formatter", format: formatNameWithPrefix, isSelected: isSelectedFor(formatNameWithPrefix), getStylePreview: getPreviewFor(formatNameWithPrefix) }; var newItem = deepMerge2(item2, customSpec); editor.formatter.register(formatName, newItem); return newItem; }; var doEnrich = function(items) { return map$2(items, function(item2) { var keys$12 = keys2(item2); if (hasNonNullableKey(item2, "items")) { var newItems = doEnrich(item2.items); return deepMerge2(enrichMenu(item2), { getStyleItems: constant$1(newItems) }); } else if (hasNonNullableKey(item2, "format")) { return enrichSupported(item2); } else if (keys$12.length === 1 && contains$2(keys$12, "title")) { return deepMerge2(item2, { type: "separator" }); } else { return enrichCustom(item2); } }); }; return doEnrich(formats2); }; var init$8 = function(editor) { var isSelectedFor = function(format3) { return function() { return editor.formatter.match(format3); }; }; var getPreviewFor = function(format3) { return function() { var fmt = editor.formatter.get(format3); return fmt !== void 0 ? Optional.some({ tag: fmt.length > 0 ? fmt[0].inline || fmt[0].block || "div" : "div", styles: editor.dom.parseStyle(editor.formatter.getCssText(format3)) }) : Optional.none(); }; }; var flatten3 = function(fmt) { var subs2 = fmt.items; return subs2 !== void 0 && subs2.length > 0 ? bind$32(subs2, flatten3) : [fmt.format]; }; var settingsFormats = Cell3([]); var settingsFlattenedFormats = Cell3([]); var eventsFormats = Cell3([]); var eventsFlattenedFormats = Cell3([]); var replaceSettings = Cell3(false); editor.on("PreInit", function(_e) { var formats2 = getStyleFormats(editor); var enriched = register$8(editor, formats2, isSelectedFor, getPreviewFor); settingsFormats.set(enriched); settingsFlattenedFormats.set(bind$32(enriched, flatten3)); }); editor.on("addStyleModifications", function(e2) { var modifications = register$8(editor, e2.items, isSelectedFor, getPreviewFor); eventsFormats.set(modifications); replaceSettings.set(e2.replace); eventsFlattenedFormats.set(bind$32(modifications, flatten3)); }); var getData2 = function() { var fromSettings = replaceSettings.get() ? [] : settingsFormats.get(); var fromEvents = eventsFormats.get(); return fromSettings.concat(fromEvents); }; var getFlattenedKeys = function() { var fromSettings = replaceSettings.get() ? [] : settingsFlattenedFormats.get(); var fromEvents = eventsFlattenedFormats.get(); return fromSettings.concat(fromEvents); }; return { getData: getData2, getFlattenedKeys }; }; var isElement2 = function(node) { return isNonNullable(node) && node.nodeType === 1; }; var trim2 = global$5.trim; var hasContentEditableState = function(value25) { return function(node) { if (isElement2(node)) { if (node.contentEditable === value25) { return true; } if (node.getAttribute("data-mce-contenteditable") === value25) { return true; } } return false; }; }; var isContentEditableTrue = hasContentEditableState("true"); var isContentEditableFalse = hasContentEditableState("false"); var create$1 = function(type3, title, url2, level2, attach2) { return { type: type3, title, url: url2, level: level2, attach: attach2 }; }; var isChildOfContentEditableTrue = function(node) { while (node = node.parentNode) { var value25 = node.contentEditable; if (value25 && value25 !== "inherit") { return isContentEditableTrue(node); } } return false; }; var select2 = function(selector2, root2) { return map$2(descendants(SugarElement.fromDom(root2), selector2), function(element2) { return element2.dom; }); }; var getElementText = function(elm) { return elm.innerText || elm.textContent; }; var getOrGenerateId = function(elm) { return elm.id ? elm.id : generate$6("h"); }; var isAnchor = function(elm) { return elm && elm.nodeName === "A" && (elm.id || elm.name) !== void 0; }; var isValidAnchor = function(elm) { return isAnchor(elm) && isEditable(elm); }; var isHeader = function(elm) { return elm && /^(H[1-6])$/.test(elm.nodeName); }; var isEditable = function(elm) { return isChildOfContentEditableTrue(elm) && !isContentEditableFalse(elm); }; var isValidHeader = function(elm) { return isHeader(elm) && isEditable(elm); }; var getLevel = function(elm) { return isHeader(elm) ? parseInt(elm.nodeName.substr(1), 10) : 0; }; var headerTarget = function(elm) { var headerId = getOrGenerateId(elm); var attach2 = function() { elm.id = headerId; }; return create$1("header", getElementText(elm), "#" + headerId, getLevel(elm), attach2); }; var anchorTarget = function(elm) { var anchorId = elm.id || elm.name; var anchorText = getElementText(elm); return create$1("anchor", anchorText ? anchorText : "#" + anchorId, "#" + anchorId, 0, noop2); }; var getHeaderTargets = function(elms) { return map$2(filter$2(elms, isValidHeader), headerTarget); }; var getAnchorTargets = function(elms) { return map$2(filter$2(elms, isValidAnchor), anchorTarget); }; var getTargetElements = function(elm) { var elms = select2("h1,h2,h3,h4,h5,h6,a:not([href])", elm); return elms; }; var hasTitle = function(target) { return trim2(target.title).length > 0; }; var find2 = function(elm) { var elms = getTargetElements(elm); return filter$2(getHeaderTargets(elms).concat(getAnchorTargets(elms)), hasTitle); }; var LinkTargets = { find: find2 }; var STORAGE_KEY = "tinymce-url-history"; var HISTORY_LENGTH = 5; var isHttpUrl = function(url2) { return isString3(url2) && /^https?/.test(url2); }; var isArrayOfUrl = function(a2) { return isArray2(a2) && a2.length <= HISTORY_LENGTH && forall(a2, isHttpUrl); }; var isRecordOfUrlArray = function(r3) { return isObject3(r3) && find$4(r3, function(value25) { return !isArrayOfUrl(value25); }).isNone(); }; var getAllHistory = function() { var unparsedHistory = global$8.getItem(STORAGE_KEY); if (unparsedHistory === null) { return {}; } var history; try { history = JSON.parse(unparsedHistory); } catch (e2) { if (e2 instanceof SyntaxError) { console.log("Local storage " + STORAGE_KEY + " was not valid JSON", e2); return {}; } throw e2; } if (!isRecordOfUrlArray(history)) { console.log("Local storage " + STORAGE_KEY + " was not valid format", history); return {}; } return history; }; var setAllHistory = function(history) { if (!isRecordOfUrlArray(history)) { throw new Error("Bad format for history:\n" + JSON.stringify(history)); } global$8.setItem(STORAGE_KEY, JSON.stringify(history)); }; var getHistory = function(fileType) { var history = getAllHistory(); return get$e(history, fileType).getOr([]); }; var addToHistory = function(url2, fileType) { if (!isHttpUrl(url2)) { return; } var history = getAllHistory(); var items = get$e(history, fileType).getOr([]); var itemsWithoutUrl = filter$2(items, function(item2) { return item2 !== url2; }); history[fileType] = [url2].concat(itemsWithoutUrl).slice(0, HISTORY_LENGTH); setAllHistory(history); }; var isTruthy = function(value25) { return !!value25; }; var makeMap = function(value25) { return map$1(global$5.makeMap(value25, /[, ]/), isTruthy); }; var getPicker = function(editor) { return Optional.from(getFilePickerCallback(editor)).filter(isFunction3); }; var getPickerTypes = function(editor) { var optFileTypes = Optional.some(getFilePickerTypes(editor)).filter(isTruthy); var optLegacyTypes = Optional.some(getFileBrowserCallbackTypes(editor)).filter(isTruthy); var optTypes = optFileTypes.or(optLegacyTypes).map(makeMap); return getPicker(editor).fold(never, function(_picker) { return optTypes.fold(always, function(types3) { return keys2(types3).length > 0 ? types3 : false; }); }); }; var getPickerSetting = function(editor, filetype) { var pickerTypes = getPickerTypes(editor); if (isBoolean2(pickerTypes)) { return pickerTypes ? getPicker(editor) : Optional.none(); } else { return pickerTypes[filetype] ? getPicker(editor) : Optional.none(); } }; var getUrlPicker = function(editor, filetype) { return getPickerSetting(editor, filetype).map(function(picker) { return function(entry) { return Future.nu(function(completer) { var handler7 = function(value25, meta2) { if (!isString3(value25)) { throw new Error("Expected value to be string"); } if (meta2 !== void 0 && !isObject3(meta2)) { throw new Error("Expected meta to be a object"); } var r3 = { value: value25, meta: meta2 }; completer(r3); }; var meta = __assign({ filetype, fieldname: entry.fieldname }, Optional.from(entry.meta).getOr({})); picker.call(editor, handler7, entry.value, meta); }); }; }); }; var getTextSetting = function(value25) { return Optional.from(value25).filter(isString3).getOrUndefined(); }; var getLinkInformation = function(editor) { if (noTypeaheadUrls(editor)) { return Optional.none(); } return Optional.some({ targets: LinkTargets.find(editor.getBody()), anchorTop: getTextSetting(getAnchorTop(editor)), anchorBottom: getTextSetting(getAnchorBottom(editor)) }); }; var getValidationHandler = function(editor) { return Optional.from(getFilePickerValidatorHandler(editor)); }; var UrlInputBackstage = function(editor) { return { getHistory, addToHistory, getLinkInformation: function() { return getLinkInformation(editor); }, getValidationHandler: function() { return getValidationHandler(editor); }, getUrlPicker: function(filetype) { return getUrlPicker(editor, filetype); } }; }; var init$7 = function(sink, editor, lazyAnchorbar) { var contextMenuState = Cell3(false); var toolbar2 = HeaderBackstage(editor); var backstage = { shared: { providers: { icons: function() { return editor.ui.registry.getAll().icons; }, menuItems: function() { return editor.ui.registry.getAll().menuItems; }, translate: global$e.translate, isDisabled: function() { return editor.mode.isReadOnly() || editor.ui.isDisabled(); }, getSetting: editor.getParam.bind(editor) }, interpreter: function(s2) { return interpretWithoutForm(s2, backstage); }, anchors: getAnchors(editor, lazyAnchorbar, toolbar2.isPositionedAtTop), header: toolbar2, getSink: function() { return Result.value(sink); } }, urlinput: UrlInputBackstage(editor), styleselect: init$8(editor), colorinput: ColorInputBackstage(editor), dialog: DialogBackstage(editor), isContextMenuOpen: function() { return contextMenuState.get(); }, setContextMenuState: function(state) { return contextMenuState.set(state); } }; return backstage; }; var setup$b = function(editor, mothership, uiMothership) { var broadcastEvent = function(name2, evt) { each$12([ mothership, uiMothership ], function(ship) { ship.broadcastEvent(name2, evt); }); }; var broadcastOn = function(channel, message2) { each$12([ mothership, uiMothership ], function(ship) { ship.broadcastOn([channel], message2); }); }; var fireDismissPopups = function(evt) { return broadcastOn(dismissPopups(), { target: evt.target }); }; var doc = getDocument2(); var onTouchstart2 = bind4(doc, "touchstart", fireDismissPopups); var onTouchmove = bind4(doc, "touchmove", function(evt) { return broadcastEvent(documentTouchmove(), evt); }); var onTouchend = bind4(doc, "touchend", function(evt) { return broadcastEvent(documentTouchend(), evt); }); var onMousedown2 = bind4(doc, "mousedown", fireDismissPopups); var onMouseup = bind4(doc, "mouseup", function(evt) { if (evt.raw.button === 0) { broadcastOn(mouseReleased(), { target: evt.target }); } }); var onContentClick = function(raw) { return broadcastOn(dismissPopups(), { target: SugarElement.fromDom(raw.target) }); }; var onContentMouseup = function(raw) { if (raw.button === 0) { broadcastOn(mouseReleased(), { target: SugarElement.fromDom(raw.target) }); } }; var onContentMousedown = function() { each$12(editor.editorManager.get(), function(loopEditor) { if (editor !== loopEditor) { loopEditor.fire("DismissPopups", { relatedTarget: editor }); } }); }; var onWindowScroll = function(evt) { return broadcastEvent(windowScroll(), fromRawEvent(evt)); }; var onWindowResize = function(evt) { broadcastOn(repositionPopups(), {}); broadcastEvent(windowResize(), fromRawEvent(evt)); }; var onEditorResize = function() { return broadcastOn(repositionPopups(), {}); }; var onEditorProgress = function(evt) { if (evt.state) { broadcastOn(dismissPopups(), { target: SugarElement.fromDom(editor.getContainer()) }); } }; var onDismissPopups = function(event) { broadcastOn(dismissPopups(), { target: SugarElement.fromDom(event.relatedTarget.getContainer()) }); }; editor.on("PostRender", function() { editor.on("click", onContentClick); editor.on("tap", onContentClick); editor.on("mouseup", onContentMouseup); editor.on("mousedown", onContentMousedown); editor.on("ScrollWindow", onWindowScroll); editor.on("ResizeWindow", onWindowResize); editor.on("ResizeEditor", onEditorResize); editor.on("AfterProgressState", onEditorProgress); editor.on("DismissPopups", onDismissPopups); }); editor.on("remove", function() { editor.off("click", onContentClick); editor.off("tap", onContentClick); editor.off("mouseup", onContentMouseup); editor.off("mousedown", onContentMousedown); editor.off("ScrollWindow", onWindowScroll); editor.off("ResizeWindow", onWindowResize); editor.off("ResizeEditor", onEditorResize); editor.off("AfterProgressState", onEditorProgress); editor.off("DismissPopups", onDismissPopups); onMousedown2.unbind(); onTouchstart2.unbind(); onTouchmove.unbind(); onTouchend.unbind(); onMouseup.unbind(); }); editor.on("detach", function() { detachSystem(mothership); detachSystem(uiMothership); mothership.destroy(); uiMothership.destroy(); }); }; var parts$a = AlloyParts; var partType = PartType; var schema$f = constant$1([ defaulted("shell", false), required$12("makeItem"), defaulted("setupItem", noop2), SketchBehaviours.field("listBehaviours", [Replacing]) ]); var customListDetail = function() { return { behaviours: derive$1([Replacing.config({})]) }; }; var itemsPart = optional({ name: "items", overrides: customListDetail }); var parts$9 = constant$1([itemsPart]); var name = constant$1("CustomList"); var factory$d = function(detail, components4, _spec, _external) { var setItems = function(list, items) { getListContainer(list).fold(function() { console.error("Custom List was defined to not be a shell, but no item container was specified in components"); throw new Error("Custom List was defined to not be a shell, but no item container was specified in components"); }, function(container) { var itemComps = Replacing.contents(container); var numListsRequired = items.length; var numListsToAdd = numListsRequired - itemComps.length; var itemsToAdd = numListsToAdd > 0 ? range$2(numListsToAdd, function() { return detail.makeItem(); }) : []; var itemsToRemove = itemComps.slice(numListsRequired); each$12(itemsToRemove, function(item2) { return Replacing.remove(container, item2); }); each$12(itemsToAdd, function(item2) { return Replacing.append(container, item2); }); var builtLists = Replacing.contents(container); each$12(builtLists, function(item2, i2) { detail.setupItem(list, item2, items[i2], i2); }); }); }; var extra = detail.shell ? { behaviours: [Replacing.config({})], components: [] } : { behaviours: [], components: components4 }; var getListContainer = function(component) { return detail.shell ? Optional.some(component) : getPart(component, detail, "items"); }; return { uid: detail.uid, dom: detail.dom, components: extra.components, behaviours: augment(detail.listBehaviours, extra.behaviours), apis: { setItems } }; }; var CustomList = composite({ name: name(), configFields: schema$f(), partFields: parts$9(), factory: factory$d, apis: { setItems: function(apis, list, items) { apis.setItems(list, items); } } }); var schema$e = constant$1([ required$12("dom"), defaulted("shell", true), field("toolbarBehaviours", [Replacing]) ]); var enhanceGroups = function() { return { behaviours: derive$1([Replacing.config({})]) }; }; var parts$8 = constant$1([optional({ name: "groups", overrides: enhanceGroups })]); var factory$c = function(detail, components4, _spec, _externals) { var setGroups2 = function(toolbar2, groups) { getGroupContainer(toolbar2).fold(function() { console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"); throw new Error("Toolbar was defined to not be a shell, but no groups container was specified in components"); }, function(container) { Replacing.set(container, groups); }); }; var getGroupContainer = function(component) { return detail.shell ? Optional.some(component) : getPart(component, detail, "groups"); }; var extra = detail.shell ? { behaviours: [Replacing.config({})], components: [] } : { behaviours: [], components: components4 }; return { uid: detail.uid, dom: detail.dom, components: extra.components, behaviours: augment(detail.toolbarBehaviours, extra.behaviours), apis: { setGroups: setGroups2 }, domModification: { attributes: { role: "group" } } }; }; var Toolbar = composite({ name: "Toolbar", configFields: schema$e(), partFields: parts$8(), factory: factory$c, apis: { setGroups: function(apis, toolbar2, groups) { apis.setGroups(toolbar2, groups); } } }); var setup$a = noop2; var isDocked$2 = never; var getBehaviours$1 = constant$1([]); var StaticHeader = /* @__PURE__ */ Object.freeze({ __proto__: null, setup: setup$a, isDocked: isDocked$2, getBehaviours: getBehaviours$1 }); var getOffsetParent2 = function(element2) { var isFixed = is$1(getRaw(element2, "position"), "fixed"); var offsetParent$1 = isFixed ? Optional.none() : offsetParent(element2); return offsetParent$1.orThunk(function() { var marker = SugarElement.fromTag("span"); return parent2(element2).bind(function(parent3) { append$2(parent3, marker); var offsetParent$12 = offsetParent(marker); remove$5(marker); return offsetParent$12; }); }); }; var getOrigin = function(element2) { return getOffsetParent2(element2).map(absolute$3).getOrThunk(function() { return SugarPosition(0, 0); }); }; var morphAdt = Adt.generate([ { static: [] }, { absolute: ["positionCss"] }, { fixed: ["positionCss"] } ]); var appear = function(component, contextualInfo) { var elem = component.element; add$2(elem, contextualInfo.transitionClass); remove$2(elem, contextualInfo.fadeOutClass); add$2(elem, contextualInfo.fadeInClass); contextualInfo.onShow(component); }; var disappear = function(component, contextualInfo) { var elem = component.element; add$2(elem, contextualInfo.transitionClass); remove$2(elem, contextualInfo.fadeInClass); add$2(elem, contextualInfo.fadeOutClass); contextualInfo.onHide(component); }; var isPartiallyVisible = function(box2, viewport2) { return box2.y < viewport2.bottom && box2.bottom > viewport2.y; }; var isTopCompletelyVisible = function(box2, viewport2) { return box2.y >= viewport2.y; }; var isBottomCompletelyVisible = function(box2, viewport2) { return box2.bottom <= viewport2.bottom; }; var isVisibleForModes = function(modes, box2, viewport2) { return forall(modes, function(mode3) { switch (mode3) { case "bottom": return isBottomCompletelyVisible(box2, viewport2); case "top": return isTopCompletelyVisible(box2, viewport2); } }); }; var getPrior = function(elem, state) { return state.getInitialPos().map(function(pos) { return bounds(pos.bounds.x, pos.bounds.y, get$a(elem), get$b(elem)); }); }; var storePrior = function(elem, box2, state) { state.setInitialPos({ style: getAllRaw(elem), position: get$c(elem, "position") || "static", bounds: box2 }); }; var revertToOriginal = function(elem, box2, state) { return state.getInitialPos().bind(function(position3) { state.clearInitialPos(); switch (position3.position) { case "static": return Optional.some(morphAdt.static()); case "absolute": var offsetBox_1 = getOffsetParent2(elem).map(box$1).getOrThunk(function() { return box$1(body()); }); return Optional.some(morphAdt.absolute(NuPositionCss("absolute", get$e(position3.style, "left").map(function(_left) { return box2.x - offsetBox_1.x; }), get$e(position3.style, "top").map(function(_top) { return box2.y - offsetBox_1.y; }), get$e(position3.style, "right").map(function(_right) { return offsetBox_1.right - box2.right; }), get$e(position3.style, "bottom").map(function(_bottom) { return offsetBox_1.bottom - box2.bottom; })))); default: return Optional.none(); } }); }; var morphToOriginal = function(elem, viewport2, state) { return getPrior(elem, state).filter(function(box2) { return isVisibleForModes(state.getModes(), box2, viewport2); }).bind(function(box2) { return revertToOriginal(elem, box2, state); }); }; var morphToFixed = function(elem, viewport2, state) { var box2 = box$1(elem); if (!isVisibleForModes(state.getModes(), box2, viewport2)) { storePrior(elem, box2, state); var winBox = win(); var left2 = box2.x - winBox.x; var top_1 = viewport2.y - winBox.y; var bottom2 = winBox.bottom - viewport2.bottom; var isTop = box2.y <= viewport2.y; return Optional.some(morphAdt.fixed(NuPositionCss("fixed", Optional.some(left2), isTop ? Optional.some(top_1) : Optional.none(), Optional.none(), !isTop ? Optional.some(bottom2) : Optional.none()))); } else { return Optional.none(); } }; var getMorph = function(component, viewport2, state) { var elem = component.element; var isDocked2 = is$1(getRaw(elem, "position"), "fixed"); return isDocked2 ? morphToOriginal(elem, viewport2, state) : morphToFixed(elem, viewport2, state); }; var getMorphToOriginal = function(component, state) { var elem = component.element; return getPrior(elem, state).bind(function(box2) { return revertToOriginal(elem, box2, state); }); }; var morphToStatic = function(component, config4, state) { state.setDocked(false); each$12([ "left", "right", "top", "bottom", "position" ], function(prop) { return remove$6(component.element, prop); }); config4.onUndocked(component); }; var morphToCoord = function(component, config4, state, position3) { var isDocked2 = position3.position === "fixed"; state.setDocked(isDocked2); applyPositionCss(component.element, position3); var method3 = isDocked2 ? config4.onDocked : config4.onUndocked; method3(component); }; var updateVisibility = function(component, config4, state, viewport2, morphToDocked) { if (morphToDocked === void 0) { morphToDocked = false; } config4.contextual.each(function(contextInfo) { contextInfo.lazyContext(component).each(function(box2) { var isVisible3 = isPartiallyVisible(box2, viewport2); if (isVisible3 !== state.isVisible()) { state.setVisible(isVisible3); if (morphToDocked && !isVisible3) { add$12(component.element, [contextInfo.fadeOutClass]); contextInfo.onHide(component); } else { var method3 = isVisible3 ? appear : disappear; method3(component, contextInfo); } } }); }); }; var refreshInternal = function(component, config4, state) { var viewport2 = config4.lazyViewport(component); var isDocked2 = state.isDocked(); if (isDocked2) { updateVisibility(component, config4, state, viewport2); } getMorph(component, viewport2, state).each(function(morph) { morph.fold(function() { return morphToStatic(component, config4, state); }, function(position3) { return morphToCoord(component, config4, state, position3); }, function(position3) { updateVisibility(component, config4, state, viewport2, true); morphToCoord(component, config4, state, position3); }); }); }; var resetInternal = function(component, config4, state) { var elem = component.element; state.setDocked(false); getMorphToOriginal(component, state).each(function(morph) { morph.fold(function() { return morphToStatic(component, config4, state); }, function(position3) { return morphToCoord(component, config4, state, position3); }, noop2); }); state.setVisible(true); config4.contextual.each(function(contextInfo) { remove$1(elem, [ contextInfo.fadeInClass, contextInfo.fadeOutClass, contextInfo.transitionClass ]); contextInfo.onShow(component); }); refresh$4(component, config4, state); }; var refresh$4 = function(component, config4, state) { if (component.getSystem().isConnected()) { refreshInternal(component, config4, state); } }; var reset2 = function(component, config4, state) { if (state.isDocked()) { resetInternal(component, config4, state); } }; var isDocked$1 = function(component, config4, state) { return state.isDocked(); }; var setModes = function(component, config4, state, modes) { return state.setModes(modes); }; var getModes = function(component, config4, state) { return state.getModes(); }; var DockingApis = /* @__PURE__ */ Object.freeze({ __proto__: null, refresh: refresh$4, reset: reset2, isDocked: isDocked$1, getModes, setModes }); var events$5 = function(dockInfo, dockState) { return derive$2([ runOnSource(transitionend(), function(component, simulatedEvent) { dockInfo.contextual.each(function(contextInfo) { if (has2(component.element, contextInfo.transitionClass)) { remove$1(component.element, [ contextInfo.transitionClass, contextInfo.fadeInClass ]); var notify = dockState.isVisible() ? contextInfo.onShown : contextInfo.onHidden; notify(component); } simulatedEvent.stop(); }); }), run$1(windowScroll(), function(component, _2) { refresh$4(component, dockInfo, dockState); }), run$1(windowResize(), function(component, _2) { reset2(component, dockInfo, dockState); }) ]); }; var ActiveDocking = /* @__PURE__ */ Object.freeze({ __proto__: null, events: events$5 }); var DockingSchema = [ optionObjOf("contextual", [ requiredString("fadeInClass"), requiredString("fadeOutClass"), requiredString("transitionClass"), requiredFunction("lazyContext"), onHandler("onShow"), onHandler("onShown"), onHandler("onHide"), onHandler("onHidden") ]), defaultedFunction("lazyViewport", win), defaultedArrayOf("modes", [ "top", "bottom" ], string2), onHandler("onDocked"), onHandler("onUndocked") ]; var init$6 = function(spec) { var docked = Cell3(false); var visible9 = Cell3(true); var initialBounds = value$1(); var modes = Cell3(spec.modes); var readState = function() { return "docked: " + docked.get() + ", visible: " + visible9.get() + ", modes: " + modes.get().join(","); }; return nu$8({ isDocked: docked.get, setDocked: docked.set, getInitialPos: initialBounds.get, setInitialPos: initialBounds.set, clearInitialPos: initialBounds.clear, isVisible: visible9.get, setVisible: visible9.set, getModes: modes.get, setModes: modes.set, readState }); }; var DockingState = /* @__PURE__ */ Object.freeze({ __proto__: null, init: init$6 }); var Docking = create$8({ fields: DockingSchema, name: "docking", active: ActiveDocking, apis: DockingApis, state: DockingState }); var toolbarHeightChange = constant$1(generate$6("toolbar-height-change")); var visibility = { fadeInClass: "tox-editor-dock-fadein", fadeOutClass: "tox-editor-dock-fadeout", transitionClass: "tox-editor-dock-transition" }; var editorStickyOnClass = "tox-tinymce--toolbar-sticky-on"; var editorStickyOffClass = "tox-tinymce--toolbar-sticky-off"; var scrollFromBehindHeader = function(e2, containerHeader) { var doc = owner$4(containerHeader); var viewHeight = doc.dom.defaultView.innerHeight; var scrollPos = get$9(doc); var markerElement = SugarElement.fromDom(e2.elm); var markerPos = absolute$2(markerElement); var markerHeight = get$b(markerElement); var markerTop = markerPos.y; var markerBottom = markerTop + markerHeight; var editorHeaderPos = absolute$3(containerHeader); var editorHeaderHeight = get$b(containerHeader); var editorHeaderTop = editorHeaderPos.top; var editorHeaderBottom = editorHeaderTop + editorHeaderHeight; var editorHeaderDockedAtTop = Math.abs(editorHeaderTop - scrollPos.top) < 2; var editorHeaderDockedAtBottom = Math.abs(editorHeaderBottom - (scrollPos.top + viewHeight)) < 2; if (editorHeaderDockedAtTop && markerTop < editorHeaderBottom) { to2(scrollPos.left, markerTop - editorHeaderHeight, doc); } else if (editorHeaderDockedAtBottom && markerBottom > editorHeaderTop) { var y2 = markerTop - viewHeight + markerHeight + editorHeaderHeight; to2(scrollPos.left, y2, doc); } }; var isDockedMode = function(header, mode3) { return contains$2(Docking.getModes(header), mode3); }; var updateIframeContentFlow = function(header) { var getOccupiedHeight = function(elm2) { return getOuter$2(elm2) + (parseInt(get$c(elm2, "margin-top"), 10) || 0) + (parseInt(get$c(elm2, "margin-bottom"), 10) || 0); }; var elm = header.element; parent2(elm).each(function(parentElem) { var padding = "padding-" + Docking.getModes(header)[0]; if (Docking.isDocked(header)) { var parentWidth = get$a(parentElem); set$7(elm, "width", parentWidth + "px"); set$7(parentElem, padding, getOccupiedHeight(elm) + "px"); } else { remove$6(elm, "width"); remove$6(parentElem, padding); } }); }; var updateSinkVisibility = function(sinkElem, visible9) { if (visible9) { remove$2(sinkElem, visibility.fadeOutClass); add$12(sinkElem, [ visibility.transitionClass, visibility.fadeInClass ]); } else { remove$2(sinkElem, visibility.fadeInClass); add$12(sinkElem, [ visibility.fadeOutClass, visibility.transitionClass ]); } }; var updateEditorClasses = function(editor, docked) { var editorContainer = SugarElement.fromDom(editor.getContainer()); if (docked) { add$2(editorContainer, editorStickyOnClass); remove$2(editorContainer, editorStickyOffClass); } else { add$2(editorContainer, editorStickyOffClass); remove$2(editorContainer, editorStickyOnClass); } }; var restoreFocus2 = function(headerElem, focusedElem) { var ownerDoc = owner$4(focusedElem); active(ownerDoc).filter(function(activeElm) { return !eq2(focusedElem, activeElm); }).filter(function(activeElm) { return eq2(activeElm, SugarElement.fromDom(ownerDoc.dom.body)) || contains2(headerElem, activeElm); }).each(function() { return focus$3(focusedElem); }); }; var findFocusedElem = function(rootElm, lazySink) { return search(rootElm).orThunk(function() { return lazySink().toOptional().bind(function(sink) { return search(sink.element); }); }); }; var setup$9 = function(editor, sharedBackstage, lazyHeader) { if (!editor.inline) { if (!sharedBackstage.header.isPositionedAtTop()) { editor.on("ResizeEditor", function() { lazyHeader().each(Docking.reset); }); } editor.on("ResizeWindow ResizeEditor", function() { lazyHeader().each(updateIframeContentFlow); }); editor.on("SkinLoaded", function() { lazyHeader().each(function(comp) { Docking.isDocked(comp) ? Docking.reset(comp) : Docking.refresh(comp); }); }); editor.on("FullscreenStateChanged", function() { lazyHeader().each(Docking.reset); }); } editor.on("AfterScrollIntoView", function(e2) { lazyHeader().each(function(header) { Docking.refresh(header); var headerElem = header.element; if (isVisible2(headerElem)) { scrollFromBehindHeader(e2, headerElem); } }); }); editor.on("PostRender", function() { updateEditorClasses(editor, false); }); }; var isDocked = function(lazyHeader) { return lazyHeader().map(Docking.isDocked).getOr(false); }; var getIframeBehaviours = function() { var _a4; return [Receiving.config({ channels: (_a4 = {}, _a4[toolbarHeightChange()] = { onReceive: updateIframeContentFlow }, _a4) })]; }; var getBehaviours = function(editor, sharedBackstage) { var focusedElm = value$1(); var lazySink = sharedBackstage.getSink; var runOnSinkElement = function(f2) { lazySink().each(function(sink) { return f2(sink.element); }); }; var onDockingSwitch = function(comp) { if (!editor.inline) { updateIframeContentFlow(comp); } updateEditorClasses(editor, Docking.isDocked(comp)); comp.getSystem().broadcastOn([repositionPopups()], {}); lazySink().each(function(sink) { return sink.getSystem().broadcastOn([repositionPopups()], {}); }); }; var additionalBehaviours = editor.inline ? [] : getIframeBehaviours(); return __spreadArray([ Focusing.config({}), Docking.config({ contextual: __assign({ lazyContext: function(comp) { var headerHeight = getOuter$2(comp.element); var container = editor.inline ? editor.getContentAreaContainer() : editor.getContainer(); var box2 = box$1(SugarElement.fromDom(container)); var boxHeight = box2.height - headerHeight; var topBound = box2.y + (isDockedMode(comp, "top") ? 0 : headerHeight); return Optional.some(bounds(box2.x, topBound, box2.width, boxHeight)); }, onShow: function() { runOnSinkElement(function(elem) { return updateSinkVisibility(elem, true); }); }, onShown: function(comp) { runOnSinkElement(function(elem) { return remove$1(elem, [ visibility.transitionClass, visibility.fadeInClass ]); }); focusedElm.get().each(function(elem) { restoreFocus2(comp.element, elem); focusedElm.clear(); }); }, onHide: function(comp) { findFocusedElem(comp.element, lazySink).fold(focusedElm.clear, focusedElm.set); runOnSinkElement(function(elem) { return updateSinkVisibility(elem, false); }); }, onHidden: function() { runOnSinkElement(function(elem) { return remove$1(elem, [visibility.transitionClass]); }); } }, visibility), lazyViewport: function(comp) { var win$1 = win(); var offset5 = getStickyToolbarOffset(editor); var top2 = win$1.y + (isDockedMode(comp, "top") ? offset5 : 0); var height2 = win$1.height - (isDockedMode(comp, "bottom") ? offset5 : 0); return bounds(win$1.x, top2, win$1.width, height2); }, modes: [sharedBackstage.header.getDockingMode()], onDocked: onDockingSwitch, onUndocked: onDockingSwitch }) ], additionalBehaviours, true); }; var StickyHeader = /* @__PURE__ */ Object.freeze({ __proto__: null, setup: setup$9, isDocked, getBehaviours }); var renderHeader2 = function(spec) { var editor = spec.editor; var getBehaviours$22 = spec.sticky ? getBehaviours : getBehaviours$1; return { uid: spec.uid, dom: spec.dom, components: spec.components, behaviours: derive$1(getBehaviours$22(editor, spec.sharedBackstage)) }; }; var groupToolbarButtonSchema = objOf([ requiredString("type"), requiredOf("items", oneOf([ arrOfObj([ requiredString("name"), requiredArrayOf("items", string2) ]), string2 ])) ].concat(baseToolbarButtonFields)); var createGroupToolbarButton = function(spec) { return asRaw("GroupToolbarButton", groupToolbarButtonSchema, spec); }; var baseMenuButtonFields = [ optionString("text"), optionString("tooltip"), optionString("icon"), requiredFunction("fetch"), defaultedFunction("onSetup", function() { return noop2; }) ]; var MenuButtonSchema = objOf(__spreadArray([requiredString("type")], baseMenuButtonFields, true)); var createMenuButton = function(spec) { return asRaw("menubutton", MenuButtonSchema, spec); }; var splitButtonSchema = objOf([ requiredString("type"), optionString("tooltip"), optionString("icon"), optionString("text"), optionFunction("select"), requiredFunction("fetch"), defaultedFunction("onSetup", function() { return noop2; }), defaultedStringEnum("presets", "normal", [ "normal", "color", "listpreview" ]), defaulted("columns", 1), requiredFunction("onAction"), requiredFunction("onItemAction") ]); var createSplitButton = function(spec) { return asRaw("SplitButton", splitButtonSchema, spec); }; var factory$b = function(detail, spec) { var setMenus = function(comp, menus) { var newMenus = map$2(menus, function(m2) { var buttonSpec = { type: "menubutton", text: m2.text, fetch: function(callback2) { callback2(m2.getItems()); } }; var internal2 = createMenuButton(buttonSpec).mapError(function(errInfo) { return formatError(errInfo); }).getOrDie(); return renderMenuButton(internal2, "tox-mbtn", spec.backstage, Optional.some("menuitem")); }); Replacing.set(comp, newMenus); }; var apis = { focus: Keying.focusIn, setMenus }; return { uid: detail.uid, dom: detail.dom, components: [], behaviours: derive$1([ Replacing.config({}), config3("menubar-events", [ runOnAttached(function(component) { detail.onSetup(component); }), run$1(mouseover(), function(comp, se) { descendant(comp.element, ".tox-mbtn--active").each(function(activeButton) { closest$1(se.event.target, ".tox-mbtn").each(function(hoveredButton) { if (!eq2(activeButton, hoveredButton)) { comp.getSystem().getByDom(activeButton).each(function(activeComp) { comp.getSystem().getByDom(hoveredButton).each(function(hoveredComp) { Dropdown2.expand(hoveredComp); Dropdown2.close(activeComp); Focusing.focus(hoveredComp); }); }); } }); }); }), run$1(focusShifted(), function(comp, se) { se.event.prevFocus.bind(function(prev2) { return comp.getSystem().getByDom(prev2).toOptional(); }).each(function(prev2) { se.event.newFocus.bind(function(nu2) { return comp.getSystem().getByDom(nu2).toOptional(); }).each(function(nu2) { if (Dropdown2.isOpen(prev2)) { Dropdown2.expand(nu2); Dropdown2.close(prev2); } }); }); }) ]), Keying.config({ mode: "flow", selector: ".tox-mbtn", onEscape: function(comp) { detail.onEscape(comp); return Optional.some(true); } }), Tabstopping.config({}) ]), apis, domModification: { attributes: { role: "menubar" } } }; }; var SilverMenubar = single({ factory: factory$b, name: "silver.Menubar", configFields: [ required$12("dom"), required$12("uid"), required$12("onEscape"), required$12("backstage"), defaulted("onSetup", noop2) ], apis: { focus: function(apis, comp) { apis.focus(comp); }, setMenus: function(apis, comp, menus) { apis.setMenus(comp, menus); } } }); var getAnimationRoot = function(component, slideConfig) { return slideConfig.getAnimationRoot.fold(function() { return component.element; }, function(get3) { return get3(component); }); }; var getDimensionProperty = function(slideConfig) { return slideConfig.dimension.property; }; var getDimension = function(slideConfig, elem) { return slideConfig.dimension.getDimension(elem); }; var disableTransitions = function(component, slideConfig) { var root2 = getAnimationRoot(component, slideConfig); remove$1(root2, [ slideConfig.shrinkingClass, slideConfig.growingClass ]); }; var setShrunk = function(component, slideConfig) { remove$2(component.element, slideConfig.openClass); add$2(component.element, slideConfig.closedClass); set$7(component.element, getDimensionProperty(slideConfig), "0px"); reflow(component.element); }; var setGrown = function(component, slideConfig) { remove$2(component.element, slideConfig.closedClass); add$2(component.element, slideConfig.openClass); remove$6(component.element, getDimensionProperty(slideConfig)); }; var doImmediateShrink = function(component, slideConfig, slideState, _calculatedSize) { slideState.setCollapsed(); set$7(component.element, getDimensionProperty(slideConfig), getDimension(slideConfig, component.element)); reflow(component.element); disableTransitions(component, slideConfig); setShrunk(component, slideConfig); slideConfig.onStartShrink(component); slideConfig.onShrunk(component); }; var doStartShrink = function(component, slideConfig, slideState, calculatedSize) { var size = calculatedSize.getOrThunk(function() { return getDimension(slideConfig, component.element); }); slideState.setCollapsed(); set$7(component.element, getDimensionProperty(slideConfig), size); reflow(component.element); var root2 = getAnimationRoot(component, slideConfig); remove$2(root2, slideConfig.growingClass); add$2(root2, slideConfig.shrinkingClass); setShrunk(component, slideConfig); slideConfig.onStartShrink(component); }; var doStartSmartShrink = function(component, slideConfig, slideState) { var size = getDimension(slideConfig, component.element); var shrinker = size === "0px" ? doImmediateShrink : doStartShrink; shrinker(component, slideConfig, slideState, Optional.some(size)); }; var doStartGrow = function(component, slideConfig, slideState) { var root2 = getAnimationRoot(component, slideConfig); var wasShrinking = has2(root2, slideConfig.shrinkingClass); var beforeSize = getDimension(slideConfig, component.element); setGrown(component, slideConfig); var fullSize = getDimension(slideConfig, component.element); var startPartialGrow = function() { set$7(component.element, getDimensionProperty(slideConfig), beforeSize); reflow(component.element); }; var startCompleteGrow = function() { setShrunk(component, slideConfig); }; var setStartSize = wasShrinking ? startPartialGrow : startCompleteGrow; setStartSize(); remove$2(root2, slideConfig.shrinkingClass); add$2(root2, slideConfig.growingClass); setGrown(component, slideConfig); set$7(component.element, getDimensionProperty(slideConfig), fullSize); slideState.setExpanded(); slideConfig.onStartGrow(component); }; var refresh$3 = function(component, slideConfig, slideState) { if (slideState.isExpanded()) { remove$6(component.element, getDimensionProperty(slideConfig)); var fullSize = getDimension(slideConfig, component.element); set$7(component.element, getDimensionProperty(slideConfig), fullSize); } }; var grow = function(component, slideConfig, slideState) { if (!slideState.isExpanded()) { doStartGrow(component, slideConfig, slideState); } }; var shrink = function(component, slideConfig, slideState) { if (slideState.isExpanded()) { doStartSmartShrink(component, slideConfig, slideState); } }; var immediateShrink = function(component, slideConfig, slideState) { if (slideState.isExpanded()) { doImmediateShrink(component, slideConfig, slideState); } }; var hasGrown = function(component, slideConfig, slideState) { return slideState.isExpanded(); }; var hasShrunk = function(component, slideConfig, slideState) { return slideState.isCollapsed(); }; var isGrowing = function(component, slideConfig, _slideState) { var root2 = getAnimationRoot(component, slideConfig); return has2(root2, slideConfig.growingClass) === true; }; var isShrinking = function(component, slideConfig, _slideState) { var root2 = getAnimationRoot(component, slideConfig); return has2(root2, slideConfig.shrinkingClass) === true; }; var isTransitioning = function(component, slideConfig, slideState) { return isGrowing(component, slideConfig) || isShrinking(component, slideConfig); }; var toggleGrow = function(component, slideConfig, slideState) { var f2 = slideState.isExpanded() ? doStartSmartShrink : doStartGrow; f2(component, slideConfig, slideState); }; var SlidingApis = /* @__PURE__ */ Object.freeze({ __proto__: null, refresh: refresh$3, grow, shrink, immediateShrink, hasGrown, hasShrunk, isGrowing, isShrinking, isTransitioning, toggleGrow, disableTransitions }); var exhibit = function(base2, slideConfig, _slideState) { var expanded = slideConfig.expanded; return expanded ? nu$7({ classes: [slideConfig.openClass], styles: {} }) : nu$7({ classes: [slideConfig.closedClass], styles: wrap$1(slideConfig.dimension.property, "0px") }); }; var events$4 = function(slideConfig, slideState) { return derive$2([runOnSource(transitionend(), function(component, simulatedEvent) { var raw = simulatedEvent.event.raw; if (raw.propertyName === slideConfig.dimension.property) { disableTransitions(component, slideConfig); if (slideState.isExpanded()) { remove$6(component.element, slideConfig.dimension.property); } var notify = slideState.isExpanded() ? slideConfig.onGrown : slideConfig.onShrunk; notify(component); } })]); }; var ActiveSliding = /* @__PURE__ */ Object.freeze({ __proto__: null, exhibit, events: events$4 }); var SlidingSchema = [ required$12("closedClass"), required$12("openClass"), required$12("shrinkingClass"), required$12("growingClass"), option("getAnimationRoot"), onHandler("onShrunk"), onHandler("onStartShrink"), onHandler("onGrown"), onHandler("onStartGrow"), defaulted("expanded", false), requiredOf("dimension", choose$1("property", { width: [ output$1("property", "width"), output$1("getDimension", function(elem) { return get$a(elem) + "px"; }) ], height: [ output$1("property", "height"), output$1("getDimension", function(elem) { return get$b(elem) + "px"; }) ] })) ]; var init$5 = function(spec) { var state = Cell3(spec.expanded); var readState = function() { return "expanded: " + state.get(); }; return nu$8({ isExpanded: function() { return state.get() === true; }, isCollapsed: function() { return state.get() === false; }, setCollapsed: curry(state.set, false), setExpanded: curry(state.set, true), readState }); }; var SlidingState = /* @__PURE__ */ Object.freeze({ __proto__: null, init: init$5 }); var Sliding = create$8({ fields: SlidingSchema, name: "sliding", active: ActiveSliding, apis: SlidingApis, state: SlidingState }); var owner = "container"; var schema$d = [field("slotBehaviours", [])]; var getPartName = function(name2) { return ""; }; var sketch = function(sSpec) { var parts2 = function() { var record2 = []; var slot = function(name2, config4) { record2.push(name2); return generateOne$1(owner, getPartName(name2), config4); }; return { slot, record: constant$1(record2) }; }(); var spec = sSpec(parts2); var partNames = parts2.record(); var fieldParts = map$2(partNames, function(n2) { return required2({ name: n2, pname: getPartName(n2) }); }); return composite$1(owner, schema$d, fieldParts, make$1, spec); }; var make$1 = function(detail, components4) { var getSlotNames = function(_2) { return getAllPartNames(detail); }; var getSlot3 = function(container, key2) { return getPart(container, detail, key2); }; var onSlot = function(f2, def) { return function(container, key2) { return getPart(container, detail, key2).map(function(slot) { return f2(slot, key2); }).getOr(def); }; }; var onSlots = function(f2) { return function(container, keys3) { each$12(keys3, function(key2) { return f2(container, key2); }); }; }; var doShowing = function(comp, _key) { return get$d(comp.element, "aria-hidden") !== "true"; }; var doShow = function(comp, key2) { if (!doShowing(comp)) { var element2 = comp.element; remove$6(element2, "display"); remove$7(element2, "aria-hidden"); emitWith(comp, slotVisibility(), { name: key2, visible: true }); } }; var doHide = function(comp, key2) { if (doShowing(comp)) { var element2 = comp.element; set$7(element2, "display", "none"); set$8(element2, "aria-hidden", "true"); emitWith(comp, slotVisibility(), { name: key2, visible: false }); } }; var isShowing = onSlot(doShowing, false); var hideSlot = onSlot(doHide); var hideSlots = onSlots(hideSlot); var hideAllSlots = function(container) { return hideSlots(container, getSlotNames()); }; var showSlot = onSlot(doShow); var apis = { getSlotNames, getSlot: getSlot3, isShowing, hideSlot, hideAllSlots, showSlot }; return { uid: detail.uid, dom: detail.dom, components: components4, behaviours: get$22(detail.slotBehaviours), apis }; }; var slotApis = map$1({ getSlotNames: function(apis, c2) { return apis.getSlotNames(c2); }, getSlot: function(apis, c2, key2) { return apis.getSlot(c2, key2); }, isShowing: function(apis, c2, key2) { return apis.isShowing(c2, key2); }, hideSlot: function(apis, c2, key2) { return apis.hideSlot(c2, key2); }, hideAllSlots: function(apis, c2) { return apis.hideAllSlots(c2); }, showSlot: function(apis, c2, key2) { return apis.showSlot(c2, key2); } }, function(value25) { return makeApi(value25); }); var SlotContainer = __assign(__assign({}, slotApis), { sketch }); var sidebarSchema = objOf([ optionString("icon"), optionString("tooltip"), defaultedFunction("onShow", noop2), defaultedFunction("onHide", noop2), defaultedFunction("onSetup", function() { return noop2; }) ]); var createSidebar = function(spec) { return asRaw("sidebar", sidebarSchema, spec); }; var setup$8 = function(editor) { var sidebars = editor.ui.registry.getAll().sidebars; each$12(keys2(sidebars), function(name2) { var spec = sidebars[name2]; var isActive = function() { return is$1(Optional.from(editor.queryCommandValue("ToggleSidebar")), name2); }; editor.ui.registry.addToggleButton(name2, { icon: spec.icon, tooltip: spec.tooltip, onAction: function(buttonApi) { editor.execCommand("ToggleSidebar", false, name2); buttonApi.setActive(isActive()); }, onSetup: function(buttonApi) { var handleToggle = function() { return buttonApi.setActive(isActive()); }; editor.on("ToggleSidebar", handleToggle); return function() { editor.off("ToggleSidebar", handleToggle); }; } }); }); }; var getApi = function(comp) { return { element: function() { return comp.element.dom; } }; }; var makePanels = function(parts2, panelConfigs) { var specs = map$2(keys2(panelConfigs), function(name2) { var spec = panelConfigs[name2]; var bridged = getOrDie(createSidebar(spec)); return { name: name2, getApi, onSetup: bridged.onSetup, onShow: bridged.onShow, onHide: bridged.onHide }; }); return map$2(specs, function(spec) { var editorOffCell = Cell3(noop2); return parts2.slot(spec.name, { dom: { tag: "div", classes: ["tox-sidebar__pane"] }, behaviours: SimpleBehaviours.unnamedEvents([ onControlAttached(spec, editorOffCell), onControlDetached(spec, editorOffCell), run$1(slotVisibility(), function(sidepanel, se) { var data65 = se.event; var optSidePanelSpec = find$5(specs, function(config4) { return config4.name === data65.name; }); optSidePanelSpec.each(function(sidePanelSpec) { var handler7 = data65.visible ? sidePanelSpec.onShow : sidePanelSpec.onHide; handler7(sidePanelSpec.getApi(sidepanel)); }); }) ]) }); }); }; var makeSidebar = function(panelConfigs) { return SlotContainer.sketch(function(parts2) { return { dom: { tag: "div", classes: ["tox-sidebar__pane-container"] }, components: makePanels(parts2, panelConfigs), slotBehaviours: SimpleBehaviours.unnamedEvents([runOnAttached(function(slotContainer) { return SlotContainer.hideAllSlots(slotContainer); })]) }; }); }; var setSidebar = function(sidebar, panelConfigs) { var optSlider = Composing.getCurrent(sidebar); optSlider.each(function(slider) { return Replacing.set(slider, [makeSidebar(panelConfigs)]); }); }; var toggleSidebar = function(sidebar, name2) { var optSlider = Composing.getCurrent(sidebar); optSlider.each(function(slider) { var optSlotContainer = Composing.getCurrent(slider); optSlotContainer.each(function(slotContainer) { if (Sliding.hasGrown(slider)) { if (SlotContainer.isShowing(slotContainer, name2)) { Sliding.shrink(slider); } else { SlotContainer.hideAllSlots(slotContainer); SlotContainer.showSlot(slotContainer, name2); } } else { SlotContainer.hideAllSlots(slotContainer); SlotContainer.showSlot(slotContainer, name2); Sliding.grow(slider); } }); }); }; var whichSidebar = function(sidebar) { var optSlider = Composing.getCurrent(sidebar); return optSlider.bind(function(slider) { var sidebarOpen = Sliding.isGrowing(slider) || Sliding.hasGrown(slider); if (sidebarOpen) { var optSlotContainer = Composing.getCurrent(slider); return optSlotContainer.bind(function(slotContainer) { return find$5(SlotContainer.getSlotNames(slotContainer), function(name2) { return SlotContainer.isShowing(slotContainer, name2); }); }); } else { return Optional.none(); } }); }; var fixSize = generate$6("FixSizeEvent"); var autoSize = generate$6("AutoSizeEvent"); var renderSidebar = function(spec) { return { uid: spec.uid, dom: { tag: "div", classes: ["tox-sidebar"], attributes: { role: "complementary" } }, components: [{ dom: { tag: "div", classes: ["tox-sidebar__slider"] }, components: [], behaviours: derive$1([ Tabstopping.config({}), Focusing.config({}), Sliding.config({ dimension: { property: "width" }, closedClass: "tox-sidebar--sliding-closed", openClass: "tox-sidebar--sliding-open", shrinkingClass: "tox-sidebar--sliding-shrinking", growingClass: "tox-sidebar--sliding-growing", onShrunk: function(slider) { var optSlotContainer = Composing.getCurrent(slider); optSlotContainer.each(SlotContainer.hideAllSlots); emit2(slider, autoSize); }, onGrown: function(slider) { emit2(slider, autoSize); }, onStartGrow: function(slider) { emitWith(slider, fixSize, { width: getRaw(slider.element, "width").getOr("") }); }, onStartShrink: function(slider) { emitWith(slider, fixSize, { width: get$a(slider.element) + "px" }); } }), Replacing.config({}), Composing.config({ find: function(comp) { var children2 = Replacing.contents(comp); return head(children2); } }) ]) }], behaviours: derive$1([ ComposingConfigs.childAt(0), config3("sidebar-sliding-events", [ run$1(fixSize, function(comp, se) { set$7(comp.element, "width", se.event.width); }), run$1(autoSize, function(comp, _se) { remove$6(comp.element, "width"); }) ]) ]) }; }; var block = function(component, config4, state, getBusySpec2) { set$8(component.element, "aria-busy", true); var root2 = config4.getRoot(component).getOr(component); var blockerBehaviours = derive$1([ Keying.config({ mode: "special", onTab: function() { return Optional.some(true); }, onShiftTab: function() { return Optional.some(true); } }), Focusing.config({}) ]); var blockSpec = getBusySpec2(root2, blockerBehaviours); var blocker = root2.getSystem().build(blockSpec); Replacing.append(root2, premade(blocker)); if (blocker.hasConfigured(Keying) && config4.focus) { Keying.focusIn(blocker); } if (!state.isBlocked()) { config4.onBlock(component); } state.blockWith(function() { return Replacing.remove(root2, blocker); }); }; var unblock = function(component, config4, state) { remove$7(component.element, "aria-busy"); if (state.isBlocked()) { config4.onUnblock(component); } state.clear(); }; var BlockingApis = /* @__PURE__ */ Object.freeze({ __proto__: null, block, unblock }); var BlockingSchema = [ defaultedFunction("getRoot", Optional.none), defaultedBoolean("focus", true), onHandler("onBlock"), onHandler("onUnblock") ]; var init$4 = function() { var blocker = destroyable(); var blockWith = function(destroy3) { blocker.set({ destroy: destroy3 }); }; return nu$8({ readState: blocker.isSet, blockWith, clear: blocker.clear, isBlocked: blocker.isSet }); }; var BlockingState = /* @__PURE__ */ Object.freeze({ __proto__: null, init: init$4 }); var Blocking = create$8({ fields: BlockingSchema, name: "blocking", apis: BlockingApis, state: BlockingState }); var getAttrs = function(elem) { var attributes2 = elem.dom.attributes !== void 0 ? elem.dom.attributes : []; return foldl(attributes2, function(b3, attr) { var _a4; if (attr.name === "class") { return b3; } else { return __assign(__assign({}, b3), (_a4 = {}, _a4[attr.name] = attr.value, _a4)); } }, {}); }; var getClasses = function(elem) { return Array.prototype.slice.call(elem.dom.classList, 0); }; var fromHtml = function(html2) { var elem = SugarElement.fromHtml(html2); var children$1 = children(elem); var attrs = getAttrs(elem); var classes4 = getClasses(elem); var contents2 = children$1.length === 0 ? {} : { innerHtml: get$7(elem) }; return __assign({ tag: name$2(elem), classes: classes4, attributes: attrs }, contents2); }; var getBusySpec$1 = function(providerBackstage) { return function(_root, _behaviours) { return { dom: { tag: "div", attributes: { "aria-label": providerBackstage.translate("Loading..."), "tabindex": "0" }, classes: ["tox-throbber__busy-spinner"] }, components: [{ dom: fromHtml('
    ') }] }; }; }; var focusBusyComponent = function(throbber) { return Composing.getCurrent(throbber).each(function(comp) { return focus$3(comp.element); }); }; var toggleEditorTabIndex = function(editor, state) { var tabIndexAttr = "tabindex"; var dataTabIndexAttr = "data-mce-" + tabIndexAttr; Optional.from(editor.iframeElement).map(SugarElement.fromDom).each(function(iframe2) { if (state) { getOpt(iframe2, tabIndexAttr).each(function(tabIndex) { return set$8(iframe2, dataTabIndexAttr, tabIndex); }); set$8(iframe2, tabIndexAttr, -1); } else { remove$7(iframe2, tabIndexAttr); getOpt(iframe2, dataTabIndexAttr).each(function(tabIndex) { set$8(iframe2, tabIndexAttr, tabIndex); remove$7(iframe2, dataTabIndexAttr); }); } }); }; var toggleThrobber = function(editor, comp, state, providerBackstage) { var element2 = comp.element; toggleEditorTabIndex(editor, state); if (state) { Blocking.block(comp, getBusySpec$1(providerBackstage)); remove$6(element2, "display"); remove$7(element2, "aria-hidden"); if (editor.hasFocus()) { focusBusyComponent(comp); } } else { var throbberFocus = Composing.getCurrent(comp).exists(function(busyComp) { return hasFocus(busyComp.element); }); Blocking.unblock(comp); set$7(element2, "display", "none"); set$8(element2, "aria-hidden", "true"); if (throbberFocus) { editor.focus(); } } }; var renderThrobber = function(spec) { return { uid: spec.uid, dom: { tag: "div", attributes: { "aria-hidden": "true" }, classes: ["tox-throbber"], styles: { display: "none" } }, behaviours: derive$1([ Replacing.config({}), Blocking.config({ focus: false }), Composing.config({ find: function(comp) { return head(comp.components()); } }) ]), components: [] }; }; var isFocusEvent = function(event) { return event.type === "focusin"; }; var isPasteBinTarget = function(event) { if (isFocusEvent(event)) { var node = event.composed ? head(event.composedPath()) : Optional.from(event.target); return node.map(SugarElement.fromDom).filter(isElement$2).exists(function(targetElm) { return has2(targetElm, "mce-pastebin"); }); } else { return false; } }; var setup$7 = function(editor, lazyThrobber, sharedBackstage) { var throbberState = Cell3(false); var timer = value$1(); var stealFocus = function(e2) { if (throbberState.get() && !isPasteBinTarget(e2)) { e2.preventDefault(); focusBusyComponent(lazyThrobber()); editor.editorManager.setActive(editor); } }; if (!editor.inline) { editor.on("PreInit", function() { editor.dom.bind(editor.getWin(), "focusin", stealFocus); editor.on("BeforeExecCommand", function(e2) { if (e2.command.toLowerCase() === "mcefocus" && e2.value !== true) { stealFocus(e2); } }); }); } var toggle2 = function(state) { if (state !== throbberState.get()) { throbberState.set(state); toggleThrobber(editor, lazyThrobber(), state, sharedBackstage.providers); editor.fire("AfterProgressState", { state }); } }; editor.on("ProgressState", function(e2) { timer.on(global$f.clearTimeout); if (isNumber2(e2.time)) { var timerId = global$f.setEditorTimeout(editor, function() { return toggle2(e2.state); }, e2.time); timer.set(timerId); } else { toggle2(e2.state); timer.clear(); } }); }; var generate$12 = function(xs, f2) { var init2 = { len: 0, list: [] }; var r3 = foldl(xs, function(b3, a2) { var value25 = f2(a2, b3.len); return value25.fold(constant$1(b3), function(v2) { return { len: v2.finish, list: b3.list.concat([v2]) }; }); }, init2); return r3.list; }; var output = function(within, extra, withinWidth) { return { within, extra, withinWidth }; }; var apportion = function(units2, total2, len) { var parray = generate$12(units2, function(unit, current2) { var width2 = len(unit); return Optional.some({ element: unit, start: current2, finish: current2 + width2, width: width2 }); }); var within = filter$2(parray, function(unit) { return unit.finish <= total2; }); var withinWidth = foldr(within, function(acc, el) { return acc + el.width; }, 0); var extra = parray.slice(within.length); return { within, extra, withinWidth }; }; var toUnit = function(parray) { return map$2(parray, function(unit) { return unit.element; }); }; var fitLast = function(within, extra, withinWidth) { var fits = toUnit(within.concat(extra)); return output(fits, [], withinWidth); }; var overflow = function(within, extra, overflower, withinWidth) { var fits = toUnit(within).concat([overflower]); return output(fits, toUnit(extra), withinWidth); }; var fitAll = function(within, extra, withinWidth) { return output(toUnit(within), [], withinWidth); }; var tryFit = function(total2, units2, len) { var divide = apportion(units2, total2, len); return divide.extra.length === 0 ? Optional.some(divide) : Optional.none(); }; var partition2 = function(total2, units2, len, overflower) { var divide = tryFit(total2, units2, len).getOrThunk(function() { return apportion(units2, total2 - len(overflower), len); }); var within = divide.within; var extra = divide.extra; var withinWidth = divide.withinWidth; if (extra.length === 1 && extra[0].width <= len(overflower)) { return fitLast(within, extra, withinWidth); } else if (extra.length >= 1) { return overflow(within, extra, overflower, withinWidth); } else { return fitAll(within, extra, withinWidth); } }; var setGroups$1 = function(toolbar2, storedGroups) { var bGroups = map$2(storedGroups, function(g2) { return premade(g2); }); Toolbar.setGroups(toolbar2, bGroups); }; var findFocusedComp = function(comps) { return findMap(comps, function(comp) { return search(comp.element).bind(function(focusedElm) { return comp.getSystem().getByDom(focusedElm).toOptional(); }); }); }; var refresh$2 = function(toolbar2, detail, setOverflow) { var builtGroups = detail.builtGroups.get(); if (builtGroups.length === 0) { return; } var primary = getPartOrDie(toolbar2, detail, "primary"); var overflowGroup = Coupling.getCoupled(toolbar2, "overflowGroup"); set$7(primary.element, "visibility", "hidden"); var groups = builtGroups.concat([overflowGroup]); var focusedComp = findFocusedComp(groups); setOverflow([]); setGroups$1(primary, groups); var availableWidth = get$a(primary.element); var overflows = partition2(availableWidth, detail.builtGroups.get(), function(comp) { return get$a(comp.element); }, overflowGroup); if (overflows.extra.length === 0) { Replacing.remove(primary, overflowGroup); setOverflow([]); } else { setGroups$1(primary, overflows.within); setOverflow(overflows.extra); } remove$6(primary.element, "visibility"); reflow(primary.element); focusedComp.each(Focusing.focus); }; var schema$c = constant$1([ field("splitToolbarBehaviours", [Coupling]), customField("builtGroups", function() { return Cell3([]); }) ]); var schema$b = constant$1([ markers$1(["overflowToggledClass"]), optionFunction("getOverflowBounds"), required$12("lazySink"), customField("overflowGroups", function() { return Cell3([]); }) ].concat(schema$c())); var parts$7 = constant$1([ required2({ factory: Toolbar, schema: schema$e(), name: "primary" }), external$1({ schema: schema$e(), name: "overflow" }), external$1({ name: "overflow-button" }), external$1({ name: "overflow-group" }) ]); var expandable = constant$1(function(element2, available) { setMax(element2, Math.floor(available)); }); var schema$a = constant$1([ markers$1(["toggledClass"]), required$12("lazySink"), requiredFunction("fetch"), optionFunction("getBounds"), optionObjOf("fireDismissalEventInstead", [defaulted("event", dismissRequested())]), schema$y() ]); var parts$6 = constant$1([ external$1({ name: "button", overrides: function(detail) { return { dom: { attributes: { "aria-haspopup": "true" } }, buttonBehaviours: derive$1([Toggling.config({ toggleClass: detail.markers.toggledClass, aria: { mode: "expanded" }, toggleOnExecute: false })]) }; } }), external$1({ factory: Toolbar, schema: schema$e(), name: "toolbar", overrides: function(detail) { return { toolbarBehaviours: derive$1([Keying.config({ mode: "cyclic", onEscape: function(comp) { getPart(comp, detail, "button").each(Focusing.focus); return Optional.none(); } })]) }; } }) ]); var toggle = function(button2, externals) { var toolbarSandbox = Coupling.getCoupled(button2, "toolbarSandbox"); if (Sandboxing.isOpen(toolbarSandbox)) { Sandboxing.close(toolbarSandbox); } else { Sandboxing.open(toolbarSandbox, externals.toolbar()); } }; var position2 = function(button2, toolbar2, detail, layouts2) { var bounds2 = detail.getBounds.map(function(bounder) { return bounder(); }); var sink = detail.lazySink(button2).getOrDie(); Positioning.positionWithinBounds(sink, toolbar2, { anchor: { type: "hotspot", hotspot: button2, layouts: layouts2, overrides: { maxWidthFunction: expandable() } } }, bounds2); }; var setGroups = function(button2, toolbar2, detail, layouts2, groups) { Toolbar.setGroups(toolbar2, groups); position2(button2, toolbar2, detail, layouts2); Toggling.on(button2); }; var makeSandbox = function(button2, spec, detail) { var ariaOwner = manager(); var onOpen = function(sandbox, toolbar2) { detail.fetch().get(function(groups) { setGroups(button2, toolbar2, detail, spec.layouts, groups); ariaOwner.link(button2.element); Keying.focusIn(toolbar2); }); }; var onClose = function() { Toggling.off(button2); Focusing.focus(button2); ariaOwner.unlink(button2.element); }; return { dom: { tag: "div", attributes: { id: ariaOwner.id } }, behaviours: derive$1([ Keying.config({ mode: "special", onEscape: function(comp) { Sandboxing.close(comp); return Optional.some(true); } }), Sandboxing.config({ onOpen, onClose, isPartOf: function(container, data65, queryElem) { return isPartOf$1(data65, queryElem) || isPartOf$1(button2, queryElem); }, getAttachPoint: function() { return detail.lazySink(button2).getOrDie(); } }), Receiving.config({ channels: __assign(__assign({}, receivingChannel$1(__assign({ isExtraPart: never }, detail.fireDismissalEventInstead.map(function(fe) { return { fireEventInstead: { event: fe.event } }; }).getOr({})))), receivingChannel({ doReposition: function() { Sandboxing.getState(Coupling.getCoupled(button2, "toolbarSandbox")).each(function(toolbar2) { position2(button2, toolbar2, detail, spec.layouts); }); } })) }) ]) }; }; var factory$a = function(detail, components4, spec, externals) { return __assign(__assign({}, Button2.sketch(__assign(__assign({}, externals.button()), { action: function(button2) { toggle(button2, externals); }, buttonBehaviours: SketchBehaviours.augment({ dump: externals.button().buttonBehaviours }, [Coupling.config({ others: { toolbarSandbox: function(button2) { return makeSandbox(button2, spec, detail); } } })]) }))), { apis: { setGroups: function(button2, groups) { Sandboxing.getState(Coupling.getCoupled(button2, "toolbarSandbox")).each(function(toolbar2) { setGroups(button2, toolbar2, detail, spec.layouts, groups); }); }, reposition: function(button2) { Sandboxing.getState(Coupling.getCoupled(button2, "toolbarSandbox")).each(function(toolbar2) { position2(button2, toolbar2, detail, spec.layouts); }); }, toggle: function(button2) { toggle(button2, externals); }, getToolbar: function(button2) { return Sandboxing.getState(Coupling.getCoupled(button2, "toolbarSandbox")); }, isOpen: function(button2) { return Sandboxing.isOpen(Coupling.getCoupled(button2, "toolbarSandbox")); } } }); }; var FloatingToolbarButton = composite({ name: "FloatingToolbarButton", factory: factory$a, configFields: schema$a(), partFields: parts$6(), apis: { setGroups: function(apis, button2, groups) { apis.setGroups(button2, groups); }, reposition: function(apis, button2) { apis.reposition(button2); }, toggle: function(apis, button2) { apis.toggle(button2); }, getToolbar: function(apis, button2) { return apis.getToolbar(button2); }, isOpen: function(apis, button2) { return apis.isOpen(button2); } } }); var schema$9 = constant$1([ required$12("items"), markers$1(["itemSelector"]), field("tgroupBehaviours", [Keying]) ]); var parts$5 = constant$1([group({ name: "items", unit: "item" })]); var factory$9 = function(detail, components4, _spec, _externals) { return { uid: detail.uid, dom: detail.dom, components: components4, behaviours: augment(detail.tgroupBehaviours, [Keying.config({ mode: "flow", selector: detail.markers.itemSelector })]), domModification: { attributes: { role: "toolbar" } } }; }; var ToolbarGroup = composite({ name: "ToolbarGroup", configFields: schema$9(), partFields: parts$5(), factory: factory$9 }); var buildGroups = function(comps) { return map$2(comps, function(g2) { return premade(g2); }); }; var refresh$1 = function(toolbar2, memFloatingToolbarButton, detail) { refresh$2(toolbar2, detail, function(overflowGroups) { detail.overflowGroups.set(overflowGroups); memFloatingToolbarButton.getOpt(toolbar2).each(function(floatingToolbarButton) { FloatingToolbarButton.setGroups(floatingToolbarButton, buildGroups(overflowGroups)); }); }); }; var factory$8 = function(detail, components4, spec, externals) { var memFloatingToolbarButton = record(FloatingToolbarButton.sketch({ fetch: function() { return Future.nu(function(resolve) { resolve(buildGroups(detail.overflowGroups.get())); }); }, layouts: { onLtr: function() { return [ southwest$2, southeast$2 ]; }, onRtl: function() { return [ southeast$2, southwest$2 ]; }, onBottomLtr: function() { return [ northwest$2, northeast$2 ]; }, onBottomRtl: function() { return [ northeast$2, northwest$2 ]; } }, getBounds: spec.getOverflowBounds, lazySink: detail.lazySink, fireDismissalEventInstead: {}, markers: { toggledClass: detail.markers.overflowToggledClass }, parts: { button: externals["overflow-button"](), toolbar: externals.overflow() } })); return { uid: detail.uid, dom: detail.dom, components: components4, behaviours: augment(detail.splitToolbarBehaviours, [Coupling.config({ others: { overflowGroup: function() { return ToolbarGroup.sketch(__assign(__assign({}, externals["overflow-group"]()), { items: [memFloatingToolbarButton.asSpec()] })); } } })]), apis: { setGroups: function(toolbar2, groups) { detail.builtGroups.set(map$2(groups, toolbar2.getSystem().build)); refresh$1(toolbar2, memFloatingToolbarButton, detail); }, refresh: function(toolbar2) { return refresh$1(toolbar2, memFloatingToolbarButton, detail); }, toggle: function(toolbar2) { memFloatingToolbarButton.getOpt(toolbar2).each(function(floatingToolbarButton) { FloatingToolbarButton.toggle(floatingToolbarButton); }); }, isOpen: function(toolbar2) { return memFloatingToolbarButton.getOpt(toolbar2).map(FloatingToolbarButton.isOpen).getOr(false); }, reposition: function(toolbar2) { memFloatingToolbarButton.getOpt(toolbar2).each(function(floatingToolbarButton) { FloatingToolbarButton.reposition(floatingToolbarButton); }); }, getOverflow: function(toolbar2) { return memFloatingToolbarButton.getOpt(toolbar2).bind(FloatingToolbarButton.getToolbar); } }, domModification: { attributes: { role: "group" } } }; }; var SplitFloatingToolbar = composite({ name: "SplitFloatingToolbar", configFields: schema$b(), partFields: parts$7(), factory: factory$8, apis: { setGroups: function(apis, toolbar2, groups) { apis.setGroups(toolbar2, groups); }, refresh: function(apis, toolbar2) { apis.refresh(toolbar2); }, reposition: function(apis, toolbar2) { apis.reposition(toolbar2); }, toggle: function(apis, toolbar2) { apis.toggle(toolbar2); }, isOpen: function(apis, toolbar2) { return apis.isOpen(toolbar2); }, getOverflow: function(apis, toolbar2) { return apis.getOverflow(toolbar2); } } }); var schema$8 = constant$1([ markers$1([ "closedClass", "openClass", "shrinkingClass", "growingClass", "overflowToggledClass" ]), onHandler("onOpened"), onHandler("onClosed") ].concat(schema$c())); var parts$4 = constant$1([ required2({ factory: Toolbar, schema: schema$e(), name: "primary" }), required2({ factory: Toolbar, schema: schema$e(), name: "overflow", overrides: function(detail) { return { toolbarBehaviours: derive$1([ Sliding.config({ dimension: { property: "height" }, closedClass: detail.markers.closedClass, openClass: detail.markers.openClass, shrinkingClass: detail.markers.shrinkingClass, growingClass: detail.markers.growingClass, onShrunk: function(comp) { getPart(comp, detail, "overflow-button").each(function(button2) { Toggling.off(button2); Focusing.focus(button2); }); detail.onClosed(comp); }, onGrown: function(comp) { Keying.focusIn(comp); detail.onOpened(comp); }, onStartGrow: function(comp) { getPart(comp, detail, "overflow-button").each(Toggling.on); } }), Keying.config({ mode: "acyclic", onEscape: function(comp) { getPart(comp, detail, "overflow-button").each(Focusing.focus); return Optional.some(true); } }) ]) }; } }), external$1({ name: "overflow-button", overrides: function(detail) { return { buttonBehaviours: derive$1([Toggling.config({ toggleClass: detail.markers.overflowToggledClass, aria: { mode: "pressed" }, toggleOnExecute: false })]) }; } }), external$1({ name: "overflow-group" }) ]); var isOpen = function(toolbar2, detail) { return getPart(toolbar2, detail, "overflow").map(Sliding.hasGrown).getOr(false); }; var toggleToolbar = function(toolbar2, detail) { getPart(toolbar2, detail, "overflow-button").bind(function() { return getPart(toolbar2, detail, "overflow"); }).each(function(overf) { refresh(toolbar2, detail); Sliding.toggleGrow(overf); }); }; var refresh = function(toolbar2, detail) { getPart(toolbar2, detail, "overflow").each(function(overflow2) { refresh$2(toolbar2, detail, function(groups) { var builtGroups = map$2(groups, function(g2) { return premade(g2); }); Toolbar.setGroups(overflow2, builtGroups); }); getPart(toolbar2, detail, "overflow-button").each(function(button2) { if (Sliding.hasGrown(overflow2)) { Toggling.on(button2); } }); Sliding.refresh(overflow2); }); }; var factory$7 = function(detail, components4, spec, externals) { var toolbarToggleEvent = "alloy.toolbar.toggle"; var doSetGroups = function(toolbar2, groups) { var built = map$2(groups, toolbar2.getSystem().build); detail.builtGroups.set(built); }; return { uid: detail.uid, dom: detail.dom, components: components4, behaviours: augment(detail.splitToolbarBehaviours, [ Coupling.config({ others: { overflowGroup: function(toolbar2) { return ToolbarGroup.sketch(__assign(__assign({}, externals["overflow-group"]()), { items: [Button2.sketch(__assign(__assign({}, externals["overflow-button"]()), { action: function(_button) { emit2(toolbar2, toolbarToggleEvent); } }))] })); } } }), config3("toolbar-toggle-events", [run$1(toolbarToggleEvent, function(toolbar2) { toggleToolbar(toolbar2, detail); })]) ]), apis: { setGroups: function(toolbar2, groups) { doSetGroups(toolbar2, groups); refresh(toolbar2, detail); }, refresh: function(toolbar2) { return refresh(toolbar2, detail); }, toggle: function(toolbar2) { return toggleToolbar(toolbar2, detail); }, isOpen: function(toolbar2) { return isOpen(toolbar2, detail); } }, domModification: { attributes: { role: "group" } } }; }; var SplitSlidingToolbar = composite({ name: "SplitSlidingToolbar", configFields: schema$8(), partFields: parts$4(), factory: factory$7, apis: { setGroups: function(apis, toolbar2, groups) { apis.setGroups(toolbar2, groups); }, refresh: function(apis, toolbar2) { apis.refresh(toolbar2); }, toggle: function(apis, toolbar2) { apis.toggle(toolbar2); }, isOpen: function(apis, toolbar2) { return apis.isOpen(toolbar2); } } }); var renderToolbarGroupCommon = function(toolbarGroup) { var attributes2 = toolbarGroup.title.fold(function() { return {}; }, function(title) { return { attributes: { title } }; }); return { dom: __assign({ tag: "div", classes: ["tox-toolbar__group"] }, attributes2), components: [ToolbarGroup.parts.items({})], items: toolbarGroup.items, markers: { itemSelector: "*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled])" }, tgroupBehaviours: derive$1([ Tabstopping.config({}), Focusing.config({}) ]) }; }; var renderToolbarGroup = function(toolbarGroup) { return ToolbarGroup.sketch(renderToolbarGroupCommon(toolbarGroup)); }; var getToolbarbehaviours = function(toolbarSpec, modeName) { var onAttached = runOnAttached(function(component) { var groups = map$2(toolbarSpec.initGroups, renderToolbarGroup); Toolbar.setGroups(component, groups); }); return derive$1([ DisablingConfigs.toolbarButton(toolbarSpec.providers.isDisabled), receivingConfig(), Keying.config({ mode: modeName, onEscape: toolbarSpec.onEscape, selector: ".tox-toolbar__group" }), config3("toolbar-events", [onAttached]) ]); }; var renderMoreToolbarCommon = function(toolbarSpec) { var modeName = toolbarSpec.cyclicKeying ? "cyclic" : "acyclic"; return { uid: toolbarSpec.uid, dom: { tag: "div", classes: ["tox-toolbar-overlord"] }, parts: { "overflow-group": renderToolbarGroupCommon({ title: Optional.none(), items: [] }), "overflow-button": renderIconButtonSpec({ name: "more", icon: Optional.some("more-drawer"), disabled: false, tooltip: Optional.some("More..."), primary: false, borderless: false }, Optional.none(), toolbarSpec.providers) }, splitToolbarBehaviours: getToolbarbehaviours(toolbarSpec, modeName) }; }; var renderFloatingMoreToolbar = function(toolbarSpec) { var baseSpec = renderMoreToolbarCommon(toolbarSpec); var overflowXOffset = 4; var primary = SplitFloatingToolbar.parts.primary({ dom: { tag: "div", classes: ["tox-toolbar__primary"] } }); return SplitFloatingToolbar.sketch(__assign(__assign({}, baseSpec), { lazySink: toolbarSpec.getSink, getOverflowBounds: function() { var headerElem = toolbarSpec.moreDrawerData.lazyHeader().element; var headerBounds = absolute$2(headerElem); var docElem = documentElement(headerElem); var docBounds = absolute$2(docElem); var height2 = Math.max(docElem.dom.scrollHeight, docBounds.height); return bounds(headerBounds.x + overflowXOffset, docBounds.y, headerBounds.width - overflowXOffset * 2, height2); }, parts: __assign(__assign({}, baseSpec.parts), { overflow: { dom: { tag: "div", classes: ["tox-toolbar__overflow"], attributes: toolbarSpec.attributes } } }), components: [primary], markers: { overflowToggledClass: "tox-tbtn--enabled" } })); }; var renderSlidingMoreToolbar = function(toolbarSpec) { var primary = SplitSlidingToolbar.parts.primary({ dom: { tag: "div", classes: ["tox-toolbar__primary"] } }); var overflow2 = SplitSlidingToolbar.parts.overflow({ dom: { tag: "div", classes: ["tox-toolbar__overflow"] } }); var baseSpec = renderMoreToolbarCommon(toolbarSpec); return SplitSlidingToolbar.sketch(__assign(__assign({}, baseSpec), { components: [ primary, overflow2 ], markers: { openClass: "tox-toolbar__overflow--open", closedClass: "tox-toolbar__overflow--closed", growingClass: "tox-toolbar__overflow--growing", shrinkingClass: "tox-toolbar__overflow--shrinking", overflowToggledClass: "tox-tbtn--enabled" }, onOpened: function(comp) { comp.getSystem().broadcastOn([toolbarHeightChange()], { type: "opened" }); }, onClosed: function(comp) { comp.getSystem().broadcastOn([toolbarHeightChange()], { type: "closed" }); } })); }; var renderToolbar = function(toolbarSpec) { var modeName = toolbarSpec.cyclicKeying ? "cyclic" : "acyclic"; return Toolbar.sketch({ uid: toolbarSpec.uid, dom: { tag: "div", classes: ["tox-toolbar"].concat(toolbarSpec.type === ToolbarMode.scrolling ? ["tox-toolbar--scrolling"] : []) }, components: [Toolbar.parts.groups({})], toolbarBehaviours: getToolbarbehaviours(toolbarSpec, modeName) }); }; var factory$6 = function(detail, components4, _spec) { var apis = { getSocket: function(comp) { return parts$a.getPart(comp, detail, "socket"); }, setSidebar: function(comp, panelConfigs) { parts$a.getPart(comp, detail, "sidebar").each(function(sidebar) { return setSidebar(sidebar, panelConfigs); }); }, toggleSidebar: function(comp, name2) { parts$a.getPart(comp, detail, "sidebar").each(function(sidebar) { return toggleSidebar(sidebar, name2); }); }, whichSidebar: function(comp) { return parts$a.getPart(comp, detail, "sidebar").bind(whichSidebar).getOrNull(); }, getHeader: function(comp) { return parts$a.getPart(comp, detail, "header"); }, getToolbar: function(comp) { return parts$a.getPart(comp, detail, "toolbar"); }, setToolbar: function(comp, groups) { parts$a.getPart(comp, detail, "toolbar").each(function(toolbar2) { toolbar2.getApis().setGroups(toolbar2, groups); }); }, setToolbars: function(comp, toolbars) { parts$a.getPart(comp, detail, "multiple-toolbar").each(function(mToolbar) { CustomList.setItems(mToolbar, toolbars); }); }, refreshToolbar: function(comp) { var toolbar2 = parts$a.getPart(comp, detail, "toolbar"); toolbar2.each(function(toolbar3) { return toolbar3.getApis().refresh(toolbar3); }); }, toggleToolbarDrawer: function(comp) { parts$a.getPart(comp, detail, "toolbar").each(function(toolbar2) { mapFrom(toolbar2.getApis().toggle, function(toggle2) { return toggle2(toolbar2); }); }); }, isToolbarDrawerToggled: function(comp) { return parts$a.getPart(comp, detail, "toolbar").bind(function(toolbar2) { return Optional.from(toolbar2.getApis().isOpen).map(function(isOpen2) { return isOpen2(toolbar2); }); }).getOr(false); }, getThrobber: function(comp) { return parts$a.getPart(comp, detail, "throbber"); }, focusToolbar: function(comp) { var optToolbar = parts$a.getPart(comp, detail, "toolbar").orThunk(function() { return parts$a.getPart(comp, detail, "multiple-toolbar"); }); optToolbar.each(function(toolbar2) { Keying.focusIn(toolbar2); }); }, setMenubar: function(comp, menus) { parts$a.getPart(comp, detail, "menubar").each(function(menubar) { SilverMenubar.setMenus(menubar, menus); }); }, focusMenubar: function(comp) { parts$a.getPart(comp, detail, "menubar").each(function(menubar) { SilverMenubar.focus(menubar); }); } }; return { uid: detail.uid, dom: detail.dom, components: components4, apis, behaviours: detail.behaviours }; }; var partMenubar = partType.optional({ factory: SilverMenubar, name: "menubar", schema: [required$12("backstage")] }); var toolbarFactory = function(spec) { if (spec.type === ToolbarMode.sliding) { return renderSlidingMoreToolbar; } else if (spec.type === ToolbarMode.floating) { return renderFloatingMoreToolbar; } else { return renderToolbar; } }; var partMultipleToolbar = partType.optional({ factory: { sketch: function(spec) { return CustomList.sketch({ uid: spec.uid, dom: spec.dom, listBehaviours: derive$1([Keying.config({ mode: "acyclic", selector: ".tox-toolbar" })]), makeItem: function() { return renderToolbar({ type: spec.type, uid: generate$6("multiple-toolbar-item"), cyclicKeying: false, initGroups: [], providers: spec.providers, onEscape: function() { spec.onEscape(); return Optional.some(true); } }); }, setupItem: function(_mToolbar, tc, data65, _index) { Toolbar.setGroups(tc, data65); }, shell: true }); } }, name: "multiple-toolbar", schema: [ required$12("dom"), required$12("onEscape") ] }); var partToolbar = partType.optional({ factory: { sketch: function(spec) { var renderer = toolbarFactory(spec); var toolbarSpec = { type: spec.type, uid: spec.uid, onEscape: function() { spec.onEscape(); return Optional.some(true); }, cyclicKeying: false, initGroups: [], getSink: spec.getSink, providers: spec.providers, moreDrawerData: { lazyToolbar: spec.lazyToolbar, lazyMoreButton: spec.lazyMoreButton, lazyHeader: spec.lazyHeader }, attributes: spec.attributes }; return renderer(toolbarSpec); } }, name: "toolbar", schema: [ required$12("dom"), required$12("onEscape"), required$12("getSink") ] }); var partHeader = partType.optional({ factory: { sketch: renderHeader2 }, name: "header", schema: [required$12("dom")] }); var partSocket = partType.optional({ name: "socket", schema: [required$12("dom")] }); var partSidebar = partType.optional({ factory: { sketch: renderSidebar }, name: "sidebar", schema: [required$12("dom")] }); var partThrobber = partType.optional({ factory: { sketch: renderThrobber }, name: "throbber", schema: [required$12("dom")] }); var OuterContainer = composite({ name: "OuterContainer", factory: factory$6, configFields: [ required$12("dom"), required$12("behaviours") ], partFields: [ partHeader, partMenubar, partToolbar, partMultipleToolbar, partSocket, partSidebar, partThrobber ], apis: { getSocket: function(apis, comp) { return apis.getSocket(comp); }, setSidebar: function(apis, comp, panelConfigs) { apis.setSidebar(comp, panelConfigs); }, toggleSidebar: function(apis, comp, name2) { apis.toggleSidebar(comp, name2); }, whichSidebar: function(apis, comp) { return apis.whichSidebar(comp); }, getHeader: function(apis, comp) { return apis.getHeader(comp); }, getToolbar: function(apis, comp) { return apis.getToolbar(comp); }, setToolbar: function(apis, comp, grps) { var groups = map$2(grps, function(grp) { return renderToolbarGroup(grp); }); apis.setToolbar(comp, groups); }, setToolbars: function(apis, comp, ts) { var renderedToolbars = map$2(ts, function(g2) { return map$2(g2, renderToolbarGroup); }); apis.setToolbars(comp, renderedToolbars); }, refreshToolbar: function(apis, comp) { return apis.refreshToolbar(comp); }, toggleToolbarDrawer: function(apis, comp) { apis.toggleToolbarDrawer(comp); }, isToolbarDrawerToggled: function(apis, comp) { return apis.isToolbarDrawerToggled(comp); }, getThrobber: function(apis, comp) { return apis.getThrobber(comp); }, setMenubar: function(apis, comp, menus) { apis.setMenubar(comp, menus); }, focusMenubar: function(apis, comp) { apis.focusMenubar(comp); }, focusToolbar: function(apis, comp) { apis.focusToolbar(comp); } } }); var defaultMenubar = "file edit view insert format tools table help"; var defaultMenus = { file: { title: "File", items: "newdocument restoredraft | preview | export print | deleteallconversations" }, edit: { title: "Edit", items: "undo redo | cut copy paste pastetext | selectall | searchreplace" }, view: { title: "View", items: "code | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments" }, insert: { title: "Insert", items: "image link media addcomment pageembed template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime" }, format: { title: "Format", items: "bold italic underline strikethrough superscript subscript codeformat | formats blockformats fontformats fontsizes align lineheight | forecolor backcolor | language | removeformat" }, tools: { title: "Tools", items: "spellchecker spellcheckerlanguage | a11ycheck code wordcount" }, table: { title: "Table", items: "inserttable | cell row column | advtablesort | tableprops deletetable" }, help: { title: "Help", items: "help" } }; var make = function(menu2, registry, editor) { var removedMenuItems = getRemovedMenuItems(editor).split(/[ ,]/); return { text: menu2.title, getItems: function() { return bind$32(menu2.items, function(i2) { var itemName = i2.toLowerCase(); if (itemName.trim().length === 0) { return []; } else if (exists(removedMenuItems, function(removedMenuItem) { return removedMenuItem === itemName; })) { return []; } else if (itemName === "separator" || itemName === "|") { return [{ type: "separator" }]; } else if (registry.menuItems[itemName]) { return [registry.menuItems[itemName]]; } else { return []; } }); } }; }; var parseItemsString = function(items) { if (typeof items === "string") { return items.split(" "); } return items; }; var identifyMenus = function(editor, registry) { var rawMenuData = __assign(__assign({}, defaultMenus), registry.menus); var userDefinedMenus = keys2(registry.menus).length > 0; var menubar = registry.menubar === void 0 || registry.menubar === true ? parseItemsString(defaultMenubar) : parseItemsString(registry.menubar === false ? "" : registry.menubar); var validMenus = filter$2(menubar, function(menuName) { var isDefaultMenu = has$22(defaultMenus, menuName); if (userDefinedMenus) { return isDefaultMenu || get$e(registry.menus, menuName).exists(function(menu2) { return has$22(menu2, "items"); }); } else { return isDefaultMenu; } }); var menus = map$2(validMenus, function(menuName) { var menuData = rawMenuData[menuName]; return make({ title: menuData.title, items: parseItemsString(menuData.items) }, registry, editor); }); return filter$2(menus, function(menu2) { var isNotSeparator = function(item2) { return item2.type !== "separator"; }; return menu2.getItems().length > 0 && exists(menu2.getItems(), isNotSeparator); }); }; var fireSkinLoaded = function(editor) { var done = function() { editor._skinLoaded = true; fireSkinLoaded$1(editor); }; return function() { if (editor.initialized) { done(); } else { editor.on("init", done); } }; }; var fireSkinLoadError = function(editor, err) { return function() { return fireSkinLoadError$1(editor, { message: err }); }; }; var loadStylesheet = function(editor, stylesheetUrl, styleSheetLoader) { return new global$c(function(resolve, reject) { styleSheetLoader.load(stylesheetUrl, resolve, reject); editor.on("remove", function() { return styleSheetLoader.unload(stylesheetUrl); }); }); }; var loadUiSkins = function(editor, skinUrl) { var skinUiCss = skinUrl + "/skin.min.css"; return loadStylesheet(editor, skinUiCss, editor.ui.styleSheetLoader); }; var loadShadowDomUiSkins = function(editor, skinUrl) { var isInShadowRoot$1 = isInShadowRoot(SugarElement.fromDom(editor.getElement())); if (isInShadowRoot$1) { var shadowDomSkinCss = skinUrl + "/skin.shadowdom.min.css"; return loadStylesheet(editor, shadowDomSkinCss, global$b.DOM.styleSheetLoader); } else { return global$c.resolve(); } }; var loadSkin = function(isInline, editor) { var skinUrl = getSkinUrl(editor); if (skinUrl) { editor.contentCSS.push(skinUrl + (isInline ? "/content.inline" : "/content") + ".min.css"); } if (isSkinDisabled(editor) === false && isString3(skinUrl)) { global$c.all([ loadUiSkins(editor, skinUrl), loadShadowDomUiSkins(editor, skinUrl) ]).then(fireSkinLoaded(editor), fireSkinLoadError(editor, "Skin could not be loaded")); } else { fireSkinLoaded(editor)(); } }; var iframe = curry(loadSkin, false); var inline = curry(loadSkin, true); var onSetupFormatToggle = function(editor, name2) { return function(api3) { var boundCallback = unbindable(); var init2 = function() { api3.setActive(editor.formatter.match(name2)); var binding = editor.formatter.formatChanged(name2, api3.setActive); boundCallback.set(binding); }; editor.initialized ? init2() : editor.once("init", init2); return function() { editor.off("init", init2); boundCallback.clear(); }; }; }; var onSetupEvent = function(editor, event, f2) { return function(api3) { var handleEvent = function() { return f2(api3); }; var init2 = function() { f2(api3); editor.on(event, handleEvent); }; editor.initialized ? init2() : editor.once("init", init2); return function() { editor.off("init", init2); editor.off(event, handleEvent); }; }; }; var onActionToggleFormat$1 = function(editor) { return function(rawItem) { return function() { editor.undoManager.transact(function() { editor.focus(); editor.execCommand("mceToggleFormat", false, rawItem.format); }); }; }; }; var onActionExecCommand = function(editor, command) { return function() { return editor.execCommand(command); }; }; var generateSelectItems = function(_editor, backstage, spec) { var generateItem = function(rawItem, response, disabled, value25) { var translatedText = backstage.shared.providers.translate(rawItem.title); if (rawItem.type === "separator") { return Optional.some({ type: "separator", text: translatedText }); } else if (rawItem.type === "submenu") { var items = bind$32(rawItem.getStyleItems(), function(si) { return validate3(si, response, value25); }); if (response === 0 && items.length <= 0) { return Optional.none(); } else { return Optional.some({ type: "nestedmenuitem", text: translatedText, disabled: items.length <= 0, getSubmenuItems: function() { return bind$32(rawItem.getStyleItems(), function(si) { return validate3(si, response, value25); }); } }); } } else { return Optional.some(__assign({ type: "togglemenuitem", text: translatedText, icon: rawItem.icon, active: rawItem.isSelected(value25), disabled, onAction: spec.onAction(rawItem) }, rawItem.getStylePreview().fold(function() { return {}; }, function(preview) { return { meta: { style: preview } }; }))); } }; var validate3 = function(item2, response, value25) { var invalid = item2.type === "formatter" && spec.isInvalid(item2); if (response === 0) { return invalid ? [] : generateItem(item2, response, false, value25).toArray(); } else { return generateItem(item2, response, invalid, value25).toArray(); } }; var validateItems = function(preItems) { var value25 = spec.getCurrentValue(); var response = spec.shouldHide ? 0 : 1; return bind$32(preItems, function(item2) { return validate3(item2, response, value25); }); }; var getFetch3 = function(backstage2, getStyleItems) { return function(comp, callback2) { var preItems = getStyleItems(); var items = validateItems(preItems); var menu2 = build(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage2, false); callback2(menu2); }; }; return { validateItems, getFetch: getFetch3 }; }; var createMenuItems = function(editor, backstage, spec) { var dataset2 = spec.dataset; var getStyleItems = dataset2.type === "basic" ? function() { return map$2(dataset2.data, function(d2) { return processBasic(d2, spec.isSelectedFor, spec.getPreviewFor); }); } : dataset2.getData; return { items: generateSelectItems(editor, backstage, spec), getStyleItems }; }; var createSelectButton = function(editor, backstage, spec) { var _a4 = createMenuItems(editor, backstage, spec), items = _a4.items, getStyleItems = _a4.getStyleItems; var getApi2 = function(comp) { return { getComponent: constant$1(comp) }; }; var onSetup = onSetupEvent(editor, "NodeChange", function(api3) { var comp = api3.getComponent(); spec.updateText(comp); }); return renderCommonDropdown({ text: spec.icon.isSome() ? Optional.none() : spec.text, icon: spec.icon, tooltip: Optional.from(spec.tooltip), role: Optional.none(), fetch: items.getFetch(backstage, getStyleItems), onSetup, getApi: getApi2, columns: 1, presets: "normal", classes: spec.icon.isSome() ? [] : ["bespoke"], dropdownBehaviours: [] }, "tox-tbtn", backstage.shared); }; var process2 = function(rawFormats) { return map$2(rawFormats, function(item2) { var title = item2, format3 = item2; var values3 = item2.split("="); if (values3.length > 1) { title = values3[0]; format3 = values3[1]; } return { title, format: format3 }; }); }; var buildBasicStaticDataset = function(data65) { return { type: "basic", data: data65 }; }; var Delimiter; (function(Delimiter2) { Delimiter2[Delimiter2["SemiColon"] = 0] = "SemiColon"; Delimiter2[Delimiter2["Space"] = 1] = "Space"; })(Delimiter || (Delimiter = {})); var split2 = function(rawFormats, delimiter2) { if (delimiter2 === Delimiter.SemiColon) { return rawFormats.replace(/;$/, "").split(";"); } else { return rawFormats.split(" "); } }; var buildBasicSettingsDataset = function(editor, settingName, defaults2, delimiter2) { var rawFormats = editor.getParam(settingName, defaults2, "string"); var data65 = process2(split2(rawFormats, delimiter2)); return { type: "basic", data: data65 }; }; var alignMenuItems = [ { title: "Left", icon: "align-left", format: "alignleft", command: "JustifyLeft" }, { title: "Center", icon: "align-center", format: "aligncenter", command: "JustifyCenter" }, { title: "Right", icon: "align-right", format: "alignright", command: "JustifyRight" }, { title: "Justify", icon: "align-justify", format: "alignjustify", command: "JustifyFull" } ]; var getSpec$4 = function(editor) { var getMatchingValue = function() { return find$5(alignMenuItems, function(item2) { return editor.formatter.match(item2.format); }); }; var isSelectedFor = function(format3) { return function() { return editor.formatter.match(format3); }; }; var getPreviewFor = function(_format) { return Optional.none; }; var updateSelectMenuIcon = function(comp) { var match5 = getMatchingValue(); var alignment = match5.fold(constant$1("left"), function(item2) { return item2.title.toLowerCase(); }); emitWith(comp, updateMenuIcon, { icon: "align-" + alignment }); }; var dataset2 = buildBasicStaticDataset(alignMenuItems); var onAction = function(rawItem) { return function() { return find$5(alignMenuItems, function(item2) { return item2.format === rawItem.format; }).each(function(item2) { return editor.execCommand(item2.command); }); }; }; return { tooltip: "Align", text: Optional.none(), icon: Optional.some("align-left"), isSelectedFor, getCurrentValue: Optional.none, getPreviewFor, onAction, updateText: updateSelectMenuIcon, dataset: dataset2, shouldHide: false, isInvalid: function(item2) { return !editor.formatter.canApply(item2.format); } }; }; var createAlignSelect = function(editor, backstage) { return createSelectButton(editor, backstage, getSpec$4(editor)); }; var alignSelectMenu = function(editor, backstage) { var menuItems = createMenuItems(editor, backstage, getSpec$4(editor)); editor.ui.registry.addNestedMenuItem("align", { text: backstage.shared.providers.translate("Align"), getSubmenuItems: function() { return menuItems.items.validateItems(menuItems.getStyleItems()); } }); }; var defaultFontsFormats = "Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats"; var systemStackFonts = [ "-apple-system", "Segoe UI", "Roboto", "Helvetica Neue", "sans-serif" ]; var splitFonts = function(fontFamily) { var fonts = fontFamily.split(/\s*,\s*/); return map$2(fonts, function(font) { return font.replace(/^['"]+|['"]+$/g, ""); }); }; var isSystemFontStack = function(fontFamily) { var matchesSystemStack = function() { var fonts = splitFonts(fontFamily.toLowerCase()); return forall(systemStackFonts, function(font) { return fonts.indexOf(font.toLowerCase()) > -1; }); }; return fontFamily.indexOf("-apple-system") === 0 && matchesSystemStack(); }; var getSpec$3 = function(editor) { var systemFont = "System Font"; var getMatchingValue = function() { var getFirstFont = function(fontFamily2) { return fontFamily2 ? splitFonts(fontFamily2)[0] : ""; }; var fontFamily = editor.queryCommandValue("FontName"); var items = dataset2.data; var font = fontFamily ? fontFamily.toLowerCase() : ""; var matchOpt = find$5(items, function(item2) { var format3 = item2.format; return format3.toLowerCase() === font || getFirstFont(format3).toLowerCase() === getFirstFont(font).toLowerCase(); }).orThunk(function() { return someIf(isSystemFontStack(font), { title: systemFont, format: font }); }); return { matchOpt, font: fontFamily }; }; var isSelectedFor = function(item2) { return function(valueOpt) { return valueOpt.exists(function(value25) { return value25.format === item2; }); }; }; var getCurrentValue = function() { var matchOpt = getMatchingValue().matchOpt; return matchOpt; }; var getPreviewFor = function(item2) { return function() { return Optional.some({ tag: "div", styles: item2.indexOf("dings") === -1 ? { "font-family": item2 } : {} }); }; }; var onAction = function(rawItem) { return function() { editor.undoManager.transact(function() { editor.focus(); editor.execCommand("FontName", false, rawItem.format); }); }; }; var updateSelectMenuText = function(comp) { var _a4 = getMatchingValue(), matchOpt = _a4.matchOpt, font = _a4.font; var text2 = matchOpt.fold(constant$1(font), function(item2) { return item2.title; }); emitWith(comp, updateMenuText, { text: text2 }); }; var dataset2 = buildBasicSettingsDataset(editor, "font_formats", defaultFontsFormats, Delimiter.SemiColon); return { tooltip: "Fonts", text: Optional.some(systemFont), icon: Optional.none(), isSelectedFor, getCurrentValue, getPreviewFor, onAction, updateText: updateSelectMenuText, dataset: dataset2, shouldHide: false, isInvalid: never }; }; var createFontSelect = function(editor, backstage) { return createSelectButton(editor, backstage, getSpec$3(editor)); }; var fontSelectMenu = function(editor, backstage) { var menuItems = createMenuItems(editor, backstage, getSpec$3(editor)); editor.ui.registry.addNestedMenuItem("fontformats", { text: backstage.shared.providers.translate("Fonts"), getSubmenuItems: function() { return menuItems.items.validateItems(menuItems.getStyleItems()); } }); }; var defaultFontsizeFormats = "8pt 10pt 12pt 14pt 18pt 24pt 36pt"; var legacyFontSizes = { "8pt": "1", "10pt": "2", "12pt": "3", "14pt": "4", "18pt": "5", "24pt": "6", "36pt": "7" }; var keywordFontSizes = { "xx-small": "7pt", "x-small": "8pt", "small": "10pt", "medium": "12pt", "large": "14pt", "x-large": "18pt", "xx-large": "24pt" }; var round2 = function(number4, precision) { var factor = Math.pow(10, precision); return Math.round(number4 * factor) / factor; }; var toPt = function(fontSize, precision) { if (/[0-9.]+px$/.test(fontSize)) { return round2(parseInt(fontSize, 10) * 72 / 96, precision || 0) + "pt"; } else { return get$e(keywordFontSizes, fontSize).getOr(fontSize); } }; var toLegacy = function(fontSize) { return get$e(legacyFontSizes, fontSize).getOr(""); }; var getSpec$2 = function(editor) { var getMatchingValue = function() { var matchOpt = Optional.none(); var items = dataset2.data; var fontSize = editor.queryCommandValue("FontSize"); if (fontSize) { var _loop_1 = function(precision2) { var pt = toPt(fontSize, precision2); var legacy = toLegacy(pt); matchOpt = find$5(items, function(item2) { return item2.format === fontSize || item2.format === pt || item2.format === legacy; }); }; for (var precision = 3; matchOpt.isNone() && precision >= 0; precision--) { _loop_1(precision); } } return { matchOpt, size: fontSize }; }; var isSelectedFor = function(item2) { return function(valueOpt) { return valueOpt.exists(function(value25) { return value25.format === item2; }); }; }; var getCurrentValue = function() { var matchOpt = getMatchingValue().matchOpt; return matchOpt; }; var getPreviewFor = constant$1(Optional.none); var onAction = function(rawItem) { return function() { editor.undoManager.transact(function() { editor.focus(); editor.execCommand("FontSize", false, rawItem.format); }); }; }; var updateSelectMenuText = function(comp) { var _a4 = getMatchingValue(), matchOpt = _a4.matchOpt, size = _a4.size; var text2 = matchOpt.fold(constant$1(size), function(match5) { return match5.title; }); emitWith(comp, updateMenuText, { text: text2 }); }; var dataset2 = buildBasicSettingsDataset(editor, "fontsize_formats", defaultFontsizeFormats, Delimiter.Space); return { tooltip: "Font sizes", text: Optional.some("12pt"), icon: Optional.none(), isSelectedFor, getPreviewFor, getCurrentValue, onAction, updateText: updateSelectMenuText, dataset: dataset2, shouldHide: false, isInvalid: never }; }; var createFontsizeSelect = function(editor, backstage) { return createSelectButton(editor, backstage, getSpec$2(editor)); }; var fontsizeSelectMenu = function(editor, backstage) { var menuItems = createMenuItems(editor, backstage, getSpec$2(editor)); editor.ui.registry.addNestedMenuItem("fontsizes", { text: "Font sizes", getSubmenuItems: function() { return menuItems.items.validateItems(menuItems.getStyleItems()); } }); }; var findNearest = function(editor, getStyles) { var styles = getStyles(); var formats2 = map$2(styles, function(style) { return style.format; }); return Optional.from(editor.formatter.closest(formats2)).bind(function(fmt) { return find$5(styles, function(data65) { return data65.format === fmt; }); }).orThunk(function() { return someIf(editor.formatter.match("p"), { title: "Paragraph", format: "p" }); }); }; var defaultBlocks = "Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre"; var getSpec$1 = function(editor) { var fallbackFormat = "Paragraph"; var isSelectedFor = function(format3) { return function() { return editor.formatter.match(format3); }; }; var getPreviewFor = function(format3) { return function() { var fmt = editor.formatter.get(format3); return Optional.some({ tag: fmt.length > 0 ? fmt[0].inline || fmt[0].block || "div" : "div", styles: editor.dom.parseStyle(editor.formatter.getCssText(format3)) }); }; }; var updateSelectMenuText = function(comp) { var detectedFormat = findNearest(editor, function() { return dataset2.data; }); var text2 = detectedFormat.fold(constant$1(fallbackFormat), function(fmt) { return fmt.title; }); emitWith(comp, updateMenuText, { text: text2 }); }; var dataset2 = buildBasicSettingsDataset(editor, "block_formats", defaultBlocks, Delimiter.SemiColon); return { tooltip: "Blocks", text: Optional.some(fallbackFormat), icon: Optional.none(), isSelectedFor, getCurrentValue: Optional.none, getPreviewFor, onAction: onActionToggleFormat$1(editor), updateText: updateSelectMenuText, dataset: dataset2, shouldHide: false, isInvalid: function(item2) { return !editor.formatter.canApply(item2.format); } }; }; var createFormatSelect = function(editor, backstage) { return createSelectButton(editor, backstage, getSpec$1(editor)); }; var formatSelectMenu = function(editor, backstage) { var menuItems = createMenuItems(editor, backstage, getSpec$1(editor)); editor.ui.registry.addNestedMenuItem("blockformats", { text: "Blocks", getSubmenuItems: function() { return menuItems.items.validateItems(menuItems.getStyleItems()); } }); }; var getSpec = function(editor, dataset2) { var fallbackFormat = "Paragraph"; var isSelectedFor = function(format3) { return function() { return editor.formatter.match(format3); }; }; var getPreviewFor = function(format3) { return function() { var fmt = editor.formatter.get(format3); return fmt !== void 0 ? Optional.some({ tag: fmt.length > 0 ? fmt[0].inline || fmt[0].block || "div" : "div", styles: editor.dom.parseStyle(editor.formatter.getCssText(format3)) }) : Optional.none(); }; }; var updateSelectMenuText = function(comp) { var getFormatItems = function(fmt) { var subs2 = fmt.items; return subs2 !== void 0 && subs2.length > 0 ? bind$32(subs2, getFormatItems) : [{ title: fmt.title, format: fmt.format }]; }; var flattenedItems = bind$32(getStyleFormats(editor), getFormatItems); var detectedFormat = findNearest(editor, constant$1(flattenedItems)); var text2 = detectedFormat.fold(constant$1(fallbackFormat), function(fmt) { return fmt.title; }); emitWith(comp, updateMenuText, { text: text2 }); }; return { tooltip: "Formats", text: Optional.some(fallbackFormat), icon: Optional.none(), isSelectedFor, getCurrentValue: Optional.none, getPreviewFor, onAction: onActionToggleFormat$1(editor), updateText: updateSelectMenuText, shouldHide: editor.getParam("style_formats_autohide", false, "boolean"), isInvalid: function(item2) { return !editor.formatter.canApply(item2.format); }, dataset: dataset2 }; }; var createStyleSelect = function(editor, backstage) { var dataset2 = __assign({ type: "advanced" }, backstage.styleselect); return createSelectButton(editor, backstage, getSpec(editor, dataset2)); }; var styleSelectMenu = function(editor, backstage) { var dataset2 = __assign({ type: "advanced" }, backstage.styleselect); var menuItems = createMenuItems(editor, backstage, getSpec(editor, dataset2)); editor.ui.registry.addNestedMenuItem("formats", { text: "Formats", getSubmenuItems: function() { return menuItems.items.validateItems(menuItems.getStyleItems()); } }); }; var events$3 = function(reflectingConfig, reflectingState) { var update = function(component, data65) { reflectingConfig.updateState.each(function(updateState) { var newState = updateState(component, data65); reflectingState.set(newState); }); reflectingConfig.renderComponents.each(function(renderComponents2) { var newComponents = renderComponents2(data65, reflectingState.get()); var newChildren = map$2(newComponents, component.getSystem().build); replaceChildren(component, newChildren); }); }; return derive$2([ run$1(receive(), function(component, message2) { var receivingData = message2; if (!receivingData.universal) { var channel = reflectingConfig.channel; if (contains$2(receivingData.channels, channel)) { update(component, receivingData.data); } } }), runOnAttached(function(comp, _se) { reflectingConfig.initialData.each(function(rawData) { update(comp, rawData); }); }) ]); }; var ActiveReflecting = /* @__PURE__ */ Object.freeze({ __proto__: null, events: events$3 }); var getState = function(component, replaceConfig, reflectState) { return reflectState; }; var ReflectingApis = /* @__PURE__ */ Object.freeze({ __proto__: null, getState }); var ReflectingSchema = [ required$12("channel"), option("renderComponents"), option("updateState"), option("initialData") ]; var init$3 = function() { var cell = Cell3(Optional.none()); var clear3 = function() { return cell.set(Optional.none()); }; var readState = function() { return cell.get().getOr("none"); }; return { readState, get: cell.get, set: cell.set, clear: clear3 }; }; var ReflectingState = /* @__PURE__ */ Object.freeze({ __proto__: null, init: init$3 }); var Reflecting = create$8({ fields: ReflectingSchema, name: "reflecting", active: ActiveReflecting, apis: ReflectingApis, state: ReflectingState }); var schema$7 = constant$1([ required$12("toggleClass"), required$12("fetch"), onStrictHandler("onExecute"), defaulted("getHotspot", Optional.some), defaulted("getAnchorOverrides", constant$1({})), schema$y(), onStrictHandler("onItemExecute"), option("lazySink"), required$12("dom"), onHandler("onOpen"), field("splitDropdownBehaviours", [ Coupling, Keying, Focusing ]), defaulted("matchWidth", false), defaulted("useMinWidth", false), defaulted("eventOrder", {}), option("role") ].concat(sandboxFields())); var arrowPart = required2({ factory: Button2, schema: [required$12("dom")], name: "arrow", defaults: function() { return { buttonBehaviours: derive$1([Focusing.revoke()]) }; }, overrides: function(detail) { return { dom: { tag: "span", attributes: { role: "presentation" } }, action: function(arrow) { arrow.getSystem().getByUid(detail.uid).each(emitExecute); }, buttonBehaviours: derive$1([Toggling.config({ toggleOnExecute: false, toggleClass: detail.toggleClass })]) }; } }); var buttonPart = required2({ factory: Button2, schema: [required$12("dom")], name: "button", defaults: function() { return { buttonBehaviours: derive$1([Focusing.revoke()]) }; }, overrides: function(detail) { return { dom: { tag: "span", attributes: { role: "presentation" } }, action: function(btn) { btn.getSystem().getByUid(detail.uid).each(function(splitDropdown) { detail.onExecute(splitDropdown, btn); }); } }; } }); var parts$3 = constant$1([ arrowPart, buttonPart, optional({ factory: { sketch: function(spec) { return { uid: spec.uid, dom: { tag: "span", styles: { display: "none" }, attributes: { "aria-hidden": "true" }, innerHtml: spec.text } }; } }, schema: [required$12("text")], name: "aria-descriptor" }), external$1({ schema: [tieredMenuMarkers()], name: "menu", defaults: function(detail) { return { onExecute: function(tmenu, item2) { tmenu.getSystem().getByUid(detail.uid).each(function(splitDropdown) { detail.onItemExecute(splitDropdown, tmenu, item2); }); } }; } }), partType$1() ]); var factory$5 = function(detail, components4, spec, externals) { var _a4; var switchToMenu = function(sandbox) { Composing.getCurrent(sandbox).each(function(current2) { Highlighting.highlightFirst(current2); Keying.focusIn(current2); }); }; var action = function(component) { var onOpenSync = switchToMenu; togglePopup(detail, identity$1, component, externals, onOpenSync, HighlightOnOpen.HighlightFirst).get(noop2); }; var openMenu = function(comp) { action(comp); return Optional.some(true); }; var executeOnButton = function(comp) { var button2 = getPartOrDie(comp, detail, "button"); emitExecute(button2); return Optional.some(true); }; var buttonEvents = __assign(__assign({}, derive$2([runOnAttached(function(component, _simulatedEvent) { var ariaDescriptor = getPart(component, detail, "aria-descriptor"); ariaDescriptor.each(function(descriptor) { var descriptorId = generate$6("aria"); set$8(descriptor.element, "id", descriptorId); set$8(component.element, "aria-describedby", descriptorId); }); })])), events$a(Optional.some(action))); var apis = { repositionMenus: function(comp) { if (Toggling.isOn(comp)) { repositionMenus(comp); } } }; return { uid: detail.uid, dom: detail.dom, components: components4, apis, eventOrder: __assign(__assign({}, detail.eventOrder), (_a4 = {}, _a4[execute$5()] = [ "disabling", "toggling", "alloy.base.behaviour" ], _a4)), events: buttonEvents, behaviours: augment(detail.splitDropdownBehaviours, [ Coupling.config({ others: { sandbox: function(hotspot) { var arrow = getPartOrDie(hotspot, detail, "arrow"); var extras = { onOpen: function() { Toggling.on(arrow); Toggling.on(hotspot); }, onClose: function() { Toggling.off(arrow); Toggling.off(hotspot); } }; return makeSandbox$1(detail, hotspot, extras); } } }), Keying.config({ mode: "special", onSpace: executeOnButton, onEnter: executeOnButton, onDown: openMenu }), Focusing.config({}), Toggling.config({ toggleOnExecute: false, aria: { mode: "expanded" } }) ]), domModification: { attributes: { "role": detail.role.getOr("button"), "aria-haspopup": true } } }; }; var SplitDropdown = composite({ name: "SplitDropdown", configFields: schema$7(), partFields: parts$3(), factory: factory$5, apis: { repositionMenus: function(apis, comp) { return apis.repositionMenus(comp); } } }); var getButtonApi = function(component) { return { isDisabled: function() { return Disabling.isDisabled(component); }, setDisabled: function(state) { return Disabling.set(component, state); } }; }; var getToggleApi = function(component) { return { setActive: function(state) { Toggling.set(component, state); }, isActive: function() { return Toggling.isOn(component); }, isDisabled: function() { return Disabling.isDisabled(component); }, setDisabled: function(state) { return Disabling.set(component, state); } }; }; var getTooltipAttributes = function(tooltip, providersBackstage) { return tooltip.map(function(tooltip2) { return { "aria-label": providersBackstage.translate(tooltip2), "title": providersBackstage.translate(tooltip2) }; }).getOr({}); }; var focusButtonEvent = generate$6("focus-button"); var renderCommonStructure = function(icon, text2, tooltip, receiver, behaviours2, providersBackstage) { var _d; return { dom: { tag: "button", classes: ["tox-tbtn"].concat(text2.isSome() ? ["tox-tbtn--select"] : []), attributes: getTooltipAttributes(tooltip, providersBackstage) }, components: componentRenderPipeline([ icon.map(function(iconName) { return renderIconFromPack(iconName, providersBackstage.icons); }), text2.map(function(text3) { return renderLabel$1(text3, "tox-tbtn", providersBackstage); }) ]), eventOrder: (_d = {}, _d[mousedown()] = [ "focusing", "alloy.base.behaviour", "common-button-display-events" ], _d), buttonBehaviours: derive$1([ DisablingConfigs.toolbarButton(providersBackstage.isDisabled), receivingConfig(), config3("common-button-display-events", [run$1(mousedown(), function(button2, se) { se.event.prevent(); emit2(button2, focusButtonEvent); })]) ].concat(receiver.map(function(r3) { return Reflecting.config({ channel: r3, initialData: { icon, text: text2 }, renderComponents: function(data65, _state) { return componentRenderPipeline([ data65.icon.map(function(iconName) { return renderIconFromPack(iconName, providersBackstage.icons); }), data65.text.map(function(text3) { return renderLabel$1(text3, "tox-tbtn", providersBackstage); }) ]); } }); }).toArray()).concat(behaviours2.getOr([]))) }; }; var renderFloatingToolbarButton = function(spec, backstage, identifyButtons2, attributes2) { var sharedBackstage = backstage.shared; return FloatingToolbarButton.sketch({ lazySink: sharedBackstage.getSink, fetch: function() { return Future.nu(function(resolve) { resolve(map$2(identifyButtons2(spec.items), renderToolbarGroup)); }); }, markers: { toggledClass: "tox-tbtn--enabled" }, parts: { button: renderCommonStructure(spec.icon, spec.text, spec.tooltip, Optional.none(), Optional.none(), sharedBackstage.providers), toolbar: { dom: { tag: "div", classes: ["tox-toolbar__overflow"], attributes: attributes2 } } } }); }; var renderCommonToolbarButton = function(spec, specialisation, providersBackstage) { var editorOffCell = Cell3(noop2); var structure = renderCommonStructure(spec.icon, spec.text, spec.tooltip, Optional.none(), Optional.none(), providersBackstage); return Button2.sketch({ dom: structure.dom, components: structure.components, eventOrder: toolbarButtonEventOrder, buttonBehaviours: derive$1([ config3("toolbar-button-events", [ onToolbarButtonExecute({ onAction: spec.onAction, getApi: specialisation.getApi }), onControlAttached(specialisation, editorOffCell), onControlDetached(specialisation, editorOffCell) ]), DisablingConfigs.toolbarButton(function() { return spec.disabled || providersBackstage.isDisabled(); }), receivingConfig() ].concat(specialisation.toolbarButtonBehaviours)) }); }; var renderToolbarButton = function(spec, providersBackstage) { return renderToolbarButtonWith(spec, providersBackstage, []); }; var renderToolbarButtonWith = function(spec, providersBackstage, bonusEvents) { return renderCommonToolbarButton(spec, { toolbarButtonBehaviours: [].concat(bonusEvents.length > 0 ? [config3("toolbarButtonWith", bonusEvents)] : []), getApi: getButtonApi, onSetup: spec.onSetup }, providersBackstage); }; var renderToolbarToggleButton = function(spec, providersBackstage) { return renderToolbarToggleButtonWith(spec, providersBackstage, []); }; var renderToolbarToggleButtonWith = function(spec, providersBackstage, bonusEvents) { return deepMerge2(renderCommonToolbarButton(spec, { toolbarButtonBehaviours: [ Replacing.config({}), Toggling.config({ toggleClass: "tox-tbtn--enabled", aria: { mode: "pressed" }, toggleOnExecute: false }) ].concat(bonusEvents.length > 0 ? [config3("toolbarToggleButtonWith", bonusEvents)] : []), getApi: getToggleApi, onSetup: spec.onSetup }, providersBackstage)); }; var fetchChoices = function(getApi2, spec, providersBackstage) { return function(comp) { return Future.nu(function(callback2) { return spec.fetch(callback2); }).map(function(items) { return Optional.from(createTieredDataFrom(deepMerge2(createPartialChoiceMenu(generate$6("menu-value"), items, function(value25) { spec.onItemAction(getApi2(comp), value25); }, spec.columns, spec.presets, ItemResponse$1.CLOSE_ON_EXECUTE, spec.select.getOr(never), providersBackstage), { movement: deriveMenuMovement(spec.columns, spec.presets), menuBehaviours: SimpleBehaviours.unnamedEvents(spec.columns !== "auto" ? [] : [runOnAttached(function(comp2, _se) { detectSize(comp2, 4, classForPreset(spec.presets)).each(function(_d) { var numRows = _d.numRows, numColumns = _d.numColumns; Keying.setGridSize(comp2, numRows, numColumns); }); })]) }))); }); }; }; var renderSplitButton = function(spec, sharedBackstage) { var _d; var displayChannel = generate$6("channel-update-split-dropdown-display"); var getApi2 = function(comp) { return { isDisabled: function() { return Disabling.isDisabled(comp); }, setDisabled: function(state) { return Disabling.set(comp, state); }, setIconFill: function(id2, value25) { descendant(comp.element, 'svg path[id="' + id2 + '"], rect[id="' + id2 + '"]').each(function(underlinePath) { set$8(underlinePath, "fill", value25); }); }, setIconStroke: function(id2, value25) { descendant(comp.element, 'svg path[id="' + id2 + '"], rect[id="' + id2 + '"]').each(function(underlinePath) { set$8(underlinePath, "stroke", value25); }); }, setActive: function(state) { set$8(comp.element, "aria-pressed", state); descendant(comp.element, "span").each(function(button2) { comp.getSystem().getByDom(button2).each(function(buttonComp) { return Toggling.set(buttonComp, state); }); }); }, isActive: function() { return descendant(comp.element, "span").exists(function(button2) { return comp.getSystem().getByDom(button2).exists(Toggling.isOn); }); } }; }; var editorOffCell = Cell3(noop2); var specialisation = { getApi: getApi2, onSetup: spec.onSetup }; return SplitDropdown.sketch({ dom: { tag: "div", classes: ["tox-split-button"], attributes: __assign({ "aria-pressed": false }, getTooltipAttributes(spec.tooltip, sharedBackstage.providers)) }, onExecute: function(button2) { spec.onAction(getApi2(button2)); }, onItemExecute: function(_a4, _b2, _c) { }, splitDropdownBehaviours: derive$1([ DisablingConfigs.splitButton(sharedBackstage.providers.isDisabled), receivingConfig(), config3("split-dropdown-events", [ run$1(focusButtonEvent, Focusing.focus), onControlAttached(specialisation, editorOffCell), onControlDetached(specialisation, editorOffCell) ]), Unselecting.config({}) ]), eventOrder: (_d = {}, _d[attachedToDom()] = [ "alloy.base.behaviour", "split-dropdown-events" ], _d), toggleClass: "tox-tbtn--enabled", lazySink: sharedBackstage.getSink, fetch: fetchChoices(getApi2, spec, sharedBackstage.providers), parts: { menu: part(false, spec.columns, spec.presets) }, components: [ SplitDropdown.parts.button(renderCommonStructure(spec.icon, spec.text, Optional.none(), Optional.some(displayChannel), Optional.some([Toggling.config({ toggleClass: "tox-tbtn--enabled", toggleOnExecute: false })]), sharedBackstage.providers)), SplitDropdown.parts.arrow({ dom: { tag: "button", classes: [ "tox-tbtn", "tox-split-button__chevron" ], innerHtml: get$12("chevron-down", sharedBackstage.providers.icons) }, buttonBehaviours: derive$1([ DisablingConfigs.splitButton(sharedBackstage.providers.isDisabled), receivingConfig(), addFocusableBehaviour() ]) }), SplitDropdown.parts["aria-descriptor"]({ text: sharedBackstage.providers.translate("To open the popup, press Shift+Enter") }) ] }); }; var defaultToolbar = [ { name: "history", items: [ "undo", "redo" ] }, { name: "styles", items: ["styleselect"] }, { name: "formatting", items: [ "bold", "italic" ] }, { name: "alignment", items: [ "alignleft", "aligncenter", "alignright", "alignjustify" ] }, { name: "indentation", items: [ "outdent", "indent" ] }, { name: "permanent pen", items: ["permanentpen"] }, { name: "comments", items: ["addcomment"] } ]; var renderFromBridge = function(bridgeBuilder, render124) { return function(spec, extras, editor) { var internal2 = bridgeBuilder(spec).mapError(function(errInfo) { return formatError(errInfo); }).getOrDie(); return render124(internal2, extras, editor); }; }; var types2 = { button: renderFromBridge(createToolbarButton, function(s2, extras) { return renderToolbarButton(s2, extras.backstage.shared.providers); }), togglebutton: renderFromBridge(createToggleButton, function(s2, extras) { return renderToolbarToggleButton(s2, extras.backstage.shared.providers); }), menubutton: renderFromBridge(createMenuButton, function(s2, extras) { return renderMenuButton(s2, "tox-tbtn", extras.backstage, Optional.none()); }), splitbutton: renderFromBridge(createSplitButton, function(s2, extras) { return renderSplitButton(s2, extras.backstage.shared); }), grouptoolbarbutton: renderFromBridge(createGroupToolbarButton, function(s2, extras, editor) { var _a4; var buttons = editor.ui.registry.getAll().buttons; var identify = function(toolbar2) { return identifyButtons(editor, { buttons, toolbar: toolbar2, allowToolbarGroups: false }, extras, Optional.none()); }; var attributes2 = (_a4 = {}, _a4[Attribute] = extras.backstage.shared.header.isPositionedAtTop() ? AttributeValue.TopToBottom : AttributeValue.BottomToTop, _a4); switch (getToolbarMode(editor)) { case ToolbarMode.floating: return renderFloatingToolbarButton(s2, extras.backstage, identify, attributes2); default: throw new Error("Toolbar groups are only supported when using floating toolbar mode"); } }), styleSelectButton: function(editor, extras) { return createStyleSelect(editor, extras.backstage); }, fontsizeSelectButton: function(editor, extras) { return createFontsizeSelect(editor, extras.backstage); }, fontSelectButton: function(editor, extras) { return createFontSelect(editor, extras.backstage); }, formatButton: function(editor, extras) { return createFormatSelect(editor, extras.backstage); }, alignMenuButton: function(editor, extras) { return createAlignSelect(editor, extras.backstage); } }; var extractFrom = function(spec, extras, editor) { return get$e(types2, spec.type).fold(function() { console.error("skipping button defined by", spec); return Optional.none(); }, function(render124) { return Optional.some(render124(spec, extras, editor)); }); }; var bespokeButtons = { styleselect: types2.styleSelectButton, fontsizeselect: types2.fontsizeSelectButton, fontselect: types2.fontSelectButton, formatselect: types2.formatButton, align: types2.alignMenuButton }; var removeUnusedDefaults = function(buttons) { var filteredItemGroups = map$2(defaultToolbar, function(group2) { var items = filter$2(group2.items, function(subItem) { return has$22(buttons, subItem) || has$22(bespokeButtons, subItem); }); return { name: group2.name, items }; }); return filter$2(filteredItemGroups, function(group2) { return group2.items.length > 0; }); }; var convertStringToolbar = function(strToolbar) { var groupsStrings = strToolbar.split("|"); return map$2(groupsStrings, function(g2) { return { items: g2.trim().split(" ") }; }); }; var isToolbarGroupSettingArray = function(toolbar2) { return isArrayOf(toolbar2, function(t3) { return has$22(t3, "name") && has$22(t3, "items"); }); }; var createToolbar = function(toolbarConfig) { var toolbar2 = toolbarConfig.toolbar; var buttons = toolbarConfig.buttons; if (toolbar2 === false) { return []; } else if (toolbar2 === void 0 || toolbar2 === true) { return removeUnusedDefaults(buttons); } else if (isString3(toolbar2)) { return convertStringToolbar(toolbar2); } else if (isToolbarGroupSettingArray(toolbar2)) { return toolbar2; } else { console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"); return []; } }; var lookupButton = function(editor, buttons, toolbarItem, allowToolbarGroups, extras, prefixes2) { return get$e(buttons, toolbarItem.toLowerCase()).orThunk(function() { return prefixes2.bind(function(ps) { return findMap(ps, function(prefix2) { return get$e(buttons, prefix2 + toolbarItem.toLowerCase()); }); }); }).fold(function() { return get$e(bespokeButtons, toolbarItem.toLowerCase()).map(function(r3) { return r3(editor, extras); }).orThunk(function() { return Optional.none(); }); }, function(spec) { if (spec.type === "grouptoolbarbutton" && !allowToolbarGroups) { console.warn("Ignoring the '" + toolbarItem + "' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested."); return Optional.none(); } else { return extractFrom(spec, extras, editor); } }); }; var identifyButtons = function(editor, toolbarConfig, extras, prefixes2) { var toolbarGroups = createToolbar(toolbarConfig); var groups = map$2(toolbarGroups, function(group2) { var items = bind$32(group2.items, function(toolbarItem) { return toolbarItem.trim().length === 0 ? [] : lookupButton(editor, toolbarConfig.buttons, toolbarItem, toolbarConfig.allowToolbarGroups, extras, prefixes2).toArray(); }); return { title: Optional.from(editor.translate(group2.name)), items }; }); return filter$2(groups, function(group2) { return group2.items.length > 0; }); }; var setToolbar = function(editor, uiComponents, rawUiConfig, backstage) { var comp = uiComponents.outerContainer; var toolbarConfig = rawUiConfig.toolbar; var toolbarButtonsConfig = rawUiConfig.buttons; if (isArrayOf(toolbarConfig, isString3)) { var toolbars = toolbarConfig.map(function(t3) { var config4 = { toolbar: t3, buttons: toolbarButtonsConfig, allowToolbarGroups: rawUiConfig.allowToolbarGroups }; return identifyButtons(editor, config4, { backstage }, Optional.none()); }); OuterContainer.setToolbars(comp, toolbars); } else { OuterContainer.setToolbar(comp, identifyButtons(editor, rawUiConfig, { backstage }, Optional.none())); } }; var detection = detect$1(); var isiOS12 = detection.os.isiOS() && detection.os.version.major <= 12; var setupEvents$1 = function(editor, uiComponents) { var dom2 = editor.dom; var contentWindow = editor.getWin(); var initialDocEle = editor.getDoc().documentElement; var lastWindowDimensions = Cell3(SugarPosition(contentWindow.innerWidth, contentWindow.innerHeight)); var lastDocumentDimensions = Cell3(SugarPosition(initialDocEle.offsetWidth, initialDocEle.offsetHeight)); var resizeWindow = function() { var outer = lastWindowDimensions.get(); if (outer.left !== contentWindow.innerWidth || outer.top !== contentWindow.innerHeight) { lastWindowDimensions.set(SugarPosition(contentWindow.innerWidth, contentWindow.innerHeight)); fireResizeContent(editor); } }; var resizeDocument = function() { var docEle = editor.getDoc().documentElement; var inner = lastDocumentDimensions.get(); if (inner.left !== docEle.offsetWidth || inner.top !== docEle.offsetHeight) { lastDocumentDimensions.set(SugarPosition(docEle.offsetWidth, docEle.offsetHeight)); fireResizeContent(editor); } }; var scroll = function(e2) { return fireScrollContent(editor, e2); }; dom2.bind(contentWindow, "resize", resizeWindow); dom2.bind(contentWindow, "scroll", scroll); var elementLoad = capture(SugarElement.fromDom(editor.getBody()), "load", resizeDocument); var mothership = uiComponents.uiMothership.element; editor.on("hide", function() { set$7(mothership, "display", "none"); }); editor.on("show", function() { remove$6(mothership, "display"); }); editor.on("NodeChange", resizeDocument); editor.on("remove", function() { elementLoad.unbind(); dom2.unbind(contentWindow, "resize", resizeWindow); dom2.unbind(contentWindow, "scroll", scroll); contentWindow = null; }); }; var render$1 = function(editor, uiComponents, rawUiConfig, backstage, args) { var lastToolbarWidth = Cell3(0); var outerContainer = uiComponents.outerContainer; iframe(editor); var eTargetNode = SugarElement.fromDom(args.targetNode); var uiRoot = getContentContainer(getRootNode(eTargetNode)); attachSystemAfter(eTargetNode, uiComponents.mothership); attachSystem(uiRoot, uiComponents.uiMothership); editor.on("PostRender", function() { setToolbar(editor, uiComponents, rawUiConfig, backstage); lastToolbarWidth.set(editor.getWin().innerWidth); OuterContainer.setMenubar(outerContainer, identifyMenus(editor, rawUiConfig)); OuterContainer.setSidebar(outerContainer, rawUiConfig.sidebar); setupEvents$1(editor, uiComponents); }); var socket = OuterContainer.getSocket(outerContainer).getOrDie("Could not find expected socket element"); if (isiOS12) { setAll(socket.element, { "overflow": "scroll", "-webkit-overflow-scrolling": "touch" }); var limit = first(function() { editor.fire("ScrollContent"); }, 20); var unbinder = bind4(socket.element, "scroll", limit.throttle); editor.on("remove", unbinder.unbind); } setupReadonlyModeSwitch(editor, uiComponents); editor.addCommand("ToggleSidebar", function(_ui, value25) { OuterContainer.toggleSidebar(outerContainer, value25); editor.fire("ToggleSidebar"); }); editor.addQueryValueHandler("ToggleSidebar", function() { return OuterContainer.whichSidebar(outerContainer); }); var toolbarMode = getToolbarMode(editor); var refreshDrawer = function() { OuterContainer.refreshToolbar(uiComponents.outerContainer); }; if (toolbarMode === ToolbarMode.sliding || toolbarMode === ToolbarMode.floating) { editor.on("ResizeWindow ResizeEditor ResizeContent", function() { var width2 = editor.getWin().innerWidth; if (width2 !== lastToolbarWidth.get()) { refreshDrawer(); lastToolbarWidth.set(width2); } }); } var api3 = { enable: function() { broadcastReadonly(uiComponents, false); }, disable: function() { broadcastReadonly(uiComponents, true); }, isDisabled: function() { return Disabling.isDisabled(outerContainer); } }; return { iframeContainer: socket.element.dom, editorContainer: outerContainer.element.dom, api: api3 }; }; var Iframe = /* @__PURE__ */ Object.freeze({ __proto__: null, render: render$1 }); var parseToInt = function(val) { var re2 = /^[0-9\.]+(|px)$/i; if (re2.test("" + val)) { return Optional.some(parseInt("" + val, 10)); } return Optional.none(); }; var numToPx = function(val) { return isNumber2(val) ? val + "px" : val; }; var calcCappedSize = function(size, minSize, maxSize) { var minOverride = minSize.filter(function(min5) { return size < min5; }); var maxOverride = maxSize.filter(function(max5) { return size > max5; }); return minOverride.or(maxOverride).getOr(size); }; var getHeight = function(editor) { var baseHeight = getHeightSetting(editor); var minHeight = getMinHeightSetting(editor); var maxHeight = getMaxHeightSetting(editor); return parseToInt(baseHeight).map(function(height2) { return calcCappedSize(height2, minHeight, maxHeight); }); }; var getHeightWithFallback = function(editor) { var height2 = getHeight(editor); return height2.getOr(getHeightSetting(editor)); }; var getWidth = function(editor) { var baseWidth = getWidthSetting(editor); var minWidth = getMinWidthSetting(editor); var maxWidth = getMaxWidthSetting(editor); return parseToInt(baseWidth).map(function(width2) { return calcCappedSize(width2, minWidth, maxWidth); }); }; var getWidthWithFallback = function(editor) { var width2 = getWidth(editor); return width2.getOr(getWidthSetting(editor)); }; var InlineHeader = function(editor, targetElm, uiComponents, backstage, floatContainer) { var uiMothership = uiComponents.uiMothership, outerContainer = uiComponents.outerContainer; var DOM = global$b.DOM; var useFixedToolbarContainer = useFixedContainer(editor); var isSticky = isStickyToolbar(editor); var editorMaxWidthOpt = getMaxWidthSetting(editor).or(getWidth(editor)); var headerBackstage = backstage.shared.header; var isPositionedAtTop = headerBackstage.isPositionedAtTop; var toolbarMode = getToolbarMode(editor); var isSplitToolbar = toolbarMode === ToolbarMode.sliding || toolbarMode === ToolbarMode.floating; var visible9 = Cell3(false); var isVisible3 = function() { return visible9.get() && !editor.removed; }; var calcToolbarOffset = function(toolbar2) { return isSplitToolbar ? toolbar2.fold(constant$1(0), function(tbar) { return tbar.components().length > 1 ? get$b(tbar.components()[1].element) : 0; }) : 0; }; var calcMode = function(container) { switch (getToolbarLocation(editor)) { case ToolbarLocation.auto: var toolbar_1 = OuterContainer.getToolbar(outerContainer); var offset5 = calcToolbarOffset(toolbar_1); var toolbarHeight = get$b(container.element) - offset5; var targetBounds = box$1(targetElm); var roomAtTop = targetBounds.y > toolbarHeight; if (roomAtTop) { return "top"; } else { var doc = documentElement(targetElm); var docHeight = Math.max(doc.dom.scrollHeight, get$b(doc)); var roomAtBottom = targetBounds.bottom < docHeight - toolbarHeight; if (roomAtBottom) { return "bottom"; } else { var winBounds = win(); var isRoomAtBottomViewport = winBounds.bottom < targetBounds.bottom - toolbarHeight; return isRoomAtBottomViewport ? "bottom" : "top"; } } case ToolbarLocation.bottom: return "bottom"; case ToolbarLocation.top: default: return "top"; } }; var setupMode = function(mode3) { var container = floatContainer.get(); Docking.setModes(container, [mode3]); headerBackstage.setDockingMode(mode3); var verticalDir = isPositionedAtTop() ? AttributeValue.TopToBottom : AttributeValue.BottomToTop; set$8(container.element, Attribute, verticalDir); }; var updateChromeWidth = function() { var maxWidth = editorMaxWidthOpt.getOrThunk(function() { var bodyMargin = parseToInt(get$c(body(), "margin-left")).getOr(0); return get$a(body()) - absolute$3(targetElm).left + bodyMargin; }); set$7(floatContainer.get().element, "max-width", maxWidth + "px"); }; var updateChromePosition = function() { var toolbar2 = OuterContainer.getToolbar(outerContainer); var offset5 = calcToolbarOffset(toolbar2); var targetBounds = box$1(targetElm); var top2 = isPositionedAtTop() ? Math.max(targetBounds.y - get$b(floatContainer.get().element) + offset5, 0) : targetBounds.bottom; setAll(outerContainer.element, { position: "absolute", top: Math.round(top2) + "px", left: Math.round(targetBounds.x) + "px" }); }; var repositionPopups$1 = function() { uiMothership.broadcastOn([repositionPopups()], {}); }; var updateChromeUi = function(resetDocking) { if (resetDocking === void 0) { resetDocking = false; } if (!isVisible3()) { return; } if (!useFixedToolbarContainer) { updateChromeWidth(); } if (isSplitToolbar) { OuterContainer.refreshToolbar(outerContainer); } if (!useFixedToolbarContainer) { updateChromePosition(); } if (isSticky) { var floatContainerComp = floatContainer.get(); resetDocking ? Docking.reset(floatContainerComp) : Docking.refresh(floatContainerComp); } repositionPopups$1(); }; var updateMode = function(updateUi) { if (updateUi === void 0) { updateUi = true; } if (useFixedToolbarContainer || !isSticky || !isVisible3()) { return; } var currentMode = headerBackstage.getDockingMode(); var newMode = calcMode(floatContainer.get()); if (newMode !== currentMode) { setupMode(newMode); if (updateUi) { updateChromeUi(true); } } }; var show2 = function() { visible9.set(true); set$7(outerContainer.element, "display", "flex"); DOM.addClass(editor.getBody(), "mce-edit-focus"); remove$6(uiMothership.element, "display"); updateMode(false); updateChromeUi(); }; var hide = function() { visible9.set(false); if (uiComponents.outerContainer) { set$7(outerContainer.element, "display", "none"); DOM.removeClass(editor.getBody(), "mce-edit-focus"); } set$7(uiMothership.element, "display", "none"); }; return { isVisible: isVisible3, isPositionedAtTop, show: show2, hide, update: updateChromeUi, updateMode, repositionPopups: repositionPopups$1 }; }; var getTargetPosAndBounds = function(targetElm, isToolbarTop) { var bounds2 = box$1(targetElm); return { pos: isToolbarTop ? bounds2.y : bounds2.bottom, bounds: bounds2 }; }; var setupEvents = function(editor, targetElm, ui, toolbarPersist) { var prevPosAndBounds = Cell3(getTargetPosAndBounds(targetElm, ui.isPositionedAtTop())); var resizeContent = function(e2) { var _a4 = getTargetPosAndBounds(targetElm, ui.isPositionedAtTop()), pos = _a4.pos, bounds2 = _a4.bounds; var _b2 = prevPosAndBounds.get(), prevPos = _b2.pos, prevBounds = _b2.bounds; var hasResized = bounds2.height !== prevBounds.height || bounds2.width !== prevBounds.width; prevPosAndBounds.set({ pos, bounds: bounds2 }); if (hasResized) { fireResizeContent(editor, e2); } if (ui.isVisible()) { if (prevPos !== pos) { ui.update(true); } else if (hasResized) { ui.updateMode(); ui.repositionPopups(); } } }; if (!toolbarPersist) { editor.on("activate", ui.show); editor.on("deactivate", ui.hide); } editor.on("SkinLoaded ResizeWindow", function() { return ui.update(true); }); editor.on("NodeChange keydown", function(e2) { global$f.requestAnimationFrame(function() { return resizeContent(e2); }); }); editor.on("ScrollWindow", function() { return ui.updateMode(); }); var elementLoad = unbindable(); elementLoad.set(capture(SugarElement.fromDom(editor.getBody()), "load", resizeContent)); editor.on("remove", function() { elementLoad.clear(); }); }; var render123 = function(editor, uiComponents, rawUiConfig, backstage, args) { var mothership = uiComponents.mothership, uiMothership = uiComponents.uiMothership, outerContainer = uiComponents.outerContainer; var floatContainer = Cell3(null); var targetElm = SugarElement.fromDom(args.targetNode); var ui = InlineHeader(editor, targetElm, uiComponents, backstage, floatContainer); var toolbarPersist = isToolbarPersist(editor); inline(editor); var render124 = function() { if (floatContainer.get()) { ui.show(); return; } floatContainer.set(OuterContainer.getHeader(outerContainer).getOrDie()); var uiContainer = getUiContainer(editor); attachSystem(uiContainer, mothership); attachSystem(uiContainer, uiMothership); setToolbar(editor, uiComponents, rawUiConfig, backstage); OuterContainer.setMenubar(outerContainer, identifyMenus(editor, rawUiConfig)); ui.show(); setupEvents(editor, targetElm, ui, toolbarPersist); editor.nodeChanged(); }; editor.on("show", render124); editor.on("hide", ui.hide); if (!toolbarPersist) { editor.on("focus", render124); editor.on("blur", ui.hide); } editor.on("init", function() { if (editor.hasFocus() || toolbarPersist) { render124(); } }); setupReadonlyModeSwitch(editor, uiComponents); var api3 = { show: function() { ui.show(); }, hide: function() { ui.hide(); }, enable: function() { broadcastReadonly(uiComponents, false); }, disable: function() { broadcastReadonly(uiComponents, true); }, isDisabled: function() { return Disabling.isDisabled(outerContainer); } }; return { editorContainer: outerContainer.element.dom, api: api3 }; }; var Inline = /* @__PURE__ */ Object.freeze({ __proto__: null, render: render123 }); var showContextToolbarEvent = "contexttoolbar-show"; var hideContextToolbarEvent = "contexttoolbar-hide"; var getFormApi = function(input2) { return { hide: function() { return emit2(input2, sandboxClose()); }, getValue: function() { return Representing.getValue(input2); } }; }; var runOnExecute = function(memInput, original2) { return run$1(internalToolbarButtonExecute, function(comp, se) { var input2 = memInput.get(comp); var formApi = getFormApi(input2); original2.onAction(formApi, se.event.buttonApi); }); }; var renderContextButton = function(memInput, button2, extras) { var _a4 = button2.original; _a4.primary; var rest = __rest2(_a4, ["primary"]); var bridged = getOrDie(createToolbarButton(__assign(__assign({}, rest), { type: "button", onAction: noop2 }))); return renderToolbarButtonWith(bridged, extras.backstage.shared.providers, [runOnExecute(memInput, button2)]); }; var renderContextToggleButton = function(memInput, button2, extras) { var _a4 = button2.original; _a4.primary; var rest = __rest2(_a4, ["primary"]); var bridged = getOrDie(createToggleButton(__assign(__assign({}, rest), { type: "togglebutton", onAction: noop2 }))); return renderToolbarToggleButtonWith(bridged, extras.backstage.shared.providers, [runOnExecute(memInput, button2)]); }; var generateOne = function(memInput, button2, providersBackstage) { var extras = { backstage: { shared: { providers: providersBackstage } } }; if (button2.type === "contextformtogglebutton") { return renderContextToggleButton(memInput, button2, extras); } else { return renderContextButton(memInput, button2, extras); } }; var generate2 = function(memInput, buttons, providersBackstage) { var mementos = map$2(buttons, function(button2) { return record(generateOne(memInput, button2, providersBackstage)); }); var asSpecs = function() { return map$2(mementos, function(mem) { return mem.asSpec(); }); }; var findPrimary = function(compInSystem) { return findMap(buttons, function(button2, i2) { if (button2.primary) { return Optional.from(mementos[i2]).bind(function(mem) { return mem.getOpt(compInSystem); }).filter(not(Disabling.isDisabled)); } else { return Optional.none(); } }); }; return { asSpecs, findPrimary }; }; var buildInitGroups = function(ctx, providers) { var inputAttributes = ctx.label.fold(function() { return {}; }, function(label) { return { "aria-label": label }; }); var memInput = record(Input2.sketch({ inputClasses: [ "tox-toolbar-textfield", "tox-toolbar-nav-js" ], data: ctx.initValue(), inputAttributes, selectOnFocus: true, inputBehaviours: derive$1([Keying.config({ mode: "special", onEnter: function(input2) { return commands.findPrimary(input2).map(function(primary) { emitExecute(primary); return true; }); }, onLeft: function(comp, se) { se.cut(); return Optional.none(); }, onRight: function(comp, se) { se.cut(); return Optional.none(); } })]) })); var commands = generate2(memInput, ctx.commands, providers); return [ { title: Optional.none(), items: [memInput.asSpec()] }, { title: Optional.none(), items: commands.asSpecs() } ]; }; var renderContextForm = function(toolbarType, ctx, providers) { return renderToolbar({ type: toolbarType, uid: generate$6("context-toolbar"), initGroups: buildInitGroups(ctx, providers), onEscape: Optional.none, cyclicKeying: true, providers }); }; var ContextForm = { renderContextForm, buildInitGroups }; var isVerticalOverlap = function(a2, b3, threshold) { if (threshold === void 0) { threshold = 0.01; } return b3.bottom - a2.y >= threshold && a2.bottom - b3.y >= threshold; }; var getRangeRect = function(rng) { var rect2 = rng.getBoundingClientRect(); if (rect2.height <= 0 && rect2.width <= 0) { var leaf$1 = leaf(SugarElement.fromDom(rng.startContainer), rng.startOffset).element; var elm = isText$1(leaf$1) ? parent2(leaf$1) : Optional.some(leaf$1); return elm.filter(isElement$2).map(function(e2) { return e2.dom.getBoundingClientRect(); }).getOr(rect2); } else { return rect2; } }; var getSelectionBounds = function(editor) { var rng = editor.selection.getRng(); var rect2 = getRangeRect(rng); if (editor.inline) { var scroll_1 = get$9(); return bounds(scroll_1.left + rect2.left, scroll_1.top + rect2.top, rect2.width, rect2.height); } else { var bodyPos = absolute$2(SugarElement.fromDom(editor.getBody())); return bounds(bodyPos.x + rect2.left, bodyPos.y + rect2.top, rect2.width, rect2.height); } }; var getAnchorElementBounds = function(editor, lastElement) { return lastElement.filter(inBody).map(absolute$2).getOrThunk(function() { return getSelectionBounds(editor); }); }; var getHorizontalBounds = function(contentAreaBox, viewportBounds, margin) { var x2 = Math.max(contentAreaBox.x + margin, viewportBounds.x); var right2 = Math.min(contentAreaBox.right - margin, viewportBounds.right); return { x: x2, width: right2 - x2 }; }; var getVerticalBounds = function(editor, contentAreaBox, viewportBounds, isToolbarLocationTop, toolbarType, margin) { var container = SugarElement.fromDom(editor.getContainer()); var header = descendant(container, ".tox-editor-header").getOr(container); var headerBox = box$1(header); var isToolbarBelowContentArea = headerBox.y >= contentAreaBox.bottom; var isToolbarAbove = isToolbarLocationTop && !isToolbarBelowContentArea; if (editor.inline && isToolbarAbove) { return { y: Math.max(headerBox.bottom + margin, viewportBounds.y), bottom: viewportBounds.bottom }; } if (editor.inline && !isToolbarAbove) { return { y: viewportBounds.y, bottom: Math.min(headerBox.y - margin, viewportBounds.bottom) }; } var containerBounds = toolbarType === "line" ? box$1(container) : contentAreaBox; if (isToolbarAbove) { return { y: Math.max(headerBox.bottom + margin, viewportBounds.y), bottom: Math.min(containerBounds.bottom - margin, viewportBounds.bottom) }; } return { y: Math.max(containerBounds.y + margin, viewportBounds.y), bottom: Math.min(headerBox.y - margin, viewportBounds.bottom) }; }; var getContextToolbarBounds = function(editor, sharedBackstage, toolbarType, margin) { if (margin === void 0) { margin = 0; } var viewportBounds = getBounds$3(window); var contentAreaBox = box$1(SugarElement.fromDom(editor.getContentAreaContainer())); var toolbarOrMenubarEnabled = isMenubarEnabled(editor) || isToolbarEnabled(editor) || isMultipleToolbars(editor); var _a4 = getHorizontalBounds(contentAreaBox, viewportBounds, margin), x2 = _a4.x, width2 = _a4.width; if (editor.inline && !toolbarOrMenubarEnabled) { return bounds(x2, viewportBounds.y, width2, viewportBounds.height); } else { var isToolbarTop = sharedBackstage.header.isPositionedAtTop(); var _b2 = getVerticalBounds(editor, contentAreaBox, viewportBounds, isToolbarTop, toolbarType, margin), y2 = _b2.y, bottom2 = _b2.bottom; return bounds(x2, y2, width2, bottom2 - y2); } }; var bubbleSize$1 = 12; var bubbleAlignments$1 = { valignCentre: [], alignCentre: [], alignLeft: ["tox-pop--align-left"], alignRight: ["tox-pop--align-right"], right: ["tox-pop--right"], left: ["tox-pop--left"], bottom: ["tox-pop--bottom"], top: ["tox-pop--top"], inset: ["tox-pop--inset"] }; var anchorOverrides = { maxHeightFunction: expandable$1(), maxWidthFunction: expandable() }; var isEntireElementSelected = function(editor, elem) { var rng = editor.selection.getRng(); var leaf$1 = leaf(SugarElement.fromDom(rng.startContainer), rng.startOffset); return rng.startContainer === rng.endContainer && rng.startOffset === rng.endOffset - 1 && eq2(leaf$1.element, elem); }; var preservePosition = function(elem, position3, f2) { var currentPosition = getRaw(elem, "position"); set$7(elem, "position", position3); var result = f2(elem); currentPosition.each(function(pos) { return set$7(elem, "position", pos); }); return result; }; var shouldUseInsetLayouts = function(position3) { return position3 === "node"; }; var determineInsetLayout = function(editor, contextbar, elem, data65, bounds2) { var selectionBounds = getSelectionBounds(editor); var isSameAnchorElement = data65.lastElement().exists(function(prev2) { return eq2(elem, prev2); }); if (isEntireElementSelected(editor, elem)) { return isSameAnchorElement ? preserve : north; } else if (isSameAnchorElement) { return preservePosition(contextbar, data65.getMode(), function() { var isOverlapping = isVerticalOverlap(selectionBounds, box$1(contextbar)); return isOverlapping && !data65.isReposition() ? flip$2 : preserve; }); } else { var yBounds = data65.getMode() === "fixed" ? bounds2.y + get$9().top : bounds2.y; var contextbarHeight = get$b(contextbar) + bubbleSize$1; return yBounds + contextbarHeight <= selectionBounds.y ? north : south; } }; var getAnchorSpec$2 = function(editor, mobile, data65, position3) { var smartInsetLayout = function(elem) { return function(anchor2, element2, bubbles, placee, bounds2) { var layout2 = determineInsetLayout(editor, placee, elem, data65, bounds2); var newAnchor = __assign(__assign({}, anchor2), { y: bounds2.y, height: bounds2.height }); return __assign(__assign({}, layout2(newAnchor, element2, bubbles, placee, bounds2)), { alwaysFit: true }); }; }; var getInsetLayouts = function(elem) { return shouldUseInsetLayouts(position3) ? [smartInsetLayout(elem)] : []; }; var desktopAnchorSpecLayouts = { onLtr: function(elem) { return [ north$2, south$2, northeast$2, southeast$2, northwest$2, southwest$2 ].concat(getInsetLayouts(elem)); }, onRtl: function(elem) { return [ north$2, south$2, northwest$2, southwest$2, northeast$2, southeast$2 ].concat(getInsetLayouts(elem)); } }; var mobileAnchorSpecLayouts = { onLtr: function(elem) { return [ south$2, southeast$2, southwest$2, northeast$2, northwest$2, north$2 ].concat(getInsetLayouts(elem)); }, onRtl: function(elem) { return [ south$2, southwest$2, southeast$2, northwest$2, northeast$2, north$2 ].concat(getInsetLayouts(elem)); } }; return mobile ? mobileAnchorSpecLayouts : desktopAnchorSpecLayouts; }; var getAnchorLayout = function(editor, position3, isTouch2, data65) { if (position3 === "line") { return { bubble: nu$5(bubbleSize$1, 0, bubbleAlignments$1), layouts: { onLtr: function() { return [east$2]; }, onRtl: function() { return [west$2]; } }, overrides: anchorOverrides }; } else { return { bubble: nu$5(0, bubbleSize$1, bubbleAlignments$1, 1 / bubbleSize$1), layouts: getAnchorSpec$2(editor, isTouch2, data65, position3), overrides: anchorOverrides }; } }; var matchTargetWith = function(elem, candidates) { var ctxs = filter$2(candidates, function(toolbarApi) { return toolbarApi.predicate(elem.dom); }); var _a4 = partition$3(ctxs, function(t3) { return t3.type === "contexttoolbar"; }), pass = _a4.pass, fail = _a4.fail; return { contextToolbars: pass, contextForms: fail }; }; var filterByPositionForStartNode = function(toolbars) { if (toolbars.length <= 1) { return toolbars; } else { var doesPositionExist = function(value25) { return exists(toolbars, function(t3) { return t3.position === value25; }); }; var filterToolbarsByPosition = function(value25) { return filter$2(toolbars, function(t3) { return t3.position === value25; }); }; var hasSelectionToolbars = doesPositionExist("selection"); var hasNodeToolbars = doesPositionExist("node"); if (hasSelectionToolbars || hasNodeToolbars) { if (hasNodeToolbars && hasSelectionToolbars) { var nodeToolbars = filterToolbarsByPosition("node"); var selectionToolbars = map$2(filterToolbarsByPosition("selection"), function(t3) { return __assign(__assign({}, t3), { position: "node" }); }); return nodeToolbars.concat(selectionToolbars); } else { return hasSelectionToolbars ? filterToolbarsByPosition("selection") : filterToolbarsByPosition("node"); } } else { return filterToolbarsByPosition("line"); } } }; var filterByPositionForAncestorNode = function(toolbars) { if (toolbars.length <= 1) { return toolbars; } else { var findPosition_1 = function(value25) { return find$5(toolbars, function(t3) { return t3.position === value25; }); }; var basePosition = findPosition_1("selection").orThunk(function() { return findPosition_1("node"); }).orThunk(function() { return findPosition_1("line"); }).map(function(t3) { return t3.position; }); return basePosition.fold(function() { return []; }, function(pos) { return filter$2(toolbars, function(t3) { return t3.position === pos; }); }); } }; var matchStartNode = function(elem, nodeCandidates, editorCandidates) { var nodeMatches = matchTargetWith(elem, nodeCandidates); if (nodeMatches.contextForms.length > 0) { return Optional.some({ elem, toolbars: [nodeMatches.contextForms[0]] }); } else { var editorMatches = matchTargetWith(elem, editorCandidates); if (editorMatches.contextForms.length > 0) { return Optional.some({ elem, toolbars: [editorMatches.contextForms[0]] }); } else if (nodeMatches.contextToolbars.length > 0 || editorMatches.contextToolbars.length > 0) { var toolbars = filterByPositionForStartNode(nodeMatches.contextToolbars.concat(editorMatches.contextToolbars)); return Optional.some({ elem, toolbars }); } else { return Optional.none(); } } }; var matchAncestor = function(isRoot, startNode, scopes) { if (isRoot(startNode)) { return Optional.none(); } else { return ancestor$2(startNode, function(ancestorElem) { if (isElement$2(ancestorElem)) { var _a4 = matchTargetWith(ancestorElem, scopes.inNodeScope), contextToolbars = _a4.contextToolbars, contextForms = _a4.contextForms; var toolbars = contextForms.length > 0 ? contextForms : filterByPositionForAncestorNode(contextToolbars); return toolbars.length > 0 ? Optional.some({ elem: ancestorElem, toolbars }) : Optional.none(); } else { return Optional.none(); } }, isRoot); } }; var lookup$1 = function(scopes, editor) { var rootElem = SugarElement.fromDom(editor.getBody()); var isRoot = function(elem) { return eq2(elem, rootElem); }; var isOutsideRoot = function(startNode2) { return !isRoot(startNode2) && !contains2(rootElem, startNode2); }; var startNode = SugarElement.fromDom(editor.selection.getNode()); if (isOutsideRoot(startNode)) { return Optional.none(); } return matchStartNode(startNode, scopes.inNodeScope, scopes.inEditorScope).orThunk(function() { return matchAncestor(isRoot, startNode, scopes); }); }; var categorise = function(contextToolbars, navigate) { var forms = {}; var inNodeScope = []; var inEditorScope = []; var formNavigators = {}; var lookupTable = {}; var registerForm = function(key2, toolbarSpec) { var contextForm = getOrDie(createContextForm(toolbarSpec)); forms[key2] = contextForm; contextForm.launch.map(function(launch) { formNavigators["form:" + key2] = __assign(__assign({}, toolbarSpec.launch), { type: launch.type === "contextformtogglebutton" ? "togglebutton" : "button", onAction: function() { navigate(contextForm); } }); }); if (contextForm.scope === "editor") { inEditorScope.push(contextForm); } else { inNodeScope.push(contextForm); } lookupTable[key2] = contextForm; }; var registerToolbar = function(key2, toolbarSpec) { createContextToolbar(toolbarSpec).each(function(contextToolbar) { if (toolbarSpec.scope === "editor") { inEditorScope.push(contextToolbar); } else { inNodeScope.push(contextToolbar); } lookupTable[key2] = contextToolbar; }); }; var keys$12 = keys2(contextToolbars); each$12(keys$12, function(key2) { var toolbarApi = contextToolbars[key2]; if (toolbarApi.type === "contextform") { registerForm(key2, toolbarApi); } else if (toolbarApi.type === "contexttoolbar") { registerToolbar(key2, toolbarApi); } }); return { forms, inNodeScope, inEditorScope, lookupTable, formNavigators }; }; var forwardSlideEvent = generate$6("forward-slide"); var backSlideEvent = generate$6("backward-slide"); var changeSlideEvent = generate$6("change-slide-event"); var resizingClass = "tox-pop--resizing"; var renderContextToolbar = function(spec) { var stack = Cell3([]); return InlineView.sketch({ dom: { tag: "div", classes: ["tox-pop"] }, fireDismissalEventInstead: { event: "doNotDismissYet" }, onShow: function(comp) { stack.set([]); InlineView.getContent(comp).each(function(c2) { remove$6(c2.element, "visibility"); }); remove$2(comp.element, resizingClass); remove$6(comp.element, "width"); }, inlineBehaviours: derive$1([ config3("context-toolbar-events", [ runOnSource(transitionend(), function(comp, se) { if (se.event.raw.propertyName === "width") { remove$2(comp.element, resizingClass); remove$6(comp.element, "width"); } }), run$1(changeSlideEvent, function(comp, se) { var elem = comp.element; remove$6(elem, "width"); var currentWidth = get$a(elem); InlineView.setContent(comp, se.event.contents); add$2(elem, resizingClass); var newWidth = get$a(elem); set$7(elem, "width", currentWidth + "px"); InlineView.getContent(comp).each(function(newContents) { se.event.focus.bind(function(f2) { focus$3(f2); return search(elem); }).orThunk(function() { Keying.focusIn(newContents); return active(getRootNode(elem)); }); }); global$f.setTimeout(function() { set$7(comp.element, "width", newWidth + "px"); }, 0); }), run$1(forwardSlideEvent, function(comp, se) { InlineView.getContent(comp).each(function(oldContents) { stack.set(stack.get().concat([{ bar: oldContents, focus: active(getRootNode(comp.element)) }])); }); emitWith(comp, changeSlideEvent, { contents: se.event.forwardContents, focus: Optional.none() }); }), run$1(backSlideEvent, function(comp, _se) { last$2(stack.get()).each(function(last3) { stack.set(stack.get().slice(0, stack.get().length - 1)); emitWith(comp, changeSlideEvent, { contents: premade(last3.bar), focus: last3.focus }); }); }) ]), Keying.config({ mode: "special", onEscape: function(comp) { return last$2(stack.get()).fold(function() { return spec.onEscape(); }, function(_2) { emit2(comp, backSlideEvent); return Optional.some(true); }); } }) ]), lazySink: function() { return Result.value(spec.sink); } }); }; var transitionClass = "tox-pop--transition"; var register$7 = function(editor, registryContextToolbars, sink, extras) { var backstage = extras.backstage; var sharedBackstage = backstage.shared; var isTouch2 = detect$1().deviceType.isTouch; var lastElement = value$1(); var lastTrigger = value$1(); var lastContextPosition = value$1(); var contextbar = build$1(renderContextToolbar({ sink, onEscape: function() { editor.focus(); return Optional.some(true); } })); var getBounds2 = function() { var position3 = lastContextPosition.get().getOr("node"); var margin = shouldUseInsetLayouts(position3) ? 1 : 0; return getContextToolbarBounds(editor, sharedBackstage, position3, margin); }; var canLaunchToolbar = function() { return !editor.removed && !(isTouch2() && backstage.isContextMenuOpen()); }; var isSameLaunchElement = function(elem) { return is$1(lift2(elem, lastElement.get(), eq2), true); }; var shouldContextToolbarHide = function() { if (!canLaunchToolbar()) { return true; } else { var contextToolbarBounds = getBounds2(); var anchorBounds = is$1(lastContextPosition.get(), "node") ? getAnchorElementBounds(editor, lastElement.get()) : getSelectionBounds(editor); return contextToolbarBounds.height <= 0 || !isVerticalOverlap(anchorBounds, contextToolbarBounds); } }; var close8 = function() { lastElement.clear(); lastTrigger.clear(); lastContextPosition.clear(); InlineView.hide(contextbar); }; var hideOrRepositionIfNecessary = function() { if (InlineView.isOpen(contextbar)) { var contextBarEle = contextbar.element; remove$6(contextBarEle, "display"); if (shouldContextToolbarHide()) { set$7(contextBarEle, "display", "none"); } else { lastTrigger.set(0); InlineView.reposition(contextbar); } } }; var wrapInPopDialog = function(toolbarSpec) { return { dom: { tag: "div", classes: ["tox-pop__dialog"] }, components: [toolbarSpec], behaviours: derive$1([ Keying.config({ mode: "acyclic" }), config3("pop-dialog-wrap-events", [ runOnAttached(function(comp) { editor.shortcuts.add("ctrl+F9", "focus statusbar", function() { return Keying.focusIn(comp); }); }), runOnDetached(function(_comp) { editor.shortcuts.remove("ctrl+F9"); }) ]) ]) }; }; var getScopes = cached2(function() { return categorise(registryContextToolbars, function(toolbarApi) { var alloySpec = buildToolbar([toolbarApi]); emitWith(contextbar, forwardSlideEvent, { forwardContents: wrapInPopDialog(alloySpec) }); }); }); var buildContextToolbarGroups = function(allButtons, ctx) { return identifyButtons(editor, { buttons: allButtons, toolbar: ctx.items, allowToolbarGroups: false }, extras, Optional.some(["form:"])); }; var buildContextFormGroups = function(ctx, providers) { return ContextForm.buildInitGroups(ctx, providers); }; var buildToolbar = function(toolbars) { var buttons = editor.ui.registry.getAll().buttons; var scopes = getScopes(); var allButtons = __assign(__assign({}, buttons), scopes.formNavigators); var toolbarType = getToolbarMode(editor) === ToolbarMode.scrolling ? ToolbarMode.scrolling : ToolbarMode.default; var initGroups = flatten2(map$2(toolbars, function(ctx) { return ctx.type === "contexttoolbar" ? buildContextToolbarGroups(allButtons, ctx) : buildContextFormGroups(ctx, sharedBackstage.providers); })); return renderToolbar({ type: toolbarType, uid: generate$6("context-toolbar"), initGroups, onEscape: Optional.none, cyclicKeying: true, providers: sharedBackstage.providers }); }; var getAnchor2 = function(position3, element2) { var anchorage = position3 === "node" ? sharedBackstage.anchors.node(element2) : sharedBackstage.anchors.cursor(); var anchorLayout = getAnchorLayout(editor, position3, isTouch2(), { lastElement: lastElement.get, isReposition: function() { return is$1(lastTrigger.get(), 0); }, getMode: function() { return Positioning.getMode(sink); } }); return deepMerge2(anchorage, anchorLayout); }; var launchContext = function(toolbarApi, elem) { launchContextToolbar.cancel(); if (!canLaunchToolbar()) { return; } var toolbarSpec = buildToolbar(toolbarApi); var position3 = toolbarApi[0].position; var anchor2 = getAnchor2(position3, elem); lastContextPosition.set(position3); lastTrigger.set(1); var contextBarEle = contextbar.element; remove$6(contextBarEle, "display"); if (!isSameLaunchElement(elem)) { remove$2(contextBarEle, transitionClass); Positioning.reset(sink, contextbar); } InlineView.showWithinBounds(contextbar, wrapInPopDialog(toolbarSpec), { anchor: anchor2, transition: { classes: [transitionClass], mode: "placement" } }, function() { return Optional.some(getBounds2()); }); elem.fold(lastElement.clear, lastElement.set); if (shouldContextToolbarHide()) { set$7(contextBarEle, "display", "none"); } }; var launchContextToolbar = last2(function() { if (!editor.hasFocus() || editor.removed) { return; } if (has2(contextbar.element, transitionClass)) { launchContextToolbar.throttle(); } else { var scopes = getScopes(); lookup$1(scopes, editor).fold(close8, function(info3) { launchContext(info3.toolbars, Optional.some(info3.elem)); }); } }, 17); editor.on("init", function() { editor.on("remove", close8); editor.on("ScrollContent ScrollWindow ObjectResized ResizeEditor longpress", hideOrRepositionIfNecessary); editor.on("click keyup focus SetContent", launchContextToolbar.throttle); editor.on(hideContextToolbarEvent, close8); editor.on(showContextToolbarEvent, function(e2) { var scopes = getScopes(); get$e(scopes.lookupTable, e2.toolbarKey).each(function(ctx) { launchContext([ctx], someIf(e2.target !== editor, e2.target)); InlineView.getContent(contextbar).each(Keying.focusIn); }); }); editor.on("focusout", function(_e) { global$f.setEditorTimeout(editor, function() { if (search(sink.element).isNone() && search(contextbar.element).isNone()) { close8(); } }, 0); }); editor.on("SwitchMode", function() { if (editor.mode.isReadOnly()) { close8(); } }); editor.on("AfterProgressState", function(event) { if (event.state) { close8(); } else if (editor.hasFocus()) { launchContextToolbar.throttle(); } }); editor.on("NodeChange", function(_e) { search(contextbar.element).fold(launchContextToolbar.throttle, noop2); }); }); }; var register$6 = function(editor) { var alignToolbarButtons = [ { name: "alignleft", text: "Align left", cmd: "JustifyLeft", icon: "align-left" }, { name: "aligncenter", text: "Align center", cmd: "JustifyCenter", icon: "align-center" }, { name: "alignright", text: "Align right", cmd: "JustifyRight", icon: "align-right" }, { name: "alignjustify", text: "Justify", cmd: "JustifyFull", icon: "align-justify" } ]; each$12(alignToolbarButtons, function(item2) { editor.ui.registry.addToggleButton(item2.name, { tooltip: item2.text, icon: item2.icon, onAction: onActionExecCommand(editor, item2.cmd), onSetup: onSetupFormatToggle(editor, item2.name) }); }); editor.ui.registry.addButton("alignnone", { tooltip: "No alignment", icon: "align-none", onAction: onActionExecCommand(editor, "JustifyNone") }); }; var units = { unsupportedLength: [ "em", "ex", "cap", "ch", "ic", "rem", "lh", "rlh", "vw", "vh", "vi", "vb", "vmin", "vmax", "cm", "mm", "Q", "in", "pc", "pt", "px" ], fixed: [ "px", "pt" ], relative: ["%"], empty: [""] }; var pattern2 = function() { var decimalDigits = "[0-9]+"; var signedInteger = "[+-]?" + decimalDigits; var exponentPart = "[eE]" + signedInteger; var dot = "\\."; var opt = function(input2) { return "(?:" + input2 + ")?"; }; var unsignedDecimalLiteral = [ "Infinity", decimalDigits + dot + opt(decimalDigits) + opt(exponentPart), dot + decimalDigits + opt(exponentPart), decimalDigits + opt(exponentPart) ].join("|"); var float2 = "[+-]?(?:" + unsignedDecimalLiteral + ")"; return new RegExp("^(" + float2 + ")(.*)$"); }(); var isUnit = function(unit, accepted) { return exists(accepted, function(acc) { return exists(units[acc], function(check) { return unit === check; }); }); }; var parse2 = function(input2, accepted) { var match5 = Optional.from(pattern2.exec(input2)); return match5.bind(function(array3) { var value25 = Number(array3[1]); var unitRaw = array3[2]; if (isUnit(unitRaw, accepted)) { return Optional.some({ value: value25, unit: unitRaw }); } else { return Optional.none(); } }); }; var normalise = function(input2, accepted) { return parse2(input2, accepted).map(function(_a4) { var value25 = _a4.value, unit = _a4.unit; return value25 + unit; }); }; var registerController = function(editor, spec) { var getMenuItems2 = function() { var options2 = spec.getOptions(editor); var initial = spec.getCurrent(editor).map(spec.hash); var current2 = value$1(); return map$2(options2, function(value25) { return { type: "togglemenuitem", text: spec.display(value25), onSetup: function(api3) { var setActive = function(active2) { if (active2) { current2.on(function(oldApi) { return oldApi.setActive(false); }); current2.set(api3); } api3.setActive(active2); }; setActive(is$1(initial, spec.hash(value25))); var unbindWatcher = spec.watcher(editor, value25, setActive); return function() { current2.clear(); unbindWatcher(); }; }, onAction: function() { return spec.setCurrent(editor, value25); } }; }); }; editor.ui.registry.addMenuButton(spec.name, { tooltip: spec.text, icon: spec.icon, fetch: function(callback2) { return callback2(getMenuItems2()); }, onSetup: spec.onToolbarSetup }); editor.ui.registry.addNestedMenuItem(spec.name, { type: "nestedmenuitem", text: spec.text, getSubmenuItems: getMenuItems2, onSetup: spec.onMenuSetup }); }; var lineHeightSpec = { name: "lineheight", text: "Line height", icon: "line-height", getOptions: getLineHeightFormats, hash: function(input2) { return normalise(input2, [ "fixed", "relative", "empty" ]).getOr(input2); }, display: identity$1, watcher: function(editor, value25, callback2) { return editor.formatter.formatChanged("lineheight", callback2, false, { value: value25 }).unbind; }, getCurrent: function(editor) { return Optional.from(editor.queryCommandValue("LineHeight")); }, setCurrent: function(editor, value25) { return editor.execCommand("LineHeight", false, value25); } }; var languageSpec = function(editor) { var settingsOpt = Optional.from(getContentLanguages(editor)); return settingsOpt.map(function(settings) { return { name: "language", text: "Language", icon: "language", getOptions: constant$1(settings), hash: function(input2) { return isUndefined2(input2.customCode) ? input2.code : input2.code + "/" + input2.customCode; }, display: function(input2) { return input2.title; }, watcher: function(editor2, value25, callback2) { return editor2.formatter.formatChanged("lang", callback2, false, { value: value25.code, customValue: value25.customCode }).unbind; }, getCurrent: function(editor2) { var node = SugarElement.fromDom(editor2.selection.getNode()); return closest$4(node, function(n2) { return Optional.some(n2).filter(isElement$2).bind(function(ele) { var codeOpt = getOpt(ele, "lang"); return codeOpt.map(function(code) { var customCode = getOpt(ele, "data-mce-lang").getOrUndefined(); return { code, customCode, title: "" }; }); }); }); }, setCurrent: function(editor2, lang2) { return editor2.execCommand("Lang", false, lang2); }, onToolbarSetup: function(api3) { var unbinder = unbindable(); api3.setActive(editor.formatter.match("lang", {}, void 0, true)); unbinder.set(editor.formatter.formatChanged("lang", api3.setActive, true)); return unbinder.clear; } }; }); }; var register$5 = function(editor) { registerController(editor, lineHeightSpec); languageSpec(editor).each(function(spec) { return registerController(editor, spec); }); }; var register$4 = function(editor, backstage) { alignSelectMenu(editor, backstage); fontSelectMenu(editor, backstage); styleSelectMenu(editor, backstage); formatSelectMenu(editor, backstage); fontsizeSelectMenu(editor, backstage); }; var onSetupOutdentState = function(editor) { return onSetupEvent(editor, "NodeChange", function(api3) { api3.setDisabled(!editor.queryCommandState("outdent")); }); }; var registerButtons$2 = function(editor) { editor.ui.registry.addButton("outdent", { tooltip: "Decrease indent", icon: "outdent", onSetup: onSetupOutdentState(editor), onAction: onActionExecCommand(editor, "outdent") }); editor.ui.registry.addButton("indent", { tooltip: "Increase indent", icon: "indent", onAction: onActionExecCommand(editor, "indent") }); }; var register$3 = function(editor) { registerButtons$2(editor); }; var onActionToggleFormat = function(editor, fmt) { return function() { editor.execCommand("mceToggleFormat", false, fmt); }; }; var registerFormatButtons = function(editor) { global$5.each([ { name: "bold", text: "Bold", icon: "bold" }, { name: "italic", text: "Italic", icon: "italic" }, { name: "underline", text: "Underline", icon: "underline" }, { name: "strikethrough", text: "Strikethrough", icon: "strike-through" }, { name: "subscript", text: "Subscript", icon: "subscript" }, { name: "superscript", text: "Superscript", icon: "superscript" } ], function(btn, _idx) { editor.ui.registry.addToggleButton(btn.name, { tooltip: btn.text, icon: btn.icon, onSetup: onSetupFormatToggle(editor, btn.name), onAction: onActionToggleFormat(editor, btn.name) }); }); for (var i2 = 1; i2 <= 6; i2++) { var name_1 = "h" + i2; editor.ui.registry.addToggleButton(name_1, { text: name_1.toUpperCase(), tooltip: "Heading " + i2, onSetup: onSetupFormatToggle(editor, name_1), onAction: onActionToggleFormat(editor, name_1) }); } }; var registerCommandButtons = function(editor) { global$5.each([ { name: "cut", text: "Cut", action: "Cut", icon: "cut" }, { name: "copy", text: "Copy", action: "Copy", icon: "copy" }, { name: "paste", text: "Paste", action: "Paste", icon: "paste" }, { name: "help", text: "Help", action: "mceHelp", icon: "help" }, { name: "selectall", text: "Select all", action: "SelectAll", icon: "select-all" }, { name: "newdocument", text: "New document", action: "mceNewDocument", icon: "new-document" }, { name: "removeformat", text: "Clear formatting", action: "RemoveFormat", icon: "remove-formatting" }, { name: "remove", text: "Remove", action: "Delete", icon: "remove" } ], function(btn) { editor.ui.registry.addButton(btn.name, { tooltip: btn.text, icon: btn.icon, onAction: onActionExecCommand(editor, btn.action) }); }); }; var registerCommandToggleButtons = function(editor) { global$5.each([{ name: "blockquote", text: "Blockquote", action: "mceBlockQuote", icon: "quote" }], function(btn) { editor.ui.registry.addToggleButton(btn.name, { tooltip: btn.text, icon: btn.icon, onAction: onActionExecCommand(editor, btn.action), onSetup: onSetupFormatToggle(editor, btn.name) }); }); }; var registerButtons$1 = function(editor) { registerFormatButtons(editor); registerCommandButtons(editor); registerCommandToggleButtons(editor); }; var registerMenuItems$2 = function(editor) { global$5.each([ { name: "bold", text: "Bold", action: "Bold", icon: "bold", shortcut: "Meta+B" }, { name: "italic", text: "Italic", action: "Italic", icon: "italic", shortcut: "Meta+I" }, { name: "underline", text: "Underline", action: "Underline", icon: "underline", shortcut: "Meta+U" }, { name: "strikethrough", text: "Strikethrough", action: "Strikethrough", icon: "strike-through", shortcut: "" }, { name: "subscript", text: "Subscript", action: "Subscript", icon: "subscript", shortcut: "" }, { name: "superscript", text: "Superscript", action: "Superscript", icon: "superscript", shortcut: "" }, { name: "removeformat", text: "Clear formatting", action: "RemoveFormat", icon: "remove-formatting", shortcut: "" }, { name: "newdocument", text: "New document", action: "mceNewDocument", icon: "new-document", shortcut: "" }, { name: "cut", text: "Cut", action: "Cut", icon: "cut", shortcut: "Meta+X" }, { name: "copy", text: "Copy", action: "Copy", icon: "copy", shortcut: "Meta+C" }, { name: "paste", text: "Paste", action: "Paste", icon: "paste", shortcut: "Meta+V" }, { name: "selectall", text: "Select all", action: "SelectAll", icon: "select-all", shortcut: "Meta+A" } ], function(btn) { editor.ui.registry.addMenuItem(btn.name, { text: btn.text, icon: btn.icon, shortcut: btn.shortcut, onAction: onActionExecCommand(editor, btn.action) }); }); editor.ui.registry.addMenuItem("codeformat", { text: "Code", icon: "sourcecode", onAction: onActionToggleFormat(editor, "code") }); }; var register$2 = function(editor) { registerButtons$1(editor); registerMenuItems$2(editor); }; var onSetupUndoRedoState = function(editor, type3) { return onSetupEvent(editor, "Undo Redo AddUndo TypingUndo ClearUndos SwitchMode", function(api3) { api3.setDisabled(editor.mode.isReadOnly() || !editor.undoManager[type3]()); }); }; var registerMenuItems$1 = function(editor) { editor.ui.registry.addMenuItem("undo", { text: "Undo", icon: "undo", shortcut: "Meta+Z", onSetup: onSetupUndoRedoState(editor, "hasUndo"), onAction: onActionExecCommand(editor, "undo") }); editor.ui.registry.addMenuItem("redo", { text: "Redo", icon: "redo", shortcut: "Meta+Y", onSetup: onSetupUndoRedoState(editor, "hasRedo"), onAction: onActionExecCommand(editor, "redo") }); }; var registerButtons = function(editor) { editor.ui.registry.addButton("undo", { tooltip: "Undo", icon: "undo", disabled: true, onSetup: onSetupUndoRedoState(editor, "hasUndo"), onAction: onActionExecCommand(editor, "undo") }); editor.ui.registry.addButton("redo", { tooltip: "Redo", icon: "redo", disabled: true, onSetup: onSetupUndoRedoState(editor, "hasRedo"), onAction: onActionExecCommand(editor, "redo") }); }; var register$1 = function(editor) { registerMenuItems$1(editor); registerButtons(editor); }; var onSetupVisualAidState = function(editor) { return onSetupEvent(editor, "VisualAid", function(api3) { api3.setActive(editor.hasVisual); }); }; var registerMenuItems = function(editor) { editor.ui.registry.addToggleMenuItem("visualaid", { text: "Visual aids", onSetup: onSetupVisualAidState(editor), onAction: onActionExecCommand(editor, "mceToggleVisualAid") }); }; var registerToolbarButton = function(editor) { editor.ui.registry.addButton("visualaid", { tooltip: "Visual aids", text: "Visual aids", onAction: onActionExecCommand(editor, "mceToggleVisualAid") }); }; var register3 = function(editor) { registerToolbarButton(editor); registerMenuItems(editor); }; var setup$6 = function(editor, backstage) { register$6(editor); register$2(editor); register$4(editor, backstage); register$1(editor); register$a(editor); register3(editor); register$3(editor); register$5(editor); }; var nu = function(x2, y2) { return { type: "makeshift", x: x2, y: y2 }; }; var transpose = function(pos, dx, dy) { return nu(pos.x + dx, pos.y + dy); }; var isTouchEvent = function(e2) { return e2.type === "longpress" || e2.type.indexOf("touch") === 0; }; var fromPageXY = function(e2) { if (isTouchEvent(e2)) { var touch2 = e2.touches[0]; return nu(touch2.pageX, touch2.pageY); } else { return nu(e2.pageX, e2.pageY); } }; var fromClientXY = function(e2) { if (isTouchEvent(e2)) { var touch2 = e2.touches[0]; return nu(touch2.clientX, touch2.clientY); } else { return nu(e2.clientX, e2.clientY); } }; var transposeContentAreaContainer = function(element2, pos) { var containerPos = global$b.DOM.getPos(element2); return transpose(pos, containerPos.x, containerPos.y); }; var getPointAnchor = function(editor, e2) { if (e2.type === "contextmenu" || e2.type === "longpress") { if (editor.inline) { return fromPageXY(e2); } else { return transposeContentAreaContainer(editor.getContentAreaContainer(), fromClientXY(e2)); } } else { return getSelectionAnchor(editor); } }; var getSelectionAnchor = function(editor) { return { type: "selection", root: SugarElement.fromDom(editor.selection.getNode()) }; }; var getNodeAnchor = function(editor) { return { type: "node", node: Optional.some(SugarElement.fromDom(editor.selection.getNode())), root: SugarElement.fromDom(editor.getBody()) }; }; var getAnchorSpec$1 = function(editor, e2, anchorType) { switch (anchorType) { case "node": return getNodeAnchor(editor); case "point": return getPointAnchor(editor, e2); case "selection": return getSelectionAnchor(editor); } }; var initAndShow$1 = function(editor, e2, buildMenu, backstage, contextmenu, anchorType) { var items = buildMenu(); var anchorSpec = getAnchorSpec$1(editor, e2, anchorType); build(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage, false).map(function(menuData) { e2.preventDefault(); InlineView.showMenuAt(contextmenu, { anchor: anchorSpec }, { menu: { markers: markers("normal") }, data: menuData }); }); }; var layouts = { onLtr: function() { return [ south$2, southeast$2, southwest$2, northeast$2, northwest$2, north$2, north, south, northeast, southeast, northwest, southwest ]; }, onRtl: function() { return [ south$2, southwest$2, southeast$2, northwest$2, northeast$2, north$2, north, south, northwest, southwest, northeast, southeast ]; } }; var bubbleSize = 12; var bubbleAlignments = { valignCentre: [], alignCentre: [], alignLeft: ["tox-pop--align-left"], alignRight: ["tox-pop--align-right"], right: ["tox-pop--right"], left: ["tox-pop--left"], bottom: ["tox-pop--bottom"], top: ["tox-pop--top"] }; var isTouchWithinSelection = function(editor, e2) { var selection = editor.selection; if (selection.isCollapsed() || e2.touches.length < 1) { return false; } else { var touch_1 = e2.touches[0]; var rng = selection.getRng(); var rngRectOpt = getFirstRect(editor.getWin(), SimSelection.domRange(rng)); return rngRectOpt.exists(function(rngRect) { return rngRect.left <= touch_1.clientX && rngRect.right >= touch_1.clientX && rngRect.top <= touch_1.clientY && rngRect.bottom >= touch_1.clientY; }); } }; var setupiOSOverrides = function(editor) { var originalSelection = editor.selection.getRng(); var selectionReset = function() { global$f.setEditorTimeout(editor, function() { editor.selection.setRng(originalSelection); }, 10); unbindEventListeners(); }; editor.once("touchend", selectionReset); var preventMousedown = function(e2) { e2.preventDefault(); e2.stopImmediatePropagation(); }; editor.on("mousedown", preventMousedown, true); var clearSelectionReset = function() { return unbindEventListeners(); }; editor.once("longpresscancel", clearSelectionReset); var unbindEventListeners = function() { editor.off("touchend", selectionReset); editor.off("longpresscancel", clearSelectionReset); editor.off("mousedown", preventMousedown); }; }; var getAnchorSpec = function(editor, e2, anchorType) { var anchorSpec = getAnchorSpec$1(editor, e2, anchorType); var bubbleYOffset = anchorType === "point" ? bubbleSize : 0; return __assign({ bubble: nu$5(0, bubbleYOffset, bubbleAlignments), layouts, overrides: { maxWidthFunction: expandable(), maxHeightFunction: expandable$1() } }, anchorSpec); }; var show = function(editor, e2, items, backstage, contextmenu, anchorType, highlightImmediately) { var anchorSpec = getAnchorSpec(editor, e2, anchorType); build(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage, true).map(function(menuData) { e2.preventDefault(); InlineView.showMenuWithinBounds(contextmenu, { anchor: anchorSpec }, { menu: { markers: markers("normal"), highlightImmediately }, data: menuData, type: "horizontal" }, function() { return Optional.some(getContextToolbarBounds(editor, backstage.shared, anchorType === "node" ? "node" : "selection")); }); editor.fire(hideContextToolbarEvent); }); }; var initAndShow = function(editor, e2, buildMenu, backstage, contextmenu, anchorType) { var detection2 = detect$1(); var isiOS = detection2.os.isiOS(); var isOSX = detection2.os.isOSX(); var isAndroid = detection2.os.isAndroid(); var isTouch2 = detection2.deviceType.isTouch(); var shouldHighlightImmediately = function() { return !(isAndroid || isiOS || isOSX && isTouch2); }; var open7 = function() { var items = buildMenu(); show(editor, e2, items, backstage, contextmenu, anchorType, shouldHighlightImmediately()); }; if ((isOSX || isiOS) && anchorType !== "node") { var openiOS_1 = function() { setupiOSOverrides(editor); open7(); }; if (isTouchWithinSelection(editor, e2)) { openiOS_1(); } else { editor.once("selectionchange", openiOS_1); editor.once("touchend", function() { return editor.off("selectionchange", openiOS_1); }); } } else { open7(); } }; var patchPipeConfig = function(config4) { return typeof config4 === "string" ? config4.split(/[ ,]/) : config4; }; var shouldNeverUseNative = function(editor) { return editor.getParam("contextmenu_never_use_native", false, "boolean"); }; var getMenuItems = function(editor, name2, defaultItems) { var contextMenus = editor.ui.registry.getAll().contextMenus; return Optional.from(editor.getParam(name2)).map(patchPipeConfig).getOrThunk(function() { return filter$2(patchPipeConfig(defaultItems), function(item2) { return has$22(contextMenus, item2); }); }); }; var isContextMenuDisabled = function(editor) { return editor.getParam("contextmenu") === false; }; var getContextMenu = function(editor) { return getMenuItems(editor, "contextmenu", "link linkchecker image imagetools table spellchecker configurepermanentpen"); }; var getAvoidOverlapSelector = function(editor) { return editor.getParam("contextmenu_avoid_overlap", "", "string"); }; var isSeparator = function(item2) { return isString3(item2) ? item2 === "|" : item2.type === "separator"; }; var separator2 = { type: "separator" }; var makeContextItem = function(item2) { var commonMenuItem = function(item3) { return { text: item3.text, icon: item3.icon, disabled: item3.disabled, shortcut: item3.shortcut }; }; if (isString3(item2)) { return item2; } else { switch (item2.type) { case "separator": return separator2; case "submenu": return __assign(__assign({ type: "nestedmenuitem" }, commonMenuItem(item2)), { getSubmenuItems: function() { var items = item2.getSubmenuItems(); if (isString3(items)) { return items; } else { return map$2(items, makeContextItem); } } }); default: return __assign(__assign({ type: "menuitem" }, commonMenuItem(item2)), { onAction: noarg(item2.onAction) }); } } }; var addContextMenuGroup = function(xs, groupItems) { if (groupItems.length === 0) { return xs; } var lastMenuItem = last$2(xs).filter(function(item2) { return !isSeparator(item2); }); var before2 = lastMenuItem.fold(function() { return []; }, function(_2) { return [separator2]; }); return xs.concat(before2).concat(groupItems).concat([separator2]); }; var generateContextMenu = function(contextMenus, menuConfig, selectedElement) { var sections = foldl(menuConfig, function(acc, name2) { return get$e(contextMenus, name2.toLowerCase()).map(function(menu2) { var items = menu2.update(selectedElement); if (isString3(items)) { return addContextMenuGroup(acc, items.split(" ")); } else if (items.length > 0) { var allItems = map$2(items, makeContextItem); return addContextMenuGroup(acc, allItems); } else { return acc; } }).getOrThunk(function() { return acc.concat([name2]); }); }, []); if (sections.length > 0 && isSeparator(sections[sections.length - 1])) { sections.pop(); } return sections; }; var isNativeOverrideKeyEvent = function(editor, e2) { return e2.ctrlKey && !shouldNeverUseNative(editor); }; var isTriggeredByKeyboard = function(editor, e2) { return e2.type !== "longpress" && (e2.button !== 2 || e2.target === editor.getBody() && e2.pointerType === ""); }; var getSelectedElement = function(editor, e2) { return isTriggeredByKeyboard(editor, e2) ? editor.selection.getStart(true) : e2.target; }; var getAnchorType = function(editor, e2) { var selector2 = getAvoidOverlapSelector(editor); var anchorType = isTriggeredByKeyboard(editor, e2) ? "selection" : "point"; if (isNotEmpty(selector2)) { var target = getSelectedElement(editor, e2); var selectorExists = closest(SugarElement.fromDom(target), selector2); return selectorExists ? "node" : anchorType; } else { return anchorType; } }; var setup$5 = function(editor, lazySink, backstage) { var detection2 = detect$1(); var isTouch2 = detection2.deviceType.isTouch; var contextmenu = build$1(InlineView.sketch({ dom: { tag: "div" }, lazySink, onEscape: function() { return editor.focus(); }, onShow: function() { return backstage.setContextMenuState(true); }, onHide: function() { return backstage.setContextMenuState(false); }, fireDismissalEventInstead: {}, inlineBehaviours: derive$1([config3("dismissContextMenu", [run$1(dismissRequested(), function(comp, _se) { Sandboxing.close(comp); editor.focus(); })])]) })); var hideContextMenu = function(_e) { return InlineView.hide(contextmenu); }; var showContextMenu = function(e2) { if (shouldNeverUseNative(editor)) { e2.preventDefault(); } if (isNativeOverrideKeyEvent(editor, e2) || isContextMenuDisabled(editor)) { return; } var anchorType = getAnchorType(editor, e2); var buildMenu = function() { var selectedElement = getSelectedElement(editor, e2); var registry = editor.ui.registry.getAll(); var menuConfig = getContextMenu(editor); return generateContextMenu(registry.contextMenus, menuConfig, selectedElement); }; var initAndShow$2 = isTouch2() ? initAndShow : initAndShow$1; initAndShow$2(editor, e2, buildMenu, backstage, contextmenu, anchorType); }; editor.on("init", function() { var hideEvents = "ResizeEditor ScrollContent ScrollWindow longpresscancel" + (isTouch2() ? "" : " ResizeWindow"); editor.on(hideEvents, hideContextMenu); editor.on("longpress contextmenu", showContextMenu); }); }; var adt = Adt.generate([ { offset: [ "x", "y" ] }, { absolute: [ "x", "y" ] }, { fixed: [ "x", "y" ] } ]); var subtract2 = function(change2) { return function(point2) { return point2.translate(-change2.left, -change2.top); }; }; var add3 = function(change2) { return function(point2) { return point2.translate(change2.left, change2.top); }; }; var transform2 = function(changes) { return function(x2, y2) { return foldl(changes, function(rest, f2) { return f2(rest); }, SugarPosition(x2, y2)); }; }; var asFixed = function(coord, scroll, origin) { return coord.fold(transform2([ add3(origin), subtract2(scroll) ]), transform2([subtract2(scroll)]), transform2([])); }; var asAbsolute = function(coord, scroll, origin) { return coord.fold(transform2([add3(origin)]), transform2([]), transform2([add3(scroll)])); }; var asOffset = function(coord, scroll, origin) { return coord.fold(transform2([]), transform2([subtract2(origin)]), transform2([ add3(scroll), subtract2(origin) ])); }; var withinRange = function(coord1, coord2, xRange2, yRange2, scroll, origin) { var a1 = asAbsolute(coord1, scroll, origin); var a2 = asAbsolute(coord2, scroll, origin); return Math.abs(a1.left - a2.left) <= xRange2 && Math.abs(a1.top - a2.top) <= yRange2; }; var getDeltas = function(coord1, coord2, xRange2, yRange2, scroll, origin) { var a1 = asAbsolute(coord1, scroll, origin); var a2 = asAbsolute(coord2, scroll, origin); var left2 = Math.abs(a1.left - a2.left); var top2 = Math.abs(a1.top - a2.top); return SugarPosition(left2, top2); }; var toStyles = function(coord, scroll, origin) { var stylesOpt = coord.fold(function(x2, y2) { return { position: Optional.some("absolute"), left: Optional.some(x2 + "px"), top: Optional.some(y2 + "px") }; }, function(x2, y2) { return { position: Optional.some("absolute"), left: Optional.some(x2 - origin.left + "px"), top: Optional.some(y2 - origin.top + "px") }; }, function(x2, y2) { return { position: Optional.some("fixed"), left: Optional.some(x2 + "px"), top: Optional.some(y2 + "px") }; }); return __assign({ right: Optional.none(), bottom: Optional.none() }, stylesOpt); }; var translate = function(coord, deltaX, deltaY) { return coord.fold(function(x2, y2) { return offset4(x2 + deltaX, y2 + deltaY); }, function(x2, y2) { return absolute(x2 + deltaX, y2 + deltaY); }, function(x2, y2) { return fixed(x2 + deltaX, y2 + deltaY); }); }; var absorb = function(partialCoord, originalCoord, scroll, origin) { var absorbOne = function(stencil, nu2) { return function(optX, optY) { var original2 = stencil(originalCoord, scroll, origin); return nu2(optX.getOr(original2.left), optY.getOr(original2.top)); }; }; return partialCoord.fold(absorbOne(asOffset, offset4), absorbOne(asAbsolute, absolute), absorbOne(asFixed, fixed)); }; var offset4 = adt.offset; var absolute = adt.absolute; var fixed = adt.fixed; var parseAttrToInt = function(element2, name2) { var value25 = get$d(element2, name2); return isUndefined2(value25) ? NaN : parseInt(value25, 10); }; var get2 = function(component, snapsInfo) { var element2 = component.element; var x2 = parseAttrToInt(element2, snapsInfo.leftAttr); var y2 = parseAttrToInt(element2, snapsInfo.topAttr); return isNaN(x2) || isNaN(y2) ? Optional.none() : Optional.some(SugarPosition(x2, y2)); }; var set2 = function(component, snapsInfo, pt) { var element2 = component.element; set$8(element2, snapsInfo.leftAttr, pt.left + "px"); set$8(element2, snapsInfo.topAttr, pt.top + "px"); }; var clear2 = function(component, snapsInfo) { var element2 = component.element; remove$7(element2, snapsInfo.leftAttr); remove$7(element2, snapsInfo.topAttr); }; var getCoords = function(component, snapInfo, coord, delta) { return get2(component, snapInfo).fold(function() { return coord; }, function(fixed$12) { return fixed(fixed$12.left + delta.left, fixed$12.top + delta.top); }); }; var moveOrSnap = function(component, snapInfo, coord, delta, scroll, origin) { var newCoord = getCoords(component, snapInfo, coord, delta); var snap2 = snapInfo.mustSnap ? findClosestSnap(component, snapInfo, newCoord, scroll, origin) : findSnap(component, snapInfo, newCoord, scroll, origin); var fixedCoord = asFixed(newCoord, scroll, origin); set2(component, snapInfo, fixedCoord); return snap2.fold(function() { return { coord: fixed(fixedCoord.left, fixedCoord.top), extra: Optional.none() }; }, function(spanned) { return { coord: spanned.output, extra: spanned.extra }; }); }; var stopDrag = function(component, snapInfo) { clear2(component, snapInfo); }; var findMatchingSnap = function(snaps, newCoord, scroll, origin) { return findMap(snaps, function(snap2) { var sensor = snap2.sensor; var inRange = withinRange(newCoord, sensor, snap2.range.left, snap2.range.top, scroll, origin); return inRange ? Optional.some({ output: absorb(snap2.output, newCoord, scroll, origin), extra: snap2.extra }) : Optional.none(); }); }; var findClosestSnap = function(component, snapInfo, newCoord, scroll, origin) { var snaps = snapInfo.getSnapPoints(component); var matchSnap = findMatchingSnap(snaps, newCoord, scroll, origin); return matchSnap.orThunk(function() { var bestSnap = foldl(snaps, function(acc, snap2) { var sensor = snap2.sensor; var deltas = getDeltas(newCoord, sensor, snap2.range.left, snap2.range.top, scroll, origin); return acc.deltas.fold(function() { return { deltas: Optional.some(deltas), snap: Optional.some(snap2) }; }, function(bestDeltas) { var currAvg = (deltas.left + deltas.top) / 2; var bestAvg = (bestDeltas.left + bestDeltas.top) / 2; if (currAvg <= bestAvg) { return { deltas: Optional.some(deltas), snap: Optional.some(snap2) }; } else { return acc; } }); }, { deltas: Optional.none(), snap: Optional.none() }); return bestSnap.snap.map(function(snap2) { return { output: absorb(snap2.output, newCoord, scroll, origin), extra: snap2.extra }; }); }); }; var findSnap = function(component, snapInfo, newCoord, scroll, origin) { var snaps = snapInfo.getSnapPoints(component); return findMatchingSnap(snaps, newCoord, scroll, origin); }; var snapTo$1 = function(snap2, scroll, origin) { return { coord: absorb(snap2.output, snap2.output, scroll, origin), extra: snap2.extra }; }; var snapTo = function(component, dragConfig, _state, snap2) { var target = dragConfig.getTarget(component.element); if (dragConfig.repositionTarget) { var doc = owner$4(component.element); var scroll_1 = get$9(doc); var origin_1 = getOrigin(target); var snapPin = snapTo$1(snap2, scroll_1, origin_1); var styles = toStyles(snapPin.coord, scroll_1, origin_1); setOptions(target, styles); } }; var DraggingApis = /* @__PURE__ */ Object.freeze({ __proto__: null, snapTo }); var initialAttribute = "data-initial-z-index"; var resetZIndex = function(blocker) { parent2(blocker.element).filter(isElement$2).each(function(root2) { getOpt(root2, initialAttribute).fold(function() { return remove$6(root2, "z-index"); }, function(zIndex) { return set$7(root2, "z-index", zIndex); }); remove$7(root2, initialAttribute); }); }; var changeZIndex = function(blocker) { parent2(blocker.element).filter(isElement$2).each(function(root2) { getRaw(root2, "z-index").each(function(zindex) { set$8(root2, initialAttribute, zindex); }); set$7(root2, "z-index", get$c(blocker.element, "z-index")); }); }; var instigate = function(anyComponent, blocker) { anyComponent.getSystem().addToGui(blocker); changeZIndex(blocker); }; var discard = function(blocker) { resetZIndex(blocker); blocker.getSystem().removeFromGui(blocker); }; var createComponent = function(component, blockerClass, blockerEvents) { return component.getSystem().build(Container.sketch({ dom: { styles: { "left": "0px", "top": "0px", "width": "100%", "height": "100%", "position": "fixed", "z-index": "1000000000000000" }, classes: [blockerClass] }, events: blockerEvents })); }; var SnapSchema = optionObjOf("snaps", [ required$12("getSnapPoints"), onHandler("onSensor"), required$12("leftAttr"), required$12("topAttr"), defaulted("lazyViewport", win), defaulted("mustSnap", false) ]); var schema$6 = [ defaulted("useFixed", never), required$12("blockerClass"), defaulted("getTarget", identity$1), defaulted("onDrag", noop2), defaulted("repositionTarget", true), defaulted("onDrop", noop2), defaultedFunction("getBounds", win), SnapSchema ]; var getCurrentCoord = function(target) { return lift3(getRaw(target, "left"), getRaw(target, "top"), getRaw(target, "position"), function(left2, top2, position3) { var nu2 = position3 === "fixed" ? fixed : offset4; return nu2(parseInt(left2, 10), parseInt(top2, 10)); }).getOrThunk(function() { var location = absolute$3(target); return absolute(location.left, location.top); }); }; var clampCoords = function(component, coords, scroll, origin, startData) { var bounds2 = startData.bounds; var absoluteCoord = asAbsolute(coords, scroll, origin); var newX = clamp$1(absoluteCoord.left, bounds2.x, bounds2.x + bounds2.width - startData.width); var newY = clamp$1(absoluteCoord.top, bounds2.y, bounds2.y + bounds2.height - startData.height); var newCoords = absolute(newX, newY); return coords.fold(function() { var offset$12 = asOffset(newCoords, scroll, origin); return offset4(offset$12.left, offset$12.top); }, constant$1(newCoords), function() { var fixed$12 = asFixed(newCoords, scroll, origin); return fixed(fixed$12.left, fixed$12.top); }); }; var calcNewCoord = function(component, optSnaps, currentCoord, scroll, origin, delta, startData) { var newCoord = optSnaps.fold(function() { var translated = translate(currentCoord, delta.left, delta.top); var fixedCoord = asFixed(translated, scroll, origin); return fixed(fixedCoord.left, fixedCoord.top); }, function(snapInfo) { var snapping = moveOrSnap(component, snapInfo, currentCoord, delta, scroll, origin); snapping.extra.each(function(extra) { snapInfo.onSensor(component, extra); }); return snapping.coord; }); return clampCoords(component, newCoord, scroll, origin, startData); }; var dragBy = function(component, dragConfig, startData, delta) { var target = dragConfig.getTarget(component.element); if (dragConfig.repositionTarget) { var doc = owner$4(component.element); var scroll_1 = get$9(doc); var origin_1 = getOrigin(target); var currentCoord = getCurrentCoord(target); var newCoord = calcNewCoord(component, dragConfig.snaps, currentCoord, scroll_1, origin_1, delta, startData); var styles = toStyles(newCoord, scroll_1, origin_1); setOptions(target, styles); } dragConfig.onDrag(component, target, delta); }; var calcStartData = function(dragConfig, comp) { return { bounds: dragConfig.getBounds(), height: getOuter$2(comp.element), width: getOuter$1(comp.element) }; }; var move2 = function(component, dragConfig, dragState, dragMode, event) { var delta = dragState.update(dragMode, event); var dragStartData = dragState.getStartData().getOrThunk(function() { return calcStartData(dragConfig, component); }); delta.each(function(dlt) { dragBy(component, dragConfig, dragStartData, dlt); }); }; var stop2 = function(component, blocker, dragConfig, dragState) { blocker.each(discard); dragConfig.snaps.each(function(snapInfo) { stopDrag(component, snapInfo); }); var target = dragConfig.getTarget(component.element); dragState.reset(); dragConfig.onDrop(component, target); }; var handlers = function(events2) { return function(dragConfig, dragState) { var updateStartState = function(comp) { dragState.setStartData(calcStartData(dragConfig, comp)); }; return derive$2(__spreadArray([run$1(windowScroll(), function(comp) { dragState.getStartData().each(function() { return updateStartState(comp); }); })], events2(dragConfig, dragState, updateStartState), true)); }; }; var init$2 = function(dragApi) { return derive$2([ run$1(mousedown(), dragApi.forceDrop), run$1(mouseup(), dragApi.drop), run$1(mousemove(), function(comp, simulatedEvent) { dragApi.move(simulatedEvent.event); }), run$1(mouseout(), dragApi.delayDrop) ]); }; var getData$1 = function(event) { return Optional.from(SugarPosition(event.x, event.y)); }; var getDelta$1 = function(old, nu2) { return SugarPosition(nu2.left - old.left, nu2.top - old.top); }; var MouseData = /* @__PURE__ */ Object.freeze({ __proto__: null, getData: getData$1, getDelta: getDelta$1 }); var events$2 = function(dragConfig, dragState, updateStartState) { return [run$1(mousedown(), function(component, simulatedEvent) { var raw = simulatedEvent.event.raw; if (raw.button !== 0) { return; } simulatedEvent.stop(); var stop$1 = function() { return stop2(component, Optional.some(blocker), dragConfig, dragState); }; var delayDrop = DelayedFunction(stop$1, 200); var dragApi = { drop: stop$1, delayDrop: delayDrop.schedule, forceDrop: stop$1, move: function(event) { delayDrop.cancel(); move2(component, dragConfig, dragState, MouseData, event); } }; var blocker = createComponent(component, dragConfig.blockerClass, init$2(dragApi)); var start = function() { updateStartState(component); instigate(component, blocker); }; start(); })]; }; var schema$5 = __spreadArray(__spreadArray([], schema$6, true), [output$1("dragger", { handlers: handlers(events$2) })], false); var init$1 = function(dragApi) { return derive$2([ run$1(touchstart(), dragApi.forceDrop), run$1(touchend(), dragApi.drop), run$1(touchcancel(), dragApi.drop), run$1(touchmove(), function(comp, simulatedEvent) { dragApi.move(simulatedEvent.event); }) ]); }; var getDataFrom = function(touches) { var touch2 = touches[0]; return Optional.some(SugarPosition(touch2.clientX, touch2.clientY)); }; var getData = function(event) { var raw = event.raw; var touches = raw.touches; return touches.length === 1 ? getDataFrom(touches) : Optional.none(); }; var getDelta = function(old, nu2) { return SugarPosition(nu2.left - old.left, nu2.top - old.top); }; var TouchData = /* @__PURE__ */ Object.freeze({ __proto__: null, getData, getDelta }); var events$1 = function(dragConfig, dragState, updateStartState) { var blockerSingleton = value$1(); var stopBlocking = function(component) { stop2(component, blockerSingleton.get(), dragConfig, dragState); blockerSingleton.clear(); }; return [ run$1(touchstart(), function(component, simulatedEvent) { simulatedEvent.stop(); var stop3 = function() { return stopBlocking(component); }; var dragApi = { drop: stop3, delayDrop: noop2, forceDrop: stop3, move: function(event) { move2(component, dragConfig, dragState, TouchData, event); } }; var blocker = createComponent(component, dragConfig.blockerClass, init$1(dragApi)); blockerSingleton.set(blocker); var start = function() { updateStartState(component); instigate(component, blocker); }; start(); }), run$1(touchmove(), function(component, simulatedEvent) { simulatedEvent.stop(); move2(component, dragConfig, dragState, TouchData, simulatedEvent.event); }), run$1(touchend(), function(component, simulatedEvent) { simulatedEvent.stop(); stopBlocking(component); }), run$1(touchcancel(), stopBlocking) ]; }; var schema$4 = __spreadArray(__spreadArray([], schema$6, true), [output$1("dragger", { handlers: handlers(events$1) })], false); var events = function(dragConfig, dragState, updateStartState) { return __spreadArray(__spreadArray([], events$2(dragConfig, dragState, updateStartState), true), events$1(dragConfig, dragState, updateStartState), true); }; var schema$3 = __spreadArray(__spreadArray([], schema$6, true), [output$1("dragger", { handlers: handlers(events) })], false); var mouse = schema$5; var touch = schema$4; var mouseOrTouch = schema$3; var DraggingBranches = /* @__PURE__ */ Object.freeze({ __proto__: null, mouse, touch, mouseOrTouch }); var init = function() { var previous = Optional.none(); var startData = Optional.none(); var reset3 = function() { previous = Optional.none(); startData = Optional.none(); }; var calculateDelta = function(mode3, nu2) { var result = previous.map(function(old) { return mode3.getDelta(old, nu2); }); previous = Optional.some(nu2); return result; }; var update = function(mode3, dragEvent) { return mode3.getData(dragEvent).bind(function(nuData) { return calculateDelta(mode3, nuData); }); }; var setStartData = function(data65) { startData = Optional.some(data65); }; var getStartData = function() { return startData; }; var readState = constant$1({}); return nu$8({ readState, reset: reset3, update, getStartData, setStartData }); }; var DragState = /* @__PURE__ */ Object.freeze({ __proto__: null, init }); var Dragging = createModes({ branchKey: "mode", branches: DraggingBranches, name: "dragging", active: { events: function(dragConfig, dragState) { var dragger = dragConfig.dragger; return dragger.handlers(dragConfig, dragState); } }, extra: { snap: function(sConfig) { return { sensor: sConfig.sensor, range: sConfig.range, output: sConfig.output, extra: Optional.from(sConfig.extra) }; } }, state: DragState, apis: DraggingApis }); var snapWidth = 40; var snapOffset = snapWidth / 2; var calcSnap = function(selectorOpt, td, x2, y2, width2, height2) { return selectorOpt.fold(function() { return Dragging.snap({ sensor: absolute(x2 - snapOffset, y2 - snapOffset), range: SugarPosition(width2, height2), output: absolute(Optional.some(x2), Optional.some(y2)), extra: { td } }); }, function(selectorHandle) { var sensorLeft = x2 - snapOffset; var sensorTop = y2 - snapOffset; var sensorWidth = snapWidth; var sensorHeight = snapWidth; var rect2 = selectorHandle.element.dom.getBoundingClientRect(); return Dragging.snap({ sensor: absolute(sensorLeft, sensorTop), range: SugarPosition(sensorWidth, sensorHeight), output: absolute(Optional.some(x2 - rect2.width / 2), Optional.some(y2 - rect2.height / 2)), extra: { td } }); }); }; var getSnapsConfig = function(getSnapPoints, cell, onChange8) { var isSameCell = function(cellOpt, td) { return cellOpt.exists(function(currentTd) { return eq2(currentTd, td); }); }; return { getSnapPoints, leftAttr: "data-drag-left", topAttr: "data-drag-top", onSensor: function(component, extra) { var td = extra.td; if (!isSameCell(cell.get(), td)) { cell.set(td); onChange8(td); } }, mustSnap: true }; }; var createSelector = function(snaps) { return record(Button2.sketch({ dom: { tag: "div", classes: ["tox-selector"] }, buttonBehaviours: derive$1([ Dragging.config({ mode: "mouseOrTouch", blockerClass: "blocker", snaps }), Unselecting.config({}) ]), eventOrder: { mousedown: [ "dragging", "alloy.base.behaviour" ], touchstart: [ "dragging", "alloy.base.behaviour" ] } })); }; var setup$4 = function(editor, sink) { var tlTds = Cell3([]); var brTds = Cell3([]); var isVisible3 = Cell3(false); var startCell = value$1(); var finishCell = value$1(); var getTopLeftSnap = function(td) { var box2 = absolute$2(td); return calcSnap(memTopLeft.getOpt(sink), td, box2.x, box2.y, box2.width, box2.height); }; var getTopLeftSnaps = function() { return map$2(tlTds.get(), function(td) { return getTopLeftSnap(td); }); }; var getBottomRightSnap = function(td) { var box2 = absolute$2(td); return calcSnap(memBottomRight.getOpt(sink), td, box2.right, box2.bottom, box2.width, box2.height); }; var getBottomRightSnaps = function() { return map$2(brTds.get(), function(td) { return getBottomRightSnap(td); }); }; var topLeftSnaps = getSnapsConfig(getTopLeftSnaps, startCell, function(start) { finishCell.get().each(function(finish) { editor.fire("TableSelectorChange", { start, finish }); }); }); var bottomRightSnaps = getSnapsConfig(getBottomRightSnaps, finishCell, function(finish) { startCell.get().each(function(start) { editor.fire("TableSelectorChange", { start, finish }); }); }); var memTopLeft = createSelector(topLeftSnaps); var memBottomRight = createSelector(bottomRightSnaps); var topLeft = build$1(memTopLeft.asSpec()); var bottomRight = build$1(memBottomRight.asSpec()); var showOrHideHandle = function(selector2, cell, isAbove, isBelow) { var cellRect = cell.dom.getBoundingClientRect(); remove$6(selector2.element, "display"); var viewportHeight = defaultView(SugarElement.fromDom(editor.getBody())).dom.innerHeight; var aboveViewport = isAbove(cellRect); var belowViewport = isBelow(cellRect, viewportHeight); if (aboveViewport || belowViewport) { set$7(selector2.element, "display", "none"); } }; var snapTo2 = function(selector2, cell, getSnapConfig, pos) { var snap2 = getSnapConfig(cell); Dragging.snapTo(selector2, snap2); var isAbove = function(rect2) { return rect2[pos] < 0; }; var isBelow = function(rect2, viewportHeight) { return rect2[pos] > viewportHeight; }; showOrHideHandle(selector2, cell, isAbove, isBelow); }; var snapTopLeft = function(cell) { return snapTo2(topLeft, cell, getTopLeftSnap, "top"); }; var snapLastTopLeft = function() { return startCell.get().each(snapTopLeft); }; var snapBottomRight = function(cell) { return snapTo2(bottomRight, cell, getBottomRightSnap, "bottom"); }; var snapLastBottomRight = function() { return finishCell.get().each(snapBottomRight); }; if (detect$1().deviceType.isTouch()) { editor.on("TableSelectionChange", function(e2) { if (!isVisible3.get()) { attach(sink, topLeft); attach(sink, bottomRight); isVisible3.set(true); } startCell.set(e2.start); finishCell.set(e2.finish); e2.otherCells.each(function(otherCells) { tlTds.set(otherCells.upOrLeftCells); brTds.set(otherCells.downOrRightCells); snapTopLeft(e2.start); snapBottomRight(e2.finish); }); }); editor.on("ResizeEditor ResizeWindow ScrollContent", function() { snapLastTopLeft(); snapLastBottomRight(); }); editor.on("TableSelectionClear", function() { if (isVisible3.get()) { detach(topLeft); detach(bottomRight); isVisible3.set(false); } startCell.clear(); finishCell.clear(); }); } }; var isHidden2 = function(elm) { if (elm.nodeType === 1) { if (elm.nodeName === "BR" || !!elm.getAttribute("data-mce-bogus")) { return true; } if (elm.getAttribute("data-mce-type") === "bookmark") { return true; } } return false; }; var renderElementPath = function(editor, settings, providersBackstage) { if (!settings.delimiter) { settings.delimiter = "\xBB"; } var getDataPath = function(data65) { var parts2 = data65 || []; var newPathElements = map$2(parts2, function(part2, index2) { return Button2.sketch({ dom: { tag: "div", classes: ["tox-statusbar__path-item"], attributes: { "role": "button", "data-index": index2, "tab-index": -1, "aria-level": index2 + 1 }, innerHtml: part2.name }, action: function(_btn) { editor.focus(); editor.selection.select(part2.element); editor.nodeChanged(); }, buttonBehaviours: derive$1([ DisablingConfigs.button(providersBackstage.isDisabled), receivingConfig() ]) }); }); var divider = { dom: { tag: "div", classes: ["tox-statusbar__path-divider"], attributes: { "aria-hidden": true }, innerHtml: " " + settings.delimiter + " " } }; return foldl(newPathElements.slice(1), function(acc, element2) { var newAcc = acc; newAcc.push(divider); newAcc.push(element2); return newAcc; }, [newPathElements[0]]); }; var updatePath = function(parents) { var newPath = []; var i2 = parents.length; while (i2-- > 0) { var parent_1 = parents[i2]; if (parent_1.nodeType === 1 && !isHidden2(parent_1)) { var args = editor.fire("ResolveName", { name: parent_1.nodeName.toLowerCase(), target: parent_1 }); if (!args.isDefaultPrevented()) { newPath.push({ name: args.name, element: parent_1 }); } if (args.isPropagationStopped()) { break; } } } return newPath; }; return { dom: { tag: "div", classes: ["tox-statusbar__path"], attributes: { role: "navigation" } }, behaviours: derive$1([ Keying.config({ mode: "flow", selector: "div[role=button]" }), Disabling.config({ disabled: providersBackstage.isDisabled }), receivingConfig(), Tabstopping.config({}), Replacing.config({}), config3("elementPathEvents", [runOnAttached(function(comp, _e) { editor.shortcuts.add("alt+F11", "focus statusbar elementpath", function() { return Keying.focusIn(comp); }); editor.on("NodeChange", function(e2) { var newPath = updatePath(e2.parents); if (newPath.length > 0) { Replacing.set(comp, getDataPath(newPath)); } else { Replacing.set(comp, []); } }); })]) ]), components: [] }; }; var ResizeTypes; (function(ResizeTypes2) { ResizeTypes2[ResizeTypes2["None"] = 0] = "None"; ResizeTypes2[ResizeTypes2["Both"] = 1] = "Both"; ResizeTypes2[ResizeTypes2["Vertical"] = 2] = "Vertical"; })(ResizeTypes || (ResizeTypes = {})); var getDimensions = function(editor, deltas, resizeType, originalHeight, originalWidth) { var dimensions = {}; dimensions.height = calcCappedSize(originalHeight + deltas.top, getMinHeightSetting(editor), getMaxHeightSetting(editor)); if (resizeType === ResizeTypes.Both) { dimensions.width = calcCappedSize(originalWidth + deltas.left, getMinWidthSetting(editor), getMaxWidthSetting(editor)); } return dimensions; }; var resize = function(editor, deltas, resizeType) { var container = SugarElement.fromDom(editor.getContainer()); var dimensions = getDimensions(editor, deltas, resizeType, get$b(container), get$a(container)); each2(dimensions, function(val, dim) { return set$7(container, dim, numToPx(val)); }); fireResizeEditor(editor); }; var getResizeType = function(editor) { var fallback2 = !editor.hasPlugin("autoresize"); var resize2 = editor.getParam("resize", fallback2); if (resize2 === false) { return ResizeTypes.None; } else if (resize2 === "both") { return ResizeTypes.Both; } else { return ResizeTypes.Vertical; } }; var keyboardHandler = function(editor, resizeType, x2, y2) { var scale2 = 20; var delta = SugarPosition(x2 * scale2, y2 * scale2); resize(editor, delta, resizeType); return Optional.some(true); }; var renderResizeHandler = function(editor, providersBackstage) { var resizeType = getResizeType(editor); if (resizeType === ResizeTypes.None) { return Optional.none(); } return Optional.some(render$3("resize-handle", { tag: "div", classes: ["tox-statusbar__resize-handle"], attributes: { title: providersBackstage.translate("Resize") }, behaviours: [ Dragging.config({ mode: "mouse", repositionTarget: false, onDrag: function(_comp, _target, delta) { return resize(editor, delta, resizeType); }, blockerClass: "tox-blocker" }), Keying.config({ mode: "special", onLeft: function() { return keyboardHandler(editor, resizeType, -1, 0); }, onRight: function() { return keyboardHandler(editor, resizeType, 1, 0); }, onUp: function() { return keyboardHandler(editor, resizeType, 0, -1); }, onDown: function() { return keyboardHandler(editor, resizeType, 0, 1); } }), Tabstopping.config({}), Focusing.config({}) ] }, providersBackstage.icons)); }; var renderWordCount = function(editor, providersBackstage) { var _a4; var replaceCountText = function(comp, count3, mode3) { return Replacing.set(comp, [text$1(providersBackstage.translate([ "{0} " + mode3, count3[mode3] ]))]); }; return Button2.sketch({ dom: { tag: "button", classes: ["tox-statusbar__wordcount"] }, components: [], buttonBehaviours: derive$1([ DisablingConfigs.button(providersBackstage.isDisabled), receivingConfig(), Tabstopping.config({}), Replacing.config({}), Representing.config({ store: { mode: "memory", initialValue: { mode: "words", count: { words: 0, characters: 0 } } } }), config3("wordcount-events", [ runOnExecute$1(function(comp) { var currentVal = Representing.getValue(comp); var newMode = currentVal.mode === "words" ? "characters" : "words"; Representing.setValue(comp, { mode: newMode, count: currentVal.count }); replaceCountText(comp, currentVal.count, newMode); }), runOnAttached(function(comp) { editor.on("wordCountUpdate", function(e2) { var mode3 = Representing.getValue(comp).mode; Representing.setValue(comp, { mode: mode3, count: e2.wordCount }); replaceCountText(comp, e2.wordCount, mode3); }); }) ]) ]), eventOrder: (_a4 = {}, _a4[execute$5()] = [ "disabling", "alloy.base.behaviour", "wordcount-events" ], _a4) }); }; var renderStatusbar = function(editor, providersBackstage) { var renderBranding = function() { var label = global$e.translate([ "Powered by {0}", "Tiny" ]); var linkHtml = '' + label + ""; return { dom: { tag: "span", classes: ["tox-statusbar__branding"], innerHtml: linkHtml } }; }; var getTextComponents = function() { var components4 = []; if (editor.getParam("elementpath", true, "boolean")) { components4.push(renderElementPath(editor, {}, providersBackstage)); } if (editor.hasPlugin("wordcount")) { components4.push(renderWordCount(editor, providersBackstage)); } if (editor.getParam("branding", true, "boolean")) { components4.push(renderBranding()); } if (components4.length > 0) { return [{ dom: { tag: "div", classes: ["tox-statusbar__text-container"] }, components: components4 }]; } return []; }; var getComponents = function() { var components4 = getTextComponents(); var resizeHandler2 = renderResizeHandler(editor, providersBackstage); return components4.concat(resizeHandler2.toArray()); }; return { dom: { tag: "div", classes: ["tox-statusbar"] }, components: getComponents() }; }; var setup$3 = function(editor) { var _a4; var isInline = editor.inline; var mode3 = isInline ? Inline : Iframe; var header = isStickyToolbar(editor) ? StickyHeader : StaticHeader; var lazyOuterContainer = Optional.none(); var platform2 = detect$1(); var isIE = platform2.browser.isIE(); var platformClasses = isIE ? ["tox-platform-ie"] : []; var isTouch2 = platform2.deviceType.isTouch(); var touchPlatformClass = "tox-platform-touch"; var deviceClasses = isTouch2 ? [touchPlatformClass] : []; var isToolbarBottom = isToolbarLocationBottom(editor); var uiContainer = getUiContainer(editor); var dirAttributes = global$e.isRtl() ? { attributes: { dir: "rtl" } } : {}; var verticalDirAttributes = { attributes: (_a4 = {}, _a4[Attribute] = isToolbarBottom ? AttributeValue.BottomToTop : AttributeValue.TopToBottom, _a4) }; var lazyHeader = function() { return lazyOuterContainer.bind(OuterContainer.getHeader); }; var isHeaderDocked = function() { return header.isDocked(lazyHeader); }; var resizeUiMothership = function() { set$7(uiMothership.element, "width", document.body.clientWidth + "px"); }; var makeSinkDefinition = function() { var isGridUiContainer = eq2(body(), uiContainer) && get$c(uiContainer, "display") === "grid"; var sinkSpec = { dom: __assign({ tag: "div", classes: [ "tox", "tox-silver-sink", "tox-tinymce-aux" ].concat(platformClasses).concat(deviceClasses) }, dirAttributes), behaviours: derive$1([Positioning.config({ useFixed: function() { return isHeaderDocked(); } })]) }; var reactiveWidthSpec = { dom: { styles: { width: document.body.clientWidth + "px" } }, events: derive$2([run$1(windowResize(), resizeUiMothership)]) }; return deepMerge2(sinkSpec, isGridUiContainer ? reactiveWidthSpec : {}); }; var sink = build$1(makeSinkDefinition()); var lazySink = function() { return Result.value(sink); }; var memAnchorBar = record({ dom: { tag: "div", classes: ["tox-anchorbar"] } }); var lazyAnchorBar = function() { return lazyOuterContainer.bind(function(container) { return memAnchorBar.getOpt(container); }).getOrDie("Could not find a anchor bar element"); }; var lazyToolbar = function() { return lazyOuterContainer.bind(function(container) { return OuterContainer.getToolbar(container); }).getOrDie("Could not find more toolbar element"); }; var lazyThrobber = function() { return lazyOuterContainer.bind(function(container) { return OuterContainer.getThrobber(container); }).getOrDie("Could not find throbber element"); }; var backstage = init$7(sink, editor, lazyAnchorBar); var partMenubar2 = OuterContainer.parts.menubar({ dom: { tag: "div", classes: ["tox-menubar"] }, backstage, onEscape: function() { editor.focus(); } }); var toolbarMode = getToolbarMode(editor); var partToolbar2 = OuterContainer.parts.toolbar(__assign({ dom: { tag: "div", classes: ["tox-toolbar"] }, getSink: lazySink, providers: backstage.shared.providers, onEscape: function() { editor.focus(); }, type: toolbarMode, lazyToolbar, lazyHeader: function() { return lazyHeader().getOrDie("Could not find header element"); } }, verticalDirAttributes)); var partMultipleToolbar2 = OuterContainer.parts["multiple-toolbar"]({ dom: { tag: "div", classes: ["tox-toolbar-overlord"] }, providers: backstage.shared.providers, onEscape: function() { editor.focus(); }, type: toolbarMode }); var partSocket2 = OuterContainer.parts.socket({ dom: { tag: "div", classes: ["tox-edit-area"] } }); var partSidebar2 = OuterContainer.parts.sidebar({ dom: { tag: "div", classes: ["tox-sidebar"] } }); var partThrobber2 = OuterContainer.parts.throbber({ dom: { tag: "div", classes: ["tox-throbber"] }, backstage }); var sb = editor.getParam("statusbar", true, "boolean"); var statusbar = sb && !isInline ? Optional.some(renderStatusbar(editor, backstage.shared.providers)) : Optional.none(); var socketSidebarContainer = { dom: { tag: "div", classes: ["tox-sidebar-wrap"] }, components: [ partSocket2, partSidebar2 ] }; var hasMultipleToolbar = isMultipleToolbars(editor); var hasToolbar = isToolbarEnabled(editor); var hasMenubar = isMenubarEnabled(editor); var getPartToolbar = function() { if (hasMultipleToolbar) { return [partMultipleToolbar2]; } else if (hasToolbar) { return [partToolbar2]; } else { return []; } }; var partHeader2 = OuterContainer.parts.header({ dom: __assign({ tag: "div", classes: ["tox-editor-header"] }, verticalDirAttributes), components: flatten2([ hasMenubar ? [partMenubar2] : [], getPartToolbar(), useFixedContainer(editor) ? [] : [memAnchorBar.asSpec()] ]), sticky: isStickyToolbar(editor), editor, sharedBackstage: backstage.shared }); var editorComponents = flatten2([ isToolbarBottom ? [] : [partHeader2], isInline ? [] : [socketSidebarContainer], isToolbarBottom ? [partHeader2] : [] ]); var editorContainer = { dom: { tag: "div", classes: ["tox-editor-container"] }, components: editorComponents }; var containerComponents = flatten2([ [editorContainer], isInline ? [] : statusbar.toArray(), [partThrobber2] ]); var isHidden3 = isDistractionFree(editor); var attributes2 = __assign(__assign({ role: "application" }, global$e.isRtl() ? { dir: "rtl" } : {}), isHidden3 ? { "aria-hidden": "true" } : {}); var outerContainer = build$1(OuterContainer.sketch({ dom: { tag: "div", classes: [ "tox", "tox-tinymce" ].concat(isInline ? ["tox-tinymce-inline"] : []).concat(isToolbarBottom ? ["tox-tinymce--toolbar-bottom"] : []).concat(deviceClasses).concat(platformClasses), styles: __assign({ visibility: "hidden" }, isHidden3 ? { opacity: "0", border: "0" } : {}), attributes: attributes2 }, components: containerComponents, behaviours: derive$1([ receivingConfig(), Disabling.config({ disableClass: "tox-tinymce--disabled" }), Keying.config({ mode: "cyclic", selector: ".tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow--open, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a, .tox-statusbar__resize-handle" }) ]) })); lazyOuterContainer = Optional.some(outerContainer); editor.shortcuts.add("alt+F9", "focus menubar", function() { OuterContainer.focusMenubar(outerContainer); }); editor.shortcuts.add("alt+F10", "focus toolbar", function() { OuterContainer.focusToolbar(outerContainer); }); editor.addCommand("ToggleToolbarDrawer", function() { OuterContainer.toggleToolbarDrawer(outerContainer); }); editor.addQueryStateHandler("ToggleToolbarDrawer", function() { return OuterContainer.isToolbarDrawerToggled(outerContainer); }); var mothership = takeover(outerContainer); var uiMothership = takeover(sink); setup$b(editor, mothership, uiMothership); var getUi = function() { var channels = { broadcastAll: uiMothership.broadcast, broadcastOn: uiMothership.broadcastOn, register: noop2 }; return { channels }; }; var setEditorSize = function() { var parsedHeight = numToPx(getHeightWithFallback(editor)); var parsedWidth = numToPx(getWidthWithFallback(editor)); if (!editor.inline) { if (isValidValue("div", "width", parsedWidth)) { set$7(outerContainer.element, "width", parsedWidth); } if (isValidValue("div", "height", parsedHeight)) { set$7(outerContainer.element, "height", parsedHeight); } else { set$7(outerContainer.element, "height", "200px"); } } return parsedHeight; }; var renderUI = function() { header.setup(editor, backstage.shared, lazyHeader); setup$6(editor, backstage); setup$5(editor, lazySink, backstage); setup$8(editor); setup$7(editor, lazyThrobber, backstage.shared); map$1(getToolbarGroups(editor), function(toolbarGroupButtonConfig, name2) { editor.ui.registry.addGroupToolbarButton(name2, toolbarGroupButtonConfig); }); var _a5 = editor.ui.registry.getAll(), buttons = _a5.buttons, menuItems = _a5.menuItems, contextToolbars = _a5.contextToolbars, sidebars = _a5.sidebars; var toolbarOpt = getMultipleToolbarsSetting(editor); var rawUiConfig = { menuItems, menus: getMenus(editor), menubar: getMenubar(editor), toolbar: toolbarOpt.getOrThunk(function() { return getToolbar(editor); }), allowToolbarGroups: toolbarMode === ToolbarMode.floating, buttons, sidebar: sidebars }; register$7(editor, contextToolbars, sink, { backstage }); setup$4(editor, sink); var elm = editor.getElement(); var height2 = setEditorSize(); var uiComponents = { mothership, uiMothership, outerContainer }; var args = { targetNode: elm, height: height2 }; return mode3.render(editor, uiComponents, rawUiConfig, backstage, args); }; return { mothership, uiMothership, backstage, renderUI, getUi }; }; var describedBy = function(describedElement, describeElement) { var describeId = Optional.from(get$d(describedElement, "id")).fold(function() { var id2 = generate$6("dialog-describe"); set$8(describeElement, "id", id2); return id2; }, identity$1); set$8(describedElement, "aria-describedby", describeId); }; var labelledBy = function(labelledElement, labelElement) { var labelId = getOpt(labelledElement, "id").fold(function() { var id2 = generate$6("dialog-label"); set$8(labelElement, "id", id2); return id2; }, identity$1); set$8(labelledElement, "aria-labelledby", labelId); }; var schema$2 = constant$1([ required$12("lazySink"), option("dragBlockClass"), defaultedFunction("getBounds", win), defaulted("useTabstopAt", always), defaulted("eventOrder", {}), field("modalBehaviours", [Keying]), onKeyboardHandler("onExecute"), onStrictKeyboardHandler("onEscape") ]); var basic = { sketch: identity$1 }; var parts$2 = constant$1([ optional({ name: "draghandle", overrides: function(detail, spec) { return { behaviours: derive$1([Dragging.config({ mode: "mouse", getTarget: function(handle2) { return ancestor(handle2, '[role="dialog"]').getOr(handle2); }, blockerClass: detail.dragBlockClass.getOrDie(new Error("The drag blocker class was not specified for a dialog with a drag handle: \n" + JSON.stringify(spec, null, 2)).message), getBounds: detail.getDragBounds })]) }; } }), required2({ schema: [required$12("dom")], name: "title" }), required2({ factory: basic, schema: [required$12("dom")], name: "close" }), required2({ factory: basic, schema: [required$12("dom")], name: "body" }), optional({ factory: basic, schema: [required$12("dom")], name: "footer" }), external$1({ factory: { sketch: function(spec, detail) { return __assign(__assign({}, spec), { dom: detail.dom, components: detail.components }); } }, schema: [ defaulted("dom", { tag: "div", styles: { position: "fixed", left: "0px", top: "0px", right: "0px", bottom: "0px" } }), defaulted("components", []) ], name: "blocker" }) ]); var factory$4 = function(detail, components4, spec, externals) { var _a4; var dialogComp = value$1(); var showDialog = function(dialog) { dialogComp.set(dialog); var sink = detail.lazySink(dialog).getOrDie(); var externalBlocker = externals.blocker(); var blocker = sink.getSystem().build(__assign(__assign({}, externalBlocker), { components: externalBlocker.components.concat([premade(dialog)]), behaviours: derive$1([ Focusing.config({}), config3("dialog-blocker-events", [runOnSource(focusin(), function() { Keying.focusIn(dialog); })]) ]) })); attach(sink, blocker); Keying.focusIn(dialog); }; var hideDialog = function(dialog) { dialogComp.clear(); parent2(dialog.element).each(function(blockerDom) { dialog.getSystem().getByDom(blockerDom).each(function(blocker) { detach(blocker); }); }); }; var getDialogBody = function(dialog) { return getPartOrDie(dialog, detail, "body"); }; var getDialogFooter = function(dialog) { return getPartOrDie(dialog, detail, "footer"); }; var setBusy = function(dialog, getBusySpec2) { Blocking.block(dialog, getBusySpec2); }; var setIdle = function(dialog) { Blocking.unblock(dialog); }; var modalEventsId = generate$6("modal-events"); var eventOrder = __assign(__assign({}, detail.eventOrder), (_a4 = {}, _a4[attachedToDom()] = [modalEventsId].concat(detail.eventOrder["alloy.system.attached"] || []), _a4)); return { uid: detail.uid, dom: detail.dom, components: components4, apis: { show: showDialog, hide: hideDialog, getBody: getDialogBody, getFooter: getDialogFooter, setIdle, setBusy }, eventOrder, domModification: { attributes: { "role": "dialog", "aria-modal": "true" } }, behaviours: augment(detail.modalBehaviours, [ Replacing.config({}), Keying.config({ mode: "cyclic", onEnter: detail.onExecute, onEscape: detail.onEscape, useTabstopAt: detail.useTabstopAt }), Blocking.config({ getRoot: dialogComp.get }), config3(modalEventsId, [runOnAttached(function(c2) { labelledBy(c2.element, getPartOrDie(c2, detail, "title").element); describedBy(c2.element, getPartOrDie(c2, detail, "body").element); })]) ]) }; }; var ModalDialog = composite({ name: "ModalDialog", configFields: schema$2(), partFields: parts$2(), factory: factory$4, apis: { show: function(apis, dialog) { apis.show(dialog); }, hide: function(apis, dialog) { apis.hide(dialog); }, getBody: function(apis, dialog) { return apis.getBody(dialog); }, getFooter: function(apis, dialog) { return apis.getFooter(dialog); }, setBusy: function(apis, dialog, getBusySpec2) { apis.setBusy(dialog, getBusySpec2); }, setIdle: function(apis, dialog) { apis.setIdle(dialog); } } }); var dialogToggleMenuItemSchema = objOf([ requiredString("type"), requiredString("name") ].concat(commonMenuItemFields)); var dialogToggleMenuItemDataProcessor = boolean; var baseFooterButtonFields = [ field$1("name", "name", defaultedThunk(function() { return generate$6("button-name"); }), string2), optionString("icon"), defaultedStringEnum("align", "end", [ "start", "end" ]), defaultedBoolean("primary", false), defaultedBoolean("disabled", false) ]; var dialogFooterButtonFields = __spreadArray(__spreadArray([], baseFooterButtonFields, true), [requiredString("text")], false); var normalFooterButtonFields = __spreadArray([requiredStringEnum("type", [ "submit", "cancel", "custom" ])], dialogFooterButtonFields, true); var menuFooterButtonFields = __spreadArray([ requiredStringEnum("type", ["menu"]), optionString("text"), optionString("tooltip"), optionString("icon"), requiredArrayOf("items", dialogToggleMenuItemSchema) ], baseFooterButtonFields, true); var dialogFooterButtonSchema = choose$1("type", { submit: normalFooterButtonFields, cancel: normalFooterButtonFields, custom: normalFooterButtonFields, menu: menuFooterButtonFields }); var alertBannerFields = [ requiredString("type"), requiredString("text"), requiredStringEnum("level", [ "info", "warn", "error", "success" ]), requiredString("icon"), defaulted("url", "") ]; var alertBannerSchema = objOf(alertBannerFields); var createBarFields = function(itemsField) { return [ requiredString("type"), itemsField ]; }; var buttonFields = [ requiredString("type"), requiredString("text"), defaultedBoolean("disabled", false), defaultedBoolean("primary", false), field$1("name", "name", defaultedThunk(function() { return generate$6("button-name"); }), string2), optionString("icon"), defaultedBoolean("borderless", false) ]; var buttonSchema = objOf(buttonFields); var checkboxFields = [ requiredString("type"), requiredString("name"), requiredString("label"), defaultedBoolean("disabled", false) ]; var checkboxSchema = objOf(checkboxFields); var checkboxDataProcessor = boolean; var formComponentFields = [ requiredString("type"), requiredString("name") ]; var formComponentWithLabelFields = formComponentFields.concat([optionString("label")]); var collectionFields = formComponentWithLabelFields.concat([defaulted("columns", "auto")]); var collectionSchema = objOf(collectionFields); var collectionDataProcessor = arrOfObj([ requiredString("value"), requiredString("text"), requiredString("icon") ]); var colorInputFields = formComponentWithLabelFields; var colorInputSchema = objOf(colorInputFields); var colorInputDataProcessor = string2; var colorPickerFields = formComponentWithLabelFields; var colorPickerSchema = objOf(colorPickerFields); var colorPickerDataProcessor = string2; var customEditorFields = formComponentFields.concat([ defaultedString("tag", "textarea"), requiredString("scriptId"), requiredString("scriptUrl"), defaultedPostMsg("settings", void 0) ]); var customEditorFieldsOld = formComponentFields.concat([ defaultedString("tag", "textarea"), requiredFunction("init") ]); var customEditorSchema = valueOf2(function(v2) { return asRaw("customeditor.old", objOfOnly(customEditorFieldsOld), v2).orThunk(function() { return asRaw("customeditor.new", objOfOnly(customEditorFields), v2); }); }); var customEditorDataProcessor = string2; var dropZoneFields = formComponentWithLabelFields; var dropZoneSchema = objOf(dropZoneFields); var dropZoneDataProcessor = arrOfVal(); var createGridFields = function(itemsField) { return [ requiredString("type"), requiredNumber("columns"), itemsField ]; }; var htmlPanelFields = [ requiredString("type"), requiredString("html"), defaultedStringEnum("presets", "presentation", [ "presentation", "document" ]) ]; var htmlPanelSchema = objOf(htmlPanelFields); var iframeFields = formComponentWithLabelFields.concat([defaultedBoolean("sandboxed", true)]); var iframeSchema = objOf(iframeFields); var iframeDataProcessor = string2; var imageToolsFields = formComponentWithLabelFields.concat([requiredOf("currentState", objOf([ required$12("blob"), requiredString("url") ]))]); var imageToolsSchema = objOf(imageToolsFields); var inputFields = formComponentWithLabelFields.concat([ optionString("inputMode"), optionString("placeholder"), defaultedBoolean("maximized", false), defaultedBoolean("disabled", false) ]); var inputSchema = objOf(inputFields); var inputDataProcessor = string2; var createLabelFields = function(itemsField) { return [ requiredString("type"), requiredString("label"), itemsField ]; }; var listBoxSingleItemFields = [ requiredString("text"), requiredString("value") ]; var listBoxNestedItemFields = [ requiredString("text"), requiredArrayOf("items", thunkOf("items", function() { return listBoxItemSchema; })) ]; var listBoxItemSchema = oneOf([ objOf(listBoxSingleItemFields), objOf(listBoxNestedItemFields) ]); var listBoxFields = formComponentWithLabelFields.concat([ requiredArrayOf("items", listBoxItemSchema), defaultedBoolean("disabled", false) ]); var listBoxSchema = objOf(listBoxFields); var listBoxDataProcessor = string2; var selectBoxFields = formComponentWithLabelFields.concat([ requiredArrayOfObj("items", [ requiredString("text"), requiredString("value") ]), defaultedNumber("size", 1), defaultedBoolean("disabled", false) ]); var selectBoxSchema = objOf(selectBoxFields); var selectBoxDataProcessor = string2; var sizeInputFields = formComponentWithLabelFields.concat([ defaultedBoolean("constrain", true), defaultedBoolean("disabled", false) ]); var sizeInputSchema = objOf(sizeInputFields); var sizeInputDataProcessor = objOf([ requiredString("width"), requiredString("height") ]); var tableFields = [ requiredString("type"), requiredArrayOf("header", string2), requiredArrayOf("cells", arrOf(string2)) ]; var tableSchema = objOf(tableFields); var textAreaFields = formComponentWithLabelFields.concat([ optionString("placeholder"), defaultedBoolean("maximized", false), defaultedBoolean("disabled", false) ]); var textAreaSchema = objOf(textAreaFields); var textAreaDataProcessor = string2; var urlInputFields = formComponentWithLabelFields.concat([ defaultedStringEnum("filetype", "file", [ "image", "media", "file" ]), defaulted("disabled", false) ]); var urlInputSchema = objOf(urlInputFields); var urlInputDataProcessor = objOf([ requiredString("value"), defaulted("meta", {}) ]); var createItemsField = function(name2) { return field$1("items", "items", required$2(), arrOf(valueOf2(function(v2) { return asRaw("Checking item of " + name2, itemSchema, v2).fold(function(sErr) { return Result.error(formatError(sErr)); }, function(passValue) { return Result.value(passValue); }); }))); }; var itemSchema = valueThunk(function() { return choose$2("type", { alertbanner: alertBannerSchema, bar: objOf(createBarFields(createItemsField("bar"))), button: buttonSchema, checkbox: checkboxSchema, colorinput: colorInputSchema, colorpicker: colorPickerSchema, dropzone: dropZoneSchema, grid: objOf(createGridFields(createItemsField("grid"))), iframe: iframeSchema, input: inputSchema, listbox: listBoxSchema, selectbox: selectBoxSchema, sizeinput: sizeInputSchema, textarea: textAreaSchema, urlinput: urlInputSchema, customeditor: customEditorSchema, htmlpanel: htmlPanelSchema, imagetools: imageToolsSchema, collection: collectionSchema, label: objOf(createLabelFields(createItemsField("label"))), table: tableSchema, panel: panelSchema }); }); var panelFields = [ requiredString("type"), defaulted("classes", []), requiredArrayOf("items", itemSchema) ]; var panelSchema = objOf(panelFields); var tabFields = [ field$1("name", "name", defaultedThunk(function() { return generate$6("tab-name"); }), string2), requiredString("title"), requiredArrayOf("items", itemSchema) ]; var tabPanelFields = [ requiredString("type"), requiredArrayOfObj("tabs", tabFields) ]; var tabPanelSchema = objOf(tabPanelFields); var dialogButtonFields = dialogFooterButtonFields; var dialogButtonSchema = dialogFooterButtonSchema; var dialogSchema = objOf([ requiredString("title"), requiredOf("body", choose$2("type", { panel: panelSchema, tabpanel: tabPanelSchema })), defaultedString("size", "normal"), requiredArrayOf("buttons", dialogButtonSchema), defaulted("initialData", {}), defaultedFunction("onAction", noop2), defaultedFunction("onChange", noop2), defaultedFunction("onSubmit", noop2), defaultedFunction("onClose", noop2), defaultedFunction("onCancel", noop2), defaulted("onTabChange", noop2) ]); var createDialog = function(spec) { return asRaw("dialog", dialogSchema, spec); }; var urlDialogButtonSchema = objOf(__spreadArray([requiredStringEnum("type", [ "cancel", "custom" ])], dialogButtonFields, true)); var urlDialogSchema = objOf([ requiredString("title"), requiredString("url"), optionNumber("height"), optionNumber("width"), optionArrayOf("buttons", urlDialogButtonSchema), defaultedFunction("onAction", noop2), defaultedFunction("onCancel", noop2), defaultedFunction("onClose", noop2), defaultedFunction("onMessage", noop2) ]); var createUrlDialog = function(spec) { return asRaw("dialog", urlDialogSchema, spec); }; var getAllObjects = function(obj) { if (isObject3(obj)) { return [obj].concat(bind$32(values2(obj), getAllObjects)); } else if (isArray2(obj)) { return bind$32(obj, getAllObjects); } else { return []; } }; var isNamedItem = function(obj) { return isString3(obj.type) && isString3(obj.name); }; var dataProcessors = { checkbox: checkboxDataProcessor, colorinput: colorInputDataProcessor, colorpicker: colorPickerDataProcessor, dropzone: dropZoneDataProcessor, input: inputDataProcessor, iframe: iframeDataProcessor, sizeinput: sizeInputDataProcessor, selectbox: selectBoxDataProcessor, listbox: listBoxDataProcessor, size: sizeInputDataProcessor, textarea: textAreaDataProcessor, urlinput: urlInputDataProcessor, customeditor: customEditorDataProcessor, collection: collectionDataProcessor, togglemenuitem: dialogToggleMenuItemDataProcessor }; var getDataProcessor = function(item2) { return Optional.from(dataProcessors[item2.type]); }; var getNamedItems = function(structure) { return filter$2(getAllObjects(structure), isNamedItem); }; var createDataValidator = function(structure) { var namedItems = getNamedItems(structure); var fields2 = bind$32(namedItems, function(item2) { return getDataProcessor(item2).fold(function() { return []; }, function(schema3) { return [requiredOf(item2.name, schema3)]; }); }); return objOf(fields2); }; var extract = function(structure) { var internalDialog = getOrDie(createDialog(structure)); var dataValidator = createDataValidator(structure); var initialData = structure.initialData; return { internalDialog, dataValidator, initialData }; }; var DialogManager = { open: function(factory2, structure) { var extraction = extract(structure); return factory2(extraction.internalDialog, extraction.initialData, extraction.dataValidator); }, openUrl: function(factory2, structure) { var internalDialog = getOrDie(createUrlDialog(structure)); return factory2(internalDialog); }, redial: function(structure) { return extract(structure); } }; var toValidValues = function(values3) { var errors = []; var result = {}; each2(values3, function(value25, name2) { value25.fold(function() { errors.push(name2); }, function(v2) { result[name2] = v2; }); }); return errors.length > 0 ? Result.error(errors) : Result.value(result); }; var renderBodyPanel = function(spec, backstage) { var memForm = record(Form2.sketch(function(parts2) { return { dom: { tag: "div", classes: ["tox-form"].concat(spec.classes) }, components: map$2(spec.items, function(item2) { return interpretInForm(parts2, item2, backstage); }) }; })); return { dom: { tag: "div", classes: ["tox-dialog__body"] }, components: [{ dom: { tag: "div", classes: ["tox-dialog__body-content"] }, components: [memForm.asSpec()] }], behaviours: derive$1([ Keying.config({ mode: "acyclic", useTabstopAt: not(isPseudoStop) }), ComposingConfigs.memento(memForm), RepresentingConfigs.memento(memForm, { postprocess: function(formValue) { return toValidValues(formValue).fold(function(err) { console.error(err); return {}; }, identity$1); } }) ]) }; }; var factory$3 = function(detail, _spec) { return { uid: detail.uid, dom: detail.dom, components: detail.components, events: events$a(detail.action), behaviours: augment(detail.tabButtonBehaviours, [ Focusing.config({}), Keying.config({ mode: "execution", useSpace: true, useEnter: true }), Representing.config({ store: { mode: "memory", initialValue: detail.value } }) ]), domModification: detail.domModification }; }; var TabButton = single({ name: "TabButton", configFields: [ defaulted("uid", void 0), required$12("value"), field$1("dom", "dom", mergeWithThunk(function() { return { attributes: { "role": "tab", "id": generate$6("aria"), "aria-selected": "false" } }; }), anyValue()), option("action"), defaulted("domModification", {}), field("tabButtonBehaviours", [ Focusing, Keying, Representing ]), required$12("view") ], factory: factory$3 }); var schema$1 = constant$1([ required$12("tabs"), required$12("dom"), defaulted("clickToDismiss", false), field("tabbarBehaviours", [ Highlighting, Keying ]), markers$1([ "tabClass", "selectedClass" ]) ]); var tabsPart = group({ factory: TabButton, name: "tabs", unit: "tab", overrides: function(barDetail) { var dismissTab$1 = function(tabbar, button2) { Highlighting.dehighlight(tabbar, button2); emitWith(tabbar, dismissTab(), { tabbar, button: button2 }); }; var changeTab$1 = function(tabbar, button2) { Highlighting.highlight(tabbar, button2); emitWith(tabbar, changeTab(), { tabbar, button: button2 }); }; return { action: function(button2) { var tabbar = button2.getSystem().getByUid(barDetail.uid).getOrDie(); var activeButton = Highlighting.isHighlighted(tabbar, button2); var response = function() { if (activeButton && barDetail.clickToDismiss) { return dismissTab$1; } else if (!activeButton) { return changeTab$1; } else { return noop2; } }(); response(tabbar, button2); }, domModification: { classes: [barDetail.markers.tabClass] } }; } }); var parts$1 = constant$1([tabsPart]); var factory$2 = function(detail, components4, _spec, _externals) { return { "uid": detail.uid, "dom": detail.dom, components: components4, "debug.sketcher": "Tabbar", "domModification": { attributes: { role: "tablist" } }, "behaviours": augment(detail.tabbarBehaviours, [ Highlighting.config({ highlightClass: detail.markers.selectedClass, itemClass: detail.markers.tabClass, onHighlight: function(tabbar, tab) { set$8(tab.element, "aria-selected", "true"); }, onDehighlight: function(tabbar, tab) { set$8(tab.element, "aria-selected", "false"); } }), Keying.config({ mode: "flow", getInitial: function(tabbar) { return Highlighting.getHighlighted(tabbar).map(function(tab) { return tab.element; }); }, selector: "." + detail.markers.tabClass, executeOnMove: true }) ]) }; }; var Tabbar = composite({ name: "Tabbar", configFields: schema$1(), partFields: parts$1(), factory: factory$2 }); var factory$1 = function(detail, _spec) { return { uid: detail.uid, dom: detail.dom, behaviours: augment(detail.tabviewBehaviours, [Replacing.config({})]), domModification: { attributes: { role: "tabpanel" } } }; }; var Tabview = single({ name: "Tabview", configFields: [field("tabviewBehaviours", [Replacing])], factory: factory$1 }); var schema2 = constant$1([ defaulted("selectFirst", true), onHandler("onChangeTab"), onHandler("onDismissTab"), defaulted("tabs", []), field("tabSectionBehaviours", []) ]); var barPart = required2({ factory: Tabbar, schema: [ required$12("dom"), requiredObjOf("markers", [ required$12("tabClass"), required$12("selectedClass") ]) ], name: "tabbar", defaults: function(detail) { return { tabs: detail.tabs }; } }); var viewPart = required2({ factory: Tabview, name: "tabview" }); var parts = constant$1([ barPart, viewPart ]); var factory = function(detail, components4, _spec, _externals) { var changeTab$1 = function(button2) { var tabValue = Representing.getValue(button2); getPart(button2, detail, "tabview").each(function(tabview) { var tabWithValue = find$5(detail.tabs, function(t3) { return t3.value === tabValue; }); tabWithValue.each(function(tabData) { var panel = tabData.view(); getOpt(button2.element, "id").each(function(id2) { set$8(tabview.element, "aria-labelledby", id2); }); Replacing.set(tabview, panel); detail.onChangeTab(tabview, button2, panel); }); }); }; var changeTabBy = function(section, byPred) { getPart(section, detail, "tabbar").each(function(tabbar) { byPred(tabbar).each(emitExecute); }); }; return { uid: detail.uid, dom: detail.dom, components: components4, behaviours: get$22(detail.tabSectionBehaviours), events: derive$2(flatten2([ detail.selectFirst ? [runOnAttached(function(section, _simulatedEvent) { changeTabBy(section, Highlighting.getFirst); })] : [], [ run$1(changeTab(), function(section, simulatedEvent) { var button2 = simulatedEvent.event.button; changeTab$1(button2); }), run$1(dismissTab(), function(section, simulatedEvent) { var button2 = simulatedEvent.event.button; detail.onDismissTab(section, button2); }) ] ])), apis: { getViewItems: function(section) { return getPart(section, detail, "tabview").map(function(tabview) { return Replacing.contents(tabview); }).getOr([]); }, showTab: function(section, tabKey) { var getTabIfNotActive = function(tabbar) { var candidates = Highlighting.getCandidates(tabbar); var optTab = find$5(candidates, function(c2) { return Representing.getValue(c2) === tabKey; }); return optTab.filter(function(tab) { return !Highlighting.isHighlighted(tabbar, tab); }); }; changeTabBy(section, getTabIfNotActive); } } }; }; var TabSection = composite({ name: "TabSection", configFields: schema2(), partFields: parts(), factory, apis: { getViewItems: function(apis, component) { return apis.getViewItems(component); }, showTab: function(apis, component, tabKey) { apis.showTab(component, tabKey); } } }); var measureHeights = function(allTabs, tabview, tabviewComp) { return map$2(allTabs, function(_tab, i2) { Replacing.set(tabviewComp, allTabs[i2].view()); var rect2 = tabview.dom.getBoundingClientRect(); Replacing.set(tabviewComp, []); return rect2.height; }); }; var getMaxHeight = function(heights) { return head(sort(heights, function(a2, b3) { if (a2 > b3) { return -1; } else if (a2 < b3) { return 1; } else { return 0; } })); }; var getMaxTabviewHeight = function(dialog, tabview, tablist) { var documentElement$1 = documentElement(dialog).dom; var rootElm = ancestor(dialog, ".tox-dialog-wrap").getOr(dialog); var isFixed = get$c(rootElm, "position") === "fixed"; var maxHeight; if (isFixed) { maxHeight = Math.max(documentElement$1.clientHeight, window.innerHeight); } else { maxHeight = Math.max(documentElement$1.offsetHeight, documentElement$1.scrollHeight); } var tabviewHeight = get$b(tabview); var isTabListBeside = tabview.dom.offsetLeft >= tablist.dom.offsetLeft + get$a(tablist); var currentTabHeight = isTabListBeside ? Math.max(get$b(tablist), tabviewHeight) : tabviewHeight; var dialogTopMargin = parseInt(get$c(dialog, "margin-top"), 10) || 0; var dialogBottomMargin = parseInt(get$c(dialog, "margin-bottom"), 10) || 0; var dialogHeight = get$b(dialog) + dialogTopMargin + dialogBottomMargin; var chromeHeight = dialogHeight - currentTabHeight; return maxHeight - chromeHeight; }; var showTab = function(allTabs, comp) { head(allTabs).each(function(tab) { return TabSection.showTab(comp, tab.value); }); }; var setTabviewHeight = function(tabview, height2) { set$7(tabview, "height", height2 + "px"); if (!detect$1().browser.isIE()) { set$7(tabview, "flex-basis", height2 + "px"); } else { remove$6(tabview, "flex-basis"); } }; var updateTabviewHeight = function(dialogBody, tabview, maxTabHeight) { ancestor(dialogBody, '[role="dialog"]').each(function(dialog) { descendant(dialog, '[role="tablist"]').each(function(tablist) { maxTabHeight.get().map(function(height2) { set$7(tabview, "height", "0"); set$7(tabview, "flex-basis", "0"); return Math.min(height2, getMaxTabviewHeight(dialog, tabview, tablist)); }).each(function(height2) { setTabviewHeight(tabview, height2); }); }); }); }; var getTabview = function(dialog) { return descendant(dialog, '[role="tabpanel"]'); }; var setMode = function(allTabs) { var smartTabHeight = function() { var maxTabHeight = value$1(); var extraEvents = [ runOnAttached(function(comp) { var dialog = comp.element; getTabview(dialog).each(function(tabview) { set$7(tabview, "visibility", "hidden"); comp.getSystem().getByDom(tabview).toOptional().each(function(tabviewComp) { var heights = measureHeights(allTabs, tabview, tabviewComp); var maxTabHeightOpt = getMaxHeight(heights); maxTabHeightOpt.fold(maxTabHeight.clear, maxTabHeight.set); }); updateTabviewHeight(dialog, tabview, maxTabHeight); remove$6(tabview, "visibility"); showTab(allTabs, comp); global$f.requestAnimationFrame(function() { updateTabviewHeight(dialog, tabview, maxTabHeight); }); }); }), run$1(windowResize(), function(comp) { var dialog = comp.element; getTabview(dialog).each(function(tabview) { updateTabviewHeight(dialog, tabview, maxTabHeight); }); }), run$1(formResizeEvent, function(comp, _se) { var dialog = comp.element; getTabview(dialog).each(function(tabview) { var oldFocus = active(getRootNode(tabview)); set$7(tabview, "visibility", "hidden"); var oldHeight = getRaw(tabview, "height").map(function(h2) { return parseInt(h2, 10); }); remove$6(tabview, "height"); remove$6(tabview, "flex-basis"); var newHeight = tabview.dom.getBoundingClientRect().height; var hasGrown2 = oldHeight.forall(function(h2) { return newHeight > h2; }); if (hasGrown2) { maxTabHeight.set(newHeight); updateTabviewHeight(dialog, tabview, maxTabHeight); } else { oldHeight.each(function(h2) { setTabviewHeight(tabview, h2); }); } remove$6(tabview, "visibility"); oldFocus.each(focus$3); }); }) ]; var selectFirst = false; return { extraEvents, selectFirst }; }(); var naiveTabHeight = function() { var extraEvents = []; var selectFirst = true; return { extraEvents, selectFirst }; }(); return { smartTabHeight, naiveTabHeight }; }; var SendDataToSectionChannel = "send-data-to-section"; var SendDataToViewChannel = "send-data-to-view"; var renderTabPanel = function(spec, backstage) { var storedValue = Cell3({}); var updateDataWithForm = function(form) { var formData = Representing.getValue(form); var validData = toValidValues(formData).getOr({}); var currentData = storedValue.get(); var newData = deepMerge2(currentData, validData); storedValue.set(newData); }; var setDataOnForm = function(form) { var tabData = storedValue.get(); Representing.setValue(form, tabData); }; var oldTab = Cell3(null); var allTabs = map$2(spec.tabs, function(tab) { return { value: tab.name, dom: { tag: "div", classes: ["tox-dialog__body-nav-item"], innerHtml: backstage.shared.providers.translate(tab.title) }, view: function() { return [Form2.sketch(function(parts2) { return { dom: { tag: "div", classes: ["tox-form"] }, components: map$2(tab.items, function(item2) { return interpretInForm(parts2, item2, backstage); }), formBehaviours: derive$1([ Keying.config({ mode: "acyclic", useTabstopAt: not(isPseudoStop) }), config3("TabView.form.events", [ runOnAttached(setDataOnForm), runOnDetached(updateDataWithForm) ]), Receiving.config({ channels: wrapAll([ { key: SendDataToSectionChannel, value: { onReceive: updateDataWithForm } }, { key: SendDataToViewChannel, value: { onReceive: setDataOnForm } } ]) }) ]) }; })]; } }; }); var tabMode = setMode(allTabs).smartTabHeight; return TabSection.sketch({ dom: { tag: "div", classes: ["tox-dialog__body"] }, onChangeTab: function(section, button2, _viewItems) { var name2 = Representing.getValue(button2); emitWith(section, formTabChangeEvent, { name: name2, oldName: oldTab.get() }); oldTab.set(name2); }, tabs: allTabs, components: [ TabSection.parts.tabbar({ dom: { tag: "div", classes: ["tox-dialog__body-nav"] }, components: [Tabbar.parts.tabs({})], markers: { tabClass: "tox-tab", selectedClass: "tox-dialog__body-nav-item--active" }, tabbarBehaviours: derive$1([Tabstopping.config({})]) }), TabSection.parts.tabview({ dom: { tag: "div", classes: ["tox-dialog__body-content"] } }) ], selectFirst: tabMode.selectFirst, tabSectionBehaviours: derive$1([ config3("tabpanel", tabMode.extraEvents), Keying.config({ mode: "acyclic" }), Composing.config({ find: function(comp) { return head(TabSection.getViewItems(comp)); } }), Representing.config({ store: { mode: "manual", getValue: function(tsection) { tsection.getSystem().broadcastOn([SendDataToSectionChannel], {}); return storedValue.get(); }, setValue: function(tsection, value25) { storedValue.set(value25); tsection.getSystem().broadcastOn([SendDataToViewChannel], {}); } } }) ]) }); }; var dialogChannel = generate$6("update-dialog"); var titleChannel = generate$6("update-title"); var bodyChannel = generate$6("update-body"); var footerChannel = generate$6("update-footer"); var bodySendMessageChannel = generate$6("body-send-message"); var renderBody2 = function(spec, id2, backstage, ariaAttrs) { var renderComponents2 = function(incoming) { switch (incoming.body.type) { case "tabpanel": { return [renderTabPanel(incoming.body, backstage)]; } default: { return [renderBodyPanel(incoming.body, backstage)]; } } }; var updateState = function(_comp, incoming) { return Optional.some({ isTabPanel: function() { return incoming.body.type === "tabpanel"; } }); }; var ariaAttributes = { "aria-live": "polite" }; return { dom: { tag: "div", classes: ["tox-dialog__content-js"], attributes: __assign(__assign({}, id2.map(function(x2) { return { id: x2 }; }).getOr({})), ariaAttrs ? ariaAttributes : {}) }, components: [], behaviours: derive$1([ ComposingConfigs.childAt(0), Reflecting.config({ channel: bodyChannel, updateState, renderComponents: renderComponents2, initialData: spec }) ]) }; }; var renderInlineBody = function(spec, contentId, backstage, ariaAttrs) { return renderBody2(spec, Optional.some(contentId), backstage, ariaAttrs); }; var renderModalBody = function(spec, backstage) { var bodySpec = renderBody2(spec, Optional.none(), backstage, false); return ModalDialog.parts.body(bodySpec); }; var renderIframeBody = function(spec) { var bodySpec = { dom: { tag: "div", classes: ["tox-dialog__content-js"] }, components: [{ dom: { tag: "div", classes: ["tox-dialog__body-iframe"] }, components: [craft({ dom: { tag: "iframe", attributes: { src: spec.url } }, behaviours: derive$1([ Tabstopping.config({}), Focusing.config({}) ]) })] }], behaviours: derive$1([Keying.config({ mode: "acyclic", useTabstopAt: not(isPseudoStop) })]) }; return ModalDialog.parts.body(bodySpec); }; function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) { return typeof obj2; } : function(obj2) { return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }, _typeof2(obj); } function _setPrototypeOf2(o2, p) { _setPrototypeOf2 = Object.setPrototypeOf || function _setPrototypeOf3(o3, p2) { o3.__proto__ = p2; return o3; }; return _setPrototypeOf2(o2, p); } function _isNativeReflectConstruct2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { })); return true; } catch (e2) { return false; } } function _construct2(Parent, args, Class) { if (_isNativeReflectConstruct2()) { _construct2 = Reflect.construct; } else { _construct2 = function _construct3(Parent2, args2, Class2) { var a2 = [null]; a2.push.apply(a2, args2); var Constructor = Function.bind.apply(Parent2, a2); var instance = new Constructor(); if (Class2) _setPrototypeOf2(instance, Class2.prototype); return instance; }; } return _construct2.apply(null, arguments); } function _toConsumableArray2(arr) { return _arrayWithoutHoles2(arr) || _iterableToArray2(arr) || _unsupportedIterableToArray2(arr) || _nonIterableSpread2(); } function _arrayWithoutHoles2(arr) { if (Array.isArray(arr)) return _arrayLikeToArray2(arr); } function _iterableToArray2(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _unsupportedIterableToArray2(o2, minLen) { if (!o2) return; if (typeof o2 === "string") return _arrayLikeToArray2(o2, minLen); var n2 = Object.prototype.toString.call(o2).slice(8, -1); if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; if (n2 === "Map" || n2 === "Set") return Array.from(o2); if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray2(o2, minLen); } function _arrayLikeToArray2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) arr2[i2] = arr[i2]; return arr2; } function _nonIterableSpread2() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var hasOwnProperty2 = Object.hasOwnProperty, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var freeze = Object.freeze, seal = Object.seal, create = Object.create; var _ref = typeof Reflect !== "undefined" && Reflect, apply2 = _ref.apply, construct = _ref.construct; if (!apply2) { apply2 = function apply3(fun, thisValue, args) { return fun.apply(thisValue, args); }; } if (!freeze) { freeze = function freeze2(x2) { return x2; }; } if (!seal) { seal = function seal2(x2) { return x2; }; } if (!construct) { construct = function construct2(Func, args) { return _construct2(Func, _toConsumableArray2(args)); }; } var arrayForEach = unapply(Array.prototype.forEach); var arrayPop = unapply(Array.prototype.pop); var arrayPush2 = unapply(Array.prototype.push); var stringToLowerCase = unapply(String.prototype.toLowerCase); var stringMatch = unapply(String.prototype.match); var stringReplace = unapply(String.prototype.replace); var stringIndexOf = unapply(String.prototype.indexOf); var stringTrim = unapply(String.prototype.trim); var regExpTest = unapply(RegExp.prototype.test); var typeErrorCreate = unconstruct(TypeError); function unapply(func) { return function(thisArg) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return apply2(func, thisArg, args); }; } function unconstruct(func) { return function() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return construct(func, args); }; } function addToSet(set3, array3) { if (setPrototypeOf) { setPrototypeOf(set3, null); } var l3 = array3.length; while (l3--) { var element2 = array3[l3]; if (typeof element2 === "string") { var lcElement = stringToLowerCase(element2); if (lcElement !== element2) { if (!isFrozen(array3)) { array3[l3] = lcElement; } element2 = lcElement; } } set3[element2] = true; } return set3; } function clone4(object3) { var newObject = create(null); var property2; for (property2 in object3) { if (apply2(hasOwnProperty2, object3, [property2])) { newObject[property2] = object3[property2]; } } return newObject; } function lookupGetter(object3, prop) { while (object3 !== null) { var desc = getOwnPropertyDescriptor(object3, prop); if (desc) { if (desc.get) { return unapply(desc.get); } if (typeof desc.value === "function") { return unapply(desc.value); } } object3 = getPrototypeOf(object3); } function fallbackValue(element2) { console.warn("fallback value for", element2); return null; } return fallbackValue; } var html$1 = freeze([ "a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr" ]); var svg$1 = freeze([ "svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern" ]); var svgFilters = freeze([ "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence" ]); var svgDisallowed = freeze([ "animate", "color-profile", "cursor", "discard", "fedropshadow", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use" ]); var mathMl$1 = freeze([ "math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover" ]); var mathMlDisallowed = freeze([ "maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none" ]); var text = freeze(["#text"]); var html = freeze([ "accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot" ]); var svg = freeze([ "accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan" ]); var mathMl = freeze([ "accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns" ]); var xml = freeze([ "xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink" ]); var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); var ARIA_ATTR = seal(/^aria-[\-\w]+$/); var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i); var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g); var DOCTYPE_NAME = seal(/^html$/i); var getGlobal2 = function getGlobal3() { return typeof window === "undefined" ? null : window; }; var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, document2) { if (_typeof2(trustedTypes) !== "object" || typeof trustedTypes.createPolicy !== "function") { return null; } var suffix2 = null; var ATTR_NAME = "data-tt-policy-suffix"; if (document2.currentScript && document2.currentScript.hasAttribute(ATTR_NAME)) { suffix2 = document2.currentScript.getAttribute(ATTR_NAME); } var policyName = "dompurify" + (suffix2 ? "#" + suffix2 : ""); try { return trustedTypes.createPolicy(policyName, { createHTML: function createHTML(html2) { return html2; } }); } catch (_2) { console.warn("TrustedTypes policy " + policyName + " could not be created."); return null; } }; function createDOMPurify() { var window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal2(); var DOMPurify = function DOMPurify2(root2) { return createDOMPurify(root2); }; DOMPurify.version = "2.3.8"; DOMPurify.removed = []; if (!window2 || !window2.document || window2.document.nodeType !== 9) { DOMPurify.isSupported = false; return DOMPurify; } var originalDocument = window2.document; var document2 = window2.document; var DocumentFragment = window2.DocumentFragment, HTMLTemplateElement = window2.HTMLTemplateElement, Node2 = window2.Node, Element3 = window2.Element, NodeFilter = window2.NodeFilter, _window$NamedNodeMap = window2.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === void 0 ? window2.NamedNodeMap || window2.MozNamedAttrMap : _window$NamedNodeMap, HTMLFormElement = window2.HTMLFormElement, DOMParser2 = window2.DOMParser, trustedTypes = window2.trustedTypes; var ElementPrototype = Element3.prototype; var cloneNode = lookupGetter(ElementPrototype, "cloneNode"); var getNextSibling = lookupGetter(ElementPrototype, "nextSibling"); var getChildNodes = lookupGetter(ElementPrototype, "childNodes"); var getParentNode = lookupGetter(ElementPrototype, "parentNode"); if (typeof HTMLTemplateElement === "function") { var template = document2.createElement("template"); if (template.content && template.content.ownerDocument) { document2 = template.content.ownerDocument; } } var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument); var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML("") : ""; var _document = document2, implementation2 = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName; var importNode = originalDocument.importNode; var documentMode = {}; try { documentMode = clone4(document2).documentMode ? document2.documentMode : {}; } catch (_2) { } var hooks2 = {}; DOMPurify.isSupported = typeof getParentNode === "function" && implementation2 && typeof implementation2.createHTMLDocument !== "undefined" && documentMode !== 9; var MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE; var IS_ALLOWED_URI$1 = IS_ALLOWED_URI; var ALLOWED_TAGS = null; var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray2(html$1), _toConsumableArray2(svg$1), _toConsumableArray2(svgFilters), _toConsumableArray2(mathMl$1), _toConsumableArray2(text))); var ALLOWED_ATTR = null; var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray2(html), _toConsumableArray2(svg), _toConsumableArray2(mathMl), _toConsumableArray2(xml))); var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, { tagNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, attributeNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, allowCustomizedBuiltInElements: { writable: true, configurable: false, enumerable: true, value: false } })); var FORBID_TAGS = null; var FORBID_ATTR = null; var ALLOW_ARIA_ATTR = true; var ALLOW_DATA_ATTR = true; var ALLOW_UNKNOWN_PROTOCOLS = false; var SAFE_FOR_TEMPLATES = false; var WHOLE_DOCUMENT = false; var SET_CONFIG = false; var FORCE_BODY = false; var RETURN_DOM = false; var RETURN_DOM_FRAGMENT = false; var RETURN_TRUSTED_TYPE = false; var SANITIZE_DOM = true; var KEEP_CONTENT = true; var IN_PLACE = false; var USE_PROFILES = {}; var FORBID_CONTENTS = null; var DEFAULT_FORBID_CONTENTS = addToSet({}, [ "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" ]); var DATA_URI_TAGS = null; var DEFAULT_DATA_URI_TAGS = addToSet({}, [ "audio", "video", "img", "source", "image", "track" ]); var URI_SAFE_ATTRIBUTES = null; var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [ "alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns" ]); var MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML"; var SVG_NAMESPACE = "http://www.w3.org/2000/svg"; var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; var NAMESPACE = HTML_NAMESPACE; var IS_EMPTY_INPUT = false; var PARSER_MEDIA_TYPE; var SUPPORTED_PARSER_MEDIA_TYPES = [ "application/xhtml+xml", "text/html" ]; var DEFAULT_PARSER_MEDIA_TYPE = "text/html"; var transformCaseFunc; var CONFIG = null; var formElement = document2.createElement("form"); var isRegexOrFunction = function isRegexOrFunction2(testValue) { return testValue instanceof RegExp || testValue instanceof Function; }; var _parseConfig = function _parseConfig2(cfg) { if (CONFIG && CONFIG === cfg) { return; } if (!cfg || _typeof2(cfg) !== "object") { cfg = {}; } cfg = clone4(cfg); ALLOWED_TAGS = "ALLOWED_TAGS" in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS; ALLOWED_ATTR = "ALLOWED_ATTR" in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR; URI_SAFE_ATTRIBUTES = "ADD_URI_SAFE_ATTR" in cfg ? addToSet(clone4(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES; DATA_URI_TAGS = "ADD_DATA_URI_TAGS" in cfg ? addToSet(clone4(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS; FORBID_CONTENTS = "FORBID_CONTENTS" in cfg ? addToSet({}, cfg.FORBID_CONTENTS) : DEFAULT_FORBID_CONTENTS; FORBID_TAGS = "FORBID_TAGS" in cfg ? addToSet({}, cfg.FORBID_TAGS) : {}; FORBID_ATTR = "FORBID_ATTR" in cfg ? addToSet({}, cfg.FORBID_ATTR) : {}; USE_PROFILES = "USE_PROFILES" in cfg ? cfg.USE_PROFILES : false; ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; RETURN_DOM = cfg.RETURN_DOM || false; RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; FORCE_BODY = cfg.FORCE_BODY || false; SANITIZE_DOM = cfg.SANITIZE_DOM !== false; KEEP_CONTENT = cfg.KEEP_CONTENT !== false; IN_PLACE = cfg.IN_PLACE || false; IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1; NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") { CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; } PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? function(x2) { return x2; } : stringToLowerCase; if (SAFE_FOR_TEMPLATES) { ALLOW_DATA_ATTR = false; } if (RETURN_DOM_FRAGMENT) { RETURN_DOM = true; } if (USE_PROFILES) { ALLOWED_TAGS = addToSet({}, _toConsumableArray2(text)); ALLOWED_ATTR = []; if (USE_PROFILES.html === true) { addToSet(ALLOWED_TAGS, html$1); addToSet(ALLOWED_ATTR, html); } if (USE_PROFILES.svg === true) { addToSet(ALLOWED_TAGS, svg$1); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.svgFilters === true) { addToSet(ALLOWED_TAGS, svgFilters); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.mathMl === true) { addToSet(ALLOWED_TAGS, mathMl$1); addToSet(ALLOWED_ATTR, mathMl); addToSet(ALLOWED_ATTR, xml); } } if (cfg.ADD_TAGS) { if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { ALLOWED_TAGS = clone4(ALLOWED_TAGS); } addToSet(ALLOWED_TAGS, cfg.ADD_TAGS); } if (cfg.ADD_ATTR) { if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { ALLOWED_ATTR = clone4(ALLOWED_ATTR); } addToSet(ALLOWED_ATTR, cfg.ADD_ATTR); } if (cfg.ADD_URI_SAFE_ATTR) { addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR); } if (cfg.FORBID_CONTENTS) { if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { FORBID_CONTENTS = clone4(FORBID_CONTENTS); } addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS); } if (KEEP_CONTENT) { ALLOWED_TAGS["#text"] = true; } if (WHOLE_DOCUMENT) { addToSet(ALLOWED_TAGS, [ "html", "head", "body" ]); } if (ALLOWED_TAGS.table) { addToSet(ALLOWED_TAGS, ["tbody"]); delete FORBID_TAGS.tbody; } if (freeze) { freeze(cfg); } CONFIG = cfg; }; var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, [ "mi", "mo", "mn", "ms", "mtext" ]); var HTML_INTEGRATION_POINTS = addToSet({}, [ "foreignobject", "desc", "title", "annotation-xml" ]); var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [ "title", "style", "font", "a", "script" ]); var ALL_SVG_TAGS = addToSet({}, svg$1); addToSet(ALL_SVG_TAGS, svgFilters); addToSet(ALL_SVG_TAGS, svgDisallowed); var ALL_MATHML_TAGS = addToSet({}, mathMl$1); addToSet(ALL_MATHML_TAGS, mathMlDisallowed); var _checkValidNamespace = function _checkValidNamespace2(element2) { var parent3 = getParentNode(element2); if (!parent3 || !parent3.tagName) { parent3 = { namespaceURI: HTML_NAMESPACE, tagName: "template" }; } var tagName = stringToLowerCase(element2.tagName); var parentTagName = stringToLowerCase(parent3.tagName); if (element2.namespaceURI === SVG_NAMESPACE) { if (parent3.namespaceURI === HTML_NAMESPACE) { return tagName === "svg"; } if (parent3.namespaceURI === MATHML_NAMESPACE) { return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); } return Boolean(ALL_SVG_TAGS[tagName]); } if (element2.namespaceURI === MATHML_NAMESPACE) { if (parent3.namespaceURI === HTML_NAMESPACE) { return tagName === "math"; } if (parent3.namespaceURI === SVG_NAMESPACE) { return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName]; } return Boolean(ALL_MATHML_TAGS[tagName]); } if (element2.namespaceURI === HTML_NAMESPACE) { if (parent3.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { return false; } if (parent3.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { return false; } return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); } return false; }; var _forceRemove = function _forceRemove2(node) { arrayPush2(DOMPurify.removed, { element: node }); try { node.parentNode.removeChild(node); } catch (_2) { try { node.outerHTML = emptyHTML; } catch (_3) { node.remove(); } } }; var _removeAttribute = function _removeAttribute2(name2, node) { try { arrayPush2(DOMPurify.removed, { attribute: node.getAttributeNode(name2), from: node }); } catch (_2) { arrayPush2(DOMPurify.removed, { attribute: null, from: node }); } node.removeAttribute(name2); if (name2 === "is" && !ALLOWED_ATTR[name2]) { if (RETURN_DOM || RETURN_DOM_FRAGMENT) { try { _forceRemove(node); } catch (_2) { } } else { try { node.setAttribute(name2, ""); } catch (_2) { } } } }; var _initDocument = function _initDocument2(dirty) { var doc; var leadingWhitespace; if (FORCE_BODY) { dirty = "" + dirty; } else { var matches = stringMatch(dirty, /^[\r\n\t ]+/); leadingWhitespace = matches && matches[0]; } if (PARSER_MEDIA_TYPE === "application/xhtml+xml") { dirty = '' + dirty + ""; } var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; if (NAMESPACE === HTML_NAMESPACE) { try { doc = new DOMParser2().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); } catch (_2) { } } if (!doc || !doc.documentElement) { doc = implementation2.createDocument(NAMESPACE, "template", null); try { doc.documentElement.innerHTML = IS_EMPTY_INPUT ? "" : dirtyPayload; } catch (_2) { } } var body2 = doc.body || doc.documentElement; if (dirty && leadingWhitespace) { body2.insertBefore(document2.createTextNode(leadingWhitespace), body2.childNodes[0] || null); } if (NAMESPACE === HTML_NAMESPACE) { return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0]; } return WHOLE_DOCUMENT ? doc.documentElement : body2; }; var _createIterator = function _createIterator2(root2) { return createNodeIterator.call(root2.ownerDocument || root2, root2, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false); }; var _isClobbered = function _isClobbered2(elm) { return elm instanceof HTMLFormElement && (typeof elm.nodeName !== "string" || typeof elm.textContent !== "string" || typeof elm.removeChild !== "function" || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== "function" || typeof elm.setAttribute !== "function" || typeof elm.namespaceURI !== "string" || typeof elm.insertBefore !== "function"); }; var _isNode = function _isNode2(object3) { return _typeof2(Node2) === "object" ? object3 instanceof Node2 : object3 && _typeof2(object3) === "object" && typeof object3.nodeType === "number" && typeof object3.nodeName === "string"; }; var _executeHook = function _executeHook2(entryPoint, currentNode, data65) { if (!hooks2[entryPoint]) { return; } arrayForEach(hooks2[entryPoint], function(hook) { hook.call(DOMPurify, currentNode, data65, CONFIG); }); }; var _sanitizeElements = function _sanitizeElements2(currentNode) { var content; _executeHook("beforeSanitizeElements", currentNode, null); if (_isClobbered(currentNode)) { _forceRemove(currentNode); return true; } if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) { _forceRemove(currentNode); return true; } var tagName = transformCaseFunc(currentNode.nodeName); _executeHook("uponSanitizeElement", currentNode, { tagName, allowedTags: ALLOWED_TAGS }); if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { _forceRemove(currentNode); return true; } if (tagName === "select" && regExpTest(/