import{Fragment as l,Comment as c,Text as y,isVNode as u}from"vue";import a from"../classNames.mjs";import v from"../isValid.mjs";import{hyphenate as A,camelize as m,resolvePropValue as d,isOn as E}from"../util.mjs";const $=t=>{const e=Object.keys(t),o={},s={},r={};for(let n=0,i=e.length;n<i;n++){const p=e[n];E(p)?(o[p[2].toLowerCase()+p.slice(3)]=t[p],s[p]=t[p]):r[p]=t[p]}return{onEvents:s,events:o,extraAttrs:r}},b=(t="",e=!1)=>{const o={},s=/;(?![^(]*\))/g,r=/:(.+)/;return typeof t=="object"?t:(t.split(s).forEach(n=>{if(n){const i=n.split(r);if(i.length>1){const p=e?m(i[0].trim()):i[0].trim();o[p]=i[1].trim()}}}),o)},P=(t,e)=>t[e]!==void 0,C=Symbol("skipFlatten"),f=(t=[],e=!0)=>{const o=Array.isArray(t)?t:[t],s=[];return o.forEach(r=>{Array.isArray(r)?s.push(...f(r,e)):r&&r.type===l?r.key===C?s.push(r):s.push(...f(r.children,e)):r&&u(r)?e&&!g(r)?s.push(r):e||s.push(r):v(r)&&s.push(r)}),s},V=(t,e="default",o={})=>{if(u(t))return t.type===l?e==="default"?f(t.children):[]:t.children&&t.children[e]?f(t.children[e](o)):[];{const s=t.$slots[e]&&t.$slots[e](o);return f(s)}},F=t=>{let e=t?.vnode?.el||t&&(t.$el||t);for(;e&&!e.tagName;)e=e.nextSibling;return e},k=t=>{const e={};if(t.$&&t.$.vnode){const o=t.$.vnode.props||{};Object.keys(t.$props).forEach(s=>{const r=t.$props[s],n=A(s);(r!==void 0||n in o)&&(e[s]=r)})}else if(u(t)&&typeof t.type=="object"){const o=t.props||{},s={};Object.keys(o).forEach(n=>{s[m(n)]=o[n]});const r=t.type.props||{};Object.keys(r).forEach(n=>{const i=d(r,s,n,s[n]);(i!==void 0||n in s)&&(e[n]=i)})}return e},D=(t,e="default",o=t,s=!0)=>{let r;if(t.$){const n=t[e];if(n!==void 0)return typeof n=="function"&&s?n(o):n;r=t.$slots[e],r=s&&r?r(o):r}else if(u(t)){const n=t.props&&t.props[e];if(n!==void 0&&t.props!==null)return typeof n=="function"&&s?n(o):n;t.type===l?r=t.children:t.children&&t.children[e]&&(r=t.children[e],r=s&&r?r(o):r)}return Array.isArray(r)&&(r=f(r),r=r.length===1?r[0]:r,r=r.length===0?void 0:r),r};function _(t={},e=!0){let o={};return t.$?o={...o,...t.$attrs}:o={...o,...t.props},$(o)[e?"onEvents":"events"]}function w(t){const o=((u(t)?t.props:t.$attrs)||{}).class||{};let s={};return typeof o=="string"?o.split(" ").forEach(r=>{s[r.trim()]=!0}):Array.isArray(o)?a(o).split(" ").forEach(r=>{s[r.trim()]=!0}):s={...s,...o},s}function K(t,e){let s=((u(t)?t.props:t.$attrs)||{}).style||{};return typeof s=="string"&&(s=b(s,e)),s}function z(t){return t.length===1&&t[0].type===l}function L(t){return t==null||t===""||Array.isArray(t)&&t.length===0}function g(t){return t&&(t.type===c||t.type===l&&t.children.length===0||t.type===y&&t.children.trim()==="")}function M(t){return t&&t.type===y}function h(t=[]){const e=[];return t.forEach(o=>{Array.isArray(o)?e.push(...o):o?.type===l?e.push(...h(o.children)):e.push(o)}),e.filter(o=>!g(o))}function U(t){if(t){const e=h(t);return e.length?e:void 0}else return t}function W(t){return Array.isArray(t)&&t.length===1&&(t=t[0]),t&&t.__v_isVNode&&typeof t.type!="symbol"}function q(t,e,o="default"){return e[o]??t[o]?.()}export{m as camelize,h as filterEmpty,U as filterEmptyWithUndefined,F as findDOMNode,f as flattenChildren,w as getClass,D as getComponent,_ as getEvents,k as getOptionProps,q as getPropsSlot,V as getSlot,K as getStyle,P as hasProp,L as isEmptyContent,g as isEmptyElement,z as isFragment,M as isStringElement,W as isValidElement,b as parseStyleText,C as skipFlattenKey,$ as splitAttrs};
