UNPKG

@ionic/core

Version:
4 lines 717 B
/*! * (C) Ionic http://ionicframework.com - MIT License */ import{w as o}from"./p-7b30edcc.js";import{r as t}from"./p-ece78e7b.js";const e=(e,r,i)=>{let n;const s=()=>void 0!==r()&&void 0===e.label&&null!==i(),c=()=>{const t=r();if(void 0===t)return;if(!s())return void t.style.removeProperty("width");const d=i().scrollWidth;if(0===d&&null===t.offsetParent&&void 0!==o&&"IntersectionObserver"in o){if(void 0!==n)return;const o=n=new IntersectionObserver((t=>{1===t[0].intersectionRatio&&(c(),o.disconnect(),n=void 0)}),{threshold:.01,root:e});o.observe(t)}else t.style.setProperty("width",.75*d+"px")};return{calculateNotchWidth:()=>{s()&&t((()=>{c()}))},destroy:()=>{n&&(n.disconnect(),n=void 0)}}};export{e as c}