1import{r as o,j as s}from"./chunk-LFPYN7LY-BYCOceFh.js";import{c as P,S as R,d as M}from"./spinner-WEkHiO-h.js";import{a as x,c as p,f as A,u as G,o as z}from"./use-style-config-ZxeY2J_M.js";const j=n=>n?"":void 0;function D(n,t){if(n!=null){if(typeof n=="function"){n(t);return}try{n.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${n}'`)}}}function W(...n){return t=>{n.forEach(e=>{D(e,t)})}}function $(...n){return o.useMemo(()=>W(...n),n)}const[q,F]=P({strict:!1,name:"ButtonGroupContext"});function l(n){const{children:t,className:e,...a}=n,i=o.isValidElement(t)?o.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,r=x("chakra-button__icon",e);return s.jsx(p.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...a,className:r,children:i})}l.displayName="ButtonIcon";function g(n){const{label:t,placement:e,spacing:a="0.5rem",children:i=s.jsx(R,{color:"currentColor",width:"1em",height:"1em"}),className:r,__css:u,...m}=n,f=x("chakra-button__spinner",r),d=e==="start"?"marginEnd":"marginStart",c=o.useMemo(()=>M({display:"flex",alignItems:"center",position:t?"relative":"absolute",[d]:t?a:0,fontSize:"1em",lineHeight:"normal",...u}),[u,t,d,a]);return s.jsx(p.div,{className:f,...m,__css:c,children:i})}g.displayName="ButtonSpinner";function H(n){const[t,e]=o.useState(!n);return{ref:o.useCallback(r=>{r&&e(r.tagName==="BUTTON")},[]),type:t?"button":void 0}}const L=A((n,t)=>{const e=F(),a=G("Button",{...e,...n}),{isDisabled:i=e==null?void 0:e.isDisabled,isLoading:r,isActive:u,children:m,leftIcon:f,rightIcon:d,loadingText:c,iconSpacing:h="0.5rem",type:N,spinner:y,spinnerPlacement:_="start",className:C,as:b,shouldWrapChildren:k,...I}=z(n),E=o.useMemo(()=>{const T={...a==null?void 0:a._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...a,...!!e&&{_focus:T}}},[a,e]),{ref:v,type:w}=H(b),S={rightIcon:d,leftIcon:f,iconSpacing:h,children:m,shouldWrapChildren:k};return s.jsxs(p.button,{disabled:i||r,ref:$(t,v),as:b,type:N??w,"data-active":j(u),"data-loading":j(r),__css:E,className:x("chakra-button",C),...I,children:[r&&_==="start"&&s.jsx(g,{className:"chakra-button__spinner--start",label:c,placement:"start",spacing:h,children:y}),r?c||s.jsx(p.span,{opacity:0,children:s.jsx(B,{...S})}):s.jsx(B,{...S}),r&&_==="end"&&s.jsx(g,{className:"chakra-button__spinner--end",label:c,placement:"end",spacing:h,children:y})]})});L.displayName="Button";function B(n){const{leftIcon:t,rightIcon:e,children:a,iconSpacing:i,shouldWrapChildren:r}=n;return r?s.jsxs("span",{style:{display:"contents"},children:[t&&s.jsx(l,{marginEnd:i,children:t}),a,e&&s.jsx(l,{marginStart:i,children:e})]}):s.jsxs(s.Fragment,{children:[t&&s.jsx(l,{marginEnd:i,children:t}),a,e&&s.jsx(l,{marginStart:i,children:e})]})}export{L as B,j as d,W as m};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.