@embedreach/components 0.1.23 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import React__default, { createContext as createContext$1, Component, useContext as useContext$1, useCallback, useState, useRef, useEffect, useMemo, createElement as createElement$1, useReducer, forwardRef, useId as useId$2, useInsertionEffect, Children, isValidElement, useLayoutEffect, Fragment as Fragment$1, cloneElement } from "react";
3
+ import React__default, { createContext as createContext$1, Component, useReducer, useMemo, useEffect, useContext as useContext$1, useCallback, useState, useRef, createElement as createElement$1, forwardRef, useId as useId$2, useInsertionEffect, Children, isValidElement, useLayoutEffect, Fragment as Fragment$1, cloneElement } from "react";
4
4
  import * as ReactDOM from "react-dom";
5
5
  import ReactDOM__default, { flushSync } from "react-dom";
6
6
  var Subscribable = class {
@@ -7763,241 +7763,6 @@ let D$2 = class D extends Component {
7763
7763
  return React__default.createElement(a4.Provider, { value: { flags: e4, flagKeyMap: r2, ldClient: n2, error: o2 } }, this.props.children);
7764
7764
  }
7765
7765
  };
7766
- const warn = (...args) => {
7767
- if (console?.warn) {
7768
- if (isString$1(args[0])) args[0] = `react-i18next:: ${args[0]}`;
7769
- console.warn(...args);
7770
- }
7771
- };
7772
- const alreadyWarned$1 = {};
7773
- const warnOnce$1 = (...args) => {
7774
- if (isString$1(args[0]) && alreadyWarned$1[args[0]]) return;
7775
- if (isString$1(args[0])) alreadyWarned$1[args[0]] = /* @__PURE__ */ new Date();
7776
- warn(...args);
7777
- };
7778
- const loadedClb = (i18n, cb) => () => {
7779
- if (i18n.isInitialized) {
7780
- cb();
7781
- } else {
7782
- const initialized = () => {
7783
- setTimeout(() => {
7784
- i18n.off("initialized", initialized);
7785
- }, 0);
7786
- cb();
7787
- };
7788
- i18n.on("initialized", initialized);
7789
- }
7790
- };
7791
- const loadNamespaces = (i18n, ns, cb) => {
7792
- i18n.loadNamespaces(ns, loadedClb(i18n, cb));
7793
- };
7794
- const loadLanguages = (i18n, lng, ns, cb) => {
7795
- if (isString$1(ns)) ns = [ns];
7796
- if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
7797
- ns.forEach((n2) => {
7798
- if (i18n.options.ns.indexOf(n2) < 0) i18n.options.ns.push(n2);
7799
- });
7800
- i18n.loadLanguages(lng, loadedClb(i18n, cb));
7801
- };
7802
- const hasLoadedNamespace = (ns, i18n, options = {}) => {
7803
- if (!i18n.languages || !i18n.languages.length) {
7804
- warnOnce$1("i18n.languages were undefined or empty", i18n.languages);
7805
- return true;
7806
- }
7807
- return i18n.hasLoadedNamespace(ns, {
7808
- lng: options.lng,
7809
- precheck: (i18nInstance2, loadNotPending) => {
7810
- if (options.bindI18n?.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
7811
- }
7812
- });
7813
- };
7814
- const isString$1 = (obj) => typeof obj === "string";
7815
- const isObject = (obj) => typeof obj === "object" && obj !== null;
7816
- const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
7817
- const htmlEntities = {
7818
- "&amp;": "&",
7819
- "&#38;": "&",
7820
- "&lt;": "<",
7821
- "&#60;": "<",
7822
- "&gt;": ">",
7823
- "&#62;": ">",
7824
- "&apos;": "'",
7825
- "&#39;": "'",
7826
- "&quot;": '"',
7827
- "&#34;": '"',
7828
- "&nbsp;": " ",
7829
- "&#160;": " ",
7830
- "&copy;": "©",
7831
- "&#169;": "©",
7832
- "&reg;": "®",
7833
- "&#174;": "®",
7834
- "&hellip;": "…",
7835
- "&#8230;": "…",
7836
- "&#x2F;": "/",
7837
- "&#47;": "/"
7838
- };
7839
- const unescapeHtmlEntity = (m4) => htmlEntities[m4];
7840
- const unescape$1 = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
7841
- let defaultOptions$2 = {
7842
- bindI18n: "languageChanged",
7843
- bindI18nStore: "",
7844
- transEmptyNodeValue: "",
7845
- transSupportBasicHtmlNodes: true,
7846
- transWrapTextNodes: "",
7847
- transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
7848
- useSuspense: true,
7849
- unescape: unescape$1
7850
- };
7851
- const setDefaults = (options = {}) => {
7852
- defaultOptions$2 = {
7853
- ...defaultOptions$2,
7854
- ...options
7855
- };
7856
- };
7857
- const getDefaults$1 = () => defaultOptions$2;
7858
- let i18nInstance;
7859
- const setI18n = (instance2) => {
7860
- i18nInstance = instance2;
7861
- };
7862
- const getI18n = () => i18nInstance;
7863
- const initReactI18next = {
7864
- type: "3rdParty",
7865
- init(instance2) {
7866
- setDefaults(instance2.options.react);
7867
- setI18n(instance2);
7868
- }
7869
- };
7870
- const I18nContext = createContext$1();
7871
- class ReportNamespaces {
7872
- constructor() {
7873
- this.usedNamespaces = {};
7874
- }
7875
- addUsedNamespaces(namespaces) {
7876
- namespaces.forEach((ns) => {
7877
- if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
7878
- });
7879
- }
7880
- getUsedNamespaces() {
7881
- return Object.keys(this.usedNamespaces);
7882
- }
7883
- }
7884
- const usePrevious$1 = (value, ignore) => {
7885
- const ref = useRef();
7886
- useEffect(() => {
7887
- ref.current = value;
7888
- }, [value, ignore]);
7889
- return ref.current;
7890
- };
7891
- const alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
7892
- const useMemoizedT = (i18n, language, namespace, keyPrefix) => useCallback(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
7893
- const useTranslation = (ns, props = {}) => {
7894
- const {
7895
- i18n: i18nFromProps
7896
- } = props;
7897
- const {
7898
- i18n: i18nFromContext,
7899
- defaultNS: defaultNSFromContext
7900
- } = useContext$1(I18nContext) || {};
7901
- const i18n = i18nFromProps || i18nFromContext || getI18n();
7902
- if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
7903
- if (!i18n) {
7904
- warnOnce$1("You will need to pass in an i18next instance by using initReactI18next");
7905
- const notReadyT = (k3, optsOrDefaultValue) => {
7906
- if (isString$1(optsOrDefaultValue)) return optsOrDefaultValue;
7907
- if (isObject(optsOrDefaultValue) && isString$1(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
7908
- return Array.isArray(k3) ? k3[k3.length - 1] : k3;
7909
- };
7910
- const retNotReady = [notReadyT, {}, false];
7911
- retNotReady.t = notReadyT;
7912
- retNotReady.i18n = {};
7913
- retNotReady.ready = false;
7914
- return retNotReady;
7915
- }
7916
- if (i18n.options.react?.wait) warnOnce$1("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
7917
- const i18nOptions = {
7918
- ...getDefaults$1(),
7919
- ...i18n.options.react,
7920
- ...props
7921
- };
7922
- const {
7923
- useSuspense,
7924
- keyPrefix
7925
- } = i18nOptions;
7926
- let namespaces = defaultNSFromContext || i18n.options?.defaultNS;
7927
- namespaces = isString$1(namespaces) ? [namespaces] : namespaces || ["translation"];
7928
- i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
7929
- const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n2) => hasLoadedNamespace(n2, i18n, i18nOptions));
7930
- const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
7931
- const getT = () => memoGetT;
7932
- const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
7933
- const [t3, setT] = useState(getT);
7934
- let joinedNS = namespaces.join();
7935
- if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
7936
- const previousJoinedNS = usePrevious$1(joinedNS);
7937
- const isMounted = useRef(true);
7938
- useEffect(() => {
7939
- const {
7940
- bindI18n,
7941
- bindI18nStore
7942
- } = i18nOptions;
7943
- isMounted.current = true;
7944
- if (!ready && !useSuspense) {
7945
- if (props.lng) {
7946
- loadLanguages(i18n, props.lng, namespaces, () => {
7947
- if (isMounted.current) setT(getNewT);
7948
- });
7949
- } else {
7950
- loadNamespaces(i18n, namespaces, () => {
7951
- if (isMounted.current) setT(getNewT);
7952
- });
7953
- }
7954
- }
7955
- if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
7956
- setT(getNewT);
7957
- }
7958
- const boundReset = () => {
7959
- if (isMounted.current) setT(getNewT);
7960
- };
7961
- if (bindI18n) i18n?.on(bindI18n, boundReset);
7962
- if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
7963
- return () => {
7964
- isMounted.current = false;
7965
- if (i18n) bindI18n?.split(" ").forEach((e4) => i18n.off(e4, boundReset));
7966
- if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach((e4) => i18n.store.off(e4, boundReset));
7967
- };
7968
- }, [i18n, joinedNS]);
7969
- useEffect(() => {
7970
- if (isMounted.current && ready) {
7971
- setT(getT);
7972
- }
7973
- }, [i18n, keyPrefix, ready]);
7974
- const ret = [t3, i18n, ready];
7975
- ret.t = t3;
7976
- ret.i18n = i18n;
7977
- ret.ready = ready;
7978
- if (ready) return ret;
7979
- if (!ready && !useSuspense) return ret;
7980
- throw new Promise((resolve) => {
7981
- if (props.lng) {
7982
- loadLanguages(i18n, props.lng, namespaces, () => resolve());
7983
- } else {
7984
- loadNamespaces(i18n, namespaces, () => resolve());
7985
- }
7986
- });
7987
- };
7988
- function I18nextProvider({
7989
- i18n,
7990
- defaultNS,
7991
- children: children2
7992
- }) {
7993
- const value = useMemo(() => ({
7994
- i18n,
7995
- defaultNS
7996
- }), [i18n, defaultNS]);
7997
- return createElement$1(I18nContext.Provider, {
7998
- value
7999
- }, children2);
8000
- }
8001
7766
  let EventEmitter$1 = class EventEmitter {
8002
7767
  handlers = /* @__PURE__ */ new Map();
8003
7768
  /**
@@ -8405,28 +8170,241 @@ const { Context, Provider: Provider$2 } = createDataContext(
8405
8170
  error: null
8406
8171
  }
8407
8172
  );
8408
- const useThemeContext = () => {
8409
- const context = useContext$1(Context);
8410
- if (context === void 0) {
8411
- throw new Error("useThemeContext must be used within a ThemeProvider");
8173
+ const warn = (...args) => {
8174
+ if (console?.warn) {
8175
+ if (isString$1(args[0])) args[0] = `react-i18next:: ${args[0]}`;
8176
+ console.warn(...args);
8412
8177
  }
8413
- const applyTheme = (themeConfig) => {
8414
- if (!themeConfig) return;
8415
- const mergedStyles = mergeThemeStyles(themeConfig);
8416
- const finalTheme = {
8417
- styles: mergedStyles
8178
+ };
8179
+ const alreadyWarned$1 = {};
8180
+ const warnOnce$1 = (...args) => {
8181
+ if (isString$1(args[0]) && alreadyWarned$1[args[0]]) return;
8182
+ if (isString$1(args[0])) alreadyWarned$1[args[0]] = /* @__PURE__ */ new Date();
8183
+ warn(...args);
8184
+ };
8185
+ const loadedClb = (i18n, cb) => () => {
8186
+ if (i18n.isInitialized) {
8187
+ cb();
8188
+ } else {
8189
+ const initialized = () => {
8190
+ setTimeout(() => {
8191
+ i18n.off("initialized", initialized);
8192
+ }, 0);
8193
+ cb();
8418
8194
  };
8419
- context.setTheme(finalTheme);
8195
+ i18n.on("initialized", initialized);
8196
+ }
8197
+ };
8198
+ const loadNamespaces = (i18n, ns, cb) => {
8199
+ i18n.loadNamespaces(ns, loadedClb(i18n, cb));
8200
+ };
8201
+ const loadLanguages = (i18n, lng, ns, cb) => {
8202
+ if (isString$1(ns)) ns = [ns];
8203
+ if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
8204
+ ns.forEach((n2) => {
8205
+ if (i18n.options.ns.indexOf(n2) < 0) i18n.options.ns.push(n2);
8206
+ });
8207
+ i18n.loadLanguages(lng, loadedClb(i18n, cb));
8208
+ };
8209
+ const hasLoadedNamespace = (ns, i18n, options = {}) => {
8210
+ if (!i18n.languages || !i18n.languages.length) {
8211
+ warnOnce$1("i18n.languages were undefined or empty", i18n.languages);
8212
+ return true;
8213
+ }
8214
+ return i18n.hasLoadedNamespace(ns, {
8215
+ lng: options.lng,
8216
+ precheck: (i18nInstance2, loadNotPending) => {
8217
+ if (options.bindI18n?.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
8218
+ }
8219
+ });
8220
+ };
8221
+ const isString$1 = (obj) => typeof obj === "string";
8222
+ const isObject = (obj) => typeof obj === "object" && obj !== null;
8223
+ const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
8224
+ const htmlEntities = {
8225
+ "&amp;": "&",
8226
+ "&#38;": "&",
8227
+ "&lt;": "<",
8228
+ "&#60;": "<",
8229
+ "&gt;": ">",
8230
+ "&#62;": ">",
8231
+ "&apos;": "'",
8232
+ "&#39;": "'",
8233
+ "&quot;": '"',
8234
+ "&#34;": '"',
8235
+ "&nbsp;": " ",
8236
+ "&#160;": " ",
8237
+ "&copy;": "©",
8238
+ "&#169;": "©",
8239
+ "&reg;": "®",
8240
+ "&#174;": "®",
8241
+ "&hellip;": "…",
8242
+ "&#8230;": "…",
8243
+ "&#x2F;": "/",
8244
+ "&#47;": "/"
8245
+ };
8246
+ const unescapeHtmlEntity = (m4) => htmlEntities[m4];
8247
+ const unescape$1 = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
8248
+ let defaultOptions$2 = {
8249
+ bindI18n: "languageChanged",
8250
+ bindI18nStore: "",
8251
+ transEmptyNodeValue: "",
8252
+ transSupportBasicHtmlNodes: true,
8253
+ transWrapTextNodes: "",
8254
+ transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
8255
+ useSuspense: true,
8256
+ unescape: unescape$1
8257
+ };
8258
+ const setDefaults = (options = {}) => {
8259
+ defaultOptions$2 = {
8260
+ ...defaultOptions$2,
8261
+ ...options
8420
8262
  };
8421
- return {
8422
- ...context.state,
8423
- setTheme: context.setTheme,
8424
- setLoading: context.setLoading,
8425
- setError: context.setError,
8426
- // Add the helper function
8427
- applyTheme
8263
+ };
8264
+ const getDefaults$1 = () => defaultOptions$2;
8265
+ let i18nInstance;
8266
+ const setI18n = (instance2) => {
8267
+ i18nInstance = instance2;
8268
+ };
8269
+ const getI18n = () => i18nInstance;
8270
+ const initReactI18next = {
8271
+ type: "3rdParty",
8272
+ init(instance2) {
8273
+ setDefaults(instance2.options.react);
8274
+ setI18n(instance2);
8275
+ }
8276
+ };
8277
+ const I18nContext = createContext$1();
8278
+ class ReportNamespaces {
8279
+ constructor() {
8280
+ this.usedNamespaces = {};
8281
+ }
8282
+ addUsedNamespaces(namespaces) {
8283
+ namespaces.forEach((ns) => {
8284
+ if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
8285
+ });
8286
+ }
8287
+ getUsedNamespaces() {
8288
+ return Object.keys(this.usedNamespaces);
8289
+ }
8290
+ }
8291
+ const usePrevious$1 = (value, ignore) => {
8292
+ const ref = useRef();
8293
+ useEffect(() => {
8294
+ ref.current = value;
8295
+ }, [value, ignore]);
8296
+ return ref.current;
8297
+ };
8298
+ const alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
8299
+ const useMemoizedT = (i18n, language, namespace, keyPrefix) => useCallback(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
8300
+ const useTranslation = (ns, props = {}) => {
8301
+ const {
8302
+ i18n: i18nFromProps
8303
+ } = props;
8304
+ const {
8305
+ i18n: i18nFromContext,
8306
+ defaultNS: defaultNSFromContext
8307
+ } = useContext$1(I18nContext) || {};
8308
+ const i18n = i18nFromProps || i18nFromContext || getI18n();
8309
+ if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
8310
+ if (!i18n) {
8311
+ warnOnce$1("You will need to pass in an i18next instance by using initReactI18next");
8312
+ const notReadyT = (k3, optsOrDefaultValue) => {
8313
+ if (isString$1(optsOrDefaultValue)) return optsOrDefaultValue;
8314
+ if (isObject(optsOrDefaultValue) && isString$1(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
8315
+ return Array.isArray(k3) ? k3[k3.length - 1] : k3;
8316
+ };
8317
+ const retNotReady = [notReadyT, {}, false];
8318
+ retNotReady.t = notReadyT;
8319
+ retNotReady.i18n = {};
8320
+ retNotReady.ready = false;
8321
+ return retNotReady;
8322
+ }
8323
+ if (i18n.options.react?.wait) warnOnce$1("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
8324
+ const i18nOptions = {
8325
+ ...getDefaults$1(),
8326
+ ...i18n.options.react,
8327
+ ...props
8428
8328
  };
8329
+ const {
8330
+ useSuspense,
8331
+ keyPrefix
8332
+ } = i18nOptions;
8333
+ let namespaces = defaultNSFromContext || i18n.options?.defaultNS;
8334
+ namespaces = isString$1(namespaces) ? [namespaces] : namespaces || ["translation"];
8335
+ i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
8336
+ const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n2) => hasLoadedNamespace(n2, i18n, i18nOptions));
8337
+ const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
8338
+ const getT = () => memoGetT;
8339
+ const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
8340
+ const [t3, setT] = useState(getT);
8341
+ let joinedNS = namespaces.join();
8342
+ if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
8343
+ const previousJoinedNS = usePrevious$1(joinedNS);
8344
+ const isMounted = useRef(true);
8345
+ useEffect(() => {
8346
+ const {
8347
+ bindI18n,
8348
+ bindI18nStore
8349
+ } = i18nOptions;
8350
+ isMounted.current = true;
8351
+ if (!ready && !useSuspense) {
8352
+ if (props.lng) {
8353
+ loadLanguages(i18n, props.lng, namespaces, () => {
8354
+ if (isMounted.current) setT(getNewT);
8355
+ });
8356
+ } else {
8357
+ loadNamespaces(i18n, namespaces, () => {
8358
+ if (isMounted.current) setT(getNewT);
8359
+ });
8360
+ }
8361
+ }
8362
+ if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
8363
+ setT(getNewT);
8364
+ }
8365
+ const boundReset = () => {
8366
+ if (isMounted.current) setT(getNewT);
8367
+ };
8368
+ if (bindI18n) i18n?.on(bindI18n, boundReset);
8369
+ if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
8370
+ return () => {
8371
+ isMounted.current = false;
8372
+ if (i18n) bindI18n?.split(" ").forEach((e4) => i18n.off(e4, boundReset));
8373
+ if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach((e4) => i18n.store.off(e4, boundReset));
8374
+ };
8375
+ }, [i18n, joinedNS]);
8376
+ useEffect(() => {
8377
+ if (isMounted.current && ready) {
8378
+ setT(getT);
8379
+ }
8380
+ }, [i18n, keyPrefix, ready]);
8381
+ const ret = [t3, i18n, ready];
8382
+ ret.t = t3;
8383
+ ret.i18n = i18n;
8384
+ ret.ready = ready;
8385
+ if (ready) return ret;
8386
+ if (!ready && !useSuspense) return ret;
8387
+ throw new Promise((resolve) => {
8388
+ if (props.lng) {
8389
+ loadLanguages(i18n, props.lng, namespaces, () => resolve());
8390
+ } else {
8391
+ loadNamespaces(i18n, namespaces, () => resolve());
8392
+ }
8393
+ });
8429
8394
  };
8395
+ function I18nextProvider({
8396
+ i18n,
8397
+ defaultNS,
8398
+ children: children2
8399
+ }) {
8400
+ const value = useMemo(() => ({
8401
+ i18n,
8402
+ defaultNS
8403
+ }), [i18n, defaultNS]);
8404
+ return createElement$1(I18nContext.Provider, {
8405
+ value
8406
+ }, children2);
8407
+ }
8430
8408
  const isString = (obj) => typeof obj === "string";
8431
8409
  const defer = () => {
8432
8410
  let res;
@@ -11899,6 +11877,28 @@ const I18nProvider = ({
11899
11877
  }, [initialLanguage]);
11900
11878
  return /* @__PURE__ */ jsx(I18nextProvider, { i18n: instance, children: children2 });
11901
11879
  };
11880
+ const useThemeContext = () => {
11881
+ const context = useContext$1(Context);
11882
+ if (context === void 0) {
11883
+ throw new Error("useThemeContext must be used within a ThemeProvider");
11884
+ }
11885
+ const applyTheme = (themeConfig) => {
11886
+ if (!themeConfig) return;
11887
+ const mergedStyles = mergeThemeStyles(themeConfig);
11888
+ const finalTheme = {
11889
+ styles: mergedStyles
11890
+ };
11891
+ context.setTheme(finalTheme);
11892
+ };
11893
+ return {
11894
+ ...context.state,
11895
+ setTheme: context.setTheme,
11896
+ setLoading: context.setLoading,
11897
+ setError: context.setError,
11898
+ // Add the helper function
11899
+ applyTheme
11900
+ };
11901
+ };
11902
11902
  const H3 = ({ children: children2 }) => {
11903
11903
  return /* @__PURE__ */ jsx("h3", { className: "scroll-m-20 text-2xl font-semibold tracking-tight", children: children2 });
11904
11904
  };
@@ -12020,6 +12020,24 @@ const SpinLoader = ({
12020
12020
  ` })
12021
12021
  ] }) });
12022
12022
  };
12023
+ const ReachProviderThemeProvider = ({
12024
+ children: children2,
12025
+ theme: theme2
12026
+ }) => {
12027
+ const { t: t3 } = useTranslation();
12028
+ const { loading: themeLoading, applyTheme } = useThemeContext();
12029
+ const themeApplied = useRef(false);
12030
+ useEffect(() => {
12031
+ if (!themeApplied.current && theme2) {
12032
+ applyTheme(theme2);
12033
+ themeApplied.current = true;
12034
+ }
12035
+ }, [applyTheme, theme2]);
12036
+ if (themeLoading && theme2) {
12037
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col justify-center items-center h-screen", children: /* @__PURE__ */ jsx(SpinLoader, { text: [t3("loading")] }) });
12038
+ }
12039
+ return /* @__PURE__ */ jsx(Fragment, { children: children2 });
12040
+ };
12023
12041
  const TOAST_LIMIT = 1;
12024
12042
  const TOAST_REMOVE_DELAY = 1e6;
12025
12043
  let count$2 = 0;
@@ -16538,24 +16556,12 @@ const ReachProvider = ({
16538
16556
  children: children2,
16539
16557
  theme: theme2
16540
16558
  }) => {
16541
- const { t: t3 } = useTranslation();
16542
16559
  const [queryClient] = React__default.useState(() => {
16543
16560
  if (authToken2) {
16544
16561
  setAuthToken(authToken2);
16545
16562
  }
16546
16563
  return createQueryClient();
16547
16564
  });
16548
- const { loading: themeLoading, applyTheme } = useThemeContext();
16549
- const themeApplied = useRef(false);
16550
- useEffect(() => {
16551
- if (!themeApplied.current && theme2) {
16552
- applyTheme(theme2);
16553
- themeApplied.current = true;
16554
- }
16555
- }, [applyTheme, theme2]);
16556
- if (themeLoading && theme2) {
16557
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col justify-center items-center h-screen", children: /* @__PURE__ */ jsx(SpinLoader, { text: [t3("loading")] }) });
16558
- }
16559
16565
  return /* @__PURE__ */ jsxs(QueryClientProvider, { client: queryClient, children: [
16560
16566
  /* @__PURE__ */ jsx(
16561
16567
  D$2,
@@ -16578,7 +16584,7 @@ const ReachProvider = ({
16578
16584
  sendEventsOnFlagRead: true
16579
16585
  },
16580
16586
  children: /* @__PURE__ */ jsx(I18nProvider, { initialLanguage: language, children: /* @__PURE__ */ jsx(Provider$2, { children: /* @__PURE__ */ jsxs(Provider$3, { children: [
16581
- children2,
16587
+ /* @__PURE__ */ jsx(ReachProviderThemeProvider, { theme: theme2, children: children2 }),
16582
16588
  /* @__PURE__ */ jsx(Toaster, {})
16583
16589
  ] }) }) })
16584
16590
  }
@@ -37829,7 +37835,7 @@ const ConditionSelectors = ({
37829
37835
  setConditionState(newState);
37830
37836
  };
37831
37837
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
37832
- /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: conditionState.map((condition, index2) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
37838
+ /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: conditionState.map((condition, index2) => /* @__PURE__ */ jsxs("div", { children: [
37833
37839
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
37834
37840
  SingleConditionLineItem,
37835
37841
  {