import{d as J,m as B,ci as ct,cj as bt,ah as b,ck as ge,cl as ft,cm as K,cn as pt,am as ut,aj as gt,az as Te,aP as vt,p as Y,co as ht,F as xt,aG as mt,cp as yt,cq as Ct,ar as n,aM as s,aq as T,aW as W,au as St,aA as wt,ai as Pe,aO as ve,cr as ee,aZ as Tt,q as te,aJ as Pt,av as G,cs as Rt,aL as zt,aN as M,cf as X,aB as Lt,cg as he,ch as xe,b0 as q,a$ as ae,i as $t,x as Bt,ct as Wt,cu as At}from"./index-d63aee15.js";import{A as _t}from"./Add-48fd5d48.js";import{o as Et}from"./omit-b0e7e098.js";const kt=ge(".v-x-scroll",{overflow:"auto",scrollbarWidth:"none"},[ge("&::-webkit-scrollbar",{width:0,height:0})]),Mt=J({name:"XScroll",props:{disabled:Boolean,onScroll:Function},setup(){const e=B(null);function r(d){!(d.currentTarget.offsetWidth<d.currentTarget.scrollWidth)||d.deltaY===0||(d.currentTarget.scrollLeft+=d.deltaY+d.deltaX,d.preventDefault())}const i=ct();return kt.mount({id:"vueuc/x-scroll",head:!0,anchorMetaName:bt,ssr:i}),Object.assign({selfRef:e,handleWheel:r},{scrollTo(...d){var m;(m=e.value)===null||m===void 0||m.scrollTo(...d)}})},render(){return b("div",{ref:"selfRef",onScroll:this.onScroll,onWheel:this.disabled?void 0:this.handleWheel,class:"v-x-scroll"},this.$slots)}});var Vt=/\s/;function jt(e){for(var r=e.length;r--&&Vt.test(e.charAt(r)););return r}var It=/^\s+/;function Gt(e){return e&&e.slice(0,jt(e)+1).replace(It,"")}var me=0/0,Ht=/^[-+]0x[0-9a-f]+$/i,Ft=/^0b[01]+$/i,Ot=/^0o[0-7]+$/i,Dt=parseInt;function ye(e){if(typeof e=="number")return e;if(ft(e))return me;if(K(e)){var r=typeof e.valueOf=="function"?e.valueOf():e;e=K(r)?r+"":r}if(typeof e!="string")return e===0?e:+e;e=Gt(e);var i=Ft.test(e);return i||Ot.test(e)?Dt(e.slice(2),i?2:8):Ht.test(e)?me:+e}var Nt=function(){return pt.Date.now()};const re=Nt;var Ut="Expected a function",Xt=Math.max,qt=Math.min;function Yt(e,r,i){var f,d,m,u,p,y,h=0,C=!1,S=!1,x=!0;if(typeof e!="function")throw new TypeError(Ut);r=ye(r)||0,K(i)&&(C=!!i.leading,S="maxWait"in i,m=S?Xt(ye(i.maxWait)||0,r):m,x="trailing"in i?!!i.trailing:x);function v(c){var L=f,V=d;return f=d=void 0,h=c,u=e.apply(V,L),u}function w(c){return h=c,p=setTimeout(A,r),C?v(c):u}function R(c){var L=c-y,V=c-h,I=r-L;return S?qt(I,m-V):I}function P(c){var L=c-y,V=c-h;return y===void 0||L>=r||L<0||S&&V>=m}function A(){var c=re();if(P(c))return z(c);p=setTimeout(A,R(c))}function z(c){return p=void 0,x&&f?v(c):(f=d=void 0,u)}function _(){p!==void 0&&clearTimeout(p),h=0,f=y=d=p=void 0}function k(){return p===void 0?u:z(re())}function g(){var c=re(),L=P(c);if(f=arguments,d=this,y=c,L){if(p===void 0)return w(y);if(S)return clearTimeout(p),p=setTimeout(A,r),v(y)}return p===void 0&&(p=setTimeout(A,r)),u}return g.cancel=_,g.flush=k,g}var Kt="Expected a function";function ne(e,r,i){var f=!0,d=!0;if(typeof e!="function")throw new TypeError(Kt);return K(i)&&(f="leading"in i?!!i.leading:f,d="trailing"in i?!!i.trailing:d),Yt(e,r,{leading:f,maxWait:r,trailing:d})}const Jt={tabFontSizeSmall:"14px",tabFontSizeMedium:"14px",tabFontSizeLarge:"16px",tabGapSmallLine:"36px",tabGapMediumLine:"36px",tabGapLargeLine:"36px",tabGapSmallLineVertical:"8px",tabGapMediumLineVertical:"8px",tabGapLargeLineVertical:"8px",tabPaddingSmallLine:"6px 0",tabPaddingMediumLine:"10px 0",tabPaddingLargeLine:"14px 0",tabPaddingVerticalSmallLine:"6px 12px",tabPaddingVerticalMediumLine:"8px 16px",tabPaddingVerticalLargeLine:"10px 20px",tabGapSmallBar:"36px",tabGapMediumBar:"36px",tabGapLargeBar:"36px",tabGapSmallBarVertical:"8px",tabGapMediumBarVertical:"8px",tabGapLargeBarVertical:"8px",tabPaddingSmallBar:"4px 0",tabPaddingMediumBar:"6px 0",tabPaddingLargeBar:"10px 0",tabPaddingVerticalSmallBar:"6px 12px",tabPaddingVerticalMediumBar:"8px 16px",tabPaddingVerticalLargeBar:"10px 20px",tabGapSmallCard:"4px",tabGapMediumCard:"4px",tabGapLargeCard:"4px",tabGapSmallCardVertical:"4px",tabGapMediumCardVertical:"4px",tabGapLargeCardVertical:"4px",tabPaddingSmallCard:"8px 16px",tabPaddingMediumCard:"10px 20px",tabPaddingLargeCard:"12px 24px",tabPaddingSmallSegment:"4px 0",tabPaddingMediumSegment:"6px 0",tabPaddingLargeSegment:"8px 0",tabPaddingVerticalLargeSegment:"0 8px",tabPaddingVerticalSmallCard:"8px 12px",tabPaddingVerticalMediumCard:"10px 16px",tabPaddingVerticalLargeCard:"12px 20px",tabPaddingVerticalSmallSegment:"0 4px",tabPaddingVerticalMediumSegment:"0 6px",tabGapSmallSegment:"0",tabGapMediumSegment:"0",tabGapLargeSegment:"0",tabGapSmallSegmentVertical:"0",tabGapMediumSegmentVertical:"0",tabGapLargeSegmentVertical:"0",panePaddingSmall:"8px 0 0 0",panePaddingMedium:"12px 0 0 0",panePaddingLarge:"16px 0 0 0",closeSize:"18px",closeIconSize:"14px"},Zt=e=>{const{textColor2:r,primaryColor:i,textColorDisabled:f,closeIconColor:d,closeIconColorHover:m,closeIconColorPressed:u,closeColorHover:p,closeColorPressed:y,tabColor:h,baseColor:C,dividerColor:S,fontWeight:x,textColor1:v,borderRadius:w,fontSize:R,fontWeightStrong:P}=e;return Object.assign(Object.assign({},Jt),{colorSegment:h,tabFontSizeCard:R,tabTextColorLine:v,tabTextColorActiveLine:i,tabTextColorHoverLine:i,tabTextColorDisabledLine:f,tabTextColorSegment:v,tabTextColorActiveSegment:r,tabTextColorHoverSegment:r,tabTextColorDisabledSegment:f,tabTextColorBar:v,tabTextColorActiveBar:i,tabTextColorHoverBar:i,tabTextColorDisabledBar:f,tabTextColorCard:v,tabTextColorHoverCard:v,tabTextColorActiveCard:i,tabTextColorDisabledCard:f,barColor:i,closeIconColor:d,closeIconColorHover:m,closeIconColorPressed:u,closeColorHover:p,closeColorPressed:y,closeBorderRadius:w,tabColor:h,tabColorSegment:C,tabBorderColor:S,tabFontWeightActive:x,tabFontWeight:x,tabBorderRadius:w,paneTextColor:r,fontWeightStrong:P})},Qt={name:"Tabs",common:ut,self:Zt},ea=Qt,se=gt("n-tabs"),Re={tab:[String,Number,Object,Function],name:{type:[String,Number],required:!0},disabled:Boolean,displayDirective:{type:String,default:"if"},closable:{type:Boolean,default:void 0},tabProps:Object,label:[String,Number,Object,Function]},sa=J({__TAB_PANE__:!0,name:"TabPane",alias:["TabPanel"],props:Re,setup(e){const r=Te(se,null);return r||vt("tab-pane","`n-tab-pane` must be placed inside `n-tabs`."),{style:r.paneStyleRef,class:r.paneClassRef,mergedClsPrefix:r.mergedClsPrefixRef}},render(){return b("div",{class:[`${this.mergedClsPrefix}-tab-pane`,this.class],style:this.style},this.$slots)}}),ta=Object.assign({internalLeftPadded:Boolean,internalAddable:Boolean,internalCreatedByPane:Boolean},Et(Re,["displayDirective"])),ie=J({__TAB__:!0,inheritAttrs:!1,name:"Tab",props:ta,setup(e){const{mergedClsPrefixRef:r,valueRef:i,typeRef:f,closableRef:d,tabStyleRef:m,tabChangeIdRef:u,onBeforeLeaveRef:p,triggerRef:y,handleAdd:h,activateTab:C,handleClose:S}=Te(se);return{trigger:y,mergedClosable:Y(()=>{if(e.internalAddable)return!1;const{closable:x}=e;return x===void 0?d.value:x}),style:m,clsPrefix:r,value:i,type:f,handleClose(x){x.stopPropagation(),!e.disabled&&S(e.name)},activateTab(){if(e.disabled)return;if(e.internalAddable){h();return}const{name:x}=e,v=++u.id;if(x!==i.value){const{value:w}=p;w?Promise.resolve(w(e.name,i.value)).then(R=>{R&&u.id===v&&C(x)}):C(x)}}}},render(){const{internalAddable:e,clsPrefix:r,name:i,disabled:f,label:d,tab:m,value:u,mergedClosable:p,style:y,trigger:h,$slots:{default:C}}=this,S=d??m;return b("div",{class:`${r}-tabs-tab-wrapper`},this.internalLeftPadded?b("div",{class:`${r}-tabs-tab-pad`}):null,b("div",Object.assign({key:i,"data-name":i,"data-disabled":f?!0:void 0},ht({class:[`${r}-tabs-tab`,u===i&&`${r}-tabs-tab--active`,f&&`${r}-tabs-tab--disabled`,p&&`${r}-tabs-tab--closable`,e&&`${r}-tabs-tab--addable`],onClick:h==="click"?this.activateTab:void 0,onMouseenter:h==="hover"?this.activateTab:void 0,style:e?void 0:y},this.internalCreatedByPane?this.tabProps||{}:this.$attrs)),b("span",{class:`${r}-tabs-tab__label`},e?b(xt,null,b("div",{class:`${r}-tabs-tab__height-placeholder`},"Â "),b(mt,{clsPrefix:r},{default:()=>b(_t,null)})):C?C():typeof S=="object"?S:yt(S??i)),p&&this.type==="card"?b(Ct,{clsPrefix:r,class:`${r}-tabs-tab__close`,onClick:this.handleClose,disabled:f}):null))}}),aa=n("tabs",` box-sizing: border-box; width: 100%; display: flex; flex-direction: column; transition: background-color .3s var(--n-bezier), border-color .3s var(--n-bezier); `,[s("segment-type",[n("tabs-rail",[T("&.transition-disabled","color: red;",[n("tabs-tab",` transition: none; `)])])]),s("top",[n("tab-pane",` padding: var(--n-pane-padding-top) var(--n-pane-padding-right) var(--n-pane-padding-bottom) var(--n-pane-padding-left); `)]),s("left",[n("tab-pane",` padding: var(--n-pane-padding-right) var(--n-pane-padding-bottom) var(--n-pane-padding-left) var(--n-pane-padding-top); `)]),s("left, right",` flex-direction: row; `,[n("tabs-bar",` width: 2px; right: 0; transition: top .2s var(--n-bezier), max-height .2s var(--n-bezier), background-color .3s var(--n-bezier); `),n("tabs-tab",` padding: var(--n-tab-padding-vertical); `)]),s("right",` flex-direction: row-reverse; `,[n("tab-pane",` padding: var(--n-pane-padding-left) var(--n-pane-padding-top) var(--n-pane-padding-right) var(--n-pane-padding-bottom); `),n("tabs-bar",` left: 0; `)]),s("bottom",` flex-direction: column-reverse; justify-content: flex-end; `,[n("tab-pane",` padding: var(--n-pane-padding-bottom) var(--n-pane-padding-right) var(--n-pane-padding-top) var(--n-pane-padding-left); `),n("tabs-bar",` top: 0; `)]),n("tabs-rail",` padding: 3px; border-radius: var(--n-tab-border-radius); width: 100%; background-color: var(--n-color-segment); transition: background-color .3s var(--n-bezier); display: flex; align-items: center; `,[n("tabs-tab-wrapper",` flex-basis: 0; flex-grow: 1; display: flex; align-items: center; justify-content: center; `,[n("tabs-tab",` overflow: hidden; border-radius: var(--n-tab-border-radius); width: 100%; display: flex; align-items: center; justify-content: center; `,[s("active",` font-weight: var(--n-font-weight-strong); color: var(--n-tab-text-color-active); background-color: var(--n-tab-color-segment); box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .08); `),T("&:hover",` color: var(--n-tab-text-color-hover); `)])])]),s("flex",[n("tabs-nav",{width:"100%"},[n("tabs-wrapper",{width:"100%"},[n("tabs-tab",{marginRight:0})])])]),n("tabs-nav",` box-sizing: border-box; line-height: 1.5; display: flex; transition: border-color .3s var(--n-bezier); `,[W("prefix, suffix",` display: flex; align-items: center; `),W("prefix","padding-right: 16px;"),W("suffix","padding-left: 16px;")]),s("top, bottom",[n("tabs-nav-scroll-wrapper",[T("&::before",` top: 0; bottom: 0; left: 0; width: 20px; `),T("&::after",` top: 0; bottom: 0; right: 0; width: 20px; `),s("shadow-start",[T("&::before",` box-shadow: inset 10px 0 8px -8px rgba(0, 0, 0, .12); `)]),s("shadow-end",[T("&::after",` box-shadow: inset -10px 0 8px -8px rgba(0, 0, 0, .12); `)])])]),s("left, right",[n("tabs-nav-scroll-wrapper",[T("&::before",` top: 0; left: 0; right: 0; height: 20px; `),T("&::after",` bottom: 0; left: 0; right: 0; height: 20px; `),s("shadow-start",[T("&::before",` box-shadow: inset 0 10px 8px -8px rgba(0, 0, 0, .12); `)]),s("shadow-end",[T("&::after",` box-shadow: inset 0 -10px 8px -8px rgba(0, 0, 0, .12); `)])])]),n("tabs-nav-scroll-wrapper",` flex: 1; position: relative; overflow: hidden; `,[n("tabs-nav-y-scroll",` height: 100%; width: 100%; overflow-y: auto; scrollbar-width: none; `,[T("&::-webkit-scrollbar",` width: 0; height: 0; `)]),T("&::before, &::after",` transition: box-shadow .3s var(--n-bezier); pointer-events: none; content: ""; position: absolute; z-index: 1; `)]),n("tabs-nav-scroll-content",` display: flex; position: relative; min-width: 100%; width: fit-content; box-sizing: border-box; `),n("tabs-wrapper",` display: inline-flex; flex-wrap: nowrap; position: relative; `),n("tabs-tab-wrapper",` display: flex; flex-wrap: nowrap; flex-shrink: 0; flex-grow: 0; `),n("tabs-tab",` cursor: pointer; white-space: nowrap; flex-wrap: nowrap; display: inline-flex; align-items: center; color: var(--n-tab-text-color); font-size: var(--n-tab-font-size); background-clip: padding-box; padding: var(--n-tab-padding); transition: box-shadow .3s var(--n-bezier), color .3s var(--n-bezier), background-color .3s var(--n-bezier), border-color .3s var(--n-bezier); `,[s("disabled",{cursor:"not-allowed"}),W("close",` margin-left: 6px; transition: background-color .3s var(--n-bezier), color .3s var(--n-bezier); `),W("label",` display: flex; align-items: center; `)]),n("tabs-bar",` position: absolute; bottom: 0; height: 2px; border-radius: 1px; background-color: var(--n-bar-color); transition: left .2s var(--n-bezier), max-width .2s var(--n-bezier), background-color .3s var(--n-bezier); `,[T("&.transition-disabled",` transition: none; `),s("disabled",` background-color: var(--n-tab-text-color-disabled) `)]),n("tabs-pane-wrapper",` position: relative; overflow: hidden; transition: max-height .2s var(--n-bezier); `),n("tab-pane",` color: var(--n-pane-text-color); width: 100%; transition: color .3s var(--n-bezier), background-color .3s var(--n-bezier), opacity .2s var(--n-bezier); left: 0; right: 0; top: 0; `,[T("&.next-transition-leave-active, &.prev-transition-leave-active, &.next-transition-enter-active, &.prev-transition-enter-active",` transition: color .3s var(--n-bezier), background-color .3s var(--n-bezier), transform .2s var(--n-bezier), opacity .2s var(--n-bezier); `),T("&.next-transition-leave-active, &.prev-transition-leave-active",` position: absolute; `),T("&.next-transition-enter-from, &.prev-transition-leave-to",` transform: translateX(32px); opacity: 0; `),T("&.next-transition-leave-to, &.prev-transition-enter-from",` transform: translateX(-32px); opacity: 0; `),T("&.next-transition-leave-from, &.next-transition-enter-to, &.prev-transition-leave-from, &.prev-transition-enter-to",` transform: translateX(0); opacity: 1; `)]),n("tabs-tab-pad",` box-sizing: border-box; width: var(--n-tab-gap); flex-grow: 0; flex-shrink: 0; `),s("line-type, bar-type",[n("tabs-tab",` font-weight: var(--n-tab-font-weight); box-sizing: border-box; vertical-align: bottom; `,[T("&:hover",{color:"var(--n-tab-text-color-hover)"}),s("active",` color: var(--n-tab-text-color-active); font-weight: var(--n-tab-font-weight-active); `),s("disabled",{color:"var(--n-tab-text-color-disabled)"})])]),n("tabs-nav",[s("line-type",[s("top",[W("prefix, suffix",` border-bottom: 1px solid var(--n-tab-border-color); `),n("tabs-nav-scroll-content",` border-bottom: 1px solid var(--n-tab-border-color); `),n("tabs-bar",` bottom: -1px; `)]),s("left",[W("prefix, suffix",` border-right: 1px solid var(--n-tab-border-color); `),n("tabs-nav-scroll-content",` border-right: 1px solid var(--n-tab-border-color); `),n("tabs-bar",` right: -1px; `)]),s("right",[W("prefix, suffix",` border-left: 1px solid var(--n-tab-border-color); `),n("tabs-nav-scroll-content",` border-left: 1px solid var(--n-tab-border-color); `),n("tabs-bar",` left: -1px; `)]),s("bottom",[W("prefix, suffix",` border-top: 1px solid var(--n-tab-border-color); `),n("tabs-nav-scroll-content",` border-top: 1px solid var(--n-tab-border-color); `),n("tabs-bar",` top: -1px; `)]),W("prefix, suffix",` transition: border-color .3s var(--n-bezier); `),n("tabs-nav-scroll-content",` transition: border-color .3s var(--n-bezier); `),n("tabs-bar",` border-radius: 0; `)]),s("card-type",[W("prefix, suffix",` transition: border-color .3s var(--n-bezier); border-bottom: 1px solid var(--n-tab-border-color); `),n("tabs-pad",` flex-grow: 1; transition: border-color .3s var(--n-bezier); border-bottom: 1px solid var(--n-tab-border-color); `),n("tabs-tab-pad",` transition: border-color .3s var(--n-bezier); `),n("tabs-tab",` font-weight: var(--n-tab-font-weight); border: 1px solid var(--n-tab-border-color); background-color: var(--n-tab-color); box-sizing: border-box; position: relative; vertical-align: bottom; display: flex; justify-content: space-between; font-size: var(--n-tab-font-size); color: var(--n-tab-text-color); `,[s("addable",` padding-left: 8px; padding-right: 8px; font-size: 16px; `,[W("height-placeholder",` width: 0; font-size: var(--n-tab-font-size); `),St("disabled",[T("&:hover",` color: var(--n-tab-text-color-hover); `)])]),s("closable","padding-right: 8px;"),s("active",` background-color: #0000; font-weight: var(--n-tab-font-weight-active); color: var(--n-tab-text-color-active); `),s("disabled","color: var(--n-tab-text-color-disabled);")]),n("tabs-scroll-padding","border-bottom: 1px solid var(--n-tab-border-color);")]),s("left, right",[n("tabs-wrapper",` flex-direction: column; `,[n("tabs-tab-wrapper",` flex-direction: column; `,[n("tabs-tab-pad",` height: var(--n-tab-gap-vertical); width: 100%; `)])])]),s("top",[s("card-type",[n("tabs-tab",` border-top-left-radius: var(--n-tab-border-radius); border-top-right-radius: var(--n-tab-border-radius); `,[s("active",` border-bottom: 1px solid #0000; `)]),n("tabs-tab-pad",` border-bottom: 1px solid var(--n-tab-border-color); `)])]),s("left",[s("card-type",[n("tabs-tab",` border-top-left-radius: var(--n-tab-border-radius); border-bottom-left-radius: var(--n-tab-border-radius); `,[s("active",` border-right: 1px solid #0000; `)]),n("tabs-tab-pad",` border-right: 1px solid var(--n-tab-border-color); `)])]),s("right",[s("card-type",[n("tabs-tab",` border-top-right-radius: var(--n-tab-border-radius); border-bottom-right-radius: var(--n-tab-border-radius); `,[s("active",` border-left: 1px solid #0000; `)]),n("tabs-tab-pad",` border-left: 1px solid var(--n-tab-border-color); `)])]),s("bottom",[s("card-type",[n("tabs-tab",` border-bottom-left-radius: var(--n-tab-border-radius); border-bottom-right-radius: var(--n-tab-border-radius); `,[s("active",` border-top: 1px solid #0000; `)]),n("tabs-tab-pad",` border-top: 1px solid var(--n-tab-border-color); `)])])])]),ra=Object.assign(Object.assign({},Pe.props),{value:[String,Number],defaultValue:[String,Number],trigger:{type:String,default:"click"},type:{type:String,default:"bar"},closable:Boolean,justifyContent:String,size:{type:String,default:"medium"},placement:{type:String,default:"top"},tabStyle:[String,Object],barWidth:Number,paneClass:String,paneStyle:[String,Object],paneWrapperClass:String,paneWrapperStyle:[String,Object],addable:[Boolean,Object],tabsPadding:{type:Number,default:0},animated:Boolean,onBeforeLeave:Function,onAdd:Function,"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],onClose:[Function,Array],labelSize:String,activeName:[String,Number],onActiveNameChange:[Function,Array]}),la=J({name:"Tabs",props:ra,setup(e,{slots:r}){var i,f,d,m;const{mergedClsPrefixRef:u,inlineThemeDisabled:p}=wt(e),y=Pe("Tabs","-tabs",aa,ea,e,u),h=B(null),C=B(null),S=B(null),x=B(null),v=B(null),w=B(!0),R=B(!0),P=ve(e,["labelSize","size"]),A=ve(e,["activeName","value"]),z=B((f=(i=A.value)!==null&&i!==void 0?i:e.defaultValue)!==null&&f!==void 0?f:r.default?(m=(d=ee(r.default())[0])===null||d===void 0?void 0:d.props)===null||m===void 0?void 0:m.name:null),_=Tt(A,z),k={id:0},g=Y(()=>{if(!(!e.justifyContent||e.type==="card"))return{display:"flex",justifyContent:e.justifyContent}});te(_,()=>{k.id=0,I(),le()});function c(){var t;const{value:a}=_;return a===null?null:(t=h.value)===null||t===void 0?void 0:t.querySelector(`[data-name="${a}"]`)}function L(t){if(e.type==="card")return;const{value:a}=C;if(a&&t){const o=`${u.value}-tabs-bar--disabled`,{barWidth:l,placement:$}=e;if(t.dataset.disabled==="true"?a.classList.add(o):a.classList.remove(o),["top","bottom"].includes($)){if(V(["top","maxHeight","height"]),typeof l=="number"&&t.offsetWidth>=l){const E=Math.floor((t.offsetWidth-l)/2)+t.offsetLeft;a.style.left=`${E}px`,a.style.maxWidth=`${l}px`}else a.style.left=`${t.offsetLeft}px`,a.style.maxWidth=`${t.offsetWidth}px`;a.style.width="8192px",a.offsetWidth}else{if(V(["left","maxWidth","width"]),typeof l=="number"&&t.offsetHeight>=l){const E=Math.floor((t.offsetHeight-l)/2)+t.offsetTop;a.style.top=`${E}px`,a.style.maxHeight=`${l}px`}else a.style.top=`${t.offsetTop}px`,a.style.maxHeight=`${t.offsetHeight}px`;a.style.height="8192px",a.offsetHeight}}}function V(t){const{value:a}=C;if(a)for(const o of t)a.style[o]=""}function I(){if(e.type==="card")return;const t=c();t&&L(t)}function le(t){var a;const o=(a=v.value)===null||a===void 0?void 0:a.$el;if(!o)return;const l=c();if(!l)return;const{scrollLeft:$,offsetWidth:E}=o,{offsetLeft:F,offsetWidth:N}=l;$>F?o.scrollTo({top:0,left:F,behavior:"smooth"}):F+N>$+E&&o.scrollTo({top:0,left:F+N-E,behavior:"smooth"})}const O=B(null);let Z=0,j=null;function ze(t){const a=O.value;if(a){Z=t.getBoundingClientRect().height;const o=`${Z}px`,l=()=>{a.style.height=o,a.style.maxHeight=o};j?(l(),j(),j=null):j=l}}function Le(t){const a=O.value;if(a){const o=t.getBoundingClientRect().height,l=()=>{document.body.offsetHeight,a.style.maxHeight=`${o}px`,a.style.height=`${Math.max(Z,o)}px`};j?(j(),j=null,l()):j=l}}function $e(){const t=O.value;if(t){t.style.maxHeight="",t.style.height="";const{paneWrapperStyle:a}=e;if(typeof a=="string")t.style.cssText=a;else if(a){const{maxHeight:o,height:l}=a;o!==void 0&&(t.style.maxHeight=o),l!==void 0&&(t.style.height=l)}}}const de={value:[]},ce=B("next");function Be(t){const a=_.value;let o="next";for(const l of de.value){if(l===a)break;if(l===t){o="prev";break}}ce.value=o,We(t)}function We(t){const{onActiveNameChange:a,onUpdateValue:o,"onUpdate:value":l}=e;a&&q(a,t),o&&q(o,t),l&&q(l,t),z.value=t}function Ae(t){const{onClose:a}=e;a&&q(a,t)}function be(){const{value:t}=C;if(!t)return;const a="transition-disabled";t.classList.add(a),I(),t.classList.remove(a)}let fe=0;function _e(t){var a;if(t.contentRect.width===0&&t.contentRect.height===0||fe===t.contentRect.width)return;fe=t.contentRect.width;const{type:o}=e;(o==="line"||o==="bar")&&be(),o!=="segment"&&Q((a=v.value)===null||a===void 0?void 0:a.$el)}const Ee=ne(_e,64);te([()=>e.justifyContent,()=>e.size],()=>{ae(()=>{const{type:t}=e;(t==="line"||t==="bar")&&be()})});const D=B(!1);function ke(t){var a;const{target:o,contentRect:{width:l}}=t,$=o.parentElement.offsetWidth;if(!D.value)$<l&&(D.value=!0);else{const{value:E}=x;if(!E)return;$-l>E.$el.offsetWidth&&(D.value=!1)}Q((a=v.value)===null||a===void 0?void 0:a.$el)}const Me=ne(ke,64);function Ve(){const{onAdd:t}=e;t&&t(),ae(()=>{const a=c(),{value:o}=v;!a||!o||o.scrollTo({left:a.offsetLeft,top:0,behavior:"smooth"})})}function Q(t){if(!t)return;const{placement:a}=e;if(a==="top"||a==="bottom"){const{scrollLeft:o,scrollWidth:l,offsetWidth:$}=t;w.value=o<=0,R.value=o+$>=l}else{const{scrollTop:o,scrollHeight:l,offsetHeight:$}=t;w.value=o<=0,R.value=o+$>=l}}const je=ne(t=>{Q(t.target)},64);Pt(se,{triggerRef:G(e,"trigger"),tabStyleRef:G(e,"tabStyle"),paneClassRef:G(e,"paneClass"),paneStyleRef:G(e,"paneStyle"),mergedClsPrefixRef:u,typeRef:G(e,"type"),closableRef:G(e,"closable"),valueRef:_,tabChangeIdRef:k,onBeforeLeaveRef:G(e,"onBeforeLeave"),activateTab:Be,handleClose:Ae,handleAdd:Ve}),Rt(()=>{I(),le()}),zt(()=>{const{value:t}=S;if(!t)return;const{value:a}=u,o=`${a}-tabs-nav-scroll-wrapper--shadow-start`,l=`${a}-tabs-nav-scroll-wrapper--shadow-end`;w.value?t.classList.remove(o):t.classList.add(o),R.value?t.classList.remove(l):t.classList.add(l)});const pe=B(null);te(_,()=>{if(e.type==="segment"){const t=pe.value;t&&ae(()=>{t.classList.add("transition-disabled"),t.offsetWidth,t.classList.remove("transition-disabled")})}});const Ie={syncBarPosition:()=>{I()}},ue=Y(()=>{const{value:t}=P,{type:a}=e,o={card:"Card",bar:"Bar",line:"Line",segment:"Segment"}[a],l=`${t}${o}`,{self:{barColor:$,closeIconColor:E,closeIconColorHover:F,closeIconColorPressed:N,tabColor:Ge,tabBorderColor:He,paneTextColor:Fe,tabFontWeight:Oe,tabBorderRadius:De,tabFontWeightActive:Ne,colorSegment:Ue,fontWeightStrong:Xe,tabColorSegment:qe,closeSize:Ye,closeIconSize:Ke,closeColorHover:Je,closeColorPressed:Ze,closeBorderRadius:Qe,[M("panePadding",t)]:U,[M("tabPadding",l)]:et,[M("tabPaddingVertical",l)]:tt,[M("tabGap",l)]:at,[M("tabGap",`${l}Vertical`)]:rt,[M("tabTextColor",a)]:nt,[M("tabTextColorActive",a)]:ot,[M("tabTextColorHover",a)]:it,[M("tabTextColorDisabled",a)]:st,[M("tabFontSize",t)]:lt},common:{cubicBezierEaseInOut:dt}}=y.value;return{"--n-bezier":dt,"--n-color-segment":Ue,"--n-bar-color":$,"--n-tab-font-size":lt,"--n-tab-text-color":nt,"--n-tab-text-color-active":ot,"--n-tab-text-color-disabled":st,"--n-tab-text-color-hover":it,"--n-pane-text-color":Fe,"--n-tab-border-color":He,"--n-tab-border-radius":De,"--n-close-size":Ye,"--n-close-icon-size":Ke,"--n-close-color-hover":Je,"--n-close-color-pressed":Ze,"--n-close-border-radius":Qe,"--n-close-icon-color":E,"--n-close-icon-color-hover":F,"--n-close-icon-color-pressed":N,"--n-tab-color":Ge,"--n-tab-font-weight":Oe,"--n-tab-font-weight-active":Ne,"--n-tab-padding":et,"--n-tab-padding-vertical":tt,"--n-tab-gap":at,"--n-tab-gap-vertical":rt,"--n-pane-padding-left":X(U,"left"),"--n-pane-padding-right":X(U,"right"),"--n-pane-padding-top":X(U,"top"),"--n-pane-padding-bottom":X(U,"bottom"),"--n-font-weight-strong":Xe,"--n-tab-color-segment":qe}}),H=p?Lt("tabs",Y(()=>`${P.value[0]}${e.type[0]}`),ue,e):void 0;return Object.assign({mergedClsPrefix:u,mergedValue:_,renderedNames:new Set,tabsRailElRef:pe,tabsPaneWrapperRef:O,tabsElRef:h,barElRef:C,addTabInstRef:x,xScrollInstRef:v,scrollWrapperElRef:S,addTabFixed:D,tabWrapperStyle:g,handleNavResize:Ee,mergedSize:P,handleScroll:je,handleTabsResize:Me,cssVars:p?void 0:ue,themeClass:H==null?void 0:H.themeClass,animationDirection:ce,renderNameListRef:de,onAnimationBeforeLeave:ze,onAnimationEnter:Le,onAnimationAfterEnter:$e,onRender:H==null?void 0:H.onRender},Ie)},render(){const{mergedClsPrefix:e,type:r,placement:i,addTabFixed:f,addable:d,mergedSize:m,renderNameListRef:u,onRender:p,paneWrapperClass:y,paneWrapperStyle:h,$slots:{default:C,prefix:S,suffix:x}}=this;p==null||p();const v=C?ee(C()).filter(g=>g.type.__TAB_PANE__===!0):[],w=C?ee(C()).filter(g=>g.type.__TAB__===!0):[],R=!w.length,P=r==="card",A=r==="segment",z=!P&&!A&&this.justifyContent;u.value=[];const _=()=>{const g=b("div",{style:this.tabWrapperStyle,class:[`${e}-tabs-wrapper`]},z?null:b("div",{class:`${e}-tabs-scroll-padding`,style:{width:`${this.tabsPadding}px`}}),R?v.map((c,L)=>(u.value.push(c.props.name),oe(b(ie,Object.assign({},c.props,{internalCreatedByPane:!0,internalLeftPadded:L!==0&&(!z||z==="center"||z==="start"||z==="end")}),c.children?{default:c.children.tab}:void 0)))):w.map((c,L)=>(u.value.push(c.props.name),oe(L!==0&&!z?we(c):c))),!f&&d&&P?Se(d,(R?v.length:w.length)!==0):null,z?null:b("div",{class:`${e}-tabs-scroll-padding`,style:{width:`${this.tabsPadding}px`}}));return b("div",{ref:"tabsElRef",class:`${e}-tabs-nav-scroll-content`},P&&d?b(xe,{onResize:this.handleTabsResize},{default:()=>g}):g,P?b("div",{class:`${e}-tabs-pad`}):null,P?null:b("div",{ref:"barElRef",class:`${e}-tabs-bar`}))},k=A?"top":i;return b("div",{class:[`${e}-tabs`,this.themeClass,`${e}-tabs--${r}-type`,`${e}-tabs--${m}-size`,z&&`${e}-tabs--flex`,`${e}-tabs--${k}`],style:this.cssVars},b("div",{class:[`${e}-tabs-nav--${r}-type`,`${e}-tabs-nav--${k}`,`${e}-tabs-nav`]},he(S,g=>g&&b("div",{class:`${e}-tabs-nav__prefix`},g)),A?b("div",{class:`${e}-tabs-rail`,ref:"tabsRailElRef"},R?v.map((g,c)=>(u.value.push(g.props.name),b(ie,Object.assign({},g.props,{internalCreatedByPane:!0,internalLeftPadded:c!==0}),g.children?{default:g.children.tab}:void 0))):w.map((g,c)=>(u.value.push(g.props.name),c===0?g:we(g)))):b(xe,{onResize:this.handleNavResize},{default:()=>b("div",{class:`${e}-tabs-nav-scroll-wrapper`,ref:"scrollWrapperElRef"},["top","bottom"].includes(k)?b(Mt,{ref:"xScrollInstRef",onScroll:this.handleScroll},{default:_}):b("div",{class:`${e}-tabs-nav-y-scroll`,onScroll:this.handleScroll},_()))}),f&&d&&P?Se(d,!0):null,he(x,g=>g&&b("div",{class:`${e}-tabs-nav__suffix`},g))),R&&(this.animated&&(k==="top"||k==="bottom")?b("div",{ref:"tabsPaneWrapperRef",style:h,class:[`${e}-tabs-pane-wrapper`,y]},Ce(v,this.mergedValue,this.renderedNames,this.onAnimationBeforeLeave,this.onAnimationEnter,this.onAnimationAfterEnter,this.animationDirection)):Ce(v,this.mergedValue,this.renderedNames)))}});function Ce(e,r,i,f,d,m,u){const p=[];return e.forEach(y=>{const{name:h,displayDirective:C,"display-directive":S}=y.props,x=w=>C===w||S===w,v=r===h;if(y.key!==void 0&&(y.key=h),v||x("show")||x("show:lazy")&&i.has(h)){i.has(h)||i.add(h);const w=!x("if");p.push(w?$t(y,[[Bt,v]]):y)}}),u?b(Wt,{name:`${u}-transition`,onBeforeLeave:f,onEnter:d,onAfterEnter:m},{default:()=>p}):p}function Se(e,r){return b(ie,{ref:"addTabInstRef",key:"__addable",name:"__addable",internalCreatedByPane:!0,internalAddable:!0,internalLeftPadded:r,disabled:typeof e=="object"&&e.disabled})}function we(e){const r=At(e);return r.props?r.props.internalLeftPadded=!0:r.props={internalLeftPadded:!0},r}function oe(e){return Array.isArray(e.dynamicProps)?e.dynamicProps.includes("internalLeftPadded")||e.dynamicProps.push("internalLeftPadded"):e.dynamicProps=["internalLeftPadded"],e}export{sa as N,la as a};