diff --git a/.gitignore b/.gitignore
index 91b5e29e..a3647e6d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,6 @@ themes/grav/.sass-cache
# Node Modules
**/node_modules/**
+themes/grav/js/admin.js
+themes/grav/js/vendor.js
+themes/grav/js/*.map
diff --git a/themes/grav/app/pages/page/media.js b/themes/grav/app/pages/page/media.js
index f440699a..65734050 100644
--- a/themes/grav/app/pages/page/media.js
+++ b/themes/grav/app/pages/page/media.js
@@ -127,7 +127,6 @@ export default class PageMedia {
}
onDropzoneRemovedFile(file, ...extra) {
- console.log(file.name, 'acc', file.accepted, 'rej', file.rejected);
if (!file.accepted || file.rejected) { return; }
let url = `${this.form.data('media-url')}/task${config.param_sep}delmedia`;
diff --git a/themes/grav/js/admin.js b/themes/grav/js/admin.js
deleted file mode 100644
index cf2cbdfd..00000000
--- a/themes/grav/js/admin.js
+++ /dev/null
@@ -1,14010 +0,0 @@
-var Grav =
-webpackJsonpGrav([0],[
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _gpm = __webpack_require__(1);
-
- var _gpm2 = _interopRequireDefault(_gpm);
-
- var _keepalive = __webpack_require__(200);
-
- var _keepalive2 = _interopRequireDefault(_keepalive);
-
- var _updates = __webpack_require__(201);
-
- var _updates2 = _interopRequireDefault(_updates);
-
- var _dashboard = __webpack_require__(206);
-
- var _dashboard2 = _interopRequireDefault(_dashboard);
-
- var _pages = __webpack_require__(211);
-
- var _pages2 = _interopRequireDefault(_pages);
-
- var _forms = __webpack_require__(227);
-
- var _forms2 = _interopRequireDefault(_forms);
-
- __webpack_require__(236);
-
- __webpack_require__(237);
-
- __webpack_require__(238);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- // starts the keep alive, auto runs every X seconds
- _keepalive2.default.start();
-
- // bootstrap jQuery extensions
-
- exports.default = {
- GPM: {
- GPM: _gpm2.default,
- Instance: _gpm.Instance
- },
- KeepAlive: _keepalive2.default,
- Dashboard: _dashboard2.default,
- Pages: _pages2.default,
- Forms: _forms2.default,
- Updates: {
- Updates: _updates2.default,
- Instance: _updates.Instance
- }
- };
-
-/***/ },
-/* 1 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(fetch) {'use strict';
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Instance = undefined;
-
- var _response2 = __webpack_require__(193);
-
- var _gravConfig = __webpack_require__(198);
-
- var _events = __webpack_require__(199);
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
- var GPM = function (_EventEmitter) {
- _inherits(GPM, _EventEmitter);
-
- function GPM() {
- var action = arguments.length <= 0 || arguments[0] === undefined ? 'getUpdates' : arguments[0];
-
- _classCallCheck(this, GPM);
-
- var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GPM).call(this));
-
- _this.payload = {};
- _this.raw = {};
- _this.action = action;
- return _this;
- }
-
- _createClass(GPM, [{
- key: 'setPayload',
- value: function setPayload() {
- var payload = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
-
- this.payload = payload;
- this.emit('payload', payload);
-
- return this;
- }
- }, {
- key: 'setAction',
- value: function setAction() {
- var action = arguments.length <= 0 || arguments[0] === undefined ? 'getUpdates' : arguments[0];
-
- this.action = action;
- this.emit('action', action);
-
- return this;
- }
- }, {
- key: 'fetch',
- value: function (_fetch) {
- function fetch() {
- return _fetch.apply(this, arguments);
- }
-
- fetch.toString = function () {
- return _fetch.toString();
- };
-
- return fetch;
- }(function () {
- var _this2 = this;
-
- var callback = arguments.length <= 0 || arguments[0] === undefined ? function () {
- return true;
- } : arguments[0];
- var flush = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
-
- var data = new FormData();
- data.append('task', 'GPM');
- data.append('action', this.action);
-
- if (flush) {
- data.append('flush', true);
- }
-
- this.emit('fetching', this);
-
- fetch(_gravConfig.config.base_url_relative, {
- credentials: 'same-origin',
- method: 'post',
- body: data
- }).then(function (response) {
- _this2.raw = response;return response;
- }).then(_response2.parseStatus).then(_response2.parseJSON).then(function (response) {
- return _this2.response(response);
- }).then(function (response) {
- return callback(response, _this2.raw);
- }).then(function (response) {
- return _this2.emit('fetched', _this2.payload, _this2.raw, _this2);
- }).catch(_response2.userFeedbackError);
- })
- }, {
- key: 'response',
- value: function response(_response) {
- this.payload = _response;
-
- return _response;
- }
- }]);
-
- return GPM;
- }(_events.EventEmitter);
-
- exports.default = GPM;
- var Instance = exports.Instance = new GPM();
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
-
-/***/ },
-/* 2 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(Promise, global) {/*** IMPORTS FROM imports-loader ***/
- (function() {
-
- (function(self) {
- 'use strict';
-
- if (self.fetch) {
- return
- }
-
- function normalizeName(name) {
- if (typeof name !== 'string') {
- name = String(name)
- }
- if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
- throw new TypeError('Invalid character in header field name')
- }
- return name.toLowerCase()
- }
-
- function normalizeValue(value) {
- if (typeof value !== 'string') {
- value = String(value)
- }
- return value
- }
-
- function Headers(headers) {
- this.map = {}
-
- if (headers instanceof Headers) {
- headers.forEach(function(value, name) {
- this.append(name, value)
- }, this)
-
- } else if (headers) {
- Object.getOwnPropertyNames(headers).forEach(function(name) {
- this.append(name, headers[name])
- }, this)
- }
- }
-
- Headers.prototype.append = function(name, value) {
- name = normalizeName(name)
- value = normalizeValue(value)
- var list = this.map[name]
- if (!list) {
- list = []
- this.map[name] = list
- }
- list.push(value)
- }
-
- Headers.prototype['delete'] = function(name) {
- delete this.map[normalizeName(name)]
- }
-
- Headers.prototype.get = function(name) {
- var values = this.map[normalizeName(name)]
- return values ? values[0] : null
- }
-
- Headers.prototype.getAll = function(name) {
- return this.map[normalizeName(name)] || []
- }
-
- Headers.prototype.has = function(name) {
- return this.map.hasOwnProperty(normalizeName(name))
- }
-
- Headers.prototype.set = function(name, value) {
- this.map[normalizeName(name)] = [normalizeValue(value)]
- }
-
- Headers.prototype.forEach = function(callback, thisArg) {
- Object.getOwnPropertyNames(this.map).forEach(function(name) {
- this.map[name].forEach(function(value) {
- callback.call(thisArg, value, name, this)
- }, this)
- }, this)
- }
-
- function consumed(body) {
- if (body.bodyUsed) {
- return Promise.reject(new TypeError('Already read'))
- }
- body.bodyUsed = true
- }
-
- function fileReaderReady(reader) {
- return new Promise(function(resolve, reject) {
- reader.onload = function() {
- resolve(reader.result)
- }
- reader.onerror = function() {
- reject(reader.error)
- }
- })
- }
-
- function readBlobAsArrayBuffer(blob) {
- var reader = new FileReader()
- reader.readAsArrayBuffer(blob)
- return fileReaderReady(reader)
- }
-
- function readBlobAsText(blob) {
- var reader = new FileReader()
- reader.readAsText(blob)
- return fileReaderReady(reader)
- }
-
- var support = {
- blob: 'FileReader' in self && 'Blob' in self && (function() {
- try {
- new Blob();
- return true
- } catch(e) {
- return false
- }
- })(),
- formData: 'FormData' in self,
- arrayBuffer: 'ArrayBuffer' in self
- }
-
- function Body() {
- this.bodyUsed = false
-
-
- this._initBody = function(body) {
- this._bodyInit = body
- if (typeof body === 'string') {
- this._bodyText = body
- } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
- this._bodyBlob = body
- } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
- this._bodyFormData = body
- } else if (!body) {
- this._bodyText = ''
- } else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
- // Only support ArrayBuffers for POST method.
- // Receiving ArrayBuffers happens via Blobs, instead.
- } else {
- throw new Error('unsupported BodyInit type')
- }
-
- if (!this.headers.get('content-type')) {
- if (typeof body === 'string') {
- this.headers.set('content-type', 'text/plain;charset=UTF-8')
- } else if (this._bodyBlob && this._bodyBlob.type) {
- this.headers.set('content-type', this._bodyBlob.type)
- }
- }
- }
-
- if (support.blob) {
- this.blob = function() {
- var rejected = consumed(this)
- if (rejected) {
- return rejected
- }
-
- if (this._bodyBlob) {
- return Promise.resolve(this._bodyBlob)
- } else if (this._bodyFormData) {
- throw new Error('could not read FormData body as blob')
- } else {
- return Promise.resolve(new Blob([this._bodyText]))
- }
- }
-
- this.arrayBuffer = function() {
- return this.blob().then(readBlobAsArrayBuffer)
- }
-
- this.text = function() {
- var rejected = consumed(this)
- if (rejected) {
- return rejected
- }
-
- if (this._bodyBlob) {
- return readBlobAsText(this._bodyBlob)
- } else if (this._bodyFormData) {
- throw new Error('could not read FormData body as text')
- } else {
- return Promise.resolve(this._bodyText)
- }
- }
- } else {
- this.text = function() {
- var rejected = consumed(this)
- return rejected ? rejected : Promise.resolve(this._bodyText)
- }
- }
-
- if (support.formData) {
- this.formData = function() {
- return this.text().then(decode)
- }
- }
-
- this.json = function() {
- return this.text().then(JSON.parse)
- }
-
- return this
- }
-
- // HTTP methods whose capitalization should be normalized
- var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
-
- function normalizeMethod(method) {
- var upcased = method.toUpperCase()
- return (methods.indexOf(upcased) > -1) ? upcased : method
- }
-
- function Request(input, options) {
- options = options || {}
- var body = options.body
- if (Request.prototype.isPrototypeOf(input)) {
- if (input.bodyUsed) {
- throw new TypeError('Already read')
- }
- this.url = input.url
- this.credentials = input.credentials
- if (!options.headers) {
- this.headers = new Headers(input.headers)
- }
- this.method = input.method
- this.mode = input.mode
- if (!body) {
- body = input._bodyInit
- input.bodyUsed = true
- }
- } else {
- this.url = input
- }
-
- this.credentials = options.credentials || this.credentials || 'omit'
- if (options.headers || !this.headers) {
- this.headers = new Headers(options.headers)
- }
- this.method = normalizeMethod(options.method || this.method || 'GET')
- this.mode = options.mode || this.mode || null
- this.referrer = null
-
- if ((this.method === 'GET' || this.method === 'HEAD') && body) {
- throw new TypeError('Body not allowed for GET or HEAD requests')
- }
- this._initBody(body)
- }
-
- Request.prototype.clone = function() {
- return new Request(this)
- }
-
- function decode(body) {
- var form = new FormData()
- body.trim().split('&').forEach(function(bytes) {
- if (bytes) {
- var split = bytes.split('=')
- var name = split.shift().replace(/\+/g, ' ')
- var value = split.join('=').replace(/\+/g, ' ')
- form.append(decodeURIComponent(name), decodeURIComponent(value))
- }
- })
- return form
- }
-
- function headers(xhr) {
- var head = new Headers()
- var pairs = xhr.getAllResponseHeaders().trim().split('\n')
- pairs.forEach(function(header) {
- var split = header.trim().split(':')
- var key = split.shift().trim()
- var value = split.join(':').trim()
- head.append(key, value)
- })
- return head
- }
-
- Body.call(Request.prototype)
-
- function Response(bodyInit, options) {
- if (!options) {
- options = {}
- }
-
- this.type = 'default'
- this.status = options.status
- this.ok = this.status >= 200 && this.status < 300
- this.statusText = options.statusText
- this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
- this.url = options.url || ''
- this._initBody(bodyInit)
- }
-
- Body.call(Response.prototype)
-
- Response.prototype.clone = function() {
- return new Response(this._bodyInit, {
- status: this.status,
- statusText: this.statusText,
- headers: new Headers(this.headers),
- url: this.url
- })
- }
-
- Response.error = function() {
- var response = new Response(null, {status: 0, statusText: ''})
- response.type = 'error'
- return response
- }
-
- var redirectStatuses = [301, 302, 303, 307, 308]
-
- Response.redirect = function(url, status) {
- if (redirectStatuses.indexOf(status) === -1) {
- throw new RangeError('Invalid status code')
- }
-
- return new Response(null, {status: status, headers: {location: url}})
- }
-
- self.Headers = Headers;
- self.Request = Request;
- self.Response = Response;
-
- self.fetch = function(input, init) {
- return new Promise(function(resolve, reject) {
- var request
- if (Request.prototype.isPrototypeOf(input) && !init) {
- request = input
- } else {
- request = new Request(input, init)
- }
-
- var xhr = new XMLHttpRequest()
-
- function responseURL() {
- if ('responseURL' in xhr) {
- return xhr.responseURL
- }
-
- // Avoid security warnings on getResponseHeader when not allowed by CORS
- if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
- return xhr.getResponseHeader('X-Request-URL')
- }
-
- return;
- }
-
- xhr.onload = function() {
- var status = (xhr.status === 1223) ? 204 : xhr.status
- if (status < 100 || status > 599) {
- reject(new TypeError('Network request failed'))
- return
- }
- var options = {
- status: status,
- statusText: xhr.statusText,
- headers: headers(xhr),
- url: responseURL()
- }
- var body = 'response' in xhr ? xhr.response : xhr.responseText;
- resolve(new Response(body, options))
- }
-
- xhr.onerror = function() {
- reject(new TypeError('Network request failed'))
- }
-
- xhr.open(request.method, request.url, true)
-
- if (request.credentials === 'include') {
- xhr.withCredentials = true
- }
-
- if ('responseType' in xhr && support.blob) {
- xhr.responseType = 'blob'
- }
-
- request.headers.forEach(function(value, name) {
- xhr.setRequestHeader(name, value)
- })
-
- xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
- })
- }
- self.fetch.polyfill = true
- })(typeof self !== 'undefined' ? self : this);
-
-
- /*** EXPORTS FROM exports-loader ***/
- module.exports = global.fetch
- }.call(global));
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), (function() { return this; }())))
-
-/***/ },
-/* 3 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(global) {/*** IMPORTS FROM imports-loader ***/
- (function() {
-
- "use strict";
-
- __webpack_require__(4);
-
- __webpack_require__(191);
-
- if (global._babelPolyfill) {
- throw new Error("only one instance of babel-polyfill is allowed");
- }
- global._babelPolyfill = true;
-
- /*** EXPORTS FROM exports-loader ***/
- module.exports = global.Promise
- }.call(global));
- /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
-
-/***/ },
-/* 4 */
-/***/ function(module, exports, __webpack_require__) {
-
- __webpack_require__(5);
- __webpack_require__(38);
- __webpack_require__(44);
- __webpack_require__(46);
- __webpack_require__(48);
- __webpack_require__(50);
- __webpack_require__(52);
- __webpack_require__(54);
- __webpack_require__(55);
- __webpack_require__(56);
- __webpack_require__(57);
- __webpack_require__(58);
- __webpack_require__(59);
- __webpack_require__(60);
- __webpack_require__(61);
- __webpack_require__(62);
- __webpack_require__(63);
- __webpack_require__(64);
- __webpack_require__(65);
- __webpack_require__(68);
- __webpack_require__(69);
- __webpack_require__(70);
- __webpack_require__(72);
- __webpack_require__(73);
- __webpack_require__(74);
- __webpack_require__(75);
- __webpack_require__(76);
- __webpack_require__(77);
- __webpack_require__(78);
- __webpack_require__(80);
- __webpack_require__(81);
- __webpack_require__(82);
- __webpack_require__(84);
- __webpack_require__(85);
- __webpack_require__(86);
- __webpack_require__(88);
- __webpack_require__(89);
- __webpack_require__(90);
- __webpack_require__(91);
- __webpack_require__(92);
- __webpack_require__(93);
- __webpack_require__(94);
- __webpack_require__(95);
- __webpack_require__(96);
- __webpack_require__(97);
- __webpack_require__(98);
- __webpack_require__(99);
- __webpack_require__(100);
- __webpack_require__(101);
- __webpack_require__(106);
- __webpack_require__(107);
- __webpack_require__(111);
- __webpack_require__(112);
- __webpack_require__(114);
- __webpack_require__(115);
- __webpack_require__(120);
- __webpack_require__(121);
- __webpack_require__(124);
- __webpack_require__(126);
- __webpack_require__(128);
- __webpack_require__(130);
- __webpack_require__(131);
- __webpack_require__(132);
- __webpack_require__(134);
- __webpack_require__(135);
- __webpack_require__(137);
- __webpack_require__(138);
- __webpack_require__(139);
- __webpack_require__(140);
- __webpack_require__(147);
- __webpack_require__(150);
- __webpack_require__(151);
- __webpack_require__(153);
- __webpack_require__(154);
- __webpack_require__(155);
- __webpack_require__(156);
- __webpack_require__(157);
- __webpack_require__(158);
- __webpack_require__(159);
- __webpack_require__(160);
- __webpack_require__(161);
- __webpack_require__(162);
- __webpack_require__(163);
- __webpack_require__(164);
- __webpack_require__(166);
- __webpack_require__(167);
- __webpack_require__(168);
- __webpack_require__(169);
- __webpack_require__(170);
- __webpack_require__(171);
- __webpack_require__(173);
- __webpack_require__(174);
- __webpack_require__(175);
- __webpack_require__(176);
- __webpack_require__(178);
- __webpack_require__(179);
- __webpack_require__(181);
- __webpack_require__(182);
- __webpack_require__(184);
- __webpack_require__(185);
- __webpack_require__(186);
- __webpack_require__(189);
- __webpack_require__(190);
- module.exports = __webpack_require__(9);
-
-/***/ },
-/* 5 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $ = __webpack_require__(6)
- , $export = __webpack_require__(7)
- , DESCRIPTORS = __webpack_require__(12)
- , createDesc = __webpack_require__(11)
- , html = __webpack_require__(18)
- , cel = __webpack_require__(19)
- , has = __webpack_require__(21)
- , cof = __webpack_require__(22)
- , invoke = __webpack_require__(23)
- , fails = __webpack_require__(13)
- , anObject = __webpack_require__(24)
- , aFunction = __webpack_require__(17)
- , isObject = __webpack_require__(20)
- , toObject = __webpack_require__(25)
- , toIObject = __webpack_require__(27)
- , toInteger = __webpack_require__(29)
- , toIndex = __webpack_require__(30)
- , toLength = __webpack_require__(31)
- , IObject = __webpack_require__(28)
- , IE_PROTO = __webpack_require__(15)('__proto__')
- , createArrayMethod = __webpack_require__(32)
- , arrayIndexOf = __webpack_require__(37)(false)
- , ObjectProto = Object.prototype
- , ArrayProto = Array.prototype
- , arraySlice = ArrayProto.slice
- , arrayJoin = ArrayProto.join
- , defineProperty = $.setDesc
- , getOwnDescriptor = $.getDesc
- , defineProperties = $.setDescs
- , factories = {}
- , IE8_DOM_DEFINE;
-
- if(!DESCRIPTORS){
- IE8_DOM_DEFINE = !fails(function(){
- return defineProperty(cel('div'), 'a', {get: function(){ return 7; }}).a != 7;
- });
- $.setDesc = function(O, P, Attributes){
- if(IE8_DOM_DEFINE)try {
- return defineProperty(O, P, Attributes);
- } catch(e){ /* empty */ }
- if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
- if('value' in Attributes)anObject(O)[P] = Attributes.value;
- return O;
- };
- $.getDesc = function(O, P){
- if(IE8_DOM_DEFINE)try {
- return getOwnDescriptor(O, P);
- } catch(e){ /* empty */ }
- if(has(O, P))return createDesc(!ObjectProto.propertyIsEnumerable.call(O, P), O[P]);
- };
- $.setDescs = defineProperties = function(O, Properties){
- anObject(O);
- var keys = $.getKeys(Properties)
- , length = keys.length
- , i = 0
- , P;
- while(length > i)$.setDesc(O, P = keys[i++], Properties[P]);
- return O;
- };
- }
- $export($export.S + $export.F * !DESCRIPTORS, 'Object', {
- // 19.1.2.6 / 15.2.3.3 Object.getOwnPropertyDescriptor(O, P)
- getOwnPropertyDescriptor: $.getDesc,
- // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
- defineProperty: $.setDesc,
- // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
- defineProperties: defineProperties
- });
-
- // IE 8- don't enum bug keys
- var keys1 = ('constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,' +
- 'toLocaleString,toString,valueOf').split(',')
- // Additional keys for getOwnPropertyNames
- , keys2 = keys1.concat('length', 'prototype')
- , keysLen1 = keys1.length;
-
- // Create object with `null` prototype: use iframe Object with cleared prototype
- var createDict = function(){
- // Thrash, waste and sodomy: IE GC bug
- var iframe = cel('iframe')
- , i = keysLen1
- , gt = '>'
- , iframeDocument;
- iframe.style.display = 'none';
- html.appendChild(iframe);
- iframe.src = 'javascript:'; // eslint-disable-line no-script-url
- // createDict = iframe.contentWindow.Object;
- // html.removeChild(iframe);
- iframeDocument = iframe.contentWindow.document;
- iframeDocument.open();
- iframeDocument.write(' i)if(has(O, key = names[i++])){
- ~arrayIndexOf(result, key) || result.push(key);
- }
- return result;
- };
- };
- var Empty = function(){};
- $export($export.S, 'Object', {
- // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
- getPrototypeOf: $.getProto = $.getProto || function(O){
- O = toObject(O);
- if(has(O, IE_PROTO))return O[IE_PROTO];
- if(typeof O.constructor == 'function' && O instanceof O.constructor){
- return O.constructor.prototype;
- } return O instanceof Object ? ObjectProto : null;
- },
- // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
- getOwnPropertyNames: $.getNames = $.getNames || createGetKeys(keys2, keys2.length, true),
- // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
- create: $.create = $.create || function(O, /*?*/Properties){
- var result;
- if(O !== null){
- Empty.prototype = anObject(O);
- result = new Empty();
- Empty.prototype = null;
- // add "__proto__" for Object.getPrototypeOf shim
- result[IE_PROTO] = O;
- } else result = createDict();
- return Properties === undefined ? result : defineProperties(result, Properties);
- },
- // 19.1.2.14 / 15.2.3.14 Object.keys(O)
- keys: $.getKeys = $.getKeys || createGetKeys(keys1, keysLen1, false)
- });
-
- var construct = function(F, len, args){
- if(!(len in factories)){
- for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']';
- factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
- }
- return factories[len](F, args);
- };
-
- // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
- $export($export.P, 'Function', {
- bind: function bind(that /*, args... */){
- var fn = aFunction(this)
- , partArgs = arraySlice.call(arguments, 1);
- var bound = function(/* args... */){
- var args = partArgs.concat(arraySlice.call(arguments));
- return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
- };
- if(isObject(fn.prototype))bound.prototype = fn.prototype;
- return bound;
- }
- });
-
- // fallback for not array-like ES3 strings and DOM objects
- $export($export.P + $export.F * fails(function(){
- if(html)arraySlice.call(html);
- }), 'Array', {
- slice: function(begin, end){
- var len = toLength(this.length)
- , klass = cof(this);
- end = end === undefined ? len : end;
- if(klass == 'Array')return arraySlice.call(this, begin, end);
- var start = toIndex(begin, len)
- , upTo = toIndex(end, len)
- , size = toLength(upTo - start)
- , cloned = Array(size)
- , i = 0;
- for(; i < size; i++)cloned[i] = klass == 'String'
- ? this.charAt(start + i)
- : this[start + i];
- return cloned;
- }
- });
- $export($export.P + $export.F * (IObject != Object), 'Array', {
- join: function join(separator){
- return arrayJoin.call(IObject(this), separator === undefined ? ',' : separator);
- }
- });
-
- // 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
- $export($export.S, 'Array', {isArray: __webpack_require__(34)});
-
- var createArrayReduce = function(isRight){
- return function(callbackfn, memo){
- aFunction(callbackfn);
- var O = IObject(this)
- , length = toLength(O.length)
- , index = isRight ? length - 1 : 0
- , i = isRight ? -1 : 1;
- if(arguments.length < 2)for(;;){
- if(index in O){
- memo = O[index];
- index += i;
- break;
- }
- index += i;
- if(isRight ? index < 0 : length <= index){
- throw TypeError('Reduce of empty array with no initial value');
- }
- }
- for(;isRight ? index >= 0 : length > index; index += i)if(index in O){
- memo = callbackfn(memo, O[index], index, this);
- }
- return memo;
- };
- };
-
- var methodize = function($fn){
- return function(arg1/*, arg2 = undefined */){
- return $fn(this, arg1, arguments[1]);
- };
- };
-
- $export($export.P, 'Array', {
- // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
- forEach: $.each = $.each || methodize(createArrayMethod(0)),
- // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
- map: methodize(createArrayMethod(1)),
- // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
- filter: methodize(createArrayMethod(2)),
- // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
- some: methodize(createArrayMethod(3)),
- // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
- every: methodize(createArrayMethod(4)),
- // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
- reduce: createArrayReduce(false),
- // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
- reduceRight: createArrayReduce(true),
- // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
- indexOf: methodize(arrayIndexOf),
- // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
- lastIndexOf: function(el, fromIndex /* = @[*-1] */){
- var O = toIObject(this)
- , length = toLength(O.length)
- , index = length - 1;
- if(arguments.length > 1)index = Math.min(index, toInteger(fromIndex));
- if(index < 0)index = toLength(length + index);
- for(;index >= 0; index--)if(index in O)if(O[index] === el)return index;
- return -1;
- }
- });
-
- // 20.3.3.1 / 15.9.4.4 Date.now()
- $export($export.S, 'Date', {now: function(){ return +new Date; }});
-
- var lz = function(num){
- return num > 9 ? num : '0' + num;
- };
-
- // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
- // PhantomJS / old WebKit has a broken implementations
- $export($export.P + $export.F * (fails(function(){
- return new Date(-5e13 - 1).toISOString() != '0385-07-25T07:06:39.999Z';
- }) || !fails(function(){
- new Date(NaN).toISOString();
- })), 'Date', {
- toISOString: function toISOString(){
- if(!isFinite(this))throw RangeError('Invalid time value');
- var d = this
- , y = d.getUTCFullYear()
- , m = d.getUTCMilliseconds()
- , s = y < 0 ? '-' : y > 9999 ? '+' : '';
- return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) +
- '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) +
- 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) +
- ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
- }
- });
-
-/***/ },
-/* 6 */
-/***/ function(module, exports) {
-
- var $Object = Object;
- module.exports = {
- create: $Object.create,
- getProto: $Object.getPrototypeOf,
- isEnum: {}.propertyIsEnumerable,
- getDesc: $Object.getOwnPropertyDescriptor,
- setDesc: $Object.defineProperty,
- setDescs: $Object.defineProperties,
- getKeys: $Object.keys,
- getNames: $Object.getOwnPropertyNames,
- getSymbols: $Object.getOwnPropertySymbols,
- each: [].forEach
- };
-
-/***/ },
-/* 7 */
-/***/ function(module, exports, __webpack_require__) {
-
- var global = __webpack_require__(8)
- , core = __webpack_require__(9)
- , hide = __webpack_require__(10)
- , redefine = __webpack_require__(14)
- , ctx = __webpack_require__(16)
- , PROTOTYPE = 'prototype';
-
- var $export = function(type, name, source){
- var IS_FORCED = type & $export.F
- , IS_GLOBAL = type & $export.G
- , IS_STATIC = type & $export.S
- , IS_PROTO = type & $export.P
- , IS_BIND = type & $export.B
- , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]
- , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
- , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {})
- , key, own, out, exp;
- if(IS_GLOBAL)source = name;
- for(key in source){
- // contains in native
- own = !IS_FORCED && target && key in target;
- // export native or passed
- out = (own ? target : source)[key];
- // bind timers to global for call from export context
- exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
- // extend global
- if(target && !own)redefine(target, key, out);
- // export
- if(exports[key] != out)hide(exports, key, exp);
- if(IS_PROTO && expProto[key] != out)expProto[key] = out;
- }
- };
- global.core = core;
- // type bitmap
- $export.F = 1; // forced
- $export.G = 2; // global
- $export.S = 4; // static
- $export.P = 8; // proto
- $export.B = 16; // bind
- $export.W = 32; // wrap
- module.exports = $export;
-
-/***/ },
-/* 8 */
-/***/ function(module, exports) {
-
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- var global = module.exports = typeof window != 'undefined' && window.Math == Math
- ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
- if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
-
-/***/ },
-/* 9 */
-/***/ function(module, exports) {
-
- var core = module.exports = {version: '1.2.6'};
- if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
-
-/***/ },
-/* 10 */
-/***/ function(module, exports, __webpack_require__) {
-
- var $ = __webpack_require__(6)
- , createDesc = __webpack_require__(11);
- module.exports = __webpack_require__(12) ? function(object, key, value){
- return $.setDesc(object, key, createDesc(1, value));
- } : function(object, key, value){
- object[key] = value;
- return object;
- };
-
-/***/ },
-/* 11 */
-/***/ function(module, exports) {
-
- module.exports = function(bitmap, value){
- return {
- enumerable : !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable : !(bitmap & 4),
- value : value
- };
- };
-
-/***/ },
-/* 12 */
-/***/ function(module, exports, __webpack_require__) {
-
- // Thank's IE8 for his funny defineProperty
- module.exports = !__webpack_require__(13)(function(){
- return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
- });
-
-/***/ },
-/* 13 */
-/***/ function(module, exports) {
-
- module.exports = function(exec){
- try {
- return !!exec();
- } catch(e){
- return true;
- }
- };
-
-/***/ },
-/* 14 */
-/***/ function(module, exports, __webpack_require__) {
-
- // add fake Function#toString
- // for correct work wrapped methods / constructors with methods like LoDash isNative
- var global = __webpack_require__(8)
- , hide = __webpack_require__(10)
- , SRC = __webpack_require__(15)('src')
- , TO_STRING = 'toString'
- , $toString = Function[TO_STRING]
- , TPL = ('' + $toString).split(TO_STRING);
-
- __webpack_require__(9).inspectSource = function(it){
- return $toString.call(it);
- };
-
- (module.exports = function(O, key, val, safe){
- if(typeof val == 'function'){
- val.hasOwnProperty(SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
- val.hasOwnProperty('name') || hide(val, 'name', key);
- }
- if(O === global){
- O[key] = val;
- } else {
- if(!safe)delete O[key];
- hide(O, key, val);
- }
- })(Function.prototype, TO_STRING, function toString(){
- return typeof this == 'function' && this[SRC] || $toString.call(this);
- });
-
-/***/ },
-/* 15 */
-/***/ function(module, exports) {
-
- var id = 0
- , px = Math.random();
- module.exports = function(key){
- return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
- };
-
-/***/ },
-/* 16 */
-/***/ function(module, exports, __webpack_require__) {
-
- // optional / simple context binding
- var aFunction = __webpack_require__(17);
- module.exports = function(fn, that, length){
- aFunction(fn);
- if(that === undefined)return fn;
- switch(length){
- case 1: return function(a){
- return fn.call(that, a);
- };
- case 2: return function(a, b){
- return fn.call(that, a, b);
- };
- case 3: return function(a, b, c){
- return fn.call(that, a, b, c);
- };
- }
- return function(/* ...args */){
- return fn.apply(that, arguments);
- };
- };
-
-/***/ },
-/* 17 */
-/***/ function(module, exports) {
-
- module.exports = function(it){
- if(typeof it != 'function')throw TypeError(it + ' is not a function!');
- return it;
- };
-
-/***/ },
-/* 18 */
-/***/ function(module, exports, __webpack_require__) {
-
- module.exports = __webpack_require__(8).document && document.documentElement;
-
-/***/ },
-/* 19 */
-/***/ function(module, exports, __webpack_require__) {
-
- var isObject = __webpack_require__(20)
- , document = __webpack_require__(8).document
- // in old IE typeof document.createElement is 'object'
- , is = isObject(document) && isObject(document.createElement);
- module.exports = function(it){
- return is ? document.createElement(it) : {};
- };
-
-/***/ },
-/* 20 */
-/***/ function(module, exports) {
-
- module.exports = function(it){
- return typeof it === 'object' ? it !== null : typeof it === 'function';
- };
-
-/***/ },
-/* 21 */
-/***/ function(module, exports) {
-
- var hasOwnProperty = {}.hasOwnProperty;
- module.exports = function(it, key){
- return hasOwnProperty.call(it, key);
- };
-
-/***/ },
-/* 22 */
-/***/ function(module, exports) {
-
- var toString = {}.toString;
-
- module.exports = function(it){
- return toString.call(it).slice(8, -1);
- };
-
-/***/ },
-/* 23 */
-/***/ function(module, exports) {
-
- // fast apply, http://jsperf.lnkit.com/fast-apply/5
- module.exports = function(fn, args, that){
- var un = that === undefined;
- switch(args.length){
- case 0: return un ? fn()
- : fn.call(that);
- case 1: return un ? fn(args[0])
- : fn.call(that, args[0]);
- case 2: return un ? fn(args[0], args[1])
- : fn.call(that, args[0], args[1]);
- case 3: return un ? fn(args[0], args[1], args[2])
- : fn.call(that, args[0], args[1], args[2]);
- case 4: return un ? fn(args[0], args[1], args[2], args[3])
- : fn.call(that, args[0], args[1], args[2], args[3]);
- } return fn.apply(that, args);
- };
-
-/***/ },
-/* 24 */
-/***/ function(module, exports, __webpack_require__) {
-
- var isObject = __webpack_require__(20);
- module.exports = function(it){
- if(!isObject(it))throw TypeError(it + ' is not an object!');
- return it;
- };
-
-/***/ },
-/* 25 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 7.1.13 ToObject(argument)
- var defined = __webpack_require__(26);
- module.exports = function(it){
- return Object(defined(it));
- };
-
-/***/ },
-/* 26 */
-/***/ function(module, exports) {
-
- // 7.2.1 RequireObjectCoercible(argument)
- module.exports = function(it){
- if(it == undefined)throw TypeError("Can't call method on " + it);
- return it;
- };
-
-/***/ },
-/* 27 */
-/***/ function(module, exports, __webpack_require__) {
-
- // to indexed object, toObject with fallback for non-array-like ES3 strings
- var IObject = __webpack_require__(28)
- , defined = __webpack_require__(26);
- module.exports = function(it){
- return IObject(defined(it));
- };
-
-/***/ },
-/* 28 */
-/***/ function(module, exports, __webpack_require__) {
-
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
- var cof = __webpack_require__(22);
- module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
- return cof(it) == 'String' ? it.split('') : Object(it);
- };
-
-/***/ },
-/* 29 */
-/***/ function(module, exports) {
-
- // 7.1.4 ToInteger
- var ceil = Math.ceil
- , floor = Math.floor;
- module.exports = function(it){
- return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
- };
-
-/***/ },
-/* 30 */
-/***/ function(module, exports, __webpack_require__) {
-
- var toInteger = __webpack_require__(29)
- , max = Math.max
- , min = Math.min;
- module.exports = function(index, length){
- index = toInteger(index);
- return index < 0 ? max(index + length, 0) : min(index, length);
- };
-
-/***/ },
-/* 31 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 7.1.15 ToLength
- var toInteger = __webpack_require__(29)
- , min = Math.min;
- module.exports = function(it){
- return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
- };
-
-/***/ },
-/* 32 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 0 -> Array#forEach
- // 1 -> Array#map
- // 2 -> Array#filter
- // 3 -> Array#some
- // 4 -> Array#every
- // 5 -> Array#find
- // 6 -> Array#findIndex
- var ctx = __webpack_require__(16)
- , IObject = __webpack_require__(28)
- , toObject = __webpack_require__(25)
- , toLength = __webpack_require__(31)
- , asc = __webpack_require__(33);
- module.exports = function(TYPE){
- var IS_MAP = TYPE == 1
- , IS_FILTER = TYPE == 2
- , IS_SOME = TYPE == 3
- , IS_EVERY = TYPE == 4
- , IS_FIND_INDEX = TYPE == 6
- , NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
- return function($this, callbackfn, that){
- var O = toObject($this)
- , self = IObject(O)
- , f = ctx(callbackfn, that, 3)
- , length = toLength(self.length)
- , index = 0
- , result = IS_MAP ? asc($this, length) : IS_FILTER ? asc($this, 0) : undefined
- , val, res;
- for(;length > index; index++)if(NO_HOLES || index in self){
- val = self[index];
- res = f(val, index, O);
- if(TYPE){
- if(IS_MAP)result[index] = res; // map
- else if(res)switch(TYPE){
- case 3: return true; // some
- case 5: return val; // find
- case 6: return index; // findIndex
- case 2: result.push(val); // filter
- } else if(IS_EVERY)return false; // every
- }
- }
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
- };
- };
-
-/***/ },
-/* 33 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
- var isObject = __webpack_require__(20)
- , isArray = __webpack_require__(34)
- , SPECIES = __webpack_require__(35)('species');
- module.exports = function(original, length){
- var C;
- if(isArray(original)){
- C = original.constructor;
- // cross-realm fallback
- if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined;
- if(isObject(C)){
- C = C[SPECIES];
- if(C === null)C = undefined;
- }
- } return new (C === undefined ? Array : C)(length);
- };
-
-/***/ },
-/* 34 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 7.2.2 IsArray(argument)
- var cof = __webpack_require__(22);
- module.exports = Array.isArray || function(arg){
- return cof(arg) == 'Array';
- };
-
-/***/ },
-/* 35 */
-/***/ function(module, exports, __webpack_require__) {
-
- var store = __webpack_require__(36)('wks')
- , uid = __webpack_require__(15)
- , Symbol = __webpack_require__(8).Symbol;
- module.exports = function(name){
- return store[name] || (store[name] =
- Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name));
- };
-
-/***/ },
-/* 36 */
-/***/ function(module, exports, __webpack_require__) {
-
- var global = __webpack_require__(8)
- , SHARED = '__core-js_shared__'
- , store = global[SHARED] || (global[SHARED] = {});
- module.exports = function(key){
- return store[key] || (store[key] = {});
- };
-
-/***/ },
-/* 37 */
-/***/ function(module, exports, __webpack_require__) {
-
- // false -> Array#indexOf
- // true -> Array#includes
- var toIObject = __webpack_require__(27)
- , toLength = __webpack_require__(31)
- , toIndex = __webpack_require__(30);
- module.exports = function(IS_INCLUDES){
- return function($this, el, fromIndex){
- var O = toIObject($this)
- , length = toLength(O.length)
- , index = toIndex(fromIndex, length)
- , value;
- // Array#includes uses SameValueZero equality algorithm
- if(IS_INCLUDES && el != el)while(length > index){
- value = O[index++];
- if(value != value)return true;
- // Array#toIndex ignores holes, Array#includes - not
- } else for(;length > index; index++)if(IS_INCLUDES || index in O){
- if(O[index] === el)return IS_INCLUDES || index;
- } return !IS_INCLUDES && -1;
- };
- };
-
-/***/ },
-/* 38 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- // ECMAScript 6 symbols shim
- var $ = __webpack_require__(6)
- , global = __webpack_require__(8)
- , has = __webpack_require__(21)
- , DESCRIPTORS = __webpack_require__(12)
- , $export = __webpack_require__(7)
- , redefine = __webpack_require__(14)
- , $fails = __webpack_require__(13)
- , shared = __webpack_require__(36)
- , setToStringTag = __webpack_require__(39)
- , uid = __webpack_require__(15)
- , wks = __webpack_require__(35)
- , keyOf = __webpack_require__(40)
- , $names = __webpack_require__(41)
- , enumKeys = __webpack_require__(42)
- , isArray = __webpack_require__(34)
- , anObject = __webpack_require__(24)
- , toIObject = __webpack_require__(27)
- , createDesc = __webpack_require__(11)
- , getDesc = $.getDesc
- , setDesc = $.setDesc
- , _create = $.create
- , getNames = $names.get
- , $Symbol = global.Symbol
- , $JSON = global.JSON
- , _stringify = $JSON && $JSON.stringify
- , setter = false
- , HIDDEN = wks('_hidden')
- , isEnum = $.isEnum
- , SymbolRegistry = shared('symbol-registry')
- , AllSymbols = shared('symbols')
- , useNative = typeof $Symbol == 'function'
- , ObjectProto = Object.prototype;
-
- // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
- var setSymbolDesc = DESCRIPTORS && $fails(function(){
- return _create(setDesc({}, 'a', {
- get: function(){ return setDesc(this, 'a', {value: 7}).a; }
- })).a != 7;
- }) ? function(it, key, D){
- var protoDesc = getDesc(ObjectProto, key);
- if(protoDesc)delete ObjectProto[key];
- setDesc(it, key, D);
- if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc);
- } : setDesc;
-
- var wrap = function(tag){
- var sym = AllSymbols[tag] = _create($Symbol.prototype);
- sym._k = tag;
- DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, {
- configurable: true,
- set: function(value){
- if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
- setSymbolDesc(this, tag, createDesc(1, value));
- }
- });
- return sym;
- };
-
- var isSymbol = function(it){
- return typeof it == 'symbol';
- };
-
- var $defineProperty = function defineProperty(it, key, D){
- if(D && has(AllSymbols, key)){
- if(!D.enumerable){
- if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {}));
- it[HIDDEN][key] = true;
- } else {
- if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
- D = _create(D, {enumerable: createDesc(0, false)});
- } return setSymbolDesc(it, key, D);
- } return setDesc(it, key, D);
- };
- var $defineProperties = function defineProperties(it, P){
- anObject(it);
- var keys = enumKeys(P = toIObject(P))
- , i = 0
- , l = keys.length
- , key;
- while(l > i)$defineProperty(it, key = keys[i++], P[key]);
- return it;
- };
- var $create = function create(it, P){
- return P === undefined ? _create(it) : $defineProperties(_create(it), P);
- };
- var $propertyIsEnumerable = function propertyIsEnumerable(key){
- var E = isEnum.call(this, key);
- return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key]
- ? E : true;
- };
- var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
- var D = getDesc(it = toIObject(it), key);
- if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
- return D;
- };
- var $getOwnPropertyNames = function getOwnPropertyNames(it){
- var names = getNames(toIObject(it))
- , result = []
- , i = 0
- , key;
- while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key);
- return result;
- };
- var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
- var names = getNames(toIObject(it))
- , result = []
- , i = 0
- , key;
- while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]);
- return result;
- };
- var $stringify = function stringify(it){
- if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
- var args = [it]
- , i = 1
- , $$ = arguments
- , replacer, $replacer;
- while($$.length > i)args.push($$[i++]);
- replacer = args[1];
- if(typeof replacer == 'function')$replacer = replacer;
- if($replacer || !isArray(replacer))replacer = function(key, value){
- if($replacer)value = $replacer.call(this, key, value);
- if(!isSymbol(value))return value;
- };
- args[1] = replacer;
- return _stringify.apply($JSON, args);
- };
- var buggyJSON = $fails(function(){
- var S = $Symbol();
- // MS Edge converts symbol values to JSON as {}
- // WebKit converts symbol values to JSON as null
- // V8 throws on boxed symbols
- return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
- });
-
- // 19.4.1.1 Symbol([description])
- if(!useNative){
- $Symbol = function Symbol(){
- if(isSymbol(this))throw TypeError('Symbol is not a constructor');
- return wrap(uid(arguments.length > 0 ? arguments[0] : undefined));
- };
- redefine($Symbol.prototype, 'toString', function toString(){
- return this._k;
- });
-
- isSymbol = function(it){
- return it instanceof $Symbol;
- };
-
- $.create = $create;
- $.isEnum = $propertyIsEnumerable;
- $.getDesc = $getOwnPropertyDescriptor;
- $.setDesc = $defineProperty;
- $.setDescs = $defineProperties;
- $.getNames = $names.get = $getOwnPropertyNames;
- $.getSymbols = $getOwnPropertySymbols;
-
- if(DESCRIPTORS && !__webpack_require__(43)){
- redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
- }
- }
-
- var symbolStatics = {
- // 19.4.2.1 Symbol.for(key)
- 'for': function(key){
- return has(SymbolRegistry, key += '')
- ? SymbolRegistry[key]
- : SymbolRegistry[key] = $Symbol(key);
- },
- // 19.4.2.5 Symbol.keyFor(sym)
- keyFor: function keyFor(key){
- return keyOf(SymbolRegistry, key);
- },
- useSetter: function(){ setter = true; },
- useSimple: function(){ setter = false; }
- };
- // 19.4.2.2 Symbol.hasInstance
- // 19.4.2.3 Symbol.isConcatSpreadable
- // 19.4.2.4 Symbol.iterator
- // 19.4.2.6 Symbol.match
- // 19.4.2.8 Symbol.replace
- // 19.4.2.9 Symbol.search
- // 19.4.2.10 Symbol.species
- // 19.4.2.11 Symbol.split
- // 19.4.2.12 Symbol.toPrimitive
- // 19.4.2.13 Symbol.toStringTag
- // 19.4.2.14 Symbol.unscopables
- $.each.call((
- 'hasInstance,isConcatSpreadable,iterator,match,replace,search,' +
- 'species,split,toPrimitive,toStringTag,unscopables'
- ).split(','), function(it){
- var sym = wks(it);
- symbolStatics[it] = useNative ? sym : wrap(sym);
- });
-
- setter = true;
-
- $export($export.G + $export.W, {Symbol: $Symbol});
-
- $export($export.S, 'Symbol', symbolStatics);
-
- $export($export.S + $export.F * !useNative, 'Object', {
- // 19.1.2.2 Object.create(O [, Properties])
- create: $create,
- // 19.1.2.4 Object.defineProperty(O, P, Attributes)
- defineProperty: $defineProperty,
- // 19.1.2.3 Object.defineProperties(O, Properties)
- defineProperties: $defineProperties,
- // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
- getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
- // 19.1.2.7 Object.getOwnPropertyNames(O)
- getOwnPropertyNames: $getOwnPropertyNames,
- // 19.1.2.8 Object.getOwnPropertySymbols(O)
- getOwnPropertySymbols: $getOwnPropertySymbols
- });
-
- // 24.3.2 JSON.stringify(value [, replacer [, space]])
- $JSON && $export($export.S + $export.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify});
-
- // 19.4.3.5 Symbol.prototype[@@toStringTag]
- setToStringTag($Symbol, 'Symbol');
- // 20.2.1.9 Math[@@toStringTag]
- setToStringTag(Math, 'Math', true);
- // 24.3.3 JSON[@@toStringTag]
- setToStringTag(global.JSON, 'JSON', true);
-
-/***/ },
-/* 39 */
-/***/ function(module, exports, __webpack_require__) {
-
- var def = __webpack_require__(6).setDesc
- , has = __webpack_require__(21)
- , TAG = __webpack_require__(35)('toStringTag');
-
- module.exports = function(it, tag, stat){
- if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
- };
-
-/***/ },
-/* 40 */
-/***/ function(module, exports, __webpack_require__) {
-
- var $ = __webpack_require__(6)
- , toIObject = __webpack_require__(27);
- module.exports = function(object, el){
- var O = toIObject(object)
- , keys = $.getKeys(O)
- , length = keys.length
- , index = 0
- , key;
- while(length > index)if(O[key = keys[index++]] === el)return key;
- };
-
-/***/ },
-/* 41 */
-/***/ function(module, exports, __webpack_require__) {
-
- // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
- var toIObject = __webpack_require__(27)
- , getNames = __webpack_require__(6).getNames
- , toString = {}.toString;
-
- var windowNames = typeof window == 'object' && Object.getOwnPropertyNames
- ? Object.getOwnPropertyNames(window) : [];
-
- var getWindowNames = function(it){
- try {
- return getNames(it);
- } catch(e){
- return windowNames.slice();
- }
- };
-
- module.exports.get = function getOwnPropertyNames(it){
- if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it);
- return getNames(toIObject(it));
- };
-
-/***/ },
-/* 42 */
-/***/ function(module, exports, __webpack_require__) {
-
- // all enumerable object keys, includes symbols
- var $ = __webpack_require__(6);
- module.exports = function(it){
- var keys = $.getKeys(it)
- , getSymbols = $.getSymbols;
- if(getSymbols){
- var symbols = getSymbols(it)
- , isEnum = $.isEnum
- , i = 0
- , key;
- while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key);
- }
- return keys;
- };
-
-/***/ },
-/* 43 */
-/***/ function(module, exports) {
-
- module.exports = false;
-
-/***/ },
-/* 44 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.3.1 Object.assign(target, source)
- var $export = __webpack_require__(7);
-
- $export($export.S + $export.F, 'Object', {assign: __webpack_require__(45)});
-
-/***/ },
-/* 45 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.2.1 Object.assign(target, source, ...)
- var $ = __webpack_require__(6)
- , toObject = __webpack_require__(25)
- , IObject = __webpack_require__(28);
-
- // should work with symbols and should have deterministic property order (V8 bug)
- module.exports = __webpack_require__(13)(function(){
- var a = Object.assign
- , A = {}
- , B = {}
- , S = Symbol()
- , K = 'abcdefghijklmnopqrst';
- A[S] = 7;
- K.split('').forEach(function(k){ B[k] = k; });
- return a({}, A)[S] != 7 || Object.keys(a({}, B)).join('') != K;
- }) ? function assign(target, source){ // eslint-disable-line no-unused-vars
- var T = toObject(target)
- , $$ = arguments
- , $$len = $$.length
- , index = 1
- , getKeys = $.getKeys
- , getSymbols = $.getSymbols
- , isEnum = $.isEnum;
- while($$len > index){
- var S = IObject($$[index++])
- , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
- , length = keys.length
- , j = 0
- , key;
- while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
- }
- return T;
- } : Object.assign;
-
-/***/ },
-/* 46 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.3.10 Object.is(value1, value2)
- var $export = __webpack_require__(7);
- $export($export.S, 'Object', {is: __webpack_require__(47)});
-
-/***/ },
-/* 47 */
-/***/ function(module, exports) {
-
- // 7.2.9 SameValue(x, y)
- module.exports = Object.is || function is(x, y){
- return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
- };
-
-/***/ },
-/* 48 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.3.19 Object.setPrototypeOf(O, proto)
- var $export = __webpack_require__(7);
- $export($export.S, 'Object', {setPrototypeOf: __webpack_require__(49).set});
-
-/***/ },
-/* 49 */
-/***/ function(module, exports, __webpack_require__) {
-
- // Works with __proto__ only. Old v8 can't work with null proto objects.
- /* eslint-disable no-proto */
- var getDesc = __webpack_require__(6).getDesc
- , isObject = __webpack_require__(20)
- , anObject = __webpack_require__(24);
- var check = function(O, proto){
- anObject(O);
- if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
- };
- module.exports = {
- set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
- function(test, buggy, set){
- try {
- set = __webpack_require__(16)(Function.call, getDesc(Object.prototype, '__proto__').set, 2);
- set(test, []);
- buggy = !(test instanceof Array);
- } catch(e){ buggy = true; }
- return function setPrototypeOf(O, proto){
- check(O, proto);
- if(buggy)O.__proto__ = proto;
- else set(O, proto);
- return O;
- };
- }({}, false) : undefined),
- check: check
- };
-
-/***/ },
-/* 50 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- // 19.1.3.6 Object.prototype.toString()
- var classof = __webpack_require__(51)
- , test = {};
- test[__webpack_require__(35)('toStringTag')] = 'z';
- if(test + '' != '[object z]'){
- __webpack_require__(14)(Object.prototype, 'toString', function toString(){
- return '[object ' + classof(this) + ']';
- }, true);
- }
-
-/***/ },
-/* 51 */
-/***/ function(module, exports, __webpack_require__) {
-
- // getting tag from 19.1.3.6 Object.prototype.toString()
- var cof = __webpack_require__(22)
- , TAG = __webpack_require__(35)('toStringTag')
- // ES3 wrong here
- , ARG = cof(function(){ return arguments; }()) == 'Arguments';
-
- module.exports = function(it){
- var O, T, B;
- return it === undefined ? 'Undefined' : it === null ? 'Null'
- // @@toStringTag case
- : typeof (T = (O = Object(it))[TAG]) == 'string' ? T
- // builtinTag case
- : ARG ? cof(O)
- // ES3 arguments fallback
- : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
- };
-
-/***/ },
-/* 52 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.2.5 Object.freeze(O)
- var isObject = __webpack_require__(20);
-
- __webpack_require__(53)('freeze', function($freeze){
- return function freeze(it){
- return $freeze && isObject(it) ? $freeze(it) : it;
- };
- });
-
-/***/ },
-/* 53 */
-/***/ function(module, exports, __webpack_require__) {
-
- // most Object methods by ES6 should accept primitives
- var $export = __webpack_require__(7)
- , core = __webpack_require__(9)
- , fails = __webpack_require__(13);
- module.exports = function(KEY, exec){
- var fn = (core.Object || {})[KEY] || Object[KEY]
- , exp = {};
- exp[KEY] = exec(fn);
- $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
- };
-
-/***/ },
-/* 54 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.2.17 Object.seal(O)
- var isObject = __webpack_require__(20);
-
- __webpack_require__(53)('seal', function($seal){
- return function seal(it){
- return $seal && isObject(it) ? $seal(it) : it;
- };
- });
-
-/***/ },
-/* 55 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.2.15 Object.preventExtensions(O)
- var isObject = __webpack_require__(20);
-
- __webpack_require__(53)('preventExtensions', function($preventExtensions){
- return function preventExtensions(it){
- return $preventExtensions && isObject(it) ? $preventExtensions(it) : it;
- };
- });
-
-/***/ },
-/* 56 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.2.12 Object.isFrozen(O)
- var isObject = __webpack_require__(20);
-
- __webpack_require__(53)('isFrozen', function($isFrozen){
- return function isFrozen(it){
- return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
- };
- });
-
-/***/ },
-/* 57 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.2.13 Object.isSealed(O)
- var isObject = __webpack_require__(20);
-
- __webpack_require__(53)('isSealed', function($isSealed){
- return function isSealed(it){
- return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
- };
- });
-
-/***/ },
-/* 58 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.2.11 Object.isExtensible(O)
- var isObject = __webpack_require__(20);
-
- __webpack_require__(53)('isExtensible', function($isExtensible){
- return function isExtensible(it){
- return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
- };
- });
-
-/***/ },
-/* 59 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
- var toIObject = __webpack_require__(27);
-
- __webpack_require__(53)('getOwnPropertyDescriptor', function($getOwnPropertyDescriptor){
- return function getOwnPropertyDescriptor(it, key){
- return $getOwnPropertyDescriptor(toIObject(it), key);
- };
- });
-
-/***/ },
-/* 60 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.2.9 Object.getPrototypeOf(O)
- var toObject = __webpack_require__(25);
-
- __webpack_require__(53)('getPrototypeOf', function($getPrototypeOf){
- return function getPrototypeOf(it){
- return $getPrototypeOf(toObject(it));
- };
- });
-
-/***/ },
-/* 61 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.2.14 Object.keys(O)
- var toObject = __webpack_require__(25);
-
- __webpack_require__(53)('keys', function($keys){
- return function keys(it){
- return $keys(toObject(it));
- };
- });
-
-/***/ },
-/* 62 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 19.1.2.7 Object.getOwnPropertyNames(O)
- __webpack_require__(53)('getOwnPropertyNames', function(){
- return __webpack_require__(41).get;
- });
-
-/***/ },
-/* 63 */
-/***/ function(module, exports, __webpack_require__) {
-
- var setDesc = __webpack_require__(6).setDesc
- , createDesc = __webpack_require__(11)
- , has = __webpack_require__(21)
- , FProto = Function.prototype
- , nameRE = /^\s*function ([^ (]*)/
- , NAME = 'name';
- // 19.2.4.2 name
- NAME in FProto || __webpack_require__(12) && setDesc(FProto, NAME, {
- configurable: true,
- get: function(){
- var match = ('' + this).match(nameRE)
- , name = match ? match[1] : '';
- has(this, NAME) || setDesc(this, NAME, createDesc(5, name));
- return name;
- }
- });
-
-/***/ },
-/* 64 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $ = __webpack_require__(6)
- , isObject = __webpack_require__(20)
- , HAS_INSTANCE = __webpack_require__(35)('hasInstance')
- , FunctionProto = Function.prototype;
- // 19.2.3.6 Function.prototype[@@hasInstance](V)
- if(!(HAS_INSTANCE in FunctionProto))$.setDesc(FunctionProto, HAS_INSTANCE, {value: function(O){
- if(typeof this != 'function' || !isObject(O))return false;
- if(!isObject(this.prototype))return O instanceof this;
- // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
- while(O = $.getProto(O))if(this.prototype === O)return true;
- return false;
- }});
-
-/***/ },
-/* 65 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $ = __webpack_require__(6)
- , global = __webpack_require__(8)
- , has = __webpack_require__(21)
- , cof = __webpack_require__(22)
- , toPrimitive = __webpack_require__(66)
- , fails = __webpack_require__(13)
- , $trim = __webpack_require__(67).trim
- , NUMBER = 'Number'
- , $Number = global[NUMBER]
- , Base = $Number
- , proto = $Number.prototype
- // Opera ~12 has broken Object#toString
- , BROKEN_COF = cof($.create(proto)) == NUMBER
- , TRIM = 'trim' in String.prototype;
-
- // 7.1.3 ToNumber(argument)
- var toNumber = function(argument){
- var it = toPrimitive(argument, false);
- if(typeof it == 'string' && it.length > 2){
- it = TRIM ? it.trim() : $trim(it, 3);
- var first = it.charCodeAt(0)
- , third, radix, maxCode;
- if(first === 43 || first === 45){
- third = it.charCodeAt(2);
- if(third === 88 || third === 120)return NaN; // Number('+0x1') should be NaN, old V8 fix
- } else if(first === 48){
- switch(it.charCodeAt(1)){
- case 66 : case 98 : radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i
- case 79 : case 111 : radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i
- default : return +it;
- }
- for(var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++){
- code = digits.charCodeAt(i);
- // parseInt parses a string to a first unavailable symbol
- // but ToNumber should return NaN if a string contains unavailable symbols
- if(code < 48 || code > maxCode)return NaN;
- } return parseInt(digits, radix);
- }
- } return +it;
- };
-
- if(!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')){
- $Number = function Number(value){
- var it = arguments.length < 1 ? 0 : value
- , that = this;
- return that instanceof $Number
- // check on 1..constructor(foo) case
- && (BROKEN_COF ? fails(function(){ proto.valueOf.call(that); }) : cof(that) != NUMBER)
- ? new Base(toNumber(it)) : toNumber(it);
- };
- $.each.call(__webpack_require__(12) ? $.getNames(Base) : (
- // ES3:
- 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
- // ES6 (in case, if modules with ES6 Number statics required before):
- 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
- 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
- ).split(','), function(key){
- if(has(Base, key) && !has($Number, key)){
- $.setDesc($Number, key, $.getDesc(Base, key));
- }
- });
- $Number.prototype = proto;
- proto.constructor = $Number;
- __webpack_require__(14)(global, NUMBER, $Number);
- }
-
-/***/ },
-/* 66 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 7.1.1 ToPrimitive(input [, PreferredType])
- var isObject = __webpack_require__(20);
- // instead of the ES6 spec version, we didn't implement @@toPrimitive case
- // and the second argument - flag - preferred type is a string
- module.exports = function(it, S){
- if(!isObject(it))return it;
- var fn, val;
- if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
- if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
- if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
- throw TypeError("Can't convert object to primitive value");
- };
-
-/***/ },
-/* 67 */
-/***/ function(module, exports, __webpack_require__) {
-
- var $export = __webpack_require__(7)
- , defined = __webpack_require__(26)
- , fails = __webpack_require__(13)
- , spaces = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
- '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'
- , space = '[' + spaces + ']'
- , non = '\u200b\u0085'
- , ltrim = RegExp('^' + space + space + '*')
- , rtrim = RegExp(space + space + '*$');
-
- var exporter = function(KEY, exec){
- var exp = {};
- exp[KEY] = exec(trim);
- $export($export.P + $export.F * fails(function(){
- return !!spaces[KEY]() || non[KEY]() != non;
- }), 'String', exp);
- };
-
- // 1 -> String#trimLeft
- // 2 -> String#trimRight
- // 3 -> String#trim
- var trim = exporter.trim = function(string, TYPE){
- string = String(defined(string));
- if(TYPE & 1)string = string.replace(ltrim, '');
- if(TYPE & 2)string = string.replace(rtrim, '');
- return string;
- };
-
- module.exports = exporter;
-
-/***/ },
-/* 68 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.1.2.1 Number.EPSILON
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Number', {EPSILON: Math.pow(2, -52)});
-
-/***/ },
-/* 69 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.1.2.2 Number.isFinite(number)
- var $export = __webpack_require__(7)
- , _isFinite = __webpack_require__(8).isFinite;
-
- $export($export.S, 'Number', {
- isFinite: function isFinite(it){
- return typeof it == 'number' && _isFinite(it);
- }
- });
-
-/***/ },
-/* 70 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.1.2.3 Number.isInteger(number)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Number', {isInteger: __webpack_require__(71)});
-
-/***/ },
-/* 71 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.1.2.3 Number.isInteger(number)
- var isObject = __webpack_require__(20)
- , floor = Math.floor;
- module.exports = function isInteger(it){
- return !isObject(it) && isFinite(it) && floor(it) === it;
- };
-
-/***/ },
-/* 72 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.1.2.4 Number.isNaN(number)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Number', {
- isNaN: function isNaN(number){
- return number != number;
- }
- });
-
-/***/ },
-/* 73 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.1.2.5 Number.isSafeInteger(number)
- var $export = __webpack_require__(7)
- , isInteger = __webpack_require__(71)
- , abs = Math.abs;
-
- $export($export.S, 'Number', {
- isSafeInteger: function isSafeInteger(number){
- return isInteger(number) && abs(number) <= 0x1fffffffffffff;
- }
- });
-
-/***/ },
-/* 74 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.1.2.6 Number.MAX_SAFE_INTEGER
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff});
-
-/***/ },
-/* 75 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.1.2.10 Number.MIN_SAFE_INTEGER
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff});
-
-/***/ },
-/* 76 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.1.2.12 Number.parseFloat(string)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Number', {parseFloat: parseFloat});
-
-/***/ },
-/* 77 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.1.2.13 Number.parseInt(string, radix)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Number', {parseInt: parseInt});
-
-/***/ },
-/* 78 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.3 Math.acosh(x)
- var $export = __webpack_require__(7)
- , log1p = __webpack_require__(79)
- , sqrt = Math.sqrt
- , $acosh = Math.acosh;
-
- // V8 bug https://code.google.com/p/v8/issues/detail?id=3509
- $export($export.S + $export.F * !($acosh && Math.floor($acosh(Number.MAX_VALUE)) == 710), 'Math', {
- acosh: function acosh(x){
- return (x = +x) < 1 ? NaN : x > 94906265.62425156
- ? Math.log(x) + Math.LN2
- : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
- }
- });
-
-/***/ },
-/* 79 */
-/***/ function(module, exports) {
-
- // 20.2.2.20 Math.log1p(x)
- module.exports = Math.log1p || function log1p(x){
- return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
- };
-
-/***/ },
-/* 80 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.5 Math.asinh(x)
- var $export = __webpack_require__(7);
-
- function asinh(x){
- return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
- }
-
- $export($export.S, 'Math', {asinh: asinh});
-
-/***/ },
-/* 81 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.7 Math.atanh(x)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Math', {
- atanh: function atanh(x){
- return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
- }
- });
-
-/***/ },
-/* 82 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.9 Math.cbrt(x)
- var $export = __webpack_require__(7)
- , sign = __webpack_require__(83);
-
- $export($export.S, 'Math', {
- cbrt: function cbrt(x){
- return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3);
- }
- });
-
-/***/ },
-/* 83 */
-/***/ function(module, exports) {
-
- // 20.2.2.28 Math.sign(x)
- module.exports = Math.sign || function sign(x){
- return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
- };
-
-/***/ },
-/* 84 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.11 Math.clz32(x)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Math', {
- clz32: function clz32(x){
- return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32;
- }
- });
-
-/***/ },
-/* 85 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.12 Math.cosh(x)
- var $export = __webpack_require__(7)
- , exp = Math.exp;
-
- $export($export.S, 'Math', {
- cosh: function cosh(x){
- return (exp(x = +x) + exp(-x)) / 2;
- }
- });
-
-/***/ },
-/* 86 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.14 Math.expm1(x)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Math', {expm1: __webpack_require__(87)});
-
-/***/ },
-/* 87 */
-/***/ function(module, exports) {
-
- // 20.2.2.14 Math.expm1(x)
- module.exports = Math.expm1 || function expm1(x){
- return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
- };
-
-/***/ },
-/* 88 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.16 Math.fround(x)
- var $export = __webpack_require__(7)
- , sign = __webpack_require__(83)
- , pow = Math.pow
- , EPSILON = pow(2, -52)
- , EPSILON32 = pow(2, -23)
- , MAX32 = pow(2, 127) * (2 - EPSILON32)
- , MIN32 = pow(2, -126);
-
- var roundTiesToEven = function(n){
- return n + 1 / EPSILON - 1 / EPSILON;
- };
-
-
- $export($export.S, 'Math', {
- fround: function fround(x){
- var $abs = Math.abs(x)
- , $sign = sign(x)
- , a, result;
- if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
- a = (1 + EPSILON32 / EPSILON) * $abs;
- result = a - (a - $abs);
- if(result > MAX32 || result != result)return $sign * Infinity;
- return $sign * result;
- }
- });
-
-/***/ },
-/* 89 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
- var $export = __webpack_require__(7)
- , abs = Math.abs;
-
- $export($export.S, 'Math', {
- hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars
- var sum = 0
- , i = 0
- , $$ = arguments
- , $$len = $$.length
- , larg = 0
- , arg, div;
- while(i < $$len){
- arg = abs($$[i++]);
- if(larg < arg){
- div = larg / arg;
- sum = sum * div * div + 1;
- larg = arg;
- } else if(arg > 0){
- div = arg / larg;
- sum += div * div;
- } else sum += arg;
- }
- return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
- }
- });
-
-/***/ },
-/* 90 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.18 Math.imul(x, y)
- var $export = __webpack_require__(7)
- , $imul = Math.imul;
-
- // some WebKit versions fails with big numbers, some has wrong arity
- $export($export.S + $export.F * __webpack_require__(13)(function(){
- return $imul(0xffffffff, 5) != -5 || $imul.length != 2;
- }), 'Math', {
- imul: function imul(x, y){
- var UINT16 = 0xffff
- , xn = +x
- , yn = +y
- , xl = UINT16 & xn
- , yl = UINT16 & yn;
- return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
- }
- });
-
-/***/ },
-/* 91 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.21 Math.log10(x)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Math', {
- log10: function log10(x){
- return Math.log(x) / Math.LN10;
- }
- });
-
-/***/ },
-/* 92 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.20 Math.log1p(x)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Math', {log1p: __webpack_require__(79)});
-
-/***/ },
-/* 93 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.22 Math.log2(x)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Math', {
- log2: function log2(x){
- return Math.log(x) / Math.LN2;
- }
- });
-
-/***/ },
-/* 94 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.28 Math.sign(x)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Math', {sign: __webpack_require__(83)});
-
-/***/ },
-/* 95 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.30 Math.sinh(x)
- var $export = __webpack_require__(7)
- , expm1 = __webpack_require__(87)
- , exp = Math.exp;
-
- // V8 near Chromium 38 has a problem with very small numbers
- $export($export.S + $export.F * __webpack_require__(13)(function(){
- return !Math.sinh(-2e-17) != -2e-17;
- }), 'Math', {
- sinh: function sinh(x){
- return Math.abs(x = +x) < 1
- ? (expm1(x) - expm1(-x)) / 2
- : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
- }
- });
-
-/***/ },
-/* 96 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.33 Math.tanh(x)
- var $export = __webpack_require__(7)
- , expm1 = __webpack_require__(87)
- , exp = Math.exp;
-
- $export($export.S, 'Math', {
- tanh: function tanh(x){
- var a = expm1(x = +x)
- , b = expm1(-x);
- return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
- }
- });
-
-/***/ },
-/* 97 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 20.2.2.34 Math.trunc(x)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Math', {
- trunc: function trunc(it){
- return (it > 0 ? Math.floor : Math.ceil)(it);
- }
- });
-
-/***/ },
-/* 98 */
-/***/ function(module, exports, __webpack_require__) {
-
- var $export = __webpack_require__(7)
- , toIndex = __webpack_require__(30)
- , fromCharCode = String.fromCharCode
- , $fromCodePoint = String.fromCodePoint;
-
- // length should be 1, old FF problem
- $export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
- // 21.1.2.2 String.fromCodePoint(...codePoints)
- fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars
- var res = []
- , $$ = arguments
- , $$len = $$.length
- , i = 0
- , code;
- while($$len > i){
- code = +$$[i++];
- if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
- res.push(code < 0x10000
- ? fromCharCode(code)
- : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
- );
- } return res.join('');
- }
- });
-
-/***/ },
-/* 99 */
-/***/ function(module, exports, __webpack_require__) {
-
- var $export = __webpack_require__(7)
- , toIObject = __webpack_require__(27)
- , toLength = __webpack_require__(31);
-
- $export($export.S, 'String', {
- // 21.1.2.4 String.raw(callSite, ...substitutions)
- raw: function raw(callSite){
- var tpl = toIObject(callSite.raw)
- , len = toLength(tpl.length)
- , $$ = arguments
- , $$len = $$.length
- , res = []
- , i = 0;
- while(len > i){
- res.push(String(tpl[i++]));
- if(i < $$len)res.push(String($$[i]));
- } return res.join('');
- }
- });
-
-/***/ },
-/* 100 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- // 21.1.3.25 String.prototype.trim()
- __webpack_require__(67)('trim', function($trim){
- return function trim(){
- return $trim(this, 3);
- };
- });
-
-/***/ },
-/* 101 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $at = __webpack_require__(102)(true);
-
- // 21.1.3.27 String.prototype[@@iterator]()
- __webpack_require__(103)(String, 'String', function(iterated){
- this._t = String(iterated); // target
- this._i = 0; // next index
- // 21.1.5.2.1 %StringIteratorPrototype%.next()
- }, function(){
- var O = this._t
- , index = this._i
- , point;
- if(index >= O.length)return {value: undefined, done: true};
- point = $at(O, index);
- this._i += point.length;
- return {value: point, done: false};
- });
-
-/***/ },
-/* 102 */
-/***/ function(module, exports, __webpack_require__) {
-
- var toInteger = __webpack_require__(29)
- , defined = __webpack_require__(26);
- // true -> String#at
- // false -> String#codePointAt
- module.exports = function(TO_STRING){
- return function(that, pos){
- var s = String(defined(that))
- , i = toInteger(pos)
- , l = s.length
- , a, b;
- if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
- a = s.charCodeAt(i);
- return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
- ? TO_STRING ? s.charAt(i) : a
- : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
- };
- };
-
-/***/ },
-/* 103 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var LIBRARY = __webpack_require__(43)
- , $export = __webpack_require__(7)
- , redefine = __webpack_require__(14)
- , hide = __webpack_require__(10)
- , has = __webpack_require__(21)
- , Iterators = __webpack_require__(104)
- , $iterCreate = __webpack_require__(105)
- , setToStringTag = __webpack_require__(39)
- , getProto = __webpack_require__(6).getProto
- , ITERATOR = __webpack_require__(35)('iterator')
- , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
- , FF_ITERATOR = '@@iterator'
- , KEYS = 'keys'
- , VALUES = 'values';
-
- var returnThis = function(){ return this; };
-
- module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
- $iterCreate(Constructor, NAME, next);
- var getMethod = function(kind){
- if(!BUGGY && kind in proto)return proto[kind];
- switch(kind){
- case KEYS: return function keys(){ return new Constructor(this, kind); };
- case VALUES: return function values(){ return new Constructor(this, kind); };
- } return function entries(){ return new Constructor(this, kind); };
- };
- var TAG = NAME + ' Iterator'
- , DEF_VALUES = DEFAULT == VALUES
- , VALUES_BUG = false
- , proto = Base.prototype
- , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
- , $default = $native || getMethod(DEFAULT)
- , methods, key;
- // Fix native
- if($native){
- var IteratorPrototype = getProto($default.call(new Base));
- // Set @@toStringTag to native iterators
- setToStringTag(IteratorPrototype, TAG, true);
- // FF fix
- if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
- // fix Array#{values, @@iterator}.name in V8 / FF
- if(DEF_VALUES && $native.name !== VALUES){
- VALUES_BUG = true;
- $default = function values(){ return $native.call(this); };
- }
- }
- // Define iterator
- if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
- hide(proto, ITERATOR, $default);
- }
- // Plug for library
- Iterators[NAME] = $default;
- Iterators[TAG] = returnThis;
- if(DEFAULT){
- methods = {
- values: DEF_VALUES ? $default : getMethod(VALUES),
- keys: IS_SET ? $default : getMethod(KEYS),
- entries: !DEF_VALUES ? $default : getMethod('entries')
- };
- if(FORCED)for(key in methods){
- if(!(key in proto))redefine(proto, key, methods[key]);
- } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
- }
- return methods;
- };
-
-/***/ },
-/* 104 */
-/***/ function(module, exports) {
-
- module.exports = {};
-
-/***/ },
-/* 105 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $ = __webpack_require__(6)
- , descriptor = __webpack_require__(11)
- , setToStringTag = __webpack_require__(39)
- , IteratorPrototype = {};
-
- // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
- __webpack_require__(10)(IteratorPrototype, __webpack_require__(35)('iterator'), function(){ return this; });
-
- module.exports = function(Constructor, NAME, next){
- Constructor.prototype = $.create(IteratorPrototype, {next: descriptor(1, next)});
- setToStringTag(Constructor, NAME + ' Iterator');
- };
-
-/***/ },
-/* 106 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $export = __webpack_require__(7)
- , $at = __webpack_require__(102)(false);
- $export($export.P, 'String', {
- // 21.1.3.3 String.prototype.codePointAt(pos)
- codePointAt: function codePointAt(pos){
- return $at(this, pos);
- }
- });
-
-/***/ },
-/* 107 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
- 'use strict';
- var $export = __webpack_require__(7)
- , toLength = __webpack_require__(31)
- , context = __webpack_require__(108)
- , ENDS_WITH = 'endsWith'
- , $endsWith = ''[ENDS_WITH];
-
- $export($export.P + $export.F * __webpack_require__(110)(ENDS_WITH), 'String', {
- endsWith: function endsWith(searchString /*, endPosition = @length */){
- var that = context(this, searchString, ENDS_WITH)
- , $$ = arguments
- , endPosition = $$.length > 1 ? $$[1] : undefined
- , len = toLength(that.length)
- , end = endPosition === undefined ? len : Math.min(toLength(endPosition), len)
- , search = String(searchString);
- return $endsWith
- ? $endsWith.call(that, search, end)
- : that.slice(end - search.length, end) === search;
- }
- });
-
-/***/ },
-/* 108 */
-/***/ function(module, exports, __webpack_require__) {
-
- // helper for String#{startsWith, endsWith, includes}
- var isRegExp = __webpack_require__(109)
- , defined = __webpack_require__(26);
-
- module.exports = function(that, searchString, NAME){
- if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!");
- return String(defined(that));
- };
-
-/***/ },
-/* 109 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 7.2.8 IsRegExp(argument)
- var isObject = __webpack_require__(20)
- , cof = __webpack_require__(22)
- , MATCH = __webpack_require__(35)('match');
- module.exports = function(it){
- var isRegExp;
- return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
- };
-
-/***/ },
-/* 110 */
-/***/ function(module, exports, __webpack_require__) {
-
- var MATCH = __webpack_require__(35)('match');
- module.exports = function(KEY){
- var re = /./;
- try {
- '/./'[KEY](re);
- } catch(e){
- try {
- re[MATCH] = false;
- return !'/./'[KEY](re);
- } catch(f){ /* empty */ }
- } return true;
- };
-
-/***/ },
-/* 111 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 21.1.3.7 String.prototype.includes(searchString, position = 0)
- 'use strict';
- var $export = __webpack_require__(7)
- , context = __webpack_require__(108)
- , INCLUDES = 'includes';
-
- $export($export.P + $export.F * __webpack_require__(110)(INCLUDES), 'String', {
- includes: function includes(searchString /*, position = 0 */){
- return !!~context(this, searchString, INCLUDES)
- .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
-
-/***/ },
-/* 112 */
-/***/ function(module, exports, __webpack_require__) {
-
- var $export = __webpack_require__(7);
-
- $export($export.P, 'String', {
- // 21.1.3.13 String.prototype.repeat(count)
- repeat: __webpack_require__(113)
- });
-
-/***/ },
-/* 113 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var toInteger = __webpack_require__(29)
- , defined = __webpack_require__(26);
-
- module.exports = function repeat(count){
- var str = String(defined(this))
- , res = ''
- , n = toInteger(count);
- if(n < 0 || n == Infinity)throw RangeError("Count can't be negative");
- for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;
- return res;
- };
-
-/***/ },
-/* 114 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 21.1.3.18 String.prototype.startsWith(searchString [, position ])
- 'use strict';
- var $export = __webpack_require__(7)
- , toLength = __webpack_require__(31)
- , context = __webpack_require__(108)
- , STARTS_WITH = 'startsWith'
- , $startsWith = ''[STARTS_WITH];
-
- $export($export.P + $export.F * __webpack_require__(110)(STARTS_WITH), 'String', {
- startsWith: function startsWith(searchString /*, position = 0 */){
- var that = context(this, searchString, STARTS_WITH)
- , $$ = arguments
- , index = toLength(Math.min($$.length > 1 ? $$[1] : undefined, that.length))
- , search = String(searchString);
- return $startsWith
- ? $startsWith.call(that, search, index)
- : that.slice(index, index + search.length) === search;
- }
- });
-
-/***/ },
-/* 115 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var ctx = __webpack_require__(16)
- , $export = __webpack_require__(7)
- , toObject = __webpack_require__(25)
- , call = __webpack_require__(116)
- , isArrayIter = __webpack_require__(117)
- , toLength = __webpack_require__(31)
- , getIterFn = __webpack_require__(118);
- $export($export.S + $export.F * !__webpack_require__(119)(function(iter){ Array.from(iter); }), 'Array', {
- // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
- from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
- var O = toObject(arrayLike)
- , C = typeof this == 'function' ? this : Array
- , $$ = arguments
- , $$len = $$.length
- , mapfn = $$len > 1 ? $$[1] : undefined
- , mapping = mapfn !== undefined
- , index = 0
- , iterFn = getIterFn(O)
- , length, result, step, iterator;
- if(mapping)mapfn = ctx(mapfn, $$len > 2 ? $$[2] : undefined, 2);
- // if object isn't iterable or it's array with default iterator - use simple case
- if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
- for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
- result[index] = mapping ? call(iterator, mapfn, [step.value, index], true) : step.value;
- }
- } else {
- length = toLength(O.length);
- for(result = new C(length); length > index; index++){
- result[index] = mapping ? mapfn(O[index], index) : O[index];
- }
- }
- result.length = index;
- return result;
- }
- });
-
-
-/***/ },
-/* 116 */
-/***/ function(module, exports, __webpack_require__) {
-
- // call something on iterator step with safe closing on error
- var anObject = __webpack_require__(24);
- module.exports = function(iterator, fn, value, entries){
- try {
- return entries ? fn(anObject(value)[0], value[1]) : fn(value);
- // 7.4.6 IteratorClose(iterator, completion)
- } catch(e){
- var ret = iterator['return'];
- if(ret !== undefined)anObject(ret.call(iterator));
- throw e;
- }
- };
-
-/***/ },
-/* 117 */
-/***/ function(module, exports, __webpack_require__) {
-
- // check on default Array iterator
- var Iterators = __webpack_require__(104)
- , ITERATOR = __webpack_require__(35)('iterator')
- , ArrayProto = Array.prototype;
-
- module.exports = function(it){
- return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
- };
-
-/***/ },
-/* 118 */
-/***/ function(module, exports, __webpack_require__) {
-
- var classof = __webpack_require__(51)
- , ITERATOR = __webpack_require__(35)('iterator')
- , Iterators = __webpack_require__(104);
- module.exports = __webpack_require__(9).getIteratorMethod = function(it){
- if(it != undefined)return it[ITERATOR]
- || it['@@iterator']
- || Iterators[classof(it)];
- };
-
-/***/ },
-/* 119 */
-/***/ function(module, exports, __webpack_require__) {
-
- var ITERATOR = __webpack_require__(35)('iterator')
- , SAFE_CLOSING = false;
-
- try {
- var riter = [7][ITERATOR]();
- riter['return'] = function(){ SAFE_CLOSING = true; };
- Array.from(riter, function(){ throw 2; });
- } catch(e){ /* empty */ }
-
- module.exports = function(exec, skipClosing){
- if(!skipClosing && !SAFE_CLOSING)return false;
- var safe = false;
- try {
- var arr = [7]
- , iter = arr[ITERATOR]();
- iter.next = function(){ safe = true; };
- arr[ITERATOR] = function(){ return iter; };
- exec(arr);
- } catch(e){ /* empty */ }
- return safe;
- };
-
-/***/ },
-/* 120 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $export = __webpack_require__(7);
-
- // WebKit Array.of isn't generic
- $export($export.S + $export.F * __webpack_require__(13)(function(){
- function F(){}
- return !(Array.of.call(F) instanceof F);
- }), 'Array', {
- // 22.1.2.3 Array.of( ...items)
- of: function of(/* ...args */){
- var index = 0
- , $$ = arguments
- , $$len = $$.length
- , result = new (typeof this == 'function' ? this : Array)($$len);
- while($$len > index)result[index] = $$[index++];
- result.length = $$len;
- return result;
- }
- });
-
-/***/ },
-/* 121 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var addToUnscopables = __webpack_require__(122)
- , step = __webpack_require__(123)
- , Iterators = __webpack_require__(104)
- , toIObject = __webpack_require__(27);
-
- // 22.1.3.4 Array.prototype.entries()
- // 22.1.3.13 Array.prototype.keys()
- // 22.1.3.29 Array.prototype.values()
- // 22.1.3.30 Array.prototype[@@iterator]()
- module.exports = __webpack_require__(103)(Array, 'Array', function(iterated, kind){
- this._t = toIObject(iterated); // target
- this._i = 0; // next index
- this._k = kind; // kind
- // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
- }, function(){
- var O = this._t
- , kind = this._k
- , index = this._i++;
- if(!O || index >= O.length){
- this._t = undefined;
- return step(1);
- }
- if(kind == 'keys' )return step(0, index);
- if(kind == 'values')return step(0, O[index]);
- return step(0, [index, O[index]]);
- }, 'values');
-
- // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
- Iterators.Arguments = Iterators.Array;
-
- addToUnscopables('keys');
- addToUnscopables('values');
- addToUnscopables('entries');
-
-/***/ },
-/* 122 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 22.1.3.31 Array.prototype[@@unscopables]
- var UNSCOPABLES = __webpack_require__(35)('unscopables')
- , ArrayProto = Array.prototype;
- if(ArrayProto[UNSCOPABLES] == undefined)__webpack_require__(10)(ArrayProto, UNSCOPABLES, {});
- module.exports = function(key){
- ArrayProto[UNSCOPABLES][key] = true;
- };
-
-/***/ },
-/* 123 */
-/***/ function(module, exports) {
-
- module.exports = function(done, value){
- return {value: value, done: !!done};
- };
-
-/***/ },
-/* 124 */
-/***/ function(module, exports, __webpack_require__) {
-
- __webpack_require__(125)('Array');
-
-/***/ },
-/* 125 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var global = __webpack_require__(8)
- , $ = __webpack_require__(6)
- , DESCRIPTORS = __webpack_require__(12)
- , SPECIES = __webpack_require__(35)('species');
-
- module.exports = function(KEY){
- var C = global[KEY];
- if(DESCRIPTORS && C && !C[SPECIES])$.setDesc(C, SPECIES, {
- configurable: true,
- get: function(){ return this; }
- });
- };
-
-/***/ },
-/* 126 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
- var $export = __webpack_require__(7);
-
- $export($export.P, 'Array', {copyWithin: __webpack_require__(127)});
-
- __webpack_require__(122)('copyWithin');
-
-/***/ },
-/* 127 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
- 'use strict';
- var toObject = __webpack_require__(25)
- , toIndex = __webpack_require__(30)
- , toLength = __webpack_require__(31);
-
- module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){
- var O = toObject(this)
- , len = toLength(O.length)
- , to = toIndex(target, len)
- , from = toIndex(start, len)
- , $$ = arguments
- , end = $$.length > 2 ? $$[2] : undefined
- , count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to)
- , inc = 1;
- if(from < to && to < from + count){
- inc = -1;
- from += count - 1;
- to += count - 1;
- }
- while(count-- > 0){
- if(from in O)O[to] = O[from];
- else delete O[to];
- to += inc;
- from += inc;
- } return O;
- };
-
-/***/ },
-/* 128 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
- var $export = __webpack_require__(7);
-
- $export($export.P, 'Array', {fill: __webpack_require__(129)});
-
- __webpack_require__(122)('fill');
-
-/***/ },
-/* 129 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
- 'use strict';
- var toObject = __webpack_require__(25)
- , toIndex = __webpack_require__(30)
- , toLength = __webpack_require__(31);
- module.exports = [].fill || function fill(value /*, start = 0, end = @length */){
- var O = toObject(this)
- , length = toLength(O.length)
- , $$ = arguments
- , $$len = $$.length
- , index = toIndex($$len > 1 ? $$[1] : undefined, length)
- , end = $$len > 2 ? $$[2] : undefined
- , endPos = end === undefined ? length : toIndex(end, length);
- while(endPos > index)O[index++] = value;
- return O;
- };
-
-/***/ },
-/* 130 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
- var $export = __webpack_require__(7)
- , $find = __webpack_require__(32)(5)
- , KEY = 'find'
- , forced = true;
- // Shouldn't skip holes
- if(KEY in [])Array(1)[KEY](function(){ forced = false; });
- $export($export.P + $export.F * forced, 'Array', {
- find: function find(callbackfn/*, that = undefined */){
- return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- __webpack_require__(122)(KEY);
-
-/***/ },
-/* 131 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
- var $export = __webpack_require__(7)
- , $find = __webpack_require__(32)(6)
- , KEY = 'findIndex'
- , forced = true;
- // Shouldn't skip holes
- if(KEY in [])Array(1)[KEY](function(){ forced = false; });
- $export($export.P + $export.F * forced, 'Array', {
- findIndex: function findIndex(callbackfn/*, that = undefined */){
- return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- __webpack_require__(122)(KEY);
-
-/***/ },
-/* 132 */
-/***/ function(module, exports, __webpack_require__) {
-
- var $ = __webpack_require__(6)
- , global = __webpack_require__(8)
- , isRegExp = __webpack_require__(109)
- , $flags = __webpack_require__(133)
- , $RegExp = global.RegExp
- , Base = $RegExp
- , proto = $RegExp.prototype
- , re1 = /a/g
- , re2 = /a/g
- // "new" creates a new object, old webkit buggy here
- , CORRECT_NEW = new $RegExp(re1) !== re1;
-
- if(__webpack_require__(12) && (!CORRECT_NEW || __webpack_require__(13)(function(){
- re2[__webpack_require__(35)('match')] = false;
- // RegExp constructor can alter flags and IsRegExp works correct with @@match
- return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
- }))){
- $RegExp = function RegExp(p, f){
- var piRE = isRegExp(p)
- , fiU = f === undefined;
- return !(this instanceof $RegExp) && piRE && p.constructor === $RegExp && fiU ? p
- : CORRECT_NEW
- ? new Base(piRE && !fiU ? p.source : p, f)
- : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f);
- };
- $.each.call($.getNames(Base), function(key){
- key in $RegExp || $.setDesc($RegExp, key, {
- configurable: true,
- get: function(){ return Base[key]; },
- set: function(it){ Base[key] = it; }
- });
- });
- proto.constructor = $RegExp;
- $RegExp.prototype = proto;
- __webpack_require__(14)(global, 'RegExp', $RegExp);
- }
-
- __webpack_require__(125)('RegExp');
-
-/***/ },
-/* 133 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- // 21.2.5.3 get RegExp.prototype.flags
- var anObject = __webpack_require__(24);
- module.exports = function(){
- var that = anObject(this)
- , result = '';
- if(that.global) result += 'g';
- if(that.ignoreCase) result += 'i';
- if(that.multiline) result += 'm';
- if(that.unicode) result += 'u';
- if(that.sticky) result += 'y';
- return result;
- };
-
-/***/ },
-/* 134 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 21.2.5.3 get RegExp.prototype.flags()
- var $ = __webpack_require__(6);
- if(__webpack_require__(12) && /./g.flags != 'g')$.setDesc(RegExp.prototype, 'flags', {
- configurable: true,
- get: __webpack_require__(133)
- });
-
-/***/ },
-/* 135 */
-/***/ function(module, exports, __webpack_require__) {
-
- // @@match logic
- __webpack_require__(136)('match', 1, function(defined, MATCH){
- // 21.1.3.11 String.prototype.match(regexp)
- return function match(regexp){
- 'use strict';
- var O = defined(this)
- , fn = regexp == undefined ? undefined : regexp[MATCH];
- return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
- };
- });
-
-/***/ },
-/* 136 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var hide = __webpack_require__(10)
- , redefine = __webpack_require__(14)
- , fails = __webpack_require__(13)
- , defined = __webpack_require__(26)
- , wks = __webpack_require__(35);
-
- module.exports = function(KEY, length, exec){
- var SYMBOL = wks(KEY)
- , original = ''[KEY];
- if(fails(function(){
- var O = {};
- O[SYMBOL] = function(){ return 7; };
- return ''[KEY](O) != 7;
- })){
- redefine(String.prototype, KEY, exec(defined, SYMBOL, original));
- hide(RegExp.prototype, SYMBOL, length == 2
- // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
- // 21.2.5.11 RegExp.prototype[@@split](string, limit)
- ? function(string, arg){ return original.call(string, this, arg); }
- // 21.2.5.6 RegExp.prototype[@@match](string)
- // 21.2.5.9 RegExp.prototype[@@search](string)
- : function(string){ return original.call(string, this); }
- );
- }
- };
-
-/***/ },
-/* 137 */
-/***/ function(module, exports, __webpack_require__) {
-
- // @@replace logic
- __webpack_require__(136)('replace', 2, function(defined, REPLACE, $replace){
- // 21.1.3.14 String.prototype.replace(searchValue, replaceValue)
- return function replace(searchValue, replaceValue){
- 'use strict';
- var O = defined(this)
- , fn = searchValue == undefined ? undefined : searchValue[REPLACE];
- return fn !== undefined
- ? fn.call(searchValue, O, replaceValue)
- : $replace.call(String(O), searchValue, replaceValue);
- };
- });
-
-/***/ },
-/* 138 */
-/***/ function(module, exports, __webpack_require__) {
-
- // @@search logic
- __webpack_require__(136)('search', 1, function(defined, SEARCH){
- // 21.1.3.15 String.prototype.search(regexp)
- return function search(regexp){
- 'use strict';
- var O = defined(this)
- , fn = regexp == undefined ? undefined : regexp[SEARCH];
- return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
- };
- });
-
-/***/ },
-/* 139 */
-/***/ function(module, exports, __webpack_require__) {
-
- // @@split logic
- __webpack_require__(136)('split', 2, function(defined, SPLIT, $split){
- // 21.1.3.17 String.prototype.split(separator, limit)
- return function split(separator, limit){
- 'use strict';
- var O = defined(this)
- , fn = separator == undefined ? undefined : separator[SPLIT];
- return fn !== undefined
- ? fn.call(separator, O, limit)
- : $split.call(String(O), separator, limit);
- };
- });
-
-/***/ },
-/* 140 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $ = __webpack_require__(6)
- , LIBRARY = __webpack_require__(43)
- , global = __webpack_require__(8)
- , ctx = __webpack_require__(16)
- , classof = __webpack_require__(51)
- , $export = __webpack_require__(7)
- , isObject = __webpack_require__(20)
- , anObject = __webpack_require__(24)
- , aFunction = __webpack_require__(17)
- , strictNew = __webpack_require__(141)
- , forOf = __webpack_require__(142)
- , setProto = __webpack_require__(49).set
- , same = __webpack_require__(47)
- , SPECIES = __webpack_require__(35)('species')
- , speciesConstructor = __webpack_require__(143)
- , asap = __webpack_require__(144)
- , PROMISE = 'Promise'
- , process = global.process
- , isNode = classof(process) == 'process'
- , P = global[PROMISE]
- , Wrapper;
-
- var testResolve = function(sub){
- var test = new P(function(){});
- if(sub)test.constructor = Object;
- return P.resolve(test) === test;
- };
-
- var USE_NATIVE = function(){
- var works = false;
- function P2(x){
- var self = new P(x);
- setProto(self, P2.prototype);
- return self;
- }
- try {
- works = P && P.resolve && testResolve();
- setProto(P2, P);
- P2.prototype = $.create(P.prototype, {constructor: {value: P2}});
- // actual Firefox has broken subclass support, test that
- if(!(P2.resolve(5).then(function(){}) instanceof P2)){
- works = false;
- }
- // actual V8 bug, https://code.google.com/p/v8/issues/detail?id=4162
- if(works && __webpack_require__(12)){
- var thenableThenGotten = false;
- P.resolve($.setDesc({}, 'then', {
- get: function(){ thenableThenGotten = true; }
- }));
- works = thenableThenGotten;
- }
- } catch(e){ works = false; }
- return works;
- }();
-
- // helpers
- var sameConstructor = function(a, b){
- // library wrapper special case
- if(LIBRARY && a === P && b === Wrapper)return true;
- return same(a, b);
- };
- var getConstructor = function(C){
- var S = anObject(C)[SPECIES];
- return S != undefined ? S : C;
- };
- var isThenable = function(it){
- var then;
- return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
- };
- var PromiseCapability = function(C){
- var resolve, reject;
- this.promise = new C(function($$resolve, $$reject){
- if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor');
- resolve = $$resolve;
- reject = $$reject;
- });
- this.resolve = aFunction(resolve),
- this.reject = aFunction(reject)
- };
- var perform = function(exec){
- try {
- exec();
- } catch(e){
- return {error: e};
- }
- };
- var notify = function(record, isReject){
- if(record.n)return;
- record.n = true;
- var chain = record.c;
- asap(function(){
- var value = record.v
- , ok = record.s == 1
- , i = 0;
- var run = function(reaction){
- var handler = ok ? reaction.ok : reaction.fail
- , resolve = reaction.resolve
- , reject = reaction.reject
- , result, then;
- try {
- if(handler){
- if(!ok)record.h = true;
- result = handler === true ? value : handler(value);
- if(result === reaction.promise){
- reject(TypeError('Promise-chain cycle'));
- } else if(then = isThenable(result)){
- then.call(result, resolve, reject);
- } else resolve(result);
- } else reject(value);
- } catch(e){
- reject(e);
- }
- };
- while(chain.length > i)run(chain[i++]); // variable length - can't use forEach
- chain.length = 0;
- record.n = false;
- if(isReject)setTimeout(function(){
- var promise = record.p
- , handler, console;
- if(isUnhandled(promise)){
- if(isNode){
- process.emit('unhandledRejection', value, promise);
- } else if(handler = global.onunhandledrejection){
- handler({promise: promise, reason: value});
- } else if((console = global.console) && console.error){
- console.error('Unhandled promise rejection', value);
- }
- } record.a = undefined;
- }, 1);
- });
- };
- var isUnhandled = function(promise){
- var record = promise._d
- , chain = record.a || record.c
- , i = 0
- , reaction;
- if(record.h)return false;
- while(chain.length > i){
- reaction = chain[i++];
- if(reaction.fail || !isUnhandled(reaction.promise))return false;
- } return true;
- };
- var $reject = function(value){
- var record = this;
- if(record.d)return;
- record.d = true;
- record = record.r || record; // unwrap
- record.v = value;
- record.s = 2;
- record.a = record.c.slice();
- notify(record, true);
- };
- var $resolve = function(value){
- var record = this
- , then;
- if(record.d)return;
- record.d = true;
- record = record.r || record; // unwrap
- try {
- if(record.p === value)throw TypeError("Promise can't be resolved itself");
- if(then = isThenable(value)){
- asap(function(){
- var wrapper = {r: record, d: false}; // wrap
- try {
- then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
- } catch(e){
- $reject.call(wrapper, e);
- }
- });
- } else {
- record.v = value;
- record.s = 1;
- notify(record, false);
- }
- } catch(e){
- $reject.call({r: record, d: false}, e); // wrap
- }
- };
-
- // constructor polyfill
- if(!USE_NATIVE){
- // 25.4.3.1 Promise(executor)
- P = function Promise(executor){
- aFunction(executor);
- var record = this._d = {
- p: strictNew(this, P, PROMISE), // <- promise
- c: [], // <- awaiting reactions
- a: undefined, // <- checked in isUnhandled reactions
- s: 0, // <- state
- d: false, // <- done
- v: undefined, // <- value
- h: false, // <- handled rejection
- n: false // <- notify
- };
- try {
- executor(ctx($resolve, record, 1), ctx($reject, record, 1));
- } catch(err){
- $reject.call(record, err);
- }
- };
- __webpack_require__(146)(P.prototype, {
- // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
- then: function then(onFulfilled, onRejected){
- var reaction = new PromiseCapability(speciesConstructor(this, P))
- , promise = reaction.promise
- , record = this._d;
- reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
- reaction.fail = typeof onRejected == 'function' && onRejected;
- record.c.push(reaction);
- if(record.a)record.a.push(reaction);
- if(record.s)notify(record, false);
- return promise;
- },
- // 25.4.5.1 Promise.prototype.catch(onRejected)
- 'catch': function(onRejected){
- return this.then(undefined, onRejected);
- }
- });
- }
-
- $export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: P});
- __webpack_require__(39)(P, PROMISE);
- __webpack_require__(125)(PROMISE);
- Wrapper = __webpack_require__(9)[PROMISE];
-
- // statics
- $export($export.S + $export.F * !USE_NATIVE, PROMISE, {
- // 25.4.4.5 Promise.reject(r)
- reject: function reject(r){
- var capability = new PromiseCapability(this)
- , $$reject = capability.reject;
- $$reject(r);
- return capability.promise;
- }
- });
- $export($export.S + $export.F * (!USE_NATIVE || testResolve(true)), PROMISE, {
- // 25.4.4.6 Promise.resolve(x)
- resolve: function resolve(x){
- // instanceof instead of internal slot check because we should fix it without replacement native Promise core
- if(x instanceof P && sameConstructor(x.constructor, this))return x;
- var capability = new PromiseCapability(this)
- , $$resolve = capability.resolve;
- $$resolve(x);
- return capability.promise;
- }
- });
- $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(119)(function(iter){
- P.all(iter)['catch'](function(){});
- })), PROMISE, {
- // 25.4.4.1 Promise.all(iterable)
- all: function all(iterable){
- var C = getConstructor(this)
- , capability = new PromiseCapability(C)
- , resolve = capability.resolve
- , reject = capability.reject
- , values = [];
- var abrupt = perform(function(){
- forOf(iterable, false, values.push, values);
- var remaining = values.length
- , results = Array(remaining);
- if(remaining)$.each.call(values, function(promise, index){
- var alreadyCalled = false;
- C.resolve(promise).then(function(value){
- if(alreadyCalled)return;
- alreadyCalled = true;
- results[index] = value;
- --remaining || resolve(results);
- }, reject);
- });
- else resolve(results);
- });
- if(abrupt)reject(abrupt.error);
- return capability.promise;
- },
- // 25.4.4.4 Promise.race(iterable)
- race: function race(iterable){
- var C = getConstructor(this)
- , capability = new PromiseCapability(C)
- , reject = capability.reject;
- var abrupt = perform(function(){
- forOf(iterable, false, function(promise){
- C.resolve(promise).then(capability.resolve, reject);
- });
- });
- if(abrupt)reject(abrupt.error);
- return capability.promise;
- }
- });
-
-/***/ },
-/* 141 */
-/***/ function(module, exports) {
-
- module.exports = function(it, Constructor, name){
- if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!");
- return it;
- };
-
-/***/ },
-/* 142 */
-/***/ function(module, exports, __webpack_require__) {
-
- var ctx = __webpack_require__(16)
- , call = __webpack_require__(116)
- , isArrayIter = __webpack_require__(117)
- , anObject = __webpack_require__(24)
- , toLength = __webpack_require__(31)
- , getIterFn = __webpack_require__(118);
- module.exports = function(iterable, entries, fn, that){
- var iterFn = getIterFn(iterable)
- , f = ctx(fn, that, entries ? 2 : 1)
- , index = 0
- , length, step, iterator;
- if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
- // fast case for arrays with default iterator
- if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
- entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
- } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
- call(iterator, f, step.value, entries);
- }
- };
-
-/***/ },
-/* 143 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 7.3.20 SpeciesConstructor(O, defaultConstructor)
- var anObject = __webpack_require__(24)
- , aFunction = __webpack_require__(17)
- , SPECIES = __webpack_require__(35)('species');
- module.exports = function(O, D){
- var C = anObject(O).constructor, S;
- return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
- };
-
-/***/ },
-/* 144 */
-/***/ function(module, exports, __webpack_require__) {
-
- var global = __webpack_require__(8)
- , macrotask = __webpack_require__(145).set
- , Observer = global.MutationObserver || global.WebKitMutationObserver
- , process = global.process
- , Promise = global.Promise
- , isNode = __webpack_require__(22)(process) == 'process'
- , head, last, notify;
-
- var flush = function(){
- var parent, domain, fn;
- if(isNode && (parent = process.domain)){
- process.domain = null;
- parent.exit();
- }
- while(head){
- domain = head.domain;
- fn = head.fn;
- if(domain)domain.enter();
- fn(); // <- currently we use it only for Promise - try / catch not required
- if(domain)domain.exit();
- head = head.next;
- } last = undefined;
- if(parent)parent.enter();
- };
-
- // Node.js
- if(isNode){
- notify = function(){
- process.nextTick(flush);
- };
- // browsers with MutationObserver
- } else if(Observer){
- var toggle = 1
- , node = document.createTextNode('');
- new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
- notify = function(){
- node.data = toggle = -toggle;
- };
- // environments with maybe non-completely correct, but existent Promise
- } else if(Promise && Promise.resolve){
- notify = function(){
- Promise.resolve().then(flush);
- };
- // for other environments - macrotask based on:
- // - setImmediate
- // - MessageChannel
- // - window.postMessag
- // - onreadystatechange
- // - setTimeout
- } else {
- notify = function(){
- // strange IE + webpack dev server bug - use .call(global)
- macrotask.call(global, flush);
- };
- }
-
- module.exports = function asap(fn){
- var task = {fn: fn, next: undefined, domain: isNode && process.domain};
- if(last)last.next = task;
- if(!head){
- head = task;
- notify();
- } last = task;
- };
-
-/***/ },
-/* 145 */
-/***/ function(module, exports, __webpack_require__) {
-
- var ctx = __webpack_require__(16)
- , invoke = __webpack_require__(23)
- , html = __webpack_require__(18)
- , cel = __webpack_require__(19)
- , global = __webpack_require__(8)
- , process = global.process
- , setTask = global.setImmediate
- , clearTask = global.clearImmediate
- , MessageChannel = global.MessageChannel
- , counter = 0
- , queue = {}
- , ONREADYSTATECHANGE = 'onreadystatechange'
- , defer, channel, port;
- var run = function(){
- var id = +this;
- if(queue.hasOwnProperty(id)){
- var fn = queue[id];
- delete queue[id];
- fn();
- }
- };
- var listner = function(event){
- run.call(event.data);
- };
- // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
- if(!setTask || !clearTask){
- setTask = function setImmediate(fn){
- var args = [], i = 1;
- while(arguments.length > i)args.push(arguments[i++]);
- queue[++counter] = function(){
- invoke(typeof fn == 'function' ? fn : Function(fn), args);
- };
- defer(counter);
- return counter;
- };
- clearTask = function clearImmediate(id){
- delete queue[id];
- };
- // Node.js 0.8-
- if(__webpack_require__(22)(process) == 'process'){
- defer = function(id){
- process.nextTick(ctx(run, id, 1));
- };
- // Browsers with MessageChannel, includes WebWorkers
- } else if(MessageChannel){
- channel = new MessageChannel;
- port = channel.port2;
- channel.port1.onmessage = listner;
- defer = ctx(port.postMessage, port, 1);
- // Browsers with postMessage, skip WebWorkers
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
- } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){
- defer = function(id){
- global.postMessage(id + '', '*');
- };
- global.addEventListener('message', listner, false);
- // IE8-
- } else if(ONREADYSTATECHANGE in cel('script')){
- defer = function(id){
- html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){
- html.removeChild(this);
- run.call(id);
- };
- };
- // Rest old browsers
- } else {
- defer = function(id){
- setTimeout(ctx(run, id, 1), 0);
- };
- }
- }
- module.exports = {
- set: setTask,
- clear: clearTask
- };
-
-/***/ },
-/* 146 */
-/***/ function(module, exports, __webpack_require__) {
-
- var redefine = __webpack_require__(14);
- module.exports = function(target, src){
- for(var key in src)redefine(target, key, src[key]);
- return target;
- };
-
-/***/ },
-/* 147 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var strong = __webpack_require__(148);
-
- // 23.1 Map Objects
- __webpack_require__(149)('Map', function(get){
- return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
- }, {
- // 23.1.3.6 Map.prototype.get(key)
- get: function get(key){
- var entry = strong.getEntry(this, key);
- return entry && entry.v;
- },
- // 23.1.3.9 Map.prototype.set(key, value)
- set: function set(key, value){
- return strong.def(this, key === 0 ? 0 : key, value);
- }
- }, strong, true);
-
-/***/ },
-/* 148 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $ = __webpack_require__(6)
- , hide = __webpack_require__(10)
- , redefineAll = __webpack_require__(146)
- , ctx = __webpack_require__(16)
- , strictNew = __webpack_require__(141)
- , defined = __webpack_require__(26)
- , forOf = __webpack_require__(142)
- , $iterDefine = __webpack_require__(103)
- , step = __webpack_require__(123)
- , ID = __webpack_require__(15)('id')
- , $has = __webpack_require__(21)
- , isObject = __webpack_require__(20)
- , setSpecies = __webpack_require__(125)
- , DESCRIPTORS = __webpack_require__(12)
- , isExtensible = Object.isExtensible || isObject
- , SIZE = DESCRIPTORS ? '_s' : 'size'
- , id = 0;
-
- var fastKey = function(it, create){
- // return primitive with prefix
- if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
- if(!$has(it, ID)){
- // can't set id to frozen object
- if(!isExtensible(it))return 'F';
- // not necessary to add id
- if(!create)return 'E';
- // add missing object id
- hide(it, ID, ++id);
- // return object id with prefix
- } return 'O' + it[ID];
- };
-
- var getEntry = function(that, key){
- // fast case
- var index = fastKey(key), entry;
- if(index !== 'F')return that._i[index];
- // frozen object case
- for(entry = that._f; entry; entry = entry.n){
- if(entry.k == key)return entry;
- }
- };
-
- module.exports = {
- getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
- var C = wrapper(function(that, iterable){
- strictNew(that, C, NAME);
- that._i = $.create(null); // index
- that._f = undefined; // first entry
- that._l = undefined; // last entry
- that[SIZE] = 0; // size
- if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
- });
- redefineAll(C.prototype, {
- // 23.1.3.1 Map.prototype.clear()
- // 23.2.3.2 Set.prototype.clear()
- clear: function clear(){
- for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){
- entry.r = true;
- if(entry.p)entry.p = entry.p.n = undefined;
- delete data[entry.i];
- }
- that._f = that._l = undefined;
- that[SIZE] = 0;
- },
- // 23.1.3.3 Map.prototype.delete(key)
- // 23.2.3.4 Set.prototype.delete(value)
- 'delete': function(key){
- var that = this
- , entry = getEntry(that, key);
- if(entry){
- var next = entry.n
- , prev = entry.p;
- delete that._i[entry.i];
- entry.r = true;
- if(prev)prev.n = next;
- if(next)next.p = prev;
- if(that._f == entry)that._f = next;
- if(that._l == entry)that._l = prev;
- that[SIZE]--;
- } return !!entry;
- },
- // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
- // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
- forEach: function forEach(callbackfn /*, that = undefined */){
- var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3)
- , entry;
- while(entry = entry ? entry.n : this._f){
- f(entry.v, entry.k, this);
- // revert to the last existing entry
- while(entry && entry.r)entry = entry.p;
- }
- },
- // 23.1.3.7 Map.prototype.has(key)
- // 23.2.3.7 Set.prototype.has(value)
- has: function has(key){
- return !!getEntry(this, key);
- }
- });
- if(DESCRIPTORS)$.setDesc(C.prototype, 'size', {
- get: function(){
- return defined(this[SIZE]);
- }
- });
- return C;
- },
- def: function(that, key, value){
- var entry = getEntry(that, key)
- , prev, index;
- // change existing entry
- if(entry){
- entry.v = value;
- // create new entry
- } else {
- that._l = entry = {
- i: index = fastKey(key, true), // <- index
- k: key, // <- key
- v: value, // <- value
- p: prev = that._l, // <- previous entry
- n: undefined, // <- next entry
- r: false // <- removed
- };
- if(!that._f)that._f = entry;
- if(prev)prev.n = entry;
- that[SIZE]++;
- // add to index
- if(index !== 'F')that._i[index] = entry;
- } return that;
- },
- getEntry: getEntry,
- setStrong: function(C, NAME, IS_MAP){
- // add .keys, .values, .entries, [@@iterator]
- // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
- $iterDefine(C, NAME, function(iterated, kind){
- this._t = iterated; // target
- this._k = kind; // kind
- this._l = undefined; // previous
- }, function(){
- var that = this
- , kind = that._k
- , entry = that._l;
- // revert to the last existing entry
- while(entry && entry.r)entry = entry.p;
- // get next entry
- if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){
- // or finish the iteration
- that._t = undefined;
- return step(1);
- }
- // return step by kind
- if(kind == 'keys' )return step(0, entry.k);
- if(kind == 'values')return step(0, entry.v);
- return step(0, [entry.k, entry.v]);
- }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);
-
- // add [@@species], 23.1.2.2, 23.2.2.2
- setSpecies(NAME);
- }
- };
-
-/***/ },
-/* 149 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var global = __webpack_require__(8)
- , $export = __webpack_require__(7)
- , redefine = __webpack_require__(14)
- , redefineAll = __webpack_require__(146)
- , forOf = __webpack_require__(142)
- , strictNew = __webpack_require__(141)
- , isObject = __webpack_require__(20)
- , fails = __webpack_require__(13)
- , $iterDetect = __webpack_require__(119)
- , setToStringTag = __webpack_require__(39);
-
- module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
- var Base = global[NAME]
- , C = Base
- , ADDER = IS_MAP ? 'set' : 'add'
- , proto = C && C.prototype
- , O = {};
- var fixMethod = function(KEY){
- var fn = proto[KEY];
- redefine(proto, KEY,
- KEY == 'delete' ? function(a){
- return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
- } : KEY == 'has' ? function has(a){
- return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
- } : KEY == 'get' ? function get(a){
- return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
- } : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; }
- : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; }
- );
- };
- if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){
- new C().entries().next();
- }))){
- // create collection constructor
- C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
- redefineAll(C.prototype, methods);
- } else {
- var instance = new C
- // early implementations not supports chaining
- , HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance
- // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
- , THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); })
- // most early implementations doesn't supports iterables, most modern - not close it correctly
- , ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new
- // for early implementations -0 and +0 not the same
- , BUGGY_ZERO;
- if(!ACCEPT_ITERABLES){
- C = wrapper(function(target, iterable){
- strictNew(target, C, NAME);
- var that = new Base;
- if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
- return that;
- });
- C.prototype = proto;
- proto.constructor = C;
- }
- IS_WEAK || instance.forEach(function(val, key){
- BUGGY_ZERO = 1 / key === -Infinity;
- });
- if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){
- fixMethod('delete');
- fixMethod('has');
- IS_MAP && fixMethod('get');
- }
- if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER);
- // weak collections should not contains .clear method
- if(IS_WEAK && proto.clear)delete proto.clear;
- }
-
- setToStringTag(C, NAME);
-
- O[NAME] = C;
- $export($export.G + $export.W + $export.F * (C != Base), O);
-
- if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);
-
- return C;
- };
-
-/***/ },
-/* 150 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var strong = __webpack_require__(148);
-
- // 23.2 Set Objects
- __webpack_require__(149)('Set', function(get){
- return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
- }, {
- // 23.2.3.1 Set.prototype.add(value)
- add: function add(value){
- return strong.def(this, value = value === 0 ? 0 : value, value);
- }
- }, strong);
-
-/***/ },
-/* 151 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $ = __webpack_require__(6)
- , redefine = __webpack_require__(14)
- , weak = __webpack_require__(152)
- , isObject = __webpack_require__(20)
- , has = __webpack_require__(21)
- , frozenStore = weak.frozenStore
- , WEAK = weak.WEAK
- , isExtensible = Object.isExtensible || isObject
- , tmp = {};
-
- // 23.3 WeakMap Objects
- var $WeakMap = __webpack_require__(149)('WeakMap', function(get){
- return function WeakMap(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
- }, {
- // 23.3.3.3 WeakMap.prototype.get(key)
- get: function get(key){
- if(isObject(key)){
- if(!isExtensible(key))return frozenStore(this).get(key);
- if(has(key, WEAK))return key[WEAK][this._i];
- }
- },
- // 23.3.3.5 WeakMap.prototype.set(key, value)
- set: function set(key, value){
- return weak.def(this, key, value);
- }
- }, weak, true, true);
-
- // IE11 WeakMap frozen keys fix
- if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
- $.each.call(['delete', 'has', 'get', 'set'], function(key){
- var proto = $WeakMap.prototype
- , method = proto[key];
- redefine(proto, key, function(a, b){
- // store frozen objects on leaky map
- if(isObject(a) && !isExtensible(a)){
- var result = frozenStore(this)[key](a, b);
- return key == 'set' ? this : result;
- // store all the rest on native weakmap
- } return method.call(this, a, b);
- });
- });
- }
-
-/***/ },
-/* 152 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var hide = __webpack_require__(10)
- , redefineAll = __webpack_require__(146)
- , anObject = __webpack_require__(24)
- , isObject = __webpack_require__(20)
- , strictNew = __webpack_require__(141)
- , forOf = __webpack_require__(142)
- , createArrayMethod = __webpack_require__(32)
- , $has = __webpack_require__(21)
- , WEAK = __webpack_require__(15)('weak')
- , isExtensible = Object.isExtensible || isObject
- , arrayFind = createArrayMethod(5)
- , arrayFindIndex = createArrayMethod(6)
- , id = 0;
-
- // fallback for frozen keys
- var frozenStore = function(that){
- return that._l || (that._l = new FrozenStore);
- };
- var FrozenStore = function(){
- this.a = [];
- };
- var findFrozen = function(store, key){
- return arrayFind(store.a, function(it){
- return it[0] === key;
- });
- };
- FrozenStore.prototype = {
- get: function(key){
- var entry = findFrozen(this, key);
- if(entry)return entry[1];
- },
- has: function(key){
- return !!findFrozen(this, key);
- },
- set: function(key, value){
- var entry = findFrozen(this, key);
- if(entry)entry[1] = value;
- else this.a.push([key, value]);
- },
- 'delete': function(key){
- var index = arrayFindIndex(this.a, function(it){
- return it[0] === key;
- });
- if(~index)this.a.splice(index, 1);
- return !!~index;
- }
- };
-
- module.exports = {
- getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
- var C = wrapper(function(that, iterable){
- strictNew(that, C, NAME);
- that._i = id++; // collection id
- that._l = undefined; // leak store for frozen objects
- if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
- });
- redefineAll(C.prototype, {
- // 23.3.3.2 WeakMap.prototype.delete(key)
- // 23.4.3.3 WeakSet.prototype.delete(value)
- 'delete': function(key){
- if(!isObject(key))return false;
- if(!isExtensible(key))return frozenStore(this)['delete'](key);
- return $has(key, WEAK) && $has(key[WEAK], this._i) && delete key[WEAK][this._i];
- },
- // 23.3.3.4 WeakMap.prototype.has(key)
- // 23.4.3.4 WeakSet.prototype.has(value)
- has: function has(key){
- if(!isObject(key))return false;
- if(!isExtensible(key))return frozenStore(this).has(key);
- return $has(key, WEAK) && $has(key[WEAK], this._i);
- }
- });
- return C;
- },
- def: function(that, key, value){
- if(!isExtensible(anObject(key))){
- frozenStore(that).set(key, value);
- } else {
- $has(key, WEAK) || hide(key, WEAK, {});
- key[WEAK][that._i] = value;
- } return that;
- },
- frozenStore: frozenStore,
- WEAK: WEAK
- };
-
-/***/ },
-/* 153 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var weak = __webpack_require__(152);
-
- // 23.4 WeakSet Objects
- __webpack_require__(149)('WeakSet', function(get){
- return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
- }, {
- // 23.4.3.1 WeakSet.prototype.add(value)
- add: function add(value){
- return weak.def(this, value, true);
- }
- }, weak, false, true);
-
-/***/ },
-/* 154 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
- var $export = __webpack_require__(7)
- , _apply = Function.apply;
-
- $export($export.S, 'Reflect', {
- apply: function apply(target, thisArgument, argumentsList){
- return _apply.call(target, thisArgument, argumentsList);
- }
- });
-
-/***/ },
-/* 155 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
- var $ = __webpack_require__(6)
- , $export = __webpack_require__(7)
- , aFunction = __webpack_require__(17)
- , anObject = __webpack_require__(24)
- , isObject = __webpack_require__(20)
- , bind = Function.bind || __webpack_require__(9).Function.prototype.bind;
-
- // MS Edge supports only 2 arguments
- // FF Nightly sets third argument as `new.target`, but does not create `this` from it
- $export($export.S + $export.F * __webpack_require__(13)(function(){
- function F(){}
- return !(Reflect.construct(function(){}, [], F) instanceof F);
- }), 'Reflect', {
- construct: function construct(Target, args /*, newTarget*/){
- aFunction(Target);
- var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
- if(Target == newTarget){
- // w/o altered newTarget, optimization for 0-4 arguments
- if(args != undefined)switch(anObject(args).length){
- case 0: return new Target;
- case 1: return new Target(args[0]);
- case 2: return new Target(args[0], args[1]);
- case 3: return new Target(args[0], args[1], args[2]);
- case 4: return new Target(args[0], args[1], args[2], args[3]);
- }
- // w/o altered newTarget, lot of arguments case
- var $args = [null];
- $args.push.apply($args, args);
- return new (bind.apply(Target, $args));
- }
- // with altered newTarget, not support built-in constructors
- var proto = newTarget.prototype
- , instance = $.create(isObject(proto) ? proto : Object.prototype)
- , result = Function.apply.call(Target, instance, args);
- return isObject(result) ? result : instance;
- }
- });
-
-/***/ },
-/* 156 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
- var $ = __webpack_require__(6)
- , $export = __webpack_require__(7)
- , anObject = __webpack_require__(24);
-
- // MS Edge has broken Reflect.defineProperty - throwing instead of returning false
- $export($export.S + $export.F * __webpack_require__(13)(function(){
- Reflect.defineProperty($.setDesc({}, 1, {value: 1}), 1, {value: 2});
- }), 'Reflect', {
- defineProperty: function defineProperty(target, propertyKey, attributes){
- anObject(target);
- try {
- $.setDesc(target, propertyKey, attributes);
- return true;
- } catch(e){
- return false;
- }
- }
- });
-
-/***/ },
-/* 157 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.4 Reflect.deleteProperty(target, propertyKey)
- var $export = __webpack_require__(7)
- , getDesc = __webpack_require__(6).getDesc
- , anObject = __webpack_require__(24);
-
- $export($export.S, 'Reflect', {
- deleteProperty: function deleteProperty(target, propertyKey){
- var desc = getDesc(anObject(target), propertyKey);
- return desc && !desc.configurable ? false : delete target[propertyKey];
- }
- });
-
-/***/ },
-/* 158 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- // 26.1.5 Reflect.enumerate(target)
- var $export = __webpack_require__(7)
- , anObject = __webpack_require__(24);
- var Enumerate = function(iterated){
- this._t = anObject(iterated); // target
- this._i = 0; // next index
- var keys = this._k = [] // keys
- , key;
- for(key in iterated)keys.push(key);
- };
- __webpack_require__(105)(Enumerate, 'Object', function(){
- var that = this
- , keys = that._k
- , key;
- do {
- if(that._i >= keys.length)return {value: undefined, done: true};
- } while(!((key = keys[that._i++]) in that._t));
- return {value: key, done: false};
- });
-
- $export($export.S, 'Reflect', {
- enumerate: function enumerate(target){
- return new Enumerate(target);
- }
- });
-
-/***/ },
-/* 159 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.6 Reflect.get(target, propertyKey [, receiver])
- var $ = __webpack_require__(6)
- , has = __webpack_require__(21)
- , $export = __webpack_require__(7)
- , isObject = __webpack_require__(20)
- , anObject = __webpack_require__(24);
-
- function get(target, propertyKey/*, receiver*/){
- var receiver = arguments.length < 3 ? target : arguments[2]
- , desc, proto;
- if(anObject(target) === receiver)return target[propertyKey];
- if(desc = $.getDesc(target, propertyKey))return has(desc, 'value')
- ? desc.value
- : desc.get !== undefined
- ? desc.get.call(receiver)
- : undefined;
- if(isObject(proto = $.getProto(target)))return get(proto, propertyKey, receiver);
- }
-
- $export($export.S, 'Reflect', {get: get});
-
-/***/ },
-/* 160 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
- var $ = __webpack_require__(6)
- , $export = __webpack_require__(7)
- , anObject = __webpack_require__(24);
-
- $export($export.S, 'Reflect', {
- getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){
- return $.getDesc(anObject(target), propertyKey);
- }
- });
-
-/***/ },
-/* 161 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.8 Reflect.getPrototypeOf(target)
- var $export = __webpack_require__(7)
- , getProto = __webpack_require__(6).getProto
- , anObject = __webpack_require__(24);
-
- $export($export.S, 'Reflect', {
- getPrototypeOf: function getPrototypeOf(target){
- return getProto(anObject(target));
- }
- });
-
-/***/ },
-/* 162 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.9 Reflect.has(target, propertyKey)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Reflect', {
- has: function has(target, propertyKey){
- return propertyKey in target;
- }
- });
-
-/***/ },
-/* 163 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.10 Reflect.isExtensible(target)
- var $export = __webpack_require__(7)
- , anObject = __webpack_require__(24)
- , $isExtensible = Object.isExtensible;
-
- $export($export.S, 'Reflect', {
- isExtensible: function isExtensible(target){
- anObject(target);
- return $isExtensible ? $isExtensible(target) : true;
- }
- });
-
-/***/ },
-/* 164 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.11 Reflect.ownKeys(target)
- var $export = __webpack_require__(7);
-
- $export($export.S, 'Reflect', {ownKeys: __webpack_require__(165)});
-
-/***/ },
-/* 165 */
-/***/ function(module, exports, __webpack_require__) {
-
- // all object keys, includes non-enumerable and symbols
- var $ = __webpack_require__(6)
- , anObject = __webpack_require__(24)
- , Reflect = __webpack_require__(8).Reflect;
- module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){
- var keys = $.getNames(anObject(it))
- , getSymbols = $.getSymbols;
- return getSymbols ? keys.concat(getSymbols(it)) : keys;
- };
-
-/***/ },
-/* 166 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.12 Reflect.preventExtensions(target)
- var $export = __webpack_require__(7)
- , anObject = __webpack_require__(24)
- , $preventExtensions = Object.preventExtensions;
-
- $export($export.S, 'Reflect', {
- preventExtensions: function preventExtensions(target){
- anObject(target);
- try {
- if($preventExtensions)$preventExtensions(target);
- return true;
- } catch(e){
- return false;
- }
- }
- });
-
-/***/ },
-/* 167 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
- var $ = __webpack_require__(6)
- , has = __webpack_require__(21)
- , $export = __webpack_require__(7)
- , createDesc = __webpack_require__(11)
- , anObject = __webpack_require__(24)
- , isObject = __webpack_require__(20);
-
- function set(target, propertyKey, V/*, receiver*/){
- var receiver = arguments.length < 4 ? target : arguments[3]
- , ownDesc = $.getDesc(anObject(target), propertyKey)
- , existingDescriptor, proto;
- if(!ownDesc){
- if(isObject(proto = $.getProto(target))){
- return set(proto, propertyKey, V, receiver);
- }
- ownDesc = createDesc(0);
- }
- if(has(ownDesc, 'value')){
- if(ownDesc.writable === false || !isObject(receiver))return false;
- existingDescriptor = $.getDesc(receiver, propertyKey) || createDesc(0);
- existingDescriptor.value = V;
- $.setDesc(receiver, propertyKey, existingDescriptor);
- return true;
- }
- return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
- }
-
- $export($export.S, 'Reflect', {set: set});
-
-/***/ },
-/* 168 */
-/***/ function(module, exports, __webpack_require__) {
-
- // 26.1.14 Reflect.setPrototypeOf(target, proto)
- var $export = __webpack_require__(7)
- , setProto = __webpack_require__(49);
-
- if(setProto)$export($export.S, 'Reflect', {
- setPrototypeOf: function setPrototypeOf(target, proto){
- setProto.check(target, proto);
- try {
- setProto.set(target, proto);
- return true;
- } catch(e){
- return false;
- }
- }
- });
-
-/***/ },
-/* 169 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $export = __webpack_require__(7)
- , $includes = __webpack_require__(37)(true);
-
- $export($export.P, 'Array', {
- // https://github.com/domenic/Array.prototype.includes
- includes: function includes(el /*, fromIndex = 0 */){
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
-
- __webpack_require__(122)('includes');
-
-/***/ },
-/* 170 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- // https://github.com/mathiasbynens/String.prototype.at
- var $export = __webpack_require__(7)
- , $at = __webpack_require__(102)(true);
-
- $export($export.P, 'String', {
- at: function at(pos){
- return $at(this, pos);
- }
- });
-
-/***/ },
-/* 171 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $export = __webpack_require__(7)
- , $pad = __webpack_require__(172);
-
- $export($export.P, 'String', {
- padLeft: function padLeft(maxLength /*, fillString = ' ' */){
- return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
- }
- });
-
-/***/ },
-/* 172 */
-/***/ function(module, exports, __webpack_require__) {
-
- // https://github.com/ljharb/proposal-string-pad-left-right
- var toLength = __webpack_require__(31)
- , repeat = __webpack_require__(113)
- , defined = __webpack_require__(26);
-
- module.exports = function(that, maxLength, fillString, left){
- var S = String(defined(that))
- , stringLength = S.length
- , fillStr = fillString === undefined ? ' ' : String(fillString)
- , intMaxLength = toLength(maxLength);
- if(intMaxLength <= stringLength)return S;
- if(fillStr == '')fillStr = ' ';
- var fillLen = intMaxLength - stringLength
- , stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
- if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen);
- return left ? stringFiller + S : S + stringFiller;
- };
-
-/***/ },
-/* 173 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var $export = __webpack_require__(7)
- , $pad = __webpack_require__(172);
-
- $export($export.P, 'String', {
- padRight: function padRight(maxLength /*, fillString = ' ' */){
- return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
- }
- });
-
-/***/ },
-/* 174 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- // https://github.com/sebmarkbage/ecmascript-string-left-right-trim
- __webpack_require__(67)('trimLeft', function($trim){
- return function trimLeft(){
- return $trim(this, 1);
- };
- });
-
-/***/ },
-/* 175 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- // https://github.com/sebmarkbage/ecmascript-string-left-right-trim
- __webpack_require__(67)('trimRight', function($trim){
- return function trimRight(){
- return $trim(this, 2);
- };
- });
-
-/***/ },
-/* 176 */
-/***/ function(module, exports, __webpack_require__) {
-
- // https://github.com/benjamingr/RexExp.escape
- var $export = __webpack_require__(7)
- , $re = __webpack_require__(177)(/[\\^$*+?.()|[\]{}]/g, '\\$&');
-
- $export($export.S, 'RegExp', {escape: function escape(it){ return $re(it); }});
-
-
-/***/ },
-/* 177 */
-/***/ function(module, exports) {
-
- module.exports = function(regExp, replace){
- var replacer = replace === Object(replace) ? function(part){
- return replace[part];
- } : replace;
- return function(it){
- return String(it).replace(regExp, replacer);
- };
- };
-
-/***/ },
-/* 178 */
-/***/ function(module, exports, __webpack_require__) {
-
- // https://gist.github.com/WebReflection/9353781
- var $ = __webpack_require__(6)
- , $export = __webpack_require__(7)
- , ownKeys = __webpack_require__(165)
- , toIObject = __webpack_require__(27)
- , createDesc = __webpack_require__(11);
-
- $export($export.S, 'Object', {
- getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){
- var O = toIObject(object)
- , setDesc = $.setDesc
- , getDesc = $.getDesc
- , keys = ownKeys(O)
- , result = {}
- , i = 0
- , key, D;
- while(keys.length > i){
- D = getDesc(O, key = keys[i++]);
- if(key in result)setDesc(result, key, createDesc(0, D));
- else result[key] = D;
- } return result;
- }
- });
-
-/***/ },
-/* 179 */
-/***/ function(module, exports, __webpack_require__) {
-
- // http://goo.gl/XkBrjD
- var $export = __webpack_require__(7)
- , $values = __webpack_require__(180)(false);
-
- $export($export.S, 'Object', {
- values: function values(it){
- return $values(it);
- }
- });
-
-/***/ },
-/* 180 */
-/***/ function(module, exports, __webpack_require__) {
-
- var $ = __webpack_require__(6)
- , toIObject = __webpack_require__(27)
- , isEnum = $.isEnum;
- module.exports = function(isEntries){
- return function(it){
- var O = toIObject(it)
- , keys = $.getKeys(O)
- , length = keys.length
- , i = 0
- , result = []
- , key;
- while(length > i)if(isEnum.call(O, key = keys[i++])){
- result.push(isEntries ? [key, O[key]] : O[key]);
- } return result;
- };
- };
-
-/***/ },
-/* 181 */
-/***/ function(module, exports, __webpack_require__) {
-
- // http://goo.gl/XkBrjD
- var $export = __webpack_require__(7)
- , $entries = __webpack_require__(180)(true);
-
- $export($export.S, 'Object', {
- entries: function entries(it){
- return $entries(it);
- }
- });
-
-/***/ },
-/* 182 */
-/***/ function(module, exports, __webpack_require__) {
-
- // https://github.com/DavidBruant/Map-Set.prototype.toJSON
- var $export = __webpack_require__(7);
-
- $export($export.P, 'Map', {toJSON: __webpack_require__(183)('Map')});
-
-/***/ },
-/* 183 */
-/***/ function(module, exports, __webpack_require__) {
-
- // https://github.com/DavidBruant/Map-Set.prototype.toJSON
- var forOf = __webpack_require__(142)
- , classof = __webpack_require__(51);
- module.exports = function(NAME){
- return function toJSON(){
- if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic");
- var arr = [];
- forOf(this, false, arr.push, arr);
- return arr;
- };
- };
-
-/***/ },
-/* 184 */
-/***/ function(module, exports, __webpack_require__) {
-
- // https://github.com/DavidBruant/Map-Set.prototype.toJSON
- var $export = __webpack_require__(7);
-
- $export($export.P, 'Set', {toJSON: __webpack_require__(183)('Set')});
-
-/***/ },
-/* 185 */
-/***/ function(module, exports, __webpack_require__) {
-
- // JavaScript 1.6 / Strawman array statics shim
- var $ = __webpack_require__(6)
- , $export = __webpack_require__(7)
- , $ctx = __webpack_require__(16)
- , $Array = __webpack_require__(9).Array || Array
- , statics = {};
- var setStatics = function(keys, length){
- $.each.call(keys.split(','), function(key){
- if(length == undefined && key in $Array)statics[key] = $Array[key];
- else if(key in [])statics[key] = $ctx(Function.call, [][key], length);
- });
- };
- setStatics('pop,reverse,shift,keys,values,entries', 1);
- setStatics('indexOf,every,some,forEach,map,filter,find,findIndex,includes', 3);
- setStatics('join,slice,concat,push,splice,unshift,sort,lastIndexOf,' +
- 'reduce,reduceRight,copyWithin,fill');
- $export($export.S, 'Array', statics);
-
-/***/ },
-/* 186 */
-/***/ function(module, exports, __webpack_require__) {
-
- // ie9- setTimeout & setInterval additional parameters fix
- var global = __webpack_require__(8)
- , $export = __webpack_require__(7)
- , invoke = __webpack_require__(23)
- , partial = __webpack_require__(187)
- , navigator = global.navigator
- , MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
- var wrap = function(set){
- return MSIE ? function(fn, time /*, ...args */){
- return set(invoke(
- partial,
- [].slice.call(arguments, 2),
- typeof fn == 'function' ? fn : Function(fn)
- ), time);
- } : set;
- };
- $export($export.G + $export.B + $export.F * MSIE, {
- setTimeout: wrap(global.setTimeout),
- setInterval: wrap(global.setInterval)
- });
-
-/***/ },
-/* 187 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
- var path = __webpack_require__(188)
- , invoke = __webpack_require__(23)
- , aFunction = __webpack_require__(17);
- module.exports = function(/* ...pargs */){
- var fn = aFunction(this)
- , length = arguments.length
- , pargs = Array(length)
- , i = 0
- , _ = path._
- , holder = false;
- while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true;
- return function(/* ...args */){
- var that = this
- , $$ = arguments
- , $$len = $$.length
- , j = 0, k = 0, args;
- if(!holder && !$$len)return invoke(fn, pargs, that);
- args = pargs.slice();
- if(holder)for(;length > j; j++)if(args[j] === _)args[j] = $$[k++];
- while($$len > k)args.push($$[k++]);
- return invoke(fn, args, that);
- };
- };
-
-/***/ },
-/* 188 */
-/***/ function(module, exports, __webpack_require__) {
-
- module.exports = __webpack_require__(8);
-
-/***/ },
-/* 189 */
-/***/ function(module, exports, __webpack_require__) {
-
- var $export = __webpack_require__(7)
- , $task = __webpack_require__(145);
- $export($export.G + $export.B, {
- setImmediate: $task.set,
- clearImmediate: $task.clear
- });
-
-/***/ },
-/* 190 */
-/***/ function(module, exports, __webpack_require__) {
-
- __webpack_require__(121);
- var global = __webpack_require__(8)
- , hide = __webpack_require__(10)
- , Iterators = __webpack_require__(104)
- , ITERATOR = __webpack_require__(35)('iterator')
- , NL = global.NodeList
- , HTC = global.HTMLCollection
- , NLProto = NL && NL.prototype
- , HTCProto = HTC && HTC.prototype
- , ArrayValues = Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array;
- if(NLProto && !NLProto[ITERATOR])hide(NLProto, ITERATOR, ArrayValues);
- if(HTCProto && !HTCProto[ITERATOR])hide(HTCProto, ITERATOR, ArrayValues);
-
-/***/ },
-/* 191 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(global, Promise, process) {/**
- * Copyright (c) 2014, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
- * additional grant of patent rights can be found in the PATENTS file in
- * the same directory.
- */
-
- !(function(global) {
- "use strict";
-
- var hasOwn = Object.prototype.hasOwnProperty;
- var undefined; // More compressible than void 0.
- var iteratorSymbol =
- typeof Symbol === "function" && Symbol.iterator || "@@iterator";
-
- var inModule = typeof module === "object";
- var runtime = global.regeneratorRuntime;
- if (runtime) {
- if (inModule) {
- // If regeneratorRuntime is defined globally and we're in a module,
- // make the exports object identical to regeneratorRuntime.
- module.exports = runtime;
- }
- // Don't bother evaluating the rest of this file if the runtime was
- // already defined globally.
- return;
- }
-
- // Define the runtime globally (as expected by generated code) as either
- // module.exports (if we're in a module) or a new, empty object.
- runtime = global.regeneratorRuntime = inModule ? module.exports : {};
-
- function wrap(innerFn, outerFn, self, tryLocsList) {
- // If outerFn provided, then outerFn.prototype instanceof Generator.
- var generator = Object.create((outerFn || Generator).prototype);
- var context = new Context(tryLocsList || []);
-
- // The ._invoke method unifies the implementations of the .next,
- // .throw, and .return methods.
- generator._invoke = makeInvokeMethod(innerFn, self, context);
-
- return generator;
- }
- runtime.wrap = wrap;
-
- // Try/catch helper to minimize deoptimizations. Returns a completion
- // record like context.tryEntries[i].completion. This interface could
- // have been (and was previously) designed to take a closure to be
- // invoked without arguments, but in all the cases we care about we
- // already have an existing method we want to call, so there's no need
- // to create a new function object. We can even get away with assuming
- // the method takes exactly one argument, since that happens to be true
- // in every case, so we don't have to touch the arguments object. The
- // only additional allocation required is the completion record, which
- // has a stable shape and so hopefully should be cheap to allocate.
- function tryCatch(fn, obj, arg) {
- try {
- return { type: "normal", arg: fn.call(obj, arg) };
- } catch (err) {
- return { type: "throw", arg: err };
- }
- }
-
- var GenStateSuspendedStart = "suspendedStart";
- var GenStateSuspendedYield = "suspendedYield";
- var GenStateExecuting = "executing";
- var GenStateCompleted = "completed";
-
- // Returning this object from the innerFn has the same effect as
- // breaking out of the dispatch switch statement.
- var ContinueSentinel = {};
-
- // Dummy constructor functions that we use as the .constructor and
- // .constructor.prototype properties for functions that return Generator
- // objects. For full spec compliance, you may wish to configure your
- // minifier not to mangle the names of these two functions.
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
-
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype;
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
- GeneratorFunction.displayName = "GeneratorFunction";
-
- // Helper for defining the .next, .throw, and .return methods of the
- // Iterator interface in terms of a single ._invoke method.
- function defineIteratorMethods(prototype) {
- ["next", "throw", "return"].forEach(function(method) {
- prototype[method] = function(arg) {
- return this._invoke(method, arg);
- };
- });
- }
-
- runtime.isGeneratorFunction = function(genFun) {
- var ctor = typeof genFun === "function" && genFun.constructor;
- return ctor
- ? ctor === GeneratorFunction ||
- // For the native GeneratorFunction constructor, the best we can
- // do is to check its .name property.
- (ctor.displayName || ctor.name) === "GeneratorFunction"
- : false;
- };
-
- runtime.mark = function(genFun) {
- if (Object.setPrototypeOf) {
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
- } else {
- genFun.__proto__ = GeneratorFunctionPrototype;
- }
- genFun.prototype = Object.create(Gp);
- return genFun;
- };
-
- // Within the body of any async function, `await x` is transformed to
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
- // `value instanceof AwaitArgument` to determine if the yielded value is
- // meant to be awaited. Some may consider the name of this method too
- // cutesy, but they are curmudgeons.
- runtime.awrap = function(arg) {
- return new AwaitArgument(arg);
- };
-
- function AwaitArgument(arg) {
- this.arg = arg;
- }
-
- function AsyncIterator(generator) {
- // This invoke function is written in a style that assumes some
- // calling function (or Promise) will handle exceptions.
- function invoke(method, arg) {
- var result = generator[method](arg);
- var value = result.value;
- return value instanceof AwaitArgument
- ? Promise.resolve(value.arg).then(invokeNext, invokeThrow)
- : Promise.resolve(value).then(function(unwrapped) {
- // When a yielded Promise is resolved, its final value becomes
- // the .value of the Promise<{value,done}> result for the
- // current iteration. If the Promise is rejected, however, the
- // result for this iteration will be rejected with the same
- // reason. Note that rejections of yielded Promises are not
- // thrown back into the generator function, as is the case
- // when an awaited Promise is rejected. This difference in
- // behavior between yield and await is important, because it
- // allows the consumer to decide what to do with the yielded
- // rejection (swallow it and continue, manually .throw it back
- // into the generator, abandon iteration, whatever). With
- // await, by contrast, there is no opportunity to examine the
- // rejection reason outside the generator function, so the
- // only option is to throw it from the await expression, and
- // let the generator function handle the exception.
- result.value = unwrapped;
- return result;
- });
- }
-
- if (typeof process === "object" && process.domain) {
- invoke = process.domain.bind(invoke);
- }
-
- var invokeNext = invoke.bind(generator, "next");
- var invokeThrow = invoke.bind(generator, "throw");
- var invokeReturn = invoke.bind(generator, "return");
- var previousPromise;
-
- function enqueue(method, arg) {
- function callInvokeWithMethodAndArg() {
- return invoke(method, arg);
- }
-
- return previousPromise =
- // If enqueue has been called before, then we want to wait until
- // all previous Promises have been resolved before calling invoke,
- // so that results are always delivered in the correct order. If
- // enqueue has not been called before, then it is important to
- // call invoke immediately, without waiting on a callback to fire,
- // so that the async generator function has the opportunity to do
- // any necessary setup in a predictable way. This predictability
- // is why the Promise constructor synchronously invokes its
- // executor callback, and why async functions synchronously
- // execute code before the first await. Since we implement simple
- // async functions in terms of async generators, it is especially
- // important to get this right, even though it requires care.
- previousPromise ? previousPromise.then(
- callInvokeWithMethodAndArg,
- // Avoid propagating failures to Promises returned by later
- // invocations of the iterator.
- callInvokeWithMethodAndArg
- ) : new Promise(function (resolve) {
- resolve(callInvokeWithMethodAndArg());
- });
- }
-
- // Define the unified helper method that is used to implement .next,
- // .throw, and .return (see defineIteratorMethods).
- this._invoke = enqueue;
- }
-
- defineIteratorMethods(AsyncIterator.prototype);
-
- // Note that simple async functions are implemented on top of
- // AsyncIterator objects; they just return a Promise for the value of
- // the final result produced by the iterator.
- runtime.async = function(innerFn, outerFn, self, tryLocsList) {
- var iter = new AsyncIterator(
- wrap(innerFn, outerFn, self, tryLocsList)
- );
-
- return runtime.isGeneratorFunction(outerFn)
- ? iter // If outerFn is a generator, return the full iterator.
- : iter.next().then(function(result) {
- return result.done ? result.value : iter.next();
- });
- };
-
- function makeInvokeMethod(innerFn, self, context) {
- var state = GenStateSuspendedStart;
-
- return function invoke(method, arg) {
- if (state === GenStateExecuting) {
- throw new Error("Generator is already running");
- }
-
- if (state === GenStateCompleted) {
- if (method === "throw") {
- throw arg;
- }
-
- // Be forgiving, per 25.3.3.3.3 of the spec:
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
- return doneResult();
- }
-
- while (true) {
- var delegate = context.delegate;
- if (delegate) {
- if (method === "return" ||
- (method === "throw" && delegate.iterator[method] === undefined)) {
- // A return or throw (when the delegate iterator has no throw
- // method) always terminates the yield* loop.
- context.delegate = null;
-
- // If the delegate iterator has a return method, give it a
- // chance to clean up.
- var returnMethod = delegate.iterator["return"];
- if (returnMethod) {
- var record = tryCatch(returnMethod, delegate.iterator, arg);
- if (record.type === "throw") {
- // If the return method threw an exception, let that
- // exception prevail over the original return or throw.
- method = "throw";
- arg = record.arg;
- continue;
- }
- }
-
- if (method === "return") {
- // Continue with the outer return, now that the delegate
- // iterator has been terminated.
- continue;
- }
- }
-
- var record = tryCatch(
- delegate.iterator[method],
- delegate.iterator,
- arg
- );
-
- if (record.type === "throw") {
- context.delegate = null;
-
- // Like returning generator.throw(uncaught), but without the
- // overhead of an extra function call.
- method = "throw";
- arg = record.arg;
- continue;
- }
-
- // Delegate generator ran and handled its own exceptions so
- // regardless of what the method was, we continue as if it is
- // "next" with an undefined arg.
- method = "next";
- arg = undefined;
-
- var info = record.arg;
- if (info.done) {
- context[delegate.resultName] = info.value;
- context.next = delegate.nextLoc;
- } else {
- state = GenStateSuspendedYield;
- return info;
- }
-
- context.delegate = null;
- }
-
- if (method === "next") {
- context._sent = arg;
-
- if (state === GenStateSuspendedYield) {
- context.sent = arg;
- } else {
- context.sent = undefined;
- }
- } else if (method === "throw") {
- if (state === GenStateSuspendedStart) {
- state = GenStateCompleted;
- throw arg;
- }
-
- if (context.dispatchException(arg)) {
- // If the dispatched exception was caught by a catch block,
- // then let that catch block handle the exception normally.
- method = "next";
- arg = undefined;
- }
-
- } else if (method === "return") {
- context.abrupt("return", arg);
- }
-
- state = GenStateExecuting;
-
- var record = tryCatch(innerFn, self, context);
- if (record.type === "normal") {
- // If an exception is thrown from innerFn, we leave state ===
- // GenStateExecuting and loop back for another invocation.
- state = context.done
- ? GenStateCompleted
- : GenStateSuspendedYield;
-
- var info = {
- value: record.arg,
- done: context.done
- };
-
- if (record.arg === ContinueSentinel) {
- if (context.delegate && method === "next") {
- // Deliberately forget the last sent value so that we don't
- // accidentally pass it on to the delegate.
- arg = undefined;
- }
- } else {
- return info;
- }
-
- } else if (record.type === "throw") {
- state = GenStateCompleted;
- // Dispatch the exception by looping back around to the
- // context.dispatchException(arg) call above.
- method = "throw";
- arg = record.arg;
- }
- }
- };
- }
-
- // Define Generator.prototype.{next,throw,return} in terms of the
- // unified ._invoke helper method.
- defineIteratorMethods(Gp);
-
- Gp[iteratorSymbol] = function() {
- return this;
- };
-
- Gp.toString = function() {
- return "[object Generator]";
- };
-
- function pushTryEntry(locs) {
- var entry = { tryLoc: locs[0] };
-
- if (1 in locs) {
- entry.catchLoc = locs[1];
- }
-
- if (2 in locs) {
- entry.finallyLoc = locs[2];
- entry.afterLoc = locs[3];
- }
-
- this.tryEntries.push(entry);
- }
-
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal";
- delete record.arg;
- entry.completion = record;
- }
-
- function Context(tryLocsList) {
- // The root entry object (effectively a try statement without a catch
- // or a finally block) gives us a place to store values thrown from
- // locations where there is no enclosing try statement.
- this.tryEntries = [{ tryLoc: "root" }];
- tryLocsList.forEach(pushTryEntry, this);
- this.reset(true);
- }
-
- runtime.keys = function(object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- keys.reverse();
-
- // Rather than returning an object with a next method, we keep
- // things simple and return the next function itself.
- return function next() {
- while (keys.length) {
- var key = keys.pop();
- if (key in object) {
- next.value = key;
- next.done = false;
- return next;
- }
- }
-
- // To avoid creating an additional object, we just hang the .value
- // and .done properties off the next function object itself. This
- // also ensures that the minifier will not anonymize the function.
- next.done = true;
- return next;
- };
- };
-
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) {
- return iteratorMethod.call(iterable);
- }
-
- if (typeof iterable.next === "function") {
- return iterable;
- }
-
- if (!isNaN(iterable.length)) {
- var i = -1, next = function next() {
- while (++i < iterable.length) {
- if (hasOwn.call(iterable, i)) {
- next.value = iterable[i];
- next.done = false;
- return next;
- }
- }
-
- next.value = undefined;
- next.done = true;
-
- return next;
- };
-
- return next.next = next;
- }
- }
-
- // Return an iterator with no values.
- return { next: doneResult };
- }
- runtime.values = values;
-
- function doneResult() {
- return { value: undefined, done: true };
- }
-
- Context.prototype = {
- constructor: Context,
-
- reset: function(skipTempReset) {
- this.prev = 0;
- this.next = 0;
- this.sent = undefined;
- this.done = false;
- this.delegate = null;
-
- this.tryEntries.forEach(resetTryEntry);
-
- if (!skipTempReset) {
- for (var name in this) {
- // Not sure about the optimal order of these conditions:
- if (name.charAt(0) === "t" &&
- hasOwn.call(this, name) &&
- !isNaN(+name.slice(1))) {
- this[name] = undefined;
- }
- }
- }
- },
-
- stop: function() {
- this.done = true;
-
- var rootEntry = this.tryEntries[0];
- var rootRecord = rootEntry.completion;
- if (rootRecord.type === "throw") {
- throw rootRecord.arg;
- }
-
- return this.rval;
- },
-
- dispatchException: function(exception) {
- if (this.done) {
- throw exception;
- }
-
- var context = this;
- function handle(loc, caught) {
- record.type = "throw";
- record.arg = exception;
- context.next = loc;
- return !!caught;
- }
-
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- var record = entry.completion;
-
- if (entry.tryLoc === "root") {
- // Exception thrown outside of any try block that could handle
- // it, so set the completion value of the entire function to
- // throw the exception.
- return handle("end");
- }
-
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc");
- var hasFinally = hasOwn.call(entry, "finallyLoc");
-
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- } else if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
-
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- }
-
- } else if (hasFinally) {
- if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
-
- } else {
- throw new Error("try statement without catch or finally");
- }
- }
- }
- },
-
- abrupt: function(type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev &&
- hasOwn.call(entry, "finallyLoc") &&
- this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
-
- if (finallyEntry &&
- (type === "break" ||
- type === "continue") &&
- finallyEntry.tryLoc <= arg &&
- arg <= finallyEntry.finallyLoc) {
- // Ignore the finally entry if control is not jumping to a
- // location outside the try/catch block.
- finallyEntry = null;
- }
-
- var record = finallyEntry ? finallyEntry.completion : {};
- record.type = type;
- record.arg = arg;
-
- if (finallyEntry) {
- this.next = finallyEntry.finallyLoc;
- } else {
- this.complete(record);
- }
-
- return ContinueSentinel;
- },
-
- complete: function(record, afterLoc) {
- if (record.type === "throw") {
- throw record.arg;
- }
-
- if (record.type === "break" ||
- record.type === "continue") {
- this.next = record.arg;
- } else if (record.type === "return") {
- this.rval = record.arg;
- this.next = "end";
- } else if (record.type === "normal" && afterLoc) {
- this.next = afterLoc;
- }
- },
-
- finish: function(finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) {
- this.complete(entry.completion, entry.afterLoc);
- resetTryEntry(entry);
- return ContinueSentinel;
- }
- }
- },
-
- "catch": function(tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if (record.type === "throw") {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
-
- // The context.catch method must only be called with a location
- // argument that corresponds to a known catch block.
- throw new Error("illegal catch attempt");
- },
-
- delegateYield: function(iterable, resultName, nextLoc) {
- this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- };
-
- return ContinueSentinel;
- }
- };
- })(
- // Among the various tricks for obtaining a reference to the global
- // object, this seems to be the most reliable technique that does not
- // use indirect eval (which violates Content Security Policy).
- typeof global === "object" ? global :
- typeof window === "object" ? window :
- typeof self === "object" ? self : this
- );
-
- /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(3), __webpack_require__(192)))
-
-/***/ },
-/* 192 */
-/***/ function(module, exports) {
-
- // shim for using process in browser
-
- var process = module.exports = {};
- var queue = [];
- var draining = false;
- var currentQueue;
- var queueIndex = -1;
-
- function cleanUpNextTick() {
- draining = false;
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
- if (queue.length) {
- drainQueue();
- }
- }
-
- function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = setTimeout(cleanUpNextTick);
- draining = true;
-
- var len = queue.length;
- while(len) {
- currentQueue = queue;
- queue = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue.length;
- }
- currentQueue = null;
- draining = false;
- clearTimeout(timeout);
- }
-
- process.nextTick = function (fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue.push(new Item(fun, args));
- if (queue.length === 1 && !draining) {
- setTimeout(drainQueue, 0);
- }
- };
-
- // v8 likes predictible objects
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- Item.prototype.run = function () {
- this.fun.apply(null, this.array);
- };
- process.title = 'browser';
- process.browser = true;
- process.env = {};
- process.argv = [];
- process.version = ''; // empty string to avoid regexp issues
- process.versions = {};
-
- function noop() {}
-
- process.on = noop;
- process.addListener = noop;
- process.once = noop;
- process.off = noop;
- process.removeListener = noop;
- process.removeAllListeners = noop;
- process.emit = noop;
-
- process.binding = function (name) {
- throw new Error('process.binding is not supported');
- };
-
- process.cwd = function () { return '/' };
- process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
- };
- process.umask = function() { return 0; };
-
-
-/***/ },
-/* 193 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.parseStatus = parseStatus;
- exports.parseJSON = parseJSON;
- exports.userFeedback = userFeedback;
- exports.userFeedbackError = userFeedbackError;
-
- var _toastr = __webpack_require__(194);
-
- var _toastr2 = _interopRequireDefault(_toastr);
-
- var _gravConfig = __webpack_require__(198);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- var error = function error(response) {
- var error = new Error(response.statusText || response || '');
- error.response = response;
-
- return error;
- };
-
- function parseStatus(response) {
- return response;
-
- /* Whoops can handle JSON responses so we don't need this for now.
- if (response.status >= 200 && response.status < 300) {
- return response;
- } else {
- throw error(response);
- }
- */
- }
-
- function parseJSON(response) {
- return response.json();
- }
-
- function userFeedback(response) {
- var status = response.status || (response.error ? 'error' : '');
- var message = response.message || (response.error ? response.error.message : null);
- var settings = response.toastr || null;
- var backup = undefined;
-
- switch (status) {
- case 'unauthenticated':
- document.location.href = _gravConfig.config.base_url_relative;
- throw error('Logged out');
- case 'unauthorized':
- status = 'error';
- message = message || 'Unauthorized.';
- break;
- case 'error':
- status = 'error';
- message = message || 'Unknown error.';
- break;
- case 'success':
- status = 'success';
- message = message || '';
- break;
- default:
- status = 'error';
- message = message || 'Invalid AJAX response.';
- break;
- }
-
- if (settings) {
- backup = Object.assign({}, _toastr2.default.options);
- Object.keys(settings).forEach(function (key) {
- return _toastr2.default.options[key] = settings[key];
- });
- }
-
- if (message) {
- _toastr2.default[status === 'success' ? 'success' : 'error'](message);
- }
-
- if (settings) {
- _toastr2.default.options = backup;
- }
-
- return response;
- }
-
- function userFeedbackError(error) {
- _toastr2.default.error('Fetch Failed:
' + error.message + '
' + error.stack + '');
- console.error(error.message + ' at ' + error.stack);
- }
-
-/***/ },
-/* 194 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _toastr = __webpack_require__(195);
-
- var _toastr2 = _interopRequireDefault(_toastr);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- _toastr2.default.options.positionClass = 'toast-top-right';
- _toastr2.default.options.preventDuplicates = true;
-
- exports.default = _toastr2.default;
-
-/***/ },
-/* 195 */,
-/* 196 */,
-/* 197 */,
-/* 198 */
-/***/ function(module, exports) {
-
- module.exports = GravAdmin;
-
-/***/ },
-/* 199 */
-/***/ function(module, exports) {
-
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- function EventEmitter() {
- this._events = this._events || {};
- this._maxListeners = this._maxListeners || undefined;
- }
- module.exports = EventEmitter;
-
- // Backwards-compat with node 0.10.x
- EventEmitter.EventEmitter = EventEmitter;
-
- EventEmitter.prototype._events = undefined;
- EventEmitter.prototype._maxListeners = undefined;
-
- // By default EventEmitters will print a warning if more than 10 listeners are
- // added to it. This is a useful default which helps finding memory leaks.
- EventEmitter.defaultMaxListeners = 10;
-
- // Obviously not all Emitters should be limited to 10. This function allows
- // that to be increased. Set to zero for unlimited.
- EventEmitter.prototype.setMaxListeners = function(n) {
- if (!isNumber(n) || n < 0 || isNaN(n))
- throw TypeError('n must be a positive number');
- this._maxListeners = n;
- return this;
- };
-
- EventEmitter.prototype.emit = function(type) {
- var er, handler, len, args, i, listeners;
-
- if (!this._events)
- this._events = {};
-
- // If there is no 'error' event listener then throw.
- if (type === 'error') {
- if (!this._events.error ||
- (isObject(this._events.error) && !this._events.error.length)) {
- er = arguments[1];
- if (er instanceof Error) {
- throw er; // Unhandled 'error' event
- }
- throw TypeError('Uncaught, unspecified "error" event.');
- }
- }
-
- handler = this._events[type];
-
- if (isUndefined(handler))
- return false;
-
- if (isFunction(handler)) {
- switch (arguments.length) {
- // fast cases
- case 1:
- handler.call(this);
- break;
- case 2:
- handler.call(this, arguments[1]);
- break;
- case 3:
- handler.call(this, arguments[1], arguments[2]);
- break;
- // slower
- default:
- args = Array.prototype.slice.call(arguments, 1);
- handler.apply(this, args);
- }
- } else if (isObject(handler)) {
- args = Array.prototype.slice.call(arguments, 1);
- listeners = handler.slice();
- len = listeners.length;
- for (i = 0; i < len; i++)
- listeners[i].apply(this, args);
- }
-
- return true;
- };
-
- EventEmitter.prototype.addListener = function(type, listener) {
- var m;
-
- if (!isFunction(listener))
- throw TypeError('listener must be a function');
-
- if (!this._events)
- this._events = {};
-
- // To avoid recursion in the case that type === "newListener"! Before
- // adding it to the listeners, first emit "newListener".
- if (this._events.newListener)
- this.emit('newListener', type,
- isFunction(listener.listener) ?
- listener.listener : listener);
-
- if (!this._events[type])
- // Optimize the case of one listener. Don't need the extra array object.
- this._events[type] = listener;
- else if (isObject(this._events[type]))
- // If we've already got an array, just append.
- this._events[type].push(listener);
- else
- // Adding the second element, need to change to array.
- this._events[type] = [this._events[type], listener];
-
- // Check for listener leak
- if (isObject(this._events[type]) && !this._events[type].warned) {
- if (!isUndefined(this._maxListeners)) {
- m = this._maxListeners;
- } else {
- m = EventEmitter.defaultMaxListeners;
- }
-
- if (m && m > 0 && this._events[type].length > m) {
- this._events[type].warned = true;
- console.error('(node) warning: possible EventEmitter memory ' +
- 'leak detected. %d listeners added. ' +
- 'Use emitter.setMaxListeners() to increase limit.',
- this._events[type].length);
- if (typeof console.trace === 'function') {
- // not supported in IE 10
- console.trace();
- }
- }
- }
-
- return this;
- };
-
- EventEmitter.prototype.on = EventEmitter.prototype.addListener;
-
- EventEmitter.prototype.once = function(type, listener) {
- if (!isFunction(listener))
- throw TypeError('listener must be a function');
-
- var fired = false;
-
- function g() {
- this.removeListener(type, g);
-
- if (!fired) {
- fired = true;
- listener.apply(this, arguments);
- }
- }
-
- g.listener = listener;
- this.on(type, g);
-
- return this;
- };
-
- // emits a 'removeListener' event iff the listener was removed
- EventEmitter.prototype.removeListener = function(type, listener) {
- var list, position, length, i;
-
- if (!isFunction(listener))
- throw TypeError('listener must be a function');
-
- if (!this._events || !this._events[type])
- return this;
-
- list = this._events[type];
- length = list.length;
- position = -1;
-
- if (list === listener ||
- (isFunction(list.listener) && list.listener === listener)) {
- delete this._events[type];
- if (this._events.removeListener)
- this.emit('removeListener', type, listener);
-
- } else if (isObject(list)) {
- for (i = length; i-- > 0;) {
- if (list[i] === listener ||
- (list[i].listener && list[i].listener === listener)) {
- position = i;
- break;
- }
- }
-
- if (position < 0)
- return this;
-
- if (list.length === 1) {
- list.length = 0;
- delete this._events[type];
- } else {
- list.splice(position, 1);
- }
-
- if (this._events.removeListener)
- this.emit('removeListener', type, listener);
- }
-
- return this;
- };
-
- EventEmitter.prototype.removeAllListeners = function(type) {
- var key, listeners;
-
- if (!this._events)
- return this;
-
- // not listening for removeListener, no need to emit
- if (!this._events.removeListener) {
- if (arguments.length === 0)
- this._events = {};
- else if (this._events[type])
- delete this._events[type];
- return this;
- }
-
- // emit removeListener for all listeners on all events
- if (arguments.length === 0) {
- for (key in this._events) {
- if (key === 'removeListener') continue;
- this.removeAllListeners(key);
- }
- this.removeAllListeners('removeListener');
- this._events = {};
- return this;
- }
-
- listeners = this._events[type];
-
- if (isFunction(listeners)) {
- this.removeListener(type, listeners);
- } else if (listeners) {
- // LIFO order
- while (listeners.length)
- this.removeListener(type, listeners[listeners.length - 1]);
- }
- delete this._events[type];
-
- return this;
- };
-
- EventEmitter.prototype.listeners = function(type) {
- var ret;
- if (!this._events || !this._events[type])
- ret = [];
- else if (isFunction(this._events[type]))
- ret = [this._events[type]];
- else
- ret = this._events[type].slice();
- return ret;
- };
-
- EventEmitter.prototype.listenerCount = function(type) {
- if (this._events) {
- var evlistener = this._events[type];
-
- if (isFunction(evlistener))
- return 1;
- else if (evlistener)
- return evlistener.length;
- }
- return 0;
- };
-
- EventEmitter.listenerCount = function(emitter, type) {
- return emitter.listenerCount(type);
- };
-
- function isFunction(arg) {
- return typeof arg === 'function';
- }
-
- function isNumber(arg) {
- return typeof arg === 'number';
- }
-
- function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
- }
-
- function isUndefined(arg) {
- return arg === void 0;
- }
-
-
-/***/ },
-/* 200 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(fetch) {'use strict';
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _gravConfig = __webpack_require__(198);
-
- var _response = __webpack_require__(193);
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- var KeepAlive = function () {
- function KeepAlive() {
- _classCallCheck(this, KeepAlive);
-
- this.active = false;
- }
-
- _createClass(KeepAlive, [{
- key: 'start',
- value: function start() {
- var _this = this;
-
- var timeout = _gravConfig.config.admin_timeout / 1.5 * 1000;
- this.timer = setInterval(function () {
- return _this.fetch();
- }, timeout);
- this.active = true;
- }
- }, {
- key: 'stop',
- value: function stop() {
- clearInterval(this.timer);
- this.active = false;
- }
- }, {
- key: 'fetch',
- value: function (_fetch) {
- function fetch() {
- return _fetch.apply(this, arguments);
- }
-
- fetch.toString = function () {
- return _fetch.toString();
- };
-
- return fetch;
- }(function () {
- var data = new FormData();
- data.append('admin-nonce', _gravConfig.config.admin_nonce);
-
- fetch(_gravConfig.config.base_url_relative + '/task' + _gravConfig.config.param_sep + 'keepAlive', {
- credentials: 'same-origin',
- method: 'post',
- body: data
- }).catch(_response.userFeedbackError);
- })
- }]);
-
- return KeepAlive;
- }();
-
- exports.default = new KeepAlive();
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
-
-/***/ },
-/* 201 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Instance = undefined;
-
- var _jquery = __webpack_require__(196);
-
- var _jquery2 = _interopRequireDefault(_jquery);
-
- var _gravConfig = __webpack_require__(198);
-
- var _formatbytes = __webpack_require__(202);
-
- var _formatbytes2 = _interopRequireDefault(_formatbytes);
-
- var _gpm = __webpack_require__(1);
-
- __webpack_require__(203);
-
- __webpack_require__(204);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- var Updates = function () {
- function Updates() {
- var payload = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
-
- _classCallCheck(this, Updates);
-
- this.setPayload(payload);
- this.task = 'task' + _gravConfig.config.param_sep;
- }
-
- _createClass(Updates, [{
- key: 'setPayload',
- value: function setPayload() {
- var payload = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
-
- this.payload = payload;
-
- return this;
- }
- }, {
- key: 'fetch',
- value: function fetch() {
- var _this = this;
-
- var force = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
-
- _gpm.Instance.fetch(function (response) {
- return _this.setPayload(response);
- }, force);
-
- return this;
- }
- }, {
- key: 'maintenance',
- value: function maintenance() {
- var mode = arguments.length <= 0 || arguments[0] === undefined ? 'hide' : arguments[0];
-
- var element = (0, _jquery2.default)('#updates [data-maintenance-update]');
-
- element[mode === 'show' ? 'fadeIn' : 'fadeOut']();
-
- if (mode === 'hide') {
- (0, _jquery2.default)('.badges.with-updates').removeClass('with-updates').find('.badge.updates').remove();
- }
-
- return this;
- }
- }, {
- key: 'grav',
- value: function grav() {
- var payload = this.payload.grav;
-
- if (payload.isUpdatable) {
- var task = this.task;
- var bar = '\n \n Grav v' + payload.available + ' ' + _gravConfig.translations.PLUGIN_ADMIN.IS_NOW_AVAILABLE + '! (' + _gravConfig.translations.PLUGIN_ADMIN.CURRENT + 'v' + payload.version + ')\n ';
-
- if (!payload.isSymlink) {
- bar += '';
- } else {
- bar += '';
- }
-
- (0, _jquery2.default)('[data-gpm-grav]').addClass('grav').html('' + bar + '
'); - } - - (0, _jquery2.default)('#grav-update-button').on('click', function () { - (0, _jquery2.default)(this).html(_gravConfig.translations.PLUGIN_ADMIN.UPDATING_PLEASE_WAIT + ' ' + (0, _formatbytes2.default)(payload.assets['grav-update'].size) + '..'); - }); - - return this; - } - }, { - key: 'resources', - value: function resources() { - if (!this.payload.resources.total) { - return this.maintenance('hide'); - } - - var map = ['plugins', 'themes']; - var singles = ['plugin', 'theme']; - var task = this.task; - var _payload$resources = this.payload.resources; - var plugins = _payload$resources.plugins; - var themes = _payload$resources.themes; - - if (!this.payload.resources.total) { - return this; - } - - [plugins, themes].forEach(function (resources, index) { - if (!resources || Array.isArray(resources)) { - return; - } - var length = Object.keys(resources).length; - var type = map[index]; - - // sidebar - (0, _jquery2.default)('#admin-menu a[href$="/' + map[index] + '"]').find('.badges').addClass('with-updates').find('.badge.updates').text(length); - - // update all - var title = type.charAt(0).toUpperCase() + type.substr(1).toLowerCase(); - var updateAll = (0, _jquery2.default)('.grav-update.' + type); - updateAll.html('\n\n \n ' + length + ' ' + _gravConfig.translations.PLUGIN_ADMIN.OF_YOUR + ' ' + type + ' ' + _gravConfig.translations.PLUGIN_ADMIN.HAVE_AN_UPDATE_AVAILABLE + '\n ' + _gravConfig.translations.PLUGIN_ADMIN.UPDATE + ' All ' + title + '\n
\n '); - - Object.keys(resources).forEach(function (item) { - // listing page - var element = (0, _jquery2.default)('[data-gpm-' + singles[index] + '="' + item + '"] .gpm-name'); - var url = element.find('a'); - - if (type === 'plugins' && !element.find('.badge.update').length) { - element.append('' + _gravConfig.translations.PLUGIN_ADMIN.UPDATE_AVAILABLE + '!'); - } else if (type === 'themes') { - element.append(''); - } - - // details page - var details = (0, _jquery2.default)('.grav-update.' + singles[index]); - if (details.length) { - details.html('\n\n \n v' + resources[item].available + ' ' + _gravConfig.translations.PLUGIN_ADMIN.OF_THIS + ' ' + singles[index] + ' ' + _gravConfig.translations.PLUGIN_ADMIN.IS_NOW_AVAILABLE + '!\n ' + _gravConfig.translations.PLUGIN_ADMIN.UPDATE + ' ' + (singles[index].charAt(0).toUpperCase() + singles[index].substr(1).toLowerCase()) + '\n
\n '); - } - }); - }); - } - }]); - - return Updates; - }(); - - exports.default = Updates; - - var Instance = new Updates(); - exports.Instance = Instance; - - // automatically refresh UI for updates (graph, sidebar, plugin/themes pages) after every fetch - - _gpm.Instance.on('fetched', function (response, raw) { - Instance.setPayload(response.payload || {}); - Instance.grav().resources(); - }); - - if (_gravConfig.config.enable_auto_updates_check === '1') { - _gpm.Instance.fetch(); - } - -/***/ }, -/* 202 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.default = formatBytes; - var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; - - function formatBytes(bytes, decimals) { - if (bytes === 0) return '0 Byte'; - - var k = 1000; - var value = Math.floor(Math.log(bytes) / Math.log(k)); - var decimal = decimals + 1 || 3; - - return (bytes / Math.pow(k, value)).toPrecision(decimal) + ' ' + sizes[value]; - } - -/***/ }, -/* 203 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - var _gpm = __webpack_require__(1); - - var _gravConfig = __webpack_require__(198); - - var _toastr = __webpack_require__(194); - - var _toastr2 = _interopRequireDefault(_toastr); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - // Check for updates trigger - (0, _jquery2.default)('[data-gpm-checkupdates]').on('click', function () { - var element = (0, _jquery2.default)(this); - element.find('i').addClass('fa-spin'); - - _gpm.Instance.fetch(function (response) { - element.find('i').removeClass('fa-spin'); - var payload = response.payload; - - if (!payload) { - return; - } - if (!payload.grav.isUpdatable && !payload.resources.total) { - _toastr2.default.success(_gravConfig.translations.PLUGIN_ADMIN.EVERYTHING_UP_TO_DATE); - } else { - var grav = payload.grav.isUpdatable ? 'Grav v' + payload.grav.available : ''; - var resources = payload.resources.total ? payload.resources.total + ' ' + _gravConfig.translations.PLUGIN_ADMIN.UPDATES_ARE_AVAILABLE : ''; - - if (!resources) { - grav += ' ' + _gravConfig.translations.PLUGIN_ADMIN.IS_AVAILABLE_FOR_UPDATE; - } - _toastr2.default.info(grav + (grav && resources ? ' ' + _gravConfig.translations.PLUGIN_ADMIN.AND + ' ' : '') + resources); - } - }, true); - }); - -/***/ }, -/* 204 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - var _request = __webpack_require__(205); - - var _request2 = _interopRequireDefault(_request); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - // Dashboard update and Grav update - (0, _jquery2.default)('body').on('click', '[data-maintenance-update]', function () { - var element = (0, _jquery2.default)(this); - var url = element.data('maintenanceUpdate'); - - element.attr('disabled', 'disabled').find('> .fa').removeClass('fa-cloud-download').addClass('fa-refresh fa-spin'); - - (0, _request2.default)(url, function (response) { - if (response.type === 'updategrav') { - (0, _jquery2.default)('[data-gpm-grav]').remove(); - (0, _jquery2.default)('#footer .grav-version').html(response.version); - } - - element.removeAttr('disabled').find('> .fa').removeClass('fa-refresh fa-spin').addClass('fa-cloud-download'); - }); - }); - -/***/ }, -/* 205 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(fetch) {'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _response = __webpack_require__(193); - - var _gravConfig = __webpack_require__(198); - - var raw = undefined; - var request = function request(url) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - var callback = arguments.length <= 2 || arguments[2] === undefined ? function () { - return true; - } : arguments[2]; - - if (typeof options === 'function') { - callback = options; - options = {}; - } - - if (options.method && options.method === 'post' && options.body) { - (function () { - var data = new FormData(); - - options.body = Object.assign({ 'admin-nonce': _gravConfig.config.admin_nonce }, options.body); - Object.keys(options.body).map(function (key) { - return data.append(key, options.body[key]); - }); - options.body = data; - })(); - } - - options = Object.assign({ - credentials: 'same-origin', - headers: { - 'Accept': 'application/json' - } - }, options); - - return fetch(url, options).then(function (response) { - raw = response; - return response; - }).then(_response.parseStatus).then(_response.parseJSON).then(_response.userFeedback).then(function (response) { - return callback(response, raw); - }).catch(_response.userFeedbackError); - }; - - exports.default = request; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) - -/***/ }, -/* 206 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _chart = __webpack_require__(207); - - var _chart2 = _interopRequireDefault(_chart); - - var _cache = __webpack_require__(209); - - __webpack_require__(210); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - Chart: { - Chart: _chart2.default, - UpdatesChart: _chart.UpdatesChart, - Instances: _chart.Instances - }, - Cache: _cache.Instance - }; - -/***/ }, -/* 207 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Instances = exports.UpdatesChart = exports.defaults = undefined; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - var _chartist = __webpack_require__(208); - - var _chartist2 = _interopRequireDefault(_chartist); - - var _gravConfig = __webpack_require__(198); - - var _gpm = __webpack_require__(1); - - var _updates = __webpack_require__(201); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; - - var defaults = exports.defaults = { - data: { - series: [100, 0] - }, - options: { - Pie: { - donut: true, - donutWidth: 10, - startAngle: 0, - total: 100, - showLabel: false, - height: 150, - chartPadding: !isFirefox ? 10 : 25 - }, - Bar: { - height: 164, - chartPadding: !isFirefox ? 5 : 25, - - axisX: { - showGrid: false, - labelOffset: { - x: 0, - y: 5 - } - }, - axisY: { - offset: 15, - showLabel: true, - showGrid: true, - labelOffset: { - x: 5, - y: 5 - }, - scaleMinSpace: 20 - } - } - } - }; - - var Chart = function () { - function Chart(element) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - var data = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; - - _classCallCheck(this, Chart); - - this.element = (0, _jquery2.default)(element) || []; - if (!this.element[0]) { - return; - } - - var type = (this.element.data('chart-type') || 'pie').toLowerCase(); - this.type = type.charAt(0).toUpperCase() + type.substr(1).toLowerCase(); - - options = Object.assign({}, defaults.options[this.type], options); - data = Object.assign({}, defaults.data, data); - Object.assign(this, { - options: options, - data: data - }); - this.chart = _chartist2.default[this.type](this.element.find('.ct-chart')[0], this.data, this.options); - } - - _createClass(Chart, [{ - key: 'updateData', - value: function updateData(data) { - Object.assign(this.data, data); - this.chart.update(this.data); - } - }]); - - return Chart; - }(); - - exports.default = Chart; - ; - - var UpdatesChart = exports.UpdatesChart = function (_Chart) { - _inherits(UpdatesChart, _Chart); - - function UpdatesChart(element) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - var data = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; - - _classCallCheck(this, UpdatesChart); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UpdatesChart).call(this, element, options, data)); - - _this.chart.on('draw', function (data) { - return _this.draw(data); - }); - - _gpm.Instance.on('fetched', function (response) { - var payload = response.payload.grav; - var missing = (response.payload.resources.total + (payload.isUpdatable ? 1 : 0)) * 100 / (response.payload.installed + (payload.isUpdatable ? 1 : 0)); - var updated = 100 - missing; - - _this.updateData({ series: [updated, missing] }); - - if (response.payload.resources.total) { - _updates.Instance.maintenance('show'); - } - }); - return _this; - } - - _createClass(UpdatesChart, [{ - key: 'draw', - value: function draw(data) { - if (data.index) { - return; - } - - var notice = _gravConfig.translations.PLUGIN_ADMIN[data.value === 100 ? 'FULLY_UPDATED' : 'UPDATES_AVAILABLE']; - this.element.find('.numeric span').text(Math.round(data.value) + '%'); - this.element.find('.js__updates-available-description').html(notice); - this.element.find('.hidden').removeClass('hidden'); - } - }, { - key: 'updateData', - value: function updateData(data) { - _get(Object.getPrototypeOf(UpdatesChart.prototype), 'updateData', this).call(this, data); - - // missing updates - if (this.data.series[0] < 100) { - this.element.closest('#updates').find('[data-maintenance-update]').fadeIn(); - } - } - }]); - - return UpdatesChart; - }(Chart); - - var charts = {}; - - (0, _jquery2.default)('[data-chart-name]').each(function () { - var element = (0, _jquery2.default)(this); - var name = element.data('chart-name') || ''; - var options = element.data('chart-options') || {}; - var data = element.data('chart-data') || {}; - - if (name === 'updates') { - charts[name] = new UpdatesChart(element, options, data); - } else { - charts[name] = new Chart(element, options, data); - } - }); - - var Instances = exports.Instances = charts; - -/***/ }, -/* 208 */, -/* 209 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Instance = undefined; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - var _gravConfig = __webpack_require__(198); - - var _request = __webpack_require__(205); - - var _request2 = _interopRequireDefault(_request); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var getUrl = function getUrl() { - var type = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; - - if (type) { - type = 'cleartype:' + type + '/'; - } - - return _gravConfig.config.base_url_relative + '/cache.json/task:clearCache/' + type + 'admin-nonce:' + _gravConfig.config.admin_nonce; - }; - - var Cache = function () { - function Cache() { - var _this = this; - - _classCallCheck(this, Cache); - - this.element = (0, _jquery2.default)('[data-clear-cache]'); - (0, _jquery2.default)('body').on('click', '[data-clear-cache]', function (event) { - return _this.clear(event, event.target); - }); - } - - _createClass(Cache, [{ - key: 'clear', - value: function clear(event, element) { - var _this2 = this; - - var type = ''; - - if (event && event.preventDefault) { - event.preventDefault(); - } - if (typeof event === 'string') { - type = event; - } - - element = element ? (0, _jquery2.default)(element) : (0, _jquery2.default)('[data-clear-cache-type="' + type + '"]'); - type = type || (0, _jquery2.default)(element).data('clear-cache-type') || ''; - var url = element.data('clearCache') || getUrl(event); - - this.disable(); - - (0, _request2.default)(url, function () { - return _this2.enable(); - }); - } - }, { - key: 'enable', - value: function enable() { - this.element.removeAttr('disabled').find('> .fa').removeClass('fa-refresh fa-spin').addClass('fa-trash'); - } - }, { - key: 'disable', - value: function disable() { - this.element.attr('disabled', 'disabled').find('> .fa').removeClass('fa-trash').addClass('fa-refresh fa-spin'); - } - }]); - - return Cache; - }(); - - exports.default = Cache; - - var Instance = new Cache(); - - exports.Instance = Instance; - -/***/ }, -/* 210 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - var _gravConfig = __webpack_require__(198); - - var _request = __webpack_require__(205); - - var _request2 = _interopRequireDefault(_request); - - var _chart = __webpack_require__(207); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - (0, _jquery2.default)('[data-ajax*="task:backup"]').on('click', function () { - var element = (0, _jquery2.default)(this); - var url = element.data('ajax'); - - element.attr('disabled', 'disabled').find('> .fa').removeClass('fa-database').addClass('fa-spin fa-refresh'); - - (0, _request2.default)(url, function () /* response */{ - if (_chart.Instances && _chart.Instances.backups) { - _chart.Instances.backups.updateData({ series: [0, 100] }); - _chart.Instances.backups.element.find('.numeric').html('0 ' + _gravConfig.translations.PLUGIN_ADMIN.DAYS.toLowerCase() + ''); - } - - element.removeAttr('disabled').find('> .fa').removeClass('fa-spin fa-refresh').addClass('fa-database'); - }); - }); - -/***/ }, -/* 211 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - var _sortablejs = __webpack_require__(212); - - var _sortablejs2 = _interopRequireDefault(_sortablejs); - - var _filter = __webpack_require__(213); - - var _filter2 = _interopRequireDefault(_filter); - - __webpack_require__(220); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - // Pages Ordering - var Ordering = null; - var orderingElement = (0, _jquery2.default)('#ordering'); - if (orderingElement.length) { - Ordering = new _sortablejs2.default(orderingElement.get(0), { - filter: '.ignore', - onUpdate: function onUpdate(event) { - var item = (0, _jquery2.default)(event.item); - var index = orderingElement.children().index(item) + 1; - (0, _jquery2.default)('[data-order]').val(index); - } - }); - } - - exports.default = { - Ordering: Ordering, - PageFilters: { - PageFilters: _filter2.default, - Instance: _filter.Instance - } - }; - -/***/ }, -/* 212 */, -/* 213 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Instance = undefined; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - var _gravConfig = __webpack_require__(198); - - var _request = __webpack_require__(205); - - var _request2 = _interopRequireDefault(_request); - - var _debounce = __webpack_require__(214); - - var _debounce2 = _interopRequireDefault(_debounce); - - var _tree = __webpack_require__(216); - - __webpack_require__(217); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /* @formatter:off */ - /* eslint-disable */ - var options = [{ flag: 'Modular', key: 'Modular', cat: 'mode' }, { flag: 'Visible', key: 'Visible', cat: 'mode' }, { flag: 'Routable', key: 'Routable', cat: 'mode' }, { flag: 'Published', key: 'Published', cat: 'mode' }, { flag: 'Non-Modular', key: 'NonModular', cat: 'mode' }, { flag: 'Non-Visible', key: 'NonVisible', cat: 'mode' }, { flag: 'Non-Routable', key: 'NonRoutable', cat: 'mode' }, { flag: 'Non-Published', key: 'NonPublished', cat: 'mode' }]; - /* @formatter:on */ - /* eslint-enable */ - - var PagesFilter = function () { - function PagesFilter(filters, search) { - var _this = this; - - _classCallCheck(this, PagesFilter); - - this.filters = (0, _jquery2.default)(filters); - this.search = (0, _jquery2.default)(search); - this.options = options; - this.tree = _tree.Instance; - - if (!this.filters.length || !this.search.length) { - return; - } - - this.labels = this.filters.data('filter-labels'); - - this.search.on('input', (0, _debounce2.default)(function () { - return _this.filter(); - }, 250)); - this.filters.on('change', function () { - return _this.filter(); - }); - - this._initSelectize(); - } - - _createClass(PagesFilter, [{ - key: 'filter', - value: function filter(value) { - var _this2 = this; - - var data = { flags: '', query: '' }; - - if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') { - Object.assign(data, value); - } - if (typeof value === 'string') { - data.query = value; - } - if (typeof value === 'undefined') { - data.flags = this.filters.val(); - data.query = this.search.val(); - } - - if (!Object.keys(data).filter(function (key) { - return data[key] !== ''; - }).length) { - this.resetValues(); - return; - } - - data.flags = data.flags.replace(/(\s{1,})?,(\s{1,})?/g, ','); - this.setValues({ flags: data.flags, query: data.query }, 'silent'); - - (0, _request2.default)(_gravConfig.config.base_url_relative + '/pages-filter.json/task' + _gravConfig.config.param_sep + 'filterPages', { - method: 'post', - body: data - }, function (response) { - _this2.refreshDOM(response); - }); - } - }, { - key: 'refreshDOM', - value: function refreshDOM(response) { - var _this3 = this; - - var items = (0, _jquery2.default)('[data-nav-id]'); - - if (!response) { - items.removeClass('search-match').show(); - this.tree.restore(); - - return; - } - - items.removeClass('search-match').hide(); - - response.results.forEach(function (page) { - var match = items.filter('[data-nav-id="' + page + '"]').addClass('search-match').show(); - match.parents('[data-nav-id]').addClass('search-match').show(); - - _this3.tree.expand(page, 'no-store'); - }); - } - }, { - key: 'setValues', - value: function setValues(_ref, silent) { - var _ref$flags = _ref.flags; - var flags = _ref$flags === undefined ? '' : _ref$flags; - var _ref$query = _ref.query; - var query = _ref$query === undefined ? '' : _ref$query; - - var flagsArray = flags.replace(/(\s{1,})?,(\s{1,})?/g, ',').split(','); - if (this.filters.val() !== flags) { - this.filters[0].selectize.setValue(flagsArray, silent); - } - if (this.search.val() !== query) { - this.search.val(query); - } - } - }, { - key: 'resetValues', - value: function resetValues() { - this.setValues('', 'silent'); - this.refreshDOM(); - } - }, { - key: '_initSelectize', - value: function _initSelectize() { - var _this4 = this; - - var extras = { - type: this.filters.data('filter-types') || {}, - access: this.filters.data('filter-access-levels') || {} - }; - - Object.keys(extras).forEach(function (cat) { - Object.keys(extras[cat]).forEach(function (key) { - _this4.options.push({ - cat: cat, - key: key, - flag: extras[cat][key] - }); - }); - }); - - this.filters.selectize({ - maxItems: null, - valueField: 'key', - labelField: 'flag', - searchField: ['flag', 'key'], - options: this.options, - optgroups: this.labels, - optgroupField: 'cat', - optgroupLabelField: 'name', - optgroupValueField: 'id', - optgroupOrder: this.labels.map(function (item) { - return item.id; - }), - plugins: ['optgroup_columns'] - }); - } - }]); - - return PagesFilter; - }(); - - exports.default = PagesFilter; - - var Instance = new PagesFilter('input[name="page-filter"]', 'input[name="page-search"]'); - exports.Instance = Instance; - -/***/ }, -/* 214 */ -/***/ function(module, exports, __webpack_require__) { - - - /** - * Module dependencies. - */ - - var now = __webpack_require__(215); - - /** - * Returns a function, that, as long as it continues to be invoked, will not - * be triggered. The function will be called after it stops being called for - * N milliseconds. If `immediate` is passed, trigger the function on the - * leading edge, instead of the trailing. - * - * @source underscore.js - * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/ - * @param {Function} function to wrap - * @param {Number} timeout in ms (`100`) - * @param {Boolean} whether to execute at the beginning (`false`) - * @api public - */ - - module.exports = function debounce(func, wait, immediate){ - var timeout, args, context, timestamp, result; - if (null == wait) wait = 100; - - function later() { - var last = now() - timestamp; - - if (last < wait && last > 0) { - timeout = setTimeout(later, wait - last); - } else { - timeout = null; - if (!immediate) { - result = func.apply(context, args); - if (!timeout) context = args = null; - } - } - }; - - return function debounced() { - context = this; - args = arguments; - timestamp = now(); - var callNow = immediate && !timeout; - if (!timeout) timeout = setTimeout(later, wait); - if (callNow) { - result = func.apply(context, args); - context = args = null; - } - - return result; - }; - }; - - -/***/ }, -/* 215 */ -/***/ function(module, exports) { - - module.exports = Date.now || now - - function now() { - return new Date().getTime() - } - - -/***/ }, -/* 216 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Instance = undefined; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var sessionKey = 'grav:admin:pages'; - - if (!sessionStorage.getItem(sessionKey)) { - sessionStorage.setItem(sessionKey, '{}'); - } - - var PagesTree = function () { - function PagesTree(elements) { - var _this = this; - - _classCallCheck(this, PagesTree); - - this.elements = (0, _jquery2.default)(elements); - this.session = JSON.parse(sessionStorage.getItem(sessionKey)); - - if (!this.elements.length) { - return; - } - - this.restore(); - - this.elements.find('.page-icon').on('click', function (event) { - return _this.toggle(event.target); - }); - - (0, _jquery2.default)('[data-page-toggleall]').on('click', function (event) { - var element = (0, _jquery2.default)(event.target).closest('[data-page-toggleall]'); - var action = element.data('page-toggleall'); - - _this[action](); - }); - } - - _createClass(PagesTree, [{ - key: 'toggle', - value: function toggle(elements) { - var _this2 = this; - - var dontStore = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (typeof elements === 'string') { - elements = (0, _jquery2.default)('[data-nav-id="' + elements + '"]').find('[data-toggle="children"]'); - } - - elements = (0, _jquery2.default)(elements || this.elements); - elements.each(function (index, element) { - element = (0, _jquery2.default)(element); - var state = _this2.getState(element.closest('[data-toggle="children"]')); - _this2[state.isOpen ? 'collapse' : 'expand'](state.id, dontStore); - }); - } - }, { - key: 'collapse', - value: function collapse(elements) { - var _this3 = this; - - var dontStore = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (typeof elements === 'string') { - elements = (0, _jquery2.default)('[data-nav-id="' + elements + '"]').find('[data-toggle="children"]'); - } - - elements = (0, _jquery2.default)(elements || this.elements); - elements.each(function (index, element) { - element = (0, _jquery2.default)(element); - var state = _this3.getState(element); - - if (state.isOpen) { - state.children.hide(); - state.icon.removeClass('children-open').addClass('children-closed'); - if (!dontStore) { - delete _this3.session[state.id]; - } - } - }); - - if (!dontStore) { - this.save(); - } - } - }, { - key: 'expand', - value: function expand(elements) { - var _this4 = this; - - var dontStore = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (typeof elements === 'string') { - var element = (0, _jquery2.default)('[data-nav-id="' + elements + '"]'); - var parents = element.parents('[data-nav-id]'); - - // loop back through parents, we don't want to expand an hidden child - if (parents.length) { - parents = parents.find('[data-toggle="children"]:first'); - parents = parents.add(element.find('[data-toggle="children"]:first')); - return this.expand(parents, dontStore); - } - - elements = element.find('[data-toggle="children"]:first'); - } - - elements = (0, _jquery2.default)(elements || this.elements); - elements.each(function (index, element) { - element = (0, _jquery2.default)(element); - var state = _this4.getState(element); - - if (!state.isOpen) { - state.children.show(); - state.icon.removeClass('children-closed').addClass('children-open'); - if (!dontStore) { - _this4.session[state.id] = 1; - } - } - }); - - if (!dontStore) { - this.save(); - } - } - }, { - key: 'restore', - value: function restore() { - var _this5 = this; - - this.collapse(null, true); - - Object.keys(this.session).forEach(function (key) { - _this5.expand(key, 'no-store'); - }); - } - }, { - key: 'save', - value: function save() { - return sessionStorage.setItem(sessionKey, JSON.stringify(this.session)); - } - }, { - key: 'getState', - value: function getState(element) { - element = (0, _jquery2.default)(element); - - return { - id: element.closest('[data-nav-id]').data('nav-id'), - children: element.closest('li.page-item').find('ul:first'), - icon: element.find('.page-icon'), - get isOpen() { - return this.icon.hasClass('children-open'); - } - }; - } - }]); - - return PagesTree; - }(); - - exports.default = PagesTree; - - var Instance = new PagesTree('[data-toggle="children"]'); - exports.Instance = Instance; - -/***/ }, -/* 217 */, -/* 218 */, -/* 219 */, -/* 220 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - __webpack_require__(221); - - __webpack_require__(222); - - __webpack_require__(223); - - __webpack_require__(224); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var switcher = (0, _jquery2.default)('input[type="radio"][name="mode-switch"]'); - - if (switcher) { - (function () { - var link = switcher.closest(':checked').data('leave-url'); - var fakeLink = (0, _jquery2.default)(''); - - switcher.parent().append(fakeLink); - - switcher.siblings('label').on('mousedown touchdown', function (event) { - event.preventDefault(); - - // let remodal = $.remodal.lookup[$('[data-remodal-id="changes"]').data('remodal')]; - var confirm = (0, _jquery2.default)('[data-remodal-id="changes"] [data-leave-action="continue"]'); - - confirm.one('click', function () { - (0, _jquery2.default)(window).on('beforeunload._grav'); - fakeLink.off('click._grav'); - - (0, _jquery2.default)(event.target).trigger('click'); - }); - - fakeLink.trigger('click._grav'); - }); - - switcher.on('change', function (event) { - var radio = (0, _jquery2.default)(event.target); - link = radio.data('leave-url'); - - setTimeout(function () { - return fakeLink.attr('href', link).get(0).click(); - }, 5); - }); - })(); - } - -/***/ }, -/* 221 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var custom = false; - var folder = (0, _jquery2.default)('input[name="folder"]'); - var title = (0, _jquery2.default)('input[name="title"]'); - - title.on('input focus blur', function () { - if (custom) { - return true; - } - - var slug = _jquery2.default.slugify(title.val()); - folder.val(slug); - }); - - folder.on('input', function () { - var input = folder.get(0); - var value = folder.val(); - var selection = { - start: input.selectionStart, - end: input.selectionEnd - }; - - value = value.toLowerCase().replace(/\s/g, '-').replace(/[^a-z0-9_\-]/g, ''); - folder.val(value); - custom = !!value; - - // restore cursor position - input.setSelectionRange(selection.start, selection.end); - }); - - folder.on('focus blur', function () { - return title.trigger('input'); - }); - -/***/ }, -/* 222 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - (0, _jquery2.default)('[data-page-move] button[name="task"][value="save"]').on('click', function () { - var route = (0, _jquery2.default)('form#blueprints:first select[name="route"]'); - var moveTo = (0, _jquery2.default)('[data-page-move] select').val(); - - if (route.length && route.val() !== moveTo) { - var selectize = route.data('selectize'); - route.val(moveTo); - - if (selectize) selectize.setValue(moveTo); - } - }); - -/***/ }, -/* 223 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - (0, _jquery2.default)('[data-remodal-target="delete"]').on('click', function () { - var confirm = (0, _jquery2.default)('[data-remodal-id="delete"] [data-delete-action]'); - var link = (0, _jquery2.default)(this).data('delete-url'); - - confirm.data('delete-action', link); - }); - - (0, _jquery2.default)('[data-delete-action]').on('click', function () { - var remodal = _jquery2.default.remodal.lookup[(0, _jquery2.default)('[data-remodal-id="delete"]').data('remodal')]; - - window.location.href = (0, _jquery2.default)(this).data('delete-action'); - remodal.close(); - }); - -/***/ }, -/* 224 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Instance = undefined; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - var _dropzone = __webpack_require__(225); - - var _dropzone2 = _interopRequireDefault(_dropzone); - - var _request = __webpack_require__(205); - - var _request2 = _interopRequireDefault(_request); - - var _gravConfig = __webpack_require__(198); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - _dropzone2.default.autoDiscover = false; - _dropzone2.default.options.gravPageDropzone = {}; - _dropzone2.default.confirm = function (question, accepted, rejected) { - var doc = (0, _jquery2.default)(document); - var modalSelector = '[data-remodal-id="delete-media"]'; - - var removeEvents = function removeEvents() { - doc.off('confirmation', modalSelector, accept); - doc.off('cancellation', modalSelector, reject); - }; - - var accept = function accept() { - accepted && accepted(); - removeEvents(); - }; - - var reject = function reject() { - rejected && rejected(); - removeEvents(); - }; - - _jquery2.default.remodal.lookup[(0, _jquery2.default)(modalSelector).data('remodal')].open(); - doc.on('confirmation', modalSelector, accept); - doc.on('cancellation', modalSelector, reject); - }; - - var DropzoneMediaConfig = { - createImageThumbnails: { thumbnailWidth: 150 }, - addRemoveLinks: false, - dictRemoveFileConfirmation: '[placeholder]', - previewTemplate: '\n '.trim() - }; - - var PageMedia = function () { - function PageMedia() { - var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - - var _ref$form = _ref.form; - var form = _ref$form === undefined ? '[data-media-url]' : _ref$form; - var _ref$container = _ref.container; - var container = _ref$container === undefined ? '#grav-dropzone' : _ref$container; - var _ref$options = _ref.options; - var options = _ref$options === undefined ? {} : _ref$options; - - _classCallCheck(this, PageMedia); - - this.form = (0, _jquery2.default)(form); - this.container = (0, _jquery2.default)(container); - if (!this.form.length || !this.container.length) { - return; - } - - this.options = Object.assign({}, DropzoneMediaConfig, { - url: this.form.data('media-url') + '/task' + _gravConfig.config.param_sep + 'addmedia', - acceptedFiles: this.form.data('media-types') - }, options); - - this.dropzone = new _dropzone2.default(container, this.options); - this.dropzone.on('complete', this.onDropzoneComplete.bind(this)); - this.dropzone.on('success', this.onDropzoneSuccess.bind(this)); - this.dropzone.on('removedfile', this.onDropzoneRemovedFile.bind(this)); - this.dropzone.on('sending', this.onDropzoneSending.bind(this)); - this.dropzone.on('error', this.onDropzoneError.bind(this)); - - this.fetchMedia(); - } - - _createClass(PageMedia, [{ - key: 'fetchMedia', - value: function fetchMedia() { - var _this = this; - - var url = this.form.data('media-url') + '/task' + _gravConfig.config.param_sep + 'listmedia/admin-nonce' + _gravConfig.config.param_sep + _gravConfig.config.admin_nonce; - - (0, _request2.default)(url, function (response) { - var results = response.results; - - Object.keys(results).forEach(function (name) { - var data = results[name]; - var mock = { name: name, size: data.size, accepted: true, extras: data }; - - _this.dropzone.files.push(mock); - _this.dropzone.options.addedfile.call(_this.dropzone, mock); - - if (name.match(/\.(jpg|jpeg|png|gif)$/i)) { - _this.dropzone.options.thumbnail.call(_this.dropzone, mock, data.url); - } - }); - - _this.container.find('.dz-preview').prop('draggable', 'true'); - }); - } - }, { - key: 'onDropzoneSending', - value: function onDropzoneSending(file, xhr, formData) { - formData.append('admin-nonce', _gravConfig.config.admin_nonce); - } - }, { - key: 'onDropzoneSuccess', - value: function onDropzoneSuccess(file, response, xhr) { - return this.handleError({ - file: file, - data: response, - mode: 'removeFile', - msg: '' + _gravConfig.translations.PLUGIN_ADMIN.FILE_ERROR_UPLOAD + ' ' + file.name + '
\n' + response.message + '' - }); - } - }, { - key: 'onDropzoneComplete', - value: function onDropzoneComplete(file) { - if (!file.accepted) { - var data = { - status: 'error', - message: _gravConfig.translations.PLUGIN_ADMIN.FILE_UNSUPPORTED + ': ' + file.name.match(/\..+/).join('') - }; - - return this.handleError({ - file: file, - data: data, - mode: 'removeFile', - msg: '
' + _gravConfig.translations.PLUGIN_ADMIN.FILE_ERROR_ADD + ' ' + file.name + '
\n' + data.message + '' - }); - } - - // accepted - (0, _jquery2.default)('.dz-preview').prop('draggable', 'true'); - } - }, { - key: 'onDropzoneRemovedFile', - value: function onDropzoneRemovedFile(file) { - console.log(file.name, 'acc', file.accepted, 'rej', file.rejected); - if (!file.accepted || file.rejected) { - return; - } - var url = this.form.data('media-url') + '/task' + _gravConfig.config.param_sep + 'delmedia'; - - (0, _request2.default)(url, { - method: 'post', - body: { - filename: file.name - } - }); - } - }, { - key: 'onDropzoneError', - value: function onDropzoneError(file, response, xhr) { - var message = xhr ? response.error.message : response; - (0, _jquery2.default)(file.previewElement).find('[data-dz-errormessage]').html(message); - - return this.handleError({ - file: file, - data: { status: 'error' }, - msg: '
' + message + '' - }); - } - }, { - key: 'handleError', - value: function handleError(options) { - var file = options.file; - var data = options.data; - var mode = options.mode; - var msg = options.msg; - - if (data.status !== 'error' && data.status !== 'unauthorized') { - return; - } - - switch (mode) { - case 'addBack': - if (file instanceof File) { - this.dropzone.addFile.call(this.dropzone, file); - } else { - this.dropzone.files.push(file); - this.dropzone.options.addedfile.call(this.dropzone, file); - this.dropzone.options.thumbnail.call(this.dropzone, file, file.extras.url); - } - - break; - case 'removeFile': - file.rejected = true; - this.dropzone.removeFile.call(this.dropzone, file); - - break; - default: - } - - var modal = (0, _jquery2.default)('[data-remodal-id="generic"]'); - modal.find('.error-content').html(msg); - _jquery2.default.remodal.lookup[modal.data('remodal')].open(); - } - }]); - - return PageMedia; - }(); - - exports.default = PageMedia; - var Instance = exports.Instance = new PageMedia(); - - // let container = $('[data-media-url]'); - - // if (container.length) { - /* let URI = container.data('media-url'); - let dropzone = new Dropzone('#grav-dropzone', { - url: `${URI}/task${config.param_sep}addmedia`, - createImageThumbnails: { thumbnailWidth: 150 }, - addRemoveLinks: false, - dictRemoveFileConfirmation: '[placeholder]', - acceptedFiles: container.data('media-types'), - previewTemplate: ` - ` - });*/ - - /* $.get(URI + '/task{{ config.system.param_sep }}listmedia/admin-nonce{{ config.system.param_sep }}' + GravAdmin.config.admin_nonce, function(data) { - $.proxy(modalError, this, { - data: data, - msg: '
An error occurred while trying to list files
'+data.message+'' - })(); - if (data.results) { - $.each(data.results, function(filename, data){ - var mockFile = { name: filename, size: data.size, accepted: true, extras: data }; - thisDropzone.files.push(mockFile); - thisDropzone.options.addedfile.call(thisDropzone, mockFile); - if (filename.toLowerCase().match(/\.(jpg|jpeg|png|gif)$/)) { - thisDropzone.options.thumbnail.call(thisDropzone, mockFile, data.url); - } - }); - } - $('.dz-preview').prop('draggable', 'true'); - });*/ - - // console.log(dropzone); - // } - - /* - */ - -/***/ }, -/* 225 */, -/* 226 */, -/* 227 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _state = __webpack_require__(228); - - var _state2 = _interopRequireDefault(_state); - - var _form = __webpack_require__(231); - - var _form2 = _interopRequireDefault(_form); - - var _fields = __webpack_require__(232); - - var _fields2 = _interopRequireDefault(_fields); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - Form: { - Form: _form2.default, - Instance: _form.Instance - }, - Fields: _fields2.default, - FormState: { - FormState: _state2.default, - Instance: _state.Instance - } - }; - -/***/ }, -/* 228 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.DOMBehaviors = exports.Instance = undefined; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - var _immutable = __webpack_require__(229); - - var _immutable2 = _interopRequireDefault(_immutable); - - __webpack_require__(230); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var FormLoadState = {}; - - var DOMBehaviors = { - attach: function attach() { - this.preventUnload(); - this.preventClickAway(); - }, - preventUnload: function preventUnload() { - if (_jquery2.default._data(window, 'events') && (_jquery2.default._data(window, 'events').beforeunload || []).filter(function (event) { - return event.namespace === '_grav'; - })) { - return; - } - - // Catch browser uri change / refresh attempt and stop it if the form state is dirty - (0, _jquery2.default)(window).on('beforeunload._grav', function () { - if (Instance.equals() === false) { - return 'You have made changes on this page that you have not yet confirmed. If you navigate away from this page you will lose your unsaved changes.'; - } - }); - }, - preventClickAway: function preventClickAway() { - var selector = 'a[href]:not([href^=#])'; - - if (_jquery2.default._data((0, _jquery2.default)(selector).get(0), 'events') && (_jquery2.default._data((0, _jquery2.default)(selector).get(0), 'events').click || []).filter(function (event) { - return event.namespace === '_grav'; - })) { - return; - } - - // Prevent clicking away if the form state is dirty - // instead, display a confirmation before continuing - (0, _jquery2.default)(selector).on('click._grav', function (event) { - var isClean = Instance.equals(); - if (isClean === null || isClean) { - return true; - } - - event.preventDefault(); - - var destination = (0, _jquery2.default)(this).attr('href'); - var modal = (0, _jquery2.default)('[data-remodal-id="changes"]'); - var lookup = _jquery2.default.remodal.lookup[modal.data('remodal')]; - var buttons = (0, _jquery2.default)('a.button', modal); - - var handler = function handler(event) { - event.preventDefault(); - var action = (0, _jquery2.default)(this).data('leave-action'); - - buttons.off('click', handler); - lookup.close(); - - if (action === 'continue') { - (0, _jquery2.default)(window).off('beforeunload'); - window.location.href = destination; - } - }; - - buttons.on('click', handler); - lookup.open(); - }); - } - }; - - var FormState = function () { - function FormState() { - var options = arguments.length <= 0 || arguments[0] === undefined ? { - ignore: [], - form_id: 'blueprints' - } : arguments[0]; - - _classCallCheck(this, FormState); - - this.options = options; - this.refresh(); - - if (!this.form || !this.fields.length) { - return; - } - FormLoadState = this.collect(); - DOMBehaviors.attach(); - } - - _createClass(FormState, [{ - key: 'refresh', - value: function refresh() { - this.form = (0, _jquery2.default)('form#' + this.options.form_id).filter(':noparents(.remodal)'); - this.fields = (0, _jquery2.default)('form#' + this.options.form_id + ' *, [form="' + this.options.form_id + '"]').filter(':input:not(.no-form)').filter(':noparents(.remodal)'); - - return this; - } - }, { - key: 'collect', - value: function collect() { - var _this = this; - - if (!this.form || !this.fields.length) { - return; - } - - var values = {}; - this.refresh().fields.each(function (index, field) { - field = (0, _jquery2.default)(field); - var name = field.prop('name'); - var type = field.prop('type'); - var value = undefined; - - switch (type) { - case 'checkbox': - case 'radio': - value = field.is(':checked'); - break; - default: - value = field.val(); - } - - if (name && ! ~_this.options.ignore.indexOf(name)) { - values[name] = value; - } - }); - - return _immutable2.default.OrderedMap(values); - } - - // When the form doesn't exist or there are no fields, `equals` returns `null` - // for this reason, _NEVER_ check with !Instance.equals(), use Instance.equals() === false - - }, { - key: 'equals', - value: function equals() { - if (!this.form || !this.fields.length) { - return null; - } - return _immutable2.default.is(FormLoadState, this.collect()); - } - }]); - - return FormState; - }(); - - exports.default = FormState; - ; - - var Instance = exports.Instance = new FormState(); - - exports.DOMBehaviors = DOMBehaviors; - -/***/ }, -/* 229 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - - (function (global, factory) { - true ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - global.Immutable = factory(); - }(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice; - - function createClass(ctor, superClass) { - if (superClass) { - ctor.prototype = Object.create(superClass.prototype); - } - ctor.prototype.constructor = ctor; - } - - function Iterable(value) { - return isIterable(value) ? value : Seq(value); - } - - - createClass(KeyedIterable, Iterable); - function KeyedIterable(value) { - return isKeyed(value) ? value : KeyedSeq(value); - } - - - createClass(IndexedIterable, Iterable); - function IndexedIterable(value) { - return isIndexed(value) ? value : IndexedSeq(value); - } - - - createClass(SetIterable, Iterable); - function SetIterable(value) { - return isIterable(value) && !isAssociative(value) ? value : SetSeq(value); - } - - - - function isIterable(maybeIterable) { - return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]); - } - - function isKeyed(maybeKeyed) { - return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]); - } - - function isIndexed(maybeIndexed) { - return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]); - } - - function isAssociative(maybeAssociative) { - return isKeyed(maybeAssociative) || isIndexed(maybeAssociative); - } - - function isOrdered(maybeOrdered) { - return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]); - } - - Iterable.isIterable = isIterable; - Iterable.isKeyed = isKeyed; - Iterable.isIndexed = isIndexed; - Iterable.isAssociative = isAssociative; - Iterable.isOrdered = isOrdered; - - Iterable.Keyed = KeyedIterable; - Iterable.Indexed = IndexedIterable; - Iterable.Set = SetIterable; - - - var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; - var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; - var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; - var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; - - // Used for setting prototype methods that IE8 chokes on. - var DELETE = 'delete'; - - // Constants describing the size of trie nodes. - var SHIFT = 5; // Resulted in best performance after ______? - var SIZE = 1 << SHIFT; - var MASK = SIZE - 1; - - // A consistent shared value representing "not set" which equals nothing other - // than itself, and nothing that could be provided externally. - var NOT_SET = {}; - - // Boolean references, Rough equivalent of `bool &`. - var CHANGE_LENGTH = { value: false }; - var DID_ALTER = { value: false }; - - function MakeRef(ref) { - ref.value = false; - return ref; - } - - function SetRef(ref) { - ref && (ref.value = true); - } - - // A function which returns a value representing an "owner" for transient writes - // to tries. The return value will only ever equal itself, and will not equal - // the return of any subsequent call of this function. - function OwnerID() {} - - // http://jsperf.com/copy-array-inline - function arrCopy(arr, offset) { - offset = offset || 0; - var len = Math.max(0, arr.length - offset); - var newArr = new Array(len); - for (var ii = 0; ii < len; ii++) { - newArr[ii] = arr[ii + offset]; - } - return newArr; - } - - function ensureSize(iter) { - if (iter.size === undefined) { - iter.size = iter.__iterate(returnTrue); - } - return iter.size; - } - - function wrapIndex(iter, index) { - // This implements "is array index" which the ECMAString spec defines as: - // - // A String property name P is an array index if and only if - // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal - // to 2^32−1. - // - // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects - if (typeof index !== 'number') { - var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32 - if ('' + uint32Index !== index || uint32Index === 4294967295) { - return NaN; - } - index = uint32Index; - } - return index < 0 ? ensureSize(iter) + index : index; - } - - function returnTrue() { - return true; - } - - function wholeSlice(begin, end, size) { - return (begin === 0 || (size !== undefined && begin <= -size)) && - (end === undefined || (size !== undefined && end >= size)); - } - - function resolveBegin(begin, size) { - return resolveIndex(begin, size, 0); - } - - function resolveEnd(end, size) { - return resolveIndex(end, size, size); - } - - function resolveIndex(index, size, defaultIndex) { - return index === undefined ? - defaultIndex : - index < 0 ? - Math.max(0, size + index) : - size === undefined ? - index : - Math.min(size, index); - } - - /* global Symbol */ - - var ITERATE_KEYS = 0; - var ITERATE_VALUES = 1; - var ITERATE_ENTRIES = 2; - - var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; - - var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL; - - - function Iterator(next) { - this.next = next; - } - - Iterator.prototype.toString = function() { - return '[Iterator]'; - }; - - - Iterator.KEYS = ITERATE_KEYS; - Iterator.VALUES = ITERATE_VALUES; - Iterator.ENTRIES = ITERATE_ENTRIES; - - Iterator.prototype.inspect = - Iterator.prototype.toSource = function () { return this.toString(); } - Iterator.prototype[ITERATOR_SYMBOL] = function () { - return this; - }; - - - function iteratorValue(type, k, v, iteratorResult) { - var value = type === 0 ? k : type === 1 ? v : [k, v]; - iteratorResult ? (iteratorResult.value = value) : (iteratorResult = { - value: value, done: false - }); - return iteratorResult; - } - - function iteratorDone() { - return { value: undefined, done: true }; - } - - function hasIterator(maybeIterable) { - return !!getIteratorFn(maybeIterable); - } - - function isIterator(maybeIterator) { - return maybeIterator && typeof maybeIterator.next === 'function'; - } - - function getIterator(iterable) { - var iteratorFn = getIteratorFn(iterable); - return iteratorFn && iteratorFn.call(iterable); - } - - function getIteratorFn(iterable) { - var iteratorFn = iterable && ( - (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) || - iterable[FAUX_ITERATOR_SYMBOL] - ); - if (typeof iteratorFn === 'function') { - return iteratorFn; - } - } - - function isArrayLike(value) { - return value && typeof value.length === 'number'; - } - - createClass(Seq, Iterable); - function Seq(value) { - return value === null || value === undefined ? emptySequence() : - isIterable(value) ? value.toSeq() : seqFromValue(value); - } - - Seq.of = function(/*...values*/) { - return Seq(arguments); - }; - - Seq.prototype.toSeq = function() { - return this; - }; - - Seq.prototype.toString = function() { - return this.__toString('Seq {', '}'); - }; - - Seq.prototype.cacheResult = function() { - if (!this._cache && this.__iterateUncached) { - this._cache = this.entrySeq().toArray(); - this.size = this._cache.length; - } - return this; - }; - - // abstract __iterateUncached(fn, reverse) - - Seq.prototype.__iterate = function(fn, reverse) { - return seqIterate(this, fn, reverse, true); - }; - - // abstract __iteratorUncached(type, reverse) - - Seq.prototype.__iterator = function(type, reverse) { - return seqIterator(this, type, reverse, true); - }; - - - - createClass(KeyedSeq, Seq); - function KeyedSeq(value) { - return value === null || value === undefined ? - emptySequence().toKeyedSeq() : - isIterable(value) ? - (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) : - keyedSeqFromValue(value); - } - - KeyedSeq.prototype.toKeyedSeq = function() { - return this; - }; - - - - createClass(IndexedSeq, Seq); - function IndexedSeq(value) { - return value === null || value === undefined ? emptySequence() : - !isIterable(value) ? indexedSeqFromValue(value) : - isKeyed(value) ? value.entrySeq() : value.toIndexedSeq(); - } - - IndexedSeq.of = function(/*...values*/) { - return IndexedSeq(arguments); - }; - - IndexedSeq.prototype.toIndexedSeq = function() { - return this; - }; - - IndexedSeq.prototype.toString = function() { - return this.__toString('Seq [', ']'); - }; - - IndexedSeq.prototype.__iterate = function(fn, reverse) { - return seqIterate(this, fn, reverse, false); - }; - - IndexedSeq.prototype.__iterator = function(type, reverse) { - return seqIterator(this, type, reverse, false); - }; - - - - createClass(SetSeq, Seq); - function SetSeq(value) { - return ( - value === null || value === undefined ? emptySequence() : - !isIterable(value) ? indexedSeqFromValue(value) : - isKeyed(value) ? value.entrySeq() : value - ).toSetSeq(); - } - - SetSeq.of = function(/*...values*/) { - return SetSeq(arguments); - }; - - SetSeq.prototype.toSetSeq = function() { - return this; - }; - - - - Seq.isSeq = isSeq; - Seq.Keyed = KeyedSeq; - Seq.Set = SetSeq; - Seq.Indexed = IndexedSeq; - - var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@'; - - Seq.prototype[IS_SEQ_SENTINEL] = true; - - - - createClass(ArraySeq, IndexedSeq); - function ArraySeq(array) { - this._array = array; - this.size = array.length; - } - - ArraySeq.prototype.get = function(index, notSetValue) { - return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue; - }; - - ArraySeq.prototype.__iterate = function(fn, reverse) { - var array = this._array; - var maxIndex = array.length - 1; - for (var ii = 0; ii <= maxIndex; ii++) { - if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) { - return ii + 1; - } - } - return ii; - }; - - ArraySeq.prototype.__iterator = function(type, reverse) { - var array = this._array; - var maxIndex = array.length - 1; - var ii = 0; - return new Iterator(function() - {return ii > maxIndex ? - iteratorDone() : - iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])} - ); - }; - - - - createClass(ObjectSeq, KeyedSeq); - function ObjectSeq(object) { - var keys = Object.keys(object); - this._object = object; - this._keys = keys; - this.size = keys.length; - } - - ObjectSeq.prototype.get = function(key, notSetValue) { - if (notSetValue !== undefined && !this.has(key)) { - return notSetValue; - } - return this._object[key]; - }; - - ObjectSeq.prototype.has = function(key) { - return this._object.hasOwnProperty(key); - }; - - ObjectSeq.prototype.__iterate = function(fn, reverse) { - var object = this._object; - var keys = this._keys; - var maxIndex = keys.length - 1; - for (var ii = 0; ii <= maxIndex; ii++) { - var key = keys[reverse ? maxIndex - ii : ii]; - if (fn(object[key], key, this) === false) { - return ii + 1; - } - } - return ii; - }; - - ObjectSeq.prototype.__iterator = function(type, reverse) { - var object = this._object; - var keys = this._keys; - var maxIndex = keys.length - 1; - var ii = 0; - return new Iterator(function() { - var key = keys[reverse ? maxIndex - ii : ii]; - return ii++ > maxIndex ? - iteratorDone() : - iteratorValue(type, key, object[key]); - }); - }; - - ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true; - - - createClass(IterableSeq, IndexedSeq); - function IterableSeq(iterable) { - this._iterable = iterable; - this.size = iterable.length || iterable.size; - } - - IterableSeq.prototype.__iterateUncached = function(fn, reverse) { - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var iterable = this._iterable; - var iterator = getIterator(iterable); - var iterations = 0; - if (isIterator(iterator)) { - var step; - while (!(step = iterator.next()).done) { - if (fn(step.value, iterations++, this) === false) { - break; - } - } - } - return iterations; - }; - - IterableSeq.prototype.__iteratorUncached = function(type, reverse) { - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterable = this._iterable; - var iterator = getIterator(iterable); - if (!isIterator(iterator)) { - return new Iterator(iteratorDone); - } - var iterations = 0; - return new Iterator(function() { - var step = iterator.next(); - return step.done ? step : iteratorValue(type, iterations++, step.value); - }); - }; - - - - createClass(IteratorSeq, IndexedSeq); - function IteratorSeq(iterator) { - this._iterator = iterator; - this._iteratorCache = []; - } - - IteratorSeq.prototype.__iterateUncached = function(fn, reverse) { - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var iterator = this._iterator; - var cache = this._iteratorCache; - var iterations = 0; - while (iterations < cache.length) { - if (fn(cache[iterations], iterations++, this) === false) { - return iterations; - } - } - var step; - while (!(step = iterator.next()).done) { - var val = step.value; - cache[iterations] = val; - if (fn(val, iterations++, this) === false) { - break; - } - } - return iterations; - }; - - IteratorSeq.prototype.__iteratorUncached = function(type, reverse) { - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterator = this._iterator; - var cache = this._iteratorCache; - var iterations = 0; - return new Iterator(function() { - if (iterations >= cache.length) { - var step = iterator.next(); - if (step.done) { - return step; - } - cache[iterations] = step.value; - } - return iteratorValue(type, iterations, cache[iterations++]); - }); - }; - - - - - // # pragma Helper functions - - function isSeq(maybeSeq) { - return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]); - } - - var EMPTY_SEQ; - - function emptySequence() { - return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([])); - } - - function keyedSeqFromValue(value) { - var seq = - Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() : - isIterator(value) ? new IteratorSeq(value).fromEntrySeq() : - hasIterator(value) ? new IterableSeq(value).fromEntrySeq() : - typeof value === 'object' ? new ObjectSeq(value) : - undefined; - if (!seq) { - throw new TypeError( - 'Expected Array or iterable object of [k, v] entries, '+ - 'or keyed object: ' + value - ); - } - return seq; - } - - function indexedSeqFromValue(value) { - var seq = maybeIndexedSeqFromValue(value); - if (!seq) { - throw new TypeError( - 'Expected Array or iterable object of values: ' + value - ); - } - return seq; - } - - function seqFromValue(value) { - var seq = maybeIndexedSeqFromValue(value) || - (typeof value === 'object' && new ObjectSeq(value)); - if (!seq) { - throw new TypeError( - 'Expected Array or iterable object of values, or keyed object: ' + value - ); - } - return seq; - } - - function maybeIndexedSeqFromValue(value) { - return ( - isArrayLike(value) ? new ArraySeq(value) : - isIterator(value) ? new IteratorSeq(value) : - hasIterator(value) ? new IterableSeq(value) : - undefined - ); - } - - function seqIterate(seq, fn, reverse, useKeys) { - var cache = seq._cache; - if (cache) { - var maxIndex = cache.length - 1; - for (var ii = 0; ii <= maxIndex; ii++) { - var entry = cache[reverse ? maxIndex - ii : ii]; - if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) { - return ii + 1; - } - } - return ii; - } - return seq.__iterateUncached(fn, reverse); - } - - function seqIterator(seq, type, reverse, useKeys) { - var cache = seq._cache; - if (cache) { - var maxIndex = cache.length - 1; - var ii = 0; - return new Iterator(function() { - var entry = cache[reverse ? maxIndex - ii : ii]; - return ii++ > maxIndex ? - iteratorDone() : - iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]); - }); - } - return seq.__iteratorUncached(type, reverse); - } - - function fromJS(json, converter) { - return converter ? - fromJSWith(converter, json, '', {'': json}) : - fromJSDefault(json); - } - - function fromJSWith(converter, json, key, parentJSON) { - if (Array.isArray(json)) { - return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); - } - if (isPlainObj(json)) { - return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); - } - return json; - } - - function fromJSDefault(json) { - if (Array.isArray(json)) { - return IndexedSeq(json).map(fromJSDefault).toList(); - } - if (isPlainObj(json)) { - return KeyedSeq(json).map(fromJSDefault).toMap(); - } - return json; - } - - function isPlainObj(value) { - return value && (value.constructor === Object || value.constructor === undefined); - } - - /** - * An extension of the "same-value" algorithm as [described for use by ES6 Map - * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality) - * - * NaN is considered the same as NaN, however -0 and 0 are considered the same - * value, which is different from the algorithm described by - * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). - * - * This is extended further to allow Objects to describe the values they - * represent, by way of `valueOf` or `equals` (and `hashCode`). - * - * Note: because of this extension, the key equality of Immutable.Map and the - * value equality of Immutable.Set will differ from ES6 Map and Set. - * - * ### Defining custom values - * - * The easiest way to describe the value an object represents is by implementing - * `valueOf`. For example, `Date` represents a value by returning a unix - * timestamp for `valueOf`: - * - * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ... - * var date2 = new Date(1234567890000); - * date1.valueOf(); // 1234567890000 - * assert( date1 !== date2 ); - * assert( Immutable.is( date1, date2 ) ); - * - * Note: overriding `valueOf` may have other implications if you use this object - * where JavaScript expects a primitive, such as implicit string coercion. - * - * For more complex types, especially collections, implementing `valueOf` may - * not be performant. An alternative is to implement `equals` and `hashCode`. - * - * `equals` takes another object, presumably of similar type, and returns true - * if the it is equal. Equality is symmetrical, so the same result should be - * returned if this and the argument are flipped. - * - * assert( a.equals(b) === b.equals(a) ); - * - * `hashCode` returns a 32bit integer number representing the object which will - * be used to determine how to store the value object in a Map or Set. You must - * provide both or neither methods, one must not exist without the other. - * - * Also, an important relationship between these methods must be upheld: if two - * values are equal, they *must* return the same hashCode. If the values are not - * equal, they might have the same hashCode; this is called a hash collision, - * and while undesirable for performance reasons, it is acceptable. - * - * if (a.equals(b)) { - * assert( a.hashCode() === b.hashCode() ); - * } - * - * All Immutable collections implement `equals` and `hashCode`. - * - */ - function is(valueA, valueB) { - if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) { - return true; - } - if (!valueA || !valueB) { - return false; - } - if (typeof valueA.valueOf === 'function' && - typeof valueB.valueOf === 'function') { - valueA = valueA.valueOf(); - valueB = valueB.valueOf(); - if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) { - return true; - } - if (!valueA || !valueB) { - return false; - } - } - if (typeof valueA.equals === 'function' && - typeof valueB.equals === 'function' && - valueA.equals(valueB)) { - return true; - } - return false; - } - - function deepEqual(a, b) { - if (a === b) { - return true; - } - - if ( - !isIterable(b) || - a.size !== undefined && b.size !== undefined && a.size !== b.size || - a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash || - isKeyed(a) !== isKeyed(b) || - isIndexed(a) !== isIndexed(b) || - isOrdered(a) !== isOrdered(b) - ) { - return false; - } - - if (a.size === 0 && b.size === 0) { - return true; - } - - var notAssociative = !isAssociative(a); - - if (isOrdered(a)) { - var entries = a.entries(); - return b.every(function(v, k) { - var entry = entries.next().value; - return entry && is(entry[1], v) && (notAssociative || is(entry[0], k)); - }) && entries.next().done; - } - - var flipped = false; - - if (a.size === undefined) { - if (b.size === undefined) { - if (typeof a.cacheResult === 'function') { - a.cacheResult(); - } - } else { - flipped = true; - var _ = a; - a = b; - b = _; - } - } - - var allEqual = true; - var bSize = b.__iterate(function(v, k) { - if (notAssociative ? !a.has(v) : - flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) { - allEqual = false; - return false; - } - }); - - return allEqual && a.size === bSize; - } - - createClass(Repeat, IndexedSeq); - - function Repeat(value, times) { - if (!(this instanceof Repeat)) { - return new Repeat(value, times); - } - this._value = value; - this.size = times === undefined ? Infinity : Math.max(0, times); - if (this.size === 0) { - if (EMPTY_REPEAT) { - return EMPTY_REPEAT; - } - EMPTY_REPEAT = this; - } - } - - Repeat.prototype.toString = function() { - if (this.size === 0) { - return 'Repeat []'; - } - return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]'; - }; - - Repeat.prototype.get = function(index, notSetValue) { - return this.has(index) ? this._value : notSetValue; - }; - - Repeat.prototype.includes = function(searchValue) { - return is(this._value, searchValue); - }; - - Repeat.prototype.slice = function(begin, end) { - var size = this.size; - return wholeSlice(begin, end, size) ? this : - new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size)); - }; - - Repeat.prototype.reverse = function() { - return this; - }; - - Repeat.prototype.indexOf = function(searchValue) { - if (is(this._value, searchValue)) { - return 0; - } - return -1; - }; - - Repeat.prototype.lastIndexOf = function(searchValue) { - if (is(this._value, searchValue)) { - return this.size; - } - return -1; - }; - - Repeat.prototype.__iterate = function(fn, reverse) { - for (var ii = 0; ii < this.size; ii++) { - if (fn(this._value, ii, this) === false) { - return ii + 1; - } - } - return ii; - }; - - Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this; - var ii = 0; - return new Iterator(function() - {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()} - ); - }; - - Repeat.prototype.equals = function(other) { - return other instanceof Repeat ? - is(this._value, other._value) : - deepEqual(other); - }; - - - var EMPTY_REPEAT; - - function invariant(condition, error) { - if (!condition) throw new Error(error); - } - - createClass(Range, IndexedSeq); - - function Range(start, end, step) { - if (!(this instanceof Range)) { - return new Range(start, end, step); - } - invariant(step !== 0, 'Cannot step a Range by 0'); - start = start || 0; - if (end === undefined) { - end = Infinity; - } - step = step === undefined ? 1 : Math.abs(step); - if (end < start) { - step = -step; - } - this._start = start; - this._end = end; - this._step = step; - this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1); - if (this.size === 0) { - if (EMPTY_RANGE) { - return EMPTY_RANGE; - } - EMPTY_RANGE = this; - } - } - - Range.prototype.toString = function() { - if (this.size === 0) { - return 'Range []'; - } - return 'Range [ ' + - this._start + '...' + this._end + - (this._step > 1 ? ' by ' + this._step : '') + - ' ]'; - }; - - Range.prototype.get = function(index, notSetValue) { - return this.has(index) ? - this._start + wrapIndex(this, index) * this._step : - notSetValue; - }; - - Range.prototype.includes = function(searchValue) { - var possibleIndex = (searchValue - this._start) / this._step; - return possibleIndex >= 0 && - possibleIndex < this.size && - possibleIndex === Math.floor(possibleIndex); - }; - - Range.prototype.slice = function(begin, end) { - if (wholeSlice(begin, end, this.size)) { - return this; - } - begin = resolveBegin(begin, this.size); - end = resolveEnd(end, this.size); - if (end <= begin) { - return new Range(0, 0); - } - return new Range(this.get(begin, this._end), this.get(end, this._end), this._step); - }; - - Range.prototype.indexOf = function(searchValue) { - var offsetValue = searchValue - this._start; - if (offsetValue % this._step === 0) { - var index = offsetValue / this._step; - if (index >= 0 && index < this.size) { - return index - } - } - return -1; - }; - - Range.prototype.lastIndexOf = function(searchValue) { - return this.indexOf(searchValue); - }; - - Range.prototype.__iterate = function(fn, reverse) { - var maxIndex = this.size - 1; - var step = this._step; - var value = reverse ? this._start + maxIndex * step : this._start; - for (var ii = 0; ii <= maxIndex; ii++) { - if (fn(value, ii, this) === false) { - return ii + 1; - } - value += reverse ? -step : step; - } - return ii; - }; - - Range.prototype.__iterator = function(type, reverse) { - var maxIndex = this.size - 1; - var step = this._step; - var value = reverse ? this._start + maxIndex * step : this._start; - var ii = 0; - return new Iterator(function() { - var v = value; - value += reverse ? -step : step; - return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v); - }); - }; - - Range.prototype.equals = function(other) { - return other instanceof Range ? - this._start === other._start && - this._end === other._end && - this._step === other._step : - deepEqual(this, other); - }; - - - var EMPTY_RANGE; - - createClass(Collection, Iterable); - function Collection() { - throw TypeError('Abstract'); - } - - - createClass(KeyedCollection, Collection);function KeyedCollection() {} - - createClass(IndexedCollection, Collection);function IndexedCollection() {} - - createClass(SetCollection, Collection);function SetCollection() {} - - - Collection.Keyed = KeyedCollection; - Collection.Indexed = IndexedCollection; - Collection.Set = SetCollection; - - var imul = - typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ? - Math.imul : - function imul(a, b) { - a = a | 0; // int - b = b | 0; // int - var c = a & 0xffff; - var d = b & 0xffff; - // Shift by 0 fixes the sign on the high part. - return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int - }; - - // v8 has an optimization for storing 31-bit signed numbers. - // Values which have either 00 or 11 as the high order bits qualify. - // This function drops the highest order bit in a signed number, maintaining - // the sign bit. - function smi(i32) { - return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF); - } - - function hash(o) { - if (o === false || o === null || o === undefined) { - return 0; - } - if (typeof o.valueOf === 'function') { - o = o.valueOf(); - if (o === false || o === null || o === undefined) { - return 0; - } - } - if (o === true) { - return 1; - } - var type = typeof o; - if (type === 'number') { - var h = o | 0; - if (h !== o) { - h ^= o * 0xFFFFFFFF; - } - while (o > 0xFFFFFFFF) { - o /= 0xFFFFFFFF; - h ^= o; - } - return smi(h); - } - if (type === 'string') { - return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o); - } - if (typeof o.hashCode === 'function') { - return o.hashCode(); - } - if (type === 'object') { - return hashJSObj(o); - } - if (typeof o.toString === 'function') { - return hashString(o.toString()); - } - throw new Error('Value type ' + type + ' cannot be hashed.'); - } - - function cachedHashString(string) { - var hash = stringHashCache[string]; - if (hash === undefined) { - hash = hashString(string); - if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) { - STRING_HASH_CACHE_SIZE = 0; - stringHashCache = {}; - } - STRING_HASH_CACHE_SIZE++; - stringHashCache[string] = hash; - } - return hash; - } - - // http://jsperf.com/hashing-strings - function hashString(string) { - // This is the hash from JVM - // The hash code for a string is computed as - // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1], - // where s[i] is the ith character of the string and n is the length of - // the string. We "mod" the result to make it between 0 (inclusive) and 2^31 - // (exclusive) by dropping high bits. - var hash = 0; - for (var ii = 0; ii < string.length; ii++) { - hash = 31 * hash + string.charCodeAt(ii) | 0; - } - return smi(hash); - } - - function hashJSObj(obj) { - var hash; - if (usingWeakMap) { - hash = weakMap.get(obj); - if (hash !== undefined) { - return hash; - } - } - - hash = obj[UID_HASH_KEY]; - if (hash !== undefined) { - return hash; - } - - if (!canDefineProperty) { - hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY]; - if (hash !== undefined) { - return hash; - } - - hash = getIENodeHash(obj); - if (hash !== undefined) { - return hash; - } - } - - hash = ++objHashUID; - if (objHashUID & 0x40000000) { - objHashUID = 0; - } - - if (usingWeakMap) { - weakMap.set(obj, hash); - } else if (isExtensible !== undefined && isExtensible(obj) === false) { - throw new Error('Non-extensible objects are not allowed as keys.'); - } else if (canDefineProperty) { - Object.defineProperty(obj, UID_HASH_KEY, { - 'enumerable': false, - 'configurable': false, - 'writable': false, - 'value': hash - }); - } else if (obj.propertyIsEnumerable !== undefined && - obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) { - // Since we can't define a non-enumerable property on the object - // we'll hijack one of the less-used non-enumerable properties to - // save our hash on it. Since this is a function it will not show up in - // `JSON.stringify` which is what we want. - obj.propertyIsEnumerable = function() { - return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments); - }; - obj.propertyIsEnumerable[UID_HASH_KEY] = hash; - } else if (obj.nodeType !== undefined) { - // At this point we couldn't get the IE `uniqueID` to use as a hash - // and we couldn't use a non-enumerable property to exploit the - // dontEnum bug so we simply add the `UID_HASH_KEY` on the node - // itself. - obj[UID_HASH_KEY] = hash; - } else { - throw new Error('Unable to set a non-enumerable property on object.'); - } - - return hash; - } - - // Get references to ES5 object methods. - var isExtensible = Object.isExtensible; - - // True if Object.defineProperty works as expected. IE8 fails this test. - var canDefineProperty = (function() { - try { - Object.defineProperty({}, '@', {}); - return true; - } catch (e) { - return false; - } - }()); - - // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it - // and avoid memory leaks from the IE cloneNode bug. - function getIENodeHash(node) { - if (node && node.nodeType > 0) { - switch (node.nodeType) { - case 1: // Element - return node.uniqueID; - case 9: // Document - return node.documentElement && node.documentElement.uniqueID; - } - } - } - - // If possible, use a WeakMap. - var usingWeakMap = typeof WeakMap === 'function'; - var weakMap; - if (usingWeakMap) { - weakMap = new WeakMap(); - } - - var objHashUID = 0; - - var UID_HASH_KEY = '__immutablehash__'; - if (typeof Symbol === 'function') { - UID_HASH_KEY = Symbol(UID_HASH_KEY); - } - - var STRING_HASH_CACHE_MIN_STRLEN = 16; - var STRING_HASH_CACHE_MAX_SIZE = 255; - var STRING_HASH_CACHE_SIZE = 0; - var stringHashCache = {}; - - function assertNotInfinite(size) { - invariant( - size !== Infinity, - 'Cannot perform this action with an infinite size.' - ); - } - - createClass(Map, KeyedCollection); - - // @pragma Construction - - function Map(value) { - return value === null || value === undefined ? emptyMap() : - isMap(value) && !isOrdered(value) ? value : - emptyMap().withMutations(function(map ) { - var iter = KeyedIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v, k) {return map.set(k, v)}); - }); - } - - Map.prototype.toString = function() { - return this.__toString('Map {', '}'); - }; - - // @pragma Access - - Map.prototype.get = function(k, notSetValue) { - return this._root ? - this._root.get(0, undefined, k, notSetValue) : - notSetValue; - }; - - // @pragma Modification - - Map.prototype.set = function(k, v) { - return updateMap(this, k, v); - }; - - Map.prototype.setIn = function(keyPath, v) { - return this.updateIn(keyPath, NOT_SET, function() {return v}); - }; - - Map.prototype.remove = function(k) { - return updateMap(this, k, NOT_SET); - }; - - Map.prototype.deleteIn = function(keyPath) { - return this.updateIn(keyPath, function() {return NOT_SET}); - }; - - Map.prototype.update = function(k, notSetValue, updater) { - return arguments.length === 1 ? - k(this) : - this.updateIn([k], notSetValue, updater); - }; - - Map.prototype.updateIn = function(keyPath, notSetValue, updater) { - if (!updater) { - updater = notSetValue; - notSetValue = undefined; - } - var updatedValue = updateInDeepMap( - this, - forceIterator(keyPath), - notSetValue, - updater - ); - return updatedValue === NOT_SET ? undefined : updatedValue; - }; - - Map.prototype.clear = function() { - if (this.size === 0) { - return this; - } - if (this.__ownerID) { - this.size = 0; - this._root = null; - this.__hash = undefined; - this.__altered = true; - return this; - } - return emptyMap(); - }; - - // @pragma Composition - - Map.prototype.merge = function(/*...iters*/) { - return mergeIntoMapWith(this, undefined, arguments); - }; - - Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoMapWith(this, merger, iters); - }; - - Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); - return this.updateIn( - keyPath, - emptyMap(), - function(m ) {return typeof m.merge === 'function' ? - m.merge.apply(m, iters) : - iters[iters.length - 1]} - ); - }; - - Map.prototype.mergeDeep = function(/*...iters*/) { - return mergeIntoMapWith(this, deepMerger, arguments); - }; - - Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoMapWith(this, deepMergerWith(merger), iters); - }; - - Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); - return this.updateIn( - keyPath, - emptyMap(), - function(m ) {return typeof m.mergeDeep === 'function' ? - m.mergeDeep.apply(m, iters) : - iters[iters.length - 1]} - ); - }; - - Map.prototype.sort = function(comparator) { - // Late binding - return OrderedMap(sortFactory(this, comparator)); - }; - - Map.prototype.sortBy = function(mapper, comparator) { - // Late binding - return OrderedMap(sortFactory(this, comparator, mapper)); - }; - - // @pragma Mutability - - Map.prototype.withMutations = function(fn) { - var mutable = this.asMutable(); - fn(mutable); - return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this; - }; - - Map.prototype.asMutable = function() { - return this.__ownerID ? this : this.__ensureOwner(new OwnerID()); - }; - - Map.prototype.asImmutable = function() { - return this.__ensureOwner(); - }; - - Map.prototype.wasAltered = function() { - return this.__altered; - }; - - Map.prototype.__iterator = function(type, reverse) { - return new MapIterator(this, type, reverse); - }; - - Map.prototype.__iterate = function(fn, reverse) {var this$0 = this; - var iterations = 0; - this._root && this._root.iterate(function(entry ) { - iterations++; - return fn(entry[1], entry[0], this$0); - }, reverse); - return iterations; - }; - - Map.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - if (!ownerID) { - this.__ownerID = ownerID; - this.__altered = false; - return this; - } - return makeMap(this.size, this._root, ownerID, this.__hash); - }; - - - function isMap(maybeMap) { - return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]); - } - - Map.isMap = isMap; - - var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@'; - - var MapPrototype = Map.prototype; - MapPrototype[IS_MAP_SENTINEL] = true; - MapPrototype[DELETE] = MapPrototype.remove; - MapPrototype.removeIn = MapPrototype.deleteIn; - - - // #pragma Trie Nodes - - - - function ArrayMapNode(ownerID, entries) { - this.ownerID = ownerID; - this.entries = entries; - } - - ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) { - var entries = this.entries; - for (var ii = 0, len = entries.length; ii < len; ii++) { - if (is(key, entries[ii][0])) { - return entries[ii][1]; - } - } - return notSetValue; - }; - - ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - var removed = value === NOT_SET; - - var entries = this.entries; - var idx = 0; - for (var len = entries.length; idx < len; idx++) { - if (is(key, entries[idx][0])) { - break; - } - } - var exists = idx < len; - - if (exists ? entries[idx][1] === value : removed) { - return this; - } - - SetRef(didAlter); - (removed || !exists) && SetRef(didChangeSize); - - if (removed && entries.length === 1) { - return; // undefined - } - - if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) { - return createNodes(ownerID, entries, key, value); - } - - var isEditable = ownerID && ownerID === this.ownerID; - var newEntries = isEditable ? entries : arrCopy(entries); - - if (exists) { - if (removed) { - idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop()); - } else { - newEntries[idx] = [key, value]; - } - } else { - newEntries.push([key, value]); - } - - if (isEditable) { - this.entries = newEntries; - return this; - } - - return new ArrayMapNode(ownerID, newEntries); - }; - - - - - function BitmapIndexedNode(ownerID, bitmap, nodes) { - this.ownerID = ownerID; - this.bitmap = bitmap; - this.nodes = nodes; - } - - BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) { - if (keyHash === undefined) { - keyHash = hash(key); - } - var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK)); - var bitmap = this.bitmap; - return (bitmap & bit) === 0 ? notSetValue : - this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue); - }; - - BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - if (keyHash === undefined) { - keyHash = hash(key); - } - var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var bit = 1 << keyHashFrag; - var bitmap = this.bitmap; - var exists = (bitmap & bit) !== 0; - - if (!exists && value === NOT_SET) { - return this; - } - - var idx = popCount(bitmap & (bit - 1)); - var nodes = this.nodes; - var node = exists ? nodes[idx] : undefined; - var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter); - - if (newNode === node) { - return this; - } - - if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) { - return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode); - } - - if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) { - return nodes[idx ^ 1]; - } - - if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) { - return newNode; - } - - var isEditable = ownerID && ownerID === this.ownerID; - var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit; - var newNodes = exists ? newNode ? - setIn(nodes, idx, newNode, isEditable) : - spliceOut(nodes, idx, isEditable) : - spliceIn(nodes, idx, newNode, isEditable); - - if (isEditable) { - this.bitmap = newBitmap; - this.nodes = newNodes; - return this; - } - - return new BitmapIndexedNode(ownerID, newBitmap, newNodes); - }; - - - - - function HashArrayMapNode(ownerID, count, nodes) { - this.ownerID = ownerID; - this.count = count; - this.nodes = nodes; - } - - HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) { - if (keyHash === undefined) { - keyHash = hash(key); - } - var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var node = this.nodes[idx]; - return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue; - }; - - HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - if (keyHash === undefined) { - keyHash = hash(key); - } - var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var removed = value === NOT_SET; - var nodes = this.nodes; - var node = nodes[idx]; - - if (removed && !node) { - return this; - } - - var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter); - if (newNode === node) { - return this; - } - - var newCount = this.count; - if (!node) { - newCount++; - } else if (!newNode) { - newCount--; - if (newCount < MIN_HASH_ARRAY_MAP_SIZE) { - return packNodes(ownerID, nodes, newCount, idx); - } - } - - var isEditable = ownerID && ownerID === this.ownerID; - var newNodes = setIn(nodes, idx, newNode, isEditable); - - if (isEditable) { - this.count = newCount; - this.nodes = newNodes; - return this; - } - - return new HashArrayMapNode(ownerID, newCount, newNodes); - }; - - - - - function HashCollisionNode(ownerID, keyHash, entries) { - this.ownerID = ownerID; - this.keyHash = keyHash; - this.entries = entries; - } - - HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) { - var entries = this.entries; - for (var ii = 0, len = entries.length; ii < len; ii++) { - if (is(key, entries[ii][0])) { - return entries[ii][1]; - } - } - return notSetValue; - }; - - HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - if (keyHash === undefined) { - keyHash = hash(key); - } - - var removed = value === NOT_SET; - - if (keyHash !== this.keyHash) { - if (removed) { - return this; - } - SetRef(didAlter); - SetRef(didChangeSize); - return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]); - } - - var entries = this.entries; - var idx = 0; - for (var len = entries.length; idx < len; idx++) { - if (is(key, entries[idx][0])) { - break; - } - } - var exists = idx < len; - - if (exists ? entries[idx][1] === value : removed) { - return this; - } - - SetRef(didAlter); - (removed || !exists) && SetRef(didChangeSize); - - if (removed && len === 2) { - return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]); - } - - var isEditable = ownerID && ownerID === this.ownerID; - var newEntries = isEditable ? entries : arrCopy(entries); - - if (exists) { - if (removed) { - idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop()); - } else { - newEntries[idx] = [key, value]; - } - } else { - newEntries.push([key, value]); - } - - if (isEditable) { - this.entries = newEntries; - return this; - } - - return new HashCollisionNode(ownerID, this.keyHash, newEntries); - }; - - - - - function ValueNode(ownerID, keyHash, entry) { - this.ownerID = ownerID; - this.keyHash = keyHash; - this.entry = entry; - } - - ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) { - return is(key, this.entry[0]) ? this.entry[1] : notSetValue; - }; - - ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - var removed = value === NOT_SET; - var keyMatch = is(key, this.entry[0]); - if (keyMatch ? value === this.entry[1] : removed) { - return this; - } - - SetRef(didAlter); - - if (removed) { - SetRef(didChangeSize); - return; // undefined - } - - if (keyMatch) { - if (ownerID && ownerID === this.ownerID) { - this.entry[1] = value; - return this; - } - return new ValueNode(ownerID, this.keyHash, [key, value]); - } - - SetRef(didChangeSize); - return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]); - }; - - - - // #pragma Iterators - - ArrayMapNode.prototype.iterate = - HashCollisionNode.prototype.iterate = function (fn, reverse) { - var entries = this.entries; - for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) { - if (fn(entries[reverse ? maxIndex - ii : ii]) === false) { - return false; - } - } - } - - BitmapIndexedNode.prototype.iterate = - HashArrayMapNode.prototype.iterate = function (fn, reverse) { - var nodes = this.nodes; - for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) { - var node = nodes[reverse ? maxIndex - ii : ii]; - if (node && node.iterate(fn, reverse) === false) { - return false; - } - } - } - - ValueNode.prototype.iterate = function (fn, reverse) { - return fn(this.entry); - } - - createClass(MapIterator, Iterator); - - function MapIterator(map, type, reverse) { - this._type = type; - this._reverse = reverse; - this._stack = map._root && mapIteratorFrame(map._root); - } - - MapIterator.prototype.next = function() { - var type = this._type; - var stack = this._stack; - while (stack) { - var node = stack.node; - var index = stack.index++; - var maxIndex; - if (node.entry) { - if (index === 0) { - return mapIteratorValue(type, node.entry); - } - } else if (node.entries) { - maxIndex = node.entries.length - 1; - if (index <= maxIndex) { - return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]); - } - } else { - maxIndex = node.nodes.length - 1; - if (index <= maxIndex) { - var subNode = node.nodes[this._reverse ? maxIndex - index : index]; - if (subNode) { - if (subNode.entry) { - return mapIteratorValue(type, subNode.entry); - } - stack = this._stack = mapIteratorFrame(subNode, stack); - } - continue; - } - } - stack = this._stack = this._stack.__prev; - } - return iteratorDone(); - }; - - - function mapIteratorValue(type, entry) { - return iteratorValue(type, entry[0], entry[1]); - } - - function mapIteratorFrame(node, prev) { - return { - node: node, - index: 0, - __prev: prev - }; - } - - function makeMap(size, root, ownerID, hash) { - var map = Object.create(MapPrototype); - map.size = size; - map._root = root; - map.__ownerID = ownerID; - map.__hash = hash; - map.__altered = false; - return map; - } - - var EMPTY_MAP; - function emptyMap() { - return EMPTY_MAP || (EMPTY_MAP = makeMap(0)); - } - - function updateMap(map, k, v) { - var newRoot; - var newSize; - if (!map._root) { - if (v === NOT_SET) { - return map; - } - newSize = 1; - newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]); - } else { - var didChangeSize = MakeRef(CHANGE_LENGTH); - var didAlter = MakeRef(DID_ALTER); - newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter); - if (!didAlter.value) { - return map; - } - newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0); - } - if (map.__ownerID) { - map.size = newSize; - map._root = newRoot; - map.__hash = undefined; - map.__altered = true; - return map; - } - return newRoot ? makeMap(newSize, newRoot) : emptyMap(); - } - - function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - if (!node) { - if (value === NOT_SET) { - return node; - } - SetRef(didAlter); - SetRef(didChangeSize); - return new ValueNode(ownerID, keyHash, [key, value]); - } - return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter); - } - - function isLeafNode(node) { - return node.constructor === ValueNode || node.constructor === HashCollisionNode; - } - - function mergeIntoNode(node, ownerID, shift, keyHash, entry) { - if (node.keyHash === keyHash) { - return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]); - } - - var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK; - var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - - var newNode; - var nodes = idx1 === idx2 ? - [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] : - ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]); - - return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes); - } - - function createNodes(ownerID, entries, key, value) { - if (!ownerID) { - ownerID = new OwnerID(); - } - var node = new ValueNode(ownerID, hash(key), [key, value]); - for (var ii = 0; ii < entries.length; ii++) { - var entry = entries[ii]; - node = node.update(ownerID, 0, undefined, entry[0], entry[1]); - } - return node; - } - - function packNodes(ownerID, nodes, count, excluding) { - var bitmap = 0; - var packedII = 0; - var packedNodes = new Array(count); - for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) { - var node = nodes[ii]; - if (node !== undefined && ii !== excluding) { - bitmap |= bit; - packedNodes[packedII++] = node; - } - } - return new BitmapIndexedNode(ownerID, bitmap, packedNodes); - } - - function expandNodes(ownerID, nodes, bitmap, including, node) { - var count = 0; - var expandedNodes = new Array(SIZE); - for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) { - expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined; - } - expandedNodes[including] = node; - return new HashArrayMapNode(ownerID, count + 1, expandedNodes); - } - - function mergeIntoMapWith(map, merger, iterables) { - var iters = []; - for (var ii = 0; ii < iterables.length; ii++) { - var value = iterables[ii]; - var iter = KeyedIterable(value); - if (!isIterable(value)) { - iter = iter.map(function(v ) {return fromJS(v)}); - } - iters.push(iter); - } - return mergeIntoCollectionWith(map, merger, iters); - } - - function deepMerger(existing, value, key) { - return existing && existing.mergeDeep && isIterable(value) ? - existing.mergeDeep(value) : - is(existing, value) ? existing : value; - } - - function deepMergerWith(merger) { - return function(existing, value, key) { - if (existing && existing.mergeDeepWith && isIterable(value)) { - return existing.mergeDeepWith(merger, value); - } - var nextValue = merger(existing, value, key); - return is(existing, nextValue) ? existing : nextValue; - }; - } - - function mergeIntoCollectionWith(collection, merger, iters) { - iters = iters.filter(function(x ) {return x.size !== 0}); - if (iters.length === 0) { - return collection; - } - if (collection.size === 0 && !collection.__ownerID && iters.length === 1) { - return collection.constructor(iters[0]); - } - return collection.withMutations(function(collection ) { - var mergeIntoMap = merger ? - function(value, key) { - collection.update(key, NOT_SET, function(existing ) - {return existing === NOT_SET ? value : merger(existing, value, key)} - ); - } : - function(value, key) { - collection.set(key, value); - } - for (var ii = 0; ii < iters.length; ii++) { - iters[ii].forEach(mergeIntoMap); - } - }); - } - - function updateInDeepMap(existing, keyPathIter, notSetValue, updater) { - var isNotSet = existing === NOT_SET; - var step = keyPathIter.next(); - if (step.done) { - var existingValue = isNotSet ? notSetValue : existing; - var newValue = updater(existingValue); - return newValue === existingValue ? existing : newValue; - } - invariant( - isNotSet || (existing && existing.set), - 'invalid keyPath' - ); - var key = step.value; - var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET); - var nextUpdated = updateInDeepMap( - nextExisting, - keyPathIter, - notSetValue, - updater - ); - return nextUpdated === nextExisting ? existing : - nextUpdated === NOT_SET ? existing.remove(key) : - (isNotSet ? emptyMap() : existing).set(key, nextUpdated); - } - - function popCount(x) { - x = x - ((x >> 1) & 0x55555555); - x = (x & 0x33333333) + ((x >> 2) & 0x33333333); - x = (x + (x >> 4)) & 0x0f0f0f0f; - x = x + (x >> 8); - x = x + (x >> 16); - return x & 0x7f; - } - - function setIn(array, idx, val, canEdit) { - var newArray = canEdit ? array : arrCopy(array); - newArray[idx] = val; - return newArray; - } - - function spliceIn(array, idx, val, canEdit) { - var newLen = array.length + 1; - if (canEdit && idx + 1 === newLen) { - array[idx] = val; - return array; - } - var newArray = new Array(newLen); - var after = 0; - for (var ii = 0; ii < newLen; ii++) { - if (ii === idx) { - newArray[ii] = val; - after = -1; - } else { - newArray[ii] = array[ii + after]; - } - } - return newArray; - } - - function spliceOut(array, idx, canEdit) { - var newLen = array.length - 1; - if (canEdit && idx === newLen) { - array.pop(); - return array; - } - var newArray = new Array(newLen); - var after = 0; - for (var ii = 0; ii < newLen; ii++) { - if (ii === idx) { - after = 1; - } - newArray[ii] = array[ii + after]; - } - return newArray; - } - - var MAX_ARRAY_MAP_SIZE = SIZE / 4; - var MAX_BITMAP_INDEXED_SIZE = SIZE / 2; - var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4; - - createClass(List, IndexedCollection); - - // @pragma Construction - - function List(value) { - var empty = emptyList(); - if (value === null || value === undefined) { - return empty; - } - if (isList(value)) { - return value; - } - var iter = IndexedIterable(value); - var size = iter.size; - if (size === 0) { - return empty; - } - assertNotInfinite(size); - if (size > 0 && size < SIZE) { - return makeList(0, size, SHIFT, null, new VNode(iter.toArray())); - } - return empty.withMutations(function(list ) { - list.setSize(size); - iter.forEach(function(v, i) {return list.set(i, v)}); - }); - } - - List.of = function(/*...values*/) { - return this(arguments); - }; - - List.prototype.toString = function() { - return this.__toString('List [', ']'); - }; - - // @pragma Access - - List.prototype.get = function(index, notSetValue) { - index = wrapIndex(this, index); - if (index >= 0 && index < this.size) { - index += this._origin; - var node = listNodeFor(this, index); - return node && node.array[index & MASK]; - } - return notSetValue; - }; - - // @pragma Modification - - List.prototype.set = function(index, value) { - return updateList(this, index, value); - }; - - List.prototype.remove = function(index) { - return !this.has(index) ? this : - index === 0 ? this.shift() : - index === this.size - 1 ? this.pop() : - this.splice(index, 1); - }; - - List.prototype.insert = function(index, value) { - return this.splice(index, 0, value); - }; - - List.prototype.clear = function() { - if (this.size === 0) { - return this; - } - if (this.__ownerID) { - this.size = this._origin = this._capacity = 0; - this._level = SHIFT; - this._root = this._tail = null; - this.__hash = undefined; - this.__altered = true; - return this; - } - return emptyList(); - }; - - List.prototype.push = function(/*...values*/) { - var values = arguments; - var oldSize = this.size; - return this.withMutations(function(list ) { - setListBounds(list, 0, oldSize + values.length); - for (var ii = 0; ii < values.length; ii++) { - list.set(oldSize + ii, values[ii]); - } - }); - }; - - List.prototype.pop = function() { - return setListBounds(this, 0, -1); - }; - - List.prototype.unshift = function(/*...values*/) { - var values = arguments; - return this.withMutations(function(list ) { - setListBounds(list, -values.length); - for (var ii = 0; ii < values.length; ii++) { - list.set(ii, values[ii]); - } - }); - }; - - List.prototype.shift = function() { - return setListBounds(this, 1); - }; - - // @pragma Composition - - List.prototype.merge = function(/*...iters*/) { - return mergeIntoListWith(this, undefined, arguments); - }; - - List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoListWith(this, merger, iters); - }; - - List.prototype.mergeDeep = function(/*...iters*/) { - return mergeIntoListWith(this, deepMerger, arguments); - }; - - List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoListWith(this, deepMergerWith(merger), iters); - }; - - List.prototype.setSize = function(size) { - return setListBounds(this, 0, size); - }; - - // @pragma Iteration - - List.prototype.slice = function(begin, end) { - var size = this.size; - if (wholeSlice(begin, end, size)) { - return this; - } - return setListBounds( - this, - resolveBegin(begin, size), - resolveEnd(end, size) - ); - }; - - List.prototype.__iterator = function(type, reverse) { - var index = 0; - var values = iterateList(this, reverse); - return new Iterator(function() { - var value = values(); - return value === DONE ? - iteratorDone() : - iteratorValue(type, index++, value); - }); - }; - - List.prototype.__iterate = function(fn, reverse) { - var index = 0; - var values = iterateList(this, reverse); - var value; - while ((value = values()) !== DONE) { - if (fn(value, index++, this) === false) { - break; - } - } - return index; - }; - - List.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - if (!ownerID) { - this.__ownerID = ownerID; - return this; - } - return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash); - }; - - - function isList(maybeList) { - return !!(maybeList && maybeList[IS_LIST_SENTINEL]); - } - - List.isList = isList; - - var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@'; - - var ListPrototype = List.prototype; - ListPrototype[IS_LIST_SENTINEL] = true; - ListPrototype[DELETE] = ListPrototype.remove; - ListPrototype.setIn = MapPrototype.setIn; - ListPrototype.deleteIn = - ListPrototype.removeIn = MapPrototype.removeIn; - ListPrototype.update = MapPrototype.update; - ListPrototype.updateIn = MapPrototype.updateIn; - ListPrototype.mergeIn = MapPrototype.mergeIn; - ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; - ListPrototype.withMutations = MapPrototype.withMutations; - ListPrototype.asMutable = MapPrototype.asMutable; - ListPrototype.asImmutable = MapPrototype.asImmutable; - ListPrototype.wasAltered = MapPrototype.wasAltered; - - - - function VNode(array, ownerID) { - this.array = array; - this.ownerID = ownerID; - } - - // TODO: seems like these methods are very similar - - VNode.prototype.removeBefore = function(ownerID, level, index) { - if (index === level ? 1 << level : 0 || this.array.length === 0) { - return this; - } - var originIndex = (index >>> level) & MASK; - if (originIndex >= this.array.length) { - return new VNode([], ownerID); - } - var removingFirst = originIndex === 0; - var newChild; - if (level > 0) { - var oldChild = this.array[originIndex]; - newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index); - if (newChild === oldChild && removingFirst) { - return this; - } - } - if (removingFirst && !newChild) { - return this; - } - var editable = editableVNode(this, ownerID); - if (!removingFirst) { - for (var ii = 0; ii < originIndex; ii++) { - editable.array[ii] = undefined; - } - } - if (newChild) { - editable.array[originIndex] = newChild; - } - return editable; - }; - - VNode.prototype.removeAfter = function(ownerID, level, index) { - if (index === (level ? 1 << level : 0) || this.array.length === 0) { - return this; - } - var sizeIndex = ((index - 1) >>> level) & MASK; - if (sizeIndex >= this.array.length) { - return this; - } - - var newChild; - if (level > 0) { - var oldChild = this.array[sizeIndex]; - newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index); - if (newChild === oldChild && sizeIndex === this.array.length - 1) { - return this; - } - } - - var editable = editableVNode(this, ownerID); - editable.array.splice(sizeIndex + 1); - if (newChild) { - editable.array[sizeIndex] = newChild; - } - return editable; - }; - - - - var DONE = {}; - - function iterateList(list, reverse) { - var left = list._origin; - var right = list._capacity; - var tailPos = getTailOffset(right); - var tail = list._tail; - - return iterateNodeOrLeaf(list._root, list._level, 0); - - function iterateNodeOrLeaf(node, level, offset) { - return level === 0 ? - iterateLeaf(node, offset) : - iterateNode(node, level, offset); - } - - function iterateLeaf(node, offset) { - var array = offset === tailPos ? tail && tail.array : node && node.array; - var from = offset > left ? 0 : left - offset; - var to = right - offset; - if (to > SIZE) { - to = SIZE; - } - return function() { - if (from === to) { - return DONE; - } - var idx = reverse ? --to : from++; - return array && array[idx]; - }; - } - - function iterateNode(node, level, offset) { - var values; - var array = node && node.array; - var from = offset > left ? 0 : (left - offset) >> level; - var to = ((right - offset) >> level) + 1; - if (to > SIZE) { - to = SIZE; - } - return function() { - do { - if (values) { - var value = values(); - if (value !== DONE) { - return value; - } - values = null; - } - if (from === to) { - return DONE; - } - var idx = reverse ? --to : from++; - values = iterateNodeOrLeaf( - array && array[idx], level - SHIFT, offset + (idx << level) - ); - } while (true); - }; - } - } - - function makeList(origin, capacity, level, root, tail, ownerID, hash) { - var list = Object.create(ListPrototype); - list.size = capacity - origin; - list._origin = origin; - list._capacity = capacity; - list._level = level; - list._root = root; - list._tail = tail; - list.__ownerID = ownerID; - list.__hash = hash; - list.__altered = false; - return list; - } - - var EMPTY_LIST; - function emptyList() { - return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT)); - } - - function updateList(list, index, value) { - index = wrapIndex(list, index); - - if (index !== index) { - return list; - } - - if (index >= list.size || index < 0) { - return list.withMutations(function(list ) { - index < 0 ? - setListBounds(list, index).set(0, value) : - setListBounds(list, 0, index + 1).set(index, value) - }); - } - - index += list._origin; - - var newTail = list._tail; - var newRoot = list._root; - var didAlter = MakeRef(DID_ALTER); - if (index >= getTailOffset(list._capacity)) { - newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter); - } else { - newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter); - } - - if (!didAlter.value) { - return list; - } - - if (list.__ownerID) { - list._root = newRoot; - list._tail = newTail; - list.__hash = undefined; - list.__altered = true; - return list; - } - return makeList(list._origin, list._capacity, list._level, newRoot, newTail); - } - - function updateVNode(node, ownerID, level, index, value, didAlter) { - var idx = (index >>> level) & MASK; - var nodeHas = node && idx < node.array.length; - if (!nodeHas && value === undefined) { - return node; - } - - var newNode; - - if (level > 0) { - var lowerNode = node && node.array[idx]; - var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter); - if (newLowerNode === lowerNode) { - return node; - } - newNode = editableVNode(node, ownerID); - newNode.array[idx] = newLowerNode; - return newNode; - } - - if (nodeHas && node.array[idx] === value) { - return node; - } - - SetRef(didAlter); - - newNode = editableVNode(node, ownerID); - if (value === undefined && idx === newNode.array.length - 1) { - newNode.array.pop(); - } else { - newNode.array[idx] = value; - } - return newNode; - } - - function editableVNode(node, ownerID) { - if (ownerID && node && ownerID === node.ownerID) { - return node; - } - return new VNode(node ? node.array.slice() : [], ownerID); - } - - function listNodeFor(list, rawIndex) { - if (rawIndex >= getTailOffset(list._capacity)) { - return list._tail; - } - if (rawIndex < 1 << (list._level + SHIFT)) { - var node = list._root; - var level = list._level; - while (node && level > 0) { - node = node.array[(rawIndex >>> level) & MASK]; - level -= SHIFT; - } - return node; - } - } - - function setListBounds(list, begin, end) { - // Sanitize begin & end using this shorthand for ToInt32(argument) - // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 - if (begin !== undefined) { - begin = begin | 0; - } - if (end !== undefined) { - end = end | 0; - } - var owner = list.__ownerID || new OwnerID(); - var oldOrigin = list._origin; - var oldCapacity = list._capacity; - var newOrigin = oldOrigin + begin; - var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end; - if (newOrigin === oldOrigin && newCapacity === oldCapacity) { - return list; - } - - // If it's going to end after it starts, it's empty. - if (newOrigin >= newCapacity) { - return list.clear(); - } - - var newLevel = list._level; - var newRoot = list._root; - - // New origin might need creating a higher root. - var offsetShift = 0; - while (newOrigin + offsetShift < 0) { - newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner); - newLevel += SHIFT; - offsetShift += 1 << newLevel; - } - if (offsetShift) { - newOrigin += offsetShift; - oldOrigin += offsetShift; - newCapacity += offsetShift; - oldCapacity += offsetShift; - } - - var oldTailOffset = getTailOffset(oldCapacity); - var newTailOffset = getTailOffset(newCapacity); - - // New size might need creating a higher root. - while (newTailOffset >= 1 << (newLevel + SHIFT)) { - newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner); - newLevel += SHIFT; - } - - // Locate or create the new tail. - var oldTail = list._tail; - var newTail = newTailOffset < oldTailOffset ? - listNodeFor(list, newCapacity - 1) : - newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail; - - // Merge Tail into tree. - if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) { - newRoot = editableVNode(newRoot, owner); - var node = newRoot; - for (var level = newLevel; level > SHIFT; level -= SHIFT) { - var idx = (oldTailOffset >>> level) & MASK; - node = node.array[idx] = editableVNode(node.array[idx], owner); - } - node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail; - } - - // If the size has been reduced, there's a chance the tail needs to be trimmed. - if (newCapacity < oldCapacity) { - newTail = newTail && newTail.removeAfter(owner, 0, newCapacity); - } - - // If the new origin is within the tail, then we do not need a root. - if (newOrigin >= newTailOffset) { - newOrigin -= newTailOffset; - newCapacity -= newTailOffset; - newLevel = SHIFT; - newRoot = null; - newTail = newTail && newTail.removeBefore(owner, 0, newOrigin); - - // Otherwise, if the root has been trimmed, garbage collect. - } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) { - offsetShift = 0; - - // Identify the new top root node of the subtree of the old root. - while (newRoot) { - var beginIndex = (newOrigin >>> newLevel) & MASK; - if (beginIndex !== (newTailOffset >>> newLevel) & MASK) { - break; - } - if (beginIndex) { - offsetShift += (1 << newLevel) * beginIndex; - } - newLevel -= SHIFT; - newRoot = newRoot.array[beginIndex]; - } - - // Trim the new sides of the new root. - if (newRoot && newOrigin > oldOrigin) { - newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift); - } - if (newRoot && newTailOffset < oldTailOffset) { - newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift); - } - if (offsetShift) { - newOrigin -= offsetShift; - newCapacity -= offsetShift; - } - } - - if (list.__ownerID) { - list.size = newCapacity - newOrigin; - list._origin = newOrigin; - list._capacity = newCapacity; - list._level = newLevel; - list._root = newRoot; - list._tail = newTail; - list.__hash = undefined; - list.__altered = true; - return list; - } - return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail); - } - - function mergeIntoListWith(list, merger, iterables) { - var iters = []; - var maxSize = 0; - for (var ii = 0; ii < iterables.length; ii++) { - var value = iterables[ii]; - var iter = IndexedIterable(value); - if (iter.size > maxSize) { - maxSize = iter.size; - } - if (!isIterable(value)) { - iter = iter.map(function(v ) {return fromJS(v)}); - } - iters.push(iter); - } - if (maxSize > list.size) { - list = list.setSize(maxSize); - } - return mergeIntoCollectionWith(list, merger, iters); - } - - function getTailOffset(size) { - return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT); - } - - createClass(OrderedMap, Map); - - // @pragma Construction - - function OrderedMap(value) { - return value === null || value === undefined ? emptyOrderedMap() : - isOrderedMap(value) ? value : - emptyOrderedMap().withMutations(function(map ) { - var iter = KeyedIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v, k) {return map.set(k, v)}); - }); - } - - OrderedMap.of = function(/*...values*/) { - return this(arguments); - }; - - OrderedMap.prototype.toString = function() { - return this.__toString('OrderedMap {', '}'); - }; - - // @pragma Access - - OrderedMap.prototype.get = function(k, notSetValue) { - var index = this._map.get(k); - return index !== undefined ? this._list.get(index)[1] : notSetValue; - }; - - // @pragma Modification - - OrderedMap.prototype.clear = function() { - if (this.size === 0) { - return this; - } - if (this.__ownerID) { - this.size = 0; - this._map.clear(); - this._list.clear(); - return this; - } - return emptyOrderedMap(); - }; - - OrderedMap.prototype.set = function(k, v) { - return updateOrderedMap(this, k, v); - }; - - OrderedMap.prototype.remove = function(k) { - return updateOrderedMap(this, k, NOT_SET); - }; - - OrderedMap.prototype.wasAltered = function() { - return this._map.wasAltered() || this._list.wasAltered(); - }; - - OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._list.__iterate( - function(entry ) {return entry && fn(entry[1], entry[0], this$0)}, - reverse - ); - }; - - OrderedMap.prototype.__iterator = function(type, reverse) { - return this._list.fromEntrySeq().__iterator(type, reverse); - }; - - OrderedMap.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - var newMap = this._map.__ensureOwner(ownerID); - var newList = this._list.__ensureOwner(ownerID); - if (!ownerID) { - this.__ownerID = ownerID; - this._map = newMap; - this._list = newList; - return this; - } - return makeOrderedMap(newMap, newList, ownerID, this.__hash); - }; - - - function isOrderedMap(maybeOrderedMap) { - return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap); - } - - OrderedMap.isOrderedMap = isOrderedMap; - - OrderedMap.prototype[IS_ORDERED_SENTINEL] = true; - OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove; - - - - function makeOrderedMap(map, list, ownerID, hash) { - var omap = Object.create(OrderedMap.prototype); - omap.size = map ? map.size : 0; - omap._map = map; - omap._list = list; - omap.__ownerID = ownerID; - omap.__hash = hash; - return omap; - } - - var EMPTY_ORDERED_MAP; - function emptyOrderedMap() { - return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList())); - } - - function updateOrderedMap(omap, k, v) { - var map = omap._map; - var list = omap._list; - var i = map.get(k); - var has = i !== undefined; - var newMap; - var newList; - if (v === NOT_SET) { // removed - if (!has) { - return omap; - } - if (list.size >= SIZE && list.size >= map.size * 2) { - newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx}); - newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap(); - if (omap.__ownerID) { - newMap.__ownerID = newList.__ownerID = omap.__ownerID; - } - } else { - newMap = map.remove(k); - newList = i === list.size - 1 ? list.pop() : list.set(i, undefined); - } - } else { - if (has) { - if (v === list.get(i)[1]) { - return omap; - } - newMap = map; - newList = list.set(i, [k, v]); - } else { - newMap = map.set(k, list.size); - newList = list.set(list.size, [k, v]); - } - } - if (omap.__ownerID) { - omap.size = newMap.size; - omap._map = newMap; - omap._list = newList; - omap.__hash = undefined; - return omap; - } - return makeOrderedMap(newMap, newList); - } - - createClass(ToKeyedSequence, KeyedSeq); - function ToKeyedSequence(indexed, useKeys) { - this._iter = indexed; - this._useKeys = useKeys; - this.size = indexed.size; - } - - ToKeyedSequence.prototype.get = function(key, notSetValue) { - return this._iter.get(key, notSetValue); - }; - - ToKeyedSequence.prototype.has = function(key) { - return this._iter.has(key); - }; - - ToKeyedSequence.prototype.valueSeq = function() { - return this._iter.valueSeq(); - }; - - ToKeyedSequence.prototype.reverse = function() {var this$0 = this; - var reversedSequence = reverseFactory(this, true); - if (!this._useKeys) { - reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()}; - } - return reversedSequence; - }; - - ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this; - var mappedSequence = mapFactory(this, mapper, context); - if (!this._useKeys) { - mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)}; - } - return mappedSequence; - }; - - ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - var ii; - return this._iter.__iterate( - this._useKeys ? - function(v, k) {return fn(v, k, this$0)} : - ((ii = reverse ? resolveSize(this) : 0), - function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}), - reverse - ); - }; - - ToKeyedSequence.prototype.__iterator = function(type, reverse) { - if (this._useKeys) { - return this._iter.__iterator(type, reverse); - } - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - var ii = reverse ? resolveSize(this) : 0; - return new Iterator(function() { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, reverse ? --ii : ii++, step.value, step); - }); - }; - - ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true; - - - createClass(ToIndexedSequence, IndexedSeq); - function ToIndexedSequence(iter) { - this._iter = iter; - this.size = iter.size; - } - - ToIndexedSequence.prototype.includes = function(value) { - return this._iter.includes(value); - }; - - ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - var iterations = 0; - return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse); - }; - - ToIndexedSequence.prototype.__iterator = function(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - var iterations = 0; - return new Iterator(function() { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, iterations++, step.value, step) - }); - }; - - - - createClass(ToSetSequence, SetSeq); - function ToSetSequence(iter) { - this._iter = iter; - this.size = iter.size; - } - - ToSetSequence.prototype.has = function(key) { - return this._iter.includes(key); - }; - - ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse); - }; - - ToSetSequence.prototype.__iterator = function(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - return new Iterator(function() { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, step.value, step.value, step); - }); - }; - - - - createClass(FromEntriesSequence, KeyedSeq); - function FromEntriesSequence(entries) { - this._iter = entries; - this.size = entries.size; - } - - FromEntriesSequence.prototype.entrySeq = function() { - return this._iter.toSeq(); - }; - - FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._iter.__iterate(function(entry ) { - // Check if entry exists first so array access doesn't throw for holes - // in the parent iteration. - if (entry) { - validateEntry(entry); - var indexedIterable = isIterable(entry); - return fn( - indexedIterable ? entry.get(1) : entry[1], - indexedIterable ? entry.get(0) : entry[0], - this$0 - ); - } - }, reverse); - }; - - FromEntriesSequence.prototype.__iterator = function(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - return new Iterator(function() { - while (true) { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - // Check if entry exists first so array access doesn't throw for holes - // in the parent iteration. - if (entry) { - validateEntry(entry); - var indexedIterable = isIterable(entry); - return iteratorValue( - type, - indexedIterable ? entry.get(0) : entry[0], - indexedIterable ? entry.get(1) : entry[1], - step - ); - } - } - }); - }; - - - ToIndexedSequence.prototype.cacheResult = - ToKeyedSequence.prototype.cacheResult = - ToSetSequence.prototype.cacheResult = - FromEntriesSequence.prototype.cacheResult = - cacheResultThrough; - - - function flipFactory(iterable) { - var flipSequence = makeSequence(iterable); - flipSequence._iter = iterable; - flipSequence.size = iterable.size; - flipSequence.flip = function() {return iterable}; - flipSequence.reverse = function () { - var reversedSequence = iterable.reverse.apply(this); // super.reverse() - reversedSequence.flip = function() {return iterable.reverse()}; - return reversedSequence; - }; - flipSequence.has = function(key ) {return iterable.includes(key)}; - flipSequence.includes = function(key ) {return iterable.has(key)}; - flipSequence.cacheResult = cacheResultThrough; - flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse); - } - flipSequence.__iteratorUncached = function(type, reverse) { - if (type === ITERATE_ENTRIES) { - var iterator = iterable.__iterator(type, reverse); - return new Iterator(function() { - var step = iterator.next(); - if (!step.done) { - var k = step.value[0]; - step.value[0] = step.value[1]; - step.value[1] = k; - } - return step; - }); - } - return iterable.__iterator( - type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES, - reverse - ); - } - return flipSequence; - } - - - function mapFactory(iterable, mapper, context) { - var mappedSequence = makeSequence(iterable); - mappedSequence.size = iterable.size; - mappedSequence.has = function(key ) {return iterable.has(key)}; - mappedSequence.get = function(key, notSetValue) { - var v = iterable.get(key, NOT_SET); - return v === NOT_SET ? - notSetValue : - mapper.call(context, v, key, iterable); - }; - mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - return iterable.__iterate( - function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false}, - reverse - ); - } - mappedSequence.__iteratorUncached = function (type, reverse) { - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - return new Iterator(function() { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - var key = entry[0]; - return iteratorValue( - type, - key, - mapper.call(context, entry[1], key, iterable), - step - ); - }); - } - return mappedSequence; - } - - - function reverseFactory(iterable, useKeys) { - var reversedSequence = makeSequence(iterable); - reversedSequence._iter = iterable; - reversedSequence.size = iterable.size; - reversedSequence.reverse = function() {return iterable}; - if (iterable.flip) { - reversedSequence.flip = function () { - var flipSequence = flipFactory(iterable); - flipSequence.reverse = function() {return iterable.flip()}; - return flipSequence; - }; - } - reversedSequence.get = function(key, notSetValue) - {return iterable.get(useKeys ? key : -1 - key, notSetValue)}; - reversedSequence.has = function(key ) - {return iterable.has(useKeys ? key : -1 - key)}; - reversedSequence.includes = function(value ) {return iterable.includes(value)}; - reversedSequence.cacheResult = cacheResultThrough; - reversedSequence.__iterate = function (fn, reverse) {var this$0 = this; - return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse); - }; - reversedSequence.__iterator = - function(type, reverse) {return iterable.__iterator(type, !reverse)}; - return reversedSequence; - } - - - function filterFactory(iterable, predicate, context, useKeys) { - var filterSequence = makeSequence(iterable); - if (useKeys) { - filterSequence.has = function(key ) { - var v = iterable.get(key, NOT_SET); - return v !== NOT_SET && !!predicate.call(context, v, key, iterable); - }; - filterSequence.get = function(key, notSetValue) { - var v = iterable.get(key, NOT_SET); - return v !== NOT_SET && predicate.call(context, v, key, iterable) ? - v : notSetValue; - }; - } - filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - var iterations = 0; - iterable.__iterate(function(v, k, c) { - if (predicate.call(context, v, k, c)) { - iterations++; - return fn(v, useKeys ? k : iterations - 1, this$0); - } - }, reverse); - return iterations; - }; - filterSequence.__iteratorUncached = function (type, reverse) { - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var iterations = 0; - return new Iterator(function() { - while (true) { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - var key = entry[0]; - var value = entry[1]; - if (predicate.call(context, value, key, iterable)) { - return iteratorValue(type, useKeys ? key : iterations++, value, step); - } - } - }); - } - return filterSequence; - } - - - function countByFactory(iterable, grouper, context) { - var groups = Map().asMutable(); - iterable.__iterate(function(v, k) { - groups.update( - grouper.call(context, v, k, iterable), - 0, - function(a ) {return a + 1} - ); - }); - return groups.asImmutable(); - } - - - function groupByFactory(iterable, grouper, context) { - var isKeyedIter = isKeyed(iterable); - var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable(); - iterable.__iterate(function(v, k) { - groups.update( - grouper.call(context, v, k, iterable), - function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)} - ); - }); - var coerce = iterableClass(iterable); - return groups.map(function(arr ) {return reify(iterable, coerce(arr))}); - } - - - function sliceFactory(iterable, begin, end, useKeys) { - var originalSize = iterable.size; - - // Sanitize begin & end using this shorthand for ToInt32(argument) - // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 - if (begin !== undefined) { - begin = begin | 0; - } - if (end !== undefined) { - end = end | 0; - } - - if (wholeSlice(begin, end, originalSize)) { - return iterable; - } - - var resolvedBegin = resolveBegin(begin, originalSize); - var resolvedEnd = resolveEnd(end, originalSize); - - // begin or end will be NaN if they were provided as negative numbers and - // this iterable's size is unknown. In that case, cache first so there is - // a known size and these do not resolve to NaN. - if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) { - return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys); - } - - // Note: resolvedEnd is undefined when the original sequence's length is - // unknown and this slice did not supply an end and should contain all - // elements after resolvedBegin. - // In that case, resolvedSize will be NaN and sliceSize will remain undefined. - var resolvedSize = resolvedEnd - resolvedBegin; - var sliceSize; - if (resolvedSize === resolvedSize) { - sliceSize = resolvedSize < 0 ? 0 : resolvedSize; - } - - var sliceSeq = makeSequence(iterable); - - // If iterable.size is undefined, the size of the realized sliceSeq is - // unknown at this point unless the number of items to slice is 0 - sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined; - - if (!useKeys && isSeq(iterable) && sliceSize >= 0) { - sliceSeq.get = function (index, notSetValue) { - index = wrapIndex(this, index); - return index >= 0 && index < sliceSize ? - iterable.get(index + resolvedBegin, notSetValue) : - notSetValue; - } - } - - sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this; - if (sliceSize === 0) { - return 0; - } - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var skipped = 0; - var isSkipping = true; - var iterations = 0; - iterable.__iterate(function(v, k) { - if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) { - iterations++; - return fn(v, useKeys ? k : iterations - 1, this$0) !== false && - iterations !== sliceSize; - } - }); - return iterations; - }; - - sliceSeq.__iteratorUncached = function(type, reverse) { - if (sliceSize !== 0 && reverse) { - return this.cacheResult().__iterator(type, reverse); - } - // Don't bother instantiating parent iterator if taking 0. - var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse); - var skipped = 0; - var iterations = 0; - return new Iterator(function() { - while (skipped++ < resolvedBegin) { - iterator.next(); - } - if (++iterations > sliceSize) { - return iteratorDone(); - } - var step = iterator.next(); - if (useKeys || type === ITERATE_VALUES) { - return step; - } else if (type === ITERATE_KEYS) { - return iteratorValue(type, iterations - 1, undefined, step); - } else { - return iteratorValue(type, iterations - 1, step.value[1], step); - } - }); - } - - return sliceSeq; - } - - - function takeWhileFactory(iterable, predicate, context) { - var takeSequence = makeSequence(iterable); - takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var iterations = 0; - iterable.__iterate(function(v, k, c) - {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)} - ); - return iterations; - }; - takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this; - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var iterating = true; - return new Iterator(function() { - if (!iterating) { - return iteratorDone(); - } - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - var k = entry[0]; - var v = entry[1]; - if (!predicate.call(context, v, k, this$0)) { - iterating = false; - return iteratorDone(); - } - return type === ITERATE_ENTRIES ? step : - iteratorValue(type, k, v, step); - }); - }; - return takeSequence; - } - - - function skipWhileFactory(iterable, predicate, context, useKeys) { - var skipSequence = makeSequence(iterable); - skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var isSkipping = true; - var iterations = 0; - iterable.__iterate(function(v, k, c) { - if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) { - iterations++; - return fn(v, useKeys ? k : iterations - 1, this$0); - } - }); - return iterations; - }; - skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this; - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var skipping = true; - var iterations = 0; - return new Iterator(function() { - var step, k, v; - do { - step = iterator.next(); - if (step.done) { - if (useKeys || type === ITERATE_VALUES) { - return step; - } else if (type === ITERATE_KEYS) { - return iteratorValue(type, iterations++, undefined, step); - } else { - return iteratorValue(type, iterations++, step.value[1], step); - } - } - var entry = step.value; - k = entry[0]; - v = entry[1]; - skipping && (skipping = predicate.call(context, v, k, this$0)); - } while (skipping); - return type === ITERATE_ENTRIES ? step : - iteratorValue(type, k, v, step); - }); - }; - return skipSequence; - } - - - function concatFactory(iterable, values) { - var isKeyedIterable = isKeyed(iterable); - var iters = [iterable].concat(values).map(function(v ) { - if (!isIterable(v)) { - v = isKeyedIterable ? - keyedSeqFromValue(v) : - indexedSeqFromValue(Array.isArray(v) ? v : [v]); - } else if (isKeyedIterable) { - v = KeyedIterable(v); - } - return v; - }).filter(function(v ) {return v.size !== 0}); - - if (iters.length === 0) { - return iterable; - } - - if (iters.length === 1) { - var singleton = iters[0]; - if (singleton === iterable || - isKeyedIterable && isKeyed(singleton) || - isIndexed(iterable) && isIndexed(singleton)) { - return singleton; - } - } - - var concatSeq = new ArraySeq(iters); - if (isKeyedIterable) { - concatSeq = concatSeq.toKeyedSeq(); - } else if (!isIndexed(iterable)) { - concatSeq = concatSeq.toSetSeq(); - } - concatSeq = concatSeq.flatten(true); - concatSeq.size = iters.reduce( - function(sum, seq) { - if (sum !== undefined) { - var size = seq.size; - if (size !== undefined) { - return sum + size; - } - } - }, - 0 - ); - return concatSeq; - } - - - function flattenFactory(iterable, depth, useKeys) { - var flatSequence = makeSequence(iterable); - flatSequence.__iterateUncached = function(fn, reverse) { - var iterations = 0; - var stopped = false; - function flatDeep(iter, currentDepth) {var this$0 = this; - iter.__iterate(function(v, k) { - if ((!depth || currentDepth < depth) && isIterable(v)) { - flatDeep(v, currentDepth + 1); - } else if (fn(v, useKeys ? k : iterations++, this$0) === false) { - stopped = true; - } - return !stopped; - }, reverse); - } - flatDeep(iterable, 0); - return iterations; - } - flatSequence.__iteratorUncached = function(type, reverse) { - var iterator = iterable.__iterator(type, reverse); - var stack = []; - var iterations = 0; - return new Iterator(function() { - while (iterator) { - var step = iterator.next(); - if (step.done !== false) { - iterator = stack.pop(); - continue; - } - var v = step.value; - if (type === ITERATE_ENTRIES) { - v = v[1]; - } - if ((!depth || stack.length < depth) && isIterable(v)) { - stack.push(iterator); - iterator = v.__iterator(type, reverse); - } else { - return useKeys ? step : iteratorValue(type, iterations++, v, step); - } - } - return iteratorDone(); - }); - } - return flatSequence; - } - - - function flatMapFactory(iterable, mapper, context) { - var coerce = iterableClass(iterable); - return iterable.toSeq().map( - function(v, k) {return coerce(mapper.call(context, v, k, iterable))} - ).flatten(true); - } - - - function interposeFactory(iterable, separator) { - var interposedSequence = makeSequence(iterable); - interposedSequence.size = iterable.size && iterable.size * 2 -1; - interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; - var iterations = 0; - iterable.__iterate(function(v, k) - {return (!iterations || fn(separator, iterations++, this$0) !== false) && - fn(v, iterations++, this$0) !== false}, - reverse - ); - return iterations; - }; - interposedSequence.__iteratorUncached = function(type, reverse) { - var iterator = iterable.__iterator(ITERATE_VALUES, reverse); - var iterations = 0; - var step; - return new Iterator(function() { - if (!step || iterations % 2) { - step = iterator.next(); - if (step.done) { - return step; - } - } - return iterations % 2 ? - iteratorValue(type, iterations++, separator) : - iteratorValue(type, iterations++, step.value, step); - }); - }; - return interposedSequence; - } - - - function sortFactory(iterable, comparator, mapper) { - if (!comparator) { - comparator = defaultComparator; - } - var isKeyedIterable = isKeyed(iterable); - var index = 0; - var entries = iterable.toSeq().map( - function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]} - ).toArray(); - entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach( - isKeyedIterable ? - function(v, i) { entries[i].length = 2; } : - function(v, i) { entries[i] = v[1]; } - ); - return isKeyedIterable ? KeyedSeq(entries) : - isIndexed(iterable) ? IndexedSeq(entries) : - SetSeq(entries); - } - - - function maxFactory(iterable, comparator, mapper) { - if (!comparator) { - comparator = defaultComparator; - } - if (mapper) { - var entry = iterable.toSeq() - .map(function(v, k) {return [v, mapper(v, k, iterable)]}) - .reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a}); - return entry && entry[0]; - } else { - return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a}); - } - } - - function maxCompare(comparator, a, b) { - var comp = comparator(b, a); - // b is considered the new max if the comparator declares them equal, but - // they are not equal and b is in fact a nullish value. - return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0; - } - - - function zipWithFactory(keyIter, zipper, iters) { - var zipSequence = makeSequence(keyIter); - zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min(); - // Note: this a generic base implementation of __iterate in terms of - // __iterator which may be more generically useful in the future. - zipSequence.__iterate = function(fn, reverse) { - /* generic: - var iterator = this.__iterator(ITERATE_ENTRIES, reverse); - var step; - var iterations = 0; - while (!(step = iterator.next()).done) { - iterations++; - if (fn(step.value[1], step.value[0], this) === false) { - break; - } - } - return iterations; - */ - // indexed: - var iterator = this.__iterator(ITERATE_VALUES, reverse); - var step; - var iterations = 0; - while (!(step = iterator.next()).done) { - if (fn(step.value, iterations++, this) === false) { - break; - } - } - return iterations; - }; - zipSequence.__iteratorUncached = function(type, reverse) { - var iterators = iters.map(function(i ) - {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))} - ); - var iterations = 0; - var isDone = false; - return new Iterator(function() { - var steps; - if (!isDone) { - steps = iterators.map(function(i ) {return i.next()}); - isDone = steps.some(function(s ) {return s.done}); - } - if (isDone) { - return iteratorDone(); - } - return iteratorValue( - type, - iterations++, - zipper.apply(null, steps.map(function(s ) {return s.value})) - ); - }); - }; - return zipSequence - } - - - // #pragma Helper Functions - - function reify(iter, seq) { - return isSeq(iter) ? seq : iter.constructor(seq); - } - - function validateEntry(entry) { - if (entry !== Object(entry)) { - throw new TypeError('Expected [K, V] tuple: ' + entry); - } - } - - function resolveSize(iter) { - assertNotInfinite(iter.size); - return ensureSize(iter); - } - - function iterableClass(iterable) { - return isKeyed(iterable) ? KeyedIterable : - isIndexed(iterable) ? IndexedIterable : - SetIterable; - } - - function makeSequence(iterable) { - return Object.create( - ( - isKeyed(iterable) ? KeyedSeq : - isIndexed(iterable) ? IndexedSeq : - SetSeq - ).prototype - ); - } - - function cacheResultThrough() { - if (this._iter.cacheResult) { - this._iter.cacheResult(); - this.size = this._iter.size; - return this; - } else { - return Seq.prototype.cacheResult.call(this); - } - } - - function defaultComparator(a, b) { - return a > b ? 1 : a < b ? -1 : 0; - } - - function forceIterator(keyPath) { - var iter = getIterator(keyPath); - if (!iter) { - // Array might not be iterable in this environment, so we need a fallback - // to our wrapped type. - if (!isArrayLike(keyPath)) { - throw new TypeError('Expected iterable or array-like: ' + keyPath); - } - iter = getIterator(Iterable(keyPath)); - } - return iter; - } - - createClass(Record, KeyedCollection); - - function Record(defaultValues, name) { - var hasInitialized; - - var RecordType = function Record(values) { - if (values instanceof RecordType) { - return values; - } - if (!(this instanceof RecordType)) { - return new RecordType(values); - } - if (!hasInitialized) { - hasInitialized = true; - var keys = Object.keys(defaultValues); - setProps(RecordTypePrototype, keys); - RecordTypePrototype.size = keys.length; - RecordTypePrototype._name = name; - RecordTypePrototype._keys = keys; - RecordTypePrototype._defaultValues = defaultValues; - } - this._map = Map(values); - }; - - var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype); - RecordTypePrototype.constructor = RecordType; - - return RecordType; - } - - Record.prototype.toString = function() { - return this.__toString(recordName(this) + ' {', '}'); - }; - - // @pragma Access - - Record.prototype.has = function(k) { - return this._defaultValues.hasOwnProperty(k); - }; - - Record.prototype.get = function(k, notSetValue) { - if (!this.has(k)) { - return notSetValue; - } - var defaultVal = this._defaultValues[k]; - return this._map ? this._map.get(k, defaultVal) : defaultVal; - }; - - // @pragma Modification - - Record.prototype.clear = function() { - if (this.__ownerID) { - this._map && this._map.clear(); - return this; - } - var RecordType = this.constructor; - return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap())); - }; - - Record.prototype.set = function(k, v) { - if (!this.has(k)) { - throw new Error('Cannot set unknown key "' + k + '" on ' + recordName(this)); - } - var newMap = this._map && this._map.set(k, v); - if (this.__ownerID || newMap === this._map) { - return this; - } - return makeRecord(this, newMap); - }; - - Record.prototype.remove = function(k) { - if (!this.has(k)) { - return this; - } - var newMap = this._map && this._map.remove(k); - if (this.__ownerID || newMap === this._map) { - return this; - } - return makeRecord(this, newMap); - }; - - Record.prototype.wasAltered = function() { - return this._map.wasAltered(); - }; - - Record.prototype.__iterator = function(type, reverse) {var this$0 = this; - return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse); - }; - - Record.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse); - }; - - Record.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - var newMap = this._map && this._map.__ensureOwner(ownerID); - if (!ownerID) { - this.__ownerID = ownerID; - this._map = newMap; - return this; - } - return makeRecord(this, newMap, ownerID); - }; - - - var RecordPrototype = Record.prototype; - RecordPrototype[DELETE] = RecordPrototype.remove; - RecordPrototype.deleteIn = - RecordPrototype.removeIn = MapPrototype.removeIn; - RecordPrototype.merge = MapPrototype.merge; - RecordPrototype.mergeWith = MapPrototype.mergeWith; - RecordPrototype.mergeIn = MapPrototype.mergeIn; - RecordPrototype.mergeDeep = MapPrototype.mergeDeep; - RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith; - RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; - RecordPrototype.setIn = MapPrototype.setIn; - RecordPrototype.update = MapPrototype.update; - RecordPrototype.updateIn = MapPrototype.updateIn; - RecordPrototype.withMutations = MapPrototype.withMutations; - RecordPrototype.asMutable = MapPrototype.asMutable; - RecordPrototype.asImmutable = MapPrototype.asImmutable; - - - function makeRecord(likeRecord, map, ownerID) { - var record = Object.create(Object.getPrototypeOf(likeRecord)); - record._map = map; - record.__ownerID = ownerID; - return record; - } - - function recordName(record) { - return record._name || record.constructor.name || 'Record'; - } - - function setProps(prototype, names) { - try { - names.forEach(setProp.bind(undefined, prototype)); - } catch (error) { - // Object.defineProperty failed. Probably IE8. - } - } - - function setProp(prototype, name) { - Object.defineProperty(prototype, name, { - get: function() { - return this.get(name); - }, - set: function(value) { - invariant(this.__ownerID, 'Cannot set on an immutable record.'); - this.set(name, value); - } - }); - } - - createClass(Set, SetCollection); - - // @pragma Construction - - function Set(value) { - return value === null || value === undefined ? emptySet() : - isSet(value) && !isOrdered(value) ? value : - emptySet().withMutations(function(set ) { - var iter = SetIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v ) {return set.add(v)}); - }); - } - - Set.of = function(/*...values*/) { - return this(arguments); - }; - - Set.fromKeys = function(value) { - return this(KeyedIterable(value).keySeq()); - }; - - Set.prototype.toString = function() { - return this.__toString('Set {', '}'); - }; - - // @pragma Access - - Set.prototype.has = function(value) { - return this._map.has(value); - }; - - // @pragma Modification - - Set.prototype.add = function(value) { - return updateSet(this, this._map.set(value, true)); - }; - - Set.prototype.remove = function(value) { - return updateSet(this, this._map.remove(value)); - }; - - Set.prototype.clear = function() { - return updateSet(this, this._map.clear()); - }; - - // @pragma Composition - - Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0); - iters = iters.filter(function(x ) {return x.size !== 0}); - if (iters.length === 0) { - return this; - } - if (this.size === 0 && !this.__ownerID && iters.length === 1) { - return this.constructor(iters[0]); - } - return this.withMutations(function(set ) { - for (var ii = 0; ii < iters.length; ii++) { - SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)}); - } - }); - }; - - Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0); - if (iters.length === 0) { - return this; - } - iters = iters.map(function(iter ) {return SetIterable(iter)}); - var originalSet = this; - return this.withMutations(function(set ) { - originalSet.forEach(function(value ) { - if (!iters.every(function(iter ) {return iter.includes(value)})) { - set.remove(value); - } - }); - }); - }; - - Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0); - if (iters.length === 0) { - return this; - } - iters = iters.map(function(iter ) {return SetIterable(iter)}); - var originalSet = this; - return this.withMutations(function(set ) { - originalSet.forEach(function(value ) { - if (iters.some(function(iter ) {return iter.includes(value)})) { - set.remove(value); - } - }); - }); - }; - - Set.prototype.merge = function() { - return this.union.apply(this, arguments); - }; - - Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return this.union.apply(this, iters); - }; - - Set.prototype.sort = function(comparator) { - // Late binding - return OrderedSet(sortFactory(this, comparator)); - }; - - Set.prototype.sortBy = function(mapper, comparator) { - // Late binding - return OrderedSet(sortFactory(this, comparator, mapper)); - }; - - Set.prototype.wasAltered = function() { - return this._map.wasAltered(); - }; - - Set.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse); - }; - - Set.prototype.__iterator = function(type, reverse) { - return this._map.map(function(_, k) {return k}).__iterator(type, reverse); - }; - - Set.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - var newMap = this._map.__ensureOwner(ownerID); - if (!ownerID) { - this.__ownerID = ownerID; - this._map = newMap; - return this; - } - return this.__make(newMap, ownerID); - }; - - - function isSet(maybeSet) { - return !!(maybeSet && maybeSet[IS_SET_SENTINEL]); - } - - Set.isSet = isSet; - - var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@'; - - var SetPrototype = Set.prototype; - SetPrototype[IS_SET_SENTINEL] = true; - SetPrototype[DELETE] = SetPrototype.remove; - SetPrototype.mergeDeep = SetPrototype.merge; - SetPrototype.mergeDeepWith = SetPrototype.mergeWith; - SetPrototype.withMutations = MapPrototype.withMutations; - SetPrototype.asMutable = MapPrototype.asMutable; - SetPrototype.asImmutable = MapPrototype.asImmutable; - - SetPrototype.__empty = emptySet; - SetPrototype.__make = makeSet; - - function updateSet(set, newMap) { - if (set.__ownerID) { - set.size = newMap.size; - set._map = newMap; - return set; - } - return newMap === set._map ? set : - newMap.size === 0 ? set.__empty() : - set.__make(newMap); - } - - function makeSet(map, ownerID) { - var set = Object.create(SetPrototype); - set.size = map ? map.size : 0; - set._map = map; - set.__ownerID = ownerID; - return set; - } - - var EMPTY_SET; - function emptySet() { - return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap())); - } - - createClass(OrderedSet, Set); - - // @pragma Construction - - function OrderedSet(value) { - return value === null || value === undefined ? emptyOrderedSet() : - isOrderedSet(value) ? value : - emptyOrderedSet().withMutations(function(set ) { - var iter = SetIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v ) {return set.add(v)}); - }); - } - - OrderedSet.of = function(/*...values*/) { - return this(arguments); - }; - - OrderedSet.fromKeys = function(value) { - return this(KeyedIterable(value).keySeq()); - }; - - OrderedSet.prototype.toString = function() { - return this.__toString('OrderedSet {', '}'); - }; - - - function isOrderedSet(maybeOrderedSet) { - return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet); - } - - OrderedSet.isOrderedSet = isOrderedSet; - - var OrderedSetPrototype = OrderedSet.prototype; - OrderedSetPrototype[IS_ORDERED_SENTINEL] = true; - - OrderedSetPrototype.__empty = emptyOrderedSet; - OrderedSetPrototype.__make = makeOrderedSet; - - function makeOrderedSet(map, ownerID) { - var set = Object.create(OrderedSetPrototype); - set.size = map ? map.size : 0; - set._map = map; - set.__ownerID = ownerID; - return set; - } - - var EMPTY_ORDERED_SET; - function emptyOrderedSet() { - return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap())); - } - - createClass(Stack, IndexedCollection); - - // @pragma Construction - - function Stack(value) { - return value === null || value === undefined ? emptyStack() : - isStack(value) ? value : - emptyStack().unshiftAll(value); - } - - Stack.of = function(/*...values*/) { - return this(arguments); - }; - - Stack.prototype.toString = function() { - return this.__toString('Stack [', ']'); - }; - - // @pragma Access - - Stack.prototype.get = function(index, notSetValue) { - var head = this._head; - index = wrapIndex(this, index); - while (head && index--) { - head = head.next; - } - return head ? head.value : notSetValue; - }; - - Stack.prototype.peek = function() { - return this._head && this._head.value; - }; - - // @pragma Modification - - Stack.prototype.push = function(/*...values*/) { - if (arguments.length === 0) { - return this; - } - var newSize = this.size + arguments.length; - var head = this._head; - for (var ii = arguments.length - 1; ii >= 0; ii--) { - head = { - value: arguments[ii], - next: head - }; - } - if (this.__ownerID) { - this.size = newSize; - this._head = head; - this.__hash = undefined; - this.__altered = true; - return this; - } - return makeStack(newSize, head); - }; - - Stack.prototype.pushAll = function(iter) { - iter = IndexedIterable(iter); - if (iter.size === 0) { - return this; - } - assertNotInfinite(iter.size); - var newSize = this.size; - var head = this._head; - iter.reverse().forEach(function(value ) { - newSize++; - head = { - value: value, - next: head - }; - }); - if (this.__ownerID) { - this.size = newSize; - this._head = head; - this.__hash = undefined; - this.__altered = true; - return this; - } - return makeStack(newSize, head); - }; - - Stack.prototype.pop = function() { - return this.slice(1); - }; - - Stack.prototype.unshift = function(/*...values*/) { - return this.push.apply(this, arguments); - }; - - Stack.prototype.unshiftAll = function(iter) { - return this.pushAll(iter); - }; - - Stack.prototype.shift = function() { - return this.pop.apply(this, arguments); - }; - - Stack.prototype.clear = function() { - if (this.size === 0) { - return this; - } - if (this.__ownerID) { - this.size = 0; - this._head = undefined; - this.__hash = undefined; - this.__altered = true; - return this; - } - return emptyStack(); - }; - - Stack.prototype.slice = function(begin, end) { - if (wholeSlice(begin, end, this.size)) { - return this; - } - var resolvedBegin = resolveBegin(begin, this.size); - var resolvedEnd = resolveEnd(end, this.size); - if (resolvedEnd !== this.size) { - // super.slice(begin, end); - return IndexedCollection.prototype.slice.call(this, begin, end); - } - var newSize = this.size - resolvedBegin; - var head = this._head; - while (resolvedBegin--) { - head = head.next; - } - if (this.__ownerID) { - this.size = newSize; - this._head = head; - this.__hash = undefined; - this.__altered = true; - return this; - } - return makeStack(newSize, head); - }; - - // @pragma Mutability - - Stack.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - if (!ownerID) { - this.__ownerID = ownerID; - this.__altered = false; - return this; - } - return makeStack(this.size, this._head, ownerID, this.__hash); - }; - - // @pragma Iteration - - Stack.prototype.__iterate = function(fn, reverse) { - if (reverse) { - return this.reverse().__iterate(fn); - } - var iterations = 0; - var node = this._head; - while (node) { - if (fn(node.value, iterations++, this) === false) { - break; - } - node = node.next; - } - return iterations; - }; - - Stack.prototype.__iterator = function(type, reverse) { - if (reverse) { - return this.reverse().__iterator(type); - } - var iterations = 0; - var node = this._head; - return new Iterator(function() { - if (node) { - var value = node.value; - node = node.next; - return iteratorValue(type, iterations++, value); - } - return iteratorDone(); - }); - }; - - - function isStack(maybeStack) { - return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]); - } - - Stack.isStack = isStack; - - var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@'; - - var StackPrototype = Stack.prototype; - StackPrototype[IS_STACK_SENTINEL] = true; - StackPrototype.withMutations = MapPrototype.withMutations; - StackPrototype.asMutable = MapPrototype.asMutable; - StackPrototype.asImmutable = MapPrototype.asImmutable; - StackPrototype.wasAltered = MapPrototype.wasAltered; - - - function makeStack(size, head, ownerID, hash) { - var map = Object.create(StackPrototype); - map.size = size; - map._head = head; - map.__ownerID = ownerID; - map.__hash = hash; - map.__altered = false; - return map; - } - - var EMPTY_STACK; - function emptyStack() { - return EMPTY_STACK || (EMPTY_STACK = makeStack(0)); - } - - /** - * Contributes additional methods to a constructor - */ - function mixin(ctor, methods) { - var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; }; - Object.keys(methods).forEach(keyCopier); - Object.getOwnPropertySymbols && - Object.getOwnPropertySymbols(methods).forEach(keyCopier); - return ctor; - } - - Iterable.Iterator = Iterator; - - mixin(Iterable, { - - // ### Conversion to other types - - toArray: function() { - assertNotInfinite(this.size); - var array = new Array(this.size || 0); - this.valueSeq().__iterate(function(v, i) { array[i] = v; }); - return array; - }, - - toIndexedSeq: function() { - return new ToIndexedSequence(this); - }, - - toJS: function() { - return this.toSeq().map( - function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value} - ).__toJS(); - }, - - toJSON: function() { - return this.toSeq().map( - function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value} - ).__toJS(); - }, - - toKeyedSeq: function() { - return new ToKeyedSequence(this, true); - }, - - toMap: function() { - // Use Late Binding here to solve the circular dependency. - return Map(this.toKeyedSeq()); - }, - - toObject: function() { - assertNotInfinite(this.size); - var object = {}; - this.__iterate(function(v, k) { object[k] = v; }); - return object; - }, - - toOrderedMap: function() { - // Use Late Binding here to solve the circular dependency. - return OrderedMap(this.toKeyedSeq()); - }, - - toOrderedSet: function() { - // Use Late Binding here to solve the circular dependency. - return OrderedSet(isKeyed(this) ? this.valueSeq() : this); - }, - - toSet: function() { - // Use Late Binding here to solve the circular dependency. - return Set(isKeyed(this) ? this.valueSeq() : this); - }, - - toSetSeq: function() { - return new ToSetSequence(this); - }, - - toSeq: function() { - return isIndexed(this) ? this.toIndexedSeq() : - isKeyed(this) ? this.toKeyedSeq() : - this.toSetSeq(); - }, - - toStack: function() { - // Use Late Binding here to solve the circular dependency. - return Stack(isKeyed(this) ? this.valueSeq() : this); - }, - - toList: function() { - // Use Late Binding here to solve the circular dependency. - return List(isKeyed(this) ? this.valueSeq() : this); - }, - - - // ### Common JavaScript methods and properties - - toString: function() { - return '[Iterable]'; - }, - - __toString: function(head, tail) { - if (this.size === 0) { - return head + tail; - } - return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail; - }, - - - // ### ES6 Collection methods (ES6 Array and Map) - - concat: function() {var values = SLICE$0.call(arguments, 0); - return reify(this, concatFactory(this, values)); - }, - - includes: function(searchValue) { - return this.some(function(value ) {return is(value, searchValue)}); - }, - - entries: function() { - return this.__iterator(ITERATE_ENTRIES); - }, - - every: function(predicate, context) { - assertNotInfinite(this.size); - var returnValue = true; - this.__iterate(function(v, k, c) { - if (!predicate.call(context, v, k, c)) { - returnValue = false; - return false; - } - }); - return returnValue; - }, - - filter: function(predicate, context) { - return reify(this, filterFactory(this, predicate, context, true)); - }, - - find: function(predicate, context, notSetValue) { - var entry = this.findEntry(predicate, context); - return entry ? entry[1] : notSetValue; - }, - - findEntry: function(predicate, context) { - var found; - this.__iterate(function(v, k, c) { - if (predicate.call(context, v, k, c)) { - found = [k, v]; - return false; - } - }); - return found; - }, - - findLastEntry: function(predicate, context) { - return this.toSeq().reverse().findEntry(predicate, context); - }, - - forEach: function(sideEffect, context) { - assertNotInfinite(this.size); - return this.__iterate(context ? sideEffect.bind(context) : sideEffect); - }, - - join: function(separator) { - assertNotInfinite(this.size); - separator = separator !== undefined ? '' + separator : ','; - var joined = ''; - var isFirst = true; - this.__iterate(function(v ) { - isFirst ? (isFirst = false) : (joined += separator); - joined += v !== null && v !== undefined ? v.toString() : ''; - }); - return joined; - }, - - keys: function() { - return this.__iterator(ITERATE_KEYS); - }, - - map: function(mapper, context) { - return reify(this, mapFactory(this, mapper, context)); - }, - - reduce: function(reducer, initialReduction, context) { - assertNotInfinite(this.size); - var reduction; - var useFirst; - if (arguments.length < 2) { - useFirst = true; - } else { - reduction = initialReduction; - } - this.__iterate(function(v, k, c) { - if (useFirst) { - useFirst = false; - reduction = v; - } else { - reduction = reducer.call(context, reduction, v, k, c); - } - }); - return reduction; - }, - - reduceRight: function(reducer, initialReduction, context) { - var reversed = this.toKeyedSeq().reverse(); - return reversed.reduce.apply(reversed, arguments); - }, - - reverse: function() { - return reify(this, reverseFactory(this, true)); - }, - - slice: function(begin, end) { - return reify(this, sliceFactory(this, begin, end, true)); - }, - - some: function(predicate, context) { - return !this.every(not(predicate), context); - }, - - sort: function(comparator) { - return reify(this, sortFactory(this, comparator)); - }, - - values: function() { - return this.__iterator(ITERATE_VALUES); - }, - - - // ### More sequential methods - - butLast: function() { - return this.slice(0, -1); - }, - - isEmpty: function() { - return this.size !== undefined ? this.size === 0 : !this.some(function() {return true}); - }, - - count: function(predicate, context) { - return ensureSize( - predicate ? this.toSeq().filter(predicate, context) : this - ); - }, - - countBy: function(grouper, context) { - return countByFactory(this, grouper, context); - }, - - equals: function(other) { - return deepEqual(this, other); - }, - - entrySeq: function() { - var iterable = this; - if (iterable._cache) { - // We cache as an entries array, so we can just return the cache! - return new ArraySeq(iterable._cache); - } - var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq(); - entriesSequence.fromEntrySeq = function() {return iterable.toSeq()}; - return entriesSequence; - }, - - filterNot: function(predicate, context) { - return this.filter(not(predicate), context); - }, - - findLast: function(predicate, context, notSetValue) { - return this.toKeyedSeq().reverse().find(predicate, context, notSetValue); - }, - - first: function() { - return this.find(returnTrue); - }, - - flatMap: function(mapper, context) { - return reify(this, flatMapFactory(this, mapper, context)); - }, - - flatten: function(depth) { - return reify(this, flattenFactory(this, depth, true)); - }, - - fromEntrySeq: function() { - return new FromEntriesSequence(this); - }, - - get: function(searchKey, notSetValue) { - return this.find(function(_, key) {return is(key, searchKey)}, undefined, notSetValue); - }, - - getIn: function(searchKeyPath, notSetValue) { - var nested = this; - // Note: in an ES6 environment, we would prefer: - // for (var key of searchKeyPath) { - var iter = forceIterator(searchKeyPath); - var step; - while (!(step = iter.next()).done) { - var key = step.value; - nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET; - if (nested === NOT_SET) { - return notSetValue; - } - } - return nested; - }, - - groupBy: function(grouper, context) { - return groupByFactory(this, grouper, context); - }, - - has: function(searchKey) { - return this.get(searchKey, NOT_SET) !== NOT_SET; - }, - - hasIn: function(searchKeyPath) { - return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET; - }, - - isSubset: function(iter) { - iter = typeof iter.includes === 'function' ? iter : Iterable(iter); - return this.every(function(value ) {return iter.includes(value)}); - }, - - isSuperset: function(iter) { - iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter); - return iter.isSubset(this); - }, - - keySeq: function() { - return this.toSeq().map(keyMapper).toIndexedSeq(); - }, - - last: function() { - return this.toSeq().reverse().first(); - }, - - max: function(comparator) { - return maxFactory(this, comparator); - }, - - maxBy: function(mapper, comparator) { - return maxFactory(this, comparator, mapper); - }, - - min: function(comparator) { - return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator); - }, - - minBy: function(mapper, comparator) { - return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper); - }, - - rest: function() { - return this.slice(1); - }, - - skip: function(amount) { - return this.slice(Math.max(0, amount)); - }, - - skipLast: function(amount) { - return reify(this, this.toSeq().reverse().skip(amount).reverse()); - }, - - skipWhile: function(predicate, context) { - return reify(this, skipWhileFactory(this, predicate, context, true)); - }, - - skipUntil: function(predicate, context) { - return this.skipWhile(not(predicate), context); - }, - - sortBy: function(mapper, comparator) { - return reify(this, sortFactory(this, comparator, mapper)); - }, - - take: function(amount) { - return this.slice(0, Math.max(0, amount)); - }, - - takeLast: function(amount) { - return reify(this, this.toSeq().reverse().take(amount).reverse()); - }, - - takeWhile: function(predicate, context) { - return reify(this, takeWhileFactory(this, predicate, context)); - }, - - takeUntil: function(predicate, context) { - return this.takeWhile(not(predicate), context); - }, - - valueSeq: function() { - return this.toIndexedSeq(); - }, - - - // ### Hashable Object - - hashCode: function() { - return this.__hash || (this.__hash = hashIterable(this)); - } - - - // ### Internal - - // abstract __iterate(fn, reverse) - - // abstract __iterator(type, reverse) - }); - - // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; - // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; - // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; - // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; - - var IterablePrototype = Iterable.prototype; - IterablePrototype[IS_ITERABLE_SENTINEL] = true; - IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values; - IterablePrototype.__toJS = IterablePrototype.toArray; - IterablePrototype.__toStringMapper = quoteString; - IterablePrototype.inspect = - IterablePrototype.toSource = function() { return this.toString(); }; - IterablePrototype.chain = IterablePrototype.flatMap; - IterablePrototype.contains = IterablePrototype.includes; - - // Temporary warning about using length - (function () { - try { - Object.defineProperty(IterablePrototype, 'length', { - get: function () { - if (!Iterable.noLengthWarning) { - var stack; - try { - throw new Error(); - } catch (error) { - stack = error.stack; - } - if (stack.indexOf('_wrapObject') === -1) { - console && console.warn && console.warn( - 'iterable.length has been deprecated, '+ - 'use iterable.size or iterable.count(). '+ - 'This warning will become a silent error in a future version. ' + - stack - ); - return this.size; - } - } - } - }); - } catch (e) {} - })(); - - - - mixin(KeyedIterable, { - - // ### More sequential methods - - flip: function() { - return reify(this, flipFactory(this)); - }, - - findKey: function(predicate, context) { - var entry = this.findEntry(predicate, context); - return entry && entry[0]; - }, - - findLastKey: function(predicate, context) { - return this.toSeq().reverse().findKey(predicate, context); - }, - - keyOf: function(searchValue) { - return this.findKey(function(value ) {return is(value, searchValue)}); - }, - - lastKeyOf: function(searchValue) { - return this.findLastKey(function(value ) {return is(value, searchValue)}); - }, - - mapEntries: function(mapper, context) {var this$0 = this; - var iterations = 0; - return reify(this, - this.toSeq().map( - function(v, k) {return mapper.call(context, [k, v], iterations++, this$0)} - ).fromEntrySeq() - ); - }, - - mapKeys: function(mapper, context) {var this$0 = this; - return reify(this, - this.toSeq().flip().map( - function(k, v) {return mapper.call(context, k, v, this$0)} - ).flip() - ); - } - - }); - - var KeyedIterablePrototype = KeyedIterable.prototype; - KeyedIterablePrototype[IS_KEYED_SENTINEL] = true; - KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries; - KeyedIterablePrototype.__toJS = IterablePrototype.toObject; - KeyedIterablePrototype.__toStringMapper = function(v, k) {return JSON.stringify(k) + ': ' + quoteString(v)}; - - - - mixin(IndexedIterable, { - - // ### Conversion to other types - - toKeyedSeq: function() { - return new ToKeyedSequence(this, false); - }, - - - // ### ES6 Collection methods (ES6 Array and Map) - - filter: function(predicate, context) { - return reify(this, filterFactory(this, predicate, context, false)); - }, - - findIndex: function(predicate, context) { - var entry = this.findEntry(predicate, context); - return entry ? entry[0] : -1; - }, - - indexOf: function(searchValue) { - var key = this.toKeyedSeq().keyOf(searchValue); - return key === undefined ? -1 : key; - }, - - lastIndexOf: function(searchValue) { - var key = this.toKeyedSeq().reverse().keyOf(searchValue); - return key === undefined ? -1 : key; - - // var index = - // return this.toSeq().reverse().indexOf(searchValue); - }, - - reverse: function() { - return reify(this, reverseFactory(this, false)); - }, - - slice: function(begin, end) { - return reify(this, sliceFactory(this, begin, end, false)); - }, - - splice: function(index, removeNum /*, ...values*/) { - var numArgs = arguments.length; - removeNum = Math.max(removeNum | 0, 0); - if (numArgs === 0 || (numArgs === 2 && !removeNum)) { - return this; - } - // If index is negative, it should resolve relative to the size of the - // collection. However size may be expensive to compute if not cached, so - // only call count() if the number is in fact negative. - index = resolveBegin(index, index < 0 ? this.count() : this.size); - var spliced = this.slice(0, index); - return reify( - this, - numArgs === 1 ? - spliced : - spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum)) - ); - }, - - - // ### More collection methods - - findLastIndex: function(predicate, context) { - var key = this.toKeyedSeq().findLastKey(predicate, context); - return key === undefined ? -1 : key; - }, - - first: function() { - return this.get(0); - }, - - flatten: function(depth) { - return reify(this, flattenFactory(this, depth, false)); - }, - - get: function(index, notSetValue) { - index = wrapIndex(this, index); - return (index < 0 || (this.size === Infinity || - (this.size !== undefined && index > this.size))) ? - notSetValue : - this.find(function(_, key) {return key === index}, undefined, notSetValue); - }, - - has: function(index) { - index = wrapIndex(this, index); - return index >= 0 && (this.size !== undefined ? - this.size === Infinity || index < this.size : - this.indexOf(index) !== -1 - ); - }, - - interpose: function(separator) { - return reify(this, interposeFactory(this, separator)); - }, - - interleave: function(/*...iterables*/) { - var iterables = [this].concat(arrCopy(arguments)); - var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables); - var interleaved = zipped.flatten(true); - if (zipped.size) { - interleaved.size = zipped.size * iterables.length; - } - return reify(this, interleaved); - }, - - last: function() { - return this.get(-1); - }, - - skipWhile: function(predicate, context) { - return reify(this, skipWhileFactory(this, predicate, context, false)); - }, - - zip: function(/*, ...iterables */) { - var iterables = [this].concat(arrCopy(arguments)); - return reify(this, zipWithFactory(this, defaultZipper, iterables)); - }, - - zipWith: function(zipper/*, ...iterables */) { - var iterables = arrCopy(arguments); - iterables[0] = this; - return reify(this, zipWithFactory(this, zipper, iterables)); - } - - }); - - IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true; - IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true; - - - - mixin(SetIterable, { - - // ### ES6 Collection methods (ES6 Array and Map) - - get: function(value, notSetValue) { - return this.has(value) ? value : notSetValue; - }, - - includes: function(value) { - return this.has(value); - }, - - - // ### More sequential methods - - keySeq: function() { - return this.valueSeq(); - } - - }); - - SetIterable.prototype.has = IterablePrototype.includes; - - - // Mixin subclasses - - mixin(KeyedSeq, KeyedIterable.prototype); - mixin(IndexedSeq, IndexedIterable.prototype); - mixin(SetSeq, SetIterable.prototype); - - mixin(KeyedCollection, KeyedIterable.prototype); - mixin(IndexedCollection, IndexedIterable.prototype); - mixin(SetCollection, SetIterable.prototype); - - - // #pragma Helper functions - - function keyMapper(v, k) { - return k; - } - - function entryMapper(v, k) { - return [k, v]; - } - - function not(predicate) { - return function() { - return !predicate.apply(this, arguments); - } - } - - function neg(predicate) { - return function() { - return -predicate.apply(this, arguments); - } - } - - function quoteString(value) { - return typeof value === 'string' ? JSON.stringify(value) : value; - } - - function defaultZipper() { - return arrCopy(arguments); - } - - function defaultNegComparator(a, b) { - return a < b ? 1 : a > b ? -1 : 0; - } - - function hashIterable(iterable) { - if (iterable.size === Infinity) { - return 0; - } - var ordered = isOrdered(iterable); - var keyed = isKeyed(iterable); - var h = ordered ? 1 : 0; - var size = iterable.__iterate( - keyed ? - ordered ? - function(v, k) { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } : - function(v, k) { h = h + hashMerge(hash(v), hash(k)) | 0; } : - ordered ? - function(v ) { h = 31 * h + hash(v) | 0; } : - function(v ) { h = h + hash(v) | 0; } - ); - return murmurHashOfSize(size, h); - } - - function murmurHashOfSize(size, h) { - h = imul(h, 0xCC9E2D51); - h = imul(h << 15 | h >>> -15, 0x1B873593); - h = imul(h << 13 | h >>> -13, 5); - h = (h + 0xE6546B64 | 0) ^ size; - h = imul(h ^ h >>> 16, 0x85EBCA6B); - h = imul(h ^ h >>> 13, 0xC2B2AE35); - h = smi(h ^ h >>> 16); - return h; - } - - function hashMerge(a, b) { - return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int - } - - var Immutable = { - - Iterable: Iterable, - - Seq: Seq, - Collection: Collection, - Map: Map, - OrderedMap: OrderedMap, - List: List, - Stack: Stack, - Set: Set, - OrderedSet: OrderedSet, - - Record: Record, - Range: Range, - Repeat: Repeat, - - is: is, - fromJS: fromJS - - }; - - return Immutable; - - })); - -/***/ }, -/* 230 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - // jQuery no parents filter - _jquery2.default.expr[':']['noparents'] = _jquery2.default.expr.createPseudo(function (text) { - return function (element) { - return (0, _jquery2.default)(element).parents(text).length < 1; - }; - }); - -/***/ }, -/* 231 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Instance = undefined; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - var _toastr = __webpack_require__(194); - - var _toastr2 = _interopRequireDefault(_toastr); - - var _gravConfig = __webpack_require__(198); - - var _state = __webpack_require__(228); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Form = function () { - function Form(form) { - var _this = this; - - _classCallCheck(this, Form); - - this.form = (0, _jquery2.default)(form); - if (!this.form.length || this.form.prop('tagName').toLowerCase() !== 'form') { - return; - } - - this.form.on('submit', function (event) { - if (_state.Instance.equals()) { - event.preventDefault(); - _toastr2.default.info(_gravConfig.translations.PLUGIN_ADMIN.NOTHING_TO_SAVE); - } - }); - - this._attachShortcuts(); - this._attachToggleables(); - this._attachDisabledFields(); - - this.observer = new MutationObserver(this.addedNodes); - this.form.each(function (index, form) { - return _this.observer.observe(form, { subtree: true, childList: true }); - }); - } - - _createClass(Form, [{ - key: '_attachShortcuts', - value: function _attachShortcuts() { - // CTRL + S / CMD + S - shortcut for [Save] when available - var saveTask = (0, _jquery2.default)('[name="task"][value="save"]').filter(function (index, element) { - element = (0, _jquery2.default)(element); - return !element.parents('.remodal-overlay').length; - }); - - if (saveTask.length) { - (0, _jquery2.default)(window).on('keydown', function (event) { - var key = String.fromCharCode(event.which).toLowerCase(); - if ((event.ctrlKey || event.metaKey) && key === 's') { - event.preventDefault(); - saveTask.click(); - } - }); - } - } - }, { - key: '_attachToggleables', - value: function _attachToggleables() { - var query = '[data-grav-field="toggleable"] input[type="checkbox"]'; - - this.form.on('change', query, function (event) { - var toggle = (0, _jquery2.default)(event.target); - var enabled = toggle.is(':checked'); - var parent = toggle.parents('.form-field'); - var label = parent.find('label.toggleable'); - var fields = parent.find('.form-data'); - var inputs = fields.find('input, select, textarea'); - - label.add(fields).css('opacity', enabled ? '' : 0.7); - inputs.map(function (index, input) { - var isSelectize = input.selectize; - input = (0, _jquery2.default)(input); - - if (isSelectize) { - isSelectize[enabled ? 'enable' : 'disable'](); - } else { - input.prop('disabled', !enabled); - } - }); - }); - - this.form.find(query).trigger('change'); - } - }, { - key: '_attachDisabledFields', - value: function _attachDisabledFields() { - var prefix = '.form-field-toggleable .form-data'; - var query = []; - - ['input', 'select', 'label[for]', 'textarea', '.selectize-control'].forEach(function (item) { - query.push(prefix + ' ' + item); - }); - - this.form.on('mousedown', query.join(', '), function (event) { - var target = (0, _jquery2.default)(event.target); - var input = target; - var isFor = input.prop('for'); - var isSelectize = (input.hasClass('selectize-control') || input.parents('.selectize-control')).length; - - if (isFor) { - input = (0, _jquery2.default)('[id="' + isFor + '"]'); - } - if (isSelectize) { - input = input.closest('.selectize-control').siblings('select[name]'); - } - - if (!input.prop('disabled')) { - return true; - } - - var toggle = input.closest('.form-field').find('[data-grav-field="toggleable"] input[type="checkbox"]'); - toggle.trigger('click'); - }); - } - }, { - key: 'addedNodes', - value: function addedNodes(mutations) { - var _this2 = this; - - mutations.forEach(function (mutation) { - if (mutation.type !== 'childList' || !mutation.addedNodes) { - return; - } - - (0, _jquery2.default)('body').trigger('mutation._grav', mutation.target, mutation, _this2); - }); - } - }]); - - return Form; - }(); - - exports.default = Form; - var Instance = exports.Instance = new Form('form#blueprints'); - -/***/ }, -/* 232 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _selectize = __webpack_require__(233); - - var _selectize2 = _interopRequireDefault(_selectize); - - var _array = __webpack_require__(234); - - var _array2 = _interopRequireDefault(_array); - - var _collections = __webpack_require__(235); - - var _collections2 = _interopRequireDefault(_collections); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - SelectizeField: { - SelectizeField: _selectize2.default, - Instance: _selectize.Instance - }, - ArrayField: { - ArrayField: _array2.default, - Instance: _array.Instance - }, - CollectionsField: { - CollectionsField: _collections2.default, - Instance: _collections.Instance - } - }; - -/***/ }, -/* 233 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Instance = undefined; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - __webpack_require__(217); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var SelectizeField = function () { - function SelectizeField() { - var _this = this; - - var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - - _classCallCheck(this, SelectizeField); - - this.options = Object.assign({}, options); - this.elements = []; - - (0, _jquery2.default)('[data-grav-selectize]').each(function (index, element) { - return _this.add(element); - }); - (0, _jquery2.default)('body').on('mutation._grav', this._onAddedNodes.bind(this)); - } - - _createClass(SelectizeField, [{ - key: 'add', - value: function add(element) { - element = (0, _jquery2.default)(element); - var tag = element.prop('tagName').toLowerCase(); - var isInput = tag === 'input' || tag === 'select'; - - var data = (isInput ? element.closest('[data-grav-selectize]') : element).data('grav-selectize') || {}; - var field = isInput ? element : element.find('input, select'); - - if (!field.length || field.get(0).selectize) { - return; - } - field.selectize(data); - - this.elements.push(field.data('selectize')); - } - }, { - key: '_onAddedNodes', - value: function _onAddedNodes(event, target /* , record, instance */) { - var _this2 = this; - - var fields = (0, _jquery2.default)(target).find('select.fancy, input.fancy'); - if (!fields.length) { - return; - } - - fields.each(function (index, field) { - return _this2.add(field); - }); - } - }]); - - return SelectizeField; - }(); - - exports.default = SelectizeField; - var Instance = exports.Instance = new SelectizeField(); - -/***/ }, -/* 234 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Instance = undefined; - - var _jquery = __webpack_require__(196); - - var _jquery2 = _interopRequireDefault(_jquery); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var body = (0, _jquery2.default)('body'); - - var Template = function () { - function Template(container) { - _classCallCheck(this, Template); - - this.container = (0, _jquery2.default)(container); - - if (this.getName() === undefined) { - this.container = this.container.closest('[data-grav-array-name]'); - } - } - - _createClass(Template, [{ - key: 'getName', - value: function getName() { - return this.container.data('grav-array-name') || ''; - } - }, { - key: 'getKeyPlaceholder', - value: function getKeyPlaceholder() { - return this.container.data('grav-array-keyname') || 'Key'; - } - }, { - key: 'getValuePlaceholder', - value: function getValuePlaceholder() { - return this.container.data('grav-array-valuename') || 'Value'; - } - }, { - key: 'isValueOnly', - value: function isValueOnly() { - return this.container.find('[data-grav-array-mode="value_only"]:first').length || false; - } - }, { - key: 'shouldBeDisabled', - value: function shouldBeDisabled() { - // check for toggleables, if field is toggleable and it's not enabled, render disabled - var toggle = this.container.closest('.form-field').find('[data-grav-field="toggleable"] input[type="checkbox"]'); - return toggle.length && toggle.is(':not(:checked)'); - } - }, { - key: 'getNewRow', - value: function getNewRow() { - var tpl = ''; - - if (this.isValueOnly()) { - tpl += '\n
${error.stack}`);\n console.error(`${error.message} at ${error.stack}`);\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/utils/response.js\n **/","import toastr from 'toastr';\n\ntoastr.options.positionClass = 'toast-top-right';\ntoastr.options.preventDuplicates = true;\n\nexport default toastr;\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/utils/toastr.js\n **/","module.exports = GravAdmin;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"GravAdmin\"\n ** module id = 198\n ** module chunks = 0\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n }\n throw TypeError('Uncaught, unspecified \"error\" event.');\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/events/events.js\n ** module id = 199\n ** module chunks = 0\n **/","import { config } from 'grav-config';\nimport { userFeedbackError } from './response';\n\nclass KeepAlive {\n constructor() {\n this.active = false;\n }\n\n start() {\n let timeout = config.admin_timeout / 1.5 * 1000;\n this.timer = setInterval(() => this.fetch(), timeout);\n this.active = true;\n }\n\n stop() {\n clearInterval(this.timer);\n this.active = false;\n }\n\n fetch() {\n let data = new FormData();\n data.append('admin-nonce', config.admin_nonce);\n\n fetch(`${config.base_url_relative}/task${config.param_sep}keepAlive`, {\n credentials: 'same-origin',\n method: 'post',\n body: data\n }).catch(userFeedbackError);\n }\n}\n\nexport default new KeepAlive();\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/utils/keepalive.js\n **/","import $ from 'jquery';\nimport { config, translations } from 'grav-config';\nimport formatBytes from '../utils/formatbytes';\nimport { Instance as gpm } from '../utils/gpm';\nimport './check';\nimport './update';\n\nexport default class Updates {\n constructor(payload = {}) {\n this.setPayload(payload);\n this.task = `task${config.param_sep}`;\n }\n\n setPayload(payload = {}) {\n this.payload = payload;\n\n return this;\n }\n\n fetch(force = false) {\n gpm.fetch((response) => this.setPayload(response), force);\n\n return this;\n }\n\n maintenance(mode = 'hide') {\n let element = $('#updates [data-maintenance-update]');\n\n element[mode === 'show' ? 'fadeIn' : 'fadeOut']();\n\n if (mode === 'hide') {\n $('.badges.with-updates').removeClass('with-updates').find('.badge.updates').remove();\n }\n\n return this;\n }\n\n grav() {\n let payload = this.payload.grav;\n\n if (payload.isUpdatable) {\n let task = this.task;\n let bar = `\n \n Grav v${payload.available} ${translations.PLUGIN_ADMIN.IS_NOW_AVAILABLE}! (${translations.PLUGIN_ADMIN.CURRENT}v${payload.version})\n `;\n\n if (!payload.isSymlink) {\n bar += ``;\n } else {\n bar += ``;\n }\n\n $('[data-gpm-grav]').addClass('grav').html(`${bar}
`);\n }\n\n $('#grav-update-button').on('click', function() {\n $(this).html(`${translations.PLUGIN_ADMIN.UPDATING_PLEASE_WAIT} ${formatBytes(payload.assets['grav-update'].size)}..`);\n });\n\n return this;\n }\n\n resources() {\n if (!this.payload.resources.total) { return this.maintenance('hide'); }\n\n let map = ['plugins', 'themes'];\n let singles = ['plugin', 'theme'];\n let task = this.task;\n let { plugins, themes } = this.payload.resources;\n\n if (!this.payload.resources.total) { return this; }\n\n [plugins, themes].forEach(function(resources, index) {\n if (!resources || Array.isArray(resources)) { return; }\n let length = Object.keys(resources).length;\n let type = map[index];\n\n // sidebar\n $(`#admin-menu a[href$=\"/${map[index]}\"]`)\n .find('.badges')\n .addClass('with-updates')\n .find('.badge.updates').text(length);\n\n // update all\n let title = type.charAt(0).toUpperCase() + type.substr(1).toLowerCase();\n let updateAll = $(`.grav-update.${type}`);\n updateAll.html(`\n\n \n ${length} ${translations.PLUGIN_ADMIN.OF_YOUR} ${type} ${translations.PLUGIN_ADMIN.HAVE_AN_UPDATE_AVAILABLE}\n ${translations.PLUGIN_ADMIN.UPDATE} All ${title}\n
\n `);\n\n Object.keys(resources).forEach(function(item) {\n // listing page\n let element = $(`[data-gpm-${singles[index]}=\"${item}\"] .gpm-name`);\n let url = element.find('a');\n\n if (type === 'plugins' && !element.find('.badge.update').length) {\n element.append(`${translations.PLUGIN_ADMIN.UPDATE_AVAILABLE}!`);\n } else if (type === 'themes') {\n element.append(``);\n }\n\n // details page\n let details = $(`.grav-update.${singles[index]}`);\n if (details.length) {\n details.html(`\n\n \n v${resources[item].available} ${translations.PLUGIN_ADMIN.OF_THIS} ${singles[index]} ${translations.PLUGIN_ADMIN.IS_NOW_AVAILABLE}!\n ${translations.PLUGIN_ADMIN.UPDATE} ${singles[index].charAt(0).toUpperCase() + singles[index].substr(1).toLowerCase()}\n
\n `);\n }\n });\n });\n }\n}\n\nlet Instance = new Updates();\nexport { Instance };\n\n// automatically refresh UI for updates (graph, sidebar, plugin/themes pages) after every fetch\ngpm.on('fetched', (response, raw) => {\n Instance.setPayload(response.payload || {});\n Instance.grav().resources();\n});\n\nif (config.enable_auto_updates_check === '1') {\n gpm.fetch();\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/updates/index.js\n **/","const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\nexport default function formatBytes(bytes, decimals) {\n if (bytes === 0) return '0 Byte';\n\n let k = 1000;\n let value = Math.floor(Math.log(bytes) / Math.log(k));\n let decimal = decimals + 1 || 3;\n\n return (bytes / Math.pow(k, value)).toPrecision(decimal) + ' ' + sizes[value];\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/utils/formatbytes.js\n **/","import $ from 'jquery';\nimport { Instance as gpm } from '../utils/gpm';\nimport { translations } from 'grav-config';\nimport toastr from '../utils/toastr';\n\n// Check for updates trigger\n$('[data-gpm-checkupdates]').on('click', function() {\n let element = $(this);\n element.find('i').addClass('fa-spin');\n\n gpm.fetch((response) => {\n element.find('i').removeClass('fa-spin');\n let payload = response.payload;\n\n if (!payload) { return; }\n if (!payload.grav.isUpdatable && !payload.resources.total) {\n toastr.success(translations.PLUGIN_ADMIN.EVERYTHING_UP_TO_DATE);\n } else {\n var grav = payload.grav.isUpdatable ? 'Grav v' + payload.grav.available : '';\n var resources = payload.resources.total ? payload.resources.total + ' ' + translations.PLUGIN_ADMIN.UPDATES_ARE_AVAILABLE : '';\n\n if (!resources) { grav += ' ' + translations.PLUGIN_ADMIN.IS_AVAILABLE_FOR_UPDATE; }\n toastr.info(grav + (grav && resources ? ' ' + translations.PLUGIN_ADMIN.AND + ' ' : '') + resources);\n }\n }, true);\n});\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/updates/check.js\n **/","import $ from 'jquery';\nimport request from '../utils/request';\n\n// Dashboard update and Grav update\n$('body').on('click', '[data-maintenance-update]', function() {\n let element = $(this);\n let url = element.data('maintenanceUpdate');\n\n element.attr('disabled', 'disabled').find('> .fa').removeClass('fa-cloud-download').addClass('fa-refresh fa-spin');\n\n request(url, (response) => {\n if (response.type === 'updategrav') {\n $('[data-gpm-grav]').remove();\n $('#footer .grav-version').html(response.version);\n }\n\n element.removeAttr('disabled').find('> .fa').removeClass('fa-refresh fa-spin').addClass('fa-cloud-download');\n });\n});\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/updates/update.js\n **/","import { parseStatus, parseJSON, userFeedback, userFeedbackError } from './response';\nimport { config } from 'grav-config';\n\nlet raw;\nlet request = function(url, options = {}, callback = () => true) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n\n if (options.method && options.method === 'post' && options.body) {\n let data = new FormData();\n\n options.body = Object.assign({ 'admin-nonce': config.admin_nonce }, options.body);\n Object.keys(options.body).map((key) => data.append(key, options.body[key]));\n options.body = data;\n }\n\n options = Object.assign({\n credentials: 'same-origin',\n headers: {\n 'Accept': 'application/json'\n }\n }, options);\n\n return fetch(url, options)\n .then((response) => {\n raw = response;\n return response;\n })\n .then(parseStatus)\n .then(parseJSON)\n .then(userFeedback)\n .then((response) => callback(response, raw))\n .catch(userFeedbackError);\n};\n\nexport default request;\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/utils/request.js\n **/","import Chart, { UpdatesChart, Instances } from './chart';\nimport { Instance as Cache } from './cache';\nimport './backup';\n\nexport default {\n Chart: {\n Chart,\n UpdatesChart,\n Instances\n },\n Cache\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/dashboard/index.js\n **/","import $ from 'jquery';\nimport chartist from 'chartist';\nimport { translations } from 'grav-config';\nimport { Instance as gpm } from '../utils/gpm';\nimport { Instance as updates } from '../updates';\n\nlet isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\n\nexport const defaults = {\n data: {\n series: [100, 0]\n },\n options: {\n Pie: {\n donut: true,\n donutWidth: 10,\n startAngle: 0,\n total: 100,\n showLabel: false,\n height: 150,\n chartPadding: !isFirefox ? 10 : 25\n },\n Bar: {\n height: 164,\n chartPadding: !isFirefox ? 5 : 25,\n\n axisX: {\n showGrid: false,\n labelOffset: {\n x: 0,\n y: 5\n }\n },\n axisY: {\n offset: 15,\n showLabel: true,\n showGrid: true,\n labelOffset: {\n x: 5,\n y: 5\n },\n scaleMinSpace: 20\n }\n }\n }\n};\n\nexport default class Chart {\n constructor(element, options = {}, data = {}) {\n this.element = $(element) || [];\n if (!this.element[0]) { return; }\n\n let type = (this.element.data('chart-type') || 'pie').toLowerCase();\n this.type = type.charAt(0).toUpperCase() + type.substr(1).toLowerCase();\n\n options = Object.assign({}, defaults.options[this.type], options);\n data = Object.assign({}, defaults.data, data);\n Object.assign(this, {\n options,\n data\n });\n this.chart = chartist[this.type](this.element.find('.ct-chart')[0], this.data, this.options);\n }\n\n updateData(data) {\n Object.assign(this.data, data);\n this.chart.update(this.data);\n }\n};\n\nexport class UpdatesChart extends Chart {\n constructor(element, options = {}, data = {}) {\n super(element, options, data);\n\n this.chart.on('draw', (data) => this.draw(data));\n\n gpm.on('fetched', (response) => {\n let payload = response.payload.grav;\n let missing = (response.payload.resources.total + (payload.isUpdatable ? 1 : 0)) * 100 / (response.payload.installed + (payload.isUpdatable ? 1 : 0));\n let updated = 100 - missing;\n\n this.updateData({ series: [updated, missing] });\n\n if (response.payload.resources.total) {\n updates.maintenance('show');\n }\n });\n }\n\n draw(data) {\n if (data.index) { return; }\n\n let notice = translations.PLUGIN_ADMIN[data.value === 100 ? 'FULLY_UPDATED' : 'UPDATES_AVAILABLE'];\n this.element.find('.numeric span').text(`${Math.round(data.value)}%`);\n this.element.find('.js__updates-available-description').html(notice);\n this.element.find('.hidden').removeClass('hidden');\n }\n\n updateData(data) {\n super.updateData(data);\n\n // missing updates\n if (this.data.series[0] < 100) {\n this.element.closest('#updates').find('[data-maintenance-update]').fadeIn();\n }\n }\n}\n\nlet charts = {};\n\n$('[data-chart-name]').each(function() {\n let element = $(this);\n let name = element.data('chart-name') || '';\n let options = element.data('chart-options') || {};\n let data = element.data('chart-data') || {};\n\n if (name === 'updates') {\n charts[name] = new UpdatesChart(element, options, data);\n } else {\n charts[name] = new Chart(element, options, data);\n }\n});\n\nexport let Instances = charts;\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/dashboard/chart.js\n **/","import $ from 'jquery';\nimport { config } from 'grav-config';\nimport request from '../utils/request';\n\nconst getUrl = (type = '') => {\n if (type) {\n type = `cleartype:${type}/`;\n }\n\n return `${config.base_url_relative}/cache.json/task:clearCache/${type}admin-nonce:${config.admin_nonce}`;\n};\n\nexport default class Cache {\n constructor() {\n this.element = $('[data-clear-cache]');\n $('body').on('click', '[data-clear-cache]', (event) => this.clear(event, event.target));\n }\n\n clear(event, element) {\n let type = '';\n\n if (event && event.preventDefault) { event.preventDefault(); }\n if (typeof event === 'string') { type = event; }\n\n element = element ? $(element) : $(`[data-clear-cache-type=\"${type}\"]`);\n type = type || $(element).data('clear-cache-type') || '';\n let url = element.data('clearCache') || getUrl(event);\n\n this.disable();\n\n request(url, () => this.enable());\n }\n\n enable() {\n this.element\n .removeAttr('disabled')\n .find('> .fa').removeClass('fa-refresh fa-spin').addClass('fa-trash');\n }\n\n disable() {\n this.element\n .attr('disabled', 'disabled')\n .find('> .fa').removeClass('fa-trash').addClass('fa-refresh fa-spin');\n }\n}\n\nlet Instance = new Cache();\n\nexport { Instance };\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/dashboard/cache.js\n **/","import $ from 'jquery';\nimport { translations } from 'grav-config';\nimport request from '../utils/request';\nimport { Instances as Charts } from './chart';\n\n$('[data-ajax*=\"task:backup\"]').on('click', function() {\n let element = $(this);\n let url = element.data('ajax');\n\n element\n .attr('disabled', 'disabled')\n .find('> .fa').removeClass('fa-database').addClass('fa-spin fa-refresh');\n\n request(url, (/* response */) => {\n if (Charts && Charts.backups) {\n Charts.backups.updateData({ series: [0, 100] });\n Charts.backups.element.find('.numeric').html(`0 ${translations.PLUGIN_ADMIN.DAYS.toLowerCase()}`);\n }\n\n element\n .removeAttr('disabled')\n .find('> .fa').removeClass('fa-spin fa-refresh').addClass('fa-database');\n });\n});\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/dashboard/backup.js\n **/","import $ from 'jquery';\nimport Sortable from 'sortablejs';\nimport PageFilters, { Instance as PageFiltersInstance } from './filter';\nimport './page';\n\n// Pages Ordering\nlet Ordering = null;\nlet orderingElement = $('#ordering');\nif (orderingElement.length) {\n Ordering = new Sortable(orderingElement.get(0), {\n filter: '.ignore',\n onUpdate: function(event) {\n let item = $(event.item);\n let index = orderingElement.children().index(item) + 1;\n $('[data-order]').val(index);\n }\n });\n}\n\nexport default {\n Ordering,\n PageFilters: {\n PageFilters,\n Instance: PageFiltersInstance\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/pages/index.js\n **/","import $ from 'jquery';\nimport { config } from 'grav-config';\nimport request from '../utils/request';\nimport debounce from 'debounce';\nimport { Instance as pagesTree } from './tree';\nimport 'selectize';\n\n/* @formatter:off */\n/* eslint-disable */\nconst options = [\n { flag: 'Modular', key: 'Modular', cat: 'mode' },\n { flag: 'Visible', key: 'Visible', cat: 'mode' },\n { flag: 'Routable', key: 'Routable', cat: 'mode' },\n { flag: 'Published', key: 'Published', cat: 'mode' },\n { flag: 'Non-Modular', key: 'NonModular', cat: 'mode' },\n { flag: 'Non-Visible', key: 'NonVisible', cat: 'mode' },\n { flag: 'Non-Routable', key: 'NonRoutable', cat: 'mode' },\n { flag: 'Non-Published', key: 'NonPublished', cat: 'mode' }\n];\n/* @formatter:on */\n/* eslint-enable */\n\nexport default class PagesFilter {\n constructor(filters, search) {\n this.filters = $(filters);\n this.search = $(search);\n this.options = options;\n this.tree = pagesTree;\n\n if (!this.filters.length || !this.search.length) { return; }\n\n this.labels = this.filters.data('filter-labels');\n\n this.search.on('input', debounce(() => this.filter(), 250));\n this.filters.on('change', () => this.filter());\n\n this._initSelectize();\n }\n\n filter(value) {\n let data = { flags: '', query: '' };\n\n if (typeof value === 'object') {\n Object.assign(data, value);\n }\n if (typeof value === 'string') {\n data.query = value;\n }\n if (typeof value === 'undefined') {\n data.flags = this.filters.val();\n data.query = this.search.val();\n }\n\n if (!Object.keys(data).filter((key) => data[key] !== '').length) {\n this.resetValues();\n return;\n }\n\n data.flags = data.flags.replace(/(\\s{1,})?,(\\s{1,})?/g, ',');\n this.setValues({ flags: data.flags, query: data.query }, 'silent');\n\n request(`${config.base_url_relative}/pages-filter.json/task${config.param_sep}filterPages`, {\n method: 'post',\n body: data\n }, (response) => {\n this.refreshDOM(response);\n });\n }\n\n refreshDOM(response) {\n let items = $('[data-nav-id]');\n\n if (!response) {\n items.removeClass('search-match').show();\n this.tree.restore();\n\n return;\n }\n\n items.removeClass('search-match').hide();\n\n response.results.forEach((page) => {\n let match = items.filter(`[data-nav-id=\"${page}\"]`).addClass('search-match').show();\n match.parents('[data-nav-id]').addClass('search-match').show();\n\n this.tree.expand(page, 'no-store');\n });\n }\n\n setValues({ flags = '', query = ''}, silent) {\n let flagsArray = flags.replace(/(\\s{1,})?,(\\s{1,})?/g, ',').split(',');\n if (this.filters.val() !== flags) { this.filters[0].selectize.setValue(flagsArray, silent); }\n if (this.search.val() !== query) { this.search.val(query); }\n }\n\n resetValues() {\n this.setValues('', 'silent');\n this.refreshDOM();\n }\n\n _initSelectize() {\n let extras = {\n type: this.filters.data('filter-types') || {},\n access: this.filters.data('filter-access-levels') || {}\n };\n\n Object.keys(extras).forEach((cat) => {\n Object.keys(extras[cat]).forEach((key) => {\n this.options.push({\n cat,\n key,\n flag: extras[cat][key]\n });\n });\n });\n\n this.filters.selectize({\n maxItems: null,\n valueField: 'key',\n labelField: 'flag',\n searchField: ['flag', 'key'],\n options: this.options,\n optgroups: this.labels,\n optgroupField: 'cat',\n optgroupLabelField: 'name',\n optgroupValueField: 'id',\n optgroupOrder: this.labels.map((item) => item.id),\n plugins: ['optgroup_columns']\n });\n }\n}\n\nlet Instance = new PagesFilter('input[name=\"page-filter\"]', 'input[name=\"page-search\"]');\nexport { Instance };\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/pages/filter.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar now = require('date-now');\n\n/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing.\n *\n * @source underscore.js\n * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/\n * @param {Function} function to wrap\n * @param {Number} timeout in ms (`100`)\n * @param {Boolean} whether to execute at the beginning (`false`)\n * @api public\n */\n\nmodule.exports = function debounce(func, wait, immediate){\n var timeout, args, context, timestamp, result;\n if (null == wait) wait = 100;\n\n function later() {\n var last = now() - timestamp;\n\n if (last < wait && last > 0) {\n timeout = setTimeout(later, wait - last);\n } else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n }\n }\n };\n\n return function debounced() {\n context = this;\n args = arguments;\n timestamp = now();\n var callNow = immediate && !timeout;\n if (!timeout) timeout = setTimeout(later, wait);\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n\n return result;\n };\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/debounce/index.js\n ** module id = 214\n ** module chunks = 0\n **/","module.exports = Date.now || now\n\nfunction now() {\n return new Date().getTime()\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/date-now/index.js\n ** module id = 215\n ** module chunks = 0\n **/","import $ from 'jquery';\n\nconst sessionKey = 'grav:admin:pages';\n\nif (!sessionStorage.getItem(sessionKey)) {\n sessionStorage.setItem(sessionKey, '{}');\n}\n\nexport default class PagesTree {\n constructor(elements) {\n this.elements = $(elements);\n this.session = JSON.parse(sessionStorage.getItem(sessionKey));\n\n if (!this.elements.length) { return; }\n\n this.restore();\n\n this.elements.find('.page-icon').on('click', (event) => this.toggle(event.target));\n\n $('[data-page-toggleall]').on('click', (event) => {\n let element = $(event.target).closest('[data-page-toggleall]');\n let action = element.data('page-toggleall');\n\n this[action]();\n });\n }\n\n toggle(elements, dontStore = false) {\n if (typeof elements === 'string') {\n elements = $(`[data-nav-id=\"${elements}\"]`).find('[data-toggle=\"children\"]');\n }\n\n elements = $(elements || this.elements);\n elements.each((index, element) => {\n element = $(element);\n let state = this.getState(element.closest('[data-toggle=\"children\"]'));\n this[state.isOpen ? 'collapse' : 'expand'](state.id, dontStore);\n });\n }\n\n collapse(elements, dontStore = false) {\n if (typeof elements === 'string') {\n elements = $(`[data-nav-id=\"${elements}\"]`).find('[data-toggle=\"children\"]');\n }\n\n elements = $(elements || this.elements);\n elements.each((index, element) => {\n element = $(element);\n let state = this.getState(element);\n\n if (state.isOpen) {\n state.children.hide();\n state.icon.removeClass('children-open').addClass('children-closed');\n if (!dontStore) { delete this.session[state.id]; }\n }\n });\n\n if (!dontStore) { this.save(); }\n }\n\n expand(elements, dontStore = false) {\n if (typeof elements === 'string') {\n let element = $(`[data-nav-id=\"${elements}\"]`);\n let parents = element.parents('[data-nav-id]');\n\n // loop back through parents, we don't want to expand an hidden child\n if (parents.length) {\n parents = parents.find('[data-toggle=\"children\"]:first');\n parents = parents.add(element.find('[data-toggle=\"children\"]:first'));\n return this.expand(parents, dontStore);\n }\n\n elements = element.find('[data-toggle=\"children\"]:first');\n }\n\n elements = $(elements || this.elements);\n elements.each((index, element) => {\n element = $(element);\n let state = this.getState(element);\n\n if (!state.isOpen) {\n state.children.show();\n state.icon.removeClass('children-closed').addClass('children-open');\n if (!dontStore) { this.session[state.id] = 1; }\n }\n });\n\n if (!dontStore) { this.save(); }\n }\n\n restore() {\n this.collapse(null, true);\n\n Object.keys(this.session).forEach((key) => {\n this.expand(key, 'no-store');\n });\n }\n\n save() {\n return sessionStorage.setItem(sessionKey, JSON.stringify(this.session));\n }\n\n getState(element) {\n element = $(element);\n\n return {\n id: element.closest('[data-nav-id]').data('nav-id'),\n children: element.closest('li.page-item').find('ul:first'),\n icon: element.find('.page-icon'),\n get isOpen() { return this.icon.hasClass('children-open'); }\n };\n }\n}\n\nlet Instance = new PagesTree('[data-toggle=\"children\"]');\nexport { Instance };\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/pages/tree.js\n **/","import $ from 'jquery';\nimport './add';\nimport './move';\nimport './delete';\nimport './media';\n\nconst switcher = $('input[type=\"radio\"][name=\"mode-switch\"]');\n\nif (switcher) {\n let link = switcher.closest(':checked').data('leave-url');\n let fakeLink = $(``);\n\n switcher.parent().append(fakeLink);\n\n switcher.siblings('label').on('mousedown touchdown', (event) => {\n event.preventDefault();\n\n // let remodal = $.remodal.lookup[$('[data-remodal-id=\"changes\"]').data('remodal')];\n let confirm = $('[data-remodal-id=\"changes\"] [data-leave-action=\"continue\"]');\n\n confirm.one('click', () => {\n $(window).on('beforeunload._grav');\n fakeLink.off('click._grav');\n\n $(event.target).trigger('click');\n });\n\n fakeLink.trigger('click._grav');\n });\n\n switcher.on('change', (event) => {\n let radio = $(event.target);\n link = radio.data('leave-url');\n\n setTimeout(() => fakeLink.attr('href', link).get(0).click(), 5);\n });\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/pages/page/index.js\n **/","import $ from 'jquery';\n\nlet custom = false;\nlet folder = $('input[name=\"folder\"]');\nlet title = $('input[name=\"title\"]');\n\ntitle.on('input focus blur', () => {\n if (custom) { return true; }\n\n let slug = $.slugify(title.val());\n folder.val(slug);\n});\n\nfolder.on('input', () => {\n let input = folder.get(0);\n let value = folder.val();\n let selection = {\n start: input.selectionStart,\n end: input.selectionEnd\n };\n\n value = value.toLowerCase().replace(/\\s/g, '-').replace(/[^a-z0-9_\\-]/g, '');\n folder.val(value);\n custom = !!value;\n\n // restore cursor position\n input.setSelectionRange(selection.start, selection.end);\n\n});\n\nfolder.on('focus blur', () => title.trigger('input'));\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/pages/page/add.js\n **/","import $ from 'jquery';\n\n$('[data-page-move] button[name=\"task\"][value=\"save\"]').on('click', function() {\n let route = $('form#blueprints:first select[name=\"route\"]');\n let moveTo = $('[data-page-move] select').val();\n\n if (route.length && route.val() !== moveTo) {\n let selectize = route.data('selectize');\n route.val(moveTo);\n\n if (selectize) selectize.setValue(moveTo);\n }\n});\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/pages/page/move.js\n **/","import $ from 'jquery';\n\n$('[data-remodal-target=\"delete\"]').on('click', function() {\n let confirm = $('[data-remodal-id=\"delete\"] [data-delete-action]');\n let link = $(this).data('delete-url');\n\n confirm.data('delete-action', link);\n});\n\n$('[data-delete-action]').on('click', function() {\n let remodal = $.remodal.lookup[$('[data-remodal-id=\"delete\"]').data('remodal')];\n\n window.location.href = $(this).data('delete-action');\n remodal.close();\n});\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/pages/page/delete.js\n **/","import $ from 'jquery';\nimport Dropzone from 'dropzone';\nimport request from '../../utils/request';\nimport { config, translations } from 'grav-config';\n\nDropzone.autoDiscover = false;\nDropzone.options.gravPageDropzone = {};\nDropzone.confirm = (question, accepted, rejected) => {\n let doc = $(document);\n let modalSelector = '[data-remodal-id=\"delete-media\"]';\n\n let removeEvents = () => {\n doc.off('confirmation', modalSelector, accept);\n doc.off('cancellation', modalSelector, reject);\n };\n\n let accept = () => {\n accepted && accepted();\n removeEvents();\n };\n\n let reject = () => {\n rejected && rejected();\n removeEvents();\n };\n\n $.remodal.lookup[$(modalSelector).data('remodal')].open();\n doc.on('confirmation', modalSelector, accept);\n doc.on('cancellation', modalSelector, reject);\n};\n\nconst DropzoneMediaConfig = {\n createImageThumbnails: { thumbnailWidth: 150 },\n addRemoveLinks: false,\n dictRemoveFileConfirmation: '[placeholder]',\n previewTemplate: `\n `.trim()\n};\n\nexport default class PageMedia {\n constructor({form = '[data-media-url]', container = '#grav-dropzone', options = {}} = {}) {\n this.form = $(form);\n this.container = $(container);\n if (!this.form.length || !this.container.length) { return; }\n\n this.options = Object.assign({}, DropzoneMediaConfig, {\n url: `${this.form.data('media-url')}/task${config.param_sep}addmedia`,\n acceptedFiles: this.form.data('media-types')\n }, options);\n\n this.dropzone = new Dropzone(container, this.options);\n this.dropzone.on('complete', this.onDropzoneComplete.bind(this));\n this.dropzone.on('success', this.onDropzoneSuccess.bind(this));\n this.dropzone.on('removedfile', this.onDropzoneRemovedFile.bind(this));\n this.dropzone.on('sending', this.onDropzoneSending.bind(this));\n this.dropzone.on('error', this.onDropzoneError.bind(this));\n\n this.fetchMedia();\n }\n\n fetchMedia() {\n let url = `${this.form.data('media-url')}/task${config.param_sep}listmedia/admin-nonce${config.param_sep}${config.admin_nonce}`;\n\n request(url, (response) => {\n let results = response.results;\n\n Object.keys(results).forEach((name) => {\n let data = results[name];\n let mock = { name, size: data.size, accepted: true, extras: data };\n\n this.dropzone.files.push(mock);\n this.dropzone.options.addedfile.call(this.dropzone, mock);\n\n if (name.match(/\\.(jpg|jpeg|png|gif)$/i)) {\n this.dropzone.options.thumbnail.call(this.dropzone, mock, data.url);\n }\n });\n\n this.container.find('.dz-preview').prop('draggable', 'true');\n });\n }\n\n onDropzoneSending(file, xhr, formData) {\n formData.append('admin-nonce', config.admin_nonce);\n }\n\n onDropzoneSuccess(file, response, xhr) {\n return this.handleError({\n file,\n data: response,\n mode: 'removeFile',\n msg: `${translations.PLUGIN_ADMIN.FILE_ERROR_UPLOAD} ${file.name}
\n${response.message}`\n });\n }\n\n onDropzoneComplete(file) {\n if (!file.accepted) {\n let data = {\n status: 'error',\n message: `${translations.PLUGIN_ADMIN.FILE_UNSUPPORTED}: ${file.name.match(/\\..+/).join('')}`\n };\n\n return this.handleError({\n file,\n data,\n mode: 'removeFile',\n msg: `${translations.PLUGIN_ADMIN.FILE_ERROR_ADD} ${file.name}
\n${data.message}`\n });\n }\n\n // accepted\n $('.dz-preview').prop('draggable', 'true');\n }\n\n onDropzoneRemovedFile(file, ...extra) {\n console.log(file.name, 'acc', file.accepted, 'rej', file.rejected);\n if (!file.accepted || file.rejected) { return; }\n let url = `${this.form.data('media-url')}/task${config.param_sep}delmedia`;\n\n request(url, {\n method: 'post',\n body: {\n filename: file.name\n }\n });\n }\n\n onDropzoneError(file, response, xhr) {\n let message = xhr ? response.error.message : response;\n $(file.previewElement).find('[data-dz-errormessage]').html(message);\n\n return this.handleError({\n file,\n data: { status: 'error' },\n msg: `${message}`\n });\n }\n\n handleError(options) {\n let { file, data, mode, msg } = options;\n if (data.status !== 'error' && data.status !== 'unauthorized') { return ; }\n\n switch (mode) {\n case 'addBack':\n if (file instanceof File) {\n this.dropzone.addFile.call(this.dropzone, file);\n } else {\n this.dropzone.files.push(file);\n this.dropzone.options.addedfile.call(this.dropzone, file);\n this.dropzone.options.thumbnail.call(this.dropzone, file, file.extras.url);\n }\n\n break;\n case 'removeFile':\n file.rejected = true;\n this.dropzone.removeFile.call(this.dropzone, file);\n\n break;\n default:\n }\n\n let modal = $('[data-remodal-id=\"generic\"]');\n modal.find('.error-content').html(msg);\n $.remodal.lookup[modal.data('remodal')].open();\n }\n}\n\nexport let Instance = new PageMedia();\n\n// let container = $('[data-media-url]');\n\n// if (container.length) {\n/* let URI = container.data('media-url');\n let dropzone = new Dropzone('#grav-dropzone', {\n url: `${URI}/task${config.param_sep}addmedia`,\n createImageThumbnails: { thumbnailWidth: 150 },\n addRemoveLinks: false,\n dictRemoveFileConfirmation: '[placeholder]',\n acceptedFiles: container.data('media-types'),\n previewTemplate: `\n `\n });*/\n\n /* $.get(URI + '/task{{ config.system.param_sep }}listmedia/admin-nonce{{ config.system.param_sep }}' + GravAdmin.config.admin_nonce, function(data) {\n\n $.proxy(modalError, this, {\n data: data,\n msg: 'An error occurred while trying to list files
'+data.message+''\n })();\n\n if (data.results) {\n $.each(data.results, function(filename, data){\n var mockFile = { name: filename, size: data.size, accepted: true, extras: data };\n thisDropzone.files.push(mockFile);\n thisDropzone.options.addedfile.call(thisDropzone, mockFile);\n\n if (filename.toLowerCase().match(/\\.(jpg|jpeg|png|gif)$/)) {\n thisDropzone.options.thumbnail.call(thisDropzone, mockFile, data.url);\n }\n });\n }\n\n $('.dz-preview').prop('draggable', 'true');\n });*/\n\n // console.log(dropzone);\n// }\n\n/*\n*/\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/pages/page/media.js\n **/","import FormState, { Instance as FormStateInstance } from './state';\nimport Form, { Instance as FormInstance } from './form';\n\nimport Fields from './fields';\n\nexport default {\n Form: {\n Form,\n Instance: FormInstance\n },\n Fields,\n FormState: {\n FormState,\n Instance: FormStateInstance\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/forms/index.js\n **/","import $ from 'jquery';\nimport Immutable from 'immutable';\nimport '../utils/jquery-utils';\n\nlet FormLoadState = {};\n\nconst DOMBehaviors = {\n attach() {\n this.preventUnload();\n this.preventClickAway();\n },\n\n preventUnload() {\n if ($._data(window, 'events') && ($._data(window, 'events').beforeunload || []).filter((event) => event.namespace === '_grav')) {\n return;\n }\n\n // Catch browser uri change / refresh attempt and stop it if the form state is dirty\n $(window).on('beforeunload._grav', () => {\n if (Instance.equals() === false) {\n return `You have made changes on this page that you have not yet confirmed. If you navigate away from this page you will lose your unsaved changes.`;\n }\n });\n },\n\n preventClickAway() {\n let selector = 'a[href]:not([href^=#])';\n\n if ($._data($(selector).get(0), 'events') && ($._data($(selector).get(0), 'events').click || []).filter((event) => event.namespace === '_grav')) {\n return;\n }\n\n // Prevent clicking away if the form state is dirty\n // instead, display a confirmation before continuing\n $(selector).on('click._grav', function(event) {\n let isClean = Instance.equals();\n if (isClean === null || isClean) { return true; }\n\n event.preventDefault();\n\n let destination = $(this).attr('href');\n let modal = $('[data-remodal-id=\"changes\"]');\n let lookup = $.remodal.lookup[modal.data('remodal')];\n let buttons = $('a.button', modal);\n\n let handler = function(event) {\n event.preventDefault();\n let action = $(this).data('leave-action');\n\n buttons.off('click', handler);\n lookup.close();\n\n if (action === 'continue') {\n $(window).off('beforeunload');\n window.location.href = destination;\n }\n };\n\n buttons.on('click', handler);\n lookup.open();\n });\n }\n};\n\nexport default class FormState {\n constructor(options = {\n ignore: [],\n form_id: 'blueprints'\n }) {\n this.options = options;\n this.refresh();\n\n if (!this.form || !this.fields.length) { return; }\n FormLoadState = this.collect();\n DOMBehaviors.attach();\n }\n\n refresh() {\n this.form = $(`form#${this.options.form_id}`).filter(':noparents(.remodal)');\n this.fields = $(`form#${this.options.form_id} *, [form=\"${this.options.form_id}\"]`).filter(':input:not(.no-form)').filter(':noparents(.remodal)');\n\n return this;\n }\n\n collect() {\n if (!this.form || !this.fields.length) { return; }\n\n let values = {};\n this.refresh().fields.each((index, field) => {\n field = $(field);\n let name = field.prop('name');\n let type = field.prop('type');\n let value;\n\n switch (type) {\n case 'checkbox':\n case 'radio':\n value = field.is(':checked');\n break;\n default:\n value = field.val();\n }\n\n if (name && !~this.options.ignore.indexOf(name)) {\n values[name] = value;\n }\n });\n\n return Immutable.OrderedMap(values);\n }\n\n // When the form doesn't exist or there are no fields, `equals` returns `null`\n // for this reason, _NEVER_ check with !Instance.equals(), use Instance.equals() === false\n equals() {\n if (!this.form || !this.fields.length) { return null; }\n return Immutable.is(FormLoadState, this.collect());\n }\n};\n\nexport let Instance = new FormState();\n\nexport { DOMBehaviors };\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/forms/state.js\n **/","/**\n * Copyright (c) 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n global.Immutable = factory();\n}(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice;\n\n function createClass(ctor, superClass) {\n if (superClass) {\n ctor.prototype = Object.create(superClass.prototype);\n }\n ctor.prototype.constructor = ctor;\n }\n\n function Iterable(value) {\n return isIterable(value) ? value : Seq(value);\n }\n\n\n createClass(KeyedIterable, Iterable);\n function KeyedIterable(value) {\n return isKeyed(value) ? value : KeyedSeq(value);\n }\n\n\n createClass(IndexedIterable, Iterable);\n function IndexedIterable(value) {\n return isIndexed(value) ? value : IndexedSeq(value);\n }\n\n\n createClass(SetIterable, Iterable);\n function SetIterable(value) {\n return isIterable(value) && !isAssociative(value) ? value : SetSeq(value);\n }\n\n\n\n function isIterable(maybeIterable) {\n return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]);\n }\n\n function isKeyed(maybeKeyed) {\n return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]);\n }\n\n function isIndexed(maybeIndexed) {\n return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]);\n }\n\n function isAssociative(maybeAssociative) {\n return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);\n }\n\n function isOrdered(maybeOrdered) {\n return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);\n }\n\n Iterable.isIterable = isIterable;\n Iterable.isKeyed = isKeyed;\n Iterable.isIndexed = isIndexed;\n Iterable.isAssociative = isAssociative;\n Iterable.isOrdered = isOrdered;\n\n Iterable.Keyed = KeyedIterable;\n Iterable.Indexed = IndexedIterable;\n Iterable.Set = SetIterable;\n\n\n var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n // Used for setting prototype methods that IE8 chokes on.\n var DELETE = 'delete';\n\n // Constants describing the size of trie nodes.\n var SHIFT = 5; // Resulted in best performance after ______?\n var SIZE = 1 << SHIFT;\n var MASK = SIZE - 1;\n\n // A consistent shared value representing \"not set\" which equals nothing other\n // than itself, and nothing that could be provided externally.\n var NOT_SET = {};\n\n // Boolean references, Rough equivalent of `bool &`.\n var CHANGE_LENGTH = { value: false };\n var DID_ALTER = { value: false };\n\n function MakeRef(ref) {\n ref.value = false;\n return ref;\n }\n\n function SetRef(ref) {\n ref && (ref.value = true);\n }\n\n // A function which returns a value representing an \"owner\" for transient writes\n // to tries. The return value will only ever equal itself, and will not equal\n // the return of any subsequent call of this function.\n function OwnerID() {}\n\n // http://jsperf.com/copy-array-inline\n function arrCopy(arr, offset) {\n offset = offset || 0;\n var len = Math.max(0, arr.length - offset);\n var newArr = new Array(len);\n for (var ii = 0; ii < len; ii++) {\n newArr[ii] = arr[ii + offset];\n }\n return newArr;\n }\n\n function ensureSize(iter) {\n if (iter.size === undefined) {\n iter.size = iter.__iterate(returnTrue);\n }\n return iter.size;\n }\n\n function wrapIndex(iter, index) {\n // This implements \"is array index\" which the ECMAString spec defines as:\n //\n // A String property name P is an array index if and only if\n // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal\n // to 2^32−1.\n //\n // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects\n if (typeof index !== 'number') {\n var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32\n if ('' + uint32Index !== index || uint32Index === 4294967295) {\n return NaN;\n }\n index = uint32Index;\n }\n return index < 0 ? ensureSize(iter) + index : index;\n }\n\n function returnTrue() {\n return true;\n }\n\n function wholeSlice(begin, end, size) {\n return (begin === 0 || (size !== undefined && begin <= -size)) &&\n (end === undefined || (size !== undefined && end >= size));\n }\n\n function resolveBegin(begin, size) {\n return resolveIndex(begin, size, 0);\n }\n\n function resolveEnd(end, size) {\n return resolveIndex(end, size, size);\n }\n\n function resolveIndex(index, size, defaultIndex) {\n return index === undefined ?\n defaultIndex :\n index < 0 ?\n Math.max(0, size + index) :\n size === undefined ?\n index :\n Math.min(size, index);\n }\n\n /* global Symbol */\n\n var ITERATE_KEYS = 0;\n var ITERATE_VALUES = 1;\n var ITERATE_ENTRIES = 2;\n\n var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator';\n\n var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;\n\n\n function Iterator(next) {\n this.next = next;\n }\n\n Iterator.prototype.toString = function() {\n return '[Iterator]';\n };\n\n\n Iterator.KEYS = ITERATE_KEYS;\n Iterator.VALUES = ITERATE_VALUES;\n Iterator.ENTRIES = ITERATE_ENTRIES;\n\n Iterator.prototype.inspect =\n Iterator.prototype.toSource = function () { return this.toString(); }\n Iterator.prototype[ITERATOR_SYMBOL] = function () {\n return this;\n };\n\n\n function iteratorValue(type, k, v, iteratorResult) {\n var value = type === 0 ? k : type === 1 ? v : [k, v];\n iteratorResult ? (iteratorResult.value = value) : (iteratorResult = {\n value: value, done: false\n });\n return iteratorResult;\n }\n\n function iteratorDone() {\n return { value: undefined, done: true };\n }\n\n function hasIterator(maybeIterable) {\n return !!getIteratorFn(maybeIterable);\n }\n\n function isIterator(maybeIterator) {\n return maybeIterator && typeof maybeIterator.next === 'function';\n }\n\n function getIterator(iterable) {\n var iteratorFn = getIteratorFn(iterable);\n return iteratorFn && iteratorFn.call(iterable);\n }\n\n function getIteratorFn(iterable) {\n var iteratorFn = iterable && (\n (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||\n iterable[FAUX_ITERATOR_SYMBOL]\n );\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n function isArrayLike(value) {\n return value && typeof value.length === 'number';\n }\n\n createClass(Seq, Iterable);\n function Seq(value) {\n return value === null || value === undefined ? emptySequence() :\n isIterable(value) ? value.toSeq() : seqFromValue(value);\n }\n\n Seq.of = function(/*...values*/) {\n return Seq(arguments);\n };\n\n Seq.prototype.toSeq = function() {\n return this;\n };\n\n Seq.prototype.toString = function() {\n return this.__toString('Seq {', '}');\n };\n\n Seq.prototype.cacheResult = function() {\n if (!this._cache && this.__iterateUncached) {\n this._cache = this.entrySeq().toArray();\n this.size = this._cache.length;\n }\n return this;\n };\n\n // abstract __iterateUncached(fn, reverse)\n\n Seq.prototype.__iterate = function(fn, reverse) {\n return seqIterate(this, fn, reverse, true);\n };\n\n // abstract __iteratorUncached(type, reverse)\n\n Seq.prototype.__iterator = function(type, reverse) {\n return seqIterator(this, type, reverse, true);\n };\n\n\n\n createClass(KeyedSeq, Seq);\n function KeyedSeq(value) {\n return value === null || value === undefined ?\n emptySequence().toKeyedSeq() :\n isIterable(value) ?\n (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) :\n keyedSeqFromValue(value);\n }\n\n KeyedSeq.prototype.toKeyedSeq = function() {\n return this;\n };\n\n\n\n createClass(IndexedSeq, Seq);\n function IndexedSeq(value) {\n return value === null || value === undefined ? emptySequence() :\n !isIterable(value) ? indexedSeqFromValue(value) :\n isKeyed(value) ? value.entrySeq() : value.toIndexedSeq();\n }\n\n IndexedSeq.of = function(/*...values*/) {\n return IndexedSeq(arguments);\n };\n\n IndexedSeq.prototype.toIndexedSeq = function() {\n return this;\n };\n\n IndexedSeq.prototype.toString = function() {\n return this.__toString('Seq [', ']');\n };\n\n IndexedSeq.prototype.__iterate = function(fn, reverse) {\n return seqIterate(this, fn, reverse, false);\n };\n\n IndexedSeq.prototype.__iterator = function(type, reverse) {\n return seqIterator(this, type, reverse, false);\n };\n\n\n\n createClass(SetSeq, Seq);\n function SetSeq(value) {\n return (\n value === null || value === undefined ? emptySequence() :\n !isIterable(value) ? indexedSeqFromValue(value) :\n isKeyed(value) ? value.entrySeq() : value\n ).toSetSeq();\n }\n\n SetSeq.of = function(/*...values*/) {\n return SetSeq(arguments);\n };\n\n SetSeq.prototype.toSetSeq = function() {\n return this;\n };\n\n\n\n Seq.isSeq = isSeq;\n Seq.Keyed = KeyedSeq;\n Seq.Set = SetSeq;\n Seq.Indexed = IndexedSeq;\n\n var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';\n\n Seq.prototype[IS_SEQ_SENTINEL] = true;\n\n\n\n createClass(ArraySeq, IndexedSeq);\n function ArraySeq(array) {\n this._array = array;\n this.size = array.length;\n }\n\n ArraySeq.prototype.get = function(index, notSetValue) {\n return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;\n };\n\n ArraySeq.prototype.__iterate = function(fn, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n ArraySeq.prototype.__iterator = function(type, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n var ii = 0;\n return new Iterator(function() \n {return ii > maxIndex ?\n iteratorDone() :\n iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])}\n );\n };\n\n\n\n createClass(ObjectSeq, KeyedSeq);\n function ObjectSeq(object) {\n var keys = Object.keys(object);\n this._object = object;\n this._keys = keys;\n this.size = keys.length;\n }\n\n ObjectSeq.prototype.get = function(key, notSetValue) {\n if (notSetValue !== undefined && !this.has(key)) {\n return notSetValue;\n }\n return this._object[key];\n };\n\n ObjectSeq.prototype.has = function(key) {\n return this._object.hasOwnProperty(key);\n };\n\n ObjectSeq.prototype.__iterate = function(fn, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n var key = keys[reverse ? maxIndex - ii : ii];\n if (fn(object[key], key, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n ObjectSeq.prototype.__iterator = function(type, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n var ii = 0;\n return new Iterator(function() {\n var key = keys[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ?\n iteratorDone() :\n iteratorValue(type, key, object[key]);\n });\n };\n\n ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n createClass(IterableSeq, IndexedSeq);\n function IterableSeq(iterable) {\n this._iterable = iterable;\n this.size = iterable.length || iterable.size;\n }\n\n IterableSeq.prototype.__iterateUncached = function(fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n var iterations = 0;\n if (isIterator(iterator)) {\n var step;\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n }\n return iterations;\n };\n\n IterableSeq.prototype.__iteratorUncached = function(type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n if (!isIterator(iterator)) {\n return new Iterator(iteratorDone);\n }\n var iterations = 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, iterations++, step.value);\n });\n };\n\n\n\n createClass(IteratorSeq, IndexedSeq);\n function IteratorSeq(iterator) {\n this._iterator = iterator;\n this._iteratorCache = [];\n }\n\n IteratorSeq.prototype.__iterateUncached = function(fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n while (iterations < cache.length) {\n if (fn(cache[iterations], iterations++, this) === false) {\n return iterations;\n }\n }\n var step;\n while (!(step = iterator.next()).done) {\n var val = step.value;\n cache[iterations] = val;\n if (fn(val, iterations++, this) === false) {\n break;\n }\n }\n return iterations;\n };\n\n IteratorSeq.prototype.__iteratorUncached = function(type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n return new Iterator(function() {\n if (iterations >= cache.length) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n cache[iterations] = step.value;\n }\n return iteratorValue(type, iterations, cache[iterations++]);\n });\n };\n\n\n\n\n // # pragma Helper functions\n\n function isSeq(maybeSeq) {\n return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);\n }\n\n var EMPTY_SEQ;\n\n function emptySequence() {\n return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));\n }\n\n function keyedSeqFromValue(value) {\n var seq =\n Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() :\n isIterator(value) ? new IteratorSeq(value).fromEntrySeq() :\n hasIterator(value) ? new IterableSeq(value).fromEntrySeq() :\n typeof value === 'object' ? new ObjectSeq(value) :\n undefined;\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of [k, v] entries, '+\n 'or keyed object: ' + value\n );\n }\n return seq;\n }\n\n function indexedSeqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value);\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of values: ' + value\n );\n }\n return seq;\n }\n\n function seqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value) ||\n (typeof value === 'object' && new ObjectSeq(value));\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of values, or keyed object: ' + value\n );\n }\n return seq;\n }\n\n function maybeIndexedSeqFromValue(value) {\n return (\n isArrayLike(value) ? new ArraySeq(value) :\n isIterator(value) ? new IteratorSeq(value) :\n hasIterator(value) ? new IterableSeq(value) :\n undefined\n );\n }\n\n function seqIterate(seq, fn, reverse, useKeys) {\n var cache = seq._cache;\n if (cache) {\n var maxIndex = cache.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n var entry = cache[reverse ? maxIndex - ii : ii];\n if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) {\n return ii + 1;\n }\n }\n return ii;\n }\n return seq.__iterateUncached(fn, reverse);\n }\n\n function seqIterator(seq, type, reverse, useKeys) {\n var cache = seq._cache;\n if (cache) {\n var maxIndex = cache.length - 1;\n var ii = 0;\n return new Iterator(function() {\n var entry = cache[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ?\n iteratorDone() :\n iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]);\n });\n }\n return seq.__iteratorUncached(type, reverse);\n }\n\n function fromJS(json, converter) {\n return converter ?\n fromJSWith(converter, json, '', {'': json}) :\n fromJSDefault(json);\n }\n\n function fromJSWith(converter, json, key, parentJSON) {\n if (Array.isArray(json)) {\n return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));\n }\n if (isPlainObj(json)) {\n return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));\n }\n return json;\n }\n\n function fromJSDefault(json) {\n if (Array.isArray(json)) {\n return IndexedSeq(json).map(fromJSDefault).toList();\n }\n if (isPlainObj(json)) {\n return KeyedSeq(json).map(fromJSDefault).toMap();\n }\n return json;\n }\n\n function isPlainObj(value) {\n return value && (value.constructor === Object || value.constructor === undefined);\n }\n\n /**\n * An extension of the \"same-value\" algorithm as [described for use by ES6 Map\n * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)\n *\n * NaN is considered the same as NaN, however -0 and 0 are considered the same\n * value, which is different from the algorithm described by\n * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n *\n * This is extended further to allow Objects to describe the values they\n * represent, by way of `valueOf` or `equals` (and `hashCode`).\n *\n * Note: because of this extension, the key equality of Immutable.Map and the\n * value equality of Immutable.Set will differ from ES6 Map and Set.\n *\n * ### Defining custom values\n *\n * The easiest way to describe the value an object represents is by implementing\n * `valueOf`. For example, `Date` represents a value by returning a unix\n * timestamp for `valueOf`:\n *\n * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...\n * var date2 = new Date(1234567890000);\n * date1.valueOf(); // 1234567890000\n * assert( date1 !== date2 );\n * assert( Immutable.is( date1, date2 ) );\n *\n * Note: overriding `valueOf` may have other implications if you use this object\n * where JavaScript expects a primitive, such as implicit string coercion.\n *\n * For more complex types, especially collections, implementing `valueOf` may\n * not be performant. An alternative is to implement `equals` and `hashCode`.\n *\n * `equals` takes another object, presumably of similar type, and returns true\n * if the it is equal. Equality is symmetrical, so the same result should be\n * returned if this and the argument are flipped.\n *\n * assert( a.equals(b) === b.equals(a) );\n *\n * `hashCode` returns a 32bit integer number representing the object which will\n * be used to determine how to store the value object in a Map or Set. You must\n * provide both or neither methods, one must not exist without the other.\n *\n * Also, an important relationship between these methods must be upheld: if two\n * values are equal, they *must* return the same hashCode. If the values are not\n * equal, they might have the same hashCode; this is called a hash collision,\n * and while undesirable for performance reasons, it is acceptable.\n *\n * if (a.equals(b)) {\n * assert( a.hashCode() === b.hashCode() );\n * }\n *\n * All Immutable collections implement `equals` and `hashCode`.\n *\n */\n function is(valueA, valueB) {\n if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n return true;\n }\n if (!valueA || !valueB) {\n return false;\n }\n if (typeof valueA.valueOf === 'function' &&\n typeof valueB.valueOf === 'function') {\n valueA = valueA.valueOf();\n valueB = valueB.valueOf();\n if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n return true;\n }\n if (!valueA || !valueB) {\n return false;\n }\n }\n if (typeof valueA.equals === 'function' &&\n typeof valueB.equals === 'function' &&\n valueA.equals(valueB)) {\n return true;\n }\n return false;\n }\n\n function deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (\n !isIterable(b) ||\n a.size !== undefined && b.size !== undefined && a.size !== b.size ||\n a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash ||\n isKeyed(a) !== isKeyed(b) ||\n isIndexed(a) !== isIndexed(b) ||\n isOrdered(a) !== isOrdered(b)\n ) {\n return false;\n }\n\n if (a.size === 0 && b.size === 0) {\n return true;\n }\n\n var notAssociative = !isAssociative(a);\n\n if (isOrdered(a)) {\n var entries = a.entries();\n return b.every(function(v, k) {\n var entry = entries.next().value;\n return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));\n }) && entries.next().done;\n }\n\n var flipped = false;\n\n if (a.size === undefined) {\n if (b.size === undefined) {\n if (typeof a.cacheResult === 'function') {\n a.cacheResult();\n }\n } else {\n flipped = true;\n var _ = a;\n a = b;\n b = _;\n }\n }\n\n var allEqual = true;\n var bSize = b.__iterate(function(v, k) {\n if (notAssociative ? !a.has(v) :\n flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {\n allEqual = false;\n return false;\n }\n });\n\n return allEqual && a.size === bSize;\n }\n\n createClass(Repeat, IndexedSeq);\n\n function Repeat(value, times) {\n if (!(this instanceof Repeat)) {\n return new Repeat(value, times);\n }\n this._value = value;\n this.size = times === undefined ? Infinity : Math.max(0, times);\n if (this.size === 0) {\n if (EMPTY_REPEAT) {\n return EMPTY_REPEAT;\n }\n EMPTY_REPEAT = this;\n }\n }\n\n Repeat.prototype.toString = function() {\n if (this.size === 0) {\n return 'Repeat []';\n }\n return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';\n };\n\n Repeat.prototype.get = function(index, notSetValue) {\n return this.has(index) ? this._value : notSetValue;\n };\n\n Repeat.prototype.includes = function(searchValue) {\n return is(this._value, searchValue);\n };\n\n Repeat.prototype.slice = function(begin, end) {\n var size = this.size;\n return wholeSlice(begin, end, size) ? this :\n new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size));\n };\n\n Repeat.prototype.reverse = function() {\n return this;\n };\n\n Repeat.prototype.indexOf = function(searchValue) {\n if (is(this._value, searchValue)) {\n return 0;\n }\n return -1;\n };\n\n Repeat.prototype.lastIndexOf = function(searchValue) {\n if (is(this._value, searchValue)) {\n return this.size;\n }\n return -1;\n };\n\n Repeat.prototype.__iterate = function(fn, reverse) {\n for (var ii = 0; ii < this.size; ii++) {\n if (fn(this._value, ii, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this;\n var ii = 0;\n return new Iterator(function() \n {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()}\n );\n };\n\n Repeat.prototype.equals = function(other) {\n return other instanceof Repeat ?\n is(this._value, other._value) :\n deepEqual(other);\n };\n\n\n var EMPTY_REPEAT;\n\n function invariant(condition, error) {\n if (!condition) throw new Error(error);\n }\n\n createClass(Range, IndexedSeq);\n\n function Range(start, end, step) {\n if (!(this instanceof Range)) {\n return new Range(start, end, step);\n }\n invariant(step !== 0, 'Cannot step a Range by 0');\n start = start || 0;\n if (end === undefined) {\n end = Infinity;\n }\n step = step === undefined ? 1 : Math.abs(step);\n if (end < start) {\n step = -step;\n }\n this._start = start;\n this._end = end;\n this._step = step;\n this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);\n if (this.size === 0) {\n if (EMPTY_RANGE) {\n return EMPTY_RANGE;\n }\n EMPTY_RANGE = this;\n }\n }\n\n Range.prototype.toString = function() {\n if (this.size === 0) {\n return 'Range []';\n }\n return 'Range [ ' +\n this._start + '...' + this._end +\n (this._step > 1 ? ' by ' + this._step : '') +\n ' ]';\n };\n\n Range.prototype.get = function(index, notSetValue) {\n return this.has(index) ?\n this._start + wrapIndex(this, index) * this._step :\n notSetValue;\n };\n\n Range.prototype.includes = function(searchValue) {\n var possibleIndex = (searchValue - this._start) / this._step;\n return possibleIndex >= 0 &&\n possibleIndex < this.size &&\n possibleIndex === Math.floor(possibleIndex);\n };\n\n Range.prototype.slice = function(begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n begin = resolveBegin(begin, this.size);\n end = resolveEnd(end, this.size);\n if (end <= begin) {\n return new Range(0, 0);\n }\n return new Range(this.get(begin, this._end), this.get(end, this._end), this._step);\n };\n\n Range.prototype.indexOf = function(searchValue) {\n var offsetValue = searchValue - this._start;\n if (offsetValue % this._step === 0) {\n var index = offsetValue / this._step;\n if (index >= 0 && index < this.size) {\n return index\n }\n }\n return -1;\n };\n\n Range.prototype.lastIndexOf = function(searchValue) {\n return this.indexOf(searchValue);\n };\n\n Range.prototype.__iterate = function(fn, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(value, ii, this) === false) {\n return ii + 1;\n }\n value += reverse ? -step : step;\n }\n return ii;\n };\n\n Range.prototype.__iterator = function(type, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n var ii = 0;\n return new Iterator(function() {\n var v = value;\n value += reverse ? -step : step;\n return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v);\n });\n };\n\n Range.prototype.equals = function(other) {\n return other instanceof Range ?\n this._start === other._start &&\n this._end === other._end &&\n this._step === other._step :\n deepEqual(this, other);\n };\n\n\n var EMPTY_RANGE;\n\n createClass(Collection, Iterable);\n function Collection() {\n throw TypeError('Abstract');\n }\n\n\n createClass(KeyedCollection, Collection);function KeyedCollection() {}\n\n createClass(IndexedCollection, Collection);function IndexedCollection() {}\n\n createClass(SetCollection, Collection);function SetCollection() {}\n\n\n Collection.Keyed = KeyedCollection;\n Collection.Indexed = IndexedCollection;\n Collection.Set = SetCollection;\n\n var imul =\n typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ?\n Math.imul :\n function imul(a, b) {\n a = a | 0; // int\n b = b | 0; // int\n var c = a & 0xffff;\n var d = b & 0xffff;\n // Shift by 0 fixes the sign on the high part.\n return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int\n };\n\n // v8 has an optimization for storing 31-bit signed numbers.\n // Values which have either 00 or 11 as the high order bits qualify.\n // This function drops the highest order bit in a signed number, maintaining\n // the sign bit.\n function smi(i32) {\n return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF);\n }\n\n function hash(o) {\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n if (typeof o.valueOf === 'function') {\n o = o.valueOf();\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n }\n if (o === true) {\n return 1;\n }\n var type = typeof o;\n if (type === 'number') {\n var h = o | 0;\n if (h !== o) {\n h ^= o * 0xFFFFFFFF;\n }\n while (o > 0xFFFFFFFF) {\n o /= 0xFFFFFFFF;\n h ^= o;\n }\n return smi(h);\n }\n if (type === 'string') {\n return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o);\n }\n if (typeof o.hashCode === 'function') {\n return o.hashCode();\n }\n if (type === 'object') {\n return hashJSObj(o);\n }\n if (typeof o.toString === 'function') {\n return hashString(o.toString());\n }\n throw new Error('Value type ' + type + ' cannot be hashed.');\n }\n\n function cachedHashString(string) {\n var hash = stringHashCache[string];\n if (hash === undefined) {\n hash = hashString(string);\n if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {\n STRING_HASH_CACHE_SIZE = 0;\n stringHashCache = {};\n }\n STRING_HASH_CACHE_SIZE++;\n stringHashCache[string] = hash;\n }\n return hash;\n }\n\n // http://jsperf.com/hashing-strings\n function hashString(string) {\n // This is the hash from JVM\n // The hash code for a string is computed as\n // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],\n // where s[i] is the ith character of the string and n is the length of\n // the string. We \"mod\" the result to make it between 0 (inclusive) and 2^31\n // (exclusive) by dropping high bits.\n var hash = 0;\n for (var ii = 0; ii < string.length; ii++) {\n hash = 31 * hash + string.charCodeAt(ii) | 0;\n }\n return smi(hash);\n }\n\n function hashJSObj(obj) {\n var hash;\n if (usingWeakMap) {\n hash = weakMap.get(obj);\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = obj[UID_HASH_KEY];\n if (hash !== undefined) {\n return hash;\n }\n\n if (!canDefineProperty) {\n hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];\n if (hash !== undefined) {\n return hash;\n }\n\n hash = getIENodeHash(obj);\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = ++objHashUID;\n if (objHashUID & 0x40000000) {\n objHashUID = 0;\n }\n\n if (usingWeakMap) {\n weakMap.set(obj, hash);\n } else if (isExtensible !== undefined && isExtensible(obj) === false) {\n throw new Error('Non-extensible objects are not allowed as keys.');\n } else if (canDefineProperty) {\n Object.defineProperty(obj, UID_HASH_KEY, {\n 'enumerable': false,\n 'configurable': false,\n 'writable': false,\n 'value': hash\n });\n } else if (obj.propertyIsEnumerable !== undefined &&\n obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {\n // Since we can't define a non-enumerable property on the object\n // we'll hijack one of the less-used non-enumerable properties to\n // save our hash on it. Since this is a function it will not show up in\n // `JSON.stringify` which is what we want.\n obj.propertyIsEnumerable = function() {\n return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);\n };\n obj.propertyIsEnumerable[UID_HASH_KEY] = hash;\n } else if (obj.nodeType !== undefined) {\n // At this point we couldn't get the IE `uniqueID` to use as a hash\n // and we couldn't use a non-enumerable property to exploit the\n // dontEnum bug so we simply add the `UID_HASH_KEY` on the node\n // itself.\n obj[UID_HASH_KEY] = hash;\n } else {\n throw new Error('Unable to set a non-enumerable property on object.');\n }\n\n return hash;\n }\n\n // Get references to ES5 object methods.\n var isExtensible = Object.isExtensible;\n\n // True if Object.defineProperty works as expected. IE8 fails this test.\n var canDefineProperty = (function() {\n try {\n Object.defineProperty({}, '@', {});\n return true;\n } catch (e) {\n return false;\n }\n }());\n\n // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it\n // and avoid memory leaks from the IE cloneNode bug.\n function getIENodeHash(node) {\n if (node && node.nodeType > 0) {\n switch (node.nodeType) {\n case 1: // Element\n return node.uniqueID;\n case 9: // Document\n return node.documentElement && node.documentElement.uniqueID;\n }\n }\n }\n\n // If possible, use a WeakMap.\n var usingWeakMap = typeof WeakMap === 'function';\n var weakMap;\n if (usingWeakMap) {\n weakMap = new WeakMap();\n }\n\n var objHashUID = 0;\n\n var UID_HASH_KEY = '__immutablehash__';\n if (typeof Symbol === 'function') {\n UID_HASH_KEY = Symbol(UID_HASH_KEY);\n }\n\n var STRING_HASH_CACHE_MIN_STRLEN = 16;\n var STRING_HASH_CACHE_MAX_SIZE = 255;\n var STRING_HASH_CACHE_SIZE = 0;\n var stringHashCache = {};\n\n function assertNotInfinite(size) {\n invariant(\n size !== Infinity,\n 'Cannot perform this action with an infinite size.'\n );\n }\n\n createClass(Map, KeyedCollection);\n\n // @pragma Construction\n\n function Map(value) {\n return value === null || value === undefined ? emptyMap() :\n isMap(value) && !isOrdered(value) ? value :\n emptyMap().withMutations(function(map ) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v, k) {return map.set(k, v)});\n });\n }\n\n Map.prototype.toString = function() {\n return this.__toString('Map {', '}');\n };\n\n // @pragma Access\n\n Map.prototype.get = function(k, notSetValue) {\n return this._root ?\n this._root.get(0, undefined, k, notSetValue) :\n notSetValue;\n };\n\n // @pragma Modification\n\n Map.prototype.set = function(k, v) {\n return updateMap(this, k, v);\n };\n\n Map.prototype.setIn = function(keyPath, v) {\n return this.updateIn(keyPath, NOT_SET, function() {return v});\n };\n\n Map.prototype.remove = function(k) {\n return updateMap(this, k, NOT_SET);\n };\n\n Map.prototype.deleteIn = function(keyPath) {\n return this.updateIn(keyPath, function() {return NOT_SET});\n };\n\n Map.prototype.update = function(k, notSetValue, updater) {\n return arguments.length === 1 ?\n k(this) :\n this.updateIn([k], notSetValue, updater);\n };\n\n Map.prototype.updateIn = function(keyPath, notSetValue, updater) {\n if (!updater) {\n updater = notSetValue;\n notSetValue = undefined;\n }\n var updatedValue = updateInDeepMap(\n this,\n forceIterator(keyPath),\n notSetValue,\n updater\n );\n return updatedValue === NOT_SET ? undefined : updatedValue;\n };\n\n Map.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._root = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyMap();\n };\n\n // @pragma Composition\n\n Map.prototype.merge = function(/*...iters*/) {\n return mergeIntoMapWith(this, undefined, arguments);\n };\n\n Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, merger, iters);\n };\n\n Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(\n keyPath,\n emptyMap(),\n function(m ) {return typeof m.merge === 'function' ?\n m.merge.apply(m, iters) :\n iters[iters.length - 1]}\n );\n };\n\n Map.prototype.mergeDeep = function(/*...iters*/) {\n return mergeIntoMapWith(this, deepMerger, arguments);\n };\n\n Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, deepMergerWith(merger), iters);\n };\n\n Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(\n keyPath,\n emptyMap(),\n function(m ) {return typeof m.mergeDeep === 'function' ?\n m.mergeDeep.apply(m, iters) :\n iters[iters.length - 1]}\n );\n };\n\n Map.prototype.sort = function(comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator));\n };\n\n Map.prototype.sortBy = function(mapper, comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator, mapper));\n };\n\n // @pragma Mutability\n\n Map.prototype.withMutations = function(fn) {\n var mutable = this.asMutable();\n fn(mutable);\n return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;\n };\n\n Map.prototype.asMutable = function() {\n return this.__ownerID ? this : this.__ensureOwner(new OwnerID());\n };\n\n Map.prototype.asImmutable = function() {\n return this.__ensureOwner();\n };\n\n Map.prototype.wasAltered = function() {\n return this.__altered;\n };\n\n Map.prototype.__iterator = function(type, reverse) {\n return new MapIterator(this, type, reverse);\n };\n\n Map.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n this._root && this._root.iterate(function(entry ) {\n iterations++;\n return fn(entry[1], entry[0], this$0);\n }, reverse);\n return iterations;\n };\n\n Map.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeMap(this.size, this._root, ownerID, this.__hash);\n };\n\n\n function isMap(maybeMap) {\n return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);\n }\n\n Map.isMap = isMap;\n\n var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';\n\n var MapPrototype = Map.prototype;\n MapPrototype[IS_MAP_SENTINEL] = true;\n MapPrototype[DELETE] = MapPrototype.remove;\n MapPrototype.removeIn = MapPrototype.deleteIn;\n\n\n // #pragma Trie Nodes\n\n\n\n function ArrayMapNode(ownerID, entries) {\n this.ownerID = ownerID;\n this.entries = entries;\n }\n\n ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n return notSetValue;\n };\n\n ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n\n var entries = this.entries;\n var idx = 0;\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && entries.length === 1) {\n return; // undefined\n }\n\n if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {\n return createNodes(ownerID, entries, key, value);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new ArrayMapNode(ownerID, newEntries);\n };\n\n\n\n\n function BitmapIndexedNode(ownerID, bitmap, nodes) {\n this.ownerID = ownerID;\n this.bitmap = bitmap;\n this.nodes = nodes;\n }\n\n BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK));\n var bitmap = this.bitmap;\n return (bitmap & bit) === 0 ? notSetValue :\n this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue);\n };\n\n BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var bit = 1 << keyHashFrag;\n var bitmap = this.bitmap;\n var exists = (bitmap & bit) !== 0;\n\n if (!exists && value === NOT_SET) {\n return this;\n }\n\n var idx = popCount(bitmap & (bit - 1));\n var nodes = this.nodes;\n var node = exists ? nodes[idx] : undefined;\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\n if (newNode === node) {\n return this;\n }\n\n if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {\n return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);\n }\n\n if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {\n return nodes[idx ^ 1];\n }\n\n if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {\n return newNode;\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;\n var newNodes = exists ? newNode ?\n setIn(nodes, idx, newNode, isEditable) :\n spliceOut(nodes, idx, isEditable) :\n spliceIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.bitmap = newBitmap;\n this.nodes = newNodes;\n return this;\n }\n\n return new BitmapIndexedNode(ownerID, newBitmap, newNodes);\n };\n\n\n\n\n function HashArrayMapNode(ownerID, count, nodes) {\n this.ownerID = ownerID;\n this.count = count;\n this.nodes = nodes;\n }\n\n HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var node = this.nodes[idx];\n return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;\n };\n\n HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var removed = value === NOT_SET;\n var nodes = this.nodes;\n var node = nodes[idx];\n\n if (removed && !node) {\n return this;\n }\n\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n if (newNode === node) {\n return this;\n }\n\n var newCount = this.count;\n if (!node) {\n newCount++;\n } else if (!newNode) {\n newCount--;\n if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {\n return packNodes(ownerID, nodes, newCount, idx);\n }\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newNodes = setIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.count = newCount;\n this.nodes = newNodes;\n return this;\n }\n\n return new HashArrayMapNode(ownerID, newCount, newNodes);\n };\n\n\n\n\n function HashCollisionNode(ownerID, keyHash, entries) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entries = entries;\n }\n\n HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n return notSetValue;\n };\n\n HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var removed = value === NOT_SET;\n\n if (keyHash !== this.keyHash) {\n if (removed) {\n return this;\n }\n SetRef(didAlter);\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);\n }\n\n var entries = this.entries;\n var idx = 0;\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && len === 2) {\n return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new HashCollisionNode(ownerID, this.keyHash, newEntries);\n };\n\n\n\n\n function ValueNode(ownerID, keyHash, entry) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entry = entry;\n }\n\n ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n return is(key, this.entry[0]) ? this.entry[1] : notSetValue;\n };\n\n ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n var keyMatch = is(key, this.entry[0]);\n if (keyMatch ? value === this.entry[1] : removed) {\n return this;\n }\n\n SetRef(didAlter);\n\n if (removed) {\n SetRef(didChangeSize);\n return; // undefined\n }\n\n if (keyMatch) {\n if (ownerID && ownerID === this.ownerID) {\n this.entry[1] = value;\n return this;\n }\n return new ValueNode(ownerID, this.keyHash, [key, value]);\n }\n\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);\n };\n\n\n\n // #pragma Iterators\n\n ArrayMapNode.prototype.iterate =\n HashCollisionNode.prototype.iterate = function (fn, reverse) {\n var entries = this.entries;\n for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {\n if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {\n return false;\n }\n }\n }\n\n BitmapIndexedNode.prototype.iterate =\n HashArrayMapNode.prototype.iterate = function (fn, reverse) {\n var nodes = this.nodes;\n for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {\n var node = nodes[reverse ? maxIndex - ii : ii];\n if (node && node.iterate(fn, reverse) === false) {\n return false;\n }\n }\n }\n\n ValueNode.prototype.iterate = function (fn, reverse) {\n return fn(this.entry);\n }\n\n createClass(MapIterator, Iterator);\n\n function MapIterator(map, type, reverse) {\n this._type = type;\n this._reverse = reverse;\n this._stack = map._root && mapIteratorFrame(map._root);\n }\n\n MapIterator.prototype.next = function() {\n var type = this._type;\n var stack = this._stack;\n while (stack) {\n var node = stack.node;\n var index = stack.index++;\n var maxIndex;\n if (node.entry) {\n if (index === 0) {\n return mapIteratorValue(type, node.entry);\n }\n } else if (node.entries) {\n maxIndex = node.entries.length - 1;\n if (index <= maxIndex) {\n return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);\n }\n } else {\n maxIndex = node.nodes.length - 1;\n if (index <= maxIndex) {\n var subNode = node.nodes[this._reverse ? maxIndex - index : index];\n if (subNode) {\n if (subNode.entry) {\n return mapIteratorValue(type, subNode.entry);\n }\n stack = this._stack = mapIteratorFrame(subNode, stack);\n }\n continue;\n }\n }\n stack = this._stack = this._stack.__prev;\n }\n return iteratorDone();\n };\n\n\n function mapIteratorValue(type, entry) {\n return iteratorValue(type, entry[0], entry[1]);\n }\n\n function mapIteratorFrame(node, prev) {\n return {\n node: node,\n index: 0,\n __prev: prev\n };\n }\n\n function makeMap(size, root, ownerID, hash) {\n var map = Object.create(MapPrototype);\n map.size = size;\n map._root = root;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_MAP;\n function emptyMap() {\n return EMPTY_MAP || (EMPTY_MAP = makeMap(0));\n }\n\n function updateMap(map, k, v) {\n var newRoot;\n var newSize;\n if (!map._root) {\n if (v === NOT_SET) {\n return map;\n }\n newSize = 1;\n newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);\n } else {\n var didChangeSize = MakeRef(CHANGE_LENGTH);\n var didAlter = MakeRef(DID_ALTER);\n newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter);\n if (!didAlter.value) {\n return map;\n }\n newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);\n }\n if (map.__ownerID) {\n map.size = newSize;\n map._root = newRoot;\n map.__hash = undefined;\n map.__altered = true;\n return map;\n }\n return newRoot ? makeMap(newSize, newRoot) : emptyMap();\n }\n\n function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (!node) {\n if (value === NOT_SET) {\n return node;\n }\n SetRef(didAlter);\n SetRef(didChangeSize);\n return new ValueNode(ownerID, keyHash, [key, value]);\n }\n return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);\n }\n\n function isLeafNode(node) {\n return node.constructor === ValueNode || node.constructor === HashCollisionNode;\n }\n\n function mergeIntoNode(node, ownerID, shift, keyHash, entry) {\n if (node.keyHash === keyHash) {\n return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);\n }\n\n var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;\n var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n\n var newNode;\n var nodes = idx1 === idx2 ?\n [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] :\n ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]);\n\n return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);\n }\n\n function createNodes(ownerID, entries, key, value) {\n if (!ownerID) {\n ownerID = new OwnerID();\n }\n var node = new ValueNode(ownerID, hash(key), [key, value]);\n for (var ii = 0; ii < entries.length; ii++) {\n var entry = entries[ii];\n node = node.update(ownerID, 0, undefined, entry[0], entry[1]);\n }\n return node;\n }\n\n function packNodes(ownerID, nodes, count, excluding) {\n var bitmap = 0;\n var packedII = 0;\n var packedNodes = new Array(count);\n for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {\n var node = nodes[ii];\n if (node !== undefined && ii !== excluding) {\n bitmap |= bit;\n packedNodes[packedII++] = node;\n }\n }\n return new BitmapIndexedNode(ownerID, bitmap, packedNodes);\n }\n\n function expandNodes(ownerID, nodes, bitmap, including, node) {\n var count = 0;\n var expandedNodes = new Array(SIZE);\n for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {\n expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;\n }\n expandedNodes[including] = node;\n return new HashArrayMapNode(ownerID, count + 1, expandedNodes);\n }\n\n function mergeIntoMapWith(map, merger, iterables) {\n var iters = [];\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = KeyedIterable(value);\n if (!isIterable(value)) {\n iter = iter.map(function(v ) {return fromJS(v)});\n }\n iters.push(iter);\n }\n return mergeIntoCollectionWith(map, merger, iters);\n }\n\n function deepMerger(existing, value, key) {\n return existing && existing.mergeDeep && isIterable(value) ?\n existing.mergeDeep(value) :\n is(existing, value) ? existing : value;\n }\n\n function deepMergerWith(merger) {\n return function(existing, value, key) {\n if (existing && existing.mergeDeepWith && isIterable(value)) {\n return existing.mergeDeepWith(merger, value);\n }\n var nextValue = merger(existing, value, key);\n return is(existing, nextValue) ? existing : nextValue;\n };\n }\n\n function mergeIntoCollectionWith(collection, merger, iters) {\n iters = iters.filter(function(x ) {return x.size !== 0});\n if (iters.length === 0) {\n return collection;\n }\n if (collection.size === 0 && !collection.__ownerID && iters.length === 1) {\n return collection.constructor(iters[0]);\n }\n return collection.withMutations(function(collection ) {\n var mergeIntoMap = merger ?\n function(value, key) {\n collection.update(key, NOT_SET, function(existing )\n {return existing === NOT_SET ? value : merger(existing, value, key)}\n );\n } :\n function(value, key) {\n collection.set(key, value);\n }\n for (var ii = 0; ii < iters.length; ii++) {\n iters[ii].forEach(mergeIntoMap);\n }\n });\n }\n\n function updateInDeepMap(existing, keyPathIter, notSetValue, updater) {\n var isNotSet = existing === NOT_SET;\n var step = keyPathIter.next();\n if (step.done) {\n var existingValue = isNotSet ? notSetValue : existing;\n var newValue = updater(existingValue);\n return newValue === existingValue ? existing : newValue;\n }\n invariant(\n isNotSet || (existing && existing.set),\n 'invalid keyPath'\n );\n var key = step.value;\n var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET);\n var nextUpdated = updateInDeepMap(\n nextExisting,\n keyPathIter,\n notSetValue,\n updater\n );\n return nextUpdated === nextExisting ? existing :\n nextUpdated === NOT_SET ? existing.remove(key) :\n (isNotSet ? emptyMap() : existing).set(key, nextUpdated);\n }\n\n function popCount(x) {\n x = x - ((x >> 1) & 0x55555555);\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333);\n x = (x + (x >> 4)) & 0x0f0f0f0f;\n x = x + (x >> 8);\n x = x + (x >> 16);\n return x & 0x7f;\n }\n\n function setIn(array, idx, val, canEdit) {\n var newArray = canEdit ? array : arrCopy(array);\n newArray[idx] = val;\n return newArray;\n }\n\n function spliceIn(array, idx, val, canEdit) {\n var newLen = array.length + 1;\n if (canEdit && idx + 1 === newLen) {\n array[idx] = val;\n return array;\n }\n var newArray = new Array(newLen);\n var after = 0;\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n newArray[ii] = val;\n after = -1;\n } else {\n newArray[ii] = array[ii + after];\n }\n }\n return newArray;\n }\n\n function spliceOut(array, idx, canEdit) {\n var newLen = array.length - 1;\n if (canEdit && idx === newLen) {\n array.pop();\n return array;\n }\n var newArray = new Array(newLen);\n var after = 0;\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n after = 1;\n }\n newArray[ii] = array[ii + after];\n }\n return newArray;\n }\n\n var MAX_ARRAY_MAP_SIZE = SIZE / 4;\n var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;\n var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;\n\n createClass(List, IndexedCollection);\n\n // @pragma Construction\n\n function List(value) {\n var empty = emptyList();\n if (value === null || value === undefined) {\n return empty;\n }\n if (isList(value)) {\n return value;\n }\n var iter = IndexedIterable(value);\n var size = iter.size;\n if (size === 0) {\n return empty;\n }\n assertNotInfinite(size);\n if (size > 0 && size < SIZE) {\n return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));\n }\n return empty.withMutations(function(list ) {\n list.setSize(size);\n iter.forEach(function(v, i) {return list.set(i, v)});\n });\n }\n\n List.of = function(/*...values*/) {\n return this(arguments);\n };\n\n List.prototype.toString = function() {\n return this.__toString('List [', ']');\n };\n\n // @pragma Access\n\n List.prototype.get = function(index, notSetValue) {\n index = wrapIndex(this, index);\n if (index >= 0 && index < this.size) {\n index += this._origin;\n var node = listNodeFor(this, index);\n return node && node.array[index & MASK];\n }\n return notSetValue;\n };\n\n // @pragma Modification\n\n List.prototype.set = function(index, value) {\n return updateList(this, index, value);\n };\n\n List.prototype.remove = function(index) {\n return !this.has(index) ? this :\n index === 0 ? this.shift() :\n index === this.size - 1 ? this.pop() :\n this.splice(index, 1);\n };\n\n List.prototype.insert = function(index, value) {\n return this.splice(index, 0, value);\n };\n\n List.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = this._origin = this._capacity = 0;\n this._level = SHIFT;\n this._root = this._tail = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyList();\n };\n\n List.prototype.push = function(/*...values*/) {\n var values = arguments;\n var oldSize = this.size;\n return this.withMutations(function(list ) {\n setListBounds(list, 0, oldSize + values.length);\n for (var ii = 0; ii < values.length; ii++) {\n list.set(oldSize + ii, values[ii]);\n }\n });\n };\n\n List.prototype.pop = function() {\n return setListBounds(this, 0, -1);\n };\n\n List.prototype.unshift = function(/*...values*/) {\n var values = arguments;\n return this.withMutations(function(list ) {\n setListBounds(list, -values.length);\n for (var ii = 0; ii < values.length; ii++) {\n list.set(ii, values[ii]);\n }\n });\n };\n\n List.prototype.shift = function() {\n return setListBounds(this, 1);\n };\n\n // @pragma Composition\n\n List.prototype.merge = function(/*...iters*/) {\n return mergeIntoListWith(this, undefined, arguments);\n };\n\n List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, merger, iters);\n };\n\n List.prototype.mergeDeep = function(/*...iters*/) {\n return mergeIntoListWith(this, deepMerger, arguments);\n };\n\n List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, deepMergerWith(merger), iters);\n };\n\n List.prototype.setSize = function(size) {\n return setListBounds(this, 0, size);\n };\n\n // @pragma Iteration\n\n List.prototype.slice = function(begin, end) {\n var size = this.size;\n if (wholeSlice(begin, end, size)) {\n return this;\n }\n return setListBounds(\n this,\n resolveBegin(begin, size),\n resolveEnd(end, size)\n );\n };\n\n List.prototype.__iterator = function(type, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n return new Iterator(function() {\n var value = values();\n return value === DONE ?\n iteratorDone() :\n iteratorValue(type, index++, value);\n });\n };\n\n List.prototype.__iterate = function(fn, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n var value;\n while ((value = values()) !== DONE) {\n if (fn(value, index++, this) === false) {\n break;\n }\n }\n return index;\n };\n\n List.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n return this;\n }\n return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);\n };\n\n\n function isList(maybeList) {\n return !!(maybeList && maybeList[IS_LIST_SENTINEL]);\n }\n\n List.isList = isList;\n\n var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';\n\n var ListPrototype = List.prototype;\n ListPrototype[IS_LIST_SENTINEL] = true;\n ListPrototype[DELETE] = ListPrototype.remove;\n ListPrototype.setIn = MapPrototype.setIn;\n ListPrototype.deleteIn =\n ListPrototype.removeIn = MapPrototype.removeIn;\n ListPrototype.update = MapPrototype.update;\n ListPrototype.updateIn = MapPrototype.updateIn;\n ListPrototype.mergeIn = MapPrototype.mergeIn;\n ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n ListPrototype.withMutations = MapPrototype.withMutations;\n ListPrototype.asMutable = MapPrototype.asMutable;\n ListPrototype.asImmutable = MapPrototype.asImmutable;\n ListPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n\n function VNode(array, ownerID) {\n this.array = array;\n this.ownerID = ownerID;\n }\n\n // TODO: seems like these methods are very similar\n\n VNode.prototype.removeBefore = function(ownerID, level, index) {\n if (index === level ? 1 << level : 0 || this.array.length === 0) {\n return this;\n }\n var originIndex = (index >>> level) & MASK;\n if (originIndex >= this.array.length) {\n return new VNode([], ownerID);\n }\n var removingFirst = originIndex === 0;\n var newChild;\n if (level > 0) {\n var oldChild = this.array[originIndex];\n newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);\n if (newChild === oldChild && removingFirst) {\n return this;\n }\n }\n if (removingFirst && !newChild) {\n return this;\n }\n var editable = editableVNode(this, ownerID);\n if (!removingFirst) {\n for (var ii = 0; ii < originIndex; ii++) {\n editable.array[ii] = undefined;\n }\n }\n if (newChild) {\n editable.array[originIndex] = newChild;\n }\n return editable;\n };\n\n VNode.prototype.removeAfter = function(ownerID, level, index) {\n if (index === (level ? 1 << level : 0) || this.array.length === 0) {\n return this;\n }\n var sizeIndex = ((index - 1) >>> level) & MASK;\n if (sizeIndex >= this.array.length) {\n return this;\n }\n\n var newChild;\n if (level > 0) {\n var oldChild = this.array[sizeIndex];\n newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);\n if (newChild === oldChild && sizeIndex === this.array.length - 1) {\n return this;\n }\n }\n\n var editable = editableVNode(this, ownerID);\n editable.array.splice(sizeIndex + 1);\n if (newChild) {\n editable.array[sizeIndex] = newChild;\n }\n return editable;\n };\n\n\n\n var DONE = {};\n\n function iterateList(list, reverse) {\n var left = list._origin;\n var right = list._capacity;\n var tailPos = getTailOffset(right);\n var tail = list._tail;\n\n return iterateNodeOrLeaf(list._root, list._level, 0);\n\n function iterateNodeOrLeaf(node, level, offset) {\n return level === 0 ?\n iterateLeaf(node, offset) :\n iterateNode(node, level, offset);\n }\n\n function iterateLeaf(node, offset) {\n var array = offset === tailPos ? tail && tail.array : node && node.array;\n var from = offset > left ? 0 : left - offset;\n var to = right - offset;\n if (to > SIZE) {\n to = SIZE;\n }\n return function() {\n if (from === to) {\n return DONE;\n }\n var idx = reverse ? --to : from++;\n return array && array[idx];\n };\n }\n\n function iterateNode(node, level, offset) {\n var values;\n var array = node && node.array;\n var from = offset > left ? 0 : (left - offset) >> level;\n var to = ((right - offset) >> level) + 1;\n if (to > SIZE) {\n to = SIZE;\n }\n return function() {\n do {\n if (values) {\n var value = values();\n if (value !== DONE) {\n return value;\n }\n values = null;\n }\n if (from === to) {\n return DONE;\n }\n var idx = reverse ? --to : from++;\n values = iterateNodeOrLeaf(\n array && array[idx], level - SHIFT, offset + (idx << level)\n );\n } while (true);\n };\n }\n }\n\n function makeList(origin, capacity, level, root, tail, ownerID, hash) {\n var list = Object.create(ListPrototype);\n list.size = capacity - origin;\n list._origin = origin;\n list._capacity = capacity;\n list._level = level;\n list._root = root;\n list._tail = tail;\n list.__ownerID = ownerID;\n list.__hash = hash;\n list.__altered = false;\n return list;\n }\n\n var EMPTY_LIST;\n function emptyList() {\n return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));\n }\n\n function updateList(list, index, value) {\n index = wrapIndex(list, index);\n\n if (index !== index) {\n return list;\n }\n\n if (index >= list.size || index < 0) {\n return list.withMutations(function(list ) {\n index < 0 ?\n setListBounds(list, index).set(0, value) :\n setListBounds(list, 0, index + 1).set(index, value)\n });\n }\n\n index += list._origin;\n\n var newTail = list._tail;\n var newRoot = list._root;\n var didAlter = MakeRef(DID_ALTER);\n if (index >= getTailOffset(list._capacity)) {\n newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);\n } else {\n newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);\n }\n\n if (!didAlter.value) {\n return list;\n }\n\n if (list.__ownerID) {\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n return makeList(list._origin, list._capacity, list._level, newRoot, newTail);\n }\n\n function updateVNode(node, ownerID, level, index, value, didAlter) {\n var idx = (index >>> level) & MASK;\n var nodeHas = node && idx < node.array.length;\n if (!nodeHas && value === undefined) {\n return node;\n }\n\n var newNode;\n\n if (level > 0) {\n var lowerNode = node && node.array[idx];\n var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);\n if (newLowerNode === lowerNode) {\n return node;\n }\n newNode = editableVNode(node, ownerID);\n newNode.array[idx] = newLowerNode;\n return newNode;\n }\n\n if (nodeHas && node.array[idx] === value) {\n return node;\n }\n\n SetRef(didAlter);\n\n newNode = editableVNode(node, ownerID);\n if (value === undefined && idx === newNode.array.length - 1) {\n newNode.array.pop();\n } else {\n newNode.array[idx] = value;\n }\n return newNode;\n }\n\n function editableVNode(node, ownerID) {\n if (ownerID && node && ownerID === node.ownerID) {\n return node;\n }\n return new VNode(node ? node.array.slice() : [], ownerID);\n }\n\n function listNodeFor(list, rawIndex) {\n if (rawIndex >= getTailOffset(list._capacity)) {\n return list._tail;\n }\n if (rawIndex < 1 << (list._level + SHIFT)) {\n var node = list._root;\n var level = list._level;\n while (node && level > 0) {\n node = node.array[(rawIndex >>> level) & MASK];\n level -= SHIFT;\n }\n return node;\n }\n }\n\n function setListBounds(list, begin, end) {\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin = begin | 0;\n }\n if (end !== undefined) {\n end = end | 0;\n }\n var owner = list.__ownerID || new OwnerID();\n var oldOrigin = list._origin;\n var oldCapacity = list._capacity;\n var newOrigin = oldOrigin + begin;\n var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;\n if (newOrigin === oldOrigin && newCapacity === oldCapacity) {\n return list;\n }\n\n // If it's going to end after it starts, it's empty.\n if (newOrigin >= newCapacity) {\n return list.clear();\n }\n\n var newLevel = list._level;\n var newRoot = list._root;\n\n // New origin might need creating a higher root.\n var offsetShift = 0;\n while (newOrigin + offsetShift < 0) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner);\n newLevel += SHIFT;\n offsetShift += 1 << newLevel;\n }\n if (offsetShift) {\n newOrigin += offsetShift;\n oldOrigin += offsetShift;\n newCapacity += offsetShift;\n oldCapacity += offsetShift;\n }\n\n var oldTailOffset = getTailOffset(oldCapacity);\n var newTailOffset = getTailOffset(newCapacity);\n\n // New size might need creating a higher root.\n while (newTailOffset >= 1 << (newLevel + SHIFT)) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);\n newLevel += SHIFT;\n }\n\n // Locate or create the new tail.\n var oldTail = list._tail;\n var newTail = newTailOffset < oldTailOffset ?\n listNodeFor(list, newCapacity - 1) :\n newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail;\n\n // Merge Tail into tree.\n if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {\n newRoot = editableVNode(newRoot, owner);\n var node = newRoot;\n for (var level = newLevel; level > SHIFT; level -= SHIFT) {\n var idx = (oldTailOffset >>> level) & MASK;\n node = node.array[idx] = editableVNode(node.array[idx], owner);\n }\n node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;\n }\n\n // If the size has been reduced, there's a chance the tail needs to be trimmed.\n if (newCapacity < oldCapacity) {\n newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);\n }\n\n // If the new origin is within the tail, then we do not need a root.\n if (newOrigin >= newTailOffset) {\n newOrigin -= newTailOffset;\n newCapacity -= newTailOffset;\n newLevel = SHIFT;\n newRoot = null;\n newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);\n\n // Otherwise, if the root has been trimmed, garbage collect.\n } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {\n offsetShift = 0;\n\n // Identify the new top root node of the subtree of the old root.\n while (newRoot) {\n var beginIndex = (newOrigin >>> newLevel) & MASK;\n if (beginIndex !== (newTailOffset >>> newLevel) & MASK) {\n break;\n }\n if (beginIndex) {\n offsetShift += (1 << newLevel) * beginIndex;\n }\n newLevel -= SHIFT;\n newRoot = newRoot.array[beginIndex];\n }\n\n // Trim the new sides of the new root.\n if (newRoot && newOrigin > oldOrigin) {\n newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);\n }\n if (newRoot && newTailOffset < oldTailOffset) {\n newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);\n }\n if (offsetShift) {\n newOrigin -= offsetShift;\n newCapacity -= offsetShift;\n }\n }\n\n if (list.__ownerID) {\n list.size = newCapacity - newOrigin;\n list._origin = newOrigin;\n list._capacity = newCapacity;\n list._level = newLevel;\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);\n }\n\n function mergeIntoListWith(list, merger, iterables) {\n var iters = [];\n var maxSize = 0;\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = IndexedIterable(value);\n if (iter.size > maxSize) {\n maxSize = iter.size;\n }\n if (!isIterable(value)) {\n iter = iter.map(function(v ) {return fromJS(v)});\n }\n iters.push(iter);\n }\n if (maxSize > list.size) {\n list = list.setSize(maxSize);\n }\n return mergeIntoCollectionWith(list, merger, iters);\n }\n\n function getTailOffset(size) {\n return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT);\n }\n\n createClass(OrderedMap, Map);\n\n // @pragma Construction\n\n function OrderedMap(value) {\n return value === null || value === undefined ? emptyOrderedMap() :\n isOrderedMap(value) ? value :\n emptyOrderedMap().withMutations(function(map ) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v, k) {return map.set(k, v)});\n });\n }\n\n OrderedMap.of = function(/*...values*/) {\n return this(arguments);\n };\n\n OrderedMap.prototype.toString = function() {\n return this.__toString('OrderedMap {', '}');\n };\n\n // @pragma Access\n\n OrderedMap.prototype.get = function(k, notSetValue) {\n var index = this._map.get(k);\n return index !== undefined ? this._list.get(index)[1] : notSetValue;\n };\n\n // @pragma Modification\n\n OrderedMap.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._map.clear();\n this._list.clear();\n return this;\n }\n return emptyOrderedMap();\n };\n\n OrderedMap.prototype.set = function(k, v) {\n return updateOrderedMap(this, k, v);\n };\n\n OrderedMap.prototype.remove = function(k) {\n return updateOrderedMap(this, k, NOT_SET);\n };\n\n OrderedMap.prototype.wasAltered = function() {\n return this._map.wasAltered() || this._list.wasAltered();\n };\n\n OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._list.__iterate(\n function(entry ) {return entry && fn(entry[1], entry[0], this$0)},\n reverse\n );\n };\n\n OrderedMap.prototype.__iterator = function(type, reverse) {\n return this._list.fromEntrySeq().__iterator(type, reverse);\n };\n\n OrderedMap.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map.__ensureOwner(ownerID);\n var newList = this._list.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n this._list = newList;\n return this;\n }\n return makeOrderedMap(newMap, newList, ownerID, this.__hash);\n };\n\n\n function isOrderedMap(maybeOrderedMap) {\n return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);\n }\n\n OrderedMap.isOrderedMap = isOrderedMap;\n\n OrderedMap.prototype[IS_ORDERED_SENTINEL] = true;\n OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;\n\n\n\n function makeOrderedMap(map, list, ownerID, hash) {\n var omap = Object.create(OrderedMap.prototype);\n omap.size = map ? map.size : 0;\n omap._map = map;\n omap._list = list;\n omap.__ownerID = ownerID;\n omap.__hash = hash;\n return omap;\n }\n\n var EMPTY_ORDERED_MAP;\n function emptyOrderedMap() {\n return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));\n }\n\n function updateOrderedMap(omap, k, v) {\n var map = omap._map;\n var list = omap._list;\n var i = map.get(k);\n var has = i !== undefined;\n var newMap;\n var newList;\n if (v === NOT_SET) { // removed\n if (!has) {\n return omap;\n }\n if (list.size >= SIZE && list.size >= map.size * 2) {\n newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx});\n newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap();\n if (omap.__ownerID) {\n newMap.__ownerID = newList.__ownerID = omap.__ownerID;\n }\n } else {\n newMap = map.remove(k);\n newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);\n }\n } else {\n if (has) {\n if (v === list.get(i)[1]) {\n return omap;\n }\n newMap = map;\n newList = list.set(i, [k, v]);\n } else {\n newMap = map.set(k, list.size);\n newList = list.set(list.size, [k, v]);\n }\n }\n if (omap.__ownerID) {\n omap.size = newMap.size;\n omap._map = newMap;\n omap._list = newList;\n omap.__hash = undefined;\n return omap;\n }\n return makeOrderedMap(newMap, newList);\n }\n\n createClass(ToKeyedSequence, KeyedSeq);\n function ToKeyedSequence(indexed, useKeys) {\n this._iter = indexed;\n this._useKeys = useKeys;\n this.size = indexed.size;\n }\n\n ToKeyedSequence.prototype.get = function(key, notSetValue) {\n return this._iter.get(key, notSetValue);\n };\n\n ToKeyedSequence.prototype.has = function(key) {\n return this._iter.has(key);\n };\n\n ToKeyedSequence.prototype.valueSeq = function() {\n return this._iter.valueSeq();\n };\n\n ToKeyedSequence.prototype.reverse = function() {var this$0 = this;\n var reversedSequence = reverseFactory(this, true);\n if (!this._useKeys) {\n reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()};\n }\n return reversedSequence;\n };\n\n ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this;\n var mappedSequence = mapFactory(this, mapper, context);\n if (!this._useKeys) {\n mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)};\n }\n return mappedSequence;\n };\n\n ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var ii;\n return this._iter.__iterate(\n this._useKeys ?\n function(v, k) {return fn(v, k, this$0)} :\n ((ii = reverse ? resolveSize(this) : 0),\n function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),\n reverse\n );\n };\n\n ToKeyedSequence.prototype.__iterator = function(type, reverse) {\n if (this._useKeys) {\n return this._iter.__iterator(type, reverse);\n }\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n var ii = reverse ? resolveSize(this) : 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, reverse ? --ii : ii++, step.value, step);\n });\n };\n\n ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n createClass(ToIndexedSequence, IndexedSeq);\n function ToIndexedSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToIndexedSequence.prototype.includes = function(value) {\n return this._iter.includes(value);\n };\n\n ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse);\n };\n\n ToIndexedSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n var iterations = 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, iterations++, step.value, step)\n });\n };\n\n\n\n createClass(ToSetSequence, SetSeq);\n function ToSetSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToSetSequence.prototype.has = function(key) {\n return this._iter.includes(key);\n };\n\n ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse);\n };\n\n ToSetSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, step.value, step.value, step);\n });\n };\n\n\n\n createClass(FromEntriesSequence, KeyedSeq);\n function FromEntriesSequence(entries) {\n this._iter = entries;\n this.size = entries.size;\n }\n\n FromEntriesSequence.prototype.entrySeq = function() {\n return this._iter.toSeq();\n };\n\n FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._iter.__iterate(function(entry ) {\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return fn(\n indexedIterable ? entry.get(1) : entry[1],\n indexedIterable ? entry.get(0) : entry[0],\n this$0\n );\n }\n }, reverse);\n };\n\n FromEntriesSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n return new Iterator(function() {\n while (true) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return iteratorValue(\n type,\n indexedIterable ? entry.get(0) : entry[0],\n indexedIterable ? entry.get(1) : entry[1],\n step\n );\n }\n }\n });\n };\n\n\n ToIndexedSequence.prototype.cacheResult =\n ToKeyedSequence.prototype.cacheResult =\n ToSetSequence.prototype.cacheResult =\n FromEntriesSequence.prototype.cacheResult =\n cacheResultThrough;\n\n\n function flipFactory(iterable) {\n var flipSequence = makeSequence(iterable);\n flipSequence._iter = iterable;\n flipSequence.size = iterable.size;\n flipSequence.flip = function() {return iterable};\n flipSequence.reverse = function () {\n var reversedSequence = iterable.reverse.apply(this); // super.reverse()\n reversedSequence.flip = function() {return iterable.reverse()};\n return reversedSequence;\n };\n flipSequence.has = function(key ) {return iterable.includes(key)};\n flipSequence.includes = function(key ) {return iterable.has(key)};\n flipSequence.cacheResult = cacheResultThrough;\n flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse);\n }\n flipSequence.__iteratorUncached = function(type, reverse) {\n if (type === ITERATE_ENTRIES) {\n var iterator = iterable.__iterator(type, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n if (!step.done) {\n var k = step.value[0];\n step.value[0] = step.value[1];\n step.value[1] = k;\n }\n return step;\n });\n }\n return iterable.__iterator(\n type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,\n reverse\n );\n }\n return flipSequence;\n }\n\n\n function mapFactory(iterable, mapper, context) {\n var mappedSequence = makeSequence(iterable);\n mappedSequence.size = iterable.size;\n mappedSequence.has = function(key ) {return iterable.has(key)};\n mappedSequence.get = function(key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v === NOT_SET ?\n notSetValue :\n mapper.call(context, v, key, iterable);\n };\n mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(\n function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false},\n reverse\n );\n }\n mappedSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var key = entry[0];\n return iteratorValue(\n type,\n key,\n mapper.call(context, entry[1], key, iterable),\n step\n );\n });\n }\n return mappedSequence;\n }\n\n\n function reverseFactory(iterable, useKeys) {\n var reversedSequence = makeSequence(iterable);\n reversedSequence._iter = iterable;\n reversedSequence.size = iterable.size;\n reversedSequence.reverse = function() {return iterable};\n if (iterable.flip) {\n reversedSequence.flip = function () {\n var flipSequence = flipFactory(iterable);\n flipSequence.reverse = function() {return iterable.flip()};\n return flipSequence;\n };\n }\n reversedSequence.get = function(key, notSetValue) \n {return iterable.get(useKeys ? key : -1 - key, notSetValue)};\n reversedSequence.has = function(key )\n {return iterable.has(useKeys ? key : -1 - key)};\n reversedSequence.includes = function(value ) {return iterable.includes(value)};\n reversedSequence.cacheResult = cacheResultThrough;\n reversedSequence.__iterate = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse);\n };\n reversedSequence.__iterator =\n function(type, reverse) {return iterable.__iterator(type, !reverse)};\n return reversedSequence;\n }\n\n\n function filterFactory(iterable, predicate, context, useKeys) {\n var filterSequence = makeSequence(iterable);\n if (useKeys) {\n filterSequence.has = function(key ) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && !!predicate.call(context, v, key, iterable);\n };\n filterSequence.get = function(key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && predicate.call(context, v, key, iterable) ?\n v : notSetValue;\n };\n }\n filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n var iterations = 0;\n iterable.__iterate(function(v, k, c) {\n if (predicate.call(context, v, k, c)) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n }, reverse);\n return iterations;\n };\n filterSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var iterations = 0;\n return new Iterator(function() {\n while (true) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var key = entry[0];\n var value = entry[1];\n if (predicate.call(context, value, key, iterable)) {\n return iteratorValue(type, useKeys ? key : iterations++, value, step);\n }\n }\n });\n }\n return filterSequence;\n }\n\n\n function countByFactory(iterable, grouper, context) {\n var groups = Map().asMutable();\n iterable.__iterate(function(v, k) {\n groups.update(\n grouper.call(context, v, k, iterable),\n 0,\n function(a ) {return a + 1}\n );\n });\n return groups.asImmutable();\n }\n\n\n function groupByFactory(iterable, grouper, context) {\n var isKeyedIter = isKeyed(iterable);\n var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable();\n iterable.__iterate(function(v, k) {\n groups.update(\n grouper.call(context, v, k, iterable),\n function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)}\n );\n });\n var coerce = iterableClass(iterable);\n return groups.map(function(arr ) {return reify(iterable, coerce(arr))});\n }\n\n\n function sliceFactory(iterable, begin, end, useKeys) {\n var originalSize = iterable.size;\n\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin = begin | 0;\n }\n if (end !== undefined) {\n end = end | 0;\n }\n\n if (wholeSlice(begin, end, originalSize)) {\n return iterable;\n }\n\n var resolvedBegin = resolveBegin(begin, originalSize);\n var resolvedEnd = resolveEnd(end, originalSize);\n\n // begin or end will be NaN if they were provided as negative numbers and\n // this iterable's size is unknown. In that case, cache first so there is\n // a known size and these do not resolve to NaN.\n if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {\n return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys);\n }\n\n // Note: resolvedEnd is undefined when the original sequence's length is\n // unknown and this slice did not supply an end and should contain all\n // elements after resolvedBegin.\n // In that case, resolvedSize will be NaN and sliceSize will remain undefined.\n var resolvedSize = resolvedEnd - resolvedBegin;\n var sliceSize;\n if (resolvedSize === resolvedSize) {\n sliceSize = resolvedSize < 0 ? 0 : resolvedSize;\n }\n\n var sliceSeq = makeSequence(iterable);\n\n // If iterable.size is undefined, the size of the realized sliceSeq is\n // unknown at this point unless the number of items to slice is 0\n sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined;\n\n if (!useKeys && isSeq(iterable) && sliceSize >= 0) {\n sliceSeq.get = function (index, notSetValue) {\n index = wrapIndex(this, index);\n return index >= 0 && index < sliceSize ?\n iterable.get(index + resolvedBegin, notSetValue) :\n notSetValue;\n }\n }\n\n sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this;\n if (sliceSize === 0) {\n return 0;\n }\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var skipped = 0;\n var isSkipping = true;\n var iterations = 0;\n iterable.__iterate(function(v, k) {\n if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0) !== false &&\n iterations !== sliceSize;\n }\n });\n return iterations;\n };\n\n sliceSeq.__iteratorUncached = function(type, reverse) {\n if (sliceSize !== 0 && reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n // Don't bother instantiating parent iterator if taking 0.\n var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse);\n var skipped = 0;\n var iterations = 0;\n return new Iterator(function() {\n while (skipped++ < resolvedBegin) {\n iterator.next();\n }\n if (++iterations > sliceSize) {\n return iteratorDone();\n }\n var step = iterator.next();\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations - 1, undefined, step);\n } else {\n return iteratorValue(type, iterations - 1, step.value[1], step);\n }\n });\n }\n\n return sliceSeq;\n }\n\n\n function takeWhileFactory(iterable, predicate, context) {\n var takeSequence = makeSequence(iterable);\n takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterations = 0;\n iterable.__iterate(function(v, k, c) \n {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)}\n );\n return iterations;\n };\n takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var iterating = true;\n return new Iterator(function() {\n if (!iterating) {\n return iteratorDone();\n }\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var k = entry[0];\n var v = entry[1];\n if (!predicate.call(context, v, k, this$0)) {\n iterating = false;\n return iteratorDone();\n }\n return type === ITERATE_ENTRIES ? step :\n iteratorValue(type, k, v, step);\n });\n };\n return takeSequence;\n }\n\n\n function skipWhileFactory(iterable, predicate, context, useKeys) {\n var skipSequence = makeSequence(iterable);\n skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var isSkipping = true;\n var iterations = 0;\n iterable.__iterate(function(v, k, c) {\n if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n });\n return iterations;\n };\n skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var skipping = true;\n var iterations = 0;\n return new Iterator(function() {\n var step, k, v;\n do {\n step = iterator.next();\n if (step.done) {\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations++, undefined, step);\n } else {\n return iteratorValue(type, iterations++, step.value[1], step);\n }\n }\n var entry = step.value;\n k = entry[0];\n v = entry[1];\n skipping && (skipping = predicate.call(context, v, k, this$0));\n } while (skipping);\n return type === ITERATE_ENTRIES ? step :\n iteratorValue(type, k, v, step);\n });\n };\n return skipSequence;\n }\n\n\n function concatFactory(iterable, values) {\n var isKeyedIterable = isKeyed(iterable);\n var iters = [iterable].concat(values).map(function(v ) {\n if (!isIterable(v)) {\n v = isKeyedIterable ?\n keyedSeqFromValue(v) :\n indexedSeqFromValue(Array.isArray(v) ? v : [v]);\n } else if (isKeyedIterable) {\n v = KeyedIterable(v);\n }\n return v;\n }).filter(function(v ) {return v.size !== 0});\n\n if (iters.length === 0) {\n return iterable;\n }\n\n if (iters.length === 1) {\n var singleton = iters[0];\n if (singleton === iterable ||\n isKeyedIterable && isKeyed(singleton) ||\n isIndexed(iterable) && isIndexed(singleton)) {\n return singleton;\n }\n }\n\n var concatSeq = new ArraySeq(iters);\n if (isKeyedIterable) {\n concatSeq = concatSeq.toKeyedSeq();\n } else if (!isIndexed(iterable)) {\n concatSeq = concatSeq.toSetSeq();\n }\n concatSeq = concatSeq.flatten(true);\n concatSeq.size = iters.reduce(\n function(sum, seq) {\n if (sum !== undefined) {\n var size = seq.size;\n if (size !== undefined) {\n return sum + size;\n }\n }\n },\n 0\n );\n return concatSeq;\n }\n\n\n function flattenFactory(iterable, depth, useKeys) {\n var flatSequence = makeSequence(iterable);\n flatSequence.__iterateUncached = function(fn, reverse) {\n var iterations = 0;\n var stopped = false;\n function flatDeep(iter, currentDepth) {var this$0 = this;\n iter.__iterate(function(v, k) {\n if ((!depth || currentDepth < depth) && isIterable(v)) {\n flatDeep(v, currentDepth + 1);\n } else if (fn(v, useKeys ? k : iterations++, this$0) === false) {\n stopped = true;\n }\n return !stopped;\n }, reverse);\n }\n flatDeep(iterable, 0);\n return iterations;\n }\n flatSequence.__iteratorUncached = function(type, reverse) {\n var iterator = iterable.__iterator(type, reverse);\n var stack = [];\n var iterations = 0;\n return new Iterator(function() {\n while (iterator) {\n var step = iterator.next();\n if (step.done !== false) {\n iterator = stack.pop();\n continue;\n }\n var v = step.value;\n if (type === ITERATE_ENTRIES) {\n v = v[1];\n }\n if ((!depth || stack.length < depth) && isIterable(v)) {\n stack.push(iterator);\n iterator = v.__iterator(type, reverse);\n } else {\n return useKeys ? step : iteratorValue(type, iterations++, v, step);\n }\n }\n return iteratorDone();\n });\n }\n return flatSequence;\n }\n\n\n function flatMapFactory(iterable, mapper, context) {\n var coerce = iterableClass(iterable);\n return iterable.toSeq().map(\n function(v, k) {return coerce(mapper.call(context, v, k, iterable))}\n ).flatten(true);\n }\n\n\n function interposeFactory(iterable, separator) {\n var interposedSequence = makeSequence(iterable);\n interposedSequence.size = iterable.size && iterable.size * 2 -1;\n interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n iterable.__iterate(function(v, k) \n {return (!iterations || fn(separator, iterations++, this$0) !== false) &&\n fn(v, iterations++, this$0) !== false},\n reverse\n );\n return iterations;\n };\n interposedSequence.__iteratorUncached = function(type, reverse) {\n var iterator = iterable.__iterator(ITERATE_VALUES, reverse);\n var iterations = 0;\n var step;\n return new Iterator(function() {\n if (!step || iterations % 2) {\n step = iterator.next();\n if (step.done) {\n return step;\n }\n }\n return iterations % 2 ?\n iteratorValue(type, iterations++, separator) :\n iteratorValue(type, iterations++, step.value, step);\n });\n };\n return interposedSequence;\n }\n\n\n function sortFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n var isKeyedIterable = isKeyed(iterable);\n var index = 0;\n var entries = iterable.toSeq().map(\n function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]}\n ).toArray();\n entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach(\n isKeyedIterable ?\n function(v, i) { entries[i].length = 2; } :\n function(v, i) { entries[i] = v[1]; }\n );\n return isKeyedIterable ? KeyedSeq(entries) :\n isIndexed(iterable) ? IndexedSeq(entries) :\n SetSeq(entries);\n }\n\n\n function maxFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n if (mapper) {\n var entry = iterable.toSeq()\n .map(function(v, k) {return [v, mapper(v, k, iterable)]})\n .reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a});\n return entry && entry[0];\n } else {\n return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a});\n }\n }\n\n function maxCompare(comparator, a, b) {\n var comp = comparator(b, a);\n // b is considered the new max if the comparator declares them equal, but\n // they are not equal and b is in fact a nullish value.\n return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0;\n }\n\n\n function zipWithFactory(keyIter, zipper, iters) {\n var zipSequence = makeSequence(keyIter);\n zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min();\n // Note: this a generic base implementation of __iterate in terms of\n // __iterator which may be more generically useful in the future.\n zipSequence.__iterate = function(fn, reverse) {\n /* generic:\n var iterator = this.__iterator(ITERATE_ENTRIES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n iterations++;\n if (fn(step.value[1], step.value[0], this) === false) {\n break;\n }\n }\n return iterations;\n */\n // indexed:\n var iterator = this.__iterator(ITERATE_VALUES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n return iterations;\n };\n zipSequence.__iteratorUncached = function(type, reverse) {\n var iterators = iters.map(function(i )\n {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))}\n );\n var iterations = 0;\n var isDone = false;\n return new Iterator(function() {\n var steps;\n if (!isDone) {\n steps = iterators.map(function(i ) {return i.next()});\n isDone = steps.some(function(s ) {return s.done});\n }\n if (isDone) {\n return iteratorDone();\n }\n return iteratorValue(\n type,\n iterations++,\n zipper.apply(null, steps.map(function(s ) {return s.value}))\n );\n });\n };\n return zipSequence\n }\n\n\n // #pragma Helper Functions\n\n function reify(iter, seq) {\n return isSeq(iter) ? seq : iter.constructor(seq);\n }\n\n function validateEntry(entry) {\n if (entry !== Object(entry)) {\n throw new TypeError('Expected [K, V] tuple: ' + entry);\n }\n }\n\n function resolveSize(iter) {\n assertNotInfinite(iter.size);\n return ensureSize(iter);\n }\n\n function iterableClass(iterable) {\n return isKeyed(iterable) ? KeyedIterable :\n isIndexed(iterable) ? IndexedIterable :\n SetIterable;\n }\n\n function makeSequence(iterable) {\n return Object.create(\n (\n isKeyed(iterable) ? KeyedSeq :\n isIndexed(iterable) ? IndexedSeq :\n SetSeq\n ).prototype\n );\n }\n\n function cacheResultThrough() {\n if (this._iter.cacheResult) {\n this._iter.cacheResult();\n this.size = this._iter.size;\n return this;\n } else {\n return Seq.prototype.cacheResult.call(this);\n }\n }\n\n function defaultComparator(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n }\n\n function forceIterator(keyPath) {\n var iter = getIterator(keyPath);\n if (!iter) {\n // Array might not be iterable in this environment, so we need a fallback\n // to our wrapped type.\n if (!isArrayLike(keyPath)) {\n throw new TypeError('Expected iterable or array-like: ' + keyPath);\n }\n iter = getIterator(Iterable(keyPath));\n }\n return iter;\n }\n\n createClass(Record, KeyedCollection);\n\n function Record(defaultValues, name) {\n var hasInitialized;\n\n var RecordType = function Record(values) {\n if (values instanceof RecordType) {\n return values;\n }\n if (!(this instanceof RecordType)) {\n return new RecordType(values);\n }\n if (!hasInitialized) {\n hasInitialized = true;\n var keys = Object.keys(defaultValues);\n setProps(RecordTypePrototype, keys);\n RecordTypePrototype.size = keys.length;\n RecordTypePrototype._name = name;\n RecordTypePrototype._keys = keys;\n RecordTypePrototype._defaultValues = defaultValues;\n }\n this._map = Map(values);\n };\n\n var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype);\n RecordTypePrototype.constructor = RecordType;\n\n return RecordType;\n }\n\n Record.prototype.toString = function() {\n return this.__toString(recordName(this) + ' {', '}');\n };\n\n // @pragma Access\n\n Record.prototype.has = function(k) {\n return this._defaultValues.hasOwnProperty(k);\n };\n\n Record.prototype.get = function(k, notSetValue) {\n if (!this.has(k)) {\n return notSetValue;\n }\n var defaultVal = this._defaultValues[k];\n return this._map ? this._map.get(k, defaultVal) : defaultVal;\n };\n\n // @pragma Modification\n\n Record.prototype.clear = function() {\n if (this.__ownerID) {\n this._map && this._map.clear();\n return this;\n }\n var RecordType = this.constructor;\n return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap()));\n };\n\n Record.prototype.set = function(k, v) {\n if (!this.has(k)) {\n throw new Error('Cannot set unknown key \"' + k + '\" on ' + recordName(this));\n }\n var newMap = this._map && this._map.set(k, v);\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n return makeRecord(this, newMap);\n };\n\n Record.prototype.remove = function(k) {\n if (!this.has(k)) {\n return this;\n }\n var newMap = this._map && this._map.remove(k);\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n return makeRecord(this, newMap);\n };\n\n Record.prototype.wasAltered = function() {\n return this._map.wasAltered();\n };\n\n Record.prototype.__iterator = function(type, reverse) {var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse);\n };\n\n Record.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse);\n };\n\n Record.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map && this._map.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n return makeRecord(this, newMap, ownerID);\n };\n\n\n var RecordPrototype = Record.prototype;\n RecordPrototype[DELETE] = RecordPrototype.remove;\n RecordPrototype.deleteIn =\n RecordPrototype.removeIn = MapPrototype.removeIn;\n RecordPrototype.merge = MapPrototype.merge;\n RecordPrototype.mergeWith = MapPrototype.mergeWith;\n RecordPrototype.mergeIn = MapPrototype.mergeIn;\n RecordPrototype.mergeDeep = MapPrototype.mergeDeep;\n RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith;\n RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n RecordPrototype.setIn = MapPrototype.setIn;\n RecordPrototype.update = MapPrototype.update;\n RecordPrototype.updateIn = MapPrototype.updateIn;\n RecordPrototype.withMutations = MapPrototype.withMutations;\n RecordPrototype.asMutable = MapPrototype.asMutable;\n RecordPrototype.asImmutable = MapPrototype.asImmutable;\n\n\n function makeRecord(likeRecord, map, ownerID) {\n var record = Object.create(Object.getPrototypeOf(likeRecord));\n record._map = map;\n record.__ownerID = ownerID;\n return record;\n }\n\n function recordName(record) {\n return record._name || record.constructor.name || 'Record';\n }\n\n function setProps(prototype, names) {\n try {\n names.forEach(setProp.bind(undefined, prototype));\n } catch (error) {\n // Object.defineProperty failed. Probably IE8.\n }\n }\n\n function setProp(prototype, name) {\n Object.defineProperty(prototype, name, {\n get: function() {\n return this.get(name);\n },\n set: function(value) {\n invariant(this.__ownerID, 'Cannot set on an immutable record.');\n this.set(name, value);\n }\n });\n }\n\n createClass(Set, SetCollection);\n\n // @pragma Construction\n\n function Set(value) {\n return value === null || value === undefined ? emptySet() :\n isSet(value) && !isOrdered(value) ? value :\n emptySet().withMutations(function(set ) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v ) {return set.add(v)});\n });\n }\n\n Set.of = function(/*...values*/) {\n return this(arguments);\n };\n\n Set.fromKeys = function(value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n Set.prototype.toString = function() {\n return this.__toString('Set {', '}');\n };\n\n // @pragma Access\n\n Set.prototype.has = function(value) {\n return this._map.has(value);\n };\n\n // @pragma Modification\n\n Set.prototype.add = function(value) {\n return updateSet(this, this._map.set(value, true));\n };\n\n Set.prototype.remove = function(value) {\n return updateSet(this, this._map.remove(value));\n };\n\n Set.prototype.clear = function() {\n return updateSet(this, this._map.clear());\n };\n\n // @pragma Composition\n\n Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0);\n iters = iters.filter(function(x ) {return x.size !== 0});\n if (iters.length === 0) {\n return this;\n }\n if (this.size === 0 && !this.__ownerID && iters.length === 1) {\n return this.constructor(iters[0]);\n }\n return this.withMutations(function(set ) {\n for (var ii = 0; ii < iters.length; ii++) {\n SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)});\n }\n });\n };\n\n Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0);\n if (iters.length === 0) {\n return this;\n }\n iters = iters.map(function(iter ) {return SetIterable(iter)});\n var originalSet = this;\n return this.withMutations(function(set ) {\n originalSet.forEach(function(value ) {\n if (!iters.every(function(iter ) {return iter.includes(value)})) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0);\n if (iters.length === 0) {\n return this;\n }\n iters = iters.map(function(iter ) {return SetIterable(iter)});\n var originalSet = this;\n return this.withMutations(function(set ) {\n originalSet.forEach(function(value ) {\n if (iters.some(function(iter ) {return iter.includes(value)})) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.merge = function() {\n return this.union.apply(this, arguments);\n };\n\n Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return this.union.apply(this, iters);\n };\n\n Set.prototype.sort = function(comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator));\n };\n\n Set.prototype.sortBy = function(mapper, comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator, mapper));\n };\n\n Set.prototype.wasAltered = function() {\n return this._map.wasAltered();\n };\n\n Set.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse);\n };\n\n Set.prototype.__iterator = function(type, reverse) {\n return this._map.map(function(_, k) {return k}).__iterator(type, reverse);\n };\n\n Set.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n return this.__make(newMap, ownerID);\n };\n\n\n function isSet(maybeSet) {\n return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);\n }\n\n Set.isSet = isSet;\n\n var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';\n\n var SetPrototype = Set.prototype;\n SetPrototype[IS_SET_SENTINEL] = true;\n SetPrototype[DELETE] = SetPrototype.remove;\n SetPrototype.mergeDeep = SetPrototype.merge;\n SetPrototype.mergeDeepWith = SetPrototype.mergeWith;\n SetPrototype.withMutations = MapPrototype.withMutations;\n SetPrototype.asMutable = MapPrototype.asMutable;\n SetPrototype.asImmutable = MapPrototype.asImmutable;\n\n SetPrototype.__empty = emptySet;\n SetPrototype.__make = makeSet;\n\n function updateSet(set, newMap) {\n if (set.__ownerID) {\n set.size = newMap.size;\n set._map = newMap;\n return set;\n }\n return newMap === set._map ? set :\n newMap.size === 0 ? set.__empty() :\n set.__make(newMap);\n }\n\n function makeSet(map, ownerID) {\n var set = Object.create(SetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_SET;\n function emptySet() {\n return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));\n }\n\n createClass(OrderedSet, Set);\n\n // @pragma Construction\n\n function OrderedSet(value) {\n return value === null || value === undefined ? emptyOrderedSet() :\n isOrderedSet(value) ? value :\n emptyOrderedSet().withMutations(function(set ) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v ) {return set.add(v)});\n });\n }\n\n OrderedSet.of = function(/*...values*/) {\n return this(arguments);\n };\n\n OrderedSet.fromKeys = function(value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n OrderedSet.prototype.toString = function() {\n return this.__toString('OrderedSet {', '}');\n };\n\n\n function isOrderedSet(maybeOrderedSet) {\n return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);\n }\n\n OrderedSet.isOrderedSet = isOrderedSet;\n\n var OrderedSetPrototype = OrderedSet.prototype;\n OrderedSetPrototype[IS_ORDERED_SENTINEL] = true;\n\n OrderedSetPrototype.__empty = emptyOrderedSet;\n OrderedSetPrototype.__make = makeOrderedSet;\n\n function makeOrderedSet(map, ownerID) {\n var set = Object.create(OrderedSetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_ORDERED_SET;\n function emptyOrderedSet() {\n return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));\n }\n\n createClass(Stack, IndexedCollection);\n\n // @pragma Construction\n\n function Stack(value) {\n return value === null || value === undefined ? emptyStack() :\n isStack(value) ? value :\n emptyStack().unshiftAll(value);\n }\n\n Stack.of = function(/*...values*/) {\n return this(arguments);\n };\n\n Stack.prototype.toString = function() {\n return this.__toString('Stack [', ']');\n };\n\n // @pragma Access\n\n Stack.prototype.get = function(index, notSetValue) {\n var head = this._head;\n index = wrapIndex(this, index);\n while (head && index--) {\n head = head.next;\n }\n return head ? head.value : notSetValue;\n };\n\n Stack.prototype.peek = function() {\n return this._head && this._head.value;\n };\n\n // @pragma Modification\n\n Stack.prototype.push = function(/*...values*/) {\n if (arguments.length === 0) {\n return this;\n }\n var newSize = this.size + arguments.length;\n var head = this._head;\n for (var ii = arguments.length - 1; ii >= 0; ii--) {\n head = {\n value: arguments[ii],\n next: head\n };\n }\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pushAll = function(iter) {\n iter = IndexedIterable(iter);\n if (iter.size === 0) {\n return this;\n }\n assertNotInfinite(iter.size);\n var newSize = this.size;\n var head = this._head;\n iter.reverse().forEach(function(value ) {\n newSize++;\n head = {\n value: value,\n next: head\n };\n });\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pop = function() {\n return this.slice(1);\n };\n\n Stack.prototype.unshift = function(/*...values*/) {\n return this.push.apply(this, arguments);\n };\n\n Stack.prototype.unshiftAll = function(iter) {\n return this.pushAll(iter);\n };\n\n Stack.prototype.shift = function() {\n return this.pop.apply(this, arguments);\n };\n\n Stack.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._head = undefined;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyStack();\n };\n\n Stack.prototype.slice = function(begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n var resolvedBegin = resolveBegin(begin, this.size);\n var resolvedEnd = resolveEnd(end, this.size);\n if (resolvedEnd !== this.size) {\n // super.slice(begin, end);\n return IndexedCollection.prototype.slice.call(this, begin, end);\n }\n var newSize = this.size - resolvedBegin;\n var head = this._head;\n while (resolvedBegin--) {\n head = head.next;\n }\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n // @pragma Mutability\n\n Stack.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeStack(this.size, this._head, ownerID, this.__hash);\n };\n\n // @pragma Iteration\n\n Stack.prototype.__iterate = function(fn, reverse) {\n if (reverse) {\n return this.reverse().__iterate(fn);\n }\n var iterations = 0;\n var node = this._head;\n while (node) {\n if (fn(node.value, iterations++, this) === false) {\n break;\n }\n node = node.next;\n }\n return iterations;\n };\n\n Stack.prototype.__iterator = function(type, reverse) {\n if (reverse) {\n return this.reverse().__iterator(type);\n }\n var iterations = 0;\n var node = this._head;\n return new Iterator(function() {\n if (node) {\n var value = node.value;\n node = node.next;\n return iteratorValue(type, iterations++, value);\n }\n return iteratorDone();\n });\n };\n\n\n function isStack(maybeStack) {\n return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);\n }\n\n Stack.isStack = isStack;\n\n var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';\n\n var StackPrototype = Stack.prototype;\n StackPrototype[IS_STACK_SENTINEL] = true;\n StackPrototype.withMutations = MapPrototype.withMutations;\n StackPrototype.asMutable = MapPrototype.asMutable;\n StackPrototype.asImmutable = MapPrototype.asImmutable;\n StackPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n function makeStack(size, head, ownerID, hash) {\n var map = Object.create(StackPrototype);\n map.size = size;\n map._head = head;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_STACK;\n function emptyStack() {\n return EMPTY_STACK || (EMPTY_STACK = makeStack(0));\n }\n\n /**\n * Contributes additional methods to a constructor\n */\n function mixin(ctor, methods) {\n var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; };\n Object.keys(methods).forEach(keyCopier);\n Object.getOwnPropertySymbols &&\n Object.getOwnPropertySymbols(methods).forEach(keyCopier);\n return ctor;\n }\n\n Iterable.Iterator = Iterator;\n\n mixin(Iterable, {\n\n // ### Conversion to other types\n\n toArray: function() {\n assertNotInfinite(this.size);\n var array = new Array(this.size || 0);\n this.valueSeq().__iterate(function(v, i) { array[i] = v; });\n return array;\n },\n\n toIndexedSeq: function() {\n return new ToIndexedSequence(this);\n },\n\n toJS: function() {\n return this.toSeq().map(\n function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value}\n ).__toJS();\n },\n\n toJSON: function() {\n return this.toSeq().map(\n function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value}\n ).__toJS();\n },\n\n toKeyedSeq: function() {\n return new ToKeyedSequence(this, true);\n },\n\n toMap: function() {\n // Use Late Binding here to solve the circular dependency.\n return Map(this.toKeyedSeq());\n },\n\n toObject: function() {\n assertNotInfinite(this.size);\n var object = {};\n this.__iterate(function(v, k) { object[k] = v; });\n return object;\n },\n\n toOrderedMap: function() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedMap(this.toKeyedSeq());\n },\n\n toOrderedSet: function() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedSet(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toSet: function() {\n // Use Late Binding here to solve the circular dependency.\n return Set(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toSetSeq: function() {\n return new ToSetSequence(this);\n },\n\n toSeq: function() {\n return isIndexed(this) ? this.toIndexedSeq() :\n isKeyed(this) ? this.toKeyedSeq() :\n this.toSetSeq();\n },\n\n toStack: function() {\n // Use Late Binding here to solve the circular dependency.\n return Stack(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toList: function() {\n // Use Late Binding here to solve the circular dependency.\n return List(isKeyed(this) ? this.valueSeq() : this);\n },\n\n\n // ### Common JavaScript methods and properties\n\n toString: function() {\n return '[Iterable]';\n },\n\n __toString: function(head, tail) {\n if (this.size === 0) {\n return head + tail;\n }\n return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail;\n },\n\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n concat: function() {var values = SLICE$0.call(arguments, 0);\n return reify(this, concatFactory(this, values));\n },\n\n includes: function(searchValue) {\n return this.some(function(value ) {return is(value, searchValue)});\n },\n\n entries: function() {\n return this.__iterator(ITERATE_ENTRIES);\n },\n\n every: function(predicate, context) {\n assertNotInfinite(this.size);\n var returnValue = true;\n this.__iterate(function(v, k, c) {\n if (!predicate.call(context, v, k, c)) {\n returnValue = false;\n return false;\n }\n });\n return returnValue;\n },\n\n filter: function(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, true));\n },\n\n find: function(predicate, context, notSetValue) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[1] : notSetValue;\n },\n\n findEntry: function(predicate, context) {\n var found;\n this.__iterate(function(v, k, c) {\n if (predicate.call(context, v, k, c)) {\n found = [k, v];\n return false;\n }\n });\n return found;\n },\n\n findLastEntry: function(predicate, context) {\n return this.toSeq().reverse().findEntry(predicate, context);\n },\n\n forEach: function(sideEffect, context) {\n assertNotInfinite(this.size);\n return this.__iterate(context ? sideEffect.bind(context) : sideEffect);\n },\n\n join: function(separator) {\n assertNotInfinite(this.size);\n separator = separator !== undefined ? '' + separator : ',';\n var joined = '';\n var isFirst = true;\n this.__iterate(function(v ) {\n isFirst ? (isFirst = false) : (joined += separator);\n joined += v !== null && v !== undefined ? v.toString() : '';\n });\n return joined;\n },\n\n keys: function() {\n return this.__iterator(ITERATE_KEYS);\n },\n\n map: function(mapper, context) {\n return reify(this, mapFactory(this, mapper, context));\n },\n\n reduce: function(reducer, initialReduction, context) {\n assertNotInfinite(this.size);\n var reduction;\n var useFirst;\n if (arguments.length < 2) {\n useFirst = true;\n } else {\n reduction = initialReduction;\n }\n this.__iterate(function(v, k, c) {\n if (useFirst) {\n useFirst = false;\n reduction = v;\n } else {\n reduction = reducer.call(context, reduction, v, k, c);\n }\n });\n return reduction;\n },\n\n reduceRight: function(reducer, initialReduction, context) {\n var reversed = this.toKeyedSeq().reverse();\n return reversed.reduce.apply(reversed, arguments);\n },\n\n reverse: function() {\n return reify(this, reverseFactory(this, true));\n },\n\n slice: function(begin, end) {\n return reify(this, sliceFactory(this, begin, end, true));\n },\n\n some: function(predicate, context) {\n return !this.every(not(predicate), context);\n },\n\n sort: function(comparator) {\n return reify(this, sortFactory(this, comparator));\n },\n\n values: function() {\n return this.__iterator(ITERATE_VALUES);\n },\n\n\n // ### More sequential methods\n\n butLast: function() {\n return this.slice(0, -1);\n },\n\n isEmpty: function() {\n return this.size !== undefined ? this.size === 0 : !this.some(function() {return true});\n },\n\n count: function(predicate, context) {\n return ensureSize(\n predicate ? this.toSeq().filter(predicate, context) : this\n );\n },\n\n countBy: function(grouper, context) {\n return countByFactory(this, grouper, context);\n },\n\n equals: function(other) {\n return deepEqual(this, other);\n },\n\n entrySeq: function() {\n var iterable = this;\n if (iterable._cache) {\n // We cache as an entries array, so we can just return the cache!\n return new ArraySeq(iterable._cache);\n }\n var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();\n entriesSequence.fromEntrySeq = function() {return iterable.toSeq()};\n return entriesSequence;\n },\n\n filterNot: function(predicate, context) {\n return this.filter(not(predicate), context);\n },\n\n findLast: function(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);\n },\n\n first: function() {\n return this.find(returnTrue);\n },\n\n flatMap: function(mapper, context) {\n return reify(this, flatMapFactory(this, mapper, context));\n },\n\n flatten: function(depth) {\n return reify(this, flattenFactory(this, depth, true));\n },\n\n fromEntrySeq: function() {\n return new FromEntriesSequence(this);\n },\n\n get: function(searchKey, notSetValue) {\n return this.find(function(_, key) {return is(key, searchKey)}, undefined, notSetValue);\n },\n\n getIn: function(searchKeyPath, notSetValue) {\n var nested = this;\n // Note: in an ES6 environment, we would prefer:\n // for (var key of searchKeyPath) {\n var iter = forceIterator(searchKeyPath);\n var step;\n while (!(step = iter.next()).done) {\n var key = step.value;\n nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET;\n if (nested === NOT_SET) {\n return notSetValue;\n }\n }\n return nested;\n },\n\n groupBy: function(grouper, context) {\n return groupByFactory(this, grouper, context);\n },\n\n has: function(searchKey) {\n return this.get(searchKey, NOT_SET) !== NOT_SET;\n },\n\n hasIn: function(searchKeyPath) {\n return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;\n },\n\n isSubset: function(iter) {\n iter = typeof iter.includes === 'function' ? iter : Iterable(iter);\n return this.every(function(value ) {return iter.includes(value)});\n },\n\n isSuperset: function(iter) {\n iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter);\n return iter.isSubset(this);\n },\n\n keySeq: function() {\n return this.toSeq().map(keyMapper).toIndexedSeq();\n },\n\n last: function() {\n return this.toSeq().reverse().first();\n },\n\n max: function(comparator) {\n return maxFactory(this, comparator);\n },\n\n maxBy: function(mapper, comparator) {\n return maxFactory(this, comparator, mapper);\n },\n\n min: function(comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);\n },\n\n minBy: function(mapper, comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);\n },\n\n rest: function() {\n return this.slice(1);\n },\n\n skip: function(amount) {\n return this.slice(Math.max(0, amount));\n },\n\n skipLast: function(amount) {\n return reify(this, this.toSeq().reverse().skip(amount).reverse());\n },\n\n skipWhile: function(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, true));\n },\n\n skipUntil: function(predicate, context) {\n return this.skipWhile(not(predicate), context);\n },\n\n sortBy: function(mapper, comparator) {\n return reify(this, sortFactory(this, comparator, mapper));\n },\n\n take: function(amount) {\n return this.slice(0, Math.max(0, amount));\n },\n\n takeLast: function(amount) {\n return reify(this, this.toSeq().reverse().take(amount).reverse());\n },\n\n takeWhile: function(predicate, context) {\n return reify(this, takeWhileFactory(this, predicate, context));\n },\n\n takeUntil: function(predicate, context) {\n return this.takeWhile(not(predicate), context);\n },\n\n valueSeq: function() {\n return this.toIndexedSeq();\n },\n\n\n // ### Hashable Object\n\n hashCode: function() {\n return this.__hash || (this.__hash = hashIterable(this));\n }\n\n\n // ### Internal\n\n // abstract __iterate(fn, reverse)\n\n // abstract __iterator(type, reverse)\n });\n\n // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n var IterablePrototype = Iterable.prototype;\n IterablePrototype[IS_ITERABLE_SENTINEL] = true;\n IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values;\n IterablePrototype.__toJS = IterablePrototype.toArray;\n IterablePrototype.__toStringMapper = quoteString;\n IterablePrototype.inspect =\n IterablePrototype.toSource = function() { return this.toString(); };\n IterablePrototype.chain = IterablePrototype.flatMap;\n IterablePrototype.contains = IterablePrototype.includes;\n\n // Temporary warning about using length\n (function () {\n try {\n Object.defineProperty(IterablePrototype, 'length', {\n get: function () {\n if (!Iterable.noLengthWarning) {\n var stack;\n try {\n throw new Error();\n } catch (error) {\n stack = error.stack;\n }\n if (stack.indexOf('_wrapObject') === -1) {\n console && console.warn && console.warn(\n 'iterable.length has been deprecated, '+\n 'use iterable.size or iterable.count(). '+\n 'This warning will become a silent error in a future version. ' +\n stack\n );\n return this.size;\n }\n }\n }\n });\n } catch (e) {}\n })();\n\n\n\n mixin(KeyedIterable, {\n\n // ### More sequential methods\n\n flip: function() {\n return reify(this, flipFactory(this));\n },\n\n findKey: function(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry && entry[0];\n },\n\n findLastKey: function(predicate, context) {\n return this.toSeq().reverse().findKey(predicate, context);\n },\n\n keyOf: function(searchValue) {\n return this.findKey(function(value ) {return is(value, searchValue)});\n },\n\n lastKeyOf: function(searchValue) {\n return this.findLastKey(function(value ) {return is(value, searchValue)});\n },\n\n mapEntries: function(mapper, context) {var this$0 = this;\n var iterations = 0;\n return reify(this,\n this.toSeq().map(\n function(v, k) {return mapper.call(context, [k, v], iterations++, this$0)}\n ).fromEntrySeq()\n );\n },\n\n mapKeys: function(mapper, context) {var this$0 = this;\n return reify(this,\n this.toSeq().flip().map(\n function(k, v) {return mapper.call(context, k, v, this$0)}\n ).flip()\n );\n }\n\n });\n\n var KeyedIterablePrototype = KeyedIterable.prototype;\n KeyedIterablePrototype[IS_KEYED_SENTINEL] = true;\n KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries;\n KeyedIterablePrototype.__toJS = IterablePrototype.toObject;\n KeyedIterablePrototype.__toStringMapper = function(v, k) {return JSON.stringify(k) + ': ' + quoteString(v)};\n\n\n\n mixin(IndexedIterable, {\n\n // ### Conversion to other types\n\n toKeyedSeq: function() {\n return new ToKeyedSequence(this, false);\n },\n\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n filter: function(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, false));\n },\n\n findIndex: function(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n\n indexOf: function(searchValue) {\n var key = this.toKeyedSeq().keyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n\n lastIndexOf: function(searchValue) {\n var key = this.toKeyedSeq().reverse().keyOf(searchValue);\n return key === undefined ? -1 : key;\n\n // var index =\n // return this.toSeq().reverse().indexOf(searchValue);\n },\n\n reverse: function() {\n return reify(this, reverseFactory(this, false));\n },\n\n slice: function(begin, end) {\n return reify(this, sliceFactory(this, begin, end, false));\n },\n\n splice: function(index, removeNum /*, ...values*/) {\n var numArgs = arguments.length;\n removeNum = Math.max(removeNum | 0, 0);\n if (numArgs === 0 || (numArgs === 2 && !removeNum)) {\n return this;\n }\n // If index is negative, it should resolve relative to the size of the\n // collection. However size may be expensive to compute if not cached, so\n // only call count() if the number is in fact negative.\n index = resolveBegin(index, index < 0 ? this.count() : this.size);\n var spliced = this.slice(0, index);\n return reify(\n this,\n numArgs === 1 ?\n spliced :\n spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))\n );\n },\n\n\n // ### More collection methods\n\n findLastIndex: function(predicate, context) {\n var key = this.toKeyedSeq().findLastKey(predicate, context);\n return key === undefined ? -1 : key;\n },\n\n first: function() {\n return this.get(0);\n },\n\n flatten: function(depth) {\n return reify(this, flattenFactory(this, depth, false));\n },\n\n get: function(index, notSetValue) {\n index = wrapIndex(this, index);\n return (index < 0 || (this.size === Infinity ||\n (this.size !== undefined && index > this.size))) ?\n notSetValue :\n this.find(function(_, key) {return key === index}, undefined, notSetValue);\n },\n\n has: function(index) {\n index = wrapIndex(this, index);\n return index >= 0 && (this.size !== undefined ?\n this.size === Infinity || index < this.size :\n this.indexOf(index) !== -1\n );\n },\n\n interpose: function(separator) {\n return reify(this, interposeFactory(this, separator));\n },\n\n interleave: function(/*...iterables*/) {\n var iterables = [this].concat(arrCopy(arguments));\n var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables);\n var interleaved = zipped.flatten(true);\n if (zipped.size) {\n interleaved.size = zipped.size * iterables.length;\n }\n return reify(this, interleaved);\n },\n\n last: function() {\n return this.get(-1);\n },\n\n skipWhile: function(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, false));\n },\n\n zip: function(/*, ...iterables */) {\n var iterables = [this].concat(arrCopy(arguments));\n return reify(this, zipWithFactory(this, defaultZipper, iterables));\n },\n\n zipWith: function(zipper/*, ...iterables */) {\n var iterables = arrCopy(arguments);\n iterables[0] = this;\n return reify(this, zipWithFactory(this, zipper, iterables));\n }\n\n });\n\n IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true;\n IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n\n mixin(SetIterable, {\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n get: function(value, notSetValue) {\n return this.has(value) ? value : notSetValue;\n },\n\n includes: function(value) {\n return this.has(value);\n },\n\n\n // ### More sequential methods\n\n keySeq: function() {\n return this.valueSeq();\n }\n\n });\n\n SetIterable.prototype.has = IterablePrototype.includes;\n\n\n // Mixin subclasses\n\n mixin(KeyedSeq, KeyedIterable.prototype);\n mixin(IndexedSeq, IndexedIterable.prototype);\n mixin(SetSeq, SetIterable.prototype);\n\n mixin(KeyedCollection, KeyedIterable.prototype);\n mixin(IndexedCollection, IndexedIterable.prototype);\n mixin(SetCollection, SetIterable.prototype);\n\n\n // #pragma Helper functions\n\n function keyMapper(v, k) {\n return k;\n }\n\n function entryMapper(v, k) {\n return [k, v];\n }\n\n function not(predicate) {\n return function() {\n return !predicate.apply(this, arguments);\n }\n }\n\n function neg(predicate) {\n return function() {\n return -predicate.apply(this, arguments);\n }\n }\n\n function quoteString(value) {\n return typeof value === 'string' ? JSON.stringify(value) : value;\n }\n\n function defaultZipper() {\n return arrCopy(arguments);\n }\n\n function defaultNegComparator(a, b) {\n return a < b ? 1 : a > b ? -1 : 0;\n }\n\n function hashIterable(iterable) {\n if (iterable.size === Infinity) {\n return 0;\n }\n var ordered = isOrdered(iterable);\n var keyed = isKeyed(iterable);\n var h = ordered ? 1 : 0;\n var size = iterable.__iterate(\n keyed ?\n ordered ?\n function(v, k) { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } :\n function(v, k) { h = h + hashMerge(hash(v), hash(k)) | 0; } :\n ordered ?\n function(v ) { h = 31 * h + hash(v) | 0; } :\n function(v ) { h = h + hash(v) | 0; }\n );\n return murmurHashOfSize(size, h);\n }\n\n function murmurHashOfSize(size, h) {\n h = imul(h, 0xCC9E2D51);\n h = imul(h << 15 | h >>> -15, 0x1B873593);\n h = imul(h << 13 | h >>> -13, 5);\n h = (h + 0xE6546B64 | 0) ^ size;\n h = imul(h ^ h >>> 16, 0x85EBCA6B);\n h = imul(h ^ h >>> 13, 0xC2B2AE35);\n h = smi(h ^ h >>> 16);\n return h;\n }\n\n function hashMerge(a, b) {\n return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int\n }\n\n var Immutable = {\n\n Iterable: Iterable,\n\n Seq: Seq,\n Collection: Collection,\n Map: Map,\n OrderedMap: OrderedMap,\n List: List,\n Stack: Stack,\n Set: Set,\n OrderedSet: OrderedSet,\n\n Record: Record,\n Range: Range,\n Repeat: Repeat,\n\n is: is,\n fromJS: fromJS\n\n };\n\n return Immutable;\n\n}));\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/immutable/dist/immutable.js\n ** module id = 229\n ** module chunks = 0\n **/","import $ from 'jquery';\n\n// jQuery no parents filter\n$.expr[':']['noparents'] = $.expr.createPseudo((text) => (element) => $(element).parents(text).length < 1);\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/utils/jquery-utils.js\n **/","import $ from 'jquery';\nimport toastr from '../utils/toastr';\nimport { translations } from 'grav-config';\nimport { Instance as FormState } from './state';\n\nexport default class Form {\n constructor(form) {\n this.form = $(form);\n if (!this.form.length || this.form.prop('tagName').toLowerCase() !== 'form') { return; }\n\n this.form.on('submit', (event) => {\n if (FormState.equals()) {\n event.preventDefault();\n toastr.info(translations.PLUGIN_ADMIN.NOTHING_TO_SAVE);\n }\n });\n\n this._attachShortcuts();\n this._attachToggleables();\n this._attachDisabledFields();\n\n this.observer = new MutationObserver(this.addedNodes);\n this.form.each((index, form) => this.observer.observe(form, { subtree: true, childList: true }));\n }\n\n _attachShortcuts() {\n // CTRL + S / CMD + S - shortcut for [Save] when available\n let saveTask = $('[name=\"task\"][value=\"save\"]').filter(function(index, element) {\n element = $(element);\n return !(element.parents('.remodal-overlay').length);\n });\n\n if (saveTask.length) {\n $(window).on('keydown', function(event) {\n var key = String.fromCharCode(event.which).toLowerCase();\n if ((event.ctrlKey || event.metaKey) && key === 's') {\n event.preventDefault();\n saveTask.click();\n }\n });\n }\n }\n\n _attachToggleables() {\n let query = '[data-grav-field=\"toggleable\"] input[type=\"checkbox\"]';\n\n this.form.on('change', query, (event) => {\n let toggle = $(event.target);\n let enabled = toggle.is(':checked');\n let parent = toggle.parents('.form-field');\n let label = parent.find('label.toggleable');\n let fields = parent.find('.form-data');\n let inputs = fields.find('input, select, textarea');\n\n label.add(fields).css('opacity', enabled ? '' : 0.7);\n inputs.map((index, input) => {\n let isSelectize = input.selectize;\n input = $(input);\n\n if (isSelectize) {\n isSelectize[enabled ? 'enable' : 'disable']();\n } else {\n input.prop('disabled', !enabled);\n }\n });\n });\n\n this.form.find(query).trigger('change');\n }\n\n _attachDisabledFields() {\n let prefix = '.form-field-toggleable .form-data';\n let query = [];\n\n ['input', 'select', 'label[for]', 'textarea', '.selectize-control'].forEach((item) => {\n query.push(`${prefix} ${item}`);\n });\n\n this.form.on('mousedown', query.join(', '), (event) => {\n let target = $(event.target);\n let input = target;\n let isFor = input.prop('for');\n let isSelectize = (input.hasClass('selectize-control') || input.parents('.selectize-control')).length;\n\n if (isFor) { input = $(`[id=\"${isFor}\"]`); }\n if (isSelectize) { input = input.closest('.selectize-control').siblings('select[name]'); }\n\n if (!input.prop('disabled')) { return true; }\n\n let toggle = input.closest('.form-field').find('[data-grav-field=\"toggleable\"] input[type=\"checkbox\"]');\n toggle.trigger('click');\n });\n }\n\n addedNodes(mutations) {\n mutations.forEach((mutation) => {\n if (mutation.type !== 'childList' || !mutation.addedNodes) { return; }\n\n $('body').trigger('mutation._grav', mutation.target, mutation, this);\n });\n }\n}\n\nexport let Instance = new Form('form#blueprints');\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/forms/form.js\n **/","import SelectizeField, { Instance as SelectizeFieldInstance } from './selectize';\nimport ArrayField, { Instance as ArrayFieldInstance } from './array';\nimport CollectionsField, { Instance as CollectionsFieldInstance } from './collections';\n\nexport default {\n SelectizeField: {\n SelectizeField,\n Instance: SelectizeFieldInstance\n },\n ArrayField: {\n ArrayField,\n Instance: ArrayFieldInstance\n },\n CollectionsField: {\n CollectionsField,\n Instance: CollectionsFieldInstance\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/forms/fields/index.js\n **/","import $ from 'jquery';\nimport 'selectize';\n\nexport default class SelectizeField {\n constructor(options = {}) {\n this.options = Object.assign({}, options);\n this.elements = [];\n\n $('[data-grav-selectize]').each((index, element) => this.add(element));\n $('body').on('mutation._grav', this._onAddedNodes.bind(this));\n }\n\n add(element) {\n element = $(element);\n let tag = element.prop('tagName').toLowerCase();\n let isInput = tag === 'input' || tag === 'select';\n\n let data = (isInput ? element.closest('[data-grav-selectize]') : element).data('grav-selectize') || {};\n let field = (isInput ? element : element.find('input, select'));\n\n if (!field.length || field.get(0).selectize) { return; }\n field.selectize(data);\n\n this.elements.push(field.data('selectize'));\n }\n\n _onAddedNodes(event, target/* , record, instance */) {\n let fields = $(target).find('select.fancy, input.fancy');\n if (!fields.length) { return; }\n\n fields.each((index, field) => this.add(field));\n }\n}\n\nexport let Instance = new SelectizeField();\n\n\n\n/** WEBPACK FOOTER **\n ** ./app/forms/fields/selectize.js\n **/","import $ from 'jquery';\n\nlet body = $('body');\n\nclass Template {\n constructor(container) {\n this.container = $(container);\n\n if (this.getName() === undefined) {\n this.container = this.container.closest('[data-grav-array-name]');\n }\n }\n\n getName() {\n return this.container.data('grav-array-name') || '';\n }\n\n getKeyPlaceholder() {\n return this.container.data('grav-array-keyname') || 'Key';\n }\n\n getValuePlaceholder() {\n return this.container.data('grav-array-valuename') || 'Value';\n }\n\n isValueOnly() {\n return this.container.find('[data-grav-array-mode=\"value_only\"]:first').length || false;\n }\n\n shouldBeDisabled() {\n // check for toggleables, if field is toggleable and it's not enabled, render disabled\n let toggle = this.container.closest('.form-field').find('[data-grav-field=\"toggleable\"] input[type=\"checkbox\"]');\n return toggle.length && toggle.is(':not(:checked)');\n }\n\n getNewRow() {\n let tpl = '';\n\n if (this.isValueOnly()) {\n tpl += `\n