@nice2dev/ui 1.0.24 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/NiceErrorBoundary-CVybqo3l.js +770 -0
  3. package/dist/NiceErrorBoundary-D0NwBkFl.cjs +1 -0
  4. package/dist/NiceForm-BrBaLUkv.js +5386 -0
  5. package/dist/NiceForm-DoiApS60.cjs +382 -0
  6. package/dist/NiceModal-C582SiK7.cjs +1 -0
  7. package/dist/NiceModal-sFJw1CWm.js +95 -0
  8. package/dist/NiceModuleLifecyclePanel-D22ycAMQ.js +6817 -0
  9. package/dist/NiceModuleLifecyclePanel-shRuDyp3.cjs +1 -0
  10. package/dist/NiceModuleLifecyclePanel.css +1 -1
  11. package/dist/NicePagination-CtyaW_b4.cjs +1 -0
  12. package/dist/NicePagination-hGlKrWYL.js +171 -0
  13. package/dist/NicePinCodeInput-DPUlM3E1.cjs +696 -0
  14. package/dist/NicePinCodeInput-xSuOVhE8.js +13097 -0
  15. package/dist/NiceSavedQueryPanel-DzB0g0ak.cjs +596 -0
  16. package/dist/NiceSavedQueryPanel-Mz4jAsGJ.js +6893 -0
  17. package/dist/NiceTabs-1o8cpB_-.js +1657 -0
  18. package/dist/NiceTabs-B-FDOecP.cjs +1 -0
  19. package/dist/NiceWindow-9zQsi0zF.cjs +1 -0
  20. package/dist/NiceWindow-Dq-xx9cw.js +1592 -0
  21. package/dist/charts-DNQXBPGB.js +4657 -0
  22. package/dist/charts-IP38F-wh.cjs +761 -0
  23. package/dist/charts.cjs +1 -1
  24. package/dist/charts.mjs +1 -1
  25. package/dist/core-C7CI2mWz.js +25248 -0
  26. package/dist/core-CjUAwZ6z.cjs +122 -0
  27. package/dist/data-branching-Bv-f_gZk.cjs +1 -0
  28. package/dist/data-branching-CNi8vtZ1.js +6133 -0
  29. package/dist/data-branching.cjs +1 -1
  30. package/dist/data-branching.mjs +1 -1
  31. package/dist/data.cjs +1 -1
  32. package/dist/data.d.ts +19 -1
  33. package/dist/data.mjs +1 -1
  34. package/dist/devops-ZWKP6vRh.cjs +17 -0
  35. package/dist/devops-draw6Jrm.js +7684 -0
  36. package/dist/devops.cjs +1 -1
  37. package/dist/devops.mjs +1 -1
  38. package/dist/editors.cjs +1 -1
  39. package/dist/editors.mjs +3 -3
  40. package/dist/feedback.cjs +1 -1
  41. package/dist/feedback.mjs +2 -2
  42. package/dist/index-BkLJ4tzy.js +68026 -0
  43. package/dist/index-CwOe80Ws.cjs +5518 -0
  44. package/dist/index.cjs +1 -1
  45. package/dist/index.css +1 -1
  46. package/dist/index.d.ts +104 -1
  47. package/dist/index.mjs +757 -753
  48. package/dist/lazy.cjs +1 -1
  49. package/dist/lazy.mjs +24 -24
  50. package/dist/navigation.cjs +1 -1
  51. package/dist/navigation.d.ts +23 -0
  52. package/dist/navigation.mjs +4 -4
  53. package/dist/no-code-BndAN6hG.cjs +332 -0
  54. package/dist/no-code-DKYzw5If.js +7133 -0
  55. package/dist/no-code.cjs +1 -1
  56. package/dist/no-code.mjs +1 -1
  57. package/dist/overlays.cjs +1 -1
  58. package/dist/overlays.mjs +2 -2
  59. package/dist/style.css +2 -2
  60. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),o=require("./core-CjUAwZ6z.cjs"),l=require("react"),Ie=require("react-dom"),Ce=l.forwardRef(({label:t,helperText:p,error:s,required:u,disabled:n,readOnly:i,size:d="md",name:$,id:h,className:f,style:_,accessMode:S,displayStyle:Q,variant:x,value:w,defaultValue:F,onChange:m,onBlur:J,onKeyDown:D,placeholder:k,type:E="text",maxLength:v,prefix:L,suffix:U,clearable:I,autoFocus:A,submitOnEnter:y,onSubmit:T,showKeyboardHints:V,labelPlacement:R,errorPlacement:G,loading:re,labelWidth:le,controlWidth:X,displayMode:Z,...de},b)=>{const N=o.sc(S,h),K=N==="hidden";N==="disabled"&&(n=!0),N==="readOnly"&&(i=!0);const{t:H}=o.Zt(),M=o._s(h),ee=o.Ns("input",Q),ae=o.Es("input",Q),ue=x==="filled"?"filled":x==="underlined"?"underlined":"",Y=l.useCallback(()=>m?.(""),[m]),P=o.zs({enabled:Z,readOnly:i,disabled:n}),oe=o.kc({enabled:y,onSubmit:T}),ie=l.useCallback(g=>{oe(g),D?.(g)},[oe,D]),a=l.useMemo(()=>{const g=[];return y&&g.push({key:"Enter",description:H("shortcuts.submit","Submit")}),I&&g.push({key:"Escape",description:H("shortcuts.clear","Clear")}),g},[y,I,H]);return K?null:e.jsxs("div",{className:`nice-field nice-field--${d} ${R==="left"?"nice-field--label-left":""} ${R==="inside"?"nice-field--label-inside":""} ${re?"nice-field--loading":""} ${f||""}`,style:{..._,...le!=null&&{"--nice-field-label-width":typeof le=="number"?`${le}px`:le},...X!=null&&{"--nice-field-control-width":typeof X=="number"?`${X}px`:X}},"aria-busy":re||void 0,"data-floating":R==="inside"&&w?"true":void 0,children:[t&&R!=="inside"&&e.jsxs("label",{htmlFor:M,className:`nice-field__label ${u?"nice-field__label--required":""}`,children:[t,V&&a.length>0&&e.jsx(o.Qr,{shortcuts:a,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",children:[P.isDisplay?e.jsx(o.Fs,{value:w??F??"",placeholder:k,disabled:n,readOnly:i,onActivate:P.enterEdit,ariaLabel:t}):e.jsxs("div",{className:`nice-input nice-input--${d} nice-input--ds-${ue||ae} ${s?"nice-input--error":""} ${n?"nice-input--disabled":""} ${i?"nice-input--readonly":""}`,style:x?void 0:ee,children:[L&&e.jsx("span",{className:"nice-input__icon",children:L}),e.jsx("input",{ref:g=>{typeof b=="function"?b(g):b&&(b.current=g),P.autoFocusRef(g)},id:M,className:"nice-input__native",type:E,name:$,value:w,defaultValue:F,placeholder:k,disabled:n||re,readOnly:i,maxLength:v,autoFocus:A,"aria-invalid":!!s,"aria-describedby":s?`${M}-error`:p?`${M}-helper`:void 0,onChange:g=>m?.(g.target.value),onBlur:g=>{Z&&P.exitEdit(),J?.(g)},onKeyDown:ie,...de}),I&&w&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:Y,"aria-label":H("controls.clear","Clear"),children:"✕"}),U&&e.jsx("span",{className:"nice-input__icon",children:U}),t&&R==="inside"&&e.jsx("label",{htmlFor:M,className:`nice-input__floating-label ${u?"nice-input__floating-label--required":""}`,children:t})]}),re&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),G==="right"&&s&&e.jsx("div",{id:`${M}-error`,className:"nice-field__error",role:"alert",children:s}),G==="right"&&!s&&p&&e.jsx("div",{id:`${M}-helper`,className:"nice-field__helper",children:p})]}),G!=="right"&&s&&e.jsx("div",{id:`${M}-error`,className:"nice-field__error",role:"alert",children:s}),G!=="right"&&!s&&p&&e.jsx("div",{id:`${M}-helper`,className:"nice-field__helper",children:p})]})});Ce.displayName="NiceTextInput";const Te=Object.freeze(Object.defineProperty({__proto__:null,NiceTextInput:Ce},Symbol.toStringTag,{value:"Module"})),Se=l.forwardRef(({label:t,helperText:p,error:s,required:u,disabled:n,readOnly:i,size:d="md",name:$,id:h,className:f,style:_,accessMode:S,displayStyle:Q,value:x,onChange:w,onBlur:F,onKeyDown:m,placeholder:J,min:D,max:k,step:E=1,precision:v,prefix:L,prefixType:U="label",prefixOptions:I,prefixValue:A,onPrefixChange:y,suffix:T,showStepper:V=!0,submitOnEnter:R,onSubmit:G,showKeyboardHints:re,labelPlacement:le,errorPlacement:X,loading:Z,labelWidth:de,controlWidth:b,formatPreset:N,format:K,suffixType:H="label",suffixOptions:M,suffixValue:ee,onSuffixChange:ae,displayMode:ue},Y)=>{const P=o.sc(S,h),oe=P==="hidden";P==="disabled"&&(n=!0),P==="readOnly"&&(i=!0);const{t:ie}=o.Zt(),a=o._s(h),g=o.Ns("input",Q),z=o.Es("input",Q),[C,O]=l.useState(!1),[W,xe]=l.useState(null),ve=o.zs({enabled:ue,readOnly:i,disabled:n}),pe=l.useMemo(()=>{let c=3;return k!=null&&(c=String(Math.abs(Math.floor(k))).length),D!=null&&D<0&&(c+=1),v&&(c+=v+1),Math.max(3,c)+1},[k,D,v]),je=l.useCallback(c=>{if(K)return K(c);if(!N)return v!=null?c.toFixed(v):String(c);switch(N){case"integer":return Math.round(c).toLocaleString();case"decimal":return c.toLocaleString(void 0,{minimumFractionDigits:v??2,maximumFractionDigits:v??2});case"money":return c.toLocaleString(void 0,{minimumFractionDigits:v??2,maximumFractionDigits:v??2,useGrouping:!0});case"percent":return(c*100).toLocaleString(void 0,{minimumFractionDigits:v??0,maximumFractionDigits:v??2})+"%";default:return String(c)}},[K,N,v]),ye=l.useMemo(()=>C&&W!==null?W:x==null?"":C?v!=null?x.toFixed(v):String(x):je(x),[x,C,W,je,v]),fe=x!=null&&x<0,se=!!(L||U==="select"&&I&&I.length>0),ne=fe&&se&&!C,we=ne?ye.replace(/^[-−]/,""):ye,he=l.useCallback(c=>{let j=c;return D!==void 0&&(j=Math.max(D,j)),k!==void 0&&(j=Math.min(k,j)),v!==void 0&&(j=parseFloat(j.toFixed(v))),j},[D,k,v]),Me=l.useCallback(c=>{const j=c.target.value;if(xe(j),j===""||j==="-"||j==="."||j==="-."){j===""&&w?.(null);return}const ce=parseFloat(j);if(!isNaN(ce)){let _e=ce;D!==void 0&&(_e=Math.max(D,_e)),k!==void 0&&(_e=Math.min(k,_e)),w?.(_e)}},[w,D,k]),ge=l.useCallback(()=>{const c=be.current,j=he((c??0)+E);be.current=j,w?.(j)},[E,w,he]),$e=l.useCallback(()=>{const c=be.current,j=he((c??0)-E);be.current=j,w?.(j)},[E,w,he]),be=l.useRef(x);be.current=x;const r=l.useRef(null),B=l.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null)},[]),q=l.useCallback(c=>{B();let j=300;const ce=()=>{c(),j=Math.max(30,j*.82),r.current=setTimeout(ce,j)};r.current=setTimeout(ce,400)},[B]),me=o.kc({enabled:R,onSubmit:G}),ke=l.useCallback(c=>{me(c),c.key==="ArrowUp"?(c.preventDefault(),ge()):c.key==="ArrowDown"&&(c.preventDefault(),$e()),m?.(c)},[me,m,ge,$e]),te=l.useMemo(()=>{const c=[];return R&&c.push(o.xc.submit),V&&(c.push({key:"ArrowUp",description:ie("shortcuts.increment","Increase value")}),c.push({key:"ArrowDown",description:ie("shortcuts.decrement","Decrease value")})),c},[R,V,ie]);return oe?null:e.jsxs("div",{className:`nice-field nice-field--${d} ${le==="left"?"nice-field--label-left":""} ${Z?"nice-field--loading":""} ${f||""}`,style:{..._,...de!=null&&{"--nice-field-label-width":typeof de=="number"?`${de}px`:de},...b!=null&&{"--nice-field-control-width":typeof b=="number"?`${b}px`:b}},"aria-busy":Z||void 0,children:[t&&e.jsxs("label",{htmlFor:a,className:`nice-field__label ${u?"nice-field__label--required":""}`,children:[t,re&&te.length>0&&e.jsx(o.Qr,{shortcuts:te,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",children:[ve.isDisplay?e.jsx(o.Fs,{value:x==null?"":L?e.jsxs(e.Fragment,{children:[L,ye]}):ye,placeholder:J,disabled:n,readOnly:i,onActivate:ve.enterEdit,ariaLabel:t}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:`nice-input nice-input--number nice-input--${d} nice-input--ds-${z} ${s?"nice-input--error":""} ${n?"nice-input--disabled":""} ${i?"nice-input--readonly":""}`,style:g,children:[V&&!i&&e.jsx("button",{type:"button",className:"nice-input__clear nice-input__minus",onClick:$e,onMouseDown:()=>q($e),onMouseUp:B,onMouseLeave:B,disabled:n,"aria-label":ie("controls.decrement","Decrement"),children:"−"}),U==="select"&&I&&I.length>0?e.jsxs(e.Fragment,{children:[ne&&e.jsx("span",{className:"nice-input__sign",children:"−"}),e.jsx("select",{className:"nice-input__suffix-select nice-input__icon--prefix",value:A??I[0]?.value,disabled:n,onChange:c=>{const j=c.target.value,ce=I.find(Ne=>Ne.value===(A??I[0]?.value)),_e=I.find(Ne=>Ne.value===j);y?.(j,ce?.weight,_e?.weight)},children:I.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))})]}):L?e.jsxs("span",{className:"nice-input__icon nice-input__icon--prefix",children:[ne&&e.jsx("span",{className:"nice-input__sign",children:"−"}),L]}):null,e.jsx("input",{ref:c=>{typeof Y=="function"?Y(c):Y&&(Y.current=c),ve.autoFocusRef(c)},id:a,className:"nice-input__native",type:!C&&(K||N)?"text":"number",name:$,value:we,placeholder:J,min:D,max:k,step:E,disabled:n||Z,readOnly:i,"aria-invalid":!!s,onChange:Me,onFocus:c=>{O(!0),xe(null),c.target.select()},onBlur:c=>{if(O(!1),xe(null),x!=null&&v!==void 0){const j=parseFloat(x.toFixed(v));j!==x&&w?.(j)}ue&&ve.exitEdit(),F?.(c)},onKeyDown:ke,style:{width:`${pe}ch`}}),H==="select"&&M&&M.length>0?e.jsx("select",{className:"nice-input__suffix-select nice-input__icon--suffix",value:ee??M[0]?.value,disabled:n,onChange:c=>{const j=c.target.value,ce=M.find(Ne=>Ne.value===(ee??M[0]?.value)),_e=M.find(Ne=>Ne.value===j);ae?.(j,ce?.weight,_e?.weight)},children:M.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))}):T?e.jsx("span",{className:"nice-input__icon nice-input__icon--suffix",children:T}):null,V&&!i&&e.jsx("button",{type:"button",className:"nice-input__clear nice-input__plus",onClick:ge,onMouseDown:()=>q(ge),onMouseUp:B,onMouseLeave:B,disabled:n,"aria-label":ie("controls.increment","Increment"),children:"+"})]})}),Z&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),X==="right"&&s&&e.jsx("div",{className:"nice-field__error",role:"alert",children:s}),X==="right"&&!s&&p&&e.jsx("div",{className:"nice-field__helper",children:p})]}),X!=="right"&&s&&e.jsx("div",{className:"nice-field__error",role:"alert",children:s}),X!=="right"&&!s&&p&&e.jsx("div",{className:"nice-field__helper",children:p})]})});Se.displayName="NiceNumberInput";const He=Object.freeze(Object.defineProperty({__proto__:null,NiceNumberInput:Se},Symbol.toStringTag,{value:"Module"})),Ee=l.forwardRef(({label:t,helperText:p,error:s,required:u,disabled:n,size:i="md",name:d,id:$,className:h,style:f,accessMode:_,displayStyle:S,options:Q,value:x,onChange:w,placeholder:F,multiple:m=!1,searchable:J=!1,clearable:D=!1,emptyText:k,maxHeight:E=240,optionsSource:v,valueField:L,labelField:U,virtualScroll:I,optionHeight:A=36,onSearch:y,loading:T,renderOption:V,multipleAutosize:R=!1,showKeyboardHints:G,labelPlacement:re,errorPlacement:le,labelWidth:X,controlWidth:Z,displayMode:de},b)=>{const N=o.sc(_,$),K=N==="hidden";(N==="disabled"||N==="readOnly")&&(n=!0);const{t:H}=o.Zt(),M=o.Ns("input",S),ee=o.Es("input",S),ae=o._s($),ue=o.zs({enabled:de,disabled:n}),[Y,P]=l.useState(!1),[oe,ie]=l.useState(""),[a,g]=l.useState(-1),[z,C]=l.useState(0),O=l.useRef(null),W=l.useRef(null),[xe,ve]=l.useState(null);l.useLayoutEffect(()=>{!T&&W.current&&ve(W.current.offsetWidth)},[T,x,S]);const[pe,je]=l.useState(null);l.useLayoutEffect(()=>{m&&!R&&W.current&&pe==null&&je(W.current.offsetWidth)},[m,R,pe]);const ye=o.vd(v??null,L??v?.keyField??"id",U??"name"),fe=v?ye.options:(Q??[]).map(r=>typeof r=="string"?{value:r,label:r}:r);o.Vs(O,()=>{P(!1),ie("")});const se=l.useMemo(()=>x?Array.isArray(x)?x:[x]:[],[x]),ne=l.useMemo(()=>{if(!oe&&!y||y)return fe;const r=oe.toLowerCase();return fe.filter(B=>B.label.toLowerCase().includes(r)||String(B.value).toLowerCase().includes(r))},[fe,oe,y]),we=l.useMemo(()=>{const r=new Map;for(const B of ne){const q=B.group||"";r.has(q)||r.set(q,[]),r.get(q).push(B)}return r},[ne]),he=l.useCallback(r=>{if(m){const B=se.includes(r)?se.filter(q=>q!==r):[...se,r];w?.(B)}else w?.(r),P(!1),ie("")},[m,se,w]),Me=l.useCallback(r=>{if(r.key==="Escape"){P(!1),ie("");return}if(r.key==="Enter"||r.key===" "){if(!Y){P(!0),r.preventDefault();return}a>=0&&ne[a]&&(he(ne[a].value),r.preventDefault());return}r.key==="ArrowDown"&&(r.preventDefault(),g(B=>Math.min(B+1,ne.length-1))),r.key==="ArrowUp"&&(r.preventDefault(),g(B=>Math.max(B-1,0)))},[Y,a,ne,he]),ge=l.useMemo(()=>se.length===0?null:m?se.map(r=>fe.find(B=>B.value===r)?.label||r).join(", "):fe.find(r=>r.value===se[0])?.label||se[0],[se,fe,m]),$e=l.useCallback(r=>{r.stopPropagation(),w?.(m?[]:"")},[w,m]),be=l.useMemo(()=>[{key:"Enter",description:H("shortcuts.select","Select")},{key:"Space",description:H("shortcuts.openDropdown","Open dropdown")},o.xc.moveUp,o.xc.moveDown,o.xc.cancel],[H]);return K?null:e.jsxs("div",{className:`nice-field ${Z==null?"nice-field--select-auto":""} nice-field--${i} ${re==="left"?"nice-field--label-left":""} ${T?"nice-field--loading":""} ${h||""}`,style:{...f,...X!=null&&{"--nice-field-label-width":typeof X=="number"?`${X}px`:X},...Z!=null&&{"--nice-field-control-width":typeof Z=="number"?`${Z}px`:Z},...T&&xe!=null&&{"--nice-select-locked-width":`${xe}px`}},"aria-busy":T||void 0,children:[t&&e.jsxs("label",{htmlFor:ae,className:`nice-field__label ${u?"nice-field__label--required":""}`,children:[t,G&&e.jsx(o.Qr,{shortcuts:be,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",children:[ue.isDisplay?e.jsx(o.Fs,{value:ge,placeholder:F||H("controls.select","Select..."),disabled:n,onActivate:()=>{ue.enterEdit(),P(!0)},ariaLabel:t}):e.jsxs("div",{className:"nice-select",ref:O,children:[e.jsxs("button",{ref:r=>{W.current=r,typeof b=="function"?b(r):b&&(b.current=r)},type:"button",id:ae,role:"combobox","aria-expanded":Y,"aria-haspopup":"listbox","aria-invalid":!!s,className:`nice-select__trigger nice-select__trigger--${i} nice-select--ds-${ee} ${Y?"nice-select__trigger--open":""} ${s?"nice-select__trigger--error":""} ${n?"nice-select__trigger--disabled":""}`,style:{...M,...m&&!R&&pe!=null?{width:pe,maxWidth:pe,overflow:"hidden"}:{}},disabled:n,onClick:()=>P(!Y),onKeyDown:Me,children:[ge?e.jsx("span",{style:m&&!R?{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:void 0,children:ge}):e.jsx("span",{className:"nice-select__placeholder",children:F||H("controls.select","Select...")}),e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[D&&se.length>0&&e.jsx("span",{className:"nice-input__clear",onClick:$e,role:"button","aria-label":H("controls.clear","Clear"),children:"✕"}),e.jsx("svg",{className:`nice-select__chevron ${Y?"nice-select__chevron--open":""}`,viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})})]})]}),Y&&e.jsxs("div",{className:"nice-select__dropdown",role:"listbox",style:{maxHeight:E},onScroll:I?r=>C(r.currentTarget.scrollTop):void 0,children:[(J||y)&&e.jsx("div",{className:"nice-select__search",children:e.jsx("input",{type:"text",value:oe,onChange:r=>{ie(r.target.value),g(0),y?.(r.target.value)},placeholder:H("controls.search","Search..."),autoFocus:!0})}),T&&e.jsx("div",{className:"nice-select__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--sm",style:{margin:"8px auto"}})}),!T&&ne.length===0?e.jsx("div",{className:"nice-select__empty",children:k||H("controls.noResults","No results found")}):I&&!Array.from(we.keys()).some(r=>r!=="")?(()=>{const B=ne.length*A,q=Math.max(0,Math.floor(z/A)-3),me=Math.min(ne.length,Math.ceil((z+E)/A)+3),ke=ne.slice(q,me);return e.jsx("div",{style:{height:B,position:"relative"},children:ke.map((te,c)=>{const j=q+c,ce=se.includes(te.value);return e.jsx("div",{role:"option","aria-selected":ce,className:`nice-select__option ${ce?"nice-select__option--selected":""} ${j===a?"nice-select__option--highlighted":""} ${te.disabled?"nice-select__option--disabled":""}`,style:{position:"absolute",top:j*A,left:0,right:0,height:A,display:"flex",alignItems:"center",padding:"0 12px"},onClick:()=>!te.disabled&&he(String(te.value)),onMouseEnter:()=>g(j),children:V?V(te,ce):e.jsxs(e.Fragment,{children:[te.icon&&e.jsx("span",{children:te.icon}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{children:te.label}),te.description&&e.jsx("div",{className:"nice-select__option-desc",children:te.description})]}),ce&&e.jsx("svg",{className:"nice-select__option-check",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})]})},te.value)})})})():Array.from(we.entries()).map(([r,B])=>e.jsxs(l.Fragment,{children:[r&&e.jsx("div",{className:"nice-select__group-label",children:r}),B.map(q=>{const me=se.includes(q.value),ke=ne.indexOf(q);return e.jsx("div",{role:"option","aria-selected":me,className:`nice-select__option ${me?"nice-select__option--selected":""} ${ke===a?"nice-select__option--highlighted":""} ${q.disabled?"nice-select__option--disabled":""}`,onClick:()=>!q.disabled&&he(String(q.value)),onMouseEnter:()=>g(ke),children:V?V(q,me):e.jsxs(e.Fragment,{children:[q.icon&&e.jsx("span",{children:q.icon}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{children:q.label}),q.description&&e.jsx("div",{className:"nice-select__option-desc",children:q.description})]}),me&&e.jsx("svg",{className:"nice-select__option-check",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})]})},q.value)})]},r))]})]}),T&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),le==="right"&&s&&e.jsx("div",{id:`${ae}-error`,className:"nice-field__error",role:"alert",children:s}),le==="right"&&!s&&p&&e.jsx("div",{id:`${ae}-helper`,className:"nice-field__helper",children:p})]}),le!=="right"&&s&&e.jsx("div",{id:`${ae}-error`,className:"nice-field__error",role:"alert",children:s}),le!=="right"&&!s&&p&&e.jsx("div",{id:`${ae}-helper`,className:"nice-field__helper",children:p})]})});Ee.displayName="NiceSelect";const Ae=Object.freeze(Object.defineProperty({__proto__:null,NiceSelect:Ee},Symbol.toStringTag,{value:"Module"})),Re=l.forwardRef(({label:t,checked:p=!1,indeterminate:s=!1,onChange:u,disabled:n,readOnly:i,loading:d,required:$,size:h="md",name:f,id:_,className:S,style:Q,error:x,helperText:w,accessMode:F,displayStyle:m,showKeyboardHints:J,labelPlacement:D,errorPlacement:k,labelWidth:E,controlWidth:v},L)=>{const U=o.sc(F,_),I=U==="hidden";(U==="disabled"||U==="readOnly")&&(n=!0);const{t:A}=o.Zt(),y=o._s(_);o.Es("toggle",m);const T=l.useMemo(()=>[{key:"Space",description:A("shortcuts.toggle","Toggle")}],[A]),V=l.useCallback(R=>{R&&(R.indeterminate=s),typeof L=="function"?L(R):L&&(L.current=R)},[s,L]);return I?null:e.jsxs("div",{className:`nice-field nice-field--inline nice-field--${h} ${D==="left"?"nice-field--label-left":""} ${k==="right"?"nice-field--error-right":""} ${d?"nice-field--loading":""} ${S||""}`,style:{...Q,...E!=null&&{"--nice-field-label-width":typeof E=="number"?`${E}px`:E},...v!=null&&{"--nice-field-control-width":typeof v=="number"?`${v}px`:v}},"aria-busy":d||void 0,children:[D==="left"&&t&&e.jsx("span",{className:`nice-field__label ${$?"nice-field__label--required":""}`,children:t}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("label",{className:`nice-checkbox ${h!=="md"?`nice-checkbox--${h}`:""} ${n||d?"nice-checkbox--disabled":""}`,htmlFor:y,children:[e.jsx("input",{ref:V,id:y,type:"checkbox",className:"nice-checkbox__input",name:f,checked:p,disabled:n||d,readOnly:i,"aria-invalid":!!x,onChange:R=>{i||d||u?.(R.target.checked)}}),e.jsx("span",{className:"nice-checkbox__box",children:e.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s?e.jsx("line",{x1:"2",y1:"6",x2:"10",y2:"6"}):e.jsx("polyline",{points:"2 6 5 9 10 3"})})}),D!=="left"&&t&&e.jsx("span",{children:t}),J&&e.jsx(o.Qr,{shortcuts:T,size:"sm"})]}),d&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),k==="right"&&x&&e.jsx("div",{id:`${y}-error`,className:"nice-field__error",role:"alert",children:x}),k==="right"&&!x&&w&&e.jsx("div",{id:`${y}-helper`,className:"nice-field__helper",children:w})]}),k!=="right"&&x&&e.jsx("div",{id:`${y}-error`,className:"nice-field__error",role:"alert",children:x}),k!=="right"&&!x&&w&&e.jsx("div",{id:`${y}-helper`,className:"nice-field__helper",children:w})]})});Re.displayName="NiceCheckbox";const Be=Object.freeze(Object.defineProperty({__proto__:null,NiceCheckbox:Re},Symbol.toStringTag,{value:"Module"})),Fe=l.forwardRef(({label:t,checked:p=!1,onChange:s,disabled:u,readOnly:n,loading:i,required:d,size:$="md",name:h,id:f,className:_,style:S,accessMode:Q,displayStyle:x,showKeyboardHints:w,error:F,helperText:m,labelPlacement:J,errorPlacement:D,labelWidth:k,controlWidth:E},v)=>{const L=o.sc(Q,f),U=L==="hidden";(L==="disabled"||L==="readOnly")&&(u=!0);const{t:I}=o.Zt(),A=o._s(f);o.Ns("toggle",x);const y=o.Es("toggle",x),T=l.useMemo(()=>[{key:"Space",description:I("shortcuts.toggle","Toggle on/off")}],[I]);return U?null:e.jsxs("div",{className:`nice-field nice-field--inline nice-field--${$} ${J==="left"?"nice-field--label-left":""} ${i?"nice-field--loading":""} ${_||""}`,style:{...S,...k!=null&&{"--nice-field-label-width":typeof k=="number"?`${k}px`:k},...E!=null&&{"--nice-field-control-width":typeof E=="number"?`${E}px`:E}},"aria-busy":i||void 0,children:[J==="left"&&t&&e.jsx("span",{className:`nice-field__label ${d?"nice-field__label--required":""}`,children:t}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("label",{className:`nice-toggle nice-toggle--ds-${y} ${$!=="md"?`nice-toggle--${$}`:""} ${u||i?"nice-toggle--disabled":""}`,htmlFor:A,children:[e.jsx("input",{ref:v,id:A,type:"checkbox",className:"nice-toggle__input",name:h,checked:p,disabled:u||i,readOnly:n,role:"switch","aria-checked":p,"aria-invalid":!!F,onChange:V=>{n||i||s?.(V.target.checked)}}),e.jsx("span",{className:"nice-toggle__track",children:e.jsx("span",{className:"nice-toggle__thumb"})}),J!=="left"&&t&&e.jsx("span",{children:t}),w&&e.jsx(o.Qr,{shortcuts:T,size:"sm"})]}),i&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),D==="right"&&F&&e.jsx("div",{id:`${A}-error`,className:"nice-field__error",role:"alert",children:F}),D==="right"&&!F&&m&&e.jsx("div",{id:`${A}-helper`,className:"nice-field__helper",children:m})]}),D!=="right"&&F&&e.jsx("div",{id:`${A}-error`,className:"nice-field__error",role:"alert",children:F}),D!=="right"&&!F&&m&&e.jsx("div",{id:`${A}-helper`,className:"nice-field__helper",children:m})]})});Fe.displayName="NiceToggle";const qe=["var(--nice-danger, #ef4444)","var(--nice-warning, #f97316)","var(--nice-warning, #f59e0b)","var(--nice-success, #84cc16)","var(--nice-success, #10b981)","var(--nice-info, #06b6d4)","var(--nice-primary, #3b82f6)","var(--nice-info, #6366f1)","var(--nice-accent, #8b5cf6)","var(--nice-accent-pink, #ec4899)","var(--nice-text-secondary, #64748b)","var(--nice-text, #1e293b)"];function ze(){return"#"+Math.floor(Math.random()*16777215).toString(16).padStart(6,"0")}function Ue(t){const p=/^#?([0-9a-f]{6})$/i.exec(t.trim());if(!p)return{r:0,g:0,b:0};const s=parseInt(p[1],16);return{r:s>>16&255,g:s>>8&255,b:s&255}}function Ke(t,p,s){const u=n=>Math.max(0,Math.min(255,Math.round(n))).toString(16).padStart(2,"0");return`#${u(t)}${u(p)}${u(s)}`}function Qe(t,p,s){const u=t/255,n=p/255,i=s/255,d=Math.max(u,n,i),$=Math.min(u,n,i),h=(d+$)/2;let f=0,_=0;if(d!==$){const S=d-$;switch(_=h>.5?S/(2-d-$):S/(d+$),d){case u:f=(n-i)/S+(n<i?6:0);break;case n:f=(i-u)/S+2;break;case i:f=(u-n)/S+4;break}f*=60}return{h:Math.round(f),s:Math.round(_*100),l:Math.round(h*100)}}function Ve(t,p,s){const u=p/100,n=s/100,i=(1-Math.abs(2*n-1))*u,d=i*(1-Math.abs(t/60%2-1)),$=n-i/2;let h=0,f=0,_=0;return t<60?[h,f,_]=[i,d,0]:t<120?[h,f,_]=[d,i,0]:t<180?[h,f,_]=[0,i,d]:t<240?[h,f,_]=[0,d,i]:t<300?[h,f,_]=[d,0,i]:[h,f,_]=[i,0,d],{r:Math.round((h+$)*255),g:Math.round((f+$)*255),b:Math.round((_+$)*255)}}function Ze(t,p,s){const u=t/255,n=p/255,i=s/255,d=Math.max(u,n,i),$=Math.min(u,n,i),h=d-$;let f=0;h!==0&&(d===u?f=(n-i)/h%6:d===n?f=(i-u)/h+2:f=(u-n)/h+4,f*=60,f<0&&(f+=360));const _=d===0?0:h/d;return{h:Math.round(f),s:Math.round(_*100),v:Math.round(d*100)}}function Pe(t,p,s){const u=p/100,n=s/100,i=n*u,d=i*(1-Math.abs(t/60%2-1)),$=n-i;let h=0,f=0,_=0;return t<60?[h,f,_]=[i,d,0]:t<120?[h,f,_]=[d,i,0]:t<180?[h,f,_]=[0,i,d]:t<240?[h,f,_]=[0,d,i]:t<300?[h,f,_]=[d,0,i]:[h,f,_]=[i,0,d],{r:Math.round((h+$)*255),g:Math.round((f+$)*255),b:Math.round((_+$)*255)}}function Ge(t){const p=/^#?([0-9a-f]{6})$/i.exec(t.trim()),s=/^#?([0-9a-f]{8})$/i.exec(t.trim());if(s){const u=s[1];return{r:parseInt(u.slice(0,2),16),g:parseInt(u.slice(2,4),16),b:parseInt(u.slice(4,6),16),a:parseInt(u.slice(6,8),16)/255}}if(p){const u=parseInt(p[1],16);return{r:u>>16&255,g:u>>8&255,b:u&255,a:1}}return{r:0,g:0,b:0,a:1}}function Xe(t,p,s,u,n){const i=$=>Math.max(0,Math.min(255,Math.round($))).toString(16).padStart(2,"0"),d=`#${i(t)}${i(p)}${i(s)}`;return n?`${d}${i(u*255)}`:d}const De=l.forwardRef(({label:t,helperText:p,error:s,required:u,disabled:n,id:i,className:d,style:$,accessMode:h,displayStyle:f,value:_="var(--nice-primary, #3b82f6)",onChange:S,presets:Q=qe,showInput:x=!0,showRandom:w=!0,withAlpha:F=!1,showKeyboardHints:m,size:J="md",labelPlacement:D,errorPlacement:k,labelWidth:E,controlWidth:v,loading:L},U)=>{const I=o.sc(h,i),A=I==="hidden";(I==="disabled"||I==="readOnly")&&(n=!0);const{t:y}=o.Zt(),T=o._s(i);o.Es("input",f);const V=l.useCallback(()=>{n||S?.(ze())},[n,S]),[R,G]=l.useState(!1),[re,le]=l.useState(null),X=l.useRef(null),Z=l.useRef(null);l.useLayoutEffect(()=>{if(!R||!Z.current)return;const b=()=>{const N=Z.current?.getBoundingClientRect();if(!N)return;const K=280,H=360;let M=N.left,ee=N.bottom+6;M+K>window.innerWidth-8&&(M=Math.max(8,window.innerWidth-K-8)),ee+H>window.innerHeight-8&&(ee=Math.max(8,N.top-H-6)),le({left:M,top:ee})};return b(),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}},[R]),l.useEffect(()=>{if(!R)return;const b=K=>{const H=K.target;X.current?.contains(H)||Z.current?.contains(H)||G(!1)},N=K=>{K.key==="Escape"&&G(!1)};return document.addEventListener("mousedown",b),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",N)}},[R]);const de=l.useMemo(()=>[{key:"Enter",description:y("shortcuts.openPicker","Open color picker")},{key:"Arrow keys",description:y("shortcuts.navigatePresets","Navigate presets")}],[y]);return A?null:e.jsxs("div",{className:`nice-field nice-field--${J} ${D==="left"?"nice-field--label-left":""} ${L?"nice-field--loading":""} ${d||""}`,style:{...$,...E!=null&&{"--nice-field-label-width":typeof E=="number"?`${E}px`:E},...v!=null&&{"--nice-field-control-width":typeof v=="number"?`${v}px`:v}},"aria-busy":L||void 0,children:[t&&e.jsxs("label",{htmlFor:T,className:`nice-field__label ${u?"nice-field__label--required":""}`,children:[t,m&&e.jsx(o.Qr,{shortcuts:de,size:"sm"})]}),e.jsx("div",{className:"nice-field__control",children:e.jsxs("div",{className:"nice-color-picker",children:[e.jsxs("div",{className:"nice-color-picker__preview-row",children:[e.jsx("div",{ref:Z,className:"nice-color-picker__swatch",id:T,style:{background:_},onClick:b=>{b.stopPropagation(),n||G(N=>!N)},onKeyDown:b=>{!n&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),G(N=>!N))},role:"button",tabIndex:0,"aria-label":y("colorPicker.openPalette","Open color palette"),"aria-haspopup":"dialog","aria-expanded":R,children:e.jsx("input",{ref:b=>{typeof U=="function"?U(b):U&&(U.current=b)},type:"hidden",value:_,disabled:n,readOnly:!0})}),x&&e.jsx("div",{className:"nice-input nice-input--sm",style:{width:100},children:e.jsx("input",{className:"nice-input__native",type:"text",value:_,disabled:n,onChange:b=>S?.(b.target.value),maxLength:7})}),w&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",onClick:V,disabled:n,title:y("colorPicker.random","Random"),"aria-label":y("colorPicker.random","Random"),style:{fontSize:"0.65rem",textTransform:"uppercase",letterSpacing:"0.05em"},children:y("colorPicker.random","Random")}),L&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),k==="right"&&s&&e.jsx("div",{id:`${T}-error`,className:"nice-field__error",role:"alert",children:s}),k==="right"&&!s&&p&&e.jsx("div",{id:`${T}-helper`,className:"nice-field__helper",children:p})]}),R&&re&&typeof document<"u"&&Ie.createPortal(e.jsx("div",{ref:X,className:"nice-color-picker__popup nice-color-picker__popup--portal",role:"dialog","aria-label":y("colorPicker.palette","Color palette"),style:{position:"fixed",left:re.left,top:re.top},onClick:b=>b.stopPropagation(),children:(()=>{const b=Ge(_),N={r:b.r,g:b.g,b:b.b},K=F?b.a:1,H=Qe(N.r,N.g,N.b),M=Ze(N.r,N.g,N.b),ee=(a,g,z,C=K)=>S?.(Xe(a,g,z,C,F)),ae=(a,g,z)=>ee(a,g,z),ue=(a,g,z)=>{const C=Ve(a,g,z);ee(C.r,C.g,C.b)},Y=(a,g,z)=>{const C=Pe(a,g,z);ee(C.r,C.g,C.b)},P=a=>ee(N.r,N.g,N.b,a),oe=a=>{if(n)return;const g=a.currentTarget,z=O=>{const W=g.getBoundingClientRect(),xe=Math.max(0,Math.min(W.width,O.clientX-W.left)),ve=Math.max(0,Math.min(W.height,O.clientY-W.top)),pe=Math.round(xe/W.width*100),je=100-Math.round(ve/W.height*100);Y(M.h,pe,je)};z(a);const C=()=>{document.removeEventListener("pointermove",z),document.removeEventListener("pointerup",C)};document.addEventListener("pointermove",z),document.addEventListener("pointerup",C)},ie=`hsl(${M.h}, 100%, 50%)`;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-color-picker__popup-header",children:e.jsx("input",{type:"text",className:"nice-input__native nice-color-picker__popup-hex",value:_,disabled:n,onChange:a=>S?.(a.target.value),maxLength:F?9:7,"aria-label":y("colorPicker.hexValue","Hex value")})}),e.jsx("input",{type:"range",min:0,max:360,value:M.h,disabled:n,onChange:a=>Y(Number(a.target.value),M.s,M.v),className:"nice-color-picker__hue-slider","aria-label":y("colorPicker.hue","Hue")}),e.jsx("div",{className:"nice-color-picker__sv",style:{background:`linear-gradient(to top, var(--nice-text, #000), transparent), linear-gradient(to right, var(--nice-bg, #FFF), ${ie})`},onPointerDown:oe,role:"application","aria-label":y("colorPicker.svPalette","Saturation/value palette"),children:e.jsx("span",{className:"nice-color-picker__sv-marker",style:{left:`${M.s}%`,top:`${100-M.v}%`}})}),e.jsxs("div",{className:"nice-color-picker__sliders",children:[e.jsx("div",{className:"nice-color-picker__slider-col",children:["h","s","l"].map(a=>{const g=a==="h"?360:100,z=H[a],C=O=>ue(a==="h"?O:H.h,a==="s"?O:H.s,a==="l"?O:H.l);return e.jsxs("div",{className:"nice-color-picker__slider-row",children:[e.jsx("label",{className:"nice-color-picker__slider-label",children:a.toUpperCase()}),e.jsx("input",{type:"range",min:0,max:g,value:z,disabled:n,onChange:O=>C(Number(O.target.value))}),e.jsx("input",{type:"number",min:0,max:g,value:z,disabled:n,onChange:O=>C(Number(O.target.value)||0),className:"nice-input__native nice-color-picker__slider-num"})]},a)})}),e.jsx("div",{className:"nice-color-picker__slider-col",children:["r","g","b"].map(a=>{const g=N[a],z=C=>ae(a==="r"?C:N.r,a==="g"?C:N.g,a==="b"?C:N.b);return e.jsxs("div",{className:"nice-color-picker__slider-row",children:[e.jsx("label",{className:"nice-color-picker__slider-label",children:a.toUpperCase()}),e.jsx("input",{type:"range",min:0,max:255,value:g,disabled:n,onChange:C=>z(Number(C.target.value))}),e.jsx("input",{type:"number",min:0,max:255,value:g,disabled:n,onChange:C=>z(Number(C.target.value)||0),className:"nice-input__native nice-color-picker__slider-num"})]},a)})})]}),F&&e.jsxs("div",{className:"nice-color-picker__alpha-row",children:[e.jsx("label",{className:"nice-color-picker__slider-label",children:"A"}),e.jsx("input",{type:"range",min:0,max:100,value:Math.round(K*100),disabled:n,onChange:a=>P(Number(a.target.value)/100),className:"nice-color-picker__alpha-slider",style:{background:`linear-gradient(to right, transparent, rgb(${N.r},${N.g},${N.b}))`},"aria-label":y("colorPicker.alpha","Alpha")}),e.jsx("input",{type:"number",min:0,max:100,value:Math.round(K*100),disabled:n,onChange:a=>P((Number(a.target.value)||0)/100),className:"nice-input__native nice-color-picker__slider-num"})]}),Q.length>0&&e.jsx("div",{className:"nice-color-picker__popup-presets",children:Q.map(a=>e.jsx("div",{className:`nice-color-picker__preset ${_===a?"nice-color-picker__preset--active":""}`,style:{background:a},onClick:()=>{S?.(a),G(!1)},role:"button",tabIndex:0,"aria-label":a,onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),S?.(a),G(!1))}},a))})]})})()}),document.body)]})}),k!=="right"&&s&&e.jsx("div",{id:`${T}-error`,className:"nice-field__error",role:"alert",children:s}),k!=="right"&&!s&&p&&e.jsx("div",{id:`${T}-helper`,className:"nice-field__helper",children:p})]})});De.displayName="NiceColorPicker";const Ye=Object.freeze(Object.defineProperty({__proto__:null,NiceColorPicker:De,hexToRgb:Ue,rgbToHex:Ke},Symbol.toStringTag,{value:"Module"})),Le=l.forwardRef(({children:t,variant:p="primary",size:s="md",type:u="button",disabled:n,loading:i,fullWidth:d,onClick:$,leftIcon:h,rightIcon:f,error:_,errorPlacement:S="bottom",className:Q,style:x,id:w,accessMode:F,displayStyle:m,...J},D)=>{const k=o.ws(p),E=o.xs(s),v=o.sc(F,w),L=v==="hidden";(v==="disabled"||v==="readOnly")&&(n=!0);const U=o.Ns("button",m),I=o.Es("button",m),A=k!=="primary"?(({background:V,color:R,...G})=>G)(U):U,y=e.jsxs("button",{ref:D,type:u,id:w,className:`nice-btn nice-btn--${k} nice-btn--${E} nice-btn--ds-${I} ${d?"nice-btn--full-width":""} ${i?"nice-btn--loading":""} ${_&&!S?"nice-btn--has-error":""} ${Q||""}`,style:{...A,...x},disabled:n||i,"aria-busy":i||void 0,"aria-disabled":n||i||void 0,onClick:$,...J,children:[i&&e.jsx("svg",{className:"nice-btn__spinner",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3","aria-hidden":"true",children:e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),!i&&h&&e.jsx("span",{"aria-hidden":"true",children:h}),!i&&e.jsx("span",{children:t}),i&&e.jsx("span",{style:{visibility:"hidden"},"aria-hidden":"true",children:t}),!i&&f&&e.jsx("span",{"aria-hidden":"true",children:f})]});if(L)return null;if(!_)return y;const T=e.jsx("div",{className:"nice-field__error",role:"alert",children:_});return S==="right"?e.jsxs("span",{className:`nice-btn-field nice-btn-field--right nice-field--${E}`,style:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:"8px",width:"fit-content"},children:[y,T]}):L?null:e.jsxs("span",{className:`nice-btn-field nice-btn-field--bottom nice-field--${E}`,style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:"4px",width:"fit-content"},children:[y,T]})});Le.displayName="NiceButton";const Je=({tabs:t,activeTab:p,onChange:s,variant:u="default",vertical:n,size:i="md",className:d,style:$,displayStyle:h})=>{const f=o.Ns("tab",h),_=o.Es("tab",h),[S,Q]=l.useState(p||t[0]?.id),x=p??S,w=l.useCallback(m=>{Q(m),s?.(m)},[s]),F=t.find(m=>m.id===x)?.content;return e.jsxs("div",{className:`nice-tabs nice-tabs--${i} nice-tabs--ds-${_} ${d||""}`,style:{...f,...$,...n?{display:"flex",gap:16}:{}},children:[e.jsx("div",{className:`nice-tabs__list ${u!=="default"?`nice-tabs__list--${u}`:""} ${n?"nice-tabs__list--vertical":""}`,role:"tablist",children:t.map(m=>e.jsxs("button",{type:"button",role:"tab","aria-selected":x===m.id,className:`nice-tabs__tab ${x===m.id?"nice-tabs__tab--active":""} ${m.disabled?"nice-tabs__tab--disabled":""}`,disabled:m.disabled,onClick:()=>w(m.id),children:[m.icon,e.jsx("span",{children:m.label}),m.badge!==void 0&&e.jsx("span",{className:"nice-tabs__badge",children:m.badge})]},m.id))}),F&&e.jsx("div",{className:"nice-tabs__panel",role:"tabpanel",children:F})]})};exports.NiceButton=Le;exports.NiceCheckbox=Re;exports.NiceCheckbox$1=Be;exports.NiceColorPicker=De;exports.NiceColorPicker$1=Ye;exports.NiceNumberInput=Se;exports.NiceNumberInput$1=He;exports.NiceSelect=Ee;exports.NiceSelect$1=Ae;exports.NiceTabs=Je;exports.NiceTextInput=Ce;exports.NiceTextInput$1=Te;exports.NiceToggle=Fe;
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),V=require("./core-CjUAwZ6z.cjs"),n=require("react"),ht=({visible:t,onClose:i,title:s,items:l,showCancelButton:m=!0,cancelText:h,className:x,style:w})=>{const{t:p}=V.Zt();return t?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-actionsheet__overlay",onClick:i}),e.jsxs("div",{className:`nice-actionsheet ${x||""}`,style:w,children:[s&&e.jsx("div",{className:"nice-actionsheet__title",children:s}),e.jsx("div",{className:"nice-actionsheet__items",children:l.map((b,a)=>e.jsxs("button",{className:`nice-actionsheet__item ${b.type==="danger"?"nice-actionsheet__item--danger":""}`,disabled:b.disabled,onClick:()=>{b.onClick?.(),i()},children:[b.icon&&e.jsx("span",{className:"nice-actionsheet__icon",children:b.icon}),b.text]},a))}),m&&e.jsx("button",{className:"nice-actionsheet__cancel",onClick:i,children:h||p("cancel","Cancel")})]})]}):null},ft=({visible:t,onClose:i,targetRef:s,position:l="bottom",title:m,showArrow:h=!0,width:x,children:w,className:p,style:b,displayStyle:a})=>{V.Es("tooltip",a);const N=n.useRef(null),[Y,S]=n.useState({top:0,left:0}),E=n.useCallback(()=>{const R=s.current,B=N.current;if(!R||!B)return;const c=R.getBoundingClientRect(),g=B.getBoundingClientRect();let r=0,j=0;const _=8;switch(l){case"top":r=c.top-g.height-_,j=c.left+(c.width-g.width)/2;break;case"bottom":r=c.bottom+_,j=c.left+(c.width-g.width)/2;break;case"left":r=c.top+(c.height-g.height)/2,j=c.left-g.width-_;break;case"right":r=c.top+(c.height-g.height)/2,j=c.right+_;break}S({top:r+window.scrollY,left:j+window.scrollX})},[s,l]);return n.useEffect(()=>{if(t){requestAnimationFrame(E);const R=B=>{N.current&&!N.current.contains(B.target)&&s.current&&!s.current.contains(B.target)&&i()};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)}},[t,E,i,s]),t?e.jsxs("div",{ref:N,className:`nice-popover nice-popover--${l} ${p||""}`,style:{...b,position:"absolute",top:Y.top,left:Y.left,width:x},children:[h&&e.jsx("div",{className:`nice-popover__arrow nice-popover__arrow--${l}`}),m&&e.jsx("div",{className:"nice-popover__title",children:m}),e.jsx("div",{className:"nice-popover__content",children:w})]}):null},pt=({visible:t,message:i,container:s,showIndicator:l=!0,shading:m=!0,className:h,style:x})=>{const{t:w}=V.Zt();if(!t)return null;const p=!!s?.current,b=e.jsxs("div",{className:`nice-loadpanel ${h||""}`,style:x,children:[m&&e.jsx("div",{className:"nice-loadpanel__shade"}),e.jsxs("div",{className:"nice-loadpanel__box",children:[l&&e.jsx("div",{className:"nice-spinner nice-spinner--md"}),e.jsx("span",{className:"nice-loadpanel__text",children:i||w("loading","Loading...")})]})]});if(p&&s.current){const a=s.current;return a.style.position=a.style.position||"relative",b}return b},xt=({direction:t="row",align:i,justify:s,wrap:l,gap:m,flex:h,children:x,className:w,style:p})=>e.jsx("div",{className:`nice-box ${w||""}`,style:{display:"flex",flexDirection:t,alignItems:i,justifyContent:s,flexWrap:l?"wrap":void 0,gap:m,flex:h,...p},children:x}),wt=({direction:t="row",items:i,gap:s,className:l,style:m})=>e.jsx("div",{className:`nice-responsivebox ${l||""}`,style:{display:"flex",flexDirection:t,gap:s,...m},children:i.map((h,x)=>e.jsx("div",{style:{flex:h.ratio??1,flexBasis:h.baseSize,flexShrink:h.shrink??1},children:h.children},x))}),_t=({width:t=200,height:i=200,minWidth:s=50,minHeight:l=50,maxWidth:m=1/0,maxHeight:h=1/0,handles:x=["right","bottom","bottomRight"],onResize:w,children:p,className:b,style:a})=>{const[N,Y]=n.useState({width:t,height:i}),S=n.useRef(null),E=(c,g)=>{g.preventDefault();const r=g.clientX,j=g.clientY,_=N.width,U=N.height,M={n:"top",s:"bottom",e:"right",w:"left",ne:"topRight",se:"bottomRight",sw:"bottomLeft",nw:"topLeft"}[c]??c,o=M==="right"||M==="topRight"||M==="bottomRight",k=M==="left"||M==="topLeft"||M==="bottomLeft",y=M==="bottom"||M==="bottomRight"||M==="bottomLeft",I=M==="top"||M==="topRight"||M==="topLeft",d=u=>{const L=u.clientX-r,f=u.clientY-j;let P=_,O=U;o&&(P=_+L),k&&(P=_-L),y&&(O=U+f),I&&(O=U-f),P=Math.max(s,Math.min(m,P)),O=Math.max(l,Math.min(h,O)),Y({width:P,height:O}),w?.({width:P,height:O})},v=()=>{document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",v)};document.addEventListener("pointermove",d),document.addEventListener("pointerup",v)},R=c=>{switch(c){case"top":case"bottom":return"ns-resize";case"left":case"right":return"ew-resize";case"topLeft":case"bottomRight":return"nwse-resize";case"topRight":case"bottomLeft":return"nesw-resize";default:return"default"}},B=c=>{const g={position:"absolute",zIndex:1},r=8;return c==="right"?{...g,top:0,right:-r/2,width:r,height:"100%",cursor:R(c)}:c==="bottom"?{...g,left:0,bottom:-r/2,width:"100%",height:r,cursor:R(c)}:c==="left"?{...g,top:0,left:-r/2,width:r,height:"100%",cursor:R(c)}:c==="top"?{...g,top:-r/2,left:0,width:"100%",height:r,cursor:R(c)}:c==="bottomRight"?{...g,bottom:-r/2,right:-r/2,width:r*2,height:r*2,cursor:R(c)}:c==="bottomLeft"?{...g,bottom:-r/2,left:-r/2,width:r*2,height:r*2,cursor:R(c)}:c==="topRight"?{...g,top:-r/2,right:-r/2,width:r*2,height:r*2,cursor:R(c)}:c==="topLeft"?{...g,top:-r/2,left:-r/2,width:r*2,height:r*2,cursor:R(c)}:g};return e.jsxs("div",{ref:S,className:`nice-resizable ${b||""}`,style:{...a,width:N.width,height:N.height,position:"relative",overflow:"hidden"},children:[p,x.map(c=>e.jsx("div",{style:B(c),onPointerDown:g=>E(c,g)},c))]})},gt=({direction:t="vertical",showScrollbar:i="onInteraction",width:s,height:l,onScroll:m,children:h,className:x,style:w})=>{const p=t==="horizontal"||t==="both"?"auto":"hidden",b=t==="vertical"||t==="both"?"auto":"hidden",a=i==="never"?"nice-scrollview--hide-sb":i==="always"?"nice-scrollview--show-sb":"";return e.jsx("div",{className:`nice-scrollview ${a} ${x||""}`,style:{...w,width:s,height:l,overflowX:p,overflowY:b},onScroll:m,children:h})};function Me(t,i){if(!t)return{score:1,indices:[]};const s=t.toLowerCase(),l=i.toLowerCase();let m=0;const h=[];let x=0,w=-1;for(let p=0;p<l.length&&m<s.length;p++)l[p]===s[m]&&(h.push(p),w===p-1&&(x+=3),(p===0||/[\s\-_/.]/.test(i[p-1]))&&(x+=5),i[p]===t[m]&&(x+=1),x+=1,w=p,m++);return m<s.length?null:(x-=h[0]*.1,{score:x,indices:h})}function Oe(t,i){if(i.length===0)return[t];const s=[];let l=0;const m=new Set(i);for(let h=0;h<t.length;h++)m.has(h)&&(l<h&&s.push(t.slice(l,h)),s.push(n.createElement("mark",{key:`m-${h}`,className:"nice-command-palette__match"},t[h])),l=h+1);return l<t.length&&s.push(t.slice(l)),s}function bt(t,i){switch(i.type){case"REGISTER":{const s=new Map(t.commands);return s.set(i.command.id,i.command),{...t,commands:s}}case"REGISTER_BATCH":{const s=new Map(t.commands);for(const l of i.commands)s.set(l.id,l);return{...t,commands:s}}case"UNREGISTER":{const s=new Map(t.commands);return s.delete(i.id),{...t,commands:s}}case"OPEN":return{...t,isOpen:!0,query:"",selectedIndex:0};case"CLOSE":return{...t,isOpen:!1,query:"",selectedIndex:0};case"SET_QUERY":return{...t,query:i.query,selectedIndex:0};case"SET_SELECTED":return{...t,selectedIndex:i.index};case"ADD_RECENT":{const s=t.recentIds.filter(l=>l!==i.id);return{...t,recentIds:[i.id,...s].slice(0,i.maxRecent)}}default:return t}}const qe=n.createContext(null);function We(){const t=n.useContext(qe);if(!t)throw new Error("useCommandPalette must be used within NiceCommandPaletteProvider");return t}const Ae=({children:t,commands:i,placeholder:s="Type a command...",maxVisible:l=10,maxRecent:m=5,className:h,emptyText:x="No commands found",closeOnAction:w=!0,onOpen:p,onClose:b})=>{const[a,N]=n.useReducer(bt,{commands:new Map(i?.map(d=>[d.id,d])??[]),isOpen:!1,query:"",selectedIndex:0,recentIds:[]}),Y=n.useRef(null),S=n.useRef(null),[E,R]=n.useState(!1),B=n.useCallback(d=>{N({type:"REGISTER",command:d})},[]),c=n.useCallback(d=>{N({type:"UNREGISTER",id:d})},[]),g=n.useCallback(d=>{N({type:"REGISTER_BATCH",commands:d})},[]),r=n.useCallback(()=>{N({type:"OPEN"}),p?.()},[p]),j=n.useCallback(()=>{N({type:"CLOSE"}),b?.()},[b]),_=n.useCallback(()=>{a.isOpen?j():r()},[a.isOpen,j,r]),D=n.useMemo(()=>{const d=Array.from(a.commands.values()).filter(u=>!u.hidden);if(!a.query.trim()){const u=a.recentIds.map(f=>a.commands.get(f)).filter(f=>!!f&&!f.hidden),L=d.filter(f=>!a.recentIds.includes(f.id));return L.sort((f,P)=>f.label.localeCompare(P.label)),[...u,...L].map(f=>({command:f,match:null,isRecent:a.recentIds.includes(f.id)}))}return d.map(u=>{const L=Me(a.query,u.label),f=u.description?Me(a.query,u.description):null,P=u.keywords?.map(H=>Me(a.query,H)).filter(Boolean)[0]??null,O=[L,f,P].filter(Boolean).sort((H,J)=>(J?.score??0)-(H?.score??0))[0];return{command:u,match:O,isRecent:!1}}).filter(u=>u.match!==null).sort((u,L)=>(L.match?.score??0)-(u.match?.score??0))},[a.commands,a.query,a.recentIds]).slice(0,l),M=n.useCallback(async d=>{const v=a.commands.get(d);if(!(!v||v.disabled)){R(!0);try{await v.action(),N({type:"ADD_RECENT",id:d,maxRecent:m})}finally{R(!1),w&&j()}}},[a.commands,m,w,j]);n.useEffect(()=>{const d=v=>{(v.metaKey||v.ctrlKey)&&v.key==="k"&&(v.preventDefault(),_()),v.key==="Escape"&&a.isOpen&&(v.preventDefault(),j())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[_,a.isOpen,j]),n.useEffect(()=>{a.isOpen&&requestAnimationFrame(()=>Y.current?.focus())},[a.isOpen]);const o=n.useCallback(d=>{const v=D.length;if(v){if(d.key==="ArrowDown")d.preventDefault(),N({type:"SET_SELECTED",index:(a.selectedIndex+1)%v});else if(d.key==="ArrowUp")d.preventDefault(),N({type:"SET_SELECTED",index:(a.selectedIndex-1+v)%v});else if(d.key==="Enter"){d.preventDefault();const u=D[a.selectedIndex];u&&M(u.command.id)}}},[D,a.selectedIndex,M]);n.useEffect(()=>{if(!S.current)return;S.current.children[a.selectedIndex]?.scrollIntoView({block:"nearest"})},[a.selectedIndex]);const k=n.useMemo(()=>({registerCommand:B,unregisterCommand:c,registerCommands:g,open:r,close:j,toggle:_,isOpen:a.isOpen,executeCommand:M}),[B,c,g,r,j,_,a.isOpen,M]),y=n.useMemo(()=>{const d=new Map;for(const v of D){const u=v.command.category??"General";d.has(u)||d.set(u,[]),d.get(u).push(v)}return d},[D]);let I=0;return e.jsxs(qe.Provider,{value:k,children:[t,a.isOpen&&e.jsx("div",{className:`nice-command-palette__overlay ${h??""}`,onClick:j,children:e.jsxs("div",{className:"nice-command-palette",role:"dialog","aria-label":"Command Palette","aria-modal":"true",onClick:d=>d.stopPropagation(),children:[e.jsx("div",{className:"nice-command-palette__input-wrapper",children:e.jsx("input",{ref:Y,className:"nice-command-palette__input",type:"text",placeholder:s,value:a.query,onChange:d=>N({type:"SET_QUERY",query:d.target.value}),onKeyDown:o,"aria-label":"Search commands","aria-autocomplete":"list","aria-controls":"nice-command-palette-list","aria-activedescendant":D[a.selectedIndex]?`nice-cmd-${D[a.selectedIndex].command.id}`:void 0})}),e.jsxs("div",{ref:S,id:"nice-command-palette-list",className:"nice-command-palette__list",role:"listbox",children:[D.length===0&&e.jsx("div",{className:"nice-command-palette__empty",children:x}),Array.from(y.entries()).map(([d,v])=>e.jsxs("div",{className:"nice-command-palette__group",children:[e.jsx("div",{className:"nice-command-palette__category",children:d}),v.map(u=>{const L=I++,f=L===a.selectedIndex;return e.jsxs("div",{id:`nice-cmd-${u.command.id}`,className:`nice-command-palette__item ${f?"nice-command-palette__item--selected":""} ${u.command.disabled?"nice-command-palette__item--disabled":""}`,role:"option","aria-selected":f,"aria-disabled":u.command.disabled,onClick:()=>!u.command.disabled&&M(u.command.id),onMouseEnter:()=>N({type:"SET_SELECTED",index:L}),children:[u.command.icon&&e.jsx("span",{className:"nice-command-palette__icon",children:u.command.icon}),e.jsxs("div",{className:"nice-command-palette__label-group",children:[e.jsx("span",{className:"nice-command-palette__label",children:u.match&&a.query?Oe(u.command.label,u.match.indices):u.command.label}),u.command.description&&e.jsx("span",{className:"nice-command-palette__description",children:u.command.description})]}),u.command.shortcut&&e.jsx("kbd",{className:"nice-command-palette__shortcut",children:u.command.shortcut}),u.isRecent&&e.jsx("span",{className:"nice-command-palette__recent-badge",children:"Recent"})]},u.command.id)})]},d))]}),E&&e.jsx("div",{className:"nice-command-palette__executing",children:"Executing..."})]})})]})};Ae.displayName="NiceCommandPaletteProvider";function vt(t){const{registerCommands:i,unregisterCommand:s}=We();n.useEffect(()=>(i(t),()=>{for(const l of t)s(l.id)}),[])}const Fe=n.forwardRef(({blocked:t,message:i,children:s,className:l,style:m,id:h},x)=>{const w=V._s(h);return e.jsxs("div",{ref:x,id:w,className:`nice-block-ui ${l||""}`,style:{position:"relative",...m},children:[s,t&&e.jsx("div",{className:"nice-block-ui__overlay","aria-busy":"true",role:"alert",children:i&&e.jsx("div",{className:"nice-block-ui__message",children:i})})]})});Fe.displayName="NiceBlockUI";const Ue=n.forwardRef(({windows:t,children:i,onChange:s,onClose:l,onFocus:m,showTaskbar:h=!0,size:x="md",className:w,style:p,id:b,...a},N)=>{const Y=V._s(b),{t:S}=V.Zt(),[E,R]=n.useState(null),B=n.useRef(null),c=t??[],g=Math.max(1,...c.map(o=>o.zIndex??1)),r=n.useCallback((o,k)=>{const y=c.map(I=>I.key===o?{...I,...k}:I);s?.(y)},[c,s]),j=n.useCallback(o=>{r(o,{zIndex:g+1}),m?.(o)},[r,g,m]),_=n.useCallback(o=>{l?.(o),s?.(c.filter(k=>k.key!==o))},[c,s,l]),U=n.useCallback(o=>{const k=c.find(y=>y.key===o);k&&r(o,{minimized:!k.minimized,maximized:!1})},[c,r]),D=n.useCallback(o=>{const k=c.find(y=>y.key===o);k&&r(o,{maximized:!k.maximized,minimized:!1})},[c,r]);n.useEffect(()=>{if(!E)return;const o=y=>{const I=c.find(d=>d.key===E.key);if(I)if(E.mode==="move")r(E.key,{x:y.clientX-E.offsetX,y:y.clientY-E.offsetY});else{const v=B.current?.getBoundingClientRect(),u=v?.left??0,L=v?.top??0;r(E.key,{width:Math.max(200,y.clientX-u-I.x),height:Math.max(100,y.clientY-L-I.y)})}},k=()=>R(null);return document.addEventListener("mousemove",o),document.addEventListener("mouseup",k),()=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",k)}},[E,c,r]);const M=n.useCallback((o,k,y)=>{k.preventDefault();const I=c.find(d=>d.key===o);I&&(j(o),R({key:o,offsetX:y==="move"?k.clientX-I.x:0,offsetY:y==="move"?k.clientY-I.y:0,mode:y}))},[c,j]);return e.jsxs("div",{ref:o=>{B.current=o,typeof N=="function"?N(o):N&&(N.current=o)},id:Y,className:`nice-wm nice-wm--${x} ${w??""}`,style:{...p,position:"relative",overflow:"hidden"},...a,children:[c.map(o=>{if(o.minimized)return null;const k=o.maximized,y=k?{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:o.zIndex??1}:{position:"absolute",top:o.y,left:o.x,width:o.width,height:o.height,zIndex:o.zIndex??1};return e.jsxs("div",{className:`nice-wm__window ${k?"nice-wm__window--maximized":""}`,style:y,onMouseDown:()=>j(o.key),role:"dialog","aria-label":o.title,children:[e.jsxs("div",{className:"nice-wm__titlebar",onMouseDown:I=>!k&&M(o.key,I,"move"),children:[o.icon&&e.jsx("span",{className:"nice-wm__icon",children:o.icon}),e.jsx("span",{className:"nice-wm__title",children:o.title}),e.jsxs("div",{className:"nice-wm__controls",children:[(o.minimizable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--min",onClick:()=>U(o.key),title:S("wm.minimize","Minimize"),children:"─"}),(o.maximizable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--max",onClick:()=>D(o.key),title:S("wm.maximize","Maximize"),children:k?"❐":"☐"}),(o.closable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--close",onClick:()=>_(o.key),title:S("wm.close","Close"),children:"✕"})]})]}),e.jsx("div",{className:"nice-wm__body",children:o.content}),(o.resizable??!0)&&!k&&e.jsx("div",{className:"nice-wm__resize-handle",onMouseDown:I=>M(o.key,I,"resize")})]},o.key)}),t===void 0&&i,h&&e.jsx("div",{className:"nice-wm__taskbar",role:"toolbar","aria-label":S("wm.taskbar","Taskbar"),children:c.map(o=>e.jsxs("button",{type:"button",className:`nice-wm__taskbar-btn ${o.minimized?"nice-wm__taskbar-btn--minimized":""}`,onClick:()=>{o.minimized&&U(o.key),j(o.key)},children:[o.icon&&e.jsx("span",{className:"nice-wm__taskbar-icon",children:o.icon}),e.jsx("span",{className:"nice-wm__taskbar-label",children:o.title})]},o.key))})]})});Ue.displayName="NiceWindowManager";function yt(t,i){const s=document.querySelector(t);if(!s)return null;const l=s.getBoundingClientRect();return{top:l.top-i+window.scrollY,left:l.left-i+window.scrollX,width:l.width+i*2,height:l.height+i*2}}function Nt(t,i,s,l){const h={w:window.innerWidth,h:window.innerHeight+window.scrollY},x={top:{top:t.top-s-12,left:t.left+t.width/2-i/2},bottom:{top:t.top+t.height+12,left:t.left+t.width/2-i/2},left:{top:t.top+t.height/2-s/2,left:t.left-i-12},right:{top:t.top+t.height/2-s/2,left:t.left+t.width+12}};if(l&&l!=="auto")return{...x[l],actualPlacement:l};for(const w of["bottom","top","right","left"]){const p=x[w];if(p.top>=0&&p.left>=0&&p.top+s<=h.h&&p.left+i<=h.w)return{...p,actualPlacement:w}}return{...x.bottom,actualPlacement:"bottom"}}const be={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function jt(){return e.jsxs("svg",{...be,children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function kt(){return e.jsx("svg",{...be,children:e.jsx("polyline",{points:"15 18 9 12 15 6"})})}function Ct(){return e.jsx("svg",{...be,children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Et(){return e.jsxs("svg",{...be,children:[e.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),e.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}function zt(){return e.jsx("svg",{...be,children:e.jsx("polygon",{points:"6 4 20 12 6 20 6 4",fill:"currentColor"})})}function St(){return e.jsxs("svg",{...be,children:[e.jsx("rect",{x:"6",y:"4",width:"4",height:"16",fill:"currentColor"}),e.jsx("rect",{x:"14",y:"4",width:"4",height:"16",fill:"currentColor"})]})}function Re(t,i,s){return s==="text"?e.jsx("span",{className:"nice-tutorial__btn-label",children:i}):s==="icon-text"?e.jsxs(e.Fragment,{children:[t,e.jsx("span",{className:"nice-tutorial__btn-label",children:i})]}):t}const Be=({steps:t,active:i,onFinish:s,onSkip:l,onStepChange:m,closeOnEscape:h=!0,closeOnOverlayClick:x=!1,showProgress:w=!0,showSkipButton:p=!0,labels:b,animationDuration:a=300,overlayOpacity:N=.6,zIndex:Y=1e4,buttonsPlacement:S="floating-bottom",buttonsDisplay:E="icon",showAutoplay:R=!0,autoplayInterval:B=5e3,autoplaySpeedRange:c={min:2e3,max:15e3},onAutoplayChange:g})=>{const[r,j]=n.useState(0),[_,U]=n.useState(null),[D,M]=n.useState({w:340,h:200}),[o,k]=n.useState(!0),[y,I]=n.useState(!1),[d,v]=n.useState(B),u=n.useRef(null),L=n.useRef(-1),f=t[r],P=r===t.length-1,O=r===0,H=b?.next??"Next",J=b?.back??"Back",ee=b?.finish??"Finish",ue=b?.skip??"Skip",me=b?.stepOf??"of",he=b?.play??"Play",fe=b?.pause??"Pause",ze=b?.speed??"Speed",ve=b?.close??"Close";n.useEffect(()=>{i&&(j(0),I(!1),v(B))},[i,B]),n.useEffect(()=>{if(u.current){const z=u.current.getBoundingClientRect();M({w:z.width,h:z.height})}},[r,i]),n.useEffect(()=>{if(!i||!f)return;const z=f.highlightPadding??0,T=()=>{const W=yt(f.target,z);U(W)};if(T(),f.scrollIntoView!==!1){document.querySelector(f.target)?.scrollIntoView({behavior:"smooth",block:"center"});const K=setTimeout(T,350);return()=>clearTimeout(K)}},[i,f,r]),n.useEffect(()=>{!i||!f||L.current!==r&&(L.current>=0&&L.current<t.length&&t[L.current]?.onLeave?.(),f.onEnter?.(),L.current=r)},[i,f,r,t]);const te=n.useCallback(()=>{if(P)f?.onLeave?.(),s?.();else{const z=r+1;j(z),m?.(z)}},[r,P,s,m,f]),pe=n.useCallback(()=>{if(!O){const z=r-1;j(z),m?.(z)}},[r,O,m]);n.useEffect(()=>{if(!i||!f?.advanceOn)return;const z=document.querySelector(f.target);if(!z)return;const T=()=>te();return z.addEventListener(f.advanceOn.event,T),()=>z.removeEventListener(f.advanceOn.event,T)},[i,f,r,te]),n.useEffect(()=>{if(!i)return;const z=T=>{T.key==="Escape"&&h?l?.():T.key==="ArrowRight"?te():T.key==="ArrowLeft"&&pe()};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i,r,h,te,pe,l]),n.useEffect(()=>{k(!0);const z=setTimeout(()=>k(!1),a);return()=>clearTimeout(z)},[r,a]),n.useEffect(()=>{if(!i||!y)return;const z=setInterval(()=>{j(T=>{if(T>=t.length-1)return I(!1),g?.(!1),t[T]?.onLeave?.(),s?.(),T;const W=T+1;return m?.(W),W})},Math.max(500,d));return()=>clearInterval(z)},[i,y,d,t,g,s,m]);const Se=n.useCallback(()=>{I(z=>{const T=!z;return g?.(T),T})},[g]),xe=n.useMemo(()=>_?Nt(_,D.w,D.h,f?.placement):{top:typeof window<"u"?window.innerHeight/2:0,left:typeof window<"u"?window.innerWidth/2:0,actualPlacement:"bottom"},[_,D,f?.placement]),ye=t.length===0?0:(r+1)/t.length*100,ne=n.useCallback(z=>{const T=R&&t.length>1,W=p&&!P&&e.jsx("button",{type:"button",className:`nice-tutorial__btn nice-tutorial__btn--skip nice-tutorial__btn--${E}`,onClick:l,"aria-label":ue,title:ue,children:Re(e.jsx(Et,{}),ue,E)}),K=!O&&e.jsx("button",{type:"button",className:`nice-tutorial__btn nice-tutorial__btn--back nice-tutorial__btn--${E}`,onClick:pe,"aria-label":J,title:J,children:Re(e.jsx(kt,{}),J,E)}),we=!f?.waitForAction&&e.jsx("button",{type:"button",className:`nice-tutorial__btn nice-tutorial__btn--next nice-tutorial__btn--${E}`,onClick:te,"aria-label":P?ee:H,title:P?ee:H,children:Re(e.jsx(Ct,{}),P?ee:H,E)}),_e=T&&e.jsx("button",{type:"button",className:["nice-tutorial__btn","nice-tutorial__btn--play",`nice-tutorial__btn--${E}`,y?"nice-tutorial__btn--active":""].filter(Boolean).join(" "),onClick:Se,"aria-label":y?fe:he,title:y?fe:he,"aria-pressed":y,children:Re(y?e.jsx(St,{}):e.jsx(zt,{}),y?fe:he,E)});return e.jsxs("div",{className:["nice-tutorial__controls",z?"nice-tutorial__controls--inline":"nice-tutorial__controls--floating-bottom"].join(" "),style:z?void 0:{zIndex:Y+2},role:"group","aria-label":"Tutorial controls",children:[W,K,w&&e.jsxs("span",{className:"nice-tutorial__step-label","aria-live":"polite",children:[r+1," ",me," ",t.length]}),we,T&&e.jsx("div",{className:"nice-tutorial__progress-bar",role:"progressbar","aria-valuenow":Math.round(ye),"aria-valuemin":0,"aria-valuemax":100,"aria-label":`${r+1} ${me} ${t.length}`,children:e.jsx("div",{className:"nice-tutorial__progress-bar-fill",style:{width:`${ye}%`}})}),_e,T&&e.jsxs("label",{className:"nice-tutorial__speed",children:[e.jsx("input",{type:"range",className:"nice-tutorial__speed-slider",min:c.min,max:c.max,step:500,value:c.min+c.max-d,onChange:Ie=>v(c.min+c.max-Number(Ie.target.value)),"aria-label":ze}),e.jsxs("span",{className:"nice-tutorial__speed-value",children:[(d/1e3).toFixed(1),"s"]})]})]})},[R,p,w,E,O,P,l,ue,J,H,ee,he,fe,ze,me,pe,te,f,y,Se,r,t.length,ye,d,c,Y]);if(!i||!f)return null;const Ne=typeof document<"u"?Math.max(document.documentElement.scrollWidth,window.innerWidth):0,X=typeof document<"u"?Math.max(document.documentElement.scrollHeight,window.innerHeight):0;return e.jsxs("div",{className:"nice-tutorial",style:{zIndex:Y},"aria-modal":"true",role:"dialog","aria-label":"Tutorial",children:[e.jsxs("svg",{className:"nice-tutorial__overlay",style:{position:"absolute",top:0,left:0,width:Ne,height:X,pointerEvents:"auto"},onClick:x?l:void 0,children:[e.jsx("defs",{children:e.jsxs("mask",{id:"nice-tutorial-mask",children:[e.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"}),_&&e.jsx("rect",{x:_.left,y:_.top,width:_.width,height:_.height,rx:"4",fill:"black",className:o?"nice-tutorial__spotlight--entering":""})]})}),e.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`rgba(0,0,0,${N})`,mask:"url(#nice-tutorial-mask)"})]}),_&&e.jsx("div",{className:`nice-tutorial__highlight ${o?"nice-tutorial__highlight--entering":""}`,style:{position:"absolute",top:_.top,left:_.left,width:_.width,height:_.height,transition:`all ${a}ms ease`}}),f.disableInteraction&&_&&e.jsx("div",{className:"nice-tutorial__blocker",style:{position:"absolute",top:_.top,left:_.left,width:_.width,height:_.height}}),e.jsxs("div",{ref:u,className:`nice-tutorial__tooltip nice-tutorial__tooltip--${xe.actualPlacement} ${o?"nice-tutorial__tooltip--entering":""}`,style:{position:"absolute",top:xe.top,left:xe.left,transition:`all ${a}ms ease`,maxWidth:380,zIndex:Y+1},children:[f.showArrow!==!1&&e.jsx("div",{className:`nice-tutorial__arrow nice-tutorial__arrow--${xe.actualPlacement}`}),e.jsxs("div",{className:"nice-tutorial__header",children:[e.jsx("h4",{className:"nice-tutorial__title",children:f.title}),p&&e.jsx("button",{type:"button",className:"nice-tutorial__close",onClick:l,"aria-label":ve,title:ve,children:e.jsx(jt,{})})]}),e.jsx("div",{className:"nice-tutorial__content",dangerouslySetInnerHTML:{__html:V.$s(f.content)}}),S==="inline"&&ne(!0)]}),S==="floating-bottom"&&ne(!1)]})};Be.displayName="NiceTutorial";const He=n.createContext({startTutorial:()=>{},stopTutorial:()=>{},isActive:!1,currentStep:0,nextStep:()=>{},prevStep:()=>{},goToStep:()=>{}});function Rt(){return n.useContext(He)}const Ke=({children:t})=>{const[i,s]=n.useState([]),[l,m]=n.useState(!1),[h,x]=n.useState(0),w=n.useCallback(S=>{s(S),x(0),m(!0)},[]),p=n.useCallback(()=>{m(!1),x(0),s([])},[]),b=n.useCallback(()=>{x(S=>Math.min(S+1,i.length-1))},[i.length]),a=n.useCallback(()=>{x(S=>Math.max(S-1,0))},[]),N=n.useCallback(S=>{x(Math.max(0,Math.min(S,i.length-1)))},[i.length]),Y={startTutorial:w,stopTutorial:p,isActive:l,currentStep:h,nextStep:b,prevStep:a,goToStep:N};return e.jsxs(He.Provider,{value:Y,children:[t,l&&i.length>0&&e.jsx(Be,{steps:i,active:l,onFinish:p,onSkip:p,onStepChange:x})]})};Ke.displayName="NiceTutorialProvider";function Mt(t,i,s,l,m){const h=t<=m,x=t+m>=s,w=i<=m,p=i+m>=l;return w&&h?"top-left":w&&x?"top-right":p&&h?"bottom-left":p&&x?"bottom-right":h?"left":x?"right":w?"top":p?"bottom":"none"}function It(t){switch(t){case"left":return{left:0,top:0,width:"50%",height:"100%"};case"right":return{left:"50%",top:0,width:"50%",height:"100%"};case"top":return{left:0,top:0,width:"100%",height:"50%"};case"bottom":return{left:0,top:"50%",width:"100%",height:"50%"};case"top-left":return{left:0,top:0,width:"50%",height:"50%"};case"top-right":return{left:"50%",top:0,width:"50%",height:"50%"};case"bottom-left":return{left:0,top:"50%",width:"50%",height:"50%"};case"bottom-right":return{left:"50%",top:"50%",width:"50%",height:"50%"};default:return null}}const Ge=n.forwardRef(({windowKey:t,title:i,icon:s,children:l,footer:m,x:h,y:x,defaultPosition:w,width:p=480,height:b=360,minWidth:a=200,minHeight:N=120,maxWidth:Y,maxHeight:S,zIndex:E=1,closable:R=!0,minimizable:B=!0,maximizable:c=!0,fullscreenable:g=!1,pinnable:r=!1,resizable:j=!0,draggable:_=!0,snappable:U=!0,snapThreshold:D=20,minimized:M,maximized:o,fullscreen:k,pinned:y,focused:I,onClose:d,onMinimize:v,onMaximize:u,onFullscreen:L,onPin:f,onFocus:P,onMove:O,onResize:H,onSnap:J,onTitleBarDoubleClick:ee,size:ue="md",statusBar:me,titleBarActions:he,className:fe,style:ze,id:ve,accessMode:te,...pe},Se)=>{const xe=V._s(ve),ye=V.sc(te,ve),{t:ne}=V.Zt(),Ne=n.useRef(null);Ne.current==null&&(Ne.current=`nice-window-${Math.random().toString(36).slice(2,10)}`);const X=t??Ne.current,z=h??w?.x??100,T=x??w?.y??100;if(ye==="hidden")return null;const[W,K]=n.useState({x:z,y:T}),[we,_e]=n.useState({width:p,height:b}),[Ie,Ve]=n.useState(!1),[Ze,Qe]=n.useState(!1),[Je,et]=n.useState(!1),[tt,nt]=n.useState(!1),[Z,Le]=n.useState("none"),it=M??Ie,G=o??Ze,A=k??Je,je=y??tt,Te=I??!0,ae=W.x,de=W.y,ie=we.width,se=we.height,oe=n.useRef(null),F=n.useRef(null),$=n.useRef(null),st=n.useCallback(()=>{d?.(X)},[X,d]),ot=n.useCallback(()=>{Ve(!0),v?.(X)},[X,v]),Pe=n.useCallback(()=>{const C=!G;Qe(C),!C&&$.current?(K({x:$.current.x,y:$.current.y}),_e({width:$.current.w,height:$.current.h}),$.current=null):C&&($.current={x:ae,y:de,w:ie,h:se}),Le("none"),u?.(X,C)},[X,G,ae,de,ie,se,u]),$e=n.useCallback(()=>{const C=!A;et(C),C?$.current={x:ae,y:de,w:ie,h:se}:$.current&&(K({x:$.current.x,y:$.current.y}),_e({width:$.current.w,height:$.current.h}),$.current=null),L?.(X,C)},[X,A,ae,de,ie,se,L]),ct=n.useCallback(()=>{const C=!je;nt(C),f?.(X,C)},[X,je,f]),ke=n.useCallback(()=>{P?.(X)},[X,P]),rt=n.useCallback(()=>{ee?ee(X):c&&Pe()},[X,c,Pe,ee]);n.useEffect(()=>{const C=ce=>{if(!oe.current)return;const Q=ce.clientX-oe.current.startX+oe.current.origX,Ce=ce.clientY-oe.current.startY+oe.current.origY;K({x:Q,y:Ce}),O?.(X,{x:Q,y:Ce})},q=ce=>{if(oe.current){if(U){const Q=Mt(ce.clientX,ce.clientY,window.innerWidth,window.innerHeight,D);Q!=="none"&&($.current={x:W.x,y:W.y,w:ie,h:se},Le(Q),J?.(X,Q))}oe.current=null}};return document.addEventListener("mousemove",C),document.addEventListener("mouseup",q),()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",q)}});const lt=n.useCallback(C=>{!_||G||A||(C.preventDefault(),Z!=="none"&&($.current&&(K({x:$.current.x,y:$.current.y}),_e({width:$.current.w,height:$.current.h})),Le("none")),ke(),oe.current={startX:C.clientX,startY:C.clientY,origX:ae,origY:de})},[_,G,A,Z,ae,de,ke]);n.useEffect(()=>{const C=ce=>{if(!F.current)return;const Q=ce.clientX-F.current.startX,Ce=ce.clientY-F.current.startY,ge=F.current.handle;let re=F.current.origW,le=F.current.origH;if(ge.includes("e")&&(re=F.current.origW+Q),ge.includes("w")&&(re=F.current.origW-Q),ge.includes("s")&&(le=F.current.origH+Ce),ge.includes("n")&&(le=F.current.origH-Ce),re=Math.max(a,Y?Math.min(Y,re):re),le=Math.max(N,S?Math.min(S,le):le),ge.includes("w")){const Ye=we.width-re;K(Ee=>({...Ee,x:Ee.x+Ye}))}if(ge.includes("n")){const Ye=we.height-le;K(Ee=>({...Ee,y:Ee.y+Ye}))}_e({width:re,height:le}),H?.(X,{width:re,height:le})},q=()=>{F.current=null};return document.addEventListener("mousemove",C),document.addEventListener("mouseup",q),()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",q)}});const at=n.useCallback((C,q)=>{!j||G||A||Z!=="none"||(q.preventDefault(),q.stopPropagation(),ke(),F.current={startX:q.clientX,startY:q.clientY,origW:ie,origH:se,handle:C})},[j,G,A,Z,ie,se,ke]);if(n.useEffect(()=>{if(!Te)return;const C=q=>{q.key==="Escape"&&A&&$e()};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[Te,A,$e]),it)return null;const Xe=Z!=="none"?It(Z):null,De=G||A,dt=A?{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:999999}:G?{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:E}:Xe?{position:"absolute",...Xe,zIndex:E}:{position:"absolute",top:de,left:ae,width:ie,height:se,zIndex:E},ut=["n","e","s","w","ne","se","sw","nw"],mt={n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize",ne:"nesw-resize",sw:"nesw-resize",nw:"nwse-resize",se:"nwse-resize"};return e.jsxs("div",{ref:Se,id:xe,className:`nice-window nice-window--${ue} ${Te?"nice-window--focused":""} ${je?"nice-window--pinned":""} ${De?"nice-window--maximized":""} ${Z!=="none"?`nice-window--snapped-${Z}`:""} ${fe??""}`,style:{...dt,...ze},onMouseDown:ke,role:"dialog","aria-label":i,...pe,children:[e.jsxs("div",{className:"nice-window__titlebar",onMouseDown:lt,onDoubleClick:rt,children:[s&&e.jsx("span",{className:"nice-window__icon",children:s}),e.jsx("span",{className:"nice-window__title",children:i}),e.jsxs("div",{className:"nice-window__actions",children:[he,r&&e.jsx("button",{type:"button",className:`nice-window__action nice-window__action--pin ${je?"nice-window__action--active":""}`,onClick:ct,title:ne("window.pin",je?"Unpin":"Pin"),children:"📌"}),B&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--minimize",onClick:ot,title:ne("window.minimize","Minimize"),children:"─"}),c&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--maximize",onClick:Pe,title:ne("window.maximize",G?"Restore":"Maximize"),children:G?"❐":"☐"}),g&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--fullscreen",onClick:$e,title:ne("window.fullscreen",A?"Exit Full Screen":"Full Screen"),children:A?"⇲":"⇱"}),R&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--close",onClick:st,title:ne("window.close","Close"),children:"✕"})]})]}),e.jsx("div",{className:"nice-window__body",children:l}),m&&e.jsx("div",{className:"nice-window__footer",children:m}),me&&e.jsx("div",{className:"nice-window__statusbar",children:me}),j&&!De&&Z==="none"&&e.jsx(e.Fragment,{children:ut.map(C=>e.jsx("div",{className:`nice-window__resize nice-window__resize--${C}`,style:{cursor:mt[C]},onMouseDown:q=>at(C,q)},C))})]})});Ge.displayName="NiceWindow";exports.NiceActionSheet=ht;exports.NiceBlockUI=Fe;exports.NiceBox=xt;exports.NiceCommandPaletteProvider=Ae;exports.NiceLoadPanel=pt;exports.NicePopover=ft;exports.NiceResizable=_t;exports.NiceResponsiveBox=wt;exports.NiceScrollView=gt;exports.NiceTutorial=Be;exports.NiceTutorialProvider=Ke;exports.NiceWindow=Ge;exports.NiceWindowManager=Ue;exports.fuzzyMatch=Me;exports.highlightMatches=Oe;exports.useCommandPalette=We;exports.useNiceTutorial=Rt;exports.useRegisterCommands=vt;