Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.145/page_editor/app/utils/convertRGBtoHex",["module","exports","require"],(function(t,e,r){window;{function _wrapRegExp(t,e){_wrapRegExp=function _wrapRegExp(t,e){return new BabelRegExp(t,void 0,e)};var r=_wrapNativeSuper(RegExp),o=RegExp.prototype,n=new WeakMap;function BabelRegExp(t,e,o){var p=r.call(this,t,e);return n.set(p,o||n.get(t)),p}function buildGroups(t,e){var r=n.get(e);return Object.keys(r).reduce((function(e,o){return e[o]=t[r[o]],e}),Object.create(null))}return _inherits(BabelRegExp,r),BabelRegExp.prototype.exec=function(t){var e=o.exec.call(this,t);return e&&(e.groups=buildGroups(e,this)),e},BabelRegExp.prototype[Symbol.replace]=function(t,e){if("string"==typeof e){var r=n.get(this);return o[Symbol.replace].call(this,t,e.replace(/\$<([^>]+)>/g,(function(t,e){return"$"+r[e]})))}if("function"==typeof e){var p=this;return o[Symbol.replace].call(this,t,(function(){var t=[];return t.push.apply(t,arguments),"object"!=typeof t[t.length-1]&&t.push(buildGroups(t,p)),e.apply(this,t)}))}return o[Symbol.replace].call(this,t,e)},_wrapRegExp.apply(this,arguments)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _wrapNativeSuper(t){var e="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!function _isNativeFunction(t){return-1!==Function.toString.call(t).indexOf("[native code]")}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,Wrapper)}function Wrapper(){return _construct(t,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,t)})(t)}function isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function _construct(t,e,r){return(_construct=isNativeReflectConstruct()?Reflect.construct:function _construct(t,e,r){var o=[null];o.push.apply(o,e);var n=new(Function.bind.apply(t,o));return r&&_setPrototypeOf(n,r.prototype),n}).apply(null,arguments)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,e){return t.__proto__=e,t})(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.convertRGBtoHex=function convertRGBtoHex(e){var o,n;const p=(null===(o=e.match(t))||void 0===o?void 0:o.groups)||(null===(n=e.match(r))||void 0===n?void 0:n.groups)||{},u=parseFloat(p.alpha),c=parseInt(p.blue,10),a=parseInt(p.green,10),i=parseInt(p.red,10);if(isNaN(c)||isNaN(a)||isNaN(i))return e;const l=[i,a,c].map((t=>t.toString(16).padStart(2,"0").toUpperCase())).join("");if(isNaN(u))return"#".concat(l);return"#".concat(l).concat(parseInt("".concat(255*u),10).toString(16).padStart(2,"0").toUpperCase())};const t=_wrapRegExp(/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)/,{red:1,green:2,blue:3}),r=_wrapRegExp(/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((1|0(\.\d+)?))\)/,{red:1,green:2,blue:3,alpha:4})}}));
//# sourceMappingURL=convertRGBtoHex.js.map