@beinformed/react 1.0.0-beta.0

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 (119) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE.md +1 -0
  3. package/dist/ErrorBoundaryFallback-D6YQem9P.d.cts +13 -0
  4. package/dist/ErrorBoundaryFallback-D6YQem9P.d.ts +13 -0
  5. package/dist/beforeRenderHooks-CNvsMmi8.d.cts +18 -0
  6. package/dist/beforeRenderHooks-Gb0tcmCY.d.ts +18 -0
  7. package/dist/chunk-347XDLN7.js +1 -0
  8. package/dist/chunk-347XDLN7.js.map +1 -0
  9. package/dist/chunk-3OP2KQ56.js +2 -0
  10. package/dist/chunk-3OP2KQ56.js.map +1 -0
  11. package/dist/chunk-4AC7YQ5Q.js +2 -0
  12. package/dist/chunk-4AC7YQ5Q.js.map +1 -0
  13. package/dist/chunk-6E5DAS6G.js +1 -0
  14. package/dist/chunk-6E5DAS6G.js.map +1 -0
  15. package/dist/chunk-6KRECIRI.js +2 -0
  16. package/dist/chunk-6KRECIRI.js.map +1 -0
  17. package/dist/chunk-A4USB53Q.js +2 -0
  18. package/dist/chunk-A4USB53Q.js.map +1 -0
  19. package/dist/chunk-AMFWIR2R.js +2 -0
  20. package/dist/chunk-AMFWIR2R.js.map +1 -0
  21. package/dist/chunk-B7PQLTVC.js +2 -0
  22. package/dist/chunk-B7PQLTVC.js.map +1 -0
  23. package/dist/chunk-DI7VM62A.js +2 -0
  24. package/dist/chunk-DI7VM62A.js.map +1 -0
  25. package/dist/chunk-FW4363Y4.js +2 -0
  26. package/dist/chunk-FW4363Y4.js.map +1 -0
  27. package/dist/chunk-HDOILTJ2.js +2 -0
  28. package/dist/chunk-HDOILTJ2.js.map +1 -0
  29. package/dist/chunk-JYAETKRB.js +2 -0
  30. package/dist/chunk-JYAETKRB.js.map +1 -0
  31. package/dist/chunk-K3DTH6XN.js +2 -0
  32. package/dist/chunk-K3DTH6XN.js.map +1 -0
  33. package/dist/chunk-KNEDBCHP.js +2 -0
  34. package/dist/chunk-KNEDBCHP.js.map +1 -0
  35. package/dist/chunk-MT7D3AJU.js +12 -0
  36. package/dist/chunk-MT7D3AJU.js.map +1 -0
  37. package/dist/chunk-RKGGCIUD.js +2 -0
  38. package/dist/chunk-RKGGCIUD.js.map +1 -0
  39. package/dist/chunk-UZIZDEU6.js +2 -0
  40. package/dist/chunk-UZIZDEU6.js.map +1 -0
  41. package/dist/chunk-VFLYA5WJ.js +2 -0
  42. package/dist/chunk-VFLYA5WJ.js.map +1 -0
  43. package/dist/chunk-VG3QU524.js +22 -0
  44. package/dist/chunk-VG3QU524.js.map +1 -0
  45. package/dist/chunk-WBPDMDW4.js +2 -0
  46. package/dist/chunk-WBPDMDW4.js.map +1 -0
  47. package/dist/chunk-X2C7CKOK.js +2 -0
  48. package/dist/chunk-X2C7CKOK.js.map +1 -0
  49. package/dist/chunk-X3N2NQVZ.js +2 -0
  50. package/dist/chunk-X3N2NQVZ.js.map +1 -0
  51. package/dist/chunk-Y7ESITVO.js +2 -0
  52. package/dist/chunk-Y7ESITVO.js.map +1 -0
  53. package/dist/chunk-YG7XDCNV.js +2 -0
  54. package/dist/chunk-YG7XDCNV.js.map +1 -0
  55. package/dist/chunk-YJNJVQFW.js +2 -0
  56. package/dist/chunk-YJNJVQFW.js.map +1 -0
  57. package/dist/chunk-Z2Y3OPVI.js +2 -0
  58. package/dist/chunk-Z2Y3OPVI.js.map +1 -0
  59. package/dist/client/index.cjs +12 -0
  60. package/dist/client/index.cjs.map +1 -0
  61. package/dist/client/index.d.cts +84 -0
  62. package/dist/client/index.d.ts +84 -0
  63. package/dist/client/index.js +2 -0
  64. package/dist/client/index.js.map +1 -0
  65. package/dist/components/index.cjs +12 -0
  66. package/dist/components/index.cjs.map +1 -0
  67. package/dist/components/index.d.cts +28 -0
  68. package/dist/components/index.d.ts +28 -0
  69. package/dist/components/index.js +2 -0
  70. package/dist/components/index.js.map +1 -0
  71. package/dist/hooks/index.cjs +2 -0
  72. package/dist/hooks/index.cjs.map +1 -0
  73. package/dist/hooks/index.d.cts +353 -0
  74. package/dist/hooks/index.d.ts +353 -0
  75. package/dist/hooks/index.js +2 -0
  76. package/dist/hooks/index.js.map +1 -0
  77. package/dist/i18n/index.cjs +2 -0
  78. package/dist/i18n/index.cjs.map +1 -0
  79. package/dist/i18n/index.d.cts +26 -0
  80. package/dist/i18n/index.d.ts +26 -0
  81. package/dist/i18n/index.js +2 -0
  82. package/dist/i18n/index.js.map +1 -0
  83. package/dist/index.cjs +32 -0
  84. package/dist/index.cjs.map +1 -0
  85. package/dist/index.d.cts +27 -0
  86. package/dist/index.d.ts +27 -0
  87. package/dist/index.js +2 -0
  88. package/dist/index.js.map +1 -0
  89. package/dist/redux/index.cjs +2 -0
  90. package/dist/redux/index.cjs.map +1 -0
  91. package/dist/redux/index.d.cts +458 -0
  92. package/dist/redux/index.d.ts +458 -0
  93. package/dist/redux/index.js +2 -0
  94. package/dist/redux/index.js.map +1 -0
  95. package/dist/server/index.cjs +22 -0
  96. package/dist/server/index.cjs.map +1 -0
  97. package/dist/server/index.d.cts +78 -0
  98. package/dist/server/index.d.ts +78 -0
  99. package/dist/server/index.js +2 -0
  100. package/dist/server/index.js.map +1 -0
  101. package/dist/styled-components.d-CrkOxzv5.d.cts +346 -0
  102. package/dist/styled-components.d-CrkOxzv5.d.ts +346 -0
  103. package/dist/theme/index.cjs +2 -0
  104. package/dist/theme/index.cjs.map +1 -0
  105. package/dist/theme/index.d.cts +112 -0
  106. package/dist/theme/index.d.ts +112 -0
  107. package/dist/theme/index.js +2 -0
  108. package/dist/theme/index.js.map +1 -0
  109. package/dist/types-CGXygEPz.d.cts +8 -0
  110. package/dist/types-CGXygEPz.d.ts +8 -0
  111. package/dist/useForm-CG_DMYfZ.d.cts +178 -0
  112. package/dist/useForm-DW-a5mcV.d.ts +178 -0
  113. package/dist/utils/index.cjs +2 -0
  114. package/dist/utils/index.cjs.map +1 -0
  115. package/dist/utils/index.d.cts +6 -0
  116. package/dist/utils/index.d.ts +6 -0
  117. package/dist/utils/index.js +2 -0
  118. package/dist/utils/index.js.map +1 -0
  119. package/package.json +125 -0
@@ -0,0 +1,2 @@
1
+ import{c as b}from"./chunk-RKGGCIUD.js";import{c as ee,d as te,j as oe,k as re,l as ne,m as se,n as ie,o as ae,p as ce,q as T}from"./chunk-Z2Y3OPVI.js";import{B as Q,C as X,K as I,O as R,V as O,d as L,g as ft,h as Mt,i as F,k as w,l as _,m as N,n as $,p as j,q as G,s as K,u as z,v as V,w as W,x as J,y as Y}from"./chunk-Y7ESITVO.js";import{a as Z}from"./chunk-JYAETKRB.js";import{a as ht}from"./chunk-YJNJVQFW.js";import{a as xt}from"./chunk-A4USB53Q.js";import{d as B,f as gt}from"./chunk-WBPDMDW4.js";import{d as dt,e as pt,f as mt,h as u,i as d}from"./chunk-6KRECIRI.js";import{a as f,b as ut}from"./chunk-FW4363Y4.js";var E=f((Os,Se)=>{"use strict";var so=pt(),io=function(){try{var e=so(Object,"defineProperty");return e({},"",{}),e}catch{}}();Se.exports=io});var Re=f((bs,Ue)=>{"use strict";var Ce=E();function ao(e,t,o){t=="__proto__"&&Ce?Ce(e,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[t]=o}Ue.exports=ao});var ve=f((Ss,Te)=>{"use strict";var co=Re(),lo=mt(),uo=Object.prototype,po=uo.hasOwnProperty;function mo(e,t,o){var r=e[t];(!(po.call(e,t)&&lo(r,o))||o===void 0&&!(t in e))&&co(e,t,o)}Te.exports=mo});var De=f((Cs,Pe)=>{"use strict";var fo=ve(),go=B(),Mo=ft(),He=dt(),xo=gt();function ho(e,t,o,r){if(!He(e))return e;t=go(t,e);for(var n=-1,s=t.length,i=s-1,a=e;a!=null&&++n<s;){var c=xo(t[n]),p=o;if(c==="__proto__"||c==="constructor"||c==="prototype")return e;if(n!=i){var m=a[c];p=r?r(m,c,a):void 0,p===void 0&&(p=He(m)?m:Mo(t[n+1])?[]:{})}fo(a,c,p),a=a[c]}return e}Pe.exports=ho});var Ee=f((Us,qe)=>{"use strict";var yo=ht(),Io=De(),Oo=B();function bo(e,t,o){for(var r=-1,n=t.length,s={};++r<n;){var i=t[r],a=yo(e,i);o(a,i)&&Io(s,Oo(i,e),a)}return s}qe.exports=bo});var ke=f((Rs,Ae)=>{"use strict";function So(e,t){return e!=null&&t in Object(e)}Ae.exports=So});var Be=f((Ts,Le)=>{"use strict";var Co=ke(),Uo=Mt();function Ro(e,t){return e!=null&&Uo(e,t,Co)}Le.exports=Ro});var we=f((vs,Fe)=>{"use strict";var To=Ee(),vo=Be();function Ho(e,t){return To(e,t,function(o,r){return vo(e,r)})}Fe.exports=Ho});var Ne=f((Hs,_e)=>{"use strict";var Po=xt();function Do(e){var t=e==null?0:e.length;return t?Po(e,1):[]}_e.exports=Do});var je=f((Ps,$e)=>{"use strict";function qo(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)}$e.exports=qo});var ze=f((Ds,Ke)=>{"use strict";var Eo=je(),Ge=Math.max;function Ao(e,t,o){return t=Ge(t===void 0?e.length-1:t,0),function(){for(var r=arguments,n=-1,s=Ge(r.length-t,0),i=Array(s);++n<s;)i[n]=r[t+n];n=-1;for(var a=Array(t+1);++n<t;)a[n]=r[n];return a[t]=o(i),Eo(e,this,a)}}Ke.exports=Ao});var We=f((qs,Ve)=>{"use strict";function ko(e){return function(){return e}}Ve.exports=ko});var Ye=f((Es,Je)=>{"use strict";function Lo(e){return e}Je.exports=Lo});var Ze=f((As,Xe)=>{"use strict";var Bo=We(),Qe=E(),Fo=Ye(),wo=Qe?function(e,t){return Qe(e,"toString",{configurable:!0,enumerable:!1,value:Bo(t),writable:!0})}:Fo;Xe.exports=wo});var tt=f((ks,et)=>{"use strict";var _o=800,No=16,$o=Date.now;function jo(e){var t=0,o=0;return function(){var r=$o(),n=No-(r-o);if(o=r,n>0){if(++t>=_o)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}et.exports=jo});var rt=f((Ls,ot)=>{"use strict";var Go=Ze(),Ko=tt(),zo=Ko(Go);ot.exports=zo});var st=f((Bs,nt)=>{"use strict";var Vo=Ne(),Wo=ze(),Jo=rt();function Yo(e){return Jo(Wo(e,void 0,Vo),e+"")}nt.exports=Yo});var at=f((Fs,it)=>{"use strict";var Qo=we(),Xo=st(),Zo=Xo(function(e,t){return e==null?{}:Qo(e,t)});it.exports=Zo});import{useEffect as bt,useState as v}from"react";import{HTTP_METHODS as St}from"@beinformed/ui/constants";import{FormModel as Ct,ListModel as Ut}from"@beinformed/ui/models";import{ModularUIRequest as yt}from"@beinformed/ui/modularui";import{createSelector as It}from"reselect";var Ot=It([Z],e=>(t,o)=>{let r=new yt(t,o);return r.locale=e,r}),le=()=>d(Ot);var mr=e=>{let t=le(),[o,r]=v(null),[n,s]=v(0),[i,a]=v(0);return bt(()=>{let c=Rt(e).map(p=>{let m=p.selfhref.addParameter("commit","false");return t(m,{method:St.POST}).fetch().then(g=>(g instanceof Ct&&(g.tokens=[]),{[p.name]:g}))});s(c.length),Promise.all(c).then(p=>{let m=Object.assign({},...p);r(m),a(p.length)})},[e,t]),i===n?o:null},Rt=e=>{if(!e.actionCollection)return[];let o=[...e.actionCollection.getActionsByType("create").filter(s=>!s.isDisabled)];e instanceof Ut&&e.listItemCollection.forEach(s=>{let i=s.actionCollection.getActionsByType("update").filter(a=>!a.isDisabled);o.push(...i)});let r=[],n=[];return o.forEach(s=>{n.includes(s.name)||(n.push(s.name),r.push(s))}),r};import{DEFAULT_AUTHENTICATION_TYPE as ue}from"@beinformed/ui/constants";import{IllegalStateException as Tt}from"@beinformed/ui/exceptions";import{getContextPathServer as de,logoutPath as vt}from"@beinformed/ui/settings";import{Cache as h}from"@beinformed/ui/utils";var Cr=()=>{h.setItem("isRedirectLogin",!1);let e=u(),t=d(R),o=d(n=>n.auth),r=t?.isLoggedIn??!1;return{isAuthenticated:r,authenticationTypes:t?.authenticationTypes??[ue],errorMessage:o.error,resetErrors:()=>e(L()),login:(n,s)=>e(ee({username:n,password:s})),redirectLogin:n=>{if(h.getItem("isRedirectLogin"))throw new Tt(`Could not redirect to '${n.authentication}' using url: '${n.redirectUri??""}'`);r||(h.setItem("isRedirectLogin",!0),window.location.assign(`${de()}${n.redirectUri??""}`))}}},Ur=()=>{let e=u(),t=d(R),o=vt(),r=de();return{isAuthenticated:t?.isLoggedIn??!1,authenticationTypes:t?.authenticationTypes??[ue],logout:()=>{if(h.getItem("isRedirectLogin")){let s=window.location.origin,i=`${s}${r}/logout?url=${s}${r}${o}`;h.setItem("isRedirectLogin",!1),window.location.assign(i)}else return e(te())}}};import{useEffect as Ht,useState as Pt}from"react";import{ModularUIRequest as Dt}from"@beinformed/ui/modularui";var pe=()=>{let e=u();return{...d(o=>o.progressindicator),start:()=>e(w()),finish:()=>e(_()),reset:()=>e(N()),update:o=>e($(o))}};var Ar=(e,t)=>{let[o,r]=Pt([]),n=b(),{start:s,finish:i}=pe(),a=e.map(p=>p.link?.selfhref.href).filter((p,m,g)=>g.indexOf(p)===m).map(p=>p?.toString()),c=JSON.stringify(a);return Ht(()=>{let p=JSON.parse(c).map(m=>{let g=new Dt(m);return g.locale=n,g.fetchContent(t)});s(),Promise.all(p).then(m=>{r(m),i()})},[c,n,t]),o};import{useEffect as qt,useRef as me}from"react";import{dequal as Et}from"dequal/lite";var At=e=>{let t=me(null),o=me(0);return Et(e,t.current)||(t.current=e,o.current+=1),[o.current]};function fe(e,t){return qt(e,At(t))}import{HTTP_METHODS as Me}from"@beinformed/ui/constants";import{FormModel as D,Href as wt}from"@beinformed/ui/models";import{getSetting as _t}from"@beinformed/ui/settings";import{produce as Nt}from"immer";import{useEffect as kt,useMemo as P,useRef as H}from"react";import{HTTP_METHODS as Lt}from"@beinformed/ui/constants";import{Href as ge}from"@beinformed/ui/models";import{useLocation as Bt}from"react-router";var Ft=(e,t)=>{let o=b();return P(()=>`${e}(${t.split("?")[0]})(${o})`,[e,t,o])},S=(e,t,o={method:Lt.GET,removeOnUnmount:!1})=>{let r=u(),n=P(()=>t?.toString()||"",[t]),s=Ft(e,n),i=P(()=>U=>U.modularui[s],[s]),a=d(i);t instanceof ge&&(o.origin=o.origin??t.origin,o.contextPath=o.contextPath??t.contextPath);let c=Bt(),p=c!==null&&typeof c=="object"&&c.state!==null&&typeof c.state=="object"&&"redirectLocation"in c.state?c.state.redirectLocation:void 0,m=a==null||(p instanceof ge?p?.equals(n):!1),g=H(o),A=H(n),k=H(m);return fe(()=>{let U=A.current===n&&g.current.isReload&&!o.isReload,lt=m&&!k.current;n!==""&&(lt||!U)&&r(O({key:s,href:n,options:o})),g.current=o,A.current=n,k.current=m},[s,n,o,m]),kt(()=>{if(o.removeOnUnmount)return()=>{r(I(s))}},[r,s,o.removeOnUnmount]),a};var cn=(e,t)=>{let o=new wt(e);_t("ALWAYS_COMMIT_FORM")||o.addParameter("commit","false");let r=S("form",o,{method:Me.POST,targetModel:D,removeOnUnmount:!0,data:t?JSON.stringify(t):void 0,origin:o.origin,contextPath:o.contextPath});if(r?.model)return r.model},ln=()=>{let e=u();return{previous:i=>e(re(i)),cancel:i=>e(ne(i)),submit:i=>e(O({key:i.connectKey||i.key,href:i.selfhref,options:{method:Me.POST,data:i.formdata,updateHandler:a=>a instanceof D?Nt(a,c=>{c.update(a)}):a,targetModel:D}})),remove:i=>e(I(i.connectKey||"")),showFormNotification:i=>e(K(i))}},un=(e,t)=>{let o=u();return(r,n,s)=>o(oe({form:e,formObject:t,attribute:r,inputvalue:n,options:s}))},dn=e=>{let t=u();return{save:()=>t(se(e)),cancel:o=>t(ie(e,o)),remove:o=>t(ae(e,o))}};import{useCallback as xe}from"react";import{IllegalArgumentException as $t}from"@beinformed/ui/exceptions";var xn=e=>{if(!e)throw new $t("Missing modalId argument for useModal hook");let t=u(),o=d(s=>s.modals.modals.find(i=>i.key===e)),r=xe(()=>{t(Q(e))},[t,e]),n=xe(()=>{t(X(e))},[t,e]);return{key:o?o.key:null,size:o?o.size:null,visible:o?o.visible:!1,show:r,close:n}};import{ConceptIndexModel as he,ContentIndexModel as Kt,ContentTOCModel as zt,ContentTypeModel as Vt,Href as Wt,ModelCatalogModel as Jt}from"@beinformed/ui/models";import{createHref as y,filterParameters as q}from"@beinformed/ui/utils";import{useMemo as C}from"react";var M=()=>d(e=>e.router.location),On=()=>M()?.key??"",bn=()=>M()?.search,Sn=()=>M()?.pathname,Cn=()=>{let e=u();return{push:(t,o)=>e(z(t,o)),replace:(t,o)=>e(V(t,o)),go:t=>e(W(t)),goBack:()=>e(J()),goForward:()=>e(Y())}};var jt=(e,t,o)=>{let r={targetModel:void 0,forceTargetModel:void 0,isReload:!1,origin:void 0,contextPath:void 0,cache:!1};return e.targetModel&&(r.targetModel=e.targetModel,r.forceTargetModel=e.forceTargetModel),e.cache&&(r.cache=e.cache),o!==null&&typeof o=="object"&&"state"in o&&o.state!==null&&typeof o.state=="object"&&"reload"in o.state&&"pathname"in o&&typeof o.pathname=="string"&&o.pathname.startsWith(t)&&(r.isReload=!0),r.origin=e.origin??r.origin,r.contextPath=e.contextPath??r.contextPath,r},Gt=(e,t)=>{t.length>0&&(t.some(r=>{if(e!==null&&typeof e=="object"&&"type"in e)return e.type===r})||console.warn(e,"is not of instance",t))},l=(e,t,o={expectedModels:[],targetModel:void 0,forceTargetModel:!1,origin:void 0,contextPath:void 0})=>{let r=M(),n=C(()=>t.toString(),[t]),s=C(()=>jt(o,n,r),[o,n,r]),i=S(e,t,s),a=C(()=>o.expectedModels??[],[o.expectedModels]);return C(()=>{if(i?.model)return Gt(i.model,a),i.model},[a,i])};var Bn=e=>l("modelcatalog","/modelcatalog",{expectedModels:["ModelCatalog"],targetModel:Jt,...e}),Yt=(e,t="conceptindex",o)=>{let{entryDate:r}=x(),n=q(e,["index","label","modelcategory","type"]);return n.setParameter("entryDate",r),l(t,n,{expectedModels:["ConceptIndex"],targetModel:he,...o})},Fn=(e,t="conceptdetail",o)=>{let{entryDate:r}=x(),n=M(),s=y("concepts",e,r,n,[]);return l(t,s,{expectedModels:["ConceptDetail","BusinessScenario"],...o})},Qt=(e,t="contentindex",o)=>{let r=q(e,["index","label","type"]);return l(t,r,{expectedModels:["ContentIndex"],targetModel:Kt,...o})},wn=(e,t="contenttoc",o)=>{let{entryDate:r}=x(),n=M(),s=y("content",e,r,n,["complete"]);return l(t,s,{expectedModels:["ContentTOC"],targetModel:zt,...o})},_n=(e,t="content",o)=>{let{entryDate:r}=x(),n=M(),s=y("content",e,r,n,["complete"]);return l(t,s,{expectedModels:["Content","ContentTOC"],...o})},Nn=(e,t="content",o)=>{let{entryDate:r}=x(),n=M(),s=new Wt(e);s.removeParameter("complete"),s.addParameter("complete","true");let i=y("content",s,r,n,["complete"]);return l(t,i,{expectedModels:["Content","ContentTOC"],...o})},$n=(e,t="contenttypes",o)=>{let r=y("contenttypes",e,void 0,void 0,[]);return l(t,r,{expectedModels:["ContentType"],targetModel:Vt,...o})},jn=(e,t="relatedconcepts",o)=>{let{entryDate:r}=x(),n=q(e,["modelcategory"]);return n.setParameter("entryDate",r),l(t,n,{expectedModels:["ConceptIndex"],targetModel:he,...o})},ye=(e,t)=>{let o=[];for(let r of Object.keys(t)){let n=t[r];if(n){let s=Array.isArray(n)?n.join(","):n;r==="type"&&(s=s.replace("#","%23")),o.push(`${r}=${s}`)}}return o.length?`${e}?${o.join("&")}`:e},Gn=(e,t,o)=>{let r=ye("/concepts",e);return Yt(r,t,o)},Kn=(e,t,o)=>{let r=ye("/content",e);return Qt(r,t,o)},x=()=>{let e=u();return{entryDate:d(ce),setEntryDate:o=>e(F(o))}};import{createSelector as Xt}from"reselect";var Xn=()=>{let e=u(),o=Xt([n=>n.modularui],n=>{let s=[],i=Object.keys(n);for(let a of i){let c=n[a];c?.status==="FINISHED"&&s.push(c.model)}return s}),r=d(o);return{reload:(n,s)=>{e(T(n,s))},reloadWithFilter:(n,s)=>{let i=r.filter(n);for(let a of i)a&&e(T(a,s))}}};import{ApplicationModel as Zt,CaseSearchModel as Ie,CaseViewModel as eo,DetailModel as Oe,GroupingPanelModel as to,ListDetailModel as oo,ListModel as be,TabModel as ro,UserProfileModel as no}from"@beinformed/ui/models";var os=e=>l("application","/",{expectedModels:["Application"],targetModel:Zt,...e}),rs=(e,t)=>l("tab",e,{expectedModels:["Tab"],targetModel:ro,...t}),ns=(e,t)=>l("caseview",e,{expectedModels:["CaseView"],targetModel:eo,...t}),ss=(e,t)=>l("panel",e,{expectedModels:["List","GroupingPanel","Detail"],...t}),is=(e,t)=>l("list",e,{expectedModels:["List"],targetModel:be,...t}),as=(e,t)=>l("list",e,{expectedModels:["List","Detail"],targetModel:[be,Oe],...t}),cs=(e,t)=>l("listdetail",e,{expectedModels:["ListDetail"],targetModel:oo,forceTargetModel:!0,...t}),ls=(e,t)=>l("groupingpanel",e,{expectedModels:["GroupingPanel"],targetModel:to,...t}),us=(e,t)=>l("detailpanel",e,{expectedModels:["Detail"],targetModel:Oe,...t}),ds=(e,t)=>l("quicksearch",e,{expectedModels:["CaseSearch"],targetModel:Ie,...t}),ps=(e,t)=>l("search",e,{expectedModels:["CaseSearch"],targetModel:Ie,...t}),ms=(e,t)=>l("userprofile",e,{expectedModels:["UserProfile"],targetModel:no,...t});var hs=()=>{let e=u(),{render:t,messageType:o,message:r,error:n}=d(s=>s.notification);return{render:t,messageType:o,message:r,error:n,dismiss:()=>e(G())}},ys=()=>{let e=u();return(t,o)=>e(j({type:"ERROR",message:t,error:o}))};var ct=ut(at(),1);import{useMemo as er}from"react";import{createSelector as tr}from"reselect";var or=e=>e.preferences,rr=e=>{let t=Array.isArray(e)?e:[e];return tr([or],o=>(0,ct.default)(o,t))},$s=e=>{let t=er(()=>rr(e),[Array.isArray(e)?e.join(","):e]);return d(t)};export{le as a,mr as b,Cr as c,Ur as d,pe as e,Ar as f,fe as g,S as h,cn as i,ln as j,un as k,dn as l,xn as m,M as n,On as o,bn as p,Sn as q,Cn as r,l as s,Bn as t,Yt as u,Fn as v,Qt as w,wn as x,_n as y,Nn as z,$n as A,jn as B,Gn as C,Kn as D,x as E,Xn as F,os as G,rs as H,ns as I,ss as J,is as K,as as L,cs as M,ls as N,us as O,ds as P,ps as Q,ms as R,hs as S,ys as T,$s as U};
2
+ //# sourceMappingURL=chunk-UZIZDEU6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignValue.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSet.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePickBy.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHasIn.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/hasIn.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePick.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/flatten.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overRest.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/constant.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSetToString.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_shortOut.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToString.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_flatRest.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/pick.js","../src/hooks/useAllFormsOnModel.ts","../src/hooks/useModularUIRequest.ts","../src/hooks/useAuthentication.ts","../src/hooks/useContent.ts","../src/hooks/useProgressIndicator.ts","../src/hooks/useDeepCompareEffect.ts","../src/hooks/useForm.ts","../src/hooks/useModularUI.ts","../src/hooks/useModal.ts","../src/hooks/useModelCatalog.ts","../src/hooks/useModularUIBasic.ts","../src/hooks/useRouter.ts","../src/hooks/useModels.ts","../src/hooks/useModularUIModel.ts","../src/hooks/useNotification.ts","../src/hooks/usePreference.ts"],"sourcesContent":["var getNative = require('./_getNative');\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nmodule.exports = defineProperty;\n","var defineProperty = require('./_defineProperty');\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nmodule.exports = baseAssignValue;\n","var baseAssignValue = require('./_baseAssignValue'),\n eq = require('./eq');\n\n/** 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 * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nmodule.exports = assignValue;\n","var assignValue = require('./_assignValue'),\n castPath = require('./_castPath'),\n isIndex = require('./_isIndex'),\n isObject = require('./isObject'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\nfunction baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return object;\n }\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n}\n\nmodule.exports = baseSet;\n","var baseGet = require('./_baseGet'),\n baseSet = require('./_baseSet'),\n castPath = require('./_castPath');\n\n/**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\nfunction basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {};\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path);\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value);\n }\n }\n return result;\n}\n\nmodule.exports = basePickBy;\n","/**\n * The base implementation of `_.hasIn` 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 baseHasIn(object, key) {\n return object != null && key in Object(object);\n}\n\nmodule.exports = baseHasIn;\n","var baseHasIn = require('./_baseHasIn'),\n hasPath = require('./_hasPath');\n\n/**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\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 = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\nfunction hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n}\n\nmodule.exports = hasIn;\n","var basePickBy = require('./_basePickBy'),\n hasIn = require('./hasIn');\n\n/**\n * The base implementation of `_.pick` without support for individual\n * property identifiers.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @returns {Object} Returns the new object.\n */\nfunction basePick(object, paths) {\n return basePickBy(object, paths, function(value, path) {\n return hasIn(object, path);\n });\n}\n\nmodule.exports = basePick;\n","var baseFlatten = require('./_baseFlatten');\n\n/**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\nfunction flatten(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, 1) : [];\n}\n\nmodule.exports = flatten;\n","/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\nmodule.exports = apply;\n","var apply = require('./_apply');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\nmodule.exports = overRest;\n","/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nmodule.exports = constant;\n","/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n","var constant = require('./constant'),\n defineProperty = require('./_defineProperty'),\n identity = require('./identity');\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\nmodule.exports = baseSetToString;\n","/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeNow = Date.now;\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\nmodule.exports = shortOut;\n","var baseSetToString = require('./_baseSetToString'),\n shortOut = require('./_shortOut');\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\nmodule.exports = setToString;\n","var flatten = require('./flatten'),\n overRest = require('./_overRest'),\n setToString = require('./_setToString');\n\n/**\n * A specialized version of `baseRest` which flattens the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\nfunction flatRest(func) {\n return setToString(overRest(func, undefined, flatten), func + '');\n}\n\nmodule.exports = flatRest;\n","var basePick = require('./_basePick'),\n flatRest = require('./_flatRest');\n\n/**\n * Creates an object composed of the picked `object` properties.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pick(object, ['a', 'c']);\n * // => { 'a': 1, 'c': 3 }\n */\nvar pick = flatRest(function(object, paths) {\n return object == null ? {} : basePick(object, paths);\n});\n\nmodule.exports = pick;\n","import { useEffect, useState } from \"react\";\n\nimport { HTTP_METHODS } from \"@beinformed/ui/constants\";\nimport { FormModel, ListModel } from \"@beinformed/ui/models\";\n\nimport { useModularUIRequest } from \"./useModularUIRequest\";\n\nimport type { ActionModel, DetailModel, TabModel } from \"@beinformed/ui/models\";\n\nexport const useRetrieveFormsOnModel = (\n model: ListModel | DetailModel | TabModel,\n) => {\n const modularui = useModularUIRequest();\n\n const [forms, setForms] = useState(null);\n const [requestCount, setRequestCount] = useState(0);\n const [responseCount, setResponseCount] = useState(0);\n\n useEffect(() => {\n const requests = getActions(model).map((action) => {\n const href = action.selfhref.addParameter(\"commit\", \"false\");\n\n return modularui(href, { method: HTTP_METHODS.POST })\n .fetch()\n .then((form) => {\n if (form instanceof FormModel) {\n form.tokens = [];\n }\n return { [action.name]: form };\n });\n });\n\n setRequestCount(requests.length);\n\n Promise.all(requests).then((responses) => {\n // put response array in object\n const actionForms = Object.assign({}, ...responses);\n setForms(actionForms);\n setResponseCount(responses.length);\n });\n }, [model, modularui]);\n\n if (responseCount === requestCount) {\n return forms;\n }\n\n return null;\n};\n\nconst getActions = (model: ListModel | DetailModel | TabModel) => {\n if (!model.actionCollection) {\n return [];\n }\n\n const createActions = model.actionCollection\n .getActionsByType(\"create\")\n .filter((action) => !action.isDisabled);\n\n const allActions = [...createActions];\n\n if (model instanceof ListModel) {\n model.listItemCollection.forEach((listItem) => {\n const updateActions = listItem.actionCollection\n .getActionsByType(\"update\")\n .filter((action) => !action.isDisabled);\n\n allActions.push(...updateActions);\n });\n }\n\n const actions: ActionModel[] = [];\n const unique: string[] = [];\n allActions.forEach((action) => {\n if (!unique.includes(action.name)) {\n unique.push(action.name);\n actions.push(action);\n }\n });\n\n return actions;\n};\n","import { ModularUIRequest } from \"@beinformed/ui/modularui\";\nimport { createSelector } from \"reselect\";\n\nimport { useBEISelector } from \"../redux/hooks\";\nimport { getLocale } from \"../redux/i18n/i18nSelectors\";\n\nimport type { Href } from \"@beinformed/ui/models\";\nimport type { ModularUIRequestOptions } from \"@beinformed/ui/utils\";\n\nconst getModularUIRequest = createSelector([getLocale], (localeCode) => {\n return (href: Href, options?: ModularUIRequestOptions) => {\n const request = new ModularUIRequest(href, options);\n request.locale = localeCode;\n return request;\n };\n});\n\n/**\n * Creates a ModularUIRequest with the locale as available in the redux store\n */\nexport const useModularUIRequest = (): ((\n href: Href,\n options?: ModularUIRequestOptions,\n) => ModularUIRequest) => useBEISelector(getModularUIRequest);\n","import { DEFAULT_AUTHENTICATION_TYPE } from \"@beinformed/ui/constants\";\nimport { IllegalStateException } from \"@beinformed/ui/exceptions\";\nimport { getContextPathServer, logoutPath } from \"@beinformed/ui/settings\";\nimport { Cache } from \"@beinformed/ui/utils\";\n\nimport { getApplication } from \"../redux/application/applicationSelectors\";\nimport { resetAuthErrors } from \"../redux/auth/authReducer\";\nimport { login } from \"../redux/auth/signinActions\";\nimport { logout } from \"../redux/auth/signoutActions\";\nimport { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\n\nimport type { AuthenticationType } from \"@beinformed/ui/modularui\";\nimport type { RootState } from \"../redux/store\";\n\n/**\n * Provides access to authentication state and actions.\n * Includes functionality for standard username/password login and redirect-based login.\n * @returns An object containing authentication status, available authentication types, error messages, and login/logout functions.\n */\nexport const useLogin = () => {\n Cache.setItem(\"isRedirectLogin\", false);\n\n const dispatch = useBEIDispatch();\n\n const application = useBEISelector(getApplication);\n const auth = useBEISelector((state: RootState) => state.auth);\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n\n return {\n /**\n * Indicates whether the user is currently authenticated.\n */\n isAuthenticated,\n\n /**\n * An array of available authentication types supported by the application.\n * Defaults to an array containing the `DEFAULT_AUTHENTICATION_TYPE` if no types are available in the application state.\n */\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n\n /**\n * The current authentication error message, if any.\n */\n errorMessage: auth.error,\n\n /**\n * Resets the authentication error message in the Redux store.\n */\n resetErrors: () => dispatch(resetAuthErrors()),\n\n /**\n * Attempts to log in the user with the provided username and password.\n * Dispatches the `login` action to the Redux store.\n * @param username The username for authentication.\n * @param password The password for authentication.\n */\n login: (username: string, password: string) =>\n dispatch(login({ username, password })),\n\n /**\n * Initiates a redirect-based login flow for a specific authentication type.\n * If a redirect login is already in progress, it throws an `IllegalStateException` to prevent infinite loops.\n * If the user is not currently authenticated, it sets a flag in the cache and redirects the browser to the authentication provider's redirect URI.\n * @param authenticationType The authentication type to initiate the redirect for.\n * @throws {IllegalStateException} If a redirect login is already in progress for a different authentication type.\n */\n redirectLogin: (authenticationType: AuthenticationType) => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n // prevent endless loop in redirects when authentication type can't be redirected\n throw new IllegalStateException(\n `Could not redirect to '${\n authenticationType.authentication\n }' using url: '${authenticationType.redirectUri ?? \"\"}'`,\n );\n }\n\n if (!isAuthenticated) {\n Cache.setItem(\"isRedirectLogin\", true);\n window.location.assign(\n `${getContextPathServer()}${authenticationType.redirectUri ?? \"\"}`,\n );\n }\n },\n };\n};\n\n/**\n * Provides access to logout functionality.\n * Handles both standard logout and redirect-based logout scenarios.\n * @returns An object containing the authentication status, available authentication types, and the logout function.\n */\nexport const useLogout = () => {\n const dispatch = useBEIDispatch();\n const application = useBEISelector(getApplication);\n\n const LOGOUT_PATH = logoutPath();\n const BASE_PATH = getContextPathServer();\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n return {\n /**\n * Indicates whether the user is currently authenticated.\n */\n isAuthenticated,\n\n /**\n * An array of available authentication types supported by the application.\n * Defaults to an array containing the `DEFAULT_AUTHENTICATION_TYPE` if no types are available in the application state.\n */\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n\n /**\n * Initiates the logout process.\n * If a redirect login was in progress, it redirects the user to the server's logout endpoint with a return URL to the current origin.\n * Otherwise, it dispatches the `logout` action to the Redux store.\n */\n logout: () => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n const origin = window.location.origin;\n const url = `${origin}${BASE_PATH}/logout?url=${origin}${BASE_PATH}${LOGOUT_PATH}`;\n Cache.setItem(\"isRedirectLogin\", false);\n window.location.assign(url);\n } else {\n return dispatch(logout());\n }\n },\n };\n};\n","import { useEffect, useState } from \"react\";\n\nimport { ModularUIRequest } from \"@beinformed/ui/modularui\";\n\nimport { useLocale } from \"../hooks/useI18n\";\nimport { useProgressIndicator } from \"../hooks/useProgressIndicator\";\n\nimport type {\n ContentModel,\n Href,\n SourceReferenceCollection,\n} from \"@beinformed/ui/models\";\n\n/**\n * Hook to retrieve multiple source references at once\n */\nexport const useContentFromSourceReferences = (\n sourceReferences: SourceReferenceCollection,\n renderChildSections: boolean,\n): ContentModel[] => {\n const [content, setContent] = useState<ContentModel[]>([]);\n const localeCode = useLocale();\n\n const { start, finish } = useProgressIndicator();\n\n const hrefs = sourceReferences\n .map((sourceReference) => sourceReference.link?.selfhref.href)\n .filter((href, index, self) => self.indexOf(href) === index)\n .map((href) => href?.toString());\n\n const allHrefs = JSON.stringify(hrefs);\n useEffect(() => {\n const requests = JSON.parse(allHrefs).map((href: Href) => {\n const modularuiRequest = new ModularUIRequest(href);\n modularuiRequest.locale = localeCode;\n return modularuiRequest.fetchContent(renderChildSections);\n });\n\n start();\n Promise.all(requests).then((responseContent) => {\n setContent(responseContent);\n finish();\n });\n\n // start and finish don't change\n }, [allHrefs, localeCode, renderChildSections]);\n\n return content;\n};\n","import { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport {\n finishProgress,\n resetProgress,\n startProgress,\n updateProgress,\n} from \"../redux/progressindicator/progressIndicatorActions\";\n\nimport type { RootState } from \"../redux/store\";\n\nexport const useProgressIndicator = () => {\n const dispatch = useBEIDispatch();\n const progress = useBEISelector(\n (state: RootState) => state.progressindicator,\n );\n\n return {\n ...progress,\n start: () => dispatch(startProgress()),\n finish: () => dispatch(finishProgress()),\n reset: () => dispatch(resetProgress()),\n update: (percentComplete: number) =>\n dispatch(updateProgress(percentComplete)),\n };\n};\n","import { useEffect, useRef } from \"react\";\n\nimport { dequal as deepEqual } from \"dequal/lite\";\n\ntype Callback = () => void | (() => void);\ntype DependencyList = unknown[];\n\n/**\n * As copied from https://github.com/kentcdodds/use-deep-compare-effect/\n * Need to copy this, because the dependency on dequal breaks in ie11\n */\nconst useDeepCompareMemoize = (value: DependencyList) => {\n const ref = useRef<DependencyList | null>(null);\n const signalRef = useRef<number>(0);\n\n if (!deepEqual(value, ref.current)) {\n ref.current = value;\n signalRef.current += 1;\n }\n\n return [signalRef.current];\n};\n\nexport function useDeepCompareEffect(\n callback: Callback,\n dependencies: DependencyList,\n): void {\n return useEffect(callback, useDeepCompareMemoize(dependencies));\n}\n","import { HTTP_METHODS } from \"@beinformed/ui/constants\";\nimport { FormModel, Href } from \"@beinformed/ui/models\";\nimport { getSetting } from \"@beinformed/ui/settings\";\nimport { produce } from \"immer\";\n\nimport { updateFormAttribute } from \"../redux/form/attributeActions\";\nimport { cancelForm, previousObject } from \"../redux/form/formActions\";\nimport {\n addRepeatableAttributeSet,\n cancelRepeatableAttributeSet,\n removeRepeatableAttributeSet,\n} from \"../redux/form/formAttributesetRepeatable\";\nimport { useBEIDispatch } from \"../redux/hooks\";\nimport { fetchModel } from \"../redux/modularui/fetchModel\";\nimport { removeModelByKey } from \"../redux/modularui/modelActions\";\nimport { showFormNotification } from \"../redux/notifications/notificationActions\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport type {\n AttributeModel,\n FormObjectModel,\n ModularUIModel,\n} from \"@beinformed/ui/models\";\n\nexport interface UpdateFormOptions {\n autosubmit: boolean;\n autosave: boolean;\n autoupdate: boolean;\n forceUpdate?: boolean;\n /** Default true: Activate/deactivate the form object validate by an update */\n validate?: boolean;\n}\n\n/**\n * Load a form by href\n */\nexport const useForm = (\n href: string | Href,\n data?: Record<string, unknown>,\n) => {\n const formHref = new Href(href);\n\n if (!getSetting(\"ALWAYS_COMMIT_FORM\")) {\n formHref.addParameter(\"commit\", \"false\");\n }\n\n const form = useModularUI(\"form\", formHref, {\n method: HTTP_METHODS.POST,\n targetModel: FormModel,\n removeOnUnmount: true,\n data: data ? JSON.stringify(data) : undefined,\n origin: formHref.origin,\n contextPath: formHref.contextPath,\n });\n\n if (form?.model) {\n return form.model;\n }\n\n return;\n};\n\n/**\n * Form navigation methods\n */\nexport const useFormNavigation = () => {\n const dispatch = useBEIDispatch();\n\n const previous = (form: FormModel) => dispatch(previousObject(form));\n\n const cancel = (form: FormModel) => dispatch(cancelForm(form));\n\n const submit = (form: FormModel) =>\n dispatch(\n fetchModel({\n key: form.connectKey || form.key,\n href: form.selfhref,\n options: {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n return produce(newModel, (draft) => {\n draft.update(newModel);\n });\n }\n return newModel;\n },\n targetModel: FormModel,\n },\n }),\n );\n\n const remove = (form: FormModel) =>\n dispatch(removeModelByKey(form.connectKey || \"\"));\n\n const showFormNotificationAction = (form: FormModel) =>\n dispatch(showFormNotification(form));\n\n return {\n previous,\n cancel,\n submit,\n remove,\n showFormNotification: showFormNotificationAction,\n };\n};\n\n/**\n * Hook that returns a function to update attributes of a form object.\n * <br >\n * The returned function accepts the following options:\n *\n * - autosubmit: Automatically submit the form after a change\n * - autosav: Automatically save the form (in the background) after a change\n * - autoupdate: Automatically update the current form object after a change\n * - forceUpdate: Force the update even if conditions are not met.\n * - validate: Activate/deactivate the form object validation by an update.\n */\nexport const useAttributeUpdate = (\n form: FormModel,\n formObject: FormObjectModel,\n) => {\n const dispatch = useBEIDispatch();\n\n return (\n attribute: AttributeModel,\n inputvalue: string,\n options?: UpdateFormOptions,\n ) =>\n dispatch(\n updateFormAttribute({ form, formObject, attribute, inputvalue, options }),\n );\n};\n\n/**\n * Repeatable attributeset actions\n */\nexport const useRepeatableAttributeSet = (form: FormModel) => {\n const dispatch = useBEIDispatch();\n\n return {\n save: () => dispatch(addRepeatableAttributeSet(form)),\n cancel: (object: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(form, object)),\n remove: (object: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(form, object)),\n };\n};\n","import { useEffect, useMemo, useRef } from \"react\";\n\nimport { HTTP_METHODS } from \"@beinformed/ui/constants\";\nimport { Href } from \"@beinformed/ui/models\";\nimport { useLocation } from \"react-router\";\n\nimport { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport { fetchModel } from \"../redux/modularui/fetchModel\";\nimport { removeModelByKey } from \"../redux/modularui/modelActions\";\nimport { useDeepCompareEffect } from \"./useDeepCompareEffect\";\nimport { useLocale } from \"./useI18n\";\n\nimport type { ModularUIRequestOptions } from \"@beinformed/ui/utils\";\nimport type { RootState } from \"../redux/store\";\n\nconst useKeyForHook = (modelKey: string, url: string) => {\n const locale = useLocale();\n return useMemo(\n () => `${modelKey}(${url.split(\"?\")[0]})(${locale})`,\n [modelKey, url, locale],\n );\n};\n\n/**\n * Use redux action and selector to retrieve the correct modular ui service model\n */\nexport const useModularUI = (\n modelKey: string,\n url: string | Href,\n options: ModularUIRequestOptions = {\n method: HTTP_METHODS.GET,\n removeOnUnmount: false,\n },\n) => {\n const dispatch = useBEIDispatch();\n const href = useMemo(() => url?.toString() || \"\", [url]);\n const key = useKeyForHook(modelKey, href);\n\n const modelSelector = useMemo(\n () => (state: RootState) => state.modularui[key],\n [key],\n );\n const model = useBEISelector(modelSelector);\n\n if (url instanceof Href) {\n options.origin = options.origin ?? url.origin;\n options.contextPath = options.contextPath ?? url.contextPath;\n }\n\n const location = useLocation();\n const redirectLocation =\n location !== null &&\n typeof location === \"object\" &&\n location.state !== null &&\n typeof location.state === \"object\" &&\n \"redirectLocation\" in location.state\n ? location.state.redirectLocation\n : undefined;\n const forceLoad =\n model == null ||\n (redirectLocation instanceof Href ? redirectLocation?.equals(href) : false);\n\n const prevOptions = useRef(options);\n const prevHref = useRef(href);\n const prevForceLoad = useRef(forceLoad);\n\n useDeepCompareEffect(() => {\n // prevent reloads when previous option had the isReload, but the new options not\n const isOldReload =\n prevHref.current === href &&\n prevOptions.current.isReload &&\n !options.isReload;\n\n const doForceLoad = forceLoad && !prevForceLoad.current;\n\n if (href !== \"\" && (doForceLoad || !isOldReload)) {\n dispatch(fetchModel({ key, href, options }));\n }\n\n prevOptions.current = options;\n prevHref.current = href;\n prevForceLoad.current = forceLoad;\n }, [key, href, options, forceLoad]);\n\n useEffect(() => {\n if (options.removeOnUnmount) {\n return () => {\n dispatch(removeModelByKey(key));\n };\n }\n return;\n }, [dispatch, key, options.removeOnUnmount]);\n\n return model;\n};\n","import { useCallback } from \"react\";\n\nimport { IllegalArgumentException } from \"@beinformed/ui/exceptions\";\n\nimport { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport { closeModal, showModal } from \"../redux/modals/modalsReducer\";\n\nimport type { RootState } from \"../redux/store\";\n\ntype ModalHook = (modalId: string) => {\n key: string | null;\n size?: string | null;\n visible: boolean;\n show: () => void;\n close: () => void;\n};\n\n/**\n * Manage modals\n */\nexport const useModal: ModalHook = (modalId: string) => {\n if (!modalId) {\n throw new IllegalArgumentException(\n \"Missing modalId argument for useModal hook\",\n );\n }\n\n const dispatch = useBEIDispatch();\n const modal = useBEISelector((state: RootState) =>\n state.modals.modals.find((m) => m.key === modalId),\n );\n\n const show = useCallback(() => {\n dispatch(showModal(modalId));\n }, [dispatch, modalId]);\n\n const close = useCallback(() => {\n dispatch(closeModal(modalId));\n }, [dispatch, modalId]);\n\n return {\n key: modal ? modal.key : null,\n size: modal ? modal.size : null,\n visible: modal ? modal.visible : false,\n show,\n close,\n };\n};\n","import {\n ConceptIndexModel,\n ContentIndexModel,\n ContentTOCModel,\n ContentTypeModel,\n Href,\n ModelCatalogModel,\n} from \"@beinformed/ui/models\";\nimport { createHref, filterParameters } from \"@beinformed/ui/utils\";\n\nimport { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport { updateEntryDate } from \"../redux/modelcatalog/modelCatalogReducer\";\nimport { getEntryDate } from \"../redux/modelcatalog/modelCatalogSelectors\";\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { useLocation } from \"./useRouter\";\n\nimport type { ConceptDetailModel, ContentModel } from \"@beinformed/ui/models\";\nimport type { ISO_DATE } from \"@beinformed/ui/types\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\n\nexport interface SearchFilter {\n index?: string;\n label?: string;\n type?: string | string[];\n modelCategory?: string | string[];\n entryDate?: string;\n}\n\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n) =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\nexport const useConceptIndex = (\n href: string | Href,\n key = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n) => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\nexport const useConceptDetail = (\n concept: string | Href,\n key = \"conceptdetail\",\n options?: UseModularUIBasicOptions<ConceptDetailModel>,\n) => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\nexport const useContentIndex = (\n href: string | Href,\n key = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n) => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\nexport const useContentTOC = (\n content: string | Href,\n key = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n) => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\nexport const useContent = (\n content: string | Href,\n key = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n) => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\nexport const useCompleteSource = (\n content: string | Href,\n key = \"content\",\n options?: UseModularUIBasicOptions<ContentModel | ContentTOCModel>,\n) => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const contentHref = new Href(content);\n contentHref.removeParameter(\"complete\");\n contentHref.addParameter(\"complete\", \"true\");\n\n const href = createHref(\"content\", contentHref, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\nexport const useContentType = (\n contentType: string | Href,\n key = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n) => {\n const href = createHref(\n \"contenttypes\",\n contentType,\n undefined,\n undefined,\n [],\n );\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\nexport const useRelatedConcepts = (\n href: string | Href,\n key = \"relatedconcepts\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n) => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\"modelcategory\"]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\nconst getSearchHref = (uri: string, filters: SearchFilter) => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key as keyof SearchFilter];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\nexport const useConceptSearch = (\n filters: SearchFilter,\n key: string | \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n) => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\nexport const useContentSearch = (\n filters: SearchFilter,\n key: string | \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n) => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = () => {\n const dispatch = useBEIDispatch();\n const entryDate = useBEISelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n","import { useMemo } from \"react\";\n\nimport { useModularUI } from \"./useModularUI\";\nimport { useLocation } from \"./useRouter\";\n\nimport type { Href } from \"@beinformed/ui/models\";\nimport type { ModularUIResponse } from \"@beinformed/ui/modularui\";\n\nexport interface UseModularUIBasicOptions<T> {\n expectedModels?: string[];\n targetModel?: new (modularuiResponse: ModularUIResponse) => T;\n forceTargetModel?: boolean;\n origin?: string;\n contextPath?: string;\n cache?: boolean;\n}\n\n// Helper to create useModularUI options\nconst createUseModularUIOptions = <T>(\n options: UseModularUIBasicOptions<T>,\n href: string,\n location: unknown,\n): Record<string, unknown> => {\n const baseOptions: Record<string, unknown> = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n origin: undefined,\n contextPath: undefined,\n cache: false,\n };\n\n // Handle targetModel and forceTargetModel\n\n if (options.targetModel) {\n baseOptions.targetModel = options.targetModel;\n baseOptions.forceTargetModel = options.forceTargetModel;\n }\n\n // Handle cache option\n if (options.cache) {\n baseOptions.cache = options.cache;\n }\n\n // Check for reload if location matches href\n if (\n location !== null &&\n typeof location === \"object\" &&\n \"state\" in location &&\n location.state !== null &&\n typeof location.state === \"object\" &&\n \"reload\" in location.state &&\n \"pathname\" in location &&\n typeof location.pathname === \"string\" &&\n location.pathname.startsWith(href)\n ) {\n baseOptions.isReload = true;\n }\n\n // Handle origin and contextPath options\n baseOptions.origin = options.origin ?? baseOptions.origin;\n baseOptions.contextPath = options.contextPath ?? baseOptions.contextPath;\n\n return baseOptions;\n};\n\n// Helper to validate the model against expectedModels\nconst validateModel = (model: unknown, expectedModels: string[]) => {\n if (expectedModels.length > 0) {\n const isCorrectModel = expectedModels.some((expectedModel) => {\n if (model !== null && typeof model === \"object\" && \"type\" in model) {\n return model.type === expectedModel;\n }\n return;\n });\n if (!isCorrectModel) {\n console.warn(model, \"is not of instance\", expectedModels);\n }\n }\n};\n\n/**\n * useModularUIBasic Hook\n */\nexport const useModularUIBasic = <T>(\n key: string,\n href: string | Href,\n options: UseModularUIBasicOptions<T> = {\n expectedModels: [],\n targetModel: undefined,\n forceTargetModel: false,\n origin: undefined,\n contextPath: undefined,\n },\n): T | undefined => {\n const location = useLocation();\n const memoizedHref = useMemo(() => href.toString(), [href]);\n const useModularUIOptions = useMemo(\n () => createUseModularUIOptions(options, memoizedHref, location),\n [options, memoizedHref, location],\n );\n\n const modularUI = useModularUI(key, href, useModularUIOptions);\n const expectedModels = useMemo(\n () => options.expectedModels ?? [],\n [options.expectedModels],\n );\n\n return useMemo((): T | undefined => {\n if (modularUI?.model) {\n validateModel(modularUI.model, expectedModels);\n return modularUI.model as T;\n }\n return undefined;\n }, [expectedModels, modularUI]);\n};\n","import { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport {\n go,\n goBack,\n goForward,\n push,\n replace,\n} from \"../redux/router/routerActions\";\n\nimport type { RouterLocation } from \"../redux/router/routerReducer\";\nimport type { RootState } from \"../redux/store\";\n\nexport const useLocation = () =>\n useBEISelector((state: RootState) => state.router.location);\n\nexport const useLocationKey = () => useLocation()?.key ?? \"\";\n\nexport const useQuerystring = () => useLocation()?.search;\n\nexport const usePathname = () => useLocation()?.pathname;\n\nexport const useNavigation = () => {\n const dispatch = useBEIDispatch();\n\n return {\n push: (location: RouterLocation | string, state?: RootState) =>\n dispatch(push(location, state)),\n replace: (location: RouterLocation | string, state?: RootState) =>\n dispatch(replace(location, state)),\n go: (delta: number) => dispatch(go(delta)),\n goBack: () => dispatch(goBack()),\n goForward: () => dispatch(goForward()),\n };\n};\n","import { createSelector } from \"reselect\";\n\nimport { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport { MODULARUI_STATUS } from \"../redux/modularui/constants\";\nimport { reloadModel } from \"../redux/modularui/reloadModel\";\n\nimport type { ModularUIModel } from \"@beinformed/ui/models\";\nimport type { ModularUIRequestOptions } from \"@beinformed/ui/utils\";\nimport type { RootState } from \"../redux/store\";\n\ntype ReloadCallback = (model: ModularUIModel | undefined) => boolean;\n\ntype UseModels = () => {\n reload: (model: ModularUIModel, options?: Record<string, unknown>) => void;\n reloadWithFilter: (\n callbackFn: ReloadCallback,\n options?: Record<string, unknown>,\n ) => void;\n};\n\n/**\n * Hook that contains the reload property that can be used to reload a model\n */\nexport const useModels: UseModels = () => {\n const dispatch = useBEIDispatch();\n\n const selectModularUI = (state: RootState) => state.modularui;\n const selector = createSelector([selectModularUI], (modularui) => {\n const models = [];\n const keys = Object.keys(modularui);\n for (const key of keys) {\n const model = modularui[key];\n if (model?.status === MODULARUI_STATUS.FINISHED) {\n models.push(model.model);\n }\n }\n return models;\n });\n\n const modularuiModels = useBEISelector(selector);\n\n return {\n reload: (model: ModularUIModel, options?: ModularUIRequestOptions) => {\n dispatch(reloadModel(model, options));\n },\n reloadWithFilter: (\n callbackFn: ReloadCallback,\n options?: Record<string, unknown>,\n ) => {\n const modelsToReload = modularuiModels.filter(callbackFn);\n for (const modelToReload of modelsToReload) {\n if (modelToReload) {\n dispatch(reloadModel(modelToReload, options));\n }\n }\n },\n };\n};\n","import {\n ApplicationModel,\n CaseSearchModel,\n CaseViewModel,\n DetailModel,\n GroupingPanelModel,\n ListDetailModel,\n ListModel,\n TabModel,\n UserProfileModel,\n} from \"@beinformed/ui/models\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\nimport type { Href } from \"@beinformed/ui/models\";\n\ninterface HookOptions {\n origin?: string;\n contextPath?: string;\n}\n\n/**\n * Load application\n */\nexport const useApplication = (options?: HookOptions) =>\n useModularUIBasic(\"application\", \"/\", {\n expectedModels: [\"Application\"],\n targetModel: ApplicationModel,\n ...options,\n });\n\n/**\n * Load a tab by href\n */\nexport const useTab = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"tab\", href, {\n expectedModels: [\"Tab\"],\n targetModel: TabModel,\n ...options,\n });\n\n/**\n * Load caseview by href\n */\nexport const useCaseView = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"caseview\", href, {\n expectedModels: [\"CaseView\"],\n targetModel: CaseViewModel,\n ...options,\n });\n\nexport const usePanel = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic<ListModel | GroupingPanelModel | DetailModel>(\n \"panel\",\n href,\n {\n expectedModels: [\"List\", \"GroupingPanel\", \"Detail\"],\n ...options,\n },\n );\n\nexport const useList = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\"],\n targetModel: ListModel,\n ...options,\n });\n\nexport const useListOrDetail = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic<ListModel | DetailModel>(\"list\", href, {\n expectedModels: [\"List\", \"Detail\"],\n // @ts-expect-error Need to improve typing for array\n targetModel: [ListModel, DetailModel],\n ...options,\n });\n\nexport const useListDetail = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"listdetail\", href, {\n expectedModels: [\"ListDetail\"],\n targetModel: ListDetailModel,\n forceTargetModel: true,\n ...options,\n });\n\nexport const useGroupingPanel = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"groupingpanel\", href, {\n expectedModels: [\"GroupingPanel\"],\n targetModel: GroupingPanelModel,\n ...options,\n });\n\nexport const useDetailPanel = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"detailpanel\", href, {\n expectedModels: [\"Detail\"],\n targetModel: DetailModel,\n ...options,\n });\n\nexport const useQuicksearch = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"quicksearch\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\nexport const useSearch = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"search\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\nexport const useUserProfile = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"userprofile\", href, {\n expectedModels: [\"UserProfile\"],\n targetModel: UserProfileModel,\n ...options,\n });\n","import { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport {\n dismissNotification,\n NOTIFICATION_TYPES,\n showNotification,\n} from \"../redux/notifications/notificationReducer\";\n\nimport type { ErrorResponse } from \"@beinformed/ui/models\";\nimport type { MessageObject } from \"../i18n/types\";\nimport type { RootState } from \"../redux/store\";\n\nexport const useNotification = () => {\n const dispatch = useBEIDispatch();\n const { render, messageType, message, error } = useBEISelector(\n (state: RootState) => state.notification,\n );\n\n return {\n render,\n messageType,\n message,\n error,\n dismiss: () => dispatch(dismissNotification()),\n };\n};\n\nexport const useErrorNotification = () => {\n const dispatch = useBEIDispatch();\n return (message: MessageObject, error?: ErrorResponse) => {\n return dispatch(\n showNotification({ type: NOTIFICATION_TYPES.ERROR, message, error }),\n );\n };\n};\n","import { useMemo } from \"react\";\n\nimport pick from \"lodash/pick\";\nimport { createSelector } from \"reselect\";\n\nimport { useBEISelector } from \"../redux/hooks\";\n\nimport type { RootState } from \"../redux/store\";\n\nconst getPreferences = (state: RootState) => state.preferences;\n\nconst makeSelectPreference = (preferenceNames: string | string[]) => {\n const names = Array.isArray(preferenceNames)\n ? preferenceNames\n : [preferenceNames];\n\n return createSelector([getPreferences], (preferences) =>\n pick(preferences, names),\n );\n};\n\nexport const usePreference = (preferenceNames: string | string[]) => {\n const selectPreference = useMemo(\n () => makeSelectPreference(preferenceNames),\n [\n Array.isArray(preferenceNames)\n ? preferenceNames.join(\",\")\n : preferenceNames,\n ],\n );\n\n return useBEISelector(selectPreference);\n};\n"],"mappings":"+mBAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,KAAA,kBAAIC,GAAY,KAEZC,GAAkB,UAAW,CAC/B,GAAI,CACF,IAAIC,EAAOF,GAAU,OAAQ,gBAAgB,EAC7C,OAAAE,EAAK,CAAC,EAAG,GAAI,CAAC,CAAC,EACRA,CACT,MAAY,CAAC,CACf,EAAE,EAEFH,GAAO,QAAUE,KCVjB,IAAAE,GAAAC,EAAA,CAAAC,GAAAC,KAAA,kBAAIC,GAAiB,IAWrB,SAASC,GAAgBC,EAAQC,EAAKC,EAAO,CACvCD,GAAO,aAAeH,GACxBA,GAAeE,EAAQC,EAAK,CAC1B,aAAgB,GAChB,WAAc,GACd,MAASC,EACT,SAAY,EACd,CAAC,EAEDF,EAAOC,CAAG,EAAIC,CAElB,CAEAL,GAAO,QAAUE,KCxBjB,IAAAI,GAAAC,EAAA,CAAAC,GAAAC,KAAA,kBAAIC,GAAkB,KAClBC,GAAK,KAGLC,GAAc,OAAO,UAGrBC,GAAiBD,GAAY,eAYjC,SAASE,GAAYC,EAAQC,EAAKC,EAAO,CACvC,IAAIC,EAAWH,EAAOC,CAAG,GACrB,EAAEH,GAAe,KAAKE,EAAQC,CAAG,GAAKL,GAAGO,EAAUD,CAAK,IACvDA,IAAU,QAAa,EAAED,KAAOD,KACnC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ACnE,IAAMM,EAAmBC,GACvB,IAAMR,GAAqBC,CAAe,EAC1C,CACE,MAAM,QAAQA,CAAe,EACzBA,EAAgB,KAAK,GAAG,EACxBA,CACN,CACF,EAEA,OAAOQ,EAAeF,CAAgB,CACxC","names":["require_defineProperty","__commonJSMin","exports","module","getNative","defineProperty","func","require_baseAssignValue","__commonJSMin","exports","module","defineProperty","baseAssignValue","object","key","value","require_assignValue","__commonJSMin","exports","module","baseAssignValue","eq","objectProto","hasOwnProperty","assignValue","object","key","value","objValue","require_baseSet","__commonJSMin","exports","module","assignValue","castPath","isIndex","isObject","toKey","baseSet","object","path","value","customizer","index","length","lastIndex","nested","key","newValue","objValue","require_basePickBy","__commonJSMin","exports","module","baseGet","baseSet","castPath","basePickBy","object","paths","predicate","index","length","result","path","value","require_baseHasIn","__commonJSMin","exports","module","baseHasIn","object","key","require_hasIn","__commonJSMin","exports","module","baseHasIn","hasPath","hasIn","object","path","require_basePick","__commonJSMin","exports","module","basePickBy","hasIn","basePick","object","paths","value","path","require_flatten","__commonJSMin","exports","module","baseFlatten","flatten","array","length","require_apply","__commonJSMin","exports","module","apply","func","thisArg","args","require_overRest","__commonJSMin","exports","module","apply","nativeMax","overRest","func","start","transform","args","index","length","array","otherArgs","require_constant","__commonJSMin","exports","module","constant","value","require_identity","__commonJSMin","exports","module","identity","value","require_baseSetToString","__commonJSMin","exports","module","constant","defineProperty","identity","baseSetToString","func","string","require_shortOut","__commonJSMin","exports","module","HOT_COUNT","HOT_SPAN","nativeNow","shortOut","func","count","lastCalled","stamp","remaining","require_setToString","__commonJSMin","exports","module","baseSetToString","shortOut","setToString","require_flatRest","__commonJSMin","exports","module","flatten","overRest","setToString","flatRest","func","require_pick","__commonJSMin","exports","module","basePick","flatRest","pick","object","paths","useEffect","useState","HTTP_METHODS","FormModel","ListModel","ModularUIRequest","createSelector","getModularUIRequest","createSelector","getLocale","localeCode","href","options","request","ModularUIRequest","useModularUIRequest","useBEISelector","useRetrieveFormsOnModel","model","modularui","useModularUIRequest","forms","setForms","useState","requestCount","setRequestCount","responseCount","setResponseCount","useEffect","requests","getActions","action","href","HTTP_METHODS","form","FormModel","responses","actionForms","allActions","ListModel","listItem","updateActions","actions","unique","DEFAULT_AUTHENTICATION_TYPE","IllegalStateException","getContextPathServer","logoutPath","Cache","useLogin","Cache","dispatch","useBEIDispatch","application","useBEISelector","getApplication","auth","state","isAuthenticated","DEFAULT_AUTHENTICATION_TYPE","resetAuthErrors","username","password","login","authenticationType","IllegalStateException","getContextPathServer","useLogout","LOGOUT_PATH","logoutPath","BASE_PATH","origin","url","logout","useEffect","useState","ModularUIRequest","useProgressIndicator","dispatch","useBEIDispatch","useBEISelector","state","startProgress","finishProgress","resetProgress","percentComplete","updateProgress","useContentFromSourceReferences","sourceReferences","renderChildSections","content","setContent","useState","localeCode","useLocale","start","finish","useProgressIndicator","hrefs","sourceReference","href","index","self","allHrefs","useEffect","requests","modularuiRequest","ModularUIRequest","responseContent","useEffect","useRef","deepEqual","useDeepCompareMemoize","value","ref","signalRef","useDeepCompareEffect","callback","dependencies","HTTP_METHODS","FormModel","Href","getSetting","produce","useEffect","useMemo","useRef","HTTP_METHODS","Href","useLocation","useKeyForHook","modelKey","url","locale","useLocale","useMemo","useModularUI","options","HTTP_METHODS","dispatch","useBEIDispatch","href","key","modelSelector","state","model","useBEISelector","Href","location","useLocation","redirectLocation","forceLoad","prevOptions","useRef","prevHref","prevForceLoad","useDeepCompareEffect","isOldReload","doForceLoad","fetchModel","useEffect","removeModelByKey","useForm","href","data","formHref","Href","getSetting","form","useModularUI","HTTP_METHODS","FormModel","useFormNavigation","dispatch","useBEIDispatch","previousObject","cancelForm","fetchModel","newModel","produce","draft","removeModelByKey","showFormNotification","useAttributeUpdate","formObject","attribute","inputvalue","options","updateFormAttribute","useRepeatableAttributeSet","addRepeatableAttributeSet","object","cancelRepeatableAttributeSet","removeRepeatableAttributeSet","useCallback","IllegalArgumentException","useModal","modalId","IllegalArgumentException","dispatch","useBEIDispatch","modal","useBEISelector","state","m","show","useCallback","showModal","close","closeModal","ConceptIndexModel","ContentIndexModel","ContentTOCModel","ContentTypeModel","Href","ModelCatalogModel","createHref","filterParameters","useMemo","useLocation","useBEISelector","state","useLocationKey","useQuerystring","usePathname","useNavigation","dispatch","useBEIDispatch","location","push","replace","delta","go","goBack","goForward","createUseModularUIOptions","options","href","location","baseOptions","validateModel","model","expectedModels","expectedModel","useModularUIBasic","key","useLocation","memoizedHref","useMemo","useModularUIOptions","modularUI","useModularUI","useModelCatalog","options","useModularUIBasic","ModelCatalogModel","useConceptIndex","href","key","entryDate","useEntryDate","url","filterParameters","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","useCompleteSource","contentHref","Href","useContentType","contentType","ContentTypeModel","useRelatedConcepts","getSearchHref","uri","filters","filterString","filterValue","value","useConceptSearch","useContentSearch","dispatch","useBEIDispatch","useBEISelector","getEntryDate","updateEntryDate","createSelector","useModels","dispatch","useBEIDispatch","selector","createSelector","state","modularui","models","keys","key","model","modularuiModels","useBEISelector","options","reloadModel","callbackFn","modelsToReload","modelToReload","ApplicationModel","CaseSearchModel","CaseViewModel","DetailModel","GroupingPanelModel","ListDetailModel","ListModel","TabModel","UserProfileModel","useApplication","options","useModularUIBasic","ApplicationModel","useTab","href","TabModel","useCaseView","CaseViewModel","usePanel","useList","ListModel","useListOrDetail","DetailModel","useListDetail","ListDetailModel","useGroupingPanel","GroupingPanelModel","useDetailPanel","useQuicksearch","CaseSearchModel","useSearch","useUserProfile","UserProfileModel","useNotification","dispatch","useBEIDispatch","render","messageType","message","error","useBEISelector","state","dismissNotification","useErrorNotification","showNotification","import_pick","useMemo","createSelector","getPreferences","state","makeSelectPreference","preferenceNames","names","createSelector","preferences","pick","usePreference","selectPreference","useMemo","useBEISelector"]}
@@ -0,0 +1,2 @@
1
+ import{b as p}from"./chunk-3OP2KQ56.js";import{e as s}from"./chunk-YG7XDCNV.js";import{b as a}from"./chunk-FW4363Y4.js";var e=a(p(),1);import{resolveModel as f}from"@beinformed/ui/models";import{ModularUIResponse as h}from"@beinformed/ui/modularui";var l=r=>{let o=h.rehydrate(r),n=f(o);if(n){let t=new n(o);if(r.childModels){let d=r.childModels.map(c=>l(c)).filter(c=>c!=null);t.addChildModels(d)}return t}},m=r=>r!=null&&typeof r=="object"&&(0,e.default)(r,"data")&&(0,e.default)(r,"contributions")&&(0,e.default)(r,"key")&&typeof r.key=="string"&&(0,e.default)(r,"locale")&&typeof r.locale=="string",u=(r,o)=>Array.isArray(o)?o.map(t=>i(t)):m(o)?l(o):r==="i18n"&&(0,e.default)(o,"locales")&&(0,e.default)(o,"locale")?{locales:s.rehydrate(o.locales),locale:o?.locale}:["preferences","router","progressindicator","modelcatalog"].includes(r)?o:o!==null&&typeof o=="object"?i(o):o,i=r=>{let o={};return Object.keys(r).forEach(n=>{let t=r[n];o[n]=u(n,t)}),o};import{JsonParseException as y}from"@beinformed/ui/exceptions";var b=()=>{let r=document.querySelector('script[type="application/json"][data-app-state="app-json"]');if(r){if(r?.textContent?.trim()==="")return{}}else throw new Error("Error loading state, json not found");let o=r.textContent||"";try{let n=JSON.parse(o);return i(n)}catch{throw new y(`Error parsing content ${o}`)}};export{i as a,b};
2
+ //# sourceMappingURL=chunk-VFLYA5WJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client/rehydrate.ts","../src/redux/dataFromServer.ts"],"sourcesContent":["import { resolveModel } from \"@beinformed/ui/models\";\nimport { ModularUIResponse } from \"@beinformed/ui/modularui\";\nimport has from \"lodash/has\";\n\nimport { Locales } from \"../i18n/Locales\";\n\nimport type { Contributions, Data } from \"@beinformed/ui/types\";\n\ninterface RehydrateData {\n key: string;\n locale: string;\n data: Data;\n contributions: Contributions;\n origin?: string;\n contextPath?: string;\n childModels?: RehydrateData[];\n}\n\n/**\n * Recreate a model from dehydrated data obtained after a server render.\n */\nconst recreateModel = (data: RehydrateData) => {\n const modelData = ModularUIResponse.rehydrate(data);\n\n const Model = resolveModel(modelData);\n\n if (Model) {\n const model = new Model(modelData);\n\n //Todo\n // model.rehydrate(data);\n\n if (data.childModels) {\n const childModels = data.childModels\n .map((childModel: RehydrateData) => recreateModel(childModel))\n .filter((d) => d != null);\n\n model.addChildModels(childModels);\n }\n\n return model;\n }\n\n return undefined;\n};\n\nconst isModularUIModelData = (data: unknown) =>\n data != null &&\n typeof data === \"object\" &&\n has(data, \"data\") &&\n has(data, \"contributions\") &&\n has(data, \"key\") &&\n typeof data.key === \"string\" &&\n has(data, \"locale\") &&\n typeof data.locale === \"string\";\n\nconst rehydratedValue = (stateKey: string, stateValue: unknown) => {\n if (Array.isArray(stateValue)) {\n return stateValue.map((stateItem) => rehydrate(stateItem));\n }\n\n if (isModularUIModelData(stateValue)) {\n return recreateModel(stateValue as RehydrateData);\n }\n\n if (\n stateKey === \"i18n\" &&\n has(stateValue, \"locales\") &&\n has(stateValue, \"locale\")\n ) {\n return {\n locales: Locales.rehydrate(stateValue.locales),\n locale: stateValue?.locale,\n };\n }\n\n const noFurtherRehydration = [\n \"preferences\",\n \"router\",\n \"progressindicator\",\n \"modelcatalog\",\n ];\n if (noFurtherRehydration.includes(stateKey)) {\n return stateValue;\n }\n\n if (stateValue !== null && typeof stateValue === \"object\") {\n return rehydrate(stateValue as Record<string, unknown>);\n }\n\n return stateValue;\n};\n\n/**\n * Maps dehydrated state to models that can be used to rehydrated the application.\n */\nexport const rehydrate = (state: Record<string, unknown>) => {\n const mappedState: Record<string, unknown> = {};\n\n Object.keys(state).forEach((stateKey) => {\n const stateValue = state[stateKey];\n mappedState[stateKey] = rehydratedValue(stateKey, stateValue);\n });\n\n return mappedState;\n};\n","import { JsonParseException } from \"@beinformed/ui/exceptions\";\n\nimport { rehydrate } from \"../client/rehydrate\";\n\nexport const getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement?.textContent?.trim() === \"\") {\n return {};\n }\n\n const data = dataElement.textContent || \"\";\n try {\n const json = JSON.parse(data);\n return rehydrate(json);\n } catch (_error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n"],"mappings":"wHAEA,IAAAA,EAAgB,SAFhB,OAAS,gBAAAC,MAAoB,wBAC7B,OAAS,qBAAAC,MAAyB,2BAoBlC,IAAMC,EAAiBC,GAAwB,CAC7C,IAAMC,EAAYC,EAAkB,UAAUF,CAAI,EAE5CG,EAAQC,EAAaH,CAAS,EAEpC,GAAIE,EAAO,CACT,IAAME,EAAQ,IAAIF,EAAMF,CAAS,EAKjC,GAAID,EAAK,YAAa,CACpB,IAAMM,EAAcN,EAAK,YACtB,IAAKO,GAA8BR,EAAcQ,CAAU,CAAC,EAC5D,OAAQC,GAAMA,GAAK,IAAI,EAE1BH,EAAM,eAAeC,CAAW,CAClC,CAEA,OAAOD,CACT,CAGF,EAEMI,EAAwBT,GAC5BA,GAAQ,MACR,OAAOA,GAAS,aAChB,EAAAU,SAAIV,EAAM,MAAM,MAChB,EAAAU,SAAIV,EAAM,eAAe,MACzB,EAAAU,SAAIV,EAAM,KAAK,GACf,OAAOA,EAAK,KAAQ,aACpB,EAAAU,SAAIV,EAAM,QAAQ,GAClB,OAAOA,EAAK,QAAW,SAEnBW,EAAkB,CAACC,EAAkBC,IACrC,MAAM,QAAQA,CAAU,EACnBA,EAAW,IAAKC,GAAcC,EAAUD,CAAS,CAAC,EAGvDL,EAAqBI,CAAU,EAC1Bd,EAAcc,CAA2B,EAIhDD,IAAa,WACb,EAAAF,SAAIG,EAAY,SAAS,MACzB,EAAAH,SAAIG,EAAY,QAAQ,EAEjB,CACL,QAASG,EAAQ,UAAUH,EAAW,OAAO,EAC7C,OAAQA,GAAY,MACtB,EAG2B,CAC3B,cACA,SACA,oBACA,cACF,EACyB,SAASD,CAAQ,EACjCC,EAGLA,IAAe,MAAQ,OAAOA,GAAe,SACxCE,EAAUF,CAAqC,EAGjDA,EAMIE,EAAaE,GAAmC,CAC3D,IAAMC,EAAuC,CAAC,EAE9C,cAAO,KAAKD,CAAK,EAAE,QAASL,GAAa,CACvC,IAAMC,EAAaI,EAAML,CAAQ,EACjCM,EAAYN,CAAQ,EAAID,EAAgBC,EAAUC,CAAU,CAC9D,CAAC,EAEMK,CACT,ECzGA,OAAS,sBAAAC,MAA0B,4BAI5B,IAAMC,EAAoB,IAAM,CACrC,IAAMC,EAAc,SAAS,cAC3B,4DACF,EAEA,GAAKA,GAEE,GAAIA,GAAa,aAAa,KAAK,IAAM,GAC9C,MAAO,CAAC,MAFR,OAAM,IAAI,MAAM,qCAAqC,EAKvD,IAAMC,EAAOD,EAAY,aAAe,GACxC,GAAI,CACF,IAAME,EAAO,KAAK,MAAMD,CAAI,EAC5B,OAAOE,EAAUD,CAAI,CACvB,MAAiB,CACf,MAAM,IAAIE,EAAmB,yBAAyBH,CAAI,EAAE,CAC9D,CACF","names":["import_has","resolveModel","ModularUIResponse","recreateModel","data","modelData","ModularUIResponse","Model","resolveModel","model","childModels","childModel","d","isModularUIModelData","has","rehydratedValue","stateKey","stateValue","stateItem","rehydrate","Locales","state","mappedState","JsonParseException","getDataFromServer","dataElement","data","json","rehydrate","JsonParseException"]}
@@ -0,0 +1,22 @@
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`
2
+ <!doctype html>
3
+ <html ${t.htmlAttributes?t.htmlAttributes.toString():""}>
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ ${Object.keys(t).filter(i=>i!=="htmlAttributes").map(i=>String(t[i])).join("")}
7
+ {CSSASSETS:<link rel="stylesheet" type="text/css" href="{CONTEXT_PATH}/{FILE}" />:CSSASSETS}
8
+ </head>
9
+ <body class="nojs">
10
+ <div id="application">${e.html}</div>
11
+ <div id="portal"></div>
12
+ <script
13
+ type="application/json"
14
+ data-app-state="app-json"
15
+ data-app-contextpath="{CONTEXT_PATH}"
16
+ data-app-filepath="{FILEPATH}"
17
+ data-app-nonce="${e.UUID??""}">${e.state??""}</script>
18
+ {JSASSETS:<script src="{CONTEXT_PATH}/{FILE}"></script>:JSASSETS}
19
+ </body>
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
@@ -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 React from \"react\";\n\nimport { getContextPathServer } from \"@beinformed/ui/settings\";\nimport { renderToString } from \"react-dom/server\";\nimport { Provider } from \"react-redux\";\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\n\nimport { ThemeProvider } from \"../theme/ThemeProvider\";\nimport { htmlpage } from \"./htmlpage\";\nimport { dehydrate } from \"./serverState\";\n\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 { createUUID } from \"@beinformed/ui/utils\";\nimport has from \"lodash/has\";\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\";\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;AAAA;AAAA,UAETC,EAAK,eAAiBA,EAAK,eAAe,SAAS,EAAI,EAAE;AAAA;AAAA;AAAA,QAG3D,OAAO,KAAKA,CAAI,EACf,OAAQC,GAAQA,IAAQ,gBAAgB,EACxC,IAAKA,GAAQ,OAAOD,EAAKC,CAAG,CAAC,CAAC,EAC9B,KAAK,EAAE,CAAC;AAAA;AAAA;AAAA;AAAA,8BAIaF,EAAM,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAOdA,EAAM,MAAQ,EAAE,K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,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","getContextPathServer","renderToString","Provider","ServerStyleSheet","StyleSheetManager","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"]}
@@ -0,0 +1,2 @@
1
+ import{b as K,c as p,g as $}from"./chunk-6KRECIRI.js";import{a as n}from"./chunk-FW4363Y4.js";var s=n((Mr,c)=>{"use strict";function F(r){return r!=null&&typeof r=="object"}c.exports=F});var u=n((Nr,f)=>{"use strict";var G=Array.isArray;f.exports=G});var a=n((kr,y)=>{"use strict";var Y=p(),Z=s(),_="[object Symbol]";function D(r){return typeof r=="symbol"||Z(r)&&Y(r)==_}y.exports=D});var m=n((vr,b)=>{"use strict";var X=u(),B=a(),H=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/;function Q(r,e){if(X(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||B(r)?!0:J.test(r)||!H.test(r)||e!=null&&r in Object(e)}b.exports=Q});var q=n((wr,g)=>{"use strict";var R=$(),U=500;function V(r){var e=R(r,function(i){return t.size===U&&t.clear(),i}),t=e.cache;return e}g.exports=V});var h=n((zr,l)=>{"use strict";var W=q(),rr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,er=/\\(\\)?/g,tr=W(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(rr,function(t,i,o,L){e.push(o?L.replace(er,"$1"):i||t)}),e});l.exports=tr});var I=n((Cr,x)=>{"use strict";function nr(r,e){for(var t=-1,i=r==null?0:r.length,o=Array(i);++t<i;)o[t]=e(r[t],t,r);return o}x.exports=nr});var j=n((Lr,d)=>{"use strict";var A=K(),ir=I(),or=u(),sr=a(),ur=1/0,S=A?A.prototype:void 0,P=S?S.toString:void 0;function T(r){if(typeof r=="string")return r;if(or(r))return ir(r,T)+"";if(sr(r))return P?P.call(r):"";var e=r+"";return e=="0"&&1/r==-ur?"-0":e}d.exports=T});var E=n((Kr,O)=>{"use strict";var ar=j();function pr(r){return r==null?"":ar(r)}O.exports=pr});var gr=n(($r,M)=>{"use strict";var cr=u(),fr=m(),yr=h(),br=E();function mr(r,e){return cr(r)?r:fr(r,e)?[r]:yr(br(r))}M.exports=mr});var k=n((Fr,N)=>{"use strict";var qr=p(),lr=s(),hr="[object Arguments]";function xr(r){return lr(r)&&qr(r)==hr}N.exports=xr});var Tr=n((Gr,z)=>{"use strict";var v=k(),Ir=s(),w=Object.prototype,Ar=w.hasOwnProperty,Sr=w.propertyIsEnumerable,Pr=v(function(){return arguments}())?v:function(r){return Ir(r)&&Ar.call(r,"callee")&&!Sr.call(r,"callee")};z.exports=Pr});var Er=n((Yr,C)=>{"use strict";var dr=a(),jr=1/0;function Or(r){if(typeof r=="string"||dr(r))return r;var e=r+"";return e=="0"&&1/r==-jr?"-0":e}C.exports=Or});export{u as a,s as b,a as c,gr as d,Tr as e,Er as f};
2
+ //# sourceMappingURL=chunk-WBPDMDW4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKey.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_memoizeCapped.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToPath.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseToString.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toString.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsArguments.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArguments.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toKey.js"],"sourcesContent":["/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nmodule.exports = isKey;\n","var memoize = require('./memoize');\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nmodule.exports = memoizeCapped;\n","var memoizeCapped = require('./_memoizeCapped');\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nmodule.exports = stringToPath;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n","var Symbol = require('./_Symbol'),\n arrayMap = require('./_arrayMap'),\n isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n","var baseToString = require('./_baseToString');\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nmodule.exports = toString;\n","var isArray = require('./isArray'),\n isKey = require('./_isKey'),\n stringToPath = require('./_stringToPath'),\n toString = require('./toString');\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nmodule.exports = castPath;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nmodule.exports = baseIsArguments;\n","var baseIsArguments = require('./_baseIsArguments'),\n isObjectLike = require('./isObjectLike');\n\n/** 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/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nmodule.exports = isArguments;\n","var isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INF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isArray","__commonJSMin","exports","module","isArray","require_isSymbol","__commonJSMin","exports","module","baseGetTag","isObjectLike","symbolTag","isSymbol","value","require_isKey","__commonJSMin","exports","module","isArray","isSymbol","reIsDeepProp","reIsPlainProp","isKey","value","object","type","require_memoizeCapped","__commonJSMin","exports","module","memoize","MAX_MEMOIZE_SIZE","memoizeCapped","func","result","key","cache","require_stringToPath","__commonJSMin","exports","module","memoizeCapped","rePropName","reEscapeChar","stringToPath","string","result","match","number","quote","subString","require_arrayMap","__commonJSMin","exports","module","arrayMap","array","iteratee","index","length","result","require_baseToString","__commonJSMin","exports","module","Symbol","arrayMap","isArray","isSymbol","INFINITY","symbolProto","symbolToString","baseToString","value","result","require_toString","__commonJSMin","exports","module","baseToString","toString","value","require_castPath","__commonJSMin","exports","module","isArray","isKey","stringToPath","toString","castPath","value","object","require_baseIsArguments","__commonJSMin","exports","module","baseGetTag","isObjectLike","argsTag","baseIsArguments","value","require_isArguments","__commonJSMin","exports","module","baseIsArguments","isObjectLike","objectProto","hasOwnProperty","propertyIsEnumerable","isArguments","value","require_toKey","__commonJSMin","exports","module","isSymbol","INFINITY","toKey","value","result"]}
@@ -0,0 +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
@@ -0,0 +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 `${propertyName}: ${getThemeStringProp(\n theme,\n path,\n defaultValue,\n )}`;\n }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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{a}from"./chunk-RKGGCIUD.js";import{hideVisually as i}from"polished";import{jsx as s}from"react/jsx-runtime";var d=({className:e,id:t,defaultMessage:o,children:n,data:p,screenreaderOnly:l=!1,allowHTML:f=!1})=>{let r=a(t,o||n,p);if(l){let m={...i()};return s("span",{className:e,style:m,children:r})}return f?s("span",{className:e,dangerouslySetInnerHTML:{__html:r}}):s("span",{className:e,children:r})};d.displayName="BI.Message";
2
+ //# sourceMappingURL=chunk-X3N2NQVZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/i18n/react/Message.tsx"],"sourcesContent":["import { hideVisually } from \"polished\";\n\nimport { useMessage } from \"../../hooks/useI18n\";\n\nimport type { MessageParameters } from \"@beinformed/ui/types\";\n\ninterface Props {\n className?: string;\n id: string;\n defaultMessage?: string | null;\n children?: string;\n data?: MessageParameters | undefined;\n screenreaderOnly?: boolean;\n allowHTML?: boolean;\n}\n\n/**\n * Message React component\n */\nconst Message = ({\n className,\n id,\n defaultMessage,\n children,\n data,\n screenreaderOnly = false,\n allowHTML = false,\n}: Props) => {\n const translatedMessage = useMessage(id, defaultMessage || children, data);\n\n if (screenreaderOnly) {\n const styles = {\n ...hideVisually(),\n };\n\n return (\n <span className={className} style={styles}>\n {translatedMessage}\n </span>\n );\n }\n\n if (allowHTML) {\n return (\n <span\n className={className}\n dangerouslySetInnerHTML={{\n __html: translatedMessage,\n }}\n />\n );\n }\n\n return <span className={className}>{translatedMessage}</span>;\n};\n\nMessage.displayName = \"BI.Message\";\n\nexport default Message;\n"],"mappings":"mCAAA,OAAS,gBAAAA,MAAoB,WAoCvB,cAAAC,MAAA,oBAjBN,IAAMC,EAAU,CAAC,CACf,UAAAC,EACA,GAAAC,EACA,eAAAC,EACA,SAAAC,EACA,KAAAC,EACA,iBAAAC,EAAmB,GACnB,UAAAC,EAAY,EACd,IAAa,CACX,IAAMC,EAAoBC,EAAWP,EAAIC,GAAkBC,EAAUC,CAAI,EAEzE,GAAIC,EAAkB,CACpB,IAAMI,EAAS,CACb,GAAGC,EAAa,CAClB,EAEA,OACEZ,EAAC,QAAK,UAAWE,EAAW,MAAOS,EAChC,SAAAF,EACH,CAEJ,CAEA,OAAID,EAEAR,EAAC,QACC,UAAWE,EACX,wBAAyB,CACvB,OAAQO,CACV,EACF,EAIGT,EAAC,QAAK,UAAWE,EAAY,SAAAO,EAAkB,CACxD,EAEAR,EAAQ,YAAc","names":["hideVisually","jsx","Message","className","id","defaultMessage","children","data","screenreaderOnly","allowHTML","translatedMessage","useMessage","styles","hideVisually"]}
@@ -0,0 +1,2 @@
1
+ import{a as x}from"./chunk-JYAETKRB.js";import{a as J,d as Q,e as ee,f as oe}from"./chunk-WBPDMDW4.js";import{a as E}from"./chunk-FW4363Y4.js";var $=E((Dt,X)=>{"use strict";var Be=9007199254740991,Ge=/^(?:0|[1-9]\d*)$/;function Ke(e,o){var t=typeof e;return o=o??Be,!!o&&(t=="number"||t!="symbol"&&Ge.test(e))&&e>-1&&e%1==0&&e<o}X.exports=Ke});var Y=E((wt,j)=>{"use strict";var qe=9007199254740991;function We(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=qe}j.exports=We});var Je=E((Ut,Z)=>{"use strict";var ze=Q(),Ve=ee(),Xe=J(),$e=$(),je=Y(),Ye=oe();function Ze(e,o,t){o=ze(o,e);for(var n=-1,r=o.length,a=!1;++n<r;){var s=Ye(o[n]);if(!(a=e!=null&&t(e,s)))break;e=e[s]}return a||++n!=r?a:(r=e==null?0:e.length,!!r&&je(r)&&$e(s,r)&&(Xe(e)||Ve(e)))}Z.exports=Ze});import{createAction as u,createReducer as te}from"@reduxjs/toolkit";var re={authenticated:!1,mustChangePassword:!1,error:null},ne=u("AUTHENTICATION_SUCCESS"),g=u("AUTHENTICATION_LOGOUT"),y=u("AUTHENTICATION_ERROR",e=>({payload:e})),ae=u("AUTHENTICATION_RESET_ERRORS"),h=u("CHANGE_PASSWORD"),eo=te(re,e=>{e.addCase(ne,o=>{o.authenticated=!0,o.error=null,o.mustChangePassword=!1}).addCase(y,(o,t)=>{o.authenticated=!1,o.error=t.payload,o.mustChangePassword=!1}).addCase(ae,o=>{o.error=null}).addCase(g,o=>{o.authenticated=!1,o.error=null,o.mustChangePassword=!1}).addCase(h,o=>{o.authenticated=!0,o.error=null,o.mustChangePassword=!0})});import{Cache as se}from"@beinformed/ui/utils";import{createAction as ie,createReducer as de}from"@reduxjs/toolkit";var le=ie("UPDATE_ENTRYDATE",e=>({payload:e})),ce={entryDate:new Date().toISOString().split("T")[0]},no=de(ce,e=>{e.addCase(le,(o,t)=>{se.addItem("ModelCatalogEntryDate",t.payload),o.entryDate=t.payload})});import{createAction as M,createAsyncThunk as ue,createReducer as me}from"@reduxjs/toolkit";var O=(r=>(r.SUCCESS="SUCCESS",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r))(O||{}),T=M("SHOW_NOTIFICATION",(e,o,t)=>({payload:{type:e,message:o,error:t}})),S=ue("notifications/show",({type:e,message:o,error:t,timeout:n},{dispatch:r})=>{n&&setTimeout(()=>{r(p())},n),r(T(e,o,t))}),p=M("DISMISS_NOTIFICATION"),pe={render:!1,messageType:void 0,message:void 0,error:void 0},io=me(pe,e=>{e.addCase(T,(o,t)=>({...o,render:!0,messageType:t.payload.type,message:t.payload.message,error:t.payload.error})).addCase(p,o=>({...o,render:!1,messageType:void 0,message:void 0,error:void 0}))});import{getNumberSetting as fe}from"@beinformed/ui/settings";import{createAsyncThunk as Re}from"@reduxjs/toolkit";import{createAction as f}from"@reduxjs/toolkit";var N=f("START_PROGRESS"),C=f("FINISH_PROGRESS"),uo=f("RESET_PROGRESS"),mo=f("UPDATE_PROGRESS",e=>({payload:{percentComplete:e}}));var Ee=e=>e.actiontype==="create"?"Notification.Msg.Create":e.actiontype==="update"?"Notification.Msg.Update":e.actiontype==="delete"?"Notification.Msg.Delete":"Notification.Msg.Generic",yo=Re("notification/show_form",async(e,{dispatch:o})=>(o(N()),o(S({type:"SUCCESS",message:{id:Ee(e)}})),setTimeout(()=>{o(p())},fe("HIDE_NOTIFICATION_TIMEOUT")),o(C()))),P=e=>S({type:"ERROR",message:{id:e.id,defaultMessage:e.message,parameters:e.properties},error:e});import{createAction as m}from"@reduxjs/toolkit";var D=m("ROUTER/PUSH",(e,o)=>({payload:{location:e,state:o}})),w=m("ROUTER/REPLACE",(e,o)=>({payload:{location:e,state:o}})),Ao=m("ROUTER/GO",e=>({payload:{delta:e}})),Io=m("ROUTER/GOBACK"),xo=m("ROUTER/GOFORWARD");import{createAction as ge,createReducer as ye}from"@reduxjs/toolkit";var A=ge("SAVE_ERROR",e=>({payload:e})),he=null,To=ye(he,e=>{e.addCase(A,(o,t)=>t.payload)});import{createAction as U,createReducer as Se}from"@reduxjs/toolkit";var Ae=U("SHOW_MODAL",e=>({payload:e})),Ie=U("CLOSE_MODAL",e=>({payload:e})),xe={modals:[]},Po=Se(xe,e=>{e.addCase(Ae,(o,t)=>{let n=t.payload;o.modals.forEach(a=>{a.visible=!1});let r=o.modals.find(a=>a.key===n);r?r.visible=!0:o.modals.push({key:n,visible:!0})}).addCase(Ie,(o,t)=>{let n=t.payload;o.modals=o.modals.filter(a=>a.key!==n);let r=o.modals[o.modals.length-1];r&&(r.visible=!0)})});var H=(r=>(r.IDLE="IDLE",r.LOADING="LOADING",r.FINISHED="FINISHED",r.ERROR="ERROR",r))(H||{});import{createAction as d}from"@reduxjs/toolkit";var _=d("MODULARUI/ERROR_STATUS",(e,o)=>({payload:{key:e,error:o}})),Ho=d("MODULARUI/SET",(e,o)=>(o.connectKey=e,{payload:{key:e,model:o}})),_o=d("MODULARUI/INIT",e=>({payload:e})),vo=d("MODULARUI/UPDATE",e=>({payload:e})),Fo=d("MODULARUI/UPDATE_FORM",e=>({payload:e})),l=d("MODULARUI/REMOVE_KEY",e=>({payload:e})),Lo=d("MODULARUI/RESET");import{Href as v}from"@beinformed/ui/models";var Bo=(e,o)=>{let t=e.i18n.locale||"en",n=e.modularui;if(n){let r=Object.keys(n).find(a=>{let s=n[a];return s?.model?s.model instanceof o&&s.model.locale===t:!1});if(r){let a=n[r];if(a?.model instanceof o)return a.model}}},F=(e,o)=>{if(e&&e.modularui){let t=o instanceof v?o:new v(o);return Object.keys(e.modularui).filter(n=>{let r=e.modularui[n];if(r)return r.model?.selfhref?.equals(t)})}return[]};import{ApplicationModel as Me}from"@beinformed/ui/models";var R=e=>{let o=e.i18n.locale||"en",t=e.modularui;if(t){let n=Object.keys(t).find(r=>{let a=t[r];return a?.model?a.model instanceof Me&&a.model.locale===o:!1});if(n)return t[n]}};import{ApplicationModel as Le,Href as be}from"@beinformed/ui/models";import{createAsyncThunk as ke}from"@reduxjs/toolkit";import{HTTP_METHODS as Ue}from"@beinformed/ui/constants";import{ErrorResponse as He,Href as z}from"@beinformed/ui/models";import{ModularUIRequest as _e}from"@beinformed/ui/modularui";import{createAsyncThunk as ve}from"@reduxjs/toolkit";import{IS_SERVER as Pe}from"@beinformed/ui/constants";import{ErrorResponse as G}from"@beinformed/ui/models";import{logoutPath as De}from"@beinformed/ui/settings";import{getBooleanSetting as Oe,getStringSetting as Te}from"@beinformed/ui/settings";import{Cache as L}from"@beinformed/ui/utils";import{createAsyncThunk as Ne}from"@reduxjs/toolkit";var k=Ne("auth/unauthorized",(e,{dispatch:o,getState:t})=>{if(e.connectKey&&o(l(e.connectKey)),Oe("PAGE_RELOAD_ON_UNAUTHORIZED_ERROR",!1)&&e.response){window.location.reload();return}let n=R(t());(L.getItem("auth")||n?.isLoggedIn)&&o(b()),o(g()),L.removeItem("auth"),e.isInvalidUsername&&o(y(e.message||""));let r=t().router.location,a=Te("LOGIN_PATH","/signin");if(r?.pathname!==a){let s=r?.state?.from;o(w(a,{from:s||t().router.location,modal:!1}))}});import{createAction as Ce}from"@reduxjs/toolkit";var B=Ce("NO_ACTION");var we=e=>o=>{if(e.isResourceNotFoundAfterReload||e.isRemoteServiceException)return o(B());if(e.isUnauthorized)return o(k(e));if(e.isBlocked||e.isConcurrentUser||e.isInvalidUsername){o(D(De()));return}return e.isChangePassword?o(h()):Pe?o(A(e)):(setTimeout(()=>{throw e.error||e}),o(P(e)))},K=(e,o)=>t=>t(o(e)),ct=e=>{K=e},q=e=>{let o=e instanceof G?e:new G(e);return K(o,we)};var W=(e,o)=>e||typeof navigator<"u"&&navigator?.language&&navigator.language.split("-")[0]||o;var Fe=async({key:e,href:o,options:t},{dispatch:n,getState:r,rejectWithValue:a})=>{try{let s=W(t?.locale,r().i18n.locale),i=o instanceof z?o:new z(o,"",{origin:t?.origin,contextPath:t?.contextPath}),c=await new _e(i,{method:t?.method||Ue.GET,params:t?.params||"",data:t?.data||null,locale:s,childmodels:t?.childmodels??!0,isReload:t?.isReload,cache:t?.cache,headers:t?.headers,events:t?.events,onProgress:t?.onProgress,origin:t?.origin,contextPath:t?.contextPath,targetModel:t?.targetModel,forceTargetModel:t?.forceTargetModel??!1,timeout:t?.timeout}).fetch();return c&&(c.connectKey=e),{key:e,model:c,updateHandler:t?.updateHandler}}catch(s){let i=new He(s,e,{origin:t?.origin,contextPath:t?.contextPath});throw i.isChangePassword||i.isResourceNotFoundAfterReload?n(l(e)):n(_(e,i)),n(q(s)),a(i)}},V=ve("modularui/fetchModel",Fe,{condition:({key:e},{getState:o})=>{if(o().modularui[e]?.status==="LOADING")return!1}});var b=ke("application/reload",async(e,{dispatch:o,getState:t})=>{let n=t(),r=new be("/","Application"),a=R(n);a&&(a.contextPath&&(r.contextPath=a.contextPath),a.origin&&(r.origin=a.origin));let s=F(n,r);for(let c of s)o(l(c));let I=`application(/)(${x(n)}`;await o(V({key:I,href:r,options:{targetModel:Le}}))});export{ne as a,g as b,y as c,ae as d,h as e,eo as f,$ as g,Je as h,le as i,no as j,N as k,C as l,uo as m,mo as n,O as o,S as p,p as q,io as r,yo as s,P as t,D as u,w as v,Ao as w,Io as x,xo as y,A as z,To as A,Ae as B,Ie as C,Po as D,H as E,_ as F,Ho as G,_o as H,vo as I,Fo as J,l as K,Lo as L,Bo as M,F as N,R as O,b as P,k as Q,B as R,ct as S,q as T,W as U,V};
2
+ //# sourceMappingURL=chunk-Y7ESITVO.js.map