Liferay.Loader.define("@liferay/frontend-taglib@8.0.4/translation_manager/hooks/useRegistry",["module","exports","require","liferay!frontend-js-react-web$react"],(function(e,r,t){window;{Object.defineProperty(r,"__esModule",{value:!0}),r.default=function({componentId:e,states:r}){const t=(0,n.useRef)(o({},r)),c=(0,n.useRef)([]),a=(0,n.useRef)(o({},r)),u=(e,r)=>{if(c.current){const t=c.current.findIndex((t=>e===t.stateName&&r===t.callback));-1!==t&&c.current.splice(t)}},i=e=>{const r=t.current[e];if(r)return r},f=(e,r)=>(c.current.push({callback:r,stateName:e}),{detach:()=>u(e,r)});Liferay.component(e)||Liferay.component(e,{detach:u,get:i,on:f},{destroyOnNavigate:!0});(0,n.useEffect)((()=>{t.current=o({},r)}),[r]),(0,n.useEffect)((()=>{const e=[];Object.entries(r).forEach((([r,t])=>{t!==a.current[r]&&e.push(r)})),c.current.forEach((({callback:t,stateName:n})=>{e.includes(n)&&t({newValue:r[n],previousValue:a.current[n]})})),a.current=o({},r)}),[r])};var n=t("liferay!frontend-js-react-web$react");function c(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?c(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):c(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}}}));
//# sourceMappingURL=useRegistry.js.map