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