(globalThis.TURBOPACK || (globalThis.TURBOPACK = [])).push([typeof document === "object" ? document.currentScript : undefined, "[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/cjs/react-jsx-dev-runtime.development.js [app-client] (ecmascript)", ((__turbopack_context__, module, exports) => { "use strict"; var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$build$2f$polyfills$2f$process$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = /*#__PURE__*/ __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/build/polyfills/process.js [app-client] (ecmascript)"); /** * @license React * react-jsx-dev-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ "use strict"; "production" !== ("TURBOPACK compile-time value", "development") && function() { function getComponentNameFromType(type) { if (null == type) return null; if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null; if ("string" === typeof type) return type; switch(type){ case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PROFILER_TYPE: return "Profiler"; case REACT_STRICT_MODE_TYPE: return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; case REACT_ACTIVITY_TYPE: return "Activity"; case REACT_VIEW_TRANSITION_TYPE: return "ViewTransition"; } if ("object" === typeof type) switch("number" === typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof){ case REACT_PORTAL_TYPE: return "Portal"; case REACT_CONTEXT_TYPE: return type.displayName || "Context"; case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer"; case REACT_FORWARD_REF_TYPE: var innerType = type.render; type = type.displayName; type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"); return type; case REACT_MEMO_TYPE: return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo"; case REACT_LAZY_TYPE: innerType = type._payload; type = type._init; try { return getComponentNameFromType(type(innerType)); } catch (x) {} } return null; } function testStringCoercion(value) { return "" + value; } function checkKeyStringCoercion(value) { try { testStringCoercion(value); var JSCompiler_inline_result = !1; } catch (e) { JSCompiler_inline_result = !0; } if (JSCompiler_inline_result) { JSCompiler_inline_result = console; var JSCompiler_temp_const = JSCompiler_inline_result.error; var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object"; JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0); return testStringCoercion(value); } } function getTaskName(type) { if (type === REACT_FRAGMENT_TYPE) return "<>"; if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE) return "<...>"; try { var name = getComponentNameFromType(type); return name ? "<" + name + ">" : "<...>"; } catch (x) { return "<...>"; } } function getOwner() { var dispatcher = ReactSharedInternals.A; return null === dispatcher ? null : dispatcher.getOwner(); } function UnknownOwner() { return Error("react-stack-top-frame"); } function hasValidKey(config) { if (hasOwnProperty.call(config, "key")) { var getter = Object.getOwnPropertyDescriptor(config, "key").get; if (getter && getter.isReactWarning) return !1; } return void 0 !== config.key; } function defineKeyPropWarningGetter(props, displayName) { function warnAboutAccessingKey() { specialPropKeyWarningShown || (specialPropKeyWarningShown = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName)); } warnAboutAccessingKey.isReactWarning = !0; Object.defineProperty(props, "key", { get: warnAboutAccessingKey, configurable: !0 }); } function elementRefGetterWithDeprecationWarning() { var componentName = getComponentNameFromType(this.type); didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")); componentName = this.props.ref; return void 0 !== componentName ? componentName : null; } function ReactElement(type, key, props, owner, debugStack, debugTask) { var refProp = props.ref; type = { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key, props: props, _owner: owner }; null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", { enumerable: !1, get: elementRefGetterWithDeprecationWarning }) : Object.defineProperty(type, "ref", { enumerable: !1, value: null }); type._store = {}; Object.defineProperty(type._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: 0 }); Object.defineProperty(type, "_debugInfo", { configurable: !1, enumerable: !1, writable: !0, value: null }); Object.defineProperty(type, "_debugStack", { configurable: !1, enumerable: !1, writable: !0, value: debugStack }); Object.defineProperty(type, "_debugTask", { configurable: !1, enumerable: !1, writable: !0, value: debugTask }); Object.freeze && (Object.freeze(type.props), Object.freeze(type)); return type; } function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) { var children = config.children; if (void 0 !== children) if (isStaticChildren) if (isArrayImpl(children)) { for(isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)validateChildKeys(children[isStaticChildren]); Object.freeze && Object.freeze(children); } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else validateChildKeys(children); if (hasOwnProperty.call(config, "key")) { children = getComponentNameFromType(type); var keys = Object.keys(config).filter(function(k) { return "key" !== k; }); isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}"; didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = !0); } children = null; void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey); hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key); if ("key" in config) { maybeKey = {}; for(var propName in config)"key" !== propName && (maybeKey[propName] = config[propName]); } else maybeKey = config; children && defineKeyPropWarningGetter(maybeKey, "function" === typeof type ? type.displayName || type.name || "Unknown" : type); return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask); } function validateChildKeys(node) { isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1)); } function isValidElement(object) { return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE; } var React = __turbopack_context__.r("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() { return null; }; React = { react_stack_bottom_frame: function(callStackForError) { return callStackForError(); } }; var specialPropKeyWarningShown; var didWarnAboutElementRef = {}; var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)(); var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner)); var didWarnAboutKeySpread = {}; exports.Fragment = REACT_FRAGMENT_TYPE; exports.jsxDEV = function(type, config, maybeKey, isStaticChildren) { var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++; if (trackActualOwner) { var previousStackTraceLimit = Error.stackTraceLimit; Error.stackTraceLimit = 10; var debugStackDEV = Error("react-stack-top-frame"); Error.stackTraceLimit = previousStackTraceLimit; } else debugStackDEV = unknownOwnerDebugStack; return jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStackDEV, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask); }; }(); }), "[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/jsx-dev-runtime.js [app-client] (ecmascript)", ((__turbopack_context__, module, exports) => { "use strict"; var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$build$2f$polyfills$2f$process$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = /*#__PURE__*/ __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/build/polyfills/process.js [app-client] (ecmascript)"); 'use strict'; if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable ; else { module.exports = __turbopack_context__.r("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/cjs/react-jsx-dev-runtime.development.js [app-client] (ecmascript)"); } }), "[project]/coding/projects/LangBot/web/node_modules/next-themes/dist/index.mjs [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "ThemeProvider", ()=>J, "useTheme", ()=>z ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)"); "use client"; ; var M = (e, i, s, u, m, a, l, h)=>{ let d = document.documentElement, w = [ "light", "dark" ]; function p(n) { (Array.isArray(e) ? e : [ e ]).forEach((y)=>{ let k = y === "class", S = k && a ? m.map((f)=>a[f] || f) : m; k ? (d.classList.remove(...S), d.classList.add(a && a[n] ? a[n] : n)) : d.setAttribute(y, n); }), R(n); } function R(n) { h && w.includes(n) && (d.style.colorScheme = n); } function c() { return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; } if (u) p(u); else try { let n = localStorage.getItem(i) || s, y = l && n === "system" ? c() : n; p(y); } catch (n) {} }; var b = [ "light", "dark" ], I = "(prefers-color-scheme: dark)", O = typeof window == "undefined", x = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createContext"](void 0), U = { setTheme: (e)=>{}, themes: [] }, z = ()=>{ var e; return (e = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useContext"](x)) != null ? e : U; }, J = (e)=>__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useContext"](x) ? __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"](__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Fragment"], null, e.children) : __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"](V, { ...e }), N = [ "light", "dark" ], V = ({ forcedTheme: e, disableTransitionOnChange: i = !1, enableSystem: s = !0, enableColorScheme: u = !0, storageKey: m = "theme", themes: a = N, defaultTheme: l = s ? "system" : "light", attribute: h = "data-theme", value: d, children: w, nonce: p, scriptProps: R })=>{ let [c, n] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useState"]({ "V.useState": ()=>H(m, l) }["V.useState"]), [T, y] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useState"]({ "V.useState": ()=>c === "system" ? E() : c }["V.useState"]), k = d ? Object.values(d) : a, S = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useCallback"]({ "V.useCallback[S]": (o)=>{ let r = o; if (!r) return; o === "system" && s && (r = E()); let v = d ? d[r] : r, C = i ? W(p) : null, P = document.documentElement, L = { "V.useCallback[S].L": (g)=>{ g === "class" ? (P.classList.remove(...k), v && P.classList.add(v)) : g.startsWith("data-") && (v ? P.setAttribute(g, v) : P.removeAttribute(g)); } }["V.useCallback[S].L"]; if (Array.isArray(h) ? h.forEach(L) : L(h), u) { let g = b.includes(l) ? l : null, D = b.includes(r) ? r : g; P.style.colorScheme = D; } C == null || C(); } }["V.useCallback[S]"], [ p ]), f = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useCallback"]({ "V.useCallback[f]": (o)=>{ let r = typeof o == "function" ? o(c) : o; n(r); try { localStorage.setItem(m, r); } catch (v) {} } }["V.useCallback[f]"], [ c ]), A = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useCallback"]({ "V.useCallback[A]": (o)=>{ let r = E(o); y(r), c === "system" && s && !e && S("system"); } }["V.useCallback[A]"], [ c, e ]); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useEffect"]({ "V.useEffect": ()=>{ let o = window.matchMedia(I); return o.addListener(A), A(o), ({ "V.useEffect": ()=>o.removeListener(A) })["V.useEffect"]; } }["V.useEffect"], [ A ]), __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useEffect"]({ "V.useEffect": ()=>{ let o = { "V.useEffect.o": (r)=>{ r.key === m && (r.newValue ? n(r.newValue) : f(l)); } }["V.useEffect.o"]; return window.addEventListener("storage", o), ({ "V.useEffect": ()=>window.removeEventListener("storage", o) })["V.useEffect"]; } }["V.useEffect"], [ f ]), __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useEffect"]({ "V.useEffect": ()=>{ S(e != null ? e : c); } }["V.useEffect"], [ e, c ]); let Q = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useMemo"]({ "V.useMemo[Q]": ()=>({ theme: c, setTheme: f, forcedTheme: e, resolvedTheme: c === "system" ? T : c, themes: s ? [ ...a, "system" ] : a, systemTheme: s ? T : void 0 }) }["V.useMemo[Q]"], [ c, f, e, T, s, a ]); return __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"](x.Provider, { value: Q }, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"](_, { forcedTheme: e, storageKey: m, attribute: h, enableSystem: s, enableColorScheme: u, defaultTheme: l, value: d, themes: a, nonce: p, scriptProps: R }), w); }, _ = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["memo"](({ forcedTheme: e, storageKey: i, attribute: s, enableSystem: u, enableColorScheme: m, defaultTheme: a, value: l, themes: h, nonce: d, scriptProps: w })=>{ let p = JSON.stringify([ s, i, a, e, h, l, u, m ]).slice(1, -1); return __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"]("script", { ...w, suppressHydrationWarning: !0, nonce: typeof window == "undefined" ? d : "", dangerouslySetInnerHTML: { __html: `(${M.toString()})(${p})` } }); }), H = (e, i)=>{ if (O) return; let s; try { s = localStorage.getItem(e) || void 0; } catch (u) {} return s || i; }, W = (e)=>{ let i = document.createElement("style"); return e && i.setAttribute("nonce", e), i.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")), document.head.appendChild(i), ()=>{ window.getComputedStyle(document.body), setTimeout(()=>{ document.head.removeChild(i); }, 1); }; }, E = (e)=>(e || (e = window.matchMedia(I)), e.matches ? "dark" : "light"); ; }), "[project]/coding/projects/LangBot/web/node_modules/sonner/dist/index.mjs [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "Toaster", ()=>Toaster, "toast", ()=>toast, "useSonner", ()=>useSonner ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2d$dom$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react-dom/index.js [app-client] (ecmascript)"); 'use client'; function __insertCSS(code) { if (!code || typeof document == 'undefined') return; let head = document.head || document.getElementsByTagName('head')[0]; let style = document.createElement('style'); style.type = 'text/css'; head.appendChild(style); style.styleSheet ? style.styleSheet.cssText = code : style.appendChild(document.createTextNode(code)); } ; ; const getAsset = (type)=>{ switch(type){ case 'success': return SuccessIcon; case 'info': return InfoIcon; case 'warning': return WarningIcon; case 'error': return ErrorIcon; default: return null; } }; const bars = Array(12).fill(0); const Loader = ({ visible, className })=>{ return /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("div", { className: [ 'sonner-loading-wrapper', className ].filter(Boolean).join(' '), "data-visible": visible }, /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("div", { className: "sonner-spinner" }, bars.map((_, i)=>/*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("div", { className: "sonner-loading-bar", key: `spinner-bar-${i}` })))); }; const SuccessIcon = /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z", clipRule: "evenodd" })); const WarningIcon = /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", height: "20", width: "20" }, /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("path", { fillRule: "evenodd", d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z", clipRule: "evenodd" })); const InfoIcon = /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z", clipRule: "evenodd" })); const ErrorIcon = /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" })); const CloseIcon = /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }, /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })); const useIsDocumentHidden = ()=>{ const [isDocumentHidden, setIsDocumentHidden] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(document.hidden); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({ "useIsDocumentHidden.useEffect": ()=>{ const callback = { "useIsDocumentHidden.useEffect.callback": ()=>{ setIsDocumentHidden(document.hidden); } }["useIsDocumentHidden.useEffect.callback"]; document.addEventListener('visibilitychange', callback); return ({ "useIsDocumentHidden.useEffect": ()=>window.removeEventListener('visibilitychange', callback) })["useIsDocumentHidden.useEffect"]; } }["useIsDocumentHidden.useEffect"], []); return isDocumentHidden; }; let toastsCounter = 1; class Observer { constructor(){ // We use arrow functions to maintain the correct `this` reference this.subscribe = (subscriber)=>{ this.subscribers.push(subscriber); return ()=>{ const index = this.subscribers.indexOf(subscriber); this.subscribers.splice(index, 1); }; }; this.publish = (data)=>{ this.subscribers.forEach((subscriber)=>subscriber(data)); }; this.addToast = (data)=>{ this.publish(data); this.toasts = [ ...this.toasts, data ]; }; this.create = (data)=>{ var _data_id; const { message, ...rest } = data; const id = typeof (data == null ? void 0 : data.id) === 'number' || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++; const alreadyExists = this.toasts.find((toast)=>{ return toast.id === id; }); const dismissible = data.dismissible === undefined ? true : data.dismissible; if (this.dismissedToasts.has(id)) { this.dismissedToasts.delete(id); } if (alreadyExists) { this.toasts = this.toasts.map((toast)=>{ if (toast.id === id) { this.publish({ ...toast, ...data, id, title: message }); return { ...toast, ...data, id, dismissible, title: message }; } return toast; }); } else { this.addToast({ title: message, ...rest, dismissible, id }); } return id; }; this.dismiss = (id)=>{ if (id) { this.dismissedToasts.add(id); requestAnimationFrame(()=>this.subscribers.forEach((subscriber)=>subscriber({ id, dismiss: true }))); } else { this.toasts.forEach((toast)=>{ this.subscribers.forEach((subscriber)=>subscriber({ id: toast.id, dismiss: true })); }); } return id; }; this.message = (message, data)=>{ return this.create({ ...data, message }); }; this.error = (message, data)=>{ return this.create({ ...data, message, type: 'error' }); }; this.success = (message, data)=>{ return this.create({ ...data, type: 'success', message }); }; this.info = (message, data)=>{ return this.create({ ...data, type: 'info', message }); }; this.warning = (message, data)=>{ return this.create({ ...data, type: 'warning', message }); }; this.loading = (message, data)=>{ return this.create({ ...data, type: 'loading', message }); }; this.promise = (promise, data)=>{ if (!data) { // Nothing to show return; } let id = undefined; if (data.loading !== undefined) { id = this.create({ ...data, promise, type: 'loading', message: data.loading, description: typeof data.description !== 'function' ? data.description : undefined }); } const p = Promise.resolve(promise instanceof Function ? promise() : promise); let shouldDismiss = id !== undefined; let result; const originalPromise = p.then(async (response)=>{ result = [ 'resolve', response ]; const isReactElementResponse = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].isValidElement(response); if (isReactElementResponse) { shouldDismiss = false; this.create({ id, type: 'default', message: response }); } else if (isHttpResponse(response) && !response.ok) { shouldDismiss = false; const promiseData = typeof data.error === 'function' ? await data.error(`HTTP error! status: ${response.status}`) : data.error; const description = typeof data.description === 'function' ? await data.description(`HTTP error! status: ${response.status}`) : data.description; const isExtendedResult = typeof promiseData === 'object' && !__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].isValidElement(promiseData); const toastSettings = isExtendedResult ? promiseData : { message: promiseData }; this.create({ id, type: 'error', description, ...toastSettings }); } else if (response instanceof Error) { shouldDismiss = false; const promiseData = typeof data.error === 'function' ? await data.error(response) : data.error; const description = typeof data.description === 'function' ? await data.description(response) : data.description; const isExtendedResult = typeof promiseData === 'object' && !__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].isValidElement(promiseData); const toastSettings = isExtendedResult ? promiseData : { message: promiseData }; this.create({ id, type: 'error', description, ...toastSettings }); } else if (data.success !== undefined) { shouldDismiss = false; const promiseData = typeof data.success === 'function' ? await data.success(response) : data.success; const description = typeof data.description === 'function' ? await data.description(response) : data.description; const isExtendedResult = typeof promiseData === 'object' && !__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].isValidElement(promiseData); const toastSettings = isExtendedResult ? promiseData : { message: promiseData }; this.create({ id, type: 'success', description, ...toastSettings }); } }).catch(async (error)=>{ result = [ 'reject', error ]; if (data.error !== undefined) { shouldDismiss = false; const promiseData = typeof data.error === 'function' ? await data.error(error) : data.error; const description = typeof data.description === 'function' ? await data.description(error) : data.description; const isExtendedResult = typeof promiseData === 'object' && !__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].isValidElement(promiseData); const toastSettings = isExtendedResult ? promiseData : { message: promiseData }; this.create({ id, type: 'error', description, ...toastSettings }); } }).finally(()=>{ if (shouldDismiss) { // Toast is still in load state (and will be indefinitely — dismiss it) this.dismiss(id); id = undefined; } data.finally == null ? void 0 : data.finally.call(data); }); const unwrap = ()=>new Promise((resolve, reject)=>originalPromise.then(()=>result[0] === 'reject' ? reject(result[1]) : resolve(result[1])).catch(reject)); if (typeof id !== 'string' && typeof id !== 'number') { // cannot Object.assign on undefined return { unwrap }; } else { return Object.assign(id, { unwrap }); } }; this.custom = (jsx, data)=>{ const id = (data == null ? void 0 : data.id) || toastsCounter++; this.create({ jsx: jsx(id), id, ...data }); return id; }; this.getActiveToasts = ()=>{ return this.toasts.filter((toast)=>!this.dismissedToasts.has(toast.id)); }; this.subscribers = []; this.toasts = []; this.dismissedToasts = new Set(); } } const ToastState = new Observer(); // bind this to the toast function const toastFunction = (message, data)=>{ const id = (data == null ? void 0 : data.id) || toastsCounter++; ToastState.addToast({ title: message, ...data, id }); return id; }; const isHttpResponse = (data)=>{ return data && typeof data === 'object' && 'ok' in data && typeof data.ok === 'boolean' && 'status' in data && typeof data.status === 'number'; }; const basicToast = toastFunction; const getHistory = ()=>ToastState.toasts; const getToasts = ()=>ToastState.getActiveToasts(); // We use `Object.assign` to maintain the correct types as we would lose them otherwise const toast = Object.assign(basicToast, { success: ToastState.success, info: ToastState.info, warning: ToastState.warning, error: ToastState.error, custom: ToastState.custom, message: ToastState.message, promise: ToastState.promise, dismiss: ToastState.dismiss, loading: ToastState.loading }, { getHistory, getToasts }); __insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}"); function isAction(action) { return action.label !== undefined; } // Visible toasts amount const VISIBLE_TOASTS_AMOUNT = 3; // Viewport padding const VIEWPORT_OFFSET = '24px'; // Mobile viewport padding const MOBILE_VIEWPORT_OFFSET = '16px'; // Default lifetime of a toasts (in ms) const TOAST_LIFETIME = 4000; // Default toast width const TOAST_WIDTH = 356; // Default gap between toasts const GAP = 14; // Threshold to dismiss a toast const SWIPE_THRESHOLD = 45; // Equal to exit animation duration const TIME_BEFORE_UNMOUNT = 200; function cn(...classes) { return classes.filter(Boolean).join(' '); } function getDefaultSwipeDirections(position) { const [y, x] = position.split('-'); const directions = []; if (y) { directions.push(y); } if (x) { directions.push(x); } return directions; } const Toast = (props)=>{ var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8; const { invert: ToasterInvert, toast, unstyled, interacting, setHeights, visibleToasts, heights, index, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = '', descriptionClassName = '', duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = 'Close toast' } = props; const [swipeDirection, setSwipeDirection] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(null); const [swipeOutDirection, setSwipeOutDirection] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(null); const [mounted, setMounted] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(false); const [removed, setRemoved] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(false); const [swiping, setSwiping] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(false); const [swipeOut, setSwipeOut] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(false); const [isSwiped, setIsSwiped] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(false); const [offsetBeforeRemove, setOffsetBeforeRemove] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(0); const [initialHeight, setInitialHeight] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(0); const remainingTime = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useRef(toast.duration || durationFromToaster || TOAST_LIFETIME); const dragStartTime = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useRef(null); const toastRef = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useRef(null); const isFront = index === 0; const isVisible = index + 1 <= visibleToasts; const toastType = toast.type; const dismissible = toast.dismissible !== false; const toastClassname = toast.className || ''; const toastDescriptionClassname = toast.descriptionClassName || ''; // Height index is used to calculate the offset as it gets updated before the toast array, which means we can calculate the new layout faster. const heightIndex = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useMemo({ "Toast.useMemo[heightIndex]": ()=>heights.findIndex({ "Toast.useMemo[heightIndex]": (height)=>height.toastId === toast.id }["Toast.useMemo[heightIndex]"]) || 0 }["Toast.useMemo[heightIndex]"], [ heights, toast.id ]); const closeButton = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useMemo({ "Toast.useMemo[closeButton]": ()=>{ var _toast_closeButton; return (_toast_closeButton = toast.closeButton) != null ? _toast_closeButton : closeButtonFromToaster; } }["Toast.useMemo[closeButton]"], [ toast.closeButton, closeButtonFromToaster ]); const duration = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useMemo({ "Toast.useMemo[duration]": ()=>toast.duration || durationFromToaster || TOAST_LIFETIME }["Toast.useMemo[duration]"], [ toast.duration, durationFromToaster ]); const closeTimerStartTimeRef = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useRef(0); const offset = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useRef(0); const lastCloseTimerStartTimeRef = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useRef(0); const pointerStartRef = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useRef(null); const [y, x] = position.split('-'); const toastsHeightBefore = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useMemo({ "Toast.useMemo[toastsHeightBefore]": ()=>{ return heights.reduce({ "Toast.useMemo[toastsHeightBefore]": (prev, curr, reducerIndex)=>{ // Calculate offset up until current toast if (reducerIndex >= heightIndex) { return prev; } return prev + curr.height; } }["Toast.useMemo[toastsHeightBefore]"], 0); } }["Toast.useMemo[toastsHeightBefore]"], [ heights, heightIndex ]); const isDocumentHidden = useIsDocumentHidden(); const invert = toast.invert || ToasterInvert; const disabled = toastType === 'loading'; offset.current = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useMemo({ "Toast.useMemo": ()=>heightIndex * gap + toastsHeightBefore }["Toast.useMemo"], [ heightIndex, toastsHeightBefore ]); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({ "Toast.useEffect": ()=>{ remainingTime.current = duration; } }["Toast.useEffect"], [ duration ]); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({ "Toast.useEffect": ()=>{ // Trigger enter animation without using CSS animation setMounted(true); } }["Toast.useEffect"], []); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({ "Toast.useEffect": ()=>{ const toastNode = toastRef.current; if (toastNode) { const height = toastNode.getBoundingClientRect().height; // Add toast height to heights array after the toast is mounted setInitialHeight(height); setHeights({ "Toast.useEffect": (h)=>[ { toastId: toast.id, height, position: toast.position }, ...h ] }["Toast.useEffect"]); return ({ "Toast.useEffect": ()=>setHeights({ "Toast.useEffect": (h)=>h.filter({ "Toast.useEffect": (height)=>height.toastId !== toast.id }["Toast.useEffect"]) }["Toast.useEffect"]) })["Toast.useEffect"]; } } }["Toast.useEffect"], [ setHeights, toast.id ]); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useLayoutEffect({ "Toast.useLayoutEffect": ()=>{ // Keep height up to date with the content in case it updates if (!mounted) return; const toastNode = toastRef.current; const originalHeight = toastNode.style.height; toastNode.style.height = 'auto'; const newHeight = toastNode.getBoundingClientRect().height; toastNode.style.height = originalHeight; setInitialHeight(newHeight); setHeights({ "Toast.useLayoutEffect": (heights)=>{ const alreadyExists = heights.find({ "Toast.useLayoutEffect.alreadyExists": (height)=>height.toastId === toast.id }["Toast.useLayoutEffect.alreadyExists"]); if (!alreadyExists) { return [ { toastId: toast.id, height: newHeight, position: toast.position }, ...heights ]; } else { return heights.map({ "Toast.useLayoutEffect": (height)=>height.toastId === toast.id ? { ...height, height: newHeight } : height }["Toast.useLayoutEffect"]); } } }["Toast.useLayoutEffect"]); } }["Toast.useLayoutEffect"], [ mounted, toast.title, toast.description, setHeights, toast.id, toast.jsx, toast.action, toast.cancel ]); const deleteToast = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useCallback({ "Toast.useCallback[deleteToast]": ()=>{ // Save the offset for the exit swipe animation setRemoved(true); setOffsetBeforeRemove(offset.current); setHeights({ "Toast.useCallback[deleteToast]": (h)=>h.filter({ "Toast.useCallback[deleteToast]": (height)=>height.toastId !== toast.id }["Toast.useCallback[deleteToast]"]) }["Toast.useCallback[deleteToast]"]); setTimeout({ "Toast.useCallback[deleteToast]": ()=>{ removeToast(toast); } }["Toast.useCallback[deleteToast]"], TIME_BEFORE_UNMOUNT); } }["Toast.useCallback[deleteToast]"], [ toast, removeToast, setHeights, offset ]); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({ "Toast.useEffect": ()=>{ if (toast.promise && toastType === 'loading' || toast.duration === Infinity || toast.type === 'loading') return; let timeoutId; // Pause the timer on each hover const pauseTimer = { "Toast.useEffect.pauseTimer": ()=>{ if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) { // Get the elapsed time since the timer started const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current; remainingTime.current = remainingTime.current - elapsedTime; } lastCloseTimerStartTimeRef.current = new Date().getTime(); } }["Toast.useEffect.pauseTimer"]; const startTimer = { "Toast.useEffect.startTimer": ()=>{ // setTimeout(, Infinity) behaves as if the delay is 0. // As a result, the toast would be closed immediately, giving the appearance that it was never rendered. // See: https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#an-infinite-timeout if (remainingTime.current === Infinity) return; closeTimerStartTimeRef.current = new Date().getTime(); // Let the toast know it has started timeoutId = setTimeout({ "Toast.useEffect.startTimer": ()=>{ toast.onAutoClose == null ? void 0 : toast.onAutoClose.call(toast, toast); deleteToast(); } }["Toast.useEffect.startTimer"], remainingTime.current); } }["Toast.useEffect.startTimer"]; if (expanded || interacting || isDocumentHidden) { pauseTimer(); } else { startTimer(); } return ({ "Toast.useEffect": ()=>clearTimeout(timeoutId) })["Toast.useEffect"]; } }["Toast.useEffect"], [ expanded, interacting, toast, toastType, isDocumentHidden, deleteToast ]); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({ "Toast.useEffect": ()=>{ if (toast.delete) { deleteToast(); toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast); } } }["Toast.useEffect"], [ deleteToast, toast.delete ]); function getLoadingIcon() { var _toast_classNames; if (icons == null ? void 0 : icons.loading) { var _toast_classNames1; return /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("div", { className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1.loader, 'sonner-loader'), "data-visible": toastType === 'loading' }, icons.loading); } return /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement(Loader, { className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.loader), visible: toastType === 'loading' }); } const icon = toast.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType); var _toast_richColors, _icons_close; return /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("li", { tabIndex: 0, ref: toastRef, className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1[toastType]), "data-sonner-toast": "", "data-rich-colors": (_toast_richColors = toast.richColors) != null ? _toast_richColors : defaultRichColors, "data-styled": !Boolean(toast.jsx || toast.unstyled || unstyled), "data-mounted": mounted, "data-promise": Boolean(toast.promise), "data-swiped": isSwiped, "data-removed": removed, "data-visible": isVisible, "data-y-position": y, "data-x-position": x, "data-index": index, "data-front": isFront, "data-swiping": swiping, "data-dismissible": dismissible, "data-type": toastType, "data-invert": invert, "data-swipe-out": swipeOut, "data-swipe-direction": swipeOutDirection, "data-expanded": Boolean(expanded || expandByDefault && mounted), "data-testid": toast.testId, style: { '--index': index, '--toasts-before': index, '--z-index': toasts.length - index, '--offset': `${removed ? offsetBeforeRemove : offset.current}px`, '--initial-height': expandByDefault ? 'auto' : `${initialHeight}px`, ...style, ...toast.style }, onDragEnd: ()=>{ setSwiping(false); setSwipeDirection(null); pointerStartRef.current = null; }, onPointerDown: (event)=>{ if (event.button === 2) return; // Return early on right click if (disabled || !dismissible) return; dragStartTime.current = new Date(); setOffsetBeforeRemove(offset.current); // Ensure we maintain correct pointer capture even when going outside of the toast (e.g. when swiping) event.target.setPointerCapture(event.pointerId); if (event.target.tagName === 'BUTTON') return; setSwiping(true); pointerStartRef.current = { x: event.clientX, y: event.clientY }; }, onPointerUp: ()=>{ var _toastRef_current, _toastRef_current1, _dragStartTime_current; if (swipeOut || !dismissible) return; pointerStartRef.current = null; const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue('--swipe-amount-x').replace('px', '')) || 0); const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue('--swipe-amount-y').replace('px', '')) || 0); const timeTaken = new Date().getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime()); const swipeAmount = swipeDirection === 'x' ? swipeAmountX : swipeAmountY; const velocity = Math.abs(swipeAmount) / timeTaken; if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) { setOffsetBeforeRemove(offset.current); toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast); if (swipeDirection === 'x') { setSwipeOutDirection(swipeAmountX > 0 ? 'right' : 'left'); } else { setSwipeOutDirection(swipeAmountY > 0 ? 'down' : 'up'); } deleteToast(); setSwipeOut(true); return; } else { var _toastRef_current2, _toastRef_current3; (_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty('--swipe-amount-x', `0px`); (_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty('--swipe-amount-y', `0px`); } setIsSwiped(false); setSwiping(false); setSwipeDirection(null); }, onPointerMove: (event)=>{ var _window_getSelection, _toastRef_current, _toastRef_current1; if (!pointerStartRef.current || !dismissible) return; const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0; if (isHighlighted) return; const yDelta = event.clientY - pointerStartRef.current.y; const xDelta = event.clientX - pointerStartRef.current.x; var _props_swipeDirections; const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position); // Determine swipe direction if not already locked if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) { setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? 'x' : 'y'); } let swipeAmount = { x: 0, y: 0 }; const getDampening = (delta)=>{ const factor = Math.abs(delta) / 20; return 1 / (1.5 + factor); }; // Only apply swipe in the locked direction if (swipeDirection === 'y') { // Handle vertical swipes if (swipeDirections.includes('top') || swipeDirections.includes('bottom')) { if (swipeDirections.includes('top') && yDelta < 0 || swipeDirections.includes('bottom') && yDelta > 0) { swipeAmount.y = yDelta; } else { // Smoothly transition to dampened movement const dampenedDelta = yDelta * getDampening(yDelta); // Ensure we don't jump when transitioning to dampened movement swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta; } } } else if (swipeDirection === 'x') { // Handle horizontal swipes if (swipeDirections.includes('left') || swipeDirections.includes('right')) { if (swipeDirections.includes('left') && xDelta < 0 || swipeDirections.includes('right') && xDelta > 0) { swipeAmount.x = xDelta; } else { // Smoothly transition to dampened movement const dampenedDelta = xDelta * getDampening(xDelta); // Ensure we don't jump when transitioning to dampened movement swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta; } } } if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) { setIsSwiped(true); } (_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty('--swipe-amount-x', `${swipeAmount.x}px`); (_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty('--swipe-amount-y', `${swipeAmount.y}px`); } }, closeButton && !toast.jsx && toastType !== 'loading' ? /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("button", { "aria-label": closeButtonAriaLabel, "data-disabled": disabled, "data-close-button": true, onClick: disabled || !dismissible ? ()=>{} : ()=>{ deleteToast(); toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast); }, className: cn(classNames == null ? void 0 : classNames.closeButton, toast == null ? void 0 : (_toast_classNames2 = toast.classNames) == null ? void 0 : _toast_classNames2.closeButton) }, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast.icon || toast.promise) && toast.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast.icon) ? /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("div", { "data-icon": "", className: cn(classNames == null ? void 0 : classNames.icon, toast == null ? void 0 : (_toast_classNames3 = toast.classNames) == null ? void 0 : _toast_classNames3.icon) }, toast.promise || toast.type === 'loading' && !toast.icon ? toast.icon || getLoadingIcon() : null, toast.type !== 'loading' ? icon : null) : null, /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("div", { "data-content": "", className: cn(classNames == null ? void 0 : classNames.content, toast == null ? void 0 : (_toast_classNames4 = toast.classNames) == null ? void 0 : _toast_classNames4.content) }, /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("div", { "data-title": "", className: cn(classNames == null ? void 0 : classNames.title, toast == null ? void 0 : (_toast_classNames5 = toast.classNames) == null ? void 0 : _toast_classNames5.title) }, toast.jsx ? toast.jsx : typeof toast.title === 'function' ? toast.title() : toast.title), toast.description ? /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("div", { "data-description": "", className: cn(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast == null ? void 0 : (_toast_classNames6 = toast.classNames) == null ? void 0 : _toast_classNames6.description) }, typeof toast.description === 'function' ? toast.description() : toast.description) : null), /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].isValidElement(toast.cancel) ? toast.cancel : toast.cancel && isAction(toast.cancel) ? /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("button", { "data-button": true, "data-cancel": true, style: toast.cancelButtonStyle || cancelButtonStyle, onClick: (event)=>{ // We need to check twice because typescript if (!isAction(toast.cancel)) return; if (!dismissible) return; toast.cancel.onClick == null ? void 0 : toast.cancel.onClick.call(toast.cancel, event); deleteToast(); }, className: cn(classNames == null ? void 0 : classNames.cancelButton, toast == null ? void 0 : (_toast_classNames7 = toast.classNames) == null ? void 0 : _toast_classNames7.cancelButton) }, toast.cancel.label) : null, /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].isValidElement(toast.action) ? toast.action : toast.action && isAction(toast.action) ? /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("button", { "data-button": true, "data-action": true, style: toast.actionButtonStyle || actionButtonStyle, onClick: (event)=>{ // We need to check twice because typescript if (!isAction(toast.action)) return; toast.action.onClick == null ? void 0 : toast.action.onClick.call(toast.action, event); if (event.defaultPrevented) return; deleteToast(); }, className: cn(classNames == null ? void 0 : classNames.actionButton, toast == null ? void 0 : (_toast_classNames8 = toast.classNames) == null ? void 0 : _toast_classNames8.actionButton) }, toast.action.label) : null); }; function getDocumentDirection() { if (typeof window === 'undefined') return 'ltr'; if (typeof document === 'undefined') return 'ltr'; // For Fresh purpose const dirAttribute = document.documentElement.getAttribute('dir'); if (dirAttribute === 'auto' || !dirAttribute) { return window.getComputedStyle(document.documentElement).direction; } return dirAttribute; } function assignOffset(defaultOffset, mobileOffset) { const styles = {}; [ defaultOffset, mobileOffset ].forEach((offset, index)=>{ const isMobile = index === 1; const prefix = isMobile ? '--mobile-offset' : '--offset'; const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET; function assignAll(offset) { [ 'top', 'right', 'bottom', 'left' ].forEach((key)=>{ styles[`${prefix}-${key}`] = typeof offset === 'number' ? `${offset}px` : offset; }); } if (typeof offset === 'number' || typeof offset === 'string') { assignAll(offset); } else if (typeof offset === 'object') { [ 'top', 'right', 'bottom', 'left' ].forEach((key)=>{ if (offset[key] === undefined) { styles[`${prefix}-${key}`] = defaultValue; } else { styles[`${prefix}-${key}`] = typeof offset[key] === 'number' ? `${offset[key]}px` : offset[key]; } }); } else { assignAll(defaultValue); } }); return styles; } function useSonner() { const [activeToasts, setActiveToasts] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState([]); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({ "useSonner.useEffect": ()=>{ return ToastState.subscribe({ "useSonner.useEffect": (toast)=>{ if (toast.dismiss) { setTimeout({ "useSonner.useEffect": ()=>{ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2d$dom$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].flushSync({ "useSonner.useEffect": ()=>{ setActiveToasts({ "useSonner.useEffect": (toasts)=>toasts.filter({ "useSonner.useEffect": (t)=>t.id !== toast.id }["useSonner.useEffect"]) }["useSonner.useEffect"]); } }["useSonner.useEffect"]); } }["useSonner.useEffect"]); return; } // Prevent batching, temp solution. setTimeout({ "useSonner.useEffect": ()=>{ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2d$dom$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].flushSync({ "useSonner.useEffect": ()=>{ setActiveToasts({ "useSonner.useEffect": (toasts)=>{ const indexOfExistingToast = toasts.findIndex({ "useSonner.useEffect.indexOfExistingToast": (t)=>t.id === toast.id }["useSonner.useEffect.indexOfExistingToast"]); // Update the toast if it already exists if (indexOfExistingToast !== -1) { return [ ...toasts.slice(0, indexOfExistingToast), { ...toasts[indexOfExistingToast], ...toast }, ...toasts.slice(indexOfExistingToast + 1) ]; } return [ toast, ...toasts ]; } }["useSonner.useEffect"]); } }["useSonner.useEffect"]); } }["useSonner.useEffect"]); } }["useSonner.useEffect"]); } }["useSonner.useEffect"], []); return { toasts: activeToasts }; } const Toaster = /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].forwardRef(function Toaster(props, ref) { const { id, invert, position = 'bottom-right', hotkey = [ 'altKey', 'KeyT' ], expand, closeButton, className, offset, mobileOffset, theme = 'light', richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = 'Notifications' } = props; const [toasts, setToasts] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState([]); const filteredToasts = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useMemo({ "Toaster.Toaster.useMemo[filteredToasts]": ()=>{ if (id) { return toasts.filter({ "Toaster.Toaster.useMemo[filteredToasts]": (toast)=>toast.toasterId === id }["Toaster.Toaster.useMemo[filteredToasts]"]); } return toasts.filter({ "Toaster.Toaster.useMemo[filteredToasts]": (toast)=>!toast.toasterId }["Toaster.Toaster.useMemo[filteredToasts]"]); } }["Toaster.Toaster.useMemo[filteredToasts]"], [ toasts, id ]); const possiblePositions = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useMemo({ "Toaster.Toaster.useMemo[possiblePositions]": ()=>{ return Array.from(new Set([ position ].concat(filteredToasts.filter({ "Toaster.Toaster.useMemo[possiblePositions]": (toast)=>toast.position }["Toaster.Toaster.useMemo[possiblePositions]"]).map({ "Toaster.Toaster.useMemo[possiblePositions]": (toast)=>toast.position }["Toaster.Toaster.useMemo[possiblePositions]"])))); } }["Toaster.Toaster.useMemo[possiblePositions]"], [ filteredToasts, position ]); const [heights, setHeights] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState([]); const [expanded, setExpanded] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(false); const [interacting, setInteracting] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(false); const [actualTheme, setActualTheme] = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useState(theme !== 'system' ? theme : typeof window !== 'undefined' ? window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' : 'light'); const listRef = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useRef(null); const hotkeyLabel = hotkey.join('+').replace(/Key/g, '').replace(/Digit/g, ''); const lastFocusedElementRef = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useRef(null); const isFocusWithinRef = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useRef(false); const removeToast = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useCallback({ "Toaster.Toaster.useCallback[removeToast]": (toastToRemove)=>{ setToasts({ "Toaster.Toaster.useCallback[removeToast]": (toasts)=>{ var _toasts_find; if (!((_toasts_find = toasts.find({ "Toaster.Toaster.useCallback[removeToast]": (toast)=>toast.id === toastToRemove.id }["Toaster.Toaster.useCallback[removeToast]"])) == null ? void 0 : _toasts_find.delete)) { ToastState.dismiss(toastToRemove.id); } return toasts.filter({ "Toaster.Toaster.useCallback[removeToast]": ({ id })=>id !== toastToRemove.id }["Toaster.Toaster.useCallback[removeToast]"]); } }["Toaster.Toaster.useCallback[removeToast]"]); } }["Toaster.Toaster.useCallback[removeToast]"], []); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({ "Toaster.Toaster.useEffect": ()=>{ return ToastState.subscribe({ "Toaster.Toaster.useEffect": (toast)=>{ if (toast.dismiss) { // Prevent batching of other state updates requestAnimationFrame({ "Toaster.Toaster.useEffect": ()=>{ setToasts({ "Toaster.Toaster.useEffect": (toasts)=>toasts.map({ "Toaster.Toaster.useEffect": (t)=>t.id === toast.id ? { ...t, delete: true } : t }["Toaster.Toaster.useEffect"]) }["Toaster.Toaster.useEffect"]); } }["Toaster.Toaster.useEffect"]); return; } // Prevent batching, temp solution. setTimeout({ "Toaster.Toaster.useEffect": ()=>{ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2d$dom$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].flushSync({ "Toaster.Toaster.useEffect": ()=>{ setToasts({ "Toaster.Toaster.useEffect": (toasts)=>{ const indexOfExistingToast = toasts.findIndex({ "Toaster.Toaster.useEffect.indexOfExistingToast": (t)=>t.id === toast.id }["Toaster.Toaster.useEffect.indexOfExistingToast"]); // Update the toast if it already exists if (indexOfExistingToast !== -1) { return [ ...toasts.slice(0, indexOfExistingToast), { ...toasts[indexOfExistingToast], ...toast }, ...toasts.slice(indexOfExistingToast + 1) ]; } return [ toast, ...toasts ]; } }["Toaster.Toaster.useEffect"]); } }["Toaster.Toaster.useEffect"]); } }["Toaster.Toaster.useEffect"]); } }["Toaster.Toaster.useEffect"]); } }["Toaster.Toaster.useEffect"], [ toasts ]); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({ "Toaster.Toaster.useEffect": ()=>{ if (theme !== 'system') { setActualTheme(theme); return; } if (theme === 'system') { // check if current preference is dark if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { // it's currently dark setActualTheme('dark'); } else { // it's not dark setActualTheme('light'); } } if (typeof window === 'undefined') return; const darkMediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); try { // Chrome & Firefox darkMediaQuery.addEventListener('change', { "Toaster.Toaster.useEffect": ({ matches })=>{ if (matches) { setActualTheme('dark'); } else { setActualTheme('light'); } } }["Toaster.Toaster.useEffect"]); } catch (error) { // Safari < 14 darkMediaQuery.addListener({ "Toaster.Toaster.useEffect": ({ matches })=>{ try { if (matches) { setActualTheme('dark'); } else { setActualTheme('light'); } } catch (e) { console.error(e); } } }["Toaster.Toaster.useEffect"]); } } }["Toaster.Toaster.useEffect"], [ theme ]); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({ "Toaster.Toaster.useEffect": ()=>{ // Ensure expanded is always false when no toasts are present / only one left if (toasts.length <= 1) { setExpanded(false); } } }["Toaster.Toaster.useEffect"], [ toasts ]); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({ "Toaster.Toaster.useEffect": ()=>{ const handleKeyDown = { "Toaster.Toaster.useEffect.handleKeyDown": (event)=>{ var _listRef_current; const isHotkeyPressed = hotkey.every({ "Toaster.Toaster.useEffect.handleKeyDown.isHotkeyPressed": (key)=>event[key] || event.code === key }["Toaster.Toaster.useEffect.handleKeyDown.isHotkeyPressed"]); if (isHotkeyPressed) { var _listRef_current1; setExpanded(true); (_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus(); } if (event.code === 'Escape' && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) { setExpanded(false); } } }["Toaster.Toaster.useEffect.handleKeyDown"]; document.addEventListener('keydown', handleKeyDown); return ({ "Toaster.Toaster.useEffect": ()=>document.removeEventListener('keydown', handleKeyDown) })["Toaster.Toaster.useEffect"]; } }["Toaster.Toaster.useEffect"], [ hotkey ]); __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({ "Toaster.Toaster.useEffect": ()=>{ if (listRef.current) { return ({ "Toaster.Toaster.useEffect": ()=>{ if (lastFocusedElementRef.current) { lastFocusedElementRef.current.focus({ preventScroll: true }); lastFocusedElementRef.current = null; isFocusWithinRef.current = false; } } })["Toaster.Toaster.useEffect"]; } } }["Toaster.Toaster.useEffect"], [ listRef.current ]); return /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("section", { ref: ref, "aria-label": `${containerAriaLabel} ${hotkeyLabel}`, tabIndex: -1, "aria-live": "polite", "aria-relevant": "additions text", "aria-atomic": "false", suppressHydrationWarning: true }, possiblePositions.map((position, index)=>{ var _heights_; const [y, x] = position.split('-'); if (!filteredToasts.length) return null; return /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement("ol", { key: position, dir: dir === 'auto' ? getDocumentDirection() : dir, tabIndex: -1, ref: listRef, className: className, "data-sonner-toaster": true, "data-sonner-theme": actualTheme, "data-y-position": y, "data-x-position": x, style: { '--front-toast-height': `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`, '--width': `${TOAST_WIDTH}px`, '--gap': `${gap}px`, ...style, ...assignOffset(offset, mobileOffset) }, onBlur: (event)=>{ if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) { isFocusWithinRef.current = false; if (lastFocusedElementRef.current) { lastFocusedElementRef.current.focus({ preventScroll: true }); lastFocusedElementRef.current = null; } } }, onFocus: (event)=>{ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false'; if (isNotDismissible) return; if (!isFocusWithinRef.current) { isFocusWithinRef.current = true; lastFocusedElementRef.current = event.relatedTarget; } }, onMouseEnter: ()=>setExpanded(true), onMouseMove: ()=>setExpanded(true), onMouseLeave: ()=>{ // Avoid setting expanded to false when interacting with a toast, e.g. swiping if (!interacting) { setExpanded(false); } }, onDragEnd: ()=>setExpanded(false), onPointerDown: (event)=>{ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false'; if (isNotDismissible) return; setInteracting(true); }, onPointerUp: ()=>setInteracting(false) }, filteredToasts.filter((toast)=>!toast.position && index === 0 || toast.position === position).map((toast, index)=>{ var _toastOptions_duration, _toastOptions_closeButton; return /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement(Toast, { key: toast.id, icons: icons, index: index, toast: toast, defaultRichColors: richColors, duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration, className: toastOptions == null ? void 0 : toastOptions.className, descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName, invert: invert, visibleToasts: visibleToasts, closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton, interacting: interacting, position: position, style: toastOptions == null ? void 0 : toastOptions.style, unstyled: toastOptions == null ? void 0 : toastOptions.unstyled, classNames: toastOptions == null ? void 0 : toastOptions.classNames, cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle, actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle, closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel, removeToast: removeToast, toasts: filteredToasts.filter((t)=>t.position == toast.position), heights: heights.filter((h)=>h.position == toast.position), setHeights: setHeights, expandByDefault: expand, gap: gap, expanded: expanded, swipeDirections: props.swipeDirections }); })); })); }); ; }), "[project]/coding/projects/LangBot/web/node_modules/i18next/dist/esm/i18next.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "changeLanguage", ()=>changeLanguage, "createInstance", ()=>createInstance, "default", ()=>instance, "dir", ()=>dir, "exists", ()=>exists, "getFixedT", ()=>getFixedT, "hasLoadedNamespace", ()=>hasLoadedNamespace, "init", ()=>init, "keyFromSelector", ()=>keysFromSelector, "loadLanguages", ()=>loadLanguages, "loadNamespaces", ()=>loadNamespaces, "loadResources", ()=>loadResources, "reloadResources", ()=>reloadResources, "setDefaultNamespace", ()=>setDefaultNamespace, "t", ()=>t, "use", ()=>use ]); const isString = (obj)=>typeof obj === 'string'; const defer = ()=>{ let res; let rej; const promise = new Promise((resolve, reject)=>{ res = resolve; rej = reject; }); promise.resolve = res; promise.reject = rej; return promise; }; const makeString = (object)=>{ if (object == null) return ''; return '' + object; }; const copy = (a, s, t)=>{ a.forEach((m)=>{ if (s[m]) t[m] = s[m]; }); }; const lastOfPathSeparatorRegExp = /###/g; const cleanKey = (key)=>key && key.indexOf('###') > -1 ? key.replace(lastOfPathSeparatorRegExp, '.') : key; const canNotTraverseDeeper = (object)=>!object || isString(object); const getLastOfPath = (object, path, Empty)=>{ const stack = !isString(path) ? path : path.split('.'); let stackIndex = 0; while(stackIndex < stack.length - 1){ if (canNotTraverseDeeper(object)) return {}; const key = cleanKey(stack[stackIndex]); if (!object[key] && Empty) object[key] = new Empty(); if (Object.prototype.hasOwnProperty.call(object, key)) { object = object[key]; } else { object = {}; } ++stackIndex; } if (canNotTraverseDeeper(object)) return {}; return { obj: object, k: cleanKey(stack[stackIndex]) }; }; const setPath = (object, path, newValue)=>{ const { obj, k } = getLastOfPath(object, path, Object); if (obj !== undefined || path.length === 1) { obj[k] = newValue; return; } let e = path[path.length - 1]; let p = path.slice(0, path.length - 1); let last = getLastOfPath(object, p, Object); while(last.obj === undefined && p.length){ e = `${p[p.length - 1]}.${e}`; p = p.slice(0, p.length - 1); last = getLastOfPath(object, p, Object); if (last?.obj && typeof last.obj[`${last.k}.${e}`] !== 'undefined') { last.obj = undefined; } } last.obj[`${last.k}.${e}`] = newValue; }; const pushPath = (object, path, newValue, concat)=>{ const { obj, k } = getLastOfPath(object, path, Object); obj[k] = obj[k] || []; obj[k].push(newValue); }; const getPath = (object, path)=>{ const { obj, k } = getLastOfPath(object, path); if (!obj) return undefined; if (!Object.prototype.hasOwnProperty.call(obj, k)) return undefined; return obj[k]; }; const getPathWithDefaults = (data, defaultData, key)=>{ const value = getPath(data, key); if (value !== undefined) { return value; } return getPath(defaultData, key); }; const deepExtend = (target, source, overwrite)=>{ for(const prop in source){ if (prop !== '__proto__' && prop !== 'constructor') { if (prop in target) { if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) { if (overwrite) target[prop] = source[prop]; } else { deepExtend(target[prop], source[prop], overwrite); } } else { target[prop] = source[prop]; } } } return target; }; const regexEscape = (str)=>str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); var _entityMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '/': '/' }; const escape = (data)=>{ if (isString(data)) { return data.replace(/[&<>"'\/]/g, (s)=>_entityMap[s]); } return data; }; class RegExpCache { constructor(capacity){ this.capacity = capacity; this.regExpMap = new Map(); this.regExpQueue = []; } getRegExp(pattern) { const regExpFromCache = this.regExpMap.get(pattern); if (regExpFromCache !== undefined) { return regExpFromCache; } const regExpNew = new RegExp(pattern); if (this.regExpQueue.length === this.capacity) { this.regExpMap.delete(this.regExpQueue.shift()); } this.regExpMap.set(pattern, regExpNew); this.regExpQueue.push(pattern); return regExpNew; } } const chars = [ ' ', ',', '?', '!', ';' ]; const looksLikeObjectPathRegExpCache = new RegExpCache(20); const looksLikeObjectPath = (key, nsSeparator, keySeparator)=>{ nsSeparator = nsSeparator || ''; keySeparator = keySeparator || ''; const possibleChars = chars.filter((c)=>nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0); if (possibleChars.length === 0) return true; const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c)=>c === '?' ? '\\?' : c).join('|')})`); let matched = !r.test(key); if (!matched) { const ki = key.indexOf(keySeparator); if (ki > 0 && !r.test(key.substring(0, ki))) { matched = true; } } return matched; }; const deepFind = (obj, path, keySeparator = '.')=>{ if (!obj) return undefined; if (obj[path]) { if (!Object.prototype.hasOwnProperty.call(obj, path)) return undefined; return obj[path]; } const tokens = path.split(keySeparator); let current = obj; for(let i = 0; i < tokens.length;){ if (!current || typeof current !== 'object') { return undefined; } let next; let nextPath = ''; for(let j = i; j < tokens.length; ++j){ if (j !== i) { nextPath += keySeparator; } nextPath += tokens[j]; next = current[nextPath]; if (next !== undefined) { if ([ 'string', 'number', 'boolean' ].indexOf(typeof next) > -1 && j < tokens.length - 1) { continue; } i += j - i + 1; break; } } current = next; } return current; }; const getCleanedCode = (code)=>code?.replace('_', '-'); const consoleLogger = { type: 'logger', log (args) { this.output('log', args); }, warn (args) { this.output('warn', args); }, error (args) { this.output('error', args); }, output (type, args) { console?.[type]?.apply?.(console, args); } }; class Logger { constructor(concreteLogger, options = {}){ this.init(concreteLogger, options); } init(concreteLogger, options = {}) { this.prefix = options.prefix || 'i18next:'; this.logger = concreteLogger || consoleLogger; this.options = options; this.debug = options.debug; } log(...args) { return this.forward(args, 'log', '', true); } warn(...args) { return this.forward(args, 'warn', '', true); } error(...args) { return this.forward(args, 'error', ''); } deprecate(...args) { return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true); } forward(args, lvl, prefix, debugOnly) { if (debugOnly && !this.debug) return null; if (isString(args[0])) args[0] = `${prefix}${this.prefix} ${args[0]}`; return this.logger[lvl](args); } create(moduleName) { return new Logger(this.logger, { ...{ prefix: `${this.prefix}:${moduleName}:` }, ...this.options }); } clone(options) { options = options || this.options; options.prefix = options.prefix || this.prefix; return new Logger(this.logger, options); } } var baseLogger = new Logger(); class EventEmitter { constructor(){ this.observers = {}; } on(events, listener) { events.split(' ').forEach((event)=>{ if (!this.observers[event]) this.observers[event] = new Map(); const numListeners = this.observers[event].get(listener) || 0; this.observers[event].set(listener, numListeners + 1); }); return this; } off(event, listener) { if (!this.observers[event]) return; if (!listener) { delete this.observers[event]; return; } this.observers[event].delete(listener); } emit(event, ...args) { if (this.observers[event]) { const cloned = Array.from(this.observers[event].entries()); cloned.forEach(([observer, numTimesAdded])=>{ for(let i = 0; i < numTimesAdded; i++){ observer(...args); } }); } if (this.observers['*']) { const cloned = Array.from(this.observers['*'].entries()); cloned.forEach(([observer, numTimesAdded])=>{ for(let i = 0; i < numTimesAdded; i++){ observer.apply(observer, [ event, ...args ]); } }); } } } class ResourceStore extends EventEmitter { constructor(data, options = { ns: [ 'translation' ], defaultNS: 'translation' }){ super(); this.data = data || {}; this.options = options; if (this.options.keySeparator === undefined) { this.options.keySeparator = '.'; } if (this.options.ignoreJSONStructure === undefined) { this.options.ignoreJSONStructure = true; } } addNamespaces(ns) { if (this.options.ns.indexOf(ns) < 0) { this.options.ns.push(ns); } } removeNamespaces(ns) { const index = this.options.ns.indexOf(ns); if (index > -1) { this.options.ns.splice(index, 1); } } getResource(lng, ns, key, options = {}) { const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator; const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure; let path; if (lng.indexOf('.') > -1) { path = lng.split('.'); } else { path = [ lng, ns ]; if (key) { if (Array.isArray(key)) { path.push(...key); } else if (isString(key) && keySeparator) { path.push(...key.split(keySeparator)); } else { path.push(key); } } } const result = getPath(this.data, path); if (!result && !ns && !key && lng.indexOf('.') > -1) { lng = path[0]; ns = path[1]; key = path.slice(2).join('.'); } if (result || !ignoreJSONStructure || !isString(key)) return result; return deepFind(this.data?.[lng]?.[ns], key, keySeparator); } addResource(lng, ns, key, value, options = { silent: false }) { const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator; let path = [ lng, ns ]; if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key); if (lng.indexOf('.') > -1) { path = lng.split('.'); value = ns; ns = path[1]; } this.addNamespaces(ns); setPath(this.data, path, value); if (!options.silent) this.emit('added', lng, ns, key, value); } addResources(lng, ns, resources, options = { silent: false }) { for(const m in resources){ if (isString(resources[m]) || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], { silent: true }); } if (!options.silent) this.emit('added', lng, ns, resources); } addResourceBundle(lng, ns, resources, deep, overwrite, options = { silent: false, skipCopy: false }) { let path = [ lng, ns ]; if (lng.indexOf('.') > -1) { path = lng.split('.'); deep = resources; resources = ns; ns = path[1]; } this.addNamespaces(ns); let pack = getPath(this.data, path) || {}; if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources)); if (deep) { deepExtend(pack, resources, overwrite); } else { pack = { ...pack, ...resources }; } setPath(this.data, path, pack); if (!options.silent) this.emit('added', lng, ns, resources); } removeResourceBundle(lng, ns) { if (this.hasResourceBundle(lng, ns)) { delete this.data[lng][ns]; } this.removeNamespaces(ns); this.emit('removed', lng, ns); } hasResourceBundle(lng, ns) { return this.getResource(lng, ns) !== undefined; } getResourceBundle(lng, ns) { if (!ns) ns = this.options.defaultNS; return this.getResource(lng, ns); } getDataByLanguage(lng) { return this.data[lng]; } hasLanguageSomeTranslations(lng) { const data = this.getDataByLanguage(lng); const n = data && Object.keys(data) || []; return !!n.find((v)=>data[v] && Object.keys(data[v]).length > 0); } toJSON() { return this.data; } } var postProcessor = { processors: {}, addPostProcessor (module) { this.processors[module.name] = module; }, handle (processors, value, key, options, translator) { processors.forEach((processor)=>{ value = this.processors[processor]?.process(value, key, options, translator) ?? value; }); return value; } }; const PATH_KEY = Symbol('i18next/PATH_KEY'); function createProxy() { const state = []; const handler = Object.create(null); let proxy; handler.get = (target, key)=>{ proxy?.revoke?.(); if (key === PATH_KEY) return state; state.push(key); proxy = Proxy.revocable(target, handler); return proxy.proxy; }; return Proxy.revocable(Object.create(null), handler).proxy; } function keysFromSelector(selector, opts) { const { [PATH_KEY]: path } = selector(createProxy()); return path.join(opts?.keySeparator ?? '.'); } const checkedLoadedFor = {}; const shouldHandleAsObject = (res)=>!isString(res) && typeof res !== 'boolean' && typeof res !== 'number'; class Translator extends EventEmitter { constructor(services, options = {}){ super(); copy([ 'resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils' ], services, this); this.options = options; if (this.options.keySeparator === undefined) { this.options.keySeparator = '.'; } this.logger = baseLogger.create('translator'); } changeLanguage(lng) { if (lng) this.language = lng; } exists(key, o = { interpolation: {} }) { const opt = { ...o }; if (key == null) return false; const resolved = this.resolve(key, opt); if (resolved?.res === undefined) return false; const isObject = shouldHandleAsObject(resolved.res); if (opt.returnObjects === false && isObject) { return false; } return true; } extractFromKey(key, opt) { let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator; if (nsSeparator === undefined) nsSeparator = ':'; const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator; let namespaces = opt.ns || this.options.defaultNS || []; const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1; const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator); if (wouldCheckForNsInKey && !seemsNaturalLanguage) { const m = key.match(this.interpolator.nestingRegexp); if (m && m.length > 0) { return { key, namespaces: isString(namespaces) ? [ namespaces ] : namespaces }; } const parts = key.split(nsSeparator); if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift(); key = parts.join(keySeparator); } return { key, namespaces: isString(namespaces) ? [ namespaces ] : namespaces }; } translate(keys, o, lastKey) { let opt = typeof o === 'object' ? { ...o } : o; if (typeof opt !== 'object' && this.options.overloadTranslationOptionHandler) { opt = this.options.overloadTranslationOptionHandler(arguments); } if (typeof opt === 'object') opt = { ...opt }; if (!opt) opt = {}; if (keys == null) return ''; if (typeof keys === 'function') keys = keysFromSelector(keys, { ...this.options, ...opt }); if (!Array.isArray(keys)) keys = [ String(keys) ]; const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails; const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator; const { key, namespaces } = this.extractFromKey(keys[keys.length - 1], opt); const namespace = namespaces[namespaces.length - 1]; let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator; if (nsSeparator === undefined) nsSeparator = ':'; const lng = opt.lng || this.language; const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode; if (lng?.toLowerCase() === 'cimode') { if (appendNamespaceToCIMode) { if (returnDetails) { return { res: `${namespace}${nsSeparator}${key}`, usedKey: key, exactUsedKey: key, usedLng: lng, usedNS: namespace, usedParams: this.getUsedParamsDetails(opt) }; } return `${namespace}${nsSeparator}${key}`; } if (returnDetails) { return { res: key, usedKey: key, exactUsedKey: key, usedLng: lng, usedNS: namespace, usedParams: this.getUsedParamsDetails(opt) }; } return key; } const resolved = this.resolve(keys, opt); let res = resolved?.res; const resUsedKey = resolved?.usedKey || key; const resExactUsedKey = resolved?.exactUsedKey || key; const noObject = [ '[object Number]', '[object Function]', '[object RegExp]' ]; const joinArrays = opt.joinArrays !== undefined ? opt.joinArrays : this.options.joinArrays; const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject; const needsPluralHandling = opt.count !== undefined && !isString(opt.count); const hasDefaultValue = Translator.hasDefaultValue(opt); const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, opt) : ''; const defaultValueSuffixOrdinalFallback = opt.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, { ordinal: false }) : ''; const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0; const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue; let resForObjHndl = res; if (handleAsObjectInI18nFormat && !res && hasDefaultValue) { resForObjHndl = defaultValue; } const handleAsObject = shouldHandleAsObject(resForObjHndl); const resType = Object.prototype.toString.apply(resForObjHndl); if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) { if (!opt.returnObjects && !this.options.returnObjects) { if (!this.options.returnedObjectHandler) { this.logger.warn('accessing an object - but returnObjects options is not enabled!'); } const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, resForObjHndl, { ...opt, ns: namespaces }) : `key '${key} (${this.language})' returned an object instead of string.`; if (returnDetails) { resolved.res = r; resolved.usedParams = this.getUsedParamsDetails(opt); return resolved; } return r; } if (keySeparator) { const resTypeIsArray = Array.isArray(resForObjHndl); const copy = resTypeIsArray ? [] : {}; const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey; for(const m in resForObjHndl){ if (Object.prototype.hasOwnProperty.call(resForObjHndl, m)) { const deepKey = `${newKeyToUse}${keySeparator}${m}`; if (hasDefaultValue && !res) { copy[m] = this.translate(deepKey, { ...opt, defaultValue: shouldHandleAsObject(defaultValue) ? defaultValue[m] : undefined, ...{ joinArrays: false, ns: namespaces } }); } else { copy[m] = this.translate(deepKey, { ...opt, ...{ joinArrays: false, ns: namespaces } }); } if (copy[m] === deepKey) copy[m] = resForObjHndl[m]; } } res = copy; } } else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) { res = res.join(joinArrays); if (res) res = this.extendTranslation(res, keys, opt, lastKey); } else { let usedDefault = false; let usedKey = false; if (!this.isValidLookup(res) && hasDefaultValue) { usedDefault = true; res = defaultValue; } if (!this.isValidLookup(res)) { usedKey = true; res = key; } const missingKeyNoValueFallbackToKey = opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey; const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res; const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing; if (usedKey || usedDefault || updateMissing) { this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res); if (keySeparator) { const fk = this.resolve(key, { ...opt, 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.'); } let lngs = []; const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, opt.lng || this.language); if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) { for(let i = 0; i < fallbackLngs.length; i++){ lngs.push(fallbackLngs[i]); } } else if (this.options.saveMissingTo === 'all') { lngs = this.languageUtils.toResolveHierarchy(opt.lng || this.language); } else { lngs.push(opt.lng || this.language); } const send = (l, k, specificDefaultValue)=>{ const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing; if (this.options.missingKeyHandler) { this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, opt); } else if (this.backendConnector?.saveMissing) { this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, opt); } this.emit('missingKey', l, namespace, k, res); }; if (this.options.saveMissing) { if (this.options.saveMissingPlurals && needsPluralHandling) { lngs.forEach((language)=>{ const suffixes = this.pluralResolver.getSuffixes(language, opt); if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) { suffixes.push(`${this.options.pluralSeparator}zero`); } suffixes.forEach((suffix)=>{ send([ language ], key + suffix, opt[`defaultValue${suffix}`] || defaultValue); }); }); } else { send(lngs, key, defaultValue); } } } res = this.extendTranslation(res, keys, opt, resolved, lastKey); if (usedKey && res === key && this.options.appendNamespaceToMissingKey) { res = `${namespace}${nsSeparator}${key}`; } if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) { res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : undefined, opt); } } if (returnDetails) { resolved.res = res; resolved.usedParams = this.getUsedParamsDetails(opt); return resolved; } return res; } extendTranslation(res, key, opt, resolved, lastKey) { if (this.i18nFormat?.parse) { res = this.i18nFormat.parse(res, { ...this.options.interpolation.defaultVariables, ...opt }, opt.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, { resolved }); } else if (!opt.skipInterpolation) { if (opt.interpolation) this.interpolator.init({ ...opt, ...{ interpolation: { ...this.options.interpolation, ...opt.interpolation } } }); const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== undefined ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables); let nestBef; if (skipOnVariables) { const nb = res.match(this.interpolator.nestingRegexp); nestBef = nb && nb.length; } let data = opt.replace && !isString(opt.replace) ? opt.replace : opt; if (this.options.interpolation.defaultVariables) data = { ...this.options.interpolation.defaultVariables, ...data }; res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt); if (skipOnVariables) { const na = res.match(this.interpolator.nestingRegexp); const nestAft = na && na.length; if (nestBef < nestAft) opt.nest = false; } if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng; if (opt.nest !== false) res = this.interpolator.nest(res, (...args)=>{ if (lastKey?.[0] === args[0] && !opt.context) { this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`); return null; } return this.translate(...args, key); }, opt); if (opt.interpolation) this.interpolator.reset(); } const postProcess = opt.postProcess || this.options.postProcess; const postProcessorNames = isString(postProcess) ? [ postProcess ] : postProcess; if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) { res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...resolved, usedParams: this.getUsedParamsDetails(opt) }, ...opt } : opt, this); } return res; } resolve(keys, opt = {}) { let found; let usedKey; let exactUsedKey; let usedLng; let usedNS; if (isString(keys)) keys = [ keys ]; keys.forEach((k)=>{ if (this.isValidLookup(found)) return; const extracted = this.extractFromKey(k, opt); const key = extracted.key; usedKey = key; let namespaces = extracted.namespaces; if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS); const needsPluralHandling = opt.count !== undefined && !isString(opt.count); const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0; const needsContextHandling = opt.context !== undefined && (isString(opt.context) || typeof opt.context === 'number') && opt.context !== ''; const codes = opt.lngs ? opt.lngs : this.languageUtils.toResolveHierarchy(opt.lng || this.language, opt.fallbackLng); namespaces.forEach((ns)=>{ if (this.isValidLookup(found)) return; usedNS = ns; if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) { checkedLoadedFor[`${codes[0]}-${ns}`] = true; this.logger.warn(`key "${usedKey}" for languages "${codes.join(', ')}" won't get resolved as namespace "${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((code)=>{ if (this.isValidLookup(found)) return; usedLng = code; const finalKeys = [ key ]; if (this.i18nFormat?.addLookupKeys) { this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, opt); } else { let pluralSuffix; if (needsPluralHandling) pluralSuffix = this.pluralResolver.getSuffix(code, opt.count, opt); const zeroSuffix = `${this.options.pluralSeparator}zero`; const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`; if (needsPluralHandling) { if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) { finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator)); } finalKeys.push(key + pluralSuffix); if (needsZeroSuffixLookup) { finalKeys.push(key + zeroSuffix); } } if (needsContextHandling) { const contextKey = `${key}${this.options.contextSeparator || '_'}${opt.context}`; finalKeys.push(contextKey); if (needsPluralHandling) { if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) { finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator)); } finalKeys.push(contextKey + pluralSuffix); if (needsZeroSuffixLookup) { finalKeys.push(contextKey + zeroSuffix); } } } } let possibleKey; while(possibleKey = finalKeys.pop()){ if (!this.isValidLookup(found)) { exactUsedKey = possibleKey; found = this.getResource(code, ns, possibleKey, opt); } } }); }); }); return { res: found, usedKey, exactUsedKey, usedLng, usedNS }; } isValidLookup(res) { return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === ''); } getResource(code, ns, key, options = {}) { if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options); return this.resourceStore.getResource(code, ns, key, options); } getUsedParamsDetails(options = {}) { const optionsKeys = [ 'defaultValue', 'ordinal', 'context', 'replace', 'lng', 'lngs', 'fallbackLng', 'ns', 'keySeparator', 'nsSeparator', 'returnObjects', 'returnDetails', 'joinArrays', 'postProcess', 'interpolation' ]; const useOptionsReplaceForData = options.replace && !isString(options.replace); let data = useOptionsReplaceForData ? options.replace : options; if (useOptionsReplaceForData && typeof options.count !== 'undefined') { data.count = options.count; } if (this.options.interpolation.defaultVariables) { data = { ...this.options.interpolation.defaultVariables, ...data }; } if (!useOptionsReplaceForData) { data = { ...data }; for (const key of optionsKeys){ delete data[key]; } } return data; } static hasDefaultValue(options) { const prefix = 'defaultValue'; for(const option in options){ if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) { return true; } } return false; } } class LanguageUtil { constructor(options){ this.options = options; this.supportedLngs = this.options.supportedLngs || false; this.logger = baseLogger.create('languageUtils'); } getScriptPartFromCode(code) { code = getCleanedCode(code); if (!code || code.indexOf('-') < 0) return null; const p = code.split('-'); if (p.length === 2) return null; p.pop(); if (p[p.length - 1].toLowerCase() === 'x') return null; return this.formatLanguageCode(p.join('-')); } getLanguagePartFromCode(code) { code = getCleanedCode(code); if (!code || code.indexOf('-') < 0) return code; const p = code.split('-'); return this.formatLanguageCode(p[0]); } formatLanguageCode(code) { if (isString(code) && code.indexOf('-') > -1) { let formattedCode; try { formattedCode = Intl.getCanonicalLocales(code)[0]; } catch (e) {} if (formattedCode && this.options.lowerCaseLng) { formattedCode = formattedCode.toLowerCase(); } if (formattedCode) return formattedCode; if (this.options.lowerCaseLng) { return code.toLowerCase(); } return code; } return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code; } isSupportedCode(code) { if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) { code = this.getLanguagePartFromCode(code); } return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1; } getBestMatchFromCodes(codes) { if (!codes) return null; let found; codes.forEach((code)=>{ if (found) return; const cleanedLng = this.formatLanguageCode(code); if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng)) found = cleanedLng; }); if (!found && this.options.supportedLngs) { codes.forEach((code)=>{ if (found) return; const lngScOnly = this.getScriptPartFromCode(code); if (this.isSupportedCode(lngScOnly)) return found = lngScOnly; const lngOnly = this.getLanguagePartFromCode(code); if (this.isSupportedCode(lngOnly)) return found = lngOnly; found = this.options.supportedLngs.find((supportedLng)=>{ if (supportedLng === lngOnly) return supportedLng; if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return; if (supportedLng.indexOf('-') > 0 && lngOnly.indexOf('-') < 0 && supportedLng.substring(0, supportedLng.indexOf('-')) === lngOnly) return supportedLng; if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng; }); }); } if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0]; return found; } getFallbackCodes(fallbacks, code) { if (!fallbacks) return []; if (typeof fallbacks === 'function') fallbacks = fallbacks(code); if (isString(fallbacks)) fallbacks = [ fallbacks ]; if (Array.isArray(fallbacks)) return fallbacks; if (!code) return fallbacks.default || []; let found = fallbacks[code]; if (!found) found = fallbacks[this.getScriptPartFromCode(code)]; if (!found) found = fallbacks[this.formatLanguageCode(code)]; if (!found) found = fallbacks[this.getLanguagePartFromCode(code)]; if (!found) found = fallbacks.default; return found || []; } toResolveHierarchy(code, fallbackCode) { const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code); const codes = []; const addCode = (c)=>{ if (!c) return; if (this.isSupportedCode(c)) { codes.push(c); } else { this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`); } }; if (isString(code) && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) { if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code)); if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code)); if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code)); } else if (isString(code)) { addCode(this.formatLanguageCode(code)); } fallbackCodes.forEach((fc)=>{ if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc)); }); return codes; } } const suffixesOrder = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }; const dummyRule = { select: (count)=>count === 1 ? 'one' : 'other', resolvedOptions: ()=>({ pluralCategories: [ 'one', 'other' ] }) }; class PluralResolver { constructor(languageUtils, options = {}){ this.languageUtils = languageUtils; this.options = options; this.logger = baseLogger.create('pluralResolver'); this.pluralRulesCache = {}; } clearCache() { this.pluralRulesCache = {}; } getRule(code, options = {}) { const cleanedCode = getCleanedCode(code === 'dev' ? 'en' : code); const type = options.ordinal ? 'ordinal' : 'cardinal'; const cacheKey = JSON.stringify({ cleanedCode, type }); if (cacheKey in this.pluralRulesCache) { return this.pluralRulesCache[cacheKey]; } let rule; try { rule = new Intl.PluralRules(cleanedCode, { type }); } catch (err) { if (!Intl) { this.logger.error('No Intl support, please use an Intl polyfill!'); return dummyRule; } if (!code.match(/-|_/)) return dummyRule; const lngPart = this.languageUtils.getLanguagePartFromCode(code); rule = this.getRule(lngPart, options); } this.pluralRulesCache[cacheKey] = rule; return rule; } needsPlural(code, options = {}) { let rule = this.getRule(code, options); if (!rule) rule = this.getRule('dev', options); return rule?.resolvedOptions().pluralCategories.length > 1; } getPluralFormsOfKey(code, key, options = {}) { return this.getSuffixes(code, options).map((suffix)=>`${key}${suffix}`); } getSuffixes(code, options = {}) { let rule = this.getRule(code, options); if (!rule) rule = this.getRule('dev', options); if (!rule) return []; return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2)=>suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory)=>`${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${pluralCategory}`); } getSuffix(code, count, options = {}) { const rule = this.getRule(code, options); if (rule) { return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${rule.select(count)}`; } this.logger.warn(`no plural rule found for: ${code}`); return this.getSuffix('dev', count, options); } } const deepFindWithDefaults = (data, defaultData, key, keySeparator = '.', ignoreJSONStructure = true)=>{ let path = getPathWithDefaults(data, defaultData, key); if (!path && ignoreJSONStructure && isString(key)) { path = deepFind(data, key, keySeparator); if (path === undefined) path = deepFind(defaultData, key, keySeparator); } return path; }; const regexSafe = (val)=>val.replace(/\$/g, '$$$$'); class Interpolator { constructor(options = {}){ this.logger = baseLogger.create('interpolator'); this.options = options; this.format = options?.interpolation?.format || ((value)=>value); this.init(options); } init(options = {}) { if (!options.interpolation) options.interpolation = { escapeValue: true }; const { escape: escape$1, escapeValue, useRawValueToEscape, prefix, prefixEscaped, suffix, suffixEscaped, formatSeparator, unescapeSuffix, unescapePrefix, nestingPrefix, nestingPrefixEscaped, nestingSuffix, nestingSuffixEscaped, nestingOptionsSeparator, maxReplaces, alwaysFormat } = options.interpolation; this.escape = escape$1 !== undefined ? escape$1 : escape; this.escapeValue = escapeValue !== undefined ? escapeValue : true; this.useRawValueToEscape = useRawValueToEscape !== undefined ? useRawValueToEscape : false; this.prefix = prefix ? regexEscape(prefix) : prefixEscaped || '{{'; this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || '}}'; this.formatSeparator = formatSeparator || ','; this.unescapePrefix = unescapeSuffix ? '' : unescapePrefix || '-'; this.unescapeSuffix = this.unescapePrefix ? '' : unescapeSuffix || ''; this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape('$t('); this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(')'); this.nestingOptionsSeparator = nestingOptionsSeparator || ','; this.maxReplaces = maxReplaces || 1000; this.alwaysFormat = alwaysFormat !== undefined ? alwaysFormat : false; this.resetRegExp(); } reset() { if (this.options) this.init(this.options); } resetRegExp() { const getOrResetRegExp = (existingRegExp, pattern)=>{ if (existingRegExp?.source === pattern) { existingRegExp.lastIndex = 0; return existingRegExp; } return new RegExp(pattern, 'g'); }; this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`); this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`); this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`); } interpolate(str, data, lng, options) { let match; let value; let replaces; const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}; const handleFormat = (key)=>{ if (key.indexOf(this.formatSeparator) < 0) { const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure); return this.alwaysFormat ? this.format(path, undefined, lng, { ...options, ...data, interpolationkey: key }) : path; } const p = key.split(this.formatSeparator); const k = p.shift().trim(); const f = p.join(this.formatSeparator).trim(); return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, { ...options, ...data, interpolationkey: k }); }; this.resetRegExp(); const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler; const skipOnVariables = options?.interpolation?.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables; const todos = [ { regex: this.regexpUnescape, safeValue: (val)=>regexSafe(val) }, { regex: this.regexp, safeValue: (val)=>this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val) } ]; todos.forEach((todo)=>{ replaces = 0; while(match = todo.regex.exec(str)){ const matchedVar = match[1].trim(); value = handleFormat(matchedVar); if (value === undefined) { if (typeof missingInterpolationHandler === 'function') { const temp = missingInterpolationHandler(str, match, options); value = isString(temp) ? 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 ${matchedVar} for interpolating ${str}`); value = ''; } } else if (!isString(value) && !this.useRawValueToEscape) { value = makeString(value); } const 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; } nest(str, fc, options = {}) { let match; let value; let clonedOptions; const handleHasOptions = (key, inheritedOptions)=>{ const sep = this.nestingOptionsSeparator; if (key.indexOf(sep) < 0) return key; const c = key.split(new RegExp(`${sep}[ ]*{`)); let optionsString = `{${c[1]}`; key = c[0]; optionsString = this.interpolate(optionsString, clonedOptions); const matchedSingleQuotes = optionsString.match(/'/g); const matchedDoubleQuotes = optionsString.match(/"/g); if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) { optionsString = optionsString.replace(/'/g, '"'); } try { clonedOptions = JSON.parse(optionsString); if (inheritedOptions) clonedOptions = { ...inheritedOptions, ...clonedOptions }; } catch (e) { this.logger.warn(`failed parsing options string in nesting for key ${key}`, e); return `${key}${sep}${optionsString}`; } if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue; return key; }; while(match = this.nestingRegexp.exec(str)){ let formatters = []; clonedOptions = { ...options }; clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions; clonedOptions.applyPostProcessor = false; delete clonedOptions.defaultValue; const keyEndIndex = /{.*}/.test(match[1]) ? match[1].lastIndexOf('}') + 1 : match[1].indexOf(this.formatSeparator); if (keyEndIndex !== -1) { formatters = match[1].slice(keyEndIndex).split(this.formatSeparator).map((elem)=>elem.trim()).filter(Boolean); match[1] = match[1].slice(0, keyEndIndex); } value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions); if (value && match[0] === str && !isString(value)) return value; if (!isString(value)) value = makeString(value); if (!value) { this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`); value = ''; } if (formatters.length) { value = formatters.reduce((v, f)=>this.format(v, f, options.lng, { ...options, interpolationkey: match[1].trim() }), value.trim()); } str = str.replace(match[0], value); this.regexp.lastIndex = 0; } return str; } } const parseFormatStr = (formatStr)=>{ let formatName = formatStr.toLowerCase().trim(); const formatOptions = {}; if (formatStr.indexOf('(') > -1) { const p = formatStr.split('('); formatName = p[0].toLowerCase().trim(); const optStr = p[1].substring(0, p[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 { const opts = optStr.split(';'); opts.forEach((opt)=>{ if (opt) { const [key, ...rest] = opt.split(':'); const val = rest.join(':').trim().replace(/^'+|'+$/g, ''); const trimmedKey = key.trim(); if (!formatOptions[trimmedKey]) formatOptions[trimmedKey] = val; if (val === 'false') formatOptions[trimmedKey] = false; if (val === 'true') formatOptions[trimmedKey] = true; if (!isNaN(val)) formatOptions[trimmedKey] = parseInt(val, 10); } }); } } return { formatName, formatOptions }; }; const createCachedFormatter = (fn)=>{ const cache = {}; return (v, l, o)=>{ let optForCache = o; if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) { optForCache = { ...optForCache, [o.interpolationkey]: undefined }; } const key = l + JSON.stringify(optForCache); let frm = cache[key]; if (!frm) { frm = fn(getCleanedCode(l), o); cache[key] = frm; } return frm(v); }; }; const createNonCachedFormatter = (fn)=>(v, l, o)=>fn(getCleanedCode(l), o)(v); class Formatter { constructor(options = {}){ this.logger = baseLogger.create('formatter'); this.options = options; this.init(options); } init(services, options = { interpolation: {} }) { this.formatSeparator = options.interpolation.formatSeparator || ','; const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter; this.formats = { number: cf((lng, opt)=>{ const formatter = new Intl.NumberFormat(lng, { ...opt }); return (val)=>formatter.format(val); }), currency: cf((lng, opt)=>{ const formatter = new Intl.NumberFormat(lng, { ...opt, style: 'currency' }); return (val)=>formatter.format(val); }), datetime: cf((lng, opt)=>{ const formatter = new Intl.DateTimeFormat(lng, { ...opt }); return (val)=>formatter.format(val); }), relativetime: cf((lng, opt)=>{ const formatter = new Intl.RelativeTimeFormat(lng, { ...opt }); return (val)=>formatter.format(val, opt.range || 'day'); }), list: cf((lng, opt)=>{ const formatter = new Intl.ListFormat(lng, { ...opt }); return (val)=>formatter.format(val); }) }; } add(name, fc) { this.formats[name.toLowerCase().trim()] = fc; } addCached(name, fc) { this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc); } format(value, format, lng, options = {}) { const formats = format.split(this.formatSeparator); if (formats.length > 1 && formats[0].indexOf('(') > 1 && formats[0].indexOf(')') < 0 && formats.find((f)=>f.indexOf(')') > -1)) { const lastIndex = formats.findIndex((f)=>f.indexOf(')') > -1); formats[0] = [ formats[0], ...formats.splice(1, lastIndex) ].join(this.formatSeparator); } const result = formats.reduce((mem, f)=>{ const { formatName, formatOptions } = parseFormatStr(f); if (this.formats[formatName]) { let formatted = mem; try { const valOptions = options?.formatParams?.[options.interpolationkey] || {}; const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng; formatted = this.formats[formatName](mem, l, { ...formatOptions, ...options, ...valOptions }); } catch (error) { this.logger.warn(error); } return formatted; } else { this.logger.warn(`there was no format function for ${formatName}`); } return mem; }, value); return result; } } const removePending = (q, name)=>{ if (q.pending[name] !== undefined) { delete q.pending[name]; q.pendingCount--; } }; class Connector extends EventEmitter { constructor(backend, store, services, options = {}){ super(); 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 = []; this.backend?.init?.(services, options.backend, options); } queueLoad(languages, namespaces, options, callback) { const toLoad = {}; const pending = {}; const toLoadLanguages = {}; const toLoadNamespaces = {}; languages.forEach((lng)=>{ let hasAllNamespaces = true; namespaces.forEach((ns)=>{ const name = `${lng}|${ns}`; if (!options.reload && this.store.hasResourceBundle(lng, ns)) { this.state[name] = 2; } else if (this.state[name] < 0) ; else if (this.state[name] === 1) { if (pending[name] === undefined) pending[name] = true; } else { this.state[name] = 1; hasAllNamespaces = false; if (pending[name] === undefined) pending[name] = true; if (toLoad[name] === undefined) toLoad[name] = true; if (toLoadNamespaces[ns] === undefined) 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) }; } loaded(name, err, data) { const s = name.split('|'); const lng = s[0]; const ns = s[1]; if (err) this.emit('failedLoading', lng, ns, err); if (!err && data) { this.store.addResourceBundle(lng, ns, data, undefined, undefined, { skipCopy: true }); } this.state[name] = err ? -1 : 2; if (err && data) this.state[name] = 0; const loaded = {}; this.queue.forEach((q)=>{ pushPath(q.loaded, [ lng ], ns); removePending(q, name); if (err) q.errors.push(err); if (q.pendingCount === 0 && !q.done) { Object.keys(q.loaded).forEach((l)=>{ if (!loaded[l]) loaded[l] = {}; const loadedKeys = q.loaded[l]; if (loadedKeys.length) { loadedKeys.forEach((n)=>{ if (loaded[l][n] === undefined) loaded[l][n] = true; }); } }); q.done = true; if (q.errors.length) { q.callback(q.errors); } else { q.callback(); } } }); this.emit('loaded', loaded); this.queue = this.queue.filter((q)=>!q.done); } read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) { if (!lng.length) return callback(null, {}); if (this.readingCalls >= this.maxParallelReads) { this.waitingReads.push({ lng, ns, fcName, tried, wait, callback }); return; } this.readingCalls++; const resolver = (err, data)=>{ this.readingCalls--; if (this.waitingReads.length > 0) { const next = this.waitingReads.shift(); this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback); } if (err && data && tried < this.maxRetries) { setTimeout(()=>{ this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback); }, wait); return; } callback(err, data); }; const fc = this.backend[fcName].bind(this.backend); if (fc.length === 2) { try { const r = fc(lng, ns); if (r && typeof r.then === 'function') { r.then((data)=>resolver(null, data)).catch(resolver); } else { resolver(null, r); } } catch (err) { resolver(err); } return; } return fc(lng, ns, resolver); } prepareLoading(languages, namespaces, options = {}, callback) { if (!this.backend) { this.logger.warn('No backend was added via i18next.use. Will not load resources.'); return callback && callback(); } if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages); if (isString(namespaces)) namespaces = [ namespaces ]; const toLoad = this.queueLoad(languages, namespaces, options, callback); if (!toLoad.toLoad.length) { if (!toLoad.pending.length) callback(); return null; } toLoad.toLoad.forEach((name)=>{ this.loadOne(name); }); } load(languages, namespaces, callback) { this.prepareLoading(languages, namespaces, {}, callback); } reload(languages, namespaces, callback) { this.prepareLoading(languages, namespaces, { reload: true }, callback); } loadOne(name, prefix = '') { const s = name.split('|'); const lng = s[0]; const ns = s[1]; this.read(lng, ns, 'read', undefined, undefined, (err, data)=>{ if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err); if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data); this.loaded(name, err, data); }); } saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = ()=>{}) { if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) { this.logger.warn(`did not save key "${key}" as the namespace "${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 (key === undefined || key === null || key === '') return; if (this.backend?.create) { const opts = { ...options, isUpdate }; const fc = this.backend.create.bind(this.backend); if (fc.length < 6) { try { let r; if (fc.length === 5) { r = fc(languages, namespace, key, fallbackValue, opts); } else { r = fc(languages, namespace, key, fallbackValue); } if (r && typeof r.then === 'function') { r.then((data)=>clb(null, data)).catch(clb); } else { clb(null, r); } } catch (err) { clb(err); } } else { fc(languages, namespace, key, fallbackValue, clb, opts); } } if (!languages || !languages[0]) return; this.store.addResource(languages[0], namespace, key, fallbackValue); } } const get = ()=>({ debug: false, initAsync: 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: false, returnEmptyString: true, returnObjects: false, joinArrays: false, returnedObjectHandler: false, parseMissingKeyHandler: false, appendNamespaceToMissingKey: false, appendNamespaceToCIMode: false, overloadTranslationOptionHandler: (args)=>{ let ret = {}; if (typeof args[1] === 'object') ret = args[1]; if (isString(args[1])) ret.defaultValue = args[1]; if (isString(args[2])) ret.tDescription = args[2]; if (typeof args[2] === 'object' || typeof args[3] === 'object') { const options = args[3] || args[2]; Object.keys(options).forEach((key)=>{ ret[key] = options[key]; }); } return ret; }, interpolation: { escapeValue: true, format: (value)=>value, prefix: '{{', suffix: '}}', formatSeparator: ',', unescapePrefix: '-', nestingPrefix: '$t(', nestingSuffix: ')', nestingOptionsSeparator: ',', maxReplaces: 1000, skipOnVariables: true }, cacheInBuiltFormats: true }); const transformOptions = (options)=>{ if (isString(options.ns)) options.ns = [ options.ns ]; if (isString(options.fallbackLng)) options.fallbackLng = [ options.fallbackLng ]; if (isString(options.fallbackNS)) options.fallbackNS = [ options.fallbackNS ]; if (options.supportedLngs?.indexOf?.('cimode') < 0) { options.supportedLngs = options.supportedLngs.concat([ 'cimode' ]); } if (typeof options.initImmediate === 'boolean') options.initAsync = options.initImmediate; return options; }; const noop = ()=>{}; const bindMemberFunctions = (inst)=>{ const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst)); mems.forEach((mem)=>{ if (typeof inst[mem] === 'function') { inst[mem] = inst[mem].bind(inst); } }); }; class I18n extends EventEmitter { constructor(options = {}, callback){ super(); this.options = transformOptions(options); this.services = {}; this.logger = baseLogger; this.modules = { external: [] }; bindMemberFunctions(this); if (callback && !this.isInitialized && !options.isClone) { if (!this.options.initAsync) { this.init(options, callback); return this; } setTimeout(()=>{ this.init(options, callback); }, 0); } } init(options = {}, callback) { this.isInitializing = true; if (typeof options === 'function') { callback = options; options = {}; } if (options.defaultNS == null && options.ns) { if (isString(options.ns)) { options.defaultNS = options.ns; } else if (options.ns.indexOf('translation') < 0) { options.defaultNS = options.ns[0]; } } const defOpts = get(); this.options = { ...defOpts, ...this.options, ...transformOptions(options) }; this.options.interpolation = { ...defOpts.interpolation, ...this.options.interpolation }; if (options.keySeparator !== undefined) { this.options.userDefinedKeySeparator = options.keySeparator; } if (options.nsSeparator !== undefined) { this.options.userDefinedNsSeparator = options.nsSeparator; } if (typeof this.options.overloadTranslationOptionHandler !== 'function') { this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler; } if (this.options.debug === true) { if (typeof console !== 'undefined') console.warn('i18next is maintained with support from locize.com — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com'); } const 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); } let formatter; if (this.modules.formatter) { formatter = this.modules.formatter; } else { formatter = Formatter; } const lu = new LanguageUtil(this.options); this.store = new ResourceStore(this.options.resources, this.options); const s = this.services; s.logger = baseLogger; s.resourceStore = this.store; s.languageUtils = lu; s.pluralResolver = new PluralResolver(lu, { prepend: this.options.pluralSeparator, simplifyPluralSuffix: this.options.simplifyPluralSuffix }); const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format; if (usingLegacyFormatFunction) { this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`); } if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) { s.formatter = createClassOnDemand(formatter); if (s.formatter.init) s.formatter.init(s, this.options); this.options.interpolation.format = s.formatter.format.bind(s.formatter); } s.interpolator = new Interpolator(this.options); s.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }; s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options); s.backendConnector.on('*', (event, ...args)=>{ this.emit(event, ...args); }); if (this.modules.languageDetector) { s.languageDetector = createClassOnDemand(this.modules.languageDetector); if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options); } if (this.modules.i18nFormat) { s.i18nFormat = createClassOnDemand(this.modules.i18nFormat); if (s.i18nFormat.init) s.i18nFormat.init(this); } this.translator = new Translator(this.services, this.options); this.translator.on('*', (event, ...args)=>{ this.emit(event, ...args); }); this.modules.external.forEach((m)=>{ if (m.init) m.init(this); }); } this.format = this.options.interpolation.format; if (!callback) callback = noop; if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) { const 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'); } const storeApi = [ 'getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage' ]; storeApi.forEach((fcName)=>{ this[fcName] = (...args)=>this.store[fcName](...args); }); const storeApiChained = [ 'addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle' ]; storeApiChained.forEach((fcName)=>{ this[fcName] = (...args)=>{ this.store[fcName](...args); return this; }; }); const deferred = defer(); const load = ()=>{ const finish = (err, t)=>{ this.isInitializing = false; if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn('init: i18next is already initialized. You should call init just once!'); this.isInitialized = true; if (!this.options.isClone) this.logger.log('initialized', this.options); this.emit('initialized', this.options); deferred.resolve(t); callback(err, t); }; if (this.languages && !this.isInitialized) return finish(null, this.t.bind(this)); this.changeLanguage(this.options.lng, finish); }; if (this.options.resources || !this.options.initAsync) { load(); } else { setTimeout(load, 0); } return deferred; } loadResources(language, callback = noop) { let usedCallback = callback; const usedLng = isString(language) ? language : this.language; if (typeof language === 'function') usedCallback = language; if (!this.options.resources || this.options.partialBundledLanguages) { if (usedLng?.toLowerCase() === 'cimode' && (!this.options.preload || this.options.preload.length === 0)) return usedCallback(); const toLoad = []; const append = (lng)=>{ if (!lng) return; if (lng === 'cimode') return; const lngs = this.services.languageUtils.toResolveHierarchy(lng); lngs.forEach((l)=>{ if (l === 'cimode') return; if (toLoad.indexOf(l) < 0) toLoad.push(l); }); }; if (!usedLng) { const fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng); fallbacks.forEach((l)=>append(l)); } else { append(usedLng); } this.options.preload?.forEach?.((l)=>append(l)); this.services.backendConnector.load(toLoad, this.options.ns, (e)=>{ if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language); usedCallback(e); }); } else { usedCallback(null); } } reloadResources(lngs, ns, callback) { const deferred = defer(); if (typeof lngs === 'function') { callback = lngs; lngs = undefined; } if (typeof ns === 'function') { callback = ns; ns = undefined; } if (!lngs) lngs = this.languages; if (!ns) ns = this.options.ns; if (!callback) callback = noop; this.services.backendConnector.reload(lngs, ns, (err)=>{ deferred.resolve(); callback(err); }); return deferred; } 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; } setResolvedLanguage(l) { if (!l || !this.languages) return; if ([ 'cimode', 'dev' ].indexOf(l) > -1) return; for(let li = 0; li < this.languages.length; li++){ const lngInLngs = this.languages[li]; if ([ 'cimode', 'dev' ].indexOf(lngInLngs) > -1) continue; if (this.store.hasLanguageSomeTranslations(lngInLngs)) { this.resolvedLanguage = lngInLngs; break; } } if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) { this.resolvedLanguage = l; this.languages.unshift(l); } } changeLanguage(lng, callback) { this.isLanguageChangingTo = lng; const deferred = defer(); this.emit('languageChanging', lng); const setLngProps = (l)=>{ this.language = l; this.languages = this.services.languageUtils.toResolveHierarchy(l); this.resolvedLanguage = undefined; this.setResolvedLanguage(l); }; const done = (err, l)=>{ if (l) { if (this.isLanguageChangingTo === lng) { setLngProps(l); this.translator.changeLanguage(l); this.isLanguageChangingTo = undefined; this.emit('languageChanged', l); this.logger.log('languageChanged', l); } } else { this.isLanguageChangingTo = undefined; } deferred.resolve((...args)=>this.t(...args)); if (callback) callback(err, (...args)=>this.t(...args)); }; const setLng = (lngs)=>{ if (!lng && !lngs && this.services.languageDetector) lngs = []; const fl = isString(lngs) ? lngs : lngs && lngs[0]; const l = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [ lngs ] : lngs); if (l) { if (!this.language) { setLngProps(l); } if (!this.translator.language) this.translator.changeLanguage(l); this.services.languageDetector?.cacheUserLanguage?.(l); } this.loadResources(l, (err)=>{ done(err, l); }); }; 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; } getFixedT(lng, ns, keyPrefix) { const fixedT = (key, opts, ...rest)=>{ let o; if (typeof opts !== 'object') { o = this.options.overloadTranslationOptionHandler([ key, opts ].concat(rest)); } else { o = { ...opts }; } o.lng = o.lng || fixedT.lng; o.lngs = o.lngs || fixedT.lngs; o.ns = o.ns || fixedT.ns; if (o.keyPrefix !== '') o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix; const keySeparator = this.options.keySeparator || '.'; let resultKey; if (o.keyPrefix && Array.isArray(key)) { resultKey = key.map((k)=>{ if (typeof k === 'function') k = keysFromSelector(k, { ...this.options, ...opts }); return `${o.keyPrefix}${keySeparator}${k}`; }); } else { if (typeof key === 'function') key = keysFromSelector(key, { ...this.options, ...opts }); resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key; } return this.t(resultKey, o); }; if (isString(lng)) { fixedT.lng = lng; } else { fixedT.lngs = lng; } fixedT.ns = ns; fixedT.keyPrefix = keyPrefix; return fixedT; } t(...args) { return this.translator?.translate(...args); } exists(...args) { return this.translator?.exists(...args); } setDefaultNamespace(ns) { this.options.defaultNS = ns; } hasLoadedNamespace(ns, options = {}) { 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; } const lng = options.lng || this.resolvedLanguage || this.languages[0]; const fallbackLng = this.options ? this.options.fallbackLng : false; const lastLng = this.languages[this.languages.length - 1]; if (lng.toLowerCase() === 'cimode') return true; const loadNotPending = (l, n)=>{ const loadState = this.services.backendConnector.state[`${l}|${n}`]; return loadState === -1 || loadState === 0 || loadState === 2; }; if (options.precheck) { const preResult = options.precheck(this, loadNotPending); if (preResult !== undefined) 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; } loadNamespaces(ns, callback) { const deferred = defer(); if (!this.options.ns) { if (callback) callback(); return Promise.resolve(); } if (isString(ns)) ns = [ ns ]; ns.forEach((n)=>{ if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n); }); this.loadResources((err)=>{ deferred.resolve(); if (callback) callback(err); }); return deferred; } loadLanguages(lngs, callback) { const deferred = defer(); if (isString(lngs)) lngs = [ lngs ]; const preloaded = this.options.preload || []; const newLngs = lngs.filter((lng)=>preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng)); if (!newLngs.length) { if (callback) callback(); return Promise.resolve(); } this.options.preload = preloaded.concat(newLngs); this.loadResources((err)=>{ deferred.resolve(); if (callback) callback(err); }); return deferred; } dir(lng) { if (!lng) lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language); if (!lng) return 'rtl'; try { const l = new Intl.Locale(lng); if (l && l.getTextInfo) { const ti = l.getTextInfo(); if (ti && ti.direction) return ti.direction; } } catch (e) {} const 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' ]; const languageUtils = this.services?.languageUtils || new LanguageUtil(get()); if (lng.toLowerCase().indexOf('-latn') > 1) return 'ltr'; return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr'; } static createInstance(options = {}, callback) { const instance = new I18n(options, callback); instance.createInstance = I18n.createInstance; return instance; } cloneInstance(options = {}, callback = noop) { const forkResourceStore = options.forkResourceStore; if (forkResourceStore) delete options.forkResourceStore; const mergedOptions = { ...this.options, ...options, ...{ isClone: true } }; const clone = new I18n(mergedOptions); if (options.debug !== undefined || options.prefix !== undefined) { clone.logger = clone.logger.clone(options); } const membersToCopy = [ 'store', 'services', 'language' ]; membersToCopy.forEach((m)=>{ clone[m] = this[m]; }); clone.services = { ...this.services }; clone.services.utils = { hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone) }; if (forkResourceStore) { const clonedData = Object.keys(this.store.data).reduce((prev, l)=>{ prev[l] = { ...this.store.data[l] }; prev[l] = Object.keys(prev[l]).reduce((acc, n)=>{ acc[n] = { ...prev[l][n] }; return acc; }, prev[l]); return prev; }, {}); clone.store = new ResourceStore(clonedData, mergedOptions); clone.services.resourceStore = clone.store; } if (options.interpolation) { const defOpts = get(); const mergedInterpolation = { ...defOpts.interpolation, ...this.options.interpolation, ...options.interpolation }; const mergedForInterpolator = { ...mergedOptions, interpolation: mergedInterpolation }; clone.services.interpolator = new Interpolator(mergedForInterpolator); } clone.translator = new Translator(clone.services, mergedOptions); clone.translator.on('*', (event, ...args)=>{ clone.emit(event, ...args); }); clone.init(mergedOptions, callback); clone.translator.options = mergedOptions; clone.translator.backendConnector.services.utils = { hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone) }; return clone; } toJSON() { return { options: this.options, store: this.store, language: this.language, languages: this.languages, resolvedLanguage: this.resolvedLanguage }; } } const instance = I18n.createInstance(); const createInstance = instance.createInstance; const dir = instance.dir; const init = instance.init; const loadResources = instance.loadResources; const reloadResources = instance.reloadResources; const use = instance.use; const changeLanguage = instance.changeLanguage; const getFixedT = instance.getFixedT; const t = instance.t; const exists = instance.exists; const setDefaultNamespace = instance.setDefaultNamespace; const hasLoadedNamespace = instance.hasLoadedNamespace; const loadNamespaces = instance.loadNamespaces; const loadLanguages = instance.loadLanguages; ; }), "[project]/coding/projects/LangBot/web/node_modules/void-elements/index.js [app-client] (ecmascript)", ((__turbopack_context__, module, exports) => { /** * This file automatically generated from `pre-publish.js`. * Do not manually edit. */ module.exports = { "area": true, "base": true, "br": true, "col": true, "embed": true, "hr": true, "img": true, "input": true, "link": true, "meta": true, "param": true, "source": true, "track": true, "wbr": true }; }), "[project]/coding/projects/LangBot/web/node_modules/html-parse-stringify/dist/html-parse-stringify.module.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "default", ()=>__TURBOPACK__default__export__ ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$void$2d$elements$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/void-elements/index.js [app-client] (ecmascript)"); ; var t = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g; function n(n) { var r = { type: "tag", name: "", voidElement: !1, attrs: {}, children: [] }, i = n.match(/<\/?([^\s]+?)[/\s>]/); if (i && (r.name = i[1], (__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$void$2d$elements$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"][i[1]] || "/" === n.charAt(n.length - 2)) && (r.voidElement = !0), r.name.startsWith("!--"))) { var s = n.indexOf("--\x3e"); return { type: "comment", comment: -1 !== s ? n.slice(4, s) : "" }; } for(var a = new RegExp(t), c = null; null !== (c = a.exec(n));)if (c[0].trim()) if (c[1]) { var o = c[1].trim(), l = [ o, "" ]; o.indexOf("=") > -1 && (l = o.split("=")), r.attrs[l[0]] = l[1], a.lastIndex--; } else c[2] && (r.attrs[c[2]] = c[3].trim().substring(1, c[3].length - 1)); return r; } var r = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, i = /^\s*$/, s = Object.create(null); function a(e, t) { switch(t.type){ case "text": return e + t.content; case "tag": return e += "<" + t.name + (t.attrs ? function(e) { var t = []; for(var n in e)t.push(n + '="' + e[n] + '"'); return t.length ? " " + t.join(" ") : ""; }(t.attrs) : "") + (t.voidElement ? "/>" : ">"), t.voidElement ? e : e + t.children.reduce(a, "") + ""; case "comment": return e + "\x3c!--" + t.comment + "--\x3e"; } } var c = { parse: function(e, t) { t || (t = {}), t.components || (t.components = s); var a, c = [], o = [], l = -1, m = !1; if (0 !== e.indexOf("<")) { var u = e.indexOf("<"); c.push({ type: "text", content: -1 === u ? e : e.substring(0, u) }); } return e.replace(r, function(r, s) { if (m) { if (r !== "") return; m = !1; } var u, f = "/" !== r.charAt(1), h = r.startsWith("\x3c!--"), p = s + r.length, d = e.charAt(p); if (h) { var v = n(r); return l < 0 ? (c.push(v), c) : ((u = o[l]).children.push(v), c); } if (f && (l++, "tag" === (a = n(r)).type && t.components[a.name] && (a.type = "component", m = !0), a.voidElement || m || !d || "<" === d || a.children.push({ type: "text", content: e.slice(p, e.indexOf("<", p)) }), 0 === l && c.push(a), (u = o[l - 1]) && u.children.push(a), o[l] = a), (!f || a.voidElement) && (l > -1 && (a.voidElement || a.name === r.slice(2, -1)) && (l--, a = -1 === l ? c : o[l]), !m && "<" !== d && d)) { u = -1 === l ? c : o[l].children; var x = e.indexOf("<", p), g = e.slice(p, -1 === x ? void 0 : x); i.test(g) && (g = " "), (x > -1 && l + u.length >= 0 || " " !== g) && u.push({ type: "text", content: g }); } }), c; }, stringify: function(e) { return e.reduce(function(e, t) { return e + a("", t); }, ""); } }; const __TURBOPACK__default__export__ = c; //# sourceMappingURL=html-parse-stringify.module.js.map }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/utils.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "getDisplayName", ()=>getDisplayName, "hasLoadedNamespace", ()=>hasLoadedNamespace, "isObject", ()=>isObject, "isString", ()=>isString, "loadLanguages", ()=>loadLanguages, "loadNamespaces", ()=>loadNamespaces, "warn", ()=>warn, "warnOnce", ()=>warnOnce ]); const warn = (i18n, code, msg, rest)=>{ const args = [ msg, { code, ...rest || {} } ]; if (i18n?.services?.logger?.forward) { return i18n.services.logger.forward(args, 'warn', 'react-i18next::', true); } if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`; if (i18n?.services?.logger?.warn) { i18n.services.logger.warn(...args); } else if (console?.warn) { console.warn(...args); } }; const alreadyWarned = {}; const warnOnce = (i18n, code, msg, rest)=>{ if (isString(msg) && alreadyWarned[msg]) return; if (isString(msg)) alreadyWarned[msg] = new Date(); warn(i18n, code, msg, rest); }; const loadedClb = (i18n, cb)=>()=>{ if (i18n.isInitialized) { cb(); } else { const initialized = ()=>{ setTimeout(()=>{ i18n.off('initialized', initialized); }, 0); cb(); }; i18n.on('initialized', initialized); } }; const loadNamespaces = (i18n, ns, cb)=>{ i18n.loadNamespaces(ns, loadedClb(i18n, cb)); }; const loadLanguages = (i18n, lng, ns, cb)=>{ if (isString(ns)) ns = [ ns ]; if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb); ns.forEach((n)=>{ if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n); }); i18n.loadLanguages(lng, loadedClb(i18n, cb)); }; const hasLoadedNamespace = (ns, i18n, options = {})=>{ if (!i18n.languages || !i18n.languages.length) { warnOnce(i18n, 'NO_LANGUAGES', 'i18n.languages were undefined or empty', { languages: i18n.languages }); return true; } return i18n.hasLoadedNamespace(ns, { lng: options.lng, precheck: (i18nInstance, loadNotPending)=>{ if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false; } }); }; const getDisplayName = (Component)=>Component.displayName || Component.name || (isString(Component) && Component.length > 0 ? Component : 'Unknown'); const isString = (obj)=>typeof obj === 'string'; const isObject = (obj)=>typeof obj === 'object' && obj !== null; }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/unescape.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "unescape", ()=>unescape ]); const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g; const htmlEntities = { '&': '&', '&': '&', '<': '<', '<': '<', '>': '>', '>': '>', ''': "'", ''': "'", '"': '"', '"': '"', ' ': ' ', ' ': ' ', '©': '©', '©': '©', '®': '®', '®': '®', '…': '…', '…': '…', '/': '/', '/': '/' }; const unescapeHtmlEntity = (m)=>htmlEntities[m]; const unescape = (text)=>text.replace(matchHtmlEntity, unescapeHtmlEntity); }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/defaults.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "getDefaults", ()=>getDefaults, "setDefaults", ()=>setDefaults ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$unescape$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/unescape.js [app-client] (ecmascript)"); ; let defaultOptions = { bindI18n: 'languageChanged', bindI18nStore: '', transEmptyNodeValue: '', transSupportBasicHtmlNodes: true, transWrapTextNodes: '', transKeepBasicHtmlNodesFor: [ 'br', 'strong', 'i', 'p' ], useSuspense: true, unescape: __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$unescape$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["unescape"] }; const setDefaults = (options = {})=>{ defaultOptions = { ...defaultOptions, ...options }; }; const getDefaults = ()=>defaultOptions; }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/i18nInstance.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "getI18n", ()=>getI18n, "setI18n", ()=>setI18n ]); let i18nInstance; const setI18n = (instance)=>{ i18nInstance = instance; }; const getI18n = ()=>i18nInstance; }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/TransWithoutContext.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "Trans", ()=>Trans, "nodesToString", ()=>nodesToString ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$html$2d$parse$2d$stringify$2f$dist$2f$html$2d$parse$2d$stringify$2e$module$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/html-parse-stringify/dist/html-parse-stringify.module.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/utils.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$defaults$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/defaults.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/i18nInstance.js [app-client] (ecmascript)"); ; ; ; ; ; const hasChildren = (node, checkLength)=>{ if (!node) return false; const base = node.props?.children ?? node.children; if (checkLength) return base.length > 0; return !!base; }; const getChildren = (node)=>{ if (!node) return []; const children = node.props?.children ?? node.children; return node.props?.i18nIsDynamicList ? getAsArray(children) : children; }; const hasValidReactChildren = (children)=>Array.isArray(children) && children.every(__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isValidElement"]); const getAsArray = (data)=>Array.isArray(data) ? data : [ data ]; const mergeProps = (source, target)=>{ const newTarget = { ...target }; newTarget.props = Object.assign(source.props, target.props); return newTarget; }; const nodesToString = (children, i18nOptions, i18n, i18nKey)=>{ if (!children) return ''; let stringNode = ''; const childrenArray = getAsArray(children); const keepArray = i18nOptions?.transSupportBasicHtmlNodes ? i18nOptions.transKeepBasicHtmlNodesFor ?? [] : []; childrenArray.forEach((child, childIndex)=>{ if ((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isString"])(child)) { stringNode += `${child}`; return; } if ((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isValidElement"])(child)) { const { props, type } = child; const childPropsCount = Object.keys(props).length; const shouldKeepChild = keepArray.indexOf(type) > -1; const childChildren = props.children; if (!childChildren && shouldKeepChild && !childPropsCount) { stringNode += `<${type}/>`; return; } if (!childChildren && (!shouldKeepChild || childPropsCount) || props.i18nIsDynamicList) { stringNode += `<${childIndex}>`; return; } if (shouldKeepChild && childPropsCount === 1 && (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isString"])(childChildren)) { stringNode += `<${type}>${childChildren}`; return; } const content = nodesToString(childChildren, i18nOptions, i18n, i18nKey); stringNode += `<${childIndex}>${content}`; return; } if (child === null) { (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["warn"])(i18n, 'TRANS_NULL_VALUE', `Passed in a null value as child`, { i18nKey }); return; } if ((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isObject"])(child)) { const { format, ...clone } = child; const keys = Object.keys(clone); if (keys.length === 1) { const value = format ? `${keys[0]}, ${format}` : keys[0]; stringNode += `{{${value}}}`; return; } (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["warn"])(i18n, 'TRANS_INVALID_OBJ', `Invalid child - Object should only have keys {{ value, format }} (format is optional).`, { i18nKey, child }); return; } (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["warn"])(i18n, 'TRANS_INVALID_VAR', `Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`, { i18nKey, child }); }); return stringNode; }; const renderNodes = (children, knownComponentsMap, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape)=>{ if (targetString === '') return []; const keepArray = i18nOptions.transKeepBasicHtmlNodesFor || []; const emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.map((keep)=>`<${keep}`).join('|')).test(targetString); if (!children && !knownComponentsMap && !emptyChildrenButNeedsHandling && !shouldUnescape) return [ targetString ]; const data = knownComponentsMap ?? {}; const getData = (childs)=>{ const childrenArray = getAsArray(childs); childrenArray.forEach((child)=>{ if ((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isString"])(child)) return; if (hasChildren(child)) getData(getChildren(child)); else if ((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isObject"])(child) && !(0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isValidElement"])(child)) Object.assign(data, child); }); }; getData(children); const ast = __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$html$2d$parse$2d$stringify$2f$dist$2f$html$2d$parse$2d$stringify$2e$module$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].parse(`<0>${targetString}`); const opts = { ...data, ...combinedTOpts }; const renderInner = (child, node, rootReactNode)=>{ const childs = getChildren(child); const mappedChildren = mapAST(childs, node.children, rootReactNode); return hasValidReactChildren(childs) && mappedChildren.length === 0 || child.props?.i18nIsDynamicList ? childs : mappedChildren; }; const pushTranslatedJSX = (child, inner, mem, i, isVoid)=>{ if (child.dummy) { child.children = inner; mem.push((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["cloneElement"])(child, { key: i }, isVoid ? undefined : inner)); } else { mem.push(...__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Children"].map([ child ], (c)=>{ const props = { ...c.props }; delete props.i18nIsDynamicList; return (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(c.type, { ...props, key: i, ref: c.props.ref ?? c.ref }, isVoid ? null : inner); })); } }; const mapAST = (reactNode, astNode, rootReactNode)=>{ const reactNodes = getAsArray(reactNode); const astNodes = getAsArray(astNode); return astNodes.reduce((mem, node, i)=>{ const translationContent = node.children?.[0]?.content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language); if (node.type === 'tag') { let tmp = reactNodes[parseInt(node.name, 10)]; if (!tmp && knownComponentsMap) tmp = knownComponentsMap[node.name]; if (rootReactNode.length === 1 && !tmp) tmp = rootReactNode[0][node.name]; if (!tmp) tmp = {}; const child = Object.keys(node.attrs).length !== 0 ? mergeProps({ props: node.attrs }, tmp) : tmp; const isElement = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isValidElement"])(child); const isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement; const isEmptyTransWithHTML = emptyChildrenButNeedsHandling && (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isObject"])(child) && child.dummy && !isElement; const isKnownComponent = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isObject"])(knownComponentsMap) && Object.hasOwnProperty.call(knownComponentsMap, node.name); if ((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isString"])(child)) { const value = i18n.services.interpolator.interpolate(child, opts, i18n.language); mem.push(value); } else if (hasChildren(child) || isValidTranslationWithChildren) { const inner = renderInner(child, node, rootReactNode); pushTranslatedJSX(child, inner, mem, i); } else if (isEmptyTransWithHTML) { const inner = mapAST(reactNodes, node.children, rootReactNode); pushTranslatedJSX(child, inner, mem, i); } else if (Number.isNaN(parseFloat(node.name))) { if (isKnownComponent) { const inner = renderInner(child, node, rootReactNode); pushTranslatedJSX(child, inner, mem, i, node.voidElement); } else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) { if (node.voidElement) { mem.push((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(node.name, { key: `${node.name}-${i}` })); } else { const inner = mapAST(reactNodes, node.children, rootReactNode); mem.push((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(node.name, { key: `${node.name}-${i}` }, inner)); } } else if (node.voidElement) { mem.push(`<${node.name} />`); } else { const inner = mapAST(reactNodes, node.children, rootReactNode); mem.push(`<${node.name}>${inner}`); } } else if ((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isObject"])(child) && !isElement) { const content = node.children[0] ? translationContent : null; if (content) mem.push(content); } else { pushTranslatedJSX(child, translationContent, mem, i, node.children.length !== 1 || !translationContent); } } else if (node.type === 'text') { const wrapTextNodes = i18nOptions.transWrapTextNodes; const content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language); if (wrapTextNodes) { mem.push((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(wrapTextNodes, { key: `${node.name}-${i}` }, content)); } else { mem.push(content); } } return mem; }, []); }; const result = mapAST([ { dummy: true, children: children || [] } ], ast, getAsArray(children || [])); return getChildren(result[0]); }; const fixComponentProps = (component, index, translation)=>{ const componentKey = component.key || index; const comp = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["cloneElement"])(component, { key: componentKey }); if (!comp.props || !comp.props.children || translation.indexOf(`${index}/>`) < 0 && translation.indexOf(`${index} />`) < 0) { return comp; } function Componentized() { return (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Fragment"], null, comp); } return (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(Componentized, { key: componentKey }); }; const generateArrayComponents = (components, translation)=>components.map((c, index)=>fixComponentProps(c, index, translation)); const generateObjectComponents = (components, translation)=>{ const componentMap = {}; Object.keys(components).forEach((c)=>{ Object.assign(componentMap, { [c]: fixComponentProps(components[c], c, translation) }); }); return componentMap; }; const generateComponents = (components, translation, i18n, i18nKey)=>{ if (!components) return null; if (Array.isArray(components)) { return generateArrayComponents(components, translation); } if ((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isObject"])(components)) { return generateObjectComponents(components, translation); } (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["warnOnce"])(i18n, 'TRANS_INVALID_COMPONENTS', ` "components" prop expects an object or array`, { i18nKey }); return null; }; const isComponentsMap = (object)=>{ if (!(0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isObject"])(object)) return false; if (Array.isArray(object)) return false; return Object.keys(object).reduce((acc, key)=>acc && Number.isNaN(Number.parseFloat(key)), true); }; function Trans({ children, count, parent, i18nKey, context, tOptions = {}, values, defaults, components, ns, i18n: i18nFromProps, t: tFromProps, shouldUnescape, ...additionalProps }) { const i18n = i18nFromProps || (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["getI18n"])(); if (!i18n) { (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["warnOnce"])(i18n, 'NO_I18NEXT_INSTANCE', `Trans: You need to pass in an i18next instance using i18nextReactModule`, { i18nKey }); return children; } const t = tFromProps || i18n.t.bind(i18n) || ((k)=>k); const reactI18nextOptions = { ...(0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$defaults$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["getDefaults"])(), ...i18n.options?.react }; let namespaces = ns || t.ns || i18n.options?.defaultNS; namespaces = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isString"])(namespaces) ? [ namespaces ] : namespaces || [ 'translation' ]; const nodeAsString = nodesToString(children, reactI18nextOptions, i18n, i18nKey); const defaultValue = defaults || nodeAsString || reactI18nextOptions.transEmptyNodeValue || i18nKey; const { hashTransKey } = reactI18nextOptions; const key = i18nKey || (hashTransKey ? hashTransKey(nodeAsString || defaultValue) : nodeAsString || defaultValue); if (i18n.options?.interpolation?.defaultVariables) { values = values && Object.keys(values).length > 0 ? { ...values, ...i18n.options.interpolation.defaultVariables } : { ...i18n.options.interpolation.defaultVariables }; } const interpolationOverride = values || count !== undefined && !i18n.options?.interpolation?.alwaysFormat || !children ? tOptions.interpolation : { interpolation: { ...tOptions.interpolation, prefix: '#$?', suffix: '?$#' } }; const combinedTOpts = { ...tOptions, context: context || tOptions.context, count, ...values, ...interpolationOverride, defaultValue, ns: namespaces }; const translation = key ? t(key, combinedTOpts) : defaultValue; const generatedComponents = generateComponents(components, translation, i18n, i18nKey); let indexedChildren = generatedComponents || children; let componentsMap = null; if (isComponentsMap(generatedComponents)) { componentsMap = generatedComponents; indexedChildren = children; } const content = renderNodes(indexedChildren, componentsMap, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape); const useAsParent = parent ?? reactI18nextOptions.defaultTransParent; return useAsParent ? (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(useAsParent, additionalProps, content) : content; } }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/initReactI18next.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "initReactI18next", ()=>initReactI18next ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$defaults$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/defaults.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/i18nInstance.js [app-client] (ecmascript)"); ; ; const initReactI18next = { type: '3rdParty', init (instance) { (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$defaults$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["setDefaults"])(instance.options.react); (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["setI18n"])(instance); } }; }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/context.js [app-client] (ecmascript) ", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "I18nContext", ()=>I18nContext, "ReportNamespaces", ()=>ReportNamespaces, "composeInitialProps", ()=>composeInitialProps, "getInitialProps", ()=>getInitialProps ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$defaults$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/defaults.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/i18nInstance.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$initReactI18next$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/initReactI18next.js [app-client] (ecmascript)"); ; ; ; ; ; const I18nContext = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createContext"])(); class ReportNamespaces { constructor(){ this.usedNamespaces = {}; } addUsedNamespaces(namespaces) { namespaces.forEach((ns)=>{ if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true; }); } getUsedNamespaces() { return Object.keys(this.usedNamespaces); } } const composeInitialProps = (ForComponent)=>async (ctx)=>{ const componentsInitialProps = await ForComponent.getInitialProps?.(ctx) ?? {}; const i18nInitialProps = getInitialProps(); return { ...componentsInitialProps, ...i18nInitialProps }; }; const getInitialProps = ()=>{ const i18n = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["getI18n"])(); const namespaces = i18n.reportNamespaces?.getUsedNamespaces() ?? []; const ret = {}; const initialI18nStore = {}; i18n.languages.forEach((l)=>{ initialI18nStore[l] = {}; namespaces.forEach((ns)=>{ initialI18nStore[l][ns] = i18n.getResourceBundle(l, ns) || {}; }); }); ret.initialI18nStore = initialI18nStore; ret.initialLanguage = i18n.language; return ret; }; }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/Trans.js [app-client] (ecmascript) ", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "Trans", ()=>Trans ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$TransWithoutContext$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/TransWithoutContext.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$context$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/context.js [app-client] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/i18nInstance.js [app-client] (ecmascript)"); ; ; ; ; function Trans({ children, count, parent, i18nKey, context, tOptions = {}, values, defaults, components, ns, i18n: i18nFromProps, t: tFromProps, shouldUnescape, ...additionalProps }) { const { i18n: i18nFromContext, defaultNS: defaultNSFromContext } = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useContext"])(__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$context$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__["I18nContext"]) || {}; const i18n = i18nFromProps || i18nFromContext || (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["getI18n"])(); const t = tFromProps || i18n?.t.bind(i18n); return (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$TransWithoutContext$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Trans"])({ children, count, parent, i18nKey, context, tOptions, values, defaults, components, ns: ns || t?.ns || defaultNSFromContext || i18n?.options?.defaultNS, i18n, t: tFromProps, shouldUnescape, ...additionalProps }); } }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/useTranslation.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "useTranslation", ()=>useTranslation ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$context$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/context.js [app-client] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/i18nInstance.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$defaults$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/defaults.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/utils.js [app-client] (ecmascript)"); ; ; ; const usePrevious = (value, ignore)=>{ const ref = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useRef"])(); (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useEffect"])({ "usePrevious.useEffect": ()=>{ ref.current = ignore ? ref.current : value; } }["usePrevious.useEffect"], [ value, ignore ]); return ref.current; }; const alwaysNewT = (i18n, language, namespace, keyPrefix)=>i18n.getFixedT(language, namespace, keyPrefix); const useMemoizedT = (i18n, language, namespace, keyPrefix)=>(0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useCallback"])(alwaysNewT(i18n, language, namespace, keyPrefix), [ i18n, language, namespace, keyPrefix ]); const useTranslation = (ns, props = {})=>{ const { i18n: i18nFromProps } = props; const { i18n: i18nFromContext, defaultNS: defaultNSFromContext } = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useContext"])(__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$context$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__["I18nContext"]) || {}; const i18n = i18nFromProps || i18nFromContext || (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["getI18n"])(); if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$context$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__["ReportNamespaces"](); if (!i18n) { (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["warnOnce"])(i18n, 'NO_I18NEXT_INSTANCE', 'useTranslation: You will need to pass in an i18next instance by using initReactI18next'); const notReadyT = (k, optsOrDefaultValue)=>{ if ((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isString"])(optsOrDefaultValue)) return optsOrDefaultValue; if ((0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isObject"])(optsOrDefaultValue) && (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isString"])(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue; return Array.isArray(k) ? k[k.length - 1] : k; }; const retNotReady = [ notReadyT, {}, false ]; retNotReady.t = notReadyT; retNotReady.i18n = {}; retNotReady.ready = false; return retNotReady; } if (i18n.options.react?.wait) (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["warnOnce"])(i18n, 'DEPRECATED_OPTION', 'useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.'); const i18nOptions = { ...(0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$defaults$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["getDefaults"])(), ...i18n.options.react, ...props }; const { useSuspense, keyPrefix } = i18nOptions; let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS; namespaces = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isString"])(namespaces) ? [ namespaces ] : namespaces || [ 'translation' ]; i18n.reportNamespaces.addUsedNamespaces?.(namespaces); const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n)=>(0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["hasLoadedNamespace"])(n, i18n, i18nOptions)); const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix); const getT = ()=>memoGetT; const getNewT = ()=>alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix); const [t, setT] = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useState"])(getT); let joinedNS = namespaces.join(); if (props.lng) joinedNS = `${props.lng}${joinedNS}`; const previousJoinedNS = usePrevious(joinedNS); const isMounted = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useRef"])(true); (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useEffect"])({ "useTranslation.useEffect": ()=>{ const { bindI18n, bindI18nStore } = i18nOptions; isMounted.current = true; if (!ready && !useSuspense) { if (props.lng) { (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["loadLanguages"])(i18n, props.lng, namespaces, { "useTranslation.useEffect": ()=>{ if (isMounted.current) setT(getNewT); } }["useTranslation.useEffect"]); } else { (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["loadNamespaces"])(i18n, namespaces, { "useTranslation.useEffect": ()=>{ if (isMounted.current) setT(getNewT); } }["useTranslation.useEffect"]); } } if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) { setT(getNewT); } const boundReset = { "useTranslation.useEffect.boundReset": ()=>{ if (isMounted.current) setT(getNewT); } }["useTranslation.useEffect.boundReset"]; if (bindI18n) i18n?.on(bindI18n, boundReset); if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset); return ({ "useTranslation.useEffect": ()=>{ isMounted.current = false; if (i18n && bindI18n) bindI18n?.split(' ').forEach({ "useTranslation.useEffect": (e)=>i18n.off(e, boundReset) }["useTranslation.useEffect"]); if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach({ "useTranslation.useEffect": (e)=>i18n.store.off(e, boundReset) }["useTranslation.useEffect"]); } })["useTranslation.useEffect"]; } }["useTranslation.useEffect"], [ i18n, joinedNS ]); (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useEffect"])({ "useTranslation.useEffect": ()=>{ if (isMounted.current && ready) { setT(getT); } } }["useTranslation.useEffect"], [ i18n, keyPrefix, ready ]); const ret = [ t, i18n, ready ]; ret.t = t; ret.i18n = i18n; ret.ready = ready; if (ready) return ret; if (!ready && !useSuspense) return ret; throw new Promise((resolve)=>{ if (props.lng) { (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["loadLanguages"])(i18n, props.lng, namespaces, ()=>resolve()); } else { (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["loadNamespaces"])(i18n, namespaces, ()=>resolve()); } }); }; }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/withTranslation.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "withTranslation", ()=>withTranslation ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$useTranslation$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/useTranslation.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/utils.js [app-client] (ecmascript)"); ; ; ; const withTranslation = (ns, options = {})=>function Extend(WrappedComponent) { function I18nextWithTranslation({ forwardedRef, ...rest }) { const [t, i18n, ready] = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$useTranslation$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useTranslation"])(ns, { ...rest, keyPrefix: options.keyPrefix }); const passDownProps = { ...rest, t, i18n, tReady: ready }; if (options.withRef && forwardedRef) { passDownProps.ref = forwardedRef; } else if (!options.withRef && forwardedRef) { passDownProps.forwardedRef = forwardedRef; } return (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(WrappedComponent, passDownProps); } I18nextWithTranslation.displayName = `withI18nextTranslation(${(0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["getDisplayName"])(WrappedComponent)})`; I18nextWithTranslation.WrappedComponent = WrappedComponent; const forwardRef = (props, ref)=>(0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(I18nextWithTranslation, Object.assign({}, props, { forwardedRef: ref })); return options.withRef ? (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["forwardRef"])(forwardRef) : I18nextWithTranslation; }; }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/Translation.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "Translation", ()=>Translation ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$useTranslation$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/useTranslation.js [app-client] (ecmascript)"); ; const Translation = ({ ns, children, ...options })=>{ const [t, i18n, ready] = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$useTranslation$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useTranslation"])(ns, options); return children(t, { i18n, lng: i18n.language }, ready); }; }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/I18nextProvider.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "I18nextProvider", ()=>I18nextProvider ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$context$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/context.js [app-client] (ecmascript) "); ; ; function I18nextProvider({ i18n, defaultNS, children }) { const value = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useMemo"])({ "I18nextProvider.useMemo[value]": ()=>({ i18n, defaultNS }) }["I18nextProvider.useMemo[value]"], [ i18n, defaultNS ]); return (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$context$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__["I18nContext"].Provider, { value }, children); } }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/useSSR.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "useSSR", ()=>useSSR ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$context$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/context.js [app-client] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/i18nInstance.js [app-client] (ecmascript)"); ; ; const useSSR = (initialI18nStore, initialLanguage, props = {})=>{ const { i18n: i18nFromProps } = props; const { i18n: i18nFromContext } = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useContext"])(__TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$context$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__["I18nContext"]) || {}; const i18n = i18nFromProps || i18nFromContext || (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["getI18n"])(); if (i18n.options?.isClone) return; if (initialI18nStore && !i18n.initializedStoreOnce) { i18n.services.resourceStore.data = initialI18nStore; i18n.options.ns = Object.values(initialI18nStore).reduce((mem, lngResources)=>{ Object.keys(lngResources).forEach((ns)=>{ if (mem.indexOf(ns) < 0) mem.push(ns); }); return mem; }, i18n.options.ns); i18n.initializedStoreOnce = true; i18n.isInitialized = true; } if (initialLanguage && !i18n.initializedLanguageOnce) { i18n.changeLanguage(initialLanguage); i18n.initializedLanguageOnce = true; } }; }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/withSSR.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "withSSR", ()=>withSSR ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$useSSR$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/useSSR.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$context$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/context.js [app-client] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/utils.js [app-client] (ecmascript)"); ; ; ; ; const withSSR = ()=>function Extend(WrappedComponent) { function I18nextWithSSR({ initialI18nStore, initialLanguage, ...rest }) { (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$useSSR$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useSSR"])(initialI18nStore, initialLanguage); return (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(WrappedComponent, { ...rest }); } I18nextWithSSR.getInitialProps = (0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$context$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__["composeInitialProps"])(WrappedComponent); I18nextWithSSR.displayName = `withI18nextSSR(${(0, __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["getDisplayName"])(WrappedComponent)})`; I18nextWithSSR.WrappedComponent = WrappedComponent; return I18nextWithSSR; }; }), "[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/index.js [app-client] (ecmascript) ", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "date", ()=>date, "number", ()=>number, "plural", ()=>plural, "select", ()=>select, "selectOrdinal", ()=>selectOrdinal, "time", ()=>time ]); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$Trans$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/Trans.js [app-client] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$TransWithoutContext$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/TransWithoutContext.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$useTranslation$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/useTranslation.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$withTranslation$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/withTranslation.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$Translation$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/Translation.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$I18nextProvider$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/I18nextProvider.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$withSSR$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/withSSR.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$useSSR$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/useSSR.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$initReactI18next$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/initReactI18next.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$defaults$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/defaults.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$i18nInstance$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/i18nInstance.js [app-client] (ecmascript)"); var __TURBOPACK__imported__module__$5b$project$5d2f$coding$2f$projects$2f$LangBot$2f$web$2f$node_modules$2f$react$2d$i18next$2f$dist$2f$es$2f$context$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__$3c$locals$3e$__ = __turbopack_context__.i("[project]/coding/projects/LangBot/web/node_modules/react-i18next/dist/es/context.js [app-client] (ecmascript) "); ; ; ; ; ; ; ; ; ; ; ; ; const date = ()=>''; const time = ()=>''; const number = ()=>''; const select = ()=>''; const plural = ()=>''; const selectOrdinal = ()=>''; }), "[project]/coding/projects/LangBot/web/node_modules/i18next-browser-languagedetector/dist/esm/i18nextBrowserLanguageDetector.js [app-client] (ecmascript)", ((__turbopack_context__) => { "use strict"; __turbopack_context__.s([ "default", ()=>Browser ]); const { slice, forEach } = []; function defaults(obj) { forEach.call(slice.call(arguments, 1), (source)=>{ if (source) { for(const prop in source){ if (obj[prop] === undefined) obj[prop] = source[prop]; } } }); return obj; } function hasXSS(input) { if (typeof input !== 'string') return false; // Common XSS attack patterns const xssPatterns = [ /<\s*script.*?>/i, /<\s*\/\s*script\s*>/i, /<\s*img.*?on\w+\s*=/i, /<\s*\w+\s*on\w+\s*=.*?>/i, /javascript\s*:/i, /vbscript\s*:/i, /expression\s*\(/i, /eval\s*\(/i, /alert\s*\(/i, /document\.cookie/i, /document\.write\s*\(/i, /window\.location/i, /innerHTML/i ]; return xssPatterns.some((pattern)=>pattern.test(input)); } // eslint-disable-next-line no-control-regex const fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; const serializeCookie = function(name, val) { let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { path: '/' }; const opt = options; const value = encodeURIComponent(val); let str = `${name}=${value}`; if (opt.maxAge > 0) { const maxAge = opt.maxAge - 0; if (Number.isNaN(maxAge)) throw new Error('maxAge should be a Number'); str += `; Max-Age=${Math.floor(maxAge)}`; } if (opt.domain) { if (!fieldContentRegExp.test(opt.domain)) { throw new TypeError('option domain is invalid'); } str += `; Domain=${opt.domain}`; } if (opt.path) { if (!fieldContentRegExp.test(opt.path)) { throw new TypeError('option path is invalid'); } str += `; Path=${opt.path}`; } if (opt.expires) { if (typeof opt.expires.toUTCString !== 'function') { throw new TypeError('option expires is invalid'); } str += `; Expires=${opt.expires.toUTCString()}`; } if (opt.httpOnly) str += '; HttpOnly'; if (opt.secure) str += '; Secure'; if (opt.sameSite) { const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite; switch(sameSite){ case true: str += '; SameSite=Strict'; break; case 'lax': str += '; SameSite=Lax'; break; case 'strict': str += '; SameSite=Strict'; break; case 'none': str += '; SameSite=None'; break; default: throw new TypeError('option sameSite is invalid'); } } if (opt.partitioned) str += '; Partitioned'; return str; }; const cookie = { create (name, value, minutes, domain) { let cookieOptions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : { path: '/', sameSite: 'strict' }; if (minutes) { cookieOptions.expires = new Date(); cookieOptions.expires.setTime(cookieOptions.expires.getTime() + minutes * 60 * 1000); } if (domain) cookieOptions.domain = domain; document.cookie = serializeCookie(name, value, cookieOptions); }, read (name) { const nameEQ = `${name}=`; const ca = document.cookie.split(';'); for(let i = 0; i < ca.length; i++){ let c = ca[i]; while(c.charAt(0) === ' ')c = c.substring(1, c.length); if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length); } return null; }, remove (name, domain) { this.create(name, '', -1, domain); } }; var cookie$1 = { name: 'cookie', // Deconstruct the options object and extract the lookupCookie property lookup (_ref) { let { lookupCookie } = _ref; if (lookupCookie && typeof document !== 'undefined') { return cookie.read(lookupCookie) || undefined; } return undefined; }, // Deconstruct the options object and extract the lookupCookie, cookieMinutes, cookieDomain, and cookieOptions properties cacheUserLanguage (lng, _ref2) { let { lookupCookie, cookieMinutes, cookieDomain, cookieOptions } = _ref2; if (lookupCookie && typeof document !== 'undefined') { cookie.create(lookupCookie, lng, cookieMinutes, cookieDomain, cookieOptions); } } }; var querystring = { name: 'querystring', // Deconstruct the options object and extract the lookupQuerystring property lookup (_ref) { let { lookupQuerystring } = _ref; let found; if (typeof window !== 'undefined') { let { search } = window.location; if (!window.location.search && window.location.hash?.indexOf('?') > -1) { search = window.location.hash.substring(window.location.hash.indexOf('?')); } const query = search.substring(1); const params = query.split('&'); for(let i = 0; i < params.length; i++){ const pos = params[i].indexOf('='); if (pos > 0) { const key = params[i].substring(0, pos); if (key === lookupQuerystring) { found = params[i].substring(pos + 1); } } } } return found; } }; var hash = { name: 'hash', // Deconstruct the options object and extract the lookupHash property and the lookupFromHashIndex property lookup (_ref) { let { lookupHash, lookupFromHashIndex } = _ref; let found; if (typeof window !== 'undefined') { const { hash } = window.location; if (hash && hash.length > 2) { const query = hash.substring(1); if (lookupHash) { const params = query.split('&'); for(let i = 0; i < params.length; i++){ const pos = params[i].indexOf('='); if (pos > 0) { const key = params[i].substring(0, pos); if (key === lookupHash) { found = params[i].substring(pos + 1); } } } } if (found) return found; if (!found && lookupFromHashIndex > -1) { const language = hash.match(/\/([a-zA-Z-]*)/g); if (!Array.isArray(language)) return undefined; const index = typeof lookupFromHashIndex === 'number' ? lookupFromHashIndex : 0; return language[index]?.replace('/', ''); } } } return found; } }; let hasLocalStorageSupport = null; const localStorageAvailable = ()=>{ if (hasLocalStorageSupport !== null) return hasLocalStorageSupport; try { hasLocalStorageSupport = typeof window !== 'undefined' && window.localStorage !== null; if (!hasLocalStorageSupport) { return false; } const testKey = 'i18next.translate.boo'; window.localStorage.setItem(testKey, 'foo'); window.localStorage.removeItem(testKey); } catch (e) { hasLocalStorageSupport = false; } return hasLocalStorageSupport; }; var localStorage = { name: 'localStorage', // Deconstruct the options object and extract the lookupLocalStorage property lookup (_ref) { let { lookupLocalStorage } = _ref; if (lookupLocalStorage && localStorageAvailable()) { return window.localStorage.getItem(lookupLocalStorage) || undefined; // Undefined ensures type consistency with the previous version of this function } return undefined; }, // Deconstruct the options object and extract the lookupLocalStorage property cacheUserLanguage (lng, _ref2) { let { lookupLocalStorage } = _ref2; if (lookupLocalStorage && localStorageAvailable()) { window.localStorage.setItem(lookupLocalStorage, lng); } } }; let hasSessionStorageSupport = null; const sessionStorageAvailable = ()=>{ if (hasSessionStorageSupport !== null) return hasSessionStorageSupport; try { hasSessionStorageSupport = typeof window !== 'undefined' && window.sessionStorage !== null; if (!hasSessionStorageSupport) { return false; } const testKey = 'i18next.translate.boo'; window.sessionStorage.setItem(testKey, 'foo'); window.sessionStorage.removeItem(testKey); } catch (e) { hasSessionStorageSupport = false; } return hasSessionStorageSupport; }; var sessionStorage = { name: 'sessionStorage', lookup (_ref) { let { lookupSessionStorage } = _ref; if (lookupSessionStorage && sessionStorageAvailable()) { return window.sessionStorage.getItem(lookupSessionStorage) || undefined; } return undefined; }, cacheUserLanguage (lng, _ref2) { let { lookupSessionStorage } = _ref2; if (lookupSessionStorage && sessionStorageAvailable()) { window.sessionStorage.setItem(lookupSessionStorage, lng); } } }; var navigator$1 = { name: 'navigator', lookup (options) { const found = []; if (typeof navigator !== 'undefined') { const { languages, userLanguage, language } = navigator; if (languages) { // chrome only; not an array, so can't use .push.apply instead of iterating for(let i = 0; i < languages.length; i++){ found.push(languages[i]); } } if (userLanguage) { found.push(userLanguage); } if (language) { found.push(language); } } return found.length > 0 ? found : undefined; } }; var htmlTag = { name: 'htmlTag', // Deconstruct the options object and extract the htmlTag property lookup (_ref) { let { htmlTag } = _ref; let found; const internalHtmlTag = htmlTag || (typeof document !== 'undefined' ? document.documentElement : null); if (internalHtmlTag && typeof internalHtmlTag.getAttribute === 'function') { found = internalHtmlTag.getAttribute('lang'); } return found; } }; var path = { name: 'path', // Deconstruct the options object and extract the lookupFromPathIndex property lookup (_ref) { let { lookupFromPathIndex } = _ref; if (typeof window === 'undefined') return undefined; const language = window.location.pathname.match(/\/([a-zA-Z-]*)/g); if (!Array.isArray(language)) return undefined; const index = typeof lookupFromPathIndex === 'number' ? lookupFromPathIndex : 0; return language[index]?.replace('/', ''); } }; var subdomain = { name: 'subdomain', lookup (_ref) { let { lookupFromSubdomainIndex } = _ref; // If given get the subdomain index else 1 const internalLookupFromSubdomainIndex = typeof lookupFromSubdomainIndex === 'number' ? lookupFromSubdomainIndex + 1 : 1; // get all matches if window.location. is existing // first item of match is the match itself and the second is the first group match which should be the first subdomain match // is the hostname no public domain get the or option of localhost const language = typeof window !== 'undefined' && window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i); // if there is no match (null) return undefined if (!language) return undefined; // return the given group match return language[internalLookupFromSubdomainIndex]; } }; // some environments, throws when accessing document.cookie let canCookies = false; try { // eslint-disable-next-line no-unused-expressions document.cookie; canCookies = true; // eslint-disable-next-line no-empty } catch (e) {} const order = [ 'querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator', 'htmlTag' ]; if (!canCookies) order.splice(1, 1); const getDefaults = ()=>({ order, lookupQuerystring: 'lng', lookupCookie: 'i18next', lookupLocalStorage: 'i18nextLng', lookupSessionStorage: 'i18nextLng', // cache user language caches: [ 'localStorage' ], excludeCacheFor: [ 'cimode' ], // cookieMinutes: 10, // cookieDomain: 'myDomain' convertDetectedLanguage: (l)=>l }); class Browser { constructor(services){ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; this.type = 'languageDetector'; this.detectors = {}; this.init(services, options); } init() { let services = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { languageUtils: {} }; let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; let i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; this.services = services; this.options = defaults(options, this.options || {}, getDefaults()); if (typeof this.options.convertDetectedLanguage === 'string' && this.options.convertDetectedLanguage.indexOf('15897') > -1) { this.options.convertDetectedLanguage = (l)=>l.replace('-', '_'); } // backwards compatibility if (this.options.lookupFromUrlIndex) this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex; this.i18nOptions = i18nOptions; this.addDetector(cookie$1); this.addDetector(querystring); this.addDetector(localStorage); this.addDetector(sessionStorage); this.addDetector(navigator$1); this.addDetector(htmlTag); this.addDetector(path); this.addDetector(subdomain); this.addDetector(hash); } addDetector(detector) { this.detectors[detector.name] = detector; return this; } detect() { let detectionOrder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.order; let detected = []; detectionOrder.forEach((detectorName)=>{ if (this.detectors[detectorName]) { let lookup = this.detectors[detectorName].lookup(this.options); if (lookup && typeof lookup === 'string') lookup = [ lookup ]; if (lookup) detected = detected.concat(lookup); } }); detected = detected.filter((d)=>d !== undefined && d !== null && !hasXSS(d)).map((d)=>this.options.convertDetectedLanguage(d)); if (this.services && this.services.languageUtils && this.services.languageUtils.getBestMatchFromCodes) return detected; // new i18next v19.5.0 return detected.length > 0 ? detected[0] : null; // a little backward compatibility } cacheUserLanguage(lng) { let caches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.caches; if (!caches) return; if (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(lng) > -1) return; caches.forEach((cacheName)=>{ if (this.detectors[cacheName]) this.detectors[cacheName].cacheUserLanguage(lng, this.options); }); } } Browser.type = 'languageDetector'; ; }), ]); //# sourceMappingURL=a2e30_01bb37b3._.js.map