Liferay.Loader.define("@liferay/search-experiences-web@3.0.7/sxp_blueprint_admin/js/edit_sxp_blueprint/preview_sidebar/PreviewAttributesModal",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=f(a("@frontend-taglib-clay$clayui/button")),r=d(a("@frontend-taglib-clay$clayui/form")),n=f(a("@frontend-taglib-clay$clayui/icon")),u=d(a("@frontend-taglib-clay$clayui/modal")),o=(f(a("liferay!frontend-js-react-web$prop-types")),d(a("liferay!frontend-js-react-web$react")));function c(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return c=function(){return e},e}function d(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=l?Object.getOwnPropertyDescriptor(e,r):null;n&&(n.get||n.set)?Object.defineProperty(a,r,n):a[r]=e[r]}return a.default=e,t&&t.set(e,a),a}function f(e){return e&&e.__esModule?e:{default:e}}const e=({id:e,onChange:t=(()=>{}),onDelete:a=(()=>{}),showLabels:u=!1,valueObject:c={key:"",value:""}})=>{const{key:d,value:f}=c;return o.default.createElement(r.default.Group,{className:"key-value-row"},o.default.createElement(r.ClayInput.Group,null,o.default.createElement(r.ClayInput.GroupItem,null,u&&o.default.createElement("label",{htmlFor:"key-".concat(e)},Liferay.Language.get("key")),o.default.createElement(r.ClayInput,{id:"key-".concat(e),onChange:({target:{value:e}})=>t({key:e,value:f}),type:"text",value:d})),o.default.createElement(r.ClayInput.GroupItem,null,u&&o.default.createElement("label",{htmlFor:"value-".concat(e)},Liferay.Language.get("value")),o.default.createElement(r.ClayInput,{id:"value-".concat(e),onChange:({target:{value:e}})=>t({key:d,value:e}),type:"text",value:f})),o.default.createElement(r.ClayInput.GroupItem,{className:"delete-button-input-group-item",shrink:!0},o.default.createElement(l.default,{"aria-label":Liferay.Language.get("delete"),borderless:!0,displayType:"secondary",monospaced:!0,onClick:a},o.default.createElement(n.default,{symbol:"times-circle"})))))};var i=({children:t,title:a=Liferay.Language.get("attributes"),description:c,onSubmit:d=(()=>{})})=>{const[f,i]=(0,o.useState)([{key:"",value:""}]),[y,s]=(0,o.useState)(!1),{observer:p,onClose:m}=(0,u.useModal)({onClose:()=>s(!1)});return o.default.createElement(o.default.Fragment,null,y&&o.default.createElement(u.default,{className:"preview-attributes-modal",observer:p,size:"md"},o.default.createElement(u.default.Header,null,a),o.default.createElement(u.default.Body,null,c&&o.default.createElement("p",{className:"text-secondary"},c),f.map(((t,a)=>o.default.createElement(e,{id:a,key:a,onChange:e=>((e,t)=>{i(f.map(((a,l)=>e===l?t:a)))})(a,e),onDelete:()=>i(f.filter(((e,t)=>a!==t))),showLabels:0===a,valueObject:t}))),o.default.createElement(r.default.Group,null,o.default.createElement(l.default.Group,{spaced:!0},o.default.createElement(l.default,{"aria-label":Liferay.Language.get("add-field"),displayType:"secondary",monospaced:!0,onClick:()=>{i([...f,{key:"",value:""}])}},o.default.createElement(n.default,{symbol:"plus"}))))),o.default.createElement(u.default.Footer,{last:o.default.createElement(l.default.Group,{spaced:!0},o.default.createElement(l.default,{displayType:"secondary",onClick:m},Liferay.Language.get("cancel")),o.default.createElement(l.default,{displayType:"primary",onClick:()=>{d(f),m()}},Liferay.Language.get("done")))})),o.default.createElement("span",{onClick:()=>s(!y)},t))};t.default=i}}));
//# sourceMappingURL=PreviewAttributesModal.js.map