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