Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.145/page_editor/app/components/app-hooks/useURLParser",["module","exports","require","liferay!frontend-js-react-web$react","../../../core/hooks/useSessionState","../../actions/switchSidebarPanel","../../config/constants/highlightedCommentIdKey","../../contexts/ControlsContext","../../contexts/StoreContext","../../utils/getFragmentItem"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function useURLParser(){const e=(0,c.useSelector)((e=>e.fragmentEntryLinks)),[,t]=(0,o.useSessionState)(r.HIGHLIGHTED_COMMENT_ID_KEY),a=(0,c.useSelector)((e=>e.layoutData)),l=(0,c.useDispatch)(),f=(0,i.useSelectItem)(),u=(0,n.useCallback)((t=>{const{fragmentEntryLinkId:n}=Object.values(e).find((e=>e.comments.find((e=>e.commentId===t||e.children.find((e=>e.commentId===t))))))||{fragmentEntryLinkId:null},{itemId:o}=(0,d.default)(a,n)||{};o&&(f(o),l((0,s.default)({sidebarOpen:!0,sidebarPanelId:"comments"})))}),[l,e,a,f]);(0,n.useEffect)((()=>{const e=new URL(window.location.href);if(e.searchParams.has("messageId")){let a;t(e.searchParams.get("messageId")),u(e.searchParams.get("messageId")),e.searchParams.delete("messageId"),Liferay.SPA&&Liferay.SPA.app&&(a=Liferay.SPA.app.skipLoadPopstate,Liferay.SPA.app.skipLoadPopstate=!0),history.replaceState(null,document.head.title,e.href),requestAnimationFrame((()=>{Liferay.SPA&&Liferay.SPA.app&&"boolean"==typeof a&&(Liferay.SPA.app.skipLoadPopstate=a)}))}}),[u,t])};var n=a("liferay!frontend-js-react-web$react"),o=a("../../../core/hooks/useSessionState"),s=_interopRequireDefault(a("../../actions/switchSidebarPanel")),r=a("../../config/constants/highlightedCommentIdKey"),i=a("../../contexts/ControlsContext"),c=a("../../contexts/StoreContext"),d=_interopRequireDefault(a("../../utils/getFragmentItem"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=useURLParser.js.map