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