import{unref as t,isRef as e,isReadonly as n,mergeProps as o}from"vue";import{merge as r}from"smob";const u={};function c(t,e){u[t]=e}function s(t){return u[t]}function i(t,e){c(e||"defaults",t)}function f(t){const e=s(t||"defaults");return void 0===e?{}:e}function l(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function p(t,e={}){return l(e,t)}function a(t,e={},n={}){return l(n,t)?n[t](e):[]}function y(t){return"object"==typeof t&&null!==t&&(t instanceof Promise||"function"==typeof t.then)}function v(t,e){if("object"!=typeof t)return;const n=Object.keys(e);for(let o=0;o<n.length;o++)if(Object.prototype.hasOwnProperty.call(t,n[o])){e[n[o]]=t[n[o]]}}function b(e,n){const o=t(e);return void 0===o?n:o}function d(t,o){return e(t)?n(t)||(t.value=o):t=o,t}function j(t,n){return e(t)?t.value.push(n):t.push(n),n}function O(t,n,o){return e(t)?t.value.splice(n,o):t.splice(n,o),t}function h(t,n){return e(t)?t.value[n]:t[n]}function m(t,n,o){const r=h(t,n),u=Object.keys(o);for(let o=0;o<u.length;o++)e(t)?t.value[n][u[o]]=r[u[o]]:t[n][u[o]]=r[u[o]]}function k(t,n){return e(t)?t.value.findIndex(n):t.findIndex(n)}function w(t){const e={},n=Object.keys(t);for(let o=0;o<n.length;o++){const r=Object.keys(t[n[o]]);for(let u=0;u<r.length;u++){Object.prototype.hasOwnProperty.call(e,r[u])||(e[r[u]]={});const c=Object.keys(t[n[o]][r[u]]);for(let s=0;s<c.length;s++)Object.prototype.hasOwnProperty.call(e[r[u]],c[s])||(e[r[u]][c[s]]={}),e[r[u]][c[s]][n[o]]=t[n[o]][r[u]][c[s]]}}return e}function g(t,e){c(e||"presets",w(t))}function x(t,e,n){const o=w({[t]:e}),u=P(n);c(n||"presets",r(u,o))}function P(t){const e=s(t||"presets");return void 0===e?{}:e}function A(t,e,n){const o=P(n);return l(o,t)&&l(o[t],e)?o[t][e]:{}}function C(t,e,n){const{[t]:o}=f(n);if("object"==typeof o&&l(o,e))return o[e]}function K(t){return-1!==t.toLowerCase().indexOf("class")}function L(t){return-1!==t.toLowerCase().indexOf("style")}function I(t){return t.startsWith("on")}function $(t){return-1!==t.toLowerCase().indexOf("props")}function q(t){return K(t)||L(t)||I(t)||$(t)}function E(t,e,n){if(void 0===e)return n;if(void 0===n)return e;if(K(t)){const{class:t}=o({class:e},{class:n});return t}if(L(t)){const{style:t}=o({style:e},{style:n});return t}if(I(t)){const{[t]:r}=o({[t]:e},{[t]:n});return r}return $(t)?o(e,n):e??n}function F(t){return t&&"object"==typeof t&&!Array.isArray(t)}function W(t,e,n){return q(t)?E(t,e,n):F(e)&&F(n)?r(e,n):e??n}function z(t){if("object"!=typeof t||null===t)return!1;if(!l(t,"presets")||!l(t,"value"))return!1;if("object"!=typeof t.presets||null===t.presets)return!1;const e=Object.keys(t.presets);for(let n=0;n<e.length;n++)if(!l(t.presets,e[n])||"boolean"!=typeof t.presets[e[n]])return!1;return!0}function B(t){return z(t)?t.value:t}function D(e){let n;const o={};if(z(e.value)){if(n=t(e.value.value),e.value.presets){const t=Object.keys(e.value.presets);for(let n=0;n<t.length;n++)o[t[n]]=e.value.presets[t[n]]}}else n=t(e.value);const{components:r,presets:u}=e.injectionKeys||{},c=C(e.component,e.key,r);if(void 0===n&&(n=c),void 0===n&&(n=e.alt),void 0===n)return;const s=A(e.component,e.key,u),i=Object.keys(s);for(let t=0;t<i.length;t++)l(o,i[t])&&!o[i[t]]||(n=W(e.key,n,s[i[t]]));return n}function G(t){const e=D(t);if(void 0===e)throw new Error(`A value for option ${t.key} of component ${t.component} is required.`);return e}function H(t,e){return{build:n=>D({...n,component:t,...e?{injectionKeys:e}:{}}),buildOrFail:n=>G({...n,component:t,...e?{injectionKeys:e}:{}})}}export{D as buildOptionValue,G as buildOptionValueOrFail,H as createOptionValueBuilderForComponent,m as extendMaybeRefArrayValue,B as extractValueFromOptionValueInput,k as findIndexOfMaybeRefArray,C as getGlobalComponentOptionValue,A as getGlobalPresetsOptionValue,h as getMaybeRefArrayValue,p as hasNormalizedSlot,l as hasOwnProperty,v as initPropertiesFromSource,s as inject,z as isOptionValueConfig,y as isPromise,K as isVNodeClassOption,I as isVNodeListenerOption,q as isVNodeOption,$ as isVNodePropsOption,L as isVNodeStyleOption,W as mergeOption,E as mergeVNodeOption,a as normalizeSlot,c as provide,j as pushMaybeRefArrayValue,i as setDefaults,d as setMaybeRefValue,x as setPreset,g as setPresets,O as spliceMaybeRefArray,w as transformPresetsInput,b as unrefWithDefault,f as useDefaults,P as usePresets};
//# sourceMappingURL=index.mjs.map
