Liferay.Loader.define("@liferay/document-library-web@6.0.104/document_library/js/bulk/BulkStatus.es",["module","exports","require","@frontend-taglib-clay$clayui/loading-indicator","@liferay/frontend-js-react-web","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./reducer.es"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=s(r("@frontend-taglib-clay$clayui/loading-indicator")),a=r("@liferay/frontend-js-react-web"),o=r("frontend-js-web"),c=(s(r("liferay!frontend-js-react-web$prop-types")),i(r("liferay!frontend-js-react-web$react"))),l=i(r("./reducer.es"));function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function i(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}return r.default=e,t&&t.set(e,r),r}function s(e){return e&&e.__esModule?e:{default:e}}var f=function({bulkComponentId:e,bulkInProgress:t,bulkStatusUrl:r="/bulk/v1.0/status",intervalSpeed:u=1e3,pathModule:i,waitingTime:s=1e3}){const f=(0,a.useTimeout)(),[d,p]=(0,c.useReducer)(l.default,t?{current:l.STATES.LONG_POLLING}:{current:l.STATES.IDLE}),y=(0,c.useCallback)((()=>f((()=>{(0,o.fetch)("".concat(Liferay.ThemeDisplay.getPortalURL()).concat(i).concat(r)).then((e=>e.json())).then((e=>{e.actionInProgress?p({type:"check"}):p({type:"success"})})).catch((()=>p({type:"error"})))}),u)),[r,f,i,u]);return(0,c.useEffect)((()=>{let e;return d.current===l.STATES.SHORT_POLLING?(y(),e=f((()=>p({type:"initialDelayCompleted"})),s)):d.current===l.STATES.LONG_POLLING?y():d.current===l.STATES.NOTIFY&&((0,o.openToast)(d.toast),p({type:"notificationCompleted"})),e}),[f,d,y,s]),Liferay.component(e)||Liferay.component(e,{startWatch:()=>{p({type:"start"})}},{destroyOnNavigate:!0}),c.default.createElement("div",{className:"bulk-status-container"},c.default.createElement("div",{className:"bulk-status ".concat(!d.current.show&&"closed")},c.default.createElement("div",{className:"bulk-status-content"},c.default.createElement(n.default,{light:!0,small:!0}),c.default.createElement("span",null,Liferay.Language.get("processing-actions")))))};t.default=f}}));
//# sourceMappingURL=BulkStatus.es.js.map