@nice2dev/ui 1.0.31 → 1.1.6
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 +403 -0
- package/dist/NiceCodeEditor-BVUwp9yX.js +1134 -0
- package/dist/NiceCodeEditor-cIqUSk3j.cjs +260 -0
- package/dist/NiceColorPicker-C8NZZcXE.js +596 -0
- package/dist/NiceColorPicker-CKVbjicN.cjs +1 -0
- package/dist/NiceConfirmDialog-DmBX1Iea.js +81 -0
- package/dist/NiceConfirmDialog-oSxVpsCs.cjs +1 -0
- package/dist/NiceDataGrid-3AIf2D3t.cjs +10 -0
- package/dist/NiceDataGrid-CXCUAkRb.js +1736 -0
- package/dist/NiceDocumentViewer-B-uEPZAf.js +672 -0
- package/dist/NiceDocumentViewer-BE0gKBlw.cjs +180 -0
- package/dist/NiceForm-C6F0HvrX.cjs +1 -0
- package/dist/NiceForm-CCyfWgIs.js +4805 -0
- package/dist/NiceGantt-CSFLZD2y.js +328 -0
- package/dist/NiceGantt-_ysNSVYR.cjs +1 -0
- package/dist/NiceHtmlEditor-B8B8AcSC.js +841 -0
- package/dist/NiceHtmlEditor-D8RQcBNp.cjs +10 -0
- package/dist/NiceLoginForm-Bai7aN8V.js +708 -0
- package/dist/NiceLoginForm-BrvIc-wq.cjs +1 -0
- package/dist/NiceMention-BjeLN4Jx.cjs +430 -0
- package/dist/NiceMention-CWoLD0SE.js +11082 -0
- package/dist/NiceMention-J1lUDLhg.cjs +430 -0
- package/dist/NiceMention-OaCi-GNO.js +11094 -0
- package/dist/NiceMention.css +1 -0
- package/dist/NiceModal-0UxviEYE.cjs +1 -0
- package/dist/NiceModal-D-iOonog.js +95 -0
- package/dist/NiceModuleLifecyclePanel-4hzDw6it.js +6999 -0
- package/dist/NiceModuleLifecyclePanel-Df_1k5qW.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-CPn-Q1h_.js +172 -0
- package/dist/NicePagination-EEQ6o1dF.cjs +1 -0
- package/dist/NicePivotGrid-Cmiolup9.cjs +152 -0
- package/dist/NicePivotGrid-DX_iUj2X.js +1167 -0
- package/dist/NiceSavedQueryPanel-BhjFJBvn.cjs +586 -0
- package/dist/NiceSavedQueryPanel-KvyXTnFx.js +5129 -0
- package/dist/NiceScheduler-DuxPzQQZ.js +1645 -0
- package/dist/NiceScheduler-nW7fMzKL.cjs +5 -0
- package/dist/NiceSelect-BVoqtfYN.cjs +1 -0
- package/dist/NiceSelect-DHowflmX.js +433 -0
- package/dist/NiceWindow-DdD9k4nc.cjs +1 -0
- package/dist/NiceWindow-xnTSHdHv.js +1623 -0
- package/dist/charts-B-sl1V9y.cjs +882 -0
- package/dist/charts-DO2z6Ziu.js +31920 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +7 -7
- package/dist/core-C2KhqEaU.cjs +1 -0
- package/dist/core-K2DIxXLn.js +795 -0
- package/dist/data-branching-DC6hcBQN.cjs +1 -0
- package/dist/data-branching-DykdTpjJ.js +6255 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +29 -7
- package/dist/data.mjs +18 -16
- package/dist/devops-CU0sOVEA.cjs +17 -0
- package/dist/devops-CXyEwQeM.js +8165 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +97 -9
- package/dist/editors.mjs +58 -54
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +1 -1
- package/dist/feedback.mjs +3 -3
- package/dist/index.cjs +5137 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +139 -21
- package/dist/index.mjs +66371 -992
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +6 -0
- package/dist/navigation.mjs +4 -4
- package/dist/no-code-C58g8_fb.cjs +332 -0
- package/dist/no-code-Cj4xJ3w9.js +7425 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +2 -0
- package/dist/overlays.mjs +2 -2
- package/dist/pickerCommons-B-wOzHFh.cjs +1 -0
- package/dist/pickerCommons-COiSUiP2.js +1122 -0
- package/dist/pickerCommons.css +1 -1
- package/dist/style.css +7 -7
- package/dist/vendor-BPVpdtPp.js +271 -0
- package/dist/vendor-Bo2Q64AF.cjs +1 -0
- package/package.json +17 -17
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("./charts-B-sl1V9y.cjs"),t=require("react");function ve(n,i){const a=n.split(".").pop()?.toLowerCase().split("?")[0]??"";return a==="pdf"?"pdf":["jpg","jpeg","png","gif","bmp","webp","svg","ico","tiff","tif"].includes(a)?"image":["mp4","webm","ogg","mov","avi","mkv"].includes(a)?"video":["mp3","wav","flac","aac","m4a","ogg"].includes(a)?"audio":["doc","docx","xls","xlsx","ppt","pptx","odt","ods","odp"].includes(a)?"office":a==="html"||a==="htm"?"html":["txt","log","md","json","xml","csv","yaml","yml"].includes(a)?"text":"unknown"}function ge(n){if(n===0)return"0 B";const i=1024,a=["B","KB","MB","GB"],o=Math.floor(Math.log(n)/Math.log(i));return parseFloat((n/Math.pow(i,o)).toFixed(1))+" "+a[o]}function we(n){const i=Math.floor(n/3600),a=Math.floor(n%3600/60),o=Math.floor(n%60);return i>0?`${i}:${a.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`:`${a}:${o.toString().padStart(2,"0")}`}function xe({src:n,page:i,zoom:a,rotation:o,onPageChange:m,onLoad:s,onError:p,workerUrl:u}){const h=t.useRef(null),y=t.useRef(null),[g,B]=t.useState(0),[I,T]=t.useState(!1);return t.useEffect(()=>{let x=!1;return(async()=>{try{let l;if(l=window.pdfjsLib,!l)try{l=await new Function("m","return import(m)")("pdfjs-dist")}catch{throw new Error('PDF.js library not found. Please install pdfjs-dist or include it via CDN: <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js"><\/script>')}u?l.GlobalWorkerOptions.workerSrc=u:l.version&&(l.GlobalWorkerOptions.workerSrc=`https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${l.version}/pdf.worker.min.js`);const w=await l.getDocument(n).promise;if(x)return;y.current=w,B(w.numPages),s({name:n.split("/").pop()??"document.pdf",type:"pdf",mimeType:"application/pdf",pageCount:w.numPages})}catch(l){x||p(l instanceof Error?l:new Error("Failed to load PDF"))}})(),()=>{x=!0}},[n,u,s,p]),t.useEffect(()=>{const x=y.current,k=h.current;if(!x||!k||g===0)return;let l=!1;return(async()=>{if(!I){T(!0);try{const w=Math.max(1,Math.min(i,g)),N=await x.getPage(w);if(l)return;const P=N.getViewport({scale:a,rotation:o}),E=k.getContext("2d");if(!E)return;k.height=P.height,k.width=P.width,await N.render({canvasContext:E,viewport:P}).promise}catch(w){console.error("Error rendering PDF page:",w)}finally{l||T(!1)}}})(),()=>{l=!0}},[i,a,o,g,I]),e.jsx("div",{className:"nice-document-viewer__pdf",children:e.jsx("canvas",{ref:h,className:"nice-document-viewer__pdf-canvas"})})}function be({src:n,zoom:i,rotation:a,onLoad:o,onError:m}){const[s,p]=t.useState(!1),u=t.useCallback(y=>{const g=y.currentTarget;p(!0),o({name:n.split("/").pop()??"image",type:"image",width:g.naturalWidth,height:g.naturalHeight})},[n,o]),h=t.useCallback(()=>{m(new Error("Failed to load image"))},[m]);return e.jsx("div",{className:"nice-document-viewer__image",children:e.jsx("img",{src:n,alt:"Document",onLoad:u,onError:h,style:{transform:`scale(${i}) rotate(${a}deg)`,opacity:s?1:0},draggable:!1})})}function _e({src:n,type:i,onLoad:a,onError:o}){const m=t.useRef(null),s=t.useCallback(()=>{const u=m.current;if(!u)return;const h={name:n.split("/").pop()??(i==="video"?"video":"audio"),type:i,duration:u.duration};i==="video"&&"videoWidth"in u&&(h.width=u.videoWidth,h.height=u.videoHeight),a(h)},[n,i,a]),p=t.useCallback(()=>{o(new Error(`Failed to load ${i}`))},[i,o]);return i==="video"?e.jsx("div",{className:"nice-document-viewer__video",children:e.jsx("video",{ref:m,src:n,controls:!0,onLoadedMetadata:s,onError:p})}):e.jsx("div",{className:"nice-document-viewer__audio",children:e.jsx("audio",{ref:m,src:n,controls:!0,onLoadedMetadata:s,onError:p})})}function je({src:n,viewerUrl:i,onLoad:a}){const[o,m]=t.useState(!1),p=`${i??"https://view.officeapps.live.com/op/embed.aspx?src="}${encodeURIComponent(n)}`,u=t.useCallback(()=>{m(!0),a({name:n.split("/").pop()??"document",type:"office"})},[n,a]);return e.jsx("div",{className:"nice-document-viewer__office",children:e.jsx("iframe",{src:p,onLoad:u,title:"Office Document",style:{opacity:o?1:0}})})}function ye({src:n,onLoad:i,onError:a}){const[o,m]=t.useState(null);return t.useEffect(()=>{fetch(n).then(s=>{if(!s.ok)throw new Error("Failed to fetch text");return s.text()}).then(s=>{m(s),i({name:n.split("/").pop()??"text",type:"text",size:s.length})}).catch(s=>{a(s instanceof Error?s:new Error("Failed to load text"))})},[n,i,a]),o===null?e.jsx("div",{className:"nice-document-viewer__loading",children:"Loading..."}):e.jsx("div",{className:"nice-document-viewer__text",children:e.jsx("pre",{children:o})})}function ke({src:n,onLoad:i}){const a=t.useCallback(()=>{i({name:n.split("/").pop()??"page.html",type:"html"})},[n,i]);return e.jsx("div",{className:"nice-document-viewer__html",children:e.jsx("iframe",{src:n,onLoad:a,title:"HTML Document",sandbox:"allow-same-origin allow-scripts"})})}const Ce=t.forwardRef(function(i,a){const{src:o,type:m,name:s,height:p=600,width:u="100%",zoom:h=1,minZoom:y=.25,maxZoom:g=4,page:B=1,showToolbar:I=!0,showPageNav:T=!0,showZoomControls:x=!0,showFullscreen:k=!0,showDownload:l=!0,showPrint:H=!0,showRotate:w=!0,enableKeyboard:N=!0,onLoad:P,onError:E,onPageChange:G,onZoomChange:A,pdfWorkerUrl:te,officeViewerUrl:ne,loading:oe,errorContent:O,className:ae,"data-testid":ie}=i,U=t.useRef(null),[c,re]=t.useState(null),[b,ce]=t.useState(B),[C,se]=t.useState(h),[Y,de]=t.useState(0),[Z,J]=t.useState(!1),[$,le]=t.useState(null),[ue,Q]=t.useState(!0),_=t.useMemo(()=>m??ve(o),[o,m]),z=t.useCallback(r=>{re(r),Q(!1),P?.(r)},[P]),K=t.useCallback(r=>{le(r),Q(!1),E?.(r)},[E]),f=t.useCallback(r=>{const d=c?.pageCount??1,X=Math.max(1,Math.min(r,d));ce(X),G?.(X)},[c?.pageCount,G]),S=t.useCallback(()=>f(b+1),[b,f]),D=t.useCallback(()=>f(b-1),[b,f]),j=t.useCallback(r=>{const d=Math.max(y,Math.min(r,g));se(d),A?.(d)},[y,g,A]),L=t.useCallback(()=>j(C*1.25),[C,j]),M=t.useCallback(()=>j(C/1.25),[C,j]),F=t.useCallback(()=>j(1),[j]),V=t.useCallback(r=>{de(d=>(d+r)%360)},[]),W=t.useCallback(()=>{const r=document.createElement("a");r.href=o,r.download=s??c?.name??"document",document.body.appendChild(r),r.click(),document.body.removeChild(r)},[o,s,c?.name]),q=t.useCallback(()=>{const r=window.open(o,"_blank");r&&(r.onload=()=>r.print())},[o]),R=t.useCallback(()=>{U.current&&(Z?(document.exitFullscreen?.(),J(!1)):(U.current.requestFullscreen?.(),J(!0)))},[Z]);t.useEffect(()=>{if(!N)return;const r=d=>{switch(d.key){case"ArrowRight":case"PageDown":S();break;case"ArrowLeft":case"PageUp":D();break;case"Home":f(1);break;case"End":f(c?.pageCount??1);break;case"+":case"=":(d.ctrlKey||d.metaKey)&&(d.preventDefault(),L());break;case"-":(d.ctrlKey||d.metaKey)&&(d.preventDefault(),M());break;case"0":(d.ctrlKey||d.metaKey)&&(d.preventDefault(),F());break;case"f":(d.ctrlKey||d.metaKey)&&(d.preventDefault(),R());break}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[N,S,D,f,c?.pageCount,L,M,F,R]),t.useImperativeHandle(a,()=>({goToPage:f,nextPage:S,prevPage:D,setZoom:j,zoomIn:L,zoomOut:M,resetZoom:F,rotate:V,download:W,print:q,toggleFullscreen:R,getInfo:()=>c}),[f,S,D,j,L,M,F,V,W,q,R,c]);const me=()=>{if($)return(typeof O=="function"?O($):O)??e.jsx("div",{className:"nice-document-viewer__error",children:e.jsxs("span",{children:[e.jsx(v.oa,{name:"warning",size:14})," ",$.message]})});switch(_){case"pdf":return e.jsx(xe,{src:o,page:b,zoom:C,rotation:Y,onPageChange:f,onLoad:z,onError:K,workerUrl:te});case"image":return e.jsx(be,{src:o,zoom:C,rotation:Y,onLoad:z,onError:K});case"video":case"audio":return e.jsx(_e,{src:o,type:_,onLoad:z,onError:K});case"office":return e.jsx(je,{src:o,viewerUrl:ne,onLoad:z});case"text":return e.jsx(ye,{src:o,onLoad:z,onError:K});case"html":return e.jsx(ke,{src:o,onLoad:z});default:return e.jsxs("div",{className:"nice-document-viewer__unknown",children:[e.jsxs("span",{children:[e.jsx(v.oa,{name:"file",size:14})," Unknown document type"]}),e.jsx("button",{type:"button",onClick:W,children:"Download"})]})}},pe=T&&_==="pdf"&&(c?.pageCount??0)>1,fe=x&&(_==="pdf"||_==="image"),he=w&&(_==="pdf"||_==="image");return e.jsxs("div",{ref:U,className:`nice-document-viewer ${Z?"nice-document-viewer--fullscreen":""} ${ae??""}`,style:{height:p,width:u},"data-testid":ie,"data-type":_,children:[I&&e.jsxs("div",{className:"nice-document-viewer__toolbar",children:[e.jsx("div",{className:"nice-document-viewer__toolbar-left",children:pe&&e.jsxs("div",{className:"nice-document-viewer__pagination",children:[e.jsx("button",{type:"button",onClick:D,disabled:b<=1,"aria-label":"Previous page",children:e.jsx(v.oa,{name:"chevron-left",size:16})}),e.jsxs("span",{children:[e.jsx("input",{type:"number",value:b,onChange:r=>f(parseInt(r.target.value,10)),min:1,max:c?.pageCount??1}),"/ ",c?.pageCount??1]}),e.jsx("button",{type:"button",onClick:S,disabled:b>=(c?.pageCount??1),"aria-label":"Next page",children:e.jsx(v.oa,{name:"chevron-right",size:16})})]})}),e.jsxs("div",{className:"nice-document-viewer__toolbar-center",children:[fe&&e.jsxs("div",{className:"nice-document-viewer__zoom",children:[e.jsx("button",{type:"button",onClick:M,"aria-label":"Zoom out",children:"−"}),e.jsxs("span",{children:[Math.round(C*100),"%"]}),e.jsx("button",{type:"button",onClick:L,"aria-label":"Zoom in",children:"+"}),e.jsx("button",{type:"button",onClick:F,"aria-label":"Reset zoom",children:e.jsx(v.oa,{name:"refresh",size:16})})]}),he&&e.jsxs("div",{className:"nice-document-viewer__rotation",children:[e.jsx("button",{type:"button",onClick:()=>V(270),"aria-label":"Rotate left",children:e.jsx(v.oa,{name:"refresh",size:16})}),e.jsx("button",{type:"button",onClick:()=>V(90),"aria-label":"Rotate right",children:e.jsx(v.oa,{name:"refresh",size:16})})]})]}),e.jsxs("div",{className:"nice-document-viewer__toolbar-right",children:[l&&e.jsx("button",{type:"button",onClick:W,"aria-label":"Download",children:e.jsx(v.oa,{name:"download",size:16})}),H&&e.jsx("button",{type:"button",onClick:q,"aria-label":"Print",children:e.jsx(v.oa,{name:"printer",size:16})}),k&&e.jsx("button",{type:"button",onClick:R,"aria-label":"Fullscreen",children:e.jsx(v.oa,{name:Z?"collapse":"expand",size:16})})]})]}),e.jsxs("div",{className:"nice-document-viewer__content",children:[ue&&!$&&(oe??e.jsx("div",{className:"nice-document-viewer__loading",children:"Loading..."})),me()]}),c&&e.jsxs("div",{className:"nice-document-viewer__info",children:[e.jsx("span",{className:"nice-document-viewer__name",children:s??c.name}),c.size&&e.jsx("span",{className:"nice-document-viewer__size",children:ge(c.size)}),c.width&&c.height&&e.jsxs("span",{className:"nice-document-viewer__dimensions",children:[c.width," × ",c.height]}),c.duration&&e.jsx("span",{className:"nice-document-viewer__duration",children:we(c.duration)})]})]})}),ee="nice-document-viewer-styles";if(typeof document<"u"&&!document.getElementById(ee)){const n=document.createElement("style");n.id=ee,n.textContent=`
|
|
2
|
+
.nice-document-viewer {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
border: 1px solid var(--border-color, #e5e7eb);
|
|
6
|
+
border-radius: var(--nice-radius-sm, 4px);
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
background: var(--bg-primary, #ffffff);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.nice-document-viewer--fullscreen {
|
|
12
|
+
position: fixed;
|
|
13
|
+
top: 0;
|
|
14
|
+
left: 0;
|
|
15
|
+
right: 0;
|
|
16
|
+
bottom: 0;
|
|
17
|
+
z-index: 9999;
|
|
18
|
+
border: none;
|
|
19
|
+
border-radius: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.nice-document-viewer__toolbar {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
padding: var(--nice-space-2, 8px) var(--nice-space-3, 12px);
|
|
27
|
+
background: var(--bg-primary, #ffffff);
|
|
28
|
+
border-bottom: 1px solid var(--border-color, #e5e7eb);
|
|
29
|
+
flex-shrink: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.nice-document-viewer__toolbar-left,
|
|
33
|
+
.nice-document-viewer__toolbar-center,
|
|
34
|
+
.nice-document-viewer__toolbar-right {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
gap: var(--nice-space-2, 8px);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.nice-document-viewer__toolbar button {
|
|
41
|
+
padding: var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);
|
|
42
|
+
border: 1px solid var(--border-color, #e5e7eb);
|
|
43
|
+
border-radius: var(--nice-radius-sm, 4px);
|
|
44
|
+
background: var(--bg-primary, #ffffff);
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
font-size: 14px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.nice-document-viewer__toolbar button:hover:not(:disabled) {
|
|
50
|
+
background: var(--hover-bg, color-mix(in srgb, var(--text-primary, #000) 4%, transparent));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.nice-document-viewer__toolbar button:disabled {
|
|
54
|
+
opacity: 0.4;
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.nice-document-viewer__pagination,
|
|
59
|
+
.nice-document-viewer__zoom,
|
|
60
|
+
.nice-document-viewer__rotation {
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: var(--nice-space-1-5, 6px);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.nice-document-viewer__pagination input {
|
|
67
|
+
width: 50px;
|
|
68
|
+
padding: var(--nice-space-1, 4px);
|
|
69
|
+
border: 1px solid var(--border-color, #e5e7eb);
|
|
70
|
+
border-radius: var(--nice-radius-sm, 4px);
|
|
71
|
+
text-align: center;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.nice-document-viewer__zoom span {
|
|
75
|
+
min-width: 50px;
|
|
76
|
+
text-align: center;
|
|
77
|
+
font-size: 13px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.nice-document-viewer__content {
|
|
81
|
+
flex: 1;
|
|
82
|
+
overflow: auto;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
position: relative;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.nice-document-viewer__loading,
|
|
90
|
+
.nice-document-viewer__error,
|
|
91
|
+
.nice-document-viewer__unknown {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
align-items: center;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
gap: var(--nice-space-3, 12px);
|
|
97
|
+
padding: var(--nice-space-10, 40px);
|
|
98
|
+
color: var(--text-secondary, #475569);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.nice-document-viewer__error span {
|
|
102
|
+
color: var(--nice-error, #d32f2f);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.nice-document-viewer__pdf,
|
|
106
|
+
.nice-document-viewer__image {
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
min-height: 100%;
|
|
111
|
+
min-width: 100%;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.nice-document-viewer__pdf-canvas {
|
|
115
|
+
max-width: 100%;
|
|
116
|
+
height: auto;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.nice-document-viewer__image img {
|
|
120
|
+
max-width: 100%;
|
|
121
|
+
max-height: 100%;
|
|
122
|
+
object-fit: contain;
|
|
123
|
+
transition: transform 0.2s;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.nice-document-viewer__video,
|
|
127
|
+
.nice-document-viewer__audio {
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
justify-content: center;
|
|
131
|
+
width: 100%;
|
|
132
|
+
height: 100%;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.nice-document-viewer__video video,
|
|
136
|
+
.nice-document-viewer__audio audio {
|
|
137
|
+
max-width: 100%;
|
|
138
|
+
max-height: 100%;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.nice-document-viewer__office iframe,
|
|
142
|
+
.nice-document-viewer__html iframe {
|
|
143
|
+
width: 100%;
|
|
144
|
+
height: 100%;
|
|
145
|
+
border: none;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.nice-document-viewer__text {
|
|
149
|
+
width: 100%;
|
|
150
|
+
height: 100%;
|
|
151
|
+
overflow: auto;
|
|
152
|
+
padding: var(--nice-space-4, 16px);
|
|
153
|
+
background: var(--bg-primary, #ffffff);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.nice-document-viewer__text pre {
|
|
157
|
+
margin: 0;
|
|
158
|
+
font-family: 'Fira Code', monospace;
|
|
159
|
+
font-size: 13px;
|
|
160
|
+
white-space: pre-wrap;
|
|
161
|
+
word-wrap: break-word;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.nice-document-viewer__info {
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
gap: var(--nice-space-4, 16px);
|
|
168
|
+
padding: var(--nice-space-1-5, 6px) var(--nice-space-3, 12px);
|
|
169
|
+
background: var(--bg-primary, #ffffff);
|
|
170
|
+
border-top: 1px solid var(--border-color, #e5e7eb);
|
|
171
|
+
font-size: 12px;
|
|
172
|
+
color: var(--text-secondary, #475569);
|
|
173
|
+
flex-shrink: 0;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.nice-document-viewer__name {
|
|
177
|
+
font-weight: 500;
|
|
178
|
+
color: var(--text-primary, #0f172a);
|
|
179
|
+
}
|
|
180
|
+
`,document.head.appendChild(n)}exports.NiceDocumentViewer=Ce;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),g=require("./charts-B-sl1V9y.cjs"),a=require("react"),Nt=require("./NiceColorPicker-CKVbjicN.cjs"),Le=require("./pickerCommons-B-wOzHFh.cjs"),ln=require("react-dom"),jt=require("./NiceSelect-BVoqtfYN.cjs"),vn=require("./core-C2KhqEaU.cjs");function Cn({text:t,query:i}){if(!i)return e.jsx(e.Fragment,{children:t});const n=t.toLowerCase().indexOf(i.toLowerCase());return n<0?e.jsx(e.Fragment,{children:t}):e.jsxs("span",{children:[t.slice(0,n),e.jsx("strong",{children:t.slice(n,n+i.length)}),t.slice(n+i.length)]})}const cn=({options:t,value:i,onChange:n,minSearchLength:l=1,maxResults:s=10,onSearch:o,clearable:d,loading:b,multiple:N,renderOption:K,highlightMatch:se=!0,showAll:T=!0,menuGap:D,label:L,error:le,helperText:z,required:U,disabled:k,readOnly:B,size:de="md",id:H,className:fe,style:ce,accessMode:$,showKeyboardHints:I,displayStyle:A,labelPlacement:F,errorPlacement:Y,labelWidth:R,controlWidth:J})=>{g.rc("input",A),g.ac("input",A);const E=g.Dc($,H),Q=E==="hidden";(E==="disabled"||E==="readOnly")&&(k=!0);const ee=g.bc(H),{t:f}=g.Gt(),m=a.useMemo(()=>N?Array.isArray(i)?i:i?[i]:[]:[],[i,N]),[_,te]=a.useState(()=>N||Array.isArray(i)?"":t.find(u=>String(u.value)===i)?.label??i??""),[ne,v]=a.useState(!1),h=a.useRef(null),[q,G]=a.useState(-1),xe=a.useRef(null),re=a.useRef(null),{popupRef:ue,coords:j,ready:W,themeClass:X,portalTarget:Ne}=jt.useAnchoredPopup(ne,h,()=>v(!1)),Ae=a.useMemo(()=>{const u=[g.Yc.moveDown,g.Yc.moveUp,g.Yc.submit,g.Yc.cancel];return N&&u.push({key:"Backspace",description:f("shortcuts.removeLastTag","Remove last tag")}),u},[N,f]);a.useEffect(()=>{N||te(Array.isArray(i)?"":t.find(u=>String(u.value)===i)?.label??i??"")},[i,N,t]);const P=a.useMemo(()=>{if(_.length<l)return T?(o?t:[...t].sort((O,ae)=>O.label.localeCompare(ae.label))).slice(0,s):[];if(o)return t.slice(0,s);const u=_.toLowerCase();return t.filter(pe=>pe.label.toLowerCase().includes(u)).slice(0,s)},[t,_,l,s,o,T]),ye=a.useMemo(()=>{const u=new Map;for(const pe of P){const O=pe.group||"";u.has(O)||u.set(O,[]),u.get(O).push(pe)}return u},[P]),V=a.useCallback(u=>{B||(te(u),v(u.length>=l),G(0),o?.(u))},[l,o,B]),Te=a.useCallback(u=>{if(!B)if(N){const pe=String(u.value),O=m.includes(pe)?m.filter(ae=>ae!==pe):[...m,pe];n?.(O),te("")}else te(u.label),n?.(String(u.value)),v(!1)},[n,N,m,B]),y=u=>{if(!B){if(N&&u.key==="Backspace"&&!_&&m.length>0){n?.(m.slice(0,-1));return}if(!ne&&(u.key==="ArrowDown"||u.key==="ArrowUp")){u.preventDefault(),v(!0),G(0);return}ne&&(u.key==="ArrowDown"?(u.preventDefault(),G(pe=>pe<0?0:Math.min(pe+1,P.length-1))):u.key==="ArrowUp"?(u.preventDefault(),G(pe=>pe<=0?P.length-1:pe-1)):(u.key==="Enter"||u.key==="Tab")&&q>=0&&q<P.length?(u.preventDefault(),Te(P[q])):u.key==="Escape"&&v(!1))}},w=a.useCallback(u=>{B||n?.(m.filter(pe=>pe!==u))},[m,n,B]);return Q?null:e.jsxs("div",{className:`nice-field nice-field--${de} ${F==="left"?"nice-field--label-left":""} ${b?"nice-field--loading":""} ${fe||""}`,style:{width:"fit-content",...ce,...R!=null&&{"--nice-field-label-width":typeof R=="number"?`${R}px`:R},...J!=null&&{"--nice-field-control-width":typeof J=="number"?`${J}px`:J},...D!=null&&{"--nice-dropdown-gap":`${D}px`}},ref:xe,"aria-busy":b||void 0,children:[L&&e.jsxs("label",{className:`nice-field__label ${U?"nice-field__label--required":""}`,htmlFor:ee,children:[L,I&&e.jsx(g.ha,{shortcuts:Ae,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",style:{position:"relative"},children:[e.jsx("div",{ref:h,className:`nice-input nice-input--${de} ${le?"nice-input--error":""} ${k?"nice-input--disabled":""}`,style:{width:"220px"},children:e.jsxs("div",{className:"nice-field__input-wrap",style:{display:"flex",flexWrap:N?"wrap":"nowrap",gap:4,alignItems:"center",flex:1,minWidth:0},children:[N&&m.map(u=>{const pe=t.find(O=>String(O.value)===u);return e.jsxs("span",{className:"nice-autocomplete__tag",children:[pe?.label||u,!B&&e.jsx("button",{type:"button",className:"nice-autocomplete__tag-remove",onClick:()=>w(u),"aria-label":f("controls.remove","Remove"),children:e.jsx(g.oa,{name:"close",size:14})})]},u)}),e.jsx("input",{ref:re,id:ee,type:"text",className:"nice-input__native",value:_,onChange:u=>V(u.target.value),onFocus:()=>!B&&(T||_.length>=l)&&v(!0),onKeyDown:y,disabled:k,readOnly:B,required:U,role:"combobox","aria-expanded":ne,"aria-autocomplete":"list",autoComplete:"off",style:{flex:1,minWidth:60,border:"none",outline:"none",background:"transparent",color:"inherit",padding:0,font:"inherit"}}),d&&!N&&_&&!k&&!B&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:()=>{te(""),n?.("")},"aria-label":f("controls.clear","Clear"),children:e.jsx(g.oa,{name:"close",size:14})})]})}),ne&&P.length>0&&j&&Ne&&ln.createPortal(e.jsx("ul",{ref:ue,className:`nice-dropdown__list${X?` ${X}`:""}`,"data-theme":X==="nice-dark"?"dark":X==="nice-light"?"light":void 0,role:"listbox",style:{position:"fixed",left:j.left,top:j.top,width:j.width,minWidth:j.width,zIndex:1e3,opacity:W?1:0,pointerEvents:W?void 0:"none"},children:Array.from(ye.entries()).map(([u,pe])=>e.jsxs(a.Fragment,{children:[u&&e.jsx("li",{className:"nice-dropdown__group-label",children:u}),pe.map(O=>{const C=P.indexOf(O)===q,Be=N&&m.includes(String(O.value));return e.jsx("li",{role:"option",className:`nice-dropdown__option ${C?"nice-dropdown__option--active":""} ${Be?"nice-dropdown__option--selected":""}`,onMouseDown:Ye=>{Ye.preventDefault(),Te(O)},"aria-selected":C,children:K?K(O,_):se?e.jsx(Cn,{text:O.label,query:_}):O.label},String(O.value))})]},u))}),Ne),b&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),Y==="right"&&le&&e.jsx("div",{id:`${ee}-error`,className:"nice-field__error",role:"alert",children:le}),Y==="right"&&!le&&z&&e.jsx("div",{id:`${ee}-helper`,className:"nice-field__helper",children:z})]}),Y!=="right"&&le&&e.jsx("div",{id:`${ee}-error`,className:"nice-field__error",role:"alert",children:le}),Y!=="right"&&!le&&z&&e.jsx("div",{id:`${ee}-helper`,className:"nice-field__helper",children:z})]})},rn={phone:"(999) 999-9999","credit-card":"9999 9999 9999 9999",date:"99/99/9999",ssn:"999-99-9999",zip:"99-999",time:"99:99",iban:"aa99 9999 9999 9999 9999 9999"};function Nn(t){return[...t].map(i=>i==="9"?{type:"digit"}:i==="a"?{type:"letter"}:i==="*"?{type:"alphanum"}:{type:"literal",literal:i})}function jn(t,i){return i.type==="digit"?/\d/.test(t):i.type==="letter"?/[a-zA-Z]/.test(t):i.type==="alphanum"?/[a-zA-Z0-9]/.test(t):!1}function Xt(t,i,n){let l=0,s="";for(const o of i)o.type==="literal"?s+=o.literal:l<t.length?(s+=t[l],l++):s+=n;return s}function Mn(t,i){return t.map(n=>n.type==="literal"?n.literal:i).join("")}const Ft=a.forwardRef(({label:t,helperText:i,error:n,required:l,disabled:s,readOnly:o,size:d="md",name:b,id:N,className:K,style:se,value:T="",onChange:D,onBlur:L,onKeyDown:le,mask:z,maskPreset:U,maskChar:k="_",placeholder:B,showMaskAsPlaceholder:de=!0,clearable:H=!1,autoFocus:fe,labelPlacement:ce,errorPlacement:$,loading:I,labelWidth:A,controlWidth:F,...Y},R)=>{const{t:J}=g.Gt(),E=g.bc(N),Q=a.useRef(null),[ee,f]=a.useState(!1),m=z||(U?rn[U]:"")||"999",_=a.useMemo(()=>Nn(m),[m]),te=a.useMemo(()=>Xt(T,_,k),[T,_,k]),ne=ee||T?te:"",v=B??(de?Mn(_,k):void 0),h=a.useCallback(W=>{Q.current=W,typeof R=="function"?R(W):R&&(R.current=W)},[R]),q=a.useCallback(W=>{const X=Xt(W,_,k);D?.(W,X)},[D,_,k]),G=a.useCallback(W=>{const X=W.currentTarget,Ne=X.value,Ae=X.selectionStart??Ne.length;let P="",ye=0;for(let V=0;V<Ne.length&&ye<_.length;V++){const Te=Ne[V];for(;ye<_.length&&_[ye].type==="literal";)ye++;if(ye>=_.length)break;jn(Te,_[ye])&&(P+=Te,ye++)}q(P),requestAnimationFrame(()=>{let V=0,Te=0;for(let y=0;y<_.length;y++){if(_[y].type==="literal")V=y+1;else if(Te<P.length)Te++,V=y+1;else{V=y;break}if(V>=Ae&&Te>=P.length)break}Te>=P.length&&P.length>0&&(V=Math.min(V,_.length)),X.setSelectionRange(V,V)})},[_,q]),xe=a.useCallback(W=>{if(W.key==="Backspace"&&T.length>0){W.preventDefault();const X=T.slice(0,-1);q(X)}le?.(W)},[T,q,le]),re=a.useCallback(()=>f(!0),[]),ue=a.useCallback(W=>{f(!1),L?.(W)},[L]),j=a.useCallback(()=>{q(""),Q.current?.focus()},[q]);return e.jsxs("div",{className:`nice-field nice-field--masked nice-field--${d} ${ce==="left"?"nice-field--label-left":""} ${I?"nice-field--loading":""} ${K||""}`,style:{...se,...A!=null&&{"--nice-field-label-width":typeof A=="number"?`${A}px`:A},...F!=null&&{"--nice-field-control-width":typeof F=="number"?`${F}px`:F}},"aria-busy":I||void 0,children:[t&&e.jsx("label",{htmlFor:E,className:`nice-field__label ${l?"nice-field__label--required":""}`,children:t}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{className:`nice-input nice-input--${d} ${n?"nice-input--error":""} ${s?"nice-input--disabled":""} ${o?"nice-input--readonly":""}`,style:{width:"fit-content",minWidth:0},children:[e.jsx("input",{ref:h,id:E,className:"nice-input__native nice-masked-input",type:"text",name:b,value:ne,placeholder:v,disabled:s||I,readOnly:o,autoFocus:fe,style:{width:`${m.length}ch`,minWidth:0,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontVariantNumeric:"tabular-nums"},"aria-invalid":!!n,"aria-describedby":n?`${E}-error`:i?`${E}-helper`:void 0,onInput:G,onChange:()=>{},onKeyDown:xe,onFocus:re,onBlur:ue,...Y}),H&&T&&e.jsx("button",{type:"button",className:"nice-input__clear",disabled:s||o,onClick:j,"aria-label":J("controls.clear","Clear"),children:e.jsx(g.oa,{name:"close",size:14})})]}),I&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),$==="right"&&n&&e.jsx("div",{id:`${E}-error`,className:"nice-field__error",role:"alert",children:n}),$==="right"&&!n&&i&&e.jsx("div",{id:`${E}-helper`,className:"nice-field__helper",children:i})]}),$!=="right"&&n&&e.jsx("div",{id:`${E}-error`,className:"nice-field__error",role:"alert",children:n}),$!=="right"&&!n&&i&&e.jsx("div",{id:`${E}-helper`,className:"nice-field__helper",children:i})]})});Ft.displayName="NiceMaskedInput";const kn=[{id:"length",label:"At least 8 characters",test:t=>t.length>=8},{id:"uppercase",label:"At least one uppercase letter",test:t=>/[A-Z]/.test(t)},{id:"lowercase",label:"At least one lowercase letter",test:t=>/[a-z]/.test(t)},{id:"digit",label:"At least one digit",test:t=>/\d/.test(t)},{id:"special",label:"At least one special character",test:t=>/[^a-zA-Z0-9]/.test(t)}];function $n(t,i){if(!t)return{level:"none",passed:[],ratio:0};const n=i.filter(o=>o.test(t)).map(o=>o.id),l=n.length/i.length;let s="weak";return l>=1?s="strong":l>=.75?s="good":l>=.5&&(s="fair"),{level:s,passed:n,ratio:l}}const Lt=a.forwardRef(({label:t,helperText:i,error:n,required:l,disabled:s,readOnly:o,size:d="md",name:b,id:N,className:K,style:se,value:T="",onChange:D,onBlur:L,onKeyDown:le,placeholder:z,maxLength:U,showToggle:k=!0,showStrength:B=!1,strengthRules:de,validationPlacement:H="bottom",autoFocus:fe,autoComplete:ce,labelPlacement:$,errorPlacement:I,loading:A,labelWidth:F,controlWidth:Y,...R},J)=>{const{t:E}=g.Gt(),Q=g.bc(N),[ee,f]=a.useState(!1),m=de??kn,_=a.useMemo(()=>B?$n(T,m):null,[B,T,m]),te=a.useCallback(()=>f(v=>!v),[]),ne=B&&_&&T?e.jsxs("div",{className:`nice-password__strength ${H==="right"?"nice-password__strength--right":""}`,children:[e.jsx("div",{className:"nice-password__meter",children:e.jsx("div",{className:`nice-password__meter-fill nice-password__meter-fill--${_.level}`,style:{width:`${_.ratio*100}%`}})}),e.jsx("span",{className:`nice-password__strength-label nice-password__strength-label--${_.level}`,children:E(`password.strength.${_.level}`,_.level.charAt(0).toUpperCase()+_.level.slice(1))}),e.jsx("ul",{className:"nice-password__rules",children:m.map(v=>{const h=_.passed.includes(v.id);return e.jsxs("li",{className:`nice-password__rule ${h?"nice-password__rule--passed":""}`,children:[e.jsx("span",{className:"nice-password__rule-icon",children:e.jsx(g.oa,{name:h?"check":"close",size:14})}),v.label]},v.id)})})]}):null;return e.jsxs("div",{className:`nice-field nice-field--${d} ${$==="left"?"nice-field--label-left":""} ${A?"nice-field--loading":""} ${K||""}`,style:{...se,...F!=null&&{"--nice-field-label-width":typeof F=="number"?`${F}px`:F},...Y!=null&&{"--nice-field-control-width":typeof Y=="number"?`${Y}px`:Y}},"aria-busy":A||void 0,children:[t&&e.jsx("label",{htmlFor:Q,className:`nice-field__label ${l?"nice-field__label--required":""}`,style:H==="right"&&$==="left"?{alignSelf:"flex-start",paddingTop:6}:void 0,children:t}),e.jsxs("div",{className:"nice-field__control",style:H==="right"?{alignItems:"flex-start"}:void 0,children:[e.jsxs("div",{style:H==="right"?{display:"flex",flexDirection:"column",flex:"1 1 auto",minWidth:0}:{display:"contents"},children:[e.jsxs("div",{className:`nice-input nice-input--${d} ${n?"nice-input--error":""} ${s?"nice-input--disabled":""} ${o?"nice-input--readonly":""}`,children:[e.jsx("input",{ref:J,id:Q,className:"nice-input__native",type:ee?"text":"password",name:b,value:T,placeholder:z,disabled:s||A,readOnly:o,maxLength:U,autoFocus:fe,autoComplete:ce,"aria-invalid":!!n,"aria-describedby":n?`${Q}-error`:i?`${Q}-helper`:void 0,onChange:v=>D?.(v.target.value),onBlur:L,onKeyDown:le,...R}),k&&e.jsx("button",{type:"button",className:"nice-password__toggle",onClick:te,disabled:s,tabIndex:-1,"aria-label":ee?E("password.hide","Hide password"):E("password.show","Show password"),children:e.jsx(g.oa,{name:ee?"eye-off":"eye",size:18})})]}),H==="right"&&I!=="right"&&n&&e.jsx("div",{id:`${Q}-error`,className:"nice-field__error",role:"alert",children:n}),H==="right"&&I!=="right"&&!n&&i&&e.jsx("div",{id:`${Q}-helper`,className:"nice-field__helper",children:i})]}),A&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),H==="right"&&ne,I==="right"&&n&&e.jsx("div",{id:`${Q}-error`,className:"nice-field__error",role:"alert",children:n}),I==="right"&&!n&&i&&e.jsx("div",{id:`${Q}-helper`,className:"nice-field__helper",children:i})]}),H!=="right"&&ne,H!=="right"&&I!=="right"&&n&&e.jsx("div",{id:`${Q}-error`,className:"nice-field__error",role:"alert",children:n}),H!=="right"&&I!=="right"&&!n&&i&&e.jsx("div",{id:`${Q}-helper`,className:"nice-field__helper",children:i})]})});Lt.displayName="NicePasswordInput";const zt=({label:t,helperText:i,error:n,required:l,disabled:s,size:o="md",name:d,id:b,className:N,style:K,accessMode:se,options:T,value:D,onChange:L,direction:le="horizontal",showKeyboardHints:z,displayStyle:U,labelPlacement:k,errorPlacement:B,labelWidth:de,controlWidth:H,loading:fe,readOnly:ce})=>{g.ac("toggle",U);const $=g.Dc(se,b),I=$==="hidden";($==="disabled"||$==="readOnly")&&(s=!0);const{t:A}=g.Gt(),F=g.bc(b),Y=d||F,R=a.useMemo(()=>[{key:"ArrowUp",description:A("shortcuts.previousOption","Previous option")},{key:"ArrowDown",description:A("shortcuts.nextOption","Next option")},{key:"Space",description:A("shortcuts.select","Select")}],[A]);return I?null:e.jsxs("div",{className:`nice-field nice-field--inline nice-field--inline-block nice-field--${o} ${k==="left"?"nice-field--label-left":""} ${B==="right"?"nice-field--error-right":""} ${fe?"nice-field--loading":""} ${N||""}`,style:{...K,...de!=null&&{"--nice-field-label-width":typeof de=="number"?`${de}px`:de},...H!=null&&{"--nice-field-control-width":typeof H=="number"?`${H}px`:H}},role:"radiogroup","aria-labelledby":`${F}-label`,"aria-busy":fe||void 0,children:[t&&e.jsxs("span",{id:`${F}-label`,className:`nice-field__label ${l?"nice-field__label--required":""}`,children:[t,z&&e.jsx(g.ha,{shortcuts:R,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsx("div",{className:`nice-radio-group ${le==="vertical"?"nice-radio-group--vertical":""}`,children:T.map(J=>e.jsxs("label",{className:`nice-radio ${s||J.disabled||fe?"nice-radio--disabled":""} ${ce?"nice-radio--readonly":""}`,children:[e.jsx("input",{type:"radio",className:"nice-radio__input",name:Y,value:J.value,checked:D===J.value,disabled:s||J.disabled||fe,"aria-readonly":ce||void 0,onChange:()=>{ce||L?.(J.value)}}),e.jsx("span",{className:"nice-radio__circle",children:e.jsx("span",{className:"nice-radio__dot"})}),e.jsx("span",{children:J.label})]},J.value))}),fe&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),B==="right"&&n&&e.jsx("div",{id:`${F}-error`,className:"nice-field__error",role:"alert",children:n}),B==="right"&&!n&&i&&e.jsx("div",{id:`${F}-helper`,className:"nice-field__helper",children:i})]}),B!=="right"&&n&&e.jsx("div",{id:`${F}-error`,className:"nice-field__error",role:"alert",children:n}),B!=="right"&&!n&&i&&e.jsx("div",{id:`${F}-helper`,className:"nice-field__helper",children:i})]})},wn=Object.freeze(Object.defineProperty({__proto__:null,NiceRadioGroup:zt},Symbol.toStringTag,{value:"Module"})),Tn=({filled:t,size:i})=>e.jsxs("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t==="half"&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:"halfGrad",children:[e.jsx("stop",{offset:"50%",stopColor:"currentColor"}),e.jsx("stop",{offset:"50%",stopColor:"transparent"})]})}),e.jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87L18.18 22 12 18.27 5.82 22 7 14.14l-5-4.87 6.91-1.01L12 2z",fill:t==="full"?"currentColor":t==="half"?"url(#halfGrad)":"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})]}),Dn={xxs:10,xs:14,sm:18,md:22,lg:28,xl:34,xxl:42,small:18,medium:22,large:28},Mt=a.forwardRef(({value:t=0,onChange:i,count:n=5,half:l=!1,readOnly:s=!1,disabled:o=!1,size:d="md",label:b,icon:N,name:K,error:se,helperText:T,required:D,id:L,className:le,style:z,labelPlacement:U,errorPlacement:k,labelWidth:B,controlWidth:de,valuePlacement:H="none",valueTemplate:fe,loading:ce,...$},I)=>{const{t:A}=g.Gt(),F=g.bc(L),[Y,R]=a.useState(null),J=Dn[d],E=!s&&!o&&!ce,Q=Y??t,ee=v=>Q>=v+1?"full":l&&Q>=v+.5?"half":"empty",f=a.useCallback((v,h)=>{if(!E)return;const q=h&&l?v+.5:v+1;i?.(q===t?0:q)},[E,l,i,t]),m=a.useCallback((v,h)=>{if(E)if(l){const q=h.currentTarget.getBoundingClientRect(),G=h.clientX-q.left<q.width/2;R(G?v+.5:v+1)}else R(v+1)},[E,l]),_=a.useCallback(()=>{E&&R(null)},[E]),te=a.useCallback(v=>{if(!E)return;const h=l?.5:1;if(v.key==="ArrowRight"||v.key==="ArrowUp"){v.preventDefault();const q=Math.min(n,t+h);i?.(q)}else if(v.key==="ArrowLeft"||v.key==="ArrowDown"){v.preventDefault();const q=Math.max(0,t-h);i?.(q)}},[E,l,n,t,i]),ne=fe?fe.replace("{value}",String(t)):String(t);return e.jsxs("div",{className:`nice-field nice-field--${d} ${U==="left"?"nice-field--label-left":""} ${ce?"nice-field--loading":""} ${le||""}`,style:{...z,...B!=null&&{"--nice-field-label-width":typeof B=="number"?`${B}px`:B},...de!=null&&{"--nice-field-control-width":typeof de=="number"?`${de}px`:de}},"aria-busy":ce||void 0,...$,children:[b&&e.jsx("label",{htmlFor:F,className:`nice-field__label ${D?"nice-field__label--required":""}`,children:b}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{ref:I,id:F,className:`nice-rating nice-rating--${d} ${o?"nice-rating--disabled":""} ${s?"nice-rating--readonly":""}`,role:"slider","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":n,"aria-label":b||A("controls.rating","Rating"),"aria-invalid":!!se,tabIndex:E?0:-1,onMouseLeave:_,onKeyDown:te,children:[K&&e.jsx("input",{type:"hidden",name:K,value:t}),Array.from({length:n},(v,h)=>{const q=ee(h);return e.jsx("span",{className:`nice-rating__star nice-rating__star--${q}`,onClick:G=>{if(!E)return;const xe=G.currentTarget.getBoundingClientRect(),re=l&&G.clientX-xe.left<xe.width/2;f(h,re)},onMouseMove:G=>m(h,G),"aria-label":`${h+1} ${A("controls.star","star")}`,children:N?N(q):e.jsx(Tn,{filled:q,size:J})},h)}),ce&&e.jsx("span",{className:"nice-rating__loading",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})})]}),H==="right"&&!ce&&e.jsx("span",{className:"nice-rating__value",children:ne}),H==="bottom"&&!ce&&e.jsx("div",{className:"nice-rating__value nice-rating__value--bottom",children:ne}),k==="right"&&se&&e.jsx("div",{id:`${F}-error`,className:"nice-field__error",role:"alert",children:se}),k==="right"&&!se&&T&&e.jsx("div",{id:`${F}-helper`,className:"nice-field__helper",children:T})]}),k!=="right"&&se&&e.jsx("div",{id:`${F}-error`,className:"nice-field__error",role:"alert",children:se}),k!=="right"&&!se&&T&&e.jsx("div",{id:`${F}-helper`,className:"nice-field__helper",children:T})]})});Mt.displayName="NiceRating";const Sn=Object.freeze(Object.defineProperty({__proto__:null,NiceRating:Mt},Symbol.toStringTag,{value:"Module"})),kt=a.forwardRef(({label:t,helperText:i,error:n,required:l,disabled:s,id:o,className:d,style:b,accessMode:N,value:K=0,onChange:se,min:T=0,max:D=100,step:L=1,showValue:le=!0,showMinMax:z=!1,formatValue:U,showKeyboardHints:k,displayStyle:B,size:de="md",labelPlacement:H,errorPlacement:fe,labelWidth:ce,controlWidth:$,loading:I,showTicks:A=!1,tickInterval:F,maxTicks:Y=21,showTickLabels:R=!1},J)=>{g.ac("input",B);const E=g.Dc(N,o),Q=E==="hidden";(E==="disabled"||E==="readOnly")&&(s=!0);const{t:ee}=g.Gt(),f=g.bc(o),m=a.useMemo(()=>(K-T)/(D-T)*100,[K,T,D]),_=U?U(K):K.toString(),te=a.useMemo(()=>{if(!A)return[];const h=D-T;if(h<=0)return[T,D];let q=F??L,G=Math.floor(h/q)+1;return G>Y&&(q=h/(Y-1),G=Y),Array.from({length:G},(xe,re)=>{const ue=T+re*q;return re===G-1?D:ue})},[A,T,D,L,F,Y]),ne=a.useMemo(()=>[g.Yc.increment,g.Yc.decrement,g.Yc.first,g.Yc.last,g.Yc.incrementBig,g.Yc.decrementBig],[]),v=H==="left";return Q?null:e.jsxs("div",{className:`nice-field nice-field--${de} ${v?"nice-field--label-left":""} ${I?"nice-field--loading":""} ${d||""}`,style:{...b,...ce!=null&&{"--nice-field-label-width":typeof ce=="number"?`${ce}px`:ce},...$!=null&&{"--nice-field-control-width":typeof $=="number"?`${$}px`:$}},"aria-busy":I||void 0,children:[v?t&&e.jsxs("label",{htmlFor:f,className:`nice-field__label ${l?"nice-field__label--required":""}`,children:[t,k&&e.jsx(g.ha,{shortcuts:ne,size:"sm"})]}):(t||le||k)&&e.jsxs("div",{className:"nice-slider__header",children:[t?e.jsxs("label",{htmlFor:f,className:`nice-field__label ${l?"nice-field__label--required":""}`,children:[t,k&&e.jsx(g.ha,{shortcuts:ne,size:"sm"})]}):e.jsx("span",{}),le&&e.jsx("span",{className:"nice-slider__value nice-slider__value--header",children:_})]}),e.jsxs("div",{className:"nice-field__control nice-field__control--slider",children:[e.jsxs("div",{className:`nice-slider ${s||I?"nice-slider--disabled":""} ${A?"nice-slider--with-ticks":""}`,children:[e.jsxs("div",{className:"nice-slider__track-wrapper",children:[e.jsx("div",{className:"nice-slider__track",children:e.jsx("div",{className:"nice-slider__fill",style:{width:`${m}%`}})}),A&&te.length>0&&e.jsx("div",{className:"nice-slider__ticks","aria-hidden":"true",children:te.map((h,q)=>{const G=(h-T)/(D-T)*100,xe=h<=K;return e.jsx("span",{className:`nice-slider__tick ${xe?"nice-slider__tick--active":""}`,style:{left:`${G}%`},children:R&&e.jsx("span",{className:"nice-slider__tick-label",children:U?U(h):h})},q)})}),e.jsx("input",{ref:J,id:f,type:"range",className:"nice-slider__native",min:T,max:D,step:L,value:K,disabled:s||I,"aria-valuenow":K,"aria-valuemin":T,"aria-valuemax":D,onChange:h=>se?.(parseFloat(h.target.value))}),e.jsx("div",{className:"nice-slider__thumb-visual",style:{left:`${m}%`}})]}),z&&e.jsxs("div",{className:"nice-slider__labels",children:[e.jsx("span",{children:U?U(T):T}),e.jsx("span",{children:U?U(D):D})]})]}),v&&le&&e.jsx("span",{className:"nice-slider__value nice-slider__value--inline",children:_}),I&&e.jsx("span",{className:"nice-field__spinner nice-field__spinner--slider",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),fe==="right"&&n&&e.jsx("div",{className:"nice-field__error nice-field__error--slider",role:"alert",children:n}),fe==="right"&&!n&&i&&e.jsx("div",{className:"nice-field__helper nice-field__helper--slider",children:i})]}),fe!=="right"&&n&&e.jsx("div",{className:"nice-field__error",role:"alert",children:n}),fe!=="right"&&!n&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]})});kt.displayName="NiceSlider";const Rn=Object.freeze(Object.defineProperty({__proto__:null,NiceSlider:kt},Symbol.toStringTag,{value:"Module"})),on=({options:t,suggestions:i,value:n,onChange:l,searchable:s=!0,clearable:o,maxTags:d,allowCustom:b,placeholder:N,label:K,error:se,helperText:T,required:D,disabled:L,size:le="md",loading:z,id:U,className:k,style:B,accessMode:de,showKeyboardHints:H,labelPlacement:fe,errorPlacement:ce,labelWidth:$,controlWidth:I,readOnly:A,autoExpand:F=!1})=>{const Y=g.Dc(de,U),R=Y==="hidden";(Y==="disabled"||Y==="readOnly")&&(L=!0);const J=g.bc(U),{t:E}=g.Gt(),[Q,ee]=a.useState(!1),[f,m]=a.useState(""),_=a.useRef(null),te=a.useRef(null);g.Sc(_,()=>ee(!1));const ne=a.useMemo(()=>[g.Yc.submit,g.Yc.cancel,{key:"Backspace",description:E("shortcuts.removeLastTag","Remove last tag")}],[E]),v=a.useMemo(()=>Array.isArray(t)&&t.length>0?t:Array.isArray(i)?i.map(j=>({label:j,value:j})):[],[t,i]),h=a.useMemo(()=>Array.isArray(n)?n:[],[n]),q=a.useMemo(()=>{let j=v.filter(W=>!h.includes(String(W.value)));if(f){const W=f.toLowerCase();j=j.filter(X=>X.label.toLowerCase().includes(W))}return j},[v,h,f]),G=a.useCallback(j=>{d&&h.length>=d||(h.includes(j)||l([...h,j]),m(""))},[h,l,d]),xe=a.useCallback(j=>{l(h.filter(W=>W!==j))},[h,l]),re=j=>{A||(j.key==="Backspace"&&!f&&h.length>0?xe(h[h.length-1]):j.key==="Enter"&&f?(j.preventDefault(),q.length>0?G(String(q[0].value)):b&&G(f)):j.key==="Escape"&&ee(!1))},ue=j=>v.find(W=>String(W.value)===j)?.label??j;return R?null:e.jsxs("div",{className:`nice-field nice-field--${le} ${fe==="left"?"nice-field--label-left":""} ${z?"nice-field--loading":""} ${k||""}`,style:{...B,...$!=null&&{"--nice-field-label-width":typeof $=="number"?`${$}px`:$},...I!=null&&{"--nice-field-control-width":typeof I=="number"?`${I}px`:I}},ref:_,"aria-busy":z||void 0,children:[K&&e.jsxs("label",{className:`nice-field__label ${D?"nice-field__label--required":""}`,htmlFor:J,children:[K,H&&e.jsx(g.ha,{shortcuts:ne,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{className:`nice-tagbox nice-tagbox--${le} ${F?"nice-tagbox--expand":"nice-tagbox--fixed"} ${se?"nice-tagbox--error":""} ${L?"nice-tagbox--disabled":""} ${A?"nice-tagbox--readonly":""}`,onClick:()=>{!L&&!z&&!A&&(ee(!0),te.current?.focus())},style:{position:"relative",cursor:L||z?"not-allowed":A?"default":"text"},children:[e.jsxs("div",{className:"nice-tagbox__tags",children:[h.map(j=>e.jsxs("span",{className:"nice-tag nice-tagbox__tag",children:[ue(j),!L&&!A&&e.jsx("button",{type:"button",className:"nice-tag__remove",onClick:W=>{W.stopPropagation(),xe(j)},"aria-label":E("controls.remove","Remove"),children:e.jsx(g.oa,{name:"close",size:14})})]},j)),s&&e.jsx("input",{ref:te,id:J,type:"text",className:"nice-tagbox__input nice-input__native",value:f,onChange:j=>{m(j.target.value),ee(!0)},onFocus:()=>ee(!0),onKeyDown:re,placeholder:h.length===0?N||E("controls.select","Select..."):"",disabled:L||z,readOnly:A,autoComplete:"off",style:{border:"none",outline:"none",background:"transparent",color:"inherit",flex:1,minWidth:80,padding:0,font:"inherit",caretColor:"var(--color-primary)"}})]}),o&&h.length>0&&!L&&!A&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:j=>{j.stopPropagation(),l([])},"aria-label":E("controls.clear","Clear"),children:e.jsx(g.oa,{name:"close",size:14})}),Q&&(q.length>0||b&&f)&&e.jsxs("ul",{className:"nice-dropdown__list nice-tagbox__dropdown",role:"listbox",children:[q.map(j=>e.jsx("li",{role:"option",className:"nice-dropdown__option",onMouseDown:W=>{W.preventDefault(),G(String(j.value))},children:j.label},String(j.value))),b&&f&&!q.some(j=>String(j.value).toLowerCase()===f.toLowerCase())&&e.jsxs("li",{role:"option",className:"nice-dropdown__option nice-dropdown__option--add",onMouseDown:j=>{j.preventDefault(),G(f)},children:["+ ",E("controls.add","Add")," “",f,"”"]})]})]}),z&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),ce==="right"&&se&&e.jsx("div",{id:`${J}-error`,className:"nice-field__error",role:"alert",children:se}),ce==="right"&&!se&&T&&e.jsx("div",{id:`${J}-helper`,className:"nice-field__helper",children:T})]}),ce!=="right"&&se&&e.jsx("div",{id:`${J}-error`,className:"nice-field__error",role:"alert",children:se}),ce!=="right"&&!se&&T&&e.jsx("div",{id:`${J}-helper`,className:"nice-field__helper",children:T})]})},$t=a.forwardRef(({label:t,helperText:i,error:n,required:l,disabled:s,readOnly:o,size:d="md",name:b,id:N,className:K,style:se,accessMode:T,displayStyle:D,value:L,defaultValue:le,onChange:z,onBlur:U,onKeyDown:k,placeholder:B,rows:de=3,maxLength:H,resize:fe="vertical",autoFocus:ce,showCount:$,counterPlacement:I="bottom",submitOnEnter:A,onSubmit:F,showKeyboardHints:Y,labelPlacement:R,errorPlacement:J,loading:E,labelWidth:Q,controlWidth:ee,displayMode:f},m)=>{const _=g.Dc(T,N),te=_==="hidden";_==="disabled"&&(s=!0),_==="readOnly"&&(o=!0);const{t:ne}=g.Gt(),v=g.bc(N),h=g.rc("input",D),q=g.ac("input",D),G=L?.length??0,xe=H?G>H:!1,re=g.sc({enabled:f,readOnly:o,disabled:s}),ue={key:"Enter",ctrl:!0,description:ne("shortcuts.submit","Submit")},j=a.useCallback(X=>{A&&g.Qc(X,ue)&&(X.preventDefault(),F?.()),k?.(X)},[A,F,k,ue]),W=a.useMemo(()=>{const X=[];return A&&X.push(ue),X.push({key:"Tab",description:ne("shortcuts.indent","Indent (when supported)")}),X},[A,ne,ue]);return te?null:e.jsxs("div",{className:`nice-field nice-field--${d} ${R==="left"?"nice-field--label-left":""} ${E?"nice-field--loading":""} ${K||""}`,style:{...se,...Q!=null&&{"--nice-field-label-width":typeof Q=="number"?`${Q}px`:Q},...ee!=null&&{"--nice-field-control-width":typeof ee=="number"?`${ee}px`:ee}},"aria-busy":E||void 0,children:[t&&e.jsxs("label",{htmlFor:v,className:`nice-field__label ${l?"nice-field__label--required":""}`,children:[t,Y&&W.length>0&&e.jsx(g.ha,{shortcuts:W,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control nice-field__control--textarea",children:[re.isDisplay?e.jsx(g.cc,{value:L??le??"",placeholder:B,disabled:s,readOnly:o,onActivate:re.enterEdit,ariaLabel:t,className:"nice-display-value--textarea"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:"1 1 auto",minWidth:0},children:[e.jsx("textarea",{ref:X=>{typeof m=="function"?m(X):m&&(m.current=X),re.autoFocusRef(X)},id:v,className:`nice-textarea nice-input--${d} nice-textarea--ds-${q} ${n?"nice-textarea--error":""} ${s?"nice-textarea--disabled":""}`,style:{...h,resize:fe},name:b,value:L,defaultValue:le,placeholder:B,rows:de,maxLength:H,disabled:s||E,readOnly:o,autoFocus:ce,"aria-invalid":!!n,"aria-describedby":n?`${v}-error`:i?`${v}-helper`:void 0,onChange:X=>z?.(X.target.value),onBlur:X=>{f&&re.exitEdit(),U?.(X)},onKeyDown:j}),I!=="right"&&($||H)&&e.jsxs("div",{className:`nice-textarea__counter ${xe?"nice-textarea__counter--over":""}`,children:[G,H?` / ${H}`:""]})]}),I==="right"&&($||H)&&e.jsxs("div",{className:`nice-textarea__counter nice-textarea__counter--right ${xe?"nice-textarea__counter--over":""}`,children:[G,H?` / ${H}`:""]})]}),E&&e.jsx("span",{className:"nice-field__spinner nice-field__spinner--textarea",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),J==="right"&&n&&e.jsx("div",{id:`${v}-error`,className:"nice-field__error",role:"alert",children:n}),J==="right"&&!n&&i&&e.jsx("div",{id:`${v}-helper`,className:"nice-field__helper",children:i})]}),J!=="right"&&n&&e.jsx("div",{id:`${v}-error`,className:"nice-field__error",role:"alert",children:n}),J!=="right"&&!n&&i&&e.jsx("div",{id:`${v}-helper`,className:"nice-field__helper",children:i})]})});$t.displayName="NiceTextArea";const An=Object.freeze(Object.defineProperty({__proto__:null,NiceTextArea:$t},Symbol.toStringTag,{value:"Module"})),En=()=>`file-${Date.now()}-${Math.random().toString(36).slice(2,11)}`,Et=t=>{if(t===0)return"0 B";const i=1024,n=["B","KB","MB","GB","TB"],l=Math.floor(Math.log(t)/Math.log(i));return`${parseFloat((t/Math.pow(i,l)).toFixed(2))} ${n[l]}`},Pt=t=>t.startsWith("image/"),Bt=t=>t.startsWith("video/"),dn=t=>t.startsWith("audio/"),Un=t=>Pt(t)?"image":Bt(t)?"video":dn(t)?"music":/pdf|word|document|text|json|xml/.test(t)?"file":/excel|spreadsheet/.test(t)?"table":/powerpoint|presentation/.test(t)?"monitor":/zip|rar|7z/.test(t)?"box":"folder",In=t=>{if(Pt(t.type)||Bt(t.type)||dn(t.type))return URL.createObjectURL(t)},Fn={xxs:24,xs:32,sm:48,md:80,lg:120,xl:160,xxl:200},Ln=(t,i)=>n=>{const l=new FormData;n.chunk?(l.append("chunk",n.chunk),l.append("chunkIndex",String(n.chunkIndex)),l.append("totalChunks",String(n.totalChunks)),l.append("fileName",n.file.name),l.append("fileId",n.fileId||"")):l.append("file",n.file);const s=new XMLHttpRequest;return new Promise(o=>{s.upload.addEventListener("progress",d=>{d.lengthComputable&&n.onProgress&&n.onProgress(d.loaded/d.total*100)}),s.addEventListener("load",()=>{if(s.status>=200&&s.status<300)try{const d=JSON.parse(s.responseText);o({success:!0,url:d.url,fileId:d.fileId||d.id,metadata:d})}catch{o({success:!0,url:s.responseText})}else o({success:!1,error:`Upload failed: ${s.status} ${s.statusText}`})}),s.addEventListener("error",()=>o({success:!1,error:"Network error"})),s.addEventListener("abort",()=>o({success:!1,error:"Upload cancelled"})),n.signal&&n.signal.addEventListener("abort",()=>s.abort()),s.open("POST",t),i&&Object.entries(i).forEach(([d,b])=>s.setRequestHeader(d,b)),s.send(l)})},Ht=a.forwardRef((t,i)=>{const{accept:n,multiple:l=!0,maxFileSize:s,maxFiles:o,minFileSize:d,onFilesSelected:b,uploadMode:N="instant",labelText:K,text:se,dropzoneText:T,browseText:D,dragActiveText:L,labelPlacement:le="right",icon:z="upload",showFileList:U=!0,imagePreview:k,showPreview:B=!0,listMode:de="list",previewSize:H="md",fileProgress:fe,renderPreview:ce,renderFileItem:$,variant:I="dropzone",trigger:A,dropChildren:F,autoUpload:Y=!1,uploadHandler:R,uploadUrl:J,uploadHeaders:E,concurrentUploads:Q=3,maxRetries:ee=3,chunkSize:f=5*1024*1024,chunkThreshold:m=10*1024*1024,validateFile:_,keepFilesAfterUpload:te=!0,initialFiles:ne,disabled:v,readOnly:h,onFilesAdded:q,onUploadComplete:G,onUploadError:xe,onProgress:re,onFileRemoved:ue,onChange:j,apiRef:W,pasteFromClipboard:X,className:Ne,style:Ae}=t,{t:P}=g.Gt(),[ye,V]=a.useState(()=>ne??[]),[Te,y]=a.useState(!1),w=a.useRef(ye),u=a.useRef(null),pe=a.useRef(new Map),O=a.useRef([]),ae=a.useRef(new Set),C=a.useRef(0),Be=a.useRef(()=>{}),Ye=a.useRef(j),Oe=!!(R||J);a.useEffect(()=>{w.current=ye},[ye]),a.useEffect(()=>{Ye.current=j}),a.useEffect(()=>{Ye.current?.(ye)},[ye]),a.useEffect(()=>()=>{w.current.forEach(c=>c.previewUrl&&URL.revokeObjectURL(c.previewUrl))},[]);const Fe=a.useCallback(c=>b(c.map(Z=>Z.file)),[b]),ie=a.useCallback(c=>{if(_){const Z=_(c);if(Z)return Z}if(s&&c.size>s)return P("fileUpload.error.tooLarge","File is too large. Maximum size: {size}").replace("{size}",Et(s));if(d&&c.size<d)return P("fileUpload.error.tooSmall","File is too small. Minimum size: {size}").replace("{size}",Et(d));if(n){const Z=n.split(",").map(me=>me.trim().toLowerCase()),oe=c.type.toLowerCase(),ve="."+(c.name.split(".").pop()?.toLowerCase()??"");if(!Z.some(me=>me.startsWith(".")?ve===me:me.endsWith("/*")?oe.startsWith(me.replace("/*","/")):oe===me))return P("fileUpload.error.badType","File type not allowed. Accepted types: {accept}").replace("{accept}",n)}return null},[_,s,d,n,P]),ke=a.useCallback(()=>R||(J?Ln(J,E):null),[R,J,E]),qe=a.useCallback(async(c,Z,oe)=>{const ve=c.file,je=Math.ceil(ve.size/f);let me=0,Re={success:!1};for(let De=0;De<je;De++){if(oe.aborted)throw new Error("Upload cancelled");const Ke=De*f,vt=Math.min(Ke+f,ve.size),it=ve.slice(Ke,vt);let st=0,Qe=!1;for(;!Qe&&st<ee;)try{Re=await Z({file:ve,chunk:it,chunkIndex:De,totalChunks:je,fileId:c.id,onProgress:lt=>{const dt=(me+it.size*lt/100)/ve.size*100;V(Rt=>Rt.map(ut=>ut.id===c.id?{...ut,progress:dt}:ut))},signal:oe}),Re.success?(Qe=!0,me+=it.size):st++}catch(lt){if(st++,st>=ee)throw lt}if(!Qe)throw new Error(`Failed to upload chunk ${De+1}/${je}`)}return Re},[f,ee]),Ze=a.useCallback(async(c,Z)=>{const oe=w.current.find(je=>je.id===c);if(!oe||oe.status==="uploading"||oe.status==="success")return;const ve=new AbortController;pe.current.set(c,ve),ae.current.add(c),V(je=>je.map(me=>me.id===c?{...me,status:"uploading",progress:0,error:void 0}:me));try{const je=oe.file;let me;if(je.size>m?me=await qe(oe,Z,ve.signal):me=await Z({file:je,onProgress:Re=>{V(De=>De.map(Ke=>Ke.id===c?{...Ke,progress:Re}:Ke)),re?.(oe,Re)},signal:ve.signal}),me.success){if(V(Re=>Re.map(De=>De.id===c?{...De,status:"success",progress:100,uploadedUrl:me.url,uploadedAt:new Date}:De)),G?.({...oe,status:"success",uploadedUrl:me.url}),!te){const Re=w.current.find(De=>De.id===c);Re?.previewUrl&&URL.revokeObjectURL(Re.previewUrl),V(De=>De.filter(Ke=>Ke.id!==c))}}else throw new Error(me.error||"Upload failed")}catch(je){const me=je;if(me.name==="AbortError"||me.message==="Upload cancelled")V(Re=>Re.map(De=>De.id===c?{...De,status:"cancelled",error:P("fileUpload.status.cancelled","Cancelled")}:De));else{const Re=me.message||P("fileUpload.error.generic","Upload error");V(De=>De.map(Ke=>Ke.id===c?{...Ke,status:"error",error:Re}:Ke)),xe?.(oe,Re)}}finally{pe.current.delete(c),ae.current.delete(c),Be.current()}},[m,qe,re,G,xe,te,P]),nt=a.useRef(Ze);a.useEffect(()=>{nt.current=Ze});const Ge=a.useCallback(()=>{const c=ke();if(c)for(;O.current.length>0&&ae.current.size<Q;){const Z=O.current.shift();Z&&nt.current(Z,c)}},[ke,Q]);a.useEffect(()=>{Be.current=Ge});const Ce=a.useCallback(c=>{const Z=ke();if(!Z){console.error("No upload handler configured");return}nt.current(c,Z)},[ke]),at=a.useCallback(c=>{pe.current.get(c)?.abort(),V(Z=>Z.map(oe=>oe.id===c&&oe.status==="uploading"?{...oe,status:"cancelled",error:P("fileUpload.status.cancelled","Cancelled")}:oe))},[P]),M=a.useCallback(c=>{V(Z=>Z.map(oe=>oe.id===c?{...oe,status:"pending",progress:0,error:void 0}:oe)),Ce(c)},[Ce]),p=a.useCallback(c=>{const Z=w.current.find(ve=>ve.id===c);if(!Z)return;pe.current.get(c)?.abort(),Z.previewUrl&&URL.revokeObjectURL(Z.previewUrl);const oe=w.current.filter(ve=>ve.id!==c);w.current=oe,V(ve=>ve.filter(je=>je.id!==c)),ue?.(Z),N==="instant"&&Fe(oe)},[ue,N,Fe]),he=a.useCallback(()=>{w.current.filter(c=>c.status==="pending").forEach(c=>O.current.push(c.id)),Ge()},[Ge]),ze=a.useCallback(()=>{pe.current.forEach(c=>c.abort()),V(c=>c.map(Z=>Z.status==="uploading"?{...Z,status:"cancelled",error:P("fileUpload.status.cancelled","Cancelled")}:Z))},[P]),Se=a.useCallback(()=>{ze(),w.current.forEach(c=>c.previewUrl&&URL.revokeObjectURL(c.previewUrl)),V([]),N==="instant"&&Fe([])},[ze,N,Fe]),He=a.useCallback(()=>{w.current.filter(c=>c.status==="error").forEach(c=>M(c.id))},[M]),Pe=a.useCallback(c=>{if(v||h)return;const Z=w.current;let oe=l?c:c.slice(0,1);o&&(oe=oe.slice(0,Math.max(0,o-Z.length)));const ve=oe.map(me=>{const Re=ie(me);return{id:En(),file:me,name:me.name,size:me.size,type:me.type,status:Re?"error":"pending",progress:0,error:Re||void 0,previewUrl:In(me)}}),je=l?[...Z,...ve]:ve;V(je),w.current=je,q?.(ve),N==="instant"&&Fe(je),Y&&(ve.filter(me=>me.status==="pending").forEach(me=>O.current.push(me.id)),Ge())},[v,h,l,o,ie,q,N,Fe,Y,Ge]),Je=a.useCallback(()=>u.current?.click(),[]);a.useImperativeHandle(W,()=>({addFiles:Pe,uploadAll:he,cancelAll:ze,clearAll:Se,getFiles:()=>w.current,getFile:c=>w.current.find(Z=>Z.id===c),retryFailed:He,openFileBrowser:Je}),[Pe,he,ze,Se,He,Je]),a.useEffect(()=>{if(!X||v||h)return;const c=Z=>{const oe=Z.clipboardData?.items;if(!oe)return;const ve=[];for(let je=0;je<oe.length;je++)if(oe[je].kind==="file"){const me=oe[je].getAsFile();me&&ve.push(me)}ve.length>0&&(Z.preventDefault(),Pe(ve))};return document.addEventListener("paste",c),()=>document.removeEventListener("paste",c)},[X,v,h,Pe]);const _t=c=>{c.preventDefault(),!(v||h)&&(C.current++,y(!0))},gt=c=>{c.preventDefault(),C.current--,C.current<=0&&(C.current=0,y(!1))},wt=c=>{c.preventDefault(),C.current=0,y(!1),!(v||h)&&Pe(Array.from(c.dataTransfer.files))},xt=c=>{c.target.files&&Pe(Array.from(c.target.files)),c.target.value=""},Ee=a.useMemo(()=>{const c={total:ye.length,pending:0,uploading:0,success:0,error:0};for(const Z of ye)Z.status==="pending"?c.pending++:Z.status==="uploading"?c.uploading++:Z.status==="success"?c.success++:Z.status==="error"&&c.error++;return c},[ye]),We=K??se??T??P("dropOrClick","Drop files here or click to browse"),et=L??P("fileUpload.dropzone.dragActive","Drop files here"),rt=c=>P(`fileUpload.status.${c}`,{pending:"Pending",uploading:"Uploading…",success:"Uploaded",error:"Error",cancelled:"Cancelled"}[c]),Tt=c=>Oe||c.status!=="pending",Dt=c=>{if(ce)return ce(c);const Z=Fn[H]??80,oe=k??B;return oe&&c.previewUrl&&Pt(c.type)?e.jsx("img",{src:c.previewUrl,alt:c.name,className:"nice-fileuploader__thumb nice-upload__thumb nice-upload__preview",style:{width:Z,height:Z,objectFit:"cover"}}):oe&&c.previewUrl&&Bt(c.type)?e.jsxs("span",{className:"nice-upload__preview",style:{position:"relative",display:"inline-flex"},children:[e.jsx("video",{src:c.previewUrl,muted:!0,style:{width:Z,height:Z,objectFit:"cover"}}),e.jsx("span",{className:"nice-upload__preview-overlay","aria-hidden":"true",children:e.jsx(g.oa,{name:"play",size:20})})]}):e.jsx("span",{className:"nice-upload__preview nice-upload__preview--icon","aria-hidden":"true",children:e.jsx(g.oa,{name:Un(c.type),size:Math.round(Z*.5)})})},St=c=>{const Z={upload:()=>Ce(c.id),cancel:()=>at(c.id),retry:()=>M(c.id),remove:()=>p(c.id)};if($)return e.jsx(a.Fragment,{children:$(c,Z)},c.id);const oe=fe?.[c.name]??c.progress,ve=Tt(c);return e.jsxs("div",{className:`nice-fileuploader__file nice-upload__file nice-upload__item nice-upload__item--${c.status}`,children:[(k??B)&&Dt(c),e.jsx("span",{className:"nice-fileuploader__filename nice-upload__filename",title:c.name,children:c.name}),e.jsx("span",{className:"nice-fileuploader__filesize nice-upload__filesize",children:Et(c.size)}),ve&&e.jsx("span",{className:`nice-upload__badge nice-upload__badge--${c.status}`,children:rt(c.status)}),(c.status==="uploading"||oe!=null&&oe>0&&oe<100)&&e.jsx("div",{className:"nice-fileuploader__progress nice-upload__progress",children:e.jsx("div",{className:"nice-fileuploader__progress-bar nice-upload__progress-bar",style:{width:`${Math.min(100,Math.max(0,oe))}%`}})}),c.error&&c.status==="error"&&e.jsx("span",{className:"nice-upload__item-error",children:c.error}),c.uploadedUrl&&e.jsx("a",{className:"nice-upload__link",href:c.uploadedUrl,target:"_blank",rel:"noopener noreferrer",children:P("fileUpload.openFile","Open file")}),!h&&!v&&e.jsxs("span",{className:"nice-upload__item-actions",children:[Oe&&c.status==="pending"&&e.jsx("button",{type:"button",className:"nice-upload__btn nice-upload__btn--upload",onClick:Z.upload,title:P("fileUpload.action.upload","Upload"),"aria-label":P("fileUpload.action.upload","Upload"),children:e.jsx(g.oa,{name:"upload",size:14})}),c.status==="uploading"&&e.jsx("button",{type:"button",className:"nice-upload__btn nice-upload__btn--cancel",onClick:Z.cancel,title:P("fileUpload.action.cancel","Cancel"),"aria-label":P("fileUpload.action.cancel","Cancel"),children:e.jsx(g.oa,{name:"stop",size:14})}),Oe&&c.status==="error"&&e.jsx("button",{type:"button",className:"nice-upload__btn nice-upload__btn--retry",onClick:Z.retry,title:P("fileUpload.action.retry","Retry"),"aria-label":P("fileUpload.action.retry","Retry"),children:e.jsx(g.oa,{name:"refresh",size:14})}),c.status!=="uploading"&&e.jsx("button",{type:"button",className:"nice-fileuploader__remove nice-upload__remove nice-upload__btn nice-upload__btn--remove",onClick:Z.remove,title:P("remove","Remove"),"aria-label":P("remove","Remove"),children:e.jsx(g.oa,{name:"close",size:14})})]})]},c.id)},ot=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),Je())},bt=e.jsx("input",{ref:u,type:"file",accept:n,multiple:l,hidden:!0,disabled:v,onChange:xt});return e.jsxs("div",{ref:i,className:`nice-fileuploader nice-upload ${v?"nice-fileuploader--disabled nice-upload--disabled":""} ${h?"nice-upload--readonly":""} ${Ne||""}`,style:Ae,children:[I==="button"?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"nice-upload__trigger nice-btn nice-btn--primary",onClick:Je,disabled:v||h,children:A??P("filePicker.label","Choose files")}),bt]}):!h&&e.jsxs("div",{className:`nice-fileuploader__dropzone nice-upload__dropzone nice-upload__dropzone--label-${le} ${!F&&!We?"nice-upload__dropzone--icon-only":""} ${Te?"nice-fileuploader__dropzone--active nice-upload__dropzone--active":""}`,role:"button",tabIndex:v?-1:0,"aria-disabled":v||void 0,onDragEnter:_t,onDragOver:c=>c.preventDefault(),onDragLeave:gt,onDrop:wt,onClick:()=>!v&&Je(),onKeyDown:ot,children:[bt,F??e.jsxs(e.Fragment,{children:[z&&e.jsx("div",{className:"nice-upload__icon","aria-hidden":"true",children:e.jsx(g.oa,{name:z,size:"lg"})}),(Te?et:We)&&e.jsxs("div",{className:"nice-fileuploader__label nice-upload__label",children:[Te?et:We,D&&e.jsxs("span",{className:"nice-upload__browse",children:[" ",D]})]})]})]}),U&&ye.length>0&&e.jsx("div",{className:`nice-fileuploader__list nice-upload__list nice-upload__list--${de}`,children:ye.map(St)}),Oe&&ye.length>0&&!h&&e.jsxs("div",{className:"nice-upload__bulk",children:[Ee.pending>0&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary nice-btn--sm",onClick:he,children:P("fileUpload.bulk.uploadAll","Upload all ({n})").replace("{n}",String(Ee.pending))}),Ee.error>0&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:He,children:P("fileUpload.bulk.retryFailed","Retry failed ({n})").replace("{n}",String(Ee.error))}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:Se,children:P("fileUpload.bulk.clear","Clear")})]}),!Oe&&N==="useButtons"&&ye.length>0&&!h&&e.jsxs("div",{className:"nice-fileuploader__actions nice-upload__actions",children:[e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary nice-btn--sm",onClick:()=>Fe(w.current),children:P("upload","Upload")}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:Se,children:P("clearAll","Clear All")})]})]})});Ht.displayName="NiceUpload";const zn=[{label:"Polska",value:"PL"},{label:"Deutschland",value:"DE"},{label:"Česko",value:"CZ"},{label:"Slovensko",value:"SK"},{label:"United Kingdom",value:"GB"},{label:"United States",value:"US"},{label:"France",value:"FR"},{label:"Italia",value:"IT"},{label:"España",value:"ES"},{label:"Nederland",value:"NL"}],Yt=({label:t,helperText:i,error:n,errorPlacement:l="bottom",required:s,disabled:o,readOnly:d,loading:b,size:N="md",className:K,style:se,accessMode:T,id:D,value:L,defaultValue:le,onChange:z,columns:U=2,showState:k=!1,showBuilding:B=!0,showApartment:de=!0,showCountry:H=!0,countryOptions:fe=zn,defaultCountry:ce="PL",fieldLabels:$,fieldPlaceholders:I,showLabel:A=!0,labelPlacement:F,labelWidth:Y,controlWidth:R})=>{const J=g.Dc(T,D),E=J==="hidden";J==="disabled"&&(o=!0),J==="readOnly"&&(d=!0);const{t:Q}=g.Gt(),ee=L!==void 0,[f,m]=a.useState(le??{}),_=ee?L:f,te=j=>{const W={..._,...j};ee||m(W),z?.(W)},ne={street:$?.street??Q("address.street","Street"),building:$?.building??Q("address.building","Building"),apartment:$?.apartment??Q("address.apartment","Apt."),postalCode:$?.postalCode??Q("address.postalCode","Postal code"),city:$?.city??Q("address.city","City"),state:$?.state??Q("address.state","State / Region"),country:$?.country??Q("address.country","Country")},v=I??{},h=_.country??ce,q=F==="left"?"left":"top",G={...se,...Y!=null&&{"--nice-field-label-width":typeof Y=="number"?`${Y}px`:Y},...R!=null&&{"--nice-field-control-width":typeof R=="number"?`${R}px`:R}},xe={display:"grid",gridTemplateColumns:`repeat(${U}, minmax(0, 1fr))`,gap:"8px 12px"},re=U===2?{gridColumn:"span 2"}:{},ue={size:N,disabled:o||b,readOnly:d,labelPlacement:q};return E?null:e.jsxs("div",{className:`nice-field nice-field--${N} nice-address nice-address--cols-${U} ${b?"nice-field--loading":""} ${K||""}`,style:G,"aria-busy":b||void 0,children:[A&&t&&e.jsx("label",{className:`nice-field__label ${s?"nice-field__label--required":""}`,children:t}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{className:"nice-address__grid",style:xe,children:[e.jsx("div",{style:re,children:e.jsx(Le.NiceTextInput,{...ue,label:ne.street,value:_.street??"",onChange:j=>te({street:j}),placeholder:v.street,required:s})}),B&&e.jsx(Le.NiceTextInput,{...ue,label:ne.building,value:_.building??"",onChange:j=>te({building:j}),placeholder:v.building}),de&&e.jsx(Le.NiceTextInput,{...ue,label:ne.apartment,value:_.apartment??"",onChange:j=>te({apartment:j}),placeholder:v.apartment}),e.jsx(Le.NiceTextInput,{...ue,label:ne.postalCode,value:_.postalCode??"",onChange:j=>te({postalCode:j}),placeholder:v.postalCode??"00-000",required:s}),e.jsx(Le.NiceTextInput,{...ue,label:ne.city,value:_.city??"",onChange:j=>te({city:j}),placeholder:v.city,required:s}),k&&e.jsx(Le.NiceTextInput,{...ue,label:ne.state,value:_.state??"",onChange:j=>te({state:j}),placeholder:v.state}),H&&e.jsx(jt.NiceSelect,{...ue,label:ne.country,value:h,onChange:j=>te({country:typeof j=="string"?j:String(j??"")}),options:fe,required:s})]}),b&&e.jsx("span",{className:"nice-field__spinner nice-field__spinner--address",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),l==="right"&&n&&e.jsx("div",{className:"nice-field__error",role:"alert",children:n}),l==="right"&&!n&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]}),l!=="right"&&n&&e.jsx("div",{className:"nice-field__error",role:"alert",children:n}),l!=="right"&&!n&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]})};Yt.displayName="NiceAddress";const un=[{code:"US",name:"United States",dialCode:"+1",flag:"🇺🇸"},{code:"GB",name:"United Kingdom",dialCode:"+44",flag:"🇬🇧"},{code:"DE",name:"Germany",dialCode:"+49",flag:"🇩🇪"},{code:"FR",name:"France",dialCode:"+33",flag:"🇫🇷"},{code:"PL",name:"Poland",dialCode:"+48",flag:"🇵🇱"},{code:"ES",name:"Spain",dialCode:"+34",flag:"🇪🇸"},{code:"IT",name:"Italy",dialCode:"+39",flag:"🇮🇹"},{code:"NL",name:"Netherlands",dialCode:"+31",flag:"🇳🇱"},{code:"BE",name:"Belgium",dialCode:"+32",flag:"🇧🇪"},{code:"AT",name:"Austria",dialCode:"+43",flag:"🇦🇹"},{code:"CH",name:"Switzerland",dialCode:"+41",flag:"🇨🇭"},{code:"SE",name:"Sweden",dialCode:"+46",flag:"🇸🇪"},{code:"NO",name:"Norway",dialCode:"+47",flag:"🇳🇴"},{code:"DK",name:"Denmark",dialCode:"+45",flag:"🇩🇰"},{code:"FI",name:"Finland",dialCode:"+358",flag:"🇫🇮"},{code:"PT",name:"Portugal",dialCode:"+351",flag:"🇵🇹"},{code:"IE",name:"Ireland",dialCode:"+353",flag:"🇮🇪"},{code:"CZ",name:"Czech Republic",dialCode:"+420",flag:"🇨🇿"},{code:"SK",name:"Slovakia",dialCode:"+421",flag:"🇸🇰"},{code:"HU",name:"Hungary",dialCode:"+36",flag:"🇭🇺"},{code:"RO",name:"Romania",dialCode:"+40",flag:"🇷🇴"},{code:"BG",name:"Bulgaria",dialCode:"+359",flag:"🇧🇬"},{code:"GR",name:"Greece",dialCode:"+30",flag:"🇬🇷"},{code:"UA",name:"Ukraine",dialCode:"+380",flag:"🇺🇦"},{code:"RU",name:"Russia",dialCode:"+7",flag:"🇷🇺"},{code:"CA",name:"Canada",dialCode:"+1",flag:"🇨🇦"},{code:"AU",name:"Australia",dialCode:"+61",flag:"🇦🇺"},{code:"NZ",name:"New Zealand",dialCode:"+64",flag:"🇳🇿"},{code:"JP",name:"Japan",dialCode:"+81",flag:"🇯🇵"},{code:"KR",name:"South Korea",dialCode:"+82",flag:"🇰🇷"},{code:"CN",name:"China",dialCode:"+86",flag:"🇨🇳"},{code:"IN",name:"India",dialCode:"+91",flag:"🇮🇳"},{code:"SG",name:"Singapore",dialCode:"+65",flag:"🇸🇬"},{code:"MY",name:"Malaysia",dialCode:"+60",flag:"🇲🇾"},{code:"TH",name:"Thailand",dialCode:"+66",flag:"🇹🇭"},{code:"VN",name:"Vietnam",dialCode:"+84",flag:"🇻🇳"},{code:"ID",name:"Indonesia",dialCode:"+62",flag:"🇮🇩"},{code:"PH",name:"Philippines",dialCode:"+63",flag:"🇵🇭"},{code:"BR",name:"Brazil",dialCode:"+55",flag:"🇧🇷"},{code:"MX",name:"Mexico",dialCode:"+52",flag:"🇲🇽"},{code:"AR",name:"Argentina",dialCode:"+54",flag:"🇦🇷"},{code:"CL",name:"Chile",dialCode:"+56",flag:"🇨🇱"},{code:"CO",name:"Colombia",dialCode:"+57",flag:"🇨🇴"},{code:"PE",name:"Peru",dialCode:"+51",flag:"🇵🇪"},{code:"ZA",name:"South Africa",dialCode:"+27",flag:"🇿🇦"},{code:"EG",name:"Egypt",dialCode:"+20",flag:"🇪🇬"},{code:"NG",name:"Nigeria",dialCode:"+234",flag:"🇳🇬"},{code:"KE",name:"Kenya",dialCode:"+254",flag:"🇰🇪"},{code:"AE",name:"United Arab Emirates",dialCode:"+971",flag:"🇦🇪"},{code:"SA",name:"Saudi Arabia",dialCode:"+966",flag:"🇸🇦"},{code:"IL",name:"Israel",dialCode:"+972",flag:"🇮🇱"},{code:"TR",name:"Turkey",dialCode:"+90",flag:"🇹🇷"},{code:"AF",name:"Afghanistan",dialCode:"+93",flag:"🇦🇫"},{code:"AL",name:"Albania",dialCode:"+355",flag:"🇦🇱"},{code:"DZ",name:"Algeria",dialCode:"+213",flag:"🇩🇿"},{code:"AD",name:"Andorra",dialCode:"+376",flag:"🇦🇩"},{code:"AO",name:"Angola",dialCode:"+244",flag:"🇦🇴"},{code:"AG",name:"Antigua and Barbuda",dialCode:"+1268",flag:"🇦🇬"},{code:"AM",name:"Armenia",dialCode:"+374",flag:"🇦🇲"},{code:"AZ",name:"Azerbaijan",dialCode:"+994",flag:"🇦🇿"},{code:"BS",name:"Bahamas",dialCode:"+1242",flag:"🇧🇸"},{code:"BH",name:"Bahrain",dialCode:"+973",flag:"🇧🇭"},{code:"BD",name:"Bangladesh",dialCode:"+880",flag:"🇧🇩"},{code:"BB",name:"Barbados",dialCode:"+1246",flag:"🇧🇧"},{code:"BY",name:"Belarus",dialCode:"+375",flag:"🇧🇾"},{code:"BZ",name:"Belize",dialCode:"+501",flag:"🇧🇿"},{code:"BJ",name:"Benin",dialCode:"+229",flag:"🇧🇯"},{code:"BT",name:"Bhutan",dialCode:"+975",flag:"🇧🇹"},{code:"BO",name:"Bolivia",dialCode:"+591",flag:"🇧🇴"},{code:"BA",name:"Bosnia and Herzegovina",dialCode:"+387",flag:"🇧🇦"},{code:"BW",name:"Botswana",dialCode:"+267",flag:"🇧🇼"},{code:"BN",name:"Brunei",dialCode:"+673",flag:"🇧🇳"},{code:"BF",name:"Burkina Faso",dialCode:"+226",flag:"🇧🇫"},{code:"BI",name:"Burundi",dialCode:"+257",flag:"🇧🇮"},{code:"CV",name:"Cape Verde",dialCode:"+238",flag:"🇨🇻"},{code:"KH",name:"Cambodia",dialCode:"+855",flag:"🇰🇭"},{code:"CM",name:"Cameroon",dialCode:"+237",flag:"🇨🇲"},{code:"CF",name:"Central African Republic",dialCode:"+236",flag:"🇨🇫"},{code:"TD",name:"Chad",dialCode:"+235",flag:"🇹🇩"},{code:"KM",name:"Comoros",dialCode:"+269",flag:"🇰🇲"},{code:"CG",name:"Congo",dialCode:"+242",flag:"🇨🇬"},{code:"CD",name:"DR Congo",dialCode:"+243",flag:"🇨🇩"},{code:"CR",name:"Costa Rica",dialCode:"+506",flag:"🇨🇷"},{code:"CI",name:"Côte d'Ivoire",dialCode:"+225",flag:"🇨🇮"},{code:"HR",name:"Croatia",dialCode:"+385",flag:"🇭🇷"},{code:"CU",name:"Cuba",dialCode:"+53",flag:"🇨🇺"},{code:"CY",name:"Cyprus",dialCode:"+357",flag:"🇨🇾"},{code:"DJ",name:"Djibouti",dialCode:"+253",flag:"🇩🇯"},{code:"DM",name:"Dominica",dialCode:"+1767",flag:"🇩🇲"},{code:"DO",name:"Dominican Republic",dialCode:"+1809",flag:"🇩🇴"},{code:"EC",name:"Ecuador",dialCode:"+593",flag:"🇪🇨"},{code:"SV",name:"El Salvador",dialCode:"+503",flag:"🇸🇻"},{code:"GQ",name:"Equatorial Guinea",dialCode:"+240",flag:"🇬🇶"},{code:"ER",name:"Eritrea",dialCode:"+291",flag:"🇪🇷"},{code:"EE",name:"Estonia",dialCode:"+372",flag:"🇪🇪"},{code:"SZ",name:"Eswatini",dialCode:"+268",flag:"🇸🇿"},{code:"ET",name:"Ethiopia",dialCode:"+251",flag:"🇪🇹"},{code:"FJ",name:"Fiji",dialCode:"+679",flag:"🇫🇯"},{code:"GA",name:"Gabon",dialCode:"+241",flag:"🇬🇦"},{code:"GM",name:"Gambia",dialCode:"+220",flag:"🇬🇲"},{code:"GE",name:"Georgia",dialCode:"+995",flag:"🇬🇪"},{code:"GH",name:"Ghana",dialCode:"+233",flag:"🇬🇭"},{code:"GD",name:"Grenada",dialCode:"+1473",flag:"🇬🇩"},{code:"GT",name:"Guatemala",dialCode:"+502",flag:"🇬🇹"},{code:"GN",name:"Guinea",dialCode:"+224",flag:"🇬🇳"},{code:"GW",name:"Guinea-Bissau",dialCode:"+245",flag:"🇬🇼"},{code:"GY",name:"Guyana",dialCode:"+592",flag:"🇬🇾"},{code:"HT",name:"Haiti",dialCode:"+509",flag:"🇭🇹"},{code:"HN",name:"Honduras",dialCode:"+504",flag:"🇭🇳"},{code:"HK",name:"Hong Kong",dialCode:"+852",flag:"🇭🇰"},{code:"IS",name:"Iceland",dialCode:"+354",flag:"🇮🇸"},{code:"IQ",name:"Iraq",dialCode:"+964",flag:"🇮🇶"},{code:"IR",name:"Iran",dialCode:"+98",flag:"🇮🇷"},{code:"JM",name:"Jamaica",dialCode:"+1876",flag:"🇯🇲"},{code:"JO",name:"Jordan",dialCode:"+962",flag:"🇯🇴"},{code:"KZ",name:"Kazakhstan",dialCode:"+7",flag:"🇰🇿"},{code:"KW",name:"Kuwait",dialCode:"+965",flag:"🇰🇼"},{code:"KG",name:"Kyrgyzstan",dialCode:"+996",flag:"🇰🇬"},{code:"LA",name:"Laos",dialCode:"+856",flag:"🇱🇦"},{code:"LV",name:"Latvia",dialCode:"+371",flag:"🇱🇻"},{code:"LB",name:"Lebanon",dialCode:"+961",flag:"🇱🇧"},{code:"LS",name:"Lesotho",dialCode:"+266",flag:"🇱🇸"},{code:"LR",name:"Liberia",dialCode:"+231",flag:"🇱🇷"},{code:"LY",name:"Libya",dialCode:"+218",flag:"🇱🇾"},{code:"LI",name:"Liechtenstein",dialCode:"+423",flag:"🇱🇮"},{code:"LT",name:"Lithuania",dialCode:"+370",flag:"🇱🇹"},{code:"LU",name:"Luxembourg",dialCode:"+352",flag:"🇱🇺"},{code:"MO",name:"Macau",dialCode:"+853",flag:"🇲🇴"},{code:"MK",name:"North Macedonia",dialCode:"+389",flag:"🇲🇰"},{code:"MG",name:"Madagascar",dialCode:"+261",flag:"🇲🇬"},{code:"MW",name:"Malawi",dialCode:"+265",flag:"🇲🇼"},{code:"MV",name:"Maldives",dialCode:"+960",flag:"🇲🇻"},{code:"ML",name:"Mali",dialCode:"+223",flag:"🇲🇱"},{code:"MT",name:"Malta",dialCode:"+356",flag:"🇲🇹"},{code:"MR",name:"Mauritania",dialCode:"+222",flag:"🇲🇷"},{code:"MU",name:"Mauritius",dialCode:"+230",flag:"🇲🇺"},{code:"MD",name:"Moldova",dialCode:"+373",flag:"🇲🇩"},{code:"MC",name:"Monaco",dialCode:"+377",flag:"🇲🇨"},{code:"MN",name:"Mongolia",dialCode:"+976",flag:"🇲🇳"},{code:"ME",name:"Montenegro",dialCode:"+382",flag:"🇲🇪"},{code:"MA",name:"Morocco",dialCode:"+212",flag:"🇲🇦"},{code:"MZ",name:"Mozambique",dialCode:"+258",flag:"🇲🇿"},{code:"MM",name:"Myanmar",dialCode:"+95",flag:"🇲🇲"},{code:"NA",name:"Namibia",dialCode:"+264",flag:"🇳🇦"},{code:"NP",name:"Nepal",dialCode:"+977",flag:"🇳🇵"},{code:"NI",name:"Nicaragua",dialCode:"+505",flag:"🇳🇮"},{code:"NE",name:"Niger",dialCode:"+227",flag:"🇳🇪"},{code:"KP",name:"North Korea",dialCode:"+850",flag:"🇰🇵"},{code:"OM",name:"Oman",dialCode:"+968",flag:"🇴🇲"},{code:"PK",name:"Pakistan",dialCode:"+92",flag:"🇵🇰"},{code:"PS",name:"Palestine",dialCode:"+970",flag:"🇵🇸"},{code:"PA",name:"Panama",dialCode:"+507",flag:"🇵🇦"},{code:"PG",name:"Papua New Guinea",dialCode:"+675",flag:"🇵🇬"},{code:"PY",name:"Paraguay",dialCode:"+595",flag:"🇵🇾"},{code:"QA",name:"Qatar",dialCode:"+974",flag:"🇶🇦"},{code:"RW",name:"Rwanda",dialCode:"+250",flag:"🇷🇼"},{code:"WS",name:"Samoa",dialCode:"+685",flag:"🇼🇸"},{code:"SM",name:"San Marino",dialCode:"+378",flag:"🇸🇲"},{code:"ST",name:"São Tomé and Príncipe",dialCode:"+239",flag:"🇸🇹"},{code:"SN",name:"Senegal",dialCode:"+221",flag:"🇸🇳"},{code:"RS",name:"Serbia",dialCode:"+381",flag:"🇷🇸"},{code:"SC",name:"Seychelles",dialCode:"+248",flag:"🇸🇨"},{code:"SL",name:"Sierra Leone",dialCode:"+232",flag:"🇸🇱"},{code:"SI",name:"Slovenia",dialCode:"+386",flag:"🇸🇮"},{code:"SB",name:"Solomon Islands",dialCode:"+677",flag:"🇸🇧"},{code:"SO",name:"Somalia",dialCode:"+252",flag:"🇸🇴"},{code:"SS",name:"South Sudan",dialCode:"+211",flag:"🇸🇸"},{code:"LK",name:"Sri Lanka",dialCode:"+94",flag:"🇱🇰"},{code:"SD",name:"Sudan",dialCode:"+249",flag:"🇸🇩"},{code:"SR",name:"Suriname",dialCode:"+597",flag:"🇸🇷"},{code:"SY",name:"Syria",dialCode:"+963",flag:"🇸🇾"},{code:"TW",name:"Taiwan",dialCode:"+886",flag:"🇹🇼"},{code:"TJ",name:"Tajikistan",dialCode:"+992",flag:"🇹🇯"},{code:"TZ",name:"Tanzania",dialCode:"+255",flag:"🇹🇿"},{code:"TL",name:"Timor-Leste",dialCode:"+670",flag:"🇹🇱"},{code:"TG",name:"Togo",dialCode:"+228",flag:"🇹🇬"},{code:"TO",name:"Tonga",dialCode:"+676",flag:"🇹🇴"},{code:"TT",name:"Trinidad and Tobago",dialCode:"+1868",flag:"🇹🇹"},{code:"TN",name:"Tunisia",dialCode:"+216",flag:"🇹🇳"},{code:"TM",name:"Turkmenistan",dialCode:"+993",flag:"🇹🇲"},{code:"UG",name:"Uganda",dialCode:"+256",flag:"🇺🇬"},{code:"UY",name:"Uruguay",dialCode:"+598",flag:"🇺🇾"},{code:"UZ",name:"Uzbekistan",dialCode:"+998",flag:"🇺🇿"},{code:"VU",name:"Vanuatu",dialCode:"+678",flag:"🇻🇺"},{code:"VA",name:"Vatican City",dialCode:"+379",flag:"🇻🇦"},{code:"VE",name:"Venezuela",dialCode:"+58",flag:"🇻🇪"},{code:"YE",name:"Yemen",dialCode:"+967",flag:"🇾🇪"},{code:"ZM",name:"Zambia",dialCode:"+260",flag:"🇿🇲"},{code:"ZW",name:"Zimbabwe",dialCode:"+263",flag:"🇿🇼"}],Gt=({value:t,defaultValue:i,onChange:n,placeholder:l,showSearch:s=!0,searchPlaceholder:o,showDialCode:d,showFlag:b,showFlagInValue:N,showFlagInMenu:K,showTextInValue:se,showTextInMenu:T,showDialCodeInValue:D,showDialCodeInMenu:L,showCodeInValue:le=!1,showCodeInMenu:z=!1,compact:U=!1,variant:k="default",dropdownAlign:B,disabled:de=!1,countries:H,priorityCountries:fe=["US","GB","DE","FR","PL"],allowClear:ce=!1,size:$="md",className:I="",style:A,label:F,helperText:Y,error:R,required:J,readOnly:E,loading:Q,labelPlacement:ee,errorPlacement:f,labelWidth:m,controlWidth:_,id:te,"data-testid":ne="nice-country-picker"})=>{const{t:v}=g.Gt(),h=a.useRef(null),q=a.useRef(null),G=a.useRef(null),[xe,re]=a.useState(i),[ue,j]=a.useState(!1),[W,X]=a.useState(""),[Ne,Ae]=a.useState(0),P=N??b??!0,ye=K??b??!0,V=se??!U,Te=T??!0,y=D??d??!U,w=L??d??!0,u=Le.useDropdownAlignment(ue,q,B??(U?"auto":"left")),pe=t!==void 0?t:xe,O=a.useMemo(()=>{let ie=un;if(H){const ke=new Set(H.map(qe=>qe.toUpperCase()));ie=ie.filter(qe=>ke.has(qe.code))}return ie},[H]),ae=a.useMemo(()=>{if(!fe?.length)return O;const ie=new Set(fe.map(Ze=>Ze.toUpperCase())),ke=O.filter(Ze=>ie.has(Ze.code)),qe=O.filter(Ze=>!ie.has(Ze.code));return[...ke,...qe]},[O,fe]),C=a.useMemo(()=>{if(!W)return ae;const ie=W.toLowerCase();return ae.filter(ke=>ke.name.toLowerCase().includes(ie)||ke.code.toLowerCase().includes(ie)||ke.dialCode.includes(ie))},[ae,W]),Be=a.useMemo(()=>pe?O.find(ie=>ie.code===pe)??null:null,[pe,O]);a.useEffect(()=>{if(!ue)return;const ie=ke=>{h.current&&!h.current.contains(ke.target)&&(j(!1),X(""))};return document.addEventListener("mousedown",ie),()=>document.removeEventListener("mousedown",ie)},[ue]),a.useEffect(()=>{ue&&s&&G.current&&G.current.focus()},[ue,s]),a.useEffect(()=>{Ae(0)},[W]);const Ye=a.useCallback(ie=>{t===void 0&&re(ie.code),n?.(ie),j(!1),X("")},[t,n]),Oe=a.useCallback(ie=>{ie.stopPropagation(),t===void 0&&re(void 0),n?.(null)},[t,n]),Fe=a.useCallback(ie=>{if(!ue){(ie.key==="Enter"||ie.key===" "||ie.key==="ArrowDown")&&(ie.preventDefault(),j(!0));return}switch(ie.key){case"ArrowDown":ie.preventDefault(),Ae(ke=>Math.min(ke+1,C.length-1));break;case"ArrowUp":ie.preventDefault(),Ae(ke=>Math.max(ke-1,0));break;case"Enter":ie.preventDefault(),C[Ne]&&Ye(C[Ne]);break;case"Escape":ie.preventDefault(),j(!1),X("");break}},[ue,C,Ne,Ye]);return e.jsxs("div",{ref:h,className:`nice-field nice-field--${$} nice-field--country-picker ${ee==="left"?"nice-field--label-left":""} ${f==="right"?"nice-field--error-right":""} ${R?"nice-field--error":""} ${Q?"nice-field--loading":""} nice-country-picker nice-country-picker--${$} ${U?"nice-country-picker--compact":""} ${k==="ghost"?"nice-country-picker--ghost":""} ${ue?"nice-country-picker--open":""} ${de?"nice-country-picker--disabled":""} ${I}`,style:{...A,...m!=null&&{"--nice-field-label-width":typeof m=="number"?`${m}px`:m},..._!=null&&{"--nice-field-control-width":typeof _=="number"?`${_}px`:_}},"data-testid":ne,"aria-busy":Q||void 0,children:[F&&e.jsxs("label",{className:"nice-field__label",htmlFor:te,children:[F,J&&e.jsx("span",{className:"nice-field__required",children:"*"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("button",{ref:q,type:"button",className:"nice-country-picker__trigger",onClick:()=>!de&&!E&&j(!ue),onKeyDown:Fe,disabled:de,id:te,"aria-haspopup":"listbox","aria-expanded":ue,"aria-invalid":R?!0:void 0,"data-testid":`${ne}-trigger`,children:[Be?e.jsxs("span",{className:"nice-country-picker__value",children:[P&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(Le.FlagIcon,{code:Be.code})}),V&&e.jsx("span",{className:"nice-country-picker__name",children:Be.name}),le&&e.jsx("span",{className:"nice-country-picker__code",children:Be.code}),y&&e.jsxs("span",{className:"nice-country-picker__dial-code",children:["(",Be.dialCode,")"]})]}):e.jsx("span",{className:"nice-country-picker__placeholder",children:U?"":l??v("controls.select","Select country")}),e.jsxs("span",{className:"nice-country-picker__icons",children:[ce&&Be&&!de&&!E&&e.jsx("span",{className:"nice-country-picker__clear",onClick:Oe,"aria-label":v("clear","Clear"),children:e.jsx(g.oa,{name:"close",size:14})}),k!=="ghost"&&e.jsx("span",{className:"nice-country-picker__arrow",children:e.jsx(g.oa,{name:ue?"chevron-up":"chevron-down",size:16})})]})]}),ue&&e.jsxs("div",{className:`nice-country-picker__dropdown nice-country-picker__dropdown--align-${u}`,role:"listbox","data-testid":`${ne}-dropdown`,children:[s&&e.jsx("div",{className:"nice-country-picker__search",children:e.jsx("input",{ref:G,type:"text",value:W,onChange:ie=>X(ie.target.value),onKeyDown:Fe,placeholder:o??v("search","Search"),className:"nice-country-picker__search-input","data-testid":`${ne}-search`})}),e.jsx("div",{className:"nice-country-picker__list",children:C.length===0?e.jsx("div",{className:"nice-country-picker__empty",children:v("noData","No countries found")}):C.map((ie,ke)=>e.jsxs("div",{className:`nice-country-picker__option ${ie.code===pe?"nice-country-picker__option--selected":""} ${ke===Ne?"nice-country-picker__option--highlighted":""}`,onClick:()=>Ye(ie),onMouseEnter:()=>Ae(ke),role:"option","aria-selected":ie.code===pe,"data-testid":`${ne}-option-${ie.code}`,children:[ye&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(Le.FlagIcon,{code:ie.code})}),Te&&e.jsx("span",{className:"nice-country-picker__name",children:ie.name}),z&&e.jsx("span",{className:"nice-country-picker__code",children:ie.code}),w&&e.jsx("span",{className:"nice-country-picker__dial-code",children:ie.dialCode})]},ie.code))})]}),Q&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),f==="right"&&R&&e.jsx("div",{className:"nice-field__error",role:"alert",children:R}),f==="right"&&!R&&Y&&e.jsx("div",{className:"nice-field__helper",children:Y})]}),f!=="right"&&R&&e.jsx("div",{className:"nice-field__error",role:"alert",children:R}),f!=="right"&&!R&&Y&&e.jsx("div",{className:"nice-field__helper",children:Y})]})};Gt.displayName="NiceCountryPicker";const Pn=["Su","Mo","Tu","We","Th","Fr","Sa"];function Bn(t,i){return new Date(t,i+1,0).getDate()}function Hn(t,i){return new Date(t,i,1).getDay()}function Wt(t,i,n){return`${t}-${String(i+1).padStart(2,"0")}-${String(n).padStart(2,"0")}`}function Yn(t){const i=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()));i.setUTCDate(i.getUTCDate()+4-(i.getUTCDay()||7));const n=new Date(Date.UTC(i.getUTCFullYear(),0,1));return Math.ceil(((i.getTime()-n.getTime())/864e5+1)/7)}const en=["January","February","March","April","May","June","July","August","September","October","November","December"],Vt=({value:t,onChange:i,min:n,max:l,disabledDates:s=[],firstDayOfWeek:o=1,size:d="md",showWeekNumbers:b,onMonthChange:N,className:K,style:se,accessMode:T,id:D,multiple:L,selectedDates:le,onSelectedDatesChange:z,selectionMode:U="single",rangeStart:k,rangeEnd:B,onRangeChange:de,renderDay:H,showKeyboardHints:fe,persistPreferences:ce=!1,fullWidth:$=!1,cookies:I=!1,localStorage:A=!0,sessionStorage:F=!1,storageMode:Y,storageKey:R})=>{const J=g.Dc(T,D),E=J==="hidden",Q=J==="disabled"||J==="readOnly",{t:ee}=g.Gt(),f=new Date,m=(U==="range"?k:t)||t,_=m?new Date(m):f,te=vn.useStorageAdapter(R??"nice-calendar"),ne=a.useMemo(()=>ce?te.get("prefs")??{}:{},[ce,te]),v=ne.firstDayOfWeek??o,[h,q]=a.useState(ne.lastViewYear??_.getFullYear()),[G,xe]=a.useState(ne.lastViewMonth??_.getMonth()),[re,ue]=a.useState(ne.preferredView??"days"),[j,W]=a.useState([]),X=le??j,[Ne,Ae]=a.useState(null),P=a.useCallback(M=>{if(!ce)return;const p=te.get("prefs")??{};te.set("prefs",{...p,...M})},[ce,te]),ye=a.useCallback(M=>{ue(M),P({preferredView:M})},[P]),V=a.useCallback((M,p)=>{P({lastViewYear:M,lastViewMonth:p})},[P]),Te=a.useMemo(()=>[g.Yc.moveUp,g.Yc.moveDown,g.Yc.moveLeft,g.Yc.moveRight,{key:"Enter",description:ee("shortcuts.selectDate","Select date")},g.Yc.pageUp,g.Yc.pageDown],[ee]),y=a.useMemo(()=>Bn(h,G),[h,G]),w=a.useMemo(()=>(Hn(h,G)-v+7)%7,[h,G,v]),u=a.useMemo(()=>{const M=[...Pn];for(let p=0;p<v;p++)M.push(M.shift());return M},[v]),pe=a.useCallback(M=>{const p=he=>/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])/.test(he);return n&&p(n)&&M<n||l&&p(l)&&M>l?!0:s.includes(M)},[n,l,s]),O=a.useCallback(M=>{if(re==="years"){q(ze=>ze+M*10);return}if(re==="months"){q(ze=>ze+M);return}let p=G+M,he=h;p<0&&(p=11,he--),p>11&&(p=0,he++),xe(p),q(he),V(he,p),N?.(he,p)},[G,h,N,re,V]),ae=Wt(f.getFullYear(),f.getMonth(),f.getDate()),C=U==="range",Be=a.useCallback(M=>C?M===k||M===B:L?X.includes(M):M===t,[C,k,B,L,X,t]),[Ye,Oe]=a.useMemo(()=>{if(!C||!k)return["",""];const M=B||Ne;return M?M<k?[M,k]:[k,M]:[k,k]},[C,k,B,Ne]),Fe=a.useCallback(M=>{if(!Q){if(C){const p=!k||B?{start:M,end:""}:M<k?{start:M,end:k}:{start:k,end:M};Ae(null),de?.(p),i?.(M);return}if(L){const p=X.includes(M)?X.filter(he=>he!==M):[...X,M];le===void 0&&W(p),z?.(p)}i?.(M)}},[Q,C,k,B,de,L,X,le,i,z]),ie=a.useCallback(()=>{re==="days"?ye("months"):re==="months"&&ye("years")},[re,ye]),ke=a.useCallback(M=>{xe(M),ye("days"),V(h,M),N?.(h,M)},[h,N,ye,V]),qe=a.useCallback(M=>{q(M),ye("months")},[ye]),Ze=re==="years"?`${h-h%10} – ${h-h%10+9}`:re==="months"?`${h}`:`${en[G]} ${h}`,nt=re==="years"?"decade":re==="months"?"year":"month",Ge=[];for(let M=0;M<w;M++)Ge.push(null);for(let M=1;M<=y;M++)Ge.push(M);for(;Ge.length%7!==0;)Ge.push(null);const Ce=[];for(let M=0;M<Ge.length;M+=7)Ce.push(Ge.slice(M,M+7));const at=h-h%10;return E?null:e.jsxs("div",{className:`nice-calendar nice-calendar--${d}${$?" nice-calendar--full-width":""} ${K||""}`,style:se,children:[e.jsxs("div",{className:"nice-calendar__header",children:[e.jsx("button",{type:"button",className:"nice-calendar__nav",onClick:()=>O(-1),"aria-label":`Previous ${nt}`,children:e.jsx(g.oa,{name:"chevron-left",size:16})}),e.jsx("button",{type:"button",className:"nice-calendar__title",onClick:ie,"aria-label":re==="days"?"Show month picker":re==="months"?"Show year picker":void 0,disabled:re==="years",children:Ze}),e.jsx("button",{type:"button",className:"nice-calendar__nav",onClick:()=>O(1),"aria-label":`Next ${nt}`,children:e.jsx(g.oa,{name:"chevron-right",size:16})}),fe&&e.jsx(g.ha,{shortcuts:Te,size:"sm"})]}),re==="days"&&e.jsxs("table",{className:"nice-calendar__grid",role:"grid",onMouseLeave:C?()=>Ae(null):void 0,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[b&&e.jsx("th",{className:"nice-calendar__wk",children:"W"}),u.map(M=>e.jsx("th",{children:M},M))]})}),e.jsx("tbody",{children:Ce.map((M,p)=>e.jsxs("tr",{children:[b&&e.jsx("td",{className:"nice-calendar__wk",children:M.find(he=>he!=null)?Yn(new Date(h,G,M.find(he=>he!=null))):""}),M.map((he,ze)=>{if(he==null)return e.jsx("td",{className:"nice-calendar__empty-cell"},ze);const Se=Wt(h,G,he),He=pe(Se),Pe=Be(Se),Je=Se===ae,gt=Ye!==""&&Se>=Ye&&Se<=Oe?` nice-calendar__day--in-range${Se===Ye?" nice-calendar__day--range-start":""}${Se===Oe?" nice-calendar__day--range-end":""}`:"";return e.jsx("td",{className:`nice-calendar__day${Pe?" nice-calendar__day--selected":""}${gt}${Je?" nice-calendar__day--today":""}${He?" nice-calendar__day--disabled":""}`,onClick:()=>!He&&Fe(Se),onMouseEnter:C&&!He?()=>Ae(Se):void 0,role:"gridcell","aria-selected":Pe,"aria-disabled":He,children:H?H(Se,he):he},ze)})]},p))})]}),re==="months"&&e.jsx("div",{className:"nice-calendar__picker-grid",children:en.map((M,p)=>e.jsx("button",{type:"button",className:`nice-calendar__picker-cell${p===G&&h===_.getFullYear()?" nice-calendar__picker-cell--selected":""}`,onClick:()=>ke(p),children:M.slice(0,3)},p))}),re==="years"&&e.jsx("div",{className:"nice-calendar__picker-grid",children:Array.from({length:12},(M,p)=>at-1+p).map(M=>e.jsx("button",{type:"button",className:`nice-calendar__picker-cell${M===h?" nice-calendar__picker-cell--selected":""}${M<at||M>at+9?" nice-calendar__picker-cell--other":""}`,onClick:()=>qe(M),children:M},M))})]})};Vt.displayName="NiceCalendar";const Gn={"date-local":{inputType:"date",localized:!0},"date-utc":{inputType:"date",localized:!1},"datetime-local":{inputType:"datetime-local",localized:!0},"datetime-utc":{inputType:"datetime-local",localized:!1},"month-local":{inputType:"month",localized:!0},"month-utc":{inputType:"month",localized:!1},week:{inputType:"week",localized:!1},time:{inputType:"time",localized:!1}},tn={date:"yyyy-MM-dd","datetime-local":"yyyy-MM-ddTHH:mm",month:"yyyy-MM",week:"yyyy-Www",time:"HH:mm"},Vn={"yyyy-MM-dd":"YYYY-MM-DD","yyyy-MM-ddTHH:mm":"YYYY-MM-DDTHH:MM","yyyy-MM":"YYYY-MM","yyyy-Www":"YYYY-Www","HH:mm":"HH:MM"};function It(t){const i=(t||"").toLowerCase().replace("_","-"),n=i.split("-")[0],l={pl:"dd.MM.yyyy","pl-pl":"dd.MM.yyyy",de:"dd.MM.yyyy","de-de":"dd.MM.yyyy","de-at":"dd.MM.yyyy","de-ch":"dd.MM.yyyy",cs:"dd.MM.yyyy","cs-cz":"dd.MM.yyyy",sk:"dd.MM.yyyy","sk-sk":"dd.MM.yyyy",ru:"dd.MM.yyyy","ru-ru":"dd.MM.yyyy",fi:"dd.MM.yyyy","fi-fi":"dd.MM.yyyy",no:"dd.MM.yyyy",nb:"dd.MM.yyyy",nn:"dd.MM.yyyy",da:"dd.MM.yyyy","da-dk":"dd.MM.yyyy",tr:"dd.MM.yyyy","tr-tr":"dd.MM.yyyy",sl:"dd.MM.yyyy",hr:"dd.MM.yyyy",sr:"dd.MM.yyyy",ro:"dd.MM.yyyy",bg:"dd.MM.yyyy",uk:"dd.MM.yyyy",is:"dd.MM.yyyy",et:"dd.MM.yyyy",lv:"dd.MM.yyyy",lt:"dd.MM.yyyy","en-gb":"dd/MM/yyyy","en-au":"dd/MM/yyyy","en-ie":"dd/MM/yyyy","en-nz":"dd/MM/yyyy","en-in":"dd/MM/yyyy",fr:"dd/MM/yyyy","fr-fr":"dd/MM/yyyy","fr-be":"dd/MM/yyyy",es:"dd/MM/yyyy","es-es":"dd/MM/yyyy",pt:"dd/MM/yyyy","pt-pt":"dd/MM/yyyy","pt-br":"dd/MM/yyyy",it:"dd/MM/yyyy","it-it":"dd/MM/yyyy",nl:"dd-MM-yyyy","nl-nl":"dd-MM-yyyy","nl-be":"dd/MM/yyyy",el:"dd/MM/yyyy",hu:"yyyy.MM.dd",en:"MM/dd/yyyy","en-us":"MM/dd/yyyy","en-ca":"MM/dd/yyyy",ja:"yyyy/MM/dd","ja-jp":"yyyy/MM/dd",ko:"yyyy.MM.dd","ko-kr":"yyyy.MM.dd",zh:"yyyy/MM/dd","zh-cn":"yyyy/MM/dd","zh-tw":"yyyy/MM/dd",sv:"yyyy-MM-dd","sv-se":"yyyy-MM-dd"};if(l[i])return l[i];if(l[n])return l[n];try{const o=new Intl.DateTimeFormat(t,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2024,0,15));let d="";for(const b of o)if(b.type==="day")d+="dd";else if(b.type==="month")d+="MM";else if(b.type==="year")d+="yyyy";else if(b.type==="literal"){const N=b.value.replace(/[\u00A0\u202F\u2009]/g," ").trim();d+=N||"."}return!/y/.test(d)||!/M/.test(d)||!/d/.test(d)?"yyyy-MM-dd":d}catch{return"yyyy-MM-dd"}}function Kn(t){const n=It(t).replace(/dd[^\w]*/g,"").replace(/[^\w]*dd/g,"");return!/y/.test(n)||!/M/.test(n)?"yyyy-MM":n}function Kt(){if(typeof document<"u"){const t=document.documentElement?.lang;if(t&&/^[a-zA-Z]{2,}/.test(t))return t}return typeof navigator<"u"&&navigator.language?navigator.language:"en-US"}function qn(t,i,n,l=!1){tn[t]||(t="date");let s=tn[t];l&&(t==="datetime-local"||t==="time")&&(s=s.replace("HH:mm","HH:mm:ss"));let o=s;i&&(t==="date"||t==="datetime-local"||t==="month")&&(t==="date"?o=It(n):t==="datetime-local"?o=`${It(n)} HH:mm${l?":ss":""}`:o=Kn(n)),t==="datetime-local"&&(o=o.replace("T"," · "));const d=Vn[o]??o.replace(/y/g,"Y").replace(/M/g,"M").replace(/d/g,"D").replace(/H/g,"H").replace(/m/g,"M").replace(/s/g,"S");return{displayTpl:o,isoTpl:s,placeholder:d}}const On=new Set(["y","M","d","H","m","s","w"]);function tt(t){return On.has(t)}function qt(t){let i=0;for(const n of t)tt(n)&&i++;return i}function Ot(t,i){let n="",l=0;for(const s of t)if(tt(s)){if(l>=i.length)break;n+=i[l++]}else{if(l===0)break;l>=i.length,n+=s}return n}function Zn(t,i,n){if(n.length===0)return"";const l={};let s=0;for(const b of t)tt(b)&&(s>=n.length?(l[b]??(l[b]=[])).push(""):(l[b]??(l[b]=[])).push(n[s]),s++);const o={};let d="";for(const b of i)if(tt(b)){const N=l[b]??[],K=o[b]??0;d+=N[K]??"",o[b]=K+1}return d}function ct(t,i,n){if(n.length===0)return"";const l={};let s=0;for(const b of i)tt(b)&&((l[b]??(l[b]=[])).push(n[s]??""),s++);const o={};let d="";for(const b of t)if(tt(b)){const N=l[b]??[],K=o[b]??0;d+=N[K]??"",o[b]=K+1}return d.replace(/\s+$/,"")}function nn(t,i,n){const l=qt(i);if(n.length<l)return"";const s=Zn(t,i,n);if(s.length<l)return"";let o="",d=0;for(const b of i)tt(b)?o+=s[d++]:o+=b;return o}function an(t,i,n){return t&&(i&&t<i?i:n&&t>n?n:t)}function Me(t){return t.toString().padStart(2,"0")}function yt(t){const i=/(\d{2}):(\d{2})(?::(\d{2}))?$/.exec(t);return i?{hours:Number(i[1]),minutes:Number(i[2]),seconds:Number(i[3]??0)}:null}function sn(t,i,n,l,s){const o=s?`${Me(i)}:${Me(n)}:${Me(l)}`:`${Me(i)}:${Me(n)}`;return t.replace(/\d{2}:\d{2}(?::\d{2})?$/,o)}function pn(t,i){if(t<=0)return i;const n=Math.floor(t/864e5),l=`${Me(Math.floor(t%864e5/36e5))}:${Me(Math.floor(t%36e5/6e4))}:${Me(Math.floor(t%6e4/1e3))}`;return n>0?`${n}d ${l}`:l}function Jn(t,i){if(t<=0)return i;const n=Math.floor(t/864e5),l=Math.floor(t%864e5/36e5),s=Math.floor(t%36e5/6e4),o=Math.floor(t%6e4/1e3),d=[];return n&&d.push(`${n}d`),(n||l)&&d.push(`${l}h`),(n||l||s)&&d.push(`${s}m`),d.push(`${o}s`),d.join(" ")}function Qn(t,i){if(t<=0)return i;const n=Math.floor(t/1e3),l=Math.floor(n/3600),s=Math.floor(n%3600/60),o=n%60;return l>0?`${Me(l)}:${Me(s)}:${Me(o)}`:`${Me(s)}:${Me(o)}`}function Xn(t,i){if(t<=0)return i;const n=Math.floor(t/1e3),l=Math.floor(n/86400);if(l)return`${l}d`;const s=Math.floor(n/3600);if(s)return`${s}h`;const o=Math.floor(n/60);return o?`${o}m`:`${n}s`}function Wn(t,i){if(t<=0)return i;const n=Math.floor(t/1e3),l=Math.floor(n/86400),s=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),d=[];return l&&d.push(`${l} ${l===1?"day":"days"}`),s&&d.push(`${s} ${s===1?"hour":"hours"}`),o&&d.push(`${o} ${o===1?"minute":"minutes"}`),d.length?d.join(", "):"less than a minute"}const ea={verbose:pn,compact:Jn,short:Qn,minimal:Xn,words:Wn};function ta(t,i,n){const l=t?yt(t):null,{hours:s,minutes:o,seconds:d}=l??{hours:0,minutes:0,seconds:0},b=new Date(n);if(i!=null){const K=typeof i=="string"?new Date(i):new Date(i.getTime());if(!Number.isNaN(K.getTime()))return K.setHours(s,o,d,0),K}if(t&&/^\d{4}-\d{2}-\d{2}T/.test(t)){const K=new Date(t);if(!Number.isNaN(K.getTime()))return K}const N=new Date(b);return N.setHours(s,o,d,0),N.getTime()<=b.getTime()&&N.setDate(N.getDate()+1),N}function mt(t,i){if(!t)return"";const n=t.replace(/[^0-9]/g,""),l=qt(i);return n.slice(0,l)}function Xe(t,i,n){const l=Ot(t,n);let s=0;const o=Math.min(i,l.length);for(let d=0;d<o;d++)tt(t[d])&&s++;return Math.min(s,n.length)}function na(t,i,n){if(n<=0)return 0;const l=Ot(t,i);let s=0;for(let o=0;o<l.length;o++)if(tt(t[o])&&(s++,s===n)){let d=o+1;for(;d<l.length&&!tt(t[d]);)d++;return d}return l.length}const Ut=40;function aa(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const ia=({part:t,label:i,value:n,max:l,step:s,onPick:o,onStep:d,startHold:b,stopHold:N})=>{const K=a.useRef(null),se=a.useRef(!1),T=a.useRef(null),D=a.useRef(null),L=a.useMemo(()=>{const $=[],I=s>0?s:1;for(let A=0;A<=l;A+=I)$.push(A);return $},[l,s]),le=Math.max(0,Math.min(L.length-1,Math.round(n/(s>0?s:1)))),z=L.length,U=a.useMemo(()=>[...L,...L,...L],[L]),k=z+le,B=a.useRef(!1);a.useLayoutEffect(()=>{const $=K.current;if(!$)return;const I=k*Ut;if(Math.abs($.scrollTop-I)<1)return;const A=Math.abs($.scrollTop/Ut-k);se.current=!0,T.current&&(clearTimeout(T.current),T.current=null);const F=B.current&&A<=3&&!aa();$.scrollTo({top:I,behavior:F?"smooth":"instant"}),B.current=!0,D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{se.current=!1},380)},[k]),a.useEffect(()=>()=>{T.current&&clearTimeout(T.current),D.current&&clearTimeout(D.current)},[]);const de=()=>{se.current||(T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{const $=K.current;if(!$)return;const I=Math.round($.scrollTop/Ut),A=L[(I%z+z)%z];A!==n&&o(A)},110))},H=$=>{$.key==="ArrowUp"?($.preventDefault(),d(-1)):$.key==="ArrowDown"&&($.preventDefault(),d(1))},fe=$=>{const I=$.replace(/\D/g,"");if(!I)return;const A=Number(I.slice(-2));o(Math.max(0,Math.min(l,A)))},ce=$=>{K.current&&K.current.scrollBy({top:$.deltaY})};return e.jsxs("div",{className:"nice-datetime-popup__spinner",role:"group","aria-label":i,children:[e.jsx("div",{ref:K,className:"nice-datetime-popup__spin-column",role:"listbox",tabIndex:-1,"aria-label":i,"aria-activedescendant":`${t}-opt-${k}`,onScroll:de,children:U.map(($,I)=>e.jsx("button",{type:"button",id:`${t}-opt-${I}`,role:"option","aria-selected":I===k,className:`nice-datetime-popup__spin-item${I===k?" is-selected":""}`,onClick:()=>o($),tabIndex:-1,children:Me($)},I))}),e.jsxs("div",{className:"nice-datetime-popup__spin-center",onWheel:ce,children:[e.jsx("button",{type:"button",className:"nice-datetime-popup__spin-btn",onClick:()=>d(-1),onPointerDown:()=>b(()=>d(-1)),onPointerUp:N,onPointerLeave:N,"aria-label":`${i} -`,tabIndex:-1,children:e.jsx(g.oa,{name:"chevron-up",size:14})}),e.jsx("input",{className:"nice-datetime-popup__spin-value",inputMode:"numeric","aria-label":i,value:Me(n),onFocus:$=>$.currentTarget.select(),onChange:$=>fe($.target.value),onKeyDown:H}),e.jsx("button",{type:"button",className:"nice-datetime-popup__spin-btn",onClick:()=>d(1),onPointerDown:()=>b(()=>d(1)),onPointerUp:N,onPointerLeave:N,"aria-label":`${i} +`,tabIndex:-1,children:e.jsx(g.oa,{name:"chevron-down",size:14})})]})]})},sa=({hours:t,minutes:i,minuteStep:n,onChange:l,t:s})=>{const[o,d]=a.useState("hours"),b=a.useRef(null),N=100,K=78,se=52,T=62,D=65,L=18,le=t>=12?"PM":"AM",z=t%12===0?12:t%12,U=(f,m)=>{const _=(f-90)*Math.PI/180;return{x:N+m*Math.cos(_),y:N+m*Math.sin(_)}},k=f=>{const m=le==="PM"?f%12+12:f%12;l(m,i)},B=f=>{const m=n&&n>1?n:1,_=Math.round(f/m)*m%60;l(t,_)},de=f=>{if(f===le)return;const m=f==="PM"?t+12:t-12;l((m%24+24)%24,i)},H=f=>{const m=f.currentTarget.getBoundingClientRect(),_=(f.clientX-m.left)/m.width*200-N,te=(f.clientY-m.top)/m.height*200-N;let ne=Math.atan2(te,_)*180/Math.PI+90;return ne<0&&(ne+=360),{ang:ne,radius:Math.hypot(_,te)}},fe=(f,m)=>{if(f==="hours"){const _=Math.round(m/30)%12;k(_===0?12:_)}else B(Math.round(m/6)%60)},ce=f=>{const{ang:m,radius:_}=H(f);if(_<L)return;const te=_>D?"hours":"minutes";b.current=te,d(te),f.currentTarget.setPointerCapture?.(f.pointerId),fe(te,m)},$=f=>{const m=b.current;m&&fe(m,H(f).ang)},I=f=>{b.current&&(b.current=null,f.currentTarget.releasePointerCapture?.(f.pointerId))},A=Array.from({length:12},(f,m)=>m+1),F=n&&n>1?n:5,Y=[];for(let f=0;f<60;f+=F)Y.push(f);const R=n&&n>1?n:1,J=Math.round(i/R)*R%60,E=o==="hours",Q=U(z%12*30,K),ee=U(J*6,se);return e.jsxs("div",{className:"nice-datetime-popup__clock",children:[e.jsxs("div",{className:"nice-datetime-popup__clock-readout",children:[e.jsx("button",{type:"button",className:`nice-datetime-popup__clock-seg${o==="hours"?" nice-datetime-popup__clock-seg--active":""}`,onClick:()=>d("hours"),"aria-label":s("datetime.hours","Hours"),children:Me(z)}),e.jsx("span",{className:"nice-datetime-popup__clock-colon",children:":"}),e.jsx("button",{type:"button",className:`nice-datetime-popup__clock-seg${o==="minutes"?" nice-datetime-popup__clock-seg--active":""}`,onClick:()=>d("minutes"),"aria-label":s("datetime.minutes","Minutes"),children:Me(i)}),e.jsxs("div",{className:"nice-datetime-popup__clock-ampm",role:"group",children:[e.jsx("button",{type:"button",className:`nice-datetime-popup__clock-period${le==="AM"?" nice-datetime-popup__clock-period--active":""}`,onClick:()=>de("AM"),"aria-pressed":le==="AM",children:"AM"}),e.jsx("button",{type:"button",className:`nice-datetime-popup__clock-period${le==="PM"?" nice-datetime-popup__clock-period--active":""}`,onClick:()=>de("PM"),"aria-pressed":le==="PM",children:"PM"})]})]}),e.jsxs("svg",{viewBox:"0 0 200 200",className:"nice-datetime-popup__clock-face",onPointerDown:ce,onPointerMove:$,onPointerUp:I,onPointerCancel:I,role:"img","aria-label":s("datetime.clockMode","Analog clock"),children:[e.jsx("circle",{cx:N,cy:N,r:96,className:"nice-datetime-popup__clock-bg"}),Y.map(f=>{const m=U(f*6,T);return e.jsx("circle",{cx:m.x,cy:m.y,r:f===J?2.6:1.5,className:`nice-datetime-popup__clock-tick${f===J?" nice-datetime-popup__clock-tick--active":""}`},`tick-${f}`)}),e.jsx("line",{x1:N,y1:N,x2:Q.x,y2:Q.y,className:`nice-datetime-popup__clock-hand nice-datetime-popup__clock-hand--hour${E?" nice-datetime-popup__clock-hand--active":""}`}),e.jsx("line",{x1:N,y1:N,x2:ee.x,y2:ee.y,className:`nice-datetime-popup__clock-hand nice-datetime-popup__clock-hand--minute${E?"":" nice-datetime-popup__clock-hand--active"}`}),e.jsx("circle",{cx:Q.x,cy:Q.y,r:15,className:"nice-datetime-popup__clock-knob"}),e.jsx("circle",{cx:ee.x,cy:ee.y,r:12,className:"nice-datetime-popup__clock-knob nice-datetime-popup__clock-knob--minute"}),e.jsx("circle",{cx:N,cy:N,r:4,className:"nice-datetime-popup__clock-center"}),A.map(f=>{const m=U(f*30,K);return e.jsx("text",{x:m.x,y:m.y,className:`nice-datetime-popup__clock-num${f===z?" nice-datetime-popup__clock-num--active":""}`,textAnchor:"middle",dominantBaseline:"central",children:f},`h-${f}`)}),Y.map(f=>{const m=U(f*6,se);return e.jsx("text",{x:m.x,y:m.y,className:`nice-datetime-popup__clock-num nice-datetime-popup__clock-num--minute${f===J?" nice-datetime-popup__clock-num--active":""}`,textAnchor:"middle",dominantBaseline:"central",children:Me(f)},`m-${f}`)})]})]})},ht=a.forwardRef(({label:t,helperText:i,error:n,required:l,disabled:s,readOnly:o,size:d="md",name:b,id:N,className:K,style:se,accessMode:T,value:D,onChange:L,onBlur:le,onKeyDown:z,min:U,max:k,type:B,dateFormatPreset:de,submitOnEnter:H,onSubmit:fe,showKeyboardHints:ce,displayStyle:$,labelPlacement:I,errorPlacement:A,loading:F,labelWidth:Y,controlWidth:R,placeholder:J,clearable:E=!1,showPickerButton:Q=!0,displayLocale:ee,keyboardShortcuts:f=!0,showSeconds:m=!1,minuteStep:_=1,showNow:te=!1,hourFormat:ne="24",timeSelectorType:v="spinners",targetDate:h,onTargetChange:q,countdown:G=!1,countdownFormat:xe="verbose",formatCountdown:re,countdownLabel:ue,countdownInterval:j=1e3,countdownDoneText:W},X)=>{const Ne=g.rc("input",$),Ae=g.ac("input",$),P=g.Dc(T,N),ye=P==="hidden";P==="disabled"&&(s=!0),P==="readOnly"&&(o=!0);const{t:V}=g.Gt(),Te=g.bc(N),y=a.useRef(null),w=a.useRef(null),u=a.useRef(null),pe=a.useRef(null),[O,ae]=a.useState(!1),[C,Be]=a.useState(null),[Ye,Oe]=a.useState(""),[Fe,ie]=a.useState(v);a.useEffect(()=>{ie(v)},[v]);const qe=a.useContext(g.Er)?.portalTarget??(typeof document<"u"?document.body:null),{start:Ze,stop:nt}=g.hc(),Ge=de?Gn[de]:null,Ce=Ge?.inputType??B??"date",at=Ge?.localized??!1,M=ee??Kt(),p=a.useMemo(()=>qn(Ce,at,M,m),[Ce,at,M,m]),he=a.useMemo(()=>qt(p.isoTpl),[p.isoTpl]),[ze,Se]=a.useState(()=>{const r=mt(D,p.isoTpl);return ct(p.displayTpl,p.isoTpl,r)}),He=a.useRef(ze);a.useEffect(()=>{He.current=ze},[ze]);const Pe=a.useRef(D??""),Je=a.useRef(null);a.useEffect(()=>{const r=D??"";if(r===Pe.current)return;const x=mt(r,p.isoTpl),S=ct(p.displayTpl,p.isoTpl,x);Se(S),Pe.current=r},[D,p.displayTpl,p.isoTpl]),a.useEffect(()=>{const r=mt(D,p.isoTpl);Se(ct(p.displayTpl,p.isoTpl,r))},[p.displayTpl,p.isoTpl]),a.useEffect(()=>{if(Je.current==null)return;const r=Je.current;Je.current=null;const x=y.current;if(x&&document.activeElement===x)try{x.setSelectionRange(r,r)}catch{}});const _t=a.useMemo(()=>Ot(p.displayTpl,ze),[p.displayTpl,ze]),gt=J??p.placeholder,wt=Math.max(p.displayTpl.length+1,9),xt=g.Zc({enabled:H,onSubmit:fe}),Ee=a.useCallback((r,x)=>{const S=r.slice(0,he);He.current=S,Se(S),Je.current=na(p.displayTpl,S,Math.max(0,Math.min(S.length,x)));const ge=an(nn(p.displayTpl,p.isoTpl,S),U,k);ge!==Pe.current&&(Pe.current=ge,L?.(ge))},[L,p.displayTpl,p.isoTpl,he,U,k]),We=a.useCallback(r=>{const x=an(r,U,k),S=mt(x,p.isoTpl);Pe.current=x,Se(ct(p.displayTpl,p.isoTpl,S)),L?.(x)},[L,p.displayTpl,p.isoTpl,U,k]),et=Ce==="time"||Ce==="datetime-local",rt=a.useCallback(()=>nn(p.displayTpl,p.isoTpl,He.current),[p.displayTpl,p.isoTpl]),Tt=a.useCallback(()=>{if(s||o)return;const r=rt(),x=r?yt(r):null;if(!x)return;const S=x.hours>=12?x.hours-12:x.hours+12;We(sn(r,S,x.minutes,x.seconds,m))},[s,o,rt,We,m]),Dt=(()=>{const r=yt(D??"");return r&&r.hours>=12?"PM":"AM"})(),St=a.useCallback(r=>{if(xt(r),o||s){z?.(r);return}const x=r.key;if(r.ctrlKey||r.metaKey||r.altKey){z?.(r);return}if(et&&(x==="ArrowUp"||x==="ArrowDown")){const _e=rt(),we=_e?yt(_e):null;if(we){r.preventDefault();const be=x==="ArrowUp"?1:-1;let{minutes:Ie,seconds:Ve}=we;m?Ve=((Ve+be)%60+60)%60:Ie=((Ie+be*_)%60+60)%60,We(sn(_e,we.hours,Ie,Ve,m)),z?.(r);return}}const S=He.current;if(x==="Escape"&&S.length>0){r.preventDefault(),Ee("",0),z?.(r);return}if(f&&(p.isoTpl==="yyyy-MM-dd"||p.isoTpl==="yyyy-MM-ddTHH:mm"||p.isoTpl==="yyyy-MM")){const _e=be=>{const Ie=String(be.getFullYear()).padStart(4,"0"),Ve=String(be.getMonth()+1).padStart(2,"0"),pt=String(be.getDate()).padStart(2,"0");let ft="";if(p.isoTpl==="yyyy-MM")ft=`${Ie}-${Ve}`;else if(p.isoTpl==="yyyy-MM-dd")ft=`${Ie}-${Ve}-${pt}`;else{const xn=String(be.getHours()).padStart(2,"0"),bn=String(be.getMinutes()).padStart(2,"0");ft=`${Ie}-${Ve}-${pt}T${xn}:${bn}`}We(ft)},we=()=>{if(D&&/^\d{4}-\d{2}/.test(D)){const be=new Date(D);if(!Number.isNaN(be.getTime()))return be}return new Date};if(x==="t"||x==="T"){r.preventDefault(),_e(new Date),z?.(r);return}if(x==="+"||x==="="||x==="-"){r.preventDefault();const be=x==="-"?-1:1,Ie=we();Ie.setDate(Ie.getDate()+be),_e(Ie),z?.(r);return}if(x==="m"||x==="M"){r.preventDefault();const be=we();be.setMonth(be.getMonth()+(x==="M"?-1:1)),_e(be),z?.(r);return}if(x==="y"||x==="Y"){r.preventDefault();const be=we();be.setFullYear(be.getFullYear()+(x==="Y"?-1:1)),_e(be),z?.(r);return}}const ge=r.currentTarget,$e=ge.selectionStart??0,Ue=ge.selectionEnd??0;if(/^[0-9]$/.test(x)){r.preventDefault();const _e=Xe(p.displayTpl,$e,S),we=Xe(p.displayTpl,Ue,S),be=S.slice(0,_e),Ie=S.slice(we);let Ve=(be+x+Ie).slice(0,he);_e===we&&be.length+1+Ie.length>he&&(Ve=(be+x+Ie.slice(1)).slice(0,he)),Ee(Ve,_e+1),z?.(r);return}if(x==="Backspace"){if(r.preventDefault(),$e!==Ue){const _e=Xe(p.displayTpl,$e,S),we=Xe(p.displayTpl,Ue,S),be=S.slice(0,_e)+S.slice(we);Ee(be,_e)}else{const _e=Xe(p.displayTpl,$e,S);if(_e===0){z?.(r);return}const we=S.slice(0,_e-1)+S.slice(_e);Ee(we,_e-1)}z?.(r);return}if(x==="Delete"){if(r.preventDefault(),$e!==Ue){const _e=Xe(p.displayTpl,$e,S),we=Xe(p.displayTpl,Ue,S),be=S.slice(0,_e)+S.slice(we);Ee(be,_e)}else{const _e=Xe(p.displayTpl,$e,S);if(_e>=S.length){z?.(r);return}const we=S.slice(0,_e)+S.slice(_e+1);Ee(we,_e)}z?.(r);return}z?.(r)},[Ee,s,xt,z,o,p.displayTpl,p.isoTpl,he,f,D,et,rt,We,m,_]),[ot,bt]=a.useState(()=>Date.now());a.useEffect(()=>{if(!G)return;const r=window.setInterval(()=>bt(Date.now()),Math.max(100,j));return()=>window.clearInterval(r)},[G,j]);const c=a.useMemo(()=>ta(D,h,ot),[D,h,ot]),Z=a.useRef(0);a.useEffect(()=>{if(!q)return;const r=c.getTime();r!==Z.current&&(Z.current=r,q(c))},[c,q]);const oe=a.useMemo(()=>{if(!G)return null;const r=c.getTime()-ot;return re?re(r,c):(ea[xe]??pn)(r,W??V("datetime.countdownDone","Done"))},[G,c,ot,re,xe,W,V]),ve=a.useCallback(r=>{if(o||s)return;const x=r.clipboardData.getData("text");if(!x)return;r.preventDefault();const S=He.current,ge=x.replace(/[^0-9]/g,"");let $e;ge.length===he&&(x.includes("-")||x.includes("T"))?$e=ct(p.displayTpl,p.isoTpl,ge):$e=ge.slice(0,he);const Ue=r.currentTarget,_e=Ue.selectionStart??0,we=Ue.selectionEnd??0,be=Xe(p.displayTpl,_e,S),Ie=Xe(p.displayTpl,we,S),Ve=S.slice(0,be),pt=S.slice(Ie),ft=(Ve+$e+pt).slice(0,he);Ee(ft,Math.min(he,Ve.length+$e.length))},[Ee,s,o,p.displayTpl,p.isoTpl,he]),je=a.useCallback(r=>{const x=r;if(x.inputType==="insertText"||x.inputType==="insertCompositionText"||x.inputType==="insertFromComposition"){const S=x.data??"";if(!/^[0-9]+$/.test(S)){r.preventDefault();return}if(S.length>1){r.preventDefault();const ge=r.currentTarget,$e=ge.selectionStart??0,Ue=ge.selectionEnd??0,_e=He.current,we=Xe(p.displayTpl,$e,_e),be=Xe(p.displayTpl,Ue,_e),Ie=_e.slice(0,we),Ve=_e.slice(be),pt=(Ie+S+Ve).slice(0,he);Ee(pt,Math.min(he,Ie.length+S.length))}}},[Ee,p.displayTpl,he]),me=a.useCallback(r=>{if(o||s)return;const x=r.target.value,S=x.replace(/[^0-9]/g,"").slice(0,he);if(S!==He.current)if(S.length===he&&(x.includes("-")||x.includes("T")||x.includes(":"))){const ge=ct(p.displayTpl,p.isoTpl,S);Ee(ge,ge.length)}else Ee(S,S.length)},[Ee,s,o,p.displayTpl,p.isoTpl,he]),Re=a.useCallback(()=>{Ee("",0),requestAnimationFrame(()=>y.current?.focus())},[Ee]),De=a.useCallback(()=>{if(s||o)return;if(Ce==="date"||Ce==="datetime-local"||Ce==="time"){ae(S=>!S);return}const r=w.current;if(!r)return;const x=r;try{if(typeof x.showPicker=="function"){x.showPicker();return}}catch{}r.focus(),r.click()},[s,o,Ce]),Ke=a.useCallback(r=>{const x=r.target.value,S=mt(x,p.isoTpl),ge=ct(p.displayTpl,p.isoTpl,S);Pe.current=x,Se(ge),L?.(x),requestAnimationFrame(()=>y.current?.focus())},[L,p.displayTpl,p.isoTpl]),vt=a.useCallback(()=>{if(s||o)return;const r=new Date,x=we=>String(we).padStart(2,"0"),S=`${r.getFullYear()}-${x(r.getMonth()+1)}-${x(r.getDate())}`,ge=`${x(r.getHours())}:${x(r.getMinutes())}`,$e=m?`${ge}:${x(r.getSeconds())}`:ge;let Ue;Ce==="time"?Ue=$e:Ce==="datetime-local"?Ue=`${S}T${$e}`:Ce==="month"?Ue=`${r.getFullYear()}-${x(r.getMonth()+1)}`:Ue=S;const _e=mt(Ue,p.isoTpl);Pe.current=Ue,Se(ct(p.displayTpl,p.isoTpl,_e)),L?.(Ue)},[s,o,Ce,m,L,p.displayTpl,p.isoTpl]),it=Ce==="date"||Ce==="datetime-local",st=(()=>{const r=/^(\d{4}-\d{2}-\d{2})/.exec(D??"");return r?r[1]:""})(),Qe=yt(D??"")??{hours:0,minutes:0,seconds:0},lt=()=>{const r=new Date;return`${r.getFullYear()}-${Me(r.getMonth()+1)}-${Me(r.getDate())}`},dt=(r,x)=>{const S=m?`${Me(x.hours)}:${Me(x.minutes)}:${Me(x.seconds)}`:`${Me(x.hours)}:${Me(x.minutes)}`;let ge;Ce==="time"?ge=S:Ce==="datetime-local"?ge=`${r}T${S}`:ge=r,We(ge)},Rt=r=>{r&&dt(r,et?Qe:{hours:0,minutes:0,seconds:0})},ut=(r,x)=>{dt(it?st||lt():"",{...Qe,[r]:x})},Zt=r=>r==="hours"?23:59,Jt=r=>r==="minutes"&&_&&_>0?_:1,mn=(r,x)=>{const S=Zt(r),ge=Jt(r),$e=S+1,Ue=((Qe[r]+x*ge)%$e+$e)%$e;ut(r,Ue)},At=(r,x,S)=>e.jsx(ia,{part:r,label:V(x,S),value:Qe[r],max:Zt(r),step:Jt(r),onPick:ge=>ut(r,ge),onStep:ge=>mn(r,ge),startHold:Ze,stopHold:nt}),hn=()=>{dt(lt(),et?Qe:{hours:0,minutes:0,seconds:0})},Ct=(()=>{const r=lt(),x=U&&U.length>=10?U.slice(0,10):U,S=k&&k.length>=10?k.slice(0,10):k;return!!(x&&r<x||S&&r>S)})(),gn=()=>{ae(!1),requestAnimationFrame(()=>y.current?.focus())};a.useLayoutEffect(()=>{if(!O)return;const r=u.current?.getBoundingClientRect();r&&(Be({left:r.left,top:r.bottom+6}),Oe(jt.scopeThemeClass(u.current)))},[O]),a.useEffect(()=>{if(!O)return;const r=ge=>{const $e=ge.target;u.current?.contains($e)||pe.current?.contains($e)||ae(!1)},x=ge=>{ge.key==="Escape"&&ae(!1)},S=()=>{const ge=u.current?.getBoundingClientRect();ge&&Be({left:ge.left,top:ge.bottom+6})};return document.addEventListener("mousedown",r),document.addEventListener("keydown",x),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",x),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[O]);const yn=a.useCallback(r=>{y.current=r,typeof X=="function"?X(r):X&&(X.current=r)},[X]),Qt=a.useMemo(()=>{const r=[];return H&&r.push(g.Yc.submit),r.push({key:"Esc",description:V("shortcuts.clearDate","Clear value")}),r},[H,V]),_n=Ce==="time";return ye?null:e.jsxs("div",{className:`nice-field nice-field--${d}${I?` nice-field--label-${I}`:""}${A==="right"?" nice-field--error-right":""} ${F?"nice-field--loading":""} ${K||""}`,style:{...se,...Y!=null&&{"--nice-field-label-width":typeof Y=="number"?`${Y}px`:Y},...R!=null&&{"--nice-field-control-width":typeof R=="number"?`${R}px`:R}},"aria-busy":F||void 0,children:[t&&e.jsxs("label",{htmlFor:Te,className:`nice-field__label ${l?"nice-field__label--required":""}`,children:[t,ce&&Qt.length>0&&e.jsx(g.ha,{shortcuts:Qt,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{ref:u,className:`nice-input nice-input--date nice-input--${d} nice-input--ds-${Ae} ${n?"nice-input--error":""} ${s?"nice-input--disabled":""} ${o?"nice-input--readonly":""}`,style:{...Ne,width:"fit-content",position:"relative"},children:[e.jsx("input",{ref:yn,id:Te,className:"nice-input__native nice-masked-input",type:"text",name:b,value:_t,placeholder:gt,disabled:s||F,readOnly:o,autoComplete:"off",spellCheck:!1,inputMode:"numeric","aria-invalid":!!n,"aria-label":t?void 0:V("controls.date","Date"),"data-display-tpl":p.displayTpl,"data-iso-tpl":p.isoTpl,style:{width:`${wt}ch`,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontVariantNumeric:"tabular-nums"},onBeforeInput:je,onChange:me,onBlur:le,onKeyDown:St,onPaste:ve}),E&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:Re,disabled:!D||s||o,"aria-label":V("controls.clear","Clear"),tabIndex:D&&!s&&!o?0:-1,children:e.jsx(g.oa,{name:"close",size:14})}),Q&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"nice-input__picker-trigger",onClick:De,"aria-label":V("controls.openPicker","Open picker"),tabIndex:-1,disabled:s||o,children:_n?e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v5l3.5 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]}):e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",children:[e.jsx("rect",{x:"3.25",y:"4.5",width:"17.5",height:"16.5",rx:"2",stroke:"currentColor",strokeWidth:"1.7"}),e.jsx("line",{x1:"16",y1:"2.5",x2:"16",y2:"6.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"}),e.jsx("line",{x1:"8",y1:"2.5",x2:"8",y2:"6.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"}),e.jsx("line",{x1:"3.25",y1:"9.75",x2:"20.75",y2:"9.75",stroke:"currentColor",strokeWidth:"1.5"})]})}),e.jsx("input",{ref:w,type:Ce,className:"nice-input__picker-companion",value:D??"",min:U,max:k,step:Ce==="time"||Ce==="datetime-local"?m?1:_?_*60:void 0:void 0,onChange:Ke,tabIndex:-1,"aria-hidden":"true",style:{position:"absolute",width:0,height:0,opacity:0,pointerEvents:"none",border:0,padding:0,left:0,bottom:0}})]}),et&&ne==="12"&&!s&&!o&&e.jsx("button",{type:"button",className:"nice-input__ampm",onClick:Tt,disabled:!D,"aria-label":V("datetime.toggleAmPm","Toggle AM/PM"),tabIndex:-1,children:Dt}),te&&!s&&!o&&e.jsx("button",{type:"button",className:"nice-input__now",onClick:vt,tabIndex:-1,children:V("controls.now","Now")})]}),O&&C&&qe&&ln.createPortal(e.jsxs("div",{ref:pe,className:`nice-datetime-popup${Ye?` ${Ye}`:""}`,style:{position:"fixed",left:C.left,top:C.top,zIndex:1e3},role:"dialog","aria-label":V("controls.openPicker","Open picker"),children:[e.jsxs("div",{className:"nice-datetime-popup__body",children:[it&&e.jsx("div",{className:"nice-datetime-popup__col nice-datetime-popup__col--date",children:e.jsx(Vt,{value:st,onChange:Rt,min:U&&U.length>=10?U.slice(0,10):void 0,max:k&&k.length>=10?k.slice(0,10):void 0})}),et&&e.jsxs("div",{className:"nice-datetime-popup__col nice-datetime-popup__col--time",children:[e.jsxs("div",{className:"nice-datetime-popup__time-modes",role:"group","aria-label":V("datetime.timeSelector","Time selector"),children:[e.jsx("button",{type:"button",className:`nice-datetime-popup__mode-btn${Fe==="spinners"?" nice-datetime-popup__mode-btn--active":""}`,onClick:()=>ie("spinners"),"aria-pressed":Fe==="spinners","aria-label":V("datetime.spinnersMode","Spinner wheels"),title:V("datetime.spinnersMode","Spinner wheels"),tabIndex:-1,children:e.jsx(g.oa,{name:"list",size:16})}),e.jsx("button",{type:"button",className:`nice-datetime-popup__mode-btn${Fe==="clock"?" nice-datetime-popup__mode-btn--active":""}`,onClick:()=>ie("clock"),"aria-pressed":Fe==="clock","aria-label":V("datetime.clockMode","Analog clock"),title:V("datetime.clockMode","Analog clock"),tabIndex:-1,children:e.jsx(g.oa,{name:"clock",size:16})})]}),Fe==="clock"?e.jsx(sa,{hours:Qe.hours,minutes:Qe.minutes,minuteStep:_,onChange:(r,x)=>dt(it?st||lt():"",{...Qe,hours:r,minutes:x}),t:V}):e.jsxs("div",{className:"nice-datetime-popup__time",role:"group",children:[At("hours","datetime.hours","Hours"),e.jsx("span",{className:"nice-datetime-popup__time-sep",children:":"}),At("minutes","datetime.minutes","Minutes"),m&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nice-datetime-popup__time-sep",children:":"}),At("seconds","datetime.seconds","Seconds")]})]})]})]}),e.jsxs("div",{className:"nice-datetime-popup__footer",children:[E&&e.jsx("button",{type:"button",className:"nice-datetime-popup__btn",onClick:Re,children:V("controls.clear","Clear")}),it&&e.jsx("button",{type:"button",className:"nice-datetime-popup__btn",onClick:hn,disabled:Ct,"aria-disabled":Ct||void 0,children:V("controls.today","Today")}),et&&e.jsx("button",{type:"button",className:"nice-datetime-popup__btn",onClick:vt,disabled:Ct,"aria-disabled":Ct||void 0,children:V("controls.now","Now")}),e.jsx("button",{type:"button",className:"nice-datetime-popup__btn nice-datetime-popup__btn--primary",onClick:gn,children:V("controls.confirm","Confirm")})]})]}),qe),G&&oe!=null&&e.jsxs("span",{className:"nice-datetime__countdown","aria-live":"polite",children:[ue&&e.jsxs("span",{className:"nice-datetime__countdown-label",children:[ue," "]}),e.jsx("span",{className:"nice-datetime__countdown-value",children:oe})]}),F&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),A==="right"&&n&&e.jsx("div",{className:"nice-field__error",role:"alert",children:n}),A==="right"&&!n&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]}),A!=="right"&&n&&e.jsx("div",{className:"nice-field__error",role:"alert",children:n}),A!=="right"&&!n&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]})});ht.displayName="NiceDateTimePicker";const la=Object.freeze(Object.defineProperty({__proto__:null,NiceDateTimePicker:ht,getDefaultLocale:Kt},Symbol.toStringTag,{value:"Module"})),fn=({items:t,data:i,onFieldChange:n,onSubmit:l,dataSource:s,recordKey:o,columns:d=1,responsiveColumns:b,gap:N=16,labelPosition:K="top",size:se="md",readOnly:T,disabled:D,className:L,style:le,accessMode:z,id:U,autoSaveDelay:k,onDirtyChange:B,showActions:de,submitLabel:H="Submit",resetLabel:fe="Reset",onCancel:ce,cancelLabel:$="Cancel"})=>{const I=g.Dc(z,U),A=I==="hidden";I==="disabled"&&(D=!0),I==="readOnly"&&(T=!0);const F=g.kn(s??null,o),Y=!!s&&o!=null,R=Y?F.editData:i??{},[J]=a.useState(()=>({...R})),[E,Q]=a.useState([]),ee=a.useMemo(()=>Object.keys(R).some(y=>R[y]!==J[y]),[R,J]),f=a.useRef(!1);a.useEffect(()=>{ee!==f.current&&(f.current=ee,B?.(ee))},[ee,B]);const m=a.useRef(null),_=a.useCallback(()=>{k&&(m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{Y?F.save():l?.(R)},k))},[k,Y,F,l,R]),te=a.useCallback((y,w)=>{T||D||(Q(u=>[...u,{field:y,prev:R[y]}]),Y?F.set(y,w):n?.(y,w),_())},[Y,F,n,T,D,R,_]),ne=a.useCallback(()=>{if(E.length===0)return;const y=E[E.length-1];Q(w=>w.slice(0,-1)),Y?F.set(y.field,y.prev):n?.(y.field,y.prev)},[E,Y,F,n]),v=a.useCallback(y=>{y.preventDefault(),m.current&&clearTimeout(m.current),Y?F.save():l?.(R)},[R,l,Y,F]),h=a.useRef(null),[q,G]=a.useState(d);a.useEffect(()=>{if(!b||!h.current){G(d);return}const y=h.current,w=new ResizeObserver(u=>{const pe=u[0]?.contentRect.width??0,O=Object.keys(b).map(Number).sort((ae,C)=>C-ae);for(const ae of O)if(pe>=ae){G(b[ae]);return}G(d)});return w.observe(y),()=>w.disconnect()},[b,d]);const xe=a.useMemo(()=>t.filter(y=>!(y.visible===!1||y.visibleWhen&&!y.visibleWhen(R))),[t,R]),re=a.useMemo(()=>{const y=[];let w=null;for(const u of xe)!w||w.name!==u.group?(w={name:u.group,items:[u]},y.push(w)):w.items.push(u);return y},[xe]),ue=a.useCallback(y=>{const w=R[y.field]!==void 0?R[y.field]:y.defaultValue,u=C=>te(y.field,C);if(y.render)return y.render(w,u);const pe=y.type||"text",O=y.options?.map(C=>typeof C=="string"?{label:C,value:C}:{label:C.label,value:String(C.value)}),ae={size:se,disabled:D,readOnly:T};switch(pe){case"number":return e.jsx(Le.NiceNumberInput,{...ae,value:w??null,onChange:C=>u(C),required:y.required});case"currency":return e.jsx(Le.NiceNumberInput,{...ae,value:w??null,onChange:C=>u(C),required:y.required,precision:y.precision??2,step:y.step??100,suffix:y.unit??"PLN",formatPreset:"money"});case"textarea":return e.jsx($t,{...ae,value:w??"",onChange:C=>u(C),rows:3});case"address":return e.jsx(Yt,{...ae,value:w??{},onChange:C=>u(C),required:y.required,columns:y.columns??2});case"select":return e.jsx(jt.NiceSelect,{...ae,value:w??"",onChange:C=>u(C),options:O??[]});case"autocomplete":return e.jsx(cn,{...ae,value:w??"",onChange:C=>u(C),options:O??[],suggestions:(O??[]).map(C=>C.label)});case"radio":return e.jsx(zt,{...ae,value:w??"",onChange:C=>u(C),options:O??[]});case"checkbox":return e.jsx(Le.NiceCheckbox,{...ae,checked:!!w,onChange:C=>u(C),label:y.label});case"toggle":return e.jsx(Le.NiceToggle,{...ae,checked:!!w,onChange:C=>u(C)});case"date":return e.jsx(ht,{...ae,value:w??"",onChange:C=>u(C)});case"time":return e.jsx(ht,{...ae,dateFormatPreset:"time",value:w??"",onChange:C=>u(C)});case"datetime":return e.jsx(ht,{...ae,dateFormatPreset:"datetime-local",value:w??"",onChange:C=>u(C)});case"color":return e.jsx(Nt.NiceColorPicker,{...ae,value:w??"var(--text-primary, #000000)",onChange:C=>u(C)});case"slider":return e.jsx(kt,{...ae,value:typeof w=="number"?w:0,onChange:C=>u(C)});case"rating":return e.jsx(Mt,{...ae,value:typeof w=="number"?w:0,onChange:C=>u(C)});case"password":return e.jsx(Lt,{...ae,value:w??"",onChange:C=>u(C),required:y.required});case"phone":case"tel":return e.jsx(Le.NiceTextInput,{...ae,type:"tel",value:w??"",onChange:C=>u(C),required:y.required});case"country":return e.jsx(Gt,{...ae,value:w??"",onChange:C=>u(C)});case"tags":return e.jsx(on,{...ae,value:Array.isArray(w)?w:[],onChange:C=>u(C),options:O??[]});case"masked":return e.jsx(Ft,{...ae,value:w??"",mask:y.mask??"999-999-9999",onChange:C=>u(C)});case"file":return e.jsx(Ht,{...ae,onFilesSelected:C=>u(C)});case"email":return e.jsx(Le.NiceTextInput,{...ae,type:"email",value:w??"",onChange:C=>u(C),required:y.required});case"url":return e.jsx(Le.NiceTextInput,{...ae,type:"url",value:w??"",onChange:C=>u(C),required:y.required});default:return e.jsx(Le.NiceTextInput,{...ae,value:w??"",onChange:C=>u(C),required:y.required})}},[R,te,D,T,se]),j=y=>e.jsxs("div",{className:"nice-form__item",style:{gridColumn:y.colSpan?`span ${y.colSpan}`:void 0},children:[y.label&&e.jsxs("label",{className:"nice-form__label",children:[y.label,y.required&&e.jsx("span",{className:"nice-field__required",children:"*"})]}),e.jsx("div",{className:"nice-form__control",children:ue(y)}),y.hint&&e.jsx("div",{className:"nice-form__hint",children:y.hint})]},y.field),W={display:"grid",gridTemplateColumns:`repeat(${q}, 1fr)`,gap:N},X=re.some(y=>y.name!=null),Ne=a.useMemo(()=>{const y=new Set,w=[];for(const u of xe)u.tab&&!y.has(u.tab)&&(y.add(u.tab),w.push(u.tab));return w},[xe]),Ae=Ne.length>0,[P,ye]=a.useState("");a.useEffect(()=>{Ae&&!Ne.includes(P)&&ye(Ne[0])},[Ae,Ne,P]);const V=y=>{const w=[];let u=null;for(const O of y)!u||u.name!==O.group?(u={name:O.group,items:[O]},w.push(u)):u.items.push(O);return w.some(O=>O.name!=null)?w.map((O,ae)=>e.jsxs("fieldset",{className:O.name?"nice-form__group":"nice-form__group nice-form__group--no-title",children:[O.name&&e.jsx("legend",{className:"nice-form__group-title",children:O.name}),e.jsx("div",{style:W,children:O.items.map(j)})]},ae)):e.jsx("div",{style:W,children:y.map(j)})},Te=de?e.jsxs("div",{className:"nice-form__actions",children:[e.jsxs("div",{className:"nice-form__actions-left",children:[ce&&e.jsx(Nt.NiceButton,{type:"button",variant:"secondary",size:se,onClick:ce,children:$}),e.jsx(Nt.NiceButton,{type:"button",variant:"ghost",size:se,onClick:ne,disabled:E.length===0,children:fe})]}),e.jsx("div",{className:"nice-form__actions-right",children:e.jsx(Nt.NiceButton,{type:"submit",variant:"primary",size:se,children:H})})]}):null;return A?null:e.jsxs("form",{ref:h,className:`nice-form nice-form--label-${K}${ee?" nice-form--dirty":""} ${L||""}`,style:X||Ae?{...le}:{...W,...le},onSubmit:v,noValidate:!0,children:[Ae?e.jsx(Le.NiceTabs,{className:"nice-form__tabs",activeTab:P||Ne[0],onChange:ye,tabs:Ne.map(y=>({id:y,label:y,content:e.jsx("div",{className:"nice-form__tab-panel",children:V(xe.filter(w=>(w.tab??Ne[0])===y))})}))}):X?re.map((y,w)=>e.jsxs("fieldset",{className:y.name?"nice-form__group":"nice-form__group nice-form__group--no-title",children:[y.name&&e.jsx("legend",{className:"nice-form__group-title",children:y.name}),e.jsx("div",{style:W,children:y.items.map(j)})]},w)):xe.map(j),Te]})};fn.displayName="NiceForm";exports.COUNTRIES=un;exports.MASK_PRESETS=rn;exports.NiceAddress=Yt;exports.NiceAutocomplete=cn;exports.NiceCalendar=Vt;exports.NiceCountryPicker=Gt;exports.NiceDateTimePicker=ht;exports.NiceDateTimePicker$1=la;exports.NiceForm=fn;exports.NiceMaskedInput=Ft;exports.NicePasswordInput=Lt;exports.NiceRadioGroup=zt;exports.NiceRadioGroup$1=wn;exports.NiceRating=Mt;exports.NiceRating$1=Sn;exports.NiceSlider=kt;exports.NiceSlider$1=Rn;exports.NiceTagBox=on;exports.NiceTextArea=$t;exports.NiceTextArea$1=An;exports.NiceUpload=Ht;exports.getDefaultLocale=Kt;
|