"use strict";function _asyncToGenerator(n){return function(){var r=n.apply(this,arguments);return new Promise(function(n,e){return function t(o,i){try{var u=r[o](i),c=u.value}catch(n){return void e(n)}if(!u.done)return Promise.resolve(c).then(function(n){t("next",n)},function(n){t("throw",n)});n(c)}("next")})}}drill.define(function(){var n=_asyncToGenerator(regeneratorRuntime.mark(function n(r){var e,t;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return t={loadImg:e=function n(r,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,o=new Image;o.onload=function(){e()},o.onerror=function(){t<=0?(console.error("img cache error => ",r),e()):n(r,e,--t)},o.src=r},cacheImg:function(n){return new Promise(function(r){var t=n.length;t?n.forEach(function(n){e(n,function(){--t||r("imgs loaded")})}):r("no imgs")})}},n.abrupt("return",t);case 4:case"end":return n.stop()}},n,void 0)}));return function(r){return n.apply(this,arguments)}}());