@embedreach/components 0.1.22 → 0.1.24

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
- import { jsx, Fragment, jsxs } from "react/jsx-runtime";
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, useReducer, useMemo, useEffect, createElement as createElement$1, forwardRef, useRef, useId as useId$2, useContext as useContext$1, useInsertionEffect, useCallback, Children, isValidElement, useLayoutEffect, useState, 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 {
@@ -4486,7 +4486,7 @@ var isPlainObject = (payload) => {
4486
4486
  };
4487
4487
  var isEmptyObject = (payload) => isPlainObject(payload) && Object.keys(payload).length === 0;
4488
4488
  var isArray = (payload) => Array.isArray(payload);
4489
- var isString$1 = (payload) => typeof payload === "string";
4489
+ var isString$2 = (payload) => typeof payload === "string";
4490
4490
  var isNumber$1 = (payload) => typeof payload === "number" && !isNaN(payload);
4491
4491
  var isBoolean = (payload) => typeof payload === "boolean";
4492
4492
  var isRegExp = (payload) => payload instanceof RegExp;
@@ -4496,7 +4496,7 @@ var isSymbol$1 = (payload) => getType(payload) === "Symbol";
4496
4496
  var isDate$3 = (payload) => payload instanceof Date && !isNaN(payload.valueOf());
4497
4497
  var isError = (payload) => payload instanceof Error;
4498
4498
  var isNaNValue = (payload) => typeof payload === "number" && isNaN(payload);
4499
- var isPrimitive = (payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber$1(payload) || isString$1(payload) || isSymbol$1(payload);
4499
+ var isPrimitive = (payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber$1(payload) || isString$2(payload) || isSymbol$1(payload);
4500
4500
  var isBigint = (payload) => typeof payload === "bigint";
4501
4501
  var isInfinite = (payload) => payload === Infinity || payload === -Infinity;
4502
4502
  var isTypedArray = (payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView);
@@ -7873,7 +7873,7 @@ const createQueryClient = () => new QueryClient({
7873
7873
  }
7874
7874
  });
7875
7875
  const createDataContext = (reducer2, actions, defaultValue, listeners2) => {
7876
- const Context = React__default.createContext({
7876
+ const Context2 = React__default.createContext({
7877
7877
  state: defaultValue
7878
7878
  });
7879
7879
  const Provider2 = ({ children: children2 }) => {
@@ -7905,9 +7905,9 @@ const createDataContext = (reducer2, actions, defaultValue, listeners2) => {
7905
7905
  () => ({ state, ...boundActions }),
7906
7906
  [state, boundActions]
7907
7907
  );
7908
- return /* @__PURE__ */ jsx(Context.Provider, { value: contextValue, children: children2 });
7908
+ return /* @__PURE__ */ jsx(Context2.Provider, { value: contextValue, children: children2 });
7909
7909
  };
7910
- return { Context, Provider: Provider2 };
7910
+ return { Context: Context2, Provider: Provider2 };
7911
7911
  };
7912
7912
  const authReducer = (state, action) => {
7913
7913
  switch (action.type) {
@@ -8120,6 +8120,13 @@ const applyThemeStyles = (styles2) => {
8120
8120
  styleElement.textContent = cssText;
8121
8121
  document.head.appendChild(styleElement);
8122
8122
  };
8123
+ const mergeThemeStyles = (themeConfig, overrides) => {
8124
+ return {
8125
+ ...DEFAULT_THEME_STYLES,
8126
+ ...themeConfig?.styles || {},
8127
+ ...{}
8128
+ };
8129
+ };
8123
8130
  const themeReducer = (state, action) => {
8124
8131
  switch (action.type) {
8125
8132
  case "set_theme":
@@ -8150,7 +8157,7 @@ const themeReducer = (state, action) => {
8150
8157
  const setTheme = (dispatch2) => (theme2) => dispatch2({ type: "set_theme", payload: theme2 });
8151
8158
  const setLoading = (dispatch2) => (loading2) => dispatch2({ type: "set_loading", payload: loading2 });
8152
8159
  const setError = (dispatch2) => (error2) => dispatch2({ type: "set_error", payload: error2 });
8153
- const { Provider: Provider$2 } = createDataContext(
8160
+ const { Context, Provider: Provider$2 } = createDataContext(
8154
8161
  themeReducer,
8155
8162
  {
8156
8163
  setTheme,
@@ -8163,6 +8170,56 @@ const { Provider: Provider$2 } = createDataContext(
8163
8170
  error: null
8164
8171
  }
8165
8172
  );
8173
+ const warn = (...args) => {
8174
+ if (console?.warn) {
8175
+ if (isString$1(args[0])) args[0] = `react-i18next:: ${args[0]}`;
8176
+ console.warn(...args);
8177
+ }
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();
8194
+ };
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;
8166
8223
  const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
8167
8224
  const htmlEntities = {
8168
8225
  "&amp;": "&",
@@ -8204,13 +8261,137 @@ const setDefaults = (options = {}) => {
8204
8261
  ...options
8205
8262
  };
8206
8263
  };
8264
+ const getDefaults$1 = () => defaultOptions$2;
8265
+ let i18nInstance;
8266
+ const setI18n = (instance2) => {
8267
+ i18nInstance = instance2;
8268
+ };
8269
+ const getI18n = () => i18nInstance;
8207
8270
  const initReactI18next = {
8208
8271
  type: "3rdParty",
8209
8272
  init(instance2) {
8210
8273
  setDefaults(instance2.options.react);
8274
+ setI18n(instance2);
8211
8275
  }
8212
8276
  };
8213
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
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
+ });
8394
+ };
8214
8395
  function I18nextProvider({
8215
8396
  i18n,
8216
8397
  defaultNS,
@@ -11696,6 +11877,167 @@ const I18nProvider = ({
11696
11877
  }, [initialLanguage]);
11697
11878
  return /* @__PURE__ */ jsx(I18nextProvider, { i18n: instance, children: children2 });
11698
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
+ const H3 = ({ children: children2 }) => {
11903
+ return /* @__PURE__ */ jsx("h3", { className: "scroll-m-20 text-2xl font-semibold tracking-tight", children: children2 });
11904
+ };
11905
+ const SpinLoader = ({
11906
+ size: size2 = 35,
11907
+ color: color2 = "black",
11908
+ speed = 0.9,
11909
+ strokeWidth = 3.5,
11910
+ text,
11911
+ textSpeed = 2e3,
11912
+ // Default 2 seconds per text
11913
+ textColor = "black"
11914
+ }) => {
11915
+ const [currentTextIndex, setCurrentTextIndex] = useState(0);
11916
+ const textArray = Array.isArray(text) ? text : text ? [text] : [];
11917
+ useEffect(() => {
11918
+ if (textArray.length <= 1) return;
11919
+ if (currentTextIndex >= textArray.length - 1) return;
11920
+ const interval = setInterval(() => {
11921
+ setCurrentTextIndex(
11922
+ (current) => current < textArray.length - 1 ? current + 1 : current
11923
+ );
11924
+ }, textSpeed);
11925
+ return () => clearInterval(interval);
11926
+ }, [textArray.length, textSpeed, currentTextIndex]);
11927
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col justify-center items-center h-full", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4", children: [
11928
+ /* @__PURE__ */ jsxs(
11929
+ "div",
11930
+ {
11931
+ className: "loader-container",
11932
+ style: {
11933
+ "--uib-size": `${size2}px`,
11934
+ "--uib-color": color2,
11935
+ "--uib-speed": `${speed}s`,
11936
+ "--uib-stroke": `${strokeWidth}px`
11937
+ },
11938
+ children: [
11939
+ /* @__PURE__ */ jsx("div", { className: "line" }),
11940
+ /* @__PURE__ */ jsx("div", { className: "line" }),
11941
+ /* @__PURE__ */ jsx("div", { className: "line" }),
11942
+ /* @__PURE__ */ jsx("div", { className: "line" }),
11943
+ /* @__PURE__ */ jsx("div", { className: "line" }),
11944
+ /* @__PURE__ */ jsx("div", { className: "line" })
11945
+ ]
11946
+ }
11947
+ ),
11948
+ textArray.length > 0 && /* @__PURE__ */ jsx(
11949
+ "div",
11950
+ {
11951
+ className: `text-center text-sm text-muted-foreground animate-fade-in ${textColor ? `text-${textColor}` : ""}`,
11952
+ children: /* @__PURE__ */ jsx(H3, { children: textArray[currentTextIndex] })
11953
+ },
11954
+ currentTextIndex
11955
+ ),
11956
+ /* @__PURE__ */ jsx("style", { children: `
11957
+ .loader-container {
11958
+ position: relative;
11959
+ display: flex;
11960
+ align-items: center;
11961
+ justify-content: center;
11962
+ height: var(--uib-size);
11963
+ width: var(--uib-size);
11964
+ }
11965
+ .line {
11966
+ position: absolute;
11967
+ top: calc(50% - var(--uib-stroke) / 2);
11968
+ left: 0;
11969
+ height: var(--uib-stroke);
11970
+ width: 100%;
11971
+ border-radius: calc(var(--uib-stroke) / 2);
11972
+ background-color: var(--uib-color);
11973
+ animation: rotate var(--uib-speed) ease-in-out infinite;
11974
+ transition: background-color 0.3s ease;
11975
+ }
11976
+ .line:nth-child(1) {
11977
+ animation-delay: calc(var(--uib-speed) * -0.375);
11978
+ }
11979
+ .line:nth-child(2) {
11980
+ animation-delay: calc(var(--uib-speed) * -0.375);
11981
+ opacity: 0.8;
11982
+ }
11983
+ .line:nth-child(3) {
11984
+ animation-delay: calc(var(--uib-speed) * -0.3);
11985
+ opacity: 0.6;
11986
+ }
11987
+ .line:nth-child(4) {
11988
+ animation-delay: calc(var(--uib-speed) * -0.225);
11989
+ opacity: 0.4;
11990
+ }
11991
+ .line:nth-child(5) {
11992
+ animation-delay: calc(var(--uib-speed) * -0.15);
11993
+ opacity: 0.2;
11994
+ }
11995
+ .line:nth-child(6) {
11996
+ animation-delay: calc(var(--uib-speed) * -0.075);
11997
+ opacity: 0.1;
11998
+ }
11999
+ @keyframes rotate {
12000
+ 0% {
12001
+ transform: rotate(0deg);
12002
+ }
12003
+ 100% {
12004
+ transform: rotate(180deg);
12005
+ }
12006
+ }
12007
+ .animate-fade-in {
12008
+ animation: fadeIn 0.5s ease-in-out;
12009
+ }
12010
+ @keyframes fadeIn {
12011
+ from {
12012
+ opacity: 0;
12013
+ transform: translateY(5px);
12014
+ }
12015
+ to {
12016
+ opacity: 1;
12017
+ transform: translateY(0);
12018
+ }
12019
+ }
12020
+ ` })
12021
+ ] }) });
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
+ };
11699
12041
  const TOAST_LIMIT = 1;
11700
12042
  const TOAST_REMOVE_DELAY = 1e6;
11701
12043
  let count$2 = 0;
@@ -11855,15 +12197,15 @@ function useComposedRefs(...refs) {
11855
12197
  return React.useCallback(composeRefs(...refs), refs);
11856
12198
  }
11857
12199
  function createContext2(rootComponentName, defaultContext) {
11858
- const Context = React.createContext(defaultContext);
12200
+ const Context2 = React.createContext(defaultContext);
11859
12201
  const Provider2 = (props) => {
11860
12202
  const { children: children2, ...context } = props;
11861
12203
  const value = React.useMemo(() => context, Object.values(context));
11862
- return /* @__PURE__ */ jsx(Context.Provider, { value, children: children2 });
12204
+ return /* @__PURE__ */ jsx(Context2.Provider, { value, children: children2 });
11863
12205
  };
11864
12206
  Provider2.displayName = rootComponentName + "Provider";
11865
12207
  function useContext2(consumerName) {
11866
- const context = React.useContext(Context);
12208
+ const context = React.useContext(Context2);
11867
12209
  if (context) return context;
11868
12210
  if (defaultContext !== void 0) return defaultContext;
11869
12211
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
@@ -11878,14 +12220,14 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
11878
12220
  defaultContexts = [...defaultContexts, defaultContext];
11879
12221
  const Provider2 = (props) => {
11880
12222
  const { scope, children: children2, ...context } = props;
11881
- const Context = scope?.[scopeName]?.[index2] || BaseContext;
12223
+ const Context2 = scope?.[scopeName]?.[index2] || BaseContext;
11882
12224
  const value = React.useMemo(() => context, Object.values(context));
11883
- return /* @__PURE__ */ jsx(Context.Provider, { value, children: children2 });
12225
+ return /* @__PURE__ */ jsx(Context2.Provider, { value, children: children2 });
11884
12226
  };
11885
12227
  Provider2.displayName = rootComponentName + "Provider";
11886
12228
  function useContext2(consumerName, scope) {
11887
- const Context = scope?.[scopeName]?.[index2] || BaseContext;
11888
- const context = React.useContext(Context);
12229
+ const Context2 = scope?.[scopeName]?.[index2] || BaseContext;
12230
+ const context = React.useContext(Context2);
11889
12231
  if (context) return context;
11890
12232
  if (defaultContext !== void 0) return defaultContext;
11891
12233
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
@@ -16211,7 +16553,8 @@ const ReachProvider = ({
16211
16553
  authToken: authToken2,
16212
16554
  tenantExternalId,
16213
16555
  language,
16214
- children: children2
16556
+ children: children2,
16557
+ theme: theme2
16215
16558
  }) => {
16216
16559
  const [queryClient] = React__default.useState(() => {
16217
16560
  if (authToken2) {
@@ -16241,7 +16584,7 @@ const ReachProvider = ({
16241
16584
  sendEventsOnFlagRead: true
16242
16585
  },
16243
16586
  children: /* @__PURE__ */ jsx(I18nProvider, { initialLanguage: language, children: /* @__PURE__ */ jsx(Provider$2, { children: /* @__PURE__ */ jsxs(Provider$3, { children: [
16244
- children2,
16587
+ /* @__PURE__ */ jsx(ReachProviderThemeProvider, { theme: theme2, children: children2 }),
16245
16588
  /* @__PURE__ */ jsx(Toaster, {})
16246
16589
  ] }) }) })
16247
16590
  }
@@ -23612,127 +23955,6 @@ const BlurDiv = ({ children: children2, className: className2, key }) => {
23612
23955
  key
23613
23956
  );
23614
23957
  };
23615
- const H3 = ({ children: children2 }) => {
23616
- return /* @__PURE__ */ jsx("h3", { className: "scroll-m-20 text-2xl font-semibold tracking-tight", children: children2 });
23617
- };
23618
- const SpinLoader = ({
23619
- size: size2 = 35,
23620
- color: color2 = "black",
23621
- speed = 0.9,
23622
- strokeWidth = 3.5,
23623
- text,
23624
- textSpeed = 2e3,
23625
- // Default 2 seconds per text
23626
- textColor = "black"
23627
- }) => {
23628
- const [currentTextIndex, setCurrentTextIndex] = useState(0);
23629
- const textArray = Array.isArray(text) ? text : text ? [text] : [];
23630
- useEffect(() => {
23631
- if (textArray.length <= 1) return;
23632
- if (currentTextIndex >= textArray.length - 1) return;
23633
- const interval = setInterval(() => {
23634
- setCurrentTextIndex(
23635
- (current) => current < textArray.length - 1 ? current + 1 : current
23636
- );
23637
- }, textSpeed);
23638
- return () => clearInterval(interval);
23639
- }, [textArray.length, textSpeed, currentTextIndex]);
23640
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col justify-center items-center h-full", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4", children: [
23641
- /* @__PURE__ */ jsxs(
23642
- "div",
23643
- {
23644
- className: "loader-container",
23645
- style: {
23646
- "--uib-size": `${size2}px`,
23647
- "--uib-color": color2,
23648
- "--uib-speed": `${speed}s`,
23649
- "--uib-stroke": `${strokeWidth}px`
23650
- },
23651
- children: [
23652
- /* @__PURE__ */ jsx("div", { className: "line" }),
23653
- /* @__PURE__ */ jsx("div", { className: "line" }),
23654
- /* @__PURE__ */ jsx("div", { className: "line" }),
23655
- /* @__PURE__ */ jsx("div", { className: "line" }),
23656
- /* @__PURE__ */ jsx("div", { className: "line" }),
23657
- /* @__PURE__ */ jsx("div", { className: "line" })
23658
- ]
23659
- }
23660
- ),
23661
- textArray.length > 0 && /* @__PURE__ */ jsx(
23662
- "div",
23663
- {
23664
- className: `text-center text-sm text-muted-foreground animate-fade-in ${textColor ? `text-${textColor}` : ""}`,
23665
- children: /* @__PURE__ */ jsx(H3, { children: textArray[currentTextIndex] })
23666
- },
23667
- currentTextIndex
23668
- ),
23669
- /* @__PURE__ */ jsx("style", { children: `
23670
- .loader-container {
23671
- position: relative;
23672
- display: flex;
23673
- align-items: center;
23674
- justify-content: center;
23675
- height: var(--uib-size);
23676
- width: var(--uib-size);
23677
- }
23678
- .line {
23679
- position: absolute;
23680
- top: calc(50% - var(--uib-stroke) / 2);
23681
- left: 0;
23682
- height: var(--uib-stroke);
23683
- width: 100%;
23684
- border-radius: calc(var(--uib-stroke) / 2);
23685
- background-color: var(--uib-color);
23686
- animation: rotate var(--uib-speed) ease-in-out infinite;
23687
- transition: background-color 0.3s ease;
23688
- }
23689
- .line:nth-child(1) {
23690
- animation-delay: calc(var(--uib-speed) * -0.375);
23691
- }
23692
- .line:nth-child(2) {
23693
- animation-delay: calc(var(--uib-speed) * -0.375);
23694
- opacity: 0.8;
23695
- }
23696
- .line:nth-child(3) {
23697
- animation-delay: calc(var(--uib-speed) * -0.3);
23698
- opacity: 0.6;
23699
- }
23700
- .line:nth-child(4) {
23701
- animation-delay: calc(var(--uib-speed) * -0.225);
23702
- opacity: 0.4;
23703
- }
23704
- .line:nth-child(5) {
23705
- animation-delay: calc(var(--uib-speed) * -0.15);
23706
- opacity: 0.2;
23707
- }
23708
- .line:nth-child(6) {
23709
- animation-delay: calc(var(--uib-speed) * -0.075);
23710
- opacity: 0.1;
23711
- }
23712
- @keyframes rotate {
23713
- 0% {
23714
- transform: rotate(0deg);
23715
- }
23716
- 100% {
23717
- transform: rotate(180deg);
23718
- }
23719
- }
23720
- .animate-fade-in {
23721
- animation: fadeIn 0.5s ease-in-out;
23722
- }
23723
- @keyframes fadeIn {
23724
- from {
23725
- opacity: 0;
23726
- transform: translateY(5px);
23727
- }
23728
- to {
23729
- opacity: 1;
23730
- transform: translateY(0);
23731
- }
23732
- }
23733
- ` })
23734
- ] }) });
23735
- };
23736
23958
  const BUSINESS_SEGMENT_PATH = "/segments";
23737
23959
  const BUSINESS_AUTOMATION_PATH = "/automations";
23738
23960
  const CHANNEL_SENDER_PATH = "/channel/senders";
@@ -33451,19 +33673,19 @@ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
33451
33673
  return useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
33452
33674
  }
33453
33675
  function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
33454
- const Context = /* @__PURE__ */ createContext$1(defaultContext);
33676
+ const Context2 = /* @__PURE__ */ createContext$1(defaultContext);
33455
33677
  function Provider2(props) {
33456
33678
  const { children: children2, ...context } = props;
33457
33679
  const value = useMemo(
33458
33680
  () => context,
33459
33681
  Object.values(context)
33460
33682
  );
33461
- return /* @__PURE__ */ createElement$1(Context.Provider, {
33683
+ return /* @__PURE__ */ createElement$1(Context2.Provider, {
33462
33684
  value
33463
33685
  }, children2);
33464
33686
  }
33465
33687
  function useContext2(consumerName) {
33466
- const context = useContext$1(Context);
33688
+ const context = useContext$1(Context2);
33467
33689
  if (context) return context;
33468
33690
  if (defaultContext !== void 0) return defaultContext;
33469
33691
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
@@ -33485,18 +33707,18 @@ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeD
33485
33707
  ];
33486
33708
  function Provider2(props) {
33487
33709
  const { scope, children: children2, ...context } = props;
33488
- const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext;
33710
+ const Context2 = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext;
33489
33711
  const value = useMemo(
33490
33712
  () => context,
33491
33713
  Object.values(context)
33492
33714
  );
33493
- return /* @__PURE__ */ createElement$1(Context.Provider, {
33715
+ return /* @__PURE__ */ createElement$1(Context2.Provider, {
33494
33716
  value
33495
33717
  }, children2);
33496
33718
  }
33497
33719
  function useContext2(consumerName, scope) {
33498
- const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext;
33499
- const context = useContext$1(Context);
33720
+ const Context2 = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext;
33721
+ const context = useContext$1(Context2);
33500
33722
  if (context) return context;
33501
33723
  if (defaultContext !== void 0) return defaultContext;
33502
33724
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);