@beinformed/react 1.0.0-beta.0 → 1.0.0-beta.1

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{beforeRenderHooks-Gb0tcmCY.d.ts → beforeRenderHooks-B0CWdI7P.d.ts} +1 -1
  3. package/dist/{beforeRenderHooks-CNvsMmi8.d.cts → beforeRenderHooks-CKR6eECI.d.cts} +1 -1
  4. package/dist/{chunk-HDOILTJ2.js → chunk-3UHZ6GBP.js} +2 -2
  5. package/dist/chunk-3UHZ6GBP.js.map +1 -0
  6. package/dist/{chunk-RKGGCIUD.js → chunk-5MOCT43G.js} +2 -2
  7. package/dist/{chunk-YJNJVQFW.js → chunk-7JMMW2FM.js} +2 -2
  8. package/dist/{chunk-YJNJVQFW.js.map → chunk-7JMMW2FM.js.map} +1 -1
  9. package/dist/{chunk-VG3QU524.js → chunk-7LGDJBGK.js} +3 -3
  10. package/dist/chunk-7LGDJBGK.js.map +1 -0
  11. package/dist/{chunk-X2C7CKOK.js → chunk-A3D5R7MI.js} +2 -2
  12. package/dist/{chunk-X2C7CKOK.js.map → chunk-A3D5R7MI.js.map} +1 -1
  13. package/dist/chunk-ALGSLJJI.js +2 -0
  14. package/dist/chunk-ALGSLJJI.js.map +1 -0
  15. package/dist/{chunk-K3DTH6XN.js → chunk-FBCZEJSD.js} +2 -2
  16. package/dist/chunk-FBCZEJSD.js.map +1 -0
  17. package/dist/{chunk-DI7VM62A.js → chunk-GD4NSZBN.js} +2 -2
  18. package/dist/chunk-GD4NSZBN.js.map +1 -0
  19. package/dist/chunk-GHKA2XFO.js +2 -0
  20. package/dist/chunk-GHKA2XFO.js.map +1 -0
  21. package/dist/chunk-HTR32BUX.js +2 -0
  22. package/dist/{chunk-6KRECIRI.js.map → chunk-HTR32BUX.js.map} +1 -1
  23. package/dist/{chunk-WBPDMDW4.js → chunk-L7DO7AZT.js} +2 -2
  24. package/dist/{chunk-WBPDMDW4.js.map → chunk-L7DO7AZT.js.map} +1 -1
  25. package/dist/chunk-LJM2ADG6.js +2 -0
  26. package/dist/chunk-LJM2ADG6.js.map +1 -0
  27. package/dist/chunk-LUXTQYD2.js +2 -0
  28. package/dist/chunk-LUXTQYD2.js.map +1 -0
  29. package/dist/chunk-LYHN5GC6.js +2 -0
  30. package/dist/chunk-LYHN5GC6.js.map +1 -0
  31. package/dist/{chunk-A4USB53Q.js → chunk-TDYPCNQI.js} +2 -2
  32. package/dist/{chunk-A4USB53Q.js.map → chunk-TDYPCNQI.js.map} +1 -1
  33. package/dist/{chunk-X3N2NQVZ.js → chunk-TRPPQFNA.js} +2 -2
  34. package/dist/{chunk-4AC7YQ5Q.js → chunk-TYEAR2B7.js} +2 -2
  35. package/dist/chunk-X6L6BWD4.js +2 -0
  36. package/dist/chunk-X6L6BWD4.js.map +1 -0
  37. package/dist/{chunk-Z2Y3OPVI.js → chunk-ZNJONDQ6.js} +2 -2
  38. package/dist/chunk-ZNJONDQ6.js.map +1 -0
  39. package/dist/client/index.cjs +5 -5
  40. package/dist/client/index.cjs.map +1 -1
  41. package/dist/client/index.d.cts +3 -3
  42. package/dist/client/index.d.ts +3 -3
  43. package/dist/client/index.js +1 -1
  44. package/dist/hooks/index.cjs +1 -1
  45. package/dist/hooks/index.cjs.map +1 -1
  46. package/dist/hooks/index.d.cts +117 -64
  47. package/dist/hooks/index.d.ts +117 -64
  48. package/dist/hooks/index.js +1 -1
  49. package/dist/i18n/index.cjs +1 -1
  50. package/dist/i18n/index.cjs.map +1 -1
  51. package/dist/i18n/index.d.cts +2 -2
  52. package/dist/i18n/index.d.ts +2 -2
  53. package/dist/i18n/index.js +1 -1
  54. package/dist/index.cjs +6 -6
  55. package/dist/index.cjs.map +1 -1
  56. package/dist/index.d.cts +6 -5
  57. package/dist/index.d.ts +6 -5
  58. package/dist/index.js +1 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/redux/index.cjs +1 -1
  61. package/dist/redux/index.cjs.map +1 -1
  62. package/dist/redux/index.d.cts +215 -28
  63. package/dist/redux/index.d.ts +215 -28
  64. package/dist/redux/index.js +1 -1
  65. package/dist/server/index.cjs +2 -2
  66. package/dist/server/index.cjs.map +1 -1
  67. package/dist/server/index.d.cts +3 -3
  68. package/dist/server/index.d.ts +3 -3
  69. package/dist/server/index.js +1 -1
  70. package/dist/{styled-components.d-CrkOxzv5.d.cts → styled-components.d-C19eFejP.d.cts} +7 -13
  71. package/dist/{styled-components.d-CrkOxzv5.d.ts → styled-components.d-C19eFejP.d.ts} +7 -13
  72. package/dist/theme/index.cjs +1 -1
  73. package/dist/theme/index.cjs.map +1 -1
  74. package/dist/theme/index.d.cts +1 -1
  75. package/dist/theme/index.d.ts +1 -1
  76. package/dist/theme/index.js +1 -1
  77. package/dist/{useForm-DW-a5mcV.d.ts → useForm-BWwXFuv5.d.cts} +3 -3
  78. package/dist/{useForm-CG_DMYfZ.d.cts → useForm-DqaU9T78.d.ts} +3 -3
  79. package/package.json +15 -15
  80. package/dist/chunk-3OP2KQ56.js +0 -2
  81. package/dist/chunk-3OP2KQ56.js.map +0 -1
  82. package/dist/chunk-6KRECIRI.js +0 -2
  83. package/dist/chunk-B7PQLTVC.js +0 -2
  84. package/dist/chunk-B7PQLTVC.js.map +0 -1
  85. package/dist/chunk-DI7VM62A.js.map +0 -1
  86. package/dist/chunk-HDOILTJ2.js.map +0 -1
  87. package/dist/chunk-K3DTH6XN.js.map +0 -1
  88. package/dist/chunk-UZIZDEU6.js +0 -2
  89. package/dist/chunk-UZIZDEU6.js.map +0 -1
  90. package/dist/chunk-VFLYA5WJ.js +0 -2
  91. package/dist/chunk-VFLYA5WJ.js.map +0 -1
  92. package/dist/chunk-VG3QU524.js.map +0 -1
  93. package/dist/chunk-Y7ESITVO.js +0 -2
  94. package/dist/chunk-Y7ESITVO.js.map +0 -1
  95. package/dist/chunk-YG7XDCNV.js +0 -2
  96. package/dist/chunk-YG7XDCNV.js.map +0 -1
  97. package/dist/chunk-Z2Y3OPVI.js.map +0 -1
  98. /package/dist/{chunk-RKGGCIUD.js.map → chunk-5MOCT43G.js.map} +0 -0
  99. /package/dist/{chunk-X3N2NQVZ.js.map → chunk-TRPPQFNA.js.map} +0 -0
  100. /package/dist/{chunk-4AC7YQ5Q.js.map → chunk-TYEAR2B7.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @beinformed/react
2
2
 
3
+ ## 1.0.0-beta.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 84de89d: - # fix sonar, lint and tsc issues
8
+ - Sync with UI library 1.0 changes
9
+ - Updated dependencies [84de89d]
10
+ - @beinformed/ui@2.0.0-beta.1
11
+
3
12
  ## 1.0.0-beta.0
4
13
 
5
14
  ### Major Changes
@@ -1,5 +1,5 @@
1
1
  import { H as HttpServletRequestJava } from './types-CGXygEPz.js';
2
- import { _ as BEIStore } from './styled-components.d-CrkOxzv5.js';
2
+ import { _ as BEIStore } from './styled-components.d-C19eFejP.js';
3
3
 
4
4
  interface BeforeRenderHookProps {
5
5
  store: BEIStore;
@@ -1,5 +1,5 @@
1
1
  import { H as HttpServletRequestJava } from './types-CGXygEPz.cjs';
2
- import { _ as BEIStore } from './styled-components.d-CrkOxzv5.cjs';
2
+ import { _ as BEIStore } from './styled-components.d-C19eFejP.cjs';
3
3
 
4
4
  interface BeforeRenderHookProps {
5
5
  store: BEIStore;
@@ -1,2 +1,2 @@
1
- import{c as p,e as l,h as u}from"./chunk-YG7XDCNV.js";var L=t=>{if(!t)return"";let e=[];return t.split("&").forEach(r=>{let[o,a]=r.split("=");o&&a?e.push(`${encodeURIComponent(o)}=${encodeURIComponent(a)}`):o&&e.push(encodeURIComponent(o))}),e.join("&")},h=t=>{let e=t.getPathInfo()||"/",r=t.getQueryString();return e=e.split("/").map(o=>encodeURIComponent(o)).join("/"),r?`${e}?${L(r)}`:e},C=t=>({pathname:t.getPathInfo()||"/",search:t.getQueryString()||"",state:{},hash:""}),v=(t,e)=>t.getCookieByName(e),m=(t,e)=>{let o=v(t,"locale")||t.getHeader("Accept-Language");return o===null?e.availableLocaleCodes[0]:e.getPreferredLocale(o)};import{IllegalArgumentException as g}from"@beinformed/ui/exceptions";import{getEnabledLocales as y}from"@beinformed/ui/settings";import R from"deepmerge";var E=(t,e=[],r)=>{if(!Array.isArray(e))throw new g("locales must be an array of objects");if(!r)throw new g("missing request argument");let o=p.map(n=>{let s=n.code,c=e.find(d=>d.code===s);return c?R(n,c):n});e.forEach(n=>{o.some(s=>s.code===n.code)||o.push(n)});let a=o.filter(n=>y().includes(n.code)),i=new l(a),f=m(r,i);t.dispatch(u(i,f??"en"))};export{h as a,C as b,v as c,m as d,E as e};
2
- //# sourceMappingURL=chunk-HDOILTJ2.js.map
1
+ import{c as p,e as l,h as u}from"./chunk-X6L6BWD4.js";var L=t=>{if(!t)return"";let e=[];return t.split("&").forEach(r=>{let[o,a]=r.split("=");o&&a?e.push(`${encodeURIComponent(o)}=${encodeURIComponent(a)}`):o&&e.push(encodeURIComponent(o))}),e.join("&")},h=t=>{let e=t.getPathInfo()||"/",r=t.getQueryString();return e=e.split("/").map(o=>encodeURIComponent(o)).join("/"),r?`${e}?${L(r)}`:e},C=t=>({pathname:t.getPathInfo()||"/",search:t.getQueryString()||"",state:{},hash:""}),v=(t,e)=>t.getCookieByName(e),m=(t,e)=>{let o=v(t,"locale")||t.getHeader("Accept-Language");return o===null?e.availableLocaleCodes[0]:e.getPreferredLocale(o)};import y from"deepmerge";import{IllegalArgumentException as g}from"@beinformed/ui/exceptions";import{getEnabledLocales as R}from"@beinformed/ui/settings";var E=(t,e=[],r)=>{if(!Array.isArray(e))throw new g("locales must be an array of objects");if(!r)throw new g("missing request argument");let o=p.map(n=>{let s=n.code,c=e.find(d=>d.code===s);return c?y(n,c):n});e.forEach(n=>{o.some(s=>s.code===n.code)||o.push(n)});let a=o.filter(n=>R().includes(n.code)),i=new l(a),f=m(r,i);t.dispatch(u(i,f??"en"))};export{h as a,C as b,v as c,m as d,E as e};
2
+ //# sourceMappingURL=chunk-3UHZ6GBP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server/requestInformation.ts","../src/i18n/serverI18n.ts"],"sourcesContent":["import type { Locales } from \"../i18n/Locales\";\nimport type { RouterLocation } from \"../redux/router/routerReducer\";\nimport type { HttpServletRequestJava } from \"./types\";\n\nconst encodeQueryString = (queryString: string) => {\n if (!queryString) return \"\";\n\n const params: string[] = [];\n queryString.split(\"&\").forEach((part) => {\n const [key, value] = part.split(\"=\");\n if (key && value) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);\n } else if (key) {\n params.push(encodeURIComponent(key));\n }\n });\n return params.join(\"&\");\n};\n\nexport const getFullRequestUrl = (request: HttpServletRequestJava): string => {\n let pathInfo = request.getPathInfo() || \"/\";\n const queryString = request.getQueryString();\n\n pathInfo = pathInfo\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n\n if (queryString) {\n return `${pathInfo}?${encodeQueryString(queryString)}`;\n }\n\n return pathInfo;\n};\n\nexport const getFullRequestLocation = (\n request: HttpServletRequestJava,\n): RouterLocation => {\n return {\n pathname: request.getPathInfo() || \"/\",\n search: request.getQueryString() || \"\",\n state: {},\n hash: \"\",\n };\n};\n\nexport const getCookieFromRequest = (\n request: HttpServletRequestJava,\n cookieName: string,\n): null | string => {\n return request.getCookieByName(cookieName);\n};\n\nexport const getPreferredLocale = (\n request: HttpServletRequestJava,\n locales: Locales,\n): void | string => {\n const languageFromCookie = getCookieFromRequest(request, \"locale\");\n const acceptLanguageHeader =\n languageFromCookie || request.getHeader(\"Accept-Language\");\n\n // when no accept language header or cookie present, get first locale code\n if (acceptLanguageHeader === null) {\n return locales.availableLocaleCodes[0];\n }\n\n return locales.getPreferredLocale(acceptLanguageHeader);\n};\n","import deepmerge from \"deepmerge\";\n\nimport { IllegalArgumentException } from \"@beinformed/ui/exceptions\";\nimport { getEnabledLocales } from \"@beinformed/ui/settings\";\n\nimport { setLocales } from \"../redux/i18n/i18nReducer\";\nimport { getPreferredLocale } from \"../server/requestInformation\";\n\nimport { availableLocales, Locales } from \"./Locales\";\n\nimport type { BEIStore } from \"../redux/store\";\nimport type { HttpServletRequestJava } from \"../server/types\";\nimport type { LocaleConfiguration } from \"./types\";\n\nexport const setI18n = (\n store: BEIStore,\n locales: LocaleConfiguration[] = [],\n request: HttpServletRequestJava,\n) => {\n if (!Array.isArray(locales)) {\n throw new IllegalArgumentException(\"locales must be an array of objects\");\n }\n if (!request) {\n throw new IllegalArgumentException(\"missing request argument\");\n }\n\n const mergedLocales = availableLocales.map((locale) => {\n const code = locale.code;\n const customLocale = locales.find((custLocale) => custLocale.code === code);\n\n if (customLocale) {\n return deepmerge(locale, customLocale);\n }\n\n return locale;\n });\n\n locales.forEach((customLocale) => {\n if (!mergedLocales.some((locale) => locale.code === customLocale.code)) {\n mergedLocales.push(customLocale);\n }\n });\n\n const enabledLocales = mergedLocales.filter((locale: LocaleConfiguration) =>\n getEnabledLocales().includes(locale.code),\n );\n\n const localesInstance = new Locales(enabledLocales);\n const preferredLocale = getPreferredLocale(request, localesInstance);\n store.dispatch(setLocales(localesInstance, preferredLocale ?? \"en\"));\n};\n"],"mappings":"sDAIA,IAAMA,EAAqBC,GAAwB,CACjD,GAAI,CAACA,EAAa,MAAO,GAEzB,IAAMC,EAAmB,CAAC,EAC1B,OAAAD,EAAY,MAAM,GAAG,EAAE,QAASE,GAAS,CACvC,GAAM,CAACC,EAAKC,CAAK,EAAIF,EAAK,MAAM,GAAG,EAC/BC,GAAOC,EACTH,EAAO,KAAK,GAAG,mBAAmBE,CAAG,CAAC,IAAI,mBAAmBC,CAAK,CAAC,EAAE,EAC5DD,GACTF,EAAO,KAAK,mBAAmBE,CAAG,CAAC,CAEvC,CAAC,EACMF,EAAO,KAAK,GAAG,CACxB,EAEaI,EAAqBC,GAA4C,CAC5E,IAAIC,EAAWD,EAAQ,YAAY,GAAK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IAAIC,EAAQH,CAAc,EAC5CI,EAAkBC,EAAmBd,EAASW,CAAe,EACnEb,EAAM,SAASiB,EAAWJ,EAAiBE,GAAmB,IAAI,CAAC,CACrE","names":["encodeQueryString","queryString","params","part","key","value","getFullRequestUrl","request","pathInfo","segment","getFullRequestLocation","getCookieFromRequest","cookieName","getPreferredLocale","locales","acceptLanguageHeader","deepmerge","IllegalArgumentException","getEnabledLocales","setI18n","store","locales","request","IllegalArgumentException","mergedLocales","availableLocales","locale","code","customLocale","custLocale","deepmerge","enabledLocales","getEnabledLocales","localesInstance","Locales","preferredLocale","getPreferredLocale","setLocales"]}
@@ -1,2 +1,2 @@
1
- import{a as r,b as a}from"./chunk-JYAETKRB.js";import{g as l,i as s}from"./chunk-6KRECIRI.js";import{b as p}from"./chunk-FW4363Y4.js";var i=p(l(),1);import{createSelector as n}from"reselect";var g=n([a,r],(e,t)=>(0,i.default)((o,m,c)=>e.getLocale(t).getMessage(o,m,c),(...o)=>JSON.stringify(o))),M=(e,t,o)=>s(g)(e,t,o),x=()=>s(g),S=()=>s(r),d=n(e=>e.i18n.locales,e=>e.map(t=>t.code)),y=()=>s(d);export{M as a,x as b,S as c,y as d};
2
- //# sourceMappingURL=chunk-RKGGCIUD.js.map
1
+ import{a as r,b as a}from"./chunk-JYAETKRB.js";import{g as l,i as s}from"./chunk-HTR32BUX.js";import{b as p}from"./chunk-FW4363Y4.js";var i=p(l(),1);import{createSelector as n}from"reselect";var g=n([a,r],(e,t)=>(0,i.default)((o,m,c)=>e.getLocale(t).getMessage(o,m,c),(...o)=>JSON.stringify(o))),M=(e,t,o)=>s(g)(e,t,o),x=()=>s(g),S=()=>s(r),d=n(e=>e.i18n.locales,e=>e.map(t=>t.code)),y=()=>s(d);export{M as a,x as b,S as c,y as d};
2
+ //# sourceMappingURL=chunk-5MOCT43G.js.map
@@ -1,2 +1,2 @@
1
- import{d,f as s}from"./chunk-WBPDMDW4.js";import{a as l}from"./chunk-FW4363Y4.js";var q=l((t,u)=>{"use strict";var a=d(),f=s();function g(e,n){n=a(n,e);for(var r=0,i=n.length;e!=null&&r<i;)e=e[f(n[r++])];return r&&r==i?e:void 0}u.exports=g});export{q as a};
2
- //# sourceMappingURL=chunk-YJNJVQFW.js.map
1
+ import{d,f as s}from"./chunk-L7DO7AZT.js";import{a as l}from"./chunk-FW4363Y4.js";var q=l((t,u)=>{"use strict";var a=d(),f=s();function g(e,n){n=a(n,e);for(var r=0,i=n.length;e!=null&&r<i;)e=e[f(n[r++])];return r&&r==i?e:void 0}u.exports=g});export{q as a};
2
+ //# sourceMappingURL=chunk-7JMMW2FM.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js"],"sourcesContent":["var castPath = require('./_castPath'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n"],"mappings":"kFAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,kBAAIC,EAAW,IACXC,EAAQ,IAUZ,SAASC,EAAQC,EAAQC,EAAM,CAC7BA,EAAOJ,EAASI,EAAMD,CAAM,EAK5B,QAHIE,EAAQ,EACRC,EAASF,EAAK,OAEXD,GAAU,MAAQE,EAAQC,GAC/BH,EAASA,EAAOF,EAAMG,EAAKC,GAAO,CAAC,CAAC,EAEtC,OAAQA,GAASA,GAASC,EAAUH,EAAS,MAC/C,CAEAJ,EAAO,QAAUG","names":["require_baseGet","__commonJSMin","exports","module","castPath","toKey","baseGet","object","path","index","length"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_baseGet.js"],"sourcesContent":["var castPath = require('./_castPath'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n"],"mappings":"kFAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,kBAAIC,EAAW,IACXC,EAAQ,IAUZ,SAASC,EAAQC,EAAQC,EAAM,CAC7BA,EAAOJ,EAASI,EAAMD,CAAM,EAK5B,QAHIE,EAAQ,EACRC,EAASF,EAAK,OAEXD,GAAU,MAAQE,EAAQC,GAC/BH,EAASA,EAAOF,EAAMG,EAAKC,GAAO,CAAC,CAAC,EAEtC,OAAQA,GAASA,GAASC,EAAUH,EAAS,MAC/C,CAEAJ,EAAO,QAAUG","names":["require_baseGet","__commonJSMin","exports","module","castPath","toKey","baseGet","object","path","index","length"]}
@@ -1,4 +1,4 @@
1
- import{b as _,e as E}from"./chunk-HDOILTJ2.js";import{a as d,b as U,i as T}from"./chunk-3OP2KQ56.js";import{H as P}from"./chunk-Y7ESITVO.js";import{a as y}from"./chunk-JYAETKRB.js";import{a as R}from"./chunk-4AC7YQ5Q.js";import{a as v,b as x}from"./chunk-DI7VM62A.js";import{b as h,e as c,g as u,h as S,i as g}from"./chunk-K3DTH6XN.js";import{b as M}from"./chunk-FW4363Y4.js";import{ModularUIRequest as L}from"@beinformed/ui/modularui";var I=e=>{try{let t=y(e.getState()),r=new L("/",{locale:t}).fetchSync();r.connectKey=`application(/)(${t})`,e.dispatch(P([{key:`application(/)(${t})`,model:r}]))}catch{}};import{getContextPath as N}from"@beinformed/ui/settings";(function(){typeof __webpack_public_path__<"u"&&(__webpack_public_path__=`${N()}/`)})();var w=e=>{if(e?.contextPath===void 0)throw new Error("Missing contextPath argument");if(e.html===void 0)throw new Error("Missing html for server");let{head:t={}}=e;return`
1
+ import{b as _,e as E}from"./chunk-3UHZ6GBP.js";import{a as d,b as U,i as T}from"./chunk-ALGSLJJI.js";import{H as P}from"./chunk-GHKA2XFO.js";import{a as y}from"./chunk-JYAETKRB.js";import{a as R}from"./chunk-TYEAR2B7.js";import{a as v,b as x}from"./chunk-GD4NSZBN.js";import{b as h,e as c,g as u,h as S,i as g}from"./chunk-FBCZEJSD.js";import{b as M}from"./chunk-FW4363Y4.js";import{ModularUIRequest as L}from"@beinformed/ui/modularui";var I=e=>{try{let t=y(e.getState()),r=new L("/",{locale:t}).fetchSync();r.connectKey=`application(/)(${t})`,e.dispatch(P([{key:`application(/)(${t})`,model:r}]))}catch{}};import{getContextPath as N}from"@beinformed/ui/settings";(function(){typeof __webpack_public_path__<"u"&&(__webpack_public_path__=`${N()}/`)})();var w=e=>{if(e?.contextPath===void 0)throw new Error("Missing contextPath argument");if(e.html===void 0)throw new Error("Missing html for server");let{head:t={}}=e;return`
2
2
  <!doctype html>
3
3
  <html ${t.htmlAttributes?t.htmlAttributes.toString():""}>
4
4
  <head>
@@ -18,5 +18,5 @@ import{b as _,e as E}from"./chunk-HDOILTJ2.js";import{a as d,b as U,i as T}from"
18
18
  {JSASSETS:<script src="{CONTEXT_PATH}/{FILE}"></script>:JSASSETS}
19
19
  </body>
20
20
  </html>
21
- `.replace(/{CONTEXT_PATH}/g,e.contextPath).trim()};import{getContextPathServer as O}from"@beinformed/ui/settings";import{renderToString as $}from"react-dom/server";import{Provider as D}from"react-redux";import{ServerStyleSheet as V,StyleSheetManager as j}from"styled-components";var b=e=>{let t=e.getState(),r={};for(let o in t.modularui){let n=t.modularui[o];if(n){let{status:s,model:p,lastModification:m}=n;p?r[o]={status:s,lastModification:m,model:p}:r[o]={status:s,lastModification:m,model:void 0}}}let i={...t,modularui:r};return JSON.stringify(i).replace(/</g,"\\u003c")};import{jsx as l}from"react/jsx-runtime";var k=({store:e,theme:t,UUID:r="",render:i,template:o=w})=>{let n=new V,s=$(l(D,{store:e,children:l(j,{sheet:n.instance,children:l(x,{theme:t,children:i()})})})),p=F(n);return o({contextPath:O(),html:s,head:p,state:b(e),UUID:r})},F=(e,t)=>{let r=e.getStyleTags(),i=t?.helmet,o=t?[...i.meta]:[];return t?{...i,style:r,meta:o}:{style:r,meta:o}};var B=M(U(),1);import{createUUID as X}from"@beinformed/ui/utils";var J=(e,t)=>{t.forEach(r=>{if(typeof r=="object"){let{name:i,defaultValue:o,type:n}=r;o&&e.dispatch(c(i,o,n))}else e.dispatch(c(r,null))})},A=(e,t)=>{Array.isArray(t)&&J(e,t),e.dispatch(u()),e.dispatch(g()),e.dispatch(S()),preferencesProvider&&preferencesProvider.isStudioContext&&preferencesProvider.isStudioContext()&&e.dispatch(h("isStudioContext",!0))};var q=e=>{let t=e.getState();if(t.error&&(t.error.shouldThrowOnServer||!(0,B.default)(t.error,"shouldThrowOnServer")))throw t.error},Ee=({request:e,locales:t,customReducers:r,serverPreferences:i=[],theme:o,render:n,template:s,beforeRenderHooks:p,preloadApplication:m=!0})=>{if(e.getHeader("X-BI-Preview-Available"))return"<h1>Preview Available</h1>";let f=X();__webpack_nonce__=f;let C=_(e),a=T({router:{location:C,action:void 0}},r);if(A(a,i),R(a),o){let H=a.getState()?.preferences?.theme;v(H,o)}return E(a,t,e),m&&I(a),q(a),d(p,{store:a,request:e}),k({store:a,theme:o,UUID:f,render:n,template:s})};export{I as a,w as b,b as c,k as d,F as e,J as f,A as g,Ee as h};
22
- //# sourceMappingURL=chunk-VG3QU524.js.map
21
+ `.replace(/{CONTEXT_PATH}/g,e.contextPath).trim()};import{renderToString as O}from"react-dom/server";import{Provider as $}from"react-redux";import{ServerStyleSheet as D,StyleSheetManager as V}from"styled-components";import{getContextPathServer as j}from"@beinformed/ui/settings";var b=e=>{let t=e.getState(),r={};for(let o in t.modularui){let n=t.modularui[o];if(n){let{status:s,model:p,lastModification:m}=n;p?r[o]={status:s,lastModification:m,model:p}:r[o]={status:s,lastModification:m,model:void 0}}}let i={...t,modularui:r};return JSON.stringify(i).replace(/</g,"\\u003c")};import{jsx as l}from"react/jsx-runtime";var k=({store:e,theme:t,UUID:r="",render:i,template:o=w})=>{let n=new D,s=O(l($,{store:e,children:l(V,{sheet:n.instance,children:l(x,{theme:t,children:i()})})})),p=F(n);return o({contextPath:j(),html:s,head:p,state:b(e),UUID:r})},F=(e,t)=>{let r=e.getStyleTags(),i=t?.helmet,o=t?[...i.meta]:[];return t?{...i,style:r,meta:o}:{style:r,meta:o}};var B=M(U(),1);import{createUUID as X}from"@beinformed/ui/utils";var J=(e,t)=>{t.forEach(r=>{if(typeof r=="object"){let{name:i,defaultValue:o,type:n}=r;o&&e.dispatch(c(i,o,n))}else e.dispatch(c(r,null))})},A=(e,t)=>{Array.isArray(t)&&J(e,t),e.dispatch(u()),e.dispatch(g()),e.dispatch(S()),preferencesProvider&&preferencesProvider.isStudioContext&&preferencesProvider.isStudioContext()&&e.dispatch(h("isStudioContext",!0))};var q=e=>{let t=e.getState();if(t.error&&(t.error.shouldThrowOnServer||!(0,B.default)(t.error,"shouldThrowOnServer")))throw t.error},Ee=({request:e,locales:t,customReducers:r,serverPreferences:i=[],theme:o,render:n,template:s,beforeRenderHooks:p,preloadApplication:m=!0})=>{if(e.getHeader("X-BI-Preview-Available"))return"<h1>Preview Available</h1>";let f=X();__webpack_nonce__=f;let C=_(e),a=T({router:{location:C,action:void 0}},r);if(A(a,i),R(a),o){let H=a.getState()?.preferences?.theme;v(H,o)}return E(a,t,e),m&&I(a),q(a),d(p,{store:a,request:e}),k({store:a,theme:o,UUID:f,render:n,template:s})};export{I as a,w as b,b as c,k as d,F as e,J as f,A as g,Ee as h};
22
+ //# sourceMappingURL=chunk-7LGDJBGK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server/application.ts","../src/server/contextPath.ts","../src/server/htmlpage.ts","../src/server/renderSSRMinimal.tsx","../src/server/serverState.ts","../src/server/serverNoSSR.ts","../src/server/serverPreferences.ts"],"sourcesContent":["import { ModularUIRequest } from \"@beinformed/ui/modularui\";\n\nimport { getLocale } from \"../redux/i18n/i18nSelectors\";\nimport { initModels } from \"../redux/modularui/modelActions\";\n\nimport type { BEIStore } from \"../redux/store\";\n\nexport const setApplication = (store: BEIStore) => {\n try {\n const locale = getLocale(store.getState());\n const application = new ModularUIRequest(\"/\", {\n locale: locale,\n }).fetchSync();\n\n application.connectKey = `application(/)(${locale})`;\n\n store.dispatch(\n initModels([\n {\n key: `application(/)(${locale})`,\n model: application,\n },\n ]),\n );\n } catch (_e) {\n // swallow error, in this case we just don't pre-cache the webapplication,\n // which has not much difference for the end user\n }\n};\n","import { getContextPath } from \"@beinformed/ui/settings\";\n\ndeclare let __webpack_public_path__: string;\n\n(function x() {\n if (typeof __webpack_public_path__ !== \"undefined\") {\n __webpack_public_path__ = `${getContextPath()}/`; // NOSONAR\n }\n})();\n\nexport {};\n","export interface TemplateProps {\n contextPath: string;\n html: string;\n head: Record<string, unknown>;\n state: string;\n UUID: string;\n}\n\nexport const htmlpage = (props?: Partial<TemplateProps>): string => {\n if (props?.contextPath === undefined) {\n throw new Error(\"Missing contextPath argument\");\n }\n if (props.html === undefined) {\n throw new Error(\"Missing html for server\");\n }\n\n const { head = {} } = props;\n\n const template = `\n <!doctype html>\n <html ${head.htmlAttributes ? head.htmlAttributes.toString() : \"\"}>\n <head>\n <meta charset=\"utf-8\" />\n ${Object.keys(head)\n .filter((key) => key !== \"htmlAttributes\")\n .map((key) => String(head[key]))\n .join(\"\")}\n {CSSASSETS:<link rel=\"stylesheet\" type=\"text/css\" href=\"{CONTEXT_PATH}/{FILE}\" />:CSSASSETS}\n </head>\n <body class=\"nojs\">\n <div id=\"application\">${props.html}</div>\n <div id=\"portal\"></div>\n <script\n type=\"application/json\"\n data-app-state=\"app-json\"\n data-app-contextpath=\"{CONTEXT_PATH}\"\n data-app-filepath=\"{FILEPATH}\"\n data-app-nonce=\"${props.UUID ?? \"\"}\">${props.state ?? \"\"}</script>\n {JSASSETS:<script src=\"{CONTEXT_PATH}/{FILE}\"></script>:JSASSETS}\n </body>\n </html>\n`;\n\n // It is important to replace the context afterwards,\n // the JSASSESTS and CSSASSETS parts act as a small template for all generated javascript and css files\n // these templates must be pure strings to make it possible to add the context path in all situations\n return template.replace(/{CONTEXT_PATH}/g, props.contextPath).trim();\n};\n","import { renderToString } from \"react-dom/server\";\nimport { Provider } from \"react-redux\";\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\n\nimport { getContextPathServer } from \"@beinformed/ui/settings\";\n\nimport { ThemeProvider } from \"../theme/ThemeProvider\";\n\nimport { htmlpage } from \"./htmlpage\";\nimport { dehydrate } from \"./serverState\";\n\nimport type React from \"react\";\nimport type { BEIStore } from \"../redux/store\";\nimport type { Theme } from \"../theme/types\";\nimport type { TemplateProps } from \"./htmlpage\";\n\ninterface Props {\n store: BEIStore;\n theme?: Theme | Theme[];\n UUID: string;\n render: () => React.ReactNode;\n template?: (arg0: TemplateProps) => string;\n}\n\nexport const renderSSRMinimal = ({\n store,\n theme,\n UUID = \"\",\n render,\n template = htmlpage,\n}: Props): string => {\n const sheet = new ServerStyleSheet();\n\n const appHTML = renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>{render()}</ThemeProvider>\n </StyleSheetManager>\n </Provider>,\n );\n\n const head = createHead(sheet);\n return template({\n contextPath: getContextPathServer(),\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n};\n\nexport const createHead = (\n sheet: ServerStyleSheet,\n helmetContext?: Record<string, unknown>,\n): Record<string, unknown> => {\n const style = sheet.getStyleTags();\n const helmet = helmetContext?.helmet as {\n meta: Record<string, unknown>[];\n };\n const meta = helmetContext ? [...helmet.meta] : [];\n\n if (helmetContext) {\n return {\n ...helmet,\n style,\n meta,\n };\n }\n\n return {\n style,\n meta,\n };\n};\n","import type { ModularUIModel } from \"@beinformed/ui/models\";\nimport type { BEIStore } from \"../redux/store\";\n\nexport const dehydrate = (store: BEIStore): string => {\n const state = store.getState();\n\n const modularui: Record<\n string,\n {\n status: string;\n lastModification: number;\n model: ModularUIModel | undefined;\n }\n > = {};\n\n for (const key in state.modularui) {\n const modelEntry = state.modularui[key];\n if (modelEntry) {\n const { status, model, lastModification } = modelEntry;\n\n if (model) {\n modularui[key] = {\n status,\n lastModification,\n model,\n };\n } else {\n modularui[key] = {\n status,\n lastModification,\n model: undefined,\n };\n }\n }\n }\n\n const filteredState = {\n ...state,\n modularui,\n };\n\n return JSON.stringify(filteredState).replace(/</g, \"\\\\u003c\");\n};\n","import \"./contextPath\";\n\nimport has from \"lodash/has\";\n\nimport { createUUID } from \"@beinformed/ui/utils\";\n\nimport { setI18n } from \"../i18n/serverI18n\";\nimport { handleBeforeRenderHooks } from \"../redux/beforeRenderHooks\";\nimport { setupStore } from \"../redux/store\";\nimport { createTheme } from \"../theme/createTheme\";\nimport { setConfigurationTheme } from \"../theme/serverTheme\";\n\nimport { setApplication } from \"./application\";\nimport { renderSSRMinimal } from \"./renderSSRMinimal\";\nimport { getFullRequestLocation } from \"./requestInformation\";\nimport { setServerPreferences } from \"./serverPreferences\";\n\nimport type { Reducer } from \"@reduxjs/toolkit\";\nimport type React from \"react\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { BeforeRenderHook } from \"../redux/beforeRenderHooks\";\nimport type { BEIStore } from \"../redux/store\";\nimport type { Theme } from \"../theme/types\";\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { ServerPreferenceValue } from \"./serverPreferences\";\nimport type { HttpServletRequestJava } from \"./types\";\n\ndeclare let __webpack_nonce__: string;\n\ninterface serverProps {\n request: HttpServletRequestJava;\n locales?: LocaleConfiguration[];\n customReducers?: Record<string, Reducer>;\n theme?: Theme | Theme[];\n serverPreferences?: (string | ServerPreferenceValue)[];\n render: () => React.ReactNode;\n template?: (arg0: TemplateProps) => string;\n beforeRenderHooks?: BeforeRenderHook[];\n preloadApplication?: boolean;\n}\n\nconst handleErrors = (s: BEIStore) => {\n const state = s.getState();\n\n if (\n state.error &&\n (state.error.shouldThrowOnServer ||\n !has(state.error, \"shouldThrowOnServer\"))\n ) {\n throw state.error;\n }\n};\n\nexport const serverNoSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme,\n render,\n template,\n beforeRenderHooks,\n preloadApplication = true,\n}: serverProps): string => {\n const isPreviewCheck = request.getHeader(\"X-BI-Preview-Available\");\n if (isPreviewCheck) {\n return \"<h1>Preview Available</h1>\";\n }\n\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const location = getFullRequestLocation(request);\n const reduxStore = setupStore(\n { router: { location, action: undefined } },\n customReducers,\n );\n\n setServerPreferences(reduxStore, serverPreferences);\n setConfigurationTheme(reduxStore);\n\n if (theme) {\n const storedTheme = reduxStore.getState()?.preferences\n ?.theme as unknown as Theme;\n createTheme(storedTheme, theme);\n }\n\n setI18n(reduxStore, locales, request);\n\n if (preloadApplication) {\n setApplication(reduxStore);\n }\n\n handleErrors(reduxStore);\n\n handleBeforeRenderHooks(beforeRenderHooks, { store: reduxStore, request });\n\n return renderSSRMinimal({ store: reduxStore, theme, UUID, render, template });\n};\n","import {\n setAllContentInDataSetting,\n setDateTimeSettings,\n setLoginPreferences,\n setServerPreference,\n} from \"../redux/preferences/preferencesActions\";\nimport { setPreference } from \"../redux/preferences/preferencesReducer\";\n\nimport type { BEIStore } from \"../redux/store\";\n\nexport interface ServerPreferenceValue {\n name: string;\n defaultValue?: string | null;\n type?: string;\n}\n\nexport const setServerPreferencesFromArray = (\n store: BEIStore,\n serverPreferences: (string | ServerPreferenceValue)[],\n) => {\n serverPreferences.forEach((serverPreference) => {\n if (typeof serverPreference === \"object\") {\n const { name, defaultValue, type } = serverPreference;\n if (defaultValue) {\n store.dispatch(setServerPreference(name, defaultValue, type));\n }\n } else {\n store.dispatch(setServerPreference(serverPreference, null));\n }\n });\n};\n\n/**\n * Server preferences can be suplied by an array of preference names,\n * or an array of objects which has the name, an optional default value and an optional type.<br>\n * When the type is set to string, a comma separated value is not converted to an array:\n *\n * @example\n * // value becomes an array [default1, default2]\n * { name: \"prefName\", defaultValue: \"default1, default2\" }\n * // value remains a string \"default1, default2\"\n * { name: \"prefName\", defaultValue: \"default1, default2\", type: \"string\" }\n *\n * @param store\n * @param serverPreferences\n */\nexport const setServerPreferences = (\n store: BEIStore,\n serverPreferences: (string | ServerPreferenceValue)[],\n) => {\n if (Array.isArray(serverPreferences)) {\n setServerPreferencesFromArray(store, serverPreferences);\n }\n\n store.dispatch(setAllContentInDataSetting());\n store.dispatch(setLoginPreferences());\n store.dispatch(setDateTimeSettings());\n\n if (\n preferencesProvider &&\n preferencesProvider.isStudioContext &&\n preferencesProvider.isStudioContext()\n ) {\n store.dispatch(setPreference(\"isStudioContext\", true));\n }\n};\n"],"mappings":"wXAAA,OAAS,oBAAAA,MAAwB,2BAO1B,IAAMC,EAAkBC,GAAoB,CACjD,GAAI,CACF,IAAMC,EAASC,EAAUF,EAAM,SAAS,CAAC,EACnCG,EAAc,IAAIC,EAAiB,IAAK,CAC5C,OAAQH,CACV,CAAC,EAAE,UAAU,EAEbE,EAAY,WAAa,kBAAkBF,CAAM,IAEjDD,EAAM,SACJK,EAAW,CACT,CACE,IAAK,kBAAkBJ,CAAM,IAC7B,MAAOE,CACT,CACF,CAAC,CACH,CACF,MAAa,CAGb,CACF,EC5BA,OAAS,kBAAAG,MAAsB,2BAI9B,UAAa,CACR,OAAO,wBAA4B,MACrC,wBAA0B,GAAGA,EAAe,CAAC,IAEjD,GAAG,ECAI,IAAMC,EAAYC,GAA2C,CAClE,GAAIA,GAAO,cAAgB,OACzB,MAAM,IAAI,MAAM,8BAA8B,EAEhD,GAAIA,EAAM,OAAS,OACjB,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAM,CAAE,KAAAC,EAAO,CAAC,CAAE,EAAID,EA8BtB,MA5BiB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IAAMC,EAAgBC,GAAgB,CACpC,IAAMC,EAAQD,EAAE,SAAS,EAEzB,GACEC,EAAM,QACLA,EAAM,MAAM,qBACX,IAAC,EAAAC,SAAID,EAAM,MAAO,qBAAqB,GAEzC,MAAMA,EAAM,KAEhB,EAEaE,GAAc,CAAC,CAC1B,QAAAC,EACA,QAAAC,EACA,eAAAC,EACA,kBAAAC,EAAoB,CAAC,EACrB,MAAAC,EACA,OAAAC,EACA,SAAAC,EACA,kBAAAC,EACA,mBAAAC,EAAqB,EACvB,IAA2B,CAEzB,GADuBR,EAAQ,UAAU,wBAAwB,EAE/D,MAAO,6BAGT,IAAMS,EAAOC,EAAW,EACxB,kBAAoBD,EAEpB,IAAME,EAAWC,EAAuBZ,CAAO,EACzCa,EAAaC,EACjB,CAAE,OAAQ,CAAE,SAAAH,EAAU,OAAQ,MAAU,CAAE,EAC1CT,CACF,EAKA,GAHAa,EAAqBF,EAAYV,CAAiB,EAClDa,EAAsBH,CAAU,EAE5BT,EAAO,CACT,IAAMa,EAAcJ,EAAW,SAAS,GAAG,aACvC,MACJK,EAAYD,EAAab,CAAK,CAChC,CAEA,OAAAe,EAAQN,EAAYZ,EAASD,CAAO,EAEhCQ,GACFY,EAAeP,CAAU,EAG3BlB,EAAakB,CAAU,EAEvBQ,EAAwBd,EAAmB,CAAE,MAAOM,EAAY,QAAAb,CAAQ,CAAC,EAElEsB,EAAiB,CAAE,MAAOT,EAAY,MAAAT,EAAO,KAAAK,EAAM,OAAAJ,EAAQ,SAAAC,CAAS,CAAC,CAC9E","names":["ModularUIRequest","setApplication","store","locale","getLocale","application","ModularUIRequest","initModels","getContextPath","htmlpage","props","head","key","renderToString","Provider","ServerStyleSheet","StyleSheetManager","getContextPathServer","dehydrate","store","state","modularui","key","modelEntry","status","model","lastModification","filteredState","jsx","renderSSRMinimal","store","theme","UUID","render","template","htmlpage","sheet","ServerStyleSheet","appHTML","renderToString","Provider","StyleSheetManager","ThemeProvider","head","createHead","getContextPathServer","dehydrate","helmetContext","style","helmet","meta","import_has","createUUID","setServerPreferencesFromArray","store","serverPreferences","serverPreference","name","defaultValue","type","setServerPreference","setServerPreferences","setAllContentInDataSetting","setLoginPreferences","setDateTimeSettings","setPreference","handleErrors","s","state","has","serverNoSSR","request","locales","customReducers","serverPreferences","theme","render","template","beforeRenderHooks","preloadApplication","UUID","createUUID","location","getFullRequestLocation","reduxStore","setupStore","setServerPreferences","setConfigurationTheme","storedTheme","createTheme","setI18n","setApplication","handleBeforeRenderHooks","renderSSRMinimal"]}
@@ -1,2 +1,2 @@
1
- import{a as d}from"./chunk-YJNJVQFW.js";import{a as b,b as x}from"./chunk-FW4363Y4.js";var a=b((N,T)=>{"use strict";var R=d();function E(e,t,o){var r=e==null?void 0:R(e,t);return r===void 0?o:r}T.exports=E});import{useContext as C}from"react";import{ThemeContext as U}from"styled-components";var L=()=>C(U);var h=x(a(),1),m=(e={},t="",o="")=>{if(t==="")return o;let r=(0,h.default)(e,t,o);return r||o},s=(e={},t="",o="")=>{let r=m(e,t,o);if(r!=null&&(typeof r=="string"||typeof r=="number"||typeof r=="object"))return r;throw new Error(`${t} is not a string, number or plain object, but: ${r===null?"nuLl":typeof r}`)},i=(e={},t="",o="")=>{let r=m(e,t,o);if(typeof r=="string")return r;if(typeof r=="number")return r.toString();throw new Error(`${t} is not a string, but: ${typeof r}`)},Y=(e={},t="",o=0)=>{let r=m(e,t,o);if(typeof r=="number")return r;throw new Error(`${t} is not a number, but: ${typeof r}`)},Q=(e,t)=>({theme:o})=>s(o,e,t);var F=(e,t)=>({theme:o})=>{let r=s(o,e,t);return typeof r=="string"?`background: ${r}`:r};import{darken as $,hsl as v,lighten as O,parseToHsl as S}from"polished";var G=(e="",t,o)=>({theme:r})=>$(e,String(s(r,t,o))),K=(e="",t,o)=>({theme:r})=>O(e,String(s(r,t,o))),z=(e,t,o,r=0)=>v(S(e).hue+r,t,o);import{getLuminance as c,parseToRgb as V}from"polished";var u=(e,t)=>{let o=c(e),r=c(t);return parseFloat((o>r?(o+.05)/(r+.05):(r+.05)/(o+.05)).toFixed(2))},g=e=>{let t=V(e);return(t.red*299+t.green*587+t.blue*114)/1e3},k=(e,t="#212529",o="#fff",r)=>{if(typeof e!="string")throw new Error("ContrastYIQ needs a string to retrieve color, received: "+e);let n=g(e);if(r&&u(e,r)>=4.5)return r;let p=g(t)<127.5?t:"#212529",f=g(o)>127.5?o:"#fff";return n>127.5?u(e,p)<3?"#212529":p:u(e,f)<3?"#fff":f},w=(e,t,o)=>{let r=m(e,t,o);if(typeof r=="object"&&r!=null&&"backgroundColor"in r){let{backgroundColor:n}=r;if(typeof n=="string")return n}return typeof r=="string"?r:o},X=(e="",t,o="YIQ_DARK_COLOR",r="YIQ_LIGHT_COLOR")=>({theme:n})=>{let p=w(n,e,"#ffffff"),f=i(n,t),P=i(n,o,"#212529"),y=i(n,r,"#fff");return k(p,P,y,f)};var l="border-radius",er=(e=l,t="BORDER_RADIUS",o="0.25rem")=>({theme:r})=>r.ROUNDED_CORNERS?`${e&&e!==l?`border-${e}-radius`:l}: ${i(r,t,o)}`:"";export{L as a,m as b,s as c,i as d,Y as e,Q as f,F as g,G as h,K as i,z as j,u as k,g as l,k as m,X as n,er as o};
2
- //# sourceMappingURL=chunk-X2C7CKOK.js.map
1
+ import{a as d}from"./chunk-7JMMW2FM.js";import{a as b,b as x}from"./chunk-FW4363Y4.js";var a=b((N,T)=>{"use strict";var R=d();function E(e,t,o){var r=e==null?void 0:R(e,t);return r===void 0?o:r}T.exports=E});import{useContext as C}from"react";import{ThemeContext as U}from"styled-components";var L=()=>C(U);var h=x(a(),1),m=(e={},t="",o="")=>{if(t==="")return o;let r=(0,h.default)(e,t,o);return r||o},s=(e={},t="",o="")=>{let r=m(e,t,o);if(r!=null&&(typeof r=="string"||typeof r=="number"||typeof r=="object"))return r;throw new Error(`${t} is not a string, number or plain object, but: ${r===null?"nuLl":typeof r}`)},i=(e={},t="",o="")=>{let r=m(e,t,o);if(typeof r=="string")return r;if(typeof r=="number")return r.toString();throw new Error(`${t} is not a string, but: ${typeof r}`)},Y=(e={},t="",o=0)=>{let r=m(e,t,o);if(typeof r=="number")return r;throw new Error(`${t} is not a number, but: ${typeof r}`)},Q=(e,t)=>({theme:o})=>s(o,e,t);var F=(e,t)=>({theme:o})=>{let r=s(o,e,t);return typeof r=="string"?`background: ${r}`:r};import{darken as $,hsl as v,lighten as O,parseToHsl as S}from"polished";var G=(e="",t,o)=>({theme:r})=>$(e,String(s(r,t,o))),K=(e="",t,o)=>({theme:r})=>O(e,String(s(r,t,o))),z=(e,t,o,r=0)=>v(S(e).hue+r,t,o);import{getLuminance as c,parseToRgb as V}from"polished";var u=(e,t)=>{let o=c(e),r=c(t);return parseFloat((o>r?(o+.05)/(r+.05):(r+.05)/(o+.05)).toFixed(2))},g=e=>{let t=V(e);return(t.red*299+t.green*587+t.blue*114)/1e3},k=(e,t="#212529",o="#fff",r)=>{if(typeof e!="string")throw new Error("ContrastYIQ needs a string to retrieve color, received: "+e);let n=g(e);if(r&&u(e,r)>=4.5)return r;let p=g(t)<127.5?t:"#212529",f=g(o)>127.5?o:"#fff";return n>127.5?u(e,p)<3?"#212529":p:u(e,f)<3?"#fff":f},w=(e,t,o)=>{let r=m(e,t,o);if(typeof r=="object"&&r!=null&&"backgroundColor"in r){let{backgroundColor:n}=r;if(typeof n=="string")return n}return typeof r=="string"?r:o},X=(e="",t,o="YIQ_DARK_COLOR",r="YIQ_LIGHT_COLOR")=>({theme:n})=>{let p=w(n,e,"#ffffff"),f=i(n,t),P=i(n,o,"#212529"),y=i(n,r,"#fff");return k(p,P,y,f)};var l="border-radius",er=(e=l,t="BORDER_RADIUS",o="0.25rem")=>({theme:r})=>r.ROUNDED_CORNERS?`${e&&e!==l?`border-${e}-radius`:l}: ${i(r,t,o)}`:"";export{L as a,m as b,s as c,i as d,Y as e,Q as f,F as g,G as h,K as i,z as j,u as k,g as l,k as m,X as n,er as o};
2
+ //# sourceMappingURL=chunk-A3D5R7MI.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js","../src/theme/useTheme.ts","../src/theme/utils/themeProps.ts","../src/theme/utils/background.ts","../src/theme/utils/colors.ts","../src/theme/utils/contrast.ts","../src/theme/utils/corners.ts"],"sourcesContent":["var baseGet = require('./_baseGet');\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nmodule.exports = get;\n","import { useContext } from \"react\";\n\nimport { ThemeContext } from \"styled-components\";\n\nimport type { Theme } from \"./types\";\n\nconst useTheme = (): Theme | undefined => {\n return useContext(ThemeContext) as Theme | undefined;\n};\n\nexport { useTheme };\n","import get from \"lodash/get\";\n\nimport type { Theme, ThemePropValue } from \"../types\";\n\nexport const getProp = (\n theme: Partial<Theme> = {},\n path = \"\",\n defaultValue: ThemePropValue = \"\",\n) => {\n if (path === \"\") {\n return defaultValue;\n }\n const value = get(theme, path, defaultValue);\n if (!value) {\n return defaultValue;\n }\n return value;\n};\n\nexport const getThemeProp = (\n theme: Partial<Theme> = {},\n path = \"\",\n defaultValue: ThemePropValue = \"\",\n) => {\n const value = getProp(theme, path, defaultValue);\n\n if (\n value != null &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"object\")\n ) {\n return value;\n }\n\n throw new Error(\n `${path} is not a string, number or plain object, but: ${value === null ? \"nuLl\" : typeof value}`,\n );\n};\n\nexport const getThemeStringProp = (\n theme: Partial<Theme> = {},\n path = \"\",\n defaultValue = \"\",\n) => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return value;\n } else if (typeof value === \"number\") {\n return value.toString();\n }\n\n throw new Error(`${path} is not a string, but: ${typeof value}`);\n};\n\nexport const getThemeNumberProp = (\n theme: Partial<Theme> = {},\n path = \"\",\n defaultValue = 0,\n) => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"number\") {\n return value;\n }\n\n throw new Error(`${path} is not a number, but: ${typeof value}`);\n};\n\n/*\n * Retrieve property value from theme property of styled component\n */\nexport const themeProp =\n <T extends Theme>(\n path: string,\n defaultValue?: ThemePropValue,\n ): ((props: { theme: T }) => ThemePropValue) =>\n ({ theme }: { theme: T }) =>\n getThemeProp(theme, path, defaultValue);\n","import { getThemeProp } from \"./themeProps\";\n\nimport type { ThemePropValue, UtilThemeProps } from \"../types\";\n\nconst renderBackground =\n (\n path?: string,\n defaultValue?: string,\n ): ((arg0: UtilThemeProps) => ThemePropValue) =>\n ({ theme }: UtilThemeProps) => {\n const value = getThemeProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return `background: ${value}`;\n }\n\n return value;\n };\n\nexport { renderBackground };\n","import { darken, hsl, lighten, parseToHsl } from \"polished\";\n\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { ThemePropValue, UtilThemeProps } from \"../types\";\n\n/*\n * Themed color x amount darkened\n */\nconst darkenColor =\n (\n amount: number | string = \"\",\n path?: string,\n defaultValue?: ThemePropValue,\n ): ((arg0: UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n darken(amount, String(getThemeProp(theme, path, defaultValue)));\n\n/*\n * Themed color x amount lightened\n */\nconst lightenColor =\n (\n amount: number | string = \"\",\n path?: string,\n defaultValue?: ThemePropValue,\n ): ((arg0: UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n lighten(amount, String(getThemeProp(theme, path, defaultValue)));\n\n/*\n * Make a color lighter or darker in the same color family\n */\nconst changeHSL = (\n color: string,\n saturation?: number,\n lightness?: number,\n hueAdjustment = 0,\n): string => hsl(parseToHsl(color).hue + hueAdjustment, saturation, lightness);\n\nexport { darkenColor, lightenColor, changeHSL };\n","import { getLuminance, parseToRgb } from \"polished\";\n\nimport { getProp, getThemeStringProp } from \"./themeProps\";\n\nimport type { Theme, ThemePropValue, UtilThemeProps } from \"../types\";\n\n/**\n * calculate the contrast ratio of two colors\n */\nconst getColorContrast = (color1: string, color2: string) => {\n const luminance1 = getLuminance(color1);\n const luminance2 = getLuminance(color2);\n return parseFloat(\n (luminance1 > luminance2\n ? (luminance1 + 0.05) / (luminance2 + 0.05)\n : (luminance2 + 0.05) / (luminance1 + 0.05)\n ).toFixed(2),\n );\n};\n\n/*\n * The YIQ equation converts the RGB color (0 to 255) into a YIQ color space.\n * YIQ is the standard formula for calculating the perceived brightness of a color,\n * and is recommended by the World Wide Web Consortium (W3C).\n */\nconst getYIQ = (color: string): number => {\n const rgb = parseToRgb(color);\n\n return (rgb.red * 299 + rgb.green * 587 + rgb.blue * 114) / 1000;\n};\n\n/**\n * Get dark or light color, depending on the given color\n * When the contrast between the color and the light or dark color is too low,\n * the preferred color is returned\n */\nconst getContrastYIQ = (\n color: ThemePropValue,\n dark = \"#212529\",\n light = \"#fff\",\n preferredColor?: string,\n): string => {\n if (typeof color !== \"string\") {\n throw new Error(\n \"ContrastYIQ needs a string to retrieve color, received: \" + color,\n );\n }\n const yiqColor = getYIQ(color);\n\n if (preferredColor && getColorContrast(color, preferredColor) >= 4.5) {\n return preferredColor;\n }\n\n const darkColor = getYIQ(dark) < 127.5 ? dark : \"#212529\";\n const lightColor = getYIQ(light) > 127.5 ? light : \"#fff\";\n\n if (yiqColor > 127.5) {\n if (getColorContrast(color, darkColor) < 3) {\n return \"#212529\";\n }\n\n return darkColor;\n }\n\n if (getColorContrast(color, lightColor) < 3) {\n return \"#fff\";\n }\n return lightColor;\n};\n\nconst getBackgroundColor = (\n theme: Theme,\n bgColorProperty: string,\n defaultValue: string,\n) => {\n const bgColor = getProp(theme, bgColorProperty, defaultValue);\n\n if (\n typeof bgColor === \"object\" &&\n bgColor != null &&\n \"backgroundColor\" in bgColor\n ) {\n const { backgroundColor } = bgColor;\n if (typeof backgroundColor === \"string\") {\n return backgroundColor;\n }\n }\n\n if (typeof bgColor === \"string\") {\n return bgColor;\n }\n\n return defaultValue;\n};\n\n/**\n * Retrieve the contrast color for the given background property,\n * based on theme properties\n */\nconst renderContrastColor =\n (\n bgColorProperty = \"\",\n preferredColorProperty?: string,\n standardDarkProperty = \"YIQ_DARK_COLOR\",\n standardLightProperty = \"YIQ_LIGHT_COLOR\",\n ): ((arg0: UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) => {\n const bgColor = getBackgroundColor(theme, bgColorProperty, \"#ffffff\");\n const preferredColor = getThemeStringProp(theme, preferredColorProperty);\n const darkColor = getThemeStringProp(\n theme,\n standardDarkProperty,\n \"#212529\",\n );\n const lightColor = getThemeStringProp(theme, standardLightProperty, \"#fff\");\n\n return getContrastYIQ(bgColor, darkColor, lightColor, preferredColor);\n };\n\nexport { getColorContrast, getYIQ, getContrastYIQ, renderContrastColor };\n","import { getThemeStringProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\nconst DEFAULT_CORNER_PROPERTY = \"border-radius\";\n\n/*\n * Border radius based on the theme setting for rounded corners\n * When ROUNDED_CORNERS is not true in the theme, no rounded corners are returned\n */\nconst roundedCorners =\n (\n property: string = DEFAULT_CORNER_PROPERTY,\n path = \"BORDER_RADIUS\",\n defaultValue = \"0.25rem\",\n ): ((arg0: UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) => {\n if (theme.ROUNDED_CORNERS) {\n const propertyName =\n property && property !== DEFAULT_CORNER_PROPERTY\n ? `border-${property}-radius`\n : DEFAULT_CORNER_PROPERTY;\n\n return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IACHA,EAAM,gBAMD,GAJLH,GAAYA,IAAaF,EACrB,UAAUE,CAAQ,UAClBF,CAEgB,KAAKM,EACzBD,EACAF,EACAC,CACF,CAAC,GAGI","names":["require_get","__commonJSMin","exports","module","baseGet","get","object","path","defaultValue","result","useContext","ThemeContext","useTheme","import_get","getProp","theme","path","defaultValue","value","get","getThemeProp","getThemeStringProp","getThemeNumberProp","themeProp","renderBackground","path","defaultValue","theme","value","getThemeProp","darken","hsl","lighten","parseToHsl","darkenColor","amount","path","defaultValue","theme","darken","getThemeProp","lightenColor","lighten","changeHSL","color","saturation","lightness","hueAdjustment","hsl","parseToHsl","getLuminance","parseToRgb","getColorContrast","color1","color2","luminance1","getLuminance","luminance2","getYIQ","color","rgb","parseToRgb","getContrastYIQ","dark","light","preferredColor","yiqColor","darkColor","lightColor","getBackgroundColor","theme","bgColorProperty","defaultValue","bgColor","getProp","backgroundColor","renderContrastColor","preferredColorProperty","standardDarkProperty","standardLightProperty","getThemeStringProp","DEFAULT_CORNER_PROPERTY","roundedCorners","property","path","defaultValue","theme","getThemeStringProp"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/get.js","../src/theme/useTheme.ts","../src/theme/utils/themeProps.ts","../src/theme/utils/background.ts","../src/theme/utils/colors.ts","../src/theme/utils/contrast.ts","../src/theme/utils/corners.ts"],"sourcesContent":["var baseGet = require('./_baseGet');\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nmodule.exports = get;\n","import { useContext } from \"react\";\n\nimport { ThemeContext } from \"styled-components\";\n\nimport type { Theme } from \"./types\";\n\nconst useTheme = (): Theme | undefined => {\n return useContext(ThemeContext) as Theme | undefined;\n};\n\nexport { useTheme };\n","import get from \"lodash/get\";\n\nimport type { Theme, ThemePropValue } from \"../types\";\n\nexport const getProp = (\n theme: Partial<Theme> = {},\n path = \"\",\n defaultValue: ThemePropValue = \"\",\n) => {\n if (path === \"\") {\n return defaultValue;\n }\n const value = get(theme, path, defaultValue);\n if (!value) {\n return defaultValue;\n }\n return value;\n};\n\nexport const getThemeProp = (\n theme: Partial<Theme> = {},\n path = \"\",\n defaultValue: ThemePropValue = \"\",\n) => {\n const value = getProp(theme, path, defaultValue);\n\n if (\n value != null &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"object\")\n ) {\n return value;\n }\n\n throw new Error(\n `${path} is not a string, number or plain object, but: ${value === null ? \"nuLl\" : typeof value}`,\n );\n};\n\nexport const getThemeStringProp = (\n theme: Partial<Theme> = {},\n path = \"\",\n defaultValue = \"\",\n) => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return value;\n } else if (typeof value === \"number\") {\n return value.toString();\n }\n\n throw new Error(`${path} is not a string, but: ${typeof value}`);\n};\n\nexport const getThemeNumberProp = (\n theme: Partial<Theme> = {},\n path = \"\",\n defaultValue = 0,\n) => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"number\") {\n return value;\n }\n\n throw new Error(`${path} is not a number, but: ${typeof value}`);\n};\n\n/*\n * Retrieve property value from theme property of styled component\n */\nexport const themeProp =\n <T extends Theme>(\n path: string,\n defaultValue?: ThemePropValue,\n ): ((props: { theme: T }) => ThemePropValue) =>\n ({ theme }: { theme: T }) =>\n getThemeProp(theme, path, defaultValue);\n","import { getThemeProp } from \"./themeProps\";\n\nimport type { ThemePropValue, UtilThemeProps } from \"../types\";\n\nconst renderBackground =\n (\n path?: string,\n defaultValue?: string,\n ): ((arg0: UtilThemeProps) => ThemePropValue) =>\n ({ theme }: UtilThemeProps) => {\n const value = getThemeProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return `background: ${value}`;\n }\n\n return value;\n };\n\nexport { renderBackground };\n","import { darken, hsl, lighten, parseToHsl } from \"polished\";\n\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { ThemePropValue, UtilThemeProps } from \"../types\";\n\n/*\n * Themed color x amount darkened\n */\nconst darkenColor =\n (\n amount: number | string = \"\",\n path?: string,\n defaultValue?: ThemePropValue,\n ): ((arg0: UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n darken(amount, String(getThemeProp(theme, path, defaultValue)));\n\n/*\n * Themed color x amount lightened\n */\nconst lightenColor =\n (\n amount: number | string = \"\",\n path?: string,\n defaultValue?: ThemePropValue,\n ): ((arg0: UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n lighten(amount, String(getThemeProp(theme, path, defaultValue)));\n\n/*\n * Make a color lighter or darker in the same color family\n */\nconst changeHSL = (\n color: string,\n saturation?: number,\n lightness?: number,\n hueAdjustment = 0,\n): string => hsl(parseToHsl(color).hue + hueAdjustment, saturation, lightness);\n\nexport { darkenColor, lightenColor, changeHSL };\n","import { getLuminance, parseToRgb } from \"polished\";\n\nimport { getProp, getThemeStringProp } from \"./themeProps\";\n\nimport type { Theme, ThemePropValue, UtilThemeProps } from \"../types\";\n\n/**\n * calculate the contrast ratio of two colors\n */\nconst getColorContrast = (color1: string, color2: string) => {\n const luminance1 = getLuminance(color1);\n const luminance2 = getLuminance(color2);\n return parseFloat(\n (luminance1 > luminance2\n ? (luminance1 + 0.05) / (luminance2 + 0.05)\n : (luminance2 + 0.05) / (luminance1 + 0.05)\n ).toFixed(2),\n );\n};\n\n/*\n * The YIQ equation converts the RGB color (0 to 255) into a YIQ color space.\n * YIQ is the standard formula for calculating the perceived brightness of a color,\n * and is recommended by the World Wide Web Consortium (W3C).\n */\nconst getYIQ = (color: string): number => {\n const rgb = parseToRgb(color);\n\n return (rgb.red * 299 + rgb.green * 587 + rgb.blue * 114) / 1000;\n};\n\n/**\n * Get dark or light color, depending on the given color\n * When the contrast between the color and the light or dark color is too low,\n * the preferred color is returned\n */\nconst getContrastYIQ = (\n color: ThemePropValue,\n dark = \"#212529\",\n light = \"#fff\",\n preferredColor?: string,\n): string => {\n if (typeof color !== \"string\") {\n throw new Error(\n \"ContrastYIQ needs a string to retrieve color, received: \" + color,\n );\n }\n const yiqColor = getYIQ(color);\n\n if (preferredColor && getColorContrast(color, preferredColor) >= 4.5) {\n return preferredColor;\n }\n\n const darkColor = getYIQ(dark) < 127.5 ? dark : \"#212529\";\n const lightColor = getYIQ(light) > 127.5 ? light : \"#fff\";\n\n if (yiqColor > 127.5) {\n if (getColorContrast(color, darkColor) < 3) {\n return \"#212529\";\n }\n\n return darkColor;\n }\n\n if (getColorContrast(color, lightColor) < 3) {\n return \"#fff\";\n }\n return lightColor;\n};\n\nconst getBackgroundColor = (\n theme: Theme,\n bgColorProperty: string,\n defaultValue: string,\n) => {\n const bgColor = getProp(theme, bgColorProperty, defaultValue);\n\n if (\n typeof bgColor === \"object\" &&\n bgColor != null &&\n \"backgroundColor\" in bgColor\n ) {\n const { backgroundColor } = bgColor;\n if (typeof backgroundColor === \"string\") {\n return backgroundColor;\n }\n }\n\n if (typeof bgColor === \"string\") {\n return bgColor;\n }\n\n return defaultValue;\n};\n\n/**\n * Retrieve the contrast color for the given background property,\n * based on theme properties\n */\nconst renderContrastColor =\n (\n bgColorProperty = \"\",\n preferredColorProperty?: string,\n standardDarkProperty = \"YIQ_DARK_COLOR\",\n standardLightProperty = \"YIQ_LIGHT_COLOR\",\n ): ((arg0: UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) => {\n const bgColor = getBackgroundColor(theme, bgColorProperty, \"#ffffff\");\n const preferredColor = getThemeStringProp(theme, preferredColorProperty);\n const darkColor = getThemeStringProp(\n theme,\n standardDarkProperty,\n \"#212529\",\n );\n const lightColor = getThemeStringProp(theme, standardLightProperty, \"#fff\");\n\n return getContrastYIQ(bgColor, darkColor, lightColor, preferredColor);\n };\n\nexport { getColorContrast, getYIQ, getContrastYIQ, renderContrastColor };\n","import { getThemeStringProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\nconst DEFAULT_CORNER_PROPERTY = \"border-radius\";\n\n/*\n * Border radius based on the theme setting for rounded corners\n * When ROUNDED_CORNERS is not true in the theme, no rounded corners are returned\n */\nconst roundedCorners =\n (\n property: string = DEFAULT_CORNER_PROPERTY,\n path = \"BORDER_RADIUS\",\n defaultValue = \"0.25rem\",\n ): ((arg0: UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) => {\n if (theme.ROUNDED_CORNERS) {\n const propertyName =\n property && property !== DEFAULT_CORNER_PROPERTY\n ? `border-${property}-radius`\n : DEFAULT_CORNER_PROPERTY;\n\n return `${propertyName}: ${getThemeStringProp(\n theme,\n path,\n defaultValue,\n )}`;\n }\n\n return \"\";\n };\n\nexport { roundedCorners };\n"],"mappings":"uFAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,kBAAIC,EAAU,IA2Bd,SAASC,EAAIC,EAAQC,EAAMC,EAAc,CACvC,IAAIC,EAASH,GAAU,KAAO,OAAYF,EAAQE,EAAQC,CAAI,EAC9D,OAAOE,IAAW,OAAYD,EAAeC,CAC/C,CAEAN,EAAO,QAAUE,IChCjB,OAAS,cAAAK,MAAkB,QAE3B,OAAS,gBAAAC,MAAoB,oBAI7B,IAAMC,EAAW,IACRF,EAAWC,CAAY,ECPhC,IAAAE,EAAgB,SAIHC,EAAU,CACrBC,EAAwB,CAAC,EACzBC,EAAO,GACPC,EAA+B,KAC5B,CACH,GAAID,IAAS,GACX,OAAOC,EAET,IAAMC,KAAQ,EAAAC,SAAI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AAQJ,EAAOC,EAAiBC,CAAY,EAE5D,GACE,OAAOC,GAAY,UACnBA,GAAW,MACX,oBAAqBA,EACrB,CACA,GAAM,CAAE,gBAAAE,CAAgB,EAAIF,EAC5B,GAAI,OAAOE,GAAoB,SAC7B,OAAOA,CAEX,CAEA,OAAI,OAAOF,GAAY,SACdA,EAGFD,CACT,EAMMI,EACJ,CACEL,EAAkB,GAClBM,EACAC,EAAuB,iBACvBC,EAAwB,oBAE1B,CAAC,CAAE,MAAAT,CAAM,IAAsB,CAC7B,IAAMG,EAAUJ,EAAmBC,EAAOC,EAAiB,SAAS,EAC9DN,EAAiBe,EAAmBV,EAAOO,CAAsB,EACjEV,EAAYa,EAChBV,EACAQ,EACA,SACF,EACMV,EAAaY,EAAmBV,EAAOS,EAAuB,MAAM,EAE1E,OAAOjB,EAAeW,EAASN,EAAWC,EAAYH,CAAc,CACtE,ECjHF,IAAMgB,EAA0B,gBAM1BC,GACJ,CACEC,EAAmBF,EACnBG,EAAO,gBACPC,EAAe,YAEjB,CAAC,CAAE,MAAAC,CAAM,IACHA,EAAM,gBAMD,GAJLH,GAAYA,IAAaF,EACrB,UAAUE,CAAQ,UAClBF,CAEgB,KAAKM,EACzBD,EACAF,EACAC,CACF,CAAC,GAGI","names":["require_get","__commonJSMin","exports","module","baseGet","get","object","path","defaultValue","result","useContext","ThemeContext","useTheme","import_get","getProp","theme","path","defaultValue","value","get","getThemeProp","getThemeStringProp","getThemeNumberProp","themeProp","renderBackground","path","defaultValue","theme","value","getThemeProp","darken","hsl","lighten","parseToHsl","darkenColor","amount","path","defaultValue","theme","darken","getThemeProp","lightenColor","lighten","changeHSL","color","saturation","lightness","hueAdjustment","hsl","parseToHsl","getLuminance","parseToRgb","getColorContrast","color1","color2","luminance1","getLuminance","luminance2","getYIQ","color","rgb","parseToRgb","getContrastYIQ","dark","light","preferredColor","yiqColor","darkColor","lightColor","getBackgroundColor","theme","bgColorProperty","defaultValue","bgColor","getProp","backgroundColor","renderContrastColor","preferredColorProperty","standardDarkProperty","standardLightProperty","getThemeStringProp","DEFAULT_CORNER_PROPERTY","roundedCorners","property","path","defaultValue","theme","getThemeStringProp"]}
@@ -0,0 +1,2 @@
1
+ import{$ as a,A as w,D,F as H,G as x,H as k,I as E,J as P,K as b,L as B,f as l,h as J,j as c,k as p,l as u,m,n as f,r as y,u as S,v as I,w as h,x as M,y as g}from"./chunk-GHKA2XFO.js";import{i as C}from"./chunk-X6L6BWD4.js";import{d as R}from"./chunk-FBCZEJSD.js";import{a as s}from"./chunk-FW4363Y4.js";var G=s((rt,W)=>{"use strict";var ye=Object.prototype,Re=ye.hasOwnProperty;function Se(e,t){return e!=null&&Re.call(e,t)}W.exports=Se});var ge=s((nt,_)=>{"use strict";var Ie=G(),he=J();function Me(e,t){return e!=null&&he(e,t,Ie)}_.exports=Me});var we=(e=[],t)=>{if(e.length>0)for(let o of e)o(t)};import{createBrowserHistory as z}from"history";import{getContextPathServer as $}from"@beinformed/ui/settings";var i=null,O=null;function v(){if(typeof window>"u")throw new Error("getBrowserHistory can only be used in a browser environment.");let e=$();return(!i||e!==O)&&(i=z({basename:e}),O=e),i}import{createAction as Q,createReducer as V}from"@reduxjs/toolkit";var X={location:void 0,action:void 0},Y=Q("ROUTER/LOCATION_CHANGE",(e,t)=>({payload:{location:e,action:t}})),U=V(X,e=>{e.addCase(Y,(t,o)=>{t.location=o.payload.location,t.action=o.payload.action})});import{createReducer as Z}from"@reduxjs/toolkit";import{ApplicationModel as ee}from"@beinformed/ui/models";var te={},oe=(e,t)=>{let{key:o,error:r}=t.payload;e[o]?(e[o].status="ERROR",e[o].lastModification=Date.now()):e[o]={model:void 0,status:"ERROR",lastModification:Date.now()},e[o].error=r},re=(e,t)=>{let{key:o,model:r}=t.payload;e[o]={model:r||void 0,lastModification:Date.now(),status:r?"FINISHED":"IDLE"}},ne=(e,t)=>{let{payload:o}=t;for(let{key:r,model:n}of o)e[r]={status:"FINISHED",lastModification:Date.now(),model:n}},F=(e,t)=>{let o=t.payload,r=Object.keys(e).find(n=>e[n]?.model?.connectKey===o.connectKey);r&&e[r]?(e[r].model=o,e[r].lastModification=Date.now(),e[r].status="FINISHED",e[r].error=void 0):console.debug(`ModularUIReducer: Cannot update model with key ${o.connectKey} - model not found in state.`)},ae=(e,t)=>{delete e[t.payload]},de=e=>{for(let t in e)e[t]?.model instanceof ee||delete e[t]},ie=(e,t)=>{let{key:o}=t.meta.arg;e[o]?(e[o].status="LOADING",e[o].lastModification=Date.now(),e[o].error=void 0):e[o]={model:void 0,status:"LOADING",lastModification:Date.now(),error:void 0}},se=(e,t)=>{let{key:o,model:r,updateHandler:n}=t.payload,d=r;n&&(d=n(r)),e[o]={model:d,lastModification:Date.now(),status:"FINISHED",error:void 0}},le=(e,t)=>{let{key:o}=t.meta.arg,r=t.payload;e[o]?(e[o].status="ERROR",e[o].lastModification=Date.now(),e[o].error=r):e[o]={model:void 0,status:"ERROR",lastModification:Date.now(),error:r}},T=Z(te,e=>{e.addCase(H,oe).addCase(x,re).addCase(k,ne).addCase(E,F).addCase(P,F).addCase(b,ae).addCase(B,de).addCase(a.pending,ie).addCase(a.fulfilled,se).addCase(a.rejected,le)});import{createReducer as ce}from"@reduxjs/toolkit";var pe={count:0,timestamp:0,percentComplete:0},A=e=>({...e,count:e.count+1}),L=e=>{let t=e.count-1===0;return{...e,count:e.count<=0?0:e.count-1,timestamp:t?Date.now():e.timestamp,percentComplete:t?0:e.percentComplete}},ue=e=>({...e,count:0,timestamp:Date.now(),percentComplete:0}),j=ce(pe,e=>{e.addCase(p,A).addCase(u,L).addCase(m,t=>({...t,count:0})).addCase(f,(t,o)=>({...t,percentComplete:o.payload?.percentComplete})).addCase(a.pending,A).addCase(a.fulfilled,L).addCase(a.rejected,ue)});var N=e=>t=>o=>r=>{if(S.match(r)){let{location:n,state:d}=r.payload;e.push(n,d)}else if(I.match(r)){let{location:n,state:d}=r.payload;e.replace(n,d)}else if(h.match(r)){let{delta:n}=r.payload;e.go(n)}else M.match(r)?e.goBack():g.match(r)&&e.goForward();return o(r)};import{combineReducers as K,configureStore as me}from"@reduxjs/toolkit";var q={router:U,preferences:R,modularui:T,i18n:C,auth:l,error:w,modals:D,modelcatalog:c,notification:y,progressindicator:j},fe=K(q),tt=(e,t,o=v())=>{let r=t?K({...q,...t}):fe;return me({reducer:r,middleware:n=>n({serializableCheck:!1}).concat(N(o)),preloadedState:e})};export{we as a,ge as b,v as c,Y as d,U as e,T as f,j as g,N as h,tt as i};
2
+ //# sourceMappingURL=chunk-ALGSLJJI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_baseHas.js","../../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/has.js","../src/redux/beforeRenderHooks.ts","../src/redux/router/browserHistory.ts","../src/redux/router/routerReducer.ts","../src/redux/modularui/modularuiReducer.ts","../src/redux/progressindicator/progressIndicatorReducer.ts","../src/redux/router/routerMiddleware.ts","../src/redux/store.ts"],"sourcesContent":["/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHas(object, key) {\n return object != null && hasOwnProperty.call(object, key);\n}\n\nmodule.exports = baseHas;\n","var baseHas = require('./_baseHas'),\n hasPath = require('./_hasPath');\n\n/**\n * Checks if `path` is a direct property of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': 2 } };\n * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b');\n * // => true\n *\n * _.has(object, ['a', 'b']);\n * // => true\n *\n * _.has(other, 'a');\n * // => false\n */\nfunction has(object, path) {\n return object != null && hasPath(object, path, baseHas);\n}\n\nmodule.exports = has;\n","import type { HttpServletRequestJava } from \"../server/types\";\nimport type { BEIStore } from \"./store\";\n\nexport interface BeforeRenderHookProps {\n store: BEIStore;\n request?: HttpServletRequestJava;\n}\nexport type BeforeRenderHook = (props: BeforeRenderHookProps) => void;\n\n/**\n * Process handlers that need to be run before the react application starts,\n * for example to start a third party service<br>\n * An object with the store is available to make it possible to read state available in the redux store,\n * for example server preferences, and the request is available to retrieve request information\n *\n */\nexport const handleBeforeRenderHooks = (\n beforeRenderHooks: BeforeRenderHook[] = [],\n props: BeforeRenderHookProps,\n) => {\n if (beforeRenderHooks.length > 0) {\n for (const beforeRenderHook of beforeRenderHooks) {\n beforeRenderHook(props);\n }\n }\n};\n","// Assuming this utility is available\nimport { createBrowserHistory } from \"history\";\n\nimport { getContextPathServer } from \"@beinformed/ui/settings\";\n\nimport type { History as RouterHistory } from \"history\";\n\nlet browserHistoryInstance: RouterHistory | null = null; // Private variable to hold the instance\nlet historyContextPath: string | null = null;\n/**\n * Returns a singleton instance of the browser history.\n * Creates the instance on the first call.\n * This pattern is suitable for client-side applications.\n */\nexport function getBrowserHistory(): RouterHistory {\n if (typeof window === \"undefined\") {\n throw new Error(\n \"getBrowserHistory can only be used in a browser environment.\",\n );\n }\n\n const contextPathServer = getContextPathServer();\n if (!browserHistoryInstance || contextPathServer !== historyContextPath) {\n browserHistoryInstance = createBrowserHistory({\n basename: contextPathServer,\n });\n historyContextPath = contextPathServer;\n }\n return browserHistoryInstance;\n}\n","import { createAction, createReducer } from \"@reduxjs/toolkit\";\n\nimport type { Action, LocationDescriptorObject } from \"history\";\n\ninterface LocationState {\n from?: string;\n modal?: boolean;\n formdata?: string | undefined | null;\n [key: string]: unknown;\n}\n\nexport type RouterLocation = LocationDescriptorObject<LocationState>;\n\nexport interface RouterState {\n location: RouterLocation | undefined;\n action: Action | undefined;\n}\n\nconst initialState = { location: undefined, action: undefined };\n\nexport const locationChange = createAction(\n \"ROUTER/LOCATION_CHANGE\",\n (location: RouterLocation, action: Action) => {\n return {\n payload: {\n location,\n action,\n },\n };\n },\n);\n\nexport const routerReducer = createReducer<RouterState>(\n initialState,\n (builder) => {\n builder.addCase(locationChange, (state, action) => {\n state.location = action.payload.location;\n state.action = action.payload.action;\n });\n },\n);\n","import { createReducer } from \"@reduxjs/toolkit\";\n\nimport { ApplicationModel } from \"@beinformed/ui/models\";\n\nimport { MODULARUI_STATUS } from \"./constants\";\nimport { fetchModel } from \"./fetchModel\";\nimport {\n initModels,\n removeModelByKey,\n resetModularUI,\n setModel,\n updateErrorStatus,\n updateForm,\n updateModel,\n} from \"./modelActions\";\n\nimport type { WritableDraft } from \"immer\";\nimport type { ModelEntry } from \"./types\";\n\nexport type ModularUIState = Record<string, ModelEntry>;\n\ntype IntermediateState = WritableDraft<ModularUIState>;\n\nconst initialState: ModularUIState = {};\n\nconst handleUpdateErrorStatus = (\n state: IntermediateState,\n action: ReturnType<typeof updateErrorStatus>,\n) => {\n const { key, error } = action.payload;\n\n if (!state[key]) {\n state[key] = {\n model: undefined,\n status: MODULARUI_STATUS.ERROR,\n lastModification: Date.now(),\n };\n } else {\n state[key].status = MODULARUI_STATUS.ERROR;\n state[key].lastModification = Date.now();\n }\n\n state[key].error = error;\n};\n\nconst handleSetModel = (\n state: IntermediateState,\n action: ReturnType<typeof setModel>,\n) => {\n const { key, model } = action.payload;\n // If model is null/undefined, this sets up an empty entry,\n // otherwise, it sets the model and marks as finished.\n state[key] = {\n model: model || undefined,\n lastModification: Date.now(),\n status: model ? MODULARUI_STATUS.FINISHED : MODULARUI_STATUS.IDLE,\n };\n};\n\nconst handleInitModel = (\n state: IntermediateState,\n action: ReturnType<typeof initModels>,\n) => {\n const { payload } = action;\n for (const { key, model } of payload) {\n state[key] = {\n status: MODULARUI_STATUS.FINISHED,\n lastModification: Date.now(),\n model,\n };\n }\n};\n\nconst handleUpdateModel = (\n state: IntermediateState,\n action: ReturnType<typeof updateModel | typeof updateForm>,\n) => {\n const model = action.payload;\n const modelKey = Object.keys(state).find(\n (key) => state[key]?.model?.connectKey === model.connectKey,\n );\n\n if (modelKey && state[modelKey]) {\n state[modelKey].model = model;\n state[modelKey].lastModification = Date.now();\n state[modelKey].status = MODULARUI_STATUS.FINISHED;\n state[modelKey].error = undefined; // Clear error on successful update\n } else {\n console.debug(\n `ModularUIReducer: Cannot update model with key ${model.connectKey} - model not found in state.`,\n );\n }\n};\n\nconst handleRemoveModelByKey = (\n state: IntermediateState,\n action: ReturnType<typeof removeModelByKey>,\n) => {\n delete state[action.payload];\n};\n\nconst handleResetModularUI = (state: IntermediateState) => {\n for (const key in state) {\n if (!(state[key]?.model instanceof ApplicationModel)) {\n delete state[key];\n }\n }\n};\n\nconst handleFetchModelPending = (\n state: IntermediateState,\n action: ReturnType<typeof fetchModel.pending>,\n) => {\n const { key } = action.meta.arg; // Access original thunk arguments\n if (!state[key]) {\n state[key] = {\n model: undefined,\n status: MODULARUI_STATUS.LOADING,\n lastModification: Date.now(),\n error: undefined, // Clear error when starting new load\n };\n } else {\n state[key].status = MODULARUI_STATUS.LOADING;\n state[key].lastModification = Date.now();\n state[key].error = undefined; // Clear error when starting new load\n }\n};\n\nconst handleFetchModelFulfilled = (\n state: IntermediateState,\n action: ReturnType<typeof fetchModel.fulfilled>,\n) => {\n const { key, model, updateHandler } = action.payload;\n let finalModel = model;\n\n if (updateHandler) {\n // Apply update handler if provided\n finalModel = updateHandler(model);\n }\n\n state[key] = {\n model: finalModel,\n lastModification: Date.now(),\n status: MODULARUI_STATUS.FINISHED,\n error: undefined, // Clear error on success\n };\n};\n\nconst handleFetchModelRejected = (\n state: IntermediateState,\n action: ReturnType<typeof fetchModel.rejected>,\n) => {\n const { key } = action.meta.arg;\n const error = action.payload;\n\n if (!state[key]) {\n state[key] = {\n model: undefined,\n status: MODULARUI_STATUS.ERROR,\n lastModification: Date.now(),\n error: error,\n };\n } else {\n state[key].status = MODULARUI_STATUS.ERROR;\n state[key].lastModification = Date.now();\n state[key].error = error;\n }\n};\n\nexport const modularUIReducer = createReducer<ModularUIState>(\n initialState,\n (builder) => {\n builder\n .addCase(updateErrorStatus, handleUpdateErrorStatus)\n .addCase(setModel, handleSetModel)\n .addCase(initModels, handleInitModel)\n .addCase(updateModel, handleUpdateModel)\n .addCase(updateForm, handleUpdateModel)\n .addCase(removeModelByKey, handleRemoveModelByKey)\n .addCase(resetModularUI, handleResetModularUI)\n .addCase(fetchModel.pending, handleFetchModelPending)\n .addCase(fetchModel.fulfilled, handleFetchModelFulfilled)\n .addCase(fetchModel.rejected, handleFetchModelRejected);\n },\n);\n","import { createReducer } from \"@reduxjs/toolkit\";\n\nimport { fetchModel } from \"../modularui/fetchModel\";\n\nimport {\n finishProgress,\n resetProgress,\n startProgress,\n updateProgress,\n} from \"./progressIndicatorActions\";\n\nimport type { WritableDraft } from \"immer\";\n\nexport interface ProgressIndicatorState {\n count: number;\n timestamp: number;\n percentComplete: number;\n}\n\ntype IntermediateState = WritableDraft<ProgressIndicatorState>;\n\nconst initialState = {\n count: 0,\n timestamp: 0,\n percentComplete: 0,\n};\n\nconst handleStartProgress = (state: IntermediateState) => {\n return {\n ...state,\n count: state.count + 1,\n };\n};\n\nconst handleEndProgress = (state: IntermediateState) => {\n const isFinalFinish = state.count - 1 === 0;\n return {\n ...state,\n count: state.count <= 0 ? 0 : state.count - 1,\n timestamp: isFinalFinish ? Date.now() : state.timestamp,\n percentComplete: isFinalFinish ? 0 : state.percentComplete,\n };\n};\n\nconst handleRejectedProgress = (state: IntermediateState) => {\n return {\n ...state,\n count: 0,\n timestamp: Date.now(),\n percentComplete: 0,\n };\n};\n\nexport const progressIndicatorReducer = createReducer<ProgressIndicatorState>(\n initialState,\n (builder) => {\n builder\n .addCase(startProgress, handleStartProgress)\n .addCase(finishProgress, handleEndProgress)\n .addCase(resetProgress, (state) => {\n return {\n ...state,\n count: 0,\n };\n })\n .addCase(updateProgress, (state, action) => {\n return {\n ...state,\n percentComplete: action.payload?.percentComplete,\n };\n })\n .addCase(fetchModel.pending, handleStartProgress)\n .addCase(fetchModel.fulfilled, handleEndProgress)\n .addCase(fetchModel.rejected, handleRejectedProgress);\n },\n);\n","// routerMiddleware.ts (updated based on your routerActions.ts)\n\nimport { go, goBack, goForward, push, replace } from \"./routerActions\"; // Correct path to routerActions.ts\n\nimport type { Middleware } from \"@reduxjs/toolkit\";\nimport type { History } from \"history\";\nimport type { RootState } from \"../store\";\n\nexport const routerMiddleware = (\n history: History,\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n): Middleware<{}, RootState> => {\n return (_storeApi) => (next) => (action: unknown) => {\n if (push.match(action)) {\n const { location, state } = action.payload; // TypeScript now knows 'action' is PushAction\n history.push(location, state);\n } else if (replace.match(action)) {\n const { location, state } = action.payload;\n history.replace(location, state);\n } else if (go.match(action)) {\n const { delta } = action.payload;\n history.go(delta);\n } else if (goBack.match(action)) {\n history.goBack();\n } else if (goForward.match(action)) {\n history.goForward();\n }\n\n return next(action);\n };\n};\n","import { combineReducers, configureStore } from \"@reduxjs/toolkit\";\n\nimport { authReducer } from \"./auth/authReducer\";\nimport { errorReducer } from \"./error/errorReducer\";\nimport { i18nReducer } from \"./i18n/i18nReducer\";\nimport { modalsReducer } from \"./modals/modalsReducer\";\nimport { modelCatalogReducer } from \"./modelcatalog/modelCatalogReducer\";\nimport { modularUIReducer } from \"./modularui/modularuiReducer\";\nimport { notificationReducer } from \"./notifications/notificationReducer\";\nimport { preferencesReducer } from \"./preferences/preferencesReducer\";\nimport { progressIndicatorReducer } from \"./progressindicator/progressIndicatorReducer\";\nimport { getBrowserHistory } from \"./router/browserHistory\";\nimport { routerMiddleware } from \"./router/routerMiddleware\";\nimport { routerReducer } from \"./router/routerReducer\";\n\nimport type { Reducer } from \"@reduxjs/toolkit\";\n\nconst reducers = {\n router: routerReducer,\n preferences: preferencesReducer,\n modularui: modularUIReducer,\n i18n: i18nReducer,\n auth: authReducer,\n error: errorReducer,\n modals: modalsReducer,\n modelcatalog: modelCatalogReducer,\n notification: notificationReducer,\n progressindicator: progressIndicatorReducer,\n};\nconst rootReducers = combineReducers(reducers);\n\nexport const setupStore = (\n preloadedState?: Partial<RootState>,\n customReducers?: Record<string, Reducer> | null,\n history = getBrowserHistory(),\n) => {\n const reducer = customReducers\n ? combineReducers({ ...reducers, ...customReducers })\n : rootReducers;\n\n return configureStore({\n reducer,\n middleware: (getDefaultMiddleware) =>\n getDefaultMiddleware({\n serializableCheck: false,\n }).concat(routerMiddleware(history)),\n preloadedState,\n });\n};\n\nexport type BEIStore = ReturnType<typeof setupStore>;\nexport type RootState = ReturnType<typeof rootReducers>;\nexport type BEIDispatch = BEIStore[\"dispatch\"];\n"],"mappings":"gTAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cACA,IAAIC,GAAc,OAAO,UAGrBC,GAAiBD,GAAY,eAUjC,SAASE,GAAQC,EAAQC,EAAK,CAC5B,OAAOD,GAAU,MAAQF,GAAe,KAAKE,EAAQC,CAAG,CAC1D,CAEAL,EAAO,QAAUG,KClBjB,IAAAG,GAAAC,EAAA,CAAAC,GAAAC,IAAA,kBAAIC,GAAU,IACVC,GAAU,IA6Bd,SAASC,GAAIC,EAAQC,EAAM,CACzB,OAAOD,GAAU,MAAQF,GAAQE,EAAQC,EAAMJ,EAAO,CACxD,CAEAD,EAAO,QAAUG,KClBV,IAAMG,GAA0B,CACrCC,EAAwC,CAAC,EACzCC,IACG,CACH,GAAID,EAAkB,OAAS,EAC7B,QAAWE,KAAoBF,EAC7BE,EAAiBD,CAAK,CAG5B,ECxBA,OAAS,wBAAAE,MAA4B,UAErC,OAAS,wBAAAC,MAA4B,0BAIrC,IAAIC,EAA+C,KAC/CC,EAAoC,KAMjC,SAASC,GAAmC,CACjD,GAAI,OAAO,OAAW,IACpB,MAAM,IAAI,MACR,8DACF,EAGF,IAAMC,EAAoBJ,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B,EACrB,CAAC,EAAE,OAAOC,EAAiBL,CAAO,CAAC,EACrC,eAAAF,CACF,CAAC,CACH","names":["require_baseHas","__commonJSMin","exports","module","objectProto","hasOwnProperty","baseHas","object","key","require_has","__commonJSMin","exports","module","baseHas","hasPath","has","object","path","handleBeforeRenderHooks","beforeRenderHooks","props","beforeRenderHook","createBrowserHistory","getContextPathServer","browserHistoryInstance","historyContextPath","getBrowserHistory","contextPathServer","createAction","createReducer","initialState","locationChange","location","action","routerReducer","builder","state","createReducer","ApplicationModel","initialState","handleUpdateErrorStatus","state","action","key","error","handleSetModel","model","handleInitModel","payload","handleUpdateModel","modelKey","handleRemoveModelByKey","handleResetModularUI","ApplicationModel","handleFetchModelPending","handleFetchModelFulfilled","updateHandler","finalModel","handleFetchModelRejected","modularUIReducer","createReducer","builder","updateErrorStatus","setModel","initModels","updateModel","updateForm","removeModelByKey","resetModularUI","fetchModel","createReducer","initialState","handleStartProgress","state","handleEndProgress","isFinalFinish","handleRejectedProgress","progressIndicatorReducer","createReducer","builder","startProgress","finishProgress","resetProgress","updateProgress","action","fetchModel","routerMiddleware","history","_storeApi","next","action","push","location","state","replace","go","delta","goBack","goForward","combineReducers","configureStore","reducers","routerReducer","preferencesReducer","modularUIReducer","i18nReducer","authReducer","errorReducer","modalsReducer","modelCatalogReducer","notificationReducer","progressIndicatorReducer","rootReducers","combineReducers","setupStore","preloadedState","customReducers","history","getBrowserHistory","reducer","configureStore","getDefaultMiddleware","routerMiddleware"]}
@@ -1,2 +1,2 @@
1
- import{b as x}from"./chunk-WBPDMDW4.js";import{c as R}from"./chunk-6KRECIRI.js";import{a as c,b as j}from"./chunk-FW4363Y4.js";var T=c(($,y)=>{"use strict";function h(r,e){return function(t){return r(e(t))}}y.exports=h});var O=c((z,S)=>{"use strict";var A=T(),G=A(Object.getPrototypeOf,Object);S.exports=G});var E=c((K,I)=>{"use strict";var L=R(),V=O(),k=x(),F="[object Object]",w=Function.prototype,U=Object.prototype,v=w.toString,q=U.hasOwnProperty,M=v.call(Object);function J(r){if(!k(r)||L(r)!=F)return!1;var e=V(r);if(e===null)return!0;var t=q.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&v.call(t)==M}I.exports=J});import{createAction as g,createReducer as C}from"@reduxjs/toolkit";var o=g("SET_PREFERENCE",(r,e)=>({payload:{key:r,value:e}})),a=g("SET_PREFERENCES",r=>({payload:{...r}})),D={},W=C(D,r=>{r.addCase(o,(e,t)=>{let{key:n,value:i}=t.payload;e[n]=i}).addCase(a,(e,t)=>{for(let n of Object.keys(t.payload))e[n]=t.payload[n]})});var b=j(E(),1);import{LOGIN_PASSWORD_SETTING as f,LOGIN_PATH_SETTING as p,LOGIN_TYPE as l,LOGIN_USERNAME_SETTING as u,LOGOUT_PATH_SETTING as d}from"@beinformed/ui/constants";import{JsonParseException as H}from"@beinformed/ui/exceptions";import{ALL_CONTENT_IN_DATA_SETTING as P,INCLUDE_TIME_OFFSET as m,setSetting as _,setSettings as N}from"@beinformed/ui/settings";var s=(r,e,t)=>{let n;return typeof preferencesProvider<"u"&&(n=preferencesProvider.getPreferenceByName(r)),n||(n=e),typeof n=="string"&&t!=="string"&&n.includes(",")&&(n=n.split(",").map(i=>i.trim())),n},re=(r,e,t)=>{let n=s(r,e,t);return o(r,n)},te=r=>{let e;try{e=r?JSON.parse(r):null}catch(t){throw new H(`Theme file contains invalid JSON: ${t}`)}return e&&(0,b.default)(e)&&N(e.settings),o("theme",e)},ne=r=>{let e=!1;return typeof preferencesProvider<"u"&&typeof preferencesProvider.getModularUIContentInData<"u"?e=preferencesProvider.getModularUIContentInData():typeof r<"u"&&(e=r.preferences[P]),_(P,!!e),o(P,e)},oe=r=>{let e=!1;return typeof preferencesProvider<"u"&&typeof preferencesProvider.isIncludeTimeOffsetInDateTimes<"u"?e=preferencesProvider.isIncludeTimeOffsetInDateTimes():typeof r<"u"&&(e=r.preferences[m]),_(m,!!e),o(m,e)},se=r=>{let e={[l]:s(l,r?.preferences[l]||""),[p]:s(p,r?.preferences[p]||"/callback?client_name=FormClient"),[u]:s(u,r?.preferences[u]||"j_username"),[f]:s(f,r?.preferences[f]||"j_password"),[d]:s(d,r?.preferences[d]||"/logout")};return N(e),a(e)};export{E as a,o as b,a as c,W as d,re as e,te as f,ne as g,oe as h,se as i};
2
- //# sourceMappingURL=chunk-K3DTH6XN.js.map
1
+ import{b as x}from"./chunk-L7DO7AZT.js";import{c as R}from"./chunk-HTR32BUX.js";import{a as c,b as j}from"./chunk-FW4363Y4.js";var T=c(($,y)=>{"use strict";function h(r,e){return function(t){return r(e(t))}}y.exports=h});var O=c((z,S)=>{"use strict";var A=T(),G=A(Object.getPrototypeOf,Object);S.exports=G});var E=c((K,I)=>{"use strict";var L=R(),V=O(),k=x(),F="[object Object]",w=Function.prototype,U=Object.prototype,v=w.toString,q=U.hasOwnProperty,M=v.call(Object);function J(r){if(!k(r)||L(r)!=F)return!1;var e=V(r);if(e===null)return!0;var t=q.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&v.call(t)==M}I.exports=J});import{createAction as g,createReducer as C}from"@reduxjs/toolkit";var o=g("SET_PREFERENCE",(r,e)=>({payload:{key:r,value:e}})),a=g("SET_PREFERENCES",r=>({payload:{...r}})),D={},W=C(D,r=>{r.addCase(o,(e,t)=>{let{key:n,value:i}=t.payload;e[n]=i}).addCase(a,(e,t)=>{for(let n of Object.keys(t.payload))e[n]=t.payload[n]})});var _=j(E(),1);import{LOGIN_PASSWORD_SETTING as f,LOGIN_PATH_SETTING as p,LOGIN_TYPE as l,LOGIN_USERNAME_SETTING as u,LOGOUT_PATH_SETTING as d}from"@beinformed/ui/constants";import{JsonParseException as H}from"@beinformed/ui/exceptions";import{ALL_CONTENT_IN_DATA_SETTING as P,INCLUDE_TIME_OFFSET as m,setSetting as N,setSettings as b}from"@beinformed/ui/settings";var s=(r,e,t)=>{let n;return typeof preferencesProvider<"u"&&(n=preferencesProvider.getPreferenceByName(r)),n||(n=e),typeof n=="string"&&t!=="string"&&n.includes(",")&&(n=n.split(",").map(i=>i.trim())),n},re=(r,e,t)=>{let n=s(r,e,t);return o(r,n)},te=r=>{let e;try{e=r?JSON.parse(r):null}catch(t){throw new H(`Theme file contains invalid JSON: ${t}`)}return e&&(0,_.default)(e)&&b(e.settings),o("theme",e)},ne=r=>{let e=!1;return typeof preferencesProvider<"u"&&typeof preferencesProvider.getModularUIContentInData<"u"?e=preferencesProvider.getModularUIContentInData():typeof r<"u"&&(e=r.preferences[P]),N(P,!!e),o(P,e)},oe=r=>{let e=!1;return typeof preferencesProvider<"u"&&typeof preferencesProvider.isIncludeTimeOffsetInDateTimes<"u"?e=preferencesProvider.isIncludeTimeOffsetInDateTimes():typeof r<"u"&&(e=r.preferences[m]),N(m,!!e),o(m,e)},se=r=>{let e={[l]:s(l,r?.preferences[l]||""),[p]:s(p,r?.preferences[p]||"/callback?client_name=FormClient"),[u]:s(u,r?.preferences[u]||"j_username"),[f]:s(f,r?.preferences[f]||"j_password"),[d]:s(d,r?.preferences[d]||"/logout")};return b(e),a(e)};export{E as a,o as b,a as c,W as d,re as e,te as f,ne as g,oe as h,se as i};
2
+ //# sourceMappingURL=chunk-FBCZEJSD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_overArg.js","../../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_getPrototype.js","../../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/isPlainObject.js","../src/redux/preferences/preferencesReducer.ts","../src/redux/preferences/preferencesActions.ts"],"sourcesContent":["/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nmodule.exports = overArg;\n","var overArg = require('./_overArg');\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nmodule.exports = getPrototype;\n","var baseGetTag = require('./_baseGetTag'),\n getPrototype = require('./_getPrototype'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nmodule.exports = isPlainObject;\n","import { createAction, createReducer } from \"@reduxjs/toolkit\";\n\nimport type { Theme } from \"../../theme/types\";\nimport type { PreferenceValue } from \"./types\";\n\nexport type PreferencesState = Record<string, PreferenceValue> & {\n theme?: Theme;\n};\n\nexport const setPreference = createAction(\n \"SET_PREFERENCE\",\n (propertyName: string, propertyValue: PreferenceValue) => {\n return {\n payload: {\n key: propertyName,\n value: propertyValue,\n },\n };\n },\n);\n\nexport const setPreferences = createAction(\n \"SET_PREFERENCES\",\n (preferences: Record<string, PreferenceValue>) => {\n return {\n payload: {\n ...preferences,\n },\n };\n },\n);\n\nconst initialState = {};\n\nexport const preferencesReducer = createReducer<PreferencesState>(\n initialState,\n (builder) => {\n builder\n .addCase(setPreference, (state, action) => {\n const { key, value } = action.payload;\n state[key] = value;\n })\n .addCase(setPreferences, (state, action) => {\n for (const key of Object.keys(action.payload)) {\n state[key] = action.payload[key];\n }\n });\n },\n);\n","import isPlainObject from \"lodash/isPlainObject\";\n\nimport {\n LOGIN_PASSWORD_SETTING,\n LOGIN_PATH_SETTING,\n LOGIN_TYPE,\n LOGIN_USERNAME_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"@beinformed/ui/constants\";\nimport { JsonParseException } from \"@beinformed/ui/exceptions\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n setSetting,\n setSettings,\n} from \"@beinformed/ui/settings\";\n\nimport { setPreference, setPreferences } from \"./preferencesReducer\";\n\nimport type { RootState } from \"../store\";\nimport type { PreferenceValue } from \"./types\";\n\nconst getServerPreferenceValue = (\n preferenceName: string,\n defaultValue: PreferenceValue,\n type?: string,\n) => {\n let value;\n if (typeof preferencesProvider !== \"undefined\") {\n value = preferencesProvider.getPreferenceByName(preferenceName);\n }\n\n if (!value) {\n value = defaultValue;\n }\n\n if (typeof value === \"string\" && type !== \"string\" && value.includes(\",\")) {\n value = value.split(\",\").map((val) => val.trim());\n }\n\n return value as PreferenceValue;\n};\n\nexport const setServerPreference = (\n propertyName: string,\n defaultValue: PreferenceValue,\n type?: string,\n) => {\n const value = getServerPreferenceValue(propertyName, defaultValue, type);\n return setPreference(propertyName, value);\n};\n\nexport const setThemePreference = (configTheme: string) => {\n let themeData;\n\n try {\n themeData = configTheme ? JSON.parse(configTheme) : null;\n } catch (error) {\n throw new JsonParseException(`Theme file contains invalid JSON: ${error}`);\n }\n\n if (themeData && isPlainObject(themeData)) {\n setSettings(themeData.settings);\n }\n\n return setPreference(\"theme\", themeData);\n};\n\n/**\n * Make modular-ui-content-in-data preference available client side\n */\nexport const setAllContentInDataSetting = (state?: RootState) => {\n let allContentInDataSetting = false;\n\n if (\n typeof preferencesProvider !== \"undefined\" &&\n typeof preferencesProvider.getModularUIContentInData !== \"undefined\"\n ) {\n allContentInDataSetting = preferencesProvider.getModularUIContentInData();\n } else if (typeof state !== \"undefined\") {\n allContentInDataSetting = state.preferences[\n ALL_CONTENT_IN_DATA_SETTING\n ] as boolean;\n }\n\n setSetting(ALL_CONTENT_IN_DATA_SETTING, !!allContentInDataSetting);\n return setPreference(ALL_CONTENT_IN_DATA_SETTING, allContentInDataSetting);\n};\n\n/**\n * Retrieve settings for date time conversion\n */\nexport const setDateTimeSettings = (state?: RootState) => {\n let isIncludeTimeOffsetInDateTimes = false;\n if (\n typeof preferencesProvider !== \"undefined\" &&\n typeof preferencesProvider.isIncludeTimeOffsetInDateTimes !== \"undefined\"\n ) {\n isIncludeTimeOffsetInDateTimes =\n preferencesProvider.isIncludeTimeOffsetInDateTimes();\n } else if (typeof state !== \"undefined\") {\n isIncludeTimeOffsetInDateTimes = state.preferences[\n INCLUDE_TIME_OFFSET\n ] as boolean;\n }\n\n setSetting(INCLUDE_TIME_OFFSET, !!isIncludeTimeOffsetInDateTimes);\n return setPreference(INCLUDE_TIME_OFFSET, isIncludeTimeOffsetInDateTimes);\n};\n\n/**\n * Retrieves login settings from runtime preferences and sets them as setting in the preference reducer\n */\nexport const setLoginPreferences = (state?: RootState) => {\n const loginSettings = {\n [LOGIN_TYPE]: getServerPreferenceValue(\n LOGIN_TYPE,\n state?.preferences[LOGIN_TYPE] || \"\",\n ) as string,\n [LOGIN_PATH_SETTING]: getServerPreferenceValue(\n LOGIN_PATH_SETTING,\n state?.preferences[LOGIN_PATH_SETTING] ||\n `/callback?client_name=FormClient`,\n ) as string,\n [LOGIN_USERNAME_SETTING]: getServerPreferenceValue(\n LOGIN_USERNAME_SETTING,\n state?.preferences[LOGIN_USERNAME_SETTING] || \"j_username\",\n ) as string,\n [LOGIN_PASSWORD_SETTING]: getServerPreferenceValue(\n LOGIN_PASSWORD_SETTING,\n state?.preferences[LOGIN_PASSWORD_SETTING] || \"j_password\",\n ) as string,\n [LOGOUT_PATH_SETTING]: getServerPreferenceValue(\n LOGOUT_PATH_SETTING,\n state?.preferences[LOGOUT_PATH_SETTING] || `/logout`,\n ) as string,\n };\n\n setSettings(loginSettings);\n return setPreferences(loginSettings);\n};\n"],"mappings":"+HAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,cAQA,SAASC,EAAQC,EAAMC,EAAW,CAChC,OAAO,SAASC,EAAK,CACnB,OAAOF,EAAKC,EAAUC,CAAG,CAAC,CAC5B,CACF,CAEAJ,EAAO,QAAUC,ICdjB,IAAAI,EAAAC,EAAA,CAAAC,EAAAC,IAAA,kBAAIC,EAAU,IAGVC,EAAeD,EAAQ,OAAO,eAAgB,MAAM,EAExDD,EAAO,QAAUE,ICLjB,IAAAC,EAAAC,EAAA,CAAAC,EAAAC,IAAA,kBAAIC,EAAa,IACbC,EAAe,IACfC,EAAe,IAGfC,EAAY,kBAGZC,EAAY,SAAS,UACrBC,EAAc,OAAO,UAGrBC,EAAeF,EAAU,SAGzBG,EAAiBF,EAAY,eAG7BG,EAAmBF,EAAa,KAAK,MAAM,EA8B/C,SAASG,EAAcC,EAAO,CAC5B,GAAI,CAACR,EAAaQ,CAAK,GAAKV,EAAWU,CAAK,GAAKP,EAC/C,MAAO,GAET,IAAIQ,EAAQV,EAAaS,CAAK,EAC9B,GAAIC,IAAU,KACZ,MAAO,GAET,IAAIC,EAAOL,EAAe,KAAKI,EAAO,aAAa,GAAKA,EAAM,YAC9D,OAAO,OAAOC,GAAQ,YAAcA,aAAgBA,GAClDN,EAAa,KAAKM,CAAI,GAAKJ,CAC/B,CAEAT,EAAO,QAAUU,IC7DjB,OAAS,gBAAAI,EAAc,iBAAAC,MAAqB,mBASrC,IAAMC,EAAgBF,EAC3B,iBACA,CAACG,EAAsB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CAAK,EAAE,CAC3E,CAEA,OAAID,MAAa,EAAAG,SAAcH,CAAS,GACtCI,EAAYJ,EAAU,QAAQ,EAGzBH,EAAc,QAASG,CAAS,CACzC,EAKaK,GAA8BC,GAAsB,CAC/D,IAAIC,EAA0B,GAE9B,OACE,OAAO,oBAAwB,KAC/B,OAAO,oBAAoB,0BAA8B,IAEzDA,EAA0B,oBAAoB,0BAA0B,EAC/D,OAAOD,EAAU,MAC1BC,EAA0BD,EAAM,YAC9BE,CACF,GAGFC,EAAWD,EAA6B,CAAC,CAACD,CAAuB,EAC1DV,EAAcW,EAA6BD,CAAuB,CAC3E,EAKaG,GAAuBJ,GAAsB,CACxD,IAAIK,EAAiC,GACrC,OACE,OAAO,oBAAwB,KAC/B,OAAO,oBAAoB,+BAAmC,IAE9DA,EACE,oBAAoB,+BAA+B,EAC5C,OAAOL,EAAU,MAC1BK,EAAiCL,EAAM,YACrCM,CACF,GAGFH,EAAWG,EAAqB,CAAC,CAACD,CAA8B,EACzDd,EAAce,EAAqBD,CAA8B,CAC1E,EAKaE,GAAuBP,GAAsB,CACxD,IAAMQ,EAAgB,CACpB,CAACC,CAAU,EAAG1B,EACZ0B,EACAT,GAAO,YAAYS,CAAU,GAAK,EACpC,EACA,CAACC,CAAkB,EAAG3B,EACpB2B,EACAV,GAAO,YAAYU,CAAkB,GACnC,kCACJ,EACA,CAACC,CAAsB,EAAG5B,EACxB4B,EACAX,GAAO,YAAYW,CAAsB,GAAK,YAChD,EACA,CAACC,CAAsB,EAAG7B,EACxB6B,EACAZ,GAAO,YAAYY,CAAsB,GAAK,YAChD,EACA,CAACC,CAAmB,EAAG9B,EACrB8B,EACAb,GAAO,YAAYa,CAAmB,GAAK,SAC7C,CACF,EAEA,OAAAf,EAAYU,CAAa,EAClBM,EAAeN,CAAa,CACrC","names":["require_overArg","__commonJSMin","exports","module","overArg","func","transform","arg","require_getPrototype","__commonJSMin","exports","module","overArg","getPrototype","require_isPlainObject","__commonJSMin","exports","module","baseGetTag","getPrototype","isObjectLike","objectTag","funcProto","objectProto","funcToString","hasOwnProperty","objectCtorString","isPlainObject","value","proto","Ctor","createAction","createReducer","setPreference","propertyName","propertyValue","setPreferences","preferences","initialState","preferencesReducer","builder","state","action","key","value","import_isPlainObject","LOGIN_PASSWORD_SETTING","LOGIN_PATH_SETTING","LOGIN_TYPE","LOGIN_USERNAME_SETTING","LOGOUT_PATH_SETTING","JsonParseException","ALL_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","setSetting","setSettings","getServerPreferenceValue","preferenceName","defaultValue","type","value","val","setServerPreference","propertyName","setPreference","setThemePreference","configTheme","themeData","error","JsonParseException","isPlainObject","setSettings","setAllContentInDataSetting","state","allContentInDataSetting","ALL_CONTENT_IN_DATA_SETTING","setSetting","setDateTimeSettings","isIncludeTimeOffsetInDateTimes","INCLUDE_TIME_OFFSET","setLoginPreferences","loginSettings","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","setPreferences"]}
@@ -1,2 +1,2 @@
1
- import{a as D}from"./chunk-A4USB53Q.js";import{a as g}from"./chunk-K3DTH6XN.js";import{i}from"./chunk-6KRECIRI.js";import{a as d,b as f}from"./chunk-FW4363Y4.js";var a=d((I,l)=>{"use strict";var y=D(),P=1/0;function b(t){var n=t==null?0:t.length;return n?y(t,P):[]}l.exports=b});var u=f(a(),1),c=f(g(),1);import{setSettings as S}from"@beinformed/ui/settings";var h=t=>{let n=Object.keys(t).map(e=>`\\b${e}\\b`).join("|"),o=new RegExp(`\\$(${n})`,"g");return Object.entries(t).forEach(([e,r])=>{e!=="settings"&&typeof r=="string"&&(t[e]=r.replace(o,(m,p)=>{let s=t[p];return typeof s=="string"?s:m}))}),t},v=(t,...n)=>{let o=t?.settings??{},e={settings:{}};for(let r of n)if(typeof r=="function")e=r(h(e));else if((0,c.default)(r)){let m=e.settings??{};e={...e,...r,...t},"settings"in r&&typeof r.settings=="object"&&(e.settings={...m,...r.settings,...o})}return h(e)},T=(t,...n)=>{let o=(0,u.default)(n).filter(r=>r!=null),e=v(t,...o);return e?.settings&&S(e.settings),e};import{ThemeProvider as R}from"styled-components";import{jsx as x}from"react/jsx-runtime";var N=({theme:t,children:n})=>{let o=i(r=>r.preferences.theme),e=T(o,t);return x(R,{theme:e,children:n})};N.displayName="BI.ThemeProvider";export{T as a,N as b};
2
- //# sourceMappingURL=chunk-DI7VM62A.js.map
1
+ import{a as D}from"./chunk-TDYPCNQI.js";import{a as g}from"./chunk-FBCZEJSD.js";import{i}from"./chunk-HTR32BUX.js";import{a as d,b as f}from"./chunk-FW4363Y4.js";var a=d((I,l)=>{"use strict";var y=D(),P=1/0;function b(t){var n=t==null?0:t.length;return n?y(t,P):[]}l.exports=b});var u=f(a(),1),c=f(g(),1);import{setSettings as S}from"@beinformed/ui/settings";var h=t=>{let n=Object.keys(t).map(e=>`\\b${e}\\b`).join("|"),o=new RegExp(`\\$(${n})`,"g");return Object.entries(t).forEach(([e,r])=>{e!=="settings"&&typeof r=="string"&&(t[e]=r.replace(o,(m,p)=>{let s=t[p];return typeof s=="string"?s:m}))}),t},v=(t,...n)=>{let o=t?.settings??{},e={settings:{}};for(let r of n)if(typeof r=="function")e=r(h(e));else if((0,c.default)(r)){let m=e.settings??{};e={...e,...r,...t},"settings"in r&&typeof r.settings=="object"&&(e.settings={...m,...r.settings,...o})}return h(e)},T=(t,...n)=>{let o=(0,u.default)(n).filter(r=>r!=null),e=v(t,...o);return e?.settings&&S(e.settings),e};import{ThemeProvider as R}from"styled-components";import{jsx as x}from"react/jsx-runtime";var N=({theme:t,children:n})=>{let o=i(r=>r.preferences.theme),e=T(o,t);return x(R,{theme:e,children:n})};N.displayName="BI.ThemeProvider";export{T as a,N as b};
2
+ //# sourceMappingURL=chunk-GD4NSZBN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/flattenDeep.js","../src/theme/createTheme.ts","../src/theme/ThemeProvider.tsx"],"sourcesContent":["var baseFlatten = require('./_baseFlatten');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Recursively flattens `array`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flattenDeep([1, [2, [3, [4]], 5]]);\n * // => [1, 2, 3, 4, 5]\n */\nfunction flattenDeep(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, INFINITY) : [];\n}\n\nmodule.exports = flattenDeep;\n","import flattenDeep from \"lodash/flattenDeep\";\nimport isPlainObject from \"lodash/isPlainObject\";\n\nimport { setSettings } from \"@beinformed/ui/settings\";\n\nimport type { DefaultTheme } from \"styled-components\";\n\nconst replacePlaceholders = (inputTheme: DefaultTheme): DefaultTheme => {\n const possibleKeys = Object.keys(inputTheme)\n .map((key) => `\\\\b${key}\\\\b`)\n .join(\"|\");\n\n const re = new RegExp(`\\\\$(${possibleKeys})`, \"g\");\n Object.entries(inputTheme).forEach(([key, value]) => {\n if (key !== \"settings\" && typeof value === \"string\") {\n inputTheme[key] = value.replace(re, (match, capture) => {\n const replacement = inputTheme[capture];\n return typeof replacement === \"string\" ? replacement : match;\n });\n }\n });\n\n return inputTheme;\n};\n\nconst generateTheme = (\n storedTheme: DefaultTheme | null | undefined,\n ...themeElements: (DefaultTheme | ((theme: DefaultTheme) => DefaultTheme))[]\n): DefaultTheme => {\n const storedSettings = storedTheme?.settings ?? {};\n\n let generatedTheme: DefaultTheme = { settings: {} };\n\n for (const element of themeElements) {\n if (typeof element === \"function\") {\n generatedTheme = element(replacePlaceholders(generatedTheme));\n } else if (isPlainObject(element)) {\n const generatedSettings = generatedTheme.settings ?? {};\n\n // Type assertion is less critical here if DefaultTheme is well-defined\n generatedTheme = {\n ...generatedTheme,\n ...(element as DefaultTheme),\n ...(storedTheme as DefaultTheme),\n };\n\n if (\"settings\" in element && typeof element.settings === \"object\") {\n generatedTheme.settings = {\n ...generatedSettings,\n ...(element.settings as Record<string, string>), // Adjusted to Record<string, string> based on your DefaultTheme\n ...storedSettings,\n };\n }\n }\n }\n\n return replacePlaceholders(generatedTheme);\n};\n\n/**\n * Create a theme from multiple theme configuration objects.\n * Properties are overwritten by iterating the configuration objects from left to right.\n *\n * The first argument represents a stored theme part, this is optional. The stored theme part will overwrite every part in the collection of theme parts.\n * Thus a stored configuration is leading as it can be configured by a modeller through the repository.\n *\n * Placeholders can be used, they are replaced before calling a function theme part or at the end of the theme creation.\n *\n * Both objects and function can be used, where a function receives the previous objects as input arguments.\n * For example using the method createTheme(ThemeObject, ThemeObject2, ThemeFunction, ThemeFunction2), will be handled as:\n *\n * ThemeFunction2(ThemeFunction1({ ...ThemeObject, ...ThemeObject2 }))\n *\n * @example\n * Example where the primary color of the default theme is overwritten with a primary color of the custom theme,\n * but the button bg still uses the yiq function of the default theme:\n *\n * const DefaultTheme = {\n * PRIMARY_COLOR: \"#0000ff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * BUTTON_COLOR: \"$PRIMARY_COLOR\"\n * }\n *\n * const createDefaultTheme = (input) => ({\n * ...input,\n * BUTTON_BG: getContrastYIQ(input.BUTTON_COLOR)\n * })\n *\n * const CustomTheme = {\n * PRIMARY_COLOR: \"#ff0000\"\n * }\n *\n * createTheme(null, DefaultTheme, CustomTheme, createDefaultTheme);\n *\n * // Result:\n * {\n * PRIMARY_COLOR: \"#ff0000\",\n * BUTTON_COLOR: \"#ff0000\",\n * BUTTON_BG: \"#fff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * }\n */\nexport const createTheme = (\n storedTheme: DefaultTheme | null | undefined,\n ...themeConfigs: (\n | DefaultTheme\n | (DefaultTheme | ((theme: DefaultTheme) => DefaultTheme))[]\n | ((theme: DefaultTheme) => DefaultTheme)\n | undefined\n )[]\n): DefaultTheme => {\n const flattenConfig = flattenDeep<\n | DefaultTheme\n | DefaultTheme[]\n | ((theme: DefaultTheme) => DefaultTheme)\n | undefined\n >(themeConfigs).filter((el) => el != null);\n\n const customTheme = generateTheme(storedTheme, ...flattenConfig);\n\n if (customTheme?.settings) {\n setSettings(customTheme.settings);\n }\n\n return customTheme;\n};\n","import { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport { useBEISelector } from \"../redux/hooks\";\n\nimport { createTheme } from \"./createTheme\";\n\nimport type { ReactNode } from \"react\";\nimport type { RootState } from \"../redux/store\";\nimport type { Theme } from \"./types\";\n\nexport interface Props {\n theme?: Theme | Theme[];\n children: ReactNode;\n}\n\nexport const ThemeProvider = ({ theme, children }: Props): ReactNode => {\n const storedTheme = useBEISelector<RootState, Theme | undefined>(\n (state) => state.preferences.theme,\n );\n const finalTheme = createTheme(storedTheme, theme);\n\n return <SCThemeProvider theme={finalTheme}>{children}</SCThemeProvider>;\n};\nThemeProvider.displayName = \"BI.ThemeProvider\";\n"],"mappings":"kKAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,kBAAIC,EAAc,IAGdC,EAAW,IAgBf,SAASC,EAAYC,EAAO,CAC1B,IAAIC,EAASD,GAAS,KAAO,EAAIA,EAAM,OACvC,OAAOC,EAASJ,EAAYG,EAAOF,CAAQ,EAAI,CAAC,CAClD,CAEAF,EAAO,QAAUG,ICxBjB,IAAAG,EAAwB,SACxBC,EAA0B,SAE1B,OAAS,eAAAC,MAAmB,0BAI5B,IAAMC,EAAuBC,GAA2C,CACtE,IAAMC,EAAe,OAAO,KAAKD,CAAU,EACxC,IAAKE,GAAQ,MAAMA,CAAG,KAAK,EAC3B,KAAK,GAAG,EAELC,EAAK,IAAI,OAAO,OAAOF,CAAY,IAAK,GAAG,EACjD,cAAO,QAAQD,CAAU,EAAE,QAAQ,CAAC,CAACE,EAAKE,CAAK,IAAM,CAC/CF,IAAQ,YAAc,OAAOE,GAAU,WACzCJ,EAAWE,CAAG,EAAIE,EAAM,QAAQD,EAAI,CAACE,EAAOC,IAAY,CACtD,IAAMC,EAAcP,EAAWM,CAAO,EACtC,OAAO,OAAOC,GAAgB,SAAWA,EAAcF,CACzD,CAAC,EAEL,CAAC,EAEML,CACT,EAEMQ,EAAgB,CACpBC,KACGC,IACc,CACjB,IAAMC,EAAiBF,GAAa,UAAY,CAAC,EAE7CG,EAA+B,CAAE,SAAU,CAAC,CAAE,EAElD,QAAWC,KAAWH,EACpB,GAAI,OAAOG,GAAY,WACrBD,EAAiBC,EAAQd,EAAoBa,CAAc,CAAC,aACnD,EAAAE,SAAcD,CAAO,EAAG,CACjC,IAAME,EAAoBH,EAAe,UAAY,CAAC,EAGtDA,EAAiB,CACf,GAAGA,EACH,GAAIC,EACJ,GAAIJ,CACN,EAEI,aAAcI,GAAW,OAAOA,EAAQ,UAAa,WACvDD,EAAe,SAAW,CACxB,GAAGG,EACH,GAAIF,EAAQ,SACZ,GAAGF,CACL,EAEJ,CAGF,OAAOZ,EAAoBa,CAAc,CAC3C,EA6CaI,EAAc,CACzBP,KACGQ,IAMc,CACjB,IAAMC,KAAgB,EAAAC,SAKpBF,CAAY,EAAE,OAAQG,GAAOA,GAAM,IAAI,EAEnCC,EAAcb,EAAcC,EAAa,GAAGS,CAAa,EAE/D,OAAIG,GAAa,UACfvB,EAAYuB,EAAY,QAAQ,EAG3BA,CACT,EC7HA,OAAS,iBAAiBC,MAAuB,oBAqBxC,cAAAC,MAAA,oBANF,IAAMC,EAAgB,CAAC,CAAE,MAAAC,EAAO,SAAAC,CAAS,IAAwB,CACtE,IAAMC,EAAcC,EACjBC,GAAUA,EAAM,YAAY,KAC/B,EACMC,EAAaC,EAAYJ,EAAaF,CAAK,EAEjD,OAAOF,EAACS,EAAA,CAAgB,MAAOF,EAAa,SAAAJ,EAAS,CACvD,EACAF,EAAc,YAAc","names":["require_flattenDeep","__commonJSMin","exports","module","baseFlatten","INFINITY","flattenDeep","array","length","import_flattenDeep","import_isPlainObject","setSettings","replacePlaceholders","inputTheme","possibleKeys","key","re","value","match","capture","replacement","generateTheme","storedTheme","themeElements","storedSettings","generatedTheme","element","isPlainObject","generatedSettings","createTheme","themeConfigs","flattenConfig","flattenDeep","el","customTheme","SCThemeProvider","jsx","ThemeProvider","theme","children","storedTheme","useBEISelector","state","finalTheme","createTheme","SCThemeProvider"]}
@@ -0,0 +1,2 @@
1
+ import{a as C}from"./chunk-JYAETKRB.js";import{a as ae,d as se,e as ie,f as le}from"./chunk-L7DO7AZT.js";import{a as E}from"./chunk-FW4363Y4.js";var Z=E((Vo,Y)=>{"use strict";var Ye=9007199254740991,Ze=/^(?:0|[1-9]\d*)$/;function Je(e,t){var o=typeof e;return t=t??Ye,!!t&&(o=="number"||o!="symbol"&&Ze.test(e))&&e>-1&&e%1==0&&e<t}Y.exports=Je});var Q=E((Xo,J)=>{"use strict";var Qe=9007199254740991;function et(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Qe}J.exports=et});var lt=E((Yo,ee)=>{"use strict";var tt=se(),ot=ie(),rt=ae(),nt=Z(),at=Q(),st=le();function it(e,t,o){t=tt(t,e);for(var n=-1,r=t.length,a=!1;++n<r;){var s=st(t[n]);if(!(a=e!=null&&o(e,s)))break;e=e[s]}return a||++n!=r?a:(r=e==null?0:e.length,!!r&&at(r)&&nt(s,r)&&(rt(e)||ot(e)))}ee.exports=it});import{createAction as f,createReducer as de}from"@reduxjs/toolkit";var ce={authenticated:!1,mustChangePassword:!1,error:null},ue=f("AUTHENTICATION_SUCCESS"),h=f("AUTHENTICATION_LOGOUT"),S=f("AUTHENTICATION_ERROR",e=>({payload:e})),me=f("AUTHENTICATION_RESET_ERRORS"),M=f("CHANGE_PASSWORD"),ct=de(ce,e=>{e.addCase(ue,t=>{t.authenticated=!0,t.error=null,t.mustChangePassword=!1}).addCase(S,(t,o)=>{t.authenticated=!1,t.error=o.payload,t.mustChangePassword=!1}).addCase(me,t=>{t.error=null}).addCase(h,t=>{t.authenticated=!1,t.error=null,t.mustChangePassword=!1}).addCase(M,t=>{t.authenticated=!0,t.error=null,t.mustChangePassword=!0})});import{createAction as fe,createReducer as pe}from"@reduxjs/toolkit";import{Cache as Re}from"@beinformed/ui/utils";var ge=fe("UPDATE_ENTRYDATE",e=>({payload:e})),ye={entryDate:new Date().toISOString().split("T")[0]},pt=pe(ye,e=>{e.addCase(ge,(t,o)=>{Re.addItem("ModelCatalogEntryDate",o.payload),t.entryDate=o.payload})});import{createAction as N,createAsyncThunk as Ee,createReducer as he}from"@reduxjs/toolkit";var P=(r=>(r.SUCCESS="SUCCESS",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r))(P||{}),H=N("SHOW_NOTIFICATION",(e,t,o)=>({payload:{type:e,message:t,error:o}})),I=Ee("notifications/show",({type:e,message:t,error:o,timeout:n},{dispatch:r})=>{n&&setTimeout(()=>{r(R())},n),r(H(e,t,o))}),R=N("DISMISS_NOTIFICATION"),Se={render:!1,messageType:void 0,message:void 0,error:void 0},yt=he(Se,e=>{e.addCase(H,(t,o)=>({...t,render:!0,messageType:o.payload.type,message:o.payload.message,error:o.payload.error})).addCase(R,t=>({...t,render:!1,messageType:void 0,message:void 0,error:void 0}))});import{createAsyncThunk as Me}from"@reduxjs/toolkit";import{getNumberSetting as Ie}from"@beinformed/ui/settings";import{createAction as g}from"@reduxjs/toolkit";var U=g("START_PROGRESS"),w=g("FINISH_PROGRESS"),St=g("RESET_PROGRESS"),Mt=g("UPDATE_PROGRESS",e=>({payload:{percentComplete:e}}));var Ae=e=>e.actiontype==="create"?"Notification.Msg.Create":e.actiontype==="update"?"Notification.Msg.Update":e.actiontype==="delete"?"Notification.Msg.Delete":"Notification.Msg.Generic",Ct=Me("notification/show_form",async(e,{dispatch:t})=>(t(U()),t(I({type:"SUCCESS",message:{id:Ae(e)}})),setTimeout(()=>{t(R())},Ie("HIDE_NOTIFICATION_TIMEOUT")),t(w()))),D=e=>I({type:"ERROR",message:{id:e.id,defaultMessage:e.message,parameters:e.properties},error:e});import{createAction as p}from"@reduxjs/toolkit";var k=p("ROUTER/PUSH",(e,t)=>({payload:{location:e,state:t}})),L=p("ROUTER/REPLACE",(e,t)=>({payload:{location:e,state:t}})),Ht=p("ROUTER/GO",e=>({payload:{delta:e}})),Ut=p("ROUTER/GOBACK"),wt=p("ROUTER/GOFORWARD");import{createAction as xe,createReducer as Te}from"@reduxjs/toolkit";var A=xe("SAVE_ERROR",e=>({payload:e})),Oe=null,Lt=Te(Oe,e=>{e.addCase(A,(t,o)=>o.payload)});import{createAction as _,createReducer as Ce}from"@reduxjs/toolkit";var Ne=_("SHOW_MODAL",e=>({payload:e})),Pe=_("CLOSE_MODAL",e=>({payload:e})),He={modals:[]},bt=Ce(He,e=>{e.addCase(Ne,(t,o)=>{let n=o.payload;t.modals.forEach(a=>{a.visible=!1});let r=t.modals.find(a=>a.key===n);r?r.visible=!0:t.modals.push({key:n,visible:!0})}).addCase(Pe,(t,o)=>{let n=o.payload;t.modals=t.modals.filter(a=>a.key!==n);let r=t.modals[t.modals.length-1];r&&(r.visible=!0)})});var x=(r=>(r.IDLE="IDLE",r.LOADING="LOADING",r.FINISHED="FINISHED",r.ERROR="ERROR",r))(x||{});import{createAction as c}from"@reduxjs/toolkit";var v=c("MODULARUI/ERROR_STATUS",(e,t)=>({payload:{key:e,error:t}})),qt=c("MODULARUI/SET",(e,t)=>(t.connectKey=e,{payload:{key:e,model:t}})),Kt=c("MODULARUI/INIT",e=>({payload:e})),Wt=c("MODULARUI/UPDATE",e=>({payload:e})),jt=c("MODULARUI/UPDATE_FORM",e=>({payload:e})),m=c("MODULARUI/REMOVE_KEY",e=>({payload:e})),$t=c("MODULARUI/RESET");import{createSelector as T}from"reselect";import{ContentModel as Ue,ContentTOCModel as we,Href as u}from"@beinformed/ui/models";var b=e=>e?.router?.location?.pathname,Zt=(e,t)=>{let o=e?.i18n?.locale||"en",n=e?.modularui;return n?Object.keys(n).filter(r=>{let a=n[r];return a?.model?a.model instanceof t&&a.model.locale===o:!1}).map(r=>n[r].model):[]},Jt=(e,t)=>{let o=e?.modularui;if(o){let n=e.i18n.locale||"en",r=Object.keys(o).find(a=>{let s=o[a];return s?.model?s.model instanceof t&&s.model.locale===n:!1});if(r){let a=o[r];if(a?.model instanceof t)return a.model}}},Qt=(e,t)=>{let o=b(e),n=e?.i18n?.locale||"en",r=e?.modularui;if(r){let a=Object.keys(r).find(s=>{let i=r[s];return i?.model?i.model instanceof t&&i.model.locale===n&&o?.startsWith(i.model.selfhref?.path||""):!1});if(a){let s=r[a];if(s?.model instanceof t)return s.model}}},eo=(e,t)=>{if(e?.modularui){let o=t instanceof u?t:new u(t),n=Object.keys(e.modularui).find(r=>e.modularui[r].model?.selfhref?.equals(o));if(n)return e.modularui[n].model}},to=(e,t)=>{if(e?.modularui){let o=t instanceof u?t:new u(t);return Object.keys(e.modularui).find(n=>{let{model:r}=e.modularui[n];return r?.selfhref?.equals(o)})}},F=(e,t)=>{if(e?.modularui){let o=t instanceof u?t:new u(t);return Object.keys(e.modularui).filter(n=>{let r=e.modularui[n];if(r)return r.model?.selfhref?.equals(o)})}return[]},De=T([e=>e.modularui],e=>{let t=[];return e&&Object.keys(e).forEach(o=>{let n=e[o];if(n&&"model"in n){let{key:r,selfhref:a,label:s,type:i}=n.model,l={key:r,selfhref:a,label:s,type:i,selfContentLink:null};n.model instanceof Ue||n.model instanceof we?t.push({...l,selfContentLink:n.model.selfContentLink}):t.push(l)}}),t}),oo=T([b,De],(e,t)=>{if(!e||!t.length)return[];let o=new Map(t.filter(s=>s.selfhref).map(s=>[s.selfhref?.toString(),s])),n=[],r=e.split("/"),a="";return r.forEach(s=>{a=a==="/"?`/${s}`:`${a}/${s}`;let i=decodeURIComponent(a).replace("/modelcatalog/","/"),l=o.get(i);if(l){let{key:d,label:te,type:oe,selfhref:re,selfContentLink:O}=l,ne=a.startsWith("/modelcatalog/")&&O?new u(`/modelcatalog${O.encodedHref.toString()}`):re;n.push({key:d,href:ne,label:te,type:oe})}}),n}),ro=T(e=>e.modularui,e=>e?Object.keys(e).filter(t=>e[t]&&e[t].status==="FINISHED").map(t=>e[t].model):[]);import{ApplicationModel as ke}from"@beinformed/ui/models";var y=e=>{let t=e.i18n.locale||"en",o=e.modularui;if(o){let n=Object.keys(o).find(r=>{let a=o[r];return a?.model?a.model instanceof ke&&a.model.locale===t:!1});if(n)return o[n]}};import{createAsyncThunk as ze}from"@reduxjs/toolkit";import{ApplicationModel as Ve,Href as Xe}from"@beinformed/ui/models";import{createAsyncThunk as qe}from"@reduxjs/toolkit";import{HTTP_METHODS as Ke}from"@beinformed/ui/constants";import{ErrorResponse as We,Href as V}from"@beinformed/ui/models";import{ModularUIRequest as je}from"@beinformed/ui/modularui";import{IS_SERVER as Fe}from"@beinformed/ui/constants";import{ErrorResponse as W}from"@beinformed/ui/models";import{logoutPath as Be}from"@beinformed/ui/settings";import{createAsyncThunk as Le}from"@reduxjs/toolkit";import{getBooleanSetting as _e,getStringSetting as ve}from"@beinformed/ui/settings";import{Cache as B}from"@beinformed/ui/utils";var q=Le("auth/unauthorized",(e,{dispatch:t,getState:o})=>{if(e.connectKey&&t(m(e.connectKey)),_e("PAGE_RELOAD_ON_UNAUTHORIZED_ERROR",!1)&&e.response){window.location.reload();return}let n=y(o());(B.getItem("auth")||n?.isLoggedIn)&&t(G()),t(h()),B.removeItem("auth"),e.isInvalidUsername&&t(S(e.message||""));let r=o().router.location,a=ve("LOGIN_PATH","/signin");if(r?.pathname!==a){let s=r?.state?.from;t(L(a,{from:s||o().router.location,modal:!1}))}});import{createAction as be}from"@reduxjs/toolkit";var K=be("NO_ACTION");var Ge=e=>t=>{if(e.isResourceNotFoundAfterReload||e.isRemoteServiceException)return t(K());if(e.isUnauthorized)return t(q(e));if(e.isBlocked||e.isConcurrentUser||e.isInvalidUsername){t(k(Be()));return}return e.isChangePassword?t(M()):Fe?t(A(e)):(setTimeout(()=>{throw e.error||e}),t(D(e)))},j=(e,t)=>o=>o(t(e)),No=e=>{j=e},$=e=>{let t=e instanceof W?e:new W(e);return j(t,Ge)};var z=(e,t)=>e||typeof navigator<"u"&&navigator?.language&&navigator.language.split("-")[0]||t;var $e=async({key:e,href:t,options:o},{dispatch:n,getState:r,rejectWithValue:a})=>{try{let s=z(o?.locale,r().i18n.locale),i=t instanceof V?t:new V(t,"",{origin:o?.origin,contextPath:o?.contextPath}),d=await new je(i,{method:o?.method||Ke.GET,params:o?.params||"",data:o?.data||null,locale:s,childmodels:o?.childmodels??!0,isReload:o?.isReload,cache:o?.cache,headers:o?.headers,events:o?.events,onProgress:o?.onProgress,origin:o?.origin,contextPath:o?.contextPath,targetModel:o?.targetModel,forceTargetModel:o?.forceTargetModel??!1,timeout:o?.timeout}).fetch();return d&&(d.connectKey=e),{key:e,model:d,updateHandler:o?.updateHandler}}catch(s){let i=new We(s,e,{origin:o?.origin,contextPath:o?.contextPath});throw i.isChangePassword||i.isResourceNotFoundAfterReload?n(m(e)):n(v(e,i)),n($(s)),a(i)}},X=qe("modularui/fetchModel",$e,{condition:({key:e},{getState:t})=>{if(t().modularui[e]?.status==="LOADING")return!1}});var G=ze("application/reload",async(e,{dispatch:t,getState:o})=>{let n=o(),r=new Xe("/","Application"),a=y(n);a&&(a.contextPath&&(r.contextPath=a.contextPath),a.origin&&(r.origin=a.origin));let s=F(n,r);for(let d of s)t(m(d));let l=`application(/)(${C(n)}`;await t(X({key:l,href:r,options:{targetModel:Ve}}))});export{ue as a,h as b,S as c,me as d,M as e,ct as f,Z as g,lt as h,ge as i,pt as j,U as k,w as l,St as m,Mt as n,P as o,I as p,R as q,yt as r,Ct as s,D as t,k as u,L as v,Ht as w,Ut as x,wt as y,A as z,Lt as A,Ne as B,Pe as C,bt as D,x as E,v as F,qt as G,Kt as H,Wt as I,jt as J,m as K,$t as L,Zt as M,Jt as N,Qt as O,eo as P,to as Q,F as R,oo as S,ro as T,y as U,G as V,q as W,K as X,No as Y,$ as Z,z as _,X as $};
2
+ //# sourceMappingURL=chunk-GHKA2XFO.js.map