import{a as l,r as c}from"./index-BP8_t0zE.js";import{o as R,a4 as _,a7 as j,c as I,s as x,Y as E}from"./defaultI18nProvider-C_r1y4tu.js";import{u as L,T as k,I as P}from"./Button-C3j8Wgdd.js";import{u as N}from"./useRefresh-BVYjI9Ho.js";import{C as w}from"./CircularProgress-CoZCnRya.js";import{r as M}from"./createSvgIcon-BeVLBbd8.js";import{j as S}from"./assertThisInitialized-ClXgY4BW.js";var F=function(){var e=R(),t=l.useRef(!1),n=l.useRef(e.isFetching()>0),r=l.useRef(e.isMutating()>0),a=l.useState(n.current||r.current),o=a[0],i=a[1];return l.useEffect(function(){t.current=!0;var v=e.getQueryCache().subscribe(_.batchCalls(function(){t.current&&(n.current=e.isFetching()>0,i(n.current||r.current))})),u=e.getMutationCache().subscribe(_.batchCalls(function(){t.current&&(r.current=e.isMutating()>0,i(n.current||r.current))}));return function(){t.current=!1,v(),u()}},[e]),o},g=function(){return g=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},g.apply(this,arguments)},T=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n},f,m,U=function(e){var t=e.className,n=e.onClick,r=e.sx,a=T(e,["className","onClick","sx"]),o=F(),i=j();return c.createElement(q,{className:t,sx:r},c.createElement($,{className:"".concat(s.loadedIcon," ").concat(o&&s.loadedLoading),onClick:n}),o&&c.createElement(w,g({className:I("app-loader",s.loader),color:"inherit",size:i.spacing(2),thickness:6},a)))},d="RaLoadingIndicator",s={loader:"".concat(d,"-loader"),loadedLoading:"".concat(d,"-loadedLoading"),loadedIcon:"".concat(d,"-loadedIcon")},q=x("div",{name:d,overridesResolver:function(e,t){return t.root}})((f={position:"relative"},f["& .".concat(s.loadedIcon)]=(m={},m["&.".concat(s.loadedLoading)]={opacity:0},m),f["& .".concat(s.loader)]={position:"absolute",top:"30%",left:"30%"},f)),h={},D=E;Object.defineProperty(h,"__esModule",{value:!0});var O=h.default=void 0,Q=D(M()),z=S;O=h.default=(0,Q.default)((0,z.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");var b=function(){return b=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},b.apply(this,arguments)},B=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n},$=function(e){var t=e.label,n=t===void 0?"ra.action.refresh":t,r=e.icon,a=r===void 0?V:r,o=e.onClick,i=e.className,v=B(e,["label","icon","onClick","className"]),u=N(),p=L(),C=c.useCallback(function(y){y.preventDefault(),u(),typeof o=="function"&&o(y)},[u,o]);return c.createElement(k,{title:n&&p(n,{_:"Refresh"})},c.createElement(P,b({"aria-label":n&&p(n,{_:"Refresh"}),className:i,color:"inherit",onClick:C},v),a))},V=c.createElement(O,null);export{U as L};
