@nice2dev/ui-mobile 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +8 -8
  2. package/dist/index.mjs +1984 -1958
  3. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -1,13 +1,13 @@
1
- "use strict";var tn=Object.defineProperty;var nn=(t,n,c)=>n in t?tn(t,n,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[n]=c;var tt=(t,n,c)=>nn(t,typeof n!="symbol"?n+"":n,c);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),ue=require("@nice2dev/ui-core"),e=require("react"),de=require("@nice2dev/icons"),rn=({style:t})=>r.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.3em",height:"0.6em",margin:"0 0.35em 0.15em 0.1em",borderRight:"0.12em solid currentColor",borderBottom:"0.12em solid currentColor",transform:"rotate(45deg)",...t}}),Pe=({style:t})=>r.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.85em",height:"0.85em",borderRadius:"50%",border:"0.12em solid currentColor",borderTopColor:"transparent",transform:"rotate(-45deg)",...t}}),nt={down:{transform:"rotate(45deg)",margin:"0 0 0.2em"},up:{transform:"rotate(-135deg)",margin:"0.2em 0 0"},left:{transform:"rotate(135deg)",margin:"0 0 0 0.2em"},right:{transform:"rotate(-45deg)",margin:"0 0.2em 0 0"}},je=({direction:t,style:n})=>r.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.45em",height:"0.45em",margin:nt[t].margin,borderRight:"0.12em solid currentColor",borderBottom:"0.12em solid currentColor",transform:nt[t].transform,...n}}),Xe=({style:t})=>r.jsxs("span",{"aria-hidden":"true",style:{display:"inline-block",position:"relative",width:"0.7em",height:"0.7em",...t},children:[r.jsx("span",{style:{position:"absolute",top:"50%",left:0,width:"100%",height:"0.12em",background:"currentColor",transform:"translateY(-50%) rotate(45deg)"}}),r.jsx("span",{style:{position:"absolute",top:"50%",left:0,width:"100%",height:"0.12em",background:"currentColor",transform:"translateY(-50%) rotate(-45deg)"}})]}),yt=e.createContext(null);function wt(){const t=e.useContext(yt);if(!t)throw new Error("usePullToRefresh must be used within NicePullToRefresh");return t}function Se(t="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const n={light:10,medium:25,heavy:50};navigator.vibrate(n[t])}}const Nt=({state:t,progress:n,pullDistance:c,threshold:s})=>{const{t:i}=ue.useNiceTranslation(),a=n*360,d=Math.min(1,n),l=()=>{switch(t){case"pulling":return r.jsx("span",{className:"nice-ptr__icon nice-ptr__icon-arrow",style:{transform:`rotate(${Math.min(a,180)}deg)`},children:r.jsx(je,{direction:"down"})});case"ready":return r.jsx("span",{className:"nice-ptr__icon nice-ptr__icon-ready",children:r.jsx(Pe,{})});case"refreshing":return r.jsx("span",{className:"nice-ptr__icon nice-ptr__icon-spinner",children:r.jsx(Pe,{})});case"success":return r.jsx("span",{className:"nice-ptr__icon nice-ptr__icon-success",children:r.jsx(rn,{})});case"error":return r.jsx("span",{className:"nice-ptr__icon nice-ptr__icon-error",children:r.jsx(Xe,{})});default:return null}},f=()=>{switch(t){case"pulling":return i("pullToRefresh.pullDownToRefresh","Pull down to refresh");case"ready":return i("pullToRefresh.releaseToRefresh","Release to refresh");case"refreshing":return i("pullToRefresh.refreshing","Refreshing...");case"success":return i("pullToRefresh.updated","Updated!");case"error":return i("pullToRefresh.failedToRefresh","Failed to refresh");default:return""}};return r.jsxs("div",{className:`nice-ptr__indicator nice-ptr__indicator--${t}`,style:{opacity:t==="idle"?0:Math.max(.3,n),transform:`scale(${d})`},role:"status","aria-live":"polite",children:[r.jsx("div",{className:"nice-ptr__indicator-icon",children:l()}),r.jsx("span",{className:"nice-ptr__indicator-text",children:f()}),t==="pulling"&&r.jsx("div",{className:"nice-ptr__progress-ring",children:r.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 32 32",children:[r.jsx("circle",{className:"nice-ptr__progress-bg",cx:"16",cy:"16",r:"14",fill:"none",strokeWidth:"2"}),r.jsx("circle",{className:"nice-ptr__progress-fill",cx:"16",cy:"16",r:"14",fill:"none",strokeWidth:"2",strokeDasharray:`${88*n} 88`,transform:"rotate(-90 16 16)"})]})})]})},kt=Object.assign(e.forwardRef(({children:t,onRefresh:n,indicator:c,threshold:s=80,maxPull:i=150,resistance:a=.4,completionDuration:d=1e3,hapticFeedback:l=!0,disabled:f=!1,onPullStart:y,onPullProgress:w,onRefreshSuccess:C,onRefreshError:D,className:u="",style:p,ariaLabel:N},I)=>{const{t:S}=ue.useNiceTranslation(),m=N??S("pullToRefresh.pullToRefresh","Pull to refresh"),[v,P]=e.useState("idle"),[Q,F]=e.useState(0),Y=e.useRef(null),$=e.useRef(null),j=e.useRef(0),k=e.useRef(0),B=e.useRef(!1),J=e.useRef(!1),W=Math.min(1,Q/s),Z=v==="refreshing",U=e.useCallback(()=>Q<=0?0:((g,A,h)=>{const L=g*(1-h);return Math.min(A,L+L*h/2)})(Q,i,a),[Q,i,a]),z=e.useCallback(async()=>{if(!(v==="refreshing"||f)){P("refreshing"),l&&Se("medium");try{await n(),P("success"),l&&Se("heavy"),C==null||C()}catch(H){P("error"),l&&Se("light"),D==null||D(H instanceof Error?H:new Error("Refresh failed"))}setTimeout(()=>{P("idle"),F(0)},d)}},[v,f,l,n,C,D,d]),K=e.useCallback(H=>{if(f||v==="refreshing")return;const g=$.current,A=(g==null?void 0:g.scrollTop)??0;A>0||(j.current=H.touches[0].clientY,k.current=A,J.current=!1)},[f,v]),X=e.useCallback(H=>{if(f||v==="refreshing")return;const g=$.current;if(((g==null?void 0:g.scrollTop)??0)>0&&!B.current)return;const L=H.touches[0].clientY-j.current;if(L<=0){B.current&&(B.current=!1,P("idle"),F(0));return}B.current||(B.current=!0,y==null||y(),P("pulling")),H.preventDefault(),F(L);const x=Math.min(1,L/s);w==null||w(x),L>=s?v!=="ready"&&(P("ready"),l&&!J.current&&(Se("light"),J.current=!0)):v==="ready"&&(P("pulling"),J.current=!1)},[f,v,s,l,y,w]),re=e.useCallback(()=>{B.current&&(B.current=!1,v==="ready"?z():(P("idle"),F(0)))},[v,z]),ne=e.useCallback(H=>{(H.key==="F5"||H.ctrlKey&&H.key==="r")&&(H.preventDefault(),z())},[z]),V=e.useCallback(H=>{Y.current=H,typeof I=="function"?I(H):I&&(I.current=H)},[I]),_={state:v,progress:W,isRefreshing:Z,triggerRefresh:z},E=U();return r.jsx(yt.Provider,{value:_,children:r.jsxs("div",{ref:V,className:`nice-ptr ${u} nice-ptr--${v}`,style:p,onTouchStart:K,onTouchMove:X,onTouchEnd:re,onKeyDown:ne,tabIndex:0,role:"region","aria-label":m,"data-state":v,"data-disabled":f||void 0,children:[r.jsx("div",{className:"nice-ptr-indicator-wrapper",style:{height:E,opacity:v==="idle"?0:1},children:c?r.jsx(c,{state:v,progress:W,pullDistance:Q,threshold:s}):r.jsx(Nt,{state:v,progress:W,pullDistance:Q,threshold:s})}),r.jsx("div",{ref:$,className:"nice-ptr-content",style:{transform:v==="refreshing"?`translateY(${s}px)`:`translateY(${E}px)`,transition:B.current?"none":"transform 0.3s cubic-bezier(0.23, 1, 0.32, 1)"},children:t})]})})}),{displayName:"NicePullToRefresh"}),cn=({state:t,progress:n})=>r.jsxs("div",{className:`nice-ptr__dots nice-ptr__dots--${t}`,children:[r.jsx("span",{className:"nice-ptr__dot",style:{opacity:Math.min(1,n*3)}}),r.jsx("span",{className:"nice-ptr__dot",style:{opacity:Math.min(1,(n-.33)*3)}}),r.jsx("span",{className:"nice-ptr__dot",style:{opacity:Math.min(1,(n-.66)*3)}})]}),sn=({state:t,progress:n})=>r.jsx("div",{className:`nice-ptr__line nice-ptr__line--${t}`,children:r.jsx("div",{className:"nice-ptr__line-fill",style:{width:`${n*100}%`}})}),an=({state:t})=>{const n={idle:"",pulling:"👇",ready:"🔄",refreshing:"⏳",success:"✅",error:"❌"};return r.jsx("div",{className:`nice-ptr__emoji nice-ptr__emoji--${t}`,children:r.jsx("span",{className:"nice-ptr__emoji-icon",children:n[t]})})},on=({state:t,progress:n})=>r.jsx("div",{className:`nice-ptr__ios nice-ptr__ios--${t}`,children:r.jsx("div",{className:"nice-ptr__ios-spinner",children:Array.from({length:12}).map((s,i)=>{const a=i/12*360,d=i/12*1,l=t==="refreshing"?void 0:Math.min(1,n*2-i*.08);return r.jsx("div",{className:"nice-ptr__ios-bar",style:{transform:`rotate(${a}deg) translateY(-8px)`,animationDelay:`${d}s`,opacity:l}},i)})})}),ln=({state:t,progress:n})=>r.jsxs("div",{className:`nice-ptr__material nice-ptr__material--${t}`,children:[r.jsxs("svg",{className:"nice-ptr__material-circle",viewBox:"0 0 36 36",width:"36",height:"36",children:[r.jsx("circle",{className:"nice-ptr__material-bg",cx:"18",cy:"18",r:"16",fill:"none",strokeWidth:"3"}),r.jsx("circle",{className:"nice-ptr__material-progress",cx:"18",cy:"18",r:"16",fill:"none",strokeWidth:"3",strokeDasharray:`${100*n} 100`,strokeLinecap:"round",transform:"rotate(-90 18 18)"})]}),(t==="success"||t==="error")&&r.jsx("span",{className:"nice-ptr__material-icon",children:t==="success"?r.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.3em",height:"0.6em",marginBottom:"0.15em",borderRight:"0.12em solid currentColor",borderBottom:"0.12em solid currentColor",transform:"rotate(45deg)"}}):"!"})]}),rt=6,jt=e.createContext(null),Tt=({children:t})=>{const[n,c]=e.useState(null);return r.jsx(jt.Provider,{value:{activeItemId:n,setActiveItemId:c},children:t})};function Mt(){return e.useContext(jt)}function De(t="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const n={light:10,medium:25,heavy:50};navigator.vibrate(n[t])}}const ct=({action:t,width:n,progress:c,index:s,total:i,side:a,onTrigger:d})=>{const{t:l}=ue.useNiceTranslation(),f=t.labelKey?l(t.labelKey,t.label):t.label,y=Math.min(1,c*2),w=a==="right"?(i-1-s)*.05:s*.05;return r.jsxs("button",{className:`nice-swipe-action nice-swipe-action--${a} ${t.destructive?"nice-swipe-action--destructive":""}`,style:{width:n,background:t.background||"var(--nice-color-primary, #3b82f6)",color:t.color||"var(--nice-color-white, #ffffff)",transform:`scale(${y})`,transitionDelay:`${w}s`},onClick:d,"aria-label":f,children:[t.icon&&r.jsx("span",{className:"nice-swipe-action-icon",children:t.icon}),r.jsx("span",{className:"nice-swipe-action-label",children:f})]})},un=Object.assign(e.forwardRef(({children:t,leftActions:n=[],rightActions:c=[],actionWidth:s=72,threshold:i=.4,direction:a,exclusive:d=!0,onSwipeStart:l,onSwipeEnd:f,onAction:y,disabled:w=!1,className:C="",style:D,itemId:u,hapticFeedback:p=!0},N)=>{const{t:I}=ue.useNiceTranslation(),S=Mt(),[m,v]=e.useState(0),[P,Q]=e.useState(null),[F,Y]=e.useState(!1),$=e.useRef(null),j=e.useRef(0),k=e.useRef(0),B=e.useRef(0),J=e.useRef(!1),W=e.useRef(null),Z=e.useRef(!1),U=-(n.length*s),z=c.length*s,K=(a==="left"||a==="both"||!a)&&n.length>0,X=(a==="right"||a==="both"||!a)&&c.length>0,re=Math.min(1,Math.abs(m)/Math.abs(U)),ne=Math.min(1,m/z),V=e.useMemo(()=>u||`swipe-${Math.random().toString(36).substr(2,9)}`,[u]),_=e.useCallback(()=>{Y(!0),v(0),Q(null),setTimeout(()=>Y(!1),300)},[]);e.useEffect(()=>{d&&S&&S.activeItemId!==null&&S.activeItemId!==V&&P&&_()},[d,S,V,P,_]);const E=e.useRef(null),H=e.useRef(!1),[g,A]=e.useState(!1),h=e.useCallback(R=>{w||F||E.current!==null||R.pointerType==="mouse"&&R.button!==0||(E.current=R.pointerId,j.current=R.clientX,k.current=R.clientY,B.current=m,J.current=!1,W.current=null,Z.current=!1)},[w,F,m]),L=e.useCallback(R=>{var se,ce;if(R.pointerId!==E.current||w||F)return;const T=R.clientX-j.current,ee=R.clientY-k.current;if(!J.current){if(Math.abs(T)<rt&&Math.abs(ee)<rt)return;if(Math.abs(T)<Math.abs(ee)){E.current=null;return}J.current=!0,W.current=T<0?"left":"right",(ce=(se=R.currentTarget).setPointerCapture)==null||ce.call(se,R.pointerId),A(!0),l==null||l(W.current),d&&S&&S.setActiveItemId(V)}let O=B.current+T;if(!K&&O<0&&(O=Math.max(O,-30)*.3),!X&&O>0&&(O=Math.min(O,30)*.3),K&&O<U){const oe=U-O;O=U-oe*.3}if(X&&O>z){const oe=O-z;O=z+oe*.3}const ie=W.current==="left"?Math.abs(U)*i:z*i,ae=W.current==="left"?Math.abs(O):O;ae>=ie&&!Z.current?(Z.current=!0,p&&De("light")):ae<ie&&Z.current&&(Z.current=!1),v(O),R.preventDefault()},[w,F,K,X,U,z,i,p,d,S,V,l]),x=e.useCallback(R=>{if(R.pointerId!==E.current||(E.current=null,!J.current))return;J.current=!1,H.current=!0,A(!1),Y(!0);const T=Math.abs(U)*i,ee=z*i;let O=0,ie=null;W.current==="left"&&K?Math.abs(m)>=T&&(O=U,ie="left",p&&De("medium")):W.current==="right"&&X&&m>=ee&&(O=z,ie="right",p&&De("medium")),(P==="left"&&m>0||P==="right"&&m<0)&&(O=0,ie=null),v(O),Q(ie),f==null||f(ie),setTimeout(()=>Y(!1),300)},[m,U,z,i,K,X,P,p,f]),M=e.useCallback((R,T)=>{R.onClick(),y==null||y(R,T),p&&De("heavy"),_()},[y,p,_]),o=e.useCallback(R=>{R.key==="Escape"&&P&&_()},[P,_]),b=e.useCallback(R=>{$.current=R,typeof N=="function"?N(R):N&&(N.current=R)},[N]);return r.jsxs("div",{ref:b,className:`nice-swipe-container ${C} ${P?`nice-swipe-container--open-${P}`:""}`,style:D,onKeyDown:o,tabIndex:0,role:"listitem","aria-label":P==="left"?I("swipeActions.leftVisible","Swipe actions left visible"):P==="right"?I("swipeActions.rightVisible","Swipe actions right visible"):I("swipeActions.swipeForActions","Swipe for actions"),"data-disabled":w||void 0,children:[c.length>0&&r.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--left",style:{width:z},children:c.map((R,T)=>r.jsx(ct,{action:R,width:s,progress:ne,index:T,total:c.length,side:"right",onTrigger:()=>M(R,"right")},R.id))}),r.jsx("div",{className:"nice-swipe-content",style:{transform:`translateX(${m}px)`,transition:F?"transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)":"none",userSelect:g?"none":void 0},onPointerDown:h,onPointerMove:L,onPointerUp:x,onPointerCancel:x,onClickCapture:R=>{H.current&&(H.current=!1,R.stopPropagation(),R.preventDefault())},children:t}),n.length>0&&r.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--right",style:{width:Math.abs(U)},children:n.map((R,T)=>r.jsx(ct,{action:R,width:s,progress:re,index:T,total:n.length,side:"left",onTrigger:()=>M(R,"left")},R.id))})]})}),{displayName:"NiceSwipeActions"}),dn=({children:t,className:n="",style:c})=>r.jsx(Tt,{children:r.jsx("div",{className:`nice-swipe-list ${n}`,style:c,role:"list",children:t})}),fn={delete:t=>({id:"delete",label:"Delete",labelKey:"swipeActions.delete",icon:r.jsx(de.NtdTrash,{size:20,variant:"outline"}),background:"var(--nice-color-error, #ef4444)",destructive:!0,onClick:t}),edit:t=>({id:"edit",label:"Edit",labelKey:"swipeActions.edit",icon:r.jsx(de.NtdEdit,{size:20,variant:"outline"}),background:"var(--nice-color-primary, #3b82f6)",onClick:t}),archive:t=>({id:"archive",label:"Archive",labelKey:"swipeActions.archive",icon:r.jsx(de.NtdArchive,{size:20,variant:"outline"}),background:"var(--nice-bg-tertiary, #6b7280)",onClick:t}),star:t=>({id:"star",label:"Star",labelKey:"swipeActions.star",icon:r.jsx(de.NtdStar,{size:20,variant:"outline"}),background:"var(--nice-color-warning, #eab308)",onClick:t}),share:t=>({id:"share",label:"Share",labelKey:"swipeActions.share",icon:r.jsx(de.NtdShare,{size:20,variant:"outline"}),background:"var(--nice-color-success, #22c55e)",onClick:t}),pin:t=>({id:"pin",label:"Pin",labelKey:"swipeActions.pin",icon:r.jsx(de.NtdPin,{size:20,variant:"outline"}),background:"var(--nice-color-accent, #8b5cf6)",onClick:t}),mute:t=>({id:"mute",label:"Mute",labelKey:"swipeActions.mute",icon:r.jsx(de.NtdVolumeMute,{size:20,variant:"outline"}),background:"var(--nice-bg-tertiary, #64748b)",onClick:t}),reply:t=>({id:"reply",label:"Reply",labelKey:"swipeActions.reply",icon:r.jsx(de.NtdReply,{size:20,variant:"outline"}),background:"var(--nice-color-info, #0ea5e9)",onClick:t})};function st(t="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const n={light:10,medium:25,heavy:50};navigator.vibrate(n[t])}}function hn(t,n,c){return t==="full"?n*.95:t==="content"?Math.min(c,n*.9):n*t/100}const bn=Object.assign(e.forwardRef(({children:t,open:n,onClose:c,onSnapChange:s,snapPoints:i=[50,100],initialSnap:a=0,header:d,footer:l,showHandle:f=!0,showBackdrop:y=!0,closeOnBackdrop:w=!0,closeOnEscape:C=!0,dismissible:D=!0,velocityThreshold:u=.5,hapticFeedback:p=!0,handleColor:N,borderRadius:I=16,zIndex:S=1e3,className:m="",style:v,ariaLabel:P,size:Q="md",disabled:F=!1,loading:Y=!1,error:$},j)=>{const{t:k}=ue.useNiceTranslation(),B=P??k("bottomSheet.bottomSheet","Bottom sheet"),[J,W]=e.useState(a),[Z,U]=e.useState(0),[z,K]=e.useState(!1),[X,re]=e.useState(typeof window<"u"?window.innerHeight:800),[ne,V]=e.useState(400),_=e.useRef(null),E=e.useRef(null),H=e.useRef(0),g=e.useRef(0),A=e.useRef(0),h=e.useRef(0),L=e.useRef(0),x=e.useRef(-1),M=i.map(ce=>hn(ce,X,ne)),o=M[J]??M[0];e.useImperativeHandle(j,()=>({snapTo:ce=>{ce>=0&&ce<i.length&&(W(ce),U(0),s==null||s(ce,M[ce]))},close:()=>c(),getCurrentSnap:()=>J})),e.useEffect(()=>{const ce=()=>{re(window.innerHeight)};return window.addEventListener("resize",ce),()=>window.removeEventListener("resize",ce)},[]),e.useEffect(()=>{if(E.current&&n){const ce=E.current.scrollHeight;V(ce+60)}},[n,t]),ue.useOverlayFocus(_,{open:n,onClose:c,closeOnEscape:C}),e.useEffect(()=>{if(n){const ce=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=ce}}},[n]);const b=e.useCallback(ce=>{const oe=X-o+ce,me=X-oe;for(let G=0;G<M.length;G++){const q=M[G];if(Math.abs(me-q)<20&&x.current!==G){x.current=G,p&&st("light");break}}},[X,o,M,p]),R=e.useCallback((ce,oe)=>{if(oe>u*2&&D&&ce<M[0]*.5)return-1;if(oe<-u)return M.length-1;if(oe>u)return D&&ce<M[0]*.7?-1:0;let me=0,G=Math.abs(ce-M[0]);for(let q=1;q<M.length;q++){const te=Math.abs(ce-M[q]);te<G&&(G=te,me=q)}return D&&ce<M[0]*.5?-1:me},[M,u,D]),T=e.useCallback(ce=>{H.current=ce.touches[0].clientY,g.current=Z,A.current=ce.touches[0].clientY,h.current=Date.now(),L.current=0,x.current=-1,K(!0)},[Z]),ee=e.useCallback(ce=>{if(!z)return;const oe=ce.touches[0].clientY,me=oe-H.current,G=Date.now(),q=G-h.current;q>0&&(L.current=(oe-A.current)/q),A.current=oe,h.current=G;let te=g.current+me;const le=o+50;if(te>le){const be=te-le;te=le+be*.2}const fe=-(X*.95-o);if(te<fe){const be=fe-te;te=fe-be*.2}U(te),b(te),ce.preventDefault()},[z,o,X,b]),O=e.useCallback(()=>{if(!z)return;K(!1);const ce=o-Z,oe=R(ce,L.current);if(oe===-1)U(o+100),setTimeout(()=>{c(),U(0),W(a)},300);else{const me=M[oe];U(0),W(oe),oe!==J&&(s==null||s(oe,me),p&&st("medium"))}},[z,o,Z,R,J,M,c,s,a,p]),ie=e.useCallback(ce=>{w&&ce.target===ce.currentTarget&&c()},[w,c]);if(!n)return null;const ae=Math.max(0,o-Z),se=Math.min(.5,ae/X*.8);return r.jsxs("div",{className:`nice-bottom-sheet-container ${m}`,style:{zIndex:S},children:[y&&r.jsx("div",{className:"nice-bottom-sheet-backdrop",style:{opacity:se},onMouseDown:ie,"aria-hidden":"true"}),r.jsxs("div",{ref:_,className:`nice-bottom-sheet nice-bottom-sheet--${Q} ${z?"nice-bottom-sheet--dragging":""} ${F?"nice-bottom-sheet--disabled":""} ${Y?"nice-bottom-sheet--loading":""} ${$?"nice-bottom-sheet--error":""}`,style:{...v,height:ae,borderTopLeftRadius:I,borderTopRightRadius:I,transition:z?"none":"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},role:"dialog","aria-modal":"true","aria-label":B,"aria-disabled":F||void 0,"aria-busy":Y||void 0,children:[$&&r.jsx("div",{className:"nice-bottom-sheet-error",role:"alert",children:$}),Y&&r.jsx("span",{className:"nice-bottom-sheet-spinner","aria-hidden":"true",children:r.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),f&&r.jsx("div",{className:"nice-bottom-sheet-handle",onTouchStart:T,onTouchMove:ee,onTouchEnd:O,children:r.jsx("div",{className:"nice-bottom-sheet-handle-bar",style:N?{backgroundColor:N}:void 0})}),d&&r.jsx("div",{className:"nice-bottom-sheet-header",children:d}),r.jsx("div",{ref:E,className:"nice-bottom-sheet-content",onTouchStart:T,onTouchMove:ee,onTouchEnd:O,children:t}),l&&r.jsx("div",{className:"nice-bottom-sheet-footer",children:l})]})]})}),{displayName:"NiceBottomSheet"}),mn=[];function pn(t="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const n={light:10,medium:25,heavy:50};navigator.vibrate(n[t])}}function it(t,n){return Math.hypot(n.x-t.x,n.y-t.y)}function at(t,n){return{x:(t.x+n.x)/2,y:(t.y+n.y)/2}}const gn=Object.assign(e.forwardRef(({items:t=mn,selectedIndex:n=0,onIndexChange:c,onClose:s,showClose:i=!0,showCounter:a=!0,showCaption:d=!0,showThumbnails:l=!1,enablePinchZoom:f=!0,enableDoubleTapZoom:y=!0,enableSwipe:w=!0,enableKeyboard:C=!0,minZoom:D=1,maxZoom:u=4,doubleTapZoom:p=2.5,swipeThreshold:N=50,loop:I=!0,hapticFeedback:S=!0,backgroundColor:m="var(--nice-overlay-95, rgba(0, 0, 0, 0.95))",zIndex:v=2e3,className:P="",style:Q},F)=>{const{t:Y}=ue.useNiceTranslation(),[$,j]=e.useState(n),[k,B]=e.useState(1),[J,W]=e.useState(0),[Z,U]=e.useState(0),[z,K]=e.useState(!1),[X,re]=e.useState({}),ne=e.useRef(null),V=e.useRef(null),_=e.useRef([]),E=e.useRef(0),H=e.useRef(1),g=e.useRef({x:0,y:0}),A=e.useRef(0),h=e.useRef({x:0,y:0}),L=e.useRef(!1),x=e.useRef(!1),M=e.useRef(null),o=t[$],b=e.useCallback(G=>{let q=G;I?q=(G%t.length+t.length)%t.length:q=Math.max(0,Math.min(t.length-1,G)),q!==$&&(K(!0),j(q),B(1),W(0),U(0),c==null||c(q,t[q]),S&&pn("light"),setTimeout(()=>K(!1),300))},[$,t,I,c,S]),R=e.useCallback(()=>b($+1),[b,$]),T=e.useCallback(()=>b($-1),[b,$]),ee=e.useCallback((G,q,te)=>{const le=Math.max(D,Math.min(u,G));B(le),le<=1&&(W(0),U(0))},[D,u]),O=e.useCallback(()=>ee(k*1.5),[k,ee]),ie=e.useCallback(()=>ee(k/1.5),[k,ee]),ae=e.useCallback(()=>{B(1),W(0),U(0)},[]);e.useImperativeHandle(F,()=>({goTo:b,goNext:R,goPrev:T,zoomIn:O,zoomOut:ie,resetZoom:ae,close:()=>s==null?void 0:s()}));const se=t.length>0;ue.useOverlayFocus(ne,{open:se,onClose:s?()=>s():void 0,closeOnEscape:C}),e.useEffect(()=>{const G=ne.current;if(!C||!se||!G)return;const q=te=>{if(!te.defaultPrevented){switch(te.key){case"ArrowLeft":T();break;case"ArrowRight":R();break;case"ArrowUp":O();break;case"ArrowDown":ie();break;case"0":case"Home":ae();break;default:return}te.preventDefault()}};return G.addEventListener("keydown",q),()=>G.removeEventListener("keydown",q)},[C,se,R,T,O,ie,ae]),ue.useIntent(["sectionPrev","sectionNext","pagePrev","pageNext"],G=>{if(G.intent==="sectionPrev")T();else if(G.intent==="sectionNext")R();else{if(G.source==="keyboard")return!1;G.intent==="pageNext"?O():ie()}},{ref:ne,enabled:se}),ue.useInputHints(ne,se&&t.length>1?[{intent:"sectionPrev",label:Y("imageGallery.previousImage","Previous image")},{intent:"sectionNext",label:Y("imageGallery.nextImage","Next image")},{intent:"pageNext",label:Y("imageGallery.zoomIn","Zoom in")},{intent:"pagePrev",label:Y("imageGallery.zoomOut","Zoom out")}]:[]);const ce=e.useCallback(G=>{const q=Array.from(G.touches).map(te=>({x:te.clientX,y:te.clientY,id:te.identifier}));if(_.current=q,h.current={x:q[0].x,y:q[0].y},x.current=!1,M.current=null,q.length===2&&f)L.current=!0,E.current=it(q[0],q[1]),H.current=k,g.current={x:J,y:Z};else if(q.length===1){const te=Date.now();te-A.current<300&&y?(k>1.1?ae():ee(p,q[0].x,q[0].y),A.current=0):A.current=te,g.current={x:J,y:Z}}},[k,J,Z,f,y,p,ae,ee]),oe=e.useCallback(G=>{const q=Array.from(G.touches).map(te=>({x:te.clientX,y:te.clientY,id:te.identifier}));if(q.length===2&&L.current&&f){const le=it(q[0],q[1])/E.current,fe=H.current*le;ee(fe);const be=at(q[0],q[1]),Me=at(_.current[0],_.current[1]||_.current[0]),Ye=be.x-Me.x,Be=be.y-Me.y;W(g.current.x+Ye),U(g.current.y+Be),G.preventDefault()}else if(q.length===1){const te=q[0].x-h.current.x,le=q[0].y-h.current.y;if(M.current||(Math.abs(te)>10||Math.abs(le)>10)&&(M.current=Math.abs(te)>Math.abs(le)?"horizontal":"vertical",x.current=!0),k>1.1){const fe=g.current.x+te,be=g.current.y+le;W(fe),U(be)}G.preventDefault()}},[k,f,ee]),me=e.useCallback(G=>{if(L.current){L.current=!1;return}const q=G.changedTouches[0],te=q.clientX-h.current.x;q.clientY-h.current.y,w&&k<=1.1&&M.current==="horizontal"&&(te>N?T():te<-N&&R()),k<=1.1&&(W(0),U(0)),x.current=!1,M.current=null},[k,w,N,R,T]);return e.useEffect(()=>{t.forEach((G,q)=>{const te=new Image;te.onload=()=>{re(le=>({...le,[q]:!0}))},te.src=G.src})},[t]),t.length===0?null:r.jsxs("div",{ref:ne,className:`nice-image-gallery ${P}`,style:{...Q,backgroundColor:m,zIndex:v},role:"dialog","aria-modal":"true","aria-label":Y("imageGallery.imageGallery","Image gallery"),children:[r.jsxs("div",{className:"nice-image-gallery-header",children:[a&&r.jsxs("span",{className:"nice-image-gallery-counter",children:[$+1," / ",t.length]}),r.jsxs("div",{className:"nice-image-gallery-actions",children:[r.jsx("button",{className:"nice-image-gallery-btn",onClick:ie,disabled:k<=D,"aria-label":Y("imageGallery.zoomOut","Zoom out"),children:r.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--minus","aria-hidden":"true"})}),r.jsx("button",{className:"nice-image-gallery-btn",onClick:O,disabled:k>=u,"aria-label":Y("imageGallery.zoomIn","Zoom in"),children:r.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--plus","aria-hidden":"true"})}),i&&r.jsx("button",{className:"nice-image-gallery-btn nice-image-gallery-close",onClick:s,"aria-label":Y("imageGallery.close","Close"),children:r.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--close","aria-hidden":"true"})})]})]}),r.jsxs("div",{className:"nice-image-gallery-viewport",onTouchStart:ce,onTouchMove:oe,onTouchEnd:me,children:[r.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--prev",onClick:T,disabled:!I&&$===0,"aria-label":Y("imageGallery.previousImage","Previous image"),children:r.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--prev","aria-hidden":"true"})}),r.jsxs("div",{className:"nice-image-gallery-image-container",children:[o.placeholder&&!X[$]&&r.jsx("div",{className:"nice-image-gallery-placeholder",style:{backgroundColor:o.placeholder}}),r.jsx("img",{ref:V,src:o.src,alt:o.alt||o.title||"",className:`nice-image-gallery-image ${z?"nice-image-gallery-image--animating":""}`,style:{transform:`scale(${k}) translate(${J/k}px, ${Z/k}px)`,transition:L.current||x.current?"none":"transform 0.2s ease-out"},draggable:!1})]}),r.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--next",onClick:R,disabled:!I&&$===t.length-1,"aria-label":Y("imageGallery.nextImage","Next image"),children:r.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--next","aria-hidden":"true"})})]}),d&&o.title&&r.jsxs("div",{className:"nice-image-gallery-caption",children:[r.jsx("h3",{children:o.title}),o.description&&r.jsx("p",{children:o.description})]}),l&&t.length>1&&r.jsx("div",{className:"nice-image-gallery-thumbnails",children:t.map((G,q)=>r.jsx("button",{className:`nice-image-gallery-thumb ${q===$?"nice-image-gallery-thumb--active":""}`,onClick:()=>b(q),"aria-label":Y("imageGallery.goToImage","Go to image {i}").replace("{i}",String(q+1)),children:r.jsx("img",{src:G.thumbnail||G.src,alt:G.alt||"",loading:"lazy"})},q))}),!l&&t.length>1&&t.length<=10&&r.jsx("div",{className:"nice-image-gallery-dots",children:t.map((G,q)=>r.jsx("button",{className:`nice-image-gallery-dot ${q===$?"nice-image-gallery-dot--active":""}`,onClick:()=>b(q),"aria-label":Y("imageGallery.goToImage","Go to image {i}").replace("{i}",String(q+1))},q))})]})}),{displayName:"NiceImageGallery"}),vn=[],Rt=e.createContext(null);function xn(){const t=e.useContext(Rt);if(!t)throw new Error("useInfiniteScroll must be used within NiceInfiniteScroll");return t}const ot=()=>{const{t}=ue.useNiceTranslation();return r.jsxs("div",{className:"nice-infinite-loading",children:[r.jsx("div",{className:"nice-infinite-spinner",children:r.jsx(Pe,{style:{fontSize:28}})}),r.jsx("span",{className:"nice-infinite-loading-text",children:t("infiniteScroll.loading","Loading...")})]})},yn=()=>{const{t}=ue.useNiceTranslation();return r.jsxs("div",{className:"nice-infinite-end",children:[r.jsx("span",{className:"nice-infinite-end-line"}),r.jsx("span",{className:"nice-infinite-end-text",children:t("infiniteScroll.youveReachedTheEnd","You've reached the end")}),r.jsx("span",{className:"nice-infinite-end-line"})]})},wn=({message:t,onRetry:n})=>{const{t:c}=ue.useNiceTranslation();return r.jsxs("div",{className:"nice-infinite-error",role:"alert",children:[r.jsx(de.NtdAlert,{className:"nice-infinite-error-icon",size:32,variant:"outline"}),r.jsx("span",{className:"nice-infinite-error-text",children:t}),n&&r.jsx("button",{className:"nice-infinite-error-retry",onClick:n,"aria-label":c("infiniteScroll.retryLoading","Retry loading"),children:c("infiniteScroll.retry","Retry")})]})},Nn=()=>{const{t}=ue.useNiceTranslation();return r.jsxs("div",{className:"nice-infinite-empty",children:[r.jsx(de.NtdInbox,{className:"nice-infinite-empty-icon",size:48,variant:"outline"}),r.jsx("p",{className:"nice-infinite-empty-text",children:t("infiniteScroll.noItemsToDisplay","No items to display")})]})},kn=({visible:t,onClick:n})=>{const{t:c}=ue.useNiceTranslation();return r.jsx("button",{className:`nice-infinite-scroll-top ${t?"nice-infinite-scroll-top--visible":""}`,onClick:n,"aria-label":c("infiniteScroll.scrollToTop","Scroll to top"),children:r.jsx(je,{direction:"up",style:{fontSize:20}})})};function jn({items:t=vn,renderItem:n,onLoadMore:c,hasMore:s,isLoading:i=!1,error:a=null,threshold:d=200,loadingIndicator:l,endIndicator:f,errorIndicator:y,onRetry:w,pullToRefresh:C=!1,onRefresh:D,direction:u="vertical",reverse:p=!1,initialScrollPosition:N="top",keyboardNav:I=!0,keyExtractor:S,emptyContent:m,header:v,footer:P,gap:Q=0,className:F="",style:Y,ariaLabel:$},j){const{t:k}=ue.useNiceTranslation(),B=$??k("infiniteScroll.scrollableList","Scrollable list"),[J,W]=e.useState("idle"),[Z,U]=e.useState(!1),[z,K]=e.useState(!1),X=e.useRef(null),re=e.useRef(null),ne=e.useRef(!1),V=e.useRef(null);e.useEffect(()=>{a?W("error"):i?W("loading"):!s&&t.length>0?W("end"):W("idle")},[a,i,s,t.length]);const _=e.useCallback((M,o)=>S?S(M,o):`item-${o}`,[S]),E=e.useCallback(async()=>{if(!(ne.current||!s||a)){ne.current=!0;try{await c()}finally{ne.current=!1}}},[s,a,c]),H=e.useCallback(()=>{var M;(M=X.current)==null||M.scrollTo({top:0,behavior:"smooth"})},[]),g=e.useCallback(()=>{X.current&&X.current.scrollTo({top:X.current.scrollHeight,behavior:"smooth"})},[]);e.useEffect(()=>{if(!re.current)return;const M=o=>{const[b]=o;b.isIntersecting&&s&&!i&&!a&&E()};return V.current=new IntersectionObserver(M,{root:X.current,rootMargin:`${d}px`,threshold:.1}),V.current.observe(re.current),()=>{var o;(o=V.current)==null||o.disconnect()}},[s,i,a,d,E]),e.useEffect(()=>{const M=X.current;if(!M)return;const o=()=>{const b=u==="vertical"?M.scrollTop:M.scrollLeft;U(b>500)};return M.addEventListener("scroll",o,{passive:!0}),()=>M.removeEventListener("scroll",o)},[u]),e.useEffect(()=>{N==="bottom"&&X.current&&(X.current.scrollTop=X.current.scrollHeight)},[N]);const A=e.useCallback(M=>{I&&(M.key==="Home"?(M.preventDefault(),H()):M.key==="End"&&(M.preventDefault(),g()))},[I,H,g]);e.useCallback(async()=>{if(!(!D||z)){K(!0);try{await D()}finally{K(!1)}}},[D,z]);const h=e.useCallback(M=>{X.current=M,typeof j=="function"?j(M):j&&(j.current=M)},[j]),L=e.useMemo(()=>({status:J,loadMore:E,hasMore:s,itemCount:t.length,scrollToTop:H,scrollToBottom:g}),[J,E,s,t.length,H,g]),x=e.useMemo(()=>(p?[...t].reverse():t).map((o,b)=>r.jsx("div",{className:"nice-infinite-item","data-index":b,children:n(o,b)},_(o,b))),[t,p,_,n]);return t.length===0&&!i&&!a?r.jsx("div",{ref:h,className:`nice-infinite-container nice-infinite-container--empty ${F}`,style:Y,role:"region","aria-label":B,children:m||r.jsx(Nn,{})}):r.jsx(Rt.Provider,{value:L,children:r.jsxs("div",{ref:h,className:`nice-infinite-container nice-infinite-container--${u} ${p?"nice-infinite-container--reverse":""} ${F}`,style:Y,onKeyDown:A,tabIndex:0,role:"feed","aria-label":B,"aria-busy":i,children:[v&&r.jsx("div",{className:"nice-infinite-header",children:v}),C&&z&&r.jsx("div",{className:"nice-infinite-pull",children:l||r.jsx(ot,{})}),r.jsx("div",{className:"nice-infinite-items",style:{gap:Q},children:x}),r.jsx("div",{ref:re,className:"nice-infinite-sentinel","aria-hidden":"true"}),J==="loading"&&(l||r.jsx(ot,{})),J==="error"&&a&&(y||r.jsx(wn,{message:a,onRetry:w})),J==="end"&&(f||r.jsx(yn,{})),P&&r.jsx("div",{className:"nice-infinite-footer",children:P}),r.jsx(kn,{visible:Z,onClick:H})]})})}const Tn=e.forwardRef(jn);function Mn(t){const{t:n}=ue.useNiceTranslation(),{fetchPage:c,initialCursor:s,refetchOnFocus:i=!1}=t,[a,d]=e.useState([]),[l,f]=e.useState(s),[y,w]=e.useState(!1),[C,D]=e.useState(null),[u,p]=e.useState(!0),[N,I]=e.useState(!1),S=e.useCallback(async()=>{if(!(y||!u)){w(!0),D(null);try{const P=await c(l);d(Q=>[...Q,...P.items]),f(P.nextCursor),p(P.hasMore),I(!0)}catch(P){D(P instanceof Error?P.message:n("infiniteScroll.failedToLoadData","Failed to load data"))}finally{w(!1)}}},[c,l,y,u,n]),m=e.useCallback(async()=>{d([]),f(s),p(!0),D(null),w(!0);try{const P=await c(s);d(P.items),f(P.nextCursor),p(P.hasMore)}catch(P){D(P instanceof Error?P.message:n("infiniteScroll.failedToRefreshData","Failed to refresh data"))}finally{w(!1)}},[c,s,n]),v=e.useCallback(()=>{d([]),f(s),p(!0),D(null),I(!1)},[s]);return e.useEffect(()=>{!N&&!y&&S()},[N,y,S]),e.useEffect(()=>{if(!i)return;const P=()=>{N&&m()};return window.addEventListener("focus",P),()=>window.removeEventListener("focus",P)},[i,N,m]),{items:a,isLoading:y,error:C,hasMore:u,loadMore:S,refresh:m,reset:v}}function Rn(t){const{itemCount:n,itemHeight:c,overscan:s=5,containerRef:i}=t,[a,d]=e.useState(0),[l,f]=e.useState(0),y=e.useCallback(u=>typeof c=="function"?c(u):c,[c]),w=e.useMemo(()=>{let u=0;for(let p=0;p<n;p++)u+=y(p);return u},[n,y]),C=e.useMemo(()=>{const u=[];let p=0,N=-1,I=-1;for(let S=0;S<n;S++){const m=y(S),v=p+m;v>=a&&N===-1&&(N=S),p<=a+l&&(I=S),p=v}N=Math.max(0,N-s),I=Math.min(n-1,I+s),p=0;for(let S=0;S<n;S++){const m=y(S);S>=N&&S<=I&&u.push({index:S,start:p,size:m,end:p+m}),p+=m}return u},[n,y,a,l,s]);e.useEffect(()=>{const u=i.current;if(!u)return;f(u.clientHeight);const p=()=>{d(u.scrollTop)},N=()=>{f(u.clientHeight)};return u.addEventListener("scroll",p,{passive:!0}),window.addEventListener("resize",N),()=>{u.removeEventListener("scroll",p),window.removeEventListener("resize",N)}},[i]);const D=e.useCallback(u=>{const p=i.current;if(!p)return;let N=0;for(let I=0;I<u&&I<n;I++)N+=y(I);p.scrollTo({top:N,behavior:"smooth"})},[i,n,y]);return{virtualItems:C,totalSize:w,scrollToIndex:D}}const St=e.createContext(null);function Sn(){const t=e.useContext(St);if(!t)throw new Error("useMobileDrawer must be used within NiceMobileDrawer");return t}const Dt=({item:t,depth:n=0,onSelect:c,activeId:s})=>{const[i,a]=e.useState(!1),d=t.children&&t.children.length>0,l=s===t.id;if(t.divider)return r.jsx("div",{className:"nice-drawer-divider"});if(t.section)return r.jsx("div",{className:"nice-drawer-section",children:r.jsx("span",{className:"nice-drawer-section-label",children:t.section})});const f=()=>{t.disabled||(d?a(!i):(c(t),t.onClick&&t.onClick()))};return r.jsxs("div",{className:"nice-drawer-nav-item-wrapper",children:[r.jsxs("button",{className:`nice-drawer-nav-item nice-drawer-nav-item--depth-${n} ${l?"nice-drawer-nav-item--active":""} ${t.disabled?"nice-drawer-nav-item--disabled":""}`,onClick:f,disabled:t.disabled,"aria-expanded":d?i:void 0,"aria-current":l?"page":void 0,style:{paddingLeft:`${16+n*16}px`},children:[t.icon&&r.jsx("span",{className:"nice-drawer-nav-icon",children:t.icon}),r.jsx("span",{className:"nice-drawer-nav-label",children:t.label}),t.badge!==void 0&&r.jsx("span",{className:"nice-drawer-nav-badge",style:{background:t.badgeColor},children:t.badge}),d&&r.jsx("span",{className:`nice-drawer-nav-chevron ${i?"nice-drawer-nav-chevron--expanded":""}`,children:r.jsx(je,{direction:"down",style:{fontSize:18}})})]}),d&&i&&r.jsx("div",{className:"nice-drawer-nav-children",children:t.children.map(y=>r.jsx(Dt,{item:y,depth:n+1,onSelect:c,activeId:s},y.id))})]})},Dn=Object.assign(e.forwardRef(({open:t,onClose:n,position:c="left",variant:s="overlay",size:i,children:a,navItems:d,header:l,footer:f,swipeToOpen:y=!0,swipeToClose:w=!0,edgeSwipeWidth:C=20,velocityThreshold:D=.3,showOverlay:u=!0,closeOnOverlayClick:p=!0,closeOnEscape:N=!0,disableBodyScroll:I=!0,overlayColor:S,zIndex:m=1e3,onNavSelect:v,activeNavId:P,className:Q="",style:F,ariaLabel:Y},$)=>{const{t:j}=ue.useNiceTranslation(),k=Y??j("mobileDrawer.navigationDrawer","Navigation drawer"),[B,J]=e.useState(0),[W,Z]=e.useState(!1),[U,z]=e.useState(P),K=e.useRef(null),X=e.useRef({x:0,y:0}),re=e.useRef(0),ne=e.useRef({x:0,y:0}),V=c==="left"||c==="right",E=i??(V?280:400);e.useEffect(()=>{P!==void 0&&z(P)},[P]),e.useEffect(()=>{if(I&&t){const o=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=o}}},[t,I]),e.useEffect(()=>{if(!N||!t)return;const o=b=>{b.key==="Escape"&&n()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[N,t,n]),e.useEffect(()=>{if(!t||!K.current)return;const o=K.current,b=o.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),R=b[0],T=b[b.length-1],ee=O=>{O.key==="Tab"&&(O.shiftKey&&document.activeElement===R?(O.preventDefault(),T==null||T.focus()):!O.shiftKey&&document.activeElement===T&&(O.preventDefault(),R==null||R.focus()))};return o.addEventListener("keydown",ee),R==null||R.focus(),()=>o.removeEventListener("keydown",ee)},[t]);const H=e.useCallback(()=>{let o=0;const b=B;if(!t)switch(c){case"left":o=-100;break;case"right":o=100;break;case"top":o=-100;break;case"bottom":o=100;break}return V?`translateX(calc(${o}% + ${b}px))`:`translateY(calc(${o}% + ${b}px))`},[t,c,B,V]),g=e.useCallback(o=>{if(!w&&t)return;const b=o.touches[0];X.current={x:b.clientX,y:b.clientY},ne.current={x:b.clientX,y:b.clientY},re.current=Date.now()},[w,t]),A=e.useCallback(o=>{if(!w||!t)return;const b=o.touches[0],R=b.clientX-X.current.x,T=b.clientY-X.current.y;let ee=!1,O=0;switch(c){case"left":ee=R<0,O=Math.min(0,R);break;case"right":ee=R>0,O=Math.max(0,R);break;case"top":ee=T<0,O=Math.min(0,T);break;case"bottom":ee=T>0,O=Math.max(0,T);break}ee&&Math.abs(V?R:T)>10&&(Z(!0),J(O),ne.current={x:b.clientX,y:b.clientY},o.preventDefault())},[w,t,c,V]),h=e.useCallback(()=>{if(!W)return;const o=Date.now()-re.current,b=Math.abs(B),R=typeof E=="number"?E:280,T=b/o;(b>R*.3||T>D)&&n(),Z(!1),J(0)},[W,B,E,D,V,n]);e.useEffect(()=>{if(!y||t)return;let o=0,b=0,R=!1;const T=O=>{const ie=O.touches[0];o=ie.clientX,b=ie.clientY;const ae=window.innerWidth,se=window.innerHeight;switch(c){case"left":R=o<C;break;case"right":R=o>ae-C;break;case"top":R=b<C;break;case"bottom":R=b>se-C;break}},ee=O=>{if(!R)return;const ie=O.touches[0],ae=ie.clientX-o,se=ie.clientY-b,ce=50;let oe=!1;switch(c){case"left":oe=ae>ce;break;case"right":oe=ae<-ce;break;case"top":oe=se>ce;break;case"bottom":oe=se<-ce;break}oe&&O.preventDefault()};return document.addEventListener("touchstart",T,{passive:!0}),document.addEventListener("touchmove",ee,{passive:!1}),()=>{document.removeEventListener("touchstart",T),document.removeEventListener("touchmove",ee)}},[y,t,c,C]);const L=e.useCallback(o=>{z(o.id),v==null||v(o),o.href&&n()},[v,n]),x=e.useCallback(o=>{K.current=o,typeof $=="function"?$(o):$&&($.current=o)},[$]),M=e.useMemo(()=>({isOpen:t,position:c,close:n,activeNavId:U,setActiveNavId:z}),[t,c,n,U]);return r.jsxs(St.Provider,{value:M,children:[u&&s!=="persistent"&&r.jsx("div",{className:`nice-drawer-overlay ${t?"nice-drawer-overlay--visible":""}`,style:{zIndex:m-1,background:S,opacity:W?1-Math.abs(B)/(typeof E=="number"?E:280):void 0},onClick:p?n:void 0,"aria-hidden":"true"}),r.jsxs("div",{ref:x,className:`nice-drawer nice-drawer--${c} nice-drawer--${s} ${t?"nice-drawer--open":""} ${W?"nice-drawer--dragging":""} ${Q}`,style:{...F,[V?"width":"height"]:E,zIndex:m,transform:H()},onTouchStart:g,onTouchMove:A,onTouchEnd:h,role:"dialog","aria-modal":s!=="persistent","aria-label":k,"aria-hidden":!t,children:[l&&r.jsxs("div",{className:"nice-drawer-header",children:[l,r.jsx("button",{className:"nice-drawer-close",onClick:n,"aria-label":j("mobileDrawer.closeDrawer","Close drawer"),children:r.jsx(Xe,{style:{fontSize:24}})})]}),r.jsx("div",{className:"nice-drawer-content",children:d?r.jsx("nav",{className:"nice-drawer-nav","aria-label":j("mobileDrawer.mainNavigation","Main navigation"),children:d.map(o=>r.jsx(Dt,{item:o,onSelect:L,activeId:U},o.id))}):a}),f&&r.jsx("div",{className:"nice-drawer-footer",children:f})]})]})}),{displayName:"NiceMobileDrawer"});function Pn(t={}){const{defaultOpen:n=!1,onOpenChange:c}=t,[s,i]=e.useState(n),a=e.useCallback(()=>{i(!0),c==null||c(!0)},[c]),d=e.useCallback(()=>{i(!1),c==null||c(!1)},[c]),l=e.useCallback(()=>{i(y=>{const w=!y;return c==null||c(w),w})},[c]),f=e.useCallback(y=>{i(y),c==null||c(y)},[c]);return{isOpen:s,open:a,close:d,toggle:l,setOpen:f}}const Cn={home:r.jsx(de.NtdHome,{size:20,variant:"outline"}),settings:r.jsx(de.NtdSettings,{size:20,variant:"outline"}),user:r.jsx(de.NtdUser,{size:20,variant:"outline"}),search:r.jsx(de.NtdSearch,{size:20,variant:"outline"}),inbox:r.jsx(de.NtdInbox,{size:20,variant:"outline"}),heart:r.jsx(de.NtdHeart,{size:20,variant:"outline"}),folder:r.jsx(de.NtdFolder,{size:20,variant:"outline"}),help:r.jsx(de.NtdHelp,{size:20,variant:"outline"}),logout:r.jsx(de.NtdLogOut,{size:20,variant:"outline"})},In=[],Pt=e.createContext(null);function $n(){const t=e.useContext(Pt);if(!t)throw new Error("useMobileModal must be used within a NiceMobileModal");return t}function En(t={}){const{defaultOpen:n=!1,open:c,onOpenChange:s,preventDismiss:i=!1}=t,[a,d]=e.useState(n),l=c!==void 0,f=l?c:a,y=e.useCallback((u,p)=>{!u&&i&&p!=="close"||(l||d(u),s==null||s(u,p))},[l,s,i]),w=e.useCallback(()=>y(!0),[y]),C=e.useCallback(u=>y(!1,u),[y]),D=e.useCallback(()=>y(!f),[y,f]);return{open:f,openModal:w,closeModal:C,toggle:D,setOpen:u=>y(u)}}const _n=()=>r.jsx(Xe,{style:{fontSize:24}});function Ln(t,n,c){return t==="content"?Math.min(c,n):t==="full"?n:t<=1?n*t:Math.min(t,n)}function An(t,n,c){return Math.min(Math.max(t,n),c)}const Ge=e.forwardRef(function({open:n,onClose:c,title:s,children:i,footer:a,snapPoints:d=["content"],defaultSnapPoint:l=0,showHandle:f=!0,showClose:y=!0,showOverlay:w=!0,dismissOnDrag:C=!0,dismissOnOverlay:D=!0,dismissOnEscape:u=!0,preventDismiss:p=!1,onSnapChange:N,className:I="",overlayClassName:S="",headerClassName:m="",contentClassName:v="",footerClassName:P="",lockScroll:Q=!0,borderRadius:F=16,zIndex:Y,style:$,...j},k){const{t:B}=ue.useNiceTranslation(),W=`${e.useId()}-title`,Z=e.useRef(null),U=e.useRef(null),z=e.useRef(0),K=e.useRef(0),X=e.useRef(!1),[re,ne]=e.useState(l),[V,_]=e.useState(0),[E,H]=e.useState(400),[g,A]=e.useState(typeof window<"u"?window.innerHeight:800),[h,L]=e.useState(!1),x=d.map(G=>Ln(G,g,E));e.useEffect(()=>{if(typeof window>"u")return;const G=()=>{A(window.innerHeight)};return window.addEventListener("resize",G),()=>window.removeEventListener("resize",G)},[]),e.useEffect(()=>{if(!U.current||!n)return;const G=new ResizeObserver(()=>{const q=U.current,te=Z.current;if(!q)return;let le=0;for(const fe of Array.from((te==null?void 0:te.children)??[]))fe!==q&&(le+=fe.offsetHeight);H(Math.min(q.scrollHeight+le,g*.9))});return G.observe(U.current),()=>G.disconnect()},[n,g]),e.useEffect(()=>{if(n){const G=x[l]||x[0]||g*.5;_(G),ne(l)}},[n]);const M=x.join(",");e.useEffect(()=>{if(n&&!h){const G=M.split(",").map(Number),q=G[re]||G[0];_(q)}},[M,re,h,n]),e.useEffect(()=>{if(!Q||!n)return;const G=document.body.style.overflow,q=document.body.style.paddingRight,te=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",te>0&&(document.body.style.paddingRight=`${te}px`),()=>{document.body.style.overflow=G,document.body.style.paddingRight=q}},[n,Q]),e.useEffect(()=>{if(!n||!u||p)return;const G=q=>{q.key==="Escape"&&(c==null||c("escape"))};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[n,u,p,c]),e.useEffect(()=>{if(!n||!Z.current)return;const q=Z.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),te=q[0],le=q[q.length-1],fe=be=>{be.key==="Tab"&&(be.shiftKey?document.activeElement===te&&(be.preventDefault(),le==null||le.focus()):document.activeElement===le&&(be.preventDefault(),te==null||te.focus()))};return document.addEventListener("keydown",fe),requestAnimationFrame(()=>{te==null||te.focus()}),()=>document.removeEventListener("keydown",fe)},[n]);const o=e.useCallback(G=>{p&&G!=="close"||c==null||c(G)},[p,c]),b=e.useCallback(()=>{D&&o("overlay")},[D,o]),R=e.useCallback((G,q)=>{if(q>.5&&C&&!p)return-1;if(q<-.5)return x.length-1;let te=0,le=Math.abs(x[0]-G);for(let fe=1;fe<x.length;fe++){const be=Math.abs(x[fe]-G);be<le&&(le=be,te=fe)}return te},[x,C,p]),T=e.useCallback(G=>{X.current=!0,z.current=G,K.current=V,L(!0)},[V]),ee=e.useCallback(G=>{if(!X.current)return;const q=z.current-G,te=An(K.current+q,50,g);_(te)},[g]),O=e.useCallback((G,q)=>{if(!X.current)return;X.current=!1,L(!1);const te=R(V,q);if(te===-1){o("drag");return}ne(te),_(x[te]),N==null||N(te,d[te])},[V,R,o,x,d,N]),ie=G=>{T(G.touches[0].clientY)},ae=G=>{ee(G.touches[0].clientY)},se=G=>{const q=G.changedTouches[0],te=(z.current-q.clientY)/(G.timeStamp-(G.timeStamp-200));O(q.clientY,te>0?-te/1e3:te/1e3)},ce=G=>{G.preventDefault(),T(G.clientY);const q=le=>{ee(le.clientY)},te=le=>{const fe=(z.current-le.clientY)/200;O(le.clientY,fe>0?-fe/500:fe/500),document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",te)};document.addEventListener("mousemove",q),document.addEventListener("mouseup",te)},oe=e.useCallback(G=>{G<0||G>=x.length||(ne(G),_(x[G]),N==null||N(G,d[G]))},[x,d,N]),me={isOpen:n,snapPoints:d,currentSnapIndex:re,setSnapIndex:oe,close:o};return n?r.jsxs(r.Fragment,{children:[w&&r.jsx("div",{className:`nice-mobile-modal-overlay nice-mobile-modal-overlay--visible ${S}`,onClick:b,"aria-hidden":"true",style:{zIndex:Y?Y-1:void 0}}),r.jsx(Pt.Provider,{value:me,children:r.jsxs("div",{ref:G=>{Z.current=G,typeof k=="function"?k(G):k&&(k.current=G)},role:"dialog","aria-modal":"true","aria-labelledby":s?W:void 0,className:`nice-modal-sheet ${h?"nice-modal-sheet--dragging":""} ${I}`,style:{height:V,borderTopLeftRadius:F,borderTopRightRadius:F,zIndex:Y,...$},...j,children:[f&&r.jsx("div",{className:"nice-modal-handle-area",onTouchStart:ie,onTouchMove:ae,onTouchEnd:se,onMouseDown:ce,children:r.jsx("div",{className:"nice-modal-handle"})}),(s||y)&&r.jsxs("div",{className:`nice-modal-header ${m}`,children:[s&&r.jsx("h2",{id:W,className:"nice-modal-title",children:s}),y&&!p&&r.jsx("button",{type:"button",className:"nice-modal-close",onClick:()=>o("close"),"aria-label":B("mobileModal.closeModal","Close modal"),children:r.jsx(_n,{})})]}),r.jsx("div",{ref:U,className:`nice-modal-content ${v}`,children:i}),a&&r.jsx("div",{className:`nice-modal-footer ${P}`,children:a})]})})]}):null}),Hn=e.forwardRef(function({actions:n=In,cancelLabel:c,onClose:s,...i},a){const{t:d}=ue.useNiceTranslation(),l=c??d("mobileModal.cancel","Cancel");return r.jsx(Ge,{ref:a,onClose:s,showHandle:!0,showClose:!1,snapPoints:["content"],...i,children:r.jsxs("div",{className:"nice-action-sheet",children:[n.map(f=>r.jsxs("button",{type:"button",className:`nice-action-sheet-item ${f.destructive?"nice-action-sheet-item--destructive":""}`,disabled:f.disabled,onClick:()=>{var y;(y=f.onClick)==null||y.call(f),s==null||s("close")},children:[f.icon&&r.jsx("span",{className:"nice-action-sheet-icon",children:f.icon}),f.label]},f.id)),r.jsx("div",{className:"nice-action-sheet-divider"}),r.jsx("button",{type:"button",className:"nice-action-sheet-item nice-action-sheet-item--cancel",onClick:()=>s==null?void 0:s("close"),children:l})]})})}),Yn=e.forwardRef(function({title:n,message:c,confirmLabel:s,cancelLabel:i,confirmDestructive:a=!1,onConfirm:d,onCancel:l,onClose:f,...y},w){const{t:C}=ue.useNiceTranslation(),D=s??C("mobileModal.confirm","Confirm"),u=i??C("mobileModal.cancel","Cancel"),p=()=>{d==null||d(),f==null||f("close")},N=()=>{l==null||l(),f==null||f("close")};return r.jsx(Ge,{ref:w,title:n,onClose:f,showHandle:!0,snapPoints:["content"],footer:r.jsxs("div",{className:"nice-confirm-sheet-buttons",children:[r.jsx("button",{type:"button",className:"nice-confirm-sheet-btn nice-confirm-sheet-btn--cancel",onClick:N,children:u}),r.jsx("button",{type:"button",className:`nice-confirm-sheet-btn nice-confirm-sheet-btn--confirm ${a?"nice-confirm-sheet-btn--destructive":""}`,onClick:p,children:D})]}),...y,children:r.jsx("div",{className:"nice-confirm-sheet-message",children:c})})}),We=[],Ct=e.createContext(null);function Bn(t,n=500){const c=e.useRef(void 0),s=e.useRef(null),i=e.useCallback(l=>{s.current={x:l.clientX,y:l.clientY},c.current=setTimeout(()=>{t(l)},n)},[t,n]),a=e.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=void 0),s.current=null},[]),d=e.useCallback(l=>{if(!s.current)return;const f=Math.abs(l.clientX-s.current.x),y=Math.abs(l.clientY-s.current.y);(f>10||y>10)&&a()},[a]);return e.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]),{onPointerDown:i,onPointerMove:d,onPointerUp:a,onPointerCancel:a,onPointerLeave:a}}const lt=({item:t,onSelect:n})=>{const c=e.useContext(Ct),s=e.useRef(null),[i,a]=e.useState(null),d=e.useCallback(()=>{var w;if(!t.disabled)if(t.children&&t.children.length>0){if(s.current){const C=s.current.getBoundingClientRect();c==null||c.openSubmenu(t.id,{x:C.right,y:C.top})}}else(w=t.onClick)==null||w.call(t),n(t)},[t,n,c]),l=e.useCallback(()=>{if(t.children&&t.children.length>0&&s.current){const w=s.current.getBoundingClientRect();c==null||c.openSubmenu(t.id,{x:w.right,y:w.top})}},[t,c]),f=t.children&&t.children.length>0,y=(c==null?void 0:c.activeSubmenu)===t.id;return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:s,type:"button",className:`nice-touch-menu-item ${t.disabled?"nice-touch-menu-item--disabled":""} ${t.danger?"nice-touch-menu-item--danger":""} ${y?"nice-touch-menu-item--active":""}`,onClick:d,onKeyDown:w=>{f&&w.key==="ArrowRight"&&(w.preventDefault(),d())},onPointerEnter:l,disabled:t.disabled,role:"menuitem","aria-haspopup":f?"menu":void 0,"aria-expanded":f?y:void 0,children:[t.icon&&r.jsx("span",{className:"nice-touch-menu-item-icon",children:t.icon}),r.jsx("span",{className:"nice-touch-menu-item-label",children:t.label}),t.shortcut&&r.jsx("span",{className:"nice-touch-menu-item-shortcut",children:t.shortcut}),f&&r.jsx("span",{className:"nice-touch-menu-item-arrow","aria-hidden":"true"})]}),t.divider&&r.jsx("div",{className:"nice-touch-menu-divider",role:"separator"})]})},It=e.forwardRef(function({items:n=We,open:c,position:s,onClose:i,haptic:a=!0,className:d="",...l},f){var F;const y=e.useRef(null),[w,C]=e.useState(null),[D,u]=e.useState(null),[p,N]=e.useState(s);e.useEffect(()=>{if(!c||!y.current)return;const $=y.current.getBoundingClientRect(),j={width:window.innerWidth,height:window.innerHeight};let k=s.x,B=s.y;k+$.width>j.width-8&&(k=j.width-$.width-8),k<8&&(k=8),B+$.height>j.height-8&&(B=j.height-$.height-8),B<8&&(B=8),N({x:k,y:B})},[c,s]),e.useEffect(()=>{if(!c)return;const Y=$=>{y.current&&!y.current.contains($.target)&&i()};return document.addEventListener("mousedown",Y),()=>{document.removeEventListener("mousedown",Y)}},[c,i]);const I=e.useRef(null),S=e.useCallback(()=>{C(null),u(null)},[]);ue.useOverlayFocus(y,{open:c,modal:!1,onClose:i}),ue.useRovingFocus(y,{orientation:"vertical",wrap:!0,typeahead:!0}),ue.useOverlayFocus(I,{open:c&&w!=null,modal:!1,onClose:S}),ue.useRovingFocus(I,{orientation:"vertical",wrap:!0,typeahead:!0});const m=e.useCallback(()=>{if(!(!a||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[a]),v=e.useCallback(Y=>{m(),i()},[m,i]),P={close:i,openSubmenu:(Y,$)=>{C(Y),u($)},closeSubmenu:S,activeSubmenu:w};if(!c)return null;const Q=w?(F=n.find(Y=>Y.id===w))==null?void 0:F.children:null;return r.jsx(Ct.Provider,{value:P,children:r.jsxs("div",{ref:y,className:`nice-touch-menu-popover ${d}`,style:{left:p.x,top:p.y},role:"menu",...l,children:[n.map(Y=>r.jsx(lt,{item:Y,onSelect:v},Y.id)),Q&&D&&r.jsx("div",{ref:I,className:"nice-touch-menu-popover nice-touch-menu-submenu",style:{left:D.x-p.x,top:D.y-p.y},role:"menu",onKeyDown:Y=>{Y.key==="ArrowLeft"&&(Y.preventDefault(),S())},children:Q.map(Y=>r.jsx(lt,{item:Y,onSelect:v},Y.id))})]})})}),Fn=e.forwardRef(function({items:n=We,trigger:c,longPress:s=!0,longPressDelay:i=500,enableContextMenu:a=!1,enableClick:d=!1,haptic:l=!0,disabled:f=!1,onOpen:y,onClose:w,className:C="",...D},u){const[p,N]=e.useState(!1),[I,S]=e.useState({x:0,y:0}),m=e.useRef(null),v=e.useCallback(()=>{if(!(!l||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(20)}catch{}},[l]),P=e.useCallback((j,k)=>{f||(v(),S({x:j,y:k}),N(!0),y==null||y())},[f,v,y]),Q=e.useCallback(()=>{N(!1),w==null||w()},[w]),F=Bn(j=>{j.preventDefault(),P(j.clientX,j.clientY)},i),Y=e.useCallback(j=>{if(!(!d||f)&&(j.preventDefault(),j.stopPropagation(),m.current)){const k=m.current.getBoundingClientRect();P(k.left,k.bottom+4)}},[d,f,P]),$=e.useCallback(j=>{!a||f||(j.preventDefault(),P(j.clientX,j.clientY))},[a,f,P]);return r.jsxs(r.Fragment,{children:[r.jsx("div",{role:"presentation",ref:j=>{m.current=j,typeof u=="function"?u(j):u&&(u.current=j)},className:`nice-touch-menu-trigger ${f?"nice-touch-menu-trigger--disabled":""} ${C}`,onClick:Y,onContextMenu:$,...s&&!f?F:{},...D,children:c}),r.jsx(It,{items:n,open:p,position:I,onClose:Q,haptic:l})]})}),$t=e.forwardRef(function({items:n=We,open:c,onClose:s,title:i,cancelLabel:a,haptic:d=!0,className:l="",...f},y){const{t:w}=ue.useNiceTranslation(),C=a??w("touchMenu.cancel","Cancel"),D=e.useCallback(()=>{if(!(!d||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[d]),u=e.useCallback(m=>{var v;m.disabled||(D(),(v=m.onClick)==null||v.call(m),s())},[D,s]),p=e.useCallback(()=>{D(),s()},[D,s]),N=e.useCallback(m=>{m.target===m.currentTarget&&s()},[s]),I=e.useRef(null),S=e.useCallback(m=>{I.current=m,typeof y=="function"?y(m):y&&(y.current=m)},[y]);return ue.useOverlayFocus(I,{open:c,onClose:s,closeHint:C}),c?r.jsx("div",{role:"presentation",className:`nice-action-sheet-backdrop ${c?"nice-action-sheet-backdrop--open":""}`,onClick:N,children:r.jsxs("div",{ref:S,className:`nice-action-sheet ${l}`,role:"dialog","aria-modal":"true",...f,children:[r.jsxs("div",{className:"nice-action-sheet-content",children:[i&&r.jsx("div",{className:"nice-action-sheet-title",children:i}),n.map(m=>r.jsxs("button",{type:"button",className:`nice-action-sheet-item ${m.disabled?"nice-action-sheet-item--disabled":""} ${m.danger?"nice-action-sheet-item--danger":""}`,onClick:()=>u(m),disabled:m.disabled,children:[m.icon&&r.jsx("span",{className:"nice-action-sheet-item-icon",children:m.icon}),r.jsx("span",{className:"nice-action-sheet-item-label",children:m.label})]},m.id))]}),r.jsx("button",{type:"button",className:"nice-action-sheet-cancel",onClick:p,children:C})]})}):null}),zn=[],Et=e.createContext(null);function On(){const t=e.useContext(Et);if(!t)throw new Error("useMobileTabs must be used within a NiceMobileTabs");return t}function Vn(t){var C;const{tabs:n,defaultTab:c,activeTab:s,onChange:i}=t,[a,d]=e.useState(c||((C=n[0])==null?void 0:C.id)||""),l=s!==void 0,f=l?s:a,y=e.useCallback(D=>{const u=n.find(p=>p.id===D);!u||u.disabled||(l||d(D),i==null||i(D))},[n,l,i]),w=e.useCallback(D=>f===D,[f]);return{activeTab:f,setActiveTab:y,tabs:n,isActive:w}}const he={home:r.jsx(de.NtdHome,{size:24,variant:"outline"}),homeFilled:r.jsx(de.NtdHome,{size:24,variant:"solid"}),search:r.jsx(de.NtdSearch,{size:24,variant:"outline"}),plus:r.jsx(de.NtdPlus,{size:24,variant:"outline"}),heart:r.jsx(de.NtdHeart,{size:24,variant:"outline"}),heartFilled:r.jsx(de.NtdHeart,{size:24,variant:"solid"}),user:r.jsx(de.NtdUser,{size:24,variant:"outline"}),userFilled:r.jsx(de.NtdUser,{size:24,variant:"solid"}),bell:r.jsx(de.NtdBell,{size:24,variant:"outline"}),bellFilled:r.jsx(de.NtdBell,{size:24,variant:"solid"}),cart:r.jsx(de.NtdCart,{size:24,variant:"outline"}),inbox:r.jsx(de.NtdInbox,{size:24,variant:"outline"}),settings:r.jsx(de.NtdSettings,{size:24,variant:"outline"}),more:r.jsx(de.NtdMoreHorizontal,{size:24,variant:"outline"})},ut=({content:t,variant:n="count",color:c})=>{if(t===void 0||t===!1)return null;if(t===!0||n==="dot")return r.jsx("span",{className:"nice-tab-badge nice-tab-badge--dot",style:c?{backgroundColor:c}:void 0});const s=typeof t=="number"&&t>99?"99+":t;return r.jsx("span",{className:"nice-tab-badge nice-tab-badge--count",style:c?{backgroundColor:c}:void 0,children:s})},dt=({tab:t,isActive:n,showLabel:c,animation:s,activeColor:i,inactiveColor:a,opensSheet:d,onClick:l})=>{const{t:f}=ue.useNiceTranslation(),y=t.labelKey?f(t.labelKey,t.label):t.label,w=e.useRef(null);e.useEffect(()=>{if(!w.current||s==="none")return;const u=w.current;s==="scale"&&n&&(u.style.transform="scale(1.2)",setTimeout(()=>{u.style.transform="scale(1)"},150))},[n,s]);const C=n&&t.activeIcon?t.activeIcon:t.icon,D={};return n&&i?D.color=i:!n&&a&&(D.color=a),t.href?r.jsxs("a",{href:t.href,className:`nice-tab-button ${n?"nice-tab-button--active":""} ${t.disabled?"nice-tab-button--disabled":""} ${t.className||""}`,style:D,role:"tab","aria-selected":n,"data-tab-id":t.id,onClick:u=>{var p;if(t.disabled){u.preventDefault();return}(p=t.onClick)==null||p.call(t),l()},children:[r.jsx("span",{ref:w,className:"nice-tab-icon",children:C}),c&&r.jsx("span",{className:"nice-tab-label",children:y}),r.jsx(ut,{content:t.badge,variant:t.badgeVariant,color:t.badgeColor})]}):r.jsxs("button",{type:"button",className:`nice-tab-button ${n?"nice-tab-button--active":""} ${t.disabled?"nice-tab-button--disabled":""} ${t.className||""}`,style:D,disabled:t.disabled,role:"tab","aria-selected":n,"aria-haspopup":d?"dialog":void 0,"data-tab-id":t.id,"aria-label":c?void 0:y,onClick:()=>{var u;(u=t.onClick)==null||u.call(t),l()},children:[r.jsx("span",{ref:w,className:"nice-tab-icon",children:C}),c&&r.jsx("span",{className:"nice-tab-label",children:y}),r.jsx(ut,{content:t.badge,variant:t.badgeVariant,color:t.badgeColor})]})},Kn=e.forwardRef(function({tabs:n=zn,activeTab:c,defaultTab:s,onChange:i,showLabels:a=!0,showAllLabels:d=!0,position:l="bottom",variant:f="default",haptic:y=!0,animation:w="scale",maxTabs:C,moreLabel:D,moreIcon:u=he.more,safeArea:p=!0,activeColor:N,inactiveColor:I,backgroundColor:S,hideOnScroll:m="none",lockScroll:v=!0,className:P="",style:Q,...F},Y){var A;const{t:$}=ue.useNiceTranslation(),j=D??$("mobileTabs.more","More"),[k,B]=e.useState(s||((A=n[0])==null?void 0:A.id)||""),[J,W]=e.useState(!1),[Z,U]=e.useState(!1),z=e.useRef(0),K=c!==void 0,X=K?c:k,re=e.useRef(null),ne=e.useCallback(h=>{re.current=h,typeof Y=="function"?Y(h):Y&&(Y.current=h)},[Y]);e.useEffect(()=>{if(m==="none"||typeof window>"u")return;const h=()=>{const L=window.scrollY,x=L>z.current?"down":"up";x===m&&L>50?W(!0):x!==m&&W(!1),z.current=L};return window.addEventListener("scroll",h,{passive:!0}),()=>window.removeEventListener("scroll",h)},[m]);const V=e.useCallback(h=>{const L=n.find(x=>x.id===h);!L||L.disabled||(y&&"vibrate"in navigator&&navigator.vibrate(10),K||B(h),i==null||i(h))},[n,y,K,i]);ue.useRovingFocus(re,{orientation:"horizontal",wrap:!0,onMove:h=>{const L=h.getAttribute("data-tab-id");L&&L!=="__more__"&&V(L)}});const _=C&&n.length>C?n.slice(0,C-1):n,E=C&&n.length>C?n.slice(C-1):[],H={activeTab:X,setActiveTab:V,tabs:n},g={...Q};return S&&(g.backgroundColor=S),r.jsxs(Et.Provider,{value:H,children:[r.jsxs("nav",{ref:ne,className:`nice-mobile-tabs nice-mobile-tabs--${l} nice-mobile-tabs--${f} ${p?"nice-mobile-tabs--safe-area":""} ${J?"nice-mobile-tabs--hidden":""} ${P}`,style:g,role:"tablist","aria-label":$("mobileTabs.mainNavigation","Main navigation"),...F,children:[_.map(h=>{const L=h.id===X,x=d||a&&L;return r.jsx(dt,{tab:h,isActive:L,showLabel:x,animation:w,activeColor:N,inactiveColor:I,onClick:()=>V(h.id)},h.id)}),E.length>0&&r.jsx(dt,{tab:{id:"__more__",label:j,icon:u,badge:E.some(h=>h.badge)?!0:void 0},isActive:E.some(h=>h.id===X),showLabel:d||a,animation:w,activeColor:N,inactiveColor:I,opensSheet:!0,onClick:()=>U(!0)})]}),E.length>0&&r.jsx($t,{open:Z,onClose:()=>U(!1),title:j,items:E.map(h=>({id:h.id,label:h.labelKey?$(h.labelKey,h.label):h.label,icon:h.icon,disabled:h.disabled,onClick:()=>V(h.id)}))})]})}),Un={basic:[{id:"home",label:"Home",labelKey:"mobileTabs.preset.home",icon:he.home,activeIcon:he.homeFilled},{id:"search",label:"Search",labelKey:"mobileTabs.preset.search",icon:he.search},{id:"notifications",label:"Alerts",labelKey:"mobileTabs.preset.alerts",icon:he.bell,activeIcon:he.bellFilled},{id:"profile",label:"Profile",labelKey:"mobileTabs.preset.profile",icon:he.user,activeIcon:he.userFilled}],social:[{id:"feed",label:"Feed",labelKey:"mobileTabs.preset.feed",icon:he.home,activeIcon:he.homeFilled},{id:"discover",label:"Discover",labelKey:"mobileTabs.preset.discover",icon:he.search},{id:"create",label:"Create",labelKey:"mobileTabs.preset.create",icon:he.plus},{id:"activity",label:"Activity",labelKey:"mobileTabs.preset.activity",icon:he.heart,activeIcon:he.heartFilled},{id:"profile",label:"Profile",labelKey:"mobileTabs.preset.profile",icon:he.user,activeIcon:he.userFilled}],ecommerce:[{id:"shop",label:"Shop",labelKey:"mobileTabs.preset.shop",icon:he.home,activeIcon:he.homeFilled},{id:"search",label:"Search",labelKey:"mobileTabs.preset.search",icon:he.search},{id:"cart",label:"Cart",labelKey:"mobileTabs.preset.cart",icon:he.cart},{id:"favorites",label:"Wishlist",labelKey:"mobileTabs.preset.wishlist",icon:he.heart,activeIcon:he.heartFilled},{id:"account",label:"Account",labelKey:"mobileTabs.preset.account",icon:he.user,activeIcon:he.userFilled}],messaging:[{id:"chats",label:"Chats",labelKey:"mobileTabs.preset.chats",icon:he.inbox},{id:"calls",label:"Calls",labelKey:"mobileTabs.preset.calls",icon:he.bell},{id:"contacts",label:"Contacts",labelKey:"mobileTabs.preset.contacts",icon:he.user,activeIcon:he.userFilled},{id:"settings",label:"Settings",labelKey:"mobileTabs.preset.settings",icon:he.settings}]},_t=e.createContext(null);function Xn(){const t=e.useContext(_t);if(!t)throw new Error("useMobileHeader must be used within a NiceMobileHeader");return t}function Gn(t={}){const{collapsedHeight:n=56,expandedHeight:c=200,scrollElement:s,mode:i="scroll",threshold:a=0}=t,[d,l]=e.useState(0),[f,y]=e.useState(!0),w=e.useRef(null),C=e.useRef(0),D=e.useRef(!1),u=c-n,p=c-d*u,N=d>=1;e.useEffect(()=>{const m=s||w.current||window,v=()=>{D.current||(D.current=!0,requestAnimationFrame(()=>{const P=m===window?window.scrollY:m.scrollTop,Q=P-C.current;if(i==="scroll"||i==="exitUntilCollapsed"){const F=Math.min(1,Math.max(0,(P-a)/u));l(F)}if(i==="enterAlways"){Q>5&&P>a?y(!1):Q<-5&&y(!0);const F=u>0?Math.min(1,Math.max(0,P/u)):0;l(F)}C.current=P,D.current=!1}))};return m.addEventListener("scroll",v,{passive:!0}),v(),()=>m.removeEventListener("scroll",v)},[s,i,a,u]);const I=e.useCallback(()=>{l(0),y(!0)},[]),S=e.useCallback(()=>{l(1)},[]);return{progress:d,height:p,isCollapsed:N,isVisible:f,scrollRef:w,expand:I,collapse:S}}const Wn=()=>r.jsx(de.NtdChevronLeft,{size:24,variant:"outline"}),qn=()=>r.jsx(de.NtdMenu,{size:24,variant:"outline"}),Jn=()=>r.jsx(de.NtdSearch,{size:24,variant:"outline"}),Qn=()=>r.jsx(de.NtdMoreVertical,{size:24,variant:"outline"}),Zn={back:r.jsx(Wn,{}),menu:r.jsx(qn,{}),search:r.jsx(Jn,{}),more:r.jsx(Qn,{})},er=({action:t})=>r.jsxs("button",{type:"button",className:`nice-header-action ${t.disabled?"nice-header-action--disabled":""}`,onClick:t.onClick,disabled:t.disabled,"aria-label":t.label,title:t.label,children:[t.icon,t.badge!==void 0&&t.badge!==!1&&r.jsx("span",{className:`nice-header-badge ${t.badge===!0?"nice-header-badge--dot":""}`,children:t.badge!==!0&&t.badge})]}),Ee=e.forwardRef(function({title:n,largeTitle:c,subtitle:s,leftAction:i,rightActions:a=[],background:d,mode:l="scroll",variant:f="default",collapsedHeight:y=56,expandedHeight:w=c||d?140:56,parallax:C=!1,parallaxSpeed:D=.5,showShadow:u=!0,sticky:p=!0,zIndex:N=100,scrollElement:I,onCollapseChange:S,safeArea:m=!0,backgroundColor:v,textColor:P,showBorder:Q=!1,collapsedContent:F,expandedContent:Y,className:$="",style:j,children:k,...B},J){const[W,Z]=e.useState(0),[U,z]=e.useState(!0),K=e.useRef(null),X=e.useRef(0),re=e.useRef(!1),ne=w-y,V=w-W*ne,_=W>=.9;e.useEffect(()=>{const x=I||window,M=()=>{re.current||(re.current=!0,requestAnimationFrame(()=>{const o=x===window?window.scrollY:x.scrollTop,b=o-X.current;if(l==="scroll"||l==="exitUntilCollapsed"){const R=ne>0?Math.min(1,Math.max(0,o/ne)):0;Z(R),S&&Math.abs(R-W)>.05&&S(R>=.9,R)}if(l==="enterAlways"){b>5&&o>y?z(!1):b<-5&&z(!0);const R=ne>0?Math.min(1,Math.max(0,o/ne)):0;Z(R)}X.current=o,re.current=!1}))};return x.addEventListener("scroll",M,{passive:!0}),M(),()=>x.removeEventListener("scroll",M)},[I,l,ne,y,S,W]);const E=1-W*2,H=W>.5?(W-.5)*2:0,g=1-W,A=C?`translateY(${W*ne*D}px) scale(${1+W*.1})`:void 0,h={height:l==="pin"?y:V,zIndex:N,...j};v&&(h.backgroundColor=v),P&&(h.color=P);const L={progress:W,isCollapsed:_,height:V,expandedHeight:w,collapsedHeight:y};return r.jsxs(_t.Provider,{value:L,children:[r.jsxs("header",{ref:x=>{K.current=x,typeof J=="function"?J(x):J&&(J.current=x)},className:`
1
+ "use strict";var tn=Object.defineProperty;var nn=(t,n,c)=>n in t?tn(t,n,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[n]=c;var nt=(t,n,c)=>nn(t,typeof n!="symbol"?n+"":n,c);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),oe=require("@nice2dev/ui-core"),e=require("react"),de=require("@nice2dev/icons"),rn=({style:t})=>r.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.3em",height:"0.6em",margin:"0 0.35em 0.15em 0.1em",borderRight:"0.12em solid currentColor",borderBottom:"0.12em solid currentColor",transform:"rotate(45deg)",...t}}),$e=({style:t})=>r.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.85em",height:"0.85em",borderRadius:"50%",border:"0.12em solid currentColor",borderTopColor:"transparent",transform:"rotate(-45deg)",...t}}),rt={down:{transform:"rotate(45deg)",margin:"0 0 0.2em"},up:{transform:"rotate(-135deg)",margin:"0.2em 0 0"},left:{transform:"rotate(135deg)",margin:"0 0 0 0.2em"},right:{transform:"rotate(-45deg)",margin:"0 0.2em 0 0"}},Se=({direction:t,style:n})=>r.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.45em",height:"0.45em",margin:rt[t].margin,borderRight:"0.12em solid currentColor",borderBottom:"0.12em solid currentColor",transform:rt[t].transform,...n}}),Ge=({style:t})=>r.jsxs("span",{"aria-hidden":"true",style:{display:"inline-block",position:"relative",width:"0.7em",height:"0.7em",...t},children:[r.jsx("span",{style:{position:"absolute",top:"50%",left:0,width:"100%",height:"0.12em",background:"currentColor",transform:"translateY(-50%) rotate(45deg)"}}),r.jsx("span",{style:{position:"absolute",top:"50%",left:0,width:"100%",height:"0.12em",background:"currentColor",transform:"translateY(-50%) rotate(-45deg)"}})]}),wt=e.createContext(null);function Nt(){const t=e.useContext(wt);if(!t)throw new Error("usePullToRefresh must be used within NicePullToRefresh");return t}function Ce(t="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const n={light:10,medium:25,heavy:50};navigator.vibrate(n[t])}}const kt=({state:t,progress:n,pullDistance:c,threshold:s})=>{const{t:i}=oe.useNiceTranslation(),a=n*360,d=Math.min(1,n),l=()=>{switch(t){case"pulling":return r.jsx("span",{className:"nice-ptr__icon nice-ptr__icon-arrow",style:{transform:`rotate(${Math.min(a,180)}deg)`},children:r.jsx(Se,{direction:"down"})});case"ready":return r.jsx("span",{className:"nice-ptr__icon nice-ptr__icon-ready",children:r.jsx($e,{})});case"refreshing":return r.jsx("span",{className:"nice-ptr__icon nice-ptr__icon-spinner",children:r.jsx($e,{})});case"success":return r.jsx("span",{className:"nice-ptr__icon nice-ptr__icon-success",children:r.jsx(rn,{})});case"error":return r.jsx("span",{className:"nice-ptr__icon nice-ptr__icon-error",children:r.jsx(Ge,{})});default:return null}},f=()=>{switch(t){case"pulling":return i("pullToRefresh.pullDownToRefresh","Pull down to refresh");case"ready":return i("pullToRefresh.releaseToRefresh","Release to refresh");case"refreshing":return i("pullToRefresh.refreshing","Refreshing...");case"success":return i("pullToRefresh.updated","Updated!");case"error":return i("pullToRefresh.failedToRefresh","Failed to refresh");default:return""}};return r.jsxs("div",{className:`nice-ptr__indicator nice-ptr__indicator--${t}`,style:{opacity:t==="idle"?0:Math.max(.3,n),transform:`scale(${d})`},role:"status","aria-live":"polite",children:[r.jsx("div",{className:"nice-ptr__indicator-icon",children:l()}),r.jsx("span",{className:"nice-ptr__indicator-text",children:f()}),t==="pulling"&&r.jsx("div",{className:"nice-ptr__progress-ring",children:r.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 32 32",children:[r.jsx("circle",{className:"nice-ptr__progress-bg",cx:"16",cy:"16",r:"14",fill:"none",strokeWidth:"2"}),r.jsx("circle",{className:"nice-ptr__progress-fill",cx:"16",cy:"16",r:"14",fill:"none",strokeWidth:"2",strokeDasharray:`${88*n} 88`,transform:"rotate(-90 16 16)"})]})})]})},jt=Object.assign(e.forwardRef(({children:t,onRefresh:n,indicator:c,threshold:s=80,maxPull:i=150,resistance:a=.4,completionDuration:d=1e3,hapticFeedback:l=!0,disabled:f=!1,onPullStart:y,onPullProgress:w,onRefreshSuccess:C,onRefreshError:P,className:u="",style:p,ariaLabel:N},I)=>{const{t:S}=oe.useNiceTranslation(),m=N??S("pullToRefresh.pullToRefresh","Pull to refresh"),[v,D]=e.useState("idle"),[J,F]=e.useState(0),Y=e.useRef(null),$=e.useRef(null),T=e.useRef(0),k=e.useRef(0),O=e.useRef(!1),q=e.useRef(!1),W=Math.min(1,J/s),Z=v==="refreshing",X=e.useCallback(()=>J<=0?0:((g,A,h)=>{const L=g*(1-h);return Math.min(A,L+L*h/2)})(J,i,a),[J,i,a]),V=e.useCallback(async()=>{if(!(v==="refreshing"||f)){D("refreshing"),l&&Ce("medium");try{await n(),D("success"),l&&Ce("heavy"),C==null||C()}catch(H){D("error"),l&&Ce("light"),P==null||P(H instanceof Error?H:new Error("Refresh failed"))}setTimeout(()=>{D("idle"),F(0)},d)}},[v,f,l,n,C,P,d]),U=e.useCallback(H=>{if(f||v==="refreshing")return;const g=$.current,A=(g==null?void 0:g.scrollTop)??0;A>0||(T.current=H.touches[0].clientY,k.current=A,q.current=!1)},[f,v]),G=e.useCallback(H=>{if(f||v==="refreshing")return;const g=$.current;if(((g==null?void 0:g.scrollTop)??0)>0&&!O.current)return;const L=H.touches[0].clientY-T.current;if(L<=0){O.current&&(O.current=!1,D("idle"),F(0));return}O.current||(O.current=!0,y==null||y(),D("pulling")),H.preventDefault(),F(L);const x=Math.min(1,L/s);w==null||w(x),L>=s?v!=="ready"&&(D("ready"),l&&!q.current&&(Ce("light"),q.current=!0)):v==="ready"&&(D("pulling"),q.current=!1)},[f,v,s,l,y,w]),re=e.useCallback(()=>{O.current&&(O.current=!1,v==="ready"?V():(D("idle"),F(0)))},[v,V]),ne=e.useCallback(H=>{(H.key==="F5"||H.ctrlKey&&H.key==="r")&&(H.preventDefault(),V())},[V]),K=e.useCallback(H=>{Y.current=H,typeof I=="function"?I(H):I&&(I.current=H)},[I]),_={state:v,progress:W,isRefreshing:Z,triggerRefresh:V},E=X();return r.jsx(wt.Provider,{value:_,children:r.jsxs("div",{ref:K,className:`nice-ptr ${u} nice-ptr--${v}`,style:p,onTouchStart:U,onTouchMove:G,onTouchEnd:re,onKeyDown:ne,tabIndex:0,role:"region","aria-label":m,"data-state":v,"data-disabled":f||void 0,children:[r.jsx("div",{className:"nice-ptr-indicator-wrapper",style:{height:E,opacity:v==="idle"?0:1},children:c?r.jsx(c,{state:v,progress:W,pullDistance:J,threshold:s}):r.jsx(kt,{state:v,progress:W,pullDistance:J,threshold:s})}),r.jsx("div",{ref:$,className:"nice-ptr-content",style:{transform:v==="refreshing"?`translateY(${s}px)`:`translateY(${E}px)`,transition:O.current?"none":"transform 0.3s cubic-bezier(0.23, 1, 0.32, 1)"},children:t})]})})}),{displayName:"NicePullToRefresh"}),cn=({state:t,progress:n})=>r.jsxs("div",{className:`nice-ptr__dots nice-ptr__dots--${t}`,children:[r.jsx("span",{className:"nice-ptr__dot",style:{opacity:Math.min(1,n*3)}}),r.jsx("span",{className:"nice-ptr__dot",style:{opacity:Math.min(1,(n-.33)*3)}}),r.jsx("span",{className:"nice-ptr__dot",style:{opacity:Math.min(1,(n-.66)*3)}})]}),sn=({state:t,progress:n})=>r.jsx("div",{className:`nice-ptr__line nice-ptr__line--${t}`,children:r.jsx("div",{className:"nice-ptr__line-fill",style:{width:`${n*100}%`}})}),an=({state:t})=>{const n={idle:"",pulling:"👇",ready:"🔄",refreshing:"⏳",success:"✅",error:"❌"};return r.jsx("div",{className:`nice-ptr__emoji nice-ptr__emoji--${t}`,children:r.jsx("span",{className:"nice-ptr__emoji-icon",children:n[t]})})},on=({state:t,progress:n})=>r.jsx("div",{className:`nice-ptr__ios nice-ptr__ios--${t}`,children:r.jsx("div",{className:"nice-ptr__ios-spinner",children:Array.from({length:12}).map((s,i)=>{const a=i/12*360,d=i/12*1,l=t==="refreshing"?void 0:Math.min(1,n*2-i*.08);return r.jsx("div",{className:"nice-ptr__ios-bar",style:{transform:`rotate(${a}deg) translateY(-8px)`,animationDelay:`${d}s`,opacity:l}},i)})})}),ln=({state:t,progress:n})=>r.jsxs("div",{className:`nice-ptr__material nice-ptr__material--${t}`,children:[r.jsxs("svg",{className:"nice-ptr__material-circle",viewBox:"0 0 36 36",width:"36",height:"36",children:[r.jsx("circle",{className:"nice-ptr__material-bg",cx:"18",cy:"18",r:"16",fill:"none",strokeWidth:"3"}),r.jsx("circle",{className:"nice-ptr__material-progress",cx:"18",cy:"18",r:"16",fill:"none",strokeWidth:"3",strokeDasharray:`${100*n} 100`,strokeLinecap:"round",transform:"rotate(-90 18 18)"})]}),(t==="success"||t==="error")&&r.jsx("span",{className:"nice-ptr__material-icon",children:t==="success"?r.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.3em",height:"0.6em",marginBottom:"0.15em",borderRight:"0.12em solid currentColor",borderBottom:"0.12em solid currentColor",transform:"rotate(45deg)"}}):"!"})]}),ct=6,Tt=e.createContext(null),Mt=({children:t})=>{const[n,c]=e.useState(null);return r.jsx(Tt.Provider,{value:{activeItemId:n,setActiveItemId:c},children:t})};function Rt(){return e.useContext(Tt)}function Ie(t="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const n={light:10,medium:25,heavy:50};navigator.vibrate(n[t])}}const st=({action:t,width:n,progress:c,index:s,total:i,side:a,onTrigger:d})=>{const{t:l}=oe.useNiceTranslation(),f=t.labelKey?l(t.labelKey,t.label):t.label,y=Math.min(1,c*2),w=a==="right"?(i-1-s)*.05:s*.05;return r.jsxs("button",{className:`nice-swipe-action nice-swipe-action--${a} ${t.destructive?"nice-swipe-action--destructive":""}`,style:{width:n,background:t.background||"var(--nice-color-primary, #3b82f6)",color:t.color||"var(--nice-color-white, #ffffff)",transform:`scale(${y})`,transitionDelay:`${w}s`},onClick:d,"aria-label":f,children:[t.icon&&r.jsx("span",{className:"nice-swipe-action-icon",children:t.icon}),r.jsx("span",{className:"nice-swipe-action-label",children:f})]})},un=Object.assign(e.forwardRef(({children:t,leftActions:n=[],rightActions:c=[],actionWidth:s=72,threshold:i=.4,direction:a,exclusive:d=!0,onSwipeStart:l,onSwipeEnd:f,onAction:y,disabled:w=!1,className:C="",style:P,itemId:u,hapticFeedback:p=!0},N)=>{const{t:I}=oe.useNiceTranslation(),S=Rt(),[m,v]=e.useState(0),[D,J]=e.useState(null),[F,Y]=e.useState(!1),$=e.useRef(null),T=e.useRef(0),k=e.useRef(0),O=e.useRef(0),q=e.useRef(!1),W=e.useRef(null),Z=e.useRef(!1),X=-(n.length*s),V=c.length*s,U=(a==="left"||a==="both"||!a)&&n.length>0,G=(a==="right"||a==="both"||!a)&&c.length>0,re=Math.min(1,Math.abs(m)/Math.abs(X)),ne=Math.min(1,m/V),K=e.useMemo(()=>u||`swipe-${Math.random().toString(36).substr(2,9)}`,[u]),_=e.useCallback(()=>{Y(!0),v(0),J(null),setTimeout(()=>Y(!1),300)},[]);e.useEffect(()=>{d&&S&&S.activeItemId!==null&&S.activeItemId!==K&&D&&_()},[d,S,K,D,_]);const E=e.useRef(null),H=e.useRef(!1),[g,A]=e.useState(!1),h=e.useCallback(R=>{w||F||E.current!==null||R.pointerType==="mouse"&&R.button!==0||(E.current=R.pointerId,T.current=R.clientX,k.current=R.clientY,O.current=m,q.current=!1,W.current=null,Z.current=!1)},[w,F,m]),L=e.useCallback(R=>{var se,ue;if(R.pointerId!==E.current||w||F)return;const j=R.clientX-T.current,te=R.clientY-k.current;if(!q.current){if(Math.abs(j)<ct&&Math.abs(te)<ct)return;if(Math.abs(j)<Math.abs(te)){E.current=null;return}q.current=!0,W.current=j<0?"left":"right",(ue=(se=R.currentTarget).setPointerCapture)==null||ue.call(se,R.pointerId),A(!0),l==null||l(W.current),d&&S&&S.setActiveItemId(K)}let z=O.current+j;if(!U&&z<0&&(z=Math.max(z,-30)*.3),!G&&z>0&&(z=Math.min(z,30)*.3),U&&z<X){const he=X-z;z=X-he*.3}if(G&&z>V){const he=z-V;z=V+he*.3}const ie=W.current==="left"?Math.abs(X)*i:V*i,ae=W.current==="left"?Math.abs(z):z;ae>=ie&&!Z.current?(Z.current=!0,p&&Ie("light")):ae<ie&&Z.current&&(Z.current=!1),v(z),R.preventDefault()},[w,F,U,G,X,V,i,p,d,S,K,l]),x=e.useCallback(R=>{if(R.pointerId!==E.current||(E.current=null,!q.current))return;q.current=!1,H.current=!0,A(!1),Y(!0);const j=Math.abs(X)*i,te=V*i;let z=0,ie=null;W.current==="left"&&U?Math.abs(m)>=j&&(z=X,ie="left",p&&Ie("medium")):W.current==="right"&&G&&m>=te&&(z=V,ie="right",p&&Ie("medium")),(D==="left"&&m>0||D==="right"&&m<0)&&(z=0,ie=null),v(z),J(ie),f==null||f(ie),setTimeout(()=>Y(!1),300)},[m,X,V,i,U,G,D,p,f]),M=e.useCallback((R,j)=>{R.onClick(),y==null||y(R,j),p&&Ie("heavy"),_()},[y,p,_]),o=e.useCallback(R=>{R.key==="Escape"&&D&&_()},[D,_]),b=e.useCallback(R=>{$.current=R,typeof N=="function"?N(R):N&&(N.current=R)},[N]);return r.jsxs("div",{ref:b,className:`nice-swipe-container ${C} ${D?`nice-swipe-container--open-${D}`:""}`,style:P,onKeyDown:o,tabIndex:0,role:"listitem","aria-label":D==="left"?I("swipeActions.leftVisible","Swipe actions left visible"):D==="right"?I("swipeActions.rightVisible","Swipe actions right visible"):I("swipeActions.swipeForActions","Swipe for actions"),"data-disabled":w||void 0,children:[c.length>0&&r.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--left",style:{width:V},children:c.map((R,j)=>r.jsx(st,{action:R,width:s,progress:ne,index:j,total:c.length,side:"right",onTrigger:()=>M(R,"right")},R.id))}),r.jsx("div",{className:"nice-swipe-content",style:{transform:`translateX(${m}px)`,transition:F?"transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)":"none",userSelect:g?"none":void 0},onPointerDown:h,onPointerMove:L,onPointerUp:x,onPointerCancel:x,onClickCapture:R=>{H.current&&(H.current=!1,R.stopPropagation(),R.preventDefault())},children:t}),n.length>0&&r.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--right",style:{width:Math.abs(X)},children:n.map((R,j)=>r.jsx(st,{action:R,width:s,progress:re,index:j,total:n.length,side:"left",onTrigger:()=>M(R,"left")},R.id))})]})}),{displayName:"NiceSwipeActions"}),dn=({children:t,className:n="",style:c})=>r.jsx(Mt,{children:r.jsx("div",{className:`nice-swipe-list ${n}`,style:c,role:"list",children:t})}),fn={delete:t=>({id:"delete",label:"Delete",labelKey:"swipeActions.delete",icon:r.jsx(de.NtdTrash,{size:20,variant:"outline"}),background:"var(--nice-color-error, #ef4444)",destructive:!0,onClick:t}),edit:t=>({id:"edit",label:"Edit",labelKey:"swipeActions.edit",icon:r.jsx(de.NtdEdit,{size:20,variant:"outline"}),background:"var(--nice-color-primary, #3b82f6)",onClick:t}),archive:t=>({id:"archive",label:"Archive",labelKey:"swipeActions.archive",icon:r.jsx(de.NtdArchive,{size:20,variant:"outline"}),background:"var(--nice-bg-tertiary, #6b7280)",onClick:t}),star:t=>({id:"star",label:"Star",labelKey:"swipeActions.star",icon:r.jsx(de.NtdStar,{size:20,variant:"outline"}),background:"var(--nice-color-warning, #eab308)",onClick:t}),share:t=>({id:"share",label:"Share",labelKey:"swipeActions.share",icon:r.jsx(de.NtdShare,{size:20,variant:"outline"}),background:"var(--nice-color-success, #22c55e)",onClick:t}),pin:t=>({id:"pin",label:"Pin",labelKey:"swipeActions.pin",icon:r.jsx(de.NtdPin,{size:20,variant:"outline"}),background:"var(--nice-color-accent, #8b5cf6)",onClick:t}),mute:t=>({id:"mute",label:"Mute",labelKey:"swipeActions.mute",icon:r.jsx(de.NtdVolumeMute,{size:20,variant:"outline"}),background:"var(--nice-bg-tertiary, #64748b)",onClick:t}),reply:t=>({id:"reply",label:"Reply",labelKey:"swipeActions.reply",icon:r.jsx(de.NtdReply,{size:20,variant:"outline"}),background:"var(--nice-color-info, #0ea5e9)",onClick:t})};function it(t="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const n={light:10,medium:25,heavy:50};navigator.vibrate(n[t])}}function hn(t,n,c){return t==="full"?n*.95:t==="content"?Math.min(c,n*.9):n*t/100}const bn=Object.assign(e.forwardRef(({children:t,open:n,onClose:c,onSnapChange:s,snapPoints:i=[50,100],initialSnap:a=0,header:d,footer:l,showHandle:f=!0,showBackdrop:y=!0,closeOnBackdrop:w=!0,closeOnEscape:C=!0,dismissible:P=!0,velocityThreshold:u=.5,hapticFeedback:p=!0,handleColor:N,borderRadius:I=16,zIndex:S=1e3,className:m="",style:v,ariaLabel:D,size:J="md",disabled:F=!1,loading:Y=!1,error:$},T)=>{const{t:k}=oe.useNiceTranslation(),O=D??k("bottomSheet.bottomSheet","Bottom sheet"),[q,W]=e.useState(a),[Z,X]=e.useState(0),[V,U]=e.useState(!1),[G,re]=e.useState(typeof window<"u"?window.innerHeight:800),[ne,K]=e.useState(400),_=e.useRef(null),E=e.useRef(null),H=e.useRef(0),g=e.useRef(0),A=e.useRef(0),h=e.useRef(0),L=e.useRef(0),x=e.useRef(-1),M=i.map(B=>hn(B,G,ne)),o=M[q]??M[0];e.useImperativeHandle(T,()=>({snapTo:B=>{B>=0&&B<i.length&&(W(B),X(0),s==null||s(B,M[B]))},close:()=>c(),getCurrentSnap:()=>q})),e.useEffect(()=>{const B=()=>{re(window.innerHeight)};return window.addEventListener("resize",B),()=>window.removeEventListener("resize",B)},[]),e.useEffect(()=>{if(E.current&&n){const B=E.current.scrollHeight;K(B+60)}},[n,t]),oe.useOverlayFocus(_,{open:n,onClose:c,closeOnEscape:C}),e.useEffect(()=>{if(n){const B=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=B}}},[n]);const b=e.useCallback(B=>{const ce=G-o+B,le=G-ce;for(let fe=0;fe<M.length;fe++){const me=M[fe];if(Math.abs(le-me)<20&&x.current!==fe){x.current=fe,p&&it("light");break}}},[G,o,M,p]),R=e.useCallback((B,ce)=>{if(ce>u*2&&P&&B<M[0]*.5)return-1;if(ce<-u)return M.length-1;if(ce>u)return P&&B<M[0]*.7?-1:0;let le=0,fe=Math.abs(B-M[0]);for(let me=1;me<M.length;me++){const ge=Math.abs(B-M[me]);ge<fe&&(fe=ge,le=me)}return P&&B<M[0]*.5?-1:le},[M,u,P]),j=e.useCallback(B=>{H.current=B,g.current=Z,A.current=B,h.current=Date.now(),L.current=0,x.current=-1,U(!0)},[Z]),te=e.useCallback(B=>j(B.touches[0].clientY),[j]),z=e.useCallback(B=>{if(!V)return!1;const ce=B-H.current,le=Date.now(),fe=le-h.current;fe>0&&(L.current=(B-A.current)/fe),A.current=B,h.current=le;let me=g.current+ce;const ge=o+50;if(me>ge){const je=me-ge;me=ge+je*.2}const we=-(G*.95-o);if(me<we){const je=we-me;me=we-je*.2}return X(me),b(me),!0},[V,o,G,b]),ie=e.useCallback(B=>{z(B.touches[0].clientY)&&B.preventDefault()},[z]),ae=e.useCallback(()=>{if(!V)return;U(!1);const B=o-Z,ce=R(B,L.current);if(ce===-1)X(o+100),setTimeout(()=>{c(),X(0),W(a)},300);else{const le=M[ce];X(0),W(ce),ce!==q&&(s==null||s(ce,le),p&&it("medium"))}},[V,o,Z,R,q,M,c,s,a,p]),se=e.useCallback(B=>{var ce,le;B.button!==0||F||((le=(ce=B.currentTarget).setPointerCapture)==null||le.call(ce,B.pointerId),j(B.clientY))},[j,F]),ue=e.useCallback(B=>{z(B.clientY)},[z]),he=e.useCallback(B=>{var ce,le;(le=(ce=B.currentTarget).releasePointerCapture)==null||le.call(ce,B.pointerId),ae()},[ae]),pe=e.useCallback(B=>{w&&B.target===B.currentTarget&&c()},[w,c]);if(!n)return null;const Q=Math.max(0,o-Z),ee=Math.min(.5,Q/G*.8);return r.jsxs("div",{className:`nice-bottom-sheet-container ${m}`,style:{zIndex:S},children:[y&&r.jsx("div",{className:"nice-bottom-sheet-backdrop",style:{opacity:ee},onMouseDown:pe,"aria-hidden":"true"}),r.jsxs("div",{ref:_,className:`nice-bottom-sheet nice-bottom-sheet--${J} ${V?"nice-bottom-sheet--dragging":""} ${F?"nice-bottom-sheet--disabled":""} ${Y?"nice-bottom-sheet--loading":""} ${$?"nice-bottom-sheet--error":""}`,style:{...v,height:Q,borderTopLeftRadius:I,borderTopRightRadius:I,transition:V?"none":"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},role:"dialog","aria-modal":"true","aria-label":O,"aria-disabled":F||void 0,"aria-busy":Y||void 0,children:[$&&r.jsx("div",{className:"nice-bottom-sheet-error",role:"alert",children:$}),Y&&r.jsx("span",{className:"nice-bottom-sheet-spinner","aria-hidden":"true",children:r.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),f&&r.jsx("div",{className:"nice-bottom-sheet-handle",onPointerDown:se,onPointerMove:ue,onPointerUp:he,onPointerCancel:he,children:r.jsx("div",{className:"nice-bottom-sheet-handle-bar",style:N?{backgroundColor:N}:void 0})}),d&&r.jsx("div",{className:"nice-bottom-sheet-header",children:d}),r.jsx("div",{ref:E,className:"nice-bottom-sheet-content",onTouchStart:te,onTouchMove:ie,onTouchEnd:ae,children:t}),l&&r.jsx("div",{className:"nice-bottom-sheet-footer",children:l})]})]})}),{displayName:"NiceBottomSheet"}),mn=[];function pn(t="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const n={light:10,medium:25,heavy:50};navigator.vibrate(n[t])}}function at(t,n){return Math.hypot(n.x-t.x,n.y-t.y)}function ot(t,n){return{x:(t.x+n.x)/2,y:(t.y+n.y)/2}}const gn=Object.assign(e.forwardRef(({items:t=mn,selectedIndex:n=0,onIndexChange:c,onClose:s,showClose:i=!0,showCounter:a=!0,showCaption:d=!0,showThumbnails:l=!1,enablePinchZoom:f=!0,enableDoubleTapZoom:y=!0,enableSwipe:w=!0,enableKeyboard:C=!0,minZoom:P=1,maxZoom:u=4,doubleTapZoom:p=2.5,swipeThreshold:N=50,loop:I=!0,hapticFeedback:S=!0,backgroundColor:m="var(--nice-overlay-95, rgba(0, 0, 0, 0.95))",zIndex:v=2e3,className:D="",style:J},F)=>{const{t:Y}=oe.useNiceTranslation(),[$,T]=e.useState(n),[k,O]=e.useState(1),[q,W]=e.useState(0),[Z,X]=e.useState(0),[V,U]=e.useState(!1),[G,re]=e.useState({}),ne=e.useRef(null),K=e.useRef(null),_=e.useRef([]),E=e.useRef(0),H=e.useRef(1),g=e.useRef({x:0,y:0}),A=e.useRef(0),h=e.useRef({x:0,y:0}),L=e.useRef(!1),x=e.useRef(!1),M=e.useRef(null),o=t[$],b=e.useCallback(Q=>{let ee=Q;I?ee=(Q%t.length+t.length)%t.length:ee=Math.max(0,Math.min(t.length-1,Q)),ee!==$&&(U(!0),T(ee),O(1),W(0),X(0),c==null||c(ee,t[ee]),S&&pn("light"),setTimeout(()=>U(!1),300))},[$,t,I,c,S]),R=e.useCallback(()=>b($+1),[b,$]),j=e.useCallback(()=>b($-1),[b,$]),te=e.useCallback((Q,ee,B)=>{const ce=Math.max(P,Math.min(u,Q));O(ce),ce<=1&&(W(0),X(0))},[P,u]),z=e.useCallback(()=>te(k*1.5),[k,te]),ie=e.useCallback(()=>te(k/1.5),[k,te]),ae=e.useCallback(()=>{O(1),W(0),X(0)},[]);e.useImperativeHandle(F,()=>({goTo:b,goNext:R,goPrev:j,zoomIn:z,zoomOut:ie,resetZoom:ae,close:()=>s==null?void 0:s()}));const se=t.length>0;oe.useOverlayFocus(ne,{open:se,onClose:s?()=>s():void 0,closeOnEscape:C}),e.useEffect(()=>{const Q=ne.current;if(!C||!se||!Q)return;const ee=B=>{if(!B.defaultPrevented){switch(B.key){case"ArrowLeft":j();break;case"ArrowRight":R();break;case"ArrowUp":z();break;case"ArrowDown":ie();break;case"0":case"Home":ae();break;default:return}B.preventDefault()}};return Q.addEventListener("keydown",ee),()=>Q.removeEventListener("keydown",ee)},[C,se,R,j,z,ie,ae]),oe.useIntent(["sectionPrev","sectionNext","pagePrev","pageNext"],Q=>{if(Q.intent==="sectionPrev")j();else if(Q.intent==="sectionNext")R();else{if(Q.source==="keyboard")return!1;Q.intent==="pageNext"?z():ie()}},{ref:ne,enabled:se}),oe.useInputHints(ne,se&&t.length>1?[{intent:"sectionPrev",label:Y("imageGallery.previousImage","Previous image")},{intent:"sectionNext",label:Y("imageGallery.nextImage","Next image")},{intent:"pageNext",label:Y("imageGallery.zoomIn","Zoom in")},{intent:"pagePrev",label:Y("imageGallery.zoomOut","Zoom out")}]:[]);const ue=e.useCallback(Q=>{const ee=Array.from(Q.touches).map(B=>({x:B.clientX,y:B.clientY,id:B.identifier}));if(_.current=ee,h.current={x:ee[0].x,y:ee[0].y},x.current=!1,M.current=null,ee.length===2&&f)L.current=!0,E.current=at(ee[0],ee[1]),H.current=k,g.current={x:q,y:Z};else if(ee.length===1){const B=Date.now();B-A.current<300&&y?(k>1.1?ae():te(p,ee[0].x,ee[0].y),A.current=0):A.current=B,g.current={x:q,y:Z}}},[k,q,Z,f,y,p,ae,te]),he=e.useCallback(Q=>{const ee=Array.from(Q.touches).map(B=>({x:B.clientX,y:B.clientY,id:B.identifier}));if(ee.length===2&&L.current&&f){const ce=at(ee[0],ee[1])/E.current,le=H.current*ce;te(le);const fe=ot(ee[0],ee[1]),me=ot(_.current[0],_.current[1]||_.current[0]),ge=fe.x-me.x,we=fe.y-me.y;W(g.current.x+ge),X(g.current.y+we),Q.preventDefault()}else if(ee.length===1){const B=ee[0].x-h.current.x,ce=ee[0].y-h.current.y;if(M.current||(Math.abs(B)>10||Math.abs(ce)>10)&&(M.current=Math.abs(B)>Math.abs(ce)?"horizontal":"vertical",x.current=!0),k>1.1){const le=g.current.x+B,fe=g.current.y+ce;W(le),X(fe)}Q.preventDefault()}},[k,f,te]),pe=e.useCallback(Q=>{if(L.current){L.current=!1;return}const ee=Q.changedTouches[0],B=ee.clientX-h.current.x;ee.clientY-h.current.y,w&&k<=1.1&&M.current==="horizontal"&&(B>N?j():B<-N&&R()),k<=1.1&&(W(0),X(0)),x.current=!1,M.current=null},[k,w,N,R,j]);return e.useEffect(()=>{t.forEach((Q,ee)=>{const B=new Image;B.onload=()=>{re(ce=>({...ce,[ee]:!0}))},B.src=Q.src})},[t]),t.length===0?null:r.jsxs("div",{ref:ne,className:`nice-image-gallery ${D}`,style:{...J,backgroundColor:m,zIndex:v},role:"dialog","aria-modal":"true","aria-label":Y("imageGallery.imageGallery","Image gallery"),children:[r.jsxs("div",{className:"nice-image-gallery-header",children:[a&&r.jsxs("span",{className:"nice-image-gallery-counter",children:[$+1," / ",t.length]}),r.jsxs("div",{className:"nice-image-gallery-actions",children:[r.jsx("button",{className:"nice-image-gallery-btn",onClick:ie,disabled:k<=P,"aria-label":Y("imageGallery.zoomOut","Zoom out"),children:r.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--minus","aria-hidden":"true"})}),r.jsx("button",{className:"nice-image-gallery-btn",onClick:z,disabled:k>=u,"aria-label":Y("imageGallery.zoomIn","Zoom in"),children:r.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--plus","aria-hidden":"true"})}),i&&r.jsx("button",{className:"nice-image-gallery-btn nice-image-gallery-close",onClick:s,"aria-label":Y("imageGallery.close","Close"),children:r.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--close","aria-hidden":"true"})})]})]}),r.jsxs("div",{className:"nice-image-gallery-viewport",onTouchStart:ue,onTouchMove:he,onTouchEnd:pe,children:[r.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--prev",onClick:j,disabled:!I&&$===0,"aria-label":Y("imageGallery.previousImage","Previous image"),children:r.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--prev","aria-hidden":"true"})}),r.jsxs("div",{className:"nice-image-gallery-image-container",children:[o.placeholder&&!G[$]&&r.jsx("div",{className:"nice-image-gallery-placeholder",style:{backgroundColor:o.placeholder}}),r.jsx("img",{ref:K,src:o.src,alt:o.alt||o.title||"",className:`nice-image-gallery-image ${V?"nice-image-gallery-image--animating":""}`,style:{transform:`scale(${k}) translate(${q/k}px, ${Z/k}px)`,transition:L.current||x.current?"none":"transform 0.2s ease-out"},draggable:!1})]}),r.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--next",onClick:R,disabled:!I&&$===t.length-1,"aria-label":Y("imageGallery.nextImage","Next image"),children:r.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--next","aria-hidden":"true"})})]}),d&&o.title&&r.jsxs("div",{className:"nice-image-gallery-caption",children:[r.jsx("h3",{children:o.title}),o.description&&r.jsx("p",{children:o.description})]}),l&&t.length>1&&r.jsx("div",{className:"nice-image-gallery-thumbnails",children:t.map((Q,ee)=>r.jsx("button",{className:`nice-image-gallery-thumb ${ee===$?"nice-image-gallery-thumb--active":""}`,onClick:()=>b(ee),"aria-label":Y("imageGallery.goToImage","Go to image {i}").replace("{i}",String(ee+1)),children:r.jsx("img",{src:Q.thumbnail||Q.src,alt:Q.alt||"",loading:"lazy"})},ee))}),!l&&t.length>1&&t.length<=10&&r.jsx("div",{className:"nice-image-gallery-dots",children:t.map((Q,ee)=>r.jsx("button",{className:`nice-image-gallery-dot ${ee===$?"nice-image-gallery-dot--active":""}`,onClick:()=>b(ee),"aria-label":Y("imageGallery.goToImage","Go to image {i}").replace("{i}",String(ee+1))},ee))})]})}),{displayName:"NiceImageGallery"}),vn=[],St=e.createContext(null);function xn(){const t=e.useContext(St);if(!t)throw new Error("useInfiniteScroll must be used within NiceInfiniteScroll");return t}const lt=()=>{const{t}=oe.useNiceTranslation();return r.jsxs("div",{className:"nice-infinite-loading",children:[r.jsx("div",{className:"nice-infinite-spinner",children:r.jsx($e,{style:{fontSize:28}})}),r.jsx("span",{className:"nice-infinite-loading-text",children:t("infiniteScroll.loading","Loading...")})]})},yn=()=>{const{t}=oe.useNiceTranslation();return r.jsxs("div",{className:"nice-infinite-end",children:[r.jsx("span",{className:"nice-infinite-end-line"}),r.jsx("span",{className:"nice-infinite-end-text",children:t("infiniteScroll.youveReachedTheEnd","You've reached the end")}),r.jsx("span",{className:"nice-infinite-end-line"})]})},wn=({message:t,onRetry:n})=>{const{t:c}=oe.useNiceTranslation();return r.jsxs("div",{className:"nice-infinite-error",role:"alert",children:[r.jsx(de.NtdAlert,{className:"nice-infinite-error-icon",size:32,variant:"outline"}),r.jsx("span",{className:"nice-infinite-error-text",children:t}),n&&r.jsx("button",{className:"nice-infinite-error-retry",onClick:n,"aria-label":c("infiniteScroll.retryLoading","Retry loading"),children:c("infiniteScroll.retry","Retry")})]})},Nn=()=>{const{t}=oe.useNiceTranslation();return r.jsxs("div",{className:"nice-infinite-empty",children:[r.jsx(de.NtdInbox,{className:"nice-infinite-empty-icon",size:48,variant:"outline"}),r.jsx("p",{className:"nice-infinite-empty-text",children:t("infiniteScroll.noItemsToDisplay","No items to display")})]})},kn=({visible:t,onClick:n})=>{const{t:c}=oe.useNiceTranslation();return r.jsx("button",{className:`nice-infinite-scroll-top ${t?"nice-infinite-scroll-top--visible":""}`,onClick:n,"aria-label":c("infiniteScroll.scrollToTop","Scroll to top"),children:r.jsx(Se,{direction:"up",style:{fontSize:20}})})};function jn({items:t=vn,renderItem:n,onLoadMore:c,hasMore:s,isLoading:i=!1,error:a=null,threshold:d=200,loadingIndicator:l,endIndicator:f,errorIndicator:y,onRetry:w,pullToRefresh:C=!1,onRefresh:P,direction:u="vertical",reverse:p=!1,initialScrollPosition:N="top",keyboardNav:I=!0,keyExtractor:S,emptyContent:m,header:v,footer:D,gap:J=0,className:F="",style:Y,ariaLabel:$},T){const{t:k}=oe.useNiceTranslation(),O=$??k("infiniteScroll.scrollableList","Scrollable list"),[q,W]=e.useState("idle"),[Z,X]=e.useState(!1),[V,U]=e.useState(!1),G=e.useRef(null),re=e.useRef(null),ne=e.useRef(!1),K=e.useRef(null);e.useEffect(()=>{a?W("error"):i?W("loading"):!s&&t.length>0?W("end"):W("idle")},[a,i,s,t.length]);const _=e.useCallback((M,o)=>S?S(M,o):`item-${o}`,[S]),E=e.useCallback(async()=>{if(!(ne.current||!s||a)){ne.current=!0;try{await c()}finally{ne.current=!1}}},[s,a,c]),H=e.useCallback(()=>{var M;(M=G.current)==null||M.scrollTo({top:0,behavior:"smooth"})},[]),g=e.useCallback(()=>{G.current&&G.current.scrollTo({top:G.current.scrollHeight,behavior:"smooth"})},[]);e.useEffect(()=>{if(!re.current)return;const M=o=>{const[b]=o;b.isIntersecting&&s&&!i&&!a&&E()};return K.current=new IntersectionObserver(M,{root:G.current,rootMargin:`${d}px`,threshold:.1}),K.current.observe(re.current),()=>{var o;(o=K.current)==null||o.disconnect()}},[s,i,a,d,E]),e.useEffect(()=>{const M=G.current;if(!M)return;const o=()=>{const b=u==="vertical"?M.scrollTop:M.scrollLeft;X(b>500)};return M.addEventListener("scroll",o,{passive:!0}),()=>M.removeEventListener("scroll",o)},[u]),e.useEffect(()=>{N==="bottom"&&G.current&&(G.current.scrollTop=G.current.scrollHeight)},[N]);const A=e.useCallback(M=>{I&&(M.key==="Home"?(M.preventDefault(),H()):M.key==="End"&&(M.preventDefault(),g()))},[I,H,g]);e.useCallback(async()=>{if(!(!P||V)){U(!0);try{await P()}finally{U(!1)}}},[P,V]);const h=e.useCallback(M=>{G.current=M,typeof T=="function"?T(M):T&&(T.current=M)},[T]),L=e.useMemo(()=>({status:q,loadMore:E,hasMore:s,itemCount:t.length,scrollToTop:H,scrollToBottom:g}),[q,E,s,t.length,H,g]),x=e.useMemo(()=>(p?[...t].reverse():t).map((o,b)=>r.jsx("div",{className:"nice-infinite-item","data-index":b,children:n(o,b)},_(o,b))),[t,p,_,n]);return t.length===0&&!i&&!a?r.jsx("div",{ref:h,className:`nice-infinite-container nice-infinite-container--empty ${F}`,style:Y,role:"region","aria-label":O,children:m||r.jsx(Nn,{})}):r.jsx(St.Provider,{value:L,children:r.jsxs("div",{ref:h,className:`nice-infinite-container nice-infinite-container--${u} ${p?"nice-infinite-container--reverse":""} ${F}`,style:Y,onKeyDown:A,tabIndex:0,role:"feed","aria-label":O,"aria-busy":i,children:[v&&r.jsx("div",{className:"nice-infinite-header",children:v}),C&&V&&r.jsx("div",{className:"nice-infinite-pull",children:l||r.jsx(lt,{})}),r.jsx("div",{className:"nice-infinite-items",style:{gap:J},children:x}),r.jsx("div",{ref:re,className:"nice-infinite-sentinel","aria-hidden":"true"}),q==="loading"&&(l||r.jsx(lt,{})),q==="error"&&a&&(y||r.jsx(wn,{message:a,onRetry:w})),q==="end"&&(f||r.jsx(yn,{})),D&&r.jsx("div",{className:"nice-infinite-footer",children:D}),r.jsx(kn,{visible:Z,onClick:H})]})})}const Tn=e.forwardRef(jn);function Mn(t){const{t:n}=oe.useNiceTranslation(),{fetchPage:c,initialCursor:s,refetchOnFocus:i=!1}=t,[a,d]=e.useState([]),[l,f]=e.useState(s),[y,w]=e.useState(!1),[C,P]=e.useState(null),[u,p]=e.useState(!0),[N,I]=e.useState(!1),S=e.useCallback(async()=>{if(!(y||!u)){w(!0),P(null);try{const D=await c(l);d(J=>[...J,...D.items]),f(D.nextCursor),p(D.hasMore),I(!0)}catch(D){P(D instanceof Error?D.message:n("infiniteScroll.failedToLoadData","Failed to load data"))}finally{w(!1)}}},[c,l,y,u,n]),m=e.useCallback(async()=>{d([]),f(s),p(!0),P(null),w(!0);try{const D=await c(s);d(D.items),f(D.nextCursor),p(D.hasMore)}catch(D){P(D instanceof Error?D.message:n("infiniteScroll.failedToRefreshData","Failed to refresh data"))}finally{w(!1)}},[c,s,n]),v=e.useCallback(()=>{d([]),f(s),p(!0),P(null),I(!1)},[s]);return e.useEffect(()=>{!N&&!y&&S()},[N,y,S]),e.useEffect(()=>{if(!i)return;const D=()=>{N&&m()};return window.addEventListener("focus",D),()=>window.removeEventListener("focus",D)},[i,N,m]),{items:a,isLoading:y,error:C,hasMore:u,loadMore:S,refresh:m,reset:v}}function Rn(t){const{itemCount:n,itemHeight:c,overscan:s=5,containerRef:i}=t,[a,d]=e.useState(0),[l,f]=e.useState(0),y=e.useCallback(u=>typeof c=="function"?c(u):c,[c]),w=e.useMemo(()=>{let u=0;for(let p=0;p<n;p++)u+=y(p);return u},[n,y]),C=e.useMemo(()=>{const u=[];let p=0,N=-1,I=-1;for(let S=0;S<n;S++){const m=y(S),v=p+m;v>=a&&N===-1&&(N=S),p<=a+l&&(I=S),p=v}N=Math.max(0,N-s),I=Math.min(n-1,I+s),p=0;for(let S=0;S<n;S++){const m=y(S);S>=N&&S<=I&&u.push({index:S,start:p,size:m,end:p+m}),p+=m}return u},[n,y,a,l,s]);e.useEffect(()=>{const u=i.current;if(!u)return;f(u.clientHeight);const p=()=>{d(u.scrollTop)},N=()=>{f(u.clientHeight)};return u.addEventListener("scroll",p,{passive:!0}),window.addEventListener("resize",N),()=>{u.removeEventListener("scroll",p),window.removeEventListener("resize",N)}},[i]);const P=e.useCallback(u=>{const p=i.current;if(!p)return;let N=0;for(let I=0;I<u&&I<n;I++)N+=y(I);p.scrollTo({top:N,behavior:"smooth"})},[i,n,y]);return{virtualItems:C,totalSize:w,scrollToIndex:P}}const Pt=e.createContext(null);function Sn(){const t=e.useContext(Pt);if(!t)throw new Error("useMobileDrawer must be used within NiceMobileDrawer");return t}const Dt=({item:t,depth:n=0,onSelect:c,activeId:s})=>{const[i,a]=e.useState(!1),d=t.children&&t.children.length>0,l=s===t.id;if(t.divider)return r.jsx("div",{className:"nice-drawer-divider"});if(t.section)return r.jsx("div",{className:"nice-drawer-section",children:r.jsx("span",{className:"nice-drawer-section-label",children:t.section})});const f=()=>{t.disabled||(d?a(!i):(c(t),t.onClick&&t.onClick()))};return r.jsxs("div",{className:"nice-drawer-nav-item-wrapper",children:[r.jsxs("button",{className:`nice-drawer-nav-item nice-drawer-nav-item--depth-${n} ${l?"nice-drawer-nav-item--active":""} ${t.disabled?"nice-drawer-nav-item--disabled":""}`,onClick:f,disabled:t.disabled,"aria-expanded":d?i:void 0,"aria-current":l?"page":void 0,style:{paddingLeft:`${16+n*16}px`},children:[t.icon&&r.jsx("span",{className:"nice-drawer-nav-icon",children:t.icon}),r.jsx("span",{className:"nice-drawer-nav-label",children:t.label}),t.badge!==void 0&&r.jsx("span",{className:"nice-drawer-nav-badge",style:{background:t.badgeColor},children:t.badge}),d&&r.jsx("span",{className:`nice-drawer-nav-chevron ${i?"nice-drawer-nav-chevron--expanded":""}`,children:r.jsx(Se,{direction:"down",style:{fontSize:18}})})]}),d&&i&&r.jsx("div",{className:"nice-drawer-nav-children",children:t.children.map(y=>r.jsx(Dt,{item:y,depth:n+1,onSelect:c,activeId:s},y.id))})]})},Pn=Object.assign(e.forwardRef(({open:t,onClose:n,position:c="left",variant:s="overlay",size:i,children:a,navItems:d,header:l,footer:f,swipeToOpen:y=!0,swipeToClose:w=!0,edgeSwipeWidth:C=20,velocityThreshold:P=.3,showOverlay:u=!0,closeOnOverlayClick:p=!0,closeOnEscape:N=!0,disableBodyScroll:I=!0,overlayColor:S,zIndex:m=1e3,onNavSelect:v,activeNavId:D,className:J="",style:F,ariaLabel:Y},$)=>{const{t:T}=oe.useNiceTranslation(),k=Y??T("mobileDrawer.navigationDrawer","Navigation drawer"),[O,q]=e.useState(0),[W,Z]=e.useState(!1),[X,V]=e.useState(D),U=e.useRef(null),G=e.useRef({x:0,y:0}),re=e.useRef(0),ne=e.useRef({x:0,y:0}),K=c==="left"||c==="right",E=i??(K?280:400);e.useEffect(()=>{D!==void 0&&V(D)},[D]),e.useEffect(()=>{if(I&&t){const o=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=o}}},[t,I]),e.useEffect(()=>{if(!N||!t)return;const o=b=>{b.key==="Escape"&&n()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[N,t,n]),e.useEffect(()=>{if(!t||!U.current)return;const o=U.current,b=o.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),R=b[0],j=b[b.length-1],te=z=>{z.key==="Tab"&&(z.shiftKey&&document.activeElement===R?(z.preventDefault(),j==null||j.focus()):!z.shiftKey&&document.activeElement===j&&(z.preventDefault(),R==null||R.focus()))};return o.addEventListener("keydown",te),R==null||R.focus(),()=>o.removeEventListener("keydown",te)},[t]);const H=e.useCallback(()=>{let o=0;const b=O;if(!t)switch(c){case"left":o=-100;break;case"right":o=100;break;case"top":o=-100;break;case"bottom":o=100;break}return K?`translateX(calc(${o}% + ${b}px))`:`translateY(calc(${o}% + ${b}px))`},[t,c,O,K]),g=e.useCallback(o=>{if(!w&&t)return;const b=o.touches[0];G.current={x:b.clientX,y:b.clientY},ne.current={x:b.clientX,y:b.clientY},re.current=Date.now()},[w,t]),A=e.useCallback(o=>{if(!w||!t)return;const b=o.touches[0],R=b.clientX-G.current.x,j=b.clientY-G.current.y;let te=!1,z=0;switch(c){case"left":te=R<0,z=Math.min(0,R);break;case"right":te=R>0,z=Math.max(0,R);break;case"top":te=j<0,z=Math.min(0,j);break;case"bottom":te=j>0,z=Math.max(0,j);break}te&&Math.abs(K?R:j)>10&&(Z(!0),q(z),ne.current={x:b.clientX,y:b.clientY},o.preventDefault())},[w,t,c,K]),h=e.useCallback(()=>{if(!W)return;const o=Date.now()-re.current,b=Math.abs(O),R=typeof E=="number"?E:280,j=b/o;(b>R*.3||j>P)&&n(),Z(!1),q(0)},[W,O,E,P,K,n]);e.useEffect(()=>{if(!y||t)return;let o=0,b=0,R=!1;const j=z=>{const ie=z.touches[0];o=ie.clientX,b=ie.clientY;const ae=window.innerWidth,se=window.innerHeight;switch(c){case"left":R=o<C;break;case"right":R=o>ae-C;break;case"top":R=b<C;break;case"bottom":R=b>se-C;break}},te=z=>{if(!R)return;const ie=z.touches[0],ae=ie.clientX-o,se=ie.clientY-b,ue=50;let he=!1;switch(c){case"left":he=ae>ue;break;case"right":he=ae<-ue;break;case"top":he=se>ue;break;case"bottom":he=se<-ue;break}he&&z.preventDefault()};return document.addEventListener("touchstart",j,{passive:!0}),document.addEventListener("touchmove",te,{passive:!1}),()=>{document.removeEventListener("touchstart",j),document.removeEventListener("touchmove",te)}},[y,t,c,C]);const L=e.useCallback(o=>{V(o.id),v==null||v(o),o.href&&n()},[v,n]),x=e.useCallback(o=>{U.current=o,typeof $=="function"?$(o):$&&($.current=o)},[$]),M=e.useMemo(()=>({isOpen:t,position:c,close:n,activeNavId:X,setActiveNavId:V}),[t,c,n,X]);return r.jsxs(Pt.Provider,{value:M,children:[u&&s!=="persistent"&&r.jsx("div",{className:`nice-drawer-overlay ${t?"nice-drawer-overlay--visible":""}`,style:{zIndex:m-1,background:S,opacity:W?1-Math.abs(O)/(typeof E=="number"?E:280):void 0},onClick:p?n:void 0,"aria-hidden":"true"}),r.jsxs("div",{ref:x,className:`nice-drawer nice-drawer--${c} nice-drawer--${s} ${t?"nice-drawer--open":""} ${W?"nice-drawer--dragging":""} ${J}`,style:{...F,[K?"width":"height"]:E,zIndex:m,transform:H()},onTouchStart:g,onTouchMove:A,onTouchEnd:h,role:"dialog","aria-modal":s!=="persistent","aria-label":k,"aria-hidden":!t,children:[l&&r.jsxs("div",{className:"nice-drawer-header",children:[l,r.jsx("button",{className:"nice-drawer-close",onClick:n,"aria-label":T("mobileDrawer.closeDrawer","Close drawer"),children:r.jsx(Ge,{style:{fontSize:24}})})]}),r.jsx("div",{className:"nice-drawer-content",children:d?r.jsx("nav",{className:"nice-drawer-nav","aria-label":T("mobileDrawer.mainNavigation","Main navigation"),children:d.map(o=>r.jsx(Dt,{item:o,onSelect:L,activeId:X},o.id))}):a}),f&&r.jsx("div",{className:"nice-drawer-footer",children:f})]})]})}),{displayName:"NiceMobileDrawer"});function Dn(t={}){const{defaultOpen:n=!1,onOpenChange:c}=t,[s,i]=e.useState(n),a=e.useCallback(()=>{i(!0),c==null||c(!0)},[c]),d=e.useCallback(()=>{i(!1),c==null||c(!1)},[c]),l=e.useCallback(()=>{i(y=>{const w=!y;return c==null||c(w),w})},[c]),f=e.useCallback(y=>{i(y),c==null||c(y)},[c]);return{isOpen:s,open:a,close:d,toggle:l,setOpen:f}}const Cn={home:r.jsx(de.NtdHome,{size:20,variant:"outline"}),settings:r.jsx(de.NtdSettings,{size:20,variant:"outline"}),user:r.jsx(de.NtdUser,{size:20,variant:"outline"}),search:r.jsx(de.NtdSearch,{size:20,variant:"outline"}),inbox:r.jsx(de.NtdInbox,{size:20,variant:"outline"}),heart:r.jsx(de.NtdHeart,{size:20,variant:"outline"}),folder:r.jsx(de.NtdFolder,{size:20,variant:"outline"}),help:r.jsx(de.NtdHelp,{size:20,variant:"outline"}),logout:r.jsx(de.NtdLogOut,{size:20,variant:"outline"})},In=[],Ct=e.createContext(null);function $n(){const t=e.useContext(Ct);if(!t)throw new Error("useMobileModal must be used within a NiceMobileModal");return t}function En(t={}){const{defaultOpen:n=!1,open:c,onOpenChange:s,preventDismiss:i=!1}=t,[a,d]=e.useState(n),l=c!==void 0,f=l?c:a,y=e.useCallback((u,p)=>{!u&&i&&p!=="close"||(l||d(u),s==null||s(u,p))},[l,s,i]),w=e.useCallback(()=>y(!0),[y]),C=e.useCallback(u=>y(!1,u),[y]),P=e.useCallback(()=>y(!f),[y,f]);return{open:f,openModal:w,closeModal:C,toggle:P,setOpen:u=>y(u)}}const _n=()=>r.jsx(Ge,{style:{fontSize:24}});function Ln(t,n,c){return t==="content"?Math.min(c,n):t==="full"?n:t<=1?n*t:Math.min(t,n)}function An(t,n,c){return Math.min(Math.max(t,n),c)}const We=e.forwardRef(function({open:n,onClose:c,title:s,children:i,footer:a,snapPoints:d=["content"],defaultSnapPoint:l=0,showHandle:f=!0,showClose:y=!0,showOverlay:w=!0,dismissOnDrag:C=!0,dismissOnOverlay:P=!0,dismissOnEscape:u=!0,preventDismiss:p=!1,onSnapChange:N,className:I="",overlayClassName:S="",headerClassName:m="",contentClassName:v="",footerClassName:D="",lockScroll:J=!0,borderRadius:F=16,zIndex:Y,style:$,...T},k){const{t:O}=oe.useNiceTranslation(),W=`${e.useId()}-title`,Z=e.useRef(null),X=e.useRef(null),V=e.useRef(0),U=e.useRef(0),G=e.useRef(!1),[re,ne]=e.useState(l),[K,_]=e.useState(0),[E,H]=e.useState(400),[g,A]=e.useState(typeof window<"u"?window.innerHeight:800),[h,L]=e.useState(!1),x=d.map(Q=>Ln(Q,g,E));e.useEffect(()=>{if(typeof window>"u")return;const Q=()=>{A(window.innerHeight)};return window.addEventListener("resize",Q),()=>window.removeEventListener("resize",Q)},[]),e.useEffect(()=>{if(!X.current||!n)return;const Q=new ResizeObserver(()=>{const ee=X.current,B=Z.current;if(!ee)return;let ce=0;for(const le of Array.from((B==null?void 0:B.children)??[]))le!==ee&&(ce+=le.offsetHeight);H(Math.min(ee.scrollHeight+ce,g*.9))});return Q.observe(X.current),()=>Q.disconnect()},[n,g]),e.useEffect(()=>{if(n){const Q=x[l]||x[0]||g*.5;_(Q),ne(l)}},[n]);const M=x.join(",");e.useEffect(()=>{if(n&&!h){const Q=M.split(",").map(Number),ee=Q[re]||Q[0];_(ee)}},[M,re,h,n]),e.useEffect(()=>{if(!J||!n)return;const Q=document.body.style.overflow,ee=document.body.style.paddingRight,B=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",B>0&&(document.body.style.paddingRight=`${B}px`),()=>{document.body.style.overflow=Q,document.body.style.paddingRight=ee}},[n,J]),e.useEffect(()=>{if(!n||!u||p)return;const Q=ee=>{ee.key==="Escape"&&(c==null||c("escape"))};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[n,u,p,c]),e.useEffect(()=>{if(!n||!Z.current)return;const ee=Z.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),B=ee[0],ce=ee[ee.length-1],le=fe=>{fe.key==="Tab"&&(fe.shiftKey?document.activeElement===B&&(fe.preventDefault(),ce==null||ce.focus()):document.activeElement===ce&&(fe.preventDefault(),B==null||B.focus()))};return document.addEventListener("keydown",le),requestAnimationFrame(()=>{B==null||B.focus()}),()=>document.removeEventListener("keydown",le)},[n]);const o=e.useCallback(Q=>{p&&Q!=="close"||c==null||c(Q)},[p,c]),b=e.useCallback(()=>{P&&o("overlay")},[P,o]),R=e.useCallback((Q,ee)=>{if(ee>.5&&C&&!p)return-1;if(ee<-.5)return x.length-1;let B=0,ce=Math.abs(x[0]-Q);for(let le=1;le<x.length;le++){const fe=Math.abs(x[le]-Q);fe<ce&&(ce=fe,B=le)}return B},[x,C,p]),j=e.useCallback(Q=>{G.current=!0,V.current=Q,U.current=K,L(!0)},[K]),te=e.useCallback(Q=>{if(!G.current)return;const ee=V.current-Q,B=An(U.current+ee,50,g);_(B)},[g]),z=e.useCallback((Q,ee)=>{if(!G.current)return;G.current=!1,L(!1);const B=R(K,ee);if(B===-1){o("drag");return}ne(B),_(x[B]),N==null||N(B,d[B])},[K,R,o,x,d,N]),ie=Q=>{j(Q.touches[0].clientY)},ae=Q=>{te(Q.touches[0].clientY)},se=Q=>{const ee=Q.changedTouches[0],B=(V.current-ee.clientY)/(Q.timeStamp-(Q.timeStamp-200));z(ee.clientY,B>0?-B/1e3:B/1e3)},ue=Q=>{Q.preventDefault(),j(Q.clientY);const ee=ce=>{te(ce.clientY)},B=ce=>{const le=(V.current-ce.clientY)/200;z(ce.clientY,le>0?-le/500:le/500),document.removeEventListener("mousemove",ee),document.removeEventListener("mouseup",B)};document.addEventListener("mousemove",ee),document.addEventListener("mouseup",B)},he=e.useCallback(Q=>{Q<0||Q>=x.length||(ne(Q),_(x[Q]),N==null||N(Q,d[Q]))},[x,d,N]),pe={isOpen:n,snapPoints:d,currentSnapIndex:re,setSnapIndex:he,close:o};return n?r.jsxs(r.Fragment,{children:[w&&r.jsx("div",{className:`nice-mobile-modal-overlay nice-mobile-modal-overlay--visible ${S}`,onClick:b,"aria-hidden":"true",style:{zIndex:Y?Y-1:void 0}}),r.jsx(Ct.Provider,{value:pe,children:r.jsxs("div",{ref:Q=>{Z.current=Q,typeof k=="function"?k(Q):k&&(k.current=Q)},role:"dialog","aria-modal":"true","aria-labelledby":s?W:void 0,className:`nice-modal-sheet ${h?"nice-modal-sheet--dragging":""} ${I}`,style:{height:K,borderTopLeftRadius:F,borderTopRightRadius:F,zIndex:Y,...$},...T,children:[f&&r.jsx("div",{className:"nice-modal-handle-area",onTouchStart:ie,onTouchMove:ae,onTouchEnd:se,onMouseDown:ue,children:r.jsx("div",{className:"nice-modal-handle"})}),(s||y)&&r.jsxs("div",{className:`nice-modal-header ${m}`,children:[s&&r.jsx("h2",{id:W,className:"nice-modal-title",children:s}),y&&!p&&r.jsx("button",{type:"button",className:"nice-modal-close",onClick:()=>o("close"),"aria-label":O("mobileModal.closeModal","Close modal"),children:r.jsx(_n,{})})]}),r.jsx("div",{ref:X,className:`nice-modal-content ${v}`,children:i}),a&&r.jsx("div",{className:`nice-modal-footer ${D}`,children:a})]})})]}):null}),Hn=e.forwardRef(function({actions:n=In,cancelLabel:c,onClose:s,...i},a){const{t:d}=oe.useNiceTranslation(),l=c??d("mobileModal.cancel","Cancel");return r.jsx(We,{ref:a,onClose:s,showHandle:!0,showClose:!1,snapPoints:["content"],...i,children:r.jsxs("div",{className:"nice-action-sheet",children:[n.map(f=>r.jsxs("button",{type:"button",className:`nice-action-sheet-item ${f.destructive?"nice-action-sheet-item--destructive":""}`,disabled:f.disabled,onClick:()=>{var y;(y=f.onClick)==null||y.call(f),s==null||s("close")},children:[f.icon&&r.jsx("span",{className:"nice-action-sheet-icon",children:f.icon}),f.label]},f.id)),r.jsx("div",{className:"nice-action-sheet-divider"}),r.jsx("button",{type:"button",className:"nice-action-sheet-item nice-action-sheet-item--cancel",onClick:()=>s==null?void 0:s("close"),children:l})]})})}),Yn=e.forwardRef(function({title:n,message:c,confirmLabel:s,cancelLabel:i,confirmDestructive:a=!1,onConfirm:d,onCancel:l,onClose:f,...y},w){const{t:C}=oe.useNiceTranslation(),P=s??C("mobileModal.confirm","Confirm"),u=i??C("mobileModal.cancel","Cancel"),p=()=>{d==null||d(),f==null||f("close")},N=()=>{l==null||l(),f==null||f("close")};return r.jsx(We,{ref:w,title:n,onClose:f,showHandle:!0,snapPoints:["content"],footer:r.jsxs("div",{className:"nice-confirm-sheet-buttons",children:[r.jsx("button",{type:"button",className:"nice-confirm-sheet-btn nice-confirm-sheet-btn--cancel",onClick:N,children:u}),r.jsx("button",{type:"button",className:`nice-confirm-sheet-btn nice-confirm-sheet-btn--confirm ${a?"nice-confirm-sheet-btn--destructive":""}`,onClick:p,children:P})]}),...y,children:r.jsx("div",{className:"nice-confirm-sheet-message",children:c})})}),qe=[],It=e.createContext(null);function Bn(t,n=500){const c=e.useRef(void 0),s=e.useRef(null),i=e.useCallback(l=>{s.current={x:l.clientX,y:l.clientY},c.current=setTimeout(()=>{t(l)},n)},[t,n]),a=e.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=void 0),s.current=null},[]),d=e.useCallback(l=>{if(!s.current)return;const f=Math.abs(l.clientX-s.current.x),y=Math.abs(l.clientY-s.current.y);(f>10||y>10)&&a()},[a]);return e.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]),{onPointerDown:i,onPointerMove:d,onPointerUp:a,onPointerCancel:a,onPointerLeave:a}}const ut=({item:t,onSelect:n})=>{const c=e.useContext(It),s=e.useRef(null),[i,a]=e.useState(null),d=e.useCallback(()=>{var w;if(!t.disabled)if(t.children&&t.children.length>0){if(s.current){const C=s.current.getBoundingClientRect();c==null||c.openSubmenu(t.id,{x:C.right,y:C.top})}}else(w=t.onClick)==null||w.call(t),n(t)},[t,n,c]),l=e.useCallback(()=>{if(t.children&&t.children.length>0&&s.current){const w=s.current.getBoundingClientRect();c==null||c.openSubmenu(t.id,{x:w.right,y:w.top})}},[t,c]),f=t.children&&t.children.length>0,y=(c==null?void 0:c.activeSubmenu)===t.id;return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:s,type:"button",className:`nice-touch-menu-item ${t.disabled?"nice-touch-menu-item--disabled":""} ${t.danger?"nice-touch-menu-item--danger":""} ${y?"nice-touch-menu-item--active":""}`,onClick:d,onKeyDown:w=>{f&&w.key==="ArrowRight"&&(w.preventDefault(),d())},onPointerEnter:l,disabled:t.disabled,role:"menuitem","aria-haspopup":f?"menu":void 0,"aria-expanded":f?y:void 0,children:[t.icon&&r.jsx("span",{className:"nice-touch-menu-item-icon",children:t.icon}),r.jsx("span",{className:"nice-touch-menu-item-label",children:t.label}),t.shortcut&&r.jsx("span",{className:"nice-touch-menu-item-shortcut",children:t.shortcut}),f&&r.jsx("span",{className:"nice-touch-menu-item-arrow","aria-hidden":"true"})]}),t.divider&&r.jsx("div",{className:"nice-touch-menu-divider",role:"separator"})]})},$t=e.forwardRef(function({items:n=qe,open:c,position:s,onClose:i,haptic:a=!0,className:d="",...l},f){var F;const y=e.useRef(null),[w,C]=e.useState(null),[P,u]=e.useState(null),[p,N]=e.useState(s);e.useEffect(()=>{if(!c||!y.current)return;const $=y.current.getBoundingClientRect(),T={width:window.innerWidth,height:window.innerHeight};let k=s.x,O=s.y;k+$.width>T.width-8&&(k=T.width-$.width-8),k<8&&(k=8),O+$.height>T.height-8&&(O=T.height-$.height-8),O<8&&(O=8),N({x:k,y:O})},[c,s]),e.useEffect(()=>{if(!c)return;const Y=$=>{y.current&&!y.current.contains($.target)&&i()};return document.addEventListener("mousedown",Y),()=>{document.removeEventListener("mousedown",Y)}},[c,i]);const I=e.useRef(null),S=e.useCallback(()=>{C(null),u(null)},[]);oe.useOverlayFocus(y,{open:c,modal:!1,onClose:i}),oe.useRovingFocus(y,{orientation:"vertical",wrap:!0,typeahead:!0}),oe.useOverlayFocus(I,{open:c&&w!=null,modal:!1,onClose:S}),oe.useRovingFocus(I,{orientation:"vertical",wrap:!0,typeahead:!0});const m=e.useCallback(()=>{if(!(!a||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[a]),v=e.useCallback(Y=>{m(),i()},[m,i]),D={close:i,openSubmenu:(Y,$)=>{C(Y),u($)},closeSubmenu:S,activeSubmenu:w};if(!c)return null;const J=w?(F=n.find(Y=>Y.id===w))==null?void 0:F.children:null;return r.jsx(It.Provider,{value:D,children:r.jsxs("div",{ref:y,className:`nice-touch-menu-popover ${d}`,style:{left:p.x,top:p.y},role:"menu",...l,children:[n.map(Y=>r.jsx(ut,{item:Y,onSelect:v},Y.id)),J&&P&&r.jsx("div",{ref:I,className:"nice-touch-menu-popover nice-touch-menu-submenu",style:{left:P.x-p.x,top:P.y-p.y},role:"menu",onKeyDown:Y=>{Y.key==="ArrowLeft"&&(Y.preventDefault(),S())},children:J.map(Y=>r.jsx(ut,{item:Y,onSelect:v},Y.id))})]})})}),Fn=e.forwardRef(function({items:n=qe,trigger:c,longPress:s=!0,longPressDelay:i=500,enableContextMenu:a=!1,enableClick:d=!1,haptic:l=!0,disabled:f=!1,onOpen:y,onClose:w,className:C="",...P},u){const[p,N]=e.useState(!1),[I,S]=e.useState({x:0,y:0}),m=e.useRef(null),v=e.useCallback(()=>{if(!(!l||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(20)}catch{}},[l]),D=e.useCallback((T,k)=>{f||(v(),S({x:T,y:k}),N(!0),y==null||y())},[f,v,y]),J=e.useCallback(()=>{N(!1),w==null||w()},[w]),F=Bn(T=>{T.preventDefault(),D(T.clientX,T.clientY)},i),Y=e.useCallback(T=>{if(!(!d||f)&&(T.preventDefault(),T.stopPropagation(),m.current)){const k=m.current.getBoundingClientRect();D(k.left,k.bottom+4)}},[d,f,D]),$=e.useCallback(T=>{!a||f||(T.preventDefault(),D(T.clientX,T.clientY))},[a,f,D]);return r.jsxs(r.Fragment,{children:[r.jsx("div",{role:"presentation",ref:T=>{m.current=T,typeof u=="function"?u(T):u&&(u.current=T)},className:`nice-touch-menu-trigger ${f?"nice-touch-menu-trigger--disabled":""} ${C}`,onClick:Y,onContextMenu:$,...s&&!f?F:{},...P,children:c}),r.jsx($t,{items:n,open:p,position:I,onClose:J,haptic:l})]})}),Et=e.forwardRef(function({items:n=qe,open:c,onClose:s,title:i,cancelLabel:a,haptic:d=!0,className:l="",...f},y){const{t:w}=oe.useNiceTranslation(),C=a??w("touchMenu.cancel","Cancel"),P=e.useCallback(()=>{if(!(!d||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[d]),u=e.useCallback(m=>{var v;m.disabled||(P(),(v=m.onClick)==null||v.call(m),s())},[P,s]),p=e.useCallback(()=>{P(),s()},[P,s]),N=e.useCallback(m=>{m.target===m.currentTarget&&s()},[s]),I=e.useRef(null),S=e.useCallback(m=>{I.current=m,typeof y=="function"?y(m):y&&(y.current=m)},[y]);return oe.useOverlayFocus(I,{open:c,onClose:s,closeHint:C}),c?r.jsx("div",{role:"presentation",className:`nice-action-sheet-backdrop ${c?"nice-action-sheet-backdrop--open":""}`,onClick:N,children:r.jsxs("div",{ref:S,className:`nice-action-sheet ${l}`,role:"dialog","aria-modal":"true",...f,children:[r.jsxs("div",{className:"nice-action-sheet-content",children:[i&&r.jsx("div",{className:"nice-action-sheet-title",children:i}),n.map(m=>r.jsxs("button",{type:"button",className:`nice-action-sheet-item ${m.disabled?"nice-action-sheet-item--disabled":""} ${m.danger?"nice-action-sheet-item--danger":""}`,onClick:()=>u(m),disabled:m.disabled,children:[m.icon&&r.jsx("span",{className:"nice-action-sheet-item-icon",children:m.icon}),r.jsx("span",{className:"nice-action-sheet-item-label",children:m.label})]},m.id))]}),r.jsx("button",{type:"button",className:"nice-action-sheet-cancel",onClick:p,children:C})]})}):null}),zn=[],_t=e.createContext(null);function On(){const t=e.useContext(_t);if(!t)throw new Error("useMobileTabs must be used within a NiceMobileTabs");return t}function Vn(t){var C;const{tabs:n,defaultTab:c,activeTab:s,onChange:i}=t,[a,d]=e.useState(c||((C=n[0])==null?void 0:C.id)||""),l=s!==void 0,f=l?s:a,y=e.useCallback(P=>{const u=n.find(p=>p.id===P);!u||u.disabled||(l||d(P),i==null||i(P))},[n,l,i]),w=e.useCallback(P=>f===P,[f]);return{activeTab:f,setActiveTab:y,tabs:n,isActive:w}}const be={home:r.jsx(de.NtdHome,{size:24,variant:"outline"}),homeFilled:r.jsx(de.NtdHome,{size:24,variant:"solid"}),search:r.jsx(de.NtdSearch,{size:24,variant:"outline"}),plus:r.jsx(de.NtdPlus,{size:24,variant:"outline"}),heart:r.jsx(de.NtdHeart,{size:24,variant:"outline"}),heartFilled:r.jsx(de.NtdHeart,{size:24,variant:"solid"}),user:r.jsx(de.NtdUser,{size:24,variant:"outline"}),userFilled:r.jsx(de.NtdUser,{size:24,variant:"solid"}),bell:r.jsx(de.NtdBell,{size:24,variant:"outline"}),bellFilled:r.jsx(de.NtdBell,{size:24,variant:"solid"}),cart:r.jsx(de.NtdCart,{size:24,variant:"outline"}),inbox:r.jsx(de.NtdInbox,{size:24,variant:"outline"}),settings:r.jsx(de.NtdSettings,{size:24,variant:"outline"}),more:r.jsx(de.NtdMoreHorizontal,{size:24,variant:"outline"})},dt=({content:t,variant:n="count",color:c})=>{if(t===void 0||t===!1)return null;if(t===!0||n==="dot")return r.jsx("span",{className:"nice-tab-badge nice-tab-badge--dot",style:c?{backgroundColor:c}:void 0});const s=typeof t=="number"&&t>99?"99+":t;return r.jsx("span",{className:"nice-tab-badge nice-tab-badge--count",style:c?{backgroundColor:c}:void 0,children:s})},ft=({tab:t,isActive:n,showLabel:c,animation:s,activeColor:i,inactiveColor:a,opensSheet:d,onClick:l})=>{const{t:f}=oe.useNiceTranslation(),y=t.labelKey?f(t.labelKey,t.label):t.label,w=e.useRef(null);e.useEffect(()=>{if(!w.current||s==="none")return;const u=w.current;s==="scale"&&n&&(u.style.transform="scale(1.2)",setTimeout(()=>{u.style.transform="scale(1)"},150))},[n,s]);const C=n&&t.activeIcon?t.activeIcon:t.icon,P={};return n&&i?P.color=i:!n&&a&&(P.color=a),t.href?r.jsxs("a",{href:t.href,className:`nice-tab-button ${n?"nice-tab-button--active":""} ${t.disabled?"nice-tab-button--disabled":""} ${t.className||""}`,style:P,role:"tab","aria-selected":n,"data-tab-id":t.id,onClick:u=>{var p;if(t.disabled){u.preventDefault();return}(p=t.onClick)==null||p.call(t),l()},children:[r.jsx("span",{ref:w,className:"nice-tab-icon",children:C}),c&&r.jsx("span",{className:"nice-tab-label",children:y}),r.jsx(dt,{content:t.badge,variant:t.badgeVariant,color:t.badgeColor})]}):r.jsxs("button",{type:"button",className:`nice-tab-button ${n?"nice-tab-button--active":""} ${t.disabled?"nice-tab-button--disabled":""} ${t.className||""}`,style:P,disabled:t.disabled,role:"tab","aria-selected":n,"aria-haspopup":d?"dialog":void 0,"data-tab-id":t.id,"aria-label":c?void 0:y,onClick:()=>{var u;(u=t.onClick)==null||u.call(t),l()},children:[r.jsx("span",{ref:w,className:"nice-tab-icon",children:C}),c&&r.jsx("span",{className:"nice-tab-label",children:y}),r.jsx(dt,{content:t.badge,variant:t.badgeVariant,color:t.badgeColor})]})},Kn=e.forwardRef(function({tabs:n=zn,activeTab:c,defaultTab:s,onChange:i,showLabels:a=!0,showAllLabels:d=!0,position:l="bottom",variant:f="default",haptic:y=!0,animation:w="scale",maxTabs:C,moreLabel:P,moreIcon:u=be.more,safeArea:p=!0,activeColor:N,inactiveColor:I,backgroundColor:S,hideOnScroll:m="none",lockScroll:v=!0,className:D="",style:J,...F},Y){var A;const{t:$}=oe.useNiceTranslation(),T=P??$("mobileTabs.more","More"),[k,O]=e.useState(s||((A=n[0])==null?void 0:A.id)||""),[q,W]=e.useState(!1),[Z,X]=e.useState(!1),V=e.useRef(0),U=c!==void 0,G=U?c:k,re=e.useRef(null),ne=e.useCallback(h=>{re.current=h,typeof Y=="function"?Y(h):Y&&(Y.current=h)},[Y]);e.useEffect(()=>{if(m==="none"||typeof window>"u")return;const h=()=>{const L=window.scrollY,x=L>V.current?"down":"up";x===m&&L>50?W(!0):x!==m&&W(!1),V.current=L};return window.addEventListener("scroll",h,{passive:!0}),()=>window.removeEventListener("scroll",h)},[m]);const K=e.useCallback(h=>{const L=n.find(x=>x.id===h);!L||L.disabled||(y&&"vibrate"in navigator&&navigator.vibrate(10),U||O(h),i==null||i(h))},[n,y,U,i]);oe.useRovingFocus(re,{orientation:"horizontal",wrap:!0,onMove:h=>{const L=h.getAttribute("data-tab-id");L&&L!=="__more__"&&K(L)}});const _=C&&n.length>C?n.slice(0,C-1):n,E=C&&n.length>C?n.slice(C-1):[],H={activeTab:G,setActiveTab:K,tabs:n},g={...J};return S&&(g.backgroundColor=S),r.jsxs(_t.Provider,{value:H,children:[r.jsxs("nav",{ref:ne,className:`nice-mobile-tabs nice-mobile-tabs--${l} nice-mobile-tabs--${f} ${p?"nice-mobile-tabs--safe-area":""} ${q?"nice-mobile-tabs--hidden":""} ${D}`,style:g,role:"tablist","aria-label":$("mobileTabs.mainNavigation","Main navigation"),...F,children:[_.map(h=>{const L=h.id===G,x=d||a&&L;return r.jsx(ft,{tab:h,isActive:L,showLabel:x,animation:w,activeColor:N,inactiveColor:I,onClick:()=>K(h.id)},h.id)}),E.length>0&&r.jsx(ft,{tab:{id:"__more__",label:T,icon:u,badge:E.some(h=>h.badge)?!0:void 0},isActive:E.some(h=>h.id===G),showLabel:d||a,animation:w,activeColor:N,inactiveColor:I,opensSheet:!0,onClick:()=>X(!0)})]}),E.length>0&&r.jsx(Et,{open:Z,onClose:()=>X(!1),title:T,items:E.map(h=>({id:h.id,label:h.labelKey?$(h.labelKey,h.label):h.label,icon:h.icon,disabled:h.disabled,onClick:()=>K(h.id)}))})]})}),Un={basic:[{id:"home",label:"Home",labelKey:"mobileTabs.preset.home",icon:be.home,activeIcon:be.homeFilled},{id:"search",label:"Search",labelKey:"mobileTabs.preset.search",icon:be.search},{id:"notifications",label:"Alerts",labelKey:"mobileTabs.preset.alerts",icon:be.bell,activeIcon:be.bellFilled},{id:"profile",label:"Profile",labelKey:"mobileTabs.preset.profile",icon:be.user,activeIcon:be.userFilled}],social:[{id:"feed",label:"Feed",labelKey:"mobileTabs.preset.feed",icon:be.home,activeIcon:be.homeFilled},{id:"discover",label:"Discover",labelKey:"mobileTabs.preset.discover",icon:be.search},{id:"create",label:"Create",labelKey:"mobileTabs.preset.create",icon:be.plus},{id:"activity",label:"Activity",labelKey:"mobileTabs.preset.activity",icon:be.heart,activeIcon:be.heartFilled},{id:"profile",label:"Profile",labelKey:"mobileTabs.preset.profile",icon:be.user,activeIcon:be.userFilled}],ecommerce:[{id:"shop",label:"Shop",labelKey:"mobileTabs.preset.shop",icon:be.home,activeIcon:be.homeFilled},{id:"search",label:"Search",labelKey:"mobileTabs.preset.search",icon:be.search},{id:"cart",label:"Cart",labelKey:"mobileTabs.preset.cart",icon:be.cart},{id:"favorites",label:"Wishlist",labelKey:"mobileTabs.preset.wishlist",icon:be.heart,activeIcon:be.heartFilled},{id:"account",label:"Account",labelKey:"mobileTabs.preset.account",icon:be.user,activeIcon:be.userFilled}],messaging:[{id:"chats",label:"Chats",labelKey:"mobileTabs.preset.chats",icon:be.inbox},{id:"calls",label:"Calls",labelKey:"mobileTabs.preset.calls",icon:be.bell},{id:"contacts",label:"Contacts",labelKey:"mobileTabs.preset.contacts",icon:be.user,activeIcon:be.userFilled},{id:"settings",label:"Settings",labelKey:"mobileTabs.preset.settings",icon:be.settings}]},Lt=e.createContext(null);function Xn(){const t=e.useContext(Lt);if(!t)throw new Error("useMobileHeader must be used within a NiceMobileHeader");return t}function Gn(t={}){const{collapsedHeight:n=56,expandedHeight:c=200,scrollElement:s,mode:i="scroll",threshold:a=0}=t,[d,l]=e.useState(0),[f,y]=e.useState(!0),w=e.useRef(null),C=e.useRef(0),P=e.useRef(!1),u=c-n,p=c-d*u,N=d>=1;e.useEffect(()=>{const m=s||w.current||window,v=()=>{P.current||(P.current=!0,requestAnimationFrame(()=>{const D=m===window?window.scrollY:m.scrollTop,J=D-C.current;if(i==="scroll"||i==="exitUntilCollapsed"){const F=Math.min(1,Math.max(0,(D-a)/u));l(F)}if(i==="enterAlways"){J>5&&D>a?y(!1):J<-5&&y(!0);const F=u>0?Math.min(1,Math.max(0,D/u)):0;l(F)}C.current=D,P.current=!1}))};return m.addEventListener("scroll",v,{passive:!0}),v(),()=>m.removeEventListener("scroll",v)},[s,i,a,u]);const I=e.useCallback(()=>{l(0),y(!0)},[]),S=e.useCallback(()=>{l(1)},[]);return{progress:d,height:p,isCollapsed:N,isVisible:f,scrollRef:w,expand:I,collapse:S}}const Wn=()=>r.jsx(de.NtdChevronLeft,{size:24,variant:"outline"}),qn=()=>r.jsx(de.NtdMenu,{size:24,variant:"outline"}),Jn=()=>r.jsx(de.NtdSearch,{size:24,variant:"outline"}),Qn=()=>r.jsx(de.NtdMoreVertical,{size:24,variant:"outline"}),Zn={back:r.jsx(Wn,{}),menu:r.jsx(qn,{}),search:r.jsx(Jn,{}),more:r.jsx(Qn,{})},er=({action:t})=>r.jsxs("button",{type:"button",className:`nice-header-action ${t.disabled?"nice-header-action--disabled":""}`,onClick:t.onClick,disabled:t.disabled,"aria-label":t.label,title:t.label,children:[t.icon,t.badge!==void 0&&t.badge!==!1&&r.jsx("span",{className:`nice-header-badge ${t.badge===!0?"nice-header-badge--dot":""}`,children:t.badge!==!0&&t.badge})]}),Ae=e.forwardRef(function({title:n,largeTitle:c,subtitle:s,leftAction:i,rightActions:a=[],background:d,mode:l="scroll",variant:f="default",collapsedHeight:y=56,expandedHeight:w=c||d?140:56,parallax:C=!1,parallaxSpeed:P=.5,showShadow:u=!0,sticky:p=!0,zIndex:N=100,scrollElement:I,onCollapseChange:S,safeArea:m=!0,backgroundColor:v,textColor:D,showBorder:J=!1,collapsedContent:F,expandedContent:Y,className:$="",style:T,children:k,...O},q){const[W,Z]=e.useState(0),[X,V]=e.useState(!0),U=e.useRef(null),G=e.useRef(0),re=e.useRef(!1),ne=w-y,K=w-W*ne,_=W>=.9;e.useEffect(()=>{const x=I||window,M=()=>{re.current||(re.current=!0,requestAnimationFrame(()=>{const o=x===window?window.scrollY:x.scrollTop,b=o-G.current;if(l==="scroll"||l==="exitUntilCollapsed"){const R=ne>0?Math.min(1,Math.max(0,o/ne)):0;Z(R),S&&Math.abs(R-W)>.05&&S(R>=.9,R)}if(l==="enterAlways"){b>5&&o>y?V(!1):b<-5&&V(!0);const R=ne>0?Math.min(1,Math.max(0,o/ne)):0;Z(R)}G.current=o,re.current=!1}))};return x.addEventListener("scroll",M,{passive:!0}),M(),()=>x.removeEventListener("scroll",M)},[I,l,ne,y,S,W]);const E=1-W*2,H=W>.5?(W-.5)*2:0,g=1-W,A=C?`translateY(${W*ne*P}px) scale(${1+W*.1})`:void 0,h={height:l==="pin"?y:K,zIndex:N,...T};v&&(h.backgroundColor=v),D&&(h.color=D);const L={progress:W,isCollapsed:_,height:K,expandedHeight:w,collapsedHeight:y};return r.jsxs(Lt.Provider,{value:L,children:[r.jsxs("header",{ref:x=>{U.current=x,typeof q=="function"?q(x):q&&(q.current=x)},className:`
2
2
  nice-mobile-header
3
3
  nice-mobile-header--${f}
4
4
  ${p?"nice-mobile-header--sticky":""}
5
5
  ${_&&u?"nice-mobile-header--shadow":""}
6
- ${Q?"nice-mobile-header--border":""}
6
+ ${J?"nice-mobile-header--border":""}
7
7
  ${m?"nice-mobile-header--safe-area":""}
8
- ${U?"":"nice-mobile-header--hidden"}
8
+ ${X?"":"nice-mobile-header--hidden"}
9
9
  ${$}
10
- `,style:h,role:"banner",...B,children:[d&&r.jsx("div",{className:"nice-header-background",style:{opacity:g,transform:A},children:d}),r.jsxs("div",{className:"nice-header-toolbar",style:{height:y},children:[i&&r.jsx("div",{className:"nice-header-left",children:i}),r.jsx("div",{className:"nice-header-center",style:{opacity:c?H:1},children:F||r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"nice-header-title",children:n}),s&&!c&&r.jsx("span",{className:"nice-header-subtitle",children:s})]})}),a.length>0&&r.jsx("div",{className:"nice-header-right",children:a.map(x=>r.jsx(er,{action:x},x.id))})]}),(c||Y)&&r.jsx("div",{className:"nice-header-expanded",style:{opacity:E,visibility:E<=0?"hidden":"visible"},children:Y||r.jsxs("div",{className:"nice-header-large-title-container",children:[r.jsx("h1",{className:"nice-header-large-title",children:c}),s&&r.jsx("p",{className:"nice-header-large-subtitle",children:s})]})}),k]}),p&&r.jsx("div",{className:"nice-header-spacer",style:{height:l==="pin"?y:w}})]})}),tr=e.forwardRef(function(n,c){return r.jsx(Ee,{ref:c,mode:"scroll",variant:"blur",collapsedHeight:44,expandedHeight:96,safeArea:!0,...n})}),nr=e.forwardRef(function(n,c){return r.jsx(Ee,{ref:c,mode:"enterAlways",variant:"solid",collapsedHeight:56,expandedHeight:56,showShadow:!0,...n})}),rr=e.forwardRef(function(n,c){return r.jsx(Ee,{ref:c,mode:"scroll",variant:"transparent",collapsedHeight:56,expandedHeight:280,parallax:!0,parallaxSpeed:.5,...n})}),cr=[],sr=[],Lt=e.createContext(null);function ir(){const t=e.useContext(Lt);if(!t)throw new Error("useMobilePicker must be used within a NiceMobilePicker");return t}function ar(t){var m;const{items:n,defaultValue:c,value:s,onChange:i,itemHeight:a=40,visibleItems:d=5,loop:l=!1}=t,f=e.useRef(null),y=e.useRef(void 0),w=e.useCallback(v=>{if(v===void 0)return 0;const P=n.findIndex(Q=>Q.value===v);return P>=0?P:0},[n]),[C,D]=e.useState(()=>w(s??c)),u=s!==void 0,p=u?w(s):C,N=(m=n[p])==null?void 0:m.value,I=e.useCallback((v,P=!0)=>{if(!f.current)return;const F=(l?(v%n.length+n.length)%n.length:Math.max(0,Math.min(v,n.length-1)))*a;f.current.scrollTo({top:F,behavior:P?"smooth":"auto"})},[n.length,a,d,l]),S=e.useCallback(v=>{const P=n[v];!P||P.disabled||(u||D(v),i==null||i(P.value,P))},[n,u,i]);return e.useEffect(()=>{const v=f.current;if(!v)return;const P=()=>{clearTimeout(y.current),y.current=setTimeout(()=>{const Q=v.scrollTop,F=Math.round(Q/a),Y=Math.max(0,Math.min(F,n.length-1));I(Y,!0),S(Y)},100)};return v.addEventListener("scroll",P,{passive:!0}),()=>{v.removeEventListener("scroll",P),clearTimeout(y.current)}},[a,n.length,I,S]),e.useEffect(()=>{I(p,!1)},[]),{selectedValue:N,selectedIndex:p,setSelectedIndex:S,scrollToIndex:I,containerRef:f}}const At=e.forwardRef(function({items:n=cr,value:c,defaultValue:s,onChange:i,itemHeight:a=40,visibleItems:d=5,loop:l=!1,renderItem:f,className:y="",style:w,...C},D){const u=e.useRef(null),p=e.useRef(void 0),N=e.useRef(!1),I=e.useRef(0),S=e.useRef(0),m=e.useCallback(K=>{if(K===void 0)return 0;const X=n.findIndex(re=>re.value===K);return X>=0?X:0},[n]),[v,P]=e.useState(()=>m(c??s)),Q=c!==void 0,F=Q?m(c):v,Y=Math.floor(d/2),$=a*d,j=Y*a,k=e.useCallback((K,X=!0)=>{if(!u.current)return;const ne=Math.max(0,Math.min(K,n.length-1))*a;u.current.scrollTo({top:ne,behavior:X?"smooth":"auto"})},[n.length,a]),B=e.useCallback(K=>{const X=n[K];!X||X.disabled||(Q||P(K),i==null||i(X.value,X))},[n,Q,i]),J=e.useCallback(()=>{if(!u.current)return;const K=u.current.scrollTop,X=Math.round(K/a),re=Math.max(0,Math.min(X,n.length-1));k(re,!0),B(re)},[a,n.length,k,B]);e.useEffect(()=>{const K=u.current;if(!K)return;const X=()=>{clearTimeout(p.current),p.current=setTimeout(J,100)};return K.addEventListener("scroll",X,{passive:!0}),()=>{K.removeEventListener("scroll",X),clearTimeout(p.current)}},[J]),e.useEffect(()=>{k(F,!1)},[]);const W=K=>{var X;N.current=!0,I.current=K.touches[0].clientY,S.current=((X=u.current)==null?void 0:X.scrollTop)||0},Z=K=>{if(!N.current||!u.current)return;const X=I.current-K.touches[0].clientY;u.current.scrollTop=S.current+X},U=()=>{N.current=!1},z=K=>{k(K,!0),B(K)};return r.jsx("div",{ref:K=>{u.current=K,typeof D=="function"?D(K):D&&(D.current=K)},className:`nice-picker-column ${y}`,style:{height:$,...w},onTouchStart:W,onTouchMove:Z,onTouchEnd:U,...C,children:r.jsx("div",{className:"nice-picker-column-inner",style:{paddingTop:j,paddingBottom:j},children:n.map((K,X)=>{const re=X===F,ne=Math.abs(X-F),V=ne===0?1:Math.max(.3,1-ne*.25),_=ne===0?1:Math.max(.85,1-ne*.05);return r.jsx("div",{className:`nice-picker-item ${re?"nice-picker-item--selected":""} ${K.disabled?"nice-picker-item--disabled":""}`,style:{height:a,lineHeight:`${a}px`,opacity:V,transform:`scale(${_})`},onClick:()=>!K.disabled&&z(X),children:f?f(K,re):K.label},String(K.value))})})})}),qe=e.forwardRef(function({columns:n=sr,value:c,defaultValue:s,onChange:i,itemHeight:a=40,visibleItems:d=5,loop:l=!1,showLabels:f=!1,renderItem:y,showIndicator:w=!0,indicatorClassName:C="",className:D="",style:u,...p},N){const[I,S]=e.useState(s??{}),m=c!==void 0,v=m?c:I,P=e.useCallback(($,j)=>{const k={...v,[$]:j};m||S(k),i==null||i(k,$)},[v,m,i]),Q=a*d,F=Math.floor(d/2)*a,Y={visibleItems:d,itemHeight:a,isScrolling:!1};return r.jsx(Lt.Provider,{value:Y,children:r.jsxs("div",{ref:N,className:`nice-mobile-picker ${D}`,style:{height:f?Q+24:Q,...u},...p,children:[f&&r.jsx("div",{className:"nice-picker-labels",children:n.map($=>r.jsx("div",{className:"nice-picker-label",style:{width:$.width},children:$.label},$.id))}),r.jsxs("div",{className:"nice-picker-body",children:[w&&r.jsx("div",{className:`nice-picker-indicator ${C}`,style:{top:F,height:a}}),r.jsx("div",{className:"nice-picker-columns",children:n.map($=>r.jsx(At,{items:$.items,value:v[$.id],onChange:j=>P($.id,j),itemHeight:a,visibleItems:d,loop:l,renderItem:y?(j,k)=>y(j,$.id,k):void 0,style:{width:$.width,flex:$.width?"none":1}},$.id))}),r.jsx("div",{className:"nice-picker-gradient nice-picker-gradient--top"}),r.jsx("div",{className:"nice-picker-gradient nice-picker-gradient--bottom"})]})]})})});function ke(t,n,c=1,s=2){const i=[];for(let a=t;a<=n;a+=c)i.push({value:a,label:String(a).padStart(s,"0")});return i}const or=e.forwardRef(function({value:n,defaultValue:c={hour:12,minute:0},onChange:s,use24Hour:i=!1,minuteStep:a=1,...d},l){const{t:f}=ue.useNiceTranslation(),y=e.useMemo(()=>ke(i?0:1,i?23:12,1,2),[i]),w=e.useMemo(()=>ke(0,59,a,2),[a]),C=[{value:"AM",label:f("mobilePicker.am","AM")},{value:"PM",label:f("mobilePicker.pm","PM")}],D=[{id:"hour",items:y,width:60},{id:"minute",items:w,width:60}];i||D.push({id:"period",items:C,width:60});const u=e.useCallback(N=>{const I=N.hour,S=N.minute,m=N.period;let v=I;i||(m==="PM"&&I!==12?v=I+12:m==="AM"&&I===12&&(v=0)),s==null||s({hour:v,minute:S})},[i,s]),p=e.useMemo(()=>{if(!n)return c;if(i)return n;const N=n.hour%12||12,I=n.hour>=12?"PM":"AM";return{hour:N,minute:n.minute,period:I}},[n,c,i]);return r.jsx(qe,{ref:l,columns:D,value:p,onChange:u,...d})}),lr=["January","February","March","April","May","June","July","August","September","October","November","December"],ur=e.forwardRef(function({value:n,defaultValue:c=new Date,onChange:s,minYear:i=new Date().getFullYear()-100,maxYear:a=new Date().getFullYear()+10,...d},l){const f=e.useMemo(()=>ke(1,31,1,2),[]),y=e.useMemo(()=>lr.map((p,N)=>({value:N,label:p})),[]),w=e.useMemo(()=>ke(i,a,1,4),[i,a]),C=[{id:"day",items:f,width:60},{id:"month",items:y,flex:1},{id:"year",items:w,width:80}],D=e.useCallback(p=>{const N=p.day,I=p.month,S=p.year,m=new Date(S,I+1,0).getDate(),v=Math.min(N,m);s==null||s(new Date(S,I,v))},[s]),u=e.useMemo(()=>{const p=n??c;return{day:p.getDate(),month:p.getMonth(),year:p.getFullYear()}},[n,c]);return r.jsx(qe,{ref:l,columns:C,value:u,onChange:D,...d})}),Ht=e.createContext(null);function dr(){const t=e.useContext(Ht);if(!t)throw new Error("useMobileCalendar must be used within a NiceMobileCalendar");return t}const fr=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Yt=["January","February","March","April","May","June","July","August","September","October","November","December"],hr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function pe(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function br(t,n,c){if(!n||!c)return!1;const s=t.getTime();return s>=n.getTime()&&s<=c.getTime()}function mr(t){const n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())),c=n.getUTCDay()||7;n.setUTCDate(n.getUTCDate()+4-c);const s=new Date(Date.UTC(n.getUTCFullYear(),0,1));return Math.ceil(((n.getTime()-s.getTime())/864e5+1)/7)}function Ce(t,n){const c=new Date(t);return c.setMonth(c.getMonth()+n),c}function ft(t,n){const c=new Date(t);return c.setFullYear(c.getFullYear()+n),c}function Bt(t={}){const{defaultDate:n=new Date,selectedDate:c,selectedDates:s,selectedRange:i,selectionMode:a="single",minDate:d,maxDate:l,disabledDates:f=[],events:y=[],weekStartDay:w=0,onChange:C}=t,[D,u]=e.useState(n),[p,N]=e.useState("day"),[I,S]=e.useState(null),[m,v]=e.useState([]),[P,Q]=e.useState({start:null,end:null}),F=c??I,Y=s??m,$=i??P,j=e.useCallback(V=>d&&V<d||l&&V>l?!0:f.some(_=>pe(_,V)),[d,l,f]),k=e.useCallback(V=>a==="single"&&F?pe(V,F):a==="multiple"?Y.some(_=>pe(_,V)):!!(a==="range"&&($.start&&pe(V,$.start)||$.end&&pe(V,$.end))),[a,F,Y,$]),B=e.useCallback(V=>{if(!j(V)){if(a==="single")S(V),C==null||C(V);else if(a==="multiple"){const E=m.some(H=>pe(H,V))?m.filter(H=>!pe(H,V)):[...m,V];v(E),C==null||C(E)}else if(a==="range")if(!P.start||P.start&&P.end){const _={start:V,end:null};Q(_),C==null||C(_)}else{const _=V<P.start?{start:V,end:P.start}:{start:P.start,end:V};Q(_),C==null||C(_)}}},[a,m,P,j,C]),J=e.useCallback(V=>u(V),[]),W=e.useCallback(()=>u(V=>Ce(V,-1)),[]),Z=e.useCallback(()=>u(V=>Ce(V,1)),[]),U=e.useCallback(()=>u(V=>ft(V,-1)),[]),z=e.useCallback(()=>u(V=>ft(V,1)),[]),K=e.useCallback(()=>u(new Date),[]),X=e.useCallback(()=>{const V=D.getFullYear(),_=D.getMonth(),E=new Date,g=(new Date(V,_,1).getDay()-w+7)%7,A=42,h=[];for(let L=0;L<A;L++){const x=new Date(V,_,1-g+L),M=x.getMonth()===_,o=x.getDate(),b=y.filter(R=>pe(R.date,x));h.push({date:x,dayOfMonth:o,isCurrentMonth:M,isToday:pe(x,E),isSelected:k(x),isInRange:br(x,$.start,$.end),isRangeStart:$.start?pe(x,$.start):!1,isRangeEnd:$.end?pe(x,$.end):!1,isDisabled:j(x),isWeekend:x.getDay()===0||x.getDay()===6,events:b.length>0?b:void 0})}return h},[D,w,y,k,$,j]),re=e.useCallback(()=>Yt.map((V,_)=>({month:_,label:V})),[]),ne=e.useCallback(()=>{const V=D.getFullYear(),_=[];for(let E=V-50;E<=V+50;E++)_.push(E);return _},[D]);return{viewDate:D,selectedDate:F,selectedDates:Y,selectedRange:$,view:p,setView:N,goToDate:J,goToPrevMonth:W,goToNextMonth:Z,goToPrevYear:U,goToNextYear:z,goToToday:K,selectDate:B,isDateSelected:k,isDateDisabled:j,getDaysInMonth:X,getMonths:re,getYears:ne}}const pr=()=>r.jsx(je,{direction:"left",style:{fontSize:24}}),gr=()=>r.jsx(je,{direction:"right",style:{fontSize:24}}),vr=({cell:t,compact:n,onClick:c,renderDay:s})=>s?r.jsx(r.Fragment,{children:s(t)}):r.jsxs("button",{type:"button",className:`
10
+ `,style:h,role:"banner",...O,children:[d&&r.jsx("div",{className:"nice-header-background",style:{opacity:g,transform:A},children:d}),r.jsxs("div",{className:"nice-header-toolbar",style:{height:y},children:[i&&r.jsx("div",{className:"nice-header-left",children:i}),r.jsx("div",{className:"nice-header-center",style:{opacity:c?H:1},children:F||r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"nice-header-title",children:n}),s&&!c&&r.jsx("span",{className:"nice-header-subtitle",children:s})]})}),a.length>0&&r.jsx("div",{className:"nice-header-right",children:a.map(x=>r.jsx(er,{action:x},x.id))})]}),(c||Y)&&r.jsx("div",{className:"nice-header-expanded",style:{opacity:E,visibility:E<=0?"hidden":"visible"},children:Y||r.jsxs("div",{className:"nice-header-large-title-container",children:[r.jsx("h1",{className:"nice-header-large-title",children:c}),s&&r.jsx("p",{className:"nice-header-large-subtitle",children:s})]})}),k]}),p&&r.jsx("div",{className:"nice-header-spacer",style:{height:l==="pin"?y:w}})]})}),tr=e.forwardRef(function(n,c){return r.jsx(Ae,{ref:c,mode:"scroll",variant:"blur",collapsedHeight:44,expandedHeight:96,safeArea:!0,...n})}),nr=e.forwardRef(function(n,c){return r.jsx(Ae,{ref:c,mode:"enterAlways",variant:"solid",collapsedHeight:56,expandedHeight:56,showShadow:!0,...n})}),rr=e.forwardRef(function(n,c){return r.jsx(Ae,{ref:c,mode:"scroll",variant:"transparent",collapsedHeight:56,expandedHeight:280,parallax:!0,parallaxSpeed:.5,...n})}),cr=[],sr=[],At=e.createContext(null);function ir(){const t=e.useContext(At);if(!t)throw new Error("useMobilePicker must be used within a NiceMobilePicker");return t}function ar(t){var m;const{items:n,defaultValue:c,value:s,onChange:i,itemHeight:a=40,visibleItems:d=5,loop:l=!1}=t,f=e.useRef(null),y=e.useRef(void 0),w=e.useCallback(v=>{if(v===void 0)return 0;const D=n.findIndex(J=>J.value===v);return D>=0?D:0},[n]),[C,P]=e.useState(()=>w(s??c)),u=s!==void 0,p=u?w(s):C,N=(m=n[p])==null?void 0:m.value,I=e.useCallback((v,D=!0)=>{if(!f.current)return;const F=(l?(v%n.length+n.length)%n.length:Math.max(0,Math.min(v,n.length-1)))*a;f.current.scrollTo({top:F,behavior:D?"smooth":"auto"})},[n.length,a,d,l]),S=e.useCallback(v=>{const D=n[v];!D||D.disabled||(u||P(v),i==null||i(D.value,D))},[n,u,i]);return e.useEffect(()=>{const v=f.current;if(!v)return;const D=()=>{clearTimeout(y.current),y.current=setTimeout(()=>{const J=v.scrollTop,F=Math.round(J/a),Y=Math.max(0,Math.min(F,n.length-1));I(Y,!0),S(Y)},100)};return v.addEventListener("scroll",D,{passive:!0}),()=>{v.removeEventListener("scroll",D),clearTimeout(y.current)}},[a,n.length,I,S]),e.useEffect(()=>{I(p,!1)},[]),{selectedValue:N,selectedIndex:p,setSelectedIndex:S,scrollToIndex:I,containerRef:f}}const Ht=e.forwardRef(function({items:n=cr,value:c,defaultValue:s,onChange:i,itemHeight:a=40,visibleItems:d=5,loop:l=!1,renderItem:f,className:y="",style:w,...C},P){const u=e.useRef(null),p=e.useRef(void 0),N=e.useRef(!1),I=e.useRef(0),S=e.useRef(0),m=e.useCallback(U=>{if(U===void 0)return 0;const G=n.findIndex(re=>re.value===U);return G>=0?G:0},[n]),[v,D]=e.useState(()=>m(c??s)),J=c!==void 0,F=J?m(c):v,Y=Math.floor(d/2),$=a*d,T=Y*a,k=e.useCallback((U,G=!0)=>{if(!u.current)return;const ne=Math.max(0,Math.min(U,n.length-1))*a;u.current.scrollTo({top:ne,behavior:G?"smooth":"auto"})},[n.length,a]),O=e.useCallback(U=>{const G=n[U];!G||G.disabled||(J||D(U),i==null||i(G.value,G))},[n,J,i]),q=e.useCallback(()=>{if(!u.current)return;const U=u.current.scrollTop,G=Math.round(U/a),re=Math.max(0,Math.min(G,n.length-1));k(re,!0),O(re)},[a,n.length,k,O]);e.useEffect(()=>{const U=u.current;if(!U)return;const G=()=>{clearTimeout(p.current),p.current=setTimeout(q,100)};return U.addEventListener("scroll",G,{passive:!0}),()=>{U.removeEventListener("scroll",G),clearTimeout(p.current)}},[q]),e.useEffect(()=>{k(F,!1)},[]);const W=U=>{var G;N.current=!0,I.current=U.touches[0].clientY,S.current=((G=u.current)==null?void 0:G.scrollTop)||0},Z=U=>{if(!N.current||!u.current)return;const G=I.current-U.touches[0].clientY;u.current.scrollTop=S.current+G},X=()=>{N.current=!1},V=U=>{k(U,!0),O(U)};return r.jsx("div",{ref:U=>{u.current=U,typeof P=="function"?P(U):P&&(P.current=U)},className:`nice-picker-column ${y}`,style:{height:$,...w},onTouchStart:W,onTouchMove:Z,onTouchEnd:X,...C,children:r.jsx("div",{className:"nice-picker-column-inner",style:{paddingTop:T,paddingBottom:T},children:n.map((U,G)=>{const re=G===F,ne=Math.abs(G-F),K=ne===0?1:Math.max(.3,1-ne*.25),_=ne===0?1:Math.max(.85,1-ne*.05);return r.jsx("div",{className:`nice-picker-item ${re?"nice-picker-item--selected":""} ${U.disabled?"nice-picker-item--disabled":""}`,style:{height:a,lineHeight:`${a}px`,opacity:K,transform:`scale(${_})`},onClick:()=>!U.disabled&&V(G),children:f?f(U,re):U.label},String(U.value))})})})}),Je=e.forwardRef(function({columns:n=sr,value:c,defaultValue:s,onChange:i,itemHeight:a=40,visibleItems:d=5,loop:l=!1,showLabels:f=!1,renderItem:y,showIndicator:w=!0,indicatorClassName:C="",className:P="",style:u,...p},N){const[I,S]=e.useState(s??{}),m=c!==void 0,v=m?c:I,D=e.useCallback(($,T)=>{const k={...v,[$]:T};m||S(k),i==null||i(k,$)},[v,m,i]),J=a*d,F=Math.floor(d/2)*a,Y={visibleItems:d,itemHeight:a,isScrolling:!1};return r.jsx(At.Provider,{value:Y,children:r.jsxs("div",{ref:N,className:`nice-mobile-picker ${P}`,style:{height:f?J+24:J,...u},...p,children:[f&&r.jsx("div",{className:"nice-picker-labels",children:n.map($=>r.jsx("div",{className:"nice-picker-label",style:{width:$.width},children:$.label},$.id))}),r.jsxs("div",{className:"nice-picker-body",children:[w&&r.jsx("div",{className:`nice-picker-indicator ${C}`,style:{top:F,height:a}}),r.jsx("div",{className:"nice-picker-columns",children:n.map($=>r.jsx(Ht,{items:$.items,value:v[$.id],onChange:T=>D($.id,T),itemHeight:a,visibleItems:d,loop:l,renderItem:y?(T,k)=>y(T,$.id,k):void 0,style:{width:$.width,flex:$.width?"none":1}},$.id))}),r.jsx("div",{className:"nice-picker-gradient nice-picker-gradient--top"}),r.jsx("div",{className:"nice-picker-gradient nice-picker-gradient--bottom"})]})]})})});function Re(t,n,c=1,s=2){const i=[];for(let a=t;a<=n;a+=c)i.push({value:a,label:String(a).padStart(s,"0")});return i}const or=e.forwardRef(function({value:n,defaultValue:c={hour:12,minute:0},onChange:s,use24Hour:i=!1,minuteStep:a=1,...d},l){const{t:f}=oe.useNiceTranslation(),y=e.useMemo(()=>Re(i?0:1,i?23:12,1,2),[i]),w=e.useMemo(()=>Re(0,59,a,2),[a]),C=[{value:"AM",label:f("mobilePicker.am","AM")},{value:"PM",label:f("mobilePicker.pm","PM")}],P=[{id:"hour",items:y,width:60},{id:"minute",items:w,width:60}];i||P.push({id:"period",items:C,width:60});const u=e.useCallback(N=>{const I=N.hour,S=N.minute,m=N.period;let v=I;i||(m==="PM"&&I!==12?v=I+12:m==="AM"&&I===12&&(v=0)),s==null||s({hour:v,minute:S})},[i,s]),p=e.useMemo(()=>{if(!n)return c;if(i)return n;const N=n.hour%12||12,I=n.hour>=12?"PM":"AM";return{hour:N,minute:n.minute,period:I}},[n,c,i]);return r.jsx(Je,{ref:l,columns:P,value:p,onChange:u,...d})}),lr=["January","February","March","April","May","June","July","August","September","October","November","December"],ur=e.forwardRef(function({value:n,defaultValue:c=new Date,onChange:s,minYear:i=new Date().getFullYear()-100,maxYear:a=new Date().getFullYear()+10,...d},l){const f=e.useMemo(()=>Re(1,31,1,2),[]),y=e.useMemo(()=>lr.map((p,N)=>({value:N,label:p})),[]),w=e.useMemo(()=>Re(i,a,1,4),[i,a]),C=[{id:"day",items:f,width:60},{id:"month",items:y,flex:1},{id:"year",items:w,width:80}],P=e.useCallback(p=>{const N=p.day,I=p.month,S=p.year,m=new Date(S,I+1,0).getDate(),v=Math.min(N,m);s==null||s(new Date(S,I,v))},[s]),u=e.useMemo(()=>{const p=n??c;return{day:p.getDate(),month:p.getMonth(),year:p.getFullYear()}},[n,c]);return r.jsx(Je,{ref:l,columns:C,value:u,onChange:P,...d})}),Yt=e.createContext(null);function dr(){const t=e.useContext(Yt);if(!t)throw new Error("useMobileCalendar must be used within a NiceMobileCalendar");return t}const fr=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Bt=["January","February","March","April","May","June","July","August","September","October","November","December"],hr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ve(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function br(t,n,c){if(!n||!c)return!1;const s=t.getTime();return s>=n.getTime()&&s<=c.getTime()}function mr(t){const n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())),c=n.getUTCDay()||7;n.setUTCDate(n.getUTCDate()+4-c);const s=new Date(Date.UTC(n.getUTCFullYear(),0,1));return Math.ceil(((n.getTime()-s.getTime())/864e5+1)/7)}function Ee(t,n){const c=new Date(t);return c.setMonth(c.getMonth()+n),c}function ht(t,n){const c=new Date(t);return c.setFullYear(c.getFullYear()+n),c}function Ft(t={}){const{defaultDate:n=new Date,selectedDate:c,selectedDates:s,selectedRange:i,selectionMode:a="single",minDate:d,maxDate:l,disabledDates:f=[],events:y=[],weekStartDay:w=0,onChange:C}=t,[P,u]=e.useState(n),[p,N]=e.useState("day"),[I,S]=e.useState(null),[m,v]=e.useState([]),[D,J]=e.useState({start:null,end:null}),F=c??I,Y=s??m,$=i??D,T=e.useCallback(K=>d&&K<d||l&&K>l?!0:f.some(_=>ve(_,K)),[d,l,f]),k=e.useCallback(K=>a==="single"&&F?ve(K,F):a==="multiple"?Y.some(_=>ve(_,K)):!!(a==="range"&&($.start&&ve(K,$.start)||$.end&&ve(K,$.end))),[a,F,Y,$]),O=e.useCallback(K=>{if(!T(K)){if(a==="single")S(K),C==null||C(K);else if(a==="multiple"){const E=m.some(H=>ve(H,K))?m.filter(H=>!ve(H,K)):[...m,K];v(E),C==null||C(E)}else if(a==="range")if(!D.start||D.start&&D.end){const _={start:K,end:null};J(_),C==null||C(_)}else{const _=K<D.start?{start:K,end:D.start}:{start:D.start,end:K};J(_),C==null||C(_)}}},[a,m,D,T,C]),q=e.useCallback(K=>u(K),[]),W=e.useCallback(()=>u(K=>Ee(K,-1)),[]),Z=e.useCallback(()=>u(K=>Ee(K,1)),[]),X=e.useCallback(()=>u(K=>ht(K,-1)),[]),V=e.useCallback(()=>u(K=>ht(K,1)),[]),U=e.useCallback(()=>u(new Date),[]),G=e.useCallback(()=>{const K=P.getFullYear(),_=P.getMonth(),E=new Date,g=(new Date(K,_,1).getDay()-w+7)%7,A=42,h=[];for(let L=0;L<A;L++){const x=new Date(K,_,1-g+L),M=x.getMonth()===_,o=x.getDate(),b=y.filter(R=>ve(R.date,x));h.push({date:x,dayOfMonth:o,isCurrentMonth:M,isToday:ve(x,E),isSelected:k(x),isInRange:br(x,$.start,$.end),isRangeStart:$.start?ve(x,$.start):!1,isRangeEnd:$.end?ve(x,$.end):!1,isDisabled:T(x),isWeekend:x.getDay()===0||x.getDay()===6,events:b.length>0?b:void 0})}return h},[P,w,y,k,$,T]),re=e.useCallback(()=>Bt.map((K,_)=>({month:_,label:K})),[]),ne=e.useCallback(()=>{const K=P.getFullYear(),_=[];for(let E=K-50;E<=K+50;E++)_.push(E);return _},[P]);return{viewDate:P,selectedDate:F,selectedDates:Y,selectedRange:$,view:p,setView:N,goToDate:q,goToPrevMonth:W,goToNextMonth:Z,goToPrevYear:X,goToNextYear:V,goToToday:U,selectDate:O,isDateSelected:k,isDateDisabled:T,getDaysInMonth:G,getMonths:re,getYears:ne}}const pr=()=>r.jsx(Se,{direction:"left",style:{fontSize:24}}),gr=()=>r.jsx(Se,{direction:"right",style:{fontSize:24}}),vr=({cell:t,compact:n,onClick:c,renderDay:s})=>s?r.jsx(r.Fragment,{children:s(t)}):r.jsxs("button",{type:"button",className:`
11
11
  nice-calendar-day
12
12
  ${t.isCurrentMonth?"":"nice-calendar-day--other-month"}
13
13
  ${t.isToday?"nice-calendar-day--today":""}
@@ -17,10 +17,10 @@
17
17
  ${t.isRangeEnd?"nice-calendar-day--range-end":""}
18
18
  ${t.isDisabled?"nice-calendar-day--disabled":""}
19
19
  ${t.isWeekend?"nice-calendar-day--weekend":""}
20
- `,disabled:t.isDisabled,onClick:c,"aria-label":t.date.toLocaleDateString(),"aria-pressed":t.isSelected,children:[r.jsx("span",{className:"nice-calendar-day-number",children:t.dayOfMonth}),t.events&&t.events.length>0&&!n&&r.jsx("span",{className:"nice-calendar-day-dots",children:t.events.slice(0,3).map((i,a)=>r.jsx("span",{className:"nice-calendar-day-dot",style:i.color?{backgroundColor:i.color}:void 0},i.id))})]}),Je=e.forwardRef(function({defaultDate:n,viewDate:c,selectedDate:s,selectedDates:i,selectedRange:a,selectionMode:d="single",minDate:l,maxDate:f,disabledDates:y=[],disableWeekends:w=!1,events:C=[],weekStartDay:D=0,locale:u="en-US",showWeekNumbers:p=!1,showAdjacentMonths:N=!0,enableSwipe:I=!0,onChange:S,onViewChange:m,onMonthChange:v,renderDay:P,renderHeader:Q,showTodayButton:F=!0,todayLabel:Y,compact:$=!1,className:j="",...k},B){const{t:J}=ue.useNiceTranslation(),W=Y??J("mobileCalendar.today","Today"),Z=e.useMemo(()=>y,[y,w]),U=Bt({defaultDate:n,selectedDate:s,selectedDates:i,selectedRange:a,selectionMode:d,minDate:l,maxDate:f,disabledDates:Z,events:C,weekStartDay:D,onChange:S}),[z,K]=e.useState(c??n??new Date),X=e.useRef(0),re=e.useRef(0);e.useEffect(()=>{c&&K(c)},[c]);const ne=e.useCallback(()=>{const T=Ce(z,-1);K(T),U.goToDate(T),v==null||v(T),m==null||m(T,U.view)},[z,U,v,m]),V=e.useCallback(()=>{const T=Ce(z,1);K(T),U.goToDate(T),v==null||v(T),m==null||m(T,U.view)},[z,U,v,m]),_=e.useCallback(()=>{const T=new Date;K(T),U.goToDate(T),v==null||v(T)},[U,v]),E=e.useRef(null),H=e.useRef(!1),g=e.useRef(!1),A=e.useCallback(T=>{!I||E.current!==null||T.pointerType==="mouse"&&T.button!==0||(E.current=T.pointerId,H.current=!1,X.current=T.clientX,re.current=T.clientX)},[I]),h=e.useCallback(T=>{var ee,O;T.pointerId===E.current&&(re.current=T.clientX,!H.current&&Math.abs(T.clientX-X.current)>10&&(H.current=!0,(O=(ee=T.currentTarget).setPointerCapture)==null||O.call(ee,T.pointerId)))},[]),L=e.useCallback(T=>{if(T.pointerId!==E.current||(E.current=null,T.type==="pointercancel"))return;const ee=X.current-re.current;Math.abs(ee)>50&&(g.current=!0,ee>0?V():ne())},[V,ne]),x=e.useCallback(T=>{T.pointerId===E.current&&!H.current&&(E.current=null)},[]),M=e.useCallback(T=>{w&&(T.getDay()===0||T.getDay()===6)||U.selectDate(T)},[U,w]),o=e.useMemo(()=>{const T=[...fr];return[...T.slice(D),...T.slice(0,D)]},[D]),b=U.getDaysInMonth(),R={viewDate:z,selectedDate:U.selectedDate,selectedDates:U.selectedDates,selectedRange:U.selectedRange,selectionMode:d,view:U.view,selectDate:M,setView:U.setView,goToDate:U.goToDate};return r.jsx(Ht.Provider,{value:R,children:r.jsxs("div",{ref:B,className:`nice-mobile-calendar ${$?"nice-mobile-calendar--compact":""} ${j}`,onPointerDown:A,onPointerMove:h,onPointerUp:L,onPointerCancel:L,onPointerLeave:x,onClickCapture:T=>{g.current&&(g.current=!1,T.stopPropagation(),T.preventDefault())},...k,children:[Q?Q(z,U.view,{prev:ne,next:V,setView:U.setView}):r.jsxs("div",{className:"nice-calendar-header",children:[r.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:ne,"aria-label":J("mobileCalendar.previousMonth","Previous month"),children:r.jsx(pr,{})}),r.jsxs("button",{type:"button",className:"nice-calendar-title-btn",onClick:()=>U.setView(U.view==="day"?"month":"day"),children:[r.jsx("span",{className:"nice-calendar-month",children:Yt[z.getMonth()]}),r.jsx("span",{className:"nice-calendar-year",children:z.getFullYear()})]}),r.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:V,"aria-label":J("mobileCalendar.nextMonth","Next month"),children:r.jsx(gr,{})})]}),U.view==="day"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:`nice-calendar-weekdays ${p?"nice-calendar-weekdays--with-numbers":""}`,children:[p&&r.jsx("div",{className:"nice-calendar-weekday nice-calendar-weekday--number",children:"W"}),o.map((T,ee)=>r.jsx("div",{className:"nice-calendar-weekday",children:$?T.charAt(0):T},T))]}),r.jsx("div",{className:`nice-calendar-grid ${p?"nice-calendar-grid--with-numbers":""}`,children:b.map((T,ee)=>{const O=p&&ee%7===0;return r.jsxs(e.Fragment,{children:[O&&r.jsx("div",{className:"nice-calendar-week-number",children:mr(T.date)}),!T.isCurrentMonth&&!N?r.jsx("div",{className:"nice-calendar-day nice-calendar-day--empty"}):r.jsx(vr,{cell:{...T,isDisabled:T.isDisabled||w&&T.isWeekend},compact:$,onClick:()=>M(T.date),renderDay:P})]},T.date.toISOString())})})]}),U.view==="month"&&r.jsx("div",{className:"nice-calendar-months",children:U.getMonths().map(({month:T,label:ee})=>r.jsx("button",{type:"button",className:`nice-calendar-month-btn ${T===z.getMonth()?"nice-calendar-month-btn--selected":""}`,onClick:()=>{const O=new Date(z.getFullYear(),T,1);K(O),U.goToDate(O),U.setView("day")},children:$?hr[T]:ee},T))}),U.view==="year"&&r.jsx("div",{className:"nice-calendar-years",children:U.getYears().map(T=>r.jsx("button",{type:"button",className:`nice-calendar-year-btn ${T===z.getFullYear()?"nice-calendar-year-btn--selected":""}`,onClick:()=>{const ee=new Date(T,z.getMonth(),1);K(ee),U.goToDate(ee),U.setView("month")},children:T},T))}),F&&U.view==="day"&&r.jsx("div",{className:"nice-calendar-footer",children:r.jsx("button",{type:"button",className:"nice-calendar-today-btn",onClick:_,children:W})})]})})}),xr=e.forwardRef(function(n,c){return r.jsx(Je,{ref:c,selectionMode:"range",...n})}),yr=e.forwardRef(function(n,c){return r.jsx(Je,{ref:c,selectionMode:"multiple",...n})}),Ft=e.createContext(null);function wr(){const t=e.useContext(Ft);if(!t)throw new Error("useGesturesContext must be used within a NiceGestures");return t}function we(t,n){const c=n.x-t.x,s=n.y-t.y;return Math.sqrt(c*c+s*s)}function ht(t,n){return Math.atan2(n.y-t.y,n.x-t.x)*(180/Math.PI)}function Fe(t,n){return{x:(t.x+n.x)/2,y:(t.y+n.y)/2}}function ze(t){const n=Math.abs(t.x),c=Math.abs(t.y);return n<5&&c<5?null:n>c?t.x>0?"right":"left":t.y>0?"down":"up"}function zt(t={}){const{enablePinch:n=!0,enableRotation:c=!0,enablePan:s=!0,enableSwipe:i=!0,enableTap:a=!0,enableDoubleTap:d=!0,enableLongPress:l=!0,minScale:f=.5,maxScale:y=4,panThreshold:w=5,swipeVelocityThreshold:C=.5,swipeDistanceThreshold:D=50,longPressDuration:u=500,doubleTapDelay:p=300,onPinchStart:N,onPinch:I,onPinchEnd:S,onRotateStart:m,onRotate:v,onRotateEnd:P,onPanStart:Q,onPan:F,onPanEnd:Y,onSwipe:$,onTap:j,onDoubleTap:k,onLongPress:B}=t,[J,W]=e.useState({scale:1,rotation:0,translation:{x:0,y:0},velocity:{x:0,y:0},center:{x:0,y:0},isActive:!1}),Z=e.useRef(new Map),U=e.useRef(0),z=e.useRef(0),K=e.useRef(1),X=e.useRef(0),re=e.useRef({x:0,y:0}),ne=e.useRef(0),V=e.useRef({x:0,y:0}),_=e.useRef(0),E=e.useRef({x:0,y:0}),H=e.useRef(0),g=e.useRef(null),A=e.useRef(!1),h=e.useRef(!1),L=e.useRef(!1),x=e.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null)},[]),M=e.useCallback(()=>{W({scale:1,rotation:0,translation:{x:0,y:0},velocity:{x:0,y:0},center:{x:0,y:0},isActive:!1}),K.current=1,X.current=0,re.current={x:0,y:0}},[]),o=e.useCallback(O=>{O.currentTarget.setPointerCapture(O.pointerId),Z.current.set(O.pointerId,{x:O.clientX,y:O.clientY});const ie=Z.current.size;if(ie===1)_.current=Date.now(),E.current={x:O.clientX,y:O.clientY},V.current={x:O.clientX,y:O.clientY},ne.current=Date.now(),l&&(x(),g.current=setTimeout(()=>{B==null||B({position:{x:O.clientX,y:O.clientY},duration:u,target:O.target})},u));else if(ie===2){x();const[ae,se]=Array.from(Z.current.values());U.current=we(ae,se),z.current=ht(ae,se),K.current=J.scale,X.current=J.rotation,n&&!h.current&&(h.current=!0,N==null||N()),c&&!L.current&&(L.current=!0,m==null||m())}W(ae=>({...ae,isActive:!0}))},[J.scale,J.rotation,l,n,c,u,B,N,m,x]),b=e.useCallback(O=>{if(!Z.current.has(O.pointerId))return;Z.current.set(O.pointerId,{x:O.clientX,y:O.clientY});const ie=Z.current.size,ae=Date.now();if(ie===1){const se={x:O.clientX,y:O.clientY},ce={x:se.x-V.current.x,y:se.y-V.current.y},oe={x:se.x-E.current.x,y:se.y-E.current.y};if(we(E.current,se)>w&&(x(),s)){A.current||(A.current=!0,Q==null||Q());const G=ae-ne.current,q=G>0?{x:ce.x/G*1e3,y:ce.y/G*1e3}:{x:0,y:0},te={x:re.current.x+oe.x,y:re.current.y+oe.y};W(le=>({...le,translation:te,velocity:q,center:se})),F==null||F({translation:te,delta:ce,velocity:q,center:se,direction:ze(ce)})}V.current=se,ne.current=ae}else if(ie===2){const[se,ce]=Array.from(Z.current.values()),oe=we(se,ce),me=ht(se,ce),G=Fe(se,ce);if(n){const q=Math.max(f,Math.min(y,K.current*(oe/U.current))),te=q-J.scale;W(le=>({...le,scale:q,center:G})),I==null||I({scale:q,deltaScale:te,center:G,distance:oe,initialDistance:U.current})}if(c){let q=me-z.current;q>180&&(q-=360),q<-180&&(q+=360);const te=X.current+q,le=te-J.rotation;W(fe=>({...fe,rotation:te,center:G})),v==null||v({rotation:te,deltaRotation:le,center:G})}}},[s,n,c,f,y,w,J.scale,J.rotation,F,Q,I,v,x]),R=e.useCallback(O=>{O.currentTarget.releasePointerCapture(O.pointerId),x();const ie=Z.current.size,ae=Date.now();if(ie===1){const se={x:O.clientX,y:O.clientY},ce=we(E.current,se),oe=ae-_.current;if(ce<w)d&&ae-H.current<p?(k==null||k({position:se,target:O.target}),H.current=0):a&&(setTimeout(()=>{H.current===ae&&(j==null||j({position:se,target:O.target}))},p),H.current=ae);else{const me=ce/oe*1e3;if(i&&me>C&&ce>D){const G={x:se.x-E.current.x,y:se.y-E.current.y},q=ze(G);q&&($==null||$({direction:q,velocity:me,distance:ce,duration:oe}))}if(A.current){const G=ae-ne.current,q={x:se.x-V.current.x,y:se.y-V.current.y},te=G>0?{x:q.x/G*1e3,y:q.y/G*1e3}:{x:0,y:0};Y==null||Y({translation:J.translation,delta:q,velocity:te,center:se,direction:ze(q)})}}re.current=J.translation}if(ie===2){if(h.current){const[se,ce]=Array.from(Z.current.values()),oe=Fe(se,ce);S==null||S({scale:J.scale,deltaScale:0,center:oe,distance:we(se,ce),initialDistance:U.current})}if(L.current){const[se,ce]=Array.from(Z.current.values()),oe=Fe(se,ce);P==null||P({rotation:J.rotation,deltaRotation:0,center:oe})}}Z.current.delete(O.pointerId),Z.current.size===0&&(A.current=!1,h.current=!1,L.current=!1,W(se=>({...se,isActive:!1})))},[a,d,i,p,w,C,D,J.scale,J.rotation,J.translation,j,k,$,Y,S,P,x]),T=e.useCallback(O=>{x(),Z.current.delete(O.pointerId),Z.current.size===0&&(A.current=!1,h.current=!1,L.current=!1,W(ie=>({...ie,isActive:!1})))},[x]),ee=e.useCallback(()=>({onPointerDown:o,onPointerMove:b,onPointerUp:R,onPointerCancel:T,style:{touchAction:"none"}}),[o,b,R,T]);return e.useEffect(()=>()=>{x()},[x]),{bind:ee,state:J,reset:M}}const _e=e.forwardRef(function({enablePinch:n=!0,enableRotation:c=!0,enablePan:s=!0,enableSwipe:i=!0,enableTap:a=!0,enableDoubleTap:d=!0,enableLongPress:l=!0,minScale:f=.5,maxScale:y=4,applyTransform:w=!1,initialScale:C=1,scale:D,initialRotation:u=0,rotation:p,initialTranslation:N={x:0,y:0},translation:I,onTransformChange:S,onPinchStart:m,onPinch:v,onPinchEnd:P,onRotateStart:Q,onRotate:F,onRotateEnd:Y,onPanStart:$,onPan:j,onPanEnd:k,onSwipe:B,onTap:J,onDoubleTap:W,onLongPress:Z,children:U,className:z="",style:K,...X},re){const ne=zt({enablePinch:n,enableRotation:c,enablePan:s,enableSwipe:i,enableTap:a,enableDoubleTap:d,enableLongPress:l,minScale:f,maxScale:y,onPinchStart:m,onPinch:x=>{v==null||v(x),S==null||S(ne.state)},onPinchEnd:P,onRotateStart:Q,onRotate:x=>{F==null||F(x),S==null||S(ne.state)},onRotateEnd:Y,onPanStart:$,onPan:x=>{j==null||j(x),S==null||S(ne.state)},onPanEnd:k,onSwipe:B,onTap:J,onDoubleTap:W,onLongPress:Z}),{bind:V,state:_}=ne,E=V(),H=D??_.scale,g=p??_.rotation,A=I??_.translation,h=w?{transform:`translate(${A.x}px, ${A.y}px) scale(${H}) rotate(${g}deg)`,transformOrigin:`${_.center.x}px ${_.center.y}px`}:{},L={state:{..._,scale:H,rotation:g,translation:A},reset:ne.reset};return r.jsx(Ft.Provider,{value:L,children:r.jsx("div",{ref:re,className:`nice-gestures ${_.isActive?"nice-gestures--active":""} ${z}`,style:{...E.style,...K,...h},onPointerDown:E.onPointerDown,onPointerMove:E.onPointerMove,onPointerUp:E.onPointerUp,onPointerCancel:E.onPointerCancel,...X,children:U})})}),Nr=e.forwardRef(function(n,c){return r.jsx(_e,{ref:c,enablePinch:!0,enableRotation:!1,enablePan:!1,enableSwipe:!1,enableTap:!1,enableLongPress:!1,applyTransform:!0,...n})}),kr=e.forwardRef(function(n,c){return r.jsx(_e,{ref:c,enablePinch:!1,enableRotation:!1,enablePan:!0,enableSwipe:!1,enableTap:!1,enableLongPress:!1,applyTransform:!0,...n})}),jr=e.forwardRef(function(n,c){return r.jsx(_e,{ref:c,enablePinch:!1,enableRotation:!1,enablePan:!1,enableSwipe:!0,enableTap:!1,enableLongPress:!1,...n})}),Qe={selection:10,"impact-light":15,"impact-medium":30,"impact-heavy":50,"notification-success":[30,50,30],"notification-warning":[50,30,50,30],"notification-error":[50,50,100],"button-press":20,"toggle-on":[15,30,15],"toggle-off":[15,50],swipe:15,"pull-to-refresh":[10,20,30],keyboard:5},Tr={light:.5,medium:1,heavy:1.5};function ye(){return typeof navigator<"u"&&"vibrate"in navigator}function Mr(t,n){return typeof t=="number"?Math.round(t*n):t.map(c=>Math.round(c*n))}function Rr(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const Ot=e.createContext(null);function Sr(){const t=e.useContext(Ot);if(!t)throw new Error("useHapticsContext must be used within a NiceHapticsProvider");return t}function ve(t={}){const{enabled:n=!0,intensity:c="medium",customPatterns:s={}}=t,i=e.useRef(n),[a,d]=e.useState(n),l=e.useMemo(()=>ye(),[]),f=e.useCallback(p=>{i.current=p,d(p)},[]),y=e.useCallback(()=>Tr[c],[c]),w=e.useCallback((p=50)=>{if(!l||!i.current)return!1;try{const N=Mr(p,y());return navigator.vibrate(N)}catch{return!1}},[l,y]),C=e.useCallback(()=>{l&&navigator.vibrate(0)},[l]),D=e.useCallback(p=>{if(!l||!i.current)return!1;const N=Qe[p];return N?w(N):!1},[l,w]),u=e.useCallback(p=>{if(!l||!i.current)return!1;const N=s[p];return N?w(N):!1},[l,s,w]);return{isSupported:l,isEnabled:a,setEnabled:f,vibrate:w,cancel:C,trigger:D,triggerPattern:u,getIntensityMultiplier:y}}function Dr({enabled:t=!0,intensity:n="medium",respectReducedMotion:c=!0,customPatterns:s={},children:i}){const a=e.useMemo(()=>c&&Rr()?!1:t,[t,c]),d=ve({enabled:a,intensity:n,customPatterns:s});return e.useEffect(()=>{if(!c)return;const l=window.matchMedia("(prefers-reduced-motion: reduce)"),f=y=>{d.setEnabled(!y.matches&&t)};return l.addEventListener("change",f),()=>l.removeEventListener("change",f)},[c,t,d]),r.jsx(Ot.Provider,{value:d,children:i})}function Pr(t=50){if(!ye())return!1;try{return navigator.vibrate(t)}catch{return!1}}function Cr(t){if(!ye())return!1;const n=Qe[t];if(!n)return!1;try{return navigator.vibrate(n)}catch{return!1}}function Ir(){ye()&&navigator.vibrate(0)}function $r(t){return function(c){const s=ve();return r.jsx(t,{...c,haptics:s})}}function Er(){const t=ve();return e.useCallback(()=>{t.trigger("button-press")},[t])}function _r(){const t=ve();return e.useCallback(n=>{t.trigger(n?"toggle-on":"toggle-off")},[t])}function Lr(){const t=ve();return e.useCallback(()=>{t.trigger("selection")},[t])}function Ar(){const t=ve();return e.useCallback(n=>{t.trigger(`notification-${n}`)},[t])}function Hr(){const t=ve();return e.useCallback((n="medium")=>{t.trigger(`impact-${n}`)},[t])}class Vt{constructor(){tt(this,"pattern",[])}vibrate(n){return this.pattern.push(n),this}pause(n){return this.pattern.push(0),this.pattern.push(n),this}pulses(n,c,s){for(let i=0;i<n;i++)this.vibrate(c),i<n-1&&this.pause(s);return this}rampUp(n,c){for(let s=1;s<=n;s++){const i=Math.round(c/n*s);this.vibrate(i),s<n&&this.pause(50)}return this}rampDown(n,c){for(let s=n;s>=1;s--){const i=Math.round(c/n*s);this.vibrate(i),s>1&&this.pause(50)}return this}build(){return[...this.pattern]}execute(){return ye()?navigator.vibrate(this.pattern):!1}}function Yr(){return new Vt}const Le={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ie=["xs","sm","md","lg","xl","2xl"];function Ve(t,n){return t>=n["2xl"]?"2xl":t>=n.xl?"xl":t>=n.lg?"lg":t>=n.md?"md":t>=n.sm?"sm":"xs"}function bt(t){return t==="xs"||t==="sm"?"mobile":t==="md"?"tablet":"desktop"}function mt(t,n){return t>=n?"landscape":"portrait"}function Ke(){return typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0}function ge(t){return Ie.indexOf(t)}function Br(t,n){let c=null;return(...s)=>{c&&clearTimeout(c),c=setTimeout(()=>t(...s),n)}}const Kt=e.createContext(null);function Fr(){const t=e.useContext(Kt);if(!t)throw new Error("useBreakpointContext must be used within a NiceBreakpointProvider");return t}function Te(t={}){const{breakpoints:n,debounceDelay:c=100,ssrDefaultWidth:s=1024}=t,i=e.useMemo(()=>({...Le,...n}),[n]),[a,d]=e.useState(()=>{const u=typeof window<"u"?window.innerWidth:s,p=typeof window<"u"?window.innerHeight:768,N=Ve(u,i),I=bt(N),S=mt(u,p);return{width:u,height:p,breakpoint:N,deviceType:I,orientation:S,isMobile:I==="mobile",isTablet:I==="tablet",isDesktop:I==="desktop",isPortrait:S==="portrait",isLandscape:S==="landscape",isTouchDevice:Ke(),pixelRatio:typeof window<"u"?window.devicePixelRatio:1}});e.useEffect(()=>{if(typeof window>"u")return;const u=()=>{const N=window.innerWidth,I=window.innerHeight,S=Ve(N,i),m=bt(S),v=mt(N,I);d({width:N,height:I,breakpoint:S,deviceType:m,orientation:v,isMobile:m==="mobile",isTablet:m==="tablet",isDesktop:m==="desktop",isPortrait:v==="portrait",isLandscape:v==="landscape",isTouchDevice:Ke(),pixelRatio:window.devicePixelRatio})},p=Br(u,c);return u(),window.addEventListener("resize",p),window.addEventListener("orientationchange",u),()=>{window.removeEventListener("resize",p),window.removeEventListener("orientationchange",u)}},[i,c]);const l=e.useCallback(u=>a.breakpoint===u,[a.breakpoint]),f=e.useCallback(u=>{const p=ge(a.breakpoint),N=ge(u);return p>=N},[a.breakpoint]),y=e.useCallback(u=>{const p=ge(a.breakpoint),N=ge(u);return p<N},[a.breakpoint]),w=e.useCallback((u,p)=>{const N=ge(a.breakpoint),I=ge(u),S=ge(p);return N>=I&&N<=S},[a.breakpoint]),C=e.useCallback((u,p)=>{const N=ge(a.breakpoint);for(let I=N;I>=0;I--){const S=Ie[I];if(u[S]!==void 0)return u[S]}return u.base??p},[a.breakpoint]),D=e.useCallback((u,p="min")=>{const N=i[u],I=ge(u),S=Ie[I+1],m=S?i[S]-1:null;return p==="min"?`(min-width: ${N}px)`:p==="max"&&m?`(max-width: ${m}px)`:p==="only"?m?`(min-width: ${N}px) and (max-width: ${m}px)`:`(min-width: ${N}px)`:`(min-width: ${N}px)`},[i]);return{...a,is:l,isAbove:f,isBelow:y,isBetween:w,getResponsive:C,mediaQuery:D}}function Ut(t){const[n,c]=e.useState(()=>typeof window>"u"?!1:window.matchMedia(t).matches);return e.useEffect(()=>{if(typeof window>"u")return;const s=window.matchMedia(t);c(s.matches);const i=a=>c(a.matches);return s.addEventListener("change",i),()=>s.removeEventListener("change",i)},[t]),n}function zr({breakpoints:t,debounceDelay:n=100,children:c}){const s=Te({breakpoints:t,debounceDelay:n});return r.jsx(Kt.Provider,{value:s,children:c})}function Or({on:t,above:n,below:c,device:s,orientation:i,children:a,fallback:d=null}){const l=Te();let f=!0;return t!==void 0?f=l.is(t):n!==void 0?f=l.isAbove(n):c!==void 0&&(f=l.isBelow(c)),s!==void 0&&(f=f&&l.deviceType===s),i!==void 0&&(f=f&&l.orientation===i),f?r.jsx(r.Fragment,{children:a}):r.jsx(r.Fragment,{children:d})}function Vr({on:t,above:n,below:c,device:s,orientation:i,children:a}){const d=Te();let l=!1;return t!==void 0?l=d.is(t):n!==void 0?l=d.isAbove(n):c!==void 0&&(l=d.isBelow(c)),s!==void 0&&(l=l||d.deviceType===s),i!==void 0&&(l=l||d.orientation===i),l?null:r.jsx(r.Fragment,{children:a})}function Kr(t,n="min",c=Le){const s=c[t],i=ge(t),a=Ie[i+1],d=a?c[a]-1:null;return n==="min"?`@media (min-width: ${s}px)`:n==="max"&&d?`@media (max-width: ${d}px)`:n==="only"?d?`@media (min-width: ${s}px) and (max-width: ${d}px)`:`@media (min-width: ${s}px)`:`@media (min-width: ${s}px)`}function Ur(t){return t}function Xt(t=Le){return typeof window>"u"?null:Ve(window.innerWidth,t)}function Xr(){if(typeof window>"u")return!1;const t=Xt();return t==="xs"||t==="sm"}function Gr(){return Ke()}const Wr={sm:"nice-touch-btn--sm",md:"nice-touch-btn--md",lg:"nice-touch-btn--lg",xl:"nice-touch-btn--xl"},qr={primary:"nice-touch-btn--primary",secondary:"nice-touch-btn--secondary",outline:"nice-touch-btn--outline",ghost:"nice-touch-btn--ghost",danger:"nice-touch-btn--danger",success:"nice-touch-btn--success",warning:"nice-touch-btn--warning"},Jr={rounded:"nice-touch-btn--rounded",pill:"nice-touch-btn--pill",square:"nice-touch-btn--square",circle:"nice-touch-btn--circle"},Ze=e.forwardRef(function({variant:n="primary",size:c="md",shape:s="rounded",fullWidth:i=!1,loading:a=!1,leftIcon:d,rightIcon:l,iconOnly:f=!1,haptic:y=!0,hapticIntensity:w="light",ripple:C=!0,active:D=!1,disabled:u,className:p="",onClick:N,onPointerDown:I,children:S,...m},v){const[P,Q]=e.useState(!1),[F,Y]=e.useState(null),$=e.useRef(null),j=e.useCallback(z=>{$.current=z,typeof v=="function"?v(z):v&&(v.current=z)},[v]),k=e.useCallback(()=>{if(!y||typeof navigator>"u"||!("vibrate"in navigator))return;const z={light:10,medium:20,heavy:40};try{navigator.vibrate(z[w]||10)}catch{}},[y,w]),B=e.useCallback(z=>{if(!(u||a)){if(Q(!0),C&&$.current){const K=$.current.getBoundingClientRect();Y({x:z.clientX-K.left,y:z.clientY-K.top}),setTimeout(()=>Y(null),600)}k(),I==null||I(z)}},[u,a,C,k,I]),J=e.useCallback(()=>{Q(!1)},[]),W=e.useCallback(()=>{Q(!1)},[]),Z=e.useCallback(z=>{u||a||N==null||N(z)},[u,a,N]),U=["nice-touch-btn",qr[n],Wr[c],Jr[s],i?"nice-touch-btn--full-width":"",a?"nice-touch-btn--loading":"",f?"nice-touch-btn--icon-only":"",P?"nice-touch-btn--pressed":"",D?"nice-touch-btn--active":"",p].filter(Boolean).join(" ");return r.jsxs("button",{ref:j,type:"button",className:U,disabled:u||a,onClick:Z,onPointerDown:B,onPointerUp:J,onPointerLeave:W,onPointerCancel:W,...m,children:[C&&F&&r.jsx("span",{className:"nice-touch-btn-ripple",style:{left:F.x,top:F.y}}),a&&r.jsx("span",{className:"nice-touch-btn-spinner","aria-hidden":"true",children:r.jsx("span",{className:"nice-touch-btn-spinner-ring",children:r.jsx(Pe,{})})}),r.jsxs("span",{className:"nice-touch-btn-content",style:{opacity:a?0:1},children:[d&&r.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--left",children:d}),!f&&S&&r.jsx("span",{className:"nice-touch-btn-text",children:S}),l&&r.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--right",children:l})]})]})}),Qr=e.forwardRef(function({icon:n,...c},s){return r.jsx(Ze,{ref:s,iconOnly:!0,leftIcon:n,...c})}),Zr=e.forwardRef(function({position:n="bottom-right",mini:c=!1,className:s="",...i},a){const d=`nice-fab--${n}`;return r.jsx(Ze,{ref:a,shape:"circle",size:c?"md":"xl",className:`nice-fab ${d} ${s}`,...i})});function Gt(t){const{min:n,max:c,step:s,value:i,defaultValue:a=n,onChange:d,onChangeCommitted:l}=t,[f,y]=e.useState(a),w=i??f,C=Array.isArray(w),D=e.useCallback(m=>Math.min(c,Math.max(n,m)),[n,c]),u=e.useCallback(m=>{const v=Math.round((m-n)/s)*s+n;return D(v)},[n,s,D]),p=e.useMemo(()=>{const m=c-n;if(C){const[v,P]=w;return[(v-n)/m*100,(P-n)/m*100]}return(w-n)/m*100},[w,n,c,C]),N=e.useCallback(m=>{if(Array.isArray(m)){const[v,P]=m,Q=[u(v),u(P)];Q[0]>Q[1]&&([Q[0],Q[1]]=[Q[1],Q[0]]),y(Q),d==null||d(Q)}else{const v=u(m);y(v),d==null||d(v)}},[u,d]),I=e.useCallback((m,v)=>{const P=c-n,Q=m/100*P+n;if(C&&typeof v=="number"){const Y=[...w];Y[v]=u(Q),N(Y)}else N(Q)},[c,n,C,w,u,N]),S=e.useCallback(()=>{l==null||l(w)},[w,l]);return{value:w,isRange:C,percentage:p,setValue:N,setValueByPercentage:I,commitValue:S,clamp:D,snap:u}}const ec=e.forwardRef(function({value:n,defaultValue:c,min:s=0,max:i=100,step:a=1,orientation:d="horizontal",disabled:l=!1,marks:f=!1,markStep:y,labelDisplay:w="auto",formatLabel:C=k=>String(k),showRange:D=!1,trackColor:u,fillColor:p,thumbSize:N=44,trackHeight:I=8,haptic:S=!0,snapToMarks:m=!1,onChange:v,onChangeCommitted:P,className:Q="","aria-label":F,"aria-labelledby":Y,...$},j){const k=Gt({min:s,max:i,step:a,value:n,defaultValue:c,onChange:v,onChangeCommitted:P}),B=e.useRef(null),[J,W]=e.useState(!1),[Z,U]=e.useState(null),[z,K]=e.useState(w==="on"),X=e.useRef(k.value),re=e.useMemo(()=>{if(!f)return[];if(Array.isArray(f))return f;const x=[],M=y??a;for(let o=s;o<=i;o+=M)x.push({value:o});return x},[f,y,a,s,i]),ne=e.useCallback(x=>{if(!B.current)return 0;const M=B.current.getBoundingClientRect();if(d==="horizontal"){const o=x.clientX-M.left;return Math.max(0,Math.min(100,o/M.width*100))}else{const o=x.clientY-M.top;return Math.max(0,Math.min(100,100-o/M.height*100))}},[d]),V=e.useCallback(()=>{if(!(!S||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[S]),_=e.useCallback(x=>{if(!k.isRange)return 0;const[M,o]=k.percentage,b=Math.abs(x-M),R=Math.abs(x-o);return b<=R?0:1},[k.isRange,k.percentage]),E=e.useCallback((x,M)=>{if(l)return;x.preventDefault(),x.currentTarget.setPointerCapture(x.pointerId);const o=ne(x),b=M??_(o);if(W(!0),U(b),K(w!=="off"),m&&re.length>0){const R=re.reduce((T,ee)=>{const O=(T.value-s)/(i-s)*100,ie=(ee.value-s)/(i-s)*100;return Math.abs(ie-o)<Math.abs(O-o)?ee:T});k.setValue(k.isRange?b===0?[R.value,k.value[1]]:[k.value[0],R.value]:R.value)}else k.setValueByPercentage(o,b);V()},[l,ne,_,w,m,re,s,i,k,V]),H=e.useCallback(x=>{var o;if(!J||l||Z===null)return;const M=ne(x);if(m&&re.length>0){const b=re.reduce((T,ee)=>{const O=(T.value-s)/(i-s)*100,ie=(ee.value-s)/(i-s)*100;return Math.abs(ie-M)<Math.abs(O-M)?ee:T}),R=k.isRange?Z===0?[b.value,k.value[1]]:[k.value[0],b.value]:b.value;JSON.stringify(R)!==JSON.stringify(X.current)&&(k.setValue(R),X.current=R,V())}else{k.setValueByPercentage(M,Z);const b=k.isRange?k.value[Z]:k.value,R=k.isRange?(o=X.current)==null?void 0:o[Z]:X.current;Math.abs(b-R)>=a&&(V(),X.current=k.value)}},[J,l,Z,ne,m,re,s,i,k,a,V]),g=e.useCallback(x=>{J&&(x.currentTarget.releasePointerCapture(x.pointerId),W(!1),U(null),w==="auto"&&K(!1),k.commitValue())},[J,w,k]),A=e.useCallback((x,M)=>{if(l)return;let o=k.isRange?k.value[M]:k.value;switch(x.key){case"ArrowRight":case"ArrowUp":x.preventDefault(),o=Math.min(i,o+a);break;case"ArrowLeft":case"ArrowDown":x.preventDefault(),o=Math.max(s,o-a);break;case"Home":x.preventDefault(),o=s;break;case"End":x.preventDefault(),o=i;break;case"PageUp":x.preventDefault(),o=Math.min(i,o+a*10);break;case"PageDown":x.preventDefault(),o=Math.max(s,o-a*10);break;default:return}if(k.isRange){const b=k.value;k.setValue(M===0?[o,b[1]]:[b[0],o])}else k.setValue(o);V(),k.commitValue()},[l,k,i,s,a,V]),h=e.useMemo(()=>{if(k.isRange){const[M,o]=k.percentage;return d==="horizontal"?{left:`${M}%`,width:`${o-M}%`}:{bottom:`${M}%`,height:`${o-M}%`}}const x=k.percentage;return d==="horizontal"?{left:0,width:`${x}%`}:{bottom:0,height:`${x}%`}},[k.isRange,k.percentage,d]),L=(x,M)=>{const o=k.isRange?k.value[x]:k.value,b=d==="horizontal"?{left:`${M}%`}:{bottom:`${M}%`};return r.jsx("div",{className:`nice-touch-slider-thumb ${Z===x?"nice-touch-slider-thumb--active":""}`,style:{...b,width:N,height:N},role:"slider",tabIndex:l?-1:0,"aria-label":F,"aria-labelledby":Y,"aria-valuenow":o,"aria-valuemin":s,"aria-valuemax":i,"aria-disabled":l,onKeyDown:R=>A(R,x),children:z&&r.jsx("span",{className:"nice-touch-slider-label",children:C(o)})},x)};return r.jsxs("div",{ref:j,className:`
20
+ `,disabled:t.isDisabled,onClick:c,"aria-label":t.date.toLocaleDateString(),"aria-pressed":t.isSelected,children:[r.jsx("span",{className:"nice-calendar-day-number",children:t.dayOfMonth}),t.events&&t.events.length>0&&!n&&r.jsx("span",{className:"nice-calendar-day-dots",children:t.events.slice(0,3).map((i,a)=>r.jsx("span",{className:"nice-calendar-day-dot",style:i.color?{backgroundColor:i.color}:void 0},i.id))})]}),Qe=e.forwardRef(function({defaultDate:n,viewDate:c,selectedDate:s,selectedDates:i,selectedRange:a,selectionMode:d="single",minDate:l,maxDate:f,disabledDates:y=[],disableWeekends:w=!1,events:C=[],weekStartDay:P=0,locale:u="en-US",showWeekNumbers:p=!1,showAdjacentMonths:N=!0,enableSwipe:I=!0,onChange:S,onViewChange:m,onMonthChange:v,renderDay:D,renderHeader:J,showTodayButton:F=!0,todayLabel:Y,compact:$=!1,className:T="",...k},O){const{t:q}=oe.useNiceTranslation(),W=Y??q("mobileCalendar.today","Today"),Z=e.useMemo(()=>y,[y,w]),X=Ft({defaultDate:n,selectedDate:s,selectedDates:i,selectedRange:a,selectionMode:d,minDate:l,maxDate:f,disabledDates:Z,events:C,weekStartDay:P,onChange:S}),[V,U]=e.useState(c??n??new Date),G=e.useRef(0),re=e.useRef(0);e.useEffect(()=>{c&&U(c)},[c]);const ne=e.useCallback(()=>{const j=Ee(V,-1);U(j),X.goToDate(j),v==null||v(j),m==null||m(j,X.view)},[V,X,v,m]),K=e.useCallback(()=>{const j=Ee(V,1);U(j),X.goToDate(j),v==null||v(j),m==null||m(j,X.view)},[V,X,v,m]),_=e.useCallback(()=>{const j=new Date;U(j),X.goToDate(j),v==null||v(j)},[X,v]),E=e.useRef(null),H=e.useRef(!1),g=e.useRef(!1),A=e.useCallback(j=>{!I||E.current!==null||j.pointerType==="mouse"&&j.button!==0||(E.current=j.pointerId,H.current=!1,G.current=j.clientX,re.current=j.clientX)},[I]),h=e.useCallback(j=>{var te,z;j.pointerId===E.current&&(re.current=j.clientX,!H.current&&Math.abs(j.clientX-G.current)>10&&(H.current=!0,(z=(te=j.currentTarget).setPointerCapture)==null||z.call(te,j.pointerId)))},[]),L=e.useCallback(j=>{if(j.pointerId!==E.current||(E.current=null,j.type==="pointercancel"))return;const te=G.current-re.current;Math.abs(te)>50&&(g.current=!0,te>0?K():ne())},[K,ne]),x=e.useCallback(j=>{j.pointerId===E.current&&!H.current&&(E.current=null)},[]),M=e.useCallback(j=>{w&&(j.getDay()===0||j.getDay()===6)||X.selectDate(j)},[X,w]),o=e.useMemo(()=>{const j=[...fr];return[...j.slice(P),...j.slice(0,P)]},[P]),b=X.getDaysInMonth(),R={viewDate:V,selectedDate:X.selectedDate,selectedDates:X.selectedDates,selectedRange:X.selectedRange,selectionMode:d,view:X.view,selectDate:M,setView:X.setView,goToDate:X.goToDate};return r.jsx(Yt.Provider,{value:R,children:r.jsxs("div",{ref:O,className:`nice-mobile-calendar ${$?"nice-mobile-calendar--compact":""} ${T}`,onPointerDown:A,onPointerMove:h,onPointerUp:L,onPointerCancel:L,onPointerLeave:x,onClickCapture:j=>{g.current&&(g.current=!1,j.stopPropagation(),j.preventDefault())},...k,children:[J?J(V,X.view,{prev:ne,next:K,setView:X.setView}):r.jsxs("div",{className:"nice-calendar-header",children:[r.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:ne,"aria-label":q("mobileCalendar.previousMonth","Previous month"),children:r.jsx(pr,{})}),r.jsxs("button",{type:"button",className:"nice-calendar-title-btn",onClick:()=>X.setView(X.view==="day"?"month":"day"),children:[r.jsx("span",{className:"nice-calendar-month",children:Bt[V.getMonth()]}),r.jsx("span",{className:"nice-calendar-year",children:V.getFullYear()})]}),r.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:K,"aria-label":q("mobileCalendar.nextMonth","Next month"),children:r.jsx(gr,{})})]}),X.view==="day"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:`nice-calendar-weekdays ${p?"nice-calendar-weekdays--with-numbers":""}`,children:[p&&r.jsx("div",{className:"nice-calendar-weekday nice-calendar-weekday--number",children:"W"}),o.map((j,te)=>r.jsx("div",{className:"nice-calendar-weekday",children:$?j.charAt(0):j},j))]}),r.jsx("div",{className:`nice-calendar-grid ${p?"nice-calendar-grid--with-numbers":""}`,children:b.map((j,te)=>{const z=p&&te%7===0;return r.jsxs(e.Fragment,{children:[z&&r.jsx("div",{className:"nice-calendar-week-number",children:mr(j.date)}),!j.isCurrentMonth&&!N?r.jsx("div",{className:"nice-calendar-day nice-calendar-day--empty"}):r.jsx(vr,{cell:{...j,isDisabled:j.isDisabled||w&&j.isWeekend},compact:$,onClick:()=>M(j.date),renderDay:D})]},j.date.toISOString())})})]}),X.view==="month"&&r.jsx("div",{className:"nice-calendar-months",children:X.getMonths().map(({month:j,label:te})=>r.jsx("button",{type:"button",className:`nice-calendar-month-btn ${j===V.getMonth()?"nice-calendar-month-btn--selected":""}`,onClick:()=>{const z=new Date(V.getFullYear(),j,1);U(z),X.goToDate(z),X.setView("day")},children:$?hr[j]:te},j))}),X.view==="year"&&r.jsx("div",{className:"nice-calendar-years",children:X.getYears().map(j=>r.jsx("button",{type:"button",className:`nice-calendar-year-btn ${j===V.getFullYear()?"nice-calendar-year-btn--selected":""}`,onClick:()=>{const te=new Date(j,V.getMonth(),1);U(te),X.goToDate(te),X.setView("month")},children:j},j))}),F&&X.view==="day"&&r.jsx("div",{className:"nice-calendar-footer",children:r.jsx("button",{type:"button",className:"nice-calendar-today-btn",onClick:_,children:W})})]})})}),xr=e.forwardRef(function(n,c){return r.jsx(Qe,{ref:c,selectionMode:"range",...n})}),yr=e.forwardRef(function(n,c){return r.jsx(Qe,{ref:c,selectionMode:"multiple",...n})}),zt=e.createContext(null);function wr(){const t=e.useContext(zt);if(!t)throw new Error("useGesturesContext must be used within a NiceGestures");return t}function Te(t,n){const c=n.x-t.x,s=n.y-t.y;return Math.sqrt(c*c+s*s)}function bt(t,n){return Math.atan2(n.y-t.y,n.x-t.x)*(180/Math.PI)}function ze(t,n){return{x:(t.x+n.x)/2,y:(t.y+n.y)/2}}function Oe(t){const n=Math.abs(t.x),c=Math.abs(t.y);return n<5&&c<5?null:n>c?t.x>0?"right":"left":t.y>0?"down":"up"}function Ot(t={}){const{enablePinch:n=!0,enableRotation:c=!0,enablePan:s=!0,enableSwipe:i=!0,enableTap:a=!0,enableDoubleTap:d=!0,enableLongPress:l=!0,minScale:f=.5,maxScale:y=4,panThreshold:w=5,swipeVelocityThreshold:C=.5,swipeDistanceThreshold:P=50,longPressDuration:u=500,doubleTapDelay:p=300,onPinchStart:N,onPinch:I,onPinchEnd:S,onRotateStart:m,onRotate:v,onRotateEnd:D,onPanStart:J,onPan:F,onPanEnd:Y,onSwipe:$,onTap:T,onDoubleTap:k,onLongPress:O}=t,[q,W]=e.useState({scale:1,rotation:0,translation:{x:0,y:0},velocity:{x:0,y:0},center:{x:0,y:0},isActive:!1}),Z=e.useRef(new Map),X=e.useRef(0),V=e.useRef(0),U=e.useRef(1),G=e.useRef(0),re=e.useRef({x:0,y:0}),ne=e.useRef(0),K=e.useRef({x:0,y:0}),_=e.useRef(0),E=e.useRef({x:0,y:0}),H=e.useRef(0),g=e.useRef(null),A=e.useRef(!1),h=e.useRef(!1),L=e.useRef(!1),x=e.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null)},[]),M=e.useCallback(()=>{W({scale:1,rotation:0,translation:{x:0,y:0},velocity:{x:0,y:0},center:{x:0,y:0},isActive:!1}),U.current=1,G.current=0,re.current={x:0,y:0}},[]),o=e.useCallback(z=>{z.currentTarget.setPointerCapture(z.pointerId),Z.current.set(z.pointerId,{x:z.clientX,y:z.clientY});const ie=Z.current.size;if(ie===1)_.current=Date.now(),E.current={x:z.clientX,y:z.clientY},K.current={x:z.clientX,y:z.clientY},ne.current=Date.now(),l&&(x(),g.current=setTimeout(()=>{O==null||O({position:{x:z.clientX,y:z.clientY},duration:u,target:z.target})},u));else if(ie===2){x();const[ae,se]=Array.from(Z.current.values());X.current=Te(ae,se),V.current=bt(ae,se),U.current=q.scale,G.current=q.rotation,n&&!h.current&&(h.current=!0,N==null||N()),c&&!L.current&&(L.current=!0,m==null||m())}W(ae=>({...ae,isActive:!0}))},[q.scale,q.rotation,l,n,c,u,O,N,m,x]),b=e.useCallback(z=>{if(!Z.current.has(z.pointerId))return;Z.current.set(z.pointerId,{x:z.clientX,y:z.clientY});const ie=Z.current.size,ae=Date.now();if(ie===1){const se={x:z.clientX,y:z.clientY},ue={x:se.x-K.current.x,y:se.y-K.current.y},he={x:se.x-E.current.x,y:se.y-E.current.y};if(Te(E.current,se)>w&&(x(),s)){A.current||(A.current=!0,J==null||J());const Q=ae-ne.current,ee=Q>0?{x:ue.x/Q*1e3,y:ue.y/Q*1e3}:{x:0,y:0},B={x:re.current.x+he.x,y:re.current.y+he.y};W(ce=>({...ce,translation:B,velocity:ee,center:se})),F==null||F({translation:B,delta:ue,velocity:ee,center:se,direction:Oe(ue)})}K.current=se,ne.current=ae}else if(ie===2){const[se,ue]=Array.from(Z.current.values()),he=Te(se,ue),pe=bt(se,ue),Q=ze(se,ue);if(n){const ee=Math.max(f,Math.min(y,U.current*(he/X.current))),B=ee-q.scale;W(ce=>({...ce,scale:ee,center:Q})),I==null||I({scale:ee,deltaScale:B,center:Q,distance:he,initialDistance:X.current})}if(c){let ee=pe-V.current;ee>180&&(ee-=360),ee<-180&&(ee+=360);const B=G.current+ee,ce=B-q.rotation;W(le=>({...le,rotation:B,center:Q})),v==null||v({rotation:B,deltaRotation:ce,center:Q})}}},[s,n,c,f,y,w,q.scale,q.rotation,F,J,I,v,x]),R=e.useCallback(z=>{z.currentTarget.releasePointerCapture(z.pointerId),x();const ie=Z.current.size,ae=Date.now();if(ie===1){const se={x:z.clientX,y:z.clientY},ue=Te(E.current,se),he=ae-_.current;if(ue<w)d&&ae-H.current<p?(k==null||k({position:se,target:z.target}),H.current=0):a&&(setTimeout(()=>{H.current===ae&&(T==null||T({position:se,target:z.target}))},p),H.current=ae);else{const pe=ue/he*1e3;if(i&&pe>C&&ue>P){const Q={x:se.x-E.current.x,y:se.y-E.current.y},ee=Oe(Q);ee&&($==null||$({direction:ee,velocity:pe,distance:ue,duration:he}))}if(A.current){const Q=ae-ne.current,ee={x:se.x-K.current.x,y:se.y-K.current.y},B=Q>0?{x:ee.x/Q*1e3,y:ee.y/Q*1e3}:{x:0,y:0};Y==null||Y({translation:q.translation,delta:ee,velocity:B,center:se,direction:Oe(ee)})}}re.current=q.translation}if(ie===2){if(h.current){const[se,ue]=Array.from(Z.current.values()),he=ze(se,ue);S==null||S({scale:q.scale,deltaScale:0,center:he,distance:Te(se,ue),initialDistance:X.current})}if(L.current){const[se,ue]=Array.from(Z.current.values()),he=ze(se,ue);D==null||D({rotation:q.rotation,deltaRotation:0,center:he})}}Z.current.delete(z.pointerId),Z.current.size===0&&(A.current=!1,h.current=!1,L.current=!1,W(se=>({...se,isActive:!1})))},[a,d,i,p,w,C,P,q.scale,q.rotation,q.translation,T,k,$,Y,S,D,x]),j=e.useCallback(z=>{x(),Z.current.delete(z.pointerId),Z.current.size===0&&(A.current=!1,h.current=!1,L.current=!1,W(ie=>({...ie,isActive:!1})))},[x]),te=e.useCallback(()=>({onPointerDown:o,onPointerMove:b,onPointerUp:R,onPointerCancel:j,style:{touchAction:"none"}}),[o,b,R,j]);return e.useEffect(()=>()=>{x()},[x]),{bind:te,state:q,reset:M}}const He=e.forwardRef(function({enablePinch:n=!0,enableRotation:c=!0,enablePan:s=!0,enableSwipe:i=!0,enableTap:a=!0,enableDoubleTap:d=!0,enableLongPress:l=!0,minScale:f=.5,maxScale:y=4,applyTransform:w=!1,initialScale:C=1,scale:P,initialRotation:u=0,rotation:p,initialTranslation:N={x:0,y:0},translation:I,onTransformChange:S,onPinchStart:m,onPinch:v,onPinchEnd:D,onRotateStart:J,onRotate:F,onRotateEnd:Y,onPanStart:$,onPan:T,onPanEnd:k,onSwipe:O,onTap:q,onDoubleTap:W,onLongPress:Z,children:X,className:V="",style:U,...G},re){const ne=Ot({enablePinch:n,enableRotation:c,enablePan:s,enableSwipe:i,enableTap:a,enableDoubleTap:d,enableLongPress:l,minScale:f,maxScale:y,onPinchStart:m,onPinch:x=>{v==null||v(x),S==null||S(ne.state)},onPinchEnd:D,onRotateStart:J,onRotate:x=>{F==null||F(x),S==null||S(ne.state)},onRotateEnd:Y,onPanStart:$,onPan:x=>{T==null||T(x),S==null||S(ne.state)},onPanEnd:k,onSwipe:O,onTap:q,onDoubleTap:W,onLongPress:Z}),{bind:K,state:_}=ne,E=K(),H=P??_.scale,g=p??_.rotation,A=I??_.translation,h=w?{transform:`translate(${A.x}px, ${A.y}px) scale(${H}) rotate(${g}deg)`,transformOrigin:`${_.center.x}px ${_.center.y}px`}:{},L={state:{..._,scale:H,rotation:g,translation:A},reset:ne.reset};return r.jsx(zt.Provider,{value:L,children:r.jsx("div",{ref:re,className:`nice-gestures ${_.isActive?"nice-gestures--active":""} ${V}`,style:{...E.style,...U,...h},onPointerDown:E.onPointerDown,onPointerMove:E.onPointerMove,onPointerUp:E.onPointerUp,onPointerCancel:E.onPointerCancel,...G,children:X})})}),Nr=e.forwardRef(function(n,c){return r.jsx(He,{ref:c,enablePinch:!0,enableRotation:!1,enablePan:!1,enableSwipe:!1,enableTap:!1,enableLongPress:!1,applyTransform:!0,...n})}),kr=e.forwardRef(function(n,c){return r.jsx(He,{ref:c,enablePinch:!1,enableRotation:!1,enablePan:!0,enableSwipe:!1,enableTap:!1,enableLongPress:!1,applyTransform:!0,...n})}),jr=e.forwardRef(function(n,c){return r.jsx(He,{ref:c,enablePinch:!1,enableRotation:!1,enablePan:!1,enableSwipe:!0,enableTap:!1,enableLongPress:!1,...n})}),Ze={selection:10,"impact-light":15,"impact-medium":30,"impact-heavy":50,"notification-success":[30,50,30],"notification-warning":[50,30,50,30],"notification-error":[50,50,100],"button-press":20,"toggle-on":[15,30,15],"toggle-off":[15,50],swipe:15,"pull-to-refresh":[10,20,30],keyboard:5},Tr={light:.5,medium:1,heavy:1.5};function ke(){return typeof navigator<"u"&&"vibrate"in navigator}function Mr(t,n){return typeof t=="number"?Math.round(t*n):t.map(c=>Math.round(c*n))}function Rr(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const Vt=e.createContext(null);function Sr(){const t=e.useContext(Vt);if(!t)throw new Error("useHapticsContext must be used within a NiceHapticsProvider");return t}function ye(t={}){const{enabled:n=!0,intensity:c="medium",customPatterns:s={}}=t,i=e.useRef(n),[a,d]=e.useState(n),l=e.useMemo(()=>ke(),[]),f=e.useCallback(p=>{i.current=p,d(p)},[]),y=e.useCallback(()=>Tr[c],[c]),w=e.useCallback((p=50)=>{if(!l||!i.current)return!1;try{const N=Mr(p,y());return navigator.vibrate(N)}catch{return!1}},[l,y]),C=e.useCallback(()=>{l&&navigator.vibrate(0)},[l]),P=e.useCallback(p=>{if(!l||!i.current)return!1;const N=Ze[p];return N?w(N):!1},[l,w]),u=e.useCallback(p=>{if(!l||!i.current)return!1;const N=s[p];return N?w(N):!1},[l,s,w]);return{isSupported:l,isEnabled:a,setEnabled:f,vibrate:w,cancel:C,trigger:P,triggerPattern:u,getIntensityMultiplier:y}}function Pr({enabled:t=!0,intensity:n="medium",respectReducedMotion:c=!0,customPatterns:s={},children:i}){const a=e.useMemo(()=>c&&Rr()?!1:t,[t,c]),d=ye({enabled:a,intensity:n,customPatterns:s});return e.useEffect(()=>{if(!c)return;const l=window.matchMedia("(prefers-reduced-motion: reduce)"),f=y=>{d.setEnabled(!y.matches&&t)};return l.addEventListener("change",f),()=>l.removeEventListener("change",f)},[c,t,d]),r.jsx(Vt.Provider,{value:d,children:i})}function Dr(t=50){if(!ke())return!1;try{return navigator.vibrate(t)}catch{return!1}}function Cr(t){if(!ke())return!1;const n=Ze[t];if(!n)return!1;try{return navigator.vibrate(n)}catch{return!1}}function Ir(){ke()&&navigator.vibrate(0)}function $r(t){return function(c){const s=ye();return r.jsx(t,{...c,haptics:s})}}function Er(){const t=ye();return e.useCallback(()=>{t.trigger("button-press")},[t])}function _r(){const t=ye();return e.useCallback(n=>{t.trigger(n?"toggle-on":"toggle-off")},[t])}function Lr(){const t=ye();return e.useCallback(()=>{t.trigger("selection")},[t])}function Ar(){const t=ye();return e.useCallback(n=>{t.trigger(`notification-${n}`)},[t])}function Hr(){const t=ye();return e.useCallback((n="medium")=>{t.trigger(`impact-${n}`)},[t])}class Kt{constructor(){nt(this,"pattern",[])}vibrate(n){return this.pattern.push(n),this}pause(n){return this.pattern.push(0),this.pattern.push(n),this}pulses(n,c,s){for(let i=0;i<n;i++)this.vibrate(c),i<n-1&&this.pause(s);return this}rampUp(n,c){for(let s=1;s<=n;s++){const i=Math.round(c/n*s);this.vibrate(i),s<n&&this.pause(50)}return this}rampDown(n,c){for(let s=n;s>=1;s--){const i=Math.round(c/n*s);this.vibrate(i),s>1&&this.pause(50)}return this}build(){return[...this.pattern]}execute(){return ke()?navigator.vibrate(this.pattern):!1}}function Yr(){return new Kt}const Ye={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},_e=["xs","sm","md","lg","xl","2xl"];function Ke(t,n){return t>=n["2xl"]?"2xl":t>=n.xl?"xl":t>=n.lg?"lg":t>=n.md?"md":t>=n.sm?"sm":"xs"}function mt(t){return t==="xs"||t==="sm"?"mobile":t==="md"?"tablet":"desktop"}function pt(t,n){return t>=n?"landscape":"portrait"}function Ue(){return typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0}function xe(t){return _e.indexOf(t)}function Br(t,n){let c=null;return(...s)=>{c&&clearTimeout(c),c=setTimeout(()=>t(...s),n)}}const Ut=e.createContext(null);function Fr(){const t=e.useContext(Ut);if(!t)throw new Error("useBreakpointContext must be used within a NiceBreakpointProvider");return t}function Pe(t={}){const{breakpoints:n,debounceDelay:c=100,ssrDefaultWidth:s=1024}=t,i=e.useMemo(()=>({...Ye,...n}),[n]),[a,d]=e.useState(()=>{const u=typeof window<"u"?window.innerWidth:s,p=typeof window<"u"?window.innerHeight:768,N=Ke(u,i),I=mt(N),S=pt(u,p);return{width:u,height:p,breakpoint:N,deviceType:I,orientation:S,isMobile:I==="mobile",isTablet:I==="tablet",isDesktop:I==="desktop",isPortrait:S==="portrait",isLandscape:S==="landscape",isTouchDevice:Ue(),pixelRatio:typeof window<"u"?window.devicePixelRatio:1}});e.useEffect(()=>{if(typeof window>"u")return;const u=()=>{const N=window.innerWidth,I=window.innerHeight,S=Ke(N,i),m=mt(S),v=pt(N,I);d({width:N,height:I,breakpoint:S,deviceType:m,orientation:v,isMobile:m==="mobile",isTablet:m==="tablet",isDesktop:m==="desktop",isPortrait:v==="portrait",isLandscape:v==="landscape",isTouchDevice:Ue(),pixelRatio:window.devicePixelRatio})},p=Br(u,c);return u(),window.addEventListener("resize",p),window.addEventListener("orientationchange",u),()=>{window.removeEventListener("resize",p),window.removeEventListener("orientationchange",u)}},[i,c]);const l=e.useCallback(u=>a.breakpoint===u,[a.breakpoint]),f=e.useCallback(u=>{const p=xe(a.breakpoint),N=xe(u);return p>=N},[a.breakpoint]),y=e.useCallback(u=>{const p=xe(a.breakpoint),N=xe(u);return p<N},[a.breakpoint]),w=e.useCallback((u,p)=>{const N=xe(a.breakpoint),I=xe(u),S=xe(p);return N>=I&&N<=S},[a.breakpoint]),C=e.useCallback((u,p)=>{const N=xe(a.breakpoint);for(let I=N;I>=0;I--){const S=_e[I];if(u[S]!==void 0)return u[S]}return u.base??p},[a.breakpoint]),P=e.useCallback((u,p="min")=>{const N=i[u],I=xe(u),S=_e[I+1],m=S?i[S]-1:null;return p==="min"?`(min-width: ${N}px)`:p==="max"&&m?`(max-width: ${m}px)`:p==="only"?m?`(min-width: ${N}px) and (max-width: ${m}px)`:`(min-width: ${N}px)`:`(min-width: ${N}px)`},[i]);return{...a,is:l,isAbove:f,isBelow:y,isBetween:w,getResponsive:C,mediaQuery:P}}function Xt(t){const[n,c]=e.useState(()=>typeof window>"u"?!1:window.matchMedia(t).matches);return e.useEffect(()=>{if(typeof window>"u")return;const s=window.matchMedia(t);c(s.matches);const i=a=>c(a.matches);return s.addEventListener("change",i),()=>s.removeEventListener("change",i)},[t]),n}function zr({breakpoints:t,debounceDelay:n=100,children:c}){const s=Pe({breakpoints:t,debounceDelay:n});return r.jsx(Ut.Provider,{value:s,children:c})}function Or({on:t,above:n,below:c,device:s,orientation:i,children:a,fallback:d=null}){const l=Pe();let f=!0;return t!==void 0?f=l.is(t):n!==void 0?f=l.isAbove(n):c!==void 0&&(f=l.isBelow(c)),s!==void 0&&(f=f&&l.deviceType===s),i!==void 0&&(f=f&&l.orientation===i),f?r.jsx(r.Fragment,{children:a}):r.jsx(r.Fragment,{children:d})}function Vr({on:t,above:n,below:c,device:s,orientation:i,children:a}){const d=Pe();let l=!1;return t!==void 0?l=d.is(t):n!==void 0?l=d.isAbove(n):c!==void 0&&(l=d.isBelow(c)),s!==void 0&&(l=l||d.deviceType===s),i!==void 0&&(l=l||d.orientation===i),l?null:r.jsx(r.Fragment,{children:a})}function Kr(t,n="min",c=Ye){const s=c[t],i=xe(t),a=_e[i+1],d=a?c[a]-1:null;return n==="min"?`@media (min-width: ${s}px)`:n==="max"&&d?`@media (max-width: ${d}px)`:n==="only"?d?`@media (min-width: ${s}px) and (max-width: ${d}px)`:`@media (min-width: ${s}px)`:`@media (min-width: ${s}px)`}function Ur(t){return t}function Gt(t=Ye){return typeof window>"u"?null:Ke(window.innerWidth,t)}function Xr(){if(typeof window>"u")return!1;const t=Gt();return t==="xs"||t==="sm"}function Gr(){return Ue()}const Wr={sm:"nice-touch-btn--sm",md:"nice-touch-btn--md",lg:"nice-touch-btn--lg",xl:"nice-touch-btn--xl"},qr={primary:"nice-touch-btn--primary",secondary:"nice-touch-btn--secondary",outline:"nice-touch-btn--outline",ghost:"nice-touch-btn--ghost",danger:"nice-touch-btn--danger",success:"nice-touch-btn--success",warning:"nice-touch-btn--warning"},Jr={rounded:"nice-touch-btn--rounded",pill:"nice-touch-btn--pill",square:"nice-touch-btn--square",circle:"nice-touch-btn--circle"},et=e.forwardRef(function({variant:n="primary",size:c="md",shape:s="rounded",fullWidth:i=!1,loading:a=!1,leftIcon:d,rightIcon:l,iconOnly:f=!1,haptic:y=!0,hapticIntensity:w="light",ripple:C=!0,active:P=!1,disabled:u,className:p="",onClick:N,onPointerDown:I,children:S,...m},v){const[D,J]=e.useState(!1),[F,Y]=e.useState(null),$=e.useRef(null),T=e.useCallback(V=>{$.current=V,typeof v=="function"?v(V):v&&(v.current=V)},[v]),k=e.useCallback(()=>{if(!y||typeof navigator>"u"||!("vibrate"in navigator))return;const V={light:10,medium:20,heavy:40};try{navigator.vibrate(V[w]||10)}catch{}},[y,w]),O=e.useCallback(V=>{if(!(u||a)){if(J(!0),C&&$.current){const U=$.current.getBoundingClientRect();Y({x:V.clientX-U.left,y:V.clientY-U.top}),setTimeout(()=>Y(null),600)}k(),I==null||I(V)}},[u,a,C,k,I]),q=e.useCallback(()=>{J(!1)},[]),W=e.useCallback(()=>{J(!1)},[]),Z=e.useCallback(V=>{u||a||N==null||N(V)},[u,a,N]),X=["nice-touch-btn",qr[n],Wr[c],Jr[s],i?"nice-touch-btn--full-width":"",a?"nice-touch-btn--loading":"",f?"nice-touch-btn--icon-only":"",D?"nice-touch-btn--pressed":"",P?"nice-touch-btn--active":"",p].filter(Boolean).join(" ");return r.jsxs("button",{ref:T,type:"button",className:X,disabled:u||a,onClick:Z,onPointerDown:O,onPointerUp:q,onPointerLeave:W,onPointerCancel:W,...m,children:[C&&F&&r.jsx("span",{className:"nice-touch-btn-ripple",style:{left:F.x,top:F.y}}),a&&r.jsx("span",{className:"nice-touch-btn-spinner","aria-hidden":"true",children:r.jsx("span",{className:"nice-touch-btn-spinner-ring",children:r.jsx($e,{})})}),r.jsxs("span",{className:"nice-touch-btn-content",style:{opacity:a?0:1},children:[d&&r.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--left",children:d}),!f&&S&&r.jsx("span",{className:"nice-touch-btn-text",children:S}),l&&r.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--right",children:l})]})]})}),Qr=e.forwardRef(function({icon:n,...c},s){return r.jsx(et,{ref:s,iconOnly:!0,leftIcon:n,...c})}),Zr=e.forwardRef(function({position:n="bottom-right",mini:c=!1,className:s="",...i},a){const d=`nice-fab--${n}`;return r.jsx(et,{ref:a,shape:"circle",size:c?"md":"xl",className:`nice-fab ${d} ${s}`,...i})});function Wt(t){const{min:n,max:c,step:s,value:i,defaultValue:a=n,onChange:d,onChangeCommitted:l}=t,[f,y]=e.useState(a),w=i??f,C=Array.isArray(w),P=e.useCallback(m=>Math.min(c,Math.max(n,m)),[n,c]),u=e.useCallback(m=>{const v=Math.round((m-n)/s)*s+n;return P(v)},[n,s,P]),p=e.useMemo(()=>{const m=c-n;if(C){const[v,D]=w;return[(v-n)/m*100,(D-n)/m*100]}return(w-n)/m*100},[w,n,c,C]),N=e.useCallback(m=>{if(Array.isArray(m)){const[v,D]=m,J=[u(v),u(D)];J[0]>J[1]&&([J[0],J[1]]=[J[1],J[0]]),y(J),d==null||d(J)}else{const v=u(m);y(v),d==null||d(v)}},[u,d]),I=e.useCallback((m,v)=>{const D=c-n,J=m/100*D+n;if(C&&typeof v=="number"){const Y=[...w];Y[v]=u(J),N(Y)}else N(J)},[c,n,C,w,u,N]),S=e.useCallback(()=>{l==null||l(w)},[w,l]);return{value:w,isRange:C,percentage:p,setValue:N,setValueByPercentage:I,commitValue:S,clamp:P,snap:u}}const ec=e.forwardRef(function({value:n,defaultValue:c,min:s=0,max:i=100,step:a=1,orientation:d="horizontal",disabled:l=!1,marks:f=!1,markStep:y,labelDisplay:w="auto",formatLabel:C=k=>String(k),showRange:P=!1,trackColor:u,fillColor:p,thumbSize:N=44,trackHeight:I=8,haptic:S=!0,snapToMarks:m=!1,onChange:v,onChangeCommitted:D,className:J="","aria-label":F,"aria-labelledby":Y,...$},T){const k=Wt({min:s,max:i,step:a,value:n,defaultValue:c,onChange:v,onChangeCommitted:D}),O=e.useRef(null),[q,W]=e.useState(!1),[Z,X]=e.useState(null),[V,U]=e.useState(w==="on"),G=e.useRef(k.value),re=e.useMemo(()=>{if(!f)return[];if(Array.isArray(f))return f;const x=[],M=y??a;for(let o=s;o<=i;o+=M)x.push({value:o});return x},[f,y,a,s,i]),ne=e.useCallback(x=>{if(!O.current)return 0;const M=O.current.getBoundingClientRect();if(d==="horizontal"){const o=x.clientX-M.left;return Math.max(0,Math.min(100,o/M.width*100))}else{const o=x.clientY-M.top;return Math.max(0,Math.min(100,100-o/M.height*100))}},[d]),K=e.useCallback(()=>{if(!(!S||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[S]),_=e.useCallback(x=>{if(!k.isRange)return 0;const[M,o]=k.percentage,b=Math.abs(x-M),R=Math.abs(x-o);return b<=R?0:1},[k.isRange,k.percentage]),E=e.useCallback((x,M)=>{if(l)return;x.preventDefault(),x.currentTarget.setPointerCapture(x.pointerId);const o=ne(x),b=M??_(o);if(W(!0),X(b),U(w!=="off"),m&&re.length>0){const R=re.reduce((j,te)=>{const z=(j.value-s)/(i-s)*100,ie=(te.value-s)/(i-s)*100;return Math.abs(ie-o)<Math.abs(z-o)?te:j});k.setValue(k.isRange?b===0?[R.value,k.value[1]]:[k.value[0],R.value]:R.value)}else k.setValueByPercentage(o,b);K()},[l,ne,_,w,m,re,s,i,k,K]),H=e.useCallback(x=>{var o;if(!q||l||Z===null)return;const M=ne(x);if(m&&re.length>0){const b=re.reduce((j,te)=>{const z=(j.value-s)/(i-s)*100,ie=(te.value-s)/(i-s)*100;return Math.abs(ie-M)<Math.abs(z-M)?te:j}),R=k.isRange?Z===0?[b.value,k.value[1]]:[k.value[0],b.value]:b.value;JSON.stringify(R)!==JSON.stringify(G.current)&&(k.setValue(R),G.current=R,K())}else{k.setValueByPercentage(M,Z);const b=k.isRange?k.value[Z]:k.value,R=k.isRange?(o=G.current)==null?void 0:o[Z]:G.current;Math.abs(b-R)>=a&&(K(),G.current=k.value)}},[q,l,Z,ne,m,re,s,i,k,a,K]),g=e.useCallback(x=>{q&&(x.currentTarget.releasePointerCapture(x.pointerId),W(!1),X(null),w==="auto"&&U(!1),k.commitValue())},[q,w,k]),A=e.useCallback((x,M)=>{if(l)return;let o=k.isRange?k.value[M]:k.value;switch(x.key){case"ArrowRight":case"ArrowUp":x.preventDefault(),o=Math.min(i,o+a);break;case"ArrowLeft":case"ArrowDown":x.preventDefault(),o=Math.max(s,o-a);break;case"Home":x.preventDefault(),o=s;break;case"End":x.preventDefault(),o=i;break;case"PageUp":x.preventDefault(),o=Math.min(i,o+a*10);break;case"PageDown":x.preventDefault(),o=Math.max(s,o-a*10);break;default:return}if(k.isRange){const b=k.value;k.setValue(M===0?[o,b[1]]:[b[0],o])}else k.setValue(o);K(),k.commitValue()},[l,k,i,s,a,K]),h=e.useMemo(()=>{if(k.isRange){const[M,o]=k.percentage;return d==="horizontal"?{left:`${M}%`,width:`${o-M}%`}:{bottom:`${M}%`,height:`${o-M}%`}}const x=k.percentage;return d==="horizontal"?{left:0,width:`${x}%`}:{bottom:0,height:`${x}%`}},[k.isRange,k.percentage,d]),L=(x,M)=>{const o=k.isRange?k.value[x]:k.value,b=d==="horizontal"?{left:`${M}%`}:{bottom:`${M}%`};return r.jsx("div",{className:`nice-touch-slider-thumb ${Z===x?"nice-touch-slider-thumb--active":""}`,style:{...b,width:N,height:N},role:"slider",tabIndex:l?-1:0,"aria-label":F,"aria-labelledby":Y,"aria-valuenow":o,"aria-valuemin":s,"aria-valuemax":i,"aria-disabled":l,onKeyDown:R=>A(R,x),children:V&&r.jsx("span",{className:"nice-touch-slider-label",children:C(o)})},x)};return r.jsxs("div",{ref:T,className:`
21
21
  nice-touch-slider
22
22
  nice-touch-slider--${d}
23
23
  ${l?"nice-touch-slider--disabled":""}
24
- ${J?"nice-touch-slider--dragging":""}
25
- ${Q}
26
- `,style:{"--thumb-size":`${N}px`,"--track-height":`${I}px`,...u?{"--track-color":u}:{},...p?{"--fill-color":p}:{}},...$,children:[D&&r.jsx("span",{className:"nice-touch-slider-min",children:C(s)}),r.jsxs("div",{ref:B,className:"nice-touch-slider-track-container",onPointerDown:E,onPointerMove:H,onPointerUp:g,onPointerCancel:g,children:[r.jsx("div",{className:"nice-touch-slider-track"}),r.jsx("div",{className:"nice-touch-slider-fill",style:h}),re.length>0&&r.jsx("div",{className:"nice-touch-slider-marks",children:re.map(x=>{const M=(x.value-s)/(i-s)*100,o=d==="horizontal"?{left:`${M}%`}:{bottom:`${M}%`};return r.jsxs("div",{className:"nice-touch-slider-mark",style:o,children:[r.jsx("span",{className:"nice-touch-slider-mark-dot"}),x.label&&r.jsx("span",{className:"nice-touch-slider-mark-label",children:x.label})]},x.value)})}),k.isRange?r.jsxs(r.Fragment,{children:[L(0,k.percentage[0]),L(1,k.percentage[1])]}):L(0,k.percentage)]}),D&&r.jsx("span",{className:"nice-touch-slider-max",children:C(i)})]})});function Ae(t,n,c){n/=100,c/=100;const s=(1-Math.abs(2*c-1))*n,i=s*(1-Math.abs(t/60%2-1)),a=c-s/2;let d=0,l=0,f=0;return t>=0&&t<60?(d=s,l=i,f=0):t>=60&&t<120?(d=i,l=s,f=0):t>=120&&t<180?(d=0,l=s,f=i):t>=180&&t<240?(d=0,l=i,f=s):t>=240&&t<300?(d=i,l=0,f=s):(d=s,l=0,f=i),{r:Math.round((d+a)*255),g:Math.round((l+a)*255),b:Math.round((f+a)*255)}}function Wt(t,n,c){t/=255,n/=255,c/=255;const s=Math.max(t,n,c),i=Math.min(t,n,c),a=(s+i)/2;let d=0,l=0;if(s!==i){const f=s-i;switch(l=a>.5?f/(2-s-i):f/(s+i),s){case t:d=((n-c)/f+(n<c?6:0))*60;break;case n:d=((c-t)/f+2)*60;break;case c:d=((t-n)/f+4)*60;break}}return{h:Math.round(d),s:Math.round(l*100),l:Math.round(a*100)}}function qt(t){const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:{r:0,g:0,b:0}}function Jt(t,n,c){return"#"+[t,n,c].map(s=>s.toString(16).padStart(2,"0")).join("")}function Ne(t){const n=qt(t);return Wt(n.r,n.g,n.b)}function $e(t,n,c){const s=Ae(t,n,c);return Jt(s.r,s.g,s.b)}function Ue(t,n){switch(n){case"hsl":return`hsl(${t.h}, ${t.s}%, ${t.l}%)`;case"rgb":{const c=Ae(t.h,t.s,t.l);return`rgb(${c.r}, ${c.g}, ${c.b})`}case"hex":default:return $e(t.h,t.s,t.l)}}const tc=e.forwardRef(function({value:n,defaultValue:c="#6366f1",format:s="hex",showAlpha:i=!1,showPreview:a=!0,showInput:d=!0,presetColors:l,wheelSize:f=240,haptic:y=!0,onChange:w,presetLabel:C,className:D="",...u},p){const{t:N}=ue.useNiceTranslation(),I=C??N("touchColorPicker.presets","Presets"),[S,m]=e.useState(()=>Ne(n||c)),[v,P]=e.useState(n||c),[Q,F]=e.useState(1),Y=e.useRef(null),$=e.useRef(null),j=e.useRef(!1),k=e.useRef(!1);e.useEffect(()=>{if(n){const h=Ne(n);m(h),P(n)}},[n]);const B=e.useCallback(()=>{if(!(!y||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[y]),J=e.useCallback(h=>{const L=Ue(h,s);P(s==="hex"?L:$e(h.h,h.s,h.l)),w==null||w(L)},[s,w]);e.useEffect(()=>{const h=Y.current;if(!h)return;const L=h.getContext("2d");if(!L)return;const x=f,M=x/2,o=M-10,b=o-30;h.width=x,h.height=x;for(let R=0;R<360;R++){const T=(R-1)*Math.PI/180,ee=(R+1)*Math.PI/180;L.beginPath(),L.arc(M,M,o,T,ee),L.arc(M,M,b,ee,T,!0),L.closePath(),L.fillStyle=`hsl(${R}, 100%, 50%)`,L.fill()}},[f]),e.useEffect(()=>{const h=$.current;if(!h)return;const L=h.getContext("2d");if(!L)return;const x=f*.5;h.width=x,h.height=x;const M=L.createImageData(x,x);for(let o=0;o<x;o++)for(let b=0;b<x;b++){const R=b/x*100,T=100-o/x*100,ee=Ae(S.h,R,T),O=(o*x+b)*4;M.data[O]=ee.r,M.data[O+1]=ee.g,M.data[O+2]=ee.b,M.data[O+3]=255}L.putImageData(M,0,0)},[S.h,f]);const W=e.useCallback(h=>{const L=Y.current;if(!L)return;const x=L.getBoundingClientRect(),M=h.clientX-x.left-x.width/2,o=h.clientY-x.top-x.height/2;let b=Math.atan2(o,M)*(180/Math.PI)+90;b<0&&(b+=360);const R={...S,h:Math.round(b)};m(R),J(R),B()},[S,J,B]),Z=e.useCallback(h=>{const L=$.current;if(!L)return;const x=L.getBoundingClientRect(),M=Math.max(0,Math.min(x.width,h.clientX-x.left)),o=Math.max(0,Math.min(x.height,h.clientY-x.top)),b=Math.round(M/x.width*100),R=Math.round(100-o/x.height*100),T={...S,s:b,l:R};m(T),J(T),B()},[S,J,B]),U=e.useCallback(h=>{h.currentTarget.setPointerCapture(h.pointerId),j.current=!0,W(h)},[W]),z=e.useCallback(h=>{j.current&&W(h)},[W]),K=e.useCallback(h=>{h.currentTarget.releasePointerCapture(h.pointerId),j.current=!1},[]),X=e.useCallback(h=>{h.currentTarget.setPointerCapture(h.pointerId),k.current=!0,Z(h)},[Z]),re=e.useCallback(h=>{k.current&&Z(h)},[Z]),ne=e.useCallback(h=>{h.currentTarget.releasePointerCapture(h.pointerId),k.current=!1},[]),V=e.useCallback(h=>{const L=h.target.value;if(P(L),/^#?[0-9a-f]{6}$/i.test(L)){const x=L.startsWith("#")?L:`#${L}`,M=Ne(x);m(M),w==null||w(Ue(M,s))}},[s,w]),_=e.useCallback(h=>{const L=Ne(h);m(L),J(L),B()},[J,B]),E=e.useMemo(()=>{const h=f/2,L=h-25,x=(S.h-90)*Math.PI/180;return{x:h+L*Math.cos(x),y:h+L*Math.sin(x)}},[S.h,f]),H=f*.5,g=e.useMemo(()=>({x:S.s/100*H,y:(1-S.l/100)*H}),[S.s,S.l,H]),A=e.useMemo(()=>$e(S.h,S.s,S.l),[S]);return r.jsxs("div",{ref:p,className:`nice-touch-color-picker ${D}`,...u,children:[r.jsxs("div",{className:"nice-touch-color-picker-wheel-container",style:{width:f,height:f},children:[r.jsx("canvas",{ref:Y,className:"nice-touch-color-picker-wheel",onPointerDown:U,onPointerMove:z,onPointerUp:K,onPointerCancel:K}),r.jsx("div",{className:"nice-touch-color-picker-hue-indicator",style:{left:E.x,top:E.y,backgroundColor:`hsl(${S.h}, 100%, 50%)`}}),r.jsxs("div",{className:"nice-touch-color-picker-sl-container",style:{width:H,height:H},children:[r.jsx("canvas",{ref:$,className:"nice-touch-color-picker-sl",onPointerDown:X,onPointerMove:re,onPointerUp:ne,onPointerCancel:ne}),r.jsx("div",{className:"nice-touch-color-picker-sl-indicator",style:{left:g.x,top:g.y,backgroundColor:A}})]})]}),r.jsxs("div",{className:"nice-touch-color-picker-controls",children:[a&&r.jsx("div",{className:"nice-touch-color-picker-preview",style:{backgroundColor:A}}),d&&r.jsx("input",{type:"text",className:"nice-touch-color-picker-input",value:v,onChange:V,placeholder:"#000000"})]}),i&&r.jsx("div",{className:"nice-touch-color-picker-alpha",children:r.jsx("input",{type:"range",min:"0",max:"100",value:Q*100,onChange:h=>F(Number(h.target.value)/100),className:"nice-touch-color-picker-alpha-slider",style:{background:`linear-gradient(to right, transparent, ${A})`}})}),l&&l.length>0&&r.jsxs("div",{className:"nice-touch-color-picker-presets",children:[r.jsx("span",{className:"nice-touch-color-picker-presets-label",children:I}),r.jsx("div",{className:"nice-touch-color-picker-presets-grid",children:l.map((h,L)=>r.jsx("button",{type:"button",className:`nice-touch-color-picker-preset ${h.toLowerCase()===A.toLowerCase()?"nice-touch-color-picker-preset--selected":""}`,style:{backgroundColor:h},onClick:()=>_(h),"aria-label":N("touchColorPicker.selectColor","Select color {color}").replace("{color}",String(h))},L))})]})]})}),nc={hslToRgb:Ae,rgbToHsl:Wt,hexToRgb:qt,rgbToHex:Jt,hexToHsl:Ne,hslToHex:$e,formatColor:Ue};function xe(t,n){var d;const c=t.trim().match(/^var\(\s*([^,\s)]+)\s*(?:,\s*(.+))?\)$/);if(!c)return t;const s=(d=c[2])==null?void 0:d.trim();if(typeof document>"u"||typeof getComputedStyle>"u")return s?xe(s):t;const i=typeof Element<"u"&&n instanceof Element&&n.isConnected?n:document.documentElement,a=getComputedStyle(i).getPropertyValue(c[1]).trim();return a||(s?xe(s,n):t)}function rc(t,n){return Math.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2))}function pt(t,n){const c=n.time-t.time||1;return rc(t,n)/c}const Qt=e.forwardRef(function({width:n="100%",height:c=200,strokeColor:s="#1f2937",strokeWidth:i=2,minWidth:a=.5,maxWidth:d=4,velocityFilterWeight:l=.7,backgroundColor:f="#ffffff",showGuideline:y=!0,guidelineColor:w="var(--nice-border-color, #e5e7eb)",disabled:C=!1,penPressure:D=!0,haptic:u=!0,placeholder:p,onChange:N,onBegin:I,onEnd:S,className:m="",...v},P){const{t:Q}=ue.useNiceTranslation(),F=p??Q("signaturePad.signHere","Sign here"),Y=e.useRef(null),$=e.useRef(null),j=e.useMemo(()=>xe(s,Y.current),[s]),k=e.useMemo(()=>xe(f,Y.current),[f]),B=e.useMemo(()=>xe(w,Y.current),[w]),[J,W]=e.useState(!0),[Z,U]=e.useState(!1),z=e.useRef([]),K=e.useRef([]),X=e.useRef([]),re=e.useRef(0),ne=e.useRef(i);e.useEffect(()=>{const o=Y.current;if(!o)return;const b=o.getBoundingClientRect(),R=window.devicePixelRatio||1;o.width=b.width*R,o.height=b.height*R;const T=o.getContext("2d");T&&(T.scale(R,R),$.current=T,_())},[]);const V=e.useCallback(()=>{if(!(!u||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[u]),_=e.useCallback(()=>{const o=Y.current,b=$.current;if(!o||!b)return;const R=o.getBoundingClientRect();b.fillStyle=k,b.fillRect(0,0,R.width,R.height),y&&(b.strokeStyle=B,b.lineWidth=1,b.setLineDash([5,5]),b.beginPath(),b.moveTo(20,R.height*.7),b.lineTo(R.width-20,R.height*.7),b.stroke(),b.setLineDash([]))},[k,y,B]),E=e.useCallback(()=>{_();const o=$.current;o&&K.current.forEach(b=>{if(!(b.length<2)){o.strokeStyle=j,o.fillStyle=j,o.lineCap="round",o.lineJoin="round";for(let R=1;R<b.length;R++){const T=b[R-1],ee=b[R],O=pt(T,ee),ie=Math.max(a,Math.min(d,d/(O+1)));o.lineWidth=ie,o.beginPath(),o.moveTo(T.x,T.y),o.lineTo(ee.x,ee.y),o.stroke()}}})},[_,j,a,d]),H=e.useCallback(o=>Math.max(a,d/(o*10+1)),[a,d]),g=e.useCallback(o=>{const b=$.current;b&&(b.fillStyle=j,b.beginPath(),b.arc(o.x,o.y,i/2,0,Math.PI*2),b.fill())},[j,i]),A=e.useCallback((o,b,R)=>{const T=$.current;T&&(T.strokeStyle=j,T.lineWidth=R,T.lineCap="round",T.lineJoin="round",T.beginPath(),T.moveTo(o.x,o.y),T.lineTo(b.x,b.y),T.stroke())},[j]),h=e.useCallback(o=>{const b=Y.current;if(!b)return{x:0,y:0,time:Date.now()};const R=b.getBoundingClientRect();return{x:o.clientX-R.left,y:o.clientY-R.top,pressure:D?o.pressure:void 0,time:Date.now()}},[D]),L=e.useCallback(o=>{if(C)return;o.preventDefault(),o.currentTarget.setPointerCapture(o.pointerId),U(!0);const b=h(o);z.current=[b],re.current=0,ne.current=i,X.current=[],g(b),I==null||I(),V()},[C,h,i,g,I,V]),x=e.useCallback(o=>{if(!Z||C)return;const b=h(o),R=z.current;if(R.length===0)return;const T=R[R.length-1],ee=pt(T,b),O=l*ee+(1-l)*re.current,ie=H(O),ae=(ne.current+ie)/2,se=b.pressure!==void 0?ae*Math.max(.5,b.pressure):ae;A(T,b,se),R.push(b),re.current=O,ne.current=ie},[Z,C,h,l,H,A]),M=e.useCallback(o=>{Z&&(o.currentTarget.releasePointerCapture(o.pointerId),U(!1),z.current.length>0&&(K.current.push([...z.current]),z.current=[],W(!1),N==null||N(!1)),S==null||S())},[Z,N,S]);return e.useImperativeHandle(P,()=>({clear:()=>{K.current=[],X.current=[],z.current=[],_(),W(!0),N==null||N(!0)},isEmpty:()=>J,toData:()=>[...K.current],fromData:o=>{K.current=o,X.current=[],W(o.length===0),E(),N==null||N(o.length===0)},toDataURL:(o="png",b=1)=>{const R=Y.current;if(!R)return"";if(o==="svg"){const ee=R.getBoundingClientRect();let O="";K.current.forEach(ae=>{if(ae.length<2)return;let se=`M ${ae[0].x} ${ae[0].y}`;for(let ce=1;ce<ae.length;ce++)se+=` L ${ae[ce].x} ${ae[ce].y}`;O+=`<path d="${se}" stroke="${j}" stroke-width="${i}" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`});const ie=`<svg xmlns="http://www.w3.org/2000/svg" width="${ee.width}" height="${ee.height}" viewBox="0 0 ${ee.width} ${ee.height}">${O}</svg>`;return`data:image/svg+xml;base64,${btoa(ie)}`}if(o==="json")return`data:application/json;base64,${btoa(JSON.stringify(K.current))}`;const T=o==="jpeg"?"image/jpeg":"image/png";return R.toDataURL(T,b)},toSVG:()=>{const o=Y.current;if(!o)return"";const b=o.getBoundingClientRect();let R="";return K.current.forEach(T=>{if(T.length<2)return;let ee=`M ${T[0].x} ${T[0].y}`;for(let O=1;O<T.length;O++)ee+=` L ${T[O].x} ${T[O].y}`;R+=`<path d="${ee}" stroke="${j}" stroke-width="${i}" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`}),`<svg xmlns="http://www.w3.org/2000/svg" width="${b.width}" height="${b.height}" viewBox="0 0 ${b.width} ${b.height}">${R}</svg>`},toBlob:(o="png",b=1)=>new Promise(R=>{const T=Y.current;if(!T){R(null);return}const ee=o==="jpeg"?"image/jpeg":"image/png";T.toBlob(R,ee,b)}),undo:()=>{if(K.current.length===0)return;const o=K.current.pop();o&&X.current.push(o);const b=K.current.length===0;W(b),E(),N==null||N(b)},redo:()=>{if(X.current.length===0)return;const o=X.current.pop();o&&K.current.push(o),W(!1),E(),N==null||N(!1)}}),[J,_,E,j,i,N]),r.jsxs("div",{className:`nice-signature-pad ${C?"nice-signature-pad--disabled":""} ${m}`,...v,children:[r.jsx("canvas",{ref:Y,className:"nice-signature-pad-canvas",style:{width:n,height:c,backgroundColor:k,touchAction:"none"},onPointerDown:L,onPointerMove:x,onPointerUp:M,onPointerCancel:M,onPointerLeave:M}),J&&F&&r.jsx("div",{className:"nice-signature-pad-placeholder",children:F})]})}),cc=e.forwardRef(function({width:n="100%",height:c=300,backgroundColor:s="var(--nice-bg-primary, #ffffff)",strokeColor:i="var(--nice-text-primary, #1f2937)",strokeWidth:a=4,tool:d="pen",lineCap:l="round",opacity:f=1,penPressure:y=!0,haptic:w=!0,maxHistory:C=50,disabled:D=!1,onChange:u,onToolChange:p,className:N="",...I},S){const m=e.useRef(null),v=e.useRef(null),[P,Q]=e.useState(!1),[F,Y]=e.useState(d),$=e.useRef([]),j=e.useRef(-1),k=e.useRef(null),B=e.useRef(null),J=e.useRef(null);e.useEffect(()=>{Y(d)},[d]),e.useEffect(()=>{const g=m.current;if(!g)return;const A=g.getBoundingClientRect(),h=window.devicePixelRatio||1;g.width=A.width*h,g.height=A.height*h;const L=g.getContext("2d",{willReadFrequently:!0});L&&(L.scale(h,h),v.current=L,L.fillStyle=s,L.fillRect(0,0,A.width,A.height),W())},[s]);const W=e.useCallback(()=>{const g=m.current,A=v.current;if(!g||!A)return;const h=g.getBoundingClientRect(),L=A.getImageData(0,0,h.width,h.height);j.current<$.current.length-1&&($.current=$.current.slice(0,j.current+1)),$.current.push({type:"stroke",imageData:L}),$.current.length>C&&$.current.shift(),j.current=$.current.length-1},[C]),Z=e.useCallback(g=>{const A=v.current;if(!A||g<0||g>=$.current.length)return;const h=$.current[g];A.putImageData(h.imageData,0,0)},[]),U=e.useCallback(()=>{if(!(!w||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[w]),z=e.useCallback(g=>{const A=m.current;if(!A)return{x:0,y:0};const h=A.getBoundingClientRect();return{x:g.clientX-h.left,y:g.clientY-h.top,pressure:y?g.pressure:void 0}},[y]),K=e.useCallback(()=>{const g=v.current;g&&(g.lineCap=l,g.lineJoin="round",g.globalAlpha=f,F==="eraser"?(g.globalCompositeOperation="destination-out",g.strokeStyle=xe("var(--nice-overlay-90, rgba(0, 0, 0, 1))",g.canvas),g.lineWidth=a*2):F==="brush"?(g.globalCompositeOperation="source-over",g.strokeStyle=i,g.lineWidth=a):F==="marker"?(g.globalCompositeOperation="multiply",g.strokeStyle=i,g.lineWidth=a*1.5,g.globalAlpha=.5):(g.globalCompositeOperation="source-over",g.strokeStyle=i,g.lineWidth=a))},[F,i,a,l,f]),X=e.useCallback((g,A)=>{const h=v.current;h&&(K(),A.pressure!==void 0&&F!=="eraser"&&(h.lineWidth=a*Math.max(.3,A.pressure)),h.beginPath(),h.moveTo(g.x,g.y),h.lineTo(A.x,A.y),h.stroke())},[K,a,F]),re=e.useCallback((g,A)=>{const h=v.current;if(!h||!J.current)return;h.putImageData(J.current,0,0),K();const L=A.x-g.x,x=A.y-g.y;if(h.beginPath(),F==="line")h.moveTo(g.x,g.y),h.lineTo(A.x,A.y),h.stroke();else if(F==="rectangle")h.strokeRect(g.x,g.y,L,x);else if(F==="circle"){const M=Math.sqrt(L*L+x*x);h.arc(g.x,g.y,M,0,Math.PI*2),h.stroke()}},[K,F]),ne=e.useCallback((g,A,h)=>{const L=m.current,x=v.current;if(!L||!x)return;const M=L.getBoundingClientRect(),o=x.getImageData(0,0,M.width,M.height),b=o.data,R=document.createElement("div");R.style.color=h,document.body.appendChild(R);const T=getComputedStyle(R).color;document.body.removeChild(R);const ee=T.match(/\d+/g);if(!ee)return;const[O,ie,ae]=ee.map(Number),se=(Math.floor(A)*M.width+Math.floor(g))*4,ce=b[se],oe=b[se+1],me=b[se+2],G=b[se+3];if(ce===O&&oe===ie&&me===ae)return;const q=[[Math.floor(g),Math.floor(A)]],te=new Set;for(;q.length>0;){const[le,fe]=q.pop(),be=(fe*M.width+le)*4;if(le<0||le>=M.width||fe<0||fe>=M.height||te.has(be))continue;const Me=b[be],Ye=b[be+1],Be=b[be+2],en=b[be+3],Re=30;Math.abs(Me-ce)>Re||Math.abs(Ye-oe)>Re||Math.abs(Be-me)>Re||Math.abs(en-G)>Re||(te.add(be),b[be]=O,b[be+1]=ie,b[be+2]=ae,b[be+3]=255,q.push([le+1,fe],[le-1,fe],[le,fe+1],[le,fe-1]))}x.putImageData(o,0,0)},[]),V=e.useCallback(g=>{if(D)return;g.preventDefault(),g.currentTarget.setPointerCapture(g.pointerId);const A=z(g);if(F==="fill"){ne(A.x,A.y,i),W(),u==null||u(),U();return}if(Q(!0),k.current=A,B.current=A,F==="line"||F==="rectangle"||F==="circle"){const h=m.current,L=v.current;if(h&&L){const x=h.getBoundingClientRect();J.current=L.getImageData(0,0,x.width,x.height)}}else{const h=v.current;h&&(K(),h.beginPath(),h.arc(A.x,A.y,a/2,0,Math.PI*2),h.fill())}U()},[D,z,F,ne,i,W,u,U,K,a]),_=e.useCallback(g=>{if(!P||D)return;const A=z(g);F==="line"||F==="rectangle"||F==="circle"?k.current&&re(k.current,A):B.current&&X(B.current,A),B.current=A},[P,D,z,F,re,X]),E=e.useCallback(g=>{P&&(g.currentTarget.releasePointerCapture(g.pointerId),Q(!1),(F==="line"||F==="rectangle"||F==="circle")&&k.current&&B.current&&re(k.current,B.current),J.current=null,k.current=null,B.current=null,W(),u==null||u())},[P,F,re,W,u]);e.useImperativeHandle(S,()=>({clear:()=>{const g=m.current,A=v.current;if(!g||!A)return;const h=g.getBoundingClientRect();A.fillStyle=s,A.globalCompositeOperation="source-over",A.fillRect(0,0,h.width,h.height),W(),u==null||u()},undo:()=>{j.current>0&&(j.current--,Z(j.current),u==null||u())},redo:()=>{j.current<$.current.length-1&&(j.current++,Z(j.current),u==null||u())},canUndo:()=>j.current>0,canRedo:()=>j.current<$.current.length-1,toDataURL:(g="png",A=1)=>{const h=m.current;if(!h)return"";const L=g==="jpeg"?"image/jpeg":"image/png";return h.toDataURL(L,A)},toBlob:(g="png",A=1)=>new Promise(h=>{const L=m.current;if(!L){h(null);return}const x=g==="jpeg"?"image/jpeg":"image/png";L.toBlob(h,x,A)}),fromDataURL:async g=>{const A=m.current,h=v.current;if(!(!A||!h))return new Promise(L=>{const x=new Image;x.onload=()=>{const M=A.getBoundingClientRect();h.drawImage(x,0,0,M.width,M.height),W(),L()},x.src=g})},fill:g=>{const A=m.current,h=v.current;if(!A||!h)return;const L=A.getBoundingClientRect();h.fillStyle=g,h.globalCompositeOperation="source-over",h.fillRect(0,0,L.width,L.height),W(),u==null||u()},getTool:()=>F,setTool:g=>{Y(g),p==null||p(g)}}),[s,W,Z,F,p,u]);const H=()=>{switch(F){case"eraser":return"cell";case"fill":return"crosshair";default:return"crosshair"}};return r.jsx("div",{className:`nice-touch-drawing ${D?"nice-touch-drawing--disabled":""} ${N}`,...I,children:r.jsx("canvas",{ref:m,className:"nice-touch-drawing-canvas",style:{width:n,height:c,cursor:H(),touchAction:"none"},onPointerDown:V,onPointerMove:_,onPointerUp:E,onPointerCancel:E,onPointerLeave:E})})}),sc=["var(--nice-text-primary, #1f2937)","var(--nice-color-error, #ef4444)","var(--nice-warning, #f97316)","var(--nice-color-warning, #eab308)","var(--nice-color-success, #22c55e)","var(--nice-color-primary, #3b82f6)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-accent-pink, #ec4899)","var(--nice-bg-primary, #ffffff)","var(--nice-text-primary, #000000)"],ic={pen:"Pen",brush:"Brush",marker:"Mark",eraser:"Erase",fill:"Fill",line:"Line",rectangle:"Rect",circle:"Circle"};function Oe(t,n,c){const[s,i]=e.useState(n),a=t!==void 0;return[a?t:s,l=>{a||i(l),c==null||c(l)}]}const ac=e.forwardRef(function({tool:n,defaultTool:c="pen",onToolChange:s,color:i,defaultColor:a,onColorChange:d,strokeWidth:l,defaultStrokeWidth:f=4,onStrokeWidthChange:y,onUndo:w,onRedo:C,onClear:D,canUndo:u=!0,canRedo:p=!0,colors:N=sc,className:I="",...S},m){const{t:v}=ue.useNiceTranslation(),[P,Q]=Oe(n,c,s),[F,Y]=Oe(i,a??N[0],d),[$,j]=Oe(l,f,y),k=["pen","brush","marker","eraser","fill","line","rectangle","circle"];return r.jsxs("div",{ref:m,className:`nice-drawing-toolbar ${I}`,...S,children:[r.jsx("div",{className:"nice-drawing-toolbar-section",children:k.map(B=>r.jsx("button",{type:"button",className:`nice-drawing-tool-btn ${P===B?"nice-drawing-tool-btn--active":""}`,onClick:()=>Q(B),title:B,"aria-label":B,children:ic[B]},B))}),r.jsx("div",{className:"nice-drawing-toolbar-divider"}),r.jsx("div",{className:"nice-drawing-toolbar-section nice-drawing-colors",children:N.map((B,J)=>r.jsx("button",{type:"button",className:`nice-drawing-color-btn ${F===B?"nice-drawing-color-btn--active":""}`,style:{backgroundColor:B,borderColor:B==="var(--nice-bg-primary, #ffffff)"?"var(--nice-border-color, #e5e7eb)":B},onClick:()=>Y(B),title:B},J))}),r.jsx("div",{className:"nice-drawing-toolbar-divider"}),r.jsx("div",{className:"nice-drawing-toolbar-section",children:r.jsxs("label",{className:"nice-drawing-stroke-label",children:[r.jsxs("span",{children:[$,"px"]}),r.jsx("input",{type:"range",min:1,max:50,value:$,onChange:B=>j(Number(B.target.value)),className:"nice-drawing-stroke-slider"})]})}),r.jsx("div",{className:"nice-drawing-toolbar-divider"}),r.jsxs("div",{className:"nice-drawing-toolbar-section nice-drawing-actions",children:[w&&r.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:w,disabled:!u,title:v("touchDrawing.undo","Undo"),children:v("touchDrawing.undo","Undo")}),C&&r.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:C,disabled:!p,title:v("touchDrawing.redo","Redo"),children:v("touchDrawing.redo","Redo")}),D&&r.jsx("button",{type:"button",className:"nice-drawing-action-btn nice-drawing-action-btn--danger",onClick:D,title:v("touchDrawing.clear","Clear"),children:v("touchDrawing.clear","Clear")})]})]})}),gt=ue.NICE_KEYBOARD_LAYOUTS,He=e.forwardRef(function({layout:n="qwerty",customLayout:c,mode:s="standard",languages:i,activeLanguage:a,onLanguageChange:d,value:l="",maxLength:f,theme:y="system",haptic:w=!0,sound:C=!1,onKeyPress:D,onChange:u,onSubmit:p,disabled:N=!1,showPreview:I=!1,previewPlaceholder:S,masked:m=!1,showLanguageSwitcher:v,enterLabel:P,className:Q="",...F},Y){const{t:$}=ue.useNiceTranslation(),j=S??$("touchKeyboard.typeHere","Type here..."),k=e.useMemo(()=>i&&i.length>0?i:["en"],[i]),[B,J]=e.useState(k[0]),W=a??B,[Z,U]=e.useState(!1),[z,K]=e.useState(!1),[X,re]=e.useState(!1),ne=v??k.length>1,V=e.useMemo(()=>n==="custom"&&c?c.rows:n!=="qwerty"?{numeric:ue.NICE_KEYBOARD_NUMERIC,numpad:ue.NICE_KEYBOARD_NUMPAD,phone:ue.NICE_KEYBOARD_PHONE,pin:ue.NICE_KEYBOARD_PIN}[n]||ue.NICE_KEYBOARD_NUMERIC:ue.buildKeyboardRows(W,s,X,ne,P),[n,c,W,s,X,ne,P]),_=e.useCallback(()=>{const M=k.indexOf(W),o=k[(M+1)%k.length];J(o),d==null||d(o)},[k,W,d]),E=e.useCallback(()=>{if(!(!w||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[w]),H=e.useCallback(()=>{if(C)try{const M=new(window.AudioContext||window.webkitAudioContext),o=M.createOscillator(),b=M.createGain();o.connect(b),b.connect(M.destination),o.frequency.value=1e3,o.type="sine",b.gain.value=.1,o.start(),o.stop(M.currentTime+.05)}catch{}},[C]),g=e.useCallback(M=>{if(N)return;E(),H();let o=l;switch(M.type){case"backspace":o=l.slice(0,-1);break;case"enter":p==null||p(l);return;case"shift":U(b=>!b);return;case"caps":K(b=>!b);return;case"tab":o=l+" ";break;case"lang":_();return;case"fn":if(M.value==="123"||M.value==="ABC"||M.value==="#+="||M.value==="#+=")re(b=>!b);else if(M.value==="Clear"||M.value==="C")o="";else{D==null||D(M.value);return}return;case"space":o=l+" ";break;default:{let b=M.value;(Z||z)&&b.length===1&&(b=b.toUpperCase()),o=l+b,Z&&!z&&U(!1)}}f&&o.length>f||(D==null||D(M.value),u==null||u(o))},[N,l,f,Z,z,E,H,D,u,p,_]),A=e.useMemo(()=>m?"•".repeat(l.length):l,[l,m]),h=Z||z,L=y==="system"?"":`nice-touch-keyboard--${y}`,x=gt[W];return r.jsxs("div",{ref:Y,className:["nice-touch-keyboard",`nice-touch-keyboard--${s}`,L,N?"nice-touch-keyboard--disabled":"",Q].filter(Boolean).join(" "),"data-layout":n,"data-language":W,dir:ue.isRtlKeyboardLanguage(W)?"rtl":void 0,...F,children:[ne&&k.length>1&&r.jsx("div",{className:"nice-touch-keyboard-langbar",children:k.map(M=>{const o=gt[M];return r.jsx("button",{type:"button",className:`nice-touch-keyboard-langbar__btn ${M===W?"nice-touch-keyboard-langbar__btn--active":""}`,onClick:()=>{J(M),d==null||d(M)},disabled:N,children:(o==null?void 0:o.nativeName)??M.toUpperCase()},M)})}),I&&r.jsxs("div",{className:"nice-touch-keyboard-preview",children:[A||r.jsx("span",{className:"nice-touch-keyboard-placeholder",children:j}),r.jsx("span",{className:"nice-touch-keyboard-cursor"})]}),r.jsx("div",{className:"nice-touch-keyboard-keys",children:V.map((M,o)=>r.jsx("div",{className:"nice-touch-keyboard-row",children:M.map((b,R)=>{var ie;const T=b.type==="shift"&&Z||b.type==="caps"&&z||b.type==="lang"||b.value==="123"&&X||b.value==="ABC"&&!X||b.value==="#+="&&X;let ee=b.label||b.value;b.type==="space"&&b.label==="Space"?ee=$("touchKeyboard.space","Space"):b.value==="Call"&&b.label==="Call"?ee=$("touchKeyboard.call","Call"):b.type==="lang"&&b.label==="Lang"&&(ee=$("touchKeyboard.language","Lang")),h&&!b.type&&ee.length===1&&(ee=ee.toUpperCase());const O=!b.type&&b.value.length===1&&((ie=x==null?void 0:x.accents)==null?void 0:ie[b.value.toLowerCase()]);return r.jsx("button",{type:"button",className:["nice-touch-keyboard-key",`nice-touch-keyboard-key--${b.type||"char"}`,T?"nice-touch-keyboard-key--active":"",O?"nice-touch-keyboard-key--has-accent":""].filter(Boolean).join(" "),style:{flex:b.width||1},onClick:()=>g(b),disabled:N,"aria-label":b.type==="backspace"?$("touchKeyboard.backspace","Backspace"):b.type==="enter"?$("touchKeyboard.enter","Enter"):void 0,children:b.icon||ee},R)})},o))}),r.jsxs("div",{className:"nice-touch-keyboard-status",children:[z&&r.jsx("span",{className:"nice-touch-keyboard-status__item",children:$("touchKeyboard.caps","CAPS")}),x&&r.jsx("span",{className:"nice-touch-keyboard-status__item",children:x.nativeName})]})]})}),oc=e.forwardRef(function(n,c){return r.jsx(He,{ref:c,layout:"pin",masked:!0,maxLength:n.maxLength||6,...n})}),lc=e.forwardRef(function(n,c){return r.jsx(He,{ref:c,layout:"numpad",...n})}),uc=e.forwardRef(function(n,c){return r.jsx(He,{ref:c,layout:"phone",...n})}),dc=[],fc=[],vt=6;function hc({row:t,rowIndex:n,rowKey:c,columns:s,swipeActionsLeft:i=[],swipeActionsRight:a=[],selectable:d,selected:l,onSelect:f,onClick:y,haptic:w,swipeThreshold:C=80}){const[D,u]=e.useState(0),[p,N]=e.useState(!1),I=e.useRef(0),S=e.useRef(0),m=e.useRef(null),v=i.length>0,P=a.length>0,Q=e.useCallback(()=>{if(!(!w||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[w]),F=e.useCallback(_=>{!v&&!P||(I.current=_.touches[0].clientX,S.current=_.touches[0].clientX,N(!0))},[v,P]),Y=e.useCallback(_=>{S.current=_;const E=S.current-I.current;let H=E;const g=v?C*i.length:0,A=P?C*a.length:0;H>g&&(H=g),H<-A&&(H=-A),!v&&H>0&&(H=E*.2),!P&&H<0&&(H=E*.2),u(H)},[v,P,C,i.length,a.length]),$=e.useCallback(_=>{p&&Y(_.touches[0].clientX)},[p,Y]),j=e.useCallback(()=>{if(!p)return;N(!1);const _=C*.5;D>_&&v?(u(C*i.length),Q()):D<-_&&P?(u(-C*a.length),Q()):u(0)},[p,D,C,v,P,i.length,a.length,Q]),k=e.useRef(null),B=e.useRef(0),J=e.useRef(!1),W=e.useCallback(_=>{_.pointerType==="touch"||_.button!==0||!v&&!P||(k.current=_.pointerId,I.current=_.clientX,S.current=_.clientX,B.current=_.clientY)},[v,P]),Z=e.useCallback(_=>{var E,H;if(_.pointerId===k.current){if(!p){const g=_.clientX-I.current,A=_.clientY-B.current;if(Math.abs(g)<vt&&Math.abs(A)<vt)return;if(Math.abs(A)>Math.abs(g)){k.current=null;return}(H=(E=_.currentTarget).setPointerCapture)==null||H.call(E,_.pointerId),N(!0)}Y(_.clientX)}},[p,Y]),U=e.useCallback(_=>{_.pointerId===k.current&&(k.current=null,p&&(J.current=!0,j()))},[p,j]),z=e.useCallback(_=>{Q(),_.onAction(t,n),u(0)},[t,n,Q]),K=e.useCallback(()=>{if(J.current){J.current=!1;return}Math.abs(D)>10||(d&&f?f():y&&y())},[D,d,f,y]);e.useEffect(()=>{if(D===0)return;const _=E=>{m.current&&!m.current.contains(E.target)&&u(0)};return document.addEventListener("click",_),()=>document.removeEventListener("click",_)},[D]);const X={transform:D?`translateX(${D}px)`:void 0,transition:p?"none":"transform 0.2s ease-out",userSelect:p?"none":void 0},re=D!==0||p,ne=_=>{const E=_==="left"?i:a;if(!E.length||!re)return null;const H=_==="left"?"var(--nice-color-primary, #3b82f6)":"var(--nice-color-error, #ef4444)";return r.jsx("div",{className:`nice-touch-table-actions nice-touch-table-actions--${_}`,style:{width:C*E.length},children:E.map(g=>r.jsxs("button",{type:"button",className:"nice-touch-table-action",style:{backgroundColor:g.color||H,color:g.textColor||"var(--nice-color-white, #ffffff)",width:C},onClick:A=>{A.stopPropagation(),z(g)},children:[g.icon&&r.jsx("span",{className:"nice-touch-table__action-icon",children:g.icon}),r.jsx("span",{className:"nice-touch-table__action-label",children:g.label})]},g.id))})},V=s.length-1;return r.jsxs("tr",{ref:m,className:`nice-touch-table-row ${l?"nice-touch-table-row--selected":""} ${p?"nice-touch-table-row--swiping":""}`,onTouchStart:F,onTouchMove:$,onTouchEnd:j,onTouchCancel:j,onPointerDown:W,onPointerMove:Z,onPointerUp:U,onPointerCancel:U,onClick:K,"data-row-key":c,children:[d&&r.jsxs("td",{className:"nice-touch-table-cell nice-touch-table-cell--checkbox nice-touch-table-cell--edge",style:X,children:[ne("left"),r.jsx("input",{type:"checkbox",checked:l,onChange:()=>f==null?void 0:f(),onClick:_=>_.stopPropagation()})]}),s.map((_,E)=>{const H=typeof _.accessor=="function"?_.accessor(t):t[_.accessor],g=_.cell?_.cell(H,t,n):H,A=!d&&E===0,h=E===V;return r.jsxs("td",{className:`nice-touch-table-cell ${_.sticky?"nice-touch-table-cell--sticky":""} ${A||h?"nice-touch-table-cell--edge":""}`,style:{width:_.width,minWidth:_.minWidth,textAlign:_.align,...X},children:[A&&ne("left"),g,h&&ne("right")]},_.id)})]})}const bc=e.forwardRef(function({data:n=dc,columns:c=fc,rowKey:s,swipeActionsLeft:i,swipeActionsRight:a,selectable:d=!1,selectedKeys:l=[],onSelect:f,onRowClick:y,sortState:w,onSort:C,emptyContent:D="No data",loading:u=!1,haptic:p=!0,swipeThreshold:N=80,className:I="",...S},m){const v=e.useCallback(j=>typeof s=="function"?s(j):String(j[s]),[s]),P=e.useCallback(j=>{if(!j.sortable||!C)return;const k=(w==null?void 0:w.columnId)===j.id&&w.direction==="asc"?"desc":"asc";C({columnId:j.id,direction:k})},[w,C]),Q=e.useCallback(()=>{f&&(l.length===n.length?f([]):f(n.map(j=>v(j))))},[n,l,f,v]),F=e.useCallback(j=>{if(!f)return;const k=l.includes(j)?l.filter(B=>B!==j):[...l,j];f(k)},[l,f]),Y=n.length>0&&l.length===n.length,$=l.length>0&&l.length<n.length;return r.jsxs("div",{ref:m,className:`nice-touch-table-container ${u?"nice-touch-table-container--loading":""} ${I}`,...S,children:[r.jsx("div",{className:"nice-touch-table-scroll",children:r.jsxs("table",{className:"nice-touch-table",children:[r.jsx("thead",{className:"nice-touch-table-head",children:r.jsxs("tr",{children:[d&&r.jsx("th",{className:"nice-touch-table-header nice-touch-table-header--checkbox",children:r.jsx("input",{type:"checkbox",checked:Y,ref:j=>{j&&(j.indeterminate=$)},onChange:Q})}),c.map(j=>r.jsx("th",{className:`nice-touch-table-header ${j.sticky?"nice-touch-table-header--sticky":""} ${j.sortable?"nice-touch-table-header--sortable":""}`,style:{width:j.width,minWidth:j.minWidth,textAlign:j.align},onClick:()=>P(j),children:r.jsxs("span",{className:"nice-touch-table__header-content",children:[j.header,j.sortable&&r.jsx("span",{className:"nice-touch-table__sort-indicator","aria-hidden":"true",children:(w==null?void 0:w.columnId)===j.id&&r.jsx("span",{className:`nice-touch-table__sort-mark nice-touch-table__sort-mark--${w.direction}`})})]})},j.id))]})}),r.jsx("tbody",{className:"nice-touch-table-body",children:n.length===0?r.jsx("tr",{className:"nice-touch-table-empty",children:r.jsx("td",{colSpan:c.length+(d?1:0),children:D})}):n.map((j,k)=>{const B=v(j);return r.jsx(hc,{row:j,rowIndex:k,rowKey:B,columns:c,swipeActionsLeft:i,swipeActionsRight:a,selectable:d,selected:l.includes(B),onSelect:()=>F(B),onClick:()=>y==null?void 0:y(j,k),haptic:p,swipeThreshold:N},B)})})]})}),u&&r.jsx("div",{className:"nice-touch-table-loading",children:r.jsx("div",{className:"nice-touch-table-spinner"})})]})}),Zt=e.createContext(null);function et(){const t=e.useContext(Zt);if(!t)throw new Error("useTouchForm must be used within NiceTouchForm");return t}function xt(t,n){for(const c of n){const s=String(t??"");switch(c.type){case"required":if(!t||typeof t=="string"&&!t.trim())return c.message;break;case"email":if(t&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s))return c.message;break;case"minLength":if(t&&s.length<c.value)return c.message;break;case"maxLength":if(t&&s.length>c.value)return c.message;break;case"pattern":if(t&&!new RegExp(c.value).test(s))return c.message;break;case"custom":if(c.validator&&!c.validator(t))return c.message;break}}return null}const mc=e.forwardRef(function({initialValues:n={},validation:c={},onSubmit:s,onChange:i,onError:a,enableNavigation:d=!0,haptic:l=!0,autoFocus:f=!1,validateOnBlur:y=!0,validateOnChange:w=!1,disabled:C=!1,children:D,className:u="",...p},N){const[I,S]=e.useState(n),[m,v]=e.useState([]),[P,Q]=e.useState(new Set),[F,Y]=e.useState(!1),$=e.useRef(new Map),j=e.useRef([]),k=e.useRef(null),B=e.useCallback(()=>{if(!(!l||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[l]),J=e.useCallback((E,H)=>{const g=c[E];return g?xt(H,g):null},[c]),W=e.useCallback(()=>{const E=[];for(const[H,g]of Object.entries(c)){const A=xt(I[H],g);A&&E.push({field:H,message:A})}return E},[I,c]),Z=e.useCallback((E,H)=>{if(S(g=>{const A={...g,[E]:H};return i==null||i(A),A}),w){const g=J(E,H);v(A=>{const h=A.filter(L=>L.field!==E);return g?[...h,{field:E,message:g}]:h})}},[i,w,J]),U=e.useCallback(E=>{if(Q(H=>new Set([...H,E])),y){const H=J(E,I[E]);v(g=>{const A=g.filter(h=>h.field!==E);return H?[...A,{field:E,message:H}]:A})}},[y,J,I]),z=e.useCallback(E=>{var g;const H=$.current.get(E);H&&((g=H.focus)==null||g.call(H),k.current=E)},[]),K=e.useCallback(()=>{if(!d)return;const E=j.current,H=k.current;if(!H){E.length>0&&z(E[0]);return}const g=E.indexOf(H);g<E.length-1&&(z(E[g+1]),B())},[d,z,B]),X=e.useCallback(()=>{if(!d)return;const E=j.current,H=k.current;if(!H)return;const g=E.indexOf(H);g>0&&(z(E[g-1]),B())},[d,z,B]),re=e.useCallback((E,H)=>{$.current.set(E,H),H&&!j.current.includes(E)&&j.current.push(E)},[]),ne=e.useCallback(E=>{$.current.delete(E),j.current=j.current.filter(H=>H!==E)},[]),V=e.useCallback(async E=>{if(E.preventDefault(),C||F)return;const H=W();if(H.length>0){v(H),a==null||a(H),B();const g=H[0];g&&z(g.field);return}Y(!0);try{await(s==null?void 0:s(I)),B()}catch(g){console.error("Form submission error:",g)}finally{Y(!1)}},[C,F,W,a,s,I,B,z]);e.useEffect(()=>{f&&j.current.length>0&&setTimeout(()=>z(j.current[0]),100)},[f,z]);const _=e.useMemo(()=>({values:I,errors:m,touched:P,setFieldValue:Z,setFieldTouched:U,focusField:z,focusNext:K,focusPrev:X,registerField:re,unregisterField:ne}),[I,m,P,Z,U,z,K,X,re,ne]);return r.jsx(Zt.Provider,{value:_,children:r.jsx("form",{ref:N,className:`nice-touch-form ${C?"nice-touch-form--disabled":""} ${F?"nice-touch-form--submitting":""} ${u}`,onSubmit:V,noValidate:!0,...p,children:D})})}),pc=e.forwardRef(function({name:n,label:c,type:s="text",placeholder:i,helperText:a,disabled:d=!1,readOnly:l=!1,autoComplete:f,inputMode:y,iconLeft:w,iconRight:C,maxLength:D,onChange:u,required:p,className:N="",...I},S){const m=et(),v=e.useRef(null),[P,Q]=e.useState(!1),F=m.values[n]??"",Y=m.errors.find(Z=>Z.field===n),j=m.touched.has(n)&&Y;e.useEffect(()=>(m.registerField(n,v.current),()=>m.unregisterField(n)),[n,m]);const k=e.useCallback(Z=>{const U=Z.target.value;m.setFieldValue(n,U),u==null||u(U)},[n,m,u]),B=e.useCallback(()=>{Q(!0)},[]),J=e.useCallback(()=>{Q(!1),m.setFieldTouched(n)},[n,m]),W=e.useCallback(Z=>{Z.key==="Enter"&&(Z.preventDefault(),m.focusNext())},[m]);return r.jsxs("div",{ref:S,className:`nice-touch-field ${P?"nice-touch-field--focused":""} ${j?"nice-touch-field--error":""} ${d?"nice-touch-field--disabled":""} ${N}`,...I,children:[c&&r.jsxs("label",{className:"nice-touch-field-label",htmlFor:`field-${n}`,children:[c,p&&r.jsx("span",{className:"nice-touch-form__required-indicator",children:"*"})]}),r.jsxs("div",{className:"nice-touch-field-input-wrapper",children:[w&&r.jsx("span",{className:"nice-touch-field-icon nice-touch-field-icon--left",children:w}),r.jsx("input",{ref:v,id:`field-${n}`,name:n,type:s,value:F,placeholder:i,disabled:d,readOnly:l,autoComplete:f,inputMode:y,maxLength:D,onChange:k,onFocus:B,onBlur:J,onKeyDown:W,className:"nice-touch-field-input","aria-invalid":j?"true":void 0,"aria-describedby":j?`${n}-error`:a?`${n}-helper`:void 0}),C&&r.jsx("span",{className:"nice-touch-field-icon nice-touch-field-icon--right",children:C})]}),j&&r.jsx("div",{id:`${n}-error`,className:"nice-touch-field-error",role:"alert",children:Y.message}),!j&&a&&r.jsx("div",{id:`${n}-helper`,className:"nice-touch-field-helper",children:a})]})}),gc=e.forwardRef(function({loading:n=!1,disabled:c=!1,fullWidth:s=!0,children:i,className:a="",...d},l){return r.jsx("button",{ref:l,type:"submit",className:`nice-touch-submit ${s?"nice-touch-submit--full-width":""} ${n?"nice-touch-submit--loading":""} ${a}`,disabled:c||n,...d,children:n?r.jsx("span",{className:"nice-touch-submit-spinner"}):i})}),vc=e.forwardRef(function({doneText:n,showDone:c=!0,onDone:s,className:i="",...a},d){const{t:l}=ue.useNiceTranslation(),f=n??l("touchForm.done","Done"),y=et(),w=e.useCallback(()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur(),s==null||s()},[s]);return r.jsxs("div",{ref:d,className:`nice-touch-navbar ${i}`,...a,children:[r.jsxs("div",{className:"nice-touch-navbar-arrows",children:[r.jsx("button",{type:"button",onClick:y.focusPrev,"aria-label":l("touchForm.previousField","Previous field"),children:r.jsx("span",{className:"nice-touch-navbar-mark nice-touch-navbar-mark--prev","aria-hidden":"true"})}),r.jsx("button",{type:"button",onClick:y.focusNext,"aria-label":l("touchForm.nextField","Next field"),children:r.jsx("span",{className:"nice-touch-navbar-mark nice-touch-navbar-mark--next","aria-hidden":"true"})})]}),c&&r.jsx("button",{type:"button",className:"nice-touch-navbar-done",onClick:w,children:f})]})});exports.DEFAULT_BREAKPOINTS=Le;exports.DotsIndicator=cn;exports.DrawerIcons=Cn;exports.EmojiIndicator=an;exports.HAPTIC_PATTERNS=Qe;exports.HapticPatternBuilder=Vt;exports.HeaderIcons=Zn;exports.HeroHeader=rr;exports.IOSHeader=tr;exports.IOSIndicator=on;exports.LineIndicator=sn;exports.MaterialHeader=nr;exports.MaterialIndicator=ln;exports.NiceBottomSheet=bn;exports.NiceBreakpointProvider=zr;exports.NiceCalculatorKeyboard=lc;exports.NiceConfirmSheet=Yn;exports.NiceDateRangePicker=xr;exports.NiceDrawingToolbar=ac;exports.NiceFAB=Zr;exports.NiceGestures=_e;exports.NiceHapticsProvider=Dr;exports.NiceHide=Vr;exports.NiceImageGallery=gn;exports.NiceInfiniteScroll=Tn;exports.NiceMobileActionSheet=Hn;exports.NiceMobileCalendar=Je;exports.NiceMobileDatePicker=ur;exports.NiceMobileDraggable=kr;exports.NiceMobileDrawer=Dn;exports.NiceMobileHeader=Ee;exports.NiceMobileModal=Ge;exports.NiceMobilePicker=qe;exports.NiceMobilePullToRefresh=kt;exports.NiceMobileTabs=Kn;exports.NiceMobileTimePicker=or;exports.NiceMultiDatePicker=yr;exports.NicePINKeyboard=oc;exports.NicePhoneKeyboard=uc;exports.NicePickerColumn=At;exports.NicePinchZoom=Nr;exports.NicePullToRefresh=kt;exports.NiceShow=Or;exports.NiceSignaturePad=Qt;exports.NiceSwipeActions=un;exports.NiceSwipeList=dn;exports.NiceSwipeable=jr;exports.NiceTouchActionSheet=$t;exports.NiceTouchButton=Ze;exports.NiceTouchColorPicker=tc;exports.NiceTouchDrawing=cc;exports.NiceTouchField=pc;exports.NiceTouchForm=mc;exports.NiceTouchIconButton=Qr;exports.NiceTouchKeyboard=He;exports.NiceTouchMenu=Fn;exports.NiceTouchMenuPopover=It;exports.NiceTouchNavBar=vc;exports.NiceTouchSignaturePad=Qt;exports.NiceTouchSlider=ec;exports.NiceTouchSubmit=gc;exports.NiceTouchTable=bc;exports.PullToRefreshDefaultIndicator=Nt;exports.SwipeActionPresets=fn;exports.SwipeGroupProvider=Tt;exports.TabIcons=he;exports.TabPresets=Un;exports.cancelVibration=Ir;exports.colorUtils=nc;exports.createHapticPattern=Yr;exports.createMediaQuery=Kr;exports.generateNumberItems=ke;exports.getCurrentBreakpoint=Xt;exports.hapticFeedback=Cr;exports.isMobileDevice=Xr;exports.isTouch=Gr;exports.isVibrationSupported=ye;exports.responsive=Ur;exports.useBreakpoint=Te;exports.useBreakpointContext=Fr;exports.useButtonHaptic=Er;exports.useCalendar=Bt;exports.useCollapsingHeader=Gn;exports.useDrawer=Pn;exports.useGestures=zt;exports.useGesturesContext=wr;exports.useHaptics=ve;exports.useHapticsContext=Sr;exports.useImpactHaptic=Hr;exports.useInfiniteData=Mn;exports.useInfiniteScroll=xn;exports.useMediaQuery=Ut;exports.useMobileBreakpoint=Te;exports.useMobileCalendar=dr;exports.useMobileDrawer=Sn;exports.useMobileHeader=Xn;exports.useMobileMediaQuery=Ut;exports.useMobileModal=$n;exports.useMobilePicker=ir;exports.useMobilePullToRefresh=wt;exports.useMobileTabs=On;exports.useModal=En;exports.useNotificationHaptic=Ar;exports.usePullToRefresh=wt;exports.useSelectionHaptic=Lr;exports.useSwipeGroup=Mt;exports.useTabs=Vn;exports.useToggleHaptic=_r;exports.useTouchForm=et;exports.useTouchSlider=Gt;exports.useVirtualList=Rn;exports.useWheelPicker=ar;exports.vibrate=Pr;exports.withHaptics=$r;
24
+ ${q?"nice-touch-slider--dragging":""}
25
+ ${J}
26
+ `,style:{"--thumb-size":`${N}px`,"--track-height":`${I}px`,...u?{"--track-color":u}:{},...p?{"--fill-color":p}:{}},...$,children:[P&&r.jsx("span",{className:"nice-touch-slider-min",children:C(s)}),r.jsxs("div",{ref:O,className:"nice-touch-slider-track-container",onPointerDown:E,onPointerMove:H,onPointerUp:g,onPointerCancel:g,children:[r.jsx("div",{className:"nice-touch-slider-track"}),r.jsx("div",{className:"nice-touch-slider-fill",style:h}),re.length>0&&r.jsx("div",{className:"nice-touch-slider-marks",children:re.map(x=>{const M=(x.value-s)/(i-s)*100,o=d==="horizontal"?{left:`${M}%`}:{bottom:`${M}%`};return r.jsxs("div",{className:"nice-touch-slider-mark",style:o,children:[r.jsx("span",{className:"nice-touch-slider-mark-dot"}),x.label&&r.jsx("span",{className:"nice-touch-slider-mark-label",children:x.label})]},x.value)})}),k.isRange?r.jsxs(r.Fragment,{children:[L(0,k.percentage[0]),L(1,k.percentage[1])]}):L(0,k.percentage)]}),P&&r.jsx("span",{className:"nice-touch-slider-max",children:C(i)})]})});function Be(t,n,c){n/=100,c/=100;const s=(1-Math.abs(2*c-1))*n,i=s*(1-Math.abs(t/60%2-1)),a=c-s/2;let d=0,l=0,f=0;return t>=0&&t<60?(d=s,l=i,f=0):t>=60&&t<120?(d=i,l=s,f=0):t>=120&&t<180?(d=0,l=s,f=i):t>=180&&t<240?(d=0,l=i,f=s):t>=240&&t<300?(d=i,l=0,f=s):(d=s,l=0,f=i),{r:Math.round((d+a)*255),g:Math.round((l+a)*255),b:Math.round((f+a)*255)}}function qt(t,n,c){t/=255,n/=255,c/=255;const s=Math.max(t,n,c),i=Math.min(t,n,c),a=(s+i)/2;let d=0,l=0;if(s!==i){const f=s-i;switch(l=a>.5?f/(2-s-i):f/(s+i),s){case t:d=((n-c)/f+(n<c?6:0))*60;break;case n:d=((c-t)/f+2)*60;break;case c:d=((t-n)/f+4)*60;break}}return{h:Math.round(d),s:Math.round(l*100),l:Math.round(a*100)}}function Jt(t){const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:{r:0,g:0,b:0}}function Qt(t,n,c){return"#"+[t,n,c].map(s=>s.toString(16).padStart(2,"0")).join("")}function Me(t){const n=Jt(t);return qt(n.r,n.g,n.b)}function Le(t,n,c){const s=Be(t,n,c);return Qt(s.r,s.g,s.b)}function Xe(t,n){switch(n){case"hsl":return`hsl(${t.h}, ${t.s}%, ${t.l}%)`;case"rgb":{const c=Be(t.h,t.s,t.l);return`rgb(${c.r}, ${c.g}, ${c.b})`}case"hex":default:return Le(t.h,t.s,t.l)}}const tc=e.forwardRef(function({value:n,defaultValue:c="#6366f1",format:s="hex",showAlpha:i=!1,showPreview:a=!0,showInput:d=!0,presetColors:l,wheelSize:f=240,haptic:y=!0,onChange:w,presetLabel:C,className:P="",...u},p){const{t:N}=oe.useNiceTranslation(),I=C??N("touchColorPicker.presets","Presets"),[S,m]=e.useState(()=>Me(n||c)),[v,D]=e.useState(n||c),[J,F]=e.useState(1),Y=e.useRef(null),$=e.useRef(null),T=e.useRef(!1),k=e.useRef(!1);e.useEffect(()=>{if(n){const h=Me(n);m(h),D(n)}},[n]);const O=e.useCallback(()=>{if(!(!y||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[y]),q=e.useCallback(h=>{const L=Xe(h,s);D(s==="hex"?L:Le(h.h,h.s,h.l)),w==null||w(L)},[s,w]);e.useEffect(()=>{const h=Y.current;if(!h)return;const L=h.getContext("2d");if(!L)return;const x=f,M=x/2,o=M-10,b=o-30;h.width=x,h.height=x;for(let R=0;R<360;R++){const j=(R-1)*Math.PI/180,te=(R+1)*Math.PI/180;L.beginPath(),L.arc(M,M,o,j,te),L.arc(M,M,b,te,j,!0),L.closePath(),L.fillStyle=`hsl(${R}, 100%, 50%)`,L.fill()}},[f]),e.useEffect(()=>{const h=$.current;if(!h)return;const L=h.getContext("2d");if(!L)return;const x=f*.5;h.width=x,h.height=x;const M=L.createImageData(x,x);for(let o=0;o<x;o++)for(let b=0;b<x;b++){const R=b/x*100,j=100-o/x*100,te=Be(S.h,R,j),z=(o*x+b)*4;M.data[z]=te.r,M.data[z+1]=te.g,M.data[z+2]=te.b,M.data[z+3]=255}L.putImageData(M,0,0)},[S.h,f]);const W=e.useCallback(h=>{const L=Y.current;if(!L)return;const x=L.getBoundingClientRect(),M=h.clientX-x.left-x.width/2,o=h.clientY-x.top-x.height/2;let b=Math.atan2(o,M)*(180/Math.PI)+90;b<0&&(b+=360);const R={...S,h:Math.round(b)};m(R),q(R),O()},[S,q,O]),Z=e.useCallback(h=>{const L=$.current;if(!L)return;const x=L.getBoundingClientRect(),M=Math.max(0,Math.min(x.width,h.clientX-x.left)),o=Math.max(0,Math.min(x.height,h.clientY-x.top)),b=Math.round(M/x.width*100),R=Math.round(100-o/x.height*100),j={...S,s:b,l:R};m(j),q(j),O()},[S,q,O]),X=e.useCallback(h=>{h.currentTarget.setPointerCapture(h.pointerId),T.current=!0,W(h)},[W]),V=e.useCallback(h=>{T.current&&W(h)},[W]),U=e.useCallback(h=>{h.currentTarget.releasePointerCapture(h.pointerId),T.current=!1},[]),G=e.useCallback(h=>{h.currentTarget.setPointerCapture(h.pointerId),k.current=!0,Z(h)},[Z]),re=e.useCallback(h=>{k.current&&Z(h)},[Z]),ne=e.useCallback(h=>{h.currentTarget.releasePointerCapture(h.pointerId),k.current=!1},[]),K=e.useCallback(h=>{const L=h.target.value;if(D(L),/^#?[0-9a-f]{6}$/i.test(L)){const x=L.startsWith("#")?L:`#${L}`,M=Me(x);m(M),w==null||w(Xe(M,s))}},[s,w]),_=e.useCallback(h=>{const L=Me(h);m(L),q(L),O()},[q,O]),E=e.useMemo(()=>{const h=f/2,L=h-25,x=(S.h-90)*Math.PI/180;return{x:h+L*Math.cos(x),y:h+L*Math.sin(x)}},[S.h,f]),H=f*.5,g=e.useMemo(()=>({x:S.s/100*H,y:(1-S.l/100)*H}),[S.s,S.l,H]),A=e.useMemo(()=>Le(S.h,S.s,S.l),[S]);return r.jsxs("div",{ref:p,className:`nice-touch-color-picker ${P}`,...u,children:[r.jsxs("div",{className:"nice-touch-color-picker-wheel-container",style:{width:f,height:f},children:[r.jsx("canvas",{ref:Y,className:"nice-touch-color-picker-wheel",onPointerDown:X,onPointerMove:V,onPointerUp:U,onPointerCancel:U}),r.jsx("div",{className:"nice-touch-color-picker-hue-indicator",style:{left:E.x,top:E.y,backgroundColor:`hsl(${S.h}, 100%, 50%)`}}),r.jsxs("div",{className:"nice-touch-color-picker-sl-container",style:{width:H,height:H},children:[r.jsx("canvas",{ref:$,className:"nice-touch-color-picker-sl",onPointerDown:G,onPointerMove:re,onPointerUp:ne,onPointerCancel:ne}),r.jsx("div",{className:"nice-touch-color-picker-sl-indicator",style:{left:g.x,top:g.y,backgroundColor:A}})]})]}),r.jsxs("div",{className:"nice-touch-color-picker-controls",children:[a&&r.jsx("div",{className:"nice-touch-color-picker-preview",style:{backgroundColor:A}}),d&&r.jsx("input",{type:"text",className:"nice-touch-color-picker-input",value:v,onChange:K,placeholder:"#000000"})]}),i&&r.jsx("div",{className:"nice-touch-color-picker-alpha",children:r.jsx("input",{type:"range",min:"0",max:"100",value:J*100,onChange:h=>F(Number(h.target.value)/100),className:"nice-touch-color-picker-alpha-slider",style:{background:`linear-gradient(to right, transparent, ${A})`}})}),l&&l.length>0&&r.jsxs("div",{className:"nice-touch-color-picker-presets",children:[r.jsx("span",{className:"nice-touch-color-picker-presets-label",children:I}),r.jsx("div",{className:"nice-touch-color-picker-presets-grid",children:l.map((h,L)=>r.jsx("button",{type:"button",className:`nice-touch-color-picker-preset ${h.toLowerCase()===A.toLowerCase()?"nice-touch-color-picker-preset--selected":""}`,style:{backgroundColor:h},onClick:()=>_(h),"aria-label":N("touchColorPicker.selectColor","Select color {color}").replace("{color}",String(h))},L))})]})]})}),nc={hslToRgb:Be,rgbToHsl:qt,hexToRgb:Jt,rgbToHex:Qt,hexToHsl:Me,hslToHex:Le,formatColor:Xe};function Ne(t,n){var d;const c=t.trim().match(/^var\(\s*([^,\s)]+)\s*(?:,\s*(.+))?\)$/);if(!c)return t;const s=(d=c[2])==null?void 0:d.trim();if(typeof document>"u"||typeof getComputedStyle>"u")return s?Ne(s):t;const i=typeof Element<"u"&&n instanceof Element&&n.isConnected?n:document.documentElement,a=getComputedStyle(i).getPropertyValue(c[1]).trim();return a||(s?Ne(s,n):t)}function rc(t,n){return Math.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2))}function gt(t,n){const c=n.time-t.time||1;return rc(t,n)/c}const Zt=e.forwardRef(function({width:n="100%",height:c=200,strokeColor:s="#1f2937",strokeWidth:i=2,minWidth:a=.5,maxWidth:d=4,velocityFilterWeight:l=.7,backgroundColor:f="#ffffff",showGuideline:y=!0,guidelineColor:w="var(--nice-border-color, #e5e7eb)",disabled:C=!1,penPressure:P=!0,haptic:u=!0,placeholder:p,onChange:N,onBegin:I,onEnd:S,className:m="",...v},D){const{t:J}=oe.useNiceTranslation(),F=p??J("signaturePad.signHere","Sign here"),Y=e.useRef(null),$=e.useRef(null),T=e.useMemo(()=>Ne(s,Y.current),[s]),k=e.useMemo(()=>Ne(f,Y.current),[f]),O=e.useMemo(()=>Ne(w,Y.current),[w]),[q,W]=e.useState(!0),[Z,X]=e.useState(!1),V=e.useRef([]),U=e.useRef([]),G=e.useRef([]),re=e.useRef(0),ne=e.useRef(i);e.useEffect(()=>{const o=Y.current;if(!o)return;const b=o.getBoundingClientRect(),R=window.devicePixelRatio||1;o.width=b.width*R,o.height=b.height*R;const j=o.getContext("2d");j&&(j.scale(R,R),$.current=j,_())},[]);const K=e.useCallback(()=>{if(!(!u||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[u]),_=e.useCallback(()=>{const o=Y.current,b=$.current;if(!o||!b)return;const R=o.getBoundingClientRect();b.fillStyle=k,b.fillRect(0,0,R.width,R.height),y&&(b.strokeStyle=O,b.lineWidth=1,b.setLineDash([5,5]),b.beginPath(),b.moveTo(20,R.height*.7),b.lineTo(R.width-20,R.height*.7),b.stroke(),b.setLineDash([]))},[k,y,O]),E=e.useCallback(()=>{_();const o=$.current;o&&U.current.forEach(b=>{if(!(b.length<2)){o.strokeStyle=T,o.fillStyle=T,o.lineCap="round",o.lineJoin="round";for(let R=1;R<b.length;R++){const j=b[R-1],te=b[R],z=gt(j,te),ie=Math.max(a,Math.min(d,d/(z+1)));o.lineWidth=ie,o.beginPath(),o.moveTo(j.x,j.y),o.lineTo(te.x,te.y),o.stroke()}}})},[_,T,a,d]),H=e.useCallback(o=>Math.max(a,d/(o*10+1)),[a,d]),g=e.useCallback(o=>{const b=$.current;b&&(b.fillStyle=T,b.beginPath(),b.arc(o.x,o.y,i/2,0,Math.PI*2),b.fill())},[T,i]),A=e.useCallback((o,b,R)=>{const j=$.current;j&&(j.strokeStyle=T,j.lineWidth=R,j.lineCap="round",j.lineJoin="round",j.beginPath(),j.moveTo(o.x,o.y),j.lineTo(b.x,b.y),j.stroke())},[T]),h=e.useCallback(o=>{const b=Y.current;if(!b)return{x:0,y:0,time:Date.now()};const R=b.getBoundingClientRect();return{x:o.clientX-R.left,y:o.clientY-R.top,pressure:P?o.pressure:void 0,time:Date.now()}},[P]),L=e.useCallback(o=>{if(C)return;o.preventDefault(),o.currentTarget.setPointerCapture(o.pointerId),X(!0);const b=h(o);V.current=[b],re.current=0,ne.current=i,G.current=[],g(b),I==null||I(),K()},[C,h,i,g,I,K]),x=e.useCallback(o=>{if(!Z||C)return;const b=h(o),R=V.current;if(R.length===0)return;const j=R[R.length-1],te=gt(j,b),z=l*te+(1-l)*re.current,ie=H(z),ae=(ne.current+ie)/2,se=b.pressure!==void 0?ae*Math.max(.5,b.pressure):ae;A(j,b,se),R.push(b),re.current=z,ne.current=ie},[Z,C,h,l,H,A]),M=e.useCallback(o=>{Z&&(o.currentTarget.releasePointerCapture(o.pointerId),X(!1),V.current.length>0&&(U.current.push([...V.current]),V.current=[],W(!1),N==null||N(!1)),S==null||S())},[Z,N,S]);return e.useImperativeHandle(D,()=>({clear:()=>{U.current=[],G.current=[],V.current=[],_(),W(!0),N==null||N(!0)},isEmpty:()=>q,toData:()=>[...U.current],fromData:o=>{U.current=o,G.current=[],W(o.length===0),E(),N==null||N(o.length===0)},toDataURL:(o="png",b=1)=>{const R=Y.current;if(!R)return"";if(o==="svg"){const te=R.getBoundingClientRect();let z="";U.current.forEach(ae=>{if(ae.length<2)return;let se=`M ${ae[0].x} ${ae[0].y}`;for(let ue=1;ue<ae.length;ue++)se+=` L ${ae[ue].x} ${ae[ue].y}`;z+=`<path d="${se}" stroke="${T}" stroke-width="${i}" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`});const ie=`<svg xmlns="http://www.w3.org/2000/svg" width="${te.width}" height="${te.height}" viewBox="0 0 ${te.width} ${te.height}">${z}</svg>`;return`data:image/svg+xml;base64,${btoa(ie)}`}if(o==="json")return`data:application/json;base64,${btoa(JSON.stringify(U.current))}`;const j=o==="jpeg"?"image/jpeg":"image/png";return R.toDataURL(j,b)},toSVG:()=>{const o=Y.current;if(!o)return"";const b=o.getBoundingClientRect();let R="";return U.current.forEach(j=>{if(j.length<2)return;let te=`M ${j[0].x} ${j[0].y}`;for(let z=1;z<j.length;z++)te+=` L ${j[z].x} ${j[z].y}`;R+=`<path d="${te}" stroke="${T}" stroke-width="${i}" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`}),`<svg xmlns="http://www.w3.org/2000/svg" width="${b.width}" height="${b.height}" viewBox="0 0 ${b.width} ${b.height}">${R}</svg>`},toBlob:(o="png",b=1)=>new Promise(R=>{const j=Y.current;if(!j){R(null);return}const te=o==="jpeg"?"image/jpeg":"image/png";j.toBlob(R,te,b)}),undo:()=>{if(U.current.length===0)return;const o=U.current.pop();o&&G.current.push(o);const b=U.current.length===0;W(b),E(),N==null||N(b)},redo:()=>{if(G.current.length===0)return;const o=G.current.pop();o&&U.current.push(o),W(!1),E(),N==null||N(!1)}}),[q,_,E,T,i,N]),r.jsxs("div",{className:`nice-signature-pad ${C?"nice-signature-pad--disabled":""} ${m}`,...v,children:[r.jsx("canvas",{ref:Y,className:"nice-signature-pad-canvas",style:{width:n,height:c,backgroundColor:k,touchAction:"none"},onPointerDown:L,onPointerMove:x,onPointerUp:M,onPointerCancel:M,onPointerLeave:M}),q&&F&&r.jsx("div",{className:"nice-signature-pad-placeholder",children:F})]})}),cc=e.forwardRef(function({width:n="100%",height:c=300,backgroundColor:s="var(--nice-bg-primary, #ffffff)",strokeColor:i="var(--nice-text-primary, #1f2937)",strokeWidth:a=4,tool:d="pen",lineCap:l="round",opacity:f=1,penPressure:y=!0,haptic:w=!0,maxHistory:C=50,disabled:P=!1,onChange:u,onToolChange:p,className:N="",...I},S){const m=e.useRef(null),v=e.useRef(null),[D,J]=e.useState(!1),[F,Y]=e.useState(d),$=e.useRef([]),T=e.useRef(-1),k=e.useRef(null),O=e.useRef(null),q=e.useRef(null);e.useEffect(()=>{Y(d)},[d]),e.useEffect(()=>{const g=m.current;if(!g)return;const A=g.getBoundingClientRect(),h=window.devicePixelRatio||1;g.width=A.width*h,g.height=A.height*h;const L=g.getContext("2d",{willReadFrequently:!0});L&&(L.scale(h,h),v.current=L,L.fillStyle=s,L.fillRect(0,0,A.width,A.height),W())},[s]);const W=e.useCallback(()=>{const g=m.current,A=v.current;if(!g||!A)return;const h=g.getBoundingClientRect(),L=A.getImageData(0,0,h.width,h.height);T.current<$.current.length-1&&($.current=$.current.slice(0,T.current+1)),$.current.push({type:"stroke",imageData:L}),$.current.length>C&&$.current.shift(),T.current=$.current.length-1},[C]),Z=e.useCallback(g=>{const A=v.current;if(!A||g<0||g>=$.current.length)return;const h=$.current[g];A.putImageData(h.imageData,0,0)},[]),X=e.useCallback(()=>{if(!(!w||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[w]),V=e.useCallback(g=>{const A=m.current;if(!A)return{x:0,y:0};const h=A.getBoundingClientRect();return{x:g.clientX-h.left,y:g.clientY-h.top,pressure:y?g.pressure:void 0}},[y]),U=e.useCallback(()=>{const g=v.current;g&&(g.lineCap=l,g.lineJoin="round",g.globalAlpha=f,F==="eraser"?(g.globalCompositeOperation="destination-out",g.strokeStyle=Ne("var(--nice-overlay-90, rgba(0, 0, 0, 1))",g.canvas),g.lineWidth=a*2):F==="brush"?(g.globalCompositeOperation="source-over",g.strokeStyle=i,g.lineWidth=a):F==="marker"?(g.globalCompositeOperation="multiply",g.strokeStyle=i,g.lineWidth=a*1.5,g.globalAlpha=.5):(g.globalCompositeOperation="source-over",g.strokeStyle=i,g.lineWidth=a))},[F,i,a,l,f]),G=e.useCallback((g,A)=>{const h=v.current;h&&(U(),A.pressure!==void 0&&F!=="eraser"&&(h.lineWidth=a*Math.max(.3,A.pressure)),h.beginPath(),h.moveTo(g.x,g.y),h.lineTo(A.x,A.y),h.stroke())},[U,a,F]),re=e.useCallback((g,A)=>{const h=v.current;if(!h||!q.current)return;h.putImageData(q.current,0,0),U();const L=A.x-g.x,x=A.y-g.y;if(h.beginPath(),F==="line")h.moveTo(g.x,g.y),h.lineTo(A.x,A.y),h.stroke();else if(F==="rectangle")h.strokeRect(g.x,g.y,L,x);else if(F==="circle"){const M=Math.sqrt(L*L+x*x);h.arc(g.x,g.y,M,0,Math.PI*2),h.stroke()}},[U,F]),ne=e.useCallback((g,A,h)=>{const L=m.current,x=v.current;if(!L||!x)return;const M=L.getBoundingClientRect(),o=x.getImageData(0,0,M.width,M.height),b=o.data,R=document.createElement("div");R.style.color=h,document.body.appendChild(R);const j=getComputedStyle(R).color;document.body.removeChild(R);const te=j.match(/\d+/g);if(!te)return;const[z,ie,ae]=te.map(Number),se=(Math.floor(A)*M.width+Math.floor(g))*4,ue=b[se],he=b[se+1],pe=b[se+2],Q=b[se+3];if(ue===z&&he===ie&&pe===ae)return;const ee=[[Math.floor(g),Math.floor(A)]],B=new Set;for(;ee.length>0;){const[ce,le]=ee.pop(),fe=(le*M.width+ce)*4;if(ce<0||ce>=M.width||le<0||le>=M.height||B.has(fe))continue;const me=b[fe],ge=b[fe+1],we=b[fe+2],je=b[fe+3],De=30;Math.abs(me-ue)>De||Math.abs(ge-he)>De||Math.abs(we-pe)>De||Math.abs(je-Q)>De||(B.add(fe),b[fe]=z,b[fe+1]=ie,b[fe+2]=ae,b[fe+3]=255,ee.push([ce+1,le],[ce-1,le],[ce,le+1],[ce,le-1]))}x.putImageData(o,0,0)},[]),K=e.useCallback(g=>{if(P)return;g.preventDefault(),g.currentTarget.setPointerCapture(g.pointerId);const A=V(g);if(F==="fill"){ne(A.x,A.y,i),W(),u==null||u(),X();return}if(J(!0),k.current=A,O.current=A,F==="line"||F==="rectangle"||F==="circle"){const h=m.current,L=v.current;if(h&&L){const x=h.getBoundingClientRect();q.current=L.getImageData(0,0,x.width,x.height)}}else{const h=v.current;h&&(U(),h.beginPath(),h.arc(A.x,A.y,a/2,0,Math.PI*2),h.fill())}X()},[P,V,F,ne,i,W,u,X,U,a]),_=e.useCallback(g=>{if(!D||P)return;const A=V(g);F==="line"||F==="rectangle"||F==="circle"?k.current&&re(k.current,A):O.current&&G(O.current,A),O.current=A},[D,P,V,F,re,G]),E=e.useCallback(g=>{D&&(g.currentTarget.releasePointerCapture(g.pointerId),J(!1),(F==="line"||F==="rectangle"||F==="circle")&&k.current&&O.current&&re(k.current,O.current),q.current=null,k.current=null,O.current=null,W(),u==null||u())},[D,F,re,W,u]);e.useImperativeHandle(S,()=>({clear:()=>{const g=m.current,A=v.current;if(!g||!A)return;const h=g.getBoundingClientRect();A.fillStyle=s,A.globalCompositeOperation="source-over",A.fillRect(0,0,h.width,h.height),W(),u==null||u()},undo:()=>{T.current>0&&(T.current--,Z(T.current),u==null||u())},redo:()=>{T.current<$.current.length-1&&(T.current++,Z(T.current),u==null||u())},canUndo:()=>T.current>0,canRedo:()=>T.current<$.current.length-1,toDataURL:(g="png",A=1)=>{const h=m.current;if(!h)return"";const L=g==="jpeg"?"image/jpeg":"image/png";return h.toDataURL(L,A)},toBlob:(g="png",A=1)=>new Promise(h=>{const L=m.current;if(!L){h(null);return}const x=g==="jpeg"?"image/jpeg":"image/png";L.toBlob(h,x,A)}),fromDataURL:async g=>{const A=m.current,h=v.current;if(!(!A||!h))return new Promise(L=>{const x=new Image;x.onload=()=>{const M=A.getBoundingClientRect();h.drawImage(x,0,0,M.width,M.height),W(),L()},x.src=g})},fill:g=>{const A=m.current,h=v.current;if(!A||!h)return;const L=A.getBoundingClientRect();h.fillStyle=g,h.globalCompositeOperation="source-over",h.fillRect(0,0,L.width,L.height),W(),u==null||u()},getTool:()=>F,setTool:g=>{Y(g),p==null||p(g)}}),[s,W,Z,F,p,u]);const H=()=>{switch(F){case"eraser":return"cell";case"fill":return"crosshair";default:return"crosshair"}};return r.jsx("div",{className:`nice-touch-drawing ${P?"nice-touch-drawing--disabled":""} ${N}`,...I,children:r.jsx("canvas",{ref:m,className:"nice-touch-drawing-canvas",style:{width:n,height:c,cursor:H(),touchAction:"none"},onPointerDown:K,onPointerMove:_,onPointerUp:E,onPointerCancel:E,onPointerLeave:E})})}),sc=["var(--nice-text-primary, #1f2937)","var(--nice-color-error, #ef4444)","var(--nice-warning, #f97316)","var(--nice-color-warning, #eab308)","var(--nice-color-success, #22c55e)","var(--nice-color-primary, #3b82f6)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-accent-pink, #ec4899)","var(--nice-bg-primary, #ffffff)","var(--nice-text-primary, #000000)"],ic={pen:"Pen",brush:"Brush",marker:"Mark",eraser:"Erase",fill:"Fill",line:"Line",rectangle:"Rect",circle:"Circle"};function Ve(t,n,c){const[s,i]=e.useState(n),a=t!==void 0;return[a?t:s,l=>{a||i(l),c==null||c(l)}]}const ac=e.forwardRef(function({tool:n,defaultTool:c="pen",onToolChange:s,color:i,defaultColor:a,onColorChange:d,strokeWidth:l,defaultStrokeWidth:f=4,onStrokeWidthChange:y,onUndo:w,onRedo:C,onClear:P,canUndo:u=!0,canRedo:p=!0,colors:N=sc,className:I="",...S},m){const{t:v}=oe.useNiceTranslation(),[D,J]=Ve(n,c,s),[F,Y]=Ve(i,a??N[0],d),[$,T]=Ve(l,f,y),k=["pen","brush","marker","eraser","fill","line","rectangle","circle"];return r.jsxs("div",{ref:m,className:`nice-drawing-toolbar ${I}`,...S,children:[r.jsx("div",{className:"nice-drawing-toolbar-section",children:k.map(O=>r.jsx("button",{type:"button",className:`nice-drawing-tool-btn ${D===O?"nice-drawing-tool-btn--active":""}`,onClick:()=>J(O),title:O,"aria-label":O,children:ic[O]},O))}),r.jsx("div",{className:"nice-drawing-toolbar-divider"}),r.jsx("div",{className:"nice-drawing-toolbar-section nice-drawing-colors",children:N.map((O,q)=>r.jsx("button",{type:"button",className:`nice-drawing-color-btn ${F===O?"nice-drawing-color-btn--active":""}`,style:{backgroundColor:O,borderColor:O==="var(--nice-bg-primary, #ffffff)"?"var(--nice-border-color, #e5e7eb)":O},onClick:()=>Y(O),title:O},q))}),r.jsx("div",{className:"nice-drawing-toolbar-divider"}),r.jsx("div",{className:"nice-drawing-toolbar-section",children:r.jsxs("label",{className:"nice-drawing-stroke-label",children:[r.jsxs("span",{children:[$,"px"]}),r.jsx("input",{type:"range",min:1,max:50,value:$,onChange:O=>T(Number(O.target.value)),className:"nice-drawing-stroke-slider"})]})}),r.jsx("div",{className:"nice-drawing-toolbar-divider"}),r.jsxs("div",{className:"nice-drawing-toolbar-section nice-drawing-actions",children:[w&&r.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:w,disabled:!u,title:v("touchDrawing.undo","Undo"),children:v("touchDrawing.undo","Undo")}),C&&r.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:C,disabled:!p,title:v("touchDrawing.redo","Redo"),children:v("touchDrawing.redo","Redo")}),P&&r.jsx("button",{type:"button",className:"nice-drawing-action-btn nice-drawing-action-btn--danger",onClick:P,title:v("touchDrawing.clear","Clear"),children:v("touchDrawing.clear","Clear")})]})]})}),vt=oe.NICE_KEYBOARD_LAYOUTS,Fe=e.forwardRef(function({layout:n="qwerty",customLayout:c,mode:s="standard",languages:i,activeLanguage:a,onLanguageChange:d,value:l="",maxLength:f,theme:y="system",haptic:w=!0,sound:C=!1,onKeyPress:P,onChange:u,onSubmit:p,disabled:N=!1,showPreview:I=!1,previewPlaceholder:S,masked:m=!1,showLanguageSwitcher:v,enterLabel:D,className:J="",...F},Y){const{t:$}=oe.useNiceTranslation(),T=S??$("touchKeyboard.typeHere","Type here..."),k=e.useMemo(()=>i&&i.length>0?i:["en"],[i]),[O,q]=e.useState(k[0]),W=a??O,[Z,X]=e.useState(!1),[V,U]=e.useState(!1),[G,re]=e.useState(!1),ne=v??k.length>1,K=e.useMemo(()=>n==="custom"&&c?c.rows:n!=="qwerty"?{numeric:oe.NICE_KEYBOARD_NUMERIC,numpad:oe.NICE_KEYBOARD_NUMPAD,phone:oe.NICE_KEYBOARD_PHONE,pin:oe.NICE_KEYBOARD_PIN}[n]||oe.NICE_KEYBOARD_NUMERIC:oe.buildKeyboardRows(W,s,G,ne,D),[n,c,W,s,G,ne,D]),_=e.useCallback(()=>{const M=k.indexOf(W),o=k[(M+1)%k.length];q(o),d==null||d(o)},[k,W,d]),E=e.useCallback(()=>{if(!(!w||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[w]),H=e.useCallback(()=>{if(C)try{const M=new(window.AudioContext||window.webkitAudioContext),o=M.createOscillator(),b=M.createGain();o.connect(b),b.connect(M.destination),o.frequency.value=1e3,o.type="sine",b.gain.value=.1,o.start(),o.stop(M.currentTime+.05)}catch{}},[C]),g=e.useCallback(M=>{if(N)return;E(),H();let o=l;switch(M.type){case"backspace":o=l.slice(0,-1);break;case"enter":p==null||p(l);return;case"shift":X(b=>!b);return;case"caps":U(b=>!b);return;case"tab":o=l+" ";break;case"lang":_();return;case"fn":if(M.value==="123"||M.value==="ABC"||M.value==="#+="||M.value==="#+=")re(b=>!b);else if(M.value==="Clear"||M.value==="C")o="";else{P==null||P(M.value);return}return;case"space":o=l+" ";break;default:{let b=M.value;(Z||V)&&b.length===1&&(b=b.toUpperCase()),o=l+b,Z&&!V&&X(!1)}}f&&o.length>f||(P==null||P(M.value),u==null||u(o))},[N,l,f,Z,V,E,H,P,u,p,_]),A=e.useMemo(()=>m?"•".repeat(l.length):l,[l,m]),h=Z||V,L=y==="system"?"":`nice-touch-keyboard--${y}`,x=vt[W];return r.jsxs("div",{ref:Y,className:["nice-touch-keyboard",`nice-touch-keyboard--${s}`,L,N?"nice-touch-keyboard--disabled":"",J].filter(Boolean).join(" "),"data-layout":n,"data-language":W,dir:oe.isRtlKeyboardLanguage(W)?"rtl":void 0,...F,children:[ne&&k.length>1&&r.jsx("div",{className:"nice-touch-keyboard-langbar",children:k.map(M=>{const o=vt[M];return r.jsx("button",{type:"button",className:`nice-touch-keyboard-langbar__btn ${M===W?"nice-touch-keyboard-langbar__btn--active":""}`,onClick:()=>{q(M),d==null||d(M)},disabled:N,children:(o==null?void 0:o.nativeName)??M.toUpperCase()},M)})}),I&&r.jsxs("div",{className:"nice-touch-keyboard-preview",children:[A||r.jsx("span",{className:"nice-touch-keyboard-placeholder",children:T}),r.jsx("span",{className:"nice-touch-keyboard-cursor"})]}),r.jsx("div",{className:"nice-touch-keyboard-keys",children:K.map((M,o)=>r.jsx("div",{className:"nice-touch-keyboard-row",children:M.map((b,R)=>{var ie;const j=b.type==="shift"&&Z||b.type==="caps"&&V||b.type==="lang"||b.value==="123"&&G||b.value==="ABC"&&!G||b.value==="#+="&&G;let te=b.label||b.value;b.type==="space"&&b.label==="Space"?te=$("touchKeyboard.space","Space"):b.value==="Call"&&b.label==="Call"?te=$("touchKeyboard.call","Call"):b.type==="lang"&&b.label==="Lang"&&(te=$("touchKeyboard.language","Lang")),h&&!b.type&&te.length===1&&(te=te.toUpperCase());const z=!b.type&&b.value.length===1&&((ie=x==null?void 0:x.accents)==null?void 0:ie[b.value.toLowerCase()]);return r.jsx("button",{type:"button",className:["nice-touch-keyboard-key",`nice-touch-keyboard-key--${b.type||"char"}`,j?"nice-touch-keyboard-key--active":"",z?"nice-touch-keyboard-key--has-accent":""].filter(Boolean).join(" "),style:{flex:b.width||1},onClick:()=>g(b),disabled:N,"aria-label":b.type==="backspace"?$("touchKeyboard.backspace","Backspace"):b.type==="enter"?$("touchKeyboard.enter","Enter"):void 0,children:b.icon||te},R)})},o))}),r.jsxs("div",{className:"nice-touch-keyboard-status",children:[V&&r.jsx("span",{className:"nice-touch-keyboard-status__item",children:$("touchKeyboard.caps","CAPS")}),x&&r.jsx("span",{className:"nice-touch-keyboard-status__item",children:x.nativeName})]})]})}),oc=e.forwardRef(function(n,c){return r.jsx(Fe,{ref:c,layout:"pin",masked:!0,maxLength:n.maxLength||6,...n})}),lc=e.forwardRef(function(n,c){return r.jsx(Fe,{ref:c,layout:"numpad",...n})}),uc=e.forwardRef(function(n,c){return r.jsx(Fe,{ref:c,layout:"phone",...n})}),dc=[],fc=[],xt=6;function hc({row:t,rowIndex:n,rowKey:c,columns:s,swipeActionsLeft:i=[],swipeActionsRight:a=[],selectable:d,selected:l,onSelect:f,onClick:y,haptic:w,swipeThreshold:C=80}){const[P,u]=e.useState(0),[p,N]=e.useState(!1),I=e.useRef(0),S=e.useRef(0),m=e.useRef(null),v=i.length>0,D=a.length>0,J=e.useCallback(()=>{if(!(!w||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[w]),F=e.useCallback(_=>{!v&&!D||(I.current=_.touches[0].clientX,S.current=_.touches[0].clientX,N(!0))},[v,D]),Y=e.useCallback(_=>{S.current=_;const E=S.current-I.current;let H=E;const g=v?C*i.length:0,A=D?C*a.length:0;H>g&&(H=g),H<-A&&(H=-A),!v&&H>0&&(H=E*.2),!D&&H<0&&(H=E*.2),u(H)},[v,D,C,i.length,a.length]),$=e.useCallback(_=>{p&&Y(_.touches[0].clientX)},[p,Y]),T=e.useCallback(()=>{if(!p)return;N(!1);const _=C*.5;P>_&&v?(u(C*i.length),J()):P<-_&&D?(u(-C*a.length),J()):u(0)},[p,P,C,v,D,i.length,a.length,J]),k=e.useRef(null),O=e.useRef(0),q=e.useRef(!1),W=e.useCallback(_=>{_.pointerType==="touch"||_.button!==0||!v&&!D||(k.current=_.pointerId,I.current=_.clientX,S.current=_.clientX,O.current=_.clientY)},[v,D]),Z=e.useCallback(_=>{var E,H;if(_.pointerId===k.current){if(!p){const g=_.clientX-I.current,A=_.clientY-O.current;if(Math.abs(g)<xt&&Math.abs(A)<xt)return;if(Math.abs(A)>Math.abs(g)){k.current=null;return}(H=(E=_.currentTarget).setPointerCapture)==null||H.call(E,_.pointerId),N(!0)}Y(_.clientX)}},[p,Y]),X=e.useCallback(_=>{_.pointerId===k.current&&(k.current=null,p&&(q.current=!0,T()))},[p,T]),V=e.useCallback(_=>{J(),_.onAction(t,n),u(0)},[t,n,J]),U=e.useCallback(()=>{if(q.current){q.current=!1;return}Math.abs(P)>10||(d&&f?f():y&&y())},[P,d,f,y]);e.useEffect(()=>{if(P===0)return;const _=E=>{m.current&&!m.current.contains(E.target)&&u(0)};return document.addEventListener("click",_),()=>document.removeEventListener("click",_)},[P]);const G={transform:P?`translateX(${P}px)`:void 0,transition:p?"none":"transform 0.2s ease-out",userSelect:p?"none":void 0},re=P!==0||p,ne=_=>{const E=_==="left"?i:a;if(!E.length||!re)return null;const H=_==="left"?"var(--nice-color-primary, #3b82f6)":"var(--nice-color-error, #ef4444)";return r.jsx("div",{className:`nice-touch-table-actions nice-touch-table-actions--${_}`,style:{width:C*E.length},children:E.map(g=>r.jsxs("button",{type:"button",className:"nice-touch-table-action",style:{backgroundColor:g.color||H,color:g.textColor||"var(--nice-color-white, #ffffff)",width:C},onClick:A=>{A.stopPropagation(),V(g)},children:[g.icon&&r.jsx("span",{className:"nice-touch-table__action-icon",children:g.icon}),r.jsx("span",{className:"nice-touch-table__action-label",children:g.label})]},g.id))})},K=s.length-1;return r.jsxs("tr",{ref:m,className:`nice-touch-table-row ${l?"nice-touch-table-row--selected":""} ${p?"nice-touch-table-row--swiping":""}`,onTouchStart:F,onTouchMove:$,onTouchEnd:T,onTouchCancel:T,onPointerDown:W,onPointerMove:Z,onPointerUp:X,onPointerCancel:X,onClick:U,"data-row-key":c,children:[d&&r.jsxs("td",{className:"nice-touch-table-cell nice-touch-table-cell--checkbox nice-touch-table-cell--edge",style:G,children:[ne("left"),r.jsx("input",{type:"checkbox",checked:l,onChange:()=>f==null?void 0:f(),onClick:_=>_.stopPropagation()})]}),s.map((_,E)=>{const H=typeof _.accessor=="function"?_.accessor(t):t[_.accessor],g=_.cell?_.cell(H,t,n):H,A=!d&&E===0,h=E===K;return r.jsxs("td",{className:`nice-touch-table-cell ${_.sticky?"nice-touch-table-cell--sticky":""} ${A||h?"nice-touch-table-cell--edge":""}`,style:{width:_.width,minWidth:_.minWidth,textAlign:_.align,...G},children:[A&&ne("left"),g,h&&ne("right")]},_.id)})]})}const bc=e.forwardRef(function({data:n=dc,columns:c=fc,rowKey:s,swipeActionsLeft:i,swipeActionsRight:a,selectable:d=!1,selectedKeys:l=[],onSelect:f,onRowClick:y,sortState:w,onSort:C,emptyContent:P="No data",loading:u=!1,haptic:p=!0,swipeThreshold:N=80,className:I="",...S},m){const v=e.useCallback(T=>typeof s=="function"?s(T):String(T[s]),[s]),D=e.useCallback(T=>{if(!T.sortable||!C)return;const k=(w==null?void 0:w.columnId)===T.id&&w.direction==="asc"?"desc":"asc";C({columnId:T.id,direction:k})},[w,C]),J=e.useCallback(()=>{f&&(l.length===n.length?f([]):f(n.map(T=>v(T))))},[n,l,f,v]),F=e.useCallback(T=>{if(!f)return;const k=l.includes(T)?l.filter(O=>O!==T):[...l,T];f(k)},[l,f]),Y=n.length>0&&l.length===n.length,$=l.length>0&&l.length<n.length;return r.jsxs("div",{ref:m,className:`nice-touch-table-container ${u?"nice-touch-table-container--loading":""} ${I}`,...S,children:[r.jsx("div",{className:"nice-touch-table-scroll",children:r.jsxs("table",{className:"nice-touch-table",children:[r.jsx("thead",{className:"nice-touch-table-head",children:r.jsxs("tr",{children:[d&&r.jsx("th",{className:"nice-touch-table-header nice-touch-table-header--checkbox",children:r.jsx("input",{type:"checkbox",checked:Y,ref:T=>{T&&(T.indeterminate=$)},onChange:J})}),c.map(T=>r.jsx("th",{className:`nice-touch-table-header ${T.sticky?"nice-touch-table-header--sticky":""} ${T.sortable?"nice-touch-table-header--sortable":""}`,style:{width:T.width,minWidth:T.minWidth,textAlign:T.align},onClick:()=>D(T),children:r.jsxs("span",{className:"nice-touch-table__header-content",children:[T.header,T.sortable&&r.jsx("span",{className:"nice-touch-table__sort-indicator","aria-hidden":"true",children:(w==null?void 0:w.columnId)===T.id&&r.jsx("span",{className:`nice-touch-table__sort-mark nice-touch-table__sort-mark--${w.direction}`})})]})},T.id))]})}),r.jsx("tbody",{className:"nice-touch-table-body",children:n.length===0?r.jsx("tr",{className:"nice-touch-table-empty",children:r.jsx("td",{colSpan:c.length+(d?1:0),children:P})}):n.map((T,k)=>{const O=v(T);return r.jsx(hc,{row:T,rowIndex:k,rowKey:O,columns:c,swipeActionsLeft:i,swipeActionsRight:a,selectable:d,selected:l.includes(O),onSelect:()=>F(O),onClick:()=>y==null?void 0:y(T,k),haptic:p,swipeThreshold:N},O)})})]})}),u&&r.jsx("div",{className:"nice-touch-table-loading",children:r.jsx("div",{className:"nice-touch-table-spinner"})})]})}),en=e.createContext(null);function tt(){const t=e.useContext(en);if(!t)throw new Error("useTouchForm must be used within NiceTouchForm");return t}function yt(t,n){for(const c of n){const s=String(t??"");switch(c.type){case"required":if(!t||typeof t=="string"&&!t.trim())return c.message;break;case"email":if(t&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s))return c.message;break;case"minLength":if(t&&s.length<c.value)return c.message;break;case"maxLength":if(t&&s.length>c.value)return c.message;break;case"pattern":if(t&&!new RegExp(c.value).test(s))return c.message;break;case"custom":if(c.validator&&!c.validator(t))return c.message;break}}return null}const mc=e.forwardRef(function({initialValues:n={},validation:c={},onSubmit:s,onChange:i,onError:a,enableNavigation:d=!0,haptic:l=!0,autoFocus:f=!1,validateOnBlur:y=!0,validateOnChange:w=!1,disabled:C=!1,children:P,className:u="",...p},N){const[I,S]=e.useState(n),[m,v]=e.useState([]),[D,J]=e.useState(new Set),[F,Y]=e.useState(!1),$=e.useRef(new Map),T=e.useRef([]),k=e.useRef(null),O=e.useCallback(()=>{if(!(!l||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[l]),q=e.useCallback((E,H)=>{const g=c[E];return g?yt(H,g):null},[c]),W=e.useCallback(()=>{const E=[];for(const[H,g]of Object.entries(c)){const A=yt(I[H],g);A&&E.push({field:H,message:A})}return E},[I,c]),Z=e.useCallback((E,H)=>{if(S(g=>{const A={...g,[E]:H};return i==null||i(A),A}),w){const g=q(E,H);v(A=>{const h=A.filter(L=>L.field!==E);return g?[...h,{field:E,message:g}]:h})}},[i,w,q]),X=e.useCallback(E=>{if(J(H=>new Set([...H,E])),y){const H=q(E,I[E]);v(g=>{const A=g.filter(h=>h.field!==E);return H?[...A,{field:E,message:H}]:A})}},[y,q,I]),V=e.useCallback(E=>{var g;const H=$.current.get(E);H&&((g=H.focus)==null||g.call(H),k.current=E)},[]),U=e.useCallback(()=>{if(!d)return;const E=T.current,H=k.current;if(!H){E.length>0&&V(E[0]);return}const g=E.indexOf(H);g<E.length-1&&(V(E[g+1]),O())},[d,V,O]),G=e.useCallback(()=>{if(!d)return;const E=T.current,H=k.current;if(!H)return;const g=E.indexOf(H);g>0&&(V(E[g-1]),O())},[d,V,O]),re=e.useCallback((E,H)=>{$.current.set(E,H),H&&!T.current.includes(E)&&T.current.push(E)},[]),ne=e.useCallback(E=>{$.current.delete(E),T.current=T.current.filter(H=>H!==E)},[]),K=e.useCallback(async E=>{if(E.preventDefault(),C||F)return;const H=W();if(H.length>0){v(H),a==null||a(H),O();const g=H[0];g&&V(g.field);return}Y(!0);try{await(s==null?void 0:s(I)),O()}catch(g){console.error("Form submission error:",g)}finally{Y(!1)}},[C,F,W,a,s,I,O,V]);e.useEffect(()=>{f&&T.current.length>0&&setTimeout(()=>V(T.current[0]),100)},[f,V]);const _=e.useMemo(()=>({values:I,errors:m,touched:D,setFieldValue:Z,setFieldTouched:X,focusField:V,focusNext:U,focusPrev:G,registerField:re,unregisterField:ne}),[I,m,D,Z,X,V,U,G,re,ne]);return r.jsx(en.Provider,{value:_,children:r.jsx("form",{ref:N,className:`nice-touch-form ${C?"nice-touch-form--disabled":""} ${F?"nice-touch-form--submitting":""} ${u}`,onSubmit:K,noValidate:!0,...p,children:P})})}),pc=e.forwardRef(function({name:n,label:c,type:s="text",placeholder:i,helperText:a,disabled:d=!1,readOnly:l=!1,autoComplete:f,inputMode:y,iconLeft:w,iconRight:C,maxLength:P,onChange:u,required:p,className:N="",...I},S){const m=tt(),v=e.useRef(null),[D,J]=e.useState(!1),F=m.values[n]??"",Y=m.errors.find(Z=>Z.field===n),T=m.touched.has(n)&&Y;e.useEffect(()=>(m.registerField(n,v.current),()=>m.unregisterField(n)),[n,m]);const k=e.useCallback(Z=>{const X=Z.target.value;m.setFieldValue(n,X),u==null||u(X)},[n,m,u]),O=e.useCallback(()=>{J(!0)},[]),q=e.useCallback(()=>{J(!1),m.setFieldTouched(n)},[n,m]),W=e.useCallback(Z=>{Z.key==="Enter"&&(Z.preventDefault(),m.focusNext())},[m]);return r.jsxs("div",{ref:S,className:`nice-touch-field ${D?"nice-touch-field--focused":""} ${T?"nice-touch-field--error":""} ${d?"nice-touch-field--disabled":""} ${N}`,...I,children:[c&&r.jsxs("label",{className:"nice-touch-field-label",htmlFor:`field-${n}`,children:[c,p&&r.jsx("span",{className:"nice-touch-form__required-indicator",children:"*"})]}),r.jsxs("div",{className:"nice-touch-field-input-wrapper",children:[w&&r.jsx("span",{className:"nice-touch-field-icon nice-touch-field-icon--left",children:w}),r.jsx("input",{ref:v,id:`field-${n}`,name:n,type:s,value:F,placeholder:i,disabled:d,readOnly:l,autoComplete:f,inputMode:y,maxLength:P,onChange:k,onFocus:O,onBlur:q,onKeyDown:W,className:"nice-touch-field-input","aria-invalid":T?"true":void 0,"aria-describedby":T?`${n}-error`:a?`${n}-helper`:void 0}),C&&r.jsx("span",{className:"nice-touch-field-icon nice-touch-field-icon--right",children:C})]}),T&&r.jsx("div",{id:`${n}-error`,className:"nice-touch-field-error",role:"alert",children:Y.message}),!T&&a&&r.jsx("div",{id:`${n}-helper`,className:"nice-touch-field-helper",children:a})]})}),gc=e.forwardRef(function({loading:n=!1,disabled:c=!1,fullWidth:s=!0,children:i,className:a="",...d},l){return r.jsx("button",{ref:l,type:"submit",className:`nice-touch-submit ${s?"nice-touch-submit--full-width":""} ${n?"nice-touch-submit--loading":""} ${a}`,disabled:c||n,...d,children:n?r.jsx("span",{className:"nice-touch-submit-spinner"}):i})}),vc=e.forwardRef(function({doneText:n,showDone:c=!0,onDone:s,className:i="",...a},d){const{t:l}=oe.useNiceTranslation(),f=n??l("touchForm.done","Done"),y=tt(),w=e.useCallback(()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur(),s==null||s()},[s]);return r.jsxs("div",{ref:d,className:`nice-touch-navbar ${i}`,...a,children:[r.jsxs("div",{className:"nice-touch-navbar-arrows",children:[r.jsx("button",{type:"button",onClick:y.focusPrev,"aria-label":l("touchForm.previousField","Previous field"),children:r.jsx("span",{className:"nice-touch-navbar-mark nice-touch-navbar-mark--prev","aria-hidden":"true"})}),r.jsx("button",{type:"button",onClick:y.focusNext,"aria-label":l("touchForm.nextField","Next field"),children:r.jsx("span",{className:"nice-touch-navbar-mark nice-touch-navbar-mark--next","aria-hidden":"true"})})]}),c&&r.jsx("button",{type:"button",className:"nice-touch-navbar-done",onClick:w,children:f})]})});exports.DEFAULT_BREAKPOINTS=Ye;exports.DotsIndicator=cn;exports.DrawerIcons=Cn;exports.EmojiIndicator=an;exports.HAPTIC_PATTERNS=Ze;exports.HapticPatternBuilder=Kt;exports.HeaderIcons=Zn;exports.HeroHeader=rr;exports.IOSHeader=tr;exports.IOSIndicator=on;exports.LineIndicator=sn;exports.MaterialHeader=nr;exports.MaterialIndicator=ln;exports.NiceBottomSheet=bn;exports.NiceBreakpointProvider=zr;exports.NiceCalculatorKeyboard=lc;exports.NiceConfirmSheet=Yn;exports.NiceDateRangePicker=xr;exports.NiceDrawingToolbar=ac;exports.NiceFAB=Zr;exports.NiceGestures=He;exports.NiceHapticsProvider=Pr;exports.NiceHide=Vr;exports.NiceImageGallery=gn;exports.NiceInfiniteScroll=Tn;exports.NiceMobileActionSheet=Hn;exports.NiceMobileCalendar=Qe;exports.NiceMobileDatePicker=ur;exports.NiceMobileDraggable=kr;exports.NiceMobileDrawer=Pn;exports.NiceMobileHeader=Ae;exports.NiceMobileModal=We;exports.NiceMobilePicker=Je;exports.NiceMobilePullToRefresh=jt;exports.NiceMobileTabs=Kn;exports.NiceMobileTimePicker=or;exports.NiceMultiDatePicker=yr;exports.NicePINKeyboard=oc;exports.NicePhoneKeyboard=uc;exports.NicePickerColumn=Ht;exports.NicePinchZoom=Nr;exports.NicePullToRefresh=jt;exports.NiceShow=Or;exports.NiceSignaturePad=Zt;exports.NiceSwipeActions=un;exports.NiceSwipeList=dn;exports.NiceSwipeable=jr;exports.NiceTouchActionSheet=Et;exports.NiceTouchButton=et;exports.NiceTouchColorPicker=tc;exports.NiceTouchDrawing=cc;exports.NiceTouchField=pc;exports.NiceTouchForm=mc;exports.NiceTouchIconButton=Qr;exports.NiceTouchKeyboard=Fe;exports.NiceTouchMenu=Fn;exports.NiceTouchMenuPopover=$t;exports.NiceTouchNavBar=vc;exports.NiceTouchSignaturePad=Zt;exports.NiceTouchSlider=ec;exports.NiceTouchSubmit=gc;exports.NiceTouchTable=bc;exports.PullToRefreshDefaultIndicator=kt;exports.SwipeActionPresets=fn;exports.SwipeGroupProvider=Mt;exports.TabIcons=be;exports.TabPresets=Un;exports.cancelVibration=Ir;exports.colorUtils=nc;exports.createHapticPattern=Yr;exports.createMediaQuery=Kr;exports.generateNumberItems=Re;exports.getCurrentBreakpoint=Gt;exports.hapticFeedback=Cr;exports.isMobileDevice=Xr;exports.isTouch=Gr;exports.isVibrationSupported=ke;exports.responsive=Ur;exports.useBreakpoint=Pe;exports.useBreakpointContext=Fr;exports.useButtonHaptic=Er;exports.useCalendar=Ft;exports.useCollapsingHeader=Gn;exports.useDrawer=Dn;exports.useGestures=Ot;exports.useGesturesContext=wr;exports.useHaptics=ye;exports.useHapticsContext=Sr;exports.useImpactHaptic=Hr;exports.useInfiniteData=Mn;exports.useInfiniteScroll=xn;exports.useMediaQuery=Xt;exports.useMobileBreakpoint=Pe;exports.useMobileCalendar=dr;exports.useMobileDrawer=Sn;exports.useMobileHeader=Xn;exports.useMobileMediaQuery=Xt;exports.useMobileModal=$n;exports.useMobilePicker=ir;exports.useMobilePullToRefresh=Nt;exports.useMobileTabs=On;exports.useModal=En;exports.useNotificationHaptic=Ar;exports.usePullToRefresh=Nt;exports.useSelectionHaptic=Lr;exports.useSwipeGroup=Rt;exports.useTabs=Vn;exports.useToggleHaptic=_r;exports.useTouchForm=tt;exports.useTouchSlider=Wt;exports.useVirtualList=Rn;exports.useWheelPicker=ar;exports.vibrate=Dr;exports.withHaptics=$r;