Files
OverlayScrollbars/packages/overlayscrollbars/dist/overlayscrollbars.esm.min.js
T
2022-07-12 12:56:27 +02:00

1 line
22 KiB
JavaScript

function t(t,e){const{o:n,u:o,_:r}=t;let i,s=n;const c=(t,e)=>{const n=s,c=t,l=e||(o?!o(n,c):n!==c);return(l||r)&&(s=c,i=n),[s,l,i]};return[e?t=>c(e(s,i),t):c,t=>[s,!!t,i]]}function e(t){return void 0===t}function n(t){return null===t}function o(t){return"number"==typeof t}function r(t){return"string"==typeof t}function i(t){return"function"==typeof t}function s(t){return Array.isArray(t)}function c(t){return"object"==typeof t&&!s(t)&&!n(t)}function l(t){const e=!!t&&t.length,n=o(e)&&e>-1&&e%1==0;return!(!(s(t)||!i(t)&&n)||e>0&&c(t)&&!(e-1 in t))}function a(t){if(!t||!c(t)||"object"!==$(t))return!1;let n;const o="constructor",r=t[o],i=r&&r.prototype,s=x.call(t,o),l=i&&x.call(i,"isPrototypeOf");if(r&&!s&&!l)return!1;for(n in t);return e(n)||x.call(t,n)}function d(t){const e=window.HTMLElement;return!!t&&(e?t instanceof e:t.nodeType===v)}function u(t){const e=window.Element;return!!t&&(e?t instanceof e:t.nodeType===v)}function f(t,e){if(l(t))for(let n=0;n<t.length&&!1!==e(t[n],n,t);n++);else t&&f(Object.keys(t),(n=>e(t[n],n,t)));return t}function h(t,e,o,r,c,l,d){const u=[e,o,r,c,l,d];return"object"==typeof t&&!n(t)||i(t)||(t={}),f(u,(e=>{f(B(e),(n=>{const o=e[n];if(t===o)return!0;const r=s(o);if(o&&(a(o)||r)){const e=t[n];let i=e;r&&!s(e)?i=[]:r||a(e)||(i={}),t[n]=h(i,o)}else t[n]=o}))})),t}function p(t,n,o,r){if(e(r))return o?o[t]:n;o&&(o[t]=r)}function w(t,n,o){if(e(o))return t?t.getAttribute(n):null;t&&t.setAttribute(n,o)}function g(t,e){return p("scrollLeft",0,t,e)}function y(t,e){return p("scrollTop",0,t,e)}function b(t,e){const n=r(e);if(s(e)||n){let o=n?"":{};if(t){const r=window.getComputedStyle(t,null);o=n?yt(t,r,e):e.reduce(((e,n)=>(e[n]=yt(t,r,n),e)),o)}return o}f(B(e),(n=>bt(t,n,e[n])))}const v=Node.ELEMENT_NODE,{toString:m,hasOwnProperty:x}=Object.prototype,$=t=>e(t)||n(t)?`${t}`:m.call(t).replace(/^\[object (.+)\]$/,"$1").toLowerCase(),S=(t,e,n)=>t.indexOf(e,n),O=(t,e,n)=>(n||r(e)||!l(e)?t.push(e):Array.prototype.push.apply(t,e),t),A=t=>{if(Array.from&&t)return Array.from(t);const e=[];return t instanceof Set?t.forEach((t=>{O(e,t)})):f(t,(t=>{O(e,t)})),e},L=t=>!!t&&0===t.length,M=(t,e)=>{const n=t=>t&&t.apply(void 0,e||[]);t instanceof Set?t.forEach(n):f(t,n)},C=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),B=t=>t?Object.keys(t):[],E=(t,e,n,o)=>{const r=w(t,e)||"",i=new Set(r.split(" "));i[o?"add":"delete"](n),w(t,e,A(i).join(" ").trim())},R=(t,e)=>{t&&t.removeAttribute(e)},T=Element.prototype,z=(t,e)=>{const n=[],o=e?u(e)?e:null:document;return o?O(n,o.querySelectorAll(t)):n},I=(t,e)=>!!u(t)&&(T.matches||T.msMatchesSelector).call(t,e),P=t=>t?A(t.childNodes):[],N=t=>t?t.parentElement:null,j=(t,e)=>{if(u(t)){const n=T.closest;if(n)return n.call(t,e);do{if(I(t,e))return t;t=N(t)}while(t)}return null},D=(t,e,n)=>{if(n){let o,r=e;t&&(l(n)?(o=document.createDocumentFragment(),f(n,(t=>{t===r&&(r=t.previousSibling),o.appendChild(t)}))):o=n,e&&(r?r!==e&&(r=r.nextSibling):r=t.firstChild),t.insertBefore(o,r||null))}},k=(t,e)=>{D(t,null,e)},H=(t,e)=>{D(t,t&&t.firstChild,e)},F=(t,e)=>{D(N(t),t&&t.nextSibling,e)},U=t=>{if(l(t))f(A(t),(t=>U(t)));else if(t){const e=N(t);e&&e.removeChild(t)}},V=t=>{const e=document.createElement("div");return t&&w(e,"class",t),e},Y=t=>{const e=V();return e.innerHTML=t.trim(),f(P(e),(t=>U(t)))},_=t=>t.charAt(0).toUpperCase()+t.slice(1),X=["-webkit-","-moz-","-o-","-ms-"],W=["WebKit","Moz","O","MS","webkit","moz","o","ms"],q={},K={},G=t=>{let e=K[t];if(C(K,t))return e;const n=_(t),o=V().style;return f(X,(r=>{const i=r.replace(/-/g,""),s=[t,r+t,i+n,_(i)+n];return!(e=s.find((t=>void 0!==o[t])))})),K[t]=e||""},J=t=>{let e=q[t]||window[t];return C(q,t)||(f(W,(n=>(e=e||window[n+_(t)],!e))),q[t]=e),e},Z=J("MutationObserver"),Q=J("IntersectionObserver"),tt=J("ResizeObserver"),et=J("cancelAnimationFrame"),nt=J("requestAnimationFrame"),ot=/[^\x20\t\r\n\f]+/g,rt=(t,e,n)=>{let o,i=0,s=!1;if(t&&e&&r(e)){const r=e.match(ot)||[];for(s=r.length>0;o=r[i++];)s=!!n(t.classList,o)&&s}return s},it=(t,e)=>{rt(t,e,((t,e)=>t.remove(e)))},st=(t,e)=>(rt(t,e,((t,e)=>t.add(e))),it.bind(0,t,e)),ct=(t,e,n,o)=>{if(t&&e){let r=!0;return f(n,(n=>{(o?o(t[n]):t[n])!==(o?o(e[n]):e[n])&&(r=!1)})),r}return!1},lt=(t,e)=>ct(t,e,["w","h"]),at=(t,e)=>ct(t,e,["x","y"]),dt=(t,e)=>ct(t,e,["t","r","b","l"]),ut=(t,e,n)=>ct(t,e,["width","height"],n&&(t=>Math.round(t))),ft=t=>{t&&window.clearTimeout(t),t&&et(t)},ht=()=>{},pt=(t,e)=>{let n,r,s,c;const{g:l,p:a,v:d}=e||{},u=window.setTimeout,f=function(e){ft(n),ft(r),r=n=s=void 0,t.apply(this,e)},h=t=>d&&s?d(s,t):t,p=()=>{n&&f(h(c)||c)},w=function(){const t=A(arguments),e=i(l)?l():l,d=o(e)&&e>=0;if(d){const l=i(a)?a():a,d=o(l)&&l>=0,w=e>0?u:nt,g=h(t)||t,y=f.bind(0,g);ft(n),n=w(y,e),d&&!r&&(r=u(p,l)),s=c=g}else f(t)};return w.m=p,w},wt={opacity:1,zindex:1},gt=(t,e)=>{const n=e?parseFloat(t):parseInt(t,10);return Number.isNaN(n)?0:n},yt=(t,e,n)=>null!=e?e[n]||e.getPropertyValue(n):t.style[n],bt=(t,n,r)=>{try{if(t){const{style:i}=t;e(i[n])?i.setProperty(n,r):i[n]=((t,e)=>!wt[t.toLowerCase()]&&o(e)?`${e}px`:e)(n,r)}}catch(T){}},vt=(t,e,n)=>{const o=e?`${e}-`:"",r=n?`-${n}`:"",i=`${o}top${r}`,s=`${o}right${r}`,c=`${o}bottom${r}`,l=`${o}left${r}`,a=b(t,[i,s,c,l]);return{t:gt(a[i]),r:gt(a[s]),b:gt(a[c]),l:gt(a[l])}},mt={w:0,h:0},xt=()=>({w:window.innerWidth,h:window.innerHeight}),$t=t=>t?{w:t.offsetWidth,h:t.offsetHeight}:mt,St=t=>t?{w:t.clientWidth,h:t.clientHeight}:mt,Ot=t=>t?{w:t.scrollWidth,h:t.scrollHeight}:mt,At=t=>{const e=parseFloat(b(t,"height"))||0,n=parseFloat(b(t,"height"))||0;return{w:n-Math.round(n),h:e-Math.round(e)}},Lt=t=>t.getBoundingClientRect();let Mt;const Ct=t=>t.split(" "),Bt=(t,e,n,o)=>{f(Ct(e),(e=>{t.removeEventListener(e,n,o)}))},Et=(t,n,o,r)=>{const i=(()=>{if(e(Mt)){Mt=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){Mt=!0}}))}catch(t){}}return Mt})(),s=i&&r&&r.S||!1,c=r&&r.C||!1,l=r&&r.O||!1,a=[],d=i?{passive:s,capture:c}:c;return f(Ct(n),(e=>{const n=l?r=>{t.removeEventListener(e,n,c),o&&o(r)}:o;O(a,Bt.bind(null,t,e,n,c)),t.addEventListener(e,n,d)})),M.bind(0,a)},Rt=t=>(t=>t.stopPropagation())(t)||(t=>t.preventDefault())(t),Tt={x:0,y:0},zt=t=>{const e=t?Lt(t):0;return e?{x:e.left+window.pageYOffset,y:e.top+window.pageXOffset}:Tt},It=(t,e)=>{f(s(e)?e:[e],t)},Pt=t=>{function e(t,e){if(t){const n=o.get(t);It((t=>{n&&n[t?"delete":"clear"](t)}),e)}else o.forEach((t=>{t.clear()})),o.clear()}function n(t,n){const r=o.get(t)||new Set;return o.set(t,r),It((t=>{t&&r.add(t)}),n),e.bind(0,t,n)}const o=new Map;return f(B(t),(e=>{n(e,t[e])})),[n,e,function(t,e){const n=o.get(t);f(A(n),(t=>{e&&!L(e)?t.apply(0,e):t()}))}]},Nt=(t,e)=>t?e.split(".").reduce(((t,e)=>t&&C(t,e)?t[e]:void 0),t):void 0,jt=(t,e,n)=>o=>[Nt(t,o),n||void 0!==Nt(e,o)],Dt=t=>{let e=t;return[()=>e,t=>{e=h({},e,t)}]},kt="os-environment",Ht=`${kt}-flexbox-glue`,Ft=`${Ht}-max`,Ut="data-overlayscrollbars",Vt=`${Ut}-overflow-x`,Yt=`${Ut}-overflow-y`,_t="overflowVisible",Xt="viewportStyled",Wt="os-padding",qt="os-viewport",Kt=`${qt}-arrange`,Gt="os-content",Jt=`${qt}-scrollbar-styled`,Zt=`os-overflow-visible`,Qt="os-size-observer",te=`${Qt}-appear`,ee=`${Qt}-listener`,ne=`${ee}-scroll`,oe=`${ee}-item`,re=`${oe}-final`,ie="os-trinsic-observer",se="os-scrollbar",ce=`${se}-horizontal`,le=`${se}-vertical`,ae="os-scrollbar-track",de="os-scrollbar-handle",ue=t=>JSON.stringify(t,((t,e)=>{if(i(e))throw new Error;return e})),fe={paddingAbsolute:!1,updating:{elementEvents:[["img","load"]],debounce:[0,33],attributes:null,ignoreMutation:null},overflow:{x:"scroll",y:"scroll"},nativeScrollbarsOverlaid:{show:!1,initialize:!1},scrollbars:{visibility:"auto",autoHide:"never",autoHideDelay:800,dragScroll:!0,clickScroll:!1,touch:!0}},he=(t,e)=>{const n={};return f(B(e).concat(B(t)),(o=>{const r=t[o],i=e[o];if(c(r)&&c(i))h(n[o]={},he(r,i));else if(C(e,o)&&i!==r){let t=!0;if(s(r)||s(i))try{ue(r)===ue(i)&&(t=!1)}catch(q){}t&&(n[o]=i)}})),n};let pe;const{abs:we,round:ge}=Math,ye=(t,e,n)=>{k(t,e);const o=St(e),r=$t(e),i=At(n);return{x:r.h-o.h+i.h,y:r.w-o.w+i.w}},be=(t,e)=>{const n="hidden";b(t,{overflowX:n,overflowY:n,direction:"rtl"}),g(t,0);const o=zt(t),r=zt(e);g(t,-999);const i=zt(e);return{i:o.x===r.x,n:r.x!==i.x}},ve=(t,e)=>{const n=st(t,Ht),o=Lt(t),r=Lt(e),i=ut(r,o,!0),s=st(t,Ft),c=Lt(t),l=Lt(e),a=ut(l,c,!0);return n(),s(),i&&a},me=()=>{const t=window.screen.deviceXDPI||0,e=window.screen.logicalXDPI||1;return window.devicePixelRatio||t/e},xe=()=>(pe||(pe=(()=>{const{body:e}=document,n=Y(`<div class="${kt}"><div></div></div>`)[0],o=n.firstChild,[r,,i]=Pt(),[s,c]=t({o:ye(e,n,o),u:at}),[l]=c(),a=(t=>{let e=!1;const n=st(t,Jt);try{e="none"===b(t,G("scrollbar-width"))||"none"===window.getComputedStyle(t,"::-webkit-scrollbar").getPropertyValue("display")}catch(o){}return n(),e})(n),d={x:0===l.x,y:0===l.y},u={A:!a,$:!1},f=h({},fe),p={L:l,I:d,T:a,D:"-1"===b(n,"zIndex"),P:be(n,o),M:ve(n,o),j:t=>r("_",t),N:h.bind(0,{},u),R(t){h(u,t)},H:h.bind(0,{},f),F(t){h(f,t)},k:h({},u),V:h({},f)};if(R(n,"style"),U(n),!(a||d.x&&d.y)){let t=xt(),r=me();window.addEventListener("resize",(()=>{const c=xt(),l={w:c.w-t.w,h:c.h-t.h};if(0===l.w&&0===l.h)return;const a=we(l.w),d=we(l.h),u={w:we(ge(c.w/(t.w/100))),h:we(ge(c.h/(t.h/100)))},f=me(),p=a>2&&d>2,w=!((t,e)=>{const n=we(t),o=we(e);return!(n===o||n+1===o||n-1===o)})(u.w,u.h);if(p&&w&&f!==r&&r>0){const[t,r]=s(ye(e,n,o));h(pe.L,t),U(n),r&&i("_")}t=c,r=f}))}return p})()),pe),$e=(t,e)=>i(t)?t.apply(0,e):t,Se=(t,e,n,o)=>$e(o||$e(n,t),t)||e.apply(0,t),Oe=(t,o,r,i)=>{let s=$e(i,t);return(n(s)||e(s))&&(s=$e(r,t)),!0===s||n(s)||e(s)?o.apply(0,t):s};let Ae=0;const Le=V.bind(0,""),Me=t=>{k(N(t),P(t)),U(t)},Ce=()=>{const{T:t,I:e,D:n}=xe(),o=!(n||t||!e.x&&!e.y)&&document.createElement("style");return o&&(w(o,"id",`${Kt}-${Ae}`),Ae++),o},Be=t=>{const{N:e,T:n}=xe(),{B:o,U:r,A:i,$:s}=e(),c=d(t),l=t,a=c?t:l.target,u=I(a,"textarea"),f=!u&&I(a,"body"),h=a.ownerDocument,p=h.body,g=h.defaultView,y=!!tt&&!u&&n,b=Se.bind(0,[a]),v=Oe.bind(0,[a]),m=[b(Le,r,l.viewport),b(Le,r),b(Le)].filter((t=>!!y||t!==a))[0],x=m===a,$={Y:a,B:u?b(Le,o,l.host):a,U:m,A:!x&&v(Le,i,l.padding),$:!x&&v(Le,s,l.content),q:!x&&Ce(),G:g,W:h,X:N(p),J:p,K:u,Z:f,tt:c,nt:x,et:(t,e)=>x?((t,e,n)=>{const o=w(t,Ut)||"";return new Set(o.split(" ")).has(n)})(m,0,e):((t,e)=>rt(t,e,((t,e)=>t.contains(e))))(m,t),ot:(t,e,n)=>x?E(m,Ut,e,n):(n?st:it)(m,t)},A=B($).reduce(((t,e)=>{const n=$[e];return O(t,!(!n||N(n))&&n)}),[]),L=t=>t?S(A,t)>-1:null,{Y:C,B:T,A:z,U:j,$:H,q:V}=$,Y=[],_=u&&L(T),X=u?C:P([H,j,z,T,C].find((t=>!1===L(t)))),W=H||j;return[$,()=>{const t=((t,e)=>(w(t,Ut,e),R.bind(0,t,Ut)))(T,x?"viewport":"host"),e=st(z,Wt),o=st(j,!x&&qt),r=st(H,Gt);_&&(F(C,T),O(Y,(()=>{F(T,C),U(T)}))),k(W,X),k(T,z),k(z||T,!x&&j),k(j,H),O(Y,(()=>{t(),R(j,Vt),R(j,Yt),L(H)&&Me(H),L(j)&&Me(j),L(z)&&Me(z),e(),o(),r()})),n&&!x&&O(Y,it.bind(0,j,Jt)),V&&(((t,e)=>{D(N(t),t,e)})(j,V),O(Y,U.bind(0,V)))},M.bind(0,Y)]},Ee=(t,e)=>{const{$:n}=t,[o]=e;return t=>{const{M:e}=xe(),{st:r}=o(),{ct:i}=t,s=(n||!e)&&i;return s&&b(n,{height:r?"":"100%"}),{it:s,rt:s}}},Re=(e,n)=>{const[o,r]=n,{B:i,A:s,U:c,nt:l}=e,[a,d]=t({u:dt,o:vt()},vt.bind(0,i,"padding",""));return(t,e,n)=>{let[i,u]=d(n);const{T:f,M:p}=xe(),{lt:w}=o(),{it:g,rt:y,ut:v}=t,[m,x]=e("paddingAbsolute");(g||u||!p&&y)&&([i,u]=a(n));const $=!l&&(x||v||u);if($){const t=!m||!s&&!f,e=i.r+i.l,n=i.t+i.b,o={marginRight:t&&!w?-e:0,marginBottom:t?-n:0,marginLeft:t&&w?-e:0,top:t?-i.t:0,right:t?w?-i.r:"auto":0,left:t?w?"auto":-i.l:0,width:t?`calc(100% + ${e}px)`:""},l={paddingTop:t?i.t:0,paddingRight:t?i.r:0,paddingBottom:t?i.b:0,paddingLeft:t?i.l:0};b(s||c,o),b(c,l),r({A:i,ft:!t,dt:s?l:h({},o,l)})}return{_t:$}}},{max:Te}=Math,ze="visible",Ie="hidden",Pe=42,Ne={u:lt,o:{w:0,h:0}},je={u:at,o:{x:Ie,y:Ie}},De=(t,e,n)=>n?st(t,e):it(t,e),ke=t=>0===t.indexOf(ze),He=(e,n)=>{const[o,r]=n,{B:i,A:s,U:c,q:l,nt:a,ot:d}=e,{L:u,M:h,T:p,I:g}=xe(),y=!a&&!p&&(g.x||g.y),[v,m]=t(Ne,At.bind(0,c)),[x,$]=t(Ne,Ot.bind(0,c)),[S,O]=t(Ne),[A]=t(je),L=(t,e)=>{if(b(c,{height:""}),e){const{ft:e,A:n}=o(),{gt:r,ht:s}=t,l=At(i),a=St(i),d="content-box"===b(c,"boxSizing"),u=e||d?n.b+n.t:0,f=!(g.x&&d);b(c,{height:a.h+l.h+(r.x&&f?s.x:0)-u})}},M=(t,e)=>{const n=p||t?0:Pe,o=(t,o,r)=>{const i=b(c,t),s="scroll"===(e?e[t]:i);return[i,s,s&&!p?o?n:r:0,o&&!!n]},[r,i,s,l]=o("overflowX",g.x,u.x),[a,d,f,h]=o("overflowY",g.y,u.y);return{vt:{x:r,y:a},gt:{x:i,y:d},ht:{x:s,y:f},wt:{x:l,y:h}}},C=(t,e,n,o)=>{const r=(t,e)=>{const n=ke(t),o=e&&n&&t.replace(`${ze}-`,"")||"";return[e&&!n?t:"",ke(o)?"hidden":o]},[i,s]=r(n.x,e.x),[c,l]=r(n.y,e.y);return o.overflowX=s&&c?s:i,o.overflowY=l&&i?l:c,M(t,o)},R=(t,e,n,r)=>{if(y){const{dt:i}=o(),{ht:s,wt:a}=t,{x:d,y:u}=a,{x:f,y:h}=s,p=i[r?"paddingRight":"paddingLeft"],g=i.paddingTop,y=e.w+n.w,v=e.h+n.h,m={w:h&&u?`${h+y-p}px`:"",h:f&&d?`${f+v-g}px`:""};if(l){const{sheet:t}=l;if(t){const{cssRules:e}=t;if(e){e.length||t.insertRule(`#${w(l,"id")} + .${Kt}::before {}`,0);const n=e[0].style;n.width=m.w,n.height=m.h}}}else b(c,{"--os-vaw":m.w,"--os-vah":m.h})}return y},T=(t,e,n,r)=>{const{ht:i,wt:s}=t,{x:c,y:l}=s,{x:a,y:d}=i,{dt:u}=o(),f=e?"marginLeft":"marginRight",h=e?"paddingLeft":"paddingRight",p=u[f],w=u.marginBottom,g=u[h],y=u.paddingBottom;r.width=`calc(100% + ${d+-1*p}px)`,r[f]=-d+p,r.marginBottom=-a+w,n&&(r[h]=g+(l?d:0),r.paddingBottom=y+(c?a:0))},z=(t,e,n)=>{if(y){const r=n||M(t),{dt:i}=o(),{wt:s}=r,{x:l,y:a}=s,d={},u=t=>f(t.split(" "),(t=>{d[t]=i[t]}));l&&u("marginBottom paddingTop paddingBottom"),a&&u("marginLeft marginRight paddingLeft paddingRight");const p=b(c,B(d));return it(c,Kt),h||(d.height=""),b(c,d),[()=>{T(r,e,y,p),b(c,p),st(c,Kt)},r]}return[ht]};return(t,e,n)=>{const{it:l,bt:u,rt:f,_t:y,ct:B,ut:I}=t,{st:P,lt:N}=o(),[j,D]=e("nativeScrollbarsOverlaid.show"),[k,H]=e("overflow"),F=j&&g.x&&g.y,U=!a&&!h&&(l||f||u||D||B),V=ke(k.x),Y=ke(k.y),_=V||Y;let X,W=m(n),q=$(n),K=O(n);if(D&&p&&d(Jt,Xt,!F),U&&(X=M(F),L(X,P)),l||y||f||I||D){_&&d(Zt,_t,!1);const[t,e]=z(F,N,X),[o,r]=W=v(n),[i,s]=q=x(n),l=St(c);let a=i,u=l;t(),(s||r||D)&&e&&!F&&R(e,i,o,N)&&(u=St(c),a=Ot(c)),K=S(((t,e,n)=>{const o=window.devicePixelRatio%1!=0?1:0,r={w:Te(0,t.w-e.w-Te(0,n.w)),h:Te(0,t.h-e.h-Te(0,n.h))};return{w:r.w>o?r.w:0,h:r.h>o?r.h:0}})({w:Te(i.w,a.w),h:Te(i.h,a.h)},{w:u.w+Te(0,l.w-i.w),h:u.h+Te(0,l.h-i.h)},o),n)}const[G,J]=K,[Z,Q]=q,[tt,et]=W,nt={x:G.w>0,y:G.h>0},ot=V&&Y&&(nt.x||nt.y)||V&&nt.x&&!nt.y||Y&&nt.y&&!nt.x;if(y||I||et||Q||J||H||D||U){const t={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},e=C(F,nt,k,t),n=R(e,Z,tt,N);a||T(e,N,n,t),U&&L(e,P),a?(w(i,Vt,t.overflowX),w(i,Yt,t.overflowY)):b(c,t)}E(i,Ut,_t,ot),De(s,Zt,ot),!a&&De(c,Zt,_);const[rt,it]=A(M(F).vt);return r({vt:rt,yt:{x:G.w,y:G.h},St:nt}),{Ct:it,xt:J}}},Fe=(t,e,n)=>{const o={},r=e||{};return f(B(t).concat(B(r)),(e=>{const i=t[e],s=r[e];o[e]=!!(n||i||s)})),o},Ue="animationstart",Ve="scroll",Ye=3333333,_e=t=>"rtl"===b(t,"direction"),Xe=t=>t&&(t.height||t.width),We=(e,n,o)=>{const{Ot:r=!1,At:i=!1}=o||{},{P:l}=xe(),a=Y(`<div class="${Qt}"><div class="${ee}"></div></div>`)[0],d=a.firstChild,u=_e.bind(0,a),[f]=t({o:void 0,_:!0,u:(t,e)=>!(!t||!Xe(t)&&Xe(e))}),h=t=>{const e=s(t)&&t.length>0&&c(t[0]),o=!e&&function(t){return"boolean"==typeof t}(t[0]);let i=!1,d=!1,u=!0;if(e){const[e,,n]=f(t.pop().contentRect),o=Xe(e),r=Xe(n);i=!n||!o,d=!r&&o,u=!i}else o?[,u]=t:d=!0===t;if(r&&u){const e=o?t[0]:_e(a);g(a,e?l.n?-Ye:l.i?0:Ye:Ye),y(a,Ye)}i||n({it:!o,$t:o?t:void 0,At:!!d})},p=[];let w,v=!!i&&h;if(tt){const t=new tt(h);t.observe(d),O(p,(()=>{t.disconnect()}))}else{const t=Y(`<div class="${oe}" dir="ltr"><div class="${oe}"><div class="${re}"></div></div><div class="${oe}"><div class="${re}" style="width: 200%; height: 200%"></div></div></div>`);k(d,t),st(d,ne);const e=t[0],n=e.lastChild,o=e.firstChild,r=null==o?void 0:o.firstChild;let s,c=$t(e),l=c,a=!1;const u=()=>{g(o,Ye),y(o,Ye),g(n,Ye),y(n,Ye)},f=t=>{s=0,a&&(c=l,h(!0===t))},w=t=>{l=$t(e),a=!t||!lt(l,c),t?(Rt(t),a&&!s&&(et(s),s=nt(f))):f(!1===t),u()};O(p,[Et(o,Ve,w),Et(n,Ve,w)]),b(r,{width:Ye,height:Ye}),u(),v=i?w.bind(0,!1):u}if(r){w=t({o:!u()},u);const[e]=w;O(p,Et(a,Ve,(t=>{const n=e(),[o,r]=n;r&&(it(d,"ltr rtl"),st(d,o?"rtl":"ltr"),h(n)),Rt(t)})))}return v&&(st(a,te),O(p,Et(a,Ue,v,{O:!!tt}))),H(e,a),()=>{M(p),U(a)}},qe=(e,n)=>{const o=V(ie),r=[],[i]=t({o:!1}),s=t=>{if(t){const e=i((t=>0===t.h||t.isIntersecting||t.intersectionRatio>0)(t)),[,o]=e;o&&n(e)}};if(Q){const t=new Q((t=>{t&&t.length>0&&s(t.pop())}),{root:e});t.observe(o),O(r,(()=>{t.disconnect()}))}else{const t=()=>{const t=$t(o);s(t)};O(r,We(o,t)),t()}return H(e,o),()=>{M(r),U(o)}},Ke=(t,e,n,o)=>{let i=!1;const{Lt:s,It:c,Tt:l,zt:a,Dt:d,Et:u}=o||{},[h,p]=((t,e,n)=>{let o,i=!1;const s=s=>{if(n){const c=n.reduce(((e,n)=>{if(n){const o=n[0],i=n[1],c=i&&o&&(s?s(o):z(o,t));c&&c.length&&i&&r(i)&&O(e,[c,i.trim()],!0)}return e}),[]);f(c,(t=>f(t[0],(n=>{const r=t[1],s=o.get(n);if(s){const t=s[0],e=s[1];t===r&&e()}const c=Et(n,r,(t=>{i?(c(),o.delete(n)):e(t)}));o.set(n,[r,c])}))))}};return n&&(o=new WeakMap,s()),[()=>{i=!0},s]})(t,pt((()=>{i&&n(!0)}),{g:33,p:99}),l),g=c||[],y=(s||[]).concat(g),b=i=>{const s=d||ht,c=u||ht,l=[],h=[];let y=!1,b=!1,v=!1;f(i,(n=>{const{attributeName:i,target:d,type:u,oldValue:f,addedNodes:p}=n,m="attributes"===u,x="childList"===u,$=t===d,A=m&&r(i)?w(d,i):0,L=0!==A&&f!==A,M=S(g,i)>-1&&L;if(e&&!$){const e=!m,r=m&&M,l=r&&a&&I(d,a),u=(l?!s(d,i,f,A):e||r)&&!c(n,!!l,t,o);O(h,p),b=b||u,v=v||x}!e&&$&&L&&!s(d,i,f,A)&&(O(l,i),y=y||M)})),v&&!L(h)&&p((t=>h.reduce(((e,n)=>(O(e,z(t,n)),I(n,t)?O(e,n):e)),[]))),e?b&&n(!1):L(l)&&!y||n(l,y)},v=new Z(b);return v.observe(t,{attributes:!0,attributeOldValue:!0,attributeFilter:y,subtree:e,childList:e,characterData:e}),i=!0,[()=>{i&&(h(),v.disconnect(),i=!1)},()=>{i&&b(v.takeRecords())}]},Ge=`[${Ut}]`,Je=`.${qt}`,Ze=["tabindex"],Qe=["wrap","cols","rows"],tn=["id","class","style","open"],en=(e,n,c)=>{let l,a,d;const[,h]=n,{B:p,U:g,$:y,K:b,nt:v,et:m,ot:x}=e,{T:$,M:O}=xe(),[A]=t({u:lt,o:{w:0,h:0}},(()=>{const t=m(Zt,_t);t&&x(Zt,_t);const e=Ot(y),n=Ot(g),o=At(g);return t&&x(Zt,_t,!0),{w:n.w+e.w+o.w,h:n.h+e.h+o.h}})),L=b?Qe:tn.concat(Qe),M=pt(c,{g:()=>l,p:()=>a,v(t,e){const[n]=t,[o]=e;return[B(n).concat(B(o)).reduce(((t,e)=>(t[e]=n[e]||o[e],t)),{})]}}),C=t=>{f(t||Ze,(t=>{if(S(Ze,t)>-1){const e=w(p,t);r(e)?w(g,t,e):R(g,t)}}))},E=({it:t,$t:e,At:n})=>{const o=!t||n?c:M;let r=!1;if(e){const[t,n]=e;r=n,h({lt:t})}o({it:t,ut:r})},T=t=>{const[,e]=A();e&&(t?c:M)({rt:!0})},z=(y||!O)&&qe(p,(t=>{const[e,n]=t;h({st:e}),c({ct:n})})),I=!v&&We(p,E,{At:!0,Ot:!$}),[P]=Ke(p,!1,((t,e)=>{e?M({bt:!0}):v||C(t)}),{It:tn,Lt:tn.concat(Ze)}),N=v&&new tt(E.bind(0,{it:!0}));return N&&N.observe(p),C(),[t=>{const[e]=t("updating.ignoreMutation"),[n,r]=t("updating.attributes"),[c,f]=t("updating.elementEvents"),[h,p]=t("updating.debounce"),w=t=>i(e)&&e(t);if((f||r)&&(d&&(d[1](),d[0]()),d=Ke(y||g,!0,T,{It:L.concat(n||[]),Lt:L.concat(n||[]),Tt:c,zt:Ge,Et:(t,e)=>{const{target:n,attributeName:o}=t;return!(e||!o)&&((t,e,n)=>{const o=t&&j(t,e),r=t&&((t,e)=>{const n=e?u(e)?e:null:document;return n?n.querySelector(t):null})(n,o);return!(!o||!r||o!==t&&r!==t&&j(j(t,n),e)===o)})(n,Ge,Je)||!!w(t)}})),p)if(M.m(),s(h)){const t=h[0],e=h[1];l=!!o(t)&&t,a=!!o(e)&&e}else o(h)?(l=h,a=!1):(l=!1,a=!1)},()=>{d&&d[0](),z&&z(),I&&I(),N&&N.disconnect(),P()}]},nn={A:{t:0,r:0,b:0,l:0},ft:!1,dt:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},yt:{x:0,y:0},vt:{x:"hidden",y:"hidden"},St:{x:!1,y:!1},st:!1,lt:!1},on=t=>{const e=V(`${se} ${t}`),n=V(ae),o=V(de);return k(e,n),k(n,o),{Nt:e,Rt:n,Ht:o}},rn={},sn="__osOptionsValidationPlugin",cn=new Set,ln=new WeakMap,an=(t,e,n)=>{let r=!1;const{H:s,I:c,j:l}=xe(),a=h({},rn),u=d(t)?t:t.target,p=(t=>ln.get(t))(u);if(p)return p;const w=a[sn],b=t=>{const e=t||{},n=w&&w.Bt;return n?n(e,!0):e},v=h({},s(),b(e)),[m,x,$]=Pt(n),[S,O,A]=((t,e)=>{const n=jt(e,{}),r=Dt(nn),[i,s,c]=Pt(),[l]=r,[a,d,u]=Be(t),p=((t,e)=>{const{U:n}=t,{T:r,I:i,M:s}=xe(),c=!r&&(i.x||i.y),l=[Ee(t,e),Re(t,e),He(t,e)];return(t,e,r)=>{const i=Fe(h({it:!1,_t:!1,ut:!1,ct:!1,xt:!1,Ct:!1,bt:!1,rt:!1},e),{},r),a=c||!s,d=a&&g(n),u=a&&y(n);let p=i;return f(l,(e=>{p=Fe(p,e(p,t,!!r)||{},r)})),o(d)&&g(n,d),o(u)&&y(n,u),p}})(a,r),[w,b]=en(a,r,(t=>{c("u",[p(n,t),{},!1])})),v=l.bind(0);return v.Pt=t=>{i("u",t)},v.Mt=d,v.jt=a,[(t,n)=>{const o=jt(e,t,n);w(o),c("u",[p(o,{},n),t,!!n])},v,()=>{s(),b(),u()}]})(t,v),[L,M,C]=((t,e,n)=>{const o=Dt({}),[r]=o,[i,s,c]=((t,e)=>{const{N:n}=xe(),{Ft:o}=n(),{Y:r,B:i,U:s,tt:c}=e,l=!c&&t.scrollbarsSlot,a=Oe([r,i,s],(()=>i),o,l),d=on(ce),u=on(le),{Nt:f}=d,{Nt:h}=u;return[{kt:d,Vt:u},()=>{k(a,f),k(a,h)},U.bind(0,[f,h])]})(t,n),l=r.bind(0);return l.jt=i,l.Mt=s,[(t,n)=>{const o=jt(e,t,n);console.log(o)},l,()=>{c()}]})(t,v,O.jt),E=(t,e)=>{S(t,e),L(t,e)},R=l(E.bind(0,{},!0)),T=t=>{(t=>{ln.delete(t),cn.delete(t)})(u),R(),C(),A(),r=!0,$("destroyed",[z,!!t]),x()},z={options(t){if(t){const e=he(v,b(t));(function(t){for(const e in t)return!1;return!0})(e)||(h(v,e),E(e))}return h({},v)},on:m,off:x,state(){const{yt:t,vt:e,St:n,A:o,ft:i}=O();return h({},{overflowAmount:t,overflowStyle:e,hasOverflow:n,padding:o,paddingAbsolute:i,destroyed:r})},elements(){const{Y:t,B:e,A:n,U:o,$:r}=O.jt;return h({},{target:t,host:e,padding:n||o,viewport:o,content:r||o})},update:t=>(E({},t),z),destroy:T.bind(0)};return c.x&&c.y&&!v.nativeScrollbarsOverlaid.initialize?(T(!0),z):(f(B(a),(t=>{const e=a[t];i(e)&&e(an,z)})),O.Mt(),M.Mt(),((t,e)=>{ln.set(t,e),cn.add(t)})(u,z),$("initialized",[z]),O.Pt(((t,e,n)=>{const{it:o,ut:r,ct:i,xt:s,Ct:c,rt:l,bt:a}=t;$("updated",[z,{updateHints:{sizeChanged:o,directionChanged:r,heightIntrinsicChanged:i,overflowAmountChanged:s,overflowStyleChanged:c,contentMutation:l,hostMutation:a},changedOptions:e,force:n}])})),z.update(!0))};an.plugin=t=>f(s(t)?t:[t],(t=>{rn[t[0]]=t[1]})),an.env=()=>{const{L:t,I:e,T:n,P:o,M:r,D:i,k:s,V:c,N:l,R:a,H:d,F:u}=xe();return h({},{scrollbarSize:t,scrollbarIsOverlaid:e,scrollbarStyling:n,rtlScrollBehavior:o,flexboxGlue:r,cssCustomProperties:i,defaultInitializationStrategy:s,defaultDefaultOptions:c,getInitializationStrategy:l,setInitializationStrategy:a,getDefaultOptions:d,setDefaultOptions:u})};export{an as default};