UNPKG

cordova-app-loader

Version:

Cordova App Loader - remote update your cordova app

1 lines 20 kB
!function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){window.CordovaAppLoader=n(1),window.CordovaFileCache=n(2),window.CordovaPromiseFS=n(4),window.Promise=n(5),window.setImmediate=window.setTimeout},function(t,e,n){function o(t){var e=Object.keys(t);e.sort();var n="";return e.forEach(function(e){t[e]&&t[e].version,n+="@"+t[e].version}),i.hash(n)+""}function r(t){if(!t)throw new Error("CordovaAppLoader has no options!");if(!t.fs)throw new Error('CordovaAppLoader has no "fs" option (cordova-promise-fs)');if(!t.serverRoot)throw new Error('CordovaAppLoader has no "serverRoot" option.');if(!window.pegasus||!window.Manifest)throw new Error("CordovaAppLoader bootstrap.js is missing.");this.allowServerRootFromManifest=t.allowServerRootFromManifest===!0,a=t.fs.Promise,this.manifest=window.Manifest,this.newManifest=null,this.bundledManifest=null,this.preventAutoUpdateLoop=t.preventAutoUpdateLoop===!0,this._lastUpdateFiles=localStorage.getItem("last_update_files"),t.serverRoot=t.serverRoot||"",t.serverRoot&&"/"!==t.serverRoot[t.serverRoot.length-1]&&(t.serverRoot+="/"),this.newManifestUrl=t.manifestUrl||t.serverRoot+(t.manifest||"manifest.json"),t.mode&&(t.mode="mirror"),this.cache=new i(t),this.corruptNewManifest=!1,this._toBeCopied=[],this._toBeDeleted=[],this._toBeDownloaded=[],this._updateReady=!1,this._checkTimeout=t.checkTimeout||1e4}var i=n(2),a=(n(4),null),u=location.href.replace(location.hash,"");u=u.substr(0,u.lastIndexOf("/")+1),/ip(hone|ad|od)/i.test(navigator.userAgent)&&(u=location.pathname.substr(location.pathname.indexOf("/www/")),u=u.substr(0,u.lastIndexOf("/")+1),u="cdvfile://localhost/bundle"+u),r.prototype._createFilemap=function(t){var e={},n=this.cache._fs.normalize;return Object.keys(t).forEach(function(o){t[o].filename=n(t[o].filename),e[t[o].filename]=t[o]}),e},r.prototype.copyFromBundle=function(t){var e=u+t;return this.cache._fs.download(e,this.cache.localRoot+t)},r.prototype.getBundledManifest=function(){var t=this,e=document.querySelector("script[manifest]"),n=(e?e.getAttribute("manifest"):null)||"manifest.json";return new a(function(e,o){t.bundledManifest?e(t.bundledManifest):(pegasus(n).then(function(n){t.bundledManifest=n,e(n)},o),setTimeout(function(){o(new Error("bundled manifest timeout"))},t._checkTimeout))})},r.prototype.check=function(t){var e=this,n=this.manifest;"string"==typeof t&&(e.newManifestUrl=t,t=void 0);var r=new a(function(n,o){"object"==typeof t?n(t):(pegasus(e.newManifestUrl).then(n,o),setTimeout(function(){o(new Error("new manifest timeout"))},e._checkTimeout))});return new a(function(t,i){a.all([r,e.getBundledManifest(),e.cache.list()]).then(function(r){var a=r[0],u=r[1],s=o(a.files);if(e.preventAutoUpdateLoop===!0&&s===e._lastUpdateFiles){var c=o(Manifest.files);return e._lastUpdateFiles!==c&&(console.warn("New manifest available, but an earlier update attempt failed. Will not download."),e.corruptNewManifest=!0,t(null)),void t(!1)}if(!a.files)return void i(new Error('Downloaded Manifest has no "files" attribute.'));var f=r[2],l=e._createFilemap(n.files),s=e._createFilemap(a.files),d=e._createFilemap(u.files);e._toBeDownloaded=[],e._toBeCopied=[],e._toBeDeleted=[];var h=e.cache._fs.isCordova,p=0;Object.keys(s).filter(function(t){return!l[t]||l[t].version!==s[t].version}).forEach(function(t){h&&d[t]&&d[t].version===s[t].version?e._toBeCopied.push(t):e._toBeDownloaded.push(t),d[t]&&d[t].version===s[t].version||p++}),e._toBeDeleted=f.map(function(t){return t.substr(e.cache.localRoot.length)}).filter(function(t){return!s[t]||e._toBeDownloaded.indexOf(t)>=0||e._toBeCopied.indexOf(t)>=0}),p+=e._toBeDeleted.length,p>0?(e.newManifest=a,e.newManifest.root=e.cache.localUrl,t(!0)):t(!1)},function(t){i(t)})})},r.prototype.canDownload=function(){return!!this.newManifest&&!this._updateReady},r.prototype.canUpdate=function(){return this._updateReady},r.prototype.download=function(t,e){var n=this;return n.canDownload()?(localStorage.removeItem("manifest"),localStorage.setItem("last_update_files",o(this.newManifest.files)),this.manifest.files=Manifest.files={},n.cache.remove(n._toBeDeleted,!0).then(function(){return a.all(n._toBeCopied.map(function(t){return n.cache._fs.download(u+t,n.cache.localRoot+t)}))}).then(function(){return n.allowServerRootFromManifest&&n.newManifest.serverRoot&&(n.cache.serverRoot=n.newManifest.serverRoot),n.cache.add(n._toBeDownloaded),n.cache.download(t,e)}).then(function(){return n._toBeDeleted=[],n._toBeDownloaded=[],n._updateReady=!0,n.newManifest},function(t){return t&&t.length&&n.cache.remove(t),t})):new a(function(t){t(null)})},r.prototype.update=function(t){return this._updateReady?(localStorage.setItem("manifest",JSON.stringify(this.newManifest)),t!==!1&&location.reload(),!0):!1},r.prototype.clear=function(){return localStorage.removeItem("last_update_files"),localStorage.removeItem("manifest"),this.cache.clear()},r.prototype.reset=function(){return this.clear().then(function(){location.reload()},function(){location.reload()})},t.exports=r},function(t,e,n){function o(t){var e=this;if(this._fs=t.fs,!this._fs)throw new Error('Missing required option "fs". Add an instance of cordova-promise-fs.');i=this._fs.Promise,this._mirrorMode="hash"!==t.mode,this._retry=t.retry||[500,1500,8e3],this._cacheBuster=!!t.cacheBuster,this.localRoot=this._fs.normalize(t.localRoot||"data"),this.serverRoot=this._fs.normalize(t.serverRoot||""),this._downloading=[],this._added=[],this._cached={},this.ready=this._fs.ensure(this.localRoot).then(function(t){return e.localInternalURL=a?t.toInternalURL():t.toURL(),e.localUrl=t.toURL(),e.list()})}var r=n(3),i=null,a="undefined"!=typeof cordova;o.hash=r,o.prototype.list=function(){var t=this;return new i(function(e){t._fs.list(t.localRoot,"rfe").then(function(n){t._cached={},n=n.map(function(e){var n=t._fs.normalize(e.fullPath);return t._cached[n]={toInternalURL:a?e.toInternalURL():e.toURL(),toURL:e.toURL()},n}),e(n)},function(){e([])})})},o.prototype.add=function(t){t||(t=[]),"string"==typeof t&&(t=[t]);var e=this;return t.forEach(function(t){t=e.toServerURL(t),-1===e._added.indexOf(t)&&e._added.push(t)}),e.isDirty()},o.prototype.remove=function(t,e){t||(t=[]);var n=[];"string"==typeof t&&(t=[t]);var o=this;return t.forEach(function(t){var e=o._added.indexOf(o.toServerURL(t));e>=0&&o._added.splice(e,1);var r=o.toPath(t);n.push(o._fs.remove(r)),delete o._cached[r]}),e?i.all(n):o.isDirty()},o.prototype.getDownloadQueue=function(){var t=this,e=t._added.filter(function(e){return!t.isCached(e)});return e},o.prototype.getAdded=function(){return this._added},o.prototype.isDirty=function(){return this.getDownloadQueue().length>0},o.prototype.download=function(t,e){var n=this._fs,o=this;return e=e||!1,o.abort(),new i(function(r,i){n.ensure(o.localRoot).then(function(){return o.list()}).then(function(){if(!o.isDirty())return void r(o);var a=o.getDownloadQueue(),u=o._downloading.length,s=o._downloading.length+a.length,c=0;a.forEach(function(a){var f,l=o.toPath(a);"function"==typeof t&&(f=function(e){e.queueIndex=u,e.queueSize=s,e.url=a,e.path=l,e.percentage=u/s,e.loaded>0&&e.total>0&&u!==s&&(e.percentage+=e.loaded/e.total/s),e.percentage=Math.max(c,e.percentage),c=e.percentage,t(e)});var d=function(){u++,f(new ProgressEvent),u===s&&(o._downloading=[],o.list().then(function(){f&&f(new ProgressEvent),o.isDirty()?i(o.getDownloadQueue()):r(o)},i))},h=a;o._cacheBuster&&(h+="?"+Date.now());var p=n.download(h,l,{retry:o._retry},e?f:void 0);p.then(d,d),o._downloading.push(p)})},i)})},o.prototype.abort=function(){this._downloading.forEach(function(t){t.abort()}),this._downloading=[]},o.prototype.isCached=function(t){return t=this.toPath(t),!!this._cached[t]},o.prototype.clear=function(){var t=this;return this._cached={},this._fs.removeDir(this.localRoot).then(function(){return t._fs.ensure(t.localRoot)})},o.prototype.toInternalURL=function(t){return path=this.toPath(t),this._cached[path]?this._cached[path].toInternalURL:t},o.prototype.get=function(t){return path=this.toPath(t),this._cached[path]?this._cached[path].toURL:this.toServerURL(t)},o.prototype.toDataURL=function(t){return this._fs.toDataURL(this.toPath(t))},o.prototype.toURL=function(t){return path=this.toPath(t),this._cached[path]?this._cached[path].toURL:t},o.prototype.toServerURL=function(t){return t=this._fs.normalize(t),t.indexOf("://")<0?this.serverRoot+t:t},o.prototype.toPath=function(t){if(this._mirrorMode){var e=t.indexOf("?");return e>-1&&(t=t.substr(0,e)),t=t=this._fs.normalize(t||""),len=this.serverRoot.length,t.substr(0,len)!==this.serverRoot?this.localRoot+t:this.localRoot+t.substr(len)}var n=t.substr(t.lastIndexOf("."));return(n.indexOf("?")>0||n.indexOf("/")>0)&&(n=".txt"),this.localRoot+r(t)+n},t.exports=o},function(t){function e(t,e){var n,o,r,i,a,u,s,c;for(n=3&t.length,o=t.length-n,r=e,a=3432918353,u=461845907,c=0;o>c;)s=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,s=(65535&s)*a+(((s>>>16)*a&65535)<<16)&4294967295,s=s<<15|s>>>17,s=(65535&s)*u+(((s>>>16)*u&65535)<<16)&4294967295,r^=s,r=r<<13|r>>>19,i=5*(65535&r)+((5*(r>>>16)&65535)<<16)&4294967295,r=(65535&i)+27492+(((i>>>16)+58964&65535)<<16);switch(s=0,n){case 3:s^=(255&t.charCodeAt(c+2))<<16;case 2:s^=(255&t.charCodeAt(c+1))<<8;case 1:s^=255&t.charCodeAt(c),s=(65535&s)*a+(((s>>>16)*a&65535)<<16)&4294967295,s=s<<15|s>>>17,s=(65535&s)*u+(((s>>>16)*u&65535)<<16)&4294967295,r^=s}return r^=t.length,r^=r>>>16,r=2246822507*(65535&r)+((2246822507*(r>>>16)&65535)<<16)&4294967295,r^=r>>>13,r=3266489909*(65535&r)+((3266489909*(r>>>16)&65535)<<16)&4294967295,r^=r>>>16,r>>>0}t.exports=e},function(t){function e(t,n,o,r){t.getDirectory(n[0],{create:!0},function(t){n.length>1?e(t,n.slice(1),o,r):o(t)},r)}function n(t){return t=t.substr(0,t.lastIndexOf("/")+1),"/"===t[0]&&(t=t.substr(1)),t}function o(t){return t.substr(t.lastIndexOf("/")+1)}function r(t){t=t||"","/"===t[0]&&(t=t.substr(1));for(var e=t.split("/"),n=e[0],o=1;o<e.length;o++)n=e[o],".."===e[o]?(e.splice(o-1,2),o-=2):"."===e[o]&&(e.splice(o,1),o--);return t=e.join("/"),"./"===t?t="":n&&n.indexOf(".")<0&&"/"!=t[t.length-1]&&(t+="/"),t}var i=[],a=0;t.exports=function(t){function u(t){return new E(function(e){return e(t)})}function s(t){return new E(function(n,o){return B.then(function(r){t?(t=t.split("/").filter(function(t){return t&&t.length>0&&"."!==t&&".."!==t}),e(r.root,t,n,o)):n(r.root)},o)})}function c(t,e){return new E(function(n,o){return"object"==typeof t?n(t):(t=r(t),e=e||{},B.then(function(r){r.root.getFile(t,e,n,o)},o))})}function f(t,e){return t=r(t),e=e||{},new E(function(n,o){return B.then(function(r){t&&"/"!==t?r.root.getDirectory(t,e,n,o):n(r.root)},o)})}function l(t,e){e=e||"";var n=e.indexOf("r")>-1,o=e.indexOf("e")>-1,r=e.indexOf("f")>-1,i=e.indexOf("d")>-1;return r&&i&&(r=!1,i=!1),new E(function(e,a){return f(t).then(function(t){var s=t.createReader();s.readEntries(function(t){var s=[u(t)];n&&t.filter(function(t){return t.isDirectory}).forEach(function(t){s.push(l(t.fullPath,"re"))}),E.all(s).then(function(t){var n=[];n=n.concat.apply(n,t),r&&(n=n.filter(function(t){return t.isFile})),i&&(n=n.filter(function(t){return t.isDirectory})),o||(n=n.map(function(t){return t.fullPath})),e(n)},a)},a)},a)})}function d(t){return new E(function(e,n){c(t).then(function(t){e(t)},function(t){1===t.code?e(!1):n(t)})})}function h(t){return new E(function(e,n){f(t).then(function(t){e(t)},function(t){1===t.code?e(!1):n(t)})})}function p(t){return s(n(t)).then(function(){return c(t,{create:!0})})}function w(t){return c(t).then(function(t){return t.toURL()})}function v(t,e){return e=e||"readAsText",c(t).then(function(t){return new E(function(n,o){t.file(function(t){var o=new FileReader;o.onloadend=function(){n(this.result)},o[e](t)},o)})})}function m(t){return v(t,"readAsDataURL")}function y(t){return v(t).then(JSON.parse)}function _(t,e,o){return s(n(t)).then(function(){return c(t,{create:!0})}).then(function(t){return new E(function(n,r){t.createWriter(function(t){t.onwriteend=n,t.onerror=r,"string"==typeof e?e=g([e],o||"text/plain"):e instanceof Blob!=!0&&(e=g([JSON.stringify(e,null,4)],o||"application/json")),t.write(e)},r)})})}function g(t,e){var n,o;try{return new Blob(t,{type:e})}catch(r){if(n=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)return o=new n,o.append(t),o.getBlob(e);throw new Error("Unable to create blob")}}function R(t,e){return s(n(e)).then(function(n){return c(t).then(function(t){return new E(function(r,i){t.moveTo(n,o(e),r,i)})})})}function b(t,e){return t=t.replace(/\/$/,""),e=e.replace(/\/$/,""),s(n(e)).then(function(n){return f(t).then(function(t){return new E(function(r,i){t.moveTo(n,o(e),r,i)})})})}function T(t,e){return s(n(e)).then(function(n){return c(t).then(function(t){return new E(function(r,i){t.copyTo(n,o(e),r,i)})})})}function L(t,e){var n=e?c:d;return new E(function(e,o){n(t).then(function(t){t!==!1?t.remove(e,o):e(1)},o)}).then(function(t){return 1===t?!1:!0})}function U(t){return f(t).then(function(t){return new E(function(e,n){t.removeRecursively(e,n)})})}function D(){for(;i.length>0&&a<t.concurrency;){a++;var e=i.pop(),n=e.fileTransfer,o=e.isDownload,r=e.serverUrl,u=e.localPath,s=e.trustAllHosts,c=e.transferOptions,f=e.win,l=e.fail;n._aborted?a--:o?(n.download.call(n,r,u,f,l,s,c),n.onprogress&&n.onprogress(new ProgressEvent)):n.upload.call(n,u,r,f,l,c,s)}}function O(t){return a--,D(),t}function x(e,n,r,u,s){"function"==typeof u&&(s=u,u={}),M&&r.indexOf("://")<0&&(r=P(r)),u=u||{},u.retry&&u.retry.length||(u.retry=t.retry),u.retry=u.retry.concat(),u.file||e||(u.fileName=o(r));var c=new FileTransfer;s=s||u.onprogress,"function"==typeof s&&(c.onprogress=s);var f=new E(function(o,s){var f=function(a){if(0===u.retry.length)t.debug&&console.log("FileTransfer Error: "+n,a),s(a);else{var l={fileTransfer:c,isDownload:e,serverUrl:n,localPath:r,trustAllHosts:u.trustAllHosts||!1,transferOptions:u,win:o,fail:f};i.unshift(l);var d=u.retry.shift();d>0?setTimeout(O,d):O()}};u.retry.unshift(0),a++,f()});return f.then(O,O),f.progress=function(t){return c.onprogress=t,f},f.abort=function(){return c._aborted=!0,c.abort(),f},f}function S(t,e,n,o){return x(!0,t,e,n,o)}function I(t,e,n,o){return x(!1,e,t,n,o)}var E=t.Promise||window.Promise;if(!E)throw new Error("No Promise library given in options.Promise");t=t||{},t.persistent=void 0!==t.persistent?t.persistent:!0,t.storageSize=t.storageSize||20971520,t.concurrency=t.concurrency||3,t.retry=t.retry||[],t.debug=!!t.debug;var F,M="undefined"!=typeof cordova;M?F=new E(function(t,e){document.addEventListener("deviceready",t,!1),setTimeout(function(){e(new Error("deviceready has not fired after 5 seconds."))},5100)}):(F=u(!0),"undefined"!=typeof webkitRequestFileSystem?(window.requestFileSystem=webkitRequestFileSystem,window.FileTransfer=function(){},FileTransfer.prototype.download=function(t,e,n,o){var r=new XMLHttpRequest;return r.open("GET",t),r.responseType="blob",r.onreadystatechange=function(){4==r.readyState&&(200!==r.status||this._aborted?o(r.status):_(e,r.response).then(n,o))},r.send(),r},FileTransfer.prototype.abort=function(){this._aborted=!0},window.ProgressEvent=function(){},window.FileEntry=function(){}):window.requestFileSystem=function(t,e,n,o){o(new Error("requestFileSystem not supported!"))});var B=new E(function(e,n){F.then(function(){var o=t.persistent?1:0;t.fileSystem&&M&&(o=t.fileSystem),!M&&1===o&&navigator.webkitPersistentStorage?navigator.webkitPersistentStorage.requestQuota(t.storageSize,function(t){window.requestFileSystem(o,t,e,n)},n):isNaN(o)?window.resolveLocalFileSystemURL(o,function(t){e(t.filesystem)},n):window.requestFileSystem(o,t.storageSize,e,n),setTimeout(function(){n(new Error("Could not retrieve FileSystem after 5 seconds."))},5100)},n)});B.then(function(t){CDV_INTERNAL_URL_ROOT=t.root.toInternalURL(),CDV_URL_ROOT=t.root.toURL(),window.__fs=t},function(t){console.error("Could not get Cordova FileSystem:",t)});var C,A,P;return CDV_INTERNAL_URL_ROOT="cdvfile://localhost/"+(t.persistent?"persistent/":"temporary/"),CDV_URL_ROOT="",M?(A=function(t){return t=r(t),t.indexOf("://")<0?CDV_INTERNAL_URL_ROOT+t:t},P=function(t){return t=r(t),t.indexOf("://")<0?CDV_URL_ROOT+t:t},C=function(t){return c(t).then(function(t){return t.toInternalURL()})}):(A=function(e){return e=r(e),"filesystem:"+location.origin+(t.persistent?"/persistent/":"/temporary/")+e},C=function(t){return c(t).then(function(t){return t.toURL()})},P=A),{fs:B,normalize:r,file:c,filename:o,dir:f,dirname:n,create:p,read:v,readJSON:y,write:_,move:R,moveDir:b,copy:T,remove:L,removeDir:U,list:l,ensure:s,exists:d,existsDir:h,download:S,upload:I,toURL:w,isCordova:M,toInternalURLSync:A,toInternalURL:C,toDataURL:m,deviceready:F,options:t,Promise:E}}},function(t,e,n){(function(e){!function(n,o){function r(t,e){return(typeof e)[0]==t}function i(t,e){return e=function u(s,c,f,l,d,h){function p(t){return function(e){d&&(d=0,u(r,t,e))}}if(l=u.q,s!=r)return i(function(t,e){l.push({p:this,r:t,j:e,1:s,0:c})});if(f&&r(n,f)|r(o,f))try{d=f.then}catch(t){c=0,f=t}if(r(n,d))try{d.call(f,p(1),c=p(0))}catch(t){c(t)}else for(e=function(e,o){return r(n,e=c?e:o)?i(function(t,n){a(this,t,n,f,e)}):t},h=0;h<l.length;)d=l[h++],r(n,s=d[c])?a(d.p,d.r,d.j,f,s):(c?d.r:d.j)(f)},e.q=[],t.call(t={then:function(t,n){return e(t,n)},catch:function(t){return e(0,t)}},function(t){e(r,1,t)},function(t){e(r,0,t)}),t}function a(t,i,a,u,s){e(function(){try{u=s(u),s=u&&r(o,u)|r(n,u)&&u.then,r(n,s)?u==t?a(TypeError()):s.call(u,i,a):i(u)}catch(t){a(t)}})}function u(t){return i(function(e){e(t)})}t.exports=i,i.resolve=u,i.reject=function(t){return i(function(e,n){n(t)})},i.all=function(t){return i(function(e,n,o,r){r=[],o=t.length||e(r),t.map(function(t,i){u(t).then(function(t){r[i]=t,--o||e(r)},n)})})}}("f","o")}).call(e,n(6).setImmediate)},function(t,e,n){(function(t,o){function r(t,e){this._id=t,this._clearFn=e}var i=n(7).nextTick,a=Function.prototype.apply,u=Array.prototype.slice,s={},c=0;e.setTimeout=function(){return new r(a.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new r(a.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},e.setImmediate="function"==typeof t?t:function(t){var n=c++,o=arguments.length<2?!1:u.call(arguments,1);return s[n]=!0,i(function(){s[n]&&(o?t.apply(null,o):t.call(null),e.clearImmediate(n))}),n},e.clearImmediate="function"==typeof o?o:function(t){delete s[t]}}).call(e,n(6).setImmediate,n(6).clearImmediate)},function(t){function e(){s=!1,i.length?u=i.concat(u):c=-1,u.length&&n()}function n(){if(!s){var t=setTimeout(e);s=!0;for(var n=u.length;n;){for(i=u,u=[];++c<n;)i&&i[c].run();c=-1,n=u.length}i=null,s=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function r(){}var i,a=t.exports={},u=[],s=!1,c=-1;a.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new o(t,e)),1!==u.length||s||setTimeout(n,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=r,a.addListener=r,a.once=r,a.off=r,a.removeListener=r,a.removeAllListeners=r,a.emit=r,a.binding=function(){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}}]);