Socket
Socket
Sign inDemoInstall

esquire

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esquire - npm Package Compare versions

Comparing version 1.1.0 to 1.1.2

2

esquire-full.min.js

@@ -1,1 +0,1 @@

"use strict";!function a(b){function c(a,b){var d=0,e=null,f=[],g=function(a){var b=d>0?"resolve":0>d?"reject":null;if(b)for(var c in a)a[c][b](e)},h=this;Object.defineProperties(this,{resolve:{enumerable:!0,configurable:!1,value:function(b){if(b&&"function"==typeof b.then)b.then(function(a){h.resolve(a)},function(a){h.reject(a)});else if(0==d){if(e=b,d=1,a)try{e=a(e)}catch(c){e=c,d=-1}g(f)}}},reject:{enumerable:!0,configurable:!1,value:function(a){if(0==d){if(e=a,d=-1,b)try{e=b(e),d=1}catch(c){e=c}g(f)}}},promise:{enumerable:!0,configurable:!1,value:Object.defineProperties(new Object,{then:{enumerable:!0,configurable:!1,value:function(a,b){var e=new c(a,b);return 0==d?f.push(e):g([e]),e.promise}},"catch":{enumerable:!0,configurable:!1,value:function(a){return this.then(null,a)}}})}})}function d(a,e){if(!(this instanceof d))return new d(a,e);if(void 0===a)c.call(this);else{if(!("number"==typeof a&&a>=0))throw new TypeError("Deferred constructor must be called with a non-negative number");null==e?e=new Error("Timeout waiting for resolution/rejection"):"string"==typeof e&&(e=new Error(e));var f=this,g=b.setTimeout(function(){f.reject(e)},a);c.call(this,function(a){return b.clearTimeout(g),a},function(a){throw b.clearTimeout(g),a})}}function e(a){if(!(this instanceof e))return new e(a);if("function"!=typeof a)throw new TypeError("Executor is not a function");var b=new d;Object.defineProperties(this,{then:{enumerable:!0,configurable:!1,value:function(){return b.promise.then.apply(b.promise,arguments)}},"catch":{enumerable:!0,configurable:!1,value:function(){return b.promise.catch.apply(b.promise,arguments)}}});try{a(b.resolve,b.reject)}catch(c){b.reject(c)}}function f(a,b){a="Esquire: "+(a||"Unknown error");var c="";if(b&&b.length)for(var d=0;d<b.length;d++)b[d]&&(c+=" -> "+b[d]);c&&(a+=" resolving"+c),Error.call(this,a),this.message=a;var e=this.stack||(new Error).stack;e&&(e=e.replace(new RegExp("^(Error|"+this.name+")\n"),""),this.stack=this.name+": "+this.message+"\n"+e)}function g(a){f.call(this,"Module '"+a+"' not found")}function h(a,b){var c=a?"Error instantiating '"+a+"' module":"Injection failed";this.$$message=c,b&&(this.originalCause=b.originalCause||b,this.cause=b);for(var d=b;null!=d;d=d.cause)c+="\n- Cause: "+(d.$$message||d.message||"[no message]");f.call(this,c)}function i(a){var b="Detected circular dependency in ";for(var c in a)b+=a[c]+" -> ";b+=a[0],this.$$message=b,f.call(this,b)}function j(a,b,c,d){a=p(a);for(var e in b)b[e]=p(b[e]);Object.defineProperty(this,"name",{enumerable:!0,configurable:!1,value:a}),Object.defineProperty(this,"dependencies",{enumerable:!0,configurable:!1,value:b}),Object.defineProperty(this,"constructor",{enumerable:!0,configurable:!1,value:c}),Object.defineProperty(this,"$$dynamic",{enumerable:!1,configurable:!1,value:d||!1}),Object.defineProperty(this,"$$script",{enumerable:!1,configurable:!1,get:function(){return"Esquire.define("+JSON.stringify(this.name)+","+JSON.stringify(this.dependencies)+","+c.toString()+");"}}),Object.freeze(this)}function k(a){j.call(this,a,["$global"],function(a){function b(a,c,d){if(!d&&a in c)return c[a];var e=["Ms","ms","Moz","moz","WebKit","webkit"];for(var f in e){var g=e[f]+a;if(g in c)return c[g]}return a[0]!==a[0].toUpperCase()?b(a[0].toUpperCase()+a.substring(1),c,!0):void 0}function c(a,d){if(!d)return void 0;if(!a)return void 0;switch(a.length){case 0:return void 0;case 1:return b(a[0],d);default:return c(a.slice(1),b(a[0],d))}}return c(this.name.substring(8).split("."),a)},!0)}function l(a){j.call(this,a,[],function(){throw new f("The constructor for '"+a+"' should not be called'")},!0)}function m(a){if(!a)return[];for(var b=[],c=0;c<a.length;c++){var d=a[c];if("string"==typeof d)b.push(d);else if("function"==typeof d)b.push(d);else if(Array.isArray(d))b=b.concat(m(d));else{if("object"!=typeof d||"number"!=typeof d.length)throw new f("Invalid dependency: "+JSON.stringify(d));b=b.concat(m(d))}}return b}function n(){var a=m(arguments),b={arguments:[],"function":null};if(!a.length)return b;"function"==typeof a[a.length-1]&&(b.function=a.splice(-1)[0]);for(var c in a){var d=a[c];if("string"!=typeof d)throw new f("Found "+typeof d+" but needed string: "+d);b.arguments.push(d)}return b}function o(a){return/^\$global[\/\.].+/.test(a)}function p(a){return o(a)?"$global/"+a.substring(8):a}function q(){if(1==arguments.length&&arguments[0].name&&arguments[0].constructor){var a=arguments[0];return q(a.name,a.dependencies||[],a.constructor)}var b,c,d=n(arguments),e=[];if(!d.arguments.length)throw new f("No module name specified");if(b=p(d.arguments.splice(0,1)[0]),e=d.arguments,y[b])throw new f("Module '"+b+"' already defined");if(!d.function)throw new f("No constructor function specified for module '"+b+"'");c=d.function;var a=y[b]=new j(b,e,c);for(var g in x.define)try{x.define[g](a)}catch(h){console.error("Error notifying listener",h)}return z[a.name]&&(z[a.name].resolve(a),delete z[a.name]),a}function r(a){if(a instanceof j)return a;if("string"==typeof a){if(y[a])return y[a];if(z[a])return z[a].promise;if(o(a))return y[a]=new k(a);var b=new d(v/2,new g(a));return z[a]=b,b.promise}return w.reject("Unable to resolve module of type "+typeof a)}function s(a){if(!(a instanceof j))return w.reject("Unable to resolve module of type "+typeof a);if(0==a.dependencies.length)return A;var b=[];for(var c in a.dependencies){var d=a.dependencies[c];b.push(r(d))}return w.all(b)}function t(a,b){if(!(a instanceof j))return w.reject("Unable to resolve module of type "+typeof a);var c=[];for(var d in a.dependencies){var e=a.dependencies[d];if(!b[e]){var f=b[e]=r(e);c.push(w.resolve(f).then(function(a){return b[e]=a,t(a,b)}))}}return w.all(c).then(function(){return b})}function u(a){function c(a,b,e){if(e=e.slice(0),null!=a.name&&e.push(a.name),k[a.name])return k[a.name];50>b&&(b=50);var f=new d(b,"Timeout waiting for module '"+a.name+"'");return a.name&&!a.$$dynamic&&(k[a.name]=f.promise),s(a).then(function(d){var f=[];for(var g in d){var h=d[g],j=e.indexOf(h.name);if(j>=0){var l=e.slice(j);throw new i(l)}f.push(k[h.name]?k[h.name]:c(h,b-5,e))}return w.all(f).then(function(b){return a.constructor.apply(a,b)})}).then(function(b){a.name&&!a.$$dynamic&&(k[a.name]=b),f.resolve(b)},function(b){f.reject(new h(a.name,b))}),f.promise}function e(){return 1==arguments.length&&"string"==typeof arguments[0]?g([arguments[0]],function(a){return a}):g(arguments,function(){for(var a=[],b=0;b<arguments.length;b++)a.push(arguments[b]);return a})}function g(){var b=n(arguments);if(!b.function)throw new f("Callback for injection unspecified");var d=new j(null,b.arguments,b.function);try{return c(d,a,[])}catch(e){return w.reject(e)}}if(!(this instanceof u))return new u(w);if(void 0===a)a=v;else{if(a=Number(a),0/0===a)throw new f("Timeout is not a number");if(100>a)throw new f("Timeout must be greater or equal than 100ms")}var k={$global:b,$esquire:this,$promise:w,$deferred:d};Object.defineProperties(this,{inject:{enumerable:!0,configurable:!1,value:g},require:{enumerable:!0,configurable:!1,value:e}})}b.console||(b.console={}),b.console.error||(b.console.error=function(){}),b.console.warn||(b.console.warn=function(){}),b.console.log||(b.console.log=function(){}),b.console.info||(b.console.info=function(){}),b.console.debug||(b.console.debug=function(){}),c.prototype=Object.create(Object.prototype),c.prototype.constructor=c,c.prototype.name="Deferring",d.prototype=Object.create(c.prototype),d.prototype.constructor=d,d.prototype.name="Deferred",e.prototype=Object.create(Object.prototype),e.prototype.constructor=e,e.prototype.name="Promise",Object.defineProperty(e,"all",{enumerable:!0,configurable:!1,value:function(a){if(!Array.isArray(a))return e.reject(new TypeError("Invalid argument"));var b=new d;if(0==a.length)return b.resolve([]),b.promise;for(var c=new Array(a.length),f=a.length,g=0;g<a.length;g++)!function(d){var e=a[d];e&&"function"==typeof e.then?e.then(function(a){c[d]=a,0==--f&&b.resolve(c)},function(a){b.reject(a)}):(c[d]=e,0==--f&&b.resolve(c))}(g);return b.promise}}),Object.defineProperty(e,"race",{enumerable:!0,configurable:!1,value:function(a){if(!Array.isArray(a))return e.reject(new TypeError("Invalid argument"));var b=new d;for(var c in a){var f=a[c];f&&"function"==typeof f.then?f.then(function(a){b.resolve(a)},function(a){b.reject(a)}):b.resolve(f)}return b.promise}}),Object.defineProperty(e,"resolve",{enumerable:!0,configurable:!1,value:function(a){var b=new d;return a&&"function"==typeof a.then?a.then(function(a){b.resolve(a)},function(a){b.reject(a)}):b.resolve(a),b.promise}}),Object.defineProperty(e,"reject",{enumerable:!0,configurable:!1,value:function(a){var b=new d;return b.reject(a),b.promise}}),f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.prototype.name="EsquireError",g.prototype=Object.create(f.prototype),g.prototype.constructor=g,g.prototype.name="NoModuleError",h.prototype=Object.create(f.prototype),h.prototype.constructor=h,h.prototype.name="InjectionError",i.prototype=Object.create(f.prototype),i.prototype.constructor=i,i.prototype.name="CircularDependencyError",k.prototype=Object.create(j.prototype),k.prototype.constructor=k,k.prototype.name="GlobalModule",l.prototype=Object.create(j.prototype),l.prototype.constructor=l,l.prototype.name="InternalModule";var v=2e3,w=b.Promise||e,x={define:[]},y={$global:new l("$global"),$esquire:new l("$esquire"),$promise:new l("$promise"),$deferred:new l("$deferred")},z={},A=w.resolve([]);if(Object.defineProperties(u,{$$script:{enumerable:!1,configurable:!1,value:a.toString()},$$normalize:{enumerable:!1,configurable:!1,value:n},$$Promise:{enumerable:!1,configurable:!1,value:e},$$Deferred:{enumerable:!1,configurable:!1,value:d},define:{enumerable:!0,configurable:!1,value:q},resolve:{enumerable:!0,configurable:!1,value:function(a,b){if("string"==typeof a)return w.resolve(r(a)).then(function(a){return u.resolve(a,b)});if(!(a instanceof j))throw new TypeError("Must be invoked with Module or module name");return b?t(a,{}):s(a).then(function(a){var b={};for(var c in a)b[a[c].name]=a[c];return b})}},timeout:{enumerable:!0,configurable:!1,get:function(){return v},set:function(a){if(a=Number(a),0/0===a)throw new f("Timeout is not a number");if(100>a)throw new f("Timeout must be greater or equal than 100ms");v=a}},modules:{enumerable:!0,configurable:!1,get:function(){var a={};for(var b in y)a[b]=y[b];return Object.freeze(a)}},module:{enumerable:!0,configurable:!1,value:function(a){return w.resolve(r(a))}},on:{enumerable:!0,configurable:!1,value:function(a,b){if("string"!=typeof a)throw new f("Event name must be a string");if("function"!=typeof b)throw new f("Listener must be a function");return"define"===a&&x.define.push(b),u}}}),b.Esquire)throw new Error("Esquire already defined in global scope");b.Esquire=u;var B=new u;b.esquire=function(){if(0==arguments.length)throw new f("No dependencies/callback specified");var a=n(arguments);return a.function?B.inject(a.arguments,a.function):B.require(1==arguments.length&&"string"==typeof arguments[0]?arguments[0]:a.arguments)}}(function(){try{return window}catch(a){return global}}()),function(a){function b(a){var b=a.filename||a.target&&a.target.src;if(g[b]){if(a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),a.target&&a.target.parentNode)try{a.target.parentNode.removeChild(a.target)}catch(c){}var d=g[b];return delete g[b],d.remaining-=1,{script:b,promise:d}}}function c(a){var c=b(a);c&&(console.debug("Esquire: Successfully loaded script '",c.script,"'"),0==c.promise.remaining&&c.promise.resolve(Esquire.modules))}function d(a){var c=b(a);if(c){console.warn("Esquire: Unable to load script '",c.script,"'");var d=a.error||new Error("Unable to load script '"+c.script+"'");c.promise.reject(d)}}function e(){if(!h)throw new Error("Esquire: Document not available");var a=h.getElementsByTagName("script")[0],b=a.parentNode,e=new Esquire.$$Deferred;e.remaining=0;var i=Esquire.$$normalize(arguments).arguments,j=[];for(var k in i)!function(a){var b=h.createElement("script");b.async=!0,b.defer=!0,b.src=a,a=b.src,f[a]?console.debug("Esquire: Script '"+a+"' already loaded"):g[a]?console.debug("Esquire: Script '"+a+"' already being loaded"):(b.addEventListener("load",c,!1),b.addEventListener("error",d,!1),g[a]=e,e.remaining+=1,j.push(b))}(i[k]);if(0==j.length)e.resolve(Esquire.modules);else for(var k in j)console.debug("Esquire: About to load '"+j[k].src+"'"),b.insertBefore(j[k],a);return e.promise}if(!a.Esquire)throw new Error("Esquire not available");var f={},g={};a.addEventListener("error",d,!0);var h=a.document;a.Esquire||(a.Esquire={}),a.Esquire.load=e}(window);
"use strict";!function a(b){function c(a,b){var d=0,e=null,f=[],g=function(a){var b=d>0?"resolve":0>d?"reject":null;if(b)for(var c in a)a[c][b](e)},h=this;Object.defineProperties(this,{resolve:{enumerable:!0,configurable:!1,value:function(b){if(b&&"function"==typeof b.then)b.then(function(a){h.resolve(a)},function(a){h.reject(a)});else if(0==d){if(e=b,d=1,a)try{e=a(e)}catch(c){e=c,d=-1}g(f)}}},reject:{enumerable:!0,configurable:!1,value:function(a){if(0==d){if(e=a,d=-1,b)try{e=b(e),d=1}catch(c){e=c}g(f)}}},promise:{enumerable:!0,configurable:!1,value:Object.defineProperties(new Object,{then:{enumerable:!0,configurable:!1,value:function(a,b){var e=new c(a,b);return 0==d?f.push(e):g([e]),e.promise}},"catch":{enumerable:!0,configurable:!1,value:function(a){return this.then(null,a)}}})}})}function d(a,e){if(!(this instanceof d))return new d(a,e);if(void 0===a)c.call(this);else{if(!("number"==typeof a&&a>=0))throw new TypeError("Deferred constructor must be called with a non-negative number");null==e?e=new Error("Timeout waiting for resolution/rejection"):"string"==typeof e&&(e=new Error(e));var f=this,g=b.setTimeout(function(){f.reject(e)},a);c.call(this,function(a){return b.clearTimeout(g),a},function(a){throw b.clearTimeout(g),a})}}function e(a){if(!(this instanceof e))return new e(a);if("function"!=typeof a)throw new TypeError("Executor is not a function");var b=new d;Object.defineProperties(this,{then:{enumerable:!0,configurable:!1,value:function(){return b.promise.then.apply(b.promise,arguments)}},"catch":{enumerable:!0,configurable:!1,value:function(){return b.promise.catch.apply(b.promise,arguments)}}});try{a(b.resolve,b.reject)}catch(c){b.reject(c)}}function f(a,b){a="Esquire: "+(a||"Unknown error");var c="";if(b&&b.length)for(var d=0;d<b.length;d++)b[d]&&(c+=" -> "+b[d]);c&&(a+=" resolving"+c),Error.call(this,a),this.message=a;var e=this.stack||(new Error).stack;e&&(e=e.replace(new RegExp("^(Error|"+this.name+")\n"),""),this.stack=this.name+": "+this.message+"\n"+e)}function g(a){f.call(this,"Module '"+a+"' not found")}function h(a,b){var c=a?"Error instantiating '"+a+"' module":"Injection failed";this.$$message=c,b&&(this.originalCause=b.originalCause||b,this.cause=b);for(var d=b;null!=d;d=d.cause)c+="\n- Cause: "+(d.$$message||d.message||"[no message]");f.call(this,c)}function i(a){var b="Detected circular dependency in ";for(var c in a)b+=a[c]+" -> ";b+=a[0],this.$$message=b,f.call(this,b)}function j(a,b,c,d){a=p(a);for(var e in b)b[e]=p(b[e]);Object.defineProperty(this,"name",{enumerable:!0,configurable:!1,value:a}),Object.defineProperty(this,"dependencies",{enumerable:!0,configurable:!1,value:b}),Object.defineProperty(this,"constructor",{enumerable:!0,configurable:!1,value:c}),Object.defineProperty(this,"$$dynamic",{enumerable:!1,configurable:!1,value:d||!1}),Object.defineProperty(this,"$$script",{enumerable:!1,configurable:!1,get:function(){return"Esquire.define("+JSON.stringify(this.name)+","+JSON.stringify(this.dependencies)+","+c.toString()+");"}}),Object.freeze(this)}function k(a){j.call(this,a,["$global"],function(a){function b(a,c,d){if(!d&&a in c)return c[a];var e=["Ms","ms","Moz","moz","WebKit","webkit"];for(var f in e){var g=e[f]+a;if(g in c)return c[g]}return a[0]!==a[0].toUpperCase()?b(a[0].toUpperCase()+a.substring(1),c,!0):void 0}function c(a,d){if(!d)return void 0;if(!a)return void 0;switch(a.length){case 0:return void 0;case 1:return b(a[0],d);default:return c(a.slice(1),b(a[0],d))}}return c(this.name.substring(8).split("."),a)},!0)}function l(a){j.call(this,a,[],function(){throw new f("The constructor for '"+a+"' should not be called'")},!0)}function m(a){if(!a)return[];for(var b=[],c=0;c<a.length;c++){var d=a[c];if("string"==typeof d)b.push(d);else if("function"==typeof d)b.push(d);else if(Array.isArray(d))b=b.concat(m(d));else{if("object"!=typeof d||"number"!=typeof d.length)throw new f("Invalid dependency: "+JSON.stringify(d));b=b.concat(m(d))}}return b}function n(){var a=m(arguments),b={arguments:[],"function":null};if(!a.length)return b;"function"==typeof a[a.length-1]&&(b.function=a.splice(-1)[0]);for(var c in a){var d=a[c];if("string"!=typeof d)throw new f("Found "+typeof d+" but needed string: "+d);b.arguments.push(d)}return b}function o(a){return/^\$global[\/\.].+/.test(a)}function p(a){return o(a)?"$global/"+a.substring(8):a}function q(){if(1==arguments.length&&arguments[0].name&&arguments[0].constructor){var a=arguments[0];return q(a.name,a.dependencies||[],a.constructor)}var b,c,d=n(arguments),e=[];if(!d.arguments.length)throw new f("No module name specified");if(b=p(d.arguments.splice(0,1)[0]),e=d.arguments,y[b])throw new f("Module '"+b+"' already defined");if(!d.function)throw new f("No constructor function specified for module '"+b+"'");c=d.function;var a=y[b]=new j(b,e,c);for(var g in x.define)try{x.define[g](a)}catch(h){console.error("Error notifying listener",h)}return z[a.name]&&(z[a.name].resolve(a),delete z[a.name]),a}function r(a){if(a instanceof j)return a;if("string"==typeof a){if(y[a])return y[a];if(z[a])return z[a].promise;if(o(a))return y[a]=new k(a);var b=new d(v/2,new g(a));return z[a]=b,b.promise}return w.reject("Unable to resolve module of type "+typeof a)}function s(a){if(!(a instanceof j))return w.reject("Unable to resolve module of type "+typeof a);if(0==a.dependencies.length)return A;var b=[];for(var c in a.dependencies){var d=a.dependencies[c];b.push(r(d))}return w.all(b)}function t(a,b){if(!(a instanceof j))return w.reject("Unable to resolve module of type "+typeof a);var c=[];for(var d in a.dependencies){var e=a.dependencies[d];if(!b[e]){var f=b[e]=r(e);c.push(w.resolve(f).then(function(a){return b[e]=a,t(a,b)}))}}return w.all(c).then(function(){return b})}function u(a){function c(a,b,e){if(e=e.slice(0),null!=a.name&&e.push(a.name),k[a.name])return k[a.name];50>b&&(b=50);var f=new d(b,"Timeout waiting for module '"+a.name+"'");return a.name&&!a.$$dynamic&&(k[a.name]=f.promise),s(a).then(function(d){var f=[];for(var g in d){var h=d[g],j=e.indexOf(h.name);if(j>=0){var l=e.slice(j);throw new i(l)}f.push(k[h.name]?k[h.name]:c(h,b-5,e))}return w.all(f).then(function(b){return a.constructor.apply(a,b)})}).then(function(b){a.name&&!a.$$dynamic&&(k[a.name]=b),f.resolve(b)},function(b){f.reject(new h(a.name,b))}),f.promise}function e(){return 1==arguments.length&&"string"==typeof arguments[0]?g([arguments[0]],function(a){return a}):g(arguments,function(){for(var a=[],b=0;b<arguments.length;b++)a.push(arguments[b]);return a})}function g(){var b=n(arguments);if(!b.function)throw new f("Callback for injection unspecified");var d=new j(null,b.arguments,b.function);try{return c(d,a,[])}catch(e){return w.reject(e)}}if(!(this instanceof u))return new u(w);if(void 0===a)a=v;else{if(a=Number(a),0/0===a)throw new f("Timeout is not a number");if(100>a)throw new f("Timeout must be greater or equal than 100ms")}var k={$global:b,$esquire:this,$promise:w,$deferred:d};Object.defineProperties(this,{inject:{enumerable:!0,configurable:!1,value:g},require:{enumerable:!0,configurable:!1,value:e}})}b.console||(b.console={}),b.console.error||(b.console.error=function(){}),b.console.warn||(b.console.warn=function(){}),b.console.log||(b.console.log=function(){}),b.console.info||(b.console.info=function(){}),b.console.debug||(b.console.debug=function(){}),b.Array.isArray||(b.Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),c.prototype=Object.create(Object.prototype),c.prototype.constructor=c,c.prototype.name="Deferring",d.prototype=Object.create(c.prototype),d.prototype.constructor=d,d.prototype.name="Deferred",e.prototype=Object.create(Object.prototype),e.prototype.constructor=e,e.prototype.name="Promise",Object.defineProperty(e,"all",{enumerable:!0,configurable:!1,value:function(a){if(!Array.isArray(a))return e.reject(new TypeError("Invalid argument"));var b=new d;if(0==a.length)return b.resolve([]),b.promise;for(var c=new Array(a.length),f=a.length,g=0;g<a.length;g++)!function(d){var e=a[d];e&&"function"==typeof e.then?e.then(function(a){c[d]=a,0==--f&&b.resolve(c)},function(a){b.reject(a)}):(c[d]=e,0==--f&&b.resolve(c))}(g);return b.promise}}),Object.defineProperty(e,"race",{enumerable:!0,configurable:!1,value:function(a){if(!Array.isArray(a))return e.reject(new TypeError("Invalid argument"));var b=new d;for(var c in a){var f=a[c];f&&"function"==typeof f.then?f.then(function(a){b.resolve(a)},function(a){b.reject(a)}):b.resolve(f)}return b.promise}}),Object.defineProperty(e,"resolve",{enumerable:!0,configurable:!1,value:function(a){var b=new d;return a&&"function"==typeof a.then?a.then(function(a){b.resolve(a)},function(a){b.reject(a)}):b.resolve(a),b.promise}}),Object.defineProperty(e,"reject",{enumerable:!0,configurable:!1,value:function(a){var b=new d;return b.reject(a),b.promise}}),f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.prototype.name="EsquireError",g.prototype=Object.create(f.prototype),g.prototype.constructor=g,g.prototype.name="NoModuleError",h.prototype=Object.create(f.prototype),h.prototype.constructor=h,h.prototype.name="InjectionError",i.prototype=Object.create(f.prototype),i.prototype.constructor=i,i.prototype.name="CircularDependencyError",k.prototype=Object.create(j.prototype),k.prototype.constructor=k,k.prototype.name="GlobalModule",l.prototype=Object.create(j.prototype),l.prototype.constructor=l,l.prototype.name="InternalModule";var v=2e3,w=b.Promise||e,x={define:[]},y={$global:new l("$global"),$esquire:new l("$esquire"),$promise:new l("$promise"),$deferred:new l("$deferred")},z={},A=w.resolve([]);if(Object.defineProperties(u,{$$script:{enumerable:!1,configurable:!1,value:a.toString()},$$Promise:{enumerable:!1,configurable:!1,value:e},$$Deferred:{enumerable:!1,configurable:!1,value:d},define:{enumerable:!0,configurable:!1,value:q},resolve:{enumerable:!0,configurable:!1,value:function(a,b,c){if("string"==typeof a)return w.resolve(r(a)).then(function(a){return u.resolve(a,b,c)});if(!(a instanceof j))throw new TypeError("Must be invoked with Module or module name");var d={};return c&&(d[a.name]=a),b?t(a,d):s(a).then(function(a){for(var b in a)d[a[b].name]=a[b];return d})}},timeout:{enumerable:!0,configurable:!1,get:function(){return v},set:function(a){if(a=Number(a),0/0===a)throw new f("Timeout is not a number");if(100>a)throw new f("Timeout must be greater or equal than 100ms");v=a}},modules:{enumerable:!0,configurable:!1,get:function(){var a={};for(var b in y)a[b]=y[b];return Object.freeze(a)}},module:{enumerable:!0,configurable:!1,value:function(a){return w.resolve(r(a))}},on:{enumerable:!0,configurable:!1,value:function(a,b){if("string"!=typeof a)throw new f("Event name must be a string");if("function"!=typeof b)throw new f("Listener must be a function");return"define"===a&&x.define.push(b),u}}}),b.Esquire)throw new Error("Esquire already defined in global scope");b.Esquire=u;var B=new u;b.esquire=function(){if(0==arguments.length)throw new f("No dependencies/callback specified");var a=n(arguments);return a.function?B.inject(a.arguments,a.function):B.require(1==arguments.length&&"string"==typeof arguments[0]?arguments[0]:a.arguments)}}(function(){try{return window}catch(a){return global}}()),function(a){function b(a){if(!a)return[];for(var c=[],d=0;d<a.length;d++){var e=a[d];if("string"==typeof e)c.push(e);else if("function"==typeof e)c.push(e);else if(Array.isArray(e))c=c.concat(b(e));else{if("object"!=typeof e||"number"!=typeof e.length)throw new EsquireError("Invalid dependency: "+JSON.stringify(e));c=c.concat(b(e))}}return c}function c(a){var b=a.filename||a.target&&a.target.src;if(h[b]){if(a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),a.target&&a.target.parentNode)try{a.target.parentNode.removeChild(a.target)}catch(c){}var d=h[b];return delete h[b],d.remaining-=1,{script:b,promise:d}}}function d(a){var b=c(a);b&&(console.debug("Esquire: Successfully loaded script '",b.script,"'"),0==b.promise.remaining&&b.promise.resolve(Esquire.modules))}function e(a){var b=c(a);if(b){console.warn("Esquire: Unable to load script '",b.script,"'");var d=a.error||new Error("Unable to load script '"+b.script+"'");b.promise.reject(d)}}function f(){if(!i)throw new Error("Esquire: Document not available");var a=i.getElementsByTagName("script")[0],c=a.parentNode,f=new Esquire.$$Deferred;f.remaining=0;var j=b(arguments),k=[];for(var l in j)!function(a){var b=i.createElement("script");b.async=!0,b.defer=!0,b.src=a,a=b.src,g[a]?console.debug("Esquire: Script '"+a+"' already loaded"):h[a]?console.debug("Esquire: Script '"+a+"' already being loaded"):(b.addEventListener("load",d,!1),b.addEventListener("error",e,!1),h[a]=f,f.remaining+=1,k.push(b))}(j[l]);if(0==k.length)f.resolve(Esquire.modules);else for(var l in k)console.debug("Esquire: About to load '"+k[l].src+"'"),c.insertBefore(k[l],a);return f.promise}if(!a.Esquire)throw new Error("Esquire not available");var g={},h={};a.addEventListener("error",e,!0);var i=a.document;a.Esquire||(a.Esquire={}),a.Esquire.load=f}(window);

@@ -1,1 +0,1 @@

"use strict";!function a(b){function c(a,b){var d=0,e=null,f=[],g=function(a){var b=d>0?"resolve":0>d?"reject":null;if(b)for(var c in a)a[c][b](e)},h=this;Object.defineProperties(this,{resolve:{enumerable:!0,configurable:!1,value:function(b){if(b&&"function"==typeof b.then)b.then(function(a){h.resolve(a)},function(a){h.reject(a)});else if(0==d){if(e=b,d=1,a)try{e=a(e)}catch(c){e=c,d=-1}g(f)}}},reject:{enumerable:!0,configurable:!1,value:function(a){if(0==d){if(e=a,d=-1,b)try{e=b(e),d=1}catch(c){e=c}g(f)}}},promise:{enumerable:!0,configurable:!1,value:Object.defineProperties(new Object,{then:{enumerable:!0,configurable:!1,value:function(a,b){var e=new c(a,b);return 0==d?f.push(e):g([e]),e.promise}},"catch":{enumerable:!0,configurable:!1,value:function(a){return this.then(null,a)}}})}})}function d(a,e){if(!(this instanceof d))return new d(a,e);if(void 0===a)c.call(this);else{if(!("number"==typeof a&&a>=0))throw new TypeError("Deferred constructor must be called with a non-negative number");null==e?e=new Error("Timeout waiting for resolution/rejection"):"string"==typeof e&&(e=new Error(e));var f=this,g=b.setTimeout(function(){f.reject(e)},a);c.call(this,function(a){return b.clearTimeout(g),a},function(a){throw b.clearTimeout(g),a})}}function e(a){if(!(this instanceof e))return new e(a);if("function"!=typeof a)throw new TypeError("Executor is not a function");var b=new d;Object.defineProperties(this,{then:{enumerable:!0,configurable:!1,value:function(){return b.promise.then.apply(b.promise,arguments)}},"catch":{enumerable:!0,configurable:!1,value:function(){return b.promise.catch.apply(b.promise,arguments)}}});try{a(b.resolve,b.reject)}catch(c){b.reject(c)}}function f(a,b){a="Esquire: "+(a||"Unknown error");var c="";if(b&&b.length)for(var d=0;d<b.length;d++)b[d]&&(c+=" -> "+b[d]);c&&(a+=" resolving"+c),Error.call(this,a),this.message=a;var e=this.stack||(new Error).stack;e&&(e=e.replace(new RegExp("^(Error|"+this.name+")\n"),""),this.stack=this.name+": "+this.message+"\n"+e)}function g(a){f.call(this,"Module '"+a+"' not found")}function h(a,b){var c=a?"Error instantiating '"+a+"' module":"Injection failed";this.$$message=c,b&&(this.originalCause=b.originalCause||b,this.cause=b);for(var d=b;null!=d;d=d.cause)c+="\n- Cause: "+(d.$$message||d.message||"[no message]");f.call(this,c)}function i(a){var b="Detected circular dependency in ";for(var c in a)b+=a[c]+" -> ";b+=a[0],this.$$message=b,f.call(this,b)}function j(a,b,c,d){a=p(a);for(var e in b)b[e]=p(b[e]);Object.defineProperty(this,"name",{enumerable:!0,configurable:!1,value:a}),Object.defineProperty(this,"dependencies",{enumerable:!0,configurable:!1,value:b}),Object.defineProperty(this,"constructor",{enumerable:!0,configurable:!1,value:c}),Object.defineProperty(this,"$$dynamic",{enumerable:!1,configurable:!1,value:d||!1}),Object.defineProperty(this,"$$script",{enumerable:!1,configurable:!1,get:function(){return"Esquire.define("+JSON.stringify(this.name)+","+JSON.stringify(this.dependencies)+","+c.toString()+");"}}),Object.freeze(this)}function k(a){j.call(this,a,["$global"],function(a){function b(a,c,d){if(!d&&a in c)return c[a];var e=["Ms","ms","Moz","moz","WebKit","webkit"];for(var f in e){var g=e[f]+a;if(g in c)return c[g]}return a[0]!==a[0].toUpperCase()?b(a[0].toUpperCase()+a.substring(1),c,!0):void 0}function c(a,d){if(!d)return void 0;if(!a)return void 0;switch(a.length){case 0:return void 0;case 1:return b(a[0],d);default:return c(a.slice(1),b(a[0],d))}}return c(this.name.substring(8).split("."),a)},!0)}function l(a){j.call(this,a,[],function(){throw new f("The constructor for '"+a+"' should not be called'")},!0)}function m(a){if(!a)return[];for(var b=[],c=0;c<a.length;c++){var d=a[c];if("string"==typeof d)b.push(d);else if("function"==typeof d)b.push(d);else if(Array.isArray(d))b=b.concat(m(d));else{if("object"!=typeof d||"number"!=typeof d.length)throw new f("Invalid dependency: "+JSON.stringify(d));b=b.concat(m(d))}}return b}function n(){var a=m(arguments),b={arguments:[],"function":null};if(!a.length)return b;"function"==typeof a[a.length-1]&&(b.function=a.splice(-1)[0]);for(var c in a){var d=a[c];if("string"!=typeof d)throw new f("Found "+typeof d+" but needed string: "+d);b.arguments.push(d)}return b}function o(a){return/^\$global[\/\.].+/.test(a)}function p(a){return o(a)?"$global/"+a.substring(8):a}function q(){if(1==arguments.length&&arguments[0].name&&arguments[0].constructor){var a=arguments[0];return q(a.name,a.dependencies||[],a.constructor)}var b,c,d=n(arguments),e=[];if(!d.arguments.length)throw new f("No module name specified");if(b=p(d.arguments.splice(0,1)[0]),e=d.arguments,y[b])throw new f("Module '"+b+"' already defined");if(!d.function)throw new f("No constructor function specified for module '"+b+"'");c=d.function;var a=y[b]=new j(b,e,c);for(var g in x.define)try{x.define[g](a)}catch(h){console.error("Error notifying listener",h)}return z[a.name]&&(z[a.name].resolve(a),delete z[a.name]),a}function r(a){if(a instanceof j)return a;if("string"==typeof a){if(y[a])return y[a];if(z[a])return z[a].promise;if(o(a))return y[a]=new k(a);var b=new d(v/2,new g(a));return z[a]=b,b.promise}return w.reject("Unable to resolve module of type "+typeof a)}function s(a){if(!(a instanceof j))return w.reject("Unable to resolve module of type "+typeof a);if(0==a.dependencies.length)return A;var b=[];for(var c in a.dependencies){var d=a.dependencies[c];b.push(r(d))}return w.all(b)}function t(a,b){if(!(a instanceof j))return w.reject("Unable to resolve module of type "+typeof a);var c=[];for(var d in a.dependencies){var e=a.dependencies[d];if(!b[e]){var f=b[e]=r(e);c.push(w.resolve(f).then(function(a){return b[e]=a,t(a,b)}))}}return w.all(c).then(function(){return b})}function u(a){function c(a,b,e){if(e=e.slice(0),null!=a.name&&e.push(a.name),k[a.name])return k[a.name];50>b&&(b=50);var f=new d(b,"Timeout waiting for module '"+a.name+"'");return a.name&&!a.$$dynamic&&(k[a.name]=f.promise),s(a).then(function(d){var f=[];for(var g in d){var h=d[g],j=e.indexOf(h.name);if(j>=0){var l=e.slice(j);throw new i(l)}f.push(k[h.name]?k[h.name]:c(h,b-5,e))}return w.all(f).then(function(b){return a.constructor.apply(a,b)})}).then(function(b){a.name&&!a.$$dynamic&&(k[a.name]=b),f.resolve(b)},function(b){f.reject(new h(a.name,b))}),f.promise}function e(){return 1==arguments.length&&"string"==typeof arguments[0]?g([arguments[0]],function(a){return a}):g(arguments,function(){for(var a=[],b=0;b<arguments.length;b++)a.push(arguments[b]);return a})}function g(){var b=n(arguments);if(!b.function)throw new f("Callback for injection unspecified");var d=new j(null,b.arguments,b.function);try{return c(d,a,[])}catch(e){return w.reject(e)}}if(!(this instanceof u))return new u(w);if(void 0===a)a=v;else{if(a=Number(a),0/0===a)throw new f("Timeout is not a number");if(100>a)throw new f("Timeout must be greater or equal than 100ms")}var k={$global:b,$esquire:this,$promise:w,$deferred:d};Object.defineProperties(this,{inject:{enumerable:!0,configurable:!1,value:g},require:{enumerable:!0,configurable:!1,value:e}})}b.console||(b.console={}),b.console.error||(b.console.error=function(){}),b.console.warn||(b.console.warn=function(){}),b.console.log||(b.console.log=function(){}),b.console.info||(b.console.info=function(){}),b.console.debug||(b.console.debug=function(){}),c.prototype=Object.create(Object.prototype),c.prototype.constructor=c,c.prototype.name="Deferring",d.prototype=Object.create(c.prototype),d.prototype.constructor=d,d.prototype.name="Deferred",e.prototype=Object.create(Object.prototype),e.prototype.constructor=e,e.prototype.name="Promise",Object.defineProperty(e,"all",{enumerable:!0,configurable:!1,value:function(a){if(!Array.isArray(a))return e.reject(new TypeError("Invalid argument"));var b=new d;if(0==a.length)return b.resolve([]),b.promise;for(var c=new Array(a.length),f=a.length,g=0;g<a.length;g++)!function(d){var e=a[d];e&&"function"==typeof e.then?e.then(function(a){c[d]=a,0==--f&&b.resolve(c)},function(a){b.reject(a)}):(c[d]=e,0==--f&&b.resolve(c))}(g);return b.promise}}),Object.defineProperty(e,"race",{enumerable:!0,configurable:!1,value:function(a){if(!Array.isArray(a))return e.reject(new TypeError("Invalid argument"));var b=new d;for(var c in a){var f=a[c];f&&"function"==typeof f.then?f.then(function(a){b.resolve(a)},function(a){b.reject(a)}):b.resolve(f)}return b.promise}}),Object.defineProperty(e,"resolve",{enumerable:!0,configurable:!1,value:function(a){var b=new d;return a&&"function"==typeof a.then?a.then(function(a){b.resolve(a)},function(a){b.reject(a)}):b.resolve(a),b.promise}}),Object.defineProperty(e,"reject",{enumerable:!0,configurable:!1,value:function(a){var b=new d;return b.reject(a),b.promise}}),f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.prototype.name="EsquireError",g.prototype=Object.create(f.prototype),g.prototype.constructor=g,g.prototype.name="NoModuleError",h.prototype=Object.create(f.prototype),h.prototype.constructor=h,h.prototype.name="InjectionError",i.prototype=Object.create(f.prototype),i.prototype.constructor=i,i.prototype.name="CircularDependencyError",k.prototype=Object.create(j.prototype),k.prototype.constructor=k,k.prototype.name="GlobalModule",l.prototype=Object.create(j.prototype),l.prototype.constructor=l,l.prototype.name="InternalModule";var v=2e3,w=b.Promise||e,x={define:[]},y={$global:new l("$global"),$esquire:new l("$esquire"),$promise:new l("$promise"),$deferred:new l("$deferred")},z={},A=w.resolve([]);if(Object.defineProperties(u,{$$script:{enumerable:!1,configurable:!1,value:a.toString()},$$normalize:{enumerable:!1,configurable:!1,value:n},$$Promise:{enumerable:!1,configurable:!1,value:e},$$Deferred:{enumerable:!1,configurable:!1,value:d},define:{enumerable:!0,configurable:!1,value:q},resolve:{enumerable:!0,configurable:!1,value:function(a,b){if("string"==typeof a)return w.resolve(r(a)).then(function(a){return u.resolve(a,b)});if(!(a instanceof j))throw new TypeError("Must be invoked with Module or module name");return b?t(a,{}):s(a).then(function(a){var b={};for(var c in a)b[a[c].name]=a[c];return b})}},timeout:{enumerable:!0,configurable:!1,get:function(){return v},set:function(a){if(a=Number(a),0/0===a)throw new f("Timeout is not a number");if(100>a)throw new f("Timeout must be greater or equal than 100ms");v=a}},modules:{enumerable:!0,configurable:!1,get:function(){var a={};for(var b in y)a[b]=y[b];return Object.freeze(a)}},module:{enumerable:!0,configurable:!1,value:function(a){return w.resolve(r(a))}},on:{enumerable:!0,configurable:!1,value:function(a,b){if("string"!=typeof a)throw new f("Event name must be a string");if("function"!=typeof b)throw new f("Listener must be a function");return"define"===a&&x.define.push(b),u}}}),b.Esquire)throw new Error("Esquire already defined in global scope");b.Esquire=u;var B=new u;b.esquire=function(){if(0==arguments.length)throw new f("No dependencies/callback specified");var a=n(arguments);return a.function?B.inject(a.arguments,a.function):B.require(1==arguments.length&&"string"==typeof arguments[0]?arguments[0]:a.arguments)}}(function(){try{return window}catch(a){return global}}());
"use strict";!function a(b){function c(a,b){var d=0,e=null,f=[],g=function(a){var b=d>0?"resolve":0>d?"reject":null;if(b)for(var c in a)a[c][b](e)},h=this;Object.defineProperties(this,{resolve:{enumerable:!0,configurable:!1,value:function(b){if(b&&"function"==typeof b.then)b.then(function(a){h.resolve(a)},function(a){h.reject(a)});else if(0==d){if(e=b,d=1,a)try{e=a(e)}catch(c){e=c,d=-1}g(f)}}},reject:{enumerable:!0,configurable:!1,value:function(a){if(0==d){if(e=a,d=-1,b)try{e=b(e),d=1}catch(c){e=c}g(f)}}},promise:{enumerable:!0,configurable:!1,value:Object.defineProperties(new Object,{then:{enumerable:!0,configurable:!1,value:function(a,b){var e=new c(a,b);return 0==d?f.push(e):g([e]),e.promise}},"catch":{enumerable:!0,configurable:!1,value:function(a){return this.then(null,a)}}})}})}function d(a,e){if(!(this instanceof d))return new d(a,e);if(void 0===a)c.call(this);else{if(!("number"==typeof a&&a>=0))throw new TypeError("Deferred constructor must be called with a non-negative number");null==e?e=new Error("Timeout waiting for resolution/rejection"):"string"==typeof e&&(e=new Error(e));var f=this,g=b.setTimeout(function(){f.reject(e)},a);c.call(this,function(a){return b.clearTimeout(g),a},function(a){throw b.clearTimeout(g),a})}}function e(a){if(!(this instanceof e))return new e(a);if("function"!=typeof a)throw new TypeError("Executor is not a function");var b=new d;Object.defineProperties(this,{then:{enumerable:!0,configurable:!1,value:function(){return b.promise.then.apply(b.promise,arguments)}},"catch":{enumerable:!0,configurable:!1,value:function(){return b.promise.catch.apply(b.promise,arguments)}}});try{a(b.resolve,b.reject)}catch(c){b.reject(c)}}function f(a,b){a="Esquire: "+(a||"Unknown error");var c="";if(b&&b.length)for(var d=0;d<b.length;d++)b[d]&&(c+=" -> "+b[d]);c&&(a+=" resolving"+c),Error.call(this,a),this.message=a;var e=this.stack||(new Error).stack;e&&(e=e.replace(new RegExp("^(Error|"+this.name+")\n"),""),this.stack=this.name+": "+this.message+"\n"+e)}function g(a){f.call(this,"Module '"+a+"' not found")}function h(a,b){var c=a?"Error instantiating '"+a+"' module":"Injection failed";this.$$message=c,b&&(this.originalCause=b.originalCause||b,this.cause=b);for(var d=b;null!=d;d=d.cause)c+="\n- Cause: "+(d.$$message||d.message||"[no message]");f.call(this,c)}function i(a){var b="Detected circular dependency in ";for(var c in a)b+=a[c]+" -> ";b+=a[0],this.$$message=b,f.call(this,b)}function j(a,b,c,d){a=p(a);for(var e in b)b[e]=p(b[e]);Object.defineProperty(this,"name",{enumerable:!0,configurable:!1,value:a}),Object.defineProperty(this,"dependencies",{enumerable:!0,configurable:!1,value:b}),Object.defineProperty(this,"constructor",{enumerable:!0,configurable:!1,value:c}),Object.defineProperty(this,"$$dynamic",{enumerable:!1,configurable:!1,value:d||!1}),Object.defineProperty(this,"$$script",{enumerable:!1,configurable:!1,get:function(){return"Esquire.define("+JSON.stringify(this.name)+","+JSON.stringify(this.dependencies)+","+c.toString()+");"}}),Object.freeze(this)}function k(a){j.call(this,a,["$global"],function(a){function b(a,c,d){if(!d&&a in c)return c[a];var e=["Ms","ms","Moz","moz","WebKit","webkit"];for(var f in e){var g=e[f]+a;if(g in c)return c[g]}return a[0]!==a[0].toUpperCase()?b(a[0].toUpperCase()+a.substring(1),c,!0):void 0}function c(a,d){if(!d)return void 0;if(!a)return void 0;switch(a.length){case 0:return void 0;case 1:return b(a[0],d);default:return c(a.slice(1),b(a[0],d))}}return c(this.name.substring(8).split("."),a)},!0)}function l(a){j.call(this,a,[],function(){throw new f("The constructor for '"+a+"' should not be called'")},!0)}function m(a){if(!a)return[];for(var b=[],c=0;c<a.length;c++){var d=a[c];if("string"==typeof d)b.push(d);else if("function"==typeof d)b.push(d);else if(Array.isArray(d))b=b.concat(m(d));else{if("object"!=typeof d||"number"!=typeof d.length)throw new f("Invalid dependency: "+JSON.stringify(d));b=b.concat(m(d))}}return b}function n(){var a=m(arguments),b={arguments:[],"function":null};if(!a.length)return b;"function"==typeof a[a.length-1]&&(b.function=a.splice(-1)[0]);for(var c in a){var d=a[c];if("string"!=typeof d)throw new f("Found "+typeof d+" but needed string: "+d);b.arguments.push(d)}return b}function o(a){return/^\$global[\/\.].+/.test(a)}function p(a){return o(a)?"$global/"+a.substring(8):a}function q(){if(1==arguments.length&&arguments[0].name&&arguments[0].constructor){var a=arguments[0];return q(a.name,a.dependencies||[],a.constructor)}var b,c,d=n(arguments),e=[];if(!d.arguments.length)throw new f("No module name specified");if(b=p(d.arguments.splice(0,1)[0]),e=d.arguments,y[b])throw new f("Module '"+b+"' already defined");if(!d.function)throw new f("No constructor function specified for module '"+b+"'");c=d.function;var a=y[b]=new j(b,e,c);for(var g in x.define)try{x.define[g](a)}catch(h){console.error("Error notifying listener",h)}return z[a.name]&&(z[a.name].resolve(a),delete z[a.name]),a}function r(a){if(a instanceof j)return a;if("string"==typeof a){if(y[a])return y[a];if(z[a])return z[a].promise;if(o(a))return y[a]=new k(a);var b=new d(v/2,new g(a));return z[a]=b,b.promise}return w.reject("Unable to resolve module of type "+typeof a)}function s(a){if(!(a instanceof j))return w.reject("Unable to resolve module of type "+typeof a);if(0==a.dependencies.length)return A;var b=[];for(var c in a.dependencies){var d=a.dependencies[c];b.push(r(d))}return w.all(b)}function t(a,b){if(!(a instanceof j))return w.reject("Unable to resolve module of type "+typeof a);var c=[];for(var d in a.dependencies){var e=a.dependencies[d];if(!b[e]){var f=b[e]=r(e);c.push(w.resolve(f).then(function(a){return b[e]=a,t(a,b)}))}}return w.all(c).then(function(){return b})}function u(a){function c(a,b,e){if(e=e.slice(0),null!=a.name&&e.push(a.name),k[a.name])return k[a.name];50>b&&(b=50);var f=new d(b,"Timeout waiting for module '"+a.name+"'");return a.name&&!a.$$dynamic&&(k[a.name]=f.promise),s(a).then(function(d){var f=[];for(var g in d){var h=d[g],j=e.indexOf(h.name);if(j>=0){var l=e.slice(j);throw new i(l)}f.push(k[h.name]?k[h.name]:c(h,b-5,e))}return w.all(f).then(function(b){return a.constructor.apply(a,b)})}).then(function(b){a.name&&!a.$$dynamic&&(k[a.name]=b),f.resolve(b)},function(b){f.reject(new h(a.name,b))}),f.promise}function e(){return 1==arguments.length&&"string"==typeof arguments[0]?g([arguments[0]],function(a){return a}):g(arguments,function(){for(var a=[],b=0;b<arguments.length;b++)a.push(arguments[b]);return a})}function g(){var b=n(arguments);if(!b.function)throw new f("Callback for injection unspecified");var d=new j(null,b.arguments,b.function);try{return c(d,a,[])}catch(e){return w.reject(e)}}if(!(this instanceof u))return new u(w);if(void 0===a)a=v;else{if(a=Number(a),0/0===a)throw new f("Timeout is not a number");if(100>a)throw new f("Timeout must be greater or equal than 100ms")}var k={$global:b,$esquire:this,$promise:w,$deferred:d};Object.defineProperties(this,{inject:{enumerable:!0,configurable:!1,value:g},require:{enumerable:!0,configurable:!1,value:e}})}b.console||(b.console={}),b.console.error||(b.console.error=function(){}),b.console.warn||(b.console.warn=function(){}),b.console.log||(b.console.log=function(){}),b.console.info||(b.console.info=function(){}),b.console.debug||(b.console.debug=function(){}),b.Array.isArray||(b.Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),c.prototype=Object.create(Object.prototype),c.prototype.constructor=c,c.prototype.name="Deferring",d.prototype=Object.create(c.prototype),d.prototype.constructor=d,d.prototype.name="Deferred",e.prototype=Object.create(Object.prototype),e.prototype.constructor=e,e.prototype.name="Promise",Object.defineProperty(e,"all",{enumerable:!0,configurable:!1,value:function(a){if(!Array.isArray(a))return e.reject(new TypeError("Invalid argument"));var b=new d;if(0==a.length)return b.resolve([]),b.promise;for(var c=new Array(a.length),f=a.length,g=0;g<a.length;g++)!function(d){var e=a[d];e&&"function"==typeof e.then?e.then(function(a){c[d]=a,0==--f&&b.resolve(c)},function(a){b.reject(a)}):(c[d]=e,0==--f&&b.resolve(c))}(g);return b.promise}}),Object.defineProperty(e,"race",{enumerable:!0,configurable:!1,value:function(a){if(!Array.isArray(a))return e.reject(new TypeError("Invalid argument"));var b=new d;for(var c in a){var f=a[c];f&&"function"==typeof f.then?f.then(function(a){b.resolve(a)},function(a){b.reject(a)}):b.resolve(f)}return b.promise}}),Object.defineProperty(e,"resolve",{enumerable:!0,configurable:!1,value:function(a){var b=new d;return a&&"function"==typeof a.then?a.then(function(a){b.resolve(a)},function(a){b.reject(a)}):b.resolve(a),b.promise}}),Object.defineProperty(e,"reject",{enumerable:!0,configurable:!1,value:function(a){var b=new d;return b.reject(a),b.promise}}),f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.prototype.name="EsquireError",g.prototype=Object.create(f.prototype),g.prototype.constructor=g,g.prototype.name="NoModuleError",h.prototype=Object.create(f.prototype),h.prototype.constructor=h,h.prototype.name="InjectionError",i.prototype=Object.create(f.prototype),i.prototype.constructor=i,i.prototype.name="CircularDependencyError",k.prototype=Object.create(j.prototype),k.prototype.constructor=k,k.prototype.name="GlobalModule",l.prototype=Object.create(j.prototype),l.prototype.constructor=l,l.prototype.name="InternalModule";var v=2e3,w=b.Promise||e,x={define:[]},y={$global:new l("$global"),$esquire:new l("$esquire"),$promise:new l("$promise"),$deferred:new l("$deferred")},z={},A=w.resolve([]);if(Object.defineProperties(u,{$$script:{enumerable:!1,configurable:!1,value:a.toString()},$$Promise:{enumerable:!1,configurable:!1,value:e},$$Deferred:{enumerable:!1,configurable:!1,value:d},define:{enumerable:!0,configurable:!1,value:q},resolve:{enumerable:!0,configurable:!1,value:function(a,b,c){if("string"==typeof a)return w.resolve(r(a)).then(function(a){return u.resolve(a,b,c)});if(!(a instanceof j))throw new TypeError("Must be invoked with Module or module name");var d={};return c&&(d[a.name]=a),b?t(a,d):s(a).then(function(a){for(var b in a)d[a[b].name]=a[b];return d})}},timeout:{enumerable:!0,configurable:!1,get:function(){return v},set:function(a){if(a=Number(a),0/0===a)throw new f("Timeout is not a number");if(100>a)throw new f("Timeout must be greater or equal than 100ms");v=a}},modules:{enumerable:!0,configurable:!1,get:function(){var a={};for(var b in y)a[b]=y[b];return Object.freeze(a)}},module:{enumerable:!0,configurable:!1,value:function(a){return w.resolve(r(a))}},on:{enumerable:!0,configurable:!1,value:function(a,b){if("string"!=typeof a)throw new f("Event name must be a string");if("function"!=typeof b)throw new f("Listener must be a function");return"define"===a&&x.define.push(b),u}}}),b.Esquire)throw new Error("Esquire already defined in global scope");b.Esquire=u;var B=new u;b.esquire=function(){if(0==arguments.length)throw new f("No dependencies/callback specified");var a=n(arguments);return a.function?B.inject(a.arguments,a.function):B.require(1==arguments.length&&"string"==typeof arguments[0]?arguments[0]:a.arguments)}}(function(){try{return window}catch(a){return global}}());
{
"name": "esquire",
"version": "1.1.0",
"version": "1.1.2",
"main": "node-adapter.js",

@@ -5,0 +5,0 @@ "description": "Esquire: asynchronous injection framework",

@@ -1,2 +0,2 @@

'use strict';
'use strict';

@@ -16,2 +16,9 @@ /** @typedef {module:$deferred.Deferred} Deferred */

/* We definitely need an Array.isArray() method */
if (! global.Array.isArray) {
global.Array.isArray = function(arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
}
/*==========================================================================*

@@ -676,3 +683,2 @@ | *======================================================================* |

/* Normalize and validate an array into a array/function object */

@@ -1105,3 +1111,2 @@ function normalize() {

"$$script": { enumerable: false, configurable: false, value: EsquireScript.toString() },
"$$normalize": { enumerable: false, configurable: false, value: normalize },
"$$Promise": { enumerable: false, configurable: false, value: PromiseImpl },

@@ -1156,9 +1161,12 @@ "$$Deferred": { enumerable: false, configurable: false, value: Deferred },

* will be resolved.
* @param {boolean} [includeSelf] - If `true` the module we are resolving
* (which might be a `string`) will also
* be returned amongst its dependencies.
* @returns {Promise} An {@link Promise} to a dictionary of all required
* {@link Module}s keyed by their `name`.
*/
"resolve": { enumerable: true, configurable: false, value: function(module, transitive) {
"resolve": { enumerable: true, configurable: false, value: function(module, transitive, includeSelf) {
if (typeof(module) === 'string') {
return Promise.resolve(moduleOrPromise(module)).then(function(module) {
return Esquire.resolve(module, transitive);
return Esquire.resolve(module, transitive, includeSelf);
})

@@ -1169,12 +1177,16 @@ } else if (!(module instanceof Module)) {

if (transitive) return resolveTransitiveDependencies(module, {});
else return resolveDependencies(module).then(function(dependencies) {
var hash = {};
for (var i in dependencies) {
hash[dependencies[i].name] = dependencies[i];
}
return hash;
});
var hash = {};
if (includeSelf) hash[module.name] = module;
return resolveTransitiveDependencies(module, {});
if (transitive) {
return resolveTransitiveDependencies(module, hash);
} else {
return resolveDependencies(module)
.then(function(dependencies) {
for (var i in dependencies) {
hash[dependencies[i].name] = dependencies[i];
}
return hash;
});
}
}},

@@ -1181,0 +1193,0 @@

@@ -11,2 +11,27 @@ 'use strict';

/* Flatten an array, or array of array, for aguments */
function flatten(iterable) {
if (! iterable) return [];
var array = [];
for (var i = 0; i < iterable.length; i ++) {
var current = iterable[i];
if (typeof(current) === 'string') {
array.push(current);
} else if (typeof(current) === 'function') {
array.push(current);
} else if (Array.isArray(current)) {
array = array.concat(flatten(current));
} else if ((typeof(current) === 'object')
&& (typeof(current.length) === 'number')) {
// JavaScripts' "arguments" is an object, not an array, and on top of
// that PhantomJS' own implementation is not iterable... Workaround!
array = array.concat(flatten(current));
} else {
throw new EsquireError("Invalid dependency: " + JSON.stringify(current));
}
}
return array;
};
/* Loaded scripts are all scripts we already loaded */

@@ -109,3 +134,3 @@ var loadedScripts = {};

/* Create all our script tags */
var locations = Esquire.$$normalize(arguments).arguments;
var locations = flatten(arguments);
var scripts = [];

@@ -112,0 +137,0 @@ for (var i in locations) {

@@ -665,2 +665,12 @@ 'use strict';

promises('should resolve direct dependencies including self', function() {
return Esquire.resolve('module-d', false, true)
.then(function(dependencies) {
expect(dependencies).to.be.an('object');
expect(Object.keys(dependencies).length).to.be.equal(2);
expect(dependencies['module-c']).to.equal(Esquire.modules['module-c']);
expect(dependencies['module-d']).to.equal(Esquire.modules['module-d']);
});
});
promises('should resolve transitive dependencies', function() {

@@ -677,2 +687,14 @@ return Esquire.resolve('module-d', true)

promises('should resolve transitive dependencies including self', function() {
return Esquire.resolve('module-d', true, true)
.then(function(dependencies) {
expect(dependencies).to.be.an('object');
expect(Object.keys(dependencies).length).to.be.equal(4);
expect(dependencies['module-a']).to.equal(Esquire.modules['module-a']);
expect(dependencies['module-b']).to.equal(Esquire.modules['module-b']);
expect(dependencies['module-c']).to.equal(Esquire.modules['module-c']);
expect(dependencies['module-d']).to.equal(Esquire.modules['module-d']);
});
});
promises('should resolve transitive deferred dependencies', function() {

@@ -679,0 +701,0 @@

@@ -0,1 +1,3 @@

'use strict';
/* Disable Karma's error interception */

@@ -2,0 +4,0 @@ window.onerror = null;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc