react-luminus-components 1.4.58 → 1.5.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.
package/dist/main.cjs.js CHANGED
@@ -6,7 +6,7 @@
6
6
  Prefix can't start with '-' when allowNegative is true.
7
7
  prefix: `+s+`
8
8
  allowNegative: `+a+`
9
- `),a=!1),Object.assign(Object.assign({},e),{allowNegative:a})}function Dc(e){e=Sc(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,o=e.allowLeadingZeros,s=e.onKeyDown;s===void 0&&(s=Xe);var a=e.onBlur;a===void 0&&(a=Xe);var i=e.thousandSeparator,l=e.decimalScale,c=e.fixedDecimalScale,p=e.prefix;p===void 0&&(p="");var u=e.defaultValue,m=e.value,f=e.valueIsNumericString,x=e.onValueChange,g=Na(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),b=Sn(e),v=b.decimalSeparator,h=b.allowedDecimalSeparators,y=function(k){return Oo(k,e)},C=function(k,M){return Nc(k,M,e)},E=ht(m)?u:m,j=f??Cc(E,p,t);ht(m)?ht(u)||(j=j||typeof u=="number"):j=j||typeof m=="number";var S=function(k){return wa(k)?k:(typeof k=="number"&&(k=Ia(k)),j&&typeof l=="number"?Io(k,l,!!c):k)},D=Oa(S(m),S(u),!!j,y,C,x),I=D[0],w=I.numAsString,_=I.formattedValue,T=D[1],A=function(k){var M=k.target,G=k.key,L=M.selectionStart,$=M.selectionEnd,U=M.value;if(U===void 0&&(U=""),(G==="Backspace"||G==="Delete")&&$<p.length){k.preventDefault();return}if(L!==$){s(k);return}G==="Backspace"&&U[0]==="-"&&L===p.length+1&&r&&dt(M,1),l&&c&&(G==="Backspace"&&U[L-1]===v?(dt(M,L-1),k.preventDefault()):G==="Delete"&&U[L]===v&&k.preventDefault()),h!=null&&h.includes(G)&&U[L]===v&&dt(M,L+1);var q=i===!0?",":i;G==="Backspace"&&U[L-1]===q&&dt(M,L-1),G==="Delete"&&U[L]===q&&dt(M,L+1),s(k)},R=function(k){var M=w;if(M.match(/\d/g)||(M=""),o||(M=dc(M)),c&&l&&(M=Io(M,l,c)),M!==w){var G=Oo(M,e);T({formattedValue:G,value:M,floatValue:parseFloat(M)},{event:k,source:$t.event})}a(k)},O=function(k){return k===v?!0:Gt(k)},F=function(k){var M=k.currentValue,G=k.lastValue,L=k.formattedValue,$=k.currentValueIndex,U=k.formattedValueIndex,q=M[$],X=L[U],Q=_a(G,M),le=Q.to,V=function(Y){return C(Y).indexOf(".")+p.length};return m===0&&c&&l&&M[le.start]===v&&V(M)<$&&V(L)>U?!1:$>=le.start&&$<le.end&&h&&h.includes(q)&&X===v?!0:q===X};return Object.assign(Object.assign({},g),{value:_,valueIsNumericString:!1,isValidInputCharacter:O,isCharacterSame:F,onValueChange:T,format:y,removeFormatting:C,getCaretBoundary:function(k){return wc(k,e)},onKeyDown:A,onBlur:R})}function _r(e){var t=Dc(e);return d.createElement(Ec,Object.assign({},t))}const Ta=({InputContainer:e=n.FloatingLabelInput,value:t,onChange:r,debounceMs:o,label:s,withoutLabel:a,placeholder:i,size:l,hidden:c,disabled:p,showClearIcon:u,clearValue:m,className:f,step:x,noSelectOnFocus:g,decimalScale:b,fixedDecimalScale:v=!1,numberPrefix:h,numberSuffix:y,min:C,max:E,hint:j})=>{const S=d.useCallback(()=>{if(!r)return;const A=m??null;r(A?Number(A):null)},[m,r]),D=d.useRef(null),[I,w]=d.useState((t==null?void 0:t.toString())??""),_=d.useCallback(A=>{const R=A;r&&r(R==null||R===""?null:Number(R))},[r]),T=d.useCallback(A=>{var O,F;let R=parseFloat(((F=(O=A.target)==null?void 0:O.value)==null?void 0:F.replaceAll(" ","").replaceAll(",","."))??0);if(Number.isNaN(R)&&(R=0),!o){_(R.toString());return}w(R.toString()),D.current!==null&&window.clearTimeout(D.current),D.current=window.setTimeout(()=>{_(R.toString())},o)},[o,_]);return d.useEffect(()=>{w(t===null?"":t.toString())},[E,C,t]),d.useEffect(()=>{E!==void 0&&Number(I)>E&&w(E.toString()),C!==void 0&&Number(I)<C&&w(C.toString())},[I,E,C,w]),d.useEffect(()=>{!r||t===null||(E!==void 0&&t>E&&r(E),C!==void 0&&t<C&&r(C))},[t,E,C,r]),n.jsxRuntimeExports.jsxs(e,{withoutLabel:a,label:s??"",hidden:c,className:f,hint:j,disabled:p,children:[n.jsxRuntimeExports.jsx(_r,{displayType:"input",thousandSeparator:" ",decimalSeparator:",",decimalScale:b,fixedDecimalScale:v,prefix:h,suffix:y,defaultValue:"",value:o?I:(t==null?void 0:t.toString())??"",placeholder:i??s,onFocus:A=>{!g&&A.target.select()},onChange:T,hidden:c,disabled:p,className:n.classNames("form-control text-end w-100",{[`form-control-${l}`]:l}),step:x,min:C,max:E}),u&&t!==null&&r&&!p&&n.jsxRuntimeExports.jsx("div",{className:"luminus-input-remove-icon inset",children:n.jsxRuntimeExports.jsx(n.IconButton,{color:"secondary",size:"sm",onClick:S,children:n.jsxRuntimeExports.jsx(n.MdClear,{})})})]})},Pa=({InputContainer:e=n.RowLabelInput,label:t,options:r,disabled:o,hidden:s,className:a,value:i,onChange:l})=>{const c=d.useCallback(p=>{l&&l(p.target.value)},[l]);return n.jsxRuntimeExports.jsx(e,{isForRadioInput:!0,hidden:s,withoutLabel:!t,label:`${t}`,className:a,disabled:o,children:r.map(p=>n.jsxRuntimeExports.jsx(n.Form.Check,{id:`radio-${p.id}`,label:p.name,type:"radio",value:p.id??"",checked:i===p.id,onChange:c,hidden:s,disabled:o,className:"w-100"},p.id))})},Ic=({InputContainer:e=n.RowLabelInput,formField:t,label:r,resetsFields:o,type:s,required:a,hidden:i,disabled:l,withoutLabel:c,hint:p,onChange:u,className:m})=>{const{register:f,formState:x,setValue:g}=Oe.useFormContext(),b=n.useFormDisabledContext({falseIfNotInit:!0}),[v,h]=d.useState(void 0),[y,C]=d.useState(!1);d.useEffect(()=>{const S=t.split(".");let D=x.errors;S.forEach(I=>{D!==void 0&&(D=D[I])}),h(D)},[x,t]);const E=d.useMemo(()=>l||b,[l,b]),j=v!==void 0;return d.useEffect(()=>{x.isSubmitted&&C(!0)},[x]),n.jsxRuntimeExports.jsxs(e,{isForCheckInput:!0,hidden:i,label:r??"",required:a,disabled:E,isInvalid:j,withoutLabel:c,hint:p,className:m,children:[n.jsxRuntimeExports.jsx(n.Form.Check,{id:`check-${t}`,type:s??"checkbox",label:`${r}${a?" *":""}`,...f(t,{onChange:S=>{o&&o.forEach(D=>g(D,null,{shouldDirty:!0,shouldValidate:y})),u&&u(S.target.value??null)}}),isInvalid:j,hidden:i,disabled:E,className:"w-100"}),v&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:v.message})]})},_c=({InputContainer:e=n.RowLabelInput,label:t,formField:r,options:o,resetsFields:s,required:a,disabled:i,hidden:l,onChange:c,className:p})=>{const{register:u,formState:m,setValue:f,watch:x}=Oe.useFormContext(),g=n.useFormDisabledContext({falseIfNotInit:!0}),[b,v]=d.useState(void 0),[h,y]=d.useState(!1),C=d.useMemo(()=>o,[o]),E=d.useMemo(()=>i||g,[i,g]);d.useEffect(()=>{const S=r.split(".");let D=m.errors;S.forEach(I=>{D!==void 0&&(D=D[I])}),v(D)},[m,r]),d.useEffect(()=>{m.isSubmitted&&y(!0)},[m]);const j=b!==void 0;return n.jsxRuntimeExports.jsxs(e,{isForRadioInput:!0,hidden:l,withoutLabel:!t,label:t??"",required:a,disabled:E,isInvalid:j,className:p,children:[C.map(S=>n.jsxRuntimeExports.jsx(n.Form.Check,{id:`radio-${S.id}`,label:S.name,type:"radio",value:S.id??"",checked:x(r)===S.id,...u(r,{onChange:D=>{var I;s&&s.forEach(w=>f(w,null,{shouldDirty:!0,shouldValidate:h})),c&&c((I=D.target)!=null&&I.value?D.target.value.toString():null)}}),isInvalid:j,hidden:l,disabled:E,className:"w-100"},S.id)),b&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:b.message})]})},Oc=({label:e,InputContainer:t=n.RowLabelInput,className:r,withoutLabel:o,hidden:s,disabled:a,contactType:i,formField:l,...c})=>{const{watch:p}=Oe.useFormContext(),u=p(l),m=n.useFormDisabledContext({falseIfNotInit:!0}),f=d.useMemo(()=>a||m,[a,m]);return s?null:n.jsxRuntimeExports.jsx(Ca,{contactType:i,value:u,withoutLabel:o,label:e,className:r,children:n.jsxRuntimeExports.jsx(n.HookFormTextInput,{type:"text",formField:l,InputContainer:t,size:"sm",withoutLabel:!0,className:"flex-grow-1",disabled:f,...c})})},Tc=({InputContainer:e=n.RowLabelInput,formField:t,label:r,size:o,defaultSelection:s,resetsFields:a,isNumber:i,required:l,hidden:c,disabled:p,items:u,onSearchQueryChange:m,selectedItemNavigateTo:f,texts:x,dropdownItemsNameWidth:g,isLoading:b,withoutLabel:v,additionalColumns:h,CustomOnChangeComponent:y,icon:C,displayIdAsName:E,onSelect:j,className:S,archiveColumn:D,hint:I,addNewOptionPath:w,refreshOptions:_,MiniDetailComponent:T,miniDetailPlacement:A,suggestedItems:R,suggestedItemsTitle:O})=>{const{formState:F,setValue:k,watch:M,control:G}=Oe.useFormContext(),L=n.useFormDisabledContext({falseIfNotInit:!0}),[$,U]=d.useState(void 0),[q,X]=d.useState(!1),[Q,le]=d.useState(!1),V=M(t)??null,Y=V===(s==null?void 0:s.id)?s==null?void 0:s.name:M(`${t}-DropdownName`),re=d.useMemo(()=>V==null?null:{id:V??null,name:Y??""},[V,Y]),fe=d.useCallback(()=>{const B=t.split(".");let z=F.errors;B.forEach(ee=>{z!==void 0&&(z=z[ee])}),U(z)},[F,t]),te=d.useCallback(B=>{if((B==null?void 0:B.id)===V)return;if(j&&j(B),a&&a.forEach(ee=>k(ee,null,{shouldDirty:!0,shouldValidate:Q})),B===null){k(t,null,{shouldDirty:!0,shouldValidate:Q}),k(`${t}-DropdownName`,null);return}let z=null;i?z=(B==null?void 0:B.id)!==null&&(B==null?void 0:B.id)!==""?parseInt(B.id.toString(),10):null:z=B.id===null||B.id===void 0||B.id===""?null:B.id,k(t,z,{shouldDirty:!0,shouldValidate:Q}),k(`${t}-DropdownName`,B.name??"")},[k,t,Q,i,a,V,j]),P=d.useCallback(B=>{X(!1),te(B)},[te]),Z=d.useCallback(()=>{X(!1)},[]),ve=d.useRef(null),De=$!==void 0,Ae=f!==void 0,ze=Ae&&re!==null,W=d.useMemo(()=>p||L,[p,L]);return d.useEffect(()=>{fe()},[fe]),d.useEffect(()=>{F.isSubmitted&&le(!0)},[F]),n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:n.jsxRuntimeExports.jsxs(e,{label:r??"",required:l,disabled:W,hidden:c,withoutLabel:v,isInvalid:De,inputContainerClassName:n.classNames({"luminus-dropdown-select-open":q}),hint:I,className:S,children:[n.jsxRuntimeExports.jsxs(n.InputAnchorContainer,{currentSelection:re,selectedItemNavigateTo:f,children:[E&&(re==null?void 0:re.name)&&n.jsxRuntimeExports.jsx(n.Typography,{variant:"caption",className:"d-flex justify-content-end mt-2 luminus-dropdown-selection-name",children:re.name}),n.jsxRuntimeExports.jsx(Oe.Controller,{control:G,name:t,render:()=>n.jsxRuntimeExports.jsx(n.MiniDetailWrapper,{value:V,MiniDetailComponent:T,miniDetailPlacement:A,children:n.jsxRuntimeExports.jsx(n.Form.Select,{size:o,onMouseDown:B=>{B.currentTarget.focus(),B.preventDefault()},onClick:()=>{!Ae&&!W&&X(!0)},ref:ve,value:V??"",onChange:()=>{},isInvalid:De,hidden:c,className:n.classNames("w-100",{"luminus-dropdown-picker-disabled":W,"luminus-dropdown-picker-link":ze}),children:n.jsxRuntimeExports.jsx("option",{value:V,children:E?V:(Y==null?void 0:Y.length)>0?Y:V})})})}),y||!W&&Ae?n.jsxRuntimeExports.jsxs("div",{className:"custom-picker-button",children:[!y&&!W&&Ae&&n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",color:"secondary",onClick:B=>{B.preventDefault(),B.stopPropagation(),X(!0)},children:C??n.jsxRuntimeExports.jsx(n.MdOutlineEdit,{})}),y??null]}):null]}),$&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:$.message}),ve.current&&n.jsxRuntimeExports.jsx(n.SimplePicker,{show:q,onCancel:Z,items:u,currentSelection:re,onSelectionChange:P,onSearchQueryChange:m,texts:x,itemsNameWidth:g,additionalColumns:h,displayIdAsName:E,isLoading:b,disabled:W,inputRef:ve,archiveColumn:D,addNewOptionPath:w,refreshOptions:_,suggestedItems:R,suggestedItemsTitle:O})]})})},Pc=({InputContainer:e=n.RowLabelInput,label:t,formField:r,hidden:o,required:s,placeholder:a,disabled:i,showClearIcon:l,resetsFields:c,multiple:p,accept:u,withoutLabel:m,hint:f,className:x})=>{const{watch:g,setValue:b,register:v,formState:h}=Oe.useFormContext(),y=n.useFormDisabledContext({falseIfNotInit:!0}),[C,E]=d.useState(!1),[j,S]=d.useState(void 0),D=d.useCallback(()=>{b(r,"")},[b,r]),I=d.useCallback(()=>{const T=r.split(".");let A=h.errors;T.forEach(R=>{A!==void 0&&(A=A[R])}),S(A)},[h,r]);d.useEffect(I,[I]),d.useEffect(()=>{h.isSubmitted&&E(!0)},[h]);const w=d.useMemo(()=>i||y,[i,y]),_=j!==void 0;return n.jsxRuntimeExports.jsxs(e,{label:t??"",required:s,disabled:w,hidden:o,withoutLabel:m,isInvalid:_,hint:f,className:x,children:[n.jsxRuntimeExports.jsx(n.FormControl,{type:"file",multiple:p,accept:u.join(", "),placeholder:a??t,isInvalid:_,hidden:o,disabled:w,className:"w-100",...v(r,{onChange:()=>{c&&c.forEach(T=>b(T,null,{shouldDirty:!0,shouldValidate:C}))}})}),l&&g(r)&&n.jsxRuntimeExports.jsx("div",{className:"luminus-input-remove-icon",children:n.jsxRuntimeExports.jsx(n.IconButton,{color:"secondary",size:"sm",onClick:D,children:n.jsxRuntimeExports.jsx(n.MdClear,{})})}),j&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:j.message})]})},ka=({children:e,onStorno:t,noSpacer:r})=>{const{formState:o}=Oe.useFormContext(),s=n.useFormDisabledContext({falseIfNotInit:!0}),[a,i]=d.useState(!1);return d.useEffect(()=>{i(Object.keys(o.dirtyFields).length>0)},[o]),a?n.jsxRuntimeExports.jsx(ha,{onStorno:t,noSpacer:r,disabled:s,children:e}):null},mr=({InputContainer:e=n.RowLabelInput,options:t,formField:r,label:o,size:s,resetsFields:a,isNumber:i,required:l,hidden:c,disabled:p,withoutLabel:u,noSortOptions:m,suffixIdToName:f,onSelect:x,className:g,appendCurrentSelectionWithName:b,hint:v,addNewOptionPath:h,refreshOptions:y,MiniDetailComponent:C,miniDetailPlacement:E,selectedItemNavigateTo:j})=>{const{texts:{customSelect:S}}=d.useContext(n.LuminusComponentsContext),{formState:D,setValue:I,watch:w,control:_}=Oe.useFormContext(),T=n.useFormDisabledContext({falseIfNotInit:!0}),[A,R]=d.useState(void 0),[O,F]=d.useState(!1),[k,M]=d.useState(!1),[G,L]=d.useState(""),$=w(r),U=d.useMemo(()=>t.find(P=>P.id===$)??null,[t,$]),q=d.useCallback(()=>{const P=r.split(".");let Z=D.errors;P.forEach(ve=>{Z!==void 0&&(Z=Z[ve])}),R(Z)},[D,r]),X=d.useCallback(P=>{if((P==null?void 0:P.id)===$)return;if(x&&x(P),a&&a.forEach(ve=>I(ve,null,{shouldDirty:!0,shouldValidate:k})),P===null){I(r,null,{shouldDirty:!0,shouldValidate:k});return}let Z=null;i?Z=(P==null?void 0:P.id)!==null&&(P==null?void 0:P.id)!==""?parseInt(P.id.toString(),10):null:Z=P.id===null||P.id===void 0||P.id===""?null:P.id,I(r,Z,{shouldDirty:!0,shouldValidate:k})},[I,r,i,a,$,k,x]),Q=d.useCallback(P=>{F(!1),X(P)},[X]),le=d.useCallback(P=>{L(P)},[]),V=d.useMemo(()=>p||T,[p,T]);d.useEffect(()=>{q()},[q]),d.useEffect(()=>{D.isSubmitted&&M(!0)},[D]);const Y=d.useCallback(P=>{var Z;return P===null?"":!P.name||P.name.length===0?((Z=P.id)==null?void 0:Z.toString())??"":f?`${P.name} (${P.id})`:P.name},[f]),re=d.useMemo(()=>{const P=t?[...t]:[];return b!==void 0&&$&&(P.some(Z=>Z.id===$)||P.push({id:$,name:b})),P.map(Z=>({id:Z.id,name:Y(Z)})).filter(Z=>n.stringSearchWithin(Z.name,G)).sort((Z,ve)=>m?0:(Z.name??"").localeCompare(ve.name??""))},[t,m,G,Y,b,$]),fe=d.useRef(null),te=A!==void 0;return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:n.jsxRuntimeExports.jsxs(e,{label:o??"",required:l,disabled:V,hidden:c,withoutLabel:u,isInvalid:te,inputContainerClassName:n.classNames({"luminus-dropdown-select-open":O}),hint:v,className:g,children:[n.jsxRuntimeExports.jsx(n.InputAnchorContainer,{currentSelection:U,selectedItemNavigateTo:j,children:n.jsxRuntimeExports.jsx(Oe.Controller,{control:_,name:r,render:()=>n.jsxRuntimeExports.jsx(n.MiniDetailWrapper,{value:$,MiniDetailComponent:C,miniDetailPlacement:E,children:n.jsxRuntimeExports.jsx(n.Form.Select,{size:s,onMouseDown:P=>{P.currentTarget.focus(),P.preventDefault()},onClick:()=>{F(!0)},ref:fe,value:$??"",onChange:()=>{},isInvalid:te,hidden:c,disabled:V,className:"w-100",children:n.jsxRuntimeExports.jsx("option",{value:(U==null?void 0:U.id)??"",children:Y(U)})})})})}),A&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:A.message}),fe.current&&n.jsxRuntimeExports.jsx(n.SimplePicker,{show:O,onCancel:()=>F(!1),items:re,currentSelection:U??null,onSelectionChange:Q,onSearchQueryChange:le,texts:S,disabled:V,inputRef:fe,autoHideSearch:!0,allItemsLength:t.length,addNewOptionPath:h,refreshOptions:y})]})})},kc=({InputContainer:e=n.RowLabelInput,formField:t,label:r,placeholder:o,size:s,resetsFields:a,showClearIcon:i,clearValue:l,required:c,hidden:p,disabled:u,withoutLabel:m,step:f,stepperStep:x=1,className:g,min:b,max:v,onChange:h,hint:y})=>{const{register:C,formState:E,setValue:j,watch:S}=Oe.useFormContext(),D=n.useFormDisabledContext({falseIfNotInit:!0}),[I,w]=d.useState(void 0),[_,T]=d.useState(!1),A=d.useCallback((G,L,$)=>{j(G,Qe.limitNumber(L,b,v),$)},[v,b,j]),R=d.useCallback(()=>{const G=l??null;A(t,G!==null?Number(G):null,{shouldDirty:!0,shouldValidate:_})},[l,A,t,_]),O=d.useCallback(()=>{const G=t.split(".");let L=E.errors;G.forEach($=>{L!==void 0&&(L=L[$])}),w(L)},[E,t]),F=d.useMemo(()=>u||D,[u,D]);d.useEffect(()=>{O()},[O]),d.useEffect(()=>{E.isSubmitted&&T(!0)},[E]);const k=I!==void 0,M=S(t);return n.jsxRuntimeExports.jsxs(e,{label:r??"",required:c,disabled:F,hidden:p,withoutLabel:m,isInvalid:k,hint:y,className:g,children:[n.jsxRuntimeExports.jsxs("div",{className:"luminus-input-container position-relative w-100",children:[n.jsxRuntimeExports.jsx(n.Form.Control,{type:"number",placeholder:o??r,size:s,...C(t,{setValueAs:G=>G==null||G===""?null:Qe.limitNumber(Number(G),b,v),min:b,max:v,onChange:G=>{var L;a&&a.forEach($=>j($,null,{shouldDirty:!0,shouldValidate:_})),h&&h((L=G.target)!=null&&L.value?Number(G.target.value)??null:null)}}),isInvalid:k,hidden:p,disabled:F,className:"w-100 luminus-numeric-stepper",step:f,min:b,max:v}),n.jsxRuntimeExports.jsx("div",{className:"stepper-icon left",children:!u&&n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",onClick:G=>{G.preventDefault(),G.stopPropagation(),A(t,((M?Number(M):0)-x).toString(),{shouldDirty:!0,shouldValidate:_})},children:n.jsxRuntimeExports.jsx(n.FaMinus,{})})}),n.jsxRuntimeExports.jsx("div",{className:"stepper-icon right",children:!u&&n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",onClick:G=>{G.preventDefault(),G.stopPropagation(),A(t,((M?Number(M):0)+x).toString(),{shouldDirty:!0,shouldValidate:_})},children:n.jsxRuntimeExports.jsx(n.FaPlus,{})})})]}),i&&S(t)&&n.jsxRuntimeExports.jsx("div",{className:"luminus-input-remove-icon",children:n.jsxRuntimeExports.jsx(n.IconButton,{color:"secondary",size:"sm",onClick:R,children:n.jsxRuntimeExports.jsx(n.MdClear,{})})}),I&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:I.message})]})},Ac=({InputContainer:e=n.RowLabelInput,formField:t,label:r,placeholder:o,resetsFields:s,showClearIcon:a,clearValue:i,required:l,hidden:c,disabled:p,withoutLabel:u,step:m,size:f,CustomOnChangeComponent:x,noSelectOnFocus:g,className:b,decimalScale:v=2,fixedDecimalScale:h=!1,numberPrefix:y,numberSuffix:C,min:E,max:j,onChange:S,hint:D})=>{const{formState:I,setValue:w,watch:_,control:T}=Oe.useFormContext(),A=n.useFormDisabledContext({falseIfNotInit:!0}),[R,O]=d.useState(void 0),[F,k]=d.useState(!1),M=d.useCallback(()=>{const q=i??null;w(t,q!==null?Number(q):null,{shouldDirty:!0,shouldValidate:F})},[i,w,t,F]),G=d.useCallback(()=>{const q=t.split(".");let X=I.errors;q.forEach(Q=>{X!==void 0&&(X=X[Q])}),O(X)},[I,t]),L=d.useMemo(()=>p||A,[p,A]);d.useEffect(()=>{G()},[G]),d.useEffect(()=>{I.isSubmitted&&k(!0)},[I]);const $=_(t);d.useEffect(()=>{j!==void 0&&$>j&&w(t,j),E!==void 0&&$<E&&w(t,E)},[t,$,j,E,w]);const U=R!==void 0;return n.jsxRuntimeExports.jsxs(e,{label:r??"",required:l,disabled:L,hidden:c,withoutLabel:u,isInvalid:U,hint:D,className:b,children:[n.jsxRuntimeExports.jsxs("div",{className:"luminus-input-container position-relative w-100",children:[n.jsxRuntimeExports.jsx(Oe.Controller,{control:T,name:t,render:({field:{ref:q,onChange:X,name:Q,value:le}})=>n.jsxRuntimeExports.jsx(_r,{displayType:"input",thousandSeparator:" ",decimalSeparator:",",decimalScale:v,fixedDecimalScale:h,prefix:y,suffix:C,defaultValue:"",name:Q,value:le??"",placeholder:o??r,onFocus:V=>{!g&&V.target.select()},onChange:V=>{var fe,te;const Y=parseFloat(((te=(fe=V.target)==null?void 0:fe.value)==null?void 0:te.replaceAll(" ","").replaceAll(",","."))??0);s&&s.forEach(P=>w(P,null,{shouldDirty:!0,shouldValidate:F}));const re=Y==null||Number.isNaN(Y)?null:Number(Y);X(re),S&&S(re)},hidden:c,disabled:L,className:n.classNames("form-control text-end w-100",{"is-invalid":U},{[`form-control-${f}`]:f}),step:m,getInputRef:q,min:E,max:j})}),x&&n.jsxRuntimeExports.jsx("div",{className:"custom-picker-button",children:x})]}),a&&_(t)&&n.jsxRuntimeExports.jsx("div",{className:"luminus-input-remove-icon inset",children:n.jsxRuntimeExports.jsx(n.IconButton,{color:"secondary",size:"sm",onClick:M,children:n.jsxRuntimeExports.jsx(n.MdClear,{})})}),R&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:R.message})]})},Mc=({color:e="primary",icon:t=n.jsxRuntimeExports.jsx(n.MdOutlineFileUpload,{size:12}),inputId:r="context-file-input",accept:o="*",onUpload:s,multiple:a,className:i,children:l,...c})=>{const p=u=>{u.target.files&&(s(u.target.files),u.target.value="")};return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsxs("label",{htmlFor:r,className:n.classNames(`btn luminus-dropdown-item text-nowrap rounded text-${e} ${i??""}`,n.classes.item),...c,children:[t,l]}),n.jsxRuntimeExports.jsx("input",{id:r,type:"file",accept:o,onChange:p,hidden:!0,multiple:a})]})},Or=["slice","options","formats","conditions"],To=e=>{const t=e.current.flexmonster.getReport({withDefaults:!0});if(typeof t=="string")throw alert("report is string"),new Error("report is string");const r={};return Or.forEach(o=>{r[o]=t[o]}),JSON.stringify(r)},Bc=e=>{if(e.settings){const t=JSON.parse(e.settings);return Or.forEach(r=>{t[r]===void 0&&(t[r]=null)}),t}return{}},Lc=e=>{const t={};return Or.forEach(r=>{t[r]=(e==null?void 0:e[r])??void 0}),t},Fc=e=>e&&e.type==="header"&&e.member&&e.member.caption!=="All"&&e.label==="",Po=(e,t)=>e.hierarchy&&e.hierarchy.uniqueName===t,ko=e=>!e.member&&!e.isDrillThrough,Ao=(e,t)=>typeof e=="function"?e(t):e.replace(":id",t),Aa=({dataSource:e,settings:t,pivotRef:r,localization:o,licenseKey:s,hyperlinkColumn:a,roomPasportization:i,enabled:l=!0})=>{const{texts:{reports:c}}=d.useContext(n.LuminusComponentsContext),[p,u]=d.useState(!1),m=d.useRef(null),f=r??m,x=d.useMemo(()=>({localization:o}),[o]),g=d.useCallback(E=>{delete E[0],delete E[1],delete E[2];const j=[{id:"fm-tab-expand",title:c.expandAll,handler:f.current.flexmonster.expandAllData,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/><path fill="none" d="M0 0h24v24H0V0z"/></svg>'},{id:"fm-tab-collapse",title:c.collapseAll,handler:f.current.flexmonster.collapseAllData,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'}];return E.unshift({id:"fm-tab-expand",title:c.expand,icon:'<svg height="42" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d=" M16 4 L28 4 L28 16 L24 12 L20 16 L16 12 L20 8z M4 16 L8 20 L12 16 L16 20 L12 24 L16 28 L4 28z "/></svg>',menu:j,rightGroup:!0}),E},[f,c.collapseAll,c.expand,c.expandAll]),b=E=>{const j=E.getTabs();E.getTabs=()=>g(j)},v=d.useMemo(()=>e&&e.mapping?Object.values(e.mapping).filter(E=>E.caption.includes("P:")).map(E=>({uniqueName:E.caption.replace("P:",""),caption:E.caption})):[],[e]),h=d.useMemo(()=>{var j,S,D,I;const E=(j=f.current)==null?void 0:j.flexmonster.getReport();return E&&E.slice?{...E.slice,rows:[...((S=E.slice.rows)==null?void 0:S.filter(w=>{var _;return!((_=w.caption)!=null&&_.includes("P:"))}))??[],...v],columns:[...((D=E.slice.columns)==null?void 0:D.filter(w=>{var _;return!((_=w.caption)!=null&&_.includes("P:"))}))??[],...v],measures:[...((I=E.slice.measures)==null?void 0:I.filter(w=>{var _;return!((_=w.caption)!=null&&_.includes("P:"))}))??[],...v]}:null},[v,f]);d.useEffect(()=>{var E,j,S,D;if(p&&l){if(i&&h){const I=(E=f.current)==null?void 0:E.flexmonster.getReport(),w=I&&I.options?{...I.options,grid:{...(j=I.options)==null?void 0:j.grid,autoSwitchToCompact:!1}}:{};(S=f.current)==null||S.flexmonster.setReport({...I,dataSource:e,slice:h,options:w})}else(D=f.current)==null||D.flexmonster.updateData(e);console.log("Updating flexmonster dataSource to: ",e)}},[e,l,p,v,f,i,h]),d.useEffect(()=>{var E,j,S,D,I;if(p&&l){const w=(E=f.current)==null?void 0:E.flexmonster.getReport();if(w===void 0||typeof w=="string")return;const _=Lc(t);_.options={...t==null?void 0:t.options,grid:{...(j=t==null?void 0:t.options)==null?void 0:j.grid,autoSwitchToCompact:!1},showFieldListSearch:!0,datePattern:"dd.MM.yyyy",dateTimePattern:"dd.MM.yyyy HH:mm:ss"},i&&(_.slice={...t==null?void 0:t.slice,rows:[...((D=(S=t==null?void 0:t.slice)==null?void 0:S.rows)==null?void 0:D.filter(A=>{var R;return!((R=A.caption)!=null&&R.includes("P:"))}))??[],...v]});const T={...w,..._};(I=f.current)==null||I.flexmonster.setReport(T),console.log("Refreshing flexmonster settings. New report: ",T)}},[l,p,v,f,i,t]);const y=d.useCallback((E,j)=>{var A,R;if(Fc(j)){E.text=((A=j.member)==null?void 0:A.caption)??"";const O=E.style["padding-left"]??"4px",F=parseInt(O,10);E.style["padding-left"]=F+11+"px"}if(!a||!Po(j,a.idColumn)||ko(j))return;const S=(R=j.escapedLabel)==null?void 0:R.toString();if(S===void 0)return;const D=Ao(a.url,S),I="style='color: #00a45a; text-decoration: underline; cursor: pointer;'",w=j.type==="header"?"onclick='event.stopImmediatePropagation()'":"",_=j.isDrillThrough||j.type==="header"?`href='${D}' target='_blank'`:"";E.style&&(E.style["z-index"]=1);const T=`<a ${_} ${I} ${w}>${j.escapedLabel}</a>`;E.text=T},[a]),C=d.useCallback(E=>{if(!a||!Po(E,a.idColumn)||ko(E))return;const j=Ao(a.url,E.escapedLabel??"");window.open(j??"","_blank","noreferrer")},[a]);return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:n.jsxRuntimeExports.jsx(fl.Pivot,{ref:f,global:x,licenseKey:s,toolbar:!0,height:"100%",beforetoolbarcreated:b,ready:()=>{u(!0)},width:"100%",customizeCell:y,cellclick:C})})},Vc=(e,t,r,o)=>{const{texts:{reports:s}}=d.useContext(n.LuminusComponentsContext),{prompt:a}=n.usePrompt(),{confirm:i}=n.useConfirm(),l=n.useAxios(),{user:c}=d.useContext(n.UserContext),{startLoading:p,stopLoading:u}=d.useContext(n.LoadingContext),{addNotification:m}=n.useNotifications(),f=d.useCallback(async h=>{p("report-versionSavingAs");try{const y=await l.post("/reports/version",h);m(s.saveSuccessful,"success"),await o(y.data)}finally{u("report-versionSavingAs")}},[m,o,l,s.saveSuccessful,p,u]),x=d.useCallback(async()=>{if(r===null){m("none open","warning");return}if(!await i(s.confirmOverwriteSave))return;const y=To(t);f({reportSourceName:e,reportVersionId:r,settings:y})},[m,i,t,e,s.confirmOverwriteSave,f,r]),g=d.useCallback(async()=>{const h=await a(s.enterName,{input:"input",required:!0});if(h===null)return;const y=To(t);f({reportSourceName:e,name:h,settings:y})},[t,a,e,s.enterName,f]),b=d.useCallback(async()=>{p("report-versionSavingAs");try{await l.post("/reports/version",{reportVersionId:r??void 0,reportSourceName:e,isArchived:!0}),m(s.deleteSuccessful,"success")}finally{u("report-versionSavingAs")}},[m,l,e,s.deleteSuccessful,r,p,u]),v=d.useCallback(async()=>{p("report-versionSavingAs");try{await l.post("/reports/version-restrictions",{reportVersionId:r??void 0,userRestricts:[{employeeId:c.personalNumber,addRights:!1}]}),m(s.detachSuccessful,"success")}finally{u("report-versionSavingAs")}},[m,l,s.detachSuccessful,r,p,u,c.personalNumber]);return{saveAs:g,save:x,archive:b,detach:v}},$c=e=>{const t=n.useAxios(),{startLoading:r,stopLoading:o}=d.useContext(n.LoadingContext);return{changeEmployeeRights:d.useCallback(async(a,i)=>{let l=null;r("reportSharing-addPerson");try{l=(await t.post("/reports/version-restrictions",{reportVersionId:e,userRestricts:[{employeeId:a,addRights:i}]})).data}finally{o("reportSharing-addPerson")}return l},[t,e,r,o])}},Gc=({isOpen:e,onHide:t,usersData:r,reportVersionId:o,EmployeePicker:s,setReportVersion:a})=>{const{ProjectIconComponent:i,texts:{reports:l}}=d.useContext(n.LuminusComponentsContext),{confirm:c}=n.useConfirm(),[p,u]=d.useState(null),{changeEmployeeRights:m}=$c(o),f=d.useCallback(b=>{a(v=>v===null?null:{...v,users:b.filter(h=>h.isReportOwner===!1)})},[a]),x=d.useCallback(async()=>{if(p===null)return;const b=await m(p.id,!0);f(b),u(null)},[p,m,f]),g=d.useCallback(async b=>{if(!await c(l.removeSharingWith(b)))return;const h=await m(b,!1);f(h)},[m,c,l,f]);return n.jsxRuntimeExports.jsxs(n.Modal,{show:e,onHide:t,children:[n.jsxRuntimeExports.jsx(n.Modal.Header,{closeButton:!0,children:n.jsxRuntimeExports.jsx(n.Modal.Title,{children:l.reportSharing})}),n.jsxRuntimeExports.jsxs(n.Modal.Body,{children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"h6",children:l.sharedWith}),n.jsxRuntimeExports.jsxs(n.ListGroup,{variant:"flush",children:[r&&r.length===0?n.jsxRuntimeExports.jsx("div",{className:"px-2 text-muted",children:l.noone.toLowerCase()}):null,r==null?void 0:r.map(b=>n.jsxRuntimeExports.jsxs(n.ListGroupItem,{className:"d-flex justify-content-between align-items-center gap-3 border-bottom px-2 py-1",children:[b.lastName," ",b.firstName," [",b.id,"]",n.jsxRuntimeExports.jsx(n.IconButton,{color:"danger",onClick:()=>g(b.id),children:n.jsxRuntimeExports.jsx(i,{icon:"delete"})})]},b.id))]}),n.jsxRuntimeExports.jsx(n.Typography,{variant:"h6",className:"mt-2 mb-2",children:l.addSharing}),n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-2 align-items-center",children:[n.jsxRuntimeExports.jsx("div",{className:"flex-grow-1",children:n.jsxRuntimeExports.jsx(s,{label:l.shareWith,onSelect:b=>{if(b===null||typeof b.id!="number"){u(null);return}u(b)},value:p})}),n.jsxRuntimeExports.jsx(n.PrimaryButton,{onClick:x,disabled:p===null,children:l.add})]})]})]})},Wc=(e,t)=>{const[r,o]=d.useState(null);return d.useEffect(()=>{e.then(({default:s})=>{const a=t!==void 0?t(s):s;o(a)})},[t,e]),{mappings:r}},Uc=({reportType:e,title:t,data:r,filterElements:o,getReportRoute:s,localization:a,licenseKey:i,EmployeePicker:l,localizationJsonFile:c,localizationTransformer:p,hyperlinkColumn:u,roomPasportization:m=!1})=>{const{texts:{reports:f}}=d.useContext(n.LuminusComponentsContext),{confirm:x}=n.useConfirm(),g=oe.useNavigate(),[b]=oe.useSearchParams(),{id:v}=oe.useParams(),h=d.useMemo(()=>v===void 0?null:Number(v),[v]),y=d.useCallback(V=>{const Y=V===null?"":V.toString();g(oe.generatePath(s(e),{id:Y})+"?"+b.toString(),{replace:!0,flushSync:!0})},[s,g,e,b]),[C,E]=d.useState(!1),j=d.useRef(null),{user:S}=d.useContext(n.UserContext),{data:D,reloadData:I}=_e.useGetApiData(`/reports/${e}`),{mappings:w}=Wc(c,p),[_,T]=d.useState({}),A=d.useCallback(V=>{const Y=V.target.value,re=Y===""?null:Number(Y);y(re)},[y]),R=d.useCallback(async V=>{await I(),y(V)},[I,y]),{data:O,setData:F}=_e.useGetApiData(`/reports/version/${h}`,{enabled:h!==null,nullStateBeforeLoad:!1,nullStateOnFail:!0});d.useEffect(()=>{var Y;if(O===null){T({});return}const V=Bc(O)??{};T(V),(Y=j.current)==null||Y.flexmonster.refresh()},[O]);const{save:k,saveAs:M,archive:G,detach:L}=Vc(e,j,h,R),$=d.useMemo(()=>({data:r??[],mapping:w??void 0}),[r,w]),U=d.useCallback(async()=>{var Y;await x(f.confirmRevertChanges)&&((Y=j.current)==null||Y.flexmonster.setReport({dataSource:$,..._}))},[x,$,f.confirmRevertChanges,_]),q=d.useMemo(()=>(O==null?void 0:O.ownerId)===S.personalNumber,[O==null?void 0:O.ownerId,S.personalNumber]),X=d.useMemo(()=>{var V;return(V=O==null?void 0:O.users)==null?void 0:V.some(Y=>Y.id===S.personalNumber&&!Y.isReportOwner)},[O==null?void 0:O.users,S.personalNumber]),Q=d.useCallback(async()=>{await x(f.confirmDelete(O==null?void 0:O.name))&&(await G(),y(null),await I())},[G,x,I,O==null?void 0:O.name,f,y]),le=d.useCallback(async()=>{await x(f.confirmDetach(O==null?void 0:O.name))&&(await L(),y(null),await I())},[x,L,I,O==null?void 0:O.name,f,y]);return d.useEffect(()=>{var V,Y;h===null&&y(((V=D==null?void 0:D.reportVersions.find(re=>re.isSystem===!0))==null?void 0:V.reportVersionId)??((Y=D==null?void 0:D.reportVersions[0])==null?void 0:Y.reportVersionId)??null)},[D==null?void 0:D.reportVersions,h,y]),n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(n.PageContainer,{variant:"fullScreen",title:n.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-start gap-3",children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"h3",children:t}),o,n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-1 align-items-center",children:[n.jsxRuntimeExports.jsxs(n.FormSelect,{size:"sm",value:h??void 0,onChange:A,children:[n.jsxRuntimeExports.jsx("optgroup",{label:f.versionSelectSystem,children:D==null?void 0:D.reportVersions.filter(V=>V.isSystem===!0).map(V=>n.jsxRuntimeExports.jsx("option",{value:V.reportVersionId,children:V.name},V.reportVersionId))}),n.jsxRuntimeExports.jsx("optgroup",{label:f.versionSelectYour,children:D==null?void 0:D.reportVersions.filter(V=>V.ownerId===S.personalNumber).map(V=>n.jsxRuntimeExports.jsx("option",{value:V.reportVersionId,children:V.name},V.reportVersionId))}),n.jsxRuntimeExports.jsx("optgroup",{label:f.versionSelectSharedWithYou,children:D==null?void 0:D.reportVersions.filter(V=>V.isSystem===!1&&V.ownerId!==S.personalNumber).map(V=>n.jsxRuntimeExports.jsx("option",{value:V.reportVersionId,children:`${V.name} [${V.ownerId}]`},V.reportVersionId))})]}),n.jsxRuntimeExports.jsx(n.ContextButton,{icon:n.jsxRuntimeExports.jsx(n.MdSave,{}),onClick:k,disabled:h===null||(O==null?void 0:O.isSystem)||!q,children:f.save}),n.jsxRuntimeExports.jsx(n.ContextButton,{icon:n.jsxRuntimeExports.jsx(n.MdSaveAs,{}),onClick:M,className:"flex-shrink-0",children:f.saveAs}),n.jsxRuntimeExports.jsxs(n.Dropdown,{toggle:n.jsxRuntimeExports.jsx(n.DropdownToggle,{as:n.SimpleDropdownToggle}),children:[n.jsxRuntimeExports.jsx(n.DropdownItem,{onClick:U,children:f.revertChanges}),n.jsxRuntimeExports.jsx(n.DropdownItem,{onClick:()=>E(!0),disabled:!q||(O==null?void 0:O.isSystem),children:f.share}),q&&!(O!=null&&O.isSystem)?n.jsxRuntimeExports.jsx(n.DropdownItem,{color:"danger",onClick:Q,children:f.delete}):null,X&&!(O!=null&&O.isSystem)?n.jsxRuntimeExports.jsx(n.DropdownItem,{color:"danger",onClick:le,children:f.detach}):null]})]})]}),children:n.jsxRuntimeExports.jsx("div",{className:n.classNames("h-100 w-100",$.data&&$.data.length>0?"":"d-none"),children:n.jsxRuntimeExports.jsx(Aa,{dataSource:$,settings:_,pivotRef:j,enabled:$.data&&$.data.length>0,roomPasportization:m,localization:a,licenseKey:i,hyperlinkColumn:u})})}),O!==null?n.jsxRuntimeExports.jsx(Gc,{isOpen:C,onHide:()=>E(!1),usersData:O.users??null,setReportVersion:F,reportVersionId:O==null?void 0:O.reportVersionId,EmployeePicker:l}):null]})},Hc=({cell:{value:e}})=>n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:e?n.jsxRuntimeExports.jsx(n.AvatarIcon,{name:e,size:21,fontSize:12}):n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{})}),zc=({knownTypes:e,typeFilters:t,onChangeTypeFilters:r})=>n.jsxRuntimeExports.jsx("div",{className:"mb-1 d-flex justify-content-center gap-2",children:e.map(o=>n.jsxRuntimeExports.jsx("div",{role:"button",style:{height:"14px",width:"14px",borderRadius:"50%",border:"2px solid transparent",backgroundColor:"transparent"},className:n.classNames(`border-${o}`,t.includes(o)&&`bg-${o}`),onClick:()=>{t.includes(o)?r(t.filter(s=>s!==o)):r([...t,o])}},o))}),qc=({linksTo:e,onClick:t,children:r})=>e?n.jsxRuntimeExports.jsx(oe.Link,{to:e,className:"text-decoration-none",onClick:t,children:r}):n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:r}),Yc=({message:e,onDeleteMessage:t,onClickMessage:r,getIcon:o,getLinksTo:s})=>{const{ProjectIconComponent:a,localizationContext:i}=d.useContext(n.LuminusComponentsContext),{dateFnsLocale:l}=d.useContext(i),c=e.dateTime?n.parseISO(e.dateTime):null,p=c?hl(new Date(Date.now()),c):0;return n.jsxRuntimeExports.jsxs("div",{children:[c&&n.jsxRuntimeExports.jsx("div",{className:"d-flex justify-content-end",children:n.jsxRuntimeExports.jsx(n.SimpleTooltip,{text:n.format(c,"dd.MM.yyyy HH:mm"),placement:"left",children:n.jsxRuntimeExports.jsx("div",{children:n.jsxRuntimeExports.jsx(n.Typography,{variant:"caption",children:p>2?n.format(c,"dd.MM.yyyy"):jl(c,new Date(Date.now()),{locale:l.code})})})})}),n.jsxRuntimeExports.jsx(qc,{linksTo:s(e)??void 0,onClick:r,children:n.jsxRuntimeExports.jsx(sl,{level:e.type,noIcon:!0,children:n.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-start gap-2",children:[o(e),n.jsxRuntimeExports.jsxs("div",{className:"d-flex flex-column gap-1 w-100",children:[n.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-start justify-content-between gap-3",children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body2",className:"fw-bold",children:e.subject}),n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",onClick:u=>{u.preventDefault(),u.stopPropagation(),t(e.id)},children:n.jsxRuntimeExports.jsx(a,{icon:"delete"})})]}),n.jsxRuntimeExports.jsx(n.Typography,{variant:"body2",children:e.text})]})]})})})]})},Mo=["info","warning","danger"],Bo=({messages:e,isLoading:t,onDeleteMessage:r,onClickMessage:o,getIcon:s,getLinksTo:a})=>{const{texts:{messageBoard:i}}=d.useContext(n.LuminusComponentsContext),[l,c]=d.useState(Mo),p=d.useMemo(()=>e.filter(u=>l.includes(u.type??"")),[l,e]);return n.jsxRuntimeExports.jsxs("div",{className:"h-100 d-flex flex-column overflow-hidden",children:[n.jsxRuntimeExports.jsx(zc,{knownTypes:Mo,typeFilters:l,onChangeTypeFilters:u=>c(u)}),t&&n.jsxRuntimeExports.jsxs("div",{className:"p-3 w-100",children:[n.jsxRuntimeExports.jsx(Ke,{as:yo.Title,animation:"glow",children:n.jsxRuntimeExports.jsx(Ke,{xs:6})}),n.jsxRuntimeExports.jsxs(Ke,{as:yo.Text,animation:"glow",children:[n.jsxRuntimeExports.jsx(Ke,{xs:7})," ",n.jsxRuntimeExports.jsx(Ke,{xs:4})," ",n.jsxRuntimeExports.jsx(Ke,{xs:4})," ",n.jsxRuntimeExports.jsx(Ke,{xs:6})," ",n.jsxRuntimeExports.jsx(Ke,{xs:8})]})]}),!t&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[e.length===0&&n.jsxRuntimeExports.jsx(n.Alert,{variant:"info",size:"sm",className:"mt-2",children:i.noMessages}),n.jsxRuntimeExports.jsx("div",{className:"h-100 overflow-y-auto d-flex flex-column gap-2 luminus-thin-scrollbar",children:p.map(u=>n.jsxRuntimeExports.jsx(Yc,{message:u,onDeleteMessage:r,onClickMessage:o,getIcon:s,getLinksTo:a},u.id))})]})]})},Fn={apiGet:"/messageBoard",apiDelete:"/messageBoard/"},Kc=({renderAsNotifPanel:e,notifIcon:t,apiUrls:{apiGet:r=Fn.apiGet,apiDelete:o=Fn.apiDelete}=Fn,getIcon:s,getLinksTo:a})=>{const l=n.useAxios(),[c,p]=d.useState([]),[u,m]=d.useState(!1),[f,x]=d.useState(!1),[g,b]=d.useState(!1),v=d.useCallback(async()=>{x(!0),await l.get(r).then(({data:j})=>{p(j),m(!0),x(!1)}).catch(()=>{p([]),x(!1)})},[r,l]),h=d.useCallback(async j=>l.delete(`${o}${j}`).then(()=>!0).catch(()=>!1),[o,l]),y=d.useCallback(j=>{h(j).then(S=>{S&&p(c.filter(D=>D.id!==j))})},[h,c]);d.useEffect(()=>{v();const j=setInterval(()=>v(),60*1e3);return()=>{clearInterval(j)}},[v]);const C=c.filter(j=>j.type==="danger").length,E=u?!1:f;return e?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsxs("div",{className:"position-relative",children:[n.jsxRuntimeExports.jsx(n.IconButton,{size:"md",onClick:()=>b(!g),children:t}),C>0&&n.jsxRuntimeExports.jsx("div",{className:"badge rounded-pill bg-danger p-1 px-2 text-white",style:{position:"absolute",top:"-6px",right:"-10px",fontSize:"10px"},children:C})]}),n.jsxRuntimeExports.jsx(Co,{show:g,onHide:()=>b(!1),placement:"end",children:n.jsxRuntimeExports.jsx(Co.Body,{children:n.jsxRuntimeExports.jsx(Bo,{messages:c,isLoading:E,onDeleteMessage:y,onClickMessage:()=>b(!1),getIcon:s,getLinksTo:a})})})]}):n.jsxRuntimeExports.jsx(Bo,{messages:c,isLoading:E,onDeleteMessage:y,getIcon:s,getLinksTo:a})},Xc="_tab-panel_d8l8q_1",Qc="_full-height-no-overflow_d8l8q_5",Jc="_disabled_d8l8q_12",Vn={"tab-panel":"_tab-panel_d8l8q_1",tabPanel:Xc,"full-height-no-overflow":"_full-height-no-overflow_d8l8q_5",fullHeightNoOverflow:Qc,disabled:Jc},Ma=({eventKey:e,activeTab:t,fullHeightNoOverflow:r,disabled:o,className:s,children:a})=>e!==t?null:n.jsxRuntimeExports.jsx("div",{className:n.classNames("luminus-tab-panel",Vn.tabPanel,{[Vn.fullHeightNoOverflow]:r},{disabled:o},{[Vn.disabled]:o},s),children:a}),Zc="_join-line_1q9e8_1",eu={"join-line":"_join-line_1q9e8_1",joinLine:Zc},Tr=({activeTab:e,onSelect:t,children:r,vertical:o,verticalStepper:s})=>n.jsxRuntimeExports.jsx("div",{className:n.classNames("luminus-tabs d-flex mb-2",{"gap-1":!s},{"gap-0":s},{"flex-column":o||s}),children:r.map((a,i)=>{const l=a.type,c=a.props;if(!c)return null;const p=c.eventKey,u=c.children,m=c.className,f=c.onClick;return n.jsxRuntimeExports.jsxs(d.Fragment,{children:[n.jsxRuntimeExports.jsx(l,{...c,className:n.classNames({active:e===p},m),onClick:()=>{t(p),f&&f(p)},vertical:o||s,children:u}),s&&i<r.length-1&&n.jsxRuntimeExports.jsx("div",{className:n.classNames("join-line",eu.joinLine)})]},c.eventKey)})}),tu="_tab_1tbi7_1",nu="_disabled_1tbi7_7",ru="_vertical_1tbi7_13",$n={tab:tu,disabled:nu,vertical:ru},Pr=({eventKey:e,className:t,onClick:r,disabled:o,vertical:s,children:a})=>n.jsxRuntimeExports.jsx("div",{role:"button",className:n.classNames("luminus-tab text-primary rounded",$n.tab,t,{disabled:o},{[$n.disabled]:o},{vertical:s},{[$n.vertical]:s}),onClick:()=>r&&!o&&r(e),children:typeof a=="string"?n.jsxRuntimeExports.jsx(n.Typography,{variant:s?"body":"h6",className:s?"":"text-primary",children:a}):a}),ou=({tabs:e,activeTab:t,onSelect:r,...o})=>{var i;const{ProjectIconComponent:s}=d.useContext(n.LuminusComponentsContext),{isMobile:a}=n.useWindowSize();return a?n.jsxRuntimeExports.jsx(n.Dropdown,{toggle:n.jsxRuntimeExports.jsx(n.DropdownToggle,{as:n.SimpleDropdownToggle,text:((i=e.find(l=>l.id===t))==null?void 0:i.name)??"",icon:n.jsxRuntimeExports.jsx(s,{icon:"chevron-down"})}),...o,children:e.map(l=>n.jsxRuntimeExports.jsx(n.DropdownItem,{onClick:()=>r(l.id),children:l.name},l.id))}):n.jsxRuntimeExports.jsx(Tr,{activeTab:t,onSelect:l=>r(l),...o,children:e.map(l=>n.jsxRuntimeExports.jsx(Pr,{eventKey:l.id,children:l.name},l.id))})},su="_selection_1dtmm_1",au="_selectionBg_1dtmm_10",iu="_selectionItemsContainer_1dtmm_18",lu="_selectionItems_1dtmm_18",ln={selection:su,selectionBg:au,selectionItemsContainer:iu,selectionItems:lu},kr=({icon:e,setIcon:t,IconComponent:r,IconTypeArray:o})=>{const[s,a]=d.useState(!1),i=l=>{t(l),a(!1)};return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(n.IconButton,{className:"rounded m-1",onClick:()=>a(!0),children:n.jsxRuntimeExports.jsx(r,{icon:e})}),s&&n.jsxRuntimeExports.jsxs("div",{className:ln.selection,children:[n.jsxRuntimeExports.jsx("div",{className:ln.selectionBg,onClick:()=>a(!1)}),n.jsxRuntimeExports.jsx("div",{className:ln.selectionItemsContainer,children:n.jsxRuntimeExports.jsx("div",{className:ln.selectionItems,children:o.filter((l,c,p)=>p.indexOf(l)===c).map(l=>n.jsxRuntimeExports.jsx(n.IconButton,{className:"rounded",onClick:()=>i(l),children:n.jsxRuntimeExports.jsx(r,{icon:l})},l))})})]})]})},Ar=()=>{const e=d.useContext(n.ShortcutLinksContext);if(e===void 0)throw new Error("ShortcutLinksProvider not initilized. Probably tried to use useShortcutLinks outside ShortcutLinksProvider.");return e},cu=({shortcutLink:e,IconComponent:t,IconTypeArray:r,editShortcutLink:o})=>{const{ProjectIconComponent:s}=d.useContext(n.LuminusComponentsContext),[a,i]=d.useState(e.icon),[l,c]=d.useState(e.name);console.log(a,typeof a);const p=d.useMemo(()=>!(a===e.icon&&l===e.name),[a,l,e.icon,e.name]),u=d.useCallback(()=>{i(e.icon),c(e.name)},[e]),m=d.useCallback(()=>{o({...e,icon:a,name:l})},[o,a,l,e]);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("td",{className:"align-middle",children:n.jsxRuntimeExports.jsx(n.TextInput,{type:"text",maxLength:20,value:l,onChange:c,className:"d-flex-grow-1",InputContainer:n.NoInputContainer})}),n.jsxRuntimeExports.jsx("td",{className:"align-middle text-center",children:n.jsxRuntimeExports.jsx(kr,{icon:a,setIcon:i,IconComponent:t,IconTypeArray:r})}),n.jsxRuntimeExports.jsx("td",{className:"align-middle",style:{width:"7em"},children:p&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(n.IconButton,{onClick:u,color:"danger",className:"d-inline mx-2",children:n.jsxRuntimeExports.jsx(s,{icon:"cancel"})}),n.jsxRuntimeExports.jsx(n.IconButton,{onClick:m,color:"success",className:"d-inline mx-2",children:n.jsxRuntimeExports.jsx(s,{icon:"check"})})]})})]})},uu=({shortcutLink:e,IconComponent:t,IconTypeArray:r,editShortcutLink:o,deleteShortcutLink:s})=>{const{ProjectIconComponent:a}=d.useContext(n.LuminusComponentsContext),i=d.useCallback(()=>{s(e.id)},[s,e.id]);return n.jsxRuntimeExports.jsx("tr",{className:"mb-3",children:n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("td",{className:"align-middle",children:n.jsxRuntimeExports.jsx(n.IconButton,{onClick:i,color:"danger",children:n.jsxRuntimeExports.jsx(a,{icon:"delete"})})}),n.jsxRuntimeExports.jsx("td",{className:"align-middle",children:e.url.length<=23?e.url:n.jsxRuntimeExports.jsx(n.SimpleTooltip,{placement:"bottom",text:e.url,children:n.jsxRuntimeExports.jsxs("span",{children:[e.url.slice(0,21),"..."]})})}),n.jsxRuntimeExports.jsx(cu,{shortcutLink:e,IconComponent:t,IconTypeArray:r,editShortcutLink:o})]})})},du=({IconComponent:e,IconTypeArray:t})=>{const{texts:r}=d.useContext(n.LuminusComponentsContext),{shortcutLinks:o,editShortcutLink:s,deleteShortcutLink:a}=Ar();return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:o!==null&&o.length>0?n.jsxRuntimeExports.jsxs(Ml,{title:r.shortcutLinks.shortcutLinksSetting,children:[n.jsxRuntimeExports.jsx("thead",{className:"fw-bold",children:n.jsxRuntimeExports.jsxs("tr",{children:[n.jsxRuntimeExports.jsx("th",{}),n.jsxRuntimeExports.jsx("th",{children:r.shortcutLinks.target}),n.jsxRuntimeExports.jsx("th",{children:r.shortcutLinks.name}),n.jsxRuntimeExports.jsx("th",{children:r.shortcutLinks.icon}),n.jsxRuntimeExports.jsx("th",{})]})}),n.jsxRuntimeExports.jsx("tbody",{children:o==null?void 0:o.map(i=>n.jsxRuntimeExports.jsx(uu,{shortcutLink:i,IconComponent:e,IconTypeArray:t,editShortcutLink:s,deleteShortcutLink:a},i.id))})]}):n.jsxRuntimeExports.jsx(n.Alert,{variant:"info",children:r.shortcutLinks.addLinksToEditThemHereInfo})})},fr=5,pu="_linkButton_pnlvi_1",mu="_linkAddButton_pnlvi_31",fu="_createLinkRow_pnlvi_39",bt={linkButton:pu,linkAddButton:mu,createLinkRow:fu},xu=({shortcutLink:e,IconComponent:t})=>n.jsxRuntimeExports.jsx(n.SimpleTooltip,{text:e.name,placement:"bottom",children:n.jsxRuntimeExports.jsx(oe.Link,{to:e.url,className:bt.linkButton,children:n.jsxRuntimeExports.jsx(t,{icon:e.icon})})}),gu=({closeModal:e,isOpen:t,createLink:r,pageTitlePrefix:o,IconComponent:s,IconTypeArray:a})=>{const i=oe.useLocation(),{texts:l}=d.useContext(n.LuminusComponentsContext),[c,p]=d.useState("star-outline"),[u,m]=d.useState(o?document.title.replace(o,""):document.title),f=d.useCallback(async()=>{await r({icon:c,name:u,url:i.pathname+i.search}),e()},[e,r,c,i.pathname,i.search,u]),x=d.useMemo(()=>i.pathname+i.search,[i.pathname,i.search]);return n.jsxRuntimeExports.jsx(n.Modal,{show:t,onHide:e,size:"sm",children:n.jsxRuntimeExports.jsxs("div",{onKeyDown:g=>{g.code!=="Escape"&&g.stopPropagation()},children:[n.jsxRuntimeExports.jsx(n.Modal.Header,{closeButton:!0,children:n.jsxRuntimeExports.jsx(n.Modal.Title,{children:l.shortcutLinks.newShortcut})}),n.jsxRuntimeExports.jsxs(n.Modal.Body,{children:[n.jsxRuntimeExports.jsxs("div",{className:bt.createLinkRow,children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"form-label",className:"pe-3 text-end",children:l.shortcutLinks.target}),n.jsxRuntimeExports.jsx("div",{className:"d-flex align-items-middle fw-bold text-muted",children:x.length<=23?x:n.jsxRuntimeExports.jsx(n.SimpleTooltip,{placement:"bottom",text:x,children:n.jsxRuntimeExports.jsxs("span",{children:[x.slice(0,21),"..."]})})})]}),n.jsxRuntimeExports.jsxs("div",{className:bt.createLinkRow,children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"form-label",className:"pe-3 text-end",children:l.shortcutLinks.name}),n.jsxRuntimeExports.jsx("div",{className:"d-flex align-items-middle fw-bold",children:n.jsxRuntimeExports.jsx(n.TextInput,{type:"text",maxLength:25,value:u,onChange:m,className:"w-100",InputContainer:n.RowLabelInput,withoutLabel:!0})})]}),n.jsxRuntimeExports.jsxs("div",{className:bt.createLinkRow,children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"form-label",className:"pe-3 text-end",children:l.shortcutLinks.icon}),n.jsxRuntimeExports.jsx("div",{className:"d-flex align-items-middle fw-bold",children:n.jsxRuntimeExports.jsx(kr,{icon:c,setIcon:p,IconComponent:s,IconTypeArray:a})})]})]}),n.jsxRuntimeExports.jsx(n.Modal.Footer,{className:"d-flex justify-content-end",children:n.jsxRuntimeExports.jsx(n.PrimaryButton,{onClick:f,children:l.shortcutLinks.addShortcut})})]})})},vu=({IconComponent:e,IconTypeArray:t,pageTitlePrefix:r,createLink:o})=>{const{ProjectIconComponent:s,texts:a}=d.useContext(n.LuminusComponentsContext),[i,l]=d.useState(!1),[c]=n.a(i,100);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(n.SimpleTooltip,{text:a.shortcutLinks.addShortcut,placement:"bottom",children:n.jsxRuntimeExports.jsx("button",{type:"button",className:n.classNames(bt.linkButton,bt.linkAddButton),onClick:()=>l(!0),children:n.jsxRuntimeExports.jsx(s,{icon:"add"})})}),(i||c)&&n.jsxRuntimeExports.jsx(gu,{IconComponent:e,IconTypeArray:t,closeModal:()=>l(!1),createLink:o,isOpen:i,pageTitlePrefix:r})]})},hu=({IconComponent:e,IconTypeArray:t,pageTitlePrefix:r})=>{const{shortcutLinks:o,createShortcutLink:s}=Ar(),a=d.useMemo(()=>o!==null&&o.length<fr,[o]);return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-2",children:[o==null?void 0:o.slice(0,fr).map((i,l)=>i!==null?n.jsxRuntimeExports.jsx(xu,{shortcutLink:i,IconComponent:e},l):null),a&&n.jsxRuntimeExports.jsx(vu,{IconComponent:e,IconTypeArray:t,pageTitlePrefix:r,createLink:s})]})})},bu=e=>{const t=n.useAxios(),{startLoading:r,stopLoading:o}=d.useContext(n.LoadingContext),s=d.useCallback(async l=>{r("submit-createShortcutLink");try{await t.post(`/dynamicForms/insert?referenceId=${e}`,l)}finally{o("submit-createShortcutLink")}},[t,e,r,o]),a=d.useCallback(async l=>{r("submit-updateShortcutLink");try{await t.post(`/dynamicForms/update?referenceId=${e}`,l)}finally{o("submit-updateShortcutLink")}},[t,e,r,o]),i=d.useCallback(async l=>{r("delete-deleteShortcutLink");try{await t.delete(`/dynamicForms/delete?referenceId=${e}&pk=${l.toString()}`)}finally{o("delete-deleteShortcutLink")}},[t,e,r,o]);return{create:s,update:a,remove:i}},ju=e=>{if(e==null)throw new Error("Tried to make operation on null shortcutLinks.");return e},Lo=e=>{if(e==null)throw new Error("Tried to make operation on null shortcutLinks.");return e},Eu=({children:e,referenceId:t})=>{const{user:r}=d.useContext(n.UserContext),o=d.useCallback(x=>x.map(g=>({id:g.id,icon:g.icon,name:g.name,url:g.url})),[]),{data:s,reloadData:a}=_e.useGetApiData(`/dynamicForms/lookup-data-all?referenceId=${t}&employee=${r==null?void 0:r.personalNumber}`,{silent:!0,dataTransformer:o,enabled:r!==null}),{create:i,update:l,remove:c}=bu(t),p=d.useCallback(async x=>{const g=Lo(r);if(ju(s).length>=fr)throw new Error("Cannot add more shortcut links.");await i({...x,employee:g.personalNumber}),await a()},[i,a,s,r]),u=d.useCallback(async x=>{const g=Lo(r);await l({...x,employee:g.personalNumber}),await a()},[a,l,r]),m=d.useCallback(async x=>{await c(x),await a()},[a,c]),f=d.useMemo(()=>({shortcutLinks:s,createShortcutLink:p,editShortcutLink:u,deleteShortcutLink:m}),[p,m,u,s]);return n.jsxRuntimeExports.jsx(n.ShortcutLinksContext.Provider,{value:f,children:e})},yu=({targets:e,removeNotifTarget:t})=>{const{ProjectIconComponent:r}=d.useContext(n.LuminusComponentsContext);return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:e&&e.sort((o,s)=>(o.employeeId??0)-(s.employeeId??0)).map(o=>n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-2 align-items-center justify-content-between mb-1",children:[n.jsxRuntimeExports.jsx("div",{className:"text-secondary",children:n.jsxRuntimeExports.jsx("span",{className:"d-flex gap-2 ",children:o.employeeId&&o.roleName===null?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(r,{icon:"user"}),n.jsxRuntimeExports.jsx(n.Typography,{variant:"subtitle",children:o.employeeName})]}):n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(r,{icon:"role"}),n.jsxRuntimeExports.jsx(n.Typography,{variant:"subtitle",children:o.roleName})]})})}),n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",color:"danger",onClick:()=>t(o.id),children:n.jsxRuntimeExports.jsx(r,{icon:"delete"})})]},o.id))})},Ru=({show:e,onHide:t,roles:r,onAddTarget:o,EmployeePicker:s,templateId:a})=>{const{texts:{notifCentrum:i}}=d.useContext(n.LuminusComponentsContext),[l,c]=d.useState(null),[p,u]=d.useState(null),[m,f]=d.useState("R"),x=d.useCallback(()=>{c(null),u(null),t()},[t]);return n.jsxRuntimeExports.jsxs(n.Modal,{show:e,onHide:()=>x(),children:[n.jsxRuntimeExports.jsx(n.Modal.Header,{closeButton:!0,children:n.jsxRuntimeExports.jsx(n.Modal.Title,{children:i.addNewTarget})}),n.jsxRuntimeExports.jsxs(n.Modal.Body,{children:[n.jsxRuntimeExports.jsx(Pa,{options:[{id:"E",name:i.employee},{id:"R",name:i.role}],value:m,onChange:g=>f(g),InputContainer:n.RowLabelInput}),m==="E"?n.jsxRuntimeExports.jsx(s,{InputContainer:n.RowLabelInput,label:i.employee,value:{id:(l==null?void 0:l.id)??null,name:(l==null?void 0:l.name)??""},onSelect:g=>c({id:Number(g==null?void 0:g.id)??null,name:(g==null?void 0:g.name)??""})}):n.jsxRuntimeExports.jsx(n.CustomSelectInput,{InputContainer:n.RowLabelInput,label:i.role,options:r.map(g=>({id:g,name:g})),value:p,onChange:g=>u((g==null?void 0:g.toString())??"")})]}),n.jsxRuntimeExports.jsx(n.Modal.Footer,{className:"d-flex justify-content-end",children:n.jsxRuntimeExports.jsx(n.PrimaryButton,{onClick:()=>{o({templateId:a??0,targetId:null,employeeId:(l==null?void 0:l.id)??null,roleName:p},(l==null?void 0:l.name)??null),x()},children:i.add})})]})},Cu=({templates:e,selectedTemplateId:t,setSelectedTemplateId:r,roles:o,onAddNotifTarget:s,onRemoveNotifTarget:a,EmployeePicker:i})=>{const{texts:{notifCentrum:l},ProjectIconComponent:c}=d.useContext(n.LuminusComponentsContext),[p,u]=d.useState(!1);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(n.ListGroup,{className:"overflow-auto h-max-100 p-2",children:e.map(m=>n.jsxRuntimeExports.jsxs(n.ListGroup.Item,{action:t!==m.id,className:`p-0 mb-2 border rounded shadow-sm ${t===m.id?"border-1 border-primary":""}`,onClick:()=>r(m.id),children:[n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-2 justify-content-between align-items-center border-1 border-bottom border-primary p-2",children:[n.jsxRuntimeExports.jsx("div",{className:"text-primary",children:m.destinationId===1?n.jsxRuntimeExports.jsx(c,{icon:"mail-envelope"}):n.jsxRuntimeExports.jsx(c,{icon:"dashboard"})}),n.jsxRuntimeExports.jsx(n.Typography,{className:"text-truncate text-primary",variant:"subtitle",children:m.subjectTemplate}),n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",onClick:()=>u(!0),children:n.jsxRuntimeExports.jsx(c,{icon:"add"})})]}),n.jsxRuntimeExports.jsx("div",{className:"my-2 ps-3 pe-2",children:m.targets.length>0?n.jsxRuntimeExports.jsx(yu,{targets:m.targets,removeNotifTarget:a}):n.jsxRuntimeExports.jsx(n.Alert,{size:"sm",variant:"warning",children:l.noTargets})})]},m.id))}),n.jsxRuntimeExports.jsx(Ru,{show:p,onHide:()=>u(!1),roles:o??[],onAddTarget:s,EmployeePicker:i,templateId:t})]})},Nu=({data:e,onClick:t,BnfTableComponent:r})=>{const{texts:{notifCentrum:o}}=d.useContext(n.LuminusComponentsContext),s=d.useMemo(()=>e==null?void 0:e.map(l=>{var c;return{...l,recipientsString:((c=l.recipients)==null?void 0:c.map(p=>p.name).join(", "))??""}}),[e]),a=d.useMemo(()=>[{caption:o.date,fieldName:"date",type:"date"},{caption:o.recipients,fieldName:"recipientsString",type:"string"},{caption:o.subject,fieldName:"subject",type:"string",isVisible:!1},{caption:"Id",fieldName:"id",type:"number",isVisible:!1}],[o]),i=d.useCallback(l=>{t(l.id)},[t]);return n.jsxRuntimeExports.jsx(r,{columnsDef:a,data:s,useScrollableContainer:!0,onRowClick:i,bottomBarProps:{hidden:!0}})},wu=({kinds:e,reloadActions:t,reloadHistory:r,reloadRoles:o,onRemoveTarget:s,onPostTarget:a,EmployeePicker:i,BnfTableComponent:l})=>{var T,A;const{texts:{notifCentrum:c}}=d.useContext(n.LuminusComponentsContext),{confirm:p}=n.useConfirm(),[u,m]=d.useState(null),[f,x]=d.useState(null),[g,b]=_e.useLocalStorageState("notif-kind-id",null);d.useEffect(()=>{var R;e.length>0?b(((R=e.at(0))==null?void 0:R.id)??null):b(null)},[e,b]);const[v,h]=d.useState([]);d.useEffect(()=>{g&&t(g).then(R=>{h(R)}).catch(R=>{console.log(R),h([])})},[t,g]);const[y,C]=_e.useLocalStorageState("notif-action-id",((T=v==null?void 0:v.at(0))==null?void 0:T.id)??null),[E,j]=d.useState([]);d.useEffect(()=>{y===null||u===null||r(y,u).then(R=>{j(R)}).catch(R=>{console.log(R),j([])})},[t,r,y,g,u]);const[S,D]=d.useState([]);d.useEffect(()=>{y!==null&&o(y).then(R=>{D(R)}).catch(R=>{console.log(R),D([])})},[o,y]);const I=d.useMemo(()=>{var R;return!v||!y?[]:((R=v.find(O=>O.id===y))==null?void 0:R.templates)??[]},[v,y]),w=d.useCallback((R,O)=>{a(R,O).then(F=>{h(v?[...v.map(k=>k.id!==y?k:{...k,templates:[...k.templates.map(M=>M.id!==u?M:{...M,targets:[...M.targets,F]})]})]:[])}).catch(F=>console.log(F))},[v,a,y,u,h]),_=d.useCallback(async R=>{await p(c.confirmTargetDelete)&&s(R).then(()=>h(v?[...v.map(O=>O.id!==y?O:{...O,templates:[...O.templates.map(F=>F.id!==u?F:{...F,targets:F.targets.filter(k=>k.id!==R)})]})]:[]))},[v,p,c,s,y,u]);return n.jsxRuntimeExports.jsxs("div",{className:"h-100 overflow-hidden",children:[n.jsxRuntimeExports.jsxs("div",{className:"row mb-2",children:[n.jsxRuntimeExports.jsx("div",{className:"col-2",children:n.jsxRuntimeExports.jsx(n.CustomSelectInput,{label:c.kind,size:"sm",noEmptyOption:!0,options:(e==null?void 0:e.map(R=>({id:R.id,name:R.name})))??[],value:g??null,onChange:R=>b(Number(R)),dropdownWidth:200})}),n.jsxRuntimeExports.jsx("div",{className:"col-3",children:n.jsxRuntimeExports.jsx(n.CustomSelectInput,{label:c.subkind,size:"sm",noEmptyOption:!0,options:(v==null?void 0:v.map(R=>({id:R.id,name:R.name})))??[],value:y??null,onChange:R=>C(Number(R)),dropdownWidth:250})})]}),n.jsxRuntimeExports.jsxs("div",{className:"vh-100 overflow-hidden d-flex gap-1",children:[n.jsxRuntimeExports.jsx("div",{className:"h-75 w-25 overflow-hidden",children:n.jsxRuntimeExports.jsx(Cu,{templates:I,roles:S??[],onAddNotifTarget:w,onRemoveNotifTarget:_,selectedTemplateId:u,setSelectedTemplateId:R=>{m(R),x(null)},EmployeePicker:i})}),n.jsxRuntimeExports.jsx("div",{className:"w-25 h-75 overflow-hidden",children:u&&n.jsxRuntimeExports.jsx(Nu,{data:E??[],onClick:R=>x((E==null?void 0:E.find(O=>O.id===R))??null),BnfTableComponent:l})}),u&&n.jsxRuntimeExports.jsx("div",{className:"h-75 w-75 overflow-hidden bg-darker",children:n.jsxRuntimeExports.jsx("iframe",{title:"notification",className:"w-100 h-100",srcDoc:(f==null?void 0:f.message)??((A=I.find(R=>R.id===u))==null?void 0:A.textTemplate)})})]})]})},Su=({history:e,onClick:t,BnfTableComponent:r})=>{const{texts:{notifCentrum:o}}=d.useContext(n.LuminusComponentsContext),s=d.useMemo(()=>[{caption:"notificationHistory.id",fieldName:"id",type:"number",isVisible:!1},{caption:"notificationHistory.recipientId",fieldName:"recipientId",type:"number",isVisible:!1},{caption:"notificationHistory.recipientFullName",fieldName:"recipientFullName",type:"string",isVisible:!1},{caption:"notificationHistory.actionKindId",fieldName:"actionKindId",type:"number",isVisible:!1},{caption:o.subkind,fieldName:"actionKindName",type:"string",filterType:"select"},{caption:"notificationHistory.actionId",fieldName:"actionId",type:"number",isVisible:!1},{caption:o.subkind,fieldName:"actionName",type:"string",filterType:"select"},{caption:o.date,fieldName:"date",type:"string"},{caption:o.subject,fieldName:"subject",type:"string"},{caption:"notificationHistory.message",fieldName:"message",type:"string",isVisible:!1}],[o]),a=d.useCallback(i=>{t(i.id)},[t]);return n.jsxRuntimeExports.jsx(r,{columnsDef:s,data:e,useScrollableContainer:!0,paginationMode:"enabled",bottomBarProps:{hideFullScreen:!0},onRowClick:a})},Du=({reloadUserHistory:e,EmployeePicker:t,BnfTableComponent:r})=>{const{texts:{notifCentrum:o}}=d.useContext(n.LuminusComponentsContext),[s,a]=d.useState(null),[i,l]=_e.useLocalStorageState("notif-user",null),[c,p]=d.useState([]);return d.useEffect(()=>{i!==null&&e(i.id).then(u=>{p(u)}).catch(u=>{console.log(u),p([])})},[i,e]),n.jsxRuntimeExports.jsxs("div",{className:"h-100 overflow-hidden d-flex flex-column gap-1",children:[n.jsxRuntimeExports.jsx("div",{className:"row",children:n.jsxRuntimeExports.jsx("div",{className:"col-3",children:n.jsxRuntimeExports.jsx(t,{label:o.employee,value:i,size:"sm",onSelect:u=>l(u?{id:Number(u.id),name:u.name}:null)})})}),n.jsxRuntimeExports.jsxs("div",{className:"vh-100 overflow hidden row",children:[n.jsxRuntimeExports.jsx("div",{className:"col-5 h-75 overflow-hidden",children:n.jsxRuntimeExports.jsx(Su,{history:c??[],onClick:u=>a((c==null?void 0:c.find(m=>m.id===u))??null),BnfTableComponent:r})}),s&&n.jsxRuntimeExports.jsx("div",{className:"col bg-darker h-75",children:n.jsxRuntimeExports.jsx("iframe",{title:"notification",className:"w-100 h-100",srcDoc:s==null?void 0:s.message})})]})]})},Ba=({result:e,onClose:t,tableIdentifier:r,BnfTableComponent:o})=>{var l,c,p,u,m;const{texts:{imports:s},ProjectIconComponent:a}=d.useContext(n.LuminusComponentsContext),i=d.useMemo(()=>[{fieldName:"row",caption:s.row,type:"number",width:100},{fieldName:"column",caption:s.column,type:"number",width:100},{fieldName:"error",caption:s.error,type:"string",width:500}],[s.row,s.column,s.error]);return e?n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:n.jsxRuntimeExports.jsx(n.Alert,{variant:e.success?"success":"danger",size:"sm",className:"mb-2 p-2",children:n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-3 align-items-start",children:[n.jsxRuntimeExports.jsxs("div",{className:"w-100",children:[n.jsxRuntimeExports.jsx("div",{className:"w-100 text-center",children:e.success?s.importSuccess:s.importFailed}),e.success&&((l=e.data)!=null&&l.added||(c=e.data)!=null&&c.updated||(p=e.data)!=null&&p.deleted)?n.jsxRuntimeExports.jsx("div",{className:"d-flex justify-content-center mt-2",children:n.jsxRuntimeExports.jsxs("div",{className:"list-group",children:[e.data.added?n.jsxRuntimeExports.jsx("div",{className:"list-group-item p-1 px-3",children:n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body2",className:"d-flex gap-2 align-items-center",children:[s.importAdded(e.data.added)," "]})}):null,e.data.updated?n.jsxRuntimeExports.jsx("div",{className:"list-group-item p-1 px-3",children:n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body2",className:"d-flex gap-2 align-items-center",children:[s.importUpdated(e.data.updated)," "]})}):null,e.data.deleted?n.jsxRuntimeExports.jsx("div",{className:"list-group-item p-1 px-3",children:n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body2",className:"d-flex gap-2 align-items-center",children:[s.importDeleted(e.data.deleted)," "]})}):null]})}):null,!e.success&&((m=(u=e.data)==null?void 0:u.errors)==null?void 0:m.length)>0?n.jsxRuntimeExports.jsx("div",{className:"mt-3",children:n.jsxRuntimeExports.jsx(o,{columnsDef:i,data:e.data.errors,useScrollableContainer:!0,tableId:r})}):null]}),t!==void 0?n.jsxRuntimeExports.jsx(n.IconButton,{color:e.success?"success":"danger",className:n.classNames("hover-darken",e.success?"bg-success-subtle":"bg-danger-subtle"),onClick:t,children:n.jsxRuntimeExports.jsx(a,{icon:"close"})}):null]})})}):null},Iu="_upload-box_9ka79_1",_u="_browse-btn_9ka79_15",Gn={"upload-box":"_upload-box_9ka79_1",uploadBox:Iu,"browse-btn":"_browse-btn_9ka79_15",browseBtn:_u},La=({file:e,onFileChange:t,onImport:r,children:o,multiple:s,accept:a})=>{const{ProjectIconComponent:i,texts:{imports:l}}=d.useContext(n.LuminusComponentsContext),c=d.useCallback(async u=>{u.length>0&&t(s===!0?[...u]:u[0])},[e,s,t]),p=d.useCallback(u=>{var f;u.preventDefault();const m=(f=u.dataTransfer)==null?void 0:f.files;m&&(m==null?void 0:m.length)>0&&c(m)},[c]);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[e!==null?n.jsxRuntimeExports.jsxs("div",{className:"d-flex border rounded p-1 ps-2 bg-white justify-content-between align-items-center mb-2",children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",children:s?e.map(u=>u.name).join(", "):e.name}),n.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-center gap-3",children:[o??null,n.jsxRuntimeExports.jsx(n.PrimaryButton,{className:"text-nowrap",size:"sm",disabled:e===null,onClick:r,children:l.start})]})]}):null,n.jsxRuntimeExports.jsxs("div",{className:n.classNames(Gn.uploadBox,{[Gn.active]:e!==null}),onDrop:p,onDragOver:u=>u.preventDefault(),children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",children:l.dropHint}),n.jsxRuntimeExports.jsx("input",{type:"file",hidden:!0,id:"browse",onChange:u=>{var m;return((m=u.target)==null?void 0:m.files)&&c(u.target.files)},multiple:s,accept:a}),n.jsxRuntimeExports.jsx("label",{htmlFor:"browse",className:Gn.browseBtn,children:n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body",className:"d-flex gap-2 align-items-center",children:[n.jsxRuntimeExports.jsx(i,{icon:"file-upload"}),l.pickFileHint]})})]})]})},Ou=({otherSettingId:e,languageOptions:t,tableIdentifier:r,SettingsOutlet:o,BnfTableComponent:s,importLocalization:a})=>{const{texts:{localizations:i}}=d.useContext(n.LuminusComponentsContext),[l,c]=d.useState(t[0].id),[p,u]=d.useState(null),[m,f]=d.useState(null),x=d.useCallback(async()=>{if(p===null)return;const g=await a({file:p,lang:l});g.status==="success"&&f(g.data)},[a,l,p]);return n.jsxRuntimeExports.jsx(o,{itemId:e,title:i.localizationImport,children:m?n.jsxRuntimeExports.jsx(Ba,{result:m,onClose:()=>f(null),BnfTableComponent:s,tableIdentifier:r}):n.jsxRuntimeExports.jsx(La,{file:p,onFileChange:u,onImport:x,children:n.jsxRuntimeExports.jsx("div",{style:{minWidth:140},children:n.jsxRuntimeExports.jsx(n.CustomSelectInput,{value:l,onChange:g=>typeof g=="string"?c(g):null,options:t,label:i.importedLanguage})})})})},Tu=(e,t)=>{const r=t.split(".");let o=e;for(let s=0;s<r.length;s++){const a=r[s],i=o[a];if(typeof i=="string")return i;if(i===void 0)return;o=i}},Pu=({selLng:e,lngsData:t,localizationKey:r,reloadData:o,saveChanges:s})=>{const{ProjectIconComponent:a}=d.useContext(n.LuminusComponentsContext),i=d.useMemo(()=>{const m=t.get(e);if(m===void 0)return"";const f=Tu(m,r);return m!==void 0&&f!==void 0?f:""},[t,r,e]),[l,c]=d.useState(i),p=d.useCallback(async()=>{await s([{fileName:e+".json",items:[{key:r,value:l}]}]),await o()},[r,o,s,e,l]),u=d.useMemo(()=>l!==i,[i,l]);return n.jsxRuntimeExports.jsxs("div",{className:"d-flex",children:[n.jsxRuntimeExports.jsx(n.TextInput,{label:e+r,type:"text",value:l,onChange:m=>{c(typeof m!="string"?"":m)},InputContainer:n.RowLabelInput,withoutLabel:!0,className:"flex-grow-1"}),u?n.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-center gap-1",children:[n.jsxRuntimeExports.jsx(n.IconButton,{color:"danger",onClick:()=>c(i),children:n.jsxRuntimeExports.jsx(a,{icon:"cancel"})}),n.jsxRuntimeExports.jsx(n.IconButton,{onClick:p,children:n.jsxRuntimeExports.jsx(a,{icon:"check"})})]}):null]})},ku="_keysTable_1j6ns_1",Au="_subgrid_1j6ns_14",Mu="_lngSelectRow_1j6ns_19",Bu="_tableItem_1j6ns_26",Lu="_tableFooter_1j6ns_29",Fu="_tableFullWidth_1j6ns_35",Vu="_tableBody_1j6ns_39",$u="_lngSelect_1j6ns_19",Gu="_addLng_1j6ns_52",Wu="_fileSelect_1j6ns_57",Uu="_searchBox_1j6ns_61",Ce={keysTable:ku,subgrid:Au,lngSelectRow:Mu,tableItem:Bu,tableFooter:Lu,tableFullWidth:Fu,tableBody:Vu,lngSelect:$u,addLng:Gu,fileSelect:Wu,searchBox:Uu},cn=50,Hu=(e,t)=>{const r=t.split(".");let o=e;for(let s=0;s<r.length;s++){const a=r[s],i=o[a];if(typeof i=="string")return i;if(i===void 0)return;o=i}},zu=({languageOptions:e,envMode:t,getOtherSettingsUrl:r,downloadXls:o,saveChanges:s,localizationFilesOptions:a,remoteLocalesRoot:i})=>{const{texts:{localizations:l},ProjectIconComponent:c}=d.useContext(n.LuminusComponentsContext),[p,u]=d.useState(1),[m,f]=d.useState(new Map),[x,g]=d.useState(null),[b,v]=d.useState(""),[h,y]=d.useState(new Set),C=d.useCallback(R=>{f(new Map),y(R)},[]),E=d.useMemo(()=>e.filter(R=>!h.has(R.id)),[h,e]),j=d.useMemo(()=>{if(m.size===0)return[];const R=new Set,O=(L,$="")=>{if(typeof L[1]=="object"){Object.entries(L[1]).forEach(U=>O(U,$+L[0]+"."));return}R.add($+L[0])};Array.from(m).forEach(L=>{Object.entries(L[1]).forEach($=>O($))});const F=Array.from(R),k=a.find(L=>L.path===x);return((k==null?void 0:k.type)==="report"?F.filter(L=>{const $=L.split(".");return $[$.length-1]==="caption"}):F).map(L=>({key:L,lngData:new Map(Array.from(h).map($=>{const U=m.get($);return[$,(U===void 0?void 0:Hu(U,L))??""]}))}))},[m,a,x,h]),S=d.useMemo(()=>j.filter(R=>n.stringSearchWithin(R.key,b)||Array.from(R.lngData).some(O=>typeof(O==null?void 0:O[1])!="string"?!1:n.stringSearchWithin((O==null?void 0:O[1])??"",b))),[b,j]),D=d.useMemo(()=>Math.ceil(S.length/cn),[S.length]),I=d.useCallback(R=>{R!==null&&u(()=>Math.max(1,Math.min(R,D)))},[D]),w=d.useCallback(async()=>{const R=Array.from(h).map(F=>(async()=>{const k=await n.axios.get(`${i}${x==null?void 0:x.replace("{{lng}}",F)}?v=${new Date().getTime()}`,{responseType:"json"});return[F,k.data]})()),O=await Promise.allSettled(R);f(new Map(O.map(F=>F.status==="fulfilled"?F.value:["",{}])))},[i,x,h]),_=d.useCallback(async()=>{w()},[w]),T=d.useMemo(()=>E.length>0,[E.length]),A=d.useMemo(()=>h.size+1+(T?1:0),[T,h.size]);return d.useEffect(()=>{I(p)},[I,p,S]),d.useEffect(()=>{w()},[w]),i===void 0?n.jsxRuntimeExports.jsx(n.PageContainer,{children:n.jsxRuntimeExports.jsxs(n.Alert,{variant:"danger",className:"fw-bold",children:[l.cantRunLocalizationSettings,n.jsxRuntimeExports.jsx("br",{}),n.jsxRuntimeExports.jsx("br",{}),l.envNotConnectedToRemote(t.toUpperCase())]})}):n.jsxRuntimeExports.jsx(n.PageContainer,{title:n.jsxRuntimeExports.jsx("div",{className:"d-flex gap-4",children:n.jsxRuntimeExports.jsx(n.Typography,{variant:"h3",children:l.localizationSettings})}),helmet:l.localizationSettings,variant:"fullScreen",children:n.jsxRuntimeExports.jsxs("div",{className:Ce.keysTable,style:{"--keys-table-columns":A,"--adding-column":T?1:0},children:[n.jsxRuntimeExports.jsxs("div",{className:n.classNames(Ce.tableFullWidth,"d-flex align-items-center justify-content-between gap-2 px-2 mt-1"),children:[n.jsxRuntimeExports.jsx(n.CustomSelectInput,{options:a.map(R=>({id:R.path,name:R.nameTranslationKey})),value:x,onChange:R=>typeof R!="number"?g(R):null,size:"sm",label:l.localizationFile,className:Ce.fileSelect,noSortOptions:!0}),n.jsxRuntimeExports.jsxs("div",{className:n.classNames(Ce.searchBox,"d-flex align-items-center gap-2 border rounded"),children:[n.jsxRuntimeExports.jsx(c,{icon:"search",className:"text-muted",size:18,iconProps:{className:"mt- me-n4"}}),n.jsxRuntimeExports.jsx(n.TextInput,{type:"text",value:b,onChange:R=>v(typeof R=="string"?R:""),size:"sm",showClearIcon:b!=="",withoutLabel:!0,placeholder:"vyhledávat...",className:"placeholder-muted bg-transparent border-0 my-0 py-0 w-100"})]}),n.jsxRuntimeExports.jsxs(n.ResponsiveContextDropdown,{children:[n.jsxRuntimeExports.jsx(n.ResponsiveContextDropdownItem,{cKey:"export",hideOn:"always",onClick:o,icon:n.jsxRuntimeExports.jsx(n.FileExtensionIcon,{fileExtension:"xls"}),children:l.xlsExport}),n.jsxRuntimeExports.jsx(n.ResponsiveContextDropdownItem,{cKey:"import",hideOn:"always",to:r("localizationImport"),icon:n.jsxRuntimeExports.jsx(c,{icon:"link"}),children:l.import})]})]}),n.jsxRuntimeExports.jsxs("div",{className:n.classNames(Ce.subgrid,Ce.lngSelectRow),children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",children:l.key}),Array.from(h).map((R,O)=>n.jsxRuntimeExports.jsx(n.CustomSelectInput,{options:e.filter(F=>F.id===R||!h.has(F.id)),value:R,onChange:F=>C(k=>F===null?(k.delete(R),new Set(k)):(typeof F=="string"&&(k.delete(R),k.add(F)),new Set(k))),size:"sm",label:`${l.language} ${O+1}`,withoutLabel:!0,InputContainer:n.RowLabelInput,className:n.classNames(Ce.lngSelect)},R)),T?n.jsxRuntimeExports.jsx(n.CustomSelectInput,{options:E,value:null,onChange:R=>C(O=>(typeof R=="string"&&O.add(R),new Set(O))),size:"sm",label:l.addLanguage,InputContainer:n.RowLabelInput,className:n.classNames(Ce.lngSelect,Ce.addLng)}):null]}),n.jsxRuntimeExports.jsxs("div",{className:n.classNames(Ce.subgrid,Ce.tableBody),children:[j.length===0||S.length===0?n.jsxRuntimeExports.jsx(n.Alert,{variant:"warning",className:n.classNames(Ce.tableFullWidth,Ce.emptyTableAlert,"my-n1"),children:j.length===0?l.noDataLoaded:S.length===0?l.noDataFiltered:null}):null,S.slice(cn*(p-1),cn*p).map(R=>n.jsxRuntimeExports.jsxs("div",{className:n.classNames(Ce.subgrid,Ce.tableItem),children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"form-label",children:R.key}),Array.from(h).map(O=>n.jsxRuntimeExports.jsx(Pu,{localizationKey:R.key,lngsData:m,selLng:O,reloadData:_,saveChanges:s},O))]},R.key))]}),n.jsxRuntimeExports.jsxs("div",{className:n.classNames("d-flex align-items-center justify-content-around gap-3 px-2 py-0",Ce.tableFooter),children:[n.jsxRuntimeExports.jsx("div",{children:n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body",children:[l.keyCount,":"," ",n.jsxRuntimeExports.jsx("span",{className:"fw-bold",children:S.length})]})}),n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-1 align-items-center",children:[n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body",children:[l.page,": "]}),n.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-center gap-1",children:[n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",onClick:()=>I(p-1),children:n.jsxRuntimeExports.jsx(c,{icon:"minus"})}),n.jsxRuntimeExports.jsx("div",{style:{width:30},children:n.jsxRuntimeExports.jsx(Ta,{value:p,onChange:I,InputContainer:n.RowLabelInput,withoutLabel:!0,size:"sm"})}),n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body",children:["/",Math.ceil(S.length/cn)]}),n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",onClick:()=>I(p+1),children:n.jsxRuntimeExports.jsx(c,{icon:"plus"})})]})]})]})]})})},Fo=3,Fa=(e,t,r)=>{var s;if((t==null?void 0:t.customPathBuilder)!==void 0)return t.customPathBuilder(e,t);const o=(s=r.find(a=>a.key===e.type))==null?void 0:s.toPath;return o?`${o}/${e.searchKey}`:"/not-found"},Va=(e,t)=>{var r;return((r=t==null?void 0:t.customNameBuilder)==null?void 0:r.call(t,e))??e.name},$a=(e,t,r,o,s)=>{const a=n.useAxios(),[i,l]=d.useState(!1),[c,p]=d.useState([]),u=e==="",m=d.useCallback(()=>{p([]),!(t.length<Fo)&&(l(!0),a.get(Qe.generateApiPath(r,{path:{query:t},query:{type:u?void 0:e,count:o?void 0:u?5:20}})).then(({data:g})=>{p(g),l(!1)}).catch(()=>{l(!1)}))},[a,o,u,t,r,e]),f=d.useMemo(()=>{if(s===void 0)return[];if(t.length<Fo&&e!=="XAP")return[];const g=[];return s.forEach(b=>{const v=b.items.filter(h=>n.stringSearchWithin(h.name,decodeURIComponent(t)));v.length>0&&g.push({key:{...b.key,totalCount:v.length},items:v})}),g},[t,s,e]),x=d.useMemo(()=>f.concat(c),[c,f]);return d.useEffect(()=>{m()},[m]),{isLoading:i,searchItems:x}},qu="_input-group_1hcpm_1",Yu="_input-group-text_1hcpm_5",Ku="_left_1hcpm_9",Xu="_right_1hcpm_13",Qu="_input_1hcpm_1",Ju="_submit-button_1hcpm_20",rt={"input-group":"_input-group_1hcpm_1",inputGroup:qu,"input-group-text":"_input-group-text_1hcpm_5",inputGroupText:Yu,left:Ku,right:Xu,input:Qu,"submit-button":"_submit-button_1hcpm_20",submitButton:Ju},Zu=({searchTypes:e,selectedType:t,setSelectedType:r})=>n.jsxRuntimeExports.jsx(n.Dropdown,{toggle:n.jsxRuntimeExports.jsx(n.DropdownToggle,{as:n.SimpleDropdownToggle,icon:null,text:t==null?void 0:t.text}),children:e.map(o=>n.jsxRuntimeExports.jsx(n.DropdownItem,{icon:null,onClick:()=>r(o.key),children:o.text},o.key))}),ed="_dropdown_1ddrg_1",td="_open_1ddrg_12",nd="_loading-container_1ddrg_15",rd="_groups-container_1ddrg_22",od="_group_1ddrg_22",sd="_header_1ddrg_26",ad="_item_1ddrg_33",lt={dropdown:ed,open:td,"loading-container":"_loading-container_1ddrg_15",loadingContainer:nd,"groups-container":"_groups-container_1ddrg_22",groupsContainer:rd,group:od,header:sd,item:ad},id=({item:e,searchTypes:t,onCancel:r})=>{const o=d.useMemo(()=>t.find(i=>i.key===e.type),[e.type,t]),s=d.useMemo(()=>Fa(e,o,t),[e,o,t]),a=d.useMemo(()=>Va(e,o),[e,o]);return n.jsxRuntimeExports.jsxs(oe.Link,{to:s,className:n.classNames("search-item d-flex gap-3 align-items-center justify-content-between",lt.item),onClick:r,children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body2",className:"text-nowrap text-truncate",children:a}),n.jsxRuntimeExports.jsx(n.Typography,{variant:"caption",className:"text-primary",children:n.jsxRuntimeExports.jsx(n.MdOutlineArrowOutward,{})})]})},ld=({show:e,query:t,onCancel:r,groups:o,isLoading:s,searchTypes:a})=>{const{texts:{appSearch:i}}=d.useContext(n.LuminusComponentsContext),l=d.useRef(null);return n.useClickOutside([l],r),n.jsxRuntimeExports.jsx("div",{ref:l,className:n.classNames("luminus-app-search-dropdown shadow rounded",lt.dropdown,{[lt.open]:e}),children:s?n.jsxRuntimeExports.jsx("div",{className:lt.loadingContainer,children:n.jsxRuntimeExports.jsx(n.Spinner,{animation:"border",variant:"primary"})}):n.jsxRuntimeExports.jsx("div",{className:lt.groupsContainer,children:o==null?void 0:o.map(c=>{var p;return n.jsxRuntimeExports.jsxs("div",{className:n.classNames(lt.group),children:[n.jsxRuntimeExports.jsxs(oe.Link,{to:`/search?query=${t}&type=${c.key.category}`,className:n.classNames("group-header",lt.header),onClick:r,children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",className:"text-primary",children:c.key.categoryName}),n.jsxRuntimeExports.jsxs(n.Typography,{variant:"caption",children:[c.items.length," ",i.amountFrom," ",c.key.totalCount]})]}),(p=c.items)==null?void 0:p.map((u,m)=>n.jsxRuntimeExports.jsx(id,{item:u,onCancel:r,searchTypes:a},m))]},c.key.category)})})})},cd=({searchTypes:e,navigateFunction:t,currentPath:r,homePath:o="/",className:s,staticAppItems:a,searchEndpointUri:i})=>{var E;const{texts:{appSearch:l}}=d.useContext(n.LuminusComponentsContext),[c,p]=d.useState(e.length>0?((E=e.at(0))==null?void 0:E.key)??null:null),u=d.useMemo(()=>e.find(j=>j.key===c)??null,[e,c]),[m,f]=d.useState(""),[x,g]=n.a(encodeURIComponent(m),500),{isLoading:b,searchItems:v}=$a(c,x,i,!1,a),[h,y]=d.useState(!1);d.useEffect(()=>{(v.length>0||b)&&y(!0)},[v,b]);const C=d.useRef(null);return d.useEffect(()=>{var j;f(""),r===o&&((j=C.current)==null||j.focus())},[r,o]),n.jsxRuntimeExports.jsx(n.Form,{className:"w-100 d-flex align-items-center justify-content-center",onSubmit:j=>{j.preventDefault(),j.stopPropagation(),g.flush(),y(!1),x.length>2&&t(`/search?query=${x}${u&&u.key&&`&type=${u==null?void 0:u.key}`}`)},children:n.jsxRuntimeExports.jsxs(gn,{className:n.classNames(rt.inputGroup,s),children:[n.jsxRuntimeExports.jsx(gn.Text,{className:n.classNames("p-1 rounded",rt.inputGroupText,rt.left),children:n.jsxRuntimeExports.jsx(Zu,{searchTypes:e,selectedType:u,setSelectedType:p})}),n.jsxRuntimeExports.jsx(n.Form.Control,{ref:C,placeholder:l.searchPlaceholder,type:"text",size:"sm",className:n.classNames("luminus-app-search-input",rt.input),value:m,onChange:j=>{var S;return f(((S=j.target)==null?void 0:S.value)??"")},onFocus:()=>v.length>0&&y(!0)}),n.jsxRuntimeExports.jsx(gn.Text,{className:n.classNames("p-0 rounded",rt.inputGroupText,rt.right),children:n.jsxRuntimeExports.jsx("button",{type:"submit",className:n.classNames("text-primary",rt.submitButton),children:n.jsxRuntimeExports.jsx(n.FaSearch,{})})}),n.jsxRuntimeExports.jsx(ld,{query:x,searchTypes:e,show:h,onCancel:()=>y(!1),groups:v,isLoading:b})]})})},ud=({item:e,searchTypes:t})=>{const{ProjectIconComponent:r}=d.useContext(n.LuminusComponentsContext),o=d.useMemo(()=>t.find(i=>i.key===e.type),[e.type,t]),s=d.useMemo(()=>Fa(e,o,t),[e,o,t]),a=d.useMemo(()=>Va(e,o),[e,o]);return n.jsxRuntimeExports.jsxs(oe.Link,{to:s,className:"text-nowrap list-group-item list-group-item-action d-flex justify-content-between align-items-center",children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",children:a}),n.jsxRuntimeExports.jsx(r,{icon:"chevron-right",className:"text-primary"})]})},dd=({query:e,type:t,appSearchTypes:r,searchEndpointUri:o,staticAppItems:s})=>{var u,m;const{texts:{appSearch:a}}=d.useContext(n.LuminusComponentsContext),[i,l]=d.useState(""),{searchItems:c,isLoading:p}=$a(t,e,o,!0,s);return d.useEffect(()=>{var f;i||c===null||c.length===0||l(((f=c[0].key)==null?void 0:f.category)??"")},[c,i]),c===null?null:n.jsxRuntimeExports.jsx(n.PageContainer,{variant:"fullScreen",children:p?n.jsxRuntimeExports.jsx(we.Loading,{}):c.length===0?n.jsxRuntimeExports.jsx("div",{className:"alert alert-warning",children:n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",children:a.noResultsFor(e)})}):n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(Tr,{activeTab:i,onSelect:f=>l((f==null?void 0:f.toString())??""),children:c.map(f=>{var x,g;return n.jsxRuntimeExports.jsx(Pr,{eventKey:((x=f.key)==null?void 0:x.category)??"",children:((g=f.key)==null?void 0:g.categoryName)??""},f.key.category)})}),n.jsxRuntimeExports.jsx(Ma,{eventKey:i,activeTab:i,fullHeightNoOverflow:!0,children:n.jsxRuntimeExports.jsx("div",{className:"list-group h-100 overflow-auto",children:(m=(u=c.find(f=>f.key.category===i))==null?void 0:u.items)==null?void 0:m.map((f,x)=>n.jsxRuntimeExports.jsx(ud,{item:f,searchTypes:r},x))})})]})})},pd="_widgets-row_13gg1_1",md="_widget_13gg1_1",fd="_widget-img_13gg1_5",xd="_widget-title-spacer_13gg1_14",gd="_widget-title_13gg1_14",vd="_title_13gg1_28",Me={"widgets-row":"_widgets-row_13gg1_1",widgetsRow:pd,widget:md,"widget-img":"_widget-img_13gg1_5",widgetImg:fd,"widget-title-spacer":"_widget-title-spacer_13gg1_14",widgetTitleSpacer:xd,"widget-title":"_widget-title_13gg1_14",widgetTitle:gd,title:vd},hd=({show:e,widgetGroups:t,widgets:r,handleClose:o,onWidgetPicked:s,texts:a})=>{const[i,l]=d.useState(""),c=d.useMemo(()=>r.filter(u=>u.id!==-1&&n.stringSearchWithin(u.name,i)),[r,i]),p=d.useMemo(()=>t.filter(u=>c.some(m=>m.group===u.id)),[t,c]);return n.jsxRuntimeExports.jsxs(n.Modal,{show:e,onHide:()=>o(),size:"lg",children:[n.jsxRuntimeExports.jsxs(n.Modal.Header,{closeButton:!0,children:[n.jsxRuntimeExports.jsx(n.Modal.Title,{className:"w-100",children:a.pickWidgetToAdd}),n.jsxRuntimeExports.jsx(n.Form.Control,{type:"search",size:"sm",value:i,placeholder:a.searchPlaceholder,onChange:u=>{var m;return l(((m=u.target)==null?void 0:m.value)??"")},className:"me-3",style:{maxWidth:"200px"}})]}),n.jsxRuntimeExports.jsx(n.Modal.Body,{className:"flex-column gap-3",children:c.length===0?n.jsxRuntimeExports.jsx(n.Alert,{variant:"warning",children:a.noWidgets}):n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[p.map(u=>n.jsxRuntimeExports.jsx(Wt,{defaultOpen:!0,title:u.name??"",children:n.jsxRuntimeExports.jsx("div",{className:"p-1",children:n.jsxRuntimeExports.jsx("div",{className:n.classNames("row gx-3 gy-3",Me.widgetsRow),children:c.filter(m=>m.group===u.id).map(m=>n.jsxRuntimeExports.jsx("div",{className:"col col-4",children:n.jsxRuntimeExports.jsxs("div",{role:"button",className:n.classNames("p-0 pt-2 bg-white rounded shadow-sm",Me.widget),onClick:()=>s(m.id),children:[n.jsxRuntimeExports.jsx("div",{className:Me.widgetImg,style:{backgroundImage:m.img?`url(${m.img})`:void 0}}),n.jsxRuntimeExports.jsx("div",{className:Me.widgetTitleSpacer}),n.jsxRuntimeExports.jsx("div",{className:n.classNames(Me.widgetTitle,"rounded"),children:n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",className:n.classNames(Me.title,"text-white text-truncate"),children:m.name})})]},m.id)}))})})},u.id)),c.some(u=>u.group===void 0)&&n.jsxRuntimeExports.jsx(Wt,{defaultOpen:!0,title:a.otherWidgets,children:n.jsxRuntimeExports.jsx("div",{className:"p-1",children:n.jsxRuntimeExports.jsx("div",{className:n.classNames("row gx-3 gy-3",Me.widgetsRow),children:c.filter(u=>u.group===void 0).map(u=>n.jsxRuntimeExports.jsx("div",{className:"col col-4",children:n.jsxRuntimeExports.jsxs("div",{role:"button",className:n.classNames("p-0 pt-2 bg-white rounded shadow-sm",Me.widget),onClick:()=>s(u.id),children:[n.jsxRuntimeExports.jsx("div",{className:Me.widgetImg,style:{backgroundImage:u.img?`url(${u.img})`:void 0}}),n.jsxRuntimeExports.jsx("div",{className:Me.widgetTitleSpacer}),n.jsxRuntimeExports.jsx("div",{className:n.classNames(Me.widgetTitle,"rounded"),children:n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",className:n.classNames(Me.title,"text-white text-truncate"),children:u.name})})]},u.id)}))})})})]})})]})},bd="_widget_19xgl_1",jd="_mobile_19xgl_7",Vo={widget:bd,mobile:jd},$o=({widgetGroups:e,availableWidgets:t,onAdd:r,texts:o})=>{const[s,a]=d.useState(!1),{isMobile:i}=n.useWindowSize();return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("div",{className:n.classNames("luminus-empty-widget",Vo.widget,{[Vo.mobile]:i}),children:n.jsxRuntimeExports.jsx(n.IconButton,{onClick:()=>a(!0),children:n.jsxRuntimeExports.jsx(n.MdOutlineAddCircleOutline,{})})}),n.jsxRuntimeExports.jsx(hd,{show:s,widgetGroups:e,widgets:t,handleClose:()=>a(!1),onWidgetPicked:l=>{a(!1),r(l)},texts:o})]})},Ed="_dashboard_1gf59_1",yd="_widgets-grid_1gf59_1",Rd="_widget-wrapper_1gf59_8",Cd="_full-width_1gf59_13",Nd="_widget-edit_1gf59_16",wd="_remove-icon_1gf59_19",Sd="_full-width-icon_1gf59_26",Dd="_widget-edit-overlay_1gf59_36",Id="_mobile_1gf59_45",He={dashboard:Ed,"widgets-grid":"_widgets-grid_1gf59_1",widgetsGrid:yd,"widget-wrapper":"_widget-wrapper_1gf59_8",widgetWrapper:Rd,"full-width":"_full-width_1gf59_13",fullWidth:Cd,"widget-edit":"_widget-edit_1gf59_16",widgetEdit:Nd,"remove-icon":"_remove-icon_1gf59_19",removeIcon:wd,"full-width-icon":"_full-width-icon_1gf59_26",fullWidthIcon:Sd,"widget-edit-overlay":"_widget-edit-overlay_1gf59_36",widgetEditOverlay:Dd,mobile:Id},_d=(e,t="dashboardConfig")=>{const[r,o]=d.useState({widgets:[]});d.useEffect(()=>{const a=localStorage.getItem(t);a?o(JSON.parse(a)):e&&o(e)},[e,t]);const s=d.useCallback(a=>{o(a),localStorage.setItem(t,JSON.stringify(a))},[t]);return{dashboardConfig:r,onChangeDashboardConfig:s}},Od=({widgetGroups:e,availableWidgets:t,editMode:r,defaultDashboardConfig:o,dashboardConfigKey:s})=>{var x;const{texts:{homeDashboard:a}}=d.useContext(n.LuminusComponentsContext),{dashboardConfig:i,onChangeDashboardConfig:l}=_d(o,s),c=d.useCallback((g,b)=>{var v,h;g===((v=i.widgets)==null?void 0:v.length)?l({...i,widgets:[...i.widgets,{widgetId:b,fullWidth:!1}]}):l({...i,widgets:((h=i.widgets)==null?void 0:h.map((y,C)=>C===g?{widgetId:b,fullWidth:!1}:y))??[]})},[i,l]),p=d.useCallback(g=>{var b,v;((b=i.widgets[g])==null?void 0:b.widgetId)===-1?l({...i,widgets:((v=i.widgets)==null?void 0:v.filter((h,y)=>y!==g))??[]}):c(g,-1)},[i,l,c]),u=d.useCallback(g=>{var b;l({...i,widgets:((b=i.widgets)==null?void 0:b.map((v,h)=>h===g?{...v,fullWidth:!v.fullWidth}:v))??[]})},[i,l]),m=d.useCallback((g,b,v)=>g?n.jsxRuntimeExports.jsxs("div",{className:n.classNames(He.widgetWrapper,{[He.widgetEdit]:r&&g.id!==-1},{[He.fullWidth]:v}),children:[r&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(n.IconButton,{color:"danger",onClick:()=>p(b),className:n.classNames(He.removeIcon),children:n.jsxRuntimeExports.jsx(n.MdOutlineDelete,{})}),n.jsxRuntimeExports.jsx(n.IconButton,{color:v?"danger":"primary",onClick:()=>u(b),className:n.classNames(He.fullWidthIcon),children:n.jsxRuntimeExports.jsx(n.MdOutlineExpand,{})})]}),g.id===-1?r&&n.jsxRuntimeExports.jsx("div",{className:He.widgetWrapper,children:n.jsxRuntimeExports.jsx($o,{widgetGroups:e,availableWidgets:t,onAdd:h=>c(b,h),texts:a})}):n.jsxRuntimeExports.jsx(ql,{title:g.title,children:n.jsxRuntimeExports.jsx(g.WidgetElement,{title:g.title})}),g.id>-1&&r&&n.jsxRuntimeExports.jsx("div",{className:He.widgetEditOverlay})]},b):n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{}),[r,e,c,p,u,t,a]),{isMobile:f}=n.useWindowSize();return n.jsxRuntimeExports.jsx("div",{className:n.classNames(He.dashboard,{[He.mobile]:f}),children:n.jsxRuntimeExports.jsxs("div",{className:n.classNames(He.widgetsGrid),children:[(x=i.widgets)==null?void 0:x.map((g,b)=>m(t.find(v=>v.id===g.widgetId),b,g.fullWidth)),r&&n.jsxRuntimeExports.jsx($o,{widgetGroups:e,availableWidgets:t,onAdd:g=>{var b;return c((b=i.widgets)==null?void 0:b.length,g)},texts:a})]})})},Td="_badge_193ci_1",Pd="_sm_193ci_6",kd="_md_193ci_10",Ad="_lg_193ci_14",Md="_light_193ci_18",Wn={badge:Td,sm:Pd,md:kd,lg:Ad,light:Md},Bd=({children:e,color:t="primary",size:r="md",rounded:o,className:s,variant:a="filled",...i})=>{const l=d.useMemo(()=>a==="filled"?n.classNames(`bg-${t}`):a==="outline"?n.classNames(`text-${t} border-${t} border bg-white`):"",[t,a]);return n.jsxRuntimeExports.jsx("span",{className:n.classNames("luminus-badge badge",l,s,{"rounded-pill":o},{"text-dark":t==="light"},{[Wn.light]:t==="light"},Wn.badge,Wn[r]),...i,children:e})},Ld="_collapse-icon_1ahhn_1",Fd="_collapsed_1ahhn_6",Go={"collapse-icon":"_collapse-icon_1ahhn_1",collapseIcon:Ld,collapsed:Fd},Wt=({title:e,children:t,className:r,...o})=>{const s=o.controlled?!1:o.defaultOpen??!1,[a,i]=d.useState(s),l=o.controlled?o.isOpen:a;return d.useEffect(()=>{i(s)},[s]),n.jsxRuntimeExports.jsxs("div",{className:r??"",children:[n.jsxRuntimeExports.jsxs("div",{role:"button",className:"d-flex align-items-center justify-content-between pb-3 pt-2",onClick:()=>o.controlled?o.onToggle(!o.isOpen):i(!a),children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"h6",children:e}),n.jsxRuntimeExports.jsx(n.MdOutlineChevronRight,{className:n.classNames(Go.collapseIcon,{[Go.collapsed]:l})})]}),n.jsxRuntimeExports.jsx(Js,{in:l,children:n.jsxRuntimeExports.jsx("div",{children:t})}),n.jsxRuntimeExports.jsx("hr",{className:`my-0 ${l?"mt-3":""}`})]})},Vd="_card_19733_1",$d="_header_19733_6",Gd="_header-content_19733_13",Wd="_title_19733_19",Ud="_collapse-icon_19733_22",Hd="_collapsed_19733_27",zd="_content_19733_30",ot={card:Vd,header:$d,"header-content":"_header-content_19733_13",headerContent:Gd,title:Wd,"collapse-icon":"_collapse-icon_19733_22",collapseIcon:Ud,collapsed:Hd,content:zd},Ut=({title:e,headerContent:t,children:r,className:o,headerClassName:s,contentClassName:a,dontRenderIfNoChildren:i,...l})=>{const c=l.collapsible?l.controlled?!1:l.defaultOpen??!1:!0,[p,u]=d.useState(c),m=l.collapsible?l.controlled?l.isOpen:p:!0;d.useEffect(()=>{u(c)},[c]);const f=d.useMemo(()=>!r||!r.toString()||r.toString().split(",").filter(x=>x&&x!=="false").length===0,[r]);return i&&f?null:n.jsxRuntimeExports.jsxs("div",{className:n.classNames("luminus-card rounded shadow-sm",ot.card,{[o??""]:o}),children:[n.jsxRuntimeExports.jsxs("div",{role:l.collapsible?"button":void 0,className:n.classNames("header",ot.header,{[s??""]:s}),onClick:()=>{l.collapsible&&(l.controlled?l.onToggle(!l.isOpen):u(!p))},children:[n.jsxRuntimeExports.jsxs("div",{className:n.classNames("header-content",ot.headerContent),children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"h6",className:n.classNames("text-primary",ot.title),children:e}),t??null]}),l.collapsible&&n.jsxRuntimeExports.jsx(n.MdOutlineChevronRight,{className:n.classNames(ot.collapseIcon,{[ot.collapsed]:m})})]}),n.jsxRuntimeExports.jsx(Js,{in:m,children:n.jsxRuntimeExports.jsx("div",{className:n.classNames("card-content border-top border-primary",ot.content,{[a??""]:a}),children:r})})]})};function Ht(e){"@babel/helpers - typeof";return Ht=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ht(e)}function qd(e,t){if(Ht(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,t||"default");if(Ht(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Yd(e){var t=qd(e,"string");return Ht(t)=="symbol"?t:t+""}function Kd(e,t,r){return(t=Yd(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,o)}return r}function Uo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wo(Object(r),!0).forEach(function(o){Kd(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wo(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function Ie(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Ho=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Un=function(){return Math.random().toString(36).substring(7).split("").join(".")},zo={INIT:"@@redux/INIT"+Un(),REPLACE:"@@redux/REPLACE"+Un(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Un()}};function Xd(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Qd(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(ep(e))return"date";if(Zd(e))return"error";var r=Jd(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function Jd(e){return typeof e.constructor=="function"?e.constructor.name:null}function Zd(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function ep(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function ct(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=Qd(e)),t}function Ga(e,t,r){var o;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?Ie(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Ie(1):"Expected the enhancer to be a function. Instead, received: '"+ct(r)+"'");return r(Ga)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Ie(2):"Expected the root reducer to be a function. Instead, received: '"+ct(e)+"'");var s=e,a=t,i=[],l=i,c=!1;function p(){l===i&&(l=i.slice())}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?Ie(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return a}function m(b){if(typeof b!="function")throw new Error(process.env.NODE_ENV==="production"?Ie(4):"Expected the listener to be a function. Instead, received: '"+ct(b)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Ie(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var v=!0;return p(),l.push(b),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?Ie(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");v=!1,p();var y=l.indexOf(b);l.splice(y,1),i=null}}}function f(b){if(!Xd(b))throw new Error(process.env.NODE_ENV==="production"?Ie(7):"Actions must be plain objects. Instead, the actual type was: '"+ct(b)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof b.type>"u")throw new Error(process.env.NODE_ENV==="production"?Ie(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?Ie(9):"Reducers may not dispatch actions.");try{c=!0,a=s(a,b)}finally{c=!1}for(var v=i=l,h=0;h<v.length;h++){var y=v[h];y()}return b}function x(b){if(typeof b!="function")throw new Error(process.env.NODE_ENV==="production"?Ie(10):"Expected the nextReducer to be a function. Instead, received: '"+ct(b));s=b,f({type:zo.REPLACE})}function g(){var b,v=m;return b={subscribe:function(y){if(typeof y!="object"||y===null)throw new Error(process.env.NODE_ENV==="production"?Ie(11):"Expected the observer to be an object. Instead, received: '"+ct(y)+"'");function C(){y.next&&y.next(u())}C();var E=v(C);return{unsubscribe:E}}},b[Ho]=function(){return this},b}return f({type:zo.INIT}),o={dispatch:f,subscribe:m,getState:u,replaceReducer:x},o[Ho]=g,o}function qo(e,t){return function(){return t(e.apply(this,arguments))}}function Yo(e,t){if(typeof e=="function")return qo(e,t);if(typeof e!="object"||e===null)throw new Error(process.env.NODE_ENV==="production"?Ie(16):"bindActionCreators expected an object or a function, but instead received: '"+ct(e)+`'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?`);var r={};for(var o in e){var s=e[o];typeof s=="function"&&(r[o]=qo(s,t))}return r}function Wa(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.length===0?function(o){return o}:t.length===1?t[0]:t.reduce(function(o,s){return function(){return o(s.apply(void 0,arguments))}})}function tp(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(o){return function(){var s=o.apply(void 0,arguments),a=function(){throw new Error(process.env.NODE_ENV==="production"?Ie(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},i={getState:s.getState,dispatch:function(){return a.apply(void 0,arguments)}},l=t.map(function(c){return c(i)});return a=Wa.apply(void 0,l)(s.dispatch),Uo(Uo({},s),{},{dispatch:a})}}}var Mr=d.createContext(null);process.env.NODE_ENV!=="production"&&(Mr.displayName="ReactRedux");function np(e){e()}var Ua=np,rp=function(t){return Ua=t},op=function(){return Ua};function sp(){var e=op(),t=null,r=null;return{clear:function(){t=null,r=null},notify:function(){e(function(){for(var s=t;s;)s.callback(),s=s.next})},get:function(){for(var s=[],a=t;a;)s.push(a),a=a.next;return s},subscribe:function(s){var a=!0,i=r={callback:s,next:null,prev:r};return i.prev?i.prev.next=i:t=i,function(){!a||t===null||(a=!1,i.next?i.next.prev=i.prev:r=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var Ko={notify:function(){},get:function(){return[]}};function Ha(e,t){var r,o=Ko;function s(m){return c(),o.subscribe(m)}function a(){o.notify()}function i(){u.onStateChange&&u.onStateChange()}function l(){return!!r}function c(){r||(r=t?t.addNestedSub(i):e.subscribe(i),o=sp())}function p(){r&&(r(),r=void 0,o.clear(),o=Ko)}var u={addNestedSub:s,notifyNestedSubs:a,handleChangeWrapper:i,isSubscribed:l,trySubscribe:c,tryUnsubscribe:p,getListeners:function(){return o}};return u}var za=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?d.useLayoutEffect:d.useEffect;function qa(e){var t=e.store,r=e.context,o=e.children,s=d.useMemo(function(){var l=Ha(t);return{store:t,subscription:l}},[t]),a=d.useMemo(function(){return t.getState()},[t]);za(function(){var l=s.subscription;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),a!==t.getState()&&l.notifyNestedSubs(),function(){l.tryUnsubscribe(),l.onStateChange=null}},[s,a]);var i=r||Mr;return d.createElement(i.Provider,{value:s},o)}process.env.NODE_ENV!=="production"&&(qa.propTypes={store:n.Oe.shape({subscribe:n.Oe.func.isRequired,dispatch:n.Oe.func.isRequired,getState:n.Oe.func.isRequired}),context:n.Oe.object,children:n.Oe.any});var Br=n.requireReactIs(),ap={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},ip={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},lp={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Ya={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Lr={};Lr[Br.ForwardRef]=lp;Lr[Br.Memo]=Ya;function Xo(e){return Br.isMemo(e)?Ya:Lr[e.$$typeof]||ap}var cp=Object.defineProperty,up=Object.getOwnPropertyNames,Qo=Object.getOwnPropertySymbols,dp=Object.getOwnPropertyDescriptor,pp=Object.getPrototypeOf,Jo=Object.prototype;function Ka(e,t,r){if(typeof t!="string"){if(Jo){var o=pp(t);o&&o!==Jo&&Ka(e,o,r)}var s=up(t);Qo&&(s=s.concat(Qo(t)));for(var a=Xo(e),i=Xo(t),l=0;l<s.length;++l){var c=s[l];if(!ip[c]&&!(r&&r[c])&&!(i&&i[c])&&!(a&&a[c])){var p=dp(t,c);try{cp(e,c,p)}catch{}}}}return e}var mp=Ka;const Zo=n.getDefaultExportFromCjs(mp);var xr={exports:{}},ce={};/** @license React v17.0.2
9
+ `),a=!1),Object.assign(Object.assign({},e),{allowNegative:a})}function Dc(e){e=Sc(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,o=e.allowLeadingZeros,s=e.onKeyDown;s===void 0&&(s=Xe);var a=e.onBlur;a===void 0&&(a=Xe);var i=e.thousandSeparator,l=e.decimalScale,c=e.fixedDecimalScale,p=e.prefix;p===void 0&&(p="");var u=e.defaultValue,m=e.value,f=e.valueIsNumericString,x=e.onValueChange,g=Na(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),b=Sn(e),v=b.decimalSeparator,h=b.allowedDecimalSeparators,y=function(k){return Oo(k,e)},C=function(k,M){return Nc(k,M,e)},E=ht(m)?u:m,j=f??Cc(E,p,t);ht(m)?ht(u)||(j=j||typeof u=="number"):j=j||typeof m=="number";var S=function(k){return wa(k)?k:(typeof k=="number"&&(k=Ia(k)),j&&typeof l=="number"?Io(k,l,!!c):k)},D=Oa(S(m),S(u),!!j,y,C,x),I=D[0],w=I.numAsString,_=I.formattedValue,T=D[1],A=function(k){var M=k.target,G=k.key,L=M.selectionStart,$=M.selectionEnd,U=M.value;if(U===void 0&&(U=""),(G==="Backspace"||G==="Delete")&&$<p.length){k.preventDefault();return}if(L!==$){s(k);return}G==="Backspace"&&U[0]==="-"&&L===p.length+1&&r&&dt(M,1),l&&c&&(G==="Backspace"&&U[L-1]===v?(dt(M,L-1),k.preventDefault()):G==="Delete"&&U[L]===v&&k.preventDefault()),h!=null&&h.includes(G)&&U[L]===v&&dt(M,L+1);var q=i===!0?",":i;G==="Backspace"&&U[L-1]===q&&dt(M,L-1),G==="Delete"&&U[L]===q&&dt(M,L+1),s(k)},R=function(k){var M=w;if(M.match(/\d/g)||(M=""),o||(M=dc(M)),c&&l&&(M=Io(M,l,c)),M!==w){var G=Oo(M,e);T({formattedValue:G,value:M,floatValue:parseFloat(M)},{event:k,source:$t.event})}a(k)},O=function(k){return k===v?!0:Gt(k)},F=function(k){var M=k.currentValue,G=k.lastValue,L=k.formattedValue,$=k.currentValueIndex,U=k.formattedValueIndex,q=M[$],X=L[U],Q=_a(G,M),le=Q.to,V=function(Y){return C(Y).indexOf(".")+p.length};return m===0&&c&&l&&M[le.start]===v&&V(M)<$&&V(L)>U?!1:$>=le.start&&$<le.end&&h&&h.includes(q)&&X===v?!0:q===X};return Object.assign(Object.assign({},g),{value:_,valueIsNumericString:!1,isValidInputCharacter:O,isCharacterSame:F,onValueChange:T,format:y,removeFormatting:C,getCaretBoundary:function(k){return wc(k,e)},onKeyDown:A,onBlur:R})}function _r(e){var t=Dc(e);return d.createElement(Ec,Object.assign({},t))}const Ta=({InputContainer:e=n.FloatingLabelInput,value:t,onChange:r,debounceMs:o,label:s,withoutLabel:a,placeholder:i,size:l,hidden:c,disabled:p,showClearIcon:u,clearValue:m,className:f,step:x,noSelectOnFocus:g,decimalScale:b,fixedDecimalScale:v=!1,numberPrefix:h,numberSuffix:y,min:C,max:E,hint:j})=>{const S=d.useCallback(()=>{if(!r)return;const A=m??null;r(A?Number(A):null)},[m,r]),D=d.useRef(null),[I,w]=d.useState((t==null?void 0:t.toString())??""),_=d.useCallback(A=>{const R=A;r&&r(R==null||R===""?null:Number(R))},[r]),T=d.useCallback(A=>{var O,F;let R=parseFloat(((F=(O=A.target)==null?void 0:O.value)==null?void 0:F.replaceAll(" ","").replaceAll(",","."))??0);if(Number.isNaN(R)&&(R=0),!o){_(R.toString());return}w(R.toString()),D.current!==null&&window.clearTimeout(D.current),D.current=window.setTimeout(()=>{_(R.toString())},o)},[o,_]);return d.useEffect(()=>{w(t===null?"":t.toString())},[E,C,t]),d.useEffect(()=>{E!==void 0&&Number(I)>E&&w(E.toString()),C!==void 0&&Number(I)<C&&w(C.toString())},[I,E,C,w]),d.useEffect(()=>{!r||t===null||(E!==void 0&&t>E&&r(E),C!==void 0&&t<C&&r(C))},[t,E,C,r]),n.jsxRuntimeExports.jsxs(e,{withoutLabel:a,label:s??"",hidden:c,className:f,hint:j,disabled:p,children:[n.jsxRuntimeExports.jsx(_r,{displayType:"input",thousandSeparator:" ",decimalSeparator:",",decimalScale:b,fixedDecimalScale:v,prefix:h,suffix:y,defaultValue:"",value:o?I:(t==null?void 0:t.toString())??"",placeholder:i??s,onFocus:A=>{!g&&A.target.select()},onChange:T,hidden:c,disabled:p,className:n.classNames("form-control text-end w-100",{[`form-control-${l}`]:l}),step:x,min:C,max:E}),u&&t!==null&&r&&!p&&n.jsxRuntimeExports.jsx("div",{className:"luminus-input-remove-icon inset",children:n.jsxRuntimeExports.jsx(n.IconButton,{color:"secondary",size:"sm",onClick:S,children:n.jsxRuntimeExports.jsx(n.MdClear,{})})})]})},Pa=({InputContainer:e=n.RowLabelInput,label:t,options:r,disabled:o,hidden:s,className:a,value:i,onChange:l})=>{const c=d.useCallback(p=>{l&&l(p.target.value)},[l]);return n.jsxRuntimeExports.jsx(e,{isForRadioInput:!0,hidden:s,withoutLabel:!t,label:`${t}`,className:a,disabled:o,children:r.map(p=>n.jsxRuntimeExports.jsx(n.Form.Check,{id:`radio-${p.id}`,label:p.name,type:"radio",value:p.id??"",checked:i===p.id,onChange:c,hidden:s,disabled:o,className:"w-100"},p.id))})},Ic=({InputContainer:e=n.RowLabelInput,formField:t,label:r,resetsFields:o,type:s,required:a,hidden:i,disabled:l,withoutLabel:c,hint:p,onChange:u,className:m})=>{const{register:f,formState:x,setValue:g}=Oe.useFormContext(),b=n.useFormDisabledContext({falseIfNotInit:!0}),[v,h]=d.useState(void 0),[y,C]=d.useState(!1);d.useEffect(()=>{const S=t.split(".");let D=x.errors;S.forEach(I=>{D!==void 0&&(D=D[I])}),h(D)},[x,t]);const E=d.useMemo(()=>l||b,[l,b]),j=v!==void 0;return d.useEffect(()=>{x.isSubmitted&&C(!0)},[x]),n.jsxRuntimeExports.jsxs(e,{isForCheckInput:!0,hidden:i,label:r??"",required:a,disabled:E,isInvalid:j,withoutLabel:c,hint:p,className:m,children:[n.jsxRuntimeExports.jsx(n.Form.Check,{id:`check-${t}`,type:s??"checkbox",label:`${r}${a?" *":""}`,...f(t,{onChange:S=>{o&&o.forEach(D=>g(D,null,{shouldDirty:!0,shouldValidate:y})),u&&u(S.target.value??null)}}),isInvalid:j,hidden:i,disabled:E,className:"w-100"}),v&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:v.message})]})},_c=({InputContainer:e=n.RowLabelInput,label:t,formField:r,options:o,resetsFields:s,required:a,disabled:i,hidden:l,onChange:c,className:p})=>{const{register:u,formState:m,setValue:f,watch:x}=Oe.useFormContext(),g=n.useFormDisabledContext({falseIfNotInit:!0}),[b,v]=d.useState(void 0),[h,y]=d.useState(!1),C=d.useMemo(()=>o,[o]),E=d.useMemo(()=>i||g,[i,g]);d.useEffect(()=>{const S=r.split(".");let D=m.errors;S.forEach(I=>{D!==void 0&&(D=D[I])}),v(D)},[m,r]),d.useEffect(()=>{m.isSubmitted&&y(!0)},[m]);const j=b!==void 0;return n.jsxRuntimeExports.jsxs(e,{isForRadioInput:!0,hidden:l,withoutLabel:!t,label:t??"",required:a,disabled:E,isInvalid:j,className:p,children:[C.map(S=>n.jsxRuntimeExports.jsx(n.Form.Check,{id:`radio-${S.id}`,label:S.name,type:"radio",value:S.id??"",checked:x(r)===S.id,...u(r,{onChange:D=>{var I;s&&s.forEach(w=>f(w,null,{shouldDirty:!0,shouldValidate:h})),c&&c((I=D.target)!=null&&I.value?D.target.value.toString():null)}}),isInvalid:j,hidden:l,disabled:E,className:"w-100"},S.id)),b&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:b.message})]})},Oc=({label:e,InputContainer:t=n.RowLabelInput,className:r,withoutLabel:o,hidden:s,disabled:a,contactType:i,formField:l,...c})=>{const{watch:p}=Oe.useFormContext(),u=p(l),m=n.useFormDisabledContext({falseIfNotInit:!0}),f=d.useMemo(()=>a||m,[a,m]);return s?null:n.jsxRuntimeExports.jsx(Ca,{contactType:i,value:u,withoutLabel:o,label:e,className:r,children:n.jsxRuntimeExports.jsx(n.HookFormTextInput,{type:"text",formField:l,InputContainer:t,size:"sm",withoutLabel:!0,className:"flex-grow-1",disabled:f,...c})})},Tc=({InputContainer:e=n.RowLabelInput,formField:t,label:r,size:o,defaultSelection:s,resetsFields:a,isNumber:i,required:l,hidden:c,disabled:p,items:u,onSearchQueryChange:m,selectedItemNavigateTo:f,texts:x,dropdownItemsNameWidth:g,isLoading:b,withoutLabel:v,additionalColumns:h,CustomOnChangeComponent:y,icon:C,displayIdAsName:E,onSelect:j,className:S,archiveColumn:D,hint:I,addNewOptionPath:w,refreshOptions:_,MiniDetailComponent:T,miniDetailPlacement:A,suggestedItems:R,suggestedItemsTitle:O})=>{const{formState:F,setValue:k,watch:M,control:G}=Oe.useFormContext(),L=n.useFormDisabledContext({falseIfNotInit:!0}),[$,U]=d.useState(void 0),[q,X]=d.useState(!1),[Q,le]=d.useState(!1),V=M(t)??null,Y=V===(s==null?void 0:s.id)?s==null?void 0:s.name:M(`${t}-DropdownName`),re=d.useMemo(()=>V==null?null:{id:V??null,name:Y??""},[V,Y]),fe=d.useCallback(()=>{const B=t.split(".");let z=F.errors;B.forEach(ee=>{z!==void 0&&(z=z[ee])}),U(z)},[F,t]),te=d.useCallback(B=>{if((B==null?void 0:B.id)===V)return;if(j&&j(B),a&&a.forEach(ee=>k(ee,null,{shouldDirty:!0,shouldValidate:Q})),B===null){k(t,null,{shouldDirty:!0,shouldValidate:Q}),k(`${t}-DropdownName`,null);return}let z=null;i?z=(B==null?void 0:B.id)!==null&&(B==null?void 0:B.id)!==""?parseInt(B.id.toString(),10):null:z=B.id===null||B.id===void 0||B.id===""?null:B.id,k(t,z,{shouldDirty:!0,shouldValidate:Q}),k(`${t}-DropdownName`,B.name??"")},[k,t,Q,i,a,V,j]),P=d.useCallback(B=>{X(!1),te(B)},[te]),Z=d.useCallback(()=>{X(!1)},[]),ve=d.useRef(null),De=$!==void 0,Ae=f!==void 0,ze=Ae&&re!==null,W=d.useMemo(()=>p||L,[p,L]);return d.useEffect(()=>{fe()},[fe]),d.useEffect(()=>{F.isSubmitted&&le(!0)},[F]),n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:n.jsxRuntimeExports.jsxs(e,{label:r??"",required:l,disabled:W,hidden:c,withoutLabel:v,isInvalid:De,inputContainerClassName:n.classNames({"luminus-dropdown-select-open":q}),hint:I,className:S,children:[n.jsxRuntimeExports.jsxs(n.InputAnchorContainer,{currentSelection:re,selectedItemNavigateTo:f,children:[E&&(re==null?void 0:re.name)&&n.jsxRuntimeExports.jsx(n.Typography,{variant:"caption",className:"d-flex justify-content-end mt-2 luminus-dropdown-selection-name",children:re.name}),n.jsxRuntimeExports.jsx(Oe.Controller,{control:G,name:t,render:()=>n.jsxRuntimeExports.jsx(n.MiniDetailWrapper,{value:V,MiniDetailComponent:T,miniDetailPlacement:A,children:n.jsxRuntimeExports.jsx(n.Form.Select,{size:o,onMouseDown:B=>{B.currentTarget.focus(),B.preventDefault()},onClick:()=>{!Ae&&!W&&X(!0)},ref:ve,value:V??"",onChange:()=>{},isInvalid:De,hidden:c,className:n.classNames("w-100",{"luminus-dropdown-picker-disabled":W,"luminus-dropdown-picker-link":ze}),children:n.jsxRuntimeExports.jsx("option",{value:V,children:E?V:(Y==null?void 0:Y.length)>0?Y:V})})})}),y||!W&&Ae?n.jsxRuntimeExports.jsxs("div",{className:"custom-picker-button",children:[!y&&!W&&Ae&&n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",color:"secondary",onClick:B=>{B.preventDefault(),B.stopPropagation(),X(!0)},children:C??n.jsxRuntimeExports.jsx(n.MdOutlineEdit,{})}),y??null]}):null]}),$&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:$.message}),ve.current&&n.jsxRuntimeExports.jsx(n.SimplePicker,{show:q,onCancel:Z,items:u,currentSelection:re,onSelectionChange:P,onSearchQueryChange:m,texts:x,itemsNameWidth:g,additionalColumns:h,displayIdAsName:E,isLoading:b,disabled:W,inputRef:ve,archiveColumn:D,addNewOptionPath:w,refreshOptions:_,suggestedItems:R,suggestedItemsTitle:O})]})})},Pc=({InputContainer:e=n.RowLabelInput,label:t,formField:r,hidden:o,required:s,placeholder:a,disabled:i,showClearIcon:l,resetsFields:c,multiple:p,accept:u,withoutLabel:m,hint:f,className:x})=>{const{watch:g,setValue:b,register:v,formState:h}=Oe.useFormContext(),y=n.useFormDisabledContext({falseIfNotInit:!0}),[C,E]=d.useState(!1),[j,S]=d.useState(void 0),D=d.useCallback(()=>{b(r,"")},[b,r]),I=d.useCallback(()=>{const T=r.split(".");let A=h.errors;T.forEach(R=>{A!==void 0&&(A=A[R])}),S(A)},[h,r]);d.useEffect(I,[I]),d.useEffect(()=>{h.isSubmitted&&E(!0)},[h]);const w=d.useMemo(()=>i||y,[i,y]),_=j!==void 0;return n.jsxRuntimeExports.jsxs(e,{label:t??"",required:s,disabled:w,hidden:o,withoutLabel:m,isInvalid:_,hint:f,className:x,children:[n.jsxRuntimeExports.jsx(n.FormControl,{type:"file",multiple:p,accept:u.join(", "),placeholder:a??t,isInvalid:_,hidden:o,disabled:w,className:"w-100",...v(r,{onChange:()=>{c&&c.forEach(T=>b(T,null,{shouldDirty:!0,shouldValidate:C}))}})}),l&&g(r)&&n.jsxRuntimeExports.jsx("div",{className:"luminus-input-remove-icon",children:n.jsxRuntimeExports.jsx(n.IconButton,{color:"secondary",size:"sm",onClick:D,children:n.jsxRuntimeExports.jsx(n.MdClear,{})})}),j&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:j.message})]})},ka=({children:e,onStorno:t,noSpacer:r})=>{const{formState:o}=Oe.useFormContext(),s=n.useFormDisabledContext({falseIfNotInit:!0}),[a,i]=d.useState(!1);return d.useEffect(()=>{i(Object.keys(o.dirtyFields).length>0)},[o]),a?n.jsxRuntimeExports.jsx(ha,{onStorno:t,noSpacer:r,disabled:s,children:e}):null},mr=({InputContainer:e=n.RowLabelInput,options:t,formField:r,label:o,size:s,resetsFields:a,isNumber:i,required:l,hidden:c,disabled:p,withoutLabel:u,noSortOptions:m,suffixIdToName:f,onSelect:x,className:g,appendCurrentSelectionWithName:b,hint:v,addNewOptionPath:h,refreshOptions:y,MiniDetailComponent:C,miniDetailPlacement:E,selectedItemNavigateTo:j})=>{const{texts:{customSelect:S}}=d.useContext(n.LuminusComponentsContext),{formState:D,setValue:I,watch:w,control:_}=Oe.useFormContext(),T=n.useFormDisabledContext({falseIfNotInit:!0}),[A,R]=d.useState(void 0),[O,F]=d.useState(!1),[k,M]=d.useState(!1),[G,L]=d.useState(""),$=w(r),U=d.useMemo(()=>t.find(P=>P.id===$)??null,[t,$]),q=d.useCallback(()=>{const P=r.split(".");let Z=D.errors;P.forEach(ve=>{Z!==void 0&&(Z=Z[ve])}),R(Z)},[D,r]),X=d.useCallback(P=>{if((P==null?void 0:P.id)===$)return;if(x&&x(P),a&&a.forEach(ve=>I(ve,null,{shouldDirty:!0,shouldValidate:k})),P===null){I(r,null,{shouldDirty:!0,shouldValidate:k});return}let Z=null;i?Z=(P==null?void 0:P.id)!==null&&(P==null?void 0:P.id)!==""?parseInt(P.id.toString(),10):null:Z=P.id===null||P.id===void 0||P.id===""?null:P.id,I(r,Z,{shouldDirty:!0,shouldValidate:k})},[I,r,i,a,$,k,x]),Q=d.useCallback(P=>{F(!1),X(P)},[X]),le=d.useCallback(P=>{L(P)},[]),V=d.useMemo(()=>p||T,[p,T]);d.useEffect(()=>{q()},[q]),d.useEffect(()=>{D.isSubmitted&&M(!0)},[D]);const Y=d.useCallback(P=>{var Z;return P===null?"":!P.name||P.name.length===0?((Z=P.id)==null?void 0:Z.toString())??"":f?`${P.name} (${P.id})`:P.name},[f]),re=d.useMemo(()=>{const P=t?[...t]:[];return b!==void 0&&$&&(P.some(Z=>Z.id===$)||P.push({id:$,name:b})),P.map(Z=>({id:Z.id,name:Y(Z)})).filter(Z=>n.stringSearchWithin(Z.name,G)).sort((Z,ve)=>m?0:(Z.name??"").localeCompare(ve.name??""))},[t,m,G,Y,b,$]),fe=d.useRef(null),te=A!==void 0;return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:n.jsxRuntimeExports.jsxs(e,{label:o??"",required:l,disabled:V,hidden:c,withoutLabel:u,isInvalid:te,inputContainerClassName:n.classNames({"luminus-dropdown-select-open":O}),hint:v,className:g,children:[n.jsxRuntimeExports.jsx(n.InputAnchorContainer,{currentSelection:U,selectedItemNavigateTo:j,children:n.jsxRuntimeExports.jsx(Oe.Controller,{control:_,name:r,render:()=>n.jsxRuntimeExports.jsx(n.MiniDetailWrapper,{value:$,MiniDetailComponent:C,miniDetailPlacement:E,children:n.jsxRuntimeExports.jsx(n.Form.Select,{size:s,onMouseDown:P=>{P.currentTarget.focus(),P.preventDefault()},onClick:()=>{F(!0)},ref:fe,value:$??"",onChange:()=>{},isInvalid:te,hidden:c,disabled:V,className:"w-100",children:n.jsxRuntimeExports.jsx("option",{value:(U==null?void 0:U.id)??"",children:Y(U)})})})})}),A&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:A.message}),fe.current&&n.jsxRuntimeExports.jsx(n.SimplePicker,{show:O,onCancel:()=>F(!1),items:re,currentSelection:U??null,onSelectionChange:Q,onSearchQueryChange:le,texts:S,disabled:V,inputRef:fe,autoHideSearch:!0,allItemsLength:t.length,addNewOptionPath:h,refreshOptions:y})]})})},kc=({InputContainer:e=n.RowLabelInput,formField:t,label:r,placeholder:o,size:s,resetsFields:a,showClearIcon:i,clearValue:l,required:c,hidden:p,disabled:u,withoutLabel:m,step:f,stepperStep:x=1,className:g,min:b,max:v,onChange:h,hint:y})=>{const{register:C,formState:E,setValue:j,watch:S}=Oe.useFormContext(),D=n.useFormDisabledContext({falseIfNotInit:!0}),[I,w]=d.useState(void 0),[_,T]=d.useState(!1),A=d.useCallback((G,L,$)=>{j(G,Qe.limitNumber(L,b,v),$)},[v,b,j]),R=d.useCallback(()=>{const G=l??null;A(t,G!==null?Number(G):null,{shouldDirty:!0,shouldValidate:_})},[l,A,t,_]),O=d.useCallback(()=>{const G=t.split(".");let L=E.errors;G.forEach($=>{L!==void 0&&(L=L[$])}),w(L)},[E,t]),F=d.useMemo(()=>u||D,[u,D]);d.useEffect(()=>{O()},[O]),d.useEffect(()=>{E.isSubmitted&&T(!0)},[E]);const k=I!==void 0,M=S(t);return n.jsxRuntimeExports.jsxs(e,{label:r??"",required:c,disabled:F,hidden:p,withoutLabel:m,isInvalid:k,hint:y,className:g,children:[n.jsxRuntimeExports.jsxs("div",{className:"luminus-input-container position-relative w-100",children:[n.jsxRuntimeExports.jsx(n.Form.Control,{type:"number",placeholder:o??r,size:s,...C(t,{setValueAs:G=>G==null||G===""?null:Qe.limitNumber(Number(G),b,v),min:b,max:v,onChange:G=>{var L;a&&a.forEach($=>j($,null,{shouldDirty:!0,shouldValidate:_})),h&&h((L=G.target)!=null&&L.value?Number(G.target.value)??null:null)}}),isInvalid:k,hidden:p,disabled:F,className:"w-100 luminus-numeric-stepper",step:f,min:b,max:v}),n.jsxRuntimeExports.jsx("div",{className:"stepper-icon left",children:!u&&n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",onClick:G=>{G.preventDefault(),G.stopPropagation(),A(t,((M?Number(M):0)-x).toString(),{shouldDirty:!0,shouldValidate:_})},children:n.jsxRuntimeExports.jsx(n.FaMinus,{})})}),n.jsxRuntimeExports.jsx("div",{className:"stepper-icon right",children:!u&&n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",onClick:G=>{G.preventDefault(),G.stopPropagation(),A(t,((M?Number(M):0)+x).toString(),{shouldDirty:!0,shouldValidate:_})},children:n.jsxRuntimeExports.jsx(n.FaPlus,{})})})]}),i&&S(t)&&n.jsxRuntimeExports.jsx("div",{className:"luminus-input-remove-icon",children:n.jsxRuntimeExports.jsx(n.IconButton,{color:"secondary",size:"sm",onClick:R,children:n.jsxRuntimeExports.jsx(n.MdClear,{})})}),I&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:I.message})]})},Ac=({InputContainer:e=n.RowLabelInput,formField:t,label:r,placeholder:o,resetsFields:s,showClearIcon:a,clearValue:i,required:l,hidden:c,disabled:p,withoutLabel:u,step:m,size:f,CustomOnChangeComponent:x,noSelectOnFocus:g,className:b,decimalScale:v=2,fixedDecimalScale:h=!1,numberPrefix:y,numberSuffix:C,min:E,max:j,onChange:S,hint:D})=>{const{formState:I,setValue:w,watch:_,control:T}=Oe.useFormContext(),A=n.useFormDisabledContext({falseIfNotInit:!0}),[R,O]=d.useState(void 0),[F,k]=d.useState(!1),M=d.useCallback(()=>{const q=i??null;w(t,q!==null?Number(q):null,{shouldDirty:!0,shouldValidate:F})},[i,w,t,F]),G=d.useCallback(()=>{const q=t.split(".");let X=I.errors;q.forEach(Q=>{X!==void 0&&(X=X[Q])}),O(X)},[I,t]),L=d.useMemo(()=>p||A,[p,A]);d.useEffect(()=>{G()},[G]),d.useEffect(()=>{I.isSubmitted&&k(!0)},[I]);const $=_(t);d.useEffect(()=>{j!==void 0&&$>j&&w(t,j),E!==void 0&&$<E&&w(t,E)},[t,$,j,E,w]);const U=R!==void 0;return n.jsxRuntimeExports.jsxs(e,{label:r??"",required:l,disabled:L,hidden:c,withoutLabel:u,isInvalid:U,hint:D,className:b,children:[n.jsxRuntimeExports.jsxs("div",{className:"luminus-input-container position-relative w-100",children:[n.jsxRuntimeExports.jsx(Oe.Controller,{control:T,name:t,render:({field:{ref:q,onChange:X,name:Q,value:le}})=>n.jsxRuntimeExports.jsx(_r,{displayType:"input",thousandSeparator:" ",decimalSeparator:",",decimalScale:v,fixedDecimalScale:h,prefix:y,suffix:C,defaultValue:"",name:Q,value:le??"",placeholder:o??r,onFocus:V=>{!g&&V.target.select()},onChange:V=>{var fe,te;const Y=parseFloat(((te=(fe=V.target)==null?void 0:fe.value)==null?void 0:te.replaceAll(" ","").replaceAll(",","."))??0);s&&s.forEach(P=>w(P,null,{shouldDirty:!0,shouldValidate:F}));const re=Y==null||Number.isNaN(Y)?null:Number(Y);X(re),S&&S(re)},hidden:c,disabled:L,className:n.classNames("form-control text-end w-100",{"is-invalid":U},{[`form-control-${f}`]:f}),step:m,getInputRef:q,min:E,max:j})}),x&&n.jsxRuntimeExports.jsx("div",{className:"custom-picker-button",children:x})]}),a&&_(t)&&n.jsxRuntimeExports.jsx("div",{className:"luminus-input-remove-icon inset",children:n.jsxRuntimeExports.jsx(n.IconButton,{color:"secondary",size:"sm",onClick:M,children:n.jsxRuntimeExports.jsx(n.MdClear,{})})}),R&&n.jsxRuntimeExports.jsx(n.InvalidFeedback,{message:R.message})]})},Mc=({color:e="primary",icon:t=n.jsxRuntimeExports.jsx(n.MdOutlineFileUpload,{size:12}),inputId:r="context-file-input",accept:o="*",onUpload:s,multiple:a,className:i,children:l,...c})=>{const p=u=>{u.target.files&&(s(u.target.files),u.target.value="")};return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsxs("label",{htmlFor:r,className:n.classNames(`btn luminus-dropdown-item text-nowrap rounded text-${e} ${i??""}`,n.classes.item),...c,children:[t,l]}),n.jsxRuntimeExports.jsx("input",{id:r,type:"file",accept:o,onChange:p,hidden:!0,multiple:a})]})},Or=["slice","options","formats","conditions"],To=e=>{const t=e.current.flexmonster.getReport({withDefaults:!0});if(typeof t=="string")throw alert("report is string"),new Error("report is string");const r={};return Or.forEach(o=>{r[o]=t[o]}),JSON.stringify(r)},Bc=e=>{if(e.settings){const t=JSON.parse(e.settings);return Or.forEach(r=>{t[r]===void 0&&(t[r]=null)}),t}return{}},Lc=e=>{const t={};return Or.forEach(r=>{t[r]=(e==null?void 0:e[r])??void 0}),t},Fc=e=>e&&e.type==="header"&&e.member&&e.member.caption!=="All"&&e.label==="",Po=(e,t)=>e.hierarchy&&e.hierarchy.uniqueName===t,ko=e=>!e.member&&!e.isDrillThrough,Ao=(e,t)=>typeof e=="function"?e(t):e.replace(":id",t),Aa=({dataSource:e,settings:t,pivotRef:r,localization:o,licenseKey:s,hyperlinkColumn:a,roomPasportization:i,enabled:l=!0})=>{const{texts:{reports:c}}=d.useContext(n.LuminusComponentsContext),[p,u]=d.useState(!1),m=d.useRef(null),f=r??m,x=d.useMemo(()=>({localization:o}),[o]),g=d.useCallback(E=>{delete E[0],delete E[1],delete E[2];const j=[{id:"fm-tab-expand",title:c.expandAll,handler:f.current.flexmonster.expandAllData,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/><path fill="none" d="M0 0h24v24H0V0z"/></svg>'},{id:"fm-tab-collapse",title:c.collapseAll,handler:f.current.flexmonster.collapseAllData,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'}];return E.unshift({id:"fm-tab-expand",title:c.expand,icon:'<svg height="42" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d=" M16 4 L28 4 L28 16 L24 12 L20 16 L16 12 L20 8z M4 16 L8 20 L12 16 L16 20 L12 24 L16 28 L4 28z "/></svg>',menu:j,rightGroup:!0}),E},[f,c.collapseAll,c.expand,c.expandAll]),b=E=>{const j=E.getTabs();E.getTabs=()=>g(j)},v=d.useMemo(()=>e&&e.mapping?Object.values(e.mapping).filter(E=>E.caption.includes("P:")).map(E=>({uniqueName:E.caption.replace("P:",""),caption:E.caption})):[],[e]),h=d.useMemo(()=>{var j,S,D,I;const E=(j=f.current)==null?void 0:j.flexmonster.getReport();return E&&E.slice?{...E.slice,rows:[...((S=E.slice.rows)==null?void 0:S.filter(w=>{var _;return!((_=w.caption)!=null&&_.includes("P:"))}))??[],...v],columns:[...((D=E.slice.columns)==null?void 0:D.filter(w=>{var _;return!((_=w.caption)!=null&&_.includes("P:"))}))??[],...v],measures:[...((I=E.slice.measures)==null?void 0:I.filter(w=>{var _;return!((_=w.caption)!=null&&_.includes("P:"))}))??[],...v]}:null},[v,f]);d.useEffect(()=>{var E,j,S,D;if(p&&l){if(i&&h){const I=(E=f.current)==null?void 0:E.flexmonster.getReport(),w=I&&I.options?{...I.options,grid:{...(j=I.options)==null?void 0:j.grid,autoSwitchToCompact:!1}}:{};(S=f.current)==null||S.flexmonster.setReport({...I,dataSource:e,slice:h,options:w})}else(D=f.current)==null||D.flexmonster.updateData(e);console.log("Updating flexmonster dataSource to: ",e)}},[e,l,p,v,f,i,h]),d.useEffect(()=>{var E,j,S,D,I;if(p&&l){const w=(E=f.current)==null?void 0:E.flexmonster.getReport();if(w===void 0||typeof w=="string")return;const _=Lc(t);_.options={...t==null?void 0:t.options,grid:{...(j=t==null?void 0:t.options)==null?void 0:j.grid,autoSwitchToCompact:!1},showFieldListSearch:!0,datePattern:"dd.MM.yyyy",dateTimePattern:"dd.MM.yyyy HH:mm:ss"},i&&(_.slice={...t==null?void 0:t.slice,rows:[...((D=(S=t==null?void 0:t.slice)==null?void 0:S.rows)==null?void 0:D.filter(A=>{var R;return!((R=A.caption)!=null&&R.includes("P:"))}))??[],...v]});const T={...w,..._};(I=f.current)==null||I.flexmonster.setReport(T),console.log("Refreshing flexmonster settings. New report: ",T)}},[l,p,v,f,i,t]);const y=d.useCallback((E,j)=>{var A,R;if(Fc(j)){E.text=((A=j.member)==null?void 0:A.caption)??"";const O=E.style["padding-left"]??"4px",F=parseInt(O,10);E.style["padding-left"]=F+11+"px"}if(!a||!Po(j,a.idColumn)||ko(j))return;const S=(R=j.escapedLabel)==null?void 0:R.toString();if(S===void 0)return;const D=Ao(a.url,S),I="style='color: #00a45a; text-decoration: underline; cursor: pointer;'",w=j.type==="header"?"onclick='event.stopImmediatePropagation()'":"",_=j.isDrillThrough||j.type==="header"?`href='${D}' target='_blank'`:"";E.style&&(E.style["z-index"]=1);const T=`<a ${_} ${I} ${w}>${j.escapedLabel}</a>`;E.text=T},[a]),C=d.useCallback(E=>{if(!a||!Po(E,a.idColumn)||ko(E))return;const j=Ao(a.url,E.escapedLabel??"");window.open(j??"","_blank","noreferrer")},[a]);return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:n.jsxRuntimeExports.jsx(fl.Pivot,{ref:f,global:x,licenseKey:s,toolbar:!0,height:"100%",beforetoolbarcreated:b,ready:()=>{u(!0)},width:"100%",customizeCell:y,cellclick:C})})},Vc=(e,t,r,o)=>{const{texts:{reports:s}}=d.useContext(n.LuminusComponentsContext),{prompt:a}=n.usePrompt(),{confirm:i}=n.useConfirm(),l=n.useAxios(),{user:c}=d.useContext(n.UserContext),{startLoading:p,stopLoading:u}=d.useContext(n.LoadingContext),{addNotification:m}=n.useNotifications(),f=d.useCallback(async h=>{p("report-versionSavingAs");try{const y=await l.post("/reports/version",h);m(s.saveSuccessful,"success"),await o(y.data)}finally{u("report-versionSavingAs")}},[m,o,l,s.saveSuccessful,p,u]),x=d.useCallback(async()=>{if(r===null){m("none open","warning");return}if(!await i(s.confirmOverwriteSave))return;const y=To(t);f({reportSourceName:e,reportVersionId:r,settings:y})},[m,i,t,e,s.confirmOverwriteSave,f,r]),g=d.useCallback(async()=>{const h=await a(s.enterName,{input:"input",required:!0});if(h===null)return;const y=To(t);f({reportSourceName:e,name:h,settings:y})},[t,a,e,s.enterName,f]),b=d.useCallback(async()=>{p("report-versionSavingAs");try{await l.post("/reports/version",{reportVersionId:r??void 0,reportSourceName:e,isArchived:!0}),m(s.deleteSuccessful,"success")}finally{u("report-versionSavingAs")}},[m,l,e,s.deleteSuccessful,r,p,u]),v=d.useCallback(async()=>{p("report-versionSavingAs");try{await l.post("/reports/version-restrictions",{reportVersionId:r??void 0,userRestricts:[{employeeId:c.personalNumber,addRights:!1}]}),m(s.detachSuccessful,"success")}finally{u("report-versionSavingAs")}},[m,l,s.detachSuccessful,r,p,u,c.personalNumber]);return{saveAs:g,save:x,archive:b,detach:v}},$c=e=>{const t=n.useAxios(),{startLoading:r,stopLoading:o}=d.useContext(n.LoadingContext);return{changeEmployeeRights:d.useCallback(async(a,i)=>{let l=null;r("reportSharing-addPerson");try{l=(await t.post("/reports/version-restrictions",{reportVersionId:e,userRestricts:[{employeeId:a,addRights:i}]})).data}finally{o("reportSharing-addPerson")}return l},[t,e,r,o])}},Gc=({isOpen:e,onHide:t,usersData:r,reportVersionId:o,EmployeePicker:s,setReportVersion:a})=>{const{ProjectIconComponent:i,texts:{reports:l}}=d.useContext(n.LuminusComponentsContext),{confirm:c}=n.useConfirm(),[p,u]=d.useState(null),{changeEmployeeRights:m}=$c(o),f=d.useCallback(b=>{a(v=>v===null?null:{...v,users:b.filter(h=>h.isReportOwner===!1)})},[a]),x=d.useCallback(async()=>{if(p===null)return;const b=await m(p.id,!0);f(b),u(null)},[p,m,f]),g=d.useCallback(async b=>{if(!await c(l.removeSharingWith(b)))return;const h=await m(b,!1);f(h)},[m,c,l,f]);return n.jsxRuntimeExports.jsxs(n.Modal,{show:e,onHide:t,children:[n.jsxRuntimeExports.jsx(n.Modal.Header,{closeButton:!0,children:n.jsxRuntimeExports.jsx(n.Modal.Title,{children:l.reportSharing})}),n.jsxRuntimeExports.jsxs(n.Modal.Body,{children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"h6",children:l.sharedWith}),n.jsxRuntimeExports.jsxs(n.ListGroup,{variant:"flush",children:[r&&r.length===0?n.jsxRuntimeExports.jsx("div",{className:"px-2 text-muted",children:l.noone.toLowerCase()}):null,r==null?void 0:r.map(b=>n.jsxRuntimeExports.jsxs(n.ListGroupItem,{className:"d-flex justify-content-between align-items-center gap-3 border-bottom px-2 py-1",children:[b.lastName," ",b.firstName," [",b.id,"]",n.jsxRuntimeExports.jsx(n.IconButton,{color:"danger",onClick:()=>g(b.id),children:n.jsxRuntimeExports.jsx(i,{icon:"delete"})})]},b.id))]}),n.jsxRuntimeExports.jsx(n.Typography,{variant:"h6",className:"mt-2 mb-2",children:l.addSharing}),n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-2 align-items-center",children:[n.jsxRuntimeExports.jsx("div",{className:"flex-grow-1",children:n.jsxRuntimeExports.jsx(s,{label:l.shareWith,onSelect:b=>{if(b===null||typeof b.id!="number"){u(null);return}u(b)},value:p})}),n.jsxRuntimeExports.jsx(n.PrimaryButton,{onClick:x,disabled:p===null,children:l.add})]})]})]})},Wc=(e,t)=>{const[r,o]=d.useState(null);return d.useEffect(()=>{e.then(({default:s})=>{const a=t!==void 0?t(s):s;o(a)})},[t,e]),{mappings:r}},Uc=({reportType:e,title:t,data:r,filterElements:o,getReportRoute:s,localization:a,licenseKey:i,EmployeePicker:l,localizationJsonFile:c,localizationTransformer:p,hyperlinkColumn:u,roomPasportization:m=!1})=>{const{texts:{reports:f}}=d.useContext(n.LuminusComponentsContext),{confirm:x}=n.useConfirm(),g=oe.useNavigate(),[b]=oe.useSearchParams(),{id:v}=oe.useParams(),h=d.useMemo(()=>v===void 0?null:Number(v),[v]),y=d.useCallback(V=>{const Y=V===null?"":V.toString();g(oe.generatePath(s(e),{id:Y})+"?"+b.toString(),{replace:!0,flushSync:!0})},[s,g,e,b]),[C,E]=d.useState(!1),j=d.useRef(null),{user:S}=d.useContext(n.UserContext),{data:D,reloadData:I}=_e.useGetApiData(`/reports/${e}`),{mappings:w}=Wc(c,p),[_,T]=d.useState({}),A=d.useCallback(V=>{const Y=V.target.value,re=Y===""?null:Number(Y);y(re)},[y]),R=d.useCallback(async V=>{await I(),y(V)},[I,y]),{data:O,setData:F}=_e.useGetApiData(`/reports/version/${h}`,{enabled:h!==null,nullStateBeforeLoad:!1,nullStateOnFail:!0});d.useEffect(()=>{var Y;if(O===null){T({});return}const V=Bc(O)??{};T(V),(Y=j.current)==null||Y.flexmonster.refresh()},[O]);const{save:k,saveAs:M,archive:G,detach:L}=Vc(e,j,h,R),$=d.useMemo(()=>({data:r??[],mapping:w??void 0}),[r,w]),U=d.useCallback(async()=>{var Y;await x(f.confirmRevertChanges)&&((Y=j.current)==null||Y.flexmonster.setReport({dataSource:$,..._}))},[x,$,f.confirmRevertChanges,_]),q=d.useMemo(()=>(O==null?void 0:O.ownerId)===S.personalNumber,[O==null?void 0:O.ownerId,S.personalNumber]),X=d.useMemo(()=>{var V;return(V=O==null?void 0:O.users)==null?void 0:V.some(Y=>Y.id===S.personalNumber&&!Y.isReportOwner)},[O==null?void 0:O.users,S.personalNumber]),Q=d.useCallback(async()=>{await x(f.confirmDelete(O==null?void 0:O.name))&&(await G(),y(null),await I())},[G,x,I,O==null?void 0:O.name,f,y]),le=d.useCallback(async()=>{await x(f.confirmDetach(O==null?void 0:O.name))&&(await L(),y(null),await I())},[x,L,I,O==null?void 0:O.name,f,y]);return d.useEffect(()=>{var V,Y;h===null&&y(((V=D==null?void 0:D.reportVersions.find(re=>re.isSystem===!0))==null?void 0:V.reportVersionId)??((Y=D==null?void 0:D.reportVersions[0])==null?void 0:Y.reportVersionId)??null)},[D==null?void 0:D.reportVersions,h,y]),n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(n.PageContainer,{variant:"fullScreen",title:n.jsxRuntimeExports.jsxs("div",{className:"d-flex justify-content-start gap-3",children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"h3",children:t}),o,n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-1 align-items-center",children:[n.jsxRuntimeExports.jsxs(n.FormSelect,{size:"sm",value:h??void 0,onChange:A,children:[n.jsxRuntimeExports.jsx("optgroup",{label:f.versionSelectSystem,children:D==null?void 0:D.reportVersions.filter(V=>V.isSystem===!0).map(V=>n.jsxRuntimeExports.jsx("option",{value:V.reportVersionId,children:V.name},V.reportVersionId))}),n.jsxRuntimeExports.jsx("optgroup",{label:f.versionSelectYour,children:D==null?void 0:D.reportVersions.filter(V=>V.ownerId===S.personalNumber).map(V=>n.jsxRuntimeExports.jsx("option",{value:V.reportVersionId,children:V.name},V.reportVersionId))}),n.jsxRuntimeExports.jsx("optgroup",{label:f.versionSelectSharedWithYou,children:D==null?void 0:D.reportVersions.filter(V=>V.isSystem===!1&&V.ownerId!==S.personalNumber).map(V=>n.jsxRuntimeExports.jsx("option",{value:V.reportVersionId,children:`${V.name} [${V.ownerId}]`},V.reportVersionId))})]}),n.jsxRuntimeExports.jsx(n.ContextButton,{icon:n.jsxRuntimeExports.jsx(n.MdSave,{}),onClick:k,disabled:h===null||(O==null?void 0:O.isSystem)||!q,children:f.save}),n.jsxRuntimeExports.jsx(n.ContextButton,{icon:n.jsxRuntimeExports.jsx(n.MdSaveAs,{}),onClick:M,className:"flex-shrink-0",children:f.saveAs}),n.jsxRuntimeExports.jsxs(n.Dropdown,{toggle:n.jsxRuntimeExports.jsx(n.DropdownToggle,{as:n.SimpleDropdownToggle}),children:[n.jsxRuntimeExports.jsx(n.DropdownItem,{onClick:U,children:f.revertChanges}),n.jsxRuntimeExports.jsx(n.DropdownItem,{onClick:()=>E(!0),disabled:!q||(O==null?void 0:O.isSystem),children:f.share}),q&&!(O!=null&&O.isSystem)?n.jsxRuntimeExports.jsx(n.DropdownItem,{color:"danger",onClick:Q,children:f.delete}):null,X&&!(O!=null&&O.isSystem)?n.jsxRuntimeExports.jsx(n.DropdownItem,{color:"danger",onClick:le,children:f.detach}):null]})]})]}),children:n.jsxRuntimeExports.jsx("div",{className:n.classNames("h-100 w-100",$.data&&$.data.length>0?"":"d-none"),children:n.jsxRuntimeExports.jsx(Aa,{dataSource:$,settings:_,pivotRef:j,enabled:$.data&&$.data.length>0,roomPasportization:m,localization:a,licenseKey:i,hyperlinkColumn:u})})}),O!==null?n.jsxRuntimeExports.jsx(Gc,{isOpen:C,onHide:()=>E(!1),usersData:O.users??null,setReportVersion:F,reportVersionId:O==null?void 0:O.reportVersionId,EmployeePicker:l}):null]})},Hc=({cell:{value:e}})=>n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:e?n.jsxRuntimeExports.jsx(n.AvatarIcon,{name:e,size:21,fontSize:12}):n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{})}),zc=({knownTypes:e,typeFilters:t,onChangeTypeFilters:r})=>n.jsxRuntimeExports.jsx("div",{className:"mb-1 d-flex justify-content-center gap-2",children:e.map(o=>n.jsxRuntimeExports.jsx("div",{role:"button",style:{height:"14px",width:"14px",borderRadius:"50%",border:"2px solid transparent",backgroundColor:"transparent"},className:n.classNames(`border-${o}`,t.includes(o)&&`bg-${o}`),onClick:()=>{t.includes(o)?r(t.filter(s=>s!==o)):r([...t,o])}},o))}),qc=({linksTo:e,onClick:t,children:r})=>e?n.jsxRuntimeExports.jsx(oe.Link,{to:e,className:"text-decoration-none",onClick:t,children:r}):n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:r}),Yc=({message:e,onDeleteMessage:t,onClickMessage:r,getIcon:o,getLinksTo:s})=>{const{ProjectIconComponent:a,localizationContext:i}=d.useContext(n.LuminusComponentsContext),{dateFnsLocale:l}=d.useContext(i),c=e.dateTime?n.parseISO(e.dateTime):null,p=c?hl(new Date(Date.now()),c):0;return n.jsxRuntimeExports.jsxs("div",{children:[c&&n.jsxRuntimeExports.jsx("div",{className:"d-flex justify-content-end",children:n.jsxRuntimeExports.jsx(n.SimpleTooltip,{text:n.format(c,"dd.MM.yyyy HH:mm"),placement:"left",children:n.jsxRuntimeExports.jsx("div",{children:n.jsxRuntimeExports.jsx(n.Typography,{variant:"caption",children:p>2?n.format(c,"dd.MM.yyyy"):jl(c,new Date(Date.now()),{locale:l.code})})})})}),n.jsxRuntimeExports.jsx(qc,{linksTo:s(e)??void 0,onClick:r,children:n.jsxRuntimeExports.jsx(sl,{level:e.type,noIcon:!0,children:n.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-start gap-2",children:[o(e),n.jsxRuntimeExports.jsxs("div",{className:"d-flex flex-column gap-1 w-100",children:[n.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-start justify-content-between gap-3",children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body2",className:"fw-bold",children:e.subject}),n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",onClick:u=>{u.preventDefault(),u.stopPropagation(),t(e.id)},children:n.jsxRuntimeExports.jsx(a,{icon:"delete"})})]}),n.jsxRuntimeExports.jsx(n.Typography,{variant:"body2",children:e.text})]})]})})})]})},Mo=["info","warning","danger"],Bo=({messages:e,isLoading:t,onDeleteMessage:r,onClickMessage:o,getIcon:s,getLinksTo:a})=>{const{texts:{messageBoard:i}}=d.useContext(n.LuminusComponentsContext),[l,c]=d.useState(Mo),p=d.useMemo(()=>e.filter(u=>l.includes(u.type??"")),[l,e]);return n.jsxRuntimeExports.jsxs("div",{className:"h-100 d-flex flex-column overflow-hidden",children:[n.jsxRuntimeExports.jsx(zc,{knownTypes:Mo,typeFilters:l,onChangeTypeFilters:u=>c(u)}),t&&n.jsxRuntimeExports.jsxs("div",{className:"p-3 w-100",children:[n.jsxRuntimeExports.jsx(Ke,{as:yo.Title,animation:"glow",children:n.jsxRuntimeExports.jsx(Ke,{xs:6})}),n.jsxRuntimeExports.jsxs(Ke,{as:yo.Text,animation:"glow",children:[n.jsxRuntimeExports.jsx(Ke,{xs:7})," ",n.jsxRuntimeExports.jsx(Ke,{xs:4})," ",n.jsxRuntimeExports.jsx(Ke,{xs:4})," ",n.jsxRuntimeExports.jsx(Ke,{xs:6})," ",n.jsxRuntimeExports.jsx(Ke,{xs:8})]})]}),!t&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[e.length===0&&n.jsxRuntimeExports.jsx(n.Alert,{variant:"info",size:"sm",className:"mt-2",children:i.noMessages}),n.jsxRuntimeExports.jsx("div",{className:"h-100 overflow-y-auto d-flex flex-column gap-2 luminus-thin-scrollbar",children:p.map(u=>n.jsxRuntimeExports.jsx(Yc,{message:u,onDeleteMessage:r,onClickMessage:o,getIcon:s,getLinksTo:a},u.id))})]})]})},Fn={apiGet:"/messageBoard",apiDelete:"/messageBoard/"},Kc=({renderAsNotifPanel:e,notifIcon:t,apiUrls:{apiGet:r=Fn.apiGet,apiDelete:o=Fn.apiDelete}=Fn,getIcon:s,getLinksTo:a})=>{const l=n.useAxios(),[c,p]=d.useState([]),[u,m]=d.useState(!1),[f,x]=d.useState(!1),[g,b]=d.useState(!1),v=d.useCallback(async()=>{x(!0),await l.get(r).then(({data:j})=>{p(j),m(!0),x(!1)}).catch(()=>{p([]),x(!1)})},[r,l]),h=d.useCallback(async j=>l.delete(`${o}${j}`).then(()=>!0).catch(()=>!1),[o,l]),y=d.useCallback(j=>{h(j).then(S=>{S&&p(c.filter(D=>D.id!==j))})},[h,c]);d.useEffect(()=>{v();const j=setInterval(()=>v(),60*1e3);return()=>{clearInterval(j)}},[v]);const C=c.filter(j=>j.type==="danger").length,E=u?!1:f;return e?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsxs("div",{className:"position-relative",children:[n.jsxRuntimeExports.jsx(n.IconButton,{size:"md",onClick:()=>b(!g),children:t}),C>0&&n.jsxRuntimeExports.jsx("div",{className:"badge rounded-pill bg-danger p-1 px-2 text-white",style:{position:"absolute",top:"-6px",right:"-10px",fontSize:"10px"},children:C})]}),n.jsxRuntimeExports.jsx(Co,{show:g,onHide:()=>b(!1),placement:"end",children:n.jsxRuntimeExports.jsx(Co.Body,{children:n.jsxRuntimeExports.jsx(Bo,{messages:c,isLoading:E,onDeleteMessage:y,onClickMessage:()=>b(!1),getIcon:s,getLinksTo:a})})})]}):n.jsxRuntimeExports.jsx(Bo,{messages:c,isLoading:E,onDeleteMessage:y,getIcon:s,getLinksTo:a})},Xc="_tab-panel_d8l8q_1",Qc="_full-height-no-overflow_d8l8q_5",Jc="_disabled_d8l8q_12",Vn={"tab-panel":"_tab-panel_d8l8q_1",tabPanel:Xc,"full-height-no-overflow":"_full-height-no-overflow_d8l8q_5",fullHeightNoOverflow:Qc,disabled:Jc},Ma=({eventKey:e,activeTab:t,fullHeightNoOverflow:r,disabled:o,className:s,children:a})=>e!==t?null:n.jsxRuntimeExports.jsx("div",{className:n.classNames("luminus-tab-panel",Vn.tabPanel,{[Vn.fullHeightNoOverflow]:r},{disabled:o},{[Vn.disabled]:o},s),children:a}),Zc="_join-line_1q9e8_1",eu={"join-line":"_join-line_1q9e8_1",joinLine:Zc},Tr=({activeTab:e,onSelect:t,children:r,vertical:o,verticalStepper:s})=>n.jsxRuntimeExports.jsx("div",{className:n.classNames("luminus-tabs d-flex mb-2",{"gap-1":!s},{"gap-0":s},{"flex-column":o||s}),children:r.map((a,i)=>{const l=a.type,c=a.props;if(!c)return null;const p=c.eventKey,u=c.children,m=c.className,f=c.onClick;return n.jsxRuntimeExports.jsxs(d.Fragment,{children:[n.jsxRuntimeExports.jsx(l,{...c,className:n.classNames({active:e===p},m),onClick:()=>{t(p),f&&f(p)},vertical:o||s,children:u}),s&&i<r.length-1&&n.jsxRuntimeExports.jsx("div",{className:n.classNames("join-line",eu.joinLine)})]},c.eventKey)})}),tu="_tab_1tbi7_1",nu="_disabled_1tbi7_7",ru="_vertical_1tbi7_13",$n={tab:tu,disabled:nu,vertical:ru},Pr=({eventKey:e,className:t,onClick:r,disabled:o,vertical:s,children:a})=>n.jsxRuntimeExports.jsx("div",{role:"button",className:n.classNames("luminus-tab text-primary rounded",$n.tab,t,{disabled:o},{[$n.disabled]:o},{vertical:s},{[$n.vertical]:s}),onClick:()=>r&&!o&&r(e),children:typeof a=="string"?n.jsxRuntimeExports.jsx(n.Typography,{variant:s?"body":"h6",className:s?"":"text-primary",children:a}):a}),ou=({tabs:e,activeTab:t,onSelect:r,...o})=>{var i;const{ProjectIconComponent:s}=d.useContext(n.LuminusComponentsContext),{isMobile:a}=n.useWindowSize();return a?n.jsxRuntimeExports.jsx(n.Dropdown,{toggle:n.jsxRuntimeExports.jsx(n.DropdownToggle,{as:n.SimpleDropdownToggle,text:((i=e.find(l=>l.id===t))==null?void 0:i.name)??"",icon:n.jsxRuntimeExports.jsx(s,{icon:"chevron-down"})}),...o,children:e.map(l=>n.jsxRuntimeExports.jsx(n.DropdownItem,{onClick:()=>r(l.id),children:l.name},l.id))}):n.jsxRuntimeExports.jsx(Tr,{activeTab:t,onSelect:l=>r(l),...o,children:e.map(l=>n.jsxRuntimeExports.jsx(Pr,{eventKey:l.id,children:l.name},l.id))})},su="_selection_1dtmm_1",au="_selectionBg_1dtmm_10",iu="_selectionItemsContainer_1dtmm_18",lu="_selectionItems_1dtmm_18",ln={selection:su,selectionBg:au,selectionItemsContainer:iu,selectionItems:lu},kr=({icon:e,setIcon:t,IconComponent:r,IconTypeArray:o})=>{const[s,a]=d.useState(!1),i=l=>{t(l),a(!1)};return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(n.IconButton,{className:"rounded m-1",onClick:()=>a(!0),children:n.jsxRuntimeExports.jsx(r,{icon:e})}),s&&n.jsxRuntimeExports.jsxs("div",{className:ln.selection,children:[n.jsxRuntimeExports.jsx("div",{className:ln.selectionBg,onClick:()=>a(!1)}),n.jsxRuntimeExports.jsx("div",{className:ln.selectionItemsContainer,children:n.jsxRuntimeExports.jsx("div",{className:ln.selectionItems,children:o.filter((l,c,p)=>p.indexOf(l)===c).map(l=>n.jsxRuntimeExports.jsx(n.IconButton,{className:"rounded",onClick:()=>i(l),children:n.jsxRuntimeExports.jsx(r,{icon:l})},l))})})]})]})},Ar=()=>{const e=d.useContext(n.ShortcutLinksContext);if(e===void 0)throw new Error("ShortcutLinksProvider not initilized. Probably tried to use useShortcutLinks outside ShortcutLinksProvider.");return e},cu=({shortcutLink:e,IconComponent:t,IconTypeArray:r,editShortcutLink:o})=>{const{ProjectIconComponent:s}=d.useContext(n.LuminusComponentsContext),[a,i]=d.useState(e.icon),[l,c]=d.useState(e.name);console.log(a,typeof a);const p=d.useMemo(()=>!(a===e.icon&&l===e.name),[a,l,e.icon,e.name]),u=d.useCallback(()=>{i(e.icon),c(e.name)},[e]),m=d.useCallback(()=>{o({...e,icon:a,name:l})},[o,a,l,e]);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("td",{className:"align-middle",children:n.jsxRuntimeExports.jsx(n.TextInput,{type:"text",maxLength:20,value:l,onChange:c,className:"d-flex-grow-1",InputContainer:n.NoInputContainer})}),n.jsxRuntimeExports.jsx("td",{className:"align-middle text-center",children:n.jsxRuntimeExports.jsx(kr,{icon:a,setIcon:i,IconComponent:t,IconTypeArray:r})}),n.jsxRuntimeExports.jsx("td",{className:"align-middle",style:{width:"7em"},children:p&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(n.IconButton,{onClick:u,color:"danger",className:"d-inline mx-2",children:n.jsxRuntimeExports.jsx(s,{icon:"cancel"})}),n.jsxRuntimeExports.jsx(n.IconButton,{onClick:m,color:"success",className:"d-inline mx-2",children:n.jsxRuntimeExports.jsx(s,{icon:"check"})})]})})]})},uu=({shortcutLink:e,IconComponent:t,IconTypeArray:r,editShortcutLink:o,deleteShortcutLink:s})=>{const{ProjectIconComponent:a}=d.useContext(n.LuminusComponentsContext),i=d.useCallback(()=>{s(e.id)},[s,e.id]);return n.jsxRuntimeExports.jsx("tr",{className:"mb-3",children:n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("td",{className:"align-middle",children:n.jsxRuntimeExports.jsx(n.IconButton,{onClick:i,color:"danger",children:n.jsxRuntimeExports.jsx(a,{icon:"delete"})})}),n.jsxRuntimeExports.jsx("td",{className:"align-middle",children:e.url.length<=23?e.url:n.jsxRuntimeExports.jsx(n.SimpleTooltip,{placement:"bottom",text:e.url,children:n.jsxRuntimeExports.jsxs("span",{children:[e.url.slice(0,21),"..."]})})}),n.jsxRuntimeExports.jsx(cu,{shortcutLink:e,IconComponent:t,IconTypeArray:r,editShortcutLink:o})]})})},du=({IconComponent:e,IconTypeArray:t})=>{const{texts:r}=d.useContext(n.LuminusComponentsContext),{shortcutLinks:o,editShortcutLink:s,deleteShortcutLink:a}=Ar();return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:o!==null&&o.length>0?n.jsxRuntimeExports.jsxs(Ml,{title:r.shortcutLinks.shortcutLinksSetting,children:[n.jsxRuntimeExports.jsx("thead",{className:"fw-bold",children:n.jsxRuntimeExports.jsxs("tr",{children:[n.jsxRuntimeExports.jsx("th",{}),n.jsxRuntimeExports.jsx("th",{children:r.shortcutLinks.target}),n.jsxRuntimeExports.jsx("th",{children:r.shortcutLinks.name}),n.jsxRuntimeExports.jsx("th",{children:r.shortcutLinks.icon}),n.jsxRuntimeExports.jsx("th",{})]})}),n.jsxRuntimeExports.jsx("tbody",{children:o==null?void 0:o.map(i=>n.jsxRuntimeExports.jsx(uu,{shortcutLink:i,IconComponent:e,IconTypeArray:t,editShortcutLink:s,deleteShortcutLink:a},i.id))})]}):n.jsxRuntimeExports.jsx(n.Alert,{variant:"info",children:r.shortcutLinks.addLinksToEditThemHereInfo})})},fr=5,pu="_linkButton_pnlvi_1",mu="_linkAddButton_pnlvi_31",fu="_createLinkRow_pnlvi_39",bt={linkButton:pu,linkAddButton:mu,createLinkRow:fu},xu=({shortcutLink:e,IconComponent:t})=>n.jsxRuntimeExports.jsx(n.SimpleTooltip,{text:e.name,placement:"bottom",children:n.jsxRuntimeExports.jsx(oe.Link,{to:e.url,className:bt.linkButton,children:n.jsxRuntimeExports.jsx(t,{icon:e.icon})})}),gu=({closeModal:e,isOpen:t,createLink:r,pageTitlePrefix:o,IconComponent:s,IconTypeArray:a})=>{const i=oe.useLocation(),{texts:l}=d.useContext(n.LuminusComponentsContext),[c,p]=d.useState("star-outline"),[u,m]=d.useState(o?document.title.replace(o,""):document.title),f=d.useCallback(async()=>{await r({icon:c,name:u,url:i.pathname+i.search}),e()},[e,r,c,i.pathname,i.search,u]),x=d.useMemo(()=>i.pathname+i.search,[i.pathname,i.search]);return n.jsxRuntimeExports.jsx(n.Modal,{show:t,onHide:e,size:"sm",children:n.jsxRuntimeExports.jsxs("div",{onKeyDown:g=>{g.code!=="Escape"&&g.stopPropagation()},children:[n.jsxRuntimeExports.jsx(n.Modal.Header,{closeButton:!0,children:n.jsxRuntimeExports.jsx(n.Modal.Title,{children:l.shortcutLinks.newShortcut})}),n.jsxRuntimeExports.jsxs(n.Modal.Body,{children:[n.jsxRuntimeExports.jsxs("div",{className:bt.createLinkRow,children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"form-label",className:"pe-3 text-end",children:l.shortcutLinks.target}),n.jsxRuntimeExports.jsx("div",{className:"d-flex align-items-middle fw-bold text-muted",children:x.length<=23?x:n.jsxRuntimeExports.jsx(n.SimpleTooltip,{placement:"bottom",text:x,children:n.jsxRuntimeExports.jsxs("span",{children:[x.slice(0,21),"..."]})})})]}),n.jsxRuntimeExports.jsxs("div",{className:bt.createLinkRow,children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"form-label",className:"pe-3 text-end",children:l.shortcutLinks.name}),n.jsxRuntimeExports.jsx("div",{className:"d-flex align-items-middle fw-bold",children:n.jsxRuntimeExports.jsx(n.TextInput,{type:"text",maxLength:25,value:u,onChange:m,className:"w-100",InputContainer:n.RowLabelInput,withoutLabel:!0})})]}),n.jsxRuntimeExports.jsxs("div",{className:bt.createLinkRow,children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"form-label",className:"pe-3 text-end",children:l.shortcutLinks.icon}),n.jsxRuntimeExports.jsx("div",{className:"d-flex align-items-middle fw-bold",children:n.jsxRuntimeExports.jsx(kr,{icon:c,setIcon:p,IconComponent:s,IconTypeArray:a})})]})]}),n.jsxRuntimeExports.jsx(n.Modal.Footer,{className:"d-flex justify-content-end",children:n.jsxRuntimeExports.jsx(n.PrimaryButton,{onClick:f,children:l.shortcutLinks.addShortcut})})]})})},vu=({IconComponent:e,IconTypeArray:t,pageTitlePrefix:r,createLink:o})=>{const{ProjectIconComponent:s,texts:a}=d.useContext(n.LuminusComponentsContext),[i,l]=d.useState(!1),[c]=n.a(i,100);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(n.SimpleTooltip,{text:a.shortcutLinks.addShortcut,placement:"bottom",children:n.jsxRuntimeExports.jsx("button",{type:"button",className:n.classNames(bt.linkButton,bt.linkAddButton),onClick:()=>l(!0),children:n.jsxRuntimeExports.jsx(s,{icon:"add"})})}),(i||c)&&n.jsxRuntimeExports.jsx(gu,{IconComponent:e,IconTypeArray:t,closeModal:()=>l(!1),createLink:o,isOpen:i,pageTitlePrefix:r})]})},hu=({IconComponent:e,IconTypeArray:t,pageTitlePrefix:r})=>{const{shortcutLinks:o,createShortcutLink:s}=Ar(),a=d.useMemo(()=>o!==null&&o.length<fr,[o]);return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-2",children:[o==null?void 0:o.slice(0,fr).map((i,l)=>i!==null?n.jsxRuntimeExports.jsx(xu,{shortcutLink:i,IconComponent:e},l):null),a&&n.jsxRuntimeExports.jsx(vu,{IconComponent:e,IconTypeArray:t,pageTitlePrefix:r,createLink:s})]})})},bu=e=>{const t=n.useAxios(),{startLoading:r,stopLoading:o}=d.useContext(n.LoadingContext),s=d.useCallback(async l=>{r("submit-createShortcutLink");try{await t.post(`/dynamicForms/insert?referenceId=${e}`,l)}finally{o("submit-createShortcutLink")}},[t,e,r,o]),a=d.useCallback(async l=>{r("submit-updateShortcutLink");try{await t.post(`/dynamicForms/update?referenceId=${e}`,l)}finally{o("submit-updateShortcutLink")}},[t,e,r,o]),i=d.useCallback(async l=>{r("delete-deleteShortcutLink");try{await t.delete(`/dynamicForms/delete?referenceId=${e}&pk=${l.toString()}`)}finally{o("delete-deleteShortcutLink")}},[t,e,r,o]);return{create:s,update:a,remove:i}},ju=e=>{if(e==null)throw new Error("Tried to make operation on null shortcutLinks.");return e},Lo=e=>{if(e==null)throw new Error("Tried to make operation on null shortcutLinks.");return e},Eu=({children:e,referenceId:t})=>{const{user:r}=d.useContext(n.UserContext),o=d.useCallback(x=>x.map(g=>({id:g.id,icon:g.icon,name:g.name,url:g.url})),[]),{data:s,reloadData:a}=_e.useGetApiData(`/dynamicForms/lookup-data-all?referenceId=${t}&employee=${r==null?void 0:r.personalNumber}`,{silent:!0,dataTransformer:o,enabled:r!==null}),{create:i,update:l,remove:c}=bu(t),p=d.useCallback(async x=>{const g=Lo(r);if(ju(s).length>=fr)throw new Error("Cannot add more shortcut links.");await i({...x,employee:g.personalNumber}),await a()},[i,a,s,r]),u=d.useCallback(async x=>{const g=Lo(r);await l({...x,employee:g.personalNumber}),await a()},[a,l,r]),m=d.useCallback(async x=>{await c(x),await a()},[a,c]),f=d.useMemo(()=>({shortcutLinks:s,createShortcutLink:p,editShortcutLink:u,deleteShortcutLink:m}),[p,m,u,s]);return n.jsxRuntimeExports.jsx(n.ShortcutLinksContext.Provider,{value:f,children:e})},yu=({targets:e,removeNotifTarget:t})=>{const{ProjectIconComponent:r}=d.useContext(n.LuminusComponentsContext);return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:e&&e.sort((o,s)=>(o.employeeId??0)-(s.employeeId??0)).map(o=>n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-2 align-items-center justify-content-between mb-1",children:[n.jsxRuntimeExports.jsx("div",{className:"text-secondary",children:n.jsxRuntimeExports.jsx("span",{className:"d-flex gap-2 ",children:o.employeeId&&o.roleName===null?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(r,{icon:"user"}),n.jsxRuntimeExports.jsx(n.Typography,{variant:"subtitle",children:o.employeeName})]}):n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(r,{icon:"role"}),n.jsxRuntimeExports.jsx(n.Typography,{variant:"subtitle",children:o.roleName})]})})}),n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",color:"danger",onClick:()=>t(o.id),children:n.jsxRuntimeExports.jsx(r,{icon:"delete"})})]},o.id))})},Ru=({show:e,onHide:t,roles:r,onAddTarget:o,EmployeePicker:s,templateId:a})=>{const{texts:{notifCentrum:i}}=d.useContext(n.LuminusComponentsContext),[l,c]=d.useState(null),[p,u]=d.useState(null),[m,f]=d.useState("R"),x=d.useCallback(()=>{c(null),u(null),t()},[t]);return n.jsxRuntimeExports.jsxs(n.Modal,{show:e,onHide:()=>x(),children:[n.jsxRuntimeExports.jsx(n.Modal.Header,{closeButton:!0,children:n.jsxRuntimeExports.jsx(n.Modal.Title,{children:i.addNewTarget})}),n.jsxRuntimeExports.jsxs(n.Modal.Body,{children:[n.jsxRuntimeExports.jsx(Pa,{options:[{id:"E",name:i.employee},{id:"R",name:i.role}],value:m,onChange:g=>f(g),InputContainer:n.RowLabelInput}),m==="E"?n.jsxRuntimeExports.jsx(s,{InputContainer:n.RowLabelInput,label:i.employee,value:{id:(l==null?void 0:l.id)??null,name:(l==null?void 0:l.name)??""},onSelect:g=>c({id:Number(g==null?void 0:g.id)??null,name:(g==null?void 0:g.name)??""})}):n.jsxRuntimeExports.jsx(n.CustomSelectInput,{InputContainer:n.RowLabelInput,label:i.role,options:r.map(g=>({id:g,name:g})),value:p,onChange:g=>u((g==null?void 0:g.toString())??"")})]}),n.jsxRuntimeExports.jsx(n.Modal.Footer,{className:"d-flex justify-content-end",children:n.jsxRuntimeExports.jsx(n.PrimaryButton,{onClick:()=>{o({templateId:a??0,targetId:null,employeeId:(l==null?void 0:l.id)??null,roleName:p},(l==null?void 0:l.name)??null),x()},children:i.add})})]})},Cu=({templates:e,selectedTemplateId:t,setSelectedTemplateId:r,roles:o,onAddNotifTarget:s,onRemoveNotifTarget:a,EmployeePicker:i})=>{const{texts:{notifCentrum:l},ProjectIconComponent:c}=d.useContext(n.LuminusComponentsContext),[p,u]=d.useState(!1);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(n.ListGroup,{className:"overflow-auto h-max-100 p-2",children:e.map(m=>n.jsxRuntimeExports.jsxs(n.ListGroup.Item,{action:t!==m.id,className:`p-0 mb-2 border rounded shadow-sm ${t===m.id?"border-1 border-primary":""}`,onClick:()=>r(m.id),children:[n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-2 justify-content-between align-items-center border-1 border-bottom border-primary p-2",children:[n.jsxRuntimeExports.jsx("div",{className:"text-primary",children:m.destinationId===1?n.jsxRuntimeExports.jsx(c,{icon:"mail-envelope"}):n.jsxRuntimeExports.jsx(c,{icon:"dashboard"})}),n.jsxRuntimeExports.jsx(n.Typography,{className:"text-truncate text-primary",variant:"subtitle",children:m.subjectTemplate}),n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",onClick:()=>u(!0),children:n.jsxRuntimeExports.jsx(c,{icon:"add"})})]}),n.jsxRuntimeExports.jsx("div",{className:"my-2 ps-3 pe-2",children:m.targets.length>0?n.jsxRuntimeExports.jsx(yu,{targets:m.targets,removeNotifTarget:a}):n.jsxRuntimeExports.jsx(n.Alert,{size:"sm",variant:"warning",children:l.noTargets})})]},m.id))}),n.jsxRuntimeExports.jsx(Ru,{show:p,onHide:()=>u(!1),roles:o??[],onAddTarget:s,EmployeePicker:i,templateId:t})]})},Nu=({data:e,onClick:t,BnfTableComponent:r})=>{const{texts:{notifCentrum:o}}=d.useContext(n.LuminusComponentsContext),s=d.useMemo(()=>e==null?void 0:e.map(l=>{var c;return{...l,recipientsString:((c=l.recipients)==null?void 0:c.map(p=>p.name).join(", "))??""}}),[e]),a=d.useMemo(()=>[{caption:o.date,fieldName:"date",type:"date"},{caption:o.recipients,fieldName:"recipientsString",type:"string"},{caption:o.subject,fieldName:"subject",type:"string",isVisible:!1},{caption:"Id",fieldName:"id",type:"number",isVisible:!1}],[o]),i=d.useCallback(l=>{t(l.id)},[t]);return n.jsxRuntimeExports.jsx(r,{columnsDef:a,data:s,useScrollableContainer:!0,onRowClick:i,bottomBarProps:{hidden:!0}})},wu=({kinds:e,reloadActions:t,reloadHistory:r,reloadRoles:o,onRemoveTarget:s,onPostTarget:a,EmployeePicker:i,BnfTableComponent:l})=>{var T,A;const{texts:{notifCentrum:c}}=d.useContext(n.LuminusComponentsContext),{confirm:p}=n.useConfirm(),[u,m]=d.useState(null),[f,x]=d.useState(null),[g,b]=_e.useLocalStorageState("notif-kind-id",null);d.useEffect(()=>{var R;e.length>0?b(((R=e.at(0))==null?void 0:R.id)??null):b(null)},[e,b]);const[v,h]=d.useState([]);d.useEffect(()=>{g&&t(g).then(R=>{h(R)}).catch(R=>{console.log(R),h([])})},[t,g]);const[y,C]=_e.useLocalStorageState("notif-action-id",((T=v==null?void 0:v.at(0))==null?void 0:T.id)??null),[E,j]=d.useState([]);d.useEffect(()=>{y===null||u===null||r(y,u).then(R=>{j(R)}).catch(R=>{console.log(R),j([])})},[t,r,y,g,u]);const[S,D]=d.useState([]);d.useEffect(()=>{y!==null&&o(y).then(R=>{D(R)}).catch(R=>{console.log(R),D([])})},[o,y]);const I=d.useMemo(()=>{var R;return!v||!y?[]:((R=v.find(O=>O.id===y))==null?void 0:R.templates)??[]},[v,y]),w=d.useCallback((R,O)=>{a(R,O).then(F=>{h(v?[...v.map(k=>k.id!==y?k:{...k,templates:[...k.templates.map(M=>M.id!==u?M:{...M,targets:[...M.targets,F]})]})]:[])}).catch(F=>console.log(F))},[v,a,y,u,h]),_=d.useCallback(async R=>{await p(c.confirmTargetDelete)&&s(R).then(()=>h(v?[...v.map(O=>O.id!==y?O:{...O,templates:[...O.templates.map(F=>F.id!==u?F:{...F,targets:F.targets.filter(k=>k.id!==R)})]})]:[]))},[v,p,c,s,y,u]);return n.jsxRuntimeExports.jsxs("div",{className:"h-100 overflow-hidden",children:[n.jsxRuntimeExports.jsxs("div",{className:"row mb-2",children:[n.jsxRuntimeExports.jsx("div",{className:"col-2",children:n.jsxRuntimeExports.jsx(n.CustomSelectInput,{label:c.kind,size:"sm",noEmptyOption:!0,options:(e==null?void 0:e.map(R=>({id:R.id,name:R.name})))??[],value:g??null,onChange:R=>b(Number(R)),dropdownWidth:200})}),n.jsxRuntimeExports.jsx("div",{className:"col-3",children:n.jsxRuntimeExports.jsx(n.CustomSelectInput,{label:c.subkind,size:"sm",noEmptyOption:!0,options:(v==null?void 0:v.map(R=>({id:R.id,name:R.name})))??[],value:y??null,onChange:R=>C(Number(R)),dropdownWidth:250})})]}),n.jsxRuntimeExports.jsxs("div",{className:"vh-100 overflow-hidden d-flex gap-1",children:[n.jsxRuntimeExports.jsx("div",{className:"h-75 w-25 overflow-hidden",children:n.jsxRuntimeExports.jsx(Cu,{templates:I,roles:S??[],onAddNotifTarget:w,onRemoveNotifTarget:_,selectedTemplateId:u,setSelectedTemplateId:R=>{m(R),x(null)},EmployeePicker:i})}),n.jsxRuntimeExports.jsx("div",{className:"w-25 h-75 overflow-hidden",children:u&&n.jsxRuntimeExports.jsx(Nu,{data:E??[],onClick:R=>x((E==null?void 0:E.find(O=>O.id===R))??null),BnfTableComponent:l})}),u&&n.jsxRuntimeExports.jsx("div",{className:"h-75 w-75 overflow-hidden bg-darker",children:n.jsxRuntimeExports.jsx("iframe",{title:"notification",className:"w-100 h-100",srcDoc:(f==null?void 0:f.message)??((A=I.find(R=>R.id===u))==null?void 0:A.textTemplate)})})]})]})},Su=({history:e,onClick:t,BnfTableComponent:r})=>{const{texts:{notifCentrum:o}}=d.useContext(n.LuminusComponentsContext),s=d.useMemo(()=>[{caption:"notificationHistory.id",fieldName:"id",type:"number",isVisible:!1},{caption:"notificationHistory.recipientId",fieldName:"recipientId",type:"number",isVisible:!1},{caption:"notificationHistory.recipientFullName",fieldName:"recipientFullName",type:"string",isVisible:!1},{caption:"notificationHistory.actionKindId",fieldName:"actionKindId",type:"number",isVisible:!1},{caption:o.subkind,fieldName:"actionKindName",type:"string",filterType:"select"},{caption:"notificationHistory.actionId",fieldName:"actionId",type:"number",isVisible:!1},{caption:o.subkind,fieldName:"actionName",type:"string",filterType:"select"},{caption:o.date,fieldName:"date",type:"string"},{caption:o.subject,fieldName:"subject",type:"string"},{caption:"notificationHistory.message",fieldName:"message",type:"string",isVisible:!1}],[o]),a=d.useCallback(i=>{t(i.id)},[t]);return n.jsxRuntimeExports.jsx(r,{columnsDef:s,data:e,useScrollableContainer:!0,paginationMode:"enabled",bottomBarProps:{hideFullScreen:!0},onRowClick:a})},Du=({reloadUserHistory:e,EmployeePicker:t,BnfTableComponent:r})=>{const{texts:{notifCentrum:o}}=d.useContext(n.LuminusComponentsContext),[s,a]=d.useState(null),[i,l]=_e.useLocalStorageState("notif-user",null),[c,p]=d.useState([]);return d.useEffect(()=>{i!==null&&e(i.id).then(u=>{p(u)}).catch(u=>{console.log(u),p([])})},[i,e]),n.jsxRuntimeExports.jsxs("div",{className:"h-100 overflow-hidden d-flex flex-column gap-1",children:[n.jsxRuntimeExports.jsx("div",{className:"row",children:n.jsxRuntimeExports.jsx("div",{className:"col-3",children:n.jsxRuntimeExports.jsx(t,{label:o.employee,value:i,size:"sm",onSelect:u=>l(u?{id:Number(u.id),name:u.name}:null)})})}),n.jsxRuntimeExports.jsxs("div",{className:"vh-100 overflow hidden row",children:[n.jsxRuntimeExports.jsx("div",{className:"col-5 h-75 overflow-hidden",children:n.jsxRuntimeExports.jsx(Su,{history:c??[],onClick:u=>a((c==null?void 0:c.find(m=>m.id===u))??null),BnfTableComponent:r})}),s&&n.jsxRuntimeExports.jsx("div",{className:"col bg-darker h-75",children:n.jsxRuntimeExports.jsx("iframe",{title:"notification",className:"w-100 h-100",srcDoc:s==null?void 0:s.message})})]})]})},Ba=({result:e,onClose:t,tableIdentifier:r,BnfTableComponent:o})=>{var l,c,p,u,m;const{texts:{imports:s},ProjectIconComponent:a}=d.useContext(n.LuminusComponentsContext),i=d.useMemo(()=>[{fieldName:"row",caption:s.row,type:"number",width:100},{fieldName:"column",caption:s.column,type:"number",width:100},{fieldName:"error",caption:s.error,type:"string",width:500}],[s.row,s.column,s.error]);return e?n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:n.jsxRuntimeExports.jsx(n.Alert,{variant:e.success?"success":"danger",size:"sm",className:"mb-2 p-2",children:n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-3 align-items-start",children:[n.jsxRuntimeExports.jsxs("div",{className:"w-100",children:[n.jsxRuntimeExports.jsx("div",{className:"w-100 text-center",children:e.success?s.importSuccess:s.importFailed}),e.success&&((l=e.data)!=null&&l.added||(c=e.data)!=null&&c.updated||(p=e.data)!=null&&p.deleted)?n.jsxRuntimeExports.jsx("div",{className:"d-flex justify-content-center mt-2",children:n.jsxRuntimeExports.jsxs("div",{className:"list-group",children:[e.data.added?n.jsxRuntimeExports.jsx("div",{className:"list-group-item p-1 px-3",children:n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body2",className:"d-flex gap-2 align-items-center",children:[s.importAdded(e.data.added)," "]})}):null,e.data.updated?n.jsxRuntimeExports.jsx("div",{className:"list-group-item p-1 px-3",children:n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body2",className:"d-flex gap-2 align-items-center",children:[s.importUpdated(e.data.updated)," "]})}):null,e.data.deleted?n.jsxRuntimeExports.jsx("div",{className:"list-group-item p-1 px-3",children:n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body2",className:"d-flex gap-2 align-items-center",children:[s.importDeleted(e.data.deleted)," "]})}):null]})}):null,!e.success&&((m=(u=e.data)==null?void 0:u.errors)==null?void 0:m.length)>0?n.jsxRuntimeExports.jsx("div",{className:"mt-3",children:n.jsxRuntimeExports.jsx(o,{columnsDef:i,data:e.data.errors,useScrollableContainer:!0,tableId:r})}):null]}),t!==void 0?n.jsxRuntimeExports.jsx(n.IconButton,{color:e.success?"success":"danger",className:n.classNames("hover-darken",e.success?"bg-success-subtle":"bg-danger-subtle"),onClick:t,children:n.jsxRuntimeExports.jsx(a,{icon:"close"})}):null]})})}):null},Iu="_upload-box_9ka79_1",_u="_browse-btn_9ka79_15",Gn={"upload-box":"_upload-box_9ka79_1",uploadBox:Iu,"browse-btn":"_browse-btn_9ka79_15",browseBtn:_u},La=({file:e,onFileChange:t,onImport:r,children:o,multiple:s,accept:a})=>{const{ProjectIconComponent:i,texts:{imports:l}}=d.useContext(n.LuminusComponentsContext),c=d.useCallback(async u=>{u.length>0&&t(s===!0?[...u]:u[0])},[e,s,t]),p=d.useCallback(u=>{var f;u.preventDefault();const m=(f=u.dataTransfer)==null?void 0:f.files;m&&(m==null?void 0:m.length)>0&&c(m)},[c]);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[e!==null?n.jsxRuntimeExports.jsxs("div",{className:"d-flex border rounded p-1 ps-2 bg-white justify-content-between align-items-center mb-2",children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",children:s?e.map(u=>u.name).join(", "):e.name}),n.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-center gap-3",children:[o??null,n.jsxRuntimeExports.jsx(n.PrimaryButton,{className:"text-nowrap",size:"sm",disabled:e===null,onClick:r,children:l.start})]})]}):null,n.jsxRuntimeExports.jsxs("div",{className:n.classNames(Gn.uploadBox,{[Gn.active]:e!==null}),onDrop:p,onDragOver:u=>u.preventDefault(),children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",children:l.dropHint}),n.jsxRuntimeExports.jsx("input",{type:"file",hidden:!0,id:"browse",onChange:u=>{var m;return((m=u.target)==null?void 0:m.files)&&c(u.target.files)},multiple:s,accept:a}),n.jsxRuntimeExports.jsx("label",{htmlFor:"browse",className:Gn.browseBtn,children:n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body",className:"d-flex gap-2 align-items-center",children:[n.jsxRuntimeExports.jsx(i,{icon:"file-upload"}),l.pickFileHint]})})]})]})},Ou=({otherSettingId:e,languageOptions:t,tableIdentifier:r,SettingsOutlet:o,BnfTableComponent:s,importLocalization:a})=>{const{texts:{localizations:i}}=d.useContext(n.LuminusComponentsContext),[l,c]=d.useState(t[0].id),[p,u]=d.useState(null),[m,f]=d.useState(null),x=d.useCallback(async()=>{if(p===null)return;const g=await a({file:p,lang:l});g.status==="success"&&f(g.data)},[a,l,p]);return n.jsxRuntimeExports.jsx(o,{itemId:e,title:i.localizationImport,children:m?n.jsxRuntimeExports.jsx(Ba,{result:m,onClose:()=>f(null),BnfTableComponent:s,tableIdentifier:r}):n.jsxRuntimeExports.jsx(La,{file:p,onFileChange:u,onImport:x,children:n.jsxRuntimeExports.jsx("div",{style:{minWidth:140},children:n.jsxRuntimeExports.jsx(n.CustomSelectInput,{value:l,onChange:g=>typeof g=="string"?c(g):null,options:t,label:i.importedLanguage})})})})},Tu=(e,t)=>{const r=t.split(".");let o=e;for(let s=0;s<r.length;s++){const a=r[s],i=o[a];if(typeof i=="string")return i;if(i===void 0)return;o=i}},Pu=({selLng:e,lngsData:t,localizationKey:r,reloadData:o,saveChanges:s})=>{const{ProjectIconComponent:a}=d.useContext(n.LuminusComponentsContext),i=d.useMemo(()=>{const m=t.get(e);if(m===void 0)return"";const f=Tu(m,r);return m!==void 0&&f!==void 0?f:""},[t,r,e]),[l,c]=d.useState(i),p=d.useCallback(async()=>{await s([{fileName:e+".json",items:[{key:r,value:l}]}]),await o()},[r,o,s,e,l]),u=d.useMemo(()=>l!==i,[i,l]);return n.jsxRuntimeExports.jsxs("div",{className:"d-flex",children:[n.jsxRuntimeExports.jsx(n.TextInput,{label:e+r,type:"text",value:l,onChange:m=>{c(typeof m!="string"?"":m)},InputContainer:n.RowLabelInput,withoutLabel:!0,className:"flex-grow-1"}),u?n.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-center gap-1",children:[n.jsxRuntimeExports.jsx(n.IconButton,{color:"danger",onClick:()=>c(i),children:n.jsxRuntimeExports.jsx(a,{icon:"cancel"})}),n.jsxRuntimeExports.jsx(n.IconButton,{onClick:p,children:n.jsxRuntimeExports.jsx(a,{icon:"check"})})]}):null]})},ku="_keysTable_1j6ns_1",Au="_subgrid_1j6ns_14",Mu="_lngSelectRow_1j6ns_19",Bu="_tableItem_1j6ns_26",Lu="_tableFooter_1j6ns_29",Fu="_tableFullWidth_1j6ns_35",Vu="_tableBody_1j6ns_39",$u="_lngSelect_1j6ns_19",Gu="_addLng_1j6ns_52",Wu="_fileSelect_1j6ns_57",Uu="_searchBox_1j6ns_61",Ce={keysTable:ku,subgrid:Au,lngSelectRow:Mu,tableItem:Bu,tableFooter:Lu,tableFullWidth:Fu,tableBody:Vu,lngSelect:$u,addLng:Gu,fileSelect:Wu,searchBox:Uu},cn=50,Hu=(e,t)=>{const r=t.split(".");let o=e;for(let s=0;s<r.length;s++){const a=r[s],i=o[a];if(typeof i=="string")return i;if(i===void 0)return;o=i}},zu=({languageOptions:e,envMode:t,getOtherSettingsUrl:r,downloadXls:o,saveChanges:s,localizationFilesOptions:a,remoteLocalesRoot:i})=>{const{texts:{localizations:l},ProjectIconComponent:c}=d.useContext(n.LuminusComponentsContext),[p,u]=d.useState(1),[m,f]=d.useState(new Map),[x,g]=d.useState(null),[b,v]=d.useState(""),[h,y]=d.useState(new Set),C=d.useCallback(R=>{f(new Map),y(R)},[]),E=d.useMemo(()=>e.filter(R=>!h.has(R.id)),[h,e]),j=d.useMemo(()=>{if(m.size===0)return[];const R=new Set,O=(L,$="")=>{if(typeof L[1]=="object"){Object.entries(L[1]).forEach(U=>O(U,$+L[0]+"."));return}R.add($+L[0])};Array.from(m).forEach(L=>{Object.entries(L[1]).forEach($=>O($))});const F=Array.from(R),k=a.find(L=>L.path===x);return((k==null?void 0:k.type)==="report"?F.filter(L=>{const $=L.split(".");return $[$.length-1]==="caption"}):F).map(L=>({key:L,lngData:new Map(Array.from(h).map($=>{const U=m.get($);return[$,(U===void 0?void 0:Hu(U,L))??""]}))}))},[m,a,x,h]),S=d.useMemo(()=>j.filter(R=>n.stringSearchWithin(R.key,b)||Array.from(R.lngData).some(O=>typeof(O==null?void 0:O[1])!="string"?!1:n.stringSearchWithin((O==null?void 0:O[1])??"",b))),[b,j]),D=d.useMemo(()=>Math.ceil(S.length/cn),[S.length]),I=d.useCallback(R=>{R!==null&&u(()=>Math.max(1,Math.min(R,D)))},[D]),w=d.useCallback(async()=>{if(x===null)return;const R=Array.from(h).map(F=>(async()=>{const k=await n.axios.get(`${i}${x==null?void 0:x.replace("{{lng}}",F)}&v=${new Date().getTime()}`,{responseType:"json"});return[F,k.data]})()),O=await Promise.allSettled(R);f(new Map(O.map(F=>F.status==="fulfilled"?F.value:["",{}])))},[i,x,h]),_=d.useCallback(async()=>{w()},[w]),T=d.useMemo(()=>E.length>0,[E.length]),A=d.useMemo(()=>h.size+1+(T?1:0),[T,h.size]);return d.useEffect(()=>{I(p)},[I,p,S]),d.useEffect(()=>{w()},[w]),i===void 0?n.jsxRuntimeExports.jsx(n.PageContainer,{children:n.jsxRuntimeExports.jsxs(n.Alert,{variant:"danger",className:"fw-bold",children:[l.cantRunLocalizationSettings,n.jsxRuntimeExports.jsx("br",{}),n.jsxRuntimeExports.jsx("br",{}),l.envNotConnectedToRemote(t.toUpperCase())]})}):n.jsxRuntimeExports.jsx(n.PageContainer,{title:n.jsxRuntimeExports.jsx("div",{className:"d-flex gap-4",children:n.jsxRuntimeExports.jsx(n.Typography,{variant:"h3",children:l.localizationSettings})}),helmet:l.localizationSettings,variant:"fullScreen",children:n.jsxRuntimeExports.jsxs("div",{className:Ce.keysTable,style:{"--keys-table-columns":A,"--adding-column":T?1:0},children:[n.jsxRuntimeExports.jsxs("div",{className:n.classNames(Ce.tableFullWidth,"d-flex align-items-center justify-content-between gap-2 px-2 mt-1"),children:[n.jsxRuntimeExports.jsx(n.CustomSelectInput,{options:a.map(R=>({id:R.path,name:R.nameTranslationKey})),value:x,onChange:R=>typeof R!="number"?g(R):null,size:"sm",label:l.localizationFile,className:Ce.fileSelect,noSortOptions:!0}),n.jsxRuntimeExports.jsxs("div",{className:n.classNames(Ce.searchBox,"d-flex align-items-center gap-2 border rounded"),children:[n.jsxRuntimeExports.jsx(c,{icon:"search",className:"text-muted",size:18,iconProps:{className:"mt- me-n4"}}),n.jsxRuntimeExports.jsx(n.TextInput,{type:"text",value:b,onChange:R=>v(typeof R=="string"?R:""),size:"sm",showClearIcon:b!=="",withoutLabel:!0,placeholder:"vyhledávat...",className:"placeholder-muted bg-transparent border-0 my-0 py-0 w-100"})]}),n.jsxRuntimeExports.jsxs(n.ResponsiveContextDropdown,{children:[n.jsxRuntimeExports.jsx(n.ResponsiveContextDropdownItem,{cKey:"export",hideOn:"always",onClick:o,icon:n.jsxRuntimeExports.jsx(n.FileExtensionIcon,{fileExtension:"xls"}),children:l.xlsExport}),n.jsxRuntimeExports.jsx(n.ResponsiveContextDropdownItem,{cKey:"import",hideOn:"always",to:r("localizationImport"),icon:n.jsxRuntimeExports.jsx(c,{icon:"link"}),children:l.import})]})]}),n.jsxRuntimeExports.jsxs("div",{className:n.classNames(Ce.subgrid,Ce.lngSelectRow),children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",children:l.key}),Array.from(h).map((R,O)=>n.jsxRuntimeExports.jsx(n.CustomSelectInput,{options:e.filter(F=>F.id===R||!h.has(F.id)),value:R,onChange:F=>C(k=>F===null?(k.delete(R),new Set(k)):(typeof F=="string"&&(k.delete(R),k.add(F)),new Set(k))),size:"sm",label:`${l.language} ${O+1}`,withoutLabel:!0,InputContainer:n.RowLabelInput,className:n.classNames(Ce.lngSelect)},R)),T?n.jsxRuntimeExports.jsx(n.CustomSelectInput,{options:E,value:null,onChange:R=>C(O=>(typeof R=="string"&&O.add(R),new Set(O))),size:"sm",label:l.addLanguage,InputContainer:n.RowLabelInput,className:n.classNames(Ce.lngSelect,Ce.addLng)}):null]}),n.jsxRuntimeExports.jsxs("div",{className:n.classNames(Ce.subgrid,Ce.tableBody),children:[j.length===0||S.length===0?n.jsxRuntimeExports.jsx(n.Alert,{variant:"warning",className:n.classNames(Ce.tableFullWidth,Ce.emptyTableAlert,"my-n1"),children:j.length===0?l.noDataLoaded:S.length===0?l.noDataFiltered:null}):null,S.slice(cn*(p-1),cn*p).map(R=>n.jsxRuntimeExports.jsxs("div",{className:n.classNames(Ce.subgrid,Ce.tableItem),children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"form-label",children:R.key}),Array.from(h).map(O=>n.jsxRuntimeExports.jsx(Pu,{localizationKey:R.key,lngsData:m,selLng:O,reloadData:_,saveChanges:s},O))]},R.key))]}),n.jsxRuntimeExports.jsxs("div",{className:n.classNames("d-flex align-items-center justify-content-around gap-3 px-2 py-0",Ce.tableFooter),children:[n.jsxRuntimeExports.jsx("div",{children:n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body",children:[l.keyCount,":"," ",n.jsxRuntimeExports.jsx("span",{className:"fw-bold",children:S.length})]})}),n.jsxRuntimeExports.jsxs("div",{className:"d-flex gap-1 align-items-center",children:[n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body",children:[l.page,": "]}),n.jsxRuntimeExports.jsxs("div",{className:"d-flex align-items-center gap-1",children:[n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",onClick:()=>I(p-1),children:n.jsxRuntimeExports.jsx(c,{icon:"minus"})}),n.jsxRuntimeExports.jsx("div",{style:{width:30},children:n.jsxRuntimeExports.jsx(Ta,{value:p,onChange:I,InputContainer:n.RowLabelInput,withoutLabel:!0,size:"sm"})}),n.jsxRuntimeExports.jsxs(n.Typography,{variant:"body",children:["/",Math.ceil(S.length/cn)]}),n.jsxRuntimeExports.jsx(n.IconButton,{size:"sm",onClick:()=>I(p+1),children:n.jsxRuntimeExports.jsx(c,{icon:"plus"})})]})]})]})]})})},Fo=3,Fa=(e,t,r)=>{var s;if((t==null?void 0:t.customPathBuilder)!==void 0)return t.customPathBuilder(e,t);const o=(s=r.find(a=>a.key===e.type))==null?void 0:s.toPath;return o?`${o}/${e.searchKey}`:"/not-found"},Va=(e,t)=>{var r;return((r=t==null?void 0:t.customNameBuilder)==null?void 0:r.call(t,e))??e.name},$a=(e,t,r,o,s)=>{const a=n.useAxios(),[i,l]=d.useState(!1),[c,p]=d.useState([]),u=e==="",m=d.useCallback(()=>{p([]),!(t.length<Fo)&&(l(!0),a.get(Qe.generateApiPath(r,{path:{query:t},query:{type:u?void 0:e,count:o?void 0:u?5:20}})).then(({data:g})=>{p(g),l(!1)}).catch(()=>{l(!1)}))},[a,o,u,t,r,e]),f=d.useMemo(()=>{if(s===void 0)return[];if(t.length<Fo&&e!=="XAP")return[];const g=[];return s.forEach(b=>{const v=b.items.filter(h=>n.stringSearchWithin(h.name,decodeURIComponent(t)));v.length>0&&g.push({key:{...b.key,totalCount:v.length},items:v})}),g},[t,s,e]),x=d.useMemo(()=>f.concat(c),[c,f]);return d.useEffect(()=>{m()},[m]),{isLoading:i,searchItems:x}},qu="_input-group_1hcpm_1",Yu="_input-group-text_1hcpm_5",Ku="_left_1hcpm_9",Xu="_right_1hcpm_13",Qu="_input_1hcpm_1",Ju="_submit-button_1hcpm_20",rt={"input-group":"_input-group_1hcpm_1",inputGroup:qu,"input-group-text":"_input-group-text_1hcpm_5",inputGroupText:Yu,left:Ku,right:Xu,input:Qu,"submit-button":"_submit-button_1hcpm_20",submitButton:Ju},Zu=({searchTypes:e,selectedType:t,setSelectedType:r})=>n.jsxRuntimeExports.jsx(n.Dropdown,{toggle:n.jsxRuntimeExports.jsx(n.DropdownToggle,{as:n.SimpleDropdownToggle,icon:null,text:t==null?void 0:t.text}),children:e.map(o=>n.jsxRuntimeExports.jsx(n.DropdownItem,{icon:null,onClick:()=>r(o.key),children:o.text},o.key))}),ed="_dropdown_1ddrg_1",td="_open_1ddrg_12",nd="_loading-container_1ddrg_15",rd="_groups-container_1ddrg_22",od="_group_1ddrg_22",sd="_header_1ddrg_26",ad="_item_1ddrg_33",lt={dropdown:ed,open:td,"loading-container":"_loading-container_1ddrg_15",loadingContainer:nd,"groups-container":"_groups-container_1ddrg_22",groupsContainer:rd,group:od,header:sd,item:ad},id=({item:e,searchTypes:t,onCancel:r})=>{const o=d.useMemo(()=>t.find(i=>i.key===e.type),[e.type,t]),s=d.useMemo(()=>Fa(e,o,t),[e,o,t]),a=d.useMemo(()=>Va(e,o),[e,o]);return n.jsxRuntimeExports.jsxs(oe.Link,{to:s,className:n.classNames("search-item d-flex gap-3 align-items-center justify-content-between",lt.item),onClick:r,children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body2",className:"text-nowrap text-truncate",children:a}),n.jsxRuntimeExports.jsx(n.Typography,{variant:"caption",className:"text-primary",children:n.jsxRuntimeExports.jsx(n.MdOutlineArrowOutward,{})})]})},ld=({show:e,query:t,onCancel:r,groups:o,isLoading:s,searchTypes:a})=>{const{texts:{appSearch:i}}=d.useContext(n.LuminusComponentsContext),l=d.useRef(null);return n.useClickOutside([l],r),n.jsxRuntimeExports.jsx("div",{ref:l,className:n.classNames("luminus-app-search-dropdown shadow rounded",lt.dropdown,{[lt.open]:e}),children:s?n.jsxRuntimeExports.jsx("div",{className:lt.loadingContainer,children:n.jsxRuntimeExports.jsx(n.Spinner,{animation:"border",variant:"primary"})}):n.jsxRuntimeExports.jsx("div",{className:lt.groupsContainer,children:o==null?void 0:o.map(c=>{var p;return n.jsxRuntimeExports.jsxs("div",{className:n.classNames(lt.group),children:[n.jsxRuntimeExports.jsxs(oe.Link,{to:`/search?query=${t}&type=${c.key.category}`,className:n.classNames("group-header",lt.header),onClick:r,children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",className:"text-primary",children:c.key.categoryName}),n.jsxRuntimeExports.jsxs(n.Typography,{variant:"caption",children:[c.items.length," ",i.amountFrom," ",c.key.totalCount]})]}),(p=c.items)==null?void 0:p.map((u,m)=>n.jsxRuntimeExports.jsx(id,{item:u,onCancel:r,searchTypes:a},m))]},c.key.category)})})})},cd=({searchTypes:e,navigateFunction:t,currentPath:r,homePath:o="/",className:s,staticAppItems:a,searchEndpointUri:i})=>{var E;const{texts:{appSearch:l}}=d.useContext(n.LuminusComponentsContext),[c,p]=d.useState(e.length>0?((E=e.at(0))==null?void 0:E.key)??null:null),u=d.useMemo(()=>e.find(j=>j.key===c)??null,[e,c]),[m,f]=d.useState(""),[x,g]=n.a(encodeURIComponent(m),500),{isLoading:b,searchItems:v}=$a(c,x,i,!1,a),[h,y]=d.useState(!1);d.useEffect(()=>{(v.length>0||b)&&y(!0)},[v,b]);const C=d.useRef(null);return d.useEffect(()=>{var j;f(""),r===o&&((j=C.current)==null||j.focus())},[r,o]),n.jsxRuntimeExports.jsx(n.Form,{className:"w-100 d-flex align-items-center justify-content-center",onSubmit:j=>{j.preventDefault(),j.stopPropagation(),g.flush(),y(!1),x.length>2&&t(`/search?query=${x}${u&&u.key&&`&type=${u==null?void 0:u.key}`}`)},children:n.jsxRuntimeExports.jsxs(gn,{className:n.classNames(rt.inputGroup,s),children:[n.jsxRuntimeExports.jsx(gn.Text,{className:n.classNames("p-1 rounded",rt.inputGroupText,rt.left),children:n.jsxRuntimeExports.jsx(Zu,{searchTypes:e,selectedType:u,setSelectedType:p})}),n.jsxRuntimeExports.jsx(n.Form.Control,{ref:C,placeholder:l.searchPlaceholder,type:"text",size:"sm",className:n.classNames("luminus-app-search-input",rt.input),value:m,onChange:j=>{var S;return f(((S=j.target)==null?void 0:S.value)??"")},onFocus:()=>v.length>0&&y(!0)}),n.jsxRuntimeExports.jsx(gn.Text,{className:n.classNames("p-0 rounded",rt.inputGroupText,rt.right),children:n.jsxRuntimeExports.jsx("button",{type:"submit",className:n.classNames("text-primary",rt.submitButton),children:n.jsxRuntimeExports.jsx(n.FaSearch,{})})}),n.jsxRuntimeExports.jsx(ld,{query:x,searchTypes:e,show:h,onCancel:()=>y(!1),groups:v,isLoading:b})]})})},ud=({item:e,searchTypes:t})=>{const{ProjectIconComponent:r}=d.useContext(n.LuminusComponentsContext),o=d.useMemo(()=>t.find(i=>i.key===e.type),[e.type,t]),s=d.useMemo(()=>Fa(e,o,t),[e,o,t]),a=d.useMemo(()=>Va(e,o),[e,o]);return n.jsxRuntimeExports.jsxs(oe.Link,{to:s,className:"text-nowrap list-group-item list-group-item-action d-flex justify-content-between align-items-center",children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",children:a}),n.jsxRuntimeExports.jsx(r,{icon:"chevron-right",className:"text-primary"})]})},dd=({query:e,type:t,appSearchTypes:r,searchEndpointUri:o,staticAppItems:s})=>{var u,m;const{texts:{appSearch:a}}=d.useContext(n.LuminusComponentsContext),[i,l]=d.useState(""),{searchItems:c,isLoading:p}=$a(t,e,o,!0,s);return d.useEffect(()=>{var f;i||c===null||c.length===0||l(((f=c[0].key)==null?void 0:f.category)??"")},[c,i]),c===null?null:n.jsxRuntimeExports.jsx(n.PageContainer,{variant:"fullScreen",children:p?n.jsxRuntimeExports.jsx(we.Loading,{}):c.length===0?n.jsxRuntimeExports.jsx("div",{className:"alert alert-warning",children:n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",children:a.noResultsFor(e)})}):n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(Tr,{activeTab:i,onSelect:f=>l((f==null?void 0:f.toString())??""),children:c.map(f=>{var x,g;return n.jsxRuntimeExports.jsx(Pr,{eventKey:((x=f.key)==null?void 0:x.category)??"",children:((g=f.key)==null?void 0:g.categoryName)??""},f.key.category)})}),n.jsxRuntimeExports.jsx(Ma,{eventKey:i,activeTab:i,fullHeightNoOverflow:!0,children:n.jsxRuntimeExports.jsx("div",{className:"list-group h-100 overflow-auto",children:(m=(u=c.find(f=>f.key.category===i))==null?void 0:u.items)==null?void 0:m.map((f,x)=>n.jsxRuntimeExports.jsx(ud,{item:f,searchTypes:r},x))})})]})})},pd="_widgets-row_13gg1_1",md="_widget_13gg1_1",fd="_widget-img_13gg1_5",xd="_widget-title-spacer_13gg1_14",gd="_widget-title_13gg1_14",vd="_title_13gg1_28",Me={"widgets-row":"_widgets-row_13gg1_1",widgetsRow:pd,widget:md,"widget-img":"_widget-img_13gg1_5",widgetImg:fd,"widget-title-spacer":"_widget-title-spacer_13gg1_14",widgetTitleSpacer:xd,"widget-title":"_widget-title_13gg1_14",widgetTitle:gd,title:vd},hd=({show:e,widgetGroups:t,widgets:r,handleClose:o,onWidgetPicked:s,texts:a})=>{const[i,l]=d.useState(""),c=d.useMemo(()=>r.filter(u=>u.id!==-1&&n.stringSearchWithin(u.name,i)),[r,i]),p=d.useMemo(()=>t.filter(u=>c.some(m=>m.group===u.id)),[t,c]);return n.jsxRuntimeExports.jsxs(n.Modal,{show:e,onHide:()=>o(),size:"lg",children:[n.jsxRuntimeExports.jsxs(n.Modal.Header,{closeButton:!0,children:[n.jsxRuntimeExports.jsx(n.Modal.Title,{className:"w-100",children:a.pickWidgetToAdd}),n.jsxRuntimeExports.jsx(n.Form.Control,{type:"search",size:"sm",value:i,placeholder:a.searchPlaceholder,onChange:u=>{var m;return l(((m=u.target)==null?void 0:m.value)??"")},className:"me-3",style:{maxWidth:"200px"}})]}),n.jsxRuntimeExports.jsx(n.Modal.Body,{className:"flex-column gap-3",children:c.length===0?n.jsxRuntimeExports.jsx(n.Alert,{variant:"warning",children:a.noWidgets}):n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[p.map(u=>n.jsxRuntimeExports.jsx(Wt,{defaultOpen:!0,title:u.name??"",children:n.jsxRuntimeExports.jsx("div",{className:"p-1",children:n.jsxRuntimeExports.jsx("div",{className:n.classNames("row gx-3 gy-3",Me.widgetsRow),children:c.filter(m=>m.group===u.id).map(m=>n.jsxRuntimeExports.jsx("div",{className:"col col-4",children:n.jsxRuntimeExports.jsxs("div",{role:"button",className:n.classNames("p-0 pt-2 bg-white rounded shadow-sm",Me.widget),onClick:()=>s(m.id),children:[n.jsxRuntimeExports.jsx("div",{className:Me.widgetImg,style:{backgroundImage:m.img?`url(${m.img})`:void 0}}),n.jsxRuntimeExports.jsx("div",{className:Me.widgetTitleSpacer}),n.jsxRuntimeExports.jsx("div",{className:n.classNames(Me.widgetTitle,"rounded"),children:n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",className:n.classNames(Me.title,"text-white text-truncate"),children:m.name})})]},m.id)}))})})},u.id)),c.some(u=>u.group===void 0)&&n.jsxRuntimeExports.jsx(Wt,{defaultOpen:!0,title:a.otherWidgets,children:n.jsxRuntimeExports.jsx("div",{className:"p-1",children:n.jsxRuntimeExports.jsx("div",{className:n.classNames("row gx-3 gy-3",Me.widgetsRow),children:c.filter(u=>u.group===void 0).map(u=>n.jsxRuntimeExports.jsx("div",{className:"col col-4",children:n.jsxRuntimeExports.jsxs("div",{role:"button",className:n.classNames("p-0 pt-2 bg-white rounded shadow-sm",Me.widget),onClick:()=>s(u.id),children:[n.jsxRuntimeExports.jsx("div",{className:Me.widgetImg,style:{backgroundImage:u.img?`url(${u.img})`:void 0}}),n.jsxRuntimeExports.jsx("div",{className:Me.widgetTitleSpacer}),n.jsxRuntimeExports.jsx("div",{className:n.classNames(Me.widgetTitle,"rounded"),children:n.jsxRuntimeExports.jsx(n.Typography,{variant:"body",className:n.classNames(Me.title,"text-white text-truncate"),children:u.name})})]},u.id)}))})})})]})})]})},bd="_widget_19xgl_1",jd="_mobile_19xgl_7",Vo={widget:bd,mobile:jd},$o=({widgetGroups:e,availableWidgets:t,onAdd:r,texts:o})=>{const[s,a]=d.useState(!1),{isMobile:i}=n.useWindowSize();return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("div",{className:n.classNames("luminus-empty-widget",Vo.widget,{[Vo.mobile]:i}),children:n.jsxRuntimeExports.jsx(n.IconButton,{onClick:()=>a(!0),children:n.jsxRuntimeExports.jsx(n.MdOutlineAddCircleOutline,{})})}),n.jsxRuntimeExports.jsx(hd,{show:s,widgetGroups:e,widgets:t,handleClose:()=>a(!1),onWidgetPicked:l=>{a(!1),r(l)},texts:o})]})},Ed="_dashboard_1gf59_1",yd="_widgets-grid_1gf59_1",Rd="_widget-wrapper_1gf59_8",Cd="_full-width_1gf59_13",Nd="_widget-edit_1gf59_16",wd="_remove-icon_1gf59_19",Sd="_full-width-icon_1gf59_26",Dd="_widget-edit-overlay_1gf59_36",Id="_mobile_1gf59_45",He={dashboard:Ed,"widgets-grid":"_widgets-grid_1gf59_1",widgetsGrid:yd,"widget-wrapper":"_widget-wrapper_1gf59_8",widgetWrapper:Rd,"full-width":"_full-width_1gf59_13",fullWidth:Cd,"widget-edit":"_widget-edit_1gf59_16",widgetEdit:Nd,"remove-icon":"_remove-icon_1gf59_19",removeIcon:wd,"full-width-icon":"_full-width-icon_1gf59_26",fullWidthIcon:Sd,"widget-edit-overlay":"_widget-edit-overlay_1gf59_36",widgetEditOverlay:Dd,mobile:Id},_d=(e,t="dashboardConfig")=>{const[r,o]=d.useState({widgets:[]});d.useEffect(()=>{const a=localStorage.getItem(t);a?o(JSON.parse(a)):e&&o(e)},[e,t]);const s=d.useCallback(a=>{o(a),localStorage.setItem(t,JSON.stringify(a))},[t]);return{dashboardConfig:r,onChangeDashboardConfig:s}},Od=({widgetGroups:e,availableWidgets:t,editMode:r,defaultDashboardConfig:o,dashboardConfigKey:s})=>{var x;const{texts:{homeDashboard:a}}=d.useContext(n.LuminusComponentsContext),{dashboardConfig:i,onChangeDashboardConfig:l}=_d(o,s),c=d.useCallback((g,b)=>{var v,h;g===((v=i.widgets)==null?void 0:v.length)?l({...i,widgets:[...i.widgets,{widgetId:b,fullWidth:!1}]}):l({...i,widgets:((h=i.widgets)==null?void 0:h.map((y,C)=>C===g?{widgetId:b,fullWidth:!1}:y))??[]})},[i,l]),p=d.useCallback(g=>{var b,v;((b=i.widgets[g])==null?void 0:b.widgetId)===-1?l({...i,widgets:((v=i.widgets)==null?void 0:v.filter((h,y)=>y!==g))??[]}):c(g,-1)},[i,l,c]),u=d.useCallback(g=>{var b;l({...i,widgets:((b=i.widgets)==null?void 0:b.map((v,h)=>h===g?{...v,fullWidth:!v.fullWidth}:v))??[]})},[i,l]),m=d.useCallback((g,b,v)=>g?n.jsxRuntimeExports.jsxs("div",{className:n.classNames(He.widgetWrapper,{[He.widgetEdit]:r&&g.id!==-1},{[He.fullWidth]:v}),children:[r&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(n.IconButton,{color:"danger",onClick:()=>p(b),className:n.classNames(He.removeIcon),children:n.jsxRuntimeExports.jsx(n.MdOutlineDelete,{})}),n.jsxRuntimeExports.jsx(n.IconButton,{color:v?"danger":"primary",onClick:()=>u(b),className:n.classNames(He.fullWidthIcon),children:n.jsxRuntimeExports.jsx(n.MdOutlineExpand,{})})]}),g.id===-1?r&&n.jsxRuntimeExports.jsx("div",{className:He.widgetWrapper,children:n.jsxRuntimeExports.jsx($o,{widgetGroups:e,availableWidgets:t,onAdd:h=>c(b,h),texts:a})}):n.jsxRuntimeExports.jsx(ql,{title:g.title,children:n.jsxRuntimeExports.jsx(g.WidgetElement,{title:g.title})}),g.id>-1&&r&&n.jsxRuntimeExports.jsx("div",{className:He.widgetEditOverlay})]},b):n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{}),[r,e,c,p,u,t,a]),{isMobile:f}=n.useWindowSize();return n.jsxRuntimeExports.jsx("div",{className:n.classNames(He.dashboard,{[He.mobile]:f}),children:n.jsxRuntimeExports.jsxs("div",{className:n.classNames(He.widgetsGrid),children:[(x=i.widgets)==null?void 0:x.map((g,b)=>m(t.find(v=>v.id===g.widgetId),b,g.fullWidth)),r&&n.jsxRuntimeExports.jsx($o,{widgetGroups:e,availableWidgets:t,onAdd:g=>{var b;return c((b=i.widgets)==null?void 0:b.length,g)},texts:a})]})})},Td="_badge_193ci_1",Pd="_sm_193ci_6",kd="_md_193ci_10",Ad="_lg_193ci_14",Md="_light_193ci_18",Wn={badge:Td,sm:Pd,md:kd,lg:Ad,light:Md},Bd=({children:e,color:t="primary",size:r="md",rounded:o,className:s,variant:a="filled",...i})=>{const l=d.useMemo(()=>a==="filled"?n.classNames(`bg-${t}`):a==="outline"?n.classNames(`text-${t} border-${t} border bg-white`):"",[t,a]);return n.jsxRuntimeExports.jsx("span",{className:n.classNames("luminus-badge badge",l,s,{"rounded-pill":o},{"text-dark":t==="light"},{[Wn.light]:t==="light"},Wn.badge,Wn[r]),...i,children:e})},Ld="_collapse-icon_1ahhn_1",Fd="_collapsed_1ahhn_6",Go={"collapse-icon":"_collapse-icon_1ahhn_1",collapseIcon:Ld,collapsed:Fd},Wt=({title:e,children:t,className:r,...o})=>{const s=o.controlled?!1:o.defaultOpen??!1,[a,i]=d.useState(s),l=o.controlled?o.isOpen:a;return d.useEffect(()=>{i(s)},[s]),n.jsxRuntimeExports.jsxs("div",{className:r??"",children:[n.jsxRuntimeExports.jsxs("div",{role:"button",className:"d-flex align-items-center justify-content-between pb-3 pt-2",onClick:()=>o.controlled?o.onToggle(!o.isOpen):i(!a),children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"h6",children:e}),n.jsxRuntimeExports.jsx(n.MdOutlineChevronRight,{className:n.classNames(Go.collapseIcon,{[Go.collapsed]:l})})]}),n.jsxRuntimeExports.jsx(Js,{in:l,children:n.jsxRuntimeExports.jsx("div",{children:t})}),n.jsxRuntimeExports.jsx("hr",{className:`my-0 ${l?"mt-3":""}`})]})},Vd="_card_19733_1",$d="_header_19733_6",Gd="_header-content_19733_13",Wd="_title_19733_19",Ud="_collapse-icon_19733_22",Hd="_collapsed_19733_27",zd="_content_19733_30",ot={card:Vd,header:$d,"header-content":"_header-content_19733_13",headerContent:Gd,title:Wd,"collapse-icon":"_collapse-icon_19733_22",collapseIcon:Ud,collapsed:Hd,content:zd},Ut=({title:e,headerContent:t,children:r,className:o,headerClassName:s,contentClassName:a,dontRenderIfNoChildren:i,...l})=>{const c=l.collapsible?l.controlled?!1:l.defaultOpen??!1:!0,[p,u]=d.useState(c),m=l.collapsible?l.controlled?l.isOpen:p:!0;d.useEffect(()=>{u(c)},[c]);const f=d.useMemo(()=>!r||!r.toString()||r.toString().split(",").filter(x=>x&&x!=="false").length===0,[r]);return i&&f?null:n.jsxRuntimeExports.jsxs("div",{className:n.classNames("luminus-card rounded shadow-sm",ot.card,{[o??""]:o}),children:[n.jsxRuntimeExports.jsxs("div",{role:l.collapsible?"button":void 0,className:n.classNames("header",ot.header,{[s??""]:s}),onClick:()=>{l.collapsible&&(l.controlled?l.onToggle(!l.isOpen):u(!p))},children:[n.jsxRuntimeExports.jsxs("div",{className:n.classNames("header-content",ot.headerContent),children:[n.jsxRuntimeExports.jsx(n.Typography,{variant:"h6",className:n.classNames("text-primary",ot.title),children:e}),t??null]}),l.collapsible&&n.jsxRuntimeExports.jsx(n.MdOutlineChevronRight,{className:n.classNames(ot.collapseIcon,{[ot.collapsed]:m})})]}),n.jsxRuntimeExports.jsx(Js,{in:m,children:n.jsxRuntimeExports.jsx("div",{className:n.classNames("card-content border-top border-primary",ot.content,{[a??""]:a}),children:r})})]})};function Ht(e){"@babel/helpers - typeof";return Ht=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ht(e)}function qd(e,t){if(Ht(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,t||"default");if(Ht(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Yd(e){var t=qd(e,"string");return Ht(t)=="symbol"?t:t+""}function Kd(e,t,r){return(t=Yd(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,o)}return r}function Uo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wo(Object(r),!0).forEach(function(o){Kd(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wo(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function Ie(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Ho=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Un=function(){return Math.random().toString(36).substring(7).split("").join(".")},zo={INIT:"@@redux/INIT"+Un(),REPLACE:"@@redux/REPLACE"+Un(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Un()}};function Xd(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Qd(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(ep(e))return"date";if(Zd(e))return"error";var r=Jd(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function Jd(e){return typeof e.constructor=="function"?e.constructor.name:null}function Zd(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function ep(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function ct(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=Qd(e)),t}function Ga(e,t,r){var o;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?Ie(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Ie(1):"Expected the enhancer to be a function. Instead, received: '"+ct(r)+"'");return r(Ga)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Ie(2):"Expected the root reducer to be a function. Instead, received: '"+ct(e)+"'");var s=e,a=t,i=[],l=i,c=!1;function p(){l===i&&(l=i.slice())}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?Ie(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return a}function m(b){if(typeof b!="function")throw new Error(process.env.NODE_ENV==="production"?Ie(4):"Expected the listener to be a function. Instead, received: '"+ct(b)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Ie(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var v=!0;return p(),l.push(b),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?Ie(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");v=!1,p();var y=l.indexOf(b);l.splice(y,1),i=null}}}function f(b){if(!Xd(b))throw new Error(process.env.NODE_ENV==="production"?Ie(7):"Actions must be plain objects. Instead, the actual type was: '"+ct(b)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof b.type>"u")throw new Error(process.env.NODE_ENV==="production"?Ie(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?Ie(9):"Reducers may not dispatch actions.");try{c=!0,a=s(a,b)}finally{c=!1}for(var v=i=l,h=0;h<v.length;h++){var y=v[h];y()}return b}function x(b){if(typeof b!="function")throw new Error(process.env.NODE_ENV==="production"?Ie(10):"Expected the nextReducer to be a function. Instead, received: '"+ct(b));s=b,f({type:zo.REPLACE})}function g(){var b,v=m;return b={subscribe:function(y){if(typeof y!="object"||y===null)throw new Error(process.env.NODE_ENV==="production"?Ie(11):"Expected the observer to be an object. Instead, received: '"+ct(y)+"'");function C(){y.next&&y.next(u())}C();var E=v(C);return{unsubscribe:E}}},b[Ho]=function(){return this},b}return f({type:zo.INIT}),o={dispatch:f,subscribe:m,getState:u,replaceReducer:x},o[Ho]=g,o}function qo(e,t){return function(){return t(e.apply(this,arguments))}}function Yo(e,t){if(typeof e=="function")return qo(e,t);if(typeof e!="object"||e===null)throw new Error(process.env.NODE_ENV==="production"?Ie(16):"bindActionCreators expected an object or a function, but instead received: '"+ct(e)+`'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?`);var r={};for(var o in e){var s=e[o];typeof s=="function"&&(r[o]=qo(s,t))}return r}function Wa(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.length===0?function(o){return o}:t.length===1?t[0]:t.reduce(function(o,s){return function(){return o(s.apply(void 0,arguments))}})}function tp(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(o){return function(){var s=o.apply(void 0,arguments),a=function(){throw new Error(process.env.NODE_ENV==="production"?Ie(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},i={getState:s.getState,dispatch:function(){return a.apply(void 0,arguments)}},l=t.map(function(c){return c(i)});return a=Wa.apply(void 0,l)(s.dispatch),Uo(Uo({},s),{},{dispatch:a})}}}var Mr=d.createContext(null);process.env.NODE_ENV!=="production"&&(Mr.displayName="ReactRedux");function np(e){e()}var Ua=np,rp=function(t){return Ua=t},op=function(){return Ua};function sp(){var e=op(),t=null,r=null;return{clear:function(){t=null,r=null},notify:function(){e(function(){for(var s=t;s;)s.callback(),s=s.next})},get:function(){for(var s=[],a=t;a;)s.push(a),a=a.next;return s},subscribe:function(s){var a=!0,i=r={callback:s,next:null,prev:r};return i.prev?i.prev.next=i:t=i,function(){!a||t===null||(a=!1,i.next?i.next.prev=i.prev:r=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var Ko={notify:function(){},get:function(){return[]}};function Ha(e,t){var r,o=Ko;function s(m){return c(),o.subscribe(m)}function a(){o.notify()}function i(){u.onStateChange&&u.onStateChange()}function l(){return!!r}function c(){r||(r=t?t.addNestedSub(i):e.subscribe(i),o=sp())}function p(){r&&(r(),r=void 0,o.clear(),o=Ko)}var u={addNestedSub:s,notifyNestedSubs:a,handleChangeWrapper:i,isSubscribed:l,trySubscribe:c,tryUnsubscribe:p,getListeners:function(){return o}};return u}var za=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?d.useLayoutEffect:d.useEffect;function qa(e){var t=e.store,r=e.context,o=e.children,s=d.useMemo(function(){var l=Ha(t);return{store:t,subscription:l}},[t]),a=d.useMemo(function(){return t.getState()},[t]);za(function(){var l=s.subscription;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),a!==t.getState()&&l.notifyNestedSubs(),function(){l.tryUnsubscribe(),l.onStateChange=null}},[s,a]);var i=r||Mr;return d.createElement(i.Provider,{value:s},o)}process.env.NODE_ENV!=="production"&&(qa.propTypes={store:n.Oe.shape({subscribe:n.Oe.func.isRequired,dispatch:n.Oe.func.isRequired,getState:n.Oe.func.isRequired}),context:n.Oe.object,children:n.Oe.any});var Br=n.requireReactIs(),ap={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},ip={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},lp={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Ya={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Lr={};Lr[Br.ForwardRef]=lp;Lr[Br.Memo]=Ya;function Xo(e){return Br.isMemo(e)?Ya:Lr[e.$$typeof]||ap}var cp=Object.defineProperty,up=Object.getOwnPropertyNames,Qo=Object.getOwnPropertySymbols,dp=Object.getOwnPropertyDescriptor,pp=Object.getPrototypeOf,Jo=Object.prototype;function Ka(e,t,r){if(typeof t!="string"){if(Jo){var o=pp(t);o&&o!==Jo&&Ka(e,o,r)}var s=up(t);Qo&&(s=s.concat(Qo(t)));for(var a=Xo(e),i=Xo(t),l=0;l<s.length;++l){var c=s[l];if(!ip[c]&&!(r&&r[c])&&!(i&&i[c])&&!(a&&a[c])){var p=dp(t,c);try{cp(e,c,p)}catch{}}}}return e}var mp=Ka;const Zo=n.getDefaultExportFromCjs(mp);var xr={exports:{}},ce={};/** @license React v17.0.2
10
10
  * react-is.production.min.js
11
11
  *
12
12
  * Copyright (c) Facebook, Inc. and its affiliates.
package/dist/main.es.js CHANGED
@@ -3068,10 +3068,12 @@ e.label === "", Qo = (e, t) => e.hierarchy && e.hierarchy.uniqueName === t, Jo =
3068
3068
  }, [p, i, m, h]), S = R(() => x.filter((N) => Je(N.key, b) || Array.from(N.lngData).some((P) => typeof (P == null ? void 0 : P[1]) != "string" ? !1 : Je((P == null ? void 0 : P[1]) ?? "", b))), [b, x]), E = R(() => Math.ceil(S.length / Zr), [S.length]), _ = A((N) => {
3069
3069
  N !== null && d(() => Math.max(1, Math.min(N, E)));
3070
3070
  }, [E]), C = A(async () => {
3071
+ if (m === null)
3072
+ return;
3071
3073
  const N = Array.from(h).map((G) => (async () => {
3072
3074
  const M = await gd.get(
3073
- `${s}${m == null ? void 0 : m.replace("{{lng}}", G)}?v=${(/* @__PURE__ */ new Date()).getTime()}`,
3074
- // ?v to not hit browser cache
3075
+ `${s}${m == null ? void 0 : m.replace("{{lng}}", G)}&v=${(/* @__PURE__ */ new Date()).getTime()}`,
3076
+ // &v to not hit browser cache
3075
3077
  { responseType: "json" }
3076
3078
  );
3077
3079
  return [G, M.data];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-luminus-components",
3
- "version": "1.4.58",
3
+ "version": "1.5.0",
4
4
  "description": "Library of React Components reusable in Luminus projects (Fleetman, CAFM)",
5
5
  "type": "module",
6
6
  "repository": {