define(["./createTaskProcessorWorker","./when-b60132fc"],(function(e,t){"use strict";function r(e){return null!=e}function n(e){var t;this.name="DeveloperError",this.message=e;try{throw new Error}catch(e){t=e.stack}this.stack=t}r(Object.create)&&(n.prototype=Object.create(Error.prototype),n.prototype.constructor=n),n.prototype.toString=function(){var e=this.name+": "+this.message;return r(this.stack)&&(e+="\n"+this.stack.toString()),e},n.throwInstantiationError=function(){throw new n("This function defines an interface and should not be called directly.")};var c=1,o=2,a=3;function s(e){if(!r(e.name))throw new n("options.name is required.");var c=t.when.defer();this.dbname=e.name;var o=indexedDB.open(this.dbname),a=this;return o.onsuccess=function(e){a.db=e.target.result,a.version=a.db.version,r(a.cachestatus)||(a.cachestatus={}),c.resolve(a)},o.onupgradeneeded=function(e){a.db=e.target.result,a.version=a.db.version,c.resolve(a)},o.onerror=function(e){a.db=null,c.reject("create database fail, error code : "+e.target.errorcode)},this.layer=e.layer||null,this.storageType=e.storageType||"arrayBuffer",this.creatingTable=!1,this.cachestatus={},c.promise}s.prototype.checkObjectStoreExit=function(e){return!!r(this.db)&&this.db.objectStoreNames.contains(e)},s.prototype.createObjectStore=function(e){var n=t.when.defer();if(this.creatingTable)n.reject(!1);else{if(this.db.objectStoreNames.contains(e))return n.reject(!1),n.promise;this.creatingTable=!0;var c=this,o=parseInt(c.db.version);c.db.close();var a=indexedDB.open(c.dbname,o+1);a.onupgradeneeded=function(t){var o=t.target.result;c.db=o;var a=o.createObjectStore(e,{keyPath:"id"});r(a)?(a.createIndex("value","value",{unique:!1}),c.creatingTable=!1,r(c.cachestatus)||(c.cachestatus={}),c.cachestatus[e]={},c.db.close(),indexedDB.open(c.dbname).onsuccess=function(e){var t=e.target.result;c.db=t,n.resolve(!0)}):(c.creatingTable=!1,n.reject(!1))},a.onsuccess=function(e){e.target.result.close(),n.resolve(!0)},a.onerror=function(e){c.creatingTable=!1,n.reject(!1)}}return n.promise},s.prototype.putElementInDB=function(e,n,s,i){var u,l=t.when.defer();if(!r(this.db))return l.reject(!1),l.promise;var h=this;if(r(h.cachestatus[e])&&!r(i)&&r(h.cachestatus[e][n])&&(h.cachestatus[e][n]===c||h.cachestatus[e][n]===o))return l.resolve(!1),l.promise;if(this.db.objectStoreNames.contains(e)){var d;r(h.cachestatus[e])||(h.cachestatus[e]={});try{d=this.db.transaction([e],"readwrite")}catch(e){return l.reject(null),l.promise}if(u=d.objectStore(e),r(i))if(i instanceof Array){for(var v=0,f=i.length;v