Liferay.Loader.define("layout-seo-web@2.0.47/js/seo/display_page_templates/components/MappingInput",["module","exports","require","@frontend-taglib-clay$clayui/form","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./MappingPanel"],(function(e,t,r){var n;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=i(r("@frontend-taglib-clay$clayui/form")),l=r("@liferay/frontend-js-react-web"),o=(r("liferay!frontend-js-react-web$prop-types"),i(r("liferay!frontend-js-react-web$react"))),c=(n=r("./MappingPanel"))&&n.__esModule?n:{default:n};function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function i(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var l=n?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(r,a,l):r[a]=e[a]}return r.default=e,t&&t.set(e,r),r}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const e=e=>e.replace(/}|[\r\n]+/gm,""),y=(t,r)=>" ${".concat(t,":").concat(e(r),"} ");var d=function({component:e,fieldType:t,fields:r,helpMessage:n,label:u,name:i,selectedSource:f,value:p}){const[d,b]=(0,o.useState)(f),[m,O]=(0,o.useState)(p||""),j=(0,o.useRef)(null),g=(0,l.useIsMounted)(),w=!!m.trim(),v=f?f.classTypeLabel||f.classNameLabel:"";return o.default.createElement(a.default.Group,null,o.default.createElement("label",{className:"control-label",htmlFor:i},u),o.default.createElement(a.ClayInput.Group,null,o.default.createElement(a.ClayInput.GroupItem,null,o.default.createElement(a.ClayInput,{component:e,id:i,name:i,onChange:e=>{O(e.target.value)},ref:j,value:m})),o.default.createElement(a.ClayInput.GroupItem,{shrink:!0},o.default.createElement(c.default,{clearSelectionOnClose:!0,fieldType:t,fields:r,isActive:w,name:i,onSelect:({field:e,source:t})=>{b(t),(({key:e,label:t})=>{const r=j.current.selectionStart,n=j.current.selectionEnd,a=y(e,t);O((e=>"".concat(e.slice(0,r)).concat(a).concat(e.slice(n)).trim())),setTimeout((()=>{g()&&(j.current.selectionStart=j.current.selectionEnd=r+a.length,j.current.focus())}),100)})(e)},source:s(s({},d),{},{initialValue:v})}))),n&&o.default.createElement(a.default.Text,null,n))};t.default=d}}));
//# sourceMappingURL=MappingInput.js.map