mirror of
https://github.com/luxfi/lpm.git
synced 2026-10-30 16:20:57 +00:00
1 line
3.9 KiB
JavaScript
1 line
3.9 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,21528,t=>{"use strict";t.i(35317);var e=t.i(59979),o="useEffectEvent"in e?({...e}).useEffectEvent:t=>{let o=e.useRef(t);return o.current=t,e.useCallback((...t)=>o.current(...t),[])};t.s(["useEffectEvent",()=>o])},87484,t=>{"use strict";let e=t=>"object"==typeof t&&null!=t&&1===t.nodeType,o=(t,e)=>(!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t,l=(t,e)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){let l,n=getComputedStyle(t,null);return o(n.overflowY,e)||o(n.overflowX,e)||!!(l=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t))&&(l.clientHeight<t.scrollHeight||l.clientWidth<t.scrollWidth)}return!1},n=(t,e,o,l,n,r,i,s)=>r<t&&i>e||r>t&&i<e?0:r<=t&&s<=o||i>=e&&s>=o?r-t-l:i>e&&s<o||r<t&&s>o?i-e+n:0,r=t=>{let e=t.parentElement;return null==e?t.getRootNode().host||null:e},i=(t,o)=>{var i,s,a,d;let f;if("undefined"==typeof document)return[];let{scrollMode:c,block:h,inline:u,boundary:p,skipOverflowHiddenElements:g}=o,m="function"==typeof p?p:t=>t!==p;if(!e(t))throw TypeError("Invalid target");let b=document.scrollingElement||document.documentElement,w=[],v=t;for(;e(v)&&m(v);){if((v=r(v))===b){w.push(v);break}null!=v&&v===document.body&&l(v)&&!l(document.documentElement)||null!=v&&l(v,g)&&w.push(v)}let y=null!=(s=null==(i=window.visualViewport)?void 0:i.width)?s:innerWidth,W=null!=(d=null==(a=window.visualViewport)?void 0:a.height)?d:innerHeight,{scrollX:M,scrollY:E}=window,{height:H,width:C,top:R,right:T,bottom:k,left:F}=t.getBoundingClientRect(),{top:B,right:N,bottom:S,left:j}={top:parseFloat((f=window.getComputedStyle(t)).scrollMarginTop)||0,right:parseFloat(f.scrollMarginRight)||0,bottom:parseFloat(f.scrollMarginBottom)||0,left:parseFloat(f.scrollMarginLeft)||0},I="start"===h||"nearest"===h?R-B:"end"===h?k+S:R+H/2-B+S,O="center"===u?F+C/2-j+N:"end"===u?T+N:F-j,x=[];for(let t=0;t<w.length;t++){let e=w[t],{height:o,width:r,top:i,right:s,bottom:a,left:d}=e.getBoundingClientRect();if("if-needed"===c&&R>=0&&F>=0&&k<=W&&T<=y&&(e===b&&!l(e)||R>=i&&k<=a&&F>=d&&T<=s))break;let f=getComputedStyle(e),p=parseInt(f.borderLeftWidth,10),g=parseInt(f.borderTopWidth,10),m=parseInt(f.borderRightWidth,10),v=parseInt(f.borderBottomWidth,10),B=0,N=0,S="offsetWidth"in e?e.offsetWidth-e.clientWidth-p-m:0,j="offsetHeight"in e?e.offsetHeight-e.clientHeight-g-v:0,L="offsetWidth"in e?0===e.offsetWidth?0:r/e.offsetWidth:0,V="offsetHeight"in e?0===e.offsetHeight?0:o/e.offsetHeight:0;if(b===e)B="start"===h?I:"end"===h?I-W:"nearest"===h?n(E,E+W,W,g,v,E+I,E+I+H,H):I-W/2,N="start"===u?O:"center"===u?O-y/2:"end"===u?O-y:n(M,M+y,y,p,m,M+O,M+O+C,C),B=Math.max(0,B+E),N=Math.max(0,N+M);else{B="start"===h?I-i-g:"end"===h?I-a+v+j:"nearest"===h?n(i,a,o,g,v+j,I,I+H,H):I-(i+o/2)+j/2,N="start"===u?O-d-p:"center"===u?O-(d+r/2)+S/2:"end"===u?O-s+m+S:n(d,s,r,p,m+S,O,O+C,C);let{scrollLeft:t,scrollTop:l}=e;B=0===V?0:Math.max(0,Math.min(l+B/V,e.scrollHeight-o/V+j)),N=0===L?0:Math.max(0,Math.min(t+N/L,e.scrollWidth-r/L+S)),I+=l-B,O+=t-N}x.push({el:e,top:B,left:N})}return x};function s(t,e){let o;if(!t.isConnected||!(t=>{let e=t;for(;e&&e.parentNode;){if(e.parentNode===document)return!0;e=e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentNode}return!1})(t))return;let l={top:parseFloat((o=window.getComputedStyle(t)).scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0};if("object"==typeof e&&"function"==typeof e.behavior)return e.behavior(i(t,e));let n="boolean"==typeof e||null==e?void 0:e.behavior;for(let{el:o,top:r,left:s}of i(t,!1===e?{block:"end",inline:"nearest"}:e===Object(e)&&0!==Object.keys(e).length?e:{block:"start",inline:"nearest"})){let t=r-l.top+l.bottom,e=s-l.left+l.right;o.scroll({top:t,left:e,behavior:n})}}t.s(["default",()=>s],87484)}]); |