@nice2dev/ui 1.3.1 → 1.3.2

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 CHANGED
@@ -1,5 +1,57 @@
1
1
  # [1.0.27] — 2026-06-07
2
2
 
3
+ ## 1.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - c8bea88: Sidebar menus nested to any depth, coloured by level and by branch; tabs in the colour of their branch.
8
+
9
+ - `NiceSidebarNav`: views nest through `children` to any depth (`SidebarNavView.children`). The
10
+ deep tree works everywhere:
11
+ - `maxDepth` now defaults to every level (it stopped at 4), and its slider goes to 10 = all;
12
+ - search finds nested views with their whole path and leaves out those under a hidden item;
13
+ - favorites, hiding and icons-only mode work on every level; in icons-only mode the tooltip
14
+ shows the item's path;
15
+ - levels 5+ are indented by `--nice-sidebar-indent-step` (16px);
16
+ - the branches above the active route open once when the route changes, and every branch on
17
+ the way down gets a bold label.
18
+ - A group with its own `route`: clicking its label opens the route and expands the group; the
19
+ arrow only expands or collapses it.
20
+ - Colours — a full row background with readable text, hover and active derived from it:
21
+ - `levelColors` colours the levels of the whole tree: `[0]` the source header, `[1]` the first
22
+ level, and so on; past the end, tints of the last colour;
23
+ - `color` / `levelColors` on a source, module, role, unit or view overrides it for that subtree;
24
+ one `color` gives the deeper levels tints of it (shades in a dark theme, `levelShading`);
25
+ - colours are written as the `--nice-sidebar-level-N-*` vars a theme's `nesting.sidebar` emits,
26
+ so the source header now takes level 1 when it is set;
27
+ - **`SidebarNavDataSource.color` was ignored until now — it colours the source's subtree from
28
+ this release on.**
29
+ - `onNavigate`'s third argument (`SidebarNavNavigateOptions`) carries `color` (the row's colour),
30
+ `branchColor` (the nearest branch with its own colour, e.g. the database a source stands for)
31
+ and `path`, besides `forceNew`.
32
+ - New exports: `walkSidebarNav`, `findSidebarItemByRoute` and `mapSidebarViews`, for walking the
33
+ data at any depth instead of loops over source → module → view.
34
+ - `NiceNavShell`:
35
+ - tabs have `color`, drawn as a 3px bar along the top and a light tint, and kept with the
36
+ persisted tabs;
37
+ - `tabColors` (`'none'` default, `'branch'`, `'level'`) gives tabs opened from the sidebar the
38
+ colour of their branch or row, and `api.openFromSidebar` does the same for a `sidebar` slot of
39
+ your own;
40
+ - tabs opened from the sidebar take the item's label and icon when `routeLabels` / `routeIcons`
41
+ do not name the route;
42
+ - `openRoute(route, { color })` repaints a tab that is already open;
43
+ - `sidebarProps` passes props to the built-in sidebar;
44
+ - home tiles of coloured tabs show the colour.
45
+ - `NiceTopNav`'s mobile drawer passes `onSidebarNavigate`'s third argument on.
46
+ - Sidebar prefs passed as `preferences` no longer get re-applied on mount over what the sidebar
47
+ saved in its first effect.
48
+ - `@nice2dev/ui-core`: `nestingLevelColors()` and `isDerivableColor()` exported — the theme's
49
+ nesting colour derivation, for colouring a subtree with the same rules.
50
+
51
+ - Updated dependencies [c8bea88]
52
+ - @nice2dev/ui-core@1.3.2
53
+ - @nice2dev/i18n@1.3.2
54
+
3
55
  ## 1.3.1
4
56
 
5
57
  ### Patch Changes
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),u=require("@nice2dev/ui-core"),a=require("react"),un=require("react-dom"),Ke=require("./NiceButton-DzCqkG5a.cjs"),Pe=require("./pickerCommons-CUGHOWyc.cjs"),Re=require("./devops-CFytAJQr.cjs"),be=require("./no-code-oQTeAtnW.cjs"),We=require("./NiceSelect-CdUHd8rj.cjs"),yn=require("./NiceColorPicker-BV3olE3M.cjs"),In=[{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"}],mn=({value:n,defaultValue:s,onChange:t,placeholder:c,showSearch:l=!0,searchThreshold:o=8,searchPlaceholder:r,isOpen:p,onOpenChange:x,showFlagInValue:i=!0,showFlagInMenu:d=!0,showTextInValue:h,showTextInMenu:m=!0,showCodeInValue:f,showCodeInMenu:D=!0,displayName:k="native",compact:_=!1,variant:$="default",dropdownAlign:I,disabled:M=!1,languages:j,allowedCodes:w,priorityCodes:y=["en","pl","de","fr","es"],allowClear:V=!1,size:E="md",className:C="",style:z,label:L,helperText:F,error:b,required:v,readOnly:T,loading:W,labelPlacement:ne,errorPlacement:N,labelWidth:g,controlWidth:A,id:P,"data-testid":G="nice-language-picker"})=>{const{t:R}=u.useNiceTranslation(),q=a.useRef(null),ie=a.useRef(null),Z=a.useRef(null),[ee,J]=a.useState(s),[se,fe]=a.useState(!1),X=p??se,B=a.useCallback(K=>{const H=typeof K=="function"?K(X):K;p===void 0&&fe(H),x?.(H)},[X,p,x]),[te,pe]=a.useState(""),_e=h??(!_&&$!=="ghost"),we=f??!1,Ne=_?320:280,ze=Pe.useDropdownAlignment(X,ie,I??(_?"auto":"left"),Ne),ge=n!==void 0?n:ee,ue=j??In,O=a.useMemo(()=>{if(!w||w.length===0)return ue;const K=w.map(Ae=>Ae.toLowerCase()),H=new Set(K),de=new Set(K.map(Ae=>Ae.split("-")[0])),he=ue.filter(Ae=>{const He=Ae.code.toLowerCase();return!!(H.has(He)||!He.includes("-")&&de.has(He))});return process.env.NODE_ENV!=="production"&&he.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(w)}. Tip: pass canonical BCP-47 primary tags (e.g. \`pl\`, not \`pl-PL\`).`),he},[ue,w]),U=a.useMemo(()=>{if(!y?.length)return O;const K=new Set(y),H=O.filter(he=>K.has(he.code)),de=O.filter(he=>!K.has(he.code));return[...H,...de]},[O,y]),ce=a.useMemo(()=>{if(!te)return U;const K=te.toLowerCase();return U.filter(H=>H.nativeName.toLowerCase().includes(K)||H.englishName.toLowerCase().includes(K)||H.code.toLowerCase().includes(K))},[U,te]),ae=a.useMemo(()=>ge?O.find(K=>K.code===ge)??null:null,[ge,O]),Q=l&&O.length>=o;a.useEffect(()=>{if(!X)return;const K=H=>{q.current&&!q.current.contains(H.target)&&(B(!1),pe(""))};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[X,B]);const Se=a.useCallback(K=>{n===void 0&&J(K.code),t?.(K),B(!1),pe("")},[n,t,B]),ve=a.useCallback(()=>{n===void 0&&J(void 0),t?.(null)},[n,t]),Me=a.useCallback(K=>{K.stopPropagation(),ve()},[ve]),ye=V&&!!ae&&!M&&!T,Ie=a.useRef(null),xe=a.useCallback(()=>{B(!1),pe("")},[B]),{activeIndex:$e,setActiveIndex:je,handleKeyDown:Te}=Pe.useListKeyboardNav(ce,{open:X,onSelect:K=>Se(K),onClose:xe,onOpen:()=>!M&&!T&&B(!0),intentRef:Ie}),Le=K=>{if((K.key==="Delete"||K.key==="Backspace")&&ye&&!X){K.preventDefault(),ve();return}Te(K)};u.useOverlayFocus(Ie,{open:X,modal:!1,initialFocus:Q?Z:"none",onClose:xe}),a.useEffect(()=>{je(0)},[te,je]);const De=`${a.useId()}-listbox`,Y=X&&ce[$e]?`${De}-${$e}`:void 0;a.useLayoutEffect(()=>{Y&&document.getElementById(Y)?.scrollIntoView?.({block:"nearest"})},[Y]);const le=K=>k==="english"?K.englishName:K.nativeName;return e.jsxs("div",{ref:q,className:`nice-field nice-field--${E} nice-field--language-picker ${ne==="left"?"nice-field--label-left":""} ${N==="right"?"nice-field--error-right":""} ${b?"nice-field--error":""} ${W?"nice-field--loading":""} nice-country-picker nice-language-picker nice-country-picker--${E} ${_?"nice-country-picker--compact":""} ${$==="ghost"?"nice-country-picker--ghost":""} ${X?"nice-country-picker--open":""} ${M?"nice-country-picker--disabled":""} ${C}`,style:{...z,...g!=null&&{"--nice-field-label-width":typeof g=="number"?`${g}px`:g},...A!=null&&{"--nice-field-control-width":typeof A=="number"?`${A}px`:A}},"data-testid":G,"aria-busy":W||void 0,children:[L&&e.jsxs("label",{className:"nice-field__label",htmlFor:P,children:[L,v&&e.jsx("span",{className:"nice-field__required",children:"*"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("button",{ref:ie,type:"button",className:"nice-country-picker__trigger",onClick:K=>{M||T||(K.stopPropagation(),B(!X))},onKeyDown:Le,disabled:M,id:P,role:"combobox","aria-keyshortcuts":ye?"Delete":void 0,"aria-haspopup":"listbox","aria-expanded":X,"aria-controls":X?De:void 0,"aria-activedescendant":Q?void 0:Y,"aria-invalid":b?!0:void 0,"data-testid":`${G}-trigger`,children:[ae?e.jsxs("span",{className:"nice-country-picker__value",children:[i&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(Pe.FlagIcon,{code:ae.flagCountryCode})}),_e&&e.jsx("span",{className:"nice-country-picker__name",children:le(ae)}),we&&e.jsxs("span",{className:"nice-country-picker__dial-code",children:["(",ae.code,")"]})]}):e.jsx("span",{className:"nice-country-picker__placeholder",children:_?"":c??R("controls.select","Select language")}),e.jsxs("span",{className:"nice-country-picker__icons",children:[ye&&e.jsx("span",{className:"nice-country-picker__clear",onClick:Me,role:"presentation",children:e.jsx(u.NiceIcon,{name:"close",size:14})}),$!=="ghost"&&e.jsx("span",{className:"nice-country-picker__arrow",children:e.jsx(u.NiceIcon,{name:X?"chevron-up":"chevron-down",size:16})})]})]}),X&&e.jsxs("div",{className:`nice-country-picker__dropdown nice-country-picker__dropdown--align-${ze}`,style:_?{minWidth:`${Ne}px`,maxWidth:"calc(100vw - 16px)"}:void 0,role:"listbox",ref:Ie,id:De,"data-testid":`${G}-dropdown`,children:[Q&&e.jsx("div",{className:"nice-country-picker__search",children:e.jsx("input",{ref:Z,type:"text",value:te,onChange:K=>pe(K.target.value),onKeyDown:Te,placeholder:r??R("languagePicker.filter","Filter languages…"),"aria-label":r??R("languagePicker.filter","Filter languages…"),"aria-controls":De,"aria-activedescendant":Y,"aria-autocomplete":"list",className:"nice-country-picker__search-input","data-testid":`${G}-search`})}),e.jsx("div",{className:"nice-country-picker__list",children:ce.length===0?e.jsx("div",{className:"nice-country-picker__empty",children:R("noData","No languages found")}):ce.map((K,H)=>e.jsxs("div",{id:`${De}-${H}`,className:`nice-country-picker__option ${K.code===ge?"nice-country-picker__option--selected":""} ${H===$e?"nice-country-picker__option--highlighted":""}`,onClick:()=>Se(K),onMouseEnter:()=>je(H),role:"option","aria-selected":K.code===ge,"data-testid":`${G}-option-${K.code}`,children:[d&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(Pe.FlagIcon,{code:K.flagCountryCode})}),m&&e.jsx("span",{className:"nice-country-picker__name",children:le(K)}),D&&e.jsx("span",{className:"nice-country-picker__dial-code",children:K.code})]},K.code))})]}),W&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),N==="right"&&b&&e.jsx("div",{className:"nice-field__error",role:"alert",children:b}),N==="right"&&!b&&F&&e.jsx("div",{className:"nice-field__helper",children:F})]}),N!=="right"&&b&&e.jsx("div",{className:"nice-field__error",role:"alert",children:b}),N!=="right"&&!b&&F&&e.jsx("div",{className:"nice-field__helper",children:F})]})};process.env.NODE_ENV!=="production"&&(mn.displayName="NiceLanguagePicker");function $n(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 ln=u.NICE_THEME_PRESETS.map($n),as=(n,s)=>{const t=encodeURIComponent(s.returnUrl);if(s.themeId){const l=n.includes("?")?"&":"?";return`${n}${l}themeId=${encodeURIComponent(s.themeId)}&returnUrl=${t}`}return`${n.replace(/\/+$/,"")}/new?returnUrl=${t}`},is=n=>{typeof window<"u"&&(window.location.href=n)},kn=n=>n.nativeName??n.name,hn=({value:n,defaultValue:s,onChange:t,themes:c,placeholder:l,showSearch:o=!0,searchThreshold:r=8,searchPlaceholder:p,isOpen:x,onOpenChange:i,showPreviewInValue:d=!0,showPreviewInMenu:h=!0,showTextInValue:m,showTextInMenu:f=!0,showIdInValue:D=!1,showIdInMenu:k=!1,compact:_=!1,variant:$="default",dropdownAlign:I,previewSize:M,previewShape:j="page",edit:w,disabled:y=!1,allowClear:V=!1,size:E="md",className:C="",style:z,label:L,helperText:F,error:b,required:v,readOnly:T,loading:W,labelPlacement:ne,errorPlacement:N,labelWidth:g,controlWidth:A,id:P,"data-testid":G="nice-theme-picker"})=>{const{t:R}=u.useNiceTranslation(),q=a.useMemo(()=>!c||c.length===0?(process.env.NODE_ENV!=="production"&&Array.isArray(c)&&console.warn(`[Nice2Dev] <NiceThemePicker> received \`themes={[]}\` (empty array). Falling back to ${ln.length} built-in presets. Omit the \`themes\` prop to silence this warning, or pass at least one descriptor.`),ln):c,[c]),ie=a.useRef(null),Z=a.useRef(null),ee=a.useRef(null),[J,se]=a.useState(s),[fe,X]=a.useState(!1),B=x??fe,te=a.useCallback(H=>{const de=typeof H=="function"?H(B):H;x===void 0&&X(de),i?.(de)},[B,x,i]),[pe,_e]=a.useState(""),we=m??(!_&&$!=="ghost"),Ne=M??(_?24:28),ze=M??32,ge=_?320:280,ue=Pe.useDropdownAlignment(B,Z,I??(_?"auto":"left"),ge),O=n!==void 0?n:J,U=a.useMemo(()=>{if(!pe)return q;const H=pe.toLowerCase();return q.filter(de=>de.id.toLowerCase().includes(H)||de.name.toLowerCase().includes(H)||(de.nativeName?.toLowerCase().includes(H)??!1))},[q,pe]),ce=a.useMemo(()=>O?q.find(H=>H.id===O)??null:null,[O,q]),ae=o&&q.length>=r;a.useEffect(()=>{if(!B)return;const H=de=>{ie.current&&!ie.current.contains(de.target)&&(te(!1),_e(""))};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[B,te]);const Q=a.useRef(!1);a.useEffect(()=>{process.env.NODE_ENV!=="production"&&q.length===0&&!Q.current&&(Q.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)."))},[q]);const Se=a.useCallback(H=>{n===void 0&&se(H.id),t?.(H),te(!1),_e("")},[n,t,te]),ve=a.useCallback(()=>{n===void 0&&se(void 0),t?.(null)},[n,t]),Me=a.useCallback(H=>{H.stopPropagation(),ve()},[ve]),ye=V&&!!ce&&!y&&!T,Ie=a.useCallback(H=>{if(!w?.enabled&&!w?.addNew?.enabled)return;const de=w.returnUrl??(typeof window<"u"?window.location.href:"/"),he=(w.buildUrl??(Ae=>as(w.editorRoute,Ae)))({themeId:H,returnUrl:de});(w.navigate??is)(he),te(!1)},[w,te]),xe=a.useRef(null),$e=a.useCallback(()=>{te(!1),_e("")},[te]),{activeIndex:je,setActiveIndex:Te,handleKeyDown:Le}=Pe.useListKeyboardNav(U,{open:B,onSelect:H=>Se(H),onClose:$e,onOpen:()=>!y&&!T&&te(!0),intentRef:xe}),Be=H=>{if((H.key==="Delete"||H.key==="Backspace")&&ye&&!B){H.preventDefault(),ve();return}Le(H)};u.useOverlayFocus(xe,{open:B,modal:!1,initialFocus:ae?ee:"none",onClose:$e}),a.useEffect(()=>{Te(0)},[pe,Te]);const Y=`${a.useId()}-listbox`,le=B&&U[je]?`${Y}-${je}`:void 0;a.useLayoutEffect(()=>{le&&document.getElementById(le)?.scrollIntoView?.({block:"nearest"})},[le]);const K=H=>!!(w?.enabled&&(!H.readOnly||w?.allowEditBuiltIn));return e.jsxs("div",{ref:ie,className:`nice-field nice-field--${E} nice-field--theme-switcher ${ne==="left"?"nice-field--label-left":""} ${N==="right"?"nice-field--error-right":""} ${b?"nice-field--error":""} ${W?"nice-field--loading":""} nice-country-picker nice-theme-picker nice-country-picker--${E} ${_?"nice-country-picker--compact":""} ${$==="ghost"?"nice-country-picker--ghost":""} ${B?"nice-country-picker--open":""} ${y?"nice-country-picker--disabled":""} ${C}`,style:{...z,...g!=null&&{"--nice-field-label-width":typeof g=="number"?`${g}px`:g},...A!=null&&{"--nice-field-control-width":typeof A=="number"?`${A}px`:A}},"data-testid":G,"aria-busy":W||void 0,children:[L&&e.jsxs("label",{className:"nice-field__label",htmlFor:P,children:[L,v&&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:H=>{y||T||(H.stopPropagation(),te(!B))},onKeyDown:Be,disabled:y,id:P,role:"combobox","aria-keyshortcuts":ye?"Delete":void 0,"aria-haspopup":"listbox","aria-expanded":B,"aria-controls":B?Y:void 0,"aria-activedescendant":ae?void 0:le,"aria-invalid":b?!0:void 0,"data-testid":`${G}-trigger`,children:[ce?e.jsxs("span",{className:"nice-country-picker__value",children:[d&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(Pe.ThemePreviewSwatch,{colors:ce.preview,size:Ne,shape:j})}),we&&e.jsx("span",{className:"nice-country-picker__name",children:kn(ce)}),D&&e.jsxs("span",{className:"nice-country-picker__dial-code",children:["(",ce.id,")"]})]}):e.jsx("span",{className:"nice-country-picker__placeholder",children:_?"":l??R("controls.select","Select theme")}),e.jsxs("span",{className:"nice-country-picker__icons",children:[ye&&e.jsx("span",{className:"nice-country-picker__clear",onClick:Me,role:"presentation",children:e.jsx(u.NiceIcon,{name:"close",size:14})}),$!=="ghost"&&e.jsx("span",{className:"nice-country-picker__arrow",children:e.jsx(u.NiceIcon,{name:B?"chevron-up":"chevron-down",size:16})})]})]}),B&&e.jsxs("div",{className:`nice-country-picker__dropdown nice-country-picker__dropdown--align-${ue}`,style:_?{minWidth:`${ge}px`,maxWidth:"calc(100vw - 16px)"}:void 0,role:"listbox",ref:xe,id:Y,"data-testid":`${G}-dropdown`,children:[ae&&e.jsx("div",{className:"nice-country-picker__search",children:e.jsx("input",{ref:ee,type:"text",value:pe,onChange:H=>_e(H.target.value),onKeyDown:Le,placeholder:p??R("themePicker.filter","Filter themes…"),"aria-label":p??R("themePicker.filter","Filter themes…"),"aria-controls":Y,"aria-activedescendant":le,"aria-autocomplete":"list",className:"nice-country-picker__search-input","data-testid":`${G}-search`})}),w?.addNew?.enabled&&e.jsxs("button",{type:"button",className:"nice-theme-picker__add-btn nice-theme-picker__add-btn--top",onClick:()=>Ie(void 0),"data-testid":`${G}-add`,children:[e.jsx(u.NiceIcon,{name:"plus",size:14})," ",w.addNew.label??w.addLabel??R("themePicker.addTheme","Add theme")]}),e.jsx("div",{className:"nice-country-picker__list",children:U.length===0?e.jsx("div",{className:"nice-country-picker__empty",children:R("noData","No themes found")}):U.map((H,de)=>e.jsxs("div",{id:`${Y}-${de}`,className:`nice-country-picker__option nice-theme-picker__option ${H.id===O?"nice-country-picker__option--selected":""} ${de===je?"nice-country-picker__option--highlighted":""}`,onClick:()=>Se(H),onMouseEnter:()=>Te(de),role:"option","aria-selected":H.id===O,"data-testid":`${G}-option-${H.id}`,children:[h&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(Pe.ThemePreviewSwatch,{colors:H.preview,size:ze,shape:j})}),f&&e.jsx("span",{className:"nice-country-picker__name",children:kn(H)}),k&&e.jsx("span",{className:"nice-country-picker__dial-code",children:H.id}),K(H)&&e.jsx("button",{type:"button",className:"nice-theme-picker__edit-btn",onClick:he=>{he.stopPropagation(),Ie(H.id)},"aria-label":w?.editLabel??R("themePicker.editTheme","Edit theme"),"data-testid":`${G}-edit-${H.id}`,children:e.jsx(u.NiceIcon,{name:"edit",size:12})})]},H.id))}),w?.enabled&&!w.addNew?.enabled&&e.jsxs("button",{type:"button",className:"nice-theme-picker__add-btn",onClick:()=>Ie(void 0),"data-testid":`${G}-add`,children:[e.jsx(u.NiceIcon,{name:"plus",size:14})," ",w.addLabel??R("themePicker.addTheme","Add theme")]})]}),W&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),N==="right"&&b&&e.jsx("div",{className:"nice-field__error",role:"alert",children:b}),N==="right"&&!b&&F&&e.jsx("div",{className:"nice-field__helper",children:F})]}),N!=="right"&&b&&e.jsx("div",{className:"nice-field__error",role:"alert",children:b}),N!=="right"&&!b&&F&&e.jsx("div",{className:"nice-field__helper",children:F})]})};process.env.NODE_ENV!=="production"&&(hn.displayName="NiceThemePicker");const pn=a.createContext(null),bn=a.createContext(null),En=({children:n,title:s,headerExtra:t,footer:c,hoverable:l,bordered:o=!0,onClick:r,selectable:p,selected:x,value:i,onSelect:d,name:h,disabled:m,readOnly:f,loading:D,error:k,size:_,className:$,style:I,displayStyle:M})=>{const j=u.useComponentDisplayStyle("card",M),w=u.useComponentDisplayClass("card",M),y=a.useContext(pn),V=a.useContext(bn),E=_??V??"md",C=a.useMemo(()=>{if(M)return j;const{background:q,border:ie,boxShadow:Z,backdropFilter:ee,WebkitBackdropFilter:J,...se}=j;return se},[j,M]),z=y!=null&&i!=null,L=p||z||d!=null,F=h??(z?y.name:void 0),b=L&&x===void 0&&!z,[v,T]=a.useState(!1),W=z?y.value===i:b?v:!!x,ne=()=>{i!=null&&(d?.(i),z&&y.onChange(i))},N=m||D,g=()=>{N||(L&&!f&&(ne(),b&&T(q=>!q)),r?.())},A=q=>{!N&&L&&!f&&(q.key===" "||q.key==="Enter")&&(q.preventDefault(),g())},P=L||r!=null,G=L?"radio":r?"button":void 0,R=typeof k=="string"?k.length>0:!!k;return e.jsxs("div",{className:"nice-card-field",children:[e.jsxs("div",{className:`nice-card nice-card--${E} nice-card--ds-${w} ${o?"nice-card--bordered":"nice-card--frameless"} ${l?"nice-card--hoverable":""} ${r?"nice-card--clickable":""} ${L?"nice-card--selectable":""} ${W?"nice-card--selected":""} ${m?"nice-card--disabled":""} ${f?"nice-card--readonly":""} ${D?"nice-card--loading":""} ${R?"nice-card--error":""} ${$||""}`,style:{...C,...I},onClick:P?g:void 0,onKeyDown:P?A:void 0,role:G,"aria-checked":L?W:void 0,"aria-disabled":m||void 0,"aria-busy":D||void 0,"data-value":i!=null?String(i):void 0,"data-name":F,tabIndex:P&&!m?0:void 0,children:[(s||t)&&e.jsxs("div",{className:"nice-card__header",children:[s&&e.jsx("h3",{className:"nice-card__title",children:s}),t]}),e.jsx("div",{className:"nice-card__body",children:n}),c&&e.jsx("div",{className:"nice-card__footer",children:c}),D&&e.jsx("span",{className:"nice-card__spinner","aria-hidden":"true",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})})]}),typeof k=="string"&&k&&e.jsx("div",{className:"nice-card__error",role:"alert",children:k})]})},ts=Object.freeze(Object.defineProperty({__proto__:null,NiceCard:En,NiceCardGroupSizeContext:bn,NiceCardRadioContext:pn},Symbol.toStringTag,{value:"Module"}));function cs(n,s,t){const l=window.innerWidth,o=window.innerHeight,r={top:n.top,bottom:o-n.bottom,left:n.left,right:l-n.right},p={top:t+6,bottom:t+6,left:s+6,right:s+6},x=["top","bottom","right","left"],i=x.filter(h=>r[h]>=p[h]),d=i.length?i:x;return d.reduce((h,m)=>r[m]>r[h]?m:h,d[0])}function ls(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 Ce=({content:n,position:s="auto",size:t="md",followCursor:c,children:l})=>{const[o,r]=a.useState(!1),[p,x]=a.useState({x:0,y:0}),[i,d]=a.useState(null),[h,m]=a.useState("top"),f=a.useId(),D=a.useRef(null),k=a.useRef(null),_=s==="auto"?h:s,$=a.useCallback(w=>{c&&x({x:w.clientX,y:w.clientY})},[c]);a.useLayoutEffect(()=>{if(!o||c)return;const w=()=>{const y=D.current;if(!y)return;const V=y.firstElementChild??y;d(V.getBoundingClientRect())};return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[o,c]),a.useLayoutEffect(()=>{if(s!=="auto"||!o||c||!i||!k.current)return;const w=k.current.getBoundingClientRect(),y=cs(i,w.width,w.height);m(V=>V===y?V:y)},[s,o,c,i,n,t]);const I=a.cloneElement(l,{"aria-describedby":o?f:void 0}),M=o?(()=>{let w;if(c)w={position:"fixed",left:p.x+12,top:p.y+12};else if(i){const y=ls(i,_);w={position:"fixed",left:y.left,top:y.top,transform:y.transform}}else w={position:"fixed",left:-9999,top:-9999};return e.jsx("span",{ref:k,id:f,className:`nice-tooltip nice-tooltip--${_} nice-tooltip--${t} nice-tooltip--portaled`,role:"tooltip",style:w,children:n})})():null,j=typeof document<"u"?document.body:null;return e.jsxs("span",{ref:D,className:"nice-tooltip-wrapper",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onMouseMove:$,onFocus:()=>r(!0),onBlur:()=>r(!1),children:[I,M!=null&&j!=null?un.createPortal(M,j):M]})};process.env.NODE_ENV!=="production"&&(Ce.displayName="NiceTooltip");const rs=[],os=({items:n=rs,multiple:s=!1,defaultOpen:t=[],size:c="md",width:l,maxWidth:o,animationDuration:r=220,className:p,style:x,displayStyle:i})=>{u.useComponentDisplayClass("card",i);const d=u.normalizeSize(c,"NiceAccordion"),[h,m]=a.useState(new Set(t)),f=a.useId(),D=a.useCallback(I=>{m(M=>{const j=new Set(M);return j.has(I)?j.delete(I):(s||j.clear(),j.add(I)),j})},[s]),k=a.useRef(null),_=I=>{const M=[...k.current?.querySelectorAll(":scope > .nice-accordion__item > .nice-accordion__trigger:not(:disabled)")??[]],j=M.indexOf(I.currentTarget),w=I.key==="ArrowDown"?j+1:I.key==="ArrowUp"?j-1:I.key==="Home"?0:I.key==="End"?M.length-1:-1,y=j>=0&&w>=0?M[w]:void 0;y&&y!==I.currentTarget&&(I.preventDefault(),y.focus())},$={...x,...l!==void 0?{width:typeof l=="number"?`${l}px`:l}:{},...o!==void 0?{maxWidth:typeof o=="number"?`${o}px`:o}:{},"--nice-accordion-anim":`${Math.max(0,r)}ms`};return e.jsx("div",{ref:k,className:`nice-accordion nice-accordion--${d} ${p||""}`,style:$,children:n.map((I,M)=>{const j=h.has(I.id),w=`${f}-trigger-${M}`,y=`${f}-panel-${M}`;return e.jsxs("div",{className:"nice-accordion__item",children:[e.jsxs("button",{type:"button",id:w,className:"nice-accordion__trigger",onClick:()=>!I.disabled&&D(I.id),onKeyDown:_,"aria-expanded":j,"aria-controls":j?y:void 0,"aria-disabled":I.disabled,disabled:I.disabled,children:[e.jsx("span",{children:I.title}),e.jsx(u.NiceIcon,{name:"chevron-down",size:16,className:`nice-accordion__chevron ${j?"nice-accordion__chevron--open":""}`})]}),j&&e.jsx("div",{id:y,className:"nice-accordion__content",role:"region","aria-labelledby":w,children:I.content})]},I.id)})})},ds=[],us=({items:n=ds,separator:s="/",size:t="md",className:c,style:l})=>{const{t:o}=u.useNiceTranslation();return e.jsx("nav",{className:`nice-breadcrumb nice-breadcrumb--${t} ${c||""}`,style:l,"aria-label":o("breadcrumb.breadcrumb","Breadcrumb"),children:n.map((r,p)=>e.jsxs(a.Fragment,{children:[p>0&&e.jsx("span",{className:"nice-breadcrumb__separator","aria-hidden":"true",children:s}),p===n.length-1?e.jsx("span",{className:"nice-breadcrumb__current","aria-current":"page",children:r.label}):e.jsx("span",{className:"nice-breadcrumb__item",children:r.href!==void 0?e.jsx("a",{className:"nice-breadcrumb__link",href:r.href,onClick:x=>{r.onClick&&(x.preventDefault(),r.onClick())},children:r.label}):r.onClick?e.jsx("button",{type:"button",className:"nice-breadcrumb__link nice-breadcrumb__link--button",onClick:r.onClick,children:r.label}):r.label})]},p))})},ms=[];function Ge(n){return(n.id??n.key??"")+""}function zn(n){return n.label??n.text??""}function tn(n){return n.children??n.items}function rn(n){const s=tn(n);return!s||s.length===0}function _n(n,s){if(!s)return!1;if(Ge(n)===s)return!0;const t=tn(n);return t?t.some(c=>_n(c,s)):!1}const Mn=({items:n=ms,orientation:s="horizontal",variant:t="ghost",density:c="normal",size:l="md",loading:o=!1,fullWidth:r=!1,showDividers:p=!1,panelAlign:x="start",panelMinWidth:i=200,panelMaxWidth:d=360,itemGap:h,paddingX:m,paddingY:f,portal:D=!0,panelZIndex:k=1100,arrowIcon:_=e.jsx(u.NiceIcon,{name:"chevron-down",size:14}),flyoutArrowIcon:$=e.jsx(u.NiceIcon,{name:"chevron-right",size:14}),closeOnSelect:I=!0,openTrigger:M="click",openDelay:j=120,closeDelay:w=180,onOpenChange:y,activeId:V,activeKey:E,onItemClick:C,ariaLabel:z,renderTriggerLabel:L,renderEntryLabel:F,maxDepth:b=3,className:v,style:T,id:W,accessMode:ne,displayStyle:N})=>{const{t:g}=u.useNiceTranslation(),A=z??g("menu.menu","Menu"),P=u.useComponentDisplayClass("menu",N),G=u.useComponentDisplayStyle("menu",N),q=a.useContext(u.NiceThemeContext)?.portalTarget??(typeof document<"u"?document.body:null),ie=u.useNiceAccessMode(ne,W),Z=ie==="hidden",ee=ie==="disabled"||ie==="readOnly"||o,J=a.useId(),se=V??E,fe=Math.min(10,Math.max(1,b)),[X,B]=a.useState(null),[te,pe]=a.useState([]),_e=a.useRef(null),we=a.useRef(null);a.useEffect(()=>{y?.(X)},[X,y]);const Ne=a.useCallback(()=>{_e.current!=null&&(window.clearTimeout(_e.current),_e.current=null),we.current!=null&&(window.clearTimeout(we.current),we.current=null)},[]);a.useEffect(()=>()=>Ne(),[Ne]);const ze=a.useCallback(Y=>{Ne(),X!==Y&&(_e.current=window.setTimeout(()=>{B(Y),pe([])},Math.max(0,j)))},[Ne,X,j]),ge=a.useCallback(()=>{Ne(),we.current=window.setTimeout(()=>{B(null),pe([])},Math.max(0,w))},[Ne,w]),[ue,O]=a.useState(-1),[U,ce]=a.useState(-1),[ae,Q]=a.useState(null),Se=a.useRef(null),ve=a.useRef(null),Me=a.useRef(new Map),ye=a.useCallback(()=>{if(!X){Q(null);return}const Y=Me.current.get(X);if(!Y)return;const le=Y.getBoundingClientRect();if(s==="vertical")Q({left:le.right,top:le.top,width:le.width});else{const K=ve.current?.offsetWidth??Math.max(i,le.width);let H=le.left;x==="end"?H=le.right-K:x==="center"&&(H=le.left+le.width/2-K/2),Q({left:H,top:le.bottom,width:le.width})}},[X,s,x,i]);a.useLayoutEffect(()=>{if(D&&(ye(),X&&(x==="end"||x==="center"))){const Y=requestAnimationFrame(ye);return()=>cancelAnimationFrame(Y)}},[D,ye,X,x]),a.useEffect(()=>{if(!D||!X)return;const Y=()=>ye();return window.addEventListener("scroll",Y,!0),window.addEventListener("resize",Y),()=>{window.removeEventListener("scroll",Y,!0),window.removeEventListener("resize",Y)}},[D,X,ye]);const Ie=a.useMemo(()=>n.filter(Y=>Ge(Y).length>0),[n]),xe=a.useCallback(()=>{B(null),pe([]),ce(-1)},[]);a.useEffect(()=>{if(!X)return;const Y=K=>{const H=K.target;Se.current&&Se.current.contains(H)||ve.current&&ve.current.contains(H)||xe()},le=K=>{K.key==="Escape"&&xe()};return document.addEventListener("mousedown",Y),document.addEventListener("keydown",le),()=>{document.removeEventListener("mousedown",Y),document.removeEventListener("keydown",le)}},[X,xe]);const $e=(Y,le)=>{if(Y.disabled||ee)return;const K=Ge(Y);if(rn(Y)){Y.onClick?.(le),C?.(Y,le),I&&xe();return}pe([]),B(X===K?null:K),ce(-1)},je=a.useCallback((Y,le)=>{pe(K=>{const H=Y-2;if(H<0)return K;if(K[H]===le)return K.slice(0,H);const he=K.slice(0,H);return he[H]=le,he})},[]),Te=(Y,le)=>{Y.disabled||(Y.onClick?.(le),C?.(Y,le),I&&xe())},Le=Y=>{if(ee)return;const le=s==="horizontal",K=le?"ArrowLeft":"ArrowUp",H=le?"ArrowRight":"ArrowDown";if(Y.key===K)Y.preventDefault(),O(de=>de<=0?Ie.length-1:de-1);else if(Y.key===H)Y.preventDefault(),O(de=>de>=Ie.length-1?0:de+1);else if(Y.key==="Home")Y.preventDefault(),O(0);else if(Y.key==="End")Y.preventDefault(),O(Ie.length-1);else if(Y.key==="Enter"||Y.key===" "){Y.preventDefault();const de=Ie[ue];de&&$e(de,Y)}else Y.key==="Escape"&&xe()};if(Z)return null;const Be=["nice-menu",`nice-menu--orientation-${s}`,`nice-menu--variant-${t}`,`nice-menu--density-${c}`,`nice-menu--size-${l}`,r?"nice-menu--full-width":"",p?"nice-menu--show-dividers":"",o?"nice-menu--loading":"",P??"",v??""].filter(Boolean).join(" "),De={...G,...T,"--nice-menu-panel-min-w":`${i}px`,"--nice-menu-panel-max-w":`${d}px`};return h!==void 0&&(De["--nice-menu-gap"]=typeof h=="number"?`${h}px`:h),m!==void 0&&(De["--nice-menu-padding-x"]=typeof m=="number"?`${m}px`:m),f!==void 0&&(De["--nice-menu-padding-y"]=typeof f=="number"?`${f}px`:f),e.jsxs("nav",{id:W,ref:Se,className:Be,style:De,"aria-label":A,"aria-busy":o||void 0,children:[o&&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:Le,tabIndex:0,children:Ie.map((Y,le)=>{const K=Ge(Y),H=X===K,de=!!se&&_n(Y,se),he=!rn(Y),Ae=["nice-menu__item",H?"nice-menu__item--open":"",de?"nice-menu__item--active":"",Y.disabled?"nice-menu__item--disabled":"",Y.danger?"nice-menu__item--danger":"",he?"nice-menu__item--has-children":"",ue===le?"nice-menu__item--focused":""].filter(Boolean).join(" "),He=L?L(Y):zn(Y),Ze=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:He}),Y.badge!=null?e.jsx("span",{className:"nice-menu__badge",children:Y.badge}):null,he?e.jsx("span",{className:"nice-menu__arrow","aria-hidden":!0,children:_}):null]});return e.jsxs("li",{className:Ae,role:"none","data-nice-menu-id":K,"data-nice-depth":1,onMouseEnter:he&&(M==="hover"||M==="both")?()=>ze(K):void 0,onMouseLeave:he&&(M==="hover"||M==="both")?()=>ge():void 0,children:[Y.href&&!he?e.jsx("a",{ref:Ee=>{Ee?Me.current.set(K,Ee):Me.current.delete(K)},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:ue===le?0:-1,onClick:Ee=>$e(Y,Ee),onFocus:()=>O(le),children:Ze}):e.jsx("button",{ref:Ee=>{Ee?Me.current.set(K,Ee):Me.current.delete(K)},type:"button",className:"nice-menu__btn",disabled:Y.disabled||ee,role:"menuitem","aria-haspopup":he||void 0,"aria-expanded":he?H:void 0,"aria-controls":he?`${J}-panel-${K}`:void 0,"aria-label":Y.ariaLabel,tabIndex:ue===le?0:-1,onClick:Ee=>$e(Y,Ee),onFocus:()=>O(le),children:Ze}),he&&H?(()=>{const Ee=D&&typeof document<"u"&&!!ae&&!!q,en=Ee?{position:"fixed",left:ae.left,top:ae.top,minWidth:Math.max(i,ae.width),maxWidth:d,zIndex:k}:{zIndex:k},Ve=e.jsx(Dn,{items:tn(Y)??[],depth:2,maxDepth:fe,openPath:te,onToggleBranch:je,onLeafClick:Te,effectiveActiveId:se,renderEntryLabel:F,flyoutArrowIcon:$,openTrigger:M,onPanelEnter:()=>Ne(),onPanelLeave:()=>ge(),panelClassName:["nice-menu__panel",`nice-menu__panel--align-${x}`,Ee?"nice-menu__panel--portal":""].filter(Boolean).join(" "),panelStyle:en,panelId:`${J}-panel-${K}`,panelRef:Ee?ve:void 0,focusedEntryIdx:U,setFocusedEntryIdx:ce});return Ee?un.createPortal(Ve,q):Ve})():null]},K)})})]})};process.env.NODE_ENV!=="production"&&(Mn.displayName="NiceMenu");function Dn({items:n,depth:s,maxDepth:t,openPath:c,onToggleBranch:l,onLeafClick:o,effectiveActiveId:r,renderEntryLabel:p,flyoutArrowIcon:x,openTrigger:i,onPanelEnter:d,onPanelLeave:h,panelClassName:m,panelStyle:f,panelId:D,panelRef:k,focusedEntryIdx:_,setFocusedEntryIdx:$}){const I=Math.min(Math.max(s,1),10),M=s===2,j=m??(M?"nice-menu__panel":"nice-menu__subpanel"),y={...{"--nice-row-bg":`var(--nice-menu-level-${I}-bg, var(--nice-bg-elevated, var(--nice-bg-primary)))`,"--nice-row-text":`var(--nice-menu-level-${I}-text, var(--nice-text-primary))`,"--nice-row-border":`var(--nice-menu-level-${I}-border, var(--nice-border-color))`,"--nice-row-hover-bg":`var(--nice-menu-level-${I}-hover-bg, var(--nice-hover-bg))`,"--nice-row-active-bg":`var(--nice-menu-level-${I}-active-bg, var(--nice-selected-bg))`},...f??{}},V=i==="hover"||i==="both"?{onMouseEnter:d,onMouseLeave:h}:{};return e.jsx("div",{ref:k,id:D,className:j,style:y,role:"menu","data-nice-depth":s,...V,children:n.map((E,C)=>{if(E.divider)return e.jsx("hr",{className:"nice-menu__divider"},`d-${C}`);const z=Ge(E),F=!rn(E)&&s<t,b=c[s-2]===z,v=!!r&&_n(E,r),T=["nice-menu__entry",E.disabled?"nice-menu__entry--disabled":"",E.danger?"nice-menu__entry--danger":"",v?"nice-menu__entry--active":"",M&&_===C?"nice-menu__entry--focused":""].filter(Boolean).join(" "),W=e.jsxs(e.Fragment,{children:[E.icon?e.jsx("span",{className:"nice-menu__icon",children:E.icon}):null,e.jsxs("span",{className:"nice-menu__entry-content",children:[e.jsxs("span",{className:"nice-menu__entry-label",children:[p?p(E):zn(E),E.badge!=null?e.jsx("span",{className:"nice-menu__badge",children:E.badge}):null]}),E.description?e.jsx("span",{className:"nice-menu__entry-desc",children:E.description}):null]}),F?e.jsx("span",{className:"nice-menu__entry-arrow","aria-hidden":!0,children:x}):null]}),ne=g=>{F?l(s,z):o(E,g)},N=M?()=>$?.(C):void 0;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:F?()=>l(s,z):void 0,children:[E.href&&!F?e.jsx("a",{className:T,href:E.href,target:E.target,rel:E.rel,role:"menuitem","aria-disabled":E.disabled||void 0,"aria-label":E.ariaLabel,onClick:ne,onFocus:N,children:W}):e.jsx("button",{type:"button",className:T,disabled:E.disabled,role:"menuitem","aria-haspopup":F||void 0,"aria-expanded":F?b:void 0,"aria-label":E.ariaLabel,onClick:ne,onFocus:N,children:W}),F&&b?e.jsx(Dn,{items:tn(E)??[],depth:s+1,maxDepth:t,openPath:c,onToggleBranch:l,onLeafClick:o,effectiveActiveId:r,renderEntryLabel:p,flyoutArrowIcon:x,openTrigger:i}):null]},z||`c-${C}`)})})}const hs=[],fn=({items:n=hs,target:s,onItemClick:t,size:c="md",className:l,style:o})=>{const[r,p]=a.useState(null),x=a.useRef(null);return u.useClickOutside(x,()=>p(null)),u.useOverlayFocus(x,{open:r!=null,modal:!1,onClose:()=>p(null)}),u.useRovingFocus(x,{orientation:"vertical",wrap:!0,typeahead:!0}),a.useEffect(()=>{const i=s.current;if(!i)return;const d=h=>{if(h.preventDefault(),h.clientX===0&&h.clientY===0&&h.target instanceof Element){const m=h.target.getBoundingClientRect();p({x:m.left,y:m.bottom})}else p({x:h.clientX,y:h.clientY})};return i.addEventListener("contextmenu",d),()=>i.removeEventListener("contextmenu",d)},[s]),r?e.jsx("div",{ref:x,className:`nice-contextmenu nice-contextmenu--${c} ${l||""}`,style:{position:"fixed",left:r.x,top:r.y,zIndex:1e4,...o},children:e.jsx("ul",{className:"nice-contextmenu__list",role:"menu",children:n.map((i,d)=>e.jsx("li",{className:`nice-contextmenu__item ${i.disabled?"nice-contextmenu__item--disabled":""}`,role:"none",children:e.jsxs("button",{type:"button",className:"nice-contextmenu__btn",disabled:i.disabled,"aria-disabled":i.disabled,role:"menuitem",onClick:h=>{i.onClick?.(h),t?.(i),p(null)},children:[i.icon&&e.jsx("span",{className:"nice-contextmenu__icon","aria-hidden":"true",children:i.icon}),e.jsx("span",{children:i.label??i.text??""})]})},i.id??i.key??d))})}):null},ps=[];function bs(n,s){if(n==null)return null;if(typeof n=="number")return n/s*100;const t=n.trim();if(t.endsWith("%"))return parseFloat(t);const c=parseFloat(t);return Number.isFinite(c)?c/s*100:null}function _s(n,s){const t=n.length||1;let c=n.map(m=>bs(m.size,s));const l=c.reduce((m,f)=>m+(f??0),0),o=c.filter(m=>m==null).length,r=Math.max(0,100-l);c=c.map(m=>m??(o?r/o:100/t));let p=n.map(m=>m.collapsible?0:m.minSize?m.minSize/s*100:0);const x=p.reduce((m,f)=>m+f,0);if(x>100){const m=100/x;p=p.map(f=>f*m)}const i=n.map(m=>m.maxSize?m.maxSize/s*100:100),d=c.map((m,f)=>Math.min(i[f],Math.max(p[f],m??0))),h=d.reduce((m,f)=>m+f,0)||1;return d.map(m=>m/h*100)}const fs=({panes:n=ps,orientation:s="horizontal",gutterSize:t=6,onResize:c,className:l,style:o,accessMode:r,id:p})=>{const i=u.useNiceAccessMode(r,p)==="hidden",d=a.useRef(null),[h,m]=a.useState(()=>n.map(()=>100/n.length)),f=a.useRef("");a.useLayoutEffect(()=>{const _=d.current;if(!_)return;const $=s==="horizontal"?_.offsetWidth:_.offsetHeight;if(!$)return;const I=`${s}:${n.map(M=>M.key).join("|")}`;f.current!==I&&(f.current=I,m(_s(n,$)))},[n,s]);const D=a.useCallback((_,$)=>{$.preventDefault();const I=d.current;if(!I)return;const M=$.currentTarget;try{M.setPointerCapture?.($.pointerId)}catch{}const j=s==="horizontal",w=j?I.offsetWidth:I.offsetHeight,y=j?$.clientX:$.clientY,V=[...h],E=document.body.style.userSelect;document.body.style.userSelect="none";const C=n.map(T=>T.collapsible?0:T.minSize?T.minSize/w*100:5),z=C.reduce((T,W)=>T+W,0),L=z>100?100/z:1,F=n.map(T=>T.maxSize?T.maxSize/w*100:100),b=T=>{const W=((j?T.clientX:T.clientY)-y)/w*100,ne=[...V],N=V[_]+V[_+1],g=C[_]*L,A=C[_+1]*L,P=F[_],G=F[_+1];let R=V[_]+W,q=V[_+1]-W;R<g&&(R=g,q=N-g),q<A&&(q=A,R=N-A),R>P&&(R=P,q=N-P),q>G&&(q=G,R=N-G),ne[_]=R,ne[_+1]=q,m(ne),c?.(ne)},v=()=>{try{M.releasePointerCapture?.($.pointerId)}catch{}document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",v),document.removeEventListener("pointercancel",v),document.body.style.userSelect=E};document.addEventListener("pointermove",b),document.addEventListener("pointerup",v),document.addEventListener("pointercancel",v)},[h,s,n,c]),k=s==="horizontal";return i?null:e.jsx("div",{ref:d,className:`nice-splitter nice-splitter--${s} ${l||""}`,style:{display:"flex",flexDirection:k?"row":"column",height:"100%",...o},children:n.map((_,$)=>{const I=`calc(${h[$]}% - ${t*(n.length-1)/n.length}px)`;return e.jsxs(a.Fragment,{children:[e.jsx("div",{className:"nice-splitter__pane",style:{"--nice-splitter-pane-size":I,[k?"width":"height"]:I,overflow:"auto"},children:_.render()}),$<n.length-1&&e.jsx("div",{className:`nice-splitter__gutter nice-splitter__gutter--${s}`,role:"separator","aria-orientation":k?"vertical":"horizontal",style:{[k?"width":"height"]:t,cursor:k?"col-resize":"row-resize",flexShrink:0,touchAction:"none"},onPointerDown:M=>D($,M),children:e.jsx("span",{className:"nice-splitter__grip","aria-hidden":"true"})})]},_.key)})})},vs=[],Rn=({steps:n=vs,activeStep:s,orientation:t="horizontal",onStepClick:c,allowStepClick:l=!1,showStepNumbers:o=!0,className:r,style:p})=>{const{t:x}=u.useNiceTranslation();return e.jsxs("div",{className:`nice-stepper nice-stepper--${t} ${r||""}`,style:p,children:[e.jsx("div",{className:"nice-stepper__header",children:n.map((i,d)=>{const h=d<s,m=d===s,f=h?"nice-stepper__step--completed":m?"nice-stepper__step--active":"";return e.jsxs(a.Fragment,{children:[d>0&&e.jsx("div",{className:`nice-stepper__connector ${h?"nice-stepper__connector--completed":""}`}),e.jsxs("div",{className:`nice-stepper__step ${f}`,"aria-current":m?"step":void 0,...l&&{role:"button",tabIndex:0,onClick:()=>c?.(d),onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),c?.(d))}},style:{cursor:l?"pointer":void 0},children:[e.jsx("div",{className:"nice-stepper__indicator",children:i.icon?i.icon:h?e.jsx(u.NiceIcon,{name:"check",size:14}):o?d+1:""}),e.jsxs("div",{className:"nice-stepper__labels",children:[e.jsx("div",{className:"nice-stepper__title",children:i.title}),i.subtitle&&e.jsx("div",{className:"nice-stepper__subtitle",children:i.subtitle}),i.optional&&e.jsx("div",{className:"nice-stepper__optional",children:x("optional","Optional")})]})]})]},d)})}),n[s]?.content&&e.jsx("div",{className:"nice-stepper__content",children:n[s].content})]})},xs=[],Ns=Object.assign(a.forwardRef(({panels:n=xs,columns:s=12,rowHeight:t=80,gap:c=8,draggable:l=!0,resizable:o=!0,onLayoutChange:r,className:p,style:x,id:i},d)=>{const h=u.useControlId(i),[m,f]=a.useState(null),[D,k]=a.useState(null),_=a.useRef(null),$=a.useCallback((E,C)=>{l&&(f(C),E.dataTransfer.effectAllowed="move")},[l]),I=a.useCallback((E,C)=>{if(E.preventDefault(),k(null),!m||m===C)return;const z=n.find(b=>b.key===m),L=n.find(b=>b.key===C);if(!z||!L)return;const F=n.map(b=>b.key===m?{...b,col:L.col,row:L.row}:b.key===C?{...b,col:z.col,row:z.row}:b);r?.(F),f(null)},[m,n,r]),M=a.useCallback((E,C)=>{E.preventDefault(),l&&m&&m!==C&&k(C)},[l,m]),j=a.useCallback(()=>{f(null),k(null)},[]),w=a.useRef(null);a.useEffect(()=>{if(!o)return;const E=z=>{if(!w.current||!_.current)return;const{key:L,startX:F,startY:b,cs:v,rs:T}=w.current,W=z.clientX-F,ne=z.clientY-b,N=_.current.clientWidth/s,g=Math.max(1,v+Math.round(W/N)),A=Math.max(1,T+Math.round(ne/t)),P=n.map(G=>G.key===L?{...G,colSpan:g,rowSpan:A}:G);r?.(P)},C=()=>{w.current=null};return document.addEventListener("mousemove",E),document.addEventListener("mouseup",C),()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",C)}},[o,n,s,t,r]);const y=a.useCallback((E,C,z,L)=>{E.stopPropagation(),w.current={key:C,startX:E.clientX,startY:E.clientY,cs:z,rs:L}},[]),V=Math.max(...n.map(E=>E.row+(E.rowSpan??1)),1);return e.jsx("div",{ref:d,id:h,className:`nice-dashboard ${p||""}`,style:x,children:e.jsx("div",{ref:_,className:"nice-dashboard__grid",style:{display:"grid",gridTemplateColumns:`repeat(${s}, 1fr)`,gridTemplateRows:`repeat(${V}, ${t}px)`,gap:c},children:n.map(E=>e.jsxs("div",{className:`nice-dashboard__panel${l?" nice-dashboard__panel--draggable":""}${m===E.key?" nice-dashboard__panel--dragging":""}${D===E.key?" nice-dashboard__panel--dragover":""}`,style:{gridColumn:`${E.col+1} / span ${E.colSpan??1}`,gridRow:`${E.row+1} / span ${E.rowSpan??1}`},draggable:l,onDragStart:C=>$(C,E.key),onDragOver:C=>M(C,E.key),onDragLeave:()=>k(C=>C===E.key?null:C),onDragEnd:j,onDrop:C=>I(C,E.key),children:[e.jsx("div",{className:"nice-dashboard__panel-content",children:E.render()}),o&&e.jsx("div",{className:"nice-dashboard__resize-handle",draggable:!1,onMouseDown:C=>y(C,E.key,E.colSpan??1,E.rowSpan??1)})]},E.key))})})}),{displayName:"NiceDashboardLayout"}),gs=Object.assign(a.forwardRef(({header:n,sidebar:s,sidebarWidth:t=260,sidebarCollapsed:c,onToggleSidebar:l,children:o,footer:r,className:p,style:x,id:i},d)=>{const{t:h}=u.useNiceTranslation(),m=u.useControlId(i),[f,D]=a.useState(!1),k=c??f,_=a.useCallback(()=>{const $=!k;D($),l?.($)},[k,l]);return e.jsxs("div",{ref:d,id:m,className:`nice-app-layout${k?" nice-app-layout--collapsed":""} ${p||""}`,style:x,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:k?0:t,overflow:"hidden",transition:"width 0.2s"},children:!k&&s}),s&&e.jsx("button",{type:"button",className:"nice-app-layout__sidebar-toggle",onClick:_,"aria-label":k?h("appLayout.openSidebar","Open sidebar"):h("appLayout.closeSidebar","Close sidebar"),children:e.jsx(u.NiceIcon,{name:k?"menu":"close",size:16})}),e.jsx("main",{className:"nice-app-layout__content",children:o})]}),r&&e.jsx("footer",{className:"nice-app-layout__footer",children:r})]})}),{displayName:"NiceAppLayout"}),js=[],ys=Object.assign(a.forwardRef(({items:n=js,position:s="bottom",size:t="md",magnify:c=!0,magnifyScale:l=1.5,activeKey:o,onItemClick:r,contained:p=!1,className:x,style:i,id:d,...h},m)=>{const f=u.useControlId(d),{t:D}=u.useNiceTranslation(),[k,_]=a.useState(null),$=a.useCallback(w=>{if(!c||k===null)return 1;const y=Math.abs(w-k);return y===0?l:y===1?1+(l-1)*.5:y===2?1+(l-1)*.2:1},[c,k,l]),I=s==="left"||s==="right",M=a.useRef(null);u.useRovingFocus(M,{orientation:I?"vertical":"horizontal",itemSelector:"button"});const j=s==="left"?"left center":s==="right"?"right center":"bottom center";return e.jsx("div",{ref:m,id:f,className:`nice-dock nice-dock--${s} nice-dock--${t}${p?" nice-dock--contained":""} ${x??""}`,style:i,role:"toolbar","aria-label":D("dock.label","Dock"),"aria-orientation":I?"vertical":"horizontal",...h,children:e.jsx("div",{ref:M,className:"nice-dock__bar",style:{flexDirection:I?"column":"row"},children:n.map((w,y)=>{const V=$(y);return e.jsxs("button",{type:"button",className:`nice-dock__item ${o===w.key?"nice-dock__item--active":""} ${w.disabled?"nice-dock__item--disabled":""}`,style:{transform:`scale(${V})`,transformOrigin:j,transition:"transform 0.15s ease-out"},disabled:w.disabled,onClick:()=>r?.(w.key),onMouseEnter:()=>_(y),onMouseLeave:()=>_(null),onFocus:()=>_(y),onBlur:()=>_(null),"aria-label":w.label,title:w.label,children:[e.jsx("span",{className:"nice-dock__icon",children:w.icon}),w.badge!==void 0&&e.jsx("span",{className:"nice-dock__badge",children:w.badge})]},w.key)})})})}),{displayName:"NiceDock"}),Tn=({items:n,label:s,icon:t,position:c,onItemClick:l})=>{const{t:o}=u.useNiceTranslation(),[r,p]=a.useState(!1),[x,i]=a.useState(null),d=a.useRef(null),h=a.useRef(null),m=a.useRef(null),f=a.useCallback(_=>{p(_),_||i(null)},[]);u.useMenuButton(d,h,{open:r,onOpenChange:f}),u.useOverlayFocus(m,{open:r&&x!=null,modal:!1,onClose:()=>i(null)}),u.useRovingFocus(m,{orientation:"vertical",wrap:!0,typeahead:!0});const D=c==="bottom"?"bottom-start":c==="top"?"top-start":c==="left"?"left-start":"right-start",k=a.useCallback(_=>{if(_.children&&_.children.length>0){i(x===_.key?null:_.key);return}_.onClick?.(),l?.(_.key),p(!1),i(null)},[l,x]);return e.jsxs("div",{className:"nice-desktop__start",children:[e.jsxs("button",{ref:d,type:"button",className:`nice-desktop__start-btn ${r?"nice-desktop__start-btn--active":""}`,onClick:()=>p(!r),"aria-expanded":r,"aria-haspopup":"menu","aria-label":o("desktop.start","Start"),children:[t&&e.jsx("span",{className:"nice-desktop__start-icon",children:t}),s&&e.jsx("span",{className:"nice-desktop__start-label",children:s}),!t&&!s&&e.jsx("span",{className:"nice-desktop__start-label",children:o("desktop.start","Start")})]}),r&&e.jsx("div",{ref:h,className:`nice-desktop__start-menu nice-desktop__start-menu--${D}`,role:"menu",children:n.map(_=>e.jsxs(a.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 ${x===_.key?"nice-desktop__start-item--open":""}`,disabled:_.disabled,onClick:()=>k(_),onKeyDown:$=>{_.children?.length&&$.key==="ArrowRight"&&($.preventDefault(),i(_.key))},role:"menuitem","aria-haspopup":_.children?.length?"menu":void 0,"aria-expanded":_.children?.length?x===_.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(u.NiceIcon,{name:"chevron-right",size:14})})]}),_.children&&x===_.key&&e.jsx("div",{ref:m,className:"nice-desktop__start-submenu",role:"menu",onKeyDown:$=>{$.key==="ArrowLeft"&&($.preventDefault(),i(null))},children:_.children.map($=>e.jsxs("button",{type:"button",className:"nice-desktop__start-item",disabled:$.disabled,onClick:()=>k($),role:"menuitem",children:[$.icon&&e.jsx("span",{className:"nice-desktop__start-item-icon",children:$.icon}),e.jsx("span",{className:"nice-desktop__start-item-label",children:$.label})]},$.key))})]})]},_.key))})]})},on=({items:n,position:s,size:t,startMenu:c,systemTray:l,onItemClick:o})=>{const{t:r}=u.useNiceTranslation(),p=s==="left"||s==="right",x=p?{width:t,height:"100%"}:{height:t,width:"100%"},i=a.useRef(null);return u.useRovingFocus(i,{orientation:p?"vertical":"horizontal",itemSelector:"button"}),e.jsxs("div",{ref:i,className:`nice-desktop__taskbar nice-desktop__taskbar--${s}`,style:x,role:"toolbar","aria-label":r("desktop.taskbar","Taskbar"),"aria-orientation":p?"vertical":"horizontal",children:[c,e.jsx("div",{className:"nice-desktop__taskbar-items",children:n.map(d=>e.jsxs("button",{type:"button",className:`nice-desktop__taskbar-btn ${d.active?"nice-desktop__taskbar-btn--active":""} ${d.minimized?"nice-desktop__taskbar-btn--minimized":""}`,onClick:()=>o?.(d.key),title:d.label,children:[d.icon&&e.jsx("span",{className:"nice-desktop__taskbar-btn-icon",children:d.icon}),e.jsx("span",{className:"nice-desktop__taskbar-btn-label",children:d.label}),d.badge!==void 0&&e.jsx("span",{className:"nice-desktop__taskbar-btn-badge",children:d.badge})]},d.key))}),l]})},On=({items:n,showClock:s=!0,onItemClick:t})=>{const[c,l]=a.useState(()=>new Date);return a.useEffect(()=>{if(!s)return;const o=setInterval(()=>l(new Date),3e4);return()=>clearInterval(o)},[s]),e.jsxs("div",{className:"nice-desktop__tray",children:[n.map(o=>e.jsx("button",{type:"button",className:"nice-desktop__tray-item",title:o.tooltip,onClick:()=>{o.onClick?.(),t?.(o.key)},children:o.icon},o.key)),s&&e.jsx("span",{className:"nice-desktop__tray-clock",children:c.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})},Ln=({icons:n,gridColumns:s,iconSize:t,onIconClick:c,onIconDoubleClick:l})=>{const[o,r]=a.useState(null),p=a.useCallback(i=>{r(i),c?.(i)},[c]),x=a.useCallback(i=>{l?.(i)},[l]);return e.jsx("div",{className:`nice-desktop__grid nice-desktop__grid--${t}`,style:{gridTemplateColumns:`repeat(${s}, 1fr)`},children:n.map(i=>e.jsxs("div",{className:`nice-desktop__icon ${o===i.key?"nice-desktop__icon--selected":""} ${i.disabled?"nice-desktop__icon--disabled":""}`,style:i.gridCol!=null||i.gridRow!=null?{gridColumn:i.gridCol,gridRow:i.gridRow}:void 0,onClick:()=>!i.disabled&&p(i.key),onDoubleClick:()=>!i.disabled&&x(i.key),role:"button",tabIndex:i.disabled?-1:0,"aria-label":i.label,onKeyDown:d=>{i.disabled||(d.key==="Enter"&&x(i.key),d.key===" "&&(d.preventDefault(),p(i.key)))},children:[e.jsx("div",{className:"nice-desktop__icon-img",children:i.icon}),e.jsx("span",{className:"nice-desktop__icon-label",children:i.label})]},i.key))})},An=({items:n,x:s,y:t,onItemClick:c,onClose:l})=>{const o=a.useRef(null);return a.useEffect(()=>{const r=p=>{o.current&&!o.current.contains(p.target)&&l()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[l]),u.useOverlayFocus(o,{open:!0,modal:!1,onClose:l}),u.useRovingFocus(o,{orientation:"vertical",wrap:!0,typeahead:!0}),e.jsx("div",{ref:o,className:"nice-desktop__context-menu",style:{position:"fixed",left:s,top:t},role:"menu",children:n.map(r=>e.jsxs(a.Fragment,{children:[r.divider&&e.jsx("div",{className:"nice-desktop__context-divider"}),e.jsxs("button",{type:"button",className:"nice-desktop__context-item",disabled:r.disabled,onClick:()=>{r.onClick?.(),c?.(r.key),l()},role:"menuitem",children:[r.icon&&e.jsx("span",{className:"nice-desktop__context-icon",children:r.icon}),e.jsx("span",{children:r.label})]})]},r.key))})},ks=Object.assign(a.forwardRef(({icons:n=[],taskbarPosition:s="bottom",taskbarSize:t=40,startMenuItems:c=[],startMenuLabel:l,startMenuIcon:o,taskbarItems:r=[],systemTrayItems:p=[],showClock:x=!0,wallpaper:i,gridColumns:d=8,iconSize:h="md",onIconClick:m,onIconDoubleClick:f,onTaskbarItemClick:D,onStartMenuItemClick:k,onSystemTrayItemClick:_,contextMenuItems:$,onContextMenuItemClick:I,children:M,className:j,style:w,id:y,accessMode:V,...E},C)=>{const z=u.useControlId(y),F=u.useNiceAccessMode(V,y)==="hidden",[b,v]=a.useState(null),T=a.useCallback(g=>{!$||$.length===0||(g.preventDefault(),v({x:g.clientX,y:g.clientY}))},[$]),W=c.length>0?e.jsx(Tn,{items:c,label:l,icon:o,position:s,onItemClick:k}):null,ne=e.jsx(On,{items:p,showClock:x,onItemClick:_}),N={...w,...i?{background:i}:{}};return F?null:e.jsxs("div",{ref:C,id:z,className:`nice-desktop nice-desktop--taskbar-${s} ${j??""}`,style:N,...E,children:[(s==="top"||s==="left")&&e.jsx(on,{items:r,position:s,size:t,startMenu:W,systemTray:ne,onItemClick:D}),e.jsxs("div",{className:"nice-desktop__area",onContextMenu:T,children:[n.length>0&&e.jsx(Ln,{icons:n,gridColumns:d,iconSize:h,onIconClick:m,onIconDoubleClick:f}),M,b&&$&&e.jsx(An,{items:$,x:b.x,y:b.y,onItemClick:I,onClose:()=>v(null)})]}),(s==="bottom"||s==="right")&&e.jsx(on,{items:r,position:s,size:t,startMenu:W,systemTray:ne,onItemClick:D})]})}),{displayName:"NiceDesktop"}),Cs=({commands:n,onSelect:s,onClose:t})=>{const[c,l]=a.useState(""),o=a.useRef(null),r=a.useRef(null),{t:p}=u.useNiceTranslation();u.useOverlayFocus(r,{open:!0,initialFocus:o,onClose:t});const x=c?n.filter(i=>i.label.toLowerCase().includes(c.toLowerCase())):n;return e.jsxs(e.Fragment,{children:[e.jsx("div",{role:"presentation",className:"nice-console__palette-overlay",onClick:t}),e.jsxs("div",{ref:r,className:"nice-console__palette",role:"dialog","aria-label":p("console.commandPalette","Command Palette"),children:[e.jsx("input",{ref:o,className:"nice-console__palette-input",placeholder:p("console.searchCommands","Search commands..."),value:c,onChange:i=>l(i.target.value),onKeyDown:i=>{i.key==="Enter"&&x.length>0&&(s(x[0].key),t())}}),e.jsxs("div",{className:"nice-console__palette-list",children:[x.map(i=>e.jsxs("button",{type:"button",className:"nice-console__palette-item",disabled:i.disabled,onClick:()=>{s(i.key),t()},children:[i.icon&&e.jsx("span",{className:"nice-console__palette-icon",children:i.icon}),e.jsx("span",{className:"nice-console__palette-label",children:i.label}),i.description&&e.jsx("span",{className:"nice-console__palette-desc",children:i.description}),i.shortcut&&e.jsx("span",{className:"nice-console__palette-shortcut",children:i.shortcut})]},i.key)),x.length===0&&e.jsx("div",{className:"nice-console__palette-empty",children:p("console.noCommands","No matching commands")})]})]})]})},ws=Object.assign(a.forwardRef(({tabs:n=[],activeTabKey:s,onTabChange:t,onTabClose:c,commandPalette:l=[],onCommand:o,statusItems:r=[],toolbar:p,sidePanel:x,sidePanelWidth:i=220,sidePanelCollapsed:d,onToggleSidePanel:h,bottomPanel:m,bottomPanelHeight:f=200,bottomPanelCollapsed:D,onToggleBottomPanel:k,children:_,size:$="md",theme:I="dark",className:M,style:j,id:w,accessMode:y,...V},E)=>{const C=a.useRef(null);u.useRovingFocus(C,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const z=u.useControlId(w),L=u.useNiceAccessMode(y,w),{t:F}=u.useNiceTranslation(),[b,v]=a.useState(n[0]?.key??""),[T,W]=a.useState(!1),[ne,N]=a.useState(!1),[g,A]=a.useState(!1),P=s??b,G=d??T,R=D??ne,q=a.useCallback(B=>{t?t(B):v(B)},[t]),ie=a.useCallback(()=>{const B=!G;h?h(B):W(B)},[G,h]),Z=a.useCallback(()=>{const B=!R;k?k(B):N(B)},[R,k]);a.useEffect(()=>{if(l.length===0)return;const B=te=>{te.ctrlKey&&te.shiftKey&&te.key==="P"&&(te.preventDefault(),A(pe=>!pe))};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[l.length]);const ee=a.useRef(null),J=a.useCallback(B=>{ee.current=B,typeof E=="function"?E(B):E&&(E.current=B)},[E]);u.useIntent("menu",()=>A(B=>!B),{ref:ee,enabled:l.length>0});const se=n.find(B=>B.key===P),fe=r.filter(B=>!B.position||B.position==="left"),X=r.filter(B=>B.position==="right");return L==="hidden"?null:e.jsxs("div",{ref:J,id:z,className:`nice-console nice-console--${$} nice-console--${I} ${M??""}`,style:j,...V,children:[p&&e.jsx("div",{className:"nice-console__toolbar",children:p}),n.length>0&&e.jsx("div",{className:"nice-console__tabs",ref:C,role:"tablist",children:n.map(B=>e.jsxs("div",{className:`nice-console__tab ${B.key===P?"nice-console__tab--active":""}`,role:"tab","aria-selected":B.key===P,children:[e.jsxs("button",{type:"button",className:"nice-console__tab-btn",onClick:()=>q(B.key),children:[B.icon&&e.jsx("span",{className:"nice-console__tab-icon",children:B.icon}),e.jsx("span",{children:B.label})]}),(B.closable??!0)&&c&&e.jsx("button",{type:"button",className:"nice-console__tab-close",onClick:()=>c(B.key),"aria-label":F("console.closeTab","Close tab"),children:e.jsx(u.NiceIcon,{name:"close",size:14})})]},B.key))}),e.jsxs("div",{className:"nice-console__main",children:[x&&!G&&e.jsxs("aside",{className:"nice-console__side",style:{width:i,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":F("console.closeSidePanel","Close side panel"),children:e.jsx(u.NiceIcon,{name:"close",size:14})})}),e.jsx("div",{className:"nice-console__side-content",children:x})]}),e.jsxs("div",{className:"nice-console__center",children:[e.jsx("div",{className:"nice-console__content",role:"tabpanel",children:se?se.render?se.render():se.content:_}),m&&!R&&e.jsxs("div",{className:"nice-console__bottom",style:{height:f,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":F("console.closeBottomPanel","Close bottom panel"),children:e.jsx(u.NiceIcon,{name:"close",size:14})})}),e.jsx("div",{className:"nice-console__bottom-content",children:m})]})]})]}),r.length>0&&e.jsxs("div",{className:"nice-console__statusbar",children:[e.jsxs("div",{className:"nice-console__statusbar-left",children:[x&&G&&e.jsx("button",{type:"button",className:"nice-console__statusbar-btn",onClick:ie,title:F("console.openSidePanel","Open side panel"),children:e.jsx(u.NiceIcon,{name:"menu",size:14})}),m&&R&&e.jsx("button",{type:"button",className:"nice-console__statusbar-btn",onClick:Z,title:F("console.openBottomPanel","Open bottom panel"),children:e.jsx(u.NiceIcon,{name:"chevron-up",size:14})}),fe.map(B=>e.jsx("span",{onKeyDown:u.clickOnActivationKey,className:"nice-console__status-item",onClick:B.onClick,role:B.onClick?"button":void 0,tabIndex:B.onClick?0:void 0,children:B.content??B.label},B.key))]}),e.jsx("div",{className:"nice-console__statusbar-right",children:X.map(B=>e.jsx("span",{onKeyDown:u.clickOnActivationKey,className:"nice-console__status-item",onClick:B.onClick,role:B.onClick?"button":void 0,tabIndex:B.onClick?0:void 0,children:B.content??B.label},B.key))})]}),g&&l.length>0&&e.jsx(Cs,{commands:l,onSelect:B=>o?.(B),onClose:()=>A(!1)})]})}),{displayName:"NiceConsole"}),Ss=[],Is=Object.assign(a.forwardRef(({steps:n=Ss,activeStep:s,onStepChange:t,onComplete:c,onCancel:l,allowStepClick:o=!1,variant:r="horizontal",nextLabel:p,prevLabel:x,finishLabel:i,cancelLabel:d,showProgress:h=!0,className:m,style:f,size:D="md",accessMode:k,id:_},$)=>{const M=u.useNiceAccessMode(k,_)==="hidden",{t:j}=u.useNiceTranslation(),w=u.useControlId(_),[y,V]=a.useState(0),[E,C]=a.useState({}),[z,L]=a.useState(new Set([0])),F=s??y,b=n[F],v=F===0,T=F===n.length-1,W=a.useCallback(Z=>{const ee=Math.max(0,Math.min(n.length-1,Z));V(ee),L(J=>new Set(J).add(ee)),t?.(ee)},[n.length,t]),ne=a.useCallback(()=>{if(!b?.validate)return!0;const Z=b.validate();return Z===!0||Z===void 0?(C(ee=>{const J={...ee};return delete J[b.id],J}),!0):(C(ee=>({...ee,[b.id]:Z})),!1)},[b]),N=a.useCallback(()=>{ne()&&(T?c?.():W(F+1))},[F,T,ne,W,c]),g=a.useCallback(()=>{v||W(F-1)},[F,v,W]),A=a.useCallback(Z=>{const ee=n.findIndex(J=>J.id===Z);ee>=0&&W(ee)},[n,W]),P=a.useMemo(()=>({stepIndex:F,totalSteps:n.length,goNext:N,goPrev:g,goTo:A,isFirst:v,isLast:T}),[F,n.length,N,g,A,v,T]),G=n.length>0?(F+1)/n.length*100:0,R=a.useRef(null),q=a.useCallback(Z=>{R.current=Z,typeof $=="function"?$(Z):$&&($.current=Z)},[$]);if(u.useIntent(["sectionPrev","sectionNext"],Z=>Z.intent==="sectionNext"?N():g(),{ref:R,enabled:!M&&n.length>0}),u.useInputHints(R,[...v?[]:[{intent:"sectionPrev",label:j("wizard.previousStep","Previous step")}],{intent:"sectionNext",label:T?j("finish","Finish"):j("wizard.nextStep","Next step")}],{enabled:n.length>0}),M)return null;const ie=n.map(Z=>({title:Z.title,subtitle:Z.description,icon:Z.icon,optional:Z.optional}));return e.jsxs("div",{ref:q,id:w,className:`nice-wizard nice-wizard--${r} nice-size-${D}${m?` ${m}`:""}`,style:f,children:[e.jsx(Rn,{steps:ie,activeStep:F,orientation:r,allowStepClick:o,onStepClick:Z=>{Z<=F&&W(Z)}}),h&&e.jsx("div",{className:"nice-wizard__progress",role:"progressbar","aria-label":j("wizard.progress","Progress"),"aria-valuemin":1,"aria-valuemax":Math.max(1,n.length),"aria-valuenow":Math.min(F+1,Math.max(1,n.length)),children:e.jsx("div",{className:"nice-wizard__progress-bar",style:{width:`${G}%`}})}),e.jsx("div",{className:"nice-wizard__content",role:"group","aria-label":b?.title,children:b&&e.jsxs(e.Fragment,{children:[typeof b.content=="function"?b.content(P):b.content,E[b.id]&&e.jsx("div",{className:"nice-wizard__error nice-error-text",role:"alert",children:E[b.id]})]})}),e.jsxs("div",{className:"nice-wizard__actions",children:[l&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--text",onClick:l,children:d??j("cancel","Cancel")}),e.jsxs("div",{className:"nice-wizard__actions-right",children:[!v&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--outlined",onClick:g,children:x??e.jsxs(e.Fragment,{children:[e.jsx(u.NiceIcon,{name:"arrow-left",size:14})," ",j("previous","Previous")]})}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary",onClick:N,children:T?i??e.jsxs(e.Fragment,{children:[j("finish","Finish")," ",e.jsx(u.NiceIcon,{name:"check",size:14})]}):p??e.jsxs(e.Fragment,{children:[j("next","Next")," ",e.jsx(u.NiceIcon,{name:"arrow-right",size:14})]})})]})]})]})}),{displayName:"NiceWizard"}),$s=[],Fn=a.createContext(null);function Es(){const n=a.useContext(Fn);if(!n)throw new Error("useSetupWizard must be used within NiceSetupWizard");return n}const zs=e.jsx(u.NiceIcon,{name:"refresh",size:18}),Ms=Object.assign(a.forwardRef(({steps:n=$s,initialValues:s={},activeStep:t,layout:c="horizontal",size:l="md",defaultQuickMode:o=!1,allowQuickModeToggle:r=!0,showStepNumbers:p=!0,showProgress:x=!0,showEstimatedTime:i=!1,allowStepClick:d=!0,showReviewStep:h=!1,persistKey:m,animation:f="slide",theme:D,branding:k,showLanguagePicker:_=!1,languagePickerProps:$,showThemePicker:I=!1,themePickerProps:M,showRestart:j=!1,onRestart:w,restart:y={},header:V,footer:E,onStepChange:C,onValuesChange:z,onComplete:L,onCancel:F,labels:b={},accessMode:v,height:T,id:W,className:ne,style:N},g)=>{const A=a.useRef(null);u.useRovingFocus(A,{orientation:c==="vertical"?"vertical":"horizontal",wrap:!0,activateOnMove:!0});const P=u.useNiceAccessMode(v,W),G=P==="hidden",{t:R}=u.useNiceTranslation(),q=u.useControlId(W),[ie,Z]=a.useState(o),ee=a.useMemo(()=>ie?n.filter(S=>!S.quickModeSkip):n,[n,ie]),J=a.useMemo(()=>{if(!h)return ee;const S={id:"__review__",title:b.review??R("wizard.review","Review"),icon:e.jsx(u.NiceIcon,{name:"clipboard",size:16}),content:oe=>e.jsxs("div",{className:"nice-setup-wizard__review",children:[e.jsx("h3",{children:R("wizard.reviewTitle","Review Your Setup")}),ee.filter(re=>re.summary).map(re=>e.jsxs("div",{className:"nice-setup-wizard__review-section",children:[e.jsx("h4",{children:re.title}),re.summary?.(oe.values)]},re.id))]})};return[...ee,S]},[ee,h,b.review,R]),[se,fe]=a.useState(()=>{if(m)try{const S=localStorage.getItem(m);if(S)return{...s,...JSON.parse(S)}}catch{}return s}),[X,B]=a.useState(()=>{if(t)return t;if(m)try{const S=localStorage.getItem(`${m}_step`);if(S&&J.some(oe=>oe.id===S))return S}catch{}return J[0]?.id??""}),[te,pe]=a.useState(()=>new Set([X])),[_e,we]=a.useState({}),[Ne,ze]=a.useState(!1),[ge,ue]=a.useState("next"),[O,U]=a.useState(!1),ce=J.findIndex(S=>S.id===X),ae=ce>=0?ce:J.length>0?0:-1,Q=J[ae],Se=ae===0,ve=ae===J.length-1,Me=J.length>0?(ae+1)/J.length*100:0;a.useEffect(()=>{m&&(localStorage.setItem(m,JSON.stringify(se)),localStorage.setItem(`${m}_step`,X))},[se,X,m]);const ye=a.useCallback((S,oe)=>{fe(re=>{const ke={...re,[S]:oe};return z?.(ke),ke})},[z]),Ie=a.useCallback(S=>{fe(oe=>{const re={...oe,...S};return z?.(re),re})},[z]),xe=a.useCallback((S,oe)=>{we(re=>({...re,[S]:oe}))},[]),$e=a.useCallback(S=>{we(oe=>{const re={...oe};return delete re[S],re})},[]),je=a.useCallback(S=>{const oe=J.findIndex(re=>re.id===S);oe>=0&&(ue(oe>ae?"next":"prev"),B(S),pe(re=>new Set(re).add(S)),C?.(S,oe))},[J,ae,C]),Te=a.useCallback(async()=>{if(Q){if(Q.validate){ze(!0);try{const S=await Q.validate(se);if(S){xe(Q.id,S),ze(!1);return}$e(Q.id)}catch(S){xe(Q.id,String(S)),ze(!1);return}ze(!1)}if(Q.fields){for(const S of Q.fields){if(S.required&&!se[S.id]){xe(Q.id,`${S.label} ${R("wizard.isRequired","is required")}`);return}if(S.validation?.custom){const oe=S.validation.custom(se[S.id]);if(oe){xe(Q.id,oe);return}}}$e(Q.id)}if(ve)await L?.(se),m&&(localStorage.removeItem(m),localStorage.removeItem(`${m}_step`));else{let S;Q.nextStep?S=typeof Q.nextStep=="function"?Q.nextStep(se):Q.nextStep:S=J[ae+1]?.id??"",S&&je(S)}}},[Q,se,ve,ae,J,L,m,R,xe,$e,je]),Le=a.useCallback(()=>{if(Se)return;const S=Q?.prevStep??J[ae-1]?.id;S&&(ue("prev"),je(S))},[Se,Q,ae,J,je]),Be=a.useCallback(()=>{if(Q?.optional&&!ve){const S=J[ae+1]?.id;S&&je(S)}},[Q,ve,ae,J,je]),De=a.useCallback(()=>{L?.(se)},[L,se]),Y=a.useCallback(()=>{F?.()},[F]),le=a.useCallback(()=>{y.skipConfirm?w?.():U(!0)},[y.skipConfirm,w]),K=a.useCallback(()=>{Z(S=>!S)},[]),H=a.useMemo(()=>({values:se,setValue:ye,setValues:Ie,currentStep:Q,currentIndex:ae,totalSteps:J.length,visitedSteps:te,errors:_e,setError:xe,clearError:$e,goNext:Te,goPrev:Le,goTo:je,skip:Be,complete:De,cancel:Y,isFirst:Se,isLast:ve,isQuickMode:ie,toggleQuickMode:K,progress:Me,t:R}),[se,ye,Ie,Q,ae,J.length,te,_e,xe,$e,Te,Le,je,Be,De,Y,Se,ve,ie,K,Me,R]),de=a.useMemo(()=>{if(!i)return null;const oe=J.map(re=>re.estimatedTime).filter(Boolean).map(re=>{const ke=re.match(/(\d+)\s*(min|sec|s|m)/i);if(!ke)return 0;const Oe=parseInt(ke[1],10);return ke[2].toLowerCase().startsWith("m")?Oe:Oe/60}).reduce((re,ke)=>re+ke,0);return oe>0?`~${Math.ceil(oe)} min`:null},[J,i]),he=a.useRef(null),Ae=a.useCallback(S=>{he.current=S,typeof g=="function"?g(S):g&&(g.current=S)},[g]);if(u.useIntent(["sectionPrev","sectionNext"],S=>{S.intent==="sectionNext"?Te():Le()},{ref:he,enabled:!G&&!!Q}),u.useInputHints(he,[...Se?[]:[{intent:"sectionPrev",label:b.prev??R("wizard.prev","Back")}],{intent:"sectionNext",label:ve?b.finish??R("wizard.finish","Finish"):b.next??R("wizard.next","Continue")}],{enabled:!!Q}),!Q)return null;const He=(S,oe)=>{const re=S.id===X,ke=te.has(S.id)&&!re&&oe<ae,Oe=!re&&!ke,Fe=!!_e[S.id],me=d&&(ke||oe<=ae);return e.jsxs("button",{type:"button",role:"tab","aria-selected":re,"aria-current":re?"step":void 0,className:["nice-setup-wizard__step-indicator",re&&"nice-setup-wizard__step-indicator--active",ke&&"nice-setup-wizard__step-indicator--completed",Oe&&"nice-setup-wizard__step-indicator--pending",Fe&&"nice-setup-wizard__step-indicator--error"].filter(Boolean).join(" "),onClick:()=>me&&je(S.id),disabled:!me,children:[e.jsx("span",{className:"nice-setup-wizard__step-marker",children:ke?e.jsx(u.NiceIcon,{name:"check",size:14}):Fe?"!":p?oe+1:S.icon||e.jsx(u.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:S.title}),S.subtitle&&e.jsx("span",{className:"nice-setup-wizard__step-subtitle",children:S.subtitle}),S.optional&&e.jsxs("span",{className:"nice-setup-wizard__step-optional",children:["(",b.optional??R("wizard.optional","optional"),")"]})]}),S.badge&&e.jsx("span",{className:"nice-setup-wizard__step-badge",children:S.badge})]},S.id)},Ze=S=>{if(S.showWhen&&!S.showWhen(se))return null;const oe=se[S.id]??S.defaultValue??"",re=me=>ye(S.id,me);if(S.render)return e.jsx("div",{className:`nice-setup-wizard__field${S.fullWidth?" nice-setup-wizard__field--full":""}`,children:S.render({value:oe,onChange:re,field:S})},S.id);const ke=`${q}-${S.id}`,Oe={id:ke,disabled:S.disabled||P==="disabled"||P==="readOnly",placeholder:S.placeholder,required:S.required};let Fe;switch(S.type){case"textarea":Fe=e.jsx("textarea",{...Oe,className:"nice-setup-wizard__input nice-setup-wizard__textarea",value:String(oe),onChange:me=>re(me.target.value),rows:4});break;case"select":Fe=e.jsxs("select",{...Oe,className:"nice-setup-wizard__input nice-setup-wizard__select",value:String(oe),onChange:me=>re(me.target.value),children:[e.jsx("option",{value:"",children:S.placeholder||R("wizard.select","Select...")}),S.options?.map(me=>e.jsx("option",{value:me.value,children:me.label},me.value))]});break;case"radio":Fe=e.jsx("div",{className:"nice-setup-wizard__radio-group",children:S.options?.map(me=>e.jsxs("label",{className:"nice-setup-wizard__radio-label",children:[e.jsx("input",{type:"radio",name:ke,value:me.value,checked:oe===me.value,onChange:()=>re(me.value),disabled:Oe.disabled}),me.icon&&e.jsx("span",{className:"nice-setup-wizard__radio-icon",children:me.icon}),e.jsx("span",{children:me.label})]},me.value))});break;case"checkbox":Fe=e.jsxs("label",{className:"nice-setup-wizard__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:!!oe,onChange:me=>re(me.target.checked),disabled:Oe.disabled}),e.jsx("span",{children:S.label})]});break;case"switch":Fe=e.jsxs("label",{className:"nice-setup-wizard__switch-label",children:[e.jsx("span",{className:"nice-setup-wizard__switch-text",children:S.label}),e.jsxs("span",{className:`nice-setup-wizard__switch${oe?" nice-setup-wizard__switch--on":""}`,children:[e.jsx("input",{type:"checkbox",checked:!!oe,onChange:me=>re(me.target.checked),disabled:Oe.disabled}),e.jsx("span",{className:"nice-setup-wizard__switch-track"}),e.jsx("span",{className:"nice-setup-wizard__switch-thumb"})]})]});break;case"slider":Fe=e.jsxs("div",{className:"nice-setup-wizard__slider-wrapper",children:[e.jsx("input",{type:"range",...Oe,className:"nice-setup-wizard__slider",value:Number(oe)||S.validation?.min||0,min:S.validation?.min,max:S.validation?.max,onChange:me=>re(Number(me.target.value))}),e.jsx("span",{className:"nice-setup-wizard__slider-value",children:String(oe??"")})]});break;default:Fe=e.jsx("input",{type:S.type==="custom"?"text":S.type,...Oe,className:"nice-setup-wizard__input",value:String(oe),onChange:me=>re(me.target.value),minLength:S.validation?.minLength,maxLength:S.validation?.maxLength,min:S.validation?.min,max:S.validation?.max,pattern:S.validation?.pattern?.source})}return e.jsxs("div",{className:`nice-setup-wizard__field${S.fullWidth?" nice-setup-wizard__field--full":""}`,children:[S.type!=="checkbox"&&S.type!=="switch"&&e.jsxs("label",{htmlFor:ke,className:"nice-setup-wizard__label",children:[S.label,S.required&&e.jsx("span",{className:"nice-setup-wizard__required",children:"*"})]}),Fe,S.description&&e.jsx("span",{className:"nice-setup-wizard__field-desc",children:S.description})]},S.id)},Ee=()=>Q.fields?e.jsx("div",{className:"nice-setup-wizard__fields",children:Q.fields.map(Ze)}):Q.content?typeof Q.content=="function"?Q.content(H):Q.content:null;if(G)return null;const en=_||I||j,Ve=y.label??R("wizard.restart","Start over"),jn=e.jsx(Fn.Provider,{value:H,children:e.jsxs("div",{ref:Ae,id:q,className:["nice-setup-wizard",`nice-setup-wizard--${c}`,`nice-size-${l}`,f!=="none"&&`nice-setup-wizard--anim-${f}`,ne].filter(Boolean).join(" "),style:T!=null?{height:T,minHeight:0,maxHeight:"none",boxSizing:"border-box",...N}:N,children:[(k||V||r||en)&&e.jsxs("header",{className:"nice-setup-wizard__header",children:[k&&e.jsx("div",{className:"nice-setup-wizard__branding",children:k}),en&&e.jsxs("div",{className:"nice-setup-wizard__header-controls",children:[_&&e.jsx(mn,{compact:!0,variant:"ghost",...$}),I&&e.jsx(hn,{compact:!0,variant:"ghost",...M}),j&&e.jsx("button",{type:"button",className:"nice-setup-wizard__icon-btn nice-setup-wizard__restart",onClick:le,title:Ve,"aria-label":Ve,children:y.icon??zs})]}),V,r&&e.jsxs("label",{className:"nice-setup-wizard__quick-toggle",children:[e.jsx("input",{type:"checkbox",checked:ie,onChange:K}),e.jsx("span",{children:b.quickMode??R("wizard.quickMode","Quick Setup")})]}),de&&e.jsx("span",{className:"nice-setup-wizard__time",children:de})]}),c!=="minimal"&&e.jsx("nav",{className:"nice-setup-wizard__nav",ref:A,role:"tablist",children:J.map(He)}),x&&e.jsx("div",{className:"nice-setup-wizard__progress",children:e.jsx("div",{className:"nice-setup-wizard__progress-bar",style:{width:`${Me}%`},role:"progressbar","aria-valuenow":Me,"aria-valuemin":0,"aria-valuemax":100})}),e.jsxs("div",{className:["nice-setup-wizard__content",ge==="next"&&"nice-setup-wizard__content--slide-next",ge==="prev"&&"nice-setup-wizard__content--slide-prev"].filter(Boolean).join(" "),role:"tabpanel",children:[Q.description&&e.jsx("p",{className:"nice-setup-wizard__step-description",children:Q.description}),Ee(),_e[Q.id]&&e.jsx("div",{className:"nice-setup-wizard__error",role:"alert",children:_e[Q.id]})]},X),e.jsxs("footer",{className:"nice-setup-wizard__footer",children:[e.jsxs("div",{className:"nice-setup-wizard__actions-left",children:[F&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--text",onClick:Y,children:b.cancel??R("wizard.cancel","Cancel")}),Q.optional&&!ve&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--text",onClick:Be,children:b.skip??R("wizard.skip","Skip")}),Q.actions?.filter(S=>S.position==="left").map(S=>e.jsxs("button",{type:"button",className:`nice-btn nice-btn--${S.variant||"outlined"}`,onClick:()=>S.onClick(H),disabled:S.disabled?.(H),children:[S.icon," ",S.label]},S.id))]}),e.jsxs("div",{className:"nice-setup-wizard__actions-right",children:[Q.actions?.filter(S=>S.position!=="left").map(S=>e.jsxs("button",{type:"button",className:`nice-btn nice-btn--${S.variant||"outlined"}`,onClick:()=>S.onClick(H),disabled:S.disabled?.(H),children:[S.icon," ",S.label]},S.id)),!Se&&e.jsx(Ke.NiceButton,{variant:"outline",size:l,onClick:Le,children:b.prev??e.jsxs(e.Fragment,{children:[e.jsx(u.NiceIcon,{name:"arrow-left",size:14})," ",R("wizard.prev","Back")]})}),e.jsx(Ke.NiceButton,{variant:"primary",size:l,onClick:Te,disabled:Ne,loading:Ne,children:ve?b.finish??e.jsxs(e.Fragment,{children:[R("wizard.finish","Finish")," ",e.jsx(u.NiceIcon,{name:"check",size:14})]}):b.next??e.jsxs(e.Fragment,{children:[R("wizard.next","Continue")," ",e.jsx(u.NiceIcon,{name:"arrow-right",size:14})]})})]})]}),E&&e.jsx("div",{className:"nice-setup-wizard__custom-footer",children:E}),c==="minimal"&&e.jsx("div",{className:"nice-setup-wizard__minimal-indicator",children:b.stepOf?b.stepOf.replace("{current}",String(ae+1)).replace("{total}",String(J.length)):`${ae+1} / ${J.length}`}),j&&!y.skipConfirm&&e.jsx(Re.NiceConfirmDialog,{visible:O,variant:"warning",size:l,header:y.confirmTitle??R("wizard.restartConfirmTitle","Start setup over?"),message:y.confirmMessage??R("wizard.restartConfirmMessage","This will discard your progress and restart the setup from the beginning."),acceptLabel:y.confirmLabel??R("wizard.restartConfirmAccept","Yes, start over"),rejectLabel:y.cancelLabel??R("wizard.restartConfirmReject","Cancel"),onAccept:()=>{U(!1),w?.()},onReject:()=>U(!1)})]})});return D!=null?e.jsx(u.NiceThemeProvider,{theme:D,children:jn}):jn}),{displayName:"NiceSetupWizard"}),Ds=Object.assign(a.forwardRef(({label:n,helperText:s,disabled:t,size:c="md",id:l,className:o,style:r,accessMode:p,logo:x,brandName:i,breadcrumbs:d,centerContent:h,rightContent:m,leftContent:f,sticky:D=!0,variant:k="light",height:_="md",onBrandClick:$,displayStyle:I},M)=>{const j=u.useNiceAccessMode(p,l),w=j==="hidden";j==="disabled"&&(t=!0);const{t:y}=u.useNiceTranslation(),V=u.useControlId(l),E=u.useComponentDisplayStyle("menu",I),C=u.useComponentDisplayClass("menu",I);return w?null:e.jsxs("nav",{ref:M,id:V,className:`nice-navbar nice-navbar--${k} nice-navbar--h-${_}${D?" nice-navbar--sticky":""} nice-navbar--ds-${C}${o?` ${o}`:""}${t?" nice-disabled":""}`,style:{...E,...r},role:"navigation","aria-label":n??y("mainNavigation","Main navigation"),children:[e.jsxs("div",{className:"nice-navbar__left",children:[f,(x||i)&&e.jsxs("div",{onKeyDown:u.clickOnActivationKey,className:"nice-navbar__brand",onClick:$,role:$?"button":void 0,tabIndex:$?0:void 0,children:[x&&e.jsx("span",{className:"nice-navbar__logo",children:x}),i&&e.jsx("span",{className:"nice-navbar__brand-name",children:i})]}),d&&d.length>0&&e.jsx("ol",{className:"nice-navbar__breadcrumbs","aria-label":y("breadcrumbs","Breadcrumbs"),children:d.map((z,L)=>e.jsxs("li",{className:"nice-navbar__breadcrumb",children:[L>0&&e.jsx("span",{className:"nice-navbar__breadcrumb-sep",children:"/"}),z.href||z.onClick?e.jsx("a",{href:z.href??"#",onClick:F=>{z.onClick&&(F.preventDefault(),z.onClick())},children:z.label}):e.jsx("span",{"aria-current":L===d.length-1?"page":void 0,children:z.label})]},L))})]}),h&&e.jsx("div",{className:"nice-navbar__center",children:h}),m&&e.jsx("div",{className:"nice-navbar__right",children:m})]})}),{displayName:"NiceNavbar"}),Rs={online:"var(--nice-color-success, #5cb85c)",away:"var(--nice-color-warning, #f0ad4e)",busy:"var(--nice-color-error, #d9534f)",offline:"var(--nice-text-muted, #999)"},Pn=Object.assign(a.forwardRef(({label:n,disabled:s,size:t="md",id:c,className:l,style:o,accessMode:r,userName:p,userEmail:x,userRole:i,avatarUrl:d,items:h=[],open:m,onOpenChange:f,onProfile:D,onLogout:k,avatarSize:_=36,status:$},I)=>{const M=u.useNiceAccessMode(r,c),j=M==="hidden";M==="disabled"&&(s=!0);const{t:w}=u.useNiceTranslation(),y=u.useControlId(c),[V,E]=a.useState(!1),C=m??V,z=a.useCallback(A=>{E(A),f?.(A)},[f]),L=a.useCallback(()=>z(!C),[C,z]),F=a.useRef(null),b=a.useRef(null);u.useMenuButton(F,b,{open:C,onOpenChange:z});const[v,T]=a.useState(null),W=a.useCallback(()=>{const A=F.current?.getBoundingClientRect();A&&T({top:A.bottom+6,right:window.innerWidth-A.right})},[]);a.useLayoutEffect(()=>{C&&W()},[C,W]),a.useEffect(()=>{if(!C)return;const A=()=>W();return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[C,W]);const ne=p.split(" ").map(A=>A.charAt(0)).join("").toUpperCase().slice(0,2),N=[];D&&N.push({id:"__profile",label:w("profile","Profile"),onClick:D}),k&&N.push({id:"__divider",label:"",isDivider:!0},{id:"__logout",label:w("logout","Logout"),onClick:k,danger:!0});const g=h.length>0?h:N;return j?null:e.jsxs("div",{ref:I,id:y,className:`nice-user-menu nice-size-${t}${l?` ${l}`:""}${s?" nice-disabled":""}`,style:o,children:[e.jsxs("button",{ref:F,type:"button",className:"nice-user-menu__trigger",onClick:L,disabled:s,"aria-haspopup":"menu","aria-expanded":C,"aria-label":n??p,children:[e.jsx("span",{className:"nice-user-menu__avatar",style:{width:_,height:_},children:d?e.jsx("img",{src:d,alt:p}):e.jsx("span",{className:"nice-user-menu__initials",children:ne})}),$&&e.jsx("span",{className:"nice-user-menu__status",style:{backgroundColor:Rs[$]},title:$})]}),C&&v&&typeof document<"u"&&un.createPortal(e.jsxs("div",{ref:b,className:`nice-user-menu__dropdown nice-user-menu__dropdown--portal ${Re.scopeThemeClass(F.current)}`,role:"menu",style:{position:"fixed",top:v.top,right:v.right,zIndex:1e3},onMouseDown:A=>A.preventDefault(),children:[e.jsxs("div",{className:"nice-user-menu__info",children:[e.jsx("span",{className:"nice-user-menu__name",children:p}),x&&e.jsx("span",{className:"nice-user-menu__email",children:x}),i&&e.jsx("span",{className:"nice-user-menu__role",children:i})]}),g.length>0&&e.jsx("div",{className:"nice-user-menu__items",children:g.map(A=>A.isDivider?e.jsx("hr",{className:"nice-user-menu__divider"},A.id):e.jsxs("button",{type:"button",role:"menuitem",className:`nice-user-menu__item${A.danger?" nice-user-menu__item--danger":""}`,onClick:()=>{A.onClick?.(),z(!1)},disabled:A.disabled||s,children:[A.icon&&e.jsx("span",{className:"nice-user-menu__item-icon",children:A.icon}),e.jsx("span",{children:A.label})]},A.id))})]}),document.body)]})}),{displayName:"NiceUserMenu"});function Ts(n,s){if(!s)return n;const t=s.toLowerCase();return n.map(c=>{const l=c.entities.filter(r=>r.label.toLowerCase().includes(t)||r.name.toLowerCase().includes(t));return c.label.toLowerCase().includes(t)||c.name.toLowerCase().includes(t)?c:l.length>0?{...c,entities:l}:null}).filter(Boolean)}const Os=({value:n,onChange:s,placeholder:t})=>{const{t:c}=u.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(u.NiceIcon,{name:"search",size:16})}),e.jsx("input",{type:"text",className:"nice-dynamic-sidebar__search-input",value:n,onChange:l=>s(l.target.value),placeholder:t,"aria-label":t}),n&&e.jsx("button",{className:"nice-dynamic-sidebar__search-clear",onClick:()=>s(""),"aria-label":c("nav.clear","Clear"),type:"button",children:e.jsx(u.NiceIcon,{name:"close",size:14})})]})},Ls=({module:n,activeRoute:s,collapsed:t,expandedModules:c,onToggleModule:l,onNavigate:o})=>{const r=c.has(n.id);return t?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&&o(n.entities[0].route,n.entities[0]),disabled:!n.isAvailable,type:"button",children:n.icon?e.jsx(u.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 ${r?"nice-dynamic-sidebar__module-header--expanded":""}`,onClick:()=>n.isAvailable&&l(n.id),disabled:!n.isAvailable,type:"button","aria-expanded":r,children:[n.icon&&e.jsx("span",{className:"nice-dynamic-sidebar__module-icon",children:e.jsx(u.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 ${r?"nice-dynamic-sidebar__module-chevron--open":""}`,children:e.jsx(u.NiceIcon,{name:"chevron-right",size:14})})]}),r&&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:()=>o(p.route,p),type:"button",children:[p.icon&&e.jsx("span",{className:"nice-dynamic-sidebar__entity-icon",children:e.jsx(u.NiceIcon,{name:p.icon,size:14})}),e.jsx("span",{children:p.label})]})},p.id))})]})},As=({favorites:n,activeRoute:s,onNavigate:t,label:c})=>n.length===0?null:e.jsxs("div",{className:"nice-dynamic-sidebar__favorites",children:[e.jsx("div",{className:"nice-dynamic-sidebar__section-title",children:c}),e.jsx("ul",{role:"list",children:n.map(l=>e.jsx("li",{className:`nice-dynamic-sidebar__favorite ${s===l.route?"nice-dynamic-sidebar__favorite--active":""}`,children:e.jsxs("button",{className:"nice-dynamic-sidebar__favorite-btn",onClick:()=>t(l.route),type:"button",children:[l.icon&&e.jsx(u.NiceIcon,{name:l.icon,size:14}),e.jsx("span",{children:l.label})]})},l.id))})]}),Fs=Object.assign(a.forwardRef(({menu:n,activeRoute:s,collapsed:t,width:c=260,collapsedWidth:l=56,searchable:o=!0,showFavorites:r=!0,showQuickActions:p=!0,collapsible:x=!0,onNavigate:i,onCollapseChange:d,onToggleFavorite:h,header:m,footer:f,className:D,style:k,id:_,accessMode:$,...I},M)=>{const j=u.useControlId(_),w=u.useNiceAccessMode($,_),{t:y}=u.useNiceTranslation(),[V,E]=a.useState(t??!1),C=t??V,[z,L]=a.useState(""),[F,b]=a.useState(()=>{if(s){const g=n.modules.find(A=>A.entities.some(P=>P.route===s));return g?new Set([g.id]):new Set}return new Set}),v=a.useCallback(()=>{const g=!C;E(g),d?.(g)},[C,d]),T=a.useCallback(g=>{b(A=>{const P=new Set(A);return P.has(g)?P.delete(g):P.add(g),P})},[]),W=a.useCallback((g,A)=>{i?.(g,A)},[i]),ne=a.useMemo(()=>Ts(n.modules.filter(g=>g.isAvailable).sort((g,A)=>g.order-A.order),z),[n.modules,z]),N=C?l:c;return w==="hidden"?null:e.jsxs("nav",{ref:M,id:j,className:`nice-dynamic-sidebar ${C?"nice-dynamic-sidebar--collapsed":""} ${D??""}`,style:{...k,width:N,minWidth:N},"aria-label":y("nav.sidebar","Sidebar"),...I,children:[m&&e.jsx("div",{className:"nice-dynamic-sidebar__header",children:m}),x&&e.jsx("button",{className:"nice-dynamic-sidebar__toggle",onClick:v,"aria-label":C?y("expand","Expand"):y("collapse","Collapse"),type:"button",children:e.jsx(u.NiceIcon,{name:C?"chevron-right":"chevron-left",size:14})}),o&&!C&&e.jsx(Os,{value:z,onChange:L,placeholder:y("nav.search","Search")}),r&&!C&&e.jsx(As,{favorites:n.favorites,activeRoute:s,onNavigate:W,label:y("nav.favorites","Favorites")}),p&&!C&&n.quickActions.length>0&&e.jsx("div",{className:"nice-dynamic-sidebar__quick-actions",children:n.quickActions.map(g=>e.jsxs("button",{className:"nice-dynamic-sidebar__quick-action",onClick:()=>W(g.route),title:g.shortcut?`${g.label} (${g.shortcut})`:g.label,type:"button",children:[g.icon&&e.jsx(u.NiceIcon,{name:g.icon,size:14}),e.jsx("span",{children:g.label})]},g.id))}),e.jsxs("div",{className:"nice-dynamic-sidebar__modules",role:"navigation",children:[ne.map(g=>e.jsx(Ls,{module:g,activeRoute:s,collapsed:C,expandedModules:F,onToggleModule:T,onNavigate:W},g.id)),ne.length===0&&!C&&e.jsx("div",{className:"nice-dynamic-sidebar__empty",children:y("noData","No data")})]}),f&&e.jsx("div",{className:"nice-dynamic-sidebar__footer",children:f})]})}),{displayName:"NiceDynamicSidebar"}),Bn=10,Ps=.12,Hn="var(--nice-text-on-warning, #0f172a)";function Qe(n){return Math.min(Math.max(n,1),Bn)}function dn(n){return u.isDerivableColor(n)?u.nestingLevelColors(1,{palette:[n]},n,Hn)[0]:{bg:n,text:"inherit",hoverBg:`color-mix(in srgb, ${n} 88%, currentColor)`,activeBg:`color-mix(in srgb, ${n} 76%, currentColor)`}}function Yn(n,s,t){const c=Bn-Qe(s)+1;if(n.length===0)return[];const l=n.slice(0,c).map(dn),o=c-l.length;if(o>0){const r=n[n.length-1];if(u.isDerivableColor(r)){const p=u.nestingLevelColors(o+1,{palette:[r],bgDerivation:t,bgStep:Ps},r,Hn);l.push(...p.slice(1))}else l.push(...Array.from({length:o},()=>dn(r)))}return l}function Kn(n,s){const t={};return n.forEach((c,l)=>{const o=Qe(s)+l;t[`--nice-sidebar-level-${o}-bg`]=c.bg,t[`--nice-sidebar-level-${o}-text`]=c.text,t[`--nice-sidebar-level-${o}-hover-bg`]=c.hoverBg,t[`--nice-sidebar-level-${o}-active-bg`]=c.activeBg}),t}function Un(n,s){return n&&n.length>0?{colors:Yn(n,1,s),fromLevel:1}:{fromLevel:1}}function vn(n,s,t,c){const l=s?.levelColors?.length?s.levelColors:s?.color?[s.color]:void 0;if(!l)return{scope:n};const o=Qe(t),r=Yn(l,o,c);return{scope:{colors:r,fromLevel:o,branchColor:l[0]},vars:Kn(r,o)}}function Xe(n,s){return n.colors?.[Qe(s)-n.fromLevel]}function Bs(n){return dn(n)}const nn=n=>({id:n.id,label:n.label,icon:n.icon});function xn(n,s,t={}){const c=t.trees??["modules"],l=t.shading??"tint",o=Un(t.levelColors,l),r=(i,d,h,m,f,D)=>{const{scope:k}=vn(f,i,h,l);return s({item:i,kind:d,depth:h,ancestors:m,branchColor:k.branchColor,color:Xe(k,h)?.bg,...D})===!1?void 0:k},p=(i,d,h,m,f)=>{for(const D of i){const k=r(D,"view",d,h,m,f);k&&D.children?.length&&p(D.children,d+1,[...h,nn(D)],k,f)}},x=(i,d,h,m,f,D)=>{for(const k of i){const _={sourceId:f,moduleId:k.id,tree:D},$=r(k,"module",d,h,m,_);$&&p(k.views,d+1,[...h,nn(k)],$,_)}};for(const i of n){const d=i.source,h=r(d,"source",1,[],o,{sourceId:d.id});if(!h)continue;const m=[nn(d)];for(const f of c){if(f==="modules"){x(i.modules,2,m,h,d.id,f);continue}const D=f==="roles"?i.roles:i.units;for(const k of D){const $=r(k,f==="roles"?"role":"unit",2,m,h,{sourceId:d.id,tree:f});$&&x(k.modules,3,[...m,nn(k)],$,d.id,f)}}}}function Hs(n,s,t={}){let c;return xn(n,l=>{if(c)return!1;if(l.kind==="view"&&l.item.route===s)return c=l,!1},{trees:["modules","roles","units"],...t}),c}function Ys(n,s){const t=(l,o)=>l.map(r=>{const p=s(r,o);return r.children?.length?{...p,children:t(r.children,o+1)}:p}),c=(l,o)=>l.map(r=>({...r,views:t(r.views,o+1)}));return n.map(l=>({...l,modules:c(l.modules,2),roles:l.roles.map(o=>({...o,modules:c(o.modules,3)})),units:l.units.map(o=>({...o,modules:c(o.modules,3)}))}))}const Ue=n=>a.createElement(u.NiceIcon,{name:n,size:18}),Ks=Ue("list"),Us=Ue("user"),Vs=Ue("building"),Ws=Ue("star"),qs=Ue("search"),Gs=Ue("settings"),an={all:{icon:Ks,label:"Everything"},"by-role":{icon:Us,label:"By role"},"by-unit":{icon:Vs,label:"By unit"},favorites:{icon:Ws,label:"Favorites"},search:{icon:qs,label:"Search"},preferences:{icon:Gs,label:"Preferences"}},Xs={all:"all","by-role":"byRole","by-unit":"byUnit",favorites:"favorites",search:"search",preferences:"preferences"};function qe(n,s){const t=an[s];return t?n(`sidebarNav.mode.${Xs[s]}`,t.label):s}const Nn={enableModeIcons:!1,enabledModes:["all","by-role","by-unit","favorites","search","preferences"],activeMode:"all",pinnedSources:{},hiddenItems:[],favorites:[],maxDepth:{},collapsedIds:[],autoExpand:!0,leftClickBehavior:"focus-existing",itemOrder:{}},Js=e.jsx(u.NiceIcon,{name:"settings",size:16}),Qs=e.jsx(u.NiceIcon,{name:"columns",size:16}),Zs=e.jsx(u.NiceIcon,{name:"list",size:16}),ea=e.jsx(u.NiceIcon,{name:"eye-off",size:16}),na=e.jsx(u.NiceIcon,{name:"refresh-ccw",size:16}),gn=[{id:"prefs-general",route:"preferences/general",labelKey:"sidebar.prefs.general",labelDefault:"General",icon:Js},{id:"prefs-display",route:"preferences/display",labelKey:"sidebar.prefs.display",labelDefault:"Display",icon:Qs},{id:"prefs-order",route:"preferences/order",labelKey:"sidebar.prefs.order",labelDefault:"Order",icon:Zs},{id:"prefs-hidden",route:"preferences/hidden",labelKey:"sidebar.prefs.hidden",labelDefault:"Hidden items",icon:ea},{id:"prefs-reset",route:"preferences/reset",labelKey:"sidebar.prefs.reset",labelDefault:"Reset",icon:na}];function sa(n){return gn.map(s=>({id:s.id,label:n(s.labelKey,s.labelDefault),icon:s.icon,route:s.route}))}function Je(n){return typeof n=="string"?e.jsx(u.NiceIcon,{name:n}):n}const aa=[];function Vn(n){return`nice_sidebar_nav_${n??"_default"}`}const cn="nice-sidebar-prefs-change";function Cn(n,s){const t={...Nn,userId:n??"_default"};if(s&&Object.assign(t,s),s&&typeof s.activeMode<"u")return t;try{const c=localStorage.getItem(Vn(n));if(c){const l=JSON.parse(c);return Array.isArray(l.favorites)&&(l.favorites=l.favorites.map(o=>o&&typeof o=="object"?{...o,icon:typeof o.icon=="string"||a.isValidElement(o.icon)?o.icon:void 0}:o)),{...t,...l,userId:n??"_default"}}}catch{}return t}function Wn(n,s,t,c){const[l,o]=a.useState(()=>{const i=Cn(n,t);return s!==void 0&&(i.enableModeIcons=s),i}),r=a.useRef(t);a.useEffect(()=>{!t||r.current===t||(r.current=t,o(i=>({...i,...t})))},[t]);const p=a.useCallback(i=>{o(d=>{const h=i(d);if(!t?.activeMode)try{const m={...h,favorites:h.favorites.map(f=>({...f,icon:void 0}))};localStorage.setItem(Vn(n),JSON.stringify(m)),typeof window<"u"&&window.dispatchEvent(new CustomEvent(cn,{detail:{userId:n??"_default"}}))}catch{}return c?.(h),h})},[n,t,c]);a.useEffect(()=>{if(typeof window>"u")return;const i=d=>{d.detail?.userId===(n??"_default")&&o(m=>{const f=Cn(n,t);return s!==void 0&&(f.enableModeIcons=s),JSON.stringify(m)===JSON.stringify(f)?m:f})};return window.addEventListener(cn,i),()=>window.removeEventListener(cn,i)},[n,t,s]);const x=a.useMemo(()=>({setMode:i=>p(d=>({...d,activeMode:i})),setEnableModeIcons:i=>p(d=>({...d,enableModeIcons:i})),toggleMode:i=>p(d=>{if(i==="preferences")return d;const h=d.enabledModes.includes(i);return{...d,enabledModes:h?d.enabledModes.filter(m=>m!==i):[...d.enabledModes,i],activeMode:!h||d.activeMode!==i?d.activeMode:"all"}}),pinSource:(i,d)=>p(h=>({...h,pinnedSources:{...h.pinnedSources,[i]:[...h.pinnedSources[i]??[],d]}})),unpinSource:(i,d)=>p(h=>({...h,pinnedSources:{...h.pinnedSources,[i]:(h.pinnedSources[i]??[]).filter(m=>m!==d)}})),hideItem:i=>p(d=>({...d,hiddenItems:d.hiddenItems.some(h=>h.id===i.id)?d.hiddenItems:[...d.hiddenItems,i]})),restoreItem:i=>p(d=>({...d,hiddenItems:d.hiddenItems.filter(h=>h.id!==i)})),addFavorite:i=>p(d=>({...d,favorites:d.favorites.some(h=>h.id===i.id)?d.favorites:[...d.favorites,{...i,addedAt:Date.now()}]})),removeFavorite:i=>p(d=>({...d,favorites:d.favorites.filter(h=>h.id!==i)})),setMaxDepth:(i,d)=>p(h=>({...h,maxDepth:{...h.maxDepth,[i]:Math.min(10,Math.max(1,d))}})),toggleCollapse:i=>p(d=>({...d,collapsedIds:d.collapsedIds.includes(i)?d.collapsedIds.filter(h=>h!==i):[...d.collapsedIds,i]})),setCollapsed:(i,d)=>p(h=>({...h,collapsedIds:d?Array.from(new Set([...h.collapsedIds,...i])):h.collapsedIds.filter(m=>!i.includes(m))})),setAutoExpand:i=>p(d=>({...d,autoExpand:i})),setLeftClickBehavior:i=>p(d=>({...d,leftClickBehavior:i})),reorderItems:(i,d)=>p(h=>{const m={...h.itemOrder};return d==null?delete m[i]:m[i]=d,{...h,itemOrder:m}}),resetAll:()=>p(()=>({...Nn,userId:n??"_default"}))}),[p,n]);return[l,x]}function ia({enabledModes:n,activeMode:s,onSelect:t,collapsed:c=!1}){const l=a.useRef(null);u.useRovingFocus(l,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const o=a.useRef(null);u.useRovingFocus(o,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const{t:r}=u.useNiceTranslation(),p=[...n.filter(i=>i!=="preferences"),"preferences"],x=r("sidebarNav.modeBar.label","Navigation mode");if(c){const i=Math.max(0,p.indexOf(s)),d=p[(i-1+p.length)%p.length],h=p[(i+1)%p.length],m=an[s],f=qe(r,s);return e.jsxs("div",{className:"nice-sidebar-nav__mode-bar nice-sidebar-nav__mode-bar--carousel",ref:l,role:"tablist","aria-label":x,children:[e.jsx(Ce,{content:`${r("sidebarNav.modeBar.previous","Previous mode")}: ${qe(r,d)}`,position:"bottom",size:"sm",children:e.jsx("button",{type:"button",className:"nice-sidebar-nav__mode-arrow","aria-label":r("sidebarNav.modeBar.previous","Previous mode"),onClick:()=>t(d),children:e.jsx("span",{"aria-hidden":"true",children:"‹"})})}),e.jsx(Ce,{content:f,position:"bottom",size:"sm",children:e.jsx("button",{type:"button",role:"tab","aria-selected":!0,"aria-label":f,className:"nice-sidebar-nav__mode-pill nice-sidebar-nav__mode-pill--active nice-sidebar-nav__mode-pill--carousel",onClick:()=>t(s),children:e.jsx("span",{className:"nice-sidebar-nav__mode-pill-icon","aria-hidden":"true",children:m.icon})})}),e.jsx(Ce,{content:`${r("sidebarNav.modeBar.next","Next mode")}: ${qe(r,h)}`,position:"bottom",size:"sm",children:e.jsx("button",{type:"button",className:"nice-sidebar-nav__mode-arrow","aria-label":r("sidebarNav.modeBar.next","Next mode"),onClick:()=>t(h),children:e.jsx("span",{"aria-hidden":"true",children:"›"})})})]})}return e.jsx("div",{className:"nice-sidebar-nav__mode-bar",ref:o,role:"tablist","aria-label":x,children:p.map(i=>{const d=an[i],h=qe(r,i),m=s===i;return e.jsx(Ce,{content:h,position:"bottom",size:"sm",children:e.jsxs("button",{role:"tab","aria-selected":m,"aria-label":h,className:["nice-sidebar-nav__mode-pill",m?"nice-sidebar-nav__mode-pill--active":""].filter(Boolean).join(" "),onClick:()=>t(i),children:[e.jsx("span",{className:"nice-sidebar-nav__mode-pill-icon","aria-hidden":"true",children:d.icon}),e.jsx("span",{className:"nice-sidebar-nav__mode-pill-label",children:h})]})},i)})})}function qn({open:n,size:s=16}){return e.jsx(u.NiceIcon,{name:"chevron-down",size:s,style:{transition:"transform 160ms ease",transform:n?"rotate(0deg)":"rotate(-90deg)"}})}function ta({size:n=14}){return e.jsx(u.NiceIcon,{name:"star",size:n})}function ca({size:n=14}){return e.jsx(u.NiceIcon,{name:"star",size:n,style:{fill:"currentColor"}})}function Gn({size:n=14}){return e.jsx(u.NiceIcon,{name:"eye-off",size:n})}function la({size:n=14,filled:s=!1}){return e.jsx(u.NiceIcon,{name:"pin",size:n,style:s?{fill:"currentColor"}:void 0})}function Xn({size:n=12}){return e.jsx(u.NiceIcon,{name:"close",size:n})}function Jn({item:n,depth:s,maxDepth:t,activeRoute:c,collapsedIds:l,hiddenIds:o,autoExpand:r,sidebarCollapsed:p=!1,expandableWhenCollapsed:x=!1,onNavigate:i,onHide:d,onToggleCollapse:h,onAddFavorite:m,onRemoveFavorite:f,isFavorite:D,leftClickBehavior:k="focus-existing",routeToUrl:_,contextMenu:$=!0,disabledActions:I,colorScope:M,shading:j,path:w}){const{t:y}=u.useNiceTranslation(),V=a.useRef(null),E=(n.children?.length??0)>0&&s<t,C=l.includes(n.id),z=r?!C:C,L=!!(n.route&&c&&n.route===c),F=!!n.route,b=F&&D(n.id),{scope:v,vars:T}=a.useMemo(()=>vn(M,n,s,j),[M,n,s,j]),W=a.useMemo(()=>[...w,{id:n.id,label:n.label,icon:n.icon}],[w,n.id,n.label,n.icon]),ne=a.useCallback(R=>({forceNew:R,color:Xe(v,s)?.bg,branchColor:v.branchColor,path:W}),[v,s,W]),N=a.useCallback(()=>({id:n.id,label:n.label,icon:n.icon,route:n.route,sourceId:n.sourceId,moduleId:n.moduleId,color:v.branchColor??Xe(v,s)?.bg,addedAt:Date.now()}),[n,v,s]),g=a.useMemo(()=>{if(!$||!F||!n.route)return[];const R=n.route,q=[{id:"open",label:y("sidebar.menu.open","Open"),onClick:()=>i?.(R,n,ne(!1))},{id:"openNewTab",label:y("sidebar.menu.openNewTab","Open in new tab"),onClick:()=>i?.(R,n,ne(!0))}];return _&&q.push({id:"openBrowserTab",label:y("sidebar.menu.openBrowserTab","Open in new browser tab"),onClick:()=>{typeof window<"u"&&window.open(_(R),"_blank","noopener,noreferrer")}}),q.push({id:"sep-1",divider:!0}),b?q.push({id:"unpinFavorite",label:y("sidebar.menu.unpinFavorite","Remove from favorites"),onClick:()=>f(n.id)}):q.push({id:"pinFavorite",label:y("sidebar.menu.pinFavorite","Add to favorites"),onClick:()=>m(N())}),q.push({id:"hide",label:y("sidebar.menu.hide","Hide"),disabled:!!I?.has("hide"),onClick:()=>d({id:n.id,kind:n.kind,label:n.label})}),_&&(q.push({id:"sep-2",divider:!0}),q.push({id:"copyLink",label:y("sidebar.menu.copyLink","Copy link"),onClick:()=>{typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(_(R))}})),q},[$,I,F,n,b,_,i,m,f,d,ne,N,y]);if(o.has(n.id))return null;function A(){if(E&&!F){I?.has("collapseToggle")||h(n.id);return}F&&n.route&&(i?.(n.route,n,ne(k==="open-new")),E&&!z&&!I?.has("collapseToggle")&&h(n.id))}const P=Qe(s),G=p?W.map(R=>R.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":"",Xe(v,s)?"nice-sidebar-nav__node--colored":"",L?"nice-sidebar-nav__node--active":"",E?"nice-sidebar-nav__node--branch":"nice-sidebar-nav__node--leaf"].filter(Boolean).join(" "),"data-nice-depth":s,style:{...T,"--nice-depth":s,"--nice-row-bg":`var(--nice-sidebar-level-${P}-bg, transparent)`,"--nice-row-text":`var(--nice-sidebar-level-${P}-text, inherit)`,"--nice-row-border":`var(--nice-sidebar-level-${P}-border, transparent)`,"--nice-row-hover-bg":`var(--nice-sidebar-level-${P}-hover-bg, var(--nice-hover-bg))`,"--nice-row-active-bg":`var(--nice-sidebar-level-${P}-active-bg, var(--nice-selected-bg))`,"--nice-row-accent":`var(--nice-sidebar-level-${P}-text, var(--nice-color-primary, #3b82f6))`,"--nice-row-label":`var(--nice-sidebar-level-${P}-text, var(--nice-text-primary))`,"--nice-row-muted":`var(--nice-sidebar-level-${P}-text, var(--nice-text-muted))`},children:[e.jsxs("div",{className:"nice-sidebar-nav__node-row",ref:V,children:[E&&e.jsx(Ce,{content:z?y("sidebarNav.collapse","Collapse"):y("sidebarNav.expand","Expand"),position:"right",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__collapse-btn","aria-label":z?y("sidebarNav.collapse","Collapse"):y("sidebarNav.expand","Expand"),"aria-expanded":z,disabled:I?.has("collapseToggle"),onClick:()=>h(n.id),children:e.jsx(qn,{open:z,size:20})})}),!E&&e.jsx("span",{className:"nice-sidebar-nav__collapse-spacer"}),e.jsx(Ce,{content:G,position:"right",size:"sm",children:e.jsxs("span",{role:F?"link":void 0,tabIndex:F?0:void 0,className:["nice-sidebar-nav__node-content",F?"nice-sidebar-nav__node-content--link":"",!F&&E?"nice-sidebar-nav__node-content--toggle":""].filter(Boolean).join(" "),onClick:A,onKeyDown:R=>(R.key==="Enter"||R.key===" ")&&A(),children:[n.icon&&e.jsx("span",{className:"nice-sidebar-nav__node-icon","aria-hidden":"true",children:Je(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} ${y("sidebarNav.notifications","notifications")}`,children:n.badge})]})}),e.jsxs("div",{className:"nice-sidebar-nav__node-actions",children:[F&&!D(n.id)&&e.jsx(Ce,{content:y("sidebarNav.addFavorite","Add to favorites"),position:"top",size:"sm",children:e.jsx("button",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--fav","aria-label":y("sidebarNav.addFavorite","Add to favorites"),onClick:R=>{R.stopPropagation(),m(N())},children:e.jsx(ta,{size:14})})}),D(n.id)&&e.jsx(Ce,{content:"W ulubionych",position:"top",size:"sm",children:e.jsx("span",{className:"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--fav-active","aria-label":y("sidebarNav.inFavorites","In favorites"),children:e.jsx(ca,{size:14})})}),e.jsx(Ce,{content:y("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":y("sidebarNav.hideItem","Hide item"),onClick:R=>{R.stopPropagation(),d({id:n.id,kind:n.kind,label:n.label})},children:e.jsx(Gn,{size:14})})})]})]}),g.length>0&&e.jsx(fn,{target:V,items:g,size:"sm"}),E&&z&&e.jsx("ul",{className:"nice-sidebar-nav__children",children:n.children.map(R=>e.jsx(Jn,{item:R,depth:s+1,maxDepth:t,activeRoute:c,collapsedIds:l,hiddenIds:o,autoExpand:r,sidebarCollapsed:p,expandableWhenCollapsed:x,onNavigate:i,onHide:d,onToggleCollapse:h,onAddFavorite:m,onRemoveFavorite:f,isFavorite:D,leftClickBehavior:k,routeToUrl:_,contextMenu:$,disabledActions:I,colorScope:v,shading:j,path:W},R.id))})]})}function ra(n,s){if(!s||s.length===0)return n;const t=new Map(s.map((l,o)=>[l,o])),c=s.length;return[...n].sort((l,o)=>{const r=t.has(l.id)?t.get(l.id):c+n.indexOf(l),p=t.has(o.id)?t.get(o.id):c+n.indexOf(o);return r-p})}function Qn(n,s,t){return n.map(c=>({id:c.id,label:c.label,tooltip:c.tooltip,icon:c.icon,route:c.route,badge:c.badge,kind:"view",sourceId:s,moduleId:t,color:c.color,levelColors:c.levelColors,children:c.children?.length?Qn(c.children,s,t):[]}))}function Zn(n,s,t=n.id){return{id:t,label:n.label,tooltip:n.tooltip,icon:n.icon,kind:"module",sourceId:s,color:n.color,levelColors:n.levelColors,children:Qn(n.views,s,n.id)}}function oa(n,s){return n.map(t=>Zn(t,s))}function es(n,s,t){return n.map(c=>({id:c.id,label:c.label,tooltip:c.tooltip,icon:c.icon,kind:s,sourceId:t,color:c.color,levelColors:c.levelColors,children:c.modules.map(l=>Zn(l,t,`${c.id}:${l.id}`))}))}function da(n,s){return es(n,"role",s)}function ua(n,s){return es(n,"unit",s)}function ns(n,s){for(const t of n){if(t.route===s)return[];if(t.children?.length){const c=ns(t.children,s);if(c)return[t.id,...c]}}}function ma({node:n,mode:s,maxDepth:t,isPinned:c,prefs:l,helpers:o,activeRoute:r,onNavigate:p,sidebarCollapsed:x=!1,expandableWhenCollapsed:i=!1,routeToUrl:d,contextMenu:h=!0,disabledActions:m,showHeader:f=!0,colorScope:D,shading:k}){const{t:_}=u.useNiceTranslation(),$=a.useRef(null),I=a.useMemo(()=>new Set(l.hiddenItems.map(g=>g.id)),[l.hiddenItems]),{scope:M,vars:j}=a.useMemo(()=>vn(D,n.source,1,k),[D,n.source,k]),w=a.useMemo(()=>{const g=Xe(M,1);return g?{...j,"--nice-source-head-bg":g.bg,"--nice-source-head-color":g.text,"--nice-source-head-bg-active":g.activeBg,"--nice-source-head-accent":g.text}:j},[M,j]),y=a.useMemo(()=>[{id:n.source.id,label:n.source.label,icon:n.source.icon}],[n.source.id,n.source.label,n.source.icon]),V=a.useMemo(()=>{let g;return s==="all"?g=oa(n.modules,n.source.id):s==="by-role"?g=da(n.roles,n.source.id):g=ua(n.units,n.source.id),ra(g,l.itemOrder[s])},[s,n,l.itemOrder]),E=a.useCallback(g=>l.favorites.some(A=>A.id===g),[l.favorites]),C=a.useRef(void 0);a.useEffect(()=>{if(!r||C.current===r)return;const g=ns(V,r);if(!g)return;C.current=r;const A=g.filter(P=>l.autoExpand?l.collapsedIds.includes(P):!l.collapsedIds.includes(P));A.length>0&&o.setCollapsed(A,!l.autoExpand)},[r,V,l.autoExpand,l.collapsedIds,o]);const z=a.useMemo(()=>h?[{id:c?"unpinSource":"pinSource",label:c?_("sidebar.menu.unpinSource","Unpin source"):_("sidebar.menu.pinSource","Pin source"),onClick:()=>c?o.unpinSource(s,n.source.id):o.pinSource(s,n.source.id)},{id:"hideSource",label:_("sidebar.menu.hideSource","Hide source"),disabled:!!m?.has("hide"),onClick:()=>o.hideItem({id:n.source.id,kind:"source",label:n.source.label})}]:[],[h,m,c,o,s,n.source,_]);if(I.has(n.source.id))return null;const L=l.collapsedIds.includes(n.source.id),F=l.autoExpand?!L:L,b=V.filter(g=>(g.children?.length??0)>0).map(g=>g.id),v=b.length>0,T=v&&b.every(g=>l.collapsedIds.includes(g)),W=v?!T:F,ne=!f||v?!0:F,N=()=>{m?.has("collapseToggle")||(v?o.setCollapsed(b,!T):o.toggleCollapse(n.source.id))};return e.jsxs("section",{className:"nice-sidebar-nav__source-section",style:w,children:[f&&e.jsx(Ce,{content:n.source.tooltip??n.source.label,position:"right",size:"sm",children:e.jsxs("div",{ref:$,className:"nice-sidebar-nav__source-header",onClick:g=>{g.target.closest(".nice-sidebar-nav__source-actions")||N()},role:"button",tabIndex:0,"aria-expanded":W,onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),N())},children:[e.jsx("span",{className:"nice-sidebar-nav__source-chevron","aria-hidden":"true",children:e.jsx(qn,{open:W,size:16})}),n.source.icon&&e.jsx("span",{className:"nice-sidebar-nav__source-icon","aria-hidden":"true",children:Je(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:g=>g.stopPropagation(),onKeyDown:g=>{g.key!=="Escape"&&g.stopPropagation()},children:[e.jsx(Ce,{content:c?_("sidebarNav.unpinSource","Unpin source"):_("sidebarNav.pinSource","Pin source"),position:"top",size:"sm",children:e.jsx("button",{className:["nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--pin",c?"nice-sidebar-nav__action-btn--pin-active":""].filter(Boolean).join(" "),"aria-label":c?_("sidebarNav.unpinSource","Unpin source"):_("sidebarNav.pinSource","Pin source"),onClick:()=>c?o.unpinSource(s,n.source.id):o.pinSource(s,n.source.id),children:e.jsx(la,{size:14,filled:c})})}),e.jsx(Ce,{content:_("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":_("sidebarNav.hideSource","Hide source"),onClick:()=>o.hideItem({id:n.source.id,kind:"source",label:n.source.label}),children:e.jsx(Gn,{size:14})})})]})]})}),f&&z.length>0&&e.jsx(fn,{target:$,items:z,size:"sm"}),t>1&&ne&&e.jsx("ul",{className:"nice-sidebar-nav__tree",children:V.map(g=>e.jsx(Jn,{item:g,depth:2,maxDepth:t,activeRoute:r,collapsedIds:l.collapsedIds,hiddenIds:I,autoExpand:l.autoExpand,sidebarCollapsed:x,expandableWhenCollapsed:i,onNavigate:p,onHide:o.hideItem,onToggleCollapse:o.toggleCollapse,onAddFavorite:o.addFavorite,onRemoveFavorite:o.removeFavorite,isFavorite:E,leftClickBehavior:l.leftClickBehavior,routeToUrl:d,contextMenu:h,disabledActions:m,colorScope:M,shading:k,path:y},g.id))})]})}function ha({favorites:n,activeRoute:s,onNavigate:t,onRemove:c,collapsed:l=!1,leftClickBehavior:o="focus-existing"}){const{t:r}=u.useNiceTranslation(),p=o==="open-new";return n.length===0?e.jsx("p",{className:"nice-sidebar-nav__empty",children:r("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(x=>{const i=!!(x.route&&x.route===s),d={forceNew:p,color:x.color,branchColor:x.color},h=x.color?Bs(x.color):void 0;return e.jsxs("li",{className:["nice-sidebar-nav__fav-item",i?"nice-sidebar-nav__fav-item--active":"",h?"nice-sidebar-nav__fav-item--colored":""].filter(Boolean).join(" "),style:h?{"--nice-fav-bg":h.bg,"--nice-fav-text":h.text,"--nice-fav-hover-bg":h.hoverBg}:void 0,children:[e.jsx(Ce,{content:x.tooltip??x.label,position:"right",size:"sm",children:e.jsxs("span",{role:"link",tabIndex:0,className:"nice-sidebar-nav__fav-content",onClick:()=>{x.route&&t?.(x.route,x,d)},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&x.route&&t?.(x.route,x,d)},children:[(typeof x.icon=="string"||a.isValidElement(x.icon))&&e.jsx("span",{className:"nice-sidebar-nav__fav-icon","aria-hidden":"true",children:Je(x.icon)}),e.jsx("span",{className:"nice-sidebar-nav__fav-label",children:x.label})]})}),!l&&e.jsx(Ce,{content:r("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":r("sidebarNav.removeFavourite","Remove from favourites"),onClick:()=>c(x.id),children:e.jsx(Xn,{size:12})})})]},x.id)})})}function pa(n,s,t){const c=[],l=new Set;return xn(n,o=>{if(o.kind!=="view")return;const r=o.item;if(r.children?.length&&!r.route)return;const p=`${o.sourceId}::${r.id}`;l.has(p)||(l.add(p),c.push({view:r,breadcrumb:o.ancestors,color:o.color,branchColor:o.branchColor}))},{trees:["modules","roles","units"],levelColors:s,shading:t}),c}function ba({data:n,activeRoute:s,onNavigate:t,hiddenIds:c,leftClickBehavior:l="focus-existing",levelColors:o,shading:r}){const{t:p}=u.useNiceTranslation(),[x,i]=a.useState(""),d=l==="open-new",h=a.useMemo(()=>pa(n,o,r),[n,o,r]),m=a.useMemo(()=>{const f=x.trim().toLowerCase();return f?h.filter(D=>c.has(D.view.id)||D.breadcrumb.some(k=>c.has(k.id))?!1:D.view.label.toLowerCase().includes(f)?!0:D.breadcrumb.some(k=>k.label.toLowerCase().includes(f))):[]},[h,x,c]);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(u.NiceIcon,{name:"search",size:14})}),e.jsx("input",{type:"text",className:"nice-sidebar-nav__search-input",placeholder:p("sidebarNav.search.placeholder","Search views…"),value:x,onChange:f=>i(f.target.value),autoFocus:!0,"aria-label":p("sidebarNav.search.label","Search views")}),x&&e.jsx("button",{type:"button",className:"nice-sidebar-nav__search-clear","aria-label":p("common.clear","Clear"),onClick:()=>i(""),children:e.jsx(Xn,{size:12})})]}),!x.trim()&&e.jsx("p",{className:"nice-sidebar-nav__empty",children:p("sidebarNav.searchHint","Type to search every view available in the panel.")}),x.trim()&&m.length===0&&e.jsxs("p",{className:"nice-sidebar-nav__empty",children:[p("sidebarNav.noResults","No results for")," “",x,"”."]}),m.length>0&&e.jsx("ul",{className:"nice-sidebar-nav__search-results",children:m.map((f,D)=>{const k=!!(f.view.route&&f.view.route===s),_=!!f.view.route;return e.jsx("li",{className:["nice-sidebar-nav__search-result",k?"nice-sidebar-nav__search-result--active":""].filter(Boolean).join(" "),children:e.jsxs("button",{type:"button",className:"nice-sidebar-nav__search-result-btn",disabled:!_,onClick:()=>{_&&f.view.route&&t?.(f.view.route,f.view,{forceNew:d,color:f.color,branchColor:f.branchColor,path:[...f.breadcrumb,{id:f.view.id,label:f.view.label}]})},children:[e.jsx("span",{className:"nice-sidebar-nav__search-result-breadcrumb",children:f.breadcrumb.map(($,I)=>e.jsxs("span",{className:"nice-sidebar-nav__search-crumb",children:[$.icon&&e.jsx("span",{className:"nice-sidebar-nav__search-crumb-icon","aria-hidden":"true",children:Je($.icon)}),e.jsx("span",{className:"nice-sidebar-nav__search-crumb-label",children:$.label}),e.jsx("span",{className:"nice-sidebar-nav__search-crumb-sep","aria-hidden":"true",children:"›"})]},`${$.id}-${I}`))}),e.jsxs("span",{className:"nice-sidebar-nav__search-result-view",children:[f.view.icon&&e.jsx("span",{className:"nice-sidebar-nav__node-icon","aria-hidden":"true",children:Je(f.view.icon)}),e.jsx("span",{className:"nice-sidebar-nav__node-label",children:f.view.label}),f.view.badge!==void 0&&e.jsx("span",{className:"nice-sidebar-nav__node-badge",children:f.view.badge})]})]})},`${f.view.id}-${D}`)})})]})}function _a({activeRoute:n,onNavigate:s,leftClickBehavior:t="focus-existing"}){const{t:c}=u.useNiceTranslation(),l=t==="open-new";return e.jsx("ul",{className:"nice-sidebar-nav__prefs-categories",role:"list",children:gn.map(o=>{const r=c(o.labelKey,o.labelDefault),p=n===o.route,x={id:o.id,label:r,icon:o.icon,route:o.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(Ce,{content:r,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?.(o.route,x,{forceNew:l}),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),s?.(o.route,x,{forceNew:l}))},children:[e.jsx("span",{className:"nice-sidebar-nav__node-icon","aria-hidden":"true",children:o.icon}),e.jsx("span",{className:"nice-sidebar-nav__node-label",children:r})]})})]})},o.id)})})}const fa=a.forwardRef(function({data:s=aa,userId:t,activeRoute:c,onNavigate:l,enableModeIcons:o,preferences:r,onPreferencesChange:p,width:x=264,collapsedWidth:i=56,position:d="left",minimal:h=!1,showModeStrip:m,showSources:f,showFavorites:D,showFooterPreferences:k,sticky:_=!0,surfaceOpacity:$,embedded:I=!1,header:M,footerExtra:j,collapsed:w,onCollapsedChange:y,expandableWhenCollapsed:V=!1,size:E="md",className:C,routeToUrl:z,contextMenu:L=!0,disabledContextMenuActions:F,readonly:b=!1,levelColors:v,levelShading:T="auto","data-testid":W},ne){const{t:N}=u.useNiceTranslation(),g=a.useContext(u.NiceThemeContext),A=T==="auto"?g?.theme.darkMode==="dark"?"shade":"tint":T,P=a.useMemo(()=>Un(v,A),[v,A]),G=a.useMemo(()=>{const ue=new Set(F??[]);return b&&["hide","reorder","rename","newGroup"].forEach(O=>ue.add(O)),ue},[F,b]),R=m??!h,q=f??!h,ie=D??!h,Z=k??!h,[ee,J]=a.useState(!1),se=I?!1:w??ee,fe=a.useCallback(()=>{const ue=!se;y?y(ue):J(ue)},[se,y]),[X,B]=Wn(t,o,r,p),te=a.useMemo(()=>{const ue=X.activeMode;if(ue==="favorites"||ue==="preferences"||ue==="search")return s;const O=X.pinnedSources[ue];return!O||O.length===0?s:s.filter(U=>O.includes(U.source.id))},[s,X.activeMode,X.pinnedSources]),pe=X.maxDepth[X.activeMode],_e=pe==null||pe>=10?Number.POSITIVE_INFINITY:pe;function we(){const ue=X.activeMode;if(ie&&ue==="favorites")return e.jsx(ha,{favorites:X.favorites,activeRoute:c,onNavigate:l,onRemove:B.removeFavorite,collapsed:se,leftClickBehavior:X.leftClickBehavior});if(Z&&ue==="preferences")return e.jsx(_a,{activeRoute:c,onNavigate:l,leftClickBehavior:X.leftClickBehavior});if(R&&ue==="search"){const O=new Set(X.hiddenItems.map(U=>U.id));return e.jsx(ba,{data:s,activeRoute:c,onNavigate:l,hiddenIds:O,leftClickBehavior:X.leftClickBehavior,levelColors:v,shading:A})}return te.length===0?e.jsx("p",{className:"nice-sidebar-nav__empty",children:N("sidebarNav.noSources","No data sources are visible in this mode.")}):te.map(O=>{const U=(X.pinnedSources[ue]??[]).includes(O.source.id);return e.jsx(ma,{node:O,mode:ue,maxDepth:_e,isPinned:U,prefs:X,helpers:B,activeRoute:c,onNavigate:l,sidebarCollapsed:se,expandableWhenCollapsed:V,routeToUrl:z,contextMenu:L,disabledActions:G,showHeader:q,colorScope:P,shading:A},O.source.id)})}const Ne=["nice-sidebar-nav",`nice-sidebar-nav--${E}`,`nice-sidebar-nav--${d}`,h?"nice-sidebar-nav--minimal":"",I?"nice-sidebar-nav--embedded":"",_&&!I?"nice-sidebar-nav--sticky":"",X.enableModeIcons&&R?"nice-sidebar-nav--with-strip":"",se?"nice-sidebar-nav--collapsed":"",se&&V?"nice-sidebar-nav--expandable-collapsed":"",C].filter(Boolean).join(" "),ze={...$!=null?{"--nice-sidebar-surface-alpha":String($)}:{},...P.colors?Kn(P.colors,1):{}},ge=I?{width:"100%",...ze}:{"--nice-sidebar-w":`${x}px`,"--nice-sidebar-w-collapsed":`${i}px`,width:se?i:x,...ze};return e.jsxs("div",{ref:ne,className:Ne,style:ge,"data-testid":W,"data-mode":X.activeMode,children:[M!=null&&e.jsx("div",{className:"nice-sidebar-nav__header",children:M}),X.enableModeIcons&&R&&e.jsx(ia,{enabledModes:X.enabledModes,activeMode:X.activeMode,onSelect:B.setMode,collapsed:se}),e.jsx("div",{className:"nice-sidebar-nav__content",children:e.jsx("div",{className:"nice-sidebar-nav__body",children:we()})}),!I&&e.jsxs("div",{className:"nice-sidebar-nav__footer",children:[e.jsxs("button",{type:"button",className:"nice-sidebar-nav__footer-toggle",onClick:fe,"aria-label":se?N("sidebarNav.expand","Expand the sidebar"):N("sidebarNav.collapseToIcons","Collapse to icons"),title:se?N("sidebarNav.expand","Expand the sidebar"):N("sidebarNav.collapseToIcons","Collapse to icons"),children:[e.jsx("span",{className:"nice-sidebar-nav__footer-toggle-icon","aria-hidden":"true",children:e.jsx(u.NiceIcon,{name:"chevron-left",size:18,style:{transition:"transform 160ms ease",transform:(d==="right"?!se:se)?"rotate(180deg)":"rotate(0deg)"}})}),e.jsx("span",{className:"nice-sidebar-nav__footer-toggle-label",children:se?N("sidebarNav.expandShort","Expand"):N("sidebarNav.collapseToIcons","Collapse to icons")})]}),j!=null&&e.jsx("div",{className:"nice-sidebar-nav__footer-extra",children:j})]}),I&&j!=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:j})})]})}),va=Object.assign(a.forwardRef(({user:n,userMenuItems:s,onProfile:t,onLogout:c,showLogin:l=!0,loginLabel:o,onLoginClick:r,showRegister:p,registerLabel:x,onRegisterClick:i,size:d="md",compact:h=!1,className:m,style:f,id:D,"data-testid":k="nice-auth-buttons"},_)=>{const{t:$}=u.useNiceTranslation(),I=["nice-auth-buttons",`nice-auth-buttons--${d}`,h?"nice-auth-buttons--compact":"",m??""].filter(Boolean).join(" ");if(n)return e.jsx("div",{ref:_,id:D,className:I,style:f,"data-testid":k,children:e.jsx(Pn,{userName:n.name,userEmail:n.email,userRole:n.role,avatarUrl:n.avatarUrl,status:n.status,items:s,onProfile:t,onLogout:c,size:d})});const M=p??!!i;return e.jsxs("div",{ref:_,id:D,className:I,style:f,"data-testid":k,children:[l&&r&&e.jsx(Ke.NiceButton,{variant:"ghost",size:d,onClick:r,className:"nice-auth-buttons__login",children:o??$("auth.signIn","Sign in")}),M&&i&&e.jsx(Ke.NiceButton,{variant:"primary",size:d,onClick:i,className:"nice-auth-buttons__register",children:x??$("auth.register","Register")})]})}),{displayName:"NiceAuthButtons"}),xa=[];function wn(n){return!n.children||n.children.length===0}function ss(n,s){return s?n.id===s?!0:(n.children??[]).some(t=>ss(t,s)):!1}const Na=Object.assign(a.forwardRef(({items:n=xa,activeId:s,size:t="md",align:c="start",ariaLabel:l,stretch:o=!1,trigger:r="click",hoverCloseDelay:p=150,className:x,style:i,id:d,"data-testid":h="nice-nav-menu"},m)=>{const{t:f}=u.useNiceTranslation(),D=a.useId(),[k,_]=a.useState(null),$=a.useRef(null),I=a.useRef(null),M=a.useCallback(()=>{I.current&&(clearTimeout(I.current),I.current=null)},[]),j=a.useCallback(()=>{M(),I.current=setTimeout(()=>{_(null),I.current=null},p)},[M,p]);a.useEffect(()=>()=>M(),[M]);const w=r==="hover",y=N=>!!(N.megaPanel||N.megaColumns&&N.megaColumns.length>0),V=a.useCallback(N=>{$.current=N,typeof m=="function"?m(N):m&&(m.current=N)},[m]);a.useEffect(()=>{if(!k)return;const N=g=>{$.current?.contains(g.target)||_(null)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[k]);const E=a.useRef(null),C=a.useRef(null),z=a.useRef(null),L=k?n.find(N=>N.id===k.itemId):void 0;u.useRovingFocus(E,{orientation:"horizontal",wrap:!0,itemSelector:"[data-nice-nav-id]"}),u.useOverlayFocus(C,{open:k!=null&&!k.byPointer,modal:!1,onClose:()=>_(null)}),u.useRovingFocus(C,{orientation:L&&y(L)?"grid":"vertical",wrap:!0,typeahead:!0}),u.useOverlayFocus(z,{open:k?.submenuId!=null&&!k.byPointer&&!k.subByPointer,modal:!1,onClose:()=>_(N=>N&&{...N,submenuId:null})}),u.useRovingFocus(z,{orientation:"vertical",wrap:!0,typeahead:!0});const F=a.useMemo(()=>n.filter(N=>!N.divider),[n]),b=N=>{const g=!wn(N),A=y(N),P=g||A,G=k?.itemId===N.id,q=["nice-nav-menu__item",ss(N,s)?"nice-nav-menu__item--active":"",G?"nice-nav-menu__item--open":"",N.disabled?"nice-nav-menu__item--disabled":"",A?"nice-nav-menu__item--mega":""].filter(Boolean).join(" "),ie=ee=>{const J=ee.nativeEvent.niceSource;P&&(ee.key==="Enter"||ee.key===" "||ee.key==="ArrowDown"&&J!=="gamepad")&&(ee.preventDefault(),_({itemId:N.id,submenuId:null}))},Z=e.jsxs(e.Fragment,{children:[N.icon!=null&&e.jsx("span",{className:"nice-nav-menu__item-icon","aria-hidden":"true",children:N.icon}),e.jsx("span",{className:"nice-nav-menu__item-label",children:N.label}),N.badge!=null&&e.jsx("span",{className:"nice-nav-menu__item-badge",children:N.badge}),P&&e.jsx("span",{className:"nice-nav-menu__item-chevron","aria-hidden":"true",children:e.jsx(u.NiceIcon,{name:"chevron-down",size:14})})]});return P?e.jsxs("li",{className:`nice-nav-menu__li${A?" nice-nav-menu__li--mega":""}`,onMouseEnter:w?()=>{M(),_(ee=>ee?.itemId===N.id?ee:{itemId:N.id,submenuId:null,byPointer:!0})}:void 0,onMouseLeave:w?j:void 0,children:[e.jsx("button",{type:"button",className:q,"data-nice-nav-id":N.id,"aria-haspopup":A?"true":"menu","aria-expanded":G,"aria-controls":`${D}-panel-${N.id}`,disabled:N.disabled,onClick:()=>{_(w?ee=>ee?.itemId===N.id?null:{itemId:N.id,submenuId:null}:ee=>ee?.itemId===N.id?null:{itemId:N.id,submenuId:null})},onKeyDown:ie,children:Z}),G&&(A?v(N):T(N))]},N.id):N.href&&!N.disabled?e.jsx("li",{className:"nice-nav-menu__li",children:e.jsx("a",{href:N.href,target:N.target,rel:N.rel,className:q,"data-nice-nav-id":N.id,onKeyDown:ie,onClick:ee=>{N.onClick?.(ee),_(null)},children:Z})},N.id):e.jsx("li",{className:"nice-nav-menu__li",children:e.jsx("button",{type:"button",className:q,"data-nice-nav-id":N.id,disabled:N.disabled,onClick:ee=>{N.onClick?.(ee),_(null)},onKeyDown:ie,children:Z})},N.id)},v=N=>{const g=`${D}-panel-${N.id}`,A=typeof N.megaPanel=="function"?N.megaPanel():N.megaPanel;return e.jsx("div",{ref:C,id:g,role:"menu","aria-label":typeof N.label=="string"?N.label:void 0,className:"nice-nav-menu__mega",onMouseEnter:w?M:void 0,onMouseLeave:w?j:void 0,children:e.jsxs("div",{className:"nice-nav-menu__mega-inner",children:[A??e.jsx("div",{className:"nice-nav-menu__mega-grid",children:(N.megaColumns??[]).map((P,G)=>e.jsxs("div",{className:"nice-nav-menu__mega-col",children:[P.title!=null&&e.jsx("div",{className:"nice-nav-menu__mega-col-title",children:P.title}),e.jsx("ul",{className:"nice-nav-menu__mega-col-list",children:P.items.map(R=>e.jsx("li",{className:"nice-nav-menu__mega-col-li",children:R.href?e.jsxs("a",{role:"menuitem",className:"nice-nav-menu__mega-col-item",href:R.href,target:R.target,rel:R.rel,onClick:q=>{R.onClick?.(q),_(null)},children:[R.icon!=null&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-icon","aria-hidden":"true",children:R.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:R.label}),R.description&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-desc",children:R.description})]})]}):e.jsxs("button",{type:"button",role:"menuitem",className:"nice-nav-menu__mega-col-item",disabled:R.disabled,onClick:q=>{R.onClick?.(q),_(null)},children:[R.icon!=null&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-icon","aria-hidden":"true",children:R.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:R.label}),R.description&&e.jsx("span",{className:"nice-nav-menu__mega-col-item-desc",children:R.description})]})]})},R.id))}),P.footer!=null&&e.jsx("div",{className:"nice-nav-menu__mega-col-footer",children:P.footer})]},G))}),N.megaFooter!=null&&e.jsx("div",{className:"nice-nav-menu__mega-footer",children:N.megaFooter})]})})},T=N=>{const g=N.children??[],A=`${D}-panel-${N.id}`,P=c==="end"?"nice-nav-menu__panel--end":"nice-nav-menu__panel--start";return e.jsx("div",{ref:C,id:A,role:"menu","aria-label":typeof N.label=="string"?N.label:void 0,className:`nice-nav-menu__panel ${P}`,children:e.jsx("ul",{className:"nice-nav-menu__panel-list",children:g.map((G,R)=>W(N.id,G,R))})})},W=(N,g,A)=>{if(g.divider)return e.jsx("li",{className:"nice-nav-menu__panel-divider",role:"separator"},`div-${A}`);const P=!wn(g),G=k?.itemId===N&&k.submenuId===g.id,R=["nice-nav-menu__panel-item",g.disabled?"nice-nav-menu__panel-item--disabled":"",g.danger?"nice-nav-menu__panel-item--danger":"",G?"nice-nav-menu__panel-item--open":"",g.id===s?"nice-nav-menu__panel-item--active":""].filter(Boolean).join(" "),q=(J,se=!1)=>_(fe=>fe&&fe.itemId===N?{...fe,submenuId:J,subByPointer:se}:{itemId:N,submenuId:J,subByPointer:se}),ie=J=>{J.key==="ArrowRight"&&P?(J.preventDefault(),q(g.id)):J.key==="ArrowLeft"&&(J.preventDefault(),k?.submenuId?q(null):(_(null),$.current?.querySelector(`[data-nice-nav-id="${N}"]`)?.focus()))},Z=e.jsxs(e.Fragment,{children:[g.icon!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-icon","aria-hidden":"true",children:g.icon}),e.jsxs("span",{className:"nice-nav-menu__panel-item-text",children:[e.jsx("span",{className:"nice-nav-menu__panel-item-label",children:g.label}),g.description&&e.jsx("span",{className:"nice-nav-menu__panel-item-desc",children:g.description})]}),g.badge!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-badge",children:g.badge}),P&&e.jsx("span",{className:"nice-nav-menu__panel-item-chevron","aria-hidden":"true",children:e.jsx(u.NiceIcon,{name:"chevron-right",size:14})})]}),ee=P?e.jsx("button",{type:"button",role:"menuitem",className:R,"data-nice-panel-id":`${N}-${g.id}`,"aria-haspopup":"menu","aria-expanded":G,disabled:g.disabled,onClick:()=>q(G?null:g.id),onMouseEnter:()=>{G||q(g.id,!0)},onKeyDown:ie,children:Z}):g.href&&!g.disabled?e.jsx("a",{role:"menuitem",className:R,"data-nice-panel-id":`${N}-${g.id}`,href:g.href,target:g.target,rel:g.rel,onMouseEnter:()=>k?.submenuId&&q(null,!0),onClick:J=>{g.onClick?.(J),_(null)},onKeyDown:ie,children:Z}):e.jsx("button",{type:"button",role:"menuitem",className:R,"data-nice-panel-id":`${N}-${g.id}`,disabled:g.disabled,onMouseEnter:()=>k?.submenuId&&q(null,!0),onClick:J=>{g.onClick?.(J),_(null)},onKeyDown:ie,children:Z});return e.jsxs("li",{className:"nice-nav-menu__panel-li",children:[ee,P&&G&&ne(N,g)]},g.id)},ne=(N,g)=>{const A=g.children??[];return e.jsxs("div",{ref:z,role:"menu","aria-label":typeof g.label=="string"?g.label:void 0,className:"nice-nav-menu__subpanel",onKeyDown:P=>{P.key==="ArrowLeft"&&(P.preventDefault(),P.stopPropagation(),_(G=>G&&{...G,submenuId:null}))},children:[e.jsx("ul",{className:"nice-nav-menu__panel-list",children:A.map((P,G)=>{if(P.divider)return e.jsx("li",{className:"nice-nav-menu__panel-divider",role:"separator"},`subdiv-${G}`);const R=["nice-nav-menu__panel-item",P.disabled?"nice-nav-menu__panel-item--disabled":"",P.danger?"nice-nav-menu__panel-item--danger":"",P.id===s?"nice-nav-menu__panel-item--active":""].filter(Boolean).join(" "),q=e.jsxs(e.Fragment,{children:[P.icon!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-icon","aria-hidden":"true",children:P.icon}),e.jsxs("span",{className:"nice-nav-menu__panel-item-text",children:[e.jsx("span",{className:"nice-nav-menu__panel-item-label",children:P.label}),P.description&&e.jsx("span",{className:"nice-nav-menu__panel-item-desc",children:P.description})]}),P.badge!=null&&e.jsx("span",{className:"nice-nav-menu__panel-item-badge",children:P.badge})]});return e.jsx("li",{className:"nice-nav-menu__panel-li",children:P.href&&!P.disabled?e.jsx("a",{role:"menuitem",className:R,href:P.href,target:P.target,rel:P.rel,onClick:ie=>{P.onClick?.(ie),_(null)},children:q}):e.jsx("button",{type:"button",role:"menuitem",className:R,disabled:P.disabled,onClick:ie=>{P.onClick?.(ie),_(null)},children:q})},P.id)})}),e.jsx("span",{hidden:!0,"data-parent-id":N})]})};return e.jsx("nav",{ref:V,id:d,className:["nice-nav-menu",`nice-nav-menu--${t}`,o?"nice-nav-menu--stretch":"",x??""].filter(Boolean).join(" "),style:i,"aria-label":l??f("nav.primary","Primary navigation"),"data-testid":h,children:e.jsx("ul",{className:"nice-nav-menu__list",ref:E,children:F.map(b)})})}),{displayName:"NiceNavMenu"}),ga=[],ja=Object.assign(a.forwardRef(({tabs:n=ga,activeIndex:s,defaultActiveIndex:t,renderTab:c,onActiveChange:l,onCloseTab:o,onReorderTabs:r,onSaveState:p,enableShortcuts:x=!0,maxTabs:i=0,showDirtyIndicator:d=!0,tabBarPosition:h="top",draggable:m=!0,showAddButton:f=!1,onAddTab:D,keepAlive:k=!0,warnOnUnsavedClose:_=!0,maxClosedTabs:$=10,onUndoCloseTab:I,getTabState:M,unsavedWarningMessage:j,className:w,style:y,id:V,accessMode:E,...C},z)=>{const L=a.useRef(null);u.useRovingFocus(L,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const F=u.useControlId(V),b=u.useNiceAccessMode(E,V),{t:v}=u.useNiceTranslation(),[T,W]=u.useControllableState({value:s,defaultValue:t,fallbackValue:0,onChange:l,componentName:"NiceMdiWorkspace"}),ne=a.useRef(null),[N,g]=a.useState(null),[A,P]=a.useState(null),[G,R]=a.useState([]),[q,ie]=a.useState(null),Z=a.useCallback((O,U,ce=!1)=>{if(!ce&&_&&O.isDirty){ie({tab:O,index:U});return}const ae={tab:{...O},originalIndex:U,closedAt:Date.now(),state:M?.(O)};R(Q=>[ae,...Q].slice(0,$)),o?.(O,U)},[_,$,M,o]),ee=a.useCallback(()=>{if(G.length===0)return;const[O,...U]=G;R(U),I?.(O)},[G,I]);a.useEffect(()=>{if(!x)return;const O=U=>{const ce=U.ctrlKey||U.metaKey;if(ce&&U.key==="w"){U.preventDefault();const ae=n[T];ae&&ae.closable!==!1&&Z(ae,T)}else if(ce&&U.key==="Tab"){U.preventDefault();const ae=U.shiftKey?-1:1,Q=(T+ae+n.length)%n.length;W(Q)}else ce&&U.shiftKey&&(U.key==="t"||U.key==="T")&&(U.preventDefault(),ee())};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[x,n,T,Z,ee,W]),a.useEffect(()=>{if(!p)return;const O=setTimeout(()=>{p({tabs:n,activeTabIndex:T})},500);return()=>clearTimeout(O)},[n,T,p]);const J=a.useCallback(O=>{m&&P(O)},[m]),se=a.useCallback((O,U)=>{O.preventDefault()},[A]),fe=a.useCallback((O,U)=>{if(O===U||U<0||U>=n.length)return;const ce=[...n],[ae]=ce.splice(O,1);ce.splice(U,0,ae),r?.(ce);let Q=T;T===O?Q=U:O<T&&U>=T?Q--:O>T&&U<=T&&Q++,Q!==T&&W(Q)},[n,T,r,W]),X=a.useCallback(O=>{A===null||A===O||(fe(A,O),P(null))},[A,fe]),B=a.useCallback((O,U)=>{O.preventDefault(),g({tabIndex:U,x:O.clientX,y:O.clientY})},[]),te=a.useCallback(()=>g(null),[]),pe=a.useMemo(()=>{if(!N)return[];const O=n[N.tabIndex];return[{label:v("wm.close","Close"),action:()=>{Z(O,N.tabIndex),te()},disabled:O.closable===!1},{label:v("wm.closeAll","Close all"),action:()=>{n.forEach((U,ce)=>U.closable!==!1&&Z(U,ce)),te()}},{label:v("wm.closeOthers","Close others"),action:()=>{n.forEach((U,ce)=>ce!==N.tabIndex&&U.closable!==!1&&Z(U,ce)),te()}},{label:v("controls.pin","Pin"),action:()=>te()},...m&&r?[{label:v("wm.moveLeft","Move left"),action:()=>{fe(N.tabIndex,N.tabIndex-1),te()},disabled:N.tabIndex===0},{label:v("wm.moveRight","Move right"),action:()=>{fe(N.tabIndex,N.tabIndex+1),te()},disabled:N.tabIndex===n.length-1}]:[],{type:"divider"},{label:v("wm.reopenClosed","Reopen closed tab"),action:()=>{ee(),te()},disabled:G.length===0,shortcut:"Ctrl+Shift+T"}]},[N,n,v,Z,ee,G.length,te,m,r,fe]);a.useEffect(()=>{if(!N)return;const O=()=>te();return window.addEventListener("click",O),()=>window.removeEventListener("click",O)},[N,te]);const _e=a.useRef(null);u.useOverlayFocus(_e,{open:!!N,modal:!1,onClose:te}),u.useRovingFocus(_e,{orientation:"vertical",wrap:!0});const we=a.useRef(null);u.useOverlayFocus(we,{open:!!q,modal:!0,onClose:()=>ie(null)});const Ne=a.useCallback(O=>{L.current?.querySelectorAll('[role="tab"]')[O]?.focus()},[]);u.useIntent(["sectionPrev","sectionNext"],O=>{if(n.length<2)return!1;const U=(T+(O.intent==="sectionNext"?1:-1)+n.length)%n.length;W(U),Ne(U)},{ref:ne}),u.useInputHints(ne,[{intent:"sectionPrev",label:v("wm.previousTab","Previous tab")},{intent:"sectionNext",label:v("wm.nextTab","Next tab")}]),u.useInputHints(L,[{intent:"secondary",label:v("wm.tabMenu","Tab menu")}]);const ze=(O,U,ce)=>{O.key==="Delete"&&U.closable!==!1&&!U.isPinned&&(O.preventDefault(),Z(U,ce))};if(b==="hidden")return null;const ge=e.jsxs("div",{className:`nice-mdi__tab-bar nice-mdi__tab-bar--${h}`,ref:L,role:"tablist",children:[n.map((O,U)=>e.jsxs("div",{className:`nice-mdi__tab ${U===T?"nice-mdi__tab--active":""} ${O.isPinned?"nice-mdi__tab--pinned":""}`,role:"tab","aria-selected":U===T,onClick:()=>W(U),onKeyDown:ce=>ze(ce,O,U),onContextMenu:ce=>B(ce,U),draggable:m,onDragStart:()=>J(U),onDragOver:ce=>se(ce,U),onDrop:()=>X(U),children:[O.icon&&e.jsx("span",{className:"nice-mdi__tab-icon",children:e.jsx(u.NiceIcon,{name:O.icon,size:14})}),e.jsx("span",{className:"nice-mdi__tab-title",children:O.title}),d&&O.isDirty&&e.jsx("span",{className:"nice-mdi__tab-dirty",title:v("wm.unsaved","Unsaved changes"),children:e.jsx(u.NiceIcon,{name:"circle",size:10})}),O.closable!==!1&&!O.isPinned&&e.jsx("button",{className:"nice-mdi__tab-close",onClick:ce=>{ce.stopPropagation(),Z(O,U)},"aria-label":v("wm.close","Close"),type:"button",children:e.jsx(u.NiceIcon,{name:"close",size:14})})]},O.id)),f&&e.jsx("button",{className:"nice-mdi__tab-add",onClick:D,"aria-label":v("controls.new","New"),type:"button",children:e.jsx(u.NiceIcon,{name:"plus",size:14})})]}),ue=k?e.jsx("div",{className:"nice-mdi__content",children:n.map((O,U)=>e.jsx("div",{className:"nice-mdi__panel",role:"tabpanel",style:{display:U===T?"block":"none"},children:c(O,U)},O.id))}):e.jsx("div",{className:"nice-mdi__content",children:n[T]&&e.jsx("div",{className:"nice-mdi__panel",role:"tabpanel",children:c(n[T],T)})});return e.jsxs("div",{ref:O=>{ne.current=O,typeof z=="function"?z(O):z&&(z.current=O)},id:F,className:`nice-mdi ${w??""}`,style:y,...C,children:[h==="top"&&ge,ue,h==="bottom"&&ge,N&&e.jsx("div",{ref:_e,className:"nice-mdi__ctx-menu",role:"menu","aria-label":v("wm.tabMenu","Tab menu"),style:{position:"fixed",left:N.x,top:N.y,zIndex:9999},children:pe.map((O,U)=>"type"in O&&O.type==="divider"?e.jsx("div",{className:"nice-mdi__ctx-divider",role:"separator"},U):e.jsxs("button",{className:"nice-mdi__ctx-item",onClick:O.action,disabled:O.disabled,type:"button",role:"menuitem",children:[e.jsx("span",{className:"nice-mdi__ctx-label",children:O.label}),"shortcut"in O&&O.shortcut&&e.jsx("span",{className:"nice-mdi__ctx-shortcut",children:O.shortcut})]},U))}),q&&e.jsx("div",{role:"presentation",className:"nice-mdi__modal-backdrop",onClick:O=>O.target===O.currentTarget&&ie(null),children:e.jsxs("div",{ref:we,className:"nice-mdi__modal",role:"dialog","aria-modal":"true","aria-labelledby":`${F}-unsaved-title`,children:[e.jsx("div",{className:"nice-mdi__modal-icon",children:e.jsx(u.NiceIcon,{name:"warning",size:32})}),e.jsx("h3",{id:`${F}-unsaved-title`,className:"nice-mdi__modal-title",children:v("wm.unsavedTitle","Unsaved Changes")}),e.jsx("p",{className:"nice-mdi__modal-message",children:j??v("wm.unsavedMessage",'"{title}" has unsaved changes. Do you want to close it anyway?').replace("{title}",q.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:v("controls.cancel","Cancel")}),e.jsx("button",{type:"button",className:"nice-mdi__modal-btn nice-mdi__modal-btn--danger",onClick:()=>{Z(q.tab,q.index,!0),ie(null)},children:v("wm.closeAnyway","Close Anyway")})]})]})})]})}),{displayName:"NiceMdiWorkspace"}),ya=Object.assign(a.forwardRef(({topBar:n,sidePanel:s,sidePanelPosition:t="left",sidePanelWidth:c=280,children:l,hintBar:o="bottom",className:r,style:p,id:x,accessMode:i,...d},h)=>{const m=u.useControlId(x),f=Re.useShellInput();return u.useNiceAccessMode(i,x)==="hidden"?null:e.jsxs("div",{ref:h,id:m,...f,className:`nice-shell nice-shell--dashboard ${r??""}`,style:p,...d,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-${t}`,children:[s&&e.jsx("aside",{className:"nice-shell__side-panel",style:{width:c},children:s}),e.jsx("main",{className:"nice-shell__dashboard-content",children:l})]}),e.jsx(Re.ShellHintBar,{position:o,block:"nice-shell"})]})}),{displayName:"NiceDashboardShell"}),ka=Object.assign(a.forwardRef(({overlay:n,lockScreen:s,locked:t=!1,children:c,hintBar:l="bottom",tv:o=!1,className:r,style:p,id:x,accessMode:i,...d},h)=>{const m=u.useControlId(x),f=Re.useShellInput();return u.useNiceAccessMode(i,x)==="hidden"?null:e.jsxs("div",{ref:h,id:m,...f,"data-nice-tv":o?"on":void 0,className:`nice-shell nice-shell--kiosk ${r??""}`,style:{position:"fixed",inset:0,...p},...d,children:[t&&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:c}),n&&e.jsx("div",{className:"nice-shell__kiosk-overlay",children:n})]}),e.jsx(Re.ShellHintBar,{position:l,block:"nice-shell"})]})}),{displayName:"NiceKioskShell"}),Ca=Object.assign(a.forwardRef(({menu:n,activeRoute:s,tenant:t,topBarActions:c,globalSearch:l,footer:o,onNavigate:r,children:p,hintBar:x="bottom",className:i,style:d,id:h,accessMode:m,...f},D)=>{const k=u.useControlId(h),_=Re.useShellInput();return u.useNiceAccessMode(m,h)==="hidden"?null:e.jsxs("div",{ref:D,id:k,..._,className:`nice-shell nice-shell--modern ${i??""}`,style:d,...f,children:[e.jsx("aside",{className:"nice-shell__modern-rail",role:"navigation",children:n?.modules.filter(I=>I.isAvailable).sort((I,M)=>I.order-M.order).map(I=>e.jsx("button",{type:"button",title:I.label,className:"nice-shell__modern-rail-item",onClick:()=>I.entities[0]&&r?.(I.entities[0].route),children:e.jsx("span",{"aria-hidden":!0,children:I.icon??e.jsx(u.NiceIcon,{name:"circle",size:16})})},I.id))}),e.jsxs("div",{className:"nice-shell__modern-main",children:[e.jsxs("header",{className:"nice-shell__modern-topbar",children:[t&&e.jsxs("div",{className:"nice-shell__modern-tenant",style:t.primaryColor?{borderColor:t.primaryColor}:void 0,children:[t.logoUrl&&e.jsx("img",{src:t.logoUrl,alt:""}),e.jsx("span",{children:t.shortName??t.name}),t.plan&&e.jsx("small",{children:t.plan})]}),l&&e.jsx("div",{className:"nice-shell__modern-search",children:l}),c&&e.jsx("div",{className:"nice-shell__modern-actions",children:c})]}),e.jsx("main",{className:"nice-shell__modern-content","data-active-route":s,children:p}),o&&e.jsx("footer",{className:"nice-shell__modern-footer",children:o})]}),e.jsx(Re.ShellHintBar,{position:x,block:"nice-shell"})]})}),{displayName:"NiceModernShell"}),wa=Object.assign(a.forwardRef(({header:n,tenant:s,maxWidth:t=960,centered:c=!0,children:l,hintBar:o="bottom",className:r,style:p,id:x,accessMode:i,...d},h)=>{const m=u.useControlId(x),f=Re.useShellInput();return u.useNiceAccessMode(i,x)==="hidden"?null:e.jsxs("div",{ref:h,id:m,...f,className:`nice-shell nice-shell--minimal ${c?"nice-shell--minimal-centered":""} ${r??""}`,style:p,...d,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:t,marginInline:c?"auto":void 0},children:l}),e.jsx(Re.ShellHintBar,{position:o,block:"nice-shell"})]})}),{displayName:"NiceMinimalShell"}),Sa=Object.assign(a.forwardRef(({menu:n,activeRoute:s,tenant:t,toolbar:c,inspector:l,inspectorOpen:o=!0,statusBar:r,onNavigate:p,children:x,hintBar:i="bottom",className:d,style:h,id:m,accessMode:f,...D},k)=>{const{t:_}=u.useNiceTranslation(),$=u.useControlId(m),I=Re.useShellInput(),M=u.useNiceAccessMode(f,m),[j,w]=a.useState(o);return M==="hidden"?null:e.jsxs("div",{ref:k,id:$,...I,className:`nice-shell nice-shell--hybrid ${d??""}`,style:h,...D,children:[e.jsxs("header",{className:"nice-shell__hybrid-topbar",children:[t&&e.jsxs("div",{className:"nice-shell__hybrid-tenant",children:[t.logoUrl&&e.jsx("img",{src:t.logoUrl,alt:""}),e.jsx("span",{children:t.name})]}),c,l&&e.jsx("button",{type:"button",className:"nice-shell__hybrid-inspector-toggle",onClick:()=>w(y=>!y),"aria-pressed":j,"aria-label":_("shells.toggleInspector","Toggle inspector"),children:e.jsx(u.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(y=>y.isAvailable).sort((y,V)=>y.order-V.order).map(y=>e.jsxs("div",{className:"nice-shell__hybrid-nav-group",children:[e.jsx("div",{className:"nice-shell__hybrid-nav-group-label",children:y.label}),e.jsx("ul",{children:y.entities.map(V=>e.jsx("li",{children:e.jsx("button",{type:"button",className:`nice-shell__hybrid-nav-item ${s===V.route?"nice-shell__hybrid-nav-item--active":""}`,onClick:()=>p?.(V.route),children:V.label})},V.id))})]},y.id))}),e.jsx("main",{className:"nice-shell__hybrid-content",children:x}),l&&j&&e.jsx("aside",{className:"nice-shell__hybrid-inspector",children:l})]}),r&&e.jsx("footer",{className:"nice-shell__hybrid-status",children:r}),e.jsx(Re.ShellHintBar,{position:i,block:"nice-shell"})]})}),{displayName:"NiceHybridShell"}),Ia=Object.assign(a.forwardRef(({appTitle:n,tenant:s,topBarActions:t,tabs:c=[],activeTabId:l,onTabChange:o,fab:r,children:p,hintBar:x="bottom",className:i,style:d,id:h,accessMode:m,...f},D)=>{const k=a.useRef(null);u.useRovingFocus(k,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const _=u.useControlId(h),$=Re.useShellInput();return u.useNiceAccessMode(m,h)==="hidden"?null:e.jsxs("div",{ref:D,id:_,...$,className:`nice-shell nice-shell--pwa ${i??""}`,style:d,...f,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??""})]}),t&&e.jsx("div",{className:"nice-shell__pwa-actions",children:t})]}),e.jsx("main",{className:"nice-shell__pwa-content",children:p}),r&&e.jsx("div",{className:"nice-shell__pwa-fab",children:r}),c.length>0&&e.jsx("nav",{className:"nice-shell__pwa-tabs",ref:k,role:"tablist",children:c.map(M=>e.jsxs("button",{type:"button",role:"tab","aria-selected":l===M.id,className:`nice-shell__pwa-tab ${l===M.id?"nice-shell__pwa-tab--active":""}`,onClick:()=>o?.(M.id,M.route),children:[M.icon&&e.jsx("span",{"aria-hidden":!0,children:M.icon}),e.jsx("span",{children:M.label})]},M.id))}),e.jsx(Re.ShellHintBar,{position:x,block:"nice-shell"})]})}),{displayName:"NicePwaShell"}),$a=[];function sn(n,s=16){return typeof n=="string"?e.jsx(u.NiceIcon,{name:n,size:s}):n}const Ea=Object.assign(a.forwardRef(({modes:n=$a,activeMode:s,onModeChange:t,variant:c="dropdown",gridColumns:l=3,showDescription:o=!0,showColorIndicator:r=!0,compact:p=!1,size:x="md",className:i,style:d,id:h,accessMode:m,...f},D)=>{const k=u.useControlId(h),_=u.useNiceAccessMode(m,h),{t:$}=u.useNiceTranslation(),[I,M]=a.useState(!1),j=a.useRef(null),w=n.find(v=>v.key===s);a.useEffect(()=>{if(!I)return;const v=T=>{j.current&&!j.current.contains(T.target)&&M(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[I]);const y=a.useCallback(v=>{t?.(v),M(!1)},[t]),V=a.useRef(null),E=a.useCallback(v=>{V.current=v,j.current=v,typeof D=="function"?D(v):D&&(D.current=v)},[D]),{activeIndex:C,setActiveIndex:z,handleKeyDown:L}=Pe.useListKeyboardNav(n,{open:I,onSelect:v=>y(v),onClose:()=>M(!1),onOpen:()=>F()}),F=()=>{z(Math.max(0,n.findIndex(v=>v.key===s))),M(!0)};u.useRovingFocus(V,{orientation:c==="card-grid"?"grid":"both",wrap:!0,activateOnMove:!0,enabled:c!=="dropdown"});const b=`${k}-modes`;return _==="hidden"?null:c==="dropdown"?e.jsxs("div",{ref:E,id:k,className:`nice-mode-selector nice-mode-selector--dropdown nice-mode-selector--${x}${p?" nice-mode-selector--compact":""} ${i??""}`,style:d,...f,children:[e.jsxs("button",{className:"nice-mode-selector__trigger",onClick:()=>I?M(!1):F(),onKeyDown:L,role:"combobox","aria-expanded":I,"aria-haspopup":"listbox","aria-controls":I?b:void 0,"aria-activedescendant":I&&n[C]?`${b}-${C}`:void 0,"aria-label":p?w?.displayName??s:void 0,title:p?w?.displayName??s:void 0,type:"button",children:[r&&w?.color&&e.jsx("span",{className:"nice-mode-selector__color",style:{backgroundColor:w.color}}),w?.icon&&e.jsx("span",{className:"nice-mode-selector__icon",children:sn(w.icon)}),!p&&e.jsx("span",{className:"nice-mode-selector__label",children:w?.displayName??s}),e.jsx("span",{className:"nice-mode-selector__chevron",children:e.jsx(u.NiceIcon,{name:I?"chevron-up":"chevron-down",size:"xs"})})]}),I&&e.jsx("ul",{className:"nice-mode-selector__menu",role:"listbox",id:b,children:n.map((v,T)=>e.jsxs("li",{id:`${b}-${T}`,className:`nice-mode-selector__option ${v.key===s?"nice-mode-selector__option--active":""} ${T===C?"nice-mode-selector__option--highlighted":""}`,onMouseEnter:()=>z(T),role:"option","aria-selected":v.key===s,onClick:()=>y(v),children:[r&&v.color&&e.jsx("span",{className:"nice-mode-selector__color",style:{backgroundColor:v.color}}),v.icon&&e.jsx("span",{className:"nice-mode-selector__icon",children:sn(v.icon)}),e.jsxs("div",{children:[e.jsx("div",{className:"nice-mode-selector__name",children:v.displayName}),o&&v.description&&e.jsx("div",{className:"nice-mode-selector__desc",children:v.description})]})]},v.key))})]}):c==="pills"?e.jsx("div",{ref:E,id:k,className:`nice-mode-selector nice-mode-selector--pills ${i??""}`,style:d,role:"radiogroup",...f,children:n.map(v=>e.jsxs("button",{className:`nice-mode-selector__pill ${v.key===s?"nice-mode-selector__pill--active":""}`,style:r&&v.color?{borderColor:v.color}:void 0,onClick:()=>y(v),role:"radio","aria-checked":v.key===s,type:"button",children:[v.icon&&e.jsx("span",{children:sn(v.icon)}),e.jsx("span",{children:v.displayName})]},v.key))}):e.jsx("div",{ref:E,id:k,className:`nice-mode-selector nice-mode-selector--card-grid ${i??""}`,style:{...d,gridTemplateColumns:`repeat(${l}, 1fr)`},role:"radiogroup",...f,children:n.map(v=>e.jsxs("button",{className:`nice-mode-selector__card ${v.key===s?"nice-mode-selector__card--active":""} ${p?"nice-mode-selector__card--compact":""}`,onClick:()=>y(v),role:"radio","aria-checked":v.key===s,type:"button",children:[r&&v.color&&e.jsx("div",{className:"nice-mode-selector__card-stripe",style:{backgroundColor:v.color}}),v.icon&&e.jsx("div",{className:"nice-mode-selector__card-icon",children:sn(v.icon,24)}),e.jsx("div",{className:"nice-mode-selector__card-name",children:v.displayName}),o&&v.description&&!p&&e.jsx("div",{className:"nice-mode-selector__card-desc",children:v.description}),v.sourcePackage&&!p&&e.jsx("div",{className:"nice-mode-selector__card-pkg",children:v.sourcePackage})]},v.key))})}),{displayName:"NiceModeSelector"}),za=[{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"}],Ma=[{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"}],Sn=["basic","contact","address","branding","localization","fiscal","preferences"],Ye=({title:n,expanded:s,onToggle:t})=>e.jsxs("button",{className:`nice-org-form__section-header ${s?"nice-org-form__section-header--expanded":""}`,onClick:t,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(u.NiceIcon,{name:s?"chevron-down":"chevron-right",size:14})})]}),Da=Object.assign(a.forwardRef(({profile:n,onChange:s,onSave:t,onCancel:c,sections:l,expandedSections:o,showActions:r=!0,countryOptions:p,languageOptions:x,currencyOptions:i,timezoneOptions:d,saving:h=!1,className:m,style:f,id:D,accessMode:k,..._},$)=>{const I=u.useControlId(D),M=u.useNiceAccessMode(k,D),{t:j}=u.useNiceTranslation(),w=a.useMemo(()=>l&&l.length>0?l:Sn,[l]),[y,V]=a.useState(()=>new Set(o??Sn)),E=a.useCallback(b=>{V(v=>{const T=new Set(v);return T.has(b)?T.delete(b):T.add(b),T})},[]),C=M==="readOnly",z=M==="disabled",L=a.useCallback((b,v)=>{s?.({...n,[b]:v})},[n,s]),F=a.useCallback(()=>{t?.(n)},[n,t]);return M==="hidden"?null:e.jsxs("div",{ref:$,id:I,className:`nice-org-form ${m??""}`,style:f,..._,children:[w.includes("basic")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Ye,{title:j("org.basic","Company Information"),expanded:y.has("basic"),onToggle:()=>E("basic")}),y.has("basic")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(be.NiceTextInput,{label:j("org.name","Company Name"),value:n.name,onChange:b=>L("name",b),required:!0,disabled:z,readOnly:C}),e.jsx(be.NiceTextInput,{label:j("org.legalName","Legal Name"),value:n.legalName??"",onChange:b=>L("legalName",b),disabled:z,readOnly:C}),e.jsx(be.NiceTextInput,{label:j("org.taxId","Tax ID"),value:n.taxId??"",onChange:b=>L("taxId",b),disabled:z,readOnly:C}),e.jsx(be.NiceTextInput,{label:j("org.regNumber","Registration Number"),value:n.registrationNumber??"",onChange:b=>L("registrationNumber",b),disabled:z,readOnly:C}),e.jsx(be.NiceTextInput,{label:j("org.industry","Industry"),value:n.industry??"",onChange:b=>L("industry",b),disabled:z,readOnly:C}),e.jsx(be.NiceNumberInput,{label:j("org.employees","Number of Employees"),value:n.employeeCount??null,onChange:b=>L("employeeCount",b??void 0),min:1,disabled:z,readOnly:C})]})]}),w.includes("contact")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Ye,{title:j("org.contact","Contact Details"),expanded:y.has("contact"),onToggle:()=>E("contact")}),y.has("contact")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(be.NiceTextInput,{label:j("org.email","Email"),value:n.email??"",onChange:b=>L("email",b),type:"email",disabled:z,readOnly:C}),e.jsx(be.NiceTextInput,{label:j("org.phone","Phone"),value:n.phone??"",onChange:b=>L("phone",b),type:"tel",disabled:z,readOnly:C}),e.jsx(be.NiceTextInput,{label:j("org.website","Website"),value:n.website??"",onChange:b=>L("website",b),type:"url",disabled:z,readOnly:C}),e.jsx(be.NiceTextInput,{label:j("org.fax","Fax"),value:n.fax??"",onChange:b=>L("fax",b),type:"tel",disabled:z,readOnly:C})]})]}),w.includes("address")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Ye,{title:j("org.address","Address"),expanded:y.has("address"),onToggle:()=>E("address")}),y.has("address")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(be.NiceTextInput,{label:j("org.street","Street"),value:n.street??"",onChange:b=>L("street",b),disabled:z,readOnly:C}),e.jsx(be.NiceTextInput,{label:j("org.city","City"),value:n.city??"",onChange:b=>L("city",b),disabled:z,readOnly:C}),e.jsx(be.NiceTextInput,{label:j("org.state","State / Province"),value:n.state??"",onChange:b=>L("state",b),disabled:z,readOnly:C}),e.jsx(be.NiceTextInput,{label:j("org.postalCode","Postal Code"),value:n.postalCode??"",onChange:b=>L("postalCode",b),disabled:z,readOnly:C}),p?e.jsx(We.NiceSelect,{label:j("org.country","Country"),value:n.country??"",onChange:b=>L("country",b),options:p,searchable:!0,disabled:z,readOnly:C}):e.jsx(be.NiceTextInput,{label:j("org.country","Country"),value:n.country??"",onChange:b=>L("country",b),disabled:z,readOnly:C})]})]}),w.includes("branding")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Ye,{title:j("org.branding","Branding"),expanded:y.has("branding"),onToggle:()=>E("branding")}),y.has("branding")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(be.NiceTextInput,{label:j("org.logoUrl","Logo URL"),value:n.logoUrl??"",onChange:b=>L("logoUrl",b),type:"url",disabled:z,readOnly:C}),e.jsx(yn.NiceColorPicker,{label:j("org.primaryColor","Primary Color"),value:n.primaryColor??"var(--nice-color-primary, #3b82f6)",onChange:b=>L("primaryColor",b),disabled:z,readOnly:C}),e.jsx(yn.NiceColorPicker,{label:j("org.secondaryColor","Secondary Color"),value:n.secondaryColor??"var(--nice-color-accent, #8b5cf6)",onChange:b=>L("secondaryColor",b),disabled:z,readOnly:C})]})]}),w.includes("localization")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Ye,{title:j("org.localization","Localization"),expanded:y.has("localization"),onToggle:()=>E("localization")}),y.has("localization")&&e.jsxs("div",{className:"nice-org-form__fields",children:[x?e.jsx(We.NiceSelect,{label:j("org.language","Default Language"),value:n.defaultLanguage??"",onChange:b=>L("defaultLanguage",b),options:x,searchable:!0,disabled:z,readOnly:C}):e.jsx(be.NiceTextInput,{label:j("org.language","Default Language"),value:n.defaultLanguage??"",onChange:b=>L("defaultLanguage",b),disabled:z,readOnly:C}),i?e.jsx(We.NiceSelect,{label:j("org.currency","Default Currency"),value:n.defaultCurrency??"",onChange:b=>L("defaultCurrency",b),options:i,searchable:!0,disabled:z,readOnly:C}):e.jsx(be.NiceTextInput,{label:j("org.currency","Default Currency"),value:n.defaultCurrency??"",onChange:b=>L("defaultCurrency",b),disabled:z,readOnly:C}),d?e.jsx(We.NiceSelect,{label:j("org.timezone","Default Timezone"),value:n.defaultTimezone??"",onChange:b=>L("defaultTimezone",b),options:d,searchable:!0,disabled:z,readOnly:C}):e.jsx(be.NiceTextInput,{label:j("org.timezone","Default Timezone"),value:n.defaultTimezone??"",onChange:b=>L("defaultTimezone",b),disabled:z,readOnly:C}),e.jsx(We.NiceSelect,{label:j("org.dateFormat","Date Format"),value:n.dateFormat??"YYYY-MM-DD",onChange:b=>L("dateFormat",b),options:Ma,disabled:z,readOnly:C})]})]}),w.includes("fiscal")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Ye,{title:j("org.fiscal","Fiscal Settings"),expanded:y.has("fiscal"),onToggle:()=>E("fiscal")}),y.has("fiscal")&&e.jsxs("div",{className:"nice-org-form__fields",children:[e.jsx(be.NiceTextInput,{label:j("org.fiscalYearStart","Fiscal Year Start"),value:n.fiscalYearStart??"",onChange:b=>L("fiscalYearStart",b),placeholder:j("org.mmDd","MM-DD"),disabled:z,readOnly:C}),e.jsx(Pe.NiceToggle,{label:j("org.vatEnabled","VAT Enabled"),checked:n.vatEnabled??!1,onChange:b=>L("vatEnabled",b),disabled:z||C}),n.vatEnabled&&e.jsx(be.NiceNumberInput,{label:j("org.defaultVatRate","Default VAT Rate (%)"),value:n.defaultVatRate??null,onChange:b=>L("defaultVatRate",b??void 0),min:0,max:100,step:.5,disabled:z,readOnly:C})]})]}),w.includes("preferences")&&e.jsxs("div",{className:"nice-org-form__section",children:[e.jsx(Ye,{title:j("org.preferences","Work Preferences"),expanded:y.has("preferences"),onToggle:()=>E("preferences")}),y.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:j("org.workingDays","Working Days")}),e.jsx("div",{className:"nice-org-form__checkboxes",children:za.map(b=>e.jsx(be.NiceCheckbox,{label:b.label,checked:(n.workingDays??["Mon","Tue","Wed","Thu","Fri"]).includes(b.key),onChange:v=>{const T=n.workingDays??["Mon","Tue","Wed","Thu","Fri"],W=v?[...T,b.key]:T.filter(ne=>ne!==b.key);L("workingDays",W)},disabled:z||C},b.key))})]}),e.jsx(be.NiceTextInput,{label:j("org.workStart","Working Hours Start"),value:n.workingHoursStart??"09:00",onChange:b=>L("workingHoursStart",b),placeholder:j("org.hhMm","HH:MM"),disabled:z,readOnly:C}),e.jsx(be.NiceTextInput,{label:j("org.workEnd","Working Hours End"),value:n.workingHoursEnd??"17:00",onChange:b=>L("workingHoursEnd",b),placeholder:j("org.hhMm","HH:MM"),disabled:z,readOnly:C})]})]}),r&&e.jsxs("div",{className:"nice-org-form__actions",children:[c&&e.jsx(Ke.NiceButton,{variant:"secondary",onClick:c,disabled:h,children:j("cancel","Cancel")}),t&&e.jsx(Ke.NiceButton,{variant:"primary",onClick:F,loading:h,disabled:C||z,children:j("save","Save")})]})]})}),{displayName:"NiceOrganizationProfileForm"}),Ra=[],Ta={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 La=({module:n,onAction:s,onClick:t,showDependencies:c,showAuthor:l,showVersion:o,processing:r,disabled:p,readOnly:x,t:i,layout:d})=>{const h=Ta[n.status],m=Oa(n.status,n.isCore);return e.jsxs("div",{className:`nice-module-card nice-module-card--${d} nice-module-card--${n.status}`,onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,onKeyDown:t?f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),t())}:void 0,children:[e.jsxs("div",{className:"nice-module-card__header",children:[e.jsx("span",{className:"nice-module-card__icon",children:e.jsx(u.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}),o&&e.jsxs("span",{className:"nice-module-card__version",children:["v",n.version]})]}),e.jsxs("span",{className:"nice-module-card__status",style:{color:h.color},title:n.status,children:[e.jsx(u.NiceIcon,{name:r?"refresh":h.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:[l&&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:i("module.core","Core")})]}),c&&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:[i("module.deps","Dependencies"),":"]}),n.dependencies.map(f=>e.jsx("span",{className:"nice-module-card__dep-tag",children:f},f))]}),!x&&m.length>0&&e.jsx("div",{className:"nice-module-card__actions",children:m.map(f=>e.jsx(Ke.NiceButton,{size:"sm",variant:f==="uninstall"?"error":f==="activate"?"primary":"secondary",onClick:D=>{D.stopPropagation(),s(f)},disabled:p||r,loading:r,children:i(`module.${f}`,f.charAt(0).toUpperCase()+f.slice(1))},f))})]})},Aa=Object.assign(a.forwardRef(({modules:n=Ra,onAction:s,statusFilter:t,searchable:c=!0,showDependencies:l=!0,showAuthor:o=!0,showVersion:r=!0,processingModules:p,layout:x="list",gridColumns:i=3,onModuleClick:d,className:h,style:m,id:f,accessMode:D,...k},_)=>{const $=a.useRef(null);u.useRovingFocus($,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const I=u.useControlId(f),M=u.useNiceAccessMode(D,f),{t:j}=u.useNiceTranslation(),[w,y]=a.useState(""),[V,E]=a.useState("all"),C=M==="readOnly",z=M==="disabled",L=a.useMemo(()=>{let v=n;if(t&&t.length>0&&(v=v.filter(T=>t.includes(T.status))),V!=="all"&&(v=v.filter(T=>T.status===V)),w){const T=w.toLowerCase();v=v.filter(W=>W.label.toLowerCase().includes(T)||W.name.toLowerCase().includes(T)||W.description.toLowerCase().includes(T))}return v},[n,t,V,w]),F=a.useMemo(()=>{const v={all:n.length};for(const T of n)v[T.status]=(v[T.status]??0)+1;return v},[n]),b=a.useCallback((v,T)=>{s?.(v,T)},[s]);return M==="hidden"?null:e.jsxs("div",{ref:_,id:I,className:`nice-module-panel ${h??""}`,style:m,...k,children:[e.jsxs("div",{className:"nice-module-panel__toolbar",children:[c&&e.jsx(be.NiceTextInput,{value:w,onChange:y,placeholder:j("module.search","Search modules…"),type:"search",clearable:!0,className:"nice-module-panel__search"}),e.jsx("div",{className:"nice-module-panel__filters",ref:$,role:"tablist",children:["all","active","installed","disabled","available","error"].map(v=>e.jsxs("button",{className:`nice-module-panel__filter ${V===v?"nice-module-panel__filter--active":""}`,onClick:()=>E(v),role:"tab","aria-selected":V===v,type:"button",children:[j(`module.status.${v}`,v==="all"?"All":v.charAt(0).toUpperCase()+v.slice(1)),e.jsx("span",{className:"nice-module-panel__filter-count",children:F[v]??0})]},v))})]}),e.jsx("div",{className:`nice-module-panel__grid nice-module-panel__grid--${x}`,style:x==="grid"?{gridTemplateColumns:`repeat(${i}, 1fr)`}:void 0,children:L.length===0?e.jsx("div",{className:"nice-module-panel__empty",children:j("module.empty","No modules found")}):L.map(v=>e.jsx(La,{module:v,onAction:T=>b(v.id,T),onClick:d?()=>d(v):void 0,showDependencies:l,showAuthor:o,showVersion:r,processing:p?.has(v.id)??!1,disabled:z,readOnly:C,t:j,layout:x},v.id))}),e.jsxs("div",{className:"nice-module-panel__summary",children:[j("module.total","Total"),": ",n.length," · ",j("module.status.active","Active"),":"," ",F.active??0," · ",j("module.status.disabled","Disabled"),":"," ",F.disabled??0," · ",j("module.status.error","Error"),":"," ",F.error??0]})]})}),{displayName:"NiceModuleLifecyclePanel"});exports.DEFAULT_SIDEBAR_PREFS=Nn;exports.DesktopContextMenu=An;exports.DesktopGrid=Ln;exports.DesktopStartMenu=Tn;exports.DesktopSystemTray=On;exports.DesktopTaskbar=on;exports.LANGUAGES=In;exports.NICE_THEME_PICKER_PRESETS=ln;exports.NiceAccordion=os;exports.NiceAppLayout=gs;exports.NiceAuthButtons=va;exports.NiceBreadcrumb=us;exports.NiceCard=En;exports.NiceCard$1=ts;exports.NiceCardGroupSizeContext=bn;exports.NiceCardRadioContext=pn;exports.NiceConsole=ws;exports.NiceContextMenu=fn;exports.NiceDashboardLayout=Ns;exports.NiceDashboardShell=ya;exports.NiceDesktop=ks;exports.NiceDock=ys;exports.NiceDynamicSidebar=Fs;exports.NiceHybridShell=Sa;exports.NiceKioskShell=ka;exports.NiceLanguagePicker=mn;exports.NiceMdiWorkspace=ja;exports.NiceMenu=Mn;exports.NiceMinimalShell=wa;exports.NiceModeSelector=Ea;exports.NiceModernShell=Ca;exports.NiceModuleLifecyclePanel=Aa;exports.NiceNavMenu=Na;exports.NiceNavbar=Ds;exports.NiceOrganizationProfileForm=Da;exports.NicePwaShell=Ia;exports.NiceSetupWizard=Ms;exports.NiceSidebarNav=fa;exports.NiceSplitter=fs;exports.NiceStepper=Rn;exports.NiceThemePicker=hn;exports.NiceTooltip=Ce;exports.NiceUserMenu=Pn;exports.NiceWizard=Is;exports.PREFS_CATEGORIES=gn;exports.SIDEBAR_MODE_META=an;exports.buildPrefsCategoryViews=sa;exports.findSidebarItemByRoute=Hs;exports.mapSidebarViews=Ys;exports.sidebarModeLabel=qe;exports.toThemeDescriptor=$n;exports.useSetupWizard=Es;exports.useSidebarNavPrefs=Wn;exports.walkSidebarNav=xn;