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