mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-21 00:20:36 +03:00
11 lines
27 KiB
JavaScript
11 lines
27 KiB
JavaScript
/*!
|
|
* OverlayScrollbars
|
|
* Version: 2.0.0-beta.0
|
|
*
|
|
* Copyright (c) Rene Haas | KingSora.
|
|
* https://github.com/KingSora
|
|
*
|
|
* Released under the MIT license.
|
|
*/
|
|
|
|
const OverlayScrollbars=function(t){"use strict";function e(t,n){if(w(t))for(let e=0;e<t.length&&!1!==n(t[e],e,t);e++);else t&&e(Object.keys(t),(e=>n(t[e],e,t)));return t}function n(t,n){const o=u(n);if(f(n)||o){let e=o?"":{};if(t){const r=window.getComputedStyle(t,null);e=o?mt(t,r,n):n.reduce(((e,n)=>(e[n]=mt(t,r,n),e)),e)}return e}t&&e(C(n),(e=>xt(t,e,n[e])))}const o=(t,e)=>{const{o:n,u:o,_:r}=t;let i,s=n;const l=(t,e)=>{const n=s,l=t,c=e||(o?!o(n,l):n!==l);return(c||r)&&(s=l,i=n),[s,c,i]};return[e?t=>l(e(s,i),t):l,t=>[s,!!t,i]]},r=Node.ELEMENT_NODE,{toString:i,hasOwnProperty:s}=Object.prototype,l=t=>void 0===t,c=t=>null===t,a=t=>l(t)||c(t)?`${t}`:i.call(t).replace(/^\[object (.+)\]$/,"$1").toLowerCase(),d=t=>"number"==typeof t,u=t=>"string"==typeof t,h=t=>"boolean"==typeof t,p=t=>"function"==typeof t,f=t=>Array.isArray(t),g=t=>"object"==typeof t&&!f(t)&&!c(t),w=t=>{const e=!!t&&t.length,n=d(e)&&e>-1&&e%1==0;return!(!(f(t)||!p(t)&&n)||e>0&&g(t)&&!(e-1 in t))},b=t=>{if(!t||!g(t)||"object"!==a(t))return!1;let e;const n="constructor",o=t[n],r=o&&o.prototype,i=s.call(t,n),c=r&&s.call(r,"isPrototypeOf");if(o&&!i&&!c)return!1;for(e in t);return l(e)||s.call(t,e)},v=t=>{const e=HTMLElement;return!!t&&(e?t instanceof e:t.nodeType===r)},y=t=>{const e=Element;return!!t&&(e?t instanceof e:t.nodeType===r)},m=(t,e,n)=>t.indexOf(e,n),x=(t,e,n)=>(n||u(e)||!w(e)?t.push(e):Array.prototype.push.apply(t,e),t),$=t=>{const n=Array.from,o=[];return n&&t?n(t):(t instanceof Set?t.forEach((t=>{x(o,t)})):e(t,(t=>{x(o,t)})),o)},O=t=>!!t&&0===t.length,S=(t,n,o)=>{e(t,(t=>t&&t.apply(void 0,n||[]))),!o&&(t.length=0)},L=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),C=t=>t?Object.keys(t):[],E=(t,n,o,r,i,s,l)=>{const a=[n,o,r,i,s,l];return"object"==typeof t&&!c(t)||p(t)||(t={}),e(a,(n=>{e(C(n),(e=>{const o=n[e];if(t===o)return!0;const r=f(o);if(o&&(b(o)||r)){const n=t[e];let i=n;r&&!f(n)?i=[]:r||b(n)||(i={}),t[e]=E(i,o)}else t[e]=o}))})),t},P=t=>{for(const e in t)return!1;return!0},T=(t,e,n,o)=>{if(l(o))return n?n[t]:e;n&&(u(o)||d(o))&&(n[t]=o)},M=(t,e,n)=>{if(l(n))return t?t.getAttribute(e):null;t&&t.setAttribute(e,n)},R=(t,e,n,o)=>{if(n){const r=M(t,e)||"",i=new Set(r.split(" "));i[o?"add":"delete"](n),M(t,e,$(i).join(" ").trim())}},z=(t,e)=>{t&&t.removeAttribute(e)},D=(t,e)=>T("scrollLeft",0,t,e),A=(t,e)=>T("scrollTop",0,t,e),k=Element.prototype,B=(t,e)=>{const n=[],o=e?y(e)?e:null:document;return o?x(n,o.querySelectorAll(t)):n},H=(t,e)=>!!y(t)&&(k.matches||k.msMatchesSelector).call(t,e),I=t=>t?$(t.childNodes):[],Y=t=>t?t.parentElement:null,X=(t,e)=>{if(y(t)){const n=k.closest;if(n)return n.call(t,e);do{if(H(t,e))return t;t=Y(t)}while(t)}return null},V=(t,n,o)=>{if(o&&t){let r,i=n;w(o)?(r=document.createDocumentFragment(),e(o,(t=>{t===i&&(i=t.previousSibling),r.appendChild(t)}))):r=o,n&&(i?i!==n&&(i=i.nextSibling):i=t.firstChild),t.insertBefore(r,i||null)}},j=(t,e)=>{V(t,null,e)},F=(t,e)=>{V(Y(t),t&&t.nextSibling,e)},_=t=>{if(w(t))e($(t),(t=>_(t)));else if(t){const e=Y(t);e&&e.removeChild(t)}},K=t=>{const e=document.createElement("div");return t&&M(e,"class",t),e},N=t=>{const n=K();return n.innerHTML=t.trim(),e(I(n),(t=>_(t)))},W=t=>t.charAt(0).toUpperCase()+t.slice(1),Z=["-webkit-","-moz-","-o-","-ms-"],G=["WebKit","Moz","O","MS","webkit","moz","o","ms"],J={},q={},U=t=>{let n=q[t];if(L(q,t))return n;const o=W(t),r=K().style;return e(Z,(e=>{const i=e.replace(/-/g,""),s=[t,e+t,i+o,W(i)+o];return!(n=s.find((t=>void 0!==r[t])))})),q[t]=n||""},Q=t=>{let n=J[t]||window[t];return L(J,t)||(e(G,(e=>(n=n||window[e+W(t)],!n))),J[t]=n),n},tt=Q("MutationObserver"),et=Q("IntersectionObserver"),nt=Q("ResizeObserver"),ot=Q("cancelAnimationFrame"),rt=Q("requestAnimationFrame"),it=window.setTimeout,st=window.clearTimeout,lt=/[^\x20\t\r\n\f]+/g,ct=(t,e,n)=>{const o=t&&t.classList;let r,i=0,s=!1;if(o&&e&&u(e)){const t=e.match(lt)||[];for(s=t.length>0;r=t[i++];)s=!!n(o,r)&&s}return s},at=(t,e)=>{ct(t,e,((t,e)=>t.remove(e)))},dt=(t,e)=>(ct(t,e,((t,e)=>t.add(e))),at.bind(0,t,e)),ut=(t,n,o,r)=>{if(t&&n){let i=!0;return e(o,(e=>{(r?r(t[e]):t[e])!==(r?r(n[e]):n[e])&&(i=!1)})),i}return!1},ht=(t,e)=>ut(t,e,["w","h"]),pt=(t,e)=>ut(t,e,["x","y"]),ft=(t,e)=>ut(t,e,["t","r","b","l"]),gt=(t,e,n)=>ut(t,e,["width","height"],n&&(t=>Math.round(t))),wt=()=>{},bt=(t,e)=>{let n,o,r,i=wt;const{g:s,v:l,p:c}=e||{},a=function(e){i(),st(n),n=o=void 0,i=wt,t.apply(this,e)},u=t=>c&&o?c(o,t):t,h=()=>{i!==wt&&a(u(r)||r)},f=function(){const t=$(arguments),e=p(s)?s():s,c=d(e)&&e>=0;if(c){const s=p(l)?l():l,c=d(s)&&s>=0,f=e>0?it:rt,g=e>0?st:ot,w=u(t)||t,b=a.bind(0,w);i();const v=f(b,e);i=()=>g(v),c&&!n&&(n=it(h,s)),o=r=w}else a(t)};return f.m=h,f},vt={opacity:1,zindex:1},yt=(t,e)=>{const n=e?parseFloat(t):parseInt(t,10);return n==n?n:0},mt=(t,e,n)=>null!=e?e[n]||e.getPropertyValue(n):t.style[n],xt=(t,e,n)=>{try{const{style:o}=t;l(o[e])?o.setProperty(e,n):o[e]=((t,e)=>!vt[t.toLowerCase()]&&d(e)?`${e}px`:e)(e,n)}catch(s){}},$t=t=>"rtl"===n(t,"direction"),Ot=(t,e,o)=>{const r=e?`${e}-`:"",i=o?`-${o}`:"",s=`${r}top${i}`,l=`${r}right${i}`,c=`${r}bottom${i}`,a=`${r}left${i}`,d=n(t,[s,l,c,a]);return{t:yt(d[s]),r:yt(d[l]),b:yt(d[c]),l:yt(d[a])}},{round:St}=Math,Lt={w:0,h:0},Ct=t=>t?{w:t.offsetWidth,h:t.offsetHeight}:Lt,Et=t=>t?{w:t.clientWidth,h:t.clientHeight}:Lt,Pt=t=>t?{w:t.scrollWidth,h:t.scrollHeight}:Lt,Tt=t=>{const e=parseFloat(n(t,"height"))||0,o=parseFloat(n(t,"width"))||0;return{w:o-St(o),h:e-St(e)}},Mt=t=>t.getBoundingClientRect();let Rt;const zt=t=>t.split(" "),Dt=(t,n,o,r)=>{e(zt(n),(e=>{t.removeEventListener(e,o,r)}))},At=(t,n,o,r)=>{var i;const s=(()=>{if(l(Rt)){Rt=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get(){Rt=!0}}))}catch(t){}}return Rt})(),c=null!=(i=s&&r&&r.S)?i:s,a=r&&r.$||!1,d=r&&r.C||!1,u=[],h=s?{passive:c,capture:a}:a;return e(zt(n),(e=>{const n=d?r=>{t.removeEventListener(e,n,a),o&&o(r)}:o;x(u,Dt.bind(null,t,e,n,a)),t.addEventListener(e,n,h)})),S.bind(0,u)},kt=t=>t.stopPropagation(),Bt={x:0,y:0},Ht=t=>{const e=t?Mt(t):0;return e?{x:e.left+window.pageYOffset,y:e.top+window.pageXOffset}:Bt},It=(t,n)=>{e(f(n)?n:[n],t)},Yt=t=>{const n=new Map,o=(t,e)=>{if(t){const o=n.get(t);It((t=>{o&&o[t?"delete":"clear"](t)}),e)}else n.forEach((t=>{t.clear()})),n.clear()},r=(t,e)=>{const r=n.get(t)||new Set;return n.set(t,r),It((t=>{t&&r.add(t)}),e),o.bind(0,t,e)};return e(C(t),(e=>{r(e,t[e])})),[r,o,(t,o)=>{const r=n.get(t);e($(r),(t=>{o&&!O(o)?t.apply(0,o):t()}))}]},Xt=t=>JSON.stringify(t,((t,e)=>{if(p(e))throw new Error;return e})),Vt={paddingAbsolute:!1,showNativeOverlaidScrollbars:!1,updating:{elementEvents:[["img","load"]],debounce:[0,33],attributes:null,ignoreMutation:null},overflow:{x:"scroll",y:"scroll"},scrollbars:{theme:"os-theme-dark",visibility:"auto",autoHide:"never",autoHideDelay:1300,dragScroll:!0,clickScroll:!1,pointers:["mouse","touch","pen"]}},jt=(t,n)=>{const o={};return e(C(n).concat(C(t)),(e=>{const r=t[e],i=n[e];if(g(r)&&g(i))E(o[e]={},jt(r,i));else if(L(n,e)&&i!==r){let t=!0;if(f(r)||f(i))try{Xt(r)===Xt(i)&&(t=!1)}catch(G){}t&&(o[e]=i)}})),o},Ft="os-environment",_t=`${Ft}-flexbox-glue`,Kt=`${_t}-max`,Nt="data-overlayscrollbars",Wt=`${Nt}-overflow-x`,Zt=`${Nt}-overflow-y`,Gt="overflowVisible",Jt="scrollbarHidden",qt="updating",Ut="os-padding",Qt="os-viewport",te=`${Qt}-arrange`,ee="os-content",ne=`${Qt}-scrollbar-hidden`,oe=`os-overflow-visible`,re="os-size-observer",ie=`${re}-appear`,se=`${re}-listener`,le=`${se}-scroll`,ce=`${se}-item`,ae=`${ce}-final`,de="os-trinsic-observer",ue="os-scrollbar",he=`${ue}-rtl`,pe=`${ue}-horizontal`,fe=`${ue}-vertical`,ge=`${ue}-track`,we=`${ue}-handle`,be=`${ue}-visible`,ve=`${ue}-cornerless`,ye=`${ue}-transitionless`,me=`${ue}-interaction`,xe=`${ue}-unusable`,$e=`${ue}-auto-hidden`,Oe=`${ge}-interactive`,Se=`${we}-interactive`,Le={},Ce=()=>Le,Ee="__osOptionsValidationPlugin",Pe=3333333,Te="scroll",Me="__osSizeObserverPlugin",Re={[Me]:{O:(t,e,o)=>{const r=N(`<div class="${ce}" dir="ltr"><div class="${ce}"><div class="${ae}"></div></div><div class="${ce}"><div class="${ae}" style="width: 200%; height: 200%"></div></div></div>`);j(t,r),dt(t,le);const i=r[0],s=i.lastChild,l=i.firstChild,c=null==l?void 0:l.firstChild;let a,d=Ct(i),u=d,h=!1;const p=()=>{D(l,Pe),A(l,Pe),D(s,Pe),A(s,Pe)},f=t=>{a=0,h&&(d=u,e(!0===t))},g=t=>{u=Ct(i),h=!t||!ht(u,d),t?(kt(t),h&&!a&&(ot(a),a=rt(f))):f(!1===t),p()},w=x([],[At(l,Te,g),At(s,Te,g)]);return n(c,{width:Pe,height:Pe}),rt(p),[o?g.bind(0,!1):p,w]}}};let ze=0;const{round:De,abs:Ae}=Math,ke="__osScrollbarsHidingPlugin",Be={[ke]:{A:t=>{const{T:e,I:n,L:o}=t,r=!(o||e||!n.x&&!n.y)&&document.createElement("style");return r&&(M(r,"id",`${te}-${ze}`),ze++),r},H:(t,o,r,i,s,l,c)=>[(e,o,l,c)=>{if(t){const{P:t}=s(),{D:a,M:d}=e,{x:u,y:h}=d,{x:p,y:f}=a,g=t[c?"paddingRight":"paddingLeft"],w=t.paddingTop,b=o.w+l.w,v=o.h+l.h,y={w:f&&h?`${f+b-g}px`:"",h:p&&u?`${p+v-w}px`:""};if(i){const{sheet:t}=i;if(t){const{cssRules:e}=t;if(e){e.length||t.insertRule(`#${M(i,"id")} + .${te}::before {}`,0);const n=e[0].style;n.width=y.w,n.height=y.h}}}else n(r,{"--os-vaw":y.w,"--os-vah":y.h})}return t},(i,a,d)=>{if(t){const u=d||l(i),{P:h}=s(),{M:p}=u,{x:f,y:g}=p,w={},b=t=>e(t.split(" "),(t=>{w[t]=h[t]}));f&&b("marginBottom paddingTop paddingBottom"),g&&b("marginLeft marginRight paddingLeft paddingRight");const v=n(r,C(w));return at(r,te),o||(w.height=""),n(r,w),[()=>{c(u,a,t,v),n(r,v),dt(r,te)},u]}return[wt]}],R:()=>{let t={w:0,h:0},e=0;return(n,o,r)=>{const i={w:window.innerWidth,h:window.innerHeight},s={w:i.w-t.w,h:i.h-t.h};if(0===s.w&&0===s.h)return;const l=Ae(s.w),c=Ae(s.h),a={w:Ae(De(i.w/(t.w/100))),h:Ae(De(i.h/(t.h/100)))},d=(()=>{const t=window.screen.deviceXDPI||0,e=window.screen.logicalXDPI||1;return window.devicePixelRatio||t/e})(),u=l>2&&c>2,h=!((t,e)=>{const n=Ae(t),o=Ae(e);return!(n===o||n+1===o||n-1===o)})(a.w,a.h);if(u&&h&&d!==e&&d>0){const[t,e]=o();E(n.k,t),e&&r()}t=i,e=d}}}};let He;const Ie=(t,e,n,o)=>{j(t,e);const r=Et(e),i=Ct(e),s=Tt(n);return o&&_(e),{x:i.h-r.h+s.h,y:i.w-r.w+s.w}},Ye=(t,e)=>{const o="hidden";n(t,{overflowX:o,overflowY:o,direction:"rtl"}),D(t,0);const r=Ht(t),i=Ht(e);D(t,-999);const s=Ht(e);return{i:r.x===i.x,n:i.x!==s.x}},Xe=(t,e)=>{const n=dt(t,_t),o=Mt(t),r=Mt(e),i=gt(r,o,!0),s=dt(t,Kt),l=Mt(t),c=Mt(e),a=gt(c,l,!0);return n(),s(),i&&a},Ve=()=>(He||(He=(()=>{const{body:t}=document,e=N(`<div class="${Ft}"><div></div></div>`)[0],r=e.firstChild,[i,,s]=Yt(),[l,c]=o({o:Ie(t,e,r),u:pt},Ie.bind(0,t,e,r,!0)),[a]=c(),d=(t=>{let e=!1;const o=dt(t,ne);try{e="none"===n(t,U("scrollbar-width"))||"none"===window.getComputedStyle(t,"::-webkit-scrollbar").getPropertyValue("display")}catch(r){}return o(),e})(e),u={x:0===a.x,y:0===a.y},h={host:null,padding:!d,viewport:t=>d&&t===t.ownerDocument.body&&t,content:!1,scrollbarsSlot:!0,cancel:{nativeScrollbarsOverlaid:!1,body:null}},p=E({},Vt),f={k:a,I:u,T:d,L:"-1"===n(e,"zIndex"),B:Ye(e,r),V:Xe(e,r),j:t=>i("_",t),Y:E.bind(0,{},h),q(t){E(h,t)},F:E.bind(0,{},p),G(t){E(p,t)},N:E({},h),U:E({},p)};if(z(e,"style"),_(e),!(d||u.x&&u.y)){let t;window.addEventListener("resize",(()=>{const e=Ce()[ke];t=t||e&&e.R(),t&&t(f,l,s.bind(0,"_"))}))}return f})()),He),je=(t,e)=>p(t)?t.apply(0,e):t,Fe=(t,e,n,o)=>{const r=l(o)?n:o;return je(r,t)||e()},_e=(t,e,n,o)=>{const r=l(o)?n:o,i=je(r,t);return!!i&&(v(i)?i:e())},Ke=new WeakMap,Ne=t=>Ke.get(t),We=(t,e)=>t?e.split(".").reduce(((t,e)=>t&&L(t,e)?t[e]:void 0),t):void 0,Ze=(t,e,n)=>o=>[We(t,o),n||void 0!==We(e,o)],Ge=t=>{let e=t;return[()=>e,t=>{e=E({},e,t)}]},Je="tabindex",qe=K.bind(0,""),Ue=t=>{j(Y(t),I(t)),_(t)},Qe=t=>{const e=Ve(),{Y:n,T:o}=e,r=Ce()[ke],i=r&&r.A,{host:s,viewport:l,padding:c,content:a}=n(),d=v(t),u=d?{}:t,{host:h,padding:p,viewport:f,content:g}=u,w=d?t:u.target,b=H(w,"textarea"),y=w.ownerDocument,$=w===y.body,O=y.defaultView,L=Fe.bind(0,[w]),E=_e.bind(0,[w]),P=L(qe,l,f),T=P===w,D=T&&$,A=!T&&O.top===O&&y.activeElement===w,k={X:w,J:b?L(qe,s,h):w,K:P,Z:!T&&E(qe,c,p),tt:!T&&E(qe,a,g),nt:!T&&!o&&i&&i(e),ot:D?y.documentElement:P,st:D?y:P,et:O,ct:y,rt:b,W:$,lt:d,it:T,ut:(t,e)=>T?((t,e,n)=>{const o=M(t,e)||"";return new Set(o.split(" ")).has(n)})(P,Nt,e):((t,e)=>ct(t,e,((t,e)=>t.contains(e))))(P,t),dt:(t,e,n)=>T?R(P,Nt,e,n):(n?dt:at)(P,t)},B=C(k).reduce(((t,e)=>{const n=k[e];return x(t,!(!n||Y(n))&&n)}),[]),X=t=>t?m(B,t)>-1:null,{X:K,J:N,Z:W,K:Z,tt:G,nt:J}=k,q=[],U=b&&X(N);let Q=b?K:I([G,Z,W,N,K].find((t=>!1===X(t))));const tt=G||Z;return[k,()=>{const t=((t,e)=>(M(t,Nt,e),z.bind(0,t,Nt)))(N,T?"viewport":"host"),e=dt(W,Ut),n=dt(Z,!T&&Qt),r=dt(G,ee),i=$?dt(Y(w),ne):wt;if(U&&(F(K,N),x(q,(()=>{F(N,K),_(N)}))),j(tt,Q),j(N,W),j(W||N,!T&&Z),j(Z,G),x(q,(()=>{i(),t(),z(Z,Wt),z(Z,Zt),X(G)&&Ue(G),X(Z)&&Ue(Z),X(W)&&Ue(W),e(),n(),r()})),o&&!T&&x(q,at.bind(0,Z,ne)),J&&(((t,e)=>{V(Y(t),t,e)})(Z,J),x(q,_.bind(0,J))),A){const t=M(Z,Je);M(Z,Je,"-1"),Z.focus();const e=At(y,"pointerdown keydown",(()=>{t?M(Z,Je,t):z(Z,Je),e()}))}Q=0},S.bind(0,q)]},tn=(t,e)=>{const{tt:o}=t,[r]=e;return t=>{const{V:e}=Ve(),{ft:i}=r(),{_t:s}=t,l=(o||!e)&&s;return l&&n(o,{height:i?"":"100%"}),{ht:l,gt:l}}},en=(t,e)=>{const[r,i]=e,{J:s,Z:l,K:c,it:a}=t,[d,u]=o({u:ft,o:Ot()},Ot.bind(0,s,"padding",""));return(t,e,o)=>{let[s,h]=u(o);const{T:p,V:f}=Ve(),{vt:g}=r(),{ht:w,gt:b,wt:v}=t,[y,m]=e("paddingAbsolute");(w||h||!f&&b)&&([s,h]=d(o));const x=!a&&(m||v||h);if(x){const t=!y||!l&&!p,e=s.r+s.l,o=s.t+s.b,r={marginRight:t&&!g?-e:0,marginBottom:t?-o:0,marginLeft:t&&g?-e:0,top:t?-s.t:0,right:t?g?-s.r:"auto":0,left:t?g?"auto":-s.l:0,width:t?`calc(100% + ${e}px)`:""},a={paddingTop:t?s.t:0,paddingRight:t?s.r:0,paddingBottom:t?s.b:0,paddingLeft:t?s.l:0};n(l||c,r),n(c,a),i({Z:s,bt:!t,P:l?a:E({},r,a)})}return{yt:x}}},{max:nn}=Math,on=nn.bind(0,0),rn="visible",sn="hidden",ln=42,cn={u:ht,o:{w:0,h:0}},an={u:pt,o:{x:sn,y:sn}},dn=(t,e,n)=>n?dt(t,e):at(t,e),un=t=>0===t.indexOf(rn),hn=(t,e)=>{const[r,i]=e,{J:s,Z:l,K:c,nt:a,it:d,dt:u,W:h,et:p}=t,{k:f,V:g,T:w,I:b}=Ve(),v=Ce()[ke],y=!d&&!w&&(b.x||b.y),m=h&&d,[x,$]=o(cn,Tt.bind(0,c)),[O,S]=o(cn,Pt.bind(0,c)),[L,C]=o(cn),[E,P]=o(cn),[T]=o(an),z=(t,e)=>{if(n(c,{height:""}),e){const{bt:e,Z:o}=r(),{St:i,D:l}=t,a=Tt(s),d=Et(s),u="content-box"===n(c,"boxSizing"),h=e||u?o.b+o.t:0,p=!(b.x&&u);n(c,{height:d.h+a.h+(i.x&&p?l.x:0)-h})}},D=(t,e)=>{const o=w||t?0:ln,r=(t,r,i)=>{const s=n(c,t),l="scroll"===(e?e[t]:s);return[s,l,l&&!w?r?o:i:0,r&&!!o]},[i,s,l,a]=r("overflowX",b.x,f.x),[d,u,h,p]=r("overflowY",b.y,f.y);return{xt:{x:i,y:d},St:{x:s,y:u},D:{x:l,y:h},M:{x:a,y:p}}},A=(t,e,n,o)=>{const{D:i,M:s}=t,{x:l,y:c}=s,{x:a,y:d}=i,{P:u}=r(),h=e?"marginLeft":"marginRight",p=e?"paddingLeft":"paddingRight",f=u[h],g=u.marginBottom,w=u[p],b=u.paddingBottom;o.width=`calc(100% + ${d+-1*f}px)`,o[h]=-d+f,o.marginBottom=-a+g,n&&(o[p]=w+(c?d:0),o.paddingBottom=b+(l?a:0))},[k,B]=v?v.H(y,g,c,a,r,D,A):[()=>y,()=>[wt]];return(t,e,o)=>{const{ht:a,$t:h,gt:f,yt:v,_t:y,wt:H}=t,{ft:I,vt:Y}=r(),[X,V]=e("showNativeOverlaidScrollbars"),[j,F]=e("overflow"),_=X&&b.x&&b.y,K=!d&&!g&&(a||f||h||V||y),N=un(j.x),W=un(j.y),Z=N||W;let G,J=$(o),q=S(o),U=C(o),Q=P(o);if(V&&w&&u(ne,Jt,!_),K&&(G=D(_),z(G,I)),a||v||f||H||V){Z&&u(oe,Gt,!1);const[t,e]=B(_,Y,G),[n,r]=J=x(o),[i,s]=q=O(o),l=Et(c);let a=i,d=l;t(),(s||r||V)&&e&&!_&&k(e,i,n,Y)&&(d=Et(c),a=Pt(c));const h={w:on(nn(i.w,a.w)+n.w),h:on(nn(i.h,a.h)+n.h)},f={w:on(m?p.innerWidth:d.w+on(l.w-i.w)+n.w),h:on(m?p.innerHeight:d.h+on(l.h-i.h)+n.h)};Q=E(f),U=L(((t,e)=>{const n=window.devicePixelRatio%1!=0?1:0,o={w:on(t.w-e.w),h:on(t.h-e.h)};return{w:o.w>n?o.w:0,h:o.h>n?o.h:0}})(h,f),o)}const[tt,et]=Q,[nt,ot]=U,[rt,it]=q,[st,lt]=J,ct={x:nt.w>0,y:nt.h>0},at=N&&W&&(ct.x||ct.y)||N&&ct.x&&!ct.y||W&&ct.y&&!ct.x;if(v||H||lt||it||et||ot||F||V||K){const t={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},e=((t,e,n,o)=>{const r=(t,e)=>{const n=un(t),o=e&&n&&t.replace(`${rn}-`,"")||"";return[e&&!n?t:"",un(o)?"hidden":o]},[i,s]=r(n.x,e.x),[l,c]=r(n.y,e.y);return o.overflowX=s&&l?s:i,o.overflowY=c&&i?c:l,D(t,o)})(_,ct,j,t),o=k(e,rt,st,Y);d||A(e,Y,o,t),K&&z(e,I),d?(M(s,Wt,t.overflowX),M(s,Zt,t.overflowY)):n(c,t)}R(s,Nt,Gt,at),dn(l,oe,at),!d&&dn(c,oe,Z);const[dt,ut]=T(D(_).xt);return i({xt:dt,Ct:{x:tt.w,y:tt.h},Ot:{x:nt.w,y:nt.h},Et:ct}),{At:ut,Tt:et,zt:ot}}},pn=(t,n,o)=>{const r={},i=n||{};return e(C(t).concat(C(i)),(e=>{const n=t[e],s=i[e];r[e]=!!(o||n||s)})),r},fn=3333333,gn=t=>t&&(t.height||t.width),wn=(t,e,n)=>{const{It:r=!1,Lt:i=!1}=n||{},s=Ce()[Me],{B:l}=Ve(),c=N(`<div class="${re}"><div class="${se}"></div></div>`)[0],a=c.firstChild,d=$t.bind(0,t),[u]=o({o:void 0,_:!0,u:(t,e)=>!(!t||!gn(t)&&gn(e))}),p=t=>{const n=f(t)&&t.length>0&&g(t[0]),o=!n&&h(t[0]);let i=!1,s=!1,a=!0;if(n){const[e,,n]=u(t.pop().contentRect),o=gn(e),r=gn(n);i=!n||!o,s=!r&&o,a=!i}else o?[,a]=t:s=!0===t;if(r&&a){const e=o?t[0]:$t(c);D(c,e?l.n?-fn:l.i?0:fn:fn),A(c,fn)}i||e({ht:!o,Ht:o?t:void 0,Lt:!!s})},w=[];let b=!!i&&p;return[()=>{S(w),_(c)},()=>{if(nt){const t=new nt(p);t.observe(a),x(w,(()=>{t.disconnect()}))}else if(s){const[t,e]=s.O(a,p,i);b=t,x(w,e)}if(r){const[t]=o({o:!d()},d);x(w,At(c,"scroll",(e=>{const n=t(),[o,r]=n;r&&(at(a,"ltr rtl"),dt(a,o?"rtl":"ltr"),p(n)),kt(e)})))}b&&(dt(c,ie),x(w,At(c,"animationstart",b,{C:!!nt}))),j(t,c)}]},bn=(t,e)=>{let n;const r=K(de),i=[],[s]=o({o:!1}),l=(t,n)=>{if(t){const o=s((t=>0===t.h||t.isIntersecting||t.intersectionRatio>0)(t)),[,r]=o;if(r)return!n&&e(o),[o]}},c=(t,e)=>{if(t&&t.length>0)return l(t.pop(),e)};return[()=>{S(i),_(r)},()=>{if(et)n=new et((t=>c(t)),{root:t}),n.observe(r),x(i,(()=>{n.disconnect()}));else{const t=()=>{const t=Ct(r);l(t)},[e,n]=wn(r,t);x(i,e),n(),t()}j(t,r)},()=>{if(n)return c(n.takeRecords(),!0)}]},vn=(t,n,o,r)=>{let i=!1;const{Pt:s,Dt:l,Mt:c,Rt:a,kt:d,Bt:h}=r||{},p=bt((()=>{i&&o(!0)}),{g:33,v:99}),[f,g]=((t,n,o)=>{let r,i=!1;const s=s=>{if(o){const l=o.reduce(((e,n)=>{if(n){const o=n[0],r=n[1],i=r&&o&&(s?s(o):B(o,t));i&&i.length&&r&&u(r)&&x(e,[i,r.trim()],!0)}return e}),[]);e(l,(t=>e(t[0],(e=>{const o=t[1],s=r.get(e);if(s){const t=s[0],e=s[1];t===o&&e()}const l=At(e,o,(t=>{i?(l(),r.delete(e)):n(t)}));r.set(e,[o,l])}))))}};return o&&(r=new WeakMap,s()),[()=>{i=!0},s]})(t,p,c),w=l||[],b=(s||[]).concat(w),v=(i,s)=>{const l=d||wt,c=h||wt,p=[],f=[];let b=!1,v=!1,y=!1;return e(i,(e=>{const{attributeName:o,target:i,type:s,oldValue:d,addedNodes:h}=e,g="attributes"===s,$="childList"===s,O=t===i,S=g&&u(o)?M(i,o):0,L=0!==S&&d!==S,C=m(w,o)>-1&&L;if(n&&!O){const n=!g,s=g&&C,u=s&&a&&H(i,a),p=(u?!l(i,o,d,S):n||s)&&!c(e,!!u,t,r);x(f,h),v=v||p,y=y||$}!n&&O&&L&&!l(i,o,d,S)&&(x(p,o),b=b||C)})),y&&!O(f)&&g((t=>f.reduce(((e,n)=>(x(e,B(t,n)),H(n,t)?x(e,n):e)),[]))),n?(!s&&v&&o(!1),[!1]):!O(p)||b?(!s&&o(p,b),[p,b]):void 0},y=new tt((t=>v(t)));return y.observe(t,{attributes:!0,attributeOldValue:!0,attributeFilter:b,subtree:n,childList:n,characterData:n}),i=!0,[()=>{i&&(f(),y.disconnect(),i=!1)},()=>{if(i){p.m();const t=y.takeRecords();return!O(t)&&v(t,!0)}}]},yn=`[${Nt}]`,mn=`.${Qt}`,xn=["tabindex"],$n=["wrap","cols","rows"],On=["id","class","style","open"],Sn=(t,n,r)=>{let i,s,l;const[,c]=n,{J:a,K:h,tt:g,rt:w,it:b,ut:v,dt:$}=t,{V:O}=Ve(),[S]=o({u:ht,o:{w:0,h:0}},(()=>{const t=v(oe,Gt),e=v(te,""),n=e&&D(h),o=e&&A(h);$(oe,Gt),$(te,""),$("",qt,!0);const r=Pt(g),i=Pt(h),s=Tt(h);return $(oe,Gt,t),$(te,"",e),$("",qt),D(h,n),A(h,o),{w:i.w+r.w+s.w,h:i.h+r.h+s.h}})),L=w?$n:On.concat($n),P=bt(r,{g:()=>i,v:()=>s,p(t,e){const[n]=t,[o]=e;return[C(n).concat(C(o)).reduce(((t,e)=>(t[e]=n[e]||o[e],t)),{})]}}),T=t=>{e(t||xn,(t=>{if(m(xn,t)>-1){const e=M(a,t);u(e)?M(h,t,e):z(h,t)}}))},R=(t,e)=>{const[n,o]=t,i={_t:o};return c({ft:n}),!e&&r(i),i},k=({ht:t,Ht:e,Lt:n})=>{const o=!t||n?r:P;let i=!1;if(e){const[t,n]=e;i=n,c({vt:t})}o({ht:t,wt:i})},B=(t,e)=>{const[,n]=S(),o={gt:n};return n&&!e&&(t?r:P)(o),o},H=(t,e,n)=>{const o={$t:e};return e?!n&&P(o):b||T(t),o},[I,Y,V]=g||!O?bn(a,R):[wt,wt,wt],[j,F]=b?[wt,wt]:wn(a,k,{Lt:!0,It:!0}),[_,K]=vn(a,!1,H,{Dt:On,Pt:On.concat(xn)}),N=b&&nt&&new nt(k.bind(0,{ht:!0}));return N&&N.observe(a),T(),[()=>{I(),j(),l&&l[0](),N&&N.disconnect(),_()},()=>{F(),Y()},()=>{const t={},e=K(),n=V(),o=l&&l[1]();return e&&E(t,H.apply(0,x(e,!0))),n&&E(t,R.apply(0,x(n,!0))),o&&E(t,B.apply(0,x(o,!0))),t},t=>{const[e]=t("updating.ignoreMutation"),[n,o]=t("updating.attributes"),[r,c]=t("updating.elementEvents"),[a,u]=t("updating.debounce"),w=t=>p(e)&&e(t);if((c||o)&&(l&&(l[1](),l[0]()),l=vn(g||h,!0,B,{Dt:L.concat(n||[]),Pt:L.concat(n||[]),Mt:r,Rt:yn,Bt:(t,e)=>{const{target:n,attributeName:o}=t;return!(e||!o||b)&&((t,e,n)=>{const o=t&&X(t,e),r=t&&((t,e)=>{const n=e?y(e)?e:null:document;return n?n.querySelector(t):null})(n,o),i=X(r,e)===o;return!(!o||!r)&&(o===t||r===t||i&&X(X(t,n),e)!==o)})(n,yn,mn)||!!X(n,`.${ue}`)||!!w(t)}})),u)if(P.m(),f(a)){const t=a[0],e=a[1];i=!!d(t)&&t,s=!!d(e)&&e}else d(a)?(i=a,s=!1):(i=!1,s=!1)}]},Ln={x:0,y:0},Cn={Z:{t:0,r:0,b:0,l:0},bt:!1,P:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},Ct:Ln,Ot:Ln,xt:{x:"hidden",y:"hidden"},Et:{x:!1,y:!1},ft:!1,vt:!1},{round:En}=Math,Pn=t=>({x:t.clientX,y:t.clientY}),Tn=(t,e)=>At(t,"mousedown",At.bind(0,e,"click",kt,{C:!0,$:!0}),{$:!0}),Mn=(t,e,n,o,r,i)=>{const{B:s}=Ve(),{qt:l,Ft:c,Gt:a}=n,d=`scroll${i?"Left":"Top"}`,u=`${i?"x":"y"}`,h=`${i?"w":"h"}`,p=(t,e,n)=>p=>{const{Ot:f}=r(),g=(Pn(p)[u]-e)*n/(Ct(c)[h]-Ct(l)[h])*f[u],w=$t(a)&&i?s.n||s.i?1:-1:1;o[d]=t+g*w};return At(l,"pointerdown",(n=>{if(((t,e,n)=>{const o=e.scrollbars,{button:r,isPrimary:i,pointerType:s}=t,{pointers:l}=o;return 0===r&&i&&o["dragScroll"]&&(l||[]).includes(s)})(n,t)){const t=At(e,"selectstart",(t=>(t=>t.preventDefault())(t)),{S:!1}),r=At(l,"pointermove",p(o[d]||0,Pn(n)[u],1/(t=>{const{width:e,height:n}=Mt(t),{w:o,h:r}=Ct(t);return{x:En(e)/o||1,y:En(n)/r||1}})(o)[u]));At(l,"pointerup",(e=>{t(),r(),l.releasePointerCapture(e.pointerId)}),{C:!0}),l.setPointerCapture(n.pointerId)}}))},{min:Rn,max:zn,abs:Dn,round:An}=Math,kn=(t,e,n,o)=>{if(o){const t=n?"x":"y",{Ot:e,Ct:r}=o,i=r[t],s=e[t];return zn(0,Rn(1,i/(i+s)))}const r=n?"w":"h",i=Ct(t)[r],s=Ct(e)[r];return zn(0,Rn(1,i/s))},Bn=(t,o,r)=>{const{Y:i}=Ve(),{scrollbarsSlot:s}=i(),{ct:l,X:c,J:a,K:d,lt:u,ot:p}=o,{scrollbarsSlot:f}=u?{}:t,g=_e([c,a,d],(()=>a),s,f),w=(t,n,o)=>{const r=o?dt:at;e(t,(t=>{r(t.Gt,n)}))},b=(t,o)=>{e(t,(t=>{const[e,r]=o(t);n(e,r)}))},v=(t,e,n)=>{b(t,(t=>{const{qt:o,Ft:r}=t;return[o,{[n?"width":"height"]:`${(100*kn(o,r,n,e)).toFixed(3)}%`}]}))},y=(t,e,n)=>{const o=n?"X":"Y";b(t,(t=>{const{qt:r,Ft:i,Gt:s}=t,l=((t,e,n,o,r,i)=>{const{B:s}=Ve(),l=i?"x":"y",c=i?"Left":"Top",{Ot:a}=o,d=An(a[l]),u=Dn(n[`scroll${c}`]),h=i&&r,p=s.i?u:d-u,f=Rn(1,(h?p:u)/d),g=kn(t,e,i);return 1/g*(1-g)*f})(r,i,p,e,$t(s),n);return[r,{transform:l==l?`translate${o}(${(100*l).toFixed(3)}%)`:""}]}))},m=[],$=[],L=[],C=(t,e,n)=>{const o=h(n),r=!o||!n;(!o||n)&&w($,t,e),r&&w(L,t,e)},E=t=>{const e=t?pe:fe,n=t?$:L,o=O(n)?ye:"",i=K(`${ue} ${e} ${o}`),s=K(ge),c=K(we),a={Gt:i,Ft:s,qt:c};return j(i,s),j(s,c),x(n,a),x(m,[_.bind(0,i),r(a,C,l,p,t)]),a},P=E.bind(0,!0),T=E.bind(0,!1);return P(),T(),[{Nt:t=>{v($,t,!0),v(L,t)},Ut:t=>{y($,t,!0),y(L,t)},Wt:C,Xt:{Jt:$,Kt:P,Zt:b.bind(0,$)},Qt:{Jt:L,Kt:T,Zt:b.bind(0,L)}},()=>{j(g,$[0].Gt),j(g,L[0].Gt),it((()=>{C(ye)}),300)},S.bind(0,m)]},Hn=t=>{let e;const n=t?it:rt,o=t?st:ot;return[r=>{o(e),e=n(r,p(t)?t():t)},()=>o(e)]},In=(t,n,o)=>{const{F:r,j:i}=Ve(),s=Ce(),a=v(t),d=a?t:t.target,u=Ne(d);if(n&&!u){let u=!1;const h=s[Ee],f=t=>{const e=t||{},n=h&&h.O;return n?n(e,!0):e},g=E({},r(),f(n)),[w,b,v]=Yt(o),[y,m,x]=((t,n)=>{const o=Ze(n,{}),r=Ge(Cn),[i,s,l]=Yt(),[c]=r,[a,d,u]=Qe(t),h=((t,n)=>{const{X:o,K:r,dt:i,it:s}=t,{T:l,I:c,V:a}=Ve(),d=!l&&(c.x||c.y),u=[tn(t,n),en(t,n),hn(t,n)];return(t,n,l)=>{const c=pn(E({ht:!1,yt:!1,wt:!1,_t:!1,Tt:!1,zt:!1,At:!1,$t:!1,gt:!1},n),{},l),h=d||!a,p=h&&D(r),f=h&&A(r);i("",qt,!0);let g=c;return e(u,(e=>{g=pn(g,e(g,t,!!l)||{},l)})),D(r,p),A(r,f),i("",qt),s||(D(o,0),A(o,0)),g}})(a,r),p=(t,e,n)=>{const o=C(t).some((e=>t[e]));(o||!P(e)||n)&&l("u",[t,e,n])},[f,g,w,b]=Sn(a,r,(t=>{p(h(o,t),{},!1)})),v=c.bind(0);return v.Vt=t=>{i("u",t)},v.jt=()=>{const{X:t,K:e}=a,n=D(t),o=A(t);g(),d(),D(e,n),A(e,o)},v.Yt=a,[(t,e)=>{const o=Ze(n,t,e);b(o),p(h(o,w(),e),t,!!e)},v,()=>{s(),f(),u()}]})(t,g),[$,O,L]=((t,e,n)=>{let o,r,i,s,l,c=0;const a=Ge({}),[d]=a,[u,h]=Hn(),[p,f]=Hn(),[g,w]=Hn(100),[b,v]=Hn(100),[y,m]=Hn((()=>c)),[x,$,O]=Bn(t,n.Yt,((t,e)=>(n,o,r,i,s)=>{const{Gt:l}=n;return S.bind(0,[At(l,"pointerenter",(()=>{o(me,!0)})),At(l,"pointerleave pointercancel",(()=>{o(me)})),Tn(l,r),Mn(t,r,n,i,e,s)])})(e,n)),{J:L,K:C,ot:E,st:P,it:T,W:M}=n.Yt,{Xt:R,Qt:z,Wt:k,Nt:B,Ut:H}=x,{Zt:I}=R,{Zt:X}=z,V=t=>{const{Gt:e}=t,n=T&&!M&&Y(e)===C&&e;return[n,{transform:n?`translate(${D(E)}px, ${A(E)}px)`:""}]},j=(t,e)=>{if(m(),t)k($e);else{const t=()=>k($e,!0);c>0&&!e?y(t):t()}},F=()=>{s=r,s&&j(!0)},_=[w,m,v,f,h,O,At(L,"pointerover",F,{C:!0}),At(L,"pointerenter",F),At(L,"pointerleave",(()=>{s=!1,r&&j(!1)})),At(L,"pointermove",(()=>{o&&u((()=>{w(),j(!0),b((()=>{o&&j(!1)}))}))})),At(P,"scroll",(()=>{p((()=>{H(n()),i&&j(!0),g((()=>{i&&!s&&j(!1)}))})),T&&I(V),T&&X(V)}))],K=d.bind(0);return K.Yt=x,K.jt=$,[(t,s,a)=>{const{Tt:d,zt:u,At:h,wt:p}=a,f=Ze(e,t,s),g=n(),{Ot:w,xt:b,vt:v}=g,[y,m]=f("scrollbars.theme"),[x,$]=f("scrollbars.visibility"),[O,S]=f("scrollbars.autoHide"),[L]=f("scrollbars.autoHideDelay"),[C,E]=f("scrollbars.dragScroll"),[P,T]=f("scrollbars.clickScroll"),R=d||u||p||s,z=h||$||s,D=(t,e)=>{const n="visible"===x||"auto"===x&&"scroll"===t;return k(be,n,e),n};if(c=L,m&&(k(l),k(y,!0),l=y),S&&(o="move"===O,r="leave"===O,i="never"!==O,j(!i,!0)),E&&k(Se,C),T&&k(Oe,P),z){const t=D(b.x,!0),e=D(b.y,!1);k(ve,!(t&&e))}R&&(B(g),H(g),k(xe,!w.x,!0),k(xe,!w.y,!1),k(he,v&&!M))},K,S.bind(0,_)]})(t,g,m),T=(t,e)=>{y(t,!!e)},M=i(T.bind(0,{},!0)),R=t=>{(t=>{Ke.delete(t)})(d),M(),L(),x(),u=!0,v("destroyed",[z,!!t]),b()},z={options(t){if(t){const e=jt(g,f(t));P(e)||(E(g,e),T(e))}return E({},g)},on:w,off:(t,e)=>{t&&e&&b(t,e)},state(){const{Ct:t,Ot:e,xt:n,Et:o,Z:r,bt:i,vt:s}=m();return E({},{overflowEdge:t,overflowAmount:e,overflowStyle:n,hasOverflow:o,padding:r,paddingAbsolute:i,directionRTL:s,destroyed:u})},elements(){const{X:t,J:e,Z:n,K:o,tt:r,ot:i,st:s}=m.Yt,{Xt:l,Qt:c}=O.Yt,a=t=>{const{qt:e,Ft:n,Gt:o}=t;return{scrollbar:o,track:n,handle:e}},d=t=>{const{Jt:e,Kt:n}=t,o=a(e[0]);return E({},o,{clone:()=>{const t=a(n());return $({},!0,{}),t}})};return E({},{target:t,host:e,padding:n||o,viewport:o,content:r||o,scrollOffsetElement:i,scrollEventElement:s,scrollbarHorizontal:d(l),scrollbarVertical:d(c)})},update:t=>(T({},t),z),destroy:R.bind(0)};return m.Vt(((t,e,n)=>{$(e,n,t)})),e(C(s),(t=>{const e=s[t];p(e)&&e(In,z)})),((t,e)=>{const{nativeScrollbarsOverlaid:n,body:o}=t||{},{W:r}=e,{Y:i,I:s,T:a}=Ve(),{nativeScrollbarsOverlaid:d,body:u}=i().cancel,h=null!=n?n:d,p=l(o)?u:o,f=(s.x||s.y)&&h,g=r&&(c(p)?!a:p);return!!f||!!g})(!a&&t.cancel,m.Yt)?(R(!0),z):(m.jt(),O.jt(),((t,e)=>{Ke.set(t,e)})(d,z),v("initialized",[z]),m.Vt(((t,e,n)=>{const{ht:o,wt:r,_t:i,Tt:s,zt:l,At:c,gt:a,$t:d}=t;v("updated",[z,{updateHints:{sizeChanged:o,directionChanged:r,heightIntrinsicChanged:i,overflowEdgeChanged:s,overflowAmountChanged:l,overflowStyleChanged:c,contentMutation:a,hostMutation:d},changedOptions:e,force:n}])})),z.update(!0))}return u};return In.plugin=t=>{e(f(t)?t:[t],(t=>{const e=C(t)[0];Le[e]=t[e]}))},In.valid=t=>{const e=t&&t.elements,n=p(e)&&e();return b(n)&&!!Ne(n.target)},In.env=()=>{const{k:t,I:e,T:n,B:o,V:r,L:i,N:s,U:l,Y:c,q:a,F:d,G:u}=Ve();return E({},{scrollbarsSize:t,scrollbarsOverlaid:e,scrollbarsHiding:n,rtlScrollBehavior:o,flexboxGlue:r,cssCustomProperties:i,staticDefaultInitialization:s,staticDefaultOptions:l,getDefaultInitialization:c,setDefaultInitialization:a,getDefaultOptions:d,setDefaultOptions:u})},t.OverlayScrollbars=In,t.scrollbarsHidingPlugin=Be,t.sizeObserverPlugin=Re,Object.defineProperties(t,{tn:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),t}({}); |