@nice2dev/ui 1.4.13 → 1.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/dist/{NiceColorPicker-BLwYNSXJ.cjs → NiceColorPicker-79rkvaSk.cjs} +1 -1
  3. package/dist/NiceDataGrid-B1AOjgjm.cjs +10 -0
  4. package/dist/NiceForm-fmePSeA9.cjs +1 -0
  5. package/dist/{NiceHtmlEditor-BzECmDO3.cjs → NiceHtmlEditor-By7R1wRo.cjs} +1 -1
  6. package/dist/{NiceMention-CYRqPKGU.cjs → NiceMention-i7n2BoMw.cjs} +1 -1
  7. package/dist/{NiceModuleLifecyclePanel-CiYbPcHV.cjs → NiceModuleLifecyclePanel-DVHQuhc-.cjs} +1 -1
  8. package/dist/{NicePagination-BAxwqeEd.cjs → NicePagination-D9JguOl0.cjs} +1 -1
  9. package/dist/NicePivotGrid-B_7iQJys.cjs +2 -0
  10. package/dist/NiceSavedQueryPanel-ChY4HwpM.cjs +587 -0
  11. package/dist/{NiceScheduler-BqYiHPvz.cjs → NiceScheduler-B2DamQ_L.cjs} +1 -1
  12. package/dist/backup/NiceBackupScheduler.mjs +171 -119
  13. package/dist/charts/NiceOrganizationChart.mjs +159 -59
  14. package/dist/charts/orgChartExport.mjs +71 -0
  15. package/dist/charts/tidyTree.mjs +43 -0
  16. package/dist/charts-C3Q3r8Yz.cjs +918 -0
  17. package/dist/charts.cjs +1 -1
  18. package/dist/charts.d.ts +9 -0
  19. package/dist/{core-lazy-BQexApr7.cjs → core-lazy-ChKRuEPb.cjs} +1 -1
  20. package/dist/data/NiceDataGrid.mjs +301 -320
  21. package/dist/data/NiceRowEditDialog.mjs +57 -0
  22. package/dist/data/NiceTreeGrid.mjs +670 -551
  23. package/dist/data/NiceTreeView.mjs +222 -180
  24. package/dist/data/treeRowDrop.mjs +130 -0
  25. package/dist/data.cjs +1 -1
  26. package/dist/data.d.ts +68 -5
  27. package/dist/{devops-cgRBnZVX.cjs → devops-o6Zm0VKB.cjs} +3 -3
  28. package/dist/devops.cjs +1 -1
  29. package/dist/editors/forms/NiceForm.mjs +216 -167
  30. package/dist/editors/inputs/NiceUpload.mjs +238 -238
  31. package/dist/editors.cjs +1 -1
  32. package/dist/editors.d.ts +13 -1
  33. package/dist/feedback.cjs +1 -1
  34. package/dist/index.cjs +254 -254
  35. package/dist/index.d.ts +293 -8
  36. package/dist/index.mjs +980 -966
  37. package/dist/lazy.cjs +1 -1
  38. package/dist/lazy.d.ts +11 -1
  39. package/dist/navigation.cjs +1 -1
  40. package/dist/no-code/NiceDataMapper.mjs +398 -361
  41. package/dist/no-code-CN_q6TcB.cjs +331 -0
  42. package/dist/no-code.cjs +1 -1
  43. package/dist/no-code.d.ts +11 -1
  44. package/dist/style.css +1 -1
  45. package/dist/tools/NicePermissionMatrix.mjs +171 -138
  46. package/dist/tools/NiceRoleEditor.mjs +334 -297
  47. package/package.json +4 -4
  48. package/dist/NiceDataGrid-D3qRQSjy.cjs +0 -10
  49. package/dist/NiceForm-BWb4LTQJ.cjs +0 -1
  50. package/dist/NicePivotGrid-Cxu5PECg.cjs +0 -152
  51. package/dist/NiceSavedQueryPanel-BSZhE-_l.cjs +0 -587
  52. package/dist/charts-BzlvCCg9.cjs +0 -768
  53. package/dist/no-code-B1jzfUF5.cjs +0 -331
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),m=require("@nice2dev/ui-core"),n=require("react"),Ft=require("./NiceButton-DzCqkG5a.cjs"),_t=require("./pickerCommons-CwcCc8Qi.cjs"),cn=require("react-dom"),Je=require("./no-code-CN_q6TcB.cjs"),Tn=require("./NiceColorPicker-79rkvaSk.cjs"),Sn=require("./devops-o6Zm0VKB.cjs"),Dn=require("./core-lBFqvT0V.cjs");function Rn({text:t,query:i}){if(!i)return e.jsx(e.Fragment,{children:t});const a=t.toLowerCase().indexOf(i.toLowerCase());return a<0?e.jsx(e.Fragment,{children:t}):e.jsxs("span",{children:[t.slice(0,a),e.jsx("strong",{children:t.slice(a,a+i.length)}),t.slice(a+i.length)]})}const In=[],on=({options:t=In,value:i,defaultValue:a,onChange:o,minSearchLength:s=1,maxResults:r=10,onSearch:f,clearable:b,loading:w,multiple:D,renderOption:ie,highlightMatch:I=!0,showAll:M=!0,menuGap:re,label:Y,error:Z,helperText:U,required:$,disabled:ee,readOnly:Q,size:X="md",id:_e,className:ue,style:x,accessMode:O,showKeyboardHints:L,displayStyle:E,labelPlacement:ye,errorPlacement:ne,labelWidth:W,controlWidth:K})=>{m.useComponentDisplayStyle("input",E),m.useComponentDisplayClass("input",E);const A=m.useNiceAccessMode(O,_e),se=A==="hidden";(A==="disabled"||A==="readOnly")&&(ee=!0);const N=m.useControlId(_e),{t:h}=m.useNiceTranslation(),[u,V]=m.useControllableState({value:i,defaultValue:a,fallbackValue:D?[]:"",onChange:o,componentName:"NiceAutocomplete"}),R=n.useMemo(()=>D?Array.isArray(u)?u:u?[u]:[]:[],[u,D]),[y,j]=n.useState(()=>D||Array.isArray(u)?"":t.find(p=>String(p.value)===u)?.label??u??""),[C,ae]=n.useState(!1),F=n.useRef(null),[pe,H]=n.useState(-1),he=n.useRef(null),be=n.useRef(null),{popupRef:ge,coords:$e,ready:Ee,themeClass:je,portalTarget:le}=Je.useAnchoredPopup(C,F,()=>ae(!1)),P=n.useMemo(()=>{const p=[m.COMMON_SHORTCUTS.moveDown,m.COMMON_SHORTCUTS.moveUp,m.COMMON_SHORTCUTS.submit,m.COMMON_SHORTCUTS.cancel];return D&&p.push({key:"Backspace",description:h("shortcuts.removeLastTag","Remove last tag")}),p},[D,h]);n.useEffect(()=>{D||j(Array.isArray(u)?"":t.find(p=>String(p.value)===u)?.label??u??"")},[u,D,t]);const q=n.useMemo(()=>{if(y.length<s)return M?(f?t:[...t].sort((B,oe)=>B.label.localeCompare(oe.label))).slice(0,r):[];if(f)return t.slice(0,r);const p=y.toLowerCase();return t.filter(ce=>ce.label.toLowerCase().includes(p)).slice(0,r)},[t,y,s,r,f,M]),xe=n.useMemo(()=>{const p=new Map;for(const ce of q){const B=ce.group||"";p.has(B)||p.set(B,[]),p.get(B).push(ce)}return p},[q]),Fe=n.useCallback(p=>{Q||(j(p),ae(p.length>=s),H(0),f?.(p))},[s,f,Q]),z=n.useCallback(p=>{if(!Q)if(D){const ce=String(p.value),B=R.includes(ce)?R.filter(oe=>oe!==ce):[...R,ce];V(B),j("")}else j(p.label),V(String(p.value)),ae(!1)},[V,D,R,Q]),te=p=>{if(!Q){if(D&&p.key==="Backspace"&&!y&&R.length>0){V(R.slice(0,-1));return}if(!C&&(p.key==="ArrowDown"||p.key==="ArrowUp")){p.preventDefault(),ae(!0),H(0);return}if(C)if(p.key==="ArrowDown")p.preventDefault(),H(ce=>ce<0?0:Math.min(ce+1,q.length-1));else if(p.key==="ArrowUp")p.preventDefault(),H(ce=>ce<=0?q.length-1:ce-1);else if(p.key==="PageDown"||p.key==="PageUp"){p.preventDefault();const ce=p.key==="PageDown"?10:-10;H(B=>Math.max(0,Math.min(q.length-1,Math.max(B,0)+ce)))}else(p.key==="Enter"||p.key==="Tab")&&pe>=0&&pe<q.length?(p.preventDefault(),z(q[pe])):p.key==="Escape"&&ae(!1)}},Oe=n.useCallback(p=>{Q||V(R.filter(ce=>ce!==p))},[R,V,Q]),ze=n.useId(),qe=`${ze}-listbox`,Re=p=>`${ze}-opt-${p}`,g=C&&q.length>0,T=g&&pe>=0&&pe<q.length?Re(pe):void 0;return n.useLayoutEffect(()=>{T&&document.getElementById(T)?.scrollIntoView?.({block:"nearest"})},[T]),m.useIntent(["navigate","activate"],p=>{if(p.source==="keyboard"||Q)return!1;if(p.intent==="activate"){const B=q[pe];if(!B)return!1;z(B);return}if(p.direction!=="up"&&p.direction!=="down")return!1;const ce=p.direction==="down"?1:-1;H(B=>Math.max(0,Math.min(q.length-1,B+ce)))},{ref:F,enabled:g}),se?null:e.jsxs("div",{className:`nice-field nice-field--${X} ${ye==="left"?"nice-field--label-left":""} ${w?"nice-field--loading":""} ${ue||""}`,style:{...x,...W!=null&&{"--nice-field-label-width":typeof W=="number"?`${W}px`:W},...K!=null&&{"--nice-field-control-width":typeof K=="number"?`${K}px`:K},...re!=null&&{"--nice-dropdown-gap":`${re}px`}},ref:he,"aria-busy":w||void 0,children:[Y&&e.jsxs("label",{className:`nice-field__label ${$?"nice-field__label--required":""}`,htmlFor:N,children:[Y,L&&e.jsx(m.NiceKeyboardHint,{shortcuts:P,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",style:{position:"relative"},children:[e.jsx("div",{ref:F,className:`nice-input nice-input--autocomplete nice-input--${X} ${Z?"nice-input--error":""} ${ee?"nice-input--disabled":""}`,children:e.jsxs("div",{className:"nice-field__input-wrap",style:{display:"flex",flexWrap:D?"wrap":"nowrap",gap:4,alignItems:"center",flex:1,minWidth:0},children:[D&&R.map(p=>{const ce=t.find(B=>String(B.value)===p);return e.jsxs("span",{className:"nice-autocomplete__tag",children:[ce?.label||p,!Q&&e.jsx("button",{type:"button",className:"nice-autocomplete__tag-remove",onClick:()=>Oe(p),"aria-label":h("controls.remove","Remove"),children:e.jsx(m.NiceIcon,{name:"close",size:14})})]},p)}),e.jsx("input",{ref:be,id:N,type:"text",className:"nice-input__native",value:y,onChange:p=>Fe(p.target.value),onFocus:()=>!Q&&(M||y.length>=s)&&ae(!0),onKeyDown:te,disabled:ee,readOnly:Q,required:$,role:"combobox","aria-expanded":g,"aria-autocomplete":"list","aria-controls":g?qe:void 0,"aria-activedescendant":T,autoComplete:"off",style:{flex:1,minWidth:60,border:"none",outline:"none",background:"transparent",color:"inherit",padding:0,font:"inherit"}}),b&&!D&&y&&!ee&&!Q&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:()=>{j(""),V("")},"aria-label":h("controls.clear","Clear"),children:e.jsx(m.NiceIcon,{name:"close",size:14})})]})}),C&&q.length>0&&$e&&le&&cn.createPortal(e.jsx("ul",{ref:ge,className:`nice-dropdown__list${je?` ${je}`:""}`,"data-theme":je==="nice-dark"?"dark":je==="nice-light"?"light":void 0,role:"listbox",id:qe,"aria-multiselectable":D||void 0,style:{position:"fixed",left:$e.left,top:$e.top,width:$e.width,minWidth:$e.width,zIndex:1e3,opacity:Ee?1:0,pointerEvents:Ee?void 0:"none"},children:Array.from(xe.entries()).map(([p,ce])=>e.jsxs(n.Fragment,{children:[p&&e.jsx("li",{className:"nice-dropdown__group-label",children:p}),ce.map(B=>{const oe=q.indexOf(B),Se=oe===pe,k=D&&R.includes(String(B.value));return e.jsx("li",{id:Re(oe),role:"option",className:`nice-dropdown__option ${Se?"nice-dropdown__option--active":""} ${k?"nice-dropdown__option--selected":""}`,onMouseDown:Ce=>{Ce.preventDefault(),z(B)},"aria-selected":D?k:Se,children:ie?ie(B,y):I?e.jsx(Rn,{text:B.label,query:y}):B.label},String(B.value))})]},p))}),le),w&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),ne==="right"&&Z&&e.jsx("div",{id:`${N}-error`,className:"nice-field__error",role:"alert",children:Z}),ne==="right"&&!Z&&U&&e.jsx("div",{id:`${N}-helper`,className:"nice-field__helper",children:U})]}),ne!=="right"&&Z&&e.jsx("div",{id:`${N}-error`,className:"nice-field__error",role:"alert",children:Z}),ne!=="right"&&!Z&&U&&e.jsx("div",{id:`${N}-helper`,className:"nice-field__helper",children:U})]})},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 An(t){return[...t].map(i=>i==="9"?{type:"digit"}:i==="a"?{type:"letter"}:i==="*"?{type:"alphanum"}:{type:"literal",literal:i})}function Un(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 tn(t,i,a){let o=0,s="";for(const r of i)r.type==="literal"?s+=r.literal:o<t.length?(s+=t[o],o++):s+=a;return s}function En(t,i){return t.map(a=>a.type==="literal"?a.literal:i).join("")}const dn=Object.assign(n.forwardRef(({label:t,helperText:i,error:a,required:o,disabled:s,readOnly:r,size:f="md",name:b,id:w,className:D,style:ie,value:I="",onChange:M,onBlur:re,onKeyDown:Y,mask:Z,maskPreset:U,maskChar:$="_",placeholder:ee,showMaskAsPlaceholder:Q=!0,clearable:X=!1,autoFocus:_e,labelPlacement:ue,errorPlacement:x,loading:O,labelWidth:L,controlWidth:E,...ye},ne)=>{const{t:W}=m.useNiceTranslation(),K=m.useControlId(w),A=n.useRef(null),[se,N]=n.useState(!1),h=Z||(U?rn[U]:"")||"999",u=n.useMemo(()=>An(h),[h]),V=n.useMemo(()=>tn(I,u,$),[I,u,$]),R=se||I?V:"",y=ee??(Q?En(u,$):void 0),j=n.useCallback(be=>{A.current=be,typeof ne=="function"?ne(be):ne&&(ne.current=be)},[ne]),C=n.useCallback(be=>{const ge=tn(be,u,$);M?.(be,ge)},[M,u,$]),ae=n.useCallback(be=>{const ge=be.currentTarget,$e=ge.value,Ee=ge.selectionStart??$e.length;let je="",le=0;for(let P=0;P<$e.length&&le<u.length;P++){const q=$e[P];for(;le<u.length&&u[le].type==="literal";)le++;if(le>=u.length)break;Un(q,u[le])&&(je+=q,le++)}C(je),requestAnimationFrame(()=>{let P=0,q=0;for(let xe=0;xe<u.length;xe++){if(u[xe].type==="literal")P=xe+1;else if(q<je.length)q++,P=xe+1;else{P=xe;break}if(P>=Ee&&q>=je.length)break}q>=je.length&&je.length>0&&(P=Math.min(P,u.length)),ge.setSelectionRange(P,P)})},[u,C]),F=n.useCallback(be=>{if(be.key==="Backspace"&&I.length>0){be.preventDefault();const ge=I.slice(0,-1);C(ge)}Y?.(be)},[I,C,Y]),pe=n.useCallback(()=>N(!0),[]),H=n.useCallback(be=>{N(!1),re?.(be)},[re]),he=n.useCallback(()=>{C(""),A.current?.focus()},[C]);return e.jsxs("div",{className:`nice-field nice-field--masked nice-field--${f} ${ue==="left"?"nice-field--label-left":""} ${O?"nice-field--loading":""} ${D||""}`,style:{...ie,...L!=null&&{"--nice-field-label-width":typeof L=="number"?`${L}px`:L},...E!=null&&{"--nice-field-control-width":typeof E=="number"?`${E}px`:E}},"aria-busy":O||void 0,children:[t&&e.jsx("label",{htmlFor:K,className:`nice-field__label ${o?"nice-field__label--required":""}`,children:t}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{className:`nice-input nice-input--${f} ${a?"nice-input--error":""} ${s?"nice-input--disabled":""} ${r?"nice-input--readonly":""}`,style:{width:"fit-content",minWidth:0},children:[e.jsx("input",{ref:j,id:K,className:"nice-input__native nice-masked-input",type:"text",name:b,value:R,placeholder:y,disabled:s||O,readOnly:r,autoFocus:_e,style:{width:`${h.length}ch`,minWidth:0,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontVariantNumeric:"tabular-nums"},"aria-invalid":!!a,"aria-describedby":a?`${K}-error`:i?`${K}-helper`:void 0,onInput:ae,onChange:()=>{},onKeyDown:F,onFocus:pe,onBlur:H,...ye}),X&&I&&e.jsx("button",{type:"button",className:"nice-input__clear",disabled:s||r,onClick:he,"aria-label":W("controls.clear","Clear"),children:e.jsx(m.NiceIcon,{name:"close",size:14})})]}),O&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),x==="right"&&a&&e.jsx("div",{id:`${K}-error`,className:"nice-field__error",role:"alert",children:a}),x==="right"&&!a&&i&&e.jsx("div",{id:`${K}-helper`,className:"nice-field__helper",children:i})]}),x!=="right"&&a&&e.jsx("div",{id:`${K}-error`,className:"nice-field__error",role:"alert",children:a}),x!=="right"&&!a&&i&&e.jsx("div",{id:`${K}-helper`,className:"nice-field__helper",children:i})]})}),{displayName:"NiceMaskedInput"}),Fn=[{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 Ln(t,i){if(!t)return{level:"none",passed:[],ratio:0};const a=i.filter(f=>f.test(t)).map(f=>f.id),o=a.length/i.length,s=i.some(f=>f.required&&!a.includes(f.id))?0:o;let r="weak";return s>=1?r="strong":s>=.75?r="good":s>=.5&&(r="fair"),{level:r,passed:a,ratio:o}}const un=Object.assign(n.forwardRef(({label:t,helperText:i,error:a,required:o,disabled:s,readOnly:r,size:f="md",name:b,id:w,className:D,style:ie,value:I="",onChange:M,onBlur:re,onKeyDown:Y,placeholder:Z,maxLength:U,showToggle:$=!0,showStrength:ee=!1,strengthRules:Q,validationPlacement:X="bottom",autoFocus:_e,autoComplete:ue,labelPlacement:x,errorPlacement:O,loading:L,labelWidth:E,controlWidth:ye,...ne},W)=>{const{t:K}=m.useNiceTranslation(),A=m.useControlId(w),[se,N]=n.useState(!1),h=Q??Fn,u=n.useMemo(()=>ee?Ln(I,h):null,[ee,I,h]),V=n.useCallback(()=>N(y=>!y),[]),R=ee&&u&&I?e.jsxs("div",{className:`nice-password__strength ${X==="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--${u.level}`,style:{width:`${u.ratio*100}%`}})}),e.jsx("span",{className:`nice-password__strength-label nice-password__strength-label--${u.level}`,children:K(`password.strength.${u.level}`,u.level.charAt(0).toUpperCase()+u.level.slice(1))}),e.jsx("ul",{className:"nice-password__rules",children:h.map(y=>{const j=u.passed.includes(y.id);return e.jsxs("li",{className:`nice-password__rule ${j?"nice-password__rule--passed":""}`,children:[e.jsx("span",{className:"nice-password__rule-icon",children:e.jsx(m.NiceIcon,{name:j?"check":"close",size:14})}),y.label]},y.id)})})]}):null;return e.jsxs("div",{className:`nice-field nice-field--${f} ${x==="left"?"nice-field--label-left":""} ${L?"nice-field--loading":""} ${D||""}`,style:{...ie,...E!=null&&{"--nice-field-label-width":typeof E=="number"?`${E}px`:E},...ye!=null&&{"--nice-field-control-width":typeof ye=="number"?`${ye}px`:ye}},"aria-busy":L||void 0,children:[t&&e.jsx("label",{htmlFor:A,className:`nice-field__label ${o?"nice-field__label--required":""}`,style:X==="right"&&x==="left"?{alignSelf:"flex-start",paddingTop:6}:void 0,children:t}),e.jsxs("div",{className:"nice-field__control",style:X==="right"?{alignItems:"flex-start"}:void 0,children:[e.jsxs("div",{className:"nice-password-input__stack",style:X==="right"?{display:"flex",flexDirection:"column",flex:"1 1 auto",minWidth:0}:{display:"contents"},children:[e.jsxs("div",{className:`nice-input nice-input--${f} ${a?"nice-input--error":""} ${s?"nice-input--disabled":""} ${r?"nice-input--readonly":""}`,children:[e.jsx("input",{ref:W,id:A,className:"nice-input__native",type:se?"text":"password",name:b,value:I,placeholder:Z,disabled:s||L,readOnly:r,maxLength:U,autoFocus:_e,autoComplete:ue,"aria-invalid":!!a,"aria-describedby":a?`${A}-error`:i?`${A}-helper`:void 0,onChange:y=>M?.(y.target.value),onBlur:re,onKeyDown:Y,...ne}),$&&e.jsx("button",{type:"button",className:"nice-password__toggle",onClick:V,disabled:s,"aria-label":se?K("password.hide","Hide password"):K("password.show","Show password"),children:e.jsx(m.NiceIcon,{name:se?"eye-off":"eye",size:18})})]}),X==="right"&&O!=="right"&&a&&e.jsx("div",{id:`${A}-error`,className:"nice-field__error",role:"alert",children:a}),X==="right"&&O!=="right"&&!a&&i&&e.jsx("div",{id:`${A}-helper`,className:"nice-field__helper",children:i})]}),L&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),X==="right"&&R,O==="right"&&a&&e.jsx("div",{id:`${A}-error`,className:"nice-field__error",role:"alert",children:a}),O==="right"&&!a&&i&&e.jsx("div",{id:`${A}-helper`,className:"nice-field__helper",children:i})]}),X!=="right"&&R,X!=="right"&&O!=="right"&&a&&e.jsx("div",{id:`${A}-error`,className:"nice-field__error",role:"alert",children:a}),X!=="right"&&O!=="right"&&!a&&i&&e.jsx("div",{id:`${A}-helper`,className:"nice-field__helper",children:i})]})}),{displayName:"NicePasswordInput"}),Pn=[],Yt=({label:t,helperText:i,error:a,required:o,disabled:s,size:r="md",name:f,id:b,className:w,style:D,accessMode:ie,options:I=Pn,value:M,onChange:re,direction:Y="horizontal",showKeyboardHints:Z,displayStyle:U,labelPlacement:$,errorPlacement:ee,labelWidth:Q,controlWidth:X,loading:_e,readOnly:ue})=>{m.useComponentDisplayClass("toggle",U);const x=m.useNiceAccessMode(ie,b),O=x==="hidden";(x==="disabled"||x==="readOnly")&&(s=!0);const{t:L}=m.useNiceTranslation(),E=m.useControlId(b),ye=f||E,ne=n.useMemo(()=>[{key:"ArrowUp",description:L("shortcuts.previousOption","Previous option")},{key:"ArrowDown",description:L("shortcuts.nextOption","Next option")},{key:"Space",description:L("shortcuts.select","Select")}],[L]);return O?null:e.jsxs("div",{className:`nice-field nice-field--inline nice-field--inline-block nice-field--${r} ${$==="left"?"nice-field--label-left":""} ${ee==="right"?"nice-field--error-right":""} ${_e?"nice-field--loading":""} ${w||""}`,style:{...D,...Q!=null&&{"--nice-field-label-width":typeof Q=="number"?`${Q}px`:Q},...X!=null&&{"--nice-field-control-width":typeof X=="number"?`${X}px`:X}},role:"radiogroup","aria-labelledby":`${E}-label`,"aria-busy":_e||void 0,children:[t&&e.jsxs("span",{id:`${E}-label`,className:`nice-field__label ${o?"nice-field__label--required":""}`,children:[t,Z&&e.jsx(m.NiceKeyboardHint,{shortcuts:ne,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsx("div",{className:`nice-radio-group ${Y==="vertical"?"nice-radio-group--vertical":""}`,children:I.map(W=>e.jsxs("label",{className:`nice-radio ${s||W.disabled||_e?"nice-radio--disabled":""} ${ue?"nice-radio--readonly":""}`,children:[e.jsx("input",{type:"radio",className:"nice-radio__input",name:ye,value:W.value,checked:M===W.value,disabled:s||W.disabled||_e,"aria-readonly":ue||void 0,onChange:()=>{ue||re?.(W.value)}}),e.jsx("span",{className:"nice-radio__circle",children:e.jsx("span",{className:"nice-radio__dot"})}),e.jsx("span",{children:W.label})]},W.value))}),_e&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),ee==="right"&&a&&e.jsx("div",{id:`${E}-error`,className:"nice-field__error",role:"alert",children:a}),ee==="right"&&!a&&i&&e.jsx("div",{id:`${E}-helper`,className:"nice-field__helper",children:i})]}),ee!=="right"&&a&&e.jsx("div",{id:`${E}-error`,className:"nice-field__error",role:"alert",children:a}),ee!=="right"&&!a&&i&&e.jsx("div",{id:`${E}-helper`,className:"nice-field__helper",children:i})]})},On=Object.freeze(Object.defineProperty({__proto__:null,NiceRadioGroup:Yt},Symbol.toStringTag,{value:"Module"})),Hn=({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"})]}),zn={xxs:10,xs:14,sm:18,md:22,lg:28,xl:34,xxl:42,small:18,medium:22,large:28},Kt=Object.assign(n.forwardRef(({value:t=0,onChange:i,count:a=5,half:o=!1,readOnly:s=!1,disabled:r=!1,size:f="md",label:b,icon:w,name:D,error:ie,helperText:I,required:M,id:re,className:Y,style:Z,labelPlacement:U,errorPlacement:$,labelWidth:ee,controlWidth:Q,valuePlacement:X="none",valueTemplate:_e,loading:ue,...x},O)=>{const{t:L}=m.useNiceTranslation(),E=m.useControlId(re),[ye,ne]=n.useState(null),W=zn[f],K=!s&&!r&&!ue,A=ye??t,se=y=>A>=y+1?"full":o&&A>=y+.5?"half":"empty",N=n.useCallback((y,j)=>{if(!K)return;const C=j&&o?y+.5:y+1;i?.(C===t?0:C)},[K,o,i,t]),h=n.useCallback((y,j)=>{if(K)if(o){const C=j.currentTarget.getBoundingClientRect(),ae=j.clientX-C.left<C.width/2;ne(ae?y+.5:y+1)}else ne(y+1)},[K,o]),u=n.useCallback(()=>{K&&ne(null)},[K]),V=n.useCallback(y=>{if(!K)return;const j=o?.5:1;if(y.key==="ArrowRight"||y.key==="ArrowUp"){y.preventDefault();const C=Math.min(a,t+j);i?.(C)}else if(y.key==="ArrowLeft"||y.key==="ArrowDown"){y.preventDefault();const C=Math.max(0,t-j);i?.(C)}else if(y.key==="Home"||y.key==="End")y.preventDefault(),i?.(y.key==="Home"?0:a);else if(y.key==="PageUp"||y.key==="PageDown"){y.preventDefault();const C=t+(y.key==="PageUp"?1:-1);i?.(Math.max(0,Math.min(a,C)))}},[K,o,a,t,i]),R=_e?_e.replace("{value}",String(t)):String(t);return e.jsxs("div",{className:`nice-field nice-field--${f} ${U==="left"?"nice-field--label-left":""} ${ue?"nice-field--loading":""} ${Y||""}`,style:{...Z,...ee!=null&&{"--nice-field-label-width":typeof ee=="number"?`${ee}px`:ee},...Q!=null&&{"--nice-field-control-width":typeof Q=="number"?`${Q}px`:Q}},"aria-busy":ue||void 0,...x,children:[b&&e.jsx("label",{htmlFor:E,className:`nice-field__label ${M?"nice-field__label--required":""}`,children:b}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{ref:O,id:E,className:`nice-rating nice-rating--${f} ${r?"nice-rating--disabled":""} ${s?"nice-rating--readonly":""}`,role:"slider","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":a,"aria-label":b||L("controls.rating","Rating"),"aria-invalid":!!ie,tabIndex:K?0:-1,onMouseLeave:u,onKeyDown:V,children:[D&&e.jsx("input",{type:"hidden",name:D,value:t}),Array.from({length:a},(y,j)=>{const C=se(j);return e.jsx("span",{role:"presentation",className:`nice-rating__star nice-rating__star--${C}`,onClick:ae=>{if(!K)return;const F=ae.currentTarget.getBoundingClientRect(),pe=o&&ae.clientX-F.left<F.width/2;N(j,pe)},onMouseMove:ae=>h(j,ae),"aria-label":`${j+1} ${L("controls.star","star")}`,children:w?w(C):e.jsx(Hn,{filled:C,size:W})},j)}),ue&&e.jsx("span",{className:"nice-rating__loading",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})})]}),X==="right"&&!ue&&e.jsx("span",{className:"nice-rating__value",children:R}),X==="bottom"&&!ue&&e.jsx("div",{className:"nice-rating__value nice-rating__value--bottom",children:R}),$==="right"&&ie&&e.jsx("div",{id:`${E}-error`,className:"nice-field__error",role:"alert",children:ie}),$==="right"&&!ie&&I&&e.jsx("div",{id:`${E}-helper`,className:"nice-field__helper",children:I})]}),$!=="right"&&ie&&e.jsx("div",{id:`${E}-error`,className:"nice-field__error",role:"alert",children:ie}),$!=="right"&&!ie&&I&&e.jsx("div",{id:`${E}-helper`,className:"nice-field__helper",children:I})]})}),{displayName:"NiceRating"}),Bn=Object.freeze(Object.defineProperty({__proto__:null,NiceRating:Kt},Symbol.toStringTag,{value:"Module"})),Vt=Object.assign(n.forwardRef(({label:t,helperText:i,error:a,required:o,disabled:s,id:r,className:f,style:b,accessMode:w,value:D=0,onChange:ie,min:I=0,max:M=100,step:re=1,showValue:Y=!0,showMinMax:Z=!1,formatValue:U,showKeyboardHints:$,displayStyle:ee,size:Q="md",labelPlacement:X,errorPlacement:_e,labelWidth:ue,controlWidth:x,loading:O,showTicks:L=!1,tickInterval:E,maxTicks:ye=21,showTickLabels:ne=!1},W)=>{m.useComponentDisplayClass("input",ee);const K=m.useNiceAccessMode(w,r),A=K==="hidden";(K==="disabled"||K==="readOnly")&&(s=!0);const{t:se}=m.useNiceTranslation(),N=m.useControlId(r),h=n.useMemo(()=>(D-I)/(M-I)*100,[D,I,M]),u=U?U(D):D.toString(),V=n.useMemo(()=>{if(!L)return[];const j=M-I;if(j<=0)return[I,M];let C=E??re,ae=Math.floor(j/C)+1;return ae>ye&&(C=j/(ye-1),ae=ye),Array.from({length:ae},(F,pe)=>{const H=I+pe*C;return pe===ae-1?M:H})},[L,I,M,re,E,ye]),R=n.useMemo(()=>[m.COMMON_SHORTCUTS.increment,m.COMMON_SHORTCUTS.decrement,m.COMMON_SHORTCUTS.first,m.COMMON_SHORTCUTS.last,m.COMMON_SHORTCUTS.incrementBig,m.COMMON_SHORTCUTS.decrementBig],[]),y=X==="left";return A?null:e.jsxs("div",{className:`nice-field nice-field--${Q} ${y?"nice-field--label-left":""} ${O?"nice-field--loading":""} ${f||""}`,style:{...b,...ue!=null&&{"--nice-field-label-width":typeof ue=="number"?`${ue}px`:ue},...x!=null&&{"--nice-field-control-width":typeof x=="number"?`${x}px`:x}},"aria-busy":O||void 0,children:[y?t&&e.jsxs("label",{htmlFor:N,className:`nice-field__label ${o?"nice-field__label--required":""}`,children:[t,$&&e.jsx(m.NiceKeyboardHint,{shortcuts:R,size:"sm"})]}):(t||Y||$)&&e.jsxs("div",{className:"nice-slider__header",children:[t?e.jsxs("label",{htmlFor:N,className:`nice-field__label ${o?"nice-field__label--required":""}`,children:[t,$&&e.jsx(m.NiceKeyboardHint,{shortcuts:R,size:"sm"})]}):e.jsx("span",{}),Y&&e.jsx("span",{className:"nice-slider__value nice-slider__value--header",children:u})]}),e.jsxs("div",{className:"nice-field__control nice-field__control--slider",children:[e.jsxs("div",{className:`nice-slider ${s||O?"nice-slider--disabled":""} ${L?"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:`${h}%`}})}),L&&V.length>0&&e.jsx("div",{className:"nice-slider__ticks","aria-hidden":"true",children:V.map((j,C)=>{const ae=(j-I)/(M-I)*100,F=j<=D;return e.jsx("span",{className:`nice-slider__tick ${F?"nice-slider__tick--active":""}`,style:{left:`${ae}%`},children:ne&&e.jsx("span",{className:"nice-slider__tick-label",children:U?U(j):j})},C)})}),e.jsx("input",{ref:W,id:N,type:"range",className:"nice-slider__native",min:I,max:M,step:re,value:D,disabled:s||O,"aria-valuenow":D,"aria-valuemin":I,"aria-valuemax":M,onChange:j=>ie?.(parseFloat(j.target.value))}),e.jsx("div",{className:"nice-slider__thumb-visual",style:{left:`${h}%`}})]}),Z&&e.jsxs("div",{className:"nice-slider__labels",children:[e.jsx("span",{children:U?U(I):I}),e.jsx("span",{children:U?U(M):M})]})]}),y&&Y&&e.jsx("span",{className:"nice-slider__value nice-slider__value--inline",children:u}),O&&e.jsx("span",{className:"nice-field__spinner nice-field__spinner--slider",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),_e==="right"&&a&&e.jsx("div",{className:"nice-field__error nice-field__error--slider",role:"alert",children:a}),_e==="right"&&!a&&i&&e.jsx("div",{className:"nice-field__helper nice-field__helper--slider",children:i})]}),_e!=="right"&&a&&e.jsx("div",{className:"nice-field__error",role:"alert",children:a}),_e!=="right"&&!a&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]})}),{displayName:"NiceSlider"}),Yn=Object.freeze(Object.defineProperty({__proto__:null,NiceSlider:Vt},Symbol.toStringTag,{value:"Module"})),pn=({options:t,suggestions:i,value:a,defaultValue:o,onChange:s,searchable:r=!0,clearable:f,maxTags:b,allowCustom:w,placeholder:D,label:ie,error:I,helperText:M,required:re,disabled:Y,size:Z="md",loading:U,id:$,className:ee,style:Q,accessMode:X,showKeyboardHints:_e,labelPlacement:ue,errorPlacement:x,labelWidth:O,controlWidth:L,readOnly:E,autoExpand:ye=!1})=>{const ne=m.useNiceAccessMode(X,$),W=ne==="hidden";(ne==="disabled"||ne==="readOnly")&&(Y=!0);const K=m.useControlId($),{t:A}=m.useNiceTranslation(),[se,N]=n.useState(!1),[h,u]=n.useState(""),V=n.useRef(null),R=n.useRef(null);m.useClickOutside(V,()=>N(!1));const y=n.useMemo(()=>[m.COMMON_SHORTCUTS.submit,m.COMMON_SHORTCUTS.cancel,{key:"Backspace",description:A("shortcuts.removeLastTag","Remove last tag")}],[A]),j=n.useMemo(()=>Array.isArray(t)&&t.length>0?t:Array.isArray(i)?i.map(z=>({label:z,value:z})):[],[t,i]),[C,ae]=m.useControllableState({value:a,defaultValue:o,fallbackValue:[],onChange:s,componentName:"NiceTagBox"}),F=n.useMemo(()=>Array.isArray(C)?C:[],[C]),pe=n.useMemo(()=>{let z=j.filter(te=>!F.includes(String(te.value)));if(h){const te=h.toLowerCase();z=z.filter(Oe=>Oe.label.toLowerCase().includes(te))}return z},[j,F,h]),H=n.useCallback(z=>{b&&F.length>=b||(F.includes(z)||ae([...F,z]),u(""))},[F,ae,b]),he=n.useCallback(z=>{ae(F.filter(te=>te!==z))},[F,ae]),be=n.useRef(null),ge=se&&(pe.length>0||!!w&&!!h),{activeIndex:$e,setActiveIndex:Ee,handleKeyDown:je}=_t.useListKeyboardNav(pe,{open:ge,onSelect:z=>H(String(z.value)),onClose:()=>N(!1),onOpen:()=>{Ee(0),N(!0)},intentRef:be}),P=`${n.useId()}-list`,q=ge&&pe[$e]?`${P}-${$e}`:void 0,xe=z=>{E||(z.key==="Backspace"&&!h&&F.length>0?he(F[F.length-1]):z.key==="Enter"&&h&&pe.length===0?(z.preventDefault(),w&&H(h)):je(z))},Fe=z=>j.find(te=>String(te.value)===z)?.label??z;return W?null:e.jsxs("div",{className:`nice-field nice-field--${Z} ${ue==="left"?"nice-field--label-left":""} ${U?"nice-field--loading":""} ${ee||""}`,style:{...Q,...O!=null&&{"--nice-field-label-width":typeof O=="number"?`${O}px`:O},...L!=null&&{"--nice-field-control-width":typeof L=="number"?`${L}px`:L}},ref:V,"aria-busy":U||void 0,children:[ie&&e.jsxs("label",{className:`nice-field__label ${re?"nice-field__label--required":""}`,htmlFor:K,children:[ie,_e&&e.jsx(m.NiceKeyboardHint,{shortcuts:y,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{role:"presentation",ref:be,className:`nice-tagbox nice-tagbox--${Z} ${ye?"nice-tagbox--expand":"nice-tagbox--fixed"} ${I?"nice-tagbox--error":""} ${Y?"nice-tagbox--disabled":""} ${E?"nice-tagbox--readonly":""}`,onClick:()=>{!Y&&!U&&!E&&(N(!0),R.current?.focus())},style:{position:"relative",cursor:Y||U?"not-allowed":E?"default":"text"},children:[e.jsxs("div",{className:"nice-tagbox__tags",children:[F.map(z=>e.jsxs("span",{className:"nice-tag nice-tagbox__tag",children:[Fe(z),!Y&&!E&&e.jsx("button",{type:"button",className:"nice-tag__remove",onClick:te=>{te.stopPropagation(),he(z)},"aria-label":A("controls.remove","Remove"),children:e.jsx(m.NiceIcon,{name:"close",size:14})})]},z)),r&&e.jsx("input",{ref:R,id:K,type:"text",className:"nice-tagbox__input nice-input__native",value:h,onChange:z=>{u(z.target.value),Ee(0),N(!0)},onFocus:()=>{Ee(-1),N(!0)},onKeyDown:xe,placeholder:F.length===0?D||A("controls.select","Select..."):"",disabled:Y||U,readOnly:E,autoComplete:"off",role:"combobox","aria-autocomplete":"list","aria-expanded":ge,"aria-controls":ge?P:void 0,"aria-activedescendant":q,style:{border:"none",outline:"none",background:"transparent",color:"inherit",flex:1,minWidth:80,padding:0,font:"inherit",caretColor:"var(--nice-color-primary)"}})]}),f&&F.length>0&&!Y&&!E&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:z=>{z.stopPropagation(),ae([])},"aria-label":A("controls.clear","Clear"),children:e.jsx(m.NiceIcon,{name:"close",size:14})}),ge&&e.jsxs("ul",{id:P,className:"nice-dropdown__list nice-tagbox__dropdown",role:"listbox","aria-multiselectable":"true",children:[pe.map((z,te)=>e.jsx("li",{id:`${P}-${te}`,role:"option","aria-selected":te===$e,className:`nice-dropdown__option ${te===$e?"nice-dropdown__option--active":""}`,onMouseEnter:()=>Ee(te),onMouseDown:Oe=>{Oe.preventDefault(),H(String(z.value))},children:z.label},String(z.value))),w&&h&&!pe.some(z=>String(z.value).toLowerCase()===h.toLowerCase())&&e.jsxs("li",{role:"option","aria-selected":!1,className:"nice-dropdown__option nice-dropdown__option--add",onMouseDown:z=>{z.preventDefault(),H(h)},children:[e.jsx(m.NiceIcon,{name:"plus",size:14})," ",A("controls.add","Add")," “",h,"”"]})]})]}),U&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),x==="right"&&I&&e.jsx("div",{id:`${K}-error`,className:"nice-field__error",role:"alert",children:I}),x==="right"&&!I&&M&&e.jsx("div",{id:`${K}-helper`,className:"nice-field__helper",children:M})]}),x!=="right"&&I&&e.jsx("div",{id:`${K}-error`,className:"nice-field__error",role:"alert",children:I}),x!=="right"&&!I&&M&&e.jsx("div",{id:`${K}-helper`,className:"nice-field__helper",children:M})]})},Gt=Object.assign(n.forwardRef(({label:t,helperText:i,error:a,required:o,disabled:s,readOnly:r,size:f="md",name:b,id:w,className:D,style:ie,accessMode:I,displayStyle:M,value:re,defaultValue:Y,onChange:Z,onBlur:U,onKeyDown:$,placeholder:ee,rows:Q=3,maxLength:X,resize:_e="vertical",autoFocus:ue,showCount:x,counterPlacement:O="bottom",submitOnEnter:L,onSubmit:E,showKeyboardHints:ye,labelPlacement:ne,errorPlacement:W,loading:K,labelWidth:A,controlWidth:se,displayMode:N},h)=>{const u=m.useNiceAccessMode(I,w),V=u==="hidden";u==="disabled"&&(s=!0),u==="readOnly"&&(r=!0);const{t:R}=m.useNiceTranslation(),y=m.useControlId(w),j=m.useComponentDisplayStyle("input",M),C=m.useComponentDisplayClass("input",M),ae=re?.length??0,F=X?ae>X:!1,pe=m.useDisplayModeEdit({enabled:N,readOnly:r,disabled:s}),H=n.useMemo(()=>({key:"Enter",ctrl:!0,description:R("shortcuts.submit","Submit")}),[R]),he=n.useCallback(ge=>{L&&m.matchesShortcut(ge,H)&&(ge.preventDefault(),E?.()),$?.(ge)},[L,E,$,H]),be=n.useMemo(()=>{const ge=[];return L&&ge.push(H),ge.push({key:"Tab",description:R("shortcuts.indent","Indent (when supported)")}),ge},[L,R,H]);return V?null:e.jsxs("div",{className:`nice-field nice-field--${f} ${ne==="left"?"nice-field--label-left":""} ${K?"nice-field--loading":""} ${D||""}`,style:{...ie,...A!=null&&{"--nice-field-label-width":typeof A=="number"?`${A}px`:A},...se!=null&&{"--nice-field-control-width":typeof se=="number"?`${se}px`:se}},"aria-busy":K||void 0,children:[t&&e.jsxs("label",{htmlFor:y,className:`nice-field__label ${o?"nice-field__label--required":""}`,children:[t,ye&&be.length>0&&e.jsx(m.NiceKeyboardHint,{shortcuts:be,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control nice-field__control--textarea",children:[pe.isDisplay?e.jsx(m.DisplayModeView,{value:re??Y??"",placeholder:ee,disabled:s,readOnly:r,onActivate:pe.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:ge=>{typeof h=="function"?h(ge):h&&(h.current=ge),pe.autoFocusRef(ge)},id:y,className:`nice-textarea nice-input--${f} nice-textarea--ds-${C} ${a?"nice-textarea--error":""} ${s?"nice-textarea--disabled":""}`,style:{...j,resize:_e},name:b,value:re,defaultValue:Y,placeholder:ee,rows:Q,maxLength:X,disabled:s||K,readOnly:r,autoFocus:ue,"aria-invalid":!!a,"aria-describedby":a?`${y}-error`:i?`${y}-helper`:void 0,onChange:ge=>Z?.(ge.target.value),onBlur:ge=>{N&&pe.exitEdit(),U?.(ge)},onKeyDown:he}),O!=="right"&&(x||X)&&e.jsxs("div",{className:`nice-textarea__counter ${F?"nice-textarea__counter--over":""}`,children:[ae,X?` / ${X}`:""]})]}),O==="right"&&(x||X)&&e.jsxs("div",{className:`nice-textarea__counter nice-textarea__counter--right ${F?"nice-textarea__counter--over":""}`,children:[ae,X?` / ${X}`:""]})]}),K&&e.jsx("span",{className:"nice-field__spinner nice-field__spinner--textarea",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),W==="right"&&a&&e.jsx("div",{id:`${y}-error`,className:"nice-field__error",role:"alert",children:a}),W==="right"&&!a&&i&&e.jsx("div",{id:`${y}-helper`,className:"nice-field__helper",children:i})]}),W!=="right"&&a&&e.jsx("div",{id:`${y}-error`,className:"nice-field__error",role:"alert",children:a}),W!=="right"&&!a&&i&&e.jsx("div",{id:`${y}-helper`,className:"nice-field__helper",children:i})]})}),{displayName:"NiceTextArea"}),Kn=Object.freeze(Object.defineProperty({__proto__:null,NiceTextArea:Gt},Symbol.toStringTag,{value:"Module"})),Vn=()=>`file-${Date.now()}-${Math.random().toString(36).slice(2,11)}`,Lt=t=>{if(t===0)return"0 B";const i=1024,a=["B","KB","MB","GB","TB"],o=Math.floor(Math.log(t)/Math.log(i));return`${parseFloat((t/Math.pow(i,o)).toFixed(2))} ${a[o]}`},qt=t=>t.startsWith("image/"),Zt=t=>t.startsWith("video/"),fn=t=>t.startsWith("audio/"),Gn=t=>qt(t)?"image":Zt(t)?"video":fn(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",qn=t=>{if(qt(t.type)||Zt(t.type)||fn(t.type))return URL.createObjectURL(t)},Zn={xxs:24,xs:32,sm:48,md:80,lg:120,xl:160,xxl:200},Jn=(t,i)=>a=>{const o=new FormData;a.chunk?(o.append("chunk",a.chunk),o.append("chunkIndex",String(a.chunkIndex)),o.append("totalChunks",String(a.totalChunks)),o.append("fileName",a.file.name),o.append("fileId",a.fileId||"")):o.append("file",a.file);const s=new XMLHttpRequest;return new Promise(r=>{s.upload.addEventListener("progress",f=>{f.lengthComputable&&a.onProgress&&a.onProgress(f.loaded/f.total*100)}),s.addEventListener("load",()=>{if(s.status>=200&&s.status<300)try{const f=JSON.parse(s.responseText);r({success:!0,url:f.url,fileId:f.fileId||f.id,metadata:f})}catch{r({success:!0,url:s.responseText})}else r({success:!1,error:`Upload failed: ${s.status} ${s.statusText}`})}),s.addEventListener("error",()=>r({success:!1,error:"Network error"})),s.addEventListener("abort",()=>r({success:!1,error:"Upload cancelled"})),a.signal&&a.signal.addEventListener("abort",()=>s.abort()),s.open("POST",t),i&&Object.entries(i).forEach(([f,b])=>s.setRequestHeader(f,b)),s.send(o)})},mn=Object.assign(n.forwardRef((t,i)=>{const{accept:a,multiple:o,maxFileSize:s,maxFiles:r,minFileSize:f,onFilesSelected:b,uploadMode:w="instant",labelText:D,text:ie,dropzoneText:I,browseText:M,dragActiveText:re,labelPlacement:Y="right",icon:Z="upload",showFileList:U=!0,imagePreview:$,showPreview:ee=!0,listMode:Q="list",previewSize:X="md",fileProgress:_e,renderPreview:ue,renderFileItem:x,variant:O="dropzone",trigger:L,dropChildren:E,autoUpload:ye=!1,uploadHandler:ne,uploadUrl:W,uploadHeaders:K,concurrentUploads:A=3,maxRetries:se=3,chunkSize:N=5*1024*1024,chunkThreshold:h=10*1024*1024,validateFile:u,keepFilesAfterUpload:V=!0,initialFiles:R,disabled:y,readOnly:j,onFilesAdded:C,onUploadComplete:ae,onUploadError:F,onProgress:pe,onFileRemoved:H,onChange:he,apiRef:be,pasteFromClipboard:ge,className:$e,style:Ee,"data-testid":je}=t,le=o??O!=="button",{t:P}=m.useNiceTranslation(),[q,xe]=n.useState(()=>R??[]),[Fe,z]=n.useState(!1),te=n.useRef(q),Oe=n.useRef(null),ze=n.useRef(new Map),qe=n.useRef([]),Re=n.useRef(new Set),g=n.useRef(0),T=n.useRef(()=>{}),p=n.useRef(he),ce=!!(ne||W);n.useEffect(()=>{te.current=q},[q]),n.useEffect(()=>{p.current=he}),n.useEffect(()=>{p.current?.(q)},[q]),n.useEffect(()=>()=>{te.current.forEach(c=>c.previewUrl&&URL.revokeObjectURL(c.previewUrl))},[]);const B=n.useCallback(c=>b(c.map(J=>J.file)),[b]),oe=n.useCallback(c=>{if(u){const J=u(c);if(J)return J}if(s&&c.size>s)return P("fileUpload.error.tooLarge","File is too large. Maximum size: {size}").replace("{size}",Lt(s));if(f&&c.size<f)return P("fileUpload.error.tooSmall","File is too small. Minimum size: {size}").replace("{size}",Lt(f));if(a){const J=a.split(",").map(me=>me.trim().toLowerCase()),fe=c.type.toLowerCase(),ke="."+(c.name.split(".").pop()?.toLowerCase()??"");if(!J.some(me=>me.startsWith(".")?ke===me:me.endsWith("/*")?fe.startsWith(me.replace("/*","/")):fe===me))return P("fileUpload.error.badType","File type not allowed. Accepted types: {accept}").replace("{accept}",a)}return null},[u,s,f,a,P]),Se=n.useCallback(()=>ne||(W?Jn(W,K):null),[ne,W,K]),k=n.useCallback(async(c,J,fe)=>{const ke=c.file,Te=Math.ceil(ke.size/N);let me=0,Be={success:!1};for(let Le=0;Le<Te;Le++){if(fe.aborted)throw new Error("Upload cancelled");const Ze=Le*N,jt=Math.min(Ze+N,ke.size),it=ke.slice(Ze,jt);let pt=0,mt=!1;for(;!mt&&pt<se;)try{Be=await J({file:ke,chunk:it,chunkIndex:Le,totalChunks:Te,fileId:c.id,onProgress:kt=>{const Dt=(me+it.size*kt/100)/ke.size*100;xe(Rt=>Rt.map(xt=>xt.id===c.id?{...xt,progress:Dt}:xt))},signal:fe}),Be.success?(mt=!0,me+=it.size):pt++}catch(kt){if(pt++,pt>=se)throw kt}if(!mt)throw new Error(`Failed to upload chunk ${Le+1}/${Te}`)}return Be},[N,se]),Ce=n.useCallback(async(c,J)=>{const fe=te.current.find(Te=>Te.id===c);if(!fe||fe.status==="uploading"||fe.status==="success")return;const ke=new AbortController;ze.current.set(c,ke),Re.current.add(c),xe(Te=>Te.map(me=>me.id===c?{...me,status:"uploading",progress:0,error:void 0}:me));try{const Te=fe.file;let me;if(Te.size>h?me=await k(fe,J,ke.signal):me=await J({file:Te,onProgress:Be=>{xe(Le=>Le.map(Ze=>Ze.id===c?{...Ze,progress:Be}:Ze)),pe?.(fe,Be)},signal:ke.signal}),me.success){if(xe(Be=>Be.map(Le=>Le.id===c?{...Le,status:"success",progress:100,uploadedUrl:me.url,uploadedAt:new Date}:Le)),ae?.({...fe,status:"success",uploadedUrl:me.url}),!V){const Be=te.current.find(Le=>Le.id===c);Be?.previewUrl&&URL.revokeObjectURL(Be.previewUrl),xe(Le=>Le.filter(Ze=>Ze.id!==c))}}else throw new Error(me.error||"Upload failed")}catch(Te){const me=Te;if(me.name==="AbortError"||me.message==="Upload cancelled")xe(Be=>Be.map(Le=>Le.id===c?{...Le,status:"cancelled",error:P("fileUpload.status.cancelled","Cancelled")}:Le));else{const Be=me.message||P("fileUpload.error.generic","Upload error");xe(Le=>Le.map(Ze=>Ze.id===c?{...Ze,status:"error",error:Be}:Ze)),F?.(fe,Be)}}finally{ze.current.delete(c),Re.current.delete(c),T.current()}},[h,k,pe,ae,F,V,P]),de=n.useRef(Ce);n.useEffect(()=>{de.current=Ce});const Ie=n.useCallback(()=>{const c=Se();if(c)for(;qe.current.length>0&&Re.current.size<A;){const J=qe.current.shift();J&&de.current(J,c)}},[Se,A]);n.useEffect(()=>{T.current=Ie});const v=n.useCallback(c=>{const J=Se();if(!J){console.error("No upload handler configured");return}de.current(c,J)},[Se]),we=n.useCallback(c=>{ze.current.get(c)?.abort(),xe(J=>J.map(fe=>fe.id===c&&fe.status==="uploading"?{...fe,status:"cancelled",error:P("fileUpload.status.cancelled","Cancelled")}:fe))},[P]),Qe=n.useCallback(c=>{xe(J=>J.map(fe=>fe.id===c?{...fe,status:"pending",progress:0,error:void 0}:fe)),v(c)},[v]),et=n.useCallback(c=>{const J=te.current.find(ke=>ke.id===c);if(!J)return;ze.current.get(c)?.abort(),J.previewUrl&&URL.revokeObjectURL(J.previewUrl);const fe=te.current.filter(ke=>ke.id!==c);te.current=fe,xe(ke=>ke.filter(Te=>Te.id!==c)),H?.(J),w==="instant"&&B(fe)},[H,w,B]),tt=n.useCallback(()=>{te.current.filter(c=>c.status==="pending").forEach(c=>qe.current.push(c.id)),Ie()},[Ie]),Xe=n.useCallback(()=>{ze.current.forEach(c=>c.abort()),xe(c=>c.map(J=>J.status==="uploading"?{...J,status:"cancelled",error:P("fileUpload.status.cancelled","Cancelled")}:J))},[P]),lt=n.useCallback(()=>{Xe(),te.current.forEach(c=>c.previewUrl&&URL.revokeObjectURL(c.previewUrl)),xe([]),w==="instant"&&B([])},[Xe,w,B]),ht=n.useCallback(()=>{te.current.filter(c=>c.status==="error").forEach(c=>Qe(c.id))},[Qe]),rt=n.useCallback(c=>{if(y||j)return;const J=te.current;let fe=le?c:c.slice(0,1);r&&(fe=fe.slice(0,Math.max(0,r-J.length)));const ke=fe.map(me=>{const Be=oe(me);return{id:Vn(),file:me,name:me.name,size:me.size,type:me.type,status:Be?"error":"pending",progress:0,error:Be||void 0,previewUrl:qn(me)}}),Te=le?[...J,...ke]:ke;xe(Te),te.current=Te,C?.(ke),w==="instant"&&B(Te),ye&&(ke.filter(me=>me.status==="pending").forEach(me=>qe.current.push(me.id)),Ie())},[y,j,le,r,oe,C,w,B,ye,Ie]),dt=n.useCallback(()=>Oe.current?.click(),[]);n.useImperativeHandle(be,()=>({addFiles:rt,uploadAll:tt,cancelAll:Xe,clearAll:lt,getFiles:()=>te.current,getFile:c=>te.current.find(J=>J.id===c),retryFailed:ht,openFileBrowser:dt}),[rt,tt,Xe,lt,ht,dt]),n.useEffect(()=>{if(!ge||y||j)return;const c=J=>{const fe=J.clipboardData?.items;if(!fe)return;const ke=[];for(let Te=0;Te<fe.length;Te++)if(fe[Te].kind==="file"){const me=fe[Te].getAsFile();me&&ke.push(me)}ke.length>0&&(J.preventDefault(),rt(ke))};return document.addEventListener("paste",c),()=>document.removeEventListener("paste",c)},[ge,y,j,rt]);const gt=c=>{c.preventDefault(),!(y||j)&&(g.current++,z(!0))},Ue=c=>{c.preventDefault(),g.current--,g.current<=0&&(g.current=0,z(!1))},ct=c=>{c.preventDefault(),g.current=0,z(!1),!(y||j)&&rt(Array.from(c.dataTransfer.files))},nt=c=>{c.target.files&&rt(Array.from(c.target.files)),c.target.value=""},d=n.useMemo(()=>{const c={total:q.length,pending:0,uploading:0,success:0,error:0};for(const J of q)J.status==="pending"?c.pending++:J.status==="uploading"?c.uploading++:J.status==="success"?c.success++:J.status==="error"&&c.error++;return c},[q]),G=D??ie??I??P("dropOrClick","Drop files here or click to browse"),Ae=re??P("fileUpload.dropzone.dragActive","Drop files here"),at=c=>P(`fileUpload.status.${c}`,{pending:"Pending",uploading:"Uploading…",success:"Uploaded",error:"Error",cancelled:"Cancelled"}[c]),He=c=>ce||c.status!=="pending",Ge=c=>{if(ue)return ue(c);const J=Zn[X]??80,fe=$??ee;return fe&&c.previewUrl&&qt(c.type)?e.jsx("img",{src:c.previewUrl,alt:c.name,className:"nice-fileuploader__thumb nice-upload__thumb nice-upload__preview",style:{width:J,height:J,objectFit:"cover"}}):fe&&c.previewUrl&&Zt(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:J,height:J,objectFit:"cover"}}),e.jsx("span",{className:"nice-upload__preview-overlay","aria-hidden":"true",children:e.jsx(m.NiceIcon,{name:"play",size:20})})]}):e.jsx("span",{className:"nice-upload__preview nice-upload__preview--icon","aria-hidden":"true",children:e.jsx(m.NiceIcon,{name:Gn(c.type),size:Math.round(J*.5)})})},ot=c=>{const J={upload:()=>v(c.id),cancel:()=>we(c.id),retry:()=>Qe(c.id),remove:()=>et(c.id)};if(x)return e.jsx(n.Fragment,{children:x(c,J)},c.id);const fe=_e?.[c.name]??c.progress,ke=He(c);return e.jsxs("div",{className:`nice-fileuploader__file nice-upload__file nice-upload__item nice-upload__item--${c.status}`,children:[($??ee)&&Ge(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:Lt(c.size)}),ke&&e.jsx("span",{className:`nice-upload__badge nice-upload__badge--${c.status}`,children:at(c.status)}),(c.status==="uploading"||fe!=null&&fe>0&&fe<100)&&e.jsx("div",{className:"nice-fileuploader__progress nice-upload__progress",role:"progressbar","aria-label":c.name,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(Math.min(100,Math.max(0,fe??0))),children:e.jsx("div",{className:"nice-fileuploader__progress-bar nice-upload__progress-bar",style:{width:`${Math.min(100,Math.max(0,fe))}%`}})}),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")}),!j&&!y&&e.jsxs("span",{className:"nice-upload__item-actions",children:[ce&&c.status==="pending"&&e.jsx("button",{type:"button",className:"nice-upload__btn nice-upload__btn--upload",onClick:J.upload,title:P("fileUpload.action.upload","Upload"),"aria-label":`${P("fileUpload.action.upload","Upload")}: ${c.name}`,children:e.jsx(m.NiceIcon,{name:"upload",size:14})}),c.status==="uploading"&&e.jsx("button",{type:"button",className:"nice-upload__btn nice-upload__btn--cancel",onClick:J.cancel,title:P("fileUpload.action.cancel","Cancel"),"aria-label":`${P("fileUpload.action.cancel","Cancel")}: ${c.name}`,children:e.jsx(m.NiceIcon,{name:"stop",size:14})}),ce&&c.status==="error"&&e.jsx("button",{type:"button",className:"nice-upload__btn nice-upload__btn--retry",onClick:J.retry,title:P("fileUpload.action.retry","Retry"),"aria-label":`${P("fileUpload.action.retry","Retry")}: ${c.name}`,children:e.jsx(m.NiceIcon,{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:J.remove,title:P("remove","Remove"),"aria-label":`${P("remove","Remove")}: ${c.name}`,children:e.jsx(m.NiceIcon,{name:"close",size:14})})]})]},c.id)},yt=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),dt())},bt=e.jsx("input",{ref:Oe,type:"file",accept:a,multiple:le,hidden:!0,disabled:y,onChange:nt});return e.jsxs("div",{ref:i,className:`nice-fileuploader nice-upload ${y?"nice-fileuploader--disabled nice-upload--disabled":""} ${j?"nice-upload--readonly":""} ${$e||""}`,style:Ee,"data-testid":je,children:[O==="button"?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"nice-upload__trigger nice-btn nice-btn--primary",onClick:dt,disabled:y||j,children:L??P("filePicker.label","Choose files")}),bt]}):!j&&e.jsxs("div",{className:`nice-fileuploader__dropzone nice-upload__dropzone nice-upload__dropzone--label-${Y} ${!E&&!G?"nice-upload__dropzone--icon-only":""} ${Fe?"nice-fileuploader__dropzone--active nice-upload__dropzone--active":""}`,role:"button",tabIndex:y?-1:0,"aria-disabled":y||void 0,"aria-label":!E&&!G?P("filePicker.label","Choose files"):void 0,onDragEnter:gt,onDragOver:c=>c.preventDefault(),onDragLeave:Ue,onDrop:ct,onClick:()=>!y&&dt(),onKeyDown:yt,children:[bt,E??e.jsxs(e.Fragment,{children:[Z&&e.jsx("div",{className:"nice-upload__icon","aria-hidden":"true",children:e.jsx(m.NiceIcon,{name:Z,size:"lg"})}),(Fe?Ae:G)&&e.jsxs("div",{className:"nice-fileuploader__label nice-upload__label",children:[Fe?Ae:G,M&&e.jsxs("span",{className:"nice-upload__browse",children:[" ",M]})]})]})]}),U&&q.length>0&&e.jsx("div",{className:`nice-fileuploader__list nice-upload__list nice-upload__list--${Q}`,"aria-live":"polite",children:q.map(ot)}),ce&&q.length>0&&!j&&e.jsxs("div",{className:"nice-upload__bulk",children:[d.pending>0&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary nice-btn--sm",onClick:tt,children:P("fileUpload.bulk.uploadAll","Upload all ({n})").replace("{n}",String(d.pending))}),d.error>0&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:ht,children:P("fileUpload.bulk.retryFailed","Retry failed ({n})").replace("{n}",String(d.error))}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:lt,children:P("fileUpload.bulk.clear","Clear")})]}),!ce&&w==="useButtons"&&q.length>0&&!j&&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:()=>B(te.current),children:P("upload","Upload")}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:lt,children:P("clearAll","Clear All")})]})]})}),{displayName:"NiceUpload"}),Qn=[{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"}],Jt=({label:t,helperText:i,error:a,errorPlacement:o="bottom",required:s,disabled:r,readOnly:f,loading:b,size:w="md",className:D,style:ie,accessMode:I,id:M,value:re,defaultValue:Y,onChange:Z,columns:U=2,showState:$=!1,showBuilding:ee=!0,showApartment:Q=!0,showCountry:X=!0,countryOptions:_e=Qn,defaultCountry:ue="PL",fieldLabels:x,fieldPlaceholders:O,showLabel:L=!0,labelPlacement:E,labelWidth:ye,controlWidth:ne})=>{const W=m.useNiceAccessMode(I,M),K=W==="hidden";W==="disabled"&&(r=!0),W==="readOnly"&&(f=!0);const{t:A}=m.useNiceTranslation(),se=re!==void 0,[N,h]=n.useState(Y??{}),u=se?re:N,V=he=>{const be={...u,...he};se||h(be),Z?.(be)},R={street:x?.street??A("address.street","Street"),building:x?.building??A("address.building","Building"),apartment:x?.apartment??A("address.apartment","Apt."),postalCode:x?.postalCode??A("address.postalCode","Postal code"),city:x?.city??A("address.city","City"),state:x?.state??A("address.state","State / Region"),country:x?.country??A("address.country","Country")},y=O??{},j=u.country??ue,C=E==="left"?"left":"top",ae={...ie,...ye!=null&&{"--nice-field-label-width":typeof ye=="number"?`${ye}px`:ye},...ne!=null&&{"--nice-field-control-width":typeof ne=="number"?`${ne}px`:ne}},F={display:"grid",gridTemplateColumns:`repeat(${U}, minmax(0, 1fr))`,gap:"8px 12px"},pe=U===2?{gridColumn:"span 2"}:{},H={size:w,disabled:r||b,readOnly:f,labelPlacement:C};return K?null:e.jsxs("div",{className:`nice-field nice-field--${w} nice-address nice-address--cols-${U} ${b?"nice-field--loading":""} ${D||""}`,style:ae,"aria-busy":b||void 0,children:[L&&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:F,children:[e.jsx("div",{style:pe,children:e.jsx(Je.NiceTextInput,{...H,label:R.street,value:u.street??"",onChange:he=>V({street:he}),placeholder:y.street,required:s})}),ee&&e.jsx(Je.NiceTextInput,{...H,label:R.building,value:u.building??"",onChange:he=>V({building:he}),placeholder:y.building}),Q&&e.jsx(Je.NiceTextInput,{...H,label:R.apartment,value:u.apartment??"",onChange:he=>V({apartment:he}),placeholder:y.apartment}),e.jsx(Je.NiceTextInput,{...H,label:R.postalCode,value:u.postalCode??"",onChange:he=>V({postalCode:he}),placeholder:y.postalCode??"00-000",required:s}),e.jsx(Je.NiceTextInput,{...H,label:R.city,value:u.city??"",onChange:he=>V({city:he}),placeholder:y.city,required:s}),$&&e.jsx(Je.NiceTextInput,{...H,label:R.state,value:u.state??"",onChange:he=>V({state:he}),placeholder:y.state}),X&&e.jsx(Je.NiceSelect,{...H,label:R.country,value:j,onChange:he=>V({country:typeof he=="string"?he:String(he??"")}),options:_e,required:s})]}),b&&e.jsx("span",{className:"nice-field__spinner nice-field__spinner--address",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),o==="right"&&a&&e.jsx("div",{className:"nice-field__error",role:"alert",children:a}),o==="right"&&!a&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]}),o!=="right"&&a&&e.jsx("div",{className:"nice-field__error",role:"alert",children:a}),o!=="right"&&!a&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]})};process.env.NODE_ENV!=="production"&&(Jt.displayName="NiceAddress");const hn=[{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:"🇿🇼"}],Qt=({value:t,defaultValue:i,onChange:a,placeholder:o,showSearch:s=!0,searchPlaceholder:r,showFlagInValue:f,showFlagInMenu:b,showTextInValue:w,showTextInMenu:D,showDialCodeInValue:ie,showDialCodeInMenu:I,showCodeInValue:M=!1,showCodeInMenu:re=!1,compact:Y=!1,variant:Z="default",dropdownAlign:U,disabled:$=!1,countries:ee,priorityCountries:Q=["US","GB","DE","FR","PL"],allowClear:X=!1,size:_e="md",className:ue="",style:x,label:O,helperText:L,error:E,required:ye,readOnly:ne,loading:W,labelPlacement:K,errorPlacement:A,labelWidth:se,controlWidth:N,id:h,"data-testid":u="nice-country-picker"})=>{const{t:V}=m.useNiceTranslation(),R=n.useRef(null),y=n.useRef(null),j=n.useRef(null),[C,ae]=n.useState(i),[F,pe]=n.useState(!1),[H,he]=n.useState(""),be=f??!0,ge=b??!0,$e=w??!Y,Ee=D??!0,je=ie??!Y,le=I??!0,P=_t.useDropdownAlignment(F,y,U??(Y?"auto":"left")),q=t!==void 0?t:C,xe=n.useMemo(()=>{let de=hn;if(ee){const Ie=new Set(ee.map(v=>v.toUpperCase()));de=de.filter(v=>Ie.has(v.code))}return de},[ee]),Fe=n.useMemo(()=>{if(!Q?.length)return xe;const de=new Set(Q.map(we=>we.toUpperCase())),Ie=xe.filter(we=>de.has(we.code)),v=xe.filter(we=>!de.has(we.code));return[...Ie,...v]},[xe,Q]),z=n.useMemo(()=>{if(!H)return Fe;const de=H.toLowerCase();return Fe.filter(Ie=>Ie.name.toLowerCase().includes(de)||Ie.code.toLowerCase().includes(de)||Ie.dialCode.includes(de))},[Fe,H]),te=n.useMemo(()=>q?xe.find(de=>de.code===q)??null:null,[q,xe]);n.useEffect(()=>{if(!F)return;const de=Ie=>{R.current&&!R.current.contains(Ie.target)&&(pe(!1),he(""))};return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[F]);const Oe=n.useCallback(de=>{t===void 0&&ae(de.code),a?.(de),pe(!1),he("")},[t,a]),ze=n.useCallback(()=>{t===void 0&&ae(void 0),a?.(null)},[t,a]),qe=n.useCallback(de=>{de.stopPropagation(),ze()},[ze]),Re=X&&!!te&&!$&&!ne,g=n.useRef(null),T=n.useCallback(()=>{pe(!1),he("")},[]),{activeIndex:p,setActiveIndex:ce,handleKeyDown:B}=_t.useListKeyboardNav(z,{open:F,onSelect:de=>Oe(de),onClose:T,onOpen:()=>!$&&!ne&&pe(!0),intentRef:g}),oe=de=>{if((de.key==="Delete"||de.key==="Backspace")&&Re&&!F){de.preventDefault(),ze();return}B(de)};m.useOverlayFocus(g,{open:F,modal:!1,initialFocus:s?j:"none",onClose:T}),n.useEffect(()=>{ce(0)},[H,ce]);const k=`${n.useId()}-listbox`,Ce=F&&z[p]?`${k}-${p}`:void 0;return n.useLayoutEffect(()=>{Ce&&document.getElementById(Ce)?.scrollIntoView?.({block:"nearest"})},[Ce]),e.jsxs("div",{ref:R,className:`nice-field nice-field--${_e} nice-field--country-picker ${K==="left"?"nice-field--label-left":""} ${A==="right"?"nice-field--error-right":""} ${E?"nice-field--error":""} ${W?"nice-field--loading":""} nice-country-picker nice-country-picker--${_e} ${Y?"nice-country-picker--compact":""} ${Z==="ghost"?"nice-country-picker--ghost":""} ${F?"nice-country-picker--open":""} ${$?"nice-country-picker--disabled":""} ${ue}`,style:{...x,...se!=null&&{"--nice-field-label-width":typeof se=="number"?`${se}px`:se},...N!=null&&{"--nice-field-control-width":typeof N=="number"?`${N}px`:N}},"data-testid":u,"aria-busy":W||void 0,children:[O&&e.jsxs("label",{className:"nice-field__label",htmlFor:h,children:[O,ye&&e.jsx("span",{className:"nice-field__required",children:"*"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("button",{ref:y,type:"button",className:"nice-country-picker__trigger",onClick:()=>!$&&!ne&&pe(!F),onKeyDown:oe,disabled:$,id:h,role:"combobox","aria-keyshortcuts":Re?"Delete":void 0,"aria-haspopup":"listbox","aria-expanded":F,"aria-controls":F?k:void 0,"aria-activedescendant":s?void 0:Ce,"aria-invalid":E?!0:void 0,"data-testid":`${u}-trigger`,children:[te?e.jsxs("span",{className:"nice-country-picker__value",children:[be&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(_t.FlagIcon,{code:te.code})}),$e&&e.jsx("span",{className:"nice-country-picker__name",children:te.name}),M&&e.jsx("span",{className:"nice-country-picker__code",children:te.code}),je&&e.jsxs("span",{className:"nice-country-picker__dial-code",children:["(",te.dialCode,")"]})]}):e.jsx("span",{className:"nice-country-picker__placeholder",children:Y?"":o??V("controls.select","Select country")}),e.jsxs("span",{className:"nice-country-picker__icons",children:[Re&&e.jsx("span",{className:"nice-country-picker__clear",onClick:qe,role:"presentation",children:e.jsx(m.NiceIcon,{name:"close",size:14})}),Z!=="ghost"&&e.jsx("span",{className:"nice-country-picker__arrow",children:e.jsx(m.NiceIcon,{name:F?"chevron-up":"chevron-down",size:16})})]})]}),F&&e.jsxs("div",{ref:g,id:k,className:`nice-country-picker__dropdown nice-country-picker__dropdown--align-${P}`,role:"listbox","data-testid":`${u}-dropdown`,children:[s&&e.jsx("div",{className:"nice-country-picker__search",children:e.jsx("input",{ref:j,type:"text",value:H,onChange:de=>he(de.target.value),onKeyDown:B,placeholder:r??V("search","Search"),"aria-label":r??V("search","Search"),"aria-controls":k,"aria-activedescendant":Ce,"aria-autocomplete":"list",className:"nice-country-picker__search-input","data-testid":`${u}-search`})}),e.jsx("div",{className:"nice-country-picker__list",children:z.length===0?e.jsx("div",{className:"nice-country-picker__empty",children:V("noData","No countries found")}):z.map((de,Ie)=>e.jsxs("div",{id:`${k}-${Ie}`,className:`nice-country-picker__option ${de.code===q?"nice-country-picker__option--selected":""} ${Ie===p?"nice-country-picker__option--highlighted":""}`,onClick:()=>Oe(de),onMouseEnter:()=>ce(Ie),role:"option","aria-selected":de.code===q,"data-testid":`${u}-option-${de.code}`,children:[ge&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(_t.FlagIcon,{code:de.code})}),Ee&&e.jsx("span",{className:"nice-country-picker__name",children:de.name}),re&&e.jsx("span",{className:"nice-country-picker__code",children:de.code}),le&&e.jsx("span",{className:"nice-country-picker__dial-code",children:de.dialCode})]},de.code))})]}),W&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),A==="right"&&E&&e.jsx("div",{className:"nice-field__error",role:"alert",children:E}),A==="right"&&!E&&L&&e.jsx("div",{className:"nice-field__helper",children:L})]}),A!=="right"&&E&&e.jsx("div",{className:"nice-field__error",role:"alert",children:E}),A!=="right"&&!E&&L&&e.jsx("div",{className:"nice-field__helper",children:L})]})};process.env.NODE_ENV!=="production"&&(Qt.displayName="NiceCountryPicker");const Xn=["Su","Mo","Tu","We","Th","Fr","Sa"];function Ht(t,i){return new Date(t,i+1,0).getDate()}function Wn(t,i){return new Date(t,i,1).getDay()}function wt(t,i,a){return`${t}-${String(i+1).padStart(2,"0")}-${String(a).padStart(2,"0")}`}function Tt(t){const[i,a,o]=t.split("-").map(Number);return new Date(i,a-1,o)}function Nt(t,i){const a=Tt(t);return a.setDate(a.getDate()+i),wt(a.getFullYear(),a.getMonth(),a.getDate())}function Pt(t,i){const a=Tt(t),o=new Date(a.getFullYear(),a.getMonth()+i,1),s=Math.min(a.getDate(),Ht(o.getFullYear(),o.getMonth()));return wt(o.getFullYear(),o.getMonth(),s)}function ea(t){const i=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()));i.setUTCDate(i.getUTCDate()+4-(i.getUTCDay()||7));const a=new Date(Date.UTC(i.getUTCFullYear(),0,1));return Math.ceil(((i.getTime()-a.getTime())/864e5+1)/7)}const nn=["January","February","March","April","May","June","July","August","September","October","November","December"],Xt=({value:t,onChange:i,min:a,max:o,disabledDates:s=[],firstDayOfWeek:r=1,size:f="md",showWeekNumbers:b,onMonthChange:w,className:D,style:ie,accessMode:I,id:M,multiple:re,selectedDates:Y,onSelectedDatesChange:Z,selectionMode:U="single",rangeStart:$,rangeEnd:ee,onRangeChange:Q,renderDay:X,showKeyboardHints:_e,persistPreferences:ue=!1,fullWidth:x=!1,cookies:O=!1,localStorage:L=!0,sessionStorage:E=!1,storageMode:ye,storageKey:ne,"data-testid":W})=>{const K=m.useNiceAccessMode(I,M),A=K==="hidden",se=K==="disabled"||K==="readOnly",{t:N}=m.useNiceTranslation(),h=new Date,u=(U==="range"?$:t)||t,V=u?new Date(u):h,R=Dn.useStorageAdapter(ne??"nice-calendar"),y=n.useMemo(()=>ue?R.get("prefs")??{}:{},[ue,R]),j=y.firstDayOfWeek??r,[C,ae]=n.useState(y.lastViewYear??V.getFullYear()),[F,pe]=n.useState(y.lastViewMonth??V.getMonth()),[H,he]=n.useState(y.preferredView??"days"),[be,ge]=n.useState([]),$e=Y??be,[Ee,je]=n.useState(null),le=n.useCallback(d=>{if(!ue)return;const G=R.get("prefs")??{};R.set("prefs",{...G,...d})},[ue,R]),P=n.useCallback(d=>{he(d),le({preferredView:d})},[le]),q=n.useCallback((d,G)=>{le({lastViewYear:d,lastViewMonth:G})},[le]),xe=n.useMemo(()=>[m.COMMON_SHORTCUTS.moveUp,m.COMMON_SHORTCUTS.moveDown,m.COMMON_SHORTCUTS.moveLeft,m.COMMON_SHORTCUTS.moveRight,{key:"Enter",description:N("shortcuts.selectDate","Select date")},m.COMMON_SHORTCUTS.pageUp,m.COMMON_SHORTCUTS.pageDown],[N]),Fe=n.useMemo(()=>Ht(C,F),[C,F]),z=n.useMemo(()=>(Wn(C,F)-j+7)%7,[C,F,j]),te=n.useMemo(()=>{const d=[...Xn];for(let G=0;G<j;G++)d.push(d.shift());return d},[j]),Oe=n.useCallback(d=>{const G=Ae=>/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])/.test(Ae);return a&&G(a)&&d<a||o&&G(o)&&d>o?!0:s.includes(d)},[a,o,s]),ze=n.useCallback(d=>{if(H==="years"){ae(at=>at+d*10);return}if(H==="months"){ae(at=>at+d);return}let G=F+d,Ae=C;G<0&&(G=11,Ae--),G>11&&(G=0,Ae++),pe(G),ae(Ae),q(Ae,G),w?.(Ae,G)},[F,C,w,H,q]),qe=wt(h.getFullYear(),h.getMonth(),h.getDate()),Re=U==="range",g=n.useCallback(d=>Re?d===$||d===ee:re?$e.includes(d):d===t,[Re,$,ee,re,$e,t]),[T,p]=n.useMemo(()=>{if(!Re||!$)return["",""];const d=ee||Ee;return d?d<$?[d,$]:[$,d]:[$,$]},[Re,$,ee,Ee]),ce=n.useCallback(d=>{if(!se){if(Re){const G=!$||ee?{start:d,end:""}:d<$?{start:d,end:$}:{start:$,end:d};je(null),Q?.(G),i?.(d);return}if(re){const G=$e.includes(d)?$e.filter(Ae=>Ae!==d):[...$e,d];Y===void 0&&ge(G),Z?.(G)}i?.(d)}},[se,Re,$,ee,Q,re,$e,Y,i,Z]),B=n.useCallback(()=>{H==="days"?P("months"):H==="months"&&P("years")},[H,P]),oe=n.useCallback(d=>{pe(d),P("days"),q(C,d),w?.(C,d)},[C,w,P,q]),Se=n.useCallback(d=>{ae(d),P("months")},[P]),k=n.useRef(null),Ce=n.useRef(null);m.useRovingFocus(Ce,{orientation:"grid",itemSelector:"button"});const de=`${C}-${String(F+1).padStart(2,"0")}-`,Ie=d=>!!d&&d.startsWith(de),[v,we]=n.useState(null),Qe=Ie(v)?v:[Re?$:t,qe].find(Ie)??`${de}01`,et=n.useRef(null),tt=(d,G)=>{ae(d),pe(G),q(d,G),w?.(d,G)},Xe=d=>{if(!Ie(d)){const G=Tt(d);tt(G.getFullYear(),G.getMonth())}we(d),et.current="day"};n.useEffect(()=>{const d=et.current;et.current=null,d==="day"?k.current?.querySelector(`[data-iso="${Qe}"]`)?.focus():d==="picker"&&Ce.current?.querySelector('[tabindex="0"]')?.focus()},[Qe,H]);const lt=d=>{const G=d.target.dataset.iso;if(!G||d.altKey||d.ctrlKey||d.metaKey)return;const Ae=getComputedStyle(d.currentTarget).direction==="rtl",at=Ae&&d.key==="ArrowLeft"?"ArrowRight":Ae&&d.key==="ArrowRight"?"ArrowLeft":d.key,He=(Tt(G).getDay()-j+7)%7;let Ge;switch(at){case"ArrowLeft":Ge=Nt(G,-1);break;case"ArrowRight":Ge=Nt(G,1);break;case"ArrowUp":Ge=Nt(G,-7);break;case"ArrowDown":Ge=Nt(G,7);break;case"Home":Ge=Nt(G,-He);break;case"End":Ge=Nt(G,6-He);break;case"PageUp":Ge=Pt(G,d.shiftKey?-12:-1);break;case"PageDown":Ge=Pt(G,d.shiftKey?12:1);break;case"Enter":case" ":d.preventDefault(),Oe(G)||ce(G);return;default:return}d.preventDefault(),Xe(Ge)};m.useIntent(["sectionPrev","sectionNext","pagePrev","pageNext"],d=>{if(d.source==="keyboard")return!1;const G=d.intent==="sectionPrev"?-1:d.intent==="sectionNext"?1:d.intent==="pagePrev"?-12:12;Xe(Pt(Qe,G))},{ref:k,enabled:H==="days"});const ht=d=>{const G=Math.min(Tt(Qe).getDate(),Ht(C,d));oe(d),we(wt(C,d,G)),et.current="day"},rt=d=>{Se(d),et.current="picker"},dt=H==="years"?`${C-C%10} – ${C-C%10+9}`:H==="months"?`${C}`:`${nn[F]} ${C}`,gt=H==="years"?"decade":H==="months"?"year":"month",Ue=[];for(let d=0;d<z;d++)Ue.push(null);for(let d=1;d<=Fe;d++)Ue.push(d);for(;Ue.length%7!==0;)Ue.push(null);const ct=[];for(let d=0;d<Ue.length;d+=7)ct.push(Ue.slice(d,d+7));const nt=C-C%10;return A?null:e.jsxs("div",{className:`nice-calendar nice-calendar--${f}${x?" nice-calendar--full-width":""} ${D||""}`,style:ie,"data-testid":W,children:[e.jsxs("div",{className:"nice-calendar__header",children:[e.jsx("button",{type:"button",className:"nice-calendar__nav",onClick:()=>ze(-1),"aria-label":N("shortcuts.previous","Previous {navLabel}").replace("{navLabel}",String(gt)),children:e.jsx(m.NiceIcon,{name:"chevron-left",size:16})}),e.jsx("button",{type:"button",className:"nice-calendar__title",onClick:B,"aria-label":H==="days"?N("shortcuts.showMonthPicker","Show month picker"):H==="months"?N("shortcuts.showYearPicker","Show year picker"):void 0,disabled:H==="years",children:dt}),e.jsx("button",{type:"button",className:"nice-calendar__nav",onClick:()=>ze(1),"aria-label":N("shortcuts.next","Next {navLabel}").replace("{navLabel}",String(gt)),children:e.jsx(m.NiceIcon,{name:"chevron-right",size:16})}),_e&&e.jsx(m.NiceKeyboardHint,{shortcuts:xe,size:"sm"})]}),H==="days"&&e.jsxs("table",{ref:k,className:"nice-calendar__grid",role:"grid","aria-label":dt,onKeyDown:lt,onMouseLeave:Re?()=>je(null):void 0,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[b&&e.jsx("th",{className:"nice-calendar__wk",children:"W"}),te.map(d=>e.jsx("th",{children:d},d))]})}),e.jsx("tbody",{children:ct.map((d,G)=>e.jsxs("tr",{children:[b&&e.jsx("td",{className:"nice-calendar__wk",children:d.find(Ae=>Ae!=null)?ea(new Date(C,F,d.find(Ae=>Ae!=null))):""}),d.map((Ae,at)=>{if(Ae==null)return e.jsx("td",{className:"nice-calendar__empty-cell"},at);const He=wt(C,F,Ae),Ge=Oe(He),ot=g(He),yt=He===qe,c=T!==""&&He>=T&&He<=p?` nice-calendar__day--in-range${He===T?" nice-calendar__day--range-start":""}${He===p?" nice-calendar__day--range-end":""}`:"";return e.jsx("td",{className:`nice-calendar__day${ot?" nice-calendar__day--selected":""}${c}${yt?" nice-calendar__day--today":""}${Ge?" nice-calendar__day--disabled":""}`,onClick:()=>!Ge&&ce(He),onMouseEnter:Re&&!Ge?()=>je(He):void 0,onFocus:Re&&!Ge?()=>je(He):void 0,role:"gridcell","data-iso":He,tabIndex:He===Qe?0:-1,"aria-selected":ot,"aria-disabled":Ge,"aria-current":yt?"date":void 0,children:X?X(He,Ae):Ae},at)})]},G))})]}),H==="months"&&e.jsx("div",{ref:Ce,className:"nice-calendar__picker-grid",children:nn.map((d,G)=>e.jsx("button",{type:"button",className:`nice-calendar__picker-cell${G===F&&C===V.getFullYear()?" nice-calendar__picker-cell--selected":""}`,"aria-current":G===F||void 0,onClick:()=>ht(G),children:d.slice(0,3)},G))}),H==="years"&&e.jsx("div",{ref:Ce,className:"nice-calendar__picker-grid",children:Array.from({length:12},(d,G)=>nt-1+G).map(d=>e.jsx("button",{type:"button",className:`nice-calendar__picker-cell${d===C?" nice-calendar__picker-cell--selected":""}${d<nt||d>nt+9?" nice-calendar__picker-cell--other":""}`,"aria-current":d===C||void 0,onClick:()=>rt(d),children:d},d))})]})};process.env.NODE_ENV!=="production"&&(Xt.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}},an={date:"yyyy-MM-dd","datetime-local":"yyyy-MM-ddTHH:mm",month:"yyyy-MM",week:"yyyy-Www",time:"HH:mm"},ta={"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 zt(t){const i=(t||"").toLowerCase().replace("_","-"),a=i.split("-")[0],o={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(o[i])return o[i];if(o[a])return o[a];try{const r=new Intl.DateTimeFormat(t,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2024,0,15));let f="";for(const b of r)if(b.type==="day")f+="dd";else if(b.type==="month")f+="MM";else if(b.type==="year")f+="yyyy";else if(b.type==="literal"){const w=b.value.replace(/[\u00A0\u202F\u2009]/g," ").trim();f+=w||"."}return!/y/.test(f)||!/M/.test(f)||!/d/.test(f)?"yyyy-MM-dd":f}catch{return"yyyy-MM-dd"}}function na(t){const a=zt(t).replace(/dd[^\w]*/g,"").replace(/[^\w]*dd/g,"");return!/y/.test(a)||!/M/.test(a)?"yyyy-MM":a}function Wt(){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 yn(t,i,a,o=!1){an[t]||(t="date");let s=an[t];o&&(t==="datetime-local"||t==="time")&&(s=s.replace("HH:mm","HH:mm:ss"));let r=s;i&&(t==="date"||t==="datetime-local"||t==="month")&&(t==="date"?r=zt(a):t==="datetime-local"?r=`${zt(a)} HH:mm${o?":ss":""}`:r=na(a)),t==="datetime-local"&&(r=r.replace("T"," · "));const f=ta[r]??r.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:r,isoTpl:s,placeholder:f}}const aa=new Set(["y","M","d","H","m","s","w"]);function ut(t){return aa.has(t)}function At(t){let i=0;for(const a of t)ut(a)&&i++;return i}function Ut(t,i){let a="",o=0;for(const s of t)if(ut(s)){if(o>=i.length)break;a+=i[o++]}else{if(o===0)break;o>=i.length,a+=s}return a}function ia(t,i,a){if(a.length===0)return"";const o={};let s=0;for(const b of t)ut(b)&&(s>=a.length?(o[b]??(o[b]=[])).push(""):(o[b]??(o[b]=[])).push(a[s]),s++);const r={};let f="";for(const b of i)if(ut(b)){const w=o[b]??[],D=r[b]??0;f+=w[D]??"",r[b]=D+1}return f}function ft(t,i,a){if(a.length===0)return"";const o={};let s=0;for(const b of i)ut(b)&&((o[b]??(o[b]=[])).push(a[s]??""),s++);const r={};let f="";for(const b of t)if(ut(b)){const w=o[b]??[],D=r[b]??0;f+=w[D]??"",r[b]=D+1}return f.replace(/\s+$/,"")}function Bt(t,i,a){const o=At(i);if(a.length<o)return"";const s=ia(t,i,a);if(s.length<o)return"";let r="",f=0;for(const b of i)ut(b)?r+=s[f++]:r+=b;return r}function _n(t,i){return yn(t?gn[t].inputType:"date",!0,i)}const bn={slots:t=>At(t.displayTpl),render:(t,i)=>Ut(t.displayTpl,i),toIso:(t,i)=>Bt(t.displayTpl,t.isoTpl,i),fromIso:(t,i)=>ft(t.displayTpl,t.isoTpl,i.replace(/\D/g,""))};function sn(t,i,a){return t&&(i&&t<i?i:a&&t>a?a:t)}function De(t){return t.toString().padStart(2,"0")}function $t(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 ln(t,i,a,o,s){const r=s?`${De(i)}:${De(a)}:${De(o)}`:`${De(i)}:${De(a)}`;return t.replace(/\d{2}:\d{2}(?::\d{2})?$/,r)}function xn(t,i){if(t<=0)return i;const a=Math.floor(t/864e5),o=`${De(Math.floor(t%864e5/36e5))}:${De(Math.floor(t%36e5/6e4))}:${De(Math.floor(t%6e4/1e3))}`;return a>0?`${a}d ${o}`:o}function sa(t,i){if(t<=0)return i;const a=Math.floor(t/864e5),o=Math.floor(t%864e5/36e5),s=Math.floor(t%36e5/6e4),r=Math.floor(t%6e4/1e3),f=[];return a&&f.push(`${a}d`),(a||o)&&f.push(`${o}h`),(a||o||s)&&f.push(`${s}m`),f.push(`${r}s`),f.join(" ")}function la(t,i){if(t<=0)return i;const a=Math.floor(t/1e3),o=Math.floor(a/3600),s=Math.floor(a%3600/60),r=a%60;return o>0?`${De(o)}:${De(s)}:${De(r)}`:`${De(s)}:${De(r)}`}function ca(t,i){if(t<=0)return i;const a=Math.floor(t/1e3),o=Math.floor(a/86400);if(o)return`${o}d`;const s=Math.floor(a/3600);if(s)return`${s}h`;const r=Math.floor(a/60);return r?`${r}m`:`${a}s`}function oa(t,i){if(t<=0)return i;const a=Math.floor(t/1e3),o=Math.floor(a/86400),s=Math.floor(a%86400/3600),r=Math.floor(a%3600/60),f=[];return o&&f.push(`${o} ${o===1?"day":"days"}`),s&&f.push(`${s} ${s===1?"hour":"hours"}`),r&&f.push(`${r} ${r===1?"minute":"minutes"}`),f.length?f.join(", "):"less than a minute"}const ra={verbose:xn,compact:sa,short:la,minimal:ca,words:oa};function da(t,i,a){const o=t?$t(t):null,{hours:s,minutes:r,seconds:f}=o??{hours:0,minutes:0,seconds:0},b=new Date(a);if(i!=null){const D=typeof i=="string"?new Date(i):new Date(i.getTime());if(!Number.isNaN(D.getTime()))return D.setHours(s,r,f,0),D}if(t&&/^\d{4}-\d{2}-\d{2}T/.test(t)){const D=new Date(t);if(!Number.isNaN(D.getTime()))return D}const w=new Date(b);return w.setHours(s,r,f,0),w.getTime()<=b.getTime()&&w.setDate(w.getDate()+1),w}function Mt(t,i){if(!t)return"";const a=t.replace(/[^0-9]/g,""),o=At(i);return a.slice(0,o)}function st(t,i,a){const o=Ut(t,a);let s=0;const r=Math.min(i,o.length);for(let f=0;f<r;f++)ut(t[f])&&s++;return Math.min(s,a.length)}function ua(t,i,a){if(a<=0)return 0;const o=Ut(t,i);let s=0;for(let r=0;r<o.length;r++)if(ut(t[r])&&(s++,s===a)){let f=r+1;for(;f<o.length&&!ut(t[f]);)f++;return f}return o.length}const Ot=40;function pa(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const fa=({label:t,value:i,max:a,step:o,onPick:s,onStep:r,startHold:f,stopHold:b})=>{const w=n.useRef(null),D=n.useRef(!1),ie=n.useRef(null),I=n.useRef(null),M=n.useMemo(()=>{const x=[],O=o>0?o:1;for(let L=0;L<=a;L+=O)x.push(L);return x},[a,o]),re=Math.max(0,Math.min(M.length-1,Math.round(i/(o>0?o:1)))),Y=M.length,Z=n.useMemo(()=>[...M,...M,...M],[M]),U=Y+re,$=n.useRef(!1);n.useLayoutEffect(()=>{const x=w.current;if(!x)return;const O=U*Ot;if(Math.abs(x.scrollTop-O)<1)return;const L=Math.abs(x.scrollTop/Ot-U);D.current=!0,ie.current&&(clearTimeout(ie.current),ie.current=null);const E=$.current&&L<=3&&!pa();x.scrollTo({top:O,behavior:E?"smooth":"instant"}),$.current=!0,I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{D.current=!1},380)},[U]),n.useEffect(()=>()=>{ie.current&&clearTimeout(ie.current),I.current&&clearTimeout(I.current)},[]);const ee=()=>{D.current||(ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{const x=w.current;if(!x)return;const O=Math.round(x.scrollTop/Ot),L=M[(O%Y+Y)%Y];L!==i&&s(L)},110))},Q=x=>s(M[(x%Y+Y)%Y]),X=x=>{x.key==="ArrowUp"?(x.preventDefault(),r(-1)):x.key==="ArrowDown"?(x.preventDefault(),r(1)):x.key==="PageUp"||x.key==="PageDown"?(x.preventDefault(),Q(re+(x.key==="PageUp"?-5:5))):(x.key==="Home"||x.key==="End")&&(x.preventDefault(),Q(x.key==="Home"?0:Y-1))},_e=x=>{const O=x.replace(/\D/g,"");if(!O)return;const L=Number(O.slice(-2));s(Math.max(0,Math.min(a,L)))},ue=x=>{w.current&&w.current.scrollBy({top:x.deltaY})};return e.jsxs("div",{className:"nice-datetime-popup__spinner",role:"group","aria-label":t,children:[e.jsx("div",{ref:w,className:"nice-datetime-popup__spin-column","aria-hidden":"true",onScroll:ee,children:Z.map((x,O)=>e.jsx("button",{type:"button",className:`nice-datetime-popup__spin-item${O===U?" is-selected":""}`,onClick:()=>s(x),tabIndex:-1,children:De(x)},O))}),e.jsxs("div",{className:"nice-datetime-popup__spin-center",onWheel:ue,children:[e.jsx("button",{type:"button",className:"nice-datetime-popup__spin-btn",onClick:()=>r(-1),onPointerDown:()=>f(()=>r(-1)),onPointerUp:b,onPointerLeave:b,"aria-label":`${t} -`,tabIndex:-1,children:e.jsx(m.NiceIcon,{name:"chevron-up",size:14})}),e.jsx("input",{className:"nice-datetime-popup__spin-value",inputMode:"numeric",role:"spinbutton","aria-label":t,"aria-valuenow":i,"aria-valuemin":M[0],"aria-valuemax":M[Y-1],"aria-valuetext":De(i),value:De(i),onFocus:x=>x.currentTarget.select(),onChange:x=>_e(x.target.value),onKeyDown:X}),e.jsx("button",{type:"button",className:"nice-datetime-popup__spin-btn",onClick:()=>r(1),onPointerDown:()=>f(()=>r(1)),onPointerUp:b,onPointerLeave:b,"aria-label":`${t} +`,tabIndex:-1,children:e.jsx(m.NiceIcon,{name:"chevron-down",size:14})})]})]})},ma=({hours:t,minutes:i,minuteStep:a,onChange:o,t:s})=>{const[r,f]=n.useState("hours"),b=n.useRef(null),w=100,D=78,ie=52,I=62,M=65,re=18,Y=t>=12?"PM":"AM",Z=t%12===0?12:t%12,U=(h,u)=>{const V=(h-90)*Math.PI/180;return{x:w+u*Math.cos(V),y:w+u*Math.sin(V)}},$=h=>{const u=Y==="PM"?h%12+12:h%12;o(u,i)},ee=h=>{const u=a&&a>1?a:1,V=Math.round(h/u)*u%60;o(t,V)},Q=h=>{if(h===Y)return;const u=h==="PM"?t+12:t-12;o((u%24+24)%24,i)},X=h=>{const u=h.currentTarget.getBoundingClientRect(),V=(h.clientX-u.left)/u.width*200-w,R=(h.clientY-u.top)/u.height*200-w;let y=Math.atan2(R,V)*180/Math.PI+90;return y<0&&(y+=360),{ang:y,radius:Math.hypot(V,R)}},_e=(h,u)=>{if(h==="hours"){const V=Math.round(u/30)%12;$(V===0?12:V)}else ee(Math.round(u/6)%60)},ue=h=>{const{ang:u,radius:V}=X(h);if(V<re)return;const R=V>M?"hours":"minutes";b.current=R,f(R),h.currentTarget.setPointerCapture?.(h.pointerId),_e(R,u)},x=h=>{const u=b.current;u&&_e(u,X(h).ang)},O=h=>{b.current&&(b.current=null,h.currentTarget.releasePointerCapture?.(h.pointerId))},L=Array.from({length:12},(h,u)=>u+1),E=a&&a>1?a:5,ye=[];for(let h=0;h<60;h+=E)ye.push(h);const ne=a&&a>1?a:1,W=Math.round(i/ne)*ne%60,K=h=>u=>{const V=h==="hours"?3:Math.max(1,Math.round(15/ne)),R=u.key==="ArrowUp"||u.key==="ArrowRight"?1:u.key==="ArrowDown"||u.key==="ArrowLeft"?-1:u.key==="PageUp"?V:u.key==="PageDown"?-V:0,y=u.key==="Home"?"min":u.key==="End"?"max":null;if(!(!R&&!y))if(u.preventDefault(),f(h),h==="hours"){const j=y==="min"?0:y==="max"?23:((t+R)%24+24)%24;o(j,i)}else{const j=y==="min"?0:y==="max"?60-ne:((W+R*ne)%60+60)%60;o(t,j)}},A=r==="hours",se=U(Z%12*30,D),N=U(W*6,ie);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${r==="hours"?" nice-datetime-popup__clock-seg--active":""}`,onClick:()=>f("hours"),onKeyDown:K("hours"),role:"spinbutton","aria-label":s("datetime.hours","Hours"),"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":23,"aria-valuetext":`${De(Z)} ${Y==="AM"?s("datetime.am","AM"):s("datetime.pm","PM")}`,children:De(Z)}),e.jsx("span",{className:"nice-datetime-popup__clock-colon",children:":"}),e.jsx("button",{type:"button",className:`nice-datetime-popup__clock-seg${r==="minutes"?" nice-datetime-popup__clock-seg--active":""}`,onClick:()=>f("minutes"),onKeyDown:K("minutes"),role:"spinbutton","aria-label":s("datetime.minutes","Minutes"),"aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":59,children:De(i)}),e.jsxs("div",{className:"nice-datetime-popup__clock-ampm",role:"group",children:[e.jsx("button",{type:"button",className:`nice-datetime-popup__clock-period${Y==="AM"?" nice-datetime-popup__clock-period--active":""}`,onClick:()=>Q("AM"),"aria-pressed":Y==="AM",children:s("datetime.am","AM")}),e.jsx("button",{type:"button",className:`nice-datetime-popup__clock-period${Y==="PM"?" nice-datetime-popup__clock-period--active":""}`,onClick:()=>Q("PM"),"aria-pressed":Y==="PM",children:s("datetime.pm","PM")})]})]}),e.jsxs("svg",{viewBox:"0 0 200 200",className:"nice-datetime-popup__clock-face",onPointerDown:ue,onPointerMove:x,onPointerUp:O,onPointerCancel:O,role:"img","aria-label":s("datetime.clockMode","Analog clock"),children:[e.jsx("circle",{cx:w,cy:w,r:96,className:"nice-datetime-popup__clock-bg"}),ye.map(h=>{const u=U(h*6,I);return e.jsx("circle",{cx:u.x,cy:u.y,r:h===W?2.6:1.5,className:`nice-datetime-popup__clock-tick${h===W?" nice-datetime-popup__clock-tick--active":""}`},`tick-${h}`)}),e.jsx("line",{x1:w,y1:w,x2:se.x,y2:se.y,className:`nice-datetime-popup__clock-hand nice-datetime-popup__clock-hand--hour${A?" nice-datetime-popup__clock-hand--active":""}`}),e.jsx("line",{x1:w,y1:w,x2:N.x,y2:N.y,className:`nice-datetime-popup__clock-hand nice-datetime-popup__clock-hand--minute${A?"":" nice-datetime-popup__clock-hand--active"}`}),e.jsx("circle",{cx:se.x,cy:se.y,r:15,className:"nice-datetime-popup__clock-knob"}),e.jsx("circle",{cx:N.x,cy:N.y,r:12,className:"nice-datetime-popup__clock-knob nice-datetime-popup__clock-knob--minute"}),e.jsx("circle",{cx:w,cy:w,r:4,className:"nice-datetime-popup__clock-center"}),L.map(h=>{const u=U(h*30,D);return e.jsx("text",{x:u.x,y:u.y,className:`nice-datetime-popup__clock-num${h===Z?" nice-datetime-popup__clock-num--active":""}`,textAnchor:"middle",dominantBaseline:"central",children:h},`h-${h}`)}),ye.map(h=>{const u=U(h*6,ie);return e.jsx("text",{x:u.x,y:u.y,className:`nice-datetime-popup__clock-num nice-datetime-popup__clock-num--minute${h===W?" nice-datetime-popup__clock-num--active":""}`,textAnchor:"middle",dominantBaseline:"central",children:De(h)},`m-${h}`)})]})]})},St=Object.assign(n.forwardRef(({label:t,helperText:i,error:a,required:o,disabled:s,readOnly:r,size:f="md",name:b,id:w,className:D,style:ie,accessMode:I,value:M,onChange:re,onBlur:Y,onKeyDown:Z,min:U,max:$,dateFormatPreset:ee,submitOnEnter:Q,onSubmit:X,showKeyboardHints:_e,displayStyle:ue,labelPlacement:x,errorPlacement:O,loading:L,labelWidth:E,controlWidth:ye,placeholder:ne,clearable:W=!1,showPickerButton:K=!0,displayLocale:A,keyboardShortcuts:se=!0,showSeconds:N=!1,minuteStep:h=1,showNow:u=!1,hourFormat:V="24",timeSelectorType:R="spinners",targetDate:y,onTargetChange:j,countdown:C=!1,countdownFormat:ae="verbose",formatCountdown:F,countdownLabel:pe,countdownInterval:H=1e3,countdownDoneText:he},be)=>{const ge=m.useComponentDisplayStyle("input",ue),$e=m.useComponentDisplayClass("input",ue),Ee=m.useNiceAccessMode(I,w),je=Ee==="hidden";Ee==="disabled"&&(s=!0),Ee==="readOnly"&&(r=!0);const{t:le}=m.useNiceTranslation(),P=m.useControlId(w),q=n.useRef(null),xe=n.useRef(null),Fe=n.useRef(null),z=n.useRef(null),[te,Oe]=n.useState(!1),[ze,qe]=n.useState(null),[Re,g]=n.useState(""),[T,p]=n.useState(R);n.useEffect(()=>{p(R)},[R]);const ce=n.useContext(m.NiceThemeContext),B=ce?.portalTarget??(typeof document<"u"?document.body:null),{start:oe,stop:Se}=m.useHoldRepeat(),k=ee?gn[ee]:null,Ce=k?.inputType??"date",de=k?.localized??!1,Ie=A??Wt(),v=n.useMemo(()=>yn(Ce,de,Ie,N),[Ce,de,Ie,N]),we=n.useMemo(()=>At(v.isoTpl),[v.isoTpl]),[Qe,et]=n.useState(()=>{const l=Mt(M,v.isoTpl);return ft(v.displayTpl,v.isoTpl,l)}),tt=n.useRef(Qe);n.useEffect(()=>{tt.current=Qe},[Qe]);const Xe=n.useRef(M??""),lt=n.useRef(null);n.useEffect(()=>{const l=M??"";if(l===Xe.current)return;const _=Mt(l,v.isoTpl),S=ft(v.displayTpl,v.isoTpl,_);et(S),Xe.current=l},[M,v.displayTpl,v.isoTpl]),n.useEffect(()=>{const l=Mt(M,v.isoTpl);et(ft(v.displayTpl,v.isoTpl,l))},[v.displayTpl,v.isoTpl]),n.useEffect(()=>{if(lt.current==null)return;const l=lt.current;lt.current=null;const _=q.current;if(_&&document.activeElement===_)try{_.setSelectionRange(l,l)}catch{}});const ht=n.useMemo(()=>Ut(v.displayTpl,Qe),[v.displayTpl,Qe]),rt=ne??v.placeholder,dt=Math.max(v.displayTpl.length+1,9),gt=m.useSubmitOnEnter({enabled:Q,onSubmit:X}),Ue=n.useCallback((l,_)=>{const S=l.slice(0,we);tt.current=S,et(S),lt.current=ua(v.displayTpl,S,Math.max(0,Math.min(S.length,_)));const Ne=sn(Bt(v.displayTpl,v.isoTpl,S),U,$);Ne!==Xe.current&&(Xe.current=Ne,re?.(Ne))},[re,v.displayTpl,v.isoTpl,we,U,$]),ct=n.useCallback(l=>{const _=sn(l,U,$),S=Mt(_,v.isoTpl);Xe.current=_,et(ft(v.displayTpl,v.isoTpl,S)),re?.(_)},[re,v.displayTpl,v.isoTpl,U,$]),nt=Ce==="time"||Ce==="datetime-local",d=n.useCallback(()=>Bt(v.displayTpl,v.isoTpl,tt.current),[v.displayTpl,v.isoTpl]),G=n.useCallback(()=>{if(s||r)return;const l=d(),_=l?$t(l):null;if(!_)return;const S=_.hours>=12?_.hours-12:_.hours+12;ct(ln(l,S,_.minutes,_.seconds,N))},[s,r,d,ct,N]),Ae=(()=>{const l=$t(M??"");return l&&l.hours>=12?le("datetime.pm","PM"):le("datetime.am","AM")})(),at=n.useCallback(l=>{if(gt(l),r||s){Z?.(l);return}const _=l.key;if(l.ctrlKey||l.metaKey||l.altKey){Z?.(l);return}if(nt&&(_==="ArrowUp"||_==="ArrowDown")){const ve=d(),Pe=ve?$t(ve):null;if(Pe){l.preventDefault();const Me=_==="ArrowUp"?1:-1;let{minutes:Ve,seconds:We}=Pe;N?We=((We+Me)%60+60)%60:Ve=((Ve+Me*h)%60+60)%60,ct(ln(ve,Pe.hours,Ve,We,N)),Z?.(l);return}}const S=tt.current;if(_==="Escape"&&S.length>0){l.preventDefault(),Ue("",0),Z?.(l);return}if(se&&(v.isoTpl==="yyyy-MM-dd"||v.isoTpl==="yyyy-MM-ddTHH:mm"||v.isoTpl==="yyyy-MM")){const ve=Me=>{const Ve=String(Me.getFullYear()).padStart(4,"0"),We=String(Me.getMonth()+1).padStart(2,"0"),vt=String(Me.getDate()).padStart(2,"0");let Ct="";if(v.isoTpl==="yyyy-MM")Ct=`${Ve}-${We}`;else if(v.isoTpl==="yyyy-MM-dd")Ct=`${Ve}-${We}-${vt}`;else{const $n=String(Me.getHours()).padStart(2,"0"),wn=String(Me.getMinutes()).padStart(2,"0");Ct=`${Ve}-${We}-${vt}T${$n}:${wn}`}ct(Ct)},Pe=()=>{if(M&&/^\d{4}-\d{2}/.test(M)){const Me=new Date(M);if(!Number.isNaN(Me.getTime()))return Me}return new Date};if(_==="t"||_==="T"){l.preventDefault(),ve(new Date),Z?.(l);return}if(_==="+"||_==="="||_==="-"){l.preventDefault();const Me=_==="-"?-1:1,Ve=Pe();Ve.setDate(Ve.getDate()+Me),ve(Ve),Z?.(l);return}if(_==="m"||_==="M"){l.preventDefault();const Me=Pe();Me.setMonth(Me.getMonth()+(_==="M"?-1:1)),ve(Me),Z?.(l);return}if(_==="y"||_==="Y"){l.preventDefault();const Me=Pe();Me.setFullYear(Me.getFullYear()+(_==="Y"?-1:1)),ve(Me),Z?.(l);return}}const Ne=l.currentTarget,Ye=Ne.selectionStart??0,Ke=Ne.selectionEnd??0;if(/^[0-9]$/.test(_)){l.preventDefault();const ve=st(v.displayTpl,Ye,S),Pe=st(v.displayTpl,Ke,S),Me=S.slice(0,ve),Ve=S.slice(Pe);let We=(Me+_+Ve).slice(0,we);ve===Pe&&Me.length+1+Ve.length>we&&(We=(Me+_+Ve.slice(1)).slice(0,we)),Ue(We,ve+1),Z?.(l);return}if(_==="Backspace"){if(l.preventDefault(),Ye!==Ke){const ve=st(v.displayTpl,Ye,S),Pe=st(v.displayTpl,Ke,S),Me=S.slice(0,ve)+S.slice(Pe);Ue(Me,ve)}else{const ve=st(v.displayTpl,Ye,S);if(ve===0){Z?.(l);return}const Pe=S.slice(0,ve-1)+S.slice(ve);Ue(Pe,ve-1)}Z?.(l);return}if(_==="Delete"){if(l.preventDefault(),Ye!==Ke){const ve=st(v.displayTpl,Ye,S),Pe=st(v.displayTpl,Ke,S),Me=S.slice(0,ve)+S.slice(Pe);Ue(Me,ve)}else{const ve=st(v.displayTpl,Ye,S);if(ve>=S.length){Z?.(l);return}const Pe=S.slice(0,ve)+S.slice(ve+1);Ue(Pe,ve)}Z?.(l);return}Z?.(l)},[Ue,s,gt,Z,r,v.displayTpl,v.isoTpl,we,se,M,nt,d,ct,N,h]),[He,Ge]=n.useState(()=>Date.now());n.useEffect(()=>{if(!C)return;const l=window.setInterval(()=>Ge(Date.now()),Math.max(100,H));return()=>window.clearInterval(l)},[C,H]);const ot=n.useMemo(()=>da(M,y,He),[M,y,He]),yt=n.useRef(0);n.useEffect(()=>{if(!j)return;const l=ot.getTime();l!==yt.current&&(yt.current=l,j(ot))},[ot,j]);const bt=n.useMemo(()=>{if(!C)return null;const l=ot.getTime()-He;return F?F(l,ot):(ra[ae]??xn)(l,he??le("datetime.countdownDone","Done"))},[C,ot,He,F,ae,he,le]),c=n.useCallback(l=>{if(r||s)return;const _=l.clipboardData.getData("text");if(!_)return;l.preventDefault();const S=tt.current,Ne=_.replace(/[^0-9]/g,"");let Ye;Ne.length===we&&(_.includes("-")||_.includes("T"))?Ye=ft(v.displayTpl,v.isoTpl,Ne):Ye=Ne.slice(0,we);const Ke=l.currentTarget,ve=Ke.selectionStart??0,Pe=Ke.selectionEnd??0,Me=st(v.displayTpl,ve,S),Ve=st(v.displayTpl,Pe,S),We=S.slice(0,Me),vt=S.slice(Ve),Ct=(We+Ye+vt).slice(0,we);Ue(Ct,Math.min(we,We.length+Ye.length))},[Ue,s,r,v.displayTpl,v.isoTpl,we]),J=n.useCallback(l=>{const _=l;if(_.inputType==="insertText"||_.inputType==="insertCompositionText"||_.inputType==="insertFromComposition"){const S=_.data??"";if(!/^[0-9]+$/.test(S)){l.preventDefault();return}if(S.length>1){l.preventDefault();const Ne=l.currentTarget,Ye=Ne.selectionStart??0,Ke=Ne.selectionEnd??0,ve=tt.current,Pe=st(v.displayTpl,Ye,ve),Me=st(v.displayTpl,Ke,ve),Ve=ve.slice(0,Pe),We=ve.slice(Me),vt=(Ve+S+We).slice(0,we);Ue(vt,Math.min(we,Ve.length+S.length))}}},[Ue,v.displayTpl,we]),fe=n.useCallback(l=>{if(r||s)return;const _=l.target.value,S=_.replace(/[^0-9]/g,"").slice(0,we);if(S!==tt.current)if(S.length===we&&(_.includes("-")||_.includes("T")||_.includes(":"))){const Ne=ft(v.displayTpl,v.isoTpl,S);Ue(Ne,Ne.length)}else Ue(S,S.length)},[Ue,s,r,v.displayTpl,v.isoTpl,we]),ke=n.useCallback(()=>{Ue("",0),requestAnimationFrame(()=>q.current?.focus())},[Ue]),Te=n.useCallback(()=>{if(s||r)return;if(Ce==="date"||Ce==="datetime-local"||Ce==="time"){Oe(S=>!S);return}const l=xe.current;if(!l)return;const _=l;try{if(typeof _.showPicker=="function"){_.showPicker();return}}catch{}l.focus(),l.click()},[s,r,Ce]),me=K&&!s&&!r;m.useIntent(["secondary"],()=>{Te()},{ref:Fe,enabled:me}),m.useInputHints(Fe,[{intent:"secondary",label:le("controls.openPicker","Open picker")}],{enabled:me});const Be=n.useCallback(l=>{const _=l.target.value,S=Mt(_,v.isoTpl),Ne=ft(v.displayTpl,v.isoTpl,S);Xe.current=_,et(Ne),re?.(_),requestAnimationFrame(()=>q.current?.focus())},[re,v.displayTpl,v.isoTpl]),Le=n.useCallback(()=>{if(s||r)return;const l=new Date,_=Pe=>String(Pe).padStart(2,"0"),S=`${l.getFullYear()}-${_(l.getMonth()+1)}-${_(l.getDate())}`,Ne=`${_(l.getHours())}:${_(l.getMinutes())}`,Ye=N?`${Ne}:${_(l.getSeconds())}`:Ne;let Ke;Ce==="time"?Ke=Ye:Ce==="datetime-local"?Ke=`${S}T${Ye}`:Ce==="month"?Ke=`${l.getFullYear()}-${_(l.getMonth()+1)}`:Ke=S;const ve=Mt(Ke,v.isoTpl);Xe.current=Ke,et(ft(v.displayTpl,v.isoTpl,ve)),re?.(Ke)},[s,r,Ce,N,re,v.displayTpl,v.isoTpl]),Ze=Ce==="date"||Ce==="datetime-local",jt=(()=>{const l=/^(\d{4}-\d{2}-\d{2})/.exec(M??"");return l?l[1]:""})(),it=$t(M??"")??{hours:0,minutes:0,seconds:0},pt=()=>{const l=new Date;return`${l.getFullYear()}-${De(l.getMonth()+1)}-${De(l.getDate())}`},mt=(l,_)=>{const S=N?`${De(_.hours)}:${De(_.minutes)}:${De(_.seconds)}`:`${De(_.hours)}:${De(_.minutes)}`;let Ne;Ce==="time"?Ne=S:Ce==="datetime-local"?Ne=`${l}T${S}`:Ne=l,ct(Ne)},kt=l=>{l&&mt(l,nt?it:{hours:0,minutes:0,seconds:0})},Dt=(l,_)=>{mt(Ze?jt||pt():"",{...it,[l]:_})},Rt=l=>l==="hours"?23:59,xt=l=>l==="minutes"&&h&&h>0?h:1,Cn=(l,_)=>{const S=Rt(l),Ne=xt(l),Ye=S+1,Ke=((it[l]+_*Ne)%Ye+Ye)%Ye;Dt(l,Ke)},Et=(l,_,S)=>e.jsx(fa,{label:le(_,S),value:it[l],max:Rt(l),step:xt(l),onPick:Ne=>Dt(l,Ne),onStep:Ne=>Cn(l,Ne),startHold:oe,stopHold:Se}),Nn=()=>{mt(pt(),nt?it:{hours:0,minutes:0,seconds:0})},It=(()=>{const l=pt(),_=U&&U.length>=10?U.slice(0,10):U,S=$&&$.length>=10?$.slice(0,10):$;return!!(_&&l<_||S&&l>S)})(),Mn=()=>{Oe(!1),requestAnimationFrame(()=>q.current?.focus())};n.useLayoutEffect(()=>{if(!te)return;const l=Fe.current?.getBoundingClientRect();l&&(qe({left:l.left,top:l.bottom+6}),g(ce?.portalTarget?"":Sn.scopeThemeClass(Fe.current)))},[te,ce?.portalTarget]),n.useEffect(()=>{if(!te)return;const l=S=>{const Ne=S.target;Fe.current?.contains(Ne)||z.current?.contains(Ne)||Oe(!1)},_=()=>{const S=Fe.current?.getBoundingClientRect();S&&qe({left:S.left,top:S.bottom+6})};return document.addEventListener("mousedown",l),window.addEventListener("scroll",_,!0),window.addEventListener("resize",_),()=>{document.removeEventListener("mousedown",l),window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",_)}},[te]),m.useOverlayFocus(z,{open:te,modal:!1,initialFocus:'.nice-calendar__grid [tabindex="0"], .nice-datetime-popup__spin-value',onClose:()=>Oe(!1)});const jn=n.useCallback(l=>{q.current=l,typeof be=="function"?be(l):be&&(be.current=l)},[be]),en=n.useMemo(()=>{const l=[];return Q&&l.push(m.COMMON_SHORTCUTS.submit),l.push({key:"Esc",description:le("shortcuts.clearDate","Clear value")}),l},[Q,le]),kn=Ce==="time";return je?null:e.jsxs("div",{className:`nice-field nice-field--${f}${x?` nice-field--label-${x}`:""}${O==="right"?" nice-field--error-right":""} ${L?"nice-field--loading":""} ${D||""}`,style:{...ie,...E!=null&&{"--nice-field-label-width":typeof E=="number"?`${E}px`:E},...ye!=null&&{"--nice-field-control-width":typeof ye=="number"?`${ye}px`:ye}},"aria-busy":L||void 0,children:[t&&e.jsxs("label",{htmlFor:P,className:`nice-field__label ${o?"nice-field__label--required":""}`,children:[t,_e&&en.length>0&&e.jsx(m.NiceKeyboardHint,{shortcuts:en,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{ref:Fe,className:`nice-input nice-input--date nice-input--${f} nice-input--ds-${$e} ${a?"nice-input--error":""} ${s?"nice-input--disabled":""} ${r?"nice-input--readonly":""}`,style:{...ge,position:"relative"},children:[e.jsx("input",{ref:jn,id:P,className:"nice-input__native nice-masked-input",type:"text",name:b,value:ht,placeholder:rt,disabled:s||L,readOnly:r,autoComplete:"off",spellCheck:!1,inputMode:"numeric","aria-invalid":!!a,"aria-label":t?void 0:le("controls.date","Date"),"aria-haspopup":me?"dialog":void 0,"aria-keyshortcuts":me?"Alt+ArrowDown":void 0,"data-display-tpl":v.displayTpl,"data-iso-tpl":v.isoTpl,style:{width:`${dt}ch`,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontVariantNumeric:"tabular-nums"},onBeforeInput:J,onChange:fe,onBlur:Y,onKeyDown:l=>{if(me&&l.altKey&&(l.key==="ArrowDown"||l.key==="ArrowUp")){l.preventDefault(),Te();return}at(l)},onPaste:c}),W&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:ke,disabled:!M||s||r,"aria-label":le("controls.clear","Clear"),tabIndex:M&&!s&&!r?0:-1,children:e.jsx(m.NiceIcon,{name:"close",size:14})}),K&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"nice-input__picker-trigger",onClick:Te,"aria-label":le("controls.openPicker","Open picker"),tabIndex:-1,disabled:s||r,children:kn?e.jsx(m.NiceIcon,{name:"clock",size:16}):e.jsx(m.NiceIcon,{name:"calendar",size:16})}),e.jsx("input",{ref:xe,type:Ce,className:"nice-input__picker-companion",value:M??"",min:U,max:$,step:Ce==="time"||Ce==="datetime-local"?N?1:h?h*60:void 0:void 0,onChange:Be,tabIndex:-1,"aria-hidden":"true",style:{position:"absolute",width:0,height:0,opacity:0,pointerEvents:"none",border:0,padding:0,left:0,bottom:0}})]}),nt&&V==="12"&&!s&&!r&&e.jsx("button",{type:"button",className:"nice-input__ampm",onClick:G,disabled:!M,"aria-label":le("datetime.toggleAmPm","Toggle AM/PM"),tabIndex:-1,children:Ae}),u&&!s&&!r&&e.jsx("button",{type:"button",className:"nice-input__now",onClick:Le,tabIndex:-1,children:le("controls.now","Now")})]}),te&&ze&&B&&cn.createPortal(e.jsxs("div",{ref:z,className:`nice-datetime-popup${Re?` ${Re}`:""}`,style:{position:"fixed",left:ze.left,top:ze.top,zIndex:1e3},role:"dialog","aria-label":le("controls.openPicker","Open picker"),children:[e.jsxs("div",{className:"nice-datetime-popup__body",children:[Ze&&e.jsx("div",{className:"nice-datetime-popup__col nice-datetime-popup__col--date",children:e.jsx(Xt,{value:jt,onChange:kt,min:U&&U.length>=10?U.slice(0,10):void 0,max:$&&$.length>=10?$.slice(0,10):void 0})}),nt&&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":le("datetime.timeSelector","Time selector"),children:[e.jsx("button",{type:"button",className:`nice-datetime-popup__mode-btn${T==="spinners"?" nice-datetime-popup__mode-btn--active":""}`,onClick:()=>p("spinners"),"aria-pressed":T==="spinners","aria-label":le("datetime.spinnersMode","Spinner wheels"),title:le("datetime.spinnersMode","Spinner wheels"),tabIndex:-1,children:e.jsx(m.NiceIcon,{name:"list",size:16})}),e.jsx("button",{type:"button",className:`nice-datetime-popup__mode-btn${T==="clock"?" nice-datetime-popup__mode-btn--active":""}`,onClick:()=>p("clock"),"aria-pressed":T==="clock","aria-label":le("datetime.clockMode","Analog clock"),title:le("datetime.clockMode","Analog clock"),tabIndex:-1,children:e.jsx(m.NiceIcon,{name:"clock",size:16})})]}),T==="clock"?e.jsx(ma,{hours:it.hours,minutes:it.minutes,minuteStep:h,onChange:(l,_)=>mt(Ze?jt||pt():"",{...it,hours:l,minutes:_}),t:le}):e.jsxs("div",{className:"nice-datetime-popup__time",role:"group",children:[Et("hours","datetime.hours","Hours"),e.jsx("span",{className:"nice-datetime-popup__time-sep",children:":"}),Et("minutes","datetime.minutes","Minutes"),N&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nice-datetime-popup__time-sep",children:":"}),Et("seconds","datetime.seconds","Seconds")]})]})]})]}),e.jsxs("div",{className:"nice-datetime-popup__footer",children:[W&&e.jsx("button",{type:"button",className:"nice-datetime-popup__btn",onClick:ke,children:le("controls.clear","Clear")}),Ze&&e.jsx("button",{type:"button",className:"nice-datetime-popup__btn",onClick:Nn,disabled:It,"aria-disabled":It||void 0,children:le("controls.today","Today")}),nt&&e.jsx("button",{type:"button",className:"nice-datetime-popup__btn",onClick:Le,disabled:It,"aria-disabled":It||void 0,children:le("controls.now","Now")}),e.jsx("button",{type:"button",className:"nice-datetime-popup__btn nice-datetime-popup__btn--primary",onClick:Mn,children:le("controls.confirm","Confirm")})]})]}),B),C&&bt!=null&&e.jsxs("span",{className:"nice-datetime__countdown","aria-live":"polite",children:[pe&&e.jsxs("span",{className:"nice-datetime__countdown-label",children:[pe," "]}),e.jsx("span",{className:"nice-datetime__countdown-value",children:bt})]}),L&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),O==="right"&&a&&e.jsx("div",{className:"nice-field__error",role:"alert",children:a}),O==="right"&&!a&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]}),O!=="right"&&a&&e.jsx("div",{className:"nice-field__error",role:"alert",children:a}),O!=="right"&&!a&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]})}),{displayName:"NiceDateTimePicker"}),ha=Object.freeze(Object.defineProperty({__proto__:null,NiceDateTimePicker:St,dateMaskDigits:bn,getDefaultLocale:Wt,rangeMaskSpec:_n},Symbol.toStringTag,{value:"Module"})),ga=[],ya=['input:not([type="hidden"]), select, textarea','[role="combobox"], [role="spinbutton"], [role="slider"], [role="switch"], [role="radiogroup"], [role="listbox"], [role="textbox"]','button, [tabindex]:not([tabindex="-1"])'];function _a(t){for(const i of ya){const a=t.querySelector(i);if(a)return a}return null}const vn=({items:t=ga,data:i,onFieldChange:a,onSubmit:o,dataSource:s,recordKey:r,columns:f=1,responsiveColumns:b,gap:w=16,labelPosition:D="top",size:ie="md",readOnly:I,disabled:M,className:re,style:Y,accessMode:Z,id:U,autoSaveDelay:$,onDirtyChange:ee,showActions:Q,submitLabel:X,resetLabel:_e,onCancel:ue,cancelLabel:x,"data-testid":O})=>{const{t:L}=m.useNiceTranslation(),E=X??L("form.submit","Submit"),ye=_e??L("form.reset","Reset"),ne=x??L("form.cancel","Cancel"),W=m.useNiceAccessMode(Z,U),K=W==="hidden";W==="disabled"&&(M=!0),W==="readOnly"&&(I=!0);const A=m.useNiceRecord(s??null,r),se=!!s&&r!=null,N=n.useMemo(()=>se?A.editData:i??{},[se,A.editData,i]),[h]=n.useState(()=>({...N})),[u,V]=n.useState([]),R=n.useMemo(()=>Object.keys(N).some(g=>N[g]!==h[g]),[N,h]),y=n.useRef(!1);n.useEffect(()=>{R!==y.current&&(y.current=R,ee?.(R))},[R,ee]);const j=n.useRef(null),C=n.useCallback(()=>{$&&(j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{se?A.save():o?.(N)},$))},[$,se,A,o,N]),ae=n.useCallback((g,T)=>{I||M||(V(p=>[...p,{field:g,prev:N[g]}]),se?A.set(g,T):a?.(g,T),C())},[se,A,a,I,M,N,C]),F=n.useCallback(()=>{if(u.length===0)return;const g=u[u.length-1];V(T=>T.slice(0,-1)),se?A.set(g.field,g.prev):a?.(g.field,g.prev)},[u,se,A,a]),pe=n.useCallback(g=>{g.preventDefault(),j.current&&clearTimeout(j.current),se?A.save():o?.(N)},[N,o,se,A]),H=n.useRef(null),he=n.useId(),be=n.useCallback(g=>`${he}-f-${g}`,[he]),ge=n.useCallback(g=>`${he}-l-${g}`,[he]);n.useEffect(()=>{const g=H.current;g&&g.querySelectorAll(".nice-form__item[data-field]").forEach(T=>{const p=T.dataset.field??"",ce=[...T.children],B=ce.find(k=>k.classList.contains("nice-form__label")),oe=ce.find(k=>k.classList.contains("nice-form__control")),Se=oe?_a(oe):null;!B||!Se||(Se.id||(Se.id=be(p)),B.htmlFor!==Se.id&&(B.htmlFor=Se.id),Se.getAttribute("aria-labelledby")||Se.setAttribute("aria-labelledby",B.id))})});const[$e,Ee]=n.useState(f);n.useEffect(()=>{if(!b||!H.current){Ee(f);return}const g=H.current,T=new ResizeObserver(p=>{const ce=p[0]?.contentRect.width??0,B=Object.keys(b).map(Number).sort((oe,Se)=>Se-oe);for(const oe of B)if(ce>=oe){Ee(b[oe]);return}Ee(f)});return T.observe(g),()=>T.disconnect()},[b,f]);const je=n.useMemo(()=>t.filter(g=>!(g.visible===!1||g.hidden||g.visibleWhen&&!g.visibleWhen(N))),[t,N]),le=n.useMemo(()=>{const g=[];let T=null;for(const p of je)!T||T.name!==p.group?(T={name:p.group,items:[p]},g.push(T)):T.items.push(p);return g},[je]),P=n.useCallback(g=>{const T=N[g.field]!==void 0?N[g.field]:g.defaultValue,p=k=>ae(g.field,k);if(g.render)return g.render(T,p,{id:be(g.field),labelId:ge(g.field)});const ce=g.type||"text",B=g.options?.map(k=>typeof k=="string"?{label:k,value:k}:{label:k.label,value:String(k.value)}),oe={size:ie,disabled:M||g.disabled,readOnly:I||g.readOnly},Se=g.placeholder;switch(ce){case"number":return e.jsx(Je.NiceNumberInput,{...oe,value:T??null,onChange:k=>p(k),required:g.required});case"currency":return e.jsx(Je.NiceNumberInput,{...oe,value:T??null,onChange:k=>p(k),required:g.required,precision:g.precision??2,step:g.step??100,suffix:g.unit??"PLN",formatPreset:"money"});case"textarea":return e.jsx(Gt,{...oe,value:T??"",onChange:k=>p(k),rows:3,placeholder:Se});case"address":return e.jsx(Jt,{...oe,value:T??{},onChange:k=>p(k),required:g.required,columns:g.columns??2});case"select":return e.jsx(Je.NiceSelect,{...oe,value:T??"",onChange:k=>p(k),options:B??[],placeholder:Se});case"autocomplete":return e.jsx(on,{...oe,value:T??"",onChange:k=>p(k),options:B??[]});case"radio":return e.jsx(Yt,{...oe,value:T??"",onChange:k=>p(k),options:B??[]});case"checkbox":return e.jsx(Je.NiceCheckbox,{...oe,checked:!!T,onChange:k=>p(k),label:g.label});case"toggle":return e.jsx(_t.NiceToggle,{...oe,checked:!!T,onChange:k=>p(k)});case"date":return e.jsx(St,{...oe,value:T??"",onChange:k=>p(k)});case"time":return e.jsx(St,{...oe,dateFormatPreset:"time",value:T??"",onChange:k=>p(k)});case"datetime":return e.jsx(St,{...oe,dateFormatPreset:"datetime-local",value:T??"",onChange:k=>p(k)});case"color":return e.jsx(Tn.NiceColorPicker,{...oe,value:T??"var(--nice-text-primary, #000000)",onChange:k=>p(k)});case"slider":return e.jsx(Vt,{...oe,value:typeof T=="number"?T:0,onChange:k=>p(k)});case"rating":return e.jsx(Kt,{...oe,value:typeof T=="number"?T:0,onChange:k=>p(k)});case"password":return e.jsx(un,{...oe,value:T??"",onChange:k=>p(k),required:g.required});case"phone":case"tel":return e.jsx(Je.NiceTextInput,{...oe,type:"tel",value:T??"",onChange:k=>p(k),required:g.required});case"country":return e.jsx(Qt,{...oe,value:T??"",onChange:k=>p(k)});case"tags":return e.jsx(pn,{...oe,value:Array.isArray(T)?T:[],onChange:k=>p(k),options:B??[]});case"masked":return e.jsx(dn,{...oe,value:T??"",mask:g.mask??"999-999-9999",onChange:k=>p(k)});case"file":return e.jsx(mn,{...oe,onFilesSelected:k=>p(k)});case"email":return e.jsx(Je.NiceTextInput,{...oe,type:"email",value:T??"",onChange:k=>p(k),required:g.required,placeholder:Se});case"url":return e.jsx(Je.NiceTextInput,{...oe,type:"url",value:T??"",onChange:k=>p(k),required:g.required});default:return e.jsx(Je.NiceTextInput,{...oe,value:T??"",onChange:k=>p(k),required:g.required,placeholder:Se})}},[N,ae,M,I,ie,be,ge]),q=g=>e.jsxs("div",{className:"nice-form__item","data-field":g.field,style:{gridColumn:g.colSpan?`span ${g.colSpan}`:void 0},children:[g.label&&g.type!=="checkbox"&&e.jsxs("label",{className:"nice-form__label",id:ge(g.field),htmlFor:be(g.field),children:[g.label,g.required&&e.jsx("span",{className:"nice-field__required",children:"*"})]}),e.jsx("div",{className:"nice-form__control",children:P(g)}),g.hint&&e.jsx("div",{className:"nice-form__hint",children:g.hint})]},g.field),xe={display:"grid",gridTemplateColumns:`repeat(${$e}, 1fr)`,gap:w},Fe=le.some(g=>g.name!=null),z=n.useMemo(()=>{const g=new Set,T=[];for(const p of je)p.tab&&!g.has(p.tab)&&(g.add(p.tab),T.push(p.tab));return T},[je]),te=z.length>0,[Oe,ze]=n.useState("");n.useEffect(()=>{te&&!z.includes(Oe)&&ze(z[0])},[te,z,Oe]);const qe=g=>{const T=[];let p=null;for(const B of g)!p||p.name!==B.group?(p={name:B.group,items:[B]},T.push(p)):p.items.push(B);return T.some(B=>B.name!=null)?T.map((B,oe)=>e.jsxs("fieldset",{className:B.name?"nice-form__group":"nice-form__group nice-form__group--no-title",children:[B.name&&e.jsx("legend",{className:"nice-form__group-title",children:B.name}),e.jsx("div",{style:xe,children:B.items.map(q)})]},oe)):e.jsx("div",{style:xe,children:g.map(q)})},Re=Q?e.jsxs("div",{className:"nice-form__actions",children:[e.jsxs("div",{className:"nice-form__actions-left",children:[ue&&e.jsx(Ft.NiceButton,{type:"button",variant:"secondary",size:ie,onClick:ue,children:ne}),e.jsx(Ft.NiceButton,{type:"button",variant:"ghost",size:ie,onClick:F,disabled:u.length===0,children:ye})]}),e.jsx("div",{className:"nice-form__actions-right",children:e.jsx(Ft.NiceButton,{type:"submit",variant:"primary",size:ie,children:E})})]}):null;return K?null:e.jsxs("form",{ref:H,className:`nice-form nice-form--label-${D}${R?" nice-form--dirty":""} ${re||""}`,style:Fe||te?{...Y}:{...xe,...Y},onSubmit:pe,"data-testid":O,noValidate:!0,children:[te?e.jsx(_t.NiceTabs,{className:"nice-form__tabs",activeTab:Oe||z[0],onChange:ze,tabs:z.map(g=>({id:g,label:g,content:e.jsx("div",{className:"nice-form__tab-panel",children:qe(je.filter(T=>(T.tab??z[0])===g))})}))}):Fe?le.map((g,T)=>e.jsxs("fieldset",{className:g.name?"nice-form__group":"nice-form__group nice-form__group--no-title",children:[g.name&&e.jsx("legend",{className:"nice-form__group-title",children:g.name}),e.jsx("div",{style:xe,children:g.items.map(q)})]},T)):je.map(q),Re]})};process.env.NODE_ENV!=="production"&&(vn.displayName="NiceForm");exports.COUNTRIES=hn;exports.MASK_PRESETS=rn;exports.NiceAddress=Jt;exports.NiceAutocomplete=on;exports.NiceCalendar=Xt;exports.NiceCountryPicker=Qt;exports.NiceDateTimePicker=St;exports.NiceDateTimePicker$1=ha;exports.NiceForm=vn;exports.NiceMaskedInput=dn;exports.NicePasswordInput=un;exports.NiceRadioGroup=Yt;exports.NiceRadioGroup$1=On;exports.NiceRating=Kt;exports.NiceRating$1=Bn;exports.NiceSlider=Vt;exports.NiceSlider$1=Yn;exports.NiceTagBox=pn;exports.NiceTextArea=Gt;exports.NiceTextArea$1=Kn;exports.NiceUpload=mn;exports.dateMaskDigits=bn;exports.getDefaultLocale=Wt;exports.rangeMaskSpec=_n;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=require("@nice2dev/ui-core"),l=require("react"),v=require("./NiceButton-DzCqkG5a.cjs"),lt=require("./devops-cgRBnZVX.cjs"),at=require("./no-code-B1jzfUF5.cjs"),ve=require("./NiceColorPicker-BLwYNSXJ.cjs");function je(m){const t=m.trim().toLowerCase();return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")||t.startsWith("./")||t.startsWith("../")?!0:!(t.startsWith("javascript:")||t.startsWith("vbscript:")||t.startsWith("data:text"))}function we(m){const t=typeof window<"u"?window.getSelection():null;if(!t||t.rangeCount===0)return null;const _=t.getRangeAt(0);return m.contains(_.commonAncestorContainer)?_.cloneRange():null}function Se(m){const t=typeof window<"u"?window.getSelection():null;!t||!m||(t.removeAllRanges(),t.addRange(m))}const st=[{target:".nice-htmleditor",titleKey:"tutorial.htmlEditor.intro.title",title:"Rich text editor",contentKey:"tutorial.htmlEditor.intro.content",content:"Format text with the toolbar, insert links, images and tables, and switch to HTML or Markdown source when you need it.",placement:"auto"}],ct=["bold","italic","underline","strikethrough","h1","h2","h3","ul","ol","blockquote","hr","link","unlink","image","table","code","alignLeft","alignCenter","alignRight","fontSize","fontColor","undo","redo","clear","findReplace","emoji","source","fullscreen","markdown"],s=m=>r.jsx(u.NiceIcon,{name:m,size:16}),dt={bold:r.jsx("strong",{style:{fontFamily:"serif"},children:"B"}),italic:r.jsx("em",{style:{fontFamily:"serif"},children:"I"}),underline:r.jsx("span",{style:{textDecoration:"underline"},children:"U"}),strikethrough:r.jsx("span",{style:{textDecoration:"line-through"},children:"S"}),h1:"H1",h2:"H2",h3:"H3",ul:s("list"),ol:s("list-ordered"),link:s("link"),unlink:s("unlink"),undo:s("reply"),redo:s("forward"),clear:s("trash"),table:s("table"),image:s("image"),code:s("code"),markdown:"MD",blockquote:s("quote"),hr:s("minus"),subscript:"X₂",superscript:"X²",indent:s("indent"),outdent:s("outdent"),alignLeft:s("align-left"),alignCenter:s("align-center"),alignRight:s("align-right"),alignJustify:s("align-justify"),fullscreen:s("expand"),removeFormat:s("eraser"),print:s("printer"),source:s("terminal"),emoji:s("smile"),findReplace:s("search"),fontSize:s("type"),fontColor:s("palette")},ut=[{value:"1",label:"8pt"},{value:"2",label:"10pt"},{value:"3",label:"12pt"},{value:"4",label:"14pt"},{value:"5",label:"18pt"},{value:"6",label:"24pt"},{value:"7",label:"36pt"}],mt=[{label:"Faces",emojis:["😀","😂","😊","😍","🤔","😢","😎","🥳","😤","🤯","🥰","😴"]},{label:"Hands",emojis:["👍","👎","👏","🤝","✌️","🤞","💪","🙌","👋","🤙"]},{label:"Symbols",emojis:["❤️","⭐","🔥","✅","❌","⚡","💡","📌","🎯","🏆","🎉","💬"]},{label:"Arrows",emojis:["➡️","⬅️","⬆️","⬇️","↩️","🔄","▶️","⏸️","⏹️","⏩"]}];function ft(m){let t=m;return t=t.replace(/<h1[^>]*>(.*?)<\/h1>/gi,`# $1
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=require("@nice2dev/ui-core"),l=require("react"),v=require("./NiceButton-DzCqkG5a.cjs"),lt=require("./devops-o6Zm0VKB.cjs"),at=require("./no-code-CN_q6TcB.cjs"),ve=require("./NiceColorPicker-79rkvaSk.cjs");function je(m){const t=m.trim().toLowerCase();return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")||t.startsWith("./")||t.startsWith("../")?!0:!(t.startsWith("javascript:")||t.startsWith("vbscript:")||t.startsWith("data:text"))}function we(m){const t=typeof window<"u"?window.getSelection():null;if(!t||t.rangeCount===0)return null;const _=t.getRangeAt(0);return m.contains(_.commonAncestorContainer)?_.cloneRange():null}function Se(m){const t=typeof window<"u"?window.getSelection():null;!t||!m||(t.removeAllRanges(),t.addRange(m))}const st=[{target:".nice-htmleditor",titleKey:"tutorial.htmlEditor.intro.title",title:"Rich text editor",contentKey:"tutorial.htmlEditor.intro.content",content:"Format text with the toolbar, insert links, images and tables, and switch to HTML or Markdown source when you need it.",placement:"auto"}],ct=["bold","italic","underline","strikethrough","h1","h2","h3","ul","ol","blockquote","hr","link","unlink","image","table","code","alignLeft","alignCenter","alignRight","fontSize","fontColor","undo","redo","clear","findReplace","emoji","source","fullscreen","markdown"],s=m=>r.jsx(u.NiceIcon,{name:m,size:16}),dt={bold:r.jsx("strong",{style:{fontFamily:"serif"},children:"B"}),italic:r.jsx("em",{style:{fontFamily:"serif"},children:"I"}),underline:r.jsx("span",{style:{textDecoration:"underline"},children:"U"}),strikethrough:r.jsx("span",{style:{textDecoration:"line-through"},children:"S"}),h1:"H1",h2:"H2",h3:"H3",ul:s("list"),ol:s("list-ordered"),link:s("link"),unlink:s("unlink"),undo:s("reply"),redo:s("forward"),clear:s("trash"),table:s("table"),image:s("image"),code:s("code"),markdown:"MD",blockquote:s("quote"),hr:s("minus"),subscript:"X₂",superscript:"X²",indent:s("indent"),outdent:s("outdent"),alignLeft:s("align-left"),alignCenter:s("align-center"),alignRight:s("align-right"),alignJustify:s("align-justify"),fullscreen:s("expand"),removeFormat:s("eraser"),print:s("printer"),source:s("terminal"),emoji:s("smile"),findReplace:s("search"),fontSize:s("type"),fontColor:s("palette")},ut=[{value:"1",label:"8pt"},{value:"2",label:"10pt"},{value:"3",label:"12pt"},{value:"4",label:"14pt"},{value:"5",label:"18pt"},{value:"6",label:"24pt"},{value:"7",label:"36pt"}],mt=[{label:"Faces",emojis:["😀","😂","😊","😍","🤔","😢","😎","🥳","😤","🤯","🥰","😴"]},{label:"Hands",emojis:["👍","👎","👏","🤝","✌️","🤞","💪","🙌","👋","🤙"]},{label:"Symbols",emojis:["❤️","⭐","🔥","✅","❌","⚡","💡","📌","🎯","🏆","🎉","💬"]},{label:"Arrows",emojis:["➡️","⬅️","⬆️","⬇️","↩️","🔄","▶️","⏸️","⏹️","⏩"]}];function ft(m){let t=m;return t=t.replace(/<h1[^>]*>(.*?)<\/h1>/gi,`# $1
2
2
  `),t=t.replace(/<h2[^>]*>(.*?)<\/h2>/gi,`## $1
3
3
  `),t=t.replace(/<h3[^>]*>(.*?)<\/h3>/gi,`### $1
4
4
  `),t=t.replace(/<strong[^>]*>(.*?)<\/strong>/gi,"**$1**"),t=t.replace(/<b[^>]*>(.*?)<\/b>/gi,"**$1**"),t=t.replace(/<em[^>]*>(.*?)<\/em>/gi,"*$1*"),t=t.replace(/<i[^>]*>(.*?)<\/i>/gi,"*$1*"),t=t.replace(/<code[^>]*>(.*?)<\/code>/gi,"`$1`"),t=t.replace(/<pre[^>]*>(.*?)<\/pre>/gis,"```\n$1\n```\n"),t=t.replace(/<br\s*\/?>/gi,`