@alanchenchen/browserbuffer
Version:
A simple implementation for browser to switch string between buffer
7 lines • 32.6 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("BrowserBuffer",[],e):"object"==typeof exports?exports.BrowserBuffer=e():t.BrowserBuffer=e()}("undefined"!=typeof self?self:this,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=35)}([function(t,e){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,e,r){var n=r(26)("wks"),o=r(27),i=r(0).Symbol,a="function"==typeof i;(t.exports=function(t){return n[t]||(n[t]=a&&i[t]||(a?i:o)("Symbol."+t))}).store=n},function(t,e){var r=t.exports={version:"2.6.9"};"number"==typeof __e&&(__e=r)},function(t,e,r){var n=r(8);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t,e,r){var n=r(7),o=r(24);t.exports=r(5)?function(t,e,r){return n.f(t,e,o(1,r))}:function(t,e,r){return t[e]=r,t}},function(t,e,r){t.exports=!r(23)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,r){var n=r(0),o=r(2),i=r(10),a=r(4),u=r(12),c=function(t,e,r){var s,f,l,p=t&c.F,h=t&c.G,v=t&c.S,d=t&c.P,y=t&c.B,m=t&c.W,g=h?o:o[e]||(o[e]={}),b=g.prototype,w=h?n:v?n[e]:(n[e]||{}).prototype;for(s in h&&(r=e),r)(f=!p&&w&&void 0!==w[s])&&u(g,s)||(l=f?w[s]:r[s],g[s]=h&&"function"!=typeof w[s]?r[s]:y&&f?i(l,n):m&&w[s]==l?function(t){var e=function(e,r,n){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,r)}return new t(e,r,n)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(l):d&&"function"==typeof l?i(Function.call,l):l,d&&((g.virtual||(g.virtual={}))[s]=l,t&c.R&&b&&!b[s]&&a(b,s,l)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},function(t,e,r){var n=r(3),o=r(45),i=r(46),a=Object.defineProperty;e.f=r(5)?Object.defineProperty:function(t,e,r){if(n(t),e=i(e,!0),n(r),o)try{return a(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[e]=r.value),t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){t.exports={}},function(t,e,r){var n=r(11);t.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e){var r={}.hasOwnProperty;t.exports=function(t,e){return r.call(t,e)}},function(t,e){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,e){var r=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:r)(t)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports=!0},function(t,e,r){var n=r(8),o=r(0).document,i=n(o)&&n(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,r){var n=r(53),o=r(15);t.exports=function(t){return n(o(t))}},function(t,e,r){var n=r(26)("keys"),o=r(27);t.exports=function(t){return n[t]||(n[t]=o(t))}},function(t,e,r){var n=r(7).f,o=r(12),i=r(1)("toStringTag");t.exports=function(t,e,r){t&&!o(t=r?t:t.prototype,i)&&n(t,i,{configurable:!0,value:e})}},function(t,e,r){"use strict";var n=r(11);t.exports.f=function(t){return new function(t){var e,r;this.promise=new t(function(t,n){if(void 0!==e||void 0!==r)throw TypeError("Bad Promise constructor");e=t,r=n}),this.resolve=n(e),this.reject=n(r)}(t)}},function(t,e,r){"use strict";var n=r(16),o=r(6),i=r(47),a=r(4),u=r(9),c=r(48),s=r(20),f=r(56),l=r(1)("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,r,v,d,y,m){c(r,e,v);var g,b,w,x=function(t){if(!p&&t in k)return k[t];switch(t){case"keys":case"values":return function(){return new r(this,t)}}return function(){return new r(this,t)}},_=e+" Iterator",j="values"==d,E=!1,k=t.prototype,L=k[l]||k["@@iterator"]||d&&k[d],O=L||x(d),P=d?j?x("entries"):O:void 0,S="Array"==e&&k.entries||L;if(S&&(w=f(S.call(new t)))!==Object.prototype&&w.next&&(s(w,_,!0),n||"function"==typeof w[l]||a(w,l,h)),j&&L&&"values"!==L.name&&(E=!0,O=function(){return L.call(this)}),n&&!m||!p&&!E&&k[l]||a(k,l,O),u[e]=O,u[_]=h,d)if(g={values:j?O:x("values"),keys:y?O:x("keys"),entries:P},m)for(b in g)b in k||i(k,b,g[b]);else o(o.P+o.F*(p||E),e,g);return g}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,r){var n=r(14),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},function(t,e,r){var n=r(2),o=r(0),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:n.version,mode:r(16)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){var r=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+n).toString(36))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,r){var n=r(0).document;t.exports=n&&n.documentElement},function(t,e,r){var n=r(13),o=r(1)("toStringTag"),i="Arguments"==n(function(){return arguments}());t.exports=function(t){var e,r,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),o))?r:i?n(e):"Object"==(a=n(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,r){var n=r(3),o=r(11),i=r(1)("species");t.exports=function(t,e){var r,a=n(t).constructor;return void 0===a||void 0==(r=n(a)[i])?e:o(r)}},function(t,e,r){var n,o,i,a=r(10),u=r(68),c=r(29),s=r(17),f=r(0),l=f.process,p=f.setImmediate,h=f.clearImmediate,v=f.MessageChannel,d=f.Dispatch,y=0,m={},g=function(){var t=+this;if(m.hasOwnProperty(t)){var e=m[t];delete m[t],e()}},b=function(t){g.call(t.data)};p&&h||(p=function(t){for(var e=[],r=1;arguments.length>r;)e.push(arguments[r++]);return m[++y]=function(){u("function"==typeof t?t:Function(t),e)},n(y),y},h=function(t){delete m[t]},"process"==r(13)(l)?n=function(t){l.nextTick(a(g,t,1))}:d&&d.now?n=function(t){d.now(a(g,t,1))}:v?(i=(o=new v).port2,o.port1.onmessage=b,n=a(i.postMessage,i,1)):f.addEventListener&&"function"==typeof postMessage&&!f.importScripts?(n=function(t){f.postMessage(t+"","*")},f.addEventListener("message",b,!1)):n="onreadystatechange"in s("script")?function(t){c.appendChild(s("script")).onreadystatechange=function(){c.removeChild(this),g.call(t)}}:function(t){setTimeout(a(g,t,1),0)}),t.exports={set:p,clear:h}},function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,e,r){var n=r(3),o=r(8),i=r(21);t.exports=function(t,e){if(n(t),o(e)&&e.constructor===t)return e;var r=i.f(t);return(0,r.resolve)(e),r.promise}},function(t,e,r){"use strict";var n=u(r(36)),o=u(r(39)),i=u(r(76)),a=u(r(77));function u(t){return t&&t.__esModule?t:{default:t}}
/**!
* @name BrowserBuffer
* @author Alan chen
* @since 2019/09/27
* @license 996.ICU
*/t.exports=function(){function t(){(0,i.default)(this,t),this._init(),this.version=r(81).version,this.createdBy="alanchenchen@github.com"}return(0,a.default)(t,[{key:"_init",value:function(){this._downloadElement=document.createElement("a"),this._uploadElement=document.createElement("input"),this._uploadElement.type="file"}},{key:"_specifyData",value:function(t){return"[object Blob]"==Object.prototype.toString.call(t)?"blob":"[object ArrayBuffer]"==Object.prototype.toString.call(t)?"arrayBuffer":"string"==typeof t?"string":"[object Object]"==Object.prototype.toString.call(t)?"object":void 0}},{key:"_saveBuffer",value:function(){var t=(0,o.default)(n.default.mark(function t(e,r,o){var i;return n.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.toString(e,{encode:"dataURL",MIME:e.type,charset:o});case 2:i=t.sent,this._downloadElement.href=i,this._downloadElement.download=r,this._downloadElement.click();case 6:case"end":return t.stop()}},t,this)}));return function(e,r,n){return t.apply(this,arguments)}}()},{key:"_saveURL",value:function(t,e){this._downloadElement.href=t,this._downloadElement.download=e,this._downloadElement.click()}},{key:"readFile",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.accept,i=void 0===r?["*"]:r,a=e.multiple,u=void 0!==a&&a,c=e.encode,s=void 0===c?"base64":c;this._uploadElement.accept=i.join(","),this._uploadElement.multiple=u;var f=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"base64";return new Promise(function(r,n){var o=new FileReader,i=null;switch(e){case"utf8":i="readAsText";break;case"base64":i="readAsDataURL";break;case"binary":i="readAsArrayBuffer";break;default:i="readAsDataURL"}o[i](t),o.onload=function(){var t=o.result;"base64"==e&&(t=o.result.split("base64,")[1]),r(t)},o.onerror=function(){o.abort(),n("some erros occured")}})};return new Promise(function(e,r){t._uploadElement.onchange=function(){var i=(0,o.default)(n.default.mark(function o(i){var a,u,c,l,p,h,v,d;return n.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:a=[],u=t._uploadElement.files||i.path[0].files,n.prev=2,c=!0,l=!1,p=void 0,n.prev=6,h=Object.keys(u)[Symbol.iterator]();case 8:if(c=(v=h.next()).done){n.next=22;break}return d=v.value,a[d]={},a[d].name=u[d].name,a[d].type=u[d].type,a[d].size=u[d].size,a[d].lastModified=u[d].lastModified,a[d].lastModifiedDate=u[d].lastModifiedDate,n.next=18,f(u[d],s);case 18:a[d].data=n.sent;case 19:c=!0,n.next=8;break;case 22:n.next=28;break;case 24:n.prev=24,n.t0=n.catch(6),l=!0,p=n.t0;case 28:n.prev=28,n.prev=29,!c&&h.return&&h.return();case 31:if(n.prev=31,!l){n.next=34;break}throw p;case 34:return n.finish(31);case 35:return n.finish(28);case 36:e(a),n.next=42;break;case 39:n.prev=39,n.t1=n.catch(2),r(n.t1);case 42:case"end":return n.stop()}},o,t,[[2,39],[6,24,28,36],[29,,31,35]])}));return function(t){return i.apply(this,arguments)}}(),t._uploadElement.click()})}},{key:"writeFile",value:function(){var t=(0,o.default)(n.default.mark(function t(){var e,r,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=o.filename,a=void 0===i?"":i,u=o.dataPath,c=void 0===u?"":u,s=o.data,f=o.MIME,l=void 0===f?"text/plain":f,p=o.charset,h=void 0===p?"utf8":p;return n.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!Boolean(c.trim())){t.next=5;break}return this._saveURL(c,a),t.abrupt("return");case 5:if(e=void 0,"string"!=(r=this._specifyData(s))&&"arrayBuffer"!=r&&"blob"!=r){t.next=11;break}e=new Blob([s],{type:l}),t.next=16;break;case 11:if("object"!=r){t.next=15;break}e=new Blob([JSON.stringify(s)],{type:l}),t.next=16;break;case 15:throw new Error("data must be string or object or Blob or ArrayBuffer");case 16:return t.next=18,this._saveBuffer(e,a,h);case 18:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"from",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";try{var r=new Blob([t]);return new Promise(function(n,o){if("utf8"===e){var i=new FileReader;i.readAsArrayBuffer(r),i.onload=function(){n(i.result)},i.onerror=function(){i.abort(),o("some erros occured")}}else{if("base64"!==e||"string"!=typeof t)throw new Error("encode must be utf8 or base64");for(var a=atob(t),u=a.length,c=new Uint8Array(u);u--;)c[u]=a.charCodeAt(u);n(c)}})}catch(t){throw new Error("data must be string or object or Blob or ArrayBuffer, "+t)}}},{key:"toString",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.encode,n=void 0===r?"utf8":r,o=e.MIME,i=void 0===o?"text/plain":o,a=e.charset,u=void 0===a?"utf8":a;try{var c=new Blob([t],{type:i}),s=null;switch(n){case"utf8":s="readAsText";break;case"base64":case"dataURL":s="readAsDataURL";break;default:s="readAsText"}return new Promise(function(t,e){var r=new FileReader;r[s](c),r.onload=function(){if("utf8"==n)t(r.result);else{var e=r.result.split(";").join(";charset="+u+";");"base64"==n&&(e=e.split("base64,")[1]),t(e)}},r.onerror=function(){r.abort(),e("some erros occured")}})}catch(t){throw new Error("data must be string or object or Blob or ArrayBuffer, "+t)}}}]),t}()},function(t,e,r){t.exports=r(37)},function(t,e,r){var n=function(){return this}()||Function("return this")(),o=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,i=o&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=r(38),o)n.regeneratorRuntime=i;else try{delete n.regeneratorRuntime}catch(t){n.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";var r,n=Object.prototype,o=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag",s="object"==typeof t,f=e.regeneratorRuntime;if(f)s&&(t.exports=f);else{(f=e.regeneratorRuntime=s?t.exports:{}).wrap=w;var l="suspendedStart",p="suspendedYield",h="executing",v="completed",d={},y={};y[a]=function(){return this};var m=Object.getPrototypeOf,g=m&&m(m(T([])));g&&g!==n&&o.call(g,a)&&(y=g);var b=E.prototype=_.prototype=Object.create(y);j.prototype=b.constructor=E,E.constructor=j,E[c]=j.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===j||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(b),t},f.awrap=function(t){return{__await:t}},k(L.prototype),L.prototype[u]=function(){return this},f.AsyncIterator=L,f.async=function(t,e,r,n){var o=new L(w(t,e,r,n));return f.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},k(b),b[c]="Generator",b[a]=function(){return this},b.toString=function(){return"[object Generator]"},f.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=T,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,o){return u.type="throw",u.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:T(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),d}}}function w(t,e,r,n){var o=e&&e.prototype instanceof _?e:_,i=Object.create(o.prototype),a=new M(n||[]);return i._invoke=function(t,e,r){var n=l;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===v){if("throw"===o)throw i;return A()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=O(a,r);if(u){if(u===d)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var c=x(t,e,r);if("normal"===c.type){if(n=r.done?v:p,c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=v,r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function x(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function _(){}function j(){}function E(){}function k(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function L(t){var e;this._invoke=function(r,n){function i(){return new Promise(function(e,i){!function e(r,n,i,a){var u=x(t[r],t,n);if("throw"!==u.type){var c=u.arg,s=c.value;return s&&"object"==typeof s&&o.call(s,"__await")?Promise.resolve(s.__await).then(function(t){e("next",t,i,a)},function(t){e("throw",t,i,a)}):Promise.resolve(s).then(function(t){c.value=t,i(c)},a)}a(u.arg)}(r,n,e,i)})}return e=e?e.then(i,i):i()}}function O(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,O(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=x(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function T(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=r,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:r,done:!0}}}(function(){return this}()||Function("return this")())},function(t,e,r){"use strict";e.__esModule=!0;var n=function(t){return t&&t.__esModule?t:{default:t}}(r(40));e.default=function(t){return function(){var e=t.apply(this,arguments);return new n.default(function(t,r){return function o(i,a){try{var u=e[i](a),c=u.value}catch(t){return void r(t)}if(!u.done)return n.default.resolve(c).then(function(t){o("next",t)},function(t){o("throw",t)});t(c)}("next")})}}},function(t,e,r){t.exports={default:r(41),__esModule:!0}},function(t,e,r){r(42),r(43),r(58),r(62),r(74),r(75),t.exports=r(2).Promise},function(t,e){},function(t,e,r){"use strict";var n=r(44)(!0);r(22)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,r=this._i;return r>=e.length?{value:void 0,done:!0}:(t=n(e,r),this._i+=t.length,{value:t,done:!1})})},function(t,e,r){var n=r(14),o=r(15);t.exports=function(t){return function(e,r){var i,a,u=String(o(e)),c=n(r),s=u.length;return c<0||c>=s?t?"":void 0:(i=u.charCodeAt(c))<55296||i>56319||c+1===s||(a=u.charCodeAt(c+1))<56320||a>57343?t?u.charAt(c):i:t?u.slice(c,c+2):a-56320+(i-55296<<10)+65536}}},function(t,e,r){t.exports=!r(5)&&!r(23)(function(){return 7!=Object.defineProperty(r(17)("div"),"a",{get:function(){return 7}}).a})},function(t,e,r){var n=r(8);t.exports=function(t,e){if(!n(t))return t;var r,o;if(e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!n(o=r.call(t)))return o;if(!e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,r){t.exports=r(4)},function(t,e,r){"use strict";var n=r(49),o=r(24),i=r(20),a={};r(4)(a,r(1)("iterator"),function(){return this}),t.exports=function(t,e,r){t.prototype=n(a,{next:o(1,r)}),i(t,e+" Iterator")}},function(t,e,r){var n=r(3),o=r(50),i=r(28),a=r(19)("IE_PROTO"),u=function(){},c=function(){var t,e=r(17)("iframe"),n=i.length;for(e.style.display="none",r(29).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),c=t.F;n--;)delete c.prototype[i[n]];return c()};t.exports=Object.create||function(t,e){var r;return null!==t?(u.prototype=n(t),r=new u,u.prototype=null,r[a]=t):r=c(),void 0===e?r:o(r,e)}},function(t,e,r){var n=r(7),o=r(3),i=r(51);t.exports=r(5)?Object.defineProperties:function(t,e){o(t);for(var r,a=i(e),u=a.length,c=0;u>c;)n.f(t,r=a[c++],e[r]);return t}},function(t,e,r){var n=r(52),o=r(28);t.exports=Object.keys||function(t){return n(t,o)}},function(t,e,r){var n=r(12),o=r(18),i=r(54)(!1),a=r(19)("IE_PROTO");t.exports=function(t,e){var r,u=o(t),c=0,s=[];for(r in u)r!=a&&n(u,r)&&s.push(r);for(;e.length>c;)n(u,r=e[c++])&&(~i(s,r)||s.push(r));return s}},function(t,e,r){var n=r(13);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==n(t)?t.split(""):Object(t)}},function(t,e,r){var n=r(18),o=r(25),i=r(55);t.exports=function(t){return function(e,r,a){var u,c=n(e),s=o(c.length),f=i(a,s);if(t&&r!=r){for(;s>f;)if((u=c[f++])!=u)return!0}else for(;s>f;f++)if((t||f in c)&&c[f]===r)return t||f||0;return!t&&-1}}},function(t,e,r){var n=r(14),o=Math.max,i=Math.min;t.exports=function(t,e){return(t=n(t))<0?o(t+e,0):i(t,e)}},function(t,e,r){var n=r(12),o=r(57),i=r(19)("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),n(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},function(t,e,r){var n=r(15);t.exports=function(t){return Object(n(t))}},function(t,e,r){r(59);for(var n=r(0),o=r(4),i=r(9),a=r(1)("toStringTag"),u="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),c=0;c<u.length;c++){var s=u[c],f=n[s],l=f&&f.prototype;l&&!l[a]&&o(l,a,s),i[s]=i.Array}},function(t,e,r){"use strict";var n=r(60),o=r(61),i=r(9),a=r(18);t.exports=r(22)(Array,"Array",function(t,e){this._t=a(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,o(1)):o(0,"keys"==e?r:"values"==e?t[r]:[r,t[r]])},"values"),i.Arguments=i.Array,n("keys"),n("values"),n("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,r){"use strict";var n,o,i,a,u=r(16),c=r(0),s=r(10),f=r(30),l=r(6),p=r(8),h=r(11),v=r(63),d=r(64),y=r(31),m=r(32).set,g=r(69)(),b=r(21),w=r(33),x=r(70),_=r(34),j=c.TypeError,E=c.process,k=E&&E.versions,L=k&&k.v8||"",O=c.Promise,P="process"==f(E),S=function(){},M=o=b.f,T=!!function(){try{var t=O.resolve(1),e=(t.constructor={})[r(1)("species")]=function(t){t(S,S)};return(P||"function"==typeof PromiseRejectionEvent)&&t.then(S)instanceof e&&0!==L.indexOf("6.6")&&-1===x.indexOf("Chrome/66")}catch(t){}}(),A=function(t){var e;return!(!p(t)||"function"!=typeof(e=t.then))&&e},B=function(t,e){if(!t._n){t._n=!0;var r=t._c;g(function(){for(var n=t._v,o=1==t._s,i=0,a=function(e){var r,i,a,u=o?e.ok:e.fail,c=e.resolve,s=e.reject,f=e.domain;try{u?(o||(2==t._h&&C(t),t._h=1),!0===u?r=n:(f&&f.enter(),r=u(n),f&&(f.exit(),a=!0)),r===e.promise?s(j("Promise-chain cycle")):(i=A(r))?i.call(r,c,s):c(r)):s(n)}catch(t){f&&!a&&f.exit(),s(t)}};r.length>i;)a(r[i++]);t._c=[],t._n=!1,e&&!t._h&&R(t)})}},R=function(t){m.call(c,function(){var e,r,n,o=t._v,i=F(t);if(i&&(e=w(function(){P?E.emit("unhandledRejection",o,t):(r=c.onunhandledrejection)?r({promise:t,reason:o}):(n=c.console)&&n.error&&n.error("Unhandled promise rejection",o)}),t._h=P||F(t)?2:1),t._a=void 0,i&&e.e)throw e.v})},F=function(t){return 1!==t._h&&0===(t._a||t._c).length},C=function(t){m.call(c,function(){var e;P?E.emit("rejectionHandled",t):(e=c.onrejectionhandled)&&e({promise:t,reason:t._v})})},N=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),B(e,!0))},I=function(t){var e,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw j("Promise can't be resolved itself");(e=A(t))?g(function(){var n={_w:r,_d:!1};try{e.call(t,s(I,n,1),s(N,n,1))}catch(t){N.call(n,t)}}):(r._v=t,r._s=1,B(r,!1))}catch(t){N.call({_w:r,_d:!1},t)}}};T||(O=function(t){v(this,O,"Promise","_h"),h(t),n.call(this);try{t(s(I,this,1),s(N,this,1))}catch(t){N.call(this,t)}},(n=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=r(71)(O.prototype,{then:function(t,e){var r=M(y(this,O));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=P?E.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&B(this,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),i=function(){var t=new n;this.promise=t,this.resolve=s(I,t,1),this.reject=s(N,t,1)},b.f=M=function(t){return t===O||t===a?new i(t):o(t)}),l(l.G+l.W+l.F*!T,{Promise:O}),r(20)(O,"Promise"),r(72)("Promise"),a=r(2).Promise,l(l.S+l.F*!T,"Promise",{reject:function(t){var e=M(this);return(0,e.reject)(t),e.promise}}),l(l.S+l.F*(u||!T),"Promise",{resolve:function(t){return _(u&&this===a?O:this,t)}}),l(l.S+l.F*!(T&&r(73)(function(t){O.all(t).catch(S)})),"Promise",{all:function(t){var e=this,r=M(e),n=r.resolve,o=r.reject,i=w(function(){var r=[],i=0,a=1;d(t,!1,function(t){var u=i++,c=!1;r.push(void 0),a++,e.resolve(t).then(function(t){c||(c=!0,r[u]=t,--a||n(r))},o)}),--a||n(r)});return i.e&&o(i.v),r.promise},race:function(t){var e=this,r=M(e),n=r.reject,o=w(function(){d(t,!1,function(t){e.resolve(t).then(r.resolve,n)})});return o.e&&n(o.v),r.promise}})},function(t,e){t.exports=function(t,e,r,n){if(!(t instanceof e)||void 0!==n&&n in t)throw TypeError(r+": incorrect invocation!");return t}},function(t,e,r){var n=r(10),o=r(65),i=r(66),a=r(3),u=r(25),c=r(67),s={},f={};(e=t.exports=function(t,e,r,l,p){var h,v,d,y,m=p?function(){return t}:c(t),g=n(r,l,e?2:1),b=0;if("function"!=typeof m)throw TypeError(t+" is not iterable!");if(i(m)){for(h=u(t.length);h>b;b++)if((y=e?g(a(v=t[b])[0],v[1]):g(t[b]))===s||y===f)return y}else for(d=m.call(t);!(v=d.next()).done;)if((y=o(d,g,v.value,e))===s||y===f)return y}).BREAK=s,e.RETURN=f},function(t,e,r){var n=r(3);t.exports=function(t,e,r,o){try{return o?e(n(r)[0],r[1]):e(r)}catch(e){var i=t.return;throw void 0!==i&&n(i.call(t)),e}}},function(t,e,r){var n=r(9),o=r(1)("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(n.Array===t||i[o]===t)}},function(t,e,r){var n=r(30),o=r(1)("iterator"),i=r(9);t.exports=r(2).getIteratorMethod=function(t){if(void 0!=t)return t[o]||t["@@iterator"]||i[n(t)]}},function(t,e){t.exports=function(t,e,r){var n=void 0===r;switch(e.length){case 0:return n?t():t.call(r);case 1:return n?t(e[0]):t.call(r,e[0]);case 2:return n?t(e[0],e[1]):t.call(r,e[0],e[1]);case 3:return n?t(e[0],e[1],e[2]):t.call(r,e[0],e[1],e[2]);case 4:return n?t(e[0],e[1],e[2],e[3]):t.call(r,e[0],e[1],e[2],e[3])}return t.apply(r,e)}},function(t,e,r){var n=r(0),o=r(32).set,i=n.MutationObserver||n.WebKitMutationObserver,a=n.process,u=n.Promise,c="process"==r(13)(a);t.exports=function(){var t,e,r,s=function(){var n,o;for(c&&(n=a.domain)&&n.exit();t;){o=t.fn,t=t.next;try{o()}catch(n){throw t?r():e=void 0,n}}e=void 0,n&&n.enter()};if(c)r=function(){a.nextTick(s)};else if(!i||n.navigator&&n.navigator.standalone)if(u&&u.resolve){var f=u.resolve(void 0);r=function(){f.then(s)}}else r=function(){o.call(n,s)};else{var l=!0,p=document.createTextNode("");new i(s).observe(p,{characterData:!0}),r=function(){p.data=l=!l}}return function(n){var o={fn:n,next:void 0};e&&(e.next=o),t||(t=o,r()),e=o}}},function(t,e,r){var n=r(0).navigator;t.exports=n&&n.userAgent||""},function(t,e,r){var n=r(4);t.exports=function(t,e,r){for(var o in e)r&&t[o]?t[o]=e[o]:n(t,o,e[o]);return t}},function(t,e,r){"use strict";var n=r(0),o=r(2),i=r(7),a=r(5),u=r(1)("species");t.exports=function(t){var e="function"==typeof o[t]?o[t]:n[t];a&&e&&!e[u]&&i.f(e,u,{configurable:!0,get:function(){return this}})}},function(t,e,r){var n=r(1)("iterator"),o=!1;try{var i=[7][n]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!o)return!1;var r=!1;try{var i=[7],a=i[n]();a.next=function(){return{done:r=!0}},i[n]=function(){return a},t(i)}catch(t){}return r}},function(t,e,r){"use strict";var n=r(6),o=r(2),i=r(0),a=r(31),u=r(34);n(n.P+n.R,"Promise",{finally:function(t){var e=a(this,o.Promise||i.Promise),r="function"==typeof t;return this.then(r?function(r){return u(e,t()).then(function(){return r})}:t,r?function(r){return u(e,t()).then(function(){throw r})}:t)}})},function(t,e,r){"use strict";var n=r(6),o=r(21),i=r(33);n(n.S,"Promise",{try:function(t){var e=o.f(this),r=i(t);return(r.e?e.reject:e.resolve)(r.v),e.promise}})},function(t,e,r){"use strict";e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,r){"use strict";e.__esModule=!0;var n=function(t){return t&&t.__esModule?t:{default:t}}(r(78));e.default=function(){function t(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),(0,n.default)(t,o.key,o)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}()},function(t,e,r){t.exports={default:r(79),__esModule:!0}},function(t,e,r){r(80);var n=r(2).Object;t.exports=function(t,e,r){return n.defineProperty(t,e,r)}},function(t,e,r){var n=r(6);n(n.S+n.F*!r(5),"Object",{defineProperty:r(7).f})},function(t,e){t.exports={name:"@alanchenchen/browserbuffer",version:"0.1.2",author:"Alan Chen",description:"A simple implementation for browser to switch string between buffer",main:"dist/BrowserBuffer.js",keywords:["BrowserBuffer","browser","buffer","download","ArrayBuffer","upload"],license:"996.ICU",private:!1,repository:{type:"git",url:"https://github.com/alanchenchen/browserBuffer"},homepage:"https://github.com/alanchenchen/browserBuffer",bugs:{url:"https://github.com/alanchenchen/browserBuffer/issues",email:"739709491@qq.com"},scripts:{config:"node config/index.js",build:"webpack --progress",test:"mocha test/*.test.js"},dependencies:{"babel-runtime":"^6.26.0"},devDependencies:{"babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-transform-runtime":"^6.23.0","babel-preset-env":"^1.6.1","babel-preset-stage-3":"^6.24.1",chalk:"^2.4.1","clean-webpack-plugin":"^0.1.19","css-loader":"^0.28.7","extract-text-webpack-plugin":"^3.0.2","file-loader":"^1.1.4",inquirer:"^6.1.0",mocha:"^5.2.0","uglifyjs-webpack-plugin":"^1.0.1","vue-loader":"^13.0.5","vue-template-compiler":"^2.4.4",webpack:"^3.8.1"},engines:{node:">= v12.8.1"},babel:{presets:["env","stage-3"],plugins:[["transform-runtime",{polyfill:!1,regenerator:!0,moduleName:"babel-runtime"}]]}}}])});