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