Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/plugins/browser/components/page-structure/components/item-configuration-panels/EditableLinkPanel",["module","exports","require","liferay!frontend-js-react-web$react","../../../../../../app/components/fragment-configuration-fields/LinkField","../../../../../../app/config/constants/editableFragmentEntryProcessor","../../../../../../app/config/constants/editableTypes","../../../../../../app/contexts/StoreContext","../../../../../../app/selectors/selectEditableValue","../../../../../../app/selectors/selectEditableValues","../../../../../../app/thunks/updateEditableValues","../../../../../../app/utils/checkDeepEqual","../../../../../../app/utils/editable-value/isMapped","../../../../../../app/utils/getEditableLinkValue","../../../../../../prop-types/index"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({item:e}){const t=(0,o.useDispatch)(),n=(0,o.useSelector)((e=>e.languageId)),b=(0,o.useSelectorCallback)((t=>(0,u.default)(t,e.fragmentEntryLinkId)),[e.fragmentEntryLinkId]),g=(0,o.useSelectorCallback)((t=>(0,p.default)(t,e.fragmentEntryLinkId,e.editableId,i.EDITABLE_FRAGMENT_ENTRY_PROCESSOR)||{}),[e.fragmentEntryLinkId,e.editableId],s.deepEqual),[y,O]=(0,r.useState)({}),[m,k]=(0,r.useState)({href:"",target:""}),[j,P]=(0,r.useState)({});return(0,r.useEffect)((()=>{const e=E({},g.config||{});Object.keys(e).length?(P({alt:e.alt||"",imageConfiguration:e.imageConfiguration||{}}),delete e.alt,delete e.imageConfiguration,O(e),k((0,d.getEditableLinkValue)(e,n))):(P({}),O({}),k({href:"",target:""}))}),[g.config,n]),r.default.createElement(a.default,{field:{name:"link"},onValueSelect:(r,a)=>{let o;(0,f.default)(a)||(0,f.default)(y)?o=E(E({},j),a):(o=E(E({},j),y||{}),Object.keys(a).length&&(o=E(E({},o),{},{href:E(E({},y.href||{}),{},{[n]:a.href}),target:a.target||""}))),e.type!==l.EDITABLE_TYPES.link&&(o.mapperType="link"),t((0,c.default)({editableValues:E(E({},b),{},{[i.EDITABLE_FRAGMENT_ENTRY_PROCESSOR]:E(E({},b[i.EDITABLE_FRAGMENT_ENTRY_PROCESSOR]),{},{[e.editableId]:E(E({},g),{},{config:o})})}),fragmentEntryLinkId:e.fragmentEntryLinkId}))},value:m})};var r=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=g();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var i=r?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(n,a,i):n[a]=e[a]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),a=b(n("../../../../../../app/components/fragment-configuration-fields/LinkField")),i=n("../../../../../../app/config/constants/editableFragmentEntryProcessor"),l=n("../../../../../../app/config/constants/editableTypes"),o=n("../../../../../../app/contexts/StoreContext"),p=b(n("../../../../../../app/selectors/selectEditableValue")),u=b(n("../../../../../../app/selectors/selectEditableValues")),c=b(n("../../../../../../app/thunks/updateEditableValues")),s=n("../../../../../../app/utils/checkDeepEqual"),f=b(n("../../../../../../app/utils/editable-value/isMapped")),d=n("../../../../../../app/utils/getEditableLinkValue");n("../../../../../../prop-types/index");function b(e){return e&&e.__esModule?e:{default:e}}function g(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return g=function(){return e},e}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){O(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}}}));
//# sourceMappingURL=EditableLinkPanel.js.map