mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-13 10:02:29 +03:00
1 line
21 KiB
JavaScript
1 line
21 KiB
JavaScript
function t(t,n){const{o:e,s:o,u:r}=t;let i,a=e;const s=(t,n)=>{const e=a,s=t,l=n||(o?!o(e,s):e!==s);return(l||r)&&(a=s,i=e),[a,l,i]};return[n?t=>s(n(a,i),t):s,t=>[a,!!t,i]]}const n=Node.ELEMENT_NODE,{toString:e,hasOwnProperty:o}=Object.prototype;function r(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 d(t){return Array.isArray(t)}function u(t){return"object"==typeof t&&!d(t)&&!i(t)}function _(t){const n=!!t&&t.length,e=a(n)&&n>-1&&n%1==0;return!!(d(t)||!c(t)&&e)&&(!(n>0&&u(t))||n-1 in t)}function g(t){if(!t||!u(t)||"object"!==(t=>r(t)||i(t)?`${t}`:e.call(t).replace(/^\[object (.+)\]$/,"$1").toLowerCase())(t))return!1;let n;const a="constructor",s=t[a],l=s&&s.prototype,c=o.call(t,a),d=l&&o.call(l,"isPrototypeOf");if(s&&!c&&!d)return!1;for(n in t);return r(n)||o.call(t,n)}function f(t){const e=window.HTMLElement;return!!t&&(e?t instanceof e:t.nodeType===n)}function h(t){const e=window.Element;return!!t&&(e?t instanceof e:t.nodeType===n)}function w(t,n){if(_(t))for(let e=0;e<t.length&&!1!==n(t[e],e,t);e++);else t&&w(Object.keys(t),e=>n(t[e],e,t));return t}const v=(t,n,e)=>t.indexOf(n,e),p=(t,n,e)=>(e||s(n)||!_(n)?t.push(n):Array.prototype.push.apply(t,n),t),b=t=>{if(Array.from&&t)return Array.from(t);const n=[];return t instanceof Set?t.forEach(t=>{p(n,t)}):w(t,t=>{p(n,t)}),n},y=t=>!!t&&0===t.length,m=(t,n)=>{const e=t=>t&&t.apply(void 0,n||[]);t instanceof Set?t.forEach(e):w(t,e)},S=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),x=t=>t?Object.keys(t):[];function C(t,n,e,o,r,a,s){const l=[n,e,o,r,a,s];return"object"==typeof t&&!i(t)||c(t)||(t={}),w(l,n=>{w(x(n),e=>{const o=n[e];if(t===o)return!0;const r=d(o);if(o&&(g(o)||r)){const n=t[e];let i=n;r&&!d(n)?i=[]:r||g(n)||(i={}),t[e]=C(i,o)}else t[e]=o})}),t}function $(t,n,e,o){if(r(o))return e?e[t]:n;e&&(e[t]=o)}function O(t,n,e){if(r(e))return t?t.getAttribute(n):null;t&&t.setAttribute(n,e)}const z=(t,n)=>{t&&t.removeAttribute(n)};function I(t,n){return $("scrollLeft",0,t,n)}function A(t,n){return $("scrollTop",0,t,n)}const M=Element.prototype,L=(t,n)=>{const e=[],o=n?h(n)?n:null:document;return o?p(e,o.querySelectorAll(t)):e},T=(t,n)=>{if(h(t)){return(M.matches||M.msMatchesSelector).call(t,n)}return!1},R=t=>t?b(t.childNodes):[],j=t=>t?t.parentElement:null,P=(t,n,e)=>{if(e){let o,r=n;t&&(_(e)?(o=document.createDocumentFragment(),w(e,t=>{t===r&&(r=t.previousSibling),o.appendChild(t)})):o=e,n&&(r?r!==n&&(r=r.nextSibling):r=t.firstChild),t.insertBefore(o,r||null))}},V=(t,n)=>{P(t,null,n)},H=(t,n)=>{P(t,t&&t.firstChild,n)},E=(t,n)=>{P(j(t),t&&t.nextSibling,n)},B=t=>{if(_(t))w(b(t),t=>B(t));else if(t){const n=j(t);n&&n.removeChild(t)}},k=t=>{const n=document.createElement("div");return t&&O(n,"class",t),n},D=t=>{const n=k();return n.innerHTML=t.trim(),w(R(n),t=>B(t))},q=t=>t.charAt(0).toUpperCase()+t.slice(1),N=["-webkit-","-moz-","-o-","-ms-"],F=["WebKit","Moz","O","MS","webkit","moz","o","ms"],G={},W={},Y=t=>{let n=W[t];if(S(W,t))return n;const e=q(t),o=k().style;return w(N,r=>{const i=r.replace(/-/g,""),a=[t,r+t,i+e,q(i)+e];return!(n=a.find(t=>void 0!==o[t]))}),W[t]=n||""},U=t=>{let n=G[t]||window[t];return S(G,t)||(w(F,e=>(n=n||window[e+q(t)],!n)),G[t]=n),n},X=U("MutationObserver"),J=U("IntersectionObserver"),K=U("ResizeObserver"),Q=U("cancelAnimationFrame"),Z=U("requestAnimationFrame"),tt=/[^\x20\t\r\n\f]+/g,nt=(t,n,e)=>{let o,r=0,i=!1;if(t&&s(n)){const a=n.match(tt)||[];for(i=a.length>0;o=a[r++];)i=!!e(t.classList,o)&&i}return i},et=(t,n)=>{nt(t,n,(t,n)=>t.remove(n))},ot=(t,n)=>(nt(t,n,(t,n)=>t.add(n)),et.bind(0,t,n)),rt=(t,n,e,o)=>{if(t&&n){let r=!0;return w(e,e=>{(o?o(t[e]):t[e])!==(o?o(n[e]):n[e])&&(r=!1)}),r}return!1},it=(t,n)=>rt(t,n,["w","h"]),at=(t,n)=>rt(t,n,["x","y"]),st=(t,n)=>rt(t,n,["t","r","b","l"]),lt=(t,n,e)=>rt(t,n,["width","height"],e&&(t=>Math.round(t))),ct=t=>{t&&window.clearTimeout(t),t&&Q(t)},dt=()=>{},ut=(t,n)=>{let e,o,r,i;const{_:s,g:l,v:d}=n||{},u=window.setTimeout,_=function(n){ct(e),ct(o),o=e=r=void 0,t.apply(this,n)},g=t=>d&&r?d(r,t):t,f=()=>{e&&_(g(i)||i)},h=function(){const t=b(arguments),n=c(s)?s():s,d=a(n)&&n>=0;if(d){const s=c(l)?l():l,d=a(s)&&s>=0,h=n>0?u:Z,w=g(t)||t,v=_.bind(0,w);ct(e),e=h(v,n),d&&!o&&(o=u(f,s)),r=i=w}else _(t)};return h.p=f,h},_t={opacity:1,zindex:1},gt=(t,n)=>{const e=n?parseFloat(t):parseInt(t,10);return Number.isNaN(e)?0:e},ft=(t,n,e)=>null!=n?n[e]||n.getPropertyValue(e):t.style[e],ht=(t,n,e)=>{try{if(t){const{style:o}=t;r(o[n])?o.setProperty(n,e):o[n]=((t,n)=>!_t[t.toLowerCase()]&&a(n)?`${n}px`:n)(n,e)}}catch(o){}};function wt(t,n){const e=s(n);if(d(n)||e){let o=e?"":{};if(t){const r=window.getComputedStyle(t,null);o=e?ft(t,r,n):n.reduce((n,e)=>(n[e]=ft(t,r,e),n),o)}return o}w(x(n),e=>ht(t,e,n[e]))}const vt=(t,n,e)=>{const o=n?`${n}-`:"",r=e?`-${e}`:"",i=`${o}top${r}`,a=`${o}right${r}`,s=`${o}bottom${r}`,l=`${o}left${r}`,c=wt(t,[i,a,s,l]);return{t:gt(c[i]),r:gt(c[a]),b:gt(c[s]),l:gt(c[l])}},pt={w:0,h:0},bt=()=>({w:window.innerWidth,h:window.innerHeight}),yt=t=>t?{w:t.offsetWidth,h:t.offsetHeight}:pt,mt=t=>t?{w:t.clientWidth,h:t.clientHeight}:pt,St=t=>t?{w:t.scrollWidth,h:t.scrollHeight}:pt,xt=t=>{const n=parseFloat(wt(t,"height"))||0,e=parseFloat(wt(t,"height"))||0;return{w:e-Math.round(e),h:n-Math.round(n)}},Ct=t=>t.getBoundingClientRect();let $t;const Ot=t=>t.split(" "),zt=(t,n,e,o)=>{w(Ot(n),n=>{t.removeEventListener(n,e,o)})},It=(t,n,e,o)=>{const i=(()=>{if(r($t)){$t=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){$t=!0}}))}catch(t){}}return $t})(),a=i&&o&&o.m||!1,s=o&&o.S||!1,l=o&&o.C||!1,c=[],d=i?{passive:a,capture:s}:s;return w(Ot(n),n=>{const o=l?r=>{t.removeEventListener(n,o,s),e&&e(r)}:e;p(c,zt.bind(null,t,n,o,s)),t.addEventListener(n,o,d)}),m.bind(0,c)},At=t=>(t=>t.stopPropagation())(t)||(t=>t.preventDefault())(t),Mt={x:0,y:0},Lt=t=>{const n=t?Ct(t):0;return n?{x:n.left+window.pageYOffset,y:n.top+window.pageXOffset}:Mt},Tt=(t,n)=>{w(d(n)?n:[n],t)},Rt=(t,n)=>t?n.split(".").reduce((t,n)=>t&&S(t,n)?t[n]:void 0,t):void 0,jt=(t,n,e)=>o=>[Rt(t,o),e||void 0!==Rt(n,o)],Pt=t=>{let n=t;return[()=>n,t=>{n=C({},n,t)}]},Vt="os-environment",Ht=`${Vt}-flexbox-glue`,Et=`${Ht}-max`,Bt="data-overlayscrollbars",kt="os-padding",Dt="os-viewport",qt=`${Dt}-arrange`,Nt="os-content",Ft=`${Dt}-scrollbar-styled`,Gt=`os-overflow-visible`,Wt="os-size-observer",Yt=`${Wt}-appear`,Ut=`${Wt}-listener`,Xt=`${Ut}-scroll`,Jt=`${Ut}-item`,Kt=`${Jt}-final`,Qt="os-trinsic-observer",Zt="os-scrollbar",tn=`${Zt}-horizontal`,nn=`${Zt}-vertical`,en="os-scrollbar-track",on="os-scrollbar-handle",rn=t=>JSON.stringify(t,(t,n)=>{if(c(n))throw new Error;return n}),an={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}},sn=(t,n)=>{const e={};return w(x(n).concat(x(t)),o=>{const r=t[o],i=n[o];if(u(r)&&u(i))C(e[o]={},sn(r,i));else if(S(n,o)&&i!==r){let t=!0;if(d(r)||d(i))try{rn(r)===rn(i)&&(t=!1)}catch(a){}t&&(e[o]=i)}}),e};let ln;const{abs:cn,round:dn}=Math,un=(t,n,e)=>{V(t,n);const o=mt(n),r=yt(n),i=xt(e);return{x:r.h-o.h+i.h,y:r.w-o.w+i.w}},_n=(t,n)=>{const e="hidden";wt(t,{overflowX:e,overflowY:e,direction:"rtl"}),I(t,0);const o=Lt(t),r=Lt(n);I(t,-999);const i=Lt(n);return{i:o.x===r.x,n:r.x!==i.x}},gn=(t,n)=>{const e=ot(t,Ht),o=Ct(t),r=Ct(n),i=lt(r,o,!0),a=ot(t,Et),s=Ct(t),l=Ct(n),c=lt(l,s,!0);return e(),a(),i&&c},fn=()=>{const t=window.screen.deviceXDPI||0,n=window.screen.logicalXDPI||1;return window.devicePixelRatio||t/n},hn=()=>{const{body:n}=document,e=D(`<div class="${Vt}"><div></div></div>`)[0],o=e.firstChild,r=new Set,[i,a]=t({o:un(n,e,o),s:at}),[s]=a(),l=(t=>{let n=!1;const e=ot(t,Ft);try{n="none"===wt(t,Y("scrollbar-width"))||"none"===window.getComputedStyle(t,"::-webkit-scrollbar").getPropertyValue("display")}catch(o){}return e(),n})(e),c={x:0===s.x,y:0===s.y},d=(t=>({$:null,O:null,I:!t,A:!1,M:null}))(l),u=C({},an),_={L:s,T:c,R:l,j:"-1"===wt(e,"zIndex"),P:_n(e,o),V:gn(e,o),H:t=>(r.add(t),()=>r.delete(t)),B:C.bind(0,{},d),k(t){C(d,t)},D:C.bind(0,{},u),q(t){C(u,t)},N:C({},d),F:C({},u)};if(z(e,"style"),B(e),!(l||c.x&&c.y)){let t=bt(),a=fn();window.addEventListener("resize",()=>{if(r.size){const s=bt(),l={w:s.w-t.w,h:s.h-t.h};if(0===l.w&&0===l.h)return;const c={w:cn(l.w),h:cn(l.h)},d={w:cn(dn(s.w/(t.w/100))),h:cn(dn(s.h/(t.h/100)))},u=fn(),_=c.w>2&&c.h>2,g=!((t,n)=>{const e=cn(t),o=cn(n);return!(e===o||e+1===o||e-1===o)})(d.w,d.h),f=u!==a&&a>0;if(_&&g&&f){const[t,a]=i(un(n,e,o));C(ln.L,t),B(e),a&&m(r)}t=s,a=u}})}return _},wn=()=>(ln||(ln=hn()),ln);let vn=0;const pn=t=>{V(j(t),R(t)),B(t)},bn=()=>{const{R:t,T:n,j:e}=wn(),o=!!(!e&&!t&&(n.x||n.y))&&document.createElement("style");return o&&(O(o,"id",`${qt}-${vn}`),vn++),o},yn=(t,n,e)=>n||(c(e)?e(t):e)||k(),mn=(t,n,e)=>{const o=l(n)||n?n:c(e)?e(t):e;return!0===o?k():o},Sn=t=>{const{B:n,R:e}=wn(),{$:o,O:r,I:i,A:a}=n(),s=f(t),l=t,c=s?t:l.target,d=T(c,"textarea"),u=!d&&T(c,"body"),_=c.ownerDocument,g=_.body,h=_.defaultView,w={G:c,$:d?yn(c,l.host,o):c,O:yn(c,l.viewport,r),I:mn(c,l.padding,i),A:mn(c,l.content,a),W:bn(),Y:h,U:_,X:j(g),J:g,K:d,Z:u,tt:s},b=x(w).reduce((t,n)=>{const e=w[n];return p(t,!(!e||j(e))&&e)},[]),y=t=>t?v(b,t)>-1:null,{G:S,$:C,I:$,O:I,A,W:M}=w,L=[],H=d&&y(C),k=d?S:R([A,I,$,C,S].find(t=>!1===y(t))),D=A||I,q=(O(N=C,Bt,""),z.bind(0,N,Bt));var N;const F=ot($,kt),G=ot(I,Dt),W=ot(A,Nt);var Y,U;return H&&(E(S,C),p(L,()=>{E(C,S),B(C)})),V(D,k),V(C,$),V($||C,I),V(I,A),p(L,()=>{s?(V(C,R(D)),B($||I),q()):(y(A)&&pn(A),y(I)&&pn(I),y($)&&pn($),q(),F(),G(),W())}),e&&p(L,et.bind(0,I,Ft)),M&&(U=M,P(j(Y=I),Y,U),p(L,B.bind(0,M))),[w,m.bind(0,L)]},xn=(t,n)=>{const{A:e}=t,[o]=n;return t=>{const{nt:n}=o(),{et:r}=t;return r&&wt(e,{height:n?"":"100%",display:n?"":"inline"}),{ot:r,rt:r}}},Cn=(n,e)=>{const[o,r]=e,{$:i,I:a,O:s}=n,[l,c]=t({s:st,o:vt()},vt.bind(0,i,"padding",""));return(t,n,e)=>{let[i,d]=c(e);const{R:u,V:_}=wn(),{it:g}=o(),{ot:f,rt:h,st:w}=t,[v,p]=n("paddingAbsolute");(f||d||!_&&h)&&([i,d]=l(e));const b=p||w||d;if(b){const t=!v||!a&&!u,n=i.r+i.l,e=i.t+i.b,o={marginRight:t&&!g?-n:0,marginBottom:t?-e:0,marginLeft:t&&g?-n:0,top:t?-i.t:0,right:t?g?-i.r:"auto":0,left:t?g?"auto":-i.l:0,width:t?`calc(100% + ${n}px)`:""},l={paddingTop:t?i.t:0,paddingRight:t?i.r:0,paddingBottom:t?i.b:0,paddingLeft:t?i.l:0};wt(a||s,o),wt(s,l),r({I:i,lt:!t,ct:a?l:C({},o,l)})}return{dt:b}}},{max:$n}=Math,On="visible",zn=42,In={s:it,o:{w:0,h:0}},An={s:at,o:{x:!1,y:!1}},Mn=(t,n,e)=>e?ot(t,n):et(t,n),Ln=t=>0===t.indexOf(On),Tn=(n,e)=>{const[o,r]=e,{$:i,I:a,O:s,W:l}=n,{L:c,V:d,R:u,T:_}=wn(),g=!u&&(_.x||_.y),[f,h]=t(In,xt.bind(0,i)),[v,p]=t(In,St.bind(0,s)),[b,y]=t(In),[m]=t(An),S=(t,n)=>{if(wt(s,{height:""}),n){const{lt:n,I:e}=o(),{ut:r,_t:a}=t,l=xt(i),c=mt(i),d="content-box"===wt(s,"boxSizing"),u=n||d?e.b+e.t:0,g=!(_.x&&d);wt(s,{height:c.h+l.h+(r.x&&g?a.x:0)-u})}},C=(t,n)=>{const{x:e,y:o}=_,r=u||t?0:zn,i=!n?wt(s,["overflowX","overflowY"]):n,a={x:"scroll"===i.overflowX,y:"scroll"===i.overflowY},l={x:e?r:c.x,y:o?r:c.y};return{ut:a,gt:{x:e&&!!r,y:o&&!!r},_t:{x:a.x&&!u?l.x:0,y:a.y&&!u?l.y:0}}},$=(t,n,e,r)=>{if(g){const{ct:i}=o(),{_t:a,gt:c}=t,{x:d,y:u}=c,{x:_,y:g}=a,f=i[r?"paddingRight":"paddingLeft"],h=i.paddingTop,w=n.w+e.w,v=n.h+e.h,p={w:g&&u?`${g+w-f}px`:"",h:_&&d?`${_+v-h}px`:""};if(l){const{sheet:t}=l;if(t){const{cssRules:n}=t;if(n){n.length||t.insertRule(`#${O(l,"id")} + .${qt}::before {}`,0);const e=n[0].style;e.width=p.w,e.height=p.h}}}else wt(s,{"--os-vaw":p.w,"--os-vah":p.h})}return g},z=(t,n,e,r)=>{const{_t:i,gt:a}=t,{x:s,y:l}=a,{x:c,y:d}=i,{ct:u}=o(),_=n?"marginLeft":"marginRight",g=n?"paddingLeft":"paddingRight",f=u[_],h=u.marginBottom,w=u[g],v=u.paddingBottom;r.width=`calc(100% + ${d+-1*f}px)`,r[_]=-d+f,r.marginBottom=-c+h,e&&(r[g]=w+(l?d:0),r.paddingBottom=v+(s?c:0))};return(t,n,e)=>{const{ot:l,ft:c,rt:I,dt:A,et:M,st:L}=t,{nt:T,it:R}=o(),[j,P]=n("nativeScrollbarsOverlaid.show"),[V,H]=n("overflow"),E=j&&_.x&&_.y,B=!d&&(l||I||c||P||M),k=Ln(V.x),D=Ln(V.y),q=k||D;let N,F,G=h(e),W=p(e),Y=y(e);if(P&&u&&Mn(s,Ft,!E),B&&(N=C(E),S(N,T)),q&&et(s,Gt),l||A||I||L||P){const[t,n]=((t,n,e)=>{if(g){const r=e||C(t),{ct:i}=o(),{gt:a}=r,{x:l,y:c}=a,u={},_=t=>w(t.split(" "),t=>{u[t]=i[t]});l&&_("marginBottom paddingTop paddingBottom"),c&&_("marginLeft marginRight paddingLeft paddingRight");const f=wt(s,x(u));return et(s,qt),d||(u.height=""),wt(s,u),[()=>{z(r,n,g,f),wt(s,f),ot(s,qt)},r]}return[dt]})(E,R,N),[r,i]=G=f(e),[a,l]=W=v(e),c=mt(s);let u=a,_=c;t(),(l||i||P)&&n&&!E&&$(n,a,r,R)&&(_=mt(s),u=St(s)),Y=b(((t,n,e)=>{const o=window.devicePixelRatio%1!=0?1:0,r={w:$n(0,t.w-n.w-$n(0,e.w)),h:$n(0,t.h-n.h-$n(0,e.h))};return{w:r.w>o?r.w:0,h:r.h>o?r.h:0}})({w:$n(a.w,u.w),h:$n(a.h,u.h)},{w:_.w+$n(0,c.w-a.w),h:_.h+$n(0,c.h-a.h)},r),e)}const[U,X]=Y,[J,K]=W,[Q,Z]=G,tt={x:U.w>0,y:U.h>0},nt=k&&D&&(tt.x||tt.y)||k&&tt.x&&!tt.y||D&&tt.y&&!tt.x;if(A||L||Z||K||X||H||P||B){const t={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},n=((t,n,e,o)=>{const r=(t,n)=>{const e=Ln(t);return[n&&!e?t:"",n&&e&&t.replace(`${On}-`,"")||""]},[i,a]=r(e.x,n.x),[s,l]=r(e.y,n.y);return o.overflowX=a&&s?a:i,o.overflowY=l&&i?l:s,C(t,o)})(E,tt,V,t),e=$(n,J,Q,R),[o,i]=m(n.ut);z(n,R,e,t),B&&S(n,T),wt(s,t),r({ut:o,ht:U,wt:tt}),F={vt:X,pt:i}}return O(i,Bt,nt?"overflowVisible":""),Mn(a,Gt,nt),Mn(s,Gt,q),F}},Rn=(t,n,e)=>{const o={},r=n||{};return w(x(t).concat(x(r)),n=>{const i=t[n],a=r[n];o[n]=!!(e||i||a)}),o},jn="animationstart",Pn="scroll",Vn=3333333,Hn=t=>"rtl"===wt(t,"direction"),En=t=>t&&(t.height||t.width),Bn=(n,e,o)=>{const{bt:r=!1,yt:i=!1}=o||{},{P:a}=wn(),s=D(`<div class="${Wt}"><div class="${Ut}"></div></div>`)[0],c=s.firstChild,_=Hn.bind(0,s),[g]=t({o:void 0,u:!0,s:(t,n)=>!(!t||!En(t)&&En(n))}),f=t=>{const n=d(t)&&t.length>0&&u(t[0]),o=!n&&l(t[0]);let i=!1,c=!1,_=!0;if(n){const[n,,e]=g(t.pop().contentRect),o=En(n),r=En(e);i=!e||!o,c=!r&&o,_=!i}else o?[,_]=t:c=!0===t;if(r&&_){const n=o?t[0]:Hn(s);I(s,n?a.n?-Vn:a.i?0:Vn:Vn),A(s,Vn)}i||e({ot:!o,St:o?t:void 0,yt:!!c})},h=[];let w,v=!!i&&f;if(K){const t=new K(f);t.observe(c),p(h,()=>{t.disconnect()})}else{const t=D(`<div class="${Jt}" dir="ltr"><div class="${Jt}"><div class="${Kt}"></div></div><div class="${Jt}"><div class="${Kt}" style="width: 200%; height: 200%"></div></div></div>`);V(c,t),ot(c,Xt);const n=t[0],e=n.lastChild,o=n.firstChild,r=null==o?void 0:o.firstChild;let a,s=yt(n),l=s,d=!1;const u=()=>{I(o,Vn),A(o,Vn),I(e,Vn),A(e,Vn)},_=t=>{a=0,d&&(s=l,f(!0===t))},g=t=>{l=yt(n),d=!t||!it(l,s),t?(At(t),d&&!a&&(Q(a),a=Z(_))):_(!1===t),u()};p(h,[It(o,Pn,g),It(e,Pn,g)]),wt(r,{width:Vn,height:Vn}),u(),v=i?g.bind(0,!1):u}if(r){w=t({o:!_()},_);const[n]=w;p(h,It(s,Pn,t=>{const e=n(),[o,r]=e;r&&(et(c,"ltr rtl"),ot(c,o?"rtl":"ltr"),f(e)),At(t)}))}return v&&(ot(s,Yt),p(h,It(s,jn,v,{C:!!K}))),H(n,s),()=>{m(h),B(s)}},kn=(t,n,e,o)=>{let r=!1;const{xt:i,Ct:a,$t:l,Ot:c,zt:d,It:u,At:_}=o||{},[g,f]=((t,n,e)=>{let o,r=!1;const i=i=>{if(e){w(e.reduce((n,e)=>{if(e){const o=e[0],r=e[1],a=r&&o&&(i?i(o):L(o,t));a&&a.length&&r&&s(r)&&p(n,[a,r.trim()],!0)}return n},[]),t=>w(t[0],e=>{const i=t[1],a=o.get(e);if(a){const t=a[0],n=a[1];t===i&&n()}const s=It(e,i,t=>{r?(s(),o.delete(e)):n(t)});o.set(e,[i,s])}))}};return e&&(o=new WeakMap,i()),[()=>{r=!0},i]})(t,ut(()=>{r&&e(!0)},{_:33,g:99}),l),h=a||[],b=(i||[]).concat(h),m=r=>{const i=(n?u:d)||dt,a=_||dt,l=[],g=[];let b=!1,m=!1,S=!1;w(r,e=>{const{attributeName:r,target:d,type:u,oldValue:_,addedNodes:f}=e,w="attributes"===u,y="childList"===u,x=t===d,C=w&&s(r)?O(d,r):0,$=0!==C&&_!==C,z=v(h,r)>-1&&$;if(n&&!x){const n=!w,s=w&&z,l=s&&c&&T(d,c),u=(l?!i(d,r,_,C):n||s)&&!a(e,!!l,t,o);p(g,f),m=m||u,S=S||y}!n&&x&&$&&!i(d,r,_,C)&&(p(l,r),b=b||z)}),S&&!y(g)&&f(t=>g.reduce((n,e)=>(p(n,L(t,e)),T(e,t)?p(n,e):n),[])),n?m&&e(!1):y(l)&&!b||e(l,b)},S=new X(m);return S.observe(t,{attributes:!0,attributeOldValue:!0,attributeFilter:b,subtree:n,childList:n,characterData:n}),r=!0,[()=>{r&&(g(),S.disconnect(),r=!1)},()=>{r&&m(S.takeRecords())}]},Dn="os-",qn=["tabindex"],Nn=["wrap","cols","rows"],Fn=["id","class","style","open"],Gn=(t,n,e,o)=>{if("class"===n&&e&&o){return!!((t,n)=>{const e=t&&t.split(" "),o=n&&n.split(" "),r={};return w(e,t=>{r[t]=1}),w(o,t=>{r[t]?delete r[t]:r[t]=1}),x(r)})(e,o).find(t=>0!==t.indexOf(Dn))}return!1},Wn=(n,e,o)=>{let r,i,l;const[,c]=e,{$:u,O:_,A:g,K:f}=n,{R:h,V:b}=wn(),y=f?Nn:Fn.concat(Nn),S=ut(o,{_:()=>r,g:()=>i,v(t,n){const[e]=t,[o]=n;return[x(e).concat(x(o)).reduce((t,n)=>(t[n]=e[n]||o[n],t),{})]}}),C=t=>{w(t||qn,t=>{if(v(qn,t)>-1){const n=O(u,t);s(n)?O(_,t,n):z(_,t)}})},$=t=>{(t?o:S)({rt:!0})},I=(g||!b)&&((n,e)=>{const o=k(Qt),r=[],[i]=t({o:!1}),a=t=>{if(t){const o=i(0===(n=t).h||n.isIntersecting||n.intersectionRatio>0),[,r]=o;r&&e(o)}var n};if(J){const t=new J(t=>{t&&t.length>0&&a(t.pop())},{root:n});t.observe(o),p(r,()=>{t.disconnect()})}else{const t=()=>{const t=yt(o);a(t)};p(r,Bn(o,t)),t()}return H(n,o),()=>{m(r),B(o)}})(u,t=>{const[n,e]=t;c({nt:n}),o({et:e})}),A=Bn(u,({ot:t,St:n,yt:e})=>{const r=!t||e?o:S;let i=!1;if(n){const[t,e]=n;i=e,c({it:t})}r({ot:t,st:i})},{yt:!0,bt:!h}),[M]=kn(u,!1,(t,n)=>{n?S({ft:!0}):C(t)},{Ct:Fn,xt:Fn.concat(qn),zt:Gn});return C(),[t=>{const[n,e]=t("updating.elementEvents"),[o,s]=t("updating.attributes"),[c,u]=t("updating.debounce");if((e||s)&&(l&&(l[1](),l[0]()),l=kn(g||_,!0,$,{Ct:y.concat(o||[]),xt:y.concat(o||[]),$t:n,It:Gn})),u)if(S.p(),d(c)){const t=c[0],n=c[1];r=!!a(t)&&t,i=!!a(n)&&n}else a(c)?(r=c,i=!1):(r=!1,i=!1)},()=>{l&&l[0](),I&&I(),A(),M()}]},Yn={I:{t:0,r:0,b:0,l:0},lt:!1,ct:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},ht:{w:0,h:0},ut:{x:!1,y:!1},wt:{x:!1,y:!1},nt:!1,it:!1},Un=(t,n)=>{const e=jt(n,{}),o=Pt(Yn),r=new Set,[i]=o,s=(t,n,e)=>{m(r,[t,n||{},!!e])},[l,c]=Sn(t),d=((t,n)=>{const{O:e}=t,{R:o,T:r,V:i}=wn(),s=!o&&(r.x||r.y),l=[xn(t,n),Cn(t,n),Tn(t,n)];return(t,n,o)=>{const r=Rn(C({ot:!1,dt:!1,st:!1,et:!1,pt:!1,vt:!1,ft:!1,rt:!1},n),{},o),c=s||!i,d=c&&I(e),u=c&&A(e);let _=r;return w(l,n=>{_=Rn(_,n(_,t,!!o)||{},o)}),a(d)&&I(e,d),a(u)&&A(e,u),_}})(l,o),[u,_]=Wn(l,o,t=>{s(d(e,t))}),g=i.bind(0);return g.Mt=t=>{r.add(t)},g.Lt=l,[(t,e)=>{const o=jt(n,t,e);u(o),s(d(o,{},e))},g,()=>{r.clear(),_(),c()}]},Xn=t=>{const n=k(`${Zt} ${t}`),e=k(en),o=k(on);return V(n,e),V(e,o),{Tt:n,Rt:e,jt:o}},Jn=(t,n,e)=>{const o=Pt({}),[r]=o,[i,a]=((t,n)=>{const{B:e}=wn(),{M:o}=e(),{G:r,$:i,O:a,tt:s}=n,l=!s&&t.scrollbarsSlot,d=(c(l)?l(r,i,a):l)||(c(o)?o(r,i,a):o)||i,u=Xn(tn),_=Xn(nn),{Tt:g}=u,{Tt:f}=_;return V(d,g),V(d,f),[{Pt:u,Vt:_},B.bind(0,[g,f])]})(t,e),s=r.bind(0);return s.Lt=i,[(t,e)=>{const o=jt(n,t,e);console.log(o)},s,()=>{a()}]},Kn={};var Qn,Zn={exports:{}};!function(t){function n(){return t.exports=n=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},t.exports.Ht=!0,t.exports["default"]=t.exports,n.apply(this,arguments)}t.exports=n,t.exports.Ht=!0,t.exports["default"]=t.exports}(Zn),(Qn=Zn.exports)&&Qn.Ht&&Object.prototype.hasOwnProperty.call(Qn,"default")&&Qn["default"];const te=["__TPL_","_TYPE__"],ne=["boolean","number","string","array","object","function","null"].reduce((t,n)=>(t[n]=te[0]+n+te[1],t),{});ne.number,ne.boolean,ne.array,ne.null,ne.string,ne.array,ne.null;ne.number,ne.array,ne.null,ne.function,ne.null;const ee="__osOptionsValidationPlugin",oe=new Set,re=new WeakMap,ie=t=>(t=>{const n=new Map,e=(t,e)=>{if(t){const o=n.get(t);Tt(t=>{o&&o[t?"delete":"clear"](t)},e)}else n.forEach(t=>{t.clear()}),n.clear()},o=(t,o)=>{const r=n.get(t)||new Set;return n.set(t,r),Tt(t=>{t&&r.add(t)},o),e.bind(0,t,o)};return w(x(t),n=>{o(n,t[n])}),[o,e,(t,e)=>{const o=n.get(t);w(b(o),t=>{e?t(e):t()})}]})(t),ae=(t,n,e)=>({amount:{x:t.w,y:t.h},overflow:n,scrollableOverflow:C({},e)}),se=(t,n,e)=>{const{D:o,T:r,H:i}=wn(),a=C({},Kn),s=f(t)?t:t.target,l=(t=>re.get(t))(s);if(l)return l;const d=a[ee],u=t=>{const n=t||{},e=d&&d.Et;return e?e(n,!0):n},_=C({},o(),u(n)),[g,h,v]=ie(e);r.x&&r.y&&!_.nativeScrollbarsOverlaid.initialize&&v("initializationWithdrawn");const[p,b,y]=Un(t,_),[m,,S]=Jn(t,_,b.Lt),$=(t,n)=>{p(t,n),m(t,n)};b.Mt((t,n,e)=>{const{ot:o,st:r,et:i,vt:a,pt:s,rt:l,ft:c}=t,{ht:d,ut:u,wt:_}=b();(a||s)&&v("overflowChanged",C({},ae(d,_,u),{previous:ae(d,_,u)})),v("updated",{updateHints:{sizeChanged:o,directionChanged:r,heightIntrinsicChanged:i,overflowAmountChanged:a,overflowScrollChanged:s,contentMutation:l,hostMutation:c},changedOptions:n,force:e})});const O=i($.bind(0,{},!0)),z={options(t){if(t){const n=sn(_,u(t));(function(t){for(const n in t)return!1;return!0})(n)||(C(_,n),$(n))}return _},on:g,off:h,state:()=>({ht:b().ht}),update(t){$({},t)},destroy:()=>{(t=>{re.delete(t),oe.delete(t)})(s),O(),h(),S(),y(),v("destroyed")}};return w(x(a),t=>{const n=a[t];c(n)&&n(se,z)}),z.update(!0),((t,n)=>{re.set(t,n),oe.add(t)})(s,z),v("initialized"),z};se.extend=t=>w(d(t)?t:[t],t=>{Kn[t[0]]=t[1]});export{se as default}; |