Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/app/components/fragment-configuration-fields/HideFragmentField",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../core/hooks/useControlledState","../../../prop-types/index","../../config/constants/viewportSizes","../../contexts/ControlsContext","../../contexts/StoreContext","../../utils/getFormErrorDescription","../../utils/getResponsiveConfig","../../utils/useHasRequiredChild","../layout-data-items/hasDropZoneChild"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.HideFragmentField=function({disabled:e,field:t,item:n,onValueSelect:f,title:y,value:m}){var b;const C=(0,d.useSelector)((e=>e.layoutData)),v=(0,d.useSelector)((e=>e.selectedViewportSize)),w=(0,p.default)(n.itemId),_=(0,c.useSelectItem)(),[k,x]=(0,i.default)(m||!1),E=null===(b=t.typeOptions)||void 0===b?void 0:b.customValues,j=h(C,n,v);return l.default.createElement(l.default.Fragment,null,l.default.createElement(a.default.Group,{className:"mb-0 mt-1"},l.default.createElement("div",{className:"align-items-center d-flex justify-content-between page-editor__sidebar__fieldset__field-checkbox","data-tooltip-align":"bottom",title:y},l.default.createElement(a.ClayCheckbox,{"aria-label":t.label,checked:E?k===E.checked:k,containerProps:{className:"mb-0"},disabled:Boolean(j)||(0,g.default)(n,C)||e,label:t.label,onChange:e=>{let n=e.target.checked;if(E&&(n=n?E.checked:E.unchecked),x(n),f(t.name,n),n&&w()){const{message:e}=(0,u.getFormErrorDescription)({type:u.FORM_ERROR_TYPES.hiddenFragment});(0,r.openToast)({message:e,type:"warning"})}}}),t.responsive&&v!==s.VIEWPORT_SIZES.desktop&&l.default.createElement(o.ClayButtonWithIcon,{"data-tooltip-align":"bottom",displayType:"secondary",onClick:()=>{f(t.name,null)},small:!0,symbol:"restore",title:Liferay.Language.get("restore-default")}))),j&&l.default.createElement(l.default.Fragment,null,l.default.createElement("p",{className:"m-0 small text-secondary"},Liferay.Language.get("this-configuration-is-inherited")),l.default.createElement(o.default,{className:"p-0 page-editor__hide-feedback-button text-left",displayType:"link",onClick:()=>_(j)},Liferay.Language.get("go-to-parent-fragment-to-edit"))))};var o=b(n("@frontend-taglib-clay$clayui/button")),a=b(n("@frontend-taglib-clay$clayui/form")),r=n("frontend-js-web"),l=(y(n("liferay!frontend-js-react-web$prop-types")),y(n("liferay!frontend-js-react-web$react"))),i=y(n("../../../core/hooks/useControlledState")),s=(n("../../../prop-types/index"),n("../../config/constants/viewportSizes")),c=n("../../contexts/ControlsContext"),d=n("../../contexts/StoreContext"),u=n("../../utils/getFormErrorDescription"),f=n("../../utils/getResponsiveConfig"),p=y(n("../../utils/useHasRequiredChild")),g=y(n("../layout-data-items/hasDropZoneChild"));function y(e){return e&&e.__esModule?e:{default:e}}function m(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return m=function(){return e},e}function b(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=m();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var r=o?Object.getOwnPropertyDescriptor(e,a):null;r&&(r.get||r.set)?Object.defineProperty(n,a,r):n[a]=e[a]}return n.default=e,t&&t.set(e,n),n}function h(e,t,n){const o=e.items[t.parentId];if(!o)return null;return"none"===(0,f.getResponsiveConfig)(o.config,n).styles.display?o.itemId:h(e,o)}}}));
//# sourceMappingURL=HideFragmentField.js.map