"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("lodash-unified"),g=require("vue"),m=require("../../item-group/helper.js");require("../../../utils/index.js");const h=require("./use-collapse-input-count.js"),S=require("../../../utils/is.js");function q(r,s){const a=new Set(r.map(e=>e.name)),d=new Map;for(const e of s){const n=String(m.getStringName(h.getTargetNode(e).props?.name));n&&a.has(n)&&d.set(n,e)}const i=new Set,o=[];for(const e of r){const n=d.get(e.name);n&&(o.push(n),i.add(n))}for(const e of s)i.has(e)||o.push(e);return o}const C=r=>{const s=g.ref(!1);let a=!1;const d=g.computed(o=>{const n=(r.value||[]).map(u=>{const t=h.getTargetNode(u).props;return{label:t.description||t.label||t.placeholder,name:m.getStringName(t.name),isHidden:v.isBoolean(t.hidden)?!!t.hidden:S.isDef(t.hidden)}});if(!o?.length||a)return a=!1,n;const f=new Map(o.map((u,c)=>[u.name,c])),p=[...n].sort((u,c)=>{const t=f.get(u.name),l=f.get(c.name);return t===void 0&&l===void 0?0:t===void 0?1:l===void 0?-1:t-l});return i(p),p});function i(o){const e=q(o||[],r.value||[]);a=!0,s.value=!0,r.value=e}return{items:d,handleClickConfirm:i,sorted:s}};exports.useSorter=C;
