/*!
 * KoliBri - The accessible HTML-Standard
 */
"use strict";var common=require("./common-Cd2qH809.js");const mapCustomIcon=(o,t,n)=>{common.isObject(n)?o[t]=n:common.isString(n,1)&&(o[t]={icon:n})},mapIconProp2State=o=>{let t={};return common.isString(o,1)?t={left:{icon:o}}:"object"==typeof o&&null!==o&&(mapCustomIcon(t,"top",o.top),mapCustomIcon(t,"right",o.right),mapCustomIcon(t,"bottom",o.bottom),mapCustomIcon(t,"left",o.left)),t},beforePatchIcon=o=>{var t,n,c;if(null===(t=o.nextState)||void 0===t?void 0:t.has("_icons")){const t=null===(n=o.nextState)||void 0===n?void 0:n.get("_icons");null===(c=o.nextState)||void 0===c||c.set("_icons",mapIconProp2State(t))}},isIcon=o=>"object"==typeof o&&null!==o&&(void 0===o.style||common.isStyle(o.style))&&(void 0===o.label||common.isString(o.label))&&common.isString(o.icon,1),validateIcons=(o,t,n={})=>{common.objectObjectHandler(t,()=>{var c;try{t=common.parseJson(t)}catch(o){}common.watchValidator(o,"_icons",o=>{const t="object"==typeof o&&null!==o&&0===Object.keys(o).length;return null===o||t||common.isString(o,1)||"object"==typeof o&&null!==o&&(common.isString(o.left,0)||isIcon(o.left)||common.isString(o.right,0)||isIcon(o.right)||common.isString(o.top,0)||isIcon(o.top)||common.isString(o.bottom,0)||isIcon(o.bottom))},new Set(["KoliBriIcon"]),t,Object.assign(Object.assign({},n),{defaultValue:{},hooks:{afterPatch:null===(c=n.hooks)||void 0===c?void 0:c.afterPatch,beforePatch:(o,t,c,e)=>{var i,s;"function"==typeof(null===(i=n.hooks)||void 0===i?void 0:i.beforePatch)&&(null===(s=n.hooks)||void 0===s||s.beforePatch(o,t,c,e)),beforePatchIcon(c)}}}))})};exports.validateIcons=validateIcons;