diff --git a/dist/bbo.js b/dist/bbo.js deleted file mode 100644 index 813b3b4..0000000 --- a/dist/bbo.js +++ /dev/null @@ -1,3171 +0,0 @@ -/* - * bbo - * +++++++++ A utility belt library for modern JavaScript. +++++++++ - * (c) 2011-2019 tnfe - * https://github.com/tnfe/bbo.git - * version 1.1.10 - */ - -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.bbo = factory()); -}(this, (function () { 'use strict'; - - function _extends() { - _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - }; - - return _extends.apply(this, arguments); - } - - function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); - } - - function _toArray(arr) { - return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest(); - } - - function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); - } - - function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } - } - - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; - } - - function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); - } - - function _iterableToArrayLimit(arr, i) { - if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { - return; - } - - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; - } - - function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); - } - - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); - } - - var version = '1.1.10'; - - var globalObject = null; - - function getGlobalObject() { - if (globalObject !== null) { - return globalObject; - } - /* istanbul ignore next */ - // It's hard to mock the global variables. This code surely works fine. I hope :) - - - if (typeof global === 'object' && global.Object === Object) { - // NodeJS global object - globalObject = global; - } else if (typeof self === 'object' && self.Object === Object) { - // self property from Window object - globalObject = self; - } else { - // Other cases. Function constructor always has the context as global object - // eslint-disable-next-line no-new-func - globalObject = new Function('return this')(); - } - - return globalObject; - } - - /* eslint-disable no-invalid-this */ - var globalObject$1 = getGlobalObject(); - var previousV = globalObject$1.v; - function noConflict() { - if (this === globalObject$1.v) { - globalObject$1.v = previousV; - } - - return this; - } - - function ua(lower) { - return lower ? window.navigator.userAgent.toLowerCase() : window.navigator.userAgent; - } - - /** - * detect IOS - * From https://stackoverflow.com/questions/9038625/detect-if-device-is-ios - * more see: - * https://github.com/madrobby/zepto/blob/master/src/detect.js#files - */ - - function isIOS() { - return /iPad|iPhone|iPod/.test(ua()); - } - - function iPhone() { - return /iPhone/.test(ua()); - } - - function isIPad() { - return /iPad/.test(ua()); - } - - /** - * detect Android - * From https://stackoverflow.com/questions/6031412/detect-android-phone-via-javascript-jquery - */ - - function isAndroid() { - return ua('l').indexOf('android') > -1; - } - - /** - * detect PC / Mobile - * From https://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-mobile-device-in-jquery - */ - - function isMobile() { - return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(ua('l')); - } - - /** - * detect PC / Mobile - * From https://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-mobile-device-in-jquery - */ - - function isPC() { - return !isMobile(); - } - - function isWeixin() { - return /MicroMessenger/i.test(ua('l')); // 微信 - } - - function isNewsApp() { - return /qqnews/.test(ua()); // 腾讯新闻app - } - - function isQQ() { - return /qq\//.test(ua()); // 手机QQ - } - - function mqqbrowser() { - return /mqqbrowser\//.test(ua()); // QQ浏览器 - } - - function isTenvideo() { - return /qqlivebrowser/.test(ua()); // 腾讯视频 - } - - function isIphoneXmodel() { - // X XS, XS Max, XR - var xSeriesConfig = [{ - devicePixelRatio: 3, - width: 375, - height: 812 - }, { - devicePixelRatio: 3, - width: 414, - height: 896 - }, { - devicePixelRatio: 2, - width: 414, - height: 896 - }]; - - if (typeof window !== 'undefined' && window) { - var _window = window, - devicePixelRatio = _window.devicePixelRatio, - screen = _window.screen; - var width = screen.width, - height = screen.height; - return xSeriesConfig.some(item => item.devicePixelRatio === devicePixelRatio && item.width === width && item.height === height); - } - - return false; - } - - /** - * ie version - * From https://codepen.io/gapcode/pen/vEJNZN - * IE 10 ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)'; - * IE 11 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'; - * Edge 12 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0'; - * Edge 13 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586'; - */ - - function ieVersion() { - var uakit = ua(); - var msie = uakit.indexOf('MSIE '); - - if (msie > 0) { - return parseInt(uakit.substring(msie + 5, uakit.indexOf('.', msie)), 10); - } - - var trident = uakit.indexOf('Trident/'); - - if (trident > 0) { - var rv = uakit.indexOf('rv:'); - return parseInt(uakit.substring(rv + 3, uakit.indexOf('.', rv)), 10); - } - - var edge = uakit.indexOf('Edge/'); - - if (edge > 0) { - return parseInt(ua.substring(edge + 5, uakit.indexOf('.', edge)), 10); - } - - return ''; - } - - function isIE() { - return ieVersion() > 0; - } - - /************************************************************************ - * LOGS - *************************************************************************/ - - /** - * log on mobile html body - */ - function log(msg, styles) { - var ele = document.getElementById('_bbo_log'); - - if (ele === null) { - ele = document.createElement('div'); - ele.setAttribute('id', '_bbo_log'); - ele.setAttribute('style', 'position:fixed;left:0;top:0;z-index:9999;padding:4px;'); - document.body.appendChild(ele); - } - - if (styles) { - for (var style in styles) { - if (Object.prototype.hasOwnProperty.call(styles, style)) { - ele.style[style] = styles[style]; - } - } - } - - ele.innerHTML = msg; - } - - /** - * arguments to array - */ - function args($arguments, first) { - return Array.prototype.slice.call($arguments, first || 0); - } - - /************************************************************************ - * Private Method - *************************************************************************/ - - var _cache = { - urls: {}, - logs: {} - }; - /** - * bbo.logs('only id&10', 1, 2); - */ - - function logs() { - if (window.console && window.console.log) { - var onlyId = String(arguments[0]); - var times = parseInt(onlyId.split('&')[1], 10) || 10; - var logsCache = _cache.logs; - if (!logsCache[onlyId]) logsCache[onlyId] = {}; - if (!logsCache[onlyId].once) logsCache[onlyId].once = 1; - - if (logsCache[onlyId].once <= times) { - console.log.apply(console, args(arguments, 1)); - logsCache[onlyId].once++; - } - } - } - - function removeConsole(clear) { - try { - if (!window.console) window.console = {}; - window.console.log = window.console.info = window.console.dir = window.console.warn = window.console.trace = noop; - if (clear === 'clear' && window.console.clear) window.console.clear(); - } catch (e) {} - } - - /** - * a trash object - */ - var trash = { - clear: function () { - for (var key in trash) { - if (key !== 'log' && key !== 'clear') delete trash[key]; - } - }, - log: function () { - for (var key in trash) { - if (key !== 'log' && key !== 'clear') console.log('bbo.trash:: ', key, trash[key]); - } - } - }; - - var noop$1 = () => {}; - - var merge = function () { - for (var _len = arguments.length, objs = new Array(_len), _key = 0; _key < _len; _key++) { - objs[_key] = arguments[_key]; - } - - return [].concat(objs).reduce((acc, obj) => Object.keys(obj).reduce((a, k) => { - acc[k] = acc.hasOwnProperty(k) ? [].concat(acc[k]).concat(obj[k]) : obj[k]; - return acc; - }, {}), {}); - }; - - var over = function () { - for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) { - fns[_key] = arguments[_key]; - } - - return function () { - for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - - return fns.map(fn => fn.apply(null, args)); - }; - }; - - var call = function (key) { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - return context => context[key].apply(context, args); - }; - - function setStyle(el, ruleName, val) { - el.style[ruleName] = val; - } - - function att(el, ruleName, val) { - el.setAttribute(ruleName, val); - } - - /** - * trigger event - * https://stackoverflow.com/questions/2490825/how-to-trigger-event-in-javascript - */ - var trigger = (element, event, eventType) => { - if (document.createEventObject) { - var e = document.createEventObject(); - return element.fireEvent('on' + event, e); - } else { - var _e = document.createEvent(eventType || 'HTMLEvents'); - - _e.initEvent(event, true, true); - - element.dispatchEvent(_e); - } - }; - - function g(i) { - return document.getElementById(i); - } - - function c(t, cn, i, id) { - var el = document.createElement(t); - - if (cn) { - att(el, 'class', cn); - } - - if (i) { - el.innerHTML = i; - } - - if (id) { - att(el, 'id', id); - } - - return el; - } - - /** - * open new url dont not blocked by browser - */ - - var open = href => { - var id = '_bbo_open_proxy'; - var a = g(id) || c('a', id, '', id); - setStyle(a, 'display', 'none'); - att(a, 'href', href); - att(a, 'target', '_blank'); - if (!a.parentNode) document.body.appendChild(a); - trigger(a, 'click', 'MouseEvents'); - }; - - var stopPropagation = e => { - var _e = e || window.event; - - if (_e.stopPropagation) { - _e.stopPropagation(); // W3C - - } else { - _e.cancelBubble = true; // IE - } - }; - - function gc(cn) { - return document.getElementsByClassName(cn); - } - - function query(i) { - return document.querySelector(i); - } - - var show = function () { - for (var _len = arguments.length, el = new Array(_len), _key = 0; _key < _len; _key++) { - el[_key] = arguments[_key]; - } - - return [].concat(el).forEach(e => { - e.style.display = ''; - }); - }; - - var hide = function () { - for (var _len = arguments.length, el = new Array(_len), _key = 0; _key < _len; _key++) { - el[_key] = arguments[_key]; - } - - return [].concat(el).forEach(e => { - e.style.display = 'none'; - }); - }; - - function copyToClipboard(str) { - var el = document.createElement('textarea'); - el.value = str; - att(el, 'readonly', ''); - setStyle(el, 'position', 'absolute'); - setStyle(el, 'left', '-9999px'); - document.body.appendChild(el); - var selected = document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : false; - el.select(); - document.execCommand('copy'); - document.body.removeChild(el); - - if (selected) { - document.getSelection().removeAllRanges(); - document.getSelection().addRange(selected); - } - } - - var elementContains = (parent, child) => parent !== child && parent.contains(child); - - var formToObject = form => Array.from(new FormData(form)).reduce((acc, _ref) => { - var _ref2 = _slicedToArray(_ref, 2), - key = _ref2[0], - value = _ref2[1]; - - return { ...acc, - [key]: value - }; - }, {}); - - var getStyle = (el, ruleName) => getComputedStyle(el)[ruleName]; - - /** - * generate uuid - * From https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript - */ - function uuid() { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - var r = Math.random() * 16 | 0; - var v = c === 'x' ? r : r & 0x3 | 0x8; - return v.toString(16); - }); - } - - /** - * string hash map - * From https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript-jquery - */ - function hash(str) { - var _str = String(str); - - var hash = 0; - var i; - var chr; - if (_str.length === 0) return hash; - - for (i = 0; i < _str.length; i++) { - chr = _str.charCodeAt(i); - hash = (hash << 5) - hash + chr; - hash |= 0; // Convert to 32bit integer - } - - return hash; - } - - /** - * is typeof type - */ - var isTypeof = (val, type) => { - return Object.prototype.toString.call(val).slice(8, -1).toLowerCase() === type; - }; - - /** - * map condition judge - * bbo.judge = bbo.judgment - */ - - function judge(v, vals, strict) { - if (!isTypeof(vals, 'array')) return false; - - for (var key in vals) { - if (strict) { - if (v === vals[key]) return true; - } else { - if (v === vals[key]) return true; - } - } - - return false; - } - - var getType = v => v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase(); - - function construct() { - var classs = arguments[0]; - return new (Function.prototype.bind.apply(classs, arguments))(); - } - - /** - * Gets all the formal parameter names of a function - * https://www.zhihu.com/question/28912825 - */ - function paramsName(fn) { - return /\(\s*([\s\S]*?)\s*\)/.exec(fn.toString())[1].split(/\s*,\s*/); - } - - function loadImages(options) { - var len = 0; - var index = 0; - var curIndex = 0; - var stepTimer = null; - var stepTimeValue = 5; - var percentageValue = 0; - var targetPercent = 0; - var data = options.data || []; - - var step = options.step || function () {}; - - var complete = options.complete || function () {}; - - var needOneStep = options.needOneStep || false; - var path = options.path || false; - - if (typeof data !== 'object' || data.length === 0) { - step(100); - return false; - } - - len = data.length; - - if (path) { - for (var i = len - 1; i > -1; i--) { - data[i] = path + data[i]; // console.info(data[i]); - } - } - - var processStep = function () { - percentageValue++; // console.info("processStep = ",percentageValue) - - step(percentageValue); - - if (percentageValue < targetPercent) { - stepTimer = setTimeout(function () { - processStep(); - }, stepTimeValue); - } else if (targetPercent === 100 && percentageValue === targetPercent) { - if (complete && typeof complete === 'function') { - complete(); - } - } - }; - - function onload() { - curIndex++; - targetPercent = Math.floor(curIndex / len * 100); - - if (needOneStep) { - if (stepTimer) { - clearTimeout(stepTimer); - } - - processStep(); - } else { - step(targetPercent); - - if (targetPercent === 100) { - complete(); - } - } - } - - for (index; index < len; index++) { - var strUrl = data[index]; - new LoadImageItem(strUrl, onload).start(); - } - } - /** - * @name loadImageItem - * @param {string} url - images full url - * @callback cb - called when load image completed - */ - - function LoadImageItem(url, cb) { - var self = this; - self.img = new Image(); // readyState:'complete' or 'loaded' => image has been loaded。 - // for IE6-IE10。 - - var onReadyStateChange = function () { - removeEventHandlers(); - console.info('onReadyStateChange'); - cb(self, 'onReadyStateChange'); - }; - - var onError = function () { - console.info('onError'); - removeEventHandlers(); - cb(self, 'onError'); - }; - - var onLoad = function () { - removeEventHandlers(); - cb(self, 'onload'); - }; - - var removeEventHandlers = function () { - self.unbind('load', onLoad); - self.unbind('readystatechange', onReadyStateChange); - self.unbind('error', onError); - }; - - this.start = function () { - this.bind('load', onLoad); - this.bind('readystatechange', onReadyStateChange); - this.bind('error', onError); - this.img.src = url; - - if (self.img.complete) { - removeEventHandlers(); - cb(this, 'onload'); - } - }; - } - /** - * @name bind - * @description cross-browser event binding - * @param {string} eventName - * @param {function} eventHandler - */ - - - LoadImageItem.prototype.bind = function (eventName, eventHandler) { - if (this.img.addEventListener) { - this.img.addEventListener(eventName, eventHandler, false); - } else if (this.img.attachEvent) { - this.img.attachEvent('on' + eventName, eventHandler); - } - }; - /** - * @name unbind - * @description cross-browser event un-binding - * @param {string} eventName - * @param {function} eventHandler - */ - - - LoadImageItem.prototype.unbind = function (eventName, eventHandler) { - if (this.img.removeEventListener) { - this.img.removeEventListener(eventName, eventHandler, false); - } else if (this.img.detachEvent) { - this.img.detachEvent('on' + eventName, eventHandler); - } - }; - - /* eslint-disable no-invalid-this */ - /** - * load js - * 1. bbo.loadjs("//your_url/a.js",func); - * 2. bbo.loadjs("//your_url/a.js","only_id",func); - */ - - var _cache$1 = { - urls: {}, - logs: {} - }; - - var _insertScripts = function (arr, callback) { - for (var i = 0; i < arr.length; i++) { - _insertScript(arr[i], loaded); - } - - var _index = 0; - - function loaded() { - _index++; - - if (_index >= arr.length) { - callback && callback(); - } - } - }; - - var _insertScript = function (src, callback) { - var script = document.createElement('script'); - script.setAttribute('type', 'text/javascript'); - script.setAttribute('src', src); - document.getElementsByTagName('head')[0].appendChild(script); - - if (/msie/.test(ua('l'))) { - script.onreadystatechange = function () { - if (this.readyState === 'loaded' || this.readyState === 'complete') { - callback(); - } - }; - } else if (/gecko/.test(ua('l'))) { - script.onload = function () { - callback(); - }; - } else { - setTimeout(function () { - callback(); - }, 50); - } - }; - - function loadjs(url, b, c) { - var onlyId; - var callback; - - if (typeof b === 'function') { - onlyId = String(hash(String(url))); - callback = b; - } else if (typeof b === 'undefined') { - onlyId = String(hash(String(url))); - callback = null; - } else { - onlyId = String(b); - callback = c; - } - - if (_cache$1.urls[onlyId]) { - callback && callback(); - } else { - var func = typeof url === 'string' ? _insertScript : _insertScripts; - func.call(this, url, function () { - _cache$1.urls[onlyId] = true; - callback && callback(); - }); - } - } - - /* eslint-disable no-invalid-this */ - - /* - * https://gist.github.com/pete-otaqui/3912307 - */ - function loadcss(url, callback) { - var promise; - var resolutions = []; - var rejections = []; - var resolved = false; - var rejected = false; - var count; - var id; - this.count = this.count ? ++this.count : 1; - count = this.count; - id = 'load-css-' + count; - promise = { - done: function (callback) { - resolutions.push(callback); - if (resolved) callback(); - return promise; - }, - fail: function (callback) { - rejections.push(callback); - if (rejected) callback(); - return promise; - } - }; - - function resolve() { - resolved = true; - - for (var i = 0, len = resolutions.length; i < len; i++) { - resolutions[i](); - } - } - - function reject() { - rejected = true; - - for (var i = 0, len = rejections.length; i < len; i++) { - rejections[i](); - } - } - - var link = document.createElement('link'); - link.setAttribute('id', id); - link.setAttribute('rel', 'stylesheet'); - link.setAttribute('type', 'text/css'); - - if (typeof link.addEventListener !== 'undefined') { - link.addEventListener('load', resolve, false); - link.addEventListener('error', reject, false); - } else if (typeof link.attachEvent !== 'undefined') { - link.attachEvent('onload', function () { - // IE 8 gives us onload for both success and failure - // and also readyState is always "completed", even - // for failure. The only way to see if a stylesheet - // load failed from an external domain is to try and - // access its cssText, and then catch the error - // ... sweet :/ - var cur; - var i = document.styleSheets.length; - - try { - while (i--) { - cur = document.styleSheets[i]; - - if (cur.id === id) { - resolve(); - return; - } - } - } catch (e) {} - - if (!resolved) { - reject(); - } - }); - } - - document.getElementsByTagName('head')[0].appendChild(link); - link.setAttribute('href', url); - return promise; - } - - /** - * to json - */ - // eval hack - - var evil = fn => { - // A variable points to Function, preventing reporting errors - var Fn = Function; - return new Fn('return ' + fn)(); - }; // bbo.toJSON = bbo.tojson = bbo.toJson - - - var toJson = res => { - if (!res) return null; - - if (typeof res === 'string') { - try { - return JSON.parse(res); - } catch (e) { - return evil('(' + res + ')'); - } - } else if (isTypeof(res.json, 'function')) { - return res.json(); - } else { - return res; - } - }; - - /** - * cookie - * https://github.com/jiayi2/onavo/blob/master/onavo.js#L209 - */ - var cookie = () => { - function _extend() { - var i = 0; - var result = {}; - - for (; i < arguments.length; i++) { - var attributes = arguments[i]; - - for (var key in attributes) { - if (Object.prototype.hasOwnProperty.call(key, attributes)) { - result[key] = attributes[key]; - } - } - } - - return result; - } - - function init(converter) { - // #lizard forgives - function api(key, value, attributes) { - var result; - - if (typeof document === 'undefined') { - return; - } - - if (arguments.length > 1) { - var _attributes = _extend({ - path: '/' - }, api.defaults, attributes); - - if (typeof _attributes.expires === 'number') { - var expires = new Date(); - expires.setMilliseconds(expires.getMilliseconds() + _attributes.expires * 864e5); - _attributes.expires = expires; - } - - var _value = value; - - try { - result = JSON.stringify(_value); - - if (/^[\{\[]/.test(result)) { - _value = result; - } - } catch (e) {} - - if (!converter.write) { - _value = encodeURIComponent(String(_value)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); - } else { - _value = converter.write(_value, key); - } - - var _key = encodeURIComponent(String(key)); - - var __key = _key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); - - var ___key = __key.replace(/[\(\)]/g, escape); - - var _cookie = document.cookie = [___key, '=', value, attributes.expires ? '; expires=' + attributes.expires.toUTCString() : '', attributes.path ? '; path=' + attributes.path : '', attributes.domain ? '; domain=' + attributes.domain : '', attributes.secure ? '; secure' : ''].join(''); - - return _cookie; - } - - if (!key) { - result = {}; - } - - var cookies = document.cookie ? document.cookie.split('; ') : []; - var setDecode = /(%[0-9A-Z]{2})+/g; - var i = 0; - - for (; i < cookies.length; i++) { - var parts = cookies[i].split('='); - - var _cookie2 = parts.slice(1).join('='); - - if (_cookie2.charAt(0) === '"') { - _cookie2 = _cookie2.slice(1, -1); - } - - try { - var name = parts[0].replace(setDecode, decodeURIComponent); - _cookie2 = converter.read ? converter.read(_cookie2, name) : converter(_cookie2, name) || _cookie2.replace(setDecode, decodeURIComponent); - - try { - _cookie2 = JSON.parse(_cookie2); - } catch (e) { - console.log(e); - } - - if (key === name) { - result = _cookie2; - break; - } - - if (!key) { - result[name] = _cookie2; - } - } catch (e) {} - } - - return result; - } - - api.set = api; - - api.get = function (key) { - return api.call(api, key); - }; - - api.getJSON = api.getjson = api.getJson = function () { - return api.apply({ - json: true - }, [].slice.call(arguments)); - }; - - api.defaults = {}; - - api.remove = function (key, attributes) { - api(key, '', _extend(attributes, { - expires: -1 - })); - }; - - api.withConverter = init; - return api; - } - - return init(function () {}); - }; - - /** - * setCookie / getCookie / deleteCookie - * From https://stackoverflow.com/questions/1458724/how-do-i-set-unset-cookie-with-jquery/1458728#1458728 - */ - var setCookie = (name, value, option) => { - var longTime = 10; // let path = '; path=/'; - - var val = option && option.raw ? value : encodeURIComponent(value); - var cookie = encodeURIComponent(name) + '=' + val; - - if (option) { - if (option.days) { - var date = new Date(); - var ms = option.days * 24 * 3600 * 1000; - date.setTime(date.getTime() + ms); - cookie += '; expires=' + date.toGMTString(); - } else if (option.hour) { - var _date = new Date(); - - var _ms = option.hour * 3600 * 1000; - - _date.setTime(_date.getTime() + _ms); - - cookie += '; expires=' + _date.toGMTString(); - } else { - var _date2 = new Date(); - - var _ms2 = longTime * 365 * 24 * 3600 * 1000; - - _date2.setTime(_date2.getTime() + _ms2); - - cookie += '; expires=' + _date2.toGMTString(); - } - - if (option.path) cookie += '; path=' + option.path; - if (option.domain) cookie += '; domain=' + option.domain; - if (option.secure) cookie += '; true'; - } - - document.cookie = cookie; - }; - - var getCookie = name => { - var nameEQ = encodeURIComponent(name) + '='; - var ca = document.cookie.split(';'); - - for (var i = 0; i < ca.length; i++) { - var c = ca[i]; - - while (c.charAt(0) === ' ') { - c = c.substring(1, c.length); - } - - if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length)); - } - - return null; - }; - - var deleteCookie = name => { - setCookie(name, '', { - hour: -1 - }); - }; - - var parseCookie = str => str.split(';').map(v => v.split('=')).reduce((acc, v) => { - acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim()); - return acc; - }, {}); - - /** - * String - */ - var string = { - /** - * Remove spaces after removing previous string - */ - trim: str => { - var _str = str.replace(/^\s+/, ''); - - for (var i = str.length - 1; i >= 0; i--) { - if (/\S/.test(str.charAt(i))) { - _str = str.slice(0, i + 1); - break; - } - } - - return _str; - }, - - /** - * Increase by 0 based on string length before string - */ - fillZero: (target, n) => { - var z = new Array(n).join('0'); - var str = z + target; - var result = str.slice(-n); - return result; - }, - - /** - * Long string unique - */ - longUnique: target => { - var json = {}; - - for (var index = 0; index < target.length; index++) { - if (!json[target[index]]) { - json[target[index]] = -1; - } - } - - var longString = ''; - - for (var _index = 0; _index < target.length; _index++) { - if (json[target[_index]]) { - json[target[_index]] = 0; - longString = longString + target[_index]; - } - } - - return longString; - }, - - /** - * Remove the html tags inside the script - */ - stripTags: target => { - return target.replace(/]*>(\S\s*?)<\/script>/gim, '').replace(/<[^>]+>/g, ''); - }, - - /** - * Capitalizes the first letter of a string. - */ - capitalize: target => { - return target.charAt(0).toUpperCase() + target.slice(1).toLowerCase(); - }, - - /** - * DeCapitalizes the first letter of a string. - */ - deCapitalize: function (_ref) { - var _ref2 = _toArray(_ref), - first = _ref2[0], - rest = _ref2.slice(1); - - var upperRest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - return first.toLowerCase() + (upperRest ? rest.join('').toUpperCase() : rest.join('')); - }, - - /** - * en:Returns true if the given string is an absolute URL, false otherwise. - */ - isAbsoluteURL: str => /^[a-z][a-z0-9+.-]*:/.test(str), - - /** - * Creates a new string with the results of calling a provided function - * on every character in the calling string. - */ - mapString: (str, fn) => str.split('').map((c, i) => fn(c, i, str)).join(''), - - /** - * Replaces all but the last num of characters with the specified mask character. - */ - mask: function (cc) { - var num = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4; - var mask = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '*'; - return `${cc}`.slice(-num).padStart(`${cc}`.length, mask); - }, - - /** - * splitLines('This\nis a\nmultiline\nstring.\n') => - * ['This', 'is a', 'multiline', 'string.' , ''] - */ - splitLines: str => str.split(/\r?\n/), - - /** - * _ or - to CamelCase - */ - camelize: target => { - if (target.indexOf('-') < 0 && target.indexOf('_') < 0) { - return target; - } - - return target.replace(/[-_][^-_]/g, function (match) { - return match.charAt(1).toUpperCase(); - }); - }, - - /** - * Turn CamelCase to '_' - */ - underscored: target => { - return target.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toLowerCase(); - }, - - /** - * Turn '_' in a string into '-' - */ - dasherize: function (target) { - return this.underscored(target).replace(/_/g, '-'); - }, - - /** - * Truncates a string up to a specified length. - * The default length is 3, and the truncated symbol defaults '...' - */ - truncate: (str, num) => str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str, - - /** - * Returns the length of a string in bytes. - */ - byteSize: str => new Blob([str]).size, - - /** - * Returns the length of a string in bytes by Unicode (utf-8 utf8 utf-16 utf16) - */ - byteLen: (str, charset) => { - var target = 0; - var charCode; - var i; - var len; - - var _charset = charset ? charset.toLowerCase() : ''; - - if (_charset === 'utf-16' || _charset === 'utf16') { - for (i = 0, len = str.length; i < len; i++) { - charCode = str.charCodeAt(i); - - if (charCode <= 0xffff) { - target += 2; - } else { - target += 4; - } - } - } else { - for (i = 0, len = str.length; i < len; i++) { - charCode = str.charCodeAt(i); - - if (charCode <= 0x007f) { - target += 1; - } else if (charCode <= 0x07ff) { - target += 2; - } else if (charCode <= 0xffff) { - target += 3; - } else { - target += 4; - } - } - } - - return target; - }, - - /** - * Repeat item, times times - */ - repeat: (item, times) => { - var s = item; - var target = ''; - - while (times > 0) { - if (times % 2 === 1) { - target += s; - } - - if (times === 1) { - break; - } - - s += s; // eslint-disable-next-line no-param-reassign - - times = times >> 1; - } - - return target; - }, - - /** - * Item is the end of the target - */ - endsWith: (target, item, ignore) => { - var str = target.slice(-item.length); - return ignore ? str.toLowerCase() === item.toLowerCase() : str === item; - }, - - /** - * Item is the beginning of the target - */ - startsWith: (target, item, ignore) => { - var str = target.slice(0, item.length); - return ignore ? str.toLowerCase() === item.toLowerCase() : str === item; - }, - - /** - * Whether a string contains another string - */ - contains: (target, item) => { - // discuss at: https://locutus.io/golang/strings/Contains - // original by: Kevin van Zonneveld (https://kvz.io) - // example 1: bbo.string.contains('Kevin', 'K') - // returns 1: true - return String(target).indexOf(item) !== -1; - }, - - /** - * XSS string filtering - */ - xssFilter: str => { - return str.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); - }, - index: (s, sep) => { - // discuss at: https://locutus.io/golang/strings/Index - // original by: Kevin van Zonneveld (https://kvz.io) - // example 1: Index('Kevin', 'K') - // returns 1: 0 - // example 2: Index('Kevin', 'Z') - // returns 2: -1 - return String(s).indexOf(sep); - }, - capwords: str => { - // example 1: capwords('kevin van zonneveld') - // returns 1: 'Kevin Van Zonneveld' - // example 2: capwords('HELLO WORLD') - // returns 2: 'HELLO WORLD' - var pattern = /^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g; - return String(str).replace(pattern, function ($1) { - return $1.toUpperCase(); - }); - } - }; - - /************************************************************************ - * localStorage && sessionStorage - * Method for safely supporting localStorage sessionStorage 'setItem' 'getItem' 'removeItem' 'removeAll', - * Some extension method 'has' 'get' adn Store prefix - *************************************************************************/ - var ulocalStorage = window.localStorage; - var ussesionStorage = window.sessionStorage; - - class Storage { - constructor(options) { - var _options$type = options.type, - type = _options$type === void 0 ? 'local' : _options$type, - _options$prefix = options.prefix, - prefix = _options$prefix === void 0 ? 'bbo.storage' : _options$prefix, - _options$message = options.message, - message = _options$message === void 0 ? { - setItem: 'write in', - getItem: 'read', - removeAll: 'remove all', - removeItem: 'remove item' - } : _options$message; - this.prefix = prefix; - this.type = type; - this.message = message; - - if (type === 'local') { - this._storage = ulocalStorage; - } else if (type === 'session') { - this._storage = ussesionStorage; - } - } - - doItem(func, action) { - try { - if (typeof func === 'function') { - return func(); - } - } catch (err) { - this._warn(action); - - return null; - } - - return true; - } - - setItem(key, value) { - if (typeof key === 'object') { - Object.keys(key).forEach((k, index) => { - this.doItem(() => this._storage.setItem(`${this.prefix}.${k}`, JSON.stringify(key[k])), 'setItem'); - }); - } else { - this.doItem(() => this._storage.setItem(`${this.prefix}.${key}`, JSON.stringify(value)), 'setItem'); - } - } - - has() { - for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) { - keys[_key] = arguments[_key]; - } - - return keys.every((key, index) => this._storage.getItem(`${this.prefix}.${key}`)); - } - - get() { - var result = {}; - - for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - keys[_key2] = arguments[_key2]; - } - - keys.forEach((key, index) => { - if (`${this._storage.getItem(`${this.prefix}.${key}`)}` !== 'null') { - try { - result[key] = JSON.parse(this._storage.getItem(`${this.prefix}.${key}`)); - } catch (err) { - console.warn(this._warn('getItem')); - } - } - }); - return result; - } - - getItem(key) { - return this.doItem(() => JSON.parse(this._storage.getItem(`${this.prefix}.${key}`)), 'getItem'); - } - - removeAll() { - Object.keys(this._storage).forEach(k => { - if (string.contains(k, this.prefix)) { - this._remove(`${k}`); - } - }); - } - - removeItem() { - for (var _len3 = arguments.length, keys = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - keys[_key3] = arguments[_key3]; - } - - console.log(keys); - keys.forEach((key, index) => this.doItem(() => this._storage.removeItem(`${this.prefix}.${key}`), 'removeItem')); - } - - _warn(action) { - var message = this.message; - console.warn(`Unable to ${message[action] || ''} ${this.type} Storage`); - } - - _remove(keys) { - this.doItem(() => this._storage.removeItem(`${keys}`), 'removeItem'); - } - - } - - var storage = (_ref) => { - var type = _ref.type, - prefix = _ref.prefix; - return new Storage({ - type: type, - prefix: prefix - }); - }; - - /** - * getUrlParam / deleteUrlParam - * From https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript - */ - var getUrlParam = function (name) { - var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.href; - name.replace(/[\[\]]/g, '\\$&'); - var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'); - var results = regex.exec(url); - if (!results) return null; - if (!results[2]) return ''; - return decodeURIComponent(results[2].replace(/\+/g, ' ')); - }; - - /** - * setUrlParam - * From https://stackoverflow.com/questions/5999118/add-or-update-query-string-parameter - */ - var setUrlParam = function (key, value) { - var url = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window.location.href; - var re = new RegExp('([?|&])' + key + '=.*?(&|#|$)', 'i'); - - if (url.match(re)) { - return url.replace(re, '$1' + key + '=' + encodeURIComponent(value) + '$2'); - } else { - var hash = ''; - - if (url.indexOf('#') !== -1) { - hash = url.replace(/.*#/, '#'); - url.replace(/#.*/, ''); - } - - var separator = url.indexOf('?') !== -1 ? '&' : '?'; - return url + separator + key + '=' + encodeURIComponent(value) + hash; - } - }; - - /** - * getUrlParam / deleteUrlParam - * From https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript - */ - var deleteUrlParam = function (param) { - var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.href; - // prefer to use l.search if you have a location/link object - var urlparts = url.split('?'); - - if (urlparts.length >= 2) { - var prefix = encodeURIComponent(param) + '='; - var pars = urlparts[1].split(/[&;]/g); // reverse iteration as may be destructive - - for (var i = pars.length; i-- > 0;) { - // idiom for string.startsWith - if (pars[i].lastIndexOf(prefix, 0) !== -1) { - pars.splice(i, 1); - } - } - - return urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : ''); - } else { - return url; - } - }; - - var objectParam = arr => { - var str = ''; - - if (Array.isArray(arr)) { - str = arr.map(function (item) { - return item.name + '=' + item.value; - }).join('&'); - } else { - str = objectParam(objectBigParam(arr)); - } - - return str; - }; - - var objectBigParam = obj => { - var arr = []; - Object.keys(obj).forEach(function (k) { - if (Array.isArray(obj[k])) { - arr = arr.concat(obj[k].map(function (v) { - return { - name: k, - value: v - }; - })); - } else { - arr.push({ - name: k, - value: obj[k] - }); - } - }); - return arr; - }; - - var httpGet = function (url, callback) { - var err = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : console.error; - var request = new XMLHttpRequest(); - request.open('GET', url, true); - - request.onload = () => callback(request.responseText); - - request.onerror = () => err(request); - - request.send(); - }; - - // eslint-disable-next-line max-params - var httpPost = function (url, data, callback) { - var err = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : console.error; - var request = new XMLHttpRequest(); - request.open('POST', url, true); - request.setRequestHeader('Content-type', 'application/json; charset=utf-8'); - - request.onload = () => callback(request.responseText); - - request.onerror = () => err(request); - - request.send(data); - }; - - /** - * setInterval func fix times - * https://stackoverflow.com/questions/2956966/javascript-telling-setinterval-to-only-fire-x-amount-of-times - */ - - function setTimesout() { - var func = arguments[0]; - var delay = arguments[1] === undefined ? 0 : parseFloat(arguments[1]); - var times = arguments[2] === undefined ? 1 : parseInt(arguments[2], 10); - - var _args = arguments.length > 3 ? args(arguments, 3) : null; - - var target = { - index: 0, - times: times, - over: false - }; - var id = setInterval(function () { - target.index++; - - if (target.index > times) { - clearInterval(id); - } else { - if (target.index === times) target.over = true; - func.apply(target, _args); - } - }, delay); - return id; - } - - function clearTimesout(id) { - clearInterval(id); - } - - function fill0(num) { - var _num = parseFloat(num); - - return _num < 10 ? '0' + _num : _num; - } - - /** - * getDate - * https://stackoverflow.com/questions/1531093/how-do-i-get-the-current-date-in-javascript - */ - - var getDate = (d1, d2) => { - var today = new Date(); - var dd = today.getDate(); - var mm = today.getMonth() + 1; - var yyyy = today.getFullYear(); - var hh = today.getHours(); - var ms = today.getMinutes(); - var ss = today.getSeconds(); - dd = fill0(dd); - mm = fill0(mm); - hh = fill0(hh); - ms = fill0(ms); - ss = fill0(ss); - - var _d1 = d1 || '/'; - - var _d2 = d2 || ':'; - - return yyyy + _d1 + mm + _d1 + dd + ' ' + hh + _d2 + ms + _d2 + ss; - }; - - /** - * @ zh_cn - * @desc 格式化${startTime}距现在的已过时间 - * @param {Date} startTime - * @return {String} - */ - var formatPassTime = startTime => { - var currentTime = Date.parse(new Date()); - var time = currentTime - startTime; - var day = parseInt(time / (1000 * 60 * 60 * 24), 10); - var hour = parseInt(time / (1000 * 60 * 60), 10); - var min = parseInt(time / (1000 * 60), 10); - var month = parseInt(day / 30, 10); - var year = parseInt(month / 12, 10); - if (year) return year + '年前'; - if (month) return month + '个月前'; - if (day) return day + '天前'; - if (hour) return hour + '小时前'; - if (min) return min + '分钟前';else return '刚刚'; - }; - - /** - * @ zh_cn - * @desc 格式化现在距${endTime}的剩余时间 - * @param {Date} endTime - * @return {String} - */ - var formatRemainTime = endTime => { - var startDate = new Date(); // 开始时间 - - var endDate = new Date(endTime); // 结束时间 - - var t = endDate.getTime() - startDate.getTime(); // 时间差 - - var d = 0; - var h = 0; - var m = 0; - var s = 0; - - if (t >= 0) { - d = Math.floor(t / 1000 / 3600 / 24); - h = Math.floor(t / 1000 / 60 / 60 % 24); - m = Math.floor(t / 1000 / 60 % 60); - s = Math.floor(t / 1000 % 60); - } - - return d + '天 ' + h + '小时 ' + m + '分钟 ' + s + '秒'; - }; - - /** - * @ en - * bbo.formatDuration(1001); // '1 second, 1 millisecond' - * bbo.formatDuration(34325055574); // '397 days, 6 hours, 44 minutes, 15 seconds, 574 milliseconds' - */ - var formatDuration = ms => { - // eslint-disable-next-line no-param-reassign - if (ms < 0) ms = -ms; - var time = { - day: Math.floor(ms / 86400000), - hour: Math.floor(ms / 3600000) % 24, - minute: Math.floor(ms / 60000) % 60, - second: Math.floor(ms / 1000) % 60, - millisecond: Math.floor(ms) % 1000 - }; - return Object.entries(time).filter(val => val[1] !== 0).map((_ref) => { - var _ref2 = _slicedToArray(_ref, 2), - key = _ref2[0], - val = _ref2[1]; - - return `${val} ${key}${val !== 1 ? 's' : ''}`; - }).join(', '); - }; - - var floor = function (n) { - var m = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - return Math.floor(n * Math.pow(10, m)) / Math.pow(10, m); - }; - - var chainAsync = fns => { - var curr = 0; - var last = fns[fns.length - 1]; - - var next = () => { - var fn = fns[curr++]; - fn === last ? fn() : fn(next); - }; - - next(); - }; - - /** - * https://locutus.io/php/ - */ - // eslint-disable-next-line max-params - var numberFormat = (number, decimals, decPoint, thousandsSep) => { - // example 1: bbo.math.numberFormat(1234.56) - // returns 1: '1,235' - // example 2: bbo.math.numberFormat(1234.56, 2, ',', ' ') - // returns 2: '1 234,56' - // example 3: bbo.math.numberFormat(1234.5678, 2, '.', '') - // returns 3: '1234.57' - // example 4: bbo.math.numberFormat(67, 2, ',', '.') - // returns 4: '67,00' - // example 5: bbo.math.numberFormat(1000) - // returns 5: '1,000' - // example 6: bbo.math.numberFormat(67.311, 2) - // returns 6: '67.31' - // example 7: bbo.math.numberFormat(1000.55, 1) - // returns 7: '1,000.6' - // example 8: bbo.math.numberFormat(67000, 5, ',', '.') - // returns 8: '67.000,00000' - // example 9: bbo.math.numberFormat(0.9, 0) - // returns 9: '1' - // example 10: bbo.math.numberFormat('1.20', 2) - // returns 10: '1.20' - // example 11: bbo.math.numberFormat('1.20', 4) - // returns 11: '1.2000' - // example 12: bbo.math.numberFormat('1.2000', 3) - // returns 12: '1.200' - // example 13: bbo.math.numberFormat('1 000,50', 2, '.', ' ') - // returns 13: '100 050.00' - // example 14: bbo.math.numberFormat(1e-8, 8, '.', '') - // returns 14: '0.00000001' - var _number = String(number).replace(/[^0-9+\-Ee.]/g, ''); - - var _decimals = decimals; - var n = !isFinite(Number(_number)) ? 0 : Number(_number); - var prec = !isFinite(Number(_decimals)) ? 0 : Math.abs(_decimals); - var sep = typeof thousandsSep === 'undefined' ? ',' : thousandsSep; - var dec = typeof decPoint === 'undefined' ? '.' : decPoint; - var s = ''; - - var toFixedFix = function (n, prec) { - if (String(n).indexOf('e') === -1) { - return Number(Math.round(n + 'e+' + prec) + 'e-' + prec); - } else { - var arr = String(n).split('e'); - var sig = ''; - - if (Number(arr[1]) + prec > 0) { - sig = '+'; - } - - return Number(Math.round(Number(arr[0]) + 'e' + sig + (Number(arr[1]) + prec)) + 'e-' + prec).toFixed(prec); - } - }; // @todo: for IE parseFloat(0.55).toFixed(0) = 0; - - - s = (prec ? toFixedFix(n, prec).toString() : String(Math.round(n))).split('.'); - - if (s[0].length > 3) { - s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); - } - - if ((s[1] || '').length < prec) { - s[1] = s[1] || ''; - s[1] += new Array(prec - s[1].length + 1).join('0'); - } - - return s.join(dec); - }; - - function randomColor() { - return '#' + ('00000' + (Math.random() * 0x1000000 << 0).toString(16)).slice(-6); - } - - // bbo.randomFromA2B = bbo.randomA2B - var randomA2B = (a, b, int) => { - var result = Math.random() * (b - a) + a; - return int ? Math.floor(result) : result; - }; - - var randomKey = function () { - var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32; - - /** Removed confusing characters 'oOLl,9gq,Vv,Uu,I1' **/ - var possible = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; - var key = ''; - - for (var i = 0; i < len; i++) { - key += possible.charAt(Math.floor(Math.random() * possible.length)); - } - - return key; - }; - - /** - * lock touch in mobile phone - */ - var lockTouch = () => { - document.addEventListener('touchmove', function (e) { - e.preventDefault(); - }, !1); - document.addEventListener('touchstart', preventDefault, !1); - document.addEventListener('touchend', preventDefault, !1); - - function not(e, tag) { - return e.target.tagName !== tag.toUpperCase() && e.target.tagName !== tag.toLowerCase(); - } - - function preventDefault(e) { - if (not(e, 'input') && not(e, 'textarea') && not(e, 'select') && not(e, 'menus')) e.preventDefault(); - } - }; - - /** - * Check image size - * @param {(Object|String)} image - image information,allow File Object or Data URLs - * @param {Object} [options={}] - Check options - * @param {Number} [options.width] - Check width - * @param {Number} [options.height] - Check height - * @param {Number} [deviation=0] - Allowable deviation - */ - var checkImageSize = function (image, options) { - var deviation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - return new Promise((resolve, reject) => { - /** - * Check type of image - */ - if (image instanceof File) { - var reader = new FileReader(); - - reader.onload = function () { - checkSize(this.result); - }; - - reader.readAsDataURL(image); - } else if (typeof image === 'string') { - checkSize(image); - } - /** - * Check picture size - * @param {String} data:Data URL - */ - - - function checkSize(data) { - var virtualImage = new Image(); - virtualImage.src = data; - - virtualImage.onload = function () { - var width = this.naturalWidth; - var height = this.naturalHeight; - - if (options.width && Math.abs(options.width - width) > deviation) { - resolve(false); - } - - if (options.height && Math.abs(options.height - height) > deviation) { - resolve(false); - } - - resolve(true); - }; - } - }); - }; - - /** - * Image optimization - * Gif images are not supported - * @param {(Object|String)} - image ,supported File Object or Data URLs - * @param {Number} [quality = 0.9] - Image quality, between 0 - 1, only image/jpeg or image/webp is accept. - * @param {Object} [options = {}] - Image options - * @param {Number} [options.maxWidth = 1920] - The maximum width of the output picture. - * If the original width of the picture is less than this width, the original size picture is returned. - * If the original width of the picture is greater than the width, the picture scaled to the size is returned. - * @param {String} [options.mimeType] - Output image type,Types of MIME. - * @returns {Object} Promise , resolve Function parameters are optimized pictures Blob Object, - * If the output type is image/gif,Then return as is image Parameter content. - */ - var imageOptimization = function (image) { - var quality = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.9; - - var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, - _ref$maxWidth = _ref.maxWidth, - maxWidth = _ref$maxWidth === void 0 ? 1920 : _ref$maxWidth, - mimeType = _ref.mimeType; - - return new Promise((resolve, reject) => { - if (image instanceof File) { - var reader = new FileReader(); - - reader.onload = function () { - toBlob(this.result); - }; - - reader.readAsDataURL(image); - } else if (typeof image === 'string') { - toBlob(image); - } - /** - * To Blob - * @param {String} data - Image: Data URL - */ - - - function toBlob(data) { - var type = data.match(/data:([^;,]+)/); - - if (Array.isArray(type)) { - var outputType = mimeType ? mimeType : type[1]; - - if (outputType === 'image/gif') { - return resolve(image); - } - - var virtualImage = new Image(); - virtualImage.src = data; - - virtualImage.onload = function () { - var width = this.naturalWidth; - var height = this.naturalHeight; - - if (width > maxWidth) { - height = Math.round(maxWidth * height / width); - width = maxWidth; - } - - var canvas = document.createElement('canvas'); - canvas.width = width; - canvas.height = height; - var context = canvas.getContext('2d'); - context.drawImage(this, 0, 0, width, height); - canvas.toBlob(blob => { - resolve(blob); - }, mimeType ? mimeType : type[1], quality); - }; - } else { - reject(new Error('Non-picture type Data URLs')); - } - } - }); - }; - - function getTag(src) { - return Object.prototype.toString.call(src); - } - - function hasOwnProperty$1(obj, keyName) { - return Object.prototype.hasOwnProperty.call(obj, keyName); - } - - function isObject(obj) { - return getTag(obj) === '[object Object]'; - } - - function isArray(arr) { - return getTag(arr) === '[object Array]'; - } - - function isString(str) { - return getTag(str) === '[object String]'; - } - - function isBoolean(bool) { - return getTag(bool) === '[object Boolean]'; - } - - function isNumber(number) { - return getTag(number) === '[object Number]'; - } - - function isMap(map) { - return getTag(map) === '[object Map]'; - } - - function isSet(set) { - return getTag(set) === '[object Set]'; - } - - function isFunction(func) { - return getTag(func) === '[object Function]'; - } - - var isEmpty = val => val == null || !(Object.keys(val) || val).length; - - /* eslint-disable no-self-compare */ - function is(x, y) { - // inlined Object.is polyfill to avoid requiring consumers ship their own - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - if (x === y) { - // Steps 1-5, 7-10 - // Steps 6.b-6.e: +0 != -0 - // Added the nonzero y check to make Flow happy, but it is redundant - return x !== 0 || y !== 0 || 1 / x === 1 / y; - } else { - // Step 6.a: NaN == NaN - return x !== x && y !== y; - } - } - - function isShallowEqual(objA, objB) { - if (is(objA, objB)) { - return true; - } - - if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { - return false; - } - - var keysA = Object.keys(objA); - var keysB = Object.keys(objB); - - if (keysA.length !== keysB.length) { - return false; - } - - var i = 0; - - while (i < keysA.length) { - if (!hasOwnProperty(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { - return false; - } - - i += 1; - } - - return true; - } - - /* eslint-disable max-params */ - var charCodeOfDot = '.'.charCodeAt(0); - var reEscapeChar = /\\(\\)?/g; - var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - function stringToPath(string) { - var result = []; - - if (string.charCodeAt(0) === charCodeOfDot) { - result.push(''); - } - - string.replace(rePropName, (match, expression, quote, subString) => { - var key = match; - - if (quote) { - key = subString.replace(reEscapeChar, '$1'); - } else if (expression) { - key = expression.trim(); - } - - result.push(key); - }); - return result; - } - - function toPath(value) { - if (!isString(value)) { - return []; - } - - return stringToPath(value); - } - - /* eslint-disable eqeqeq */ - function has(object, path) { - if (!isObject(object)) { - return false; - } - - if (!isArray(path)) { - path = toPath(path); - } - - var index = -1; - var length = path.length; - var result = false; - - while (++index < length) { - var key = String(path[index]); - - if (!(result = object != null && hasOwnProperty(object, key))) { - break; - } - - object = object[key]; - } // eslint-disable-next-line eqeqeq - - - if (result || ++index != length) { - return result; - } - - return false; - } - - function reduce(src, func) { - var i = 0; - var acc = arguments[2]; - - if (isArray(src)) { - if (arguments.length !== 3) { - acc = src[0]; - } - - while (i < src.length) { - acc = func(acc, src[i], i, src); - i += 1; - } - - return acc; - } else if (isObject(src)) { - var keys = Object.keys(src); - - if (arguments.length !== 3) { - acc = src[keys[0]]; - } - - while (i < keys.length) { - var key = keys[i]; - acc = func(acc, src[key], key, src); - i += 1; - } - - return acc; - } - - return acc; - } - - function forEach(src, func) { - var i = 0; - - if (isArray(src)) { - while (i < src.length) { - var rst = func(src[i], i, src); - - if (rst === false) { - break; - } - - i += 1; - } - } else if (isObject(src)) { - var keys = Object.keys(src); - - while (i < keys.length) { - var key = keys[i]; - - var _rst = func(src[key], key, src); - - if (_rst === false) { - break; - } - - i += 1; - } - } - } - - function map(src, func) { - var rst = []; - var i = 0; - - if (isArray(src)) { - while (i < src.length) { - rst.push(func(src[i], i, src)); - i += 1; - } - } else if (isObject(src)) { - var keys = Object.keys(src); - - while (i < keys.length) { - var key = keys[i]; - rst.push(func(src[key], key, src)); - i += 1; - } - } - - return rst; - } - - function find(src, func) { - // eslint-disable-next-line no-undef-init - var rst = undefined; - forEach(src, (item, key, obj) => { - if (isFunction(func)) { - if (func(item, key, obj) === true) { - rst = item; - return false; - } - } else if (is(item, func)) { - rst = item; - return false; - } else if (isObject(item) && isObject(func)) { - var subEqual = true; - forEach(func, (v, k) => { - subEqual = isShallowEqual(item[k], v); - return subEqual; - }); - - if (subEqual) { - rst = item; - return false; - } - } - }); - return rst; - } - - function findIndex(src, func) { - var rst = -1; - forEach(src, (item, index, obj) => { - if (isFunction(func)) { - if (func(item, index, obj) === true) { - rst = index; - return false; - } - } else if (is(item, func)) { - rst = index; - return false; - } else if (isObject(item) && isObject(func)) { - var subEqual = true; - forEach(func, (v, k) => { - subEqual = isShallowEqual(item[k], v); - return subEqual; - }); - - if (subEqual) { - rst = index; - return false; - } - } - }); - return rst; - } - - /* eslint-disable no-param-reassign */ - function get(object, path, defaultValue) { - if (object == null) { - return defaultValue; - } - - if (!Array.isArray(path)) { - var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; - var reIsPlainProp = /^\w*$/; - - var isKey = function (value, object) { - var type = typeof value; - - if (type == 'number' || type == 'boolean' || value == null) { - return true; - } - - return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); - }; - - if (isKey(path, object)) { - path = [path]; - } else { - path = stringToPath(path); - } - } - - var index = 0; - var length = path.length; - - while (object != null && index < length) { - object = object[path[index]]; - index += 1; - } - - if (index && index === length) { - return object === undefined ? defaultValue : object; - } else { - return defaultValue; - } - } - - /* eslint-disable no-implicit-coercion */ - function debounce(func, wait, options) { - var lastArgs; - var lastThis; - var maxWait; - var result; - var timerId; - var lastCallTime; - var lastInvokeTime = 0; - var leading = false; - var maxing = false; - var trailing = true; // Bypass `requestAnimationFrame` by explicitly setting `wait=0`. - - var useRAF = !wait && wait !== 0 && typeof requestAnimationFrame === 'function'; - - if (typeof func !== 'function') { - throw new TypeError('Expected a function'); - } - - wait = +wait || 0; - - if (isObject(options)) { - leading = !!options.leading; - maxing = 'maxWait' in options; - maxWait = maxing ? Math.max(+options.maxWait || 0, wait) : maxWait; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - - function invokeFunc(time) { - var args = lastArgs; - var thisArg = lastThis; - lastArgs = lastThis = undefined; - lastInvokeTime = time; - result = func.apply(thisArg, args); - return result; - } - - function startTimer(pendingFunc, wait) { - if (useRAF) { - cancelAnimationFrame(timerId); - return requestAnimationFrame(pendingFunc); - } - - return setTimeout(pendingFunc, wait); - } // eslint-disable-next-line no-unused-vars - - function leadingEdge(time) { - // Reset any `maxWait` timer. - lastInvokeTime = time; // Start the timer for the trailing edge. - - timerId = startTimer(timerExpired, wait); // Invoke the leading edge. - - return leading ? invokeFunc(time) : result; - } - - function remainingWait(time) { - var timeSinceLastCall = time - lastCallTime; - var timeSinceLastInvoke = time - lastInvokeTime; - var timeWaiting = wait - timeSinceLastCall; - return maxing ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; - } - - function shouldInvoke(time) { - var timeSinceLastCall = time - lastCallTime; - var timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the - // trailing edge, the system time has gone backwards and we're treating - // it as the trailing edge, or we've hit the `maxWait` limit. - - return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; - } - - function timerExpired() { - var time = Date.now(); - - if (shouldInvoke(time)) { - return trailingEdge(time); - } // Restart the timer. - - - timerId = startTimer(timerExpired, remainingWait(time)); - } - - function trailingEdge(time) { - timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - - if (trailing && lastArgs) { - return invokeFunc(time); - } - - lastArgs = lastThis = undefined; - return result; - } - - function debounced() { - var time = Date.now(); - var isInvoking = shouldInvoke(time); - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - lastArgs = args; // eslint-disable-next-line no-invalid-this - - lastThis = this; - lastCallTime = time; - - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); - } - - if (maxing) { - // Handle invocations in a tight loop. - timerId = startTimer(timerExpired, wait); - return invokeFunc(lastCallTime); - } - } - - if (timerId === undefined) { - timerId = startTimer(timerExpired, wait); - } - - return result; - } - - return debounced; - } - - function throttle(func, wait, options) { - var leading = true; - var trailing = true; - - if (typeof func !== 'function') { - throw new TypeError('Expected a function'); - } - - if (isObject(options)) { - leading = 'leading' in options ? !!options.leading : leading; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - - return debounce(func, wait, { - leading: leading, - trailing: trailing, - maxWait: wait - }); - } - - // arr.reduce((acc, curr) => (curr in obj && (acc[curr] = obj[curr]), acc), {}); - // Only pick the first-level key, - - function pick(object) { - if (object === null || object === undefined) { - return {}; - } - - for (var _len = arguments.length, paths = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - paths[_key - 1] = arguments[_key]; - } - - return reduce(paths, (rst, path) => { - if (isArray(path)) { - forEach(path, item => { - if (has(object, item)) { - rst[item] = object[item]; - } - }); - } else { - if (has(object, path)) { - rst[path] = object[path]; - } - } - - return rst; - }, {}); - } - - /* eslint-disable no-return-assign */ - - /* eslint-disable no-sequences */ - var omit = (obj, arr) => Object.keys(obj).filter(k => !arr.includes(k)).reduce((acc, key) => (acc[key] = obj[key], acc), {}); - - /** - * Array - */ - var array = { - /** - * Returns all unique values of an array. - */ - unique: arr => _toConsumableArray(new Set(arr)), - - /** - * Returns all unique values of an array, based on a provided comparator function. - */ - uniqueBy: (arr, fn) => arr.reduce((acc, v) => { - if (!acc.some(x => fn(v, x))) acc.push(v); - return acc; - }, []), - - /** - * Remove duplicates from an array of objects - * https://stackoverflow.com/questions/2218999/remove-duplicates-from-an-array-of-objects-in-javascript - */ - uniqueFrom: (arr, target) => { - return Object.values(arr.reduce((acc, cur) => _extends(acc, { - [cur[target]]: cur - }), {})); - }, - - /** - * Returns a random element from an array. - */ - random: arr => arr[Math.floor(Math.random() * arr.length)], - - /** - * Gets n random elements at unique keys from array up to the size of array. - */ - randomSize: function (_ref) { - var _ref2 = _toArray(_ref), - arr = _ref2.slice(0); - - var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; - var m = arr.length; - - while (m) { - var i = Math.floor(Math.random() * m--); - var _ref3 = [arr[i], arr[m]]; - arr[m] = _ref3[0]; - arr[i] = _ref3[1]; - } - - return arr.slice(0, n); - }, - - /** - * Randomizes the order of the values of an array, returning a new array. - */ - shuffle: (_ref4) => { - var _ref5 = _toArray(_ref4), - arr = _ref5.slice(0); - - var m = arr.length; - - while (m) { - var i = Math.floor(Math.random() * m--); - var _ref6 = [arr[i], arr[m]]; - arr[m] = _ref6[0]; - arr[i] = _ref6[1]; - } - - return arr; - }, - - /** - * Returns true if the element has the specified Array, false otherwise. - */ - contains: (target, item) => { - return target.indexOf(item) > -1; - }, - - /** - * Returns true if all the elements values are included in arr, false otherwise. - */ - includesAll: (arr, values) => values.every(v => arr.includes(v)), - - /** - * Returns true if at least one element of values is included in arr , false otherwise. - */ - includesAny: (arr, values) => values.some(v => arr.includes(v)), - - /** - * Remove the element specified by parameter 2 in parameter 1 and return Boolean - */ - removeAt: function (target, index) { - return !!target.splice(index, 1).length; - }, - - /** - * Remove parameter 2 in parameter 1 and return boolean - */ - remove: function (target, item) { - var index = target.indexOf(item); - return index > -1 ? this.removeAt(target, index) : false; - }, - - /** - * Removes undefined and Null from an array. - */ - compact: target => { - return target.filter(item => { - return item !== undefined; - }); - }, - - /** - * Removes falsy values from an array. - * (false, null, 0, "", undefined, and NaN). - */ - compactAll: arr => arr.filter(Boolean), - - /** - * Get the attribute values in an array object and combine them into a new array - */ - pluck: (target, name) => { - var result = []; - var temp; - target.forEach(function (item) { - temp = item[name]; - - if (temp !== null) { - result.push(temp); - } - }); - return result; - }, - - /** - * Returns every element that exists in any of the two arrays once - * Create a Set with all values of a and b and convert to an array. - */ - union: (a, b) => Array.from(new Set([].concat(_toConsumableArray(a), _toConsumableArray(b)))), - - /** - * Returns every element that exists in any of the two arrays once, - * after applying the provided function to each array element of both. - */ - unionBy: (a, b, fn) => { - var s = new Set(a.map(fn)); - return Array.from(new Set([].concat(_toConsumableArray(a), _toConsumableArray(b.filter(x => !s.has(fn(x))))))); - }, - - /** - * Returns every element that exists in any of the two arrays once, - * using a provided comparator function. - */ - unionWith: (a, b, comp) => { - Array.from(new Set([].concat(_toConsumableArray(a), _toConsumableArray(b.filter(x => a.findIndex(y => comp(x, y)) === -1))))); - }, - - /** - * Returns a list of elements that exist in both arrays. - */ - intersect: (a, b) => { - var s = new Set(b); - return a.filter(x => s.has(x)); - }, - - /** - * Returns a list of elements that exist in both arrays, - * after applying the provided function to each array element of both. - */ - intersectBy: (a, b, fn) => { - var s = new Set(b.map(fn)); - return a.filter(x => s.has(fn(x))); - }, - - /** - * Returns the difference between two arrays. - * Create a Set from b, then use Array.prototype. - * Filter() on a to only keep values not contained in b. - */ - difference: (a, b) => { - var s = new Set(b); - return a.filter(x => !s.has(x)); - }, - - /** - * Returns the difference between two arrays, - * after applying the provided function to each array element of both. - */ - differenceBy: (a, b, fn) => { - var s = new Set(b.map(fn)); - return a.map(fn).filter(el => !s.has(el)); - }, - - /** - * Returns the largest element in an array - */ - max: target => { - return Math.max.apply(0, target); - }, - - /** - * Returns the smallest element in an array - */ - min: target => { - return Math.min.apply(0, target); - }, - - /** - * Check two arrays are equal - */ - equal: (arr1, arr2) => { - if (arr1 === arr2) return true; - if (arr1.length !== arr2.length) return false; - - for (var i = 0; i < arr1.length; ++i) { - if (arr1[i] !== arr2[i]) return false; - } - - return true; - }, - - /** - * Check if all elements in an array are equal. - */ - allEqual: arr => arr.every(val => val === arr[0]), - - /** - * Returns true if the provided predicate function returns true for all elements in a collection, false otherwise. - */ - all: function (arr) { - var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Boolean; - return arr.every(fn); - }, - - /** - * Returns true if the provided predicate function returns true for at least one element in a collection, - * false otherwise. - */ - any: function (arr) { - var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Boolean; - return arr.some(fn); - }, - - /** - * Chunks an array into smaller arrays of a specified size. - */ - chunk: (arr, size) => { - Array.from({ - length: Math.ceil(arr.length / size) - }, (v, i) => arr.slice(i * size, i * size + size)); - }, - - /** - * Groups the elements of an array based on the given function and returns the count of elements in each group. - */ - countBy: (arr, fn) => { - arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => { - acc[val] = (acc[val] || 0) + 1; - return acc; - }, {}); - }, - - /** - * Counts the occurrences of a value in an array. - */ - countOccurrences: (arr, val) => { - arr.reduce((a, v) => v === val ? a + 1 : a, 0); - }, - - /** - * Returns a new array with n elements removed from the left. - */ - drop: function (arr) { - var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; - return arr.slice(n); - }, - - /** - * Returns a new array with n elements removed from the right. - */ - dropRight: function (arr) { - var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; - return arr.slice(0, -n); - }, - - /** - * Removes elements in an array until the passed function returns true. - * Returns the remaining elements in the array. - */ - dropWhile: (arr, func) => { - var _arr = arr; - - while (_arr.length > 0 && !func(_arr[0])) { - _arr = _arr.slice(1); - } - - return _arr; - }, - - /** - * Removes elements from the end of an array until the passed function returns true, - * Returns the remaining elements in the array. - */ - dropRightWhile: (arr, func) => { - var rightIndex = arr.length; - - while (rightIndex-- && !func(arr[rightIndex])) { - } - - return arr.slice(0, rightIndex + 1); - }, - - /** - * discuss at: https://locutus.io/php/array_column/ - */ - column: function (input, ColumnKey) { - var IndexKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - var _input = input; - - if (_input !== null && (typeof _input === 'object' || Array.isArray(_input))) { - var newArray = []; - - if (typeof _input === 'object') { - var tempArray = []; - - for (var key of Object.keys(_input)) { - tempArray.push(_input[key]); - } - - _input = tempArray; - } - - if (Array.isArray(_input)) { - for (var _key of _input.keys()) { - if (IndexKey && _input[_key][IndexKey]) { - if (ColumnKey) { - newArray[_input[_key][IndexKey]] = _input[_key][ColumnKey]; - } else { - newArray[_input[_key][IndexKey]] = _input[_key]; - } - } else { - if (ColumnKey) { - newArray.push(_input[_key][ColumnKey]); - } else { - newArray.push(_input[_key]); - } - } - } - } - - return { ...newArray - }; - } - }, - search: (needle, haystack, argStrict) => { - // discuss at: https://locutus.io/php/array_search/' - // example 1: bbo.array.search('3', {a: 3, b: 5, c: 7}) - // returns 1: 'a' - var strict = !!argStrict; - var key = ''; - var _needle = needle; - - if (typeof _needle === 'object' && _needle.exec) { - // Duck-type for RegExp - if (!strict) { - // Let's consider case sensitive searches as strict - var flags = 'i' + (_needle.global ? 'g' : '') + (_needle.multiline ? 'm' : '') + ( // sticky is FF only - _needle.sticky ? 'y' : ''); - _needle = new RegExp(_needle.source, flags); - } - - for (key in haystack) { - if (haystack.hasOwnProperty(key)) { - if (_needle.test(haystack[key])) { - return key; - } - } - } - - return false; - } - - for (key in haystack) { - if (haystack.hasOwnProperty(key)) { - // eslint-disable-next-line eqeqeq - if (strict && haystack[key] === needle || !strict && haystack[key] == needle) { - return key; - } - } - } - - return false; - }, - unary: fn => val => fn(val) - }; - - var functions = { - // version - version: version, - noConflict: noConflict, - // device - ua: ua, - isIos: isIOS, - isiPhone: iPhone, - isIPad: isIPad, - isAndroid: isAndroid, - isMobile: isMobile, - isPC: isPC, - isWeixin: isWeixin, - isNewsApp: isNewsApp, - isQQ: isQQ, - mqqbrowser: mqqbrowser, - isTenvideo: isTenvideo, - isIphoneXmodel: isIphoneXmodel, - ieVersion: ieVersion, - isIE: isIE, - // log - log: log, - logs: logs, - removeConsole: removeConsole, - // arguments - args: args, - trash: trash, - noop: noop$1, - merge: merge, - over: over, - call: call, - // bom - open: open, - trigger: trigger, - stopPropagation: stopPropagation, - g: g, - gc: gc, - c: c, - query: query, - show: show, - hide: hide, - copyToClipboard: copyToClipboard, - elementContains: elementContains, - formToObject: formToObject, - getStyle: getStyle, - setStyle: setStyle, - attr: att, - // other - uuid: uuid, - hash: hash, - judge: judge, - judgment: judge, - getType: getType, - isTypeof: isTypeof, - construct: construct, - paramsName: paramsName, - // other function - loadImages: loadImages, - loadjs: loadjs, - loadcss: loadcss, - toJson: toJson, - toJSON: toJson, - tojson: toJson, - // cookie - cookie: cookie, - setCookie: setCookie, - getCookie: getCookie, - deleteCookie: deleteCookie, - delCookie: deleteCookie, - parseCookie: parseCookie, - // storage - storage: storage, - // url - getUrlParam: getUrlParam, - setUrlParam: setUrlParam, - deleteUrlParam: deleteUrlParam, - delUrlParam: deleteUrlParam, - objectParam: objectParam, - httpGet: httpGet, - httpPost: httpPost, - // times - setTimesout: setTimesout, - clearTimesout: clearTimesout, - getDate: getDate, - formatPassTime: formatPassTime, - formatRemainTime: formatRemainTime, - formatDuration: formatDuration, - // fill - fill0: fill0, - chainAsync: chainAsync, - numberFormat: numberFormat, - // random - randomColor: randomColor, - randomA2B: randomA2B, - randomFromA2B: randomA2B, - randomKey: randomKey, - floor: floor, - // touch - lockTouch: lockTouch, - // image - checkImageSize: checkImageSize, - imageOptimization: imageOptimization, - // lodash - getTag: getTag, - hasOwnProperty: hasOwnProperty$1, - isObject: isObject, - isArray: isArray, - isString: isString, - isBoolean: isBoolean, - isNumber: isNumber, - isMap: isMap, - isSet: isSet, - isFunction: isFunction, - isEmpty: isEmpty, - isShallowEqual: isShallowEqual, - has: has, - reduce: reduce, - forEach: forEach, - map: map, - findIndex: findIndex, - find: find, - toPath: toPath, - get: get, - debounce: debounce, - throttle: throttle, - pick: pick, - omit: omit, - // string - string: string, - // array - array: array - }; - - /* eslint-disable no-invalid-this */ - - function ChainWrapper(subject, explicitChain) { - this._wrappedValue = subject; - this._explicitChain = explicitChain; - } - - ChainWrapper.prototype.value = function () { - return this._wrappedValue; - }; - - ChainWrapper.prototype.valueOf = function () { - return this.value(); - }; - - ChainWrapper.prototype.toJSON = function () { - return this.value(); - }; - - ChainWrapper.prototype.toString = function () { - return String(this.value()); - }; - - ChainWrapper.prototype.chain = function () { - return new ChainWrapper(this._wrappedValue, true); - }; - - ChainWrapper.prototype.thru = function (changer) { - if (typeof changer === 'function') { - return new ChainWrapper(changer(this._wrappedValue), this._explicitChain); - } - - return this; - }; - - ChainWrapper.prototype._explicitChain = true; - - function makeFunctionChainable(functionInstance) { - return function () { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var result = functionInstance.apply(void 0, [this._wrappedValue].concat(args)); - - if (this._explicitChain || typeof result === 'string') { - return new ChainWrapper(result, this._explicitChain); - } else { - return result; - } - }; - } - - Object.keys(functions).forEach(function (name) { - ChainWrapper.prototype[name] = makeFunctionChainable(functions[name]); - }); - - function chain(subject) { - return new ChainWrapper(subject, true); - } - - function bbo(subject) { - return new ChainWrapper(subject, false); - } - - _extends(bbo, functions, { - chain: chain - }); - - return bbo; - -}))); diff --git a/dist/bbo.min.js b/dist/bbo.min.js deleted file mode 100644 index 67c1dd7..0000000 --- a/dist/bbo.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).bbo=t()}(this,(function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t0)return parseInt(e.substring(t+5,e.indexOf(".",t)),10);if(e.indexOf("Trident/")>0){var n=e.indexOf("rv:");return parseInt(e.substring(n+3,e.indexOf(".",n)),10)}var r=e.indexOf("Edge/");return r>0?parseInt(s.substring(r+5,e.indexOf(".",r)),10):""}function h(e,t){return Array.prototype.slice.call(e,t||0)}var p={};var g={clear:function(){for(var e in g)"log"!==e&&"clear"!==e&&delete g[e]},log:function(){for(var e in g)"log"!==e&&"clear"!==e&&console.log("bbo.trash:: ",e,g[e])}};function v(e,t,n){e.style[t]=n}function m(e,t,n){e.setAttribute(t,n)}var y=(e,t,n)=>{if(document.createEventObject){var r=document.createEventObject();return e.fireEvent("on"+t,r)}var o=document.createEvent(n||"HTMLEvents");o.initEvent(t,!0,!0),e.dispatchEvent(o)};function w(e){return document.getElementById(e)}function b(e,t,n,r){var o=document.createElement(e);return t&&m(o,"class",t),n&&(o.innerHTML=n),r&&m(o,"id",r),o}function x(e){var t,n=String(e),r=0;if(0===n.length)return r;for(t=0;tObject.prototype.toString.call(e).slice(8,-1).toLowerCase()===t;function S(e,t,n){if(!A(t,"array"))return!1;for(var r in t)if(n){if(e===t[r])return!0}else if(e===t[r])return!0;return!1}function O(e,t){var n=this;n.img=new Image;var r=function(){a(),console.info("onReadyStateChange"),t(n,"onReadyStateChange")},o=function(){console.info("onError"),a(),t(n,"onError")},i=function(){a(),t(n,"onload")},a=function(){n.unbind("load",i),n.unbind("readystatechange",r),n.unbind("error",o)};this.start=function(){this.bind("load",i),this.bind("readystatechange",r),this.bind("error",o),this.img.src=e,n.img.complete&&(a(),t(this,"onload"))}}O.prototype.bind=function(e,t){this.img.addEventListener?this.img.addEventListener(e,t,!1):this.img.attachEvent&&this.img.attachEvent("on"+e,t)},O.prototype.unbind=function(e,t){this.img.removeEventListener?this.img.removeEventListener(e,t,!1):this.img.detachEvent&&this.img.detachEvent("on"+e,t)};var j={urls:{},logs:{}},C=function(e,t){for(var n=0;n=e.length&&t&&t()}},I=function(e,t){var n=document.createElement("script");n.setAttribute("type","text/javascript"),n.setAttribute("src",e),document.getElementsByTagName("head")[0].appendChild(n),/msie/.test(s("l"))?n.onreadystatechange=function(){"loaded"!==this.readyState&&"complete"!==this.readyState||t()}:/gecko/.test(s("l"))?n.onload=function(){t()}:setTimeout((function(){t()}),50)};var E=e=>{if(!e)return null;if("string"!=typeof e)return A(e.json,"function")?e.json():e;try{return JSON.parse(e)}catch(t){return new Function("return "+("("+e+")"))()}},M=(e,t,n)=>{var r=n&&n.raw?t:encodeURIComponent(t),o=encodeURIComponent(e)+"="+r;if(n){if(n.days){var i=new Date,a=24*n.days*3600*1e3;i.setTime(i.getTime()+a),o+="; expires="+i.toGMTString()}else if(n.hour){var u=new Date,c=3600*n.hour*1e3;u.setTime(u.getTime()+c),o+="; expires="+u.toGMTString()}else{var l=new Date;l.setTime(l.getTime()+31536e7),o+="; expires="+l.toGMTString()}n.path&&(o+="; path="+n.path),n.domain&&(o+="; domain="+n.domain),n.secure&&(o+="; true")}document.cookie=o},T=e=>{M(e,"",{hour:-1})},k={trim:e=>{for(var t=e.replace(/^\s+/,""),n=e.length-1;n>=0;n--)if(/\S/.test(e.charAt(n))){t=e.slice(0,n+1);break}return t},fillZero:(e,t)=>(new Array(t).join("0")+e).slice(-t),longUnique:e=>{for(var t={},n=0;ne.replace(/]*>(\S\s*?)<\/script>/gim,"").replace(/<[^>]+>/g,""),capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),deCapitalize:function(e){var t=n(e),r=t[0],o=t.slice(1),i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return r.toLowerCase()+(i?o.join("").toUpperCase():o.join(""))},isAbsoluteURL:e=>/^[a-z][a-z0-9+.-]*:/.test(e),mapString:(e,t)=>e.split("").map((n,r)=>t(n,r,e)).join(""),mask:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"*";return`${e}`.slice(-t).padStart(`${e}`.length,n)},splitLines:e=>e.split(/\r?\n/),camelize:e=>e.indexOf("-")<0&&e.indexOf("_")<0?e:e.replace(/[-_][^-_]/g,(function(e){return e.charAt(1).toUpperCase()})),underscored:e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase(),dasherize:function(e){return this.underscored(e).replace(/_/g,"-")},truncate:(e,t)=>e.length>t?e.slice(0,t>3?t-3:t)+"...":e,byteSize:e=>new Blob([e]).size,byteLen:(e,t)=>{var n,r,o,i=0,a=t?t.toLowerCase():"";if("utf-16"===a||"utf16"===a)for(r=0,o=e.length;r{for(var n=e,r="";t>0&&(t%2==1&&(r+=n),1!==t);)n+=n,t>>=1;return r},endsWith:(e,t,n)=>{var r=e.slice(-t.length);return n?r.toLowerCase()===t.toLowerCase():r===t},startsWith:(e,t,n)=>{var r=e.slice(0,t.length);return n?r.toLowerCase()===t.toLowerCase():r===t},contains:(e,t)=>-1!==String(e).indexOf(t),xssFilter:e=>e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),index:(e,t)=>String(e).indexOf(t),capwords:e=>String(e).replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g,(function(e){return e.toUpperCase()}))},R=window.localStorage,_=window.sessionStorage;class P{constructor(e){var t=e.type,n=void 0===t?"local":t,r=e.prefix,o=void 0===r?"bbo.storage":r,i=e.message,a=void 0===i?{setItem:"write in",getItem:"read",removeAll:"remove all",removeItem:"remove item"}:i;this.prefix=o,this.type=n,this.message=a,"local"===n?this._storage=R:"session"===n&&(this._storage=_)}doItem(e,t){try{if("function"==typeof e)return e()}catch(e){return this._warn(t),null}return!0}setItem(e,t){"object"==typeof e?Object.keys(e).forEach((t,n)=>{this.doItem(()=>this._storage.setItem(`${this.prefix}.${t}`,JSON.stringify(e[t])),"setItem")}):this.doItem(()=>this._storage.setItem(`${this.prefix}.${e}`,JSON.stringify(t)),"setItem")}has(){for(var e=arguments.length,t=new Array(e),n=0;nthis._storage.getItem(`${this.prefix}.${e}`))}get(){for(var e={},t=arguments.length,n=new Array(t),r=0;r{if("null"!==`${this._storage.getItem(`${this.prefix}.${t}`)}`)try{e[t]=JSON.parse(this._storage.getItem(`${this.prefix}.${t}`))}catch(e){console.warn(this._warn("getItem"))}}),e}getItem(e){return this.doItem(()=>JSON.parse(this._storage.getItem(`${this.prefix}.${e}`)),"getItem")}removeAll(){Object.keys(this._storage).forEach(e=>{k.contains(e,this.prefix)&&this._remove(`${e}`)})}removeItem(){for(var e=arguments.length,t=new Array(e),n=0;nthis.doItem(()=>this._storage.removeItem(`${this.prefix}.${e}`),"removeItem"))}_warn(e){var t=this.message;console.warn(`Unable to ${t[e]||""} ${this.type} Storage`)}_remove(e){this.doItem(()=>this._storage.removeItem(`${e}`),"removeItem")}}var L=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.href,n=t.split("?");if(n.length>=2){for(var r=encodeURIComponent(e)+"=",o=n[1].split(/[&;]/g),i=o.length;i-- >0;)-1!==o[i].lastIndexOf(r,0)&&o.splice(i,1);return n[0]+(o.length>0?"?"+o.join("&"):"")}return t},$=e=>Array.isArray(e)?e.map((function(e){return e.name+"="+e.value})).join("&"):$(U(e)),U=e=>{var t=[];return Object.keys(e).forEach((function(n){Array.isArray(e[n])?t=t.concat(e[n].map((function(e){return{name:n,value:e}}))):t.push({name:n,value:e[n]})})),t};function N(e){var t=parseFloat(e);return t<10?"0"+t:t}var F=(e,t,n)=>{var r=Math.random()*(t-e)+e;return n?Math.floor(r):r};function B(e){return Object.prototype.toString.call(e)}function q(e){return"[object Object]"===B(e)}function D(e){return"[object Array]"===B(e)}function z(e){return"[object String]"===B(e)}function J(e){return"[object Function]"===B(e)}function W(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function H(e,t){if(W(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=0;o{var i=e;r?i=o.replace(V,"$1"):n&&(i=n.trim()),t.push(i)}),t}function Q(e){return z(e)?Z(e):[]}function K(e,t){if(!q(e))return!1;D(t)||(t=Q(t));for(var n=-1,r=t.length,o=!1;++n=t||n<0||f&&e-l>=i}function y(){var e=Date.now();if(m(e))return function(e){if(u=void 0,d&&r)return p(e);return r=o=void 0,a}(e);u=g(y,function(e){var n=e-l,r=t-(e-c);return f?Math.min(r,i-n):r}(e))}return t=+t||0,q(n)&&(s=!!n.leading,i=(f="maxWait"in n)?Math.max(+n.maxWait||0,t):i,d="trailing"in n?!!n.trailing:d),function(){for(var e=Date.now(),n=m(e),i=arguments.length,l=new Array(i),s=0;s-1},isMobile:f,isPC:function(){return!f()},isWeixin:function(){return/MicroMessenger/i.test(s("l"))},isNewsApp:function(){return/qqnews/.test(s())},isQQ:function(){return/qq\//.test(s())},mqqbrowser:function(){return/mqqbrowser\//.test(s())},isTenvideo:function(){return/qqlivebrowser/.test(s())},isIphoneXmodel:function(){if("undefined"!=typeof window&&window){var e=window,t=e.devicePixelRatio,n=e.screen,r=n.width,o=n.height;return[{devicePixelRatio:3,width:375,height:812},{devicePixelRatio:3,width:414,height:896},{devicePixelRatio:2,width:414,height:896}].some(e=>e.devicePixelRatio===t&&e.width===r&&e.height===o)}return!1},ieVersion:d,isIE:function(){return d()>0},log:function(e,t){var n=document.getElementById("_bbo_log");if(null===n&&((n=document.createElement("div")).setAttribute("id","_bbo_log"),n.setAttribute("style","position:fixed;left:0;top:0;z-index:9999;padding:4px;"),document.body.appendChild(n)),t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n.style[r]=t[r]);n.innerHTML=e},logs:function(){if(window.console&&window.console.log){var e=String(arguments[0]),t=parseInt(e.split("&")[1],10)||10,n=p;n[e]||(n[e]={}),n[e].once||(n[e].once=1),n[e].once<=t&&(console.log.apply(console,h(arguments,1)),n[e].once++)}},removeConsole:function(e){try{window.console||(window.console={}),window.console.log=window.console.info=window.console.dir=window.console.warn=window.console.trace=noop,"clear"===e&&window.console.clear&&window.console.clear()}catch(e){}},args:h,trash:g,noop:()=>{},merge:function(){for(var e=arguments.length,t=new Array(e),n=0;nObject.keys(t).reduce((n,r)=>(e[r]=e.hasOwnProperty(r)?[].concat(e[r]).concat(t[r]):t[r],e),{}),{})},over:function(){for(var e=arguments.length,t=new Array(e),n=0;ne.apply(null,n))}},call:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rt[e].apply(t,n)},open:e=>{var t="_bbo_open_proxy",n=w(t)||b("a",t,"",t);v(n,"display","none"),m(n,"href",e),m(n,"target","_blank"),n.parentNode||document.body.appendChild(n),y(n,"click","MouseEvents")},trigger:y,stopPropagation:e=>{var t=e||window.event;t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},g:w,gc:function(e){return document.getElementsByClassName(e)},c:b,query:function(e){return document.querySelector(e)},show:function(){for(var e=arguments.length,t=new Array(e),n=0;n{e.style.display=""})},hide:function(){for(var e=arguments.length,t=new Array(e),n=0;n{e.style.display="none"})},copyToClipboard:function(e){var t=document.createElement("textarea");t.value=e,m(t,"readonly",""),v(t,"position","absolute"),v(t,"left","-9999px"),document.body.appendChild(t);var n=document.getSelection().rangeCount>0&&document.getSelection().getRangeAt(0);t.select(),document.execCommand("copy"),document.body.removeChild(t),n&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n))},elementContains:(e,t)=>e!==t&&e.contains(t),formToObject:e=>Array.from(new FormData(e)).reduce((e,n)=>{var r=t(n,2);return{...e,[r[0]]:r[1]}},{}),getStyle:(e,t)=>getComputedStyle(e)[t],setStyle:v,attr:m,uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},hash:x,judge:S,judgment:S,getType:e=>void 0===e?"undefined":null===e?"null":e.constructor.name.toLowerCase(),isTypeof:A,construct:function(){var e=arguments[0];return new(Function.prototype.bind.apply(e,arguments))},paramsName:function(e){return/\(\s*([\s\S]*?)\s*\)/.exec(e.toString())[1].split(/\s*,\s*/)},loadImages:function(e){var t,n=0,r=0,o=null,i=0,a=0,u=e.data||[],c=e.step||function(){},l=e.complete||function(){},s=e.needOneStep||!1,f=e.path||!1;if("object"!=typeof u||0===u.length)return c(100),!1;if(t=u.length,f)for(var d=t-1;d>-1;d--)u[d]=f+u[d];var h=function(){i++,c(i),i{function e(){for(var e=0,t={};e1){var u=e({path:"/"},r.defaults,i);if("number"==typeof u.expires){var c=new Date;c.setMilliseconds(c.getMilliseconds()+864e5*u.expires),u.expires=c}var l=o;try{a=JSON.stringify(l),/^[\{\[]/.test(a)&&(l=a)}catch(e){}l=n.write?n.write(l,t):encodeURIComponent(String(l)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent);var s=encodeURIComponent(String(t)),f=s.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),d=f.replace(/[\(\)]/g,escape),h=document.cookie=[d,"=",o,i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("");return h}t||(a={});for(var p=document.cookie?document.cookie.split("; "):[],g=/(%[0-9A-Z]{2})+/g,v=0;v{for(var t=encodeURIComponent(e)+"=",n=document.cookie.split(";"),r=0;re.split(";").map(e=>e.split("=")).reduce((e,t)=>(e[decodeURIComponent(t[0].trim())]=decodeURIComponent(t[1].trim()),e),{}),storage:e=>{var t=e.type,n=e.prefix;return new P({type:t,prefix:n})},getUrlParam:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.href;e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),r=n.exec(t);return r?r[2]?decodeURIComponent(r[2].replace(/\+/g," ")):"":null},setUrlParam:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.location.href,r=new RegExp("([?|&])"+e+"=.*?(&|#|$)","i");if(n.match(r))return n.replace(r,"$1"+e+"="+encodeURIComponent(t)+"$2");var o="";-1!==n.indexOf("#")&&(o=n.replace(/.*#/,"#"),n.replace(/#.*/,""));var i=-1!==n.indexOf("?")?"&":"?";return n+i+e+"="+encodeURIComponent(t)+o},deleteUrlParam:L,delUrlParam:L,objectParam:$,httpGet:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:console.error,r=new XMLHttpRequest;r.open("GET",e,!0),r.onload=()=>t(r.responseText),r.onerror=()=>n(r),r.send()},httpPost:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:console.error,o=new XMLHttpRequest;o.open("POST",e,!0),o.setRequestHeader("Content-type","application/json; charset=utf-8"),o.onload=()=>n(o.responseText),o.onerror=()=>r(o),o.send(t)},setTimesout:function(){var e=arguments[0],t=void 0===arguments[1]?0:parseFloat(arguments[1]),n=void 0===arguments[2]?1:parseInt(arguments[2],10),r=arguments.length>3?h(arguments,3):null,o={index:0,times:n,over:!1},i=setInterval((function(){o.index++,o.index>n?clearInterval(i):(o.index===n&&(o.over=!0),e.apply(o,r))}),t);return i},clearTimesout:function(e){clearInterval(e)},getDate:(e,t)=>{var n=new Date,r=n.getDate(),o=n.getMonth()+1,i=n.getFullYear(),a=n.getHours(),u=n.getMinutes(),c=n.getSeconds();r=N(r);var l=e||"/",s=t||":";return i+l+(o=N(o))+l+r+" "+(a=N(a))+s+(u=N(u))+s+(c=N(c))},formatPassTime:e=>{var t=Date.parse(new Date)-e,n=parseInt(t/864e5,10),r=parseInt(t/36e5,10),o=parseInt(t/6e4,10),i=parseInt(n/30,10),a=parseInt(i/12,10);return a?a+"年前":i?i+"个月前":n?n+"天前":r?r+"小时前":o?o+"分钟前":"刚刚"},formatRemainTime:e=>{var t=new Date,n=new Date(e).getTime()-t.getTime(),r=0,o=0,i=0,a=0;return n>=0&&(r=Math.floor(n/1e3/3600/24),o=Math.floor(n/1e3/60/60%24),i=Math.floor(n/1e3/60%60),a=Math.floor(n/1e3%60)),r+"天 "+o+"小时 "+i+"分钟 "+a+"秒"},formatDuration:e=>{e<0&&(e=-e);var n={day:Math.floor(e/864e5),hour:Math.floor(e/36e5)%24,minute:Math.floor(e/6e4)%60,second:Math.floor(e/1e3)%60,millisecond:Math.floor(e)%1e3};return Object.entries(n).filter(e=>0!==e[1]).map(e=>{var n=t(e,2),r=n[0],o=n[1];return`${o} ${r}${1!==o?"s":""}`}).join(", ")},fill0:N,chainAsync:e=>{var t=0,n=e[e.length-1],r=()=>{var o=e[t++];o===n?o():o(r)};r()},numberFormat:(e,t,n,r)=>{var o=String(e).replace(/[^0-9+\-Ee.]/g,""),i=t,a=isFinite(Number(o))?Number(o):0,u=isFinite(Number(i))?Math.abs(i):0,c=void 0===r?",":r,l=void 0===n?".":n,s="";return(s=(u?function(e,t){if(-1===String(e).indexOf("e"))return Number(Math.round(e+"e+"+t)+"e-"+t);var n=String(e).split("e"),r="";return Number(n[1])+t>0&&(r="+"),Number(Math.round(Number(n[0])+"e"+r+(Number(n[1])+t))+"e-"+t).toFixed(t)}(a,u).toString():String(Math.round(a))).split("."))[0].length>3&&(s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,c)),(s[1]||"").length0&&void 0!==arguments[0]?arguments[0]:32,t="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",n="",r=0;r1&&void 0!==arguments[1]?arguments[1]:0;return Math.floor(e*Math.pow(10,t))/Math.pow(10,t)},lockTouch:()=>{function e(e,t){return e.target.tagName!==t.toUpperCase()&&e.target.tagName!==t.toLowerCase()}function t(t){e(t,"input")&&e(t,"textarea")&&e(t,"select")&&e(t,"menus")&&t.preventDefault()}document.addEventListener("touchmove",(function(e){e.preventDefault()}),!1),document.addEventListener("touchstart",t,!1),document.addEventListener("touchend",t,!1)},checkImageSize:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return new Promise((r,o)=>{if(e instanceof File){var i=new FileReader;i.onload=function(){a(this.result)},i.readAsDataURL(e)}else"string"==typeof e&&a(e);function a(e){var o=new Image;o.src=e,o.onload=function(){var e=this.naturalWidth,o=this.naturalHeight;t.width&&Math.abs(t.width-e)>n&&r(!1),t.height&&Math.abs(t.height-o)>n&&r(!1),r(!0)}}})},imageOptimization:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.9,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.maxWidth,o=void 0===r?1920:r,i=n.mimeType;return new Promise((n,r)=>{if(e instanceof File){var a=new FileReader;a.onload=function(){u(this.result)},a.readAsDataURL(e)}else"string"==typeof e&&u(e);function u(a){var u=a.match(/data:([^;,]+)/);if(Array.isArray(u)){if("image/gif"===(i||u[1]))return n(e);var c=new Image;c.src=a,c.onload=function(){var e=this.naturalWidth,r=this.naturalHeight;e>o&&(r=Math.round(o*r/e),e=o);var a=document.createElement("canvas");a.width=e,a.height=r,a.getContext("2d").drawImage(this,0,0,e,r),a.toBlob(e=>{n(e)},i||u[1],t)}}else r(new Error("Non-picture type Data URLs"))}})},getTag:B,hasOwnProperty:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},isObject:q,isArray:D,isString:z,isBoolean:function(e){return"[object Boolean]"===B(e)},isNumber:function(e){return"[object Number]"===B(e)},isMap:function(e){return"[object Map]"===B(e)},isSet:function(e){return"[object Set]"===B(e)},isFunction:J,isEmpty:e=>null==e||!(Object.keys(e)||e).length,isShallowEqual:H,has:K,reduce:Y,forEach:ee,map:function(e,t){var n=[],r=0;if(D(e))for(;r{if(J(t)){if(!0===t(e,r,o))return n=r,!1}else{if(W(e,t))return n=r,!1;if(q(e)&&q(t)){var i=!0;if(ee(t,(t,n)=>i=H(e[n],t)),i)return n=r,!1}}}),n},find:function(e,t){var n=void 0;return ee(e,(e,r,o)=>{if(J(t)){if(!0===t(e,r,o))return n=e,!1}else{if(W(e,t))return n=e,!1;if(q(e)&&q(t)){var i=!0;if(ee(t,(t,n)=>i=H(e[n],t)),i)return n=e,!1}}}),n},toPath:Q,get:function(e,t,n){if(null==e)return n;if(!Array.isArray(t)){var r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;t=function(e,t){var n=typeof e;return"number"==n||"boolean"==n||null==e||(o.test(e)||!r.test(e)||null!=t&&e in Object(t))}(t,e)?[t]:Z(t)}for(var i=0,a=t.length;null!=e&&i1?t-1:0),r=1;r(D(n)?ee(n,n=>{K(e,n)&&(t[n]=e[n])}):K(e,n)&&(t[n]=e[n]),t),{})},omit:(e,t)=>Object.keys(e).filter(e=>!t.includes(e)).reduce((t,n)=>(t[n]=e[n],t),{}),string:k,array:{unique:e=>r(new Set(e)),uniqueBy:(e,t)=>e.reduce((e,n)=>(e.some(e=>t(n,e))||e.push(n),e),[]),uniqueFrom:(t,n)=>Object.values(t.reduce((t,r)=>e(t,{[r[n]]:r}),{})),random:e=>e[Math.floor(Math.random()*e.length)],randomSize:function(e){for(var t=n(e),r=t.slice(0),o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=r.length;i;){var a=Math.floor(Math.random()*i--),u=[r[a],r[i]];r[i]=u[0],r[a]=u[1]}return r.slice(0,o)},shuffle:e=>{for(var t=n(e).slice(0),r=t.length;r;){var o=Math.floor(Math.random()*r--),i=[t[o],t[r]];t[r]=i[0],t[o]=i[1]}return t},contains:(e,t)=>e.indexOf(t)>-1,includesAll:(e,t)=>t.every(t=>e.includes(t)),includesAny:(e,t)=>t.some(t=>e.includes(t)),removeAt:function(e,t){return!!e.splice(t,1).length},remove:function(e,t){var n=e.indexOf(t);return n>-1&&this.removeAt(e,n)},compact:e=>e.filter(e=>void 0!==e),compactAll:e=>e.filter(Boolean),pluck:(e,t)=>{var n,r=[];return e.forEach((function(e){null!==(n=e[t])&&r.push(n)})),r},union:(e,t)=>Array.from(new Set([].concat(r(e),r(t)))),unionBy:(e,t,n)=>{var o=new Set(e.map(n));return Array.from(new Set([].concat(r(e),r(t.filter(e=>!o.has(n(e)))))))},unionWith:(e,t,n)=>{Array.from(new Set([].concat(r(e),r(t.filter(t=>-1===e.findIndex(e=>n(t,e)))))))},intersect:(e,t)=>{var n=new Set(t);return e.filter(e=>n.has(e))},intersectBy:(e,t,n)=>{var r=new Set(t.map(n));return e.filter(e=>r.has(n(e)))},difference:(e,t)=>{var n=new Set(t);return e.filter(e=>!n.has(e))},differenceBy:(e,t,n)=>{var r=new Set(t.map(n));return e.map(n).filter(e=>!r.has(e))},max:e=>Math.max.apply(0,e),min:e=>Math.min.apply(0,e),equal:(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(var n=0;ne.every(t=>t===e[0]),all:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Boolean;return e.every(t)},any:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Boolean;return e.some(t)},chunk:(e,t)=>{Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,r*t+t))},countBy:(e,t)=>{e.map("function"==typeof t?t:e=>e[t]).reduce((e,t)=>(e[t]=(e[t]||0)+1,e),{})},countOccurrences:(e,t)=>{e.reduce((e,n)=>n===t?e+1:e,0)},drop:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.slice(t)},dropRight:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.slice(0,-t)},dropWhile:(e,t)=>{for(var n=e;n.length>0&&!t(n[0]);)n=n.slice(1);return n},dropRightWhile:(e,t)=>{for(var n=e.length;n--&&!t(e[n]););return e.slice(0,n+1)},column:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=e;if(null!==r&&("object"==typeof r||Array.isArray(r))){var o=[];if("object"==typeof r){var i=[];for(var a of Object.keys(r))i.push(r[a]);r=i}if(Array.isArray(r))for(var u of r.keys())n&&r[u][n]?o[r[u][n]]=t?r[u][t]:r[u]:t?o.push(r[u][t]):o.push(r[u]);return{...o}}},search:(e,t,n)=>{var r=!!n,o="",i=e;if("object"==typeof i&&i.exec){if(!r){var a="i"+(i.global?"g":"")+(i.multiline?"m":"")+(i.sticky?"y":"");i=new RegExp(i.source,a)}for(o in t)if(t.hasOwnProperty(o)&&i.test(t[o]))return o;return!1}for(o in t)if(t.hasOwnProperty(o)&&(r&&t[o]===e||!r&&t[o]==e))return o;return!1},unary:e=>t=>e(t)}};function re(e,t){this._wrappedValue=e,this._explicitChain=t}function oe(e){return new re(e,!1)}return re.prototype.value=function(){return this._wrappedValue},re.prototype.valueOf=function(){return this.value()},re.prototype.toJSON=function(){return this.value()},re.prototype.toString=function(){return String(this.value())},re.prototype.chain=function(){return new re(this._wrappedValue,!0)},re.prototype.thru=function(e){return"function"==typeof e?new re(e(this._wrappedValue),this._explicitChain):this},re.prototype._explicitChain=!0,Object.keys(ne).forEach((function(e){var t;re.prototype[e]=(t=ne[e],function(){for(var e=arguments.length,n=new Array(e),r=0;r 0) {\n return parseInt(uakit.substring(msie + 5, uakit.indexOf('.', msie)), 10);\n }\n\n let trident = uakit.indexOf('Trident/');\n if (trident > 0) {\n let rv = uakit.indexOf('rv:');\n return parseInt(uakit.substring(rv + 3, uakit.indexOf('.', rv)), 10);\n }\n\n let edge = uakit.indexOf('Edge/');\n if (edge > 0) {\n return parseInt(ua.substring(edge + 5, uakit.indexOf('.', edge)), 10);\n }\n\n return '';\n}\n","/**\n * arguments to array\n */\nexport default function args($arguments, first) {\n return Array.prototype.slice.call($arguments, first || 0);\n}\n","import args from '../args/args';\n/************************************************************************\n * Private Method\n *************************************************************************/\nlet _cache = {\n urls: {},\n logs: {}\n};\n/**\n * bbo.logs('only id&10', 1, 2);\n */\nexport default function logs() {\n if (window.console && window.console.log) {\n let onlyId = String(arguments[0]);\n let times = parseInt(onlyId.split('&')[1], 10) || 10;\n let logsCache = _cache.logs;\n\n if (!logsCache[onlyId]) logsCache[onlyId] = {};\n if (!logsCache[onlyId].once) logsCache[onlyId].once = 1;\n\n if (logsCache[onlyId].once <= times) {\n console.log.apply(console, args(arguments, 1));\n logsCache[onlyId].once++;\n }\n }\n}\n","/**\n * a trash object\n */\nconst trash = {\n clear: function() {\n for (let key in trash) {\n if (key !== 'log' && key !== 'clear') delete trash[key];\n }\n },\n log: function() {\n for (let key in trash) {\n if (key !== 'log' && key !== 'clear') console.log('bbo.trash:: ', key, trash[key]);\n }\n }\n};\n\nexport default trash;\n","export default function setStyle(el, ruleName, val) {\n el.style[ruleName] = val;\n}\n","export default function att(el, ruleName, val) {\n el.setAttribute(ruleName, val);\n}\n","/**\n * trigger event\n * https://stackoverflow.com/questions/2490825/how-to-trigger-event-in-javascript\n */\nconst trigger = (element, event, eventType) => {\n if (document.createEventObject) {\n let e = document.createEventObject();\n return element.fireEvent('on' + event, e);\n } else {\n let e = document.createEvent(eventType || 'HTMLEvents');\n e.initEvent(event, true, true);\n element.dispatchEvent(e);\n }\n};\n\nexport default trigger;\n","export default function g(i) {\n return document.getElementById(i);\n}\n","import attr from './attr';\n\n// eslint-disable-next-line max-params\nexport default function c(t, cn, i, id) {\n let el = document.createElement(t);\n if (cn) {\n attr(el, 'class', cn);\n }\n if (i) {\n el.innerHTML = i;\n }\n if (id) {\n attr(el, 'id', id);\n }\n return el;\n}\n","/**\n * string hash map\n * From https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript-jquery\n */\nexport default function hash(str) {\n let _str = String(str);\n let hash = 0;\n let i;\n let chr;\n if (_str.length === 0) return hash;\n for (i = 0; i < _str.length; i++) {\n chr = _str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0; // Convert to 32bit integer\n }\n\n return hash;\n}\n","/**\n * is typeof type\n */\nconst isTypeof = (val, type) => {\n return (\n Object.prototype.toString\n .call(val)\n .slice(8, -1)\n .toLowerCase() === type\n );\n};\n\nexport default isTypeof;\n","import isTypeof from './is_typeof';\n/**\n * map condition judge\n * bbo.judge = bbo.judgment\n */\nexport default function judge(v, vals, strict) {\n if (!isTypeof(vals, 'array')) return false;\n\n for (let key in vals) {\n if (strict) {\n if (v === vals[key]) return true;\n } else {\n if (v === vals[key]) return true;\n }\n }\n\n return false;\n}\n","export default function loadImages(options) {\n let len = 0;\n let index = 0;\n let curIndex = 0;\n let stepTimer = null;\n let stepTimeValue = 5;\n let percentageValue = 0;\n let targetPercent = 0;\n let data = options.data || [];\n let step = options.step || function() {};\n let complete = options.complete || function() {};\n let needOneStep = options.needOneStep || false;\n let path = options.path || false;\n\n if (typeof data !== 'object' || data.length === 0) {\n step(100);\n return false;\n }\n\n len = data.length;\n if (path) {\n for (let i = len - 1; i > -1; i--) {\n data[i] = path + data[i];\n // console.info(data[i]);\n }\n }\n\n let processStep = function() {\n percentageValue++;\n // console.info(\"processStep = \",percentageValue)\n step(percentageValue);\n if (percentageValue < targetPercent) {\n stepTimer = setTimeout(function() {\n processStep();\n }, stepTimeValue);\n } else if (targetPercent === 100 && percentageValue === targetPercent) {\n if (complete && typeof complete === 'function') {\n complete();\n }\n }\n };\n\n function onload() {\n curIndex++;\n targetPercent = Math.floor((curIndex / len) * 100);\n if (needOneStep) {\n if (stepTimer) {\n clearTimeout(stepTimer);\n }\n processStep();\n } else {\n step(targetPercent);\n if (targetPercent === 100) {\n complete();\n }\n }\n }\n\n for (index; index < len; index++) {\n let strUrl = data[index];\n new LoadImageItem(strUrl, onload).start();\n }\n}\n\n/**\n * @name loadImageItem\n * @param {string} url - images full url\n * @callback cb - called when load image completed\n */\nfunction LoadImageItem(url, cb) {\n let self = this;\n\n self.img = new Image();\n\n // readyState:'complete' or 'loaded' => image has been loaded。\n // for IE6-IE10。\n let onReadyStateChange = function() {\n removeEventHandlers();\n console.info('onReadyStateChange');\n cb(self, 'onReadyStateChange');\n };\n\n let onError = function() {\n console.info('onError');\n removeEventHandlers();\n cb(self, 'onError');\n };\n\n let onLoad = function() {\n removeEventHandlers();\n cb(self, 'onload');\n };\n\n let removeEventHandlers = function() {\n self.unbind('load', onLoad);\n self.unbind('readystatechange', onReadyStateChange);\n self.unbind('error', onError);\n };\n\n this.start = function() {\n this.bind('load', onLoad);\n this.bind('readystatechange', onReadyStateChange);\n this.bind('error', onError);\n\n this.img.src = url;\n if (self.img.complete) {\n removeEventHandlers();\n cb(this, 'onload');\n }\n };\n}\n\n/**\n * @name bind\n * @description cross-browser event binding\n * @param {string} eventName\n * @param {function} eventHandler\n */\nLoadImageItem.prototype.bind = function(eventName, eventHandler) {\n if (this.img.addEventListener) {\n this.img.addEventListener(eventName, eventHandler, false);\n } else if (this.img.attachEvent) {\n this.img.attachEvent('on' + eventName, eventHandler);\n }\n};\n\n/**\n * @name unbind\n * @description cross-browser event un-binding\n * @param {string} eventName\n * @param {function} eventHandler\n */\n\nLoadImageItem.prototype.unbind = function(eventName, eventHandler) {\n if (this.img.removeEventListener) {\n this.img.removeEventListener(eventName, eventHandler, false);\n } else if (this.img.detachEvent) {\n this.img.detachEvent('on' + eventName, eventHandler);\n }\n};\n","/* eslint-disable no-invalid-this */\n\nimport hash from '../other/hash';\nimport ua from '../device/ua';\n\n/**\n * load js\n * 1. bbo.loadjs(\"//your_url/a.js\",func);\n * 2. bbo.loadjs(\"//your_url/a.js\",\"only_id\",func);\n */\nlet _cache = {\n urls: {},\n logs: {}\n};\n\nlet _insertScripts = function(arr, callback) {\n for (let i = 0; i < arr.length; i++) {\n _insertScript(arr[i], loaded);\n }\n\n let _index = 0;\n\n function loaded() {\n _index++;\n if (_index >= arr.length) {\n callback && callback();\n }\n }\n};\n\nlet _insertScript = function(src, callback) {\n let script = document.createElement('script');\n script.setAttribute('type', 'text/javascript');\n script.setAttribute('src', src);\n document.getElementsByTagName('head')[0].appendChild(script);\n\n if (/msie/.test(ua('l'))) {\n script.onreadystatechange = function() {\n if (this.readyState === 'loaded' || this.readyState === 'complete') {\n callback();\n }\n };\n } else if (/gecko/.test(ua('l'))) {\n script.onload = function() {\n callback();\n };\n } else {\n setTimeout(function() {\n callback();\n }, 50);\n }\n};\n\nexport default function loadjs(url, b, c) {\n let onlyId;\n let callback;\n\n if (typeof b === 'function') {\n onlyId = String(hash(String(url)));\n callback = b;\n } else if (typeof b === 'undefined') {\n onlyId = String(hash(String(url)));\n callback = null;\n } else {\n onlyId = String(b);\n callback = c;\n }\n\n if (_cache.urls[onlyId]) {\n callback && callback();\n } else {\n let func = typeof url === 'string' ? _insertScript : _insertScripts;\n func.call(this, url, function() {\n _cache.urls[onlyId] = true;\n callback && callback();\n });\n }\n}\n","import isTypeof from '../other/is_typeof';\n/**\n * to json\n */\n\n// eval hack\nconst evil = (fn) => {\n // A variable points to Function, preventing reporting errors\n let Fn = Function;\n return new Fn('return ' + fn)();\n};\n\n// bbo.toJSON = bbo.tojson = bbo.toJson\nconst toJson = (res) => {\n if (!res) return null;\n\n if (typeof res === 'string') {\n try {\n return JSON.parse(res);\n } catch (e) {\n return evil('(' + res + ')');\n }\n } else if (isTypeof(res.json, 'function')) {\n return res.json();\n } else {\n return res;\n }\n};\n\nexport default toJson;\n","/**\n * setCookie / getCookie / deleteCookie\n * From https://stackoverflow.com/questions/1458724/how-do-i-set-unset-cookie-with-jquery/1458728#1458728\n */\nconst setCookie = (name, value, option) => {\n let longTime = 10;\n // let path = '; path=/';\n let val = option && option.raw ? value : encodeURIComponent(value);\n let cookie = encodeURIComponent(name) + '=' + val;\n\n if (option) {\n if (option.days) {\n let date = new Date();\n let ms = option.days * 24 * 3600 * 1000;\n date.setTime(date.getTime() + ms);\n cookie += '; expires=' + date.toGMTString();\n } else if (option.hour) {\n let date = new Date();\n let ms = option.hour * 3600 * 1000;\n date.setTime(date.getTime() + ms);\n cookie += '; expires=' + date.toGMTString();\n } else {\n let date = new Date();\n let ms = longTime * 365 * 24 * 3600 * 1000;\n date.setTime(date.getTime() + ms);\n cookie += '; expires=' + date.toGMTString();\n }\n\n if (option.path) cookie += '; path=' + option.path;\n if (option.domain) cookie += '; domain=' + option.domain;\n if (option.secure) cookie += '; true';\n }\n\n document.cookie = cookie;\n};\n\nexport default setCookie;\n","import setCookie from './set_cookie';\n\nconst deleteCookie = (name) => {\n setCookie(name, '', {\n hour: -1\n });\n};\n\nexport default deleteCookie;\n","/**\n * String\n */\nconst string = {\n /**\n * Remove spaces after removing previous string\n */\n trim: (str) => {\n let _str = str.replace(/^\\s+/, '');\n for (let i = str.length - 1; i >= 0; i--) {\n if (/\\S/.test(str.charAt(i))) {\n _str = str.slice(0, i + 1);\n break;\n }\n }\n return _str;\n },\n /**\n * Increase by 0 based on string length before string\n */\n fillZero: (target, n) => {\n let z = new Array(n).join('0');\n let str = z + target;\n let result = str.slice(-n);\n return result;\n },\n /**\n * Long string unique\n */\n longUnique: (target) => {\n let json = {};\n for (let index = 0; index < target.length; index++) {\n if (!json[target[index]]) {\n json[target[index]] = -1;\n }\n }\n let longString = '';\n for (let index = 0; index < target.length; index++) {\n if (json[target[index]]) {\n json[target[index]] = 0;\n longString = longString + target[index];\n }\n }\n return longString;\n },\n\n /**\n * Remove the html tags inside the script\n */\n stripTags: (target) => {\n return target.replace(/]*>(\\S\\s*?)<\\/script>/gim, '').replace(/<[^>]+>/g, '');\n },\n /**\n * Capitalizes the first letter of a string.\n */\n capitalize: (target) => {\n return target.charAt(0).toUpperCase() + target.slice(1).toLowerCase();\n },\n /**\n * DeCapitalizes the first letter of a string.\n */\n deCapitalize: ([first, ...rest], upperRest = false) =>\n first.toLowerCase() + (upperRest ? rest.join('').toUpperCase() : rest.join('')),\n /**\n * en:Returns true if the given string is an absolute URL, false otherwise.\n */\n isAbsoluteURL: (str) => /^[a-z][a-z0-9+.-]*:/.test(str),\n /**\n * Creates a new string with the results of calling a provided function\n * on every character in the calling string.\n */\n mapString: (str, fn) =>\n str\n .split('')\n .map((c, i) => fn(c, i, str))\n .join(''),\n /**\n * Replaces all but the last num of characters with the specified mask character.\n */\n mask: (cc, num = 4, mask = '*') => `${cc}`.slice(-num).padStart(`${cc}`.length, mask),\n /**\n * splitLines('This\\nis a\\nmultiline\\nstring.\\n') =>\n * ['This', 'is a', 'multiline', 'string.' , '']\n */\n splitLines: (str) => str.split(/\\r?\\n/),\n /**\n * _ or - to CamelCase\n */\n camelize: (target) => {\n if (target.indexOf('-') < 0 && target.indexOf('_') < 0) {\n return target;\n }\n return target.replace(/[-_][^-_]/g, function(match) {\n return match.charAt(1).toUpperCase();\n });\n },\n /**\n * Turn CamelCase to '_'\n */\n underscored: (target) => {\n return target.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toLowerCase();\n },\n\n /**\n * Turn '_' in a string into '-'\n */\n dasherize: function(target) {\n return this.underscored(target).replace(/_/g, '-');\n },\n\n /**\n * Truncates a string up to a specified length.\n * The default length is 3, and the truncated symbol defaults '...'\n */\n truncate: (str, num) => (str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str),\n\n /**\n * Returns the length of a string in bytes.\n */\n byteSize: (str) => new Blob([str]).size,\n\n /**\n * Returns the length of a string in bytes by Unicode (utf-8 utf8 utf-16 utf16)\n */\n byteLen: (str, charset) => {\n let target = 0;\n let charCode;\n let i;\n let len;\n let _charset = charset ? charset.toLowerCase() : '';\n if (_charset === 'utf-16' || _charset === 'utf16') {\n for (i = 0, len = str.length; i < len; i++) {\n charCode = str.charCodeAt(i);\n if (charCode <= 0xffff) {\n target += 2;\n } else {\n target += 4;\n }\n }\n } else {\n for (i = 0, len = str.length; i < len; i++) {\n charCode = str.charCodeAt(i);\n if (charCode <= 0x007f) {\n target += 1;\n } else if (charCode <= 0x07ff) {\n target += 2;\n } else if (charCode <= 0xffff) {\n target += 3;\n } else {\n target += 4;\n }\n }\n }\n return target;\n },\n /**\n * Repeat item, times times\n */\n repeat: (item, times) => {\n let s = item;\n let target = '';\n while (times > 0) {\n if (times % 2 === 1) {\n target += s;\n }\n if (times === 1) {\n break;\n }\n s += s;\n // eslint-disable-next-line no-param-reassign\n times = times >> 1;\n }\n return target;\n },\n /**\n * Item is the end of the target\n */\n endsWith: (target, item, ignore) => {\n let str = target.slice(-item.length);\n return ignore ? str.toLowerCase() === item.toLowerCase() : str === item;\n },\n\n /**\n * Item is the beginning of the target\n */\n startsWith: (target, item, ignore) => {\n let str = target.slice(0, item.length);\n return ignore ? str.toLowerCase() === item.toLowerCase() : str === item;\n },\n\n /**\n * Whether a string contains another string\n */\n contains: (target, item) => {\n // discuss at: https://locutus.io/golang/strings/Contains\n // original by: Kevin van Zonneveld (https://kvz.io)\n // example 1: bbo.string.contains('Kevin', 'K')\n // returns 1: true\n return String(target).indexOf(item) !== -1;\n },\n\n /**\n * XSS string filtering\n */\n xssFilter: (str) => {\n return str\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n },\n\n index: (s, sep) => {\n // discuss at: https://locutus.io/golang/strings/Index\n // original by: Kevin van Zonneveld (https://kvz.io)\n // example 1: Index('Kevin', 'K')\n // returns 1: 0\n // example 2: Index('Kevin', 'Z')\n // returns 2: -1\n return String(s).indexOf(sep);\n },\n\n capwords: (str) => {\n // example 1: capwords('kevin van zonneveld')\n // returns 1: 'Kevin Van Zonneveld'\n // example 2: capwords('HELLO WORLD')\n // returns 2: 'HELLO WORLD'\n\n let pattern = /^([a-z\\u00E0-\\u00FC])|\\s+([a-z\\u00E0-\\u00FC])/g;\n return String(str).replace(pattern, function($1) {\n return $1.toUpperCase();\n });\n }\n};\n\nexport { string };\n","/************************************************************************\n * localStorage && sessionStorage\n * Method for safely supporting localStorage sessionStorage 'setItem' 'getItem' 'removeItem' 'removeAll',\n * Some extension method 'has' 'get' adn Store prefix\n *************************************************************************/\nimport { string } from '../string/index';\n\nconst ulocalStorage = window.localStorage;\nconst ussesionStorage = window.sessionStorage;\nclass Storage {\n constructor(options) {\n const {\n type = 'local',\n prefix = 'bbo.storage',\n message = {\n setItem: 'write in',\n getItem: 'read',\n removeAll: 'remove all',\n removeItem: 'remove item'\n }\n } = options;\n this.prefix = prefix;\n this.type = type;\n this.message = message;\n if (type === 'local') {\n this._storage = ulocalStorage;\n } else if (type === 'session') {\n this._storage = ussesionStorage;\n }\n }\n\n doItem(func, action) {\n try {\n if (typeof func === 'function') {\n return func();\n }\n } catch (err) {\n this._warn(action);\n return null;\n }\n return true;\n }\n\n setItem(key, value) {\n if (typeof key === 'object') {\n Object.keys(key).forEach((k, index) => {\n this.doItem(\n () => this._storage.setItem(`${this.prefix}.${k}`, JSON.stringify(key[k])),\n 'setItem'\n );\n });\n } else {\n this.doItem(\n () => this._storage.setItem(`${this.prefix}.${key}`, JSON.stringify(value)),\n 'setItem'\n );\n }\n }\n\n has(...keys) {\n return keys.every((key, index) => this._storage.getItem(`${this.prefix}.${key}`));\n }\n\n get(...keys) {\n const result = {};\n keys.forEach((key, index) => {\n if (`${this._storage.getItem(`${this.prefix}.${key}`)}` !== 'null') {\n try {\n result[key] = JSON.parse(this._storage.getItem(`${this.prefix}.${key}`));\n } catch (err) {\n console.warn(this._warn('getItem'));\n }\n }\n });\n return result;\n }\n\n getItem(key) {\n return this.doItem(() => JSON.parse(this._storage.getItem(`${this.prefix}.${key}`)), 'getItem');\n }\n\n removeAll() {\n Object.keys(this._storage).forEach((k) => {\n if (string.contains(k, this.prefix)) {\n this._remove(`${k}`);\n }\n });\n }\n\n removeItem(...keys) {\n console.log(keys);\n keys.forEach((key, index) =>\n this.doItem(() => this._storage.removeItem(`${this.prefix}.${key}`), 'removeItem')\n );\n }\n\n _warn(action) {\n const { message } = this;\n console.warn(`Unable to ${message[action] || ''} ${this.type} Storage`);\n }\n\n _remove(keys) {\n this.doItem(() => this._storage.removeItem(`${keys}`), 'removeItem');\n }\n}\n\nconst storage = ({ type, prefix }) =>\n new Storage({\n type,\n prefix\n });\n\nexport default storage;\n","/**\n * getUrlParam / deleteUrlParam\n * From https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript\n */\n\nconst deleteUrlParam = (param, url = window.location.href) => {\n // prefer to use l.search if you have a location/link object\n let urlparts = url.split('?');\n if (urlparts.length >= 2) {\n let prefix = encodeURIComponent(param) + '=';\n let pars = urlparts[1].split(/[&;]/g);\n\n // reverse iteration as may be destructive\n for (let i = pars.length; i-- > 0; ) {\n // idiom for string.startsWith\n if (pars[i].lastIndexOf(prefix, 0) !== -1) {\n pars.splice(i, 1);\n }\n }\n return urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : '');\n } else {\n return url;\n }\n};\n\nexport default deleteUrlParam;\n","const objectParam = (arr) => {\n let str = '';\n if (Array.isArray(arr)) {\n str = arr\n .map(function(item) {\n return item.name + '=' + item.value;\n })\n .join('&');\n } else {\n str = objectParam(objectBigParam(arr));\n }\n return str;\n};\n\nconst objectBigParam = (obj) => {\n let arr = [];\n Object.keys(obj).forEach(function(k) {\n if (Array.isArray(obj[k])) {\n arr = arr.concat(\n obj[k].map(function(v) {\n return {\n name: k,\n value: v\n };\n })\n );\n } else {\n arr.push({\n name: k,\n value: obj[k]\n });\n }\n });\n return arr;\n};\n\nexport default objectParam;\n","export default function fill0(num) {\n let _num = parseFloat(num);\n return _num < 10 ? '0' + _num : _num;\n}\n","// bbo.randomFromA2B = bbo.randomA2B\nconst randomA2B = (a, b, int) => {\n let result = Math.random() * (b - a) + a;\n return int ? Math.floor(result) : result;\n};\n\nexport default randomA2B;\n","export default function getTag(src) {\n return Object.prototype.toString.call(src);\n}\n","import getTag from './get_tag';\n\nexport default function isObject(obj) {\n return getTag(obj) === '[object Object]';\n}\n","import getTag from './get_tag';\n\nexport default function isArray(arr) {\n return getTag(arr) === '[object Array]';\n}\n","import getTag from './get_tag';\n\nexport default function isString(str) {\n return getTag(str) === '[object String]';\n}\n","import getTag from './get_tag';\n\nexport default function isFunction(func) {\n return getTag(func) === '[object Function]';\n}\n","/* eslint-disable no-self-compare */\nexport default function is(x, y) {\n // inlined Object.is polyfill to avoid requiring consumers ship their own\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n // Added the nonzero y check to make Flow happy, but it is redundant\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n}\n","import is from \"./is\";\n\nexport default function isShallowEqual(objA, objB) {\n if (is(objA, objB)) {\n return true;\n }\n if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {\n return false;\n }\n const keysA = Object.keys(objA);\n const keysB = Object.keys(objB);\n if (keysA.length !== keysB.length) {\n return false;\n }\n let i = 0;\n while (i < keysA.length) {\n if (!hasOwnProperty(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {\n return false;\n }\n i += 1;\n }\n return true;\n}\n","/* eslint-disable max-params */\nconst charCodeOfDot = '.'.charCodeAt(0);\nconst reEscapeChar = /\\\\(\\\\)?/g;\nconst rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]/g;\n\nexport default function stringToPath(string) {\n const result = [];\n if (string.charCodeAt(0) === charCodeOfDot) {\n result.push('');\n }\n string.replace(rePropName, (match, expression, quote, subString) => {\n let key = match;\n if (quote) {\n key = subString.replace(reEscapeChar, '$1');\n } else if (expression) {\n key = expression.trim();\n }\n result.push(key);\n });\n return result;\n}\n","import isString from './is_string';\nimport stringToPath from \"./string_to_path\";\n\nexport default function toPath(value) {\n if (!isString(value)) {\n return [];\n }\n return stringToPath(value);\n}\n","/* eslint-disable eqeqeq */\n/* eslint-disable no-eq-null */\n/* eslint-disable no-param-reassign */\nimport isObject from './is_object';\nimport isArray from './is_array';\nimport toPath from './to_path';\n\nexport default function has(object, path) {\n if (!isObject(object)) {\n return false;\n }\n if (!isArray(path)) {\n path = toPath(path);\n }\n let index = -1;\n let length = path.length;\n let result = false;\n while (++index < length) {\n const key = String(path[index]);\n if (!(result = object != null && hasOwnProperty(object, key))) {\n break;\n }\n object = object[key];\n }\n // eslint-disable-next-line eqeqeq\n if (result || ++index != length) {\n return result;\n }\n return false;\n}\n","import isArray from './is_array';\nimport isObject from './is_object';\n\nexport default function reduce(src, func) {\n let i = 0;\n let acc = arguments[2];\n if (isArray(src)) {\n if (arguments.length !== 3) {\n acc = src[0];\n }\n while (i < src.length) {\n acc = func(acc, src[i], i, src);\n i += 1;\n }\n return acc;\n } else if (isObject(src)) {\n const keys = Object.keys(src);\n if (arguments.length !== 3) {\n acc = src[keys[0]];\n }\n while (i < keys.length) {\n const key = keys[i];\n acc = func(acc, src[key], key, src);\n i += 1;\n }\n return acc;\n }\n return acc;\n}\n","import isArray from './is_array';\nimport isObject from './is_object';\n\nexport default function forEach(src, func) {\n let i = 0;\n if (isArray(src)) {\n while (i < src.length) {\n const rst = func(src[i], i, src);\n if (rst === false) {\n break;\n }\n i += 1;\n }\n } else if (isObject(src)) {\n const keys = Object.keys(src);\n while (i < keys.length) {\n const key = keys[i];\n const rst = func(src[key], key, src);\n if (rst === false) {\n break;\n }\n i += 1;\n }\n }\n}\n","/* eslint-disable no-implicit-coercion */\n/* eslint-disable no-param-reassign */\n\nimport isObject from './is_object';\n\nexport default function debounce(func, wait, options) {\n let lastArgs;\n let lastThis;\n let maxWait;\n let result;\n let timerId;\n let lastCallTime;\n\n let lastInvokeTime = 0;\n let leading = false;\n let maxing = false;\n let trailing = true;\n\n // Bypass `requestAnimationFrame` by explicitly setting `wait=0`.\n const useRAF = !wait && wait !== 0 && typeof requestAnimationFrame === 'function';\n\n if (typeof func !== 'function') {\n throw new TypeError('Expected a function');\n }\n wait = +wait || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? Math.max(+options.maxWait || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n const args = lastArgs;\n const thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function startTimer(pendingFunc, wait) {\n if (useRAF) {\n cancelAnimationFrame(timerId);\n return requestAnimationFrame(pendingFunc);\n }\n return setTimeout(pendingFunc, wait);\n }\n\n // eslint-disable-next-line no-unused-vars\n function cancelTimer(id) {\n if (useRAF) {\n return cancelAnimationFrame(id);\n }\n clearTimeout(id);\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = startTimer(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n const timeSinceLastCall = time - lastCallTime;\n const timeSinceLastInvoke = time - lastInvokeTime;\n const timeWaiting = wait - timeSinceLastCall;\n\n return maxing ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;\n }\n\n function shouldInvoke(time) {\n const timeSinceLastCall = time - lastCallTime;\n const timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (\n lastCallTime === undefined ||\n timeSinceLastCall >= wait ||\n timeSinceLastCall < 0 ||\n (maxing && timeSinceLastInvoke >= maxWait)\n );\n }\n\n function timerExpired() {\n const time = Date.now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = startTimer(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function debounced(...args) {\n const time = Date.now();\n const isInvoking = shouldInvoke(time);\n\n lastArgs = args;\n // eslint-disable-next-line no-invalid-this\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = startTimer(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = startTimer(timerExpired, wait);\n }\n return result;\n }\n return debounced;\n}\n","/* eslint-disable no-return-assign */\n/* eslint-disable no-sequences */\nconst omit = (obj, arr) =>\n Object.keys(obj)\n .filter((k) => !arr.includes(k))\n .reduce((acc, key) => ((acc[key] = obj[key]), acc), {});\n\nexport default omit;\n","import version from './util/version';\nimport noConflict from './util/no_conflict';\n\n// device\nimport ua from './device/ua';\nimport isIos from './device/is_ios';\nimport isiPhone from './device/is_iphone';\nimport isIPad from './device/is_ipad';\nimport isAndroid from './device/is_android';\nimport isMobile from './device/is_mobile';\nimport isPC from './device/is_pc';\nimport isWeixin from './device/is_weixin';\nimport isNewsApp from './device/is_news_app';\nimport isQQ from './device/is_qq';\nimport mqqbrowser from './device/mqqbrowser';\nimport isTenvideo from './device/is_tenvideo';\nimport isIphoneXmodel from './device/is_iphonex_model';\nimport isIE from './device/is_ie';\nimport ieVersion from './device/ie_version';\n\n// log\nimport log from './log/log';\nimport logs from './log/logs';\nimport removeConsole from './log/remove_console';\n\n// args\nimport args from './args/args';\nimport trash from './args/trash';\nimport noop from './args/noop';\nimport merge from './args/merge';\nimport over from './args/over';\nimport call from './args/call';\n\n// bom\nimport open from './bom/open';\nimport trigger from './bom/trigger';\nimport stopPropagation from './bom/stop_propagation';\nimport g from './bom/g';\nimport gc from './bom/gc';\nimport c from './bom/c';\nimport query from './bom/query';\nimport show from './bom/show';\nimport hide from './bom/hide';\nimport copyToClipboard from './bom/copy_to_clipboard';\nimport elementContains from './bom/element_contains';\nimport formToObject from './bom/form_to_object';\nimport getStyle from './bom/get_style';\nimport setStyle from './bom/set_style';\nimport attr from './bom/attr';\n\n// other\nimport uuid from './other/uuid';\nimport hash from './other/hash';\nimport judge from './other/judge';\nimport getType from './other/get_type';\nimport isTypeof from './other/is_typeof';\nimport construct from './other/construct';\nimport paramsName from './other/params_name';\n\n// load\nimport loadImages from './load/load_images';\nimport loadjs from './load/loadjs';\nimport loadcss from './load/loadcss';\n\n// json\nimport toJson from './json/to_json';\n\n// cookie\nimport cookie from './cookie/cookie';\nimport setCookie from './cookie/set_cookie';\nimport getCookie from './cookie/get_cookie';\nimport deleteCookie from './cookie/delete_cookie';\nimport parseCookie from './cookie/parse_cookie';\n\n// storage\nimport storage from './storage/storage';\n\n// http\nimport getUrlParam from './http/get_url_param';\nimport setUrlParam from './http/set_url_param';\nimport deleteUrlParam from './http/delete_url_param';\nimport objectParam from './http/object_param';\nimport httpGet from './http/http_get';\nimport httpPost from './http/http_post';\n\n// times\nimport setTimesout from './times/set_timesout';\nimport clearTimesout from './times/clear_timesout';\nimport getDate from './times/get_date';\nimport formatPassTime from './times/format_pass_time';\nimport formatRemainTime from './times/format_remain_time';\nimport formatDuration from './times/format_duration';\n\n// fill\nimport fill0 from './fill/fill0';\nimport floor from './fill/floor';\nimport chainAsync from './fill/chain_async';\nimport numberFormat from './fill/number_format';\n\n// random\nimport randomColor from './random/random_color';\nimport randomA2B from './random/random_a2b';\nimport randomKey from './random/random_key';\n\n// behavior\nimport lockTouch from './behavior/lock_touch';\n\n// image\nimport checkImageSize from './image/check_image_size';\nimport imageOptimization from './image/image_optimization';\n\n// lodash\nimport getTag from './lodash/get_tag';\nimport hasOwnProperty from './lodash/has_own_property';\nimport isObject from './lodash/is_object';\nimport isArray from './lodash/is_array';\nimport isString from './lodash/is_string';\nimport isBoolean from './lodash/is_boolean';\nimport isNumber from './lodash/is_number';\nimport isMap from './lodash/is_map';\nimport isSet from './lodash/is_set';\nimport isFunction from './lodash/is_function';\nimport isEmpty from './lodash/is_empty';\nimport isShallowEqual from './lodash/is_shallow_equal';\nimport has from './lodash/has';\nimport toPath from './lodash/to_path';\nimport reduce from './lodash/reduce';\nimport forEach from './lodash/for_each';\nimport map from './lodash/map';\nimport find from './lodash/find';\nimport findIndex from './lodash/find_index';\nimport get from './lodash/get';\nimport debounce from './lodash/debounce';\nimport throttle from './lodash/throttle';\nimport pick from './lodash/pick';\nimport omit from './lodash/omit';\n\nimport { string } from './string/index';\nimport { array } from './array/index';\n\nexport default {\n // version\n version,\n noConflict,\n // device\n ua,\n isIos,\n isiPhone,\n isIPad,\n isAndroid,\n isMobile,\n isPC,\n isWeixin,\n isNewsApp,\n isQQ,\n mqqbrowser,\n isTenvideo,\n isIphoneXmodel,\n ieVersion,\n isIE,\n // log\n log,\n logs,\n removeConsole,\n // arguments\n args,\n trash,\n noop,\n merge,\n over,\n call,\n // bom\n open,\n trigger,\n stopPropagation,\n g,\n gc,\n c,\n query,\n show,\n hide,\n copyToClipboard,\n elementContains,\n formToObject,\n getStyle,\n setStyle,\n attr,\n // other\n uuid,\n hash,\n judge,\n judgment: judge,\n getType,\n isTypeof,\n construct,\n paramsName,\n // other function\n loadImages,\n loadjs,\n loadcss,\n toJson,\n toJSON: toJson,\n tojson: toJson,\n // cookie\n cookie,\n setCookie,\n getCookie,\n deleteCookie,\n delCookie: deleteCookie,\n parseCookie,\n // storage\n storage,\n // url\n getUrlParam,\n setUrlParam,\n deleteUrlParam,\n delUrlParam: deleteUrlParam,\n objectParam,\n httpGet,\n httpPost,\n // times\n setTimesout,\n clearTimesout,\n getDate,\n formatPassTime,\n formatRemainTime,\n formatDuration,\n // fill\n fill0,\n chainAsync,\n numberFormat,\n // random\n randomColor,\n randomA2B,\n randomFromA2B: randomA2B,\n randomKey,\n floor,\n // touch\n lockTouch,\n // image\n checkImageSize,\n imageOptimization,\n // lodash\n getTag,\n hasOwnProperty,\n isObject,\n isArray,\n isString,\n isBoolean,\n isNumber,\n isMap,\n isSet,\n isFunction,\n isEmpty,\n isShallowEqual,\n has,\n reduce,\n forEach,\n map,\n findIndex,\n find,\n toPath,\n get,\n debounce,\n throttle,\n pick,\n omit,\n // string\n string,\n // array\n array\n};\n","import ua from './ua';\n/**\n * detect IOS\n * From https://stackoverflow.com/questions/9038625/detect-if-device-is-ios\n * more see:\n * https://github.com/madrobby/zepto/blob/master/src/detect.js#files\n */\n\nexport default function isIOS() {\n return /iPad|iPhone|iPod/.test(ua());\n}\n","import ua from './ua';\n\nexport default function iPhone() {\n return /iPhone/.test(ua());\n}\n","import ua from './ua';\n\nexport default function isIPad() {\n return /iPad/.test(ua());\n}","import ua from './ua';\n/**\n * detect Android\n * From https://stackoverflow.com/questions/6031412/detect-android-phone-via-javascript-jquery\n */\nexport default function isAndroid() {\n return ua('l').indexOf('android') > -1;\n}\n","import isMobile from './is_mobile';\n\n/**\n * detect PC / Mobile\n * From https://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-mobile-device-in-jquery\n */\nexport default function isPC() {\n return !isMobile();\n}\n","import ua from './ua';\n\nexport default function isWeixin() {\n return /MicroMessenger/i.test(ua('l')); // 微信\n}\n","import ua from './ua';\n\nexport default function isNewsApp() {\n return /qqnews/.test(ua()); // 腾讯新闻app\n}\n","import ua from './ua';\n\nexport default function isQQ() {\n return /qq\\//.test(ua()); // 手机QQ\n}\n","import ua from './ua';\n\nexport default function mqqbrowser() {\n return /mqqbrowser\\//.test(ua()); // QQ浏览器\n}\n","import ua from './ua';\n\nexport default function isTenvideo() {\n return /qqlivebrowser/.test(ua()); // 腾讯视频\n}\n","export default function isIphoneXmodel() {\n // X XS, XS Max, XR\n const xSeriesConfig = [\n {\n devicePixelRatio: 3,\n width: 375,\n height: 812\n },\n {\n devicePixelRatio: 3,\n width: 414,\n height: 896\n },\n {\n devicePixelRatio: 2,\n width: 414,\n height: 896\n }\n ];\n if (typeof window !== 'undefined' && window) {\n const { devicePixelRatio, screen } = window;\n const { width, height } = screen;\n return xSeriesConfig.some(\n (item) =>\n item.devicePixelRatio === devicePixelRatio && item.width === width && item.height === height\n );\n }\n return false;\n}\n","import ieVersion from './ie_version';\n\nexport default function isIE() {\n return ieVersion() > 0;\n}\n","/************************************************************************\n * LOGS\n *************************************************************************/\n/**\n * log on mobile html body\n */\n\nexport default function log(msg, styles) {\n let ele = document.getElementById('_bbo_log');\n if (ele === null) {\n ele = document.createElement('div');\n ele.setAttribute('id', '_bbo_log');\n ele.setAttribute('style', 'position:fixed;left:0;top:0;z-index:9999;padding:4px;');\n document.body.appendChild(ele);\n }\n\n if (styles) {\n for (let style in styles) {\n if (Object.prototype.hasOwnProperty.call(styles, style)) {\n ele.style[style] = styles[style];\n }\n }\n }\n ele.innerHTML = msg;\n}\n","export default function removeConsole(clear) {\n try {\n if (!window.console) window.console = {};\n window.console.log = window.console.info = window.console.dir = window.console.warn = window.console.trace = noop;\n if (clear === 'clear' && window.console.clear) window.console.clear();\n } catch (e) {}\n}\n","const noop = () => {};\n\nexport default noop;\n","const merge = (...objs) =>\n [...objs].reduce(\n (acc, obj) =>\n Object.keys(obj).reduce((a, k) => {\n acc[k] = acc.hasOwnProperty(k) ? [].concat(acc[k]).concat(obj[k]) : obj[k];\n return acc;\n }, {}),\n {}\n );\n\nexport default merge;\n","const over = (...fns) => (...args) => fns.map((fn) => fn.apply(null, args));\n\nexport default over;\n","const call = (key, ...args) => (context) => context[key](...args);\n\nexport default call;\n","import setStyle from './set_style';\nimport attr from './attr';\nimport trigger from './trigger';\nimport g from './g';\nimport c from './c';\n\n/**\n * open new url dont not blocked by browser\n */\nconst open = (href) => {\n let id = '_bbo_open_proxy';\n let a = g(id) || c('a', id, '', id);\n setStyle(a, 'display', 'none');\n attr(a, 'href', href);\n attr(a, 'target', '_blank');\n if (!a.parentNode) document.body.appendChild(a);\n trigger(a, 'click', 'MouseEvents');\n};\n\nexport default open;\n","const stopPropagation = (e) => {\n let _e = e || window.event;\n if (_e.stopPropagation) {\n _e.stopPropagation(); // W3C\n } else {\n _e.cancelBubble = true; // IE\n }\n};\n\nexport default stopPropagation;\n","export default function gc(cn) {\n return document.getElementsByClassName(cn);\n}\n","export default function query(i) {\n return document.querySelector(i);\n}\n","const show = (...el) =>\n [...el].forEach((e) => {\n e.style.display = '';\n });\n\nexport default show;\n","const hide = (...el) =>\n [...el].forEach((e) => {\n e.style.display = 'none';\n });\n\nexport default hide;\n","import attr from './attr';\nimport setStyle from './set_style';\n\nexport default function copyToClipboard(str) {\n const el = document.createElement('textarea');\n el.value = str;\n attr(el, 'readonly', '');\n setStyle(el, 'position', 'absolute');\n setStyle(el, 'left', '-9999px');\n document.body.appendChild(el);\n const selected =\n document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : false;\n el.select();\n document.execCommand('copy');\n document.body.removeChild(el);\n if (selected) {\n document.getSelection().removeAllRanges();\n document.getSelection().addRange(selected);\n }\n}\n","const elementContains = (parent, child) => parent !== child && parent.contains(child);\n\nexport default elementContains;\n","const formToObject = (form) =>\n Array.from(new FormData(form)).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: value\n }),\n {}\n );\n\nexport default formToObject;\n","const getStyle = (el, ruleName) => getComputedStyle(el)[ruleName];\n\nexport default getStyle;\n","/**\n * generate uuid\n * From https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript\n */\nexport default function uuid() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n let r = (Math.random() * 16) | 0;\n let v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n","const getType = (v) =>\n v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase();\n\nexport default getType;\n","export default function construct() {\n let classs = arguments[0];\n return new (Function.prototype.bind.apply(classs, arguments))();\n}\n","/**\n * Gets all the formal parameter names of a function\n * https://www.zhihu.com/question/28912825\n */\nexport default function paramsName(fn) {\n return /\\(\\s*([\\s\\S]*?)\\s*\\)/.exec(fn.toString())[1].split(/\\s*,\\s*/);\n}\n","/* eslint-disable no-invalid-this */\n\n/*\n * https://gist.github.com/pete-otaqui/3912307\n */\nexport default function loadcss(url, callback) {\n let promise;\n let resolutions = [];\n let rejections = [];\n let resolved = false;\n let rejected = false;\n let count;\n let id;\n\n this.count = this.count ? ++this.count : 1;\n count = this.count;\n id = 'load-css-' + count;\n\n promise = {\n done: function(callback) {\n resolutions.push(callback);\n if (resolved) callback();\n return promise;\n },\n fail: function(callback) {\n rejections.push(callback);\n if (rejected) callback();\n return promise;\n }\n };\n\n function resolve() {\n resolved = true;\n for (let i = 0, len = resolutions.length; i < len; i++) resolutions[i]();\n }\n\n function reject() {\n rejected = true;\n for (let i = 0, len = rejections.length; i < len; i++) rejections[i]();\n }\n\n let link = document.createElement('link');\n link.setAttribute('id', id);\n link.setAttribute('rel', 'stylesheet');\n link.setAttribute('type', 'text/css');\n if (typeof link.addEventListener !== 'undefined') {\n link.addEventListener('load', resolve, false);\n link.addEventListener('error', reject, false);\n } else if (typeof link.attachEvent !== 'undefined') {\n link.attachEvent('onload', function() {\n // IE 8 gives us onload for both success and failure\n // and also readyState is always \"completed\", even\n // for failure. The only way to see if a stylesheet\n // load failed from an external domain is to try and\n // access its cssText, and then catch the error\n // ... sweet :/\n let cur;\n let i = document.styleSheets.length;\n try {\n while (i--) {\n cur = document.styleSheets[i];\n if (cur.id === id) {\n resolve();\n return;\n }\n }\n } catch (e) {}\n if (!resolved) {\n reject();\n }\n });\n }\n document.getElementsByTagName('head')[0].appendChild(link);\n link.setAttribute('href', url);\n return promise;\n}\n","/**\n * cookie\n * https://github.com/jiayi2/onavo/blob/master/onavo.js#L209\n */\nconst cookie = () => {\n function _extend() {\n let i = 0;\n let result = {};\n for (; i < arguments.length; i++) {\n let attributes = arguments[i];\n for (let key in attributes) {\n if (Object.prototype.hasOwnProperty.call(key, attributes)) {\n result[key] = attributes[key];\n }\n }\n }\n return result;\n }\n\n function init(converter) {\n // #lizard forgives\n function api(key, value, attributes) {\n let result;\n if (typeof document === 'undefined') {\n return;\n }\n if (arguments.length > 1) {\n let _attributes = _extend(\n {\n path: '/'\n },\n api.defaults,\n attributes\n );\n\n if (typeof _attributes.expires === 'number') {\n let expires = new Date();\n expires.setMilliseconds(expires.getMilliseconds() + _attributes.expires * 864e5);\n _attributes.expires = expires;\n }\n let _value = value;\n try {\n result = JSON.stringify(_value);\n if (/^[\\{\\[]/.test(result)) {\n _value = result;\n }\n } catch (e) {}\n\n if (!converter.write) {\n _value = encodeURIComponent(String(_value)).replace(\n /%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,\n decodeURIComponent\n );\n } else {\n _value = converter.write(_value, key);\n }\n\n let _key = encodeURIComponent(String(key));\n let __key = _key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);\n let ___key = __key.replace(/[\\(\\)]/g, escape);\n let _cookie = (document.cookie = [\n ___key,\n '=',\n value,\n attributes.expires ? '; expires=' + attributes.expires.toUTCString() : '',\n attributes.path ? '; path=' + attributes.path : '',\n attributes.domain ? '; domain=' + attributes.domain : '',\n attributes.secure ? '; secure' : ''\n ].join(''));\n\n return _cookie;\n }\n if (!key) {\n result = {};\n }\n let cookies = document.cookie ? document.cookie.split('; ') : [];\n let setDecode = /(%[0-9A-Z]{2})+/g;\n let i = 0;\n\n for (; i < cookies.length; i++) {\n let parts = cookies[i].split('=');\n let cookie = parts.slice(1).join('=');\n\n if (cookie.charAt(0) === '\"') {\n cookie = cookie.slice(1, -1);\n }\n\n try {\n let name = parts[0].replace(setDecode, decodeURIComponent);\n cookie = converter.read\n ? converter.read(cookie, name)\n : converter(cookie, name) || cookie.replace(setDecode, decodeURIComponent);\n\n try {\n cookie = JSON.parse(cookie);\n } catch (e) {\n console.log(e);\n }\n\n if (key === name) {\n result = cookie;\n break;\n }\n\n if (!key) {\n result[name] = cookie;\n }\n } catch (e) {}\n }\n\n return result;\n }\n\n api.set = api;\n api.get = function(key) {\n return api.call(api, key);\n };\n api.getJSON = api.getjson = api.getJson = function() {\n return api.apply(\n {\n json: true\n },\n [].slice.call(arguments)\n );\n };\n api.defaults = {};\n\n api.remove = function(key, attributes) {\n api(\n key,\n '',\n _extend(attributes, {\n expires: -1\n })\n );\n };\n\n api.withConverter = init;\n\n return api;\n }\n return init(function() {});\n};\n\nexport default cookie;\n","const getCookie = (name) => {\n let nameEQ = encodeURIComponent(name) + '=';\n let ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length));\n }\n\n return null;\n};\n\nexport default getCookie;\n","const parseCookie = (str) =>\n str\n .split(';')\n .map((v) => v.split('='))\n .reduce((acc, v) => {\n acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim());\n return acc;\n }, {});\n\nexport default parseCookie;\n","/**\n * getUrlParam / deleteUrlParam\n * From https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript\n */\nconst getUrlParam = (name, url = window.location.href) => {\n name.replace(/[\\[\\]]/g, '\\\\$&');\n let regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)');\n let results = regex.exec(url);\n if (!results) return null;\n if (!results[2]) return '';\n\n return decodeURIComponent(results[2].replace(/\\+/g, ' '));\n};\n\nexport default getUrlParam;\n","/**\n * setUrlParam\n * From https://stackoverflow.com/questions/5999118/add-or-update-query-string-parameter\n */\nconst setUrlParam = (key, value, url = window.location.href) => {\n let re = new RegExp('([?|&])' + key + '=.*?(&|#|$)', 'i');\n\n if (url.match(re)) {\n return url.replace(re, '$1' + key + '=' + encodeURIComponent(value) + '$2');\n } else {\n let hash = '';\n if (url.indexOf('#') !== -1) {\n hash = url.replace(/.*#/, '#');\n url.replace(/#.*/, '');\n }\n let separator = url.indexOf('?') !== -1 ? '&' : '?';\n return url + separator + key + '=' + encodeURIComponent(value) + hash;\n }\n};\n\nexport default setUrlParam;\n","const httpGet = (url, callback, err = console.error) => {\n const request = new XMLHttpRequest();\n request.open('GET', url, true);\n request.onload = () => callback(request.responseText);\n request.onerror = () => err(request);\n request.send();\n};\n\nexport default httpGet;\n","// eslint-disable-next-line max-params\nconst httpPost = (url, data, callback, err = console.error) => {\n const request = new XMLHttpRequest();\n request.open('POST', url, true);\n request.setRequestHeader('Content-type', 'application/json; charset=utf-8');\n request.onload = () => callback(request.responseText);\n request.onerror = () => err(request);\n request.send(data);\n};\n\nexport default httpPost;\n","import args from '../args/args';\n/**\n * setInterval func fix times\n * https://stackoverflow.com/questions/2956966/javascript-telling-setinterval-to-only-fire-x-amount-of-times\n */\nexport default function setTimesout() {\n let func = arguments[0];\n let delay = arguments[1] === undefined ? 0 : parseFloat(arguments[1]);\n let times = arguments[2] === undefined ? 1 : parseInt(arguments[2], 10);\n let _args = arguments.length > 3 ? args(arguments, 3) : null;\n let target = {\n index: 0,\n times: times,\n over: false\n };\n\n let id = setInterval(function() {\n target.index++;\n if (target.index > times) {\n clearInterval(id);\n } else {\n if (target.index === times) target.over = true;\n func.apply(target, _args);\n }\n }, delay);\n\n return id;\n}\n","export default function clearTimesout(id) {\n clearInterval(id);\n}\n","import fill0 from '../fill/fill0';\n\n/**\n * getDate\n * https://stackoverflow.com/questions/1531093/how-do-i-get-the-current-date-in-javascript\n */\nconst getDate = (d1, d2) => {\n let today = new Date();\n\n let dd = today.getDate();\n let mm = today.getMonth() + 1;\n let yyyy = today.getFullYear();\n let hh = today.getHours();\n let ms = today.getMinutes();\n let ss = today.getSeconds();\n\n dd = fill0(dd);\n mm = fill0(mm);\n hh = fill0(hh);\n ms = fill0(ms);\n ss = fill0(ss);\n\n let _d1 = d1 || '/';\n let _d2 = d2 || ':';\n\n return yyyy + _d1 + mm + _d1 + dd + ' ' + hh + _d2 + ms + _d2 + ss;\n};\n\nexport default getDate;\n","/**\n * @ zh_cn\n * @desc 格式化${startTime}距现在的已过时间\n * @param {Date} startTime\n * @return {String}\n */\nconst formatPassTime = (startTime) => {\n let currentTime = Date.parse(new Date());\n let time = currentTime - startTime;\n let day = parseInt(time / (1000 * 60 * 60 * 24), 10);\n let hour = parseInt(time / (1000 * 60 * 60), 10);\n let min = parseInt(time / (1000 * 60), 10);\n let month = parseInt(day / 30, 10);\n let year = parseInt(month / 12, 10);\n if (year) return year + '年前';\n if (month) return month + '个月前';\n if (day) return day + '天前';\n if (hour) return hour + '小时前';\n if (min) return min + '分钟前';\n else return '刚刚';\n};\n\nexport default formatPassTime;\n","/**\n * @ zh_cn\n * @desc 格式化现在距${endTime}的剩余时间\n * @param {Date} endTime\n * @return {String}\n */\nconst formatRemainTime = (endTime) => {\n let startDate = new Date(); // 开始时间\n let endDate = new Date(endTime); // 结束时间\n let t = endDate.getTime() - startDate.getTime(); // 时间差\n let d = 0;\n let h = 0;\n let m = 0;\n let s = 0;\n if (t >= 0) {\n d = Math.floor(t / 1000 / 3600 / 24);\n h = Math.floor((t / 1000 / 60 / 60) % 24);\n m = Math.floor((t / 1000 / 60) % 60);\n s = Math.floor((t / 1000) % 60);\n }\n return d + '天 ' + h + '小时 ' + m + '分钟 ' + s + '秒';\n};\n\nexport default formatRemainTime;\n","/**\n * @ en\n * bbo.formatDuration(1001); // '1 second, 1 millisecond'\n * bbo.formatDuration(34325055574); // '397 days, 6 hours, 44 minutes, 15 seconds, 574 milliseconds'\n */\nconst formatDuration = (ms) => {\n // eslint-disable-next-line no-param-reassign\n if (ms < 0) ms = -ms;\n const time = {\n day: Math.floor(ms / 86400000),\n hour: Math.floor(ms / 3600000) % 24,\n minute: Math.floor(ms / 60000) % 60,\n second: Math.floor(ms / 1000) % 60,\n millisecond: Math.floor(ms) % 1000\n };\n return Object.entries(time)\n .filter((val) => val[1] !== 0)\n .map(([key, val]) => `${val} ${key}${val !== 1 ? 's' : ''}`)\n .join(', ');\n};\n\nexport default formatDuration;\n","const chainAsync = (fns) => {\n let curr = 0;\n const last = fns[fns.length - 1];\n const next = () => {\n const fn = fns[curr++];\n fn === last ? fn() : fn(next);\n };\n next();\n};\n\nexport default chainAsync;\n","/**\n * https://locutus.io/php/\n */\n// eslint-disable-next-line max-params\nconst numberFormat = (number, decimals, decPoint, thousandsSep) => {\n // example 1: bbo.math.numberFormat(1234.56)\n // returns 1: '1,235'\n // example 2: bbo.math.numberFormat(1234.56, 2, ',', ' ')\n // returns 2: '1 234,56'\n // example 3: bbo.math.numberFormat(1234.5678, 2, '.', '')\n // returns 3: '1234.57'\n // example 4: bbo.math.numberFormat(67, 2, ',', '.')\n // returns 4: '67,00'\n // example 5: bbo.math.numberFormat(1000)\n // returns 5: '1,000'\n // example 6: bbo.math.numberFormat(67.311, 2)\n // returns 6: '67.31'\n // example 7: bbo.math.numberFormat(1000.55, 1)\n // returns 7: '1,000.6'\n // example 8: bbo.math.numberFormat(67000, 5, ',', '.')\n // returns 8: '67.000,00000'\n // example 9: bbo.math.numberFormat(0.9, 0)\n // returns 9: '1'\n // example 10: bbo.math.numberFormat('1.20', 2)\n // returns 10: '1.20'\n // example 11: bbo.math.numberFormat('1.20', 4)\n // returns 11: '1.2000'\n // example 12: bbo.math.numberFormat('1.2000', 3)\n // returns 12: '1.200'\n // example 13: bbo.math.numberFormat('1 000,50', 2, '.', ' ')\n // returns 13: '100 050.00'\n // example 14: bbo.math.numberFormat(1e-8, 8, '.', '')\n // returns 14: '0.00000001'\n\n let _number = String(number).replace(/[^0-9+\\-Ee.]/g, '');\n let _decimals = decimals;\n let n = !isFinite(Number(_number)) ? 0 : Number(_number);\n let prec = !isFinite(Number(_decimals)) ? 0 : Math.abs(_decimals);\n let sep = typeof thousandsSep === 'undefined' ? ',' : thousandsSep;\n let dec = typeof decPoint === 'undefined' ? '.' : decPoint;\n let s = '';\n\n let toFixedFix = function(n, prec) {\n if (String(n).indexOf('e') === -1) {\n return Number(Math.round(n + 'e+' + prec) + 'e-' + prec);\n } else {\n let arr = String(n).split('e');\n let sig = '';\n if (Number(arr[1]) + prec > 0) {\n sig = '+';\n }\n return Number(\n Math.round(Number(arr[0]) + 'e' + sig + (Number(arr[1]) + prec)) + 'e-' + prec\n ).toFixed(prec);\n }\n };\n\n // @todo: for IE parseFloat(0.55).toFixed(0) = 0;\n s = (prec ? toFixedFix(n, prec).toString() : String(Math.round(n))).split('.');\n if (s[0].length > 3) {\n s[0] = s[0].replace(/\\B(?=(?:\\d{3})+(?!\\d))/g, sep);\n }\n if ((s[1] || '').length < prec) {\n s[1] = s[1] || '';\n s[1] += new Array(prec - s[1].length + 1).join('0');\n }\n\n return s.join(dec);\n};\n\nexport default numberFormat;\n","export default function randomColor() {\n return '#' + ('00000' + ((Math.random() * 0x1000000) << 0).toString(16)).slice(-6);\n}","const randomKey = (len = 32) => {\n /** Removed confusing characters 'oOLl,9gq,Vv,Uu,I1' **/\n let possible = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';\n let key = '';\n for (let i = 0; i < len; i++) {\n key += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n return key;\n};\n\nexport default randomKey;\n","const floor = (n, m = 0) => {\n return Math.floor(n * Math.pow(10, m)) / Math.pow(10, m);\n};\n\nexport default floor;\n","/**\n * lock touch in mobile phone\n */\nconst lockTouch = () => {\n document.addEventListener(\n 'touchmove',\n function(e) {\n e.preventDefault();\n },\n !1\n );\n document.addEventListener('touchstart', preventDefault, !1);\n document.addEventListener('touchend', preventDefault, !1);\n\n function not(e, tag) {\n return e.target.tagName !== tag.toUpperCase() && e.target.tagName !== tag.toLowerCase();\n }\n\n function preventDefault(e) {\n if (not(e, 'input') && not(e, 'textarea') && not(e, 'select') && not(e, 'menus'))\n e.preventDefault();\n }\n};\n\nexport default lockTouch;\n","/**\n * Check image size\n * @param {(Object|String)} image - image information,allow File Object or Data URLs\n * @param {Object} [options={}] - Check options\n * @param {Number} [options.width] - Check width\n * @param {Number} [options.height] - Check height\n * @param {Number} [deviation=0] - Allowable deviation\n */\n\nconst checkImageSize = (image, options, deviation = 0) => {\n return new Promise((resolve, reject) => {\n /**\n * Check type of image\n */\n if (image instanceof File) {\n const reader = new FileReader();\n reader.onload = function() {\n checkSize(this.result);\n };\n reader.readAsDataURL(image);\n } else if (typeof image === 'string') {\n checkSize(image);\n }\n\n /**\n * Check picture size\n * @param {String} data:Data URL\n */\n function checkSize(data) {\n const virtualImage = new Image();\n virtualImage.src = data;\n virtualImage.onload = function() {\n let width = this.naturalWidth;\n let height = this.naturalHeight;\n if (options.width && Math.abs(options.width - width) > deviation) {\n resolve(false);\n }\n if (options.height && Math.abs(options.height - height) > deviation) {\n resolve(false);\n }\n resolve(true);\n };\n }\n });\n};\n\nexport default checkImageSize;\n","/**\n * Image optimization\n * Gif images are not supported\n * @param {(Object|String)} - image ,supported File Object or Data URLs\n * @param {Number} [quality = 0.9] - Image quality, between 0 - 1, only image/jpeg or image/webp is accept.\n * @param {Object} [options = {}] - Image options\n * @param {Number} [options.maxWidth = 1920] - The maximum width of the output picture.\n * If the original width of the picture is less than this width, the original size picture is returned.\n * If the original width of the picture is greater than the width, the picture scaled to the size is returned.\n * @param {String} [options.mimeType] - Output image type,Types of MIME.\n * @returns {Object} Promise , resolve Function parameters are optimized pictures Blob Object,\n * If the output type is image/gif,Then return as is image Parameter content.\n */\nconst imageOptimization = (image, quality = 0.9, { maxWidth = 1920, mimeType } = {}) => {\n return new Promise((resolve, reject) => {\n if (image instanceof File) {\n const reader = new FileReader();\n reader.onload = function() {\n toBlob(this.result);\n };\n reader.readAsDataURL(image);\n } else if (typeof image === 'string') {\n toBlob(image);\n }\n\n /**\n * To Blob\n * @param {String} data - Image: Data URL\n */\n function toBlob(data) {\n const type = data.match(/data:([^;,]+)/);\n if (Array.isArray(type)) {\n const outputType = mimeType ? mimeType : type[1];\n\n if (outputType === 'image/gif') {\n return resolve(image);\n }\n\n const virtualImage = new Image();\n virtualImage.src = data;\n virtualImage.onload = function() {\n let width = this.naturalWidth;\n let height = this.naturalHeight;\n if (width > maxWidth) {\n height = Math.round((maxWidth * height) / width);\n width = maxWidth;\n }\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const context = canvas.getContext('2d');\n context.drawImage(this, 0, 0, width, height);\n canvas.toBlob(\n (blob) => {\n resolve(blob);\n },\n mimeType ? mimeType : type[1],\n quality\n );\n };\n } else {\n reject(new Error('Non-picture type Data URLs'));\n }\n }\n });\n};\n\nexport default imageOptimization;\n","export default function hasOwnProperty(obj, keyName) {\n return Object.prototype.hasOwnProperty.call(obj, keyName);\n}\n","import getTag from './get_tag';\n\nexport default function isBoolean(bool) {\n return getTag(bool) === '[object Boolean]';\n}\n","import getTag from './get_tag';\n\nexport default function isNumber(number) {\n return getTag(number) === '[object Number]';\n}\n","import getTag from './get_tag';\n\nexport default function isMap(map) {\n return getTag(map) === '[object Map]';\n}\n","import getTag from './get_tag';\n\nexport default function isSet(set) {\n return getTag(set) === '[object Set]';\n}\n","const isEmpty = (val) => val == null || !(Object.keys(val) || val).length;\n\nexport default isEmpty;","import isArray from './is_array';\nimport isObject from './is_object';\n\nexport default function map(src, func) {\n const rst = [];\n let i = 0;\n if (isArray(src)) {\n while (i < src.length) {\n rst.push(func(src[i], i, src));\n i += 1;\n }\n } else if (isObject(src)) {\n const keys = Object.keys(src);\n while (i < keys.length) {\n const key = keys[i];\n rst.push(func(src[key], key, src));\n i += 1;\n }\n }\n return rst;\n}\n","import forEach from './for_each';\nimport isFunction from './is_function';\nimport isObject from './is_object';\nimport is from './is';\nimport isShallowEqual from './is_shallow_equal';\n\nexport default function findIndex(src, func) {\n let rst = -1;\n forEach(src, (item, index, obj) => {\n if (isFunction(func)) {\n if (func(item, index, obj) === true) {\n rst = index;\n return false;\n }\n } else if (is(item, func)) {\n rst = index;\n return false;\n } else if (isObject(item) && isObject(func)) {\n let subEqual = true;\n forEach(func, (v, k) => {\n subEqual = isShallowEqual(item[k], v);\n return subEqual;\n });\n if (subEqual) {\n rst = index;\n return false;\n }\n }\n });\n return rst;\n}\n","import forEach from './for_each';\nimport isFunction from './is_function';\nimport isObject from './is_object';\nimport is from './is';\nimport isShallowEqual from './is_shallow_equal';\n\nexport default function find(src, func) {\n // eslint-disable-next-line no-undef-init\n let rst = undefined;\n forEach(src, (item, key, obj) => {\n if (isFunction(func)) {\n if (func(item, key, obj) === true) {\n rst = item;\n return false;\n }\n } else if (is(item, func)) {\n rst = item;\n return false;\n } else if (isObject(item) && isObject(func)) {\n let subEqual = true;\n forEach(func, (v, k) => {\n subEqual = isShallowEqual(item[k], v);\n return subEqual;\n });\n if (subEqual) {\n rst = item;\n return false;\n }\n }\n });\n return rst;\n}\n","/* eslint-disable no-param-reassign */\n/* eslint-disable eqeqeq */\n/* eslint-disable no-eq-null */\n\nimport stringToPath from './string_to_path';\nexport default function get(object, path, defaultValue) {\n if (object == null) {\n return defaultValue;\n }\n if (!Array.isArray(path)) {\n const reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/;\n const reIsPlainProp = /^\\w*$/;\n const isKey = function(value, object) {\n const type = typeof value;\n if (type == 'number' || type == 'boolean' || value == null) {\n return true;\n }\n return (\n reIsPlainProp.test(value) ||\n !reIsDeepProp.test(value) ||\n (object != null && value in Object(object))\n );\n };\n if (isKey(path, object)) {\n path = [path];\n } else {\n path = stringToPath(path);\n }\n }\n let index = 0;\n const length = path.length;\n while (object != null && index < length) {\n object = object[path[index]];\n index += 1;\n }\n if (index && index === length) {\n return object === undefined ? defaultValue : object;\n } else {\n return defaultValue;\n }\n}\n","import isObject from './is_object';\nimport debounce from './debounce';\n\nexport default function throttle(func, wait, options) {\n let leading = true;\n let trailing = true;\n\n if (typeof func !== 'function') {\n throw new TypeError('Expected a function');\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n leading,\n trailing,\n maxWait: wait\n });\n}\n","import reduce from './reduce';\nimport isArray from './is_array';\nimport forEach from './for_each';\nimport has from './has';\n\n// const pick = (obj, arr) =>\n// arr.reduce((acc, curr) => (curr in obj && (acc[curr] = obj[curr]), acc), {});\n\n// Only pick the first-level key,\nexport default function pick(object, ...paths) {\n if (object === null || object === undefined) {\n return {};\n }\n return reduce(\n paths,\n (rst, path) => {\n if (isArray(path)) {\n forEach(path, (item) => {\n if (has(object, item)) {\n rst[item] = object[item];\n }\n });\n } else {\n if (has(object, path)) {\n rst[path] = object[path];\n }\n }\n return rst;\n },\n {}\n );\n}\n","/**\n * Array\n */\nlet array = {\n /**\n * Returns all unique values of an array.\n */\n unique: (arr) => [...new Set(arr)],\n\n /**\n * Returns all unique values of an array, based on a provided comparator function.\n */\n uniqueBy: (arr, fn) =>\n arr.reduce((acc, v) => {\n if (!acc.some((x) => fn(v, x))) acc.push(v);\n return acc;\n }, []),\n\n /**\n * Remove duplicates from an array of objects\n * https://stackoverflow.com/questions/2218999/remove-duplicates-from-an-array-of-objects-in-javascript\n */\n uniqueFrom: (arr, target) => {\n return Object.values(arr.reduce((acc, cur) => Object.assign(acc, { [cur[target]]: cur }), {}));\n },\n\n /**\n * Returns a random element from an array.\n */\n random: (arr) => arr[Math.floor(Math.random() * arr.length)],\n\n /**\n * Gets n random elements at unique keys from array up to the size of array.\n */\n randomSize: ([...arr], n = 1) => {\n let m = arr.length;\n while (m) {\n const i = Math.floor(Math.random() * m--);\n [arr[m], arr[i]] = [arr[i], arr[m]];\n }\n return arr.slice(0, n);\n },\n\n /**\n * Randomizes the order of the values of an array, returning a new array.\n */\n shuffle: ([...arr]) => {\n let m = arr.length;\n while (m) {\n const i = Math.floor(Math.random() * m--);\n [arr[m], arr[i]] = [arr[i], arr[m]];\n }\n return arr;\n },\n\n /**\n * Returns true if the element has the specified Array, false otherwise.\n */\n contains: (target, item) => {\n return target.indexOf(item) > -1;\n },\n\n /**\n * Returns true if all the elements values are included in arr, false otherwise.\n */\n includesAll: (arr, values) => values.every((v) => arr.includes(v)),\n\n /**\n * Returns true if at least one element of values is included in arr , false otherwise.\n */\n includesAny: (arr, values) => values.some((v) => arr.includes(v)),\n\n /**\n * Remove the element specified by parameter 2 in parameter 1 and return Boolean\n */\n removeAt: function(target, index) {\n return !!target.splice(index, 1).length;\n },\n\n /**\n * Remove parameter 2 in parameter 1 and return boolean\n */\n remove: function(target, item) {\n let index = target.indexOf(item);\n return index > -1 ? this.removeAt(target, index) : false;\n },\n\n /**\n * Removes undefined and Null from an array.\n */\n compact: (target) => {\n return target.filter((item) => {\n return item !== undefined;\n });\n },\n\n /**\n * Removes falsy values from an array.\n * (false, null, 0, \"\", undefined, and NaN).\n */\n compactAll: (arr) => arr.filter(Boolean),\n\n /**\n * Get the attribute values in an array object and combine them into a new array\n */\n pluck: (target, name) => {\n let result = [];\n let temp;\n target.forEach(function(item) {\n temp = item[name];\n if (temp !== null) {\n result.push(temp);\n }\n });\n return result;\n },\n\n /**\n * Returns every element that exists in any of the two arrays once\n * Create a Set with all values of a and b and convert to an array.\n */\n union: (a, b) => Array.from(new Set([...a, ...b])),\n\n /**\n * Returns every element that exists in any of the two arrays once,\n * after applying the provided function to each array element of both.\n */\n unionBy: (a, b, fn) => {\n const s = new Set(a.map(fn));\n return Array.from(new Set([...a, ...b.filter((x) => !s.has(fn(x)))]));\n },\n\n /**\n * Returns every element that exists in any of the two arrays once,\n * using a provided comparator function.\n */\n unionWith: (a, b, comp) => {\n Array.from(new Set([...a, ...b.filter((x) => a.findIndex((y) => comp(x, y)) === -1)]));\n },\n\n /**\n * Returns a list of elements that exist in both arrays.\n */\n intersect: (a, b) => {\n const s = new Set(b);\n return a.filter((x) => s.has(x));\n },\n\n /**\n * Returns a list of elements that exist in both arrays,\n * after applying the provided function to each array element of both.\n */\n intersectBy: (a, b, fn) => {\n const s = new Set(b.map(fn));\n return a.filter((x) => s.has(fn(x)));\n },\n\n /**\n * Returns the difference between two arrays.\n * Create a Set from b, then use Array.prototype.\n * Filter() on a to only keep values not contained in b.\n */\n difference: (a, b) => {\n const s = new Set(b);\n return a.filter((x) => !s.has(x));\n },\n\n /**\n * Returns the difference between two arrays,\n * after applying the provided function to each array element of both.\n */\n differenceBy: (a, b, fn) => {\n const s = new Set(b.map(fn));\n return a.map(fn).filter((el) => !s.has(el));\n },\n\n /**\n * Returns the largest element in an array\n */\n max: (target) => {\n return Math.max.apply(0, target);\n },\n\n /**\n * Returns the smallest element in an array\n */\n min: (target) => {\n return Math.min.apply(0, target);\n },\n\n /**\n * Check two arrays are equal\n */\n equal: (arr1, arr2) => {\n if (arr1 === arr2) return true;\n if (arr1.length !== arr2.length) return false;\n for (let i = 0; i < arr1.length; ++i) {\n if (arr1[i] !== arr2[i]) return false;\n }\n return true;\n },\n\n /**\n * Check if all elements in an array are equal.\n */\n allEqual: (arr) => arr.every((val) => val === arr[0]),\n\n /**\n * Returns true if the provided predicate function returns true for all elements in a collection, false otherwise.\n */\n all: (arr, fn = Boolean) => arr.every(fn),\n\n /**\n * Returns true if the provided predicate function returns true for at least one element in a collection,\n * false otherwise.\n */\n any: (arr, fn = Boolean) => arr.some(fn),\n\n /**\n * Chunks an array into smaller arrays of a specified size.\n */\n chunk: (arr, size) => {\n Array.from({ length: Math.ceil(arr.length / size) }, (v, i) =>\n arr.slice(i * size, i * size + size)\n );\n },\n\n /**\n * Groups the elements of an array based on the given function and returns the count of elements in each group.\n */\n countBy: (arr, fn) => {\n arr.map(typeof fn === 'function' ? fn : (val) => val[fn]).reduce((acc, val) => {\n acc[val] = (acc[val] || 0) + 1;\n return acc;\n }, {});\n },\n\n /**\n * Counts the occurrences of a value in an array.\n */\n countOccurrences: (arr, val) => {\n arr.reduce((a, v) => (v === val ? a + 1 : a), 0);\n },\n\n /**\n * Returns a new array with n elements removed from the left.\n */\n drop: (arr, n = 1) => arr.slice(n),\n\n /**\n * Returns a new array with n elements removed from the right.\n */\n dropRight: (arr, n = 1) => arr.slice(0, -n),\n\n /**\n * Removes elements in an array until the passed function returns true.\n * Returns the remaining elements in the array.\n */\n dropWhile: (arr, func) => {\n let _arr = arr;\n while (_arr.length > 0 && !func(_arr[0])) _arr = _arr.slice(1);\n return _arr;\n },\n\n /**\n * Removes elements from the end of an array until the passed function returns true,\n * Returns the remaining elements in the array.\n */\n dropRightWhile: (arr, func) => {\n let rightIndex = arr.length;\n while (rightIndex-- && !func(arr[rightIndex]));\n return arr.slice(0, rightIndex + 1);\n },\n\n /**\n * discuss at: https://locutus.io/php/array_column/\n */\n column: (input, ColumnKey, IndexKey = null) => {\n let _input = input;\n if (_input !== null && (typeof _input === 'object' || Array.isArray(_input))) {\n let newArray = [];\n if (typeof _input === 'object') {\n let tempArray = [];\n for (let key of Object.keys(_input)) {\n tempArray.push(_input[key]);\n }\n _input = tempArray;\n }\n if (Array.isArray(_input)) {\n for (let key of _input.keys()) {\n if (IndexKey && _input[key][IndexKey]) {\n if (ColumnKey) {\n newArray[_input[key][IndexKey]] = _input[key][ColumnKey];\n } else {\n newArray[_input[key][IndexKey]] = _input[key];\n }\n } else {\n if (ColumnKey) {\n newArray.push(_input[key][ColumnKey]);\n } else {\n newArray.push(_input[key]);\n }\n }\n }\n }\n return { ...newArray };\n }\n },\n\n search: (needle, haystack, argStrict) => {\n // discuss at: https://locutus.io/php/array_search/'\n // example 1: bbo.array.search('3', {a: 3, b: 5, c: 7})\n // returns 1: 'a'\n\n let strict = !!argStrict;\n let key = '';\n let _needle = needle;\n\n if (typeof _needle === 'object' && _needle.exec) {\n // Duck-type for RegExp\n if (!strict) {\n // Let's consider case sensitive searches as strict\n let flags =\n 'i' +\n (_needle.global ? 'g' : '') +\n (_needle.multiline ? 'm' : '') +\n // sticky is FF only\n (_needle.sticky ? 'y' : '');\n _needle = new RegExp(_needle.source, flags);\n }\n for (key in haystack) {\n if (haystack.hasOwnProperty(key)) {\n if (_needle.test(haystack[key])) {\n return key;\n }\n }\n }\n return false;\n }\n\n for (key in haystack) {\n if (haystack.hasOwnProperty(key)) {\n // eslint-disable-next-line eqeqeq\n if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {\n return key;\n }\n }\n }\n\n return false;\n },\n\n unary: (fn) => (val) => fn(val)\n};\n\nexport { array };\n","/* eslint-disable no-invalid-this */\nimport functions from 'functions';\n\nfunction ChainWrapper(subject, explicitChain) {\n this._wrappedValue = subject;\n this._explicitChain = explicitChain;\n}\n\nChainWrapper.prototype.value = function() {\n return this._wrappedValue;\n};\n\nChainWrapper.prototype.valueOf = function() {\n return this.value();\n};\n\nChainWrapper.prototype.toJSON = function() {\n return this.value();\n};\n\nChainWrapper.prototype.toString = function() {\n return String(this.value());\n};\n\nChainWrapper.prototype.chain = function() {\n return new ChainWrapper(this._wrappedValue, true);\n};\n\nChainWrapper.prototype.thru = function(changer) {\n if (typeof changer === 'function') {\n return new ChainWrapper(changer(this._wrappedValue), this._explicitChain);\n }\n return this;\n};\n\nChainWrapper.prototype._explicitChain = true;\n\nfunction makeFunctionChainable(functionInstance) {\n return function(...args) {\n const result = functionInstance(this._wrappedValue, ...args);\n if (this._explicitChain || typeof result === 'string') {\n return new ChainWrapper(result, this._explicitChain);\n } else {\n return result;\n }\n };\n}\n\nObject.keys(functions).forEach(function(name) {\n ChainWrapper.prototype[name] = makeFunctionChainable(functions[name]);\n});\n\nexport default ChainWrapper;\n","import chain from './chain/chain';\nimport ChainWrapper from './chain/wrapper';\nimport functions from './functions';\n\nfunction bbo(subject) {\n return new ChainWrapper(subject, false);\n}\n\nObject.assign(bbo, functions, {\n chain: chain\n});\n\nexport default bbo;\n","import ChainWrapper from 'chain/wrapper';\n\nexport default function chain(subject) {\n return new ChainWrapper(subject, true);\n}\n"],"names":["globalObject","global","Object","self","Function","previousV","v","ua","lower","window","navigator","userAgent","toLowerCase","isMobile","test","ieVersion","uakit","msie","indexOf","parseInt","substring","rv","edge","args","$arguments","first","Array","prototype","slice","call","_cache","trash","clear","key","log","console","setStyle","el","ruleName","val","style","att","setAttribute","trigger","element","event","eventType","document","createEventObject","e","fireEvent","createEvent","initEvent","dispatchEvent","g","i","getElementById","c","t","cn","id","createElement","attr","innerHTML","hash","str","_str","String","length","charCodeAt","isTypeof","type","toString","judge","vals","strict","LoadImageItem","url","cb","this","img","Image","onReadyStateChange","removeEventHandlers","info","onError","onLoad","unbind","start","bind","src","complete","eventName","eventHandler","addEventListener","attachEvent","removeEventListener","detachEvent","urls","logs","_insertScripts","arr","callback","_insertScript","loaded","_index","script","getElementsByTagName","appendChild","onreadystatechange","readyState","onload","setTimeout","toJson","res","json","JSON","parse","setCookie","name","value","option","raw","encodeURIComponent","cookie","days","date","Date","ms","setTime","getTime","toGMTString","hour","longTime","path","domain","secure","deleteCookie","string","trim","replace","charAt","fillZero","target","n","join","longUnique","index","longString","stripTags","capitalize","toUpperCase","deCapitalize","rest","upperRest","isAbsoluteURL","mapString","fn","split","map","mask","cc","num","padStart","splitLines","camelize","match","underscored","dasherize","truncate","byteSize","Blob","size","byteLen","charset","charCode","len","_charset","repeat","item","times","s","endsWith","ignore","startsWith","contains","xssFilter","sep","capwords","$1","ulocalStorage","localStorage","ussesionStorage","sessionStorage","Storage","constructor","options","prefix","message","setItem","getItem","removeAll","removeItem","_storage","doItem","func","action","err","_warn","keys","forEach","k","stringify","has","every","get","result","warn","_remove","deleteUrlParam","param","location","href","urlparts","pars","lastIndexOf","splice","objectParam","isArray","objectBigParam","obj","concat","push","fill0","_num","parseFloat","randomA2B","a","b","int","Math","random","floor","getTag","isObject","isString","isFunction","is","x","y","isShallowEqual","objA","objB","keysA","keysB","hasOwnProperty","charCodeOfDot","reEscapeChar","rePropName","stringToPath","expression","quote","subString","toPath","object","reduce","acc","arguments","debounce","wait","lastArgs","lastThis","maxWait","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","useRAF","requestAnimationFrame","TypeError","invokeFunc","time","thisArg","undefined","apply","startTimer","pendingFunc","cancelAnimationFrame","leadingEdge","timerExpired","shouldInvoke","timeSinceLastCall","now","trailingEdge","timeSinceLastInvoke","timeWaiting","min","remainingWait","max","isInvoking","version","noConflict","isIos","isiPhone","isIPad","isAndroid","isPC","isWeixin","isNewsApp","isQQ","mqqbrowser","isTenvideo","isIphoneXmodel","devicePixelRatio","screen","width","height","some","isIE","msg","styles","ele","body","onlyId","logsCache","once","removeConsole","dir","trace","noop","merge","objs","over","fns","context","open","parentNode","stopPropagation","_e","cancelBubble","gc","getElementsByClassName","query","querySelector","show","display","hide","copyToClipboard","selected","getSelection","rangeCount","getRangeAt","select","execCommand","removeChild","removeAllRanges","addRange","elementContains","parent","child","formToObject","form","from","FormData","getStyle","getComputedStyle","uuid","r","judgment","getType","construct","classs","paramsName","exec","loadImages","curIndex","stepTimer","percentageValue","targetPercent","data","step","needOneStep","processStep","clearTimeout","loadjs","loadcss","promise","count","resolutions","rejections","resolved","rejected","resolve","reject","done","fail","link","styleSheets","toJSON","tojson","_extend","attributes","init","converter","api","_attributes","defaults","expires","setMilliseconds","getMilliseconds","_value","write","decodeURIComponent","_key","__key","___key","escape","_cookie","toUTCString","cookies","setDecode","parts","read","set","getJSON","getjson","getJson","remove","withConverter","getCookie","nameEQ","ca","delCookie","parseCookie","storage","getUrlParam","regex","RegExp","results","setUrlParam","re","separator","delUrlParam","httpGet","error","request","XMLHttpRequest","responseText","onerror","send","httpPost","setRequestHeader","setTimesout","delay","_args","setInterval","clearInterval","clearTimesout","getDate","d1","d2","today","dd","mm","getMonth","yyyy","getFullYear","hh","getHours","getMinutes","ss","getSeconds","_d1","_d2","formatPassTime","startTime","day","month","year","formatRemainTime","endTime","startDate","d","h","m","formatDuration","minute","second","millisecond","entries","filter","chainAsync","curr","last","next","numberFormat","number","decimals","decPoint","thousandsSep","_number","_decimals","isFinite","Number","prec","abs","dec","round","sig","toFixed","toFixedFix","randomColor","randomFromA2B","randomKey","possible","pow","lockTouch","not","tag","tagName","preventDefault","checkImageSize","image","deviation","Promise","File","reader","FileReader","checkSize","readAsDataURL","virtualImage","naturalWidth","naturalHeight","imageOptimization","quality","maxWidth","mimeType","toBlob","canvas","getContext","drawImage","blob","Error","keyName","isBoolean","bool","isNumber","isMap","isSet","isEmpty","rst","findIndex","subEqual","find","defaultValue","reIsDeepProp","reIsPlainProp","isKey","throttle","pick","paths","omit","includes","array","unique","Set","uniqueBy","uniqueFrom","values","cur","_extends","randomSize","shuffle","includesAll","includesAny","removeAt","compact","compactAll","Boolean","pluck","temp","union","unionBy","unionWith","comp","intersect","intersectBy","difference","differenceBy","equal","arr1","arr2","allEqual","all","any","chunk","ceil","countBy","countOccurrences","drop","dropRight","dropWhile","_arr","dropRightWhile","rightIndex","column","input","ColumnKey","IndexKey","_input","newArray","tempArray","search","needle","haystack","argStrict","_needle","flags","multiline","sticky","source","unary","ChainWrapper","subject","explicitChain","_wrappedValue","_explicitChain","bbo","valueOf","chain","thru","changer","functions","functionInstance"],"mappings":"kwCAAA,ICAIA,EAAe,KCGnB,IAAMA,EDAiB,OAAjBA,EACKA,EAMPA,EAFoB,iBAAXC,QAAuBA,OAAOC,SAAWA,OAEnCD,OACU,iBAATE,MAAqBA,KAAKD,SAAWA,OAEtCC,KAIA,IAAIC,SAAS,cAAb,GCbbC,EAAYL,EAAaM,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AKK,GAAW,CAC5BH,MCPa,SAAeN,UACrB,IAAID,GAAaC,GAAS"} \ No newline at end of file diff --git a/dist_mod/cookie.js b/dist_mod/cookie.js deleted file mode 100644 index cbf6cbf..0000000 --- a/dist_mod/cookie.js +++ /dev/null @@ -1,140 +0,0 @@ -'use strict'; - -/** - * cookie - * https://github.com/jiayi2/onavo/blob/master/onavo.js#L209 - */ -var cookie = () => { - function _extend() { - var i = 0; - var result = {}; - - for (; i < arguments.length; i++) { - var attributes = arguments[i]; - - for (var key in attributes) { - if (Object.prototype.hasOwnProperty.call(key, attributes)) { - result[key] = attributes[key]; - } - } - } - - return result; - } - - function init(converter) { - // #lizard forgives - function api(key, value, attributes) { - var result; - - if (typeof document === 'undefined') { - return; - } - - if (arguments.length > 1) { - var _attributes = _extend({ - path: '/' - }, api.defaults, attributes); - - if (typeof _attributes.expires === 'number') { - var expires = new Date(); - expires.setMilliseconds(expires.getMilliseconds() + _attributes.expires * 864e5); - _attributes.expires = expires; - } - - var _value = value; - - try { - result = JSON.stringify(_value); - - if (/^[\{\[]/.test(result)) { - _value = result; - } - } catch (e) {} - - if (!converter.write) { - _value = encodeURIComponent(String(_value)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); - } else { - _value = converter.write(_value, key); - } - - var _key = encodeURIComponent(String(key)); - - var __key = _key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); - - var ___key = __key.replace(/[\(\)]/g, escape); - - var _cookie = document.cookie = [___key, '=', value, attributes.expires ? '; expires=' + attributes.expires.toUTCString() : '', attributes.path ? '; path=' + attributes.path : '', attributes.domain ? '; domain=' + attributes.domain : '', attributes.secure ? '; secure' : ''].join(''); - - return _cookie; - } - - if (!key) { - result = {}; - } - - var cookies = document.cookie ? document.cookie.split('; ') : []; - var setDecode = /(%[0-9A-Z]{2})+/g; - var i = 0; - - for (; i < cookies.length; i++) { - var parts = cookies[i].split('='); - - var _cookie2 = parts.slice(1).join('='); - - if (_cookie2.charAt(0) === '"') { - _cookie2 = _cookie2.slice(1, -1); - } - - try { - var name = parts[0].replace(setDecode, decodeURIComponent); - _cookie2 = converter.read ? converter.read(_cookie2, name) : converter(_cookie2, name) || _cookie2.replace(setDecode, decodeURIComponent); - - try { - _cookie2 = JSON.parse(_cookie2); - } catch (e) { - console.log(e); - } - - if (key === name) { - result = _cookie2; - break; - } - - if (!key) { - result[name] = _cookie2; - } - } catch (e) {} - } - - return result; - } - - api.set = api; - - api.get = function (key) { - return api.call(api, key); - }; - - api.getJSON = api.getjson = api.getJson = function () { - return api.apply({ - json: true - }, [].slice.call(arguments)); - }; - - api.defaults = {}; - - api.remove = function (key, attributes) { - api(key, '', _extend(attributes, { - expires: -1 - })); - }; - - api.withConverter = init; - return api; - } - - return init(function () {}); -}; - -module.exports = cookie; diff --git a/dist_mod/es/cookie.js b/dist_mod/es/cookie.js deleted file mode 100644 index 461bbdf..0000000 --- a/dist_mod/es/cookie.js +++ /dev/null @@ -1,138 +0,0 @@ -/** - * cookie - * https://github.com/jiayi2/onavo/blob/master/onavo.js#L209 - */ -var cookie = () => { - function _extend() { - var i = 0; - var result = {}; - - for (; i < arguments.length; i++) { - var attributes = arguments[i]; - - for (var key in attributes) { - if (Object.prototype.hasOwnProperty.call(key, attributes)) { - result[key] = attributes[key]; - } - } - } - - return result; - } - - function init(converter) { - // #lizard forgives - function api(key, value, attributes) { - var result; - - if (typeof document === 'undefined') { - return; - } - - if (arguments.length > 1) { - var _attributes = _extend({ - path: '/' - }, api.defaults, attributes); - - if (typeof _attributes.expires === 'number') { - var expires = new Date(); - expires.setMilliseconds(expires.getMilliseconds() + _attributes.expires * 864e5); - _attributes.expires = expires; - } - - var _value = value; - - try { - result = JSON.stringify(_value); - - if (/^[\{\[]/.test(result)) { - _value = result; - } - } catch (e) {} - - if (!converter.write) { - _value = encodeURIComponent(String(_value)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); - } else { - _value = converter.write(_value, key); - } - - var _key = encodeURIComponent(String(key)); - - var __key = _key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); - - var ___key = __key.replace(/[\(\)]/g, escape); - - var _cookie = document.cookie = [___key, '=', value, attributes.expires ? '; expires=' + attributes.expires.toUTCString() : '', attributes.path ? '; path=' + attributes.path : '', attributes.domain ? '; domain=' + attributes.domain : '', attributes.secure ? '; secure' : ''].join(''); - - return _cookie; - } - - if (!key) { - result = {}; - } - - var cookies = document.cookie ? document.cookie.split('; ') : []; - var setDecode = /(%[0-9A-Z]{2})+/g; - var i = 0; - - for (; i < cookies.length; i++) { - var parts = cookies[i].split('='); - - var _cookie2 = parts.slice(1).join('='); - - if (_cookie2.charAt(0) === '"') { - _cookie2 = _cookie2.slice(1, -1); - } - - try { - var name = parts[0].replace(setDecode, decodeURIComponent); - _cookie2 = converter.read ? converter.read(_cookie2, name) : converter(_cookie2, name) || _cookie2.replace(setDecode, decodeURIComponent); - - try { - _cookie2 = JSON.parse(_cookie2); - } catch (e) { - console.log(e); - } - - if (key === name) { - result = _cookie2; - break; - } - - if (!key) { - result[name] = _cookie2; - } - } catch (e) {} - } - - return result; - } - - api.set = api; - - api.get = function (key) { - return api.call(api, key); - }; - - api.getJSON = api.getjson = api.getJson = function () { - return api.apply({ - json: true - }, [].slice.call(arguments)); - }; - - api.defaults = {}; - - api.remove = function (key, attributes) { - api(key, '', _extend(attributes, { - expires: -1 - })); - }; - - api.withConverter = init; - return api; - } - - return init(function () {}); -}; - -export default cookie; diff --git a/dist_mod/es/index.js b/dist_mod/es/index.js deleted file mode 100644 index af7230e..0000000 --- a/dist_mod/es/index.js +++ /dev/null @@ -1,399 +0,0 @@ -import { _ as _toConsumableArray, a as _extends, b as _toArray } from './internal/_rollupPluginBabelHelpers.js'; - -/** - * Array - */ -var array = { - /** - * Returns all unique values of an array. - */ - unique: arr => _toConsumableArray(new Set(arr)), - - /** - * Returns all unique values of an array, based on a provided comparator function. - */ - uniqueBy: (arr, fn) => arr.reduce((acc, v) => { - if (!acc.some(x => fn(v, x))) acc.push(v); - return acc; - }, []), - - /** - * Remove duplicates from an array of objects - * https://stackoverflow.com/questions/2218999/remove-duplicates-from-an-array-of-objects-in-javascript - */ - uniqueFrom: (arr, target) => { - return Object.values(arr.reduce((acc, cur) => _extends(acc, { - [cur[target]]: cur - }), {})); - }, - - /** - * Returns a random element from an array. - */ - random: arr => arr[Math.floor(Math.random() * arr.length)], - - /** - * Gets n random elements at unique keys from array up to the size of array. - */ - randomSize: function (_ref) { - var _ref2 = _toArray(_ref), - arr = _ref2.slice(0); - - var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; - var m = arr.length; - - while (m) { - var i = Math.floor(Math.random() * m--); - var _ref3 = [arr[i], arr[m]]; - arr[m] = _ref3[0]; - arr[i] = _ref3[1]; - } - - return arr.slice(0, n); - }, - - /** - * Randomizes the order of the values of an array, returning a new array. - */ - shuffle: (_ref4) => { - var _ref5 = _toArray(_ref4), - arr = _ref5.slice(0); - - var m = arr.length; - - while (m) { - var i = Math.floor(Math.random() * m--); - var _ref6 = [arr[i], arr[m]]; - arr[m] = _ref6[0]; - arr[i] = _ref6[1]; - } - - return arr; - }, - - /** - * Returns true if the element has the specified Array, false otherwise. - */ - contains: (target, item) => { - return target.indexOf(item) > -1; - }, - - /** - * Returns true if all the elements values are included in arr, false otherwise. - */ - includesAll: (arr, values) => values.every(v => arr.includes(v)), - - /** - * Returns true if at least one element of values is included in arr , false otherwise. - */ - includesAny: (arr, values) => values.some(v => arr.includes(v)), - - /** - * Remove the element specified by parameter 2 in parameter 1 and return Boolean - */ - removeAt: function (target, index) { - return !!target.splice(index, 1).length; - }, - - /** - * Remove parameter 2 in parameter 1 and return boolean - */ - remove: function (target, item) { - var index = target.indexOf(item); - return index > -1 ? this.removeAt(target, index) : false; - }, - - /** - * Removes undefined and Null from an array. - */ - compact: target => { - return target.filter(item => { - return item !== undefined; - }); - }, - - /** - * Removes falsy values from an array. - * (false, null, 0, "", undefined, and NaN). - */ - compactAll: arr => arr.filter(Boolean), - - /** - * Get the attribute values in an array object and combine them into a new array - */ - pluck: (target, name) => { - var result = []; - var temp; - target.forEach(function (item) { - temp = item[name]; - - if (temp !== null) { - result.push(temp); - } - }); - return result; - }, - - /** - * Returns every element that exists in any of the two arrays once - * Create a Set with all values of a and b and convert to an array. - */ - union: (a, b) => Array.from(new Set([].concat(_toConsumableArray(a), _toConsumableArray(b)))), - - /** - * Returns every element that exists in any of the two arrays once, - * after applying the provided function to each array element of both. - */ - unionBy: (a, b, fn) => { - var s = new Set(a.map(fn)); - return Array.from(new Set([].concat(_toConsumableArray(a), _toConsumableArray(b.filter(x => !s.has(fn(x))))))); - }, - - /** - * Returns every element that exists in any of the two arrays once, - * using a provided comparator function. - */ - unionWith: (a, b, comp) => { - Array.from(new Set([].concat(_toConsumableArray(a), _toConsumableArray(b.filter(x => a.findIndex(y => comp(x, y)) === -1))))); - }, - - /** - * Returns a list of elements that exist in both arrays. - */ - intersect: (a, b) => { - var s = new Set(b); - return a.filter(x => s.has(x)); - }, - - /** - * Returns a list of elements that exist in both arrays, - * after applying the provided function to each array element of both. - */ - intersectBy: (a, b, fn) => { - var s = new Set(b.map(fn)); - return a.filter(x => s.has(fn(x))); - }, - - /** - * Returns the difference between two arrays. - * Create a Set from b, then use Array.prototype. - * Filter() on a to only keep values not contained in b. - */ - difference: (a, b) => { - var s = new Set(b); - return a.filter(x => !s.has(x)); - }, - - /** - * Returns the difference between two arrays, - * after applying the provided function to each array element of both. - */ - differenceBy: (a, b, fn) => { - var s = new Set(b.map(fn)); - return a.map(fn).filter(el => !s.has(el)); - }, - - /** - * Returns the largest element in an array - */ - max: target => { - return Math.max.apply(0, target); - }, - - /** - * Returns the smallest element in an array - */ - min: target => { - return Math.min.apply(0, target); - }, - - /** - * Check two arrays are equal - */ - equal: (arr1, arr2) => { - if (arr1 === arr2) return true; - if (arr1.length !== arr2.length) return false; - - for (var i = 0; i < arr1.length; ++i) { - if (arr1[i] !== arr2[i]) return false; - } - - return true; - }, - - /** - * Check if all elements in an array are equal. - */ - allEqual: arr => arr.every(val => val === arr[0]), - - /** - * Returns true if the provided predicate function returns true for all elements in a collection, false otherwise. - */ - all: function (arr) { - var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Boolean; - return arr.every(fn); - }, - - /** - * Returns true if the provided predicate function returns true for at least one element in a collection, - * false otherwise. - */ - any: function (arr) { - var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Boolean; - return arr.some(fn); - }, - - /** - * Chunks an array into smaller arrays of a specified size. - */ - chunk: (arr, size) => { - Array.from({ - length: Math.ceil(arr.length / size) - }, (v, i) => arr.slice(i * size, i * size + size)); - }, - - /** - * Groups the elements of an array based on the given function and returns the count of elements in each group. - */ - countBy: (arr, fn) => { - arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => { - acc[val] = (acc[val] || 0) + 1; - return acc; - }, {}); - }, - - /** - * Counts the occurrences of a value in an array. - */ - countOccurrences: (arr, val) => { - arr.reduce((a, v) => v === val ? a + 1 : a, 0); - }, - - /** - * Returns a new array with n elements removed from the left. - */ - drop: function (arr) { - var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; - return arr.slice(n); - }, - - /** - * Returns a new array with n elements removed from the right. - */ - dropRight: function (arr) { - var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; - return arr.slice(0, -n); - }, - - /** - * Removes elements in an array until the passed function returns true. - * Returns the remaining elements in the array. - */ - dropWhile: (arr, func) => { - var _arr = arr; - - while (_arr.length > 0 && !func(_arr[0])) { - _arr = _arr.slice(1); - } - - return _arr; - }, - - /** - * Removes elements from the end of an array until the passed function returns true, - * Returns the remaining elements in the array. - */ - dropRightWhile: (arr, func) => { - var rightIndex = arr.length; - - while (rightIndex-- && !func(arr[rightIndex])) { - } - - return arr.slice(0, rightIndex + 1); - }, - - /** - * discuss at: https://locutus.io/php/array_column/ - */ - column: function (input, ColumnKey) { - var IndexKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - var _input = input; - - if (_input !== null && (typeof _input === 'object' || Array.isArray(_input))) { - var newArray = []; - - if (typeof _input === 'object') { - var tempArray = []; - - for (var key of Object.keys(_input)) { - tempArray.push(_input[key]); - } - - _input = tempArray; - } - - if (Array.isArray(_input)) { - for (var _key of _input.keys()) { - if (IndexKey && _input[_key][IndexKey]) { - if (ColumnKey) { - newArray[_input[_key][IndexKey]] = _input[_key][ColumnKey]; - } else { - newArray[_input[_key][IndexKey]] = _input[_key]; - } - } else { - if (ColumnKey) { - newArray.push(_input[_key][ColumnKey]); - } else { - newArray.push(_input[_key]); - } - } - } - } - - return { ...newArray - }; - } - }, - search: (needle, haystack, argStrict) => { - // discuss at: https://locutus.io/php/array_search/' - // example 1: bbo.array.search('3', {a: 3, b: 5, c: 7}) - // returns 1: 'a' - var strict = !!argStrict; - var key = ''; - var _needle = needle; - - if (typeof _needle === 'object' && _needle.exec) { - // Duck-type for RegExp - if (!strict) { - // Let's consider case sensitive searches as strict - var flags = 'i' + (_needle.global ? 'g' : '') + (_needle.multiline ? 'm' : '') + ( // sticky is FF only - _needle.sticky ? 'y' : ''); - _needle = new RegExp(_needle.source, flags); - } - - for (key in haystack) { - if (haystack.hasOwnProperty(key)) { - if (_needle.test(haystack[key])) { - return key; - } - } - } - - return false; - } - - for (key in haystack) { - if (haystack.hasOwnProperty(key)) { - // eslint-disable-next-line eqeqeq - if (strict && haystack[key] === needle || !strict && haystack[key] == needle) { - return key; - } - } - } - - return false; - }, - unary: fn => val => fn(val) -}; - -export { array }; diff --git a/dist_mod/es/index2.js b/dist_mod/es/index2.js deleted file mode 100644 index 5d5a3d0..0000000 --- a/dist_mod/es/index2.js +++ /dev/null @@ -1,265 +0,0 @@ -import { b as _toArray } from './internal/_rollupPluginBabelHelpers.js'; - -/** - * String - */ -var string = { - /** - * Remove spaces after removing previous string - */ - trim: str => { - var _str = str.replace(/^\s+/, ''); - - for (var i = str.length - 1; i >= 0; i--) { - if (/\S/.test(str.charAt(i))) { - _str = str.slice(0, i + 1); - break; - } - } - - return _str; - }, - - /** - * Increase by 0 based on string length before string - */ - fillZero: (target, n) => { - var z = new Array(n).join('0'); - var str = z + target; - var result = str.slice(-n); - return result; - }, - - /** - * Long string unique - */ - longUnique: target => { - var json = {}; - - for (var index = 0; index < target.length; index++) { - if (!json[target[index]]) { - json[target[index]] = -1; - } - } - - var longString = ''; - - for (var _index = 0; _index < target.length; _index++) { - if (json[target[_index]]) { - json[target[_index]] = 0; - longString = longString + target[_index]; - } - } - - return longString; - }, - - /** - * Remove the html tags inside the script - */ - stripTags: target => { - return target.replace(/]*>(\S\s*?)<\/script>/gim, '').replace(/<[^>]+>/g, ''); - }, - - /** - * Capitalizes the first letter of a string. - */ - capitalize: target => { - return target.charAt(0).toUpperCase() + target.slice(1).toLowerCase(); - }, - - /** - * DeCapitalizes the first letter of a string. - */ - deCapitalize: function (_ref) { - var _ref2 = _toArray(_ref), - first = _ref2[0], - rest = _ref2.slice(1); - - var upperRest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - return first.toLowerCase() + (upperRest ? rest.join('').toUpperCase() : rest.join('')); - }, - - /** - * en:Returns true if the given string is an absolute URL, false otherwise. - */ - isAbsoluteURL: str => /^[a-z][a-z0-9+.-]*:/.test(str), - - /** - * Creates a new string with the results of calling a provided function - * on every character in the calling string. - */ - mapString: (str, fn) => str.split('').map((c, i) => fn(c, i, str)).join(''), - - /** - * Replaces all but the last num of characters with the specified mask character. - */ - mask: function (cc) { - var num = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4; - var mask = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '*'; - return `${cc}`.slice(-num).padStart(`${cc}`.length, mask); - }, - - /** - * splitLines('This\nis a\nmultiline\nstring.\n') => - * ['This', 'is a', 'multiline', 'string.' , ''] - */ - splitLines: str => str.split(/\r?\n/), - - /** - * _ or - to CamelCase - */ - camelize: target => { - if (target.indexOf('-') < 0 && target.indexOf('_') < 0) { - return target; - } - - return target.replace(/[-_][^-_]/g, function (match) { - return match.charAt(1).toUpperCase(); - }); - }, - - /** - * Turn CamelCase to '_' - */ - underscored: target => { - return target.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toLowerCase(); - }, - - /** - * Turn '_' in a string into '-' - */ - dasherize: function (target) { - return this.underscored(target).replace(/_/g, '-'); - }, - - /** - * Truncates a string up to a specified length. - * The default length is 3, and the truncated symbol defaults '...' - */ - truncate: (str, num) => str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str, - - /** - * Returns the length of a string in bytes. - */ - byteSize: str => new Blob([str]).size, - - /** - * Returns the length of a string in bytes by Unicode (utf-8 utf8 utf-16 utf16) - */ - byteLen: (str, charset) => { - var target = 0; - var charCode; - var i; - var len; - - var _charset = charset ? charset.toLowerCase() : ''; - - if (_charset === 'utf-16' || _charset === 'utf16') { - for (i = 0, len = str.length; i < len; i++) { - charCode = str.charCodeAt(i); - - if (charCode <= 0xffff) { - target += 2; - } else { - target += 4; - } - } - } else { - for (i = 0, len = str.length; i < len; i++) { - charCode = str.charCodeAt(i); - - if (charCode <= 0x007f) { - target += 1; - } else if (charCode <= 0x07ff) { - target += 2; - } else if (charCode <= 0xffff) { - target += 3; - } else { - target += 4; - } - } - } - - return target; - }, - - /** - * Repeat item, times times - */ - repeat: (item, times) => { - var s = item; - var target = ''; - - while (times > 0) { - if (times % 2 === 1) { - target += s; - } - - if (times === 1) { - break; - } - - s += s; // eslint-disable-next-line no-param-reassign - - times = times >> 1; - } - - return target; - }, - - /** - * Item is the end of the target - */ - endsWith: (target, item, ignore) => { - var str = target.slice(-item.length); - return ignore ? str.toLowerCase() === item.toLowerCase() : str === item; - }, - - /** - * Item is the beginning of the target - */ - startsWith: (target, item, ignore) => { - var str = target.slice(0, item.length); - return ignore ? str.toLowerCase() === item.toLowerCase() : str === item; - }, - - /** - * Whether a string contains another string - */ - contains: (target, item) => { - // discuss at: https://locutus.io/golang/strings/Contains - // original by: Kevin van Zonneveld (https://kvz.io) - // example 1: bbo.string.contains('Kevin', 'K') - // returns 1: true - return String(target).indexOf(item) !== -1; - }, - - /** - * XSS string filtering - */ - xssFilter: str => { - return str.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); - }, - index: (s, sep) => { - // discuss at: https://locutus.io/golang/strings/Index - // original by: Kevin van Zonneveld (https://kvz.io) - // example 1: Index('Kevin', 'K') - // returns 1: 0 - // example 2: Index('Kevin', 'Z') - // returns 2: -1 - return String(s).indexOf(sep); - }, - capwords: str => { - // example 1: capwords('kevin van zonneveld') - // returns 1: 'Kevin Van Zonneveld' - // example 2: capwords('HELLO WORLD') - // returns 2: 'HELLO WORLD' - var pattern = /^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g; - return String(str).replace(pattern, function ($1) { - return $1.toUpperCase(); - }); - } -}; - -export { string }; diff --git a/dist_mod/es/internal/_rollupPluginBabelHelpers.js b/dist_mod/es/internal/_rollupPluginBabelHelpers.js deleted file mode 100644 index 90d7b69..0000000 --- a/dist_mod/es/internal/_rollupPluginBabelHelpers.js +++ /dev/null @@ -1,85 +0,0 @@ -function _extends() { - _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - }; - - return _extends.apply(this, arguments); -} - -function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); -} - -function _toArray(arr) { - return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest(); -} - -function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); -} - -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } -} - -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} - -function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); -} - -function _iterableToArrayLimit(arr, i) { - if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { - return; - } - - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; -} - -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); -} - -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); -} - -export { _toConsumableArray as _, _extends as a, _toArray as b, _slicedToArray as c }; diff --git a/dist_mod/es/storage.js b/dist_mod/es/storage.js deleted file mode 100644 index 5aee398..0000000 --- a/dist_mod/es/storage.js +++ /dev/null @@ -1,128 +0,0 @@ -import './internal/_rollupPluginBabelHelpers.js'; -import { string } from './index2.js'; - -/************************************************************************ - * localStorage && sessionStorage - * Method for safely supporting localStorage sessionStorage 'setItem' 'getItem' 'removeItem' 'removeAll', - * Some extension method 'has' 'get' adn Store prefix - *************************************************************************/ -var ulocalStorage = window.localStorage; -var ussesionStorage = window.sessionStorage; - -class Storage { - constructor(options) { - var _options$type = options.type, - type = _options$type === void 0 ? 'local' : _options$type, - _options$prefix = options.prefix, - prefix = _options$prefix === void 0 ? 'bbo.storage' : _options$prefix, - _options$message = options.message, - message = _options$message === void 0 ? { - setItem: 'write in', - getItem: 'read', - removeAll: 'remove all', - removeItem: 'remove item' - } : _options$message; - this.prefix = prefix; - this.type = type; - this.message = message; - - if (type === 'local') { - this._storage = ulocalStorage; - } else if (type === 'session') { - this._storage = ussesionStorage; - } - } - - doItem(func, action) { - try { - if (typeof func === 'function') { - return func(); - } - } catch (err) { - this._warn(action); - - return null; - } - - return true; - } - - setItem(key, value) { - if (typeof key === 'object') { - Object.keys(key).forEach((k, index) => { - this.doItem(() => this._storage.setItem(`${this.prefix}.${k}`, JSON.stringify(key[k])), 'setItem'); - }); - } else { - this.doItem(() => this._storage.setItem(`${this.prefix}.${key}`, JSON.stringify(value)), 'setItem'); - } - } - - has() { - for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) { - keys[_key] = arguments[_key]; - } - - return keys.every((key, index) => this._storage.getItem(`${this.prefix}.${key}`)); - } - - get() { - var result = {}; - - for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - keys[_key2] = arguments[_key2]; - } - - keys.forEach((key, index) => { - if (`${this._storage.getItem(`${this.prefix}.${key}`)}` !== 'null') { - try { - result[key] = JSON.parse(this._storage.getItem(`${this.prefix}.${key}`)); - } catch (err) { - console.warn(this._warn('getItem')); - } - } - }); - return result; - } - - getItem(key) { - return this.doItem(() => JSON.parse(this._storage.getItem(`${this.prefix}.${key}`)), 'getItem'); - } - - removeAll() { - Object.keys(this._storage).forEach(k => { - if (string.contains(k, this.prefix)) { - this._remove(`${k}`); - } - }); - } - - removeItem() { - for (var _len3 = arguments.length, keys = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - keys[_key3] = arguments[_key3]; - } - - console.log(keys); - keys.forEach((key, index) => this.doItem(() => this._storage.removeItem(`${this.prefix}.${key}`), 'removeItem')); - } - - _warn(action) { - var message = this.message; - console.warn(`Unable to ${message[action] || ''} ${this.type} Storage`); - } - - _remove(keys) { - this.doItem(() => this._storage.removeItem(`${keys}`), 'removeItem'); - } - -} - -var storage = (_ref) => { - var type = _ref.type, - prefix = _ref.prefix; - return new Storage({ - type: type, - prefix: prefix - }); -}; - -export default storage; diff --git a/dist_mod/index.js b/dist_mod/index.js deleted file mode 100644 index 813b3b4..0000000 --- a/dist_mod/index.js +++ /dev/null @@ -1,3171 +0,0 @@ -/* - * bbo - * +++++++++ A utility belt library for modern JavaScript. +++++++++ - * (c) 2011-2019 tnfe - * https://github.com/tnfe/bbo.git - * version 1.1.10 - */ - -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.bbo = factory()); -}(this, (function () { 'use strict'; - - function _extends() { - _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - }; - - return _extends.apply(this, arguments); - } - - function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); - } - - function _toArray(arr) { - return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest(); - } - - function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); - } - - function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } - } - - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; - } - - function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); - } - - function _iterableToArrayLimit(arr, i) { - if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { - return; - } - - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; - } - - function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); - } - - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); - } - - var version = '1.1.10'; - - var globalObject = null; - - function getGlobalObject() { - if (globalObject !== null) { - return globalObject; - } - /* istanbul ignore next */ - // It's hard to mock the global variables. This code surely works fine. I hope :) - - - if (typeof global === 'object' && global.Object === Object) { - // NodeJS global object - globalObject = global; - } else if (typeof self === 'object' && self.Object === Object) { - // self property from Window object - globalObject = self; - } else { - // Other cases. Function constructor always has the context as global object - // eslint-disable-next-line no-new-func - globalObject = new Function('return this')(); - } - - return globalObject; - } - - /* eslint-disable no-invalid-this */ - var globalObject$1 = getGlobalObject(); - var previousV = globalObject$1.v; - function noConflict() { - if (this === globalObject$1.v) { - globalObject$1.v = previousV; - } - - return this; - } - - function ua(lower) { - return lower ? window.navigator.userAgent.toLowerCase() : window.navigator.userAgent; - } - - /** - * detect IOS - * From https://stackoverflow.com/questions/9038625/detect-if-device-is-ios - * more see: - * https://github.com/madrobby/zepto/blob/master/src/detect.js#files - */ - - function isIOS() { - return /iPad|iPhone|iPod/.test(ua()); - } - - function iPhone() { - return /iPhone/.test(ua()); - } - - function isIPad() { - return /iPad/.test(ua()); - } - - /** - * detect Android - * From https://stackoverflow.com/questions/6031412/detect-android-phone-via-javascript-jquery - */ - - function isAndroid() { - return ua('l').indexOf('android') > -1; - } - - /** - * detect PC / Mobile - * From https://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-mobile-device-in-jquery - */ - - function isMobile() { - return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(ua('l')); - } - - /** - * detect PC / Mobile - * From https://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-mobile-device-in-jquery - */ - - function isPC() { - return !isMobile(); - } - - function isWeixin() { - return /MicroMessenger/i.test(ua('l')); // 微信 - } - - function isNewsApp() { - return /qqnews/.test(ua()); // 腾讯新闻app - } - - function isQQ() { - return /qq\//.test(ua()); // 手机QQ - } - - function mqqbrowser() { - return /mqqbrowser\//.test(ua()); // QQ浏览器 - } - - function isTenvideo() { - return /qqlivebrowser/.test(ua()); // 腾讯视频 - } - - function isIphoneXmodel() { - // X XS, XS Max, XR - var xSeriesConfig = [{ - devicePixelRatio: 3, - width: 375, - height: 812 - }, { - devicePixelRatio: 3, - width: 414, - height: 896 - }, { - devicePixelRatio: 2, - width: 414, - height: 896 - }]; - - if (typeof window !== 'undefined' && window) { - var _window = window, - devicePixelRatio = _window.devicePixelRatio, - screen = _window.screen; - var width = screen.width, - height = screen.height; - return xSeriesConfig.some(item => item.devicePixelRatio === devicePixelRatio && item.width === width && item.height === height); - } - - return false; - } - - /** - * ie version - * From https://codepen.io/gapcode/pen/vEJNZN - * IE 10 ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)'; - * IE 11 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'; - * Edge 12 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0'; - * Edge 13 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586'; - */ - - function ieVersion() { - var uakit = ua(); - var msie = uakit.indexOf('MSIE '); - - if (msie > 0) { - return parseInt(uakit.substring(msie + 5, uakit.indexOf('.', msie)), 10); - } - - var trident = uakit.indexOf('Trident/'); - - if (trident > 0) { - var rv = uakit.indexOf('rv:'); - return parseInt(uakit.substring(rv + 3, uakit.indexOf('.', rv)), 10); - } - - var edge = uakit.indexOf('Edge/'); - - if (edge > 0) { - return parseInt(ua.substring(edge + 5, uakit.indexOf('.', edge)), 10); - } - - return ''; - } - - function isIE() { - return ieVersion() > 0; - } - - /************************************************************************ - * LOGS - *************************************************************************/ - - /** - * log on mobile html body - */ - function log(msg, styles) { - var ele = document.getElementById('_bbo_log'); - - if (ele === null) { - ele = document.createElement('div'); - ele.setAttribute('id', '_bbo_log'); - ele.setAttribute('style', 'position:fixed;left:0;top:0;z-index:9999;padding:4px;'); - document.body.appendChild(ele); - } - - if (styles) { - for (var style in styles) { - if (Object.prototype.hasOwnProperty.call(styles, style)) { - ele.style[style] = styles[style]; - } - } - } - - ele.innerHTML = msg; - } - - /** - * arguments to array - */ - function args($arguments, first) { - return Array.prototype.slice.call($arguments, first || 0); - } - - /************************************************************************ - * Private Method - *************************************************************************/ - - var _cache = { - urls: {}, - logs: {} - }; - /** - * bbo.logs('only id&10', 1, 2); - */ - - function logs() { - if (window.console && window.console.log) { - var onlyId = String(arguments[0]); - var times = parseInt(onlyId.split('&')[1], 10) || 10; - var logsCache = _cache.logs; - if (!logsCache[onlyId]) logsCache[onlyId] = {}; - if (!logsCache[onlyId].once) logsCache[onlyId].once = 1; - - if (logsCache[onlyId].once <= times) { - console.log.apply(console, args(arguments, 1)); - logsCache[onlyId].once++; - } - } - } - - function removeConsole(clear) { - try { - if (!window.console) window.console = {}; - window.console.log = window.console.info = window.console.dir = window.console.warn = window.console.trace = noop; - if (clear === 'clear' && window.console.clear) window.console.clear(); - } catch (e) {} - } - - /** - * a trash object - */ - var trash = { - clear: function () { - for (var key in trash) { - if (key !== 'log' && key !== 'clear') delete trash[key]; - } - }, - log: function () { - for (var key in trash) { - if (key !== 'log' && key !== 'clear') console.log('bbo.trash:: ', key, trash[key]); - } - } - }; - - var noop$1 = () => {}; - - var merge = function () { - for (var _len = arguments.length, objs = new Array(_len), _key = 0; _key < _len; _key++) { - objs[_key] = arguments[_key]; - } - - return [].concat(objs).reduce((acc, obj) => Object.keys(obj).reduce((a, k) => { - acc[k] = acc.hasOwnProperty(k) ? [].concat(acc[k]).concat(obj[k]) : obj[k]; - return acc; - }, {}), {}); - }; - - var over = function () { - for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) { - fns[_key] = arguments[_key]; - } - - return function () { - for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - - return fns.map(fn => fn.apply(null, args)); - }; - }; - - var call = function (key) { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - return context => context[key].apply(context, args); - }; - - function setStyle(el, ruleName, val) { - el.style[ruleName] = val; - } - - function att(el, ruleName, val) { - el.setAttribute(ruleName, val); - } - - /** - * trigger event - * https://stackoverflow.com/questions/2490825/how-to-trigger-event-in-javascript - */ - var trigger = (element, event, eventType) => { - if (document.createEventObject) { - var e = document.createEventObject(); - return element.fireEvent('on' + event, e); - } else { - var _e = document.createEvent(eventType || 'HTMLEvents'); - - _e.initEvent(event, true, true); - - element.dispatchEvent(_e); - } - }; - - function g(i) { - return document.getElementById(i); - } - - function c(t, cn, i, id) { - var el = document.createElement(t); - - if (cn) { - att(el, 'class', cn); - } - - if (i) { - el.innerHTML = i; - } - - if (id) { - att(el, 'id', id); - } - - return el; - } - - /** - * open new url dont not blocked by browser - */ - - var open = href => { - var id = '_bbo_open_proxy'; - var a = g(id) || c('a', id, '', id); - setStyle(a, 'display', 'none'); - att(a, 'href', href); - att(a, 'target', '_blank'); - if (!a.parentNode) document.body.appendChild(a); - trigger(a, 'click', 'MouseEvents'); - }; - - var stopPropagation = e => { - var _e = e || window.event; - - if (_e.stopPropagation) { - _e.stopPropagation(); // W3C - - } else { - _e.cancelBubble = true; // IE - } - }; - - function gc(cn) { - return document.getElementsByClassName(cn); - } - - function query(i) { - return document.querySelector(i); - } - - var show = function () { - for (var _len = arguments.length, el = new Array(_len), _key = 0; _key < _len; _key++) { - el[_key] = arguments[_key]; - } - - return [].concat(el).forEach(e => { - e.style.display = ''; - }); - }; - - var hide = function () { - for (var _len = arguments.length, el = new Array(_len), _key = 0; _key < _len; _key++) { - el[_key] = arguments[_key]; - } - - return [].concat(el).forEach(e => { - e.style.display = 'none'; - }); - }; - - function copyToClipboard(str) { - var el = document.createElement('textarea'); - el.value = str; - att(el, 'readonly', ''); - setStyle(el, 'position', 'absolute'); - setStyle(el, 'left', '-9999px'); - document.body.appendChild(el); - var selected = document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : false; - el.select(); - document.execCommand('copy'); - document.body.removeChild(el); - - if (selected) { - document.getSelection().removeAllRanges(); - document.getSelection().addRange(selected); - } - } - - var elementContains = (parent, child) => parent !== child && parent.contains(child); - - var formToObject = form => Array.from(new FormData(form)).reduce((acc, _ref) => { - var _ref2 = _slicedToArray(_ref, 2), - key = _ref2[0], - value = _ref2[1]; - - return { ...acc, - [key]: value - }; - }, {}); - - var getStyle = (el, ruleName) => getComputedStyle(el)[ruleName]; - - /** - * generate uuid - * From https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript - */ - function uuid() { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - var r = Math.random() * 16 | 0; - var v = c === 'x' ? r : r & 0x3 | 0x8; - return v.toString(16); - }); - } - - /** - * string hash map - * From https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript-jquery - */ - function hash(str) { - var _str = String(str); - - var hash = 0; - var i; - var chr; - if (_str.length === 0) return hash; - - for (i = 0; i < _str.length; i++) { - chr = _str.charCodeAt(i); - hash = (hash << 5) - hash + chr; - hash |= 0; // Convert to 32bit integer - } - - return hash; - } - - /** - * is typeof type - */ - var isTypeof = (val, type) => { - return Object.prototype.toString.call(val).slice(8, -1).toLowerCase() === type; - }; - - /** - * map condition judge - * bbo.judge = bbo.judgment - */ - - function judge(v, vals, strict) { - if (!isTypeof(vals, 'array')) return false; - - for (var key in vals) { - if (strict) { - if (v === vals[key]) return true; - } else { - if (v === vals[key]) return true; - } - } - - return false; - } - - var getType = v => v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase(); - - function construct() { - var classs = arguments[0]; - return new (Function.prototype.bind.apply(classs, arguments))(); - } - - /** - * Gets all the formal parameter names of a function - * https://www.zhihu.com/question/28912825 - */ - function paramsName(fn) { - return /\(\s*([\s\S]*?)\s*\)/.exec(fn.toString())[1].split(/\s*,\s*/); - } - - function loadImages(options) { - var len = 0; - var index = 0; - var curIndex = 0; - var stepTimer = null; - var stepTimeValue = 5; - var percentageValue = 0; - var targetPercent = 0; - var data = options.data || []; - - var step = options.step || function () {}; - - var complete = options.complete || function () {}; - - var needOneStep = options.needOneStep || false; - var path = options.path || false; - - if (typeof data !== 'object' || data.length === 0) { - step(100); - return false; - } - - len = data.length; - - if (path) { - for (var i = len - 1; i > -1; i--) { - data[i] = path + data[i]; // console.info(data[i]); - } - } - - var processStep = function () { - percentageValue++; // console.info("processStep = ",percentageValue) - - step(percentageValue); - - if (percentageValue < targetPercent) { - stepTimer = setTimeout(function () { - processStep(); - }, stepTimeValue); - } else if (targetPercent === 100 && percentageValue === targetPercent) { - if (complete && typeof complete === 'function') { - complete(); - } - } - }; - - function onload() { - curIndex++; - targetPercent = Math.floor(curIndex / len * 100); - - if (needOneStep) { - if (stepTimer) { - clearTimeout(stepTimer); - } - - processStep(); - } else { - step(targetPercent); - - if (targetPercent === 100) { - complete(); - } - } - } - - for (index; index < len; index++) { - var strUrl = data[index]; - new LoadImageItem(strUrl, onload).start(); - } - } - /** - * @name loadImageItem - * @param {string} url - images full url - * @callback cb - called when load image completed - */ - - function LoadImageItem(url, cb) { - var self = this; - self.img = new Image(); // readyState:'complete' or 'loaded' => image has been loaded。 - // for IE6-IE10。 - - var onReadyStateChange = function () { - removeEventHandlers(); - console.info('onReadyStateChange'); - cb(self, 'onReadyStateChange'); - }; - - var onError = function () { - console.info('onError'); - removeEventHandlers(); - cb(self, 'onError'); - }; - - var onLoad = function () { - removeEventHandlers(); - cb(self, 'onload'); - }; - - var removeEventHandlers = function () { - self.unbind('load', onLoad); - self.unbind('readystatechange', onReadyStateChange); - self.unbind('error', onError); - }; - - this.start = function () { - this.bind('load', onLoad); - this.bind('readystatechange', onReadyStateChange); - this.bind('error', onError); - this.img.src = url; - - if (self.img.complete) { - removeEventHandlers(); - cb(this, 'onload'); - } - }; - } - /** - * @name bind - * @description cross-browser event binding - * @param {string} eventName - * @param {function} eventHandler - */ - - - LoadImageItem.prototype.bind = function (eventName, eventHandler) { - if (this.img.addEventListener) { - this.img.addEventListener(eventName, eventHandler, false); - } else if (this.img.attachEvent) { - this.img.attachEvent('on' + eventName, eventHandler); - } - }; - /** - * @name unbind - * @description cross-browser event un-binding - * @param {string} eventName - * @param {function} eventHandler - */ - - - LoadImageItem.prototype.unbind = function (eventName, eventHandler) { - if (this.img.removeEventListener) { - this.img.removeEventListener(eventName, eventHandler, false); - } else if (this.img.detachEvent) { - this.img.detachEvent('on' + eventName, eventHandler); - } - }; - - /* eslint-disable no-invalid-this */ - /** - * load js - * 1. bbo.loadjs("//your_url/a.js",func); - * 2. bbo.loadjs("//your_url/a.js","only_id",func); - */ - - var _cache$1 = { - urls: {}, - logs: {} - }; - - var _insertScripts = function (arr, callback) { - for (var i = 0; i < arr.length; i++) { - _insertScript(arr[i], loaded); - } - - var _index = 0; - - function loaded() { - _index++; - - if (_index >= arr.length) { - callback && callback(); - } - } - }; - - var _insertScript = function (src, callback) { - var script = document.createElement('script'); - script.setAttribute('type', 'text/javascript'); - script.setAttribute('src', src); - document.getElementsByTagName('head')[0].appendChild(script); - - if (/msie/.test(ua('l'))) { - script.onreadystatechange = function () { - if (this.readyState === 'loaded' || this.readyState === 'complete') { - callback(); - } - }; - } else if (/gecko/.test(ua('l'))) { - script.onload = function () { - callback(); - }; - } else { - setTimeout(function () { - callback(); - }, 50); - } - }; - - function loadjs(url, b, c) { - var onlyId; - var callback; - - if (typeof b === 'function') { - onlyId = String(hash(String(url))); - callback = b; - } else if (typeof b === 'undefined') { - onlyId = String(hash(String(url))); - callback = null; - } else { - onlyId = String(b); - callback = c; - } - - if (_cache$1.urls[onlyId]) { - callback && callback(); - } else { - var func = typeof url === 'string' ? _insertScript : _insertScripts; - func.call(this, url, function () { - _cache$1.urls[onlyId] = true; - callback && callback(); - }); - } - } - - /* eslint-disable no-invalid-this */ - - /* - * https://gist.github.com/pete-otaqui/3912307 - */ - function loadcss(url, callback) { - var promise; - var resolutions = []; - var rejections = []; - var resolved = false; - var rejected = false; - var count; - var id; - this.count = this.count ? ++this.count : 1; - count = this.count; - id = 'load-css-' + count; - promise = { - done: function (callback) { - resolutions.push(callback); - if (resolved) callback(); - return promise; - }, - fail: function (callback) { - rejections.push(callback); - if (rejected) callback(); - return promise; - } - }; - - function resolve() { - resolved = true; - - for (var i = 0, len = resolutions.length; i < len; i++) { - resolutions[i](); - } - } - - function reject() { - rejected = true; - - for (var i = 0, len = rejections.length; i < len; i++) { - rejections[i](); - } - } - - var link = document.createElement('link'); - link.setAttribute('id', id); - link.setAttribute('rel', 'stylesheet'); - link.setAttribute('type', 'text/css'); - - if (typeof link.addEventListener !== 'undefined') { - link.addEventListener('load', resolve, false); - link.addEventListener('error', reject, false); - } else if (typeof link.attachEvent !== 'undefined') { - link.attachEvent('onload', function () { - // IE 8 gives us onload for both success and failure - // and also readyState is always "completed", even - // for failure. The only way to see if a stylesheet - // load failed from an external domain is to try and - // access its cssText, and then catch the error - // ... sweet :/ - var cur; - var i = document.styleSheets.length; - - try { - while (i--) { - cur = document.styleSheets[i]; - - if (cur.id === id) { - resolve(); - return; - } - } - } catch (e) {} - - if (!resolved) { - reject(); - } - }); - } - - document.getElementsByTagName('head')[0].appendChild(link); - link.setAttribute('href', url); - return promise; - } - - /** - * to json - */ - // eval hack - - var evil = fn => { - // A variable points to Function, preventing reporting errors - var Fn = Function; - return new Fn('return ' + fn)(); - }; // bbo.toJSON = bbo.tojson = bbo.toJson - - - var toJson = res => { - if (!res) return null; - - if (typeof res === 'string') { - try { - return JSON.parse(res); - } catch (e) { - return evil('(' + res + ')'); - } - } else if (isTypeof(res.json, 'function')) { - return res.json(); - } else { - return res; - } - }; - - /** - * cookie - * https://github.com/jiayi2/onavo/blob/master/onavo.js#L209 - */ - var cookie = () => { - function _extend() { - var i = 0; - var result = {}; - - for (; i < arguments.length; i++) { - var attributes = arguments[i]; - - for (var key in attributes) { - if (Object.prototype.hasOwnProperty.call(key, attributes)) { - result[key] = attributes[key]; - } - } - } - - return result; - } - - function init(converter) { - // #lizard forgives - function api(key, value, attributes) { - var result; - - if (typeof document === 'undefined') { - return; - } - - if (arguments.length > 1) { - var _attributes = _extend({ - path: '/' - }, api.defaults, attributes); - - if (typeof _attributes.expires === 'number') { - var expires = new Date(); - expires.setMilliseconds(expires.getMilliseconds() + _attributes.expires * 864e5); - _attributes.expires = expires; - } - - var _value = value; - - try { - result = JSON.stringify(_value); - - if (/^[\{\[]/.test(result)) { - _value = result; - } - } catch (e) {} - - if (!converter.write) { - _value = encodeURIComponent(String(_value)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); - } else { - _value = converter.write(_value, key); - } - - var _key = encodeURIComponent(String(key)); - - var __key = _key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); - - var ___key = __key.replace(/[\(\)]/g, escape); - - var _cookie = document.cookie = [___key, '=', value, attributes.expires ? '; expires=' + attributes.expires.toUTCString() : '', attributes.path ? '; path=' + attributes.path : '', attributes.domain ? '; domain=' + attributes.domain : '', attributes.secure ? '; secure' : ''].join(''); - - return _cookie; - } - - if (!key) { - result = {}; - } - - var cookies = document.cookie ? document.cookie.split('; ') : []; - var setDecode = /(%[0-9A-Z]{2})+/g; - var i = 0; - - for (; i < cookies.length; i++) { - var parts = cookies[i].split('='); - - var _cookie2 = parts.slice(1).join('='); - - if (_cookie2.charAt(0) === '"') { - _cookie2 = _cookie2.slice(1, -1); - } - - try { - var name = parts[0].replace(setDecode, decodeURIComponent); - _cookie2 = converter.read ? converter.read(_cookie2, name) : converter(_cookie2, name) || _cookie2.replace(setDecode, decodeURIComponent); - - try { - _cookie2 = JSON.parse(_cookie2); - } catch (e) { - console.log(e); - } - - if (key === name) { - result = _cookie2; - break; - } - - if (!key) { - result[name] = _cookie2; - } - } catch (e) {} - } - - return result; - } - - api.set = api; - - api.get = function (key) { - return api.call(api, key); - }; - - api.getJSON = api.getjson = api.getJson = function () { - return api.apply({ - json: true - }, [].slice.call(arguments)); - }; - - api.defaults = {}; - - api.remove = function (key, attributes) { - api(key, '', _extend(attributes, { - expires: -1 - })); - }; - - api.withConverter = init; - return api; - } - - return init(function () {}); - }; - - /** - * setCookie / getCookie / deleteCookie - * From https://stackoverflow.com/questions/1458724/how-do-i-set-unset-cookie-with-jquery/1458728#1458728 - */ - var setCookie = (name, value, option) => { - var longTime = 10; // let path = '; path=/'; - - var val = option && option.raw ? value : encodeURIComponent(value); - var cookie = encodeURIComponent(name) + '=' + val; - - if (option) { - if (option.days) { - var date = new Date(); - var ms = option.days * 24 * 3600 * 1000; - date.setTime(date.getTime() + ms); - cookie += '; expires=' + date.toGMTString(); - } else if (option.hour) { - var _date = new Date(); - - var _ms = option.hour * 3600 * 1000; - - _date.setTime(_date.getTime() + _ms); - - cookie += '; expires=' + _date.toGMTString(); - } else { - var _date2 = new Date(); - - var _ms2 = longTime * 365 * 24 * 3600 * 1000; - - _date2.setTime(_date2.getTime() + _ms2); - - cookie += '; expires=' + _date2.toGMTString(); - } - - if (option.path) cookie += '; path=' + option.path; - if (option.domain) cookie += '; domain=' + option.domain; - if (option.secure) cookie += '; true'; - } - - document.cookie = cookie; - }; - - var getCookie = name => { - var nameEQ = encodeURIComponent(name) + '='; - var ca = document.cookie.split(';'); - - for (var i = 0; i < ca.length; i++) { - var c = ca[i]; - - while (c.charAt(0) === ' ') { - c = c.substring(1, c.length); - } - - if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length)); - } - - return null; - }; - - var deleteCookie = name => { - setCookie(name, '', { - hour: -1 - }); - }; - - var parseCookie = str => str.split(';').map(v => v.split('=')).reduce((acc, v) => { - acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim()); - return acc; - }, {}); - - /** - * String - */ - var string = { - /** - * Remove spaces after removing previous string - */ - trim: str => { - var _str = str.replace(/^\s+/, ''); - - for (var i = str.length - 1; i >= 0; i--) { - if (/\S/.test(str.charAt(i))) { - _str = str.slice(0, i + 1); - break; - } - } - - return _str; - }, - - /** - * Increase by 0 based on string length before string - */ - fillZero: (target, n) => { - var z = new Array(n).join('0'); - var str = z + target; - var result = str.slice(-n); - return result; - }, - - /** - * Long string unique - */ - longUnique: target => { - var json = {}; - - for (var index = 0; index < target.length; index++) { - if (!json[target[index]]) { - json[target[index]] = -1; - } - } - - var longString = ''; - - for (var _index = 0; _index < target.length; _index++) { - if (json[target[_index]]) { - json[target[_index]] = 0; - longString = longString + target[_index]; - } - } - - return longString; - }, - - /** - * Remove the html tags inside the script - */ - stripTags: target => { - return target.replace(/]*>(\S\s*?)<\/script>/gim, '').replace(/<[^>]+>/g, ''); - }, - - /** - * Capitalizes the first letter of a string. - */ - capitalize: target => { - return target.charAt(0).toUpperCase() + target.slice(1).toLowerCase(); - }, - - /** - * DeCapitalizes the first letter of a string. - */ - deCapitalize: function (_ref) { - var _ref2 = _toArray(_ref), - first = _ref2[0], - rest = _ref2.slice(1); - - var upperRest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - return first.toLowerCase() + (upperRest ? rest.join('').toUpperCase() : rest.join('')); - }, - - /** - * en:Returns true if the given string is an absolute URL, false otherwise. - */ - isAbsoluteURL: str => /^[a-z][a-z0-9+.-]*:/.test(str), - - /** - * Creates a new string with the results of calling a provided function - * on every character in the calling string. - */ - mapString: (str, fn) => str.split('').map((c, i) => fn(c, i, str)).join(''), - - /** - * Replaces all but the last num of characters with the specified mask character. - */ - mask: function (cc) { - var num = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4; - var mask = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '*'; - return `${cc}`.slice(-num).padStart(`${cc}`.length, mask); - }, - - /** - * splitLines('This\nis a\nmultiline\nstring.\n') => - * ['This', 'is a', 'multiline', 'string.' , ''] - */ - splitLines: str => str.split(/\r?\n/), - - /** - * _ or - to CamelCase - */ - camelize: target => { - if (target.indexOf('-') < 0 && target.indexOf('_') < 0) { - return target; - } - - return target.replace(/[-_][^-_]/g, function (match) { - return match.charAt(1).toUpperCase(); - }); - }, - - /** - * Turn CamelCase to '_' - */ - underscored: target => { - return target.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toLowerCase(); - }, - - /** - * Turn '_' in a string into '-' - */ - dasherize: function (target) { - return this.underscored(target).replace(/_/g, '-'); - }, - - /** - * Truncates a string up to a specified length. - * The default length is 3, and the truncated symbol defaults '...' - */ - truncate: (str, num) => str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str, - - /** - * Returns the length of a string in bytes. - */ - byteSize: str => new Blob([str]).size, - - /** - * Returns the length of a string in bytes by Unicode (utf-8 utf8 utf-16 utf16) - */ - byteLen: (str, charset) => { - var target = 0; - var charCode; - var i; - var len; - - var _charset = charset ? charset.toLowerCase() : ''; - - if (_charset === 'utf-16' || _charset === 'utf16') { - for (i = 0, len = str.length; i < len; i++) { - charCode = str.charCodeAt(i); - - if (charCode <= 0xffff) { - target += 2; - } else { - target += 4; - } - } - } else { - for (i = 0, len = str.length; i < len; i++) { - charCode = str.charCodeAt(i); - - if (charCode <= 0x007f) { - target += 1; - } else if (charCode <= 0x07ff) { - target += 2; - } else if (charCode <= 0xffff) { - target += 3; - } else { - target += 4; - } - } - } - - return target; - }, - - /** - * Repeat item, times times - */ - repeat: (item, times) => { - var s = item; - var target = ''; - - while (times > 0) { - if (times % 2 === 1) { - target += s; - } - - if (times === 1) { - break; - } - - s += s; // eslint-disable-next-line no-param-reassign - - times = times >> 1; - } - - return target; - }, - - /** - * Item is the end of the target - */ - endsWith: (target, item, ignore) => { - var str = target.slice(-item.length); - return ignore ? str.toLowerCase() === item.toLowerCase() : str === item; - }, - - /** - * Item is the beginning of the target - */ - startsWith: (target, item, ignore) => { - var str = target.slice(0, item.length); - return ignore ? str.toLowerCase() === item.toLowerCase() : str === item; - }, - - /** - * Whether a string contains another string - */ - contains: (target, item) => { - // discuss at: https://locutus.io/golang/strings/Contains - // original by: Kevin van Zonneveld (https://kvz.io) - // example 1: bbo.string.contains('Kevin', 'K') - // returns 1: true - return String(target).indexOf(item) !== -1; - }, - - /** - * XSS string filtering - */ - xssFilter: str => { - return str.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); - }, - index: (s, sep) => { - // discuss at: https://locutus.io/golang/strings/Index - // original by: Kevin van Zonneveld (https://kvz.io) - // example 1: Index('Kevin', 'K') - // returns 1: 0 - // example 2: Index('Kevin', 'Z') - // returns 2: -1 - return String(s).indexOf(sep); - }, - capwords: str => { - // example 1: capwords('kevin van zonneveld') - // returns 1: 'Kevin Van Zonneveld' - // example 2: capwords('HELLO WORLD') - // returns 2: 'HELLO WORLD' - var pattern = /^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g; - return String(str).replace(pattern, function ($1) { - return $1.toUpperCase(); - }); - } - }; - - /************************************************************************ - * localStorage && sessionStorage - * Method for safely supporting localStorage sessionStorage 'setItem' 'getItem' 'removeItem' 'removeAll', - * Some extension method 'has' 'get' adn Store prefix - *************************************************************************/ - var ulocalStorage = window.localStorage; - var ussesionStorage = window.sessionStorage; - - class Storage { - constructor(options) { - var _options$type = options.type, - type = _options$type === void 0 ? 'local' : _options$type, - _options$prefix = options.prefix, - prefix = _options$prefix === void 0 ? 'bbo.storage' : _options$prefix, - _options$message = options.message, - message = _options$message === void 0 ? { - setItem: 'write in', - getItem: 'read', - removeAll: 'remove all', - removeItem: 'remove item' - } : _options$message; - this.prefix = prefix; - this.type = type; - this.message = message; - - if (type === 'local') { - this._storage = ulocalStorage; - } else if (type === 'session') { - this._storage = ussesionStorage; - } - } - - doItem(func, action) { - try { - if (typeof func === 'function') { - return func(); - } - } catch (err) { - this._warn(action); - - return null; - } - - return true; - } - - setItem(key, value) { - if (typeof key === 'object') { - Object.keys(key).forEach((k, index) => { - this.doItem(() => this._storage.setItem(`${this.prefix}.${k}`, JSON.stringify(key[k])), 'setItem'); - }); - } else { - this.doItem(() => this._storage.setItem(`${this.prefix}.${key}`, JSON.stringify(value)), 'setItem'); - } - } - - has() { - for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) { - keys[_key] = arguments[_key]; - } - - return keys.every((key, index) => this._storage.getItem(`${this.prefix}.${key}`)); - } - - get() { - var result = {}; - - for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - keys[_key2] = arguments[_key2]; - } - - keys.forEach((key, index) => { - if (`${this._storage.getItem(`${this.prefix}.${key}`)}` !== 'null') { - try { - result[key] = JSON.parse(this._storage.getItem(`${this.prefix}.${key}`)); - } catch (err) { - console.warn(this._warn('getItem')); - } - } - }); - return result; - } - - getItem(key) { - return this.doItem(() => JSON.parse(this._storage.getItem(`${this.prefix}.${key}`)), 'getItem'); - } - - removeAll() { - Object.keys(this._storage).forEach(k => { - if (string.contains(k, this.prefix)) { - this._remove(`${k}`); - } - }); - } - - removeItem() { - for (var _len3 = arguments.length, keys = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - keys[_key3] = arguments[_key3]; - } - - console.log(keys); - keys.forEach((key, index) => this.doItem(() => this._storage.removeItem(`${this.prefix}.${key}`), 'removeItem')); - } - - _warn(action) { - var message = this.message; - console.warn(`Unable to ${message[action] || ''} ${this.type} Storage`); - } - - _remove(keys) { - this.doItem(() => this._storage.removeItem(`${keys}`), 'removeItem'); - } - - } - - var storage = (_ref) => { - var type = _ref.type, - prefix = _ref.prefix; - return new Storage({ - type: type, - prefix: prefix - }); - }; - - /** - * getUrlParam / deleteUrlParam - * From https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript - */ - var getUrlParam = function (name) { - var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.href; - name.replace(/[\[\]]/g, '\\$&'); - var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'); - var results = regex.exec(url); - if (!results) return null; - if (!results[2]) return ''; - return decodeURIComponent(results[2].replace(/\+/g, ' ')); - }; - - /** - * setUrlParam - * From https://stackoverflow.com/questions/5999118/add-or-update-query-string-parameter - */ - var setUrlParam = function (key, value) { - var url = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window.location.href; - var re = new RegExp('([?|&])' + key + '=.*?(&|#|$)', 'i'); - - if (url.match(re)) { - return url.replace(re, '$1' + key + '=' + encodeURIComponent(value) + '$2'); - } else { - var hash = ''; - - if (url.indexOf('#') !== -1) { - hash = url.replace(/.*#/, '#'); - url.replace(/#.*/, ''); - } - - var separator = url.indexOf('?') !== -1 ? '&' : '?'; - return url + separator + key + '=' + encodeURIComponent(value) + hash; - } - }; - - /** - * getUrlParam / deleteUrlParam - * From https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript - */ - var deleteUrlParam = function (param) { - var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.href; - // prefer to use l.search if you have a location/link object - var urlparts = url.split('?'); - - if (urlparts.length >= 2) { - var prefix = encodeURIComponent(param) + '='; - var pars = urlparts[1].split(/[&;]/g); // reverse iteration as may be destructive - - for (var i = pars.length; i-- > 0;) { - // idiom for string.startsWith - if (pars[i].lastIndexOf(prefix, 0) !== -1) { - pars.splice(i, 1); - } - } - - return urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : ''); - } else { - return url; - } - }; - - var objectParam = arr => { - var str = ''; - - if (Array.isArray(arr)) { - str = arr.map(function (item) { - return item.name + '=' + item.value; - }).join('&'); - } else { - str = objectParam(objectBigParam(arr)); - } - - return str; - }; - - var objectBigParam = obj => { - var arr = []; - Object.keys(obj).forEach(function (k) { - if (Array.isArray(obj[k])) { - arr = arr.concat(obj[k].map(function (v) { - return { - name: k, - value: v - }; - })); - } else { - arr.push({ - name: k, - value: obj[k] - }); - } - }); - return arr; - }; - - var httpGet = function (url, callback) { - var err = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : console.error; - var request = new XMLHttpRequest(); - request.open('GET', url, true); - - request.onload = () => callback(request.responseText); - - request.onerror = () => err(request); - - request.send(); - }; - - // eslint-disable-next-line max-params - var httpPost = function (url, data, callback) { - var err = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : console.error; - var request = new XMLHttpRequest(); - request.open('POST', url, true); - request.setRequestHeader('Content-type', 'application/json; charset=utf-8'); - - request.onload = () => callback(request.responseText); - - request.onerror = () => err(request); - - request.send(data); - }; - - /** - * setInterval func fix times - * https://stackoverflow.com/questions/2956966/javascript-telling-setinterval-to-only-fire-x-amount-of-times - */ - - function setTimesout() { - var func = arguments[0]; - var delay = arguments[1] === undefined ? 0 : parseFloat(arguments[1]); - var times = arguments[2] === undefined ? 1 : parseInt(arguments[2], 10); - - var _args = arguments.length > 3 ? args(arguments, 3) : null; - - var target = { - index: 0, - times: times, - over: false - }; - var id = setInterval(function () { - target.index++; - - if (target.index > times) { - clearInterval(id); - } else { - if (target.index === times) target.over = true; - func.apply(target, _args); - } - }, delay); - return id; - } - - function clearTimesout(id) { - clearInterval(id); - } - - function fill0(num) { - var _num = parseFloat(num); - - return _num < 10 ? '0' + _num : _num; - } - - /** - * getDate - * https://stackoverflow.com/questions/1531093/how-do-i-get-the-current-date-in-javascript - */ - - var getDate = (d1, d2) => { - var today = new Date(); - var dd = today.getDate(); - var mm = today.getMonth() + 1; - var yyyy = today.getFullYear(); - var hh = today.getHours(); - var ms = today.getMinutes(); - var ss = today.getSeconds(); - dd = fill0(dd); - mm = fill0(mm); - hh = fill0(hh); - ms = fill0(ms); - ss = fill0(ss); - - var _d1 = d1 || '/'; - - var _d2 = d2 || ':'; - - return yyyy + _d1 + mm + _d1 + dd + ' ' + hh + _d2 + ms + _d2 + ss; - }; - - /** - * @ zh_cn - * @desc 格式化${startTime}距现在的已过时间 - * @param {Date} startTime - * @return {String} - */ - var formatPassTime = startTime => { - var currentTime = Date.parse(new Date()); - var time = currentTime - startTime; - var day = parseInt(time / (1000 * 60 * 60 * 24), 10); - var hour = parseInt(time / (1000 * 60 * 60), 10); - var min = parseInt(time / (1000 * 60), 10); - var month = parseInt(day / 30, 10); - var year = parseInt(month / 12, 10); - if (year) return year + '年前'; - if (month) return month + '个月前'; - if (day) return day + '天前'; - if (hour) return hour + '小时前'; - if (min) return min + '分钟前';else return '刚刚'; - }; - - /** - * @ zh_cn - * @desc 格式化现在距${endTime}的剩余时间 - * @param {Date} endTime - * @return {String} - */ - var formatRemainTime = endTime => { - var startDate = new Date(); // 开始时间 - - var endDate = new Date(endTime); // 结束时间 - - var t = endDate.getTime() - startDate.getTime(); // 时间差 - - var d = 0; - var h = 0; - var m = 0; - var s = 0; - - if (t >= 0) { - d = Math.floor(t / 1000 / 3600 / 24); - h = Math.floor(t / 1000 / 60 / 60 % 24); - m = Math.floor(t / 1000 / 60 % 60); - s = Math.floor(t / 1000 % 60); - } - - return d + '天 ' + h + '小时 ' + m + '分钟 ' + s + '秒'; - }; - - /** - * @ en - * bbo.formatDuration(1001); // '1 second, 1 millisecond' - * bbo.formatDuration(34325055574); // '397 days, 6 hours, 44 minutes, 15 seconds, 574 milliseconds' - */ - var formatDuration = ms => { - // eslint-disable-next-line no-param-reassign - if (ms < 0) ms = -ms; - var time = { - day: Math.floor(ms / 86400000), - hour: Math.floor(ms / 3600000) % 24, - minute: Math.floor(ms / 60000) % 60, - second: Math.floor(ms / 1000) % 60, - millisecond: Math.floor(ms) % 1000 - }; - return Object.entries(time).filter(val => val[1] !== 0).map((_ref) => { - var _ref2 = _slicedToArray(_ref, 2), - key = _ref2[0], - val = _ref2[1]; - - return `${val} ${key}${val !== 1 ? 's' : ''}`; - }).join(', '); - }; - - var floor = function (n) { - var m = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - return Math.floor(n * Math.pow(10, m)) / Math.pow(10, m); - }; - - var chainAsync = fns => { - var curr = 0; - var last = fns[fns.length - 1]; - - var next = () => { - var fn = fns[curr++]; - fn === last ? fn() : fn(next); - }; - - next(); - }; - - /** - * https://locutus.io/php/ - */ - // eslint-disable-next-line max-params - var numberFormat = (number, decimals, decPoint, thousandsSep) => { - // example 1: bbo.math.numberFormat(1234.56) - // returns 1: '1,235' - // example 2: bbo.math.numberFormat(1234.56, 2, ',', ' ') - // returns 2: '1 234,56' - // example 3: bbo.math.numberFormat(1234.5678, 2, '.', '') - // returns 3: '1234.57' - // example 4: bbo.math.numberFormat(67, 2, ',', '.') - // returns 4: '67,00' - // example 5: bbo.math.numberFormat(1000) - // returns 5: '1,000' - // example 6: bbo.math.numberFormat(67.311, 2) - // returns 6: '67.31' - // example 7: bbo.math.numberFormat(1000.55, 1) - // returns 7: '1,000.6' - // example 8: bbo.math.numberFormat(67000, 5, ',', '.') - // returns 8: '67.000,00000' - // example 9: bbo.math.numberFormat(0.9, 0) - // returns 9: '1' - // example 10: bbo.math.numberFormat('1.20', 2) - // returns 10: '1.20' - // example 11: bbo.math.numberFormat('1.20', 4) - // returns 11: '1.2000' - // example 12: bbo.math.numberFormat('1.2000', 3) - // returns 12: '1.200' - // example 13: bbo.math.numberFormat('1 000,50', 2, '.', ' ') - // returns 13: '100 050.00' - // example 14: bbo.math.numberFormat(1e-8, 8, '.', '') - // returns 14: '0.00000001' - var _number = String(number).replace(/[^0-9+\-Ee.]/g, ''); - - var _decimals = decimals; - var n = !isFinite(Number(_number)) ? 0 : Number(_number); - var prec = !isFinite(Number(_decimals)) ? 0 : Math.abs(_decimals); - var sep = typeof thousandsSep === 'undefined' ? ',' : thousandsSep; - var dec = typeof decPoint === 'undefined' ? '.' : decPoint; - var s = ''; - - var toFixedFix = function (n, prec) { - if (String(n).indexOf('e') === -1) { - return Number(Math.round(n + 'e+' + prec) + 'e-' + prec); - } else { - var arr = String(n).split('e'); - var sig = ''; - - if (Number(arr[1]) + prec > 0) { - sig = '+'; - } - - return Number(Math.round(Number(arr[0]) + 'e' + sig + (Number(arr[1]) + prec)) + 'e-' + prec).toFixed(prec); - } - }; // @todo: for IE parseFloat(0.55).toFixed(0) = 0; - - - s = (prec ? toFixedFix(n, prec).toString() : String(Math.round(n))).split('.'); - - if (s[0].length > 3) { - s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); - } - - if ((s[1] || '').length < prec) { - s[1] = s[1] || ''; - s[1] += new Array(prec - s[1].length + 1).join('0'); - } - - return s.join(dec); - }; - - function randomColor() { - return '#' + ('00000' + (Math.random() * 0x1000000 << 0).toString(16)).slice(-6); - } - - // bbo.randomFromA2B = bbo.randomA2B - var randomA2B = (a, b, int) => { - var result = Math.random() * (b - a) + a; - return int ? Math.floor(result) : result; - }; - - var randomKey = function () { - var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32; - - /** Removed confusing characters 'oOLl,9gq,Vv,Uu,I1' **/ - var possible = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; - var key = ''; - - for (var i = 0; i < len; i++) { - key += possible.charAt(Math.floor(Math.random() * possible.length)); - } - - return key; - }; - - /** - * lock touch in mobile phone - */ - var lockTouch = () => { - document.addEventListener('touchmove', function (e) { - e.preventDefault(); - }, !1); - document.addEventListener('touchstart', preventDefault, !1); - document.addEventListener('touchend', preventDefault, !1); - - function not(e, tag) { - return e.target.tagName !== tag.toUpperCase() && e.target.tagName !== tag.toLowerCase(); - } - - function preventDefault(e) { - if (not(e, 'input') && not(e, 'textarea') && not(e, 'select') && not(e, 'menus')) e.preventDefault(); - } - }; - - /** - * Check image size - * @param {(Object|String)} image - image information,allow File Object or Data URLs - * @param {Object} [options={}] - Check options - * @param {Number} [options.width] - Check width - * @param {Number} [options.height] - Check height - * @param {Number} [deviation=0] - Allowable deviation - */ - var checkImageSize = function (image, options) { - var deviation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - return new Promise((resolve, reject) => { - /** - * Check type of image - */ - if (image instanceof File) { - var reader = new FileReader(); - - reader.onload = function () { - checkSize(this.result); - }; - - reader.readAsDataURL(image); - } else if (typeof image === 'string') { - checkSize(image); - } - /** - * Check picture size - * @param {String} data:Data URL - */ - - - function checkSize(data) { - var virtualImage = new Image(); - virtualImage.src = data; - - virtualImage.onload = function () { - var width = this.naturalWidth; - var height = this.naturalHeight; - - if (options.width && Math.abs(options.width - width) > deviation) { - resolve(false); - } - - if (options.height && Math.abs(options.height - height) > deviation) { - resolve(false); - } - - resolve(true); - }; - } - }); - }; - - /** - * Image optimization - * Gif images are not supported - * @param {(Object|String)} - image ,supported File Object or Data URLs - * @param {Number} [quality = 0.9] - Image quality, between 0 - 1, only image/jpeg or image/webp is accept. - * @param {Object} [options = {}] - Image options - * @param {Number} [options.maxWidth = 1920] - The maximum width of the output picture. - * If the original width of the picture is less than this width, the original size picture is returned. - * If the original width of the picture is greater than the width, the picture scaled to the size is returned. - * @param {String} [options.mimeType] - Output image type,Types of MIME. - * @returns {Object} Promise , resolve Function parameters are optimized pictures Blob Object, - * If the output type is image/gif,Then return as is image Parameter content. - */ - var imageOptimization = function (image) { - var quality = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.9; - - var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, - _ref$maxWidth = _ref.maxWidth, - maxWidth = _ref$maxWidth === void 0 ? 1920 : _ref$maxWidth, - mimeType = _ref.mimeType; - - return new Promise((resolve, reject) => { - if (image instanceof File) { - var reader = new FileReader(); - - reader.onload = function () { - toBlob(this.result); - }; - - reader.readAsDataURL(image); - } else if (typeof image === 'string') { - toBlob(image); - } - /** - * To Blob - * @param {String} data - Image: Data URL - */ - - - function toBlob(data) { - var type = data.match(/data:([^;,]+)/); - - if (Array.isArray(type)) { - var outputType = mimeType ? mimeType : type[1]; - - if (outputType === 'image/gif') { - return resolve(image); - } - - var virtualImage = new Image(); - virtualImage.src = data; - - virtualImage.onload = function () { - var width = this.naturalWidth; - var height = this.naturalHeight; - - if (width > maxWidth) { - height = Math.round(maxWidth * height / width); - width = maxWidth; - } - - var canvas = document.createElement('canvas'); - canvas.width = width; - canvas.height = height; - var context = canvas.getContext('2d'); - context.drawImage(this, 0, 0, width, height); - canvas.toBlob(blob => { - resolve(blob); - }, mimeType ? mimeType : type[1], quality); - }; - } else { - reject(new Error('Non-picture type Data URLs')); - } - } - }); - }; - - function getTag(src) { - return Object.prototype.toString.call(src); - } - - function hasOwnProperty$1(obj, keyName) { - return Object.prototype.hasOwnProperty.call(obj, keyName); - } - - function isObject(obj) { - return getTag(obj) === '[object Object]'; - } - - function isArray(arr) { - return getTag(arr) === '[object Array]'; - } - - function isString(str) { - return getTag(str) === '[object String]'; - } - - function isBoolean(bool) { - return getTag(bool) === '[object Boolean]'; - } - - function isNumber(number) { - return getTag(number) === '[object Number]'; - } - - function isMap(map) { - return getTag(map) === '[object Map]'; - } - - function isSet(set) { - return getTag(set) === '[object Set]'; - } - - function isFunction(func) { - return getTag(func) === '[object Function]'; - } - - var isEmpty = val => val == null || !(Object.keys(val) || val).length; - - /* eslint-disable no-self-compare */ - function is(x, y) { - // inlined Object.is polyfill to avoid requiring consumers ship their own - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - if (x === y) { - // Steps 1-5, 7-10 - // Steps 6.b-6.e: +0 != -0 - // Added the nonzero y check to make Flow happy, but it is redundant - return x !== 0 || y !== 0 || 1 / x === 1 / y; - } else { - // Step 6.a: NaN == NaN - return x !== x && y !== y; - } - } - - function isShallowEqual(objA, objB) { - if (is(objA, objB)) { - return true; - } - - if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { - return false; - } - - var keysA = Object.keys(objA); - var keysB = Object.keys(objB); - - if (keysA.length !== keysB.length) { - return false; - } - - var i = 0; - - while (i < keysA.length) { - if (!hasOwnProperty(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { - return false; - } - - i += 1; - } - - return true; - } - - /* eslint-disable max-params */ - var charCodeOfDot = '.'.charCodeAt(0); - var reEscapeChar = /\\(\\)?/g; - var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - function stringToPath(string) { - var result = []; - - if (string.charCodeAt(0) === charCodeOfDot) { - result.push(''); - } - - string.replace(rePropName, (match, expression, quote, subString) => { - var key = match; - - if (quote) { - key = subString.replace(reEscapeChar, '$1'); - } else if (expression) { - key = expression.trim(); - } - - result.push(key); - }); - return result; - } - - function toPath(value) { - if (!isString(value)) { - return []; - } - - return stringToPath(value); - } - - /* eslint-disable eqeqeq */ - function has(object, path) { - if (!isObject(object)) { - return false; - } - - if (!isArray(path)) { - path = toPath(path); - } - - var index = -1; - var length = path.length; - var result = false; - - while (++index < length) { - var key = String(path[index]); - - if (!(result = object != null && hasOwnProperty(object, key))) { - break; - } - - object = object[key]; - } // eslint-disable-next-line eqeqeq - - - if (result || ++index != length) { - return result; - } - - return false; - } - - function reduce(src, func) { - var i = 0; - var acc = arguments[2]; - - if (isArray(src)) { - if (arguments.length !== 3) { - acc = src[0]; - } - - while (i < src.length) { - acc = func(acc, src[i], i, src); - i += 1; - } - - return acc; - } else if (isObject(src)) { - var keys = Object.keys(src); - - if (arguments.length !== 3) { - acc = src[keys[0]]; - } - - while (i < keys.length) { - var key = keys[i]; - acc = func(acc, src[key], key, src); - i += 1; - } - - return acc; - } - - return acc; - } - - function forEach(src, func) { - var i = 0; - - if (isArray(src)) { - while (i < src.length) { - var rst = func(src[i], i, src); - - if (rst === false) { - break; - } - - i += 1; - } - } else if (isObject(src)) { - var keys = Object.keys(src); - - while (i < keys.length) { - var key = keys[i]; - - var _rst = func(src[key], key, src); - - if (_rst === false) { - break; - } - - i += 1; - } - } - } - - function map(src, func) { - var rst = []; - var i = 0; - - if (isArray(src)) { - while (i < src.length) { - rst.push(func(src[i], i, src)); - i += 1; - } - } else if (isObject(src)) { - var keys = Object.keys(src); - - while (i < keys.length) { - var key = keys[i]; - rst.push(func(src[key], key, src)); - i += 1; - } - } - - return rst; - } - - function find(src, func) { - // eslint-disable-next-line no-undef-init - var rst = undefined; - forEach(src, (item, key, obj) => { - if (isFunction(func)) { - if (func(item, key, obj) === true) { - rst = item; - return false; - } - } else if (is(item, func)) { - rst = item; - return false; - } else if (isObject(item) && isObject(func)) { - var subEqual = true; - forEach(func, (v, k) => { - subEqual = isShallowEqual(item[k], v); - return subEqual; - }); - - if (subEqual) { - rst = item; - return false; - } - } - }); - return rst; - } - - function findIndex(src, func) { - var rst = -1; - forEach(src, (item, index, obj) => { - if (isFunction(func)) { - if (func(item, index, obj) === true) { - rst = index; - return false; - } - } else if (is(item, func)) { - rst = index; - return false; - } else if (isObject(item) && isObject(func)) { - var subEqual = true; - forEach(func, (v, k) => { - subEqual = isShallowEqual(item[k], v); - return subEqual; - }); - - if (subEqual) { - rst = index; - return false; - } - } - }); - return rst; - } - - /* eslint-disable no-param-reassign */ - function get(object, path, defaultValue) { - if (object == null) { - return defaultValue; - } - - if (!Array.isArray(path)) { - var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; - var reIsPlainProp = /^\w*$/; - - var isKey = function (value, object) { - var type = typeof value; - - if (type == 'number' || type == 'boolean' || value == null) { - return true; - } - - return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); - }; - - if (isKey(path, object)) { - path = [path]; - } else { - path = stringToPath(path); - } - } - - var index = 0; - var length = path.length; - - while (object != null && index < length) { - object = object[path[index]]; - index += 1; - } - - if (index && index === length) { - return object === undefined ? defaultValue : object; - } else { - return defaultValue; - } - } - - /* eslint-disable no-implicit-coercion */ - function debounce(func, wait, options) { - var lastArgs; - var lastThis; - var maxWait; - var result; - var timerId; - var lastCallTime; - var lastInvokeTime = 0; - var leading = false; - var maxing = false; - var trailing = true; // Bypass `requestAnimationFrame` by explicitly setting `wait=0`. - - var useRAF = !wait && wait !== 0 && typeof requestAnimationFrame === 'function'; - - if (typeof func !== 'function') { - throw new TypeError('Expected a function'); - } - - wait = +wait || 0; - - if (isObject(options)) { - leading = !!options.leading; - maxing = 'maxWait' in options; - maxWait = maxing ? Math.max(+options.maxWait || 0, wait) : maxWait; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - - function invokeFunc(time) { - var args = lastArgs; - var thisArg = lastThis; - lastArgs = lastThis = undefined; - lastInvokeTime = time; - result = func.apply(thisArg, args); - return result; - } - - function startTimer(pendingFunc, wait) { - if (useRAF) { - cancelAnimationFrame(timerId); - return requestAnimationFrame(pendingFunc); - } - - return setTimeout(pendingFunc, wait); - } // eslint-disable-next-line no-unused-vars - - function leadingEdge(time) { - // Reset any `maxWait` timer. - lastInvokeTime = time; // Start the timer for the trailing edge. - - timerId = startTimer(timerExpired, wait); // Invoke the leading edge. - - return leading ? invokeFunc(time) : result; - } - - function remainingWait(time) { - var timeSinceLastCall = time - lastCallTime; - var timeSinceLastInvoke = time - lastInvokeTime; - var timeWaiting = wait - timeSinceLastCall; - return maxing ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; - } - - function shouldInvoke(time) { - var timeSinceLastCall = time - lastCallTime; - var timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the - // trailing edge, the system time has gone backwards and we're treating - // it as the trailing edge, or we've hit the `maxWait` limit. - - return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; - } - - function timerExpired() { - var time = Date.now(); - - if (shouldInvoke(time)) { - return trailingEdge(time); - } // Restart the timer. - - - timerId = startTimer(timerExpired, remainingWait(time)); - } - - function trailingEdge(time) { - timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - - if (trailing && lastArgs) { - return invokeFunc(time); - } - - lastArgs = lastThis = undefined; - return result; - } - - function debounced() { - var time = Date.now(); - var isInvoking = shouldInvoke(time); - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - lastArgs = args; // eslint-disable-next-line no-invalid-this - - lastThis = this; - lastCallTime = time; - - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); - } - - if (maxing) { - // Handle invocations in a tight loop. - timerId = startTimer(timerExpired, wait); - return invokeFunc(lastCallTime); - } - } - - if (timerId === undefined) { - timerId = startTimer(timerExpired, wait); - } - - return result; - } - - return debounced; - } - - function throttle(func, wait, options) { - var leading = true; - var trailing = true; - - if (typeof func !== 'function') { - throw new TypeError('Expected a function'); - } - - if (isObject(options)) { - leading = 'leading' in options ? !!options.leading : leading; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - - return debounce(func, wait, { - leading: leading, - trailing: trailing, - maxWait: wait - }); - } - - // arr.reduce((acc, curr) => (curr in obj && (acc[curr] = obj[curr]), acc), {}); - // Only pick the first-level key, - - function pick(object) { - if (object === null || object === undefined) { - return {}; - } - - for (var _len = arguments.length, paths = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - paths[_key - 1] = arguments[_key]; - } - - return reduce(paths, (rst, path) => { - if (isArray(path)) { - forEach(path, item => { - if (has(object, item)) { - rst[item] = object[item]; - } - }); - } else { - if (has(object, path)) { - rst[path] = object[path]; - } - } - - return rst; - }, {}); - } - - /* eslint-disable no-return-assign */ - - /* eslint-disable no-sequences */ - var omit = (obj, arr) => Object.keys(obj).filter(k => !arr.includes(k)).reduce((acc, key) => (acc[key] = obj[key], acc), {}); - - /** - * Array - */ - var array = { - /** - * Returns all unique values of an array. - */ - unique: arr => _toConsumableArray(new Set(arr)), - - /** - * Returns all unique values of an array, based on a provided comparator function. - */ - uniqueBy: (arr, fn) => arr.reduce((acc, v) => { - if (!acc.some(x => fn(v, x))) acc.push(v); - return acc; - }, []), - - /** - * Remove duplicates from an array of objects - * https://stackoverflow.com/questions/2218999/remove-duplicates-from-an-array-of-objects-in-javascript - */ - uniqueFrom: (arr, target) => { - return Object.values(arr.reduce((acc, cur) => _extends(acc, { - [cur[target]]: cur - }), {})); - }, - - /** - * Returns a random element from an array. - */ - random: arr => arr[Math.floor(Math.random() * arr.length)], - - /** - * Gets n random elements at unique keys from array up to the size of array. - */ - randomSize: function (_ref) { - var _ref2 = _toArray(_ref), - arr = _ref2.slice(0); - - var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; - var m = arr.length; - - while (m) { - var i = Math.floor(Math.random() * m--); - var _ref3 = [arr[i], arr[m]]; - arr[m] = _ref3[0]; - arr[i] = _ref3[1]; - } - - return arr.slice(0, n); - }, - - /** - * Randomizes the order of the values of an array, returning a new array. - */ - shuffle: (_ref4) => { - var _ref5 = _toArray(_ref4), - arr = _ref5.slice(0); - - var m = arr.length; - - while (m) { - var i = Math.floor(Math.random() * m--); - var _ref6 = [arr[i], arr[m]]; - arr[m] = _ref6[0]; - arr[i] = _ref6[1]; - } - - return arr; - }, - - /** - * Returns true if the element has the specified Array, false otherwise. - */ - contains: (target, item) => { - return target.indexOf(item) > -1; - }, - - /** - * Returns true if all the elements values are included in arr, false otherwise. - */ - includesAll: (arr, values) => values.every(v => arr.includes(v)), - - /** - * Returns true if at least one element of values is included in arr , false otherwise. - */ - includesAny: (arr, values) => values.some(v => arr.includes(v)), - - /** - * Remove the element specified by parameter 2 in parameter 1 and return Boolean - */ - removeAt: function (target, index) { - return !!target.splice(index, 1).length; - }, - - /** - * Remove parameter 2 in parameter 1 and return boolean - */ - remove: function (target, item) { - var index = target.indexOf(item); - return index > -1 ? this.removeAt(target, index) : false; - }, - - /** - * Removes undefined and Null from an array. - */ - compact: target => { - return target.filter(item => { - return item !== undefined; - }); - }, - - /** - * Removes falsy values from an array. - * (false, null, 0, "", undefined, and NaN). - */ - compactAll: arr => arr.filter(Boolean), - - /** - * Get the attribute values in an array object and combine them into a new array - */ - pluck: (target, name) => { - var result = []; - var temp; - target.forEach(function (item) { - temp = item[name]; - - if (temp !== null) { - result.push(temp); - } - }); - return result; - }, - - /** - * Returns every element that exists in any of the two arrays once - * Create a Set with all values of a and b and convert to an array. - */ - union: (a, b) => Array.from(new Set([].concat(_toConsumableArray(a), _toConsumableArray(b)))), - - /** - * Returns every element that exists in any of the two arrays once, - * after applying the provided function to each array element of both. - */ - unionBy: (a, b, fn) => { - var s = new Set(a.map(fn)); - return Array.from(new Set([].concat(_toConsumableArray(a), _toConsumableArray(b.filter(x => !s.has(fn(x))))))); - }, - - /** - * Returns every element that exists in any of the two arrays once, - * using a provided comparator function. - */ - unionWith: (a, b, comp) => { - Array.from(new Set([].concat(_toConsumableArray(a), _toConsumableArray(b.filter(x => a.findIndex(y => comp(x, y)) === -1))))); - }, - - /** - * Returns a list of elements that exist in both arrays. - */ - intersect: (a, b) => { - var s = new Set(b); - return a.filter(x => s.has(x)); - }, - - /** - * Returns a list of elements that exist in both arrays, - * after applying the provided function to each array element of both. - */ - intersectBy: (a, b, fn) => { - var s = new Set(b.map(fn)); - return a.filter(x => s.has(fn(x))); - }, - - /** - * Returns the difference between two arrays. - * Create a Set from b, then use Array.prototype. - * Filter() on a to only keep values not contained in b. - */ - difference: (a, b) => { - var s = new Set(b); - return a.filter(x => !s.has(x)); - }, - - /** - * Returns the difference between two arrays, - * after applying the provided function to each array element of both. - */ - differenceBy: (a, b, fn) => { - var s = new Set(b.map(fn)); - return a.map(fn).filter(el => !s.has(el)); - }, - - /** - * Returns the largest element in an array - */ - max: target => { - return Math.max.apply(0, target); - }, - - /** - * Returns the smallest element in an array - */ - min: target => { - return Math.min.apply(0, target); - }, - - /** - * Check two arrays are equal - */ - equal: (arr1, arr2) => { - if (arr1 === arr2) return true; - if (arr1.length !== arr2.length) return false; - - for (var i = 0; i < arr1.length; ++i) { - if (arr1[i] !== arr2[i]) return false; - } - - return true; - }, - - /** - * Check if all elements in an array are equal. - */ - allEqual: arr => arr.every(val => val === arr[0]), - - /** - * Returns true if the provided predicate function returns true for all elements in a collection, false otherwise. - */ - all: function (arr) { - var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Boolean; - return arr.every(fn); - }, - - /** - * Returns true if the provided predicate function returns true for at least one element in a collection, - * false otherwise. - */ - any: function (arr) { - var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Boolean; - return arr.some(fn); - }, - - /** - * Chunks an array into smaller arrays of a specified size. - */ - chunk: (arr, size) => { - Array.from({ - length: Math.ceil(arr.length / size) - }, (v, i) => arr.slice(i * size, i * size + size)); - }, - - /** - * Groups the elements of an array based on the given function and returns the count of elements in each group. - */ - countBy: (arr, fn) => { - arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => { - acc[val] = (acc[val] || 0) + 1; - return acc; - }, {}); - }, - - /** - * Counts the occurrences of a value in an array. - */ - countOccurrences: (arr, val) => { - arr.reduce((a, v) => v === val ? a + 1 : a, 0); - }, - - /** - * Returns a new array with n elements removed from the left. - */ - drop: function (arr) { - var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; - return arr.slice(n); - }, - - /** - * Returns a new array with n elements removed from the right. - */ - dropRight: function (arr) { - var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; - return arr.slice(0, -n); - }, - - /** - * Removes elements in an array until the passed function returns true. - * Returns the remaining elements in the array. - */ - dropWhile: (arr, func) => { - var _arr = arr; - - while (_arr.length > 0 && !func(_arr[0])) { - _arr = _arr.slice(1); - } - - return _arr; - }, - - /** - * Removes elements from the end of an array until the passed function returns true, - * Returns the remaining elements in the array. - */ - dropRightWhile: (arr, func) => { - var rightIndex = arr.length; - - while (rightIndex-- && !func(arr[rightIndex])) { - } - - return arr.slice(0, rightIndex + 1); - }, - - /** - * discuss at: https://locutus.io/php/array_column/ - */ - column: function (input, ColumnKey) { - var IndexKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - var _input = input; - - if (_input !== null && (typeof _input === 'object' || Array.isArray(_input))) { - var newArray = []; - - if (typeof _input === 'object') { - var tempArray = []; - - for (var key of Object.keys(_input)) { - tempArray.push(_input[key]); - } - - _input = tempArray; - } - - if (Array.isArray(_input)) { - for (var _key of _input.keys()) { - if (IndexKey && _input[_key][IndexKey]) { - if (ColumnKey) { - newArray[_input[_key][IndexKey]] = _input[_key][ColumnKey]; - } else { - newArray[_input[_key][IndexKey]] = _input[_key]; - } - } else { - if (ColumnKey) { - newArray.push(_input[_key][ColumnKey]); - } else { - newArray.push(_input[_key]); - } - } - } - } - - return { ...newArray - }; - } - }, - search: (needle, haystack, argStrict) => { - // discuss at: https://locutus.io/php/array_search/' - // example 1: bbo.array.search('3', {a: 3, b: 5, c: 7}) - // returns 1: 'a' - var strict = !!argStrict; - var key = ''; - var _needle = needle; - - if (typeof _needle === 'object' && _needle.exec) { - // Duck-type for RegExp - if (!strict) { - // Let's consider case sensitive searches as strict - var flags = 'i' + (_needle.global ? 'g' : '') + (_needle.multiline ? 'm' : '') + ( // sticky is FF only - _needle.sticky ? 'y' : ''); - _needle = new RegExp(_needle.source, flags); - } - - for (key in haystack) { - if (haystack.hasOwnProperty(key)) { - if (_needle.test(haystack[key])) { - return key; - } - } - } - - return false; - } - - for (key in haystack) { - if (haystack.hasOwnProperty(key)) { - // eslint-disable-next-line eqeqeq - if (strict && haystack[key] === needle || !strict && haystack[key] == needle) { - return key; - } - } - } - - return false; - }, - unary: fn => val => fn(val) - }; - - var functions = { - // version - version: version, - noConflict: noConflict, - // device - ua: ua, - isIos: isIOS, - isiPhone: iPhone, - isIPad: isIPad, - isAndroid: isAndroid, - isMobile: isMobile, - isPC: isPC, - isWeixin: isWeixin, - isNewsApp: isNewsApp, - isQQ: isQQ, - mqqbrowser: mqqbrowser, - isTenvideo: isTenvideo, - isIphoneXmodel: isIphoneXmodel, - ieVersion: ieVersion, - isIE: isIE, - // log - log: log, - logs: logs, - removeConsole: removeConsole, - // arguments - args: args, - trash: trash, - noop: noop$1, - merge: merge, - over: over, - call: call, - // bom - open: open, - trigger: trigger, - stopPropagation: stopPropagation, - g: g, - gc: gc, - c: c, - query: query, - show: show, - hide: hide, - copyToClipboard: copyToClipboard, - elementContains: elementContains, - formToObject: formToObject, - getStyle: getStyle, - setStyle: setStyle, - attr: att, - // other - uuid: uuid, - hash: hash, - judge: judge, - judgment: judge, - getType: getType, - isTypeof: isTypeof, - construct: construct, - paramsName: paramsName, - // other function - loadImages: loadImages, - loadjs: loadjs, - loadcss: loadcss, - toJson: toJson, - toJSON: toJson, - tojson: toJson, - // cookie - cookie: cookie, - setCookie: setCookie, - getCookie: getCookie, - deleteCookie: deleteCookie, - delCookie: deleteCookie, - parseCookie: parseCookie, - // storage - storage: storage, - // url - getUrlParam: getUrlParam, - setUrlParam: setUrlParam, - deleteUrlParam: deleteUrlParam, - delUrlParam: deleteUrlParam, - objectParam: objectParam, - httpGet: httpGet, - httpPost: httpPost, - // times - setTimesout: setTimesout, - clearTimesout: clearTimesout, - getDate: getDate, - formatPassTime: formatPassTime, - formatRemainTime: formatRemainTime, - formatDuration: formatDuration, - // fill - fill0: fill0, - chainAsync: chainAsync, - numberFormat: numberFormat, - // random - randomColor: randomColor, - randomA2B: randomA2B, - randomFromA2B: randomA2B, - randomKey: randomKey, - floor: floor, - // touch - lockTouch: lockTouch, - // image - checkImageSize: checkImageSize, - imageOptimization: imageOptimization, - // lodash - getTag: getTag, - hasOwnProperty: hasOwnProperty$1, - isObject: isObject, - isArray: isArray, - isString: isString, - isBoolean: isBoolean, - isNumber: isNumber, - isMap: isMap, - isSet: isSet, - isFunction: isFunction, - isEmpty: isEmpty, - isShallowEqual: isShallowEqual, - has: has, - reduce: reduce, - forEach: forEach, - map: map, - findIndex: findIndex, - find: find, - toPath: toPath, - get: get, - debounce: debounce, - throttle: throttle, - pick: pick, - omit: omit, - // string - string: string, - // array - array: array - }; - - /* eslint-disable no-invalid-this */ - - function ChainWrapper(subject, explicitChain) { - this._wrappedValue = subject; - this._explicitChain = explicitChain; - } - - ChainWrapper.prototype.value = function () { - return this._wrappedValue; - }; - - ChainWrapper.prototype.valueOf = function () { - return this.value(); - }; - - ChainWrapper.prototype.toJSON = function () { - return this.value(); - }; - - ChainWrapper.prototype.toString = function () { - return String(this.value()); - }; - - ChainWrapper.prototype.chain = function () { - return new ChainWrapper(this._wrappedValue, true); - }; - - ChainWrapper.prototype.thru = function (changer) { - if (typeof changer === 'function') { - return new ChainWrapper(changer(this._wrappedValue), this._explicitChain); - } - - return this; - }; - - ChainWrapper.prototype._explicitChain = true; - - function makeFunctionChainable(functionInstance) { - return function () { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var result = functionInstance.apply(void 0, [this._wrappedValue].concat(args)); - - if (this._explicitChain || typeof result === 'string') { - return new ChainWrapper(result, this._explicitChain); - } else { - return result; - } - }; - } - - Object.keys(functions).forEach(function (name) { - ChainWrapper.prototype[name] = makeFunctionChainable(functions[name]); - }); - - function chain(subject) { - return new ChainWrapper(subject, true); - } - - function bbo(subject) { - return new ChainWrapper(subject, false); - } - - _extends(bbo, functions, { - chain: chain - }); - - return bbo; - -}))); diff --git a/dist_mod/index2.js b/dist_mod/index2.js deleted file mode 100644 index e5bc1e5..0000000 --- a/dist_mod/index2.js +++ /dev/null @@ -1,269 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var _rollupPluginBabelHelpers = require('./internal/_rollupPluginBabelHelpers.js'); - -/** - * String - */ -var string = { - /** - * Remove spaces after removing previous string - */ - trim: str => { - var _str = str.replace(/^\s+/, ''); - - for (var i = str.length - 1; i >= 0; i--) { - if (/\S/.test(str.charAt(i))) { - _str = str.slice(0, i + 1); - break; - } - } - - return _str; - }, - - /** - * Increase by 0 based on string length before string - */ - fillZero: (target, n) => { - var z = new Array(n).join('0'); - var str = z + target; - var result = str.slice(-n); - return result; - }, - - /** - * Long string unique - */ - longUnique: target => { - var json = {}; - - for (var index = 0; index < target.length; index++) { - if (!json[target[index]]) { - json[target[index]] = -1; - } - } - - var longString = ''; - - for (var _index = 0; _index < target.length; _index++) { - if (json[target[_index]]) { - json[target[_index]] = 0; - longString = longString + target[_index]; - } - } - - return longString; - }, - - /** - * Remove the html tags inside the script - */ - stripTags: target => { - return target.replace(/]*>(\S\s*?)<\/script>/gim, '').replace(/<[^>]+>/g, ''); - }, - - /** - * Capitalizes the first letter of a string. - */ - capitalize: target => { - return target.charAt(0).toUpperCase() + target.slice(1).toLowerCase(); - }, - - /** - * DeCapitalizes the first letter of a string. - */ - deCapitalize: function (_ref) { - var _ref2 = _rollupPluginBabelHelpers._toArray(_ref), - first = _ref2[0], - rest = _ref2.slice(1); - - var upperRest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - return first.toLowerCase() + (upperRest ? rest.join('').toUpperCase() : rest.join('')); - }, - - /** - * en:Returns true if the given string is an absolute URL, false otherwise. - */ - isAbsoluteURL: str => /^[a-z][a-z0-9+.-]*:/.test(str), - - /** - * Creates a new string with the results of calling a provided function - * on every character in the calling string. - */ - mapString: (str, fn) => str.split('').map((c, i) => fn(c, i, str)).join(''), - - /** - * Replaces all but the last num of characters with the specified mask character. - */ - mask: function (cc) { - var num = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4; - var mask = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '*'; - return `${cc}`.slice(-num).padStart(`${cc}`.length, mask); - }, - - /** - * splitLines('This\nis a\nmultiline\nstring.\n') => - * ['This', 'is a', 'multiline', 'string.' , ''] - */ - splitLines: str => str.split(/\r?\n/), - - /** - * _ or - to CamelCase - */ - camelize: target => { - if (target.indexOf('-') < 0 && target.indexOf('_') < 0) { - return target; - } - - return target.replace(/[-_][^-_]/g, function (match) { - return match.charAt(1).toUpperCase(); - }); - }, - - /** - * Turn CamelCase to '_' - */ - underscored: target => { - return target.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toLowerCase(); - }, - - /** - * Turn '_' in a string into '-' - */ - dasherize: function (target) { - return this.underscored(target).replace(/_/g, '-'); - }, - - /** - * Truncates a string up to a specified length. - * The default length is 3, and the truncated symbol defaults '...' - */ - truncate: (str, num) => str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str, - - /** - * Returns the length of a string in bytes. - */ - byteSize: str => new Blob([str]).size, - - /** - * Returns the length of a string in bytes by Unicode (utf-8 utf8 utf-16 utf16) - */ - byteLen: (str, charset) => { - var target = 0; - var charCode; - var i; - var len; - - var _charset = charset ? charset.toLowerCase() : ''; - - if (_charset === 'utf-16' || _charset === 'utf16') { - for (i = 0, len = str.length; i < len; i++) { - charCode = str.charCodeAt(i); - - if (charCode <= 0xffff) { - target += 2; - } else { - target += 4; - } - } - } else { - for (i = 0, len = str.length; i < len; i++) { - charCode = str.charCodeAt(i); - - if (charCode <= 0x007f) { - target += 1; - } else if (charCode <= 0x07ff) { - target += 2; - } else if (charCode <= 0xffff) { - target += 3; - } else { - target += 4; - } - } - } - - return target; - }, - - /** - * Repeat item, times times - */ - repeat: (item, times) => { - var s = item; - var target = ''; - - while (times > 0) { - if (times % 2 === 1) { - target += s; - } - - if (times === 1) { - break; - } - - s += s; // eslint-disable-next-line no-param-reassign - - times = times >> 1; - } - - return target; - }, - - /** - * Item is the end of the target - */ - endsWith: (target, item, ignore) => { - var str = target.slice(-item.length); - return ignore ? str.toLowerCase() === item.toLowerCase() : str === item; - }, - - /** - * Item is the beginning of the target - */ - startsWith: (target, item, ignore) => { - var str = target.slice(0, item.length); - return ignore ? str.toLowerCase() === item.toLowerCase() : str === item; - }, - - /** - * Whether a string contains another string - */ - contains: (target, item) => { - // discuss at: https://locutus.io/golang/strings/Contains - // original by: Kevin van Zonneveld (https://kvz.io) - // example 1: bbo.string.contains('Kevin', 'K') - // returns 1: true - return String(target).indexOf(item) !== -1; - }, - - /** - * XSS string filtering - */ - xssFilter: str => { - return str.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); - }, - index: (s, sep) => { - // discuss at: https://locutus.io/golang/strings/Index - // original by: Kevin van Zonneveld (https://kvz.io) - // example 1: Index('Kevin', 'K') - // returns 1: 0 - // example 2: Index('Kevin', 'Z') - // returns 2: -1 - return String(s).indexOf(sep); - }, - capwords: str => { - // example 1: capwords('kevin van zonneveld') - // returns 1: 'Kevin Van Zonneveld' - // example 2: capwords('HELLO WORLD') - // returns 2: 'HELLO WORLD' - var pattern = /^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g; - return String(str).replace(pattern, function ($1) { - return $1.toUpperCase(); - }); - } -}; - -exports.string = string; diff --git a/dist_mod/internal/_rollupPluginBabelHelpers.js b/dist_mod/internal/_rollupPluginBabelHelpers.js deleted file mode 100644 index 277bd5e..0000000 --- a/dist_mod/internal/_rollupPluginBabelHelpers.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict'; - -function _extends() { - _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - }; - - return _extends.apply(this, arguments); -} - -function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); -} - -function _toArray(arr) { - return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest(); -} - -function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); -} - -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } -} - -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} - -function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); -} - -function _iterableToArrayLimit(arr, i) { - if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { - return; - } - - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; -} - -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); -} - -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); -} - -exports._extends = _extends; -exports._slicedToArray = _slicedToArray; -exports._toArray = _toArray; -exports._toConsumableArray = _toConsumableArray; diff --git a/dist_mod/storage.js b/dist_mod/storage.js deleted file mode 100644 index a1c65ed..0000000 --- a/dist_mod/storage.js +++ /dev/null @@ -1,130 +0,0 @@ -'use strict'; - -require('./internal/_rollupPluginBabelHelpers.js'); -var index = require('./index2.js'); - -/************************************************************************ - * localStorage && sessionStorage - * Method for safely supporting localStorage sessionStorage 'setItem' 'getItem' 'removeItem' 'removeAll', - * Some extension method 'has' 'get' adn Store prefix - *************************************************************************/ -var ulocalStorage = window.localStorage; -var ussesionStorage = window.sessionStorage; - -class Storage { - constructor(options) { - var _options$type = options.type, - type = _options$type === void 0 ? 'local' : _options$type, - _options$prefix = options.prefix, - prefix = _options$prefix === void 0 ? 'bbo.storage' : _options$prefix, - _options$message = options.message, - message = _options$message === void 0 ? { - setItem: 'write in', - getItem: 'read', - removeAll: 'remove all', - removeItem: 'remove item' - } : _options$message; - this.prefix = prefix; - this.type = type; - this.message = message; - - if (type === 'local') { - this._storage = ulocalStorage; - } else if (type === 'session') { - this._storage = ussesionStorage; - } - } - - doItem(func, action) { - try { - if (typeof func === 'function') { - return func(); - } - } catch (err) { - this._warn(action); - - return null; - } - - return true; - } - - setItem(key, value) { - if (typeof key === 'object') { - Object.keys(key).forEach((k, index) => { - this.doItem(() => this._storage.setItem(`${this.prefix}.${k}`, JSON.stringify(key[k])), 'setItem'); - }); - } else { - this.doItem(() => this._storage.setItem(`${this.prefix}.${key}`, JSON.stringify(value)), 'setItem'); - } - } - - has() { - for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) { - keys[_key] = arguments[_key]; - } - - return keys.every((key, index) => this._storage.getItem(`${this.prefix}.${key}`)); - } - - get() { - var result = {}; - - for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - keys[_key2] = arguments[_key2]; - } - - keys.forEach((key, index) => { - if (`${this._storage.getItem(`${this.prefix}.${key}`)}` !== 'null') { - try { - result[key] = JSON.parse(this._storage.getItem(`${this.prefix}.${key}`)); - } catch (err) { - console.warn(this._warn('getItem')); - } - } - }); - return result; - } - - getItem(key) { - return this.doItem(() => JSON.parse(this._storage.getItem(`${this.prefix}.${key}`)), 'getItem'); - } - - removeAll() { - Object.keys(this._storage).forEach(k => { - if (index.string.contains(k, this.prefix)) { - this._remove(`${k}`); - } - }); - } - - removeItem() { - for (var _len3 = arguments.length, keys = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - keys[_key3] = arguments[_key3]; - } - - console.log(keys); - keys.forEach((key, index) => this.doItem(() => this._storage.removeItem(`${this.prefix}.${key}`), 'removeItem')); - } - - _warn(action) { - var message = this.message; - console.warn(`Unable to ${message[action] || ''} ${this.type} Storage`); - } - - _remove(keys) { - this.doItem(() => this._storage.removeItem(`${keys}`), 'removeItem'); - } - -} - -var storage = (_ref) => { - var type = _ref.type, - prefix = _ref.prefix; - return new Storage({ - type: type, - prefix: prefix - }); -}; - -module.exports = storage; diff --git a/src/array/index.js b/src/array/array.js similarity index 100% rename from src/array/index.js rename to src/array/array.js diff --git a/src/functions.js b/src/functions.js index 75e45af..5031d7c 100755 --- a/src/functions.js +++ b/src/functions.js @@ -135,8 +135,8 @@ import throttle from './lodash/throttle'; import pick from './lodash/pick'; import omit from './lodash/omit'; -import { string } from './string/index'; -import { array } from './array/index'; +import { string } from './string/string'; +import { array } from './array/array'; export default { // version diff --git a/src/storage/storage.js b/src/storage/storage.js index c086b46..11033c3 100644 --- a/src/storage/storage.js +++ b/src/storage/storage.js @@ -3,7 +3,7 @@ * Method for safely supporting localStorage sessionStorage 'setItem' 'getItem' 'removeItem' 'removeAll', * Some extension method 'has' 'get' adn Store prefix *************************************************************************/ -import { string } from '../string/index'; +import { string } from '../string/string'; const ulocalStorage = window.localStorage; const ussesionStorage = window.sessionStorage; diff --git a/src/string/index.js b/src/string/string.js similarity index 100% rename from src/string/index.js rename to src/string/string.js