"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),A=require("../_util/collapseMotion.js"),m=require("./TreeNode.js"),E=require("./contextTypes.js"),w=require("./props.js"),q=e.defineComponent({compatConfig:{MODE:3},name:"MotionTreeNode",inheritAttrs:!1,props:{...w.treeNodeProps,active:Boolean,motion:Object,motionNodes:{type:Array},onMotionStart:Function,onMotionEnd:Function,motionType:String},setup(t,{attrs:l,slots:u}){const i=e.shallowRef(!0),y=E.useInjectTreeContext(),c=e.shallowRef(!1),a=e.computed(()=>t.motion?t.motion:A.default()),r=(s,n)=>{n==="appear"?a.value?.onAfterEnter?.(s):n==="leave"&&a.value?.onAfterLeave?.(s),c.value||t.onMotionEnd(),c.value=!0};return e.watch(()=>t.motionNodes,()=>{t.motionNodes&&t.motionType==="hide"&&i.value&&e.nextTick(()=>{i.value=!1})},{immediate:!0,flush:"post"}),e.onMounted(()=>{t.motionNodes&&t.onMotionStart()}),e.onBeforeUnmount(()=>{t.motionNodes&&r()}),()=>{const{motion:s,motionNodes:n,motionType:N,active:d,eventKey:M,...h}=t;return n?e.createVNode(e.Transition,{...a.value,appear:N==="show",onAfterAppear:o=>r(o,"appear"),onAfterLeave:o=>r(o,"leave")},{default:()=>[e.withDirectives(e.createVNode("div",{class:`${y.value.prefixCls}-treenode-motion`},[n.map(o=>{const{data:{...f},title:p,key:v,isStart:T,isEnd:S}=o;return delete f.children,e.createVNode(m.default,{...f,title:p,active:d,data:o.data,key:v,eventKey:v,isStart:T,isEnd:S},u)})]),[[e.vShow,i.value]])]}):e.createVNode(m.default,{class:l.class,style:l.style,...h,active:d,eventKey:M},u)}}});exports.default=q;
