You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openpower.foundation/themes/openpowerfoundation/static/lib/loader/tools.min.js

1 line
28 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){I=t}function r(t){J=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof H?function(){H(a)}:c()}function s(){var t=0,e=new V(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<G;t+=2){var e=$[t],n=$[t+1];e(n),$[t]=void 0,$[t+1]=void 0}G=0}function f(){try{var t=require,e=t("vertx");return H=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=arguments,r=this,o=new this.constructor(p);void 0===o[et]&&k(o);var i=r._state;return i?!function(){var t=n[i-1];J(function(){return x(i,o,t,r._result)})}():E(r,o,t,e),o}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return it.error=e,it}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){J(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===rt?S(t,e._result):e._state===ot?j(t,e._result):E(e,void 0,function(e){return g(t,e)},function(e){return j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?b(t,n):r===it?(j(t,it.error),it.error=null):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,v()):t(n)?w(e,n,_(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),T(t)}function S(t,e){t._state===nt&&(t._result=e,t._state=rt,0!==t._subscribers.length&&J(T,t))}function j(t,e){t._state===nt&&(t._state=ot,t._result=e,J(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+rt]=n,o[i+ot]=r,0===i&&t._state&&J(T,t)}function T(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?x(n,r,o,i):o(i);t._subscribers.length=0}}function M(){this.error=null}function P(t,e){try{return t(e)}catch(n){return st.error=n,st}}function x(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=void 0,a=void 0;if(i){if(s=P(r,o),s===st?(a=!0,u=s.error,s.error=null):c=!0,n===s)return void j(n,d())}else s=o,c=!0;n._state!==nt||(i&&c?g(n,s):a?j(n,u):t===rt?S(n,s):t===ot&&j(n,s))}function C(t,e){try{e(function(e){g(t,e)},function(e){j(t,e)})}catch(n){j(t,n)}}function O(){return ut++}function k(t){t[et]=ut++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[et]||k(this.promise),B(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&S(this.promise,this._result))):j(this.promise,q())}function q(){return new Error("Array Methods must be provided an Array")}function F(t){return new Y(this,t).promise}function D(t){var e=this;return new e(B(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function K(t){var e=this,n=new e(p);return j(n,t),n}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function N(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(t){this[et]=O(),this._result=this._state=void 0,this._subscribers=[],p!==t&&("function"!=typeof t&&L(),this instanceof U?C(this,t):N())}function W(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=U}var z=void 0;z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var B=z,G=0,H=void 0,I=void 0,J=function(t,e){$[G]=t,$[G+1]=e,G+=2,2===G&&(I?I(a):tt())},Q="undefined"!=typeof window?window:void 0,R=Q||{},V=R.MutationObserver||R.WebKitMutationObserver,X="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,$=new Array(1e3),tt=void 0;tt=X?o():V?s():Z?u():void 0===Q&&"function"==typeof require?f():c();var et=Math.random().toString(36).substring(16),nt=void 0,rt=1,ot=2,it=new M,st=new M,ut=0;return Y.prototype._enumerate=function(t){for(var e=0;this._state===nt&&e<t.length;e++)this._eachEntry(t[e],e)},Y.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=_(t);if(o===l&&t._state!==nt)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===U){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},Y.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===nt&&(this._remaining--,t===ot?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},Y.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){return n._settledAt(rt,e,t)},function(t){return n._settledAt(ot,e,t)})},U.all=F,U.race=D,U.resolve=h,U.reject=K,U._setScheduler=n,U._setAsap=r,U._asap=J,U.prototype={constructor:U,then:l,"catch":function(t){return this.then(null,t)}},U.polyfill=W,U.Promise=U,U.polyfill(),U});"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rocket=void 0;!function(e){var t={months:[{number:"01",name:"january",nameShort:"jan"},{number:"02",name:"february",nameShort:"feb"},{number:"03",name:"march",nameShort:"mar"},{number:"04",name:"april",nameShort:"apr"},{number:"05",name:"may",nameShort:"may"},{number:"06",name:"june",nameShort:"jun"},{number:"07",name:"july",nameShort:"jul"},{number:"08",name:"august",nameShort:"aug"},{number:"09",name:"september",nameShort:"sep"},{number:"10",name:"october",nameShort:"oct"},{number:"11",name:"november",nameShort:"nov"},{number:"12",name:"december",nameShort:"dec"}],prefix:{basic:"rocket-",state:"is-"},state:{alts:{active:"inactive",closed:"open",hidden:"visible",inactive:"active",open:"closed",visible:"hidden"},list:["active","closed","hidden","inactive","open","selected","toggled","visible"]}};t.state.list=t.state.list.map(function(e){return""+t.prefix.state+e}),e.defaults={extensions:{all:["png","jpg","jpeg","json","gif","tif","tiff","bmp","doc","docx","xls","xlsx","pdf","txt","csv"],images:["jpg","jpeg","gif","tif","tiff","bmp","png"]},log:!0,overlay:{backgroundColor:"rgba(56,56,56,0.6)"},regexp:{colour:/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/,date:/^[0-9]{4}-[0-9]{2}-[0-9]{2}/,email:/([\w\.\-]+)@([\w\.\-]+)\.(\w+)/i,password:/^(?=.*\d).{6,}/,selector:{attribute:/([a-z])+(\[)+([a-z])+(=")+([a-zA-Z\-])+("\])/,tag:/^[a-zA-Z]+$/},time:/([01]\d|2[0-3]):([0-5]\d)/,url:/^(https?:\/\/[^\s]+)/},request:{async:!0,data:!1,dataForce:!1,dataType:"json",headers:!1,onStart:!1,onLoading:!1,onSuccess:!1,onError:!1,onComplete:!1,timeout:!1,type:!1,withCredentials:!1},storage:{name:!1,type:"session"}},e.array={clean:function(t){return!!e.is.array(t)&&t.filter(function(e){return null!==e})},make:function(t,n){var r=[];if(!t)return r;var s=e.helper.setDefault(n,!1);return e.is.array(t)&&t.length>0?r=t:e.is.element(t)?r.push(t):e.is.string(t)?r=t.split(" "):e.is.object(t)&&(t=Array.prototype.slice.call(t),e.is.array(t)&&t.length>0&&(r=t)),s?e.array.unique(r):r},unique:function(t){return!!e.is.array(t)&&t.filter(function(e,t,n){return n.indexOf(e)===t})}},e.exists=function(e){return!(void 0===e||null===e||!1===e)},e.has={spaces:function(e){return/\s/.test(e)},class:function(e,t){return(" "+e.className+" ").indexOf(" "+t+" ")>-1},extension:function(t,n){return(e.is.array(n)?n:e.defaults.extensions.all).indexOf(t.split(".").pop().toLowerCase())>-1}},e.is={array:function(e){return"object"===(void 0===e?"undefined":_typeof(e))&&e instanceof Array},boolean:function(e){return"boolean"==typeof e},browser:function(){return!("undefined"==typeof window||"undefined"==typeof navigator||!window.document)},color:function(t){return e.is.colour(t)},colour:function(t){return e.defaults.regexp.colour.test(t)},date:function(t,n){return(n instanceof RegExp?n:e.defaults.regexp.date).test(t)},element:function(t){return!!e.exists(t)&&(t.nodeType&&1===t.nodeType)},email:function(t,n){return(n instanceof RegExp?n:e.defaults.regexp.email).test(t)},function:function(e){return"function"==typeof e},image:function(t,n){return(e.is.array(n)?n:e.defaults.extensions.images).indexOf(t.split(".").pop().toLowerCase())>-1},integer:function(e){return(0^e)===e},json:function(e){if("object"!==(void 0===e?"undefined":_typeof(e)))try{JSON.parse(e)}catch(e){return!1}return!0},number:function(e){return"number"==typeof e&&!isNaN(e)},object:function(e){return"object"===(void 0===e?"undefined":_typeof(e))},password:function(t,n){return(n instanceof RegExp?n:e.defaults.regexp.password).test(t)},string:function(e){return"string"==typeof e},time:function(t,n){return(n instanceof RegExp?n:e.defaults.regexp.time).test(t)},touch:function(){return!!(e.is.browser()&&window&&window.console)&&("ontouchstart"in window||"onmsgesturechange"in window)},url:function(t,n){return(n instanceof RegExp?n:e.defaults.regexp.url).test(t)}},e.classes={add:function(t,n){var r=e.is.string(t)?e.dom.select(t):t;e.classes.executeClasses(r,n,!1)},clear:function(t){var n=e.is.string(t)?e.dom.select(t):[t];if(n.length>0)for(var r=0,s=n.length;r<s;r++)e.exists(n[r])&&n[r].removeAttribute("class")},executeAdd:function(e,t){e.className=e.className.split(" ").concat(t).filter(function(e,t,n){return n.indexOf(e)===t&&""!==e}).toString().replace(/,/g," ")},executeClasses:function(t,n,r){if(!e.exists(t))return!1;var s=e.array.make(t);if(s.length<1)return!1;for(var a=e.array.make(n,!0),o=e.array.make(r,!0),i=a.length>0,l=o.length>0,u=0,c=s.length;u<c;u++)l&&e.classes.executeRemove(s[u],o),i&&e.classes.executeAdd(s[u],a)},executeRemove:function(t,n){t.className=t.className.split(" ").filter(function(e){return n.indexOf(e)<0}).toString().replace(/,/g," "),""===t.className&&e.classes.clear(t)},remove:function(t,n){var r=e.is.string(t)?e.dom.select(t):t;e.classes.executeClasses(r,!1,n)},replace:function(t,n,r){var s=e.is.string(t)?e.dom.select(t):t;e.classes.executeClasses(s,r,n)},toggle:function(t,n){var r=e.is.string(t)?e.dom.select(t):t;if(!e.exists(r)||"string"!=typeof n||e.has.spaces(n))return!1;var s=[];if(e.is.element(r)?s.push(r):e.is.array(r)&&(s=r),s.length<1)return!1;for(var a=0,o=s.length;a<o;a++)e.has.class(s[a],n)?e.classes.executeRemove(s[a],[n]):e.classes.executeAdd(s[a],[n])}},e.clone=function(t){return e.helper.parse.json(JSON.stringify(t))},e.date={basic:function(t,n){var r=t?e.date.transform(t):new Date;if(!r)return!1;var s=!!e.is.boolean(n)&&n,a="";return a+=e.date.day(r.getDate())+" "+e.date.month(r.getMonth()+1)+" "+e.date.year(r.getFullYear()),s&&(a+=", "+e.time.basic(t)),a},day:function(t,n){var r,s=!!e.is.string(n)&&n;if(e.is.number(t))r=t;else if(e.is.string(t)){var a=e.date.transform(t);r=a?a.getDate():t}else r=(new Date).getDate();return!!r&&(r=r.toString(),"long"===s?1===r.length?"0"+r:r:parseInt(r))},safe:function(t,n){var r=t?e.date.transform(t):new Date;if(!r)return!1;var s=!!e.is.boolean(n)&&n,a=r.getFullYear()+"-"+("0"+(r.getMonth()+1)).slice(-2)+"-"+("0"+r.getDate()).slice(-2);return s&&(a+=" "+e.time.full(t)),a},month:function(n,r){var s,a=!!e.is.string(r)&&r;if(e.is.number(n))s=n;else if(e.is.string(n)){var o=e.date.transform(n);s=o?o.getMonth()+1:n}else s=(new Date).getMonth()+1;if(!s)return!1;switch(s=s.toString(),a){case"long":s=1===s.length?"0"+s:s;for(var i=0,l=t.months.length;i<l;i++)if(t.months[i].number==s){s=e.string.uppercase.first(t.months[i].name);break}break;case"number":s=parseInt(s);break;default:s=1===s.length?"0"+s:s;for(var i=0,l=t.months.length;i<l;i++)if(t.months[i].number==s){s=e.string.uppercase.first(t.months[i].nameShort);break}}return s},toISO:function(n,r){var s=void 0===r||r;if(n.indexOf(" ")>-1){for(var a,o=void 0,i=void 0,l=void 0,u=void 0,c=n.split(" "),d=0,f=c.length;d<f;d++)if(e.is.integer(c[d]))2===c[d].length?l=c[d]:4===c[d].length&&(o=c[d]);else if(2===c[d].indexOf(":")&&!0===s)a=c[d];else for(var g=e.string.lowercase.all(c[d]),m=0,p=t.months.length;m<p;m++)if(g===t.months[m].name||g===t.months[m].nameShort){i=t.months[m].number;break}return u=o+"-"+i+"-"+l,!0===s&&void 0!==a&&(u+="T"+a),u}},transform:function(t){function n(e,t){return e.split(t).reverse().join(t)}if(e.is.string(t)){var r=t.indexOf("-"),s=t.indexOf("."),a=t.indexOf("/");2==r?t=n(t,"-"):2==s?t=n(t,"."):2==a&&(t=n(t,"/"))}var o=void 0!==t?new Date(t):new Date;return"Invalid Date"!=o.toString()&&o},year:function(t,n){var r,s=!!e.is.string(n)&&n;if(e.is.number(t))r=t;else if(e.is.string(t)){var a=e.date.transform(t);r=a?a.getFullYear():t}else r=(new Date).getFullYear();if(!r)return!1;switch(r=r.toString(),s){case"long":if(r.length<4){var o=(new Date).getFullYear().toString().substring(0,4-r.length).toString();r=parseInt(o+r)}else r=parseInt(r);break;case"short":r=1===r.length?(o=(new Date).getFullYear().toString().substr(2,1))+r:r.substr(r.length-2,2)}return parseInt(r)}},e.log=function(t){(!e.is.browser()||window&&window.console)&&e.defaults.log&&console.log(t)},e.error=function(t){if((!e.is.browser()||window&&window.console)&&e.is.browser()&&e.defaults.log)throw new Error(t)},e.dimensions={getWidthOrHeight:function(t,n){if(!e.is.browser()||!window||!window.console)return!1;if(!e.is.element(t)&&!e.is.string(t)&&t!==window)return!1;if(e.is.string(n)&&"width"!==n&&"height"!==n)return!1;var r;if(t===window)n=e.string.uppercase.first(n),r=window["inner"+n]||document.documentElement["client"+n]||document.body["client"+n];else{if(e.is.string(t)){if((t=e.dom.select(t)).length<1)return!1;t=t[0]}t.getClientRects().length&&(r=t.getBoundingClientRect()[n]),(r<1||null==r)&&(r=t.style[n])}return parseFloat(r)||0},height:function(t){return e.dimensions.getWidthOrHeight(t,"height")},width:function(t){return e.dimensions.getWidthOrHeight(t,"width")}},e.dom={body:"undefined"!=typeof document&&document.getElementsByTagName("body")[0],element:function(t){if(e.is.string(t))switch(e.get.selector.type(t)){case"gebi":return document.getElementById(t.substring(1));default:return document.querySelector(t)}else{if(e.is.element(t))return t;if(!e.is.object(t))return null;if(t===window||t===document)return t;if(t=Array.prototype.slice.call(t),e.is.array(t)&&t.length>0)return t[0]}},head:"undefined"!=typeof document&&document.getElementsByTagName("head")[0],html:"undefined"!=typeof document&&document.getElementsByTagName("html")[0],ratio:function(e,t){var n=document.querySelectorAll(e);void 0===t&&(t=1);for(var r=n.length-1;r>=0;r--)n[r].style.height=Math.floor(n[r].offsetWidth*t)+"px"},remove:function(t){if(e.exists(t))if(e.is.element(t)&&e.is.element(t.parentNode))t.parentNode.removeChild(t);else if(e.is.string(t))for(var n=e.dom.select(t),r=0,s=n.length;r<s;r++)e.is.element(n[r])&&n[r].parentNode.removeChild(n[r])},select:function(t){var n=[];if(e.is.string(t))n=n.concat(e.dom.selectByString(t));else if(e.is.element(t))n.push(t);else if(e.is.array(t)){for(var r="",s=0,a=t;s<a.length;s++){var o=a[s];e.is.string(o)?r+=o+",":e.is.element(o)&&n.push(o)}r.length>0&&(n=n.concat(e.dom.selectByString(r)))}else e.is.object(t)?t===window||t===document?n=[t]:(t=Array.prototype.slice.call(t),e.is.array(t)&&t.length>0&&(n=t)):t!==window&&t!==document||(n=[t]);return e.array.clean(e.array.unique(n))},selectByString:function(t){var n=[],r=t.split(",").map(e.string.trim).filter(function(e){return e.length>0});if(r.length>0)for(var s=0,a=r.length;s<a;s++)switch(e.get.selector.type(r[s])){case"gebi":n=n.concat(document.getElementById(r[s].substring(1)));break;case"gebtn":n=n.concat(Array.prototype.slice.call(document.getElementsByTagName(r[s])));break;case"qsa":n=n.concat(Array.prototype.slice.call(document.querySelectorAll(r[s])))}return n},title:"undefined"!=typeof document&&document.getElementsByTagName("title")[0],window:"undefined"!=typeof window&&window},e.event={add:function(t,n,r){void 0===n&&(n="click"),e.event.apply(t,n,r,"add")},apply:function(t,n,r,s){void 0===n&&(n="click");var a=e.dom.select(t);if(!(a.length<1))for(var o=0,i=a.length;o<i;o++){var l=a[o];switch(s){case"add":l.addEventListener?l.addEventListener(n,r,!1):l.attachEvent?l.attachEvent("on"+n,r):l["on"+n]=r;break;case"remove":l.removeEventListener?l.removeEventListener(n,r,!1):l.detachEvent?l.detachEvent("on"+n,r):l["on"+n]=r}}},remove:function(t,n,r){void 0===n&&(n="click"),e.event.apply(t,n,r,"remove")}},e.get={extension:function(e){return e.split(".").pop().toLowerCase()},index:function(e){return[].indexOf.call(e.parentNode.children,e)},selector:{type:function(t){var n=!1;return t.indexOf(".")>-1||e.has.spaces(t)||e.defaults.regexp.selector.attribute.test(t)?n="qsa":t.indexOf("#")>-1?n="gebi":e.defaults.regexp.selector.tag.test(t)&&(n="gebtn"),n}}},e.helper={parse:{json:function(t){return e.is.json(t)?JSON.parse(t):t}},setDefault:function(e,t){return(void 0!==e||void 0!==t)&&(void 0!==e&&void 0===t?e:(void 0===e?"undefined":_typeof(e))===(void 0===t?"undefined":_typeof(t))?e:t)}},e.id={add:function(t,n){e.exists(t)&&t.setAttribute("id",n)},remove:function(t){e.exists(t)&&t.removeAttribute("id")}},e.input={disable:function(t){for(var n=e.dom.select(t),r=0,s=n.length;r<s;r++)n[r].disabled=!0},enable:function(t){for(var n=e.dom.select(t),r=0,s=n.length;r<s;r++)n[r].disabled=!1}},e.milliseconds={hours:function(e){return 60*e*60*1e3},minutes:function(e){return 60*e*1e3},seconds:function(e){return 1e3*e}},e.overlay={add:function(){if(!e.is.browser()||!window||!window.console)return!1;var n=document.createElement("div");e.id.add(n,t.prefix.basic+"overlay"),n.setAttribute("style","-webkit-transition: all .4s ease-out 0s;-moz-transition: all .4s ease-out 0s;-ms-transition: all .4s ease-out 0s;transition: all .4s ease-out 0s;"),n.style.display="block",n.style.position="fixed",n.style.top="0",n.style.right="0",n.style.bottom="0",n.style.left="0",n.style.backgroundColor=e.defaults.overlay.backgroundColor,n.style.zIndex="1000",n.style.visibility="hidden",n.style.opacity="0",n.style.filter="alpha(opacity=0)",e.exists(document.getElementById(t.prefix.basic+"overlay"))||e.dom.body.appendChild(n)},hide:function(){if(!e.is.browser()||!window||!window.console)return!1;var t=e.dom.select("#rocket-overlay")[0];t.style.visibility="hidden",t.style.opacity="0",t.style.filter="alpha(opacity=0)"},show:function(){if(!e.is.browser()||!window||!window.console)return!1;var t=e.dom.select("#rocket-overlay")[0];setTimeout(function(){t.style.visibility="visible",t.style.opacity="1",t.style.filter="alpha(opacity=100)"},50)}},e.random={integer:function(e,t){var n="number"==typeof e?e:10,r="number"==typeof t?t:1;return Math.floor(Math.random()*(n-r+1))+r},string:function(t,n){var r=!!e.is.boolean(n)&&n,s="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",a=e.is.number(t)?t:5,o="";r||(s+="0123456789");for(var i=0;i<a;i++)o+=s[Math.floor(Math.random()*s.length)];return o}},e.request={run:function(t){if(e.exists(t)&&e.exists(t.url))return new Promise(function(n,r){var s={url:t.url,async:e.is.string(t.async)?t.async:e.defaults.request.async,data:e.exists(t.data)?t.data:e.defaults.request.data,dataForce:e.is.string(t.dataForce)?t.dataForce:e.defaults.request.dataForce,dataType:e.exists(t.dataType)?t.dataType:e.defaults.request.dataType,headers:e.is.object(t.headers)?t.headers:e.defaults.request.headers,onStart:e.is.function(t.onStart)?t.onStart:e.defaults.request.onStart,onLoading:e.is.function(t.onLoading)?t.onLoading:e.defaults.request.onLoading,onComplete:e.is.function(t.onComplete)?t.onComplete:e.defaults.request.onComplete,timeout:e.is.number(t.timeout)?e.time.seconds(t.timeout):e.defaults.request.timeout,type:e.exists(t.type)?e.string.uppercase.all(t.type):e.defaults.request.type,withCredentials:e.is.boolean(t.withCredentials)?t.withCredentials:e.defaults.request.withCredentials},a=new XMLHttpRequest;if(a.withCredentials=s.withCredentials,s.timeout&&(a.timeout=s.timeout),a.onreadystatechange=function(){switch(this.readyState){case 1:s.onStart&&s.onStart();break;case 3:s.onLoading&&s.onLoading();break;case 4:s.onComplete&&s.onComplete(this),this.status>=200&&this.status<300?n({response:e.helper.parse.json(this.responseText),status:this.status,headers:a.getAllResponseHeaders()}):r({error:e.helper.parse.json(this.responseText),status:this.status,headers:a.getAllResponseHeaders()})}},a.onerror=function(){r({error:"Network Error",status:a.status,headers:a.getAllResponseHeaders()})},s.data&&"body"!==s.dataForce&&("GET"===s.type||"DELETE"===s.type||"queryString"===s.dataForce)){var o="";for(var i in s.data)s.data.hasOwnProperty(i)&&(o+="&"+encodeURIComponent(i)+"="+encodeURIComponent(s.data[i]));s.url=s.url+"?"+e.string.remove.first(o)}if(a.open(s.type,s.url,s.async),s.headers)for(var i in s.headers)s.headers.hasOwnProperty(i)&&a.setRequestHeader(i,s.headers[i]);if(!s.data||"queryString"===s.dataForce||"POST"!==s.type&&"PUT"!==s.type&&"PATCH"!==s.type&&"body"!==s.dataForce)a.send();else if(e.is.json(s.data)){var l;switch(e.string.lowercase.all(s.dataType)){case"form":a.setRequestHeader("Content-type","application/x-www-form-urlencoded");var u="";for(var i in s.data)s.data.hasOwnProperty(i)&&(u+="&"+i+"="+s.data[i]);l=e.string.remove.first(u);break;case"formdata":l=new FormData;for(var i in s.data)s.data.hasOwnProperty(i)&&l.append(i,s.data[i]);break;default:a.setRequestHeader("Content-type","application/json;charset=UTF-8"),l=JSON.stringify(s.data)}a.send(l)}else a.send(s.data)})},delete:function(t){return t.type="DELETE",e.request.run(t)},get:function(t){return t.type="GET",e.request.run(t)},patch:function(t){return t.type="PATCH",e.request.run(t)},post:function(t){return t.type="POST",e.request.run(t)},put:function(t){return t.type="PUT",e.request.run(t)}},function(){if(!e.is.browser()||!window||!window.console)return!1;e.is.touch()||e.has.class(e.dom.html,"rocket-no-touch")||e.classes.add(e.dom.html,"rocket-no-touch"),e.overlay.add()}(),e.state={add:function(n,r){if(!e.exists(n)||t.state.list.indexOf(""+t.prefix.state+r)<0)return!1;e.classes.replace(n,t.state.list,""+t.prefix.state+r)},clear:function(n){if(!e.exists(n))return!1;e.classes.remove(n,t.state.list)},toggle:function(n,r){var s=e.array.make(n),a=""+t.prefix.state+r;if(!e.exists(s)||t.state.list.indexOf(a)<0)return!1;for(var o=t.state.alts[r],i=0,l=s.length;i<l;i++)e.has.class(s[i],a)?(e.state.clear(s[i]),e.state.add(s[i],o)):e.has.class(s[i],""+t.prefix.state+o)?(e.state.clear(s[i]),e.state.add(s[i],r)):e.state.add(s[i],a)}},e.storage={add:function(t,n){if(!e.exists(t))return!1;if(e.is.string(t)){if(!e.exists(n))return!1}else if(!e.is.object(t)||e.is.array(t))return!1;var r=e.storage.getStorageEngine(),s={};e.is.string(t)?s[t]=n:s=t;for(var a in s)s.hasOwnProperty(a)&&(r[a]=s[a]);switch(e.defaults.storage.type){case"local":localStorage.setItem(e.defaults.storage.name,JSON.stringify(r));break;case"session":sessionStorage.setItem(e.defaults.storage.name,JSON.stringify(r))}},clear:function(t){function n(){localStorage.removeItem(e.defaults.storage.name),sessionStorage.removeItem(e.defaults.storage.name)}if(e.is.string(t)){var r=e.storage.get(t);n(),!1!==r&&e.storage.add(t,r)}else if(e.is.array(t)){for(var s={},a=e.storage.getStorageEngine(),o=0,i=t.length;o<i;o++){var l=a[t[o]];e.exists(l)&&(s[t[o]]=l)}n(),Object.keys(s).length>0&&e.storage.add(s)}else n()},get:function(t){if(!e.is.string(t))return!1;var n=e.storage.getStorageEngine();return!!e.exists(n[t])&&n[t]},getStorageEngine:function(){if(!e.defaults.storage.name)return e.log("ROCKET: You have not set the storage name. Provide a name for [Rocket].defaults.storage.name.",!0),!1;var t;switch(e.defaults.storage.type){case"local":t=localStorage.getItem(e.defaults.storage.name);break;case"session":t=sessionStorage.getItem(e.defaults.storage.name)}return t?e.helper.parse.json(t):{}},remove:function(t){if(!e.is.string(t))return!1;var n=e.storage.getStorageEngine();if(!e.exists(n[t]))return!1;switch(delete n[t],e.defaults.storage.type){case"local":localStorage.setItem(e.defaults.storage.name,JSON.stringify(n));break;case"session":sessionStorage.setItem(e.defaults.storage.name,JSON.stringify(n))}}},e.string={format:{bytes:function(e,t){if("number"!=typeof e||0==e)return"0 Byte";var n=t+1||3,r=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],s=Math.floor(Math.log(e)/Math.log(1e3));return parseFloat((e/Math.pow(1e3,s)).toFixed(n))+" "+r[s]}},lowercase:{all:function(t){return e.is.string(t)?t.toLowerCase():t},first:function(t){return e.is.string(t)?t.charAt(0).toLowerCase()+t.slice(1):t},last:function(t){return e.is.string(t)?t.slice(0,t.length-1)+t.charAt(t.length-1).toLowerCase():t}},remove:{first:function(t){return e.is.string(t)?t.substring(1):t},firstAndLast:function(t){return e.is.string(t)?t.substring(1,t.length-1):t},last:function(t){return e.is.string(t)?t.substring(0,t.length-1):t},spaces:function(t){return e.is.string(t)?t.replace(/ /g,""):t}},trim:function(t){return e.is.string(t)?t.replace(/^ /,"").replace(/ +$/,""):t},uppercase:{all:function(t){return e.is.string(t)?t.toUpperCase():t},first:function(t){return e.is.string(t)?t.charAt(0).toUpperCase()+t.slice(1):t},last:function(t){return e.is.string(t)?t.slice(0,t.length-1)+t.charAt(t.length-1).toUpperCase():t}}},e.time={basic:function(t){var n=e.date.transform(t);return!!n&&e.time.leadingZero(n.getHours())+":"+e.time.leadingZero(n.getMinutes())},exact:function(t){var n=e.date.transform(t);return!!n&&e.time.leadingZero(n.getHours())+":"+e.time.leadingZero(n.getMinutes())+":"+e.time.leadingZero(n.getSeconds())+":"+e.time.leadingZero(n.getMilliseconds())},full:function(t){var n=e.date.transform(t);return!!n&&e.time.leadingZero(n.getHours())+":"+e.time.leadingZero(n.getMinutes())+":"+e.time.leadingZero(n.getSeconds())},hours:function(t){var n=e.date.transform(t);return!!n&&e.time.leadingZero(n.getHours())},minutes:function(t){var n=e.date.transform(t);return!!n&&e.time.leadingZero(n.getMinutes())},seconds:function(t){var n=e.date.transform(t);return!!n&&e.time.leadingZero(n.getSeconds())},leadingZero:function(e){return(e<10?"0":"")+e}},e.url={all:function(){var e=window.location,t=e.href,n=t.split("#")[0],r=e.hash.substring(1),s=e.host,a=e.protocol+"//",o="";o=document.getElementsByTagName("base").length>0?document.getElementsByTagName("base")[0].href:a+s;for(var i=e.pathname,l=[],u=i.split("/"),c=0,d=u.length;c<d;c++)u[c].indexOf(".")<0&&""!=u[c]&&l.push(u[c]);return{base:o,current:n,full:t,hash:r,host:s,pathname:i,protocol:a,segments:l}},base:function(){return e.url.all().base},current:function(){return e.url.all().current},full:function(){return e.url.all().full},hash:function(){return e.url.all().hash},host:function(){return e.url.all().host},pathname:function(){return e.url.all().pathname},protocol:function(){return e.url.all().protocol},segments:function(){return e.url.all().segments}}}(Rocket||(Rocket={}));"use strict";"undefined"==typeof exports||exports.nodeType||"undefined"!=typeof module&&!module.nodeType&&module.exports&&(module.exports=Rocket);