UNPKG

on-screen-keyboard-detector

Version:

Detects presence of the On-Screen-Keyboard in mobile browsers

31 lines (30 loc) 43.6 kB
/* @license On-screen keyboard detector (OSKD) v.2.3.0 (c) 2020-2021 Matthias Seemann OSKD may be freely distributed under the MIT license. */ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).OSKD={})}(this,(function(t){"use strict"; /** @license MIT License (c) copyright 2010-2016 original author or authors */function n(t,n){if(t<0)throw new TypeError("i must be >= 0");var e=n.length;return 0===e||t>=e?n:1===e?[]:function(t,n,e){var r,i=new Array(e);for(r=0;r<t;++r)i[r]=n[r];for(r=t;r<e;++r)i[r]=n[r+1];return i}(t,n,e-1)} /** @license MIT License (c) copyright 2010-2016 original author or authors */ var e=function(t){return t};function r(t){return function n(e,r){switch(arguments.length){case 0:return n;case 1:return function(n){return t(e,n)};default:return t(e,r)}}}function i(t){return function n(e,i,s){switch(arguments.length){case 0:return n;case 1:return r((function(n,r){return t(e,n,r)}));case 2:return function(n){return t(e,i,n)};default:return t(e,i,s)}}}var s=function(){function t(t,n){this.origin=t,this.scheduler=n}return t.prototype.currentTime=function(){return this.scheduler.currentTime()-this.origin},t.prototype.scheduleTask=function(t,n,e,r){return this.scheduler.scheduleTask(t+this.origin,n,e,r)},t.prototype.relative=function(n){return new t(n+this.origin,this.scheduler)},t.prototype.cancel=function(t){return this.scheduler.cancel(t)},t.prototype.cancelAll=function(t){return this.scheduler.cancelAll(t)},t}(),o=r((function(t,n){return n.scheduleTask(0,0,-1,t)})),u=i((function(t,n,e){return e.scheduleTask(0,t,-1,n)})),c=function(t){return t.dispose()},h=r((function(t,n){return new s(t,n)}));function f(t,n,e){for(var r=n,i=0,s=e.length;i<s;++i)r=t(r,e[i],i);return r}function a(t){return function n(e,r){switch(arguments.length){case 0:return n;case 1:return function(n){return t(e,n)};default:return t(e,r)}}}var p=function(){return l},l=new(function(){function t(){}return t.prototype.dispose=function(){},t}()),d=function(t){return new v(t)},v=function(){function t(t){this.disposed=!1,this.disposable=t}return t.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposable&&(this.disposable.dispose(),this.disposable=void 0))},t}(),y=function(t){var n=f(g,[],t);return 0===n.length?p():new k(n)},m=a((function(t,n){return y([t,n])})),g=function(t,n){return function(t){return t===l}(n)?t:n instanceof k?function(t,n){var e=t.length,r=n.length,i=new Array(e+r),s=0;for(s=0;s<e;s++)i[s]=t[s];for(var o=0;o<r;o++)i[s++]=n[o];return i}(t,n.disposables): /** @license MIT License (c) copyright 2010-2016 original author or authors */ function(t,n){for(var e=n.length,r=new Array(e+1),i=0;i<e;++i)r[i]=n[i];return r[e]=t,r}(n,t)},k=function(){function t(t){this.disposables=t}return t.prototype.dispose=function(){_(w(this.disposables))},t}(),w=function(t){return f(b,[],t)},b=function(t,n){try{n.dispose()}catch(n){t.push(n)}return t},_=function(t){if(t.length>0)throw new A(t.length+" errors",t)},A=function t(n,e){this.name="DisposeAllError",this.message=n,this.errors=e,Error.call(this,n),Error.captureStackTrace&&Error.captureStackTrace(this,t),this.stack=""+this.stack+x(this.errors)};A.prototype=Object.create(Error.prototype);var O,x=function(t){return f(E,"",t)},E=function(t,n,e){return t+"\n["+(e+1)+"] "+n.stack},T=(O=function(t,n,e){try{n.dispose()}catch(n){e.error(t,n)}},function t(n,e,r){switch(arguments.length){case 0:return t;case 1:return a((function(t,e){return O(n,t,e)}));case 2:return function(t){return O(n,e,t)};default:return O(n,e,r)}}),S=function(t,n){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};function j(t,n){function e(){this.constructor=t}S(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)} /** @license MIT License (c) copyright 2010-2016 original author or authors */function I(t){throw t} /** @license MIT License (c) copyright 2010-2016 original author or authors */var H=function(t,n){return new z(t,n)},q=function(t){return new N(t)},R=function(){function t(t){this.sink=t,this.active=!0}return t.prototype.dispose=function(){this.active=!1},t.prototype.run=function(t){this.active&&this.runIfActive(t)},t.prototype.error=function(t,n){if(!this.active)return function(t){setTimeout(I,0,t)}(n);this.sink.error(t,n)},t}(),V=function(t){function n(n,e,r){var i=t.call(this,r)||this;return i.runEvent=n,i.value=e,i}return j(n,t),n.prototype.runIfActive=function(t){this.runEvent(t,this.value,this.sink)},n}(R),z=function(t){function n(n,e){var r=t.call(this,e)||this;return r.value=n,r}return j(n,t),n.prototype.runIfActive=function(t){this.sink.event(t,this.value)},n}(R),N=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return j(n,t),n.prototype.runIfActive=function(t){this.sink.end(t)},n}(R),P=(function(t){function n(n,e){var r=t.call(this,e)||this;return r.value=n,r}j(n,t),n.prototype.runIfActive=function(t){this.sink.error(t,this.value)}}(R),function(){return M}),C=function(t){return t===M},M=new(function(){function t(){}return t.prototype.run=function(t,n){return o(q(t),n)},t}()),D=function(t,n){return new B(t,n)},B=function(){function t(t,n){this.time=t,this.value=n}return t.prototype.run=function(t,n){return u(this.time,function(t,n,e){return new V(t,n,e)}(F,this.value,t),n)},t}();function F(t,n,e){e.event(t,n),e.end(t)} /** @license MIT License (c) copyright 2010-2017 original author or authors */var U=function(t){return D(0,t)},W=function(){function t(){this.disposable=void 0,this.disposed=!1}return t.prototype.setDisposable=function(t){if(void 0!==this.disposable)throw new Error("setDisposable called more than once");this.disposable=t,this.disposed&&t.dispose()},t.prototype.dispose=function(){this.disposed||(this.disposed=!0,void 0!==this.disposable&&this.disposable.dispose())},t}(),J=r((function(t,n){return new Promise((function(e,r){return function(t,n,e,r){var i=new W,s=new L(e,r,i);i.setDisposable(t.run(s,n))}(t,n,e,r)}))}));var L=function(){function t(t,n,e){this._end=t,this._error=n,this._disposable=e,this.active=!0}return t.prototype.event=function(){},t.prototype.end=function(){this.active&&this.dispose(this._error,this._end,void 0)},t.prototype.error=function(t,n){this.dispose(this._error,this._error,n)},t.prototype.dispose=function(t,n,e){this.active=!1,function(t,n,e,r){try{r.dispose()}catch(n){return void t(n)}n(e)}(t,n,e,this._disposable)},t}();var K=function(){function t(t,n){this.sink=n,this.offset=t}return t.prototype.event=function(t,n){this.sink.event(t+this.offset,n)},t.prototype.error=function(t,n){this.sink.error(t+this.offset,n)},t.prototype.end=function(t){this.sink.end(t+this.offset)},t}(),X=function(){function t(t,n){this.origin=t,this.source=n}return t.prototype.run=function(t,n){return this.source.run(G(this.origin,t),h(this.origin,n))},t}(),G=function(t,n){return n instanceof K?new K(t+n.offset,n.sink):new K(t,n)},Q=function(){function t(t){this.sink=t}return t.prototype.end=function(t){return this.sink.end(t)},t.prototype.error=function(t,n){return this.sink.error(t,n)},t}(),Y=(function(t){function n(n,e,r){var i=t.call(this,r)||this;return i.step=n,i.seed=e,i}j(n,t),n.prototype.event=function(t,n){var e=this.step(this.seed,n);this.seed=e.seed,this.sink.event(t,e.value)}}(Q),function(){function t(t,n,e){this.source=e,this.f=t,this.value=n}return t.prototype.run=function(t,n){var e=o(H(this.value,t),n),r=this.source.run(new Z(this.f,this.value,t),n);return m(e,r)},t}()),Z=function(t){function n(n,e,r){var i=t.call(this,r)||this;return i.f=n,i.value=e,i}return j(n,t),n.prototype.event=function(t,n){var e=this.f;this.value=e(this.value,n),this.sink.event(t,this.value)},n}(Q),$=function(){function t(t,n){this.f=t,this.source=n}return t.prototype.run=function(t,n){return new tt(this.f,this.source,t,n)},t}(),tt=function(t){function n(n,e,r,i){var s=t.call(this,r)||this;return s.f=n,s.scheduler=i,s.active=!0,s.disposable=d(e.run(s,i)),s}return j(n,t),n.prototype.event=function(t,n){this.active&&this.sink.event(t,n)},n.prototype.end=function(t){this.active&&(T(t,this.disposable,this.sink),this.startNext(t,this.sink))},n.prototype.startNext=function(t,n){try{this.disposable=this.continue(this.f,t,n)}catch(e){n.error(t,e)}},n.prototype.continue=function(t,n,e){return function(t,n,e){return e.run(t,n)}(e,this.scheduler,(r=n,i=t(),new X(r,i)));var r,i},n.prototype.dispose=function(){return this.active=!1,this.disposable.dispose()},n}(Q),nt=function(){function t(t,n){this.p=t,this.source=n}return t.prototype.run=function(t,n){return this.source.run(new et(this.p,t),n)},t.create=function(n,e){return C(e)?e:e instanceof t?new t(rt(e.p,n),e.source):new t(n,e)},t}(),et=function(t){function n(n,e){var r=t.call(this,e)||this;return r.p=n,r}return j(n,t),n.prototype.event=function(t,n){(0,this.p)(n)&&this.sink.event(t,n)},n}(Q),rt=function(t,n){return function(e){return t(e)&&n(e)}},it=function(){function t(t,n,e){this.p=t,this.f=n,this.source=e}return t.prototype.run=function(t,n){return this.source.run(new st(this.p,this.f,t),n)},t}(),st=function(t){function n(n,e,r){var i=t.call(this,r)||this;return i.p=n,i.f=e,i}return j(n,t),n.prototype.event=function(t,n){var e=this.f;(0,this.p)(n)&&this.sink.event(t,e(n))},n}(Q),ot=function(){function t(t,n){this.f=t,this.source=n}return t.prototype.run=function(t,n){return this.source.run(new ut(this.f,t),n)},t.create=function(n,e){return C(e)?P():e instanceof t?new t(function(t,n){return function(e){return t(n(e))}}(n,e.f),e.source):e instanceof nt?new it(e.p,n,e.source):new t(n,e)},t}(),ut=function(t){function n(n,e){var r=t.call(this,e)||this;return r.f=n,r}return j(n,t),n.prototype.event=function(t,n){var e=this.f;this.sink.event(t,e(n))},n}(Q),ct=function(){function t(t,n){this.source=n,this.f=t}return t.prototype.run=function(t,n){return this.source.run(new ht(this.f,t),n)},t}(),ht=function(t){function n(n,e){var r=t.call(this,e)||this;return r.f=n,r}return j(n,t),n.prototype.event=function(t,n){(0,this.f)(n),this.sink.event(t,n)},n}(Q),ft=function(t){function n(n,e){var r=t.call(this,e)||this;return r.index=n,r.active=!0,r.value=void 0,r}return j(n,t),n.prototype.event=function(t,n){this.active&&(this.value=n,this.sink.event(t,this))},n.prototype.end=function(t){this.active&&(this.active=!1,this.sink.event(t,this))},n}(Q); /** @license MIT License (c) copyright 2010-2016 original author or authors */ function at(t,n){switch(n.length){case 0:return t();case 1:return t(n[0]);case 2:return t(n[0],n[1]);case 3:return t(n[0],n[1],n[2]);case 4:return t(n[0],n[1],n[2],n[3]);case 5:return t(n[0],n[1],n[2],n[3],n[4]);default:return t.apply(void 0,n)}}!function(t){function n(n,e,r,i){var s=t.call(this,r)||this;return s.disposables=n,s.f=i,s.awaiting=e,s.values=new Array(e),s.hasValue=new Array(e).fill(!1),s.activeCount=e,s}j(n,t),n.prototype.event=function(t,n){if(n.active){var e=n.index,r=this.updateReady(e);this.values[e]=n.value,0===r&&this.sink.event(t,at(this.f,this.values))}else this.dispose(t,n.index)},n.prototype.updateReady=function(t){return this.awaiting>0&&(this.hasValue[t]||(this.hasValue[t]=!0,this.awaiting-=1)),this.awaiting},n.prototype.dispose=function(t,n){T(t,this.disposables[n],this.sink),0==--this.activeCount&&this.sink.end(t)}}(Q); /** @license MIT License (c) copyright 2010 original author or authors */var pt=function(t,n,e){return C(e)?P():new lt(t,n,e)},lt=function(){function t(t,n,e){this.f=t,this.concurrency=n,this.source=e}return t.prototype.run=function(t,n){return new dt(this.f,this.concurrency,this.source,t,n)},t}(),dt=function(){function t(t,n,e,r,i){this.f=t,this.concurrency=n,this.sink=r,this.scheduler=i,this.pending=[],this.current=[],this.disposable=d(e.run(this,i)),this.active=!0}return t.prototype.event=function(t,n){this.addInner(t,n)},t.prototype.addInner=function(t,n){this.current.length<this.concurrency?this.startInner(t,n):this.pending.push(n)},t.prototype.startInner=function(t,n){try{this.initInner(t,n)}catch(n){this.error(t,n)}},t.prototype.initInner=function(t,n){var e=new yt(t,this,this.sink);e.disposable=vt(this.f,t,n,e,this.scheduler),this.current.push(e)},t.prototype.end=function(t){this.active=!1,T(t,this.disposable,this.sink),this.checkEnd(t)},t.prototype.error=function(t,n){this.active=!1,this.sink.error(t,n)},t.prototype.dispose=function(){this.active=!1,this.pending.length=0,this.disposable.dispose(),y(this.current).dispose()},t.prototype.endInner=function(t,n){var e=this.current.indexOf(n);e>=0&&this.current.splice(e,1),T(t,n,this);var r=this.pending;r.length>0?this.startInner(t,r.shift()):this.checkEnd(t)},t.prototype.checkEnd=function(t){this.active||0!==this.current.length||this.sink.end(t)},t}(),vt=function(t,n,e,r,i){return t(e).run(r,h(n,i))},yt=function(){function t(t,n,e){this.time=t,this.outer=n,this.sink=e,this.disposable=p()}return t.prototype.event=function(t,n){this.sink.event(t+this.time,n)},t.prototype.end=function(t){this.outer.endInner(t+this.time,this)},t.prototype.error=function(t,n){this.outer.error(t+this.time,n)},t.prototype.dispose=function(){return this.disposable.dispose()},t}(),mt=function(t){return function(t,n){return pt(e,t,n)}(1/0,t)};var gt=function(t){return kt(wt(t))},kt=function(t){return 0===t.length?P():1===t.length?t[0]:new At(function(t,n,e){for(var r=n,i=0,s=e.length;i<s;++i)r=t(r,e[i],i);return r}(_t,[],t))},wt=function(t){return t.filter(bt)},bt=function(t){return!C(t)},_t=function(t,n){return t.concat(n instanceof At?n.sources:n)},At=function(){function t(t){this.sources=t}return t.prototype.run=function(t,n){for(var e=this.sources.length,r=new Array(e),i=new Array(e),s=new Ot(r,i,t),o=void 0,u=0;u<e;++u)o=i[u]=new ft(u,s),r[u]=this.sources[u].run(o,n);return y(r)},t}(),Ot=function(t){function n(n,e,r){var i=t.call(this,r)||this;return i.disposables=n,i.activeCount=e.length,i}return j(n,t),n.prototype.event=function(t,n){n.active?this.sink.event(t,n.value):this.dispose(t,n.index)},n.prototype.dispose=function(t,n){T(t,this.disposables[n],this.sink),0==--this.activeCount&&this.sink.end(t)},n}(Q),xt=function(){function t(t,n,e){this.f=t,this.values=n,this.sampler=e}return t.prototype.run=function(t,n){var e=new Et(this.f,t),r=this.values.run(e.latest,n),i=this.sampler.run(e,n);return m(i,r)},t}(),Et=function(t){function n(n,e){var r=t.call(this,e)||this;return r.f=n,r.latest=new Tt(r),r}return j(n,t),n.prototype.event=function(t,n){if(this.latest.hasValue){var e=this.f;this.sink.event(t,e(this.latest.value,n))}},n}(Q),Tt=function(t){function n(n){var e=t.call(this,n)||this;return e.hasValue=!1,e}return j(n,t),n.prototype.event=function(t,n){this.value=n,this.hasValue=!0},n.prototype.end=function(){},n}(Q),St=(function(t){function n(n,e,r,i){var s=t.call(this,r)||this;return s.skip=n,s.take=e,s.disposable=i,s}j(n,t),n.prototype.event=function(t,n){this.skip>0?this.skip-=1:0!==this.take&&(this.take-=1,this.sink.event(t,n),0===this.take&&(this.disposable.dispose(),this.sink.end(t)))}}(Q),function(t){function n(n,e,r){var i=t.call(this,e)||this;return i.p=n,i.active=!0,i.disposable=r,i}j(n,t),n.prototype.event=function(t,n){if(this.active){var e=this.p;this.active=e(n),this.active?this.sink.event(t,n):(this.disposable.dispose(),this.sink.end(t))}}}(Q),function(t){function n(n,e){var r=t.call(this,e)||this;return r.p=n,r.skipping=!0,r}j(n,t),n.prototype.event=function(t,n){if(this.skipping){var e=this.p;if(this.skipping=e(n),this.skipping)return}this.sink.event(t,n)}}(Q),function(){function t(t,n){this.p=t,this.source=n}return t.prototype.run=function(t,n){return this.source.run(new jt(this.p,t),n)},t}()),jt=function(t){function n(n,e){var r=t.call(this,e)||this;return r.p=n,r.skipping=!1,r}return j(n,t),n.prototype.event=function(t,n){if(!this.skipping){var e=this.p;this.skipping=e(n),this.sink.event(t,n),this.skipping&&this.sink.end(t)}},n}(Q),It=(function(t){function n(n,e,r){var i=t.call(this,r)||this;return i.f=n,i.items=e,i.index=0,i}j(n,t),n.prototype.event=function(t,n){var e=this.f;this.sink.event(t,e(this.items[this.index],n)),this.index+=1}}(Q),function(t){function n(n,e,r,i){var s=t.call(this,i)||this;return s.f=n,s.sinks=r,s.buffers=e,s}j(n,t),n.prototype.event=function(t,n){if(n.active){var e=this.buffers,r=e[n.index];if(r.push(n.value),1===r.length()){if(!function(t){for(var n=0,e=t.length;n<e;++n)if(t[n].isEmpty())return!1;return!0} /** @license MIT License (c) copyright 2010-2016 original author or authors */(e))return;It(this.f,t,e,this.sink),function(t,n){for(var e=0,r=t.length;e<r;++e)if(t[e].isEmpty()&&!n[e].active)return!0;return!1}(this.buffers,this.sinks)&&this.sink.end(t)}}else this.dispose(t,n.index)},n.prototype.dispose=function(t,n){this.buffers[n].isEmpty()&&this.sink.end(t)}}(Q),function(t,n,e,r){return r.event(n,at(t,function(t,n){for(var e=n.length,r=new Array(e),i=0;i<e;++i)r[i]=t(n[i]);return r}(Ht,e)))}),Ht=function(t){return t.shift()};var qt=function(t){return C(t)?P():new Rt(t)},Rt=function(){function t(t){this.source=t}return t.prototype.run=function(t,n){var e=new Vt(t,n);return m(e,this.source.run(e,n))},t}(),Vt=function(){function t(t,n){this.sink=t,this.scheduler=n,this.current=null,this.ended=!1}return t.prototype.event=function(t,n){this.disposeCurrent(t),this.current=new zt(n,t,1/0,this,this.sink,this.scheduler)},t.prototype.end=function(t){this.ended=!0,this.checkEnd(t)},t.prototype.error=function(t,n){this.ended=!0,this.sink.error(t,n)},t.prototype.dispose=function(){return this.disposeCurrent(this.scheduler.currentTime())},t.prototype.disposeCurrent=function(t){if(null!==this.current)return this.current.dispose(t)},t.prototype.disposeInner=function(t,n){n.dispose(t),n===this.current&&(this.current=null)},t.prototype.checkEnd=function(t){this.ended&&null===this.current&&this.sink.end(t)},t.prototype.endInner=function(t,n){this.disposeInner(t,n),this.checkEnd(t)},t.prototype.errorInner=function(t,n,e){this.disposeInner(t,e),this.sink.error(t,n)},t}(),zt=function(){function t(t,n,e,r,i,s){this.min=n,this.max=e,this.outer=r,this.sink=i,this.disposable=t.run(this,h(n,s))}return t.prototype.event=function(t,n){var e=Math.max(0,t+this.min);e<this.max&&this.sink.event(e,n)},t.prototype.end=function(t){this.outer.endInner(t+this.min,this)},t.prototype.error=function(t,n){this.outer.errorInner(t+this.min,n,this)},t.prototype.dispose=function(t){T(t,this.disposable,this.sink)},t}();var Nt=function(t){return Pt(Dt,t)},Pt=function(t,n){return C(n)?P():new Ct(t,n)},Ct=function(){function t(t,n){this.equals=t,this.source=n}return t.prototype.run=function(t,n){return this.source.run(new Mt(this.equals,t),n)},t}(),Mt=function(t){function n(n,e){var r=t.call(this,e)||this;return r.equals=n,r.value=void 0,r.init=!0,r}return j(n,t),n.prototype.event=function(t,n){this.init?(this.init=!1,this.value=n,this.sink.event(t,n)):this.equals(this.value,n)||(this.value=n,this.sink.event(t,n))},n}(Q);function Dt(t,n){return t===n} /** @license MIT License (c) copyright 2010-2016 original author or authors */var Bt=function(){function t(t,n){this.maxSignal=t,this.source=n}return t.prototype.run=function(t,n){var e=new W,r=this.source.run(t,n),i=this.maxSignal.run(new Ft(t,e),n);return e.setDisposable(m(r,i)),e},t}(),Ft=(function(t){function n(n,e){var r=t.call(this,e)||this;return r.min=n,r}j(n,t),n.prototype.event=function(t,n){this.min.allow&&this.sink.event(t,n)}}(Q),function(t){function n(n,e,r){var i=t.call(this,e)||this;return i.allow=!1,i.disposable=n.run(i,r),i}j(n,t),n.prototype.event=function(){this.allow=!0,this.dispose()},n.prototype.end=function(){},n.prototype.dispose=function(){this.disposable.dispose()}}(Q),function(t){function n(n,e){var r=t.call(this,n)||this;return r.disposable=e,r}return j(n,t),n.prototype.event=function(t){this.disposable.dispose(),this.sink.end(t)},n.prototype.end=function(){},n}(Q)),Ut=function(){function t(t,n){this.dt=t,this.source=n}return t.prototype.run=function(t,n){var e=new Wt(this.dt,t,n);return m(e,this.source.run(e,n))},t}(),Wt=function(t){function n(n,e,r){var i=t.call(this,e)||this;return i.dt=n,i.scheduler=r,i.tasks=[],i}return j(n,t),n.prototype.dispose=function(){this.tasks.forEach(c)},n.prototype.event=function(t,n){this.tasks.push(u(this.dt,H(n,this.sink),this.scheduler))},n.prototype.end=function(){this.tasks.push(u(this.dt,q(this.sink),this.scheduler))},n}(Q),Jt=(function(t){function n(n,e){var r=t.call(this,e)||this;return r.time=0,r.period=n,r}j(n,t),n.prototype.event=function(t,n){t>=this.time&&(this.time=t+this.period,this.sink.event(t,n))}}(Q),function(){function t(t,n){this.dt=t,this.source=n}return t.prototype.run=function(t,n){return new Lt(this.dt,this.source,t,n)},t}()),Lt=function(){function t(t,n,e,r){this.dt=t,this.sink=e,this.scheduler=r,this.timer=null,this.disposable=n.run(this,r)}return t.prototype.event=function(t,n){this.clearTimer(),this.value=n,this.timer=u(this.dt,new Kt(this,n),this.scheduler)},t.prototype.handleEventFromTask=function(t,n){this.clearTimer(),this.sink.event(t,n)},t.prototype.end=function(t){this.clearTimer()&&(this.sink.event(t,this.value),this.value=void 0),this.sink.end(t)},t.prototype.error=function(t,n){this.clearTimer(),this.sink.error(t,n)},t.prototype.dispose=function(){this.clearTimer(),this.disposable.dispose()},t.prototype.clearTimer=function(){return null!==this.timer&&(this.timer.dispose(),this.timer=null,!0)},t}(),Kt=function(){function t(t,n){this.sink=t,this.value=n}return t.prototype.run=function(t){this.sink.handleEventFromTask(t,this.value)},t.prototype.error=function(t,n){this.sink.error(t,n)},t.prototype.dispose=function(){},t}(); /** @license MIT License (c) copyright 2010-2016 original author or authors */ function Xt(t,n,e){try{e.event(t,n)}catch(n){e.error(t,n)}}function Gt(t,n){try{n.end(t)}catch(e){n.error(t,e)}}var Qt=function(t){return t instanceof Yt||C(t)?t:new Yt(t)},Yt=function(){function t(t){this.source=new Zt(t)}return t.prototype.run=function(t,n){return this.source.run(t,n)},t}(),Zt=function(){function t(t){this.source=t,this.sinks=[],this.disposable=p()}return t.prototype.run=function(t,n){return 1===this.add(t)&&(this.disposable=this.source.run(this,n)),d(new $t(this,t))},t.prototype.dispose=function(){var t=this.disposable;return this.disposable=p(),t.dispose()},t.prototype.add=function(t){return this.sinks=function(t,n){for(var e=n.length,r=new Array(e+1),i=0;i<e;++i)r[i]=n[i];return r[e]=t,r}(t,this.sinks),this.sinks.length},t.prototype.remove=function(t){var e=function(t,n){for(var e=0,r=n.length;e<r;++e)if(t===n[e])return e;return-1}(t,this.sinks);return e>=0&&(this.sinks=n(e,this.sinks)),this.sinks.length},t.prototype.event=function(t,n){var e=this.sinks;if(1===e.length)return e[0].event(t,n);for(var r=0;r<e.length;++r)Xt(t,n,e[r])},t.prototype.end=function(t){for(var n=this.sinks,e=0;e<n.length;++e)Gt(t,n[e])},t.prototype.error=function(t,n){for(var e=this.sinks,r=0;r<e.length;++r)e[r].error(t,n)},t}(),$t=function(){function t(t,n){this.source=t,this.sink=n}return t.prototype.dispose=function(){0===this.source.remove(this.sink)&&this.source.dispose()},t}(),tn=i((function(t,n,e){return new Y(t,n,e)})),nn=r((function(t,n){return function(t,n){return new $(t,n)}((function(){return n}),U(t))})),en=r((function(t,n){return ot.create(t,n)})),rn=r((function(t,n){return new ct(t,n)})),sn=r(( /** @license MIT License (c) copyright 2010-2016 original author or authors */ function(t,n){return gt([t,n])})),on=i((function(t,n,e){return C(e)||C(n)?P():new xt(t,n,e)})),un=r(( /** @license MIT License (c) copyright 2010-2016 original author or authors */ function(t,n){return nt.create(t,n)})),cn=r((function(t,n){return C(n)?P():new St(t,n)})),hn=r((function(t,n){return new Bt(t,n)})),fn=r((function(t,n){return t<=0?n:new Ut(t,n)})),an=r((function(t,n){return C(n)?P():new Jt(t,n)}));var pn=function(){function t(t,n,e,r,i){this.time=t,this.localOffset=n,this.period=e,this.task=r,this.scheduler=i,this.active=!0}return t.prototype.run=function(){return this.task.run(this.time-this.localOffset)},t.prototype.error=function(t){return this.task.error(this.time-this.localOffset,t)},t.prototype.dispose=function(){return this.active=!1,this.scheduler.cancel(this),this.task.dispose()},t}(),ln=function(){function t(t,n){this.origin=t,this.scheduler=n}return t.prototype.currentTime=function(){return this.scheduler.currentTime()-this.origin},t.prototype.scheduleTask=function(t,n,e,r){return this.scheduler.scheduleTask(t+this.origin,n,e,r)},t.prototype.relative=function(n){return new t(n+this.origin,this.scheduler)},t.prototype.cancel=function(t){return this.scheduler.cancel(t)},t.prototype.cancelAll=function(t){return this.scheduler.cancelAll(t)},t}(),dn=function(t){return Promise.resolve(t).then(vn)};function vn(t){try{return t.run()}catch(n){return t.error(n)}} /** @license MIT License (c) copyright 2010-2017 original author or authors */var yn=function(){function t(t,n){var e=this;this._runReadyTasksBound=function(){return e._runReadyTasks()},this.timer=t,this.timeline=n,this._timer=null,this._nextArrival=1/0}return t.prototype.currentTime=function(){return this.timer.now()},t.prototype.scheduleTask=function(t,n,e,r){var i=this.currentTime()+Math.max(0,n),s=new pn(i,t,e,r,this);return this.timeline.add(s),this._scheduleNextRun(),s},t.prototype.relative=function(t){return new ln(t,this)},t.prototype.cancel=function(t){t.active=!1,this.timeline.remove(t)&&this._reschedule()},t.prototype.cancelAll=function(t){this.timeline.removeAll(t),this._reschedule()},t.prototype._reschedule=function(){this.timeline.isEmpty()?this._unschedule():this._scheduleNextRun()},t.prototype._unschedule=function(){this.timer.clearTimer(this._timer),this._timer=null},t.prototype._scheduleNextRun=function(){if(!this.timeline.isEmpty()){var t=this.timeline.nextArrival();null===this._timer?this._scheduleNextArrival(t):t<this._nextArrival&&(this._unschedule(),this._scheduleNextArrival(t))}},t.prototype._scheduleNextArrival=function(t){this._nextArrival=t;var n=Math.max(0,t-this.currentTime());this._timer=this.timer.setTimer(this._runReadyTasksBound,n)},t.prototype._runReadyTasks=function(){this._timer=null,this.timeline.runTasks(this.currentTime(),vn),this._scheduleNextRun()},t}(),mn=function(){function t(){this.tasks=[]}return t.prototype.nextArrival=function(){return this.isEmpty()?1/0:this.tasks[0].time},t.prototype.isEmpty=function(){return 0===this.tasks.length},t.prototype.add=function(t){kn(t,this.tasks)},t.prototype.remove=function(t){var n=_n(wn(t),this.tasks);if(n>=0&&n<this.tasks.length){var e=this.tasks[n].events,r=function(t,n){for(var e=0,r=n.length;e<r;++e)if(t===n[e])return e;return-1}(t,e);if(r>=0)return e.splice(r,1),0===e.length&&this.tasks.splice(n,1),!0}return!1},t.prototype.removeAll=function(t){for(var n=0;n<this.tasks.length;++n)bn(t,this.tasks[n])},t.prototype.runTasks=function(t,n){for(var e=this.tasks,r=e.length,i=0;i<r&&e[i].time<=t;)++i;this.tasks=e.slice(i);for(var s=0;s<i;++s)this.tasks=gn(n,e[s].events,this.tasks)},t}(); /** @license MIT License (c) copyright 2010-2017 original author or authors */function gn(t,n,e){for(var r=0;r<n.length;++r){var i=n[r];i.active&&(t(i),i.period>=0&&i.active&&(i.time=i.time+i.period,kn(i,e)))}return e}function kn(t,n){var e=n.length,r=wn(t);if(0!==e){var i=_n(r,n);i>=e?n.push(An(r,[t])):function(t,n,e,r){var i=n[r];e===i.time?function(t,n){0===n.length||t.time>=n[n.length-1].time?n.push(t):function(t,n){for(var e=0;e<n.length;e++)if(t.time<n[e].time){n.splice(e,0,t);break}}(t,n)}(t,i.events):n.splice(r,0,An(e,[t]))}(t,n,r,i)}else n.push(An(r,[t]))}function wn(t){return Math.floor(t.time)}function bn(t,n){n.events= /** @license MIT License (c) copyright 2010-2016 original author or authors */ function(t,n){for(var e=n.length,r=new Array(e),i=0,s=void 0,o=0;o<e;++o)t(s=n[o])||(r[i]=s,++i);return r.length=i,r}(t,n.events)}function _n(t,n){for(var e,r,i=0,s=n.length;i<s;){if(t===(r=n[e=Math.floor((i+s)/2)]).time)return e;t<r.time?s=e:i=e+1}return s}var An=function(t,n){return{time:t,events:n}},On=function(){function t(t){this._clock=t}return t.prototype.now=function(){return this._clock.now()},t.prototype.setTimer=function(t,n){return n<=0?function(t){var n=new xn(t);return dn(n),n}(t):setTimeout(t,n)},t.prototype.clearTimer=function(t){return t instanceof xn?t.cancel():clearTimeout(t)},t}(),xn=function(){function t(t){this.f=t,this.active=!0}return t.prototype.run=function(){if(this.active)return this.f()},t.prototype.error=function(t){throw t},t.prototype.cancel=function(){this.active=!1},t}(); /** @license MIT License (c) copyright 2010-2017 original author or authors */var En=function(){function t(t,n){this.origin=n,this.clock=t}return t.prototype.now=function(){return this.clock.now()-this.origin},t}(),Tn=function(){function t(t,n){this.origin=n,this.hrtime=t}return t.prototype.now=function(){var t=this.hrtime(this.origin);return(1e9*t[0]+t[1])/1e6},t}(),Sn=function(t){return new En(t,t.now())},jn=function(){return"undefined"!=typeof performance&&"function"==typeof performance.now?Sn(performance):"undefined"!=typeof process&&"function"==typeof process.hrtime?new Tn(process.hrtime,process.hrtime()):Sn(Date)},In=function(){return new yn(Hn(),new mn)},Hn=function(){return new On(jn())},qn=function(t,n,e){return void 0===e&&(e=!1),new Cn(t,n,e)},Rn=function(t,n){return void 0===n&&(n=!1),qn("focusin",t,n)},Vn=function(t,n){return void 0===n&&(n=!1),qn("focusout",t,n)},zn=function(t,n){return void 0===n&&(n=!1),qn("change",t,n)},Nn=function(t,n){return void 0===n&&(n=!1),qn("resize",t,n)},Pn=function(t,n){return void 0===n&&(n=!1),qn("scroll",t,n)},Cn=function(t,n,e){this.event=t,this.node=n,this.capture=e};Cn.prototype.run=function(t,n){var e=this,r=function(e){return function(t,n,e){try{e.event(t,n)}catch(n){e.error(t,n)}}(n.currentTime(),e,t)};return this.node.addEventListener(this.event,r,this.capture),{dispose:function(){return e.node.removeEventListener(e.event,r,e.capture)}}};var Mn=function(){var t=[];return[function(n){return Dn(t,n)},new Bn(t)]},Dn=function(t,n){return t.forEach((function(t){var e=t.sink;return function(t,n,e){try{e.event(t,n)}catch(n){e.error(t,n)}}(t.scheduler.currentTime(),n,e)}))},Bn=function(){function t(t){this.sinks=t}return t.prototype.run=function(t,n){var e={sink:t,scheduler:n};return this.sinks.push(e),new Fn(e,this.sinks)},t}(),Fn=function(){function t(t,n){this.sink=t,this.sinks=n}return t.prototype.dispose=function(){var t=this.sinks.indexOf(this.sink);t>=0&&this.sinks.splice(t,1)},t}();function Un(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}function Wn(t){return function n(e){return 0===arguments.length||Un(e)?n:t.apply(this,arguments)}}function Jn(t){return function n(e,r){switch(arguments.length){case 0:return n;case 1:return Un(e)?n:Wn((function(n){return t(e,n)}));default:return Un(e)&&Un(r)?n:Un(e)?Wn((function(n){return t(n,r)})):Un(r)?Wn((function(n){return t(e,n)})):t(e,r)}}}function Ln(t,n){switch(t){case 0:return function(){return n.apply(this,arguments)};case 1:return function(t){return n.apply(this,arguments)};case 2:return function(t,e){return n.apply(this,arguments)};case 3:return function(t,e,r){return n.apply(this,arguments)};case 4:return function(t,e,r,i){return n.apply(this,arguments)};case 5:return function(t,e,r,i,s){return n.apply(this,arguments)};case 6:return function(t,e,r,i,s,o){return n.apply(this,arguments)};case 7:return function(t,e,r,i,s,o,u){return n.apply(this,arguments)};case 8:return function(t,e,r,i,s,o,u,c){return n.apply(this,arguments)};case 9:return function(t,e,r,i,s,o,u,c,h){return n.apply(this,arguments)};case 10:return function(t,e,r,i,s,o,u,c,h,f){return n.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}var Kn=Jn((function(t,n){return 1===t?Wn(n):Ln(t,function t(n,e,r){return function(){for(var i=[],s=0,o=n,u=0;u<e.length||s<arguments.length;){var c;u<e.length&&(!Un(e[u])||s>=arguments.length)?c=e[u]:(c=arguments[s],s+=1),i[u]=c,Un(c)||(o-=1),u+=1}return o<=0?r.apply(this,i):Ln(o,t(n,i,r))}}(t,[],n))}));function Xn(t){return function n(e,r,i){switch(arguments.length){case 0:return n;case 1:return Un(e)?n:Jn((function(n,r){return t(e,n,r)}));case 2:return Un(e)&&Un(r)?n:Un(e)?Jn((function(n,e){return t(n,r,e)})):Un(r)?Jn((function(n,r){return t(e,n,r)})):Wn((function(n){return t(e,r,n)}));default:return Un(e)&&Un(r)&&Un(i)?n:Un(e)&&Un(r)?Jn((function(n,e){return t(n,e,i)})):Un(e)&&Un(i)?Jn((function(n,e){return t(n,r,e)})):Un(r)&&Un(i)?Jn((function(n,r){return t(e,n,r)})):Un(e)?Wn((function(n){return t(n,r,i)})):Un(r)?Wn((function(n){return t(e,n,i)})):Un(i)?Wn((function(n){return t(e,r,n)})):t(e,r,i)}}}var Gn=Array.isArray||function(t){return null!=t&&t.length>=0&&"[object Array]"===Object.prototype.toString.call(t)};function Qn(t){return"[object String]"===Object.prototype.toString.call(t)}var Yn=Wn((function(t){return!!Gn(t)||!!t&&("object"==typeof t&&(!Qn(t)&&(1===t.nodeType?!!t.length:0===t.length||t.length>0&&(t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1)))))})),Zn=function(){function t(t){this.f=t}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(t){return t},t.prototype["@@transducer/step"]=function(t,n){return this.f(t,n)},t}();var $n=Jn((function(t,n){return Ln(t.length,(function(){return t.apply(n,arguments)}))}));function te(t,n,e){for(var r=e.next();!r.done;){if((n=t["@@transducer/step"](n,r.value))&&n["@@transducer/reduced"]){n=n["@@transducer/value"];break}r=e.next()}return t["@@transducer/result"](n)}function ne(t,n,e,r){return t["@@transducer/result"](e[r]($n(t["@@transducer/step"],t),n))}var ee="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function re(t,n,e){if("function"==typeof t&&(t=function(t){return new Zn(t)}(t)),Yn(e))return function(t,n,e){for(var r=0,i=e.length;r<i;){if((n=t["@@transducer/step"](n,e[r]))&&n["@@transducer/reduced"]){n=n["@@transducer/value"];break}r+=1}return t["@@transducer/result"](n)}(t,n,e);if("function"==typeof e["fantasy-land/reduce"])return ne(t,n,e,"fantasy-land/reduce");if(null!=e[ee])return te(t,n,e[ee]());if("function"==typeof e.next)return te(t,n,e);if("function"==typeof e.reduce)return ne(t,n,e,"reduce");throw new TypeError("reduce: list must be array or iterable")}function ie(t,n){return Object.prototype.hasOwnProperty.call(n,t)}var se=Object.prototype.toString,oe=function(){return"[object Arguments]"===se.call(arguments)?function(t){return"[object Arguments]"===se.call(t)}:function(t){return ie("callee",t)}}(),ue=!{toString:null}.propertyIsEnumerable("toString"),ce=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],he=function(){return arguments.propertyIsEnumerable("length")}(),fe=function(t,n){for(var e=0;e<t.length;){if(t[e]===n)return!0;e+=1}return!1},ae="function"!=typeof Object.keys||he?Wn((function(t){if(Object(t)!==t)return[];var n,e,r=[],i=he&&oe(t);for(n in t)!ie(n,t)||i&&"length"===n||(r[r.length]=n);if(ue)for(e=ce.length-1;e>=0;)ie(n=ce[e],t)&&!fe(r,n)&&(r[r.length]=n),e-=1;return r})):Wn((function(t){return Object(t)!==t?[]:Object.keys(t)})),pe=Xn(re),le=Wn((function(t){return function(){return t}})),de=Jn((function(t,n){return n(t)})),ve=Xn((function(t,n,e){var r={};for(var i in e)r[i]=e[i];return r[t]=n,r})),ye=Wn((function(t){return Kn(t.length,t)})),me=Wn((function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}));function ge(t,n){return function(){return n.call(this,t.apply(this,arguments))}}function ke(t,n){return function(){var e=arguments.length;if(0===e)return n();var r=arguments[e-1];return Gn(r)||"function"!=typeof r[t]?n.apply(this,arguments):r[t].apply(r,Array.prototype.slice.call(arguments,0,e-1))}}var we=Wn(ke("tail",Xn(ke("slice",(function(t,n,e){return Array.prototype.slice.call(e,t,n)})))(1,1/0)));function be(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return Ln(arguments[0].length,pe(ge,arguments[0],we(arguments)))}var _e=Wn((function(t){return Qn(t)?t.split("").reverse().join(""):Array.prototype.slice.call(t,0).reverse()}));function Ae(){if(0===arguments.length)throw new Error("compose requires at least one argument");return be.apply(this,_e(arguments))}function Oe(t){for(var n,e=[];!(n=t.next()).done;)e.push(n.value);return e}function xe(t,n,e){for(var r=0,i=e.length;r<i;){if(t(n,e[r]))return!0;r+=1}return!1}var Ee="function"==typeof Object.is?Object.is:function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n};function Te(t,n,e,r){var i=Oe(t);function s(t,n){return Se(t,n,e.slice(),r.slice())}return!xe((function(t,n){return!xe(s,n,t)}),Oe(n),i)}function Se(t,n,e,r){if(Ee(t,n))return!0;var i=me(t);if(i!==me(n))return!1;if(null==t||null==n)return!1;if("function"==typeof t["fantasy-land/equals"]||"function"==typeof n["fantasy-land/equals"])return"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](n)&&"function"==typeof n["fantasy-land/equals"]&&n["fantasy-land/equals"](t);if("function"==typeof t.equals||"function"==typeof n.equals)return"function"==typeof t.equals&&t.equals(n)&&"function"==typeof n.equals&&n.equals(t);switch(i){case"Arguments":case"Array":case"Object":if("function"==typeof t.constructor&&"Promise"===function(t){var n=String(t).match(/^function (\w*)/);return null==n?"":n[1]}(t.constructor))return t===n;break;case"Boolean":case"Number":case"String":if(typeof t!=typeof n||!Ee(t.valueOf(),n.valueOf()))return!1;break;case"Date":if(!Ee(t.valueOf(),n.valueOf()))return!1;break;case"Error":return t.name===n.name&&t.message===n.message;case"RegExp":if(t.source!==n.source||t.global!==n.global||t.ignoreCase!==n.ignoreCase||t.multiline!==n.multiline||t.sticky!==n.sticky||t.unicode!==n.unicode)return!1}for(var s=e.length-1;s>=0;){if(e[s]===t)return r[s]===n;s-=1}switch(i){case"Map":return t.size===n.size&&Te(t.entries(),n.entries(),e.concat([t]),r.concat([n]));case"Set":return t.size===n.size&&Te(t.values(),n.values(),e.concat([t]),r.concat([n]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var o=ae(t);if(o.length!==ae(n).length)return!1;var u=e.concat([t]),c=r.concat([n]);for(s=o.length-1;s>=0;){var h=o[s];if(!ie(h,n)||!Se(n[h],t[h],u,c))return!1;s-=1}return!0}var je=Jn((function(t,n){return Se(t,n,[],[])}));function Ie(t,n){return function(t,n,e){var r,i;if("function"==typeof t.indexOf)switch(typeof n){case"number":if(0===n){for(r=1/n;e<t.length;){if(0===(i=t[e])&&1/i===r)return e;e+=1}return-1}if(n!=n){for(;e<t.length;){if("number"==typeof(i=t[e])&&i!=i)return e;e+=1}return-1}return t.indexOf(n,e);case"string":case"boolean":case"function":case"undefined":return t.indexOf(n,e);case"object":if(null===n)return t.indexOf(n,e)}for(;e<t.length;){if(je(t[e],n))return e;e+=1}return-1}(n,t,0)>=0}var He=function(){function t(){this._nativeSet="function"==typeof Set?new Set:null,this._items={}}return t.prototype.add=function(t){return!qe(t,!0,this)},t.prototype.has=function(t){return qe(t,!1,this)},t}();function qe(t,n,e){var r,i=typeof t;switch(i){case"string":case"number":return 0===t&&1/t==-1/0?!!e._items["-0"]||(n&&(e._items["-0"]=!0),!1):null!==e._nativeSet?n?(r=e._nativeSet.size,e._nativeSet.add(t),e._nativeSet.size===r):e._nativeSet.has(t):i in e._items?t in e._items[i]||(n&&(e._items[i][t]=!0),!1):(n&&(e._items[i]={},e._items[i][t]=!0),!1);case"boolean":if(i in e._items){var s=t?1:0;return!!e._items[i][s]||(n&&(e._items[i][s]=!0),!1)}return n&&(e._items[i]=t?[!1,!0]:[!0,!1]),!1;case"function":return null!==e._nativeSet?n?(r=e._nativeSet.size,e._nativeSet.add(t),e._nativeSet.size===r):e._nativeSet.has(t):i in e._items?!!Ie(t,e._items[i])||(n&&e._items[i].push(t),!1):(n&&(e._items[i]=[t]),!1);case"undefined":return!!e._items[i]||(n&&(e._items[i]=!0),!1);case"object":if(null===t)return!!e._items.null||(n&&(e._items.null=!0),!1);default:return(i=Object.prototype.toString.call(t))in e._items?!!Ie(t,e._items[i])||(n&&e._items[i].push(t),!1):(n&&(e._items[i]=[t]),!1)}}var Re=Jn((function(t,n){for(var e=[],r=0,i=t.length,s=n.length,o=new He,u=0;u<s;u+=1)o.add(n[u]);for(;r<i;)o.add(t[r])&&(e[e.length]=t[r]),r+=1;return e})),Ve=Wn((function(t){return null!=t&&"function"==typeof t["fantasy-land/empty"]?t["fantasy-land/empty"]():null!=t&&null!=t.constructor&&"function"==typeof t.constructor["fantasy-land/empty"]?t.constructor["fantasy-land/empty"]():null!=t&&"function"==typeof t.empty?t.empty():null!=t&&null!=t.constructor&&"function"==typeof t.constructor.empty?t.constructor.empty():Gn(t)?[]:Qn(t)?"":function(t){return"[object Object]"===Object.prototype.toString.call(t)}(t)?{}:oe(t)?function(){return arguments}():void 0})),ze=Jn(Ee),Ne=Wn((function(t){return null!=t&&je(t,Ve(t))})),Pe=Xn((function(t,n,e){return je(n,e[t])}));const Ce="visualViewport"in window;function Me(){return Ce}const De=navigator.userAgent,Be="ontouchend"in document,Fe=/\b(\w*Macintosh\w*)\b/.test(De)&&Be,Ue=/\b(\w*iPhone\w*)\b/.test(De)&&/\b(\w*Mobile\w*)\b/.test(De)&&Be,We=Fe||Ue,Je=()=>screen.orientation.type.startsWith("portrait")?"portrait":"landscape",Le=ye(Ae(mt,on((t,n)=>t?P():U(n)))),Ke=()=>document.activeElement&&document.activeElement!==document.body;t.isSupported=function(){return We?Me():Be},t.subscribe=function(t){if(We)return function(t){if(!Me())return console.warn("On-Screen-Keyboard detection not supported on this version of iOS"),()=>void 0;const[n,e]=Mn(),r=In(),i=be(()=>gt([Pn(visualViewport),Nn(visualViewport),Pn(window)]),an(800),rn(()=>{console.log(visualViewport.height*visualViewport.scale/document.documentElement.clientHeight)}),en(()=>visualViewport.height*visualViewport.scale/document.documentElement.clientHeight<.85),Nt,en(t=>t?"visible":"hidden"),hn(e))();return J(rn(t,i),r),n}(t);const n=Math.max(700,700)-500+200,[e,r]=Mn(),i=In(),s=window.innerHeight,o=screen.availHeight-window.innerHeight,u=sn(Rn(document.documentElement),Vn(document.documentElement)),c=de(qn("visibilitychange",document))(be(en(()=>document.visibilityState),nn(document.visibilityState))),h=de(u)(be(en(t=>"focusin"===t.type?U(!1):D(700,!0)),qt,nn(!Ke()),Nt,Qt)),f=de(zn(screen.orientation))(be(on(t=>t||window.innerHeight===s,h),an(700),en(t=>({screenOrientation:Je(),height:t?window.innerHeight:screen.availHeight-o})))),a=de(h)(be(un(ze(!0)),en(()=>({screenOrientation:Je(),height:window.innerHeight})))),p=de(gt([a,f]))(be(fn(1e3),Le(en(je("hidden"),c)),tn((t,{screenOrientation:n,height:e})=>ve(n,e,t),{[Je()]:window.innerHeight}),cn(Ae(Ne,Re(["portrait","landscape"]),ae)))),l=de(Nn(window))(be(an(500),en(t=>({width:t.target.innerWidth,height:t.target.innerHeight})),tn((t,n)=>({...n,isJustHeightResize:t.width===n.width,dH:n.height-t.height}),{width:window.innerWidth,height:window.innerHeight,isJustHeightResize:!1,dH:0}),un(Pe("isJustHeightResize",!0)))),d=de(l)(be(fn(n),on((t,{height:n,dH:e})=>{const r=t[Je()];return r?n<.9*r&&e<0?U("visible"):n===r&&e>0?U("hidden"):P():e>.1*screen.availHeight?U("hidden"):e<-.1*screen.availHeight?U("visible"):P()},p),mt,sn(de(h)(be(un(ze(!0)),en(le("hidden"))))),hn(r),Nt));return J(rn(t,d),i),e},Object.defineProperty(t,"__esModule",{value:!0})}));