import{shallowRef as x,watch as s}from"vue";import{unrefElement as b}from"./unrefElement.mjs";import{useResizeObserver as l}from"./useResizeObserver.mjs";function w(u,o={width:0,height:0},d={}){const{box:i="content-box"}=d,t=x(o.width),h=x(o.height);return l(u,([e])=>{const c=i==="border-box"?e.borderBoxSize:i==="content-box"?e.contentBoxSize:e.devicePixelContentBoxSize;c?(t.value=c.reduce((n,{inlineSize:r})=>n+r,0),h.value=c.reduce((n,{blockSize:r})=>n+r,0)):(t.value=e.contentRect.width,h.value=e.contentRect.height)},d),s(()=>b(u),e=>{t.value=e?o.width:0,h.value=e?o.height:0}),{width:t,height:h}}export{w as useElementSize};
