// ==UserScript== // @name ChatGPT Exporter // @name:zh-CN ChatGPT Exporter // @name:zh-TW ChatGPT Exporter // @namespace pionxzh // @version 2.22.1 // @author pionxzh // @description Easily export the whole ChatGPT conversation history for further analysis or sharing. // @description:zh-CN 轻松导出 ChatGPT 聊天记录,以便进一步分析或分享。 // @description:zh-TW 輕鬆匯出 ChatGPT 聊天紀錄,以便進一步分析或分享。 // @license MIT // @icon https://chat.openai.com/favicon.ico // @match https://chat.openai.com/ // @match https://chat.openai.com/?model=* // @match https://chat.openai.com/c/* // @match https://chat.openai.com/g/* // @match https://chat.openai.com/gpts // @match https://chat.openai.com/gpts/* // @match https://chat.openai.com/share/* // @match https://chat.openai.com/share/*/continue // @require https://cdn.jsdelivr.net/npm/jszip@3.9.1/dist/jszip.min.js // @require https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js // @grant GM_addStyle // @grant GM_deleteValue // @grant GM_getValue // @grant GM_setValue // @grant unsafeWindow // @run-at document-end // ==/UserScript== (n=>{if(typeof GM_addStyle=="function"){GM_addStyle(n);return}const e=document.createElement("style");e.textContent=n,document.head.append(e)})(` .CheckBoxLabel { position: relative; display: flex; font-size: 16px; vertical-align: middle; } .CheckBoxLabel * { cursor: pointer; } .CheckBoxLabel[disabled] { opacity: 0.7; } .CheckBoxLabel[disabled] * { cursor: not-allowed; } .CheckBoxLabel input { position: absolute; opacity: 0; width: 100%; height: 100%; top: 0; left: 0; margin: 0; padding: 0; } .CheckBoxLabel .IconWrapper { display: inline-flex; align-items: center; position: relative; vertical-align: middle; font-size: 1.5rem; } .CheckBoxLabel input:checked ~ svg { color: rgb(28 100 242); } .dark .CheckBoxLabel input:checked ~ svg { color: rgb(144, 202, 249); } .CheckBoxLabel .LabelText { margin-left: 0.5rem; font-size: 1rem; line-height: 1.5; } span[data-time-format] { display: none; } body[data-time-format="12"] span[data-time-format="12"] { display: inline; } body[data-time-format="24"] span[data-time-format="24"] { display: inline; } .Select { padding: 0 0 0 0.5rem; width: 7.5rem; border-radius: 4px; box-shadow: 0 0 0 1px #6f6e77; } .dark .Select { background-color: #2f2f2f; color: #fff; box-shadow: 0 0 0 1px #6f6e77; } html { --ce-text-primary: var(--text-primary, #0d0d0d); --ce-menu-primary: var(--sidebar-surface-primary, #f9f9f9); --ce-menu-secondary: var(--sidebar-surface-secondary, #ececec); --ce-border-light: var(--border-light, rgba(0, 0, 0, .1)); } .dark { --ce-text-primary: var(--text-primary, #ececec); --ce-menu-primary: var(--sidebar-surface-primary, #171717); --ce-menu-secondary: var(--sidebar-surface-secondary, #212121); } .text-menu { color: var(--ce-text-primary); } .bg-menu { background-color: var(--ce-menu-primary); } .border-menu { border-color: var(--ce-border-light); } .menu-item { height: 46px; } .menu-item[disabled] { filter: brightness(0.5); } .inputFieldSet { display: block; border-width: 2px; border-style: groove; } .inputFieldSet legend { margin-left: 4px; } .inputFieldSet input { background-color: transparent; box-shadow: none!important; } .row-half { grid-column: auto / span 1; } .row-full { grid-column: auto / span 2; } .dropdown-backdrop { display: block; position: fixed; top: 0; bottom: 0; left: 0; right: 0; background-color: rgba(0,0,0,.5); animation-name: pointerFadeIn; animation-duration: .3s; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } } @keyframes pointerFadeIn { from { opacity: 0; pointer-events: none; } to { opacity: 1; pointer-events: auto; } } @keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } @keyframes circularDash { 0% { stroke-dasharray: 1px, 200px; stroke-dashoffset: 0; } 50% { stroke-dasharray: 100px, 200px; stroke-dashoffset: -15px; } 100% { stroke-dasharray: 100px, 200px; stroke-dashoffset: -125px; } } .DialogOverlay { background-color: rgba(0, 0, 0, 0.44); position: fixed; inset: 0; z-index: 1000; animation: fadeIn 150ms cubic-bezier(0.16, 1, 0.3, 1); } .DialogContent { background-color: #f3f3f3; border-radius: 6px; box-shadow: hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90vw; max-width: 560px; max-height: 85vh; overflow-x: hidden; overflow-y: auto; padding: 16px 24px; z-index: 1001; outline: none; animation: contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1); } .dark .DialogContent { background-color: #2a2a2a; border-color: #40414f; border-width: 1px; } .DialogContent input[type="checkbox"] { border: none; outline: none; box-shadow: none; } .DialogTitle { margin: 0 0 16px 0; font-weight: 500; color: #1a1523; font-size: 20px; } .dark .DialogTitle { color: #fff; } .Button { display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; padding: 0 15px; font-size: 15px; line-height: 1; height: 35px; } .Button.green { background-color: #ddf3e4; color: #18794e; } .Button.red { background-color: #f9d9d9; color: #a71d2a; } .Button.green:hover { background-color: #ccebd7; } .Button:disabled { opacity: 0.5; color: #6f6e77; background-color: #e0e0e0; cursor: not-allowed; } .Button:disabled:hover { background-color: #e0e0e0; } .IconButton { font-family: inherit; border-radius: 100%; height: 25px; width: 25px; display: inline-flex; align-items: center; justify-content: center; color: #6f6e77; } .IconButton:hover { background-color: rgba(0, 0, 0, 0.06); } .CloseButton { position: absolute; top: 10px; right: 10px; } .Fieldset { display: flex; gap: 20px; align-items: center; margin-bottom: 15px; } .Label { font-size: 15px; color: #1a1523; min-width: 90px; text-align: right; } .dark .Label { color: #fff; } .Input { width: 100%; flex: 1; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; padding: 0 10px; font-size: 15px; line-height: 1; color: #000; background-color: #fafafa; box-shadow: 0 0 0 1px #6f6e77; height: 35px; outline: none; } .dark .Input { background-color: #2f2f2f; color: #fff; box-shadow: 0 0 0 1px #6f6e77; } .Description { font-size: 13px; color: #5a5865; text-align: right; margin-bottom: 4px; } .dark .Description { color: #bcbcbc; } .SelectToolbar { display: flex; align-items: center; padding: 12px 16px; border-radius: 4px 4px 0 0; border: 1px solid #6f6e77; border-bottom: none; } .SelectList { position: relative; width: 100%; height: 270px; padding: 12px 16px; overflow-x: hidden; overflow-y: auto; border: 1px solid #6f6e77; border-radius: 0 0 4px 4px; white-space: nowrap; } .SelectItem { overflow: hidden; text-overflow: ellipsis; } .SelectItem label, .SelectItem input { cursor: pointer; } .SelectItem span { vertical-align: middle; } @keyframes contentShow { from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } } .animate-fadeIn { animation: fadeIn .3s; } .animate-slideUp { animation: slideUp .3s; } .bg-blue-600 { background-color: rgb(28 100 242); } .hover\\:bg-gray-500\\/10:hover { background-color: hsla(0, 0%, 61%, .1) } .border-\\[\\#6f6e77\\] { border-color: #6f6e77; } .cursor-help { cursor: help; } .dark .dark\\:bg-white\\/5 { background-color: rgb(255 255 255 / 5%); } .dark .dark\\:text-gray-200 { color: rgb(229 231 235 / 1); } .dark .dark\\:text-gray-300 { color: rgb(209 213 219 / 1); } .dark .dark\\:border-gray-\\[\\#86858d\\] { border-color: #86858d; } .gap-x-1 { column-gap: 0.25rem; } .h-2\\.5 { height: 0.625rem; } .h-4 { height: 1rem; } .ml-3 { margin-left: 0.75rem; } .ml-4 { margin-left: 1rem; } .mr-8 { margin-right: 2rem; } .pb-0 { padding-bottom: 0; } .pr-8 { padding-right: 2rem; } .rounded-full { border-radius: 9999px; } .select-all { user-select: all!important; } .space-y-6>:not([hidden])~:not([hidden]) { --tw-space-y-reverse: 0; margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse))); margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .whitespace-nowrap { white-space: nowrap; } @media (min-width:768px) { /* md */ } @media (min-width:1024px) { .lg\\:mt-0 { margin-top: 0; } .lg\\:top-8 { top: 2rem; } } `); (function (JSZip, html2canvas) { 'use strict'; var __defProp = Object.defineProperty; var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value; var __publicField = (obj, key2, value) => { __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value); return value; }; var n$2, l$5, u$6, i$6, o$9, r$5, f$4, e$4, c$5 = {}, s$7 = [], a$4 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, h$5 = Array.isArray; function v$3(n2, l2) { for (var u2 in l2) n2[u2] = l2[u2]; return n2; } function p$7(n2) { var l2 = n2.parentNode; l2 && l2.removeChild(n2); } function y$6(l2, u2, t2) { var i2, o3, r2, f2 = {}; for (r2 in u2) "key" == r2 ? i2 = u2[r2] : "ref" == r2 ? o3 = u2[r2] : f2[r2] = u2[r2]; if (arguments.length > 2 && (f2.children = arguments.length > 3 ? n$2.call(arguments, 2) : t2), "function" == typeof l2 && null != l2.defaultProps) for (r2 in l2.defaultProps) void 0 === f2[r2] && (f2[r2] = l2.defaultProps[r2]); return d$6(l2, f2, i2, o3, null); } function d$6(n2, t2, i2, o3, r2) { var f2 = { type: n2, props: t2, key: i2, ref: o3, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: null == r2 ? ++u$6 : r2 }; return null == r2 && null != l$5.vnode && l$5.vnode(f2), f2; } function _$2() { return { current: null }; } function k$3(n2) { return n2.children; } function b$4(n2, l2) { this.props = n2, this.context = l2; } function g$5(n2, l2) { if (null == l2) return n2.__ ? g$5(n2.__, n2.__.__k.indexOf(n2) + 1) : null; for (var u2; l2 < n2.__k.length; l2++) if (null != (u2 = n2.__k[l2]) && null != u2.__e) return u2.__e; return "function" == typeof n2.type ? g$5(n2) : null; } function m$3(n2) { var l2, u2; if (null != (n2 = n2.__) && null != n2.__c) { for (n2.__e = n2.__c.base = null, l2 = 0; l2 < n2.__k.length; l2++) if (null != (u2 = n2.__k[l2]) && null != u2.__e) { n2.__e = n2.__c.base = u2.__e; break; } return m$3(n2); } } function w$4(n2) { (!n2.__d && (n2.__d = true) && i$6.push(n2) && !x$4.__r++ || o$9 !== l$5.debounceRendering) && ((o$9 = l$5.debounceRendering) || r$5)(x$4); } function x$4() { var n2, l2, u2, t2, o3, r2, e2, c2, s2; for (i$6.sort(f$4); n2 = i$6.shift(); ) n2.__d && (l2 = i$6.length, t2 = void 0, o3 = void 0, r2 = void 0, c2 = (e2 = (u2 = n2).__v).__e, (s2 = u2.__P) && (t2 = [], o3 = [], (r2 = v$3({}, e2)).__v = e2.__v + 1, L$3(s2, e2, r2, u2.__n, void 0 !== s2.ownerSVGElement, null != e2.__h ? [c2] : null, t2, null == c2 ? g$5(e2) : c2, e2.__h, o3), M$3(t2, e2, o3), e2.__e != c2 && m$3(e2)), i$6.length > l2 && i$6.sort(f$4)); x$4.__r = 0; } function P$3(n2, l2, u2, t2, i2, o3, r2, f2, e2, a2, v2) { var p2, y2, _24, b2, m2, w2, x2, P2, C2, H2 = 0, I2 = t2 && t2.__k || s$7, T2 = I2.length, j2 = T2, z2 = l2.length; for (u2.__k = [], p2 = 0; p2 < z2; p2++) null != (b2 = u2.__k[p2] = null == (b2 = l2[p2]) || "boolean" == typeof b2 || "function" == typeof b2 ? null : "string" == typeof b2 || "number" == typeof b2 || "bigint" == typeof b2 ? d$6(null, b2, null, null, b2) : h$5(b2) ? d$6(k$3, { children: b2 }, null, null, null) : b2.__b > 0 ? d$6(b2.type, b2.props, b2.key, b2.ref ? b2.ref : null, b2.__v) : b2) ? (b2.__ = u2, b2.__b = u2.__b + 1, -1 === (P2 = A$4(b2, I2, x2 = p2 + H2, j2)) ? _24 = c$5 : (_24 = I2[P2] || c$5, I2[P2] = void 0, j2--), L$3(n2, b2, _24, i2, o3, r2, f2, e2, a2, v2), m2 = b2.__e, (y2 = b2.ref) && _24.ref != y2 && (_24.ref && O$2(_24.ref, null, b2), v2.push(y2, b2.__c || m2, b2)), null != m2 && (null == w2 && (w2 = m2), (C2 = _24 === c$5 || null === _24.__v) ? -1 == P2 && H2-- : P2 !== x2 && (P2 === x2 + 1 ? H2++ : P2 > x2 ? j2 > z2 - x2 ? H2 += P2 - x2 : H2-- : H2 = P2 < x2 && P2 == x2 - 1 ? P2 - x2 : 0), x2 = p2 + H2, "function" != typeof b2.type || P2 === x2 && _24.__k !== b2.__k ? "function" == typeof b2.type || P2 === x2 && !C2 ? void 0 !== b2.__d ? (e2 = b2.__d, b2.__d = void 0) : e2 = m2.nextSibling : e2 = S$3(n2, m2, e2) : e2 = $$1(b2, e2, n2), "function" == typeof u2.type && (u2.__d = e2))) : (_24 = I2[p2]) && null == _24.key && _24.__e && (_24.__e == e2 && (e2 = g$5(_24)), q$2(_24, _24, false), I2[p2] = null); for (u2.__e = w2, p2 = T2; p2--; ) null != I2[p2] && ("function" == typeof u2.type && null != I2[p2].__e && I2[p2].__e == u2.__d && (u2.__d = I2[p2].__e.nextSibling), q$2(I2[p2], I2[p2])); } function $$1(n2, l2, u2) { for (var t2, i2 = n2.__k, o3 = 0; i2 && o3 < i2.length; o3++) (t2 = i2[o3]) && (t2.__ = n2, l2 = "function" == typeof t2.type ? $$1(t2, l2, u2) : S$3(u2, t2.__e, l2)); return l2; } function C$2(n2, l2) { return l2 = l2 || [], null == n2 || "boolean" == typeof n2 || (h$5(n2) ? n2.some(function(n3) { C$2(n3, l2); }) : l2.push(n2)), l2; } function S$3(n2, l2, u2) { return null == u2 || u2.parentNode !== n2 ? n2.insertBefore(l2, null) : l2 == u2 && null != l2.parentNode || n2.insertBefore(l2, u2), l2.nextSibling; } function A$4(n2, l2, u2, t2) { var i2 = n2.key, o3 = n2.type, r2 = u2 - 1, f2 = u2 + 1, e2 = l2[u2]; if (null === e2 || e2 && i2 == e2.key && o3 === e2.type) return u2; if (t2 > (null != e2 ? 1 : 0)) for (; r2 >= 0 || f2 < l2.length; ) { if (r2 >= 0) { if ((e2 = l2[r2]) && i2 == e2.key && o3 === e2.type) return r2; r2--; } if (f2 < l2.length) { if ((e2 = l2[f2]) && i2 == e2.key && o3 === e2.type) return f2; f2++; } } return -1; } function H$3(n2, l2, u2, t2, i2) { var o3; for (o3 in u2) "children" === o3 || "key" === o3 || o3 in l2 || T$5(n2, o3, null, u2[o3], t2); for (o3 in l2) i2 && "function" != typeof l2[o3] || "children" === o3 || "key" === o3 || "value" === o3 || "checked" === o3 || u2[o3] === l2[o3] || T$5(n2, o3, l2[o3], u2[o3], t2); } function I$2(n2, l2, u2) { "-" === l2[0] ? n2.setProperty(l2, null == u2 ? "" : u2) : n2[l2] = null == u2 ? "" : "number" != typeof u2 || a$4.test(l2) ? u2 : u2 + "px"; } function T$5(n2, l2, u2, t2, i2) { var o3; n: if ("style" === l2) if ("string" == typeof u2) n2.style.cssText = u2; else { if ("string" == typeof t2 && (n2.style.cssText = t2 = ""), t2) for (l2 in t2) u2 && l2 in u2 || I$2(n2.style, l2, ""); if (u2) for (l2 in u2) t2 && u2[l2] === t2[l2] || I$2(n2.style, l2, u2[l2]); } else if ("o" === l2[0] && "n" === l2[1]) o3 = l2 !== (l2 = l2.replace(/(PointerCapture)$|Capture$/, "$1")), l2 = l2.toLowerCase() in n2 ? l2.toLowerCase().slice(2) : l2.slice(2), n2.l || (n2.l = {}), n2.l[l2 + o3] = u2, u2 ? t2 || n2.addEventListener(l2, o3 ? z$3 : j$3, o3) : n2.removeEventListener(l2, o3 ? z$3 : j$3, o3); else if ("dangerouslySetInnerHTML" !== l2) { if (i2) l2 = l2.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); else if ("width" !== l2 && "height" !== l2 && "href" !== l2 && "list" !== l2 && "form" !== l2 && "tabIndex" !== l2 && "download" !== l2 && "rowSpan" !== l2 && "colSpan" !== l2 && l2 in n2) try { n2[l2] = null == u2 ? "" : u2; break n; } catch (n3) { } "function" == typeof u2 || (null == u2 || false === u2 && "-" !== l2[4] ? n2.removeAttribute(l2) : n2.setAttribute(l2, u2)); } } function j$3(n2) { return this.l[n2.type + false](l$5.event ? l$5.event(n2) : n2); } function z$3(n2) { return this.l[n2.type + true](l$5.event ? l$5.event(n2) : n2); } function L$3(n2, u2, t2, i2, o3, r2, f2, e2, c2, s2) { var a2, p2, y2, d2, _24, g2, m2, w2, x2, $2, C2, S2, A2, H2, I2, T2 = u2.type; if (void 0 !== u2.constructor) return null; null != t2.__h && (c2 = t2.__h, e2 = u2.__e = t2.__e, u2.__h = null, r2 = [e2]), (a2 = l$5.__b) && a2(u2); n: if ("function" == typeof T2) try { if (w2 = u2.props, x2 = (a2 = T2.contextType) && i2[a2.__c], $2 = a2 ? x2 ? x2.props.value : a2.__ : i2, t2.__c ? m2 = (p2 = u2.__c = t2.__c).__ = p2.__E : ("prototype" in T2 && T2.prototype.render ? u2.__c = p2 = new T2(w2, $2) : (u2.__c = p2 = new b$4(w2, $2), p2.constructor = T2, p2.render = B$2), x2 && x2.sub(p2), p2.props = w2, p2.state || (p2.state = {}), p2.context = $2, p2.__n = i2, y2 = p2.__d = true, p2.__h = [], p2._sb = []), null == p2.__s && (p2.__s = p2.state), null != T2.getDerivedStateFromProps && (p2.__s == p2.state && (p2.__s = v$3({}, p2.__s)), v$3(p2.__s, T2.getDerivedStateFromProps(w2, p2.__s))), d2 = p2.props, _24 = p2.state, p2.__v = u2, y2) null == T2.getDerivedStateFromProps && null != p2.componentWillMount && p2.componentWillMount(), null != p2.componentDidMount && p2.__h.push(p2.componentDidMount); else { if (null == T2.getDerivedStateFromProps && w2 !== d2 && null != p2.componentWillReceiveProps && p2.componentWillReceiveProps(w2, $2), !p2.__e && (null != p2.shouldComponentUpdate && false === p2.shouldComponentUpdate(w2, p2.__s, $2) || u2.__v === t2.__v)) { for (u2.__v !== t2.__v && (p2.props = w2, p2.state = p2.__s, p2.__d = false), u2.__e = t2.__e, u2.__k = t2.__k, u2.__k.forEach(function(n3) { n3 && (n3.__ = u2); }), C2 = 0; C2 < p2._sb.length; C2++) p2.__h.push(p2._sb[C2]); p2._sb = [], p2.__h.length && f2.push(p2); break n; } null != p2.componentWillUpdate && p2.componentWillUpdate(w2, p2.__s, $2), null != p2.componentDidUpdate && p2.__h.push(function() { p2.componentDidUpdate(d2, _24, g2); }); } if (p2.context = $2, p2.props = w2, p2.__P = n2, p2.__e = false, S2 = l$5.__r, A2 = 0, "prototype" in T2 && T2.prototype.render) { for (p2.state = p2.__s, p2.__d = false, S2 && S2(u2), a2 = p2.render(p2.props, p2.state, p2.context), H2 = 0; H2 < p2._sb.length; H2++) p2.__h.push(p2._sb[H2]); p2._sb = []; } else do { p2.__d = false, S2 && S2(u2), a2 = p2.render(p2.props, p2.state, p2.context), p2.state = p2.__s; } while (p2.__d && ++A2 < 25); p2.state = p2.__s, null != p2.getChildContext && (i2 = v$3(v$3({}, i2), p2.getChildContext())), y2 || null == p2.getSnapshotBeforeUpdate || (g2 = p2.getSnapshotBeforeUpdate(d2, _24)), P$3(n2, h$5(I2 = null != a2 && a2.type === k$3 && null == a2.key ? a2.props.children : a2) ? I2 : [I2], u2, t2, i2, o3, r2, f2, e2, c2, s2), p2.base = u2.__e, u2.__h = null, p2.__h.length && f2.push(p2), m2 && (p2.__E = p2.__ = null); } catch (n3) { u2.__v = null, (c2 || null != r2) && (u2.__e = e2, u2.__h = !!c2, r2[r2.indexOf(e2)] = null), l$5.__e(n3, u2, t2); } else null == r2 && u2.__v === t2.__v ? (u2.__k = t2.__k, u2.__e = t2.__e) : u2.__e = N$3(t2.__e, u2, t2, i2, o3, r2, f2, c2, s2); (a2 = l$5.diffed) && a2(u2); } function M$3(n2, u2, t2) { for (var i2 = 0; i2 < t2.length; i2++) O$2(t2[i2], t2[++i2], t2[++i2]); l$5.__c && l$5.__c(u2, n2), n2.some(function(u3) { try { n2 = u3.__h, u3.__h = [], n2.some(function(n3) { n3.call(u3); }); } catch (n3) { l$5.__e(n3, u3.__v); } }); } function N$3(l2, u2, t2, i2, o3, r2, f2, e2, s2) { var a2, v2, y2, d2 = t2.props, _24 = u2.props, k2 = u2.type, b2 = 0; if ("svg" === k2 && (o3 = true), null != r2) { for (; b2 < r2.length; b2++) if ((a2 = r2[b2]) && "setAttribute" in a2 == !!k2 && (k2 ? a2.localName === k2 : 3 === a2.nodeType)) { l2 = a2, r2[b2] = null; break; } } if (null == l2) { if (null === k2) return document.createTextNode(_24); l2 = o3 ? document.createElementNS("http://www.w3.org/2000/svg", k2) : document.createElement(k2, _24.is && _24), r2 = null, e2 = false; } if (null === k2) d2 === _24 || e2 && l2.data === _24 || (l2.data = _24); else { if (r2 = r2 && n$2.call(l2.childNodes), v2 = (d2 = t2.props || c$5).dangerouslySetInnerHTML, y2 = _24.dangerouslySetInnerHTML, !e2) { if (null != r2) for (d2 = {}, b2 = 0; b2 < l2.attributes.length; b2++) d2[l2.attributes[b2].name] = l2.attributes[b2].value; (y2 || v2) && (y2 && (v2 && y2.__html == v2.__html || y2.__html === l2.innerHTML) || (l2.innerHTML = y2 && y2.__html || "")); } if (H$3(l2, _24, d2, o3, e2), y2) u2.__k = []; else if (P$3(l2, h$5(b2 = u2.props.children) ? b2 : [b2], u2, t2, i2, o3 && "foreignObject" !== k2, r2, f2, r2 ? r2[0] : t2.__k && g$5(t2, 0), e2, s2), null != r2) for (b2 = r2.length; b2--; ) null != r2[b2] && p$7(r2[b2]); e2 || ("value" in _24 && void 0 !== (b2 = _24.value) && (b2 !== l2.value || "progress" === k2 && !b2 || "option" === k2 && b2 !== d2.value) && T$5(l2, "value", b2, d2.value, false), "checked" in _24 && void 0 !== (b2 = _24.checked) && b2 !== l2.checked && T$5(l2, "checked", b2, d2.checked, false)); } return l2; } function O$2(n2, u2, t2) { try { "function" == typeof n2 ? n2(u2) : n2.current = u2; } catch (n3) { l$5.__e(n3, t2); } } function q$2(n2, u2, t2) { var i2, o3; if (l$5.unmount && l$5.unmount(n2), (i2 = n2.ref) && (i2.current && i2.current !== n2.__e || O$2(i2, null, u2)), null != (i2 = n2.__c)) { if (i2.componentWillUnmount) try { i2.componentWillUnmount(); } catch (n3) { l$5.__e(n3, u2); } i2.base = i2.__P = null, n2.__c = void 0; } if (i2 = n2.__k) for (o3 = 0; o3 < i2.length; o3++) i2[o3] && q$2(i2[o3], u2, t2 || "function" != typeof n2.type); t2 || null == n2.__e || p$7(n2.__e), n2.__ = n2.__e = n2.__d = void 0; } function B$2(n2, l2, u2) { return this.constructor(n2, u2); } function D$4(u2, t2, i2) { var o3, r2, f2, e2; l$5.__ && l$5.__(u2, t2), r2 = (o3 = "function" == typeof i2) ? null : i2 && i2.__k || t2.__k, f2 = [], e2 = [], L$3(t2, u2 = (!o3 && i2 || t2).__k = y$6(k$3, null, [u2]), r2 || c$5, c$5, void 0 !== t2.ownerSVGElement, !o3 && i2 ? [i2] : r2 ? null : t2.firstChild ? n$2.call(t2.childNodes) : null, f2, !o3 && i2 ? i2 : r2 ? r2.__e : t2.firstChild, o3, e2), M$3(f2, u2, e2); } function E$2(n2, l2) { D$4(n2, l2, E$2); } function F$2(l2, u2, t2) { var i2, o3, r2, f2, e2 = v$3({}, l2.props); for (r2 in l2.type && l2.type.defaultProps && (f2 = l2.type.defaultProps), u2) "key" == r2 ? i2 = u2[r2] : "ref" == r2 ? o3 = u2[r2] : e2[r2] = void 0 === u2[r2] && void 0 !== f2 ? f2[r2] : u2[r2]; return arguments.length > 2 && (e2.children = arguments.length > 3 ? n$2.call(arguments, 2) : t2), d$6(l2.type, e2, i2 || l2.key, o3 || l2.ref, null); } function G$1(n2, l2) { var u2 = { __c: l2 = "__cC" + e$4++, __: n2, Consumer: function(n3, l3) { return n3.children(l3); }, Provider: function(n3) { var u3, t2; return this.getChildContext || (u3 = [], (t2 = {})[l2] = this, this.getChildContext = function() { return t2; }, this.shouldComponentUpdate = function(n4) { this.props.value !== n4.value && u3.some(function(n5) { n5.__e = true, w$4(n5); }); }, this.sub = function(n4) { u3.push(n4); var l3 = n4.componentWillUnmount; n4.componentWillUnmount = function() { u3.splice(u3.indexOf(n4), 1), l3 && l3.call(n4); }; }), n3.children; } }; return u2.Provider.__ = u2.Consumer.contextType = u2; } n$2 = s$7.slice, l$5 = { __e: function(n2, l2, u2, t2) { for (var i2, o3, r2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try { if ((o3 = i2.constructor) && null != o3.getDerivedStateFromError && (i2.setState(o3.getDerivedStateFromError(n2)), r2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, t2 || {}), r2 = i2.__d), r2) return i2.__E = i2; } catch (l3) { n2 = l3; } throw n2; } }, u$6 = 0, b$4.prototype.setState = function(n2, l2) { var u2; u2 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = v$3({}, this.state), "function" == typeof n2 && (n2 = n2(v$3({}, u2), this.props)), n2 && v$3(u2, n2), null != n2 && this.__v && (l2 && this._sb.push(l2), w$4(this)); }, b$4.prototype.forceUpdate = function(n2) { this.__v && (this.__e = true, n2 && this.__h.push(n2), w$4(this)); }, b$4.prototype.render = k$3, i$6 = [], r$5 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, f$4 = function(n2, l2) { return n2.__v.__b - l2.__v.__b; }, x$4.__r = 0, e$4 = 0; var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; function getDefaultExportFromCjs(x2) { return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2; } var sentinel_umd = { exports: {} }; (function(module, exports) { (function(root2, factory) { { module.exports = factory(); } })(commonjsGlobal, function() { var isArray = Array.isArray, selectorToAnimationMap = {}, animationCallbacks = {}, styleEl, styleSheet, cssRules; return { /** * Add watcher. * @param {array} cssSelectors - List of CSS selector strings * @param {Function} callback - The callback function */ on: function(cssSelectors, callback) { if (!callback) return; if (!styleEl) { var doc = document, head2 = doc.head; doc.addEventListener("animationstart", function(ev, callbacks, l2, i2) { callbacks = animationCallbacks[ev.animationName]; if (!callbacks) return; ev.stopImmediatePropagation(); l2 = callbacks.length; for (i2 = 0; i2 < l2; i2++) callbacks[i2](ev.target); }, true); styleEl = doc.getElementById("sentinel-css"); if (!styleEl) { styleEl = doc.createElement("style"); head2.insertBefore(styleEl, head2.firstChild); } styleSheet = styleEl.sheet; cssRules = styleSheet.cssRules; } (isArray(cssSelectors) ? cssSelectors : [cssSelectors]).map(function(selector, animId, isCustomName) { animId = selectorToAnimationMap[selector]; if (!animId) { isCustomName = selector[0] == "!"; selectorToAnimationMap[selector] = animId = isCustomName ? selector.slice(1) : "sentinel-" + Math.random().toString(16).slice(2); cssRules[styleSheet.insertRule( "@keyframes " + animId + "{from{transform:none;}to{transform:none;}}", cssRules.length )]._id = selector; if (!isCustomName) { cssRules[styleSheet.insertRule( selector + "{animation-duration:0.0001s;animation-name:" + animId + ";}", cssRules.length )]._id = selector; } selectorToAnimationMap[selector] = animId; } (animationCallbacks[animId] = animationCallbacks[animId] || []).push(callback); }); }, /** * Remove watcher. * @param {array} cssSelectors - List of CSS selector strings * @param {Function} callback - The callback function (optional) */ off: function(cssSelectors, callback) { (isArray(cssSelectors) ? cssSelectors : [cssSelectors]).map(function(selector, animId, callbackList, i2) { if (!(animId = selectorToAnimationMap[selector])) return; callbackList = animationCallbacks[animId]; if (callback) { i2 = callbackList.length; while (i2--) { if (callbackList[i2] === callback) callbackList.splice(i2, 1); } } else { callbackList = []; } if (callbackList.length) return; i2 = cssRules.length; while (i2--) { if (cssRules[i2]._id == selector) styleSheet.deleteRule(i2); } delete selectorToAnimationMap[selector]; delete animationCallbacks[animId]; }); }, /** * Reset watchers and cache */ reset: function() { selectorToAnimationMap = {}; animationCallbacks = {}; if (styleEl) styleEl.parentNode.removeChild(styleEl); styleEl = 0; } }; }); })(sentinel_umd); var sentinel_umdExports = sentinel_umd.exports; const sentinel = /* @__PURE__ */ getDefaultExportFromCjs(sentinel_umdExports); var dist = {}; var __assign$1 = commonjsGlobal && commonjsGlobal.__assign || function() { __assign$1 = Object.assign || function(t2) { for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) { s2 = arguments[i2]; for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t2[p2] = s2[p2]; } return t2; }; return __assign$1.apply(this, arguments); }; Object.defineProperty(dist, "__esModule", { value: true }); dist.join = dist.subst = dist.query = void 0; function urlcat(baseUrlOrTemplate, pathTemplateOrParams, maybeParams) { if (maybeParams === void 0) { maybeParams = {}; } if (typeof pathTemplateOrParams === "string") { var baseUrl2 = baseUrlOrTemplate; var pathTemplate = pathTemplateOrParams; var params = maybeParams; return urlcatImpl(pathTemplate, params, baseUrl2); } else { var baseTemplate = baseUrlOrTemplate; var params = pathTemplateOrParams; return urlcatImpl(baseTemplate, params); } } var _default = dist.default = urlcat; function urlcatImpl(pathTemplate, params, baseUrl2) { var _a = path$1(pathTemplate, params), renderedPath = _a.renderedPath, remainingParams = _a.remainingParams; var cleanParams = removeNullOrUndef(remainingParams); var renderedQuery = query(cleanParams); var pathAndQuery = join$1(renderedPath, "?", renderedQuery); return baseUrl2 ? join$1(baseUrl2, "/", pathAndQuery) : pathAndQuery; } function query(params) { return new URLSearchParams(params).toString(); } dist.query = query; function subst(template, params) { var renderedPath = path$1(template, params).renderedPath; return renderedPath; } dist.subst = subst; function path$1(template, params) { var remainingParams = __assign$1({}, params); var allowedTypes = ["boolean", "string", "number"]; var renderedPath = template.replace(/:\w+/g, function(p2) { var key2 = p2.slice(1); if (/^\d+$/.test(key2)) { return p2; } if (!params.hasOwnProperty(key2)) { throw new Error("Missing value for path parameter " + key2 + "."); } if (!allowedTypes.includes(typeof params[key2])) { throw new TypeError("Path parameter " + key2 + " cannot be of type " + typeof params[key2] + ". " + ("Allowed types are: " + allowedTypes.join(", ") + ".")); } if (typeof params[key2] === "string" && params[key2].trim() === "") { throw new Error("Path parameter " + key2 + " cannot be an empty string."); } delete remainingParams[key2]; return encodeURIComponent(params[key2]); }); return { renderedPath, remainingParams }; } function join$1(part1, separator, part2) { var p1 = part1.endsWith(separator) ? part1.slice(0, -separator.length) : part1; var p2 = part2.startsWith(separator) ? part2.slice(separator.length) : part2; return p1 === "" || p2 === "" ? p1 + p2 : p1 + separator + p2; } dist.join = join$1; function removeNullOrUndef(params) { return Object.keys(params).filter(function(k2) { return notNullOrUndefined(params[k2]); }).reduce(function(result, k2) { result[k2] = params[k2]; return result; }, {}); } function notNullOrUndefined(v2) { return v2 !== void 0 && v2 !== null; } const API_MAPPING = { "https://chat.openai.com": "https://chat.openai.com/backend-api" }; const baseUrl = new URL(location.href).origin; const apiUrl = API_MAPPING[baseUrl]; const KEY_LANGUAGE = "exporter:language"; const KEY_FILENAME_FORMAT = "exporter:filename_format"; const KEY_TIMESTAMP_ENABLED = "exporter:enable_timestamp"; const KEY_TIMESTAMP_24H = "exporter:timestamp_24h"; const KEY_TIMESTAMP_MARKDOWN = "exporter:timestamp_markdown"; const KEY_TIMESTAMP_HTML = "exporter:timestamp_html"; const KEY_META_ENABLED = "exporter:enable_meta"; const KEY_META_LIST = "exporter:meta_list"; var _GM_deleteValue = /* @__PURE__ */ (() => typeof GM_deleteValue != "undefined" ? GM_deleteValue : void 0)(); var _GM_getValue = /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)(); var _GM_setValue = /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)(); var _unsafeWindow = /* @__PURE__ */ (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)(); function getBase64FromImg(el) { const canvas = document.createElement("canvas"); canvas.width = el.naturalWidth; canvas.height = el.naturalHeight; const ctx = canvas.getContext("2d"); if (!ctx) return ""; ctx.drawImage(el, 0, 0); return canvas.toDataURL("image/png"); } async function getBase64FromImageUrl(url) { const img = await loadImage(url); return getBase64FromImg(img); } function loadImage(url) { return new Promise((resolve, reject) => { const img = new Image(); img.src = url; img.crossOrigin = "anonymous"; img.onload = () => resolve(img); img.onerror = reject; }); } function blobToDataURL(blob) { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.onerror = reject; reader.onload = () => resolve(reader.result); reader.readAsDataURL(blob); }); } const historyDisabledKey = "oai/apps/historyDisabled"; function getHistoryDisabled() { return localStorage.getItem(historyDisabledKey) === '"true"'; } function getUserProfile() { var _a, _b, _c; const user = (_c = (_b = (_a = _unsafeWindow == null ? void 0 : _unsafeWindow.__NEXT_DATA__) == null ? void 0 : _a.props) == null ? void 0 : _b.pageProps) == null ? void 0 : _c.user; if (!user) throw new Error("No user found."); return user; } function getChatIdFromUrl() { const match = location.pathname.match(/^\/(?:share|c|g\/[a-z0-9-]+\/c)\/([a-z0-9-]+)/i); if (match) return match[1]; return null; } function isSharePage() { return location.pathname.startsWith("/share") && !location.pathname.endsWith("/continue"); } function getConversationFromSharePage() { var _a, _b, _c, _d; if ((_d = (_c = (_b = (_a = window.__NEXT_DATA__) == null ? void 0 : _a.props) == null ? void 0 : _b.pageProps) == null ? void 0 : _c.serverResponse) == null ? void 0 : _d.data) { return JSON.parse(JSON.stringify(window.__NEXT_DATA__.props.pageProps.serverResponse.data)); } return null; } const defaultAvatar = "data:image/svg+xml,%3Csvg%20stroke%3D%22currentColor%22%20fill%3D%22none%22%20stroke-width%3D%221.5%22%20viewBox%3D%22-6%20-6%2036%2036%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20style%3D%22color%3A%20white%3B%20background%3A%20%23ab68ff%3B%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M20%2021v-2a4%204%200%200%200-4-4H8a4%204%200%200%200-4%204v2%22%3E%3C%2Fpath%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%227%22%20r%3D%224%22%3E%3C%2Fcircle%3E%3C%2Fsvg%3E"; async function getUserAvatar() { try { const { picture } = getUserProfile(); if (picture) return await getBase64FromImageUrl(picture); } catch (e2) { console.error(e2); } try { const avatars = Array.from(document.querySelectorAll("img[alt]:not([aria-hidden])")); const avatar = avatars.find((avatar2) => !avatar2.src.startsWith("data:")); if (avatar) return getBase64FromImg(avatar); } catch (e2) { console.error(e2); } return defaultAvatar; } function checkIfConversationStarted() { return !!document.querySelector('[data-testid^="conversation-turn-"]'); } const generateKey = (args) => JSON.stringify(args); function memorize(fn2) { const cache = /* @__PURE__ */ new Map(); const memorized = (...args) => { const key2 = generateKey(args); if (cache.has(key2)) { return cache.get(key2); } const result = fn2(...args); cache.set(key2, result); return result; }; return memorized; } const sessionApi = _default(baseUrl, "/api/auth/session"); const conversationApi = (id) => _default(apiUrl, "/conversation/:id", { id }); const conversationsApi = (offset, limit) => _default(apiUrl, "/conversations", { offset, limit }); const fileDownloadApi = (id) => _default(apiUrl, "/files/:id/download", { id }); const accountsCheckApi = _default(apiUrl, "/accounts/check/v4-2023-04-27"); async function getCurrentChatId() { if (isSharePage()) { return `__share__${getChatIdFromUrl()}`; } const chatId = getChatIdFromUrl(); if (chatId) return chatId; const conversations = await fetchConversations(); if (conversations && conversations.items.length > 0) { return conversations.items[0].id; } throw new Error("No chat id found."); } async function fetchImageFromPointer(uri) { const pointer = uri.replace("file-service://", ""); const imageDetails = await fetchApi(fileDownloadApi(pointer)); if (imageDetails.status === "error") { console.error("Failed to fetch image asset", imageDetails.error_code, imageDetails.error_message); return null; } const image2 = await fetch(imageDetails.download_url); const blob = await image2.blob(); const base64 = await blobToDataURL(blob); return base64.replace(/^data:.*?;/, `data:${image2.headers.get("content-type")};`); } async function replaceImageAssets(conversation) { const isMultiModalInputImage = (part) => { return typeof part !== "string" && part.asset_pointer.startsWith("file-service://"); }; const imageAssets = Object.values(conversation.mapping).flatMap((node2) => { if (!node2.message) return []; if (node2.message.content.content_type !== "multimodal_text") return []; return node2.message.content.parts.filter(isMultiModalInputImage); }); const executionOutputs = Object.values(conversation.mapping).flatMap((node2) => { var _a, _b; if (!node2.message) return []; if (node2.message.content.content_type !== "execution_output") return []; if (!((_b = (_a = node2.message.metadata) == null ? void 0 : _a.aggregate_result) == null ? void 0 : _b.messages)) return []; return node2.message.metadata.aggregate_result.messages.filter((msg) => msg.message_type === "image"); }); await Promise.all([...imageAssets.map(async (asset) => { try { const newAssetPointer = await fetchImageFromPointer(asset.asset_pointer); if (newAssetPointer) asset.asset_pointer = newAssetPointer; } catch (error2) { console.error("Failed to fetch image asset", error2); } }), ...executionOutputs.map(async (msg) => { try { const newImageUrl = await fetchImageFromPointer(msg.image_url); if (newImageUrl) msg.image_url = newImageUrl; } catch (error2) { console.error("Failed to fetch image asset", error2); } })]); } async function fetchConversation(chatId, shouldReplaceAssets) { if (chatId.startsWith("__share__")) { const id = chatId.replace("__share__", ""); const shareConversation = getConversationFromSharePage(); await replaceImageAssets(shareConversation); return { id, ...shareConversation }; } const url = conversationApi(chatId); const conversation = await fetchApi(url); if (shouldReplaceAssets) { await replaceImageAssets(conversation); } return { id: chatId, ...conversation }; } async function fetchConversations(offset = 0, limit = 20) { const url = conversationsApi(offset, limit); return fetchApi(url); } async function fetchAllConversations() { const conversations = []; const limit = 20; let offset = 0; while (true) { const result = await fetchConversations(offset, limit); conversations.push(...result.items); if (offset + limit >= result.total) break; offset += limit; } return conversations; } async function archiveConversation(chatId) { const url = conversationApi(chatId); const { success } = await fetchApi(url, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ is_archived: true }) }); return success; } async function deleteConversation(chatId) { const url = conversationApi(chatId); const { success } = await fetchApi(url, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ is_visible: false }) }); return success; } async function fetchApi(url, options) { const accessToken = await getAccessToken(); const accountId = await getTeamAccountId(); const response = await fetch(url, { ...options, headers: { "Authorization": `Bearer ${accessToken}`, "X-Authorization": `Bearer ${accessToken}`, ...accountId ? { "Chatgpt-Account-Id": accountId } : {}, ...options == null ? void 0 : options.headers } }); if (!response.ok) { throw new Error(response.statusText); } return response.json(); } async function _fetchSession() { const response = await fetch(sessionApi); if (!response.ok) { throw new Error(response.statusText); } return response.json(); } const fetchSession = memorize(_fetchSession); async function getAccessToken() { const session = await fetchSession(); return session.accessToken; } async function _fetchAccountsCheck() { const accessToken = await getAccessToken(); const response = await fetch(accountsCheckApi, { headers: { "Authorization": `Bearer ${accessToken}`, "X-Authorization": `Bearer ${accessToken}` } }); if (!response.ok) { throw new Error(response.statusText); } return response.json(); } const fetchAccountsCheck = memorize(_fetchAccountsCheck); const getCookie = (key2) => { var _a; return ((_a = document.cookie.match(`(^|;)\\s*${key2}\\s*=\\s*([^;]+)`)) == null ? void 0 : _a.pop()) || ""; }; async function getTeamAccountId() { const accountsCheck = await fetchAccountsCheck(); const workspaceId = getCookie( "_account" /* Workspace */ ); if (workspaceId) { const account = accountsCheck.accounts[workspaceId]; if (account) { return account.account.account_id; } } return null; } const ModelMapping = { "text-davinci-002-render-sha": "GPT-3.5", "text-davinci-002-render-paid": "GPT-3.5", "text-davinci-002-browse": "GPT-3.5", "gpt-4": "GPT-4", "gpt-4-browsing": "GPT-4 (Browser)", // fuzzy matching "text-davinci-002": "GPT-3.5" }; function processConversation(conversation) { var _a; const title2 = conversation.title || "ChatGPT Conversation"; const createTime = conversation.create_time; const updateTime = conversation.update_time; const { model, modelSlug } = extractModel(conversation.mapping); const startNodeId = conversation.current_node || ((_a = Object.values(conversation.mapping).find((node2) => !node2.children || node2.children.length === 0)) == null ? void 0 : _a.id); if (!startNodeId) throw new Error("Failed to find start node."); const conversationNodes = extractConversationResult(conversation.mapping, startNodeId); const mergedConversationNodes = mergeContinuationNodes(conversationNodes); return { id: conversation.id, title: title2, model, modelSlug, createTime, updateTime, conversationNodes: mergedConversationNodes }; } function extractModel(conversationMapping) { var _a, _b, _c; let model = ""; const modelSlug = ((_c = (_b = (_a = Object.values(conversationMapping).find((node2) => { var _a2, _b2; return (_b2 = (_a2 = node2.message) == null ? void 0 : _a2.metadata) == null ? void 0 : _b2.model_slug; })) == null ? void 0 : _a.message) == null ? void 0 : _b.metadata) == null ? void 0 : _c.model_slug) || ""; if (modelSlug) { if (ModelMapping[modelSlug]) { model = ModelMapping[modelSlug]; } else { Object.keys(ModelMapping).forEach((key2) => { if (modelSlug.startsWith(key2)) { model = key2; } }); } } return { model, modelSlug }; } function extractConversationResult(conversationMapping, startNodeId) { var _a, _b; const result = []; let currentNodeId = startNodeId; while (currentNodeId) { const node2 = conversationMapping[currentNodeId]; if (!node2) { break; } if (node2.parent === void 0) { break; } if ( // Skip system messages ((_a = node2.message) == null ? void 0 : _a.author.role) !== "system" && ((_b = node2.message) == null ? void 0 : _b.content.content_type) !== "model_editable_context" ) { result.unshift(node2); } currentNodeId = node2.parent; } return result; } function mergeContinuationNodes(nodes) { var _a, _b; const result = []; for (const node2 of nodes) { const prevNode = result[result.length - 1]; if (((_a = prevNode == null ? void 0 : prevNode.message) == null ? void 0 : _a.author.role) === "assistant" && ((_b = node2.message) == null ? void 0 : _b.author.role) === "assistant" && prevNode.message.recipient === "all" && node2.message.recipient === "all" && prevNode.message.content.content_type === "text" && node2.message.content.content_type === "text") { prevNode.message.content.parts[prevNode.message.content.parts.length - 1] += node2.message.content.parts[0]; prevNode.message.content.parts.push(...node2.message.content.parts.slice(1)); } else { result.push(node2); } } return result; } function _extends() { _extends = Object.assign ? Object.assign.bind() : function(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source = arguments[i2]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; } } } return target; }; return _extends.apply(this, arguments); } var t$2, r$4, u$5, i$5, o$8 = 0, f$3 = [], c$4 = [], e$3 = l$5.__b, a$3 = l$5.__r, v$2 = l$5.diffed, l$4 = l$5.__c, m$2 = l$5.unmount; function d$5(t2, u2) { l$5.__h && l$5.__h(r$4, t2, o$8 || u2), o$8 = 0; var i2 = r$4.__H || (r$4.__H = { __: [], __h: [] }); return t2 >= i2.__.length && i2.__.push({ __V: c$4 }), i2.__[t2]; } function h$4(n2) { return o$8 = 1, s$6(B$1, n2); } function s$6(n2, u2, i2) { var o3 = d$5(t$2++, 2); if (o3.t = n2, !o3.__c && (o3.__ = [i2 ? i2(u2) : B$1(void 0, u2), function(n3) { var t2 = o3.__N ? o3.__N[0] : o3.__[0], r2 = o3.t(t2, n3); t2 !== r2 && (o3.__N = [r2, o3.__[1]], o3.__c.setState({})); }], o3.__c = r$4, !r$4.u)) { var f2 = function(n3, t2, r2) { if (!o3.__c.__H) return true; var u3 = o3.__c.__H.__.filter(function(n4) { return n4.__c; }); if (u3.every(function(n4) { return !n4.__N; })) return !c2 || c2.call(this, n3, t2, r2); var i3 = false; return u3.forEach(function(n4) { if (n4.__N) { var t3 = n4.__[0]; n4.__ = n4.__N, n4.__N = void 0, t3 !== n4.__[0] && (i3 = true); } }), !(!i3 && o3.__c.props === n3) && (!c2 || c2.call(this, n3, t2, r2)); }; r$4.u = true; var c2 = r$4.shouldComponentUpdate, e2 = r$4.componentWillUpdate; r$4.componentWillUpdate = function(n3, t2, r2) { if (this.__e) { var u3 = c2; c2 = void 0, f2(n3, t2, r2), c2 = u3; } e2 && e2.call(this, n3, t2, r2); }, r$4.shouldComponentUpdate = f2; } return o3.__N || o3.__; } function p$6(u2, i2) { var o3 = d$5(t$2++, 3); !l$5.__s && z$2(o3.__H, i2) && (o3.__ = u2, o3.i = i2, r$4.__H.__h.push(o3)); } function y$5(u2, i2) { var o3 = d$5(t$2++, 4); !l$5.__s && z$2(o3.__H, i2) && (o3.__ = u2, o3.i = i2, r$4.__h.push(o3)); } function _$1(n2) { return o$8 = 5, F$1(function() { return { current: n2 }; }, []); } function A$3(n2, t2, r2) { o$8 = 6, y$5(function() { return "function" == typeof n2 ? (n2(t2()), function() { return n2(null); }) : n2 ? (n2.current = t2(), function() { return n2.current = null; }) : void 0; }, null == r2 ? r2 : r2.concat(n2)); } function F$1(n2, r2) { var u2 = d$5(t$2++, 7); return z$2(u2.__H, r2) ? (u2.__V = n2(), u2.i = r2, u2.__h = n2, u2.__V) : u2.__; } function T$4(n2, t2) { return o$8 = 8, F$1(function() { return n2; }, t2); } function q$1(n2) { var u2 = r$4.context[n2.__c], i2 = d$5(t$2++, 9); return i2.c = n2, u2 ? (null == i2.__ && (i2.__ = true, u2.sub(r$4)), u2.props.value) : n2.__; } function x$3(t2, r2) { l$5.useDebugValue && l$5.useDebugValue(r2 ? r2(t2) : t2); } function P$2(n2) { var u2 = d$5(t$2++, 10), i2 = h$4(); return u2.__ = n2, r$4.componentDidCatch || (r$4.componentDidCatch = function(n3, t2) { u2.__ && u2.__(n3, t2), i2[1](n3); }), [i2[0], function() { i2[1](void 0); }]; } function V$1() { var n2 = d$5(t$2++, 11); if (!n2.__) { for (var u2 = r$4.__v; null !== u2 && !u2.__m && null !== u2.__; ) u2 = u2.__; var i2 = u2.__m || (u2.__m = [0, 0]); n2.__ = "P" + i2[0] + "-" + i2[1]++; } return n2.__; } function b$3() { for (var t2; t2 = f$3.shift(); ) if (t2.__P && t2.__H) try { t2.__H.__h.forEach(k$2), t2.__H.__h.forEach(w$3), t2.__H.__h = []; } catch (r2) { t2.__H.__h = [], l$5.__e(r2, t2.__v); } } l$5.__b = function(n2) { r$4 = null, e$3 && e$3(n2); }, l$5.__r = function(n2) { a$3 && a$3(n2), t$2 = 0; var i2 = (r$4 = n2.__c).__H; i2 && (u$5 === r$4 ? (i2.__h = [], r$4.__h = [], i2.__.forEach(function(n3) { n3.__N && (n3.__ = n3.__N), n3.__V = c$4, n3.__N = n3.i = void 0; })) : (i2.__h.forEach(k$2), i2.__h.forEach(w$3), i2.__h = [], t$2 = 0)), u$5 = r$4; }, l$5.diffed = function(t2) { v$2 && v$2(t2); var o3 = t2.__c; o3 && o3.__H && (o3.__H.__h.length && (1 !== f$3.push(o3) && i$5 === l$5.requestAnimationFrame || ((i$5 = l$5.requestAnimationFrame) || j$2)(b$3)), o3.__H.__.forEach(function(n2) { n2.i && (n2.__H = n2.i), n2.__V !== c$4 && (n2.__ = n2.__V), n2.i = void 0, n2.__V = c$4; })), u$5 = r$4 = null; }, l$5.__c = function(t2, r2) { r2.some(function(t3) { try { t3.__h.forEach(k$2), t3.__h = t3.__h.filter(function(n2) { return !n2.__ || w$3(n2); }); } catch (u2) { r2.some(function(n2) { n2.__h && (n2.__h = []); }), r2 = [], l$5.__e(u2, t3.__v); } }), l$4 && l$4(t2, r2); }, l$5.unmount = function(t2) { m$2 && m$2(t2); var r2, u2 = t2.__c; u2 && u2.__H && (u2.__H.__.forEach(function(n2) { try { k$2(n2); } catch (n3) { r2 = n3; } }), u2.__H = void 0, r2 && l$5.__e(r2, u2.__v)); }; var g$4 = "function" == typeof requestAnimationFrame; function j$2(n2) { var t2, r2 = function() { clearTimeout(u2), g$4 && cancelAnimationFrame(t2), setTimeout(n2); }, u2 = setTimeout(r2, 100); g$4 && (t2 = requestAnimationFrame(r2)); } function k$2(n2) { var t2 = r$4, u2 = n2.__c; "function" == typeof u2 && (n2.__c = void 0, u2()), r$4 = t2; } function w$3(n2) { var t2 = r$4; n2.__c = n2.__(), r$4 = t2; } function z$2(n2, t2) { return !n2 || n2.length !== t2.length || t2.some(function(t3, r2) { return t3 !== n2[r2]; }); } function B$1(n2, t2) { return "function" == typeof t2 ? t2(n2) : t2; } function g$3(n2, t2) { for (var e2 in t2) n2[e2] = t2[e2]; return n2; } function C$1(n2, t2) { for (var e2 in n2) if ("__source" !== e2 && !(e2 in t2)) return true; for (var r2 in t2) if ("__source" !== r2 && n2[r2] !== t2[r2]) return true; return false; } function E$1(n2, t2) { return n2 === t2 && (0 !== n2 || 1 / n2 == 1 / t2) || n2 != n2 && t2 != t2; } function w$2(n2) { this.props = n2; } function x$2(n2, e2) { function r2(n3) { var t2 = this.props.ref, r3 = t2 == n3.ref; return !r3 && t2 && (t2.call ? t2(null) : t2.current = null), e2 ? !e2(this.props, n3) || !r3 : C$1(this.props, n3); } function u2(e3) { return this.shouldComponentUpdate = r2, y$6(n2, e3); } return u2.displayName = "Memo(" + (n2.displayName || n2.name) + ")", u2.prototype.isReactComponent = true, u2.__f = true, u2; } (w$2.prototype = new b$4()).isPureReactComponent = true, w$2.prototype.shouldComponentUpdate = function(n2, t2) { return C$1(this.props, n2) || C$1(this.state, t2); }; var R$3 = l$5.__b; l$5.__b = function(n2) { n2.type && n2.type.__f && n2.ref && (n2.props.ref = n2.ref, n2.ref = null), R$3 && R$3(n2); }; var N$2 = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.forward_ref") || 3911; function k$1(n2) { function t2(t3) { var e2 = g$3({}, t3); return delete e2.ref, n2(e2, t3.ref || null); } return t2.$$typeof = N$2, t2.render = t2, t2.prototype.isReactComponent = t2.__f = true, t2.displayName = "ForwardRef(" + (n2.displayName || n2.name) + ")", t2; } var A$2 = function(n2, t2) { return null == n2 ? null : C$2(C$2(n2).map(t2)); }, O$1 = { map: A$2, forEach: A$2, count: function(n2) { return n2 ? C$2(n2).length : 0; }, only: function(n2) { var t2 = C$2(n2); if (1 !== t2.length) throw "Children.only"; return t2[0]; }, toArray: C$2 }, T$3 = l$5.__e; l$5.__e = function(n2, t2, e2, r2) { if (n2.then) { for (var u2, o3 = t2; o3 = o3.__; ) if ((u2 = o3.__c) && u2.__c) return null == t2.__e && (t2.__e = e2.__e, t2.__k = e2.__k), u2.__c(n2, t2); } T$3(n2, t2, e2, r2); }; var F = l$5.unmount; function I$1(n2, t2, e2) { return n2 && (n2.__c && n2.__c.__H && (n2.__c.__H.__.forEach(function(n3) { "function" == typeof n3.__c && n3.__c(); }), n2.__c.__H = null), null != (n2 = g$3({}, n2)).__c && (n2.__c.__P === e2 && (n2.__c.__P = t2), n2.__c = null), n2.__k = n2.__k && n2.__k.map(function(n3) { return I$1(n3, t2, e2); })), n2; } function L$2(n2, t2, e2) { return n2 && (n2.__v = null, n2.__k = n2.__k && n2.__k.map(function(n3) { return L$2(n3, t2, e2); }), n2.__c && n2.__c.__P === t2 && (n2.__e && e2.insertBefore(n2.__e, n2.__d), n2.__c.__e = true, n2.__c.__P = e2)), n2; } function U() { this.__u = 0, this.t = null, this.__b = null; } function D$3(n2) { var t2 = n2.__.__c; return t2 && t2.__a && t2.__a(n2); } function M$2(n2) { var e2, r2, u2; function o3(o4) { if (e2 || (e2 = n2()).then(function(n3) { r2 = n3.default || n3; }, function(n3) { u2 = n3; }), u2) throw u2; if (!r2) throw e2; return y$6(r2, o4); } return o3.displayName = "Lazy", o3.__f = true, o3; } function V() { this.u = null, this.o = null; } l$5.unmount = function(n2) { var t2 = n2.__c; t2 && t2.__R && t2.__R(), t2 && true === n2.__h && (n2.type = null), F && F(n2); }, (U.prototype = new b$4()).__c = function(n2, t2) { var e2 = t2.__c, r2 = this; null == r2.t && (r2.t = []), r2.t.push(e2); var u2 = D$3(r2.__v), o3 = false, i2 = function() { o3 || (o3 = true, e2.__R = null, u2 ? u2(l2) : l2()); }; e2.__R = i2; var l2 = function() { if (!--r2.__u) { if (r2.state.__a) { var n3 = r2.state.__a; r2.__v.__k[0] = L$2(n3, n3.__c.__P, n3.__c.__O); } var t3; for (r2.setState({ __a: r2.__b = null }); t3 = r2.t.pop(); ) t3.forceUpdate(); } }, c2 = true === t2.__h; r2.__u++ || c2 || r2.setState({ __a: r2.__b = r2.__v.__k[0] }), n2.then(i2, i2); }, U.prototype.componentWillUnmount = function() { this.t = []; }, U.prototype.render = function(n2, e2) { if (this.__b) { if (this.__v.__k) { var r2 = document.createElement("div"), o3 = this.__v.__k[0].__c; this.__v.__k[0] = I$1(this.__b, r2, o3.__O = o3.__P); } this.__b = null; } var i2 = e2.__a && y$6(k$3, null, n2.fallback); return i2 && (i2.__h = null), [y$6(k$3, null, e2.__a ? null : n2.children), i2]; }; var W$1 = function(n2, t2, e2) { if (++e2[1] === e2[0] && n2.o.delete(t2), n2.props.revealOrder && ("t" !== n2.props.revealOrder[0] || !n2.o.size)) for (e2 = n2.u; e2; ) { for (; e2.length > 3; ) e2.pop()(); if (e2[1] < e2[0]) break; n2.u = e2 = e2[2]; } }; function P$1(n2) { return this.getChildContext = function() { return n2.context; }, n2.children; } function j$1(n2) { var e2 = this, r2 = n2.i; e2.componentWillUnmount = function() { D$4(null, e2.l), e2.l = null, e2.i = null; }, e2.i && e2.i !== r2 && e2.componentWillUnmount(), e2.l || (e2.i = r2, e2.l = { nodeType: 1, parentNode: r2, childNodes: [], appendChild: function(n3) { this.childNodes.push(n3), e2.i.appendChild(n3); }, insertBefore: function(n3, t2) { this.childNodes.push(n3), e2.i.appendChild(n3); }, removeChild: function(n3) { this.childNodes.splice(this.childNodes.indexOf(n3) >>> 1, 1), e2.i.removeChild(n3); } }), D$4(y$6(P$1, { context: e2.context }, n2.__v), e2.l); } function z$1(n2, e2) { var r2 = y$6(j$1, { __v: n2, i: e2 }); return r2.containerInfo = e2, r2; } (V.prototype = new b$4()).__a = function(n2) { var t2 = this, e2 = D$3(t2.__v), r2 = t2.o.get(n2); return r2[0]++, function(u2) { var o3 = function() { t2.props.revealOrder ? (r2.push(u2), W$1(t2, n2, r2)) : u2(); }; e2 ? e2(o3) : o3(); }; }, V.prototype.render = function(n2) { this.u = null, this.o = /* @__PURE__ */ new Map(); var t2 = C$2(n2.children); n2.revealOrder && "b" === n2.revealOrder[0] && t2.reverse(); for (var e2 = t2.length; e2--; ) this.o.set(t2[e2], this.u = [1, 0, this.u]); return n2.children; }, V.prototype.componentDidUpdate = V.prototype.componentDidMount = function() { var n2 = this; this.o.forEach(function(t2, e2) { W$1(n2, e2, t2); }); }; var B = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103, H$2 = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, Z$1 = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, Y$1 = /[A-Z0-9]/g, $ = "undefined" != typeof document, q = function(n2) { return ("undefined" != typeof Symbol && "symbol" == typeof Symbol() ? /fil|che|rad/ : /fil|che|ra/).test(n2); }; function G(n2, t2, e2) { return null == t2.__k && (t2.textContent = ""), D$4(n2, t2), "function" == typeof e2 && e2(), n2 ? n2.__c : null; } function J(n2, t2, e2) { return E$2(n2, t2), "function" == typeof e2 && e2(), n2 ? n2.__c : null; } b$4.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(t2) { Object.defineProperty(b$4.prototype, t2, { configurable: true, get: function() { return this["UNSAFE_" + t2]; }, set: function(n2) { Object.defineProperty(this, t2, { configurable: true, writable: true, value: n2 }); } }); }); var K = l$5.event; function Q() { } function X$1() { return this.cancelBubble; } function nn() { return this.defaultPrevented; } l$5.event = function(n2) { return K && (n2 = K(n2)), n2.persist = Q, n2.isPropagationStopped = X$1, n2.isDefaultPrevented = nn, n2.nativeEvent = n2; }; var tn, en = { enumerable: false, configurable: true, get: function() { return this.class; } }, rn = l$5.vnode; l$5.vnode = function(n2) { "string" == typeof n2.type && function(n3) { var t2 = n3.props, e2 = n3.type, u2 = {}; for (var o3 in t2) { var i2 = t2[o3]; if (!("value" === o3 && "defaultValue" in t2 && null == i2 || $ && "children" === o3 && "noscript" === e2 || "class" === o3 || "className" === o3)) { var l2 = o3.toLowerCase(); "defaultValue" === o3 && "value" in t2 && null == t2.value ? o3 = "value" : "download" === o3 && true === i2 ? i2 = "" : "ondoubleclick" === l2 ? o3 = "ondblclick" : "onchange" !== l2 || "input" !== e2 && "textarea" !== e2 || q(t2.type) ? "onfocus" === l2 ? o3 = "onfocusin" : "onblur" === l2 ? o3 = "onfocusout" : Z$1.test(o3) ? o3 = l2 : -1 === e2.indexOf("-") && H$2.test(o3) ? o3 = o3.replace(Y$1, "-$&").toLowerCase() : null === i2 && (i2 = void 0) : l2 = o3 = "oninput", "oninput" === l2 && u2[o3 = l2] && (o3 = "oninputCapture"), u2[o3] = i2; } } "select" == e2 && u2.multiple && Array.isArray(u2.value) && (u2.value = C$2(t2.children).forEach(function(n4) { n4.props.selected = -1 != u2.value.indexOf(n4.props.value); })), "select" == e2 && null != u2.defaultValue && (u2.value = C$2(t2.children).forEach(function(n4) { n4.props.selected = u2.multiple ? -1 != u2.defaultValue.indexOf(n4.props.value) : u2.defaultValue == n4.props.value; })), t2.class && !t2.className ? (u2.class = t2.class, Object.defineProperty(u2, "className", en)) : (t2.className && !t2.class || t2.class && t2.className) && (u2.class = u2.className = t2.className), n3.props = u2; }(n2), n2.$$typeof = B, rn && rn(n2); }; var un = l$5.__r; l$5.__r = function(n2) { un && un(n2), tn = n2.__c; }; var on = l$5.diffed; l$5.diffed = function(n2) { on && on(n2); var t2 = n2.props, e2 = n2.__e; null != e2 && "textarea" === n2.type && "value" in t2 && t2.value !== e2.value && (e2.value = null == t2.value ? "" : t2.value), tn = null; }; var ln = { ReactCurrentDispatcher: { current: { readContext: function(n2) { return tn.__n[n2.__c].props.value; } } } }, cn = "17.0.2"; function fn(n2) { return y$6.bind(null, n2); } function an(n2) { return !!n2 && n2.$$typeof === B; } function sn(n2) { return an(n2) && n2.type === k$3; } function hn(n2) { return an(n2) ? F$2.apply(null, arguments) : n2; } function vn(n2) { return !!n2.__k && (D$4(null, n2), true); } function dn(n2) { return n2 && (n2.base || 1 === n2.nodeType && n2) || null; } var pn = function(n2, t2) { return n2(t2); }, mn = function(n2, t2) { return n2(t2); }, yn = k$3; function _n(n2) { n2(); } function bn(n2) { return n2; } function Sn() { return [false, _n]; } var gn = y$5, Cn = an; function En(n2, t2) { var e2 = t2(), r2 = h$4({ h: { __: e2, v: t2 } }), u2 = r2[0].h, o3 = r2[1]; return y$5(function() { u2.__ = e2, u2.v = t2, E$1(u2.__, t2()) || o3({ h: u2 }); }, [n2, e2, t2]), p$6(function() { return E$1(u2.__, u2.v()) || o3({ h: u2 }), n2(function() { E$1(u2.__, u2.v()) || o3({ h: u2 }); }); }, [n2]), e2; } var wn = { useState: h$4, useId: V$1, useReducer: s$6, useEffect: p$6, useLayoutEffect: y$5, useInsertionEffect: gn, useTransition: Sn, useDeferredValue: bn, useSyncExternalStore: En, startTransition: _n, useRef: _$1, useImperativeHandle: A$3, useMemo: F$1, useCallback: T$4, useContext: q$1, useDebugValue: x$3, version: "17.0.2", Children: O$1, render: G, hydrate: J, unmountComponentAtNode: vn, createPortal: z$1, createElement: y$6, createContext: G$1, createFactory: fn, cloneElement: hn, createRef: _$2, Fragment: k$3, isValidElement: an, isElement: Cn, isFragment: sn, findDOMNode: dn, Component: b$4, PureComponent: w$2, memo: x$2, forwardRef: k$1, flushSync: mn, unstable_batchedUpdates: pn, StrictMode: yn, Suspense: U, SuspenseList: V, lazy: M$2, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ln }; const e$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, Children: O$1, Component: b$4, Fragment: k$3, PureComponent: w$2, StrictMode: yn, Suspense: U, SuspenseList: V, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ln, cloneElement: hn, createContext: G$1, createElement: y$6, createFactory: fn, createPortal: z$1, createRef: _$2, default: wn, findDOMNode: dn, flushSync: mn, forwardRef: k$1, hydrate: J, isElement: Cn, isFragment: sn, isValidElement: an, lazy: M$2, memo: x$2, render: G, startTransition: _n, unmountComponentAtNode: vn, unstable_batchedUpdates: pn, useCallback: T$4, useContext: q$1, useDebugValue: x$3, useDeferredValue: bn, useEffect: p$6, useErrorBoundary: P$2, useId: V$1, useImperativeHandle: A$3, useInsertionEffect: gn, useLayoutEffect: y$5, useMemo: F$1, useReducer: s$6, useRef: _$1, useState: h$4, useSyncExternalStore: En, useTransition: Sn, version: cn }, Symbol.toStringTag, { value: "Module" })); function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) { return function handleEvent(event) { originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event); if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event); }; } function $6ed0406888f73fc4$var$setRef(ref, value) { if (typeof ref === "function") ref(value); else if (ref !== null && ref !== void 0) ref.current = value; } function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) { return (node2) => refs.forEach( (ref) => $6ed0406888f73fc4$var$setRef(ref, node2) ); } function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) { return T$4($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs); } function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) { let defaultContexts = []; function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) { const BaseContext = /* @__PURE__ */ G$1(defaultContext); const index2 = defaultContexts.length; defaultContexts = [ ...defaultContexts, defaultContext ]; function Provider(props) { const { scope, children, ...context } = props; const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext; const value = F$1( () => context, Object.values(context) ); return /* @__PURE__ */ y$6(Context.Provider, { value }, children); } function useContext(consumerName, scope) { const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext; const context = q$1(Context); if (context) return context; if (defaultContext !== void 0) return defaultContext; throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``); } Provider.displayName = rootComponentName + "Provider"; return [ Provider, useContext ]; } const createScope = () => { const scopeContexts = defaultContexts.map((defaultContext) => { return /* @__PURE__ */ G$1(defaultContext); }); return function useScope(scope) { const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts; return F$1( () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }), [ scope, contexts ] ); }; }; createScope.scopeName = scopeName; return [ $c512c27ab02ef895$export$fd42f52fd3ae1109, $c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps) ]; } function $c512c27ab02ef895$var$composeContextScopes(...scopes) { const baseScope = scopes[0]; if (scopes.length === 1) return baseScope; const createScope1 = () => { const scopeHooks = scopes.map( (createScope) => ({ useScope: createScope(), scopeName: createScope.scopeName }) ); return function useComposedScopes(overrideScopes) { const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope, scopeName }) => { const scopeProps = useScope(overrideScopes); const currentScope = scopeProps[`__scope${scopeName}`]; return { ...nextScopes, ...currentScope }; }, {}); return F$1( () => ({ [`__scope${baseScope.scopeName}`]: nextScopes1 }), [ nextScopes1 ] ); }; }; createScope1.scopeName = baseScope.scopeName; return createScope1; } const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? y$5 : () => { }; const $1746a345f3d73bb7$var$useReactId = e$2["useId".toString()] || (() => void 0); let $1746a345f3d73bb7$var$count = 0; function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) { const [id, setId] = h$4($1746a345f3d73bb7$var$useReactId()); $9f79659886946c16$export$e5c5a5f917a5871c(() => { if (!deterministicId) setId( (reactId) => reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++) ); }, [ deterministicId ]); return deterministicId || (id ? `radix-${id}` : ""); } function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) { const callbackRef = _$1(callback); p$6(() => { callbackRef.current = callback; }); return F$1( () => (...args) => { var _callbackRef$current; return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args); }, [] ); } function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop, defaultProp, onChange = () => { } }) { const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp, onChange }); const isControlled = prop !== void 0; const value1 = isControlled ? prop : uncontrolledProp; const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange); const setValue = T$4((nextValue) => { if (isControlled) { const setter = nextValue; const value = typeof nextValue === "function" ? setter(prop) : nextValue; if (value !== prop) handleChange(value); } else setUncontrolledProp(nextValue); }, [ isControlled, prop, setUncontrolledProp, handleChange ]); return [ value1, setValue ]; } function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp, onChange }) { const uncontrolledState = h$4(defaultProp); const [value] = uncontrolledState; const prevValueRef = _$1(value); const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange); p$6(() => { if (prevValueRef.current !== value) { handleChange(value); prevValueRef.current = value; } }, [ value, prevValueRef, handleChange ]); return uncontrolledState; } const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /* @__PURE__ */ k$1((props, forwardedRef) => { const { children, ...slotProps } = props; const childrenArray = O$1.toArray(children); const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable); if (slottable) { const newElement = slottable.props.children; const newChildren = childrenArray.map((child) => { if (child === slottable) { if (O$1.count(newElement) > 1) return O$1.only(null); return /* @__PURE__ */ an(newElement) ? newElement.props.children : null; } else return child; }); return /* @__PURE__ */ y$6($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, { ref: forwardedRef }), /* @__PURE__ */ an(newElement) ? /* @__PURE__ */ hn(newElement, void 0, newChildren) : null); } return /* @__PURE__ */ y$6($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, { ref: forwardedRef }), children); }); $5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = "Slot"; const $5e63c961fc1ce211$var$SlotClone = /* @__PURE__ */ k$1((props, forwardedRef) => { const { children, ...slotProps } = props; if (/* @__PURE__ */ an(children)) return /* @__PURE__ */ hn(children, { ...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props), ref: $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref) }); return O$1.count(children) > 1 ? O$1.only(null) : null; }); $5e63c961fc1ce211$var$SlotClone.displayName = "SlotClone"; const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children }) => { return /* @__PURE__ */ y$6(k$3, null, children); }; function $5e63c961fc1ce211$var$isSlottable(child) { return /* @__PURE__ */ an(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45; } function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) { const overrideProps = { ...childProps }; for (const propName in childProps) { const slotPropValue = slotProps[propName]; const childPropValue = childProps[propName]; const isHandler = /^on[A-Z]/.test(propName); if (isHandler) { if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => { childPropValue(...args); slotPropValue(...args); }; else if (slotPropValue) overrideProps[propName] = slotPropValue; } else if (propName === "style") overrideProps[propName] = { ...slotPropValue, ...childPropValue }; else if (propName === "className") overrideProps[propName] = [ slotPropValue, childPropValue ].filter(Boolean).join(" "); } return { ...slotProps, ...overrideProps }; } const $8927f6f2acc4f386$var$NODES = [ "a", "button", "div", "form", "h2", "h3", "img", "input", "label", "li", "nav", "ol", "p", "span", "svg", "ul" ]; const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node2) => { const Node = /* @__PURE__ */ k$1((props, forwardedRef) => { const { asChild, ...primitiveProps } = props; const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node2; p$6(() => { window[Symbol.for("radix-ui")] = true; }, []); return /* @__PURE__ */ y$6(Comp, _extends({}, primitiveProps, { ref: forwardedRef })); }); Node.displayName = `Primitive.${node2}`; return { ...primitive, [node2]: Node }; }, {}); function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) { if (target) mn( () => target.dispatchEvent(event) ); } function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) { const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp); p$6(() => { const handleKeyDown = (event) => { if (event.key === "Escape") onEscapeKeyDown(event); }; ownerDocument.addEventListener("keydown", handleKeyDown); return () => ownerDocument.removeEventListener("keydown", handleKeyDown); }, [ onEscapeKeyDown, ownerDocument ]); } const $5cb92bef7577960e$var$CONTEXT_UPDATE = "dismissableLayer.update"; const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside"; const $5cb92bef7577960e$var$FOCUS_OUTSIDE = "dismissableLayer.focusOutside"; let $5cb92bef7577960e$var$originalBodyPointerEvents; const $5cb92bef7577960e$var$DismissableLayerContext = /* @__PURE__ */ G$1({ layers: /* @__PURE__ */ new Set(), layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(), branches: /* @__PURE__ */ new Set() }); const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /* @__PURE__ */ k$1((props, forwardedRef) => { var _node$ownerDocument; const { disableOutsidePointerEvents = false, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onDismiss, ...layerProps } = props; const context = q$1($5cb92bef7577960e$var$DismissableLayerContext); const [node1, setNode] = h$4(null); const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document; const [, force] = h$4({}); const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05( forwardedRef, (node2) => setNode(node2) ); const layers = Array.from(context.layers); const [highestLayerWithOutsidePointerEventsDisabled] = [ ...context.layersWithOutsidePointerEventsDisabled ].slice(-1); const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); const index2 = node1 ? layers.indexOf(node1) : -1; const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0; const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex; const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event) => { const target = event.target; const isPointerDownOnBranch = [ ...context.branches ].some( (branch) => branch.contains(target) ); if (!isPointerEventsEnabled || isPointerDownOnBranch) return; onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event); onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event); if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss(); }, ownerDocument); const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event) => { const target = event.target; const isFocusInBranch = [ ...context.branches ].some( (branch) => branch.contains(target) ); if (isFocusInBranch) return; onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event); onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event); if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss(); }, ownerDocument); $addc16e1bbe58fd0$export$3a72a57244d6e765((event) => { const isHighestLayer = index2 === context.layers.size - 1; if (!isHighestLayer) return; onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event); if (!event.defaultPrevented && onDismiss) { event.preventDefault(); onDismiss(); } }, ownerDocument); p$6(() => { if (!node1) return; if (disableOutsidePointerEvents) { if (context.layersWithOutsidePointerEventsDisabled.size === 0) { $5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents; ownerDocument.body.style.pointerEvents = "none"; } context.layersWithOutsidePointerEventsDisabled.add(node1); } context.layers.add(node1); $5cb92bef7577960e$var$dispatchUpdate(); return () => { if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents; }; }, [ node1, ownerDocument, disableOutsidePointerEvents, context ]); p$6(() => { return () => { if (!node1) return; context.layers.delete(node1); context.layersWithOutsidePointerEventsDisabled.delete(node1); $5cb92bef7577960e$var$dispatchUpdate(); }; }, [ node1, context ]); p$6(() => { const handleUpdate = () => force({}); document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate); return () => document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate); }, []); return /* @__PURE__ */ y$6($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, layerProps, { ref: composedRefs, style: { pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0, ...props.style }, onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture), onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture), onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture) })); }); function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) { const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside); const isPointerInsideReactTreeRef = _$1(false); const handleClickRef = _$1(() => { }); p$6(() => { const handlePointerDown = (event) => { if (event.target && !isPointerInsideReactTreeRef.current) { let handleAndDispatchPointerDownOutsideEvent = function() { $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, { discrete: true }); }; const eventDetail = { originalEvent: event }; if (event.pointerType === "touch") { ownerDocument.removeEventListener("click", handleClickRef.current); handleClickRef.current = handleAndDispatchPointerDownOutsideEvent; ownerDocument.addEventListener("click", handleClickRef.current, { once: true }); } else handleAndDispatchPointerDownOutsideEvent(); } isPointerInsideReactTreeRef.current = false; }; const timerId = window.setTimeout(() => { ownerDocument.addEventListener("pointerdown", handlePointerDown); }, 0); return () => { window.clearTimeout(timerId); ownerDocument.removeEventListener("pointerdown", handlePointerDown); ownerDocument.removeEventListener("click", handleClickRef.current); }; }, [ ownerDocument, handlePointerDownOutside ]); return { // ensures we check React component tree (not just DOM tree) onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true }; } function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) { const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside); const isFocusInsideReactTreeRef = _$1(false); p$6(() => { const handleFocus = (event) => { if (event.target && !isFocusInsideReactTreeRef.current) { const eventDetail = { originalEvent: event }; $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, { discrete: false }); } }; ownerDocument.addEventListener("focusin", handleFocus); return () => ownerDocument.removeEventListener("focusin", handleFocus); }, [ ownerDocument, handleFocusOutside ]); return { onFocusCapture: () => isFocusInsideReactTreeRef.current = true, onBlurCapture: () => isFocusInsideReactTreeRef.current = false }; } function $5cb92bef7577960e$var$dispatchUpdate() { const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE); document.dispatchEvent(event); } function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete }) { const target = detail.originalEvent.target; const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail }); if (handler) target.addEventListener(name, handler, { once: true }); if (discrete) $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event); else target.dispatchEvent(event); } const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount"; const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount"; const $d3863c46a17e8a28$var$EVENT_OPTIONS = { bubbles: false, cancelable: true }; const $d3863c46a17e8a28$export$20e40289641fbbb6 = /* @__PURE__ */ k$1((props, forwardedRef) => { const { loop = false, trapped = false, onMountAutoFocus: onMountAutoFocusProp, onUnmountAutoFocus: onUnmountAutoFocusProp, ...scopeProps } = props; const [container1, setContainer] = h$4(null); const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp); const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp); const lastFocusedElementRef = _$1(null); const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05( forwardedRef, (node2) => setContainer(node2) ); const focusScope = _$1({ paused: false, pause() { this.paused = true; }, resume() { this.paused = false; } }).current; p$6(() => { if (trapped) { let handleFocusIn = function(event) { if (focusScope.paused || !container1) return; const target = event.target; if (container1.contains(target)) lastFocusedElementRef.current = target; else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, { select: true }); }, handleFocusOut = function(event) { if (focusScope.paused || !container1) return; if (!container1.contains(event.relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, { select: true }); }; document.addEventListener("focusin", handleFocusIn); document.addEventListener("focusout", handleFocusOut); return () => { document.removeEventListener("focusin", handleFocusIn); document.removeEventListener("focusout", handleFocusOut); }; } }, [ trapped, container1, focusScope.paused ]); p$6(() => { if (container1) { $d3863c46a17e8a28$var$focusScopesStack.add(focusScope); const previouslyFocusedElement = document.activeElement; const hasFocusedCandidate = container1.contains(previouslyFocusedElement); if (!hasFocusedCandidate) { const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS); container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); container1.dispatchEvent(mountEvent); if (!mountEvent.defaultPrevented) { $d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), { select: true }); if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1); } } return () => { container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); setTimeout(() => { const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS); container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus); container1.dispatchEvent(unmountEvent); if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, { select: true }); container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus); $d3863c46a17e8a28$var$focusScopesStack.remove(focusScope); }, 0); }; } }, [ container1, onMountAutoFocus, onUnmountAutoFocus, focusScope ]); const handleKeyDown = T$4((event) => { if (!loop && !trapped) return; if (focusScope.paused) return; const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey; const focusedElement = document.activeElement; if (isTabKey && focusedElement) { const container = event.currentTarget; const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container); const hasTabbableElementsInside = first && last; if (!hasTabbableElementsInside) { if (focusedElement === container) event.preventDefault(); } else { if (!event.shiftKey && focusedElement === last) { event.preventDefault(); if (loop) $d3863c46a17e8a28$var$focus(first, { select: true }); } else if (event.shiftKey && focusedElement === first) { event.preventDefault(); if (loop) $d3863c46a17e8a28$var$focus(last, { select: true }); } } } }, [ loop, trapped, focusScope.paused ]); return /* @__PURE__ */ y$6($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({ tabIndex: -1 }, scopeProps, { ref: composedRefs, onKeyDown: handleKeyDown })); }); function $d3863c46a17e8a28$var$focusFirst(candidates, { select = false } = {}) { const previouslyFocusedElement = document.activeElement; for (const candidate of candidates) { $d3863c46a17e8a28$var$focus(candidate, { select }); if (document.activeElement !== previouslyFocusedElement) return; } } function $d3863c46a17e8a28$var$getTabbableEdges(container) { const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container); const first = $d3863c46a17e8a28$var$findVisible(candidates, container); const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container); return [ first, last ]; } function $d3863c46a17e8a28$var$getTabbableCandidates(container) { const nodes = []; const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { acceptNode: (node2) => { const isHiddenInput = node2.tagName === "INPUT" && node2.type === "hidden"; if (node2.disabled || node2.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; return node2.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } }); while (walker.nextNode()) nodes.push(walker.currentNode); return nodes; } function $d3863c46a17e8a28$var$findVisible(elements, container) { for (const element2 of elements) { if (!$d3863c46a17e8a28$var$isHidden(element2, { upTo: container })) return element2; } } function $d3863c46a17e8a28$var$isHidden(node2, { upTo }) { if (getComputedStyle(node2).visibility === "hidden") return true; while (node2) { if (upTo !== void 0 && node2 === upTo) return false; if (getComputedStyle(node2).display === "none") return true; node2 = node2.parentElement; } return false; } function $d3863c46a17e8a28$var$isSelectableInput(element2) { return element2 instanceof HTMLInputElement && "select" in element2; } function $d3863c46a17e8a28$var$focus(element2, { select = false } = {}) { if (element2 && element2.focus) { const previouslyFocusedElement = document.activeElement; element2.focus({ preventScroll: true }); if (element2 !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element2) && select) element2.select(); } } const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack(); function $d3863c46a17e8a28$var$createFocusScopesStack() { let stack = []; return { add(focusScope) { const activeFocusScope = stack[0]; if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause(); stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope); stack.unshift(focusScope); }, remove(focusScope) { var _stack$; stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope); (_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume(); } }; } function $d3863c46a17e8a28$var$arrayRemove(array, item) { const updatedArray = [ ...array ]; const index2 = updatedArray.indexOf(item); if (index2 !== -1) updatedArray.splice(index2, 1); return updatedArray; } function $d3863c46a17e8a28$var$removeLinks(items) { return items.filter( (item) => item.tagName !== "A" ); } const $f1701beae083dbae$export$602eac185826482c = /* @__PURE__ */ k$1((props, forwardedRef) => { var _globalThis$document; const { container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body, ...portalProps } = props; return container ? /* @__PURE__ */ wn.createPortal(/* @__PURE__ */ y$6($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, portalProps, { ref: forwardedRef })), container) : null; }); function $fe963b355347cc68$export$3e6543de14f8614f(initialState, machine) { return s$6((state, event) => { const nextState = machine[state][event]; return nextState !== null && nextState !== void 0 ? nextState : state; }, initialState); } const $921a889cee6df7e8$export$99c2b779aa4e8b8b = (props) => { const { present, children } = props; const presence = $921a889cee6df7e8$var$usePresence(present); const child = typeof children === "function" ? children({ present: presence.isPresent }) : O$1.only(children); const ref = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(presence.ref, child.ref); const forceMount = typeof children === "function"; return forceMount || presence.isPresent ? /* @__PURE__ */ hn(child, { ref }) : null; }; $921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = "Presence"; function $921a889cee6df7e8$var$usePresence(present) { const [node1, setNode] = h$4(); const stylesRef = _$1({}); const prevPresentRef = _$1(present); const prevAnimationNameRef = _$1("none"); const initialState = present ? "mounted" : "unmounted"; const [state, send] = $fe963b355347cc68$export$3e6543de14f8614f(initialState, { mounted: { UNMOUNT: "unmounted", ANIMATION_OUT: "unmountSuspended" }, unmountSuspended: { MOUNT: "mounted", ANIMATION_END: "unmounted" }, unmounted: { MOUNT: "mounted" } }); p$6(() => { const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current); prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none"; }, [ state ]); $9f79659886946c16$export$e5c5a5f917a5871c(() => { const styles = stylesRef.current; const wasPresent = prevPresentRef.current; const hasPresentChanged = wasPresent !== present; if (hasPresentChanged) { const prevAnimationName = prevAnimationNameRef.current; const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(styles); if (present) send("MOUNT"); else if (currentAnimationName === "none" || (styles === null || styles === void 0 ? void 0 : styles.display) === "none") send("UNMOUNT"); else { const isAnimating = prevAnimationName !== currentAnimationName; if (wasPresent && isAnimating) send("ANIMATION_OUT"); else send("UNMOUNT"); } prevPresentRef.current = present; } }, [ present, send ]); $9f79659886946c16$export$e5c5a5f917a5871c(() => { if (node1) { const handleAnimationEnd = (event) => { const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current); const isCurrentAnimation = currentAnimationName.includes(event.animationName); if (event.target === node1 && isCurrentAnimation) mn( () => send("ANIMATION_END") ); }; const handleAnimationStart = (event) => { if (event.target === node1) prevAnimationNameRef.current = $921a889cee6df7e8$var$getAnimationName(stylesRef.current); }; node1.addEventListener("animationstart", handleAnimationStart); node1.addEventListener("animationcancel", handleAnimationEnd); node1.addEventListener("animationend", handleAnimationEnd); return () => { node1.removeEventListener("animationstart", handleAnimationStart); node1.removeEventListener("animationcancel", handleAnimationEnd); node1.removeEventListener("animationend", handleAnimationEnd); }; } else send("ANIMATION_END"); }, [ node1, send ]); return { isPresent: [ "mounted", "unmountSuspended" ].includes(state), ref: T$4((node2) => { if (node2) stylesRef.current = getComputedStyle(node2); setNode(node2); }, []) }; } function $921a889cee6df7e8$var$getAnimationName(styles) { return (styles === null || styles === void 0 ? void 0 : styles.animationName) || "none"; } let $3db38b7d1fb3fe6a$var$count = 0; function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() { p$6(() => { var _edgeGuards$, _edgeGuards$2; const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]"); document.body.insertAdjacentElement("afterbegin", (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard()); document.body.insertAdjacentElement("beforeend", (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard()); $3db38b7d1fb3fe6a$var$count++; return () => { if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll("[data-radix-focus-guard]").forEach( (node2) => node2.remove() ); $3db38b7d1fb3fe6a$var$count--; }; }, []); } function $3db38b7d1fb3fe6a$var$createFocusGuard() { const element2 = document.createElement("span"); element2.setAttribute("data-radix-focus-guard", ""); element2.tabIndex = 0; element2.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none"; return element2; } 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 p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t2[p2] = s2[p2]; } return t2; }; return __assign.apply(this, arguments); }; function __rest(s2, e2) { var t2 = {}; for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2]; if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) { if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2])) t2[p2[i2]] = s2[p2[i2]]; } return t2; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i2 = 0, l2 = from.length, ar; i2 < l2; i2++) { if (ar || !(i2 in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i2); ar[i2] = from[i2]; } } return to.concat(ar || Array.prototype.slice.call(from)); } var zeroRightClassName = "right-scroll-bar-position"; var fullWidthClassName = "width-before-scroll-bar"; var noScrollbarsClassName = "with-scroll-bars-hidden"; var removedBarSizeVariable = "--removed-body-scroll-bar-size"; function assignRef(ref, value) { if (typeof ref === "function") { ref(value); } else if (ref) { ref.current = value; } return ref; } function useCallbackRef(initialValue, callback) { var ref = h$4(function() { return { // value value: initialValue, // last callback callback, // "memoized" public interface facade: { get current() { return ref.value; }, set current(value) { var last = ref.value; if (last !== value) { ref.value = value; ref.callback(value, last); } } } }; })[0]; ref.callback = callback; return ref.facade; } function useMergeRefs(refs, defaultValue) { return useCallbackRef(defaultValue || null, function(newValue) { return refs.forEach(function(ref) { return assignRef(ref, newValue); }); }); } function ItoI(a2) { return a2; } function innerCreateMedium(defaults, middleware) { if (middleware === void 0) { middleware = ItoI; } var buffer = []; var assigned = false; var medium = { read: function() { if (assigned) { throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`."); } if (buffer.length) { return buffer[buffer.length - 1]; } return defaults; }, useMedium: function(data) { var item = middleware(data, assigned); buffer.push(item); return function() { buffer = buffer.filter(function(x2) { return x2 !== item; }); }; }, assignSyncMedium: function(cb) { assigned = true; while (buffer.length) { var cbs = buffer; buffer = []; cbs.forEach(cb); } buffer = { push: function(x2) { return cb(x2); }, filter: function() { return buffer; } }; }, assignMedium: function(cb) { assigned = true; var pendingQueue = []; if (buffer.length) { var cbs = buffer; buffer = []; cbs.forEach(cb); pendingQueue = buffer; } var executeQueue = function() { var cbs2 = pendingQueue; pendingQueue = []; cbs2.forEach(cb); }; var cycle = function() { return Promise.resolve().then(executeQueue); }; cycle(); buffer = { push: function(x2) { pendingQueue.push(x2); cycle(); }, filter: function(filter) { pendingQueue = pendingQueue.filter(filter); return buffer; } }; } }; return medium; } function createSidecarMedium(options) { if (options === void 0) { options = {}; } var medium = innerCreateMedium(null); medium.options = __assign({ async: true, ssr: false }, options); return medium; } var SideCar$1 = function(_a) { var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]); if (!sideCar) { throw new Error("Sidecar: please provide `sideCar` property to import the right car"); } var Target = sideCar.read(); if (!Target) { throw new Error("Sidecar medium not found"); } return y$6(Target, __assign({}, rest)); }; SideCar$1.isSideCarExport = true; function exportSidecar(medium, exported) { medium.useMedium(exported); return SideCar$1; } var effectCar = createSidecarMedium(); var nothing = function() { return; }; var RemoveScroll = k$1(function(props, parentRef) { var ref = _$1(null); var _a = h$4({ onScrollCapture: nothing, onWheelCapture: nothing, onTouchMoveCapture: nothing }), callbacks = _a[0], setCallbacks = _a[1]; var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as"]); var SideCar2 = sideCar; var containerRef = useMergeRefs([ref, parentRef]); var containerProps = __assign(__assign({}, rest), callbacks); return y$6( k$3, null, enabled && y$6(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref }), forwardProps ? hn(O$1.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : y$6(Container, __assign({}, containerProps, { className, ref: containerRef }), children) ); }); RemoveScroll.defaultProps = { enabled: true, removeScrollBar: true, inert: false }; RemoveScroll.classNames = { fullWidth: fullWidthClassName, zeroRight: zeroRightClassName }; var getNonce = function() { if (typeof __webpack_nonce__ !== "undefined") { return __webpack_nonce__; } return void 0; }; function makeStyleTag() { if (!document) return null; var tag = document.createElement("style"); tag.type = "text/css"; var nonce = getNonce(); if (nonce) { tag.setAttribute("nonce", nonce); } return tag; } function injectStyles(tag, css) { if (tag.styleSheet) { tag.styleSheet.cssText = css; } else { tag.appendChild(document.createTextNode(css)); } } function insertStyleTag(tag) { var head2 = document.head || document.getElementsByTagName("head")[0]; head2.appendChild(tag); } var stylesheetSingleton = function() { var counter = 0; var stylesheet = null; return { add: function(style) { if (counter == 0) { if (stylesheet = makeStyleTag()) { injectStyles(stylesheet, style); insertStyleTag(stylesheet); } } counter++; }, remove: function() { counter--; if (!counter && stylesheet) { stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet); stylesheet = null; } } }; }; var styleHookSingleton = function() { var sheet = stylesheetSingleton(); return function(styles, isDynamic) { p$6(function() { sheet.add(styles); return function() { sheet.remove(); }; }, [styles && isDynamic]); }; }; var styleSingleton = function() { var useStyle = styleHookSingleton(); var Sheet = function(_a) { var styles = _a.styles, dynamic = _a.dynamic; useStyle(styles, dynamic); return null; }; return Sheet; }; var zeroGap = { left: 0, top: 0, right: 0, gap: 0 }; var parse$1 = function(x2) { return parseInt(x2 || "", 10) || 0; }; var getOffset = function(gapMode) { var cs = window.getComputedStyle(document.body); var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"]; var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"]; var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"]; return [parse$1(left), parse$1(top), parse$1(right)]; }; var getGapWidth = function(gapMode) { if (gapMode === void 0) { gapMode = "margin"; } if (typeof window === "undefined") { return zeroGap; } var offsets = getOffset(gapMode); var documentWidth = document.documentElement.clientWidth; var windowWidth = window.innerWidth; return { left: offsets[0], top: offsets[1], right: offsets[2], gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]) }; }; var Style = styleSingleton(); var getStyles = function(_a, allowRelative, gapMode, important) { var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap; if (gapMode === void 0) { gapMode = "margin"; } return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([ allowRelative && "position: relative ".concat(important, ";"), gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "), gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";") ].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n"); }; var RemoveScrollBar = function(props) { var noRelative = props.noRelative, noImportant = props.noImportant, _a = props.gapMode, gapMode = _a === void 0 ? "margin" : _a; var gap = F$1(function() { return getGapWidth(gapMode); }, [gapMode]); return y$6(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") }); }; var passiveSupported = false; if (typeof window !== "undefined") { try { var options = Object.defineProperty({}, "passive", { get: function() { passiveSupported = true; return true; } }); window.addEventListener("test", options, options); window.removeEventListener("test", options, options); } catch (err) { passiveSupported = false; } } var nonPassive = passiveSupported ? { passive: false } : false; var alwaysContainsScroll = function(node2) { return node2.tagName === "TEXTAREA"; }; var elementCanBeScrolled = function(node2, overflow) { var styles = window.getComputedStyle(node2); return ( // not-not-scrollable styles[overflow] !== "hidden" && // contains scroll inside self !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node2) && styles[overflow] === "visible") ); }; var elementCouldBeVScrolled = function(node2) { return elementCanBeScrolled(node2, "overflowY"); }; var elementCouldBeHScrolled = function(node2) { return elementCanBeScrolled(node2, "overflowX"); }; var locationCouldBeScrolled = function(axis, node2) { var current = node2; do { if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) { current = current.host; } var isScrollable = elementCouldBeScrolled(axis, current); if (isScrollable) { var _a = getScrollVariables(axis, current), s2 = _a[1], d2 = _a[2]; if (s2 > d2) { return true; } } current = current.parentNode; } while (current && current !== document.body); return false; }; var getVScrollVariables = function(_a) { var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight; return [ scrollTop, scrollHeight, clientHeight ]; }; var getHScrollVariables = function(_a) { var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth; return [ scrollLeft, scrollWidth, clientWidth ]; }; var elementCouldBeScrolled = function(axis, node2) { return axis === "v" ? elementCouldBeVScrolled(node2) : elementCouldBeHScrolled(node2); }; var getScrollVariables = function(axis, node2) { return axis === "v" ? getVScrollVariables(node2) : getHScrollVariables(node2); }; var getDirectionFactor = function(axis, direction) { return axis === "h" && direction === "rtl" ? -1 : 1; }; var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) { var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction); var delta = directionFactor * sourceDelta; var target = event.target; var targetInLock = endTarget.contains(target); var shouldCancelScroll = false; var isDeltaPositive = delta > 0; var availableScroll = 0; var availableScrollTop = 0; do { var _a = getScrollVariables(axis, target), position2 = _a[0], scroll_1 = _a[1], capacity = _a[2]; var elementScroll = scroll_1 - capacity - directionFactor * position2; if (position2 || elementScroll) { if (elementCouldBeScrolled(axis, target)) { availableScroll += elementScroll; availableScrollTop += position2; } } target = target.parentNode; } while ( // portaled content !targetInLock && target !== document.body || // self content targetInLock && (endTarget.contains(target) || endTarget === target) ); if (isDeltaPositive && (noOverscroll && availableScroll === 0 || !noOverscroll && delta > availableScroll)) { shouldCancelScroll = true; } else if (!isDeltaPositive && (noOverscroll && availableScrollTop === 0 || !noOverscroll && -delta > availableScrollTop)) { shouldCancelScroll = true; } return shouldCancelScroll; }; var getTouchXY = function(event) { return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0]; }; var getDeltaXY = function(event) { return [event.deltaX, event.deltaY]; }; var extractRef = function(ref) { return ref && "current" in ref ? ref.current : ref; }; var deltaCompare = function(x2, y2) { return x2[0] === y2[0] && x2[1] === y2[1]; }; var generateStyle = function(id) { return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); }; var idCounter = 0; var lockStack = []; function RemoveScrollSideCar(props) { var shouldPreventQueue = _$1([]); var touchStartRef = _$1([0, 0]); var activeAxis = _$1(); var id = h$4(idCounter++)[0]; var Style2 = h$4(function() { return styleSingleton(); })[0]; var lastProps = _$1(props); p$6(function() { lastProps.current = props; }, [props]); p$6(function() { if (props.inert) { document.body.classList.add("block-interactivity-".concat(id)); var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean); allow_1.forEach(function(el) { return el.classList.add("allow-interactivity-".concat(id)); }); return function() { document.body.classList.remove("block-interactivity-".concat(id)); allow_1.forEach(function(el) { return el.classList.remove("allow-interactivity-".concat(id)); }); }; } return; }, [props.inert, props.lockRef.current, props.shards]); var shouldCancelEvent = T$4(function(event, parent) { if ("touches" in event && event.touches.length === 2) { return !lastProps.current.allowPinchZoom; } var touch = getTouchXY(event); var touchStart = touchStartRef.current; var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0]; var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1]; var currentAxis; var target = event.target; var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v"; if ("touches" in event && moveDirection === "h" && target.type === "range") { return false; } var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target); if (!canBeScrolledInMainDirection) { return true; } if (canBeScrolledInMainDirection) { currentAxis = moveDirection; } else { currentAxis = moveDirection === "v" ? "h" : "v"; canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target); } if (!canBeScrolledInMainDirection) { return false; } if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) { activeAxis.current = currentAxis; } if (!currentAxis) { return true; } var cancelingAxis = activeAxis.current || currentAxis; return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true); }, []); var shouldPrevent = T$4(function(_event) { var event = _event; if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) { return; } var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event); var sourceEvent = shouldPreventQueue.current.filter(function(e2) { return e2.name === event.type && e2.target === event.target && deltaCompare(e2.delta, delta); })[0]; if (sourceEvent && sourceEvent.should) { if (event.cancelable) { event.preventDefault(); } return; } if (!sourceEvent) { var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node2) { return node2.contains(event.target); }); var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation; if (shouldStop) { if (event.cancelable) { event.preventDefault(); } } } }, []); var shouldCancel = T$4(function(name, delta, target, should) { var event = { name, delta, target, should }; shouldPreventQueue.current.push(event); setTimeout(function() { shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e2) { return e2 !== event; }); }, 1); }, []); var scrollTouchStart = T$4(function(event) { touchStartRef.current = getTouchXY(event); activeAxis.current = void 0; }, []); var scrollWheel = T$4(function(event) { shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current)); }, []); var scrollTouchMove = T$4(function(event) { shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current)); }, []); p$6(function() { lockStack.push(Style2); props.setCallbacks({ onScrollCapture: scrollWheel, onWheelCapture: scrollWheel, onTouchMoveCapture: scrollTouchMove }); document.addEventListener("wheel", shouldPrevent, nonPassive); document.addEventListener("touchmove", shouldPrevent, nonPassive); document.addEventListener("touchstart", scrollTouchStart, nonPassive); return function() { lockStack = lockStack.filter(function(inst) { return inst !== Style2; }); document.removeEventListener("wheel", shouldPrevent, nonPassive); document.removeEventListener("touchmove", shouldPrevent, nonPassive); document.removeEventListener("touchstart", scrollTouchStart, nonPassive); }; }, []); var removeScrollBar = props.removeScrollBar, inert = props.inert; return y$6( k$3, null, inert ? y$6(Style2, { styles: generateStyle(id) }) : null, removeScrollBar ? y$6(RemoveScrollBar, { gapMode: "margin" }) : null ); } const SideCar = exportSidecar(effectCar, RemoveScrollSideCar); var ReactRemoveScroll = k$1(function(props, ref) { return y$6(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar })); }); ReactRemoveScroll.classNames = RemoveScroll.classNames; const $67UHm$RemoveScroll = ReactRemoveScroll; var getDefaultParent = function(originalTarget) { if (typeof document === "undefined") { return null; } var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget; return sampleTarget.ownerDocument.body; }; var counterMap = /* @__PURE__ */ new WeakMap(); var uncontrolledNodes = /* @__PURE__ */ new WeakMap(); var markerMap = {}; var lockCount = 0; var unwrapHost = function(node2) { return node2 && (node2.host || unwrapHost(node2.parentNode)); }; var correctTargets = function(parent, targets) { return targets.map(function(target) { if (parent.contains(target)) { return target; } var correctedTarget = unwrapHost(target); if (correctedTarget && parent.contains(correctedTarget)) { return correctedTarget; } console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing"); return null; }).filter(function(x2) { return Boolean(x2); }); }; var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) { var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]); if (!markerMap[markerName]) { markerMap[markerName] = /* @__PURE__ */ new WeakMap(); } var markerCounter = markerMap[markerName]; var hiddenNodes = []; var elementsToKeep = /* @__PURE__ */ new Set(); var elementsToStop = new Set(targets); var keep = function(el) { if (!el || elementsToKeep.has(el)) { return; } elementsToKeep.add(el); keep(el.parentNode); }; targets.forEach(keep); var deep = function(parent) { if (!parent || elementsToStop.has(parent)) { return; } Array.prototype.forEach.call(parent.children, function(node2) { if (elementsToKeep.has(node2)) { deep(node2); } else { var attr = node2.getAttribute(controlAttribute); var alreadyHidden = attr !== null && attr !== "false"; var counterValue = (counterMap.get(node2) || 0) + 1; var markerValue = (markerCounter.get(node2) || 0) + 1; counterMap.set(node2, counterValue); markerCounter.set(node2, markerValue); hiddenNodes.push(node2); if (counterValue === 1 && alreadyHidden) { uncontrolledNodes.set(node2, true); } if (markerValue === 1) { node2.setAttribute(markerName, "true"); } if (!alreadyHidden) { node2.setAttribute(controlAttribute, "true"); } } }); }; deep(parentNode); elementsToKeep.clear(); lockCount++; return function() { hiddenNodes.forEach(function(node2) { var counterValue = counterMap.get(node2) - 1; var markerValue = markerCounter.get(node2) - 1; counterMap.set(node2, counterValue); markerCounter.set(node2, markerValue); if (!counterValue) { if (!uncontrolledNodes.has(node2)) { node2.removeAttribute(controlAttribute); } uncontrolledNodes.delete(node2); } if (!markerValue) { node2.removeAttribute(markerName); } }); lockCount--; if (!lockCount) { counterMap = /* @__PURE__ */ new WeakMap(); counterMap = /* @__PURE__ */ new WeakMap(); uncontrolledNodes = /* @__PURE__ */ new WeakMap(); markerMap = {}; } }; }; var hideOthers = function(originalTarget, parentNode, markerName) { if (markerName === void 0) { markerName = "data-aria-hidden"; } var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]); var activeParentNode = parentNode || getDefaultParent(originalTarget); if (!activeParentNode) { return function() { return null; }; } targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live]"))); return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden"); }; const $5d3850c4d0b4e6c7$var$DIALOG_NAME = "Dialog"; const [$5d3850c4d0b4e6c7$var$createDialogContext, $5d3850c4d0b4e6c7$export$cc702773b8ea3e41] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($5d3850c4d0b4e6c7$var$DIALOG_NAME); const [$5d3850c4d0b4e6c7$var$DialogProvider, $5d3850c4d0b4e6c7$var$useDialogContext] = $5d3850c4d0b4e6c7$var$createDialogContext($5d3850c4d0b4e6c7$var$DIALOG_NAME); const $5d3850c4d0b4e6c7$export$3ddf2d174ce01153 = (props) => { const { __scopeDialog, children, open: openProp, defaultOpen, onOpenChange, modal = true } = props; const triggerRef = _$1(null); const contentRef = _$1(null); const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: openProp, defaultProp: defaultOpen, onChange: onOpenChange }); return /* @__PURE__ */ y$6($5d3850c4d0b4e6c7$var$DialogProvider, { scope: __scopeDialog, triggerRef, contentRef, contentId: $1746a345f3d73bb7$export$f680877a34711e37(), titleId: $1746a345f3d73bb7$export$f680877a34711e37(), descriptionId: $1746a345f3d73bb7$export$f680877a34711e37(), open, onOpenChange: setOpen, onOpenToggle: T$4( () => setOpen( (prevOpen) => !prevOpen ), [ setOpen ] ), modal }, children); }; const $5d3850c4d0b4e6c7$var$TRIGGER_NAME = "DialogTrigger"; const $5d3850c4d0b4e6c7$export$2e1e1122cf0cba88 = /* @__PURE__ */ k$1((props, forwardedRef) => { const { __scopeDialog, ...triggerProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$TRIGGER_NAME, __scopeDialog); const composedTriggerRef = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.triggerRef); return /* @__PURE__ */ y$6($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({ type: "button", "aria-haspopup": "dialog", "aria-expanded": context.open, "aria-controls": context.contentId, "data-state": $5d3850c4d0b4e6c7$var$getState(context.open) }, triggerProps, { ref: composedTriggerRef, onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, context.onOpenToggle) })); }); const $5d3850c4d0b4e6c7$var$PORTAL_NAME = "DialogPortal"; const [$5d3850c4d0b4e6c7$var$PortalProvider, $5d3850c4d0b4e6c7$var$usePortalContext] = $5d3850c4d0b4e6c7$var$createDialogContext($5d3850c4d0b4e6c7$var$PORTAL_NAME, { forceMount: void 0 }); const $5d3850c4d0b4e6c7$export$dad7c95542bacce0 = (props) => { const { __scopeDialog, forceMount, children, container } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$PORTAL_NAME, __scopeDialog); return /* @__PURE__ */ y$6($5d3850c4d0b4e6c7$var$PortalProvider, { scope: __scopeDialog, forceMount }, O$1.map( children, (child) => /* @__PURE__ */ y$6($921a889cee6df7e8$export$99c2b779aa4e8b8b, { present: forceMount || context.open }, /* @__PURE__ */ y$6($f1701beae083dbae$export$602eac185826482c, { asChild: true, container }, child)) )); }; const $5d3850c4d0b4e6c7$var$OVERLAY_NAME = "DialogOverlay"; const $5d3850c4d0b4e6c7$export$bd1d06c79be19e17 = /* @__PURE__ */ k$1((props, forwardedRef) => { const portalContext = $5d3850c4d0b4e6c7$var$usePortalContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, props.__scopeDialog); const { forceMount = portalContext.forceMount, ...overlayProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, props.__scopeDialog); return context.modal ? /* @__PURE__ */ y$6($921a889cee6df7e8$export$99c2b779aa4e8b8b, { present: forceMount || context.open }, /* @__PURE__ */ y$6($5d3850c4d0b4e6c7$var$DialogOverlayImpl, _extends({}, overlayProps, { ref: forwardedRef }))) : null; }); const $5d3850c4d0b4e6c7$var$DialogOverlayImpl = /* @__PURE__ */ k$1((props, forwardedRef) => { const { __scopeDialog, ...overlayProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, __scopeDialog); return ( // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll` // ie. when `Overlay` and `Content` are siblings /* @__PURE__ */ y$6($67UHm$RemoveScroll, { as: $5e63c961fc1ce211$export$8c6ed5c666ac1360, allowPinchZoom: true, shards: [ context.contentRef ] }, /* @__PURE__ */ y$6($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({ "data-state": $5d3850c4d0b4e6c7$var$getState(context.open) }, overlayProps, { ref: forwardedRef, style: { pointerEvents: "auto", ...overlayProps.style } }))) ); }); const $5d3850c4d0b4e6c7$var$CONTENT_NAME = "DialogContent"; const $5d3850c4d0b4e6c7$export$b6d9565de1e068cf = /* @__PURE__ */ k$1((props, forwardedRef) => { const portalContext = $5d3850c4d0b4e6c7$var$usePortalContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog); const { forceMount = portalContext.forceMount, ...contentProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog); return /* @__PURE__ */ y$6($921a889cee6df7e8$export$99c2b779aa4e8b8b, { present: forceMount || context.open }, context.modal ? /* @__PURE__ */ y$6($5d3850c4d0b4e6c7$var$DialogContentModal, _extends({}, contentProps, { ref: forwardedRef })) : /* @__PURE__ */ y$6($5d3850c4d0b4e6c7$var$DialogContentNonModal, _extends({}, contentProps, { ref: forwardedRef }))); }); const $5d3850c4d0b4e6c7$var$DialogContentModal = /* @__PURE__ */ k$1((props, forwardedRef) => { const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog); const contentRef = _$1(null); const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.contentRef, contentRef); p$6(() => { const content2 = contentRef.current; if (content2) return hideOthers(content2); }, []); return /* @__PURE__ */ y$6($5d3850c4d0b4e6c7$var$DialogContentImpl, _extends({}, props, { ref: composedRefs, trapFocus: context.open, disableOutsidePointerEvents: true, onCloseAutoFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onCloseAutoFocus, (event) => { var _context$triggerRef$c; event.preventDefault(); (_context$triggerRef$c = context.triggerRef.current) === null || _context$triggerRef$c === void 0 || _context$triggerRef$c.focus(); }), onPointerDownOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownOutside, (event) => { const originalEvent = event.detail.originalEvent; const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true; const isRightClick = originalEvent.button === 2 || ctrlLeftClick; if (isRightClick) event.preventDefault(); }), onFocusOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10( props.onFocusOutside, (event) => event.preventDefault() ) })); }); const $5d3850c4d0b4e6c7$var$DialogContentNonModal = /* @__PURE__ */ k$1((props, forwardedRef) => { const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog); const hasInteractedOutsideRef = _$1(false); return /* @__PURE__ */ y$6($5d3850c4d0b4e6c7$var$DialogContentImpl, _extends({}, props, { ref: forwardedRef, trapFocus: false, disableOutsidePointerEvents: false, onCloseAutoFocus: (event) => { var _props$onCloseAutoFoc; (_props$onCloseAutoFoc = props.onCloseAutoFocus) === null || _props$onCloseAutoFoc === void 0 || _props$onCloseAutoFoc.call(props, event); if (!event.defaultPrevented) { var _context$triggerRef$c2; if (!hasInteractedOutsideRef.current) (_context$triggerRef$c2 = context.triggerRef.current) === null || _context$triggerRef$c2 === void 0 || _context$triggerRef$c2.focus(); event.preventDefault(); } hasInteractedOutsideRef.current = false; }, onInteractOutside: (event) => { var _props$onInteractOuts, _context$triggerRef$c3; (_props$onInteractOuts = props.onInteractOutside) === null || _props$onInteractOuts === void 0 || _props$onInteractOuts.call(props, event); if (!event.defaultPrevented) hasInteractedOutsideRef.current = true; const target = event.target; const targetIsTrigger = (_context$triggerRef$c3 = context.triggerRef.current) === null || _context$triggerRef$c3 === void 0 ? void 0 : _context$triggerRef$c3.contains(target); if (targetIsTrigger) event.preventDefault(); } })); }); const $5d3850c4d0b4e6c7$var$DialogContentImpl = /* @__PURE__ */ k$1((props, forwardedRef) => { const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, __scopeDialog); const contentRef = _$1(null); const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentRef); $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c(); return /* @__PURE__ */ y$6(k$3, null, /* @__PURE__ */ y$6($d3863c46a17e8a28$export$20e40289641fbbb6, { asChild: true, loop: true, trapped: trapFocus, onMountAutoFocus: onOpenAutoFocus, onUnmountAutoFocus: onCloseAutoFocus }, /* @__PURE__ */ y$6($5cb92bef7577960e$export$177fb62ff3ec1f22, _extends({ role: "dialog", id: context.contentId, "aria-describedby": context.descriptionId, "aria-labelledby": context.titleId, "data-state": $5d3850c4d0b4e6c7$var$getState(context.open) }, contentProps, { ref: composedRefs, onDismiss: () => context.onOpenChange(false) }))), false); }); const $5d3850c4d0b4e6c7$var$TITLE_NAME = "DialogTitle"; const $5d3850c4d0b4e6c7$export$16f7638e4a34b909 = /* @__PURE__ */ k$1((props, forwardedRef) => { const { __scopeDialog, ...titleProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$TITLE_NAME, __scopeDialog); return /* @__PURE__ */ y$6($8927f6f2acc4f386$export$250ffa63cdc0d034.h2, _extends({ id: context.titleId }, titleProps, { ref: forwardedRef })); }); const $5d3850c4d0b4e6c7$var$CLOSE_NAME = "DialogClose"; const $5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac = /* @__PURE__ */ k$1((props, forwardedRef) => { const { __scopeDialog, ...closeProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CLOSE_NAME, __scopeDialog); return /* @__PURE__ */ y$6($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({ type: "button" }, closeProps, { ref: forwardedRef, onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10( props.onClick, () => context.onOpenChange(false) ) })); }); function $5d3850c4d0b4e6c7$var$getState(open) { return open ? "open" : "closed"; } const $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9 = $5d3850c4d0b4e6c7$export$3ddf2d174ce01153; const $5d3850c4d0b4e6c7$export$41fb9f06171c75f4 = $5d3850c4d0b4e6c7$export$2e1e1122cf0cba88; const $5d3850c4d0b4e6c7$export$602eac185826482c = $5d3850c4d0b4e6c7$export$dad7c95542bacce0; const $5d3850c4d0b4e6c7$export$c6fdb837b070b4ff = $5d3850c4d0b4e6c7$export$bd1d06c79be19e17; const $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2 = $5d3850c4d0b4e6c7$export$b6d9565de1e068cf; const $5d3850c4d0b4e6c7$export$f99233281efd08a0 = $5d3850c4d0b4e6c7$export$16f7638e4a34b909; const $5d3850c4d0b4e6c7$export$f39c2d165cd861fe = $5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac; function t$1(t2) { return t2.split("-")[0]; } function e$1(t2) { return t2.split("-")[1]; } function n$1(e2) { return ["top", "bottom"].includes(t$1(e2)) ? "x" : "y"; } function r$3(t2) { return "y" === t2 ? "height" : "width"; } function i$4(i2, o3, a2) { let { reference: l2, floating: s2 } = i2; const c2 = l2.x + l2.width / 2 - s2.width / 2, f2 = l2.y + l2.height / 2 - s2.height / 2, u2 = n$1(o3), m2 = r$3(u2), g2 = l2[m2] / 2 - s2[m2] / 2, d2 = "x" === u2; let p2; switch (t$1(o3)) { case "top": p2 = { x: c2, y: l2.y - s2.height }; break; case "bottom": p2 = { x: c2, y: l2.y + l2.height }; break; case "right": p2 = { x: l2.x + l2.width, y: f2 }; break; case "left": p2 = { x: l2.x - s2.width, y: f2 }; break; default: p2 = { x: l2.x, y: l2.y }; } switch (e$1(o3)) { case "start": p2[u2] -= g2 * (a2 && d2 ? -1 : 1); break; case "end": p2[u2] += g2 * (a2 && d2 ? -1 : 1); } return p2; } const o$7 = async (t2, e2, n2) => { const { placement: r2 = "bottom", strategy: o3 = "absolute", middleware: a2 = [], platform: l2 } = n2, s2 = await (null == l2.isRTL ? void 0 : l2.isRTL(e2)); let c2 = await l2.getElementRects({ reference: t2, floating: e2, strategy: o3 }), { x: f2, y: u2 } = i$4(c2, r2, s2), m2 = r2, g2 = {}, d2 = 0; for (let n3 = 0; n3 < a2.length; n3++) { const { name: p2, fn: h2 } = a2[n3], { x: y2, y: x2, data: w2, reset: v2 } = await h2({ x: f2, y: u2, initialPlacement: r2, placement: m2, strategy: o3, middlewareData: g2, rects: c2, platform: l2, elements: { reference: t2, floating: e2 } }); f2 = null != y2 ? y2 : f2, u2 = null != x2 ? x2 : u2, g2 = { ...g2, [p2]: { ...g2[p2], ...w2 } }, v2 && d2 <= 50 && (d2++, "object" == typeof v2 && (v2.placement && (m2 = v2.placement), v2.rects && (c2 = true === v2.rects ? await l2.getElementRects({ reference: t2, floating: e2, strategy: o3 }) : v2.rects), { x: f2, y: u2 } = i$4(c2, m2, s2)), n3 = -1); } return { x: f2, y: u2, placement: m2, strategy: o3, middlewareData: g2 }; }; function a$2(t2) { return "number" != typeof t2 ? function(t3) { return { top: 0, right: 0, bottom: 0, left: 0, ...t3 }; }(t2) : { top: t2, right: t2, bottom: t2, left: t2 }; } function l$3(t2) { return { ...t2, top: t2.y, left: t2.x, right: t2.x + t2.width, bottom: t2.y + t2.height }; } async function s$5(t2, e2) { var n2; void 0 === e2 && (e2 = {}); const { x: r2, y: i2, platform: o3, rects: s2, elements: c2, strategy: f2 } = t2, { boundary: u2 = "clippingAncestors", rootBoundary: m2 = "viewport", elementContext: g2 = "floating", altBoundary: d2 = false, padding: p2 = 0 } = e2, h2 = a$2(p2), y2 = c2[d2 ? "floating" === g2 ? "reference" : "floating" : g2], x2 = l$3(await o3.getClippingRect({ element: null == (n2 = await (null == o3.isElement ? void 0 : o3.isElement(y2))) || n2 ? y2 : y2.contextElement || await (null == o3.getDocumentElement ? void 0 : o3.getDocumentElement(c2.floating)), boundary: u2, rootBoundary: m2, strategy: f2 })), w2 = l$3(o3.convertOffsetParentRelativeRectToViewportRelativeRect ? await o3.convertOffsetParentRelativeRectToViewportRelativeRect({ rect: "floating" === g2 ? { ...s2.floating, x: r2, y: i2 } : s2.reference, offsetParent: await (null == o3.getOffsetParent ? void 0 : o3.getOffsetParent(c2.floating)), strategy: f2 }) : s2[g2]); return { top: x2.top - w2.top + h2.top, bottom: w2.bottom - x2.bottom + h2.bottom, left: x2.left - w2.left + h2.left, right: w2.right - x2.right + h2.right }; } const c$3 = Math.min, f$2 = Math.max; function u$4(t2, e2, n2) { return f$2(t2, c$3(e2, n2)); } const m$1 = (t2) => ({ name: "arrow", options: t2, async fn(i2) { const { element: o3, padding: l2 = 0 } = null != t2 ? t2 : {}, { x: s2, y: c2, placement: f2, rects: m2, platform: g2 } = i2; if (null == o3) return {}; const d2 = a$2(l2), p2 = { x: s2, y: c2 }, h2 = n$1(f2), y2 = e$1(f2), x2 = r$3(h2), w2 = await g2.getDimensions(o3), v2 = "y" === h2 ? "top" : "left", b2 = "y" === h2 ? "bottom" : "right", R2 = m2.reference[x2] + m2.reference[h2] - p2[h2] - m2.floating[x2], A2 = p2[h2] - m2.reference[h2], P2 = await (null == g2.getOffsetParent ? void 0 : g2.getOffsetParent(o3)); let T2 = P2 ? "y" === h2 ? P2.clientHeight || 0 : P2.clientWidth || 0 : 0; 0 === T2 && (T2 = m2.floating[x2]); const O2 = R2 / 2 - A2 / 2, D2 = d2[v2], L2 = T2 - w2[x2] - d2[b2], k2 = T2 / 2 - w2[x2] / 2 + O2, E2 = u$4(D2, k2, L2), C2 = ("start" === y2 ? d2[v2] : d2[b2]) > 0 && k2 !== E2 && m2.reference[x2] <= m2.floating[x2]; return { [h2]: p2[h2] - (C2 ? k2 < D2 ? D2 - k2 : L2 - k2 : 0), data: { [h2]: E2, centerOffset: k2 - E2 } }; } }), g$2 = { left: "right", right: "left", bottom: "top", top: "bottom" }; function d$4(t2) { return t2.replace(/left|right|bottom|top/g, (t3) => g$2[t3]); } function p$5(t2, i2, o3) { void 0 === o3 && (o3 = false); const a2 = e$1(t2), l2 = n$1(t2), s2 = r$3(l2); let c2 = "x" === l2 ? a2 === (o3 ? "end" : "start") ? "right" : "left" : "start" === a2 ? "bottom" : "top"; return i2.reference[s2] > i2.floating[s2] && (c2 = d$4(c2)), { main: c2, cross: d$4(c2) }; } const h$3 = { start: "end", end: "start" }; function y$4(t2) { return t2.replace(/start|end/g, (t3) => h$3[t3]); } const x$1 = ["top", "right", "bottom", "left"]; x$1.reduce((t2, e2) => t2.concat(e2, e2 + "-start", e2 + "-end"), []); const b$2 = function(e2) { return void 0 === e2 && (e2 = {}), { name: "flip", options: e2, async fn(n2) { var r2; const { placement: i2, middlewareData: o3, rects: a2, initialPlacement: l2, platform: c2, elements: f2 } = n2, { mainAxis: u2 = true, crossAxis: m2 = true, fallbackPlacements: g2, fallbackStrategy: h2 = "bestFit", flipAlignment: x2 = true, ...w2 } = e2, v2 = t$1(i2), b2 = g2 || (v2 === l2 || !x2 ? [d$4(l2)] : function(t2) { const e3 = d$4(t2); return [y$4(t2), e3, y$4(e3)]; }(l2)), R2 = [l2, ...b2], A2 = await s$5(n2, w2), P2 = []; let T2 = (null == (r2 = o3.flip) ? void 0 : r2.overflows) || []; if (u2 && P2.push(A2[v2]), m2) { const { main: t2, cross: e3 } = p$5(i2, a2, await (null == c2.isRTL ? void 0 : c2.isRTL(f2.floating))); P2.push(A2[t2], A2[e3]); } if (T2 = [...T2, { placement: i2, overflows: P2 }], !P2.every((t2) => t2 <= 0)) { var O2, D2; const t2 = (null != (O2 = null == (D2 = o3.flip) ? void 0 : D2.index) ? O2 : 0) + 1, e3 = R2[t2]; if (e3) return { data: { index: t2, overflows: T2 }, reset: { placement: e3 } }; let n3 = "bottom"; switch (h2) { case "bestFit": { var L2; const t3 = null == (L2 = T2.map((t4) => [t4, t4.overflows.filter((t5) => t5 > 0).reduce((t5, e4) => t5 + e4, 0)]).sort((t4, e4) => t4[1] - e4[1])[0]) ? void 0 : L2[0].placement; t3 && (n3 = t3); break; } case "initialPlacement": n3 = l2; } if (i2 !== n3) return { reset: { placement: n3 } }; } return {}; } }; }; function R$2(t2, e2) { return { top: t2.top - e2.height, right: t2.right - e2.width, bottom: t2.bottom - e2.height, left: t2.left - e2.width }; } function A$1(t2) { return x$1.some((e2) => t2[e2] >= 0); } const P = function(t2) { let { strategy: e2 = "referenceHidden", ...n2 } = void 0 === t2 ? {} : t2; return { name: "hide", async fn(t3) { const { rects: r2 } = t3; switch (e2) { case "referenceHidden": { const e3 = R$2(await s$5(t3, { ...n2, elementContext: "reference" }), r2.reference); return { data: { referenceHiddenOffsets: e3, referenceHidden: A$1(e3) } }; } case "escaped": { const e3 = R$2(await s$5(t3, { ...n2, altBoundary: true }), r2.floating); return { data: { escapedOffsets: e3, escaped: A$1(e3) } }; } default: return {}; } } }; }; const T$2 = function(r2) { return void 0 === r2 && (r2 = 0), { name: "offset", options: r2, async fn(i2) { const { x: o3, y: a2 } = i2, l2 = await async function(r3, i3) { const { placement: o4, platform: a3, elements: l3 } = r3, s2 = await (null == a3.isRTL ? void 0 : a3.isRTL(l3.floating)), c2 = t$1(o4), f2 = e$1(o4), u2 = "x" === n$1(o4), m2 = ["left", "top"].includes(c2) ? -1 : 1, g2 = s2 && u2 ? -1 : 1, d2 = "function" == typeof i3 ? i3(r3) : i3; let { mainAxis: p2, crossAxis: h2, alignmentAxis: y2 } = "number" == typeof d2 ? { mainAxis: d2, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...d2 }; return f2 && "number" == typeof y2 && (h2 = "end" === f2 ? -1 * y2 : y2), u2 ? { x: h2 * g2, y: p2 * m2 } : { x: p2 * m2, y: h2 * g2 }; }(i2, r2); return { x: o3 + l2.x, y: a2 + l2.y, data: l2 }; } }; }; function O(t2) { return "x" === t2 ? "y" : "x"; } const D$2 = function(e2) { return void 0 === e2 && (e2 = {}), { name: "shift", options: e2, async fn(r2) { const { x: i2, y: o3, placement: a2 } = r2, { mainAxis: l2 = true, crossAxis: c2 = false, limiter: f2 = { fn: (t2) => { let { x: e3, y: n2 } = t2; return { x: e3, y: n2 }; } }, ...m2 } = e2, g2 = { x: i2, y: o3 }, d2 = await s$5(r2, m2), p2 = n$1(t$1(a2)), h2 = O(p2); let y2 = g2[p2], x2 = g2[h2]; if (l2) { const t2 = "y" === p2 ? "bottom" : "right"; y2 = u$4(y2 + d2["y" === p2 ? "top" : "left"], y2, y2 - d2[t2]); } if (c2) { const t2 = "y" === h2 ? "bottom" : "right"; x2 = u$4(x2 + d2["y" === h2 ? "top" : "left"], x2, x2 - d2[t2]); } const w2 = f2.fn({ ...r2, [p2]: y2, [h2]: x2 }); return { ...w2, data: { x: w2.x - i2, y: w2.y - o3 } }; } }; }, L$1 = function(e2) { return void 0 === e2 && (e2 = {}), { options: e2, fn(r2) { const { x: i2, y: o3, placement: a2, rects: l2, middlewareData: s2 } = r2, { offset: c2 = 0, mainAxis: f2 = true, crossAxis: u2 = true } = e2, m2 = { x: i2, y: o3 }, g2 = n$1(a2), d2 = O(g2); let p2 = m2[g2], h2 = m2[d2]; const y2 = "function" == typeof c2 ? c2({ ...l2, placement: a2 }) : c2, x2 = "number" == typeof y2 ? { mainAxis: y2, crossAxis: 0 } : { mainAxis: 0, crossAxis: 0, ...y2 }; if (f2) { const t2 = "y" === g2 ? "height" : "width", e3 = l2.reference[g2] - l2.floating[t2] + x2.mainAxis, n2 = l2.reference[g2] + l2.reference[t2] - x2.mainAxis; p2 < e3 ? p2 = e3 : p2 > n2 && (p2 = n2); } if (u2) { var w2, v2, b2, R2; const e3 = "y" === g2 ? "width" : "height", n2 = ["top", "left"].includes(t$1(a2)), r3 = l2.reference[d2] - l2.floating[e3] + (n2 && null != (w2 = null == (v2 = s2.offset) ? void 0 : v2[d2]) ? w2 : 0) + (n2 ? 0 : x2.crossAxis), i3 = l2.reference[d2] + l2.reference[e3] + (n2 ? 0 : null != (b2 = null == (R2 = s2.offset) ? void 0 : R2[d2]) ? b2 : 0) - (n2 ? x2.crossAxis : 0); h2 < r3 ? h2 = r3 : h2 > i3 && (h2 = i3); } return { [g2]: p2, [d2]: h2 }; } }; }, k = function(n2) { return void 0 === n2 && (n2 = {}), { name: "size", options: n2, async fn(r2) { const { placement: i2, rects: o3, platform: a2, elements: l2 } = r2, { apply: c2, ...u2 } = n2, m2 = await s$5(r2, u2), g2 = t$1(i2), d2 = e$1(i2); let p2, h2; "top" === g2 || "bottom" === g2 ? (p2 = g2, h2 = d2 === (await (null == a2.isRTL ? void 0 : a2.isRTL(l2.floating)) ? "start" : "end") ? "left" : "right") : (h2 = g2, p2 = "end" === d2 ? "top" : "bottom"); const y2 = f$2(m2.left, 0), x2 = f$2(m2.right, 0), w2 = f$2(m2.top, 0), v2 = f$2(m2.bottom, 0), b2 = { availableHeight: o3.floating.height - (["left", "right"].includes(i2) ? 2 * (0 !== w2 || 0 !== v2 ? w2 + v2 : f$2(m2.top, m2.bottom)) : m2[p2]), availableWidth: o3.floating.width - (["top", "bottom"].includes(i2) ? 2 * (0 !== y2 || 0 !== x2 ? y2 + x2 : f$2(m2.left, m2.right)) : m2[h2]) }, R2 = await a2.getDimensions(l2.floating); null == c2 || c2({ ...r2, ...b2 }); const A2 = await a2.getDimensions(l2.floating); return R2.width !== A2.width || R2.height !== A2.height ? { reset: { rects: true } } : {}; } }; }; function n(t2) { return t2 && t2.document && t2.location && t2.alert && t2.setInterval; } function o$6(t2) { if (null == t2) return window; if (!n(t2)) { const e2 = t2.ownerDocument; return e2 && e2.defaultView || window; } return t2; } function i$3(t2) { return o$6(t2).getComputedStyle(t2); } function r$2(t2) { return n(t2) ? "" : t2 ? (t2.nodeName || "").toLowerCase() : ""; } function l$2() { const t2 = navigator.userAgentData; return null != t2 && t2.brands ? t2.brands.map((t3) => t3.brand + "/" + t3.version).join(" ") : navigator.userAgent; } function c$2(t2) { return t2 instanceof o$6(t2).HTMLElement; } function f$1(t2) { return t2 instanceof o$6(t2).Element; } function s$4(t2) { if ("undefined" == typeof ShadowRoot) return false; return t2 instanceof o$6(t2).ShadowRoot || t2 instanceof ShadowRoot; } function u$3(t2) { const { overflow: e2, overflowX: n2, overflowY: o3 } = i$3(t2); return /auto|scroll|overlay|hidden/.test(e2 + o3 + n2); } function d$3(t2) { return ["table", "td", "th"].includes(r$2(t2)); } function h$2(t2) { const e2 = /firefox/i.test(l$2()), n2 = i$3(t2); return "none" !== n2.transform || "none" !== n2.perspective || "paint" === n2.contain || ["transform", "perspective"].includes(n2.willChange) || e2 && "filter" === n2.willChange || e2 && !!n2.filter && "none" !== n2.filter; } function a$1() { return !/^((?!chrome|android).)*safari/i.test(l$2()); } const g$1 = Math.min, p$4 = Math.max, m = Math.round; function w$1(t2, e2, n2) { var i2, r2, l2, s2; void 0 === e2 && (e2 = false), void 0 === n2 && (n2 = false); const u2 = t2.getBoundingClientRect(); let d2 = 1, h2 = 1; e2 && c$2(t2) && (d2 = t2.offsetWidth > 0 && m(u2.width) / t2.offsetWidth || 1, h2 = t2.offsetHeight > 0 && m(u2.height) / t2.offsetHeight || 1); const g2 = f$1(t2) ? o$6(t2) : window, p2 = !a$1() && n2, w2 = (u2.left + (p2 && null != (i2 = null == (r2 = g2.visualViewport) ? void 0 : r2.offsetLeft) ? i2 : 0)) / d2, v2 = (u2.top + (p2 && null != (l2 = null == (s2 = g2.visualViewport) ? void 0 : s2.offsetTop) ? l2 : 0)) / h2, y2 = u2.width / d2, x2 = u2.height / h2; return { width: y2, height: x2, top: v2, right: w2 + y2, bottom: v2 + x2, left: w2, x: w2, y: v2 }; } function v$1(t2) { return (e2 = t2, (e2 instanceof o$6(e2).Node ? t2.ownerDocument : t2.document) || window.document).documentElement; var e2; } function y$3(t2) { return f$1(t2) ? { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop } : { scrollLeft: t2.pageXOffset, scrollTop: t2.pageYOffset }; } function x(t2) { return w$1(v$1(t2)).left + y$3(t2).scrollLeft; } function b$1(t2, e2, n2) { const o3 = c$2(e2), i2 = v$1(e2), l2 = w$1(t2, o3 && function(t3) { const e3 = w$1(t3); return m(e3.width) !== t3.offsetWidth || m(e3.height) !== t3.offsetHeight; }(e2), "fixed" === n2); let f2 = { scrollLeft: 0, scrollTop: 0 }; const s2 = { x: 0, y: 0 }; if (o3 || !o3 && "fixed" !== n2) if (("body" !== r$2(e2) || u$3(i2)) && (f2 = y$3(e2)), c$2(e2)) { const t3 = w$1(e2, true); s2.x = t3.x + e2.clientLeft, s2.y = t3.y + e2.clientTop; } else i2 && (s2.x = x(i2)); return { x: l2.left + f2.scrollLeft - s2.x, y: l2.top + f2.scrollTop - s2.y, width: l2.width, height: l2.height }; } function L(t2) { return "html" === r$2(t2) ? t2 : t2.assignedSlot || t2.parentNode || (s$4(t2) ? t2.host : null) || v$1(t2); } function R$1(t2) { return c$2(t2) && "fixed" !== getComputedStyle(t2).position ? t2.offsetParent : null; } function T$1(t2) { const e2 = o$6(t2); let n2 = R$1(t2); for (; n2 && d$3(n2) && "static" === getComputedStyle(n2).position; ) n2 = R$1(n2); return n2 && ("html" === r$2(n2) || "body" === r$2(n2) && "static" === getComputedStyle(n2).position && !h$2(n2)) ? e2 : n2 || function(t3) { let e3 = L(t3); for (s$4(e3) && (e3 = e3.host); c$2(e3) && !["html", "body"].includes(r$2(e3)); ) { if (h$2(e3)) return e3; e3 = e3.parentNode; } return null; }(t2) || e2; } function W(t2) { if (c$2(t2)) return { width: t2.offsetWidth, height: t2.offsetHeight }; const e2 = w$1(t2); return { width: e2.width, height: e2.height }; } function E(t2) { const e2 = L(t2); return ["html", "body", "#document"].includes(r$2(e2)) ? t2.ownerDocument.body : c$2(e2) && u$3(e2) ? e2 : E(e2); } function H$1(t2, e2) { var n2; void 0 === e2 && (e2 = []); const i2 = E(t2), r2 = i2 === (null == (n2 = t2.ownerDocument) ? void 0 : n2.body), l2 = o$6(i2), c2 = r2 ? [l2].concat(l2.visualViewport || [], u$3(i2) ? i2 : []) : i2, f2 = e2.concat(c2); return r2 ? f2 : f2.concat(H$1(c2)); } function C(e2, n2, r2) { return "viewport" === n2 ? l$3(function(t2, e3) { const n3 = o$6(t2), i2 = v$1(t2), r3 = n3.visualViewport; let l2 = i2.clientWidth, c2 = i2.clientHeight, f2 = 0, s2 = 0; if (r3) { l2 = r3.width, c2 = r3.height; const t3 = a$1(); (t3 || !t3 && "fixed" === e3) && (f2 = r3.offsetLeft, s2 = r3.offsetTop); } return { width: l2, height: c2, x: f2, y: s2 }; }(e2, r2)) : f$1(n2) ? function(t2, e3) { const n3 = w$1(t2, false, "fixed" === e3), o3 = n3.top + t2.clientTop, i2 = n3.left + t2.clientLeft; return { top: o3, left: i2, x: i2, y: o3, right: i2 + t2.clientWidth, bottom: o3 + t2.clientHeight, width: t2.clientWidth, height: t2.clientHeight }; }(n2, r2) : l$3(function(t2) { var e3; const n3 = v$1(t2), o3 = y$3(t2), r3 = null == (e3 = t2.ownerDocument) ? void 0 : e3.body, l2 = p$4(n3.scrollWidth, n3.clientWidth, r3 ? r3.scrollWidth : 0, r3 ? r3.clientWidth : 0), c2 = p$4(n3.scrollHeight, n3.clientHeight, r3 ? r3.scrollHeight : 0, r3 ? r3.clientHeight : 0); let f2 = -o3.scrollLeft + x(t2); const s2 = -o3.scrollTop; return "rtl" === i$3(r3 || n3).direction && (f2 += p$4(n3.clientWidth, r3 ? r3.clientWidth : 0) - l2), { width: l2, height: c2, x: f2, y: s2 }; }(v$1(e2))); } function S$2(t2) { const e2 = H$1(t2), n2 = ["absolute", "fixed"].includes(i$3(t2).position) && c$2(t2) ? T$1(t2) : t2; return f$1(n2) ? e2.filter((t3) => f$1(t3) && function(t4, e3) { const n3 = null == e3.getRootNode ? void 0 : e3.getRootNode(); if (t4.contains(e3)) return true; if (n3 && s$4(n3)) { let n4 = e3; do { if (n4 && t4 === n4) return true; n4 = n4.parentNode || n4.host; } while (n4); } return false; }(t3, n2) && "body" !== r$2(t3)) : []; } const D$1 = { getClippingRect: function(t2) { let { element: e2, boundary: n2, rootBoundary: o3, strategy: i2 } = t2; const r2 = [..."clippingAncestors" === n2 ? S$2(e2) : [].concat(n2), o3], l2 = r2[0], c2 = r2.reduce((t3, n3) => { const o4 = C(e2, n3, i2); return t3.top = p$4(o4.top, t3.top), t3.right = g$1(o4.right, t3.right), t3.bottom = g$1(o4.bottom, t3.bottom), t3.left = p$4(o4.left, t3.left), t3; }, C(e2, l2, i2)); return { width: c2.right - c2.left, height: c2.bottom - c2.top, x: c2.left, y: c2.top }; }, convertOffsetParentRelativeRectToViewportRelativeRect: function(t2) { let { rect: e2, offsetParent: n2, strategy: o3 } = t2; const i2 = c$2(n2), l2 = v$1(n2); if (n2 === l2) return e2; let f2 = { scrollLeft: 0, scrollTop: 0 }; const s2 = { x: 0, y: 0 }; if ((i2 || !i2 && "fixed" !== o3) && (("body" !== r$2(n2) || u$3(l2)) && (f2 = y$3(n2)), c$2(n2))) { const t3 = w$1(n2, true); s2.x = t3.x + n2.clientLeft, s2.y = t3.y + n2.clientTop; } return { ...e2, x: e2.x - f2.scrollLeft + s2.x, y: e2.y - f2.scrollTop + s2.y }; }, isElement: f$1, getDimensions: W, getOffsetParent: T$1, getDocumentElement: v$1, getElementRects: (t2) => { let { reference: e2, floating: n2, strategy: o3 } = t2; return { reference: b$1(e2, T$1(n2), o3), floating: { ...W(n2), x: 0, y: 0 } }; }, getClientRects: (t2) => Array.from(t2.getClientRects()), isRTL: (t2) => "rtl" === i$3(t2).direction }; function N$1(t2, e2, n2, o3) { void 0 === o3 && (o3 = {}); const { ancestorScroll: i2 = true, ancestorResize: r2 = true, elementResize: l2 = true, animationFrame: c2 = false } = o3, s2 = i2 && !c2, u2 = r2 && !c2, d2 = s2 || u2 ? [...f$1(t2) ? H$1(t2) : [], ...H$1(e2)] : []; d2.forEach((t3) => { s2 && t3.addEventListener("scroll", n2, { passive: true }), u2 && t3.addEventListener("resize", n2); }); let h2, a2 = null; if (l2) { let o4 = true; a2 = new ResizeObserver(() => { o4 || n2(), o4 = false; }), f$1(t2) && !c2 && a2.observe(t2), a2.observe(e2); } let g2 = c2 ? w$1(t2) : null; return c2 && function e3() { const o4 = w$1(t2); !g2 || o4.x === g2.x && o4.y === g2.y && o4.width === g2.width && o4.height === g2.height || n2(); g2 = o4, h2 = requestAnimationFrame(e3); }(), n2(), () => { var t3; d2.forEach((t4) => { s2 && t4.removeEventListener("scroll", n2), u2 && t4.removeEventListener("resize", n2); }), null == (t3 = a2) || t3.disconnect(), a2 = null, c2 && cancelAnimationFrame(h2); }; } const z = (t2, n2, o3) => o$7(t2, n2, { platform: D$1, ...o3 }); var index$1 = typeof document !== "undefined" ? y$5 : p$6; function deepEqual(a2, b2) { if (a2 === b2) { return true; } if (typeof a2 !== typeof b2) { return false; } if (typeof a2 === "function" && a2.toString() === b2.toString()) { return true; } let length, i2, keys; if (a2 && b2 && typeof a2 == "object") { if (Array.isArray(a2)) { length = a2.length; if (length != b2.length) return false; for (i2 = length; i2-- !== 0; ) { if (!deepEqual(a2[i2], b2[i2])) { return false; } } return true; } keys = Object.keys(a2); length = keys.length; if (length !== Object.keys(b2).length) { return false; } for (i2 = length; i2-- !== 0; ) { if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) { return false; } } for (i2 = length; i2-- !== 0; ) { const key2 = keys[i2]; if (key2 === "_owner" && a2.$$typeof) { continue; } if (!deepEqual(a2[key2], b2[key2])) { return false; } } return true; } return a2 !== a2 && b2 !== b2; } function useLatestRef(value) { const ref = _$1(value); index$1(() => { ref.current = value; }); return ref; } function useFloating(_temp) { let { middleware, placement = "bottom", strategy = "absolute", whileElementsMounted } = _temp === void 0 ? {} : _temp; const reference = _$1(null); const floating = _$1(null); const whileElementsMountedRef = useLatestRef(whileElementsMounted); const cleanupRef = _$1(null); const [data, setData] = h$4({ // Setting these to `null` will allow the consumer to determine if // `computePosition()` has run yet x: null, y: null, strategy, placement, middlewareData: {} }); const [latestMiddleware, setLatestMiddleware] = h$4(middleware); if (!deepEqual(latestMiddleware == null ? void 0 : latestMiddleware.map((_ref) => { let { options } = _ref; return options; }), middleware == null ? void 0 : middleware.map((_ref2) => { let { options } = _ref2; return options; }))) { setLatestMiddleware(middleware); } const update = T$4(() => { if (!reference.current || !floating.current) { return; } z(reference.current, floating.current, { middleware: latestMiddleware, placement, strategy }).then((data2) => { if (isMountedRef.current) { mn(() => { setData(data2); }); } }); }, [latestMiddleware, placement, strategy]); index$1(() => { if (isMountedRef.current) { update(); } }, [update]); const isMountedRef = _$1(false); index$1(() => { isMountedRef.current = true; return () => { isMountedRef.current = false; }; }, []); const runElementMountCallback = T$4(() => { if (typeof cleanupRef.current === "function") { cleanupRef.current(); cleanupRef.current = null; } if (reference.current && floating.current) { if (whileElementsMountedRef.current) { const cleanupFn = whileElementsMountedRef.current(reference.current, floating.current, update); cleanupRef.current = cleanupFn; } else { update(); } } }, [update, whileElementsMountedRef]); const setReference = T$4((node2) => { reference.current = node2; runElementMountCallback(); }, [runElementMountCallback]); const setFloating = T$4((node2) => { floating.current = node2; runElementMountCallback(); }, [runElementMountCallback]); const refs = F$1(() => ({ reference, floating }), []); return F$1(() => ({ ...data, update, refs, reference: setReference, floating: setFloating }), [data, update, refs, setReference, setFloating]); } const arrow = (options) => { const { element: element2, padding } = options; function isRef(value) { return Object.prototype.hasOwnProperty.call(value, "current"); } return { name: "arrow", options, fn(args) { if (isRef(element2)) { if (element2.current != null) { return m$1({ element: element2.current, padding }).fn(args); } return {}; } else if (element2) { return m$1({ element: element2, padding }).fn(args); } return {}; } }; }; const $7e8f5cd07187803e$export$21b07c8f274aebd5 = /* @__PURE__ */ k$1((props, forwardedRef) => { const { children, width = 10, height = 5, ...arrowProps } = props; return /* @__PURE__ */ y$6($8927f6f2acc4f386$export$250ffa63cdc0d034.svg, _extends({}, arrowProps, { ref: forwardedRef, width, height, viewBox: "0 0 30 10", preserveAspectRatio: "none" }), props.asChild ? children : /* @__PURE__ */ y$6("polygon", { points: "0,0 30,0 15,10" })); }); const $7e8f5cd07187803e$export$be92b6f5f03c0fe9 = $7e8f5cd07187803e$export$21b07c8f274aebd5; function $db6c3485150b8e66$export$1ab7ae714698c4b8(element2) { const [size, setSize] = h$4(void 0); $9f79659886946c16$export$e5c5a5f917a5871c(() => { if (element2) { setSize({ width: element2.offsetWidth, height: element2.offsetHeight }); const resizeObserver = new ResizeObserver((entries) => { if (!Array.isArray(entries)) return; if (!entries.length) return; const entry = entries[0]; let width; let height; if ("borderBoxSize" in entry) { const borderSizeEntry = entry["borderBoxSize"]; const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry; width = borderSize["inlineSize"]; height = borderSize["blockSize"]; } else { width = element2.offsetWidth; height = element2.offsetHeight; } setSize({ width, height }); }); resizeObserver.observe(element2, { box: "border-box" }); return () => resizeObserver.unobserve(element2); } else setSize(void 0); }, [ element2 ]); return size; } const $cf1ac5d9fe0e8206$var$POPPER_NAME = "Popper"; const [$cf1ac5d9fe0e8206$var$createPopperContext, $cf1ac5d9fe0e8206$export$722aac194ae923] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($cf1ac5d9fe0e8206$var$POPPER_NAME); const [$cf1ac5d9fe0e8206$var$PopperProvider, $cf1ac5d9fe0e8206$var$usePopperContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$POPPER_NAME); const $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9 = (props) => { const { __scopePopper, children } = props; const [anchor, setAnchor] = h$4(null); return /* @__PURE__ */ y$6($cf1ac5d9fe0e8206$var$PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor }, children); }; const $cf1ac5d9fe0e8206$var$ANCHOR_NAME = "PopperAnchor"; const $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d = /* @__PURE__ */ k$1((props, forwardedRef) => { const { __scopePopper, virtualRef, ...anchorProps } = props; const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$ANCHOR_NAME, __scopePopper); const ref = _$1(null); const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref); p$6(() => { context.onAnchorChange((virtualRef === null || virtualRef === void 0 ? void 0 : virtualRef.current) || ref.current); }); return virtualRef ? null : /* @__PURE__ */ y$6($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, anchorProps, { ref: composedRefs })); }); const $cf1ac5d9fe0e8206$var$CONTENT_NAME = "PopperContent"; const [$cf1ac5d9fe0e8206$var$PopperContentProvider, $cf1ac5d9fe0e8206$var$useContentContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME); const [$cf1ac5d9fe0e8206$var$PositionContextProvider, $cf1ac5d9fe0e8206$var$usePositionContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME, { hasParent: false, positionUpdateFns: /* @__PURE__ */ new Set() }); const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /* @__PURE__ */ k$1((props, forwardedRef) => { var _arrowSize$width, _arrowSize$height, _middlewareData$arrow, _middlewareData$arrow2, _middlewareData$arrow3, _middlewareData$hide, _middlewareData$trans, _middlewareData$trans2; const { __scopePopper, side = "bottom", sideOffset = 0, align = "center", alignOffset = 0, arrowPadding = 0, collisionBoundary = [], collisionPadding: collisionPaddingProp = 0, sticky = "partial", hideWhenDetached = false, avoidCollisions = true, onPlaced, ...contentProps } = props; const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME, __scopePopper); const [content2, setContent] = h$4(null); const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05( forwardedRef, (node2) => setContent(node2) ); const [arrow$1, setArrow] = h$4(null); const arrowSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(arrow$1); const arrowWidth = (_arrowSize$width = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.width) !== null && _arrowSize$width !== void 0 ? _arrowSize$width : 0; const arrowHeight = (_arrowSize$height = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.height) !== null && _arrowSize$height !== void 0 ? _arrowSize$height : 0; const desiredPlacement = side + (align !== "center" ? "-" + align : ""); const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp }; const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [ collisionBoundary ]; const hasExplicitBoundaries = boundary.length > 0; const detectOverflowOptions = { padding: collisionPadding, boundary: boundary.filter($cf1ac5d9fe0e8206$var$isNotNull), // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries altBoundary: hasExplicitBoundaries }; const { reference, floating, strategy, x: x2, y: y2, placement, middlewareData, update } = useFloating({ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues strategy: "fixed", placement: desiredPlacement, whileElementsMounted: N$1, middleware: [ $cf1ac5d9fe0e8206$var$anchorCssProperties(), T$2({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }), avoidCollisions ? D$2({ mainAxis: true, crossAxis: false, limiter: sticky === "partial" ? L$1() : void 0, ...detectOverflowOptions }) : void 0, arrow$1 ? arrow({ element: arrow$1, padding: arrowPadding }) : void 0, avoidCollisions ? b$2({ ...detectOverflowOptions }) : void 0, k({ ...detectOverflowOptions, apply: ({ elements, availableWidth: width, availableHeight: height }) => { elements.floating.style.setProperty("--radix-popper-available-width", `${width}px`); elements.floating.style.setProperty("--radix-popper-available-height", `${height}px`); } }), $cf1ac5d9fe0e8206$var$transformOrigin({ arrowWidth, arrowHeight }), hideWhenDetached ? P({ strategy: "referenceHidden" }) : void 0 ].filter($cf1ac5d9fe0e8206$var$isDefined) }); $9f79659886946c16$export$e5c5a5f917a5871c(() => { reference(context.anchor); }, [ reference, context.anchor ]); const isPlaced = x2 !== null && y2 !== null; const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement); const handlePlaced = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPlaced); $9f79659886946c16$export$e5c5a5f917a5871c(() => { if (isPlaced) handlePlaced === null || handlePlaced === void 0 || handlePlaced(); }, [ isPlaced, handlePlaced ]); const arrowX = (_middlewareData$arrow = middlewareData.arrow) === null || _middlewareData$arrow === void 0 ? void 0 : _middlewareData$arrow.x; const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) === null || _middlewareData$arrow2 === void 0 ? void 0 : _middlewareData$arrow2.y; const cannotCenterArrow = ((_middlewareData$arrow3 = middlewareData.arrow) === null || _middlewareData$arrow3 === void 0 ? void 0 : _middlewareData$arrow3.centerOffset) !== 0; const [contentZIndex, setContentZIndex] = h$4(); $9f79659886946c16$export$e5c5a5f917a5871c(() => { if (content2) setContentZIndex(window.getComputedStyle(content2).zIndex); }, [ content2 ]); const { hasParent, positionUpdateFns } = $cf1ac5d9fe0e8206$var$usePositionContext($cf1ac5d9fe0e8206$var$CONTENT_NAME, __scopePopper); const isRoot = !hasParent; y$5(() => { if (!isRoot) { positionUpdateFns.add(update); return () => { positionUpdateFns.delete(update); }; } }, [ isRoot, positionUpdateFns, update ]); $9f79659886946c16$export$e5c5a5f917a5871c(() => { if (isRoot && isPlaced) Array.from(positionUpdateFns).reverse().forEach( (fn2) => requestAnimationFrame(fn2) ); }, [ isRoot, isPlaced, positionUpdateFns ]); const commonProps = { "data-side": placedSide, "data-align": placedAlign, ...contentProps, ref: composedRefs, style: { ...contentProps.style, // if the PopperContent hasn't been placed yet (not all measurements done) // we prevent animations so that users's animation don't kick in too early referring wrong sides animation: !isPlaced ? "none" : void 0, // hide the content if using the hide middleware and should be hidden opacity: (_middlewareData$hide = middlewareData.hide) !== null && _middlewareData$hide !== void 0 && _middlewareData$hide.referenceHidden ? 0 : void 0 } }; return /* @__PURE__ */ y$6("div", { ref: floating, "data-radix-popper-content-wrapper": "", style: { position: strategy, left: 0, top: 0, transform: isPlaced ? `translate3d(${Math.round(x2)}px, ${Math.round(y2)}px, 0)` : "translate3d(0, -200%, 0)", // keep off the page when measuring minWidth: "max-content", zIndex: contentZIndex, ["--radix-popper-transform-origin"]: [ (_middlewareData$trans = middlewareData.transformOrigin) === null || _middlewareData$trans === void 0 ? void 0 : _middlewareData$trans.x, (_middlewareData$trans2 = middlewareData.transformOrigin) === null || _middlewareData$trans2 === void 0 ? void 0 : _middlewareData$trans2.y ].join(" ") }, dir: props.dir }, /* @__PURE__ */ y$6($cf1ac5d9fe0e8206$var$PopperContentProvider, { scope: __scopePopper, placedSide, onArrowChange: setArrow, arrowX, arrowY, shouldHideArrow: cannotCenterArrow }, isRoot ? /* @__PURE__ */ y$6($cf1ac5d9fe0e8206$var$PositionContextProvider, { scope: __scopePopper, hasParent: true, positionUpdateFns }, /* @__PURE__ */ y$6($8927f6f2acc4f386$export$250ffa63cdc0d034.div, commonProps)) : /* @__PURE__ */ y$6($8927f6f2acc4f386$export$250ffa63cdc0d034.div, commonProps))); }); const $cf1ac5d9fe0e8206$var$ARROW_NAME = "PopperArrow"; const $cf1ac5d9fe0e8206$var$OPPOSITE_SIDE = { top: "bottom", right: "left", bottom: "top", left: "right" }; const $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd0 = /* @__PURE__ */ k$1(function $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd02(props, forwardedRef) { const { __scopePopper, ...arrowProps } = props; const contentContext = $cf1ac5d9fe0e8206$var$useContentContext($cf1ac5d9fe0e8206$var$ARROW_NAME, __scopePopper); const baseSide = $cf1ac5d9fe0e8206$var$OPPOSITE_SIDE[contentContext.placedSide]; return ( // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`) // doesn't report size as we'd expect on SVG elements. // it reports their bounding box which is effectively the largest path inside the SVG. /* @__PURE__ */ y$6("span", { ref: contentContext.onArrowChange, style: { position: "absolute", left: contentContext.arrowX, top: contentContext.arrowY, [baseSide]: 0, transformOrigin: { top: "", right: "0 0", bottom: "center 0", left: "100% 0" }[contentContext.placedSide], transform: { top: "translateY(100%)", right: "translateY(50%) rotate(90deg) translateX(-50%)", bottom: `rotate(180deg)`, left: "translateY(50%) rotate(-90deg) translateX(50%)" }[contentContext.placedSide], visibility: contentContext.shouldHideArrow ? "hidden" : void 0 } }, /* @__PURE__ */ y$6($7e8f5cd07187803e$export$be92b6f5f03c0fe9, _extends({}, arrowProps, { ref: forwardedRef, style: { ...arrowProps.style, // ensures the element can be measured correctly (mostly for if SVG) display: "block" } }))) ); }); function $cf1ac5d9fe0e8206$var$isDefined(value) { return value !== void 0; } function $cf1ac5d9fe0e8206$var$isNotNull(value) { return value !== null; } const $cf1ac5d9fe0e8206$var$anchorCssProperties = () => ({ name: "anchorCssProperties", fn(data) { const { rects, elements } = data; const { width, height } = rects.reference; elements.floating.style.setProperty("--radix-popper-anchor-width", `${width}px`); elements.floating.style.setProperty("--radix-popper-anchor-height", `${height}px`); return {}; } }); const $cf1ac5d9fe0e8206$var$transformOrigin = (options) => ({ name: "transformOrigin", options, fn(data) { var _middlewareData$arrow4, _middlewareData$arrow5, _middlewareData$arrow6, _middlewareData$arrow7, _middlewareData$arrow8; const { placement, rects, middlewareData } = data; const cannotCenterArrow = ((_middlewareData$arrow4 = middlewareData.arrow) === null || _middlewareData$arrow4 === void 0 ? void 0 : _middlewareData$arrow4.centerOffset) !== 0; const isArrowHidden = cannotCenterArrow; const arrowWidth = isArrowHidden ? 0 : options.arrowWidth; const arrowHeight = isArrowHidden ? 0 : options.arrowHeight; const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement); const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign]; const arrowXCenter = ((_middlewareData$arrow5 = (_middlewareData$arrow6 = middlewareData.arrow) === null || _middlewareData$arrow6 === void 0 ? void 0 : _middlewareData$arrow6.x) !== null && _middlewareData$arrow5 !== void 0 ? _middlewareData$arrow5 : 0) + arrowWidth / 2; const arrowYCenter = ((_middlewareData$arrow7 = (_middlewareData$arrow8 = middlewareData.arrow) === null || _middlewareData$arrow8 === void 0 ? void 0 : _middlewareData$arrow8.y) !== null && _middlewareData$arrow7 !== void 0 ? _middlewareData$arrow7 : 0) + arrowHeight / 2; let x2 = ""; let y2 = ""; if (placedSide === "bottom") { x2 = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`; y2 = `${-arrowHeight}px`; } else if (placedSide === "top") { x2 = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`; y2 = `${rects.floating.height + arrowHeight}px`; } else if (placedSide === "right") { x2 = `${-arrowHeight}px`; y2 = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`; } else if (placedSide === "left") { x2 = `${rects.floating.width + arrowHeight}px`; y2 = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`; } return { data: { x: x2, y: y2 } }; } }); function $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement) { const [side, align = "center"] = placement.split("-"); return [ side, align ]; } const $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9 = $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9; const $cf1ac5d9fe0e8206$export$b688253958b8dfe7 = $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d; const $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 = $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc; const $cf1ac5d9fe0e8206$export$21b07c8f274aebd5 = $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd0; let $cef8881cdc69808e$var$originalBodyUserSelect; const $cef8881cdc69808e$var$HOVERCARD_NAME = "HoverCard"; const [$cef8881cdc69808e$var$createHoverCardContext, $cef8881cdc69808e$export$47b6998a836b7260] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($cef8881cdc69808e$var$HOVERCARD_NAME, [ $cf1ac5d9fe0e8206$export$722aac194ae923 ]); const $cef8881cdc69808e$var$usePopperScope = $cf1ac5d9fe0e8206$export$722aac194ae923(); const [$cef8881cdc69808e$var$HoverCardProvider, $cef8881cdc69808e$var$useHoverCardContext] = $cef8881cdc69808e$var$createHoverCardContext($cef8881cdc69808e$var$HOVERCARD_NAME); const $cef8881cdc69808e$export$57a077cc9fbe653e = (props) => { const { __scopeHoverCard, children, open: openProp, defaultOpen, onOpenChange, openDelay = 700, closeDelay = 300 } = props; const popperScope = $cef8881cdc69808e$var$usePopperScope(__scopeHoverCard); const openTimerRef = _$1(0); const closeTimerRef = _$1(0); const hasSelectionRef = _$1(false); const isPointerDownOnContentRef = _$1(false); const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: openProp, defaultProp: defaultOpen, onChange: onOpenChange }); const handleOpen = T$4(() => { clearTimeout(closeTimerRef.current); openTimerRef.current = window.setTimeout( () => setOpen(true), openDelay ); }, [ openDelay, setOpen ]); const handleClose = T$4(() => { clearTimeout(openTimerRef.current); if (!hasSelectionRef.current && !isPointerDownOnContentRef.current) closeTimerRef.current = window.setTimeout( () => setOpen(false), closeDelay ); }, [ closeDelay, setOpen ]); const handleDismiss = T$4( () => setOpen(false), [ setOpen ] ); p$6(() => { return () => { clearTimeout(openTimerRef.current); clearTimeout(closeTimerRef.current); }; }, []); return /* @__PURE__ */ y$6($cef8881cdc69808e$var$HoverCardProvider, { scope: __scopeHoverCard, open, onOpenChange: setOpen, onOpen: handleOpen, onClose: handleClose, onDismiss: handleDismiss, hasSelectionRef, isPointerDownOnContentRef }, /* @__PURE__ */ y$6($cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9, popperScope, children)); }; const $cef8881cdc69808e$var$TRIGGER_NAME = "HoverCardTrigger"; const $cef8881cdc69808e$export$ef9f7fd8e4ba882f = /* @__PURE__ */ k$1((props, forwardedRef) => { const { __scopeHoverCard, ...triggerProps } = props; const context = $cef8881cdc69808e$var$useHoverCardContext($cef8881cdc69808e$var$TRIGGER_NAME, __scopeHoverCard); const popperScope = $cef8881cdc69808e$var$usePopperScope(__scopeHoverCard); return /* @__PURE__ */ y$6($cf1ac5d9fe0e8206$export$b688253958b8dfe7, _extends({ asChild: true }, popperScope), /* @__PURE__ */ y$6($8927f6f2acc4f386$export$250ffa63cdc0d034.a, _extends({ "data-state": context.open ? "open" : "closed" }, triggerProps, { ref: forwardedRef, onPointerEnter: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerEnter, $cef8881cdc69808e$var$excludeTouch(context.onOpen)), onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerLeave, $cef8881cdc69808e$var$excludeTouch(context.onClose)), onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, context.onOpen), onBlur: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlur, context.onClose), onTouchStart: $e42e1063c40fb3ef$export$b9ecd428b558ff10( props.onTouchStart, (event) => event.preventDefault() ) }))); }); const $cef8881cdc69808e$var$PORTAL_NAME = "HoverCardPortal"; const [$cef8881cdc69808e$var$PortalProvider, $cef8881cdc69808e$var$usePortalContext] = $cef8881cdc69808e$var$createHoverCardContext($cef8881cdc69808e$var$PORTAL_NAME, { forceMount: void 0 }); const $cef8881cdc69808e$export$b384c6e0a789f88b = (props) => { const { __scopeHoverCard, forceMount, children, container } = props; const context = $cef8881cdc69808e$var$useHoverCardContext($cef8881cdc69808e$var$PORTAL_NAME, __scopeHoverCard); return /* @__PURE__ */ y$6($cef8881cdc69808e$var$PortalProvider, { scope: __scopeHoverCard, forceMount }, /* @__PURE__ */ y$6($921a889cee6df7e8$export$99c2b779aa4e8b8b, { present: forceMount || context.open }, /* @__PURE__ */ y$6($f1701beae083dbae$export$602eac185826482c, { asChild: true, container }, children))); }; const $cef8881cdc69808e$var$CONTENT_NAME = "HoverCardContent"; const $cef8881cdc69808e$export$aa4724a5938c586 = /* @__PURE__ */ k$1((props, forwardedRef) => { const portalContext = $cef8881cdc69808e$var$usePortalContext($cef8881cdc69808e$var$CONTENT_NAME, props.__scopeHoverCard); const { forceMount = portalContext.forceMount, ...contentProps } = props; const context = $cef8881cdc69808e$var$useHoverCardContext($cef8881cdc69808e$var$CONTENT_NAME, props.__scopeHoverCard); return /* @__PURE__ */ y$6($921a889cee6df7e8$export$99c2b779aa4e8b8b, { present: forceMount || context.open }, /* @__PURE__ */ y$6($cef8881cdc69808e$var$HoverCardContentImpl, _extends({ "data-state": context.open ? "open" : "closed" }, contentProps, { onPointerEnter: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerEnter, $cef8881cdc69808e$var$excludeTouch(context.onOpen)), onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerLeave, $cef8881cdc69808e$var$excludeTouch(context.onClose)), ref: forwardedRef }))); }); const $cef8881cdc69808e$var$HoverCardContentImpl = /* @__PURE__ */ k$1((props, forwardedRef) => { const { __scopeHoverCard, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, ...contentProps } = props; const context = $cef8881cdc69808e$var$useHoverCardContext($cef8881cdc69808e$var$CONTENT_NAME, __scopeHoverCard); const popperScope = $cef8881cdc69808e$var$usePopperScope(__scopeHoverCard); const ref = _$1(null); const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref); const [containSelection, setContainSelection] = h$4(false); p$6(() => { if (containSelection) { const body2 = document.body; $cef8881cdc69808e$var$originalBodyUserSelect = body2.style.userSelect || body2.style.webkitUserSelect; body2.style.userSelect = "none"; body2.style.webkitUserSelect = "none"; return () => { body2.style.userSelect = $cef8881cdc69808e$var$originalBodyUserSelect; body2.style.webkitUserSelect = $cef8881cdc69808e$var$originalBodyUserSelect; }; } }, [ containSelection ]); p$6(() => { if (ref.current) { const handlePointerUp = () => { setContainSelection(false); context.isPointerDownOnContentRef.current = false; setTimeout(() => { var _document$getSelectio; const hasSelection = ((_document$getSelectio = document.getSelection()) === null || _document$getSelectio === void 0 ? void 0 : _document$getSelectio.toString()) !== ""; if (hasSelection) context.hasSelectionRef.current = true; }); }; document.addEventListener("pointerup", handlePointerUp); return () => { document.removeEventListener("pointerup", handlePointerUp); context.hasSelectionRef.current = false; context.isPointerDownOnContentRef.current = false; }; } }, [ context.isPointerDownOnContentRef, context.hasSelectionRef ]); p$6(() => { if (ref.current) { const tabbables = $cef8881cdc69808e$var$getTabbableNodes(ref.current); tabbables.forEach( (tabbable) => tabbable.setAttribute("tabindex", "-1") ); } }); return /* @__PURE__ */ y$6($5cb92bef7577960e$export$177fb62ff3ec1f22, { asChild: true, disableOutsidePointerEvents: false, onInteractOutside, onEscapeKeyDown, onPointerDownOutside, onFocusOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(onFocusOutside, (event) => { event.preventDefault(); }), onDismiss: context.onDismiss }, /* @__PURE__ */ y$6($cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2, _extends({}, popperScope, contentProps, { onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(contentProps.onPointerDown, (event) => { if (event.currentTarget.contains(event.target)) setContainSelection(true); context.hasSelectionRef.current = false; context.isPointerDownOnContentRef.current = true; }), ref: composedRefs, style: { ...contentProps.style, userSelect: containSelection ? "text" : void 0, // Safari requires prefix WebkitUserSelect: containSelection ? "text" : void 0, "--radix-hover-card-content-transform-origin": "var(--radix-popper-transform-origin)", "--radix-hover-card-content-available-width": "var(--radix-popper-available-width)", "--radix-hover-card-content-available-height": "var(--radix-popper-available-height)", "--radix-hover-card-trigger-width": "var(--radix-popper-anchor-width)", "--radix-hover-card-trigger-height": "var(--radix-popper-anchor-height)" } }))); }); const $cef8881cdc69808e$export$b9744d3e7456d806 = /* @__PURE__ */ k$1((props, forwardedRef) => { const { __scopeHoverCard, ...arrowProps } = props; const popperScope = $cef8881cdc69808e$var$usePopperScope(__scopeHoverCard); return /* @__PURE__ */ y$6($cf1ac5d9fe0e8206$export$21b07c8f274aebd5, _extends({}, popperScope, arrowProps, { ref: forwardedRef })); }); function $cef8881cdc69808e$var$excludeTouch(eventHandler) { return (event) => event.pointerType === "touch" ? void 0 : eventHandler(); } function $cef8881cdc69808e$var$getTabbableNodes(container) { const nodes = []; const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { acceptNode: (node2) => { return node2.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } }); while (walker.nextNode()) nodes.push(walker.currentNode); return nodes; } const $cef8881cdc69808e$export$be92b6f5f03c0fe9 = $cef8881cdc69808e$export$57a077cc9fbe653e; const $cef8881cdc69808e$export$41fb9f06171c75f4 = $cef8881cdc69808e$export$ef9f7fd8e4ba882f; const $cef8881cdc69808e$export$602eac185826482c = $cef8881cdc69808e$export$b384c6e0a789f88b; const $cef8881cdc69808e$export$7c6e2c02157bb7d2 = $cef8881cdc69808e$export$aa4724a5938c586; const $cef8881cdc69808e$export$21b07c8f274aebd5 = $cef8881cdc69808e$export$b9744d3e7456d806; function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { return typeof obj2; } : function(obj2) { return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }, _typeof(obj); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== void 0) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _toPropertyKey(arg) { var key2 = _toPrimitive(arg, "string"); return _typeof(key2) === "symbol" ? key2 : String(key2); } function _defineProperty(obj, key2, value) { key2 = _toPropertyKey(key2); if (key2 in obj) { Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value; } return obj; } function warn() { if (console && console.warn) { var _console; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } if (typeof args[0] === "string") args[0] = "react-i18next:: ".concat(args[0]); (_console = console).warn.apply(_console, args); } } var alreadyWarned = {}; function warnOnce() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } if (typeof args[0] === "string" && alreadyWarned[args[0]]) return; if (typeof args[0] === "string") alreadyWarned[args[0]] = /* @__PURE__ */ new Date(); warn.apply(void 0, args); } var loadedClb = function loadedClb2(i18n, cb) { return function() { if (i18n.isInitialized) { cb(); } else { var initialized = function initialized2() { setTimeout(function() { i18n.off("initialized", initialized2); }, 0); cb(); }; i18n.on("initialized", initialized); } }; }; function loadNamespaces(i18n, ns, cb) { i18n.loadNamespaces(ns, loadedClb(i18n, cb)); } function loadLanguages(i18n, lng, ns, cb) { if (typeof ns === "string") ns = [ns]; ns.forEach(function(n2) { if (i18n.options.ns.indexOf(n2) < 0) i18n.options.ns.push(n2); }); i18n.loadLanguages(lng, loadedClb(i18n, cb)); } function oldI18nextHasLoadedNamespace(ns, i18n) { var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; var lng = i18n.languages[0]; var fallbackLng = i18n.options ? i18n.options.fallbackLng : false; var lastLng = i18n.languages[i18n.languages.length - 1]; if (lng.toLowerCase() === "cimode") return true; var loadNotPending = function loadNotPending2(l2, n2) { var loadState = i18n.services.backendConnector.state["".concat(l2, "|").concat(n2)]; return loadState === -1 || loadState === 2; }; if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns)) return false; if (i18n.hasResourceBundle(lng, ns)) return true; if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages) return true; if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true; return false; } function hasLoadedNamespace(ns, i18n) { var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; if (!i18n.languages || !i18n.languages.length) { warnOnce("i18n.languages were undefined or empty", i18n.languages); return true; } var isNewerI18next = i18n.options.ignoreJSONStructure !== void 0; if (!isNewerI18next) { return oldI18nextHasLoadedNamespace(ns, i18n, options); } return i18n.hasLoadedNamespace(ns, { lng: options.lng, precheck: function precheck(i18nInstance2, loadNotPending) { if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false; } }); } var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g; var htmlEntities = { "&": "&", "&": "&", "<": "<", "<": "<", ">": ">", ">": ">", "'": "'", "'": "'", """: '"', """: '"', " ": " ", " ": " ", "©": "©", "©": "©", "®": "®", "®": "®", "…": "…", "…": "…", "/": "/", "/": "/" }; var unescapeHtmlEntity = function unescapeHtmlEntity2(m2) { return htmlEntities[m2]; }; var unescape = function unescape2(text2) { return text2.replace(matchHtmlEntity, unescapeHtmlEntity); }; function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread$8(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source = arguments[i2] != null ? arguments[i2] : {}; if (i2 % 2) { ownKeys$8(Object(source), true).forEach(function(key2) { _defineProperty(target, key2, source[key2]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); }); } } return target; } var defaultOptions = { bindI18n: "languageChanged", bindI18nStore: "", transEmptyNodeValue: "", transSupportBasicHtmlNodes: true, transWrapTextNodes: "", transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"], useSuspense: true, unescape }; function setDefaults() { var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; defaultOptions = _objectSpread$8(_objectSpread$8({}, defaultOptions), options); } function getDefaults() { return defaultOptions; } var i18nInstance; function setI18n(instance2) { i18nInstance = instance2; } function getI18n() { return i18nInstance; } function _classCallCheck(instance2, Constructor) { if (!(instance2 instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i2 = 0; i2 < props.length; i2++) { var descriptor = props[i2]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(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 initReactI18next = { type: "3rdParty", init: function init(instance2) { setDefaults(instance2.options.react); setI18n(instance2); } }; var I18nContext = G$1(); var ReportNamespaces = function() { function ReportNamespaces2() { _classCallCheck(this, ReportNamespaces2); this.usedNamespaces = {}; } _createClass(ReportNamespaces2, [{ key: "addUsedNamespaces", value: function addUsedNamespaces(namespaces) { var _this = this; namespaces.forEach(function(ns) { if (!_this.usedNamespaces[ns]) _this.usedNamespaces[ns] = true; }); } }, { key: "getUsedNamespaces", value: function getUsedNamespaces() { return Object.keys(this.usedNamespaces); } }]); return ReportNamespaces2; }(); function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _iterableToArrayLimit(arr, i2) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n2 = true, _d = false; try { if (_x = (_i = _i.call(arr)).next, 0 === i2) { if (Object(_i) !== _i) return; _n2 = false; } else for (; !(_n2 = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i2); _n2 = true) ; } catch (err) { _d = true, _e = err; } finally { try { if (!_n2 && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } 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 _unsupportedIterableToArray(o3, minLen) { if (!o3) return; if (typeof o3 === "string") return _arrayLikeToArray(o3, minLen); var n2 = Object.prototype.toString.call(o3).slice(8, -1); if (n2 === "Object" && o3.constructor) n2 = o3.constructor.name; if (n2 === "Map" || n2 === "Set") return Array.from(o3); if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray(o3, minLen); } 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 _slicedToArray(arr, i2) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i2) || _unsupportedIterableToArray(arr, i2) || _nonIterableRest(); } function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread$7(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source = arguments[i2] != null ? arguments[i2] : {}; if (i2 % 2) { ownKeys$7(Object(source), true).forEach(function(key2) { _defineProperty(target, key2, source[key2]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); }); } } return target; } var usePrevious = function usePrevious2(value, ignore2) { var ref = _$1(); p$6(function() { ref.current = ignore2 ? ref.current : value; }, [value, ignore2]); return ref.current; }; function useTranslation(ns) { var props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var i18nFromProps = props.i18n; var _ref = q$1(I18nContext) || {}, i18nFromContext = _ref.i18n, defaultNSFromContext = _ref.defaultNS; var i18n = i18nFromProps || i18nFromContext || getI18n(); if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces(); if (!i18n) { warnOnce("You will need to pass in an i18next instance by using initReactI18next"); var notReadyT = function notReadyT2(k2, optsOrDefaultValue) { if (typeof optsOrDefaultValue === "string") return optsOrDefaultValue; if (optsOrDefaultValue && _typeof(optsOrDefaultValue) === "object" && typeof optsOrDefaultValue.defaultValue === "string") return optsOrDefaultValue.defaultValue; return Array.isArray(k2) ? k2[k2.length - 1] : k2; }; var retNotReady = [notReadyT, {}, false]; retNotReady.t = notReadyT; retNotReady.i18n = {}; retNotReady.ready = false; return retNotReady; } if (i18n.options.react && i18n.options.react.wait !== void 0) warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour."); var i18nOptions = _objectSpread$7(_objectSpread$7(_objectSpread$7({}, getDefaults()), i18n.options.react), props); var useSuspense = i18nOptions.useSuspense, keyPrefix = i18nOptions.keyPrefix; var namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS; namespaces = typeof namespaces === "string" ? [namespaces] : namespaces || ["translation"]; if (i18n.reportNamespaces.addUsedNamespaces) i18n.reportNamespaces.addUsedNamespaces(namespaces); var ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(function(n2) { return hasLoadedNamespace(n2, i18n, i18nOptions); }); function getT() { return i18n.getFixedT(props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix); } var _useState = h$4(getT), _useState2 = _slicedToArray(_useState, 2), t2 = _useState2[0], setT = _useState2[1]; var joinedNS = namespaces.join(); if (props.lng) joinedNS = "".concat(props.lng).concat(joinedNS); var previousJoinedNS = usePrevious(joinedNS); var isMounted = _$1(true); p$6(function() { var bindI18n = i18nOptions.bindI18n, bindI18nStore = i18nOptions.bindI18nStore; isMounted.current = true; if (!ready && !useSuspense) { if (props.lng) { loadLanguages(i18n, props.lng, namespaces, function() { if (isMounted.current) setT(getT); }); } else { loadNamespaces(i18n, namespaces, function() { if (isMounted.current) setT(getT); }); } } if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) { setT(getT); } function boundReset() { if (isMounted.current) setT(getT); } if (bindI18n && i18n) i18n.on(bindI18n, boundReset); if (bindI18nStore && i18n) i18n.store.on(bindI18nStore, boundReset); return function() { isMounted.current = false; if (bindI18n && i18n) bindI18n.split(" ").forEach(function(e2) { return i18n.off(e2, boundReset); }); if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach(function(e2) { return i18n.store.off(e2, boundReset); }); }; }, [i18n, joinedNS]); var isInitial = _$1(true); p$6(function() { if (isMounted.current && !isInitial.current) { setT(getT); } isInitial.current = false; }, [i18n, keyPrefix]); var ret = [t2, i18n, ready]; ret.t = t2; ret.i18n = i18n; ret.ready = ready; if (ready) return ret; if (!ready && !useSuspense) return ret; throw new Promise(function(resolve) { if (props.lng) { loadLanguages(i18n, props.lng, namespaces, function() { return resolve(); }); } else { loadNamespaces(i18n, namespaces, function() { return resolve(); }); } }); } function _assertThisInitialized(self2) { if (self2 === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self2; } function _setPrototypeOf(o3, p2) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o4, p3) { o4.__proto__ = p3; return o4; }; return _setPrototypeOf(o3, p2); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _possibleConstructorReturn(self2, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self2); } function _getPrototypeOf(o3) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o4) { return o4.__proto__ || Object.getPrototypeOf(o4); }; return _getPrototypeOf(o3); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); } function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$6(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source = null != arguments[i2] ? arguments[i2] : {}; i2 % 2 ? ownKeys$6(Object(source), true).forEach(function(key2) { _defineProperty(target, key2, source[key2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); }); } return target; } var consoleLogger = { type: "logger", log: function log(args) { this.output("log", args); }, warn: function warn2(args) { this.output("warn", args); }, error: function error(args) { this.output("error", args); }, output: function output(type, args) { if (console && console[type]) console[type].apply(console, args); } }; var Logger = function() { function Logger2(concreteLogger) { var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; _classCallCheck(this, Logger2); this.init(concreteLogger, options); } _createClass(Logger2, [{ key: "init", value: function init2(concreteLogger) { var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.prefix = options.prefix || "i18next:"; this.logger = concreteLogger || consoleLogger; this.options = options; this.debug = options.debug; } }, { key: "setDebug", value: function setDebug(bool) { this.debug = bool; } }, { key: "log", value: function log2() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return this.forward(args, "log", "", true); } }, { key: "warn", value: function warn3() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return this.forward(args, "warn", "", true); } }, { key: "error", value: function error2() { for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } return this.forward(args, "error", ""); } }, { key: "deprecate", value: function deprecate() { for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } return this.forward(args, "warn", "WARNING DEPRECATED: ", true); } }, { key: "forward", value: function forward(args, lvl, prefix, debugOnly) { if (debugOnly && !this.debug) return null; if (typeof args[0] === "string") args[0] = "".concat(prefix).concat(this.prefix, " ").concat(args[0]); return this.logger[lvl](args); } }, { key: "create", value: function create2(moduleName) { return new Logger2(this.logger, _objectSpread$6(_objectSpread$6({}, { prefix: "".concat(this.prefix, ":").concat(moduleName, ":") }), this.options)); } }, { key: "clone", value: function clone(options) { options = options || this.options; options.prefix = options.prefix || this.prefix; return new Logger2(this.logger, options); } }]); return Logger2; }(); var baseLogger = new Logger(); var EventEmitter$1 = function() { function EventEmitter2() { _classCallCheck(this, EventEmitter2); this.observers = {}; } _createClass(EventEmitter2, [{ key: "on", value: function on2(events, listener) { var _this = this; events.split(" ").forEach(function(event) { _this.observers[event] = _this.observers[event] || []; _this.observers[event].push(listener); }); return this; } }, { key: "off", value: function off(event, listener) { if (!this.observers[event]) return; if (!listener) { delete this.observers[event]; return; } this.observers[event] = this.observers[event].filter(function(l2) { return l2 !== listener; }); } }, { key: "emit", value: function emit(event) { 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.observers[event]) { var cloned = [].concat(this.observers[event]); cloned.forEach(function(observer) { observer.apply(void 0, args); }); } if (this.observers["*"]) { var _cloned = [].concat(this.observers["*"]); _cloned.forEach(function(observer) { observer.apply(observer, [event].concat(args)); }); } } }]); return EventEmitter2; }(); function defer() { var res; var rej; var promise = new Promise(function(resolve, reject) { res = resolve; rej = reject; }); promise.resolve = res; promise.reject = rej; return promise; } function makeString(object) { if (object == null) return ""; return "" + object; } function copy(a2, s2, t2) { a2.forEach(function(m2) { if (s2[m2]) t2[m2] = s2[m2]; }); } function getLastOfPath(object, path2, Empty) { function cleanKey(key3) { return key3 && key3.indexOf("###") > -1 ? key3.replace(/###/g, ".") : key3; } function canNotTraverseDeeper() { return !object || typeof object === "string"; } var stack = typeof path2 !== "string" ? [].concat(path2) : path2.split("."); while (stack.length > 1) { if (canNotTraverseDeeper()) return {}; var key2 = cleanKey(stack.shift()); if (!object[key2] && Empty) object[key2] = new Empty(); if (Object.prototype.hasOwnProperty.call(object, key2)) { object = object[key2]; } else { object = {}; } } if (canNotTraverseDeeper()) return {}; return { obj: object, k: cleanKey(stack.shift()) }; } function setPath(object, path2, newValue) { var _getLastOfPath = getLastOfPath(object, path2, Object), obj = _getLastOfPath.obj, k2 = _getLastOfPath.k; obj[k2] = newValue; } function pushPath(object, path2, newValue, concat) { var _getLastOfPath2 = getLastOfPath(object, path2, Object), obj = _getLastOfPath2.obj, k2 = _getLastOfPath2.k; obj[k2] = obj[k2] || []; if (concat) obj[k2] = obj[k2].concat(newValue); if (!concat) obj[k2].push(newValue); } function getPath(object, path2) { var _getLastOfPath3 = getLastOfPath(object, path2), obj = _getLastOfPath3.obj, k2 = _getLastOfPath3.k; if (!obj) return void 0; return obj[k2]; } function getPathWithDefaults(data, defaultData, key2) { var value = getPath(data, key2); if (value !== void 0) { return value; } return getPath(defaultData, key2); } function deepExtend(target, source, overwrite) { for (var prop in source) { if (prop !== "__proto__" && prop !== "constructor") { if (prop in target) { if (typeof target[prop] === "string" || target[prop] instanceof String || typeof source[prop] === "string" || source[prop] instanceof String) { if (overwrite) target[prop] = source[prop]; } else { deepExtend(target[prop], source[prop], overwrite); } } else { target[prop] = source[prop]; } } } return target; } function regexEscape(str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); } var _entityMap = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'", "/": "/" }; function escape(data) { if (typeof data === "string") { return data.replace(/[&<>"'\/]/g, function(s2) { return _entityMap[s2]; }); } return data; } var isIE10 = typeof window !== "undefined" && window.navigator && typeof window.navigator.userAgentData === "undefined" && window.navigator.userAgent && window.navigator.userAgent.indexOf("MSIE") > -1; var chars = [" ", ",", "?", "!", ";"]; function looksLikeObjectPath(key2, nsSeparator, keySeparator) { nsSeparator = nsSeparator || ""; keySeparator = keySeparator || ""; var possibleChars = chars.filter(function(c2) { return nsSeparator.indexOf(c2) < 0 && keySeparator.indexOf(c2) < 0; }); if (possibleChars.length === 0) return true; var r2 = new RegExp("(".concat(possibleChars.map(function(c2) { return c2 === "?" ? "\\?" : c2; }).join("|"), ")")); var matched = !r2.test(key2); if (!matched) { var ki = key2.indexOf(keySeparator); if (ki > 0 && !r2.test(key2.substring(0, ki))) { matched = true; } } return matched; } function deepFind(obj, path2) { var keySeparator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "."; if (!obj) return void 0; if (obj[path2]) return obj[path2]; var paths = path2.split(keySeparator); var current = obj; for (var i2 = 0; i2 < paths.length; ++i2) { if (!current) return void 0; if (typeof current[paths[i2]] === "string" && i2 + 1 < paths.length) { return void 0; } if (current[paths[i2]] === void 0) { var j2 = 2; var p2 = paths.slice(i2, i2 + j2).join(keySeparator); var mix = current[p2]; while (mix === void 0 && paths.length > i2 + j2) { j2++; p2 = paths.slice(i2, i2 + j2).join(keySeparator); mix = current[p2]; } if (mix === void 0) return void 0; if (mix === null) return null; if (path2.endsWith(p2)) { if (typeof mix === "string") return mix; if (p2 && typeof mix[p2] === "string") return mix[p2]; } var joinedPath = paths.slice(i2 + j2).join(keySeparator); if (joinedPath) return deepFind(mix, joinedPath, keySeparator); return void 0; } current = current[paths[i2]]; } return current; } function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$5(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source = null != arguments[i2] ? arguments[i2] : {}; i2 % 2 ? ownKeys$5(Object(source), true).forEach(function(key2) { _defineProperty(target, key2, source[key2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); }); } return target; } function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _isNativeReflectConstruct$3() { 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; } } var ResourceStore = function(_EventEmitter) { _inherits(ResourceStore2, _EventEmitter); var _super = _createSuper$3(ResourceStore2); function ResourceStore2(data) { var _this; var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { ns: ["translation"], defaultNS: "translation" }; _classCallCheck(this, ResourceStore2); _this = _super.call(this); if (isIE10) { EventEmitter$1.call(_assertThisInitialized(_this)); } _this.data = data || {}; _this.options = options; if (_this.options.keySeparator === void 0) { _this.options.keySeparator = "."; } if (_this.options.ignoreJSONStructure === void 0) { _this.options.ignoreJSONStructure = true; } return _this; } _createClass(ResourceStore2, [{ key: "addNamespaces", value: function addNamespaces(ns) { if (this.options.ns.indexOf(ns) < 0) { this.options.ns.push(ns); } } }, { key: "removeNamespaces", value: function removeNamespaces(ns) { var index2 = this.options.ns.indexOf(ns); if (index2 > -1) { this.options.ns.splice(index2, 1); } } }, { key: "getResource", value: function getResource(lng, ns, key2) { var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator; var ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure; var path2 = [lng, ns]; if (key2 && typeof key2 !== "string") path2 = path2.concat(key2); if (key2 && typeof key2 === "string") path2 = path2.concat(keySeparator ? key2.split(keySeparator) : key2); if (lng.indexOf(".") > -1) { path2 = lng.split("."); } var result = getPath(this.data, path2); if (result || !ignoreJSONStructure || typeof key2 !== "string") return result; return deepFind(this.data && this.data[lng] && this.data[lng][ns], key2, keySeparator); } }, { key: "addResource", value: function addResource(lng, ns, key2, value) { var options = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : { silent: false }; var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator; var path2 = [lng, ns]; if (key2) path2 = path2.concat(keySeparator ? key2.split(keySeparator) : key2); if (lng.indexOf(".") > -1) { path2 = lng.split("."); value = ns; ns = path2[1]; } this.addNamespaces(ns); setPath(this.data, path2, value); if (!options.silent) this.emit("added", lng, ns, key2, value); } }, { key: "addResources", value: function addResources(lng, ns, resources2) { var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : { silent: false }; for (var m2 in resources2) { if (typeof resources2[m2] === "string" || Object.prototype.toString.apply(resources2[m2]) === "[object Array]") this.addResource(lng, ns, m2, resources2[m2], { silent: true }); } if (!options.silent) this.emit("added", lng, ns, resources2); } }, { key: "addResourceBundle", value: function addResourceBundle(lng, ns, resources2, deep, overwrite) { var options = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : { silent: false }; var path2 = [lng, ns]; if (lng.indexOf(".") > -1) { path2 = lng.split("."); deep = resources2; resources2 = ns; ns = path2[1]; } this.addNamespaces(ns); var pack = getPath(this.data, path2) || {}; if (deep) { deepExtend(pack, resources2, overwrite); } else { pack = _objectSpread$5(_objectSpread$5({}, pack), resources2); } setPath(this.data, path2, pack); if (!options.silent) this.emit("added", lng, ns, resources2); } }, { key: "removeResourceBundle", value: function removeResourceBundle(lng, ns) { if (this.hasResourceBundle(lng, ns)) { delete this.data[lng][ns]; } this.removeNamespaces(ns); this.emit("removed", lng, ns); } }, { key: "hasResourceBundle", value: function hasResourceBundle(lng, ns) { return this.getResource(lng, ns) !== void 0; } }, { key: "getResourceBundle", value: function getResourceBundle(lng, ns) { if (!ns) ns = this.options.defaultNS; if (this.options.compatibilityAPI === "v1") return _objectSpread$5(_objectSpread$5({}, {}), this.getResource(lng, ns)); return this.getResource(lng, ns); } }, { key: "getDataByLanguage", value: function getDataByLanguage(lng) { return this.data[lng]; } }, { key: "hasLanguageSomeTranslations", value: function hasLanguageSomeTranslations(lng) { var data = this.getDataByLanguage(lng); var n2 = data && Object.keys(data) || []; return !!n2.find(function(v2) { return data[v2] && Object.keys(data[v2]).length > 0; }); } }, { key: "toJSON", value: function toJSON() { return this.data; } }]); return ResourceStore2; }(EventEmitter$1); var postProcessor = { processors: {}, addPostProcessor: function addPostProcessor(module) { this.processors[module.name] = module; }, handle: function handle(processors, value, key2, options, translator) { var _this = this; processors.forEach(function(processor) { if (_this.processors[processor]) value = _this.processors[processor].process(value, key2, options, translator); }); return value; } }; function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$4(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source = null != arguments[i2] ? arguments[i2] : {}; i2 % 2 ? ownKeys$4(Object(source), true).forEach(function(key2) { _defineProperty(target, key2, source[key2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); }); } return target; } function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _isNativeReflectConstruct$2() { 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; } } var checkedLoadedFor = {}; var Translator = function(_EventEmitter) { _inherits(Translator2, _EventEmitter); var _super = _createSuper$2(Translator2); function Translator2(services) { var _this; var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; _classCallCheck(this, Translator2); _this = _super.call(this); if (isIE10) { EventEmitter$1.call(_assertThisInitialized(_this)); } copy(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, _assertThisInitialized(_this)); _this.options = options; if (_this.options.keySeparator === void 0) { _this.options.keySeparator = "."; } _this.logger = baseLogger.create("translator"); return _this; } _createClass(Translator2, [{ key: "changeLanguage", value: function changeLanguage(lng) { if (lng) this.language = lng; } }, { key: "exists", value: function exists(key2) { var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { interpolation: {} }; if (key2 === void 0 || key2 === null) { return false; } var resolved = this.resolve(key2, options); return resolved && resolved.res !== void 0; } }, { key: "extractFromKey", value: function extractFromKey(key2, options) { var nsSeparator = options.nsSeparator !== void 0 ? options.nsSeparator : this.options.nsSeparator; if (nsSeparator === void 0) nsSeparator = ":"; var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator; var namespaces = options.ns || this.options.defaultNS || []; var wouldCheckForNsInKey = nsSeparator && key2.indexOf(nsSeparator) > -1; var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key2, nsSeparator, keySeparator); if (wouldCheckForNsInKey && !seemsNaturalLanguage) { var m2 = key2.match(this.interpolator.nestingRegexp); if (m2 && m2.length > 0) { return { key: key2, namespaces }; } var parts = key2.split(nsSeparator); if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift(); key2 = parts.join(keySeparator); } if (typeof namespaces === "string") namespaces = [namespaces]; return { key: key2, namespaces }; } }, { key: "translate", value: function translate(keys, options, lastKey) { var _this2 = this; if (_typeof(options) !== "object" && this.options.overloadTranslationOptionHandler) { options = this.options.overloadTranslationOptionHandler(arguments); } if (_typeof(options) === "object") options = _objectSpread$4({}, options); if (!options) options = {}; if (keys === void 0 || keys === null) return ""; if (!Array.isArray(keys)) keys = [String(keys)]; var returnDetails = options.returnDetails !== void 0 ? options.returnDetails : this.options.returnDetails; var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator; var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options), key2 = _this$extractFromKey.key, namespaces = _this$extractFromKey.namespaces; var namespace = namespaces[namespaces.length - 1]; var lng = options.lng || this.language; var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode; if (lng && lng.toLowerCase() === "cimode") { if (appendNamespaceToCIMode) { var nsSeparator = options.nsSeparator || this.options.nsSeparator; if (returnDetails) { return { res: "".concat(namespace).concat(nsSeparator).concat(key2), usedKey: key2, exactUsedKey: key2, usedLng: lng, usedNS: namespace }; } return "".concat(namespace).concat(nsSeparator).concat(key2); } if (returnDetails) { return { res: key2, usedKey: key2, exactUsedKey: key2, usedLng: lng, usedNS: namespace }; } return key2; } var resolved = this.resolve(keys, options); var res = resolved && resolved.res; var resUsedKey = resolved && resolved.usedKey || key2; var resExactUsedKey = resolved && resolved.exactUsedKey || key2; var resType = Object.prototype.toString.apply(res); var noObject = ["[object Number]", "[object Function]", "[object RegExp]"]; var joinArrays = options.joinArrays !== void 0 ? options.joinArrays : this.options.joinArrays; var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject; var handleAsObject = typeof res !== "string" && typeof res !== "boolean" && typeof res !== "number"; if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === "string" && resType === "[object Array]")) { if (!options.returnObjects && !this.options.returnObjects) { if (!this.options.returnedObjectHandler) { this.logger.warn("accessing an object - but returnObjects options is not enabled!"); } var r2 = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$4(_objectSpread$4({}, options), {}, { ns: namespaces })) : "key '".concat(key2, " (").concat(this.language, ")' returned an object instead of string."); if (returnDetails) { resolved.res = r2; return resolved; } return r2; } if (keySeparator) { var resTypeIsArray = resType === "[object Array]"; var copy2 = resTypeIsArray ? [] : {}; var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey; for (var m2 in res) { if (Object.prototype.hasOwnProperty.call(res, m2)) { var deepKey = "".concat(newKeyToUse).concat(keySeparator).concat(m2); copy2[m2] = this.translate(deepKey, _objectSpread$4(_objectSpread$4({}, options), { joinArrays: false, ns: namespaces })); if (copy2[m2] === deepKey) copy2[m2] = res[m2]; } } res = copy2; } } else if (handleAsObjectInI18nFormat && typeof joinArrays === "string" && resType === "[object Array]") { res = res.join(joinArrays); if (res) res = this.extendTranslation(res, keys, options, lastKey); } else { var usedDefault = false; var usedKey = false; var needsPluralHandling = options.count !== void 0 && typeof options.count !== "string"; var hasDefaultValue = Translator2.hasDefaultValue(options); var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : ""; var defaultValue = options["defaultValue".concat(defaultValueSuffix)] || options.defaultValue; if (!this.isValidLookup(res) && hasDefaultValue) { usedDefault = true; res = defaultValue; } if (!this.isValidLookup(res)) { usedKey = true; res = key2; } var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey; var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? void 0 : res; var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing; if (usedKey || usedDefault || updateMissing) { this.logger.log(updateMissing ? "updateKey" : "missingKey", lng, namespace, key2, updateMissing ? defaultValue : res); if (keySeparator) { var fk = this.resolve(key2, _objectSpread$4(_objectSpread$4({}, options), {}, { keySeparator: false })); if (fk && fk.res) this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format."); } var lngs = []; var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language); if (this.options.saveMissingTo === "fallback" && fallbackLngs && fallbackLngs[0]) { for (var i2 = 0; i2 < fallbackLngs.length; i2++) { lngs.push(fallbackLngs[i2]); } } else if (this.options.saveMissingTo === "all") { lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language); } else { lngs.push(options.lng || this.language); } var send = function send2(l2, k2, specificDefaultValue) { var defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing; if (_this2.options.missingKeyHandler) { _this2.options.missingKeyHandler(l2, namespace, k2, defaultForMissing, updateMissing, options); } else if (_this2.backendConnector && _this2.backendConnector.saveMissing) { _this2.backendConnector.saveMissing(l2, namespace, k2, defaultForMissing, updateMissing, options); } _this2.emit("missingKey", l2, namespace, k2, res); }; if (this.options.saveMissing) { if (this.options.saveMissingPlurals && needsPluralHandling) { lngs.forEach(function(language) { _this2.pluralResolver.getSuffixes(language, options).forEach(function(suffix) { send([language], key2 + suffix, options["defaultValue".concat(suffix)] || defaultValue); }); }); } else { send(lngs, key2, defaultValue); } } } res = this.extendTranslation(res, keys, options, resolved, lastKey); if (usedKey && res === key2 && this.options.appendNamespaceToMissingKey) res = "".concat(namespace, ":").concat(key2); if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) { if (this.options.compatibilityAPI !== "v1") { res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? "".concat(namespace, ":").concat(key2) : key2, usedDefault ? res : void 0); } else { res = this.options.parseMissingKeyHandler(res); } } } if (returnDetails) { resolved.res = res; return resolved; } return res; } }, { key: "extendTranslation", value: function extendTranslation(res, key2, options, resolved, lastKey) { var _this3 = this; if (this.i18nFormat && this.i18nFormat.parse) { res = this.i18nFormat.parse(res, _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, { resolved }); } else if (!options.skipInterpolation) { if (options.interpolation) this.interpolator.init(_objectSpread$4(_objectSpread$4({}, options), { interpolation: _objectSpread$4(_objectSpread$4({}, this.options.interpolation), options.interpolation) })); var skipOnVariables = typeof res === "string" && (options && options.interpolation && options.interpolation.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables); var nestBef; if (skipOnVariables) { var nb = res.match(this.interpolator.nestingRegexp); nestBef = nb && nb.length; } var data = options.replace && typeof options.replace !== "string" ? options.replace : options; if (this.options.interpolation.defaultVariables) data = _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), data); res = this.interpolator.interpolate(res, data, options.lng || this.language, options); if (skipOnVariables) { var na = res.match(this.interpolator.nestingRegexp); var nestAft = na && na.length; if (nestBef < nestAft) options.nest = false; } if (!options.lng && this.options.compatibilityAPI !== "v1" && resolved && resolved.res) options.lng = resolved.usedLng; if (options.nest !== false) res = this.interpolator.nest(res, function() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } if (lastKey && lastKey[0] === args[0] && !options.context) { _this3.logger.warn("It seems you are nesting recursively key: ".concat(args[0], " in key: ").concat(key2[0])); return null; } return _this3.translate.apply(_this3, args.concat([key2])); }, options); if (options.interpolation) this.interpolator.reset(); } var postProcess = options.postProcess || this.options.postProcess; var postProcessorNames = typeof postProcess === "string" ? [postProcess] : postProcess; if (res !== void 0 && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) { res = postProcessor.handle(postProcessorNames, res, key2, this.options && this.options.postProcessPassResolved ? _objectSpread$4({ i18nResolved: resolved }, options) : options, this); } return res; } }, { key: "resolve", value: function resolve(keys) { var _this4 = this; var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var found; var usedKey; var exactUsedKey; var usedLng; var usedNS; if (typeof keys === "string") keys = [keys]; keys.forEach(function(k2) { if (_this4.isValidLookup(found)) return; var extracted = _this4.extractFromKey(k2, options); var key2 = extracted.key; usedKey = key2; var namespaces = extracted.namespaces; if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS); var needsPluralHandling = options.count !== void 0 && typeof options.count !== "string"; var needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && _this4.pluralResolver.shouldUseIntlApi(); var needsContextHandling = options.context !== void 0 && (typeof options.context === "string" || typeof options.context === "number") && options.context !== ""; var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng); namespaces.forEach(function(ns) { if (_this4.isValidLookup(found)) return; usedNS = ns; if (!checkedLoadedFor["".concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) { checkedLoadedFor["".concat(codes[0], "-").concat(ns)] = true; _this4.logger.warn('key "'.concat(usedKey, '" for languages "').concat(codes.join(", "), `" won't get resolved as namespace "`).concat(usedNS, '" was not yet loaded'), "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"); } codes.forEach(function(code2) { if (_this4.isValidLookup(found)) return; usedLng = code2; var finalKeys = [key2]; if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) { _this4.i18nFormat.addLookupKeys(finalKeys, key2, code2, ns, options); } else { var pluralSuffix; if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code2, options.count, options); var zeroSuffix = "".concat(_this4.options.pluralSeparator, "zero"); if (needsPluralHandling) { finalKeys.push(key2 + pluralSuffix); if (needsZeroSuffixLookup) { finalKeys.push(key2 + zeroSuffix); } } if (needsContextHandling) { var contextKey = "".concat(key2).concat(_this4.options.contextSeparator).concat(options.context); finalKeys.push(contextKey); if (needsPluralHandling) { finalKeys.push(contextKey + pluralSuffix); if (needsZeroSuffixLookup) { finalKeys.push(contextKey + zeroSuffix); } } } } var possibleKey; while (possibleKey = finalKeys.pop()) { if (!_this4.isValidLookup(found)) { exactUsedKey = possibleKey; found = _this4.getResource(code2, ns, possibleKey, options); } } }); }); }); return { res: found, usedKey, exactUsedKey, usedLng, usedNS }; } }, { key: "isValidLookup", value: function isValidLookup(res) { return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === ""); } }, { key: "getResource", value: function getResource(code2, ns, key2) { var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code2, ns, key2, options); return this.resourceStore.getResource(code2, ns, key2, options); } }], [{ key: "hasDefaultValue", value: function hasDefaultValue(options) { var prefix = "defaultValue"; for (var option2 in options) { if (Object.prototype.hasOwnProperty.call(options, option2) && prefix === option2.substring(0, prefix.length) && void 0 !== options[option2]) { return true; } } return false; } }]); return Translator2; }(EventEmitter$1); function capitalize(string2) { return string2.charAt(0).toUpperCase() + string2.slice(1); } var LanguageUtil = function() { function LanguageUtil2(options) { _classCallCheck(this, LanguageUtil2); this.options = options; this.supportedLngs = this.options.supportedLngs || false; this.logger = baseLogger.create("languageUtils"); } _createClass(LanguageUtil2, [{ key: "getScriptPartFromCode", value: function getScriptPartFromCode(code2) { if (!code2 || code2.indexOf("-") < 0) return null; var p2 = code2.split("-"); if (p2.length === 2) return null; p2.pop(); if (p2[p2.length - 1].toLowerCase() === "x") return null; return this.formatLanguageCode(p2.join("-")); } }, { key: "getLanguagePartFromCode", value: function getLanguagePartFromCode(code2) { if (!code2 || code2.indexOf("-") < 0) return code2; var p2 = code2.split("-"); return this.formatLanguageCode(p2[0]); } }, { key: "formatLanguageCode", value: function formatLanguageCode(code2) { if (typeof code2 === "string" && code2.indexOf("-") > -1) { var specialCases = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"]; var p2 = code2.split("-"); if (this.options.lowerCaseLng) { p2 = p2.map(function(part) { return part.toLowerCase(); }); } else if (p2.length === 2) { p2[0] = p2[0].toLowerCase(); p2[1] = p2[1].toUpperCase(); if (specialCases.indexOf(p2[1].toLowerCase()) > -1) p2[1] = capitalize(p2[1].toLowerCase()); } else if (p2.length === 3) { p2[0] = p2[0].toLowerCase(); if (p2[1].length === 2) p2[1] = p2[1].toUpperCase(); if (p2[0] !== "sgn" && p2[2].length === 2) p2[2] = p2[2].toUpperCase(); if (specialCases.indexOf(p2[1].toLowerCase()) > -1) p2[1] = capitalize(p2[1].toLowerCase()); if (specialCases.indexOf(p2[2].toLowerCase()) > -1) p2[2] = capitalize(p2[2].toLowerCase()); } return p2.join("-"); } return this.options.cleanCode || this.options.lowerCaseLng ? code2.toLowerCase() : code2; } }, { key: "isSupportedCode", value: function isSupportedCode(code2) { if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) { code2 = this.getLanguagePartFromCode(code2); } return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code2) > -1; } }, { key: "getBestMatchFromCodes", value: function getBestMatchFromCodes(codes) { var _this = this; if (!codes) return null; var found; codes.forEach(function(code2) { if (found) return; var cleanedLng = _this.formatLanguageCode(code2); if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng; }); if (!found && this.options.supportedLngs) { codes.forEach(function(code2) { if (found) return; var lngOnly = _this.getLanguagePartFromCode(code2); if (_this.isSupportedCode(lngOnly)) return found = lngOnly; found = _this.options.supportedLngs.find(function(supportedLng) { if (supportedLng === lngOnly) return supportedLng; if (supportedLng.indexOf("-") < 0 && lngOnly.indexOf("-") < 0) return; if (supportedLng.indexOf(lngOnly) === 0) return supportedLng; }); }); } if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0]; return found; } }, { key: "getFallbackCodes", value: function getFallbackCodes(fallbacks, code2) { if (!fallbacks) return []; if (typeof fallbacks === "function") fallbacks = fallbacks(code2); if (typeof fallbacks === "string") fallbacks = [fallbacks]; if (Object.prototype.toString.apply(fallbacks) === "[object Array]") return fallbacks; if (!code2) return fallbacks["default"] || []; var found = fallbacks[code2]; if (!found) found = fallbacks[this.getScriptPartFromCode(code2)]; if (!found) found = fallbacks[this.formatLanguageCode(code2)]; if (!found) found = fallbacks[this.getLanguagePartFromCode(code2)]; if (!found) found = fallbacks["default"]; return found || []; } }, { key: "toResolveHierarchy", value: function toResolveHierarchy(code2, fallbackCode) { var _this2 = this; var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code2); var codes = []; var addCode = function addCode2(c2) { if (!c2) return; if (_this2.isSupportedCode(c2)) { codes.push(c2); } else { _this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c2)); } }; if (typeof code2 === "string" && code2.indexOf("-") > -1) { if (this.options.load !== "languageOnly") addCode(this.formatLanguageCode(code2)); if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly") addCode(this.getScriptPartFromCode(code2)); if (this.options.load !== "currentOnly") addCode(this.getLanguagePartFromCode(code2)); } else if (typeof code2 === "string") { addCode(this.formatLanguageCode(code2)); } fallbackCodes.forEach(function(fc) { if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc)); }); return codes; } }]); return LanguageUtil2; }(); var sets = [{ lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"], nr: [1, 2], fc: 1 }, { lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"], nr: [1, 2], fc: 2 }, { lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"], nr: [1], fc: 3 }, { lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"], nr: [1, 2, 5], fc: 4 }, { lngs: ["ar"], nr: [0, 1, 2, 3, 11, 100], fc: 5 }, { lngs: ["cs", "sk"], nr: [1, 2, 5], fc: 6 }, { lngs: ["csb", "pl"], nr: [1, 2, 5], fc: 7 }, { lngs: ["cy"], nr: [1, 2, 3, 8], fc: 8 }, { lngs: ["fr"], nr: [1, 2], fc: 9 }, { lngs: ["ga"], nr: [1, 2, 3, 7, 11], fc: 10 }, { lngs: ["gd"], nr: [1, 2, 3, 20], fc: 11 }, { lngs: ["is"], nr: [1, 2], fc: 12 }, { lngs: ["jv"], nr: [0, 1], fc: 13 }, { lngs: ["kw"], nr: [1, 2, 3, 4], fc: 14 }, { lngs: ["lt"], nr: [1, 2, 10], fc: 15 }, { lngs: ["lv"], nr: [1, 2, 0], fc: 16 }, { lngs: ["mk"], nr: [1, 2], fc: 17 }, { lngs: ["mnk"], nr: [0, 1, 2], fc: 18 }, { lngs: ["mt"], nr: [1, 2, 11, 20], fc: 19 }, { lngs: ["or"], nr: [2, 1], fc: 2 }, { lngs: ["ro"], nr: [1, 2, 20], fc: 20 }, { lngs: ["sl"], nr: [5, 1, 2, 3], fc: 21 }, { lngs: ["he", "iw"], nr: [1, 2, 20, 21], fc: 22 }]; var _rulesPluralsTypes = { 1: function _(n2) { return Number(n2 > 1); }, 2: function _2(n2) { return Number(n2 != 1); }, 3: function _3(n2) { return 0; }, 4: function _4(n2) { return Number(n2 % 10 == 1 && n2 % 100 != 11 ? 0 : n2 % 10 >= 2 && n2 % 10 <= 4 && (n2 % 100 < 10 || n2 % 100 >= 20) ? 1 : 2); }, 5: function _5(n2) { return Number(n2 == 0 ? 0 : n2 == 1 ? 1 : n2 == 2 ? 2 : n2 % 100 >= 3 && n2 % 100 <= 10 ? 3 : n2 % 100 >= 11 ? 4 : 5); }, 6: function _6(n2) { return Number(n2 == 1 ? 0 : n2 >= 2 && n2 <= 4 ? 1 : 2); }, 7: function _7(n2) { return Number(n2 == 1 ? 0 : n2 % 10 >= 2 && n2 % 10 <= 4 && (n2 % 100 < 10 || n2 % 100 >= 20) ? 1 : 2); }, 8: function _8(n2) { return Number(n2 == 1 ? 0 : n2 == 2 ? 1 : n2 != 8 && n2 != 11 ? 2 : 3); }, 9: function _9(n2) { return Number(n2 >= 2); }, 10: function _10(n2) { return Number(n2 == 1 ? 0 : n2 == 2 ? 1 : n2 < 7 ? 2 : n2 < 11 ? 3 : 4); }, 11: function _11(n2) { return Number(n2 == 1 || n2 == 11 ? 0 : n2 == 2 || n2 == 12 ? 1 : n2 > 2 && n2 < 20 ? 2 : 3); }, 12: function _12(n2) { return Number(n2 % 10 != 1 || n2 % 100 == 11); }, 13: function _13(n2) { return Number(n2 !== 0); }, 14: function _14(n2) { return Number(n2 == 1 ? 0 : n2 == 2 ? 1 : n2 == 3 ? 2 : 3); }, 15: function _15(n2) { return Number(n2 % 10 == 1 && n2 % 100 != 11 ? 0 : n2 % 10 >= 2 && (n2 % 100 < 10 || n2 % 100 >= 20) ? 1 : 2); }, 16: function _16(n2) { return Number(n2 % 10 == 1 && n2 % 100 != 11 ? 0 : n2 !== 0 ? 1 : 2); }, 17: function _17(n2) { return Number(n2 == 1 || n2 % 10 == 1 && n2 % 100 != 11 ? 0 : 1); }, 18: function _18(n2) { return Number(n2 == 0 ? 0 : n2 == 1 ? 1 : 2); }, 19: function _19(n2) { return Number(n2 == 1 ? 0 : n2 == 0 || n2 % 100 > 1 && n2 % 100 < 11 ? 1 : n2 % 100 > 10 && n2 % 100 < 20 ? 2 : 3); }, 20: function _20(n2) { return Number(n2 == 1 ? 0 : n2 == 0 || n2 % 100 > 0 && n2 % 100 < 20 ? 1 : 2); }, 21: function _21(n2) { return Number(n2 % 100 == 1 ? 1 : n2 % 100 == 2 ? 2 : n2 % 100 == 3 || n2 % 100 == 4 ? 3 : 0); }, 22: function _22(n2) { return Number(n2 == 1 ? 0 : n2 == 2 ? 1 : (n2 < 0 || n2 > 10) && n2 % 10 == 0 ? 2 : 3); } }; var deprecatedJsonVersions = ["v1", "v2", "v3"]; var suffixesOrder = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }; function createRules() { var rules = {}; sets.forEach(function(set) { set.lngs.forEach(function(l2) { rules[l2] = { numbers: set.nr, plurals: _rulesPluralsTypes[set.fc] }; }); }); return rules; } var PluralResolver = function() { function PluralResolver2(languageUtils) { var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; _classCallCheck(this, PluralResolver2); this.languageUtils = languageUtils; this.options = options; this.logger = baseLogger.create("pluralResolver"); if ((!this.options.compatibilityJSON || this.options.compatibilityJSON === "v4") && (typeof Intl === "undefined" || !Intl.PluralRules)) { this.options.compatibilityJSON = "v3"; this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling."); } this.rules = createRules(); } _createClass(PluralResolver2, [{ key: "addRule", value: function addRule(lng, obj) { this.rules[lng] = obj; } }, { key: "getRule", value: function getRule(code2) { var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (this.shouldUseIntlApi()) { try { return new Intl.PluralRules(code2, { type: options.ordinal ? "ordinal" : "cardinal" }); } catch (_unused) { return; } } return this.rules[code2] || this.rules[this.languageUtils.getLanguagePartFromCode(code2)]; } }, { key: "needsPlural", value: function needsPlural(code2) { var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var rule = this.getRule(code2, options); if (this.shouldUseIntlApi()) { return rule && rule.resolvedOptions().pluralCategories.length > 1; } return rule && rule.numbers.length > 1; } }, { key: "getPluralFormsOfKey", value: function getPluralFormsOfKey(code2, key2) { var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; return this.getSuffixes(code2, options).map(function(suffix) { return "".concat(key2).concat(suffix); }); } }, { key: "getSuffixes", value: function getSuffixes(code2) { var _this = this; var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var rule = this.getRule(code2, options); if (!rule) { return []; } if (this.shouldUseIntlApi()) { return rule.resolvedOptions().pluralCategories.sort(function(pluralCategory1, pluralCategory2) { return suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]; }).map(function(pluralCategory) { return "".concat(_this.options.prepend).concat(pluralCategory); }); } return rule.numbers.map(function(number2) { return _this.getSuffix(code2, number2, options); }); } }, { key: "getSuffix", value: function getSuffix(code2, count) { var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; var rule = this.getRule(code2, options); if (rule) { if (this.shouldUseIntlApi()) { return "".concat(this.options.prepend).concat(rule.select(count)); } return this.getSuffixRetroCompatible(rule, count); } this.logger.warn("no plural rule found for: ".concat(code2)); return ""; } }, { key: "getSuffixRetroCompatible", value: function getSuffixRetroCompatible(rule, count) { var _this2 = this; var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count)); var suffix = rule.numbers[idx]; if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) { if (suffix === 2) { suffix = "plural"; } else if (suffix === 1) { suffix = ""; } } var returnSuffix = function returnSuffix2() { return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString(); }; if (this.options.compatibilityJSON === "v1") { if (suffix === 1) return ""; if (typeof suffix === "number") return "_plural_".concat(suffix.toString()); return returnSuffix(); } else if (this.options.compatibilityJSON === "v2") { return returnSuffix(); } else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) { return returnSuffix(); } return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString(); } }, { key: "shouldUseIntlApi", value: function shouldUseIntlApi() { return !deprecatedJsonVersions.includes(this.options.compatibilityJSON); } }]); return PluralResolver2; }(); function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$3(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source = null != arguments[i2] ? arguments[i2] : {}; i2 % 2 ? ownKeys$3(Object(source), true).forEach(function(key2) { _defineProperty(target, key2, source[key2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); }); } return target; } function deepFindWithDefaults(data, defaultData, key2) { var keySeparator = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "."; var ignoreJSONStructure = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true; var path2 = getPathWithDefaults(data, defaultData, key2); if (!path2 && ignoreJSONStructure && typeof key2 === "string") { path2 = deepFind(data, key2, keySeparator); if (path2 === void 0) path2 = deepFind(defaultData, key2, keySeparator); } return path2; } var Interpolator = function() { function Interpolator2() { var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; _classCallCheck(this, Interpolator2); this.logger = baseLogger.create("interpolator"); this.options = options; this.format = options.interpolation && options.interpolation.format || function(value) { return value; }; this.init(options); } _createClass(Interpolator2, [{ key: "init", value: function init2() { var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; if (!options.interpolation) options.interpolation = { escapeValue: true }; var iOpts = options.interpolation; this.escape = iOpts.escape !== void 0 ? iOpts.escape : escape; this.escapeValue = iOpts.escapeValue !== void 0 ? iOpts.escapeValue : true; this.useRawValueToEscape = iOpts.useRawValueToEscape !== void 0 ? iOpts.useRawValueToEscape : false; this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || "{{"; this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || "}}"; this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ","; this.unescapePrefix = iOpts.unescapeSuffix ? "" : iOpts.unescapePrefix || "-"; this.unescapeSuffix = this.unescapePrefix ? "" : iOpts.unescapeSuffix || ""; this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape("$t("); this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(")"); this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ","; this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1e3; this.alwaysFormat = iOpts.alwaysFormat !== void 0 ? iOpts.alwaysFormat : false; this.resetRegExp(); } }, { key: "reset", value: function reset() { if (this.options) this.init(this.options); } }, { key: "resetRegExp", value: function resetRegExp() { var regexpStr = "".concat(this.prefix, "(.+?)").concat(this.suffix); this.regexp = new RegExp(regexpStr, "g"); var regexpUnescapeStr = "".concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix); this.regexpUnescape = new RegExp(regexpUnescapeStr, "g"); var nestingRegexpStr = "".concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix); this.nestingRegexp = new RegExp(nestingRegexpStr, "g"); } }, { key: "interpolate", value: function interpolate(str, data, lng, options) { var _this = this; var match; var value; var replaces; var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}; function regexSafe(val) { return val.replace(/\$/g, "$$$$"); } var handleFormat = function handleFormat2(key2) { if (key2.indexOf(_this.formatSeparator) < 0) { var path2 = deepFindWithDefaults(data, defaultData, key2, _this.options.keySeparator, _this.options.ignoreJSONStructure); return _this.alwaysFormat ? _this.format(path2, void 0, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, { interpolationkey: key2 })) : path2; } var p2 = key2.split(_this.formatSeparator); var k2 = p2.shift().trim(); var f2 = p2.join(_this.formatSeparator).trim(); return _this.format(deepFindWithDefaults(data, defaultData, k2, _this.options.keySeparator, _this.options.ignoreJSONStructure), f2, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, { interpolationkey: k2 })); }; this.resetRegExp(); var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler; var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables; var todos = [{ regex: this.regexpUnescape, safeValue: function safeValue(val) { return regexSafe(val); } }, { regex: this.regexp, safeValue: function safeValue(val) { return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val); } }]; todos.forEach(function(todo) { replaces = 0; while (match = todo.regex.exec(str)) { var matchedVar = match[1].trim(); value = handleFormat(matchedVar); if (value === void 0) { if (typeof missingInterpolationHandler === "function") { var temp = missingInterpolationHandler(str, match, options); value = typeof temp === "string" ? temp : ""; } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) { value = ""; } else if (skipOnVariables) { value = match[0]; continue; } else { _this.logger.warn("missed to pass in variable ".concat(matchedVar, " for interpolating ").concat(str)); value = ""; } } else if (typeof value !== "string" && !_this.useRawValueToEscape) { value = makeString(value); } var safeValue = todo.safeValue(value); str = str.replace(match[0], safeValue); if (skipOnVariables) { todo.regex.lastIndex += value.length; todo.regex.lastIndex -= match[0].length; } else { todo.regex.lastIndex = 0; } replaces++; if (replaces >= _this.maxReplaces) { break; } } }); return str; } }, { key: "nest", value: function nest(str, fc) { var _this2 = this; var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; var match; var value; var clonedOptions; function handleHasOptions(key2, inheritedOptions) { var sep = this.nestingOptionsSeparator; if (key2.indexOf(sep) < 0) return key2; var c2 = key2.split(new RegExp("".concat(sep, "[ ]*{"))); var optionsString = "{".concat(c2[1]); key2 = c2[0]; optionsString = this.interpolate(optionsString, clonedOptions); var matchedSingleQuotes = optionsString.match(/'/g); var matchedDoubleQuotes = optionsString.match(/"/g); if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) { optionsString = optionsString.replace(/'/g, '"'); } try { clonedOptions = JSON.parse(optionsString); if (inheritedOptions) clonedOptions = _objectSpread$3(_objectSpread$3({}, inheritedOptions), clonedOptions); } catch (e2) { this.logger.warn("failed parsing options string in nesting for key ".concat(key2), e2); return "".concat(key2).concat(sep).concat(optionsString); } delete clonedOptions.defaultValue; return key2; } while (match = this.nestingRegexp.exec(str)) { var formatters = []; clonedOptions = _objectSpread$3({}, options); clonedOptions = clonedOptions.replace && typeof clonedOptions.replace !== "string" ? clonedOptions.replace : clonedOptions; clonedOptions.applyPostProcessor = false; delete clonedOptions.defaultValue; var doReduce = false; if (match[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match[1])) { var r2 = match[1].split(this.formatSeparator).map(function(elem) { return elem.trim(); }); match[1] = r2.shift(); formatters = r2; doReduce = true; } value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions); if (value && match[0] === str && typeof value !== "string") return value; if (typeof value !== "string") value = makeString(value); if (!value) { this.logger.warn("missed to resolve ".concat(match[1], " for nesting ").concat(str)); value = ""; } if (doReduce) { value = formatters.reduce(function(v2, f2) { return _this2.format(v2, f2, options.lng, _objectSpread$3(_objectSpread$3({}, options), {}, { interpolationkey: match[1].trim() })); }, value.trim()); } str = str.replace(match[0], value); this.regexp.lastIndex = 0; } return str; } }]); return Interpolator2; }(); function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$2(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source = null != arguments[i2] ? arguments[i2] : {}; i2 % 2 ? ownKeys$2(Object(source), true).forEach(function(key2) { _defineProperty(target, key2, source[key2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); }); } return target; } function parseFormatStr(formatStr) { var formatName = formatStr.toLowerCase().trim(); var formatOptions = {}; if (formatStr.indexOf("(") > -1) { var p2 = formatStr.split("("); formatName = p2[0].toLowerCase().trim(); var optStr = p2[1].substring(0, p2[1].length - 1); if (formatName === "currency" && optStr.indexOf(":") < 0) { if (!formatOptions.currency) formatOptions.currency = optStr.trim(); } else if (formatName === "relativetime" && optStr.indexOf(":") < 0) { if (!formatOptions.range) formatOptions.range = optStr.trim(); } else { var opts = optStr.split(";"); opts.forEach(function(opt) { if (!opt) return; var _opt$split = opt.split(":"), _opt$split2 = _toArray(_opt$split), key2 = _opt$split2[0], rest = _opt$split2.slice(1); var val = rest.join(":").trim().replace(/^'+|'+$/g, ""); if (!formatOptions[key2.trim()]) formatOptions[key2.trim()] = val; if (val === "false") formatOptions[key2.trim()] = false; if (val === "true") formatOptions[key2.trim()] = true; if (!isNaN(val)) formatOptions[key2.trim()] = parseInt(val, 10); }); } } return { formatName, formatOptions }; } function createCachedFormatter(fn2) { var cache = {}; return function invokeFormatter(val, lng, options) { var key2 = lng + JSON.stringify(options); var formatter = cache[key2]; if (!formatter) { formatter = fn2(lng, options); cache[key2] = formatter; } return formatter(val); }; } var Formatter = function() { function Formatter2() { var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; _classCallCheck(this, Formatter2); this.logger = baseLogger.create("formatter"); this.options = options; this.formats = { number: createCachedFormatter(function(lng, opt) { var formatter = new Intl.NumberFormat(lng, _objectSpread$2({}, opt)); return function(val) { return formatter.format(val); }; }), currency: createCachedFormatter(function(lng, opt) { var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, opt), {}, { style: "currency" })); return function(val) { return formatter.format(val); }; }), datetime: createCachedFormatter(function(lng, opt) { var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, opt)); return function(val) { return formatter.format(val); }; }), relativetime: createCachedFormatter(function(lng, opt) { var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, opt)); return function(val) { return formatter.format(val, opt.range || "day"); }; }), list: createCachedFormatter(function(lng, opt) { var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, opt)); return function(val) { return formatter.format(val); }; }) }; this.init(options); } _createClass(Formatter2, [{ key: "init", value: function init2(services) { var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { interpolation: {} }; var iOpts = options.interpolation; this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ","; } }, { key: "add", value: function add(name, fc) { this.formats[name.toLowerCase().trim()] = fc; } }, { key: "addCached", value: function addCached(name, fc) { this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc); } }, { key: "format", value: function format(value, _format, lng) { var _this = this; var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; var formats = _format.split(this.formatSeparator); var result = formats.reduce(function(mem, f2) { var _parseFormatStr = parseFormatStr(f2), formatName = _parseFormatStr.formatName, formatOptions = _parseFormatStr.formatOptions; if (_this.formats[formatName]) { var formatted = mem; try { var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {}; var l2 = valOptions.locale || valOptions.lng || options.locale || options.lng || lng; formatted = _this.formats[formatName](mem, l2, _objectSpread$2(_objectSpread$2(_objectSpread$2({}, formatOptions), options), valOptions)); } catch (error2) { _this.logger.warn(error2); } return formatted; } else { _this.logger.warn("there was no format function for ".concat(formatName)); } return mem; }, value); return result; } }]); return Formatter2; }(); function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$1(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source = null != arguments[i2] ? arguments[i2] : {}; i2 % 2 ? ownKeys$1(Object(source), true).forEach(function(key2) { _defineProperty(target, key2, source[key2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); }); } return target; } function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _isNativeReflectConstruct$1() { 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 removePending(q2, name) { if (q2.pending[name] !== void 0) { delete q2.pending[name]; q2.pendingCount--; } } var Connector = function(_EventEmitter) { _inherits(Connector2, _EventEmitter); var _super = _createSuper$1(Connector2); function Connector2(backend, store, services) { var _this; var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; _classCallCheck(this, Connector2); _this = _super.call(this); if (isIE10) { EventEmitter$1.call(_assertThisInitialized(_this)); } _this.backend = backend; _this.store = store; _this.services = services; _this.languageUtils = services.languageUtils; _this.options = options; _this.logger = baseLogger.create("backendConnector"); _this.waitingReads = []; _this.maxParallelReads = options.maxParallelReads || 10; _this.readingCalls = 0; _this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5; _this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350; _this.state = {}; _this.queue = []; if (_this.backend && _this.backend.init) { _this.backend.init(services, options.backend, options); } return _this; } _createClass(Connector2, [{ key: "queueLoad", value: function queueLoad(languages, namespaces, options, callback) { var _this2 = this; var toLoad = {}; var pending = {}; var toLoadLanguages = {}; var toLoadNamespaces = {}; languages.forEach(function(lng) { var hasAllNamespaces = true; namespaces.forEach(function(ns) { var name = "".concat(lng, "|").concat(ns); if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) { _this2.state[name] = 2; } else if (_this2.state[name] < 0) ; else if (_this2.state[name] === 1) { if (pending[name] === void 0) pending[name] = true; } else { _this2.state[name] = 1; hasAllNamespaces = false; if (pending[name] === void 0) pending[name] = true; if (toLoad[name] === void 0) toLoad[name] = true; if (toLoadNamespaces[ns] === void 0) toLoadNamespaces[ns] = true; } }); if (!hasAllNamespaces) toLoadLanguages[lng] = true; }); if (Object.keys(toLoad).length || Object.keys(pending).length) { this.queue.push({ pending, pendingCount: Object.keys(pending).length, loaded: {}, errors: [], callback }); } return { toLoad: Object.keys(toLoad), pending: Object.keys(pending), toLoadLanguages: Object.keys(toLoadLanguages), toLoadNamespaces: Object.keys(toLoadNamespaces) }; } }, { key: "loaded", value: function loaded(name, err, data) { var s2 = name.split("|"); var lng = s2[0]; var ns = s2[1]; if (err) this.emit("failedLoading", lng, ns, err); if (data) { this.store.addResourceBundle(lng, ns, data); } this.state[name] = err ? -1 : 2; var loaded2 = {}; this.queue.forEach(function(q2) { pushPath(q2.loaded, [lng], ns); removePending(q2, name); if (err) q2.errors.push(err); if (q2.pendingCount === 0 && !q2.done) { Object.keys(q2.loaded).forEach(function(l2) { if (!loaded2[l2]) loaded2[l2] = {}; var loadedKeys = q2.loaded[l2]; if (loadedKeys.length) { loadedKeys.forEach(function(n2) { if (loaded2[l2][n2] === void 0) loaded2[l2][n2] = true; }); } }); q2.done = true; if (q2.errors.length) { q2.callback(q2.errors); } else { q2.callback(); } } }); this.emit("loaded", loaded2); this.queue = this.queue.filter(function(q2) { return !q2.done; }); } }, { key: "read", value: function read(lng, ns, fcName) { var _this3 = this; var tried = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0; var wait = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout; var callback = arguments.length > 5 ? arguments[5] : void 0; if (!lng.length) return callback(null, {}); if (this.readingCalls >= this.maxParallelReads) { this.waitingReads.push({ lng, ns, fcName, tried, wait, callback }); return; } this.readingCalls++; var resolver2 = function resolver3(err, data) { _this3.readingCalls--; if (_this3.waitingReads.length > 0) { var next = _this3.waitingReads.shift(); _this3.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback); } if (err && data && tried < _this3.maxRetries) { setTimeout(function() { _this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback); }, wait); return; } callback(err, data); }; var fc = this.backend[fcName].bind(this.backend); if (fc.length === 2) { try { var r2 = fc(lng, ns); if (r2 && typeof r2.then === "function") { r2.then(function(data) { return resolver2(null, data); })["catch"](resolver2); } else { resolver2(null, r2); } } catch (err) { resolver2(err); } return; } return fc(lng, ns, resolver2); } }, { key: "prepareLoading", value: function prepareLoading(languages, namespaces) { var _this4 = this; var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; var callback = arguments.length > 3 ? arguments[3] : void 0; if (!this.backend) { this.logger.warn("No backend was added via i18next.use. Will not load resources."); return callback && callback(); } if (typeof languages === "string") languages = this.languageUtils.toResolveHierarchy(languages); if (typeof namespaces === "string") namespaces = [namespaces]; var toLoad = this.queueLoad(languages, namespaces, options, callback); if (!toLoad.toLoad.length) { if (!toLoad.pending.length) callback(); return null; } toLoad.toLoad.forEach(function(name) { _this4.loadOne(name); }); } }, { key: "load", value: function load(languages, namespaces, callback) { this.prepareLoading(languages, namespaces, {}, callback); } }, { key: "reload", value: function reload(languages, namespaces, callback) { this.prepareLoading(languages, namespaces, { reload: true }, callback); } }, { key: "loadOne", value: function loadOne(name) { var _this5 = this; var prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; var s2 = name.split("|"); var lng = s2[0]; var ns = s2[1]; this.read(lng, ns, "read", void 0, void 0, function(err, data) { if (err) _this5.logger.warn("".concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err); if (!err && data) _this5.logger.log("".concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data); _this5.loaded(name, err, data); }); } }, { key: "saveMissing", value: function saveMissing(languages, namespace, key2, fallbackValue, isUpdate) { var options = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}; var clb = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : function() { }; if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) { this.logger.warn('did not save key "'.concat(key2, '" as the namespace "').concat(namespace, '" was not yet loaded'), "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"); return; } if (key2 === void 0 || key2 === null || key2 === "") return; if (this.backend && this.backend.create) { var opts = _objectSpread$1(_objectSpread$1({}, options), {}, { isUpdate }); var fc = this.backend.create.bind(this.backend); if (fc.length < 6) { try { var r2; if (fc.length === 5) { r2 = fc(languages, namespace, key2, fallbackValue, opts); } else { r2 = fc(languages, namespace, key2, fallbackValue); } if (r2 && typeof r2.then === "function") { r2.then(function(data) { return clb(null, data); })["catch"](clb); } else { clb(null, r2); } } catch (err) { clb(err); } } else { fc(languages, namespace, key2, fallbackValue, clb, opts); } } if (!languages || !languages[0]) return; this.store.addResource(languages[0], namespace, key2, fallbackValue); } }]); return Connector2; }(EventEmitter$1); function get() { return { debug: false, initImmediate: true, ns: ["translation"], defaultNS: ["translation"], fallbackLng: ["dev"], fallbackNS: false, supportedLngs: false, nonExplicitSupportedLngs: false, load: "all", preload: false, simplifyPluralSuffix: true, keySeparator: ".", nsSeparator: ":", pluralSeparator: "_", contextSeparator: "_", partialBundledLanguages: false, saveMissing: false, updateMissing: false, saveMissingTo: "fallback", saveMissingPlurals: true, missingKeyHandler: false, missingInterpolationHandler: false, postProcess: false, postProcessPassResolved: false, returnNull: true, returnEmptyString: true, returnObjects: false, joinArrays: false, returnedObjectHandler: false, parseMissingKeyHandler: false, appendNamespaceToMissingKey: false, appendNamespaceToCIMode: false, overloadTranslationOptionHandler: function handle3(args) { var ret = {}; if (_typeof(args[1]) === "object") ret = args[1]; if (typeof args[1] === "string") ret.defaultValue = args[1]; if (typeof args[2] === "string") ret.tDescription = args[2]; if (_typeof(args[2]) === "object" || _typeof(args[3]) === "object") { var options = args[3] || args[2]; Object.keys(options).forEach(function(key2) { ret[key2] = options[key2]; }); } return ret; }, interpolation: { escapeValue: true, format: function format(value, _format, lng, options) { return value; }, prefix: "{{", suffix: "}}", formatSeparator: ",", unescapePrefix: "-", nestingPrefix: "$t(", nestingSuffix: ")", nestingOptionsSeparator: ",", maxReplaces: 1e3, skipOnVariables: true } }; } function transformOptions(options) { if (typeof options.ns === "string") options.ns = [options.ns]; if (typeof options.fallbackLng === "string") options.fallbackLng = [options.fallbackLng]; if (typeof options.fallbackNS === "string") options.fallbackNS = [options.fallbackNS]; if (options.supportedLngs && options.supportedLngs.indexOf("cimode") < 0) { options.supportedLngs = options.supportedLngs.concat(["cimode"]); } return options; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source = null != arguments[i2] ? arguments[i2] : {}; i2 % 2 ? ownKeys(Object(source), true).forEach(function(key2) { _defineProperty(target, key2, source[key2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); }); } return target; } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 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 noop$1() { } function bindMemberFunctions(inst) { var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst)); mems.forEach(function(mem) { if (typeof inst[mem] === "function") { inst[mem] = inst[mem].bind(inst); } }); } var I18n = function(_EventEmitter) { _inherits(I18n2, _EventEmitter); var _super = _createSuper(I18n2); function I18n2() { var _this; var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var callback = arguments.length > 1 ? arguments[1] : void 0; _classCallCheck(this, I18n2); _this = _super.call(this); if (isIE10) { EventEmitter$1.call(_assertThisInitialized(_this)); } _this.options = transformOptions(options); _this.services = {}; _this.logger = baseLogger; _this.modules = { external: [] }; bindMemberFunctions(_assertThisInitialized(_this)); if (callback && !_this.isInitialized && !options.isClone) { if (!_this.options.initImmediate) { _this.init(options, callback); return _possibleConstructorReturn(_this, _assertThisInitialized(_this)); } setTimeout(function() { _this.init(options, callback); }, 0); } return _this; } _createClass(I18n2, [{ key: "init", value: function init2() { var _this2 = this; var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var callback = arguments.length > 1 ? arguments[1] : void 0; if (typeof options === "function") { callback = options; options = {}; } if (!options.defaultNS && options.defaultNS !== false && options.ns) { if (typeof options.ns === "string") { options.defaultNS = options.ns; } else if (options.ns.indexOf("translation") < 0) { options.defaultNS = options.ns[0]; } } var defOpts = get(); this.options = _objectSpread(_objectSpread(_objectSpread({}, defOpts), this.options), transformOptions(options)); if (this.options.compatibilityAPI !== "v1") { this.options.interpolation = _objectSpread(_objectSpread({}, defOpts.interpolation), this.options.interpolation); } if (options.keySeparator !== void 0) { this.options.userDefinedKeySeparator = options.keySeparator; } if (options.nsSeparator !== void 0) { this.options.userDefinedNsSeparator = options.nsSeparator; } function createClassOnDemand(ClassOrObject) { if (!ClassOrObject) return null; if (typeof ClassOrObject === "function") return new ClassOrObject(); return ClassOrObject; } if (!this.options.isClone) { if (this.modules.logger) { baseLogger.init(createClassOnDemand(this.modules.logger), this.options); } else { baseLogger.init(null, this.options); } var formatter; if (this.modules.formatter) { formatter = this.modules.formatter; } else if (typeof Intl !== "undefined") { formatter = Formatter; } var lu = new LanguageUtil(this.options); this.store = new ResourceStore(this.options.resources, this.options); var s2 = this.services; s2.logger = baseLogger; s2.resourceStore = this.store; s2.languageUtils = lu; s2.pluralResolver = new PluralResolver(lu, { prepend: this.options.pluralSeparator, compatibilityJSON: this.options.compatibilityJSON, simplifyPluralSuffix: this.options.simplifyPluralSuffix }); if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) { s2.formatter = createClassOnDemand(formatter); s2.formatter.init(s2, this.options); this.options.interpolation.format = s2.formatter.format.bind(s2.formatter); } s2.interpolator = new Interpolator(this.options); s2.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }; s2.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s2.resourceStore, s2, this.options); s2.backendConnector.on("*", function(event) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } _this2.emit.apply(_this2, [event].concat(args)); }); if (this.modules.languageDetector) { s2.languageDetector = createClassOnDemand(this.modules.languageDetector); if (s2.languageDetector.init) s2.languageDetector.init(s2, this.options.detection, this.options); } if (this.modules.i18nFormat) { s2.i18nFormat = createClassOnDemand(this.modules.i18nFormat); if (s2.i18nFormat.init) s2.i18nFormat.init(this); } this.translator = new Translator(this.services, this.options); this.translator.on("*", function(event) { for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } _this2.emit.apply(_this2, [event].concat(args)); }); this.modules.external.forEach(function(m2) { if (m2.init) m2.init(_this2); }); } this.format = this.options.interpolation.format; if (!callback) callback = noop$1; if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) { var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng); if (codes.length > 0 && codes[0] !== "dev") this.options.lng = codes[0]; } if (!this.services.languageDetector && !this.options.lng) { this.logger.warn("init: no languageDetector is used and no lng is defined"); } var storeApi = ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"]; storeApi.forEach(function(fcName) { _this2[fcName] = function() { var _this2$store; return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments); }; }); var storeApiChained = ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"]; storeApiChained.forEach(function(fcName) { _this2[fcName] = function() { var _this2$store2; (_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments); return _this2; }; }); var deferred = defer(); var load = function load2() { var finish = function finish2(err, t2) { if (_this2.isInitialized && !_this2.initializedStoreOnce) _this2.logger.warn("init: i18next is already initialized. You should call init just once!"); _this2.isInitialized = true; if (!_this2.options.isClone) _this2.logger.log("initialized", _this2.options); _this2.emit("initialized", _this2.options); deferred.resolve(t2); callback(err, t2); }; if (_this2.languages && _this2.options.compatibilityAPI !== "v1" && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2)); _this2.changeLanguage(_this2.options.lng, finish); }; if (this.options.resources || !this.options.initImmediate) { load(); } else { setTimeout(load, 0); } return deferred; } }, { key: "loadResources", value: function loadResources(language) { var _this3 = this; var callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$1; var usedCallback = callback; var usedLng = typeof language === "string" ? language : this.language; if (typeof language === "function") usedCallback = language; if (!this.options.resources || this.options.partialBundledLanguages) { if (usedLng && usedLng.toLowerCase() === "cimode") return usedCallback(); var toLoad = []; var append = function append2(lng) { if (!lng) return; var lngs = _this3.services.languageUtils.toResolveHierarchy(lng); lngs.forEach(function(l2) { if (toLoad.indexOf(l2) < 0) toLoad.push(l2); }); }; if (!usedLng) { var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng); fallbacks.forEach(function(l2) { return append(l2); }); } else { append(usedLng); } if (this.options.preload) { this.options.preload.forEach(function(l2) { return append(l2); }); } this.services.backendConnector.load(toLoad, this.options.ns, function(e2) { if (!e2 && !_this3.resolvedLanguage && _this3.language) _this3.setResolvedLanguage(_this3.language); usedCallback(e2); }); } else { usedCallback(null); } } }, { key: "reloadResources", value: function reloadResources(lngs, ns, callback) { var deferred = defer(); if (!lngs) lngs = this.languages; if (!ns) ns = this.options.ns; if (!callback) callback = noop$1; this.services.backendConnector.reload(lngs, ns, function(err) { deferred.resolve(); callback(err); }); return deferred; } }, { key: "use", value: function use(module) { if (!module) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()"); if (!module.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()"); if (module.type === "backend") { this.modules.backend = module; } if (module.type === "logger" || module.log && module.warn && module.error) { this.modules.logger = module; } if (module.type === "languageDetector") { this.modules.languageDetector = module; } if (module.type === "i18nFormat") { this.modules.i18nFormat = module; } if (module.type === "postProcessor") { postProcessor.addPostProcessor(module); } if (module.type === "formatter") { this.modules.formatter = module; } if (module.type === "3rdParty") { this.modules.external.push(module); } return this; } }, { key: "setResolvedLanguage", value: function setResolvedLanguage(l2) { if (!l2 || !this.languages) return; if (["cimode", "dev"].indexOf(l2) > -1) return; for (var li2 = 0; li2 < this.languages.length; li2++) { var lngInLngs = this.languages[li2]; if (["cimode", "dev"].indexOf(lngInLngs) > -1) continue; if (this.store.hasLanguageSomeTranslations(lngInLngs)) { this.resolvedLanguage = lngInLngs; break; } } } }, { key: "changeLanguage", value: function changeLanguage(lng, callback) { var _this4 = this; this.isLanguageChangingTo = lng; var deferred = defer(); this.emit("languageChanging", lng); var setLngProps = function setLngProps2(l2) { _this4.language = l2; _this4.languages = _this4.services.languageUtils.toResolveHierarchy(l2); _this4.resolvedLanguage = void 0; _this4.setResolvedLanguage(l2); }; var done = function done2(err, l2) { if (l2) { setLngProps(l2); _this4.translator.changeLanguage(l2); _this4.isLanguageChangingTo = void 0; _this4.emit("languageChanged", l2); _this4.logger.log("languageChanged", l2); } else { _this4.isLanguageChangingTo = void 0; } deferred.resolve(function() { return _this4.t.apply(_this4, arguments); }); if (callback) callback(err, function() { return _this4.t.apply(_this4, arguments); }); }; var setLng = function setLng2(lngs) { if (!lng && !lngs && _this4.services.languageDetector) lngs = []; var l2 = typeof lngs === "string" ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs); if (l2) { if (!_this4.language) { setLngProps(l2); } if (!_this4.translator.language) _this4.translator.changeLanguage(l2); if (_this4.services.languageDetector && _this4.services.languageDetector.cacheUserLanguage) _this4.services.languageDetector.cacheUserLanguage(l2); } _this4.loadResources(l2, function(err) { done(err, l2); }); }; if (!lng && this.services.languageDetector && !this.services.languageDetector.async) { setLng(this.services.languageDetector.detect()); } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) { if (this.services.languageDetector.detect.length === 0) { this.services.languageDetector.detect().then(setLng); } else { this.services.languageDetector.detect(setLng); } } else { setLng(lng); } return deferred; } }, { key: "getFixedT", value: function getFixedT(lng, ns, keyPrefix) { var _this5 = this; var fixedT = function fixedT2(key2, opts) { var options; if (_typeof(opts) !== "object") { for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { rest[_key3 - 2] = arguments[_key3]; } options = _this5.options.overloadTranslationOptionHandler([key2, opts].concat(rest)); } else { options = _objectSpread({}, opts); } options.lng = options.lng || fixedT2.lng; options.lngs = options.lngs || fixedT2.lngs; options.ns = options.ns || fixedT2.ns; options.keyPrefix = options.keyPrefix || keyPrefix || fixedT2.keyPrefix; var keySeparator = _this5.options.keySeparator || "."; var resultKey; if (options.keyPrefix && Array.isArray(key2)) { resultKey = key2.map(function(k2) { return "".concat(options.keyPrefix).concat(keySeparator).concat(k2); }); } else { resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key2) : key2; } return _this5.t(resultKey, options); }; if (typeof lng === "string") { fixedT.lng = lng; } else { fixedT.lngs = lng; } fixedT.ns = ns; fixedT.keyPrefix = keyPrefix; return fixedT; } }, { key: "t", value: function t2() { var _this$translator; return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments); } }, { key: "exists", value: function exists() { var _this$translator2; return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments); } }, { key: "setDefaultNamespace", value: function setDefaultNamespace(ns) { this.options.defaultNS = ns; } }, { key: "hasLoadedNamespace", value: function hasLoadedNamespace2(ns) { var _this6 = this; var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (!this.isInitialized) { this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages); return false; } if (!this.languages || !this.languages.length) { this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages); return false; } var lng = options.lng || this.resolvedLanguage || this.languages[0]; var fallbackLng = this.options ? this.options.fallbackLng : false; var lastLng = this.languages[this.languages.length - 1]; if (lng.toLowerCase() === "cimode") return true; var loadNotPending = function loadNotPending2(l2, n2) { var loadState = _this6.services.backendConnector.state["".concat(l2, "|").concat(n2)]; return loadState === -1 || loadState === 2; }; if (options.precheck) { var preResult = options.precheck(this, loadNotPending); if (preResult !== void 0) return preResult; } if (this.hasResourceBundle(lng, ns)) return true; if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true; if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true; return false; } }, { key: "loadNamespaces", value: function loadNamespaces2(ns, callback) { var _this7 = this; var deferred = defer(); if (!this.options.ns) { if (callback) callback(); return Promise.resolve(); } if (typeof ns === "string") ns = [ns]; ns.forEach(function(n2) { if (_this7.options.ns.indexOf(n2) < 0) _this7.options.ns.push(n2); }); this.loadResources(function(err) { deferred.resolve(); if (callback) callback(err); }); return deferred; } }, { key: "loadLanguages", value: function loadLanguages2(lngs, callback) { var deferred = defer(); if (typeof lngs === "string") lngs = [lngs]; var preloaded = this.options.preload || []; var newLngs = lngs.filter(function(lng) { return preloaded.indexOf(lng) < 0; }); if (!newLngs.length) { if (callback) callback(); return Promise.resolve(); } this.options.preload = preloaded.concat(newLngs); this.loadResources(function(err) { deferred.resolve(); if (callback) callback(err); }); return deferred; } }, { key: "dir", value: function dir(lng) { if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language); if (!lng) return "rtl"; var rtlLngs = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"]; var languageUtils = this.services && this.services.languageUtils || new LanguageUtil(get()); return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr"; } }, { key: "cloneInstance", value: function cloneInstance() { var _this8 = this; var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$1; var mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, this.options), options), { isClone: true }); var clone = new I18n2(mergedOptions); if (options.debug !== void 0 || options.prefix !== void 0) { clone.logger = clone.logger.clone(options); } var membersToCopy = ["store", "services", "language"]; membersToCopy.forEach(function(m2) { clone[m2] = _this8[m2]; }); clone.services = _objectSpread({}, this.services); clone.services.utils = { hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone) }; clone.translator = new Translator(clone.services, clone.options); clone.translator.on("*", function(event) { for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { args[_key4 - 1] = arguments[_key4]; } clone.emit.apply(clone, [event].concat(args)); }); clone.init(mergedOptions, callback); clone.translator.options = clone.options; clone.translator.backendConnector.services.utils = { hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone) }; return clone; } }, { key: "toJSON", value: function toJSON() { return { options: this.options, store: this.store, language: this.language, languages: this.languages, resolvedLanguage: this.resolvedLanguage }; } }]); return I18n2; }(EventEmitter$1); _defineProperty(I18n, "createInstance", function() { var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var callback = arguments.length > 1 ? arguments[1] : void 0; return new I18n(options, callback); }); var instance = I18n.createInstance(); instance.createInstance = I18n.createInstance; instance.createInstance; instance.dir; instance.init; instance.loadResources; instance.reloadResources; instance.use; instance.changeLanguage; instance.getFixedT; instance.t; instance.exists; instance.setDefaultNamespace; instance.hasLoadedNamespace; instance.loadNamespaces; instance.loadLanguages; const title$6 = "ChatGPT Exporter"; const ExportHelper$6 = "Export"; const Setting$6 = "Setting"; const Language$6 = "Language"; const Screenshot$6 = "Screenshot"; const Markdown$6 = "Markdown"; const HTML$6 = "HTML"; const Archive$6 = "Archive"; const Save$6 = "Save"; const Delete$6 = "Delete"; const Export$6 = "Export"; const Loading$6 = "Loading"; const Preview$6 = "Preview"; const en_US = { title: title$6, ExportHelper: ExportHelper$6, Setting: Setting$6, Language: Language$6, "Copy Text": "Copy Text", "Copied!": "Copied!", Screenshot: Screenshot$6, Markdown: Markdown$6, HTML: HTML$6, "JSON": "JSON", Archive: Archive$6, Save: Save$6, Delete: Delete$6, "Select All": "Select All", Export: Export$6, "Error": "Error", Loading: Loading$6, Preview: Preview$6, "File Name": "File Name", "Export All": "Export All", "Exporter Settings": "Exporter Settings", "Export Dialog Title": "Export Conversations", "Invalid File Format": "Invalid File Format", "Export from official export file": "Export from official export file", "Export from API": "Export from API", "Available variables": "Available variables", "Conversation Timestamp": "Conversation Timestamp", "Conversation Timestamp Description": "Will show on the page.", "Enable on HTML": "Enable on HTML files", "Enable on Markdown": "Enable on Markdown files", "Use 24-hour format": "Use 24-hour format (eg. 23:59)", "Export Format": "Export Format", "Export Metadata": "Export Metadata", "Export Metadata Description": "Add metadata to exported Markdown and HTML files.", "OpenAI Official Format": "OpenAI Official Format", "Conversation Archive Alert": "Are you sure you want to archive all selected conversations?", "Conversation Archived Message": "All selected conversations have been archived. Please refresh the page to see the changes.", "Conversation Delete Alert": "Are you sure you want to delete all selected conversations?", "Conversation Deleted Message": "All selected conversations have been deleted. Please refresh the page to see the changes.", "Please start a conversation first": "Please start a conversation first." }; const title$5 = "ChatGPT Exporter"; const ExportHelper$5 = "Exportar"; const Setting$5 = "Ajustes"; const Language$5 = "Idioma"; const Screenshot$5 = "Captura De Pantalla"; const Markdown$5 = "Markdown"; const HTML$5 = "HTML"; const Archive$5 = "Archivo"; const Save$5 = "Guardar"; const Delete$5 = "Borrar"; const Export$5 = "Exportar"; const Loading$5 = "Cargando"; const Preview$5 = "Previsualizar"; const es = { title: title$5, ExportHelper: ExportHelper$5, Setting: Setting$5, Language: Language$5, "Copy Text": "Copiar Texto", "Copied!": "¡Copiado!", Screenshot: Screenshot$5, Markdown: Markdown$5, HTML: HTML$5, "JSON": "JSON", Archive: Archive$5, Save: Save$5, Delete: Delete$5, "Select All": "Seleccionar Todos", Export: Export$5, "Error": "Error", Loading: Loading$5, Preview: Preview$5, "File Name": "Nombre del Archivo", "Export All": "Exportar Todos", "Exporter Settings": "Ajustes De Exportación", "Export Dialog Title": "Exportar Conversaciones", "Invalid File Format": "Formato de archivo inválido", "Export from official export file": "Exportar desde archivo de exportación oficial", "Export from API": "Exportar desde API", "Available variables": "Variables Disponibles", "Conversation Timestamp": "Marca de Tiempo", "Conversation Timestamp Description": "Aparecerá en la página.", "Enable on HTML": "Habilitar en archivos HTML", "Enable on Markdown": "Habilitar en archivos Markdown", "Use 24-hour format": "Usar formato de 24 horas (ej. 23:59)", "Export Format": "Formato de Exportación", "Export Metadata": "Exportar Metadatos", "Export Metadata Description": "Añadir Metadatos a los archivos Markdown y HTML exportados.", "OpenAI Official Format": "Formato Oficial de OpenAI", "Conversation Archive Alert": "¿Estás seguro que quieres archivar todas las conversaciones seleccionadas?", "Conversation Archived Message": "Todos las conversaciones seleccionadas se han archivado. Por favor refresca la página para ver los cambios.", "Conversation Delete Alert": "¿Estás seguro que quieres borrar todas las conversaciones seleccionadas?", "Conversation Deleted Message": "Todos las conversaciones seleccionadas se han borrado. Por favor refresca la página para ver los cambios.", "Please start a conversation first": "Por favor empieza una conversación antes." }; const title$4 = "ChatGPT Exporter"; const ExportHelper$4 = "Ekspor"; const Setting$4 = "Pengaturan"; const Language$4 = "Bahasa"; const Screenshot$4 = "Tangkapan Layar"; const Markdown$4 = "Markdown"; const HTML$4 = "HTML"; const Archive$4 = "Arsip"; const Save$4 = "Simpan"; const Delete$4 = "Hapus"; const Export$4 = "Ekspor"; const Loading$4 = "Memuat"; const Preview$4 = "Pratinjau"; const id_ID = { title: title$4, ExportHelper: ExportHelper$4, Setting: Setting$4, Language: Language$4, "Copy Text": "Salin Teks", "Copied!": "Disalin!", Screenshot: Screenshot$4, Markdown: Markdown$4, HTML: HTML$4, "JSON": "JSON", Archive: Archive$4, Save: Save$4, Delete: Delete$4, "Select All": "Pilih Semua", Export: Export$4, "Error": "Kesalahan", Loading: Loading$4, Preview: Preview$4, "File Name": "Nama File", "Export All": "Ekspor Semua", "Exporter Settings": "Pengaturan Pengekspor", "Export Dialog Title": "Ekspor Percakapan", "Invalid File Format": "Format File Tidak Valid", "Export from official export file": "Ekspor dari file ekspor resmi", "Export from API": "Ekspor dari API", "Available variables": "Variabel yang Tersedia", "Conversation Timestamp": "Timestamp Percakapan", "Conversation Timestamp Description": "Akan ditampilkan pada halaman.", "Enable on HTML": "Aktifkan pada file HTML", "Enable on Markdown": "Aktifkan pada file Markdown", "Use 24-hour format": "Gunakan format 24 jam (contohnya: 23:59)", "Export Format": "Format Ekspor", "Export Metadata": "Ekspor Metada", "Export Metadata Description": "Tambahkan metadata ke file Markdown dan HTML yang diekspor.", "OpenAI Official Format": "Format Resmi OpenAI", "Conversation Archive Alert": "Apakah Anda yakin ingin mengarsipkan semua percakapan yang dipilih?", "Conversation Archived Message": "Semua percakapan yang dipilih telah diarsipkan. Harap segarkan halaman untuk melihat perubahan.", "Conversation Delete Alert": "Apakah Anda yakin ingin menghapus semua percakapan yang dipilih?", "Conversation Deleted Message": "Semua percakapan yang dipilih telah dihapus. Harap segarkan halaman untuk melihat perubahan.", "Please start a conversation first": "Harap mulai percakapan terlebih dahulu." }; const title$3 = "ChatGPTエクスポーター"; const ExportHelper$3 = "エクスポート"; const Setting$3 = "設定"; const Language$3 = "言語"; const Screenshot$3 = "スクリーンショット"; const Markdown$3 = "Markdown"; const HTML$3 = "HTML"; const Archive$3 = "アーカイブ"; const Save$3 = "保存"; const Delete$3 = "削除"; const Export$3 = "エクスポート"; const Loading$3 = "読み込み中"; const Preview$3 = "プレビュー"; const ja_JP = { title: title$3, ExportHelper: ExportHelper$3, Setting: Setting$3, Language: Language$3, "Copy Text": "テキストをコピー", "Copied!": "コピーしました!", Screenshot: Screenshot$3, Markdown: Markdown$3, HTML: HTML$3, "JSON": "JSON", Archive: Archive$3, Save: Save$3, Delete: Delete$3, "Select All": "すべて選択", Export: Export$3, "Error": "エラー", Loading: Loading$3, Preview: Preview$3, "File Name": "ファイル名", "Export All": "すべてエクスポート", "Exporter Settings": "エクスポーター設定", "Export Dialog Title": "会話をエクスポート", "Invalid File Format": "無効なファイル形式", "Export from official export file": "公式エクスポートファイルからエクスポートする", "Export from API": "APIからエクスポートする", "Available variables": "使用可能な変数", "Conversation Timestamp": "会話のタイムスタンプ", "Conversation Timestamp Description": "ページに表示されます。", "Enable on HTML": "HTML ファイルで有効にする", "Enable on Markdown": "Markdown ファイルで有効にする", "Use 24-hour format": "24時間形式を使用する (例: 23:59)", "Export Format": "エクスポートフォーマット", "Export Metadata": "メタデータをエクスポート", "Export Metadata Description": "エクスポートされたMarkdownおよびHTMLファイルにメタデータを追加します。", "OpenAI Official Format": "OpenAI公式フォーマット", "Conversation Archive Alert": "選択したすべての会話をアーカイブしてもよろしいですか?", "Conversation Archived Message": "選択したすべての会話がアーカイブされました。変更を表示するには、ページを更新してください。", "Conversation Delete Alert": "選択したすべての会話を削除してもよろしいですか?", "Conversation Deleted Message": "選択したすべての会話が削除されました。変更を表示するには、ページを更新してください。", "Please start a conversation first": "まず会話を開始してください。" }; const title$2 = "ChatGPT Exporter"; const ExportHelper$2 = "Dışa Aktar"; const Setting$2 = "Ayarlar"; const Language$2 = "Dil"; const Screenshot$2 = "Ekran Alıntısı"; const Markdown$2 = "Markdown"; const HTML$2 = "HTML"; const Archive$2 = "Arşiv"; const Save$2 = "Kaydet"; const Delete$2 = "Sil"; const Export$2 = "Dışa Aktar"; const Loading$2 = "Yükleniyor"; const Preview$2 = "Önizleme"; const tr_TR = { title: title$2, ExportHelper: ExportHelper$2, Setting: Setting$2, Language: Language$2, "Copy Text": "Metni Kopyala", "Copied!": "Kopyalandı!", Screenshot: Screenshot$2, Markdown: Markdown$2, HTML: HTML$2, "JSON": "JSON", Archive: Archive$2, Save: Save$2, Delete: Delete$2, "Select All": "Tümünü Seç", Export: Export$2, "Error": "Hata", Loading: Loading$2, Preview: Preview$2, "File Name": "Dosya Adı", "Export All": "Tümünü Dışa Aktar", "Exporter Settings": "Dışa Aktarma Ayarları", "Export Dialog Title": "Konuşmaları Dışa Aktar", "Invalid File Format": "Dosya Biçimi Geçersiz", "Export from official export file": "Resmi dışa aktarma dosyasından dışa aktar", "Export from API": "API'den dışa aktar", "Available variables": "Kullanılabilir değişkenler", "Conversation Timestamp": "Konuşma zaman bilgisi", "Conversation Timestamp Description": "Sayfada gösterilir.", "Enable on HTML": "HTML dosyalarında etkinleştir", "Enable on Markdown": "Markdown dosyalarında etkinleştir", "Use 24-hour format": "24 saat biçimini kullan (örn. 23:59)", "Export Format": "Dışa Aktarma Formatı", "Export Metadata": "Üst veriyi dışa aktar", "Export Metadata Description": "Dışa aktarılan Markdown ve HTML dosyalarına üst veri ekle", "OpenAI Official Format": "OpenAI Resmi Format", "Conversation Archive Alert": "Seçilen tüm konuşmaları arşivlemek istediğinizden emin misiniz?", "Conversation Archived Message": "Seçilen tüm konuşmalar arşivlendi. Değişiklikleri görmek için sayfayı yenileyin.", "Conversation Delete Alert": "Seçilen tüm konuşmaları silmek istediğinizden emin misiniz?", "Conversation Deleted Message": "Seçilen tüm konuşmalar silindi. Değişiklikleri görmek için sayfayı yenileyin.", "Please start a conversation first": "Lütfen önce bir konuşma başlatın." }; const title$1 = "ChatGPT Exporter"; const ExportHelper$1 = "导出助手"; const Setting$1 = "设置"; const Language$1 = "语言"; const Screenshot$1 = "截屏"; const Markdown$1 = "Markdown"; const HTML$1 = "HTML"; const Archive$1 = "归档"; const Save$1 = "保存"; const Delete$1 = "删除"; const Export$1 = "导出"; const Loading$1 = "加载中"; const Preview$1 = "预览"; const zh_Hans = { title: title$1, ExportHelper: ExportHelper$1, Setting: Setting$1, Language: Language$1, "Copy Text": "复制文字", "Copied!": "已复制!", Screenshot: Screenshot$1, Markdown: Markdown$1, HTML: HTML$1, "JSON": "JSON", Archive: Archive$1, Save: Save$1, Delete: Delete$1, "Select All": "全选", Export: Export$1, "Error": "错误", Loading: Loading$1, Preview: Preview$1, "File Name": "文件名", "Export All": "批量导出", "Exporter Settings": "导出设置", "Export Dialog Title": "导出对话", "Invalid File Format": "无效的文件格式", "Export from official export file": "从官方导出文件导出", "Export from API": "从 API 导出", "Available variables": "可用变量", "Conversation Timestamp": "对话时间戳", "Conversation Timestamp Description": "会显示在页面上。", "Enable on HTML": "在 HTML 文件上启用", "Enable on Markdown": "在 Markdown 文件上启用", "Use 24-hour format": "使用24小时制 (例如 23:59)", "Export Format": "导出格式", "Export Metadata": "导出元数据", "Export Metadata Description": "会添加至 Markdown 以及 HTML 导出。", "OpenAI Official Format": "OpenAI 官方格式", "Conversation Archive Alert": "确定要归档所有选取的对话?", "Conversation Archived Message": "所有所选的对话已归档。请刷新页面。", "Conversation Delete Alert": "确定要删除所有选取的对话?", "Conversation Deleted Message": "所有所选的对话已删除。请刷新页面。", "Please start a conversation first": "请先开始对话。" }; const title = "ChatGPT Exporter"; const ExportHelper = "Export"; const Setting = "設定"; const Language = "語言"; const Screenshot = "截圖"; const Markdown = "Markdown"; const HTML = "HTML"; const Archive = "封存"; const Save = "保存"; const Delete = "刪除"; const Export = "匯出"; const Loading = "載入中"; const Preview = "預覽"; const zh_Hant = { title, ExportHelper, Setting, Language, "Copy Text": "複製文字", "Copied!": "已複製!", Screenshot, Markdown, HTML, "JSON": "JSON", Archive, Save, Delete, "Select All": "全選", Export, "Error": "錯誤", Loading, Preview, "File Name": "檔案名稱", "Export All": "批量匯出", "Exporter Settings": "設定", "Export Dialog Title": "匯出對話", "Invalid File Format": "無效的檔案格式", "Export from official export file": "從官方匯出檔案匯出", "Export from API": "從 API 匯出", "Available variables": "可用變數", "Conversation Timestamp": "對話時間戳", "Conversation Timestamp Description": "會顯示在頁面上。", "Enable on HTML": "在 HTML 檔案上啟用", "Enable on Markdown": "在 Markdown 檔案上啟用", "Use 24-hour format": "使用24小時制 (例如 23:59)", "Export Format": "匯出格式", "Export Metadata": "匯出元資料", "Export Metadata Description": "會添加至 Markdown 以及 HTML 匯出。", "OpenAI Official Format": "OpenAI 官方格式", "Conversation Archive Alert": "確定要封存所有選取的對話?", "Conversation Archived Message": "所有選取的對話已封存。請重新整理頁面。", "Conversation Delete Alert": "確定要刪除所有選取的對話?", "Conversation Deleted Message": "所有選取的對話已刪除。請重新整理頁面。", "Please start a conversation first": "請先開始對話。" }; class GMStorage { static get(key2) { const item = _GM_getValue(key2, ""); if (item) { try { return JSON.parse(item); } catch { return null; } } return null; } static set(key2, value) { const item = JSON.stringify(value); _GM_setValue(key2, item); } static delete(key2) { _GM_deleteValue(key2); } } __publicField(GMStorage, "supported", typeof _GM_getValue === "function" && typeof _GM_setValue === "function" && typeof _GM_deleteValue === "function"); class LocalStorage { static get(key2) { const item = localStorage.getItem(key2); if (item) { try { return JSON.parse(item); } catch { return null; } } return null; } static set(key2, value) { const item = JSON.stringify(value); localStorage.setItem(key2, item); } static delete(key2) { localStorage.removeItem(key2); } } __publicField(LocalStorage, "supported", typeof localStorage === "object"); class MemoryStorage { static get(key2) { const item = this.map.get(key2); if (!item) return null; return item; } static set(key2, value) { this.map.set(key2, value); } static delete(key2) { this.map.delete(key2); } } __publicField(MemoryStorage, "map", /* @__PURE__ */ new Map()); __publicField(MemoryStorage, "supported", true); class ScriptStorage { static get(key2) { if (GMStorage.supported) { try { return GMStorage.get(key2); } catch { } } if (LocalStorage.supported) { try { return LocalStorage.get(key2); } catch { } } return MemoryStorage.get(key2); } static set(key2, value) { if (GMStorage.supported) { try { return GMStorage.set(key2, value); } catch { } } if (LocalStorage.supported) { try { return LocalStorage.set(key2, value); } catch { } } return MemoryStorage.set(key2, value); } static delete(key2) { if (GMStorage.supported) { try { return GMStorage.delete(key2); } catch { } } if (LocalStorage.supported) { try { return LocalStorage.delete(key2); } catch { } } return MemoryStorage.delete(key2); } } const EN_US = { name: "English", code: "en-US", resource: en_US }; const ES = { name: "Español", code: "es", resource: es }; const ID_ID = { name: "Indonesia", code: "id-ID", resource: id_ID }; const JA_JP = { name: "日本語", code: "ja-JP", resource: ja_JP }; const TR_TR = { name: "Türkçe", code: "tr-TR", resource: tr_TR }; const ZH_Hans = { name: "简体中文", code: "zh-Hans", resource: zh_Hans }; const ZH_Hant = { name: "繁體中文", code: "zh-Hant", resource: zh_Hant }; const LOCALES = [EN_US, ES, ID_ID, JA_JP, TR_TR, ZH_Hans, ZH_Hant]; const LanguageMapping = { "en": EN_US.code, "en-US": EN_US.code, "es": ES.code, "es-ES": ES.code, "es-AR": ES.code, "es-CL": ES.code, "es-CO": ES.code, "es-MX": ES.code, "es-US": ES.code, "id": ID_ID.code, "id-ID": ID_ID.code, "ja": JA_JP.code, "ja-JP": JA_JP.code, "tr": TR_TR.code, "tr-TR": TR_TR.code, "zh": ZH_Hans.code, "zh-CN": ZH_Hans.code, "zh-MO": ZH_Hans.code, "zh-SG": ZH_Hans.code, "zh-Hans": ZH_Hans.code, "zh-HK": ZH_Hant.code, "zh-TW": ZH_Hant.code, "zh-Hant": ZH_Hant.code }; const resources = LOCALES.reduce((acc, cur) => { acc[cur.code] = { translation: cur.resource }; return acc; }, {}); function standardizeLanguage(language) { if (language in LanguageMapping) return LanguageMapping[language]; const shortLang = language.split("-")[0]; if (shortLang in LanguageMapping) return LanguageMapping[shortLang]; return language; } function getNavigatorLanguage() { const { language, languages } = navigator; if (language) return language; if (languages && languages.length) { return languages[0]; } return null; } function getDefaultLanguage() { const storedLanguage = ScriptStorage.get(KEY_LANGUAGE); if (storedLanguage) return standardizeLanguage(storedLanguage); const browserLanguage = getNavigatorLanguage(); if (browserLanguage) return standardizeLanguage(browserLanguage); return EN_US.code; } instance.use(initReactI18next).init({ fallbackLng: EN_US.code, lng: getDefaultLanguage(), debug: false, resources, interpolation: { escapeValue: false // not needed for react as it escapes by default } }); instance.on("languageChanged", (lng) => { ScriptStorage.set(KEY_LANGUAGE, lng); }); const templateHtml = ` {{title}}