2 lines
2.3 KiB
JavaScript
2 lines
2.3 KiB
JavaScript
function O(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var M=typeof global=="object"&&global&&global.Object===Object&&global;const R=M;var w=typeof self=="object"&&self&&self.Object===Object&&self,B=R||w||Function("return this")();const W=B;var F=function(){return W.Date.now()};const S=F;var G=/\s/;function U(e){for(var n=e.length;n--&&G.test(e.charAt(n)););return n}var _=/^\s+/;function D(e){return e&&e.slice(0,U(e)+1).replace(_,"")}var H=W.Symbol;const y=H;var L=Object.prototype,X=L.hasOwnProperty,q=L.toString,g=y?y.toStringTag:void 0;function z(e){var n=X.call(e,g),i=e[g];try{e[g]=void 0;var o=!0}catch{}var f=q.call(e);return o&&(n?e[g]=i:delete e[g]),f}var J=Object.prototype,K=J.toString;function Q(e){return K.call(e)}var V="[object Null]",Y="[object Undefined]",$=y?y.toStringTag:void 0;function Z(e){return e==null?e===void 0?Y:V:$&&$ in Object(e)?z(e):Q(e)}function ee(e){return e!=null&&typeof e=="object"}var ne="[object Symbol]";function te(e){return typeof e=="symbol"||ee(e)&&Z(e)==ne}var E=0/0,re=/^[-+]0x[0-9a-f]+$/i,ie=/^0b[01]+$/i,oe=/^0o[0-7]+$/i,ae=parseInt;function k(e){if(typeof e=="number")return e;if(te(e))return E;if(O(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=O(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=D(e);var i=ie.test(e);return i||oe.test(e)?ae(e.slice(2),i?2:8):re.test(e)?E:+e}var fe="Expected a function",ce=Math.max,ue=Math.min;function se(e,n,i){var o,f,s,u,r,c,d=0,v=!1,l=!1,T=!0;if(typeof e!="function")throw new TypeError(fe);n=k(n)||0,O(i)&&(v=!!i.leading,l="maxWait"in i,s=l?ce(k(i.maxWait)||0,n):s,T="trailing"in i?!!i.trailing:T);function j(t){var a=o,b=f;return o=f=void 0,d=t,u=e.apply(b,a),u}function N(t){return d=t,r=setTimeout(m,n),v?j(t):u}function P(t){var a=t-c,b=t-d,I=n-a;return l?ue(I,s-b):I}function h(t){var a=t-c,b=t-d;return c===void 0||a>=n||a<0||l&&b>=s}function m(){var t=S();if(h(t))return x(t);r=setTimeout(m,P(t))}function x(t){return r=void 0,T&&o?j(t):(o=f=void 0,u)}function A(){r!==void 0&&clearTimeout(r),d=0,o=c=f=r=void 0}function C(){return r===void 0?u:x(S())}function p(){var t=S(),a=h(t);if(o=arguments,f=this,c=t,a){if(r===void 0)return N(c);if(l)return clearTimeout(r),r=setTimeout(m,n),j(c)}return r===void 0&&(r=setTimeout(m,n)),u}return p.cancel=A,p.flush=C,p}export{se as d};
|