forked from inexorabletash/polyfill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb.min.js
2 lines (2 loc) · 32.3 KB
/
web.min.js
1
2
!function(e){"window"in e&&"document"in e&&(document.head=document.head||document.getElementsByTagName("head")[0],["abbr","article","aside","audio","bdi","canvas","data","datalist","details","dialog","figcaption","figure","footer","header","hgroup","main","mark","meter","nav","output","picture","progress","section","summary","template","time","video"].forEach(function(e){document.createElement(e)}),!("dataset"in document.createElement("span"))&&"Element"in e&&Element.prototype&&Object.defineProperty&&Object.defineProperty(Element.prototype,"dataset",{get:function(){for(var e=Object.create(null),t=0;t<this.attributes.length;++t){var r=this.attributes[t];r.specified&&"data-"===r.name.substring(0,5)&&!function(t,r){e[r]=t.getAttribute("data-"+r),Object.defineProperty(e,r,{get:function(){return t.getAttribute("data-"+r)},set:function(e){t.setAttribute("data-"+r,e)}})}(this,r.name.substring(5))}return e}}),function(){function t(e){e=String(e);var t,r=0,o=[],i=0,s=0;if(e=e.replace(/\s/g,""),e.length%4===0&&(e=e.replace(/=+$/,"")),e.length%4===1)throw Error("InvalidCharacterError");if(/[^+/0-9A-Za-z]/.test(e))throw Error("InvalidCharacterError");for(;r<e.length;)t=n.indexOf(e.charAt(r)),i=i<<6|t,s+=6,24===s&&(o.push(String.fromCharCode(i>>16&255)),o.push(String.fromCharCode(i>>8&255)),o.push(String.fromCharCode(255&i)),s=0,i=0),r+=1;return 12===s?(i>>=4,o.push(String.fromCharCode(255&i))):18===s&&(i>>=2,o.push(String.fromCharCode(i>>8&255)),o.push(String.fromCharCode(255&i))),o.join("")}function r(e){e=String(e);var t,r,o,i,s,a,u,c=0,h=[];if(/[^\x00-\xFF]/.test(e))throw Error("InvalidCharacterError");for(;c<e.length;)t=e.charCodeAt(c++),r=e.charCodeAt(c++),o=e.charCodeAt(c++),i=t>>2,s=(3&t)<<4|r>>4,a=(15&r)<<2|o>>6,u=63&o,c===e.length+2?(a=64,u=64):c===e.length+1&&(u=64),h.push(n.charAt(i),n.charAt(s),n.charAt(a),n.charAt(u));return h.join("")}if(!("atob"in e&&"btoa"in e)){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.atob=t,e.btoa=r}}())}(this),function(e){"window"in e&&"document"in e&&(document.querySelectorAll||(document.querySelectorAll=function(e){var t,r=document.createElement("style"),n=[];for(document.documentElement.firstChild.appendChild(r),document._qsa=[],r.styleSheet.cssText=e+"{x-qsa:expression(document._qsa && document._qsa.push(this))}",window.scrollBy(0,0),r.parentNode.removeChild(r);document._qsa.length;)t=document._qsa.shift(),t.style.removeAttribute("x-qsa"),n.push(t);return document._qsa=null,n}),document.querySelector||(document.querySelector=function(e){var t=document.querySelectorAll(e);return t.length?t[0]:null}),document.getElementsByClassName||(document.getElementsByClassName=function(e){return e=String(e).replace(/^|\s+/g,"."),document.querySelectorAll(e)}),e.Node=e.Node||function(){throw TypeError("Illegal constructor")},Node.ELEMENT_NODE=1,Node.ATTRIBUTE_NODE=2,Node.TEXT_NODE=3,Node.CDATA_SECTION_NODE=4,Node.ENTITY_REFERENCE_NODE=5,Node.ENTITY_NODE=6,Node.PROCESSING_INSTRUCTION_NODE=7,Node.COMMENT_NODE=8,Node.DOCUMENT_NODE=9,Node.DOCUMENT_TYPE_NODE=10,Node.DOCUMENT_FRAGMENT_NODE=11,Node.NOTATION_NODE=12,e.DOMException=e.DOMException||function(){throw TypeError("Illegal constructor")},DOMException.INDEX_SIZE_ERR=1,DOMException.DOMSTRING_SIZE_ERR=2,DOMException.HIERARCHY_REQUEST_ERR=3,DOMException.WRONG_DOCUMENT_ERR=4,DOMException.INVALID_CHARACTER_ERR=5,DOMException.NO_DATA_ALLOWED_ERR=6,DOMException.NO_MODIFICATION_ALLOWED_ERR=7,DOMException.NOT_FOUND_ERR=8,DOMException.NOT_SUPPORTED_ERR=9,DOMException.INUSE_ATTRIBUTE_ERR=10,DOMException.INVALID_STATE_ERR=11,DOMException.SYNTAX_ERR=12,DOMException.INVALID_MODIFICATION_ERR=13,DOMException.NAMESPACE_ERR=14,DOMException.INVALID_ACCESS_ERR=15,function(){function t(e,t,r){if("function"==typeof t){"DOMContentLoaded"===e&&(e="load");var n=this,o=function(e){e._timeStamp=Date.now(),e._currentTarget=n,t.call(this,e),e._currentTarget=null};this["_"+e+t]=o,this.attachEvent("on"+e,o)}}function r(e,t,r){if("function"==typeof t){"DOMContentLoaded"===e&&(e="load");var n=this["_"+e+t];n&&(this.detachEvent("on"+e,n),this["_"+e+t]=null)}}"Element"in e&&!Element.prototype.addEventListener&&Object.defineProperty&&(Event.CAPTURING_PHASE=1,Event.AT_TARGET=2,Event.BUBBLING_PHASE=3,Object.defineProperties(Event.prototype,{CAPTURING_PHASE:{get:function(){return 1}},AT_TARGET:{get:function(){return 2}},BUBBLING_PHASE:{get:function(){return 3}},target:{get:function(){return this.srcElement}},currentTarget:{get:function(){return this._currentTarget}},eventPhase:{get:function(){return this.srcElement===this.currentTarget?Event.AT_TARGET:Event.BUBBLING_PHASE}},bubbles:{get:function(){switch(this.type){case"click":case"dblclick":case"mousedown":case"mouseup":case"mouseover":case"mousemove":case"mouseout":case"mousewheel":case"keydown":case"keypress":case"keyup":case"resize":case"scroll":case"select":case"change":case"submit":case"reset":return!0}return!1}},cancelable:{get:function(){switch(this.type){case"click":case"dblclick":case"mousedown":case"mouseup":case"mouseover":case"mouseout":case"mousewheel":case"keydown":case"keypress":case"keyup":case"submit":return!0}return!1}},timeStamp:{get:function(){return this._timeStamp}},stopPropagation:{value:function(){this.cancelBubble=!0}},preventDefault:{value:function(){this.returnValue=!1}},defaultPrevented:{get:function(){return this.returnValue===!1}}}),[Window,HTMLDocument,Element].forEach(function(e){e.prototype.addEventListener=t,e.prototype.removeEventListener=r}))}(),window.addEvent=function(e,t,r){e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent&&(e["e"+t+r]=r,e[t+r]=function(){var n=window.event;n.currentTarget=e,n.preventDefault=function(){n.returnValue=!1},n.stopPropagation=function(){n.cancelBubble=!0},n.target=n.srcElement,n.timeStamp=Date.now(),e["e"+t+r].call(this,n)},e.attachEvent("on"+t,e[t+r]))},window.removeEvent=function(e,t,r){e.removeEventListener?e.removeEventListener(t,r,!1):e.detachEvent&&(e.detachEvent("on"+t,e[t+r]),e[t+r]=null,e["e"+t+r]=null)},function(){function t(e,t){function r(e){return e.length?e.split(/\s+/g):[]}function n(e,t){var n=r(t),o=n.indexOf(e);return-1!==o&&n.splice(o,1),n.join(" ")}if(Object.defineProperties(this,{length:{get:function(){return r(e[t]).length}},item:{value:function(n){var o=r(e[t]);return n>=0&&n<o.length?o[n]:null}},contains:{value:function(n){if(n=String(n),0===n.length)throw SyntaxError();if(/\s/.test(n))throw Error("InvalidCharacterError");var o=r(e[t]);return-1!==o.indexOf(n)}},add:{value:function(){var n=Array.prototype.slice.call(arguments).map(String);if(n.some(function(e){return 0===e.length}))throw SyntaxError();if(n.some(function(e){return/\s/.test(e)}))throw Error("InvalidCharacterError");try{var o=e[t],i=r(o);if(n=n.filter(function(e){return-1===i.indexOf(e)}),0===n.length)return;0===o.length||/\s$/.test(o)||(o+=" "),o+=n.join(" "),e[t]=o}finally{var s=r(e[t]).length;this.length!==s&&(this.length=s)}}},remove:{value:function(){var o=Array.prototype.slice.call(arguments).map(String);if(o.some(function(e){return 0===e.length}))throw SyntaxError();if(o.some(function(e){return/\s/.test(e)}))throw Error("InvalidCharacterError");try{var i=e[t];o.forEach(function(e){i=n(e,i)}),e[t]=i}finally{var s=r(e[t]).length;this.length!==s&&(this.length=s)}}},toggle:{value:function(o,i){try{if(o=String(o),0===o.length)throw SyntaxError();if(/\s/.test(o))throw Error("InvalidCharacterError");var s=r(e[t]),a=s.indexOf(o);if(-1!==a&&(!i||void 0===i))return e[t]=n(o,e[t]),!1;if(-1!==a&&i)return!0;var u=e[t];return 0===u.length||/\s$/.test(u)||(u+=" "),u+=o,e[t]=u,!0}finally{var c=r(e[t]).length;this.length!==c&&(this.length=c)}}},toString:{value:function(){return e[t]}}}),"length"in this)for(var o=0;100>o;++o)Object.defineProperty(this,String(o),{get:function(e){return function(){return this.item(e)}}(o)});else this.length=r(e[t]).length}function r(t,r){"Element"in e&&Element.prototype&&Object.defineProperty&&Object.defineProperty(Element.prototype,t,{get:r})}"classList"in document.createElement("span")?window.getClassList=function(e){return e.classList}:(window.getClassList=function(e){return new t(e,"className")},r("classList",function(){return new t(this,"className")})),"relList"in document.createElement("link")?window.getRelList=function(e){return e.relList}:(window.getRelList=function(e){return new t(e,"rel")},r("relList",function(){return new t(this,"rel")}))}())}(this),function(e){"window"in e&&"document"in e&&(e.XMLHttpRequest=e.XMLHttpRequest||function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw Error("This browser does not support XMLHttpRequest.")},XMLHttpRequest.UNSENT=0,XMLHttpRequest.OPENED=1,XMLHttpRequest.HEADERS_RECEIVED=2,XMLHttpRequest.LOADING=3,XMLHttpRequest.DONE=4,function(){function t(e){if(this._data=[],e)for(var t=0;t<e.elements.length;++t){var r=e.elements[t];""!==r.name&&this.append(r.name,r.value)}}if(!("FormData"in e)){t.prototype={append:function(t,r){if("Blob"in e&&r instanceof e.Blob)throw TypeError("Blob not supported");t=String(t),this._data.push([t,r])},toString:function(){return this._data.map(function(e){return encodeURIComponent(e[0])+"="+encodeURIComponent(e[1])}).join("&")}},e.FormData=t;var r=e.XMLHttpRequest.prototype.send;e.XMLHttpRequest.prototype.send=function(e){return e instanceof t&&(this.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),arguments[0]=e.toString()),r.apply(this,arguments)}}}())}(this),function(e){"use strict";function t(e){if(r)return new n(e);var t=document.createElement("a");return t.href=e,t}var r,n=e.URL;try{if(n){if(r=new e.URL("http://example.com"),"searchParams"in r)return;"href"in r||(r=void 0)}}catch(o){}if(e.URL=function(o,i){function s(e,t){var r=e.split("&");t&&-1===r[0].indexOf("=")&&(r[0]="="+r[0]);var n=[];r.forEach(function(e){if(0!==e.length){var t=e.indexOf("=");if(-1!==t)var r=e.substring(0,t),o=e.substring(t+1);else r=e,o="";r=r.replace(/\+/g," "),o=o.replace(/\+/g," "),n.push({name:r,value:o})}});var o=[];return n.forEach(function(e){o.push({name:decodeURIComponent(e.name),value:decodeURIComponent(e.value)})}),o}function a(t,r){function n(){a||(a=!0,"about:"===t.protocol&&-1!==t.pathname.indexOf("?")&&(t.pathname=t.pathname.split("?")[0]),t.search=o(i),a=!1)}function o(e){var t="",r=!0;return e.forEach(function(e){var n=encodeURIComponent(e.name),o=encodeURIComponent(e.value);r||(t+="&"),t+=n+"="+o,r=!1}),t.replace(/%20/g,"+")}var i=[];r&&(i=s(r)),this._setPairs=function(e){a||(i=e)},this._updateSteps=function(){n()};var a=!1;Object.defineProperties(this,{append:{value:function(e,t){i.push({name:e,value:t}),n()}},"delete":{value:function(e){for(var t=0;t<i.length;)i[t].name===e?i.splice(t,1):++t;n()}},get:{value:function(e){for(var t=0;t<i.length;++t)if(i[t].name===e)return i[t].value;return null}},getAll:{value:function(e){for(var t=[],r=0;r<i.length;++r)i[r].name===e&&t.push(i[r].value);return t}},has:{value:function(e){for(var t=0;t<i.length;++t)if(i[t].name===e)return!0;return!1}},set:{value:function(e,t){for(var r=!1,o=0;o<i.length;)i[o].name===e?r?i.splice(o,1):(i[o].value=t,r=!0,++o):++o;r||i.push({name:e,value:t}),n()}},toString:{value:function(){return o(i)}}}),"Symbol"in e&&"iterator"in e.Symbol&&Object.defineProperty(this,e.Symbol.iterator,{value:function(){var e=0;return{next:function(){if(e>=i.length)return{done:!0,value:void 0};var t=i[e++];return{done:!1,value:[t.name,t.value]}}}}})}function u(){var e=h.href.replace(/#$|\?$|\?(?=#)/g,"");h.href!==e&&(h.href=e)}function c(){d._setPairs(h.search?s(h.search.substring(1)):[]),d._updateSteps()}if(!(this instanceof e.URL))throw new TypeError("Failed to construct 'URL': Please use the 'new' operator.");i&&(o=function(){if(r)return new n(o,i).href;var e;if(document.implementation&&document.implementation.createHTMLDocument?e=document.implementation.createHTMLDocument(""):document.implementation&&document.implementation.createDocument?(e=document.implementation.createElement("http://www.w3.org/1999/xhtml","html",null),e.documentElement.appendChild(e.createElement("head")),e.documentElement.appendChild(e.createElement("body"))):window.ActiveXObject&&(e=new window.ActiveXObject("htmlfile"),e.write("<head></head><body></body>"),e.close()),!e)throw Error("base not supported");var t=e.createElement("base");t.href=i,e.getElementsByTagName("head")[0].appendChild(t);var s=e.createElement("a");return s.href=o,s.href}());var h=t(o||""),f=function(){if(!("defineProperties"in Object))return!1;try{var e={};return Object.defineProperties(e,{prop:{get:function(){return!0}}}),e.prop}catch(t){return!1}}(),l=f?this:document.createElement("a"),d=new a(l,h.search?h.search.substring(1):null);return Object.defineProperties(l,{href:{get:function(){return h.href},set:function(e){h.href=e,u(),c()}},origin:{get:function(){return"origin"in h?h.origin:this.protocol+"//"+this.host}},protocol:{get:function(){return h.protocol},set:function(e){h.protocol=e}},username:{get:function(){return h.username},set:function(e){h.username=e}},password:{get:function(){return h.password},set:function(e){h.password=e}},host:{get:function(){var e={"http:":/:80$/,"https:":/:443$/,"ftp:":/:21$/}[h.protocol];return e?h.host.replace(e,""):h.host},set:function(e){h.host=e}},hostname:{get:function(){return h.hostname},set:function(e){h.hostname=e}},port:{get:function(){return h.port},set:function(e){h.port=e}},pathname:{get:function(){return"/"!==h.pathname.charAt(0)?"/"+h.pathname:h.pathname},set:function(e){h.pathname=e}},search:{get:function(){return h.search},set:function(e){h.search!==e&&(h.search=e,u(),c())}},searchParams:{get:function(){return d}},hash:{get:function(){return h.hash},set:function(e){h.hash=e,u()}},toString:{value:function(){return h.toString()}},valueOf:{value:function(){return h.valueOf()}}}),l},n)for(var i in n)n.hasOwnProperty(i)&&(e.URL[i]=n[i])}(this),function(e){function t(e){if(e=String(e),e.match(/[^\x00-\xFF]/))throw TypeError("Not a valid ByteString");return e}function r(e){return e=String(e),e.replace(/([\u0000-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDFFF])/g,function(e){return/^[\uD800-\uDFFF]$/.test(e)?"�":e})}function n(e){return 65535&e}function o(e){return String(e).replace(/[a-z]/g,function(e){return e.toUpperCase()})}function i(e){return e=o(e),"CONNECT"===e||"TRACE"===e||"TRACK"===e}function s(e){var t=o(e);return"DELETE"===t||"GET"===t||"HEAD"===t||"OPTIONS"===t||"POST"===t||"PUT"===t?t:e}function a(e){return/^[!#$%&'*+\-.09A-Z^_`a-z|~]+$/.test(e)}function u(e){return!0}function c(e){e=String(e).toLowerCase();var t={"accept-charset":!0,"accept-encoding":!0,"access-control-request-headers":!0,"access-control-request-method":!0,connection:!0,"content-length":!0,cookie:!0,cookie2:!0,date:!0,dnt:!0,expect:!0,host:!0,"keep-alive":!0,origin:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,via:!0};return t[e]||"proxy-"===e.substring(0,6)||"sec-"===e.substring(0,4)}function h(e){e=String(e).toLowerCase();var t={"set-cookie":!0,"set-cookie2":!0};return t[e]}function f(e,t){return e=String(e).toLowerCase(),"accept"===e||"accept-language"===e||"content-language"===e||"content-type"===e&&-1!==["application/x-www-form-encoded","multipart/form-data","text/plain"].indexOf(t)}function l(e){this._guard="none",this._headerList=[],e&&d(this,e)}function d(e,t){t instanceof l?t._headerList.forEach(function(t){e.append(t[0],t[1])}):Array.isArray(t)?t.forEach(function(t){if(!Array.isArray(t)||2!==t.length)throw TypeError();e.append(t[0],t[1])}):(t=Object(t),Object.keys(t).forEach(function(r){e.append(r,t[r])}))}function p(e){this._headers=e,this._index=0}function m(e){this._stream=e,this.bodyUsed=!1}function g(e,n){if(arguments.length<1)throw TypeError("Not enough arguments");if(m.call(this,null),this.method="GET",this.url="",this.headers=new l,this.headers._guard="request",this.referrer=null,this.mode=null,this.credentials=null,e instanceof g){if(e.bodyUsed)throw TypeError();e.bodyUsed=!0,this.method=e.method,this.url=e.url,this.headers=new l(e.headers),this.headers._guard=e.headers._guard,this._stream=e._stream}else e=r(e),this.url=String(new URL(e,self.location));if(n=Object(n),"method"in n){var o=t(n.method);if(i(o))throw TypeError();this.method=s(o)}"headers"in n&&(this.headers=new l,d(this.headers,n.headers)),"body"in n&&(this._stream=n.body)}function E(e,t){if(arguments.length<1&&(e=""),this.headers=new l,this.headers._guard="response",e instanceof XMLHttpRequest&&"_url"in e){var o=e;return this.type="basic",this.url=r(o._url),this.status=o.status,this.ok=200<=this.status&&this.status<=299,this.statusText=o.statusText,o.getAllResponseHeaders().split(/\r?\n/).filter(function(e){return e.length}).forEach(function(e){var t=e.indexOf(":");this.headers.append(e.substring(0,t),e.substring(t+2))},this),void m.call(this,o.responseText)}m.call(this,e),t=Object(t)||{},this.url="";var i="status"in t?n(t.status):200;if(200>i||i>599)throw RangeError();this.status=i,this.ok=200<=this.status&&this.status<=299;var s="statusText"in t?String(t.statusText):"OK";if(/[^\x00-\xFF]/.test(s))throw TypeError();this.statusText=s,"headers"in t&&d(this.headers,t),this.type="basic"}function v(e,t){return new Promise(function(r,n){var o=new g(e,t),i=new XMLHttpRequest,s=!0;i._url=o.url;try{i.open(o.method,o.url,s)}catch(a){throw TypeError(a.message)}for(var u=o.headers[Symbol.iterator](),c=u.next();!c.done;c=u.next())i.setRequestHeader(c.value[0],c.value[1]);i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&(0===i.status?n(new TypeError("Network error")):r(new E(i)))},i.send(o._stream)})}l.prototype={append:function(e,r){if(e=t(e),!a(e)||!u(r))throw TypeError();if("immutable"===this._guard)throw TypeError();"request"===this._guard&&c(e)||("request-no-CORS"!==this._guard||f(e,r))&&("response"===this._guard&&h(e)||(e=e.toLowerCase(),this._headerList.push([e,r])))},"delete":function(e){if(e=t(e),!a(e))throw TypeError();if("immutable"===this._guard)throw TypeError();if(!("request"===this._guard&&c(e)||"request-no-CORS"===this._guard&&!f(e,"invalid")||"response"===this._guard&&h(e))){e=e.toLowerCase();for(var r=0;r<this._headerList.length;)this._headerList[r][0]===e?this._headerList.splice(r,1):++r}},get:function(e){if(e=t(e),!a(e))throw TypeError();e=e.toLowerCase();for(var r=0;r<this._headerList.length;++r)if(this._headerList[r][0]===e)return this._headerList[r][1];return null},getAll:function(e){if(e=t(e),!a(e))throw TypeError();e=e.toLowerCase();for(var r=[],n=0;n<this._headerList.length;++n)this._headerList[n][0]===e&&r.push(this._headerList[n][1]);return r},has:function(e){if(e=t(e),!a(e))throw TypeError();e=e.toLowerCase();for(var r=0;r<this._headerList.length;++r)if(this._headerList[r][0]===e)return!0;return!1},set:function(e,r){if(e=t(e),!a(e)||!u(r))throw TypeError();if("immutable"===this._guard)throw TypeError();if(!("request"===this._guard&&c(e)||"request-no-CORS"===this._guard&&!f(e,r)||"response"===this._guard&&h(e))){e=e.toLowerCase();for(var n=0;n<this._headerList.length;++n)if(this._headerList[n][0]===e){for(this._headerList[n++][1]=r;n<this._headerList.length;)this._headerList[n][0]===e?this._headerList.splice(n,1):++n;return}this._headerList.push([e,r])}}},l.prototype[Symbol.iterator]=function(){return new p(this)},p.prototype={},p.prototype.next=function(){return this._index>=this._headers._headerList.length?{value:void 0,done:!0}:{value:this._headers._headerList[this._index++],done:!1}},p.prototype[Symbol.iterator]=function(){return this},m.prototype={arrayBuffer:function(){if(this.bodyUsed)return Promise.reject(TypeError());if(this.bodyUsed=!0,this._stream instanceof ArrayBuffer)return Promise.resolve(this._stream);var e=this._stream;return new Promise(function(t,r){var n=unescape(encodeURIComponent(e)).split("").map(function(e){return e.charCodeAt(0)});t(new Uint8Array(n).buffer)})},blob:function(){return this.bodyUsed?Promise.reject(TypeError()):(this.bodyUsed=!0,this._stream instanceof Blob?Promise.resolve(this._stream):Promise.resolve(new Blob([this._stream])))},formData:function(){return this.bodyUsed?Promise.reject(TypeError()):(this.bodyUsed=!0,this._stream instanceof FormData?Promise.resolve(this._stream):Promise.reject(Error("Not yet implemented")))},json:function(){if(this.bodyUsed)return Promise.reject(TypeError());this.bodyUsed=!0;var e=this;return new Promise(function(t,r){t(JSON.parse(e._stream))})},text:function(){return this.bodyUsed?Promise.reject(TypeError()):(this.bodyUsed=!0,Promise.resolve(String(this._stream)))}},g.prototype=m.prototype,E.prototype=m.prototype,E.redirect=function(){throw Error("Not supported")},e.Headers=l,e.Request=g,e.Response=E,e.fetch=v}(self),function(e){"window"in e&&"document"in e&&"TextRectangle"in this&&!("width"in TextRectangle.prototype)&&Object.defineProperties(TextRectangle.prototype,{width:{get:function(){return this.right-this.left}},height:{get:function(){return this.bottom-this.top}}})}(this),function(e){"window"in e&&"document"in e&&(!function(){function t(e){return e.offsetWidth>0&&e.offsetHeight>0}function r(){var e=s;s=Object.create(null),u=-1,Object.keys(e).forEach(function(r){var n=e[r];(!n.element||t(n.element))&&n.callback(Date.now())})}function n(t,n){var o=++a;return s[o]={callback:t,element:n},-1===u&&(u=e.setTimeout(r,1e3/i)),o}function o(t){delete s[t],0===Object.keys(s).length&&(e.clearTimeout(u),u=-1)}if(!("requestAnimationFrame"in e)){var i=60,s=Object.create(null),a=0,u=-1;e.requestAnimationFrame=n,e.cancelAnimationFrame=o}}(),function(){function t(t){var r=[].slice.call(arguments,1);return e.setTimeout(function(){t.apply(null,r)},0)}function r(t){e.clearTimeout(t)}"setImmediate"in e||(e.setImmediate=t,e.clearImmediate=r)}())}(this),function(e){"use strict";function t(e){if(r)return new n(e);var t=document.createElement("a");return t.href=e,t}var r,n=e.URL;try{if(n){if(r=new e.URL("http://example.com"),"searchParams"in r)return;"href"in r||(r=void 0)}}catch(o){}if(e.URL=function(o,i){function s(e,t){var r=e.split("&");t&&-1===r[0].indexOf("=")&&(r[0]="="+r[0]);var n=[];r.forEach(function(e){if(0!==e.length){var t=e.indexOf("=");if(-1!==t)var r=e.substring(0,t),o=e.substring(t+1);else r=e,o="";r=r.replace(/\+/g," "),o=o.replace(/\+/g," "),n.push({name:r,value:o})}});var o=[];return n.forEach(function(e){o.push({name:decodeURIComponent(e.name),value:decodeURIComponent(e.value)})}),o}function a(t,r){function n(){a||(a=!0,"about:"===t.protocol&&-1!==t.pathname.indexOf("?")&&(t.pathname=t.pathname.split("?")[0]),t.search=o(i),a=!1)}function o(e){var t="",r=!0;return e.forEach(function(e){var n=encodeURIComponent(e.name),o=encodeURIComponent(e.value);r||(t+="&"),t+=n+"="+o,r=!1}),t.replace(/%20/g,"+")}var i=[];r&&(i=s(r)),this._setPairs=function(e){a||(i=e)},this._updateSteps=function(){n()};var a=!1;Object.defineProperties(this,{append:{value:function(e,t){i.push({name:e,value:t}),n()}},"delete":{value:function(e){for(var t=0;t<i.length;)i[t].name===e?i.splice(t,1):++t;n()}},get:{value:function(e){for(var t=0;t<i.length;++t)if(i[t].name===e)return i[t].value;return null}},getAll:{value:function(e){for(var t=[],r=0;r<i.length;++r)i[r].name===e&&t.push(i[r].value);return t}},has:{value:function(e){for(var t=0;t<i.length;++t)if(i[t].name===e)return!0;return!1}},set:{value:function(e,t){for(var r=!1,o=0;o<i.length;)i[o].name===e?r?i.splice(o,1):(i[o].value=t,r=!0,++o):++o;r||i.push({name:e,value:t}),n()}},toString:{value:function(){return o(i)}}}),"Symbol"in e&&"iterator"in e.Symbol&&Object.defineProperty(this,e.Symbol.iterator,{value:function(){var e=0;return{next:function(){if(e>=i.length)return{done:!0,value:void 0};var t=i[e++];return{done:!1,value:[t.name,t.value]}}}}})}function u(){var e=h.href.replace(/#$|\?$|\?(?=#)/g,"");h.href!==e&&(h.href=e)}function c(){d._setPairs(h.search?s(h.search.substring(1)):[]),d._updateSteps()}if(!(this instanceof e.URL))throw new TypeError("Failed to construct 'URL': Please use the 'new' operator.");i&&(o=function(){if(r)return new n(o,i).href;var e;if(document.implementation&&document.implementation.createHTMLDocument?e=document.implementation.createHTMLDocument(""):document.implementation&&document.implementation.createDocument?(e=document.implementation.createElement("http://www.w3.org/1999/xhtml","html",null),e.documentElement.appendChild(e.createElement("head")),e.documentElement.appendChild(e.createElement("body"))):window.ActiveXObject&&(e=new window.ActiveXObject("htmlfile"),e.write("<head></head><body></body>"),e.close()),!e)throw Error("base not supported");var t=e.createElement("base");t.href=i,e.getElementsByTagName("head")[0].appendChild(t);var s=e.createElement("a");return s.href=o,s.href}());var h=t(o||""),f=function(){if(!("defineProperties"in Object))return!1;try{var e={};return Object.defineProperties(e,{prop:{get:function(){return!0}}}),e.prop}catch(t){return!1}}(),l=f?this:document.createElement("a"),d=new a(l,h.search?h.search.substring(1):null);return Object.defineProperties(l,{href:{get:function(){return h.href},set:function(e){h.href=e,u(),c()}},origin:{get:function(){return"origin"in h?h.origin:this.protocol+"//"+this.host}},protocol:{get:function(){return h.protocol},set:function(e){h.protocol=e}},username:{get:function(){return h.username},set:function(e){h.username=e}},password:{get:function(){return h.password},set:function(e){h.password=e}},host:{get:function(){var e={"http:":/:80$/,"https:":/:443$/,"ftp:":/:21$/}[h.protocol];return e?h.host.replace(e,""):h.host},set:function(e){h.host=e}},hostname:{get:function(){return h.hostname},set:function(e){h.hostname=e}},port:{get:function(){return h.port},set:function(e){h.port=e}},pathname:{get:function(){return"/"!==h.pathname.charAt(0)?"/"+h.pathname:h.pathname},set:function(e){h.pathname=e}},search:{get:function(){return h.search},set:function(e){h.search!==e&&(h.search=e,u(),c())}},searchParams:{get:function(){return d}},hash:{get:function(){return h.hash},set:function(e){h.hash=e,u()}},toString:{value:function(){return h.toString()}},valueOf:{value:function(){return h.valueOf()}}}),l},n)for(var i in n)n.hasOwnProperty(i)&&(e.URL[i]=n[i])}(this),function(e){function t(e){if(e=String(e),e.match(/[^\x00-\xFF]/))throw TypeError("Not a valid ByteString");return e}function r(e){return e=String(e),e.replace(/([\u0000-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDFFF])/g,function(e){return/^[\uD800-\uDFFF]$/.test(e)?"�":e})}function n(e){return 65535&e}function o(e){return String(e).replace(/[a-z]/g,function(e){return e.toUpperCase()})}function i(e){return e=o(e),"CONNECT"===e||"TRACE"===e||"TRACK"===e}function s(e){var t=o(e);return"DELETE"===t||"GET"===t||"HEAD"===t||"OPTIONS"===t||"POST"===t||"PUT"===t?t:e}function a(e){return/^[!#$%&'*+\-.09A-Z^_`a-z|~]+$/.test(e)}function u(e){return!0}function c(e){e=String(e).toLowerCase();var t={"accept-charset":!0,"accept-encoding":!0,"access-control-request-headers":!0,"access-control-request-method":!0,connection:!0,"content-length":!0,cookie:!0,cookie2:!0,date:!0,dnt:!0,expect:!0,host:!0,"keep-alive":!0,origin:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,via:!0};return t[e]||"proxy-"===e.substring(0,6)||"sec-"===e.substring(0,4)}function h(e){e=String(e).toLowerCase();var t={"set-cookie":!0,"set-cookie2":!0};return t[e]}function f(e,t){return e=String(e).toLowerCase(),"accept"===e||"accept-language"===e||"content-language"===e||"content-type"===e&&-1!==["application/x-www-form-encoded","multipart/form-data","text/plain"].indexOf(t)}function l(e){this._guard="none",this._headerList=[],e&&d(this,e)}function d(e,t){t instanceof l?t._headerList.forEach(function(t){e.append(t[0],t[1])}):Array.isArray(t)?t.forEach(function(t){if(!Array.isArray(t)||2!==t.length)throw TypeError();e.append(t[0],t[1])}):(t=Object(t),Object.keys(t).forEach(function(r){e.append(r,t[r])}))}function p(e){this._headers=e,this._index=0}function m(e){this._stream=e,this.bodyUsed=!1}function g(e,n){if(arguments.length<1)throw TypeError("Not enough arguments");if(m.call(this,null),this.method="GET",this.url="",this.headers=new l,this.headers._guard="request",this.referrer=null,this.mode=null,this.credentials=null,e instanceof g){if(e.bodyUsed)throw TypeError();e.bodyUsed=!0,this.method=e.method,this.url=e.url,this.headers=new l(e.headers),this.headers._guard=e.headers._guard,this._stream=e._stream}else e=r(e),this.url=String(new URL(e,self.location));if(n=Object(n),"method"in n){var o=t(n.method);if(i(o))throw TypeError();this.method=s(o)}"headers"in n&&(this.headers=new l,d(this.headers,n.headers)),"body"in n&&(this._stream=n.body)}function E(e,t){if(arguments.length<1&&(e=""),this.headers=new l,this.headers._guard="response",e instanceof XMLHttpRequest&&"_url"in e){var o=e;return this.type="basic",this.url=r(o._url),this.status=o.status,this.ok=200<=this.status&&this.status<=299,this.statusText=o.statusText,o.getAllResponseHeaders().split(/\r?\n/).filter(function(e){return e.length}).forEach(function(e){var t=e.indexOf(":");this.headers.append(e.substring(0,t),e.substring(t+2))},this),void m.call(this,o.responseText)}m.call(this,e),t=Object(t)||{},this.url="";var i="status"in t?n(t.status):200;if(200>i||i>599)throw RangeError();this.status=i,this.ok=200<=this.status&&this.status<=299;var s="statusText"in t?String(t.statusText):"OK";if(/[^\x00-\xFF]/.test(s))throw TypeError();this.statusText=s,"headers"in t&&d(this.headers,t),this.type="basic"}function v(e,t){return new Promise(function(r,n){var o=new g(e,t),i=new XMLHttpRequest,s=!0;i._url=o.url;try{i.open(o.method,o.url,s)}catch(a){throw TypeError(a.message)}for(var u=o.headers[Symbol.iterator](),c=u.next();!c.done;c=u.next())i.setRequestHeader(c.value[0],c.value[1]);i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&(0===i.status?n(new TypeError("Network error")):r(new E(i)))},i.send(o._stream)})}l.prototype={append:function(e,r){if(e=t(e),!a(e)||!u(r))throw TypeError();if("immutable"===this._guard)throw TypeError();"request"===this._guard&&c(e)||("request-no-CORS"!==this._guard||f(e,r))&&("response"===this._guard&&h(e)||(e=e.toLowerCase(),this._headerList.push([e,r])))},"delete":function(e){if(e=t(e),!a(e))throw TypeError();if("immutable"===this._guard)throw TypeError();if(!("request"===this._guard&&c(e)||"request-no-CORS"===this._guard&&!f(e,"invalid")||"response"===this._guard&&h(e))){e=e.toLowerCase();for(var r=0;r<this._headerList.length;)this._headerList[r][0]===e?this._headerList.splice(r,1):++r}},get:function(e){if(e=t(e),!a(e))throw TypeError();e=e.toLowerCase();for(var r=0;r<this._headerList.length;++r)if(this._headerList[r][0]===e)return this._headerList[r][1];return null},getAll:function(e){if(e=t(e),!a(e))throw TypeError();e=e.toLowerCase();for(var r=[],n=0;n<this._headerList.length;++n)this._headerList[n][0]===e&&r.push(this._headerList[n][1]);return r},has:function(e){if(e=t(e),!a(e))throw TypeError();e=e.toLowerCase();for(var r=0;r<this._headerList.length;++r)if(this._headerList[r][0]===e)return!0;return!1},set:function(e,r){if(e=t(e),!a(e)||!u(r))throw TypeError();if("immutable"===this._guard)throw TypeError();if(!("request"===this._guard&&c(e)||"request-no-CORS"===this._guard&&!f(e,r)||"response"===this._guard&&h(e))){e=e.toLowerCase();for(var n=0;n<this._headerList.length;++n)if(this._headerList[n][0]===e){for(this._headerList[n++][1]=r;n<this._headerList.length;)this._headerList[n][0]===e?this._headerList.splice(n,1):++n;return}this._headerList.push([e,r])}}},l.prototype[Symbol.iterator]=function(){return new p(this)},p.prototype={},p.prototype.next=function(){return this._index>=this._headers._headerList.length?{value:void 0,done:!0}:{value:this._headers._headerList[this._index++],done:!1}},p.prototype[Symbol.iterator]=function(){return this},m.prototype={arrayBuffer:function(){if(this.bodyUsed)return Promise.reject(TypeError());if(this.bodyUsed=!0,
this._stream instanceof ArrayBuffer)return Promise.resolve(this._stream);var e=this._stream;return new Promise(function(t,r){var n=unescape(encodeURIComponent(e)).split("").map(function(e){return e.charCodeAt(0)});t(new Uint8Array(n).buffer)})},blob:function(){return this.bodyUsed?Promise.reject(TypeError()):(this.bodyUsed=!0,this._stream instanceof Blob?Promise.resolve(this._stream):Promise.resolve(new Blob([this._stream])))},formData:function(){return this.bodyUsed?Promise.reject(TypeError()):(this.bodyUsed=!0,this._stream instanceof FormData?Promise.resolve(this._stream):Promise.reject(Error("Not yet implemented")))},json:function(){if(this.bodyUsed)return Promise.reject(TypeError());this.bodyUsed=!0;var e=this;return new Promise(function(t,r){t(JSON.parse(e._stream))})},text:function(){return this.bodyUsed?Promise.reject(TypeError()):(this.bodyUsed=!0,Promise.resolve(String(this._stream)))}},g.prototype=m.prototype,E.prototype=m.prototype,E.redirect=function(){throw Error("Not supported")},e.Headers=l,e.Request=g,e.Response=E,e.fetch=v}(self);