engine-wrapper.min.js 4.4 KB

1
  1. !function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([,function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports={type:function(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()},isObject:function(e,t){return t?"object"===this.type(e):e&&"object"===(void 0===e?"undefined":o(e))},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},trim:function(e){return e.replace(/(^\s*)|(\s*$)/g,"")},encode:function(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")},formatParams:function(e){function t(e,a){var i=r.encode,s=r.type(e);if("array"==s)e.forEach(function(e,n){r.isObject(e)||(n=""),t(e,a+"%5B"+n+"%5D")});else if("object"==s)for(var u in e)a?t(e[u],a+"%5B"+i(u)+"%5D"):t(e[u],i(u));else o||(n+="&"),o=!1,n+=a+"="+i(e)}var n="",o=!0,r=this;return this.isObject(e)?(t(e,""),n):e},merge:function(e,t){for(var n in t)e.hasOwnProperty(n)?this.isObject(t[n],1)&&this.isObject(e[n],1)&&this.merge(e[n],t[n]):e[n]=t[n];return e}}},,,function(e,t,n){function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){return function(){function t(){o(this,t),this.requestHeaders={},this.readyState=0,this.timeout=0,this.responseURL="",this.responseHeaders={}}return i(t,[{key:"_call",value:function(e){this[e]&&this[e].apply(this,[].splice.call(arguments,1))}},{key:"_changeReadyState",value:function(e){this.readyState=e,this._call("onreadystatechange")}},{key:"open",value:function(e,t){if(this.method=e,t){if(t=s.trim(t),0!==t.indexOf("http")&&u){var n=document.createElement("a");n.href=t,t=n.href}}else t=location.href;this.responseURL=t,this._changeReadyState(1)}},{key:"send",value:function(t){var n=this;t=t||null;var o=this;if(e){var r={method:o.method,url:o.responseURL,headers:o.requestHeaders||{},body:t};s.merge(r,o._options||{}),"GET"===r.method&&(r.body=null),o._changeReadyState(3);var i=void 0;o.timeout=o.timeout||0,o.timeout>0&&(i=setTimeout(function(){3===o.readyState&&(n._call("onloadend"),o._changeReadyState(0),o._call("ontimeout"))},o.timeout)),r.timeout=o.timeout,e(r,function(e){function t(t){var n=e[t];return delete e[t],n}if(3===o.readyState){clearTimeout(i),o.status=t("statusCode")-0;var n=t("responseText"),r=t("statusMessage");if(o.status){var s=t("headers"),c={};for(var l in s){var f=s[l],p=l.toLowerCase();"object"===(void 0===f?"undefined":a(f))?c[p]=f:(c[p]=c[p]||[],c[p].push(f))}var d=c["set-cookie"];u&&d&&d.forEach(function(e){document.cookie=e.replace(/;\s*httpOnly/gi,"")}),o.responseHeaders=c,o.statusText=r||"",o.response=o.responseText=n,o._response=e,o._changeReadyState(4),o._call("onload")}else o.statusText=n,o._call("onerror",{msg:r});o._call("onloadend")}})}else console.error("Ajax require adapter")}},{key:"setRequestHeader",value:function(e,t){this.requestHeaders[s.trim(e)]=t}},{key:"getResponseHeader",value:function(e){return(this.responseHeaders[e.toLowerCase()]||"").toString()||null}},{key:"getAllResponseHeaders",value:function(){var e="";for(var t in this.responseHeaders)e+=t+":"+this.getResponseHeader(t)+"\r\n";return e||null}},{key:"abort",value:function(e){this._changeReadyState(0),this._call("onerror",{msg:e}),this._call("onloadend")}}],[{key:"setAdapter",value:function(t){e=t}}]),t}()}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),s=n(1),u="undefined"!=typeof document;!function(e,t){t()}(0,function(){window.EngineWrapper=r}),e.exports=r}]);