You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
9.1 KiB
2 lines
9.1 KiB
import{d as oe,D as se,P as ae,b3 as ce,aV as ve}from"./index-f4658ae7.js";var v=[],ue=function(){return v.some(function(e){return e.activeTargets.length>0})},de=function(){return v.some(function(e){return e.skippedTargets.length>0})},P="ResizeObserver loop completed with undelivered notifications.",he=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:P}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=P),window.dispatchEvent(e)},b;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(b||(b={}));var u=function(e){return Object.freeze(e)},le=function(){function e(t,r){this.inlineSize=t,this.blockSize=r,u(this)}return e}(),q=function(){function e(t,r,n,i){return this.x=t,this.y=r,this.width=n,this.height=i,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,u(this)}return e.prototype.toJSON=function(){var t=this,r=t.x,n=t.y,i=t.top,o=t.right,s=t.bottom,d=t.left,h=t.width,c=t.height;return{x:r,y:n,top:i,right:o,bottom:s,left:d,width:h,height:c}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),C=function(e){return e instanceof SVGElement&&"getBBox"in e},G=function(e){if(C(e)){var t=e.getBBox(),r=t.width,n=t.height;return!r&&!n}var i=e,o=i.offsetWidth,s=i.offsetHeight;return!(o||s||e.getClientRects().length)},A=function(e){var t;if(e instanceof Element)return!0;var r=(t=e==null?void 0:e.ownerDocument)===null||t===void 0?void 0:t.defaultView;return!!(r&&e instanceof r.Element)},fe=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},p=typeof window!="undefined"?window:{},x=new WeakMap,I=/auto|scroll/,pe=/^tb|vertical/,be=/msie|trident/i.test(p.navigator&&p.navigator.userAgent),a=function(e){return parseFloat(e||"0")},l=function(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=!1),new le((r?t:e)||0,(r?e:t)||0)},_=u({devicePixelContentBoxSize:l(),borderBoxSize:l(),contentBoxSize:l(),contentRect:new q(0,0,0,0)}),U=function(e,t){if(t===void 0&&(t=!1),x.has(e)&&!t)return x.get(e);if(G(e))return x.set(e,_),_;var r=getComputedStyle(e),n=C(e)&&e.ownerSVGElement&&e.getBBox(),i=!be&&r.boxSizing==="border-box",o=pe.test(r.writingMode||""),s=!n&&I.test(r.overflowY||""),d=!n&&I.test(r.overflowX||""),h=n?0:a(r.paddingTop),c=n?0:a(r.paddingRight),O=n?0:a(r.paddingBottom),f=n?0:a(r.paddingLeft),Q=n?0:a(r.borderTopWidth),Z=n?0:a(r.borderRightWidth),j=n?0:a(r.borderBottomWidth),ee=n?0:a(r.borderLeftWidth),D=f+c,M=h+O,E=ee+Z,y=Q+j,k=d?e.offsetHeight-y-e.clientHeight:0,H=s?e.offsetWidth-E-e.clientWidth:0,te=i?D+E:0,re=i?M+y:0,g=n?n.width:a(r.width)-te-H,z=n?n.height:a(r.height)-re-k,ne=g+D+H+E,ie=z+M+k+y,N=u({devicePixelContentBoxSize:l(Math.round(g*devicePixelRatio),Math.round(z*devicePixelRatio),o),borderBoxSize:l(ne,ie,o),contentBoxSize:l(g,z,o),contentRect:new q(f,h,g,z)});return x.set(e,N),N},J=function(e,t,r){var n=U(e,r),i=n.borderBoxSize,o=n.contentBoxSize,s=n.devicePixelContentBoxSize;switch(t){case b.DEVICE_PIXEL_CONTENT_BOX:return s;case b.BORDER_BOX:return i;default:return o}},ge=function(){function e(t){var r=U(t);this.target=t,this.contentRect=r.contentRect,this.borderBoxSize=u([r.borderBoxSize]),this.contentBoxSize=u([r.contentBoxSize]),this.devicePixelContentBoxSize=u([r.devicePixelContentBoxSize])}return e}(),Y=function(e){if(G(e))return 1/0;for(var t=0,r=e.parentNode;r;)t+=1,r=r.parentNode;return t},ze=function(){var e=1/0,t=[];v.forEach(function(s){if(s.activeTargets.length!==0){var d=[];s.activeTargets.forEach(function(c){var O=new ge(c.target),f=Y(c.target);d.push(O),c.lastReportedSize=J(c.target,c.observedBox),f<e&&(e=f)}),t.push(function(){s.callback.call(s.observer,d,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var r=0,n=t;r<n.length;r++){var i=n[r];i()}return e},V=function(e){v.forEach(function(r){r.activeTargets.splice(0,r.activeTargets.length),r.skippedTargets.splice(0,r.skippedTargets.length),r.observationTargets.forEach(function(i){i.isActive()&&(Y(i.target)>e?r.activeTargets.push(i):r.skippedTargets.push(i))})})},xe=function(){var e=0;for(V(e);ue();)e=ze(),V(e);return de()&&he(),e>0},T,K=[],Re=function(){return K.splice(0).forEach(function(e){return e()})},we=function(e){if(!T){var t=0,r=document.createTextNode(""),n={characterData:!0};new MutationObserver(function(){return Re()}).observe(r,n),T=function(){r.textContent="".concat(t?t--:t++)}}K.push(e),T()},me=function(e){we(function(){requestAnimationFrame(e)})},m=0,Oe=function(){return!!m},Ee=250,ye={attributes:!0,characterData:!0,childList:!0,subtree:!0},W=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],L=function(e){return e===void 0&&(e=0),Date.now()+e},S=!1,Te=function(){function e(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return e.prototype.run=function(t){var r=this;if(t===void 0&&(t=Ee),!S){S=!0;var n=L(t);me(function(){var i=!1;try{i=xe()}finally{if(S=!1,t=n-L(),!Oe())return;i?r.run(1e3):t>0?r.run(t):r.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,r=function(){return t.observer&&t.observer.observe(document.body,ye)};document.body?r():p.addEventListener("DOMContentLoaded",r)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),W.forEach(function(r){return p.addEventListener(r,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),W.forEach(function(r){return p.removeEventListener(r,t.listener,!0)}),this.stopped=!0)},e}(),B=new Te,F=function(e){!m&&e>0&&B.start(),m+=e,!m&&B.stop()},Se=function(e){return!C(e)&&!fe(e)&&getComputedStyle(e).display==="inline"},Be=function(){function e(t,r){this.target=t,this.observedBox=r||b.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=J(this.target,this.observedBox,!0);return Se(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Ce=function(){function e(t,r){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=r}return e}(),R=new WeakMap,X=function(e,t){for(var r=0;r<e.length;r+=1)if(e[r].target===t)return r;return-1},w=function(){function e(){}return e.connect=function(t,r){var n=new Ce(t,r);R.set(t,n)},e.observe=function(t,r,n){var i=R.get(t),o=i.observationTargets.length===0;X(i.observationTargets,r)<0&&(o&&v.push(i),i.observationTargets.push(new Be(r,n&&n.box)),F(1),B.schedule())},e.unobserve=function(t,r){var n=R.get(t),i=X(n.observationTargets,r),o=n.observationTargets.length===1;i>=0&&(o&&v.splice(v.indexOf(n),1),n.observationTargets.splice(i,1),F(-1))},e.disconnect=function(t){var r=this,n=R.get(t);n.observationTargets.slice().forEach(function(i){return r.unobserve(t,i.target)}),n.activeTargets.splice(0,n.activeTargets.length)},e}(),De=function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");w.connect(this,t)}return e.prototype.observe=function(t,r){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!A(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");w.observe(this,t,r)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!A(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");w.unobserve(this,t)},e.prototype.disconnect=function(){w.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();class Me{constructor(){this.handleResize=this.handleResize.bind(this),this.observer=new(typeof window!="undefined"&&window.ResizeObserver||De)(this.handleResize),this.elHandlersMap=new Map}handleResize(t){for(const r of t){const n=this.elHandlersMap.get(r.target);n!==void 0&&n(r)}}registerHandler(t,r){this.elHandlersMap.set(t,r),this.observer.observe(t)}unregisterHandler(t){this.elHandlersMap.has(t)&&(this.elHandlersMap.delete(t),this.observer.unobserve(t))}}const $=new Me,He=oe({name:"ResizeObserver",props:{onResize:Function},setup(e){let t=!1;const r=se().proxy;function n(i){const{onResize:o}=e;o!==void 0&&o(i)}ae(()=>{const i=r.$el;if(i===void 0){return}if(i.nextElementSibling!==i.nextSibling&&i.nodeType===3&&i.nodeValue!==""){return}i.nextElementSibling!==null&&($.registerHandler(i.nextElementSibling,n),t=!0)}),ce(()=>{t&&$.unregisterHandler(r.$el.nextElementSibling)})},render(){return ve(this.$slots,"default")}});export{He as V,$ as r};
|