import{m as T,w as m,t as f,d as v,S as C,aH as y,aA as R,k as e,aI as u,aJ as $,a2 as _,y as w,p as r,e as A,F as N}from"./index.879f7421.js";const[F,a]=T("nav-bar"),L={title:String,fixed:Boolean,zIndex:m,border:f,leftText:String,rightText:String,leftArrow:Boolean,placeholder:Boolean,safeAreaInsetTop:Boolean,clickable:f};var O=v({name:F,props:L,emits:["clickLeft","clickRight"],setup(t,{emit:o,slots:i}){const c=C(),n=y(c,a),h=l=>o("clickLeft",l),s=l=>o("clickRight",l),k=()=>i.left?i.left():[t.leftArrow&&e(_,{class:a("arrow"),name:"arrow-left"},null),t.leftText&&e("span",{class:a("text")},[t.leftText])],H=()=>i.right?i.right():e("span",{class:a("text")},[t.rightText]),g=()=>{const{title:l,fixed:b,border:p,zIndex:S}=t,x=R(S),B=t.leftArrow||t.leftText||i.left,I=t.rightText||i.right;return e("div",{ref:c,style:x,class:[a({fixed:b}),{[$]:p,"van-safe-area-top":t.safeAreaInsetTop}]},[e("div",{class:a("content")},[B&&e("div",{class:[a("left"),t.clickable?u:""],onClick:h},[k()]),e("div",{class:[a("title"),"van-ellipsis"]},[i.title?i.title():l]),I&&e("div",{class:[a("right"),t.clickable?u:""],onClick:s},[H()])])])};return()=>t.fixed&&t.placeholder?n(g):g()}});const P=w(O),z="_colHeader_a7v8p_1",E="_transparent_a7v8p_11",D="_headerSection_a7v8p_14";var d={colHeader:z,transparent:E,headerSection:D},j=v({name:"o-header",props:{title:String,isBack:{type:Boolean,default:!1},backIconColor:{type:String,default:"black"},isFixed:{type:Boolean,default:!0},styleName:{type:Object,default:()=>({})},titleClass:String,background:{type:String,default:"white"},color:{type:String,default:"#323233"},rightText:String,onClickRight:{type:Function,default:()=>{}},border:{type:Boolean,default:!0},onHeaderBack:{type:Function,default:()=>{}}},watch:{backIconColor(){r({api:"backIconChange",content:{iconStyle:this.backIconColor}})}},data(){return{headerTitle:null,navBarHeight:0,titleHeight:44}},mounted(){this.headerTitle=this.title||this.$route.meta.title,this.navBarInit(()=>{this.onHeaderBack&&this.onHeaderBack()})},unmounted(){r({api:"setBarStatus",content:{status:1}}),r({api:"backIconChange",content:{iconStyle:"black"}})},methods:{navBarInit(t){r({api:"setBarStatus",content:{status:0}}),r({api:"backIconChange",content:{iconStyle:this.backIconColor||"black"}});const o=sessionStorage.getItem("navHeight"),i=sessionStorage.getItem("titleHeight");o&&i?(this.navBarHeight=Number(o),t&&t()):r({api:"getNavHeight"},c=>{const{content:n}=c,h=n.dpi||2;if(n.navHeight){const s=n.navHeight/h;sessionStorage.setItem("navHeight",String(s)),this.navBarHeight=s}if(n.titleHeight){const s=n.titleHeight/h;sessionStorage.setItem("titleHeight",String(s)),this.titleHeight=s}t&&t()}),!A().isApp&&t&&t()},onClickLeft(){this.$router.back()},clickRight(){this.onClickRight&&this.onClickRight()}},render(){return e("div",null,[this.$slots.content?e("div",{style:{paddingTop:`${this.navBarHeight}px`,background:this.background},class:d.headerSection},[this.$slots.content(this.navBarHeight)]):e(N,null,[e("div",{style:{minHeight:`calc(var(--van-nav-bar-height) + ${this.navBarHeight}px)`},class:d.headerSection},[e(P,{title:this.headerTitle,class:[d.colHeader],style:{background:this.background,color:this.color,paddingTop:`${this.navBarHeight}px`,zIndex:99},"left-arrow":this.isBack,rightText:this.rightText,fixed:this.isFixed,border:this.border,"onClick-right":this.clickRight,"onClick-left":this.onClickLeft},{right:()=>this.$slots.right&&this.$slots.right()||this.rightText,title:()=>this.$slots.title&&this.$slots.title()||this.headerTitle})]),this.$slots.default?this.$slots.default():null])])}});export{j as O};
