2 lines
3.8 KiB
JavaScript
2 lines
3.8 KiB
JavaScript
import{aQ as N,aO as I,aj as _,k as b,r as w,L as P,aS as A,c4 as $,aW as D,a4 as R,o as M,ah as W,c7 as Y,I as O,c8 as j,d as B,C as p,c6 as z}from"./BYv1load.js";import{m as x,t as V,b as v,c as y,h as m,d as k,j as F,w as L}from"./C6wbjLIE.js";var E=typeof window<"u";function ue(e){const n=N(e,null);if(n){const t=I(),{link:r,unlink:s,internalChildren:c}=n;r(t),_(()=>s(t));const u=b(()=>c.indexOf(t));return{parent:n,index:u}}return{parent:null,index:w(-1)}}function H(e){const n=[],t=r=>{Array.isArray(r)&&r.forEach(s=>{var c;j(s)&&(n.push(s),(c=s.component)!=null&&c.subTree&&(n.push(s.component.subTree),t(s.component.subTree.children)),s.children&&t(s.children))})};return t(e),n}var C=(e,n)=>{const t=e.indexOf(n);return t===-1?e.findIndex(r=>n.key!==void 0&&n.key!==null&&r.type===n.type&&r.key===n.key):t};function K(e,n,t){const r=H(e.subTree.children);t.sort((c,u)=>C(r,c.vnode)-C(r,u.vnode));const s=t.map(c=>c.proxy);n.sort((c,u)=>{const o=s.indexOf(c),a=s.indexOf(u);return o-a})}function de(e){const n=P([]),t=P([]),r=I();return{children:n,linkChildren:c=>{A(e,Object.assign({link:a=>{a.proxy&&(t.push(a),n.push(a.proxy),K(r,n,t))},unlink:a=>{const i=t.indexOf(a);n.splice(i,1),t.splice(i,1)},children:n,internalChildren:t},c))}}}function U(e){let n;M(()=>{e(),W(()=>{n=!0})}),Y(()=>{n&&e()})}function le(e,n,t={}){if(!E)return;const{target:r=window,passive:s=!1,capture:c=!1}=t;let u=!1,o;const a=d=>{if(u)return;const l=O(d);l&&!o&&(l.addEventListener(e,n,{capture:c,passive:s}),o=!0)},i=d=>{if(u)return;const l=O(d);l&&o&&(l.removeEventListener(e,n,c),o=!1)};_(()=>i(r)),$(()=>i(r)),U(()=>a(r));let f;return D(r)&&(f=R(r,(d,l)=>{i(l),a(d)})),()=>{f?.(),i(r),u=!0}}var g,h;function fe(){if(!g&&(g=w(0),h=w(0),E)){const e=()=>{g.value=window.innerWidth,h.value=window.innerHeight};e(),window.addEventListener("resize",e,{passive:!0}),window.addEventListener("orientationchange",e,{passive:!0})}return{width:g,height:h}}var Z=/scroll|auto|overlay/i,G=E?window:void 0;function Q(e){return e.tagName!=="HTML"&&e.tagName!=="BODY"&&e.nodeType===1}function me(e,n=G){let t=e;for(;t&&t!==n&&Q(t);){const{overflowY:r}=window.getComputedStyle(t);if(Z.test(r))return t;t=t.parentNode}return n}const ge="van-hairline",pe="van-haptics-feedback",ve=5,[X,T]=y("badge"),q={dot:Boolean,max:v,tag:x("div"),color:String,offset:Array,content:v,showZero:V,position:x("top-right")};var J=B({name:X,props:q,setup(e,{slots:n}){const t=()=>{if(n.content)return!0;const{content:o,showZero:a}=e;return k(o)&&o!==""&&(a||o!==0&&o!=="0")},r=()=>{const{dot:o,max:a,content:i}=e;if(!o&&t())return n.content?n.content():k(a)&&F(i)&&+i>+a?`${a}+`:i},s=o=>o.startsWith("-")?o.replace("-",""):`-${o}`,c=b(()=>{const o={background:e.color};if(e.offset){const[a,i]=e.offset,{position:f}=e,[d,l]=f.split("-");n.default?(typeof i=="number"?o[d]=m(d==="top"?i:-i):o[d]=d==="top"?m(i):s(i),typeof a=="number"?o[l]=m(l==="left"?a:-a):o[l]=l==="left"?m(a):s(a)):(o.marginTop=m(i),o.marginLeft=m(a))}return o}),u=()=>{if(t()||e.dot)return p("div",{class:T([e.position,{dot:e.dot,fixed:!!n.default}]),style:c.value},[r()])};return()=>{if(n.default){const{tag:o}=e;return p(o,{class:T("wrapper")},{default:()=>[n.default(),u()]})}return u()}}});const ee=L(J),[ne,he]=y("config-provider"),te=Symbol(ne),[oe,S]=y("icon"),re=e=>e?.includes("/"),ae={dot:Boolean,tag:x("i"),name:String,size:v,badge:v,color:String,badgeProps:Object,classPrefix:String};var se=B({name:oe,props:ae,setup(e,{slots:n}){const t=N(te,null),r=b(()=>e.classPrefix||t?.iconPrefix||S());return()=>{const{tag:s,dot:c,name:u,size:o,badge:a,color:i}=e,f=re(u);return p(ee,z({dot:c,tag:s,class:[r.value,f?"":`${r.value}-${u}`],style:{color:i,fontSize:m(o)},content:a},e.badgeProps),{default:()=>{var d;return[(d=n.default)==null?void 0:d.call(n),f&&p("img",{class:S("image"),src:u},null)]}})}}});const we=L(se);export{ge as B,pe as H,we as I,ve as T,le as a,de as b,ue as c,me as g,U as o,fe as u};
|