(); return; } const { _blocks: t, ...o } = e; this._blocks.forEach((i, r) => i.state = t[r]), super.state = o; } reset() { super.reset(), this._blocks.forEach((e) => e.reset()); } get isComplete() { return this.exposeBlock ? this.exposeBlock.isComplete : this._blocks.every((e) => e.isComplete); } get isFilled() { return this._blocks.every((e) => e.isFilled); } get isFixed() { return this._blocks.every((e) => e.isFixed); } get isOptional() { return this._blocks.every((e) => e.isOptional); } doCommit() { this._blocks.forEach((e) => e.doCommit()), super.doCommit(); } get unmaskedValue() { return this.exposeBlock ? this.exposeBlock.unmaskedValue : this._blocks.reduce((e, t) => e += t.unmaskedValue, ""); } set unmaskedValue(e) { if (this.exposeBlock) { const t = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length); this.exposeBlock.unmaskedValue = e, this.appendTail(t), this.doCommit(); } else super.unmaskedValue = e; } get value() { return this.exposeBlock ? this.exposeBlock.value : ( // TODO return _value when not in change? this._blocks.reduce((e, t) => e += t.value, "") ); } set value(e) { if (this.exposeBlock) { const t = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length); this.exposeBlock.value = e, this.appendTail(t), this.doCommit(); } else super.value = e; } get typedValue() { return this.exposeBlock ? this.exposeBlock.typedValue : super.typedValue; } set typedValue(e) { if (this.exposeBlock) { const t = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length); this.exposeBlock.typedValue = e, this.appendTail(t), this.doCommit(); } else super.typedValue = e; } get displayValue() { return this._blocks.reduce((e, t) => e += t.displayValue, ""); } appendTail(e) { return super.appendTail(e).aggregate(this._appendPlaceholder()); } _appendEager() { var e; const t = new I(); let o = (e = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : e.index; if (o == null) return t; this._blocks[o].isFilled && ++o; for (let i = o; i < this._blocks.length; ++i) { const r = this._blocks[i]._appendEager(); if (!r.inserted) break; t.aggregate(r); } return t; } _appendCharRaw(e, t) { t === void 0 && (t = {}); const o = this._mapPosToBlock(this.displayValue.length), i = new I(); if (!o) return i; for (let n = o.index, c; c = this._blocks[n]; ++n) { var r; const m = c._appendChar(e, { ...t, _beforeTailState: (r = t._beforeTailState) == null || (r = r._blocks) == null ? void 0 : r[n] }); if (i.aggregate(m), m.consumed) break; } return i; } extractTail(e, t) { e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length); const o = new ro(); return e === t || this._forEachBlocksInRange(e, t, (i, r, n, c) => { const m = i.extractTail(n, c); m.stop = this._findStopBefore(r), m.from = this._blockStartPos(r), m instanceof ro && (m.blockIndex = r), o.extend(m); }), o; } extractInput(e, t, o) { if (e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), o === void 0 && (o = {}), e === t) return ""; let i = ""; return this._forEachBlocksInRange(e, t, (r, n, c, m) => { i += r.extractInput(c, m, o); }), i; } _findStopBefore(e) { let t; for (let o = 0; o < this._stops.length; ++o) { const i = this._stops[o]; if (i <= e) t = i; else break; } return t; } /** Appends placeholder depending on laziness */ _appendPlaceholder(e) { const t = new I(); if (this.lazy && e == null) return t; const o = this._mapPosToBlock(this.displayValue.length); if (!o) return t; const i = o.index, r = e ?? this._blocks.length; return this._blocks.slice(i, r).forEach((n) => { if (!n.lazy || e != null) { var c; t.aggregate(n._appendPlaceholder((c = n._blocks) == null ? void 0 : c.length)); } }), t; } /** Finds block in pos */ _mapPosToBlock(e) { let t = ""; for (let o = 0; o < this._blocks.length; ++o) { const i = this._blocks[o], r = t.length; if (t += i.displayValue, e <= t.length) return { index: o, offset: e - r }; } } _blockStartPos(e) { return this._blocks.slice(0, e).reduce((t, o) => t += o.displayValue.length, 0); } _forEachBlocksInRange(e, t, o) { t === void 0 && (t = this.displayValue.length); const i = this._mapPosToBlock(e); if (i) { const r = this._mapPosToBlock(t), n = r && i.index === r.index, c = i.offset, m = r && n ? r.offset : this._blocks[i.index].displayValue.length; if (o(this._blocks[i.index], i.index, c, m), r && !n) { for (let g = i.index + 1; g < r.index; ++g) o(this._blocks[g], g, 0, this._blocks[g].displayValue.length); o(this._blocks[r.index], r.index, 0, r.offset); } } } remove(e, t) { e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length); const o = super.remove(e, t); return this._forEachBlocksInRange(e, t, (i, r, n, c) => { o.aggregate(i.remove(n, c)); }), o; } nearestInputPos(e, t) { if (t === void 0 && (t = B.NONE), !this._blocks.length) return 0; const o = new Rf(this, e); if (t === B.NONE) return o.pushRightBeforeInput() || (o.popState(), o.pushLeftBeforeInput()) ? o.pos : this.displayValue.length; if (t === B.LEFT || t === B.FORCE_LEFT) { if (t === B.LEFT) { if (o.pushRightBeforeFilled(), o.ok && o.pos === e) return e; o.popState(); } if (o.pushLeftBeforeInput(), o.pushLeftBeforeRequired(), o.pushLeftBeforeFilled(), t === B.LEFT) { if (o.pushRightBeforeInput(), o.pushRightBeforeRequired(), o.ok && o.pos <= e || (o.popState(), o.ok && o.pos <= e)) return o.pos; o.popState(); } return o.ok ? o.pos : t === B.FORCE_LEFT ? 0 : (o.popState(), o.ok || (o.popState(), o.ok) ? o.pos : 0); } return t === B.RIGHT || t === B.FORCE_RIGHT ? (o.pushRightBeforeInput(), o.pushRightBeforeRequired(), o.pushRightBeforeFilled() ? o.pos : t === B.FORCE_RIGHT ? this.displayValue.length : (o.popState(), o.ok || (o.popState(), o.ok) ? o.pos : this.nearestInputPos(e, B.LEFT))) : e; } totalInputPositions(e, t) { e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length); let o = 0; return this._forEachBlocksInRange(e, t, (i, r, n, c) => { o += i.totalInputPositions(n, c); }), o; } /** Get block by name */ maskedBlock(e) { return this.maskedBlocks(e)[0]; } /** Get all blocks by name */ maskedBlocks(e) { const t = this._maskedBlocks[e]; return t ? t.map((o) => this._blocks[o]) : []; } pad(e) { const t = new I(); return this._forEachBlocksInRange(0, this.displayValue.length, (o) => t.aggregate(o.pad(e))), t; } } de.DEFAULTS = { ...ce.DEFAULTS, lazy: !0, placeholderChar: "_" }; de.STOP_CHAR = "`"; de.ESCAPE_CHAR = "\\"; de.InputDefinition = sa; de.FixedDefinition = Bs; z.MaskedPattern = de; class Ki extends de { /** Optionally sets max length of pattern. Used when pattern length is longer then `to` param length. Pads zeros at start in this case. */ /** Min bound */ /** Max bound */ get _matchFrom() { return this.maxLength - String(this.from).length; } constructor(e) { super(e); } updateOptions(e) { super.updateOptions(e); } _update(e) { const { to: t = this.to || 0, from: o = this.from || 0, maxLength: i = this.maxLength || 0, autofix: r = this.autofix, ...n } = e; this.to = t, this.from = o, this.maxLength = Math.max(String(t).length, i), this.autofix = r; const c = String(this.from).padStart(this.maxLength, "0"), m = String(this.to).padStart(this.maxLength, "0"); let g = 0; for (; g < m.length && m[g] === c[g]; ) ++g; n.mask = m.slice(0, g).replace(/0/g, "\\0") + "0".repeat(this.maxLength - g), super._update(n); } get isComplete() { return super.isComplete && !!this.value; } boundaries(e) { let t = "", o = ""; const [, i, r] = e.match(/^(\D*)(\d*)(\D*)/) || []; return r && (t = "0".repeat(i.length) + r, o = "9".repeat(i.length) + r), t = t.padEnd(this.maxLength, "0"), o = o.padEnd(this.maxLength, "9"), [t, o]; } doPrepareChar(e, t) { t === void 0 && (t = {}); let o; return [e, o] = super.doPrepareChar(e.replace(/\D/g, ""), t), e || (o.skip = !this.isComplete), [e, o]; } _appendCharRaw(e, t) { if (t === void 0 && (t = {}), !this.autofix || this.value.length + 1 > this.maxLength) return super._appendCharRaw(e, t); const o = String(this.from).padStart(this.maxLength, "0"), i = String(this.to).padStart(this.maxLength, "0"), [r, n] = this.boundaries(this.value + e); return Number(n) < this.from ? super._appendCharRaw(o[this.value.length], t) : Number(r) > this.to ? !t.tail && this.autofix === "pad" && this.value.length + 1 < this.maxLength ? super._appendCharRaw(o[this.value.length], t).aggregate(this._appendCharRaw(e, t)) : super._appendCharRaw(i[this.value.length], t) : super._appendCharRaw(e, t); } doValidate(e) { const t = this.value; if (t.search(/[^0]/) === -1 && t.length <= this._matchFrom) return !0; const [i, r] = this.boundaries(t); return this.from <= Number(r) && Number(i) <= this.to && super.doValidate(e); } pad(e) { const t = new I(); if (this.value.length === this.maxLength) return t; const o = this.value, i = this.maxLength - this.value.length; if (i) { this.reset(); for (let r = 0; r < i; ++r) t.aggregate(super._appendCharRaw("0", e)); o.split("").forEach((r) => this._appendCharRaw(r)); } return t; } } z.MaskedRange = Ki; const Ef = "d{.}`m{.}`Y"; class yt extends de { static extractPatternOptions(e) { const { mask: t, pattern: o, ...i } = e; return { ...i, mask: Ft(t) ? t : o }; } /** Pattern mask for date according to {@link MaskedDate#format} */ /** Start date */ /** End date */ /** Format typed value to string */ /** Parse string to get typed value */ constructor(e) { super(yt.extractPatternOptions({ ...yt.DEFAULTS, ...e })); } updateOptions(e) { super.updateOptions(e); } _update(e) { const { mask: t, pattern: o, blocks: i, ...r } = { ...yt.DEFAULTS, ...e }, n = Object.assign({}, yt.GET_DEFAULT_BLOCKS()); e.min && (n.Y.from = e.min.getFullYear()), e.max && (n.Y.to = e.max.getFullYear()), e.min && e.max && n.Y.from === n.Y.to && (n.m.from = e.min.getMonth() + 1, n.m.to = e.max.getMonth() + 1, n.m.from === n.m.to && (n.d.from = e.min.getDate(), n.d.to = e.max.getDate())), Object.assign(n, this.blocks, i), super._update({ ...r, mask: Ft(t) ? t : o, blocks: n }); } doValidate(e) { const t = this.date; return super.doValidate(e) && (!this.isComplete || this.isDateExist(this.value) && t != null && (this.min == null || this.min <= t) && (this.max == null || t <= this.max)); } /** Checks if date is exists */ isDateExist(e) { return this.format(this.parse(e, this), this).indexOf(e) >= 0; } /** Parsed Date */ get date() { return this.typedValue; } set date(e) { this.typedValue = e; } get typedValue() { return this.isComplete ? super.typedValue : null; } set typedValue(e) { super.typedValue = e; } maskEquals(e) { return e === Date || super.maskEquals(e); } optionsIsChanged(e) { return super.optionsIsChanged(yt.extractPatternOptions(e)); } } yt.GET_DEFAULT_BLOCKS = () => ({ d: { mask: Ki, from: 1, to: 31, maxLength: 2 }, m: { mask: Ki, from: 1, to: 12, maxLength: 2 }, Y: { mask: Ki, from: 1900, to: 9999 } }); yt.DEFAULTS = { ...de.DEFAULTS, mask: Date, pattern: Ef, format: (a, e) => { if (!a) return ""; const t = String(a.getDate()).padStart(2, "0"), o = String(a.getMonth() + 1).padStart(2, "0"), i = a.getFullYear(); return [t, o, i].join("."); }, parse: (a, e) => { const [t, o, i] = a.split(".").map(Number); return new Date(i, o - 1, t); } }; z.MaskedDate = yt; class Sa extends ce { constructor(e) { super({ ...Sa.DEFAULTS, ...e }), this.currentMask = void 0; } updateOptions(e) { super.updateOptions(e); } _update(e) { super._update(e), "mask" in e && (this.exposeMask = void 0, this.compiledMasks = Array.isArray(e.mask) ? e.mask.map((t) => { const { expose: o, ...i } = pi(t), r = $t({ overwrite: this._overwrite, eager: this._eager, skipInvalid: this._skipInvalid, ...i }); return o && (this.exposeMask = r), r; }) : []); } _appendCharRaw(e, t) { t === void 0 && (t = {}); const o = this._applyDispatch(e, t); return this.currentMask && o.aggregate(this.currentMask._appendChar(e, this.currentMaskFlags(t))), o; } _applyDispatch(e, t, o) { e === void 0 && (e = ""), t === void 0 && (t = {}), o === void 0 && (o = ""); const i = t.tail && t._beforeTailState != null ? t._beforeTailState._value : this.value, r = this.rawInputValue, n = t.tail && t._beforeTailState != null ? t._beforeTailState._rawInputValue : r, c = r.slice(n.length), m = this.currentMask, g = new I(), f = m?.state; return this.currentMask = this.doDispatch(e, { ...t }, o), this.currentMask && (this.currentMask !== m ? (this.currentMask.reset(), n && (this.currentMask.append(n, { raw: !0 }), g.tailShift = this.currentMask.value.length - i.length), c && (g.tailShift += this.currentMask.append(c, { raw: !0, tail: !0 }).tailShift)) : f && (this.currentMask.state = f)), g; } _appendPlaceholder() { const e = this._applyDispatch(); return this.currentMask && e.aggregate(this.currentMask._appendPlaceholder()), e; } _appendEager() { const e = this._applyDispatch(); return this.currentMask && e.aggregate(this.currentMask._appendEager()), e; } appendTail(e) { const t = new I(); return e && t.aggregate(this._applyDispatch("", {}, e)), t.aggregate(this.currentMask ? this.currentMask.appendTail(e) : super.appendTail(e)); } currentMaskFlags(e) { var t, o; return { ...e, _beforeTailState: ((t = e._beforeTailState) == null ? void 0 : t.currentMaskRef) === this.currentMask && ((o = e._beforeTailState) == null ? void 0 : o.currentMask) || e._beforeTailState }; } doDispatch(e, t, o) { return t === void 0 && (t = {}), o === void 0 && (o = ""), this.dispatch(e, this, t, o); } doValidate(e) { return super.doValidate(e) && (!this.currentMask || this.currentMask.doValidate(this.currentMaskFlags(e))); } doPrepare(e, t) { t === void 0 && (t = {}); let [o, i] = super.doPrepare(e, t); if (this.currentMask) { let r; [o, r] = super.doPrepare(o, this.currentMaskFlags(t)), i = i.aggregate(r); } return [o, i]; } doPrepareChar(e, t) { t === void 0 && (t = {}); let [o, i] = super.doPrepareChar(e, t); if (this.currentMask) { let r; [o, r] = super.doPrepareChar(o, this.currentMaskFlags(t)), i = i.aggregate(r); } return [o, i]; } reset() { var e; (e = this.currentMask) == null || e.reset(), this.compiledMasks.forEach((t) => t.reset()); } get value() { return this.exposeMask ? this.exposeMask.value : this.currentMask ? this.currentMask.value : ""; } set value(e) { this.exposeMask ? (this.exposeMask.value = e, this.currentMask = this.exposeMask, this._applyDispatch()) : super.value = e; } get unmaskedValue() { return this.exposeMask ? this.exposeMask.unmaskedValue : this.currentMask ? this.currentMask.unmaskedValue : ""; } set unmaskedValue(e) { this.exposeMask ? (this.exposeMask.unmaskedValue = e, this.currentMask = this.exposeMask, this._applyDispatch()) : super.unmaskedValue = e; } get typedValue() { return this.exposeMask ? this.exposeMask.typedValue : this.currentMask ? this.currentMask.typedValue : ""; } set typedValue(e) { if (this.exposeMask) { this.exposeMask.typedValue = e, this.currentMask = this.exposeMask, this._applyDispatch(); return; } let t = String(e); this.currentMask && (this.currentMask.typedValue = e, t = this.currentMask.unmaskedValue), this.unmaskedValue = t; } get displayValue() { return this.currentMask ? this.currentMask.displayValue : ""; } get isComplete() { var e; return !!((e = this.currentMask) != null && e.isComplete); } get isFilled() { var e; return !!((e = this.currentMask) != null && e.isFilled); } remove(e, t) { const o = new I(); return this.currentMask && o.aggregate(this.currentMask.remove(e, t)).aggregate(this._applyDispatch()), o; } get state() { var e; return { ...super.state, _rawInputValue: this.rawInputValue, compiledMasks: this.compiledMasks.map((t) => t.state), currentMaskRef: this.currentMask, currentMask: (e = this.currentMask) == null ? void 0 : e.state }; } set state(e) { const { compiledMasks: t, currentMaskRef: o, currentMask: i, ...r } = e; t && this.compiledMasks.forEach((n, c) => n.state = t[c]), o != null && (this.currentMask = o, this.currentMask.state = i), super.state = r; } extractInput(e, t, o) { return this.currentMask ? this.currentMask.extractInput(e, t, o) : ""; } extractTail(e, t) { return this.currentMask ? this.currentMask.extractTail(e, t) : super.extractTail(e, t); } doCommit() { this.currentMask && this.currentMask.doCommit(), super.doCommit(); } nearestInputPos(e, t) { return this.currentMask ? this.currentMask.nearestInputPos(e, t) : super.nearestInputPos(e, t); } get overwrite() { return this.currentMask ? this.currentMask.overwrite : this._overwrite; } set overwrite(e) { this._overwrite = e; } get eager() { return this.currentMask ? this.currentMask.eager : this._eager; } set eager(e) { this._eager = e; } get skipInvalid() { return this.currentMask ? this.currentMask.skipInvalid : this._skipInvalid; } set skipInvalid(e) { this._skipInvalid = e; } get autofix() { return this.currentMask ? this.currentMask.autofix : this._autofix; } set autofix(e) { this._autofix = e; } maskEquals(e) { return Array.isArray(e) ? this.compiledMasks.every((t, o) => { if (!e[o]) return; const { mask: i, ...r } = e[o]; return na(t, r) && t.maskEquals(i); }) : super.maskEquals(e); } typedValueEquals(e) { var t; return !!((t = this.currentMask) != null && t.typedValueEquals(e)); } } Sa.DEFAULTS = { ...ce.DEFAULTS, dispatch: (a, e, t, o) => { if (!e.compiledMasks.length) return; const i = e.rawInputValue, r = e.compiledMasks.map((n, c) => { const m = e.currentMask === n, g = m ? n.displayValue.length : n.nearestInputPos(n.displayValue.length, B.FORCE_LEFT); return n.rawInputValue !== i ? (n.reset(), n.append(i, { raw: !0 })) : m || n.remove(g), n.append(a, e.currentMaskFlags(t)), n.appendTail(o), { index: c, weight: n.rawInputValue.length, totalInputPositions: n.totalInputPositions(0, Math.max(g, n.nearestInputPos(n.displayValue.length, B.FORCE_LEFT))) }; }); return r.sort((n, c) => c.weight - n.weight || c.totalInputPositions - n.totalInputPositions), e.compiledMasks[r[0].index]; } }; z.MaskedDynamic = Sa; class Oa extends de { constructor(e) { super({ ...Oa.DEFAULTS, ...e }); } updateOptions(e) { super.updateOptions(e); } _update(e) { const { enum: t, ...o } = e; if (t) { const i = t.map((c) => c.length), r = Math.min(...i), n = Math.max(...i) - r; o.mask = "*".repeat(r), n && (o.mask += "[" + "*".repeat(n) + "]"), this.enum = t; } super._update(o); } _appendCharRaw(e, t) { t === void 0 && (t = {}); const o = Math.min(this.nearestInputPos(0, B.FORCE_RIGHT), this.value.length), i = this.enum.filter((r) => this.matchValue(r, this.unmaskedValue + e, o)); if (i.length) { i.length === 1 && this._forEachBlocksInRange(0, this.value.length, (n, c) => { const m = i[0][c]; c >= this.value.length || m === n.value || (n.reset(), n._appendChar(m, t)); }); const r = super._appendCharRaw(i[0][this.value.length], t); return i.length === 1 && i[0].slice(this.unmaskedValue.length).split("").forEach((n) => r.aggregate(super._appendCharRaw(n))), r; } return new I({ skip: !this.isComplete }); } extractTail(e, t) { return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), new Qe("", e); } remove(e, t) { if (e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), e === t) return new I(); const o = Math.min(super.nearestInputPos(0, B.FORCE_RIGHT), this.value.length); let i; for (i = e; i >= 0 && !(this.enum.filter((c) => this.matchValue(c, this.value.slice(o, i), o)).length > 1); --i) ; const r = super.remove(i, t); return r.tailShift += i - e, r; } get isComplete() { return this.enum.indexOf(this.value) >= 0; } } Oa.DEFAULTS = { ...de.DEFAULTS, matchValue: (a, e, t) => a.indexOf(e, t) === t }; z.MaskedEnum = Oa; class Pf extends ce { /** */ /** Enable characters overwriting */ /** */ /** */ /** */ updateOptions(e) { super.updateOptions(e); } _update(e) { super._update({ ...e, validate: e.mask }); } } z.MaskedFunction = Pf; var Cs; class Le extends ce { /** Single char */ /** Single char */ /** Array of single chars */ /** */ /** */ /** Digits after point */ /** Flag to remove leading and trailing zeros in the end of editing */ /** Flag to pad trailing zeros after point in the end of editing */ /** Enable characters overwriting */ /** */ /** */ /** */ /** Format typed value to string */ /** Parse string to get typed value */ constructor(e) { super({ ...Le.DEFAULTS, ...e }); } updateOptions(e) { super.updateOptions(e); } _update(e) { super._update(e), this._updateRegExps(); } _updateRegExps() { const e = "^" + (this.allowNegative ? "[+|\\-]?" : ""), t = "\\d*", o = (this.scale ? "(" + Pa(this.radix) + "\\d{0," + this.scale + "})?" : "") + "$"; this._numberRegExp = new RegExp(e + t + o), this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(Pa).join("") + "]", "g"), this._thousandsSeparatorRegExp = new RegExp(Pa(this.thousandsSeparator), "g"); } _removeThousandsSeparators(e) { return e.replace(this._thousandsSeparatorRegExp, ""); } _insertThousandsSeparators(e) { const t = e.split(this.radix); return t[0] = t[0].replace(/\B(?=(\d{3})+(?!\d))/g, this.thousandsSeparator), t.join(this.radix); } doPrepareChar(e, t) { t === void 0 && (t = {}); const [o, i] = super.doPrepareChar(this._removeThousandsSeparators(this.scale && this.mapToRadix.length && /* radix should be mapped when 1) input is done from keyboard = flags.input && flags.raw 2) unmasked value is set = !flags.input && !flags.raw and should not be mapped when 1) value is set = flags.input && !flags.raw 2) raw value is set = !flags.input && flags.raw */ (t.input && t.raw || !t.input && !t.raw) ? e.replace(this._mapToRadixRegExp, this.radix) : e), t); return e && !o && (i.skip = !0), o && !this.allowPositive && !this.value && o !== "-" && i.aggregate(this._appendChar("-")), [o, i]; } _separatorsCount(e, t) { t === void 0 && (t = !1); let o = 0; for (let i = 0; i < e; ++i) this._value.indexOf(this.thousandsSeparator, i) === i && (++o, t && (e += this.thousandsSeparator.length)); return o; } _separatorsCountFromSlice(e) { return e === void 0 && (e = this._value), this._separatorsCount(this._removeThousandsSeparators(e).length, !0); } extractInput(e, t, o) { return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), [e, t] = this._adjustRangeWithSeparators(e, t), this._removeThousandsSeparators(super.extractInput(e, t, o)); } _appendCharRaw(e, t) { t === void 0 && (t = {}); const o = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, i = this._separatorsCountFromSlice(o); this._value = this._removeThousandsSeparators(this.value); const r = this._value; this._value += e; const n = this.number; let c = !isNaN(n), m = !1; if (c) { let x; this.min != null && this.min < 0 && this.number < this.min && (x = this.min), this.max != null && this.max > 0 && this.number > this.max && (x = this.max), x != null && (this.autofix ? (this._value = this.format(x, this).replace(Le.UNMASKED_RADIX, this.radix), m || (m = r === this._value && !t.tail)) : c = !1), c && (c = !!this._value.match(this._numberRegExp)); } let g; c ? g = new I({ inserted: this._value.slice(r.length), rawInserted: m ? "" : e, skip: m }) : (this._value = r, g = new I()), this._value = this._insertThousandsSeparators(this._value); const f = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, v = this._separatorsCountFromSlice(f); return g.tailShift += (v - i) * this.thousandsSeparator.length, g; } _findSeparatorAround(e) { if (this.thousandsSeparator) { const t = e - this.thousandsSeparator.length + 1, o = this.value.indexOf(this.thousandsSeparator, t); if (o <= e) return o; } return -1; } _adjustRangeWithSeparators(e, t) { const o = this._findSeparatorAround(e); o >= 0 && (e = o); const i = this._findSeparatorAround(t); return i >= 0 && (t = i + this.thousandsSeparator.length), [e, t]; } remove(e, t) { e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), [e, t] = this._adjustRangeWithSeparators(e, t); const o = this.value.slice(0, e), i = this.value.slice(t), r = this._separatorsCount(o.length); this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(o + i)); const n = this._separatorsCountFromSlice(o); return new I({ tailShift: (n - r) * this.thousandsSeparator.length }); } nearestInputPos(e, t) { if (!this.thousandsSeparator) return e; switch (t) { case B.NONE: case B.LEFT: case B.FORCE_LEFT: { const o = this._findSeparatorAround(e - 1); if (o >= 0) { const i = o + this.thousandsSeparator.length; if (e < i || this.value.length <= i || t === B.FORCE_LEFT) return o; } break; } case B.RIGHT: case B.FORCE_RIGHT: { const o = this._findSeparatorAround(e); if (o >= 0) return o + this.thousandsSeparator.length; } } return e; } doCommit() { if (this.value) { const e = this.number; let t = e; this.min != null && (t = Math.max(t, this.min)), this.max != null && (t = Math.min(t, this.max)), t !== e && (this.unmaskedValue = this.format(t, this)); let o = this.value; this.normalizeZeros && (o = this._normalizeZeros(o)), this.padFractionalZeros && this.scale > 0 && (o = this._padFractionalZeros(o)), this._value = o; } super.doCommit(); } _normalizeZeros(e) { const t = this._removeThousandsSeparators(e).split(this.radix); return t[0] = t[0].replace(/^(\D*)(0*)(\d*)/, (o, i, r, n) => i + n), e.length && !/\d$/.test(t[0]) && (t[0] = t[0] + "0"), t.length > 1 && (t[1] = t[1].replace(/0*$/, ""), t[1].length || (t.length = 1)), this._insertThousandsSeparators(t.join(this.radix)); } _padFractionalZeros(e) { if (!e) return e; const t = e.split(this.radix); return t.length < 2 && t.push(""), t[1] = t[1].padEnd(this.scale, "0"), t.join(this.radix); } doSkipInvalid(e, t, o) { t === void 0 && (t = {}); const i = this.scale === 0 && e !== this.thousandsSeparator && (e === this.radix || e === Le.UNMASKED_RADIX || this.mapToRadix.includes(e)); return super.doSkipInvalid(e, t, o) && !i; } get unmaskedValue() { return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, Le.UNMASKED_RADIX); } set unmaskedValue(e) { super.unmaskedValue = e; } get typedValue() { return this.parse(this.unmaskedValue, this); } set typedValue(e) { this.rawInputValue = this.format(e, this).replace(Le.UNMASKED_RADIX, this.radix); } /** Parsed Number */ get number() { return this.typedValue; } set number(e) { this.typedValue = e; } get allowNegative() { return this.min != null && this.min < 0 || this.max != null && this.max < 0; } get allowPositive() { return this.min != null && this.min > 0 || this.max != null && this.max > 0; } typedValueEquals(e) { return (super.typedValueEquals(e) || Le.EMPTY_VALUES.includes(e) && Le.EMPTY_VALUES.includes(this.typedValue)) && !(e === 0 && this.value === ""); } } Cs = Le; Le.UNMASKED_RADIX = "."; Le.EMPTY_VALUES = [...ce.EMPTY_VALUES, 0]; Le.DEFAULTS = { ...ce.DEFAULTS, mask: Number, radix: ",", thousandsSeparator: "", mapToRadix: [Cs.UNMASKED_RADIX], min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER, scale: 2, normalizeZeros: !0, padFractionalZeros: !1, parse: Number, format: (a) => a.toLocaleString("en-US", { useGrouping: !1, maximumFractionDigits: 20 }) }; z.MaskedNumber = Le; const Qa = { MASKED: "value", UNMASKED: "unmaskedValue", TYPED: "typedValue" }; function zs(a, e, t) { e === void 0 && (e = Qa.MASKED), t === void 0 && (t = Qa.MASKED); const o = $t(a); return (i) => o.runIsolated((r) => (r[e] = i, r[t])); } function Hf(a, e, t, o) { return zs(e, t, o)(a); } z.PIPE_TYPE = Qa; z.createPipe = zs; z.pipe = Hf; class Gf extends de { get repeatFrom() { var e; return (e = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === 1 / 0 ? 0 : this.repeat) != null ? e : 0; } get repeatTo() { var e; return (e = Array.isArray(this.repeat) ? this.repeat[1] : this.repeat) != null ? e : 1 / 0; } constructor(e) { super(e); } updateOptions(e) { super.updateOptions(e); } _update(e) { var t, o, i; const { repeat: r, ...n } = pi(e); this._blockOpts = Object.assign({}, this._blockOpts, n); const c = $t(this._blockOpts); this.repeat = (t = (o = r ?? c.repeat) != null ? o : this.repeat) != null ? t : 1 / 0, super._update({ mask: "m".repeat(Math.max(this.repeatTo === 1 / 0 && ((i = this._blocks) == null ? void 0 : i.length) || 0, this.repeatFrom)), blocks: { m: c }, eager: c.eager, overwrite: c.overwrite, skipInvalid: c.skipInvalid, lazy: c.lazy, placeholderChar: c.placeholderChar, displayChar: c.displayChar }); } _allocateBlock(e) { if (e < this._blocks.length) return this._blocks[e]; if (this.repeatTo === 1 / 0 || this._blocks.length < this.repeatTo) return this._blocks.push($t(this._blockOpts)), this.mask += "m", this._blocks[this._blocks.length - 1]; } _appendCharRaw(e, t) { t === void 0 && (t = {}); const o = new I(); for ( let m = (i = (r = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : r.index) != null ? i : Math.max(this._blocks.length - 1, 0), g, f; // try to get a block or // try to allocate a new block if not allocated already g = (n = this._blocks[m]) != null ? n : f = !f && this._allocateBlock(m); ++m ) { var i, r, n, c; const v = g._appendChar(e, { ...t, _beforeTailState: (c = t._beforeTailState) == null || (c = c._blocks) == null ? void 0 : c[m] }); if (v.skip && f) { this._blocks.pop(), this.mask = this.mask.slice(1); break; } if (o.aggregate(v), v.consumed) break; } return o; } _trimEmptyTail(e, t) { var o, i; e === void 0 && (e = 0); const r = Math.max(((o = this._mapPosToBlock(e)) == null ? void 0 : o.index) || 0, this.repeatFrom, 0); let n; t != null && (n = (i = this._mapPosToBlock(t)) == null ? void 0 : i.index), n == null && (n = this._blocks.length - 1); let c = 0; for (let m = n; r <= m && !this._blocks[m].unmaskedValue; --m, ++c) ; c && (this._blocks.splice(n - c + 1, c), this.mask = this.mask.slice(c)); } reset() { super.reset(), this._trimEmptyTail(); } remove(e, t) { e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length); const o = super.remove(e, t); return this._trimEmptyTail(e, t), o; } totalInputPositions(e, t) { return e === void 0 && (e = 0), t == null && this.repeatTo === 1 / 0 ? 1 / 0 : super.totalInputPositions(e, t); } get state() { return super.state; } set state(e) { this._blocks.length = e._blocks.length, this.mask = this.mask.slice(0, this._blocks.length), super.state = e; } } z.RepeatBlock = Gf; try { globalThis.IMask = z; } catch { } var Yf = Object.defineProperty, Tf = Object.getOwnPropertyDescriptor, pe = (a, e, t, o) => { for (var i = o > 1 ? void 0 : o ? Tf(e, t) : e, r = a.length - 1, n; r >= 0; r--) (n = a[r]) && (i = (o ? n(e, t, i) : n(i)) || i); return o && i && Yf(e, t, i), i; }; class re extends k { constructor() { super(...arguments), this.nestedHint = "", this.nestedPlaceholder = "", this.preserveHint = !1, this.preservePlaceholder = !1, this.mask = "", this.variant = "date", this.value = "", this.handleSlotChange = (e) => { const t = e.target; if (X(t, ["MAUI-INPUT"], 1, !1), this.maskedInput = t.assignedElements()[0], !this.maskedInput) throw new Error("No MAUI-INPUT element found"); this.maskedInput.setAttribute("controlled", ""), this.maskedInput.setAttribute("theme", this.theme), this.maskedInput.addEventListener( "maui-clear", () => this.handleInputClear() ); }; } handleInputClear() { this.value = "", this.masked.value = "", this.masked.unmaskedValue = "", this.maskedInput.value = ""; } createMaskedInput() { const { maskOptions: e } = this.getMask(); if (this.maskedInput && this.maskedInput.shadowRoot) { const t = this.maskedInput.shadowRoot.querySelector( ".control" ); this.masked = z(t, e), this.masked.on("complete", () => { this.maskedInput.value = this.masked.value.replace( /[\u{0080}-\u{10FFFF}]/gu, "" ), this.value = this.masked.value.replace(/[\u{0080}-\u{10FFFF}]/gu, ""), this.emit("maui-complete", { detail: { value: { masked: this.masked.value.replace(/[\u{0080}-\u{10FFFF}]/gu, ""), unmasked: this.masked.unmaskedValue } } }); }); } } getMask() { let e = { lazy: !0, eager: !0, overwrite: !0 }; const t = { locale: this.customLocale || navigator.languages[0] }; switch (this.variant) { case "date": { const { format: o, separators: i } = kr(t), [r, n, c] = an( this.minDate || (/* @__PURE__ */ new Date("01/01/1900")).toISOString() ), [m, g, f] = an( this.maxDate || (/* @__PURE__ */ new Date("12/31/9999")).toISOString() ), v = `${o.split(i[0].replace(/[\u{0080}-\u{10FFFF}]/gu, "")).join(`${i[0].replace(/[\u{0080}-\u{10FFFF}]/gu, "")}\``).replace(/[\u{0080}-\u{10FFFF}]/gu, "")}`; this.mask = o, e = { ...e, lazy: !0, mask: o, overwrite: !1, autofix: !0, pattern: v, blocks: { DD: { mask: z.MaskedRange, from: n, to: g, maxLength: 2, placeholderChar: "D" }, MM: { mask: z.MaskedRange, from: r, to: m, maxLength: 2, placeholderChar: "M" }, YYYY: { mask: z.MaskedRange, from: c, to: f, maxLength: 4, placeholderChar: "Y" } } }; break; } case "ticketnr": { this.mask = "123-4567890123", e = { mask: "000-0000000000", eager: !0, overwrite: !0 }; break; } case "flightnr": { this.mask = `${this.theme === "b2b" ? "LH" : this.theme?.toUpperCase()} 100`, e = { ...e, mask: "aa 000[0]", prepareChar: (o) => o.toUpperCase() }; break; } case "custom": { if (!this.mask) throw new Error("No mask provided"); e = { ...e, mask: this.mask }; break; } default: this.mask = ""; } return { mask: this.mask, maskOptions: e }; } destroyMaskedInput() { this.masked && (this.masked.off("complete"), this.masked.destroy(), this.masked = null); } handleInput(e) { e.stopPropagation(), this.maskedInput.value = this.masked.value.replace( /[\u{0080}-\u{10FFFF}]/gu, "" ), this.emit("maui-input", { detail: { value: { masked: this.masked.value.replace(/[\u{0080}-\u{10FFFF}]/gu, ""), unmasked: this.masked.unmaskedValue } } }); } updateHint() { this.preserveHint ? this.maskedInput.setAttribute("hint", this.nestedHint) : this.maskedInput.setAttribute( "hint", this.getMask().mask || this.nestedHint ); } updatePlaceHolder() { this.preservePlaceholder ? this.maskedInput.setAttribute("placeholder", this.nestedPlaceholder) : this.maskedInput.setAttribute( "placeholder", this.getMask().mask || this.nestedPlaceholder ); } disconnectedCallback() { this.destroyMaskedInput(), super.disconnectedCallback(); } watchMaskedInput() { this.masked && this.destroyMaskedInput(), this.nestedHint = this.maskedInput.getAttribute("hint") || "", this.nestedPlaceholder = this.maskedInput.getAttribute("placeholder") || "", this.updateHint(), this.updatePlaceHolder(), this.createMaskedInput(), this.value && (this.masked.value = this.value); } watchPreserveHint() { this.maskedInput && this.updateHint(); } watchPreservePlaceholder() { this.maskedInput && this.updatePlaceHolder(); } watchValue() { this.masked && (this.masked.value = this.value); } render() { return u`
`; } } pe([ O() ], re.prototype, "masked", 2); pe([ O() ], re.prototype, "maskedInput", 2); pe([ O() ], re.prototype, "nestedHint", 2); pe([ O() ], re.prototype, "nestedPlaceholder", 2); pe([ l({ type: Boolean, reflect: !0 }) ], re.prototype, "preserveHint", 2); pe([ l({ type: Boolean, reflect: !0 }) ], re.prototype, "preservePlaceholder", 2); pe([ l({ type: String, reflect: !0 }) ], re.prototype, "mask", 2); pe([ l({ type: String }) ], re.prototype, "variant", 2); pe([ l({ type: String, attribute: "custom-locale", reflect: !0 }) ], re.prototype, "customLocale", 2); pe([ l({ type: String, reflect: !0 }) ], re.prototype, "value", 2); pe([ l({ type: String, attribute: "min-date", reflect: !0 }) ], re.prototype, "minDate", 2); pe([ l({ type: String, attribute: "max-date", reflect: !0 }) ], re.prototype, "maxDate", 2); pe([ F("maskedInput") ], re.prototype, "watchMaskedInput", 1); pe([ F("preserveHint") ], re.prototype, "watchPreserveHint", 1); pe([ F("preservePlaceholder") ], re.prototype, "watchPreservePlaceholder", 1); pe([ F("value") ], re.prototype, "watchValue", 1); w("maui-masked-input", re); const Xf = s` .miles-and-more-info { display: flex; flex-direction: column; gap: var(--maui-spacing-3); } @media screen and (min-width: ${S.phablet["min-width"]}px) { .miles-and-more-info { flex-direction: row; column-gap: var(--maui-spacing-4); } .miles-and-more-info maui-copy { align-self: center; } } `, Vf = s` .os.miles-and-more-info { row-gap: var(--maui-spacing-2); } `, jf = [Xf, Vf]; var qf = Object.defineProperty, Kf = Object.getOwnPropertyDescriptor, Cr = (a, e, t, o) => { for (var i = o > 1 ? void 0 : o ? Kf(e, t) : e, r = a.length - 1, n; r >= 0; r--) (n = a[r]) && (i = (o ? n(e, t, i) : n(i)) || i); return o && i && qf(e, t, i), i; }; class Fi extends k { constructor() { super(), this.badgePreset = "mam", this.componentName = "miles-and-more-info"; } render() { return u`
${this.serviceCardNumber}
`; } } Fi.styles = jf; Cr([ l({ type: String }) ], Fi.prototype, "mamStatus", 2); Cr([ l({ type: String }) ], Fi.prototype, "badgePreset", 2); Cr([ l({ type: String }) ], Fi.prototype, "serviceCardNumber", 2); w("maui-miles-and-more-info", Fi); function oo(a, e, t) { return new Promise((o) => { if (t?.duration === 1 / 0) throw new Error("Promise-based animations must be finite."); const i = a.animate(e, { ...t, // eslint-disable-next-line no-use-before-define duration: Wf() ? 0 : t.duration }); i.addEventListener("cancel", o, { once: !0 }), i.addEventListener("finish", o, { once: !0 }); }); } function Wf() { return window.matchMedia("(prefers-reduced-motion: reduce)").matches; } function Xi(a) { return Promise.all( a.getAnimations().map( (e) => new Promise((t) => { const o = requestAnimationFrame(t); e.addEventListener("cancel", () => o, { once: !0 }), e.addEventListener("finish", () => o, { once: !0 }), e.cancel(); }) ) ); } const As = /* @__PURE__ */ new Map(), Zf = /* @__PURE__ */ new WeakMap(); function Qf(a) { return a ?? { keyframes: [], options: { duration: 0 } }; } function xo(a, e) { As.set(a, Qf(e)); } function io(a, e) { const t = Zf.get(a); if (t?.[e]) return t[e]; const o = As.get(e); return o || { keyframes: [], options: { duration: 0 } }; } function* Fs(a = document.activeElement) { a != null && (yield a, "shadowRoot" in a && a.shadowRoot && a.shadowRoot.mode !== "closed" && (yield* Fs(a.shadowRoot.activeElement))); } function Jf() { return [...Fs()].pop(); } function ey(a) { const e = a.tagName.toLowerCase(); return a.getAttribute("tabindex") === "-1" || a.hasAttribute("disabled") || e === "input" && a.getAttribute("type") === "radio" && !a.hasAttribute("checked") || a.offsetParent === null && ms(a) === null || window.getComputedStyle(a).visibility === "hidden" ? !1 : (e === "audio" || e === "video") && a.hasAttribute("controls") || a.hasAttribute("tabindex") || a.hasAttribute("contenteditable") && a.getAttribute("contenteditable") !== "false" ? !0 : [ "button", "input", "select", "textarea", "a", "audio", "video", "summary" ].includes(e); } function cn(a) { const e = []; function t(o) { if (o instanceof Element) { if (o.hasAttribute("inert")) return; !e.includes(o) && ey(o) && e.push(o); const i = (r) => r.getRootNode({ composed: !0 })?.host !== a; o instanceof HTMLSlotElement && i(o) && o.assignedElements({ flatten: !0 }).forEach( (r) => { t(r); } ), o.shadowRoot !== null && o.shadowRoot.mode === "open" && t(o.shadowRoot); } [...o.children].forEach( (i) => t(i) ); } return t(a), e.sort((o, i) => { const r = Number(o.getAttribute("tabindex")) || 0; return (Number(i.getAttribute("tabindex")) || 0) - r; }); } let ri = []; class ty { constructor(e) { this.tabDirection = "forward", this.handleFocusIn = () => { this.checkFocus(); }, this.handleKeyDown = (t) => { if (t.key !== "Tab" || this.isExternalActivated) return; t.shiftKey ? this.tabDirection = "backward" : this.tabDirection = "forward", t.preventDefault(); const o = cn(this.element), i = Jf(); let r = o.findIndex( (c) => c === i ); if (r === -1) { this.currentFocus = o[0], this.currentFocus.focus({ preventScroll: !0 }); return; } const n = this.tabDirection === "forward" ? 1 : -1; r + n >= o.length ? r = 0 : r + n < 0 ? r = o.length - 1 : r += n, this.currentFocus = o[r], this.currentFocus?.focus({ preventScroll: !0 }), setTimeout(() => this.checkFocus()); }, this.handleKeyUp = () => { this.tabDirection = "forward"; }, this.element = e; } /** Activates focus trapping. */ activate() { ri.push(this.element), document.addEventListener("focusin", this.handleFocusIn), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp); } /** Deactivates focus trapping. */ deactivate() { ri = ri.filter((e) => e !== this.element), this.currentFocus = null, document.removeEventListener("focusin", this.handleFocusIn), document.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("keyup", this.handleKeyUp); } /** Determines if this modal element is currently active or not. */ isActive() { return ri[ri.length - 1] === this.element; } /** Activates external modal behavior and temporarily disables focus trapping. */ activateExternal() { this.isExternalActivated = !0; } /** Deactivates external modal behavior and re-enables focus trapping. */ deactivateExternal() { this.isExternalActivated = !1; } checkFocus() { if (this.isActive() && !this.isExternalActivated) { const e = cn(this.element); if (!this.element.matches(":focus-within")) { const t = e[0], o = e[e.length - 1], i = this.tabDirection === "forward" ? t : o; typeof i?.focus == "function" && (this.currentFocus = i, i.focus({ preventScroll: !0 })); } } } } const Ja = /* @__PURE__ */ new Set(); function dn(a) { Ja.add(a), document.body.classList.add("maui-scroll-lock"); } function un(a) { Ja.delete(a), Ja.size === 0 && document.body.classList.remove("maui-scroll-lock"); } const oy = s` .dimmer { background-color: var(--maui-color-modal-dim); transition: background-color 0.25s ease-in-out; width: 100%; height: 100%; } `, iy = s` .os.dimmer { backdrop-filter: blur(6px); } `, ay = [oy, iy]; class Ns extends k { constructor() { super(), this.componentName = "dimmer"; } render() { return u`
`; } } Ns.styles = ay; w("maui-dimmer", Ns); const Is = (a) => { const e = h(a); return s` .${e} { --maui-modal-shadow-offset-x: 0; --maui-modal-shadow-offset-y: 0; --maui-modal-shadow-radius: 16px; --maui-modal-shadow-spread: 0; --maui-modal-shadow-color: var(--maui-color-brand-black-transparent); } `; }, ry = s` ${C} ${A} :host { display: contents; } .modal { display: flex; align-items: center; justify-content: center; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 10000; --maui-modal-outside-padding: var(--maui-spacing-6); } .modal.default { --maui-modal-width: 500px; /* default width */ } .modal.custom { --maui-modal-width: var( --maui-modal-custom-width, 500px ); /* custom width with default width as the fallback */ } .modal.scroll-outside { overflow: auto; align-items: flex-start; padding: var(--maui-modal-outside-padding) 0; -webkit-overflow-scrolling: touch; } .panel { display: flex; flex-direction: column; z-index: 2; width: var(--maui-modal-width); max-width: calc(100% - var(--maui-spacing-4)); max-height: calc(100% - 2 * var(--maui-modal-outside-padding)); background-color: var(--maui-color-brand-white); box-shadow: var(--maui-modal-shadow-offset-x) var(--maui-modal-shadow-offset-y) var(--maui-modal-shadow-radius) var(--maui-modal-shadow-spread) var(--maui-modal-shadow-color); } .clipping { position: relative; height: 0; width: 100%; pointer-events: none; z-index: 2; } .clipping::after { display: block; content: ' '; position: absolute; height: 70px; width: 100%; transition: box-shadow 0.2s ease-in-out; } .clipping:not(.active).top::after, .clipping:not(.active).bottom::after { box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0); } .clipping.top::after { top: 0; box-shadow: inset 0px 15px 11px -10px var(--maui-modal-shadow-color); } .clipping.bottom::after { bottom: 0; box-shadow: inset 0px -15px 11px -10px var(--maui-modal-shadow-color); } .scroll-outside .panel { max-height: none; } .scroll-outside .body { overflow: initial; } .panel:focus { outline: none; } .is-open .panel { display: flex; opacity: 1; } .header-structure { display: flex; flex: 0 0 auto; justify-content: space-between; column-gap: var(--maui-spacing-4); } .custom-header:not(.has-actions) .header-structure { display: block; } .custom-header .header-actions { display: flex; justify-content: flex-end; flex-grow: 1; } .header-actions { padding-left: var(--maui-spacing-4); gap: var(--maui-spacing-2); } .has-header-spacing .header-actions { padding-top: var(--maui-spacing-4); padding-right: var(--maui-spacing-4); } .header-actions ::slotted(maui-icon-link), .header-actions maui-icon-link { display: block; } .header { display: flex; justify-content: space-between; } .has-header-spacing slot[name='header'] { display: block; padding-top: var(--maui-spacing-4); padding-left: var(--maui-spacing-4); padding-bottom: var(--maui-spacing-4); } .body { display: block; overflow: auto; -webkit-overflow-scrolling: touch; } .has-content-spacing .body { padding-inline: var(--maui-spacing-4); } .has-content-spacing:not(.has-footer) .body { padding-bottom: var(--maui-spacing-4); } .has-content-spacing.no-header:not(.has-actions) .body { padding-top: var(--maui-spacing-4); } .has-footer-spacing.has-footer .footer { display: block; padding-top: var(--maui-spacing-4); padding-inline: var(--maui-spacing-4); padding-bottom: var(--maui-spacing-4); } .overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; } @media screen and (max-width: ${S.phablet["max-width"]}px) { .panel { /* Ensure there's enough vertical padding for phones that don't update vh when chrome appears (e.g. iPhone) */ max-height: 80vh; } .modal.focus-view-variant { --maui-modal-outside-padding: 0; --maui-modal-width: 100%; } .focus-view-variant .panel { max-width: 100%; max-height: 100%; } } @media screen and (min-width: ${S["mini-tablet"]["min-width"]}px) { .has-header-spacing slot[name='header'] { padding-top: var(--maui-spacing-6); padding-left: var(--maui-spacing-6); } .has-header-spacing .header-actions { padding-top: var(--maui-spacing-6); padding-right: var(--maui-spacing-6); } .has-content-spacing .body { padding-inline: var(--maui-spacing-6); } .has-content-spacing:not(.has-footer) .body { padding-bottom: var(--maui-spacing-6); } .has-content-spacing.no-header:not(.has-actions) .body { padding-top: var(--maui-spacing-6); } .has-footer-spacing.has-footer .footer { padding-inline: var(--maui-spacing-6); padding-bottom: var(--maui-spacing-6); } } @media (forced-colors: active) { .panel { border: solid 1px var(--maui-color-grey-08); } } `, ny = s` ${Is("lh")} `, sy = s` .os { --maui-modal-shadow-offset-x: 0; --maui-modal-shadow-offset-y: 4px; --maui-modal-shadow-radius: 12px; --maui-modal-shadow-spread: 0; --maui-modal-shadow-color: var(--maui-color-brand-osgrey8-transparent); } `, ly = s` .lx { --maui-modal-shadow-offset-x: 0; --maui-modal-shadow-offset-y: 0; --maui-modal-shadow-radius: 16px; --maui-modal-shadow-spread: 0; --maui-modal-shadow-color: var(--maui-color-brand-black-transparent); } .lx .panel { border: 1px solid var(--maui-color-grey-02); } `, cy = s` .sn { --maui-modal-shadow-offset-x: 0; --maui-modal-shadow-offset-y: 2px; --maui-modal-shadow-radius: 12px; --maui-modal-shadow-spread: 0; --maui-modal-shadow-color: var(--maui-color-brand-sn-blue-4-transparent); } .sn .panel { border: 1px solid var(--maui-color-grey-04); } `, dy = s` ${Is("b2b")} `, uy = s` .four_y { --maui-modal-shadow-color: var(--maui-color-brand-black-transparent); } .four_y .panel { border-radius: var(--maui-radii-radius-4); } .four_y.has-header-spacing slot[name='header'] { padding-top: var(--maui-spacing-4); padding-left: var(--maui-spacing-4); padding-bottom: 0; } .four_y.has-content-spacing .body { padding-top: var(--maui-spacing-4); } @media screen and (min-width: ${S["mini-tablet"]["min-width"]}px) { .four_y.has-header-spacing slot[name='header'] { padding-top: var(--maui-spacing-5); padding-left: var(--maui-spacing-5); padding-bottom: 0; } .four_y.has-header-spacing .header-actions { padding-top: var(--maui-spacing-5); padding-right: var(--maui-spacing-5); } .four_y.has-content-spacing .body { padding-top: var(--maui-spacing-5); padding-inline: var(--maui-spacing-5); } .four_y.has-content-spacing:not(.has-footer) .body { padding-bottom: var(--maui-spacing-5); } .four_y.has-content-spacing.no-header:not(.has-actions) .body { padding-top: var(--maui-spacing-5); } .four_y.has-footer-spacing.has-footer .footer { padding-inline: var(--maui-spacing-5); padding-bottom: var(--maui-spacing-5); } } `, my = s` .mmg { --maui-modal-shadow-offset-x: 0; --maui-modal-shadow-offset-y: 0; --maui-modal-shadow-radius: 16px; --maui-modal-shadow-spread: 0; --maui-modal-shadow-color: var(--maui-color-brand-mmg-elevation3); } .mmg.modal.default { --maui-modal-width: 836px; } .mmg.has-header-spacing slot[name='header'] { padding-block: var(--maui-spacing-3); padding-left: var(--maui-spacing-3); } .mmg.has-content-spacing .header-actions { padding-top: var(--maui-spacing-3); } .mmg.has-content-spacing .header-actions, .mmg.has-content-spacing .body { padding-inline: var(--maui-spacing-3); } .mmg.has-footer-spacing.has-footer .footer { padding: var(--maui-spacing-3); } @media screen and (min-width: ${S["mini-tablet"]["min-width"]}px) { .mmg.has-header-spacing slot[name='header'] { padding-block: var(--maui-spacing-3); padding-left: var(--maui-spacing-3); } .mmg.has-content-spacing .header-actions { padding-top: var(--maui-spacing-3); } .mmg.has-content-spacing .header-actions, .mmg.has-content-spacing .body { padding-inline: var(--maui-spacing-3); } .mmg.has-footer-spacing.has-footer .footer { padding: var(--maui-spacing-3); } } `, hy = [ ry, ny, sy, ly, cy, dy, uy, my ]; var py = Object.defineProperty, gy = Object.getOwnPropertyDescriptor, oe = (a, e, t, o) => { for (var i = o > 1 ? void 0 : o ? gy(e, t) : e, r = a.length - 1, n; r >= 0; r--) (n = a[r]) && (i = (o ? n(e, t, i) : n(i)) || i); return o && i && py(e, t, i), i; }; class Q extends k { constructor() { super(...arguments), this.hasSlotController = new be( this, "header", "footer", "header-actions" ), this.topClipping = !1, this.bottomClipping = !1, this.open = !1, this.label = "", this.scrollOutside = !1, this.variant = "default", this.noHeader = !1, this.customClose = !1, this.assistiveClose = "Close", this.noHeaderSpacing = !1, this.noContentSpacing = !1, this.noFooterSpacing = !1, this.size = "default"; } connectedCallback() { super.connectedCallback(), this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this), this.modal = new ty(this), this.testClipping = this.testClipping.bind(this), window.addEventListener("resize", this.testClipping); } firstUpdated() { this.modalElement.hidden = !this.open, this.open && (this.addOpenListeners(), this.modal.activate(), dn(this)); } disconnectedCallback() { super.disconnectedCallback(), un(this), window.removeEventListener("resize", this.testClipping); } requestClose(e) { if (this.emit("maui-request-close", { cancelable: !0, detail: { source: e } }).defaultPrevented) { const o = io(this, "modal.denyClose"); oo(this.panel, o.keyframes, o.options); return; } this.hide(); } addOpenListeners() { document.addEventListener("keydown", this.handleDocumentKeyDown); } removeOpenListeners() { document.removeEventListener("keydown", this.handleDocumentKeyDown); } handleDocumentKeyDown(e) { this.open && e.key === "Escape" && (e.stopPropagation(), this.requestClose("keyboard")); } handleBodyScroll() { this.testClipping(); const { scrollHeight: e, clientHeight: t, scrollTop: o } = this.content; this.emit("maui-scroll", { detail: { scrollHeight: e, clientHeight: t, scrollTop: o } }); } testClipping() { const { scrollHeight: e, clientHeight: t, scrollTop: o } = this.content; o === 0 ? this.topClipping = !1 : this.topClipping = !0, o + t === e ? this.bottomClipping = !1 : this.bottomClipping = !0; } async handleOpenChange() { if (this.open) { this.emit("maui-show"), this.addOpenListeners(), this.originalTrigger = document.activeElement, this.modal.activate(), dn(this); const e = this.querySelector("[autofocus]"); e && e.removeAttribute("autofocus"), await Promise.all([ Xi(this.modalElement), Xi(this.overlay) ]), this.modalElement.hidden = !1, this.testClipping(), requestAnimationFrame(() => { this.emit("maui-initial-focus", { cancelable: !0 }).defaultPrevented || (e ? e.focus({ preventScroll: !0 }) : this.panel.focus({ preventScroll: !0 })), e && e.setAttribute("autofocus", ""); }); const t = io(this, "modal.show"), o = io(this, "modal.overlay.show"); await Promise.all([ oo(this.panel, t.keyframes, t.options), oo( this.overlay, o.keyframes, o.options ) ]), this.emit("maui-after-show"); } else { this.emit("maui-hide"), this.removeOpenListeners(), this.modal.deactivate(), await Promise.all([ Xi(this.modalElement), Xi(this.overlay) ]); const e = io(this, "modal.hide"), t = io(this, "modal.overlay.hide"); await Promise.all([ oo( this.overlay, t.keyframes, t.options ).then(() => { this.overlay.hidden = !0; }), oo( this.panel, e.keyframes, e.options ).then(() => { this.panel.hidden = !0; }) ]), this.modalElement.hidden = !0, this.overlay.hidden = !1, this.panel.hidden = !1, un(this); const o = this.originalTrigger; typeof o?.focus == "function" && setTimeout(() => o.focus()), this.emit("maui-after-hide"); } } /** Shows the modal. */ async show() { if (!this.open) return this.open = !0, jr(this, "maui-after-show"); } /** Hides the modal. Use this to close the modal in case you have added the `customClose` attribute */ async hide() { if (this.open) return this.open = !1, jr(this, "maui-after-hide"); } render() { const e = this.size || "default", t = !this.customClose || this.hasSlotController.test("header-actions"), o = this.scrollOutside && this.variant !== "focus-view", i = this.hasSlotController.test("footer"); return u`
this.requestClose("overlay")} tabindex="-1" >