import{s as t,M as e,c as a,u as o,a7 as l,o as s,n,ad as i,d,e as p,f as c,g as f,k as u,h as y,A as r,m as x,H as b,a9 as m,p as v}from"./index-45b322f7.js";import{_ as g}from"./_plugin-vue_export-helper.1b428a4d.js";const h=g({__name:"su-fixed",props:{noNav:{type:Boolean,default:!1},bottom:{type:Boolean,default:!1},bg:{type:String,default:""},bgStyles:{type:Object,default(){}},val:{type:Number,default:0},width:{type:[String,Number],default:0},alway:{type:Boolean,default:!0},opacity:{type:Boolean,default:!1},index:{type:[Number,String],default:0},placeholder:{type:[Boolean],default:!1},sticky:{type:[Boolean],default:!1},noFixed:{type:Boolean,default:!1},ui:{type:String,default:""},clickTo:{type:Boolean,default:!1},isInset:{type:Boolean,default:!0}},setup(g){const h=g,{safeAreaInsets:k}=t.$platform.device,$=b(),I=t.$helper.guid(),_=t.$platform.navbar,B=e({content:{},fixed:!0,scrollTop:0,opacityVal:0}),T=a((()=>B.fixed&&h.bottom?h.isInset?h.val+"px":h.val+k.bottom+"px":"auto"));B.fixed=!o(h.sticky),l((e=>{let a=e.scrollTop;B.scrollTop=a,B.opacityVal=a>t.$platform.navbar?1:.01*a})),s((()=>{n((()=>{w()}))}));const w=()=>{i().in($).select(`#fixed-${I}`).boundingClientRect((t=>{null!=t&&(B.content=t,o(h.sticky)&&z(B.scrollTop))})).exec()},z=e=>{o(h.bottom)?B.fixed=e>=B.content.bottom-t.$platform.device.windowHeight+B.content.height+o(h.val):B.fixed=e>=B.content.top-(o(h.noNav)?o(h.val):o(h.val)+t.$platform.navbar)},N=()=>{h.hasToTop&&m({scrollTop:B.content.top,duration:100})};return(e,a)=>{const l=v;return d(),p(l,{class:"ui-fixed"},{default:c((()=>[f(l,{class:u(["ui-fixed-box",[{fixed:B.fixed}]]),id:`fixed-${o(I)}`,style:y([{left:g.sticky?"auto":"0px",top:B.fixed&&!g.bottom?(g.noNav?g.val:g.val+o(_))+"px":"auto",bottom:o(T),zIndex:g.index+o(t).$zIndex.navbar},g.alway?"":{opacity:B.opacityVal}])},{default:c((()=>[f(l,{class:"ui-fixed-content",onClick:N,style:y([{zIndex:g.index+o(t).$zIndex.navbar}])},{default:c((()=>[r(e.$slots,"default",{},void 0,!0),o(k).bottom&&g.bottom&&g.isInset?(d(),p(l,{key:0,class:"inset-bottom",style:y([{height:o(k).bottom+"px"}])},null,8,["style"])):x("",!0)])),_:3},8,["style"]),g.bottom?(d(),p(l,{key:0,class:u(["ui-fixed-bottom",[g.bg]])},null,8,["class"])):x("",!0),f(l,{class:u(["ui-fixed-bg",[g.ui,g.bg]]),style:y([{zIndex:g.index+o(t).$zIndex.navbar-1},g.bgStyles,g.opacity?{opacity:B.opacityVal}:""])},null,8,["class","style"])])),_:3},8,["id","class","style"]),(g.sticky||g.placeholder)&&B.fixed?(d(),p(l,{key:0,class:"skeleton",style:y([{height:B.content.height+"px",width:g.width+"px"}])},null,8,["style"])):x("",!0)])),_:3})}}},[["__scopeId","data-v-3f7da64a"]]);export{h as _};
