mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-22 15:40: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,s=n;const a=(t,e)=>{const n=s,a=t,l=e||(r?!r(n,a):n!==a);return(l||o)&&(s=a,i=n),[s,l,i]};return[e?t=>a(e(s,i),t):a,t=>[s,!!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 s(t){return"number"==typeof t}function a(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=s(e)&&e>-1&&e%1==0;return!!(u(t)||!c(t)&&n)&&(!(e>0&&d(t))||e-1 in t)}function g(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 s="constructor",a=t[s],l=a&&a.prototype,c=r.call(t,s),u=l&&r.call(l,"isPrototypeOf");if(a&&!c&&!u)return!1;for(e in t);return o(e)||r.call(t,e)}function f(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),b=(t,e,n)=>(n||a(e)||!_(e)?t.push(e):Array.prototype.push.apply(t,e),t),w=t=>{if(Array.from&&t)return Array.from(t);const e=[];return t instanceof Set?t.forEach(t=>{b(e,t)}):v(t,t=>{b(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,s,a){const l=[e,n,r,o,s,a];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&&(g(r)||o)){const e=t[n];let i=e;o&&!u(e)?i=[]:o||g(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 M=Element.prototype,A=(t,e)=>{const n=[],r=e?h(e)?e:null:document;return r?b(n,r.querySelectorAll(t)):n},T=(t,e)=>{if(h(t)){return(M.matches||M.msMatchesSelector).call(t,e)}return!1},R=t=>t?w(t.childNodes):[],j=t=>t?t.parentElement:null,V=(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))}},P=(t,e)=>{V(t,null,e)},E=(t,e)=>{V(t,t&&t.firstChild,e)},H=(t,e)=>{V(j(t),t&&t.nextSibling,e)},B=t=>{if(_(t))v(w(t),t=>B(t));else if(t){const e=j(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(R(e),t=>B(t))},N=t=>t.charAt(0).toUpperCase()+t.slice(1),G=["-webkit-","-moz-","-o-","-ms-"],q=["WebKit","Moz","O","MS","webkit","moz","o","ms"],Y={},F={},W=t=>{let e=F[t];if(S(F,t))return e;const n=N(t),r=k().style;return v(G,o=>{const i=o.replace(/-/g,""),s=[t,o+t,i+n,N(i)+n];return!(e=s.find(t=>void 0!==r[t]))}),F[t]=e||""},X=t=>{let e=Y[t]||window[t];return S(Y,t)||(v(q,n=>(e=e||window[n+N(t)],!e)),Y[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&&a(e)){const s=e.match(tt)||[];for(i=s.length>0;r=s[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}),st=t=>t?{w:t.offsetWidth,h:t.offsetHeight}:ot,at=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)})},gt=(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})(),s=i&&r&&r._||!1,a=r&&r.g||!1,l=r&&r.v||!1,c=[],u=i?{passive:s,capture:a}:a;return v(dt(e),e=>{const r=l?o=>{t.removeEventListener(e,r,a),n&&n(o)}:n;b(c,_t.bind(null,t,e,r,a)),t.addEventListener(e,r,u)}),m.bind(0,c)},ft=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"]),bt=(t,e,n)=>ht(t,e,["width","height"],n&&(t=>Math.round(t))),wt=t=>{t&&window.clearTimeout(t),t&&Q(t)},yt=()=>{},mt=(t,e)=>{let n,r,o,i;const{p:a,m:l,S:u}=e||{},d=window.setTimeout,_=function(e){wt(n),wt(r),r=n=o=void 0,t.apply(this,e)},g=t=>u&&o?u(o,t):t,f=()=>{n&&_(g(i)||i)},h=function(){const t=w(arguments),e=c(a)?a():a,u=s(e)&&e>=0;if(u){const a=c(l)?l():l,u=s(a)&&a>=0,h=e>0?d:Z,v=g(t)||t,p=_.bind(0,v);wt(n),n=h(p,e),u&&!r&&(r=d(f,a)),o=i=v}else _(t)};return h.O=f,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()]&&s(e)?`${e}px`:e)(e,n)}}catch(r){}};function $t(t,e){const n=a(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}`,s=`${r}right${o}`,a=`${r}bottom${o}`,l=`${r}left${o}`,c=$t(t,[i,s,a,l]);return{t:xt(c[i]),r:xt(c[s]),b:xt(c[a]),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},Mt="os-environment",At=`${Mt}-flexbox-glue`,Tt=`${At}-max`,Rt="os-host",jt="os-padding",Vt="os-viewport",Pt=`${Vt}-arrange`,Et="os-content",Ht=`${Vt}-scrollbar-styled`,Bt="os-size-observer",kt=`${Bt}-appear`,Dt=`${Bt}-listener`,Nt=`${Dt}-scroll`,Gt=`${Dt}-item`,qt=`${Gt}-final`,Yt="os-trinsic-observer",Ft="os-scrollbar",Wt=`${Ft}-horizontal`,Xt=`${Ft}-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(s){}t&&(n[r]=i)}}),n};let re;const{abs:oe,round:ie}=Math,se=(t,e)=>{P(t,e);const n=at(e),r=st(e);return{x:r.h-n.h,y:r.w-n.w}},ae=(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,At);const n=ct(t),r=ct(e),o=bt(r,n,!0);nt(t,Tt);const i=ct(t),s=ct(e),a=bt(s,i,!0);return o&&a},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="${Mt}"><div></div></div>`)[0],n=e.firstChild,r=new Set,o=se(t,e),i=(t=>{let e=!1;nt(t,Ht);try{e="none"===$t(t,W("scrollbar-width"))||"none"===window.getComputedStyle(t,"::-webkit-scrollbar").getPropertyValue("display")}catch(n){}return e})(e),s={x:0===o.x,y:0===o.y},a={$:null,I:null,L:null,M:null,A:null};let l=a,c=ee;const u={T:o,R:s,j:i,V:"-1"===$t(e,"zIndex"),P:ae(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)},G:()=>Qt({},c),q(t){c=O({},c,t)},Y:a,F:c};if(z(e,"style"),B(e),!(i||s.x&&s.y)){let n=it(),i=ce(),s=o;window.addEventListener("resize",()=>{if(r.size){const o=it(),a={w:o.w-n.w,h:o.h-n.h};if(0===a.w&&0===a.h)return;const l={w:oe(a.w),h:oe(a.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),g=u!==i&&i>0;if(d&&_&&g){const n=re.T=se(t,e);B(e),s.x===n.x&&s.y===n.y||m(r),s=n}n=o,i=u}})}return u},de=()=>(re||(re=ue()),re);let _e=0;const ge=t=>{P(j(t),R(t)),B(t)},fe=()=>{const{j:t,R:e,V:n}=de(),r=!!(!n&&!t&&(e.x||e.y))&&document.createElement("style");return r&&($(r,"id",`${Pt}-${_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,j:n}=de(),{$:r,I:o,L:i,M:s}=e(),a=f(t),l=t,c=a?t:l.target,u=T(c,"textarea"),d=!u&&T(c,"body"),_=c.ownerDocument,g=_.body,h=_.defaultView,v={W:c,$:u?he(c,l.host,r,Rt):c,I:he(c,l.viewport,o,Vt),L:ve(c,l.padding,i,jt,!n),M:ve(c,l.content,s,Et,!1),X:fe()},w={U:h,J:_,K:j(g),Z:g,tt:u,et:d,nt:a},y=x(v).reduce((t,e)=>{const n=v[e];return b(t,!(!n||j(n))&&n)},[]),S=t=>t?p(y,t)>-1:null,{W:O,$:C,L:$,I:z,M:I,X:L}=v,M=[],A=u&&S(C),E=u?O:R([I,z,$,C,O].find(t=>!1===S(t))),k=I||z;var D,N;return A&&(H(O,C),b(M,()=>{H(C,O),B(C)})),P(k,E),P(C,$),P($||C,z),P(z,I),nt(C,Rt),nt($,jt),nt(z,Vt),nt(I,Et),b(M,()=>{a?(P(C,R(k)),B($||z),rt(C,Rt)):(S(I)&&ge(I),S(z)&&ge(z),S($)&&ge($),rt(C,Rt),rt($,jt),rt(z,Vt),rt(I,Et))}),n&&b(M,rt.bind(0,z,Ht)),L&&(N=L,V(j(D=z),D,N),b(M,B.bind(0,L))),{rt:v,ot:w,it:()=>{m(M)}}},be=t=>{const e=k(`${Ft} ${t}`),n=k(Ut),r=k(Jt);return P(e,n),P(n,r),{st:e,lt:n,ct:r}},we="animationstart",ye="scroll",me=3333333,Se=t=>"rtl"===$t(t,"direction"),xe=t=>t&&(t.height||t.width),Oe=(e,n,r)=>{const{ut:o=!1,dt:i=!1}=r||{},{P:s}=de(),a=D(`<div class="${Bt}"><div class="${Dt}"></div></div>`)[0],c=a.firstChild,_=Se.bind(0,a),[g]=t({o:void 0,u:!0,s:(t,e)=>!(!t||!xe(t)&&xe(e))}),f=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]=g(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(a);I(a,e?s.n?-me:s.i?0:me:me),L(a,me)}i||n({_t:!r,gt:r?t:void 0,dt:!!c})},h=[];let v,p=!!i&&f;if(K){const t=new K(f);t.observe(c),b(h,()=>{t.disconnect()})}else{const t=D(`<div class="${Gt}" dir="ltr"><div class="${Gt}"><div class="${qt}"></div></div><div class="${Gt}"><div class="${qt}" style="width: 200%; height: 200%"></div></div></div>`);P(c,t),nt(c,Nt);const e=t[0],n=e.lastChild,r=e.firstChild,o=null==r?void 0:r.firstChild;let s,a=st(e),l=a,u=!1;const d=()=>{I(r,me),L(r,me),I(n,me),L(n,me)},_=t=>{s=0,u&&(a=l,f(!0===t))},g=t=>{l=st(e),u=!t||!vt(l,a),t?(ft(t),u&&!s&&(Q(s),s=Z(_))):_(!1===t),d()};b(h,[gt(r,ye,g),gt(n,ye,g)]),$t(o,{width:me,height:me}),d(),p=i?g.bind(0,!1):d}if(o){v=t({o:!_()},_);const[e]=v;b(h,gt(a,ye,t=>{const n=e(),[r,o]=n;o&&(rt(c,"ltr rtl"),nt(c,r?"rtl":"ltr"),f(n)),ft(t)}))}return p&&(nt(a,kt),b(h,gt(a,we,p,{v:!!K}))),E(e,a),{it(){m(h),B(a)},ft:t=>({ht:v?v[1](t):[!1,!1,!1]})}},Ce=(t,e,n,r)=>{let o=!1;const{vt:i,pt:s,bt:l,wt:c,yt:u,St:d,xt:_}=r||{},{it:g,Ot:f}=((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],s=o&&r&&(i?i(r):A(r,t));s&&s.length&&o&&a(o)&&b(e,[s,o.trim()],!0)}return e},[]),t=>v(t[0],n=>{const i=t[1],s=r.get(n);if(s){const t=s[0],e=s[1];t===i&&e()}const a=gt(n,i,t=>{o?(a(),r.delete(n)):e(t)});r.set(n,[i,a])}))}};return n&&(r=new WeakMap,i()),{it:()=>{o=!0},Ot:i}})(t,mt(()=>{o&&n(!0)},{p:33,m:99}),l),h=s||[],w=(i||[]).concat(h),m=o=>{const i=(e?d:u)||yt,s=_||yt,l=[],g=[];let w=!1,m=!1,S=!1;v(o,n=>{const{attributeName:o,target:u,type:d,oldValue:_,addedNodes:f}=n,v="attributes"===d,y="childList"===d,x=t===u,O=v&&a(o)?$(u,o):0,C=0!==O&&_!==O,z=p(h,o)>-1&&C;if(e&&!x){const e=!v,a=v&&z,l=a&&c&&T(u,c),d=(l?!i(u,o,_,O):e||a)&&!s(n,!!l,t,r);b(g,f),m=m||d,S=S||y}!e&&x&&C&&!i(u,o,_,O)&&(b(l,o),w=w||z)}),S&&!y(g)&&f(t=>g.reduce((e,n)=>(b(e,A(t,n)),T(n,t)?b(e,n):e),[])),e?m&&n(!1):y(l)&&!w||n(l,w)},S=new U(m);return S.observe(t,{attributes:!0,attributeOldValue:!0,attributeFilter:w,subtree:e,childList:e,characterData:e}),o=!0,{it:()=>{o&&(g(),S.disconnect(),o=!1)},Ct:()=>{o&&m(S.takeRecords())}}},$e="os-",ze=["tabindex"],Ie=["wrap","cols","rows"],Le=["id","class","style","open"],Me=(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},Ae=(e,n)=>{let r,o,i;const{$t:l}=e,{rt:c,ot:d}=l,{$:_,I:g,M:f}=c,{tt:h}=d,{j:w,H:y}=de(),S=h?Ie:Le.concat(Ie),x=mt(n,{p:()=>r,m:()=>o,S(t,e){const{_t:n,zt:r,It:o}=t[0],{_t:i,zt:s,It:a}=e[0];return[{_t:n||i,zt:r||s,It:o||a}]}}),O=t=>{v(t||ze,t=>{if(p(ze,t)>-1){const e=$(_,t);a(e)?$(g,t,e):z(g,t)}})},C=t=>{(t?n:x)({It:!0})},I=(f||!y)&&((e,n)=>{const r=k(Yt),o=[],[i,s]=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),b(o,()=>{t.disconnect()})}else{const t=()=>{const t=st(r);a(t)};b(o,Oe(r,t).it),t()}return E(e,r),{it(){m(o),B(r)},ft:t=>({Lt:s(t)})}})(_,t=>{n({Lt:t})}),L=Oe(_,({_t:t,gt:e,dt:r})=>{(!t||r?n:x)({_t:t,ht:e})},{dt:!0,ut:!w}),M=Ce(_,!1,(t,e)=>{e?x({zt:!0}):O(t)},{pt:Le,vt:Le.concat(ze),yt:Me});return O(),{Mt:I,At:L,Tt:t=>{const[e,n]=t("updating.elementEvents"),[a,l]=t("updating.attributes"),[c,d]=t("updating.debounce");if((n||l)&&(i&&(i.Ct(),i.it()),i=Ce(f||g,!0,C,{pt:S.concat(a||[]),vt:S.concat(a||[]),bt:e,St:Me})),d)if(x.O(),u(c)){const t=c[0],e=c[1];r=!!s(t)&&t,o=!!s(e)&&e}else s(c)?(r=c,o=!1):(r=!1,o=!1)},it(){i&&i.it(),I&&I.it(),L.it(),M.it()}}},Te=t=>{const{$t:e}=t,{M:n}=e.rt;return t=>{const{Lt:e}=t,[r,o]=e;return o&&$t(n,{height:r?"":"100%",display:r?"":"inline"}),{_t:o,It:o}}},Re=e=>{const{$t:n,Rt:r}=e,{$:o,L:i,I:s}=n.rt,[a,l]=t({s:pt,o:zt()},zt.bind(0,o,"padding",""));return(t,e,n)=>{let[o,c]=l(n);const{j:u,H:d}=de(),{_t:_,ht:g,It:f}=t,[h,v]=g,[p,b]=e("paddingAbsolute");(_||c||!d&&f)&&([o,c]=a(n));const w=b||v||c;if(w){const t=!p||!i&&!u,e=o.r+o.l,n=o.t+o.b,a={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||s,a),$t(s,l),r({jt:{Vt:!t,L:o},Pt:i?l:Qt({},a,l)})}return{Et:w}}},{max:je,abs:Ve,round:Pe}=Math,Ee=42,He={s:vt,o:{w:0,h:0}},Be=t=>{const e=st(t),n=ct(t);return{w:n.width-e.w,h:n.height-e.h}},ke=()=>window.devicePixelRatio%1==0?0:1,De=(t,e,n,r)=>{const o=t?"overflowX":"overflowY",i=0===n.indexOf("visible"),s="visible-hidden"===n,a="scroll"===n,l=e>0;return i&&(r[o]="visible"),a&&l&&(r[o]=n),{Ht:i,Bt:s?"hidden":"scroll"}},Ne=e=>{const{$t:n,kt:r,Dt:o,Rt:i}=e,{$:s,I:a,X:l}=n.rt,[c,u]=t(He,Be.bind(0,a)),[d,_]=t(He,lt.bind(0,a)),[g,f]=t(He),h=(t,e)=>{if($t(a,{height:""}),e){const{R:e}=de(),{Vt:n,L:r}=o().jt,{Nt:i,Gt:l}=t,c=Be(s),u=at(s),d="content-box"===$t(a,"boxSizing"),_=n||d?r.b+r.t:0,g=u.h+(Ve(c.h)<1?c.h:0),f=!(e.x&&d);$t(a,{height:g+(i.x&&f?l.x:0)-_})}},p=(t,e)=>{const{T:n,R:r,j:o}=de(),{x:i,y:s}=r,l=o||t?0:Ee,c=!e?$t(a,["overflowX","overflowY"]):e,u={x:"scroll"===c.overflowX,y:"scroll"===c.overflowY},d={x:i?l:n.x,y:s?l:n.y};return{Nt:u,qt:{x:i&&!!l,y:s&&!!l},Gt:{x:u.x&&!o?d.x:0,y:u.y&&!o?d.y:0}}},b=(t,e,n,i)=>{if(r){const{Gt:r,qt:s}=t,{x:c,y:u}=s,{x:d,y:_}=r,{Pt:g}=o(),f=g[i?"paddingRight":"paddingLeft"],h=g.paddingTop,v=e.w+(Ve(n.w)<1?n.w:0),p=e.h+(Ve(n.h)<1?n.h:0),b={w:_&&u?`${_+v-f}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")} + .${Pt}::before {}`,0);const n=e[0].style;n.width=b.w,n.height=b.h}}}else $t(a,{"--os-vaw":b.w,"--os-vah":b.h})}return r},w=(t,e,n,r)=>{const{Gt:i,qt:s}=t,{x:a,y:l}=s,{x:c,y:u}=i,{Pt:d}=o(),_=e?"marginLeft":"marginRight",g=e?"paddingLeft":"paddingRight",f=d[_],h=d.marginBottom,v=d[g],p=d.paddingBottom;r.width=`calc(100% + ${u+-1*f}px)`,r[_]=-u+f,r.marginBottom=-c+h,n&&(r[g]=v+(l?u:0),r.paddingBottom=p+(a?c:0))};return(t,e,n)=>{const{ht:s,Lt:l,_t:y,zt:m,It:S,Et:O}=t,{H:C,j:$,R:z}=de(),[I,L]=l,[M,A]=s,[T,R]=e("nativeScrollbarsOverlaid.show"),j=T&&z.x&&z.y,V=!C&&(y||S||m||R||L);let P,E=u(n),H=_(n),B=f(n);if(R&&$&&(j?rt(a,Ht):nt(a,Ht)),V&&(P=p(j),h(P,!!I)),y||O||S||R||A){const[t,e]=((t,e,n)=>{if(r){const i=n||p(t),{Pt:s}=o(),{H:l}=de(),{qt:c}=i,{x:u,y:d}=c,_={},g=t=>v(t.split(" "),t=>{_[t]=s[t]});l||(_.height=""),u&&g("marginBottom paddingTop paddingBottom"),d&&g("marginLeft marginRight paddingLeft paddingRight");const f=$t(a,x(_));return rt(a,Pt),$t(a,_),[()=>{w(i,e,r,f),$t(a,f),nt(a,Pt)},i]}return[yt]})(j,M,P),[i,s]=E=c(n),[l,u]=H=d(n),_=at(a);let f=l,h=_;t(),(u||s||R)&&e&&!j&&b(e,l,i,M)&&(h=at(a),f=lt(a)),B=g(((t,e,n)=>({w:je(0,Pe(je(0,t.w-e.w)-(ke()||je(0,n.w)))),h:je(0,Pe(je(0,t.h-e.h)-(ke()||je(0,n.h))))}))({w:je(l.w,f.w),h:je(l.h,f.h)},{w:h.w+je(0,_.w-l.w),h:h.h+je(0,_.h-l.h)},i),n)}const[k,D]=E,[N,G]=H,[q,Y]=B,[F,W]=e("overflow");if(O||D||G||Y||W||R||A||V){const t={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},e=((t,e,n,r)=>{const{Ht:o,Bt:i}=De(!0,e.w,n.x,r),{Ht:s,Bt:a}=De(!1,e.h,n.y,r);return o&&!s&&(r.overflowX=i),s&&!o&&(r.overflowY=a),p(t,r)})(j,q,F,t),n=b(e,N,k,M);w(e,M,n,t),V&&h(e,!!I),$t(a,t),i({Yt:e.Nt,Ft:q})}}},Ge=(t,e)=>t?e.split(".").reduce((t,e)=>t&&S(t,e)?t[e]:void 0,t):void 0,qe=[!1,!1,!1],Ye={jt:{Vt:!1,L:{t:0,r:0,b:0,l:0}},Yt:{x:!1,y:!1},Ft:{w:0,h:0},Pt:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0}},Fe={},We=["__TPL_","_TYPE__"],Xe=["boolean","number","string","array","object","function","null"].reduce((t,e)=>(t[e]=We[0]+e+We[1],t),{});Xe.number,Xe.boolean,Xe.array,Xe.null,Xe.string,Xe.array,Xe.null;Xe.number,Xe.array,Xe.null,Xe.function,Xe.null;const Ue="__osOptionsValidationPlugin",Je=new Set,Ke=new WeakMap,Qe=(t,e)=>{v(u(e)?e:[e],t)},Ze=(t,e)=>{const n=f(t)?t:t.target,r=(t=>Ke.get(t))(n);if(r)return r;const{G:o}=de(),i=O({},Fe),a=i[Ue],l=t=>{const e=t||{},n=a&&a.Wt;return n?n(e,!0):e},[u,d,_]=(()=>{const t=new Map,e=(e,n)=>{if(e){const r=t.get(e);Qe(t=>{r&&r[t?"delete":"clear"](t)},n)}else t.forEach(t=>{t.clear()}),t.clear()};return[(n,r)=>{const o=t.get(n)||new Set;return t.set(n,o),Qe(t=>{o.add(t)},r),e.bind(0,n,r)},e,(e,n)=>{const r=t.get(e);v(w(r),t=>{t(n)})}]})(),g=O({},o(),l(e)),h=pe(t),p=((t,e)=>{const{D:n}=de(),{A:r}=n(),{rt:o,ot:i}=e,{W:s,$:a,I:l}=o,u=!i.nt&&t.scrollbarsSlot,d=(c(u)?u(s,a,l):u)||(c(r)?r(s,a,l):r)||a,_=be(Wt),g=be(Xt),{st:f}=_,{st:h}=g;return P(d,f),P(d,h),{Xt:_,Ut:g,it(){B([f,h])}}})(t,h),b=((t,e,n,r)=>{let o=Ye;const{I:i}=n.rt,{j:a,R:l,H:c,B:u,k:d}=de(),_=!a&&(l.x||l.y),g={Jt:t,$t:n,kt:_,Dt:()=>o,Rt(t){o=O({},o,t)}},f=[Te(g),Re(g),Ne(g)],h=(n,r,o)=>{let{ht:a,Lt:l,_t:u=o||!1,zt:d=o||!1,It:g=o||!1,Et:h=o||!1}=n||{};const y=a||(p?p.ft(o).ht:qe),m=l||(b?b.ft(o).Lt:qe),S=e=>[Ge(t,e),o||void 0!==Ge(r,e)],x=_||!c,O=x&&I(i),C=x&&L(i);w&&w(S),v(f,t=>{const{_t:e,zt:n,It:r,Et:i}=t({ht:y,Lt:m,_t:u,zt:d,It:g,Et:h},S,!!o)||{};u=e||u,d=n||d,g=r||g,h=i||h}),s(O)&&I(i,O),s(C)&&L(i,C),e("updated",{updateHints:{sizeChanged:u,contentMutation:g,hostMutation:d,directionChanged:y[1],heightIntrinsicChanged:m[1]},changedOptions:r||{},force:!!o})},{At:p,Mt:b,Tt:w,it:y}=Ae(g,h),m=(t,e)=>h({},t,e),S=m.bind(0,{},!0);return u(S),console.log(de()),{Ct:m,Kt:()=>({Qt:o.Ft}),it(){y(),d(S),n.it(),r.it()}}})(g,_,h,p),y={options(t){if(t){const e=ne(g,l(t));(function(t){for(const e in t)return!1;return!0})(e)||(O(g,e),b.Ct(e))}return g},on:u,off:d,state:()=>b.Kt(),update(t){b.Ct({},t)},destroy:()=>{b.it(),(t=>{Ke.delete(t),Je.delete(t)})(n),d()}};return v(x(i),t=>{const e=i[t];c(e)&&e(Ze,y)}),y.update(!0),((t,e)=>{Ke.set(t,e),Je.add(t)})(n,y),y};Ze.extend=t=>v(u(t)?t:[t],t=>{Fe[t[0]]=t[1]});export{Ze as default}; |