@nice2dev/ui 1.3.11 → 1.3.13
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/CHANGELOG.md +79 -0
- package/dist/NiceModuleLifecyclePanel-BakQIZ5c.js +8418 -0
- package/dist/NiceModuleLifecyclePanel-ui6mzXQS.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/index.cjs +238 -238
- package/dist/index.css +1 -1
- package/dist/index.d.ts +697 -3
- package/dist/index.mjs +21737 -19198
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +81 -0
- package/dist/navigation.mjs +97 -96
- package/dist/style.css +2 -2
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),b=require("@nice2dev/ui-core"),i=require("react"),hn=require("react-dom"),en=require("./NiceSelect-BNPXs6FQ.cjs"),Xe=require("./pickerCommons-KrBqCBDn.cjs"),Ze=require("./NiceButton-DzCqkG5a.cjs"),Ue=require("./devops-cgRBnZVX.cjs"),Se=require("./no-code-BQqK8mvU.cjs"),An=require("./NiceColorPicker-BLwYNSXJ.cjs"),Un=[{code:"en",nativeName:"English",englishName:"English",flagCountryCode:"GB"},{code:"en-US",nativeName:"English (US)",englishName:"English (US)",flagCountryCode:"US"},{code:"en-GB",nativeName:"English (UK)",englishName:"English (UK)",flagCountryCode:"GB"},{code:"pl",nativeName:"Polski",englishName:"Polish",flagCountryCode:"PL"},{code:"de",nativeName:"Deutsch",englishName:"German",flagCountryCode:"DE"},{code:"de-AT",nativeName:"Deutsch (Österreich)",englishName:"German (Austria)",flagCountryCode:"AT"},{code:"de-CH",nativeName:"Deutsch (Schweiz)",englishName:"German (Switzerland)",flagCountryCode:"CH"},{code:"fr",nativeName:"Français",englishName:"French",flagCountryCode:"FR"},{code:"fr-CA",nativeName:"Français (Canada)",englishName:"French (Canada)",flagCountryCode:"CA"},{code:"es",nativeName:"Español",englishName:"Spanish",flagCountryCode:"ES"},{code:"es-MX",nativeName:"Español (México)",englishName:"Spanish (Mexico)",flagCountryCode:"MX"},{code:"es-AR",nativeName:"Español (Argentina)",englishName:"Spanish (Argentina)",flagCountryCode:"AR"},{code:"it",nativeName:"Italiano",englishName:"Italian",flagCountryCode:"IT"},{code:"pt",nativeName:"Português",englishName:"Portuguese",flagCountryCode:"PT"},{code:"pt-BR",nativeName:"Português (Brasil)",englishName:"Portuguese (Brazil)",flagCountryCode:"BR"},{code:"nl",nativeName:"Nederlands",englishName:"Dutch",flagCountryCode:"NL"},{code:"sv",nativeName:"Svenska",englishName:"Swedish",flagCountryCode:"SE"},{code:"no",nativeName:"Norsk",englishName:"Norwegian",flagCountryCode:"NO"},{code:"da",nativeName:"Dansk",englishName:"Danish",flagCountryCode:"DK"},{code:"fi",nativeName:"Suomi",englishName:"Finnish",flagCountryCode:"FI"},{code:"cs",nativeName:"Čeština",englishName:"Czech",flagCountryCode:"CZ"},{code:"sk",nativeName:"Slovenčina",englishName:"Slovak",flagCountryCode:"SK"},{code:"hu",nativeName:"Magyar",englishName:"Hungarian",flagCountryCode:"HU"},{code:"ro",nativeName:"Română",englishName:"Romanian",flagCountryCode:"RO"},{code:"bg",nativeName:"Български",englishName:"Bulgarian",flagCountryCode:"BG"},{code:"el",nativeName:"Ελληνικά",englishName:"Greek",flagCountryCode:"GR"},{code:"tr",nativeName:"Türkçe",englishName:"Turkish",flagCountryCode:"TR"},{code:"ru",nativeName:"Русский",englishName:"Russian",flagCountryCode:"RU"},{code:"uk",nativeName:"Українська",englishName:"Ukrainian",flagCountryCode:"UA"},{code:"ar",nativeName:"العربية",englishName:"Arabic",flagCountryCode:"SA"},{code:"he",nativeName:"עברית",englishName:"Hebrew",flagCountryCode:"IL"},{code:"fa",nativeName:"فارسی",englishName:"Persian",flagCountryCode:"IR"},{code:"hi",nativeName:"हिन्दी",englishName:"Hindi",flagCountryCode:"IN"},{code:"zh",nativeName:"中文",englishName:"Chinese",flagCountryCode:"CN"},{code:"zh-TW",nativeName:"繁體中文",englishName:"Chinese (Traditional)",flagCountryCode:"TW"},{code:"ja",nativeName:"日本語",englishName:"Japanese",flagCountryCode:"JP"},{code:"ko",nativeName:"한국어",englishName:"Korean",flagCountryCode:"KR"},{code:"th",nativeName:"ไทย",englishName:"Thai",flagCountryCode:"TH"},{code:"vi",nativeName:"Tiếng Việt",englishName:"Vietnamese",flagCountryCode:"VN"},{code:"id",nativeName:"Bahasa Indonesia",englishName:"Indonesian",flagCountryCode:"ID"}],wn=({value:n,defaultValue:s,onChange:a,placeholder:t,showSearch:c=!0,searchThreshold:r=8,searchPlaceholder:d,isOpen:p,onOpenChange:v,showFlagInValue:u=!0,showFlagInMenu:l=!0,showTextInValue:m,showTextInMenu:o=!0,showCodeInValue:h,showCodeInMenu:k=!0,displayName:I="native",compact:_=!1,variant:w="default",dropdownAlign:z,disabled:$=!1,languages:S,allowedCodes:C,priorityCodes:M=["en","pl","de","fr","es"],allowClear:R=!1,size:B="md",className:y="",style:g,label:T,helperText:A,error:N,required:f,readOnly:O,loading:L,labelPlacement:Q,errorPlacement:x,labelWidth:E,controlWidth:F,id:D,"data-testid":V="nice-language-picker","aria-label":W})=>{const{t:K}=b.useNiceTranslation(),ie=i.useRef(null),Z=i.useRef(null),ne=i.useRef(null),[ee,ce]=i.useState(s),[J,_e]=i.useState(!1),P=p??J,te=i.useCallback(q=>{const X=typeof q=="function"?q(P):q;p===void 0&&_e(X),v?.(X)},[P,p,v]),[Ne,ye]=i.useState(""),$e=m??(!_&&w!=="ghost"),Ke=h??!1,Re=_?320:280,ve=Xe.useDropdownAlignment(P,Z,z??(_?"auto":"left"),Re),Le=n!==void 0?n:ee,H=S??Un,U=i.useMemo(()=>{if(!C||C.length===0)return H;const q=C.map(ge=>ge.toLowerCase()),X=new Set(q),Ce=new Set(q.map(ge=>ge.split("-")[0])),Fe=H.filter(ge=>{const Je=ge.code.toLowerCase();return!!(X.has(Je)||!Je.includes("-")&&Ce.has(Je))});return process.env.NODE_ENV!=="production"&&Fe.length===0&&console.warn(`[Nice2Dev] <NiceLanguagePicker> received \`allowedCodes\` but none matched any entry in the language list. Picker will render empty. Got codes: ${JSON.stringify(C)}. Tip: pass canonical BCP-47 primary tags (e.g. \`pl\`, not \`pl-PL\`).`),Fe},[H,C]),me=i.useMemo(()=>{if(!M?.length)return U;const q=new Set(M),X=U.filter(Fe=>q.has(Fe.code)),Ce=U.filter(Fe=>!q.has(Fe.code));return[...X,...Ce]},[U,M]),he=i.useMemo(()=>{if(!Ne)return me;const q=Ne.toLowerCase();return me.filter(X=>X.nativeName.toLowerCase().includes(q)||X.englishName.toLowerCase().includes(q)||X.code.toLowerCase().includes(q))},[me,Ne]),re=i.useMemo(()=>Le?U.find(q=>q.code===Le)??null:null,[Le,U]),ae=c&&U.length>=r;i.useEffect(()=>{if(!P)return;const q=X=>{ie.current&&!ie.current.contains(X.target)&&(te(!1),ye(""))};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[P,te]);const Pe=i.useCallback(q=>{n===void 0&&ce(q.code),a?.(q),te(!1),ye("")},[n,a,te]),Ie=i.useCallback(()=>{n===void 0&&ce(void 0),a?.(null)},[n,a]),Ye=i.useCallback(q=>{q.stopPropagation(),Ie()},[Ie]),se=R&&!!re&&!$&&!O,xe=i.useRef(null),Me=i.useCallback(()=>{te(!1),ye("")},[te]),{activeIndex:Ee,setActiveIndex:Be,handleKeyDown:ze}=Xe.useListKeyboardNav(he,{open:P,onSelect:q=>Pe(q),onClose:Me,onOpen:()=>!$&&!O&&te(!0),intentRef:xe}),He=q=>{if((q.key==="Delete"||q.key==="Backspace")&&se&&!P){q.preventDefault(),Ie();return}ze(q)};b.useOverlayFocus(xe,{open:P,modal:!1,initialFocus:ae?ne:"none",onClose:Me}),i.useEffect(()=>{Be(0)},[Ne,Be]);const Te=i.useId(),De=`${Te}-listbox`,Y=P&&he[Ee]?`${De}-${Ee}`:void 0;i.useLayoutEffect(()=>{Y&&document.getElementById(Y)?.scrollIntoView?.({block:"nearest"})},[Y]);const le=q=>I==="english"?q.englishName:q.nativeName,fe=D??`${Te}-trigger`,ke=W??(!!T||(re?$e:!_)?void 0:re?K("languagePicker.ariaLabelValue","Language: {name}").replace("{name}",le(re)):K("languagePicker.ariaLabel","Language"));return e.jsxs("div",{ref:ie,className:`nice-field nice-field--${B} nice-field--language-picker ${Q==="left"?"nice-field--label-left":""} ${x==="right"?"nice-field--error-right":""} ${N?"nice-field--error":""} ${L?"nice-field--loading":""} nice-country-picker nice-language-picker nice-country-picker--${B} ${_?"nice-country-picker--compact":""} ${w==="ghost"?"nice-country-picker--ghost":""} ${P?"nice-country-picker--open":""} ${$?"nice-country-picker--disabled":""} ${y}`,style:{...g,...E!=null&&{"--nice-field-label-width":typeof E=="number"?`${E}px`:E},...F!=null&&{"--nice-field-control-width":typeof F=="number"?`${F}px`:F}},"data-testid":V,"aria-busy":L||void 0,children:[T&&e.jsxs("label",{className:"nice-field__label",htmlFor:fe,children:[T,f&&e.jsx("span",{className:"nice-field__required",children:"*"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("button",{ref:Z,type:"button",className:"nice-country-picker__trigger",onClick:q=>{$||O||(q.stopPropagation(),te(!P))},onKeyDown:He,disabled:$,id:fe,"aria-label":ke,role:"combobox","aria-keyshortcuts":se?"Delete":void 0,"aria-haspopup":"listbox","aria-expanded":P,"aria-controls":P?De:void 0,"aria-activedescendant":ae?void 0:Y,"aria-invalid":N?!0:void 0,"data-testid":`${V}-trigger`,children:[re?e.jsxs("span",{className:"nice-country-picker__value",children:[u&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(Xe.FlagIcon,{code:re.flagCountryCode})}),$e&&e.jsx("span",{className:"nice-country-picker__name",children:le(re)}),Ke&&e.jsxs("span",{className:"nice-country-picker__dial-code",children:["(",re.code,")"]})]}):e.jsx("span",{className:"nice-country-picker__placeholder",children:_?"":t??K("controls.select","Select language")}),e.jsxs("span",{className:"nice-country-picker__icons",children:[se&&e.jsx("span",{className:"nice-country-picker__clear",onClick:Ye,role:"presentation",children:e.jsx(b.NiceIcon,{name:"close",size:14})}),w!=="ghost"&&e.jsx("span",{className:"nice-country-picker__arrow",children:e.jsx(b.NiceIcon,{name:P?"chevron-up":"chevron-down",size:16})})]})]}),P&&e.jsxs("div",{className:`nice-country-picker__dropdown nice-country-picker__dropdown--align-${ve}`,style:_?{minWidth:`${Re}px`,maxWidth:"calc(100vw - 16px)"}:void 0,role:"listbox",ref:xe,id:De,"data-testid":`${V}-dropdown`,children:[ae&&e.jsx("div",{className:"nice-country-picker__search",children:e.jsx("input",{ref:ne,type:"text",value:Ne,onChange:q=>ye(q.target.value),onKeyDown:ze,placeholder:d??K("languagePicker.filter","Filter languages…"),"aria-label":d??K("languagePicker.filter","Filter languages…"),"aria-controls":De,"aria-activedescendant":Y,"aria-autocomplete":"list",className:"nice-country-picker__search-input","data-testid":`${V}-search`})}),e.jsx("div",{className:"nice-country-picker__list",children:he.length===0?e.jsx("div",{className:"nice-country-picker__empty",children:K("noData","No languages found")}):he.map((q,X)=>e.jsxs("div",{id:`${De}-${X}`,className:`nice-country-picker__option ${q.code===Le?"nice-country-picker__option--selected":""} ${X===Ee?"nice-country-picker__option--highlighted":""}`,onClick:()=>Pe(q),onMouseEnter:()=>Be(X),role:"option","aria-selected":q.code===Le,"data-testid":`${V}-option-${q.code}`,children:[l&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(Xe.FlagIcon,{code:q.flagCountryCode})}),o&&e.jsx("span",{className:"nice-country-picker__name",children:le(q)}),k&&e.jsx("span",{className:"nice-country-picker__dial-code",children:q.code})]},q.code))})]}),L&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),x==="right"&&N&&e.jsx("div",{className:"nice-field__error",role:"alert",children:N}),x==="right"&&!N&&A&&e.jsx("div",{className:"nice-field__helper",children:A})]}),x!=="right"&&N&&e.jsx("div",{className:"nice-field__error",role:"alert",children:N}),x!=="right"&&!N&&A&&e.jsx("div",{className:"nice-field__helper",children:A})]})};process.env.NODE_ENV!=="production"&&(wn.displayName="NiceLanguagePicker");function Vn(n){return{id:n.name,name:n.name,preview:{background:n.backgrounds.primary,backgroundSecondary:n.backgrounds.secondary,primary:n.colors.primary,textColor:n.text.primary,border:n.borders.color},readOnly:!0}}const gn=b.NICE_THEME_PRESETS.map(Vn),Ss=(n,s)=>{const a=encodeURIComponent(s.returnUrl);if(s.themeId){const c=n.includes("?")?"&":"?";return`${n}${c}themeId=${encodeURIComponent(s.themeId)}&returnUrl=${a}`}return`${n.replace(/\/+$/,"")}/new?returnUrl=${a}`},Is=n=>{typeof window<"u"&&(window.location.href=n)},fn=n=>n.nativeName??n.name,Sn=({value:n,defaultValue:s,onChange:a,themes:t,placeholder:c,showSearch:r=!0,searchThreshold:d=8,searchPlaceholder:p,isOpen:v,onOpenChange:u,showPreviewInValue:l=!0,showPreviewInMenu:m=!0,showTextInValue:o,showTextInMenu:h=!0,showIdInValue:k=!1,showIdInMenu:I=!1,compact:_=!1,variant:w="default",dropdownAlign:z,previewSize:$,previewShape:S="page",edit:C,disabled:M=!1,allowClear:R=!1,size:B="md",className:y="",style:g,label:T,helperText:A,error:N,required:f,readOnly:O,loading:L,labelPlacement:Q,errorPlacement:x,labelWidth:E,controlWidth:F,id:D,"data-testid":V="nice-theme-picker","aria-label":W})=>{const{t:K}=b.useNiceTranslation(),ie=i.useMemo(()=>!t||t.length===0?(process.env.NODE_ENV!=="production"&&Array.isArray(t)&&console.warn(`[Nice2Dev] <NiceThemePicker> received \`themes={[]}\` (empty array). Falling back to ${gn.length} built-in presets. Omit the \`themes\` prop to silence this warning, or pass at least one descriptor.`),gn):t,[t]),Z=i.useRef(null),ne=i.useRef(null),ee=i.useRef(null),[ce,J]=i.useState(s),[_e,P]=i.useState(!1),te=v??_e,Ne=i.useCallback(X=>{const Ce=typeof X=="function"?X(te):X;v===void 0&&P(Ce),u?.(Ce)},[te,v,u]),[ye,$e]=i.useState(""),Ke=o??(!_&&w!=="ghost"),Re=$??(_?24:28),ve=$??32,Le=_?320:280,H=Xe.useDropdownAlignment(te,ne,z??(_?"auto":"left"),Le),U=n!==void 0?n:ce,me=i.useMemo(()=>{if(!ye)return ie;const X=ye.toLowerCase();return ie.filter(Ce=>Ce.id.toLowerCase().includes(X)||Ce.name.toLowerCase().includes(X)||(Ce.nativeName?.toLowerCase().includes(X)??!1))},[ie,ye]),he=i.useMemo(()=>U?ie.find(X=>X.id===U)??null:null,[U,ie]),re=r&&ie.length>=d;i.useEffect(()=>{if(!te)return;const X=Ce=>{Z.current&&!Z.current.contains(Ce.target)&&(Ne(!1),$e(""))};return document.addEventListener("mousedown",X),()=>document.removeEventListener("mousedown",X)},[te,Ne]);const ae=i.useRef(!1);i.useEffect(()=>{process.env.NODE_ENV!=="production"&&ie.length===0&&!ae.current&&(ae.current=!0,console.warn("[@nice2dev/ui] <NiceThemePicker> received an empty `themes` array. Omit the prop to use NICE_THEME_PICKER_PRESETS, or pass your own NiceThemeDescriptor[] (use `toThemeDescriptor(theme)` to adapt a NiceTheme)."))},[ie]);const Pe=i.useCallback(X=>{n===void 0&&J(X.id),a?.(X),Ne(!1),$e("")},[n,a,Ne]),Ie=i.useCallback(()=>{n===void 0&&J(void 0),a?.(null)},[n,a]),Ye=i.useCallback(X=>{X.stopPropagation(),Ie()},[Ie]),se=R&&!!he&&!M&&!O,xe=i.useCallback(X=>{if(!C?.enabled&&!C?.addNew?.enabled)return;const Ce=C.returnUrl??(typeof window<"u"?window.location.href:"/"),Fe=(C.buildUrl??(ge=>Ss(C.editorRoute,ge)))({themeId:X,returnUrl:Ce});(C.navigate??Is)(Fe),Ne(!1)},[C,Ne]),Me=i.useRef(null),Ee=i.useCallback(()=>{Ne(!1),$e("")},[Ne]),{activeIndex:Be,setActiveIndex:ze,handleKeyDown:He}=Xe.useListKeyboardNav(me,{open:te,onSelect:X=>Pe(X),onClose:Ee,onOpen:()=>!M&&!O&&Ne(!0),intentRef:Me}),Te=X=>{if((X.key==="Delete"||X.key==="Backspace")&&se&&!te){X.preventDefault(),Ie();return}He(X)};b.useOverlayFocus(Me,{open:te,modal:!1,initialFocus:re?ee:"none",onClose:Ee}),i.useEffect(()=>{ze(0)},[ye,ze]);const De=i.useId(),Y=`${De}-listbox`,le=te&&me[Be]?`${Y}-${Be}`:void 0;i.useLayoutEffect(()=>{le&&document.getElementById(le)?.scrollIntoView?.({block:"nearest"})},[le]);const fe=X=>!!(C?.enabled&&(!X.readOnly||C?.allowEditBuiltIn)),pe=D??`${De}-trigger`,q=W??(!!T||(he?Ke:!_)?void 0:he?K("themePicker.ariaLabelValue","Theme: {name}").replace("{name}",fn(he)):K("themePicker.ariaLabel","Theme"));return e.jsxs("div",{ref:Z,className:`nice-field nice-field--${B} nice-field--theme-switcher ${Q==="left"?"nice-field--label-left":""} ${x==="right"?"nice-field--error-right":""} ${N?"nice-field--error":""} ${L?"nice-field--loading":""} nice-country-picker nice-theme-picker nice-country-picker--${B} ${_?"nice-country-picker--compact":""} ${w==="ghost"?"nice-country-picker--ghost":""} ${te?"nice-country-picker--open":""} ${M?"nice-country-picker--disabled":""} ${y}`,style:{...g,...E!=null&&{"--nice-field-label-width":typeof E=="number"?`${E}px`:E},...F!=null&&{"--nice-field-control-width":typeof F=="number"?`${F}px`:F}},"data-testid":V,"aria-busy":L||void 0,children:[T&&e.jsxs("label",{className:"nice-field__label",htmlFor:pe,children:[T,f&&e.jsx("span",{className:"nice-field__required",children:"*"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("button",{ref:ne,type:"button",className:"nice-country-picker__trigger",onClick:X=>{M||O||(X.stopPropagation(),Ne(!te))},onKeyDown:Te,disabled:M,id:pe,"aria-label":q,role:"combobox","aria-keyshortcuts":se?"Delete":void 0,"aria-haspopup":"listbox","aria-expanded":te,"aria-controls":te?Y:void 0,"aria-activedescendant":re?void 0:le,"aria-invalid":N?!0:void 0,"data-testid":`${V}-trigger`,children:[he?e.jsxs("span",{className:"nice-country-picker__value",children:[l&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(Xe.ThemePreviewSwatch,{colors:he.preview,size:Re,shape:S})}),Ke&&e.jsx("span",{className:"nice-country-picker__name",children:fn(he)}),k&&e.jsxs("span",{className:"nice-country-picker__dial-code",children:["(",he.id,")"]})]}):e.jsx("span",{className:"nice-country-picker__placeholder",children:_?"":c??K("controls.select","Select theme")}),e.jsxs("span",{className:"nice-country-picker__icons",children:[se&&e.jsx("span",{className:"nice-country-picker__clear",onClick:Ye,role:"presentation",children:e.jsx(b.NiceIcon,{name:"close",size:14})}),w!=="ghost"&&e.jsx("span",{className:"nice-country-picker__arrow",children:e.jsx(b.NiceIcon,{name:te?"chevron-up":"chevron-down",size:16})})]})]}),te&&e.jsxs("div",{className:`nice-country-picker__dropdown nice-country-picker__dropdown--align-${H}`,style:_?{minWidth:`${Le}px`,maxWidth:"calc(100vw - 16px)"}:void 0,role:"listbox",ref:Me,id:Y,"data-testid":`${V}-dropdown`,children:[re&&e.jsx("div",{className:"nice-country-picker__search",children:e.jsx("input",{ref:ee,type:"text",value:ye,onChange:X=>$e(X.target.value),onKeyDown:He,placeholder:p??K("themePicker.filter","Filter themes…"),"aria-label":p??K("themePicker.filter","Filter themes…"),"aria-controls":Y,"aria-activedescendant":le,"aria-autocomplete":"list",className:"nice-country-picker__search-input","data-testid":`${V}-search`})}),C?.addNew?.enabled&&e.jsxs("button",{type:"button",className:"nice-theme-picker__add-btn nice-theme-picker__add-btn--top",onClick:()=>xe(void 0),"data-testid":`${V}-add`,children:[e.jsx(b.NiceIcon,{name:"plus",size:14})," ",C.addNew.label??C.addLabel??K("themePicker.addTheme","Add theme")]}),e.jsx("div",{className:"nice-country-picker__list",children:me.length===0?e.jsx("div",{className:"nice-country-picker__empty",children:K("noData","No themes found")}):me.map((X,Ce)=>e.jsxs("div",{id:`${Y}-${Ce}`,className:`nice-country-picker__option nice-theme-picker__option ${X.id===U?"nice-country-picker__option--selected":""} ${Ce===Be?"nice-country-picker__option--highlighted":""}`,onClick:()=>Pe(X),onMouseEnter:()=>ze(Ce),role:"option","aria-selected":X.id===U,"data-testid":`${V}-option-${X.id}`,children:[m&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(Xe.ThemePreviewSwatch,{colors:X.preview,size:ve,shape:S})}),h&&e.jsx("span",{className:"nice-country-picker__name",children:fn(X)}),I&&e.jsx("span",{className:"nice-country-picker__dial-code",children:X.id}),fe(X)&&e.jsx("button",{type:"button",className:"nice-theme-picker__edit-btn",onClick:Fe=>{Fe.stopPropagation(),xe(X.id)},"aria-label":C?.editLabel??K("themePicker.editTheme","Edit theme"),"data-testid":`${V}-edit-${X.id}`,children:e.jsx(b.NiceIcon,{name:"edit",size:12})})]},X.id))}),C?.enabled&&!C.addNew?.enabled&&e.jsxs("button",{type:"button",className:"nice-theme-picker__add-btn",onClick:()=>xe(void 0),"data-testid":`${V}-add`,children:[e.jsx(b.NiceIcon,{name:"plus",size:14})," ",C.addLabel??K("themePicker.addTheme","Add theme")]})]}),L&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),x==="right"&&N&&e.jsx("div",{className:"nice-field__error",role:"alert",children:N}),x==="right"&&!N&&A&&e.jsx("div",{className:"nice-field__helper",children:A})]}),x!=="right"&&N&&e.jsx("div",{className:"nice-field__error",role:"alert",children:N}),x!=="right"&&!N&&A&&e.jsx("div",{className:"nice-field__helper",children:A})]})};process.env.NODE_ENV!=="production"&&(Sn.displayName="NiceThemePicker");const In=i.createContext(null),$n=i.createContext(null),Wn=({children:n,title:s,headerExtra:a,footer:t,hoverable:c,bordered:r=!0,onClick:d,selectable:p,selected:v,value:u,onSelect:l,name:m,disabled:o,readOnly:h,loading:k,error:I,size:_,className:w,style:z,displayStyle:$,id:S,testId:C,"data-testid":M})=>{const R=b.useComponentDisplayStyle("card",$),B=b.useComponentDisplayClass("card",$),y=i.useContext(In),g=i.useContext($n),T=_??g??"md",A=i.useMemo(()=>{if($)return R;const{background:ne,border:ee,boxShadow:ce,backdropFilter:J,WebkitBackdropFilter:_e,...P}=R;return P},[R,$]),N=y!=null&&u!=null,f=p||N||l!=null,O=m??(N?y.name:void 0),L=f&&v===void 0&&!N,[Q,x]=i.useState(!1),E=N?y.value===u:L?Q:!!v,F=()=>{u!=null&&(l?.(u),N&&y.onChange(u))},D=o||k,V=()=>{D||(f&&!h&&(F(),L&&x(ne=>!ne)),d?.())},W=ne=>{!D&&f&&!h&&(ne.key===" "||ne.key==="Enter")&&(ne.preventDefault(),V())},K=f||d!=null,ie=f?"radio":d?"button":void 0,Z=typeof I=="string"?I.length>0:!!I;return e.jsxs("div",{className:"nice-card-field",children:[e.jsxs("div",{className:`nice-card nice-card--${T} nice-card--ds-${B} ${r?"nice-card--bordered":"nice-card--frameless"} ${c?"nice-card--hoverable":""} ${d?"nice-card--clickable":""} ${f?"nice-card--selectable":""} ${E?"nice-card--selected":""} ${o?"nice-card--disabled":""} ${h?"nice-card--readonly":""} ${k?"nice-card--loading":""} ${Z?"nice-card--error":""} ${w||""}`,style:{...A,...z},id:S,"data-testid":M??C,onClick:K?V:void 0,onKeyDown:K?W:void 0,role:ie,"aria-checked":f?E:void 0,"aria-disabled":o||void 0,"aria-busy":k||void 0,"data-value":u!=null?String(u):void 0,"data-name":O,tabIndex:K&&!o?0:void 0,children:[(s||a)&&e.jsxs("div",{className:"nice-card__header",children:[s&&e.jsx("h3",{className:"nice-card__title",children:s}),a]}),e.jsx("div",{className:"nice-card__body",children:n}),t&&e.jsx("div",{className:"nice-card__footer",children:t}),k&&e.jsx("span",{className:"nice-card__spinner","aria-hidden":"true",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})})]}),typeof I=="string"&&I&&e.jsx("div",{className:"nice-card__error",role:"alert",children:I})]})},$s=Object.freeze(Object.defineProperty({__proto__:null,NiceCard:Wn,NiceCardGroupSizeContext:$n,NiceCardRadioContext:In},Symbol.toStringTag,{value:"Module"}));function Es(n,s,a){const c=window.innerWidth,r=window.innerHeight,d={top:n.top,bottom:r-n.bottom,left:n.left,right:c-n.right},p={top:a+6,bottom:a+6,left:s+6,right:s+6},v=["top","bottom","right","left"],u=v.filter(m=>d[m]>=p[m]),l=u.length?u:v;return l.reduce((m,o)=>d[o]>d[m]?o:m,l[0])}function Ms(n,s){switch(s){case"bottom":return{left:n.left+n.width/2,top:n.bottom+6,transform:"translateX(-50%)"};case"left":return{left:n.left-6,top:n.top+n.height/2,transform:"translate(-100%, -50%)"};case"right":return{left:n.right+6,top:n.top+n.height/2,transform:"translateY(-50%)"};case"top":default:return{left:n.left+n.width/2,top:n.top-6,transform:"translate(-50%, -100%)"}}}const Ae=({content:n,position:s="auto",size:a="md",followCursor:t,children:c})=>{const[r,d]=i.useState(!1),[p,v]=i.useState({x:0,y:0}),[u,l]=i.useState(null),[m,o]=i.useState("top"),h=i.useId(),k=i.useRef(null),I=i.useRef(null),_=s==="auto"?m:s,w=i.useCallback(C=>{t&&v({x:C.clientX,y:C.clientY})},[t]);i.useLayoutEffect(()=>{if(!r||t)return;const C=()=>{const M=k.current;if(!M)return;const R=M.firstElementChild??M;l(R.getBoundingClientRect())};return C(),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[r,t]),i.useLayoutEffect(()=>{if(s!=="auto"||!r||t||!u||!I.current)return;const C=I.current.getBoundingClientRect(),M=Es(u,C.width,C.height);o(R=>R===M?R:M)},[s,r,t,u,n,a]);const z=i.cloneElement(c,{"aria-describedby":r?h:void 0}),$=r?(()=>{let C;if(t)C={position:"fixed",left:p.x+12,top:p.y+12};else if(u){const M=Ms(u,_);C={position:"fixed",left:M.left,top:M.top,transform:M.transform}}else C={position:"fixed",left:-9999,top:-9999};return e.jsx("span",{ref:I,id:h,className:`nice-tooltip nice-tooltip--${_} nice-tooltip--${a} nice-tooltip--portaled`,role:"tooltip",style:C,children:n})})():null,S=typeof document<"u"?document.body:null;return e.jsxs("span",{ref:k,className:"nice-tooltip-wrapper",onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onMouseMove:w,onFocus:()=>d(!0),onBlur:()=>d(!1),children:[z,$!=null&&S!=null?hn.createPortal($,S):$]})};process.env.NODE_ENV!=="production"&&(Ae.displayName="NiceTooltip");const zs=[],Ls=({items:n=zs,multiple:s=!1,defaultOpen:a=[],size:t="md",width:c,maxWidth:r,animationDuration:d=220,className:p,"data-testid":v,style:u,displayStyle:l})=>{b.useComponentDisplayClass("card",l);const m=b.normalizeSize(t,"NiceAccordion"),[o,h]=i.useState(new Set(a)),k=i.useId(),I=i.useCallback($=>{h(S=>{const C=new Set(S);return C.has($)?C.delete($):(s||C.clear(),C.add($)),C})},[s]),_=i.useRef(null),w=$=>{const S=[..._.current?.querySelectorAll(":scope > .nice-accordion__item > .nice-accordion__trigger:not(:disabled)")??[]],C=S.indexOf($.currentTarget),M=$.key==="ArrowDown"?C+1:$.key==="ArrowUp"?C-1:$.key==="Home"?0:$.key==="End"?S.length-1:-1,R=C>=0&&M>=0?S[M]:void 0;R&&R!==$.currentTarget&&($.preventDefault(),R.focus())},z={...u,...c!==void 0?{width:typeof c=="number"?`${c}px`:c}:{},...r!==void 0?{maxWidth:typeof r=="number"?`${r}px`:r}:{},"--nice-accordion-anim":`${Math.max(0,d)}ms`};return e.jsx("div",{ref:_,className:`nice-accordion nice-accordion--${m} ${p||""}`,style:z,"data-testid":v,children:n.map(($,S)=>{const C=o.has($.id),M=`${k}-trigger-${S}`,R=`${k}-panel-${S}`;return e.jsxs("div",{className:"nice-accordion__item",children:[e.jsxs("button",{type:"button",id:M,className:"nice-accordion__trigger",onClick:()=>!$.disabled&&I($.id),onKeyDown:w,"aria-expanded":C,"aria-controls":C?R:void 0,"aria-disabled":$.disabled,disabled:$.disabled,children:[e.jsx("span",{children:$.title}),e.jsx(b.NiceIcon,{name:"chevron-down",size:16,className:`nice-accordion__chevron ${C?"nice-accordion__chevron--open":""}`})]}),C&&e.jsx("div",{id:R,className:"nice-accordion__content",role:"region","aria-labelledby":M,children:$.content})]},$.id)})})},Ds=[],Rs=({items:n=Ds,separator:s="/",size:a="md",className:t,"data-testid":c,style:r})=>{const{t:d}=b.useNiceTranslation();return e.jsx("nav",{className:`nice-breadcrumb nice-breadcrumb--${a} ${t||""}`,style:r,"data-testid":c,"aria-label":d("breadcrumb.breadcrumb","Breadcrumb"),children:n.map((p,v)=>e.jsxs(i.Fragment,{children:[v>0&&e.jsx("span",{className:"nice-breadcrumb__separator","aria-hidden":"true",children:s}),v===n.length-1?e.jsx("span",{className:"nice-breadcrumb__current","aria-current":"page",children:p.label}):e.jsx("span",{className:"nice-breadcrumb__item",children:p.href!==void 0?e.jsx("a",{className:"nice-breadcrumb__link",href:p.href,onClick:u=>{p.onClick&&(u.preventDefault(),p.onClick())},children:p.label}):p.onClick?e.jsx("button",{type:"button",className:"nice-breadcrumb__link nice-breadcrumb__link--button",onClick:p.onClick,children:p.label}):p.label})]},v))})},Ts=[];function tn(n){return(n.id??n.key??"")+""}function Gn(n){return n.label??n.text??""}function pn(n){return n.children??n.items}function jn(n){const s=pn(n);return!s||s.length===0}function En(n,s){if(!s)return!1;if(tn(n)===s)return!0;const a=pn(n);return a?a.some(t=>En(t,s)):!1}const qn=({items:n=Ts,orientation:s="horizontal",variant:a="ghost",density:t="normal",size:c="md",loading:r=!1,fullWidth:d=!1,showDividers:p=!1,panelAlign:v="start",panelMinWidth:u=200,panelMaxWidth:l=360,itemGap:m,paddingX:o,paddingY:h,portal:k=!0,panelZIndex:I=1100,arrowIcon:_=e.jsx(b.NiceIcon,{name:"chevron-down",size:14}),flyoutArrowIcon:w=e.jsx(b.NiceIcon,{name:"chevron-right",size:14}),closeOnSelect:z=!0,openTrigger:$="click",openDelay:S=120,closeDelay:C=180,onOpenChange:M,activeId:R,activeKey:B,onItemClick:y,ariaLabel:g,renderTriggerLabel:T,renderEntryLabel:A,maxDepth:N=3,className:f,"data-testid":O,style:L,id:Q,accessMode:x,displayStyle:E})=>{const{t:F}=b.useNiceTranslation(),D=g??F("menu.menu","Menu"),V=b.useComponentDisplayClass("menu",E),W=b.useComponentDisplayStyle("menu",E),ie=i.useContext(b.NiceThemeContext)?.portalTarget??(typeof document<"u"?document.body:null),Z=b.useNiceAccessMode(x,Q),ne=Z==="hidden",ee=Z==="disabled"||Z==="readOnly"||r,ce=i.useId(),J=R??B,_e=Math.min(10,Math.max(1,N)),[P,te]=i.useState(null),[Ne,ye]=i.useState([]),$e=i.useRef(null),Ke=i.useRef(null);i.useEffect(()=>{M?.(P)},[P,M]);const Re=i.useCallback(()=>{$e.current!=null&&(window.clearTimeout($e.current),$e.current=null),Ke.current!=null&&(window.clearTimeout(Ke.current),Ke.current=null)},[]);i.useEffect(()=>()=>Re(),[Re]);const ve=i.useCallback(Y=>{Re(),P!==Y&&($e.current=window.setTimeout(()=>{te(Y),ye([])},Math.max(0,S)))},[Re,P,S]),Le=i.useCallback(()=>{Re(),Ke.current=window.setTimeout(()=>{te(null),ye([])},Math.max(0,C))},[Re,C]),[H,U]=i.useState(-1),[me,he]=i.useState(-1),[re,ae]=i.useState(null),Pe=i.useRef(null),Ie=i.useRef(null),Ye=i.useRef(new Map),se=i.useCallback(()=>{if(!P){ae(null);return}const Y=Ye.current.get(P);if(!Y)return;const le=Y.getBoundingClientRect();if(s==="vertical")ae({left:le.right,top:le.top,width:le.width});else{const fe=Ie.current?.offsetWidth??Math.max(u,le.width);let pe=le.left;v==="end"?pe=le.right-fe:v==="center"&&(pe=le.left+le.width/2-fe/2),ae({left:pe,top:le.bottom,width:le.width})}},[P,s,v,u]);i.useLayoutEffect(()=>{if(k&&(se(),P&&(v==="end"||v==="center"))){const Y=requestAnimationFrame(se);return()=>cancelAnimationFrame(Y)}},[k,se,P,v]),i.useEffect(()=>{if(!k||!P)return;const Y=()=>se();return window.addEventListener("scroll",Y,!0),window.addEventListener("resize",Y),()=>{window.removeEventListener("scroll",Y,!0),window.removeEventListener("resize",Y)}},[k,P,se]);const xe=i.useMemo(()=>n.filter(Y=>tn(Y).length>0),[n]),Me=i.useCallback(()=>{te(null),ye([]),he(-1)},[]);i.useEffect(()=>{if(!P)return;const Y=fe=>{const pe=fe.target;Pe.current&&Pe.current.contains(pe)||Ie.current&&Ie.current.contains(pe)||Me()},le=fe=>{fe.key==="Escape"&&Me()};return document.addEventListener("mousedown",Y),document.addEventListener("keydown",le),()=>{document.removeEventListener("mousedown",Y),document.removeEventListener("keydown",le)}},[P,Me]);const Ee=(Y,le)=>{if(Y.disabled||ee)return;const fe=tn(Y);if(jn(Y)){Y.onClick?.(le),y?.(Y,le),z&&Me();return}ye([]),te(P===fe?null:fe),he(-1)},Be=i.useCallback((Y,le)=>{ye(fe=>{const pe=Y-2;if(pe<0)return fe;if(fe[pe]===le)return fe.slice(0,pe);const q=fe.slice(0,pe);return q[pe]=le,q})},[]),ze=(Y,le)=>{Y.disabled||(Y.onClick?.(le),y?.(Y,le),z&&Me())},He=Y=>{if(ee)return;const le=s==="horizontal",fe=le?"ArrowLeft":"ArrowUp",pe=le?"ArrowRight":"ArrowDown";if(Y.key===fe)Y.preventDefault(),U(ke=>ke<=0?xe.length-1:ke-1);else if(Y.key===pe)Y.preventDefault(),U(ke=>ke>=xe.length-1?0:ke+1);else if(Y.key==="Home")Y.preventDefault(),U(0);else if(Y.key==="End")Y.preventDefault(),U(xe.length-1);else if(Y.key==="Enter"||Y.key===" "){Y.preventDefault();const ke=xe[H];ke&&Ee(ke,Y)}else Y.key==="Escape"&&Me()};if(ne)return null;const Te=["nice-menu",`nice-menu--orientation-${s}`,`nice-menu--variant-${a}`,`nice-menu--density-${t}`,`nice-menu--size-${c}`,d?"nice-menu--full-width":"",p?"nice-menu--show-dividers":"",r?"nice-menu--loading":"",V??"",f??""].filter(Boolean).join(" "),De={...W,...L,"--nice-menu-panel-min-w":`${u}px`,"--nice-menu-panel-max-w":`${l}px`};return m!==void 0&&(De["--nice-menu-gap"]=typeof m=="number"?`${m}px`:m),o!==void 0&&(De["--nice-menu-padding-x"]=typeof o=="number"?`${o}px`:o),h!==void 0&&(De["--nice-menu-padding-y"]=typeof h=="number"?`${h}px`:h),e.jsxs("nav",{id:Q,ref:Pe,className:Te,style:De,"data-testid":O,"aria-label":D,"aria-busy":r||void 0,children:[r&&e.jsx("span",{className:"nice-menu__spinner","aria-hidden":"true",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),e.jsx("ul",{className:"nice-menu__list",role:"menubar",onKeyDown:He,tabIndex:0,children:xe.map((Y,le)=>{const fe=tn(Y),pe=P===fe,ke=!!J&&En(Y,J),q=!jn(Y),X=["nice-menu__item",pe?"nice-menu__item--open":"",ke?"nice-menu__item--active":"",Y.disabled?"nice-menu__item--disabled":"",Y.danger?"nice-menu__item--danger":"",q?"nice-menu__item--has-children":"",H===le?"nice-menu__item--focused":""].filter(Boolean).join(" "),Ce=T?T(Y):Gn(Y),Fe=e.jsxs(e.Fragment,{children:[Y.icon?e.jsx("span",{className:"nice-menu__icon",children:Y.icon}):null,e.jsx("span",{className:"nice-menu__label",children:Ce}),Y.badge!=null?e.jsx("span",{className:"nice-menu__badge",children:Y.badge}):null,q?e.jsx("span",{className:"nice-menu__arrow","aria-hidden":!0,children:_}):null]});return e.jsxs("li",{className:X,role:"none","data-nice-menu-id":fe,"data-nice-depth":1,onMouseEnter:q&&($==="hover"||$==="both")?()=>ve(fe):void 0,onMouseLeave:q&&($==="hover"||$==="both")?()=>Le():void 0,children:[Y.href&&!q?e.jsx("a",{ref:ge=>{ge?Ye.current.set(fe,ge):Ye.current.delete(fe)},className:"nice-menu__btn",href:Y.href,target:Y.target,rel:Y.rel,role:"menuitem","aria-disabled":Y.disabled||void 0,"aria-label":Y.ariaLabel,tabIndex:H===le?0:-1,onClick:ge=>Ee(Y,ge),onFocus:()=>U(le),children:Fe}):e.jsx("button",{ref:ge=>{ge?Ye.current.set(fe,ge):Ye.current.delete(fe)},type:"button",className:"nice-menu__btn",disabled:Y.disabled||ee,role:"menuitem","aria-haspopup":q||void 0,"aria-expanded":q?pe:void 0,"aria-controls":q?`${ce}-panel-${fe}`:void 0,"aria-label":Y.ariaLabel,tabIndex:H===le?0:-1,onClick:ge=>Ee(Y,ge),onFocus:()=>U(le),children:Fe}),q&&pe?(()=>{const ge=k&&typeof document<"u"&&!!re&&!!ie,Je=ge?{position:"fixed",left:re.left,top:re.top,minWidth:Math.max(u,re.width),maxWidth:l,zIndex:I}:{zIndex:I},G=e.jsx(Xn,{items:pn(Y)??[],depth:2,maxDepth:_e,openPath:Ne,onToggleBranch:Be,onLeafClick:ze,effectiveActiveId:J,renderEntryLabel:A,flyoutArrowIcon:w,openTrigger:$,onPanelEnter:()=>Re(),onPanelLeave:()=>Le(),panelClassName:["nice-menu__panel",`nice-menu__panel--align-${v}`,ge?"nice-menu__panel--portal":""].filter(Boolean).join(" "),panelStyle:Je,panelId:`${ce}-panel-${fe}`,panelRef:ge?Ie:void 0,focusedEntryIdx:me,setFocusedEntryIdx:he});return ge?hn.createPortal(G,ie):G})():null]},fe)})})]})};process.env.NODE_ENV!=="production"&&(qn.displayName="NiceMenu");function Xn({items:n,depth:s,maxDepth:a,openPath:t,onToggleBranch:c,onLeafClick:r,effectiveActiveId:d,renderEntryLabel:p,flyoutArrowIcon:v,openTrigger:u,onPanelEnter:l,onPanelLeave:m,panelClassName:o,panelStyle:h,panelId:k,panelRef:I,focusedEntryIdx:_,setFocusedEntryIdx:w}){const z=Math.min(Math.max(s,1),10),$=s===2,S=o??($?"nice-menu__panel":"nice-menu__subpanel"),M={...{"--nice-row-bg":`var(--nice-menu-level-${z}-bg, var(--nice-bg-elevated, var(--nice-bg-primary)))`,"--nice-row-text":`var(--nice-menu-level-${z}-text, var(--nice-text-primary))`,"--nice-row-border":`var(--nice-menu-level-${z}-border, var(--nice-border-color))`,"--nice-row-hover-bg":`var(--nice-menu-level-${z}-hover-bg, var(--nice-hover-bg))`,"--nice-row-active-bg":`var(--nice-menu-level-${z}-active-bg, var(--nice-selected-bg))`},...h??{}},R=u==="hover"||u==="both"?{onMouseEnter:l,onMouseLeave:m}:{};return e.jsx("div",{ref:I,id:k,className:S,style:M,role:"menu","data-nice-depth":s,...R,children:n.map((B,y)=>{if(B.divider)return e.jsx("hr",{className:"nice-menu__divider"},`d-${y}`);const g=tn(B),A=!jn(B)&&s<a,N=t[s-2]===g,f=!!d&&En(B,d),O=["nice-menu__entry",B.disabled?"nice-menu__entry--disabled":"",B.danger?"nice-menu__entry--danger":"",f?"nice-menu__entry--active":"",$&&_===y?"nice-menu__entry--focused":""].filter(Boolean).join(" "),L=e.jsxs(e.Fragment,{children:[B.icon?e.jsx("span",{className:"nice-menu__icon",children:B.icon}):null,e.jsxs("span",{className:"nice-menu__entry-content",children:[e.jsxs("span",{className:"nice-menu__entry-label",children:[p?p(B):Gn(B),B.badge!=null?e.jsx("span",{className:"nice-menu__badge",children:B.badge}):null]}),B.description?e.jsx("span",{className:"nice-menu__entry-desc",children:B.description}):null]}),A?e.jsx("span",{className:"nice-menu__entry-arrow","aria-hidden":!0,children:v}):null]}),Q=E=>{A?c(s,g):r(B,E)},x=$?()=>w?.(y):void 0;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:A?()=>c(s,g):void 0,children:[B.href&&!A?e.jsx("a",{className:O,href:B.href,target:B.target,rel:B.rel,role:"menuitem","aria-disabled":B.disabled||void 0,"aria-label":B.ariaLabel,onClick:Q,onFocus:x,children:L}):e.jsx("button",{type:"button",className:O,disabled:B.disabled,role:"menuitem","aria-haspopup":A||void 0,"aria-expanded":A?N:void 0,"aria-label":B.ariaLabel,onClick:Q,onFocus:x,children:L}),A&&N?e.jsx(Xn,{items:pn(B)??[],depth:s+1,maxDepth:a,openPath:t,onToggleBranch:c,onLeafClick:r,effectiveActiveId:d,renderEntryLabel:p,flyoutArrowIcon:v,openTrigger:u}):null]},g||`c-${y}`)})})}const Os=[],Mn=({items:n=Os,target:s,onItemClick:a,size:t="md",className:c,"data-testid":r,style:d})=>{const[p,v]=i.useState(null),u=i.useRef(null);return b.useClickOutside(u,()=>v(null)),b.useOverlayFocus(u,{open:p!=null,modal:!1,onClose:()=>v(null)}),b.useRovingFocus(u,{orientation:"vertical",wrap:!0,typeahead:!0}),i.useEffect(()=>{const l=s.current;if(!l)return;const m=o=>{if(o.preventDefault(),o.clientX===0&&o.clientY===0&&o.target instanceof Element){const h=o.target.getBoundingClientRect();v({x:h.left,y:h.bottom})}else v({x:o.clientX,y:o.clientY})};return l.addEventListener("contextmenu",m),()=>l.removeEventListener("contextmenu",m)},[s]),p?e.jsx("div",{ref:u,"data-testid":r,className:`nice-contextmenu nice-contextmenu--${t} ${c||""}`,style:{position:"fixed",left:p.x,top:p.y,zIndex:1e4,...d},children:e.jsx("ul",{className:"nice-contextmenu__list",role:"menu",children:n.map((l,m)=>e.jsx("li",{className:`nice-contextmenu__item ${l.disabled?"nice-contextmenu__item--disabled":""}`,role:"none",children:e.jsxs("button",{type:"button",className:"nice-contextmenu__btn",disabled:l.disabled,"aria-disabled":l.disabled,role:"menuitem",onClick:o=>{l.onClick?.(o),a?.(l),v(null)},children:[l.icon&&e.jsx("span",{className:"nice-contextmenu__icon","aria-hidden":"true",children:l.icon}),e.jsx("span",{children:l.label??l.text??""})]})},l.id??l.key??m))})}):null},Fs=[];function As(n,s){if(n==null)return null;if(typeof n=="number")return n/s*100;const a=n.trim();if(a.endsWith("%"))return parseFloat(a);const t=parseFloat(a);return Number.isFinite(t)?t/s*100:null}function Ps(n,s){const a=n.length||1;let t=n.map(o=>As(o.size,s));const c=t.reduce((o,h)=>o+(h??0),0),r=t.filter(o=>o==null).length,d=Math.max(0,100-c);t=t.map(o=>o??(r?d/r:100/a));let p=n.map(o=>o.collapsible?0:o.minSize?o.minSize/s*100:0);const v=p.reduce((o,h)=>o+h,0);if(v>100){const o=100/v;p=p.map(h=>h*o)}const u=n.map(o=>o.maxSize?o.maxSize/s*100:100),l=t.map((o,h)=>Math.min(u[h],Math.max(p[h],o??0))),m=l.reduce((o,h)=>o+h,0)||1;return l.map(o=>o/m*100)}const Bs=({panes:n=Fs,orientation:s="horizontal",gutterSize:a=6,onResize:t,className:c,"data-testid":r,style:d,accessMode:p,id:v})=>{const l=b.useNiceAccessMode(p,v)==="hidden",m=i.useRef(null),[o,h]=i.useState(()=>n.map(()=>100/n.length)),k=i.useRef("");i.useLayoutEffect(()=>{const w=m.current;if(!w)return;const z=s==="horizontal"?w.offsetWidth:w.offsetHeight;if(!z)return;const $=`${s}:${n.map(S=>S.key).join("|")}`;k.current!==$&&(k.current=$,h(Ps(n,z)))},[n,s]);const I=i.useCallback((w,z)=>{z.preventDefault();const $=m.current;if(!$)return;const S=z.currentTarget;try{S.setPointerCapture?.(z.pointerId)}catch{}const C=s==="horizontal",M=C?$.offsetWidth:$.offsetHeight,R=C?z.clientX:z.clientY,B=[...o],y=document.body.style.userSelect;document.body.style.userSelect="none";const g=n.map(L=>L.collapsible?0:L.minSize?L.minSize/M*100:5),T=g.reduce((L,Q)=>L+Q,0),A=T>100?100/T:1,N=n.map(L=>L.maxSize?L.maxSize/M*100:100),f=L=>{const Q=((C?L.clientX:L.clientY)-R)/M*100,x=[...B],E=B[w]+B[w+1],F=g[w]*A,D=g[w+1]*A,V=N[w],W=N[w+1];let K=B[w]+Q,ie=B[w+1]-Q;K<F&&(K=F,ie=E-F),ie<D&&(ie=D,K=E-D),K>V&&(K=V,ie=E-V),ie>W&&(ie=W,K=E-W),x[w]=K,x[w+1]=ie,h(x),t?.(x)},O=()=>{try{S.releasePointerCapture?.(z.pointerId)}catch{}document.removeEventListener("pointermove",f),document.removeEventListener("pointerup",O),document.removeEventListener("pointercancel",O),document.body.style.userSelect=y};document.addEventListener("pointermove",f),document.addEventListener("pointerup",O),document.addEventListener("pointercancel",O)},[o,s,n,t]),_=s==="horizontal";return l?null:e.jsx("div",{ref:m,"data-testid":r,className:`nice-splitter nice-splitter--${s} ${c||""}`,style:{display:"flex",flexDirection:_?"row":"column",height:"100%",...d},children:n.map((w,z)=>{const $=`calc(${o[z]}% - ${a*(n.length-1)/n.length}px)`;return e.jsxs(i.Fragment,{children:[e.jsx("div",{className:"nice-splitter__pane",style:{"--nice-splitter-pane-size":$,[_?"width":"height"]:$,overflow:"auto"},children:w.render()}),z<n.length-1&&e.jsx("div",{className:`nice-splitter__gutter nice-splitter__gutter--${s}`,role:"separator","aria-orientation":_?"vertical":"horizontal",style:{[_?"width":"height"]:a,cursor:_?"col-resize":"row-resize",flexShrink:0,touchAction:"none"},onPointerDown:S=>I(z,S),children:e.jsx("span",{className:"nice-splitter__grip","aria-hidden":"true"})})]},w.key)})})},Hs=[],Jn=({items:n=Hs,orientation:s="vertical",activeId:a,onSelect:t,"aria-label":c,size:r="md",className:d,style:p,id:v,title:u,accessMode:l,"data-testid":m})=>{const{t:o}=b.useNiceTranslation(),h=b.useNiceAccessMode(l,v),k=i.useRef(null);if(b.useRovingFocus(k,{orientation:s,itemSelector:".nice-icon-rail__item"}),h==="hidden")return null;const I=h==="disabled"||h==="readOnly";return e.jsx("div",{ref:k,id:v,title:u,"data-testid":m,role:"toolbar","aria-orientation":s,"aria-label":c??o("iconRail.label","Shortcuts"),className:["nice-icon-rail",`nice-icon-rail--${s}`,`nice-icon-rail--${r}`,d??""].filter(Boolean).join(" "),style:p,children:n.map(_=>{const w=_.id===a;return e.jsxs("button",{type:"button",className:`nice-icon-rail__item${w?" nice-icon-rail__item--active":""}`,title:_.title??_.label,"aria-current":w?"page":void 0,disabled:I||_.disabled,onClick:()=>{_.onClick?.(),t?.(_)},children:[e.jsxs("span",{className:"nice-icon-rail__icon","aria-hidden":"true",children:[_.icon,_.badge!==void 0&&_.badge!==""&&e.jsx("span",{className:"nice-icon-rail__badge",children:_.badge})]}),e.jsx("span",{className:"nice-icon-rail__label",children:_.label})]},_.id)})})},Qn=10,Ks=.12,Zn="var(--nice-text-on-warning, #0f172a)";function ln(n){return Math.min(Math.max(n,1),Qn)}function yn(n){return b.isDerivableColor(n)?b.nestingLevelColors(1,{palette:[n]},n,Zn)[0]:{bg:n,text:"inherit",hoverBg:`color-mix(in srgb, ${n} 88%, currentColor)`,activeBg:`color-mix(in srgb, ${n} 76%, currentColor)`}}function es(n,s,a){const t=Qn-ln(s)+1;if(n.length===0)return[];const c=n.slice(0,t).map(yn),r=t-c.length;if(r>0){const d=n[n.length-1];if(b.isDerivableColor(d)){const p=b.nestingLevelColors(r+1,{palette:[d],bgDerivation:a,bgStep:Ks},d,Zn);c.push(...p.slice(1))}else c.push(...Array.from({length:r},()=>yn(d)))}return c}function ns(n,s){const a={};return n.forEach((t,c)=>{const r=ln(s)+c;a[`--nice-sidebar-level-${r}-bg`]=t.bg,a[`--nice-sidebar-level-${r}-text`]=t.text,a[`--nice-sidebar-level-${r}-hover-bg`]=t.hoverBg,a[`--nice-sidebar-level-${r}-active-bg`]=t.activeBg}),a}function ss(n,s){return n&&n.length>0?{colors:es(n,1,s),fromLevel:1}:{fromLevel:1}}function zn(n,s,a,t){const c=s?.levelColors?.length?s.levelColors:s?.color?[s.color]:void 0;if(!c)return{scope:n};const r=ln(a),d=es(c,r,t);return{scope:{colors:d,fromLevel:r,branchColor:c[0]},vars:ns(d,r)}}function cn(n,s){return n.colors?.[ln(s)-n.fromLevel]}function Ys(n){return yn(n)}const sn=n=>i.createElement(b.NiceIcon,{name:n,size:18}),Us=sn("list"),Vs=sn("user"),Ws=sn("building"),Gs=sn("star"),qs=sn("search"),Xs=sn("settings"),rn={all:{icon:Us,label:"Everything"},"by-role":{icon:Vs,label:"By role"},"by-unit":{icon:Ws,label:"By unit"},favorites:{icon:Gs,label:"Favorites"},search:{icon:qs,label:"Search"},preferences:{icon:Xs,label:"Preferences"}},Js={all:"all","by-role":"byRole","by-unit":"byUnit",favorites:"favorites",search:"search",preferences:"preferences"};function an(n,s){const a=rn[s];return a?n(`sidebarNav.mode.${Js[s]}`,a.label):s}const We="favorites",Ln={enableModeIcons:!1,enabledModes:["all","by-role","by-unit","favorites","search","preferences"],activeMode:"all",pinnedSources:{},hiddenItems:[],favorites:[],favoriteLists:[],activeFavoriteListId:We,activeGroupId:{},maxDepth:{},collapsedIds:[],autoExpand:!0,leftClickBehavior:"focus-existing",itemOrder:{},colorStyle:"bar",pageMode:"auto"};function is(n,s){return[{id:We,label:s,items:n.favorites,createdAt:0},...n.favoriteLists??[]]}function mn(n,s){return s===We?n.favorites:n.favoriteLists?.find(a=>a.id===s)?.items??[]}function as(n){const s=n.activeFavoriteListId;return s&&(n.favoriteLists??[]).some(a=>a.id===s)?s:We}function bn(n,s){const a=n.favorites.some(t=>t.id===s)?[We]:[];for(const t of n.favoriteLists??[])t.items.some(c=>c.id===s)&&a.push(t.id);return a}function kn(n){return{...n,icon:typeof n.icon=="string"?n.icon:void 0,tooltip:typeof n.tooltip=="string"?n.tooltip:void 0,...n.path?{path:ts(n.path)}:{}}}function ts(n){return n.map(s=>typeof s.icon=="string"?{id:s.id,label:s.label,icon:s.icon}:{id:s.id,label:s.label})}function cs(n,s,a){const t=[],c=(r,d)=>{let p=r.find(v=>v.id===d.id);return p||(p={id:d.id,label:d.label,icon:d.icon,children:[]},r.push(p)),p};for(const r of n){let d=t;for(const v of s(r))d=c(d,v).children;const p=c(d,r);p.favorite=r,p.label=r.label,p.icon=r.icon??p.icon}if(a){const r=d=>{const p=v=>a(v.id)??Number.POSITIVE_INFINITY;d.sort((v,u)=>p(v)===p(u)?0:p(v)<p(u)?-1:1),d.forEach(v=>r(v.children))};r(t)}return t}const dn=n=>({id:n.id,label:n.label,icon:n.icon});function vn(n,s,a={}){const t=a.trees??["modules"],c=a.shading??"tint",r=ss(a.levelColors,c),d=(u,l,m,o,h,k)=>{const{scope:I}=zn(h,u,m,c);return s({item:u,kind:l,depth:m,ancestors:o,branchColor:I.branchColor,color:cn(I,m)?.bg,...k})===!1?void 0:I},p=(u,l,m,o,h)=>{for(const k of u){const I=d(k,"view",l,m,o,h);I&&k.children?.length&&p(k.children,l+1,[...m,dn(k)],I,h)}},v=(u,l,m,o,h,k)=>{for(const I of u){const _={sourceId:h,moduleId:I.id,tree:k},w=d(I,"module",l,m,o,_);w&&p(I.views,l+1,[...m,dn(I)],w,_)}};for(const u of n){const l=u.source,m=d(l,"source",1,[],r,{sourceId:l.id});if(!m)continue;const o=[dn(l)];for(const h of t){if(h==="modules"){v(u.modules,2,o,m,l.id,h);continue}const k=h==="roles"?u.roles:u.units;for(const I of k){const w=d(I,h==="roles"?"role":"unit",2,o,m,{sourceId:l.id,tree:h});w&&v(I.modules,3,[...o,dn(I)],w,l.id,h)}}}}function Qs(n,s,a={}){let t;return vn(n,c=>{if(t)return!1;if(c.kind==="view"&&c.item.route===s)return t=c,!1},{trees:["modules","roles","units"],...a}),t}function Zs(n,s){const a=(c,r)=>c.map(d=>{const p=s(d,r);return d.children?.length?{...p,children:a(d.children,r+1)}:p}),t=(c,r)=>c.map(d=>({...d,views:a(d.views,r+1)}));return n.map(c=>({...c,modules:t(c.modules,2),roles:c.roles.map(r=>({...r,modules:t(r.modules,3)})),units:c.units.map(r=>({...r,modules:t(r.modules,3)}))}))}const ei=e.jsx(b.NiceIcon,{name:"settings",size:16}),ni=e.jsx(b.NiceIcon,{name:"columns",size:16}),si=e.jsx(b.NiceIcon,{name:"list",size:16}),ii=e.jsx(b.NiceIcon,{name:"eye-off",size:16}),ai=e.jsx(b.NiceIcon,{name:"refresh-ccw",size:16}),Dn=[{id:"prefs-general",route:"preferences/general",labelKey:"sidebar.prefs.general",labelDefault:"General",icon:ei},{id:"prefs-display",route:"preferences/display",labelKey:"sidebar.prefs.display",labelDefault:"Display",icon:ni},{id:"prefs-order",route:"preferences/order",labelKey:"sidebar.prefs.order",labelDefault:"Order",icon:si},{id:"prefs-hidden",route:"preferences/hidden",labelKey:"sidebar.prefs.hidden",labelDefault:"Hidden items",icon:ii},{id:"prefs-reset",route:"preferences/reset",labelKey:"sidebar.prefs.reset",labelDefault:"Reset",icon:ai}];function ti(n){return Dn.map(s=>({id:s.id,label:n(s.labelKey,s.labelDefault),icon:s.icon,route:s.route}))}function rs({anchorRef:n,onClose:s,options:a,selected:t,multiple:c=!1,onPick:r,onCreate:d,footer:p,title:v,"aria-label":u}){const{t:l}=b.useNiceTranslation(),m=b.useControlId(),[o,h]=i.useState(""),[k,I]=i.useState(null),{popupRef:_,coords:w,ready:z,themeClass:$,portalTarget:S}=en.useAnchoredPopup(!0,n,s,{maxHeight:360}),C=o.trim(),M=i.useMemo(()=>{const L=C.toLowerCase(),Q=a.filter(E=>!L||E.label.toLowerCase().includes(L)).map(E=>({kind:"option",option:E})),x=a.some(E=>E.label.toLowerCase()===L);return d&&!x&&k===null&&Q.push({kind:"create",label:C}),Q},[a,C,d,k]),R=L=>{d?.(L),h(""),I(null),c||s()},B=L=>{if(L.kind==="create"){L.label?R(L.label):I("");return}r(L.option.id),c||s()},{activeIndex:y,setActiveIndex:g,handleKeyDown:T}=Xe.useListKeyboardNav(M,{open:!0,onSelect:B,onClose:s,intentRef:_}),A=L=>`${m}-o${L}`,N=i.useRef(null);i.useEffect(()=>{z&&N.current?.focus()},[z]);const f=i.useRef(null),O=k!==null;return i.useEffect(()=>{O&&f.current?.focus()},[O]),!w||!S?null:hn.createPortal(e.jsxs("div",{ref:_,className:`nice-select__dropdown nice-sidebar-nav__scope-panel${$?` ${$}`:""}`,"data-theme":$==="nice-dark"?"dark":$==="nice-light"?"light":void 0,style:{position:"fixed",left:w.left,top:w.top,width:Math.max(w.width,220),maxHeight:360,zIndex:1e3,opacity:z?1:0,pointerEvents:z?void 0:"none"},children:[e.jsxs("div",{className:"nice-sidebar-nav__scope-head",children:[e.jsx("span",{className:"nice-sidebar-nav__scope-title",children:v??u}),e.jsx("button",{type:"button",className:"nice-sidebar-nav__scope-close","aria-label":l("controls.close","Close"),title:l("controls.close","Close"),onClick:s,children:e.jsx(b.NiceIcon,{name:"close",size:14})})]}),e.jsx("div",{className:"nice-select__search",children:e.jsx("input",{type:"text",value:o,onChange:L=>{h(L.target.value),g(0)},onKeyDown:T,placeholder:l("controls.search","Search..."),"aria-label":l("controls.search","Search..."),"aria-controls":m,"aria-activedescendant":M.length>0?A(y):void 0,"aria-autocomplete":"list",ref:N})}),e.jsxs("div",{id:m,role:"listbox","aria-label":u,"aria-multiselectable":c||void 0,className:"nice-sidebar-nav__scope-options",children:[M.length===0&&e.jsx("div",{className:"nice-select__empty",children:l("controls.noResults","No results found")}),M.map((L,Q)=>{const x=L.kind==="option"&&t.includes(L.option.id);return e.jsx("button",{id:A(Q),type:"button",role:"option",tabIndex:-1,"aria-selected":x,className:["nice-select__option","nice-sidebar-nav__scope-option",x?"nice-select__option--selected":"",Q===y?"nice-select__option--highlighted":"",L.kind==="create"?"nice-sidebar-nav__scope-option--create":""].filter(Boolean).join(" "),onMouseEnter:()=>g(Q),onClick:()=>B(L),children:L.kind==="create"?e.jsxs(e.Fragment,{children:[e.jsx(b.NiceIcon,{name:"plus",size:14}),e.jsx("span",{className:"nice-sidebar-nav__scope-option-label",children:C?l("sidebarNav.favLists.createNamed",'Create "{name}"').replace("{name}",C):l("sidebarNav.favLists.create","New list…")})]}):e.jsxs(e.Fragment,{children:[c&&e.jsx("span",{className:`nice-sidebar-nav__scope-check${x?" nice-sidebar-nav__scope-check--on":""}`,"aria-hidden":"true",children:x&&e.jsx(b.NiceIcon,{name:"check",size:12})}),e.jsx("span",{className:"nice-sidebar-nav__scope-option-label",children:L.option.label}),L.option.count!==void 0&&e.jsx("span",{className:"nice-sidebar-nav__scope-count",children:L.option.count}),!c&&x&&e.jsx(b.NiceIcon,{name:"check",size:14,className:"nice-select__option-check"})]})},L.kind==="option"?L.option.id:"__create")})]}),k!==null&&e.jsxs("form",{className:"nice-sidebar-nav__scope-edit nice-sidebar-nav__scope-new",onSubmit:L=>{L.preventDefault(),k.trim()&&R(k.trim())},children:[e.jsx("input",{ref:f,className:"nice-sidebar-nav__scope-field",value:k,onChange:L=>I(L.target.value),placeholder:l("sidebarNav.favLists.renameField","List name"),"aria-label":l("sidebarNav.favLists.renameField","List name")}),e.jsx("button",{type:"submit",className:"nice-sidebar-nav__scope-action nice-sidebar-nav__scope-action--primary",disabled:!k.trim(),children:l("sidebarNav.favLists.createButton","Create")}),e.jsx("button",{type:"button",className:"nice-sidebar-nav__scope-action",onClick:()=>I(null),children:l("sidebarNav.favLists.cancel","Cancel")})]}),p&&e.jsx("div",{className:"nice-sidebar-nav__scope-footer",children:p})]}),S)}function ci({label:n,onRename:s,onRemove:a}){const{t}=b.useNiceTranslation(),[c,r]=i.useState("idle"),[d,p]=i.useState(n),v=i.useRef(null);return i.useEffect(()=>{c==="rename"&&(v.current?.focus(),v.current?.select())},[c]),c==="rename"?e.jsxs("form",{className:"nice-sidebar-nav__scope-edit",onSubmit:u=>{u.preventDefault(),d.trim()&&s(d.trim()),r("idle")},children:[e.jsx("input",{ref:v,className:"nice-sidebar-nav__scope-field",value:d,onChange:u=>p(u.target.value),"aria-label":t("sidebarNav.favLists.renameField","List name")}),e.jsx("button",{type:"submit",className:"nice-sidebar-nav__scope-action",children:t("sidebarNav.favLists.save","Save")}),e.jsx("button",{type:"button",className:"nice-sidebar-nav__scope-action",onClick:()=>r("idle"),children:t("sidebarNav.favLists.cancel","Cancel")})]}):c==="remove"?e.jsxs("div",{className:"nice-sidebar-nav__scope-edit",role:"group","aria-label":n,children:[e.jsx("span",{className:"nice-sidebar-nav__scope-question",children:t("sidebarNav.favLists.removeConfirm",'Remove the list "{name}"?').replace("{name}",n)}),e.jsx("button",{type:"button",className:"nice-sidebar-nav__scope-action nice-sidebar-nav__scope-action--danger",onClick:a,children:t("sidebarNav.favLists.remove","Remove")}),e.jsx("button",{type:"button",className:"nice-sidebar-nav__scope-action",onClick:()=>r("idle"),children:t("sidebarNav.favLists.cancel","Cancel")})]}):e.jsxs("div",{className:"nice-sidebar-nav__scope-edit",children:[e.jsxs("button",{type:"button",className:"nice-sidebar-nav__scope-action",onClick:()=>{p(n),r("rename")},children:[e.jsx(b.NiceIcon,{name:"edit",size:14}),t("sidebarNav.favLists.rename","Rename")]}),e.jsxs("button",{type:"button",className:"nice-sidebar-nav__scope-action nice-sidebar-nav__scope-action--danger",onClick:()=>r("remove"),children:[e.jsx(b.NiceIcon,{name:"trash",size:14}),t("sidebarNav.favLists.removeList","Remove the list")]})]})}function Pn({options:n,value:s,onChange:a,collapsed:t=!1,icon:c,"aria-label":r,onCreate:d,renderFooter:p}){const{t:v}=b.useNiceTranslation(),u=i.useRef(null),[l,m]=i.useState(!1),o=Math.max(0,n.findIndex(_=>_.id===s)),h=n[o],k=_=>{n.length>1&&a(n[(o+_+n.length)%n.length].id)},I=()=>m(!1);return e.jsxs("div",{ref:u,role:"group","aria-label":r,className:`nice-sidebar-nav__scope${t?" nice-sidebar-nav__scope--collapsed":""}`,children:[e.jsx("button",{type:"button",className:"nice-sidebar-nav__scope-arrow","aria-label":v("sidebarNav.scope.previous","Previous"),title:v("sidebarNav.scope.previous","Previous"),disabled:n.length<2,onClick:()=>k(-1),children:e.jsx(b.NiceIcon,{name:"chevron-left",size:16})}),e.jsxs("button",{type:"button",className:"nice-sidebar-nav__scope-current","aria-haspopup":"listbox","aria-expanded":l,title:h?.label,onClick:()=>m(_=>!_),onKeyDown:_=>{(_.key==="ArrowLeft"||_.key==="ArrowRight")&&(_.preventDefault(),k(_.key==="ArrowLeft"?-1:1))},children:[e.jsx("span",{className:"nice-sidebar-nav__scope-icon","aria-hidden":"true",children:c}),!t&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nice-sidebar-nav__scope-name",children:h?.label}),h?.count!==void 0&&e.jsx("span",{className:"nice-sidebar-nav__scope-count",children:h.count}),e.jsx("span",{className:"nice-sidebar-nav__scope-caret","aria-hidden":"true",children:e.jsx(b.NiceIcon,{name:"chevron-down",size:14})})]})]}),e.jsx("button",{type:"button",className:"nice-sidebar-nav__scope-arrow","aria-label":v("sidebarNav.scope.next","Next"),title:v("sidebarNav.scope.next","Next"),disabled:n.length<2,onClick:()=>k(1),children:e.jsx(b.NiceIcon,{name:"chevron-right",size:16})}),l&&e.jsx(rs,{anchorRef:u,onClose:I,options:n,selected:h?[h.id]:[],onPick:a,onCreate:d,footer:p?.(I),"aria-label":r})]})}function nn(n){return typeof n=="string"?e.jsx(b.NiceIcon,{name:n}):n}const ri=[],on=i.createContext(!1),ls=i.createContext(!0),os=i.createContext(null);function Bn(n,s){const a=new Set(s.map(c=>c.toLowerCase()));let t=n;for(let c=2;a.has(t.toLowerCase());c++)t=`${n} ${c}`;return t}function ds(n){return`nice_sidebar_nav_${n??"_default"}`}const _n="nice-sidebar-prefs-change";function Hn(n,s){const a={...Ln,userId:n??"_default"};if(s&&Object.assign(a,s),s&&typeof s.activeMode<"u")return a;try{const t=localStorage.getItem(ds(n));if(t){const c=JSON.parse(t);return Array.isArray(c.favorites)&&(c.favorites=c.favorites.map(r=>r&&typeof r=="object"?{...r,icon:typeof r.icon=="string"||i.isValidElement(r.icon)?r.icon:void 0}:r)),{...a,...c,userId:n??"_default"}}}catch{}return a}function xn(n,s,a,t){if(s===We){const p=n.favorites.some(v=>v.id===a.id);return t===p?n:{...n,favorites:t?[...n.favorites,{...a,addedAt:Date.now()}]:n.favorites.filter(v=>v.id!==a.id)}}const c=n.favoriteLists??[],r=c.find(p=>p.id===s);if(!r||t===r.items.some(p=>p.id===a.id))return n;const d=t?[...r.items,{...kn(a),addedAt:Date.now()}]:r.items.filter(p=>p.id!==a.id);return{...n,favoriteLists:c.map(p=>p.id===s?{...p,items:d}:p)}}function us(n,s,a,t){const[c,r]=i.useState(()=>{const l=Hn(n,a);return s!==void 0&&(l.enableModeIcons=s),l}),d=i.useRef(a);i.useEffect(()=>{!a||d.current===a||(d.current=a,r(l=>({...l,...a})))},[a]);const p=i.useRef(c);p.current=c;const v=i.useCallback(l=>{const m=p.current,o=l(m);if(o!==m){if(p.current=o,r(o),!a?.activeMode)try{const h={...o,favorites:o.favorites.map(k=>({...k,icon:void 0})),favoriteLists:(o.favoriteLists??[]).map(k=>({...k,items:k.items.map(kn)}))};localStorage.setItem(ds(n),JSON.stringify(h)),typeof window<"u"&&window.dispatchEvent(new CustomEvent(_n,{detail:{userId:n??"_default"}}))}catch{}if(t){const h={};for(const k of Object.keys(o))o[k]!==m[k]&&(h[k]=o[k]);t(o,h)}}},[n,a,t]);i.useEffect(()=>{if(typeof window>"u")return;const l=m=>{m.detail?.userId===(n??"_default")&&r(h=>{const k=Hn(n,a);return s!==void 0&&(k.enableModeIcons=s),JSON.stringify(h)===JSON.stringify(k)?h:k})};return window.addEventListener(_n,l),()=>window.removeEventListener(_n,l)},[n,a,s]);const u=i.useMemo(()=>({setMode:l=>v(m=>({...m,activeMode:l})),setEnableModeIcons:l=>v(m=>({...m,enableModeIcons:l})),toggleMode:l=>v(m=>{if(l==="preferences")return m;const o=m.enabledModes.includes(l);return{...m,enabledModes:o?m.enabledModes.filter(h=>h!==l):[...m.enabledModes,l],activeMode:!o||m.activeMode!==l?m.activeMode:"all"}}),pinSource:(l,m)=>v(o=>({...o,pinnedSources:{...o.pinnedSources,[l]:[...o.pinnedSources[l]??[],m]}})),unpinSource:(l,m)=>v(o=>({...o,pinnedSources:{...o.pinnedSources,[l]:(o.pinnedSources[l]??[]).filter(h=>h!==m)}})),hideItem:l=>v(m=>({...m,hiddenItems:m.hiddenItems.some(o=>o.id===l.id)?m.hiddenItems:[...m.hiddenItems,l]})),restoreItem:l=>v(m=>({...m,hiddenItems:m.hiddenItems.filter(o=>o.id!==l)})),addFavorite:(l,m=We)=>v(o=>xn(o,m,l,!0)),removeFavorite:(l,m=We)=>v(o=>xn(o,m,{id:l,label:l,addedAt:0},!1)),toggleFavoriteInList:(l,m)=>v(o=>xn(o,m,l,!mn(o,m).some(h=>h.id===l.id))),createFavoriteList:(l,m)=>{const o=`list-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`;return v(h=>(h.favoriteLists??[]).some(k=>k.id===o)?h:{...h,favoriteLists:[...h.favoriteLists??[],{id:o,label:l,items:m?[{...kn(m),addedAt:Date.now()}]:[],createdAt:Date.now()}]}),o},renameFavoriteList:(l,m)=>v(o=>({...o,favoriteLists:(o.favoriteLists??[]).map(h=>h.id===l?{...h,label:m}:h)})),removeFavoriteList:l=>v(m=>l===We?m:{...m,favoriteLists:(m.favoriteLists??[]).filter(o=>o.id!==l),activeFavoriteListId:m.activeFavoriteListId===l?We:m.activeFavoriteListId}),setActiveFavoriteList:l=>v(m=>({...m,activeFavoriteListId:l})),setActiveGroup:(l,m)=>v(o=>({...o,activeGroupId:{...o.activeGroupId,[l]:m}})),setMaxDepth:(l,m)=>v(o=>({...o,maxDepth:{...o.maxDepth,[l]:Math.min(10,Math.max(1,m))}})),toggleCollapse:l=>v(m=>({...m,collapsedIds:m.collapsedIds.includes(l)?m.collapsedIds.filter(o=>o!==l):[...m.collapsedIds,l]})),setCollapsed:(l,m)=>v(o=>({...o,collapsedIds:m?Array.from(new Set([...o.collapsedIds,...l])):o.collapsedIds.filter(h=>!l.includes(h))})),setAutoExpand:l=>v(m=>({...m,autoExpand:l})),setLeftClickBehavior:l=>v(m=>({...m,leftClickBehavior:l})),reorderItems:(l,m)=>v(o=>{const h={...o.itemOrder};return m==null?delete h[l]:h[l]=m,{...o,itemOrder:h}}),setColorStyle:l=>v(m=>({...m,colorStyle:l})),setPageMode:l=>v(m=>({...m,pageMode:l})),resetAll:()=>v(()=>({...Ln,userId:n??"_default"}))}),[v,n]);return[c,u]}function li({enabledModes:n,activeMode:s,onSelect:a,collapsed:t=!1}){const c=i.useRef(null);b.useRovingFocus(c,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const r=i.useRef(null);b.useRovingFocus(r,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const{t:d}=b.useNiceTranslation(),p=[...n.filter(u=>u!=="preferences"),"preferences"],v=d("sidebarNav.modeBar.label","Navigation mode");if(t){const u=Math.max(0,p.indexOf(s)),l=p[(u-1+p.length)%p.length],m=p[(u+1)%p.length],o=rn[s],h=an(d,s);return e.jsxs("div",{className:"nice-sidebar-nav__mode-bar nice-sidebar-nav__mode-bar--carousel",ref:c,role:"tablist","aria-label":v,children:[e.jsx(Ae,{content:`${d("sidebarNav.modeBar.previous","Previous mode")}: ${an(d,l)}`,position:"bottom",size:"sm",children:e.jsx("button",{type:"button",className:"nice-sidebar-nav__mode-arrow","aria-label":d("sidebarNav.modeBar.previous","Previous mode"),onClick:()=>a(l),children:e.jsx("span",{"aria-hidden":"true",children:"‹"})})}),e.jsx(Ae,{content:h,position:"bottom",size:"sm",children:e.jsx("button",{type:"button",role:"tab","aria-selected":!0,"aria-label":h,className:"nice-sidebar-nav__mode-pill nice-sidebar-nav__mode-pill--active nice-sidebar-nav__mode-pill--carousel",onClick:()=>a(s),children:e.jsx("span",{className:"nice-sidebar-nav__mode-pill-icon","aria-hidden":"true",children:o.icon})})}),e.jsx(Ae,{content:`${d("sidebarNav.modeBar.next","Next mode")}: ${an(d,m)}`,position:"bottom",size:"sm",children:e.jsx("button",{type:"button",className:"nice-sidebar-nav__mode-arrow","aria-label":d("sidebarNav.modeBar.next","Next mode"),onClick:()=>a(m),children:e.jsx("span",{"aria-hidden":"true",children:"›"})})})]})}return e.jsx("div",{className:"nice-sidebar-nav__mode-bar",ref:r,role:"tablist","aria-label":v,children:p.map(u=>{const l=rn[u],m=an(d,u),o=s===u;return e.jsx(Ae,{content:m,position:"bottom",size:"sm",children:e.jsxs("button",{role:"tab","aria-selected":o,"aria-label":m,className:["nice-sidebar-nav__mode-pill",o?"nice-sidebar-nav__mode-pill--active":""].filter(Boolean).join(" "),onClick:()=>a(u),children:[e.jsx("span",{className:"nice-sidebar-nav__mode-pill-icon","aria-hidden":"true",children:l.icon}),e.jsx("span",{className:"nice-sidebar-nav__mode-pill-label",children:m})]})},u)})})}function Rn({open:n,size:s=16}){return e.jsx(b.NiceIcon,{name:"chevron-down",size:s,style:{transition:"transform 160ms ease",transform:n?"rotate(0deg)":"rotate(-90deg)"}})}function oi({size:n=14}){return e.jsx(b.NiceIcon,{name:"star",size:n})}function ms({size:n=14}){return e.jsx(b.NiceIcon,{name:"star",size:n,style:{fill:"currentColor"}})}function hs({size:n=14}){return e.jsx(b.NiceIcon,{name:"eye-off",size:n})}function di({size:n=14,filled:s=!1}){return e.jsx(b.NiceIcon,{name:"pin",size:n,style:s?{fill:"currentColor"}:void 0})}function Tn({size:n=12}){return e.jsx(b.NiceIcon,{name:"close",size:n})}function On({item:n,depth:s,maxDepth:a,activeRoute:t,collapsedIds:c,hiddenIds:r,autoExpand:d,sidebarCollapsed:p=!1,expandableWhenCollapsed:v=!1,onNavigate:u,onHide:l,onToggleCollapse:m,onAddFavorite:o,onRemoveFavorite:h,isFavorite:k,leftClickBehavior:I="focus-existing",routeToUrl:_,contextMenu:w=!0,disabledActions:z,colorScope:$,shading:S,path:C,onRemoveFromList:M}){const{t:R}=b.useNiceTranslation(),B=i.useContext(on),y=i.useContext(ls),g=i.useContext(os),[T,A]=i.useState(!1),N=i.useRef(null),f=(n.children?.length??0)>0&&s<a,O=c.includes(n.id),L=d?!O:O,Q=!!(n.route&&t&&n.route===t),x=!!n.route,E=x&&k(n.id),{scope:F,vars:D}=i.useMemo(()=>zn($,n,s,S),[$,n,s,S]),V=i.useMemo(()=>[...C,{id:n.id,label:n.label,icon:n.icon}],[C,n.id,n.label,n.icon]),W=i.useCallback(J=>({forceNew:J,color:cn(F,s)?.bg,branchColor:F.branchColor,path:V}),[F,s,V]),K=i.useCallback(()=>({id:n.id,label:n.label,icon:n.icon,route:n.route,sourceId:n.sourceId,moduleId:n.moduleId,color:F.branchColor??cn(F,s)?.bg,path:ts(C),addedAt:Date.now()}),[n,F,s,C]),ie=i.useMemo(()=>{if(!w||!x||!n.route)return[];const J=n.route,_e=[{id:"open",label:R("sidebar.menu.open","Open"),onClick:()=>u?.(J,n,W(!1))}];return y&&_e.push({id:"openNewTab",label:R("sidebar.menu.openNewTab","Open in new tab"),onClick:()=>u?.(J,n,W(!0))}),_&&_e.push({id:"openBrowserTab",label:R("sidebar.menu.openBrowserTab","Open in new browser tab"),onClick:()=>{typeof window<"u"&&window.open(_(J),"_blank","noopener,noreferrer")}}),_e.push({id:"sep-1",divider:!0}),M?_e.push({id:"removeFromList",label:R("sidebarNav.removeFavourite","Remove from favourites"),onClick:()=>M(n.id)}):E?_e.push({id:"unpinFavorite",label:R("sidebar.menu.unpinFavorite","Remove from favorites"),onClick:()=>h(n.id)}):_e.push({id:"pinFavorite",label:R("sidebar.menu.pinFavorite","Add to favorites"),onClick:()=>o(K())}),g&&_e.push({id:"favoriteLists",label:R("sidebarNav.favLists.addTo","Add to a list…"),onClick:()=>A(!0)}),M||_e.push({id:"hide",label:R("sidebar.menu.hide","Hide"),disabled:!!z?.has("hide"),onClick:()=>l({id:n.id,kind:n.kind,label:n.label})}),_&&(_e.push({id:"sep-2",divider:!0}),_e.push({id:"copyLink",label:R("sidebar.menu.copyLink","Copy link"),onClick:()=>{typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(_(J))}})),_e},[w,y,z,x,n,E,_,u,o,h,l,W,K,g,M,R]);if(r.has(n.id))return null;function Z(){if(f&&!x){z?.has("collapseToggle")||m(n.id);return}x&&n.route&&(u?.(n.route,n,W(I==="open-new")),f&&!L&&!z?.has("collapseToggle")&&m(n.id))}const ne=ln(s),ee=cn(F,s),ce=p?V.map(J=>J.label).join(" › "):n.tooltip??n.label;return e.jsxs("li",{className:["nice-sidebar-nav__node",`nice-sidebar-nav__node--depth-${s}`,s>4?"nice-sidebar-nav__node--deep":"",ee?B?"nice-sidebar-nav__node--colored":"nice-sidebar-nav__node--marked":"",Q?"nice-sidebar-nav__node--active":"",f?"nice-sidebar-nav__node--branch":"nice-sidebar-nav__node--leaf"].filter(Boolean).join(" "),"data-nice-depth":s,style:{...D,"--nice-depth":s,...B?{"--nice-row-bg":`var(--nice-sidebar-level-${ne}-bg, transparent)`,"--nice-row-text":`var(--nice-sidebar-level-${ne}-text, inherit)`,"--nice-row-border":`var(--nice-sidebar-level-${ne}-border, transparent)`,"--nice-row-hover-bg":`var(--nice-sidebar-level-${ne}-hover-bg, var(--nice-hover-bg))`,"--nice-row-active-bg":`var(--nice-sidebar-level-${ne}-active-bg, var(--nice-selected-bg))`,"--nice-row-accent":`var(--nice-sidebar-level-${ne}-text, var(--nice-color-primary, #3b82f6))`,"--nice-row-label":`var(--nice-sidebar-level-${ne}-text, var(--nice-text-primary))`,"--nice-row-muted":`var(--nice-sidebar-level-${ne}-text, var(--nice-text-muted))`}:ee&&{"--nice-row-mark":ee.bg}},children:[e.jsxs("div",{className:"nice-sidebar-nav__node-row",ref:N,children:[f&&e.jsx(Ae,{content:L?R("sidebarNav.collapse","Collapse"):R("sidebarNav.expand","Expand"),position:"right",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__collapse-btn","aria-label":L?R("sidebarNav.collapse","Collapse"):R("sidebarNav.expand","Expand"),"aria-expanded":L,disabled:z?.has("collapseToggle"),onClick:()=>m(n.id),children:e.jsx(Rn,{open:L,size:20})})}),!f&&e.jsx("span",{className:"nice-sidebar-nav__collapse-spacer"}),e.jsx(Ae,{content:ce,position:"right",size:"sm",children:e.jsxs("span",{role:x?"link":void 0,tabIndex:x?0:void 0,className:["nice-sidebar-nav__node-content",x?"nice-sidebar-nav__node-content--link":"",!x&&f?"nice-sidebar-nav__node-content--toggle":""].filter(Boolean).join(" "),onClick:Z,onKeyDown:J=>(J.key==="Enter"||J.key===" ")&&Z(),children:[n.icon&&e.jsx("span",{className:"nice-sidebar-nav__node-icon","aria-hidden":"true",children:nn(n.icon)}),e.jsx("span",{className:"nice-sidebar-nav__node-label",children:n.label}),n.badge!==void 0&&e.jsx("span",{className:"nice-sidebar-nav__node-badge","aria-label":`${n.badge} ${R("sidebarNav.notifications","notifications")}`,children:n.badge})]})}),e.jsxs("div",{className:"nice-sidebar-nav__node-actions",children:[x&&e.jsx(Ae,{content:E?R("sidebarNav.inFavorites","In favorites"):R("sidebarNav.addFavorite","Add to favorites"),position:"top",size:"sm",children:e.jsx("button",{type:"button",className:`nice-sidebar-nav__action-btn ${E?"nice-sidebar-nav__action-btn--fav-active":"nice-sidebar-nav__action-btn--fav"}`,"aria-label":E?R("sidebarNav.inFavorites","In favorites"):R("sidebarNav.addFavorite","Add to favorites"),"aria-haspopup":g?"listbox":void 0,"aria-expanded":g?T:void 0,onClick:J=>{J.stopPropagation(),g?A(_e=>!_e):E||o(K())},children:E?e.jsx(ms,{size:14}):e.jsx(oi,{size:14})})}),M?x&&e.jsx(Ae,{content:R("sidebarNav.removeFavourite","Remove from favourites"),position:"top",size:"sm",children:e.jsx("button",{type:"button",className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--remove","aria-label":R("sidebarNav.removeFavourite","Remove from favourites"),onClick:J=>{J.stopPropagation(),M(n.id)},children:e.jsx(Tn,{size:12})})}):e.jsx(Ae,{content:R("sidebarNav.hideItem","Hide item"),position:"top",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--hide","aria-label":R("sidebarNav.hideItem","Hide item"),onClick:J=>{J.stopPropagation(),l({id:n.id,kind:n.kind,label:n.label})},children:e.jsx(hs,{size:14})})})]})]}),ie.length>0&&e.jsx(Mn,{target:N,items:ie,size:"sm"}),T&&g&&e.jsx(rs,{anchorRef:N,onClose:()=>A(!1),multiple:!0,options:g.lists,selected:g.listsOf(n.id),onPick:J=>g.toggle(K(),J),onCreate:J=>g.create(J,K()),"aria-label":R("sidebarNav.favLists.title","Favourites lists")}),f&&L&&e.jsx("ul",{className:"nice-sidebar-nav__children",children:n.children.map(J=>e.jsx(On,{item:J,depth:s+1,maxDepth:a,activeRoute:t,collapsedIds:c,hiddenIds:r,autoExpand:d,sidebarCollapsed:p,expandableWhenCollapsed:v,onNavigate:u,onHide:l,onToggleCollapse:m,onAddFavorite:o,onRemoveFavorite:h,isFavorite:k,leftClickBehavior:I,routeToUrl:_,contextMenu:w,disabledActions:z,colorScope:F,shading:S,path:V,onRemoveFromList:M},J.id))})]})}function ui(n,s){if(!s||s.length===0)return n;const a=new Map(s.map((c,r)=>[c,r])),t=s.length;return[...n].sort((c,r)=>{const d=a.has(c.id)?a.get(c.id):t+n.indexOf(c),p=a.has(r.id)?a.get(r.id):t+n.indexOf(r);return d-p})}function ps(n,s,a){return n.map(t=>({id:t.id,label:t.label,tooltip:t.tooltip,icon:t.icon,route:t.route,badge:t.badge,kind:"view",sourceId:s,moduleId:a,color:t.color,levelColors:t.levelColors,children:t.children?.length?ps(t.children,s,a):[]}))}function bs(n,s,a=n.id){return{id:a,label:n.label,tooltip:n.tooltip,icon:n.icon,kind:"module",sourceId:s,color:n.color,levelColors:n.levelColors,children:ps(n.views,s,n.id)}}function mi(n,s){return n.map(a=>bs(a,s))}function Fn(n,s,a){return n.map(t=>({id:t.id,label:t.label,tooltip:t.tooltip,icon:t.icon,kind:s,sourceId:a,color:t.color,levelColors:t.levelColors,children:t.modules.map(c=>bs(c,a,`${t.id}:${c.id}`))}))}function hi(n,s){return Fn(n,"role",s)}function pi(n,s){return Fn(n,"unit",s)}function vs(n,s,a,t){const{scope:c,vars:r}=zn(n,s,1,a),d=cn(c,1);return d?t?{scope:c,style:{...r,"--nice-source-head-bg":d.bg,"--nice-source-head-color":d.text,"--nice-source-head-bg-active":d.activeBg,"--nice-source-head-accent":d.text},marked:!1}:{scope:c,style:{...r,"--nice-source-mark":d.bg},marked:!0}:{scope:c,style:r,marked:!1}}function fs(n,s){for(const a of n){if(a.route===s)return[];if(a.children?.length){const t=fs(a.children,s);if(t)return[a.id,...t]}}}function bi({node:n,mode:s,maxDepth:a,isPinned:t,prefs:c,helpers:r,activeRoute:d,onNavigate:p,sidebarCollapsed:v=!1,expandableWhenCollapsed:u=!1,routeToUrl:l,contextMenu:m=!0,disabledActions:o,showHeader:h=!0,colorScope:k,shading:I,groupFilter:_}){const{t:w}=b.useNiceTranslation(),z=i.useRef(null),$=i.useMemo(()=>new Set(c.hiddenItems.map(D=>D.id)),[c.hiddenItems]),S=i.useContext(on),{scope:C,style:M,marked:R}=i.useMemo(()=>vs(k,n.source,I,S),[k,n.source,I,S]),B=i.useMemo(()=>{const D=[{id:n.source.id,label:n.source.label,icon:n.source.icon}],V=_===void 0||s==="all"?void 0:(s==="by-role"?n.roles:n.units).find(W=>W.id===_);return V?[...D,{id:V.id,label:V.label,icon:V.icon}]:D},[n,s,_]),y=i.useMemo(()=>{let D;if(s==="all")D=mi(n.modules,n.source.id);else if(_!==void 0){const V=(s==="by-role"?n.roles:n.units).filter(W=>W.id===_);return Fn(V,s==="by-role"?"role":"unit",n.source.id).flatMap(W=>W.children??[])}else s==="by-role"?D=hi(n.roles,n.source.id):D=pi(n.units,n.source.id);return ui(D,c.itemOrder[s])},[s,n,c.itemOrder,_]),g=i.useCallback(D=>bn({favorites:c.favorites,favoriteLists:c.favoriteLists},D).length>0,[c.favorites,c.favoriteLists]),T=i.useRef(void 0);i.useEffect(()=>{if(!d||T.current===d)return;const D=fs(y,d);if(!D)return;T.current=d;const V=D.filter(W=>c.autoExpand?c.collapsedIds.includes(W):!c.collapsedIds.includes(W));V.length>0&&r.setCollapsed(V,!c.autoExpand)},[d,y,c.autoExpand,c.collapsedIds,r]);const A=i.useMemo(()=>m?[{id:t?"unpinSource":"pinSource",label:t?w("sidebar.menu.unpinSource","Unpin source"):w("sidebar.menu.pinSource","Pin source"),onClick:()=>t?r.unpinSource(s,n.source.id):r.pinSource(s,n.source.id)},{id:"hideSource",label:w("sidebar.menu.hideSource","Hide source"),disabled:!!o?.has("hide"),onClick:()=>r.hideItem({id:n.source.id,kind:"source",label:n.source.label})}]:[],[m,o,t,r,s,n.source,w]);if($.has(n.source.id))return null;const N=c.collapsedIds.includes(n.source.id),f=c.autoExpand?!N:N,O=y.filter(D=>(D.children?.length??0)>0).map(D=>D.id),L=O.length>0,Q=L&&O.every(D=>c.collapsedIds.includes(D)),x=L?!Q:f,E=!h||L?!0:f,F=()=>{o?.has("collapseToggle")||(L?r.setCollapsed(O,!Q):r.toggleCollapse(n.source.id))};return e.jsxs("section",{className:R?"nice-sidebar-nav__source-section nice-sidebar-nav__source-section--marked":"nice-sidebar-nav__source-section",style:M,children:[h&&e.jsx(Ae,{content:n.source.tooltip??n.source.label,position:"right",size:"sm",children:e.jsxs("div",{ref:z,className:"nice-sidebar-nav__source-header",onClick:D=>{D.target.closest(".nice-sidebar-nav__source-actions")||F()},role:"button",tabIndex:0,"aria-expanded":x,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),F())},children:[e.jsx("span",{className:"nice-sidebar-nav__source-chevron","aria-hidden":"true",children:e.jsx(Rn,{open:x,size:16})}),n.source.icon&&e.jsx("span",{className:"nice-sidebar-nav__source-icon","aria-hidden":"true",children:nn(n.source.icon)}),e.jsx("span",{className:"nice-sidebar-nav__source-label",children:n.source.label}),e.jsxs("div",{className:"nice-sidebar-nav__source-actions",onClick:D=>D.stopPropagation(),onKeyDown:D=>{D.key!=="Escape"&&D.stopPropagation()},children:[e.jsx(Ae,{content:t?w("sidebarNav.unpinSource","Unpin source"):w("sidebarNav.pinSource","Pin source"),position:"top",size:"sm",children:e.jsx("button",{className:["nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--pin",t?"nice-sidebar-nav__action-btn--pin-active":""].filter(Boolean).join(" "),"aria-label":t?w("sidebarNav.unpinSource","Unpin source"):w("sidebarNav.pinSource","Pin source"),onClick:()=>t?r.unpinSource(s,n.source.id):r.pinSource(s,n.source.id),children:e.jsx(di,{size:14,filled:t})})}),e.jsx(Ae,{content:w("sidebarNav.hideSource","Hide source"),position:"top",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--hide","aria-label":w("sidebarNav.hideSource","Hide source"),onClick:()=>r.hideItem({id:n.source.id,kind:"source",label:n.source.label}),children:e.jsx(hs,{size:14})})})]})]})}),h&&A.length>0&&e.jsx(Mn,{target:z,items:A,size:"sm"}),a>1&&E&&e.jsx("ul",{className:"nice-sidebar-nav__tree",children:y.map(D=>e.jsx(On,{item:D,depth:2,maxDepth:a,activeRoute:d,collapsedIds:c.collapsedIds,hiddenIds:$,autoExpand:c.autoExpand,sidebarCollapsed:v,expandableWhenCollapsed:u,onNavigate:p,onHide:r.hideItem,onToggleCollapse:r.toggleCollapse,onAddFavorite:r.addFavorite,onRemoveFavorite:r.removeFavorite,isFavorite:g,leftClickBehavior:c.leftClickBehavior,routeToUrl:l,contextMenu:m,disabledActions:o,colorScope:C,shading:I,path:B},D.id))})]})}function vi({favorites:n,activeRoute:s,onNavigate:a,onRemove:t,collapsed:c=!1,leftClickBehavior:r="focus-existing"}){const{t:d}=b.useNiceTranslation(),p=i.useContext(on),v=r==="open-new";return n.length===0?e.jsx("p",{className:"nice-sidebar-nav__empty",children:d("sidebarNav.noFavourites","No favourites yet. Hover an item and click the star to add it.")}):e.jsx("ul",{className:"nice-sidebar-nav__favorites-list",children:n.map(u=>{const l=!!(u.route&&u.route===s),m={forceNew:v,color:u.color,branchColor:u.color},o=u.color?Ys(u.color):void 0;return e.jsxs("li",{className:["nice-sidebar-nav__fav-item",l?"nice-sidebar-nav__fav-item--active":"",o?p?"nice-sidebar-nav__fav-item--colored":"nice-sidebar-nav__fav-item--marked":""].filter(Boolean).join(" "),style:o?p?{"--nice-fav-bg":o.bg,"--nice-fav-text":o.text,"--nice-fav-hover-bg":o.hoverBg}:{"--nice-fav-mark":o.bg}:void 0,children:[e.jsx(Ae,{content:u.tooltip??u.label,position:"right",size:"sm",children:e.jsxs("span",{role:"link",tabIndex:0,className:"nice-sidebar-nav__fav-content",onClick:()=>{u.route&&a?.(u.route,u,m)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&u.route&&a?.(u.route,u,m)},children:[(typeof u.icon=="string"||i.isValidElement(u.icon))&&e.jsx("span",{className:"nice-sidebar-nav__fav-icon","aria-hidden":"true",children:nn(u.icon)}),e.jsx("span",{className:"nice-sidebar-nav__fav-label",children:u.label})]})}),!c&&e.jsx(Ae,{content:d("sidebarNav.removeFavourite","Remove from favourites"),position:"top",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--remove","aria-label":d("sidebarNav.removeFavourite","Remove from favourites"),onClick:()=>t(u.id),children:e.jsx(Tn,{size:12})})})]},u.id)})})}const Nn="fav:",fi=new Set;function _s(n){const s=n.favorite;return{id:n.id,label:n.label,icon:n.icon,tooltip:s?.tooltip,route:s?.route,kind:s?"view":"module",sourceId:s?.sourceId,moduleId:s?.moduleId,children:n.children.map(_s)}}function _i({favorites:n,pathOf:s,sources:a,rank:t,showSources:c,prefs:r,helpers:d,activeRoute:p,onNavigate:v,onRemove:u,collapsed:l,routeToUrl:m,contextMenu:o,disabledActions:h,colorScope:k,shading:I}){const{t:_}=b.useNiceTranslation(),w=i.useContext(on),z=i.useMemo(()=>cs(n,s,g=>t.get(g)),[n,s,t]),$=i.useMemo(()=>r.collapsedIds.filter(g=>g.startsWith(Nn)).map(g=>g.slice(Nn.length)),[r.collapsedIds]),S=i.useCallback(g=>d.toggleCollapse(Nn+g),[d]),C=i.useCallback(g=>bn({favorites:r.favorites,favoriteLists:r.favoriteLists},g).length>0,[r.favorites,r.favoriteLists]);if(n.length===0)return e.jsx("p",{className:"nice-sidebar-nav__empty",children:_("sidebarNav.noFavourites","No favourites yet. Hover an item and click the star to add it.")});const M=(g,T,A,N)=>e.jsx(On,{item:_s(g),depth:2,maxDepth:Number.POSITIVE_INFINITY,activeRoute:p,collapsedIds:$,hiddenIds:fi,autoExpand:!0,sidebarCollapsed:l,onNavigate:v,onHide:d.hideItem,onToggleCollapse:S,onAddFavorite:d.addFavorite,onRemoveFavorite:d.removeFavorite,isFavorite:C,leftClickBehavior:r.leftClickBehavior,routeToUrl:m,contextMenu:o,disabledActions:h,colorScope:T,shading:I,path:A,onRemoveFromList:u},N),R=[];let B=[];const y=()=>{B.length>0&&(R.push(e.jsx("ul",{className:"nice-sidebar-nav__tree",children:B},`rows-${R.length}`)),B=[])};for(const g of z){const T=a.get(g.id);if(!T){B.push(M(g,k,[],g.id));continue}const{scope:A,style:N,marked:f}=vs(k,T,I,w),O=[{id:T.id,label:T.label,icon:T.icon}];if(!c){for(const Q of g.children)B.push(M(Q,A,O,`${g.id}/${Q.id}`));continue}y();const L=!$.includes(g.id);R.push(e.jsxs("section",{className:f?"nice-sidebar-nav__source-section nice-sidebar-nav__source-section--marked":"nice-sidebar-nav__source-section",style:N,children:[e.jsx(Ae,{content:T.tooltip??T.label,position:"right",size:"sm",children:e.jsxs("div",{className:"nice-sidebar-nav__source-header",role:"button",tabIndex:0,"aria-expanded":L,onClick:()=>S(g.id),onKeyDown:Q=>{(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),S(g.id))},children:[e.jsx("span",{className:"nice-sidebar-nav__source-chevron","aria-hidden":"true",children:e.jsx(Rn,{open:L,size:16})}),T.icon&&e.jsx("span",{className:"nice-sidebar-nav__source-icon","aria-hidden":"true",children:nn(T.icon)}),e.jsx("span",{className:"nice-sidebar-nav__source-label",children:T.label})]})}),L&&e.jsx("ul",{className:"nice-sidebar-nav__tree",children:g.children.map(Q=>M(Q,A,O,Q.id))})]},g.id))}return y(),e.jsx(e.Fragment,{children:R})}function xi(n,s,a){const t=[],c=new Set;return vn(n,r=>{if(r.kind!=="view")return;const d=r.item;if(d.children?.length&&!d.route)return;const p=`${r.sourceId}::${d.id}`;c.has(p)||(c.add(p),t.push({view:d,breadcrumb:r.ancestors,color:r.color,branchColor:r.branchColor}))},{trees:["modules","roles","units"],levelColors:s,shading:a}),t}function Ni({data:n,activeRoute:s,onNavigate:a,hiddenIds:t,leftClickBehavior:c="focus-existing",levelColors:r,shading:d}){const{t:p}=b.useNiceTranslation(),[v,u]=i.useState(""),l=c==="open-new",m=i.useMemo(()=>xi(n,r,d),[n,r,d]),o=i.useMemo(()=>{const h=v.trim().toLowerCase();return h?m.filter(k=>t.has(k.view.id)||k.breadcrumb.some(I=>t.has(I.id))?!1:k.view.label.toLowerCase().includes(h)?!0:k.breadcrumb.some(I=>I.label.toLowerCase().includes(h))):[]},[m,v,t]);return e.jsxs("div",{className:"nice-sidebar-nav__search",children:[e.jsxs("div",{className:"nice-sidebar-nav__search-inputWrap",children:[e.jsx("span",{className:"nice-sidebar-nav__search-icon","aria-hidden":"true",children:e.jsx(b.NiceIcon,{name:"search",size:14})}),e.jsx("input",{type:"text",className:"nice-sidebar-nav__search-input",placeholder:p("sidebarNav.search.placeholder","Search views…"),value:v,onChange:h=>u(h.target.value),autoFocus:!0,"aria-label":p("sidebarNav.search.label","Search views")}),v&&e.jsx("button",{type:"button",className:"nice-sidebar-nav__search-clear","aria-label":p("common.clear","Clear"),onClick:()=>u(""),children:e.jsx(Tn,{size:12})})]}),!v.trim()&&e.jsx("p",{className:"nice-sidebar-nav__empty",children:p("sidebarNav.searchHint","Type to search every view available in the panel.")}),v.trim()&&o.length===0&&e.jsxs("p",{className:"nice-sidebar-nav__empty",children:[p("sidebarNav.noResults","No results for")," “",v,"”."]}),o.length>0&&e.jsx("ul",{className:"nice-sidebar-nav__search-results",children:o.map((h,k)=>{const I=!!(h.view.route&&h.view.route===s),_=!!h.view.route;return e.jsx("li",{className:["nice-sidebar-nav__search-result",I?"nice-sidebar-nav__search-result--active":""].filter(Boolean).join(" "),children:e.jsxs("button",{type:"button",className:"nice-sidebar-nav__search-result-btn",disabled:!_,onClick:()=>{_&&h.view.route&&a?.(h.view.route,h.view,{forceNew:l,color:h.color,branchColor:h.branchColor,path:[...h.breadcrumb,{id:h.view.id,label:h.view.label}]})},children:[e.jsx("span",{className:"nice-sidebar-nav__search-result-breadcrumb",children:h.breadcrumb.map((w,z)=>e.jsxs("span",{className:"nice-sidebar-nav__search-crumb",children:[w.icon&&e.jsx("span",{className:"nice-sidebar-nav__search-crumb-icon","aria-hidden":"true",children:nn(w.icon)}),e.jsx("span",{className:"nice-sidebar-nav__search-crumb-label",children:w.label}),e.jsx("span",{className:"nice-sidebar-nav__search-crumb-sep","aria-hidden":"true",children:"›"})]},`${w.id}-${z}`))}),e.jsxs("span",{className:"nice-sidebar-nav__search-result-view",children:[h.view.icon&&e.jsx("span",{className:"nice-sidebar-nav__node-icon","aria-hidden":"true",children:nn(h.view.icon)}),e.jsx("span",{className:"nice-sidebar-nav__node-label",children:h.view.label}),h.view.badge!==void 0&&e.jsx("span",{className:"nice-sidebar-nav__node-badge",children:h.view.badge})]})]})},`${h.view.id}-${k}`)})})]})}function gi({activeRoute:n,onNavigate:s,leftClickBehavior:a="focus-existing"}){const{t}=b.useNiceTranslation(),c=a==="open-new";return e.jsx("ul",{className:"nice-sidebar-nav__prefs-categories",role:"list",children:Dn.map(r=>{const d=t(r.labelKey,r.labelDefault),p=n===r.route,v={id:r.id,label:d,icon:r.icon,route:r.route};return e.jsx("li",{className:["nice-sidebar-nav__node nice-sidebar-nav__node--leaf",p?"nice-sidebar-nav__node--active":""].filter(Boolean).join(" "),children:e.jsxs("div",{className:"nice-sidebar-nav__node-row",children:[e.jsx("span",{className:"nice-sidebar-nav__collapse-spacer"}),e.jsx(Ae,{content:d,position:"right",size:"sm",children:e.jsxs("span",{role:"link",tabIndex:0,className:"nice-sidebar-nav__node-content nice-sidebar-nav__node-content--link",onClick:()=>s?.(r.route,v,{forceNew:c}),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s?.(r.route,v,{forceNew:c}))},children:[e.jsx("span",{className:"nice-sidebar-nav__node-icon","aria-hidden":"true",children:r.icon}),e.jsx("span",{className:"nice-sidebar-nav__node-label",children:d})]})})]})},r.id)})})}const ji=i.forwardRef(function({data:s=ri,userId:a,activeRoute:t,onNavigate:c,enableModeIcons:r,preferences:d,onPreferencesChange:p,width:v=264,collapsedWidth:u=56,position:l="left",minimal:m=!1,showModeStrip:o,showSources:h,showFavorites:k,showFooterPreferences:I,sticky:_=!0,surfaceOpacity:w,embedded:z=!1,header:$,footerExtra:S,collapsed:C,onCollapsedChange:M,expandableWhenCollapsed:R=!1,railItems:B,railOpen:y,defaultRailOpen:g,onRailOpenChange:T,railWidth:A=76,railActiveId:N,groupPicker:f=!0,favoritesLayout:O="list",getFavoritePath:L,size:Q="md",className:x,routeToUrl:E,contextMenu:F=!0,openInNewTab:D=!0,disabledContextMenuActions:V,readonly:W=!1,levelColors:K,levelShading:ie="auto","data-testid":Z},ne){const{t:ee}=b.useNiceTranslation(),ce=i.useContext(b.NiceThemeContext),J=ie==="auto"?ce?.theme.darkMode==="dark"?"shade":"tint":ie,_e=i.useMemo(()=>ss(K,J),[K,J]),P=i.useMemo(()=>{const G=new Set(V??[]);return W&&["hide","reorder","rename","newGroup"].forEach(ue=>G.add(ue)),G},[V,W]),te=o??!m,Ne=h??!m,ye=k??!m,$e=I??!m,[Ke,Re]=i.useState(!1),ve=z?!1:C??Ke,Le=i.useCallback(()=>{const G=!ve;M?M(G):Re(G)},[ve,M]),H=!z&&!!B&&B.length>0,[U,me]=b.useControllableState({value:y,defaultValue:g,fallbackValue:!1,componentName:"NiceSidebarNav"}),he=H&&U&&!ve,re=G=>{me(G),T?.(G)},ae=()=>{he?re(!1):ve||Le()},Pe=()=>{ve?Le():he||re(!0)},Ie=N??B?.find(G=>G.route&&G.route===t)?.id,Ye=G=>{!G.onClick&&G.route&&c?.(G.route,{id:G.id,label:G.label,icon:G.icon,route:G.route})},[se,xe]=us(a,r,d,p),Me=i.useMemo(()=>{const G=se.activeMode;if(G==="favorites"||G==="preferences"||G==="search")return s;const ue=se.pinnedSources[G];return!ue||ue.length===0?s:s.filter(we=>ue.includes(we.source.id))},[s,se.activeMode,se.pinnedSources]),Ee=se.maxDepth[se.activeMode],Be=Ee==null||Ee>=10?Number.POSITIVE_INFINITY:Ee,ze=ee("sidebarNav.favLists.default","Favourites"),He=i.useMemo(()=>is({favorites:se.favorites,favoriteLists:se.favoriteLists},ze),[se.favorites,se.favoriteLists,ze]),Te=as(se),De=i.useMemo(()=>({lists:He.map(G=>({id:G.id,label:G.label,count:G.items.length})),listsOf:G=>bn({favorites:se.favorites,favoriteLists:se.favoriteLists},G),toggle:xe.toggleFavoriteInList,create:(G,ue)=>{xe.createFavoriteList(Bn(G,He.map(we=>we.label)),ue)}}),[He,se.favorites,se.favoriteLists,xe]),Y=i.useMemo(()=>{const G=new Map,ue=new Map,we=new Map,Ge=new Map;return O!=="tree"?{parentsOf:G,items:ue,sources:we,rank:Ge}:(vn(s,be=>{const j={id:be.item.id,label:be.item.label,icon:be.item.icon};be.kind==="source"&&we.set(be.item.id,be.item);const oe=be.tree==="roles"||be.tree==="units";oe&&be.kind==="module"?ue.set(`${be.ancestors[1].id}:${be.item.id}`,j):ue.has(be.item.id)||ue.set(be.item.id,j),be.kind==="view"&&!G.has(be.item.id)&&G.set(be.item.id,oe?be.ancestors.map((de,Oe)=>Oe===2?{...de,id:`${be.ancestors[1].id}:${de.id}`}:de):be.ancestors)},{trees:["modules","roles","units"]}),[...ue.keys()].forEach((be,j)=>Ge.set(be,j)),{parentsOf:G,items:ue,sources:we,rank:Ge})},[s,O]),le=i.useCallback(G=>(L?.(G)??G.path??Y.parentsOf.get(G.id)??[]).map(ue=>{const we=Y.items.get(ue.id);return we?{id:ue.id,label:we.label,icon:we.icon??ue.icon}:ue}),[L,Y]),fe=i.useMemo(()=>O!=="tree"?[]:mn({favorites:se.favorites,favoriteLists:se.favoriteLists},Te).map(G=>typeof G.icon=="string"||i.isValidElement(G.icon)?G:{...G,icon:Y.items.get(G.id)?.icon}),[O,se.favorites,se.favoriteLists,Te,Y]),pe=se.activeMode==="by-role"||se.activeMode==="by-unit"?se.activeMode:null,ke=i.useMemo(()=>{if(!pe||f===!1)return[];const G=new Set(se.hiddenItems.map(be=>be.id)),ue=new Map;for(const be of Me)for(const j of pe==="by-role"?be.roles:be.units)!G.has(j.id)&&!ue.has(j.id)&&ue.set(j.id,{id:j.id,label:j.label});const we=se.itemOrder[pe]??[],Ge=be=>{const j=we.indexOf(be);return j<0?we.length:j};return[...ue.values()].map((be,j)=>({o:be,i:j})).sort((be,j)=>Ge(be.o.id)-Ge(j.o.id)||be.i-j.i).map(({o:be})=>be)},[pe,f,Me,se.hiddenItems,se.itemOrder]),q=pe&&ke.length>1?ke.find(G=>G.id===se.activeGroupId?.[pe])?.id??ke[0].id:void 0;function X(){const G=se.activeMode;if(ye&&G==="favorites")return O==="tree"?e.jsx(_i,{favorites:fe,pathOf:le,sources:Y.sources,rank:Y.rank,showSources:Ne,prefs:se,helpers:xe,activeRoute:t,onNavigate:c,onRemove:ue=>xe.removeFavorite(ue,Te),collapsed:ve,routeToUrl:E,contextMenu:F,disabledActions:P,colorScope:_e,shading:J}):e.jsx(vi,{favorites:mn(se,Te),activeRoute:t,onNavigate:c,onRemove:ue=>xe.removeFavorite(ue,Te),collapsed:ve,leftClickBehavior:se.leftClickBehavior});if($e&&G==="preferences")return e.jsx(gi,{activeRoute:t,onNavigate:c,leftClickBehavior:se.leftClickBehavior});if(te&&G==="search"){const ue=new Set(se.hiddenItems.map(we=>we.id));return e.jsx(Ni,{data:s,activeRoute:t,onNavigate:c,hiddenIds:ue,leftClickBehavior:se.leftClickBehavior,levelColors:K,shading:J})}return Me.length===0?e.jsx("p",{className:"nice-sidebar-nav__empty",children:ee("sidebarNav.noSources","No data sources are visible in this mode.")}):Me.map(ue=>{const we=(se.pinnedSources[G]??[]).includes(ue.source.id);return q!==void 0&&!(G==="by-role"?ue.roles:ue.units).some(Ge=>Ge.id===q)?null:e.jsx(bi,{node:ue,mode:G,maxDepth:Be,isPinned:we,prefs:se,helpers:xe,activeRoute:t,onNavigate:c,sidebarCollapsed:ve,expandableWhenCollapsed:R,routeToUrl:E,contextMenu:F,disabledActions:P,showHeader:Ne,colorScope:_e,shading:J,groupFilter:q},ue.source.id)})}let Ce=null;if(ye&&se.activeMode==="favorites"){const G=He.find(ue=>ue.id===Te);Ce=e.jsx(Pn,{options:De.lists,value:Te,onChange:xe.setActiveFavoriteList,collapsed:ve,icon:e.jsx(ms,{size:16}),"aria-label":ee("sidebarNav.favLists.title","Favourites lists"),onCreate:ue=>xe.setActiveFavoriteList(xe.createFavoriteList(Bn(ue,He.map(we=>we.label)))),renderFooter:G&&G.id!==We?ue=>e.jsx(ci,{label:G.label,onRename:we=>xe.renameFavoriteList(G.id,we),onRemove:()=>{xe.removeFavoriteList(G.id),ue()}}):void 0},"favorites")}else pe&&q!==void 0&&(Ce=e.jsx(Pn,{options:ke,value:q,onChange:G=>xe.setActiveGroup(pe,G),collapsed:ve,icon:rn[pe].icon,"aria-label":pe==="by-role"?ee("sidebarNav.scope.role","Role"):ee("sidebarNav.scope.unit","Organizational unit")},pe));const Fe=["nice-sidebar-nav",`nice-sidebar-nav--${Q}`,`nice-sidebar-nav--${l}`,m?"nice-sidebar-nav--minimal":"",z?"nice-sidebar-nav--embedded":"",_&&!z?"nice-sidebar-nav--sticky":"",se.enableModeIcons&&te?"nice-sidebar-nav--with-strip":"",ve?"nice-sidebar-nav--collapsed":"",ve&&R?"nice-sidebar-nav--expandable-collapsed":"",he?"nice-sidebar-nav--with-rail":"",x].filter(Boolean).join(" "),ge={...w!=null?{"--nice-sidebar-surface-alpha":String(w)}:{},..._e.colors?ns(_e.colors,1):{}},Je=z?{width:"100%",...ge}:{"--nice-sidebar-w":`${v}px`,"--nice-sidebar-w-collapsed":`${u}px`,...H?{"--nice-sidebar-rail-w":`${A}px`}:{},width:ve?u:he?v+A:v,...ge};return e.jsxs("div",{ref:ne,className:Fe,style:Je,"data-testid":Z,"data-mode":se.activeMode,children:[he&&e.jsx(Jn,{className:"nice-sidebar-nav__rail",items:B,activeId:Ie,onSelect:Ye,"aria-label":ee("sidebarNav.rail","Shortcuts")}),$!=null&&e.jsx("div",{className:"nice-sidebar-nav__header",children:$}),se.enableModeIcons&&te&&e.jsx(li,{enabledModes:se.enabledModes,activeMode:se.activeMode,onSelect:xe.setMode,collapsed:ve}),Ce,e.jsx("div",{className:"nice-sidebar-nav__content",children:e.jsx(on.Provider,{value:se.colorStyle==="fill",children:e.jsx(ls.Provider,{value:D,children:e.jsx(os.Provider,{value:De,children:e.jsx("div",{className:"nice-sidebar-nav__body",children:X()})})})})}),H&&e.jsxs("div",{className:"nice-sidebar-nav__footer nice-sidebar-nav__footer--levels",children:[!ve&&e.jsxs("button",{type:"button",className:"nice-sidebar-nav__footer-toggle nice-sidebar-nav__footer-toggle--down",onClick:ae,"aria-label":he?ee("sidebarNav.railHide","Hide the bar"):ee("sidebarNav.collapseToIcons","Collapse to icons"),title:he?ee("sidebarNav.railHide","Hide the bar"):ee("sidebarNav.collapseToIcons","Collapse to icons"),children:[e.jsx("span",{className:"nice-sidebar-nav__footer-toggle-icon","aria-hidden":"true",children:e.jsx(b.NiceIcon,{name:l==="right"?"chevron-right":"chevron-left",size:18})}),e.jsx("span",{className:"nice-sidebar-nav__footer-toggle-label",children:ee("sidebarNav.collapseShort","Collapse")})]}),e.jsxs("button",{type:"button",className:"nice-sidebar-nav__footer-toggle nice-sidebar-nav__footer-toggle--up",onClick:Pe,disabled:he,"aria-label":ve?ee("sidebarNav.expand","Expand the sidebar"):ee("sidebarNav.railShow","Show the bar"),title:ve?ee("sidebarNav.expand","Expand the sidebar"):ee("sidebarNav.railShow","Show the bar"),children:[e.jsx("span",{className:"nice-sidebar-nav__footer-toggle-label",children:ee("sidebarNav.expandShort","Expand")}),e.jsx("span",{className:"nice-sidebar-nav__footer-toggle-icon","aria-hidden":"true",children:e.jsx(b.NiceIcon,{name:l==="right"?"chevron-left":"chevron-right",size:18})})]}),S!=null&&e.jsx("div",{className:"nice-sidebar-nav__footer-extra",children:S})]}),!z&&!H&&e.jsxs("div",{className:"nice-sidebar-nav__footer",children:[e.jsxs("button",{type:"button",className:"nice-sidebar-nav__footer-toggle",onClick:Le,"aria-label":ve?ee("sidebarNav.expand","Expand the sidebar"):ee("sidebarNav.collapseToIcons","Collapse to icons"),title:ve?ee("sidebarNav.expand","Expand the sidebar"):ee("sidebarNav.collapseToIcons","Collapse to icons"),children:[e.jsx("span",{className:"nice-sidebar-nav__footer-toggle-icon","aria-hidden":"true",children:e.jsx(b.NiceIcon,{name:"chevron-left",size:18,style:{transition:"transform 160ms ease",transform:(l==="right"?!ve:ve)?"rotate(180deg)":"rotate(0deg)"}})}),e.jsx("span",{className:"nice-sidebar-nav__footer-toggle-label",children:ve?ee("sidebarNav.expandShort","Expand"):ee("sidebarNav.collapseToIcons","Collapse to icons")})]}),S!=null&&e.jsx("div",{className:"nice-sidebar-nav__footer-extra",children:S})]}),z&&S!=null&&e.jsx("div",{className:"nice-sidebar-nav__footer nice-sidebar-nav__footer--embedded",children:e.jsx("div",{className:"nice-sidebar-nav__footer-extra",children:S})})]})}),yi=[],xs=({steps:n=yi,activeStep:s,orientation:a="horizontal",onStepClick:t,allowStepClick:c=!1,showStepNumbers:r=!0,className:d,style:p,"data-testid":v})=>{const{t:u}=b.useNiceTranslation();return e.jsxs("div",{className:`nice-stepper nice-stepper--${a} ${d||""}`,style:p,"data-testid":v,children:[e.jsx("div",{className:"nice-stepper__header",children:n.map((l,m)=>{const o=m<s,h=m===s,k=o?"nice-stepper__step--completed":h?"nice-stepper__step--active":"";return e.jsxs(i.Fragment,{children:[m>0&&e.jsx("div",{className:`nice-stepper__connector ${o?"nice-stepper__connector--completed":""}`}),e.jsxs("div",{className:`nice-stepper__step ${k}`,"aria-current":h?"step":void 0,...c&&{role:"button",tabIndex:0,onClick:()=>t?.(m),onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),t?.(m))}},style:{cursor:c?"pointer":void 0},children:[e.jsx("div",{className:"nice-stepper__indicator",children:l.icon?l.icon:o?e.jsx(b.NiceIcon,{name:"check",size:14}):r?m+1:""}),e.jsxs("div",{className:"nice-stepper__labels",children:[e.jsx("div",{className:"nice-stepper__title",children:l.title}),l.subtitle&&e.jsx("div",{className:"nice-stepper__subtitle",children:l.subtitle}),l.optional&&e.jsx("div",{className:"nice-stepper__optional",children:u("optional","Optional")})]})]})]},m)})}),n[s]?.content&&e.jsx("div",{className:"nice-stepper__content",children:n[s].content})]})},ki=[],Ci=Object.assign(i.forwardRef(({panels:n=ki,columns:s=12,rowHeight:a=80,gap:t=8,draggable:c=!0,resizable:r=!0,onLayoutChange:d,className:p,"data-testid":v,style:u,id:l},m)=>{const o=b.useControlId(l),[h,k]=i.useState(null),[I,_]=i.useState(null),w=i.useRef(null),z=i.useCallback((y,g)=>{c&&(k(g),y.dataTransfer.effectAllowed="move")},[c]),$=i.useCallback((y,g)=>{if(y.preventDefault(),_(null),!h||h===g)return;const T=n.find(f=>f.key===h),A=n.find(f=>f.key===g);if(!T||!A)return;const N=n.map(f=>f.key===h?{...f,col:A.col,row:A.row}:f.key===g?{...f,col:T.col,row:T.row}:f);d?.(N),k(null)},[h,n,d]),S=i.useCallback((y,g)=>{y.preventDefault(),c&&h&&h!==g&&_(g)},[c,h]),C=i.useCallback(()=>{k(null),_(null)},[]),M=i.useRef(null);i.useEffect(()=>{if(!r)return;const y=T=>{if(!M.current||!w.current)return;const{key:A,startX:N,startY:f,cs:O,rs:L}=M.current,Q=T.clientX-N,x=T.clientY-f,E=w.current.clientWidth/s,F=Math.max(1,O+Math.round(Q/E)),D=Math.max(1,L+Math.round(x/a)),V=n.map(W=>W.key===A?{...W,colSpan:F,rowSpan:D}:W);d?.(V)},g=()=>{M.current=null};return document.addEventListener("mousemove",y),document.addEventListener("mouseup",g),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",g)}},[r,n,s,a,d]);const R=i.useCallback((y,g,T,A)=>{y.stopPropagation(),M.current={key:g,startX:y.clientX,startY:y.clientY,cs:T,rs:A}},[]),B=Math.max(...n.map(y=>y.row+(y.rowSpan??1)),1);return e.jsx("div",{ref:m,id:o,className:`nice-dashboard ${p||""}`,style:u,"data-testid":v,children:e.jsx("div",{ref:w,className:"nice-dashboard__grid",style:{display:"grid",gridTemplateColumns:`repeat(${s}, 1fr)`,gridTemplateRows:`repeat(${B}, ${a}px)`,gap:t},children:n.map(y=>e.jsxs("div",{className:`nice-dashboard__panel${c?" nice-dashboard__panel--draggable":""}${h===y.key?" nice-dashboard__panel--dragging":""}${I===y.key?" nice-dashboard__panel--dragover":""}`,style:{gridColumn:`${y.col+1} / span ${y.colSpan??1}`,gridRow:`${y.row+1} / span ${y.rowSpan??1}`},draggable:c,onDragStart:g=>z(g,y.key),onDragOver:g=>S(g,y.key),onDragLeave:()=>_(g=>g===y.key?null:g),onDragEnd:C,onDrop:g=>$(g,y.key),children:[e.jsx("div",{className:"nice-dashboard__panel-content",children:y.render()}),r&&e.jsx("div",{className:"nice-dashboard__resize-handle",draggable:!1,onMouseDown:g=>R(g,y.key,y.colSpan??1,y.rowSpan??1)})]},y.key))})})}),{displayName:"NiceDashboardLayout"}),wi=Object.assign(i.forwardRef(({header:n,sidebar:s,sidebarWidth:a=260,sidebarCollapsed:t,onToggleSidebar:c,children:r,footer:d,className:p,"data-testid":v,style:u,id:l},m)=>{const{t:o}=b.useNiceTranslation(),h=b.useControlId(l),[k,I]=i.useState(!1),_=t??k,w=i.useCallback(()=>{const z=!_;I(z),c?.(z)},[_,c]);return e.jsxs("div",{ref:m,id:h,className:`nice-app-layout${_?" nice-app-layout--collapsed":""} ${p||""}`,style:u,"data-testid":v,children:[n&&e.jsx("header",{className:"nice-app-layout__header",children:n}),e.jsxs("div",{className:"nice-app-layout__body",children:[s&&e.jsx("aside",{className:"nice-app-layout__sidebar",style:{width:_?0:a,overflow:"hidden",transition:"width 0.2s"},children:!_&&s}),s&&e.jsx("button",{type:"button",className:"nice-app-layout__sidebar-toggle",onClick:w,"aria-label":_?o("appLayout.openSidebar","Open sidebar"):o("appLayout.closeSidebar","Close sidebar"),children:e.jsx(b.NiceIcon,{name:_?"menu":"close",size:16})}),e.jsx("main",{className:"nice-app-layout__content",children:r})]}),d&&e.jsx("footer",{className:"nice-app-layout__footer",children:d})]})}),{displayName:"NiceAppLayout"}),Si=[],Ii=Object.assign(i.forwardRef(({items:n=Si,position:s="bottom",size:a="md",magnify:t=!0,magnifyScale:c=1.5,activeKey:r,onItemClick:d,contained:p=!1,className:v,style:u,id:l,...m},o)=>{const h=b.useControlId(l),{t:k}=b.useNiceTranslation(),[I,_]=i.useState(null),w=i.useCallback(C=>{if(!t||I===null)return 1;const M=Math.abs(C-I);return M===0?c:M===1?1+(c-1)*.5:M===2?1+(c-1)*.2:1},[t,I,c]),z=s==="left"||s==="right",$=i.useRef(null);b.useRovingFocus($,{orientation:z?"vertical":"horizontal",itemSelector:"button"});const S=s==="left"?"left center":s==="right"?"right center":"bottom center";return e.jsx("div",{ref:o,id:h,className:`nice-dock nice-dock--${s} nice-dock--${a}${p?" nice-dock--contained":""} ${v??""}`,style:u,role:"toolbar","aria-label":k("dock.label","Dock"),"aria-orientation":z?"vertical":"horizontal",...m,children:e.jsx("div",{ref:$,className:"nice-dock__bar",style:{flexDirection:z?"column":"row"},children:n.map((C,M)=>{const R=w(M);return e.jsxs("button",{type:"button",className:`nice-dock__item ${r===C.key?"nice-dock__item--active":""} ${C.disabled?"nice-dock__item--disabled":""}`,style:{transform:`scale(${R})`,transformOrigin:S,transition:"transform 0.15s ease-out"},disabled:C.disabled,onClick:()=>d?.(C.key),onMouseEnter:()=>_(M),onMouseLeave:()=>_(null),onFocus:()=>_(M),onBlur:()=>_(null),"aria-label":C.label,title:C.label,children:[e.jsx("span",{className:"nice-dock__icon",children:C.icon}),C.badge!==void 0&&e.jsx("span",{className:"nice-dock__badge",children:C.badge})]},C.key)})})})}),{displayName:"NiceDock"}),Ns=({items:n,label:s,icon:a,position:t,onItemClick:c})=>{const{t:r}=b.useNiceTranslation(),[d,p]=i.useState(!1),[v,u]=i.useState(null),l=i.useRef(null),m=i.useRef(null),o=i.useRef(null),h=i.useCallback(_=>{p(_),_||u(null)},[]);b.useMenuButton(l,m,{open:d,onOpenChange:h}),b.useOverlayFocus(o,{open:d&&v!=null,modal:!1,onClose:()=>u(null)}),b.useRovingFocus(o,{orientation:"vertical",wrap:!0,typeahead:!0});const k=t==="bottom"?"bottom-start":t==="top"?"top-start":t==="left"?"left-start":"right-start",I=i.useCallback(_=>{if(_.children&&_.children.length>0){u(v===_.key?null:_.key);return}_.onClick?.(),c?.(_.key),p(!1),u(null)},[c,v]);return e.jsxs("div",{className:"nice-desktop__start",children:[e.jsxs("button",{ref:l,type:"button",className:`nice-desktop__start-btn ${d?"nice-desktop__start-btn--active":""}`,onClick:()=>p(!d),"aria-expanded":d,"aria-haspopup":"menu","aria-label":r("desktop.start","Start"),children:[a&&e.jsx("span",{className:"nice-desktop__start-icon",children:a}),s&&e.jsx("span",{className:"nice-desktop__start-label",children:s}),!a&&!s&&e.jsx("span",{className:"nice-desktop__start-label",children:r("desktop.start","Start")})]}),d&&e.jsx("div",{ref:m,className:`nice-desktop__start-menu nice-desktop__start-menu--${k}`,role:"menu",children:n.map(_=>e.jsxs(i.Fragment,{children:[_.divider&&e.jsx("div",{className:"nice-desktop__start-divider"}),e.jsxs("div",{className:"nice-desktop__start-item-wrap",children:[e.jsxs("button",{type:"button",className:`nice-desktop__start-item ${v===_.key?"nice-desktop__start-item--open":""}`,disabled:_.disabled,onClick:()=>I(_),onKeyDown:w=>{_.children?.length&&w.key==="ArrowRight"&&(w.preventDefault(),u(_.key))},role:"menuitem","aria-haspopup":_.children?.length?"menu":void 0,"aria-expanded":_.children?.length?v===_.key:void 0,children:[_.icon&&e.jsx("span",{className:"nice-desktop__start-item-icon",children:_.icon}),e.jsx("span",{className:"nice-desktop__start-item-label",children:_.label}),_.children&&_.children.length>0&&e.jsx("span",{className:"nice-desktop__start-item-arrow",children:e.jsx(b.NiceIcon,{name:"chevron-right",size:14})})]}),_.children&&v===_.key&&e.jsx("div",{ref:o,className:"nice-desktop__start-submenu",role:"menu",onKeyDown:w=>{w.key==="ArrowLeft"&&(w.preventDefault(),u(null))},children:_.children.map(w=>e.jsxs("button",{type:"button",className:"nice-desktop__start-item",disabled:w.disabled,onClick:()=>I(w),role:"menuitem",children:[w.icon&&e.jsx("span",{className:"nice-desktop__start-item-icon",children:w.icon}),e.jsx("span",{className:"nice-desktop__start-item-label",children:w.label})]},w.key))})]})]},_.key))})]})},Cn=({items:n,position:s,size:a,startMenu:t,systemTray:c,onItemClick:r})=>{const{t:d}=b.useNiceTranslation(),p=s==="left"||s==="right",v=p?{width:a,height:"100%"}:{height:a,width:"100%"},u=i.useRef(null);return b.useRovingFocus(u,{orientation:p?"vertical":"horizontal",itemSelector:"button"}),e.jsxs("div",{ref:u,className:`nice-desktop__taskbar nice-desktop__taskbar--${s}`,style:v,role:"toolbar","aria-label":d("desktop.taskbar","Taskbar"),"aria-orientation":p?"vertical":"horizontal",children:[t,e.jsx("div",{className:"nice-desktop__taskbar-items",children:n.map(l=>e.jsxs("button",{type:"button",className:`nice-desktop__taskbar-btn ${l.active?"nice-desktop__taskbar-btn--active":""} ${l.minimized?"nice-desktop__taskbar-btn--minimized":""}`,onClick:()=>r?.(l.key),title:l.label,children:[l.icon&&e.jsx("span",{className:"nice-desktop__taskbar-btn-icon",children:l.icon}),e.jsx("span",{className:"nice-desktop__taskbar-btn-label",children:l.label}),l.badge!==void 0&&e.jsx("span",{className:"nice-desktop__taskbar-btn-badge",children:l.badge})]},l.key))}),c]})},gs=({items:n,showClock:s=!0,onItemClick:a})=>{const[t,c]=i.useState(()=>new Date);return i.useEffect(()=>{if(!s)return;const r=setInterval(()=>c(new Date),3e4);return()=>clearInterval(r)},[s]),e.jsxs("div",{className:"nice-desktop__tray",children:[n.map(r=>e.jsx("button",{type:"button",className:"nice-desktop__tray-item",title:r.tooltip,onClick:()=>{r.onClick?.(),a?.(r.key)},children:r.icon},r.key)),s&&e.jsx("span",{className:"nice-desktop__tray-clock",children:t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})},js=({icons:n,gridColumns:s,iconSize:a,onIconClick:t,onIconDoubleClick:c})=>{const[r,d]=i.useState(null),p=i.useCallback(u=>{d(u),t?.(u)},[t]),v=i.useCallback(u=>{c?.(u)},[c]);return e.jsx("div",{className:`nice-desktop__grid nice-desktop__grid--${a}`,style:{gridTemplateColumns:`repeat(${s}, 1fr)`},children:n.map(u=>e.jsxs("div",{className:`nice-desktop__icon ${r===u.key?"nice-desktop__icon--selected":""} ${u.disabled?"nice-desktop__icon--disabled":""}`,style:u.gridCol!=null||u.gridRow!=null?{gridColumn:u.gridCol,gridRow:u.gridRow}:void 0,onClick:()=>!u.disabled&&p(u.key),onDoubleClick:()=>!u.disabled&&v(u.key),role:"button",tabIndex:u.disabled?-1:0,"aria-label":u.label,onKeyDown:l=>{u.disabled||(l.key==="Enter"&&v(u.key),l.key===" "&&(l.preventDefault(),p(u.key)))},children:[e.jsx("div",{className:"nice-desktop__icon-img",children:u.icon}),e.jsx("span",{className:"nice-desktop__icon-label",children:u.label})]},u.key))})},ys=({items:n,x:s,y:a,onItemClick:t,onClose:c})=>{const r=i.useRef(null);return i.useEffect(()=>{const d=p=>{r.current&&!r.current.contains(p.target)&&c()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[c]),b.useOverlayFocus(r,{open:!0,modal:!1,onClose:c}),b.useRovingFocus(r,{orientation:"vertical",wrap:!0,typeahead:!0}),e.jsx("div",{ref:r,className:"nice-desktop__context-menu",style:{position:"fixed",left:s,top:a},role:"menu",children:n.map(d=>e.jsxs(i.Fragment,{children:[d.divider&&e.jsx("div",{className:"nice-desktop__context-divider"}),e.jsxs("button",{type:"button",className:"nice-desktop__context-item",disabled:d.disabled,onClick:()=>{d.onClick?.(),t?.(d.key),c()},role:"menuitem",children:[d.icon&&e.jsx("span",{className:"nice-desktop__context-icon",children:d.icon}),e.jsx("span",{children:d.label})]})]},d.key))})},$i=Object.assign(i.forwardRef(({icons:n=[],taskbarPosition:s="bottom",taskbarSize:a=40,startMenuItems:t=[],startMenuLabel:c,startMenuIcon:r,taskbarItems:d=[],systemTrayItems:p=[],showClock:v=!0,wallpaper:u,gridColumns:l=8,iconSize:m="md",onIconClick:o,onIconDoubleClick:h,onTaskbarItemClick:k,onStartMenuItemClick:I,onSystemTrayItemClick:_,contextMenuItems:w,onContextMenuItemClick:z,children:$,className:S,style:C,id:M,accessMode:R,...B},y)=>{const g=b.useControlId(M),A=b.useNiceAccessMode(R,M)==="hidden",[N,f]=i.useState(null),O=i.useCallback(E=>{!w||w.length===0||(E.preventDefault(),f({x:E.clientX,y:E.clientY}))},[w]),L=t.length>0?e.jsx(Ns,{items:t,label:c,icon:r,position:s,onItemClick:I}):null,Q=e.jsx(gs,{items:p,showClock:v,onItemClick:_}),x={...C,...u?{background:u}:{}};return A?null:e.jsxs("div",{ref:y,id:g,className:`nice-desktop nice-desktop--taskbar-${s} ${S??""}`,style:x,...B,children:[(s==="top"||s==="left")&&e.jsx(Cn,{items:d,position:s,size:a,startMenu:L,systemTray:Q,onItemClick:k}),e.jsxs("div",{className:"nice-desktop__area",onContextMenu:O,children:[n.length>0&&e.jsx(js,{icons:n,gridColumns:l,iconSize:m,onIconClick:o,onIconDoubleClick:h}),$,N&&w&&e.jsx(ys,{items:w,x:N.x,y:N.y,onItemClick:z,onClose:()=>f(null)})]}),(s==="bottom"||s==="right")&&e.jsx(Cn,{items:d,position:s,size:a,startMenu:L,systemTray:Q,onItemClick:k})]})}),{displayName:"NiceDesktop"}),Ei=({commands:n,onSelect:s,onClose:a})=>{const[t,c]=i.useState(""),r=i.useRef(null),d=i.useRef(null),{t:p}=b.useNiceTranslation();b.useOverlayFocus(d,{open:!0,initialFocus:r,onClose:a});const v=t?n.filter(u=>u.label.toLowerCase().includes(t.toLowerCase())):n;return e.jsxs(e.Fragment,{children:[e.jsx("div",{role:"presentation",className:"nice-console__palette-overlay",onClick:a}),e.jsxs("div",{ref:d,className:"nice-console__palette",role:"dialog","aria-label":p("console.commandPalette","Command Palette"),children:[e.jsx("input",{ref:r,className:"nice-console__palette-input",placeholder:p("console.searchCommands","Search commands..."),value:t,onChange:u=>c(u.target.value),onKeyDown:u=>{u.key==="Enter"&&v.length>0&&(s(v[0].key),a())}}),e.jsxs("div",{className:"nice-console__palette-list",children:[v.map(u=>e.jsxs("button",{type:"button",className:"nice-console__palette-item",disabled:u.disabled,onClick:()=>{s(u.key),a()},children:[u.icon&&e.jsx("span",{className:"nice-console__palette-icon",children:u.icon}),e.jsx("span",{className:"nice-console__palette-label",children:u.label}),u.description&&e.jsx("span",{className:"nice-console__palette-desc",children:u.description}),u.shortcut&&e.jsx("span",{className:"nice-console__palette-shortcut",children:u.shortcut})]},u.key)),v.length===0&&e.jsx("div",{className:"nice-console__palette-empty",children:p("console.noCommands","No matching commands")})]})]})]})},Mi=Object.assign(i.forwardRef(({tabs:n=[],activeTabKey:s,onTabChange:a,onTabClose:t,commandPalette:c=[],onCommand:r,statusItems:d=[],toolbar:p,sidePanel:v,sidePanelWidth:u=220,sidePanelCollapsed:l,onToggleSidePanel:m,bottomPanel:o,bottomPanelHeight:h=200,bottomPanelCollapsed:k,onToggleBottomPanel:I,children:_,size:w="md",theme:z="dark",className:$,style:S,id:C,accessMode:M,...R},B)=>{const y=i.useRef(null);b.useRovingFocus(y,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const g=b.useControlId(C),T=b.useNiceAccessMode(M,C),{t:A}=b.useNiceTranslation(),[N,f]=i.useState(n[0]?.key??""),[O,L]=i.useState(!1),[Q,x]=i.useState(!1),[E,F]=i.useState(!1),D=s??N,V=l??O,W=k??Q,K=i.useCallback(P=>{a?a(P):f(P)},[a]),ie=i.useCallback(()=>{const P=!V;m?m(P):L(P)},[V,m]),Z=i.useCallback(()=>{const P=!W;I?I(P):x(P)},[W,I]);i.useEffect(()=>{if(c.length===0)return;const P=te=>{te.ctrlKey&&te.shiftKey&&te.key==="P"&&(te.preventDefault(),F(Ne=>!Ne))};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[c.length]);const ne=i.useRef(null),ee=i.useCallback(P=>{ne.current=P,typeof B=="function"?B(P):B&&(B.current=P)},[B]);b.useIntent("menu",()=>F(P=>!P),{ref:ne,enabled:c.length>0});const ce=n.find(P=>P.key===D),J=d.filter(P=>!P.position||P.position==="left"),_e=d.filter(P=>P.position==="right");return T==="hidden"?null:e.jsxs("div",{ref:ee,id:g,className:`nice-console nice-console--${w} nice-console--${z} ${$??""}`,style:S,...R,children:[p&&e.jsx("div",{className:"nice-console__toolbar",children:p}),n.length>0&&e.jsx("div",{className:"nice-console__tabs",ref:y,role:"tablist",children:n.map(P=>e.jsxs("div",{className:`nice-console__tab ${P.key===D?"nice-console__tab--active":""}`,role:"tab","aria-selected":P.key===D,children:[e.jsxs("button",{type:"button",className:"nice-console__tab-btn",onClick:()=>K(P.key),children:[P.icon&&e.jsx("span",{className:"nice-console__tab-icon",children:P.icon}),e.jsx("span",{children:P.label})]}),(P.closable??!0)&&t&&e.jsx("button",{type:"button",className:"nice-console__tab-close",onClick:()=>t(P.key),"aria-label":A("console.closeTab","Close tab"),children:e.jsx(b.NiceIcon,{name:"close",size:14})})]},P.key))}),e.jsxs("div",{className:"nice-console__main",children:[v&&!V&&e.jsxs("aside",{className:"nice-console__side",style:{width:u,flexShrink:0},children:[e.jsx("div",{className:"nice-console__side-header",children:e.jsx("button",{type:"button",className:"nice-console__side-toggle",onClick:ie,"aria-label":A("console.closeSidePanel","Close side panel"),children:e.jsx(b.NiceIcon,{name:"close",size:14})})}),e.jsx("div",{className:"nice-console__side-content",children:v})]}),e.jsxs("div",{className:"nice-console__center",children:[e.jsx("div",{className:"nice-console__content",role:"tabpanel",children:ce?ce.render?ce.render():ce.content:_}),o&&!W&&e.jsxs("div",{className:"nice-console__bottom",style:{height:h,flexShrink:0},children:[e.jsx("div",{className:"nice-console__bottom-header",children:e.jsx("button",{type:"button",className:"nice-console__bottom-toggle",onClick:Z,"aria-label":A("console.closeBottomPanel","Close bottom panel"),children:e.jsx(b.NiceIcon,{name:"close",size:14})})}),e.jsx("div",{className:"nice-console__bottom-content",children:o})]})]})]}),d.length>0&&e.jsxs("div",{className:"nice-console__statusbar",children:[e.jsxs("div",{className:"nice-console__statusbar-left",children:[v&&V&&e.jsx("button",{type:"button",className:"nice-console__statusbar-btn",onClick:ie,title:A("console.openSidePanel","Open side panel"),children:e.jsx(b.NiceIcon,{name:"menu",size:14})}),o&&W&&e.jsx("button",{type:"button",className:"nice-console__statusbar-btn",onClick:Z,title:A("console.openBottomPanel","Open bottom panel"),children:e.jsx(b.NiceIcon,{name:"chevron-up",size:14})}),J.map(P=>e.jsx("span",{onKeyDown:b.clickOnActivationKey,className:"nice-console__status-item",onClick:P.onClick,role:P.onClick?"button":void 0,tabIndex:P.onClick?0:void 0,children:P.content??P.label},P.key))]}),e.jsx("div",{className:"nice-console__statusbar-right",children:_e.map(P=>e.jsx("span",{onKeyDown:b.clickOnActivationKey,className:"nice-console__status-item",onClick:P.onClick,role:P.onClick?"button":void 0,tabIndex:P.onClick?0:void 0,children:P.content??P.label},P.key))})]}),E&&c.length>0&&e.jsx(Ei,{commands:c,onSelect:P=>r?.(P),onClose:()=>F(!1)})]})}),{displayName:"NiceConsole"}),zi=[],Li=Object.assign(i.forwardRef(({steps:n=zi,activeStep:s,onStepChange:a,onComplete:t,onCancel:c,allowStepClick:r=!1,variant:d="horizontal",nextLabel:p,prevLabel:v,finishLabel:u,cancelLabel:l,showProgress:m=!0,className:o,style:h,size:k="md",accessMode:I,id:_},w)=>{const $=b.useNiceAccessMode(I,_)==="hidden",{t:S}=b.useNiceTranslation(),C=b.useControlId(_),[M,R]=i.useState(0),[B,y]=i.useState({}),[g,T]=i.useState(new Set([0])),A=s??M,N=n[A],f=A===0,O=A===n.length-1,L=i.useCallback(Z=>{const ne=Math.max(0,Math.min(n.length-1,Z));R(ne),T(ee=>new Set(ee).add(ne)),a?.(ne)},[n.length,a]),Q=i.useCallback(()=>{if(!N?.validate)return!0;const Z=N.validate();return Z===!0||Z===void 0?(y(ne=>{const ee={...ne};return delete ee[N.id],ee}),!0):(y(ne=>({...ne,[N.id]:Z})),!1)},[N]),x=i.useCallback(()=>{Q()&&(O?t?.():L(A+1))},[A,O,Q,L,t]),E=i.useCallback(()=>{f||L(A-1)},[A,f,L]),F=i.useCallback(Z=>{const ne=n.findIndex(ee=>ee.id===Z);ne>=0&&L(ne)},[n,L]),D=i.useMemo(()=>({stepIndex:A,totalSteps:n.length,goNext:x,goPrev:E,goTo:F,isFirst:f,isLast:O}),[A,n.length,x,E,F,f,O]),V=n.length>0?(A+1)/n.length*100:0,W=i.useRef(null),K=i.useCallback(Z=>{W.current=Z,typeof w=="function"?w(Z):w&&(w.current=Z)},[w]);if(b.useIntent(["sectionPrev","sectionNext"],Z=>Z.intent==="sectionNext"?x():E(),{ref:W,enabled:!$&&n.length>0}),b.useInputHints(W,[...f?[]:[{intent:"sectionPrev",label:S("wizard.previousStep","Previous step")}],{intent:"sectionNext",label:O?S("finish","Finish"):S("wizard.nextStep","Next step")}],{enabled:n.length>0}),$)return null;const ie=n.map(Z=>({title:Z.title,subtitle:Z.description,icon:Z.icon,optional:Z.optional}));return e.jsxs("div",{ref:K,id:C,className:`nice-wizard nice-wizard--${d} nice-size-${k}${o?` ${o}`:""}`,style:h,children:[e.jsx(xs,{steps:ie,activeStep:A,orientation:d,allowStepClick:r,onStepClick:Z=>{Z<=A&&L(Z)}}),m&&e.jsx("div",{className:"nice-wizard__progress",role:"progressbar","aria-label":S("wizard.progress","Progress"),"aria-valuemin":1,"aria-valuemax":Math.max(1,n.length),"aria-valuenow":Math.min(A+1,Math.max(1,n.length)),children:e.jsx("div",{className:"nice-wizard__progress-bar",style:{width:`${V}%`}})}),e.jsx("div",{className:"nice-wizard__content",role:"group","aria-label":N?.title,children:N&&e.jsxs(e.Fragment,{children:[typeof N.content=="function"?N.content(D):N.content,B[N.id]&&e.jsx("div",{className:"nice-wizard__error nice-error-text",role:"alert",children:B[N.id]})]})}),e.jsxs("div",{className:"nice-wizard__actions",children:[c&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--text",onClick:c,children:l??S("cancel","Cancel")}),e.jsxs("div",{className:"nice-wizard__actions-right",children:[!f&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--outlined",onClick:E,children:v??e.jsxs(e.Fragment,{children:[e.jsx(b.NiceIcon,{name:"arrow-left",size:14})," ",S("previous","Previous")]})}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary",onClick:x,children:O?u??e.jsxs(e.Fragment,{children:[S("finish","Finish")," ",e.jsx(b.NiceIcon,{name:"check",size:14})]}):p??e.jsxs(e.Fragment,{children:[S("next","Next")," ",e.jsx(b.NiceIcon,{name:"arrow-right",size:14})]})})]})]})]})}),{displayName:"NiceWizard"}),Di=[],ks=i.createContext(null);function Ri(){const n=i.useContext(ks);if(!n)throw new Error("useSetupWizard must be used within NiceSetupWizard");return n}const Ti=e.jsx(b.NiceIcon,{name:"refresh",size:18}),Oi=Object.assign(i.forwardRef(({steps:n=Di,initialValues:s={},activeStep:a,completedSteps:t,layout:c="horizontal",size:r="md",defaultQuickMode:d=!1,allowQuickModeToggle:p=!0,showStepNumbers:v=!0,showProgress:u=!0,showEstimatedTime:l=!1,allowStepClick:m=!0,showReviewStep:o=!1,persistKey:h,animation:k="slide",theme:I,branding:_,showLanguagePicker:w=!1,languagePickerProps:z,showThemePicker:$=!1,themePickerProps:S,showRestart:C=!1,onRestart:M,restart:R={},header:B,footer:y,onStepChange:g,onValuesChange:T,onComplete:A,onCancel:N,labels:f={},accessMode:O,height:L,id:Q,className:x,style:E},F)=>{const D=i.useRef(null);b.useRovingFocus(D,{orientation:c==="vertical"?"vertical":"horizontal",wrap:!0,activateOnMove:!0});const V=b.useNiceAccessMode(O,Q),W=V==="hidden",{t:K}=b.useNiceTranslation(),ie=b.useControlId(Q),[Z,ne]=i.useState(d),ee=i.useMemo(()=>Z?n.filter(j=>!j.quickModeSkip):n,[n,Z]),ce=i.useMemo(()=>{if(!o)return ee;const j={id:"__review__",title:f.review??K("wizard.review","Review"),icon:e.jsx(b.NiceIcon,{name:"clipboard",size:16}),content:oe=>e.jsxs("div",{className:"nice-setup-wizard__review",children:[e.jsx("h3",{children:K("wizard.reviewTitle","Review Your Setup")}),ee.filter(de=>de.summary).map(de=>e.jsxs("div",{className:"nice-setup-wizard__review-section",children:[e.jsx("h4",{children:de.title}),de.summary?.(oe.values)]},de.id))]})};return[...ee,j]},[ee,o,f.review,K]),[J,_e]=i.useState(()=>{if(h)try{const j=localStorage.getItem(h);if(j)return{...s,...JSON.parse(j)}}catch{}return s}),[P,te]=i.useState(()=>{if(a)return a;if(h)try{const j=localStorage.getItem(`${h}_step`);if(j&&ce.some(oe=>oe.id===j))return j}catch{}return ce[0]?.id??""}),[Ne,ye]=i.useState(()=>new Set([P])),[$e,Ke]=i.useState({}),[Re,ve]=i.useState(!1),[Le,H]=i.useState("next"),[U,me]=i.useState(!1),he=ce.findIndex(j=>j.id===P),re=he>=0?he:ce.length>0?0:-1,ae=ce[re],Pe=re===0,Ie=re===ce.length-1,Ye=ce.length>0?(re+1)/ce.length*100:0,se=i.useRef(a);i.useEffect(()=>{if(a===void 0||a===se.current)return;const j=ce.findIndex(oe=>oe.id===a);j<0||(se.current=a,a!==P&&(H(j>ce.findIndex(oe=>oe.id===P)?"next":"prev"),te(a),ye(oe=>new Set(oe).add(a))))},[a,ce,P]),i.useEffect(()=>{h&&(localStorage.setItem(h,JSON.stringify(J)),localStorage.setItem(`${h}_step`,P))},[J,P,h]);const xe=i.useCallback((j,oe)=>{_e(de=>{const Oe={...de,[j]:oe};return T?.(Oe),Oe})},[T]),Me=i.useCallback(j=>{_e(oe=>{const de={...oe,...j};return T?.(de),de})},[T]),Ee=i.useCallback((j,oe)=>{Ke(de=>({...de,[j]:oe}))},[]),Be=i.useCallback(j=>{Ke(oe=>{const de={...oe};return delete de[j],de})},[]),ze=i.useCallback(j=>{const oe=ce.findIndex(de=>de.id===j);oe>=0&&(H(oe>re?"next":"prev"),te(j),ye(de=>new Set(de).add(j)),g?.(j,oe))},[ce,re,g]),He=i.useCallback(async()=>{if(!(!ae||ae.canProceed===!1)){if(ae.validate){ve(!0);try{const j=await ae.validate(J);if(j){Ee(ae.id,j),ve(!1);return}Be(ae.id)}catch(j){Ee(ae.id,String(j)),ve(!1);return}ve(!1)}if(ae.fields){for(const j of ae.fields){if(j.required&&!J[j.id]){Ee(ae.id,`${j.label} ${K("wizard.isRequired","is required")}`);return}if(j.validation?.custom){const oe=j.validation.custom(J[j.id]);if(oe){Ee(ae.id,oe);return}}}Be(ae.id)}if(Ie)await A?.(J),h&&(localStorage.removeItem(h),localStorage.removeItem(`${h}_step`));else{let j;ae.nextStep?j=typeof ae.nextStep=="function"?ae.nextStep(J):ae.nextStep:j=ce[re+1]?.id??"",j&&ze(j)}}},[ae,J,Ie,re,ce,A,h,K,Ee,Be,ze]),Te=i.useCallback(()=>{if(Pe||ae?.canGoBack===!1)return;const j=ae?.prevStep??ce[re-1]?.id;j&&(H("prev"),ze(j))},[Pe,ae,re,ce,ze]),De=i.useCallback(()=>{if(ae?.optional&&!Ie){const j=ce[re+1]?.id;j&&ze(j)}},[ae,Ie,re,ce,ze]),Y=i.useCallback(()=>{A?.(J)},[A,J]),le=i.useCallback(()=>{N?.()},[N]),fe=i.useCallback(()=>{R.skipConfirm?M?.():me(!0)},[R.skipConfirm,M]),pe=i.useCallback(()=>{ne(j=>!j)},[]),ke=i.useMemo(()=>({values:J,setValue:xe,setValues:Me,currentStep:ae,currentIndex:re,totalSteps:ce.length,visitedSteps:Ne,errors:$e,setError:Ee,clearError:Be,goNext:He,goPrev:Te,goTo:ze,skip:De,complete:Y,cancel:le,isFirst:Pe,isLast:Ie,isQuickMode:Z,toggleQuickMode:pe,progress:Ye,t:K}),[J,xe,Me,ae,re,ce.length,Ne,$e,Ee,Be,He,Te,ze,De,Y,le,Pe,Ie,Z,pe,Ye,K]),q=i.useMemo(()=>{if(!l)return null;const oe=ce.map(de=>de.estimatedTime).filter(Boolean).map(de=>{const Oe=de.match(/(\d+)\s*(min|sec|s|m)/i);if(!Oe)return 0;const Ve=parseInt(Oe[1],10);return Oe[2].toLowerCase().startsWith("m")?Ve:Ve/60}).reduce((de,Oe)=>de+Oe,0);return oe>0?`~${Math.ceil(oe)} min`:null},[ce,l]),X=i.useRef(null),Ce=i.useCallback(j=>{X.current=j,typeof F=="function"?F(j):F&&(F.current=j)},[F]);b.useIntent(["sectionPrev","sectionNext"],j=>{j.intent==="sectionNext"?He():Te()},{ref:X,enabled:!W&&!!ae});const Fe=!Pe&&ae?.canGoBack!==!1,ge=ae?.canProceed!==!1;if(b.useInputHints(X,[...Fe?[{intent:"sectionPrev",label:f.prev??K("wizard.prev","Back")}]:[],...ge?[{intent:"sectionNext",label:ae?.nextLabel??(Ie?f.finish??K("wizard.finish","Finish"):f.next??K("wizard.next","Continue"))}]:[]],{enabled:!!ae}),!ae)return null;const Je=(j,oe)=>{const de=j.id===P,Oe=!de&&(!!t?.includes(j.id)||Ne.has(j.id)&&oe<re),Ve=!de&&!Oe,qe=!!$e[j.id],je=m&&(Oe||oe<=re);return e.jsxs("button",{type:"button",role:"tab","aria-selected":de,"aria-current":de?"step":void 0,className:["nice-setup-wizard__step-indicator",de&&"nice-setup-wizard__step-indicator--active",Oe&&"nice-setup-wizard__step-indicator--completed",Ve&&"nice-setup-wizard__step-indicator--pending",qe&&"nice-setup-wizard__step-indicator--error"].filter(Boolean).join(" "),onClick:()=>je&&ze(j.id),disabled:!je,children:[e.jsx("span",{className:"nice-setup-wizard__step-marker",children:Oe?e.jsx(b.NiceIcon,{name:"check",size:14}):qe?"!":v?oe+1:j.icon||e.jsx(b.NiceIcon,{name:"circle",size:12})}),e.jsxs("span",{className:"nice-setup-wizard__step-info",children:[e.jsx("span",{className:"nice-setup-wizard__step-title",children:j.title}),j.subtitle&&e.jsx("span",{className:"nice-setup-wizard__step-subtitle",children:j.subtitle}),j.optional&&e.jsxs("span",{className:"nice-setup-wizard__step-optional",children:["(",f.optional??K("wizard.optional","optional"),")"]})]}),j.badge&&e.jsx("span",{className:"nice-setup-wizard__step-badge",children:j.badge})]},j.id)},G=j=>{if(j.showWhen&&!j.showWhen(J))return null;const oe=J[j.id]??j.defaultValue??"",de=je=>xe(j.id,je);if(j.render)return e.jsx("div",{className:`nice-setup-wizard__field${j.fullWidth?" nice-setup-wizard__field--full":""}`,children:j.render({value:oe,onChange:de,field:j})},j.id);const Oe=`${ie}-${j.id}`,Ve={id:Oe,disabled:j.disabled||V==="disabled"||V==="readOnly",placeholder:j.placeholder,required:j.required};let qe;switch(j.type){case"textarea":qe=e.jsx("textarea",{...Ve,className:"nice-setup-wizard__input nice-setup-wizard__textarea",value:String(oe),onChange:je=>de(je.target.value),rows:4});break;case"select":qe=e.jsxs("select",{...Ve,className:"nice-setup-wizard__input nice-setup-wizard__select",value:String(oe),onChange:je=>de(je.target.value),children:[e.jsx("option",{value:"",children:j.placeholder||K("wizard.select","Select...")}),j.options?.map(je=>e.jsx("option",{value:je.value,children:je.label},je.value))]});break;case"radio":qe=e.jsx("div",{className:"nice-setup-wizard__radio-group",children:j.options?.map(je=>e.jsxs("label",{className:"nice-setup-wizard__radio-label",children:[e.jsx("input",{type:"radio",name:Oe,value:je.value,checked:oe===je.value,onChange:()=>de(je.value),disabled:Ve.disabled}),je.icon&&e.jsx("span",{className:"nice-setup-wizard__radio-icon",children:je.icon}),e.jsx("span",{children:je.label})]},je.value))});break;case"checkbox":qe=e.jsxs("label",{className:"nice-setup-wizard__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:!!oe,onChange:je=>de(je.target.checked),disabled:Ve.disabled}),e.jsx("span",{children:j.label})]});break;case"switch":qe=e.jsxs("label",{className:"nice-setup-wizard__switch-label",children:[e.jsx("span",{className:"nice-setup-wizard__switch-text",children:j.label}),e.jsxs("span",{className:`nice-setup-wizard__switch${oe?" nice-setup-wizard__switch--on":""}`,children:[e.jsx("input",{type:"checkbox",checked:!!oe,onChange:je=>de(je.target.checked),disabled:Ve.disabled}),e.jsx("span",{className:"nice-setup-wizard__switch-track"}),e.jsx("span",{className:"nice-setup-wizard__switch-thumb"})]})]});break;case"slider":qe=e.jsxs("div",{className:"nice-setup-wizard__slider-wrapper",children:[e.jsx("input",{type:"range",...Ve,className:"nice-setup-wizard__slider",value:Number(oe)||j.validation?.min||0,min:j.validation?.min,max:j.validation?.max,onChange:je=>de(Number(je.target.value))}),e.jsx("span",{className:"nice-setup-wizard__slider-value",children:String(oe??"")})]});break;default:qe=e.jsx("input",{type:j.type==="custom"?"text":j.type,...Ve,className:"nice-setup-wizard__input",value:String(oe),onChange:je=>de(je.target.value),minLength:j.validation?.minLength,maxLength:j.validation?.maxLength,min:j.validation?.min,max:j.validation?.max,pattern:j.validation?.pattern?.source})}return e.jsxs("div",{className:`nice-setup-wizard__field${j.fullWidth?" nice-setup-wizard__field--full":""}`,children:[j.type!=="checkbox"&&j.type!=="switch"&&e.jsxs("label",{htmlFor:Oe,className:"nice-setup-wizard__label",children:[j.label,j.required&&e.jsx("span",{className:"nice-setup-wizard__required",children:"*"})]}),qe,j.description&&e.jsx("span",{className:"nice-setup-wizard__field-desc",children:j.description})]},j.id)},ue=()=>ae.fields?e.jsx("div",{className:"nice-setup-wizard__fields",children:ae.fields.map(G)}):ae.content?typeof ae.content=="function"?ae.content(ke):ae.content:null;if(W)return null;const we=w||$||C,Ge=R.label??K("wizard.restart","Start over"),be=e.jsx(ks.Provider,{value:ke,children:e.jsxs("div",{ref:Ce,id:ie,className:["nice-setup-wizard",`nice-setup-wizard--${c}`,`nice-size-${r}`,k!=="none"&&`nice-setup-wizard--anim-${k}`,x].filter(Boolean).join(" "),style:L!=null?{height:L,minHeight:0,maxHeight:"none",boxSizing:"border-box",...E}:E,children:[(_||B||p||we)&&e.jsxs("header",{className:"nice-setup-wizard__header",children:[_&&e.jsx("div",{className:"nice-setup-wizard__branding",children:_}),we&&e.jsxs("div",{className:"nice-setup-wizard__header-controls",children:[w&&e.jsx(wn,{compact:!0,variant:"ghost",...z}),$&&e.jsx(Sn,{compact:!0,variant:"ghost",...S}),C&&e.jsx("button",{type:"button",className:"nice-setup-wizard__icon-btn nice-setup-wizard__restart",onClick:fe,title:Ge,"aria-label":Ge,children:R.icon??Ti})]}),B,p&&e.jsxs("label",{className:"nice-setup-wizard__quick-toggle",children:[e.jsx("input",{type:"checkbox",checked:Z,onChange:pe}),e.jsx("span",{children:f.quickMode??K("wizard.quickMode","Quick Setup")})]}),q&&e.jsx("span",{className:"nice-setup-wizard__time",children:q})]}),c!=="minimal"&&e.jsx("nav",{className:"nice-setup-wizard__nav",ref:D,role:"tablist",children:ce.map(Je)}),u&&e.jsx("div",{className:"nice-setup-wizard__progress",children:e.jsx("div",{className:"nice-setup-wizard__progress-bar",style:{width:`${Ye}%`},role:"progressbar","aria-valuenow":Ye,"aria-valuemin":0,"aria-valuemax":100})}),e.jsxs("div",{className:["nice-setup-wizard__content",Le==="next"&&"nice-setup-wizard__content--slide-next",Le==="prev"&&"nice-setup-wizard__content--slide-prev"].filter(Boolean).join(" "),role:"tabpanel",children:[ae.description&&e.jsx("p",{className:"nice-setup-wizard__step-description",children:ae.description}),ue(),$e[ae.id]&&e.jsx("div",{className:"nice-setup-wizard__error",role:"alert",children:$e[ae.id]})]},P),e.jsxs("footer",{className:"nice-setup-wizard__footer",children:[e.jsxs("div",{className:"nice-setup-wizard__actions-left",children:[N&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--text",onClick:le,children:f.cancel??K("wizard.cancel","Cancel")}),ae.optional&&!Ie&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--text",onClick:De,children:f.skip??K("wizard.skip","Skip")}),ae.actions?.filter(j=>j.position==="left").map(j=>e.jsxs("button",{type:"button",className:`nice-btn nice-btn--${j.variant||"outlined"}`,onClick:()=>j.onClick(ke),disabled:j.disabled?.(ke),children:[j.icon," ",j.label]},j.id))]}),e.jsxs("div",{className:"nice-setup-wizard__actions-right",children:[ae.actions?.filter(j=>j.position!=="left").map(j=>e.jsxs("button",{type:"button",className:`nice-btn nice-btn--${j.variant||"outlined"}`,onClick:()=>j.onClick(ke),disabled:j.disabled?.(ke),children:[j.icon," ",j.label]},j.id)),Fe&&e.jsx(Ze.NiceButton,{variant:"outline",size:r,onClick:Te,children:f.prev??e.jsxs(e.Fragment,{children:[e.jsx(b.NiceIcon,{name:"arrow-left",size:14})," ",K("wizard.prev","Back")]})}),e.jsx(Ze.NiceButton,{variant:"primary",size:r,onClick:He,disabled:Re||!ge,loading:Re,children:ae.nextLabel??(Ie?f.finish??e.jsxs(e.Fragment,{children:[K("wizard.finish","Finish")," ",e.jsx(b.NiceIcon,{name:"check",size:14})]}):f.next??e.jsxs(e.Fragment,{children:[K("wizard.next","Continue")," ",e.jsx(b.NiceIcon,{name:"arrow-right",size:14})]}))})]})]}),y&&e.jsx("div",{className:"nice-setup-wizard__custom-footer",children:y}),c==="minimal"&&e.jsx("div",{className:"nice-setup-wizard__minimal-indicator",children:f.stepOf?f.stepOf.replace("{current}",String(re+1)).replace("{total}",String(ce.length)):`${re+1} / ${ce.length}`}),C&&!R.skipConfirm&&e.jsx(Ue.NiceConfirmDialog,{visible:U,variant:"warning",size:r,header:R.confirmTitle??K("wizard.restartConfirmTitle","Start setup over?"),message:R.confirmMessage??K("wizard.restartConfirmMessage","This will discard your progress and restart the setup from the beginning."),acceptLabel:R.confirmLabel??K("wizard.restartConfirmAccept","Yes, start over"),rejectLabel:R.cancelLabel??K("wizard.restartConfirmReject","Cancel"),onAccept:()=>{me(!1),M?.()},onReject:()=>me(!1)})]})});return I!=null?e.jsx(b.NiceThemeProvider,{theme:I,children:be}):be}),{displayName:"NiceSetupWizard"}),Fi=Object.assign(i.forwardRef(({label:n,helperText:s,disabled:a,size:t="md",id:c,className:r,style:d,accessMode:p,logo:v,brandName:u,breadcrumbs:l,centerContent:m,rightContent:o,leftContent:h,sticky:k=!0,variant:I="light",height:_="md",onBrandClick:w,displayStyle:z},$)=>{const S=b.useNiceAccessMode(p,c),C=S==="hidden";S==="disabled"&&(a=!0);const{t:M}=b.useNiceTranslation(),R=b.useControlId(c),B=b.useComponentDisplayStyle("menu",z),y=b.useComponentDisplayClass("menu",z);return C?null:e.jsxs("nav",{ref:$,id:R,className:`nice-navbar nice-navbar--${I} nice-navbar--h-${_}${k?" nice-navbar--sticky":""} nice-navbar--ds-${y}${r?` ${r}`:""}${a?" nice-disabled":""}`,style:{...B,...d},role:"navigation","aria-label":n??M("mainNavigation","Main navigation"),children:[e.jsxs("div",{className:"nice-navbar__left",children:[h,(v||u)&&e.jsxs("div",{onKeyDown:b.clickOnActivationKey,className:"nice-navbar__brand",onClick:w,role:w?"button":void 0,tabIndex:w?0:void 0,children:[v&&e.jsx("span",{className:"nice-navbar__logo",children:v}),u&&e.jsx("span",{className:"nice-navbar__brand-name",children:u})]}),l&&l.length>0&&e.jsx("ol",{className:"nice-navbar__breadcrumbs","aria-label":M("breadcrumbs","Breadcrumbs"),children:l.map((g,T)=>e.jsxs("li",{className:"nice-navbar__breadcrumb",children:[T>0&&e.jsx("span",{className:"nice-navbar__breadcrumb-sep",children:"/"}),g.href||g.onClick?e.jsx("a",{href:g.href??"#",onClick:A=>{g.onClick&&(A.preventDefault(),g.onClick())},children:g.label}):e.jsx("span",{"aria-current":T===l.length-1?"page":void 0,children:g.label})]},T))})]}),m&&e.jsx("div",{className:"nice-navbar__center",children:m}),o&&e.jsx("div",{className:"nice-navbar__right",children:o})]})}),{displayName:"NiceNavbar"}),Ai={online:"var(--nice-color-success, #5cb85c)",away:"var(--nice-color-warning, #f0ad4e)",busy:"var(--nice-color-error, #d9534f)",offline:"var(--nice-text-muted, #999)"},Cs=Object.assign(i.forwardRef(({label:n,disabled:s,size:a="md",id:t,className:c,style:r,accessMode:d,userName:p,userEmail:v,userRole:u,avatarUrl:l,items:m=[],open:o,onOpenChange:h,onProfile:k,onLogout:I,avatarSize:_=36,status:w},z)=>{const $=b.useNiceAccessMode(d,t),S=$==="hidden";$==="disabled"&&(s=!0);const{t:C}=b.useNiceTranslation(),M=b.useControlId(t),[R,B]=i.useState(!1),y=o??R,g=i.useCallback(F=>{B(F),h?.(F)},[h]),T=i.useCallback(()=>g(!y),[y,g]),A=i.useRef(null),N=i.useRef(null);b.useMenuButton(A,N,{open:y,onOpenChange:g});const[f,O]=i.useState(null),L=i.useCallback(()=>{const F=A.current?.getBoundingClientRect();F&&O({top:F.bottom+6,right:window.innerWidth-F.right})},[]);i.useLayoutEffect(()=>{y&&L()},[y,L]),i.useEffect(()=>{if(!y)return;const F=()=>L();return window.addEventListener("scroll",F,!0),window.addEventListener("resize",F),()=>{window.removeEventListener("scroll",F,!0),window.removeEventListener("resize",F)}},[y,L]);const Q=p.split(" ").map(F=>F.charAt(0)).join("").toUpperCase().slice(0,2),x=[];k&&x.push({id:"__profile",label:C("profile","Profile"),onClick:k}),I&&x.push({id:"__divider",label:"",isDivider:!0},{id:"__logout",label:C("logout","Logout"),onClick:I,danger:!0});const E=m.length>0?m:x;return S?null:e.jsxs("div",{ref:z,id:M,className:`nice-user-menu nice-size-${a}${c?` ${c}`:""}${s?" nice-disabled":""}`,style:r,children:[e.jsxs("button",{ref:A,type:"button",className:"nice-user-menu__trigger",onClick:T,disabled:s,"aria-haspopup":"menu","aria-expanded":y,"aria-label":n??p,children:[e.jsx("span",{className:"nice-user-menu__avatar",style:{width:_,height:_},children:l?e.jsx("img",{src:l,alt:p}):e.jsx("span",{className:"nice-user-menu__initials",children:Q})}),w&&e.jsx("span",{className:"nice-user-menu__status",style:{backgroundColor:Ai[w]},title:w})]}),y&&f&&typeof document<"u"&&hn.createPortal(e.jsxs("div",{ref:N,className:`nice-user-menu__dropdown nice-user-menu__dropdown--portal ${Ue.scopeThemeClass(A.current)}`,role:"menu",style:{position:"fixed",top:f.top,right:f.right,zIndex:1e3},onMouseDown:F=>F.preventDefault(),children:[e.jsxs("div",{className:"nice-user-menu__info",children:[e.jsx("span",{className:"nice-user-menu__name",children:p}),v&&e.jsx("span",{className:"nice-user-menu__email",children:v}),u&&e.jsx("span",{className:"nice-user-menu__role",children:u})]}),E.length>0&&e.jsx("div",{className:"nice-user-menu__items",children:E.map(F=>F.isDivider?e.jsx("hr",{className:"nice-user-menu__divider"},F.id):e.jsxs("button",{type:"button",role:"menuitem",className:`nice-user-menu__item${F.danger?" nice-user-menu__item--danger":""}`,onClick:()=>{F.onClick?.(),g(!1)},disabled:F.disabled||s,children:[F.icon&&e.jsx("span",{className:"nice-user-menu__item-icon",children:F.icon}),e.jsx("span",{children:F.label})]},F.id))})]}),document.body)]})}),{displayName:"NiceUserMenu"});function Pi(n,s){if(!s)return n;const a=s.toLowerCase();return n.map(t=>{const c=t.entities.filter(d=>d.label.toLowerCase().includes(a)||d.name.toLowerCase().includes(a));return t.label.toLowerCase().includes(a)||t.name.toLowerCase().includes(a)?t:c.length>0?{...t,entities:c}:null}).filter(Boolean)}const Bi=({value:n,onChange:s,placeholder:a})=>{const{t}=b.useNiceTranslation();return e.jsxs("div",{className:"nice-dynamic-sidebar__search",children:[e.jsx("span",{className:"nice-dynamic-sidebar__search-icon","aria-hidden":!0,children:e.jsx(b.NiceIcon,{name:"search",size:16})}),e.jsx("input",{type:"text",className:"nice-dynamic-sidebar__search-input",value:n,onChange:c=>s(c.target.value),placeholder:a,"aria-label":a}),n&&e.jsx("button",{className:"nice-dynamic-sidebar__search-clear",onClick:()=>s(""),"aria-label":t("nav.clear","Clear"),type:"button",children:e.jsx(b.NiceIcon,{name:"close",size:14})})]})},Hi=({module:n,activeRoute:s,collapsed:a,expandedModules:t,onToggleModule:c,onNavigate:r})=>{const d=t.has(n.id);return a?e.jsx("div",{className:"nice-dynamic-sidebar__module nice-dynamic-sidebar__module--collapsed",title:n.label,children:e.jsx("button",{className:`nice-dynamic-sidebar__module-icon ${n.isAvailable?"":"nice-dynamic-sidebar__module-icon--disabled"}`,onClick:()=>n.isAvailable&&n.entities.length>0&&r(n.entities[0].route,n.entities[0]),disabled:!n.isAvailable,type:"button",children:n.icon?e.jsx(b.NiceIcon,{name:n.icon,size:18}):e.jsx("span",{children:n.label[0]})})}):e.jsxs("div",{className:`nice-dynamic-sidebar__module ${n.isAvailable?"":"nice-dynamic-sidebar__module--disabled"}`,children:[e.jsxs("button",{className:`nice-dynamic-sidebar__module-header ${d?"nice-dynamic-sidebar__module-header--expanded":""}`,onClick:()=>n.isAvailable&&c(n.id),disabled:!n.isAvailable,type:"button","aria-expanded":d,children:[n.icon&&e.jsx("span",{className:"nice-dynamic-sidebar__module-icon",children:e.jsx(b.NiceIcon,{name:n.icon,size:16})}),e.jsx("span",{className:"nice-dynamic-sidebar__module-label",children:n.label}),e.jsx("span",{className:`nice-dynamic-sidebar__module-chevron ${d?"nice-dynamic-sidebar__module-chevron--open":""}`,children:e.jsx(b.NiceIcon,{name:"chevron-right",size:14})})]}),d&&e.jsx("ul",{className:"nice-dynamic-sidebar__entities",role:"list",children:n.entities.map(p=>e.jsx("li",{className:`nice-dynamic-sidebar__entity ${s===p.route?"nice-dynamic-sidebar__entity--active":""}`,children:e.jsxs("button",{className:"nice-dynamic-sidebar__entity-btn",onClick:()=>r(p.route,p),type:"button",children:[p.icon&&e.jsx("span",{className:"nice-dynamic-sidebar__entity-icon",children:e.jsx(b.NiceIcon,{name:p.icon,size:14})}),e.jsx("span",{children:p.label})]})},p.id))})]})},Ki=({favorites:n,activeRoute:s,onNavigate:a,label:t})=>n.length===0?null:e.jsxs("div",{className:"nice-dynamic-sidebar__favorites",children:[e.jsx("div",{className:"nice-dynamic-sidebar__section-title",children:t}),e.jsx("ul",{role:"list",children:n.map(c=>e.jsx("li",{className:`nice-dynamic-sidebar__favorite ${s===c.route?"nice-dynamic-sidebar__favorite--active":""}`,children:e.jsxs("button",{className:"nice-dynamic-sidebar__favorite-btn",onClick:()=>a(c.route),type:"button",children:[c.icon&&e.jsx(b.NiceIcon,{name:c.icon,size:14}),e.jsx("span",{children:c.label})]})},c.id))})]}),Yi=Object.assign(i.forwardRef(({menu:n,activeRoute:s,collapsed:a,width:t=260,collapsedWidth:c=56,searchable:r=!0,showFavorites:d=!0,showQuickActions:p=!0,collapsible:v=!0,onNavigate:u,onCollapseChange:l,onToggleFavorite:m,header:o,footer:h,className:k,style:I,id:_,accessMode:w,...z},$)=>{const S=b.useControlId(_),C=b.useNiceAccessMode(w,_),{t:M}=b.useNiceTranslation(),[R,B]=i.useState(a??!1),y=a??R,[g,T]=i.useState(""),[A,N]=i.useState(()=>{if(s){const E=n.modules.find(F=>F.entities.some(D=>D.route===s));return E?new Set([E.id]):new Set}return new Set}),f=i.useCallback(()=>{const E=!y;B(E),l?.(E)},[y,l]),O=i.useCallback(E=>{N(F=>{const D=new Set(F);return D.has(E)?D.delete(E):D.add(E),D})},[]),L=i.useCallback((E,F)=>{u?.(E,F)},[u]),Q=i.useMemo(()=>Pi(n.modules.filter(E=>E.isAvailable).sort((E,F)=>E.order-F.order),g),[n.modules,g]),x=y?c:t;return C==="hidden"?null:e.jsxs("nav",{ref:$,id:S,className:`nice-dynamic-sidebar ${y?"nice-dynamic-sidebar--collapsed":""} ${k??""}`,style:{...I,width:x,minWidth:x},"aria-label":M("nav.sidebar","Sidebar"),...z,children:[o&&e.jsx("div",{className:"nice-dynamic-sidebar__header",children:o}),v&&e.jsx("button",{className:"nice-dynamic-sidebar__toggle",onClick:f,"aria-label":y?M("expand","Expand"):M("collapse","Collapse"),type:"button",children:e.jsx(b.NiceIcon,{name:y?"chevron-right":"chevron-left",size:14})}),r&&!y&&e.jsx(Bi,{value:g,onChange:T,placeholder:M("nav.search","Search")}),d&&!y&&e.jsx(Ki,{favorites:n.favorites,activeRoute:s,onNavigate:L,label:M("nav.favorites","Favorites")}),p&&!y&&n.quickActions.length>0&&e.jsx("div",{className:"nice-dynamic-sidebar__quick-actions",children:n.quickActions.map(E=>e.jsxs("button",{className:"nice-dynamic-sidebar__quick-action",onClick:()=>L(E.route),title:E.shortcut?`${E.label} (${E.shortcut})`:E.label,type:"button",children:[E.icon&&e.jsx(b.NiceIcon,{name:E.icon,size:14}),e.jsx("span",{children:E.label})]},E.id))}),e.jsxs("div",{className:"nice-dynamic-sidebar__modules",role:"navigation",children:[Q.map(E=>e.jsx(Hi,{module:E,activeRoute:s,collapsed:y,expandedModules:A,onToggleModule:O,onNavigate:L},E.id)),Q.length===0&&!y&&e.jsx("div",{className:"nice-dynamic-sidebar__empty",children:M("noData","No data")})]}),h&&e.jsx("div",{className:"nice-dynamic-sidebar__footer",children:h})]})}),{displayName:"NiceDynamicSidebar"}),Ui=Object.assign(i.forwardRef(({user:n,userMenuItems:s,onProfile:a,onLogout:t,showLogin:c=!0,loginLabel:r,onLoginClick:d,showRegister:p,registerLabel:v,onRegisterClick:u,size:l="md",compact:m=!1,className:o,style:h,id:k,"data-testid":I="nice-auth-buttons"},_)=>{const{t:w}=b.useNiceTranslation(),z=["nice-auth-buttons",`nice-auth-buttons--${l}`,m?"nice-auth-buttons--compact":"",o??""].filter(Boolean).join(" ");if(n)return e.jsx("div",{ref:_,id:k,className:z,style:h,"data-testid":I,children:e.jsx(Cs,{userName:n.name,userEmail:n.email,userRole:n.role,avatarUrl:n.avatarUrl,status:n.status,items:s,onProfile:a,onLogout:t,size:l})});const $=p??!!u;return e.jsxs("div",{ref:_,id:k,className:z,style:h,"data-testid":I,children:[c&&d&&e.jsx(Ze.NiceButton,{variant:"ghost",size:l,onClick:d,className:"nice-auth-buttons__login",children:r??w("auth.signIn","Sign in")}),$&&u&&e.jsx(Ze.NiceButton,{variant:"primary",size:l,onClick:u,className:"nice-auth-buttons__register",children:v??w("auth.register","Register")})]})}),{displayName:"NiceAuthButtons"}),Vi=[];function Kn(n){return!n.children||n.children.length===0}function ws(n,s){return s?n.id===s?!0:(n.children??[]).some(a=>ws(a,s)):!1}const Wi=Object.assign(i.forwardRef(({items:n=Vi,activeId:s,size:a="md",align:t="start",ariaLabel:c,stretch:r=!1,trigger:d="click",hoverCloseDelay:p=150,className:v,style:u,id:l,"data-testid":m="nice-nav-menu"},o)=>{const{t:h}=b.useNiceTranslation(),k=i.useId(),[I,_]=i.useState(null),w=i.useRef(null),z=i.useRef(null),$=i.useCallback(()=>{z.current&&(clearTimeout(z.current),z.current=null)},[]),S=i.useCallback(()=>{$(),z.current=setTimeout(()=>{_(null),z.current=null},p)},[$,p]);i.useEffect(()=>()=>$(),[$]);const C=d==="hover",M=x=>!!(x.megaPanel||x.megaColumns&&x.megaColumns.length>0),R=i.useCallback(x=>{w.current=x,typeof o=="function"?o(x):o&&(o.current=x)},[o]);i.useEffect(()=>{if(!I)return;const x=E=>{w.current?.contains(E.target)||_(null)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[I]);const B=i.useRef(null),y=i.useRef(null),g=i.useRef(null),T=I?n.find(x=>x.id===I.itemId):void 0;b.useRovingFocus(B,{orientation:"horizontal",wrap:!0,itemSelector:"[data-nice-nav-id]"}),b.useOverlayFocus(y,{open:I!=null&&!I.byPointer,modal:!1,onClose:()=>_(null)}),b.useRovingFocus(y,{orientation:T&&M(T)?"grid":"vertical",wrap:!0,typeahead:!0}),b.useOverlayFocus(g,{open:I?.submenuId!=null&&!I.byPointer&&!I.subByPointer,modal:!1,onClose:()=>_(x=>x&&{...x,submenuId:null})}),b.useRovingFocus(g,{orientation:"vertical",wrap:!0,typeahead:!0});const A=i.useMemo(()=>n.filter(x=>!x.divider),[n]),N=x=>{const E=!Kn(x),F=M(x),D=E||F,V=I?.itemId===x.id,K=["nice-nav-menu__item",ws(x,s)?"nice-nav-menu__item--active":"",V?"nice-nav-menu__item--open":"",x.disabled?"nice-nav-menu__item--disabled":"",F?"nice-nav-menu__item--mega":""].filter(Boolean).join(" "),ie=ne=>{const ee=ne.nativeEvent.niceSource;D&&(ne.key==="Enter"||ne.key===" "||ne.key==="ArrowDown"&&ee!=="gamepad")&&(ne.preventDefault(),_({itemId:x.id,submenuId:null}))},Z=e.jsxs(e.Fragment,{children:[x.icon!=null&&e.jsx("span",{className:"nice-nav-menu__item-icon","aria-hidden":"true",children:x.icon}),e.jsx("span",{className:"nice-nav-menu__item-label",children:x.label}),x.badge!=null&&e.jsx("span",{className:"nice-nav-menu__item-badge",children:x.badge}),D&&e.jsx("span",{className:"nice-nav-menu__item-chevron","aria-hidden":"true",children:e.jsx(b.NiceIcon,{name:"chevron-down",size:14})})]});return D?e.jsxs("li",{className:`nice-nav-menu__li${F?" nice-nav-menu__li--mega":""}`,onMouseEnter:C?()=>{$(),_(ne=>ne?.itemId===x.id?ne:{itemId:x.id,submenuId:null,byPointer:!0})}:void 0,onMouseLeave:C?S:void 0,children:[e.jsx("button",{type:"button",className:K,"data-nice-nav-id":x.id,"aria-haspopup":F?"true":"menu","aria-expanded":V,"aria-controls":`${k}-panel-${x.id}`,disabled:x.disabled,onClick:()=>{_(C?ne=>ne?.itemId===x.id?null:{itemId:x.id,submenuId:null}:ne=>ne?.itemId===x.id?null:{itemId:x.id,submenuId:null})},onKeyDown:ie,children:Z}),V&&(F?f(x):O(x))]},x.id):x.href&&!x.disabled?e.jsx("li",{className:"nice-nav-menu__li",children:e.jsx("a",{href:x.href,target:x.target,rel:x.rel,className:K,"data-nice-nav-id":x.id,onKeyDown:ie,onClick:ne=>{x.onClick?.(ne),_(null)},children:Z})},x.id):e.jsx("li",{className:"nice-nav-menu__li",children:e.jsx("button",{type:"button",className:K,"data-nice-nav-id":x.id,disabled:x.disabled,onClick:ne=>{x.onClick?.(ne),_(null)},onKeyDown:ie,children:Z})},x.id)},f=x=>{const E=`${k}-panel-${x.id}`,F=typeof x.megaPanel=="function"?x.megaPanel():x.megaPanel;return e.jsx("div",{ref:y,id:E,role:"menu","aria-label":typeof x.label=="string"?x.label:void 0,className:"nice-nav-menu__mega",onMouseEnter:C?$:void 0,onMouseLeave:C?S:void 0,children:e.jsxs("div",{className:"nice-nav-menu__mega-inner",children:[F??e.jsx("div",{className:"nice-nav-menu__mega-grid",children:(x.megaColumns??[]).map((D,V)=>e.jsxs("div",{className:"nice-nav-menu__mega-col",children:[D.title!=null&&e.jsx("div",{className:"nice-nav-menu__mega-col-title",children:D.title}),e.jsx("ul",{className:"nice-nav-menu__mega-col-list",children:D.items.map(W=>e.jsx("li",{className:"nice-nav-menu__mega-col-li",children:W.href?e.jsxs("a",{role:"menuitem",className:"nice-nav-menu__mega-col-item",href:W.href,target:W.target,rel:W.rel,onClick:K=>{W.onClick?.(K),_(null)},children:[W.icon!=null&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-icon","aria-hidden":"true",children:W.icon}),e.jsxs("span",{className:"nice-nav-menu__mega-col-item-text",children:[e.jsx("span",{className:"nice-nav-menu__mega-col-item-label",children:W.label}),W.description&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-desc",children:W.description})]})]}):e.jsxs("button",{type:"button",role:"menuitem",className:"nice-nav-menu__mega-col-item",disabled:W.disabled,onClick:K=>{W.onClick?.(K),_(null)},children:[W.icon!=null&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-icon","aria-hidden":"true",children:W.icon}),e.jsxs("span",{className:"nice-nav-menu__mega-col-item-text",children:[e.jsx("span",{className:"nice-nav-menu__mega-col-item-label",children:W.label}),W.description&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-desc",children:W.description})]})]})},W.id))}),D.footer!=null&&e.jsx("div",{className:"nice-nav-menu__mega-col-footer",children:D.footer})]},V))}),x.megaFooter!=null&&e.jsx("div",{className:"nice-nav-menu__mega-footer",children:x.megaFooter})]})})},O=x=>{const E=x.children??[],F=`${k}-panel-${x.id}`,D=t==="end"?"nice-nav-menu__panel--end":"nice-nav-menu__panel--start";return e.jsx("div",{ref:y,id:F,role:"menu","aria-label":typeof x.label=="string"?x.label:void 0,className:`nice-nav-menu__panel ${D}`,children:e.jsx("ul",{className:"nice-nav-menu__panel-list",children:E.map((V,W)=>L(x.id,V,W))})})},L=(x,E,F)=>{if(E.divider)return e.jsx("li",{className:"nice-nav-menu__panel-divider",role:"separator"},`div-${F}`);const D=!Kn(E),V=I?.itemId===x&&I.submenuId===E.id,W=["nice-nav-menu__panel-item",E.disabled?"nice-nav-menu__panel-item--disabled":"",E.danger?"nice-nav-menu__panel-item--danger":"",V?"nice-nav-menu__panel-item--open":"",E.id===s?"nice-nav-menu__panel-item--active":""].filter(Boolean).join(" "),K=(ee,ce=!1)=>_(J=>J&&J.itemId===x?{...J,submenuId:ee,subByPointer:ce}:{itemId:x,submenuId:ee,subByPointer:ce}),ie=ee=>{ee.key==="ArrowRight"&&D?(ee.preventDefault(),K(E.id)):ee.key==="ArrowLeft"&&(ee.preventDefault(),I?.submenuId?K(null):(_(null),w.current?.querySelector(`[data-nice-nav-id="${x}"]`)?.focus()))},Z=e.jsxs(e.Fragment,{children:[E.icon!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-icon","aria-hidden":"true",children:E.icon}),e.jsxs("span",{className:"nice-nav-menu__panel-item-text",children:[e.jsx("span",{className:"nice-nav-menu__panel-item-label",children:E.label}),E.description&&e.jsx("span",{className:"nice-nav-menu__panel-item-desc",children:E.description})]}),E.badge!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-badge",children:E.badge}),D&&e.jsx("span",{className:"nice-nav-menu__panel-item-chevron","aria-hidden":"true",children:e.jsx(b.NiceIcon,{name:"chevron-right",size:14})})]}),ne=D?e.jsx("button",{type:"button",role:"menuitem",className:W,"data-nice-panel-id":`${x}-${E.id}`,"aria-haspopup":"menu","aria-expanded":V,disabled:E.disabled,onClick:()=>K(V?null:E.id),onMouseEnter:()=>{V||K(E.id,!0)},onKeyDown:ie,children:Z}):E.href&&!E.disabled?e.jsx("a",{role:"menuitem",className:W,"data-nice-panel-id":`${x}-${E.id}`,href:E.href,target:E.target,rel:E.rel,onMouseEnter:()=>I?.submenuId&&K(null,!0),onClick:ee=>{E.onClick?.(ee),_(null)},onKeyDown:ie,children:Z}):e.jsx("button",{type:"button",role:"menuitem",className:W,"data-nice-panel-id":`${x}-${E.id}`,disabled:E.disabled,onMouseEnter:()=>I?.submenuId&&K(null,!0),onClick:ee=>{E.onClick?.(ee),_(null)},onKeyDown:ie,children:Z});return e.jsxs("li",{className:"nice-nav-menu__panel-li",children:[ne,D&&V&&Q(x,E)]},E.id)},Q=(x,E)=>{const F=E.children??[];return e.jsxs("div",{ref:g,role:"menu","aria-label":typeof E.label=="string"?E.label:void 0,className:"nice-nav-menu__subpanel",onKeyDown:D=>{D.key==="ArrowLeft"&&(D.preventDefault(),D.stopPropagation(),_(V=>V&&{...V,submenuId:null}))},children:[e.jsx("ul",{className:"nice-nav-menu__panel-list",children:F.map((D,V)=>{if(D.divider)return e.jsx("li",{className:"nice-nav-menu__panel-divider",role:"separator"},`subdiv-${V}`);const W=["nice-nav-menu__panel-item",D.disabled?"nice-nav-menu__panel-item--disabled":"",D.danger?"nice-nav-menu__panel-item--danger":"",D.id===s?"nice-nav-menu__panel-item--active":""].filter(Boolean).join(" "),K=e.jsxs(e.Fragment,{children:[D.icon!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-icon","aria-hidden":"true",children:D.icon}),e.jsxs("span",{className:"nice-nav-menu__panel-item-text",children:[e.jsx("span",{className:"nice-nav-menu__panel-item-label",children:D.label}),D.description&&e.jsx("span",{className:"nice-nav-menu__panel-item-desc",children:D.description})]}),D.badge!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-badge",children:D.badge})]});return e.jsx("li",{className:"nice-nav-menu__panel-li",children:D.href&&!D.disabled?e.jsx("a",{role:"menuitem",className:W,href:D.href,target:D.target,rel:D.rel,onClick:ie=>{D.onClick?.(ie),_(null)},children:K}):e.jsx("button",{type:"button",role:"menuitem",className:W,disabled:D.disabled,onClick:ie=>{D.onClick?.(ie),_(null)},children:K})},D.id)})}),e.jsx("span",{hidden:!0,"data-parent-id":x})]})};return e.jsx("nav",{ref:R,id:l,className:["nice-nav-menu",`nice-nav-menu--${a}`,r?"nice-nav-menu--stretch":"",v??""].filter(Boolean).join(" "),style:u,"aria-label":c??h("nav.primary","Primary navigation"),"data-testid":m,children:e.jsx("ul",{className:"nice-nav-menu__list",ref:B,children:A.map(N)})})}),{displayName:"NiceNavMenu"}),Gi=[],qi=Object.assign(i.forwardRef(({tabs:n=Gi,activeIndex:s,defaultActiveIndex:a,renderTab:t,onActiveChange:c,onCloseTab:r,onReorderTabs:d,onSaveState:p,enableShortcuts:v=!0,maxTabs:u=0,showDirtyIndicator:l=!0,tabBarPosition:m="top",draggable:o=!0,showAddButton:h=!1,onAddTab:k,keepAlive:I=!0,warnOnUnsavedClose:_=!0,maxClosedTabs:w=10,onUndoCloseTab:z,getTabState:$,unsavedWarningMessage:S,className:C,style:M,id:R,accessMode:B,...y},g)=>{const T=i.useRef(null);b.useRovingFocus(T,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const A=b.useControlId(R),N=b.useNiceAccessMode(B,R),{t:f}=b.useNiceTranslation(),[O,L]=b.useControllableState({value:s,defaultValue:a,fallbackValue:0,onChange:c,componentName:"NiceMdiWorkspace"}),Q=i.useRef(null),[x,E]=i.useState(null),[F,D]=i.useState(null),[V,W]=i.useState([]),[K,ie]=i.useState(null),Z=i.useCallback((H,U,me=!1)=>{if(!me&&_&&H.isDirty){ie({tab:H,index:U});return}const he={tab:{...H},originalIndex:U,closedAt:Date.now(),state:$?.(H)};W(re=>[he,...re].slice(0,w)),r?.(H,U)},[_,w,$,r]),ne=i.useCallback(()=>{if(V.length===0)return;const[H,...U]=V;W(U),z?.(H)},[V,z]);i.useEffect(()=>{if(!v)return;const H=U=>{const me=U.ctrlKey||U.metaKey;if(me&&U.key==="w"){U.preventDefault();const he=n[O];he&&he.closable!==!1&&Z(he,O)}else if(me&&U.key==="Tab"){U.preventDefault();const he=U.shiftKey?-1:1,re=(O+he+n.length)%n.length;L(re)}else me&&U.shiftKey&&(U.key==="t"||U.key==="T")&&(U.preventDefault(),ne())};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[v,n,O,Z,ne,L]),i.useEffect(()=>{if(!p)return;const H=setTimeout(()=>{p({tabs:n,activeTabIndex:O})},500);return()=>clearTimeout(H)},[n,O,p]);const ee=i.useCallback(H=>{o&&D(H)},[o]),ce=i.useCallback((H,U)=>{H.preventDefault()},[F]),J=i.useCallback((H,U)=>{if(H===U||U<0||U>=n.length)return;const me=[...n],[he]=me.splice(H,1);me.splice(U,0,he),d?.(me);let re=O;O===H?re=U:H<O&&U>=O?re--:H>O&&U<=O&&re++,re!==O&&L(re)},[n,O,d,L]),_e=i.useCallback(H=>{F===null||F===H||(J(F,H),D(null))},[F,J]),P=i.useCallback((H,U)=>{H.preventDefault(),E({tabIndex:U,x:H.clientX,y:H.clientY})},[]),te=i.useCallback(()=>E(null),[]),Ne=i.useMemo(()=>{if(!x)return[];const H=n[x.tabIndex];return[{label:f("wm.close","Close"),action:()=>{Z(H,x.tabIndex),te()},disabled:H.closable===!1},{label:f("wm.closeAll","Close all"),action:()=>{n.forEach((U,me)=>U.closable!==!1&&Z(U,me)),te()}},{label:f("wm.closeOthers","Close others"),action:()=>{n.forEach((U,me)=>me!==x.tabIndex&&U.closable!==!1&&Z(U,me)),te()}},{label:f("controls.pin","Pin"),action:()=>te()},...o&&d?[{label:f("wm.moveLeft","Move left"),action:()=>{J(x.tabIndex,x.tabIndex-1),te()},disabled:x.tabIndex===0},{label:f("wm.moveRight","Move right"),action:()=>{J(x.tabIndex,x.tabIndex+1),te()},disabled:x.tabIndex===n.length-1}]:[],{type:"divider"},{label:f("wm.reopenClosed","Reopen closed tab"),action:()=>{ne(),te()},disabled:V.length===0,shortcut:"Ctrl+Shift+T"}]},[x,n,f,Z,ne,V.length,te,o,d,J]);i.useEffect(()=>{if(!x)return;const H=()=>te();return window.addEventListener("click",H),()=>window.removeEventListener("click",H)},[x,te]);const ye=i.useRef(null);b.useOverlayFocus(ye,{open:!!x,modal:!1,onClose:te}),b.useRovingFocus(ye,{orientation:"vertical",wrap:!0});const $e=i.useRef(null);b.useOverlayFocus($e,{open:!!K,modal:!0,onClose:()=>ie(null)});const Ke=i.useCallback(H=>{T.current?.querySelectorAll('[role="tab"]')[H]?.focus()},[]);b.useIntent(["sectionPrev","sectionNext"],H=>{if(n.length<2)return!1;const U=(O+(H.intent==="sectionNext"?1:-1)+n.length)%n.length;L(U),Ke(U)},{ref:Q}),b.useInputHints(Q,[{intent:"sectionPrev",label:f("wm.previousTab","Previous tab")},{intent:"sectionNext",label:f("wm.nextTab","Next tab")}]),b.useInputHints(T,[{intent:"secondary",label:f("wm.tabMenu","Tab menu")}]);const Re=(H,U,me)=>{H.key==="Delete"&&U.closable!==!1&&!U.isPinned&&(H.preventDefault(),Z(U,me))};if(N==="hidden")return null;const ve=e.jsxs("div",{className:`nice-mdi__tab-bar nice-mdi__tab-bar--${m}`,ref:T,role:"tablist",children:[n.map((H,U)=>e.jsxs("div",{className:`nice-mdi__tab ${U===O?"nice-mdi__tab--active":""} ${H.isPinned?"nice-mdi__tab--pinned":""}`,role:"tab","aria-selected":U===O,onClick:()=>L(U),onKeyDown:me=>Re(me,H,U),onContextMenu:me=>P(me,U),draggable:o,onDragStart:()=>ee(U),onDragOver:me=>ce(me,U),onDrop:()=>_e(U),children:[H.icon&&e.jsx("span",{className:"nice-mdi__tab-icon",children:e.jsx(b.NiceIcon,{name:H.icon,size:14})}),e.jsx("span",{className:"nice-mdi__tab-title",children:H.title}),l&&H.isDirty&&e.jsx("span",{className:"nice-mdi__tab-dirty",title:f("wm.unsaved","Unsaved changes"),children:e.jsx(b.NiceIcon,{name:"circle",size:10})}),H.closable!==!1&&!H.isPinned&&e.jsx("button",{className:"nice-mdi__tab-close",onClick:me=>{me.stopPropagation(),Z(H,U)},"aria-label":f("wm.close","Close"),type:"button",children:e.jsx(b.NiceIcon,{name:"close",size:14})})]},H.id)),h&&e.jsx("button",{className:"nice-mdi__tab-add",onClick:k,"aria-label":f("controls.new","New"),type:"button",children:e.jsx(b.NiceIcon,{name:"plus",size:14})})]}),Le=I?e.jsx("div",{className:"nice-mdi__content",children:n.map((H,U)=>e.jsx("div",{className:"nice-mdi__panel",role:"tabpanel",style:{display:U===O?"block":"none"},children:t(H,U)},H.id))}):e.jsx("div",{className:"nice-mdi__content",children:n[O]&&e.jsx("div",{className:"nice-mdi__panel",role:"tabpanel",children:t(n[O],O)})});return e.jsxs("div",{ref:H=>{Q.current=H,typeof g=="function"?g(H):g&&(g.current=H)},id:A,className:`nice-mdi ${C??""}`,style:M,...y,children:[m==="top"&&ve,Le,m==="bottom"&&ve,x&&e.jsx("div",{ref:ye,className:"nice-mdi__ctx-menu",role:"menu","aria-label":f("wm.tabMenu","Tab menu"),style:{position:"fixed",left:x.x,top:x.y,zIndex:9999},children:Ne.map((H,U)=>"type"in H&&H.type==="divider"?e.jsx("div",{className:"nice-mdi__ctx-divider",role:"separator"},U):e.jsxs("button",{className:"nice-mdi__ctx-item",onClick:H.action,disabled:H.disabled,type:"button",role:"menuitem",children:[e.jsx("span",{className:"nice-mdi__ctx-label",children:H.label}),"shortcut"in H&&H.shortcut&&e.jsx("span",{className:"nice-mdi__ctx-shortcut",children:H.shortcut})]},U))}),K&&e.jsx("div",{role:"presentation",className:"nice-mdi__modal-backdrop",onClick:H=>H.target===H.currentTarget&&ie(null),children:e.jsxs("div",{ref:$e,className:"nice-mdi__modal",role:"dialog","aria-modal":"true","aria-labelledby":`${A}-unsaved-title`,children:[e.jsx("div",{className:"nice-mdi__modal-icon",children:e.jsx(b.NiceIcon,{name:"warning",size:32})}),e.jsx("h3",{id:`${A}-unsaved-title`,className:"nice-mdi__modal-title",children:f("wm.unsavedTitle","Unsaved Changes")}),e.jsx("p",{className:"nice-mdi__modal-message",children:S??f("wm.unsavedMessage",'"{title}" has unsaved changes. Do you want to close it anyway?').replace("{title}",K.tab.title)}),e.jsxs("div",{className:"nice-mdi__modal-actions",children:[e.jsx("button",{type:"button",className:"nice-mdi__modal-btn nice-mdi__modal-btn--secondary",onClick:()=>ie(null),"data-autofocus":"",children:f("controls.cancel","Cancel")}),e.jsx("button",{type:"button",className:"nice-mdi__modal-btn nice-mdi__modal-btn--danger",onClick:()=>{Z(K.tab,K.index,!0),ie(null)},children:f("wm.closeAnyway","Close Anyway")})]})]})})]})}),{displayName:"NiceMdiWorkspace"}),Xi=Object.assign(i.forwardRef(({topBar:n,sidePanel:s,sidePanelPosition:a="left",sidePanelWidth:t=280,children:c,hintBar:r="bottom",className:d,style:p,id:v,accessMode:u,...l},m)=>{const o=b.useControlId(v),h=Ue.useShellInput();return b.useNiceAccessMode(u,v)==="hidden"?null:e.jsxs("div",{ref:m,id:o,...h,className:`nice-shell nice-shell--dashboard ${d??""}`,style:p,...l,children:[n&&e.jsx("header",{className:"nice-shell__top-bar",children:n}),e.jsxs("div",{className:`nice-shell__dashboard-body nice-shell__dashboard-body--panel-${a}`,children:[s&&e.jsx("aside",{className:"nice-shell__side-panel",style:{width:t},children:s}),e.jsx("main",{className:"nice-shell__dashboard-content",children:c})]}),e.jsx(Ue.ShellHintBar,{position:r,block:"nice-shell"})]})}),{displayName:"NiceDashboardShell"}),Ji=Object.assign(i.forwardRef(({overlay:n,lockScreen:s,locked:a=!1,children:t,hintBar:c="bottom",tv:r=!1,className:d,style:p,id:v,accessMode:u,...l},m)=>{const o=b.useControlId(v),h=Ue.useShellInput();return b.useNiceAccessMode(u,v)==="hidden"?null:e.jsxs("div",{ref:m,id:o,...h,"data-nice-tv":r?"on":void 0,className:`nice-shell nice-shell--kiosk ${d??""}`,style:{position:"fixed",inset:0,...p},...l,children:[a&&s?e.jsx("div",{className:"nice-shell__kiosk-lock",children:s}):e.jsxs(e.Fragment,{children:[e.jsx("main",{className:"nice-shell__kiosk-content",children:t}),n&&e.jsx("div",{className:"nice-shell__kiosk-overlay",children:n})]}),e.jsx(Ue.ShellHintBar,{position:c,block:"nice-shell"})]})}),{displayName:"NiceKioskShell"}),Qi=Object.assign(i.forwardRef(({menu:n,activeRoute:s,tenant:a,topBarActions:t,globalSearch:c,footer:r,onNavigate:d,children:p,hintBar:v="bottom",className:u,style:l,id:m,accessMode:o,...h},k)=>{const I=b.useControlId(m),_=Ue.useShellInput();return b.useNiceAccessMode(o,m)==="hidden"?null:e.jsxs("div",{ref:k,id:I,..._,className:`nice-shell nice-shell--modern ${u??""}`,style:l,...h,children:[e.jsx("aside",{className:"nice-shell__modern-rail",role:"navigation",children:n?.modules.filter(z=>z.isAvailable).sort((z,$)=>z.order-$.order).map(z=>e.jsx("button",{type:"button",title:z.label,className:"nice-shell__modern-rail-item",onClick:()=>z.entities[0]&&d?.(z.entities[0].route),children:e.jsx("span",{"aria-hidden":!0,children:z.icon??e.jsx(b.NiceIcon,{name:"circle",size:16})})},z.id))}),e.jsxs("div",{className:"nice-shell__modern-main",children:[e.jsxs("header",{className:"nice-shell__modern-topbar",children:[a&&e.jsxs("div",{className:"nice-shell__modern-tenant",style:a.primaryColor?{borderColor:a.primaryColor}:void 0,children:[a.logoUrl&&e.jsx("img",{src:a.logoUrl,alt:""}),e.jsx("span",{children:a.shortName??a.name}),a.plan&&e.jsx("small",{children:a.plan})]}),c&&e.jsx("div",{className:"nice-shell__modern-search",children:c}),t&&e.jsx("div",{className:"nice-shell__modern-actions",children:t})]}),e.jsx("main",{className:"nice-shell__modern-content","data-active-route":s,children:p}),r&&e.jsx("footer",{className:"nice-shell__modern-footer",children:r})]}),e.jsx(Ue.ShellHintBar,{position:v,block:"nice-shell"})]})}),{displayName:"NiceModernShell"}),Zi=Object.assign(i.forwardRef(({header:n,tenant:s,maxWidth:a=960,centered:t=!0,children:c,hintBar:r="bottom",className:d,style:p,id:v,accessMode:u,...l},m)=>{const o=b.useControlId(v),h=Ue.useShellInput();return b.useNiceAccessMode(u,v)==="hidden"?null:e.jsxs("div",{ref:m,id:o,...h,className:`nice-shell nice-shell--minimal ${t?"nice-shell--minimal-centered":""} ${d??""}`,style:p,...l,children:[(n||s)&&e.jsxs("header",{className:"nice-shell__minimal-header",children:[s&&e.jsxs("div",{className:"nice-shell__minimal-tenant",children:[s.logoUrl&&e.jsx("img",{src:s.logoUrl,alt:""}),e.jsx("span",{children:s.name})]}),n]}),e.jsx("main",{className:"nice-shell__minimal-content",style:{maxWidth:a,marginInline:t?"auto":void 0},children:c}),e.jsx(Ue.ShellHintBar,{position:r,block:"nice-shell"})]})}),{displayName:"NiceMinimalShell"}),ea=Object.assign(i.forwardRef(({menu:n,activeRoute:s,tenant:a,toolbar:t,inspector:c,inspectorOpen:r=!0,statusBar:d,onNavigate:p,children:v,hintBar:u="bottom",className:l,style:m,id:o,accessMode:h,...k},I)=>{const{t:_}=b.useNiceTranslation(),w=b.useControlId(o),z=Ue.useShellInput(),$=b.useNiceAccessMode(h,o),[S,C]=i.useState(r);return $==="hidden"?null:e.jsxs("div",{ref:I,id:w,...z,className:`nice-shell nice-shell--hybrid ${l??""}`,style:m,...k,children:[e.jsxs("header",{className:"nice-shell__hybrid-topbar",children:[a&&e.jsxs("div",{className:"nice-shell__hybrid-tenant",children:[a.logoUrl&&e.jsx("img",{src:a.logoUrl,alt:""}),e.jsx("span",{children:a.name})]}),t,c&&e.jsx("button",{type:"button",className:"nice-shell__hybrid-inspector-toggle",onClick:()=>C(M=>!M),"aria-pressed":S,"aria-label":_("shells.toggleInspector","Toggle inspector"),children:e.jsx(b.NiceIcon,{name:"settings",size:16})})]}),e.jsxs("div",{className:"nice-shell__hybrid-body",children:[e.jsx("aside",{className:"nice-shell__hybrid-sidebar",role:"navigation",children:n?.modules.filter(M=>M.isAvailable).sort((M,R)=>M.order-R.order).map(M=>e.jsxs("div",{className:"nice-shell__hybrid-nav-group",children:[e.jsx("div",{className:"nice-shell__hybrid-nav-group-label",children:M.label}),e.jsx("ul",{children:M.entities.map(R=>e.jsx("li",{children:e.jsx("button",{type:"button",className:`nice-shell__hybrid-nav-item ${s===R.route?"nice-shell__hybrid-nav-item--active":""}`,onClick:()=>p?.(R.route),children:R.label})},R.id))})]},M.id))}),e.jsx("main",{className:"nice-shell__hybrid-content",children:v}),c&&S&&e.jsx("aside",{className:"nice-shell__hybrid-inspector",children:c})]}),d&&e.jsx("footer",{className:"nice-shell__hybrid-status",children:d}),e.jsx(Ue.ShellHintBar,{position:u,block:"nice-shell"})]})}),{displayName:"NiceHybridShell"}),na=Object.assign(i.forwardRef(({appTitle:n,tenant:s,topBarActions:a,tabs:t=[],activeTabId:c,onTabChange:r,fab:d,children:p,hintBar:v="bottom",className:u,style:l,id:m,accessMode:o,...h},k)=>{const I=i.useRef(null);b.useRovingFocus(I,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const _=b.useControlId(m),w=Ue.useShellInput();return b.useNiceAccessMode(o,m)==="hidden"?null:e.jsxs("div",{ref:k,id:_,...w,className:`nice-shell nice-shell--pwa ${u??""}`,style:l,...h,children:[e.jsxs("header",{className:"nice-shell__pwa-topbar",children:[e.jsxs("div",{className:"nice-shell__pwa-title",children:[s?.logoUrl&&e.jsx("img",{src:s.logoUrl,alt:""}),e.jsx("span",{children:s?.name??n??""})]}),a&&e.jsx("div",{className:"nice-shell__pwa-actions",children:a})]}),e.jsx("main",{className:"nice-shell__pwa-content",children:p}),d&&e.jsx("div",{className:"nice-shell__pwa-fab",children:d}),t.length>0&&e.jsx("nav",{className:"nice-shell__pwa-tabs",ref:I,role:"tablist",children:t.map($=>e.jsxs("button",{type:"button",role:"tab","aria-selected":c===$.id,className:`nice-shell__pwa-tab ${c===$.id?"nice-shell__pwa-tab--active":""}`,onClick:()=>r?.($.id,$.route),children:[$.icon&&e.jsx("span",{"aria-hidden":!0,children:$.icon}),e.jsx("span",{children:$.label})]},$.id))}),e.jsx(Ue.ShellHintBar,{position:v,block:"nice-shell"})]})}),{displayName:"NicePwaShell"}),sa=[];function un(n,s=16){return typeof n=="string"?e.jsx(b.NiceIcon,{name:n,size:s}):n}const ia=Object.assign(i.forwardRef(({modes:n=sa,activeMode:s,onModeChange:a,variant:t="dropdown",gridColumns:c=3,showDescription:r=!0,showColorIndicator:d=!0,compact:p=!1,size:v="md",className:u,style:l,id:m,accessMode:o,...h},k)=>{const I=b.useControlId(m),_=b.useNiceAccessMode(o,m),{t:w}=b.useNiceTranslation(),[z,$]=i.useState(!1),S=i.useRef(null),C=n.find(f=>f.key===s);i.useEffect(()=>{if(!z)return;const f=O=>{S.current&&!S.current.contains(O.target)&&$(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[z]);const M=i.useCallback(f=>{a?.(f),$(!1)},[a]),R=i.useRef(null),B=i.useCallback(f=>{R.current=f,S.current=f,typeof k=="function"?k(f):k&&(k.current=f)},[k]),{activeIndex:y,setActiveIndex:g,handleKeyDown:T}=Xe.useListKeyboardNav(n,{open:z,onSelect:f=>M(f),onClose:()=>$(!1),onOpen:()=>A()}),A=()=>{g(Math.max(0,n.findIndex(f=>f.key===s))),$(!0)};b.useRovingFocus(R,{orientation:t==="card-grid"?"grid":"both",wrap:!0,activateOnMove:!0,enabled:t!=="dropdown"});const N=`${I}-modes`;return _==="hidden"?null:t==="dropdown"?e.jsxs("div",{ref:B,id:I,className:`nice-mode-selector nice-mode-selector--dropdown nice-mode-selector--${v}${p?" nice-mode-selector--compact":""} ${u??""}`,style:l,...h,children:[e.jsxs("button",{className:"nice-mode-selector__trigger",onClick:()=>z?$(!1):A(),onKeyDown:T,role:"combobox","aria-expanded":z,"aria-haspopup":"listbox","aria-controls":z?N:void 0,"aria-activedescendant":z&&n[y]?`${N}-${y}`:void 0,"aria-label":p?C?.displayName??s:void 0,title:p?C?.displayName??s:void 0,type:"button",children:[d&&C?.color&&e.jsx("span",{className:"nice-mode-selector__color",style:{backgroundColor:C.color}}),C?.icon&&e.jsx("span",{className:"nice-mode-selector__icon",children:un(C.icon)}),!p&&e.jsx("span",{className:"nice-mode-selector__label",children:C?.displayName??s}),e.jsx("span",{className:"nice-mode-selector__chevron",children:e.jsx(b.NiceIcon,{name:z?"chevron-up":"chevron-down",size:"xs"})})]}),z&&e.jsx("ul",{className:"nice-mode-selector__menu",role:"listbox",id:N,children:n.map((f,O)=>e.jsxs("li",{id:`${N}-${O}`,className:`nice-mode-selector__option ${f.key===s?"nice-mode-selector__option--active":""} ${O===y?"nice-mode-selector__option--highlighted":""}`,onMouseEnter:()=>g(O),role:"option","aria-selected":f.key===s,onClick:()=>M(f),children:[d&&f.color&&e.jsx("span",{className:"nice-mode-selector__color",style:{backgroundColor:f.color}}),f.icon&&e.jsx("span",{className:"nice-mode-selector__icon",children:un(f.icon)}),e.jsxs("div",{children:[e.jsx("div",{className:"nice-mode-selector__name",children:f.displayName}),r&&f.description&&e.jsx("div",{className:"nice-mode-selector__desc",children:f.description})]})]},f.key))})]}):t==="pills"?e.jsx("div",{ref:B,id:I,className:`nice-mode-selector nice-mode-selector--pills ${u??""}`,style:l,role:"radiogroup",...h,children:n.map(f=>e.jsxs("button",{className:`nice-mode-selector__pill ${f.key===s?"nice-mode-selector__pill--active":""}`,style:d&&f.color?{borderColor:f.color}:void 0,onClick:()=>M(f),role:"radio","aria-checked":f.key===s,type:"button",children:[f.icon&&e.jsx("span",{children:un(f.icon)}),e.jsx("span",{children:f.displayName})]},f.key))}):e.jsx("div",{ref:B,id:I,className:`nice-mode-selector nice-mode-selector--card-grid ${u??""}`,style:{...l,gridTemplateColumns:`repeat(${c}, 1fr)`},role:"radiogroup",...h,children:n.map(f=>e.jsxs("button",{className:`nice-mode-selector__card ${f.key===s?"nice-mode-selector__card--active":""} ${p?"nice-mode-selector__card--compact":""}`,onClick:()=>M(f),role:"radio","aria-checked":f.key===s,type:"button",children:[d&&f.color&&e.jsx("div",{className:"nice-mode-selector__card-stripe",style:{backgroundColor:f.color}}),f.icon&&e.jsx("div",{className:"nice-mode-selector__card-icon",children:un(f.icon,24)}),e.jsx("div",{className:"nice-mode-selector__card-name",children:f.displayName}),r&&f.description&&!p&&e.jsx("div",{className:"nice-mode-selector__card-desc",children:f.description}),f.sourcePackage&&!p&&e.jsx("div",{className:"nice-mode-selector__card-pkg",children:f.sourcePackage})]},f.key))})}),{displayName:"NiceModeSelector"}),aa=[{key:"Mon",label:"Monday"},{key:"Tue",label:"Tuesday"},{key:"Wed",label:"Wednesday"},{key:"Thu",label:"Thursday"},{key:"Fri",label:"Friday"},{key:"Sat",label:"Saturday"},{key:"Sun",label:"Sunday"}],ta=[{value:"YYYY-MM-DD",label:"YYYY-MM-DD"},{value:"DD/MM/YYYY",label:"DD/MM/YYYY"},{value:"MM/DD/YYYY",label:"MM/DD/YYYY"},{value:"DD.MM.YYYY",label:"DD.MM.YYYY"}],Yn=["basic","contact","address","branding","localization","fiscal","preferences"],Qe=({title:n,expanded:s,onToggle:a})=>e.jsxs("button",{className:`nice-org-form__section-header ${s?"nice-org-form__section-header--expanded":""}`,onClick:a,type:"button","aria-expanded":s,children:[e.jsx("span",{className:"nice-org-form__section-title",children:n}),e.jsx("span",{className:"nice-org-form__section-chevron",children:e.jsx(b.NiceIcon,{name:s?"chevron-down":"chevron-right",size:14})})]}),ca=Object.assign(i.forwardRef(({profile:n,onChange:s,onSave:a,onCancel:t,sections:c,expandedSections:r,showActions:d=!0,countryOptions:p,languageOptions:v,currencyOptions:u,timezoneOptions:l,saving:m=!1,className:o,style:h,id:k,accessMode:I,..._},w)=>{const z=b.useControlId(k),$=b.useNiceAccessMode(I,k),{t:S}=b.useNiceTranslation(),C=i.useMemo(()=>c&&c.length>0?c:Yn,[c]),[M,R]=i.useState(()=>new Set(r??Yn)),B=i.useCallback(N=>{R(f=>{const O=new Set(f);return O.has(N)?O.delete(N):O.add(N),O})},[]),y=$==="readOnly",g=$==="disabled",T=i.useCallback((N,f)=>{s?.({...n,[N]:f})},[n,s]),A=i.useCallback(()=>{a?.(n)},[n,a]);return $==="hidden"?null:e.jsxs("div",{ref:w,id:z,className:`nice-org-form ${o??""}`,style:h,..._,children:[C.includes("basic")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Qe,{title:S("org.basic","Company Information"),expanded:M.has("basic"),onToggle:()=>B("basic")}),M.has("basic")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(Se.NiceTextInput,{label:S("org.name","Company Name"),value:n.name,onChange:N=>T("name",N),required:!0,disabled:g,readOnly:y}),e.jsx(Se.NiceTextInput,{label:S("org.legalName","Legal Name"),value:n.legalName??"",onChange:N=>T("legalName",N),disabled:g,readOnly:y}),e.jsx(Se.NiceTextInput,{label:S("org.taxId","Tax ID"),value:n.taxId??"",onChange:N=>T("taxId",N),disabled:g,readOnly:y}),e.jsx(Se.NiceTextInput,{label:S("org.regNumber","Registration Number"),value:n.registrationNumber??"",onChange:N=>T("registrationNumber",N),disabled:g,readOnly:y}),e.jsx(Se.NiceTextInput,{label:S("org.industry","Industry"),value:n.industry??"",onChange:N=>T("industry",N),disabled:g,readOnly:y}),e.jsx(Se.NiceNumberInput,{label:S("org.employees","Number of Employees"),value:n.employeeCount??null,onChange:N=>T("employeeCount",N??void 0),min:1,disabled:g,readOnly:y})]})]}),C.includes("contact")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Qe,{title:S("org.contact","Contact Details"),expanded:M.has("contact"),onToggle:()=>B("contact")}),M.has("contact")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(Se.NiceTextInput,{label:S("org.email","Email"),value:n.email??"",onChange:N=>T("email",N),type:"email",disabled:g,readOnly:y}),e.jsx(Se.NiceTextInput,{label:S("org.phone","Phone"),value:n.phone??"",onChange:N=>T("phone",N),type:"tel",disabled:g,readOnly:y}),e.jsx(Se.NiceTextInput,{label:S("org.website","Website"),value:n.website??"",onChange:N=>T("website",N),type:"url",disabled:g,readOnly:y}),e.jsx(Se.NiceTextInput,{label:S("org.fax","Fax"),value:n.fax??"",onChange:N=>T("fax",N),type:"tel",disabled:g,readOnly:y})]})]}),C.includes("address")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Qe,{title:S("org.address","Address"),expanded:M.has("address"),onToggle:()=>B("address")}),M.has("address")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(Se.NiceTextInput,{label:S("org.street","Street"),value:n.street??"",onChange:N=>T("street",N),disabled:g,readOnly:y}),e.jsx(Se.NiceTextInput,{label:S("org.city","City"),value:n.city??"",onChange:N=>T("city",N),disabled:g,readOnly:y}),e.jsx(Se.NiceTextInput,{label:S("org.state","State / Province"),value:n.state??"",onChange:N=>T("state",N),disabled:g,readOnly:y}),e.jsx(Se.NiceTextInput,{label:S("org.postalCode","Postal Code"),value:n.postalCode??"",onChange:N=>T("postalCode",N),disabled:g,readOnly:y}),p?e.jsx(en.NiceSelect,{label:S("org.country","Country"),value:n.country??"",onChange:N=>T("country",N),options:p,searchable:!0,disabled:g,readOnly:y}):e.jsx(Se.NiceTextInput,{label:S("org.country","Country"),value:n.country??"",onChange:N=>T("country",N),disabled:g,readOnly:y})]})]}),C.includes("branding")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Qe,{title:S("org.branding","Branding"),expanded:M.has("branding"),onToggle:()=>B("branding")}),M.has("branding")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(Se.NiceTextInput,{label:S("org.logoUrl","Logo URL"),value:n.logoUrl??"",onChange:N=>T("logoUrl",N),type:"url",disabled:g,readOnly:y}),e.jsx(An.NiceColorPicker,{label:S("org.primaryColor","Primary Color"),value:n.primaryColor??"var(--nice-color-primary, #3b82f6)",onChange:N=>T("primaryColor",N),disabled:g,readOnly:y}),e.jsx(An.NiceColorPicker,{label:S("org.secondaryColor","Secondary Color"),value:n.secondaryColor??"var(--nice-color-accent, #8b5cf6)",onChange:N=>T("secondaryColor",N),disabled:g,readOnly:y})]})]}),C.includes("localization")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Qe,{title:S("org.localization","Localization"),expanded:M.has("localization"),onToggle:()=>B("localization")}),M.has("localization")&&e.jsxs("div",{className:"nice-org-form__fields",children:[v?e.jsx(en.NiceSelect,{label:S("org.language","Default Language"),value:n.defaultLanguage??"",onChange:N=>T("defaultLanguage",N),options:v,searchable:!0,disabled:g,readOnly:y}):e.jsx(Se.NiceTextInput,{label:S("org.language","Default Language"),value:n.defaultLanguage??"",onChange:N=>T("defaultLanguage",N),disabled:g,readOnly:y}),u?e.jsx(en.NiceSelect,{label:S("org.currency","Default Currency"),value:n.defaultCurrency??"",onChange:N=>T("defaultCurrency",N),options:u,searchable:!0,disabled:g,readOnly:y}):e.jsx(Se.NiceTextInput,{label:S("org.currency","Default Currency"),value:n.defaultCurrency??"",onChange:N=>T("defaultCurrency",N),disabled:g,readOnly:y}),l?e.jsx(en.NiceSelect,{label:S("org.timezone","Default Timezone"),value:n.defaultTimezone??"",onChange:N=>T("defaultTimezone",N),options:l,searchable:!0,disabled:g,readOnly:y}):e.jsx(Se.NiceTextInput,{label:S("org.timezone","Default Timezone"),value:n.defaultTimezone??"",onChange:N=>T("defaultTimezone",N),disabled:g,readOnly:y}),e.jsx(en.NiceSelect,{label:S("org.dateFormat","Date Format"),value:n.dateFormat??"YYYY-MM-DD",onChange:N=>T("dateFormat",N),options:ta,disabled:g,readOnly:y})]})]}),C.includes("fiscal")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Qe,{title:S("org.fiscal","Fiscal Settings"),expanded:M.has("fiscal"),onToggle:()=>B("fiscal")}),M.has("fiscal")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(Se.NiceTextInput,{label:S("org.fiscalYearStart","Fiscal Year Start"),value:n.fiscalYearStart??"",onChange:N=>T("fiscalYearStart",N),placeholder:S("org.mmDd","MM-DD"),disabled:g,readOnly:y}),e.jsx(Xe.NiceToggle,{label:S("org.vatEnabled","VAT Enabled"),checked:n.vatEnabled??!1,onChange:N=>T("vatEnabled",N),disabled:g||y}),n.vatEnabled&&e.jsx(Se.NiceNumberInput,{label:S("org.defaultVatRate","Default VAT Rate (%)"),value:n.defaultVatRate??null,onChange:N=>T("defaultVatRate",N??void 0),min:0,max:100,step:.5,disabled:g,readOnly:y})]})]}),C.includes("preferences")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Qe,{title:S("org.preferences","Work Preferences"),expanded:M.has("preferences"),onToggle:()=>B("preferences")}),M.has("preferences")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsxs("div",{className:"nice-org-form__field-group",children:[e.jsx("label",{className:"nice-org-form__group-label",children:S("org.workingDays","Working Days")}),e.jsx("div",{className:"nice-org-form__checkboxes",children:aa.map(N=>e.jsx(Se.NiceCheckbox,{label:N.label,checked:(n.workingDays??["Mon","Tue","Wed","Thu","Fri"]).includes(N.key),onChange:f=>{const O=n.workingDays??["Mon","Tue","Wed","Thu","Fri"],L=f?[...O,N.key]:O.filter(Q=>Q!==N.key);T("workingDays",L)},disabled:g||y},N.key))})]}),e.jsx(Se.NiceTextInput,{label:S("org.workStart","Working Hours Start"),value:n.workingHoursStart??"09:00",onChange:N=>T("workingHoursStart",N),placeholder:S("org.hhMm","HH:MM"),disabled:g,readOnly:y}),e.jsx(Se.NiceTextInput,{label:S("org.workEnd","Working Hours End"),value:n.workingHoursEnd??"17:00",onChange:N=>T("workingHoursEnd",N),placeholder:S("org.hhMm","HH:MM"),disabled:g,readOnly:y})]})]}),d&&e.jsxs("div",{className:"nice-org-form__actions",children:[t&&e.jsx(Ze.NiceButton,{variant:"secondary",onClick:t,disabled:m,children:S("cancel","Cancel")}),a&&e.jsx(Ze.NiceButton,{variant:"primary",onClick:A,loading:m,disabled:y||g,children:S("save","Save")})]})]})}),{displayName:"NiceOrganizationProfileForm"}),ra=[],la={available:{color:"var(--nice-text-muted, #6b7280)",icon:"circle"},installed:{color:"var(--nice-color-primary, #3b82f6)",icon:"circle"},active:{color:"var(--nice-color-success, #10b981)",icon:"success"},disabled:{color:"var(--nice-color-warning, #f59e0b)",icon:"minus"},error:{color:"var(--nice-color-error, #ef4444)",icon:"error"},updating:{color:"var(--nice-color-accent, #8b5cf6)",icon:"refresh"}};function oa(n,s){switch(n){case"available":return["install"];case"installed":return["activate",...s?[]:["uninstall"]];case"active":return["deactivate"];case"disabled":return["activate",...s?[]:["uninstall"]];case"error":return["activate",...s?[]:["uninstall"]];case"updating":return[];default:return[]}}const da=({module:n,onAction:s,onClick:a,showDependencies:t,showAuthor:c,showVersion:r,processing:d,disabled:p,readOnly:v,t:u,layout:l})=>{const m=la[n.status],o=oa(n.status,n.isCore);return e.jsxs("div",{className:`nice-module-card nice-module-card--${l} nice-module-card--${n.status}`,onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,onKeyDown:a?h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),a())}:void 0,children:[e.jsxs("div",{className:"nice-module-card__header",children:[e.jsx("span",{className:"nice-module-card__icon",children:e.jsx(b.NiceIcon,{name:n.icon??"box",size:20})}),e.jsxs("div",{className:"nice-module-card__info",children:[e.jsx("div",{className:"nice-module-card__name",children:n.label}),r&&e.jsxs("span",{className:"nice-module-card__version",children:["v",n.version]})]}),e.jsxs("span",{className:"nice-module-card__status",style:{color:m.color},title:n.status,children:[e.jsx(b.NiceIcon,{name:d?"refresh":m.icon,size:14})," ",n.status]})]}),e.jsx("div",{className:"nice-module-card__desc",children:n.description}),e.jsxs("div",{className:"nice-module-card__meta",children:[c&&n.author&&e.jsx("span",{className:"nice-module-card__author",children:n.author}),n.isCore&&e.jsx("span",{className:"nice-module-card__badge nice-module-card__badge--core",children:u("module.core","Core")})]}),t&&n.dependencies&&n.dependencies.length>0&&e.jsxs("div",{className:"nice-module-card__deps",children:[e.jsxs("span",{className:"nice-module-card__deps-label",children:[u("module.deps","Dependencies"),":"]}),n.dependencies.map(h=>e.jsx("span",{className:"nice-module-card__dep-tag",children:h},h))]}),!v&&o.length>0&&e.jsx("div",{className:"nice-module-card__actions",children:o.map(h=>e.jsx(Ze.NiceButton,{size:"sm",variant:h==="uninstall"?"error":h==="activate"?"primary":"secondary",onClick:k=>{k.stopPropagation(),s(h)},disabled:p||d,loading:d,children:u(`module.${h}`,h.charAt(0).toUpperCase()+h.slice(1))},h))})]})},ua=Object.assign(i.forwardRef(({modules:n=ra,onAction:s,statusFilter:a,searchable:t=!0,showDependencies:c=!0,showAuthor:r=!0,showVersion:d=!0,processingModules:p,layout:v="list",gridColumns:u=3,onModuleClick:l,className:m,style:o,id:h,accessMode:k,...I},_)=>{const w=i.useRef(null);b.useRovingFocus(w,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const z=b.useControlId(h),$=b.useNiceAccessMode(k,h),{t:S}=b.useNiceTranslation(),[C,M]=i.useState(""),[R,B]=i.useState("all"),y=$==="readOnly",g=$==="disabled",T=i.useMemo(()=>{let f=n;if(a&&a.length>0&&(f=f.filter(O=>a.includes(O.status))),R!=="all"&&(f=f.filter(O=>O.status===R)),C){const O=C.toLowerCase();f=f.filter(L=>L.label.toLowerCase().includes(O)||L.name.toLowerCase().includes(O)||L.description.toLowerCase().includes(O))}return f},[n,a,R,C]),A=i.useMemo(()=>{const f={all:n.length};for(const O of n)f[O.status]=(f[O.status]??0)+1;return f},[n]),N=i.useCallback((f,O)=>{s?.(f,O)},[s]);return $==="hidden"?null:e.jsxs("div",{ref:_,id:z,className:`nice-module-panel ${m??""}`,style:o,...I,children:[e.jsxs("div",{className:"nice-module-panel__toolbar",children:[t&&e.jsx(Se.NiceTextInput,{value:C,onChange:M,placeholder:S("module.search","Search modules…"),type:"search",clearable:!0,className:"nice-module-panel__search"}),e.jsx("div",{className:"nice-module-panel__filters",ref:w,role:"tablist",children:["all","active","installed","disabled","available","error"].map(f=>e.jsxs("button",{className:`nice-module-panel__filter ${R===f?"nice-module-panel__filter--active":""}`,onClick:()=>B(f),role:"tab","aria-selected":R===f,type:"button",children:[S(`module.status.${f}`,f==="all"?"All":f.charAt(0).toUpperCase()+f.slice(1)),e.jsx("span",{className:"nice-module-panel__filter-count",children:A[f]??0})]},f))})]}),e.jsx("div",{className:`nice-module-panel__grid nice-module-panel__grid--${v}`,style:v==="grid"?{gridTemplateColumns:`repeat(${u}, 1fr)`}:void 0,children:T.length===0?e.jsx("div",{className:"nice-module-panel__empty",children:S("module.empty","No modules found")}):T.map(f=>e.jsx(da,{module:f,onAction:O=>N(f.id,O),onClick:l?()=>l(f):void 0,showDependencies:c,showAuthor:r,showVersion:d,processing:p?.has(f.id)??!1,disabled:g,readOnly:y,t:S,layout:v},f.id))}),e.jsxs("div",{className:"nice-module-panel__summary",children:[S("module.total","Total"),": ",n.length," · ",S("module.status.active","Active"),":"," ",A.active??0," · ",S("module.status.disabled","Disabled"),":"," ",A.disabled??0," · ",S("module.status.error","Error"),":"," ",A.error??0]})]})}),{displayName:"NiceModuleLifecyclePanel"});exports.DEFAULT_SIDEBAR_PREFS=Ln;exports.DesktopContextMenu=ys;exports.DesktopGrid=js;exports.DesktopStartMenu=Ns;exports.DesktopSystemTray=gs;exports.DesktopTaskbar=Cn;exports.LANGUAGES=Un;exports.NICE_THEME_PICKER_PRESETS=gn;exports.NiceAccordion=Ls;exports.NiceAppLayout=wi;exports.NiceAuthButtons=Ui;exports.NiceBreadcrumb=Rs;exports.NiceCard=Wn;exports.NiceCard$1=$s;exports.NiceCardGroupSizeContext=$n;exports.NiceCardRadioContext=In;exports.NiceConsole=Mi;exports.NiceContextMenu=Mn;exports.NiceDashboardLayout=Ci;exports.NiceDashboardShell=Xi;exports.NiceDesktop=$i;exports.NiceDock=Ii;exports.NiceDynamicSidebar=Yi;exports.NiceHybridShell=ea;exports.NiceIconRail=Jn;exports.NiceKioskShell=Ji;exports.NiceLanguagePicker=wn;exports.NiceMdiWorkspace=qi;exports.NiceMenu=qn;exports.NiceMinimalShell=Zi;exports.NiceModeSelector=ia;exports.NiceModernShell=Qi;exports.NiceModuleLifecyclePanel=ua;exports.NiceNavMenu=Wi;exports.NiceNavbar=Fi;exports.NiceOrganizationProfileForm=ca;exports.NicePwaShell=na;exports.NiceSetupWizard=Oi;exports.NiceSidebarNav=ji;exports.NiceSplitter=Bs;exports.NiceStepper=xs;exports.NiceThemePicker=Sn;exports.NiceTooltip=Ae;exports.NiceUserMenu=Cs;exports.NiceWizard=Li;exports.PREFS_CATEGORIES=Dn;exports.SIDEBAR_DEFAULT_FAVORITE_LIST=We;exports.SIDEBAR_MODE_META=rn;exports.activeSidebarFavoriteList=as;exports.buildPrefsCategoryViews=ti;exports.findSidebarItemByRoute=Qs;exports.mapSidebarViews=Zs;exports.sidebarFavoriteItems=mn;exports.sidebarFavoriteLists=is;exports.sidebarFavoriteListsOf=bn;exports.sidebarFavoriteTree=cs;exports.sidebarModeLabel=an;exports.toThemeDescriptor=Vn;exports.useSetupWizard=Ri;exports.useSidebarNavPrefs=us;exports.walkSidebarNav=vn;
|