@nice2dev/ui-mobile 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +22 -22
- package/dist/index.d.ts +38 -18
- package/dist/index.mjs +5389 -5793
- package/dist/ui-mobile.css +1 -1
- package/package.json +5 -1
package/dist/index.cjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use strict";var rn=Object.defineProperty;var sn=(n,r,s)=>r in n?rn(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s;var tt=(n,r,s)=>sn(n,typeof r!="symbol"?r+"":r,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("react"),xt=e.createContext(null);function gt(){const n=e.useContext(xt);if(!n)throw new Error("usePullToRefresh must be used within NicePullToRefresh");return n}function Me(n="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}const yt=({state:n,progress:r,pullDistance:s,threshold:c})=>{const a=r*360,l=Math.min(1,r),u=()=>{switch(n){case"pulling":return t.jsxs("svg",{className:"ptr-icon ptr-icon-arrow",style:{transform:`rotate(${Math.min(a,180)}deg)`},width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),t.jsx("polyline",{points:"19 12 12 19 5 12"})]});case"ready":return t.jsxs("svg",{className:"ptr-icon ptr-icon-ready",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]});case"refreshing":return t.jsxs("svg",{className:"ptr-icon ptr-icon-spinner",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"6"}),t.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"22"}),t.jsx("line",{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76"}),t.jsx("line",{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07"}),t.jsx("line",{x1:"2",y1:"12",x2:"6",y2:"12"}),t.jsx("line",{x1:"18",y1:"12",x2:"22",y2:"12"}),t.jsx("line",{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24"}),t.jsx("line",{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93"})]});case"success":return t.jsx("svg",{className:"ptr-icon ptr-icon-success",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"20 6 9 17 4 12"})});case"error":return t.jsxs("svg",{className:"ptr-icon ptr-icon-error",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]});default:return null}},o=()=>{switch(n){case"pulling":return"Pull down to refresh";case"ready":return"Release to refresh";case"refreshing":return"Refreshing...";case"success":return"Updated!";case"error":return"Failed to refresh";default:return""}};return t.jsxs("div",{className:`ptr-indicator ptr-indicator--${n}`,style:{opacity:n==="idle"?0:Math.max(.3,r),transform:`scale(${l})`},role:"status","aria-live":"polite",children:[t.jsx("div",{className:"ptr-indicator-icon",children:u()}),t.jsx("span",{className:"ptr-indicator-text",children:o()}),n==="pulling"&&t.jsx("div",{className:"ptr-progress-ring",children:t.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 32 32",children:[t.jsx("circle",{className:"ptr-progress-bg",cx:"16",cy:"16",r:"14",fill:"none",strokeWidth:"2"}),t.jsx("circle",{className:"ptr-progress-fill",cx:"16",cy:"16",r:"14",fill:"none",strokeWidth:"2",strokeDasharray:`${88*r} 88`,transform:"rotate(-90 16 16)"})]})})]})},qe=e.forwardRef(({children:n,onRefresh:r,indicator:s,threshold:c=80,maxPull:a=150,resistance:l=.4,completionDuration:u=1e3,hapticFeedback:o=!0,disabled:b=!1,onPullStart:N,onPullProgress:y,onRefreshSuccess:w,onRefreshError:R,className:f="",style:v,ariaLabel:p="Pull to refresh"},S)=>{const[D,M]=e.useState("idle"),[g,F]=e.useState(0),Y=e.useRef(null),B=e.useRef(null),z=e.useRef(0),H=e.useRef(0),x=e.useRef(!1),k=e.useRef(!1),X=Math.min(1,g/c),U=D==="refreshing",A=e.useCallback(()=>g<=0?0:((E,V,d)=>{const T=E*(1-d);return Math.min(V,T+T*d/2)})(g,a,l),[g,a,l]),L=e.useCallback(async()=>{if(!(D==="refreshing"||b)){M("refreshing"),o&&Me("medium");try{await r(),M("success"),o&&Me("heavy"),w==null||w()}catch(C){M("error"),o&&Me("light"),R==null||R(C instanceof Error?C:new Error("Refresh failed"))}setTimeout(()=>{M("idle"),F(0)},u)}},[D,b,o,r,w,R,u]),G=e.useCallback(C=>{if(b||D==="refreshing")return;const E=B.current,V=(E==null?void 0:E.scrollTop)??0;V>0||(z.current=C.touches[0].clientY,H.current=V,k.current=!1)},[b,D]),O=e.useCallback(C=>{if(b||D==="refreshing")return;const E=B.current;if(((E==null?void 0:E.scrollTop)??0)>0&&!x.current)return;const T=C.touches[0].clientY-z.current;if(T<=0){x.current&&(x.current=!1,M("idle"),F(0));return}x.current||(x.current=!0,N==null||N(),M("pulling")),C.preventDefault(),F(T);const I=Math.min(1,T/c);y==null||y(I),T>=c?D!=="ready"&&(M("ready"),o&&!k.current&&(Me("light"),k.current=!0)):D==="ready"&&(M("pulling"),k.current=!1)},[b,D,c,o,N,y]),q=e.useCallback(()=>{x.current&&(x.current=!1,D==="ready"?L():(M("idle"),F(0)))},[D,L]),J=e.useCallback(C=>{(C.key==="F5"||C.ctrlKey&&C.key==="r")&&(C.preventDefault(),L())},[L]),Z=e.useCallback(C=>{Y.current=C,typeof S=="function"?S(C):S&&(S.current=C)},[S]),ee={state:D,progress:X,isRefreshing:U,triggerRefresh:L},$=A();return t.jsx(xt.Provider,{value:ee,children:t.jsxs("div",{ref:Z,className:`nice-ptr ${f} nice-ptr--${D}`,style:v,onTouchStart:G,onTouchMove:O,onTouchEnd:q,onKeyDown:J,tabIndex:0,role:"region","aria-label":p,"data-state":D,"data-disabled":b||void 0,children:[t.jsx("div",{className:"nice-ptr-indicator-wrapper",style:{height:$,opacity:D==="idle"?0:1},children:s?t.jsx(s,{state:D,progress:X,pullDistance:g,threshold:c}):t.jsx(yt,{state:D,progress:X,pullDistance:g,threshold:c})}),t.jsx("div",{ref:B,className:"nice-ptr-content",style:{transform:D==="refreshing"?`translateY(${c}px)`:`translateY(${$}px)`,transition:x.current?"none":"transform 0.3s cubic-bezier(0.23, 1, 0.32, 1)"},children:n})]})})});qe.displayName="NicePullToRefresh";const cn=({state:n,progress:r})=>t.jsxs("div",{className:`ptr-dots ptr-dots--${n}`,children:[t.jsx("span",{className:"ptr-dot",style:{opacity:Math.min(1,r*3)}}),t.jsx("span",{className:"ptr-dot",style:{opacity:Math.min(1,(r-.33)*3)}}),t.jsx("span",{className:"ptr-dot",style:{opacity:Math.min(1,(r-.66)*3)}})]}),an=({state:n,progress:r})=>t.jsx("div",{className:`ptr-line ptr-line--${n}`,children:t.jsx("div",{className:"ptr-line-fill",style:{width:`${r*100}%`}})}),ln=({state:n})=>{const r={idle:"",pulling:"👇",ready:"🔄",refreshing:"⏳",success:"✅",error:"❌"};return t.jsx("div",{className:`ptr-emoji ptr-emoji--${n}`,children:t.jsx("span",{className:"ptr-emoji-icon",children:r[n]})})},on=({state:n,progress:r})=>t.jsx("div",{className:`ptr-ios ptr-ios--${n}`,children:t.jsx("div",{className:"ptr-ios-spinner",children:Array.from({length:12}).map((c,a)=>{const l=a/12*360,u=a/12*1,o=n==="refreshing"?void 0:Math.min(1,r*2-a*.08);return t.jsx("div",{className:"ptr-ios-bar",style:{transform:`rotate(${l}deg) translateY(-8px)`,animationDelay:`${u}s`,opacity:o}},a)})})}),un=({state:n,progress:r})=>t.jsxs("div",{className:`ptr-material ptr-material--${n}`,children:[t.jsxs("svg",{className:"ptr-material-circle",viewBox:"0 0 36 36",width:"36",height:"36",children:[t.jsx("circle",{className:"ptr-material-bg",cx:"18",cy:"18",r:"16",fill:"none",strokeWidth:"3"}),t.jsx("circle",{className:"ptr-material-progress",cx:"18",cy:"18",r:"16",fill:"none",strokeWidth:"3",strokeDasharray:`${100*r} 100`,strokeLinecap:"round",transform:"rotate(-90 18 18)"})]}),(n==="success"||n==="error")&&t.jsx("span",{className:"ptr-material-icon",children:n==="success"?t.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)"}}):"!"})]}),nt=6,wt=e.createContext(null),kt=({children:n})=>{const[r,s]=e.useState(null);return t.jsx(wt.Provider,{value:{activeItemId:r,setActiveItemId:s},children:n})};function jt(){return e.useContext(wt)}function Re(n="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}const rt=({action:n,width:r,progress:s,index:c,total:a,side:l,onTrigger:u})=>{const o=Math.min(1,s*2),b=l==="right"?(a-1-c)*.05:c*.05;return t.jsxs("button",{className:`nice-swipe-action nice-swipe-action--${l} ${n.destructive?"nice-swipe-action--destructive":""}`,style:{width:r,background:n.background||"var(--nice-color-primary, #3b82f6)",color:n.color||"var(--nice-color-white, #ffffff)",transform:`scale(${o})`,transitionDelay:`${b}s`},onClick:u,"aria-label":n.label,children:[n.icon&&t.jsx("span",{className:"nice-swipe-action-icon",children:n.icon}),t.jsx("span",{className:"nice-swipe-action-label",children:n.label})]})},Nt=e.forwardRef(({children:n,leftActions:r=[],rightActions:s=[],actionWidth:c=72,threshold:a=.4,direction:l,exclusive:u=!0,onSwipeStart:o,onSwipeEnd:b,onAction:N,disabled:y=!1,className:w="",style:R,itemId:f,hapticFeedback:v=!0},p)=>{const S=jt(),[D,M]=e.useState(0),[g,F]=e.useState(null),[Y,B]=e.useState(!1),z=e.useRef(null),H=e.useRef(0),x=e.useRef(0),k=e.useRef(0),X=e.useRef(!1),U=e.useRef(null),A=e.useRef(!1),L=-(r.length*c),G=s.length*c,O=(l==="left"||l==="both"||!l)&&r.length>0,q=(l==="right"||l==="both"||!l)&&s.length>0,J=Math.min(1,Math.abs(D)/Math.abs(L)),Z=Math.min(1,D/G),ee=e.useMemo(()=>f||`swipe-${Math.random().toString(36).substr(2,9)}`,[f]),$=e.useCallback(()=>{B(!0),M(0),F(null),setTimeout(()=>B(!1),300)},[]);e.useEffect(()=>{u&&S&&S.activeItemId!==null&&S.activeItemId!==ee&&g&&$()},[u,S,ee,g,$]);const C=e.useRef(null),E=e.useRef(!1),[V,d]=e.useState(!1),T=e.useCallback(h=>{y||Y||C.current!==null||h.pointerType==="mouse"&&h.button!==0||(C.current=h.pointerId,H.current=h.clientX,x.current=h.clientY,k.current=D,X.current=!1,U.current=null,A.current=!1)},[y,Y,D]),I=e.useCallback(h=>{var re,se;if(h.pointerId!==C.current||y||Y)return;const W=h.clientX-H.current,te=h.clientY-x.current;if(!X.current){if(Math.abs(W)<nt&&Math.abs(te)<nt)return;if(Math.abs(W)<Math.abs(te)){C.current=null;return}X.current=!0,U.current=W<0?"left":"right",(se=(re=h.currentTarget).setPointerCapture)==null||se.call(re,h.pointerId),d(!0),o==null||o(U.current),u&&S&&S.setActiveItemId(ee)}let ce=k.current+W;if(!O&&ce<0&&(ce=Math.max(ce,-30)*.3),!q&&ce>0&&(ce=Math.min(ce,30)*.3),O&&ce<L){const le=L-ce;ce=L-le*.3}if(q&&ce>G){const le=ce-G;ce=G+le*.3}const ne=U.current==="left"?Math.abs(L)*a:G*a,ae=U.current==="left"?Math.abs(ce):ce;ae>=ne&&!A.current?(A.current=!0,v&&Re("light")):ae<ne&&A.current&&(A.current=!1),M(ce),h.preventDefault()},[y,Y,O,q,L,G,a,v,u,S,ee,o]),j=e.useCallback(h=>{if(h.pointerId!==C.current||(C.current=null,!X.current))return;X.current=!1,E.current=!0,d(!1),B(!0);const W=Math.abs(L)*a,te=G*a;let ce=0,ne=null;U.current==="left"&&O?Math.abs(D)>=W&&(ce=L,ne="left",v&&Re("medium")):U.current==="right"&&q&&D>=te&&(ce=G,ne="right",v&&Re("medium")),(g==="left"&&D>0||g==="right"&&D<0)&&(ce=0,ne=null),M(ce),F(ne),b==null||b(ne),setTimeout(()=>B(!1),300)},[D,L,G,a,O,q,g,v,b]),i=e.useCallback((h,W)=>{h.onClick(),N==null||N(h,W),v&&Re("heavy"),$()},[N,v,$]),m=e.useCallback(h=>{h.key==="Escape"&&g&&$()},[g,$]),P=e.useCallback(h=>{z.current=h,typeof p=="function"?p(h):p&&(p.current=h)},[p]);return t.jsxs("div",{ref:P,className:`nice-swipe-container ${w} ${g?`nice-swipe-container--open-${g}`:""}`,style:R,onKeyDown:m,tabIndex:0,role:"listitem","aria-label":g?`Swipe actions ${g} visible`:"Swipe for actions","data-disabled":y||void 0,children:[s.length>0&&t.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--left",style:{width:G},children:s.map((h,W)=>t.jsx(rt,{action:h,width:c,progress:Z,index:W,total:s.length,side:"right",onTrigger:()=>i(h,"right")},h.id))}),t.jsx("div",{className:"nice-swipe-content",style:{transform:`translateX(${D}px)`,transition:Y?"transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)":"none",userSelect:V?"none":void 0},onPointerDown:T,onPointerMove:I,onPointerUp:j,onPointerCancel:j,onClickCapture:h=>{E.current&&(E.current=!1,h.stopPropagation(),h.preventDefault())},children:n}),r.length>0&&t.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--right",style:{width:Math.abs(L)},children:r.map((h,W)=>t.jsx(rt,{action:h,width:c,progress:J,index:W,total:r.length,side:"left",onTrigger:()=>i(h,"left")},h.id))})]})});Nt.displayName="NiceSwipeActions";const dn=({children:n,className:r="",style:s})=>t.jsx(kt,{children:t.jsx("div",{className:`nice-swipe-list ${r}`,style:s,role:"list",children:n})}),fn={delete:n=>({id:"delete",label:"Delete",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"3 6 5 6 21 6"}),t.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),background:"var(--nice-color-error, #ef4444)",destructive:!0,onClick:n}),edit:n=>({id:"edit",label:"Edit",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),t.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),background:"var(--nice-color-primary, #3b82f6)",onClick:n}),archive:n=>({id:"archive",label:"Archive",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"21 8 21 21 3 21 3 8"}),t.jsx("rect",{x:"1",y:"3",width:"22",height:"5"}),t.jsx("line",{x1:"10",y1:"12",x2:"14",y2:"12"})]}),background:"var(--nice-bg-tertiary, #6b7280)",onClick:n}),star:n=>({id:"star",label:"Star",icon:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),background:"var(--nice-color-warning, #eab308)",onClick:n}),share:n=>({id:"share",label:"Share",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"18",cy:"5",r:"3"}),t.jsx("circle",{cx:"6",cy:"12",r:"3"}),t.jsx("circle",{cx:"18",cy:"19",r:"3"}),t.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),t.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),background:"var(--nice-color-success, #22c55e)",onClick:n}),pin:n=>({id:"pin",label:"Pin",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"22"}),t.jsx("path",{d:"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"})]}),background:"var(--nice-color-accent, #8b5cf6)",onClick:n}),mute:n=>({id:"mute",label:"Mute",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M11 5L6 9H2v6h4l5 4V5z"}),t.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),t.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}),background:"var(--nice-bg-tertiary, #64748b)",onClick:n}),reply:n=>({id:"reply",label:"Reply",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"9 17 4 12 9 7"}),t.jsx("path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"})]}),background:"var(--nice-color-info, #0ea5e9)",onClick:n})};function st(n="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}function hn(n,r,s){return n==="full"?r*.95:n==="content"?Math.min(s,r*.9):r*n/100}const Mt=e.forwardRef(({children:n,open:r,onClose:s,onSnapChange:c,snapPoints:a=[50,100],initialSnap:l=0,header:u,footer:o,showHandle:b=!0,showBackdrop:N=!0,closeOnBackdrop:y=!0,closeOnEscape:w=!0,dismissible:R=!0,velocityThreshold:f=.5,hapticFeedback:v=!0,handleColor:p,borderRadius:S=16,zIndex:D=1e3,className:M="",style:g,ariaLabel:F="Bottom sheet",size:Y="md",disabled:B=!1,loading:z=!1,error:H},x)=>{const[k,X]=e.useState(l),[U,A]=e.useState(0),[L,G]=e.useState(!1),[O,q]=e.useState(typeof window<"u"?window.innerHeight:800),[J,Z]=e.useState(400),ee=e.useRef(null),$=e.useRef(null),C=e.useRef(0),E=e.useRef(0),V=e.useRef(0),d=e.useRef(0),T=e.useRef(0),I=e.useRef(-1),j=a.map(re=>hn(re,O,J)),i=j[k]??j[0];e.useImperativeHandle(x,()=>({snapTo:re=>{re>=0&&re<a.length&&(X(re),A(0),c==null||c(re,j[re]))},close:()=>s(),getCurrentSnap:()=>k})),e.useEffect(()=>{const re=()=>{q(window.innerHeight)};return window.addEventListener("resize",re),()=>window.removeEventListener("resize",re)},[]),e.useEffect(()=>{if($.current&&r){const re=$.current.scrollHeight;Z(re+60)}},[r,n]),e.useEffect(()=>{if(!r||!w)return;const re=se=>{se.key==="Escape"&&s()};return document.addEventListener("keydown",re),()=>document.removeEventListener("keydown",re)},[r,w,s]),e.useEffect(()=>{if(r){const re=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=re}}},[r]);const m=e.useCallback(re=>{const se=O-i+re,le=O-se;for(let _=0;_<j.length;_++){const K=j[_];if(Math.abs(le-K)<20&&I.current!==_){I.current=_,v&&st("light");break}}},[O,i,j,v]),P=e.useCallback((re,se)=>{if(se>f*2&&R&&re<j[0]*.5)return-1;if(se<-f)return j.length-1;if(se>f)return R&&re<j[0]*.7?-1:0;let le=0,_=Math.abs(re-j[0]);for(let K=1;K<j.length;K++){const Q=Math.abs(re-j[K]);Q<_&&(_=Q,le=K)}return R&&re<j[0]*.5?-1:le},[j,f,R]),h=e.useCallback(re=>{C.current=re.touches[0].clientY,E.current=U,V.current=re.touches[0].clientY,d.current=Date.now(),T.current=0,I.current=-1,G(!0)},[U]),W=e.useCallback(re=>{if(!L)return;const se=re.touches[0].clientY,le=se-C.current,_=Date.now(),K=_-d.current;K>0&&(T.current=(se-V.current)/K),V.current=se,d.current=_;let Q=E.current+le;const ie=i+50;if(Q>ie){const ue=Q-ie;Q=ie+ue*.2}const oe=-(O*.95-i);if(Q<oe){const ue=oe-Q;Q=oe-ue*.2}A(Q),m(Q),re.preventDefault()},[L,i,O,m]),te=e.useCallback(()=>{if(!L)return;G(!1);const re=i-U,se=P(re,T.current);if(se===-1)A(i+100),setTimeout(()=>{s(),A(0),X(l)},300);else{const le=j[se];A(0),X(se),se!==k&&(c==null||c(se,le),v&&st("medium"))}},[L,i,U,P,k,j,s,c,l,v]),ce=e.useCallback(re=>{y&&re.target===re.currentTarget&&s()},[y,s]);if(!r)return null;const ne=Math.max(0,i-U),ae=Math.min(.5,ne/O*.8);return t.jsxs("div",{className:`nice-bottom-sheet-container ${M}`,style:{zIndex:D},children:[N&&t.jsx("div",{className:"nice-bottom-sheet-backdrop",style:{opacity:ae},onMouseDown:ce,"aria-hidden":"true"}),t.jsxs("div",{ref:ee,className:`nice-bottom-sheet nice-bottom-sheet--${Y} ${L?"nice-bottom-sheet--dragging":""} ${B?"nice-bottom-sheet--disabled":""} ${z?"nice-bottom-sheet--loading":""} ${H?"nice-bottom-sheet--error":""}`,style:{...g,height:ne,borderTopLeftRadius:S,borderTopRightRadius:S,transition:L?"none":"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},role:"dialog","aria-modal":"true","aria-label":F,"aria-disabled":B||void 0,"aria-busy":z||void 0,children:[H&&t.jsx("div",{className:"nice-bottom-sheet-error",role:"alert",children:H}),z&&t.jsx("span",{className:"nice-bottom-sheet-spinner","aria-hidden":"true",children:t.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),b&&t.jsx("div",{className:"nice-bottom-sheet-handle",onTouchStart:h,onTouchMove:W,onTouchEnd:te,children:t.jsx("div",{className:"nice-bottom-sheet-handle-bar",style:p?{backgroundColor:p}:void 0})}),u&&t.jsx("div",{className:"nice-bottom-sheet-header",children:u}),t.jsx("div",{ref:$,className:"nice-bottom-sheet-content",onTouchStart:h,onTouchMove:W,onTouchEnd:te,children:n}),o&&t.jsx("div",{className:"nice-bottom-sheet-footer",children:o})]})]})});Mt.displayName="NiceBottomSheet";function vn(n="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}function ct(n,r){return Math.hypot(r.x-n.x,r.y-n.y)}function it(n,r){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}const Rt=e.forwardRef(({items:n,selectedIndex:r=0,onIndexChange:s,onClose:c,showClose:a=!0,showCounter:l=!0,showCaption:u=!0,showThumbnails:o=!1,enablePinchZoom:b=!0,enableDoubleTapZoom:N=!0,enableSwipe:y=!0,enableKeyboard:w=!0,minZoom:R=1,maxZoom:f=4,doubleTapZoom:v=2.5,swipeThreshold:p=50,loop:S=!0,hapticFeedback:D=!0,backgroundColor:M="var(--nice-overlay-95, rgba(0, 0, 0, 0.95))",zIndex:g=2e3,className:F="",style:Y},B)=>{const[z,H]=e.useState(r),[x,k]=e.useState(1),[X,U]=e.useState(0),[A,L]=e.useState(0),[G,O]=e.useState(!1),[q,J]=e.useState({}),Z=e.useRef(null),ee=e.useRef(null),$=e.useRef([]),C=e.useRef(0),E=e.useRef(1),V=e.useRef({x:0,y:0}),d=e.useRef(0),T=e.useRef({x:0,y:0}),I=e.useRef(!1),j=e.useRef(!1),i=e.useRef(null),m=n[z],P=e.useCallback(_=>{let K=_;S?K=(_%n.length+n.length)%n.length:K=Math.max(0,Math.min(n.length-1,_)),K!==z&&(O(!0),H(K),k(1),U(0),L(0),s==null||s(K,n[K]),D&&vn("light"),setTimeout(()=>O(!1),300))},[z,n,S,s,D]),h=e.useCallback(()=>P(z+1),[P,z]),W=e.useCallback(()=>P(z-1),[P,z]),te=e.useCallback((_,K,Q)=>{const ie=Math.max(R,Math.min(f,_));k(ie),ie<=1&&(U(0),L(0))},[R,f]),ce=e.useCallback(()=>te(x*1.5),[x,te]),ne=e.useCallback(()=>te(x/1.5),[x,te]),ae=e.useCallback(()=>{k(1),U(0),L(0)},[]);e.useImperativeHandle(B,()=>({goTo:P,goNext:h,goPrev:W,zoomIn:ce,zoomOut:ne,resetZoom:ae,close:()=>c==null?void 0:c()})),e.useEffect(()=>{if(!w)return;const _=K=>{switch(K.key){case"ArrowLeft":W();break;case"ArrowRight":h();break;case"ArrowUp":ce();break;case"ArrowDown":ne();break;case"Escape":c==null||c();break;case"0":case"Home":ae();break}};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[w,h,W,ce,ne,ae,c]);const re=e.useCallback(_=>{const K=Array.from(_.touches).map(Q=>({x:Q.clientX,y:Q.clientY,id:Q.identifier}));if($.current=K,T.current={x:K[0].x,y:K[0].y},j.current=!1,i.current=null,K.length===2&&b)I.current=!0,C.current=ct(K[0],K[1]),E.current=x,V.current={x:X,y:A};else if(K.length===1){const Q=Date.now();Q-d.current<300&&N?(x>1.1?ae():te(v,K[0].x,K[0].y),d.current=0):d.current=Q,V.current={x:X,y:A}}},[x,X,A,b,N,v,ae,te]),se=e.useCallback(_=>{const K=Array.from(_.touches).map(Q=>({x:Q.clientX,y:Q.clientY,id:Q.identifier}));if(K.length===2&&I.current&&b){const ie=ct(K[0],K[1])/C.current,oe=E.current*ie;te(oe);const ue=it(K[0],K[1]),fe=it($.current[0],$.current[1]||$.current[0]),he=ue.x-fe.x,Ye=ue.y-fe.y;U(V.current.x+he),L(V.current.y+Ye),_.preventDefault()}else if(K.length===1){const Q=K[0].x-T.current.x,ie=K[0].y-T.current.y;if(i.current||(Math.abs(Q)>10||Math.abs(ie)>10)&&(i.current=Math.abs(Q)>Math.abs(ie)?"horizontal":"vertical",j.current=!0),x>1.1){const oe=V.current.x+Q,ue=V.current.y+ie;U(oe),L(ue)}_.preventDefault()}},[x,b,te]),le=e.useCallback(_=>{if(I.current){I.current=!1;return}const K=_.changedTouches[0],Q=K.clientX-T.current.x;K.clientY-T.current.y,y&&x<=1.1&&i.current==="horizontal"&&(Q>p?W():Q<-p&&h()),x<=1.1&&(U(0),L(0)),j.current=!1,i.current=null},[x,y,p,h,W]);return e.useEffect(()=>{n.forEach((_,K)=>{const Q=new Image;Q.onload=()=>{J(ie=>({...ie,[K]:!0}))},Q.src=_.src})},[n]),n.length===0?null:t.jsxs("div",{ref:Z,className:`nice-image-gallery ${F}`,style:{...Y,backgroundColor:M,zIndex:g},role:"dialog","aria-modal":"true","aria-label":"Image gallery",children:[t.jsxs("div",{className:"nice-image-gallery-header",children:[l&&t.jsxs("span",{className:"nice-image-gallery-counter",children:[z+1," / ",n.length]}),t.jsxs("div",{className:"nice-image-gallery-actions",children:[t.jsx("button",{className:"nice-image-gallery-btn",onClick:ne,disabled:x<=R,"aria-label":"Zoom out",children:t.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--minus","aria-hidden":"true"})}),t.jsx("button",{className:"nice-image-gallery-btn",onClick:ce,disabled:x>=f,"aria-label":"Zoom in",children:t.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--plus","aria-hidden":"true"})}),a&&t.jsx("button",{className:"nice-image-gallery-btn nice-image-gallery-close",onClick:c,"aria-label":"Close",children:t.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--close","aria-hidden":"true"})})]})]}),t.jsxs("div",{className:"nice-image-gallery-viewport",onTouchStart:re,onTouchMove:se,onTouchEnd:le,children:[t.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--prev",onClick:W,disabled:!S&&z===0,"aria-label":"Previous image",children:t.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--prev","aria-hidden":"true"})}),t.jsxs("div",{className:"nice-image-gallery-image-container",children:[m.placeholder&&!q[z]&&t.jsx("div",{className:"nice-image-gallery-placeholder",style:{backgroundColor:m.placeholder}}),t.jsx("img",{ref:ee,src:m.src,alt:m.alt||m.title||"",className:`nice-image-gallery-image ${G?"nice-image-gallery-image--animating":""}`,style:{transform:`scale(${x}) translate(${X/x}px, ${A/x}px)`,transition:I.current||j.current?"none":"transform 0.2s ease-out"},draggable:!1})]}),t.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--next",onClick:h,disabled:!S&&z===n.length-1,"aria-label":"Next image",children:t.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--next","aria-hidden":"true"})})]}),u&&m.title&&t.jsxs("div",{className:"nice-image-gallery-caption",children:[t.jsx("h3",{children:m.title}),m.description&&t.jsx("p",{children:m.description})]}),o&&n.length>1&&t.jsx("div",{className:"nice-image-gallery-thumbnails",children:n.map((_,K)=>t.jsx("button",{className:`nice-image-gallery-thumb ${K===z?"nice-image-gallery-thumb--active":""}`,onClick:()=>P(K),"aria-label":`Go to image ${K+1}`,children:t.jsx("img",{src:_.thumbnail||_.src,alt:_.alt||"",loading:"lazy"})},K))}),!o&&n.length>1&&n.length<=10&&t.jsx("div",{className:"nice-image-gallery-dots",children:n.map((_,K)=>t.jsx("button",{className:`nice-image-gallery-dot ${K===z?"nice-image-gallery-dot--active":""}`,onClick:()=>P(K),"aria-label":`Go to image ${K+1}`},K))})]})});Rt.displayName="NiceImageGallery";const Tt=e.createContext(null);function mn(){const n=e.useContext(Tt);if(!n)throw new Error("useInfiniteScroll must be used within NiceInfiniteScroll");return n}const at=()=>t.jsxs("div",{className:"nice-infinite-loading",children:[t.jsx("div",{className:"nice-infinite-spinner",children:t.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",children:[t.jsx("circle",{className:"nice-infinite-spinner-track",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"3"}),t.jsx("circle",{className:"nice-infinite-spinner-fill",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"3",strokeDasharray:"60",strokeLinecap:"round"})]})}),t.jsx("span",{className:"nice-infinite-loading-text",children:"Loading..."})]}),bn=()=>t.jsxs("div",{className:"nice-infinite-end",children:[t.jsx("span",{className:"nice-infinite-end-line"}),t.jsx("span",{className:"nice-infinite-end-text",children:"You've reached the end"}),t.jsx("span",{className:"nice-infinite-end-line"})]}),pn=({message:n,onRetry:r})=>t.jsxs("div",{className:"nice-infinite-error",role:"alert",children:[t.jsxs("svg",{className:"nice-infinite-error-icon",viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),t.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),t.jsx("span",{className:"nice-infinite-error-text",children:n}),r&&t.jsx("button",{className:"nice-infinite-error-retry",onClick:r,"aria-label":"Retry loading",children:"Retry"})]}),xn=()=>t.jsxs("div",{className:"nice-infinite-empty",children:[t.jsx("svg",{className:"nice-infinite-empty-icon",viewBox:"0 0 24 24",width:"48",height:"48",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:t.jsx("path",{d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),t.jsx("p",{className:"nice-infinite-empty-text",children:"No items to display"})]}),gn=({visible:n,onClick:r})=>t.jsx("button",{className:`nice-infinite-scroll-top ${n?"nice-infinite-scroll-top--visible":""}`,onClick:r,"aria-label":"Scroll to top",children:t.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polyline",{points:"18 15 12 9 6 15"})})});function yn({items:n,renderItem:r,onLoadMore:s,hasMore:c,isLoading:a=!1,error:l=null,threshold:u=200,loadingIndicator:o,endIndicator:b,errorIndicator:N,onRetry:y,pullToRefresh:w=!1,onRefresh:R,direction:f="vertical",reverse:v=!1,initialScrollPosition:p="top",keyboardNav:S=!0,keyExtractor:D,emptyContent:M,header:g,footer:F,gap:Y=0,className:B="",style:z,ariaLabel:H="Scrollable list"},x){const[k,X]=e.useState("idle"),[U,A]=e.useState(!1),[L,G]=e.useState(!1),O=e.useRef(null),q=e.useRef(null),J=e.useRef(!1),Z=e.useRef(null);e.useEffect(()=>{l?X("error"):a?X("loading"):!c&&n.length>0?X("end"):X("idle")},[l,a,c,n.length]);const ee=e.useCallback((j,i)=>D?D(j,i):`item-${i}`,[D]),$=e.useCallback(async()=>{if(!(J.current||!c||l)){J.current=!0;try{await s()}finally{J.current=!1}}},[c,l,s]),C=e.useCallback(()=>{var j;(j=O.current)==null||j.scrollTo({top:0,behavior:"smooth"})},[]),E=e.useCallback(()=>{O.current&&O.current.scrollTo({top:O.current.scrollHeight,behavior:"smooth"})},[]);e.useEffect(()=>{if(!q.current)return;const j=i=>{const[m]=i;m.isIntersecting&&c&&!a&&!l&&$()};return Z.current=new IntersectionObserver(j,{root:O.current,rootMargin:`${u}px`,threshold:.1}),Z.current.observe(q.current),()=>{var i;(i=Z.current)==null||i.disconnect()}},[c,a,l,u,$]),e.useEffect(()=>{const j=O.current;if(!j)return;const i=()=>{const m=f==="vertical"?j.scrollTop:j.scrollLeft;A(m>500)};return j.addEventListener("scroll",i,{passive:!0}),()=>j.removeEventListener("scroll",i)},[f]),e.useEffect(()=>{p==="bottom"&&O.current&&(O.current.scrollTop=O.current.scrollHeight)},[p]);const V=e.useCallback(j=>{S&&(j.key==="Home"?(j.preventDefault(),C()):j.key==="End"&&(j.preventDefault(),E()))},[S,C,E]);e.useCallback(async()=>{if(!(!R||L)){G(!0);try{await R()}finally{G(!1)}}},[R,L]);const d=e.useCallback(j=>{O.current=j,typeof x=="function"?x(j):x&&(x.current=j)},[x]),T=e.useMemo(()=>({status:k,loadMore:$,hasMore:c,itemCount:n.length,scrollToTop:C,scrollToBottom:E}),[k,$,c,n.length,C,E]),I=e.useMemo(()=>(v?[...n].reverse():n).map((i,m)=>t.jsx("div",{className:"nice-infinite-item","data-index":m,children:r(i,m)},ee(i,m))),[n,v,ee,r]);return n.length===0&&!a&&!l?t.jsx("div",{ref:d,className:`nice-infinite-container nice-infinite-container--empty ${B}`,style:z,role:"region","aria-label":H,children:M||t.jsx(xn,{})}):t.jsx(Tt.Provider,{value:T,children:t.jsxs("div",{ref:d,className:`nice-infinite-container nice-infinite-container--${f} ${v?"nice-infinite-container--reverse":""} ${B}`,style:z,onKeyDown:V,tabIndex:0,role:"feed","aria-label":H,"aria-busy":a,children:[g&&t.jsx("div",{className:"nice-infinite-header",children:g}),w&&L&&t.jsx("div",{className:"nice-infinite-pull",children:o||t.jsx(at,{})}),t.jsx("div",{className:"nice-infinite-items",style:{gap:Y},children:I}),t.jsx("div",{ref:q,className:"nice-infinite-sentinel","aria-hidden":"true"}),k==="loading"&&(o||t.jsx(at,{})),k==="error"&&l&&(N||t.jsx(pn,{message:l,onRetry:y})),k==="end"&&(b||t.jsx(bn,{})),F&&t.jsx("div",{className:"nice-infinite-footer",children:F}),t.jsx(gn,{visible:U,onClick:C})]})})}const wn=e.forwardRef(yn);function kn(n){const{fetchPage:r,initialCursor:s,refetchOnFocus:c=!1}=n,[a,l]=e.useState([]),[u,o]=e.useState(s),[b,N]=e.useState(!1),[y,w]=e.useState(null),[R,f]=e.useState(!0),[v,p]=e.useState(!1),S=e.useCallback(async()=>{if(!(b||!R)){N(!0),w(null);try{const g=await r(u);l(F=>[...F,...g.items]),o(g.nextCursor),f(g.hasMore),p(!0)}catch(g){w(g instanceof Error?g.message:"Failed to load data")}finally{N(!1)}}},[r,u,b,R]),D=e.useCallback(async()=>{l([]),o(s),f(!0),w(null),N(!0);try{const g=await r(s);l(g.items),o(g.nextCursor),f(g.hasMore)}catch(g){w(g instanceof Error?g.message:"Failed to refresh data")}finally{N(!1)}},[r,s]),M=e.useCallback(()=>{l([]),o(s),f(!0),w(null),p(!1)},[s]);return e.useEffect(()=>{!v&&!b&&S()},[v,b,S]),e.useEffect(()=>{if(!c)return;const g=()=>{v&&D()};return window.addEventListener("focus",g),()=>window.removeEventListener("focus",g)},[c,v,D]),{items:a,isLoading:b,error:y,hasMore:R,loadMore:S,refresh:D,reset:M}}function jn(n){const{itemCount:r,itemHeight:s,overscan:c=5,containerRef:a}=n,[l,u]=e.useState(0),[o,b]=e.useState(0),N=e.useCallback(f=>typeof s=="function"?s(f):s,[s]),y=e.useMemo(()=>{let f=0;for(let v=0;v<r;v++)f+=N(v);return f},[r,N]),w=e.useMemo(()=>{const f=[];let v=0,p=-1,S=-1;for(let D=0;D<r;D++){const M=N(D),g=v+M;g>=l&&p===-1&&(p=D),v<=l+o&&(S=D),v=g}p=Math.max(0,p-c),S=Math.min(r-1,S+c),v=0;for(let D=0;D<r;D++){const M=N(D);D>=p&&D<=S&&f.push({index:D,start:v,size:M,end:v+M}),v+=M}return f},[r,N,l,o,c]);e.useEffect(()=>{const f=a.current;if(!f)return;b(f.clientHeight);const v=()=>{u(f.scrollTop)},p=()=>{b(f.clientHeight)};return f.addEventListener("scroll",v,{passive:!0}),window.addEventListener("resize",p),()=>{f.removeEventListener("scroll",v),window.removeEventListener("resize",p)}},[a]);const R=e.useCallback(f=>{const v=a.current;if(!v)return;let p=0;for(let S=0;S<f&&S<r;S++)p+=N(S);v.scrollTo({top:p,behavior:"smooth"})},[a,r,N]);return{virtualItems:w,totalSize:y,scrollToIndex:R}}const Ct=e.createContext(null);function Nn(){const n=e.useContext(Ct);if(!n)throw new Error("useMobileDrawer must be used within NiceMobileDrawer");return n}const Dt=({item:n,depth:r=0,onSelect:s,activeId:c})=>{const[a,l]=e.useState(!1),u=n.children&&n.children.length>0,o=c===n.id;if(n.divider)return t.jsx("div",{className:"nice-drawer-divider"});if(n.section)return t.jsx("div",{className:"nice-drawer-section",children:t.jsx("span",{className:"nice-drawer-section-label",children:n.section})});const b=()=>{n.disabled||(u?l(!a):(s(n),n.onClick&&n.onClick()))};return t.jsxs("div",{className:"nice-drawer-nav-item-wrapper",children:[t.jsxs("button",{className:`nice-drawer-nav-item nice-drawer-nav-item--depth-${r} ${o?"nice-drawer-nav-item--active":""} ${n.disabled?"nice-drawer-nav-item--disabled":""}`,onClick:b,disabled:n.disabled,"aria-expanded":u?a:void 0,"aria-current":o?"page":void 0,style:{paddingLeft:`${16+r*16}px`},children:[n.icon&&t.jsx("span",{className:"nice-drawer-nav-icon",children:n.icon}),t.jsx("span",{className:"nice-drawer-nav-label",children:n.label}),n.badge!==void 0&&t.jsx("span",{className:"nice-drawer-nav-badge",style:{background:n.badgeColor},children:n.badge}),u&&t.jsx("span",{className:`nice-drawer-nav-chevron ${a?"nice-drawer-nav-chevron--expanded":""}`,children:t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),u&&a&&t.jsx("div",{className:"nice-drawer-nav-children",children:n.children.map(N=>t.jsx(Dt,{item:N,depth:r+1,onSelect:s,activeId:c},N.id))})]})},Pt=e.forwardRef(({open:n,onClose:r,position:s="left",variant:c="overlay",size:a,children:l,navItems:u,header:o,footer:b,swipeToOpen:N=!0,swipeToClose:y=!0,edgeSwipeWidth:w=20,velocityThreshold:R=.3,showOverlay:f=!0,closeOnOverlayClick:v=!0,closeOnEscape:p=!0,disableBodyScroll:S=!0,overlayColor:D,zIndex:M=1e3,onNavSelect:g,activeNavId:F,className:Y="",style:B,ariaLabel:z="Navigation drawer"},H)=>{const[x,k]=e.useState(0),[X,U]=e.useState(!1),[A,L]=e.useState(F),G=e.useRef(null),O=e.useRef({x:0,y:0}),q=e.useRef(0),J=e.useRef({x:0,y:0}),Z=s==="left"||s==="right",$=a??(Z?280:400);e.useEffect(()=>{F!==void 0&&L(F)},[F]),e.useEffect(()=>{if(S&&n){const i=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=i}}},[n,S]),e.useEffect(()=>{if(!p||!n)return;const i=m=>{m.key==="Escape"&&r()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[p,n,r]),e.useEffect(()=>{if(!n||!G.current)return;const i=G.current,m=i.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),P=m[0],h=m[m.length-1],W=te=>{te.key==="Tab"&&(te.shiftKey&&document.activeElement===P?(te.preventDefault(),h==null||h.focus()):!te.shiftKey&&document.activeElement===h&&(te.preventDefault(),P==null||P.focus()))};return i.addEventListener("keydown",W),P==null||P.focus(),()=>i.removeEventListener("keydown",W)},[n]);const C=e.useCallback(()=>{let i=0;const m=x;if(!n)switch(s){case"left":i=-100;break;case"right":i=100;break;case"top":i=-100;break;case"bottom":i=100;break}return Z?`translateX(calc(${i}% + ${m}px))`:`translateY(calc(${i}% + ${m}px))`},[n,s,x,Z]),E=e.useCallback(i=>{if(!y&&n)return;const m=i.touches[0];O.current={x:m.clientX,y:m.clientY},J.current={x:m.clientX,y:m.clientY},q.current=Date.now()},[y,n]),V=e.useCallback(i=>{if(!y||!n)return;const m=i.touches[0],P=m.clientX-O.current.x,h=m.clientY-O.current.y;let W=!1,te=0;switch(s){case"left":W=P<0,te=Math.min(0,P);break;case"right":W=P>0,te=Math.max(0,P);break;case"top":W=h<0,te=Math.min(0,h);break;case"bottom":W=h>0,te=Math.max(0,h);break}W&&Math.abs(Z?P:h)>10&&(U(!0),k(te),J.current={x:m.clientX,y:m.clientY},i.preventDefault())},[y,n,s,Z]),d=e.useCallback(()=>{if(!X)return;const i=Date.now()-q.current,m=Math.abs(x),P=typeof $=="number"?$:280,h=m/i;(m>P*.3||h>R)&&r(),U(!1),k(0)},[X,x,$,R,Z,r]);e.useEffect(()=>{if(!N||n)return;let i=0,m=0,P=!1;const h=te=>{const ce=te.touches[0];i=ce.clientX,m=ce.clientY;const ne=window.innerWidth,ae=window.innerHeight;switch(s){case"left":P=i<w;break;case"right":P=i>ne-w;break;case"top":P=m<w;break;case"bottom":P=m>ae-w;break}},W=te=>{if(!P)return;const ce=te.touches[0],ne=ce.clientX-i,ae=ce.clientY-m,re=50;let se=!1;switch(s){case"left":se=ne>re;break;case"right":se=ne<-re;break;case"top":se=ae>re;break;case"bottom":se=ae<-re;break}se&&te.preventDefault()};return document.addEventListener("touchstart",h,{passive:!0}),document.addEventListener("touchmove",W,{passive:!1}),()=>{document.removeEventListener("touchstart",h),document.removeEventListener("touchmove",W)}},[N,n,s,w]);const T=e.useCallback(i=>{L(i.id),g==null||g(i),i.href&&r()},[g,r]),I=e.useCallback(i=>{G.current=i,typeof H=="function"?H(i):H&&(H.current=i)},[H]),j=e.useMemo(()=>({isOpen:n,position:s,close:r,activeNavId:A,setActiveNavId:L}),[n,s,r,A]);return t.jsxs(Ct.Provider,{value:j,children:[f&&c!=="persistent"&&t.jsx("div",{className:`nice-drawer-overlay ${n?"nice-drawer-overlay--visible":""}`,style:{zIndex:M-1,background:D,opacity:X?1-Math.abs(x)/(typeof $=="number"?$:280):void 0},onClick:v?r:void 0,"aria-hidden":"true"}),t.jsxs("div",{ref:I,className:`nice-drawer nice-drawer--${s} nice-drawer--${c} ${n?"nice-drawer--open":""} ${X?"nice-drawer--dragging":""} ${Y}`,style:{...B,[Z?"width":"height"]:$,zIndex:M,transform:C()},onTouchStart:E,onTouchMove:V,onTouchEnd:d,role:"dialog","aria-modal":c!=="persistent","aria-label":z,"aria-hidden":!n,children:[o&&t.jsxs("div",{className:"nice-drawer-header",children:[o,t.jsx("button",{className:"nice-drawer-close",onClick:r,"aria-label":"Close drawer",children:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),t.jsx("div",{className:"nice-drawer-content",children:u?t.jsx("nav",{className:"nice-drawer-nav","aria-label":"Main navigation",children:u.map(i=>t.jsx(Dt,{item:i,onSelect:T,activeId:A},i.id))}):l}),b&&t.jsx("div",{className:"nice-drawer-footer",children:b})]})]})});Pt.displayName="NiceMobileDrawer";function Mn(n={}){const{defaultOpen:r=!1,onOpenChange:s}=n,[c,a]=e.useState(r),l=e.useCallback(()=>{a(!0),s==null||s(!0)},[s]),u=e.useCallback(()=>{a(!1),s==null||s(!1)},[s]),o=e.useCallback(()=>{a(N=>{const y=!N;return s==null||s(y),y})},[s]),b=e.useCallback(N=>{a(N),s==null||s(N)},[s]);return{isOpen:c,open:l,close:u,toggle:o,setOpen:b}}const Rn={home:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),settings:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"3"}),t.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),user:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),search:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),inbox:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),t.jsx("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]}),heart:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})}),folder:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),help:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),t.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),logout:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),t.jsx("polyline",{points:"16 17 21 12 16 7"}),t.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})},St=e.createContext(null);function Tn(){const n=e.useContext(St);if(!n)throw new Error("useMobileModal must be used within a NiceMobileModal");return n}function Cn(n={}){const{defaultOpen:r=!1,open:s,onOpenChange:c,preventDismiss:a=!1}=n,[l,u]=e.useState(r),o=s!==void 0,b=o?s:l,N=e.useCallback((f,v)=>{!f&&a&&v!=="close"||(o||u(f),c==null||c(f,v))},[o,c,a]),y=e.useCallback(()=>N(!0),[N]),w=e.useCallback(f=>N(!1,f),[N]),R=e.useCallback(()=>N(!b),[N,b]);return{open:b,openModal:y,closeModal:w,toggle:R,setOpen:f=>N(f)}}const Dn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]});function Pn(n,r,s){return n==="content"?Math.min(s,r):n==="full"?r:n<=1?r*n:Math.min(n,r)}function Sn(n,r,s){return Math.min(Math.max(n,r),s)}const Ge=e.forwardRef(function({open:r,onClose:s,title:c,children:a,footer:l,snapPoints:u=["content"],defaultSnapPoint:o=0,showHandle:b=!0,showClose:N=!0,showOverlay:y=!0,dismissOnDrag:w=!0,dismissOnOverlay:R=!0,dismissOnEscape:f=!0,preventDismiss:v=!1,onSnapChange:p,className:S="",overlayClassName:D="",headerClassName:M="",contentClassName:g="",footerClassName:F="",lockScroll:Y=!0,borderRadius:B=16,zIndex:z,style:H,...x},k){const U=`${e.useId()}-title`,A=e.useRef(null),L=e.useRef(null),G=e.useRef(0),O=e.useRef(0),q=e.useRef(!1),[J,Z]=e.useState(o),[ee,$]=e.useState(0),[C,E]=e.useState(400),[V,d]=e.useState(typeof window<"u"?window.innerHeight:800),[T,I]=e.useState(!1),j=u.map(_=>Pn(_,V,C));e.useEffect(()=>{if(typeof window>"u")return;const _=()=>{d(window.innerHeight)};return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]),e.useEffect(()=>{if(!L.current||!r)return;const _=new ResizeObserver(()=>{const K=L.current,Q=A.current;if(!K)return;let ie=0;for(const oe of Array.from((Q==null?void 0:Q.children)??[]))oe!==K&&(ie+=oe.offsetHeight);E(Math.min(K.scrollHeight+ie,V*.9))});return _.observe(L.current),()=>_.disconnect()},[r,V]),e.useEffect(()=>{if(r){const _=j[o]||j[0]||V*.5;$(_),Z(o)}},[r]),e.useEffect(()=>{if(r&&!T){const _=j[J]||j[0];$(_)}},[j.join(","),J,T,r]),e.useEffect(()=>{if(!Y||!r)return;const _=document.body.style.overflow,K=document.body.style.paddingRight,Q=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",Q>0&&(document.body.style.paddingRight=`${Q}px`),()=>{document.body.style.overflow=_,document.body.style.paddingRight=K}},[r,Y]),e.useEffect(()=>{if(!r||!f||v)return;const _=K=>{K.key==="Escape"&&(s==null||s("escape"))};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[r,f,v,s]),e.useEffect(()=>{if(!r||!A.current)return;const K=A.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),Q=K[0],ie=K[K.length-1],oe=ue=>{ue.key==="Tab"&&(ue.shiftKey?document.activeElement===Q&&(ue.preventDefault(),ie==null||ie.focus()):document.activeElement===ie&&(ue.preventDefault(),Q==null||Q.focus()))};return document.addEventListener("keydown",oe),requestAnimationFrame(()=>{Q==null||Q.focus()}),()=>document.removeEventListener("keydown",oe)},[r]);const i=e.useCallback(_=>{v&&_!=="close"||s==null||s(_)},[v,s]),m=e.useCallback(()=>{R&&i("overlay")},[R,i]),P=e.useCallback((_,K)=>{if(K>.5&&w&&!v)return-1;if(K<-.5)return j.length-1;let Q=0,ie=Math.abs(j[0]-_);for(let oe=1;oe<j.length;oe++){const ue=Math.abs(j[oe]-_);ue<ie&&(ie=ue,Q=oe)}return Q},[j,w,v]),h=e.useCallback(_=>{q.current=!0,G.current=_,O.current=ee,I(!0)},[ee]),W=e.useCallback(_=>{if(!q.current)return;const K=G.current-_,Q=Sn(O.current+K,50,V);$(Q)},[V]),te=e.useCallback((_,K)=>{if(!q.current)return;q.current=!1,I(!1);const Q=P(ee,K);if(Q===-1){i("drag");return}Z(Q),$(j[Q]),p==null||p(Q,u[Q])},[ee,P,i,j,u,p]),ce=_=>{h(_.touches[0].clientY)},ne=_=>{W(_.touches[0].clientY)},ae=_=>{const K=_.changedTouches[0],Q=(G.current-K.clientY)/(_.timeStamp-(_.timeStamp-200));te(K.clientY,Q>0?-Q/1e3:Q/1e3)},re=_=>{_.preventDefault(),h(_.clientY);const K=ie=>{W(ie.clientY)},Q=ie=>{const oe=(G.current-ie.clientY)/200;te(ie.clientY,oe>0?-oe/500:oe/500),document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",Q)};document.addEventListener("mousemove",K),document.addEventListener("mouseup",Q)},se=e.useCallback(_=>{_<0||_>=j.length||(Z(_),$(j[_]),p==null||p(_,u[_]))},[j,u,p]),le={isOpen:r,snapPoints:u,currentSnapIndex:J,setSnapIndex:se,close:i};return r?t.jsxs(t.Fragment,{children:[y&&t.jsx("div",{className:`nice-mobile-modal-overlay nice-mobile-modal-overlay--visible ${D}`,onClick:m,"aria-hidden":"true",style:{zIndex:z?z-1:void 0}}),t.jsx(St.Provider,{value:le,children:t.jsxs("div",{ref:_=>{A.current=_,typeof k=="function"?k(_):k&&(k.current=_)},role:"dialog","aria-modal":"true","aria-labelledby":c?U:void 0,className:`nice-modal-sheet ${T?"nice-modal-sheet--dragging":""} ${S}`,style:{height:ee,borderTopLeftRadius:B,borderTopRightRadius:B,zIndex:z,...H},...x,children:[b&&t.jsx("div",{className:"nice-modal-handle-area",onTouchStart:ce,onTouchMove:ne,onTouchEnd:ae,onMouseDown:re,children:t.jsx("div",{className:"nice-modal-handle"})}),(c||N)&&t.jsxs("div",{className:`nice-modal-header ${M}`,children:[c&&t.jsx("h2",{id:U,className:"nice-modal-title",children:c}),N&&!v&&t.jsx("button",{type:"button",className:"nice-modal-close",onClick:()=>i("close"),"aria-label":"Close modal",children:t.jsx(Dn,{})})]}),t.jsx("div",{ref:L,className:`nice-modal-content ${g}`,children:a}),l&&t.jsx("div",{className:`nice-modal-footer ${F}`,children:l})]})})]}):null}),In=e.forwardRef(function({actions:r,cancelLabel:s="Cancel",onClose:c,...a},l){return t.jsx(Ge,{ref:l,onClose:c,showHandle:!0,showClose:!1,snapPoints:["content"],...a,children:t.jsxs("div",{className:"nice-action-sheet",children:[r.map(u=>t.jsxs("button",{type:"button",className:`nice-action-sheet-item ${u.destructive?"nice-action-sheet-item--destructive":""}`,disabled:u.disabled,onClick:()=>{var o;(o=u.onClick)==null||o.call(u),c==null||c("close")},children:[u.icon&&t.jsx("span",{className:"nice-action-sheet-icon",children:u.icon}),u.label]},u.id)),t.jsx("div",{className:"nice-action-sheet-divider"}),t.jsx("button",{type:"button",className:"nice-action-sheet-item nice-action-sheet-item--cancel",onClick:()=>c==null?void 0:c("close"),children:s})]})})}),$n=e.forwardRef(function({title:r,message:s,confirmLabel:c="Confirm",cancelLabel:a="Cancel",confirmDestructive:l=!1,onConfirm:u,onCancel:o,onClose:b,...N},y){const w=()=>{u==null||u(),b==null||b("close")},R=()=>{o==null||o(),b==null||b("close")};return t.jsx(Ge,{ref:y,title:r,onClose:b,showHandle:!0,snapPoints:["content"],footer:t.jsxs("div",{className:"nice-confirm-sheet-buttons",children:[t.jsx("button",{type:"button",className:"nice-confirm-sheet-btn nice-confirm-sheet-btn--cancel",onClick:R,children:a}),t.jsx("button",{type:"button",className:`nice-confirm-sheet-btn nice-confirm-sheet-btn--confirm ${l?"nice-confirm-sheet-btn--destructive":""}`,onClick:w,children:c})]}),...N,children:t.jsx("div",{className:"nice-confirm-sheet-message",children:s})})}),It=e.createContext(null);function En(){const n=e.useContext(It);if(!n)throw new Error("useMobileTabs must be used within a NiceMobileTabs");return n}function Ln(n){var w;const{tabs:r,defaultTab:s,activeTab:c,onChange:a}=n,[l,u]=e.useState(s||((w=r[0])==null?void 0:w.id)||""),o=c!==void 0,b=o?c:l,N=e.useCallback(R=>{const f=r.find(v=>v.id===R);!f||f.disabled||(o||u(R),a==null||a(R))},[r,o,a]),y=e.useCallback(R=>b===R,[b]);return{activeTab:b,setActiveTab:N,tabs:r,isActive:y}}const de={home:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),homeFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"})}),search:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),plus:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),t.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),heart:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})}),heartFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})}),user:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),userFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})}),bell:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),t.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),bellFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"})}),cart:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"9",cy:"21",r:"1"}),t.jsx("circle",{cx:"20",cy:"21",r:"1"}),t.jsx("path",{d:"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"})]}),inbox:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),t.jsx("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]}),settings:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"12",r:"3"}),t.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),more:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"12",r:"1"}),t.jsx("circle",{cx:"19",cy:"12",r:"1"}),t.jsx("circle",{cx:"5",cy:"12",r:"1"})]})},lt=({content:n,variant:r="count",color:s})=>{if(n===void 0||n===!1)return null;if(n===!0||r==="dot")return t.jsx("span",{className:"nice-tab-badge nice-tab-badge--dot",style:s?{backgroundColor:s}:void 0});const c=typeof n=="number"&&n>99?"99+":n;return t.jsx("span",{className:"nice-tab-badge nice-tab-badge--count",style:s?{backgroundColor:s}:void 0,children:c})},ot=({tab:n,isActive:r,showLabel:s,animation:c,activeColor:a,inactiveColor:l,onClick:u})=>{const o=e.useRef(null);e.useEffect(()=>{if(!o.current||c==="none")return;const y=o.current;c==="scale"&&r&&(y.style.transform="scale(1.2)",setTimeout(()=>{y.style.transform="scale(1)"},150))},[r,c]);const b=r&&n.activeIcon?n.activeIcon:n.icon,N={};return r&&a?N.color=a:!r&&l&&(N.color=l),n.href?t.jsxs("a",{href:n.href,className:`nice-tab-button ${r?"nice-tab-button--active":""} ${n.disabled?"nice-tab-button--disabled":""} ${n.className||""}`,style:N,"aria-current":r?"page":void 0,onClick:y=>{var w;if(n.disabled){y.preventDefault();return}(w=n.onClick)==null||w.call(n),u()},children:[t.jsx("span",{ref:o,className:"nice-tab-icon",children:b}),s&&t.jsx("span",{className:"nice-tab-label",children:n.label}),t.jsx(lt,{content:n.badge,variant:n.badgeVariant,color:n.badgeColor})]}):t.jsxs("button",{type:"button",className:`nice-tab-button ${r?"nice-tab-button--active":""} ${n.disabled?"nice-tab-button--disabled":""} ${n.className||""}`,style:N,disabled:n.disabled,"aria-pressed":r,onClick:()=>{var y;(y=n.onClick)==null||y.call(n),u()},children:[t.jsx("span",{ref:o,className:"nice-tab-icon",children:b}),s&&t.jsx("span",{className:"nice-tab-label",children:n.label}),t.jsx(lt,{content:n.badge,variant:n.badgeVariant,color:n.badgeColor})]})},Bn=e.forwardRef(function({tabs:r,activeTab:s,defaultTab:c,onChange:a,showLabels:l=!0,showAllLabels:u=!0,position:o="bottom",variant:b="default",haptic:N=!0,animation:y="scale",maxTabs:w,moreLabel:R="More",moreIcon:f=de.more,safeArea:v=!0,activeColor:p,inactiveColor:S,backgroundColor:D,hideOnScroll:M="none",lockScroll:g=!0,className:F="",style:Y,...B},z){var ee;const[H,x]=e.useState(c||((ee=r[0])==null?void 0:ee.id)||""),[k,X]=e.useState(!1),U=e.useRef(0),A=s!==void 0,L=A?s:H;e.useEffect(()=>{if(M==="none"||typeof window>"u")return;const $=()=>{const C=window.scrollY,E=C>U.current?"down":"up";E===M&&C>50?X(!0):E!==M&&X(!1),U.current=C};return window.addEventListener("scroll",$,{passive:!0}),()=>window.removeEventListener("scroll",$)},[M]);const G=e.useCallback($=>{const C=r.find(E=>E.id===$);!C||C.disabled||(N&&"vibrate"in navigator&&navigator.vibrate(10),A||x($),a==null||a($))},[r,N,A,a]),O=w&&r.length>w?r.slice(0,w-1):r,q=w&&r.length>w?r.slice(w-1):[],J={activeTab:L,setActiveTab:G,tabs:r},Z={...Y};return D&&(Z.backgroundColor=D),t.jsx(It.Provider,{value:J,children:t.jsxs("nav",{ref:z,className:`nice-mobile-tabs nice-mobile-tabs--${o} nice-mobile-tabs--${b} ${v?"nice-mobile-tabs--safe-area":""} ${k?"nice-mobile-tabs--hidden":""} ${F}`,style:Z,role:"tablist","aria-label":"Main navigation",...B,children:[O.map($=>{const C=$.id===L,E=u||l&&C;return t.jsx(ot,{tab:$,isActive:C,showLabel:E,animation:y,activeColor:p,inactiveColor:S,onClick:()=>G($.id)},$.id)}),q.length>0&&t.jsx(ot,{tab:{id:"__more__",label:R,icon:f,badge:q.some($=>$.badge)?!0:void 0},isActive:q.some($=>$.id===L),showLabel:u||l,animation:y,activeColor:p,inactiveColor:S,onClick:()=>{console.log("Open more menu",q)}})]})})}),Hn={basic:[{id:"home",label:"Home",icon:de.home,activeIcon:de.homeFilled},{id:"search",label:"Search",icon:de.search},{id:"notifications",label:"Alerts",icon:de.bell,activeIcon:de.bellFilled},{id:"profile",label:"Profile",icon:de.user,activeIcon:de.userFilled}],social:[{id:"feed",label:"Feed",icon:de.home,activeIcon:de.homeFilled},{id:"discover",label:"Discover",icon:de.search},{id:"create",label:"Create",icon:de.plus},{id:"activity",label:"Activity",icon:de.heart,activeIcon:de.heartFilled},{id:"profile",label:"Profile",icon:de.user,activeIcon:de.userFilled}],ecommerce:[{id:"shop",label:"Shop",icon:de.home,activeIcon:de.homeFilled},{id:"search",label:"Search",icon:de.search},{id:"cart",label:"Cart",icon:de.cart},{id:"favorites",label:"Wishlist",icon:de.heart,activeIcon:de.heartFilled},{id:"account",label:"Account",icon:de.user,activeIcon:de.userFilled}],messaging:[{id:"chats",label:"Chats",icon:de.inbox},{id:"calls",label:"Calls",icon:de.bell},{id:"contacts",label:"Contacts",icon:de.user,activeIcon:de.userFilled},{id:"settings",label:"Settings",icon:de.settings}]},$t=e.createContext(null);function An(){const n=e.useContext($t);if(!n)throw new Error("useMobileHeader must be used within a NiceMobileHeader");return n}function Yn(n={}){const{collapsedHeight:r=56,expandedHeight:s=200,scrollElement:c,mode:a="scroll",threshold:l=0}=n,[u,o]=e.useState(0),[b,N]=e.useState(!0),y=e.useRef(null),w=e.useRef(0),R=e.useRef(!1),f=s-r,v=s-u*f,p=u>=1;e.useEffect(()=>{const M=c||y.current||window,g=()=>{R.current||(R.current=!0,requestAnimationFrame(()=>{const F=M===window?window.scrollY:M.scrollTop,Y=F-w.current;if(a==="scroll"||a==="exitUntilCollapsed"){const B=Math.min(1,Math.max(0,(F-l)/f));o(B)}if(a==="enterAlways"){Y>5&&F>l?N(!1):Y<-5&&N(!0);const B=f>0?Math.min(1,Math.max(0,F/f)):0;o(B)}w.current=F,R.current=!1}))};return M.addEventListener("scroll",g,{passive:!0}),g(),()=>M.removeEventListener("scroll",g)},[c,a,l,f]);const S=e.useCallback(()=>{o(0),N(!0)},[]),D=e.useCallback(()=>{o(1)},[]);return{progress:u,height:v,isCollapsed:p,isVisible:b,scrollRef:y,expand:S,collapse:D}}const Fn=()=>t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"15 18 9 12 15 6"})}),Vn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),t.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),t.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),zn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),Wn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"12",r:"1"}),t.jsx("circle",{cx:"12",cy:"5",r:"1"}),t.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),Xn={back:t.jsx(Fn,{}),menu:t.jsx(Vn,{}),search:t.jsx(zn,{}),more:t.jsx(Wn,{})},Un=({action:n})=>t.jsxs("button",{type:"button",className:`nice-header-action ${n.disabled?"nice-header-action--disabled":""}`,onClick:n.onClick,disabled:n.disabled,"aria-label":n.label,title:n.label,children:[n.icon,n.badge!==void 0&&n.badge!==!1&&t.jsx("span",{className:`nice-header-badge ${n.badge===!0?"nice-header-badge--dot":""}`,children:n.badge!==!0&&n.badge})]}),Ee=e.forwardRef(function({title:r,largeTitle:s,subtitle:c,leftAction:a,rightActions:l=[],background:u,mode:o="scroll",variant:b="default",collapsedHeight:N=56,expandedHeight:y=s||u?140:56,parallax:w=!1,parallaxSpeed:R=.5,showShadow:f=!0,sticky:v=!0,zIndex:p=100,scrollElement:S,onCollapseChange:D,safeArea:M=!0,backgroundColor:g,textColor:F,showBorder:Y=!1,collapsedContent:B,expandedContent:z,className:H="",style:x,children:k,...X},U){const[A,L]=e.useState(0),[G,O]=e.useState(!0),q=e.useRef(null),J=e.useRef(0),Z=e.useRef(!1),ee=y-N,$=y-A*ee,C=A>=.9;e.useEffect(()=>{const i=S||window,m=()=>{Z.current||(Z.current=!0,requestAnimationFrame(()=>{const P=i===window?window.scrollY:i.scrollTop,h=P-J.current;if(o==="scroll"||o==="exitUntilCollapsed"){const W=ee>0?Math.min(1,Math.max(0,P/ee)):0;L(W),D&&Math.abs(W-A)>.05&&D(W>=.9,W)}if(o==="enterAlways"){h>5&&P>N?O(!1):h<-5&&O(!0);const W=ee>0?Math.min(1,Math.max(0,P/ee)):0;L(W)}J.current=P,Z.current=!1}))};return i.addEventListener("scroll",m,{passive:!0}),m(),()=>i.removeEventListener("scroll",m)},[S,o,ee,N,D,A]);const E=1-A*2,V=A>.5?(A-.5)*2:0,d=1-A,T=w?`translateY(${A*ee*R}px) scale(${1+A*.1})`:void 0,I={height:o==="pin"?N:$,zIndex:p,...x};g&&(I.backgroundColor=g),F&&(I.color=F);const j={progress:A,isCollapsed:C,height:$,expandedHeight:y,collapsedHeight:N};return t.jsxs($t.Provider,{value:j,children:[t.jsxs("header",{ref:i=>{q.current=i,typeof U=="function"?U(i):U&&(U.current=i)},className:`
|
|
1
|
+
"use strict";var ln=Object.defineProperty;var on=(t,n,c)=>n in t?ln(t,n,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[n]=c;var it=(t,n,c)=>on(t,typeof n!="symbol"?n+"":n,c);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),be=require("@nice2dev/ui-core"),e=require("react"),de=require("@nice2dev/icons"),un=({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}}),lt={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"}},Te=({direction:t,style:n})=>r.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.45em",height:"0.45em",margin:lt[t].margin,borderRight:"0.12em solid currentColor",borderBottom:"0.12em solid currentColor",transform:lt[t].transform,...n}}),Ze=({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)"}})]}),Tt=e.createContext(null);function Mt(){const t=e.useContext(Tt);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 Rt=({state:t,progress:n,pullDistance:c,threshold:s})=>{const{t:a}=be.useNiceTranslation(),i=n*360,d=Math.min(1,n),o=()=>{switch(t){case"pulling":return r.jsx("span",{className:"nice-ptr__icon nice-ptr__icon-arrow",style:{transform:`rotate(${Math.min(i,180)}deg)`},children:r.jsx(Te,{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(un,{})});case"error":return r.jsx("span",{className:"nice-ptr__icon nice-ptr__icon-error",children:r.jsx(Ze,{})});default:return null}},f=()=>{switch(t){case"pulling":return a("pullToRefresh.pullDownToRefresh","Pull down to refresh");case"ready":return a("pullToRefresh.releaseToRefresh","Release to refresh");case"refreshing":return a("pullToRefresh.refreshing","Refreshing...");case"success":return a("pullToRefresh.updated","Updated!");case"error":return a("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:o()}),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)"})]})})]})},St=Object.assign(e.forwardRef(({children:t,onRefresh:n,indicator:c,threshold:s=80,maxPull:a=150,resistance:i=.4,completionDuration:d=1e3,hapticFeedback:o=!0,disabled:f=!1,onPullStart:w,onPullProgress:v,onRefreshSuccess:k,onRefreshError:g,className:u="",style:m,ariaLabel:x},R)=>{const{t:D}=be.useNiceTranslation(),j=x??D("pullToRefresh.pullToRefresh","Pull to refresh"),[y,I]=e.useState("idle"),[O,H]=e.useState(0),W=e.useRef(null),$=e.useRef(null),T=e.useRef(0),M=e.useRef(0),K=e.useRef(!1),J=e.useRef(!1),X=Math.min(1,O/s),Q=y==="refreshing",q=e.useCallback(()=>O<=0?0:((h,_,p)=>{const z=h*(1-p);return Math.min(_,z+z*p/2)})(O,a,i),[O,a,i]),F=e.useCallback(async()=>{if(!(y==="refreshing"||f)){I("refreshing"),o&&Se("medium");try{await n(),I("success"),o&&Se("heavy"),k==null||k()}catch(A){I("error"),o&&Se("light"),g==null||g(A instanceof Error?A:new Error("Refresh failed"))}setTimeout(()=>{I("idle"),H(0)},d)}},[y,f,o,n,k,g,d]),U=e.useCallback(A=>{if(f||y==="refreshing")return;const h=$.current,_=(h==null?void 0:h.scrollTop)??0;_>0||(T.current=A.touches[0].clientY,M.current=_,J.current=!1)},[f,y]),G=e.useCallback(A=>{if(f||y==="refreshing")return;const h=$.current;if(((h==null?void 0:h.scrollTop)??0)>0&&!K.current)return;const z=A.touches[0].clientY-T.current;if(z<=0){K.current&&(K.current=!1,I("idle"),H(0));return}K.current||(K.current=!0,w==null||w(),I("pulling")),A.preventDefault(),H(z);const N=Math.min(1,z/s);v==null||v(N),z>=s?y!=="ready"&&(I("ready"),o&&!J.current&&(Se("light"),J.current=!0)):y==="ready"&&(I("pulling"),J.current=!1)},[f,y,s,o,w,v]),ne=e.useCallback(()=>{K.current&&(K.current=!1,y==="ready"?F():(I("idle"),H(0)))},[y,F]),te=e.useCallback(A=>{(A.key==="F5"||A.ctrlKey&&A.key==="r")&&(A.preventDefault(),F())},[F]),V=e.useCallback(A=>{W.current=A,typeof R=="function"?R(A):R&&(R.current=A)},[R]),L={state:y,progress:X,isRefreshing:Q,triggerRefresh:F},E=q();return r.jsx(Tt.Provider,{value:L,children:r.jsxs("div",{ref:V,className:`nice-ptr ${u} nice-ptr--${y}`,style:m,onTouchStart:U,onTouchMove:G,onTouchEnd:ne,onKeyDown:te,tabIndex:0,role:"region","aria-label":j,"data-state":y,"data-disabled":f||void 0,children:[r.jsx("div",{className:"nice-ptr-indicator-wrapper",style:{height:E,opacity:y==="idle"?0:1},children:c?r.jsx(c,{state:y,progress:X,pullDistance:O,threshold:s}):r.jsx(Rt,{state:y,progress:X,pullDistance:O,threshold:s})}),r.jsx("div",{ref:$,className:"nice-ptr-content",style:{transform:y==="refreshing"?`translateY(${s}px)`:`translateY(${E}px)`,transition:K.current?"none":"transform 0.3s cubic-bezier(0.23, 1, 0.32, 1)"},children:t})]})})}),{displayName:"NicePullToRefresh"}),dn=({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)}})]}),fn=({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}%`}})}),hn=({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]})})},bn=({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,a)=>{const i=a/12*360,d=a/12*1,o=t==="refreshing"?void 0:Math.min(1,n*2-a*.08);return r.jsx("div",{className:"nice-ptr__ios-bar",style:{transform:`rotate(${i}deg) translateY(-8px)`,animationDelay:`${d}s`,opacity:o}},a)})})}),mn=({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)"}}):"!"})]}),ot=6,Pt=e.createContext(null),Dt=({children:t})=>{const[n,c]=e.useState(null);return r.jsx(Pt.Provider,{value:{activeItemId:n,setActiveItemId:c},children:t})};function Ct(){return e.useContext(Pt)}function Pe(t="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const n={light:10,medium:25,heavy:50};navigator.vibrate(n[t])}}const ut=({action:t,width:n,progress:c,index:s,total:a,side:i,onTrigger:d})=>{const{t:o}=be.useNiceTranslation(),f=t.labelKey?o(t.labelKey,t.label):t.label,w=Math.min(1,c*2),v=i==="right"?(a-1-s)*.05:s*.05;return r.jsxs("button",{className:`nice-swipe-action nice-swipe-action--${i} ${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(${w})`,transitionDelay:`${v}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})]})},pn=Object.assign(e.forwardRef(({children:t,leftActions:n=[],rightActions:c=[],actionWidth:s=72,threshold:a=.4,direction:i,exclusive:d=!0,onSwipeStart:o,onSwipeEnd:f,onAction:w,disabled:v=!1,className:k="",style:g,itemId:u,hapticFeedback:m=!0},x)=>{const{t:R}=be.useNiceTranslation(),D=Ct(),[j,y]=e.useState(0),[I,O]=e.useState(null),[H,W]=e.useState(!1),$=e.useRef(null),T=e.useRef(0),M=e.useRef(0),K=e.useRef(0),J=e.useRef(!1),X=e.useRef(null),Q=e.useRef(!1),q=-(n.length*s),F=c.length*s,U=(i==="left"||i==="both"||!i)&&n.length>0,G=(i==="right"||i==="both"||!i)&&c.length>0,ne=Math.min(1,Math.abs(j)/Math.abs(q)),te=Math.min(1,j/F),V=e.useMemo(()=>u||`swipe-${Math.random().toString(36).substr(2,9)}`,[u]),L=e.useCallback(()=>{W(!0),y(0),O(null),setTimeout(()=>W(!1),300)},[]);e.useEffect(()=>{d&&D&&D.activeItemId!==null&&D.activeItemId!==V&&I&&L()},[d,D,V,I,L]);const E=e.useRef(null),A=e.useRef(!1),[h,_]=e.useState(!1),p=e.useCallback(C=>{v||H||E.current!==null||C.pointerType==="mouse"&&C.button!==0||(E.current=C.pointerId,T.current=C.clientX,M.current=C.clientY,K.current=j,J.current=!1,X.current=null,Q.current=!1)},[v,H,j]),z=e.useCallback(C=>{var se,re;if(C.pointerId!==E.current||v||H)return;const S=C.clientX-T.current,Z=C.clientY-M.current;if(!J.current){if(Math.abs(S)<ot&&Math.abs(Z)<ot)return;if(Math.abs(S)<Math.abs(Z)){E.current=null;return}J.current=!0,X.current=S<0?"left":"right",(re=(se=C.currentTarget).setPointerCapture)==null||re.call(se,C.pointerId),_(!0),o==null||o(X.current),d&&D&&D.setActiveItemId(V)}let B=K.current+S;if(!U&&B<0&&(B=Math.max(B,-30)*.3),!G&&B>0&&(B=Math.min(B,30)*.3),U&&B<q){const ie=q-B;B=q-ie*.3}if(G&&B>F){const ie=B-F;B=F+ie*.3}const ae=X.current==="left"?Math.abs(q)*a:F*a,le=X.current==="left"?Math.abs(B):B;le>=ae&&!Q.current?(Q.current=!0,m&&Pe("light")):le<ae&&Q.current&&(Q.current=!1),y(B),C.preventDefault()},[v,H,U,G,q,F,a,m,d,D,V,o]),N=e.useCallback(C=>{if(C.pointerId!==E.current||(E.current=null,!J.current))return;J.current=!1,A.current=!0,_(!1),W(!0);const S=Math.abs(q)*a,Z=F*a;let B=0,ae=null;X.current==="left"&&U?Math.abs(j)>=S&&(B=q,ae="left",m&&Pe("medium")):X.current==="right"&&G&&j>=Z&&(B=F,ae="right",m&&Pe("medium")),(I==="left"&&j>0||I==="right"&&j<0)&&(B=0,ae=null),y(B),O(ae),f==null||f(ae),setTimeout(()=>W(!1),300)},[j,q,F,a,U,G,I,m,f]),P=e.useCallback((C,S)=>{C.onClick(),w==null||w(C,S),m&&Pe("heavy"),L()},[w,m,L]),l=e.useCallback(C=>{C.key==="Escape"&&I&&L()},[I,L]),b=e.useCallback(C=>{$.current=C,typeof x=="function"?x(C):x&&(x.current=C)},[x]);return r.jsxs("div",{ref:b,className:`nice-swipe-container ${k} ${I?`nice-swipe-container--open-${I}`:""}`,style:g,onKeyDown:l,tabIndex:0,role:"listitem","aria-label":I==="left"?R("swipeActions.leftVisible","Swipe actions left visible"):I==="right"?R("swipeActions.rightVisible","Swipe actions right visible"):R("swipeActions.swipeForActions","Swipe for actions"),"data-disabled":v||void 0,children:[c.length>0&&r.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--left",style:{width:F},children:c.map((C,S)=>r.jsx(ut,{action:C,width:s,progress:te,index:S,total:c.length,side:"right",onTrigger:()=>P(C,"right")},C.id))}),r.jsx("div",{className:"nice-swipe-content",style:{transform:`translateX(${j}px)`,transition:H?"transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)":"none",userSelect:h?"none":void 0},onPointerDown:p,onPointerMove:z,onPointerUp:N,onPointerCancel:N,onClickCapture:C=>{A.current&&(A.current=!1,C.stopPropagation(),C.preventDefault())},children:t}),n.length>0&&r.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--right",style:{width:Math.abs(q)},children:n.map((C,S)=>r.jsx(ut,{action:C,width:s,progress:ne,index:S,total:n.length,side:"left",onTrigger:()=>P(C,"left")},C.id))})]})}),{displayName:"NiceSwipeActions"}),vn=({children:t,className:n="",style:c})=>r.jsx(Dt,{children:r.jsx("div",{className:`nice-swipe-list ${n}`,style:c,role:"list",children:t})}),gn={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 dt(t="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const n={light:10,medium:25,heavy:50};navigator.vibrate(n[t])}}function xn(t,n,c){return t==="full"?n*.95:t==="content"?Math.min(c,n*.9):n*t/100}const yn=Object.assign(e.forwardRef(({children:t,open:n,onClose:c,onSnapChange:s,snapPoints:a=[50,100],initialSnap:i=0,header:d,footer:o,showHandle:f=!0,showBackdrop:w=!0,closeOnBackdrop:v=!0,closeOnEscape:k=!0,dismissible:g=!0,velocityThreshold:u=.5,hapticFeedback:m=!0,handleColor:x,borderRadius:R=16,zIndex:D=1e3,className:j="",style:y,ariaLabel:I,size:O="md",disabled:H=!1,loading:W=!1,error:$},T)=>{const{t:M}=be.useNiceTranslation(),K=I??M("bottomSheet.bottomSheet","Bottom sheet"),[J,X]=e.useState(i),[Q,q]=e.useState(0),[F,U]=e.useState(!1),[G,ne]=e.useState(typeof window<"u"?window.innerHeight:800),[te,V]=e.useState(400),L=e.useRef(null),E=e.useRef(null),A=e.useRef(0),h=e.useRef(0),_=e.useRef(0),p=e.useRef(0),z=e.useRef(0),N=e.useRef(-1),P=a.map(re=>xn(re,G,te)),l=P[J]??P[0];e.useImperativeHandle(T,()=>({snapTo:re=>{re>=0&&re<a.length&&(X(re),q(0),s==null||s(re,P[re]))},close:()=>c(),getCurrentSnap:()=>J})),e.useEffect(()=>{const re=()=>{ne(window.innerHeight)};return window.addEventListener("resize",re),()=>window.removeEventListener("resize",re)},[]),e.useEffect(()=>{if(E.current&&n){const re=E.current.scrollHeight;V(re+60)}},[n,t]),e.useEffect(()=>{if(!n||!k)return;const re=ie=>{ie.key==="Escape"&&c()};return document.addEventListener("keydown",re),()=>document.removeEventListener("keydown",re)},[n,k,c]),e.useEffect(()=>{if(n){const re=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=re}}},[n]);const b=e.useCallback(re=>{const ie=G-l+re,oe=G-ie;for(let Y=0;Y<P.length;Y++){const ee=P[Y];if(Math.abs(oe-ee)<20&&N.current!==Y){N.current=Y,m&&dt("light");break}}},[G,l,P,m]),C=e.useCallback((re,ie)=>{if(ie>u*2&&g&&re<P[0]*.5)return-1;if(ie<-u)return P.length-1;if(ie>u)return g&&re<P[0]*.7?-1:0;let oe=0,Y=Math.abs(re-P[0]);for(let ee=1;ee<P.length;ee++){const ce=Math.abs(re-P[ee]);ce<Y&&(Y=ce,oe=ee)}return g&&re<P[0]*.5?-1:oe},[P,u,g]),S=e.useCallback(re=>{A.current=re.touches[0].clientY,h.current=Q,_.current=re.touches[0].clientY,p.current=Date.now(),z.current=0,N.current=-1,U(!0)},[Q]),Z=e.useCallback(re=>{if(!F)return;const ie=re.touches[0].clientY,oe=ie-A.current,Y=Date.now(),ee=Y-p.current;ee>0&&(z.current=(ie-_.current)/ee),_.current=ie,p.current=Y;let ce=h.current+oe;const ue=l+50;if(ce>ue){const me=ce-ue;ce=ue+me*.2}const fe=-(G*.95-l);if(ce<fe){const me=fe-ce;ce=fe-me*.2}q(ce),b(ce),re.preventDefault()},[F,l,G,b]),B=e.useCallback(()=>{if(!F)return;U(!1);const re=l-Q,ie=C(re,z.current);if(ie===-1)q(l+100),setTimeout(()=>{c(),q(0),X(i)},300);else{const oe=P[ie];q(0),X(ie),ie!==J&&(s==null||s(ie,oe),m&&dt("medium"))}},[F,l,Q,C,J,P,c,s,i,m]),ae=e.useCallback(re=>{v&&re.target===re.currentTarget&&c()},[v,c]);if(!n)return null;const le=Math.max(0,l-Q),se=Math.min(.5,le/G*.8);return r.jsxs("div",{className:`nice-bottom-sheet-container ${j}`,style:{zIndex:D},children:[w&&r.jsx("div",{className:"nice-bottom-sheet-backdrop",style:{opacity:se},onMouseDown:ae,"aria-hidden":"true"}),r.jsxs("div",{ref:L,className:`nice-bottom-sheet nice-bottom-sheet--${O} ${F?"nice-bottom-sheet--dragging":""} ${H?"nice-bottom-sheet--disabled":""} ${W?"nice-bottom-sheet--loading":""} ${$?"nice-bottom-sheet--error":""}`,style:{...y,height:le,borderTopLeftRadius:R,borderTopRightRadius:R,transition:F?"none":"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},role:"dialog","aria-modal":"true","aria-label":K,"aria-disabled":H||void 0,"aria-busy":W||void 0,children:[$&&r.jsx("div",{className:"nice-bottom-sheet-error",role:"alert",children:$}),W&&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:S,onTouchMove:Z,onTouchEnd:B,children:r.jsx("div",{className:"nice-bottom-sheet-handle-bar",style:x?{backgroundColor:x}:void 0})}),d&&r.jsx("div",{className:"nice-bottom-sheet-header",children:d}),r.jsx("div",{ref:E,className:"nice-bottom-sheet-content",onTouchStart:S,onTouchMove:Z,onTouchEnd:B,children:t}),o&&r.jsx("div",{className:"nice-bottom-sheet-footer",children:o})]})]})}),{displayName:"NiceBottomSheet"}),wn=[];function Nn(t="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const n={light:10,medium:25,heavy:50};navigator.vibrate(n[t])}}function ft(t,n){return Math.hypot(n.x-t.x,n.y-t.y)}function ht(t,n){return{x:(t.x+n.x)/2,y:(t.y+n.y)/2}}const kn=Object.assign(e.forwardRef(({items:t=wn,selectedIndex:n=0,onIndexChange:c,onClose:s,showClose:a=!0,showCounter:i=!0,showCaption:d=!0,showThumbnails:o=!1,enablePinchZoom:f=!0,enableDoubleTapZoom:w=!0,enableSwipe:v=!0,enableKeyboard:k=!0,minZoom:g=1,maxZoom:u=4,doubleTapZoom:m=2.5,swipeThreshold:x=50,loop:R=!0,hapticFeedback:D=!0,backgroundColor:j="var(--nice-overlay-95, rgba(0, 0, 0, 0.95))",zIndex:y=2e3,className:I="",style:O},H)=>{const{t:W}=be.useNiceTranslation(),[$,T]=e.useState(n),[M,K]=e.useState(1),[J,X]=e.useState(0),[Q,q]=e.useState(0),[F,U]=e.useState(!1),[G,ne]=e.useState({}),te=e.useRef(null),V=e.useRef(null),L=e.useRef([]),E=e.useRef(0),A=e.useRef(1),h=e.useRef({x:0,y:0}),_=e.useRef(0),p=e.useRef({x:0,y:0}),z=e.useRef(!1),N=e.useRef(!1),P=e.useRef(null),l=t[$],b=e.useCallback(oe=>{let Y=oe;R?Y=(oe%t.length+t.length)%t.length:Y=Math.max(0,Math.min(t.length-1,oe)),Y!==$&&(U(!0),T(Y),K(1),X(0),q(0),c==null||c(Y,t[Y]),D&&Nn("light"),setTimeout(()=>U(!1),300))},[$,t,R,c,D]),C=e.useCallback(()=>b($+1),[b,$]),S=e.useCallback(()=>b($-1),[b,$]),Z=e.useCallback((oe,Y,ee)=>{const ce=Math.max(g,Math.min(u,oe));K(ce),ce<=1&&(X(0),q(0))},[g,u]),B=e.useCallback(()=>Z(M*1.5),[M,Z]),ae=e.useCallback(()=>Z(M/1.5),[M,Z]),le=e.useCallback(()=>{K(1),X(0),q(0)},[]);e.useImperativeHandle(H,()=>({goTo:b,goNext:C,goPrev:S,zoomIn:B,zoomOut:ae,resetZoom:le,close:()=>s==null?void 0:s()})),e.useEffect(()=>{if(!k)return;const oe=Y=>{switch(Y.key){case"ArrowLeft":S();break;case"ArrowRight":C();break;case"ArrowUp":B();break;case"ArrowDown":ae();break;case"Escape":s==null||s();break;case"0":case"Home":le();break}};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[k,C,S,B,ae,le,s]);const se=e.useCallback(oe=>{const Y=Array.from(oe.touches).map(ee=>({x:ee.clientX,y:ee.clientY,id:ee.identifier}));if(L.current=Y,p.current={x:Y[0].x,y:Y[0].y},N.current=!1,P.current=null,Y.length===2&&f)z.current=!0,E.current=ft(Y[0],Y[1]),A.current=M,h.current={x:J,y:Q};else if(Y.length===1){const ee=Date.now();ee-_.current<300&&w?(M>1.1?le():Z(m,Y[0].x,Y[0].y),_.current=0):_.current=ee,h.current={x:J,y:Q}}},[M,J,Q,f,w,m,le,Z]),re=e.useCallback(oe=>{const Y=Array.from(oe.touches).map(ee=>({x:ee.clientX,y:ee.clientY,id:ee.identifier}));if(Y.length===2&&z.current&&f){const ce=ft(Y[0],Y[1])/E.current,ue=A.current*ce;Z(ue);const fe=ht(Y[0],Y[1]),me=ht(L.current[0],L.current[1]||L.current[0]),Oe=fe.x-me.x,Ve=fe.y-me.y;X(h.current.x+Oe),q(h.current.y+Ve),oe.preventDefault()}else if(Y.length===1){const ee=Y[0].x-p.current.x,ce=Y[0].y-p.current.y;if(P.current||(Math.abs(ee)>10||Math.abs(ce)>10)&&(P.current=Math.abs(ee)>Math.abs(ce)?"horizontal":"vertical",N.current=!0),M>1.1){const ue=h.current.x+ee,fe=h.current.y+ce;X(ue),q(fe)}oe.preventDefault()}},[M,f,Z]),ie=e.useCallback(oe=>{if(z.current){z.current=!1;return}const Y=oe.changedTouches[0],ee=Y.clientX-p.current.x;Y.clientY-p.current.y,v&&M<=1.1&&P.current==="horizontal"&&(ee>x?S():ee<-x&&C()),M<=1.1&&(X(0),q(0)),N.current=!1,P.current=null},[M,v,x,C,S]);return e.useEffect(()=>{t.forEach((oe,Y)=>{const ee=new Image;ee.onload=()=>{ne(ce=>({...ce,[Y]:!0}))},ee.src=oe.src})},[t]),t.length===0?null:r.jsxs("div",{ref:te,className:`nice-image-gallery ${I}`,style:{...O,backgroundColor:j,zIndex:y},role:"dialog","aria-modal":"true","aria-label":W("imageGallery.imageGallery","Image gallery"),children:[r.jsxs("div",{className:"nice-image-gallery-header",children:[i&&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:ae,disabled:M<=g,"aria-label":W("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:B,disabled:M>=u,"aria-label":W("imageGallery.zoomIn","Zoom in"),children:r.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--plus","aria-hidden":"true"})}),a&&r.jsx("button",{className:"nice-image-gallery-btn nice-image-gallery-close",onClick:s,"aria-label":W("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:se,onTouchMove:re,onTouchEnd:ie,children:[r.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--prev",onClick:S,disabled:!R&&$===0,"aria-label":W("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:[l.placeholder&&!G[$]&&r.jsx("div",{className:"nice-image-gallery-placeholder",style:{backgroundColor:l.placeholder}}),r.jsx("img",{ref:V,src:l.src,alt:l.alt||l.title||"",className:`nice-image-gallery-image ${F?"nice-image-gallery-image--animating":""}`,style:{transform:`scale(${M}) translate(${J/M}px, ${Q/M}px)`,transition:z.current||N.current?"none":"transform 0.2s ease-out"},draggable:!1})]}),r.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--next",onClick:C,disabled:!R&&$===t.length-1,"aria-label":W("imageGallery.nextImage","Next image"),children:r.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--next","aria-hidden":"true"})})]}),d&&l.title&&r.jsxs("div",{className:"nice-image-gallery-caption",children:[r.jsx("h3",{children:l.title}),l.description&&r.jsx("p",{children:l.description})]}),o&&t.length>1&&r.jsx("div",{className:"nice-image-gallery-thumbnails",children:t.map((oe,Y)=>r.jsx("button",{className:`nice-image-gallery-thumb ${Y===$?"nice-image-gallery-thumb--active":""}`,onClick:()=>b(Y),"aria-label":W("imageGallery.goToImage","Go to image {i}").replace("{i}",String(Y+1)),children:r.jsx("img",{src:oe.thumbnail||oe.src,alt:oe.alt||"",loading:"lazy"})},Y))}),!o&&t.length>1&&t.length<=10&&r.jsx("div",{className:"nice-image-gallery-dots",children:t.map((oe,Y)=>r.jsx("button",{className:`nice-image-gallery-dot ${Y===$?"nice-image-gallery-dot--active":""}`,onClick:()=>b(Y),"aria-label":W("imageGallery.goToImage","Go to image {i}").replace("{i}",String(Y+1))},Y))})]})}),{displayName:"NiceImageGallery"}),jn=[],It=e.createContext(null);function Tn(){const t=e.useContext(It);if(!t)throw new Error("useInfiniteScroll must be used within NiceInfiniteScroll");return t}const bt=()=>{const{t}=be.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...")})]})},Mn=()=>{const{t}=be.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"})]})},Rn=({message:t,onRetry:n})=>{const{t:c}=be.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")})]})},Sn=()=>{const{t}=be.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")})]})},Pn=({visible:t,onClick:n})=>{const{t:c}=be.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(Te,{direction:"up",style:{fontSize:20}})})};function Dn({items:t=jn,renderItem:n,onLoadMore:c,hasMore:s,isLoading:a=!1,error:i=null,threshold:d=200,loadingIndicator:o,endIndicator:f,errorIndicator:w,onRetry:v,pullToRefresh:k=!1,onRefresh:g,direction:u="vertical",reverse:m=!1,initialScrollPosition:x="top",keyboardNav:R=!0,keyExtractor:D,emptyContent:j,header:y,footer:I,gap:O=0,className:H="",style:W,ariaLabel:$},T){const{t:M}=be.useNiceTranslation(),K=$??M("infiniteScroll.scrollableList","Scrollable list"),[J,X]=e.useState("idle"),[Q,q]=e.useState(!1),[F,U]=e.useState(!1),G=e.useRef(null),ne=e.useRef(null),te=e.useRef(!1),V=e.useRef(null);e.useEffect(()=>{i?X("error"):a?X("loading"):!s&&t.length>0?X("end"):X("idle")},[i,a,s,t.length]);const L=e.useCallback((P,l)=>D?D(P,l):`item-${l}`,[D]),E=e.useCallback(async()=>{if(!(te.current||!s||i)){te.current=!0;try{await c()}finally{te.current=!1}}},[s,i,c]),A=e.useCallback(()=>{var P;(P=G.current)==null||P.scrollTo({top:0,behavior:"smooth"})},[]),h=e.useCallback(()=>{G.current&&G.current.scrollTo({top:G.current.scrollHeight,behavior:"smooth"})},[]);e.useEffect(()=>{if(!ne.current)return;const P=l=>{const[b]=l;b.isIntersecting&&s&&!a&&!i&&E()};return V.current=new IntersectionObserver(P,{root:G.current,rootMargin:`${d}px`,threshold:.1}),V.current.observe(ne.current),()=>{var l;(l=V.current)==null||l.disconnect()}},[s,a,i,d,E]),e.useEffect(()=>{const P=G.current;if(!P)return;const l=()=>{const b=u==="vertical"?P.scrollTop:P.scrollLeft;q(b>500)};return P.addEventListener("scroll",l,{passive:!0}),()=>P.removeEventListener("scroll",l)},[u]),e.useEffect(()=>{x==="bottom"&&G.current&&(G.current.scrollTop=G.current.scrollHeight)},[x]);const _=e.useCallback(P=>{R&&(P.key==="Home"?(P.preventDefault(),A()):P.key==="End"&&(P.preventDefault(),h()))},[R,A,h]);e.useCallback(async()=>{if(!(!g||F)){U(!0);try{await g()}finally{U(!1)}}},[g,F]);const p=e.useCallback(P=>{G.current=P,typeof T=="function"?T(P):T&&(T.current=P)},[T]),z=e.useMemo(()=>({status:J,loadMore:E,hasMore:s,itemCount:t.length,scrollToTop:A,scrollToBottom:h}),[J,E,s,t.length,A,h]),N=e.useMemo(()=>(m?[...t].reverse():t).map((l,b)=>r.jsx("div",{className:"nice-infinite-item","data-index":b,children:n(l,b)},L(l,b))),[t,m,L,n]);return t.length===0&&!a&&!i?r.jsx("div",{ref:p,className:`nice-infinite-container nice-infinite-container--empty ${H}`,style:W,role:"region","aria-label":K,children:j||r.jsx(Sn,{})}):r.jsx(It.Provider,{value:z,children:r.jsxs("div",{ref:p,className:`nice-infinite-container nice-infinite-container--${u} ${m?"nice-infinite-container--reverse":""} ${H}`,style:W,onKeyDown:_,tabIndex:0,role:"feed","aria-label":K,"aria-busy":a,children:[y&&r.jsx("div",{className:"nice-infinite-header",children:y}),k&&F&&r.jsx("div",{className:"nice-infinite-pull",children:o||r.jsx(bt,{})}),r.jsx("div",{className:"nice-infinite-items",style:{gap:O},children:N}),r.jsx("div",{ref:ne,className:"nice-infinite-sentinel","aria-hidden":"true"}),J==="loading"&&(o||r.jsx(bt,{})),J==="error"&&i&&(w||r.jsx(Rn,{message:i,onRetry:v})),J==="end"&&(f||r.jsx(Mn,{})),I&&r.jsx("div",{className:"nice-infinite-footer",children:I}),r.jsx(Pn,{visible:Q,onClick:A})]})})}const Cn=e.forwardRef(Dn);function In(t){const{t:n}=be.useNiceTranslation(),{fetchPage:c,initialCursor:s,refetchOnFocus:a=!1}=t,[i,d]=e.useState([]),[o,f]=e.useState(s),[w,v]=e.useState(!1),[k,g]=e.useState(null),[u,m]=e.useState(!0),[x,R]=e.useState(!1),D=e.useCallback(async()=>{if(!(w||!u)){v(!0),g(null);try{const I=await c(o);d(O=>[...O,...I.items]),f(I.nextCursor),m(I.hasMore),R(!0)}catch(I){g(I instanceof Error?I.message:n("infiniteScroll.failedToLoadData","Failed to load data"))}finally{v(!1)}}},[c,o,w,u,n]),j=e.useCallback(async()=>{d([]),f(s),m(!0),g(null),v(!0);try{const I=await c(s);d(I.items),f(I.nextCursor),m(I.hasMore)}catch(I){g(I instanceof Error?I.message:n("infiniteScroll.failedToRefreshData","Failed to refresh data"))}finally{v(!1)}},[c,s,n]),y=e.useCallback(()=>{d([]),f(s),m(!0),g(null),R(!1)},[s]);return e.useEffect(()=>{!x&&!w&&D()},[x,w,D]),e.useEffect(()=>{if(!a)return;const I=()=>{x&&j()};return window.addEventListener("focus",I),()=>window.removeEventListener("focus",I)},[a,x,j]),{items:i,isLoading:w,error:k,hasMore:u,loadMore:D,refresh:j,reset:y}}function $n(t){const{itemCount:n,itemHeight:c,overscan:s=5,containerRef:a}=t,[i,d]=e.useState(0),[o,f]=e.useState(0),w=e.useCallback(u=>typeof c=="function"?c(u):c,[c]),v=e.useMemo(()=>{let u=0;for(let m=0;m<n;m++)u+=w(m);return u},[n,w]),k=e.useMemo(()=>{const u=[];let m=0,x=-1,R=-1;for(let D=0;D<n;D++){const j=w(D),y=m+j;y>=i&&x===-1&&(x=D),m<=i+o&&(R=D),m=y}x=Math.max(0,x-s),R=Math.min(n-1,R+s),m=0;for(let D=0;D<n;D++){const j=w(D);D>=x&&D<=R&&u.push({index:D,start:m,size:j,end:m+j}),m+=j}return u},[n,w,i,o,s]);e.useEffect(()=>{const u=a.current;if(!u)return;f(u.clientHeight);const m=()=>{d(u.scrollTop)},x=()=>{f(u.clientHeight)};return u.addEventListener("scroll",m,{passive:!0}),window.addEventListener("resize",x),()=>{u.removeEventListener("scroll",m),window.removeEventListener("resize",x)}},[a]);const g=e.useCallback(u=>{const m=a.current;if(!m)return;let x=0;for(let R=0;R<u&&R<n;R++)x+=w(R);m.scrollTo({top:x,behavior:"smooth"})},[a,n,w]);return{virtualItems:k,totalSize:v,scrollToIndex:g}}const $t=e.createContext(null);function En(){const t=e.useContext($t);if(!t)throw new Error("useMobileDrawer must be used within NiceMobileDrawer");return t}const Et=({item:t,depth:n=0,onSelect:c,activeId:s})=>{const[a,i]=e.useState(!1),d=t.children&&t.children.length>0,o=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?i(!a):(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} ${o?"nice-drawer-nav-item--active":""} ${t.disabled?"nice-drawer-nav-item--disabled":""}`,onClick:f,disabled:t.disabled,"aria-expanded":d?a:void 0,"aria-current":o?"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 ${a?"nice-drawer-nav-chevron--expanded":""}`,children:r.jsx(Te,{direction:"down",style:{fontSize:18}})})]}),d&&a&&r.jsx("div",{className:"nice-drawer-nav-children",children:t.children.map(w=>r.jsx(Et,{item:w,depth:n+1,onSelect:c,activeId:s},w.id))})]})},_n=Object.assign(e.forwardRef(({open:t,onClose:n,position:c="left",variant:s="overlay",size:a,children:i,navItems:d,header:o,footer:f,swipeToOpen:w=!0,swipeToClose:v=!0,edgeSwipeWidth:k=20,velocityThreshold:g=.3,showOverlay:u=!0,closeOnOverlayClick:m=!0,closeOnEscape:x=!0,disableBodyScroll:R=!0,overlayColor:D,zIndex:j=1e3,onNavSelect:y,activeNavId:I,className:O="",style:H,ariaLabel:W},$)=>{const{t:T}=be.useNiceTranslation(),M=W??T("mobileDrawer.navigationDrawer","Navigation drawer"),[K,J]=e.useState(0),[X,Q]=e.useState(!1),[q,F]=e.useState(I),U=e.useRef(null),G=e.useRef({x:0,y:0}),ne=e.useRef(0),te=e.useRef({x:0,y:0}),V=c==="left"||c==="right",E=a??(V?280:400);e.useEffect(()=>{I!==void 0&&F(I)},[I]),e.useEffect(()=>{if(R&&t){const l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l}}},[t,R]),e.useEffect(()=>{if(!x||!t)return;const l=b=>{b.key==="Escape"&&n()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[x,t,n]),e.useEffect(()=>{if(!t||!U.current)return;const l=U.current,b=l.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),C=b[0],S=b[b.length-1],Z=B=>{B.key==="Tab"&&(B.shiftKey&&document.activeElement===C?(B.preventDefault(),S==null||S.focus()):!B.shiftKey&&document.activeElement===S&&(B.preventDefault(),C==null||C.focus()))};return l.addEventListener("keydown",Z),C==null||C.focus(),()=>l.removeEventListener("keydown",Z)},[t]);const A=e.useCallback(()=>{let l=0;const b=K;if(!t)switch(c){case"left":l=-100;break;case"right":l=100;break;case"top":l=-100;break;case"bottom":l=100;break}return V?`translateX(calc(${l}% + ${b}px))`:`translateY(calc(${l}% + ${b}px))`},[t,c,K,V]),h=e.useCallback(l=>{if(!v&&t)return;const b=l.touches[0];G.current={x:b.clientX,y:b.clientY},te.current={x:b.clientX,y:b.clientY},ne.current=Date.now()},[v,t]),_=e.useCallback(l=>{if(!v||!t)return;const b=l.touches[0],C=b.clientX-G.current.x,S=b.clientY-G.current.y;let Z=!1,B=0;switch(c){case"left":Z=C<0,B=Math.min(0,C);break;case"right":Z=C>0,B=Math.max(0,C);break;case"top":Z=S<0,B=Math.min(0,S);break;case"bottom":Z=S>0,B=Math.max(0,S);break}Z&&Math.abs(V?C:S)>10&&(Q(!0),J(B),te.current={x:b.clientX,y:b.clientY},l.preventDefault())},[v,t,c,V]),p=e.useCallback(()=>{if(!X)return;const l=Date.now()-ne.current,b=Math.abs(K),C=typeof E=="number"?E:280,S=b/l;(b>C*.3||S>g)&&n(),Q(!1),J(0)},[X,K,E,g,V,n]);e.useEffect(()=>{if(!w||t)return;let l=0,b=0,C=!1;const S=B=>{const ae=B.touches[0];l=ae.clientX,b=ae.clientY;const le=window.innerWidth,se=window.innerHeight;switch(c){case"left":C=l<k;break;case"right":C=l>le-k;break;case"top":C=b<k;break;case"bottom":C=b>se-k;break}},Z=B=>{if(!C)return;const ae=B.touches[0],le=ae.clientX-l,se=ae.clientY-b,re=50;let ie=!1;switch(c){case"left":ie=le>re;break;case"right":ie=le<-re;break;case"top":ie=se>re;break;case"bottom":ie=se<-re;break}ie&&B.preventDefault()};return document.addEventListener("touchstart",S,{passive:!0}),document.addEventListener("touchmove",Z,{passive:!1}),()=>{document.removeEventListener("touchstart",S),document.removeEventListener("touchmove",Z)}},[w,t,c,k]);const z=e.useCallback(l=>{F(l.id),y==null||y(l),l.href&&n()},[y,n]),N=e.useCallback(l=>{U.current=l,typeof $=="function"?$(l):$&&($.current=l)},[$]),P=e.useMemo(()=>({isOpen:t,position:c,close:n,activeNavId:q,setActiveNavId:F}),[t,c,n,q]);return r.jsxs($t.Provider,{value:P,children:[u&&s!=="persistent"&&r.jsx("div",{className:`nice-drawer-overlay ${t?"nice-drawer-overlay--visible":""}`,style:{zIndex:j-1,background:D,opacity:X?1-Math.abs(K)/(typeof E=="number"?E:280):void 0},onClick:m?n:void 0,"aria-hidden":"true"}),r.jsxs("div",{ref:N,className:`nice-drawer nice-drawer--${c} nice-drawer--${s} ${t?"nice-drawer--open":""} ${X?"nice-drawer--dragging":""} ${O}`,style:{...H,[V?"width":"height"]:E,zIndex:j,transform:A()},onTouchStart:h,onTouchMove:_,onTouchEnd:p,role:"dialog","aria-modal":s!=="persistent","aria-label":M,"aria-hidden":!t,children:[o&&r.jsxs("div",{className:"nice-drawer-header",children:[o,r.jsx("button",{className:"nice-drawer-close",onClick:n,"aria-label":T("mobileDrawer.closeDrawer","Close drawer"),children:r.jsx(Ze,{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(l=>r.jsx(Et,{item:l,onSelect:z,activeId:q},l.id))}):i}),f&&r.jsx("div",{className:"nice-drawer-footer",children:f})]})]})}),{displayName:"NiceMobileDrawer"});function Ln(t={}){const{defaultOpen:n=!1,onOpenChange:c}=t,[s,a]=e.useState(n),i=e.useCallback(()=>{a(!0),c==null||c(!0)},[c]),d=e.useCallback(()=>{a(!1),c==null||c(!1)},[c]),o=e.useCallback(()=>{a(w=>{const v=!w;return c==null||c(v),v})},[c]),f=e.useCallback(w=>{a(w),c==null||c(w)},[c]);return{isOpen:s,open:i,close:d,toggle:o,setOpen:f}}const An={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"})},Yn=[],_t=e.createContext(null);function Hn(){const t=e.useContext(_t);if(!t)throw new Error("useMobileModal must be used within a NiceMobileModal");return t}function zn(t={}){const{defaultOpen:n=!1,open:c,onOpenChange:s,preventDismiss:a=!1}=t,[i,d]=e.useState(n),o=c!==void 0,f=o?c:i,w=e.useCallback((u,m)=>{!u&&a&&m!=="close"||(o||d(u),s==null||s(u,m))},[o,s,a]),v=e.useCallback(()=>w(!0),[w]),k=e.useCallback(u=>w(!1,u),[w]),g=e.useCallback(()=>w(!f),[w,f]);return{open:f,openModal:v,closeModal:k,toggle:g,setOpen:u=>w(u)}}const Fn=()=>r.jsx(Ze,{style:{fontSize:24}});function Bn(t,n,c){return t==="content"?Math.min(c,n):t==="full"?n:t<=1?n*t:Math.min(t,n)}function On(t,n,c){return Math.min(Math.max(t,n),c)}const et=e.forwardRef(function({open:n,onClose:c,title:s,children:a,footer:i,snapPoints:d=["content"],defaultSnapPoint:o=0,showHandle:f=!0,showClose:w=!0,showOverlay:v=!0,dismissOnDrag:k=!0,dismissOnOverlay:g=!0,dismissOnEscape:u=!0,preventDismiss:m=!1,onSnapChange:x,className:R="",overlayClassName:D="",headerClassName:j="",contentClassName:y="",footerClassName:I="",lockScroll:O=!0,borderRadius:H=16,zIndex:W,style:$,...T},M){const{t:K}=be.useNiceTranslation(),X=`${e.useId()}-title`,Q=e.useRef(null),q=e.useRef(null),F=e.useRef(0),U=e.useRef(0),G=e.useRef(!1),[ne,te]=e.useState(o),[V,L]=e.useState(0),[E,A]=e.useState(400),[h,_]=e.useState(typeof window<"u"?window.innerHeight:800),[p,z]=e.useState(!1),N=d.map(Y=>Bn(Y,h,E));e.useEffect(()=>{if(typeof window>"u")return;const Y=()=>{_(window.innerHeight)};return window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)},[]),e.useEffect(()=>{if(!q.current||!n)return;const Y=new ResizeObserver(()=>{const ee=q.current,ce=Q.current;if(!ee)return;let ue=0;for(const fe of Array.from((ce==null?void 0:ce.children)??[]))fe!==ee&&(ue+=fe.offsetHeight);A(Math.min(ee.scrollHeight+ue,h*.9))});return Y.observe(q.current),()=>Y.disconnect()},[n,h]),e.useEffect(()=>{if(n){const Y=N[o]||N[0]||h*.5;L(Y),te(o)}},[n]);const P=N.join(",");e.useEffect(()=>{if(n&&!p){const Y=P.split(",").map(Number),ee=Y[ne]||Y[0];L(ee)}},[P,ne,p,n]),e.useEffect(()=>{if(!O||!n)return;const Y=document.body.style.overflow,ee=document.body.style.paddingRight,ce=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",ce>0&&(document.body.style.paddingRight=`${ce}px`),()=>{document.body.style.overflow=Y,document.body.style.paddingRight=ee}},[n,O]),e.useEffect(()=>{if(!n||!u||m)return;const Y=ee=>{ee.key==="Escape"&&(c==null||c("escape"))};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[n,u,m,c]),e.useEffect(()=>{if(!n||!Q.current)return;const ee=Q.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),ce=ee[0],ue=ee[ee.length-1],fe=me=>{me.key==="Tab"&&(me.shiftKey?document.activeElement===ce&&(me.preventDefault(),ue==null||ue.focus()):document.activeElement===ue&&(me.preventDefault(),ce==null||ce.focus()))};return document.addEventListener("keydown",fe),requestAnimationFrame(()=>{ce==null||ce.focus()}),()=>document.removeEventListener("keydown",fe)},[n]);const l=e.useCallback(Y=>{m&&Y!=="close"||c==null||c(Y)},[m,c]),b=e.useCallback(()=>{g&&l("overlay")},[g,l]),C=e.useCallback((Y,ee)=>{if(ee>.5&&k&&!m)return-1;if(ee<-.5)return N.length-1;let ce=0,ue=Math.abs(N[0]-Y);for(let fe=1;fe<N.length;fe++){const me=Math.abs(N[fe]-Y);me<ue&&(ue=me,ce=fe)}return ce},[N,k,m]),S=e.useCallback(Y=>{G.current=!0,F.current=Y,U.current=V,z(!0)},[V]),Z=e.useCallback(Y=>{if(!G.current)return;const ee=F.current-Y,ce=On(U.current+ee,50,h);L(ce)},[h]),B=e.useCallback((Y,ee)=>{if(!G.current)return;G.current=!1,z(!1);const ce=C(V,ee);if(ce===-1){l("drag");return}te(ce),L(N[ce]),x==null||x(ce,d[ce])},[V,C,l,N,d,x]),ae=Y=>{S(Y.touches[0].clientY)},le=Y=>{Z(Y.touches[0].clientY)},se=Y=>{const ee=Y.changedTouches[0],ce=(F.current-ee.clientY)/(Y.timeStamp-(Y.timeStamp-200));B(ee.clientY,ce>0?-ce/1e3:ce/1e3)},re=Y=>{Y.preventDefault(),S(Y.clientY);const ee=ue=>{Z(ue.clientY)},ce=ue=>{const fe=(F.current-ue.clientY)/200;B(ue.clientY,fe>0?-fe/500:fe/500),document.removeEventListener("mousemove",ee),document.removeEventListener("mouseup",ce)};document.addEventListener("mousemove",ee),document.addEventListener("mouseup",ce)},ie=e.useCallback(Y=>{Y<0||Y>=N.length||(te(Y),L(N[Y]),x==null||x(Y,d[Y]))},[N,d,x]),oe={isOpen:n,snapPoints:d,currentSnapIndex:ne,setSnapIndex:ie,close:l};return n?r.jsxs(r.Fragment,{children:[v&&r.jsx("div",{className:`nice-mobile-modal-overlay nice-mobile-modal-overlay--visible ${D}`,onClick:b,"aria-hidden":"true",style:{zIndex:W?W-1:void 0}}),r.jsx(_t.Provider,{value:oe,children:r.jsxs("div",{ref:Y=>{Q.current=Y,typeof M=="function"?M(Y):M&&(M.current=Y)},role:"dialog","aria-modal":"true","aria-labelledby":s?X:void 0,className:`nice-modal-sheet ${p?"nice-modal-sheet--dragging":""} ${R}`,style:{height:V,borderTopLeftRadius:H,borderTopRightRadius:H,zIndex:W,...$},...T,children:[f&&r.jsx("div",{className:"nice-modal-handle-area",onTouchStart:ae,onTouchMove:le,onTouchEnd:se,onMouseDown:re,children:r.jsx("div",{className:"nice-modal-handle"})}),(s||w)&&r.jsxs("div",{className:`nice-modal-header ${j}`,children:[s&&r.jsx("h2",{id:X,className:"nice-modal-title",children:s}),w&&!m&&r.jsx("button",{type:"button",className:"nice-modal-close",onClick:()=>l("close"),"aria-label":K("mobileModal.closeModal","Close modal"),children:r.jsx(Fn,{})})]}),r.jsx("div",{ref:q,className:`nice-modal-content ${y}`,children:a}),i&&r.jsx("div",{className:`nice-modal-footer ${I}`,children:i})]})})]}):null}),Vn=e.forwardRef(function({actions:n=Yn,cancelLabel:c,onClose:s,...a},i){const{t:d}=be.useNiceTranslation(),o=c??d("mobileModal.cancel","Cancel");return r.jsx(et,{ref:i,onClose:s,showHandle:!0,showClose:!1,snapPoints:["content"],...a,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 w;(w=f.onClick)==null||w.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:o})]})})}),Un=e.forwardRef(function({title:n,message:c,confirmLabel:s,cancelLabel:a,confirmDestructive:i=!1,onConfirm:d,onCancel:o,onClose:f,...w},v){const{t:k}=be.useNiceTranslation(),g=s??k("mobileModal.confirm","Confirm"),u=a??k("mobileModal.cancel","Cancel"),m=()=>{d==null||d(),f==null||f("close")},x=()=>{o==null||o(),f==null||f("close")};return r.jsx(et,{ref:v,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:x,children:u}),r.jsx("button",{type:"button",className:`nice-confirm-sheet-btn nice-confirm-sheet-btn--confirm ${i?"nice-confirm-sheet-btn--destructive":""}`,onClick:m,children:g})]}),...w,children:r.jsx("div",{className:"nice-confirm-sheet-message",children:c})})}),tt=[],Lt=e.createContext(null);function Kn(t,n=500){const c=e.useRef(void 0),s=e.useRef(null),a=e.useCallback(o=>{s.current={x:o.clientX,y:o.clientY},c.current=setTimeout(()=>{t(o)},n)},[t,n]),i=e.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=void 0),s.current=null},[]),d=e.useCallback(o=>{if(!s.current)return;const f=Math.abs(o.clientX-s.current.x),w=Math.abs(o.clientY-s.current.y);(f>10||w>10)&&i()},[i]);return e.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]),{onPointerDown:a,onPointerMove:d,onPointerUp:i,onPointerCancel:i,onPointerLeave:i}}const mt=({item:t,onSelect:n})=>{const c=e.useContext(Lt),s=e.useRef(null),[a,i]=e.useState(null),d=e.useCallback(()=>{var v;if(!t.disabled)if(t.children&&t.children.length>0){if(s.current){const k=s.current.getBoundingClientRect();c==null||c.openSubmenu(t.id,{x:k.right,y:k.top})}}else(v=t.onClick)==null||v.call(t),n(t)},[t,n,c]),o=e.useCallback(()=>{if(t.children&&t.children.length>0&&s.current){const v=s.current.getBoundingClientRect();c==null||c.openSubmenu(t.id,{x:v.right,y:v.top})}},[t,c]),f=t.children&&t.children.length>0,w=(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":""} ${w?"nice-touch-menu-item--active":""}`,onClick:d,onPointerEnter:o,disabled:t.disabled,role:"menuitem","aria-haspopup":f?"menu":void 0,"aria-expanded":f?w: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"})]})},At=e.forwardRef(function({items:n=tt,open:c,position:s,onClose:a,haptic:i=!0,className:d="",...o},f){var I;const w=e.useRef(null),[v,k]=e.useState(null),[g,u]=e.useState(null),[m,x]=e.useState(s);e.useEffect(()=>{if(!c||!w.current)return;const H=w.current.getBoundingClientRect(),W={width:window.innerWidth,height:window.innerHeight};let $=s.x,T=s.y;$+H.width>W.width-8&&($=W.width-H.width-8),$<8&&($=8),T+H.height>W.height-8&&(T=W.height-H.height-8),T<8&&(T=8),x({x:$,y:T})},[c,s]),e.useEffect(()=>{if(!c)return;const O=W=>{w.current&&!w.current.contains(W.target)&&a()},H=W=>{W.key==="Escape"&&a()};return document.addEventListener("mousedown",O),document.addEventListener("keydown",H),()=>{document.removeEventListener("mousedown",O),document.removeEventListener("keydown",H)}},[c,a]);const R=e.useCallback(()=>{if(!(!i||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[i]),D=e.useCallback(O=>{R(),a()},[R,a]),j={close:a,openSubmenu:(O,H)=>{k(O),u(H)},closeSubmenu:()=>{k(null),u(null)},activeSubmenu:v};if(!c)return null;const y=v?(I=n.find(O=>O.id===v))==null?void 0:I.children:null;return r.jsx(Lt.Provider,{value:j,children:r.jsxs("div",{ref:w,className:`nice-touch-menu-popover ${d}`,style:{left:m.x,top:m.y},role:"menu",...o,children:[n.map(O=>r.jsx(mt,{item:O,onSelect:D},O.id)),y&&g&&r.jsx("div",{className:"nice-touch-menu-popover nice-touch-menu-submenu",style:{left:g.x-m.x,top:g.y-m.y},role:"menu",children:y.map(O=>r.jsx(mt,{item:O,onSelect:D},O.id))})]})})}),Xn=e.forwardRef(function({items:n=tt,trigger:c,longPress:s=!0,longPressDelay:a=500,enableContextMenu:i=!1,enableClick:d=!1,haptic:o=!0,disabled:f=!1,onOpen:w,onClose:v,className:k="",...g},u){const[m,x]=e.useState(!1),[R,D]=e.useState({x:0,y:0}),j=e.useRef(null),y=e.useCallback(()=>{if(!(!o||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(20)}catch{}},[o]),I=e.useCallback((T,M)=>{f||(y(),D({x:T,y:M}),x(!0),w==null||w())},[f,y,w]),O=e.useCallback(()=>{x(!1),v==null||v()},[v]),H=Kn(T=>{T.preventDefault(),I(T.clientX,T.clientY)},a),W=e.useCallback(T=>{if(!(!d||f)&&(T.preventDefault(),T.stopPropagation(),j.current)){const M=j.current.getBoundingClientRect();I(M.left,M.bottom+4)}},[d,f,I]),$=e.useCallback(T=>{!i||f||(T.preventDefault(),I(T.clientX,T.clientY))},[i,f,I]);return r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:T=>{j.current=T,typeof u=="function"?u(T):u&&(u.current=T)},className:`nice-touch-menu-trigger ${f?"nice-touch-menu-trigger--disabled":""} ${k}`,onClick:W,onContextMenu:$,...s&&!f?H:{},...g,children:c}),r.jsx(At,{items:n,open:m,position:R,onClose:O,haptic:o})]})}),Yt=e.forwardRef(function({items:n=tt,open:c,onClose:s,title:a,cancelLabel:i,haptic:d=!0,className:o="",...f},w){const{t:v}=be.useNiceTranslation(),k=i??v("touchMenu.cancel","Cancel"),g=e.useCallback(()=>{if(!(!d||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[d]),u=e.useCallback(R=>{var D;R.disabled||(g(),(D=R.onClick)==null||D.call(R),s())},[g,s]),m=e.useCallback(()=>{g(),s()},[g,s]),x=e.useCallback(R=>{R.target===R.currentTarget&&s()},[s]);return e.useEffect(()=>{if(!c)return;const R=D=>{D.key==="Escape"&&s()};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[c,s]),c?r.jsx("div",{className:`nice-action-sheet-backdrop ${c?"nice-action-sheet-backdrop--open":""}`,onClick:x,children:r.jsxs("div",{ref:w,className:`nice-action-sheet ${o}`,role:"dialog","aria-modal":"true",...f,children:[r.jsxs("div",{className:"nice-action-sheet-content",children:[a&&r.jsx("div",{className:"nice-action-sheet-title",children:a}),n.map(R=>r.jsxs("button",{type:"button",className:`nice-action-sheet-item ${R.disabled?"nice-action-sheet-item--disabled":""} ${R.danger?"nice-action-sheet-item--danger":""}`,onClick:()=>u(R),disabled:R.disabled,children:[R.icon&&r.jsx("span",{className:"nice-action-sheet-item-icon",children:R.icon}),r.jsx("span",{className:"nice-action-sheet-item-label",children:R.label})]},R.id))]}),r.jsx("button",{type:"button",className:"nice-action-sheet-cancel",onClick:m,children:k})]})}):null}),qn=[],Ht=e.createContext(null);function Gn(){const t=e.useContext(Ht);if(!t)throw new Error("useMobileTabs must be used within a NiceMobileTabs");return t}function Wn(t){var k;const{tabs:n,defaultTab:c,activeTab:s,onChange:a}=t,[i,d]=e.useState(c||((k=n[0])==null?void 0:k.id)||""),o=s!==void 0,f=o?s:i,w=e.useCallback(g=>{const u=n.find(m=>m.id===g);!u||u.disabled||(o||d(g),a==null||a(g))},[n,o,a]),v=e.useCallback(g=>f===g,[f]);return{activeTab:f,setActiveTab:w,tabs:n,isActive:v}}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.NtdShoppingCart,{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"})},pt=({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})},vt=({tab:t,isActive:n,showLabel:c,animation:s,activeColor:a,inactiveColor:i,onClick:d})=>{const{t:o}=be.useNiceTranslation(),f=t.labelKey?o(t.labelKey,t.label):t.label,w=e.useRef(null);e.useEffect(()=>{if(!w.current||s==="none")return;const g=w.current;s==="scale"&&n&&(g.style.transform="scale(1.2)",setTimeout(()=>{g.style.transform="scale(1)"},150))},[n,s]);const v=n&&t.activeIcon?t.activeIcon:t.icon,k={};return n&&a?k.color=a:!n&&i&&(k.color=i),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:k,"aria-current":n?"page":void 0,onClick:g=>{var u;if(t.disabled){g.preventDefault();return}(u=t.onClick)==null||u.call(t),d()},children:[r.jsx("span",{ref:w,className:"nice-tab-icon",children:v}),c&&r.jsx("span",{className:"nice-tab-label",children:f}),r.jsx(pt,{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:k,disabled:t.disabled,"aria-pressed":n,"aria-label":c?void 0:f,onClick:()=>{var g;(g=t.onClick)==null||g.call(t),d()},children:[r.jsx("span",{ref:w,className:"nice-tab-icon",children:v}),c&&r.jsx("span",{className:"nice-tab-label",children:f}),r.jsx(pt,{content:t.badge,variant:t.badgeVariant,color:t.badgeColor})]})},Jn=e.forwardRef(function({tabs:n=qn,activeTab:c,defaultTab:s,onChange:a,showLabels:i=!0,showAllLabels:d=!0,position:o="bottom",variant:f="default",haptic:w=!0,animation:v="scale",maxTabs:k,moreLabel:g,moreIcon:u=he.more,safeArea:m=!0,activeColor:x,inactiveColor:R,backgroundColor:D,hideOnScroll:j="none",lockScroll:y=!0,className:I="",style:O,...H},W){var A;const{t:$}=be.useNiceTranslation(),T=g??$("mobileTabs.more","More"),[M,K]=e.useState(s||((A=n[0])==null?void 0:A.id)||""),[J,X]=e.useState(!1),[Q,q]=e.useState(!1),F=e.useRef(0),U=c!==void 0,G=U?c:M;e.useEffect(()=>{if(j==="none"||typeof window>"u")return;const h=()=>{const _=window.scrollY,p=_>F.current?"down":"up";p===j&&_>50?X(!0):p!==j&&X(!1),F.current=_};return window.addEventListener("scroll",h,{passive:!0}),()=>window.removeEventListener("scroll",h)},[j]);const ne=e.useCallback(h=>{const _=n.find(p=>p.id===h);!_||_.disabled||(w&&"vibrate"in navigator&&navigator.vibrate(10),U||K(h),a==null||a(h))},[n,w,U,a]),te=k&&n.length>k?n.slice(0,k-1):n,V=k&&n.length>k?n.slice(k-1):[],L={activeTab:G,setActiveTab:ne,tabs:n},E={...O};return D&&(E.backgroundColor=D),r.jsxs(Ht.Provider,{value:L,children:[r.jsxs("nav",{ref:W,className:`nice-mobile-tabs nice-mobile-tabs--${o} nice-mobile-tabs--${f} ${m?"nice-mobile-tabs--safe-area":""} ${J?"nice-mobile-tabs--hidden":""} ${I}`,style:E,role:"tablist","aria-label":$("mobileTabs.mainNavigation","Main navigation"),...H,children:[te.map(h=>{const _=h.id===G,p=d||i&&_;return r.jsx(vt,{tab:h,isActive:_,showLabel:p,animation:v,activeColor:x,inactiveColor:R,onClick:()=>ne(h.id)},h.id)}),V.length>0&&r.jsx(vt,{tab:{id:"__more__",label:T,icon:u,badge:V.some(h=>h.badge)?!0:void 0},isActive:V.some(h=>h.id===G),showLabel:d||i,animation:v,activeColor:x,inactiveColor:R,onClick:()=>q(!0)})]}),V.length>0&&r.jsx(Yt,{open:Q,onClose:()=>q(!1),title:T,items:V.map(h=>({id:h.id,label:h.labelKey?$(h.labelKey,h.label):h.label,icon:h.icon,disabled:h.disabled,onClick:()=>ne(h.id)}))})]})}),Qn={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}]},zt=e.createContext(null);function Zn(){const t=e.useContext(zt);if(!t)throw new Error("useMobileHeader must be used within a NiceMobileHeader");return t}function er(t={}){const{collapsedHeight:n=56,expandedHeight:c=200,scrollElement:s,mode:a="scroll",threshold:i=0}=t,[d,o]=e.useState(0),[f,w]=e.useState(!0),v=e.useRef(null),k=e.useRef(0),g=e.useRef(!1),u=c-n,m=c-d*u,x=d>=1;e.useEffect(()=>{const j=s||v.current||window,y=()=>{g.current||(g.current=!0,requestAnimationFrame(()=>{const I=j===window?window.scrollY:j.scrollTop,O=I-k.current;if(a==="scroll"||a==="exitUntilCollapsed"){const H=Math.min(1,Math.max(0,(I-i)/u));o(H)}if(a==="enterAlways"){O>5&&I>i?w(!1):O<-5&&w(!0);const H=u>0?Math.min(1,Math.max(0,I/u)):0;o(H)}k.current=I,g.current=!1}))};return j.addEventListener("scroll",y,{passive:!0}),y(),()=>j.removeEventListener("scroll",y)},[s,a,i,u]);const R=e.useCallback(()=>{o(0),w(!0)},[]),D=e.useCallback(()=>{o(1)},[]);return{progress:d,height:m,isCollapsed:x,isVisible:f,scrollRef:v,expand:R,collapse:D}}const tr=()=>r.jsx(de.NtdChevronLeft,{size:24,variant:"outline"}),nr=()=>r.jsx(de.NtdMenu,{size:24,variant:"outline"}),rr=()=>r.jsx(de.NtdSearch,{size:24,variant:"outline"}),cr=()=>r.jsx(de.NtdMoreVertical,{size:24,variant:"outline"}),sr={back:r.jsx(tr,{}),menu:r.jsx(nr,{}),search:r.jsx(rr,{}),more:r.jsx(cr,{})},ar=({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})]}),Ye=e.forwardRef(function({title:n,largeTitle:c,subtitle:s,leftAction:a,rightActions:i=[],background:d,mode:o="scroll",variant:f="default",collapsedHeight:w=56,expandedHeight:v=c||d?140:56,parallax:k=!1,parallaxSpeed:g=.5,showShadow:u=!0,sticky:m=!0,zIndex:x=100,scrollElement:R,onCollapseChange:D,safeArea:j=!0,backgroundColor:y,textColor:I,showBorder:O=!1,collapsedContent:H,expandedContent:W,className:$="",style:T,children:M,...K},J){const[X,Q]=e.useState(0),[q,F]=e.useState(!0),U=e.useRef(null),G=e.useRef(0),ne=e.useRef(!1),te=v-w,V=v-X*te,L=X>=.9;e.useEffect(()=>{const N=R||window,P=()=>{ne.current||(ne.current=!0,requestAnimationFrame(()=>{const l=N===window?window.scrollY:N.scrollTop,b=l-G.current;if(o==="scroll"||o==="exitUntilCollapsed"){const C=te>0?Math.min(1,Math.max(0,l/te)):0;Q(C),D&&Math.abs(C-X)>.05&&D(C>=.9,C)}if(o==="enterAlways"){b>5&&l>w?F(!1):b<-5&&F(!0);const C=te>0?Math.min(1,Math.max(0,l/te)):0;Q(C)}G.current=l,ne.current=!1}))};return N.addEventListener("scroll",P,{passive:!0}),P(),()=>N.removeEventListener("scroll",P)},[R,o,te,w,D,X]);const E=1-X*2,A=X>.5?(X-.5)*2:0,h=1-X,_=k?`translateY(${X*te*g}px) scale(${1+X*.1})`:void 0,p={height:o==="pin"?w:V,zIndex:x,...T};y&&(p.backgroundColor=y),I&&(p.color=I);const z={progress:X,isCollapsed:L,height:V,expandedHeight:v,collapsedHeight:w};return r.jsxs(zt.Provider,{value:z,children:[r.jsxs("header",{ref:N=>{U.current=N,typeof J=="function"?J(N):J&&(J.current=N)},className:`
|
|
2
2
|
nice-mobile-header
|
|
3
|
-
nice-mobile-header--${
|
|
4
|
-
${
|
|
5
|
-
${
|
|
6
|
-
${
|
|
7
|
-
${
|
|
8
|
-
${
|
|
9
|
-
${
|
|
10
|
-
`,style:I,role:"banner",...X,children:[u&&t.jsx("div",{className:"nice-header-background",style:{opacity:d,transform:T},children:u}),t.jsxs("div",{className:"nice-header-toolbar",style:{height:N},children:[a&&t.jsx("div",{className:"nice-header-left",children:a}),t.jsx("div",{className:"nice-header-center",style:{opacity:s?V:1},children:B||t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"nice-header-title",children:r}),c&&!s&&t.jsx("span",{className:"nice-header-subtitle",children:c})]})}),l.length>0&&t.jsx("div",{className:"nice-header-right",children:l.map(i=>t.jsx(Un,{action:i},i.id))})]}),(s||z)&&t.jsx("div",{className:"nice-header-expanded",style:{opacity:E,visibility:E<=0?"hidden":"visible"},children:z||t.jsxs("div",{className:"nice-header-large-title-container",children:[t.jsx("h1",{className:"nice-header-large-title",children:s}),c&&t.jsx("p",{className:"nice-header-large-subtitle",children:c})]})}),k]}),v&&t.jsx("div",{className:"nice-header-spacer",style:{height:o==="pin"?N:y}})]})}),On=e.forwardRef(function(r,s){return t.jsx(Ee,{ref:s,mode:"scroll",variant:"blur",collapsedHeight:44,expandedHeight:96,safeArea:!0,...r})}),_n=e.forwardRef(function(r,s){return t.jsx(Ee,{ref:s,mode:"enterAlways",variant:"solid",collapsedHeight:56,expandedHeight:56,showShadow:!0,...r})}),qn=e.forwardRef(function(r,s){return t.jsx(Ee,{ref:s,mode:"scroll",variant:"transparent",collapsedHeight:56,expandedHeight:280,parallax:!0,parallaxSpeed:.5,...r})}),Et=e.createContext(null);function Gn(){const n=e.useContext(Et);if(!n)throw new Error("useMobilePicker must be used within a NiceMobilePicker");return n}function Kn(n){var M;const{items:r,defaultValue:s,value:c,onChange:a,itemHeight:l=40,visibleItems:u=5,loop:o=!1}=n,b=e.useRef(null),N=e.useRef(void 0),y=e.useCallback(g=>{if(g===void 0)return 0;const F=r.findIndex(Y=>Y.value===g);return F>=0?F:0},[r]),[w,R]=e.useState(()=>y(c??s)),f=c!==void 0,v=f?y(c):w,p=(M=r[v])==null?void 0:M.value,S=e.useCallback((g,F=!0)=>{if(!b.current)return;const B=(o?(g%r.length+r.length)%r.length:Math.max(0,Math.min(g,r.length-1)))*l;b.current.scrollTo({top:B,behavior:F?"smooth":"auto"})},[r.length,l,u,o]),D=e.useCallback(g=>{const F=r[g];!F||F.disabled||(f||R(g),a==null||a(F.value,F))},[r,f,a]);return e.useEffect(()=>{const g=b.current;if(!g)return;const F=()=>{clearTimeout(N.current),N.current=setTimeout(()=>{const Y=g.scrollTop,B=Math.round(Y/l),z=Math.max(0,Math.min(B,r.length-1));S(z,!0),D(z)},100)};return g.addEventListener("scroll",F,{passive:!0}),()=>{g.removeEventListener("scroll",F),clearTimeout(N.current)}},[l,r.length,S,D]),e.useEffect(()=>{S(v,!1)},[]),{selectedValue:p,selectedIndex:v,setSelectedIndex:D,scrollToIndex:S,containerRef:b}}const Lt=e.forwardRef(function({items:r,value:s,defaultValue:c,onChange:a,itemHeight:l=40,visibleItems:u=5,loop:o=!1,renderItem:b,className:N="",style:y,...w},R){const f=e.useRef(null),v=e.useRef(void 0),p=e.useRef(!1),S=e.useRef(0),D=e.useRef(0),M=e.useCallback(q=>{if(q===void 0)return 0;const J=r.findIndex(Z=>Z.value===q);return J>=0?J:0},[r]),[g,F]=e.useState(()=>M(s??c)),Y=s!==void 0,B=Y?M(s):g,z=Math.floor(u/2),H=l*u,x=z*l,k=e.useCallback((q,J=!0)=>{if(!f.current)return;const ee=Math.max(0,Math.min(q,r.length-1))*l;f.current.scrollTo({top:ee,behavior:J?"smooth":"auto"})},[r.length,l]),X=e.useCallback(q=>{const J=r[q];!J||J.disabled||(Y||F(q),a==null||a(J.value,J))},[r,Y,a]),U=e.useCallback(()=>{if(!f.current)return;const q=f.current.scrollTop,J=Math.round(q/l),Z=Math.max(0,Math.min(J,r.length-1));k(Z,!0),X(Z)},[l,r.length,k,X]);e.useEffect(()=>{const q=f.current;if(!q)return;const J=()=>{clearTimeout(v.current),v.current=setTimeout(U,100)};return q.addEventListener("scroll",J,{passive:!0}),()=>{q.removeEventListener("scroll",J),clearTimeout(v.current)}},[U]),e.useEffect(()=>{k(B,!1)},[]);const A=q=>{var J;p.current=!0,S.current=q.touches[0].clientY,D.current=((J=f.current)==null?void 0:J.scrollTop)||0},L=q=>{if(!p.current||!f.current)return;const J=S.current-q.touches[0].clientY;f.current.scrollTop=D.current+J},G=()=>{p.current=!1},O=q=>{k(q,!0),X(q)};return t.jsx("div",{ref:q=>{f.current=q,typeof R=="function"?R(q):R&&(R.current=q)},className:`nice-picker-column ${N}`,style:{height:H,...y},onTouchStart:A,onTouchMove:L,onTouchEnd:G,...w,children:t.jsx("div",{className:"nice-picker-column-inner",style:{paddingTop:x,paddingBottom:x},children:r.map((q,J)=>{const Z=J===B,ee=Math.abs(J-B),$=ee===0?1:Math.max(.3,1-ee*.25),C=ee===0?1:Math.max(.85,1-ee*.05);return t.jsx("div",{className:`nice-picker-item ${Z?"nice-picker-item--selected":""} ${q.disabled?"nice-picker-item--disabled":""}`,style:{height:l,lineHeight:`${l}px`,opacity:$,transform:`scale(${C})`},onClick:()=>!q.disabled&&O(J),children:b?b(q,Z):q.label},String(q.value))})})})}),Ke=e.forwardRef(function({columns:r,value:s,defaultValue:c,onChange:a,itemHeight:l=40,visibleItems:u=5,loop:o=!1,showLabels:b=!1,renderItem:N,showIndicator:y=!0,indicatorClassName:w="",className:R="",style:f,...v},p){const[S,D]=e.useState(c??{}),M=s!==void 0,g=M?s:S,F=e.useCallback((H,x)=>{const k={...g,[H]:x};M||D(k),a==null||a(k,H)},[g,M,a]),Y=l*u,B=Math.floor(u/2)*l,z={visibleItems:u,itemHeight:l,isScrolling:!1};return t.jsx(Et.Provider,{value:z,children:t.jsxs("div",{ref:p,className:`nice-mobile-picker ${R}`,style:{height:b?Y+24:Y,...f},...v,children:[b&&t.jsx("div",{className:"nice-picker-labels",children:r.map(H=>t.jsx("div",{className:"nice-picker-label",style:{width:H.width},children:H.label},H.id))}),t.jsxs("div",{className:"nice-picker-body",children:[y&&t.jsx("div",{className:`nice-picker-indicator ${w}`,style:{top:B,height:l}}),t.jsx("div",{className:"nice-picker-columns",children:r.map(H=>t.jsx(Lt,{items:H.items,value:g[H.id],onChange:x=>F(H.id,x),itemHeight:l,visibleItems:u,loop:o,renderItem:N?(x,k)=>N(x,H.id,k):void 0,style:{width:H.width,flex:H.width?"none":1}},H.id))}),t.jsx("div",{className:"nice-picker-gradient nice-picker-gradient--top"}),t.jsx("div",{className:"nice-picker-gradient nice-picker-gradient--bottom"})]})]})})});function ke(n,r,s=1,c=2){const a=[];for(let l=n;l<=r;l+=s)a.push({value:l,label:String(l).padStart(c,"0")});return a}const Jn=e.forwardRef(function({value:r,defaultValue:s={hour:12,minute:0},onChange:c,use24Hour:a=!1,minuteStep:l=1,...u},o){const b=e.useMemo(()=>ke(a?0:1,a?23:12,1,2),[a]),N=e.useMemo(()=>ke(0,59,l,2),[l]),y=[{value:"AM",label:"AM"},{value:"PM",label:"PM"}],w=[{id:"hour",items:b,width:60},{id:"minute",items:N,width:60}];a||w.push({id:"period",items:y,width:60});const R=e.useCallback(v=>{const p=v.hour,S=v.minute,D=v.period;let M=p;a||(D==="PM"&&p!==12?M=p+12:D==="AM"&&p===12&&(M=0)),c==null||c({hour:M,minute:S})},[a,c]),f=e.useMemo(()=>{if(!r)return s;if(a)return r;const v=r.hour%12||12,p=r.hour>=12?"PM":"AM";return{hour:v,minute:r.minute,period:p}},[r,s,a]);return t.jsx(Ke,{ref:o,columns:w,value:f,onChange:R,...u})}),Qn=["January","February","March","April","May","June","July","August","September","October","November","December"],Zn=e.forwardRef(function({value:r,defaultValue:s=new Date,onChange:c,minYear:a=new Date().getFullYear()-100,maxYear:l=new Date().getFullYear()+10,...u},o){const b=e.useMemo(()=>ke(1,31,1,2),[]),N=e.useMemo(()=>Qn.map((v,p)=>({value:p,label:v})),[]),y=e.useMemo(()=>ke(a,l,1,4),[a,l]),w=[{id:"day",items:b,width:60},{id:"month",items:N,flex:1},{id:"year",items:y,width:80}],R=e.useCallback(v=>{const p=v.day,S=v.month,D=v.year,M=new Date(D,S+1,0).getDate(),g=Math.min(p,M);c==null||c(new Date(D,S,g))},[c]),f=e.useMemo(()=>{const v=r??s;return{day:v.getDate(),month:v.getMonth(),year:v.getFullYear()}},[r,s]);return t.jsx(Ke,{ref:o,columns:w,value:f,onChange:R,...u})}),Bt=e.createContext(null);function er(){const n=e.useContext(Bt);if(!n)throw new Error("useMobileCalendar must be used within a NiceMobileCalendar");return n}const tr=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Ht=["January","February","March","April","May","June","July","August","September","October","November","December"],nr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ve(n,r){return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function rr(n,r,s){if(!r||!s)return!1;const c=n.getTime();return c>=r.getTime()&&c<=s.getTime()}function sr(n){const r=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())),s=r.getUTCDay()||7;r.setUTCDate(r.getUTCDate()+4-s);const c=new Date(Date.UTC(r.getUTCFullYear(),0,1));return Math.ceil(((r.getTime()-c.getTime())/864e5+1)/7)}function Pe(n,r){const s=new Date(n);return s.setMonth(s.getMonth()+r),s}function ut(n,r){const s=new Date(n);return s.setFullYear(s.getFullYear()+r),s}function At(n={}){const{defaultDate:r=new Date,selectedDate:s,selectedDates:c,selectedRange:a,selectionMode:l="single",minDate:u,maxDate:o,disabledDates:b=[],events:N=[],weekStartDay:y=0,onChange:w}=n,[R,f]=e.useState(r),[v,p]=e.useState("day"),[S,D]=e.useState(null),[M,g]=e.useState([]),[F,Y]=e.useState({start:null,end:null}),B=s??S,z=c??M,H=a??F,x=e.useCallback($=>u&&$<u||o&&$>o?!0:b.some(C=>ve(C,$)),[u,o,b]),k=e.useCallback($=>l==="single"&&B?ve($,B):l==="multiple"?z.some(C=>ve(C,$)):!!(l==="range"&&(H.start&&ve($,H.start)||H.end&&ve($,H.end))),[l,B,z,H]),X=e.useCallback($=>{if(!x($)){if(l==="single")D($),w==null||w($);else if(l==="multiple"){const E=M.some(V=>ve(V,$))?M.filter(V=>!ve(V,$)):[...M,$];g(E),w==null||w(E)}else if(l==="range")if(!F.start||F.start&&F.end){const C={start:$,end:null};Y(C),w==null||w(C)}else{const C=$<F.start?{start:$,end:F.start}:{start:F.start,end:$};Y(C),w==null||w(C)}}},[l,M,F,x,w]),U=e.useCallback($=>f($),[]),A=e.useCallback(()=>f($=>Pe($,-1)),[]),L=e.useCallback(()=>f($=>Pe($,1)),[]),G=e.useCallback(()=>f($=>ut($,-1)),[]),O=e.useCallback(()=>f($=>ut($,1)),[]),q=e.useCallback(()=>f(new Date),[]),J=e.useCallback(()=>{const $=R.getFullYear(),C=R.getMonth(),E=new Date,d=(new Date($,C,1).getDay()-y+7)%7,T=42,I=[];for(let j=0;j<T;j++){const i=new Date($,C,1-d+j),m=i.getMonth()===C,P=i.getDate(),h=N.filter(W=>ve(W.date,i));I.push({date:i,dayOfMonth:P,isCurrentMonth:m,isToday:ve(i,E),isSelected:k(i),isInRange:rr(i,H.start,H.end),isRangeStart:H.start?ve(i,H.start):!1,isRangeEnd:H.end?ve(i,H.end):!1,isDisabled:x(i),isWeekend:i.getDay()===0||i.getDay()===6,events:h.length>0?h:void 0})}return I},[R,y,N,k,H,x]),Z=e.useCallback(()=>Ht.map(($,C)=>({month:C,label:$})),[]),ee=e.useCallback(()=>{const $=R.getFullYear(),C=[];for(let E=$-50;E<=$+50;E++)C.push(E);return C},[R]);return{viewDate:R,selectedDate:B,selectedDates:z,selectedRange:H,view:v,setView:p,goToDate:U,goToPrevMonth:A,goToNextMonth:L,goToPrevYear:G,goToNextYear:O,goToToday:q,selectDate:X,isDateSelected:k,isDateDisabled:x,getDaysInMonth:J,getMonths:Z,getYears:ee}}const cr=()=>t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"15 18 9 12 15 6"})}),ir=()=>t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"9 18 15 12 9 6"})}),ar=({cell:n,compact:r,onClick:s,renderDay:c})=>c?t.jsx(t.Fragment,{children:c(n)}):t.jsxs("button",{type:"button",className:`
|
|
3
|
+
nice-mobile-header--${f}
|
|
4
|
+
${m?"nice-mobile-header--sticky":""}
|
|
5
|
+
${L&&u?"nice-mobile-header--shadow":""}
|
|
6
|
+
${O?"nice-mobile-header--border":""}
|
|
7
|
+
${j?"nice-mobile-header--safe-area":""}
|
|
8
|
+
${q?"":"nice-mobile-header--hidden"}
|
|
9
|
+
${$}
|
|
10
|
+
`,style:p,role:"banner",...K,children:[d&&r.jsx("div",{className:"nice-header-background",style:{opacity:h,transform:_},children:d}),r.jsxs("div",{className:"nice-header-toolbar",style:{height:w},children:[a&&r.jsx("div",{className:"nice-header-left",children:a}),r.jsx("div",{className:"nice-header-center",style:{opacity:c?A:1},children:H||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})]})}),i.length>0&&r.jsx("div",{className:"nice-header-right",children:i.map(N=>r.jsx(ar,{action:N},N.id))})]}),(c||W)&&r.jsx("div",{className:"nice-header-expanded",style:{opacity:E,visibility:E<=0?"hidden":"visible"},children:W||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})]})}),M]}),m&&r.jsx("div",{className:"nice-header-spacer",style:{height:o==="pin"?w:v}})]})}),ir=e.forwardRef(function(n,c){return r.jsx(Ye,{ref:c,mode:"scroll",variant:"blur",collapsedHeight:44,expandedHeight:96,safeArea:!0,...n})}),lr=e.forwardRef(function(n,c){return r.jsx(Ye,{ref:c,mode:"enterAlways",variant:"solid",collapsedHeight:56,expandedHeight:56,showShadow:!0,...n})}),or=e.forwardRef(function(n,c){return r.jsx(Ye,{ref:c,mode:"scroll",variant:"transparent",collapsedHeight:56,expandedHeight:280,parallax:!0,parallaxSpeed:.5,...n})}),ur=[],dr=[],Ft=e.createContext(null);function fr(){const t=e.useContext(Ft);if(!t)throw new Error("useMobilePicker must be used within a NiceMobilePicker");return t}function hr(t){var j;const{items:n,defaultValue:c,value:s,onChange:a,itemHeight:i=40,visibleItems:d=5,loop:o=!1}=t,f=e.useRef(null),w=e.useRef(void 0),v=e.useCallback(y=>{if(y===void 0)return 0;const I=n.findIndex(O=>O.value===y);return I>=0?I:0},[n]),[k,g]=e.useState(()=>v(s??c)),u=s!==void 0,m=u?v(s):k,x=(j=n[m])==null?void 0:j.value,R=e.useCallback((y,I=!0)=>{if(!f.current)return;const H=(o?(y%n.length+n.length)%n.length:Math.max(0,Math.min(y,n.length-1)))*i;f.current.scrollTo({top:H,behavior:I?"smooth":"auto"})},[n.length,i,d,o]),D=e.useCallback(y=>{const I=n[y];!I||I.disabled||(u||g(y),a==null||a(I.value,I))},[n,u,a]);return e.useEffect(()=>{const y=f.current;if(!y)return;const I=()=>{clearTimeout(w.current),w.current=setTimeout(()=>{const O=y.scrollTop,H=Math.round(O/i),W=Math.max(0,Math.min(H,n.length-1));R(W,!0),D(W)},100)};return y.addEventListener("scroll",I,{passive:!0}),()=>{y.removeEventListener("scroll",I),clearTimeout(w.current)}},[i,n.length,R,D]),e.useEffect(()=>{R(m,!1)},[]),{selectedValue:x,selectedIndex:m,setSelectedIndex:D,scrollToIndex:R,containerRef:f}}const Bt=e.forwardRef(function({items:n=ur,value:c,defaultValue:s,onChange:a,itemHeight:i=40,visibleItems:d=5,loop:o=!1,renderItem:f,className:w="",style:v,...k},g){const u=e.useRef(null),m=e.useRef(void 0),x=e.useRef(!1),R=e.useRef(0),D=e.useRef(0),j=e.useCallback(U=>{if(U===void 0)return 0;const G=n.findIndex(ne=>ne.value===U);return G>=0?G:0},[n]),[y,I]=e.useState(()=>j(c??s)),O=c!==void 0,H=O?j(c):y,W=Math.floor(d/2),$=i*d,T=W*i,M=e.useCallback((U,G=!0)=>{if(!u.current)return;const te=Math.max(0,Math.min(U,n.length-1))*i;u.current.scrollTo({top:te,behavior:G?"smooth":"auto"})},[n.length,i]),K=e.useCallback(U=>{const G=n[U];!G||G.disabled||(O||I(U),a==null||a(G.value,G))},[n,O,a]),J=e.useCallback(()=>{if(!u.current)return;const U=u.current.scrollTop,G=Math.round(U/i),ne=Math.max(0,Math.min(G,n.length-1));M(ne,!0),K(ne)},[i,n.length,M,K]);e.useEffect(()=>{const U=u.current;if(!U)return;const G=()=>{clearTimeout(m.current),m.current=setTimeout(J,100)};return U.addEventListener("scroll",G,{passive:!0}),()=>{U.removeEventListener("scroll",G),clearTimeout(m.current)}},[J]),e.useEffect(()=>{M(H,!1)},[]);const X=U=>{var G;x.current=!0,R.current=U.touches[0].clientY,D.current=((G=u.current)==null?void 0:G.scrollTop)||0},Q=U=>{if(!x.current||!u.current)return;const G=R.current-U.touches[0].clientY;u.current.scrollTop=D.current+G},q=()=>{x.current=!1},F=U=>{M(U,!0),K(U)};return r.jsx("div",{ref:U=>{u.current=U,typeof g=="function"?g(U):g&&(g.current=U)},className:`nice-picker-column ${w}`,style:{height:$,...v},onTouchStart:X,onTouchMove:Q,onTouchEnd:q,...k,children:r.jsx("div",{className:"nice-picker-column-inner",style:{paddingTop:T,paddingBottom:T},children:n.map((U,G)=>{const ne=G===H,te=Math.abs(G-H),V=te===0?1:Math.max(.3,1-te*.25),L=te===0?1:Math.max(.85,1-te*.05);return r.jsx("div",{className:`nice-picker-item ${ne?"nice-picker-item--selected":""} ${U.disabled?"nice-picker-item--disabled":""}`,style:{height:i,lineHeight:`${i}px`,opacity:V,transform:`scale(${L})`},onClick:()=>!U.disabled&&F(G),children:f?f(U,ne):U.label},String(U.value))})})})}),nt=e.forwardRef(function({columns:n=dr,value:c,defaultValue:s,onChange:a,itemHeight:i=40,visibleItems:d=5,loop:o=!1,showLabels:f=!1,renderItem:w,showIndicator:v=!0,indicatorClassName:k="",className:g="",style:u,...m},x){const[R,D]=e.useState(s??{}),j=c!==void 0,y=j?c:R,I=e.useCallback(($,T)=>{const M={...y,[$]:T};j||D(M),a==null||a(M,$)},[y,j,a]),O=i*d,H=Math.floor(d/2)*i,W={visibleItems:d,itemHeight:i,isScrolling:!1};return r.jsx(Ft.Provider,{value:W,children:r.jsxs("div",{ref:x,className:`nice-mobile-picker ${g}`,style:{height:f?O+24:O,...u},...m,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:[v&&r.jsx("div",{className:`nice-picker-indicator ${k}`,style:{top:H,height:i}}),r.jsx("div",{className:"nice-picker-columns",children:n.map($=>r.jsx(Bt,{items:$.items,value:y[$.id],onChange:T=>I($.id,T),itemHeight:i,visibleItems:d,loop:o,renderItem:w?(T,M)=>w(T,$.id,M):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 je(t,n,c=1,s=2){const a=[];for(let i=t;i<=n;i+=c)a.push({value:i,label:String(i).padStart(s,"0")});return a}const br=e.forwardRef(function({value:n,defaultValue:c={hour:12,minute:0},onChange:s,use24Hour:a=!1,minuteStep:i=1,...d},o){const{t:f}=be.useNiceTranslation(),w=e.useMemo(()=>je(a?0:1,a?23:12,1,2),[a]),v=e.useMemo(()=>je(0,59,i,2),[i]),k=[{value:"AM",label:f("mobilePicker.am","AM")},{value:"PM",label:f("mobilePicker.pm","PM")}],g=[{id:"hour",items:w,width:60},{id:"minute",items:v,width:60}];a||g.push({id:"period",items:k,width:60});const u=e.useCallback(x=>{const R=x.hour,D=x.minute,j=x.period;let y=R;a||(j==="PM"&&R!==12?y=R+12:j==="AM"&&R===12&&(y=0)),s==null||s({hour:y,minute:D})},[a,s]),m=e.useMemo(()=>{if(!n)return c;if(a)return n;const x=n.hour%12||12,R=n.hour>=12?"PM":"AM";return{hour:x,minute:n.minute,period:R}},[n,c,a]);return r.jsx(nt,{ref:o,columns:g,value:m,onChange:u,...d})}),mr=["January","February","March","April","May","June","July","August","September","October","November","December"],pr=e.forwardRef(function({value:n,defaultValue:c=new Date,onChange:s,minYear:a=new Date().getFullYear()-100,maxYear:i=new Date().getFullYear()+10,...d},o){const f=e.useMemo(()=>je(1,31,1,2),[]),w=e.useMemo(()=>mr.map((m,x)=>({value:x,label:m})),[]),v=e.useMemo(()=>je(a,i,1,4),[a,i]),k=[{id:"day",items:f,width:60},{id:"month",items:w,flex:1},{id:"year",items:v,width:80}],g=e.useCallback(m=>{const x=m.day,R=m.month,D=m.year,j=new Date(D,R+1,0).getDate(),y=Math.min(x,j);s==null||s(new Date(D,R,y))},[s]),u=e.useMemo(()=>{const m=n??c;return{day:m.getDate(),month:m.getMonth(),year:m.getFullYear()}},[n,c]);return r.jsx(nt,{ref:o,columns:k,value:u,onChange:g,...d})}),Ot=e.createContext(null);function vr(){const t=e.useContext(Ot);if(!t)throw new Error("useMobileCalendar must be used within a NiceMobileCalendar");return t}const gr=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Vt=["January","February","March","April","May","June","July","August","September","October","November","December"],xr=["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 yr(t,n,c){if(!n||!c)return!1;const s=t.getTime();return s>=n.getTime()&&s<=c.getTime()}function wr(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 gt(t,n){const c=new Date(t);return c.setFullYear(c.getFullYear()+n),c}function Ut(t={}){const{defaultDate:n=new Date,selectedDate:c,selectedDates:s,selectedRange:a,selectionMode:i="single",minDate:d,maxDate:o,disabledDates:f=[],events:w=[],weekStartDay:v=0,onChange:k}=t,[g,u]=e.useState(n),[m,x]=e.useState("day"),[R,D]=e.useState(null),[j,y]=e.useState([]),[I,O]=e.useState({start:null,end:null}),H=c??R,W=s??j,$=a??I,T=e.useCallback(V=>d&&V<d||o&&V>o?!0:f.some(L=>pe(L,V)),[d,o,f]),M=e.useCallback(V=>i==="single"&&H?pe(V,H):i==="multiple"?W.some(L=>pe(L,V)):!!(i==="range"&&($.start&&pe(V,$.start)||$.end&&pe(V,$.end))),[i,H,W,$]),K=e.useCallback(V=>{if(!T(V)){if(i==="single")D(V),k==null||k(V);else if(i==="multiple"){const E=j.some(A=>pe(A,V))?j.filter(A=>!pe(A,V)):[...j,V];y(E),k==null||k(E)}else if(i==="range")if(!I.start||I.start&&I.end){const L={start:V,end:null};O(L),k==null||k(L)}else{const L=V<I.start?{start:V,end:I.start}:{start:I.start,end:V};O(L),k==null||k(L)}}},[i,j,I,T,k]),J=e.useCallback(V=>u(V),[]),X=e.useCallback(()=>u(V=>Ee(V,-1)),[]),Q=e.useCallback(()=>u(V=>Ee(V,1)),[]),q=e.useCallback(()=>u(V=>gt(V,-1)),[]),F=e.useCallback(()=>u(V=>gt(V,1)),[]),U=e.useCallback(()=>u(new Date),[]),G=e.useCallback(()=>{const V=g.getFullYear(),L=g.getMonth(),E=new Date,h=(new Date(V,L,1).getDay()-v+7)%7,_=42,p=[];for(let z=0;z<_;z++){const N=new Date(V,L,1-h+z),P=N.getMonth()===L,l=N.getDate(),b=w.filter(C=>pe(C.date,N));p.push({date:N,dayOfMonth:l,isCurrentMonth:P,isToday:pe(N,E),isSelected:M(N),isInRange:yr(N,$.start,$.end),isRangeStart:$.start?pe(N,$.start):!1,isRangeEnd:$.end?pe(N,$.end):!1,isDisabled:T(N),isWeekend:N.getDay()===0||N.getDay()===6,events:b.length>0?b:void 0})}return p},[g,v,w,M,$,T]),ne=e.useCallback(()=>Vt.map((V,L)=>({month:L,label:V})),[]),te=e.useCallback(()=>{const V=g.getFullYear(),L=[];for(let E=V-50;E<=V+50;E++)L.push(E);return L},[g]);return{viewDate:g,selectedDate:H,selectedDates:W,selectedRange:$,view:m,setView:x,goToDate:J,goToPrevMonth:X,goToNextMonth:Q,goToPrevYear:q,goToNextYear:F,goToToday:U,selectDate:K,isDateSelected:M,isDateDisabled:T,getDaysInMonth:G,getMonths:ne,getYears:te}}const Nr=()=>r.jsx(Te,{direction:"left",style:{fontSize:24}}),kr=()=>r.jsx(Te,{direction:"right",style:{fontSize:24}}),jr=({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
|
-
${
|
|
13
|
-
${
|
|
14
|
-
${
|
|
15
|
-
${
|
|
16
|
-
${
|
|
17
|
-
${
|
|
18
|
-
${
|
|
19
|
-
${
|
|
20
|
-
`,disabled:n.isDisabled,onClick:s,"aria-label":n.date.toLocaleDateString(),"aria-pressed":n.isSelected,children:[t.jsx("span",{className:"nice-calendar-day-number",children:n.dayOfMonth}),n.events&&n.events.length>0&&!r&&t.jsx("span",{className:"nice-calendar-day-dots",children:n.events.slice(0,3).map((a,l)=>t.jsx("span",{className:"nice-calendar-day-dot",style:a.color?{backgroundColor:a.color}:void 0},a.id))})]}),Je=e.forwardRef(function({defaultDate:r,viewDate:s,selectedDate:c,selectedDates:a,selectedRange:l,selectionMode:u="single",minDate:o,maxDate:b,disabledDates:N=[],disableWeekends:y=!1,events:w=[],weekStartDay:R=0,locale:f="en-US",showWeekNumbers:v=!1,showAdjacentMonths:p=!0,enableSwipe:S=!0,onChange:D,onViewChange:M,onMonthChange:g,renderDay:F,renderHeader:Y,showTodayButton:B=!0,todayLabel:z="Today",compact:H=!1,className:x="",...k},X){const U=e.useMemo(()=>N,[N,y]),A=At({defaultDate:r,selectedDate:c,selectedDates:a,selectedRange:l,selectionMode:u,minDate:o,maxDate:b,disabledDates:U,events:w,weekStartDay:R,onChange:D}),[L,G]=e.useState(s??r??new Date),O=e.useRef(0),q=e.useRef(0);e.useEffect(()=>{s&&G(s)},[s]);const J=e.useCallback(()=>{const h=Pe(L,-1);G(h),A.goToDate(h),g==null||g(h),M==null||M(h,A.view)},[L,A,g,M]),Z=e.useCallback(()=>{const h=Pe(L,1);G(h),A.goToDate(h),g==null||g(h),M==null||M(h,A.view)},[L,A,g,M]),ee=e.useCallback(()=>{const h=new Date;G(h),A.goToDate(h),g==null||g(h)},[A,g]),$=e.useRef(null),C=e.useRef(!1),E=e.useRef(!1),V=e.useCallback(h=>{!S||$.current!==null||h.pointerType==="mouse"&&h.button!==0||($.current=h.pointerId,C.current=!1,O.current=h.clientX,q.current=h.clientX)},[S]),d=e.useCallback(h=>{var W,te;h.pointerId===$.current&&(q.current=h.clientX,!C.current&&Math.abs(h.clientX-O.current)>10&&(C.current=!0,(te=(W=h.currentTarget).setPointerCapture)==null||te.call(W,h.pointerId)))},[]),T=e.useCallback(h=>{if(h.pointerId!==$.current||($.current=null,h.type==="pointercancel"))return;const W=O.current-q.current;Math.abs(W)>50&&(E.current=!0,W>0?Z():J())},[Z,J]),I=e.useCallback(h=>{h.pointerId===$.current&&!C.current&&($.current=null)},[]),j=e.useCallback(h=>{y&&(h.getDay()===0||h.getDay()===6)||A.selectDate(h)},[A,y]),i=e.useMemo(()=>{const h=[...tr];return[...h.slice(R),...h.slice(0,R)]},[R]),m=A.getDaysInMonth(),P={viewDate:L,selectedDate:A.selectedDate,selectedDates:A.selectedDates,selectedRange:A.selectedRange,selectionMode:u,view:A.view,selectDate:j,setView:A.setView,goToDate:A.goToDate};return t.jsx(Bt.Provider,{value:P,children:t.jsxs("div",{ref:X,className:`nice-mobile-calendar ${H?"nice-mobile-calendar--compact":""} ${x}`,onPointerDown:V,onPointerMove:d,onPointerUp:T,onPointerCancel:T,onPointerLeave:I,onClickCapture:h=>{E.current&&(E.current=!1,h.stopPropagation(),h.preventDefault())},...k,children:[Y?Y(L,A.view,{prev:J,next:Z,setView:A.setView}):t.jsxs("div",{className:"nice-calendar-header",children:[t.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:J,"aria-label":"Previous month",children:t.jsx(cr,{})}),t.jsxs("button",{type:"button",className:"nice-calendar-title-btn",onClick:()=>A.setView(A.view==="day"?"month":"day"),children:[t.jsx("span",{className:"nice-calendar-month",children:Ht[L.getMonth()]}),t.jsx("span",{className:"nice-calendar-year",children:L.getFullYear()})]}),t.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:Z,"aria-label":"Next month",children:t.jsx(ir,{})})]}),A.view==="day"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:`nice-calendar-weekdays ${v?"nice-calendar-weekdays--with-numbers":""}`,children:[v&&t.jsx("div",{className:"nice-calendar-weekday nice-calendar-weekday--number",children:"W"}),i.map((h,W)=>t.jsx("div",{className:"nice-calendar-weekday",children:H?h.charAt(0):h},h))]}),t.jsx("div",{className:`nice-calendar-grid ${v?"nice-calendar-grid--with-numbers":""}`,children:m.map((h,W)=>{const te=v&&W%7===0;return t.jsxs(e.Fragment,{children:[te&&t.jsx("div",{className:"nice-calendar-week-number",children:sr(h.date)}),!h.isCurrentMonth&&!p?t.jsx("div",{className:"nice-calendar-day nice-calendar-day--empty"}):t.jsx(ar,{cell:{...h,isDisabled:h.isDisabled||y&&h.isWeekend},compact:H,onClick:()=>j(h.date),renderDay:F})]},h.date.toISOString())})})]}),A.view==="month"&&t.jsx("div",{className:"nice-calendar-months",children:A.getMonths().map(({month:h,label:W})=>t.jsx("button",{type:"button",className:`nice-calendar-month-btn ${h===L.getMonth()?"nice-calendar-month-btn--selected":""}`,onClick:()=>{const te=new Date(L.getFullYear(),h,1);G(te),A.goToDate(te),A.setView("day")},children:H?nr[h]:W},h))}),A.view==="year"&&t.jsx("div",{className:"nice-calendar-years",children:A.getYears().map(h=>t.jsx("button",{type:"button",className:`nice-calendar-year-btn ${h===L.getFullYear()?"nice-calendar-year-btn--selected":""}`,onClick:()=>{const W=new Date(h,L.getMonth(),1);G(W),A.goToDate(W),A.setView("month")},children:h},h))}),B&&A.view==="day"&&t.jsx("div",{className:"nice-calendar-footer",children:t.jsx("button",{type:"button",className:"nice-calendar-today-btn",onClick:ee,children:z})})]})})}),lr=e.forwardRef(function(r,s){return t.jsx(Je,{ref:s,selectionMode:"range",...r})}),or=e.forwardRef(function(r,s){return t.jsx(Je,{ref:s,selectionMode:"multiple",...r})}),Yt=e.createContext(null);function ur(){const n=e.useContext(Yt);if(!n)throw new Error("useGesturesContext must be used within a NiceGestures");return n}function ye(n,r){const s=r.x-n.x,c=r.y-n.y;return Math.sqrt(s*s+c*c)}function dt(n,r){return Math.atan2(r.y-n.y,r.x-n.x)*(180/Math.PI)}function Fe(n,r){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}function Ve(n){const r=Math.abs(n.x),s=Math.abs(n.y);return r<5&&s<5?null:r>s?n.x>0?"right":"left":n.y>0?"down":"up"}function Ft(n={}){const{enablePinch:r=!0,enableRotation:s=!0,enablePan:c=!0,enableSwipe:a=!0,enableTap:l=!0,enableDoubleTap:u=!0,enableLongPress:o=!0,minScale:b=.5,maxScale:N=4,panThreshold:y=5,swipeVelocityThreshold:w=.5,swipeDistanceThreshold:R=50,longPressDuration:f=500,doubleTapDelay:v=300,onPinchStart:p,onPinch:S,onPinchEnd:D,onRotateStart:M,onRotate:g,onRotateEnd:F,onPanStart:Y,onPan:B,onPanEnd:z,onSwipe:H,onTap:x,onDoubleTap:k,onLongPress:X}=n,[U,A]=e.useState({scale:1,rotation:0,translation:{x:0,y:0},velocity:{x:0,y:0},center:{x:0,y:0},isActive:!1}),L=e.useRef(new Map),G=e.useRef(0),O=e.useRef(0),q=e.useRef(1),J=e.useRef(0),Z=e.useRef({x:0,y:0}),ee=e.useRef(0),$=e.useRef({x:0,y:0}),C=e.useRef(0),E=e.useRef({x:0,y:0}),V=e.useRef(0),d=e.useRef(null),T=e.useRef(!1),I=e.useRef(!1),j=e.useRef(!1),i=e.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),m=e.useCallback(()=>{A({scale:1,rotation:0,translation:{x:0,y:0},velocity:{x:0,y:0},center:{x:0,y:0},isActive:!1}),q.current=1,J.current=0,Z.current={x:0,y:0}},[]),P=e.useCallback(ne=>{ne.currentTarget.setPointerCapture(ne.pointerId),L.current.set(ne.pointerId,{x:ne.clientX,y:ne.clientY});const ae=L.current.size;if(ae===1)C.current=Date.now(),E.current={x:ne.clientX,y:ne.clientY},$.current={x:ne.clientX,y:ne.clientY},ee.current=Date.now(),o&&(i(),d.current=setTimeout(()=>{X==null||X({position:{x:ne.clientX,y:ne.clientY},duration:f,target:ne.target})},f));else if(ae===2){i();const[re,se]=Array.from(L.current.values());G.current=ye(re,se),O.current=dt(re,se),q.current=U.scale,J.current=U.rotation,r&&!I.current&&(I.current=!0,p==null||p()),s&&!j.current&&(j.current=!0,M==null||M())}A(re=>({...re,isActive:!0}))},[U.scale,U.rotation,o,r,s,f,X,p,M,i]),h=e.useCallback(ne=>{if(!L.current.has(ne.pointerId))return;L.current.set(ne.pointerId,{x:ne.clientX,y:ne.clientY});const ae=L.current.size,re=Date.now();if(ae===1){const se={x:ne.clientX,y:ne.clientY},le={x:se.x-$.current.x,y:se.y-$.current.y},_={x:se.x-E.current.x,y:se.y-E.current.y};if(ye(E.current,se)>y&&(i(),c)){T.current||(T.current=!0,Y==null||Y());const Q=re-ee.current,ie=Q>0?{x:le.x/Q*1e3,y:le.y/Q*1e3}:{x:0,y:0},oe={x:Z.current.x+_.x,y:Z.current.y+_.y};A(ue=>({...ue,translation:oe,velocity:ie,center:se})),B==null||B({translation:oe,delta:le,velocity:ie,center:se,direction:Ve(le)})}$.current=se,ee.current=re}else if(ae===2){const[se,le]=Array.from(L.current.values()),_=ye(se,le),K=dt(se,le),Q=Fe(se,le);if(r){const ie=Math.max(b,Math.min(N,q.current*(_/G.current))),oe=ie-U.scale;A(ue=>({...ue,scale:ie,center:Q})),S==null||S({scale:ie,deltaScale:oe,center:Q,distance:_,initialDistance:G.current})}if(s){let ie=K-O.current;ie>180&&(ie-=360),ie<-180&&(ie+=360);const oe=J.current+ie,ue=oe-U.rotation;A(fe=>({...fe,rotation:oe,center:Q})),g==null||g({rotation:oe,deltaRotation:ue,center:Q})}}},[c,r,s,b,N,y,U.scale,U.rotation,B,Y,S,g,i]),W=e.useCallback(ne=>{ne.currentTarget.releasePointerCapture(ne.pointerId),i();const ae=L.current.size,re=Date.now();if(ae===1){const se={x:ne.clientX,y:ne.clientY},le=ye(E.current,se),_=re-C.current;if(le<y)u&&re-V.current<v?(k==null||k({position:se,target:ne.target}),V.current=0):l&&(setTimeout(()=>{V.current===re&&(x==null||x({position:se,target:ne.target}))},v),V.current=re);else{const K=le/_*1e3;if(a&&K>w&&le>R){const Q={x:se.x-E.current.x,y:se.y-E.current.y},ie=Ve(Q);ie&&(H==null||H({direction:ie,velocity:K,distance:le,duration:_}))}if(T.current){const Q=re-ee.current,ie={x:se.x-$.current.x,y:se.y-$.current.y},oe=Q>0?{x:ie.x/Q*1e3,y:ie.y/Q*1e3}:{x:0,y:0};z==null||z({translation:U.translation,delta:ie,velocity:oe,center:se,direction:Ve(ie)})}}Z.current=U.translation}if(ae===2){if(I.current){const[se,le]=Array.from(L.current.values()),_=Fe(se,le);D==null||D({scale:U.scale,deltaScale:0,center:_,distance:ye(se,le),initialDistance:G.current})}if(j.current){const[se,le]=Array.from(L.current.values()),_=Fe(se,le);F==null||F({rotation:U.rotation,deltaRotation:0,center:_})}}L.current.delete(ne.pointerId),L.current.size===0&&(T.current=!1,I.current=!1,j.current=!1,A(se=>({...se,isActive:!1})))},[l,u,a,v,y,w,R,U.scale,U.rotation,U.translation,x,k,H,z,D,F,i]),te=e.useCallback(ne=>{i(),L.current.delete(ne.pointerId),L.current.size===0&&(T.current=!1,I.current=!1,j.current=!1,A(ae=>({...ae,isActive:!1})))},[i]),ce=e.useCallback(()=>({onPointerDown:P,onPointerMove:h,onPointerUp:W,onPointerCancel:te,style:{touchAction:"none"}}),[P,h,W,te]);return e.useEffect(()=>()=>{i()},[i]),{bind:ce,state:U,reset:m}}const Le=e.forwardRef(function({enablePinch:r=!0,enableRotation:s=!0,enablePan:c=!0,enableSwipe:a=!0,enableTap:l=!0,enableDoubleTap:u=!0,enableLongPress:o=!0,minScale:b=.5,maxScale:N=4,applyTransform:y=!1,initialScale:w=1,scale:R,initialRotation:f=0,rotation:v,initialTranslation:p={x:0,y:0},translation:S,onTransformChange:D,onPinchStart:M,onPinch:g,onPinchEnd:F,onRotateStart:Y,onRotate:B,onRotateEnd:z,onPanStart:H,onPan:x,onPanEnd:k,onSwipe:X,onTap:U,onDoubleTap:A,onLongPress:L,children:G,className:O="",style:q,...J},Z){const ee=Ft({enablePinch:r,enableRotation:s,enablePan:c,enableSwipe:a,enableTap:l,enableDoubleTap:u,enableLongPress:o,minScale:b,maxScale:N,onPinchStart:M,onPinch:i=>{g==null||g(i),D==null||D(ee.state)},onPinchEnd:F,onRotateStart:Y,onRotate:i=>{B==null||B(i),D==null||D(ee.state)},onRotateEnd:z,onPanStart:H,onPan:i=>{x==null||x(i),D==null||D(ee.state)},onPanEnd:k,onSwipe:X,onTap:U,onDoubleTap:A,onLongPress:L}),{bind:$,state:C}=ee,E=$(),V=R??C.scale,d=v??C.rotation,T=S??C.translation,I=y?{transform:`translate(${T.x}px, ${T.y}px) scale(${V}) rotate(${d}deg)`,transformOrigin:`${C.center.x}px ${C.center.y}px`}:{},j={state:{...C,scale:V,rotation:d,translation:T},reset:ee.reset};return t.jsx(Yt.Provider,{value:j,children:t.jsx("div",{ref:Z,className:`nice-gestures ${C.isActive?"nice-gestures--active":""} ${O}`,style:{...E.style,...q,...I},onPointerDown:E.onPointerDown,onPointerMove:E.onPointerMove,onPointerUp:E.onPointerUp,onPointerCancel:E.onPointerCancel,...J,children:G})})}),dr=e.forwardRef(function(r,s){return t.jsx(Le,{ref:s,enablePinch:!0,enableRotation:!1,enablePan:!1,enableSwipe:!1,enableTap:!1,enableLongPress:!1,applyTransform:!0,...r})}),fr=e.forwardRef(function(r,s){return t.jsx(Le,{ref:s,enablePinch:!1,enableRotation:!1,enablePan:!0,enableSwipe:!1,enableTap:!1,enableLongPress:!1,applyTransform:!0,...r})}),hr=e.forwardRef(function(r,s){return t.jsx(Le,{ref:s,enablePinch:!1,enableRotation:!1,enablePan:!1,enableSwipe:!0,enableTap:!1,enableLongPress:!1,...r})}),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},vr={light:.5,medium:1,heavy:1.5};function ge(){return typeof navigator<"u"&&"vibrate"in navigator}function mr(n,r){return typeof n=="number"?Math.round(n*r):n.map(s=>Math.round(s*r))}function br(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const Vt=e.createContext(null);function pr(){const n=e.useContext(Vt);if(!n)throw new Error("useHapticsContext must be used within a NiceHapticsProvider");return n}function pe(n={}){const{enabled:r=!0,intensity:s="medium",customPatterns:c={}}=n,a=e.useRef(r),[l,u]=e.useState(r),o=e.useMemo(()=>ge(),[]),b=e.useCallback(v=>{a.current=v,u(v)},[]),N=e.useCallback(()=>vr[s],[s]),y=e.useCallback((v=50)=>{if(!o||!a.current)return!1;try{const p=mr(v,N());return navigator.vibrate(p)}catch{return!1}},[o,N]),w=e.useCallback(()=>{o&&navigator.vibrate(0)},[o]),R=e.useCallback(v=>{if(!o||!a.current)return!1;const p=Qe[v];return p?y(p):!1},[o,y]),f=e.useCallback(v=>{if(!o||!a.current)return!1;const p=c[v];return p?y(p):!1},[o,c,y]);return{isSupported:o,isEnabled:l,setEnabled:b,vibrate:y,cancel:w,trigger:R,triggerPattern:f,getIntensityMultiplier:N}}function xr({enabled:n=!0,intensity:r="medium",respectReducedMotion:s=!0,customPatterns:c={},children:a}){const l=e.useMemo(()=>s&&br()?!1:n,[n,s]),u=pe({enabled:l,intensity:r,customPatterns:c});return e.useEffect(()=>{if(!s)return;const o=window.matchMedia("(prefers-reduced-motion: reduce)"),b=N=>{u.setEnabled(!N.matches&&n)};return o.addEventListener("change",b),()=>o.removeEventListener("change",b)},[s,n,u]),t.jsx(Vt.Provider,{value:u,children:a})}function gr(n=50){if(!ge())return!1;try{return navigator.vibrate(n)}catch{return!1}}function yr(n){if(!ge())return!1;const r=Qe[n];if(!r)return!1;try{return navigator.vibrate(r)}catch{return!1}}function wr(){ge()&&navigator.vibrate(0)}function kr(n){return function(s){const c=pe();return t.jsx(n,{...s,haptics:c})}}function jr(){const n=pe();return e.useCallback(()=>{n.trigger("button-press")},[n])}function Nr(){const n=pe();return e.useCallback(r=>{n.trigger(r?"toggle-on":"toggle-off")},[n])}function Mr(){const n=pe();return e.useCallback(()=>{n.trigger("selection")},[n])}function Rr(){const n=pe();return e.useCallback(r=>{n.trigger(`notification-${r}`)},[n])}function Tr(){const n=pe();return e.useCallback((r="medium")=>{n.trigger(`impact-${r}`)},[n])}class zt{constructor(){tt(this,"pattern",[])}vibrate(r){return this.pattern.push(r),this}pause(r){return this.pattern.push(0),this.pattern.push(r),this}pulses(r,s,c){for(let a=0;a<r;a++)this.vibrate(s),a<r-1&&this.pause(c);return this}rampUp(r,s){for(let c=1;c<=r;c++){const a=Math.round(s/r*c);this.vibrate(a),c<r&&this.pause(50)}return this}rampDown(r,s){for(let c=r;c>=1;c--){const a=Math.round(s/r*c);this.vibrate(a),c>1&&this.pause(50)}return this}build(){return[...this.pattern]}execute(){return ge()?navigator.vibrate(this.pattern):!1}}function Cr(){return new zt}const Be={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Se=["xs","sm","md","lg","xl","2xl"];function Xe(n,r){return n>=r["2xl"]?"2xl":n>=r.xl?"xl":n>=r.lg?"lg":n>=r.md?"md":n>=r.sm?"sm":"xs"}function ft(n){return n==="xs"||n==="sm"?"mobile":n==="md"?"tablet":"desktop"}function ht(n,r){return n>=r?"landscape":"portrait"}function Ue(){return typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0}function me(n){return Se.indexOf(n)}function Dr(n,r){let s=null;return(...c)=>{s&&clearTimeout(s),s=setTimeout(()=>n(...c),r)}}const Wt=e.createContext(null);function Pr(){const n=e.useContext(Wt);if(!n)throw new Error("useBreakpointContext must be used within a NiceBreakpointProvider");return n}function je(n={}){const{breakpoints:r,debounceDelay:s=100,ssrDefaultWidth:c=1024}=n,a=e.useMemo(()=>({...Be,...r}),[r]),[l,u]=e.useState(()=>{const f=typeof window<"u"?window.innerWidth:c,v=typeof window<"u"?window.innerHeight:768,p=Xe(f,a),S=ft(p),D=ht(f,v);return{width:f,height:v,breakpoint:p,deviceType:S,orientation:D,isMobile:S==="mobile",isTablet:S==="tablet",isDesktop:S==="desktop",isPortrait:D==="portrait",isLandscape:D==="landscape",isTouchDevice:Ue(),pixelRatio:typeof window<"u"?window.devicePixelRatio:1}});e.useEffect(()=>{if(typeof window>"u")return;const f=()=>{const p=window.innerWidth,S=window.innerHeight,D=Xe(p,a),M=ft(D),g=ht(p,S);u({width:p,height:S,breakpoint:D,deviceType:M,orientation:g,isMobile:M==="mobile",isTablet:M==="tablet",isDesktop:M==="desktop",isPortrait:g==="portrait",isLandscape:g==="landscape",isTouchDevice:Ue(),pixelRatio:window.devicePixelRatio})},v=Dr(f,s);return f(),window.addEventListener("resize",v),window.addEventListener("orientationchange",f),()=>{window.removeEventListener("resize",v),window.removeEventListener("orientationchange",f)}},[a,s]);const o=e.useCallback(f=>l.breakpoint===f,[l.breakpoint]),b=e.useCallback(f=>{const v=me(l.breakpoint),p=me(f);return v>=p},[l.breakpoint]),N=e.useCallback(f=>{const v=me(l.breakpoint),p=me(f);return v<p},[l.breakpoint]),y=e.useCallback((f,v)=>{const p=me(l.breakpoint),S=me(f),D=me(v);return p>=S&&p<=D},[l.breakpoint]),w=e.useCallback((f,v)=>{const p=me(l.breakpoint);for(let S=p;S>=0;S--){const D=Se[S];if(f[D]!==void 0)return f[D]}return f.base??v},[l.breakpoint]),R=e.useCallback((f,v="min")=>{const p=a[f],S=me(f),D=Se[S+1],M=D?a[D]-1:null;return v==="min"?`(min-width: ${p}px)`:v==="max"&&M?`(max-width: ${M}px)`:v==="only"?M?`(min-width: ${p}px) and (max-width: ${M}px)`:`(min-width: ${p}px)`:`(min-width: ${p}px)`},[a]);return{...l,is:o,isAbove:b,isBelow:N,isBetween:y,getResponsive:w,mediaQuery:R}}function Xt(n){const[r,s]=e.useState(()=>typeof window>"u"?!1:window.matchMedia(n).matches);return e.useEffect(()=>{if(typeof window>"u")return;const c=window.matchMedia(n);s(c.matches);const a=l=>s(l.matches);return c.addEventListener("change",a),()=>c.removeEventListener("change",a)},[n]),r}function Sr({breakpoints:n,debounceDelay:r=100,children:s}){const c=je({breakpoints:n,debounceDelay:r});return t.jsx(Wt.Provider,{value:c,children:s})}function Ir({on:n,above:r,below:s,device:c,orientation:a,children:l,fallback:u=null}){const o=je();let b=!0;return n!==void 0?b=o.is(n):r!==void 0?b=o.isAbove(r):s!==void 0&&(b=o.isBelow(s)),c!==void 0&&(b=b&&o.deviceType===c),a!==void 0&&(b=b&&o.orientation===a),b?t.jsx(t.Fragment,{children:l}):t.jsx(t.Fragment,{children:u})}function $r({on:n,above:r,below:s,device:c,orientation:a,children:l}){const u=je();let o=!1;return n!==void 0?o=u.is(n):r!==void 0?o=u.isAbove(r):s!==void 0&&(o=u.isBelow(s)),c!==void 0&&(o=o||u.deviceType===c),a!==void 0&&(o=o||u.orientation===a),o?null:t.jsx(t.Fragment,{children:l})}function Er(n,r="min",s=Be){const c=s[n],a=me(n),l=Se[a+1],u=l?s[l]-1:null;return r==="min"?`@media (min-width: ${c}px)`:r==="max"&&u?`@media (max-width: ${u}px)`:r==="only"?u?`@media (min-width: ${c}px) and (max-width: ${u}px)`:`@media (min-width: ${c}px)`:`@media (min-width: ${c}px)`}function Lr(n){return n}function Ut(n=Be){return typeof window>"u"?null:Xe(window.innerWidth,n)}function Br(){if(typeof window>"u")return!1;const n=Ut();return n==="xs"||n==="sm"}function Hr(){return Ue()}const Ar={sm:"nice-touch-btn--sm",md:"nice-touch-btn--md",lg:"nice-touch-btn--lg",xl:"nice-touch-btn--xl"},Yr={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"},Fr={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:r="primary",size:s="md",shape:c="rounded",fullWidth:a=!1,loading:l=!1,leftIcon:u,rightIcon:o,iconOnly:b=!1,haptic:N=!0,hapticIntensity:y="light",ripple:w=!0,active:R=!1,disabled:f,className:v="",onClick:p,onPointerDown:S,children:D,...M},g){const[F,Y]=e.useState(!1),[B,z]=e.useState(null),H=e.useRef(null),x=e.useCallback(O=>{H.current=O,typeof g=="function"?g(O):g&&(g.current=O)},[g]),k=e.useCallback(()=>{if(!N||typeof navigator>"u"||!("vibrate"in navigator))return;const O={light:10,medium:20,heavy:40};try{navigator.vibrate(O[y]||10)}catch{}},[N,y]),X=e.useCallback(O=>{if(!(f||l)){if(Y(!0),w&&H.current){const q=H.current.getBoundingClientRect();z({x:O.clientX-q.left,y:O.clientY-q.top}),setTimeout(()=>z(null),600)}k(),S==null||S(O)}},[f,l,w,k,S]),U=e.useCallback(()=>{Y(!1)},[]),A=e.useCallback(()=>{Y(!1)},[]),L=e.useCallback(O=>{f||l||p==null||p(O)},[f,l,p]),G=["nice-touch-btn",Yr[r],Ar[s],Fr[c],a?"nice-touch-btn--full-width":"",l?"nice-touch-btn--loading":"",b?"nice-touch-btn--icon-only":"",F?"nice-touch-btn--pressed":"",R?"nice-touch-btn--active":"",v].filter(Boolean).join(" ");return t.jsxs("button",{ref:x,type:"button",className:G,disabled:f||l,onClick:L,onPointerDown:X,onPointerUp:U,onPointerLeave:A,onPointerCancel:A,...M,children:[w&&B&&t.jsx("span",{className:"nice-touch-btn-ripple",style:{left:B.x,top:B.y}}),l&&t.jsx("span",{className:"nice-touch-btn-spinner","aria-hidden":"true",children:t.jsx("svg",{viewBox:"0 0 24 24",className:"nice-touch-btn-spinner-svg",children:t.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"32"})})}),t.jsxs("span",{className:"nice-touch-btn-content",style:{opacity:l?0:1},children:[u&&t.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--left",children:u}),!b&&D&&t.jsx("span",{className:"nice-touch-btn-text",children:D}),o&&t.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--right",children:o})]})]})}),Vr=e.forwardRef(function({icon:r,...s},c){return t.jsx(Ze,{ref:c,iconOnly:!0,leftIcon:r,...s})}),zr=e.forwardRef(function({position:r="bottom-right",mini:s=!1,className:c="",...a},l){const u=`nice-fab--${r}`;return t.jsx(Ze,{ref:l,shape:"circle",size:s?"md":"xl",className:`nice-fab ${u} ${c}`,...a})});function Ot(n){const{min:r,max:s,step:c,value:a,defaultValue:l=r,onChange:u,onChangeCommitted:o}=n,[b,N]=e.useState(l),y=a??b,w=Array.isArray(y),R=e.useCallback(M=>Math.min(s,Math.max(r,M)),[r,s]),f=e.useCallback(M=>{const g=Math.round((M-r)/c)*c+r;return R(g)},[r,c,R]),v=e.useMemo(()=>{const M=s-r;if(w){const[g,F]=y;return[(g-r)/M*100,(F-r)/M*100]}return(y-r)/M*100},[y,r,s,w]),p=e.useCallback(M=>{if(Array.isArray(M)){const[g,F]=M,Y=[f(g),f(F)];Y[0]>Y[1]&&([Y[0],Y[1]]=[Y[1],Y[0]]),N(Y),u==null||u(Y)}else{const g=f(M);N(g),u==null||u(g)}},[f,u]),S=e.useCallback((M,g)=>{const F=s-r,Y=M/100*F+r;if(w&&typeof g=="number"){const z=[...y];z[g]=f(Y),p(z)}else p(Y)},[s,r,w,y,f,p]),D=e.useCallback(()=>{o==null||o(y)},[y,o]);return{value:y,isRange:w,percentage:v,setValue:p,setValueByPercentage:S,commitValue:D,clamp:R,snap:f}}const Wr=e.forwardRef(function({value:r,defaultValue:s,min:c=0,max:a=100,step:l=1,orientation:u="horizontal",disabled:o=!1,marks:b=!1,markStep:N,labelDisplay:y="auto",formatLabel:w=k=>String(k),showRange:R=!1,trackColor:f,fillColor:v,thumbSize:p=44,trackHeight:S=8,haptic:D=!0,snapToMarks:M=!1,onChange:g,onChangeCommitted:F,className:Y="","aria-label":B,"aria-labelledby":z,...H},x){const k=Ot({min:c,max:a,step:l,value:r,defaultValue:s,onChange:g,onChangeCommitted:F}),X=e.useRef(null),[U,A]=e.useState(!1),[L,G]=e.useState(null),[O,q]=e.useState(y==="on"),J=e.useRef(k.value),Z=e.useMemo(()=>{if(!b)return[];if(Array.isArray(b))return b;const i=[],m=N??l;for(let P=c;P<=a;P+=m)i.push({value:P});return i},[b,N,l,c,a]),ee=e.useCallback(i=>{if(!X.current)return 0;const m=X.current.getBoundingClientRect();if(u==="horizontal"){const P=i.clientX-m.left;return Math.max(0,Math.min(100,P/m.width*100))}else{const P=i.clientY-m.top;return Math.max(0,Math.min(100,100-P/m.height*100))}},[u]),$=e.useCallback(()=>{if(!(!D||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[D]),C=e.useCallback(i=>{if(!k.isRange)return 0;const[m,P]=k.percentage,h=Math.abs(i-m),W=Math.abs(i-P);return h<=W?0:1},[k.isRange,k.percentage]),E=e.useCallback((i,m)=>{if(o)return;i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId);const P=ee(i),h=m??C(P);if(A(!0),G(h),q(y!=="off"),M&&Z.length>0){const W=Z.reduce((te,ce)=>{const ne=(te.value-c)/(a-c)*100,ae=(ce.value-c)/(a-c)*100;return Math.abs(ae-P)<Math.abs(ne-P)?ce:te});k.setValue(k.isRange?h===0?[W.value,k.value[1]]:[k.value[0],W.value]:W.value)}else k.setValueByPercentage(P,h);$()},[o,ee,C,y,M,Z,c,a,k,$]),V=e.useCallback(i=>{var P;if(!U||o||L===null)return;const m=ee(i);if(M&&Z.length>0){const h=Z.reduce((te,ce)=>{const ne=(te.value-c)/(a-c)*100,ae=(ce.value-c)/(a-c)*100;return Math.abs(ae-m)<Math.abs(ne-m)?ce:te}),W=k.isRange?L===0?[h.value,k.value[1]]:[k.value[0],h.value]:h.value;JSON.stringify(W)!==JSON.stringify(J.current)&&(k.setValue(W),J.current=W,$())}else{k.setValueByPercentage(m,L);const h=k.isRange?k.value[L]:k.value,W=k.isRange?(P=J.current)==null?void 0:P[L]:J.current;Math.abs(h-W)>=l&&($(),J.current=k.value)}},[U,o,L,ee,M,Z,c,a,k,l,$]),d=e.useCallback(i=>{U&&(i.currentTarget.releasePointerCapture(i.pointerId),A(!1),G(null),y==="auto"&&q(!1),k.commitValue())},[U,y,k]),T=e.useCallback((i,m)=>{if(o)return;let P=k.isRange?k.value[m]:k.value;switch(i.key){case"ArrowRight":case"ArrowUp":i.preventDefault(),P=Math.min(a,P+l);break;case"ArrowLeft":case"ArrowDown":i.preventDefault(),P=Math.max(c,P-l);break;case"Home":i.preventDefault(),P=c;break;case"End":i.preventDefault(),P=a;break;case"PageUp":i.preventDefault(),P=Math.min(a,P+l*10);break;case"PageDown":i.preventDefault(),P=Math.max(c,P-l*10);break;default:return}if(k.isRange){const h=k.value;k.setValue(m===0?[P,h[1]]:[h[0],P])}else k.setValue(P);$(),k.commitValue()},[o,k,a,c,l,$]),I=e.useMemo(()=>{if(k.isRange){const[m,P]=k.percentage;return u==="horizontal"?{left:`${m}%`,width:`${P-m}%`}:{bottom:`${m}%`,height:`${P-m}%`}}const i=k.percentage;return u==="horizontal"?{left:0,width:`${i}%`}:{bottom:0,height:`${i}%`}},[k.isRange,k.percentage,u]),j=(i,m)=>{const P=k.isRange?k.value[i]:k.value,h=u==="horizontal"?{left:`${m}%`}:{bottom:`${m}%`};return t.jsx("div",{className:`nice-touch-slider-thumb ${L===i?"nice-touch-slider-thumb--active":""}`,style:{...h,width:p,height:p},role:"slider",tabIndex:o?-1:0,"aria-label":B,"aria-labelledby":z,"aria-valuenow":P,"aria-valuemin":c,"aria-valuemax":a,"aria-disabled":o,onKeyDown:W=>T(W,i),children:O&&t.jsx("span",{className:"nice-touch-slider-label",children:w(P)})},i)};return t.jsxs("div",{ref:x,className:`
|
|
12
|
+
${t.isCurrentMonth?"":"nice-calendar-day--other-month"}
|
|
13
|
+
${t.isToday?"nice-calendar-day--today":""}
|
|
14
|
+
${t.isSelected?"nice-calendar-day--selected":""}
|
|
15
|
+
${t.isInRange?"nice-calendar-day--in-range":""}
|
|
16
|
+
${t.isRangeStart?"nice-calendar-day--range-start":""}
|
|
17
|
+
${t.isRangeEnd?"nice-calendar-day--range-end":""}
|
|
18
|
+
${t.isDisabled?"nice-calendar-day--disabled":""}
|
|
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((a,i)=>r.jsx("span",{className:"nice-calendar-day-dot",style:a.color?{backgroundColor:a.color}:void 0},a.id))})]}),rt=e.forwardRef(function({defaultDate:n,viewDate:c,selectedDate:s,selectedDates:a,selectedRange:i,selectionMode:d="single",minDate:o,maxDate:f,disabledDates:w=[],disableWeekends:v=!1,events:k=[],weekStartDay:g=0,locale:u="en-US",showWeekNumbers:m=!1,showAdjacentMonths:x=!0,enableSwipe:R=!0,onChange:D,onViewChange:j,onMonthChange:y,renderDay:I,renderHeader:O,showTodayButton:H=!0,todayLabel:W,compact:$=!1,className:T="",...M},K){const{t:J}=be.useNiceTranslation(),X=W??J("mobileCalendar.today","Today"),Q=e.useMemo(()=>w,[w,v]),q=Ut({defaultDate:n,selectedDate:s,selectedDates:a,selectedRange:i,selectionMode:d,minDate:o,maxDate:f,disabledDates:Q,events:k,weekStartDay:g,onChange:D}),[F,U]=e.useState(c??n??new Date),G=e.useRef(0),ne=e.useRef(0);e.useEffect(()=>{c&&U(c)},[c]);const te=e.useCallback(()=>{const S=Ee(F,-1);U(S),q.goToDate(S),y==null||y(S),j==null||j(S,q.view)},[F,q,y,j]),V=e.useCallback(()=>{const S=Ee(F,1);U(S),q.goToDate(S),y==null||y(S),j==null||j(S,q.view)},[F,q,y,j]),L=e.useCallback(()=>{const S=new Date;U(S),q.goToDate(S),y==null||y(S)},[q,y]),E=e.useRef(null),A=e.useRef(!1),h=e.useRef(!1),_=e.useCallback(S=>{!R||E.current!==null||S.pointerType==="mouse"&&S.button!==0||(E.current=S.pointerId,A.current=!1,G.current=S.clientX,ne.current=S.clientX)},[R]),p=e.useCallback(S=>{var Z,B;S.pointerId===E.current&&(ne.current=S.clientX,!A.current&&Math.abs(S.clientX-G.current)>10&&(A.current=!0,(B=(Z=S.currentTarget).setPointerCapture)==null||B.call(Z,S.pointerId)))},[]),z=e.useCallback(S=>{if(S.pointerId!==E.current||(E.current=null,S.type==="pointercancel"))return;const Z=G.current-ne.current;Math.abs(Z)>50&&(h.current=!0,Z>0?V():te())},[V,te]),N=e.useCallback(S=>{S.pointerId===E.current&&!A.current&&(E.current=null)},[]),P=e.useCallback(S=>{v&&(S.getDay()===0||S.getDay()===6)||q.selectDate(S)},[q,v]),l=e.useMemo(()=>{const S=[...gr];return[...S.slice(g),...S.slice(0,g)]},[g]),b=q.getDaysInMonth(),C={viewDate:F,selectedDate:q.selectedDate,selectedDates:q.selectedDates,selectedRange:q.selectedRange,selectionMode:d,view:q.view,selectDate:P,setView:q.setView,goToDate:q.goToDate};return r.jsx(Ot.Provider,{value:C,children:r.jsxs("div",{ref:K,className:`nice-mobile-calendar ${$?"nice-mobile-calendar--compact":""} ${T}`,onPointerDown:_,onPointerMove:p,onPointerUp:z,onPointerCancel:z,onPointerLeave:N,onClickCapture:S=>{h.current&&(h.current=!1,S.stopPropagation(),S.preventDefault())},...M,children:[O?O(F,q.view,{prev:te,next:V,setView:q.setView}):r.jsxs("div",{className:"nice-calendar-header",children:[r.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:te,"aria-label":J("mobileCalendar.previousMonth","Previous month"),children:r.jsx(Nr,{})}),r.jsxs("button",{type:"button",className:"nice-calendar-title-btn",onClick:()=>q.setView(q.view==="day"?"month":"day"),children:[r.jsx("span",{className:"nice-calendar-month",children:Vt[F.getMonth()]}),r.jsx("span",{className:"nice-calendar-year",children:F.getFullYear()})]}),r.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:V,"aria-label":J("mobileCalendar.nextMonth","Next month"),children:r.jsx(kr,{})})]}),q.view==="day"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:`nice-calendar-weekdays ${m?"nice-calendar-weekdays--with-numbers":""}`,children:[m&&r.jsx("div",{className:"nice-calendar-weekday nice-calendar-weekday--number",children:"W"}),l.map((S,Z)=>r.jsx("div",{className:"nice-calendar-weekday",children:$?S.charAt(0):S},S))]}),r.jsx("div",{className:`nice-calendar-grid ${m?"nice-calendar-grid--with-numbers":""}`,children:b.map((S,Z)=>{const B=m&&Z%7===0;return r.jsxs(e.Fragment,{children:[B&&r.jsx("div",{className:"nice-calendar-week-number",children:wr(S.date)}),!S.isCurrentMonth&&!x?r.jsx("div",{className:"nice-calendar-day nice-calendar-day--empty"}):r.jsx(jr,{cell:{...S,isDisabled:S.isDisabled||v&&S.isWeekend},compact:$,onClick:()=>P(S.date),renderDay:I})]},S.date.toISOString())})})]}),q.view==="month"&&r.jsx("div",{className:"nice-calendar-months",children:q.getMonths().map(({month:S,label:Z})=>r.jsx("button",{type:"button",className:`nice-calendar-month-btn ${S===F.getMonth()?"nice-calendar-month-btn--selected":""}`,onClick:()=>{const B=new Date(F.getFullYear(),S,1);U(B),q.goToDate(B),q.setView("day")},children:$?xr[S]:Z},S))}),q.view==="year"&&r.jsx("div",{className:"nice-calendar-years",children:q.getYears().map(S=>r.jsx("button",{type:"button",className:`nice-calendar-year-btn ${S===F.getFullYear()?"nice-calendar-year-btn--selected":""}`,onClick:()=>{const Z=new Date(S,F.getMonth(),1);U(Z),q.goToDate(Z),q.setView("month")},children:S},S))}),H&&q.view==="day"&&r.jsx("div",{className:"nice-calendar-footer",children:r.jsx("button",{type:"button",className:"nice-calendar-today-btn",onClick:L,children:X})})]})})}),Tr=e.forwardRef(function(n,c){return r.jsx(rt,{ref:c,selectionMode:"range",...n})}),Mr=e.forwardRef(function(n,c){return r.jsx(rt,{ref:c,selectionMode:"multiple",...n})}),Kt=e.createContext(null);function Rr(){const t=e.useContext(Kt);if(!t)throw new Error("useGesturesContext must be used within a NiceGestures");return t}function Ne(t,n){const c=n.x-t.x,s=n.y-t.y;return Math.sqrt(c*c+s*s)}function xt(t,n){return Math.atan2(n.y-t.y,n.x-t.x)*(180/Math.PI)}function Ue(t,n){return{x:(t.x+n.x)/2,y:(t.y+n.y)/2}}function Ke(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 Xt(t={}){const{enablePinch:n=!0,enableRotation:c=!0,enablePan:s=!0,enableSwipe:a=!0,enableTap:i=!0,enableDoubleTap:d=!0,enableLongPress:o=!0,minScale:f=.5,maxScale:w=4,panThreshold:v=5,swipeVelocityThreshold:k=.5,swipeDistanceThreshold:g=50,longPressDuration:u=500,doubleTapDelay:m=300,onPinchStart:x,onPinch:R,onPinchEnd:D,onRotateStart:j,onRotate:y,onRotateEnd:I,onPanStart:O,onPan:H,onPanEnd:W,onSwipe:$,onTap:T,onDoubleTap:M,onLongPress:K}=t,[J,X]=e.useState({scale:1,rotation:0,translation:{x:0,y:0},velocity:{x:0,y:0},center:{x:0,y:0},isActive:!1}),Q=e.useRef(new Map),q=e.useRef(0),F=e.useRef(0),U=e.useRef(1),G=e.useRef(0),ne=e.useRef({x:0,y:0}),te=e.useRef(0),V=e.useRef({x:0,y:0}),L=e.useRef(0),E=e.useRef({x:0,y:0}),A=e.useRef(0),h=e.useRef(null),_=e.useRef(!1),p=e.useRef(!1),z=e.useRef(!1),N=e.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),P=e.useCallback(()=>{X({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,ne.current={x:0,y:0}},[]),l=e.useCallback(B=>{B.currentTarget.setPointerCapture(B.pointerId),Q.current.set(B.pointerId,{x:B.clientX,y:B.clientY});const ae=Q.current.size;if(ae===1)L.current=Date.now(),E.current={x:B.clientX,y:B.clientY},V.current={x:B.clientX,y:B.clientY},te.current=Date.now(),o&&(N(),h.current=setTimeout(()=>{K==null||K({position:{x:B.clientX,y:B.clientY},duration:u,target:B.target})},u));else if(ae===2){N();const[le,se]=Array.from(Q.current.values());q.current=Ne(le,se),F.current=xt(le,se),U.current=J.scale,G.current=J.rotation,n&&!p.current&&(p.current=!0,x==null||x()),c&&!z.current&&(z.current=!0,j==null||j())}X(le=>({...le,isActive:!0}))},[J.scale,J.rotation,o,n,c,u,K,x,j,N]),b=e.useCallback(B=>{if(!Q.current.has(B.pointerId))return;Q.current.set(B.pointerId,{x:B.clientX,y:B.clientY});const ae=Q.current.size,le=Date.now();if(ae===1){const se={x:B.clientX,y:B.clientY},re={x:se.x-V.current.x,y:se.y-V.current.y},ie={x:se.x-E.current.x,y:se.y-E.current.y};if(Ne(E.current,se)>v&&(N(),s)){_.current||(_.current=!0,O==null||O());const Y=le-te.current,ee=Y>0?{x:re.x/Y*1e3,y:re.y/Y*1e3}:{x:0,y:0},ce={x:ne.current.x+ie.x,y:ne.current.y+ie.y};X(ue=>({...ue,translation:ce,velocity:ee,center:se})),H==null||H({translation:ce,delta:re,velocity:ee,center:se,direction:Ke(re)})}V.current=se,te.current=le}else if(ae===2){const[se,re]=Array.from(Q.current.values()),ie=Ne(se,re),oe=xt(se,re),Y=Ue(se,re);if(n){const ee=Math.max(f,Math.min(w,U.current*(ie/q.current))),ce=ee-J.scale;X(ue=>({...ue,scale:ee,center:Y})),R==null||R({scale:ee,deltaScale:ce,center:Y,distance:ie,initialDistance:q.current})}if(c){let ee=oe-F.current;ee>180&&(ee-=360),ee<-180&&(ee+=360);const ce=G.current+ee,ue=ce-J.rotation;X(fe=>({...fe,rotation:ce,center:Y})),y==null||y({rotation:ce,deltaRotation:ue,center:Y})}}},[s,n,c,f,w,v,J.scale,J.rotation,H,O,R,y,N]),C=e.useCallback(B=>{B.currentTarget.releasePointerCapture(B.pointerId),N();const ae=Q.current.size,le=Date.now();if(ae===1){const se={x:B.clientX,y:B.clientY},re=Ne(E.current,se),ie=le-L.current;if(re<v)d&&le-A.current<m?(M==null||M({position:se,target:B.target}),A.current=0):i&&(setTimeout(()=>{A.current===le&&(T==null||T({position:se,target:B.target}))},m),A.current=le);else{const oe=re/ie*1e3;if(a&&oe>k&&re>g){const Y={x:se.x-E.current.x,y:se.y-E.current.y},ee=Ke(Y);ee&&($==null||$({direction:ee,velocity:oe,distance:re,duration:ie}))}if(_.current){const Y=le-te.current,ee={x:se.x-V.current.x,y:se.y-V.current.y},ce=Y>0?{x:ee.x/Y*1e3,y:ee.y/Y*1e3}:{x:0,y:0};W==null||W({translation:J.translation,delta:ee,velocity:ce,center:se,direction:Ke(ee)})}}ne.current=J.translation}if(ae===2){if(p.current){const[se,re]=Array.from(Q.current.values()),ie=Ue(se,re);D==null||D({scale:J.scale,deltaScale:0,center:ie,distance:Ne(se,re),initialDistance:q.current})}if(z.current){const[se,re]=Array.from(Q.current.values()),ie=Ue(se,re);I==null||I({rotation:J.rotation,deltaRotation:0,center:ie})}}Q.current.delete(B.pointerId),Q.current.size===0&&(_.current=!1,p.current=!1,z.current=!1,X(se=>({...se,isActive:!1})))},[i,d,a,m,v,k,g,J.scale,J.rotation,J.translation,T,M,$,W,D,I,N]),S=e.useCallback(B=>{N(),Q.current.delete(B.pointerId),Q.current.size===0&&(_.current=!1,p.current=!1,z.current=!1,X(ae=>({...ae,isActive:!1})))},[N]),Z=e.useCallback(()=>({onPointerDown:l,onPointerMove:b,onPointerUp:C,onPointerCancel:S,style:{touchAction:"none"}}),[l,b,C,S]);return e.useEffect(()=>()=>{N()},[N]),{bind:Z,state:J,reset:P}}const He=e.forwardRef(function({enablePinch:n=!0,enableRotation:c=!0,enablePan:s=!0,enableSwipe:a=!0,enableTap:i=!0,enableDoubleTap:d=!0,enableLongPress:o=!0,minScale:f=.5,maxScale:w=4,applyTransform:v=!1,initialScale:k=1,scale:g,initialRotation:u=0,rotation:m,initialTranslation:x={x:0,y:0},translation:R,onTransformChange:D,onPinchStart:j,onPinch:y,onPinchEnd:I,onRotateStart:O,onRotate:H,onRotateEnd:W,onPanStart:$,onPan:T,onPanEnd:M,onSwipe:K,onTap:J,onDoubleTap:X,onLongPress:Q,children:q,className:F="",style:U,...G},ne){const te=Xt({enablePinch:n,enableRotation:c,enablePan:s,enableSwipe:a,enableTap:i,enableDoubleTap:d,enableLongPress:o,minScale:f,maxScale:w,onPinchStart:j,onPinch:N=>{y==null||y(N),D==null||D(te.state)},onPinchEnd:I,onRotateStart:O,onRotate:N=>{H==null||H(N),D==null||D(te.state)},onRotateEnd:W,onPanStart:$,onPan:N=>{T==null||T(N),D==null||D(te.state)},onPanEnd:M,onSwipe:K,onTap:J,onDoubleTap:X,onLongPress:Q}),{bind:V,state:L}=te,E=V(),A=g??L.scale,h=m??L.rotation,_=R??L.translation,p=v?{transform:`translate(${_.x}px, ${_.y}px) scale(${A}) rotate(${h}deg)`,transformOrigin:`${L.center.x}px ${L.center.y}px`}:{},z={state:{...L,scale:A,rotation:h,translation:_},reset:te.reset};return r.jsx(Kt.Provider,{value:z,children:r.jsx("div",{ref:ne,className:`nice-gestures ${L.isActive?"nice-gestures--active":""} ${F}`,style:{...E.style,...U,...p},onPointerDown:E.onPointerDown,onPointerMove:E.onPointerMove,onPointerUp:E.onPointerUp,onPointerCancel:E.onPointerCancel,...G,children:q})})}),Sr=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})}),Pr=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})}),Dr=e.forwardRef(function(n,c){return r.jsx(He,{ref:c,enablePinch:!1,enableRotation:!1,enablePan:!1,enableSwipe:!0,enableTap:!1,enableLongPress:!1,...n})}),ct={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},Cr={light:.5,medium:1,heavy:1.5};function we(){return typeof navigator<"u"&&"vibrate"in navigator}function Ir(t,n){return typeof t=="number"?Math.round(t*n):t.map(c=>Math.round(c*n))}function $r(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const qt=e.createContext(null);function Er(){const t=e.useContext(qt);if(!t)throw new Error("useHapticsContext must be used within a NiceHapticsProvider");return t}function xe(t={}){const{enabled:n=!0,intensity:c="medium",customPatterns:s={}}=t,a=e.useRef(n),[i,d]=e.useState(n),o=e.useMemo(()=>we(),[]),f=e.useCallback(m=>{a.current=m,d(m)},[]),w=e.useCallback(()=>Cr[c],[c]),v=e.useCallback((m=50)=>{if(!o||!a.current)return!1;try{const x=Ir(m,w());return navigator.vibrate(x)}catch{return!1}},[o,w]),k=e.useCallback(()=>{o&&navigator.vibrate(0)},[o]),g=e.useCallback(m=>{if(!o||!a.current)return!1;const x=ct[m];return x?v(x):!1},[o,v]),u=e.useCallback(m=>{if(!o||!a.current)return!1;const x=s[m];return x?v(x):!1},[o,s,v]);return{isSupported:o,isEnabled:i,setEnabled:f,vibrate:v,cancel:k,trigger:g,triggerPattern:u,getIntensityMultiplier:w}}function _r({enabled:t=!0,intensity:n="medium",respectReducedMotion:c=!0,customPatterns:s={},children:a}){const i=e.useMemo(()=>c&&$r()?!1:t,[t,c]),d=xe({enabled:i,intensity:n,customPatterns:s});return e.useEffect(()=>{if(!c)return;const o=window.matchMedia("(prefers-reduced-motion: reduce)"),f=w=>{d.setEnabled(!w.matches&&t)};return o.addEventListener("change",f),()=>o.removeEventListener("change",f)},[c,t,d]),r.jsx(qt.Provider,{value:d,children:a})}function Lr(t=50){if(!we())return!1;try{return navigator.vibrate(t)}catch{return!1}}function Ar(t){if(!we())return!1;const n=ct[t];if(!n)return!1;try{return navigator.vibrate(n)}catch{return!1}}function Yr(){we()&&navigator.vibrate(0)}function Hr(t){return function(c){const s=xe();return r.jsx(t,{...c,haptics:s})}}function zr(){const t=xe();return e.useCallback(()=>{t.trigger("button-press")},[t])}function Fr(){const t=xe();return e.useCallback(n=>{t.trigger(n?"toggle-on":"toggle-off")},[t])}function Br(){const t=xe();return e.useCallback(()=>{t.trigger("selection")},[t])}function Or(){const t=xe();return e.useCallback(n=>{t.trigger(`notification-${n}`)},[t])}function Vr(){const t=xe();return e.useCallback((n="medium")=>{t.trigger(`impact-${n}`)},[t])}class Gt{constructor(){it(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 a=0;a<n;a++)this.vibrate(c),a<n-1&&this.pause(s);return this}rampUp(n,c){for(let s=1;s<=n;s++){const a=Math.round(c/n*s);this.vibrate(a),s<n&&this.pause(50)}return this}rampDown(n,c){for(let s=n;s>=1;s--){const a=Math.round(c/n*s);this.vibrate(a),s>1&&this.pause(50)}return this}build(){return[...this.pattern]}execute(){return we()?navigator.vibrate(this.pattern):!1}}function Ur(){return new Gt}const ze={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},_e=["xs","sm","md","lg","xl","2xl"];function Ge(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 yt(t){return t==="xs"||t==="sm"?"mobile":t==="md"?"tablet":"desktop"}function wt(t,n){return t>=n?"landscape":"portrait"}function We(){return typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0}function ve(t){return _e.indexOf(t)}function Kr(t,n){let c=null;return(...s)=>{c&&clearTimeout(c),c=setTimeout(()=>t(...s),n)}}const Wt=e.createContext(null);function Xr(){const t=e.useContext(Wt);if(!t)throw new Error("useBreakpointContext must be used within a NiceBreakpointProvider");return t}function Me(t={}){const{breakpoints:n,debounceDelay:c=100,ssrDefaultWidth:s=1024}=t,a=e.useMemo(()=>({...ze,...n}),[n]),[i,d]=e.useState(()=>{const u=typeof window<"u"?window.innerWidth:s,m=typeof window<"u"?window.innerHeight:768,x=Ge(u,a),R=yt(x),D=wt(u,m);return{width:u,height:m,breakpoint:x,deviceType:R,orientation:D,isMobile:R==="mobile",isTablet:R==="tablet",isDesktop:R==="desktop",isPortrait:D==="portrait",isLandscape:D==="landscape",isTouchDevice:We(),pixelRatio:typeof window<"u"?window.devicePixelRatio:1}});e.useEffect(()=>{if(typeof window>"u")return;const u=()=>{const x=window.innerWidth,R=window.innerHeight,D=Ge(x,a),j=yt(D),y=wt(x,R);d({width:x,height:R,breakpoint:D,deviceType:j,orientation:y,isMobile:j==="mobile",isTablet:j==="tablet",isDesktop:j==="desktop",isPortrait:y==="portrait",isLandscape:y==="landscape",isTouchDevice:We(),pixelRatio:window.devicePixelRatio})},m=Kr(u,c);return u(),window.addEventListener("resize",m),window.addEventListener("orientationchange",u),()=>{window.removeEventListener("resize",m),window.removeEventListener("orientationchange",u)}},[a,c]);const o=e.useCallback(u=>i.breakpoint===u,[i.breakpoint]),f=e.useCallback(u=>{const m=ve(i.breakpoint),x=ve(u);return m>=x},[i.breakpoint]),w=e.useCallback(u=>{const m=ve(i.breakpoint),x=ve(u);return m<x},[i.breakpoint]),v=e.useCallback((u,m)=>{const x=ve(i.breakpoint),R=ve(u),D=ve(m);return x>=R&&x<=D},[i.breakpoint]),k=e.useCallback((u,m)=>{const x=ve(i.breakpoint);for(let R=x;R>=0;R--){const D=_e[R];if(u[D]!==void 0)return u[D]}return u.base??m},[i.breakpoint]),g=e.useCallback((u,m="min")=>{const x=a[u],R=ve(u),D=_e[R+1],j=D?a[D]-1:null;return m==="min"?`(min-width: ${x}px)`:m==="max"&&j?`(max-width: ${j}px)`:m==="only"?j?`(min-width: ${x}px) and (max-width: ${j}px)`:`(min-width: ${x}px)`:`(min-width: ${x}px)`},[a]);return{...i,is:o,isAbove:f,isBelow:w,isBetween:v,getResponsive:k,mediaQuery:g}}function Jt(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 a=i=>c(i.matches);return s.addEventListener("change",a),()=>s.removeEventListener("change",a)},[t]),n}function qr({breakpoints:t,debounceDelay:n=100,children:c}){const s=Me({breakpoints:t,debounceDelay:n});return r.jsx(Wt.Provider,{value:s,children:c})}function Gr({on:t,above:n,below:c,device:s,orientation:a,children:i,fallback:d=null}){const o=Me();let f=!0;return t!==void 0?f=o.is(t):n!==void 0?f=o.isAbove(n):c!==void 0&&(f=o.isBelow(c)),s!==void 0&&(f=f&&o.deviceType===s),a!==void 0&&(f=f&&o.orientation===a),f?r.jsx(r.Fragment,{children:i}):r.jsx(r.Fragment,{children:d})}function Wr({on:t,above:n,below:c,device:s,orientation:a,children:i}){const d=Me();let o=!1;return t!==void 0?o=d.is(t):n!==void 0?o=d.isAbove(n):c!==void 0&&(o=d.isBelow(c)),s!==void 0&&(o=o||d.deviceType===s),a!==void 0&&(o=o||d.orientation===a),o?null:r.jsx(r.Fragment,{children:i})}function Jr(t,n="min",c=ze){const s=c[t],a=ve(t),i=_e[a+1],d=i?c[i]-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 Qr(t){return t}function Qt(t=ze){return typeof window>"u"?null:Ge(window.innerWidth,t)}function Zr(){if(typeof window>"u")return!1;const t=Qt();return t==="xs"||t==="sm"}function ec(){return We()}const tc={sm:"nice-touch-btn--sm",md:"nice-touch-btn--md",lg:"nice-touch-btn--lg",xl:"nice-touch-btn--xl"},nc={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"},rc={rounded:"nice-touch-btn--rounded",pill:"nice-touch-btn--pill",square:"nice-touch-btn--square",circle:"nice-touch-btn--circle"},st=e.forwardRef(function({variant:n="primary",size:c="md",shape:s="rounded",fullWidth:a=!1,loading:i=!1,leftIcon:d,rightIcon:o,iconOnly:f=!1,haptic:w=!0,hapticIntensity:v="light",ripple:k=!0,active:g=!1,disabled:u,className:m="",onClick:x,onPointerDown:R,children:D,...j},y){const[I,O]=e.useState(!1),[H,W]=e.useState(null),$=e.useRef(null),T=e.useCallback(F=>{$.current=F,typeof y=="function"?y(F):y&&(y.current=F)},[y]),M=e.useCallback(()=>{if(!w||typeof navigator>"u"||!("vibrate"in navigator))return;const F={light:10,medium:20,heavy:40};try{navigator.vibrate(F[v]||10)}catch{}},[w,v]),K=e.useCallback(F=>{if(!(u||i)){if(O(!0),k&&$.current){const U=$.current.getBoundingClientRect();W({x:F.clientX-U.left,y:F.clientY-U.top}),setTimeout(()=>W(null),600)}M(),R==null||R(F)}},[u,i,k,M,R]),J=e.useCallback(()=>{O(!1)},[]),X=e.useCallback(()=>{O(!1)},[]),Q=e.useCallback(F=>{u||i||x==null||x(F)},[u,i,x]),q=["nice-touch-btn",nc[n],tc[c],rc[s],a?"nice-touch-btn--full-width":"",i?"nice-touch-btn--loading":"",f?"nice-touch-btn--icon-only":"",I?"nice-touch-btn--pressed":"",g?"nice-touch-btn--active":"",m].filter(Boolean).join(" ");return r.jsxs("button",{ref:T,type:"button",className:q,disabled:u||i,onClick:Q,onPointerDown:K,onPointerUp:J,onPointerLeave:X,onPointerCancel:X,...j,children:[k&&H&&r.jsx("span",{className:"nice-touch-btn-ripple",style:{left:H.x,top:H.y}}),i&&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:i?0:1},children:[d&&r.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--left",children:d}),!f&&D&&r.jsx("span",{className:"nice-touch-btn-text",children:D}),o&&r.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--right",children:o})]})]})}),cc=e.forwardRef(function({icon:n,...c},s){return r.jsx(st,{ref:s,iconOnly:!0,leftIcon:n,...c})}),sc=e.forwardRef(function({position:n="bottom-right",mini:c=!1,className:s="",...a},i){const d=`nice-fab--${n}`;return r.jsx(st,{ref:i,shape:"circle",size:c?"md":"xl",className:`nice-fab ${d} ${s}`,...a})});function Zt(t){const{min:n,max:c,step:s,value:a,defaultValue:i=n,onChange:d,onChangeCommitted:o}=t,[f,w]=e.useState(i),v=a??f,k=Array.isArray(v),g=e.useCallback(j=>Math.min(c,Math.max(n,j)),[n,c]),u=e.useCallback(j=>{const y=Math.round((j-n)/s)*s+n;return g(y)},[n,s,g]),m=e.useMemo(()=>{const j=c-n;if(k){const[y,I]=v;return[(y-n)/j*100,(I-n)/j*100]}return(v-n)/j*100},[v,n,c,k]),x=e.useCallback(j=>{if(Array.isArray(j)){const[y,I]=j,O=[u(y),u(I)];O[0]>O[1]&&([O[0],O[1]]=[O[1],O[0]]),w(O),d==null||d(O)}else{const y=u(j);w(y),d==null||d(y)}},[u,d]),R=e.useCallback((j,y)=>{const I=c-n,O=j/100*I+n;if(k&&typeof y=="number"){const W=[...v];W[y]=u(O),x(W)}else x(O)},[c,n,k,v,u,x]),D=e.useCallback(()=>{o==null||o(v)},[v,o]);return{value:v,isRange:k,percentage:m,setValue:x,setValueByPercentage:R,commitValue:D,clamp:g,snap:u}}const ac=e.forwardRef(function({value:n,defaultValue:c,min:s=0,max:a=100,step:i=1,orientation:d="horizontal",disabled:o=!1,marks:f=!1,markStep:w,labelDisplay:v="auto",formatLabel:k=M=>String(M),showRange:g=!1,trackColor:u,fillColor:m,thumbSize:x=44,trackHeight:R=8,haptic:D=!0,snapToMarks:j=!1,onChange:y,onChangeCommitted:I,className:O="","aria-label":H,"aria-labelledby":W,...$},T){const M=Zt({min:s,max:a,step:i,value:n,defaultValue:c,onChange:y,onChangeCommitted:I}),K=e.useRef(null),[J,X]=e.useState(!1),[Q,q]=e.useState(null),[F,U]=e.useState(v==="on"),G=e.useRef(M.value),ne=e.useMemo(()=>{if(!f)return[];if(Array.isArray(f))return f;const N=[],P=w??i;for(let l=s;l<=a;l+=P)N.push({value:l});return N},[f,w,i,s,a]),te=e.useCallback(N=>{if(!K.current)return 0;const P=K.current.getBoundingClientRect();if(d==="horizontal"){const l=N.clientX-P.left;return Math.max(0,Math.min(100,l/P.width*100))}else{const l=N.clientY-P.top;return Math.max(0,Math.min(100,100-l/P.height*100))}},[d]),V=e.useCallback(()=>{if(!(!D||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[D]),L=e.useCallback(N=>{if(!M.isRange)return 0;const[P,l]=M.percentage,b=Math.abs(N-P),C=Math.abs(N-l);return b<=C?0:1},[M.isRange,M.percentage]),E=e.useCallback((N,P)=>{if(o)return;N.preventDefault(),N.currentTarget.setPointerCapture(N.pointerId);const l=te(N),b=P??L(l);if(X(!0),q(b),U(v!=="off"),j&&ne.length>0){const C=ne.reduce((S,Z)=>{const B=(S.value-s)/(a-s)*100,ae=(Z.value-s)/(a-s)*100;return Math.abs(ae-l)<Math.abs(B-l)?Z:S});M.setValue(M.isRange?b===0?[C.value,M.value[1]]:[M.value[0],C.value]:C.value)}else M.setValueByPercentage(l,b);V()},[o,te,L,v,j,ne,s,a,M,V]),A=e.useCallback(N=>{var l;if(!J||o||Q===null)return;const P=te(N);if(j&&ne.length>0){const b=ne.reduce((S,Z)=>{const B=(S.value-s)/(a-s)*100,ae=(Z.value-s)/(a-s)*100;return Math.abs(ae-P)<Math.abs(B-P)?Z:S}),C=M.isRange?Q===0?[b.value,M.value[1]]:[M.value[0],b.value]:b.value;JSON.stringify(C)!==JSON.stringify(G.current)&&(M.setValue(C),G.current=C,V())}else{M.setValueByPercentage(P,Q);const b=M.isRange?M.value[Q]:M.value,C=M.isRange?(l=G.current)==null?void 0:l[Q]:G.current;Math.abs(b-C)>=i&&(V(),G.current=M.value)}},[J,o,Q,te,j,ne,s,a,M,i,V]),h=e.useCallback(N=>{J&&(N.currentTarget.releasePointerCapture(N.pointerId),X(!1),q(null),v==="auto"&&U(!1),M.commitValue())},[J,v,M]),_=e.useCallback((N,P)=>{if(o)return;let l=M.isRange?M.value[P]:M.value;switch(N.key){case"ArrowRight":case"ArrowUp":N.preventDefault(),l=Math.min(a,l+i);break;case"ArrowLeft":case"ArrowDown":N.preventDefault(),l=Math.max(s,l-i);break;case"Home":N.preventDefault(),l=s;break;case"End":N.preventDefault(),l=a;break;case"PageUp":N.preventDefault(),l=Math.min(a,l+i*10);break;case"PageDown":N.preventDefault(),l=Math.max(s,l-i*10);break;default:return}if(M.isRange){const b=M.value;M.setValue(P===0?[l,b[1]]:[b[0],l])}else M.setValue(l);V(),M.commitValue()},[o,M,a,s,i,V]),p=e.useMemo(()=>{if(M.isRange){const[P,l]=M.percentage;return d==="horizontal"?{left:`${P}%`,width:`${l-P}%`}:{bottom:`${P}%`,height:`${l-P}%`}}const N=M.percentage;return d==="horizontal"?{left:0,width:`${N}%`}:{bottom:0,height:`${N}%`}},[M.isRange,M.percentage,d]),z=(N,P)=>{const l=M.isRange?M.value[N]:M.value,b=d==="horizontal"?{left:`${P}%`}:{bottom:`${P}%`};return r.jsx("div",{className:`nice-touch-slider-thumb ${Q===N?"nice-touch-slider-thumb--active":""}`,style:{...b,width:x,height:x},role:"slider",tabIndex:o?-1:0,"aria-label":H,"aria-labelledby":W,"aria-valuenow":l,"aria-valuemin":s,"aria-valuemax":a,"aria-disabled":o,onKeyDown:C=>_(C,N),children:F&&r.jsx("span",{className:"nice-touch-slider-label",children:k(l)})},N)};return r.jsxs("div",{ref:T,className:`
|
|
21
21
|
nice-touch-slider
|
|
22
|
-
nice-touch-slider--${
|
|
22
|
+
nice-touch-slider--${d}
|
|
23
23
|
${o?"nice-touch-slider--disabled":""}
|
|
24
|
-
${
|
|
25
|
-
${
|
|
26
|
-
`,style:{"--thumb-size":`${p}px`,"--track-height":`${S}px`,...f?{"--track-color":f}:{},...v?{"--fill-color":v}:{}},...H,children:[R&&t.jsx("span",{className:"nice-touch-slider-min",children:w(c)}),t.jsxs("div",{ref:X,className:"nice-touch-slider-track-container",onPointerDown:E,onPointerMove:V,onPointerUp:d,onPointerCancel:d,children:[t.jsx("div",{className:"nice-touch-slider-track"}),t.jsx("div",{className:"nice-touch-slider-fill",style:I}),Z.length>0&&t.jsx("div",{className:"nice-touch-slider-marks",children:Z.map(i=>{const m=(i.value-c)/(a-c)*100,P=u==="horizontal"?{left:`${m}%`}:{bottom:`${m}%`};return t.jsxs("div",{className:"nice-touch-slider-mark",style:P,children:[t.jsx("span",{className:"nice-touch-slider-mark-dot"}),i.label&&t.jsx("span",{className:"nice-touch-slider-mark-label",children:i.label})]},i.value)})}),k.isRange?t.jsxs(t.Fragment,{children:[j(0,k.percentage[0]),j(1,k.percentage[1])]}):j(0,k.percentage)]}),R&&t.jsx("span",{className:"nice-touch-slider-max",children:w(a)})]})});function He(n,r,s){r/=100,s/=100;const c=(1-Math.abs(2*s-1))*r,a=c*(1-Math.abs(n/60%2-1)),l=s-c/2;let u=0,o=0,b=0;return n>=0&&n<60?(u=c,o=a,b=0):n>=60&&n<120?(u=a,o=c,b=0):n>=120&&n<180?(u=0,o=c,b=a):n>=180&&n<240?(u=0,o=a,b=c):n>=240&&n<300?(u=a,o=0,b=c):(u=c,o=0,b=a),{r:Math.round((u+l)*255),g:Math.round((o+l)*255),b:Math.round((b+l)*255)}}function _t(n,r,s){n/=255,r/=255,s/=255;const c=Math.max(n,r,s),a=Math.min(n,r,s),l=(c+a)/2;let u=0,o=0;if(c!==a){const b=c-a;switch(o=l>.5?b/(2-c-a):b/(c+a),c){case n:u=((r-s)/b+(r<s?6:0))*60;break;case r:u=((s-n)/b+2)*60;break;case s:u=((n-r)/b+4)*60;break}}return{h:Math.round(u),s:Math.round(o*100),l:Math.round(l*100)}}function qt(n){const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:{r:0,g:0,b:0}}function Gt(n,r,s){return"#"+[n,r,s].map(c=>c.toString(16).padStart(2,"0")).join("")}function we(n){const r=qt(n);return _t(r.r,r.g,r.b)}function Ie(n,r,s){const c=He(n,r,s);return Gt(c.r,c.g,c.b)}function Oe(n,r){switch(r){case"hsl":return`hsl(${n.h}, ${n.s}%, ${n.l}%)`;case"rgb":{const s=He(n.h,n.s,n.l);return`rgb(${s.r}, ${s.g}, ${s.b})`}case"hex":default:return Ie(n.h,n.s,n.l)}}const Xr=e.forwardRef(function({value:r,defaultValue:s="#6366f1",format:c="hex",showAlpha:a=!1,showPreview:l=!0,showInput:u=!0,presetColors:o,wheelSize:b=240,haptic:N=!0,onChange:y,presetLabel:w="Presets",className:R="",...f},v){const[p,S]=e.useState(()=>we(r||s)),[D,M]=e.useState(r||s),[g,F]=e.useState(1),Y=e.useRef(null),B=e.useRef(null),z=e.useRef(!1),H=e.useRef(!1);e.useEffect(()=>{if(r){const d=we(r);S(d),M(r)}},[r]);const x=e.useCallback(()=>{if(!(!N||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[N]),k=e.useCallback(d=>{const T=Oe(d,c);M(c==="hex"?T:Ie(d.h,d.s,d.l)),y==null||y(T)},[c,y]);e.useEffect(()=>{const d=Y.current;if(!d)return;const T=d.getContext("2d");if(!T)return;const I=b,j=I/2,i=j-10,m=i-30;d.width=I,d.height=I;for(let P=0;P<360;P++){const h=(P-1)*Math.PI/180,W=(P+1)*Math.PI/180;T.beginPath(),T.arc(j,j,i,h,W),T.arc(j,j,m,W,h,!0),T.closePath(),T.fillStyle=`hsl(${P}, 100%, 50%)`,T.fill()}},[b]),e.useEffect(()=>{const d=B.current;if(!d)return;const T=d.getContext("2d");if(!T)return;const I=b*.5;d.width=I,d.height=I;const j=T.createImageData(I,I);for(let i=0;i<I;i++)for(let m=0;m<I;m++){const P=m/I*100,h=100-i/I*100,W=He(p.h,P,h),te=(i*I+m)*4;j.data[te]=W.r,j.data[te+1]=W.g,j.data[te+2]=W.b,j.data[te+3]=255}T.putImageData(j,0,0)},[p.h,b]);const X=e.useCallback(d=>{const T=Y.current;if(!T)return;const I=T.getBoundingClientRect(),j=d.clientX-I.left-I.width/2,i=d.clientY-I.top-I.height/2;let m=Math.atan2(i,j)*(180/Math.PI)+90;m<0&&(m+=360);const P={...p,h:Math.round(m)};S(P),k(P),x()},[p,k,x]),U=e.useCallback(d=>{const T=B.current;if(!T)return;const I=T.getBoundingClientRect(),j=Math.max(0,Math.min(I.width,d.clientX-I.left)),i=Math.max(0,Math.min(I.height,d.clientY-I.top)),m=Math.round(j/I.width*100),P=Math.round(100-i/I.height*100),h={...p,s:m,l:P};S(h),k(h),x()},[p,k,x]),A=e.useCallback(d=>{d.currentTarget.setPointerCapture(d.pointerId),z.current=!0,X(d)},[X]),L=e.useCallback(d=>{z.current&&X(d)},[X]),G=e.useCallback(d=>{d.currentTarget.releasePointerCapture(d.pointerId),z.current=!1},[]),O=e.useCallback(d=>{d.currentTarget.setPointerCapture(d.pointerId),H.current=!0,U(d)},[U]),q=e.useCallback(d=>{H.current&&U(d)},[U]),J=e.useCallback(d=>{d.currentTarget.releasePointerCapture(d.pointerId),H.current=!1},[]),Z=e.useCallback(d=>{const T=d.target.value;if(M(T),/^#?[0-9a-f]{6}$/i.test(T)){const I=T.startsWith("#")?T:`#${T}`,j=we(I);S(j),y==null||y(Oe(j,c))}},[c,y]),ee=e.useCallback(d=>{const T=we(d);S(T),k(T),x()},[k,x]),$=e.useMemo(()=>{const d=b/2,T=d-25,I=(p.h-90)*Math.PI/180;return{x:d+T*Math.cos(I),y:d+T*Math.sin(I)}},[p.h,b]),C=b*.5,E=e.useMemo(()=>({x:p.s/100*C,y:(1-p.l/100)*C}),[p.s,p.l,C]),V=e.useMemo(()=>Ie(p.h,p.s,p.l),[p]);return t.jsxs("div",{ref:v,className:`nice-touch-color-picker ${R}`,...f,children:[t.jsxs("div",{className:"nice-touch-color-picker-wheel-container",style:{width:b,height:b},children:[t.jsx("canvas",{ref:Y,className:"nice-touch-color-picker-wheel",onPointerDown:A,onPointerMove:L,onPointerUp:G,onPointerCancel:G}),t.jsx("div",{className:"nice-touch-color-picker-hue-indicator",style:{left:$.x,top:$.y,backgroundColor:`hsl(${p.h}, 100%, 50%)`}}),t.jsxs("div",{className:"nice-touch-color-picker-sl-container",style:{width:C,height:C},children:[t.jsx("canvas",{ref:B,className:"nice-touch-color-picker-sl",onPointerDown:O,onPointerMove:q,onPointerUp:J,onPointerCancel:J}),t.jsx("div",{className:"nice-touch-color-picker-sl-indicator",style:{left:E.x,top:E.y,backgroundColor:V}})]})]}),t.jsxs("div",{className:"nice-touch-color-picker-controls",children:[l&&t.jsx("div",{className:"nice-touch-color-picker-preview",style:{backgroundColor:V}}),u&&t.jsx("input",{type:"text",className:"nice-touch-color-picker-input",value:D,onChange:Z,placeholder:"#000000"})]}),a&&t.jsx("div",{className:"nice-touch-color-picker-alpha",children:t.jsx("input",{type:"range",min:"0",max:"100",value:g*100,onChange:d=>F(Number(d.target.value)/100),className:"nice-touch-color-picker-alpha-slider",style:{background:`linear-gradient(to right, transparent, ${V})`}})}),o&&o.length>0&&t.jsxs("div",{className:"nice-touch-color-picker-presets",children:[t.jsx("span",{className:"nice-touch-color-picker-presets-label",children:w}),t.jsx("div",{className:"nice-touch-color-picker-presets-grid",children:o.map((d,T)=>t.jsx("button",{type:"button",className:`nice-touch-color-picker-preset ${d.toLowerCase()===V.toLowerCase()?"nice-touch-color-picker-preset--selected":""}`,style:{backgroundColor:d},onClick:()=>ee(d),"aria-label":`Select color ${d}`},T))})]})]})}),Ur={hslToRgb:He,rgbToHsl:_t,hexToRgb:qt,rgbToHex:Gt,hexToHsl:we,hslToHex:Ie,formatColor:Oe};function xe(n,r){var u;const s=n.trim().match(/^var\(\s*([^,\s)]+)\s*(?:,\s*(.+))?\)$/);if(!s)return n;const c=(u=s[2])==null?void 0:u.trim();if(typeof document>"u"||typeof getComputedStyle>"u")return c?xe(c):n;const a=typeof Element<"u"&&r instanceof Element&&r.isConnected?r:document.documentElement,l=getComputedStyle(a).getPropertyValue(s[1]).trim();return l||(c?xe(c,r):n)}function Or(n,r){return Math.sqrt(Math.pow(r.x-n.x,2)+Math.pow(r.y-n.y,2))}function vt(n,r){const s=r.time-n.time||1;return Or(n,r)/s}const Kt=e.forwardRef(function({width:r="100%",height:s=200,strokeColor:c="#1f2937",strokeWidth:a=2,minWidth:l=.5,maxWidth:u=4,velocityFilterWeight:o=.7,backgroundColor:b="#ffffff",showGuideline:N=!0,guidelineColor:y="var(--nice-border-color, #e5e7eb)",disabled:w=!1,penPressure:R=!0,haptic:f=!0,placeholder:v="Sign here",onChange:p,onBegin:S,onEnd:D,className:M="",...g},F){const Y=e.useRef(null),B=e.useRef(null),z=e.useMemo(()=>xe(c,Y.current),[c]),H=e.useMemo(()=>xe(b,Y.current),[b]),x=e.useMemo(()=>xe(y,Y.current),[y]),[k,X]=e.useState(!0),[U,A]=e.useState(!1),L=e.useRef([]),G=e.useRef([]),O=e.useRef([]),q=e.useRef(0),J=e.useRef(a);e.useEffect(()=>{const i=Y.current;if(!i)return;const m=i.getBoundingClientRect(),P=window.devicePixelRatio||1;i.width=m.width*P,i.height=m.height*P;const h=i.getContext("2d");h&&(h.scale(P,P),B.current=h,ee())},[]);const Z=e.useCallback(()=>{if(!(!f||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[f]),ee=e.useCallback(()=>{const i=Y.current,m=B.current;if(!i||!m)return;const P=i.getBoundingClientRect();m.fillStyle=H,m.fillRect(0,0,P.width,P.height),N&&(m.strokeStyle=x,m.lineWidth=1,m.setLineDash([5,5]),m.beginPath(),m.moveTo(20,P.height*.7),m.lineTo(P.width-20,P.height*.7),m.stroke(),m.setLineDash([]))},[H,N,x]),$=e.useCallback(()=>{ee();const i=B.current;i&&G.current.forEach(m=>{if(!(m.length<2)){i.strokeStyle=z,i.fillStyle=z,i.lineCap="round",i.lineJoin="round";for(let P=1;P<m.length;P++){const h=m[P-1],W=m[P],te=vt(h,W),ce=Math.max(l,Math.min(u,u/(te+1)));i.lineWidth=ce,i.beginPath(),i.moveTo(h.x,h.y),i.lineTo(W.x,W.y),i.stroke()}}})},[ee,z,l,u]),C=e.useCallback(i=>Math.max(l,u/(i*10+1)),[l,u]),E=e.useCallback(i=>{const m=B.current;m&&(m.fillStyle=z,m.beginPath(),m.arc(i.x,i.y,a/2,0,Math.PI*2),m.fill())},[z,a]),V=e.useCallback((i,m,P)=>{const h=B.current;h&&(h.strokeStyle=z,h.lineWidth=P,h.lineCap="round",h.lineJoin="round",h.beginPath(),h.moveTo(i.x,i.y),h.lineTo(m.x,m.y),h.stroke())},[z]),d=e.useCallback(i=>{const m=Y.current;if(!m)return{x:0,y:0,time:Date.now()};const P=m.getBoundingClientRect();return{x:i.clientX-P.left,y:i.clientY-P.top,pressure:R?i.pressure:void 0,time:Date.now()}},[R]),T=e.useCallback(i=>{if(w)return;i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId),A(!0);const m=d(i);L.current=[m],q.current=0,J.current=a,O.current=[],E(m),S==null||S(),Z()},[w,d,a,E,S,Z]),I=e.useCallback(i=>{if(!U||w)return;const m=d(i),P=L.current;if(P.length===0)return;const h=P[P.length-1],W=vt(h,m),te=o*W+(1-o)*q.current,ce=C(te),ne=(J.current+ce)/2,ae=m.pressure!==void 0?ne*Math.max(.5,m.pressure):ne;V(h,m,ae),P.push(m),q.current=te,J.current=ce},[U,w,d,o,C,V]),j=e.useCallback(i=>{U&&(i.currentTarget.releasePointerCapture(i.pointerId),A(!1),L.current.length>0&&(G.current.push([...L.current]),L.current=[],X(!1),p==null||p(!1)),D==null||D())},[U,p,D]);return e.useImperativeHandle(F,()=>({clear:()=>{G.current=[],O.current=[],L.current=[],ee(),X(!0),p==null||p(!0)},isEmpty:()=>k,toData:()=>[...G.current],fromData:i=>{G.current=i,O.current=[],X(i.length===0),$(),p==null||p(i.length===0)},toDataURL:(i="png",m=1)=>{const P=Y.current;if(!P)return"";if(i==="svg"){const W=P.getBoundingClientRect();let te="";G.current.forEach(ne=>{if(ne.length<2)return;let ae=`M ${ne[0].x} ${ne[0].y}`;for(let re=1;re<ne.length;re++)ae+=` L ${ne[re].x} ${ne[re].y}`;te+=`<path d="${ae}" stroke="${z}" stroke-width="${a}" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`});const ce=`<svg xmlns="http://www.w3.org/2000/svg" width="${W.width}" height="${W.height}" viewBox="0 0 ${W.width} ${W.height}">${te}</svg>`;return`data:image/svg+xml;base64,${btoa(ce)}`}if(i==="json")return`data:application/json;base64,${btoa(JSON.stringify(G.current))}`;const h=i==="jpeg"?"image/jpeg":"image/png";return P.toDataURL(h,m)},toSVG:()=>{const i=Y.current;if(!i)return"";const m=i.getBoundingClientRect();let P="";return G.current.forEach(h=>{if(h.length<2)return;let W=`M ${h[0].x} ${h[0].y}`;for(let te=1;te<h.length;te++)W+=` L ${h[te].x} ${h[te].y}`;P+=`<path d="${W}" stroke="${z}" stroke-width="${a}" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`}),`<svg xmlns="http://www.w3.org/2000/svg" width="${m.width}" height="${m.height}" viewBox="0 0 ${m.width} ${m.height}">${P}</svg>`},toBlob:(i="png",m=1)=>new Promise(P=>{const h=Y.current;if(!h){P(null);return}const W=i==="jpeg"?"image/jpeg":"image/png";h.toBlob(P,W,m)}),undo:()=>{if(G.current.length===0)return;const i=G.current.pop();i&&O.current.push(i);const m=G.current.length===0;X(m),$(),p==null||p(m)},redo:()=>{if(O.current.length===0)return;const i=O.current.pop();i&&G.current.push(i),X(!1),$(),p==null||p(!1)}}),[k,ee,$,z,a,p]),t.jsxs("div",{className:`nice-signature-pad ${w?"nice-signature-pad--disabled":""} ${M}`,...g,children:[t.jsx("canvas",{ref:Y,className:"nice-signature-pad-canvas",style:{width:r,height:s,backgroundColor:H,touchAction:"none"},onPointerDown:T,onPointerMove:I,onPointerUp:j,onPointerCancel:j,onPointerLeave:j}),k&&v&&t.jsx("div",{className:"nice-signature-pad-placeholder",children:v})]})}),_r=e.forwardRef(function({width:r="100%",height:s=300,backgroundColor:c="var(--nice-bg-primary, #ffffff)",strokeColor:a="var(--nice-text-primary, #1f2937)",strokeWidth:l=4,tool:u="pen",lineCap:o="round",opacity:b=1,penPressure:N=!0,haptic:y=!0,maxHistory:w=50,disabled:R=!1,onChange:f,onToolChange:v,className:p="",...S},D){const M=e.useRef(null),g=e.useRef(null),[F,Y]=e.useState(!1),[B,z]=e.useState(u),H=e.useRef([]),x=e.useRef(-1),k=e.useRef(null),X=e.useRef(null),U=e.useRef(null);e.useEffect(()=>{z(u)},[u]),e.useEffect(()=>{const d=M.current;if(!d)return;const T=d.getBoundingClientRect(),I=window.devicePixelRatio||1;d.width=T.width*I,d.height=T.height*I;const j=d.getContext("2d",{willReadFrequently:!0});j&&(j.scale(I,I),g.current=j,j.fillStyle=c,j.fillRect(0,0,T.width,T.height),A())},[c]);const A=e.useCallback(()=>{const d=M.current,T=g.current;if(!d||!T)return;const I=d.getBoundingClientRect(),j=T.getImageData(0,0,I.width,I.height);x.current<H.current.length-1&&(H.current=H.current.slice(0,x.current+1)),H.current.push({type:"stroke",imageData:j}),H.current.length>w&&H.current.shift(),x.current=H.current.length-1},[w]),L=e.useCallback(d=>{const T=g.current;if(!T||d<0||d>=H.current.length)return;const I=H.current[d];T.putImageData(I.imageData,0,0)},[]),G=e.useCallback(()=>{if(!(!y||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[y]),O=e.useCallback(d=>{const T=M.current;if(!T)return{x:0,y:0};const I=T.getBoundingClientRect();return{x:d.clientX-I.left,y:d.clientY-I.top,pressure:N?d.pressure:void 0}},[N]),q=e.useCallback(()=>{const d=g.current;d&&(d.lineCap=o,d.lineJoin="round",d.globalAlpha=b,B==="eraser"?(d.globalCompositeOperation="destination-out",d.strokeStyle=xe("var(--nice-overlay-90, rgba(0, 0, 0, 1))",d.canvas),d.lineWidth=l*2):B==="brush"?(d.globalCompositeOperation="source-over",d.strokeStyle=a,d.lineWidth=l):B==="marker"?(d.globalCompositeOperation="multiply",d.strokeStyle=a,d.lineWidth=l*1.5,d.globalAlpha=.5):(d.globalCompositeOperation="source-over",d.strokeStyle=a,d.lineWidth=l))},[B,a,l,o,b]),J=e.useCallback((d,T)=>{const I=g.current;I&&(q(),T.pressure!==void 0&&B!=="eraser"&&(I.lineWidth=l*Math.max(.3,T.pressure)),I.beginPath(),I.moveTo(d.x,d.y),I.lineTo(T.x,T.y),I.stroke())},[q,l,B]),Z=e.useCallback((d,T)=>{const I=g.current;if(!I||!U.current)return;I.putImageData(U.current,0,0),q();const j=T.x-d.x,i=T.y-d.y;if(I.beginPath(),B==="line")I.moveTo(d.x,d.y),I.lineTo(T.x,T.y),I.stroke();else if(B==="rectangle")I.strokeRect(d.x,d.y,j,i);else if(B==="circle"){const m=Math.sqrt(j*j+i*i);I.arc(d.x,d.y,m,0,Math.PI*2),I.stroke()}},[q,B]),ee=e.useCallback((d,T,I)=>{const j=M.current,i=g.current;if(!j||!i)return;const m=j.getBoundingClientRect(),P=i.getImageData(0,0,m.width,m.height),h=P.data,W=document.createElement("div");W.style.color=I,document.body.appendChild(W);const te=getComputedStyle(W).color;document.body.removeChild(W);const ce=te.match(/\d+/g);if(!ce)return;const[ne,ae,re]=ce.map(Number),se=(Math.floor(T)*m.width+Math.floor(d))*4,le=h[se],_=h[se+1],K=h[se+2],Q=h[se+3];if(le===ne&&_===ae&&K===re)return;const ie=[[Math.floor(d),Math.floor(T)]],oe=new Set;for(;ie.length>0;){const[ue,fe]=ie.pop(),he=(fe*m.width+ue)*4;if(ue<0||ue>=m.width||fe<0||fe>=m.height||oe.has(he))continue;const Ye=h[he],en=h[he+1],tn=h[he+2],nn=h[he+3],Ne=30;Math.abs(Ye-le)>Ne||Math.abs(en-_)>Ne||Math.abs(tn-K)>Ne||Math.abs(nn-Q)>Ne||(oe.add(he),h[he]=ne,h[he+1]=ae,h[he+2]=re,h[he+3]=255,ie.push([ue+1,fe],[ue-1,fe],[ue,fe+1],[ue,fe-1]))}i.putImageData(P,0,0)},[]),$=e.useCallback(d=>{if(R)return;d.preventDefault(),d.currentTarget.setPointerCapture(d.pointerId);const T=O(d);if(B==="fill"){ee(T.x,T.y,a),A(),f==null||f(),G();return}if(Y(!0),k.current=T,X.current=T,B==="line"||B==="rectangle"||B==="circle"){const I=M.current,j=g.current;if(I&&j){const i=I.getBoundingClientRect();U.current=j.getImageData(0,0,i.width,i.height)}}else{const I=g.current;I&&(q(),I.beginPath(),I.arc(T.x,T.y,l/2,0,Math.PI*2),I.fill())}G()},[R,O,B,ee,a,A,f,G,q,l]),C=e.useCallback(d=>{if(!F||R)return;const T=O(d);B==="line"||B==="rectangle"||B==="circle"?k.current&&Z(k.current,T):X.current&&J(X.current,T),X.current=T},[F,R,O,B,Z,J]),E=e.useCallback(d=>{F&&(d.currentTarget.releasePointerCapture(d.pointerId),Y(!1),(B==="line"||B==="rectangle"||B==="circle")&&k.current&&X.current&&Z(k.current,X.current),U.current=null,k.current=null,X.current=null,A(),f==null||f())},[F,B,Z,A,f]);e.useImperativeHandle(D,()=>({clear:()=>{const d=M.current,T=g.current;if(!d||!T)return;const I=d.getBoundingClientRect();T.fillStyle=c,T.globalCompositeOperation="source-over",T.fillRect(0,0,I.width,I.height),A(),f==null||f()},undo:()=>{x.current>0&&(x.current--,L(x.current),f==null||f())},redo:()=>{x.current<H.current.length-1&&(x.current++,L(x.current),f==null||f())},canUndo:()=>x.current>0,canRedo:()=>x.current<H.current.length-1,toDataURL:(d="png",T=1)=>{const I=M.current;if(!I)return"";const j=d==="jpeg"?"image/jpeg":"image/png";return I.toDataURL(j,T)},toBlob:(d="png",T=1)=>new Promise(I=>{const j=M.current;if(!j){I(null);return}const i=d==="jpeg"?"image/jpeg":"image/png";j.toBlob(I,i,T)}),fromDataURL:async d=>{const T=M.current,I=g.current;if(!(!T||!I))return new Promise(j=>{const i=new Image;i.onload=()=>{const m=T.getBoundingClientRect();I.drawImage(i,0,0,m.width,m.height),A(),j()},i.src=d})},fill:d=>{const T=M.current,I=g.current;if(!T||!I)return;const j=T.getBoundingClientRect();I.fillStyle=d,I.globalCompositeOperation="source-over",I.fillRect(0,0,j.width,j.height),A(),f==null||f()},getTool:()=>B,setTool:d=>{z(d),v==null||v(d)}}),[c,A,L,B,v,f]);const V=()=>{switch(B){case"eraser":return"cell";case"fill":return"crosshair";default:return"crosshair"}};return t.jsx("div",{className:`nice-touch-drawing ${R?"nice-touch-drawing--disabled":""} ${p}`,...S,children:t.jsx("canvas",{ref:M,className:"nice-touch-drawing-canvas",style:{width:r,height:s,cursor:V(),touchAction:"none"},onPointerDown:$,onPointerMove:C,onPointerUp:E,onPointerCancel:E,onPointerLeave:E})})}),qr=["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)"],Gr={pen:"Pen",brush:"Brush",marker:"Mark",eraser:"Erase",fill:"Fill",line:"Line",rectangle:"Rect",circle:"Circle"};function ze(n,r,s){const[c,a]=e.useState(r),l=n!==void 0;return[l?n:c,o=>{l||a(o),s==null||s(o)}]}const Kr=e.forwardRef(function({tool:r,defaultTool:s="pen",onToolChange:c,color:a,defaultColor:l,onColorChange:u,strokeWidth:o,defaultStrokeWidth:b=4,onStrokeWidthChange:N,onUndo:y,onRedo:w,onClear:R,canUndo:f=!0,canRedo:v=!0,colors:p=qr,className:S="",...D},M){const[g,F]=ze(r,s,c),[Y,B]=ze(a,l??p[0],u),[z,H]=ze(o,b,N),x=["pen","brush","marker","eraser","fill","line","rectangle","circle"];return t.jsxs("div",{ref:M,className:`nice-drawing-toolbar ${S}`,...D,children:[t.jsx("div",{className:"nice-drawing-toolbar-section",children:x.map(k=>t.jsx("button",{type:"button",className:`nice-drawing-tool-btn ${g===k?"active":""}`,onClick:()=>F(k),title:k,"aria-label":k,children:Gr[k]},k))}),t.jsx("div",{className:"nice-drawing-toolbar-divider"}),t.jsx("div",{className:"nice-drawing-toolbar-section nice-drawing-colors",children:p.map((k,X)=>t.jsx("button",{type:"button",className:`nice-drawing-color-btn ${Y===k?"active":""}`,style:{backgroundColor:k,borderColor:k==="var(--nice-bg-primary, #ffffff)"?"var(--nice-border-color, #e5e7eb)":k},onClick:()=>B(k),title:k},X))}),t.jsx("div",{className:"nice-drawing-toolbar-divider"}),t.jsx("div",{className:"nice-drawing-toolbar-section",children:t.jsxs("label",{className:"nice-drawing-stroke-label",children:[t.jsxs("span",{children:[z,"px"]}),t.jsx("input",{type:"range",min:1,max:50,value:z,onChange:k=>H(Number(k.target.value)),className:"nice-drawing-stroke-slider"})]})}),t.jsx("div",{className:"nice-drawing-toolbar-divider"}),t.jsxs("div",{className:"nice-drawing-toolbar-section nice-drawing-actions",children:[y&&t.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:y,disabled:!f,title:"Undo",children:"Undo"}),w&&t.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:w,disabled:!v,title:"Redo",children:"Redo"}),R&&t.jsx("button",{type:"button",className:"nice-drawing-action-btn danger",onClick:R,title:"Clear",children:"Clear"})]})]})}),$e={en:{code:"en",name:"English",nativeName:"English",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]]},pl:{code:"pl",name:"Polish",nativeName:"Polski",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],accents:{a:["ą"],c:["ć"],e:["ę"],l:["ł"],n:["ń"],o:["ó"],s:["ś"],z:["ź","ż"]}},de:{code:"de",name:"German",nativeName:"Deutsch",rows:[["q","w","e","r","t","z","u","i","o","p","ü"],["a","s","d","f","g","h","j","k","l","ö","ä"],["y","x","c","v","b","n","m","ß"]],accents:{a:["ä"],o:["ö"],u:["ü"],s:["ß"]}},fr:{code:"fr",name:"French",nativeName:"Français",rows:[["a","z","e","r","t","y","u","i","o","p"],["q","s","d","f","g","h","j","k","l","m"],["w","x","c","v","b","n"]],accents:{a:["à","â","æ"],e:["é","è","ê","ë"],i:["î","ï"],o:["ô","œ"],u:["ù","û","ü"],c:["ç"]}},es:{code:"es",name:"Spanish",nativeName:"Español",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l","ñ"],["z","x","c","v","b","n","m"]],accents:{a:["á"],e:["é"],i:["í"],o:["ó"],u:["ú","ü"],n:["ñ"]}},it:{code:"it",name:"Italian",nativeName:"Italiano",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],accents:{a:["à"],e:["è","é"],i:["ì"],o:["ò"],u:["ù"]}},pt:{code:"pt",name:"Portuguese",nativeName:"Português",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l","ç"],["z","x","c","v","b","n","m"]],accents:{a:["á","ã","â","à"],e:["é","ê"],i:["í"],o:["ó","õ","ô"],u:["ú"],c:["ç"]}},ru:{code:"ru",name:"Russian",nativeName:"Русский",rows:[["й","ц","у","к","е","н","г","ш","щ","з","х","ъ"],["ф","ы","в","а","п","р","о","л","д","ж","э"],["я","ч","с","м","и","т","ь","б","ю"]]},uk:{code:"uk",name:"Ukrainian",nativeName:"Українська",rows:[["й","ц","у","к","е","н","г","ш","щ","з","х","ї"],["ф","і","в","а","п","р","о","л","д","ж","є"],["я","ч","с","м","и","т","ь","б","ю","ґ"]]},cs:{code:"cs",name:"Czech",nativeName:"Čeština",rows:[["q","w","e","r","t","z","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["y","x","c","v","b","n","m"]],accents:{a:["á"],c:["č"],d:["ď"],e:["é","ě"],i:["í"],n:["ň"],o:["ó"],r:["ř"],s:["š"],t:["ť"],u:["ú","ů"],y:["ý"],z:["ž"]}},tr:{code:"tr",name:"Turkish",nativeName:"Türkçe",rows:[["q","w","e","r","t","y","u","ı","o","p","ğ","ü"],["a","s","d","f","g","h","j","k","l","ş","i"],["z","x","c","v","b","n","m","ö","ç"]]},nl:{code:"nl",name:"Dutch",nativeName:"Nederlands",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],accents:{e:["é","ë"],i:["ï"],o:["ö"],u:["ü"]}},sv:{code:"sv",name:"Swedish",nativeName:"Svenska",rows:[["q","w","e","r","t","y","u","i","o","p","å"],["a","s","d","f","g","h","j","k","l","ö","ä"],["z","x","c","v","b","n","m"]]},no:{code:"no",name:"Norwegian",nativeName:"Norsk",rows:[["q","w","e","r","t","y","u","i","o","p","å"],["a","s","d","f","g","h","j","k","l","ø","æ"],["z","x","c","v","b","n","m"]]},da:{code:"da",name:"Danish",nativeName:"Dansk",rows:[["q","w","e","r","t","y","u","i","o","p","å"],["a","s","d","f","g","h","j","k","l","æ","ø"],["z","x","c","v","b","n","m"]]},fi:{code:"fi",name:"Finnish",nativeName:"Suomi",rows:[["q","w","e","r","t","y","u","i","o","p","å"],["a","s","d","f","g","h","j","k","l","ö","ä"],["z","x","c","v","b","n","m"]]},ro:{code:"ro",name:"Romanian",nativeName:"Română",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],accents:{a:["ă","â"],i:["î"],s:["ș"],t:["ț"]}},hr:{code:"hr",name:"Croatian",nativeName:"Hrvatski",rows:[["q","w","e","r","t","z","u","i","o","p","š","đ"],["a","s","d","f","g","h","j","k","l","č","ć"],["y","x","c","v","b","n","m","ž"]]},el:{code:"el",name:"Greek",nativeName:"Ελληνικά",rows:[["ς","ε","ρ","τ","υ","θ","ι","ο","π"],["α","σ","δ","φ","γ","η","ξ","κ","λ"],["ζ","χ","ψ","ω","β","ν","μ"]],accents:{α:["ά"],ε:["έ"],η:["ή"],ι:["ί","ϊ"],ο:["ό"],υ:["ύ","ϋ"],ω:["ώ"]}},hu:{code:"hu",name:"Hungarian",nativeName:"Magyar",rows:[["q","w","e","r","t","z","u","i","o","p","ő","ú"],["a","s","d","f","g","h","j","k","l","é","á"],["y","x","c","v","b","n","m","ö","ü","ó"]],accents:{a:["á"],e:["é"],i:["í"],o:["ó","ö","ő"],u:["ú","ü","ű"]}},sk:{code:"sk",name:"Slovak",nativeName:"Slovenčina",rows:[["q","w","e","r","t","z","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["y","x","c","v","b","n","m"]],accents:{a:["á","ä"],c:["č"],d:["ď"],e:["é"],i:["í"],l:["ĺ","ľ"],n:["ň"],o:["ó","ô"],r:["ŕ"],s:["š"],t:["ť"],u:["ú"],y:["ý"],z:["ž"]}},bg:{code:"bg",name:"Bulgarian",nativeName:"Български",rows:[["я","в","е","р","т","ъ","у","и","о","п","ш","щ"],["а","с","д","ф","г","х","й","к","л"],["з","ь","ц","ж","б","н","м","ч","ю"]]},sr:{code:"sr",name:"Serbian",nativeName:"Српски",rows:[["љ","њ","е","р","т","з","у","и","о","п","ш","ђ"],["а","с","д","ф","г","х","ј","к","л","ч","ћ"],["ж","џ","ц","в","б","н","м"]]},ja:{code:"ja",name:"Japanese (Romaji)",nativeName:"日本語",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]]},ko:{code:"ko",name:"Korean (Romaji)",nativeName:"한국어",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]]},zh:{code:"zh",name:"Chinese (Pinyin)",nativeName:"中文",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]]},ar:{code:"ar",name:"Arabic",nativeName:"العربية",rows:[["ض","ص","ث","ق","ف","غ","ع","ه","خ","ح","ج","د"],["ش","س","ي","ب","ل","ا","ت","ن","م","ك","ط"],["ئ","ء","ؤ","ر","لا","ى","ة","و","ز","ظ"]]},he:{code:"he",name:"Hebrew",nativeName:"עברית",rows:[["/","'","ק","ר","א","ט","ו","ן","ם","פ"],["ש","ד","ג","כ","ע","י","ח","ל","ך","ף"],["ז","ס","ב","ה","נ","מ","צ","ת","ץ"]]}},be={value:"Backspace",label:"⌫",type:"backspace",width:1.5},Te={value:"Enter",label:"⏎",type:"enter",width:1.5},Ce={value:" ",label:"Space",type:"space",width:5},De={value:"Shift",label:"⇧",type:"shift",width:1.5},Jr={value:"CapsLock",label:"⇪",type:"caps",width:1.75},Qr={value:"Tab",label:"⇥",type:"tab",width:1.5},We=[{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"0"},{value:"-"},{value:"="}],Zr=[{value:"!"},{value:"@"},{value:"#"},{value:"$"},{value:"%"},{value:"^"},{value:"&"},{value:"*"},{value:"("},{value:")"}],es=[{value:"-"},{value:"_"},{value:"="},{value:"+"},{value:"["},{value:"]"},{value:"{"},{value:"}"},be],ts=[{value:"Esc",label:"Esc",type:"fn",width:1},{value:"F1",label:"F1",type:"fn"},{value:"F2",label:"F2",type:"fn"},{value:"F3",label:"F3",type:"fn"},{value:"F4",label:"F4",type:"fn"},{value:"F5",label:"F5",type:"fn"},{value:"F6",label:"F6",type:"fn"},{value:"F7",label:"F7",type:"fn"},{value:"F8",label:"F8",type:"fn"},{value:"F9",label:"F9",type:"fn"},{value:"F10",label:"F10",type:"fn"},{value:"F11",label:"F11",type:"fn"},{value:"F12",label:"F12",type:"fn"}],_e=[[{value:"1"},{value:"2"},{value:"3"}],[{value:"4"},{value:"5"},{value:"6"}],[{value:"7"},{value:"8"},{value:"9"}],[{value:".",width:1},{value:"0"},be]],ns=[[{value:"7"},{value:"8"},{value:"9"},{value:"/",type:"special"}],[{value:"4"},{value:"5"},{value:"6"},{value:"*",type:"special"}],[{value:"1"},{value:"2"},{value:"3"},{value:"-",type:"special"}],[{value:"0",width:2},{value:"."},{value:"+",type:"special"}],[{value:"C",label:"C",type:"fn"},be,{value:"=",type:"enter",width:2}]],rs=[[{value:"1",label:"1"},{value:"2",label:"2 ABC"},{value:"3",label:"3 DEF"}],[{value:"4",label:"4 GHI"},{value:"5",label:"5 JKL"},{value:"6",label:"6 MNO"}],[{value:"7",label:"7 PQRS"},{value:"8",label:"8 TUV"},{value:"9",label:"9 WXYZ"}],[{value:"*",label:"*"},{value:"0",label:"0 +"},{value:"#",label:"#"}],[{value:"Call",label:"Call",type:"enter",width:1.5},be]],ss=[[{value:"1"},{value:"2"},{value:"3"}],[{value:"4"},{value:"5"},{value:"6"}],[{value:"7"},{value:"8"},{value:"9"}],[{value:"Clear",label:"C",type:"fn"},{value:"0"},be]];function cs(n,r,s,c,a){const l=$e[n]||$e.en,[u,o,b]=l.rows;if(r==="minimal")return _e;if(s){const w=[We.slice(0,10),Zr,es],R=[{value:"ABC",label:"ABC",type:"fn",width:1.5}];return c&&R.push({value:"Lang",label:"Lang",type:"lang",width:1}),R.push({value:",",width:1}),R.push({...Ce,width:c?3.5:4}),R.push({value:".",width:1}),R.push({...Te,...a?{label:a}:{}}),w.push(R),w}if(r==="compact"){const w=[u.map(f=>({value:f})),o.map(f=>({value:f})),[De,...b.map(f=>({value:f})),be]],R=[{value:"123",label:"123",type:"fn",width:1.5}];return c&&R.push({value:"Lang",label:"Lang",type:"lang",width:1}),R.push({value:",",width:1}),R.push({...Ce,width:c?3.5:4}),R.push({value:".",width:1}),R.push({...Te,...a?{label:a}:{}}),w.push(R),w}if(r==="standard"){const w=[We.slice(0,10),u.map(f=>({value:f})),o.map(f=>({value:f})),[De,...b.map(f=>({value:f})),be]],R=[{value:"#+=",label:"#+=",type:"fn",width:1.5}];return c&&R.push({value:"Lang",label:"Lang",type:"lang",width:1}),R.push({value:",",width:1}),R.push({...Ce,width:c?3:4}),R.push({value:".",width:1}),R.push({...Te,...a?{label:a}:{}}),w.push(R),w}const N=[ts,[...We,be],[Qr,...u.map(w=>({value:w}))],[Jr,...o.map(w=>({value:w})),{...Te,width:1.75,...a?{label:a}:{}}],[{...De,width:2.25},...b.map(w=>({value:w})),{...De,width:2.25}]],y=[{value:"#+=",label:"#+=",type:"fn",width:1.5}];if(c&&y.push({value:"Lang",label:"Lang",type:"lang",width:1}),y.push({...Ce,width:c?6:7}),y.push({value:",",width:1}),y.push({value:".",width:1}),N.push(y),l.accents){const w=[];for(const[,R]of Object.entries(l.accents))for(const f of R)w.find(v=>v.value===f)||w.push({value:f});w.length>0&&N.push(w)}return N}const Ae=e.forwardRef(function({layout:r="qwerty",customLayout:s,mode:c="standard",languages:a,activeLanguage:l,onLanguageChange:u,value:o="",maxLength:b,theme:N="system",haptic:y=!0,sound:w=!1,onKeyPress:R,onChange:f,onSubmit:v,disabled:p=!1,showPreview:S=!1,previewPlaceholder:D="Type here...",masked:M=!1,showLanguageSwitcher:g,enterLabel:F,className:Y="",...B},z){const H=e.useMemo(()=>a&&a.length>0?a:["en"],[a]),[x,k]=e.useState(H[0]),X=l??x,[U,A]=e.useState(!1),[L,G]=e.useState(!1),[O,q]=e.useState(!1),J=g??H.length>1,Z=e.useMemo(()=>r==="custom"&&s?s.rows:r!=="qwerty"?{numeric:_e,numpad:ns,phone:rs,pin:ss}[r]||_e:cs(X,c,O,J,F),[r,s,X,c,O,J,F]),ee=e.useCallback(()=>{const j=H.indexOf(X),i=H[(j+1)%H.length];k(i),u==null||u(i)},[H,X,u]),$=e.useCallback(()=>{if(!(!y||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[y]),C=e.useCallback(()=>{if(w)try{const j=new(window.AudioContext||window.webkitAudioContext),i=j.createOscillator(),m=j.createGain();i.connect(m),m.connect(j.destination),i.frequency.value=1e3,i.type="sine",m.gain.value=.1,i.start(),i.stop(j.currentTime+.05)}catch{}},[w]),E=e.useCallback(j=>{if(p)return;$(),C();let i=o;switch(j.type){case"backspace":i=o.slice(0,-1);break;case"enter":v==null||v(o);return;case"shift":A(m=>!m);return;case"caps":G(m=>!m);return;case"tab":i=o+" ";break;case"lang":ee();return;case"fn":if(j.value==="123"||j.value==="ABC"||j.value==="#+="||j.value==="#+=")q(m=>!m);else if(j.value==="Clear"||j.value==="C")i="";else{R==null||R(j.value);return}return;case"space":i=o+" ";break;default:{let m=j.value;(U||L)&&m.length===1&&(m=m.toUpperCase()),i=o+m,U&&!L&&A(!1)}}b&&i.length>b||(R==null||R(j.value),f==null||f(i))},[p,o,b,U,L,$,C,R,f,v,ee]),V=e.useMemo(()=>M?"•".repeat(o.length):o,[o,M]),d=U||L,T=N==="system"?"":`nice-touch-keyboard--${N}`,I=$e[X];return t.jsxs("div",{ref:z,className:["nice-touch-keyboard",`nice-touch-keyboard--${c}`,T,p?"nice-touch-keyboard--disabled":"",Y].filter(Boolean).join(" "),"data-layout":r,"data-language":X,dir:X==="ar"||X==="he"?"rtl":void 0,...B,children:[J&&H.length>1&&t.jsx("div",{className:"nice-touch-keyboard-langbar",children:H.map(j=>{const i=$e[j];return t.jsx("button",{type:"button",className:`nice-touch-keyboard-langbar__btn ${j===X?"active":""}`,onClick:()=>{k(j),u==null||u(j)},disabled:p,children:(i==null?void 0:i.nativeName)??j.toUpperCase()},j)})}),S&&t.jsxs("div",{className:"nice-touch-keyboard-preview",children:[V||t.jsx("span",{className:"nice-touch-keyboard-placeholder",children:D}),t.jsx("span",{className:"nice-touch-keyboard-cursor"})]}),t.jsx("div",{className:"nice-touch-keyboard-keys",children:Z.map((j,i)=>t.jsx("div",{className:"nice-touch-keyboard-row",children:j.map((m,P)=>{var ce;const h=m.type==="shift"&&U||m.type==="caps"&&L||m.type==="lang"||m.value==="123"&&O||m.value==="ABC"&&!O||m.value==="#+="&&O;let W=m.label||m.value;d&&!m.type&&W.length===1&&(W=W.toUpperCase());const te=!m.type&&m.value.length===1&&((ce=I==null?void 0:I.accents)==null?void 0:ce[m.value.toLowerCase()]);return t.jsx("button",{type:"button",className:["nice-touch-keyboard-key",`nice-touch-keyboard-key--${m.type||"char"}`,h?"active":"",te?"nice-touch-keyboard-key--has-accent":""].filter(Boolean).join(" "),style:{flex:m.width||1},onClick:()=>E(m),disabled:p,"aria-label":m.type==="backspace"?"Backspace":m.type==="enter"?"Enter":void 0,children:m.icon||W},P)})},i))}),t.jsxs("div",{className:"nice-touch-keyboard-status",children:[L&&t.jsx("span",{className:"nice-touch-keyboard-status__item",children:"CAPS"}),I&&t.jsx("span",{className:"nice-touch-keyboard-status__item",children:I.nativeName})]})]})}),is=e.forwardRef(function(r,s){return t.jsx(Ae,{ref:s,layout:"pin",masked:!0,maxLength:r.maxLength||6,...r})}),as=e.forwardRef(function(r,s){return t.jsx(Ae,{ref:s,layout:"numpad",...r})}),ls=e.forwardRef(function(r,s){return t.jsx(Ae,{ref:s,layout:"phone",...r})}),Jt=e.createContext(null);function os(n,r=500){const s=e.useRef(void 0),c=e.useRef(null),a=e.useCallback(o=>{c.current={x:o.clientX,y:o.clientY},s.current=setTimeout(()=>{n(o)},r)},[n,r]),l=e.useCallback(o=>{if(!c.current)return;const b=Math.abs(o.clientX-c.current.x),N=Math.abs(o.clientY-c.current.y);(b>10||N>10)&&u()},[]),u=e.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=void 0),c.current=null},[]);return e.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]),{onPointerDown:a,onPointerMove:l,onPointerUp:u,onPointerCancel:u,onPointerLeave:u}}const mt=({item:n,onSelect:r})=>{const s=e.useContext(Jt),c=e.useRef(null),[a,l]=e.useState(null),u=e.useCallback(()=>{var y;if(!n.disabled)if(n.children&&n.children.length>0){if(c.current){const w=c.current.getBoundingClientRect();s==null||s.openSubmenu(n.id,{x:w.right,y:w.top})}}else(y=n.onClick)==null||y.call(n),r(n)},[n,r,s]),o=e.useCallback(()=>{if(n.children&&n.children.length>0&&c.current){const y=c.current.getBoundingClientRect();s==null||s.openSubmenu(n.id,{x:y.right,y:y.top})}},[n,s]),b=n.children&&n.children.length>0,N=(s==null?void 0:s.activeSubmenu)===n.id;return t.jsxs(t.Fragment,{children:[t.jsxs("button",{ref:c,type:"button",className:`nice-touch-menu-item ${n.disabled?"disabled":""} ${n.danger?"danger":""} ${N?"active":""}`,onClick:u,onPointerEnter:o,disabled:n.disabled,role:"menuitem","aria-haspopup":b?"menu":void 0,"aria-expanded":b?N:void 0,children:[n.icon&&t.jsx("span",{className:"nice-touch-menu-item-icon",children:n.icon}),t.jsx("span",{className:"nice-touch-menu-item-label",children:n.label}),n.shortcut&&t.jsx("span",{className:"nice-touch-menu-item-shortcut",children:n.shortcut}),b&&t.jsx("span",{className:"nice-touch-menu-item-arrow","aria-hidden":"true"})]}),n.divider&&t.jsx("div",{className:"nice-touch-menu-divider",role:"separator"})]})},Qt=e.forwardRef(function({items:r,open:s,position:c,onClose:a,haptic:l=!0,className:u="",...o},b){var F;const N=e.useRef(null),[y,w]=e.useState(null),[R,f]=e.useState(null),[v,p]=e.useState(c);e.useEffect(()=>{if(!s||!N.current)return;const B=N.current.getBoundingClientRect(),z={width:window.innerWidth,height:window.innerHeight};let H=c.x,x=c.y;H+B.width>z.width-8&&(H=z.width-B.width-8),H<8&&(H=8),x+B.height>z.height-8&&(x=z.height-B.height-8),x<8&&(x=8),p({x:H,y:x})},[s,c]),e.useEffect(()=>{if(!s)return;const Y=z=>{N.current&&!N.current.contains(z.target)&&a()},B=z=>{z.key==="Escape"&&a()};return document.addEventListener("mousedown",Y),document.addEventListener("keydown",B),()=>{document.removeEventListener("mousedown",Y),document.removeEventListener("keydown",B)}},[s,a]);const S=e.useCallback(()=>{if(!(!l||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[l]),D=e.useCallback(Y=>{S(),a()},[S,a]),M={close:a,openSubmenu:(Y,B)=>{w(Y),f(B)},closeSubmenu:()=>{w(null),f(null)},activeSubmenu:y};if(!s)return null;const g=y?(F=r.find(Y=>Y.id===y))==null?void 0:F.children:null;return t.jsx(Jt.Provider,{value:M,children:t.jsxs("div",{ref:N,className:`nice-touch-menu-popover ${u}`,style:{left:v.x,top:v.y},role:"menu",...o,children:[r.map(Y=>t.jsx(mt,{item:Y,onSelect:D},Y.id)),g&&R&&t.jsx("div",{className:"nice-touch-menu-popover nice-touch-menu-submenu",style:{left:R.x-v.x,top:R.y-v.y},role:"menu",children:g.map(Y=>t.jsx(mt,{item:Y,onSelect:D},Y.id))})]})})}),us=e.forwardRef(function({items:r,trigger:s,longPress:c=!0,longPressDelay:a=500,enableContextMenu:l=!1,enableClick:u=!1,haptic:o=!0,disabled:b=!1,onOpen:N,onClose:y,className:w="",...R},f){const[v,p]=e.useState(!1),[S,D]=e.useState({x:0,y:0}),M=e.useRef(null),g=e.useCallback(()=>{if(!(!o||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(20)}catch{}},[o]),F=e.useCallback((x,k)=>{b||(g(),D({x,y:k}),p(!0),N==null||N())},[b,g,N]),Y=e.useCallback(()=>{p(!1),y==null||y()},[y]),B=os(x=>{x.preventDefault(),F(x.clientX,x.clientY)},a),z=e.useCallback(x=>{if(!(!u||b)&&(x.preventDefault(),x.stopPropagation(),M.current)){const k=M.current.getBoundingClientRect();F(k.left,k.bottom+4)}},[u,b,F]),H=e.useCallback(x=>{!l||b||(x.preventDefault(),F(x.clientX,x.clientY))},[l,b,F]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:x=>{M.current=x,typeof f=="function"?f(x):f&&(f.current=x)},className:`nice-touch-menu-trigger ${b?"disabled":""} ${w}`,onClick:z,onContextMenu:H,...c&&!b?B:{},...R,children:s}),t.jsx(Qt,{items:r,open:v,position:S,onClose:Y,haptic:o})]})}),ds=e.forwardRef(function({items:r,open:s,onClose:c,title:a,cancelLabel:l="Cancel",haptic:u=!0,className:o="",...b},N){const y=e.useCallback(()=>{if(!(!u||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[u]),w=e.useCallback(v=>{var p;v.disabled||(y(),(p=v.onClick)==null||p.call(v),c())},[y,c]),R=e.useCallback(()=>{y(),c()},[y,c]),f=e.useCallback(v=>{v.target===v.currentTarget&&c()},[c]);return e.useEffect(()=>{if(!s)return;const v=p=>{p.key==="Escape"&&c()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[s,c]),s?t.jsx("div",{className:`nice-action-sheet-backdrop ${s?"open":""}`,onClick:f,children:t.jsxs("div",{ref:N,className:`nice-action-sheet ${o}`,role:"dialog","aria-modal":"true",...b,children:[t.jsxs("div",{className:"nice-action-sheet-content",children:[a&&t.jsx("div",{className:"nice-action-sheet-title",children:a}),r.map(v=>t.jsxs("button",{type:"button",className:`nice-action-sheet-item ${v.disabled?"disabled":""} ${v.danger?"danger":""}`,onClick:()=>w(v),disabled:v.disabled,children:[v.icon&&t.jsx("span",{className:"nice-action-sheet-item-icon",children:v.icon}),t.jsx("span",{className:"nice-action-sheet-item-label",children:v.label})]},v.id))]}),t.jsx("button",{type:"button",className:"nice-action-sheet-cancel",onClick:R,children:l})]})}):null}),bt=6;function fs({row:n,rowIndex:r,rowKey:s,columns:c,swipeActionsLeft:a=[],swipeActionsRight:l=[],selectable:u,selected:o,onSelect:b,onClick:N,haptic:y,swipeThreshold:w=80}){const[R,f]=e.useState(0),[v,p]=e.useState(!1),S=e.useRef(0),D=e.useRef(0),M=e.useRef(null),g=a.length>0,F=l.length>0,Y=e.useCallback(()=>{if(!(!y||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[y]),B=e.useCallback(C=>{!g&&!F||(S.current=C.touches[0].clientX,D.current=C.touches[0].clientX,p(!0))},[g,F]),z=e.useCallback(C=>{D.current=C;const E=D.current-S.current;let V=E;const d=g?w*a.length:0,T=F?w*l.length:0;V>d&&(V=d),V<-T&&(V=-T),!g&&V>0&&(V=E*.2),!F&&V<0&&(V=E*.2),f(V)},[g,F,w,a.length,l.length]),H=e.useCallback(C=>{v&&z(C.touches[0].clientX)},[v,z]),x=e.useCallback(()=>{if(!v)return;p(!1);const C=w*.5;R>C&&g?(f(w*a.length),Y()):R<-C&&F?(f(-w*l.length),Y()):f(0)},[v,R,w,g,F,a.length,l.length,Y]),k=e.useRef(null),X=e.useRef(0),U=e.useRef(!1),A=e.useCallback(C=>{C.pointerType==="touch"||C.button!==0||!g&&!F||(k.current=C.pointerId,S.current=C.clientX,D.current=C.clientX,X.current=C.clientY)},[g,F]),L=e.useCallback(C=>{var E,V;if(C.pointerId===k.current){if(!v){const d=C.clientX-S.current,T=C.clientY-X.current;if(Math.abs(d)<bt&&Math.abs(T)<bt)return;if(Math.abs(T)>Math.abs(d)){k.current=null;return}(V=(E=C.currentTarget).setPointerCapture)==null||V.call(E,C.pointerId),p(!0)}z(C.clientX)}},[v,z]),G=e.useCallback(C=>{C.pointerId===k.current&&(k.current=null,v&&(U.current=!0,x()))},[v,x]),O=e.useCallback(C=>{Y(),C.onAction(n,r),f(0)},[n,r,Y]),q=e.useCallback(()=>{if(U.current){U.current=!1;return}Math.abs(R)>10||(u&&b?b():N&&N())},[R,u,b,N]);e.useEffect(()=>{if(R===0)return;const C=E=>{M.current&&!M.current.contains(E.target)&&f(0)};return document.addEventListener("click",C),()=>document.removeEventListener("click",C)},[R]);const J={transform:R?`translateX(${R}px)`:void 0,transition:v?"none":"transform 0.2s ease-out",userSelect:v?"none":void 0},Z=R!==0||v,ee=C=>{const E=C==="left"?a:l;if(!E.length||!Z)return null;const V=C==="left"?"var(--nice-color-primary, #3b82f6)":"var(--nice-color-error, #ef4444)";return t.jsx("div",{className:`nice-touch-table-actions nice-touch-table-actions--${C}`,style:{width:w*E.length},children:E.map(d=>t.jsxs("button",{type:"button",className:"nice-touch-table-action",style:{backgroundColor:d.color||V,color:d.textColor||"var(--nice-color-white, #ffffff)",width:w},onClick:T=>{T.stopPropagation(),O(d)},children:[d.icon&&t.jsx("span",{className:"action-icon",children:d.icon}),t.jsx("span",{className:"action-label",children:d.label})]},d.id))})},$=c.length-1;return t.jsxs("tr",{ref:M,className:`nice-touch-table-row ${o?"selected":""} ${v?"swiping":""}`,onTouchStart:B,onTouchMove:H,onTouchEnd:x,onTouchCancel:x,onPointerDown:A,onPointerMove:L,onPointerUp:G,onPointerCancel:G,onClick:q,"data-row-key":s,children:[u&&t.jsxs("td",{className:"nice-touch-table-cell nice-touch-table-cell--checkbox nice-touch-table-cell--edge",style:J,children:[ee("left"),t.jsx("input",{type:"checkbox",checked:o,onChange:()=>b==null?void 0:b(),onClick:C=>C.stopPropagation()})]}),c.map((C,E)=>{const V=typeof C.accessor=="function"?C.accessor(n):n[C.accessor],d=C.cell?C.cell(V,n,r):V,T=!u&&E===0,I=E===$;return t.jsxs("td",{className:`nice-touch-table-cell ${C.sticky?"sticky":""} ${T||I?"nice-touch-table-cell--edge":""}`,style:{width:C.width,minWidth:C.minWidth,textAlign:C.align,...J},children:[T&&ee("left"),d,I&&ee("right")]},C.id)})]})}const hs=e.forwardRef(function({data:r,columns:s,rowKey:c,swipeActionsLeft:a,swipeActionsRight:l,selectable:u=!1,selectedKeys:o=[],onSelect:b,onRowClick:N,sortState:y,onSort:w,emptyContent:R="No data",loading:f=!1,haptic:v=!0,swipeThreshold:p=80,className:S="",...D},M){const g=e.useCallback(x=>typeof c=="function"?c(x):String(x[c]),[c]),F=e.useCallback(x=>{if(!x.sortable||!w)return;const k=(y==null?void 0:y.columnId)===x.id&&y.direction==="asc"?"desc":"asc";w({columnId:x.id,direction:k})},[y,w]),Y=e.useCallback(()=>{b&&(o.length===r.length?b([]):b(r.map(x=>g(x))))},[r,o,b,g]),B=e.useCallback(x=>{if(!b)return;const k=o.includes(x)?o.filter(X=>X!==x):[...o,x];b(k)},[o,b]),z=r.length>0&&o.length===r.length,H=o.length>0&&o.length<r.length;return t.jsxs("div",{ref:M,className:`nice-touch-table-container ${f?"loading":""} ${S}`,...D,children:[t.jsx("div",{className:"nice-touch-table-scroll",children:t.jsxs("table",{className:"nice-touch-table",children:[t.jsx("thead",{className:"nice-touch-table-head",children:t.jsxs("tr",{children:[u&&t.jsx("th",{className:"nice-touch-table-header nice-touch-table-header--checkbox",children:t.jsx("input",{type:"checkbox",checked:z,ref:x=>{x&&(x.indeterminate=H)},onChange:Y})}),s.map(x=>t.jsx("th",{className:`nice-touch-table-header ${x.sticky?"sticky":""} ${x.sortable?"sortable":""}`,style:{width:x.width,minWidth:x.minWidth,textAlign:x.align},onClick:()=>F(x),children:t.jsxs("span",{className:"header-content",children:[x.header,x.sortable&&t.jsx("span",{className:"sort-indicator","aria-hidden":"true",children:(y==null?void 0:y.columnId)===x.id&&t.jsx("span",{className:`sort-mark sort-mark--${y.direction}`})})]})},x.id))]})}),t.jsx("tbody",{className:"nice-touch-table-body",children:r.length===0?t.jsx("tr",{className:"nice-touch-table-empty",children:t.jsx("td",{colSpan:s.length+(u?1:0),children:R})}):r.map((x,k)=>{const X=g(x);return t.jsx(fs,{row:x,rowIndex:k,rowKey:X,columns:s,swipeActionsLeft:a,swipeActionsRight:l,selectable:u,selected:o.includes(X),onSelect:()=>B(X),onClick:()=>N==null?void 0:N(x,k),haptic:v,swipeThreshold:p},X)})})]})}),f&&t.jsx("div",{className:"nice-touch-table-loading",children:t.jsx("div",{className:"nice-touch-table-spinner"})})]})}),Zt=e.createContext(null);function et(){const n=e.useContext(Zt);if(!n)throw new Error("useTouchForm must be used within NiceTouchForm");return n}function pt(n,r){for(const s of r){const c=String(n??"");switch(s.type){case"required":if(!n||typeof n=="string"&&!n.trim())return s.message;break;case"email":if(n&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c))return s.message;break;case"minLength":if(n&&c.length<s.value)return s.message;break;case"maxLength":if(n&&c.length>s.value)return s.message;break;case"pattern":if(n&&!new RegExp(s.value).test(c))return s.message;break;case"custom":if(s.validator&&!s.validator(n))return s.message;break}}return null}const vs=e.forwardRef(function({initialValues:r={},validation:s={},onSubmit:c,onChange:a,onError:l,enableNavigation:u=!0,haptic:o=!0,autoFocus:b=!1,validateOnBlur:N=!0,validateOnChange:y=!1,disabled:w=!1,children:R,className:f="",...v},p){const[S,D]=e.useState(r),[M,g]=e.useState([]),[F,Y]=e.useState(new Set),[B,z]=e.useState(!1),H=e.useRef(new Map),x=e.useRef([]),k=e.useRef(null),X=e.useCallback(()=>{if(!(!o||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[o]),U=e.useCallback((E,V)=>{const d=s[E];return d?pt(V,d):null},[s]),A=e.useCallback(()=>{const E=[];for(const[V,d]of Object.entries(s)){const T=pt(S[V],d);T&&E.push({field:V,message:T})}return E},[S,s]),L=e.useCallback((E,V)=>{if(D(d=>{const T={...d,[E]:V};return a==null||a(T),T}),y){const d=U(E,V);g(T=>{const I=T.filter(j=>j.field!==E);return d?[...I,{field:E,message:d}]:I})}},[a,y,U]),G=e.useCallback(E=>{if(Y(V=>new Set([...V,E])),N){const V=U(E,S[E]);g(d=>{const T=d.filter(I=>I.field!==E);return V?[...T,{field:E,message:V}]:T})}},[N,U,S]),O=e.useCallback(E=>{var d;const V=H.current.get(E);V&&((d=V.focus)==null||d.call(V),k.current=E)},[]),q=e.useCallback(()=>{if(!u)return;const E=x.current,V=k.current;if(!V){E.length>0&&O(E[0]);return}const d=E.indexOf(V);d<E.length-1&&(O(E[d+1]),X())},[u,O,X]),J=e.useCallback(()=>{if(!u)return;const E=x.current,V=k.current;if(!V)return;const d=E.indexOf(V);d>0&&(O(E[d-1]),X())},[u,O,X]),Z=e.useCallback((E,V)=>{H.current.set(E,V),V&&!x.current.includes(E)&&x.current.push(E)},[]),ee=e.useCallback(E=>{H.current.delete(E),x.current=x.current.filter(V=>V!==E)},[]),$=e.useCallback(async E=>{if(E.preventDefault(),w||B)return;const V=A();if(V.length>0){g(V),l==null||l(V),X();const d=V[0];d&&O(d.field);return}z(!0);try{await(c==null?void 0:c(S)),X()}catch(d){console.error("Form submission error:",d)}finally{z(!1)}},[w,B,A,l,c,S,X,O]);e.useEffect(()=>{b&&x.current.length>0&&setTimeout(()=>O(x.current[0]),100)},[b,O]);const C=e.useMemo(()=>({values:S,errors:M,touched:F,setFieldValue:L,setFieldTouched:G,focusField:O,focusNext:q,focusPrev:J,registerField:Z,unregisterField:ee}),[S,M,F,L,G,O,q,J,Z,ee]);return t.jsx(Zt.Provider,{value:C,children:t.jsx("form",{ref:p,className:`nice-touch-form ${w?"disabled":""} ${B?"submitting":""} ${f}`,onSubmit:$,noValidate:!0,...v,children:R})})}),ms=e.forwardRef(function({name:r,label:s,type:c="text",placeholder:a,helperText:l,disabled:u=!1,readOnly:o=!1,autoComplete:b,inputMode:N,iconLeft:y,iconRight:w,maxLength:R,onChange:f,required:v,className:p="",...S},D){const M=et(),g=e.useRef(null),[F,Y]=e.useState(!1),B=M.values[r]??"",z=M.errors.find(L=>L.field===r),x=M.touched.has(r)&&z;e.useEffect(()=>(M.registerField(r,g.current),()=>M.unregisterField(r)),[r,M]);const k=e.useCallback(L=>{const G=L.target.value;M.setFieldValue(r,G),f==null||f(G)},[r,M,f]),X=e.useCallback(()=>{Y(!0)},[]),U=e.useCallback(()=>{Y(!1),M.setFieldTouched(r)},[r,M]),A=e.useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),M.focusNext())},[M]);return t.jsxs("div",{ref:D,className:`nice-touch-field ${F?"focused":""} ${x?"error":""} ${u?"disabled":""} ${p}`,...S,children:[s&&t.jsxs("label",{className:"nice-touch-field-label",htmlFor:`field-${r}`,children:[s,v&&t.jsx("span",{className:"required-indicator",children:"*"})]}),t.jsxs("div",{className:"nice-touch-field-input-wrapper",children:[y&&t.jsx("span",{className:"nice-touch-field-icon left",children:y}),t.jsx("input",{ref:g,id:`field-${r}`,name:r,type:c,value:B,placeholder:a,disabled:u,readOnly:o,autoComplete:b,inputMode:N,maxLength:R,onChange:k,onFocus:X,onBlur:U,onKeyDown:A,className:"nice-touch-field-input","aria-invalid":x?"true":void 0,"aria-describedby":x?`${r}-error`:l?`${r}-helper`:void 0}),w&&t.jsx("span",{className:"nice-touch-field-icon right",children:w})]}),x&&t.jsx("div",{id:`${r}-error`,className:"nice-touch-field-error",role:"alert",children:z.message}),!x&&l&&t.jsx("div",{id:`${r}-helper`,className:"nice-touch-field-helper",children:l})]})}),bs=e.forwardRef(function({loading:r=!1,disabled:s=!1,fullWidth:c=!0,children:a,className:l="",...u},o){return t.jsx("button",{ref:o,type:"submit",className:`nice-touch-submit ${c?"full-width":""} ${r?"loading":""} ${l}`,disabled:s||r,...u,children:r?t.jsx("span",{className:"nice-touch-submit-spinner"}):a})}),ps=e.forwardRef(function({doneText:r="Done",showDone:s=!0,onDone:c,className:a="",...l},u){const o=et(),b=e.useCallback(()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur(),c==null||c()},[c]);return t.jsxs("div",{ref:u,className:`nice-touch-navbar ${a}`,...l,children:[t.jsxs("div",{className:"nice-touch-navbar-arrows",children:[t.jsx("button",{type:"button",onClick:o.focusPrev,"aria-label":"Previous field",children:t.jsx("span",{className:"nice-touch-navbar-mark nice-touch-navbar-mark--prev","aria-hidden":"true"})}),t.jsx("button",{type:"button",onClick:o.focusNext,"aria-label":"Next field",children:t.jsx("span",{className:"nice-touch-navbar-mark nice-touch-navbar-mark--next","aria-hidden":"true"})})]}),s&&t.jsx("button",{type:"button",className:"nice-touch-navbar-done",onClick:b,children:r})]})});exports.DEFAULT_BREAKPOINTS=Be;exports.DotsIndicator=cn;exports.DrawerIcons=Rn;exports.EmojiIndicator=ln;exports.HAPTIC_PATTERNS=Qe;exports.HapticPatternBuilder=zt;exports.HeaderIcons=Xn;exports.HeroHeader=qn;exports.IOSHeader=On;exports.IOSIndicator=on;exports.LineIndicator=an;exports.MaterialHeader=_n;exports.MaterialIndicator=un;exports.NiceBottomSheet=Mt;exports.NiceBreakpointProvider=Sr;exports.NiceCalculatorKeyboard=as;exports.NiceConfirmSheet=$n;exports.NiceDateRangePicker=lr;exports.NiceDrawingToolbar=Kr;exports.NiceFAB=zr;exports.NiceGestures=Le;exports.NiceHapticsProvider=xr;exports.NiceHide=$r;exports.NiceImageGallery=Rt;exports.NiceInfiniteScroll=wn;exports.NiceMobileActionSheet=In;exports.NiceMobileCalendar=Je;exports.NiceMobileDatePicker=Zn;exports.NiceMobileDraggable=fr;exports.NiceMobileDrawer=Pt;exports.NiceMobileHeader=Ee;exports.NiceMobileModal=Ge;exports.NiceMobilePicker=Ke;exports.NiceMobilePullToRefresh=qe;exports.NiceMobileTabs=Bn;exports.NiceMobileTimePicker=Jn;exports.NiceMultiDatePicker=or;exports.NicePINKeyboard=is;exports.NicePhoneKeyboard=ls;exports.NicePickerColumn=Lt;exports.NicePinchZoom=dr;exports.NicePullToRefresh=qe;exports.NiceShow=Ir;exports.NiceSignaturePad=Kt;exports.NiceSwipeActions=Nt;exports.NiceSwipeList=dn;exports.NiceSwipeable=hr;exports.NiceTouchActionSheet=ds;exports.NiceTouchButton=Ze;exports.NiceTouchColorPicker=Xr;exports.NiceTouchDrawing=_r;exports.NiceTouchField=ms;exports.NiceTouchForm=vs;exports.NiceTouchIconButton=Vr;exports.NiceTouchKeyboard=Ae;exports.NiceTouchMenu=us;exports.NiceTouchMenuPopover=Qt;exports.NiceTouchNavBar=ps;exports.NiceTouchSignaturePad=Kt;exports.NiceTouchSlider=Wr;exports.NiceTouchSubmit=bs;exports.NiceTouchTable=hs;exports.PullToRefreshDefaultIndicator=yt;exports.SwipeActionPresets=fn;exports.SwipeGroupProvider=kt;exports.TabIcons=de;exports.TabPresets=Hn;exports.cancelVibration=wr;exports.colorUtils=Ur;exports.createHapticPattern=Cr;exports.createMediaQuery=Er;exports.generateNumberItems=ke;exports.getCurrentBreakpoint=Ut;exports.hapticFeedback=yr;exports.isMobileDevice=Br;exports.isTouch=Hr;exports.isVibrationSupported=ge;exports.responsive=Lr;exports.useBreakpoint=je;exports.useBreakpointContext=Pr;exports.useButtonHaptic=jr;exports.useCalendar=At;exports.useCollapsingHeader=Yn;exports.useDrawer=Mn;exports.useGestures=Ft;exports.useGesturesContext=ur;exports.useHaptics=pe;exports.useHapticsContext=pr;exports.useImpactHaptic=Tr;exports.useInfiniteData=kn;exports.useInfiniteScroll=mn;exports.useMediaQuery=Xt;exports.useMobileBreakpoint=je;exports.useMobileCalendar=er;exports.useMobileDrawer=Nn;exports.useMobileHeader=An;exports.useMobileMediaQuery=Xt;exports.useMobileModal=Tn;exports.useMobilePicker=Gn;exports.useMobilePullToRefresh=gt;exports.useMobileTabs=En;exports.useModal=Cn;exports.useNotificationHaptic=Rr;exports.usePullToRefresh=gt;exports.useSelectionHaptic=Mr;exports.useSwipeGroup=jt;exports.useTabs=Ln;exports.useToggleHaptic=Nr;exports.useTouchForm=et;exports.useTouchSlider=Ot;exports.useVirtualList=jn;exports.useWheelPicker=Kn;exports.vibrate=gr;exports.withHaptics=kr;
|
|
24
|
+
${J?"nice-touch-slider--dragging":""}
|
|
25
|
+
${O}
|
|
26
|
+
`,style:{"--thumb-size":`${x}px`,"--track-height":`${R}px`,...u?{"--track-color":u}:{},...m?{"--fill-color":m}:{}},...$,children:[g&&r.jsx("span",{className:"nice-touch-slider-min",children:k(s)}),r.jsxs("div",{ref:K,className:"nice-touch-slider-track-container",onPointerDown:E,onPointerMove:A,onPointerUp:h,onPointerCancel:h,children:[r.jsx("div",{className:"nice-touch-slider-track"}),r.jsx("div",{className:"nice-touch-slider-fill",style:p}),ne.length>0&&r.jsx("div",{className:"nice-touch-slider-marks",children:ne.map(N=>{const P=(N.value-s)/(a-s)*100,l=d==="horizontal"?{left:`${P}%`}:{bottom:`${P}%`};return r.jsxs("div",{className:"nice-touch-slider-mark",style:l,children:[r.jsx("span",{className:"nice-touch-slider-mark-dot"}),N.label&&r.jsx("span",{className:"nice-touch-slider-mark-label",children:N.label})]},N.value)})}),M.isRange?r.jsxs(r.Fragment,{children:[z(0,M.percentage[0]),z(1,M.percentage[1])]}):z(0,M.percentage)]}),g&&r.jsx("span",{className:"nice-touch-slider-max",children:k(a)})]})});function Fe(t,n,c){n/=100,c/=100;const s=(1-Math.abs(2*c-1))*n,a=s*(1-Math.abs(t/60%2-1)),i=c-s/2;let d=0,o=0,f=0;return t>=0&&t<60?(d=s,o=a,f=0):t>=60&&t<120?(d=a,o=s,f=0):t>=120&&t<180?(d=0,o=s,f=a):t>=180&&t<240?(d=0,o=a,f=s):t>=240&&t<300?(d=a,o=0,f=s):(d=s,o=0,f=a),{r:Math.round((d+i)*255),g:Math.round((o+i)*255),b:Math.round((f+i)*255)}}function en(t,n,c){t/=255,n/=255,c/=255;const s=Math.max(t,n,c),a=Math.min(t,n,c),i=(s+a)/2;let d=0,o=0;if(s!==a){const f=s-a;switch(o=i>.5?f/(2-s-a):f/(s+a),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(o*100),l:Math.round(i*100)}}function tn(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 nn(t,n,c){return"#"+[t,n,c].map(s=>s.toString(16).padStart(2,"0")).join("")}function ke(t){const n=tn(t);return en(n.r,n.g,n.b)}function Le(t,n,c){const s=Fe(t,n,c);return nn(s.r,s.g,s.b)}function Je(t,n){switch(n){case"hsl":return`hsl(${t.h}, ${t.s}%, ${t.l}%)`;case"rgb":{const c=Fe(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 ic=e.forwardRef(function({value:n,defaultValue:c="#6366f1",format:s="hex",showAlpha:a=!1,showPreview:i=!0,showInput:d=!0,presetColors:o,wheelSize:f=240,haptic:w=!0,onChange:v,presetLabel:k,className:g="",...u},m){const{t:x}=be.useNiceTranslation(),R=k??x("touchColorPicker.presets","Presets"),[D,j]=e.useState(()=>ke(n||c)),[y,I]=e.useState(n||c),[O,H]=e.useState(1),W=e.useRef(null),$=e.useRef(null),T=e.useRef(!1),M=e.useRef(!1);e.useEffect(()=>{if(n){const p=ke(n);j(p),I(n)}},[n]);const K=e.useCallback(()=>{if(!(!w||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[w]),J=e.useCallback(p=>{const z=Je(p,s);I(s==="hex"?z:Le(p.h,p.s,p.l)),v==null||v(z)},[s,v]);e.useEffect(()=>{const p=W.current;if(!p)return;const z=p.getContext("2d");if(!z)return;const N=f,P=N/2,l=P-10,b=l-30;p.width=N,p.height=N;for(let C=0;C<360;C++){const S=(C-1)*Math.PI/180,Z=(C+1)*Math.PI/180;z.beginPath(),z.arc(P,P,l,S,Z),z.arc(P,P,b,Z,S,!0),z.closePath(),z.fillStyle=`hsl(${C}, 100%, 50%)`,z.fill()}},[f]),e.useEffect(()=>{const p=$.current;if(!p)return;const z=p.getContext("2d");if(!z)return;const N=f*.5;p.width=N,p.height=N;const P=z.createImageData(N,N);for(let l=0;l<N;l++)for(let b=0;b<N;b++){const C=b/N*100,S=100-l/N*100,Z=Fe(D.h,C,S),B=(l*N+b)*4;P.data[B]=Z.r,P.data[B+1]=Z.g,P.data[B+2]=Z.b,P.data[B+3]=255}z.putImageData(P,0,0)},[D.h,f]);const X=e.useCallback(p=>{const z=W.current;if(!z)return;const N=z.getBoundingClientRect(),P=p.clientX-N.left-N.width/2,l=p.clientY-N.top-N.height/2;let b=Math.atan2(l,P)*(180/Math.PI)+90;b<0&&(b+=360);const C={...D,h:Math.round(b)};j(C),J(C),K()},[D,J,K]),Q=e.useCallback(p=>{const z=$.current;if(!z)return;const N=z.getBoundingClientRect(),P=Math.max(0,Math.min(N.width,p.clientX-N.left)),l=Math.max(0,Math.min(N.height,p.clientY-N.top)),b=Math.round(P/N.width*100),C=Math.round(100-l/N.height*100),S={...D,s:b,l:C};j(S),J(S),K()},[D,J,K]),q=e.useCallback(p=>{p.currentTarget.setPointerCapture(p.pointerId),T.current=!0,X(p)},[X]),F=e.useCallback(p=>{T.current&&X(p)},[X]),U=e.useCallback(p=>{p.currentTarget.releasePointerCapture(p.pointerId),T.current=!1},[]),G=e.useCallback(p=>{p.currentTarget.setPointerCapture(p.pointerId),M.current=!0,Q(p)},[Q]),ne=e.useCallback(p=>{M.current&&Q(p)},[Q]),te=e.useCallback(p=>{p.currentTarget.releasePointerCapture(p.pointerId),M.current=!1},[]),V=e.useCallback(p=>{const z=p.target.value;if(I(z),/^#?[0-9a-f]{6}$/i.test(z)){const N=z.startsWith("#")?z:`#${z}`,P=ke(N);j(P),v==null||v(Je(P,s))}},[s,v]),L=e.useCallback(p=>{const z=ke(p);j(z),J(z),K()},[J,K]),E=e.useMemo(()=>{const p=f/2,z=p-25,N=(D.h-90)*Math.PI/180;return{x:p+z*Math.cos(N),y:p+z*Math.sin(N)}},[D.h,f]),A=f*.5,h=e.useMemo(()=>({x:D.s/100*A,y:(1-D.l/100)*A}),[D.s,D.l,A]),_=e.useMemo(()=>Le(D.h,D.s,D.l),[D]);return r.jsxs("div",{ref:m,className:`nice-touch-color-picker ${g}`,...u,children:[r.jsxs("div",{className:"nice-touch-color-picker-wheel-container",style:{width:f,height:f},children:[r.jsx("canvas",{ref:W,className:"nice-touch-color-picker-wheel",onPointerDown:q,onPointerMove:F,onPointerUp:U,onPointerCancel:U}),r.jsx("div",{className:"nice-touch-color-picker-hue-indicator",style:{left:E.x,top:E.y,backgroundColor:`hsl(${D.h}, 100%, 50%)`}}),r.jsxs("div",{className:"nice-touch-color-picker-sl-container",style:{width:A,height:A},children:[r.jsx("canvas",{ref:$,className:"nice-touch-color-picker-sl",onPointerDown:G,onPointerMove:ne,onPointerUp:te,onPointerCancel:te}),r.jsx("div",{className:"nice-touch-color-picker-sl-indicator",style:{left:h.x,top:h.y,backgroundColor:_}})]})]}),r.jsxs("div",{className:"nice-touch-color-picker-controls",children:[i&&r.jsx("div",{className:"nice-touch-color-picker-preview",style:{backgroundColor:_}}),d&&r.jsx("input",{type:"text",className:"nice-touch-color-picker-input",value:y,onChange:V,placeholder:"#000000"})]}),a&&r.jsx("div",{className:"nice-touch-color-picker-alpha",children:r.jsx("input",{type:"range",min:"0",max:"100",value:O*100,onChange:p=>H(Number(p.target.value)/100),className:"nice-touch-color-picker-alpha-slider",style:{background:`linear-gradient(to right, transparent, ${_})`}})}),o&&o.length>0&&r.jsxs("div",{className:"nice-touch-color-picker-presets",children:[r.jsx("span",{className:"nice-touch-color-picker-presets-label",children:R}),r.jsx("div",{className:"nice-touch-color-picker-presets-grid",children:o.map((p,z)=>r.jsx("button",{type:"button",className:`nice-touch-color-picker-preset ${p.toLowerCase()===_.toLowerCase()?"nice-touch-color-picker-preset--selected":""}`,style:{backgroundColor:p},onClick:()=>L(p),"aria-label":x("touchColorPicker.selectColor","Select color {color}").replace("{color}",String(p))},z))})]})]})}),lc={hslToRgb:Fe,rgbToHsl:en,hexToRgb:tn,rgbToHex:nn,hexToHsl:ke,hslToHex:Le,formatColor:Je};function ye(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?ye(s):t;const a=typeof Element<"u"&&n instanceof Element&&n.isConnected?n:document.documentElement,i=getComputedStyle(a).getPropertyValue(c[1]).trim();return i||(s?ye(s,n):t)}function oc(t,n){return Math.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2))}function Nt(t,n){const c=n.time-t.time||1;return oc(t,n)/c}const rn=e.forwardRef(function({width:n="100%",height:c=200,strokeColor:s="#1f2937",strokeWidth:a=2,minWidth:i=.5,maxWidth:d=4,velocityFilterWeight:o=.7,backgroundColor:f="#ffffff",showGuideline:w=!0,guidelineColor:v="var(--nice-border-color, #e5e7eb)",disabled:k=!1,penPressure:g=!0,haptic:u=!0,placeholder:m,onChange:x,onBegin:R,onEnd:D,className:j="",...y},I){const{t:O}=be.useNiceTranslation(),H=m??O("signaturePad.signHere","Sign here"),W=e.useRef(null),$=e.useRef(null),T=e.useMemo(()=>ye(s,W.current),[s]),M=e.useMemo(()=>ye(f,W.current),[f]),K=e.useMemo(()=>ye(v,W.current),[v]),[J,X]=e.useState(!0),[Q,q]=e.useState(!1),F=e.useRef([]),U=e.useRef([]),G=e.useRef([]),ne=e.useRef(0),te=e.useRef(a);e.useEffect(()=>{const l=W.current;if(!l)return;const b=l.getBoundingClientRect(),C=window.devicePixelRatio||1;l.width=b.width*C,l.height=b.height*C;const S=l.getContext("2d");S&&(S.scale(C,C),$.current=S,L())},[]);const V=e.useCallback(()=>{if(!(!u||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[u]),L=e.useCallback(()=>{const l=W.current,b=$.current;if(!l||!b)return;const C=l.getBoundingClientRect();b.fillStyle=M,b.fillRect(0,0,C.width,C.height),w&&(b.strokeStyle=K,b.lineWidth=1,b.setLineDash([5,5]),b.beginPath(),b.moveTo(20,C.height*.7),b.lineTo(C.width-20,C.height*.7),b.stroke(),b.setLineDash([]))},[M,w,K]),E=e.useCallback(()=>{L();const l=$.current;l&&U.current.forEach(b=>{if(!(b.length<2)){l.strokeStyle=T,l.fillStyle=T,l.lineCap="round",l.lineJoin="round";for(let C=1;C<b.length;C++){const S=b[C-1],Z=b[C],B=Nt(S,Z),ae=Math.max(i,Math.min(d,d/(B+1)));l.lineWidth=ae,l.beginPath(),l.moveTo(S.x,S.y),l.lineTo(Z.x,Z.y),l.stroke()}}})},[L,T,i,d]),A=e.useCallback(l=>Math.max(i,d/(l*10+1)),[i,d]),h=e.useCallback(l=>{const b=$.current;b&&(b.fillStyle=T,b.beginPath(),b.arc(l.x,l.y,a/2,0,Math.PI*2),b.fill())},[T,a]),_=e.useCallback((l,b,C)=>{const S=$.current;S&&(S.strokeStyle=T,S.lineWidth=C,S.lineCap="round",S.lineJoin="round",S.beginPath(),S.moveTo(l.x,l.y),S.lineTo(b.x,b.y),S.stroke())},[T]),p=e.useCallback(l=>{const b=W.current;if(!b)return{x:0,y:0,time:Date.now()};const C=b.getBoundingClientRect();return{x:l.clientX-C.left,y:l.clientY-C.top,pressure:g?l.pressure:void 0,time:Date.now()}},[g]),z=e.useCallback(l=>{if(k)return;l.preventDefault(),l.currentTarget.setPointerCapture(l.pointerId),q(!0);const b=p(l);F.current=[b],ne.current=0,te.current=a,G.current=[],h(b),R==null||R(),V()},[k,p,a,h,R,V]),N=e.useCallback(l=>{if(!Q||k)return;const b=p(l),C=F.current;if(C.length===0)return;const S=C[C.length-1],Z=Nt(S,b),B=o*Z+(1-o)*ne.current,ae=A(B),le=(te.current+ae)/2,se=b.pressure!==void 0?le*Math.max(.5,b.pressure):le;_(S,b,se),C.push(b),ne.current=B,te.current=ae},[Q,k,p,o,A,_]),P=e.useCallback(l=>{Q&&(l.currentTarget.releasePointerCapture(l.pointerId),q(!1),F.current.length>0&&(U.current.push([...F.current]),F.current=[],X(!1),x==null||x(!1)),D==null||D())},[Q,x,D]);return e.useImperativeHandle(I,()=>({clear:()=>{U.current=[],G.current=[],F.current=[],L(),X(!0),x==null||x(!0)},isEmpty:()=>J,toData:()=>[...U.current],fromData:l=>{U.current=l,G.current=[],X(l.length===0),E(),x==null||x(l.length===0)},toDataURL:(l="png",b=1)=>{const C=W.current;if(!C)return"";if(l==="svg"){const Z=C.getBoundingClientRect();let B="";U.current.forEach(le=>{if(le.length<2)return;let se=`M ${le[0].x} ${le[0].y}`;for(let re=1;re<le.length;re++)se+=` L ${le[re].x} ${le[re].y}`;B+=`<path d="${se}" stroke="${T}" stroke-width="${a}" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`});const ae=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z.width}" height="${Z.height}" viewBox="0 0 ${Z.width} ${Z.height}">${B}</svg>`;return`data:image/svg+xml;base64,${btoa(ae)}`}if(l==="json")return`data:application/json;base64,${btoa(JSON.stringify(U.current))}`;const S=l==="jpeg"?"image/jpeg":"image/png";return C.toDataURL(S,b)},toSVG:()=>{const l=W.current;if(!l)return"";const b=l.getBoundingClientRect();let C="";return U.current.forEach(S=>{if(S.length<2)return;let Z=`M ${S[0].x} ${S[0].y}`;for(let B=1;B<S.length;B++)Z+=` L ${S[B].x} ${S[B].y}`;C+=`<path d="${Z}" stroke="${T}" stroke-width="${a}" 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}">${C}</svg>`},toBlob:(l="png",b=1)=>new Promise(C=>{const S=W.current;if(!S){C(null);return}const Z=l==="jpeg"?"image/jpeg":"image/png";S.toBlob(C,Z,b)}),undo:()=>{if(U.current.length===0)return;const l=U.current.pop();l&&G.current.push(l);const b=U.current.length===0;X(b),E(),x==null||x(b)},redo:()=>{if(G.current.length===0)return;const l=G.current.pop();l&&U.current.push(l),X(!1),E(),x==null||x(!1)}}),[J,L,E,T,a,x]),r.jsxs("div",{className:`nice-signature-pad ${k?"nice-signature-pad--disabled":""} ${j}`,...y,children:[r.jsx("canvas",{ref:W,className:"nice-signature-pad-canvas",style:{width:n,height:c,backgroundColor:M,touchAction:"none"},onPointerDown:z,onPointerMove:N,onPointerUp:P,onPointerCancel:P,onPointerLeave:P}),J&&H&&r.jsx("div",{className:"nice-signature-pad-placeholder",children:H})]})}),uc=e.forwardRef(function({width:n="100%",height:c=300,backgroundColor:s="var(--nice-bg-primary, #ffffff)",strokeColor:a="var(--nice-text-primary, #1f2937)",strokeWidth:i=4,tool:d="pen",lineCap:o="round",opacity:f=1,penPressure:w=!0,haptic:v=!0,maxHistory:k=50,disabled:g=!1,onChange:u,onToolChange:m,className:x="",...R},D){const j=e.useRef(null),y=e.useRef(null),[I,O]=e.useState(!1),[H,W]=e.useState(d),$=e.useRef([]),T=e.useRef(-1),M=e.useRef(null),K=e.useRef(null),J=e.useRef(null);e.useEffect(()=>{W(d)},[d]),e.useEffect(()=>{const h=j.current;if(!h)return;const _=h.getBoundingClientRect(),p=window.devicePixelRatio||1;h.width=_.width*p,h.height=_.height*p;const z=h.getContext("2d",{willReadFrequently:!0});z&&(z.scale(p,p),y.current=z,z.fillStyle=s,z.fillRect(0,0,_.width,_.height),X())},[s]);const X=e.useCallback(()=>{const h=j.current,_=y.current;if(!h||!_)return;const p=h.getBoundingClientRect(),z=_.getImageData(0,0,p.width,p.height);T.current<$.current.length-1&&($.current=$.current.slice(0,T.current+1)),$.current.push({type:"stroke",imageData:z}),$.current.length>k&&$.current.shift(),T.current=$.current.length-1},[k]),Q=e.useCallback(h=>{const _=y.current;if(!_||h<0||h>=$.current.length)return;const p=$.current[h];_.putImageData(p.imageData,0,0)},[]),q=e.useCallback(()=>{if(!(!v||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[v]),F=e.useCallback(h=>{const _=j.current;if(!_)return{x:0,y:0};const p=_.getBoundingClientRect();return{x:h.clientX-p.left,y:h.clientY-p.top,pressure:w?h.pressure:void 0}},[w]),U=e.useCallback(()=>{const h=y.current;h&&(h.lineCap=o,h.lineJoin="round",h.globalAlpha=f,H==="eraser"?(h.globalCompositeOperation="destination-out",h.strokeStyle=ye("var(--nice-overlay-90, rgba(0, 0, 0, 1))",h.canvas),h.lineWidth=i*2):H==="brush"?(h.globalCompositeOperation="source-over",h.strokeStyle=a,h.lineWidth=i):H==="marker"?(h.globalCompositeOperation="multiply",h.strokeStyle=a,h.lineWidth=i*1.5,h.globalAlpha=.5):(h.globalCompositeOperation="source-over",h.strokeStyle=a,h.lineWidth=i))},[H,a,i,o,f]),G=e.useCallback((h,_)=>{const p=y.current;p&&(U(),_.pressure!==void 0&&H!=="eraser"&&(p.lineWidth=i*Math.max(.3,_.pressure)),p.beginPath(),p.moveTo(h.x,h.y),p.lineTo(_.x,_.y),p.stroke())},[U,i,H]),ne=e.useCallback((h,_)=>{const p=y.current;if(!p||!J.current)return;p.putImageData(J.current,0,0),U();const z=_.x-h.x,N=_.y-h.y;if(p.beginPath(),H==="line")p.moveTo(h.x,h.y),p.lineTo(_.x,_.y),p.stroke();else if(H==="rectangle")p.strokeRect(h.x,h.y,z,N);else if(H==="circle"){const P=Math.sqrt(z*z+N*N);p.arc(h.x,h.y,P,0,Math.PI*2),p.stroke()}},[U,H]),te=e.useCallback((h,_,p)=>{const z=j.current,N=y.current;if(!z||!N)return;const P=z.getBoundingClientRect(),l=N.getImageData(0,0,P.width,P.height),b=l.data,C=document.createElement("div");C.style.color=p,document.body.appendChild(C);const S=getComputedStyle(C).color;document.body.removeChild(C);const Z=S.match(/\d+/g);if(!Z)return;const[B,ae,le]=Z.map(Number),se=(Math.floor(_)*P.width+Math.floor(h))*4,re=b[se],ie=b[se+1],oe=b[se+2],Y=b[se+3];if(re===B&&ie===ae&&oe===le)return;const ee=[[Math.floor(h),Math.floor(_)]],ce=new Set;for(;ee.length>0;){const[ue,fe]=ee.pop(),me=(fe*P.width+ue)*4;if(ue<0||ue>=P.width||fe<0||fe>=P.height||ce.has(me))continue;const Oe=b[me],Ve=b[me+1],sn=b[me+2],an=b[me+3],Re=30;Math.abs(Oe-re)>Re||Math.abs(Ve-ie)>Re||Math.abs(sn-oe)>Re||Math.abs(an-Y)>Re||(ce.add(me),b[me]=B,b[me+1]=ae,b[me+2]=le,b[me+3]=255,ee.push([ue+1,fe],[ue-1,fe],[ue,fe+1],[ue,fe-1]))}N.putImageData(l,0,0)},[]),V=e.useCallback(h=>{if(g)return;h.preventDefault(),h.currentTarget.setPointerCapture(h.pointerId);const _=F(h);if(H==="fill"){te(_.x,_.y,a),X(),u==null||u(),q();return}if(O(!0),M.current=_,K.current=_,H==="line"||H==="rectangle"||H==="circle"){const p=j.current,z=y.current;if(p&&z){const N=p.getBoundingClientRect();J.current=z.getImageData(0,0,N.width,N.height)}}else{const p=y.current;p&&(U(),p.beginPath(),p.arc(_.x,_.y,i/2,0,Math.PI*2),p.fill())}q()},[g,F,H,te,a,X,u,q,U,i]),L=e.useCallback(h=>{if(!I||g)return;const _=F(h);H==="line"||H==="rectangle"||H==="circle"?M.current&&ne(M.current,_):K.current&&G(K.current,_),K.current=_},[I,g,F,H,ne,G]),E=e.useCallback(h=>{I&&(h.currentTarget.releasePointerCapture(h.pointerId),O(!1),(H==="line"||H==="rectangle"||H==="circle")&&M.current&&K.current&&ne(M.current,K.current),J.current=null,M.current=null,K.current=null,X(),u==null||u())},[I,H,ne,X,u]);e.useImperativeHandle(D,()=>({clear:()=>{const h=j.current,_=y.current;if(!h||!_)return;const p=h.getBoundingClientRect();_.fillStyle=s,_.globalCompositeOperation="source-over",_.fillRect(0,0,p.width,p.height),X(),u==null||u()},undo:()=>{T.current>0&&(T.current--,Q(T.current),u==null||u())},redo:()=>{T.current<$.current.length-1&&(T.current++,Q(T.current),u==null||u())},canUndo:()=>T.current>0,canRedo:()=>T.current<$.current.length-1,toDataURL:(h="png",_=1)=>{const p=j.current;if(!p)return"";const z=h==="jpeg"?"image/jpeg":"image/png";return p.toDataURL(z,_)},toBlob:(h="png",_=1)=>new Promise(p=>{const z=j.current;if(!z){p(null);return}const N=h==="jpeg"?"image/jpeg":"image/png";z.toBlob(p,N,_)}),fromDataURL:async h=>{const _=j.current,p=y.current;if(!(!_||!p))return new Promise(z=>{const N=new Image;N.onload=()=>{const P=_.getBoundingClientRect();p.drawImage(N,0,0,P.width,P.height),X(),z()},N.src=h})},fill:h=>{const _=j.current,p=y.current;if(!_||!p)return;const z=_.getBoundingClientRect();p.fillStyle=h,p.globalCompositeOperation="source-over",p.fillRect(0,0,z.width,z.height),X(),u==null||u()},getTool:()=>H,setTool:h=>{W(h),m==null||m(h)}}),[s,X,Q,H,m,u]);const A=()=>{switch(H){case"eraser":return"cell";case"fill":return"crosshair";default:return"crosshair"}};return r.jsx("div",{className:`nice-touch-drawing ${g?"nice-touch-drawing--disabled":""} ${x}`,...R,children:r.jsx("canvas",{ref:j,className:"nice-touch-drawing-canvas",style:{width:n,height:c,cursor:A(),touchAction:"none"},onPointerDown:V,onPointerMove:L,onPointerUp:E,onPointerCancel:E,onPointerLeave:E})})}),dc=["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)"],fc={pen:"Pen",brush:"Brush",marker:"Mark",eraser:"Erase",fill:"Fill",line:"Line",rectangle:"Rect",circle:"Circle"};function Xe(t,n,c){const[s,a]=e.useState(n),i=t!==void 0;return[i?t:s,o=>{i||a(o),c==null||c(o)}]}const hc=e.forwardRef(function({tool:n,defaultTool:c="pen",onToolChange:s,color:a,defaultColor:i,onColorChange:d,strokeWidth:o,defaultStrokeWidth:f=4,onStrokeWidthChange:w,onUndo:v,onRedo:k,onClear:g,canUndo:u=!0,canRedo:m=!0,colors:x=dc,className:R="",...D},j){const{t:y}=be.useNiceTranslation(),[I,O]=Xe(n,c,s),[H,W]=Xe(a,i??x[0],d),[$,T]=Xe(o,f,w),M=["pen","brush","marker","eraser","fill","line","rectangle","circle"];return r.jsxs("div",{ref:j,className:`nice-drawing-toolbar ${R}`,...D,children:[r.jsx("div",{className:"nice-drawing-toolbar-section",children:M.map(K=>r.jsx("button",{type:"button",className:`nice-drawing-tool-btn ${I===K?"nice-drawing-tool-btn--active":""}`,onClick:()=>O(K),title:K,"aria-label":K,children:fc[K]},K))}),r.jsx("div",{className:"nice-drawing-toolbar-divider"}),r.jsx("div",{className:"nice-drawing-toolbar-section nice-drawing-colors",children:x.map((K,J)=>r.jsx("button",{type:"button",className:`nice-drawing-color-btn ${H===K?"nice-drawing-color-btn--active":""}`,style:{backgroundColor:K,borderColor:K==="var(--nice-bg-primary, #ffffff)"?"var(--nice-border-color, #e5e7eb)":K},onClick:()=>W(K),title:K},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:K=>T(Number(K.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:[v&&r.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:v,disabled:!u,title:y("touchDrawing.undo","Undo"),children:y("touchDrawing.undo","Undo")}),k&&r.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:k,disabled:!m,title:y("touchDrawing.redo","Redo"),children:y("touchDrawing.redo","Redo")}),g&&r.jsx("button",{type:"button",className:"nice-drawing-action-btn nice-drawing-action-btn--danger",onClick:g,title:y("touchDrawing.clear","Clear"),children:y("touchDrawing.clear","Clear")})]})]})}),Ae={en:{code:"en",name:"English",nativeName:"English",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]]},pl:{code:"pl",name:"Polish",nativeName:"Polski",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],accents:{a:["ą"],c:["ć"],e:["ę"],l:["ł"],n:["ń"],o:["ó"],s:["ś"],z:["ź","ż"]}},de:{code:"de",name:"German",nativeName:"Deutsch",rows:[["q","w","e","r","t","z","u","i","o","p","ü"],["a","s","d","f","g","h","j","k","l","ö","ä"],["y","x","c","v","b","n","m","ß"]],accents:{a:["ä"],o:["ö"],u:["ü"],s:["ß"]}},fr:{code:"fr",name:"French",nativeName:"Français",rows:[["a","z","e","r","t","y","u","i","o","p"],["q","s","d","f","g","h","j","k","l","m"],["w","x","c","v","b","n"]],accents:{a:["à","â","æ"],e:["é","è","ê","ë"],i:["î","ï"],o:["ô","œ"],u:["ù","û","ü"],c:["ç"]}},es:{code:"es",name:"Spanish",nativeName:"Español",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l","ñ"],["z","x","c","v","b","n","m"]],accents:{a:["á"],e:["é"],i:["í"],o:["ó"],u:["ú","ü"],n:["ñ"]}},it:{code:"it",name:"Italian",nativeName:"Italiano",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],accents:{a:["à"],e:["è","é"],i:["ì"],o:["ò"],u:["ù"]}},pt:{code:"pt",name:"Portuguese",nativeName:"Português",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l","ç"],["z","x","c","v","b","n","m"]],accents:{a:["á","ã","â","à"],e:["é","ê"],i:["í"],o:["ó","õ","ô"],u:["ú"],c:["ç"]}},ru:{code:"ru",name:"Russian",nativeName:"Русский",rows:[["й","ц","у","к","е","н","г","ш","щ","з","х","ъ"],["ф","ы","в","а","п","р","о","л","д","ж","э"],["я","ч","с","м","и","т","ь","б","ю"]]},uk:{code:"uk",name:"Ukrainian",nativeName:"Українська",rows:[["й","ц","у","к","е","н","г","ш","щ","з","х","ї"],["ф","і","в","а","п","р","о","л","д","ж","є"],["я","ч","с","м","и","т","ь","б","ю","ґ"]]},cs:{code:"cs",name:"Czech",nativeName:"Čeština",rows:[["q","w","e","r","t","z","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["y","x","c","v","b","n","m"]],accents:{a:["á"],c:["č"],d:["ď"],e:["é","ě"],i:["í"],n:["ň"],o:["ó"],r:["ř"],s:["š"],t:["ť"],u:["ú","ů"],y:["ý"],z:["ž"]}},tr:{code:"tr",name:"Turkish",nativeName:"Türkçe",rows:[["q","w","e","r","t","y","u","ı","o","p","ğ","ü"],["a","s","d","f","g","h","j","k","l","ş","i"],["z","x","c","v","b","n","m","ö","ç"]]},nl:{code:"nl",name:"Dutch",nativeName:"Nederlands",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],accents:{e:["é","ë"],i:["ï"],o:["ö"],u:["ü"]}},sv:{code:"sv",name:"Swedish",nativeName:"Svenska",rows:[["q","w","e","r","t","y","u","i","o","p","å"],["a","s","d","f","g","h","j","k","l","ö","ä"],["z","x","c","v","b","n","m"]]},no:{code:"no",name:"Norwegian",nativeName:"Norsk",rows:[["q","w","e","r","t","y","u","i","o","p","å"],["a","s","d","f","g","h","j","k","l","ø","æ"],["z","x","c","v","b","n","m"]]},da:{code:"da",name:"Danish",nativeName:"Dansk",rows:[["q","w","e","r","t","y","u","i","o","p","å"],["a","s","d","f","g","h","j","k","l","æ","ø"],["z","x","c","v","b","n","m"]]},fi:{code:"fi",name:"Finnish",nativeName:"Suomi",rows:[["q","w","e","r","t","y","u","i","o","p","å"],["a","s","d","f","g","h","j","k","l","ö","ä"],["z","x","c","v","b","n","m"]]},ro:{code:"ro",name:"Romanian",nativeName:"Română",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],accents:{a:["ă","â"],i:["î"],s:["ș"],t:["ț"]}},hr:{code:"hr",name:"Croatian",nativeName:"Hrvatski",rows:[["q","w","e","r","t","z","u","i","o","p","š","đ"],["a","s","d","f","g","h","j","k","l","č","ć"],["y","x","c","v","b","n","m","ž"]]},el:{code:"el",name:"Greek",nativeName:"Ελληνικά",rows:[["ς","ε","ρ","τ","υ","θ","ι","ο","π"],["α","σ","δ","φ","γ","η","ξ","κ","λ"],["ζ","χ","ψ","ω","β","ν","μ"]],accents:{α:["ά"],ε:["έ"],η:["ή"],ι:["ί","ϊ"],ο:["ό"],υ:["ύ","ϋ"],ω:["ώ"]}},hu:{code:"hu",name:"Hungarian",nativeName:"Magyar",rows:[["q","w","e","r","t","z","u","i","o","p","ő","ú"],["a","s","d","f","g","h","j","k","l","é","á"],["y","x","c","v","b","n","m","ö","ü","ó"]],accents:{a:["á"],e:["é"],i:["í"],o:["ó","ö","ő"],u:["ú","ü","ű"]}},sk:{code:"sk",name:"Slovak",nativeName:"Slovenčina",rows:[["q","w","e","r","t","z","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["y","x","c","v","b","n","m"]],accents:{a:["á","ä"],c:["č"],d:["ď"],e:["é"],i:["í"],l:["ĺ","ľ"],n:["ň"],o:["ó","ô"],r:["ŕ"],s:["š"],t:["ť"],u:["ú"],y:["ý"],z:["ž"]}},bg:{code:"bg",name:"Bulgarian",nativeName:"Български",rows:[["я","в","е","р","т","ъ","у","и","о","п","ш","щ"],["а","с","д","ф","г","х","й","к","л"],["з","ь","ц","ж","б","н","м","ч","ю"]]},sr:{code:"sr",name:"Serbian",nativeName:"Српски",rows:[["љ","њ","е","р","т","з","у","и","о","п","ш","ђ"],["а","с","д","ф","г","х","ј","к","л","ч","ћ"],["ж","џ","ц","в","б","н","м"]]},ja:{code:"ja",name:"Japanese (Romaji)",nativeName:"日本語",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]]},ko:{code:"ko",name:"Korean (Romaji)",nativeName:"한국어",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]]},zh:{code:"zh",name:"Chinese (Pinyin)",nativeName:"中文",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]]},ar:{code:"ar",name:"Arabic",nativeName:"العربية",rows:[["ض","ص","ث","ق","ف","غ","ع","ه","خ","ح","ج","د"],["ش","س","ي","ب","ل","ا","ت","ن","م","ك","ط"],["ئ","ء","ؤ","ر","لا","ى","ة","و","ز","ظ"]]},he:{code:"he",name:"Hebrew",nativeName:"עברית",rows:[["/","'","ק","ר","א","ט","ו","ן","ם","פ"],["ש","ד","ג","כ","ע","י","ח","ל","ך","ף"],["ז","ס","ב","ה","נ","מ","צ","ת","ץ"]]}},ge={value:"Backspace",label:"⌫",type:"backspace",width:1.5},De={value:"Enter",label:"⏎",type:"enter",width:1.5},Ce={value:" ",label:"Space",type:"space",width:5},Ie={value:"Shift",label:"⇧",type:"shift",width:1.5},bc={value:"CapsLock",label:"⇪",type:"caps",width:1.75},mc={value:"Tab",label:"⇥",type:"tab",width:1.5},qe=[{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"0"},{value:"-"},{value:"="}],pc=[{value:"!"},{value:"@"},{value:"#"},{value:"$"},{value:"%"},{value:"^"},{value:"&"},{value:"*"},{value:"("},{value:")"}],vc=[{value:"-"},{value:"_"},{value:"="},{value:"+"},{value:"["},{value:"]"},{value:"{"},{value:"}"},ge],gc=[{value:"Esc",label:"Esc",type:"fn",width:1},{value:"F1",label:"F1",type:"fn"},{value:"F2",label:"F2",type:"fn"},{value:"F3",label:"F3",type:"fn"},{value:"F4",label:"F4",type:"fn"},{value:"F5",label:"F5",type:"fn"},{value:"F6",label:"F6",type:"fn"},{value:"F7",label:"F7",type:"fn"},{value:"F8",label:"F8",type:"fn"},{value:"F9",label:"F9",type:"fn"},{value:"F10",label:"F10",type:"fn"},{value:"F11",label:"F11",type:"fn"},{value:"F12",label:"F12",type:"fn"}],Qe=[[{value:"1"},{value:"2"},{value:"3"}],[{value:"4"},{value:"5"},{value:"6"}],[{value:"7"},{value:"8"},{value:"9"}],[{value:".",width:1},{value:"0"},ge]],xc=[[{value:"7"},{value:"8"},{value:"9"},{value:"/",type:"special"}],[{value:"4"},{value:"5"},{value:"6"},{value:"*",type:"special"}],[{value:"1"},{value:"2"},{value:"3"},{value:"-",type:"special"}],[{value:"0",width:2},{value:"."},{value:"+",type:"special"}],[{value:"C",label:"C",type:"fn"},ge,{value:"=",type:"enter",width:2}]],yc=[[{value:"1",label:"1"},{value:"2",label:"2 ABC"},{value:"3",label:"3 DEF"}],[{value:"4",label:"4 GHI"},{value:"5",label:"5 JKL"},{value:"6",label:"6 MNO"}],[{value:"7",label:"7 PQRS"},{value:"8",label:"8 TUV"},{value:"9",label:"9 WXYZ"}],[{value:"*",label:"*"},{value:"0",label:"0 +"},{value:"#",label:"#"}],[{value:"Call",label:"Call",type:"enter",width:1.5},ge]],wc=[[{value:"1"},{value:"2"},{value:"3"}],[{value:"4"},{value:"5"},{value:"6"}],[{value:"7"},{value:"8"},{value:"9"}],[{value:"Clear",label:"C",type:"fn"},{value:"0"},ge]];function Nc(t,n,c,s,a){const i=Ae[t]||Ae.en,[d,o,f]=i.rows;if(n==="minimal")return Qe;if(c){const k=[qe.slice(0,10),pc,vc],g=[{value:"ABC",label:"ABC",type:"fn",width:1.5}];return s&&g.push({value:"Lang",label:"Lang",type:"lang",width:1}),g.push({value:",",width:1}),g.push({...Ce,width:s?3.5:4}),g.push({value:".",width:1}),g.push({...De,...a?{label:a}:{}}),k.push(g),k}if(n==="compact"){const k=[d.map(u=>({value:u})),o.map(u=>({value:u})),[Ie,...f.map(u=>({value:u})),ge]],g=[{value:"123",label:"123",type:"fn",width:1.5}];return s&&g.push({value:"Lang",label:"Lang",type:"lang",width:1}),g.push({value:",",width:1}),g.push({...Ce,width:s?3.5:4}),g.push({value:".",width:1}),g.push({...De,...a?{label:a}:{}}),k.push(g),k}if(n==="standard"){const k=[qe.slice(0,10),d.map(u=>({value:u})),o.map(u=>({value:u})),[Ie,...f.map(u=>({value:u})),ge]],g=[{value:"#+=",label:"#+=",type:"fn",width:1.5}];return s&&g.push({value:"Lang",label:"Lang",type:"lang",width:1}),g.push({value:",",width:1}),g.push({...Ce,width:s?3:4}),g.push({value:".",width:1}),g.push({...De,...a?{label:a}:{}}),k.push(g),k}const w=[gc,[...qe,ge],[mc,...d.map(k=>({value:k}))],[bc,...o.map(k=>({value:k})),{...De,width:1.75,...a?{label:a}:{}}],[{...Ie,width:2.25},...f.map(k=>({value:k})),{...Ie,width:2.25}]],v=[{value:"#+=",label:"#+=",type:"fn",width:1.5}];if(s&&v.push({value:"Lang",label:"Lang",type:"lang",width:1}),v.push({...Ce,width:s?6:7}),v.push({value:",",width:1}),v.push({value:".",width:1}),w.push(v),i.accents){const k=[];for(const[,g]of Object.entries(i.accents))for(const u of g)k.find(m=>m.value===u)||k.push({value:u});k.length>0&&w.push(k)}return w}const Be=e.forwardRef(function({layout:n="qwerty",customLayout:c,mode:s="standard",languages:a,activeLanguage:i,onLanguageChange:d,value:o="",maxLength:f,theme:w="system",haptic:v=!0,sound:k=!1,onKeyPress:g,onChange:u,onSubmit:m,disabled:x=!1,showPreview:R=!1,previewPlaceholder:D,masked:j=!1,showLanguageSwitcher:y,enterLabel:I,className:O="",...H},W){const{t:$}=be.useNiceTranslation(),T=D??$("touchKeyboard.typeHere","Type here..."),M=e.useMemo(()=>a&&a.length>0?a:["en"],[a]),[K,J]=e.useState(M[0]),X=i??K,[Q,q]=e.useState(!1),[F,U]=e.useState(!1),[G,ne]=e.useState(!1),te=y??M.length>1,V=e.useMemo(()=>n==="custom"&&c?c.rows:n!=="qwerty"?{numeric:Qe,numpad:xc,phone:yc,pin:wc}[n]||Qe:Nc(X,s,G,te,I),[n,c,X,s,G,te,I]),L=e.useCallback(()=>{const P=M.indexOf(X),l=M[(P+1)%M.length];J(l),d==null||d(l)},[M,X,d]),E=e.useCallback(()=>{if(!(!v||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[v]),A=e.useCallback(()=>{if(k)try{const P=new(window.AudioContext||window.webkitAudioContext),l=P.createOscillator(),b=P.createGain();l.connect(b),b.connect(P.destination),l.frequency.value=1e3,l.type="sine",b.gain.value=.1,l.start(),l.stop(P.currentTime+.05)}catch{}},[k]),h=e.useCallback(P=>{if(x)return;E(),A();let l=o;switch(P.type){case"backspace":l=o.slice(0,-1);break;case"enter":m==null||m(o);return;case"shift":q(b=>!b);return;case"caps":U(b=>!b);return;case"tab":l=o+" ";break;case"lang":L();return;case"fn":if(P.value==="123"||P.value==="ABC"||P.value==="#+="||P.value==="#+=")ne(b=>!b);else if(P.value==="Clear"||P.value==="C")l="";else{g==null||g(P.value);return}return;case"space":l=o+" ";break;default:{let b=P.value;(Q||F)&&b.length===1&&(b=b.toUpperCase()),l=o+b,Q&&!F&&q(!1)}}f&&l.length>f||(g==null||g(P.value),u==null||u(l))},[x,o,f,Q,F,E,A,g,u,m,L]),_=e.useMemo(()=>j?"•".repeat(o.length):o,[o,j]),p=Q||F,z=w==="system"?"":`nice-touch-keyboard--${w}`,N=Ae[X];return r.jsxs("div",{ref:W,className:["nice-touch-keyboard",`nice-touch-keyboard--${s}`,z,x?"nice-touch-keyboard--disabled":"",O].filter(Boolean).join(" "),"data-layout":n,"data-language":X,dir:X==="ar"||X==="he"?"rtl":void 0,...H,children:[te&&M.length>1&&r.jsx("div",{className:"nice-touch-keyboard-langbar",children:M.map(P=>{const l=Ae[P];return r.jsx("button",{type:"button",className:`nice-touch-keyboard-langbar__btn ${P===X?"nice-touch-keyboard-langbar__btn--active":""}`,onClick:()=>{J(P),d==null||d(P)},disabled:x,children:(l==null?void 0:l.nativeName)??P.toUpperCase()},P)})}),R&&r.jsxs("div",{className:"nice-touch-keyboard-preview",children:[_||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:V.map((P,l)=>r.jsx("div",{className:"nice-touch-keyboard-row",children:P.map((b,C)=>{var ae;const S=b.type==="shift"&&Q||b.type==="caps"&&F||b.type==="lang"||b.value==="123"&&G||b.value==="ABC"&&!G||b.value==="#+="&&G;let Z=b.label||b.value;b.type==="space"&&b.label==="Space"?Z=$("touchKeyboard.space","Space"):b.value==="Call"&&b.label==="Call"?Z=$("touchKeyboard.call","Call"):b.type==="lang"&&b.label==="Lang"&&(Z=$("touchKeyboard.language","Lang")),p&&!b.type&&Z.length===1&&(Z=Z.toUpperCase());const B=!b.type&&b.value.length===1&&((ae=N==null?void 0:N.accents)==null?void 0:ae[b.value.toLowerCase()]);return r.jsx("button",{type:"button",className:["nice-touch-keyboard-key",`nice-touch-keyboard-key--${b.type||"char"}`,S?"nice-touch-keyboard-key--active":"",B?"nice-touch-keyboard-key--has-accent":""].filter(Boolean).join(" "),style:{flex:b.width||1},onClick:()=>h(b),disabled:x,"aria-label":b.type==="backspace"?$("touchKeyboard.backspace","Backspace"):b.type==="enter"?$("touchKeyboard.enter","Enter"):void 0,children:b.icon||Z},C)})},l))}),r.jsxs("div",{className:"nice-touch-keyboard-status",children:[F&&r.jsx("span",{className:"nice-touch-keyboard-status__item",children:$("touchKeyboard.caps","CAPS")}),N&&r.jsx("span",{className:"nice-touch-keyboard-status__item",children:N.nativeName})]})]})}),kc=e.forwardRef(function(n,c){return r.jsx(Be,{ref:c,layout:"pin",masked:!0,maxLength:n.maxLength||6,...n})}),jc=e.forwardRef(function(n,c){return r.jsx(Be,{ref:c,layout:"numpad",...n})}),Tc=e.forwardRef(function(n,c){return r.jsx(Be,{ref:c,layout:"phone",...n})}),Mc=[],Rc=[],kt=6;function Sc({row:t,rowIndex:n,rowKey:c,columns:s,swipeActionsLeft:a=[],swipeActionsRight:i=[],selectable:d,selected:o,onSelect:f,onClick:w,haptic:v,swipeThreshold:k=80}){const[g,u]=e.useState(0),[m,x]=e.useState(!1),R=e.useRef(0),D=e.useRef(0),j=e.useRef(null),y=a.length>0,I=i.length>0,O=e.useCallback(()=>{if(!(!v||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[v]),H=e.useCallback(L=>{!y&&!I||(R.current=L.touches[0].clientX,D.current=L.touches[0].clientX,x(!0))},[y,I]),W=e.useCallback(L=>{D.current=L;const E=D.current-R.current;let A=E;const h=y?k*a.length:0,_=I?k*i.length:0;A>h&&(A=h),A<-_&&(A=-_),!y&&A>0&&(A=E*.2),!I&&A<0&&(A=E*.2),u(A)},[y,I,k,a.length,i.length]),$=e.useCallback(L=>{m&&W(L.touches[0].clientX)},[m,W]),T=e.useCallback(()=>{if(!m)return;x(!1);const L=k*.5;g>L&&y?(u(k*a.length),O()):g<-L&&I?(u(-k*i.length),O()):u(0)},[m,g,k,y,I,a.length,i.length,O]),M=e.useRef(null),K=e.useRef(0),J=e.useRef(!1),X=e.useCallback(L=>{L.pointerType==="touch"||L.button!==0||!y&&!I||(M.current=L.pointerId,R.current=L.clientX,D.current=L.clientX,K.current=L.clientY)},[y,I]),Q=e.useCallback(L=>{var E,A;if(L.pointerId===M.current){if(!m){const h=L.clientX-R.current,_=L.clientY-K.current;if(Math.abs(h)<kt&&Math.abs(_)<kt)return;if(Math.abs(_)>Math.abs(h)){M.current=null;return}(A=(E=L.currentTarget).setPointerCapture)==null||A.call(E,L.pointerId),x(!0)}W(L.clientX)}},[m,W]),q=e.useCallback(L=>{L.pointerId===M.current&&(M.current=null,m&&(J.current=!0,T()))},[m,T]),F=e.useCallback(L=>{O(),L.onAction(t,n),u(0)},[t,n,O]),U=e.useCallback(()=>{if(J.current){J.current=!1;return}Math.abs(g)>10||(d&&f?f():w&&w())},[g,d,f,w]);e.useEffect(()=>{if(g===0)return;const L=E=>{j.current&&!j.current.contains(E.target)&&u(0)};return document.addEventListener("click",L),()=>document.removeEventListener("click",L)},[g]);const G={transform:g?`translateX(${g}px)`:void 0,transition:m?"none":"transform 0.2s ease-out",userSelect:m?"none":void 0},ne=g!==0||m,te=L=>{const E=L==="left"?a:i;if(!E.length||!ne)return null;const A=L==="left"?"var(--nice-color-primary, #3b82f6)":"var(--nice-color-error, #ef4444)";return r.jsx("div",{className:`nice-touch-table-actions nice-touch-table-actions--${L}`,style:{width:k*E.length},children:E.map(h=>r.jsxs("button",{type:"button",className:"nice-touch-table-action",style:{backgroundColor:h.color||A,color:h.textColor||"var(--nice-color-white, #ffffff)",width:k},onClick:_=>{_.stopPropagation(),F(h)},children:[h.icon&&r.jsx("span",{className:"nice-touch-table__action-icon",children:h.icon}),r.jsx("span",{className:"nice-touch-table__action-label",children:h.label})]},h.id))})},V=s.length-1;return r.jsxs("tr",{ref:j,className:`nice-touch-table-row ${o?"nice-touch-table-row--selected":""} ${m?"nice-touch-table-row--swiping":""}`,onTouchStart:H,onTouchMove:$,onTouchEnd:T,onTouchCancel:T,onPointerDown:X,onPointerMove:Q,onPointerUp:q,onPointerCancel:q,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:[te("left"),r.jsx("input",{type:"checkbox",checked:o,onChange:()=>f==null?void 0:f(),onClick:L=>L.stopPropagation()})]}),s.map((L,E)=>{const A=typeof L.accessor=="function"?L.accessor(t):t[L.accessor],h=L.cell?L.cell(A,t,n):A,_=!d&&E===0,p=E===V;return r.jsxs("td",{className:`nice-touch-table-cell ${L.sticky?"nice-touch-table-cell--sticky":""} ${_||p?"nice-touch-table-cell--edge":""}`,style:{width:L.width,minWidth:L.minWidth,textAlign:L.align,...G},children:[_&&te("left"),h,p&&te("right")]},L.id)})]})}const Pc=e.forwardRef(function({data:n=Mc,columns:c=Rc,rowKey:s,swipeActionsLeft:a,swipeActionsRight:i,selectable:d=!1,selectedKeys:o=[],onSelect:f,onRowClick:w,sortState:v,onSort:k,emptyContent:g="No data",loading:u=!1,haptic:m=!0,swipeThreshold:x=80,className:R="",...D},j){const y=e.useCallback(T=>typeof s=="function"?s(T):String(T[s]),[s]),I=e.useCallback(T=>{if(!T.sortable||!k)return;const M=(v==null?void 0:v.columnId)===T.id&&v.direction==="asc"?"desc":"asc";k({columnId:T.id,direction:M})},[v,k]),O=e.useCallback(()=>{f&&(o.length===n.length?f([]):f(n.map(T=>y(T))))},[n,o,f,y]),H=e.useCallback(T=>{if(!f)return;const M=o.includes(T)?o.filter(K=>K!==T):[...o,T];f(M)},[o,f]),W=n.length>0&&o.length===n.length,$=o.length>0&&o.length<n.length;return r.jsxs("div",{ref:j,className:`nice-touch-table-container ${u?"nice-touch-table-container--loading":""} ${R}`,...D,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:W,ref:T=>{T&&(T.indeterminate=$)},onChange:O})}),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:()=>I(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:(v==null?void 0:v.columnId)===T.id&&r.jsx("span",{className:`nice-touch-table__sort-mark nice-touch-table__sort-mark--${v.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:g})}):n.map((T,M)=>{const K=y(T);return r.jsx(Sc,{row:T,rowIndex:M,rowKey:K,columns:c,swipeActionsLeft:a,swipeActionsRight:i,selectable:d,selected:o.includes(K),onSelect:()=>H(K),onClick:()=>w==null?void 0:w(T,M),haptic:m,swipeThreshold:x},K)})})]})}),u&&r.jsx("div",{className:"nice-touch-table-loading",children:r.jsx("div",{className:"nice-touch-table-spinner"})})]})}),cn=e.createContext(null);function at(){const t=e.useContext(cn);if(!t)throw new Error("useTouchForm must be used within NiceTouchForm");return t}function jt(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 Dc=e.forwardRef(function({initialValues:n={},validation:c={},onSubmit:s,onChange:a,onError:i,enableNavigation:d=!0,haptic:o=!0,autoFocus:f=!1,validateOnBlur:w=!0,validateOnChange:v=!1,disabled:k=!1,children:g,className:u="",...m},x){const[R,D]=e.useState(n),[j,y]=e.useState([]),[I,O]=e.useState(new Set),[H,W]=e.useState(!1),$=e.useRef(new Map),T=e.useRef([]),M=e.useRef(null),K=e.useCallback(()=>{if(!(!o||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[o]),J=e.useCallback((E,A)=>{const h=c[E];return h?jt(A,h):null},[c]),X=e.useCallback(()=>{const E=[];for(const[A,h]of Object.entries(c)){const _=jt(R[A],h);_&&E.push({field:A,message:_})}return E},[R,c]),Q=e.useCallback((E,A)=>{if(D(h=>{const _={...h,[E]:A};return a==null||a(_),_}),v){const h=J(E,A);y(_=>{const p=_.filter(z=>z.field!==E);return h?[...p,{field:E,message:h}]:p})}},[a,v,J]),q=e.useCallback(E=>{if(O(A=>new Set([...A,E])),w){const A=J(E,R[E]);y(h=>{const _=h.filter(p=>p.field!==E);return A?[..._,{field:E,message:A}]:_})}},[w,J,R]),F=e.useCallback(E=>{var h;const A=$.current.get(E);A&&((h=A.focus)==null||h.call(A),M.current=E)},[]),U=e.useCallback(()=>{if(!d)return;const E=T.current,A=M.current;if(!A){E.length>0&&F(E[0]);return}const h=E.indexOf(A);h<E.length-1&&(F(E[h+1]),K())},[d,F,K]),G=e.useCallback(()=>{if(!d)return;const E=T.current,A=M.current;if(!A)return;const h=E.indexOf(A);h>0&&(F(E[h-1]),K())},[d,F,K]),ne=e.useCallback((E,A)=>{$.current.set(E,A),A&&!T.current.includes(E)&&T.current.push(E)},[]),te=e.useCallback(E=>{$.current.delete(E),T.current=T.current.filter(A=>A!==E)},[]),V=e.useCallback(async E=>{if(E.preventDefault(),k||H)return;const A=X();if(A.length>0){y(A),i==null||i(A),K();const h=A[0];h&&F(h.field);return}W(!0);try{await(s==null?void 0:s(R)),K()}catch(h){console.error("Form submission error:",h)}finally{W(!1)}},[k,H,X,i,s,R,K,F]);e.useEffect(()=>{f&&T.current.length>0&&setTimeout(()=>F(T.current[0]),100)},[f,F]);const L=e.useMemo(()=>({values:R,errors:j,touched:I,setFieldValue:Q,setFieldTouched:q,focusField:F,focusNext:U,focusPrev:G,registerField:ne,unregisterField:te}),[R,j,I,Q,q,F,U,G,ne,te]);return r.jsx(cn.Provider,{value:L,children:r.jsx("form",{ref:x,className:`nice-touch-form ${k?"nice-touch-form--disabled":""} ${H?"nice-touch-form--submitting":""} ${u}`,onSubmit:V,noValidate:!0,...m,children:g})})}),Cc=e.forwardRef(function({name:n,label:c,type:s="text",placeholder:a,helperText:i,disabled:d=!1,readOnly:o=!1,autoComplete:f,inputMode:w,iconLeft:v,iconRight:k,maxLength:g,onChange:u,required:m,className:x="",...R},D){const j=at(),y=e.useRef(null),[I,O]=e.useState(!1),H=j.values[n]??"",W=j.errors.find(Q=>Q.field===n),T=j.touched.has(n)&&W;e.useEffect(()=>(j.registerField(n,y.current),()=>j.unregisterField(n)),[n,j]);const M=e.useCallback(Q=>{const q=Q.target.value;j.setFieldValue(n,q),u==null||u(q)},[n,j,u]),K=e.useCallback(()=>{O(!0)},[]),J=e.useCallback(()=>{O(!1),j.setFieldTouched(n)},[n,j]),X=e.useCallback(Q=>{Q.key==="Enter"&&(Q.preventDefault(),j.focusNext())},[j]);return r.jsxs("div",{ref:D,className:`nice-touch-field ${I?"nice-touch-field--focused":""} ${T?"nice-touch-field--error":""} ${d?"nice-touch-field--disabled":""} ${x}`,...R,children:[c&&r.jsxs("label",{className:"nice-touch-field-label",htmlFor:`field-${n}`,children:[c,m&&r.jsx("span",{className:"nice-touch-form__required-indicator",children:"*"})]}),r.jsxs("div",{className:"nice-touch-field-input-wrapper",children:[v&&r.jsx("span",{className:"nice-touch-field-icon nice-touch-field-icon--left",children:v}),r.jsx("input",{ref:y,id:`field-${n}`,name:n,type:s,value:H,placeholder:a,disabled:d,readOnly:o,autoComplete:f,inputMode:w,maxLength:g,onChange:M,onFocus:K,onBlur:J,onKeyDown:X,className:"nice-touch-field-input","aria-invalid":T?"true":void 0,"aria-describedby":T?`${n}-error`:i?`${n}-helper`:void 0}),k&&r.jsx("span",{className:"nice-touch-field-icon nice-touch-field-icon--right",children:k})]}),T&&r.jsx("div",{id:`${n}-error`,className:"nice-touch-field-error",role:"alert",children:W.message}),!T&&i&&r.jsx("div",{id:`${n}-helper`,className:"nice-touch-field-helper",children:i})]})}),Ic=e.forwardRef(function({loading:n=!1,disabled:c=!1,fullWidth:s=!0,children:a,className:i="",...d},o){return r.jsx("button",{ref:o,type:"submit",className:`nice-touch-submit ${s?"nice-touch-submit--full-width":""} ${n?"nice-touch-submit--loading":""} ${i}`,disabled:c||n,...d,children:n?r.jsx("span",{className:"nice-touch-submit-spinner"}):a})}),$c=e.forwardRef(function({doneText:n,showDone:c=!0,onDone:s,className:a="",...i},d){const{t:o}=be.useNiceTranslation(),f=n??o("touchForm.done","Done"),w=at(),v=e.useCallback(()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur(),s==null||s()},[s]);return r.jsxs("div",{ref:d,className:`nice-touch-navbar ${a}`,...i,children:[r.jsxs("div",{className:"nice-touch-navbar-arrows",children:[r.jsx("button",{type:"button",onClick:w.focusPrev,"aria-label":o("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:w.focusNext,"aria-label":o("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:v,children:f})]})});exports.DEFAULT_BREAKPOINTS=ze;exports.DotsIndicator=dn;exports.DrawerIcons=An;exports.EmojiIndicator=hn;exports.HAPTIC_PATTERNS=ct;exports.HapticPatternBuilder=Gt;exports.HeaderIcons=sr;exports.HeroHeader=or;exports.IOSHeader=ir;exports.IOSIndicator=bn;exports.LineIndicator=fn;exports.MaterialHeader=lr;exports.MaterialIndicator=mn;exports.NiceBottomSheet=yn;exports.NiceBreakpointProvider=qr;exports.NiceCalculatorKeyboard=jc;exports.NiceConfirmSheet=Un;exports.NiceDateRangePicker=Tr;exports.NiceDrawingToolbar=hc;exports.NiceFAB=sc;exports.NiceGestures=He;exports.NiceHapticsProvider=_r;exports.NiceHide=Wr;exports.NiceImageGallery=kn;exports.NiceInfiniteScroll=Cn;exports.NiceMobileActionSheet=Vn;exports.NiceMobileCalendar=rt;exports.NiceMobileDatePicker=pr;exports.NiceMobileDraggable=Pr;exports.NiceMobileDrawer=_n;exports.NiceMobileHeader=Ye;exports.NiceMobileModal=et;exports.NiceMobilePicker=nt;exports.NiceMobilePullToRefresh=St;exports.NiceMobileTabs=Jn;exports.NiceMobileTimePicker=br;exports.NiceMultiDatePicker=Mr;exports.NicePINKeyboard=kc;exports.NicePhoneKeyboard=Tc;exports.NicePickerColumn=Bt;exports.NicePinchZoom=Sr;exports.NicePullToRefresh=St;exports.NiceShow=Gr;exports.NiceSignaturePad=rn;exports.NiceSwipeActions=pn;exports.NiceSwipeList=vn;exports.NiceSwipeable=Dr;exports.NiceTouchActionSheet=Yt;exports.NiceTouchButton=st;exports.NiceTouchColorPicker=ic;exports.NiceTouchDrawing=uc;exports.NiceTouchField=Cc;exports.NiceTouchForm=Dc;exports.NiceTouchIconButton=cc;exports.NiceTouchKeyboard=Be;exports.NiceTouchMenu=Xn;exports.NiceTouchMenuPopover=At;exports.NiceTouchNavBar=$c;exports.NiceTouchSignaturePad=rn;exports.NiceTouchSlider=ac;exports.NiceTouchSubmit=Ic;exports.NiceTouchTable=Pc;exports.PullToRefreshDefaultIndicator=Rt;exports.SwipeActionPresets=gn;exports.SwipeGroupProvider=Dt;exports.TabIcons=he;exports.TabPresets=Qn;exports.cancelVibration=Yr;exports.colorUtils=lc;exports.createHapticPattern=Ur;exports.createMediaQuery=Jr;exports.generateNumberItems=je;exports.getCurrentBreakpoint=Qt;exports.hapticFeedback=Ar;exports.isMobileDevice=Zr;exports.isTouch=ec;exports.isVibrationSupported=we;exports.responsive=Qr;exports.useBreakpoint=Me;exports.useBreakpointContext=Xr;exports.useButtonHaptic=zr;exports.useCalendar=Ut;exports.useCollapsingHeader=er;exports.useDrawer=Ln;exports.useGestures=Xt;exports.useGesturesContext=Rr;exports.useHaptics=xe;exports.useHapticsContext=Er;exports.useImpactHaptic=Vr;exports.useInfiniteData=In;exports.useInfiniteScroll=Tn;exports.useMediaQuery=Jt;exports.useMobileBreakpoint=Me;exports.useMobileCalendar=vr;exports.useMobileDrawer=En;exports.useMobileHeader=Zn;exports.useMobileMediaQuery=Jt;exports.useMobileModal=Hn;exports.useMobilePicker=fr;exports.useMobilePullToRefresh=Mt;exports.useMobileTabs=Gn;exports.useModal=zn;exports.useNotificationHaptic=Or;exports.usePullToRefresh=Mt;exports.useSelectionHaptic=Br;exports.useSwipeGroup=Ct;exports.useTabs=Wn;exports.useToggleHaptic=Fr;exports.useTouchForm=at;exports.useTouchSlider=Zt;exports.useVirtualList=$n;exports.useWheelPicker=hr;exports.vibrate=Lr;exports.withHaptics=Hr;
|