(function(b){function d(a){Object.defineProperty(this,"__firesTouchEvents",{value:a&&"firesTouchEvents"in a?a.firesTouchEvents:!1,writable:!1,enumerable:!1})}function e(a){l=Date.now()}function p(a){if(a in b&&"length"in b[a]&&!(1>b[a].length)){var m=b[a];b[a]=function(f,c){var q=c&&c.sourceCapabilities?c.sourceCapabilities:null;c&&delete c.sourceCapabilities;f=new m(f,c);Object.defineProperty(f,"__inputDeviceCapabilitiesPolyfill_specifiedSourceCapabilities",{value:q,writable:!1});return f};b[a].prototype=
m.prototype}}if(!("InputDeviceCapabilities"in b||"sourceCapabilities"in UIEvent.prototype)){d.prototype={get firesTouchEvents(){return this.__firesTouchEvents}};b.InputDeviceCapabilities=d;var g=new d({firesTouchEvents:!0}),h=new d({firesTouchEvents:!1}),l;document.addEventListener("touchstart",e,!0);document.addEventListener("touchmove",e,!0);document.addEventListener("touchend",e,!0);document.addEventListener("touchcancel",e,!0);var r=["resize","error","load","unload","abort"];Object.defineProperty(UIEvent.prototype,
"sourceCapabilities",{get:function(){if("__inputDeviceCapabilitiesPolyfill_specifiedSourceCapabilities"in this)return this.__inputDeviceCapabilitiesPolyfill_specifiedSourceCapabilities;if(0<=r.indexOf(this.type))return null;if(!("TouchEvent"in b))return h;if(this instanceof TouchEvent)return g;if("PointerEvent"in b&&this instanceof PointerEvent)return"touch"==this.pointerType?g:h;var a=Date.now()<l+1E3?g:h;Object.defineProperty(this,"__inputDeviceCapabilitiesPolyfill_specifiedSourceCapabilities",
{value:a,writable:!1});return a},configurable:!0,enumerable:!0});for(var n="UIEvent MouseEvent TouchEvent InputEvent CompositionEvent FocusEvent KeyboardEvent WheelEvent PointerEvent".split(" "),k=0;k<n.length;k++)p(n[k]);var t=Document.prototype.createEvent;Document.prototype.createEvent=function(a){a=t.call(this,a);a instanceof UIEvent&&Object.defineProperty(a,"__inputDeviceCapabilitiesPolyfill_specifiedSourceCapabilities",{value:null,writable:!1});return a}}})(this);
