@smwb/ui-react 2.4.0 → 2.4.1
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/components/clickAwayListener/clickAwayListener.js +19 -14
- package/dist/components/clickAwayListener/clickAwayListener.js.map +1 -1
- package/dist/components/dataDisplay/treeView/treeView.d.ts +5 -2
- package/dist/components/dataDisplay/treeView/treeView.js +78 -75
- package/dist/components/dataDisplay/treeView/treeView.js.map +1 -1
- package/dist/components/feedBack/modal/modal.js +40 -38
- package/dist/components/feedBack/modal/modal.js.map +1 -1
- package/dist/components/inputs/datePicker/datePicker.js +13 -12
- package/dist/components/inputs/datePicker/datePicker.js.map +1 -1
- package/dist/components/inputs/dateTimePicker/dateTimePicker.js +28 -27
- package/dist/components/inputs/dateTimePicker/dateTimePicker.js.map +1 -1
- package/dist/components/inputs/selectField/dropdownMenu.js +7 -6
- package/dist/components/inputs/selectField/dropdownMenu.js.map +1 -1
- package/dist/components/inputs/timePicker/timePicker.js +16 -15
- package/dist/components/inputs/timePicker/timePicker.js.map +1 -1
- package/dist/components/layout/sheet/sheet.js +102 -92
- package/dist/components/layout/sheet/sheet.js.map +1 -1
- package/dist/headless/components/clickAwayListener/clickAwayListener.js +19 -14
- package/dist/headless/components/clickAwayListener/clickAwayListener.js.map +1 -1
- package/dist/headless/components/dataDisplay/treeView/treeView.js +78 -75
- package/dist/headless/components/dataDisplay/treeView/treeView.js.map +1 -1
- package/dist/headless/components/feedBack/modal/modal.js +42 -40
- package/dist/headless/components/feedBack/modal/modal.js.map +1 -1
- package/dist/headless/components/inputs/datePicker/datePicker.js +13 -12
- package/dist/headless/components/inputs/datePicker/datePicker.js.map +1 -1
- package/dist/headless/components/inputs/dateTimePicker/dateTimePicker.js +28 -27
- package/dist/headless/components/inputs/dateTimePicker/dateTimePicker.js.map +1 -1
- package/dist/headless/components/inputs/selectField/dropdownMenu.js +7 -6
- package/dist/headless/components/inputs/selectField/dropdownMenu.js.map +1 -1
- package/dist/headless/components/inputs/timePicker/timePicker.js +16 -15
- package/dist/headless/components/inputs/timePicker/timePicker.js.map +1 -1
- package/dist/headless/components/layout/sheet/sheet.js +95 -85
- package/dist/headless/components/layout/sheet/sheet.js.map +1 -1
- package/dist/headless/utils/overlayLayer.js +11 -0
- package/dist/headless/utils/overlayLayer.js.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/utils/overlayLayer.d.ts +13 -0
- package/dist/utils/overlayLayer.js +11 -0
- package/dist/utils/overlayLayer.js.map +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),fe=require("@floating-ui/react"),s=require("react/jsx-runtime"),y=require("clsx"),vt=require("react-transition-group/Transition"),Re=require("react-dom"),He=require("react-transition-group"),ta=require("react-dropzone"),Xt=require("rifm"),Ps=require("uuid");class sa{constructor(t){this.cbs=[],this._value=t}setValue(t){if(this.value!==t){this._value=t;for(const n of this.cbs)n(t)}}get value(){return this._value}subscribe(t){return this.cbs.push(t),()=>{this.cbs=this.cbs.filter(n=>n!==t)}}}function na(e){const[t,n]=i.useState(e.value);return i.useEffect(()=>(n(e.value),e.subscribe(n)),[e]),t}const _e=typeof window=="undefined"?i.useEffect:i.useLayoutEffect;var zs=(e=>(e.dark="dark",e.light="light",e))(zs||{});const wt="smui-theme",Ve=new sa("light"),aa=()=>{const e=na(Ve),t=i.useRef(!0);_e(()=>{const a=localStorage.getItem(wt);if(t.current)if(t.current=!1,a)Ve.setValue(a),document.documentElement.dataset.theme=a;else{const r=window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark";a!==e&&Ve.setValue(r),localStorage.setItem(wt,r),document.documentElement.dataset.theme=r}},[e]);const n=function(a){if(a.storageArea===localStorage){const r=localStorage.getItem(wt);document.documentElement.dataset.theme=r,Ve.setValue(r)}};return i.useEffect(()=>(window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)),[]),{theme:e,setTheme:a=>{localStorage.setItem(wt,a),Ve.setValue.bind(Ve)(a),document.documentElement.dataset.theme=a}}};function $e({value:e,defaultValue:t,onChange:n}){const a=e!==void 0,[r,c]=i.useState(t),l=a?e:r,o=i.useRef(l);o.current=l;const d=i.useRef(n);d.current=n;const u=i.useCallback(m=>{var h;const f=o.current,b=typeof m=="function"?m(f):m;a||c(b),(h=d.current)==null||h.call(d,b)},[a]);return[l,u]}function dt(e,t="smwb"){const n=i.useId();return e!=null?e:`${t}-${n.replace(/[:]/g,"")}`}const ra='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function ia(e,{active:t,restoreFocus:n=!0,autoFocus:a=!0}){const r=i.useRef(null);i.useEffect(()=>{if(!t)return;const c=e.current;if(!c)return;r.current=document.activeElement;const l=()=>Array.from(c.querySelectorAll(ra)).filter(d=>d.offsetParent!==null||d===document.activeElement);if(a){const d=l()[0];(d!=null?d:c).focus({preventScroll:!0})}const o=d=>{if(d.key!=="Tab")return;const u=l();if(u.length===0){d.preventDefault();return}const m=u[0],f=u[u.length-1],b=document.activeElement;d.shiftKey&&b===m?(d.preventDefault(),f.focus()):!d.shiftKey&&b===f?(d.preventDefault(),m.focus()):c.contains(b)||(d.preventDefault(),m.focus())};return document.addEventListener("keydown",o,!0),()=>{document.removeEventListener("keydown",o,!0),n&&r.current&&r.current.focus({preventScroll:!0})}},[t,a,n,e])}function la({count:e,activeIndex:t,onMove:n,orientation:a="horizontal",loop:r=!0,isDisabled:c}){return i.useCallback(l=>{if(e===0)return;const o=a==="horizontal"||a==="both",d=a==="vertical"||a==="both",u=o&&l.key==="ArrowRight"||d&&l.key==="ArrowDown",m=o&&l.key==="ArrowLeft"||d&&l.key==="ArrowUp";let f=null;if(u?f=t+1:m?f=t-1:l.key==="Home"?f=0:l.key==="End"&&(f=e-1),f===null)return;const b=h=>r?(h+e)%e:Math.max(0,Math.min(e-1,h));if(f=b(f),c){let h=0;const w=u||l.key==="Home"?1:-1;for(;c(f)&&h<e;)f=b(f+w),h+=1;if(c(f))return}l.preventDefault(),n(f)},[e,t,n,a,r,c])}function Kt({itemCount:e,itemHeight:t,viewportHeight:n,overscan:a=4}){const[r,c]=i.useState(0),l=i.useCallback(o=>{c(o.currentTarget.scrollTop)},[]);return i.useMemo(()=>{const o=t>0?t:1,d=Math.ceil(n/o),u=Math.max(0,Math.floor(r/o)-a),m=Math.min(e,u+d+a*2);return{startIndex:u,endIndex:m,totalHeight:e*o,offsetY:u*o,onScroll:l}},[e,t,n,a,r,l])}function Ze(e){if(e==="auto"||e==="auto-start"||e==="auto-end"){const t=e==="auto-start"?"start":e==="auto-end"?"end":null;return{autoMiddleware:fe.autoPlacement({alignment:t})}}return{placement:e}}const us=4,Rt=8;function yt(e,t){return t!=null&&t.length?[...t,fe.flip(),fe.shift({padding:Rt})]:e.autoMiddleware?[fe.offset(us),fe.shift({padding:Rt}),e.autoMiddleware]:[fe.offset(us),fe.flip(),fe.shift({padding:Rt})]}const oa="bottom-start",ca=4,ua=8,da=({x:e,y:t})=>({x:e,y:t,top:t,left:e,right:e,bottom:t,width:0,height:0});function ma(e={}){const{placement:t=oa,offsetPx:n=ca,openDelay:a=0,closeDelay:r=0,middleware:c}=e,[l,o]=i.useState(!1),d=i.useRef({x:0,y:0}),u=i.useRef({x:0,y:0}),m=i.useRef(null),f=i.useRef(null),b=i.useRef(null),h=Ze(t),w=i.useMemo(()=>[fe.offset({mainAxis:n,crossAxis:n}),...h.autoMiddleware?[h.autoMiddleware]:[fe.flip()],fe.shift({padding:ua}),...c!=null?c:[]],[n,h.autoMiddleware,c]),{refs:p,floatingStyles:_,update:v}=fe.useFloating({open:l,placement:h.placement,whileElementsMounted:fe.autoUpdate,middleware:w}),g=i.useMemo(()=>({getBoundingClientRect:()=>da(u.current)}),[]),x=i.useCallback(()=>{f.current!==null&&(clearTimeout(f.current),f.current=null),b.current!==null&&(clearTimeout(b.current),b.current=null)},[]);i.useEffect(()=>()=>x(),[x]),i.useEffect(()=>{var E;l&&(p.setPositionReference((E=m.current)!=null?E:g),v())},[l,p,v,g]);const T=i.useCallback(()=>{m.current===null&&(u.current=d.current)},[]),j=i.useCallback(()=>{x(),T(),o(!0)},[x,T]),S=i.useCallback(()=>{if(x(),a<=0){T(),o(!0);return}f.current=setTimeout(()=>{T(),o(!0)},a)},[x,T,a]),R=i.useCallback(()=>{if(x(),r<=0){o(!1);return}b.current=setTimeout(()=>o(!1),r)},[x,r]),k=i.useCallback(()=>{x(),o(!1)},[x]),N=i.useCallback(E=>{m.current=null,u.current=E},[]),C=i.useCallback(E=>{m.current=E},[]),A=i.useCallback(E=>{d.current={x:E.clientX,y:E.clientY},S()},[S]),M=i.useCallback(E=>{d.current={x:E.clientX,y:E.clientY}},[]),I=i.useCallback(E=>({onPointerEnter:$=>{var B;(B=E==null?void 0:E.onPointerEnter)==null||B.call(E,$),A($)},onPointerMove:$=>{var B;(B=E==null?void 0:E.onPointerMove)==null||B.call(E,$),M($)},onPointerLeave:$=>{var B;(B=E==null?void 0:E.onPointerLeave)==null||B.call(E,$),R()}}),[A,M,R]),z=i.useCallback(()=>{x(),o(!0)},[x]),D=i.useCallback(E=>({ref:p.setFloating,style:{..._,...E==null?void 0:E.style},onPointerEnter:z,onPointerLeave:R}),[p,_,z,R]);return{open:l,getReferenceProps:I,getFloatingProps:D,setAnchorEl:C,setVirtualAnchor:N,openNow:j,scheduleOpen:S,scheduleClose:R,close:k}}const K=i.forwardRef(function({className:t,weight:n=400,fill:a=0,size:r=20,grade:c=100,name:l,color:o="inherit",title:d,...u},m){const f=d===void 0,b=o&&["primary","secondary","error","success","warning","info","disabled"].includes(o)?`smwb-icon_color-${o}`:null;return s.jsx("span",{...u,ref:m,"data-testid":"icon",role:f?void 0:"img","aria-hidden":f?!0:void 0,"aria-label":d,title:d,style:{...u.style,fontVariationSettings:`'FILL' ${a}, 'wght' ${n}, 'GRAD' ${c}, 'opsz' 48`},className:y("smwb-icon__wrapper",b,t),children:s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:typeof r=="number"?`${r}px`:r},children:l})})}),De=i.forwardRef(function({actionRef:t,className:n,classes:a,center:r,style:c,duration:l=600,color:o,...d},u){const[m,f]=i.useState([]),b=i.useRef(0);return i.useImperativeHandle(t,()=>({onRipple(h){const p=h.currentTarget.getBoundingClientRect(),_=Math.max(p.width,p.height),v=_/2;let g,x;r?(g=p.width>p.height?0:p.width/2-v,x=p.height>p.width?0:p.height/2-v):(g=h.clientX-p.left-v,x=h.clientY-p.top-v),f([...m,s.jsx("span",{className:y("smwb-ripple__child",a==null?void 0:a.child),style:{...c,left:g,top:x,width:_,height:_,backgroundColor:o!=null?o:c==null?void 0:c.backgroundColor},...d},b.current)]),b.current+=1,setTimeout(()=>{f(T=>T.slice(1))},l)}}),[d,r,m,a==null?void 0:a.child,c,l,o]),s.jsx("span",{ref:u,className:y("smwb-ripple",n,a==null?void 0:a.ripple),"data-testid":"ripple","aria-hidden":"true",children:m})});function Hs(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function ge(...e){return i.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{Hs(n,t)})},e)}function fa(e){const t=parseFloat(e);return!isNaN(t)&&isFinite(t)}function ds(e){return typeof e=="string"&&e[e.length-1]==="%"&&fa(e.substring(0,e.length-1))}function Ct(e,t){t===0&&(e!=null&&e.style)&&(e.style.display="none")}function ha(e,t){t===0&&(e!=null&&e.style)&&(e.style.display="")}const ba={animating:"rah-animating",animatingUp:"rah-animating--up",animatingDown:"rah-animating--down",animatingToHeightZero:"rah-animating--to-height-zero",animatingToHeightAuto:"rah-animating--to-height-auto",animatingToHeightSpecific:"rah-animating--to-height-specific",static:"rah-static",staticHeightZero:"rah-static--height-zero",staticHeightAuto:"rah-static--height-auto",staticHeightSpecific:"rah-static--height-specific"};function ms(e,t){return y({[e.static]:!0,[e.staticHeightZero]:t===0,[e.staticHeightSpecific]:typeof t=="number"&&t>0,[e.staticHeightAuto]:t==="auto"})}const wa=i.forwardRef(function({animateOpacity:t=!1,animationStateClasses:n={},applyInlineTransitions:a=!0,children:r,className:c="",contentClassName:l,delay:o=0,duration:d=300,easing:u="ease",height:m,onHeightAnimationEnd:f,onHeightAnimationStart:b,style:h,...w},p){const _=i.useRef(m),v=i.useRef(null),g=i.useRef(null),x=ge(p,g),T=i.useRef(),j=i.useRef(),S=i.useRef({...ba,...n}),R=o,k=d;let N=m,C="visible";typeof N=="number"?(N=typeof m!="number"||m<0?0:m,C="hidden"):ds(N)&&(N=m==="0%"?0:m,C="hidden");const[A,M]=i.useState(N),[I,z]=i.useState(C),[D,E]=i.useState(!1),[$,B]=i.useState(ms(S.current,m));i.useEffect(()=>{Ct(v.current,A)},[]),i.useEffect(()=>{if(m!==_.current&&v.current){ha(v.current,_.current),v.current.style.overflow="hidden";const Q=v.current.offsetHeight;v.current.style.overflow="";const se=k+R;let F,O,X="hidden",W;const Z=_.current==="auto";typeof m=="number"?(F=m<0?0:m,O=F):ds(m)?(F=m==="0%"?0:m,O=F):(F=Q,O="auto",X=void 0),Z&&(O=F,F=Q);const ae=y({[S.current.animating]:!0,[S.current.animatingUp]:_.current==="auto"||m<_.current,[S.current.animatingDown]:m==="auto"||m>_.current,[S.current.animatingToHeightZero]:O===0,[S.current.animatingToHeightAuto]:O==="auto",[S.current.animatingToHeightSpecific]:typeof O=="number"&&O>0}),de=ms(S.current,O);M(F),z("hidden"),E(!Z),B(ae),clearTimeout(j.current),clearTimeout(T.current),Z?(W=!0,j.current=setTimeout(()=>{M(O),z(X),E(W),b==null||b(O)},50),T.current=setTimeout(()=>{E(!1),B(de),Ct(v.current,O),f==null||f(O)},se)):(b==null||b(F),j.current=setTimeout(()=>{M(O),z(X),E(!1),B(de),m!=="auto"&&Ct(v.current,F),f==null||f(F)},se))}return _.current=m,()=>{clearTimeout(j.current),clearTimeout(T.current)}},[m]);const U={...h,height:A,overflow:I||(h==null?void 0:h.overflow)};D&&a&&(U.transition=`height ${k}ms ${u} ${R}ms`,h!=null&&h.transition&&(U.transition=`${h.transition}, ${U.transition}`),U.WebkitTransition=U.transition);const te={};t&&(te.transition=`opacity ${k}ms ${u} ${R}ms`,te.WebkitTransition=te.transition,A===0&&(te.opacity=0));const ce=typeof w["aria-hidden"]!="undefined"?w["aria-hidden"]:m===0;return s.jsx("div",{...w,ref:x,"aria-hidden":ce,className:`${$} ${c}`,style:U,children:s.jsx("div",{className:l,style:te,ref:v,children:r})})}),pa=i.forwardRef(function({className:t,title:n,isOpenByDefault:a=!1,open:r,disabled:c,icon:l,id:o,children:d,startAdornment:u,noIcon:m,onToggleClick:f,onChange:b},h){const w=r!==void 0,[p,_]=i.useState(a),v=w?!!r:p,g=dt(o),x=`${g}-content`,T=`${g}-header`,j=y("smwb-accordion__arrow-icon",{"smwb-accordion__arrow-icon_opened":v}),S=R=>{if(c)return;const k=!v;w||_(k),b==null||b(k),f==null||f(R)};return s.jsxs("div",{ref:h,className:y("smwb-accordion",{"smwb-disabled":c},t),"data-testid":"accordion",children:[s.jsxs("button",{id:T,className:"smwb-accordion__header",onClick:S,type:"button",disabled:c,"aria-expanded":v,"aria-controls":d?x:void 0,children:[u==null?void 0:u(v),s.jsx("span",{className:"smwb-accordion__title",children:n}),!m&&(l!=null?l:s.jsx(K,{className:j,name:"expand_more",size:24}))]}),d&&s.jsx("div",{id:x,role:"region","aria-labelledby":T,children:s.jsx(wa,{height:v?"auto":0,animateOpacity:!0,duration:300,className:"smwb-accordion__content",children:d})})]})}),Te=i.forwardRef(function(t,n){const{label:a,variant:r="contained",icon:c,iconProps:l={},href:o,className:d,disabled:u,children:m,onMouseDown:f,fullWidth:b,rippleCenter:h,disableRipple:w,size:p="medium",colorTheme:_="primary",color:v,...g}=t,x=v!=null?v:_,T=i.useRef(null),j=C=>{f==null||f(C)},S=C=>{var A;u||(A=T.current)==null||A.onRipple(C)},R=y("smwb-button",`smwb-${r}`,`smwb-${p}`,x==="primary"?"smwb-primary":`smwb-button_color-${x}`,d,{"smwb-disabled":u,"smwb-full-width":b}),k=!w&&s.jsx(De,{actionRef:T,center:h}),N=typeof c=="string"?s.jsx(K,{...l,name:c}):c;return o?s.jsxs("a",{"data-testid":"button-link",ref:n,className:R,href:o,target:"_blank",rel:"noreferrer",onMouseDown:j,onPointerDown:S,...g,children:[c&&N,a||m,k]}):s.jsxs("button",{"data-testid":"button",ref:n,className:R,onMouseDown:j,onPointerDown:S,disabled:!!u,...g,children:[c&&N,a||m,k]})}),_a={expandRow:"Expand to full row",collapseRow:"Collapse to grid",expandFullscreen:"Expand to fullscreen",closeFullscreen:"Close fullscreen",placeholder:"Panel is open in fullscreen",placeholderClose:"Close"},fs=(e,t)=>typeof e=="function"?e(t):e,ga=(e,t)=>typeof e=="function"?e(t):e,xa=i.forwardRef(function({className:t,header:n,mode:a,defaultMode:r="tile",onModeChange:c,disableExpand:l=!1,noControls:o=!1,renderControls:d,closeOnOutsideClick:u=!0,closeOnEsc:m=!0,labels:f,children:b},h){const[w,p]=$e({value:a,defaultValue:r,onChange:c}),_={..._a,...f},[v,g]=i.useState();_e(()=>{g(document.body)},[]);const x=l?"tile":w,T=x==="row",j=x==="fullscreen",S=()=>p(I=>I==="row"?"tile":"row"),R=()=>p("fullscreen"),k=()=>p("tile"),N=I=>({mode:x,isFullscreen:I,isFullRow:I?!1:T,setMode:p,toggleRow:S,openFullscreen:R,closeFullscreen:k,labels:_}),C=I=>I?s.jsx(Te,{type:"button",variant:"outlined",size:"small","aria-label":_.closeFullscreen,title:_.closeFullscreen,onClick:k,"data-testid":"expansion-panel-close",icon:s.jsx(K,{name:"close",size:18})}):s.jsxs(s.Fragment,{children:[s.jsx(Te,{type:"button",variant:"outlined",size:"small","aria-pressed":T,"aria-label":T?_.collapseRow:_.expandRow,title:T?_.collapseRow:_.expandRow,onClick:S,"data-testid":"expansion-panel-row",icon:s.jsx(K,{name:T?"grid_view":"table_rows",size:18})}),s.jsx(Te,{type:"button",variant:"outlined",size:"small","aria-label":_.expandFullscreen,title:_.expandFullscreen,onClick:R,"data-testid":"expansion-panel-fullscreen",icon:s.jsx(K,{name:"open_in_full",size:18})})]}),A=I=>{if(l||o)return null;const z=d?ga(d,N(I)):C(I);return z?s.jsx("div",{className:"smwb-expansion-panel__controls",children:z}):null};i.useEffect(()=>{if(!j)return;const I=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=I}},[j]),i.useEffect(()=>{if(!j||!m)return;const I=z=>{z.key==="Escape"&&p("tile")};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[j,m,p]);const M=s.jsxs("div",{ref:h,className:y("smwb-expansion-panel",{"smwb-expansion-panel_row":T},t),"data-testid":"expansion-panel",children:[s.jsxs("div",{className:"smwb-expansion-panel__head",children:[s.jsx("div",{className:"smwb-expansion-panel__header",children:n}),A(!1)]}),s.jsx("div",{className:"smwb-expansion-panel__body",children:fs(b,{mode:x,isFullscreen:!1,isFullRow:T})})]});return!j||!v?M:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"smwb-expansion-panel__placeholder","data-testid":"expansion-panel-placeholder",children:[s.jsx("span",{children:_.placeholder}),s.jsx(Te,{type:"button",variant:"outlined",size:"small",label:_.placeholderClose,onClick:()=>p("tile")})]}),Re.createPortal(s.jsx("div",{className:"smwb-expansion-panel__overlay smwb-dark",role:"dialog","aria-modal":"true","data-testid":"expansion-panel-overlay",onClick:u?I=>{I.target===I.currentTarget&&p("tile")}:void 0,children:s.jsxs("div",{className:"smwb-expansion-panel__dialog",children:[s.jsxs("div",{className:"smwb-expansion-panel__head",children:[s.jsx("div",{className:"smwb-expansion-panel__header",children:n}),A(!0)]}),s.jsx("div",{className:"smwb-expansion-panel__body smwb-expansion-panel__body_fullscreen",children:fs(b,{mode:x,isFullscreen:!0,isFullRow:!1})})]})}),v)]})});function Ue({className:e,children:t,disabled:n,edge:a,color:r="default",onMouseDown:c,...l}){const o=i.useRef(null),d=m=>{c==null||c(m)},u=m=>{var f;n||(f=o.current)==null||f.onRipple(m)};return s.jsxs("button",{type:"button",className:y("smwb-chat-icon-button",a==="start"&&"smwb-chat-icon-button_edge-start",a==="end"&&"smwb-chat-icon-button_edge-end",r==="primary"&&"smwb-chat-icon-button_primary",n&&"smwb-chat-icon-button_disabled",e),disabled:n,onMouseDown:d,onPointerDown:u,...l,children:[t,n?null:s.jsx(De,{actionRef:o,center:!0})]})}const Vs=i.forwardRef(function({children:t,className:n,onMouseDown:a,variant:r="default",size:c="medium",color:l="primary",type:o="button",...d},u){const m=i.useRef(null),f=h=>{a==null||a(h)},b=h=>{var w;(w=m.current)==null||w.onRipple(h)};return s.jsxs("button",{ref:u,type:o,className:y("smwb-fab",`smwb-${r}`,`smwb-${c}`,`smwb-fab_color-${l}`,n),onMouseDown:f,onPointerDown:b,...d,children:[t,s.jsx(De,{actionRef:m})]})});function hs(e){return e!=null&&!(Array.isArray(e)&&e.length===0)}function va(e){return e&&(hs(e.value)&&e.value!==""||hs(e.defaultValue)&&e.defaultValue!=="")}function Lt({position:e,variant:t,children:n,className:a,disablePointerEvents:r,inline:c}){const l=y("smwb-text-field__adornment",a,e==="start"&&"smwb-text-field__adornment--start",e==="end"&&"smwb-text-field__adornment--end",r&&"smwb-text-field__adornment--disable-pointer",!c&&t==="filled"&&"smwb-text-field__adornment--filled",typeof n=="string"&&"smwb-text-field__adornment--text");return s.jsx("span",{className:l,children:n})}function Le({label:e,helperText:t=s.jsx(s.Fragment,{children:" "}),variant:n,disabled:a,className:r,error:c,fullWidth:l,isFilledState:o,isFocused:d,htmlFor:u,shrink:m,children:f,onHolderMouseDown:b,startAdornment:h,endAdornment:w,inline:p,..._}){const v=n==="filled",g=e&&(o||d||m),x=y(r,"smwb-text-field",{"smwb-text-field--filled":!p&&v,"smwb-text-field--inline":p,"smwb-text-field--focused":!p&&d,"smwb-text-field--error":c,"smwb-text-field--disabled":a,"smwb-text-field--full-width":l}),T=y("smwb-text-field__label",{"smwb-text-field__label--shrink":g}),j=y("smwb-text-field__notched",{"smwb-text-field__notched--with-label":e,"smwb-text-field__notched--active":g});return s.jsxs("div",{className:x,..._,"data-testid":"text-field",children:[!p&&e&&s.jsx("label",{className:T,htmlFor:u||"",children:e}),s.jsxs("div",{className:"smwb-text-field__input-holder",onMouseDown:b,children:[h&&s.jsx(Lt,{variant:n,inline:!!p,position:"start",children:h}),f,w&&s.jsx(Lt,{position:"end",children:w}),!p&&n==="outlined"&&s.jsx("fieldset",{className:j,children:s.jsx("legend",{children:e?s.jsx("span",{children:e}):s.jsx("span",{className:"smwb-notranslate",children:""})})})]}),!p&&t&&s.jsx("p",{className:"smwb-text-field__helper-line",children:s.jsx("span",{className:"smwb-text-field__helper-text",children:t})})]})}const Be=i.forwardRef(function(t,n){const{label:a,helperText:r,variant:c="outlined",size:l="medium",required:o,className:d,disabled:u,value:m,defaultValue:f,onChange:b,onFocus:h,onBlur:w,error:p,name:_,type:v="text",readOnly:g,placeholder:x,fullWidth:T,id:j,startAdornment:S,endAdornment:R,inline:k,autoComplete:N,inputMode:C,...A}=t,[M,I]=i.useState(!1),[z,D]=i.useState(!1),{current:E}=i.useRef(m!=null),$=i.useRef(null),B=ge(n,$),U=F=>{if(u){F.stopPropagation();return}h==null||h(F),I(!0)},te=F=>{if(!E){const O=F.target||$.current;G({value:O.value})}w==null||w(F,t),I(!1)},G=i.useCallback(F=>{const O=!!va(F);D(X=>X===O?X:O)},[]),ce=F=>{if(!E){const O=F.target||$.current;G({value:O.value})}b==null||b(F,t)},Q=F=>{$.current&&F.currentTarget===F.target&&(F.preventDefault(),$.current.focus())};i.useEffect(()=>{u&&M&&I(!1)},[u,M]),i.useEffect(()=>{E||G($.current)}),_e(()=>{E&&G({value:m})},[m,E,G]);const se=y("smwb-text-field__input",(!a||k)&&"smwb-text-field__input--show-placeholder",S&&"smwb-text-field__input--adornment-start",R&&"smwb-text-field__input--adornment-end",k&&"smwb-text-field__input--inline");return s.jsx(Le,{label:a,helperText:r,variant:c,disabled:u,className:y(d,l!=="medium"&&`smwb-text-field_size-${l}`),error:p,fullWidth:T,isFilledState:z,isFocused:M,htmlFor:j,shrink:!!S,onHolderMouseDown:Q,startAdornment:S,endAdornment:R,inline:k,...A,children:s.jsx("input",{type:v,defaultValue:f,name:_,readOnly:g,required:o,"aria-invalid":p||void 0,"aria-required":o||void 0,placeholder:x,disabled:u,value:m,className:se,ref:B,onChange:ce,onFocus:U,onBlur:te,id:j,autoComplete:N,inputMode:C})})}),Ys=["pending","sent","delivered","read"],Xs={pending:"progress_activity",sent:"check",delivered:"done_all",read:"done_all"},Ks={pending:"В обработке",sent:"Отправлено",delivered:"Доставлено",read:"Прочитано"},Wt=["floating","fullHeight","fullscreen"],Ws=10;function Ut(e){return Ys.includes(e)}function Us(e,t){const n=t==null?void 0:t[e];if(n)return n;if(Ut(e))return Xs[e]}function Gs(e){return Ut(e)?Ks[e]:String(e)}function qs(e){var t;return(t=e.mimeType)!=null&&t.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name)}function Zs(e){if(!e)return"";const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?String(e):new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(t)}function Gt(e){return e==null?["floating"]:e.length===0?[]:Wt.filter(t=>e.includes(t))}function bs(e,t){var n;return t&&t!=="closed"&&e.includes(t)?t:(n=e[0])!=null?n:"floating"}function Js(e,t){return Gt(e).filter(n=>n!=="closed"&&n!==t)}function ya(e){return e.showCloseButton===!1?!1:e.showCloseButton===!0||e.overlayContext&&e.floatingTrigger&&!e.embedded&&(e.effectiveLayout==="floating"||e.effectiveLayout==="fullHeight")?!0:!!(e.floatingTrigger&&!e.embedded&&e.effectiveLayout==="floating")}function Qs(e,t={}){if(e.key!=="Enter")return!1;const{shiftEnterNewline:n=!0,ctrlEnterNewline:a=!0}=t,r=e.ctrlKey||e.metaKey;return!!(n&&e.shiftKey&&!r||a&&r&&!e.shiftKey)}function St(e){e.stopPropagation()}function ja(e,t,n){var l,o;const a=(l=e.selectionStart)!=null?l:t.length,r=(o=e.selectionEnd)!=null?o:t.length,c=`${t.slice(0,a)}
|
|
2
|
-
${t.slice(r)}`;n(c),requestAnimationFrame(()=>{e.selectionStart=a+1,e.selectionEnd=a+1})}function en({className:e,onSendMessage:t,placeholder:n="message",disabled:a=!1,sendAriaLabel:r="Send message",shiftEnterNewline:c=!0,ctrlEnterNewline:l=!0,fileUpload:o=!1,attachInputId:d,onAttachClick:u,attachAriaLabel:m="Attach file"}){const[f,b]=i.useState(""),[h,w]=i.useState(!1),p=i.useId(),_=i.useRef(null),v=c||l,g=!!t&&f.trim().length>0&&!a,x=o&&!!(d||u),T=()=>{if(!t)return;const C=f.trim();!C||a||(t(C),b(""))},j=C=>{if(Qs(C,{shiftEnterNewline:c,ctrlEnterNewline:l})){C.currentTarget instanceof HTMLTextAreaElement&&(C.preventDefault(),ja(C.currentTarget,f,b));return}C.key==="Enter"&&(C.preventDefault(),T())},S=y("smwb-chat-icon-button","smwb-chat-icon-button_edge-start",a&&"smwb-chat-icon-button_disabled"),R=x?d?s.jsx("label",{htmlFor:a?void 0:d,className:S,"aria-label":m,"aria-disabled":a||void 0,"data-testid":"chat-composer-attach",onMouseDown:St,children:s.jsx(K,{name:"attach_file",size:24})}):s.jsx(Ue,{edge:"start","aria-label":m,"data-testid":"chat-composer-attach",disabled:a,onClick:u,onMouseDown:St,children:s.jsx(K,{name:"attach_file",size:24})}):null,k=t?s.jsx(Ue,{edge:"end",color:"primary","aria-label":r,"data-testid":"chat-composer-send",disabled:!g,onClick:T,onMouseDown:St,children:s.jsx(K,{name:"send",size:24})}):null;if(x&&!t)return s.jsx("div",{className:y("smwb-chat-composer","smwb-chat-composer_attach-only",e),"data-testid":"chat-composer",children:R});if(!v)return s.jsx(Be,{className:y("smwb-chat-composer",e),"data-testid":"chat-composer",fullWidth:!0,value:f,disabled:a,placeholder:n,onChange:C=>b(C.target.value),startAdornment:R,endAdornment:k,onKeyDown:j});const N=C=>{_.current&&C.currentTarget===C.target&&(C.preventDefault(),_.current.focus())};return s.jsx(Le,{className:y("smwb-chat-composer",e),"data-testid":"chat-composer",fullWidth:!0,disabled:a,isFilledState:f.length>0,isFocused:h,htmlFor:p,shrink:!!R,onHolderMouseDown:N,startAdornment:R,endAdornment:k,children:s.jsx("textarea",{id:p,ref:_,className:y("smwb-text-field__input","smwb-chat-composer__input","smwb-text-field__input--show-placeholder",R&&"smwb-text-field__input--adornment-start",k&&"smwb-text-field__input--adornment-end"),value:f,disabled:a,placeholder:n,rows:1,onChange:C=>b(C.target.value),onFocus:()=>w(!0),onBlur:()=>w(!1),onKeyDown:j})})}const ka={floating:"picture_in_picture",fullHeight:"fit_screen",fullscreen:"open_in_full"},Na={floating:"Floating window",fullHeight:"Full height",fullscreen:"Fullscreen"};function tn({className:e,title:t,subtitle:n,actions:a,layout:r,allowedLayouts:c=["floating"],onLayoutChange:l,onClose:o}){const d=Js(c,r),u=!!l&&d.length>0;return s.jsxs("div",{className:y("smwb-chat-header",e),"data-testid":"chat-header",children:[s.jsxs("div",{className:"smwb-chat-header__main",children:[t?s.jsx("div",{className:"smwb-chat-header__title",children:t}):null,n?s.jsx("div",{className:"smwb-chat-header__subtitle",children:n}):null]}),s.jsxs("div",{className:"smwb-chat-header__actions",children:[a,u?d.map(m=>s.jsx(Ue,{"aria-pressed":r===m,"aria-label":Na[m],"data-testid":`chat-layout-${m}`,onClick:()=>l==null?void 0:l(m),children:s.jsx(K,{name:ka[m],size:18})},m)):null,o?s.jsx(Ue,{"aria-label":"Close chat","data-testid":"chat-close",onClick:o,children:s.jsx(K,{name:"close",size:18})}):null]})]})}const Ra={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",caption:"span",overline:"span",button:"span"},Ge=i.forwardRef(function({variant:t="body1",color:n="inherit",align:a,gutterBottom:r,noWrap:c,component:l,className:o,children:d,...u},m){const f=l!=null?l:Ra[t];return s.jsx(f,{ref:m,className:y("smwb-typography",`smwb-typography_${t}`,n!=="inherit"&&`smwb-typography_color-${n}`,a&&`smwb-typography_align-${a}`,{"smwb-typography_gutter":r,"smwb-typography_nowrap":c},o),...u,children:d})});function sn({attachment:e,className:t}){const[n,a]=i.useState(!1),[r,c]=i.useState(),l=i.useRef(null);return _e(()=>{c(document.body)},[]),e.url?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:y("smwb-chat-attachment-image",t),onClick:()=>a(!0),"data-testid":"chat-attachment-image","aria-label":e.name,children:s.jsx("img",{src:e.url,alt:e.name,className:"smwb-chat-attachment-image__img"})}),r?Re.createPortal(s.jsx(He.CSSTransition,{in:n,timeout:150,mountOnEnter:!0,unmountOnExit:!0,nodeRef:l,classNames:{enterActive:"smwb-chat-attachment-image__overlay_enter-active",enterDone:"smwb-chat-attachment-image__overlay_enter-done"},children:s.jsx("div",{ref:l,className:"smwb-chat-attachment-image__overlay smwb-dark",role:"dialog","aria-modal":"true","aria-label":e.name,"data-testid":"chat-attachment-image-overlay",onClick:()=>a(!1),children:s.jsx("img",{src:e.url,alt:e.name,className:"smwb-chat-attachment-image__overlay-img",onClick:o=>o.stopPropagation()})})}),r):null]}):null}function nn({attachments:e,className:t,enabled:n=!0}){return!n||!(e!=null&&e.length)?null:s.jsx("div",{className:y("smwb-chat-attachments",t),"data-testid":"chat-attachments",children:e.map(a=>qs(a)?s.jsx(sn,{attachment:a},a.id):s.jsx("a",{className:"smwb-chat-attachments__file",href:a.url,download:a.name,target:"_blank",rel:"noreferrer","data-testid":"chat-attachment-file",children:a.name},a.id))})}const ws=e=>typeof e=="string",qt=i.forwardRef(function({className:t,src:n,alt:a,size:r="medium",variant:c="circular",color:l,style:o,imgProps:d,children:u,...m},f){const[b,h]=i.useState(!1),w=!!n&&!b,p=y("smwb-avatar",`smwb-avatar_${c}`,ws(r)?`smwb-avatar_${r}`:null,t),_={...o,...ws(r)?{}:{width:r,height:r,fontSize:r/2.5},...l&&!w?{backgroundColor:l}:{}};return s.jsx("div",{ref:f,...m,"data-testid":"avatar",className:p,style:_,children:w?s.jsx("img",{...d,className:y("smwb-avatar__img",d==null?void 0:d.className),src:n,alt:a,onError:v=>{var g;h(!0),(g=d==null?void 0:d.onError)==null||g.call(d,v)}}):s.jsx("span",{className:"smwb-avatar__fallback",role:"img","aria-label":a,children:u})})}),Ca=i.forwardRef(function({className:t,max:n=5,total:a,onSurplusClick:r,children:c,...l},o){const d=i.Children.toArray(c).filter(i.isValidElement),u=a!=null?a:d.length,m=Math.max(n,1),f=d.slice(0,m),b=u-f.length;return s.jsxs("div",{ref:o,...l,"data-testid":"avatar-group",className:y("smwb-avatar-group",t),children:[b>0?s.jsx(qt,{className:"smwb-avatar-group__surplus",onClick:r,style:r?{cursor:"pointer"}:void 0,children:`+${b}`}):null,f]})});function Bt({author:e,enabled:t=!0,className:n}){var a,r;return t?s.jsx("div",{className:y("smwb-chat-message__avatar",n),"data-testid":"chat-message-avatar",children:s.jsx(qt,{src:e==null?void 0:e.avatarSrc,alt:(a=e==null?void 0:e.avatarAlt)!=null?a:e==null?void 0:e.name,size:"small",children:(r=e==null?void 0:e.name)==null?void 0:r.slice(0,1)})}):null}function an({className:e,message:t,status:n,statusIcons:a,renderStatus:r}){if(r){const d=r({message:t,status:n});if(d!=null)return s.jsx("span",{className:y("smwb-chat-message__status",`smwb-chat-message__status_${n}`,e),"data-testid":"chat-message-status",children:d})}const c=Us(n,a);if(!c)return null;const l=Gs(n),o=n==="read";return s.jsx("span",{className:y("smwb-chat-message__status",`smwb-chat-message__status_${n}`,e),"data-testid":"chat-message-status","aria-label":l,title:l,children:s.jsx(K,{name:c,size:14,fill:o?1:0})})}function Zt({className:e,align:t,message:n,author:a,text:r,attachments:c,timestamp:l,status:o,showAvatars:d=!1,showAttachments:u=!1,showStatus:m=!1,statusIcons:f,renderStatus:b,bubbleClassName:h}){const w=Zs(l),p=o!=null?o:n.status,_=m&&t==="end"&&p;return s.jsxs("div",{className:y("smwb-chat-message",`smwb-chat-message_${t}`,e),"data-testid":`chat-message-${t}`,children:[t==="start"?s.jsx(Bt,{author:a,enabled:d}):null,s.jsxs("div",{className:"smwb-chat-message__content",children:[a!=null&&a.name?s.jsx(Ge,{variant:"caption",className:"smwb-chat-message__author",children:a.name}):null,s.jsxs("div",{className:y("smwb-chat-message__bubble",h),children:[r?s.jsx("div",{className:"smwb-chat-message__text",children:r}):null,s.jsx(nn,{attachments:c,enabled:u})]}),w||_?s.jsxs("div",{className:"smwb-chat-message__meta","data-testid":"chat-message-meta",children:[w?s.jsx(Ge,{variant:"caption",className:"smwb-chat-message__time",children:w}):null,_?s.jsx(an,{message:n,status:p,statusIcons:f,renderStatus:b}):null]}):null]}),t==="end"?s.jsx(Bt,{author:a,enabled:d}):null]})}function rn({message:e,showAvatars:t,showAttachments:n,className:a}){return s.jsx(Zt,{className:a,align:"start",message:e,author:e.author,text:e.text,attachments:e.attachments,timestamp:e.timestamp,showAvatars:t,showAttachments:n,bubbleClassName:"smwb-chat-message__bubble_incoming"})}function ln({message:e,showAvatars:t,showAttachments:n,showStatus:a,statusIcons:r,renderStatus:c,className:l}){return s.jsx(Zt,{className:l,align:"end",message:e,author:e.author,text:e.text,attachments:e.attachments,timestamp:e.timestamp,status:e.status,showAvatars:t,showAttachments:n,showStatus:a,statusIcons:r,renderStatus:c,bubbleClassName:"smwb-chat-message__bubble_outgoing"})}function on({message:e,className:t}){var a;const n=(a=e.content)!=null?a:e.text;return n?s.jsx("div",{className:y("smwb-chat-message-system",t),"data-testid":"chat-message-system",children:s.jsx(Ge,{variant:"caption",children:n})}):null}function cn({message:e,showAvatars:t,showAttachments:n,showStatus:a,statusIcons:r,renderStatus:c,className:l,renderMessage:o}){var u;const d={showAvatars:t,showAttachments:n,showStatus:a,statusIcons:r,renderStatus:c};if(o)return s.jsx("div",{className:y("smwb-chat-message-item",l),children:o(e,d)});switch(e.variant){case"outgoing":return s.jsx(ln,{message:e,showAvatars:t,showAttachments:n,showStatus:a,statusIcons:r,renderStatus:c,className:l});case"system":return s.jsx(on,{message:e,className:l});case"custom":return s.jsx("div",{className:y("smwb-chat-message-item","smwb-chat-message-item_custom",l),"data-testid":"chat-message-custom",children:(u=e.content)!=null?u:e.text});case"incoming":default:return s.jsx(rn,{message:e,showAvatars:t,showAttachments:n,className:l})}}const ps=e=>typeof e=="number"?`${e}px`:e,rt=i.forwardRef(function({className:t,variant:n="text",width:a,height:r,animation:c="pulse",count:l=1,animationDelay:o,component:d="span",style:u,...m},f){const b=y("smwb-skeleton",`smwb-skeleton_${n}`,c===!1?"smwb-skeleton_no-animation":`smwb-skeleton_${c}`,t),h=d,w=p=>{const _={...u,width:ps(a),height:ps(r),...o?{animationDelay:`${p*o}ms`}:{}};return s.jsx(h,{ref:l===1?f:void 0,...l===1?m:{},"data-testid":"skeleton","aria-hidden":"true",className:b,style:_},p)};return l===1?w(0):s.jsx("span",{ref:f,...m,className:"smwb-skeleton__group","aria-hidden":"true",children:Array.from({length:l},(p,_)=>w(_))})});function un({className:e,align:t="start",showAvatar:n=!1,lines:a=2}){const r=t==="start"?"72%":"64%";return s.jsxs("div",{className:y("smwb-chat-message",`smwb-chat-message_${t}`,"smwb-chat-message-skeleton",e),"data-testid":"chat-message-skeleton","aria-hidden":"true",children:[t==="start"&&n?s.jsx(rt,{variant:"circular",width:32,height:32}):null,s.jsx("div",{className:"smwb-chat-message__content",children:s.jsxs("div",{className:"smwb-chat-message-skeleton__bubble",children:[s.jsx(rt,{variant:"rounded",width:r,height:14}),a>1?s.jsx(rt,{variant:"rounded",width:"48%",height:14}):null]})}),t==="end"&&n?s.jsx(rt,{variant:"circular",width:32,height:32}):null]})}function dn({containerRef:e,onLoadMore:t,hasMore:n=!1,loading:a=!1,rootMargin:r="80px"}){const c=i.useRef(null),l=i.useRef(a);return l.current=a,i.useEffect(()=>{const o=e.current,d=c.current;if(!o||!d||!n||!t||typeof IntersectionObserver=="undefined")return;const u=new IntersectionObserver(m=>{m.some(f=>f.isIntersecting)&&!l.current&&t()},{root:o,rootMargin:r,threshold:0});return u.observe(d),()=>u.disconnect()},[e,n,t,r]),{sentinelRef:c}}function mn(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function Ot(e){e.scrollTop=e.scrollHeight}function fn({containerRef:e,messages:t,threshold:n=24}){const a=i.useRef(!0),r=i.useRef(0),c=i.useRef(),l=i.useRef();i.useEffect(()=>{const o=e.current;if(!o)return;const d=()=>{a.current=mn(o,n)};return d(),o.addEventListener("scroll",d,{passive:!0}),()=>o.removeEventListener("scroll",d)},[e,n]),_e(()=>{var h,w;const o=e.current;if(!o)return;const d=r.current,u=c.current,m=l.current,f=(h=t[0])==null?void 0:h.id,b=(w=t[t.length-1])==null?void 0:w.id;if(u===void 0)Ot(o),a.current=!0;else{const p=f!==void 0&&f!==u&&b===m,_=b!==void 0&&b!==m;p&&d>0?o.scrollTop+=o.scrollHeight-d:_&&a.current&&Ot(o)}r.current=o.scrollHeight,c.current=f,l.current=b},[e,t])}function hn({className:e,messages:t,showAvatars:n,showAttachments:a,showStatus:r,statusIcons:c,renderStatus:l,onLoadMore:o,hasMore:d=!1,loading:u=!1,loadingMore:m=!1,loadingSkeletonCount:f=3,renderMessage:b}){const h=i.useRef(null),{sentinelRef:w}=dn({containerRef:h,onLoadMore:o,hasMore:d,loading:m||u});fn({containerRef:h,messages:t});const p=u||m,_=v=>v%2===0?"start":"end";return s.jsxs("div",{ref:h,className:y("smwb-chat-messages",e),"data-testid":"chat-messages",children:[s.jsx("div",{ref:w,className:"smwb-chat-messages__sentinel","data-testid":"chat-messages-sentinel"}),p?s.jsx("div",{className:"smwb-chat-messages__skeletons","data-testid":"chat-messages-skeletons","aria-busy":"true","aria-label":"Loading messages",children:Array.from({length:f},(v,g)=>s.jsx(un,{align:_(g),showAvatar:n,lines:g%2===0?2:1},g))}):null,u?null:t.map(v=>s.jsx(cn,{message:v,showAvatars:n,showAttachments:a,showStatus:r,statusIcons:c,renderStatus:l,renderMessage:b},v.id))]})}function bn({className:e,layout:t,anchor:n="bottom-right",themeMode:a="inherit",embedded:r=!1,overlayContext:c=!1,header:l,footer:o,children:d,fileDropzoneRootProps:u,fileDropzoneActive:m=!1}){const[f,b]=i.useState();if(_e(()=>{b(document.body)},[]),i.useEffect(()=>{if(t!=="fullscreen")return;const _=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=_}},[t]),t==="closed")return null;const{className:h,...w}=u!=null?u:{},p=s.jsxs("div",{...w,className:y("smwb-chat-shell",`smwb-chat-shell_${t}`,!r&&`smwb-chat-shell_${n}`,{"smwb-dark":a==="dark","smwb-chat-shell_embedded":r,"smwb-chat-shell_overlay-context":c,"smwb-chat-dropzone_active":m},h,e),"data-testid":"chat-shell","data-layout":t,children:[l?s.jsx("div",{className:"smwb-chat-shell__header",children:l}):null,s.jsx("div",{className:"smwb-chat-shell__body",children:d}),o?s.jsx("div",{className:"smwb-chat-shell__footer",children:o}):null]});return t==="fullscreen"&&f?Re.createPortal(p,f):p}function wn(e){return e==null?Ws:Math.max(1,e)}function pn({enabled:e=!1,accept:t,maxFiles:n,onUploadFiles:a,disabled:r=!1}){const c=wn(n),l=e&&!!a&&!r,{getRootProps:o,getInputProps:d,open:u,isDragActive:m,inputRef:f}=ta.useDropzone({accept:t,maxFiles:c,multiple:c>1,disabled:!l,noClick:!0,noKeyboard:!0,useFsAccessApi:!1,onDropAccepted:h=>{a&&a(h)}});return{enabled:l,maxFiles:c,getRootProps:o,getInputProps:d,open:()=>{u==null||u()},inputRef:f,isDragActive:m}}function Pt({className:e,messages:t,showAvatars:n=!1,showAttachments:a=!1,headerTitle:r,headerSubtitle:c,headerActions:l,footer:o,children:d,anchor:u="bottom-right",themeMode:m="inherit",allowedLayouts:f,layout:b,defaultLayout:h,onLayoutChange:w,open:p,defaultOpen:_=!1,onOpenChange:v,floatingTrigger:g=!1,triggerIcon:x,triggerLabel:T,onLoadMore:j,hasMore:S,onSendMessage:R,composerPlaceholder:k="message",composerDisabled:N,composerShiftEnterNewline:C=!0,composerCtrlEnterNewline:A=!0,fileUpload:M=!1,onUploadFiles:I,fileUploadAccept:z,fileUploadMaxFiles:D,attachAriaLabel:E,loading:$,loadingMore:B,loadingSkeletonCount:U,renderMessage:te,embedded:G=!1,overlayContext:ce=!1,showStatus:Q=!1,statusIcons:se,renderStatus:F,showCloseButton:O}){var Se;const X=i.useMemo(()=>Gt(f!=null?f:Wt),[f]),[W,Z]=$e({value:p,defaultValue:_,onChange:v}),[ae,de]=$e({value:b,defaultValue:bs(X,h),onChange:w}),ie=G?"fullHeight":g?W?ae:"closed":ae,xe=()=>{Z(!0),ae==="closed"&&de(bs(X,h))},ee=()=>{Z(!1)},me=Y=>{Z(!0),de(Y)},{enabled:J,getRootProps:be,getInputProps:L,isDragActive:H}=pn({enabled:M,accept:z,maxFiles:D,onUploadFiles:I,disabled:N}),le=i.useId(),ne=!!R||J,P=J?s.jsx("input",{...L({id:le}),"data-testid":"chat-file-input"}):null,re=(Se=o!=null?o:d)!=null?Se:ne?s.jsxs(s.Fragment,{children:[P,s.jsx(en,{onSendMessage:R,placeholder:k,disabled:N,shiftEnterNewline:C,ctrlEnterNewline:A,fileUpload:J,attachInputId:J?le:void 0,attachAriaLabel:E})]}):void 0,je=s.jsx(hn,{messages:t,showAvatars:n,showAttachments:a,showStatus:Q,statusIcons:se,renderStatus:F,onLoadMore:j,hasMore:S,loading:$,loadingMore:B,loadingSkeletonCount:U,renderMessage:te}),ke=J?be():void 0,Ce=ya({floatingTrigger:g,embedded:G,overlayContext:ce,effectiveLayout:ie,showCloseButton:O});return s.jsxs("div",{className:y("smwb-chat",!G&&`smwb-chat_${u}`,G&&"smwb-chat_embedded",ce&&"smwb-chat_overlay-context",e),"data-testid":"chat",children:[g&&!G&&!W?s.jsx(Vs,{className:"smwb-chat__trigger","aria-label":T!=null?T:"Open chat","data-testid":"chat-trigger",onClick:xe,children:x!=null?x:s.jsx(K,{name:"chat",size:24})}):null,s.jsx(bn,{layout:ie,anchor:u,themeMode:m,embedded:G,overlayContext:ce,fileDropzoneRootProps:ke,fileDropzoneActive:J&&H,header:s.jsx(tn,{title:r,subtitle:c,actions:l,layout:ie==="closed"?ae:ie,allowedLayouts:X,onLayoutChange:me,onClose:Ce?ee:void 0}),footer:re,children:je})]})}const Sa=e=>typeof e=="number"?`${e}px`:e,Ta=e=>e==="left"?"bottom-left":"bottom-right";function Ma({className:e,contentClassName:t,chatClassName:n,side:a="right",chatWidth:r=400,collapsed:c,defaultCollapsed:l=!1,onCollapsedChange:o,collapseAriaLabel:d="Collapse chat panel",expandAriaLabel:u="Expand chat panel",floatingAnchor:m,chat:f,children:b,style:h,...w}){const[p,_]=$e({value:c,defaultValue:l,onChange:o}),[v,g]=$e({defaultValue:!1});i.useEffect(()=>{p||g(!1)},[p,g]);const x=m!=null?m:Ta(a),T=a==="left"?"dock_to_left":"dock_to_right",j=a==="left"?"left_panel_close":"right_panel_close",S=s.jsx(Ue,{"aria-label":d,"data-testid":"chat-layout-collapse",onClick:()=>_(!0),children:s.jsx(K,{name:j,size:18})}),R=s.jsx(Ue,{"aria-label":u,"data-testid":"chat-layout-expand",onClick:()=>_(!1),children:s.jsx(K,{name:T,size:18})}),k=s.jsxs(s.Fragment,{children:[f.headerActions,S]}),N=s.jsxs(s.Fragment,{children:[f.headerActions,R]}),C={"--smwb-chat-layout-w":Sa(r)};if(p)return s.jsxs("div",{className:y("smwb-chat-layout","smwb-chat-layout_collapsed",e),style:{...C,...h},"data-testid":"chat-layout","data-collapsed":"true",...w,children:[s.jsx("div",{className:y("smwb-chat-layout__content",t),"data-testid":"chat-layout-content",children:b}),s.jsx(Pt,{...f,className:n,floatingTrigger:!0,anchor:x,allowedLayouts:["floating"],layout:"floating",open:v,onOpenChange:g,headerActions:N})]});const A=s.jsx("aside",{className:"smwb-chat-layout__panel","data-testid":"chat-layout-panel",children:s.jsx(Pt,{...f,className:n,embedded:!0,allowedLayouts:[],headerActions:k})});return s.jsxs("div",{className:y("smwb-chat-layout",`smwb-chat-layout_${a}`,e),style:{...C,...h},"data-testid":"chat-layout","data-collapsed":"false",...w,children:[a==="left"?A:null,s.jsx("div",{className:y("smwb-chat-layout__content",t),"data-testid":"chat-layout-content",children:b}),a==="right"?A:null]})}const Da=i.forwardRef(function({className:t,color:n="primary",badgeContent:a,variant:r="outside",vertical:c="top",horizontal:l="right",max:o,showZero:d=!1,badgeAriaLabel:u,children:m,...f},b){const h=a===0||a==="0",w=(a==null||h&&!d)===!0;let p=a;typeof a=="number"&&o!==void 0&&a>o&&(p=`${o}+`);const _=y("smwb-badge",`smwb-badge_${n}`,`smwb-badge_${r}`,`smwb-badge_${r}_${c}`,`smwb-badge_${r}_${c}_${l}`,t,{"smwb-badge_no-content":w});return s.jsxs("span",{className:"smwb-badge__wrapper","data-testid":"badge",children:[m,s.jsx("span",{ref:b,className:_,"aria-label":u,...f,children:w?null:p})]})}),Ea=i.forwardRef(function({className:t,variant:n="elevated",children:a,disabled:r,title:c,footer:l,onClick:o,onKeyDown:d,...u},m){const f=!!o&&!r,b=h=>{d==null||d(h),f&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),o==null||o(h))};return s.jsxs("div",{ref:m,"data-testid":"card",className:y("smwb-card",`smwb-card_${n}`,t,{card_disabled:r,"smwb-card_interactive":f}),role:f?"button":void 0,tabIndex:f?0:void 0,"aria-disabled":r||void 0,onClick:f?o:void 0,onKeyDown:b,...u,children:[c&&s.jsx("div",{className:"smwb-card__title",children:c}),a,l&&s.jsx("div",{className:"smwb-card__footer",children:l})]})}),Jt=i.forwardRef(function({label:t,className:n,deleteIcon:a,icon:r,onDelete:c,onMouseDown:l,onDeleteMouseDown:o,asLink:d,href:u,target:m="_blank",selected:f,variant:b="filled",size:h="medium",color:w="default",disabled:p=!1,onClick:_,deleteAriaLabel:v="Remove",...g},x){const T=i.useRef(null),j=M=>{l==null||l(M)},S=M=>{var I;p||(I=T.current)==null||I.onRipple(M)},R=M=>{o==null||o(M),M.stopPropagation()},k=y("smwb-chip",`smwb-${b}`,`smwb-chip_size-${h}`,w!=="default"&&`smwb-chip_color-${w}`,n,{"smwb-disabled":p,"smwb-selected":f}),N=!!c&&s.jsx("button",{type:"button",className:"smwb-chip__delete-icon","aria-label":v,disabled:p,onClick:c,onMouseDown:R,children:a||s.jsx(K,{name:"cancel",size:18,fill:1})}),C=s.jsxs(s.Fragment,{children:[r&&s.jsx("span",{className:"smwb-chip__icon",children:r}),s.jsx("span",{className:"smwb-chip__label",children:t}),N,s.jsx(De,{actionRef:T})]});if(d&&u)return s.jsx("a",{ref:x,"data-testid":"chip-link",className:k,href:u,onMouseDown:j,onPointerDown:S,target:m,rel:"noreferrer",...g,children:C});const A=!!_&&!p;return s.jsx("span",{ref:x,"data-testid":"chip",className:k,role:A?"button":void 0,tabIndex:A?0:void 0,"aria-disabled":p||void 0,onClick:A?_:void 0,onKeyDown:A?M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),_==null||_())}:void 0,onMouseDown:j,onPointerDown:S,...g,children:C})});function Aa({options:e,value:t,multiple:n,onChange:a,size:r="medium",color:c="primary",disabled:l,className:o,...d}){const u=()=>t==null?[]:Array.isArray(t)?t:[t],m=b=>u().includes(b),f=b=>{if(n){const h=u(),w=h.includes(b)?h.filter(p=>p!==b):[...h,b];a==null||a(w)}else a==null||a(b)};return s.jsx("div",{...d,role:"group",className:y("smwb-chip-group",o),children:e.map(b=>s.jsx(Jt,{label:b.label,icon:b.icon,size:r,color:c,selected:m(b.value),variant:m(b.value)?"filled":"outlined",disabled:!!(l||b.disabled),onClick:()=>f(b.value)},b.value))})}const _n=i.forwardRef(function({src:t,alt:n,fallback:a,lazy:r=!0,aspectRatio:c,className:l,onError:o,...d},u){const[m,f]=i.useState(!1),[b,h]=i.useState(!r),w=i.useRef(null),p=ge(u,w);i.useEffect(()=>{if(!r||b)return;const g=w.current;if(!g)return;if(typeof IntersectionObserver=="undefined"){h(!0);return}const x=new IntersectionObserver(T=>{T.some(j=>j.isIntersecting)&&(h(!0),x.disconnect())});return x.observe(g),()=>x.disconnect()},[r,b]);const _=m||!t,v=g=>{f(!0),o==null||o(g)};return s.jsxs("span",{className:y("smwb-lazy-image",l,{"smwb-lazy-image--empty":_}),style:c!=null?{aspectRatio:String(c)}:void 0,children:[_&&a?s.jsx("span",{className:"smwb-lazy-image__fallback",children:a}):null,_?null:s.jsx("img",{...d,ref:p,className:"smwb-lazy-image__img",src:b?t:void 0,alt:n!=null?n:"",loading:r?"lazy":void 0,decoding:"async",onError:v})]})}),Ia=i.forwardRef(function({src:t,caption:n,selected:a,onSelect:r,fallback:c,hoverPreview:l,topStart:o,topEnd:d,lazy:u=!0,disabled:m,hoverDelay:f=350,className:b,...h},w){const p=i.useRef(null),_=ge(w,p),[v,g]=i.useState(null),x=i.useRef(null),T=()=>{x.current&&(clearTimeout(x.current),x.current=null)},j=()=>{l==null||m||(T(),x.current=setTimeout(()=>{var C;const N=(C=p.current)==null?void 0:C.getBoundingClientRect();N&&g({top:N.top,left:N.right+8})},f))},S=()=>{T(),g(null)};i.useEffect(()=>T,[]);const R=!!r&&!m,k=N=>{R&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),r==null||r())};return s.jsxs("div",{...h,ref:_,className:y("smwb-thumb-card",b,{"smwb-thumb-card--selected":a,"smwb-thumb-card--disabled":m,"smwb-thumb-card--interactive":R}),role:R?"button":void 0,tabIndex:R?0:void 0,"aria-pressed":r?a!=null?a:!1:void 0,"aria-disabled":m||void 0,onClick:R?()=>r==null?void 0:r():void 0,onKeyDown:k,onMouseEnter:j,onMouseLeave:S,children:[s.jsxs("div",{className:"smwb-thumb-card__media",children:[s.jsx(_n,{src:t,lazy:u,fallback:c}),o?s.jsx("div",{className:"smwb-thumb-card__slot smwb-thumb-card__slot--start",children:o}):null,d?s.jsx("div",{className:"smwb-thumb-card__slot smwb-thumb-card__slot--end",children:d}):null]}),n?s.jsx("div",{className:"smwb-thumb-card__caption",children:n}):null,v&&typeof document!="undefined"?Re.createPortal(s.jsx("div",{className:"smwb-thumb-card__preview",style:{position:"fixed",top:v.top,left:v.left},children:typeof l=="string"?s.jsx("img",{src:l,alt:""}):l}),document.body):null]})});function $a({items:e,renderItem:t,minColumn:n=160,rowHeight:a,gap:r=8,overscan:c=2,loading:l,loadingCount:o=12,emptyLabel:d,className:u,style:m}){const f=i.useRef(null),[b,h]=i.useState(0),[w,p]=i.useState(0),[_,v]=i.useState(!1);i.useEffect(()=>{const k=f.current;if(!k||typeof ResizeObserver=="undefined")return;const N=new ResizeObserver(()=>{h(k.clientWidth),p(k.clientHeight),v(!0)});return N.observe(k),()=>N.disconnect()},[]);const g=i.useMemo(()=>b<=0?1:Math.max(1,Math.floor((b+r)/(n+r))),[b,r,n]),x=Math.ceil(e.length/g),T=Kt({itemCount:x,itemHeight:a+r,viewportHeight:w||1,overscan:c}),j={display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr))`,gap:r,gridAutoRows:a},S={display:"grid",gridTemplateColumns:`repeat(${g}, minmax(0, 1fr))`,gap:r,height:a,marginBottom:r};let R;return l?R=s.jsx("div",{className:"smwb-asset-grid__plain",style:j,children:Array.from({length:o}).map((k,N)=>s.jsx("div",{className:"smwb-asset-grid__skeleton",style:{height:a}},N))}):e.length===0?R=s.jsx("div",{className:"smwb-asset-grid__empty",children:d}):_?R=s.jsx("div",{className:"smwb-asset-grid__sizer",style:{height:T.totalHeight,position:"relative"},children:s.jsx("div",{className:"smwb-asset-grid__band",style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${T.offsetY}px)`},children:Array.from({length:Math.max(0,T.endIndex-T.startIndex)}).map((k,N)=>{const C=T.startIndex+N;return s.jsx("div",{className:"smwb-asset-grid__row",style:S,children:Array.from({length:g}).map((A,M)=>{const I=C*g+M;return I<e.length?s.jsx(i.Fragment,{children:t(e[I],I)},M):null})},C)})})}):R=s.jsx("div",{className:"smwb-asset-grid__plain",style:j,children:e.map((k,N)=>s.jsx(i.Fragment,{children:t(k,N)},N))}),s.jsx("div",{ref:f,className:y("smwb-asset-grid",u),style:m,onScroll:T.onScroll,children:R})}const Fa=i.forwardRef(function({children:t,onClose:n,open:a,className:r,animation:c="fade",backdrop:l="dark",size:o="large",closeOnOutsideClick:d=!0,asForm:u=!1,disableAppearAnimation:m=!1,role:f="dialog",closeOnEsc:b=!0,...h},w){const[p,_]=i.useState(),v=i.useRef(null),g=i.useRef(null),x=ge(w,g);if(_e(()=>{_(document.body)},[]),i.useEffect(()=>{if(!a||!b||!n)return;const j=S=>{S.key==="Escape"&&n()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[a,b,n]),!p)return s.jsx(s.Fragment,{});const T=u?"form":"div";return Re.createPortal(s.jsx(He.CSSTransition,{timeout:{appear:225,enter:225,exit:150},in:a,classNames:{appear:"smwb-modal__overlay-appear",appearActive:"smwb-modal__overlay-appear-active",appearDone:"smwb-modal__overlay-appear-done",enter:"smwb-modal__overlay-enter",enterActive:"smwb-modal__overlay-enter-active",enterDone:"smwb-modal__overlay-enter-done",exit:"smwb-modal__overlay-exit",exitActive:"smwb-modal__overlay-exit-active"},appear:!m,mountOnEnter:!0,unmountOnExit:!0,nodeRef:v,children:s.jsx("div",{ref:v,className:y("smwb-modal__overlay",`smwb-${l}`,`smwb-${o}`),onClick:d&&n?n:void 0,children:s.jsx(T,{ref:x,className:y("smwb-modal",`smwb-${o}`,`smwb-${c}`,r),onClick:j=>j.stopPropagation(),role:f,"aria-modal":"true",...h,children:t})})}),p)});function La({className:e,children:t}){return s.jsx("div",{className:y("smwb-modal__header",e),children:t})}function Ba({className:e,children:t}){return s.jsx("div",{className:y("smwb-modal__content",e),children:t})}function Oa({className:e,children:t}){return s.jsx("div",{className:y("smwb-modal__footer",e),children:t})}const Ye=Object.assign(Fa,{Footer:Oa,Header:La,Content:Ba});function Pa(e,t){const n=Math.floor(e/t);return e%t===0?n-1:n}function _s(e,t,n,a){const r=Pa(n,t);return e===n+t?0:a||e<t&&e!==0?r:e===0?n%t===0?r:r-1:t>0?Math.floor(e/t)-1:0}function gn(e){return!(e instanceof Event)}function gt(e){return gn(e)&&e.nativeEvent instanceof MouseEvent||e instanceof MouseEvent}function Qt(e){return window.TouchEvent&&(gn(e)&&e.nativeEvent instanceof TouchEvent||e instanceof TouchEvent)}function Tt(e){return gt(e)?e.clientX:Qt(e)?e.changedTouches[0].clientX:0}function gs(e){return gt(e)?e.clientY:Qt(e)?e.changedTouches[0].clientY:0}function xs(e){const t=e.target;(t.tagName==="A"||t.tagName==="IMG")&&e.preventDefault()}function za(e){return{width:`${xn(e)}%`}}function xn(e){return 100/e}function Ha(e,t){return e<=0||t===0?1:e>t?t:e}function Va(e,t,n){return Math.min(Math.max(e,t),n)}function Mt(e){if(e!=null)return typeof e=="number"?`${e}px`:e}function Ya(e){if(e!=null)return String(e)}function Xa(e,t){if(e<=0||t===0)return 0;const n=t-1;return e>n?n:e}function Me(e){const t=i.useRef(e);return _e(()=>{t.current=e}),i.useCallback((...n)=>(0,t.current)(...n),[])}const Ka={isPressed:!1,startX:0,startY:0,lastX:0,lastT:0,axis:null,dragged:!1},vs=8,Wa=.4,Ua=i.forwardRef(function({slidesToShow:t=3,startSlide:n=0,children:a,className:r,showNavigation:c=!0,showArrows:l,arrowsSize:o=30,navigationClassName:d,onSlideChange:u,navigationDotRenderer:m,"aria-label":f="Carousel",autoplay:b=!1,autoplayInterval:h=4e3,pauseOnHover:w=!0,cellHeight:p,aspectRatio:_,gap:v,maxWidth:g,enableFullscreen:x=!1},T){const j=i.Children.count(a),S=Ha(t,j),R=Xa(n,j),k=l&&j>1,N=Math.max(0,j-S),[C,A]=i.useState(R),[M,I]=i.useState({animation:void 0}),[z,D]=i.useState(0),[E,$]=i.useState(!1),[B,U]=i.useState(null),[te,G]=i.useState(0),[ce,Q]=i.useState(!1),se=i.useRef(null),F=i.useRef(null),O=ge(T,F),X=i.useRef(null),[W,Z]=i.useState(!1),ae=i.useRef({...Ka});_e(()=>{I(V=>({...V,animation:!1}))},[S]),_e(()=>{A(R),u==null||u(R),M.animation!==void 0&&I(V=>({...V,animation:!0}))},[R]);const de=V=>{Object.assign(ae.current,V)},ie=()=>typeof performance!="undefined"?performance.now():Date.now(),xe=V=>{const q=Va(V,0,N);A(q),I(he=>({...he,animation:!0})),u==null||u(q)},ee=V=>{U(q=>q===null?q:(q+V+j)%j)},me=i.useRef(null),J=V=>{X.current&&(X.current.removeEventListener(V?"mousemove":"touchmove",L),X.current.removeEventListener(V?"mouseup":"touchend",H),V&&X.current.removeEventListener("mouseleave",H))},be=Me(V=>{if(!X.current)return;const q=gt(V);if(q&&V.button!==0)return;V.stopPropagation();const he=Tt(V),we=gs(V);de({isPressed:!0,startX:he,startY:we,lastX:he,lastT:ie(),axis:null,dragged:!1}),X.current.addEventListener(q?"mousemove":"touchmove",L,{passive:!1}),X.current.addEventListener(q?"mouseup":"touchend",H),q&&X.current.addEventListener("mouseleave",H)}),L=Me(V=>{if(!se.current||!ae.current.isPressed)return;if(Qt(V)&&V.touches.length>1)return H(V);const q=Tt(V),he=gs(V),we=q-ae.current.startX,ve=he-ae.current.startY;if(ae.current.axis===null){if(Math.abs(we)<vs&&Math.abs(ve)<vs)return;const Ae=Math.abs(we)>=Math.abs(ve)?"x":"y";if(de({axis:Ae,dragged:!0}),Ae==="y")return H(V);j>1&&$(!0)}if(ae.current.axis==="x"){if(V.preventDefault(),V.stopPropagation(),j>1){const Ae=C<=0,Ie=C>=N,Oe=Ae&&we>0||Ie&&we<0?we*.35:we;D(Oe)}ae.current.lastX=q,ae.current.lastT=ie()}}),H=Me(V=>{if(!ae.current.isPressed)return;const q=gt(V);J(q);const{axis:he,dragged:we,startX:ve,lastX:Ae,lastT:Ie}=ae.current;if(de({isPressed:!1}),$(!1),he==="x"&&we&&j>1&&se.current){const Oe=Tt(V),ht=Oe-ve,tt=se.current.offsetWidth/S,bt=Ie?(Oe-Ae)/Math.max(1,ie()-Ie):0;let st=tt>0?Math.round(-ht/tt):0;st===0&&Math.abs(bt)>Wa&&(st=bt<0?1:-1),xe(C+st)}D(0)}),le=V=>()=>{ae.current.dragged||x&&U(V)},ne=V=>()=>xe(V),P=V=>{const q=S===1,he=q?j:Math.ceil(j/S),we=C+S,ve=j-S<=C,Ie=(_s(we,S,j,ve)+V+he)%he;return q?Ie:Ie*S},re=()=>{if(!c)return s.jsx(s.Fragment,{});const V=j-S<=C,q=S===1,he=q?j:Math.ceil(j/S),we=[];for(let ve=0;ve<he;ve++){let Ae=ve,Ie=C;if(!q){const bt=ve===he-1,st=C+S;Ae=bt?j-S:ve*S,Ie=_s(st,S,j,V)}const Oe=Ie===ve,ht=ne(Ae);let tt=s.jsx("div",{className:y("smwb-carousel__navigation__dot",Oe&&"current"),onClick:ht},ve);m&&(tt=m(ve,Oe,ht)),we.push(tt)}return s.jsx("div",{className:y("smwb-carousel__navigation",d),children:we})},oe=()=>{const V=C>N?N:C;return xn(S)*V},je=i.useId(),ke=za(S),Se={transform:`translateX(calc(-${oe()}% + ${z}px))`,transition:E||M.animation===void 0?"none":M.animation?"transform 500ms cubic-bezier(.1, 0, .25, 1)":"none"},Y={},ue=Mt(p),ye=Ya(_),Ee=Mt(v),Fe=Mt(g);if(ue&&(Y["--smwb-carousel-cell-height"]=ue),ye&&(Y["--smwb-carousel-aspect-ratio"]=ye),Ee&&(Y["--smwb-carousel-gap"]=Ee),Fe&&(Y["--smwb-carousel-max-width"]=Fe),i.useEffect(()=>{Array.isArray(a)||console.error("SMWB Material: The `children` prop was passed invalidly. It should contain an array of elements.")},[a]),i.useEffect(()=>{if(!b||j<=1||w&&W||B!==null)return;const V=window.setInterval(()=>{ne(P(1))()},h);return()=>window.clearInterval(V)},[b,h,w,W,j,C,S,B]),i.useEffect(()=>{if(B===null||j<=1)return;const V=q=>{q.key==="ArrowLeft"?ee(-1):q.key==="ArrowRight"&&ee(1)};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[B,j]),!Array.isArray(a))return s.jsx(s.Fragment,{});const ft=a,et=V=>{var q,he;me.current=(he=(q=V.touches[0])==null?void 0:q.clientX)!=null?he:null},Nt=V=>{var he,we;if(me.current===null||j<=1)return;const q=((we=(he=V.touches[0])==null?void 0:he.clientX)!=null?we:me.current)-me.current;Q(!0),G(q)},Qn=V=>{var we,ve;const q=me.current;if(me.current=null,Q(!1),G(0),q===null||j<=1)return;const he=((ve=(we=V.changedTouches[0])==null?void 0:we.clientX)!=null?ve:q)-q;Math.abs(he)>40&&ee(he<0?1:-1)},ea={transform:`translateX(calc(-${(B!=null?B:0)*100}% + ${te}px))`,transition:ce?"none":"transform 350ms cubic-bezier(.22, .61, .36, 1)"};return s.jsxs("div",{className:y("smwb-carousel",r),"data-testid":"carousel",ref:O,role:"region","aria-roledescription":"carousel","aria-label":f,style:Y,onMouseEnter:w?()=>Z(!0):void 0,onMouseLeave:w?()=>Z(!1):void 0,children:[s.jsxs("div",{className:y("smwb-carousel__inner"),ref:se,children:[k&&s.jsx(K,{name:"chevron_left",size:o,className:y("smwb-carousel__arrow","smwb-carousel__arrow_prev"),style:{top:`calc(50% - ${o/2}px)`,left:-o/2},onClick:()=>ne(P(-1))()}),s.jsx("div",{ref:X,className:"smwb-carousel__track",onMouseDown:be,onTouchStart:be,onDragStart:xs,onDragEnd:xs,children:s.jsx("div",{className:"smwb-carousel__layer",style:Se,children:i.Children.map(a,(V,q)=>s.jsx("div",{id:`${je}${q}`,className:"smwb-carousel__slide",style:ke,children:s.jsx("div",{className:y("smwb-carousel__slide-inner",x&&"smwb-carousel__slide-inner_clickable"),onClick:x?le(q):void 0,children:V})},q))})}),k&&s.jsx(K,{name:"chevron_right",size:o,className:y("smwb-carousel__arrow","smwb-carousel__arrow_next"),style:{top:`calc(50% - ${o/2}px)`,right:-o/2},onClick:()=>ne(P(1))()})]}),re(),x&&s.jsx(Ye,{open:B!==null,size:"fullscreen",backdrop:"darkBlured",className:"smwb-carousel__fullscreen",onClose:()=>U(null),"aria-label":"Image viewer",children:B!==null&&s.jsxs("div",{className:"smwb-carousel__fullscreen-content",children:[j>1&&s.jsx(K,{name:"chevron_left",size:40,className:y("smwb-carousel__fullscreen-arrow","smwb-carousel__fullscreen-arrow_prev"),onClick:()=>ee(-1)}),s.jsx("div",{className:"smwb-carousel__fullscreen-stage",onTouchStart:et,onTouchMove:Nt,onTouchEnd:Qn,children:s.jsx("div",{className:"smwb-carousel__fullscreen-track",style:ea,children:ft.map((V,q)=>s.jsx("div",{className:"smwb-carousel__fullscreen-slide","aria-hidden":q!==B,children:V},q))})}),j>1&&s.jsx(K,{name:"chevron_right",size:40,className:y("smwb-carousel__fullscreen-arrow","smwb-carousel__fullscreen-arrow_next"),onClick:()=>ee(1)}),s.jsx(K,{name:"close",size:32,className:"smwb-carousel__fullscreen-close",onClick:()=>U(null)})]})})]})}),Ga=()=>{const[e,t]=i.useState(!1),n=i.useCallback(()=>{t(!1)},[]),a=i.useCallback(()=>{t(!0)},[]);return{onClose:n,onOpen:a,isOpen:e}},vn=i.createContext({rowsHeight:0}),qa=({className:e,src:t,rounded:n,itemBarContent:a,cols:r=1,rows:c=1,itemBarPlacement:l="bottom",alt:o="image"})=>{const{isOpen:d,onClose:u,onOpen:m}=Ga(),{rowsHeight:f,variant:b}=i.useContext(vn);i.useEffect(()=>{d?document.body.style.overflow="hidden":document.body.style.overflow="auto"},[d]);const h={height:f?`${f*c}px`:"",gridRowEnd:`span ${c}`,gridColumnEnd:`span ${r}`};return s.jsxs(s.Fragment,{children:[s.jsx("li",{"data-testid":"images-list-item",className:y("smwb-gallery__list__item",e,"smwb-gallery-item",`smwb-${b}`),onClick:m,style:h,children:s.jsxs("div",{className:"smwb-gallery-item__inner",children:[s.jsx("div",{className:"smwb-gallery-item__img-wrapper",children:s.jsx("img",{src:t,alt:o||"image",className:y("smwb-gallery-item__img",{"smwb-rounded":n})})}),a&&s.jsx("div",{className:y("smwb-gallery-item__bar",e,`smwb-${l}`,{"smwb-rounded":n}),children:a})]})}),s.jsx(yn,{src:t,onClose:u,isOpen:d})]})},Za=i.forwardRef(function({className:t,children:n,gap:a=4,cols:r=3,rowsHeight:c=0,variant:l="default","aria-label":o,id:d},u){return s.jsx(vn.Provider,{value:{rowsHeight:c,variant:l},children:s.jsx("div",{className:y("smwb-gallery",t),"data-testid":"images-list",ref:u,id:d,children:s.jsx("ul",{"aria-label":o,className:y("smwb-gallery__list",`smwb-${l}`),style:{"--cols-count":r,"--gap":`${a}px`},children:n})})})}),yn=({src:e,onClose:t,isOpen:n})=>{const a=i.useRef(null);return Re.createPortal(s.jsx(He.CSSTransition,{timeout:100,in:n,classNames:{enterActive:"smwb-image-modal__overlay-enter-active",enterDone:"smwb-image-modal__overlay-enter-done"},mountOnEnter:!0,unmountOnExit:!0,nodeRef:a,children:s.jsx("div",{className:"smwb-image-modal__overlay",onClick:t,ref:a,children:s.jsx("div",{className:"smwb-image-modal",onClick:r=>r.stopPropagation(),children:s.jsx("img",{src:e,alt:"",className:"smwb-image-modal__img"})})})}),document.body)},Ja=i.forwardRef(function({className:t,children:n,disabled:a,selected:r,dense:c,divider:l,startAdornment:o,endAdornment:d,onClick:u},m){const f=!!u&&!a;return s.jsxs("li",{ref:m,role:"listitem",tabIndex:f?0:void 0,"aria-disabled":a||void 0,"aria-selected":r||void 0,onClick:a?void 0:u,onKeyDown:f?b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),u==null||u(b))}:void 0,className:y("smwb-list__item",t,{"smwb-disabled":a,"smwb-selected":r,"smwb-list__item_dense":c,"smwb-list__item_divider":l}),"data-testid":"list-item",children:[s.jsx("span",{className:"smwb-list__item__start",children:o}),s.jsx("span",{className:"smwb-list__item__main",children:n}),s.jsx("span",{className:"smwb-list__item__end",children:d})]})}),Qa=i.forwardRef(function({className:t,dense:n,subheader:a,children:r,...c},l){return s.jsxs("ul",{ref:l,"data-testid":"list",role:"list",className:y("smwb-list",{"smwb-list_dense":n},t),...c,children:[a?s.jsx("li",{className:"smwb-list__subheader",children:a}):null,r]})}),jn=({limit:e,page:t,totalCount:n,onPrev:a,onNext:r,limitOptions:c,onLimitChange:l,hasNextPage:o})=>{const d=typeof n=="undefined",u=d?!o:t===Math.ceil(n/e),m=w=>{l&&l(+w.target.value)},f=()=>{a==null||a()},b=()=>{r==null||r()},h=()=>{const w=t*e-e,p=t*e;return`${w}–${p}`+(d?"":` of ${n}`)};return s.jsx("div",{className:"smwb-table__pagination",children:s.jsxs("div",{className:"smwb-table__pagination__controls",children:[c&&c.length>1&&s.jsxs("div",{className:"smwb-table__pagination__rows",children:[s.jsx("span",{children:"Rows per page"}),s.jsx("select",{id:"rows",className:"smwb-table__pagination__select",onChange:m,value:e,children:c.map(w=>s.jsx("option",{value:w,className:y("smwb-select-option",{selected:w===e}),children:w},w))})]}),s.jsx("div",{className:"smwb-table__pagination__current-count",children:h()}),s.jsxs("div",{className:"smwb-table__pagination__buttons",children:[s.jsx("button",{className:"smwb-table__pagination__control",onClick:f,disabled:t===1,children:s.jsx(K,{name:"chevron_left",size:24,weight:600})}),s.jsx("span",{className:"smwb-table__pagination__page",children:t}),s.jsx("button",{className:"smwb-table__pagination__control",onClick:b,disabled:u,children:s.jsx(K,{name:"chevron_right",size:24,weight:600})})]})]})})},er=i.forwardRef(({className:e,dense:t,hovered:n,children:a,paginationSettings:r,isLoading:c,stickyHeader:l,caption:o,...d},u)=>s.jsxs("div",{ref:u,className:y("smwb-table__wrapper",e,{"smwb-table__wrapper_loading":c}),...d,children:[s.jsx("div",{className:y("smwb-table__container",{"smwb-withPagination":!!r}),children:s.jsxs("table",{className:y("smwb-table",{"smwb-dense":t,"smwb-hovered":n,"smwb-table_sticky-header":l}),children:[o!=null&&s.jsx("caption",{className:"smwb-table__caption",children:o}),a]})}),!!r&&s.jsx(jn,{...r})]})),tr=({children:e,className:t,...n})=>s.jsx("tbody",{...n,className:y("smwb-table__body",t),children:e}),sr=({children:e,cellAlign:t="left",className:n,...a})=>s.jsx("td",{...a,className:y("smwb-table__cell",n),align:t||"left",children:e}),nr=({children:e,className:t,...n})=>s.jsx("thead",{...n,className:y("smwb-table__head",t),children:e}),ar=({children:e,className:t,cellAlign:n="left",isSortedByAsc:a,isSortedByDesc:r,sortable:c,sortDirection:l,onSort:o,...d})=>{const u=l!==void 0?l:a?"asc":r?"desc":!1,m=c?u==="asc"?"ascending":u==="desc"?"descending":"none":void 0,f=u==="asc"?"expand_more":u==="desc"?"expand_less":"",b=h=>{c&&o&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),o())};return s.jsx("th",{...d,"aria-sort":m,className:y("smwb-table__cell","smwb-head-cell",t,{[`smwb-align_${n}`]:!!n,"smwb-head-cell_sortable":c}),children:s.jsxs("span",{className:"smwb-head-cell__content",onClick:c?o:void 0,onKeyDown:c?b:void 0,role:c?"button":void 0,tabIndex:c?0:void 0,children:[e,s.jsx(K,{name:f,size:18,weight:800})]})})},rr=({children:e,className:t,selected:n,expanded:a,...r})=>s.jsx("tr",{"data-testid":"table-row",className:y("smwb-table__row",t,{"smwb-table__row_selected":n,"smwb-table__row_expanded":a}),"aria-selected":n!=null?n:void 0,"aria-expanded":a!=null?a:void 0,...r,children:e}),ir=i.forwardRef(function({className:t,listIcon:n="draft",nodeIcon:a={closed:"folder",opened:"folder_open"},data:r=[],expanded:c,defaultExpanded:l=[],onExpandedChange:o,selected:d,defaultSelected:u=[],onSelectedChange:m,selectable:f=!1,checkboxes:b=!1,renderLabel:h,loadChildren:w,...p},_){const[v,g]=i.useState({}),[x,T]=i.useState([]),[j,S]=$e({value:c,defaultValue:l,onChange:o}),[R,k]=$e({value:d,defaultValue:u,onChange:m}),N=D=>{S(E=>E.includes(D)?E.filter($=>$!==D):[...E,D])},C=(D,E)=>{S($=>{const B=$.includes(D);return E&&!B?[...$,D]:!E&&B?$.filter(U=>U!==D):$})},A=D=>{k(E=>E.includes(D)?E.filter($=>$!==D):[...E,D])},M=(D,E)=>{!w||v[E]||D.children&&D.children.length>0||(T($=>$.includes(E)?$:[...$,E]),w(D,E).then($=>{g(B=>({...B,[E]:$}))}).finally(()=>{T($=>$.filter(B=>B!==E))}))},I=(D,E)=>{var O,X;const $=(O=D.id)!=null?O:E,B=(X=D.children)!=null?X:v[$],U=!!w&&(D.hasChildren||!!v[$]),te=!!B&&B.length>0||U,G=j.includes($),ce=R.includes($),Q=x.includes($),se=()=>{te&&(G||M(D,$),N($)),f&&A($)},F=W=>{W.key==="Enter"||W.key===" "?(W.preventDefault(),se()):W.key==="ArrowRight"&&te?(M(D,$),C($,!0)):W.key==="ArrowLeft"&&te&&C($,!1)};return s.jsxs("div",{className:y("smwb-tree__node",{"smwb-tree__node_selected":ce}),role:"treeitem","aria-expanded":te?G:void 0,"aria-selected":f||b?ce:void 0,children:[s.jsxs("span",{className:"smwb-tree__node__content",onClick:se,onKeyDown:F,tabIndex:0,role:"button",children:[b&&s.jsx("input",{type:"checkbox",className:"smwb-tree__node__checkbox",checked:ce,onClick:W=>W.stopPropagation(),onChange:()=>A($),"aria-label":D.label}),s.jsxs("span",{className:"smwb-tree__node__label",children:[te&&G?s.jsx(K,{name:a==null?void 0:a.opened,fill:1,size:20}):te?s.jsx(K,{name:a==null?void 0:a.closed,fill:1,size:20}):s.jsx(K,{name:n,size:20}),h?h(D,$):D.label]})]}),te&&G&&s.jsx("div",{role:"group",children:Q&&!B?s.jsx("div",{className:"smwb-tree__node__loading",role:"status",children:"Загрузка…"}):B==null?void 0:B.map((W,Z)=>I(W,`${E}.${Z}`))})]},$)},z=i.useMemo(()=>r.map((D,E)=>I(D,`${E}`)),[r,j,R,f,b,n,a,h,v,x]);return s.jsx("div",{"data-testid":"tree-view",...p,ref:_,role:"tree",className:y("smwb-tree",t),children:z.map((D,E)=>s.jsx("div",{className:"smwb-tree__wrapper",role:"presentation",children:D},E))})});function ys(e){return e.substring(2).toLowerCase()}function lr(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function Je({children:e,disableReactTree:t=!1,mouseEvent:n="onMouseUp",onClickAway:a,touchEvent:r="onTouchEnd",enabled:c=!0}){const l=i.useRef(!1),o=i.useRef(null),d=i.useRef(!1),u=i.useRef(!1);i.useEffect(()=>(setTimeout(()=>{d.current=!0},0),()=>{d.current=!1}),[]);const m=ge(e.ref,o),f=Me(w=>{const p=u.current;if(u.current=!1,!c||!d.current||!o.current||"clientX"in w&&lr(w,document))return;if(l.current){l.current=!1;return}let _;if(w.composedPath)_=w.composedPath().indexOf(o.current)>-1;else{const v=w.target;_=!document.documentElement.contains(v)||o.current.contains(v)}!_&&(t||!p)&&a(w)}),b=w=>p=>{u.current=!0;const _=e.props[w];_&&_(p)},h={ref:m};return r!==!1&&(h[r]=b(r)),i.useEffect(()=>{if(r!==!1){const w=ys(r),p=()=>{l.current=!0};return document.addEventListener(w,f),document.addEventListener("touchmove",p),()=>{document.removeEventListener(w,f),document.removeEventListener("touchmove",p)}}},[f,r]),n!==!1&&(h[n]=b(n)),i.useEffect(()=>{if(n!==!1){const w=ys(n);return document.addEventListener(w,f),()=>{document.removeEventListener(w,f)}}},[f,n]),s.jsx(s.Fragment,{children:i.cloneElement(e,h)})}const kn=i.forwardRef(({className:e,children:t,type:n,severity:a,variant:r="filled",onClose:c,closeAriaLabel:l="Close",...o},d)=>{const u=a!=null?a:n,m=y("smwb-message",`smwb-message_${r}`,e,{[`smwb-message_${u}`]:!!u});return s.jsxs("div",{"data-testid":"message",role:"alert","aria-live":u==="error"?"assertive":"polite",...o,className:m,ref:d,children:[t,c&&s.jsx("button",{className:"smwb-message__close-btn",onClick:c,"aria-label":l,type:"button",children:s.jsx(K,{name:"close",weight:1e3})})]})}),or=({children:e})=>s.jsx("div",{className:"smwb-message__header",children:e}),cr=Object.assign(kn,{Header:or});function ur({open:e,title:t,nameLabel:n,name:a,onNameChange:r,previewSrc:c,onCapture:l,captureLabel:o,busy:d,confirmLabel:u,cancelLabel:m,onConfirm:f,onClose:b,children:h,className:w}){const p=r!==void 0||a!==void 0;return s.jsxs(Ye,{open:e,onClose:b,size:"small",children:[s.jsx(Ye.Header,{children:t!=null?t:"Save"}),s.jsx(Ye.Content,{children:s.jsxs("div",{className:y("smwb-save-asset-dialog__body",w),children:[p?s.jsx(Be,{label:n!=null?n:"Name",value:a!=null?a:"",disabled:!!d,onChange:_=>r==null?void 0:r(_.currentTarget.value)}):null,c?s.jsx("div",{className:"smwb-save-asset-dialog__preview",children:s.jsx("img",{src:c,alt:""})}):null,l?s.jsx(Te,{variant:"outlined",size:"small",disabled:!!d,onClick:()=>l(),label:o!=null?o:"Capture preview"}):null,h]})}),s.jsxs(Ye.Footer,{children:[s.jsx(Te,{variant:"text",disabled:!!d,onClick:()=>b(),label:m!=null?m:"Cancel"}),s.jsx(Te,{variant:"contained",disabled:!!d,onClick:()=>f(),label:u!=null?u:"Save"})]})]})}const Nn=i.forwardRef(function({type:t,variant:n,className:a,progressValue:r=0,color:c="primary",size:l="medium",id:o,...d},u){const m={role:"progressbar","aria-label":d["aria-label"],id:o,...t==="determinate"?{"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100}:{}},f=c!=="primary"?`smwb-indicator_color-${c}`:null;return n==="circular"?s.jsx("div",{ref:u,className:y("smwb-indicator_circular",`smwb-${t}`,f,`smwb-indicator_size-${l}`,a),...m,children:t==="determinate"?s.jsx(Rn,{progressValue:r}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"smwb-indicator_circular__thumb"}),s.jsx("div",{}),s.jsx("div",{}),s.jsx("div",{})]})}):s.jsx("div",{ref:u,className:y("smwb-indicator_linear",`smwb-${t}`,f,a),...m,children:s.jsx("div",{className:"smwb-indicator_linear__thumb",style:t==="determinate"?{width:`${r}%`}:{}})})});function Rn({progressValue:e=0}){const t=i.useRef(null);return i.useEffect(()=>{var a;if(!t.current||!t.current.r)return;const n=(a=t.current)==null?void 0:a.r.baseVal.value;if(n&&t.current){const r=2*Math.PI*n;t.current.style.strokeDasharray=`${r} ${r}`,t.current.style.strokeDashoffset=`${r}`;const c=r-e/100*r;t.current.style.strokeDashoffset=`${c}`}},[t,e]),s.jsx("svg",{className:"smwb-indicator_circular__svg",children:s.jsx("circle",{className:"smwb-indicator_circular__circle",cx:"24",cy:"24",r:"22",ref:t})})}function dr(){const[e,t]=i.useState(null);return _e(()=>{const n=document.createElement("div");return n.id=`snackbar-portal-${Ps.v4()}`,document.body.prepend(n),t(n),()=>{document.body.removeChild(n)}},[]),{snackbarDomRoot:e}}function mr({snack:e,position:t,variant:n,className:a,component:r,autoClose:c,autoCloseTime:l,snackRest:o,onSnackRemove:d,onClose:u}){var f,b,h,w,p;const m=i.useRef(null);return s.jsx(He.CSSTransition,{appear:!0,timeout:125,classNames:{appear:"smwb-snackbar-enter",appearActive:"smwb-snackbar-enter-active",appearDone:"smwb-snackbar-enter-done",enter:"smwb-snackbar-enter",enterActive:"smwb-snackbar-enter-active",enterDone:"smwb-snackbar-enter-done",exitActive:"smwb-snackbar-exit-active"},unmountOnExit:!0,in:!0,nodeRef:m,children:s.jsx(hr,{ref:m,component:(f=e.component)!=null?f:r,message:e.message,position:(b=e.position)!=null?b:t,variant:(h=e.variant)!=null?h:n,onClick:d(e.id),className:y(a,e.className),isAutoClose:(w=e.autoClose)!=null?w:c,autoCloseTime:(p=e.autoCloseTime)!=null?p:l,onClose:u(e.id),...o})})}const Cn=i.createContext({addSnackbar:()=>"",clearAllSnackbars:()=>{},clearFirstSnackbar:()=>{},clearLastSnackbar:()=>{},clearByIdSnackbar:()=>{}});function fr(e){const{position:t="top-right",variant:n="dark",className:a,autoClose:r=!0,autoCloseTime:c=5e3,closeOnClick:l=!0,onClick:o,component:d="div",children:u,...m}=e,[f,b]=i.useState([]),{snackbarDomRoot:h}=dr(),w=i.useCallback(R=>{const{key:k,...N}=R,C=k!=null?k:Ps.v4(),A={id:C,...N};return b(M=>{const I=M.findIndex(D=>D.id===C);if(I===-1)return[...M,A];const z=[...M];return z[I]=A,z}),C},[]),p=()=>{b([])},_=()=>{b(R=>R.slice(1))},v=()=>{b(R=>R.slice(0,-1))},g=R=>{b(k=>k.filter(N=>N.id!==R))},x=R=>k=>{o==null||o(k),l&&g(R)},T=R=>()=>{g(R)},j=f.reduce((R,k)=>{var C,A;const N=(C=k.position)!=null?C:t;return R[N]=[...(A=R[N])!=null?A:[],k],R},{}),S=Object.keys(j).map(R=>{const k=j[R];return s.jsx(He.TransitionGroup,{className:y("smwb-snackbars",`smwb-${R}`),"data-testid":`snackbars-${R}`,appear:!0,children:k.map(N=>s.jsx(mr,{snack:N,position:t,variant:n,className:a,component:d,autoClose:r,autoCloseTime:c,snackRest:m,onSnackRemove:x,onClose:T},N.id))},R)});return s.jsxs(Cn.Provider,{value:{addSnackbar:w,clearAllSnackbars:p,clearFirstSnackbar:_,clearLastSnackbar:v,clearByIdSnackbar:g},children:[u,h&&Re.createPortal(S,h)]})}const hr=i.forwardRef(function({className:t,message:n,variant:a="dark",position:r="top-right",onClick:c,component:l="div",isAutoClose:o,autoCloseTime:d,onClose:u,action:m,...f},b){const h=i.useRef(),w=Me(()=>{!u||!o||!d||(h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{u()},d))});i.useEffect(()=>(w(),()=>{h.current&&clearTimeout(h.current)}),[w]);const p=l;return s.jsxs(p,{ref:b,className:y("smwb-snackbar",t,`smwb-${a}`,`smwb-${r}`),onClick:c,role:"alert","aria-live":a==="danger"?"assertive":"polite","aria-atomic":"true",...f,children:[s.jsx("div",{className:"smwb-snackbar__body",children:n}),m!=null?s.jsx("div",{className:"smwb-snackbar__action",children:m}):null]})});function br(){return i.useContext(Cn)}const wr=i.forwardRef(function({className:t,children:n,placement:a="top",offset:r={offsetX:0,offsetY:0},message:c,open:l,trigger:o="hover",openDelay:d=0,closeDelay:u=0},m){var A,M;const f=Ze(a),[b,h]=i.useState(!1),[w,p]=i.useState(!1),_=i.useRef(null),v=i.useRef(null),g=i.useCallback(()=>{_.current!==null&&(clearTimeout(_.current),_.current=null),v.current!==null&&(clearTimeout(v.current),v.current=null)},[]);i.useEffect(()=>()=>g(),[g]);const x=i.useCallback(()=>{if(g(),d<=0){h(!0);return}_.current=setTimeout(()=>h(!0),d)},[g,d]),T=i.useCallback(()=>{if(g(),u<=0){h(!1);return}v.current=setTimeout(()=>h(!1),u)},[g,u]),{refs:j,floatingStyles:S}=fe.useFloating({placement:f.placement,whileElementsMounted:fe.autoUpdate,middleware:[fe.offset({mainAxis:(A=r==null?void 0:r.offsetY)!=null?A:0,crossAxis:(M=r==null?void 0:r.offsetX)!=null?M:0}),...f.autoMiddleware?[f.autoMiddleware]:[]]}),R=o==="manual"?l===!0:o==="click"?w:b,k=o==="hover"?x:void 0,N=o==="hover"?T:void 0,C=o==="click"?()=>{p(I=>!I)}:void 0;return s.jsxs("div",{className:"smwb-tooltip__wrapper",role:"tooltip",ref:m,children:[s.jsx("div",{className:"smwb-tooltip__ref",ref:j.setReference,onPointerEnter:k,onPointerLeave:N,onClick:C,children:n}),R&&s.jsx("div",{ref:j.setFloating,className:y("smwb-tooltip",t),style:S,children:c})]})}),pr=i.forwardRef(function(t,n){const{className:a,children:r,variant:c="contained",size:l="medium",orientation:o="horizontal",colorTheme:d="primary",color:u,fullWidth:m=!1,disabled:f=!1,...b}=t;return s.jsx("div",{ref:n,className:y("smwb-button-group",a,`smwb-${o}`,`smwb-${c}`,m&&"smwb-full-width",f),role:"group","data-testid":"button-group",...b,children:i.Children.map(r,h=>{var p,_,v,g,x,T;const w=h;return i.cloneElement(w,{className:"smwb-button-group__grouped",fullWidth:o==="vertical"||((p=w.props.fullWidth)!=null?p:m),variant:(_=w.props.variant)!=null?_:c,size:(v=w.props.size)!=null?v:l,disabled:(g=w.props.disabled)!=null?g:f,colorTheme:(x=w.props.colorTheme)!=null?x:d,color:(T=w.props.color)!=null?T:u})})})}),_r=i.forwardRef(function(t,n){const{label:a,disabled:r,readOnly:c,required:l,name:o,id:d,indeterminate:u,className:m,size:f="medium",color:b="primary",onChange:h,helperText:w,error:p,..._}=t,v=dt(d),g=x=>{if(c){x.preventDefault();return}h==null||h(x,x.target.checked,t)};return s.jsx(Le,{helperText:w,disabled:r,error:p,className:"smwb-text-field-checkbox",children:s.jsxs("label",{htmlFor:v,className:y("smwb-checkbox__wrapper",`smwb-checkbox_size-${f}`,`smwb-checkbox_color-${b}`,m,{"smwb-disabled":r,"smwb-readonly":c,"smwb-indeterminate":u}),children:[s.jsx("input",{type:"checkbox",id:v,name:o,className:"smwb-checkbox__input",disabled:r,readOnly:c,required:l,"aria-invalid":p||void 0,"aria-required":l||void 0,ref:n,..._,onChange:g}),s.jsx("span",{className:y("smwb-checkbox__btn",{"smwb-indeterminate":u}),children:u?s.jsx(K,{name:"remove",size:18,className:"smwb-checkbox__icon",weight:700}):s.jsx(K,{name:"check",size:17,className:"smwb-checkbox__icon",weight:700})}),a&&s.jsx("span",{className:"smwb-checkbox__label",children:a})]})})});function ze({className:e,children:t,onMouseDown:n,disabled:a,size:r="medium",edge:c,...l}){const o=i.useRef(null),d=f=>{n==null||n(f)},u=f=>{var b;a||(b=o.current)==null||b.onRipple(f)},m=y("smwb-date-picker__icon-button",e,{"smwb-date-picker__icon-button--small":r==="small","smwb-date-picker__icon-button--edge-start":c==="start","smwb-date-picker__icon-button--edge-end":c==="end","smwb-date-picker__icon-button--disabled":a});return s.jsxs("button",{onMouseDown:d,onPointerDown:u,type:"button",className:m,disabled:a,...l,children:[t,!a&&s.jsx(De,{actionRef:o,center:!0})]})}function zt({label:e,onLeftIconClick:t,onRightIconClick:n,onLabelClick:a,disabled:r,active:c,hiddenSwitches:l,dataToggleId:o,...d}){const u=y("smwb-date-picker__switch",{"smwb-date-picker__switch--hidden":l});return s.jsxs("div",{className:"smwb-date-picker__action",...d,children:[s.jsx("div",{className:u,children:s.jsx(ze,{size:"small",onClick:r?void 0:t,children:s.jsx(K,{name:"keyboard_arrow_left",weight:500,size:24})})}),s.jsxs("div",{className:y("smwb-date-picker__action-label",{"smwb-date-picker__action-label--disabled":r,"smwb-date-picker__action-label--active":c}),"data-testid":o,onClick:r?void 0:a,children:[s.jsx("span",{className:"smwb-date-picker__action-text",children:e}),s.jsx(K,{name:"arrow_drop_down",weight:500,size:20})]}),s.jsx("div",{className:u,children:s.jsx(ze,{size:"small",onClick:r?void 0:n,children:s.jsx(K,{name:"keyboard_arrow_right",weight:500,size:24})})})]})}const Xe=/yyyy|MM|dd/g;function gr(e){const t=[];let n;for(Xe.lastIndex=0;(n=Xe.exec(e))!==null;)t.push(n[0]);return t}function js(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xr(e){let t="^",n=0,a;for(Xe.lastIndex=0;(a=Xe.exec(e))!==null;)t+=js(e.slice(n,a.index)),t+=a[0]==="yyyy"?"(\\d{4})":"(\\d{2})",n=Xe.lastIndex;return t+=js(e.slice(n)),t+="$",new RegExp(t)}function vr(e,t,n){if(t<1||t>12||n<1)return!1;const a=new Date(e,t-1,n);return a.getFullYear()===e&&a.getMonth()===t-1&&a.getDate()===n}function yr(e,t){const n=e.getFullYear(),a=e.getMonth()+1,r=e.getDate();return t.replace(Xe,c=>c==="yyyy"?String(n).padStart(4,"0"):c==="MM"?String(a).padStart(2,"0"):String(r).padStart(2,"0"))}function Sn(e,t){const n=gr(t);if(n.length!==3||!n.includes("yyyy")||!n.includes("MM")||!n.includes("dd"))return;const a=xr(t).exec(e);if(!a)return;let r,c,l;if(n.forEach((o,d)=>{const u=Number(a[d+1]);if(o==="yyyy"){r=u;return}if(o==="MM"){c=u;return}l=u}),!(r===void 0||c===void 0||l===void 0)&&vr(r,c,l))return new Date(r,c-1,l)}function jr(e,t){return Sn(e,t)!==void 0}function es(e,t=0){t=t%7;const n=new Date(e),a=n.getDay(),r=(a<t?7:0)+a-t;return new Date(n.setDate(n.getDate()-r))}function Tn(e,t=0){const n=new Date(es(e,t));return new Date(n.setDate(n.getDate()+6))}function kr(e,t){const n=[],a=new Date(e),c=new Date(t).getTime(),l=a;for(l.setHours(0,0,0,0);l.getTime()<=c;)n.push(new Date(l.getTime())),l.setDate(l.getDate()+1),l.setHours(0,0,0,0);return n}const Nr=(e,t,n)=>{const a=new Intl.DateTimeFormat(n,{weekday:"narrow"});return kr(es(e,t),Tn(e,t)).map(r=>a.format(r))};function Mn(e){const t=new Date(e);return new Date(t.getFullYear(),t.getMonth(),1)}function Dn(e){return En(new Date(e.getFullYear(),e.getMonth()+1,0))}function lt(e,t){return new Date(e)<new Date(t)}function Dt(e,t){return lt(t,e)}function Rr(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}const Cr=(e,t)=>{const n=es(Mn(e),t),a=Tn(Dn(e),t);let r=0,c=n;const l=[];let o=null;for(;lt(c,a);){const d=Math.floor(r/7);l[d]=l[d]||[];const u=c.getDay();o!==u&&(o=u,l[d].push(c),r+=1),c=Rr(c,1)}return l};function Sr(e,t){return Mn(t)<=e&&e<=Dn(t)}function Ht(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function En(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59,999)}function pt(e,t){return Ht(e).getTime()===Ht(t).getTime()}function An(e,t){return ts(e,e.getMonth()+t)}function Tr(e,t){return ss(e,e.getFullYear()+t)}function nt(e){return En(e)}function at(e){return Ht(e)}function In(e){const t=[],n=new Intl.DateTimeFormat(e,{month:"long"});for(let a=0;a<12;a++)t.push({label:n.format(An(new Date("1970-01-01"),a)),value:a});return t}function ts(e,t){const n=new Date(e);return n.setMonth(t),n}function $n(e,t){const n=[];for(let a=e-t;a<=e+t;a++)n.push({label:String(a).padStart(4,"0"),value:a});return n}function ss(e,t){const n=new Date(e);return n.setFullYear(t),n}function Mr(e,t){return new Intl.DateTimeFormat(t,{month:"short"}).format(e)}function Dr(e,t){return new Intl.DateTimeFormat(t,{year:"numeric"}).format(e)}function ot(e,t){return Ne(e)?t?yr(e,t):new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit",year:"numeric"}).format(e):""}function ns(e){if(e)return e;const t={year:"yyyy",month:"MM",day:"dd"};return new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit",year:"numeric"}).formatToParts(new Date("1970-01-01")).map(r=>t[r.type]||r.value).join("")}const Vt=/\d/gi,Er=/[a-zA-Z]/g;function Ar(e){return e?e.replace(Er,"_"):new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit",year:"numeric"}).format(new Date("1970-01-01")).replace(Vt,"_")}function Fn(e){return t=>{let n=0;return t.split("").map((a,r)=>{if(Vt.lastIndex=0,n>e.length-1)return"";const c=e[n],l=e[n+1],o=Vt.test(a)?a:"",d=c==="_"?o:c+o;return n+=d.length,r===t.length-1&&l&&l!=="_"?d?d+l:"":d}).join("")}}function ks(e,t){return jr(e,t)}function Ns(e,t){const n=Sn(e,t);return n||new Date(Number.NaN)}function Ne(e){return Object.prototype.toString.call(e)==="[object Date]"&&!isNaN(e)}function as({viewValue:e,openView:t,onChange:n,onMonthLabelClick:a,onYearLabelClick:r,locale:c}){const l=i.useCallback(u=>()=>{n==null||n(An(e,u))},[n,e]),o=i.useCallback(u=>()=>{n==null||n(Tr(e,u))},[n,e]),d=t===pe.months||t===pe.years;return s.jsxs("div",{className:"smwb-date-picker__header",children:[s.jsx(zt,{label:Mr(e,c),onLeftIconClick:l(-1),onRightIconClick:l(1),onLabelClick:a,disabled:t===pe.years,active:t===pe.months,hiddenSwitches:d,dataToggleId:"date-picker-months-toggle"}),s.jsx(zt,{label:Dr(e,c),onLeftIconClick:o(-1),onRightIconClick:o(1),onLabelClick:r,disabled:t===pe.months,active:t===pe.years,hiddenSwitches:d,dataToggleId:"date-picker-years-toggle"})]})}const Ir=i.memo(function({className:t,children:n,onMouseDown:a,onChange:r,active:c,current:l,hidden:o,outside:d,disabled:u,inRange:m,day:f,...b}){const h=i.useRef(null),w=i.useCallback(g=>{a==null||a(g)},[a]),p=i.useCallback(g=>{var x;u||(x=h.current)==null||x.onRipple(g)},[u]),_=i.useCallback(()=>{u||r==null||r(void 0,f)},[r,f,u]);if(o)return s.jsx("span",{className:"smwb-date-picker__day-hidden"});const v=y("smwb-date-picker__day",t,{"smwb-date-picker__day--active":!u&&c,"smwb-date-picker__day--current":l&&!c,"smwb-date-picker__day--outside":!u&&d,"smwb-date-picker__day--disabled":u,"smwb-date-picker__day--in-range":!u&&m});return s.jsxs("button",{className:v,type:"button",onMouseDown:w,onPointerDown:p,onClick:_,disabled:u,...b,children:[n,!u&&s.jsx(De,{actionRef:h,center:!0})]})});function rs({viewValue:e,value:t,showDaysOutsideMonth:n,onChange:a,disablePast:r,disableFuture:c,weekStartsOn:l=0,minDate:o,maxDate:d,isDateDisabled:u,locale:m,range:f,rangeStart:b,rangeEnd:h}){const[w]=i.useState(new Date),p=i.useMemo(()=>Nr(w,l,m),[w,l,m]),_=i.useMemo(()=>Cr(e,l),[e,l]),v=i.useCallback(j=>f?Ne(b)&&pt(j,b)||Ne(h)&&pt(j,h):Ne(t)?pt(j,t):!1,[t,f,b,h]),g=i.useCallback(j=>!f||!Ne(b)||!Ne(h)?!1:Dt(at(j),at(b))&<(nt(j),nt(h)),[f,b,h]),x=i.useCallback(j=>{let S=!1;return r&&(S=lt(nt(j),w)),c&&(S=S||Dt(at(j),w)),o&<(nt(j),at(o))&&(S=!0),d&&Dt(at(j),nt(d))&&(S=!0),u!=null&&u(j)&&(S=!0),S},[r,c,w,o,d,u]),T=i.useMemo(()=>p.map((j,S)=>s.jsx("span",{className:"smwb-date-picker__week-day",children:j.toString()},S)),[p]);return s.jsxs("div",{className:"smwb-date-picker__days",children:[s.jsx("div",{className:"smwb-date-picker__week-days",children:T}),s.jsx("div",{className:"smwb-date-picker__month",children:_.map((j,S)=>s.jsx("div",{className:"smwb-date-picker__week",children:j.map(R=>{const k=!Sr(R,e);return s.jsx(Ir,{day:R,current:pt(R,w),active:v(R),inRange:g(R),hidden:!n&&k,outside:k,onChange:a,disabled:x(R),children:R.getDate()},R.toISOString())})},S))})]})}const Qe=i.createContext({dense:!1,variant:"floating",onClose:()=>null});function jt(){return i.useContext(Qe)}const qe=i.forwardRef(function(t,n){const{children:a,className:r,disabled:c,selected:l,onClick:o,onMouseDown:d,href:u,linkElement:m,linkProps:f,value:b,optionRenderer:h,...w}=t,{dense:p}=i.useContext(Qe),_=i.useRef(null),v=S=>{if(c){u&&S.preventDefault();return}o==null||o(S)},g=S=>{c||d==null||d(S)},x=S=>{var R;(R=_.current)==null||R.onRipple(S)};let T;if(u){const S=m!=null?m:"a";T=s.jsxs(S,{className:"smwb-menu__item-inner",href:u,...f,children:[a,s.jsx("span",{className:"smwb-menu__item__helper-text"})]})}else T=s.jsx("span",{className:"smwb-menu__item-inner",children:a});const j=y("smwb-menu__item",r,{"smwb-menu__item--dense":p,"smwb-menu__item--disabled":c,"smwb-menu__item--selected":l});return h?h(t):s.jsxs("li",{role:"menuitem",ref:n,className:j,tabIndex:c?void 0:0,onClick:v,"data-value":b,onMouseDown:g,onPointerDown:x,...w,children:[T,s.jsx(De,{actionRef:_})]})}),is=i.forwardRef(function(t,n){const{children:a,className:r,edge:c,...l}=t,{dense:o}=i.useContext(Qe),d=y("smwb-menu__icon",r,{"smwb-menu__icon--dense":o,"smwb-menu__icon--start":c==="start","smwb-menu__icon--end":c==="end"});return s.jsx("span",{ref:n,className:d,...l,children:a})}),ls=i.forwardRef(function(t,n){const{children:a,className:r,inset:c=!1,...l}=t,{dense:o}=i.useContext(Qe),d=y("smwb-menu__text",r,{"smwb-menu__text--inset":c,"smwb-menu__text--dense":o});return s.jsx("span",{ref:n,className:d,...l,children:a})}),Ln=i.forwardRef(function(t,n){const{className:a,...r}=t,{variant:c}=jt();return s.jsx("li",{ref:n,className:y("smwb-menu__divider",a,c==="static"&&"smwb-menu__divider--vertical"),...r})}),Bn=i.forwardRef(function(t,n){const{children:a,className:r,...c}=t,{variant:l,onClose:o}=jt(),d=u=>{var b,h,w,p;const m=Array.from(u.currentTarget.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])'));if(m.length===0)return;const f=m.indexOf(document.activeElement);u.key==="ArrowDown"?(u.preventDefault(),(b=m[(f+1+m.length)%m.length])==null||b.focus()):u.key==="ArrowUp"?(u.preventDefault(),(h=m[(f-1+m.length)%m.length])==null||h.focus()):u.key==="Home"?(u.preventDefault(),(w=m[0])==null||w.focus()):u.key==="End"?(u.preventDefault(),(p=m[m.length-1])==null||p.focus()):u.key==="Escape"&&o()};return s.jsx("div",{ref:n,className:y("smwb-menu",r,`smwb-menu--${l}`),...c,children:s.jsx("ul",{className:y("smwb-menu__list",`smwb-menu__list--${l}`),role:"menu","aria-orientation":"vertical",onKeyDown:d,children:a})})});function $r(e,t){return yt(e,t)}const Fr=e=>({transition:`opacity ${e}ms ease-in-out`,opacity:0}),Lr={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0}},On=i.forwardRef(function(t,n){const{anchorElement:a,isOpen:r,onClose:c,placement:l="bottom-start",middleware:o,style:d,...u}=t,[m,f]=i.useState(null),b=i.useRef(null),h=Ze(l),{refs:w,floatingStyles:p}=fe.useFloating({open:!!r,placement:h.placement,whileElementsMounted:fe.autoUpdate,elements:{reference:a!=null?a:null},middleware:$r(h,o)}),_=ge(n,b,f,w.setFloating),v=g=>{if(!r||!c||!m)return;const x=g.target;m.contains(x)||a!=null&&a.contains(x)||c==null||c()};return s.jsx(vt,{nodeRef:b,in:!!r,timeout:150,unmountOnExit:!0,children:g=>s.jsx(Je,{onClickAway:v,children:s.jsx(Bn,{ref:_,style:{...p,...d,...Fr(150),...Lr[g]},...u})})})}),Br=i.forwardRef(function e(t,n){const{children:a,toggleElement:r,placement:c="right-start",onClose:l,openOnHover:o,...d}=t,[u,m]=i.useState(!1),[f,b]=i.useState(null),h=jt(),w=[fe.offset(({placement:x})=>{switch(x){case"right-start":case"left-start":return{crossAxis:-8,mainAxis:0};case"right-end":case"left-end":return{crossAxis:8,mainAxis:0};default:return{crossAxis:0,mainAxis:0}}})],p=x=>{x.button===0&&m(T=>!T)},_=()=>{m(!1),l==null||l()},v=x=>{x.key==="ArrowRight"||x.key==="Enter"||x.key===" "?(x.preventDefault(),m(!0)):(x.key==="ArrowLeft"||x.key==="Escape")&&m(!1)},g=i.cloneElement(r,{ref:b,onClick:p,onKeyDown:v,onMouseEnter:o?()=>m(!0):void 0,"aria-haspopup":"menu","aria-expanded":u,selected:u});return s.jsxs(Qe.Provider,{value:{...h,variant:"floating"},children:[g,s.jsx(On,{ref:n,...d,placement:c,isOpen:u,onClose:_,anchorElement:f,middleware:w,children:i.Children.map(a,x=>{if(!i.isValidElement(x))return null;if(x.type===e)return x;const T=x;return i.cloneElement(T,{onClick:j=>{var S,R;(R=(S=T.props).onClick)==null||R.call(S,j),_(),h.onClose()}})})})]})}),Or=i.forwardRef(function(t,n){const{variant:a}=jt();if(a==="static"){const{anchorElement:r,isOpen:c,onClose:l,placement:o,middleware:d,...u}=t;return s.jsx(Bn,{ref:n,...u})}return s.jsx(On,{ref:n,...t})}),kt=i.forwardRef(function(t,n){const{dense:a=!1,variant:r="floating",onClose:c,...l}=t,o=()=>{c==null||c()};return s.jsx(Qe.Provider,{value:{dense:a,variant:r,onClose:o},children:s.jsx(Or,{ref:n,onClose:c,...l})})});function ut({value:e,items:t,onChange:n}){const a=i.useRef(null),r=i.useRef(null);_e(()=>{if(a.current&&r.current){const o=(a.current.offsetHeight-r.current.offsetHeight)/2;a.current.scrollTop=r.current.offsetTop-o}});const c=i.useCallback(o=>()=>{n==null||n(o)},[n]),l=i.useCallback(o=>d=>{e===o&&(r.current=d)},[e]);return s.jsx("div",{className:"smwb-date-picker__overflow",ref:a,"data-testid":"date-picker-list",children:s.jsx("ul",{className:"smwb-date-picker__list",children:t.map(({label:o,value:d})=>{const u=e===d;return s.jsxs(qe,{selected:u,onClick:c(d),ref:l(d),children:[u&&s.jsx(is,{children:s.jsx(K,{name:"check",weight:500,size:24})}),s.jsx(ls,{className:"smwb-date-picker__list-item",inset:!u,children:o})]},d)})})})}const Pr=ns();function Pn({value:e,onChange:t,onBlur:n,format:a}){const r=i.useMemo(()=>a?ns(a):Pr,[a]),[c,l]=i.useState(ot(e,a)),o=i.useMemo(()=>Ar(a),[a]),d=i.useMemo(()=>Fn(o),[o]),u=i.useRef(void 0);i.useEffect(()=>{const w=e!==u.current;u.current=e,w&&l(ot(e,a))},[e,a]);const m=w=>{l(w),t&&(ks(w,r)?t(void 0,Ns(w,r)):w===""&&t(void 0))},f=i.useCallback(()=>{var w,p,_,v;n&&(ks((p=(w=u.current)==null?void 0:w.toString())!=null?p:"",r)?n(void 0,Ns((v=(_=u.current)==null?void 0:_.toString())!=null?v:"",r)):u.current===""&&n(void 0),l(ot(e,a)))},[n,e,a,r]),b=Xt.useRifm({value:c,onChange:m,format:d}),h=r.toLowerCase();return{...b,onBlur:f,placeholder:h}}function zr(e){e.stopPropagation()}const zn=i.forwardRef(function(t,n){const{value:a,onChange:r,onBlur:c,onToggle:l,disabled:o,disableCalendar:d,calendarIcon:u,format:m,...f}=t,b=Pn({value:a,onChange:r,onBlur:c,format:m});return s.jsx(Be,{ref:n,...b,type:"tel",endAdornment:!d&&s.jsx(ze,{edge:"end",onClick:l,onMouseDown:zr,disabled:!!o,"data-testid":"date-picker-icon-button",children:u||s.jsx(K,{name:"calendar_today",fill:1,weight:500,size:24})}),disabled:!!o,...f})});var pe=(e=>(e.days="days",e.months="months",e.years="years",e))(pe||{});const Hr=e=>({transition:`opacity ${e}ms ease-in-out`,opacity:0}),Vr={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0}},Yr=i.forwardRef(function(t,n){const{value:a,onChange:r,showDaysOutsideMonth:c,disablePast:l,disableFuture:o,weekStartsOn:d=1,placement:u="bottom-start",disabled:m,disableCalendar:f,calendarAriaLabel:b="Choose date",minDate:h,maxDate:w,isDateDisabled:p,locale:_,format:v,range:g,rangeValue:x,onRangeChange:T,calendarIcon:j,onBlur:S,...R}=t,k=i.useMemo(()=>a===void 0?void 0:new Date(a),[a]),N=x!==void 0,[C,A]=i.useState([void 0,void 0]),M=N&&x?x:C,[I,z]=i.useState(()=>Ne(k)?k:new Date),[D,E]=i.useState("days"),[$,B]=i.useState(!1),U=i.useRef(null),te=i.useRef(null),G=Ze(u),{refs:ce,floatingStyles:Q}=fe.useFloating({open:$,placement:G.placement,whileElementsMounted:fe.autoUpdate,middleware:yt(G)}),se=ge(U,ce.setReference,n),F=ge(te,ce.setFloating);_e(()=>{m||z(Ne(k)?k:new Date)},[k,m]);const O=i.useCallback(L=>{z(L)},[]),X=i.useCallback(()=>{E(D==="months"?"days":"months")},[D]),W=i.useCallback(()=>{E(D==="years"?"days":"years")},[D]),Z=i.useCallback(L=>{z(ts(I,L)),E("days")},[I]),ae=i.useCallback(L=>{z(ss(I,L)),E("days")},[I]),de=i.useCallback((L,H)=>{if(g){if(!H)return;const[le,ne]=M;let P;!le||le&&ne?P=[H,void 0]:P=Ne(le)&&H.getTime()<le.getTime()?[H,le]:[le,H],N||A(P),T==null||T(P),P[0]&&P[1]&&B(!1);return}r==null||r(L,H,t),B(!1)},[r,t,g,M,N,T]),ie=i.useCallback(()=>{m||B(L=>!L)},[m]),xe=i.useCallback(L=>{var le,ne;const H=L.target;(le=te.current)!=null&&le.contains(H)||(ne=U.current)!=null&&ne.contains(H)||B(!1)},[]),ee=i.useMemo(()=>In(_),[_]),me=i.useMemo(()=>$n(new Date().getFullYear(),100),[]);let J=null;switch(D){case"days":J=s.jsx(rs,{viewValue:I,value:k,showDaysOutsideMonth:c,onChange:de,disablePast:l,disableFuture:o,weekStartsOn:d,minDate:h,maxDate:w,isDateDisabled:p,locale:_,range:g,rangeStart:M[0],rangeEnd:M[1]});break;case"months":J=s.jsx(ut,{value:I.getMonth(),items:ee,onChange:Z});break;case"years":J=s.jsx(ut,{value:I.getFullYear(),items:me,onChange:ae});break}const be=g&&(M[0]||M[1])?`${ot(M[0],v)} – ${ot(M[1],v)}`:"";return s.jsxs(s.Fragment,{children:[g?s.jsx(Be,{ref:se,value:be,readOnly:!0,onChange:()=>{},disabled:!!m,placeholder:v?`${v} – ${v}`:void 0,endAdornment:!f&&s.jsx(ze,{edge:"end",onClick:ie,disabled:!!m,"data-testid":"date-picker-icon-button",children:j||s.jsx(K,{name:"calendar_today",fill:1,weight:500,size:24})}),...R}):s.jsx(zn,{ref:se,value:k,onChange:r,onBlur:S,onToggle:ie,disabled:m,disableCalendar:f,format:v,calendarIcon:j,...R}),Re.createPortal(s.jsx(vt,{nodeRef:te,in:$&&!m&&!f,timeout:150,mountOnEnter:!0,unmountOnExit:!0,children:L=>s.jsx(Je,{onClickAway:xe,children:s.jsx("div",{ref:F,className:"smwb-date-picker",style:{...Q,...Hr(150),...Vr[L]},"data-testid":"date-picker",role:"dialog","aria-modal":"false","aria-label":b,children:s.jsxs("div",{className:"smwb-date-picker__inner",children:[s.jsx(as,{viewValue:I,locale:_,openView:D,onChange:O,onMonthLabelClick:X,onYearLabelClick:W}),s.jsx("div",{className:"smwb-date-picker__body",children:J})]})})})}),document.body)]})}),Ke=/yyyy|MM|dd|HH|mm|ss/g;function Xr(e){const t=[];let n;for(Ke.lastIndex=0;(n=Ke.exec(e))!==null;)t.push(n[0]);return t}function Rs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Kr(e){let t="^",n=0,a;for(Ke.lastIndex=0;(a=Ke.exec(e))!==null;)t+=Rs(e.slice(n,a.index)),t+=a[0]==="yyyy"?"(\\d{4})":"(\\d{2})",n=Ke.lastIndex;return t+=Rs(e.slice(n)),t+="$",new RegExp(t)}function Wr(e,t,n){if(t<1||t>12||n<1)return!1;const a=new Date(e,t-1,n);return a.getFullYear()===e&&a.getMonth()===t-1&&a.getDate()===n}function Ur(e,t,n){return e>=0&&e<=23&&t>=0&&t<=59&&n>=0&&n<=59}function Gr(e,t){const n=e.getFullYear(),a=e.getMonth()+1,r=e.getDate(),c=e.getHours(),l=e.getMinutes(),o=e.getSeconds();return t.replace(Ke,d=>d==="yyyy"?String(n).padStart(4,"0"):d==="MM"?String(a).padStart(2,"0"):d==="dd"?String(r).padStart(2,"0"):d==="HH"?String(c).padStart(2,"0"):d==="mm"?String(l).padStart(2,"0"):String(o).padStart(2,"0"))}function Hn(e,t){const n=Xr(t);if(!n.includes("yyyy")||!n.includes("MM")||!n.includes("dd")||!n.includes("HH")||!n.includes("mm"))return;const a=Kr(t).exec(e);if(!a)return;let r,c,l,o,d,u=0;if(n.forEach((m,f)=>{const b=Number(a[f+1]);if(m==="yyyy"){r=b;return}if(m==="MM"){c=b;return}if(m==="dd"){l=b;return}if(m==="HH"){o=b;return}if(m==="mm"){d=b;return}u=b}),!(r===void 0||c===void 0||l===void 0||o===void 0||d===void 0)&&!(!Wr(r,c,l)||!Ur(o,d,u)))return new Date(r,c-1,l,o,d,u)}function Et(e,t){return Hn(e,t)!==void 0}const qr=/[a-zA-Z]/g;function it(e,t){return!e||Object.prototype.toString.call(e)!=="[object Date]"||isNaN(e)?"":t?Gr(e,t):new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function xt(e){return e||`${ns()} HH:mm`}function Zr(e){return xt(e).replace(qr,"_")}function Cs(e,t){const n=Hn(e,t);return n||new Date(Number.NaN)}function Vn({value:e,onChange:t,onBlur:n,format:a}){const r=i.useMemo(()=>xt(a),[a]),[c,l]=i.useState(it(e,a)),o=i.useMemo(()=>Zr(a),[a]),d=i.useMemo(()=>Fn(o),[o]),u=i.useRef(void 0);i.useEffect(()=>{const h=e!==u.current;u.current=e,h&&l(it(e,a))},[e,a]);const m=h=>{l(h),t&&(Et(h,r)?t(void 0,Cs(h,r)):h===""&&t(void 0))},f=i.useCallback(()=>{if(!n)return;const h=u.current;h instanceof Date&&Et(it(h,a),r)?n(void 0,h):typeof h=="string"&&Et(h,r)?n(void 0,Cs(h,r)):(h===void 0||h==="")&&n(void 0),l(it(e,a))},[n,e,a,r]);return{...Xt.useRifm({value:c,onChange:m,format:d}),onBlur:f,placeholder:xt(a).toLowerCase()}}function Jr(e){e.stopPropagation()}const Yn=i.forwardRef(function(t,n){const{value:a,onChange:r,onBlur:c,onToggle:l,disabled:o,disableCalendar:d,calendarIcon:u,format:m,...f}=t,b=Vn({value:a,onChange:r,onBlur:c,format:m});return s.jsx(Be,{ref:n,...b,type:"tel",endAdornment:!d&&s.jsx(ze,{edge:"end",onClick:l,onMouseDown:Jr,disabled:!!o,"data-testid":"date-time-picker-icon-button",children:u||s.jsx(K,{name:"event",fill:1,weight:500,size:24})}),disabled:!!o,...f})});function At({value:e,items:t,onChange:n}){const a=i.useRef(null),r=i.useRef(null);_e(()=>{if(a.current&&r.current){const o=(a.current.offsetHeight-r.current.offsetHeight)/2;a.current.scrollTop=r.current.offsetTop-o}});const c=i.useCallback(o=>()=>{n==null||n(o)},[n]),l=i.useCallback(o=>d=>{e===o&&(r.current=d)},[e]);return s.jsx("div",{className:"smwb-time-picker__overflow",ref:a,"data-testid":"time-picker-list",children:s.jsx("ul",{className:"smwb-time-picker__list",children:t.map(({label:o,value:d})=>{const u=e===d;return s.jsx("li",{ref:l(d),className:y("smwb-time-picker__item",{"smwb-time-picker__item--selected":u}),onClick:c(d),children:o},d)})})})}const We=/HH|mm|ss/g;function Xn(e){const t=[];let n;for(We.lastIndex=0;(n=We.exec(e))!==null;)t.push(n[0]);return t}function Ss(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qr(e){let t="^",n=0,a;for(We.lastIndex=0;(a=We.exec(e))!==null;)t+=Ss(e.slice(n,a.index)),t+="(\\d{2})",n=We.lastIndex;return t+=Ss(e.slice(n)),t+="$",new RegExp(t)}function ei(e,t,n){return e>=0&&e<=23&&t>=0&&t<=59&&n>=0&&n<=59}function ti(e){return Xn(e).includes("ss")}function si(e,t){const n=e.getHours(),a=e.getMinutes(),r=e.getSeconds();return t.replace(We,c=>c==="HH"?String(n).padStart(2,"0"):c==="mm"?String(a).padStart(2,"0"):String(r).padStart(2,"0"))}function Kn(e,t){const n=Xn(t);if(!n.includes("HH")||!n.includes("mm"))return;const a=Qr(t).exec(e);if(!a)return;let r,c,l=0;if(n.forEach((d,u)=>{const m=Number(a[u+1]);if(d==="HH"){r=m;return}if(d==="mm"){c=m;return}l=m}),r===void 0||c===void 0||!ei(r,c,l))return;const o=new Date;return new Date(o.getFullYear(),o.getMonth(),o.getDate(),r,c,l)}function ni(e,t){return Kn(e,t)!==void 0}const Ts=/\d/gi,ai=/[a-zA-Z]/g,mt="HH:mm";function ri(){return Array.from({length:24},(e,t)=>({value:t,label:String(t).padStart(2,"0")}))}function ii(){return Array.from({length:60},(e,t)=>({value:t,label:String(t).padStart(2,"0")}))}function li(){return Array.from({length:60},(e,t)=>({value:t,label:String(t).padStart(2,"0")}))}function It(e,t,n,a){const r=new Date(e);return r.setHours(t,n,a,0),r}function _t(e,t){return Pe(e)?si(e,t!=null?t:mt):""}function os(e){return e!=null?e:mt}function oi(e){return os(e).replace(ai,"_")}function ci(e){return t=>{let n=0;return t.split("").map((a,r)=>{if(Ts.lastIndex=0,n>e.length-1)return"";const c=e[n],l=e[n+1],o=Ts.test(a)?a:"",d=c==="_"?o:c+o;return n+=d.length,r===t.length-1&&l&&l!=="_"?d?d+l:"":d}).join("")}}function $t(e,t){return ni(e,t)}function Ms(e,t){const n=Kn(e,t);return n||new Date(Number.NaN)}function Pe(e){return Object.prototype.toString.call(e)==="[object Date]"&&!isNaN(e)}function ui(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),0)}function di(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),0)}function cs({value:e,format:t,onChange:n,onComplete:a}){const r=i.useMemo(()=>Pe(e)?e:new Date,[e]),c=t!=null?t:mt,l=ti(c),o=i.useMemo(()=>ri(),[]),d=i.useMemo(()=>ii(),[]),u=i.useMemo(()=>li(),[]),m=i.useCallback(h=>{n(It(r,h,r.getMinutes(),r.getSeconds()))},[r,n]),f=i.useCallback(h=>{n(It(r,r.getHours(),h,r.getSeconds())),l||a==null||a()},[r,n,a,l]),b=i.useCallback(h=>{n(It(r,r.getHours(),r.getMinutes(),h)),a==null||a()},[r,n,a]);return s.jsxs("div",{className:"smwb-time-picker__columns","data-testid":"time-picker-columns",children:[s.jsx("div",{className:"smwb-time-picker__column",children:s.jsx(At,{value:r.getHours(),items:o,onChange:m})}),s.jsx("div",{className:"smwb-time-picker__column",children:s.jsx(At,{value:r.getMinutes(),items:d,onChange:f})}),l&&s.jsx("div",{className:"smwb-time-picker__column",children:s.jsx(At,{value:r.getSeconds(),items:u,onChange:b})})]})}const mi=e=>({transition:`opacity ${e}ms ease-in-out`,opacity:0}),fi={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0}},hi=i.forwardRef(function(t,n){const{value:a,onChange:r,showDaysOutsideMonth:c,disablePast:l,disableFuture:o,weekStartsOn:d=1,placement:u="bottom-start",disabled:m,disableCalendar:f,calendarAriaLabel:b="Choose date and time",minDate:h,maxDate:w,isDateDisabled:p,locale:_,format:v,timeFormat:g,calendarIcon:x,onBlur:T,...j}=t,S=i.useMemo(()=>a===void 0?void 0:new Date(a),[a]),[R,k]=i.useState(()=>Ne(S)||Pe(S)?S:new Date),[N,C]=i.useState(pe.days),[A,M]=i.useState(!1),I=i.useRef(null),z=i.useRef(null),D=Ze(u),{refs:E,floatingStyles:$}=fe.useFloating({open:A,placement:D.placement,whileElementsMounted:fe.autoUpdate,middleware:yt(D)}),B=ge(I,E.setReference,n),U=ge(z,E.setFloating);_e(()=>{m||k(Ne(S)||Pe(S)?S:new Date)},[S,m]);const te=i.useCallback(ee=>{k(ee)},[]),G=i.useCallback(()=>{C(N===pe.months?pe.days:pe.months)},[N]),ce=i.useCallback(()=>{C(N===pe.years?pe.days:pe.years)},[N]),Q=i.useCallback(ee=>{k(ts(R,ee)),C(pe.days)},[R]),se=i.useCallback(ee=>{k(ss(R,ee)),C(pe.days)},[R]),F=i.useCallback(ee=>{k(ee),r==null||r(void 0,ee,t)},[r,t]),O=i.useCallback((ee,me)=>{if(!me)return;const J=Pe(S)?S:R;F(di(me,J))},[F,S,R]),X=i.useCallback(ee=>{const me=Ne(S)?S:R;F(ui(me,ee))},[F,S,R]),W=i.useCallback(()=>{m||M(ee=>!ee)},[m]),Z=i.useCallback(ee=>{var J,be;const me=ee.target;(J=z.current)!=null&&J.contains(me)||(be=I.current)!=null&&be.contains(me)||M(!1)},[]),ae=i.useMemo(()=>g||(v!=null&&v.includes("HH:mm:ss")?"HH:mm:ss":mt),[v,g]),de=i.useMemo(()=>In(_),[_]),ie=i.useMemo(()=>$n(new Date().getFullYear(),100),[]);let xe=null;switch(N){case pe.days:xe=s.jsx(rs,{viewValue:R,value:S,showDaysOutsideMonth:c,onChange:O,disablePast:l,disableFuture:o,weekStartsOn:d,minDate:h,maxDate:w,isDateDisabled:p,locale:_});break;case pe.months:xe=s.jsx(ut,{value:R.getMonth(),items:de,onChange:Q});break;case pe.years:xe=s.jsx(ut,{value:R.getFullYear(),items:ie,onChange:se});break}return s.jsxs(s.Fragment,{children:[s.jsx(Yn,{ref:B,value:S,onChange:r,onBlur:T,onToggle:W,disabled:m,disableCalendar:f,format:v,calendarIcon:x,...j}),Re.createPortal(s.jsx(vt,{nodeRef:z,in:A&&!m&&!f,timeout:150,mountOnEnter:!0,unmountOnExit:!0,children:ee=>s.jsx(Je,{onClickAway:Z,children:s.jsx("div",{ref:U,className:"smwb-date-picker smwb-date-time-picker",style:{...$,...mi(150),...fi[ee]},"data-testid":"date-time-picker",role:"dialog","aria-modal":"false","aria-label":b,children:s.jsxs("div",{className:"smwb-date-picker__inner smwb-date-time-picker__inner",children:[s.jsx(as,{viewValue:R,locale:_,openView:N,onChange:te,onMonthLabelClick:G,onYearLabelClick:ce}),s.jsxs("div",{className:"smwb-date-time-picker__content",children:[s.jsx("div",{className:"smwb-date-picker__body smwb-date-time-picker__body",children:xe}),s.jsx(cs,{value:R,format:ae,onChange:X})]})]})})})}),document.body)]})}),bi=os();function Wn({value:e,onChange:t,onBlur:n,format:a}){const r=i.useMemo(()=>os(a),[a]),[c,l]=i.useState(_t(e,a)),o=i.useMemo(()=>oi(a),[a]),d=i.useMemo(()=>ci(o),[o]),u=i.useRef(void 0);i.useEffect(()=>{const h=e!==u.current;u.current=e,h&&l(_t(e,a))},[e,a]);const m=h=>{l(h),t&&($t(h,r)?t(void 0,Ms(h,r)):h===""&&t(void 0))},f=i.useCallback(()=>{if(!n)return;const h=u.current;h instanceof Date&&$t(_t(h,a),r)?n(void 0,h):typeof h=="string"&&$t(h,r)?n(void 0,Ms(h,r)):(h===void 0||h==="")&&n(void 0),l(_t(e,a))},[n,e,a,r]);return{...Xt.useRifm({value:c,onChange:m,format:d}),onBlur:f,placeholder:(a!=null?a:bi).toLowerCase()}}function wi(e){e.stopPropagation()}const Un=i.forwardRef(function(t,n){const{value:a,onChange:r,onBlur:c,onToggle:l,disabled:o,disableClock:d,clockIcon:u,format:m,...f}=t,b=Wn({value:a,onChange:r,onBlur:c,format:m});return s.jsx(Be,{ref:n,...b,type:"tel",endAdornment:!d&&s.jsx(ze,{edge:"end",onClick:l,onMouseDown:wi,disabled:!!o,"data-testid":"time-picker-icon-button",children:u||s.jsx(K,{name:"schedule",fill:1,weight:500,size:24})}),disabled:!!o,...f})}),pi=e=>({transition:`opacity ${e}ms ease-in-out`,opacity:0}),_i={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0}},gi=i.forwardRef(function(t,n){const{value:a,onChange:r,placement:c="bottom-start",disabled:l,disableClock:o,clockAriaLabel:d="Choose time",format:u,onBlur:m,...f}=t,b=i.useMemo(()=>a===void 0?void 0:new Date(a),[a]),[h,w]=i.useState(()=>Pe(b)?b:new Date),[p,_]=i.useState(!1),v=i.useRef(null),g=i.useRef(null),x=Ze(c),{refs:T,floatingStyles:j}=fe.useFloating({open:p,placement:x.placement,whileElementsMounted:fe.autoUpdate,middleware:yt(x)}),S=ge(v,T.setReference,n),R=ge(g,T.setFloating);_e(()=>{l||w(Pe(b)?b:new Date)},[b,l]);const k=i.useCallback(()=>{l||_(M=>!M)},[l]),N=i.useCallback(M=>{var z,D;const I=M.target;(z=g.current)!=null&&z.contains(I)||(D=v.current)!=null&&D.contains(I)||_(!1)},[]),C=i.useCallback(M=>{w(M),r==null||r(void 0,M,t)},[r,t]),A=i.useCallback(()=>{_(!1)},[]);return s.jsxs(s.Fragment,{children:[s.jsx(Un,{ref:S,value:b,onChange:r,onBlur:m,onToggle:k,disabled:l,disableClock:o,format:u,...f}),Re.createPortal(s.jsx(vt,{nodeRef:g,in:p&&!l&&!o,timeout:150,mountOnEnter:!0,unmountOnExit:!0,children:M=>s.jsx(Je,{onClickAway:N,children:s.jsx("div",{ref:R,className:"smwb-date-picker smwb-time-picker",style:{...j,...pi(150),..._i[M]},"data-testid":"time-picker",role:"dialog","aria-modal":"false","aria-label":d,children:s.jsx("div",{className:"smwb-date-picker__inner",children:s.jsx(cs,{value:h,format:u,onChange:C,onComplete:A})})})})}),document.body)]})}),xi=i.forwardRef(function(t,n){const{label:a,disabled:r,readOnly:c,required:l,name:o,id:d,size:u="medium",color:m="primary",helperText:f,error:b,onChange:h,className:w,...p}=t,_=dt(d),v=g=>{if(c){g.preventDefault();return}h==null||h(g,t.value!==void 0?t.value:g.target.checked,t)};return s.jsx(Le,{helperText:f,disabled:r,error:b,className:"smwb-text-field-checkbox",children:s.jsxs("label",{htmlFor:_,className:y("smwb-radio",`smwb-radio_size-${u}`,`smwb-radio_color-${m}`,{"smwb-disabled":r,"smwb-readonly":c}),children:[s.jsxs("span",{className:"smwb-radio__wrapper",children:[s.jsx("input",{id:_,name:o,disabled:r,readOnly:c,required:l,"aria-invalid":b||void 0,"aria-required":l||void 0,className:y("smwb-radio__input",w),type:"radio","data-testid":"radio",ref:n,...p,onChange:v}),s.jsx("span",{className:y("smwb-radio__btn",{"smwb-disabled":r})}),s.jsx("span",{className:y("smwb-radio__bg",{"smwb-disabled":r})})]}),a&&s.jsx("span",{className:"smwb-radio__label",children:a})]})})}),vi=i.forwardRef(function({className:t,value:n,defaultValue:a=0,max:r=5,precision:c=1,readOnly:l=!1,disabled:o=!1,size:d=28,icon:u,emptyIcon:m,name:f,color:b="primary",error:h,helperText:w,id:p,onChange:_},v){const g=n!==void 0,[x,T]=i.useState(a),[j,S]=i.useState(null),R=n!==void 0?n:x,k=j!=null?j:R,N=!l&&!o,C=(E,$)=>{if(c===1)return $+1;const{left:B,width:U}=E.currentTarget.getBoundingClientRect(),te=E.clientX-B<U/2;return $+(te?.5:1)},A=(E,$)=>{if(!N)return;const B=C(E,$);g||T(B),_==null||_(B)},M=u!=null?u:s.jsx(K,{name:"star",fill:1,size:d}),I=m!=null?m:s.jsx(K,{name:"star",size:d}),z=E=>{const $=Math.max(0,Math.min(r,E));g||T($),_==null||_($)},D=E=>{N&&(E.key==="ArrowRight"||E.key==="ArrowUp"?(E.preventDefault(),z(R+c)):E.key==="ArrowLeft"||E.key==="ArrowDown"?(E.preventDefault(),z(R-c)):E.key==="Home"?(E.preventDefault(),z(0)):E.key==="End"&&(E.preventDefault(),z(r)))};return s.jsxs("span",{ref:v,id:p,className:y("smwb-rating",{"smwb-rating_readonly":l,"smwb-rating_disabled":o,"smwb-rating_error":h},b!=="primary"&&`smwb-rating_color-${b}`,t),"data-testid":"rating",role:"img","aria-label":`${R} of ${r}`,tabIndex:N?0:void 0,onKeyDown:N?D:void 0,children:[Array.from({length:r},(E,$)=>{const B=Math.max(0,Math.min(1,k-$));return s.jsxs("span",{className:"smwb-rating__item",style:{width:d,height:d,cursor:N?"pointer":"default"},onClick:U=>A(U,$),onMouseMove:N&&c===.5?U=>S(C(U,$)):N?()=>S($+1):void 0,onMouseLeave:N?()=>S(null):void 0,children:[s.jsx("span",{className:"smwb-rating__icon smwb-rating__icon_empty",children:I}),s.jsx("span",{className:"smwb-rating__icon smwb-rating__icon_filled",style:{width:`${B*100}%`},children:M})]},$)}),f?s.jsx("input",{type:"hidden",name:f,value:R,readOnly:!0}):null,w!=null&&w!==!1?s.jsx("span",{className:y("smwb-rating__helper",h&&"smwb-rating__helper_error"),children:w}):null]})});function yi({menuMaxHeight:e,menuMiddleware:t,search:n,onSearchInputChange:a,items:r,searchValue:c,isOpen:l,onClose:o,anchorElementRef:d,value:u,onItemClick:m,isLoading:f,optionRenderer:b,menuNoItemsMessage:h,container:w=document.body,createOption:p,virtualized:_,itemHeight:v=40}){const g=Array.isArray(u)?u:[u],x=r.some(D=>!!D.group);let T;const j=!!_&&!x&&!f&&r.length>0,S=e||240,{startIndex:R,endIndex:k,totalHeight:N,offsetY:C,onScroll:A}=Kt({itemCount:j?r.length:0,itemHeight:v,viewportHeight:S}),M=D=>{var $;const E=[];return x&&D.group!==T&&(T=D.group,E.push(s.jsx("li",{className:"smwb-select-field__group-label",role:"presentation",children:D.group},`group-${($=D.group)!=null?$:"ungrouped"}`))),E.push(s.jsxs(qe,{value:D.value,disabled:D.disabled,selected:!!g.find(B=>B===D.value),onClick:B=>{D.disabled||m(B,D)},optionRenderer:b,children:[D.text,D.helperText?s.jsx("span",{className:"smwb-select-field__option__helper-text",children:D.helperText}):null]},D.key||D.value)),E},[I,z]=i.useState();return i.useEffect(()=>{l&&d.current&&z(d.current.clientWidth)},[d,l]),i.useEffect(()=>{const D=E=>{l&&E.key==="Escape"&&o()};return document.addEventListener("keydown",D),()=>{document.removeEventListener("keydown",D)}},[l,o]),Re.createPortal(s.jsxs(kt,{isOpen:l,onClose:o,anchorElement:d.current,middleware:t,style:{minWidth:I,maxHeight:e||void 0,overflowY:e?"auto":void 0},children:[n&&s.jsxs(s.Fragment,{children:[s.jsx("li",{className:"smwb-select-field__menu-search",children:s.jsx(Be,{className:"smwb-select-field__menu-search-input",type:"text",placeholder:"Найти...",value:c,onChange:(D,E)=>a==null?void 0:a(D,E.value),fullWidth:!0})}),s.jsx(Ln,{})]}),f?s.jsx("div",{className:"smwb-select-field__menu-loading",children:s.jsx(Nn,{type:"indeterminate",variant:"circular",className:"smwb-select-field__menu__loader"})}):j?s.jsx("li",{role:"presentation",className:"smwb-select-field__virtual-viewport",children:s.jsx("div",{className:"smwb-select-field__virtual-scroller",style:{maxHeight:S,overflowY:"auto"},onScroll:A,children:s.jsx("div",{style:{height:N,position:"relative"},children:s.jsx("ul",{role:"presentation",className:"smwb-select-field__virtual-list",style:{transform:`translateY(${C}px)`,listStyle:"none",margin:0,padding:0},children:r.slice(R,k).map(D=>M(D))})})})}):r.length?r.map(D=>M(D)):p?null:s.jsx("li",{className:"smwb-select-field__empty-items",children:h||"Опций не найдено."}),p?s.jsx(qe,{value:"__create__",onClick:D=>p.onCreate(D),className:"smwb-select-field__create-option",children:p.text},"__create__"):null]}),w)}const ji=e=>s.jsx(K,{name:"arrow_drop_down",...e}),ki=e=>s.jsx(K,{name:"close",size:20,...e});function Ds(e){e.preventDefault(),e.stopPropagation()}const Ni=i.forwardRef(function(t,n){const{className:a,value:r,defaultValue:c,onChange:l,disabled:o,readOnly:d,name:u,multiple:m,menuMaxHeight:f,menuMiddleware:b,menuNoItemsMessage:h,menuContainer:w,search:p,chips:_,isFocused:v,error:g,items:x,label:T,variant:j="outlined",fullWidth:S,helperText:R,onSearch:k,resetSearch:N,isLoading:C,inline:A,endAdornment:M,hideSelectArrowIcon:I,optionRenderer:z,clearable:D,creatable:E,onCreate:$,virtualized:B,itemHeight:U,"aria-label":te,id:G,...ce}=t,[Q,se]=i.useState(!1),[F,O]=i.useState(c),[X,W]=i.useState(()=>{const Y=r!=null?r:c;if(Array.isArray(Y))return x.filter(ye=>Y.includes(ye.value));const ue=Y==null?void 0:x.find(ye=>ye.value===Y);return ue?[ue]:[]}),[Z,ae]=i.useState(""),{current:de}=i.useRef(r!=null),ie=i.useRef(null),xe=ge(n,ie),ee=i.useRef(null),me=i.useRef(null),J=de?r:F,be=i.useMemo(()=>v||Q,[v,Q]),L=Y=>{var ue;Y.button===0&&(Y.preventDefault(),(ue=ie.current)==null||ue.focus(),se(!Q))},H=()=>{var Y;se(!1),(Y=ie.current)==null||Y.focus()},le=()=>{var Y;p===!0&&((Y=me.current)==null||Y.focus())},ne=Y=>{d||[" ","ArrowUp","ArrowDown","Enter"].includes(Y.key)&&(Y.preventDefault(),se(!Q))};i.useEffect(()=>{(!be||p==="menu"&&!Q)&&(ae(""),N==null||N())},[be,p,Q,N]),i.useEffect(()=>{if(Array.isArray(J))W(x.filter(Y=>J.includes(Y.value)));else if(J==null||J==="")W([]);else{const Y=x.find(ue=>ue.value===J);W(Y?[Y]:[])}},[J,x]),_e(()=>{ee.current&&(ee.current.scrollLeft=ee.current.scrollWidth)},[J]);const P=(Y,ue)=>{l==null||l(Y,{...t,value:ue,name:u||void 0}),O(ue)},re=(Y,ue)=>{var Fe;let ye,Ee;if(m){const ft=Array.isArray(J)?J:[J].filter(Boolean);ye=ft.slice(),Ee=X.slice();const et=ft.findIndex(Nt=>Nt===ue.value);et===-1?(ye.push(ue.value),Ee.push(ue)):(ye.splice(et,1),Ee.splice(et,1))}else ye=J===ue.value?"":ue.value,Ee=[ue];Z&&ae(""),m||(se(!1),(Fe=ie.current)==null||Fe.focus()),W(Ee),P(Y,ye)},oe=Y=>{ae(Y.target.value),k==null||k(Y),Q||se(!0)},je=Y=>ue=>{if(Array.isArray(J)){const ye=J.filter(Fe=>Y!==Fe);P(ue,ye);const Ee=X.filter(Fe=>Fe.value!==Y);W(Ee)}},ke=Y=>{P(Y,[]),W([])};let Ce;const Se=y("smwb-select-field",a,{"smwb-select-field--filled":j==="filled"&&T,"smwb-select-field--disabled":o,"smwb-select-field--search":p,"smwb-select-field--inline":A});return _?Ce=X.map(({key:Y,value:ue,text:ye})=>s.jsx(Jt,{label:ye,onDelete:je(ue),onDeleteMouseDown:Ds},Y||ue)):Ce=X.map(Y=>Y.text).join(", "),s.jsxs(s.Fragment,{children:[s.jsx(Le,{label:T,helperText:R,variant:j,disabled:o,className:a,error:g,fullWidth:S,isFilledState:!!X.length||!!Z,isFocused:be,inline:A,...ce,children:s.jsxs("span",{ref:xe,id:G,className:Se,tabIndex:o?void 0:0,role:"button","aria-haspopup":"listbox","aria-expanded":Q,"aria-disabled":o||void 0,"aria-label":te,onMouseDown:o||d?void 0:L,onFocus:le,onKeyDown:ne,"data-testid":"select-field",children:[s.jsxs("span",{className:"smwb-select-field__search-wrapper",ref:ee,children:[Ce&&s.jsx("span",{className:"smwb-select-field__values",children:Ce}),p&&typeof p=="boolean"&&!d&&s.jsxs("span",{className:"smwb-select-field__search",children:[s.jsx("span",{className:"smwb-select-field__search-text",children:Z}),s.jsx("input",{className:"smwb-select-field__search-input",ref:me,type:"text",value:Z,onChange:oe,onMouseDown:Y=>{Y.stopPropagation(),se(!0)},onKeyDown:Y=>{Y.stopPropagation()},"data-testid":"search-input"})]})]}),s.jsxs("span",{className:"smwb-select-field__actions",children:[(Array.isArray(J)&&J.length>0||D&&X.length>0)&&!o&&s.jsx(ki,{onClick:ke,onMouseDown:Ds,className:y("smwb-select-field__icon","smwb-select-field__icon--close"),"aria-label":"Clear selection",role:"button"}),M,!I&&s.jsx(ji,{className:y("smwb-select-field__icon","smwb-select-field__icon--arrow",{"smwb-select-field__icon--opened":Q,"smwb-select-field__icon--focused":be,"smwb-select-field__icon--error":g})})]})]})}),s.jsx(yi,{anchorElementRef:ie,menuMaxHeight:f,menuMiddleware:b,search:p==="menu",onSearchInputChange:oe,optionRenderer:z,items:k?x:Z?x.filter(Y=>Y.text.search(new RegExp(Z,"i"))!==-1):x,searchValue:Z,isOpen:Q,onClose:H,onItemClick:re,value:J,isLoading:C,menuNoItemsMessage:h,container:w,virtualized:B,itemHeight:U,createOption:E&&Z&&!x.some(Y=>Y.text.toLowerCase()===String(Z).toLowerCase())?{text:`Создать "${Z}"`,onCreate:Y=>{$==null||$(String(Z),Y),ae(""),se(!1)}}:void 0})]})});function ct(e,t,n){return(e-t)/(n-t)*100}function Ri(e){return(`${e}`.split(".")[1]||"").length}function Es(e,t,n){return Math.max(t,Math.min(e,n))}function As(e,t=1){const n=Math.pow(10,t);return Math.round(e*n)/n}function Ci(e,t,n,a){if(a==null||a<=0)return Es(e,t,n);const r=Ri(a),c=As(Math.round((e-t)/a)*a,r),l=As(Math.floor((n-t)/a)*a,r);return t+Es(c,0,l)}function Yt(e,t,n,a={}){const r=(e-t[0])/(t[1]-t[0])*(n[1]-n[0])+n[0];return Ci(r,n[0],n[1],a.step)}function Gn(e){return e instanceof MouseEvent?e.clientX:e instanceof TouchEvent?e.changedTouches[0].clientX:0}function qn(e){return e instanceof MouseEvent?e.clientY:e instanceof TouchEvent?e.changedTouches[0].clientY:0}function Zn(e,t,n,a){if(!e)return[];if(Array.isArray(e))return e;const r=a&&a>0?a:(n-t)/10,c=[];for(let l=t;l<=n+1e-9;l+=r)c.push({value:Math.round(l*1e6)/1e6});return c}const Si=i.forwardRef(function(t,n){const{defaultValue:a,value:r,onChange:c,min:l=0,max:o=100,name:d,disabled:u=!1,className:m,step:f,label:b,helperText:h,error:w,size:p="medium",color:_="primary",orientation:v="horizontal",marks:g,getAriaValueText:x,"aria-label":T,range:j,variant:S,valueField:R,withTicks:k,...N}=t,C=v==="vertical",A=L=>{var P,re,oe,je;const H=Array.isArray(L)?L:[l,o],le=Math.min((P=H[0])!=null?P:l,(re=H[1])!=null?re:o),ne=Math.max((oe=H[0])!=null?oe:l,(je=H[1])!=null?je:o);return[le,ne]},M=r!==void 0,[I,z]=i.useState(()=>A(a)),D=M?A(r):I,E=i.useRef(null),$=ge(n,E),B=i.useRef(0),U=i.useRef(!1),te=Zn(g,l,o,f),G=L=>{var ne;const H=(ne=E.current)==null?void 0:ne.getBoundingClientRect();if(!H)return l;if(C){const P=(typeof L.clientY=="number"?L.clientY:qn(L))-H.top;return Yt(H.height-P,[0,H.height],[l,o],{step:f})}const le=(typeof L.clientX=="number"?L.clientX:Gn(L))-H.left;return Yt(le,[0,H.width],[l,o],{step:f})},ce=(L,H)=>{const le=Math.min(L[0],L[1]),ne=Math.max(L[0],L[1]),P=[Math.max(l,le),Math.min(o,ne)];M||z(P),c==null||c(H,P,t)},Q=(L,H)=>{const le=B.current,ne=[D[0],D[1]];ne[le]=Math.max(l,Math.min(o,L)),ce(ne,H)},se=L=>{B.current=Math.abs(L-D[0])<=Math.abs(L-D[1])?0:1},F=Me(L=>{U.current&&(L.preventDefault(),Q(G(L),L))}),O=Me(()=>{U.current=!1,document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",O),document.removeEventListener("touchmove",F),document.removeEventListener("touchend",O)}),X=L=>{if(u||L.button!==0)return;const H=G(L);se(H),U.current=!0,Q(H,L),document.addEventListener("mousemove",F),document.addEventListener("mouseup",O)},W=L=>{if(u)return;const H=G(L);se(H),U.current=!0,Q(H,L),document.addEventListener("touchmove",F),document.addEventListener("touchend",O)};_e(()=>{const L=E.current;if(L)return L.addEventListener("touchstart",W),()=>L.removeEventListener("touchstart",W)});const Z=L=>H=>{if(u)return;const le=f&&f>0?f:1;let ne=null;H.key==="ArrowLeft"||H.key==="ArrowDown"?ne=D[L]-le:H.key==="ArrowRight"||H.key==="ArrowUp"?ne=D[L]+le:H.key==="Home"?ne=l:H.key==="End"&&(ne=o),ne!==null&&(H.preventDefault(),B.current=L,Q(ne,H))},ae=y("smwb-slider","smwb-slider--range",m,{"smwb-slider--disabled":u,"smwb-slider--vertical":C},p!=="medium"&&`smwb-slider_size-${p}`,_!=="primary"&&`smwb-slider_color-${_}`),de=ct(D[0],l,o),ie=ct(D[1],l,o),xe=`${Math.min(de,ie)}%`,ee=`${Math.abs(ie-de)}%`,me=C?{bottom:`${de}%`}:{left:`${de}%`},J=C?{bottom:`${ie}%`}:{left:`${ie}%`},be=C?{bottom:xe,height:ee}:{left:xe,width:ee};return s.jsx(Le,{label:b,helperText:h,disabled:u,error:w,fullWidth:!0,shrink:!0,children:s.jsx("div",{className:"smwb-slider__container",children:s.jsxs("span",{ref:$,onMouseDown:X,className:ae,...N,children:[te.length>0&&s.jsx("span",{className:"smwb-slider__marks","aria-hidden":"true",children:te.map(L=>{const H=`${ct(L.value,l,o)}%`;return s.jsx("span",{className:"smwb-slider__mark",style:C?{bottom:H}:{left:H},children:L.label!=null&&s.jsx("span",{className:"smwb-slider__mark-label",children:L.label})},L.value)})}),s.jsx("span",{className:"smwb-slider__rail"}),s.jsx("span",{className:"smwb-slider__track",style:be}),[0,1].map(L=>s.jsx("span",{className:y("smwb-slider__thumb",`smwb-slider__thumb--${L===0?"start":"end"}`),style:L===0?me:J,children:s.jsx("input",{"data-testid":`slider-input-${L}`,className:"smwb-slider__input",type:"range",min:l,max:o,step:f,name:d?`${d}[${L}]`:void 0,value:D[L],disabled:u,onChange:()=>{},onKeyDown:Z(L),tabIndex:u?-1:0,"aria-label":T?`${T} ${L===0?"minimum":"maximum"}`:void 0,"aria-orientation":v,"aria-valuenow":D[L],"aria-valuemin":L===0?l:D[0],"aria-valuemax":L===0?D[1]:o,"aria-valuetext":x?x(D[L]):void 0,"aria-disabled":u||void 0})},L))]})})})}),Ti=i.forwardRef(function(t,n){const{defaultValue:a,value:r,onChange:c,min:l=0,max:o=100,name:d,disabled:u=!1,className:m,step:f,variant:b="continuous",valueField:h,withTicks:w,label:p,helperText:_,error:v,size:g="medium",color:x="primary",orientation:T="horizontal",marks:j,range:S,getAriaValueText:R,"aria-label":k,...N}=t,C=typeof a=="number"?a:void 0,A=typeof r=="number"?r:void 0,M=T==="vertical",[I,z]=i.useState(C!=null?C:l),[D,E]=i.useState(!1),[$,B]=i.useState(!1),[U,te]=i.useState(!1),G=i.useRef(null),ce=ge(n,G),Q=i.useRef(!1),se=A!==void 0,F=b==="discrete",O=se?A:I,X=(P,re)=>{P<l||P>o||(se||z(P),c==null||c(re,P,t))},W=(P,re)=>Yt(P,[0,re],[l,o],{step:f}),Z=P=>{if(u||P.button!==0)return;Q.current=!0;const re=G.current,oe=re==null?void 0:re.getBoundingClientRect();if(oe){const je=M?oe.height-(P.clientY-oe.top):P.clientX-oe.left,ke=W(je,M?oe.height:oe.width);$||B(!0),X(ke,P)}document.addEventListener("mousemove",de),document.addEventListener("mouseup",ie)},ae=P=>{var je;if(u)return;Q.current=!0;const re=G.current,oe=re==null?void 0:re.getBoundingClientRect();if(oe){const ke=(je=P.changedTouches)==null?void 0:je[0],Ce=M?oe.height-(ke.clientY-oe.top):ke.clientX-oe.left,Se=W(Ce,M?oe.height:oe.width);$||B(!0),X(Se,P)}document.addEventListener("touchmove",de),document.addEventListener("touchend",ie)},de=Me(P=>{if(Q.current){const re=G.current,oe=re==null?void 0:re.getBoundingClientRect();if(oe){const je=Gn(P),ke=qn(P),Ce=M?oe.height-(ke-oe.top):je-oe.left,Se=W(Ce,M?oe.height:oe.width);if($||B(!0),O===Se)return;D||E(!0),X(Se,P)}}}),ie=Me(()=>{Q.current=!1,D&&E(!1),$&&B(!1),xe()}),xe=()=>{document.removeEventListener("mousemove",de),document.removeEventListener("mouseup",ie),document.removeEventListener("touchmove",de),document.removeEventListener("touchend",ie)},ee=P=>{!U||u||((P.key==="ArrowLeft"||P.key==="ArrowDown")&&X(O-(f||1),P),(P.key==="ArrowRight"||P.key==="ArrowUp")&&X(O+(f||1),P))},me=()=>{te(!1),document.removeEventListener("keydown",ee)};_e(()=>{if(G.current)return G.current.addEventListener("touchstart",ae),()=>{var P;(P=G.current)==null||P.removeEventListener("touchstart",ae)}}),_e(()=>{var P,re;u&&((P=G.current)!=null&&P.contains(document.activeElement))&&((re=document.activeElement)==null||re.blur())},[u]);const J=y("smwb-slider",m,{"smwb-slider--disabled":u,"smwb-slider--dragging":D,"smwb-slider--discrete":F,"smwb-slider--vertical":M},g!=="medium"&&`smwb-slider_size-${g}`,x!=="primary"&&`smwb-slider_color-${x}`),be=`${ct(O,l,o)}%`,L=M?{height:be}:{width:be},H=M?{bottom:be}:{left:be},le=()=>Array(Math.round(o/(f||1))+1).fill(1),ne=Zn(j,l,o,f);return s.jsx(Le,{label:p,helperText:_,disabled:u,error:v,fullWidth:!0,shrink:!0,children:s.jsxs("div",{className:"smwb-slider__container",children:[s.jsxs("span",{onKeyDown:ee,ref:ce,onMouseDown:Z,className:J,tabIndex:u?-1:0,onFocus:()=>te(!0),onBlur:me,...N,children:[w&&s.jsx("span",{className:"smwb-slider__ticks",style:{gap:`${f}`},children:le().map((P,re)=>s.jsx("span",{className:"smwb-slider__tick"},re))}),ne.length>0&&s.jsx("span",{className:"smwb-slider__marks","aria-hidden":"true",children:ne.map(P=>{const re=`${ct(P.value,l,o)}%`;return s.jsx("span",{className:"smwb-slider__mark",style:M?{bottom:re}:{left:re},children:P.label!=null&&s.jsx("span",{className:"smwb-slider__mark-label",children:P.label})},P.value)})}),s.jsx("span",{className:"smwb-slider__rail"}),s.jsx("span",{className:"smwb-slider__track",style:L}),s.jsxs("span",{className:y("smwb-slider__thumb",{"smwb-slider__thumb--active":$,"smwb-slider__thumb--discrete":F}),style:H,children:[F&&s.jsx("span",{className:"smwb-slider__thumb-tooltip",children:Math.round(O)}),s.jsx("input",{"data-testid":"slider-input",className:"smwb-slider__input",type:"range",min:l,max:o,name:d,value:O,readOnly:!0,"aria-label":k,"aria-orientation":T,"aria-valuenow":O,"aria-valuemin":l,"aria-valuemax":o,"aria-valuetext":R?R(O):void 0,"aria-disabled":u||void 0})]})]}),h&&F&&s.jsx(Be,{type:"number",value:O,onChange:P=>X(+P.target.value,P),variant:"filled",helperText:null})]})})}),Jn=i.forwardRef(function(t,n){return t.range===!0||Array.isArray(t.value)||Array.isArray(t.defaultValue)?s.jsx(Si,{ref:n,...t}):s.jsx(Ti,{ref:n,...t})});function Mi(e,t){return typeof e=="function"?e(t):Array.isArray(t)?`${t[0]} – ${t[1]}`:t==null?"":String(t)}function Di({readout:e,endAdornment:t,onReset:n,resetLabel:a,label:r,className:c,...l}){const o=e!==void 0&&e!==!1,d=r!=null||o||t!=null||n!=null;return s.jsxs("div",{className:y("smwb-value-slider",c),children:[d?s.jsxs("div",{className:"smwb-value-slider__header",children:[r!=null?s.jsx("span",{className:"smwb-value-slider__label",children:r}):null,s.jsx("span",{className:"smwb-value-slider__spacer"}),o?s.jsx("span",{className:"smwb-value-slider__readout",children:Mi(e,l.value)}):null,t,n!=null?s.jsx("button",{type:"button",className:"smwb-value-slider__reset","aria-label":a!=null?a:"Reset",disabled:!!l.disabled,onClick:()=>n(),children:s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7M3 4v4h4",strokeLinecap:"round",strokeLinejoin:"round"})})}):null]}):null,s.jsx(Jn,{...l})]})}const Ei=i.forwardRef(function(t,n){const{disabled:a,readOnly:r,required:c,checked:l,className:o,id:d,label:u,labelPlacement:m,size:f="medium",color:b="primary",helperText:h,error:w,...p}=t,_=dt(d),v=g=>{var x;if(r){g.preventDefault();return}(x=t.onChange)==null||x.call(t,g,g.target.checked,t)};return s.jsx(Le,{helperText:h,disabled:a,error:w,className:"smwb-text-field-checkbox",children:s.jsxs("span",{className:y("smwb-toggle__wrapper",m&&`smwb-toggle__wrapper_label-${m}`),children:[u?s.jsx("label",{htmlFor:_,className:"smwb-toggle__label",children:u}):null,s.jsxs("label",{className:y("smwb-toggle",`smwb-toggle_size-${f}`,`smwb-toggle_color-${b}`,o,{"smwb-disabled":a,"smwb-readonly":r}),children:[s.jsx("input",{type:"checkbox",id:_,className:"smwb-toggle__checkbox","aria-checked":l,"aria-invalid":w||void 0,"aria-required":c||void 0,role:"switch",checked:l,disabled:a,readOnly:r,required:c,ref:n,...p,onChange:v}),s.jsx("span",{className:"smwb-toggle__track"}),s.jsx("span",{className:"smwb-toggle__thumb"})]})]})})}),Ai=i.forwardRef(function({className:t,...n},a){return s.jsx("div",{ref:a,"data-testid":"grid",className:y("smwb-grid",t),...n})}),Ii=["wrap","nowrap","wrap-reverse"],$i=["flex-start","center","flex-end","space-between","space-around","space-evenly"],Fi=["flex-start","center","flex-end","stretch","baseline"],Li=["row","row-reverse","column","column-reverse"],Bi=i.forwardRef(function({className:t,justifyContent:n,alignItems:a,direction:r,wrap:c,spacing:l,...o},d){const u=n&&$i.includes(n)&&n!=="flex-start",m=a&&Fi.includes(a)&&a!=="flex-start",f=r&&Li.includes(r)&&r!=="row",b=c&&Ii.includes(c)&&c!=="wrap",h=y("smwb-grid__row",t,{[`smwb-grid__row--spacing-${l}`]:l,[`smwb-grid__row--justifyContent-${n}`]:u,[`smwb-grid__row--alignItems-${a}`]:m,[`smwb-grid__row--direction-${r}`]:f,[`smwb-grid__row--${c}`]:b});return s.jsx("div",{ref:d,"data-testid":"grid-row",className:h,...o})}),Oi=e=>e===void 0?{}:typeof e=="boolean"?{"smwb-grid__column--hidden":e}:Object.keys(e).reduce((t,n)=>(t[`smwb-grid__column--hidden-${n}`]=e[n]===!0,t[`smwb-grid__column--visible-${n}`]=e[n]===!1,t),{}),Pi=i.forwardRef(function({className:t,xs:n,sm:a,md:r,lg:c,xl:l,xsOffset:o,smOffset:d,mdOffset:u,lgOffset:m,xlOffset:f,hidden:b,...h},w){const p=y("smwb-grid__column",t,{[`smwb-grid__column--xs-${n}`]:n,[`smwb-grid__column--sm-${a}`]:a,[`smwb-grid__column--md-${r}`]:r,[`smwb-grid__column--lg-${c}`]:c,[`smwb-grid__column--xl-${l}`]:l,[`smwb-grid__column--xs-offset-${o}`]:o,[`smwb-grid__column--sm-offset-${d}`]:d,[`smwb-grid__column--md-offset-${u}`]:u,[`smwb-grid__column--lg-offset-${m}`]:m,[`smwb-grid__column--xl-offset-${f}`]:f,...Oi(b)});return s.jsx("div",{ref:w,className:p,"data-testid":"grid-col",...h})}),zi=i.forwardRef(function({className:t,maxWidth:n="lg",disableGutters:a=!1,...r},c){const l=y("smwb-container",{[`smwb-container--${n}`]:n!==!1,"smwb-container--gutterless":a},t);return s.jsx("div",{ref:c,"data-testid":"grid-container",className:l,...r})}),Hi={default:void 0,primary:"var(--smui-primaryColor)",secondary:"var(--smui-secondaryColor)",error:"var(--smui-errorColor)",success:"var(--smui-successColor)",warning:"var(--smui-warningColor)",info:"var(--smui-infoColor)"},Vi=i.forwardRef(function({className:t,orientation:n="horizontal",variant:a="fullWidth",textAlign:r="center",color:c="default",thickness:l,flexItem:o,style:d,children:u,...m},f){const b=u!=null&&u!==!1,h=Hi[c],w=typeof l=="number"?`${l}px`:l,p={...d,...h?{borderColor:h}:{},...w?n==="vertical"?{borderLeftWidth:w}:{borderBottomWidth:w}:{}},_=y("smwb-divider",`smwb-divider_${n}`,`smwb-divider_${a}`,{"smwb-divider_with-text":b&&n==="horizontal",[`smwb-divider_align-${r}`]:b&&n==="horizontal","smwb-divider_flex-item":o},t);return s.jsx("div",{...m,ref:f,"data-testid":"divider",role:"separator","aria-orientation":n,className:_,style:p,children:b&&n==="horizontal"?s.jsx("span",{className:"smwb-divider__text",children:u}):null})});function Yi(e,t){let n=0,a,r;const c=(o,d)=>{n=o,e(...d)},l=(...o)=>{const d=Date.now(),u=t-(d-n);r=o,u<=0||u>t?(a!==void 0&&(clearTimeout(a),a=void 0),c(d,o)):a===void 0&&(a=setTimeout(()=>{a=void 0,r!==void 0&&c(Date.now(),r)},u))};return l.cancel=()=>{a!==void 0&&(clearTimeout(a),a=void 0),n=0,r=void 0},l}const Is=(e,t)=>!e&&t?100-t:e||50,Xi=i.forwardRef(function({className:t,orientation:n="horizontal",sizeFirst:a,sizeSecond:r,children:c,onSizeChange:l,keyboardStep:o=5,resizerAriaLabel:d="Resize panels"},u){const m=i.useRef(null),f=ge(u,m),[b,h]=i.useState(Is(a,r)),[w,p]=i.useState(null),[_,v]=i.useState(!1);i.useEffect(()=>{h(Is(a,r))},[a,r]);const g=i.Children.toArray(c);if(g.length>2)throw new Error("Allowed not more than 2 children");const x=()=>{p(m.current),v(!0)},T=i.useMemo(()=>Yi(N=>{if(!_)return;const C=m.current;if(!C||C!==w)return;const A=C.getBoundingClientRect(),M=n==="vertical"?A.height:A.width,I=n==="vertical"?N.clientY-A.top:N.clientX-A.left,z=Math.max(5,Math.min(M-5,I));h(z/M*100)},1e3/60),[_,w,n]),j=i.useCallback(()=>{p(null),v(!1),document.body.removeEventListener("pointerup",j),document.body.removeEventListener("pointermove",T)},[T]);i.useEffect(()=>{l==null||l(b)},[b,l]);const S=N=>{const C=n==="vertical"?"ArrowUp":"ArrowLeft",A=n==="vertical"?"ArrowDown":"ArrowRight";N.key===C?(N.preventDefault(),h(M=>Math.max(0,M-o))):N.key===A?(N.preventDefault(),h(M=>Math.min(100,M+o))):N.key==="Home"?(N.preventDefault(),h(0)):N.key==="End"&&(N.preventDefault(),h(100))},R=n==="vertical"?{height:`${100-b}%`}:{width:`${100-b}%`},k=n==="vertical"?{height:`${b}%`}:{width:`${b}%`};return i.useEffect(()=>(_?(document.body.addEventListener("pointerup",j),document.body.addEventListener("pointermove",T),document.body.style.cursor=n==="horizontal"?"e-resize":"n-resize"):document.body.style.cursor="default",()=>{document.body.removeEventListener("pointerup",j),document.body.removeEventListener("pointermove",T)}),[T,j,_,n]),s.jsxs("div",{className:y("smwb-screen-divider__wrapper",`smwb-${n}`,t),ref:f,"data-testid":"screen-divider",children:[s.jsx("div",{className:y("smwb-screen-divider__first",`smwb-${n}`),style:k,children:g[0]||""}),s.jsx("span",{className:"smwb-screen-divider__resizer",onPointerDown:x,draggable:!1,role:"separator","aria-orientation":n==="vertical"?"horizontal":"vertical","aria-valuenow":Math.round(b),"aria-valuemin":0,"aria-valuemax":100,"aria-label":d,tabIndex:0,onKeyDown:S}),s.jsx("div",{className:y("smwb-screen-divider__second",`smwb-${n}`),style:R,children:g[1]||""})]})}),Ki=i.forwardRef(function({isOpen:t,onClose:n,variant:a="default",children:r,placement:c="bottom",disableOutsideClick:l,closeOnEsc:o=!0,...d},u){const[m,f]=i.useState(null),b=i.useRef(null);i.useEffect(()=>{if(!t||!o||!n)return;const p=_=>{_.key==="Escape"&&n()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,o,n]);const h=()=>{f(m==="expanded"?"small":m?null:"expanded")},w=()=>{n==null||n(),f(null)};return Re.createPortal(s.jsx(He.CSSTransition,{in:t,timeout:70,mountOnEnter:!0,unmountOnExit:!0,classNames:{enterDone:"smwb-entered"},appear:!0,nodeRef:b,children:a==="default"?s.jsx("div",{className:y(l?"smwb-sheet__overlay":"smwb-sheet__default"),ref:b,children:s.jsx($s,{ref:u,onClose:n,handleSizeButton:h,handleClose:w,isOpen:t,mode:m,placement:c,variant:a,...d,children:r})}):s.jsx("div",{className:y("smwb-sheet__overlay","smwb-dark",`smwb-${c}`,`smwb-sheet_${a}`),ref:b,children:s.jsx(Je,{onClickAway:()=>!l&&w(),children:s.jsx($s,{ref:u,onClose:n,handleSizeButton:h,handleClose:w,isOpen:t,mode:m,placement:c,variant:a,...d,children:r})})})}),document.body)}),Wi=e=>e==="bottom"||e==="top",$s=i.forwardRef(function(t,n){const{isOpen:a,placement:r,className:c,mode:l,size:o="60%",variant:d,onClose:u,withSizeToggle:m=!0,hideHeaderActions:f=!1,reverseHeaderActions:b=!1,resizable:h=!1,minSize:w=80,maxSize:p,resizeStep:_=24,resizeHandleAriaLabel:v="Resize sheet",onResize:g,style:x,handleClose:T,handleSizeButton:j,children:S,...R}=t,k=!f&&(!!u||m),N=[];m&&N.push(s.jsx(Te,{variant:"outlined",size:"small",onClick:j,children:s.jsx(K,{name:"open_in_full"})},"size")),u&&N.push(s.jsx(Te,{variant:"outlined",size:"small",onClick:T,children:s.jsx(K,{name:"close"})},"close")),b&&N.reverse();const C=i.useRef(null),A=i.useRef(null),M=ge(n,C,A),[I,z]=i.useState(null),D=Wi(r),E=i.useCallback(F=>{const O=D?window.innerHeight:window.innerWidth,X=p!=null?p:O;return Math.max(w,Math.min(X,F))},[D,p,w]),$=i.useCallback(()=>{var O;const F=(O=A.current)==null?void 0:O.getBoundingClientRect();return F?D?F.height:F.width:w},[D,w]),B=i.useCallback(F=>{const O=E(F);z(O),g==null||g(O)},[E,g]),U=i.useRef(null),te=i.useCallback(F=>{var O,X;F.preventDefault(),U.current={start:D?F.clientY:F.clientX,size:$()};try{(X=(O=F.currentTarget).setPointerCapture)==null||X.call(O,F.pointerId)}catch{}},[D,$]),G=i.useCallback(F=>{const O=U.current;if(!O)return;const W=(D?F.clientY:F.clientX)-O.start,Z=r==="bottom"||r==="right"?-W:W;B(O.size+Z)},[D,r,B]),ce=i.useCallback(F=>{var O,X,W,Z;U.current=null,(X=(O=F.currentTarget).hasPointerCapture)!=null&&X.call(O,F.pointerId)&&((Z=(W=F.currentTarget).releasePointerCapture)==null||Z.call(W,F.pointerId))},[]),Q=i.useCallback(F=>{const O=I!=null?I:$(),X=p!=null?p:D?window.innerHeight:window.innerWidth,W=r==="bottom"?"ArrowUp":r==="top"?"ArrowDown":r==="left"?"ArrowRight":"ArrowLeft",Z=r==="bottom"?"ArrowDown":r==="top"?"ArrowUp":r==="left"?"ArrowLeft":"ArrowRight";F.key===W?(F.preventDefault(),B(O+_)):F.key===Z?(F.preventDefault(),B(O-_)):F.key==="Home"?(F.preventDefault(),B(w)):F.key==="End"&&(F.preventDefault(),B(X))},[I,$,D,r,B,_,w,p]);i.useEffect(()=>{var F;if(!a){z(null);return}(F=A.current)==null||F.focus()},[a]);const se=h&&I!==null?{...D?{height:I}:{width:I},transition:"none"}:{};return s.jsx(He.CSSTransition,{in:a,timeout:120,appear:!0,classNames:{enterDone:"smwb-sheet_entered"},nodeRef:C,children:s.jsxs("div",{ref:M,"data-testid":"sheet",tabIndex:-1,role:"dialog","aria-modal":d==="modal"||void 0,...R,className:y("smwb-sheet",c,`smwb-sheet_${d}`,`smwb-${r}`,{"smwb-expanded":l==="expanded","smwb-small":l==="small","smwb-sheet_resizable":h}),style:{"--sizeProp":o,...se,...x},children:[h&&s.jsx("div",{className:"smwb-sheet__drag-handle","data-testid":"sheet-drag-handle",role:"separator",tabIndex:0,"aria-orientation":D?"horizontal":"vertical","aria-label":v,"aria-valuemin":w,"aria-valuemax":Math.round(p!=null?p:D?window.innerHeight:window.innerWidth),"aria-valuenow":Math.round(I!=null?I:$()),onPointerDown:te,onPointerMove:G,onPointerUp:ce,onPointerCancel:ce,onKeyDown:Q,children:s.jsx("span",{className:"smwb-sheet__drag-handle-bar"})}),k&&s.jsx("div",{className:"smwb-sheet__header",children:N}),a&&l!=="small"&&s.jsx("div",{className:"smwb-sheet__inner",children:S})]})})}),Fs=e=>e==="start"||e==="end"?`flex-${e}`:e,Ui=e=>typeof e=="number"?`calc(var(--smui-spacing-unit, 4px) * ${e})`:e==="none"?"0":`var(--smui-space-${e})`,Gi=i.forwardRef(function({direction:t="column",spacing:n="md",align:a,justify:r,wrap:c,divider:l,className:o,style:d,children:u,...m},f){const b=i.Children.toArray(u).filter(i.isValidElement);return s.jsx("div",{ref:f,"data-testid":"stack",className:y("smwb-stack",o),style:{display:"flex",flexDirection:t,flexWrap:c?"wrap":void 0,alignItems:Fs(a),justifyContent:Fs(r),gap:Ui(n),...d},...m,children:l?b.map((h,w)=>s.jsxs(i.Fragment,{children:[w>0?s.jsx("div",{className:"smwb-stack__divider",children:l}):null,h]},w)):u})}),qi=i.forwardRef(function({maxWidth:t="lg",disableGutters:n=!1,component:a,className:r,children:c,...l},o){const d=a!=null?a:"main";return s.jsx(d,{ref:o,"data-testid":"page",className:y("smwb-page",`smwb-page_max-${t}`,{"smwb-page_gutterless":n},r),...l,children:s.jsx("div",{className:"smwb-page__inner",children:c})})}),Zi=i.forwardRef(function({title:t,subtitle:n,breadcrumbs:a,actions:r,divider:c=!1,className:l,...o},d){return s.jsxs("header",{ref:d,"data-testid":"page-header",className:y("smwb-page-header",{"smwb-page-header_divider":c},l),...o,children:[a?s.jsx("div",{className:"smwb-page-header__breadcrumbs",children:a}):null,s.jsxs("div",{className:"smwb-page-header__row",children:[s.jsxs("div",{className:"smwb-page-header__titles",children:[typeof t=="string"?s.jsx(Ge,{variant:"h4",component:"h1",className:"smwb-page-header__title",children:t}):s.jsx("div",{className:"smwb-page-header__title",children:t}),n?s.jsx(Ge,{variant:"body2",color:"textSecondary",className:"smwb-page-header__subtitle",children:n}):null]}),r?s.jsx("div",{className:"smwb-page-header__actions",children:r}):null]})]})}),Ls=e=>typeof e=="number"?`${e}px`:e,Ji=i.forwardRef(function({header:t,sidebar:n,footer:a,sidebarWidth:r=260,sidebarCollapsed:c,defaultSidebarCollapsed:l=!1,onSidebarCollapsedChange:o,collapsible:d=!1,collapseToggle:u,collapseToggleAriaLabel:m="Toggle navigation",sidebarCollapsedWidth:f=72,stickyHeader:b=!0,className:h,style:w,children:p,..._},v){const[g,x]=$e({value:c,defaultValue:l,onChange:o}),T=i.useId(),j={"--smui-app-sidebar-w":Ls(g?f:r)};return s.jsxs("div",{ref:v,"data-testid":"app-layout",className:y("smwb-app-layout",{"smwb-app-layout_sticky-header":b,"smwb-app-layout_collapsed":g},h),style:{...j,...w},..._,children:[t?s.jsx("div",{className:"smwb-app-layout__header",children:t}):null,s.jsxs("div",{className:"smwb-app-layout__body",children:[n?s.jsxs("aside",{id:T,className:"smwb-app-layout__sidebar",children:[d?s.jsx("div",{className:"smwb-app-layout__collapse",children:u!=null?u:s.jsx("button",{type:"button",className:"smwb-app-layout__collapse-btn","aria-label":m,"aria-expanded":!g,"aria-controls":T,onClick:()=>x(!g),children:s.jsx(K,{name:g?"chevron_right":"chevron_left",size:20})})}):null,n]}):null,s.jsxs("div",{className:"smwb-app-layout__content",children:[p,a?s.jsx("div",{className:"smwb-app-layout__footer",children:a}):null]})]})]})}),Qi=i.forwardRef(function({className:t,children:n,dense:a,position:r="static",placement:c="top",leftContent:l,midContent:o,midContentAlign:d="middle",rightContent:u,title:m,color:f="default",...b},h){const w=c==="top"?"header":"footer";return s.jsx(w,{ref:h,className:y("smwb-appbar",t,`smwb-${r}`,`smwb-${c}`,{"smwb-dense":a},f!=="default"&&`smwb-appbar_color-${f}`),"data-testid":"app-bar",...b,children:n||s.jsxs("div",{className:"smwb-appbar__inner",children:[s.jsxs("div",{className:"smwb-appbar__left",children:[m&&s.jsx("div",{className:"smwb-appbar__left__title",children:m}),l]}),s.jsx("div",{className:y("smwb-appbar__mid",`smwb-${d}`),children:o}),s.jsx("div",{className:"smwb-appbar__right",children:u})]})})}),el=i.forwardRef(function({className:t,separator:n="/",maxItems:a=8,itemsBeforeCollapse:r=1,itemsAfterCollapse:c=1,expanded:l,onExpand:o,expandLabel:d="Show path",children:u,...m},f){const b=l!==void 0,[h,w]=i.useState(!1),p=b?!!l:h,_=i.Children.toArray(u).filter(i.isValidElement),v=!p&&_.length>a&&r+c<_.length,g=()=>{o==null||o(),b||w(!0)},x=v?[..._.slice(0,r),s.jsx("button",{type:"button",className:"smwb-breadcrumbs__expand","aria-label":d,onClick:g,children:"…"},"smwb-breadcrumbs-expand"),..._.slice(_.length-c)]:_;return s.jsx("nav",{...m,ref:f,"data-testid":"breadcrumbs","aria-label":"breadcrumb",className:y("smwb-breadcrumbs",t),children:s.jsx("ol",{className:"smwb-breadcrumbs__list",children:x.map((T,j)=>s.jsxs(i.Fragment,{children:[s.jsx("li",{className:"smwb-breadcrumbs__item",children:T}),j<x.length-1?s.jsx("li",{className:"smwb-breadcrumbs__separator","aria-hidden":"true",children:n}):null]},j))})})}),Ft=(e,t)=>Array.from({length:Math.max(t-e+1,0)},(n,a)=>e+a),tl=(e,t,n,a)=>{const r=Ft(1,Math.min(a,e)),c=Ft(Math.max(e-a+1,a+1),e),l=Math.max(Math.min(t-n,e-a-n*2-1),a+2),o=Math.min(Math.max(t+n,a+n*2+2),c.length>0?c[0]-2:e-1);return[...r,...l>a+2?["start-ellipsis"]:a+1<e-a?[a+1]:[],...Ft(l,o),...o<e-a-1?["end-ellipsis"]:e-a>a?[e-a]:[],...c]},sl=i.forwardRef(function({className:t,count:n,page:a,siblingCount:r=1,boundaryCount:c=1,size:l="medium",variant:o="filled",shape:d="circular",color:u="default",disabled:m=!1,showFirstButton:f=!1,showLastButton:b=!1,hidePrevButton:h=!1,hideNextButton:w=!1,onChange:p,..._},v){const g=i.useRef(null),x=ge(v,g),T=k=>{m||k===a||k<1||k>n||p==null||p(k)},j=k=>{var M,I,z;if(!["ArrowLeft","ArrowRight","Home","End"].includes(k.key))return;const N=Array.from((I=(M=g.current)==null?void 0:M.querySelectorAll("button.smwb-pagination__item:not(:disabled)"))!=null?I:[]);if(N.length===0)return;const C=N.indexOf(document.activeElement);let A=C;k.key==="ArrowRight"?A=Math.min(C+1,N.length-1):k.key==="ArrowLeft"?A=Math.max(C-1,0):k.key==="Home"?A=0:k.key==="End"&&(A=N.length-1),k.preventDefault(),(z=N[A])==null||z.focus()},S=tl(n,a,r,c),R=(k,N,C,A,M)=>M?null:s.jsx("li",{children:s.jsx("button",{type:"button",className:"smwb-pagination__item smwb-pagination__nav","aria-label":N,disabled:m||C<1||C>n,onClick:()=>T(C),children:s.jsx(K,{name:A,size:l==="small"?16:18})})},k);return s.jsx("nav",{..._,ref:x,"data-testid":"pagination","aria-label":"pagination",className:y("smwb-pagination",`smwb-pagination_${l}`,`smwb-pagination_${o}`,`smwb-pagination_shape-${d}`,u!=="default"&&`smwb-pagination_color-${u}`,{"smwb-pagination_disabled":m},t),children:s.jsxs("ul",{className:"smwb-pagination__list",onKeyDown:j,children:[R("first","First page",1,"first_page",!f),R("prev","Previous page",a-1,"chevron_left",h),S.map((k,N)=>typeof k=="number"?s.jsx("li",{children:s.jsx("button",{type:"button",className:y("smwb-pagination__item",{"smwb-pagination__item_selected":k===a}),"aria-current":k===a?"page":void 0,disabled:m,onClick:()=>T(k),children:k})},k):s.jsx("li",{className:"smwb-pagination__ellipsis","aria-hidden":"true",children:"…"},`${k}-${N}`)),R("next","Next page",a+1,"chevron_right",w),R("last","Last page",n,"last_page",!b)]})})}),nl=i.forwardRef(function({className:t,steps:n,activeStep:a,orientation:r="horizontal",alternativeLabel:c=!1,onStepClick:l,...o},d){return s.jsx("div",{...o,ref:d,"data-testid":"stepper",className:y("smwb-stepper",`smwb-stepper_${r}`,{"smwb-stepper_alt-label":c&&r==="horizontal"},t),children:n.map((u,m)=>{var _;const f=m<a,b=m===a,h=m===n.length-1,w=!!l&&!u.disabled,p=v=>{w&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),l==null||l(m))};return s.jsxs(i.Fragment,{children:[s.jsxs("div",{className:y("smwb-stepper__step",{"smwb-stepper__step_active":b,"smwb-stepper__step_completed":f,"smwb-stepper__step_error":u.error,"smwb-stepper__step_disabled":u.disabled,"smwb-stepper__step_clickable":w}),"aria-current":b?"step":void 0,"aria-disabled":u.disabled||void 0,role:w?"button":void 0,tabIndex:w?0:void 0,onClick:w?()=>l==null?void 0:l(m):void 0,onKeyDown:w?p:void 0,children:[s.jsx("div",{className:"smwb-stepper__icon","aria-hidden":"true",children:(_=u.icon)!=null?_:f?s.jsx(K,{name:"check",size:16}):s.jsx("span",{children:m+1})}),s.jsxs("div",{className:"smwb-stepper__text",children:[s.jsx("span",{className:"smwb-stepper__label",children:u.label}),u.optional?s.jsx("span",{className:"smwb-stepper__optional",children:u.optional}):null,u.description&&r==="vertical"?s.jsx("span",{className:"smwb-stepper__description",children:u.description}):null]})]}),h?null:s.jsx("div",{className:"smwb-stepper__connector","aria-hidden":"true"})]},m)})})});function al({items:e,icon:t="more_vert",placement:n,"aria-label":a,disabled:r,className:c}){const l=i.useRef(null),[o,d]=i.useState(!1),u=()=>d(!1);return s.jsxs("span",{className:y("smwb-overflow-menu",c),children:[s.jsx(Te,{ref:l,variant:"text",size:"small",icon:t,"aria-label":a!=null?a:"More actions","aria-haspopup":"menu",disabled:!!r,onClick:()=>d(m=>!m)}),s.jsx(kt,{isOpen:o,onClose:u,anchorElement:l.current,...n?{placement:n}:{},children:e.map(m=>s.jsxs(qe,{className:y({"smwb-overflow-menu__item--danger":m.danger}),disabled:m.disabled,onClick:()=>{var f;m.disabled||((f=m.onSelect)==null||f.call(m),u())},children:[m.icon?typeof m.icon=="string"?s.jsx(K,{name:m.icon}):m.icon:null,m.label]},m.id))})]})}const rl=i.forwardRef(function({className:t,variant:n="default",menuItems:a,activeItem:r,defaultActiveItem:c=null,onActiveItemChange:l,collapsible:o=!1,collapsed:d,defaultCollapsed:u=!1,onCollapsedChange:m,collapseToggleAriaLabel:f="Toggle navigation",...b},h){const w=r!==void 0,[p,_]=i.useState(c),v=w?r:p,[g,x]=$e({value:d,defaultValue:u,onChange:m}),T=o&&g?"compactMini":n;return s.jsxs("aside",{ref:h,className:y("smwb-sidebar",t,`smwb-${T}`,{"smwb-sidebar_collapsible":o,"smwb-sidebar_collapsed":o&&g}),role:"menubar",...b,children:[o&&s.jsx("div",{className:"smwb-sidebar__collapse",children:s.jsx("button",{type:"button",className:"smwb-sidebar__collapse-btn","aria-label":f,"aria-expanded":!g,onClick:()=>x(!g),children:s.jsx(K,{name:g?"chevron_right":"chevron_left",size:20})})}),s.jsx("nav",{className:"smwb-sidebar__nav",children:a&&(a==null?void 0:a.map((j,S)=>s.jsx(il,{as:j.as,isActive:v===S,onClick:R=>{var k;w||_(S),l==null||l(S),(k=j.onClick)==null||k.call(j,R)},icon:j.icon,title:j.title,href:j.href,variant:T},S)))})]})});function il({isActive:e,icon:t,title:n,as:a="div",href:r,onMouseDown:c,variant:l,...o}){const d=i.useRef(null),u=h=>{c==null||c(h)},m=h=>{var w;(w=d.current)==null||w.onRipple(h)},f=s.jsx(De,{actionRef:d}),b=a;return s.jsxs(b,{href:r,role:"menuitem",className:y("sidebar__nav__item","smwb-nav-item",l,{active:e}),onMouseDown:u,onPointerDown:m,...o,children:[t&&s.jsx("span",{className:"smwb-nav-item__icon",children:t}),n&&s.jsx("span",{className:"smwb-nav-item__title",children:n}),f]})}const ll=i.forwardRef(function({className:t,menuItems:n=[],visibleCount:a=4,activeItem:r,defaultActiveItem:c=null,onActiveItemChange:l,overflowMenuAriaLabel:o="More navigation",...d},u){const m=r!==void 0,[f,b]=i.useState(c),h=m?r:f,[w,p]=i.useState(!1),[_,v]=i.useState(null),g=Math.max(0,a),x=i.useMemo(()=>n.slice(0,g),[n,g]),T=i.useMemo(()=>n.slice(g),[n,g]),j=T.length>0,S=j&&h!==null&&h>=g,R=A=>{m||b(A),l==null||l(A)},k=(A,M)=>I=>{R(A),M==null||M(I)},N=()=>{p(A=>!A)},C=()=>{p(!1)};return s.jsxs("nav",{ref:u,className:y("smwb-bottom-bar",t),role:"navigation",...d,children:[s.jsxs("div",{className:"smwb-bottom-bar__nav",role:"menubar",children:[x.map((A,M)=>s.jsx(Bs,{as:A.as,isActive:h===M,onClick:k(M,A.onClick),icon:A.icon,title:A.title,href:A.href},M)),j&&s.jsx(Bs,{ref:v,isActive:S,onClick:N,icon:s.jsx(K,{name:"menu",size:24}),"aria-label":o,"aria-haspopup":"menu","aria-expanded":w})]}),j&&s.jsx(kt,{isOpen:w,onClose:C,anchorElement:_,placement:"top",dense:!0,children:T.map((A,M)=>{const I=g+M;return s.jsxs(qe,{selected:h===I,href:A.href,onClick:z=>{var D;R(I),(D=A.onClick)==null||D.call(A,z),C()},children:[A.icon?s.jsx(is,{children:A.icon}):null,s.jsx(ls,{inset:!A.icon,children:A.title})]},I)})})]})}),Bs=i.forwardRef(function({isActive:t,icon:n,title:a,as:r="div",href:c,onMouseDown:l,...o},d){const u=i.useRef(null),m=h=>{l==null||l(h)},f=h=>{var w;(w=u.current)==null||w.onRipple(h)},b=r;return s.jsxs(b,{ref:d,href:c,role:"menuitem",className:y("smwb-bottom-bar__item",{"smwb-bottom-bar__item_active":t}),onMouseDown:m,onPointerDown:f,...o,children:[n&&s.jsx("span",{className:"smwb-bottom-bar__item-icon",children:n}),a?s.jsx("span",{className:"smwb-bottom-bar__item-title",children:a}):null,s.jsx(De,{actionRef:u})]})});function ol(e,t){let n;const a=(...r)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...r)},t)};return a.cancel=()=>{n!==void 0&&(clearTimeout(n),n=void 0)},a}const cl=i.forwardRef(function(t,n){const{className:a,label:r,isActive:c=!1,contentRef:l,icon:o,stacked:d=!1,tag:u,disabled:m,onMouseDown:f,...b}=t,h=i.useRef(null),w=g=>{f==null||f(g)},p=g=>{var x;(x=h.current)==null||x.onRipple(g)},_=u!=null?u:u||"button",v=y("smwb-tab",a,{"smwb-tab--active":c,"smwb-tab--stacked":d,"smwb-tab--disabled":m});return s.jsxs(_,{ref:n,className:v,onMouseDown:w,onPointerDown:p,role:"tab","aria-selected":c,"aria-disabled":m||void 0,tabIndex:c?0:-1,disabled:_==="button"?m:void 0,...b,children:[s.jsxs("span",{className:"smwb-tab__content",ref:l,children:[o&&s.jsx("span",{className:"smwb-tab__icon",children:o}),r&&s.jsx("span",{className:"smwb-tab__text-label",children:r})]}),s.jsx(De,{actionRef:h,classes:{child:"tab__ripple-child"}})]})}),ul=e=>(1+Math.sin(Math.PI*e-Math.PI/2))/2;function dl(e,t,n,a={},r=()=>{}){const{ease:c=ul,duration:l=300}=a;let o=null;const d=e[t];let u=!1;const m=()=>{u=!0},f=b=>{if(u){r(new Error("Animation cancelled"));return}o===null&&(o=b);const h=Math.min(1,(b-o)/l);if(e[t]=c(h)*(n-d)+d,h>=1){requestAnimationFrame(()=>{r(null)});return}requestAnimationFrame(f)};return d===n?(r(new Error("Element already at target position")),m):(requestAnimationFrame(f),m)}const Os={root:{},content:{}},ml=i.forwardRef(function(t,n){const{className:a,children:r,onChange:c,value:l,indicatorContent:o=!1,scrollable:d=!1,"aria-label":u,...m}=t,[f,b]=i.useState(!1),[h,w]=i.useState(Os),p=i.useRef(null),_=i.useRef(null),v=i.useRef([]),g=40,x=()=>{const k=p.current;let N;if(k){const M=k.getBoundingClientRect();N={clientWidth:k.clientWidth,scrollLeft:k.scrollLeft,scrollTop:k.scrollTop,scrollWidth:k.scrollWidth,top:M.top,bottom:M.bottom,left:M.left,right:M.right}}let C=null,A=null;if(_.current||console.error("tabListRef.current is undefined"),k&&_.current){const M=_.current.children;if(M.length>0){const I=M[l];C=I?I.getBoundingClientRect():null,o&&(A=v.current[l]?v.current[l].getBoundingClientRect():null)}}return{tabsMeta:N,tabMeta:C,tabContentMeta:A}},T=Me(()=>{const{tabsMeta:k,tabMeta:N,tabContentMeta:C}=x();let A=0;N&&k&&(A=1*(N.left-k.left+k.scrollLeft));const M={root:{left:A,width:N?N.width:0}};if(o&&C&&(M.content={width:C.width}),isNaN(h.root.left)||isNaN(h.root.width))w(M);else{const I=Math.abs(h.root.left-M.root.left),z=Math.abs(h.root.width-M.root.width);(I>=1||z>=1)&&w(M)}}),j=(k,{animation:N=!0}={})=>{p.current&&(N?dl(p.current,"scrollLeft",k,{duration:300}):p.current.scrollLeft=k)},S=Me(k=>{const{tabsMeta:N,tabMeta:C}=x();if(!(!C||!N)){if(C.left<N.left){const A=N.scrollLeft+(C.left-N.left);j(A-g,{animation:k})}else if(C.right>N.right){const A=N.scrollLeft+(C.right-N.right);j(A+g,{animation:k})}}});i.useEffect(()=>{b(!0)},[]),i.useEffect(()=>{T()}),i.useEffect(()=>{var A,M;const k=ol(()=>{p.current&&T()},166);if(!p.current||!p.current.ownerDocument.defaultView){console.error("tabsRef.current.ownerDocument.defaultView is undefined");return}const N=p.current.ownerDocument.defaultView;N.addEventListener("resize",k);let C;return typeof ResizeObserver!="undefined"&&(C=new ResizeObserver(k),Array.from((M=(A=_.current)==null?void 0:A.children)!=null?M:[]).forEach(I=>{C.observe(I)})),()=>{k.cancel(),N.removeEventListener("resize",k),C&&C.disconnect()}},[T]),i.useEffect(()=>{S(Os!==h)},[S,h]);const R=i.Children.map(r,(k,N)=>i.cloneElement(k,{isActive:l===N,onClick:C=>{c(C,N)},...o&&{contentRef:C=>{const{contentRef:A}=k.props;v.current.push(C),A&&Hs(A,C)}}}));return s.jsx("div",{className:y("smwb-tabs",a),role:"tabpanel",ref:n,...m,children:s.jsxs("div",{className:y("smwb-tabs__scroller",{"smwb-tabs__scroller--scrollable":d}),ref:p,children:[s.jsx("div",{className:"smwb-tabs__scroll-area",ref:_,role:"tablist","aria-label":u,children:R}),f&&s.jsx("span",{className:"smwb-tabs__indicator",style:h.root,children:s.jsx("span",{className:"smwb-tabs__indicator-content",style:h.content})})]})})});exports.Accordion=pa;exports.AppBar=Qi;exports.AppLayout=Ji;exports.AssetGrid=$a;exports.Avatar=qt;exports.AvatarGroup=Ca;exports.Badge=Da;exports.BottomBar=ll;exports.Breadcrumbs=el;exports.Button=Te;exports.ButtonGroup=pr;exports.CHAT_DEFAULT_FILE_UPLOAD_MAX_FILES=Ws;exports.CHAT_EXPAND_LAYOUTS=Wt;exports.CHAT_MESSAGE_DELIVERY_STATUSES=Ys;exports.CHAT_MESSAGE_STATUS_ICONS=Xs;exports.CHAT_MESSAGE_STATUS_LABELS=Ks;exports.Card=Ea;exports.Carousel=Ua;exports.Chat=Pt;exports.ChatAttachmentImage=sn;exports.ChatAttachments=nn;exports.ChatComposer=en;exports.ChatHeader=tn;exports.ChatLayout=Ma;exports.ChatMessageAvatar=Bt;exports.ChatMessageBubble=Zt;exports.ChatMessageIncoming=rn;exports.ChatMessageItem=cn;exports.ChatMessageOutgoing=ln;exports.ChatMessageSkeleton=un;exports.ChatMessageStatus=an;exports.ChatMessageSystem=on;exports.ChatMessages=hn;exports.ChatShell=bn;exports.Checkbox=_r;exports.Chip=Jt;exports.ChipGroup=Aa;exports.CircularProgress=Rn;exports.ClickAwayListener=Je;exports.Column=Pi;exports.Container=zi;exports.DEFAULT_TIME_FORMAT=mt;exports.DataPickerDays=rs;exports.DataPickerHeader=as;exports.DataPickerInput=zn;exports.DatePicker=Yr;exports.DatePickerActionLabel=zt;exports.DatePickerIconButton=ze;exports.DatePickerList=ut;exports.DateTimePicker=hi;exports.DateTimePickerInput=Yn;exports.Divider=Vi;exports.ExpansionPanel=xa;exports.FloatingButton=Vs;exports.Grid=Ai;exports.Icon=K;exports.ImagesList=Za;exports.ImagesListItem=qa;exports.ImagesListItemModal=yn;exports.LazyImage=_n;exports.List=Qa;exports.ListItem=Ja;exports.Menu=kt;exports.MenuDivider=Ln;exports.MenuItem=qe;exports.MenuItemIcon=is;exports.MenuItemText=ls;exports.MenuSubmenu=Br;exports.Message=cr;exports.MessageContainer=kn;exports.Modal=Ye;exports.OpenView=pe;exports.OverflowMenu=al;exports.Page=qi;exports.PageHeader=Zi;exports.Pagination=sl;exports.ProgressIndicator=Nn;exports.RadioButton=xi;exports.Rating=vi;exports.Ripple=De;exports.Row=Bi;exports.SaveAssetDialog=ur;exports.ScreenDivider=Xi;exports.SelectField=Ni;exports.Sheet=Ki;exports.Sidebar=rl;exports.Skeleton=rt;exports.Slider=Jn;exports.SnackbarProvider=fr;exports.Stack=Gi;exports.Stepper=nl;exports.Tab=cl;exports.Table=er;exports.TableBody=tr;exports.TableCell=sr;exports.TableHead=nr;exports.TableHeadCell=ar;exports.TablePagination=jn;exports.TableRow=rr;exports.Tabs=ml;exports.TextField=Be;exports.TextFieldAdornment=Lt;exports.TextFieldWrapper=Le;exports.Theme=zs;exports.ThumbCard=Ia;exports.TimePicker=gi;exports.TimePickerColumns=cs;exports.TimePickerInput=Un;exports.Toggle=Ei;exports.Tooltip=wr;exports.TreeView=ir;exports.Typography=Ge;exports.ValueSlider=Di;exports.formatChatTimestamp=Zs;exports.getChatLayoutActions=Js;exports.getCurrentDateTimeFormat=xt;exports.getDisplayDateTime=it;exports.isChatMessageDeliveryStatus=Ut;exports.isImageAttachment=qs;exports.isScrolledToBottom=mn;exports.resolveAllowedLayouts=Gt;exports.resolveChatFileUploadMaxFiles=wn;exports.resolveChatMessageStatusIcon=Us;exports.resolveChatMessageStatusLabel=Gs;exports.scrollChatToBottom=Ot;exports.shouldComposerNewlineOnEnter=Qs;exports.useChatFileUpload=pn;exports.useChatInfiniteScroll=dn;exports.useChatStickToBottom=fn;exports.useControllableState=$e;exports.useDateInput=Pn;exports.useDateTimeInput=Vn;exports.useFocusTrap=ia;exports.useHoverPopover=ma;exports.useId=dt;exports.useRovingTabIndex=la;exports.useSnackbar=br;exports.useTheme=aa;exports.useTimeInput=Wn;exports.useVirtualList=Kt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),fe=require("@floating-ui/react"),s=require("react/jsx-runtime"),y=require("clsx"),vt=require("react-transition-group/Transition"),Re=require("react-dom"),Ve=require("react-transition-group"),na=require("react-dropzone"),Xt=require("rifm"),Ps=require("uuid");class aa{constructor(t){this.cbs=[],this._value=t}setValue(t){if(this.value!==t){this._value=t;for(const n of this.cbs)n(t)}}get value(){return this._value}subscribe(t){return this.cbs.push(t),()=>{this.cbs=this.cbs.filter(n=>n!==t)}}}function ra(e){const[t,n]=i.useState(e.value);return i.useEffect(()=>(n(e.value),e.subscribe(n)),[e]),t}const _e=typeof window=="undefined"?i.useEffect:i.useLayoutEffect;var zs=(e=>(e.dark="dark",e.light="light",e))(zs||{});const wt="smui-theme",He=new aa("light"),ia=()=>{const e=ra(He),t=i.useRef(!0);_e(()=>{const a=localStorage.getItem(wt);if(t.current)if(t.current=!1,a)He.setValue(a),document.documentElement.dataset.theme=a;else{const r=window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark";a!==e&&He.setValue(r),localStorage.setItem(wt,r),document.documentElement.dataset.theme=r}},[e]);const n=function(a){if(a.storageArea===localStorage){const r=localStorage.getItem(wt);document.documentElement.dataset.theme=r,He.setValue(r)}};return i.useEffect(()=>(window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)),[]),{theme:e,setTheme:a=>{localStorage.setItem(wt,a),He.setValue.bind(He)(a),document.documentElement.dataset.theme=a}}};function $e({value:e,defaultValue:t,onChange:n}){const a=e!==void 0,[r,c]=i.useState(t),l=a?e:r,o=i.useRef(l);o.current=l;const d=i.useRef(n);d.current=n;const u=i.useCallback(m=>{var h;const f=o.current,b=typeof m=="function"?m(f):m;a||c(b),(h=d.current)==null||h.call(d,b)},[a]);return[l,u]}function dt(e,t="smwb"){const n=i.useId();return e!=null?e:`${t}-${n.replace(/[:]/g,"")}`}const la='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function oa(e,{active:t,restoreFocus:n=!0,autoFocus:a=!0}){const r=i.useRef(null);i.useEffect(()=>{if(!t)return;const c=e.current;if(!c)return;r.current=document.activeElement;const l=()=>Array.from(c.querySelectorAll(la)).filter(d=>d.offsetParent!==null||d===document.activeElement);if(a){const d=l()[0];(d!=null?d:c).focus({preventScroll:!0})}const o=d=>{if(d.key!=="Tab")return;const u=l();if(u.length===0){d.preventDefault();return}const m=u[0],f=u[u.length-1],b=document.activeElement;d.shiftKey&&b===m?(d.preventDefault(),f.focus()):!d.shiftKey&&b===f?(d.preventDefault(),m.focus()):c.contains(b)||(d.preventDefault(),m.focus())};return document.addEventListener("keydown",o,!0),()=>{document.removeEventListener("keydown",o,!0),n&&r.current&&r.current.focus({preventScroll:!0})}},[t,a,n,e])}function ca({count:e,activeIndex:t,onMove:n,orientation:a="horizontal",loop:r=!0,isDisabled:c}){return i.useCallback(l=>{if(e===0)return;const o=a==="horizontal"||a==="both",d=a==="vertical"||a==="both",u=o&&l.key==="ArrowRight"||d&&l.key==="ArrowDown",m=o&&l.key==="ArrowLeft"||d&&l.key==="ArrowUp";let f=null;if(u?f=t+1:m?f=t-1:l.key==="Home"?f=0:l.key==="End"&&(f=e-1),f===null)return;const b=h=>r?(h+e)%e:Math.max(0,Math.min(e-1,h));if(f=b(f),c){let h=0;const w=u||l.key==="Home"?1:-1;for(;c(f)&&h<e;)f=b(f+w),h+=1;if(c(f))return}l.preventDefault(),n(f)},[e,t,n,a,r,c])}function Kt({itemCount:e,itemHeight:t,viewportHeight:n,overscan:a=4}){const[r,c]=i.useState(0),l=i.useCallback(o=>{c(o.currentTarget.scrollTop)},[]);return i.useMemo(()=>{const o=t>0?t:1,d=Math.ceil(n/o),u=Math.max(0,Math.floor(r/o)-a),m=Math.min(e,u+d+a*2);return{startIndex:u,endIndex:m,totalHeight:e*o,offsetY:u*o,onScroll:l}},[e,t,n,a,r,l])}function Ze(e){if(e==="auto"||e==="auto-start"||e==="auto-end"){const t=e==="auto-start"?"start":e==="auto-end"?"end":null;return{autoMiddleware:fe.autoPlacement({alignment:t})}}return{placement:e}}const us=4,Rt=8;function yt(e,t){return t!=null&&t.length?[...t,fe.flip(),fe.shift({padding:Rt})]:e.autoMiddleware?[fe.offset(us),fe.shift({padding:Rt}),e.autoMiddleware]:[fe.offset(us),fe.flip(),fe.shift({padding:Rt})]}const ua="bottom-start",da=4,ma=8,fa=({x:e,y:t})=>({x:e,y:t,top:t,left:e,right:e,bottom:t,width:0,height:0});function ha(e={}){const{placement:t=ua,offsetPx:n=da,openDelay:a=0,closeDelay:r=0,middleware:c}=e,[l,o]=i.useState(!1),d=i.useRef({x:0,y:0}),u=i.useRef({x:0,y:0}),m=i.useRef(null),f=i.useRef(null),b=i.useRef(null),h=Ze(t),w=i.useMemo(()=>[fe.offset({mainAxis:n,crossAxis:n}),...h.autoMiddleware?[h.autoMiddleware]:[fe.flip()],fe.shift({padding:ma}),...c!=null?c:[]],[n,h.autoMiddleware,c]),{refs:p,floatingStyles:_,update:v}=fe.useFloating({open:l,placement:h.placement,whileElementsMounted:fe.autoUpdate,middleware:w}),g=i.useMemo(()=>({getBoundingClientRect:()=>fa(u.current)}),[]),x=i.useCallback(()=>{f.current!==null&&(clearTimeout(f.current),f.current=null),b.current!==null&&(clearTimeout(b.current),b.current=null)},[]);i.useEffect(()=>()=>x(),[x]),i.useEffect(()=>{var M;l&&(p.setPositionReference((M=m.current)!=null?M:g),v())},[l,p,v,g]);const S=i.useCallback(()=>{m.current===null&&(u.current=d.current)},[]),j=i.useCallback(()=>{x(),S(),o(!0)},[x,S]),T=i.useCallback(()=>{if(x(),a<=0){S(),o(!0);return}f.current=setTimeout(()=>{S(),o(!0)},a)},[x,S,a]),R=i.useCallback(()=>{if(x(),r<=0){o(!1);return}b.current=setTimeout(()=>o(!1),r)},[x,r]),k=i.useCallback(()=>{x(),o(!1)},[x]),N=i.useCallback(M=>{m.current=null,u.current=M},[]),C=i.useCallback(M=>{m.current=M},[]),E=i.useCallback(M=>{d.current={x:M.clientX,y:M.clientY},T()},[T]),D=i.useCallback(M=>{d.current={x:M.clientX,y:M.clientY}},[]),A=i.useCallback(M=>({onPointerEnter:F=>{var I;(I=M==null?void 0:M.onPointerEnter)==null||I.call(M,F),E(F)},onPointerMove:F=>{var I;(I=M==null?void 0:M.onPointerMove)==null||I.call(M,F),D(F)},onPointerLeave:F=>{var I;(I=M==null?void 0:M.onPointerLeave)==null||I.call(M,F),R()}}),[E,D,R]),z=i.useCallback(()=>{x(),o(!0)},[x]),$=i.useCallback(M=>({ref:p.setFloating,style:{..._,...M==null?void 0:M.style},onPointerEnter:z,onPointerLeave:R}),[p,_,z,R]);return{open:l,getReferenceProps:A,getFloatingProps:$,setAnchorEl:C,setVirtualAnchor:N,openNow:j,scheduleOpen:T,scheduleClose:R,close:k}}const W=i.forwardRef(function({className:t,weight:n=400,fill:a=0,size:r=20,grade:c=100,name:l,color:o="inherit",title:d,...u},m){const f=d===void 0,b=o&&["primary","secondary","error","success","warning","info","disabled"].includes(o)?`smwb-icon_color-${o}`:null;return s.jsx("span",{...u,ref:m,"data-testid":"icon",role:f?void 0:"img","aria-hidden":f?!0:void 0,"aria-label":d,title:d,style:{...u.style,fontVariationSettings:`'FILL' ${a}, 'wght' ${n}, 'GRAD' ${c}, 'opsz' 48`},className:y("smwb-icon__wrapper",b,t),children:s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:typeof r=="number"?`${r}px`:r},children:l})})}),De=i.forwardRef(function({actionRef:t,className:n,classes:a,center:r,style:c,duration:l=600,color:o,...d},u){const[m,f]=i.useState([]),b=i.useRef(0);return i.useImperativeHandle(t,()=>({onRipple(h){const p=h.currentTarget.getBoundingClientRect(),_=Math.max(p.width,p.height),v=_/2;let g,x;r?(g=p.width>p.height?0:p.width/2-v,x=p.height>p.width?0:p.height/2-v):(g=h.clientX-p.left-v,x=h.clientY-p.top-v),f([...m,s.jsx("span",{className:y("smwb-ripple__child",a==null?void 0:a.child),style:{...c,left:g,top:x,width:_,height:_,backgroundColor:o!=null?o:c==null?void 0:c.backgroundColor},...d},b.current)]),b.current+=1,setTimeout(()=>{f(S=>S.slice(1))},l)}}),[d,r,m,a==null?void 0:a.child,c,l,o]),s.jsx("span",{ref:u,className:y("smwb-ripple",n,a==null?void 0:a.ripple),"data-testid":"ripple","aria-hidden":"true",children:m})});function Vs(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function ge(...e){return i.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{Vs(n,t)})},e)}function ba(e){const t=parseFloat(e);return!isNaN(t)&&isFinite(t)}function ds(e){return typeof e=="string"&&e[e.length-1]==="%"&&ba(e.substring(0,e.length-1))}function Tt(e,t){t===0&&(e!=null&&e.style)&&(e.style.display="none")}function wa(e,t){t===0&&(e!=null&&e.style)&&(e.style.display="")}const pa={animating:"rah-animating",animatingUp:"rah-animating--up",animatingDown:"rah-animating--down",animatingToHeightZero:"rah-animating--to-height-zero",animatingToHeightAuto:"rah-animating--to-height-auto",animatingToHeightSpecific:"rah-animating--to-height-specific",static:"rah-static",staticHeightZero:"rah-static--height-zero",staticHeightAuto:"rah-static--height-auto",staticHeightSpecific:"rah-static--height-specific"};function ms(e,t){return y({[e.static]:!0,[e.staticHeightZero]:t===0,[e.staticHeightSpecific]:typeof t=="number"&&t>0,[e.staticHeightAuto]:t==="auto"})}const _a=i.forwardRef(function({animateOpacity:t=!1,animationStateClasses:n={},applyInlineTransitions:a=!0,children:r,className:c="",contentClassName:l,delay:o=0,duration:d=300,easing:u="ease",height:m,onHeightAnimationEnd:f,onHeightAnimationStart:b,style:h,...w},p){const _=i.useRef(m),v=i.useRef(null),g=i.useRef(null),x=ge(p,g),S=i.useRef(),j=i.useRef(),T=i.useRef({...pa,...n}),R=o,k=d;let N=m,C="visible";typeof N=="number"?(N=typeof m!="number"||m<0?0:m,C="hidden"):ds(N)&&(N=m==="0%"?0:m,C="hidden");const[E,D]=i.useState(N),[A,z]=i.useState(C),[$,M]=i.useState(!1),[F,I]=i.useState(ms(T.current,m));i.useEffect(()=>{Tt(v.current,E)},[]),i.useEffect(()=>{if(m!==_.current&&v.current){wa(v.current,_.current),v.current.style.overflow="hidden";const Z=v.current.offsetHeight;v.current.style.overflow="";const te=k+R;let L,B,X="hidden",ee;const U=_.current==="auto";typeof m=="number"?(L=m<0?0:m,B=L):ds(m)?(L=m==="0%"?0:m,B=L):(L=Z,B="auto",X=void 0),U&&(B=L,L=Z);const se=y({[T.current.animating]:!0,[T.current.animatingUp]:_.current==="auto"||m<_.current,[T.current.animatingDown]:m==="auto"||m>_.current,[T.current.animatingToHeightZero]:B===0,[T.current.animatingToHeightAuto]:B==="auto",[T.current.animatingToHeightSpecific]:typeof B=="number"&&B>0}),de=ms(T.current,B);D(L),z("hidden"),M(!U),I(se),clearTimeout(j.current),clearTimeout(S.current),U?(ee=!0,j.current=setTimeout(()=>{D(B),z(X),M(ee),b==null||b(B)},50),S.current=setTimeout(()=>{M(!1),I(de),Tt(v.current,B),f==null||f(B)},te)):(b==null||b(L),j.current=setTimeout(()=>{D(B),z(X),M(!1),I(de),m!=="auto"&&Tt(v.current,L),f==null||f(L)},te))}return _.current=m,()=>{clearTimeout(j.current),clearTimeout(S.current)}},[m]);const K={...h,height:E,overflow:A||(h==null?void 0:h.overflow)};$&&a&&(K.transition=`height ${k}ms ${u} ${R}ms`,h!=null&&h.transition&&(K.transition=`${h.transition}, ${K.transition}`),K.WebkitTransition=K.transition);const ne={};t&&(ne.transition=`opacity ${k}ms ${u} ${R}ms`,ne.WebkitTransition=ne.transition,E===0&&(ne.opacity=0));const ce=typeof w["aria-hidden"]!="undefined"?w["aria-hidden"]:m===0;return s.jsx("div",{...w,ref:x,"aria-hidden":ce,className:`${F} ${c}`,style:K,children:s.jsx("div",{className:l,style:ne,ref:v,children:r})})}),ga=i.forwardRef(function({className:t,title:n,isOpenByDefault:a=!1,open:r,disabled:c,icon:l,id:o,children:d,startAdornment:u,noIcon:m,onToggleClick:f,onChange:b},h){const w=r!==void 0,[p,_]=i.useState(a),v=w?!!r:p,g=dt(o),x=`${g}-content`,S=`${g}-header`,j=y("smwb-accordion__arrow-icon",{"smwb-accordion__arrow-icon_opened":v}),T=R=>{if(c)return;const k=!v;w||_(k),b==null||b(k),f==null||f(R)};return s.jsxs("div",{ref:h,className:y("smwb-accordion",{"smwb-disabled":c},t),"data-testid":"accordion",children:[s.jsxs("button",{id:S,className:"smwb-accordion__header",onClick:T,type:"button",disabled:c,"aria-expanded":v,"aria-controls":d?x:void 0,children:[u==null?void 0:u(v),s.jsx("span",{className:"smwb-accordion__title",children:n}),!m&&(l!=null?l:s.jsx(W,{className:j,name:"expand_more",size:24}))]}),d&&s.jsx("div",{id:x,role:"region","aria-labelledby":S,children:s.jsx(_a,{height:v?"auto":0,animateOpacity:!0,duration:300,className:"smwb-accordion__content",children:d})})]})}),Se=i.forwardRef(function(t,n){const{label:a,variant:r="contained",icon:c,iconProps:l={},href:o,className:d,disabled:u,children:m,onMouseDown:f,fullWidth:b,rippleCenter:h,disableRipple:w,size:p="medium",colorTheme:_="primary",color:v,...g}=t,x=v!=null?v:_,S=i.useRef(null),j=C=>{f==null||f(C)},T=C=>{var E;u||(E=S.current)==null||E.onRipple(C)},R=y("smwb-button",`smwb-${r}`,`smwb-${p}`,x==="primary"?"smwb-primary":`smwb-button_color-${x}`,d,{"smwb-disabled":u,"smwb-full-width":b}),k=!w&&s.jsx(De,{actionRef:S,center:h}),N=typeof c=="string"?s.jsx(W,{...l,name:c}):c;return o?s.jsxs("a",{"data-testid":"button-link",ref:n,className:R,href:o,target:"_blank",rel:"noreferrer",onMouseDown:j,onPointerDown:T,...g,children:[c&&N,a||m,k]}):s.jsxs("button",{"data-testid":"button",ref:n,className:R,onMouseDown:j,onPointerDown:T,disabled:!!u,...g,children:[c&&N,a||m,k]})}),xa={expandRow:"Expand to full row",collapseRow:"Collapse to grid",expandFullscreen:"Expand to fullscreen",closeFullscreen:"Close fullscreen",placeholder:"Panel is open in fullscreen",placeholderClose:"Close"},fs=(e,t)=>typeof e=="function"?e(t):e,va=(e,t)=>typeof e=="function"?e(t):e,ya=i.forwardRef(function({className:t,header:n,mode:a,defaultMode:r="tile",onModeChange:c,disableExpand:l=!1,noControls:o=!1,renderControls:d,closeOnOutsideClick:u=!0,closeOnEsc:m=!0,labels:f,children:b},h){const[w,p]=$e({value:a,defaultValue:r,onChange:c}),_={...xa,...f},[v,g]=i.useState();_e(()=>{g(document.body)},[]);const x=l?"tile":w,S=x==="row",j=x==="fullscreen",T=()=>p(A=>A==="row"?"tile":"row"),R=()=>p("fullscreen"),k=()=>p("tile"),N=A=>({mode:x,isFullscreen:A,isFullRow:A?!1:S,setMode:p,toggleRow:T,openFullscreen:R,closeFullscreen:k,labels:_}),C=A=>A?s.jsx(Se,{type:"button",variant:"outlined",size:"small","aria-label":_.closeFullscreen,title:_.closeFullscreen,onClick:k,"data-testid":"expansion-panel-close",icon:s.jsx(W,{name:"close",size:18})}):s.jsxs(s.Fragment,{children:[s.jsx(Se,{type:"button",variant:"outlined",size:"small","aria-pressed":S,"aria-label":S?_.collapseRow:_.expandRow,title:S?_.collapseRow:_.expandRow,onClick:T,"data-testid":"expansion-panel-row",icon:s.jsx(W,{name:S?"grid_view":"table_rows",size:18})}),s.jsx(Se,{type:"button",variant:"outlined",size:"small","aria-label":_.expandFullscreen,title:_.expandFullscreen,onClick:R,"data-testid":"expansion-panel-fullscreen",icon:s.jsx(W,{name:"open_in_full",size:18})})]}),E=A=>{if(l||o)return null;const z=d?va(d,N(A)):C(A);return z?s.jsx("div",{className:"smwb-expansion-panel__controls",children:z}):null};i.useEffect(()=>{if(!j)return;const A=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=A}},[j]),i.useEffect(()=>{if(!j||!m)return;const A=z=>{z.key==="Escape"&&p("tile")};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[j,m,p]);const D=s.jsxs("div",{ref:h,className:y("smwb-expansion-panel",{"smwb-expansion-panel_row":S},t),"data-testid":"expansion-panel",children:[s.jsxs("div",{className:"smwb-expansion-panel__head",children:[s.jsx("div",{className:"smwb-expansion-panel__header",children:n}),E(!1)]}),s.jsx("div",{className:"smwb-expansion-panel__body",children:fs(b,{mode:x,isFullscreen:!1,isFullRow:S})})]});return!j||!v?D:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"smwb-expansion-panel__placeholder","data-testid":"expansion-panel-placeholder",children:[s.jsx("span",{children:_.placeholder}),s.jsx(Se,{type:"button",variant:"outlined",size:"small",label:_.placeholderClose,onClick:()=>p("tile")})]}),Re.createPortal(s.jsx("div",{className:"smwb-expansion-panel__overlay smwb-dark",role:"dialog","aria-modal":"true","data-testid":"expansion-panel-overlay",onClick:u?A=>{A.target===A.currentTarget&&p("tile")}:void 0,children:s.jsxs("div",{className:"smwb-expansion-panel__dialog",children:[s.jsxs("div",{className:"smwb-expansion-panel__head",children:[s.jsx("div",{className:"smwb-expansion-panel__header",children:n}),E(!0)]}),s.jsx("div",{className:"smwb-expansion-panel__body smwb-expansion-panel__body_fullscreen",children:fs(b,{mode:x,isFullscreen:!0,isFullRow:!1})})]})}),v)]})});function Ue({className:e,children:t,disabled:n,edge:a,color:r="default",onMouseDown:c,...l}){const o=i.useRef(null),d=m=>{c==null||c(m)},u=m=>{var f;n||(f=o.current)==null||f.onRipple(m)};return s.jsxs("button",{type:"button",className:y("smwb-chat-icon-button",a==="start"&&"smwb-chat-icon-button_edge-start",a==="end"&&"smwb-chat-icon-button_edge-end",r==="primary"&&"smwb-chat-icon-button_primary",n&&"smwb-chat-icon-button_disabled",e),disabled:n,onMouseDown:d,onPointerDown:u,...l,children:[t,n?null:s.jsx(De,{actionRef:o,center:!0})]})}const Hs=i.forwardRef(function({children:t,className:n,onMouseDown:a,variant:r="default",size:c="medium",color:l="primary",type:o="button",...d},u){const m=i.useRef(null),f=h=>{a==null||a(h)},b=h=>{var w;(w=m.current)==null||w.onRipple(h)};return s.jsxs("button",{ref:u,type:o,className:y("smwb-fab",`smwb-${r}`,`smwb-${c}`,`smwb-fab_color-${l}`,n),onMouseDown:f,onPointerDown:b,...d,children:[t,s.jsx(De,{actionRef:m})]})});function hs(e){return e!=null&&!(Array.isArray(e)&&e.length===0)}function ja(e){return e&&(hs(e.value)&&e.value!==""||hs(e.defaultValue)&&e.defaultValue!=="")}function Lt({position:e,variant:t,children:n,className:a,disablePointerEvents:r,inline:c}){const l=y("smwb-text-field__adornment",a,e==="start"&&"smwb-text-field__adornment--start",e==="end"&&"smwb-text-field__adornment--end",r&&"smwb-text-field__adornment--disable-pointer",!c&&t==="filled"&&"smwb-text-field__adornment--filled",typeof n=="string"&&"smwb-text-field__adornment--text");return s.jsx("span",{className:l,children:n})}function Le({label:e,helperText:t=s.jsx(s.Fragment,{children:" "}),variant:n,disabled:a,className:r,error:c,fullWidth:l,isFilledState:o,isFocused:d,htmlFor:u,shrink:m,children:f,onHolderMouseDown:b,startAdornment:h,endAdornment:w,inline:p,..._}){const v=n==="filled",g=e&&(o||d||m),x=y(r,"smwb-text-field",{"smwb-text-field--filled":!p&&v,"smwb-text-field--inline":p,"smwb-text-field--focused":!p&&d,"smwb-text-field--error":c,"smwb-text-field--disabled":a,"smwb-text-field--full-width":l}),S=y("smwb-text-field__label",{"smwb-text-field__label--shrink":g}),j=y("smwb-text-field__notched",{"smwb-text-field__notched--with-label":e,"smwb-text-field__notched--active":g});return s.jsxs("div",{className:x,..._,"data-testid":"text-field",children:[!p&&e&&s.jsx("label",{className:S,htmlFor:u||"",children:e}),s.jsxs("div",{className:"smwb-text-field__input-holder",onMouseDown:b,children:[h&&s.jsx(Lt,{variant:n,inline:!!p,position:"start",children:h}),f,w&&s.jsx(Lt,{position:"end",children:w}),!p&&n==="outlined"&&s.jsx("fieldset",{className:j,children:s.jsx("legend",{children:e?s.jsx("span",{children:e}):s.jsx("span",{className:"smwb-notranslate",children:""})})})]}),!p&&t&&s.jsx("p",{className:"smwb-text-field__helper-line",children:s.jsx("span",{className:"smwb-text-field__helper-text",children:t})})]})}const Oe=i.forwardRef(function(t,n){const{label:a,helperText:r,variant:c="outlined",size:l="medium",required:o,className:d,disabled:u,value:m,defaultValue:f,onChange:b,onFocus:h,onBlur:w,error:p,name:_,type:v="text",readOnly:g,placeholder:x,fullWidth:S,id:j,startAdornment:T,endAdornment:R,inline:k,autoComplete:N,inputMode:C,...E}=t,[D,A]=i.useState(!1),[z,$]=i.useState(!1),{current:M}=i.useRef(m!=null),F=i.useRef(null),I=ge(n,F),K=L=>{if(u){L.stopPropagation();return}h==null||h(L),A(!0)},ne=L=>{if(!M){const B=L.target||F.current;G({value:B.value})}w==null||w(L,t),A(!1)},G=i.useCallback(L=>{const B=!!ja(L);$(X=>X===B?X:B)},[]),ce=L=>{if(!M){const B=L.target||F.current;G({value:B.value})}b==null||b(L,t)},Z=L=>{F.current&&L.currentTarget===L.target&&(L.preventDefault(),F.current.focus())};i.useEffect(()=>{u&&D&&A(!1)},[u,D]),i.useEffect(()=>{M||G(F.current)}),_e(()=>{M&&G({value:m})},[m,M,G]);const te=y("smwb-text-field__input",(!a||k)&&"smwb-text-field__input--show-placeholder",T&&"smwb-text-field__input--adornment-start",R&&"smwb-text-field__input--adornment-end",k&&"smwb-text-field__input--inline");return s.jsx(Le,{label:a,helperText:r,variant:c,disabled:u,className:y(d,l!=="medium"&&`smwb-text-field_size-${l}`),error:p,fullWidth:S,isFilledState:z,isFocused:D,htmlFor:j,shrink:!!T,onHolderMouseDown:Z,startAdornment:T,endAdornment:R,inline:k,...E,children:s.jsx("input",{type:v,defaultValue:f,name:_,readOnly:g,required:o,"aria-invalid":p||void 0,"aria-required":o||void 0,placeholder:x,disabled:u,value:m,className:te,ref:I,onChange:ce,onFocus:K,onBlur:ne,id:j,autoComplete:N,inputMode:C})})}),Ys=["pending","sent","delivered","read"],Xs={pending:"progress_activity",sent:"check",delivered:"done_all",read:"done_all"},Ks={pending:"В обработке",sent:"Отправлено",delivered:"Доставлено",read:"Прочитано"},Wt=["floating","fullHeight","fullscreen"],Ws=10;function Ut(e){return Ys.includes(e)}function Us(e,t){const n=t==null?void 0:t[e];if(n)return n;if(Ut(e))return Xs[e]}function Gs(e){return Ut(e)?Ks[e]:String(e)}function qs(e){var t;return(t=e.mimeType)!=null&&t.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name)}function Zs(e){if(!e)return"";const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?String(e):new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(t)}function Gt(e){return e==null?["floating"]:e.length===0?[]:Wt.filter(t=>e.includes(t))}function bs(e,t){var n;return t&&t!=="closed"&&e.includes(t)?t:(n=e[0])!=null?n:"floating"}function Js(e,t){return Gt(e).filter(n=>n!=="closed"&&n!==t)}function ka(e){return e.showCloseButton===!1?!1:e.showCloseButton===!0||e.overlayContext&&e.floatingTrigger&&!e.embedded&&(e.effectiveLayout==="floating"||e.effectiveLayout==="fullHeight")?!0:!!(e.floatingTrigger&&!e.embedded&&e.effectiveLayout==="floating")}function Qs(e,t={}){if(e.key!=="Enter")return!1;const{shiftEnterNewline:n=!0,ctrlEnterNewline:a=!0}=t,r=e.ctrlKey||e.metaKey;return!!(n&&e.shiftKey&&!r||a&&r&&!e.shiftKey)}function Ct(e){e.stopPropagation()}function Na(e,t,n){var l,o;const a=(l=e.selectionStart)!=null?l:t.length,r=(o=e.selectionEnd)!=null?o:t.length,c=`${t.slice(0,a)}
|
|
2
|
+
${t.slice(r)}`;n(c),requestAnimationFrame(()=>{e.selectionStart=a+1,e.selectionEnd=a+1})}function en({className:e,onSendMessage:t,placeholder:n="message",disabled:a=!1,sendAriaLabel:r="Send message",shiftEnterNewline:c=!0,ctrlEnterNewline:l=!0,fileUpload:o=!1,attachInputId:d,onAttachClick:u,attachAriaLabel:m="Attach file"}){const[f,b]=i.useState(""),[h,w]=i.useState(!1),p=i.useId(),_=i.useRef(null),v=c||l,g=!!t&&f.trim().length>0&&!a,x=o&&!!(d||u),S=()=>{if(!t)return;const C=f.trim();!C||a||(t(C),b(""))},j=C=>{if(Qs(C,{shiftEnterNewline:c,ctrlEnterNewline:l})){C.currentTarget instanceof HTMLTextAreaElement&&(C.preventDefault(),Na(C.currentTarget,f,b));return}C.key==="Enter"&&(C.preventDefault(),S())},T=y("smwb-chat-icon-button","smwb-chat-icon-button_edge-start",a&&"smwb-chat-icon-button_disabled"),R=x?d?s.jsx("label",{htmlFor:a?void 0:d,className:T,"aria-label":m,"aria-disabled":a||void 0,"data-testid":"chat-composer-attach",onMouseDown:Ct,children:s.jsx(W,{name:"attach_file",size:24})}):s.jsx(Ue,{edge:"start","aria-label":m,"data-testid":"chat-composer-attach",disabled:a,onClick:u,onMouseDown:Ct,children:s.jsx(W,{name:"attach_file",size:24})}):null,k=t?s.jsx(Ue,{edge:"end",color:"primary","aria-label":r,"data-testid":"chat-composer-send",disabled:!g,onClick:S,onMouseDown:Ct,children:s.jsx(W,{name:"send",size:24})}):null;if(x&&!t)return s.jsx("div",{className:y("smwb-chat-composer","smwb-chat-composer_attach-only",e),"data-testid":"chat-composer",children:R});if(!v)return s.jsx(Oe,{className:y("smwb-chat-composer",e),"data-testid":"chat-composer",fullWidth:!0,value:f,disabled:a,placeholder:n,onChange:C=>b(C.target.value),startAdornment:R,endAdornment:k,onKeyDown:j});const N=C=>{_.current&&C.currentTarget===C.target&&(C.preventDefault(),_.current.focus())};return s.jsx(Le,{className:y("smwb-chat-composer",e),"data-testid":"chat-composer",fullWidth:!0,disabled:a,isFilledState:f.length>0,isFocused:h,htmlFor:p,shrink:!!R,onHolderMouseDown:N,startAdornment:R,endAdornment:k,children:s.jsx("textarea",{id:p,ref:_,className:y("smwb-text-field__input","smwb-chat-composer__input","smwb-text-field__input--show-placeholder",R&&"smwb-text-field__input--adornment-start",k&&"smwb-text-field__input--adornment-end"),value:f,disabled:a,placeholder:n,rows:1,onChange:C=>b(C.target.value),onFocus:()=>w(!0),onBlur:()=>w(!1),onKeyDown:j})})}const Ra={floating:"picture_in_picture",fullHeight:"fit_screen",fullscreen:"open_in_full"},Ta={floating:"Floating window",fullHeight:"Full height",fullscreen:"Fullscreen"};function tn({className:e,title:t,subtitle:n,actions:a,layout:r,allowedLayouts:c=["floating"],onLayoutChange:l,onClose:o}){const d=Js(c,r),u=!!l&&d.length>0;return s.jsxs("div",{className:y("smwb-chat-header",e),"data-testid":"chat-header",children:[s.jsxs("div",{className:"smwb-chat-header__main",children:[t?s.jsx("div",{className:"smwb-chat-header__title",children:t}):null,n?s.jsx("div",{className:"smwb-chat-header__subtitle",children:n}):null]}),s.jsxs("div",{className:"smwb-chat-header__actions",children:[a,u?d.map(m=>s.jsx(Ue,{"aria-pressed":r===m,"aria-label":Ta[m],"data-testid":`chat-layout-${m}`,onClick:()=>l==null?void 0:l(m),children:s.jsx(W,{name:Ra[m],size:18})},m)):null,o?s.jsx(Ue,{"aria-label":"Close chat","data-testid":"chat-close",onClick:o,children:s.jsx(W,{name:"close",size:18})}):null]})]})}const Ca={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",caption:"span",overline:"span",button:"span"},Ge=i.forwardRef(function({variant:t="body1",color:n="inherit",align:a,gutterBottom:r,noWrap:c,component:l,className:o,children:d,...u},m){const f=l!=null?l:Ca[t];return s.jsx(f,{ref:m,className:y("smwb-typography",`smwb-typography_${t}`,n!=="inherit"&&`smwb-typography_color-${n}`,a&&`smwb-typography_align-${a}`,{"smwb-typography_gutter":r,"smwb-typography_nowrap":c},o),...u,children:d})});function sn({attachment:e,className:t}){const[n,a]=i.useState(!1),[r,c]=i.useState(),l=i.useRef(null);return _e(()=>{c(document.body)},[]),e.url?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:y("smwb-chat-attachment-image",t),onClick:()=>a(!0),"data-testid":"chat-attachment-image","aria-label":e.name,children:s.jsx("img",{src:e.url,alt:e.name,className:"smwb-chat-attachment-image__img"})}),r?Re.createPortal(s.jsx(Ve.CSSTransition,{in:n,timeout:150,mountOnEnter:!0,unmountOnExit:!0,nodeRef:l,classNames:{enterActive:"smwb-chat-attachment-image__overlay_enter-active",enterDone:"smwb-chat-attachment-image__overlay_enter-done"},children:s.jsx("div",{ref:l,className:"smwb-chat-attachment-image__overlay smwb-dark",role:"dialog","aria-modal":"true","aria-label":e.name,"data-testid":"chat-attachment-image-overlay",onClick:()=>a(!1),children:s.jsx("img",{src:e.url,alt:e.name,className:"smwb-chat-attachment-image__overlay-img",onClick:o=>o.stopPropagation()})})}),r):null]}):null}function nn({attachments:e,className:t,enabled:n=!0}){return!n||!(e!=null&&e.length)?null:s.jsx("div",{className:y("smwb-chat-attachments",t),"data-testid":"chat-attachments",children:e.map(a=>qs(a)?s.jsx(sn,{attachment:a},a.id):s.jsx("a",{className:"smwb-chat-attachments__file",href:a.url,download:a.name,target:"_blank",rel:"noreferrer","data-testid":"chat-attachment-file",children:a.name},a.id))})}const ws=e=>typeof e=="string",qt=i.forwardRef(function({className:t,src:n,alt:a,size:r="medium",variant:c="circular",color:l,style:o,imgProps:d,children:u,...m},f){const[b,h]=i.useState(!1),w=!!n&&!b,p=y("smwb-avatar",`smwb-avatar_${c}`,ws(r)?`smwb-avatar_${r}`:null,t),_={...o,...ws(r)?{}:{width:r,height:r,fontSize:r/2.5},...l&&!w?{backgroundColor:l}:{}};return s.jsx("div",{ref:f,...m,"data-testid":"avatar",className:p,style:_,children:w?s.jsx("img",{...d,className:y("smwb-avatar__img",d==null?void 0:d.className),src:n,alt:a,onError:v=>{var g;h(!0),(g=d==null?void 0:d.onError)==null||g.call(d,v)}}):s.jsx("span",{className:"smwb-avatar__fallback",role:"img","aria-label":a,children:u})})}),Sa=i.forwardRef(function({className:t,max:n=5,total:a,onSurplusClick:r,children:c,...l},o){const d=i.Children.toArray(c).filter(i.isValidElement),u=a!=null?a:d.length,m=Math.max(n,1),f=d.slice(0,m),b=u-f.length;return s.jsxs("div",{ref:o,...l,"data-testid":"avatar-group",className:y("smwb-avatar-group",t),children:[b>0?s.jsx(qt,{className:"smwb-avatar-group__surplus",onClick:r,style:r?{cursor:"pointer"}:void 0,children:`+${b}`}):null,f]})});function Ot({author:e,enabled:t=!0,className:n}){var a,r;return t?s.jsx("div",{className:y("smwb-chat-message__avatar",n),"data-testid":"chat-message-avatar",children:s.jsx(qt,{src:e==null?void 0:e.avatarSrc,alt:(a=e==null?void 0:e.avatarAlt)!=null?a:e==null?void 0:e.name,size:"small",children:(r=e==null?void 0:e.name)==null?void 0:r.slice(0,1)})}):null}function an({className:e,message:t,status:n,statusIcons:a,renderStatus:r}){if(r){const d=r({message:t,status:n});if(d!=null)return s.jsx("span",{className:y("smwb-chat-message__status",`smwb-chat-message__status_${n}`,e),"data-testid":"chat-message-status",children:d})}const c=Us(n,a);if(!c)return null;const l=Gs(n),o=n==="read";return s.jsx("span",{className:y("smwb-chat-message__status",`smwb-chat-message__status_${n}`,e),"data-testid":"chat-message-status","aria-label":l,title:l,children:s.jsx(W,{name:c,size:14,fill:o?1:0})})}function Zt({className:e,align:t,message:n,author:a,text:r,attachments:c,timestamp:l,status:o,showAvatars:d=!1,showAttachments:u=!1,showStatus:m=!1,statusIcons:f,renderStatus:b,bubbleClassName:h}){const w=Zs(l),p=o!=null?o:n.status,_=m&&t==="end"&&p;return s.jsxs("div",{className:y("smwb-chat-message",`smwb-chat-message_${t}`,e),"data-testid":`chat-message-${t}`,children:[t==="start"?s.jsx(Ot,{author:a,enabled:d}):null,s.jsxs("div",{className:"smwb-chat-message__content",children:[a!=null&&a.name?s.jsx(Ge,{variant:"caption",className:"smwb-chat-message__author",children:a.name}):null,s.jsxs("div",{className:y("smwb-chat-message__bubble",h),children:[r?s.jsx("div",{className:"smwb-chat-message__text",children:r}):null,s.jsx(nn,{attachments:c,enabled:u})]}),w||_?s.jsxs("div",{className:"smwb-chat-message__meta","data-testid":"chat-message-meta",children:[w?s.jsx(Ge,{variant:"caption",className:"smwb-chat-message__time",children:w}):null,_?s.jsx(an,{message:n,status:p,statusIcons:f,renderStatus:b}):null]}):null]}),t==="end"?s.jsx(Ot,{author:a,enabled:d}):null]})}function rn({message:e,showAvatars:t,showAttachments:n,className:a}){return s.jsx(Zt,{className:a,align:"start",message:e,author:e.author,text:e.text,attachments:e.attachments,timestamp:e.timestamp,showAvatars:t,showAttachments:n,bubbleClassName:"smwb-chat-message__bubble_incoming"})}function ln({message:e,showAvatars:t,showAttachments:n,showStatus:a,statusIcons:r,renderStatus:c,className:l}){return s.jsx(Zt,{className:l,align:"end",message:e,author:e.author,text:e.text,attachments:e.attachments,timestamp:e.timestamp,status:e.status,showAvatars:t,showAttachments:n,showStatus:a,statusIcons:r,renderStatus:c,bubbleClassName:"smwb-chat-message__bubble_outgoing"})}function on({message:e,className:t}){var a;const n=(a=e.content)!=null?a:e.text;return n?s.jsx("div",{className:y("smwb-chat-message-system",t),"data-testid":"chat-message-system",children:s.jsx(Ge,{variant:"caption",children:n})}):null}function cn({message:e,showAvatars:t,showAttachments:n,showStatus:a,statusIcons:r,renderStatus:c,className:l,renderMessage:o}){var u;const d={showAvatars:t,showAttachments:n,showStatus:a,statusIcons:r,renderStatus:c};if(o)return s.jsx("div",{className:y("smwb-chat-message-item",l),children:o(e,d)});switch(e.variant){case"outgoing":return s.jsx(ln,{message:e,showAvatars:t,showAttachments:n,showStatus:a,statusIcons:r,renderStatus:c,className:l});case"system":return s.jsx(on,{message:e,className:l});case"custom":return s.jsx("div",{className:y("smwb-chat-message-item","smwb-chat-message-item_custom",l),"data-testid":"chat-message-custom",children:(u=e.content)!=null?u:e.text});case"incoming":default:return s.jsx(rn,{message:e,showAvatars:t,showAttachments:n,className:l})}}const ps=e=>typeof e=="number"?`${e}px`:e,rt=i.forwardRef(function({className:t,variant:n="text",width:a,height:r,animation:c="pulse",count:l=1,animationDelay:o,component:d="span",style:u,...m},f){const b=y("smwb-skeleton",`smwb-skeleton_${n}`,c===!1?"smwb-skeleton_no-animation":`smwb-skeleton_${c}`,t),h=d,w=p=>{const _={...u,width:ps(a),height:ps(r),...o?{animationDelay:`${p*o}ms`}:{}};return s.jsx(h,{ref:l===1?f:void 0,...l===1?m:{},"data-testid":"skeleton","aria-hidden":"true",className:b,style:_},p)};return l===1?w(0):s.jsx("span",{ref:f,...m,className:"smwb-skeleton__group","aria-hidden":"true",children:Array.from({length:l},(p,_)=>w(_))})});function un({className:e,align:t="start",showAvatar:n=!1,lines:a=2}){const r=t==="start"?"72%":"64%";return s.jsxs("div",{className:y("smwb-chat-message",`smwb-chat-message_${t}`,"smwb-chat-message-skeleton",e),"data-testid":"chat-message-skeleton","aria-hidden":"true",children:[t==="start"&&n?s.jsx(rt,{variant:"circular",width:32,height:32}):null,s.jsx("div",{className:"smwb-chat-message__content",children:s.jsxs("div",{className:"smwb-chat-message-skeleton__bubble",children:[s.jsx(rt,{variant:"rounded",width:r,height:14}),a>1?s.jsx(rt,{variant:"rounded",width:"48%",height:14}):null]})}),t==="end"&&n?s.jsx(rt,{variant:"circular",width:32,height:32}):null]})}function dn({containerRef:e,onLoadMore:t,hasMore:n=!1,loading:a=!1,rootMargin:r="80px"}){const c=i.useRef(null),l=i.useRef(a);return l.current=a,i.useEffect(()=>{const o=e.current,d=c.current;if(!o||!d||!n||!t||typeof IntersectionObserver=="undefined")return;const u=new IntersectionObserver(m=>{m.some(f=>f.isIntersecting)&&!l.current&&t()},{root:o,rootMargin:r,threshold:0});return u.observe(d),()=>u.disconnect()},[e,n,t,r]),{sentinelRef:c}}function mn(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function Bt(e){e.scrollTop=e.scrollHeight}function fn({containerRef:e,messages:t,threshold:n=24}){const a=i.useRef(!0),r=i.useRef(0),c=i.useRef(),l=i.useRef();i.useEffect(()=>{const o=e.current;if(!o)return;const d=()=>{a.current=mn(o,n)};return d(),o.addEventListener("scroll",d,{passive:!0}),()=>o.removeEventListener("scroll",d)},[e,n]),_e(()=>{var h,w;const o=e.current;if(!o)return;const d=r.current,u=c.current,m=l.current,f=(h=t[0])==null?void 0:h.id,b=(w=t[t.length-1])==null?void 0:w.id;if(u===void 0)Bt(o),a.current=!0;else{const p=f!==void 0&&f!==u&&b===m,_=b!==void 0&&b!==m;p&&d>0?o.scrollTop+=o.scrollHeight-d:_&&a.current&&Bt(o)}r.current=o.scrollHeight,c.current=f,l.current=b},[e,t])}function hn({className:e,messages:t,showAvatars:n,showAttachments:a,showStatus:r,statusIcons:c,renderStatus:l,onLoadMore:o,hasMore:d=!1,loading:u=!1,loadingMore:m=!1,loadingSkeletonCount:f=3,renderMessage:b}){const h=i.useRef(null),{sentinelRef:w}=dn({containerRef:h,onLoadMore:o,hasMore:d,loading:m||u});fn({containerRef:h,messages:t});const p=u||m,_=v=>v%2===0?"start":"end";return s.jsxs("div",{ref:h,className:y("smwb-chat-messages",e),"data-testid":"chat-messages",children:[s.jsx("div",{ref:w,className:"smwb-chat-messages__sentinel","data-testid":"chat-messages-sentinel"}),p?s.jsx("div",{className:"smwb-chat-messages__skeletons","data-testid":"chat-messages-skeletons","aria-busy":"true","aria-label":"Loading messages",children:Array.from({length:f},(v,g)=>s.jsx(un,{align:_(g),showAvatar:n,lines:g%2===0?2:1},g))}):null,u?null:t.map(v=>s.jsx(cn,{message:v,showAvatars:n,showAttachments:a,showStatus:r,statusIcons:c,renderStatus:l,renderMessage:b},v.id))]})}function bn({className:e,layout:t,anchor:n="bottom-right",themeMode:a="inherit",embedded:r=!1,overlayContext:c=!1,header:l,footer:o,children:d,fileDropzoneRootProps:u,fileDropzoneActive:m=!1}){const[f,b]=i.useState();if(_e(()=>{b(document.body)},[]),i.useEffect(()=>{if(t!=="fullscreen")return;const _=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=_}},[t]),t==="closed")return null;const{className:h,...w}=u!=null?u:{},p=s.jsxs("div",{...w,className:y("smwb-chat-shell",`smwb-chat-shell_${t}`,!r&&`smwb-chat-shell_${n}`,{"smwb-dark":a==="dark","smwb-chat-shell_embedded":r,"smwb-chat-shell_overlay-context":c,"smwb-chat-dropzone_active":m},h,e),"data-testid":"chat-shell","data-layout":t,children:[l?s.jsx("div",{className:"smwb-chat-shell__header",children:l}):null,s.jsx("div",{className:"smwb-chat-shell__body",children:d}),o?s.jsx("div",{className:"smwb-chat-shell__footer",children:o}):null]});return t==="fullscreen"&&f?Re.createPortal(p,f):p}function wn(e){return e==null?Ws:Math.max(1,e)}function pn({enabled:e=!1,accept:t,maxFiles:n,onUploadFiles:a,disabled:r=!1}){const c=wn(n),l=e&&!!a&&!r,{getRootProps:o,getInputProps:d,open:u,isDragActive:m,inputRef:f}=na.useDropzone({accept:t,maxFiles:c,multiple:c>1,disabled:!l,noClick:!0,noKeyboard:!0,useFsAccessApi:!1,onDropAccepted:h=>{a&&a(h)}});return{enabled:l,maxFiles:c,getRootProps:o,getInputProps:d,open:()=>{u==null||u()},inputRef:f,isDragActive:m}}function Pt({className:e,messages:t,showAvatars:n=!1,showAttachments:a=!1,headerTitle:r,headerSubtitle:c,headerActions:l,footer:o,children:d,anchor:u="bottom-right",themeMode:m="inherit",allowedLayouts:f,layout:b,defaultLayout:h,onLayoutChange:w,open:p,defaultOpen:_=!1,onOpenChange:v,floatingTrigger:g=!1,triggerIcon:x,triggerLabel:S,onLoadMore:j,hasMore:T,onSendMessage:R,composerPlaceholder:k="message",composerDisabled:N,composerShiftEnterNewline:C=!0,composerCtrlEnterNewline:E=!0,fileUpload:D=!1,onUploadFiles:A,fileUploadAccept:z,fileUploadMaxFiles:$,attachAriaLabel:M,loading:F,loadingMore:I,loadingSkeletonCount:K,renderMessage:ne,embedded:G=!1,overlayContext:ce=!1,showStatus:Z=!1,statusIcons:te,renderStatus:L,showCloseButton:B}){var Ce;const X=i.useMemo(()=>Gt(f!=null?f:Wt),[f]),[ee,U]=$e({value:p,defaultValue:_,onChange:v}),[se,de]=$e({value:b,defaultValue:bs(X,h),onChange:w}),ie=G?"fullHeight":g?ee?se:"closed":se,xe=()=>{U(!0),se==="closed"&&de(bs(X,h))},Q=()=>{U(!1)},me=Y=>{U(!0),de(Y)},{enabled:J,getRootProps:be,getInputProps:O,isDragActive:V}=pn({enabled:D,accept:z,maxFiles:$,onUploadFiles:A,disabled:N}),le=i.useId(),ae=!!R||J,P=J?s.jsx("input",{...O({id:le}),"data-testid":"chat-file-input"}):null,re=(Ce=o!=null?o:d)!=null?Ce:ae?s.jsxs(s.Fragment,{children:[P,s.jsx(en,{onSendMessage:R,placeholder:k,disabled:N,shiftEnterNewline:C,ctrlEnterNewline:E,fileUpload:J,attachInputId:J?le:void 0,attachAriaLabel:M})]}):void 0,je=s.jsx(hn,{messages:t,showAvatars:n,showAttachments:a,showStatus:Z,statusIcons:te,renderStatus:L,onLoadMore:j,hasMore:T,loading:F,loadingMore:I,loadingSkeletonCount:K,renderMessage:ne}),ke=J?be():void 0,Te=ka({floatingTrigger:g,embedded:G,overlayContext:ce,effectiveLayout:ie,showCloseButton:B});return s.jsxs("div",{className:y("smwb-chat",!G&&`smwb-chat_${u}`,G&&"smwb-chat_embedded",ce&&"smwb-chat_overlay-context",e),"data-testid":"chat",children:[g&&!G&&!ee?s.jsx(Hs,{className:"smwb-chat__trigger","aria-label":S!=null?S:"Open chat","data-testid":"chat-trigger",onClick:xe,children:x!=null?x:s.jsx(W,{name:"chat",size:24})}):null,s.jsx(bn,{layout:ie,anchor:u,themeMode:m,embedded:G,overlayContext:ce,fileDropzoneRootProps:ke,fileDropzoneActive:J&&V,header:s.jsx(tn,{title:r,subtitle:c,actions:l,layout:ie==="closed"?se:ie,allowedLayouts:X,onLayoutChange:me,onClose:Te?Q:void 0}),footer:re,children:je})]})}const Ma=e=>typeof e=="number"?`${e}px`:e,Da=e=>e==="left"?"bottom-left":"bottom-right";function Ea({className:e,contentClassName:t,chatClassName:n,side:a="right",chatWidth:r=400,collapsed:c,defaultCollapsed:l=!1,onCollapsedChange:o,collapseAriaLabel:d="Collapse chat panel",expandAriaLabel:u="Expand chat panel",floatingAnchor:m,chat:f,children:b,style:h,...w}){const[p,_]=$e({value:c,defaultValue:l,onChange:o}),[v,g]=$e({defaultValue:!1});i.useEffect(()=>{p||g(!1)},[p,g]);const x=m!=null?m:Da(a),S=a==="left"?"dock_to_left":"dock_to_right",j=a==="left"?"left_panel_close":"right_panel_close",T=s.jsx(Ue,{"aria-label":d,"data-testid":"chat-layout-collapse",onClick:()=>_(!0),children:s.jsx(W,{name:j,size:18})}),R=s.jsx(Ue,{"aria-label":u,"data-testid":"chat-layout-expand",onClick:()=>_(!1),children:s.jsx(W,{name:S,size:18})}),k=s.jsxs(s.Fragment,{children:[f.headerActions,T]}),N=s.jsxs(s.Fragment,{children:[f.headerActions,R]}),C={"--smwb-chat-layout-w":Ma(r)};if(p)return s.jsxs("div",{className:y("smwb-chat-layout","smwb-chat-layout_collapsed",e),style:{...C,...h},"data-testid":"chat-layout","data-collapsed":"true",...w,children:[s.jsx("div",{className:y("smwb-chat-layout__content",t),"data-testid":"chat-layout-content",children:b}),s.jsx(Pt,{...f,className:n,floatingTrigger:!0,anchor:x,allowedLayouts:["floating"],layout:"floating",open:v,onOpenChange:g,headerActions:N})]});const E=s.jsx("aside",{className:"smwb-chat-layout__panel","data-testid":"chat-layout-panel",children:s.jsx(Pt,{...f,className:n,embedded:!0,allowedLayouts:[],headerActions:k})});return s.jsxs("div",{className:y("smwb-chat-layout",`smwb-chat-layout_${a}`,e),style:{...C,...h},"data-testid":"chat-layout","data-collapsed":"false",...w,children:[a==="left"?E:null,s.jsx("div",{className:y("smwb-chat-layout__content",t),"data-testid":"chat-layout-content",children:b}),a==="right"?E:null]})}const Aa=i.forwardRef(function({className:t,color:n="primary",badgeContent:a,variant:r="outside",vertical:c="top",horizontal:l="right",max:o,showZero:d=!1,badgeAriaLabel:u,children:m,...f},b){const h=a===0||a==="0",w=(a==null||h&&!d)===!0;let p=a;typeof a=="number"&&o!==void 0&&a>o&&(p=`${o}+`);const _=y("smwb-badge",`smwb-badge_${n}`,`smwb-badge_${r}`,`smwb-badge_${r}_${c}`,`smwb-badge_${r}_${c}_${l}`,t,{"smwb-badge_no-content":w});return s.jsxs("span",{className:"smwb-badge__wrapper","data-testid":"badge",children:[m,s.jsx("span",{ref:b,className:_,"aria-label":u,...f,children:w?null:p})]})}),Ia=i.forwardRef(function({className:t,variant:n="elevated",children:a,disabled:r,title:c,footer:l,onClick:o,onKeyDown:d,...u},m){const f=!!o&&!r,b=h=>{d==null||d(h),f&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),o==null||o(h))};return s.jsxs("div",{ref:m,"data-testid":"card",className:y("smwb-card",`smwb-card_${n}`,t,{card_disabled:r,"smwb-card_interactive":f}),role:f?"button":void 0,tabIndex:f?0:void 0,"aria-disabled":r||void 0,onClick:f?o:void 0,onKeyDown:b,...u,children:[c&&s.jsx("div",{className:"smwb-card__title",children:c}),a,l&&s.jsx("div",{className:"smwb-card__footer",children:l})]})}),Jt=i.forwardRef(function({label:t,className:n,deleteIcon:a,icon:r,onDelete:c,onMouseDown:l,onDeleteMouseDown:o,asLink:d,href:u,target:m="_blank",selected:f,variant:b="filled",size:h="medium",color:w="default",disabled:p=!1,onClick:_,deleteAriaLabel:v="Remove",...g},x){const S=i.useRef(null),j=D=>{l==null||l(D)},T=D=>{var A;p||(A=S.current)==null||A.onRipple(D)},R=D=>{o==null||o(D),D.stopPropagation()},k=y("smwb-chip",`smwb-${b}`,`smwb-chip_size-${h}`,w!=="default"&&`smwb-chip_color-${w}`,n,{"smwb-disabled":p,"smwb-selected":f}),N=!!c&&s.jsx("button",{type:"button",className:"smwb-chip__delete-icon","aria-label":v,disabled:p,onClick:c,onMouseDown:R,children:a||s.jsx(W,{name:"cancel",size:18,fill:1})}),C=s.jsxs(s.Fragment,{children:[r&&s.jsx("span",{className:"smwb-chip__icon",children:r}),s.jsx("span",{className:"smwb-chip__label",children:t}),N,s.jsx(De,{actionRef:S})]});if(d&&u)return s.jsx("a",{ref:x,"data-testid":"chip-link",className:k,href:u,onMouseDown:j,onPointerDown:T,target:m,rel:"noreferrer",...g,children:C});const E=!!_&&!p;return s.jsx("span",{ref:x,"data-testid":"chip",className:k,role:E?"button":void 0,tabIndex:E?0:void 0,"aria-disabled":p||void 0,onClick:E?_:void 0,onKeyDown:E?D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),_==null||_())}:void 0,onMouseDown:j,onPointerDown:T,...g,children:C})});function $a({options:e,value:t,multiple:n,onChange:a,size:r="medium",color:c="primary",disabled:l,className:o,...d}){const u=()=>t==null?[]:Array.isArray(t)?t:[t],m=b=>u().includes(b),f=b=>{if(n){const h=u(),w=h.includes(b)?h.filter(p=>p!==b):[...h,b];a==null||a(w)}else a==null||a(b)};return s.jsx("div",{...d,role:"group",className:y("smwb-chip-group",o),children:e.map(b=>s.jsx(Jt,{label:b.label,icon:b.icon,size:r,color:c,selected:m(b.value),variant:m(b.value)?"filled":"outlined",disabled:!!(l||b.disabled),onClick:()=>f(b.value)},b.value))})}const _n=i.forwardRef(function({src:t,alt:n,fallback:a,lazy:r=!0,aspectRatio:c,className:l,onError:o,...d},u){const[m,f]=i.useState(!1),[b,h]=i.useState(!r),w=i.useRef(null),p=ge(u,w);i.useEffect(()=>{if(!r||b)return;const g=w.current;if(!g)return;if(typeof IntersectionObserver=="undefined"){h(!0);return}const x=new IntersectionObserver(S=>{S.some(j=>j.isIntersecting)&&(h(!0),x.disconnect())});return x.observe(g),()=>x.disconnect()},[r,b]);const _=m||!t,v=g=>{f(!0),o==null||o(g)};return s.jsxs("span",{className:y("smwb-lazy-image",l,{"smwb-lazy-image--empty":_}),style:c!=null?{aspectRatio:String(c)}:void 0,children:[_&&a?s.jsx("span",{className:"smwb-lazy-image__fallback",children:a}):null,_?null:s.jsx("img",{...d,ref:p,className:"smwb-lazy-image__img",src:b?t:void 0,alt:n!=null?n:"",loading:r?"lazy":void 0,decoding:"async",onError:v})]})}),Fa=i.forwardRef(function({src:t,caption:n,selected:a,onSelect:r,fallback:c,hoverPreview:l,topStart:o,topEnd:d,lazy:u=!0,disabled:m,hoverDelay:f=350,className:b,...h},w){const p=i.useRef(null),_=ge(w,p),[v,g]=i.useState(null),x=i.useRef(null),S=()=>{x.current&&(clearTimeout(x.current),x.current=null)},j=()=>{l==null||m||(S(),x.current=setTimeout(()=>{var C;const N=(C=p.current)==null?void 0:C.getBoundingClientRect();N&&g({top:N.top,left:N.right+8})},f))},T=()=>{S(),g(null)};i.useEffect(()=>S,[]);const R=!!r&&!m,k=N=>{R&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),r==null||r())};return s.jsxs("div",{...h,ref:_,className:y("smwb-thumb-card",b,{"smwb-thumb-card--selected":a,"smwb-thumb-card--disabled":m,"smwb-thumb-card--interactive":R}),role:R?"button":void 0,tabIndex:R?0:void 0,"aria-pressed":r?a!=null?a:!1:void 0,"aria-disabled":m||void 0,onClick:R?()=>r==null?void 0:r():void 0,onKeyDown:k,onMouseEnter:j,onMouseLeave:T,children:[s.jsxs("div",{className:"smwb-thumb-card__media",children:[s.jsx(_n,{src:t,lazy:u,fallback:c}),o?s.jsx("div",{className:"smwb-thumb-card__slot smwb-thumb-card__slot--start",children:o}):null,d?s.jsx("div",{className:"smwb-thumb-card__slot smwb-thumb-card__slot--end",children:d}):null]}),n?s.jsx("div",{className:"smwb-thumb-card__caption",children:n}):null,v&&typeof document!="undefined"?Re.createPortal(s.jsx("div",{className:"smwb-thumb-card__preview",style:{position:"fixed",top:v.top,left:v.left},children:typeof l=="string"?s.jsx("img",{src:l,alt:""}):l}),document.body):null]})});function La({items:e,renderItem:t,minColumn:n=160,rowHeight:a,gap:r=8,overscan:c=2,loading:l,loadingCount:o=12,emptyLabel:d,className:u,style:m}){const f=i.useRef(null),[b,h]=i.useState(0),[w,p]=i.useState(0),[_,v]=i.useState(!1);i.useEffect(()=>{const k=f.current;if(!k||typeof ResizeObserver=="undefined")return;const N=new ResizeObserver(()=>{h(k.clientWidth),p(k.clientHeight),v(!0)});return N.observe(k),()=>N.disconnect()},[]);const g=i.useMemo(()=>b<=0?1:Math.max(1,Math.floor((b+r)/(n+r))),[b,r,n]),x=Math.ceil(e.length/g),S=Kt({itemCount:x,itemHeight:a+r,viewportHeight:w||1,overscan:c}),j={display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr))`,gap:r,gridAutoRows:a},T={display:"grid",gridTemplateColumns:`repeat(${g}, minmax(0, 1fr))`,gap:r,height:a,marginBottom:r};let R;return l?R=s.jsx("div",{className:"smwb-asset-grid__plain",style:j,children:Array.from({length:o}).map((k,N)=>s.jsx("div",{className:"smwb-asset-grid__skeleton",style:{height:a}},N))}):e.length===0?R=s.jsx("div",{className:"smwb-asset-grid__empty",children:d}):_?R=s.jsx("div",{className:"smwb-asset-grid__sizer",style:{height:S.totalHeight,position:"relative"},children:s.jsx("div",{className:"smwb-asset-grid__band",style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${S.offsetY}px)`},children:Array.from({length:Math.max(0,S.endIndex-S.startIndex)}).map((k,N)=>{const C=S.startIndex+N;return s.jsx("div",{className:"smwb-asset-grid__row",style:T,children:Array.from({length:g}).map((E,D)=>{const A=C*g+D;return A<e.length?s.jsx(i.Fragment,{children:t(e[A],A)},D):null})},C)})})}):R=s.jsx("div",{className:"smwb-asset-grid__plain",style:j,children:e.map((k,N)=>s.jsx(i.Fragment,{children:t(k,N)},N))}),s.jsx("div",{ref:f,className:y("smwb-asset-grid",u),style:m,onScroll:S.onScroll,children:R})}const gn="data-smwb-overlay-layer",Oa=()=>typeof document=="undefined"?[]:Array.from(document.querySelectorAll(`[${gn}]`)),Ba=(e,t)=>typeof e.composedPath!="function"?!1:e.composedPath().some(n=>n instanceof Element&&n.hasAttribute(gn)&&!n.contains(t)),xn=e=>{if(!e)return!0;const t=Oa(),n=t[t.length-1];return!n||n===e||n.contains(e)||e.contains(n)},Pa=i.forwardRef(function({children:t,onClose:n,open:a,className:r,animation:c="fade",backdrop:l="dark",size:o="large",closeOnOutsideClick:d=!0,asForm:u=!1,disableAppearAnimation:m=!1,role:f="dialog",closeOnEsc:b=!0,...h},w){const[p,_]=i.useState(),v=i.useRef(null),g=i.useRef(null),x=ge(w,g);if(_e(()=>{_(document.body)},[]),i.useEffect(()=>{if(!a||!b||!n)return;const j=T=>{T.key==="Escape"&&xn(v.current)&&n()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[a,b,n]),!p)return s.jsx(s.Fragment,{});const S=u?"form":"div";return Re.createPortal(s.jsx(Ve.CSSTransition,{timeout:{appear:225,enter:225,exit:150},in:a,classNames:{appear:"smwb-modal__overlay-appear",appearActive:"smwb-modal__overlay-appear-active",appearDone:"smwb-modal__overlay-appear-done",enter:"smwb-modal__overlay-enter",enterActive:"smwb-modal__overlay-enter-active",enterDone:"smwb-modal__overlay-enter-done",exit:"smwb-modal__overlay-exit",exitActive:"smwb-modal__overlay-exit-active"},appear:!m,mountOnEnter:!0,unmountOnExit:!0,nodeRef:v,children:s.jsx("div",{ref:v,"data-smwb-overlay-layer":"",className:y("smwb-modal__overlay",`smwb-${l}`,`smwb-${o}`),onClick:d&&n?n:void 0,children:s.jsx(S,{ref:x,className:y("smwb-modal",`smwb-${o}`,`smwb-${c}`,r),onClick:j=>j.stopPropagation(),role:f,"aria-modal":"true",...h,children:t})})}),p)});function za({className:e,children:t}){return s.jsx("div",{className:y("smwb-modal__header",e),children:t})}function Va({className:e,children:t}){return s.jsx("div",{className:y("smwb-modal__content",e),children:t})}function Ha({className:e,children:t}){return s.jsx("div",{className:y("smwb-modal__footer",e),children:t})}const Ye=Object.assign(Pa,{Footer:Ha,Header:za,Content:Va});function Ya(e,t){const n=Math.floor(e/t);return e%t===0?n-1:n}function _s(e,t,n,a){const r=Ya(n,t);return e===n+t?0:a||e<t&&e!==0?r:e===0?n%t===0?r:r-1:t>0?Math.floor(e/t)-1:0}function vn(e){return!(e instanceof Event)}function gt(e){return vn(e)&&e.nativeEvent instanceof MouseEvent||e instanceof MouseEvent}function Qt(e){return window.TouchEvent&&(vn(e)&&e.nativeEvent instanceof TouchEvent||e instanceof TouchEvent)}function St(e){return gt(e)?e.clientX:Qt(e)?e.changedTouches[0].clientX:0}function gs(e){return gt(e)?e.clientY:Qt(e)?e.changedTouches[0].clientY:0}function xs(e){const t=e.target;(t.tagName==="A"||t.tagName==="IMG")&&e.preventDefault()}function Xa(e){return{width:`${yn(e)}%`}}function yn(e){return 100/e}function Ka(e,t){return e<=0||t===0?1:e>t?t:e}function Wa(e,t,n){return Math.min(Math.max(e,t),n)}function Mt(e){if(e!=null)return typeof e=="number"?`${e}px`:e}function Ua(e){if(e!=null)return String(e)}function Ga(e,t){if(e<=0||t===0)return 0;const n=t-1;return e>n?n:e}function Me(e){const t=i.useRef(e);return _e(()=>{t.current=e}),i.useCallback((...n)=>(0,t.current)(...n),[])}const qa={isPressed:!1,startX:0,startY:0,lastX:0,lastT:0,axis:null,dragged:!1},vs=8,Za=.4,Ja=i.forwardRef(function({slidesToShow:t=3,startSlide:n=0,children:a,className:r,showNavigation:c=!0,showArrows:l,arrowsSize:o=30,navigationClassName:d,onSlideChange:u,navigationDotRenderer:m,"aria-label":f="Carousel",autoplay:b=!1,autoplayInterval:h=4e3,pauseOnHover:w=!0,cellHeight:p,aspectRatio:_,gap:v,maxWidth:g,enableFullscreen:x=!1},S){const j=i.Children.count(a),T=Ka(t,j),R=Ga(n,j),k=l&&j>1,N=Math.max(0,j-T),[C,E]=i.useState(R),[D,A]=i.useState({animation:void 0}),[z,$]=i.useState(0),[M,F]=i.useState(!1),[I,K]=i.useState(null),[ne,G]=i.useState(0),[ce,Z]=i.useState(!1),te=i.useRef(null),L=i.useRef(null),B=ge(S,L),X=i.useRef(null),[ee,U]=i.useState(!1),se=i.useRef({...qa});_e(()=>{A(H=>({...H,animation:!1}))},[T]),_e(()=>{E(R),u==null||u(R),D.animation!==void 0&&A(H=>({...H,animation:!0}))},[R]);const de=H=>{Object.assign(se.current,H)},ie=()=>typeof performance!="undefined"?performance.now():Date.now(),xe=H=>{const q=Wa(H,0,N);E(q),A(he=>({...he,animation:!0})),u==null||u(q)},Q=H=>{K(q=>q===null?q:(q+H+j)%j)},me=i.useRef(null),J=H=>{X.current&&(X.current.removeEventListener(H?"mousemove":"touchmove",O),X.current.removeEventListener(H?"mouseup":"touchend",V),H&&X.current.removeEventListener("mouseleave",V))},be=Me(H=>{if(!X.current)return;const q=gt(H);if(q&&H.button!==0)return;H.stopPropagation();const he=St(H),we=gs(H);de({isPressed:!0,startX:he,startY:we,lastX:he,lastT:ie(),axis:null,dragged:!1}),X.current.addEventListener(q?"mousemove":"touchmove",O,{passive:!1}),X.current.addEventListener(q?"mouseup":"touchend",V),q&&X.current.addEventListener("mouseleave",V)}),O=Me(H=>{if(!te.current||!se.current.isPressed)return;if(Qt(H)&&H.touches.length>1)return V(H);const q=St(H),he=gs(H),we=q-se.current.startX,ve=he-se.current.startY;if(se.current.axis===null){if(Math.abs(we)<vs&&Math.abs(ve)<vs)return;const Ae=Math.abs(we)>=Math.abs(ve)?"x":"y";if(de({axis:Ae,dragged:!0}),Ae==="y")return V(H);j>1&&F(!0)}if(se.current.axis==="x"){if(H.preventDefault(),H.stopPropagation(),j>1){const Ae=C<=0,Ie=C>=N,Be=Ae&&we>0||Ie&&we<0?we*.35:we;$(Be)}se.current.lastX=q,se.current.lastT=ie()}}),V=Me(H=>{if(!se.current.isPressed)return;const q=gt(H);J(q);const{axis:he,dragged:we,startX:ve,lastX:Ae,lastT:Ie}=se.current;if(de({isPressed:!1}),F(!1),he==="x"&&we&&j>1&&te.current){const Be=St(H),ht=Be-ve,tt=te.current.offsetWidth/T,bt=Ie?(Be-Ae)/Math.max(1,ie()-Ie):0;let st=tt>0?Math.round(-ht/tt):0;st===0&&Math.abs(bt)>Za&&(st=bt<0?1:-1),xe(C+st)}$(0)}),le=H=>()=>{se.current.dragged||x&&K(H)},ae=H=>()=>xe(H),P=H=>{const q=T===1,he=q?j:Math.ceil(j/T),we=C+T,ve=j-T<=C,Ie=(_s(we,T,j,ve)+H+he)%he;return q?Ie:Ie*T},re=()=>{if(!c)return s.jsx(s.Fragment,{});const H=j-T<=C,q=T===1,he=q?j:Math.ceil(j/T),we=[];for(let ve=0;ve<he;ve++){let Ae=ve,Ie=C;if(!q){const bt=ve===he-1,st=C+T;Ae=bt?j-T:ve*T,Ie=_s(st,T,j,H)}const Be=Ie===ve,ht=ae(Ae);let tt=s.jsx("div",{className:y("smwb-carousel__navigation__dot",Be&&"current"),onClick:ht},ve);m&&(tt=m(ve,Be,ht)),we.push(tt)}return s.jsx("div",{className:y("smwb-carousel__navigation",d),children:we})},oe=()=>{const H=C>N?N:C;return yn(T)*H},je=i.useId(),ke=Xa(T),Ce={transform:`translateX(calc(-${oe()}% + ${z}px))`,transition:M||D.animation===void 0?"none":D.animation?"transform 500ms cubic-bezier(.1, 0, .25, 1)":"none"},Y={},ue=Mt(p),ye=Ua(_),Ee=Mt(v),Fe=Mt(g);if(ue&&(Y["--smwb-carousel-cell-height"]=ue),ye&&(Y["--smwb-carousel-aspect-ratio"]=ye),Ee&&(Y["--smwb-carousel-gap"]=Ee),Fe&&(Y["--smwb-carousel-max-width"]=Fe),i.useEffect(()=>{Array.isArray(a)||console.error("SMWB Material: The `children` prop was passed invalidly. It should contain an array of elements.")},[a]),i.useEffect(()=>{if(!b||j<=1||w&&ee||I!==null)return;const H=window.setInterval(()=>{ae(P(1))()},h);return()=>window.clearInterval(H)},[b,h,w,ee,j,C,T,I]),i.useEffect(()=>{if(I===null||j<=1)return;const H=q=>{q.key==="ArrowLeft"?Q(-1):q.key==="ArrowRight"&&Q(1)};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[I,j]),!Array.isArray(a))return s.jsx(s.Fragment,{});const ft=a,et=H=>{var q,he;me.current=(he=(q=H.touches[0])==null?void 0:q.clientX)!=null?he:null},Nt=H=>{var he,we;if(me.current===null||j<=1)return;const q=((we=(he=H.touches[0])==null?void 0:he.clientX)!=null?we:me.current)-me.current;Z(!0),G(q)},ta=H=>{var we,ve;const q=me.current;if(me.current=null,Z(!1),G(0),q===null||j<=1)return;const he=((ve=(we=H.changedTouches[0])==null?void 0:we.clientX)!=null?ve:q)-q;Math.abs(he)>40&&Q(he<0?1:-1)},sa={transform:`translateX(calc(-${(I!=null?I:0)*100}% + ${ne}px))`,transition:ce?"none":"transform 350ms cubic-bezier(.22, .61, .36, 1)"};return s.jsxs("div",{className:y("smwb-carousel",r),"data-testid":"carousel",ref:B,role:"region","aria-roledescription":"carousel","aria-label":f,style:Y,onMouseEnter:w?()=>U(!0):void 0,onMouseLeave:w?()=>U(!1):void 0,children:[s.jsxs("div",{className:y("smwb-carousel__inner"),ref:te,children:[k&&s.jsx(W,{name:"chevron_left",size:o,className:y("smwb-carousel__arrow","smwb-carousel__arrow_prev"),style:{top:`calc(50% - ${o/2}px)`,left:-o/2},onClick:()=>ae(P(-1))()}),s.jsx("div",{ref:X,className:"smwb-carousel__track",onMouseDown:be,onTouchStart:be,onDragStart:xs,onDragEnd:xs,children:s.jsx("div",{className:"smwb-carousel__layer",style:Ce,children:i.Children.map(a,(H,q)=>s.jsx("div",{id:`${je}${q}`,className:"smwb-carousel__slide",style:ke,children:s.jsx("div",{className:y("smwb-carousel__slide-inner",x&&"smwb-carousel__slide-inner_clickable"),onClick:x?le(q):void 0,children:H})},q))})}),k&&s.jsx(W,{name:"chevron_right",size:o,className:y("smwb-carousel__arrow","smwb-carousel__arrow_next"),style:{top:`calc(50% - ${o/2}px)`,right:-o/2},onClick:()=>ae(P(1))()})]}),re(),x&&s.jsx(Ye,{open:I!==null,size:"fullscreen",backdrop:"darkBlured",className:"smwb-carousel__fullscreen",onClose:()=>K(null),"aria-label":"Image viewer",children:I!==null&&s.jsxs("div",{className:"smwb-carousel__fullscreen-content",children:[j>1&&s.jsx(W,{name:"chevron_left",size:40,className:y("smwb-carousel__fullscreen-arrow","smwb-carousel__fullscreen-arrow_prev"),onClick:()=>Q(-1)}),s.jsx("div",{className:"smwb-carousel__fullscreen-stage",onTouchStart:et,onTouchMove:Nt,onTouchEnd:ta,children:s.jsx("div",{className:"smwb-carousel__fullscreen-track",style:sa,children:ft.map((H,q)=>s.jsx("div",{className:"smwb-carousel__fullscreen-slide","aria-hidden":q!==I,children:H},q))})}),j>1&&s.jsx(W,{name:"chevron_right",size:40,className:y("smwb-carousel__fullscreen-arrow","smwb-carousel__fullscreen-arrow_next"),onClick:()=>Q(1)}),s.jsx(W,{name:"close",size:32,className:"smwb-carousel__fullscreen-close",onClick:()=>K(null)})]})})]})}),Qa=()=>{const[e,t]=i.useState(!1),n=i.useCallback(()=>{t(!1)},[]),a=i.useCallback(()=>{t(!0)},[]);return{onClose:n,onOpen:a,isOpen:e}},jn=i.createContext({rowsHeight:0}),er=({className:e,src:t,rounded:n,itemBarContent:a,cols:r=1,rows:c=1,itemBarPlacement:l="bottom",alt:o="image"})=>{const{isOpen:d,onClose:u,onOpen:m}=Qa(),{rowsHeight:f,variant:b}=i.useContext(jn);i.useEffect(()=>{d?document.body.style.overflow="hidden":document.body.style.overflow="auto"},[d]);const h={height:f?`${f*c}px`:"",gridRowEnd:`span ${c}`,gridColumnEnd:`span ${r}`};return s.jsxs(s.Fragment,{children:[s.jsx("li",{"data-testid":"images-list-item",className:y("smwb-gallery__list__item",e,"smwb-gallery-item",`smwb-${b}`),onClick:m,style:h,children:s.jsxs("div",{className:"smwb-gallery-item__inner",children:[s.jsx("div",{className:"smwb-gallery-item__img-wrapper",children:s.jsx("img",{src:t,alt:o||"image",className:y("smwb-gallery-item__img",{"smwb-rounded":n})})}),a&&s.jsx("div",{className:y("smwb-gallery-item__bar",e,`smwb-${l}`,{"smwb-rounded":n}),children:a})]})}),s.jsx(kn,{src:t,onClose:u,isOpen:d})]})},tr=i.forwardRef(function({className:t,children:n,gap:a=4,cols:r=3,rowsHeight:c=0,variant:l="default","aria-label":o,id:d},u){return s.jsx(jn.Provider,{value:{rowsHeight:c,variant:l},children:s.jsx("div",{className:y("smwb-gallery",t),"data-testid":"images-list",ref:u,id:d,children:s.jsx("ul",{"aria-label":o,className:y("smwb-gallery__list",`smwb-${l}`),style:{"--cols-count":r,"--gap":`${a}px`},children:n})})})}),kn=({src:e,onClose:t,isOpen:n})=>{const a=i.useRef(null);return Re.createPortal(s.jsx(Ve.CSSTransition,{timeout:100,in:n,classNames:{enterActive:"smwb-image-modal__overlay-enter-active",enterDone:"smwb-image-modal__overlay-enter-done"},mountOnEnter:!0,unmountOnExit:!0,nodeRef:a,children:s.jsx("div",{className:"smwb-image-modal__overlay",onClick:t,ref:a,children:s.jsx("div",{className:"smwb-image-modal",onClick:r=>r.stopPropagation(),children:s.jsx("img",{src:e,alt:"",className:"smwb-image-modal__img"})})})}),document.body)},sr=i.forwardRef(function({className:t,children:n,disabled:a,selected:r,dense:c,divider:l,startAdornment:o,endAdornment:d,onClick:u},m){const f=!!u&&!a;return s.jsxs("li",{ref:m,role:"listitem",tabIndex:f?0:void 0,"aria-disabled":a||void 0,"aria-selected":r||void 0,onClick:a?void 0:u,onKeyDown:f?b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),u==null||u(b))}:void 0,className:y("smwb-list__item",t,{"smwb-disabled":a,"smwb-selected":r,"smwb-list__item_dense":c,"smwb-list__item_divider":l}),"data-testid":"list-item",children:[s.jsx("span",{className:"smwb-list__item__start",children:o}),s.jsx("span",{className:"smwb-list__item__main",children:n}),s.jsx("span",{className:"smwb-list__item__end",children:d})]})}),nr=i.forwardRef(function({className:t,dense:n,subheader:a,children:r,...c},l){return s.jsxs("ul",{ref:l,"data-testid":"list",role:"list",className:y("smwb-list",{"smwb-list_dense":n},t),...c,children:[a?s.jsx("li",{className:"smwb-list__subheader",children:a}):null,r]})}),Nn=({limit:e,page:t,totalCount:n,onPrev:a,onNext:r,limitOptions:c,onLimitChange:l,hasNextPage:o})=>{const d=typeof n=="undefined",u=d?!o:t===Math.ceil(n/e),m=w=>{l&&l(+w.target.value)},f=()=>{a==null||a()},b=()=>{r==null||r()},h=()=>{const w=t*e-e,p=t*e;return`${w}–${p}`+(d?"":` of ${n}`)};return s.jsx("div",{className:"smwb-table__pagination",children:s.jsxs("div",{className:"smwb-table__pagination__controls",children:[c&&c.length>1&&s.jsxs("div",{className:"smwb-table__pagination__rows",children:[s.jsx("span",{children:"Rows per page"}),s.jsx("select",{id:"rows",className:"smwb-table__pagination__select",onChange:m,value:e,children:c.map(w=>s.jsx("option",{value:w,className:y("smwb-select-option",{selected:w===e}),children:w},w))})]}),s.jsx("div",{className:"smwb-table__pagination__current-count",children:h()}),s.jsxs("div",{className:"smwb-table__pagination__buttons",children:[s.jsx("button",{className:"smwb-table__pagination__control",onClick:f,disabled:t===1,children:s.jsx(W,{name:"chevron_left",size:24,weight:600})}),s.jsx("span",{className:"smwb-table__pagination__page",children:t}),s.jsx("button",{className:"smwb-table__pagination__control",onClick:b,disabled:u,children:s.jsx(W,{name:"chevron_right",size:24,weight:600})})]})]})})},ar=i.forwardRef(({className:e,dense:t,hovered:n,children:a,paginationSettings:r,isLoading:c,stickyHeader:l,caption:o,...d},u)=>s.jsxs("div",{ref:u,className:y("smwb-table__wrapper",e,{"smwb-table__wrapper_loading":c}),...d,children:[s.jsx("div",{className:y("smwb-table__container",{"smwb-withPagination":!!r}),children:s.jsxs("table",{className:y("smwb-table",{"smwb-dense":t,"smwb-hovered":n,"smwb-table_sticky-header":l}),children:[o!=null&&s.jsx("caption",{className:"smwb-table__caption",children:o}),a]})}),!!r&&s.jsx(Nn,{...r})]})),rr=({children:e,className:t,...n})=>s.jsx("tbody",{...n,className:y("smwb-table__body",t),children:e}),ir=({children:e,cellAlign:t="left",className:n,...a})=>s.jsx("td",{...a,className:y("smwb-table__cell",n),align:t||"left",children:e}),lr=({children:e,className:t,...n})=>s.jsx("thead",{...n,className:y("smwb-table__head",t),children:e}),or=({children:e,className:t,cellAlign:n="left",isSortedByAsc:a,isSortedByDesc:r,sortable:c,sortDirection:l,onSort:o,...d})=>{const u=l!==void 0?l:a?"asc":r?"desc":!1,m=c?u==="asc"?"ascending":u==="desc"?"descending":"none":void 0,f=u==="asc"?"expand_more":u==="desc"?"expand_less":"",b=h=>{c&&o&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),o())};return s.jsx("th",{...d,"aria-sort":m,className:y("smwb-table__cell","smwb-head-cell",t,{[`smwb-align_${n}`]:!!n,"smwb-head-cell_sortable":c}),children:s.jsxs("span",{className:"smwb-head-cell__content",onClick:c?o:void 0,onKeyDown:c?b:void 0,role:c?"button":void 0,tabIndex:c?0:void 0,children:[e,s.jsx(W,{name:f,size:18,weight:800})]})})},cr=({children:e,className:t,selected:n,expanded:a,...r})=>s.jsx("tr",{"data-testid":"table-row",className:y("smwb-table__row",t,{"smwb-table__row_selected":n,"smwb-table__row_expanded":a}),"aria-selected":n!=null?n:void 0,"aria-expanded":a!=null?a:void 0,...r,children:e}),ur=i.forwardRef(function({className:t,listIcon:n="draft",nodeIcon:a={closed:"folder",opened:"folder_open"},data:r=[],expanded:c,defaultExpanded:l=[],onExpandedChange:o,selected:d,defaultSelected:u=[],onSelectedChange:m,selectable:f=!1,checkboxes:b=!1,renderLabel:h,loadChildren:w,...p},_){const[v,g]=i.useState({}),[x,S]=i.useState([]),[j,T]=$e({value:c,defaultValue:l,onChange:o}),R=i.useRef(),[k,N]=$e({value:d,defaultValue:u,onChange:M=>{const F=R.current;R.current=void 0,m==null||m(M,F)}}),C=M=>{T(F=>F.includes(M)?F.filter(I=>I!==M):[...F,M])},E=(M,F)=>{T(I=>{const K=I.includes(M);return F&&!K?[...I,M]:!F&&K?I.filter(ne=>ne!==M):I})},D=M=>{R.current={id:M,selected:!k.includes(M)},N(F=>F.includes(M)?F.filter(I=>I!==M):[...F,M])},A=(M,F)=>{!w||v[F]||M.children&&M.children.length>0||(S(I=>I.includes(F)?I:[...I,F]),w(M,F).then(I=>{g(K=>({...K,[F]:I}))}).finally(()=>{S(I=>I.filter(K=>K!==F))}))},z=(M,F)=>{var X,ee;const I=(X=M.id)!=null?X:F,K=(ee=M.children)!=null?ee:v[I],ne=!!w&&(M.hasChildren||!!v[I]),G=!!K&&K.length>0||ne,ce=j.includes(I),Z=k.includes(I),te=x.includes(I),L=()=>{G&&(ce||A(M,I),C(I)),f&&D(I)},B=U=>{U.key==="Enter"||U.key===" "?(U.preventDefault(),L()):U.key==="ArrowRight"&&G?(A(M,I),E(I,!0)):U.key==="ArrowLeft"&&G&&E(I,!1)};return s.jsxs("div",{className:y("smwb-tree__node",{"smwb-tree__node_selected":Z}),role:"treeitem","aria-expanded":G?ce:void 0,"aria-selected":f||b?Z:void 0,children:[s.jsxs("span",{className:"smwb-tree__node__content",onClick:L,onKeyDown:B,tabIndex:0,role:"button",children:[b&&s.jsx("input",{type:"checkbox",className:"smwb-tree__node__checkbox",checked:Z,onClick:U=>U.stopPropagation(),onChange:()=>D(I),"aria-label":M.label}),s.jsxs("span",{className:"smwb-tree__node__label",children:[G&&ce?s.jsx(W,{name:a==null?void 0:a.opened,fill:1,size:20}):G?s.jsx(W,{name:a==null?void 0:a.closed,fill:1,size:20}):s.jsx(W,{name:n,size:20}),h?h(M,I):M.label]})]}),G&&ce&&s.jsx("div",{role:"group",children:te&&!K?s.jsx("div",{className:"smwb-tree__node__loading",role:"status",children:"Загрузка…"}):K==null?void 0:K.map((U,se)=>z(U,`${F}.${se}`))})]},I)},$=i.useMemo(()=>r.map((M,F)=>z(M,`${F}`)),[r,j,k,f,b,n,a,h,v,x]);return s.jsx("div",{"data-testid":"tree-view",...p,ref:_,role:"tree",className:y("smwb-tree",t),children:$.map((M,F)=>s.jsx("div",{className:"smwb-tree__wrapper",role:"presentation",children:M},F))})});function ys(e){return e.substring(2).toLowerCase()}function dr(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function Je({children:e,disableReactTree:t=!1,mouseEvent:n="onMouseUp",onClickAway:a,touchEvent:r="onTouchEnd",enabled:c=!0}){const l=i.useRef(!1),o=i.useRef(null),d=i.useRef(!1),u=i.useRef(!1);i.useEffect(()=>(setTimeout(()=>{d.current=!0},0),()=>{d.current=!1}),[]);const m=ge(e.ref,o),f=Me(w=>{const p=u.current;if(u.current=!1,!c||!d.current||!o.current||"clientX"in w&&dr(w,document))return;if(l.current){l.current=!1;return}let _;if(w.composedPath)_=w.composedPath().indexOf(o.current)>-1;else{const v=w.target;_=!document.documentElement.contains(v)||o.current.contains(v)}if(!_&&(t||!p)){if(Ba(w,o.current))return;a(w)}}),b=w=>p=>{u.current=!0;const _=e.props[w];_&&_(p)},h={ref:m};return r!==!1&&(h[r]=b(r)),i.useEffect(()=>{if(r!==!1){const w=ys(r),p=()=>{l.current=!0};return document.addEventListener(w,f),document.addEventListener("touchmove",p),()=>{document.removeEventListener(w,f),document.removeEventListener("touchmove",p)}}},[f,r]),n!==!1&&(h[n]=b(n)),i.useEffect(()=>{if(n!==!1){const w=ys(n);return document.addEventListener(w,f),()=>{document.removeEventListener(w,f)}}},[f,n]),s.jsx(s.Fragment,{children:i.cloneElement(e,h)})}const Rn=i.forwardRef(({className:e,children:t,type:n,severity:a,variant:r="filled",onClose:c,closeAriaLabel:l="Close",...o},d)=>{const u=a!=null?a:n,m=y("smwb-message",`smwb-message_${r}`,e,{[`smwb-message_${u}`]:!!u});return s.jsxs("div",{"data-testid":"message",role:"alert","aria-live":u==="error"?"assertive":"polite",...o,className:m,ref:d,children:[t,c&&s.jsx("button",{className:"smwb-message__close-btn",onClick:c,"aria-label":l,type:"button",children:s.jsx(W,{name:"close",weight:1e3})})]})}),mr=({children:e})=>s.jsx("div",{className:"smwb-message__header",children:e}),fr=Object.assign(Rn,{Header:mr});function hr({open:e,title:t,nameLabel:n,name:a,onNameChange:r,previewSrc:c,onCapture:l,captureLabel:o,busy:d,confirmLabel:u,cancelLabel:m,onConfirm:f,onClose:b,children:h,className:w}){const p=r!==void 0||a!==void 0;return s.jsxs(Ye,{open:e,onClose:b,size:"small",children:[s.jsx(Ye.Header,{children:t!=null?t:"Save"}),s.jsx(Ye.Content,{children:s.jsxs("div",{className:y("smwb-save-asset-dialog__body",w),children:[p?s.jsx(Oe,{label:n!=null?n:"Name",value:a!=null?a:"",disabled:!!d,onChange:_=>r==null?void 0:r(_.currentTarget.value)}):null,c?s.jsx("div",{className:"smwb-save-asset-dialog__preview",children:s.jsx("img",{src:c,alt:""})}):null,l?s.jsx(Se,{variant:"outlined",size:"small",disabled:!!d,onClick:()=>l(),label:o!=null?o:"Capture preview"}):null,h]})}),s.jsxs(Ye.Footer,{children:[s.jsx(Se,{variant:"text",disabled:!!d,onClick:()=>b(),label:m!=null?m:"Cancel"}),s.jsx(Se,{variant:"contained",disabled:!!d,onClick:()=>f(),label:u!=null?u:"Save"})]})]})}const Tn=i.forwardRef(function({type:t,variant:n,className:a,progressValue:r=0,color:c="primary",size:l="medium",id:o,...d},u){const m={role:"progressbar","aria-label":d["aria-label"],id:o,...t==="determinate"?{"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100}:{}},f=c!=="primary"?`smwb-indicator_color-${c}`:null;return n==="circular"?s.jsx("div",{ref:u,className:y("smwb-indicator_circular",`smwb-${t}`,f,`smwb-indicator_size-${l}`,a),...m,children:t==="determinate"?s.jsx(Cn,{progressValue:r}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"smwb-indicator_circular__thumb"}),s.jsx("div",{}),s.jsx("div",{}),s.jsx("div",{})]})}):s.jsx("div",{ref:u,className:y("smwb-indicator_linear",`smwb-${t}`,f,a),...m,children:s.jsx("div",{className:"smwb-indicator_linear__thumb",style:t==="determinate"?{width:`${r}%`}:{}})})});function Cn({progressValue:e=0}){const t=i.useRef(null);return i.useEffect(()=>{var a;if(!t.current||!t.current.r)return;const n=(a=t.current)==null?void 0:a.r.baseVal.value;if(n&&t.current){const r=2*Math.PI*n;t.current.style.strokeDasharray=`${r} ${r}`,t.current.style.strokeDashoffset=`${r}`;const c=r-e/100*r;t.current.style.strokeDashoffset=`${c}`}},[t,e]),s.jsx("svg",{className:"smwb-indicator_circular__svg",children:s.jsx("circle",{className:"smwb-indicator_circular__circle",cx:"24",cy:"24",r:"22",ref:t})})}function br(){const[e,t]=i.useState(null);return _e(()=>{const n=document.createElement("div");return n.id=`snackbar-portal-${Ps.v4()}`,document.body.prepend(n),t(n),()=>{document.body.removeChild(n)}},[]),{snackbarDomRoot:e}}function wr({snack:e,position:t,variant:n,className:a,component:r,autoClose:c,autoCloseTime:l,snackRest:o,onSnackRemove:d,onClose:u}){var f,b,h,w,p;const m=i.useRef(null);return s.jsx(Ve.CSSTransition,{appear:!0,timeout:125,classNames:{appear:"smwb-snackbar-enter",appearActive:"smwb-snackbar-enter-active",appearDone:"smwb-snackbar-enter-done",enter:"smwb-snackbar-enter",enterActive:"smwb-snackbar-enter-active",enterDone:"smwb-snackbar-enter-done",exitActive:"smwb-snackbar-exit-active"},unmountOnExit:!0,in:!0,nodeRef:m,children:s.jsx(_r,{ref:m,component:(f=e.component)!=null?f:r,message:e.message,position:(b=e.position)!=null?b:t,variant:(h=e.variant)!=null?h:n,onClick:d(e.id),className:y(a,e.className),isAutoClose:(w=e.autoClose)!=null?w:c,autoCloseTime:(p=e.autoCloseTime)!=null?p:l,onClose:u(e.id),...o})})}const Sn=i.createContext({addSnackbar:()=>"",clearAllSnackbars:()=>{},clearFirstSnackbar:()=>{},clearLastSnackbar:()=>{},clearByIdSnackbar:()=>{}});function pr(e){const{position:t="top-right",variant:n="dark",className:a,autoClose:r=!0,autoCloseTime:c=5e3,closeOnClick:l=!0,onClick:o,component:d="div",children:u,...m}=e,[f,b]=i.useState([]),{snackbarDomRoot:h}=br(),w=i.useCallback(R=>{const{key:k,...N}=R,C=k!=null?k:Ps.v4(),E={id:C,...N};return b(D=>{const A=D.findIndex($=>$.id===C);if(A===-1)return[...D,E];const z=[...D];return z[A]=E,z}),C},[]),p=()=>{b([])},_=()=>{b(R=>R.slice(1))},v=()=>{b(R=>R.slice(0,-1))},g=R=>{b(k=>k.filter(N=>N.id!==R))},x=R=>k=>{o==null||o(k),l&&g(R)},S=R=>()=>{g(R)},j=f.reduce((R,k)=>{var C,E;const N=(C=k.position)!=null?C:t;return R[N]=[...(E=R[N])!=null?E:[],k],R},{}),T=Object.keys(j).map(R=>{const k=j[R];return s.jsx(Ve.TransitionGroup,{className:y("smwb-snackbars",`smwb-${R}`),"data-testid":`snackbars-${R}`,appear:!0,children:k.map(N=>s.jsx(wr,{snack:N,position:t,variant:n,className:a,component:d,autoClose:r,autoCloseTime:c,snackRest:m,onSnackRemove:x,onClose:S},N.id))},R)});return s.jsxs(Sn.Provider,{value:{addSnackbar:w,clearAllSnackbars:p,clearFirstSnackbar:_,clearLastSnackbar:v,clearByIdSnackbar:g},children:[u,h&&Re.createPortal(T,h)]})}const _r=i.forwardRef(function({className:t,message:n,variant:a="dark",position:r="top-right",onClick:c,component:l="div",isAutoClose:o,autoCloseTime:d,onClose:u,action:m,...f},b){const h=i.useRef(),w=Me(()=>{!u||!o||!d||(h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{u()},d))});i.useEffect(()=>(w(),()=>{h.current&&clearTimeout(h.current)}),[w]);const p=l;return s.jsxs(p,{ref:b,className:y("smwb-snackbar",t,`smwb-${a}`,`smwb-${r}`),onClick:c,role:"alert","aria-live":a==="danger"?"assertive":"polite","aria-atomic":"true",...f,children:[s.jsx("div",{className:"smwb-snackbar__body",children:n}),m!=null?s.jsx("div",{className:"smwb-snackbar__action",children:m}):null]})});function gr(){return i.useContext(Sn)}const xr=i.forwardRef(function({className:t,children:n,placement:a="top",offset:r={offsetX:0,offsetY:0},message:c,open:l,trigger:o="hover",openDelay:d=0,closeDelay:u=0},m){var E,D;const f=Ze(a),[b,h]=i.useState(!1),[w,p]=i.useState(!1),_=i.useRef(null),v=i.useRef(null),g=i.useCallback(()=>{_.current!==null&&(clearTimeout(_.current),_.current=null),v.current!==null&&(clearTimeout(v.current),v.current=null)},[]);i.useEffect(()=>()=>g(),[g]);const x=i.useCallback(()=>{if(g(),d<=0){h(!0);return}_.current=setTimeout(()=>h(!0),d)},[g,d]),S=i.useCallback(()=>{if(g(),u<=0){h(!1);return}v.current=setTimeout(()=>h(!1),u)},[g,u]),{refs:j,floatingStyles:T}=fe.useFloating({placement:f.placement,whileElementsMounted:fe.autoUpdate,middleware:[fe.offset({mainAxis:(E=r==null?void 0:r.offsetY)!=null?E:0,crossAxis:(D=r==null?void 0:r.offsetX)!=null?D:0}),...f.autoMiddleware?[f.autoMiddleware]:[]]}),R=o==="manual"?l===!0:o==="click"?w:b,k=o==="hover"?x:void 0,N=o==="hover"?S:void 0,C=o==="click"?()=>{p(A=>!A)}:void 0;return s.jsxs("div",{className:"smwb-tooltip__wrapper",role:"tooltip",ref:m,children:[s.jsx("div",{className:"smwb-tooltip__ref",ref:j.setReference,onPointerEnter:k,onPointerLeave:N,onClick:C,children:n}),R&&s.jsx("div",{ref:j.setFloating,className:y("smwb-tooltip",t),style:T,children:c})]})}),vr=i.forwardRef(function(t,n){const{className:a,children:r,variant:c="contained",size:l="medium",orientation:o="horizontal",colorTheme:d="primary",color:u,fullWidth:m=!1,disabled:f=!1,...b}=t;return s.jsx("div",{ref:n,className:y("smwb-button-group",a,`smwb-${o}`,`smwb-${c}`,m&&"smwb-full-width",f),role:"group","data-testid":"button-group",...b,children:i.Children.map(r,h=>{var p,_,v,g,x,S;const w=h;return i.cloneElement(w,{className:"smwb-button-group__grouped",fullWidth:o==="vertical"||((p=w.props.fullWidth)!=null?p:m),variant:(_=w.props.variant)!=null?_:c,size:(v=w.props.size)!=null?v:l,disabled:(g=w.props.disabled)!=null?g:f,colorTheme:(x=w.props.colorTheme)!=null?x:d,color:(S=w.props.color)!=null?S:u})})})}),yr=i.forwardRef(function(t,n){const{label:a,disabled:r,readOnly:c,required:l,name:o,id:d,indeterminate:u,className:m,size:f="medium",color:b="primary",onChange:h,helperText:w,error:p,..._}=t,v=dt(d),g=x=>{if(c){x.preventDefault();return}h==null||h(x,x.target.checked,t)};return s.jsx(Le,{helperText:w,disabled:r,error:p,className:"smwb-text-field-checkbox",children:s.jsxs("label",{htmlFor:v,className:y("smwb-checkbox__wrapper",`smwb-checkbox_size-${f}`,`smwb-checkbox_color-${b}`,m,{"smwb-disabled":r,"smwb-readonly":c,"smwb-indeterminate":u}),children:[s.jsx("input",{type:"checkbox",id:v,name:o,className:"smwb-checkbox__input",disabled:r,readOnly:c,required:l,"aria-invalid":p||void 0,"aria-required":l||void 0,ref:n,..._,onChange:g}),s.jsx("span",{className:y("smwb-checkbox__btn",{"smwb-indeterminate":u}),children:u?s.jsx(W,{name:"remove",size:18,className:"smwb-checkbox__icon",weight:700}):s.jsx(W,{name:"check",size:17,className:"smwb-checkbox__icon",weight:700})}),a&&s.jsx("span",{className:"smwb-checkbox__label",children:a})]})})});function ze({className:e,children:t,onMouseDown:n,disabled:a,size:r="medium",edge:c,...l}){const o=i.useRef(null),d=f=>{n==null||n(f)},u=f=>{var b;a||(b=o.current)==null||b.onRipple(f)},m=y("smwb-date-picker__icon-button",e,{"smwb-date-picker__icon-button--small":r==="small","smwb-date-picker__icon-button--edge-start":c==="start","smwb-date-picker__icon-button--edge-end":c==="end","smwb-date-picker__icon-button--disabled":a});return s.jsxs("button",{onMouseDown:d,onPointerDown:u,type:"button",className:m,disabled:a,...l,children:[t,!a&&s.jsx(De,{actionRef:o,center:!0})]})}function zt({label:e,onLeftIconClick:t,onRightIconClick:n,onLabelClick:a,disabled:r,active:c,hiddenSwitches:l,dataToggleId:o,...d}){const u=y("smwb-date-picker__switch",{"smwb-date-picker__switch--hidden":l});return s.jsxs("div",{className:"smwb-date-picker__action",...d,children:[s.jsx("div",{className:u,children:s.jsx(ze,{size:"small",onClick:r?void 0:t,children:s.jsx(W,{name:"keyboard_arrow_left",weight:500,size:24})})}),s.jsxs("div",{className:y("smwb-date-picker__action-label",{"smwb-date-picker__action-label--disabled":r,"smwb-date-picker__action-label--active":c}),"data-testid":o,onClick:r?void 0:a,children:[s.jsx("span",{className:"smwb-date-picker__action-text",children:e}),s.jsx(W,{name:"arrow_drop_down",weight:500,size:20})]}),s.jsx("div",{className:u,children:s.jsx(ze,{size:"small",onClick:r?void 0:n,children:s.jsx(W,{name:"keyboard_arrow_right",weight:500,size:24})})})]})}const Xe=/yyyy|MM|dd/g;function jr(e){const t=[];let n;for(Xe.lastIndex=0;(n=Xe.exec(e))!==null;)t.push(n[0]);return t}function js(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kr(e){let t="^",n=0,a;for(Xe.lastIndex=0;(a=Xe.exec(e))!==null;)t+=js(e.slice(n,a.index)),t+=a[0]==="yyyy"?"(\\d{4})":"(\\d{2})",n=Xe.lastIndex;return t+=js(e.slice(n)),t+="$",new RegExp(t)}function Nr(e,t,n){if(t<1||t>12||n<1)return!1;const a=new Date(e,t-1,n);return a.getFullYear()===e&&a.getMonth()===t-1&&a.getDate()===n}function Rr(e,t){const n=e.getFullYear(),a=e.getMonth()+1,r=e.getDate();return t.replace(Xe,c=>c==="yyyy"?String(n).padStart(4,"0"):c==="MM"?String(a).padStart(2,"0"):String(r).padStart(2,"0"))}function Mn(e,t){const n=jr(t);if(n.length!==3||!n.includes("yyyy")||!n.includes("MM")||!n.includes("dd"))return;const a=kr(t).exec(e);if(!a)return;let r,c,l;if(n.forEach((o,d)=>{const u=Number(a[d+1]);if(o==="yyyy"){r=u;return}if(o==="MM"){c=u;return}l=u}),!(r===void 0||c===void 0||l===void 0)&&Nr(r,c,l))return new Date(r,c-1,l)}function Tr(e,t){return Mn(e,t)!==void 0}function es(e,t=0){t=t%7;const n=new Date(e),a=n.getDay(),r=(a<t?7:0)+a-t;return new Date(n.setDate(n.getDate()-r))}function Dn(e,t=0){const n=new Date(es(e,t));return new Date(n.setDate(n.getDate()+6))}function Cr(e,t){const n=[],a=new Date(e),c=new Date(t).getTime(),l=a;for(l.setHours(0,0,0,0);l.getTime()<=c;)n.push(new Date(l.getTime())),l.setDate(l.getDate()+1),l.setHours(0,0,0,0);return n}const Sr=(e,t,n)=>{const a=new Intl.DateTimeFormat(n,{weekday:"narrow"});return Cr(es(e,t),Dn(e,t)).map(r=>a.format(r))};function En(e){const t=new Date(e);return new Date(t.getFullYear(),t.getMonth(),1)}function An(e){return In(new Date(e.getFullYear(),e.getMonth()+1,0))}function lt(e,t){return new Date(e)<new Date(t)}function Dt(e,t){return lt(t,e)}function Mr(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}const Dr=(e,t)=>{const n=es(En(e),t),a=Dn(An(e),t);let r=0,c=n;const l=[];let o=null;for(;lt(c,a);){const d=Math.floor(r/7);l[d]=l[d]||[];const u=c.getDay();o!==u&&(o=u,l[d].push(c),r+=1),c=Mr(c,1)}return l};function Er(e,t){return En(t)<=e&&e<=An(t)}function Vt(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function In(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59,999)}function pt(e,t){return Vt(e).getTime()===Vt(t).getTime()}function $n(e,t){return ts(e,e.getMonth()+t)}function Ar(e,t){return ss(e,e.getFullYear()+t)}function nt(e){return In(e)}function at(e){return Vt(e)}function Fn(e){const t=[],n=new Intl.DateTimeFormat(e,{month:"long"});for(let a=0;a<12;a++)t.push({label:n.format($n(new Date("1970-01-01"),a)),value:a});return t}function ts(e,t){const n=new Date(e);return n.setMonth(t),n}function Ln(e,t){const n=[];for(let a=e-t;a<=e+t;a++)n.push({label:String(a).padStart(4,"0"),value:a});return n}function ss(e,t){const n=new Date(e);return n.setFullYear(t),n}function Ir(e,t){return new Intl.DateTimeFormat(t,{month:"short"}).format(e)}function $r(e,t){return new Intl.DateTimeFormat(t,{year:"numeric"}).format(e)}function ot(e,t){return Ne(e)?t?Rr(e,t):new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit",year:"numeric"}).format(e):""}function ns(e){if(e)return e;const t={year:"yyyy",month:"MM",day:"dd"};return new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit",year:"numeric"}).formatToParts(new Date("1970-01-01")).map(r=>t[r.type]||r.value).join("")}const Ht=/\d/gi,Fr=/[a-zA-Z]/g;function Lr(e){return e?e.replace(Fr,"_"):new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit",year:"numeric"}).format(new Date("1970-01-01")).replace(Ht,"_")}function On(e){return t=>{let n=0;return t.split("").map((a,r)=>{if(Ht.lastIndex=0,n>e.length-1)return"";const c=e[n],l=e[n+1],o=Ht.test(a)?a:"",d=c==="_"?o:c+o;return n+=d.length,r===t.length-1&&l&&l!=="_"?d?d+l:"":d}).join("")}}function ks(e,t){return Tr(e,t)}function Ns(e,t){const n=Mn(e,t);return n||new Date(Number.NaN)}function Ne(e){return Object.prototype.toString.call(e)==="[object Date]"&&!isNaN(e)}function as({viewValue:e,openView:t,onChange:n,onMonthLabelClick:a,onYearLabelClick:r,locale:c}){const l=i.useCallback(u=>()=>{n==null||n($n(e,u))},[n,e]),o=i.useCallback(u=>()=>{n==null||n(Ar(e,u))},[n,e]),d=t===pe.months||t===pe.years;return s.jsxs("div",{className:"smwb-date-picker__header",children:[s.jsx(zt,{label:Ir(e,c),onLeftIconClick:l(-1),onRightIconClick:l(1),onLabelClick:a,disabled:t===pe.years,active:t===pe.months,hiddenSwitches:d,dataToggleId:"date-picker-months-toggle"}),s.jsx(zt,{label:$r(e,c),onLeftIconClick:o(-1),onRightIconClick:o(1),onLabelClick:r,disabled:t===pe.months,active:t===pe.years,hiddenSwitches:d,dataToggleId:"date-picker-years-toggle"})]})}const Or=i.memo(function({className:t,children:n,onMouseDown:a,onChange:r,active:c,current:l,hidden:o,outside:d,disabled:u,inRange:m,day:f,...b}){const h=i.useRef(null),w=i.useCallback(g=>{a==null||a(g)},[a]),p=i.useCallback(g=>{var x;u||(x=h.current)==null||x.onRipple(g)},[u]),_=i.useCallback(()=>{u||r==null||r(void 0,f)},[r,f,u]);if(o)return s.jsx("span",{className:"smwb-date-picker__day-hidden"});const v=y("smwb-date-picker__day",t,{"smwb-date-picker__day--active":!u&&c,"smwb-date-picker__day--current":l&&!c,"smwb-date-picker__day--outside":!u&&d,"smwb-date-picker__day--disabled":u,"smwb-date-picker__day--in-range":!u&&m});return s.jsxs("button",{className:v,type:"button",onMouseDown:w,onPointerDown:p,onClick:_,disabled:u,...b,children:[n,!u&&s.jsx(De,{actionRef:h,center:!0})]})});function rs({viewValue:e,value:t,showDaysOutsideMonth:n,onChange:a,disablePast:r,disableFuture:c,weekStartsOn:l=0,minDate:o,maxDate:d,isDateDisabled:u,locale:m,range:f,rangeStart:b,rangeEnd:h}){const[w]=i.useState(new Date),p=i.useMemo(()=>Sr(w,l,m),[w,l,m]),_=i.useMemo(()=>Dr(e,l),[e,l]),v=i.useCallback(j=>f?Ne(b)&&pt(j,b)||Ne(h)&&pt(j,h):Ne(t)?pt(j,t):!1,[t,f,b,h]),g=i.useCallback(j=>!f||!Ne(b)||!Ne(h)?!1:Dt(at(j),at(b))&<(nt(j),nt(h)),[f,b,h]),x=i.useCallback(j=>{let T=!1;return r&&(T=lt(nt(j),w)),c&&(T=T||Dt(at(j),w)),o&<(nt(j),at(o))&&(T=!0),d&&Dt(at(j),nt(d))&&(T=!0),u!=null&&u(j)&&(T=!0),T},[r,c,w,o,d,u]),S=i.useMemo(()=>p.map((j,T)=>s.jsx("span",{className:"smwb-date-picker__week-day",children:j.toString()},T)),[p]);return s.jsxs("div",{className:"smwb-date-picker__days",children:[s.jsx("div",{className:"smwb-date-picker__week-days",children:S}),s.jsx("div",{className:"smwb-date-picker__month",children:_.map((j,T)=>s.jsx("div",{className:"smwb-date-picker__week",children:j.map(R=>{const k=!Er(R,e);return s.jsx(Or,{day:R,current:pt(R,w),active:v(R),inRange:g(R),hidden:!n&&k,outside:k,onChange:a,disabled:x(R),children:R.getDate()},R.toISOString())})},T))})]})}const Qe=i.createContext({dense:!1,variant:"floating",onClose:()=>null});function jt(){return i.useContext(Qe)}const qe=i.forwardRef(function(t,n){const{children:a,className:r,disabled:c,selected:l,onClick:o,onMouseDown:d,href:u,linkElement:m,linkProps:f,value:b,optionRenderer:h,...w}=t,{dense:p}=i.useContext(Qe),_=i.useRef(null),v=T=>{if(c){u&&T.preventDefault();return}o==null||o(T)},g=T=>{c||d==null||d(T)},x=T=>{var R;(R=_.current)==null||R.onRipple(T)};let S;if(u){const T=m!=null?m:"a";S=s.jsxs(T,{className:"smwb-menu__item-inner",href:u,...f,children:[a,s.jsx("span",{className:"smwb-menu__item__helper-text"})]})}else S=s.jsx("span",{className:"smwb-menu__item-inner",children:a});const j=y("smwb-menu__item",r,{"smwb-menu__item--dense":p,"smwb-menu__item--disabled":c,"smwb-menu__item--selected":l});return h?h(t):s.jsxs("li",{role:"menuitem",ref:n,className:j,tabIndex:c?void 0:0,onClick:v,"data-value":b,onMouseDown:g,onPointerDown:x,...w,children:[S,s.jsx(De,{actionRef:_})]})}),is=i.forwardRef(function(t,n){const{children:a,className:r,edge:c,...l}=t,{dense:o}=i.useContext(Qe),d=y("smwb-menu__icon",r,{"smwb-menu__icon--dense":o,"smwb-menu__icon--start":c==="start","smwb-menu__icon--end":c==="end"});return s.jsx("span",{ref:n,className:d,...l,children:a})}),ls=i.forwardRef(function(t,n){const{children:a,className:r,inset:c=!1,...l}=t,{dense:o}=i.useContext(Qe),d=y("smwb-menu__text",r,{"smwb-menu__text--inset":c,"smwb-menu__text--dense":o});return s.jsx("span",{ref:n,className:d,...l,children:a})}),Bn=i.forwardRef(function(t,n){const{className:a,...r}=t,{variant:c}=jt();return s.jsx("li",{ref:n,className:y("smwb-menu__divider",a,c==="static"&&"smwb-menu__divider--vertical"),...r})}),Pn=i.forwardRef(function(t,n){const{children:a,className:r,...c}=t,{variant:l,onClose:o}=jt(),d=u=>{var b,h,w,p;const m=Array.from(u.currentTarget.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])'));if(m.length===0)return;const f=m.indexOf(document.activeElement);u.key==="ArrowDown"?(u.preventDefault(),(b=m[(f+1+m.length)%m.length])==null||b.focus()):u.key==="ArrowUp"?(u.preventDefault(),(h=m[(f-1+m.length)%m.length])==null||h.focus()):u.key==="Home"?(u.preventDefault(),(w=m[0])==null||w.focus()):u.key==="End"?(u.preventDefault(),(p=m[m.length-1])==null||p.focus()):u.key==="Escape"&&o()};return s.jsx("div",{ref:n,className:y("smwb-menu",r,`smwb-menu--${l}`),...c,children:s.jsx("ul",{className:y("smwb-menu__list",`smwb-menu__list--${l}`),role:"menu","aria-orientation":"vertical",onKeyDown:d,children:a})})});function Br(e,t){return yt(e,t)}const Pr=e=>({transition:`opacity ${e}ms ease-in-out`,opacity:0}),zr={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0}},zn=i.forwardRef(function(t,n){const{anchorElement:a,isOpen:r,onClose:c,placement:l="bottom-start",middleware:o,style:d,...u}=t,[m,f]=i.useState(null),b=i.useRef(null),h=Ze(l),{refs:w,floatingStyles:p}=fe.useFloating({open:!!r,placement:h.placement,whileElementsMounted:fe.autoUpdate,elements:{reference:a!=null?a:null},middleware:Br(h,o)}),_=ge(n,b,f,w.setFloating),v=g=>{if(!r||!c||!m)return;const x=g.target;m.contains(x)||a!=null&&a.contains(x)||c==null||c()};return s.jsx(vt,{nodeRef:b,in:!!r,timeout:150,unmountOnExit:!0,children:g=>s.jsx(Je,{onClickAway:v,children:s.jsx(Pn,{ref:_,style:{...p,...d,...Pr(150),...zr[g]},...u})})})}),Vr=i.forwardRef(function e(t,n){const{children:a,toggleElement:r,placement:c="right-start",onClose:l,openOnHover:o,...d}=t,[u,m]=i.useState(!1),[f,b]=i.useState(null),h=jt(),w=[fe.offset(({placement:x})=>{switch(x){case"right-start":case"left-start":return{crossAxis:-8,mainAxis:0};case"right-end":case"left-end":return{crossAxis:8,mainAxis:0};default:return{crossAxis:0,mainAxis:0}}})],p=x=>{x.button===0&&m(S=>!S)},_=()=>{m(!1),l==null||l()},v=x=>{x.key==="ArrowRight"||x.key==="Enter"||x.key===" "?(x.preventDefault(),m(!0)):(x.key==="ArrowLeft"||x.key==="Escape")&&m(!1)},g=i.cloneElement(r,{ref:b,onClick:p,onKeyDown:v,onMouseEnter:o?()=>m(!0):void 0,"aria-haspopup":"menu","aria-expanded":u,selected:u});return s.jsxs(Qe.Provider,{value:{...h,variant:"floating"},children:[g,s.jsx(zn,{ref:n,...d,placement:c,isOpen:u,onClose:_,anchorElement:f,middleware:w,children:i.Children.map(a,x=>{if(!i.isValidElement(x))return null;if(x.type===e)return x;const S=x;return i.cloneElement(S,{onClick:j=>{var T,R;(R=(T=S.props).onClick)==null||R.call(T,j),_(),h.onClose()}})})})]})}),Hr=i.forwardRef(function(t,n){const{variant:a}=jt();if(a==="static"){const{anchorElement:r,isOpen:c,onClose:l,placement:o,middleware:d,...u}=t;return s.jsx(Pn,{ref:n,...u})}return s.jsx(zn,{ref:n,...t})}),kt=i.forwardRef(function(t,n){const{dense:a=!1,variant:r="floating",onClose:c,...l}=t,o=()=>{c==null||c()};return s.jsx(Qe.Provider,{value:{dense:a,variant:r,onClose:o},children:s.jsx(Hr,{ref:n,onClose:c,...l})})});function ut({value:e,items:t,onChange:n}){const a=i.useRef(null),r=i.useRef(null);_e(()=>{if(a.current&&r.current){const o=(a.current.offsetHeight-r.current.offsetHeight)/2;a.current.scrollTop=r.current.offsetTop-o}});const c=i.useCallback(o=>()=>{n==null||n(o)},[n]),l=i.useCallback(o=>d=>{e===o&&(r.current=d)},[e]);return s.jsx("div",{className:"smwb-date-picker__overflow",ref:a,"data-testid":"date-picker-list",children:s.jsx("ul",{className:"smwb-date-picker__list",children:t.map(({label:o,value:d})=>{const u=e===d;return s.jsxs(qe,{selected:u,onClick:c(d),ref:l(d),children:[u&&s.jsx(is,{children:s.jsx(W,{name:"check",weight:500,size:24})}),s.jsx(ls,{className:"smwb-date-picker__list-item",inset:!u,children:o})]},d)})})})}const Yr=ns();function Vn({value:e,onChange:t,onBlur:n,format:a}){const r=i.useMemo(()=>a?ns(a):Yr,[a]),[c,l]=i.useState(ot(e,a)),o=i.useMemo(()=>Lr(a),[a]),d=i.useMemo(()=>On(o),[o]),u=i.useRef(void 0);i.useEffect(()=>{const w=e!==u.current;u.current=e,w&&l(ot(e,a))},[e,a]);const m=w=>{l(w),t&&(ks(w,r)?t(void 0,Ns(w,r)):w===""&&t(void 0))},f=i.useCallback(()=>{var w,p,_,v;n&&(ks((p=(w=u.current)==null?void 0:w.toString())!=null?p:"",r)?n(void 0,Ns((v=(_=u.current)==null?void 0:_.toString())!=null?v:"",r)):u.current===""&&n(void 0),l(ot(e,a)))},[n,e,a,r]),b=Xt.useRifm({value:c,onChange:m,format:d}),h=r.toLowerCase();return{...b,onBlur:f,placeholder:h}}function Xr(e){e.stopPropagation()}const Hn=i.forwardRef(function(t,n){const{value:a,onChange:r,onBlur:c,onToggle:l,disabled:o,disableCalendar:d,calendarIcon:u,format:m,...f}=t,b=Vn({value:a,onChange:r,onBlur:c,format:m});return s.jsx(Oe,{ref:n,...b,type:"tel",endAdornment:!d&&s.jsx(ze,{edge:"end",onClick:l,onMouseDown:Xr,disabled:!!o,"data-testid":"date-picker-icon-button",children:u||s.jsx(W,{name:"calendar_today",fill:1,weight:500,size:24})}),disabled:!!o,...f})});var pe=(e=>(e.days="days",e.months="months",e.years="years",e))(pe||{});const Kr=e=>({transition:`opacity ${e}ms ease-in-out`,opacity:0}),Wr={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0}},Ur=i.forwardRef(function(t,n){const{value:a,onChange:r,showDaysOutsideMonth:c,disablePast:l,disableFuture:o,weekStartsOn:d=1,placement:u="bottom-start",disabled:m,disableCalendar:f,calendarAriaLabel:b="Choose date",minDate:h,maxDate:w,isDateDisabled:p,locale:_,format:v,range:g,rangeValue:x,onRangeChange:S,calendarIcon:j,onBlur:T,...R}=t,k=i.useMemo(()=>a===void 0?void 0:new Date(a),[a]),N=x!==void 0,[C,E]=i.useState([void 0,void 0]),D=N&&x?x:C,[A,z]=i.useState(()=>Ne(k)?k:new Date),[$,M]=i.useState("days"),[F,I]=i.useState(!1),K=i.useRef(null),ne=i.useRef(null),G=Ze(u),{refs:ce,floatingStyles:Z}=fe.useFloating({open:F,placement:G.placement,whileElementsMounted:fe.autoUpdate,middleware:yt(G)}),te=ge(K,ce.setReference,n),L=ge(ne,ce.setFloating);_e(()=>{m||z(Ne(k)?k:new Date)},[k,m]);const B=i.useCallback(O=>{z(O)},[]),X=i.useCallback(()=>{M($==="months"?"days":"months")},[$]),ee=i.useCallback(()=>{M($==="years"?"days":"years")},[$]),U=i.useCallback(O=>{z(ts(A,O)),M("days")},[A]),se=i.useCallback(O=>{z(ss(A,O)),M("days")},[A]),de=i.useCallback((O,V)=>{if(g){if(!V)return;const[le,ae]=D;let P;!le||le&&ae?P=[V,void 0]:P=Ne(le)&&V.getTime()<le.getTime()?[V,le]:[le,V],N||E(P),S==null||S(P),P[0]&&P[1]&&I(!1);return}r==null||r(O,V,t),I(!1)},[r,t,g,D,N,S]),ie=i.useCallback(()=>{m||I(O=>!O)},[m]),xe=i.useCallback(O=>{var le,ae;const V=O.target;(le=ne.current)!=null&&le.contains(V)||(ae=K.current)!=null&&ae.contains(V)||I(!1)},[]),Q=i.useMemo(()=>Fn(_),[_]),me=i.useMemo(()=>Ln(new Date().getFullYear(),100),[]);let J=null;switch($){case"days":J=s.jsx(rs,{viewValue:A,value:k,showDaysOutsideMonth:c,onChange:de,disablePast:l,disableFuture:o,weekStartsOn:d,minDate:h,maxDate:w,isDateDisabled:p,locale:_,range:g,rangeStart:D[0],rangeEnd:D[1]});break;case"months":J=s.jsx(ut,{value:A.getMonth(),items:Q,onChange:U});break;case"years":J=s.jsx(ut,{value:A.getFullYear(),items:me,onChange:se});break}const be=g&&(D[0]||D[1])?`${ot(D[0],v)} – ${ot(D[1],v)}`:"";return s.jsxs(s.Fragment,{children:[g?s.jsx(Oe,{ref:te,value:be,readOnly:!0,onChange:()=>{},disabled:!!m,placeholder:v?`${v} – ${v}`:void 0,endAdornment:!f&&s.jsx(ze,{edge:"end",onClick:ie,disabled:!!m,"data-testid":"date-picker-icon-button",children:j||s.jsx(W,{name:"calendar_today",fill:1,weight:500,size:24})}),...R}):s.jsx(Hn,{ref:te,value:k,onChange:r,onBlur:T,onToggle:ie,disabled:m,disableCalendar:f,format:v,calendarIcon:j,...R}),Re.createPortal(s.jsx(vt,{nodeRef:ne,in:F&&!m&&!f,timeout:150,mountOnEnter:!0,unmountOnExit:!0,children:O=>s.jsx(Je,{onClickAway:xe,children:s.jsx("div",{ref:L,className:"smwb-date-picker",style:{...Z,...Kr(150),...Wr[O]},"data-testid":"date-picker","data-smwb-overlay-layer":"",role:"dialog","aria-modal":"false","aria-label":b,children:s.jsxs("div",{className:"smwb-date-picker__inner",children:[s.jsx(as,{viewValue:A,locale:_,openView:$,onChange:B,onMonthLabelClick:X,onYearLabelClick:ee}),s.jsx("div",{className:"smwb-date-picker__body",children:J})]})})})}),document.body)]})}),Ke=/yyyy|MM|dd|HH|mm|ss/g;function Gr(e){const t=[];let n;for(Ke.lastIndex=0;(n=Ke.exec(e))!==null;)t.push(n[0]);return t}function Rs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qr(e){let t="^",n=0,a;for(Ke.lastIndex=0;(a=Ke.exec(e))!==null;)t+=Rs(e.slice(n,a.index)),t+=a[0]==="yyyy"?"(\\d{4})":"(\\d{2})",n=Ke.lastIndex;return t+=Rs(e.slice(n)),t+="$",new RegExp(t)}function Zr(e,t,n){if(t<1||t>12||n<1)return!1;const a=new Date(e,t-1,n);return a.getFullYear()===e&&a.getMonth()===t-1&&a.getDate()===n}function Jr(e,t,n){return e>=0&&e<=23&&t>=0&&t<=59&&n>=0&&n<=59}function Qr(e,t){const n=e.getFullYear(),a=e.getMonth()+1,r=e.getDate(),c=e.getHours(),l=e.getMinutes(),o=e.getSeconds();return t.replace(Ke,d=>d==="yyyy"?String(n).padStart(4,"0"):d==="MM"?String(a).padStart(2,"0"):d==="dd"?String(r).padStart(2,"0"):d==="HH"?String(c).padStart(2,"0"):d==="mm"?String(l).padStart(2,"0"):String(o).padStart(2,"0"))}function Yn(e,t){const n=Gr(t);if(!n.includes("yyyy")||!n.includes("MM")||!n.includes("dd")||!n.includes("HH")||!n.includes("mm"))return;const a=qr(t).exec(e);if(!a)return;let r,c,l,o,d,u=0;if(n.forEach((m,f)=>{const b=Number(a[f+1]);if(m==="yyyy"){r=b;return}if(m==="MM"){c=b;return}if(m==="dd"){l=b;return}if(m==="HH"){o=b;return}if(m==="mm"){d=b;return}u=b}),!(r===void 0||c===void 0||l===void 0||o===void 0||d===void 0)&&!(!Zr(r,c,l)||!Jr(o,d,u)))return new Date(r,c-1,l,o,d,u)}function Et(e,t){return Yn(e,t)!==void 0}const ei=/[a-zA-Z]/g;function it(e,t){return!e||Object.prototype.toString.call(e)!=="[object Date]"||isNaN(e)?"":t?Qr(e,t):new Intl.DateTimeFormat(void 0,{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function xt(e){return e||`${ns()} HH:mm`}function ti(e){return xt(e).replace(ei,"_")}function Ts(e,t){const n=Yn(e,t);return n||new Date(Number.NaN)}function Xn({value:e,onChange:t,onBlur:n,format:a}){const r=i.useMemo(()=>xt(a),[a]),[c,l]=i.useState(it(e,a)),o=i.useMemo(()=>ti(a),[a]),d=i.useMemo(()=>On(o),[o]),u=i.useRef(void 0);i.useEffect(()=>{const h=e!==u.current;u.current=e,h&&l(it(e,a))},[e,a]);const m=h=>{l(h),t&&(Et(h,r)?t(void 0,Ts(h,r)):h===""&&t(void 0))},f=i.useCallback(()=>{if(!n)return;const h=u.current;h instanceof Date&&Et(it(h,a),r)?n(void 0,h):typeof h=="string"&&Et(h,r)?n(void 0,Ts(h,r)):(h===void 0||h==="")&&n(void 0),l(it(e,a))},[n,e,a,r]);return{...Xt.useRifm({value:c,onChange:m,format:d}),onBlur:f,placeholder:xt(a).toLowerCase()}}function si(e){e.stopPropagation()}const Kn=i.forwardRef(function(t,n){const{value:a,onChange:r,onBlur:c,onToggle:l,disabled:o,disableCalendar:d,calendarIcon:u,format:m,...f}=t,b=Xn({value:a,onChange:r,onBlur:c,format:m});return s.jsx(Oe,{ref:n,...b,type:"tel",endAdornment:!d&&s.jsx(ze,{edge:"end",onClick:l,onMouseDown:si,disabled:!!o,"data-testid":"date-time-picker-icon-button",children:u||s.jsx(W,{name:"event",fill:1,weight:500,size:24})}),disabled:!!o,...f})});function At({value:e,items:t,onChange:n}){const a=i.useRef(null),r=i.useRef(null);_e(()=>{if(a.current&&r.current){const o=(a.current.offsetHeight-r.current.offsetHeight)/2;a.current.scrollTop=r.current.offsetTop-o}});const c=i.useCallback(o=>()=>{n==null||n(o)},[n]),l=i.useCallback(o=>d=>{e===o&&(r.current=d)},[e]);return s.jsx("div",{className:"smwb-time-picker__overflow",ref:a,"data-testid":"time-picker-list",children:s.jsx("ul",{className:"smwb-time-picker__list",children:t.map(({label:o,value:d})=>{const u=e===d;return s.jsx("li",{ref:l(d),className:y("smwb-time-picker__item",{"smwb-time-picker__item--selected":u}),onClick:c(d),children:o},d)})})})}const We=/HH|mm|ss/g;function Wn(e){const t=[];let n;for(We.lastIndex=0;(n=We.exec(e))!==null;)t.push(n[0]);return t}function Cs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ni(e){let t="^",n=0,a;for(We.lastIndex=0;(a=We.exec(e))!==null;)t+=Cs(e.slice(n,a.index)),t+="(\\d{2})",n=We.lastIndex;return t+=Cs(e.slice(n)),t+="$",new RegExp(t)}function ai(e,t,n){return e>=0&&e<=23&&t>=0&&t<=59&&n>=0&&n<=59}function ri(e){return Wn(e).includes("ss")}function ii(e,t){const n=e.getHours(),a=e.getMinutes(),r=e.getSeconds();return t.replace(We,c=>c==="HH"?String(n).padStart(2,"0"):c==="mm"?String(a).padStart(2,"0"):String(r).padStart(2,"0"))}function Un(e,t){const n=Wn(t);if(!n.includes("HH")||!n.includes("mm"))return;const a=ni(t).exec(e);if(!a)return;let r,c,l=0;if(n.forEach((d,u)=>{const m=Number(a[u+1]);if(d==="HH"){r=m;return}if(d==="mm"){c=m;return}l=m}),r===void 0||c===void 0||!ai(r,c,l))return;const o=new Date;return new Date(o.getFullYear(),o.getMonth(),o.getDate(),r,c,l)}function li(e,t){return Un(e,t)!==void 0}const Ss=/\d/gi,oi=/[a-zA-Z]/g,mt="HH:mm";function ci(){return Array.from({length:24},(e,t)=>({value:t,label:String(t).padStart(2,"0")}))}function ui(){return Array.from({length:60},(e,t)=>({value:t,label:String(t).padStart(2,"0")}))}function di(){return Array.from({length:60},(e,t)=>({value:t,label:String(t).padStart(2,"0")}))}function It(e,t,n,a){const r=new Date(e);return r.setHours(t,n,a,0),r}function _t(e,t){return Pe(e)?ii(e,t!=null?t:mt):""}function os(e){return e!=null?e:mt}function mi(e){return os(e).replace(oi,"_")}function fi(e){return t=>{let n=0;return t.split("").map((a,r)=>{if(Ss.lastIndex=0,n>e.length-1)return"";const c=e[n],l=e[n+1],o=Ss.test(a)?a:"",d=c==="_"?o:c+o;return n+=d.length,r===t.length-1&&l&&l!=="_"?d?d+l:"":d}).join("")}}function $t(e,t){return li(e,t)}function Ms(e,t){const n=Un(e,t);return n||new Date(Number.NaN)}function Pe(e){return Object.prototype.toString.call(e)==="[object Date]"&&!isNaN(e)}function hi(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),0)}function bi(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),0)}function cs({value:e,format:t,onChange:n,onComplete:a}){const r=i.useMemo(()=>Pe(e)?e:new Date,[e]),c=t!=null?t:mt,l=ri(c),o=i.useMemo(()=>ci(),[]),d=i.useMemo(()=>ui(),[]),u=i.useMemo(()=>di(),[]),m=i.useCallback(h=>{n(It(r,h,r.getMinutes(),r.getSeconds()))},[r,n]),f=i.useCallback(h=>{n(It(r,r.getHours(),h,r.getSeconds())),l||a==null||a()},[r,n,a,l]),b=i.useCallback(h=>{n(It(r,r.getHours(),r.getMinutes(),h)),a==null||a()},[r,n,a]);return s.jsxs("div",{className:"smwb-time-picker__columns","data-testid":"time-picker-columns",children:[s.jsx("div",{className:"smwb-time-picker__column",children:s.jsx(At,{value:r.getHours(),items:o,onChange:m})}),s.jsx("div",{className:"smwb-time-picker__column",children:s.jsx(At,{value:r.getMinutes(),items:d,onChange:f})}),l&&s.jsx("div",{className:"smwb-time-picker__column",children:s.jsx(At,{value:r.getSeconds(),items:u,onChange:b})})]})}const wi=e=>({transition:`opacity ${e}ms ease-in-out`,opacity:0}),pi={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0}},_i=i.forwardRef(function(t,n){const{value:a,onChange:r,showDaysOutsideMonth:c,disablePast:l,disableFuture:o,weekStartsOn:d=1,placement:u="bottom-start",disabled:m,disableCalendar:f,calendarAriaLabel:b="Choose date and time",minDate:h,maxDate:w,isDateDisabled:p,locale:_,format:v,timeFormat:g,calendarIcon:x,onBlur:S,...j}=t,T=i.useMemo(()=>a===void 0?void 0:new Date(a),[a]),[R,k]=i.useState(()=>Ne(T)||Pe(T)?T:new Date),[N,C]=i.useState(pe.days),[E,D]=i.useState(!1),A=i.useRef(null),z=i.useRef(null),$=Ze(u),{refs:M,floatingStyles:F}=fe.useFloating({open:E,placement:$.placement,whileElementsMounted:fe.autoUpdate,middleware:yt($)}),I=ge(A,M.setReference,n),K=ge(z,M.setFloating);_e(()=>{m||k(Ne(T)||Pe(T)?T:new Date)},[T,m]);const ne=i.useCallback(Q=>{k(Q)},[]),G=i.useCallback(()=>{C(N===pe.months?pe.days:pe.months)},[N]),ce=i.useCallback(()=>{C(N===pe.years?pe.days:pe.years)},[N]),Z=i.useCallback(Q=>{k(ts(R,Q)),C(pe.days)},[R]),te=i.useCallback(Q=>{k(ss(R,Q)),C(pe.days)},[R]),L=i.useCallback(Q=>{k(Q),r==null||r(void 0,Q,t)},[r,t]),B=i.useCallback((Q,me)=>{if(!me)return;const J=Pe(T)?T:R;L(bi(me,J))},[L,T,R]),X=i.useCallback(Q=>{const me=Ne(T)?T:R;L(hi(me,Q))},[L,T,R]),ee=i.useCallback(()=>{m||D(Q=>!Q)},[m]),U=i.useCallback(Q=>{var J,be;const me=Q.target;(J=z.current)!=null&&J.contains(me)||(be=A.current)!=null&&be.contains(me)||D(!1)},[]),se=i.useMemo(()=>g||(v!=null&&v.includes("HH:mm:ss")?"HH:mm:ss":mt),[v,g]),de=i.useMemo(()=>Fn(_),[_]),ie=i.useMemo(()=>Ln(new Date().getFullYear(),100),[]);let xe=null;switch(N){case pe.days:xe=s.jsx(rs,{viewValue:R,value:T,showDaysOutsideMonth:c,onChange:B,disablePast:l,disableFuture:o,weekStartsOn:d,minDate:h,maxDate:w,isDateDisabled:p,locale:_});break;case pe.months:xe=s.jsx(ut,{value:R.getMonth(),items:de,onChange:Z});break;case pe.years:xe=s.jsx(ut,{value:R.getFullYear(),items:ie,onChange:te});break}return s.jsxs(s.Fragment,{children:[s.jsx(Kn,{ref:I,value:T,onChange:r,onBlur:S,onToggle:ee,disabled:m,disableCalendar:f,format:v,calendarIcon:x,...j}),Re.createPortal(s.jsx(vt,{nodeRef:z,in:E&&!m&&!f,timeout:150,mountOnEnter:!0,unmountOnExit:!0,children:Q=>s.jsx(Je,{onClickAway:U,children:s.jsx("div",{ref:K,className:"smwb-date-picker smwb-date-time-picker",style:{...F,...wi(150),...pi[Q]},"data-testid":"date-time-picker","data-smwb-overlay-layer":"",role:"dialog","aria-modal":"false","aria-label":b,children:s.jsxs("div",{className:"smwb-date-picker__inner smwb-date-time-picker__inner",children:[s.jsx(as,{viewValue:R,locale:_,openView:N,onChange:ne,onMonthLabelClick:G,onYearLabelClick:ce}),s.jsxs("div",{className:"smwb-date-time-picker__content",children:[s.jsx("div",{className:"smwb-date-picker__body smwb-date-time-picker__body",children:xe}),s.jsx(cs,{value:R,format:se,onChange:X})]})]})})})}),document.body)]})}),gi=os();function Gn({value:e,onChange:t,onBlur:n,format:a}){const r=i.useMemo(()=>os(a),[a]),[c,l]=i.useState(_t(e,a)),o=i.useMemo(()=>mi(a),[a]),d=i.useMemo(()=>fi(o),[o]),u=i.useRef(void 0);i.useEffect(()=>{const h=e!==u.current;u.current=e,h&&l(_t(e,a))},[e,a]);const m=h=>{l(h),t&&($t(h,r)?t(void 0,Ms(h,r)):h===""&&t(void 0))},f=i.useCallback(()=>{if(!n)return;const h=u.current;h instanceof Date&&$t(_t(h,a),r)?n(void 0,h):typeof h=="string"&&$t(h,r)?n(void 0,Ms(h,r)):(h===void 0||h==="")&&n(void 0),l(_t(e,a))},[n,e,a,r]);return{...Xt.useRifm({value:c,onChange:m,format:d}),onBlur:f,placeholder:(a!=null?a:gi).toLowerCase()}}function xi(e){e.stopPropagation()}const qn=i.forwardRef(function(t,n){const{value:a,onChange:r,onBlur:c,onToggle:l,disabled:o,disableClock:d,clockIcon:u,format:m,...f}=t,b=Gn({value:a,onChange:r,onBlur:c,format:m});return s.jsx(Oe,{ref:n,...b,type:"tel",endAdornment:!d&&s.jsx(ze,{edge:"end",onClick:l,onMouseDown:xi,disabled:!!o,"data-testid":"time-picker-icon-button",children:u||s.jsx(W,{name:"schedule",fill:1,weight:500,size:24})}),disabled:!!o,...f})}),vi=e=>({transition:`opacity ${e}ms ease-in-out`,opacity:0}),yi={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0}},ji=i.forwardRef(function(t,n){const{value:a,onChange:r,placement:c="bottom-start",disabled:l,disableClock:o,clockAriaLabel:d="Choose time",format:u,onBlur:m,...f}=t,b=i.useMemo(()=>a===void 0?void 0:new Date(a),[a]),[h,w]=i.useState(()=>Pe(b)?b:new Date),[p,_]=i.useState(!1),v=i.useRef(null),g=i.useRef(null),x=Ze(c),{refs:S,floatingStyles:j}=fe.useFloating({open:p,placement:x.placement,whileElementsMounted:fe.autoUpdate,middleware:yt(x)}),T=ge(v,S.setReference,n),R=ge(g,S.setFloating);_e(()=>{l||w(Pe(b)?b:new Date)},[b,l]);const k=i.useCallback(()=>{l||_(D=>!D)},[l]),N=i.useCallback(D=>{var z,$;const A=D.target;(z=g.current)!=null&&z.contains(A)||($=v.current)!=null&&$.contains(A)||_(!1)},[]),C=i.useCallback(D=>{w(D),r==null||r(void 0,D,t)},[r,t]),E=i.useCallback(()=>{_(!1)},[]);return s.jsxs(s.Fragment,{children:[s.jsx(qn,{ref:T,value:b,onChange:r,onBlur:m,onToggle:k,disabled:l,disableClock:o,format:u,...f}),Re.createPortal(s.jsx(vt,{nodeRef:g,in:p&&!l&&!o,timeout:150,mountOnEnter:!0,unmountOnExit:!0,children:D=>s.jsx(Je,{onClickAway:N,children:s.jsx("div",{ref:R,className:"smwb-date-picker smwb-time-picker",style:{...j,...vi(150),...yi[D]},"data-testid":"time-picker","data-smwb-overlay-layer":"",role:"dialog","aria-modal":"false","aria-label":d,children:s.jsx("div",{className:"smwb-date-picker__inner",children:s.jsx(cs,{value:h,format:u,onChange:C,onComplete:E})})})})}),document.body)]})}),ki=i.forwardRef(function(t,n){const{label:a,disabled:r,readOnly:c,required:l,name:o,id:d,size:u="medium",color:m="primary",helperText:f,error:b,onChange:h,className:w,...p}=t,_=dt(d),v=g=>{if(c){g.preventDefault();return}h==null||h(g,t.value!==void 0?t.value:g.target.checked,t)};return s.jsx(Le,{helperText:f,disabled:r,error:b,className:"smwb-text-field-checkbox",children:s.jsxs("label",{htmlFor:_,className:y("smwb-radio",`smwb-radio_size-${u}`,`smwb-radio_color-${m}`,{"smwb-disabled":r,"smwb-readonly":c}),children:[s.jsxs("span",{className:"smwb-radio__wrapper",children:[s.jsx("input",{id:_,name:o,disabled:r,readOnly:c,required:l,"aria-invalid":b||void 0,"aria-required":l||void 0,className:y("smwb-radio__input",w),type:"radio","data-testid":"radio",ref:n,...p,onChange:v}),s.jsx("span",{className:y("smwb-radio__btn",{"smwb-disabled":r})}),s.jsx("span",{className:y("smwb-radio__bg",{"smwb-disabled":r})})]}),a&&s.jsx("span",{className:"smwb-radio__label",children:a})]})})}),Ni=i.forwardRef(function({className:t,value:n,defaultValue:a=0,max:r=5,precision:c=1,readOnly:l=!1,disabled:o=!1,size:d=28,icon:u,emptyIcon:m,name:f,color:b="primary",error:h,helperText:w,id:p,onChange:_},v){const g=n!==void 0,[x,S]=i.useState(a),[j,T]=i.useState(null),R=n!==void 0?n:x,k=j!=null?j:R,N=!l&&!o,C=(M,F)=>{if(c===1)return F+1;const{left:I,width:K}=M.currentTarget.getBoundingClientRect(),ne=M.clientX-I<K/2;return F+(ne?.5:1)},E=(M,F)=>{if(!N)return;const I=C(M,F);g||S(I),_==null||_(I)},D=u!=null?u:s.jsx(W,{name:"star",fill:1,size:d}),A=m!=null?m:s.jsx(W,{name:"star",size:d}),z=M=>{const F=Math.max(0,Math.min(r,M));g||S(F),_==null||_(F)},$=M=>{N&&(M.key==="ArrowRight"||M.key==="ArrowUp"?(M.preventDefault(),z(R+c)):M.key==="ArrowLeft"||M.key==="ArrowDown"?(M.preventDefault(),z(R-c)):M.key==="Home"?(M.preventDefault(),z(0)):M.key==="End"&&(M.preventDefault(),z(r)))};return s.jsxs("span",{ref:v,id:p,className:y("smwb-rating",{"smwb-rating_readonly":l,"smwb-rating_disabled":o,"smwb-rating_error":h},b!=="primary"&&`smwb-rating_color-${b}`,t),"data-testid":"rating",role:"img","aria-label":`${R} of ${r}`,tabIndex:N?0:void 0,onKeyDown:N?$:void 0,children:[Array.from({length:r},(M,F)=>{const I=Math.max(0,Math.min(1,k-F));return s.jsxs("span",{className:"smwb-rating__item",style:{width:d,height:d,cursor:N?"pointer":"default"},onClick:K=>E(K,F),onMouseMove:N&&c===.5?K=>T(C(K,F)):N?()=>T(F+1):void 0,onMouseLeave:N?()=>T(null):void 0,children:[s.jsx("span",{className:"smwb-rating__icon smwb-rating__icon_empty",children:A}),s.jsx("span",{className:"smwb-rating__icon smwb-rating__icon_filled",style:{width:`${I*100}%`},children:D})]},F)}),f?s.jsx("input",{type:"hidden",name:f,value:R,readOnly:!0}):null,w!=null&&w!==!1?s.jsx("span",{className:y("smwb-rating__helper",h&&"smwb-rating__helper_error"),children:w}):null]})});function Ri({menuMaxHeight:e,menuMiddleware:t,search:n,onSearchInputChange:a,items:r,searchValue:c,isOpen:l,onClose:o,anchorElementRef:d,value:u,onItemClick:m,isLoading:f,optionRenderer:b,menuNoItemsMessage:h,container:w=document.body,createOption:p,virtualized:_,itemHeight:v=40}){const g=Array.isArray(u)?u:[u],x=r.some($=>!!$.group);let S;const j=!!_&&!x&&!f&&r.length>0,T=e||240,{startIndex:R,endIndex:k,totalHeight:N,offsetY:C,onScroll:E}=Kt({itemCount:j?r.length:0,itemHeight:v,viewportHeight:T}),D=$=>{var F;const M=[];return x&&$.group!==S&&(S=$.group,M.push(s.jsx("li",{className:"smwb-select-field__group-label",role:"presentation",children:$.group},`group-${(F=$.group)!=null?F:"ungrouped"}`))),M.push(s.jsxs(qe,{value:$.value,disabled:$.disabled,selected:!!g.find(I=>I===$.value),onClick:I=>{$.disabled||m(I,$)},optionRenderer:b,children:[$.text,$.helperText?s.jsx("span",{className:"smwb-select-field__option__helper-text",children:$.helperText}):null]},$.key||$.value)),M},[A,z]=i.useState();return i.useEffect(()=>{l&&d.current&&z(d.current.clientWidth)},[d,l]),i.useEffect(()=>{const $=M=>{l&&M.key==="Escape"&&o()};return document.addEventListener("keydown",$),()=>{document.removeEventListener("keydown",$)}},[l,o]),Re.createPortal(s.jsxs(kt,{isOpen:l,onClose:o,anchorElement:d.current,middleware:t,"data-smwb-overlay-layer":"",style:{minWidth:A,maxHeight:e||void 0,overflowY:e?"auto":void 0},children:[n&&s.jsxs(s.Fragment,{children:[s.jsx("li",{className:"smwb-select-field__menu-search",children:s.jsx(Oe,{className:"smwb-select-field__menu-search-input",type:"text",placeholder:"Найти...",value:c,onChange:($,M)=>a==null?void 0:a($,M.value),fullWidth:!0})}),s.jsx(Bn,{})]}),f?s.jsx("div",{className:"smwb-select-field__menu-loading",children:s.jsx(Tn,{type:"indeterminate",variant:"circular",className:"smwb-select-field__menu__loader"})}):j?s.jsx("li",{role:"presentation",className:"smwb-select-field__virtual-viewport",children:s.jsx("div",{className:"smwb-select-field__virtual-scroller",style:{maxHeight:T,overflowY:"auto"},onScroll:E,children:s.jsx("div",{style:{height:N,position:"relative"},children:s.jsx("ul",{role:"presentation",className:"smwb-select-field__virtual-list",style:{transform:`translateY(${C}px)`,listStyle:"none",margin:0,padding:0},children:r.slice(R,k).map($=>D($))})})})}):r.length?r.map($=>D($)):p?null:s.jsx("li",{className:"smwb-select-field__empty-items",children:h||"Опций не найдено."}),p?s.jsx(qe,{value:"__create__",onClick:$=>p.onCreate($),className:"smwb-select-field__create-option",children:p.text},"__create__"):null]}),w)}const Ti=e=>s.jsx(W,{name:"arrow_drop_down",...e}),Ci=e=>s.jsx(W,{name:"close",size:20,...e});function Ds(e){e.preventDefault(),e.stopPropagation()}const Si=i.forwardRef(function(t,n){const{className:a,value:r,defaultValue:c,onChange:l,disabled:o,readOnly:d,name:u,multiple:m,menuMaxHeight:f,menuMiddleware:b,menuNoItemsMessage:h,menuContainer:w,search:p,chips:_,isFocused:v,error:g,items:x,label:S,variant:j="outlined",fullWidth:T,helperText:R,onSearch:k,resetSearch:N,isLoading:C,inline:E,endAdornment:D,hideSelectArrowIcon:A,optionRenderer:z,clearable:$,creatable:M,onCreate:F,virtualized:I,itemHeight:K,"aria-label":ne,id:G,...ce}=t,[Z,te]=i.useState(!1),[L,B]=i.useState(c),[X,ee]=i.useState(()=>{const Y=r!=null?r:c;if(Array.isArray(Y))return x.filter(ye=>Y.includes(ye.value));const ue=Y==null?void 0:x.find(ye=>ye.value===Y);return ue?[ue]:[]}),[U,se]=i.useState(""),{current:de}=i.useRef(r!=null),ie=i.useRef(null),xe=ge(n,ie),Q=i.useRef(null),me=i.useRef(null),J=de?r:L,be=i.useMemo(()=>v||Z,[v,Z]),O=Y=>{var ue;Y.button===0&&(Y.preventDefault(),(ue=ie.current)==null||ue.focus(),te(!Z))},V=()=>{var Y;te(!1),(Y=ie.current)==null||Y.focus()},le=()=>{var Y;p===!0&&((Y=me.current)==null||Y.focus())},ae=Y=>{d||[" ","ArrowUp","ArrowDown","Enter"].includes(Y.key)&&(Y.preventDefault(),te(!Z))};i.useEffect(()=>{(!be||p==="menu"&&!Z)&&(se(""),N==null||N())},[be,p,Z,N]),i.useEffect(()=>{if(Array.isArray(J))ee(x.filter(Y=>J.includes(Y.value)));else if(J==null||J==="")ee([]);else{const Y=x.find(ue=>ue.value===J);ee(Y?[Y]:[])}},[J,x]),_e(()=>{Q.current&&(Q.current.scrollLeft=Q.current.scrollWidth)},[J]);const P=(Y,ue)=>{l==null||l(Y,{...t,value:ue,name:u||void 0}),B(ue)},re=(Y,ue)=>{var Fe;let ye,Ee;if(m){const ft=Array.isArray(J)?J:[J].filter(Boolean);ye=ft.slice(),Ee=X.slice();const et=ft.findIndex(Nt=>Nt===ue.value);et===-1?(ye.push(ue.value),Ee.push(ue)):(ye.splice(et,1),Ee.splice(et,1))}else ye=J===ue.value?"":ue.value,Ee=[ue];U&&se(""),m||(te(!1),(Fe=ie.current)==null||Fe.focus()),ee(Ee),P(Y,ye)},oe=Y=>{se(Y.target.value),k==null||k(Y),Z||te(!0)},je=Y=>ue=>{if(Array.isArray(J)){const ye=J.filter(Fe=>Y!==Fe);P(ue,ye);const Ee=X.filter(Fe=>Fe.value!==Y);ee(Ee)}},ke=Y=>{P(Y,[]),ee([])};let Te;const Ce=y("smwb-select-field",a,{"smwb-select-field--filled":j==="filled"&&S,"smwb-select-field--disabled":o,"smwb-select-field--search":p,"smwb-select-field--inline":E});return _?Te=X.map(({key:Y,value:ue,text:ye})=>s.jsx(Jt,{label:ye,onDelete:je(ue),onDeleteMouseDown:Ds},Y||ue)):Te=X.map(Y=>Y.text).join(", "),s.jsxs(s.Fragment,{children:[s.jsx(Le,{label:S,helperText:R,variant:j,disabled:o,className:a,error:g,fullWidth:T,isFilledState:!!X.length||!!U,isFocused:be,inline:E,...ce,children:s.jsxs("span",{ref:xe,id:G,className:Ce,tabIndex:o?void 0:0,role:"button","aria-haspopup":"listbox","aria-expanded":Z,"aria-disabled":o||void 0,"aria-label":ne,onMouseDown:o||d?void 0:O,onFocus:le,onKeyDown:ae,"data-testid":"select-field",children:[s.jsxs("span",{className:"smwb-select-field__search-wrapper",ref:Q,children:[Te&&s.jsx("span",{className:"smwb-select-field__values",children:Te}),p&&typeof p=="boolean"&&!d&&s.jsxs("span",{className:"smwb-select-field__search",children:[s.jsx("span",{className:"smwb-select-field__search-text",children:U}),s.jsx("input",{className:"smwb-select-field__search-input",ref:me,type:"text",value:U,onChange:oe,onMouseDown:Y=>{Y.stopPropagation(),te(!0)},onKeyDown:Y=>{Y.stopPropagation()},"data-testid":"search-input"})]})]}),s.jsxs("span",{className:"smwb-select-field__actions",children:[(Array.isArray(J)&&J.length>0||$&&X.length>0)&&!o&&s.jsx(Ci,{onClick:ke,onMouseDown:Ds,className:y("smwb-select-field__icon","smwb-select-field__icon--close"),"aria-label":"Clear selection",role:"button"}),D,!A&&s.jsx(Ti,{className:y("smwb-select-field__icon","smwb-select-field__icon--arrow",{"smwb-select-field__icon--opened":Z,"smwb-select-field__icon--focused":be,"smwb-select-field__icon--error":g})})]})]})}),s.jsx(Ri,{anchorElementRef:ie,menuMaxHeight:f,menuMiddleware:b,search:p==="menu",onSearchInputChange:oe,optionRenderer:z,items:k?x:U?x.filter(Y=>Y.text.search(new RegExp(U,"i"))!==-1):x,searchValue:U,isOpen:Z,onClose:V,onItemClick:re,value:J,isLoading:C,menuNoItemsMessage:h,container:w,virtualized:I,itemHeight:K,createOption:M&&U&&!x.some(Y=>Y.text.toLowerCase()===String(U).toLowerCase())?{text:`Создать "${U}"`,onCreate:Y=>{F==null||F(String(U),Y),se(""),te(!1)}}:void 0})]})});function ct(e,t,n){return(e-t)/(n-t)*100}function Mi(e){return(`${e}`.split(".")[1]||"").length}function Es(e,t,n){return Math.max(t,Math.min(e,n))}function As(e,t=1){const n=Math.pow(10,t);return Math.round(e*n)/n}function Di(e,t,n,a){if(a==null||a<=0)return Es(e,t,n);const r=Mi(a),c=As(Math.round((e-t)/a)*a,r),l=As(Math.floor((n-t)/a)*a,r);return t+Es(c,0,l)}function Yt(e,t,n,a={}){const r=(e-t[0])/(t[1]-t[0])*(n[1]-n[0])+n[0];return Di(r,n[0],n[1],a.step)}function Zn(e){return e instanceof MouseEvent?e.clientX:e instanceof TouchEvent?e.changedTouches[0].clientX:0}function Jn(e){return e instanceof MouseEvent?e.clientY:e instanceof TouchEvent?e.changedTouches[0].clientY:0}function Qn(e,t,n,a){if(!e)return[];if(Array.isArray(e))return e;const r=a&&a>0?a:(n-t)/10,c=[];for(let l=t;l<=n+1e-9;l+=r)c.push({value:Math.round(l*1e6)/1e6});return c}const Ei=i.forwardRef(function(t,n){const{defaultValue:a,value:r,onChange:c,min:l=0,max:o=100,name:d,disabled:u=!1,className:m,step:f,label:b,helperText:h,error:w,size:p="medium",color:_="primary",orientation:v="horizontal",marks:g,getAriaValueText:x,"aria-label":S,range:j,variant:T,valueField:R,withTicks:k,...N}=t,C=v==="vertical",E=O=>{var P,re,oe,je;const V=Array.isArray(O)?O:[l,o],le=Math.min((P=V[0])!=null?P:l,(re=V[1])!=null?re:o),ae=Math.max((oe=V[0])!=null?oe:l,(je=V[1])!=null?je:o);return[le,ae]},D=r!==void 0,[A,z]=i.useState(()=>E(a)),$=D?E(r):A,M=i.useRef(null),F=ge(n,M),I=i.useRef(0),K=i.useRef(!1),ne=Qn(g,l,o,f),G=O=>{var ae;const V=(ae=M.current)==null?void 0:ae.getBoundingClientRect();if(!V)return l;if(C){const P=(typeof O.clientY=="number"?O.clientY:Jn(O))-V.top;return Yt(V.height-P,[0,V.height],[l,o],{step:f})}const le=(typeof O.clientX=="number"?O.clientX:Zn(O))-V.left;return Yt(le,[0,V.width],[l,o],{step:f})},ce=(O,V)=>{const le=Math.min(O[0],O[1]),ae=Math.max(O[0],O[1]),P=[Math.max(l,le),Math.min(o,ae)];D||z(P),c==null||c(V,P,t)},Z=(O,V)=>{const le=I.current,ae=[$[0],$[1]];ae[le]=Math.max(l,Math.min(o,O)),ce(ae,V)},te=O=>{I.current=Math.abs(O-$[0])<=Math.abs(O-$[1])?0:1},L=Me(O=>{K.current&&(O.preventDefault(),Z(G(O),O))}),B=Me(()=>{K.current=!1,document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",B),document.removeEventListener("touchmove",L),document.removeEventListener("touchend",B)}),X=O=>{if(u||O.button!==0)return;const V=G(O);te(V),K.current=!0,Z(V,O),document.addEventListener("mousemove",L),document.addEventListener("mouseup",B)},ee=O=>{if(u)return;const V=G(O);te(V),K.current=!0,Z(V,O),document.addEventListener("touchmove",L),document.addEventListener("touchend",B)};_e(()=>{const O=M.current;if(O)return O.addEventListener("touchstart",ee),()=>O.removeEventListener("touchstart",ee)});const U=O=>V=>{if(u)return;const le=f&&f>0?f:1;let ae=null;V.key==="ArrowLeft"||V.key==="ArrowDown"?ae=$[O]-le:V.key==="ArrowRight"||V.key==="ArrowUp"?ae=$[O]+le:V.key==="Home"?ae=l:V.key==="End"&&(ae=o),ae!==null&&(V.preventDefault(),I.current=O,Z(ae,V))},se=y("smwb-slider","smwb-slider--range",m,{"smwb-slider--disabled":u,"smwb-slider--vertical":C},p!=="medium"&&`smwb-slider_size-${p}`,_!=="primary"&&`smwb-slider_color-${_}`),de=ct($[0],l,o),ie=ct($[1],l,o),xe=`${Math.min(de,ie)}%`,Q=`${Math.abs(ie-de)}%`,me=C?{bottom:`${de}%`}:{left:`${de}%`},J=C?{bottom:`${ie}%`}:{left:`${ie}%`},be=C?{bottom:xe,height:Q}:{left:xe,width:Q};return s.jsx(Le,{label:b,helperText:h,disabled:u,error:w,fullWidth:!0,shrink:!0,children:s.jsx("div",{className:"smwb-slider__container",children:s.jsxs("span",{ref:F,onMouseDown:X,className:se,...N,children:[ne.length>0&&s.jsx("span",{className:"smwb-slider__marks","aria-hidden":"true",children:ne.map(O=>{const V=`${ct(O.value,l,o)}%`;return s.jsx("span",{className:"smwb-slider__mark",style:C?{bottom:V}:{left:V},children:O.label!=null&&s.jsx("span",{className:"smwb-slider__mark-label",children:O.label})},O.value)})}),s.jsx("span",{className:"smwb-slider__rail"}),s.jsx("span",{className:"smwb-slider__track",style:be}),[0,1].map(O=>s.jsx("span",{className:y("smwb-slider__thumb",`smwb-slider__thumb--${O===0?"start":"end"}`),style:O===0?me:J,children:s.jsx("input",{"data-testid":`slider-input-${O}`,className:"smwb-slider__input",type:"range",min:l,max:o,step:f,name:d?`${d}[${O}]`:void 0,value:$[O],disabled:u,onChange:()=>{},onKeyDown:U(O),tabIndex:u?-1:0,"aria-label":S?`${S} ${O===0?"minimum":"maximum"}`:void 0,"aria-orientation":v,"aria-valuenow":$[O],"aria-valuemin":O===0?l:$[0],"aria-valuemax":O===0?$[1]:o,"aria-valuetext":x?x($[O]):void 0,"aria-disabled":u||void 0})},O))]})})})}),Ai=i.forwardRef(function(t,n){const{defaultValue:a,value:r,onChange:c,min:l=0,max:o=100,name:d,disabled:u=!1,className:m,step:f,variant:b="continuous",valueField:h,withTicks:w,label:p,helperText:_,error:v,size:g="medium",color:x="primary",orientation:S="horizontal",marks:j,range:T,getAriaValueText:R,"aria-label":k,...N}=t,C=typeof a=="number"?a:void 0,E=typeof r=="number"?r:void 0,D=S==="vertical",[A,z]=i.useState(C!=null?C:l),[$,M]=i.useState(!1),[F,I]=i.useState(!1),[K,ne]=i.useState(!1),G=i.useRef(null),ce=ge(n,G),Z=i.useRef(!1),te=E!==void 0,L=b==="discrete",B=te?E:A,X=(P,re)=>{P<l||P>o||(te||z(P),c==null||c(re,P,t))},ee=(P,re)=>Yt(P,[0,re],[l,o],{step:f}),U=P=>{if(u||P.button!==0)return;Z.current=!0;const re=G.current,oe=re==null?void 0:re.getBoundingClientRect();if(oe){const je=D?oe.height-(P.clientY-oe.top):P.clientX-oe.left,ke=ee(je,D?oe.height:oe.width);F||I(!0),X(ke,P)}document.addEventListener("mousemove",de),document.addEventListener("mouseup",ie)},se=P=>{var je;if(u)return;Z.current=!0;const re=G.current,oe=re==null?void 0:re.getBoundingClientRect();if(oe){const ke=(je=P.changedTouches)==null?void 0:je[0],Te=D?oe.height-(ke.clientY-oe.top):ke.clientX-oe.left,Ce=ee(Te,D?oe.height:oe.width);F||I(!0),X(Ce,P)}document.addEventListener("touchmove",de),document.addEventListener("touchend",ie)},de=Me(P=>{if(Z.current){const re=G.current,oe=re==null?void 0:re.getBoundingClientRect();if(oe){const je=Zn(P),ke=Jn(P),Te=D?oe.height-(ke-oe.top):je-oe.left,Ce=ee(Te,D?oe.height:oe.width);if(F||I(!0),B===Ce)return;$||M(!0),X(Ce,P)}}}),ie=Me(()=>{Z.current=!1,$&&M(!1),F&&I(!1),xe()}),xe=()=>{document.removeEventListener("mousemove",de),document.removeEventListener("mouseup",ie),document.removeEventListener("touchmove",de),document.removeEventListener("touchend",ie)},Q=P=>{!K||u||((P.key==="ArrowLeft"||P.key==="ArrowDown")&&X(B-(f||1),P),(P.key==="ArrowRight"||P.key==="ArrowUp")&&X(B+(f||1),P))},me=()=>{ne(!1),document.removeEventListener("keydown",Q)};_e(()=>{if(G.current)return G.current.addEventListener("touchstart",se),()=>{var P;(P=G.current)==null||P.removeEventListener("touchstart",se)}}),_e(()=>{var P,re;u&&((P=G.current)!=null&&P.contains(document.activeElement))&&((re=document.activeElement)==null||re.blur())},[u]);const J=y("smwb-slider",m,{"smwb-slider--disabled":u,"smwb-slider--dragging":$,"smwb-slider--discrete":L,"smwb-slider--vertical":D},g!=="medium"&&`smwb-slider_size-${g}`,x!=="primary"&&`smwb-slider_color-${x}`),be=`${ct(B,l,o)}%`,O=D?{height:be}:{width:be},V=D?{bottom:be}:{left:be},le=()=>Array(Math.round(o/(f||1))+1).fill(1),ae=Qn(j,l,o,f);return s.jsx(Le,{label:p,helperText:_,disabled:u,error:v,fullWidth:!0,shrink:!0,children:s.jsxs("div",{className:"smwb-slider__container",children:[s.jsxs("span",{onKeyDown:Q,ref:ce,onMouseDown:U,className:J,tabIndex:u?-1:0,onFocus:()=>ne(!0),onBlur:me,...N,children:[w&&s.jsx("span",{className:"smwb-slider__ticks",style:{gap:`${f}`},children:le().map((P,re)=>s.jsx("span",{className:"smwb-slider__tick"},re))}),ae.length>0&&s.jsx("span",{className:"smwb-slider__marks","aria-hidden":"true",children:ae.map(P=>{const re=`${ct(P.value,l,o)}%`;return s.jsx("span",{className:"smwb-slider__mark",style:D?{bottom:re}:{left:re},children:P.label!=null&&s.jsx("span",{className:"smwb-slider__mark-label",children:P.label})},P.value)})}),s.jsx("span",{className:"smwb-slider__rail"}),s.jsx("span",{className:"smwb-slider__track",style:O}),s.jsxs("span",{className:y("smwb-slider__thumb",{"smwb-slider__thumb--active":F,"smwb-slider__thumb--discrete":L}),style:V,children:[L&&s.jsx("span",{className:"smwb-slider__thumb-tooltip",children:Math.round(B)}),s.jsx("input",{"data-testid":"slider-input",className:"smwb-slider__input",type:"range",min:l,max:o,name:d,value:B,readOnly:!0,"aria-label":k,"aria-orientation":S,"aria-valuenow":B,"aria-valuemin":l,"aria-valuemax":o,"aria-valuetext":R?R(B):void 0,"aria-disabled":u||void 0})]})]}),h&&L&&s.jsx(Oe,{type:"number",value:B,onChange:P=>X(+P.target.value,P),variant:"filled",helperText:null})]})})}),ea=i.forwardRef(function(t,n){return t.range===!0||Array.isArray(t.value)||Array.isArray(t.defaultValue)?s.jsx(Ei,{ref:n,...t}):s.jsx(Ai,{ref:n,...t})});function Ii(e,t){return typeof e=="function"?e(t):Array.isArray(t)?`${t[0]} – ${t[1]}`:t==null?"":String(t)}function $i({readout:e,endAdornment:t,onReset:n,resetLabel:a,label:r,className:c,...l}){const o=e!==void 0&&e!==!1,d=r!=null||o||t!=null||n!=null;return s.jsxs("div",{className:y("smwb-value-slider",c),children:[d?s.jsxs("div",{className:"smwb-value-slider__header",children:[r!=null?s.jsx("span",{className:"smwb-value-slider__label",children:r}):null,s.jsx("span",{className:"smwb-value-slider__spacer"}),o?s.jsx("span",{className:"smwb-value-slider__readout",children:Ii(e,l.value)}):null,t,n!=null?s.jsx("button",{type:"button",className:"smwb-value-slider__reset","aria-label":a!=null?a:"Reset",disabled:!!l.disabled,onClick:()=>n(),children:s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7M3 4v4h4",strokeLinecap:"round",strokeLinejoin:"round"})})}):null]}):null,s.jsx(ea,{...l})]})}const Fi=i.forwardRef(function(t,n){const{disabled:a,readOnly:r,required:c,checked:l,className:o,id:d,label:u,labelPlacement:m,size:f="medium",color:b="primary",helperText:h,error:w,...p}=t,_=dt(d),v=g=>{var x;if(r){g.preventDefault();return}(x=t.onChange)==null||x.call(t,g,g.target.checked,t)};return s.jsx(Le,{helperText:h,disabled:a,error:w,className:"smwb-text-field-checkbox",children:s.jsxs("span",{className:y("smwb-toggle__wrapper",m&&`smwb-toggle__wrapper_label-${m}`),children:[u?s.jsx("label",{htmlFor:_,className:"smwb-toggle__label",children:u}):null,s.jsxs("label",{className:y("smwb-toggle",`smwb-toggle_size-${f}`,`smwb-toggle_color-${b}`,o,{"smwb-disabled":a,"smwb-readonly":r}),children:[s.jsx("input",{type:"checkbox",id:_,className:"smwb-toggle__checkbox","aria-checked":l,"aria-invalid":w||void 0,"aria-required":c||void 0,role:"switch",checked:l,disabled:a,readOnly:r,required:c,ref:n,...p,onChange:v}),s.jsx("span",{className:"smwb-toggle__track"}),s.jsx("span",{className:"smwb-toggle__thumb"})]})]})})}),Li=i.forwardRef(function({className:t,...n},a){return s.jsx("div",{ref:a,"data-testid":"grid",className:y("smwb-grid",t),...n})}),Oi=["wrap","nowrap","wrap-reverse"],Bi=["flex-start","center","flex-end","space-between","space-around","space-evenly"],Pi=["flex-start","center","flex-end","stretch","baseline"],zi=["row","row-reverse","column","column-reverse"],Vi=i.forwardRef(function({className:t,justifyContent:n,alignItems:a,direction:r,wrap:c,spacing:l,...o},d){const u=n&&Bi.includes(n)&&n!=="flex-start",m=a&&Pi.includes(a)&&a!=="flex-start",f=r&&zi.includes(r)&&r!=="row",b=c&&Oi.includes(c)&&c!=="wrap",h=y("smwb-grid__row",t,{[`smwb-grid__row--spacing-${l}`]:l,[`smwb-grid__row--justifyContent-${n}`]:u,[`smwb-grid__row--alignItems-${a}`]:m,[`smwb-grid__row--direction-${r}`]:f,[`smwb-grid__row--${c}`]:b});return s.jsx("div",{ref:d,"data-testid":"grid-row",className:h,...o})}),Hi=e=>e===void 0?{}:typeof e=="boolean"?{"smwb-grid__column--hidden":e}:Object.keys(e).reduce((t,n)=>(t[`smwb-grid__column--hidden-${n}`]=e[n]===!0,t[`smwb-grid__column--visible-${n}`]=e[n]===!1,t),{}),Yi=i.forwardRef(function({className:t,xs:n,sm:a,md:r,lg:c,xl:l,xsOffset:o,smOffset:d,mdOffset:u,lgOffset:m,xlOffset:f,hidden:b,...h},w){const p=y("smwb-grid__column",t,{[`smwb-grid__column--xs-${n}`]:n,[`smwb-grid__column--sm-${a}`]:a,[`smwb-grid__column--md-${r}`]:r,[`smwb-grid__column--lg-${c}`]:c,[`smwb-grid__column--xl-${l}`]:l,[`smwb-grid__column--xs-offset-${o}`]:o,[`smwb-grid__column--sm-offset-${d}`]:d,[`smwb-grid__column--md-offset-${u}`]:u,[`smwb-grid__column--lg-offset-${m}`]:m,[`smwb-grid__column--xl-offset-${f}`]:f,...Hi(b)});return s.jsx("div",{ref:w,className:p,"data-testid":"grid-col",...h})}),Xi=i.forwardRef(function({className:t,maxWidth:n="lg",disableGutters:a=!1,...r},c){const l=y("smwb-container",{[`smwb-container--${n}`]:n!==!1,"smwb-container--gutterless":a},t);return s.jsx("div",{ref:c,"data-testid":"grid-container",className:l,...r})}),Ki={default:void 0,primary:"var(--smui-primaryColor)",secondary:"var(--smui-secondaryColor)",error:"var(--smui-errorColor)",success:"var(--smui-successColor)",warning:"var(--smui-warningColor)",info:"var(--smui-infoColor)"},Wi=i.forwardRef(function({className:t,orientation:n="horizontal",variant:a="fullWidth",textAlign:r="center",color:c="default",thickness:l,flexItem:o,style:d,children:u,...m},f){const b=u!=null&&u!==!1,h=Ki[c],w=typeof l=="number"?`${l}px`:l,p={...d,...h?{borderColor:h}:{},...w?n==="vertical"?{borderLeftWidth:w}:{borderBottomWidth:w}:{}},_=y("smwb-divider",`smwb-divider_${n}`,`smwb-divider_${a}`,{"smwb-divider_with-text":b&&n==="horizontal",[`smwb-divider_align-${r}`]:b&&n==="horizontal","smwb-divider_flex-item":o},t);return s.jsx("div",{...m,ref:f,"data-testid":"divider",role:"separator","aria-orientation":n,className:_,style:p,children:b&&n==="horizontal"?s.jsx("span",{className:"smwb-divider__text",children:u}):null})});function Ui(e,t){let n=0,a,r;const c=(o,d)=>{n=o,e(...d)},l=(...o)=>{const d=Date.now(),u=t-(d-n);r=o,u<=0||u>t?(a!==void 0&&(clearTimeout(a),a=void 0),c(d,o)):a===void 0&&(a=setTimeout(()=>{a=void 0,r!==void 0&&c(Date.now(),r)},u))};return l.cancel=()=>{a!==void 0&&(clearTimeout(a),a=void 0),n=0,r=void 0},l}const Is=(e,t)=>!e&&t?100-t:e||50,Gi=i.forwardRef(function({className:t,orientation:n="horizontal",sizeFirst:a,sizeSecond:r,children:c,onSizeChange:l,keyboardStep:o=5,resizerAriaLabel:d="Resize panels"},u){const m=i.useRef(null),f=ge(u,m),[b,h]=i.useState(Is(a,r)),[w,p]=i.useState(null),[_,v]=i.useState(!1);i.useEffect(()=>{h(Is(a,r))},[a,r]);const g=i.Children.toArray(c);if(g.length>2)throw new Error("Allowed not more than 2 children");const x=()=>{p(m.current),v(!0)},S=i.useMemo(()=>Ui(N=>{if(!_)return;const C=m.current;if(!C||C!==w)return;const E=C.getBoundingClientRect(),D=n==="vertical"?E.height:E.width,A=n==="vertical"?N.clientY-E.top:N.clientX-E.left,z=Math.max(5,Math.min(D-5,A));h(z/D*100)},1e3/60),[_,w,n]),j=i.useCallback(()=>{p(null),v(!1),document.body.removeEventListener("pointerup",j),document.body.removeEventListener("pointermove",S)},[S]);i.useEffect(()=>{l==null||l(b)},[b,l]);const T=N=>{const C=n==="vertical"?"ArrowUp":"ArrowLeft",E=n==="vertical"?"ArrowDown":"ArrowRight";N.key===C?(N.preventDefault(),h(D=>Math.max(0,D-o))):N.key===E?(N.preventDefault(),h(D=>Math.min(100,D+o))):N.key==="Home"?(N.preventDefault(),h(0)):N.key==="End"&&(N.preventDefault(),h(100))},R=n==="vertical"?{height:`${100-b}%`}:{width:`${100-b}%`},k=n==="vertical"?{height:`${b}%`}:{width:`${b}%`};return i.useEffect(()=>(_?(document.body.addEventListener("pointerup",j),document.body.addEventListener("pointermove",S),document.body.style.cursor=n==="horizontal"?"e-resize":"n-resize"):document.body.style.cursor="default",()=>{document.body.removeEventListener("pointerup",j),document.body.removeEventListener("pointermove",S)}),[S,j,_,n]),s.jsxs("div",{className:y("smwb-screen-divider__wrapper",`smwb-${n}`,t),ref:f,"data-testid":"screen-divider",children:[s.jsx("div",{className:y("smwb-screen-divider__first",`smwb-${n}`),style:k,children:g[0]||""}),s.jsx("span",{className:"smwb-screen-divider__resizer",onPointerDown:x,draggable:!1,role:"separator","aria-orientation":n==="vertical"?"horizontal":"vertical","aria-valuenow":Math.round(b),"aria-valuemin":0,"aria-valuemax":100,"aria-label":d,tabIndex:0,onKeyDown:T}),s.jsx("div",{className:y("smwb-screen-divider__second",`smwb-${n}`),style:R,children:g[1]||""})]})}),qi=i.forwardRef(function({isOpen:t,onClose:n,variant:a="default",children:r,placement:c="bottom",disableOutsideClick:l,closeOnEsc:o=!0,...d},u){const[m,f]=i.useState(null),b=i.useRef(null);i.useEffect(()=>{if(!t||!o||!n)return;const p=_=>{_.key==="Escape"&&xn(b.current)&&n()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,o,n]);const h=()=>{f(m==="expanded"?"small":m?null:"expanded")},w=()=>{n==null||n(),f(null)};return Re.createPortal(s.jsx(Ve.CSSTransition,{in:t,timeout:70,mountOnEnter:!0,unmountOnExit:!0,classNames:{enterDone:"smwb-entered"},appear:!0,nodeRef:b,children:a==="default"?s.jsx("div",{className:y(l?"smwb-sheet__overlay":"smwb-sheet__default"),ref:b,"data-smwb-overlay-layer":"",children:s.jsx($s,{ref:u,onClose:n,handleSizeButton:h,handleClose:w,isOpen:t,mode:m,placement:c,variant:a,...d,children:r})}):s.jsx("div",{className:y("smwb-sheet__overlay","smwb-dark",`smwb-${c}`,`smwb-sheet_${a}`),ref:b,"data-smwb-overlay-layer":"",children:s.jsx(Je,{onClickAway:()=>!l&&w(),children:s.jsx($s,{ref:u,onClose:n,handleSizeButton:h,handleClose:w,isOpen:t,mode:m,placement:c,variant:a,...d,children:r})})})}),document.body)}),Zi=e=>e==="bottom"||e==="top",$s=i.forwardRef(function(t,n){const{isOpen:a,placement:r,className:c,mode:l,size:o="60%",variant:d,onClose:u,withSizeToggle:m=!0,hideHeaderActions:f=!1,reverseHeaderActions:b=!1,resizable:h=!1,minSize:w=80,maxSize:p,resizeStep:_=24,resizeHandleAriaLabel:v="Resize sheet",onResize:g,style:x,handleClose:S,handleSizeButton:j,children:T,...R}=t,k=!f&&(!!u||m),N=[];m&&N.push(s.jsx(Se,{variant:"outlined",size:"small",onClick:j,children:s.jsx(W,{name:"open_in_full"})},"size")),u&&N.push(s.jsx(Se,{variant:"outlined",size:"small",onClick:S,children:s.jsx(W,{name:"close"})},"close")),b&&N.reverse();const C=i.useRef(null),E=i.useRef(null),D=ge(n,C,E),[A,z]=i.useState(null),$=Zi(r),M=i.useCallback(L=>{const B=$?window.innerHeight:window.innerWidth,X=p!=null?p:B;return Math.max(w,Math.min(X,L))},[$,p,w]),F=i.useCallback(()=>{var B;const L=(B=E.current)==null?void 0:B.getBoundingClientRect();return L?$?L.height:L.width:w},[$,w]),I=i.useCallback(L=>{const B=M(L);z(B),g==null||g(B)},[M,g]),K=i.useRef(null),ne=i.useCallback(L=>{var B,X;L.preventDefault(),K.current={start:$?L.clientY:L.clientX,size:F()};try{(X=(B=L.currentTarget).setPointerCapture)==null||X.call(B,L.pointerId)}catch{}},[$,F]),G=i.useCallback(L=>{const B=K.current;if(!B)return;const ee=($?L.clientY:L.clientX)-B.start,U=r==="bottom"||r==="right"?-ee:ee;I(B.size+U)},[$,r,I]),ce=i.useCallback(L=>{var B,X,ee,U;K.current=null,(X=(B=L.currentTarget).hasPointerCapture)!=null&&X.call(B,L.pointerId)&&((U=(ee=L.currentTarget).releasePointerCapture)==null||U.call(ee,L.pointerId))},[]),Z=i.useCallback(L=>{const B=A!=null?A:F(),X=p!=null?p:$?window.innerHeight:window.innerWidth,ee=r==="bottom"?"ArrowUp":r==="top"?"ArrowDown":r==="left"?"ArrowRight":"ArrowLeft",U=r==="bottom"?"ArrowDown":r==="top"?"ArrowUp":r==="left"?"ArrowLeft":"ArrowRight";L.key===ee?(L.preventDefault(),I(B+_)):L.key===U?(L.preventDefault(),I(B-_)):L.key==="Home"?(L.preventDefault(),I(w)):L.key==="End"&&(L.preventDefault(),I(X))},[A,F,$,r,I,_,w,p]);i.useEffect(()=>{var L;if(!a){z(null);return}(L=E.current)==null||L.focus()},[a]);const te=h&&A!==null?{...$?{height:A}:{width:A},transition:"none"}:{};return s.jsx(Ve.CSSTransition,{in:a,timeout:120,appear:!0,classNames:{enterDone:"smwb-sheet_entered"},nodeRef:C,children:s.jsxs("div",{ref:D,"data-testid":"sheet",tabIndex:-1,role:"dialog","aria-modal":d==="modal"||void 0,...R,className:y("smwb-sheet",c,`smwb-sheet_${d}`,`smwb-${r}`,{"smwb-expanded":l==="expanded","smwb-small":l==="small","smwb-sheet_resizable":h}),style:{"--sizeProp":o,...te,...x},children:[h&&s.jsx("div",{className:"smwb-sheet__drag-handle","data-testid":"sheet-drag-handle",role:"separator",tabIndex:0,"aria-orientation":$?"horizontal":"vertical","aria-label":v,"aria-valuemin":w,"aria-valuemax":Math.round(p!=null?p:$?window.innerHeight:window.innerWidth),"aria-valuenow":Math.round(A!=null?A:F()),onPointerDown:ne,onPointerMove:G,onPointerUp:ce,onPointerCancel:ce,onKeyDown:Z,children:s.jsx("span",{className:"smwb-sheet__drag-handle-bar"})}),k&&s.jsx("div",{className:"smwb-sheet__header",children:N}),a&&l!=="small"&&s.jsx("div",{className:"smwb-sheet__inner",children:T})]})})}),Fs=e=>e==="start"||e==="end"?`flex-${e}`:e,Ji=e=>typeof e=="number"?`calc(var(--smui-spacing-unit, 4px) * ${e})`:e==="none"?"0":`var(--smui-space-${e})`,Qi=i.forwardRef(function({direction:t="column",spacing:n="md",align:a,justify:r,wrap:c,divider:l,className:o,style:d,children:u,...m},f){const b=i.Children.toArray(u).filter(i.isValidElement);return s.jsx("div",{ref:f,"data-testid":"stack",className:y("smwb-stack",o),style:{display:"flex",flexDirection:t,flexWrap:c?"wrap":void 0,alignItems:Fs(a),justifyContent:Fs(r),gap:Ji(n),...d},...m,children:l?b.map((h,w)=>s.jsxs(i.Fragment,{children:[w>0?s.jsx("div",{className:"smwb-stack__divider",children:l}):null,h]},w)):u})}),el=i.forwardRef(function({maxWidth:t="lg",disableGutters:n=!1,component:a,className:r,children:c,...l},o){const d=a!=null?a:"main";return s.jsx(d,{ref:o,"data-testid":"page",className:y("smwb-page",`smwb-page_max-${t}`,{"smwb-page_gutterless":n},r),...l,children:s.jsx("div",{className:"smwb-page__inner",children:c})})}),tl=i.forwardRef(function({title:t,subtitle:n,breadcrumbs:a,actions:r,divider:c=!1,className:l,...o},d){return s.jsxs("header",{ref:d,"data-testid":"page-header",className:y("smwb-page-header",{"smwb-page-header_divider":c},l),...o,children:[a?s.jsx("div",{className:"smwb-page-header__breadcrumbs",children:a}):null,s.jsxs("div",{className:"smwb-page-header__row",children:[s.jsxs("div",{className:"smwb-page-header__titles",children:[typeof t=="string"?s.jsx(Ge,{variant:"h4",component:"h1",className:"smwb-page-header__title",children:t}):s.jsx("div",{className:"smwb-page-header__title",children:t}),n?s.jsx(Ge,{variant:"body2",color:"textSecondary",className:"smwb-page-header__subtitle",children:n}):null]}),r?s.jsx("div",{className:"smwb-page-header__actions",children:r}):null]})]})}),Ls=e=>typeof e=="number"?`${e}px`:e,sl=i.forwardRef(function({header:t,sidebar:n,footer:a,sidebarWidth:r=260,sidebarCollapsed:c,defaultSidebarCollapsed:l=!1,onSidebarCollapsedChange:o,collapsible:d=!1,collapseToggle:u,collapseToggleAriaLabel:m="Toggle navigation",sidebarCollapsedWidth:f=72,stickyHeader:b=!0,className:h,style:w,children:p,..._},v){const[g,x]=$e({value:c,defaultValue:l,onChange:o}),S=i.useId(),j={"--smui-app-sidebar-w":Ls(g?f:r)};return s.jsxs("div",{ref:v,"data-testid":"app-layout",className:y("smwb-app-layout",{"smwb-app-layout_sticky-header":b,"smwb-app-layout_collapsed":g},h),style:{...j,...w},..._,children:[t?s.jsx("div",{className:"smwb-app-layout__header",children:t}):null,s.jsxs("div",{className:"smwb-app-layout__body",children:[n?s.jsxs("aside",{id:S,className:"smwb-app-layout__sidebar",children:[d?s.jsx("div",{className:"smwb-app-layout__collapse",children:u!=null?u:s.jsx("button",{type:"button",className:"smwb-app-layout__collapse-btn","aria-label":m,"aria-expanded":!g,"aria-controls":S,onClick:()=>x(!g),children:s.jsx(W,{name:g?"chevron_right":"chevron_left",size:20})})}):null,n]}):null,s.jsxs("div",{className:"smwb-app-layout__content",children:[p,a?s.jsx("div",{className:"smwb-app-layout__footer",children:a}):null]})]})]})}),nl=i.forwardRef(function({className:t,children:n,dense:a,position:r="static",placement:c="top",leftContent:l,midContent:o,midContentAlign:d="middle",rightContent:u,title:m,color:f="default",...b},h){const w=c==="top"?"header":"footer";return s.jsx(w,{ref:h,className:y("smwb-appbar",t,`smwb-${r}`,`smwb-${c}`,{"smwb-dense":a},f!=="default"&&`smwb-appbar_color-${f}`),"data-testid":"app-bar",...b,children:n||s.jsxs("div",{className:"smwb-appbar__inner",children:[s.jsxs("div",{className:"smwb-appbar__left",children:[m&&s.jsx("div",{className:"smwb-appbar__left__title",children:m}),l]}),s.jsx("div",{className:y("smwb-appbar__mid",`smwb-${d}`),children:o}),s.jsx("div",{className:"smwb-appbar__right",children:u})]})})}),al=i.forwardRef(function({className:t,separator:n="/",maxItems:a=8,itemsBeforeCollapse:r=1,itemsAfterCollapse:c=1,expanded:l,onExpand:o,expandLabel:d="Show path",children:u,...m},f){const b=l!==void 0,[h,w]=i.useState(!1),p=b?!!l:h,_=i.Children.toArray(u).filter(i.isValidElement),v=!p&&_.length>a&&r+c<_.length,g=()=>{o==null||o(),b||w(!0)},x=v?[..._.slice(0,r),s.jsx("button",{type:"button",className:"smwb-breadcrumbs__expand","aria-label":d,onClick:g,children:"…"},"smwb-breadcrumbs-expand"),..._.slice(_.length-c)]:_;return s.jsx("nav",{...m,ref:f,"data-testid":"breadcrumbs","aria-label":"breadcrumb",className:y("smwb-breadcrumbs",t),children:s.jsx("ol",{className:"smwb-breadcrumbs__list",children:x.map((S,j)=>s.jsxs(i.Fragment,{children:[s.jsx("li",{className:"smwb-breadcrumbs__item",children:S}),j<x.length-1?s.jsx("li",{className:"smwb-breadcrumbs__separator","aria-hidden":"true",children:n}):null]},j))})})}),Ft=(e,t)=>Array.from({length:Math.max(t-e+1,0)},(n,a)=>e+a),rl=(e,t,n,a)=>{const r=Ft(1,Math.min(a,e)),c=Ft(Math.max(e-a+1,a+1),e),l=Math.max(Math.min(t-n,e-a-n*2-1),a+2),o=Math.min(Math.max(t+n,a+n*2+2),c.length>0?c[0]-2:e-1);return[...r,...l>a+2?["start-ellipsis"]:a+1<e-a?[a+1]:[],...Ft(l,o),...o<e-a-1?["end-ellipsis"]:e-a>a?[e-a]:[],...c]},il=i.forwardRef(function({className:t,count:n,page:a,siblingCount:r=1,boundaryCount:c=1,size:l="medium",variant:o="filled",shape:d="circular",color:u="default",disabled:m=!1,showFirstButton:f=!1,showLastButton:b=!1,hidePrevButton:h=!1,hideNextButton:w=!1,onChange:p,..._},v){const g=i.useRef(null),x=ge(v,g),S=k=>{m||k===a||k<1||k>n||p==null||p(k)},j=k=>{var D,A,z;if(!["ArrowLeft","ArrowRight","Home","End"].includes(k.key))return;const N=Array.from((A=(D=g.current)==null?void 0:D.querySelectorAll("button.smwb-pagination__item:not(:disabled)"))!=null?A:[]);if(N.length===0)return;const C=N.indexOf(document.activeElement);let E=C;k.key==="ArrowRight"?E=Math.min(C+1,N.length-1):k.key==="ArrowLeft"?E=Math.max(C-1,0):k.key==="Home"?E=0:k.key==="End"&&(E=N.length-1),k.preventDefault(),(z=N[E])==null||z.focus()},T=rl(n,a,r,c),R=(k,N,C,E,D)=>D?null:s.jsx("li",{children:s.jsx("button",{type:"button",className:"smwb-pagination__item smwb-pagination__nav","aria-label":N,disabled:m||C<1||C>n,onClick:()=>S(C),children:s.jsx(W,{name:E,size:l==="small"?16:18})})},k);return s.jsx("nav",{..._,ref:x,"data-testid":"pagination","aria-label":"pagination",className:y("smwb-pagination",`smwb-pagination_${l}`,`smwb-pagination_${o}`,`smwb-pagination_shape-${d}`,u!=="default"&&`smwb-pagination_color-${u}`,{"smwb-pagination_disabled":m},t),children:s.jsxs("ul",{className:"smwb-pagination__list",onKeyDown:j,children:[R("first","First page",1,"first_page",!f),R("prev","Previous page",a-1,"chevron_left",h),T.map((k,N)=>typeof k=="number"?s.jsx("li",{children:s.jsx("button",{type:"button",className:y("smwb-pagination__item",{"smwb-pagination__item_selected":k===a}),"aria-current":k===a?"page":void 0,disabled:m,onClick:()=>S(k),children:k})},k):s.jsx("li",{className:"smwb-pagination__ellipsis","aria-hidden":"true",children:"…"},`${k}-${N}`)),R("next","Next page",a+1,"chevron_right",w),R("last","Last page",n,"last_page",!b)]})})}),ll=i.forwardRef(function({className:t,steps:n,activeStep:a,orientation:r="horizontal",alternativeLabel:c=!1,onStepClick:l,...o},d){return s.jsx("div",{...o,ref:d,"data-testid":"stepper",className:y("smwb-stepper",`smwb-stepper_${r}`,{"smwb-stepper_alt-label":c&&r==="horizontal"},t),children:n.map((u,m)=>{var _;const f=m<a,b=m===a,h=m===n.length-1,w=!!l&&!u.disabled,p=v=>{w&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),l==null||l(m))};return s.jsxs(i.Fragment,{children:[s.jsxs("div",{className:y("smwb-stepper__step",{"smwb-stepper__step_active":b,"smwb-stepper__step_completed":f,"smwb-stepper__step_error":u.error,"smwb-stepper__step_disabled":u.disabled,"smwb-stepper__step_clickable":w}),"aria-current":b?"step":void 0,"aria-disabled":u.disabled||void 0,role:w?"button":void 0,tabIndex:w?0:void 0,onClick:w?()=>l==null?void 0:l(m):void 0,onKeyDown:w?p:void 0,children:[s.jsx("div",{className:"smwb-stepper__icon","aria-hidden":"true",children:(_=u.icon)!=null?_:f?s.jsx(W,{name:"check",size:16}):s.jsx("span",{children:m+1})}),s.jsxs("div",{className:"smwb-stepper__text",children:[s.jsx("span",{className:"smwb-stepper__label",children:u.label}),u.optional?s.jsx("span",{className:"smwb-stepper__optional",children:u.optional}):null,u.description&&r==="vertical"?s.jsx("span",{className:"smwb-stepper__description",children:u.description}):null]})]}),h?null:s.jsx("div",{className:"smwb-stepper__connector","aria-hidden":"true"})]},m)})})});function ol({items:e,icon:t="more_vert",placement:n,"aria-label":a,disabled:r,className:c}){const l=i.useRef(null),[o,d]=i.useState(!1),u=()=>d(!1);return s.jsxs("span",{className:y("smwb-overflow-menu",c),children:[s.jsx(Se,{ref:l,variant:"text",size:"small",icon:t,"aria-label":a!=null?a:"More actions","aria-haspopup":"menu",disabled:!!r,onClick:()=>d(m=>!m)}),s.jsx(kt,{isOpen:o,onClose:u,anchorElement:l.current,...n?{placement:n}:{},children:e.map(m=>s.jsxs(qe,{className:y({"smwb-overflow-menu__item--danger":m.danger}),disabled:m.disabled,onClick:()=>{var f;m.disabled||((f=m.onSelect)==null||f.call(m),u())},children:[m.icon?typeof m.icon=="string"?s.jsx(W,{name:m.icon}):m.icon:null,m.label]},m.id))})]})}const cl=i.forwardRef(function({className:t,variant:n="default",menuItems:a,activeItem:r,defaultActiveItem:c=null,onActiveItemChange:l,collapsible:o=!1,collapsed:d,defaultCollapsed:u=!1,onCollapsedChange:m,collapseToggleAriaLabel:f="Toggle navigation",...b},h){const w=r!==void 0,[p,_]=i.useState(c),v=w?r:p,[g,x]=$e({value:d,defaultValue:u,onChange:m}),S=o&&g?"compactMini":n;return s.jsxs("aside",{ref:h,className:y("smwb-sidebar",t,`smwb-${S}`,{"smwb-sidebar_collapsible":o,"smwb-sidebar_collapsed":o&&g}),role:"menubar",...b,children:[o&&s.jsx("div",{className:"smwb-sidebar__collapse",children:s.jsx("button",{type:"button",className:"smwb-sidebar__collapse-btn","aria-label":f,"aria-expanded":!g,onClick:()=>x(!g),children:s.jsx(W,{name:g?"chevron_right":"chevron_left",size:20})})}),s.jsx("nav",{className:"smwb-sidebar__nav",children:a&&(a==null?void 0:a.map((j,T)=>s.jsx(ul,{as:j.as,isActive:v===T,onClick:R=>{var k;w||_(T),l==null||l(T),(k=j.onClick)==null||k.call(j,R)},icon:j.icon,title:j.title,href:j.href,variant:S},T)))})]})});function ul({isActive:e,icon:t,title:n,as:a="div",href:r,onMouseDown:c,variant:l,...o}){const d=i.useRef(null),u=h=>{c==null||c(h)},m=h=>{var w;(w=d.current)==null||w.onRipple(h)},f=s.jsx(De,{actionRef:d}),b=a;return s.jsxs(b,{href:r,role:"menuitem",className:y("sidebar__nav__item","smwb-nav-item",l,{active:e}),onMouseDown:u,onPointerDown:m,...o,children:[t&&s.jsx("span",{className:"smwb-nav-item__icon",children:t}),n&&s.jsx("span",{className:"smwb-nav-item__title",children:n}),f]})}const dl=i.forwardRef(function({className:t,menuItems:n=[],visibleCount:a=4,activeItem:r,defaultActiveItem:c=null,onActiveItemChange:l,overflowMenuAriaLabel:o="More navigation",...d},u){const m=r!==void 0,[f,b]=i.useState(c),h=m?r:f,[w,p]=i.useState(!1),[_,v]=i.useState(null),g=Math.max(0,a),x=i.useMemo(()=>n.slice(0,g),[n,g]),S=i.useMemo(()=>n.slice(g),[n,g]),j=S.length>0,T=j&&h!==null&&h>=g,R=E=>{m||b(E),l==null||l(E)},k=(E,D)=>A=>{R(E),D==null||D(A)},N=()=>{p(E=>!E)},C=()=>{p(!1)};return s.jsxs("nav",{ref:u,className:y("smwb-bottom-bar",t),role:"navigation",...d,children:[s.jsxs("div",{className:"smwb-bottom-bar__nav",role:"menubar",children:[x.map((E,D)=>s.jsx(Os,{as:E.as,isActive:h===D,onClick:k(D,E.onClick),icon:E.icon,title:E.title,href:E.href},D)),j&&s.jsx(Os,{ref:v,isActive:T,onClick:N,icon:s.jsx(W,{name:"menu",size:24}),"aria-label":o,"aria-haspopup":"menu","aria-expanded":w})]}),j&&s.jsx(kt,{isOpen:w,onClose:C,anchorElement:_,placement:"top",dense:!0,children:S.map((E,D)=>{const A=g+D;return s.jsxs(qe,{selected:h===A,href:E.href,onClick:z=>{var $;R(A),($=E.onClick)==null||$.call(E,z),C()},children:[E.icon?s.jsx(is,{children:E.icon}):null,s.jsx(ls,{inset:!E.icon,children:E.title})]},A)})})]})}),Os=i.forwardRef(function({isActive:t,icon:n,title:a,as:r="div",href:c,onMouseDown:l,...o},d){const u=i.useRef(null),m=h=>{l==null||l(h)},f=h=>{var w;(w=u.current)==null||w.onRipple(h)},b=r;return s.jsxs(b,{ref:d,href:c,role:"menuitem",className:y("smwb-bottom-bar__item",{"smwb-bottom-bar__item_active":t}),onMouseDown:m,onPointerDown:f,...o,children:[n&&s.jsx("span",{className:"smwb-bottom-bar__item-icon",children:n}),a?s.jsx("span",{className:"smwb-bottom-bar__item-title",children:a}):null,s.jsx(De,{actionRef:u})]})});function ml(e,t){let n;const a=(...r)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...r)},t)};return a.cancel=()=>{n!==void 0&&(clearTimeout(n),n=void 0)},a}const fl=i.forwardRef(function(t,n){const{className:a,label:r,isActive:c=!1,contentRef:l,icon:o,stacked:d=!1,tag:u,disabled:m,onMouseDown:f,...b}=t,h=i.useRef(null),w=g=>{f==null||f(g)},p=g=>{var x;(x=h.current)==null||x.onRipple(g)},_=u!=null?u:u||"button",v=y("smwb-tab",a,{"smwb-tab--active":c,"smwb-tab--stacked":d,"smwb-tab--disabled":m});return s.jsxs(_,{ref:n,className:v,onMouseDown:w,onPointerDown:p,role:"tab","aria-selected":c,"aria-disabled":m||void 0,tabIndex:c?0:-1,disabled:_==="button"?m:void 0,...b,children:[s.jsxs("span",{className:"smwb-tab__content",ref:l,children:[o&&s.jsx("span",{className:"smwb-tab__icon",children:o}),r&&s.jsx("span",{className:"smwb-tab__text-label",children:r})]}),s.jsx(De,{actionRef:h,classes:{child:"tab__ripple-child"}})]})}),hl=e=>(1+Math.sin(Math.PI*e-Math.PI/2))/2;function bl(e,t,n,a={},r=()=>{}){const{ease:c=hl,duration:l=300}=a;let o=null;const d=e[t];let u=!1;const m=()=>{u=!0},f=b=>{if(u){r(new Error("Animation cancelled"));return}o===null&&(o=b);const h=Math.min(1,(b-o)/l);if(e[t]=c(h)*(n-d)+d,h>=1){requestAnimationFrame(()=>{r(null)});return}requestAnimationFrame(f)};return d===n?(r(new Error("Element already at target position")),m):(requestAnimationFrame(f),m)}const Bs={root:{},content:{}},wl=i.forwardRef(function(t,n){const{className:a,children:r,onChange:c,value:l,indicatorContent:o=!1,scrollable:d=!1,"aria-label":u,...m}=t,[f,b]=i.useState(!1),[h,w]=i.useState(Bs),p=i.useRef(null),_=i.useRef(null),v=i.useRef([]),g=40,x=()=>{const k=p.current;let N;if(k){const D=k.getBoundingClientRect();N={clientWidth:k.clientWidth,scrollLeft:k.scrollLeft,scrollTop:k.scrollTop,scrollWidth:k.scrollWidth,top:D.top,bottom:D.bottom,left:D.left,right:D.right}}let C=null,E=null;if(_.current||console.error("tabListRef.current is undefined"),k&&_.current){const D=_.current.children;if(D.length>0){const A=D[l];C=A?A.getBoundingClientRect():null,o&&(E=v.current[l]?v.current[l].getBoundingClientRect():null)}}return{tabsMeta:N,tabMeta:C,tabContentMeta:E}},S=Me(()=>{const{tabsMeta:k,tabMeta:N,tabContentMeta:C}=x();let E=0;N&&k&&(E=1*(N.left-k.left+k.scrollLeft));const D={root:{left:E,width:N?N.width:0}};if(o&&C&&(D.content={width:C.width}),isNaN(h.root.left)||isNaN(h.root.width))w(D);else{const A=Math.abs(h.root.left-D.root.left),z=Math.abs(h.root.width-D.root.width);(A>=1||z>=1)&&w(D)}}),j=(k,{animation:N=!0}={})=>{p.current&&(N?bl(p.current,"scrollLeft",k,{duration:300}):p.current.scrollLeft=k)},T=Me(k=>{const{tabsMeta:N,tabMeta:C}=x();if(!(!C||!N)){if(C.left<N.left){const E=N.scrollLeft+(C.left-N.left);j(E-g,{animation:k})}else if(C.right>N.right){const E=N.scrollLeft+(C.right-N.right);j(E+g,{animation:k})}}});i.useEffect(()=>{b(!0)},[]),i.useEffect(()=>{S()}),i.useEffect(()=>{var E,D;const k=ml(()=>{p.current&&S()},166);if(!p.current||!p.current.ownerDocument.defaultView){console.error("tabsRef.current.ownerDocument.defaultView is undefined");return}const N=p.current.ownerDocument.defaultView;N.addEventListener("resize",k);let C;return typeof ResizeObserver!="undefined"&&(C=new ResizeObserver(k),Array.from((D=(E=_.current)==null?void 0:E.children)!=null?D:[]).forEach(A=>{C.observe(A)})),()=>{k.cancel(),N.removeEventListener("resize",k),C&&C.disconnect()}},[S]),i.useEffect(()=>{T(Bs!==h)},[T,h]);const R=i.Children.map(r,(k,N)=>i.cloneElement(k,{isActive:l===N,onClick:C=>{c(C,N)},...o&&{contentRef:C=>{const{contentRef:E}=k.props;v.current.push(C),E&&Vs(E,C)}}}));return s.jsx("div",{className:y("smwb-tabs",a),role:"tabpanel",ref:n,...m,children:s.jsxs("div",{className:y("smwb-tabs__scroller",{"smwb-tabs__scroller--scrollable":d}),ref:p,children:[s.jsx("div",{className:"smwb-tabs__scroll-area",ref:_,role:"tablist","aria-label":u,children:R}),f&&s.jsx("span",{className:"smwb-tabs__indicator",style:h.root,children:s.jsx("span",{className:"smwb-tabs__indicator-content",style:h.content})})]})})});exports.Accordion=ga;exports.AppBar=nl;exports.AppLayout=sl;exports.AssetGrid=La;exports.Avatar=qt;exports.AvatarGroup=Sa;exports.Badge=Aa;exports.BottomBar=dl;exports.Breadcrumbs=al;exports.Button=Se;exports.ButtonGroup=vr;exports.CHAT_DEFAULT_FILE_UPLOAD_MAX_FILES=Ws;exports.CHAT_EXPAND_LAYOUTS=Wt;exports.CHAT_MESSAGE_DELIVERY_STATUSES=Ys;exports.CHAT_MESSAGE_STATUS_ICONS=Xs;exports.CHAT_MESSAGE_STATUS_LABELS=Ks;exports.Card=Ia;exports.Carousel=Ja;exports.Chat=Pt;exports.ChatAttachmentImage=sn;exports.ChatAttachments=nn;exports.ChatComposer=en;exports.ChatHeader=tn;exports.ChatLayout=Ea;exports.ChatMessageAvatar=Ot;exports.ChatMessageBubble=Zt;exports.ChatMessageIncoming=rn;exports.ChatMessageItem=cn;exports.ChatMessageOutgoing=ln;exports.ChatMessageSkeleton=un;exports.ChatMessageStatus=an;exports.ChatMessageSystem=on;exports.ChatMessages=hn;exports.ChatShell=bn;exports.Checkbox=yr;exports.Chip=Jt;exports.ChipGroup=$a;exports.CircularProgress=Cn;exports.ClickAwayListener=Je;exports.Column=Yi;exports.Container=Xi;exports.DEFAULT_TIME_FORMAT=mt;exports.DataPickerDays=rs;exports.DataPickerHeader=as;exports.DataPickerInput=Hn;exports.DatePicker=Ur;exports.DatePickerActionLabel=zt;exports.DatePickerIconButton=ze;exports.DatePickerList=ut;exports.DateTimePicker=_i;exports.DateTimePickerInput=Kn;exports.Divider=Wi;exports.ExpansionPanel=ya;exports.FloatingButton=Hs;exports.Grid=Li;exports.Icon=W;exports.ImagesList=tr;exports.ImagesListItem=er;exports.ImagesListItemModal=kn;exports.LazyImage=_n;exports.List=nr;exports.ListItem=sr;exports.Menu=kt;exports.MenuDivider=Bn;exports.MenuItem=qe;exports.MenuItemIcon=is;exports.MenuItemText=ls;exports.MenuSubmenu=Vr;exports.Message=fr;exports.MessageContainer=Rn;exports.Modal=Ye;exports.OpenView=pe;exports.OverflowMenu=ol;exports.Page=el;exports.PageHeader=tl;exports.Pagination=il;exports.ProgressIndicator=Tn;exports.RadioButton=ki;exports.Rating=Ni;exports.Ripple=De;exports.Row=Vi;exports.SaveAssetDialog=hr;exports.ScreenDivider=Gi;exports.SelectField=Si;exports.Sheet=qi;exports.Sidebar=cl;exports.Skeleton=rt;exports.Slider=ea;exports.SnackbarProvider=pr;exports.Stack=Qi;exports.Stepper=ll;exports.Tab=fl;exports.Table=ar;exports.TableBody=rr;exports.TableCell=ir;exports.TableHead=lr;exports.TableHeadCell=or;exports.TablePagination=Nn;exports.TableRow=cr;exports.Tabs=wl;exports.TextField=Oe;exports.TextFieldAdornment=Lt;exports.TextFieldWrapper=Le;exports.Theme=zs;exports.ThumbCard=Fa;exports.TimePicker=ji;exports.TimePickerColumns=cs;exports.TimePickerInput=qn;exports.Toggle=Fi;exports.Tooltip=xr;exports.TreeView=ur;exports.Typography=Ge;exports.ValueSlider=$i;exports.formatChatTimestamp=Zs;exports.getChatLayoutActions=Js;exports.getCurrentDateTimeFormat=xt;exports.getDisplayDateTime=it;exports.isChatMessageDeliveryStatus=Ut;exports.isImageAttachment=qs;exports.isScrolledToBottom=mn;exports.resolveAllowedLayouts=Gt;exports.resolveChatFileUploadMaxFiles=wn;exports.resolveChatMessageStatusIcon=Us;exports.resolveChatMessageStatusLabel=Gs;exports.scrollChatToBottom=Bt;exports.shouldComposerNewlineOnEnter=Qs;exports.useChatFileUpload=pn;exports.useChatInfiniteScroll=dn;exports.useChatStickToBottom=fn;exports.useControllableState=$e;exports.useDateInput=Vn;exports.useDateTimeInput=Xn;exports.useFocusTrap=oa;exports.useHoverPopover=ha;exports.useId=dt;exports.useRovingTabIndex=ca;exports.useSnackbar=gr;exports.useTheme=ia;exports.useTimeInput=Gn;exports.useVirtualList=Kt;
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|