/**
 * Minified by jsDelivr using UglifyJS v3.0.24.
 * Original file: /npm/pxloader@1.1.2/PxLoader.js
 * 
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(t,e){"function"==typeof define&&define.amd?define([],function(){return t.PxLoader=e()}):"object"==typeof module&&module.exports?module.exports=e():t.PxLoader=e()}(this,function(){function t(t){if(this.all=[],this.first=null,this.length=0,this.lookup={},t){if(Array.isArray(t))this.all=t.slice(0);else if("object"==typeof t)for(var e in t)t.hasOwnProperty(e)&&this.all.push(e);else this.all.push(t);this.length=this.all.length,this.length>0&&(this.first=this.all[0]);for(var r=0;r<this.length;r++)this.lookup[this.all[r]]=!0}}return t.prototype.intersects=function(t){if(0===this.length||0===t.length)return!1;if(1===this.length&&1===t.length)return this.first===t.first;if(t.length<this.length)return t.intersects(this);for(var e in this.lookup)if(t.lookup[e])return!0;return!1},function(e){e=e||{},this.settings=e,null==e.statusInterval&&(e.statusInterval=5e3),null==e.loggingDelay&&(e.loggingDelay=2e4),null==e.noProgressTimeout&&(e.noProgressTimeout=1/0);var r,s=[],n=[],o=[],a=Date.now(),i={QUEUED:0,WAITING:1,LOADED:2,ERROR:3,TIMEOUT:4},u=function(t){return null==t?[]:Array.isArray(t)?t:[t]};this.add=function(e){e.tags=new t(e.tags),null==e.priority&&(e.priority=1/0),s.push({resource:e,status:i.QUEUED})},this.addProgressListener=function(e,r){o.push({callback:e,tags:new t(r)})},this.addCompletionListener=function(e,r){n.push({tags:new t(r),callback:function(t){t.completedCount===t.totalCount&&e(t)}})};var l=function(t){t=u(t);var e=function(e){for(var r=e.resource,s=1/0,n=0;n<r.tags.length;n++)for(var o=0;o<Math.min(t.length,s)&&!(r.tags.all[n]===t[o]&&o<s&&0===(s=o))&&0!==s;o++);return s};return function(t,r){var s=e(t),n=e(r);return s<n?-1:s>n?1:t.priority<r.priority?-1:t.priority>r.priority?1:0}};this.start=function(t){r=Date.now();var e=l(t);s.sort(e);for(var n=0,o=s.length;n<o;n++){var a=s[n];a.status=i.WAITING,a.resource.start(this)}setTimeout(c,100)};var c=function(){for(var t=!1,r=Date.now()-a,n=r>=e.noProgressTimeout,o=r>=e.loggingDelay,u=0,l=s.length;u<l;u++){var h=s[u];h.status===i.WAITING&&(h.resource.checkStatus&&h.resource.checkStatus(),h.status===i.WAITING&&(n?h.resource.onTimeout():t=!0))}o&&t&&g(),t&&setTimeout(c,e.statusInterval)};this.isBusy=function(){for(var t=0,e=s.length;t<e;t++)if(s[t].status===i.QUEUED||s[t].status===i.WAITING)return!0;return!1};var h=function(t,e){var r,u,l,c,h=null;for(r=0,u=s.length;r<u;r++)if(s[r].resource===t){h=s[r];break}if(null!=h&&h.status===i.WAITING)for(h.status=e,a=Date.now(),r=0,u=(l=o.concat(n)).length;r<u;r++)(0===(c=l[r]).tags.length||t.tags.intersects(c.tags))&&f(h,c)};this.onLoad=function(t){h(t,i.LOADED)},this.onError=function(t){h(t,i.ERROR)},this.onTimeout=function(t){h(t,i.TIMEOUT)};var f=function(t,e){var r,n,o,a=0,u=0;for(r=0,n=s.length;r<n;r++)o=s[r],(0===e.tags.length||o.resource.tags.intersects(e.tags))&&(u++,o.status!==i.LOADED&&o.status!==i.ERROR&&o.status!==i.TIMEOUT||a++);e.callback({resource:t.resource,loaded:t.status===i.LOADED,error:t.status===i.ERROR,timeout:t.status===i.TIMEOUT,completedCount:a,totalCount:u})},g=this.log=function(t){if(window.console){var e=Math.round((Date.now()-r)/1e3);window.console.log("PxLoader elapsed: "+e+" sec");for(var n=0,o=s.length;n<o;n++){var a=s[n];if(t||a.status===i.WAITING){var u="PxLoader: #"+n+" "+a.resource.getName();switch(a.status){case i.QUEUED:u+=" (Not Started)";break;case i.WAITING:u+=" (Waiting)";break;case i.LOADED:u+=" (Loaded)";break;case i.ERROR:u+=" (Error)";break;case i.TIMEOUT:u+=" (Timeout)"}a.resource.tags.length>0&&(u+=" Tags: ["+a.resource.tags.all.join(",")+"]"),window.console.log(u)}}}}}});
//# sourceMappingURL=/sm/18ae76eaef1371b98908a7e88e8d1239e1ced87a78891d4f574af81c7e6bf2b6.map