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