Liferay.Loader.define("style-book-web@2.0.76/js/style-book-editor/FrontendTokenSet",["module","exports","require","@liferay/layout-content-page-editor-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./constants/frontendTokenTypes","./contexts/StyleBookEditorContext","./frontend_tokens/BooleanFrontendToken","./frontend_tokens/ColorFrontendToken","./frontend_tokens/LengthFrontendToken","./frontend_tokens/SelectFrontendToken","./frontend_tokens/TextFrontendToken"],(function(e,n,t){window;{Object.defineProperty(n,"__esModule",{value:!0}),n.default=function FrontendTokenSet({frontendTokens:e,label:n,open:t,tokenValues:c}){const p=(0,l.useFrontendTokensValues)(),k=(0,l.useSaveTokenValue)(),y=(0,r.useCallback)(((e,n)=>{const{mappings:t=[],label:o,name:r}=e,a=t.find((e=>"cssVariable"===e.type));var l,u;n&&k({label:o,name:r,value:{cssVariableMapping:a.value,name:null===(l=c[n])||void 0===l?void 0:l.name,value:(null===(u=c[n])||void 0===u?void 0:u.value)||n}})}),[k,c]);return r.default.createElement(o.Collapse,{label:n,open:t},e.map((e=>{var n,t;const o=function getFrontendTokenComponent(e){if("ColorPicker"===e.editorType)return i.default;if("Length"===e.editorType)return d.default;if(e.validValues)return f.default;if(e.type===a.FRONTEND_TOKEN_TYPES.boolean)return u.default;return s.default}(e),l={frontendToken:e,frontendTokensValues:p,onValueSelect:n=>y(e,n),tokenValues:c,value:(null===(n=p[e.name])||void 0===n?void 0:n.name)||(null===(t=p[e.name])||void 0===t?void 0:t.value)||e.defaultValue};return r.default.createElement(o,_extends({key:e.name},l))})))};var o=t("@liferay/layout-content-page-editor-web"),r=(_interopRequireDefault(t("liferay!frontend-js-react-web$prop-types")),function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache();if(n&&n.has(e))return n.get(e);var t={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var a=o?Object.getOwnPropertyDescriptor(e,r):null;a&&(a.get||a.set)?Object.defineProperty(t,r,a):t[r]=e[r]}t.default=e,n&&n.set(e,t);return t}(t("liferay!frontend-js-react-web$react"))),a=t("./constants/frontendTokenTypes"),l=t("./contexts/StyleBookEditorContext"),u=_interopRequireDefault(t("./frontend_tokens/BooleanFrontendToken")),i=_interopRequireDefault(t("./frontend_tokens/ColorFrontendToken")),d=_interopRequireDefault(t("./frontend_tokens/LengthFrontendToken")),f=_interopRequireDefault(t("./frontend_tokens/SelectFrontendToken")),s=_interopRequireDefault(t("./frontend_tokens/TextFrontendToken"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _extends(){return(_extends=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}).apply(this,arguments)}}}));
//# sourceMappingURL=FrontendTokenSet.js.map