Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.130/page_editor/app/components/LayoutBreadcrumbs",["module","exports","require","@frontend-taglib-clay$clayui/breadcrumb","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$react","../config/constants/itemActivationOrigins","../config/constants/itemTypes","../config/constants/layoutDataItemTypes","../contexts/ControlsContext","../contexts/GlobalContext","../contexts/StoreContext","../selectors/selectLayoutDataItemLabel","../utils/checkDeepEqual"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.LayoutBreadcrumbs=function(){const t=(0,a.useMemo)((()=>document.getElementById("wrapper")),[]),n=function(){const t=(0,s.useActiveItemId)(),n=(0,s.useActiveItemType)(),o=(0,u.useGlobalContext)(),r=(0,s.useSelectItem)();return(0,d.useSelectorCallback)((o=>{const a=[],s=t=>{if(t&&t.type!==i.LAYOUT_DATA_ITEM_TYPES.root){if(t.type===i.LAYOUT_DATA_ITEM_TYPES.fragmentDropZone){var n;const o=null===(n=document.querySelector('[uuid="'.concat(t.itemId,'"]')))||void 0===n?void 0:n.getAttribute("data-lfr-drop-zone-id");a.push({label:o?"".concat(e," ").concat(o):e})}else t.type!==i.LAYOUT_DATA_ITEM_TYPES.column&&t.type!==i.LAYOUT_DATA_ITEM_TYPES.collectionItem&&a.push({label:(0,f.default)(o,t),onClick:()=>r(t.itemId,{itemType:l.ITEM_TYPES.layoutDataItem,origin:c.ITEM_ACTIVATION_ORIGINS.breadcrumbs})});s(o.layoutData.items[t.parentId])}};if(n===l.ITEM_TYPES.layoutDataItem)s(o.layoutData.items[t]);else if(n===l.ITEM_TYPES.editable){const[,e,n]=t.match(/^([^-]+)-([^\n]+)$/);a.push({label:n,onClick:()=>r(t,{itemType:l.ITEM_TYPES.editable,origin:c.ITEM_ACTIVATION_ORIGINS.breadcrumbs})});const u=Object.values(o.layoutData.items).find((t=>t.type===i.LAYOUT_DATA_ITEM_TYPES.fragment&&t.config.fragmentEntryLinkId===e));s(u)}if(a.reverse(),a.length){a[a.length-1].active=!0}return a}),[t,n,o,r],m.deepEqual)}(),p=(0,a.useRef)(null),y=function(e,t){const[n,o]=(0,a.useState)(0);return(0,a.useEffect)((()=>{o(0)}),[e]),(0,a.useEffect)((()=>{const r=t.current;if(0!==n)return;if(!e.length)return void o(1);if(!r)return void o(e.length);const a=r.cloneNode(!0),c=r.getBoundingClientRect();a.style.opacity="0",a.style.pointerEvents="none",a.style.height="".concat(c.height,"px"),a.style.width="".concat(c.width,"px");const l=()=>{if(!document.body.contains(a))return;const t=a.firstElementChild;if(t.clientWidth===t.scrollWidth){let t=a.querySelectorAll(".breadcrumb-item").length-b;t<=0&&(t=e.length),document.body.removeChild(a),o(t)}else{const t=a.querySelector(".breadcrumb-item");t?(t.parentElement.removeChild(t),requestAnimationFrame(l)):(document.body.removeChild(a),o(e.length))}};return document.body.appendChild(a),requestAnimationFrame(l),()=>{document.body.contains(a)&&document.body.removeChild(a)}}),[t,n,e.length]),n}(n,p);return(0,a.useEffect)((()=>{t&&(t.classList.add("page-editor__wrapper"),t.classList.toggle("page-editor__wrapper--padded-block-end",n.length))}),[t,n.length]),t&&n.length?a.default.createElement(r.ReactPortal,{container:t},a.default.createElement("div",{className:"bg-white border-top cadmin page-editor__layout-breadcrumbs position-fixed px-3",ref:p},a.default.createElement("div",{className:"overflow-auto",style:{opacity:y?1:0}},a.default.createElement(o.default,{className:"py-1",ellipsisBuffer:y,items:n})))):null};var o=y(n("@frontend-taglib-clay$clayui/breadcrumb")),r=n("@liferay/frontend-js-react-web"),a=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=p();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var a=o?Object.getOwnPropertyDescriptor(e,r):null;a&&(a.get||a.set)?Object.defineProperty(n,r,a):n[r]=e[r]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),c=n("../config/constants/itemActivationOrigins"),l=n("../config/constants/itemTypes"),i=n("../config/constants/layoutDataItemTypes"),s=n("../contexts/ControlsContext"),u=n("../contexts/GlobalContext"),d=n("../contexts/StoreContext"),f=y(n("../selectors/selectLayoutDataItemLabel")),m=n("../utils/checkDeepEqual");function p(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return p=function(){return e},e}function y(e){return e&&e.__esModule?e:{default:e}}const e=Liferay.Language.get("drop-zone"),b=4}}));
//# sourceMappingURL=LayoutBreadcrumbs.js.map